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: {
|
rollupOptions: {
|
||||||
plugins: [
|
plugins: [
|
||||||
...(customConfig?.rollupPluginsPre ?? []),
|
...(customConfig?.rollupPluginsPre ?? []),
|
||||||
nodeExternals(),
|
nodeExternals({
|
||||||
|
builtinsPrefix: 'ignore',
|
||||||
|
}),
|
||||||
{
|
{
|
||||||
name: 'mtcute-finalize',
|
name: 'mtcute-finalize',
|
||||||
renderChunk(code, chunk, options) {
|
renderChunk(code, chunk, options) {
|
||||||
|
|
|
@ -78,6 +78,15 @@ export default defineConfig({
|
||||||
return code
|
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',
|
name: 'fix-wasm-load',
|
||||||
async transform(code) {
|
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 { Socket } from 'bun'
|
||||||
import type { IPacketCodec, ITelegramTransport } from '@mtcute/core'
|
import type { IPacketCodec, ITelegramTransport } from '@mtcute/core'
|
||||||
|
|
|
@ -464,6 +464,7 @@ async function main() {
|
||||||
output.write(
|
output.write(
|
||||||
'/* eslint-disable ts/no-unsafe-declaration-merging, ts/no-unsafe-argument */\n'
|
'/* eslint-disable ts/no-unsafe-declaration-merging, ts/no-unsafe-argument */\n'
|
||||||
+ '/* THIS FILE WAS AUTO-GENERATED */\n'
|
+ '/* THIS FILE WAS AUTO-GENERATED */\n'
|
||||||
|
+ '// eslint-disable-next-line unicorn/prefer-node-protocol\n'
|
||||||
+ "import EventEmitter from 'events'\n"
|
+ "import EventEmitter from 'events'\n"
|
||||||
+ "import Long from 'long'\n",
|
+ "import Long from 'long'\n",
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* eslint-disable ts/no-unsafe-declaration-merging, ts/no-unsafe-argument */
|
/* eslint-disable ts/no-unsafe-declaration-merging, ts/no-unsafe-argument */
|
||||||
/* THIS FILE WAS AUTO-GENERATED */
|
/* 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 Long from 'long'
|
||||||
import type { tdFileId } from '@mtcute/file-id'
|
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 type { mtp } from '@mtcute/tl'
|
||||||
import { tl } 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'
|
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 { MtcuteError } from '../types/index.js'
|
||||||
import type { BasicDcOption, ICryptoProvider, Logger } from '../utils/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'
|
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'
|
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'
|
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 type { ITelegramTransport } from '@mtcute/core'
|
||||||
import { TransportState } 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 {
|
import type {
|
||||||
IPacketCodec,
|
IPacketCodec,
|
||||||
|
|
Loading…
Reference in a new issue