Update dependency oxc-parser to v0.129.0 (#19121)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: fisker <lionkay@gmail.com>
This commit is contained in:
renovate[bot]andfisker authored and GitHub committed 2026-05-07 21:02:58 +08:00
1 parent 8cabdd41ff
commit 8cc7e177f6
3 files changed
+114 -93

No files matched your search

+23 -2
View File
@@ -41,7 +41,7 @@ async function install(version) {
const wasmUrlPattern =
/var __wasmUrl = new URL\("(?<wasmFile>.\/[a-z0-9.-]+\.wasm)", import\.meta\.url\)\.href;/;
async function inlineWasmBinary(directory) {
async function buildEntry(directory) {
const packageDirectory = new URL(
"./node_modules/@oxc-parser/binding-wasm32-wasi/",
directory,
@@ -49,6 +49,27 @@ async function inlineWasmBinary(directory) {
const entryFile = new URL("./browser-bundle.js", packageDirectory);
let text = await fs.readFile(entryFile, "utf8");
// Remove useless `visitorKeys`
const moduleMark = "\n// src-js/generated/visit/keys.js\n";
const moduleIndex = text.indexOf(moduleMark);
if (moduleIndex === -1) {
throw new Error("Unexpected source");
}
const nextModuleIndex = text.indexOf(
"\n// src-js/",
moduleIndex + moduleMark.length,
);
if (nextModuleIndex === -1) {
throw new Error("Unexpected source");
}
text = outdent`
${text.slice(0, moduleIndex + moduleMark.length)}
var keys_default;
${text.slice(nextModuleIndex)}
`;
const { wasmFile } = text.match(wasmUrlPattern).groups;
const wasmBase64String = await fs.readFile(
@@ -93,7 +114,7 @@ async function buildOxcWasmParser() {
await fs.rename(installDirectory, directory);
}
return await inlineWasmBinary(directory);
return await buildEntry(directory);
}
export default buildOxcWasmParser;