fix: import EventEmitter from events
, not node:events
thanks sindresorhus for not making an option to disable this lint for a specific package lol
This commit is contained in:
parent
d52682acc3
commit
f621b0e81a
13 changed files with 33 additions and 11 deletions
|
@ -43,7 +43,9 @@ if (typeof globalThis !== 'undefined' && !globalThis._MTCUTE_CJS_DEPRECATION_WAR
|
|||
rollupOptions: {
|
||||
plugins: [
|
||||
...(customConfig?.rollupPluginsPre ?? []),
|
||||
nodeExternals(),
|
||||
nodeExternals({
|
||||
builtinsPrefix: 'ignore',
|
||||
}),
|
||||
{
|
||||
name: 'mtcute-finalize',
|
||||
renderChunk(code, chunk, options) {
|
||||
|
|
|
@ -78,6 +78,15 @@ export default defineConfig({
|
|||
return code
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'fix-events',
|
||||
transform(code) {
|
||||
if (!code.includes('events')) return code
|
||||
return code.replace(/^import (.+?) from ['"]events['"]/gms, (_, name) => {
|
||||
return `import ${name} from 'node:events'`
|
||||
})
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'fix-wasm-load',
|
||||
async transform(code) {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import EventEmitter from 'node:events'
|
||||
// eslint-disable-next-line unicorn/prefer-node-protocol
|
||||
import EventEmitter from 'events'
|
||||
|
||||
import type { Socket } from 'bun'
|
||||
import type { IPacketCodec, ITelegramTransport } from '@mtcute/core'
|
||||
|
|
|
@ -464,6 +464,7 @@ async function main() {
|
|||
output.write(
|
||||
'/* eslint-disable ts/no-unsafe-declaration-merging, ts/no-unsafe-argument */\n'
|
||||
+ '/* THIS FILE WAS AUTO-GENERATED */\n'
|
||||
+ '// eslint-disable-next-line unicorn/prefer-node-protocol\n'
|
||||
+ "import EventEmitter from 'events'\n"
|
||||
+ "import Long from 'long'\n",
|
||||
)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* eslint-disable ts/no-unsafe-declaration-merging, ts/no-unsafe-argument */
|
||||
/* THIS FILE WAS AUTO-GENERATED */
|
||||
import EventEmitter from 'node:events'
|
||||
// eslint-disable-next-line unicorn/prefer-node-protocol
|
||||
import EventEmitter from 'events'
|
||||
|
||||
import type Long from 'long'
|
||||
import type { tdFileId } from '@mtcute/file-id'
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import EventEmitter from 'node:events'
|
||||
// eslint-disable-next-line unicorn/prefer-node-protocol
|
||||
import EventEmitter from 'events'
|
||||
|
||||
import type { mtp } from '@mtcute/tl'
|
||||
import { tl } from '@mtcute/tl'
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import EventEmitter from 'node:events'
|
||||
// eslint-disable-next-line unicorn/prefer-node-protocol
|
||||
import EventEmitter from 'events'
|
||||
|
||||
import type { mtp, tl } from '@mtcute/tl'
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import EventEmitter from 'node:events'
|
||||
// eslint-disable-next-line unicorn/prefer-node-protocol
|
||||
import EventEmitter from 'events'
|
||||
|
||||
import { MtcuteError } from '../types/index.js'
|
||||
import type { BasicDcOption, ICryptoProvider, Logger } from '../utils/index.js'
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import type EventEmitter from 'node:events'
|
||||
// eslint-disable-next-line unicorn/prefer-node-protocol
|
||||
import type EventEmitter from 'events'
|
||||
|
||||
import type { tl } from '@mtcute/tl'
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import EventEmitter from 'node:events'
|
||||
// eslint-disable-next-line unicorn/prefer-node-protocol
|
||||
import EventEmitter from 'events'
|
||||
|
||||
import { concatBuffers } from '../../utils/index.js'
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import EventEmitter from 'node:events'
|
||||
// eslint-disable-next-line unicorn/prefer-node-protocol
|
||||
import EventEmitter from 'events'
|
||||
|
||||
import type { ICryptoProvider, Logger } from '../../utils/index.js'
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import EventEmitter from 'node:events'
|
||||
// eslint-disable-next-line unicorn/prefer-node-protocol
|
||||
import EventEmitter from 'events'
|
||||
|
||||
import type { ITelegramTransport } from '@mtcute/core'
|
||||
import { TransportState } from '@mtcute/core'
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import EventEmitter from 'node:events'
|
||||
// eslint-disable-next-line unicorn/prefer-node-protocol
|
||||
import EventEmitter from 'events'
|
||||
|
||||
import type {
|
||||
IPacketCodec,
|
||||
|
|
Loading…
Reference in a new issue