Skip to content

Commit 8ac2df6

Browse files
committed
Replace node --loader with --import
1 parent 276734a commit 8ac2df6

File tree

12 files changed

+42
-18
lines changed

12 files changed

+42
-18
lines changed

scripts/build.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,7 @@ async function main() {
141141
}
142142
}
143143

144-
main().catch(console.error)
144+
main().catch(e => {
145+
console.error(e)
146+
process.exitCode = 1
147+
})

scripts/check.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,4 +204,7 @@ async function main() {
204204
}
205205
}
206206

207-
main().catch(console.error)
207+
main().catch(e => {
208+
logger.error(e)
209+
process.exitCode = 1
210+
})

scripts/claude.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5717,4 +5717,7 @@ async function main() {
57175717
}
57185718
}
57195719

5720-
main().catch(console.error)
5720+
main().catch(e => {
5721+
console.error(e)
5722+
process.exitCode = 1
5723+
})

scripts/clean.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,4 +207,7 @@ async function main() {
207207
}
208208
}
209209

210-
main().catch(console.error)
210+
main().catch(e => {
211+
logger.error(e)
212+
process.exitCode = 1
213+
})

scripts/cover.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,4 +294,7 @@ async function main() {
294294
}
295295
}
296296

297-
main().catch(console.error)
297+
main().catch(e => {
298+
logger.error(e)
299+
process.exitCode = 1
300+
})

scripts/fix.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,7 @@ async function main() {
8181
}
8282
}
8383

84-
main().catch(console.error)
84+
main().catch(e => {
85+
logger.error(e)
86+
process.exitCode = 1
87+
})

scripts/lint.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,4 +464,7 @@ async function main() {
464464
}
465465
}
466466

467-
main().catch(console.error)
467+
main().catch(e => {
468+
logger.error(e)
469+
process.exitCode = 1
470+
})

scripts/load.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ if (require.main === module) {
2828
const scriptPath = path.join(__dirname, scriptFile)
2929

3030
// Run the script with the alias loader.
31-
const loaderPath = path.join(__dirname, 'load.mjs')
32-
const args = [`--loader=${loaderPath}`, scriptPath, ...flags]
31+
const registerPath = path.join(__dirname, 'register.mjs')
32+
const args = [`--import=${registerPath}`, scriptPath, ...flags]
3333

3434
const child = spawn(process.execPath, args, {
3535
stdio: 'inherit',

scripts/load.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/**
2-
* @fileoverview ESM loader that provides alias resolution.
2+
* @fileoverview Deprecated - use register.mjs instead.
33
*
4-
* This is the actual loader used by Node.js with --loader flag.
5-
* For convenience, use scripts/load.js which wraps this automatically.
4+
* This file is kept for backward compatibility but should not be used.
5+
* Use register.mjs with --import flag instead.
66
*
7-
* Direct usage:
8-
* node --loader=./scripts/load.mjs script.mjs
7+
* New usage:
8+
* node --import=./scripts/register.mjs script.mjs
99
*
1010
* Wrapper usage (recommended):
1111
* node scripts/load script-name

scripts/test.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ async function main() {
446446
}
447447
}
448448

449-
main().catch(error => {
450-
console.error(error)
449+
main().catch(e => {
450+
logger.error(e)
451451
process.exit(1)
452452
})

0 commit comments

Comments
 (0)