File tree Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -15,10 +15,6 @@ build(
15
15
) ,
16
16
path . join ( dirname , './shim/@typescript-eslint/parser.mjs' ) ,
17
17
[
18
- 'stream' ,
19
- 'node:stream' ,
20
- 'os' ,
21
- 'node:os' ,
22
18
'util' ,
23
19
'node:util' ,
24
20
'path' ,
@@ -70,16 +66,22 @@ function bundle(entryPoint: string, externals: string[]) {
70
66
}
71
67
72
68
function transform ( code : string , injects : string [ ] ) {
69
+ const normalizeInjects = [
70
+ ...new Set ( injects . map ( ( inject ) => inject . replace ( / ^ n o d e : / u, '' ) ) )
71
+ ]
73
72
const newCode = code . replace ( / " [ a - z ] + " = " [ a - z ] + " ; / u, '' )
74
73
return `
75
- ${ injects
74
+ ${ normalizeInjects
76
75
. map (
77
76
( inject ) =>
78
77
`import $inject_${ inject . replace ( / [ \- : ] / gu, '_' ) } $ from '${ inject } ';`
79
78
)
80
79
. join ( '\n' ) }
81
80
const $_injects_$ = {${ injects
82
- . map ( ( inject ) => `"${ inject } ":$inject_${ inject . replace ( / [ \- : ] / gu, '_' ) } $` )
81
+ . map (
82
+ ( inject ) =>
83
+ `"${ inject } ":$inject_${ inject . replace ( / ^ n o d e : / u, '' ) . replace ( / [ \- : ] / gu, '_' ) } $`
84
+ )
83
85
. join ( ',\n' ) } };
84
86
function require(module, ...args) {
85
87
return $_injects_$[module] || {}
Original file line number Diff line number Diff line change @@ -162,14 +162,16 @@ export default async () => {
162
162
163
163
tslib : path . join ( dirname , '../../node_modules/tslib/tslib.es6.js' ) ,
164
164
globby : path . join ( dirname , './build-system/shim/empty.mjs' ) ,
165
- 'fast-glob' : path . join ( dirname , './build-system/shim/empty.mjs' ) ,
166
- 'node:fs' : 'fs' ,
167
- 'node:path' : 'path' ,
168
- 'node:util' : 'util'
165
+ 'fast-glob' : path . join ( dirname , './build-system/shim/empty.mjs' )
169
166
}
170
167
} ,
171
168
define : {
172
169
'require.cache' : '{}'
170
+ } ,
171
+ build : {
172
+ rollupOptions : {
173
+ external : [ 'module' ]
174
+ }
173
175
}
174
176
} ,
175
177
You can’t perform that action at this time.
0 commit comments