@@ -30,7 +30,6 @@ const resolvedPromise = PromiseResolve();
30
30
let debug = require ( 'internal/util/debuglog' ) . debuglog ( 'esm' , ( fn ) => {
31
31
debug = fn ;
32
32
} ) ;
33
- // const { writeFileSync } = require('fs');
34
33
35
34
const noop = FunctionPrototype ;
36
35
@@ -114,21 +113,20 @@ class ModuleJob {
114
113
}
115
114
116
115
async _instantiate ( ) {
117
- // writeFileSync(1, 'ModuleJob::instantiate()\n');
118
116
const jobsInGraph = new SafeSet ( ) ;
119
117
const addJobsToDependencyGraph = async ( moduleJob ) => {
120
118
if ( jobsInGraph . has ( moduleJob ) ) {
121
119
return ;
122
120
}
123
121
jobsInGraph . add ( moduleJob ) ;
124
- // writeFileSync(1, 'ModuleJob::instantiate() getting linked jobs\n');
122
+
125
123
const dependencyJobs = await moduleJob . linked ;
126
- // writeFileSync(1, 'ModuleJob::instantiate() got linked jobs\n');
124
+
127
125
return SafePromiseAllReturnVoid ( dependencyJobs , addJobsToDependencyGraph ) ;
128
126
} ;
127
+
129
128
await addJobsToDependencyGraph ( this ) ;
130
129
131
- // writeFileSync(1, 'ModuleJob::instantiate() job added to dep graph\n');
132
130
try {
133
131
if ( ! hasPausedEntry && this . inspectBrk ) {
134
132
hasPausedEntry = true ;
@@ -138,7 +136,7 @@ class ModuleJob {
138
136
this . module . instantiate ( ) ;
139
137
}
140
138
} catch ( e ) {
141
- // writeFileSync(1, `ModuleJob::instantiate() error: ${e.stack}\n`);
139
+
142
140
decorateErrorStack ( e ) ;
143
141
// TODO(@bcoe): Add source map support to exception that occurs as result
144
142
// of missing named export. This is currently not possible because
@@ -218,16 +216,14 @@ class ModuleJob {
218
216
}
219
217
220
218
async run ( ) {
221
- // writeFileSync(1, `ModuleJob::run() instantiating: ${this.url}\n`);
222
219
await this . instantiate ( ) ;
223
- // writeFileSync(1, `ModuleJob::run() instantiated: ${this.url}\n`);
224
220
const timeout = - 1 ;
225
221
const breakOnSigint = false ;
222
+
226
223
try {
227
224
await this . module . evaluate ( timeout , breakOnSigint ) ;
228
- // writeFileSync(1, `ModuleJob::run() evaluation complete: ${this.module}\n`);
225
+
229
226
} catch ( e ) {
230
- // writeFileSync(1, `ModuleJob::run() error: ${e.stack}\n`);
231
227
if ( e ?. name === 'ReferenceError' &&
232
228
isCommonJSGlobalLikeNotDefinedError ( e . message ) ) {
233
229
e . message += ' in ES module scope' ;
@@ -249,7 +245,7 @@ class ModuleJob {
249
245
'to use the \'.cjs\' file extension.' ;
250
246
}
251
247
}
252
- // writeFileSync(1, `ModuleJob::run() throwing error: ${e.stack}\n`);
248
+
253
249
throw e ;
254
250
}
255
251
return { __proto__ : null , module : this . module } ;
0 commit comments