mirror of
https://github.com/chatmail/core.git
synced 2026-04-21 15:36:30 +03:00
build(node): migrate from CommonJS to ESM modules
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
import { join } from 'path'
|
||||
import * as url from 'url'
|
||||
|
||||
/**
|
||||
* bindings are not typed yet.
|
||||
* if the available function names are required they can be found inside of `../src/module.c`
|
||||
*/
|
||||
export const bindings: any = require('node-gyp-build')(join(__dirname, '../'))
|
||||
import build from 'node-gyp-build'
|
||||
export const bindings: any = build(
|
||||
join(url.fileURLToPath(new URL('.', import.meta.url)), '../')
|
||||
)
|
||||
|
||||
export default bindings
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/* eslint-disable camelcase */
|
||||
|
||||
import binding from './binding'
|
||||
import binding from './binding.js'
|
||||
import rawDebug from 'debug'
|
||||
const debug = rawDebug('deltachat:node:chat')
|
||||
import { C } from './constants'
|
||||
import { integerToHexColor } from './util'
|
||||
import { ChatJSON } from './types'
|
||||
import { C } from './constants.js'
|
||||
import { integerToHexColor } from './util.js'
|
||||
import { ChatJSON } from './types.js'
|
||||
|
||||
interface NativeChat {}
|
||||
/**
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
/* eslint-disable camelcase */
|
||||
|
||||
import binding from './binding'
|
||||
import { Lot } from './lot'
|
||||
import { Chat } from './chat'
|
||||
const debug = require('debug')('deltachat:node:chatlist')
|
||||
import binding from './binding.js'
|
||||
import { Lot } from './lot.js'
|
||||
import { Chat } from './chat.js'
|
||||
import rawDebug from 'debug'
|
||||
const debug = rawDebug('deltachat:node:chatlist')
|
||||
|
||||
interface NativeChatList {}
|
||||
/**
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { integerToHexColor } from './util'
|
||||
import { integerToHexColor } from './util.js'
|
||||
|
||||
/* eslint-disable camelcase */
|
||||
|
||||
import binding from './binding'
|
||||
const debug = require('debug')('deltachat:node:contact')
|
||||
import binding from './binding.js'
|
||||
import rawDebug from 'debug'
|
||||
const debug = rawDebug('deltachat:node:contact')
|
||||
|
||||
interface NativeContact {}
|
||||
/**
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/* eslint-disable camelcase */
|
||||
|
||||
import binding from './binding'
|
||||
import { C, EventId2EventName } from './constants'
|
||||
import { Chat } from './chat'
|
||||
import { ChatList } from './chatlist'
|
||||
import { Contact } from './contact'
|
||||
import { Message } from './message'
|
||||
import { Lot } from './lot'
|
||||
import { Locations } from './locations'
|
||||
import binding from './binding.js'
|
||||
import { C, EventId2EventName } from './constants.js'
|
||||
import { Chat } from './chat.js'
|
||||
import { ChatList } from './chatlist.js'
|
||||
import { Contact } from './contact.js'
|
||||
import { Message } from './message.js'
|
||||
import { Lot } from './lot.js'
|
||||
import { Locations } from './locations.js'
|
||||
import rawDebug from 'debug'
|
||||
import { AccountManager } from './deltachat'
|
||||
import { AccountManager } from './deltachat.js'
|
||||
import { join } from 'path'
|
||||
import { EventEmitter } from 'stream'
|
||||
import { EventEmitter } from 'events'
|
||||
const debug = rawDebug('deltachat:node:index')
|
||||
|
||||
const noop = function () {}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* eslint-disable camelcase */
|
||||
|
||||
import binding from './binding'
|
||||
import { EventId2EventName } from './constants'
|
||||
import binding from './binding.js'
|
||||
import { EventId2EventName } from './constants.js'
|
||||
import { EventEmitter } from 'events'
|
||||
import { existsSync } from 'fs'
|
||||
import rawDebug from 'debug'
|
||||
import { tmpdir } from 'os'
|
||||
import { join } from 'path'
|
||||
import { Context } from './context'
|
||||
import { Context } from './context.js'
|
||||
const debug = rawDebug('deltachat:node:index')
|
||||
|
||||
const noop = function () {}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import { AccountManager } from './deltachat'
|
||||
import { AccountManager } from './deltachat.js'
|
||||
|
||||
export default AccountManager
|
||||
|
||||
export { Context } from './context'
|
||||
export { Chat } from './chat'
|
||||
export { ChatList } from './chatlist'
|
||||
export { C } from './constants'
|
||||
export { Contact } from './contact'
|
||||
export { Context } from './context.js'
|
||||
export { Chat } from './chat.js'
|
||||
export { ChatList } from './chatlist.js'
|
||||
export { C } from './constants.js'
|
||||
export { Contact } from './contact.js'
|
||||
export { AccountManager as DeltaChat }
|
||||
export { Locations } from './locations'
|
||||
export { Lot } from './lot'
|
||||
export { Locations } from './locations.js'
|
||||
export { Lot } from './lot.js'
|
||||
export {
|
||||
Message,
|
||||
MessageState,
|
||||
MessageViewType,
|
||||
MessageDownloadState,
|
||||
} from './message'
|
||||
} from './message.js'
|
||||
|
||||
export * from './types'
|
||||
export * from './types.js'
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/* eslint-disable camelcase */
|
||||
|
||||
const binding = require('../binding')
|
||||
const debug = require('debug')('deltachat:node:locations')
|
||||
import binding from './binding.js'
|
||||
import rawDebug from 'debug'
|
||||
const debug = rawDebug('deltachat:node:locations')
|
||||
|
||||
interface NativeLocations {}
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/* eslint-disable camelcase */
|
||||
|
||||
const binding = require('../binding')
|
||||
const debug = require('debug')('deltachat:node:lot')
|
||||
import binding from './binding.js'
|
||||
import rawDebug from 'debug'
|
||||
const debug = rawDebug('deltachat:node:lot')
|
||||
|
||||
interface NativeLot {}
|
||||
/**
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
/* eslint-disable camelcase */
|
||||
|
||||
import binding from './binding'
|
||||
import { C } from './constants'
|
||||
import { Lot } from './lot'
|
||||
import { Chat } from './chat'
|
||||
import { WebxdcInfo } from './context'
|
||||
const debug = require('debug')('deltachat:node:message')
|
||||
import binding from './binding.js'
|
||||
import { C } from './constants.js'
|
||||
import { Lot } from './lot.js'
|
||||
import { Chat } from './chat.js'
|
||||
import { WebxdcInfo } from './context.js'
|
||||
import rawDebug from 'debug'
|
||||
const debug = rawDebug('deltachat:node:message')
|
||||
|
||||
export enum MessageDownloadState {
|
||||
Available = C.DC_DOWNLOAD_AVAILABLE,
|
||||
|
||||
1
node/lib/node-gyp-build.d.ts
vendored
Normal file
1
node/lib/node-gyp-build.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
declare module 'node-gyp-build'
|
||||
@@ -1,4 +1,4 @@
|
||||
import { C } from './constants'
|
||||
import { C } from './constants.js'
|
||||
|
||||
export type ChatTypes =
|
||||
| C.DC_CHAT_TYPE_GROUP
|
||||
|
||||
Reference in New Issue
Block a user