File tree Expand file tree Collapse file tree 4 files changed +16
-7
lines changed Expand file tree Collapse file tree 4 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -438,7 +438,7 @@ function trySelf(parentPath, request) {
438
438
const EXPORTS_PATTERN = / ^ ( (?: @ [ ^ / \\ % ] + \/ ) ? [ ^ . / \\ % ] [ ^ / \\ % ] * ) ( \/ .* ) ? $ / ;
439
439
function resolveExports ( nmPath , request ) {
440
440
// The implementation's behavior is meant to mirror resolution in ESM.
441
- const [ , name , expansion = '' ] =
441
+ const { 1 : name , 2 : expansion = '' } =
442
442
StringPrototypeMatch ( request , EXPORTS_PATTERN ) || [ ] ;
443
443
if ( ! name )
444
444
return ;
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ const {
12
12
PromisePrototypeCatch,
13
13
ReflectApply,
14
14
RegExpPrototypeTest,
15
+ SafeArrayIterator,
15
16
SafeSet,
16
17
StringPrototypeIncludes,
17
18
StringPrototypeMatch,
@@ -76,9 +77,9 @@ class ModuleJob {
76
77
} ) ;
77
78
78
79
if ( promises !== undefined )
79
- await PromiseAll ( promises ) ;
80
+ await PromiseAll ( new SafeArrayIterator ( promises ) ) ;
80
81
81
- return PromiseAll ( dependencyJobs ) ;
82
+ return PromiseAll ( new SafeArrayIterator ( dependencyJobs ) ) ;
82
83
} ;
83
84
// Promise for the list of all dependencyJobs.
84
85
this . linked = link ( ) ;
@@ -106,8 +107,8 @@ class ModuleJob {
106
107
}
107
108
jobsInGraph . add ( moduleJob ) ;
108
109
const dependencyJobs = await moduleJob . linked ;
109
- return PromiseAll (
110
- ArrayPrototypeMap ( dependencyJobs , addJobsToDependencyGraph ) ) ;
110
+ return PromiseAll ( new SafeArrayIterator (
111
+ ArrayPrototypeMap ( dependencyJobs , addJobsToDependencyGraph ) ) ) ;
111
112
} ;
112
113
await addJobsToDependencyGraph ( this ) ;
113
114
Original file line number Diff line number Diff line change @@ -263,6 +263,9 @@ primordials.SafeWeakSet = makeSafe(
263
263
// Refs: https://tc39.es/ecma262/#sec-%typedarray%-intrinsic-object
264
264
[
265
265
{ name : 'TypedArray' , original : Reflect . getPrototypeOf ( Uint8Array ) } ,
266
+ { name : 'ArrayIterator' , original : {
267
+ prototype : Reflect . getPrototypeOf ( Array . prototype [ Symbol . iterator ] ( ) ) ,
268
+ } } ,
266
269
{ name : 'StringIterator' , original : {
267
270
prototype : Reflect . getPrototypeOf ( String . prototype [ Symbol . iterator ] ( ) ) ,
268
271
} } ,
@@ -274,6 +277,10 @@ primordials.SafeWeakSet = makeSafe(
274
277
copyPrototype ( original . prototype , primordials , `${ name } Prototype` ) ;
275
278
} ) ;
276
279
280
+ primordials . SafeArrayIterator = createSafeIterator (
281
+ primordials . ArrayPrototypeSymbolIterator ,
282
+ primordials . ArrayIteratorPrototypeNext
283
+ ) ;
277
284
primordials . SafeStringIterator = createSafeIterator (
278
285
primordials . StringPrototypeSymbolIterator ,
279
286
primordials . StringIteratorPrototypeNext
Original file line number Diff line number Diff line change 6
6
ObjectDefineProperty,
7
7
RegExp,
8
8
RegExpPrototypeTest,
9
+ SafeArrayIterator,
9
10
StringPrototypeToUpperCase
10
11
} = primordials ;
11
12
@@ -78,15 +79,15 @@ function debuglog(set, cb) {
78
79
debug = debuglogImpl ( enabled , set ) ;
79
80
if ( typeof cb === 'function' )
80
81
cb ( debug ) ;
81
- debug ( ...args ) ;
82
+ debug ( ...new SafeArrayIterator ( args ) ) ;
82
83
} ;
83
84
let enabled ;
84
85
let test = ( ) => {
85
86
init ( ) ;
86
87
test = ( ) => enabled ;
87
88
return enabled ;
88
89
} ;
89
- const logger = ( ...args ) => debug ( ...args ) ;
90
+ const logger = ( ...args ) => debug ( ...new SafeArrayIterator ( args ) ) ;
90
91
ObjectDefineProperty ( logger , 'enabled' , {
91
92
get ( ) {
92
93
return test ( ) ;
You can’t perform that action at this time.
0 commit comments