Update dependency oxc-parser to v0.102.0 (#18448)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: fisker <lionkay@gmail.com>
This commit is contained in:
1 parent
7ab72c4f71
commit
20a30bb36d
4 files changed
+126
-97
No files matched your search
@@ -48,25 +48,26 @@ async function inlineWasmBinary(directory) {
|
||||
const wasmFile = new URL("./parser.wasm32-wasi.wasm", packageDirectory);
|
||||
|
||||
let text = await fs.readFile(entryFile, "utf8");
|
||||
const wasm = await fs.readFile(wasmFile, "base64");
|
||||
const wasmBase64String = await fs.readFile(wasmFile, "base64");
|
||||
|
||||
// https://issues.chromium.org/issues/467033528
|
||||
text = outdent`
|
||||
import { decode as __decode } from "base64-arraybuffer-es6";
|
||||
const __base64ToArrayBuffer = Uint8Array.fromBase64
|
||||
? (string) => Uint8Array.fromBase64(string).buffer
|
||||
? (string) => Uint8Array.from(Uint8Array.fromBase64(string)).buffer
|
||||
: __decode;
|
||||
|
||||
${text}
|
||||
`;
|
||||
|
||||
text = text.replaceAll(
|
||||
/new URL\(".*?", import\.meta\.url\)/gu,
|
||||
"{url:undefined}",
|
||||
/new URL\((?<url>".*?"), import\.meta\.url\)/gu,
|
||||
"{/* $<url> */}",
|
||||
);
|
||||
|
||||
text = text.replace(
|
||||
"await fetch(__wasmUrl).then((res) => res.arrayBuffer())",
|
||||
`__base64ToArrayBuffer(${JSON.stringify(wasm)})`,
|
||||
`__base64ToArrayBuffer(${JSON.stringify(wasmBase64String)})`,
|
||||
);
|
||||
|
||||
await fs.writeFile(entryFile, text);
|
||||
|
||||
Reference in new issue
Block a user