From da0c2531073ab247a0e899ed6a7cc19013195296 Mon Sep 17 00:00:00 2001 From: Evan Wallace Date: Mon, 19 Dec 2022 12:54:02 -0500 Subject: [PATCH] fix default wasm name for deno to `esbuild.wasm` --- Makefile | 3 +++ lib/deno/wasm.ts | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d9dcbfd6d71..95fb863c547 100644 --- a/Makefile +++ b/Makefile @@ -66,6 +66,8 @@ test-wasm-browser: platform-wasm | scripts/browser/node_modules test-deno: esbuild platform-deno ESBUILD_BINARY_PATH="$(shell pwd)/esbuild" deno test --allow-run --allow-env --allow-net --allow-read --allow-write --no-check scripts/deno-tests.js + deno eval 'import { transform, stop } from "file://$(shell pwd)/deno/mod.js"; console.log((await transform("1+2")).code); stop()' | grep "1 + 2;" + deno eval 'import { transform, stop } from "file://$(shell pwd)/deno/wasm.js"; console.log((await transform("1+2")).code); stop()' | grep "1 + 2;" test-deno-windows: esbuild platform-deno ESBUILD_BINARY_PATH=./esbuild.exe deno test --allow-run --allow-env --allow-net --allow-read --allow-write --no-check scripts/deno-tests.js @@ -206,6 +208,7 @@ test-e2e-yarn-berry: test-e2e-deno: deno eval 'import { transform, stop } from "https://deno.land/x/esbuild@v$(ESBUILD_VERSION)/mod.js"; console.log((await transform("1+2")).code); stop()' | grep "1 + 2;" + deno eval 'import { transform, stop } from "https://deno.land/x/esbuild@v$(ESBUILD_VERSION)/wasm.js"; console.log((await transform("1+2")).code); stop()' | grep "1 + 2;" test-yarnpnp: platform-wasm node scripts/test-yarnpnp.js diff --git a/lib/deno/wasm.ts b/lib/deno/wasm.ts index 87d795fde1a..2c318c63a0b 100644 --- a/lib/deno/wasm.ts +++ b/lib/deno/wasm.ts @@ -59,7 +59,7 @@ let initializePromise: Promise | undefined; let stopService: (() => void) | undefined let ensureServiceIsRunning = (): Promise => { - return initializePromise || startRunningService('', undefined, true) + return initializePromise || startRunningService('esbuild.wasm', undefined, true) } export const initialize: typeof types.initialize = async (options) => { @@ -68,7 +68,7 @@ export const initialize: typeof types.initialize = async (options) => { let wasmModule = options.wasmModule; let useWorker = options.worker !== false; if (initializePromise) throw new Error('Cannot call "initialize" more than once'); - initializePromise = startRunningService(wasmURL || '', wasmModule, useWorker); + initializePromise = startRunningService(wasmURL || 'esbuild.wasm', wasmModule, useWorker); initializePromise.catch(() => { // Let the caller try again if this fails initializePromise = void 0;