Skip to content

Commit f743315

Browse files
committed
feat(web-host): task wasm:transpile dynamically picks wasm files
1 parent ad5344e commit f743315

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

packages/web-host/package.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"preview": "vite preview --host",
1515
"lint": "biome check .",
1616
"lint:fix": "biome check --write .",
17+
"list-public-wasm-names": "ls -1 public/plugins/*.wasm|sed 's/.wasm//'|sed 's#public/plugins/##'",
1718
"typecheck": "tsc --noEmit -p tsconfig.app.json",
1819
"prepareVirtualFs": "node --experimental-strip-types --no-warnings ./clis/prepareFilesystem.ts --path fixtures/filesystem --format ts > src/wasm/virtualFs.ts; biome format --write ./src/wasm/virtualFs.ts",
1920
"test:e2e:all": "playwright test",
@@ -22,14 +23,7 @@
2223
"test:e2e:ui:preview": "BASE_URL=http://localhost:4173/webassembly-component-model-experiments npm run test:e2e:ui",
2324
"test:e2e:report": "playwright show-report",
2425
"test:e2e:like-in-ci": "CI=true GITHUB_ACTIONS=true WAIT_FOR_SERVER_AT_URL=http://localhost:4173/webassembly-component-model-experiments/ npm run test:e2e:all:preview",
25-
"wasm:transpile:plugin-echo": "jco transpile --no-nodejs-compat --no-namespaced-exports public/plugins/plugin_echo.wasm -o ./src/wasm/generated/plugin_echo/transpiled",
26-
"wasm:transpile:plugin-weather": "jco transpile --no-nodejs-compat --no-namespaced-exports public/plugins/plugin_weather.wasm -o ./src/wasm/generated/plugin_weather/transpiled",
27-
"wasm:transpile:plugin-greet": "jco transpile --no-nodejs-compat --no-namespaced-exports public/plugins/plugin_greet.wasm -o ./src/wasm/generated/plugin_greet/transpiled",
28-
"wasm:transpile:plugin-ls": "jco transpile --no-nodejs-compat --no-namespaced-exports public/plugins/plugin_ls.wasm -o ./src/wasm/generated/plugin_ls/transpiled",
29-
"wasm:transpile:plugin-cat": "jco transpile --no-nodejs-compat --no-namespaced-exports public/plugins/plugin_cat.wasm -o ./src/wasm/generated/plugin_cat/transpiled",
30-
"wasm:transpile:plugin-echoc": "jco transpile --no-nodejs-compat --no-namespaced-exports public/plugins/plugin-echo-c.wasm -o ./src/wasm/generated/plugin-echo-c/transpiled",
31-
"wasm:transpile:repl-logic-guest": "jco transpile --no-nodejs-compat --no-namespaced-exports public/plugins/repl_logic_guest.wasm -o ./src/wasm/generated/repl_logic_guest/transpiled",
32-
"wasm:transpile": "npm run wasm:transpile:plugin-echo && npm run wasm:transpile:plugin-weather && npm run wasm:transpile:plugin-greet && npm run wasm:transpile:plugin-ls && npm run wasm:transpile:plugin-cat && npm run wasm:transpile:plugin-echoc && npm run wasm:transpile:repl-logic-guest",
26+
"wasm:transpile": "npm run list-public-wasm-names --silent|xargs -I {} jco transpile --no-nodejs-compat --no-namespaced-exports public/plugins/{}.wasm -o ./src/wasm/generated/{}/transpiled",
3327
"wit-types:host-api": "jco types --world-name host-api --out-dir ./src/types/generated ../../crates/pluginlab/wit",
3428
"wit-types:plugin-api": "jco types --world-name plugin-api --out-dir ./src/types/generated ../../crates/pluginlab/wit",
3529
"wit-types": "npm run wit-types:clean && npm run wit-types:host-api && npm run wit-types:plugin-api && biome format --write ./src/types/generated",

scripts/prepare-wasm-files.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ prepare_wasm_files() {
4040
"target/wasm32-wasip1/$mode/plugin_ls.wasm"
4141
"target/wasm32-wasip1/$mode/plugin_cat.wasm"
4242
"target/wasm32-wasip1/$mode/plugin_weather.wasm"
43+
"target/wasm32-wasip1/$mode/plugin_tee.wasm"
4344
"c_modules/plugin-echo/plugin-echo-c.wasm"
4445
"target/wasm32-wasip1/$mode/repl_logic_guest.wasm"
4546
)

0 commit comments

Comments
 (0)