diff options
| author | GitHub Action <[email protected]> | 2025-12-29 21:16:16 +0000 |
|---|---|---|
| committer | GitHub Action <[email protected]> | 2025-12-29 21:16:16 +0000 |
| commit | 825dfd48b1a31f7cd1851fe7516109cf00512c3c (patch) | |
| tree | 80c992b612020f1ff0f3b996641c3d2d0aa6bb30 /nix/scripts | |
| parent | 923d114ffab6b8dba8c77e10f07cfc5d0bbca2e4 (diff) | |
| download | opencode-825dfd48b1a31f7cd1851fe7516109cf00512c3c.tar.gz opencode-825dfd48b1a31f7cd1851fe7516109cf00512c3c.zip | |
chore: generate
Diffstat (limited to 'nix/scripts')
| -rw-r--r-- | nix/scripts/patch-wasm.ts | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/nix/scripts/patch-wasm.ts b/nix/scripts/patch-wasm.ts index 75d6a73d9..88a06c2bd 100644 --- a/nix/scripts/patch-wasm.ts +++ b/nix/scripts/patch-wasm.ts @@ -31,10 +31,13 @@ for (const [name, wasmPath] of byName) { next = next.replaceAll("tree-sitter.wasm", mainWasm).replaceAll("web-tree-sitter/tree-sitter.wasm", mainWasm) // Collapse any relative prefixes before absolute store paths (e.g., "../../../..//nix/store/...") -const nixStorePrefix = process.env.NIX_STORE || "/nix/store"; +const nixStorePrefix = process.env.NIX_STORE || "/nix/store" next = next.replace(/(\.\/)+/g, "./") -next = next.replace(new RegExp(`(\\.\\.\\/)+\\/{1,2}(${nixStorePrefix.replace(/^\//, '').replace(/\//g, "\\/")}[^"']+)`, 'g'), '/$2') -next = next.replace(new RegExp(`(["'])\\/{2,}(\\/${nixStorePrefix.replace(/\//g, "\\/")}[^"']+)(["'])`, 'g'), '$1$2$3') -next = next.replace(new RegExp(`(["'])\\/\\/(${nixStorePrefix.replace(/\//g, "\\/")}[^"']+)(["'])`, 'g'), '$1$2$3') +next = next.replace( + new RegExp(`(\\.\\.\\/)+\\/{1,2}(${nixStorePrefix.replace(/^\//, "").replace(/\//g, "\\/")}[^"']+)`, "g"), + "/$2", +) +next = next.replace(new RegExp(`(["'])\\/{2,}(\\/${nixStorePrefix.replace(/\//g, "\\/")}[^"']+)(["'])`, "g"), "$1$2$3") +next = next.replace(new RegExp(`(["'])\\/\\/(${nixStorePrefix.replace(/\//g, "\\/")}[^"']+)(["'])`, "g"), "$1$2$3") if (next !== content) fs.writeFileSync(file, next) |
