fix: import compatibility with ts-node/esm
see https://github.com/TypeStrong/ts-node/issues/1934
This commit is contained in:
parent
392ff5ad2d
commit
0b2ae3aac6
7 changed files with 21 additions and 16 deletions
|
@ -1,4 +1,5 @@
|
||||||
const { MemoryStorage } = require('@mtcute/core/storage/memory.js')
|
const { MemoryStorage } = require('@mtcute/core/storage/memory.js')
|
||||||
|
const { LogManager } = require('@mtcute/core/utils.js')
|
||||||
|
|
||||||
exports.getApiParams = () => {
|
exports.getApiParams = () => {
|
||||||
if (!process.env.API_ID || !process.env.API_HASH) {
|
if (!process.env.API_ID || !process.env.API_HASH) {
|
||||||
|
@ -10,5 +11,6 @@ exports.getApiParams = () => {
|
||||||
apiHash: process.env.API_HASH,
|
apiHash: process.env.API_HASH,
|
||||||
testMode: true,
|
testMode: true,
|
||||||
storage: new MemoryStorage(),
|
storage: new MemoryStorage(),
|
||||||
|
logLevel: LogManager.DEBUG,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { MemoryStorage } from '@mtcute/core/storage/memory.js'
|
import { MemoryStorage } from '@mtcute/core/storage/memory.js'
|
||||||
|
import { LogManager } from '@mtcute/core/utils.js'
|
||||||
|
|
||||||
export const getApiParams = () => {
|
export const getApiParams = () => {
|
||||||
if (!process.env.API_ID || !process.env.API_HASH) {
|
if (!process.env.API_ID || !process.env.API_HASH) {
|
||||||
|
@ -10,5 +11,6 @@ export const getApiParams = () => {
|
||||||
apiHash: process.env.API_HASH,
|
apiHash: process.env.API_HASH,
|
||||||
testMode: true,
|
testMode: true,
|
||||||
storage: new MemoryStorage(),
|
storage: new MemoryStorage(),
|
||||||
|
logLevel: LogManager.DEBUG,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
/* eslint-disable no-restricted-globals */
|
|
||||||
const cp = require('child_process')
|
const cp = require('child_process')
|
||||||
|
|
||||||
const { fixForEsm } = require('./build-esm.cjs')
|
const { fixForEsm } = require('./build-esm.cjs')
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { BaseTelegramClientOptions } from '@mtcute/core'
|
import { BaseTelegramClientOptions } from '@mtcute/core'
|
||||||
import { MemoryStorage } from '@mtcute/core/storage/memory.js'
|
import { MemoryStorage } from '@mtcute/core/storage/memory.js'
|
||||||
|
import { LogManager } from '@mtcute/core/utils.js'
|
||||||
|
|
||||||
export const getApiParams = (): BaseTelegramClientOptions => {
|
export const getApiParams = (): BaseTelegramClientOptions => {
|
||||||
if (!process.env.API_ID || !process.env.API_HASH) {
|
if (!process.env.API_ID || !process.env.API_HASH) {
|
||||||
|
@ -11,5 +12,6 @@ export const getApiParams = (): BaseTelegramClientOptions => {
|
||||||
apiHash: process.env.API_HASH,
|
apiHash: process.env.API_HASH,
|
||||||
testMode: true,
|
testMode: true,
|
||||||
storage: new MemoryStorage(),
|
storage: new MemoryStorage(),
|
||||||
|
logLevel: LogManager.DEBUG,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,9 +18,9 @@
|
||||||
"import": "./esm/index.js",
|
"import": "./esm/index.js",
|
||||||
"require": "./cjs/index.js"
|
"require": "./cjs/index.js"
|
||||||
},
|
},
|
||||||
"./methods/*.js": {
|
"./methods/*": {
|
||||||
"import": "./esm/methods/*.js",
|
"import": "./esm/methods/*",
|
||||||
"require": "./cjs/methods/*.js"
|
"require": "./cjs/methods/*"
|
||||||
},
|
},
|
||||||
"./utils.js": {
|
"./utils.js": {
|
||||||
"import": "./esm/utils/index.js",
|
"import": "./esm/utils/index.js",
|
||||||
|
|
|
@ -27,17 +27,17 @@
|
||||||
"import": "./esm/utils/index.js",
|
"import": "./esm/utils/index.js",
|
||||||
"require": "./cjs/utils/index.js"
|
"require": "./cjs/utils/index.js"
|
||||||
},
|
},
|
||||||
"./utils/crypto/*.js": {
|
"./utils/crypto/*": {
|
||||||
"import": "./esm/utils/crypto/*.js",
|
"import": "./esm/utils/crypto/*",
|
||||||
"require": "./cjs/utils/crypto/*.js"
|
"require": "./cjs/utils/crypto/*"
|
||||||
},
|
},
|
||||||
"./network/transports/*.js": {
|
"./network/transports/*": {
|
||||||
"import": "./esm/network/transports/*.js",
|
"import": "./esm/network/transports/*",
|
||||||
"require": "./cjs/network/transports/*.js"
|
"require": "./cjs/network/transports/*"
|
||||||
},
|
},
|
||||||
"./storage/*.js": {
|
"./storage/*": {
|
||||||
"import": "./esm/storage/*.js",
|
"import": "./esm/storage/*",
|
||||||
"require": "./cjs/storage/*.js"
|
"require": "./cjs/storage/*"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -16,9 +16,9 @@
|
||||||
"import": "./esm/index.js",
|
"import": "./esm/index.js",
|
||||||
"require": "./cjs/index.js"
|
"require": "./cjs/index.js"
|
||||||
},
|
},
|
||||||
"./plurals/*.js": {
|
"./plurals/*": {
|
||||||
"import": "./esm/plurals/*.js",
|
"import": "./esm/plurals/*",
|
||||||
"require": "./cjs/plurals/*.js"
|
"require": "./cjs/plurals/*"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue