Skip to content

Commit f45c2ed

Browse files
committed
tmp: remove htmlrewriter wasm references
1 parent ff9f567 commit f45c2ed

File tree

2 files changed

+25
-29
lines changed

2 files changed

+25
-29
lines changed

src/build/functions/edge.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@ const writeHandlerFile = async (ctx: PluginContext, { matchers, name }: NextDefi
9292
JSON.stringify(minimalNextConfig),
9393
)
9494

95-
const htmlRewriterWasm = await readFile(
96-
join(
97-
ctx.pluginDir,
98-
'edge-runtime/vendor/deno.land/x/htmlrewriter@v1.0.0/pkg/htmlrewriter_bg.wasm',
99-
),
100-
)
95+
// const htmlRewriterWasm = await readFile(
96+
// join(
97+
// ctx.pluginDir,
98+
// 'edge-runtime/vendor/deno.land/x/htmlrewriter@v1.0.0/pkg/htmlrewriter_bg.wasm',
99+
// ),
100+
// )
101101

102102
// Writing the function entry file. It wraps the middleware code with the
103103
// compatibility layer mentioned above.
@@ -108,10 +108,6 @@ const writeHandlerFile = async (ctx: PluginContext, { matchers, name }: NextDefi
108108
import { handleMiddleware } from './edge-runtime/middleware.ts';
109109
import handler from './server/${name}.js';
110110
111-
await htmlRewriterInit({ module_or_path: Uint8Array.from(${JSON.stringify([
112-
...htmlRewriterWasm,
113-
])}) });
114-
115111
export default (req, context) => handleMiddleware(req, context, handler);
116112
`,
117113
)

tools/build-helpers.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -42,28 +42,28 @@ export async function vendorDeno({
4242
cwd,
4343
})
4444

45-
if (wasmFilesToDownload.length !== 0) {
46-
console.log(`⬇️ Downloading wasm files...`)
45+
// if (wasmFilesToDownload.length !== 0) {
46+
// console.log(`⬇️ Downloading wasm files...`)
4747

48-
// deno vendor doesn't work well with wasm files
49-
// see https://github.com/denoland/deno/issues/14123
50-
// to workaround this we copy the wasm files manually
51-
// (note Deno 2 allows to vendor wasm files, but it also require modules to import them and not fetch and instantiate them
52-
// se being able to drop downloading is dependent on implementation of wasm handling in external modules as well)
53-
await Promise.all(
54-
wasmFilesToDownload.map(async (urlString) => {
55-
const url = new URL(urlString)
48+
// // deno vendor doesn't work well with wasm files
49+
// // see https://github.com/denoland/deno/issues/14123
50+
// // to workaround this we copy the wasm files manually
51+
// // (note Deno 2 allows to vendor wasm files, but it also require modules to import them and not fetch and instantiate them
52+
// // so being able to drop downloading is dependent on implementation of wasm handling in external modules as well)
53+
// await Promise.all(
54+
// wasmFilesToDownload.map(async (urlString) => {
55+
// const url = new URL(urlString)
5656

57-
const destination = join(vendorDest, url.hostname, url.pathname)
57+
// const destination = join(vendorDest, url.hostname, url.pathname)
5858

59-
const res = await fetch(url)
60-
if (!res.ok)
61-
throw new Error(`Failed to fetch .wasm file to vendor. Response status: ${res.status}`)
62-
const fileStream = createWriteStream(destination, { flags: 'wx' })
63-
await finished(Readable.fromWeb(res.body).pipe(fileStream))
64-
}),
65-
)
66-
}
59+
// const res = await fetch(url)
60+
// if (!res.ok)
61+
// throw new Error(`Failed to fetch .wasm file to vendor. Response status: ${res.status}`)
62+
// const fileStream = createWriteStream(destination, { flags: 'wx' })
63+
// await finished(Readable.fromWeb(res.body).pipe(fileStream))
64+
// }),
65+
// )
66+
// }
6767

6868
console.log(`✅ Vendored Deno modules for '${vendorSource}' into '${vendorDest}'`)
6969
}

0 commit comments

Comments
 (0)