chore: switch to oxnode

This commit is contained in:
LongYinan
2025-04-02 17:56:37 +08:00
parent 61af6fd24e
commit 359ed9698b
7 changed files with 207 additions and 41 deletions
+2 -5
View File
@@ -2,12 +2,11 @@
import { spawn } from 'node:child_process';
import { existsSync } from 'node:fs';
import { join } from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url';
import { fileURLToPath } from 'node:url';
const scriptsFolder = join(fileURLToPath(import.meta.url), '..', '..');
const scriptsSrcFolder = join(scriptsFolder, 'src');
const projectRoot = join(scriptsFolder, '..', '..');
const loader = join(scriptsFolder, 'register.js');
const [node, _self, file, ...options] = process.argv;
@@ -60,9 +59,7 @@ if (
scriptLocation.endsWith('.ts') ||
scriptLocation.startsWith(scriptsFolder)
) {
nodeOptions.unshift(`--import=${pathToFileURL(loader)}`);
} else {
nodeOptions.unshift('--experimental-specifier-resolution=node');
nodeOptions.unshift(`--import=@oxc-node/core/register`);
}
spawn(node, [...nodeOptions, scriptLocation, ...options], {