Skip to content

Commit 3618f8c

Browse files
committed
refactor: restructure wasm package
1 parent a9a13cf commit 3618f8c

7 files changed

Lines changed: 22 additions & 6 deletions

File tree

crates/wasm/package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "@hiogawa/demucs-onnx-wasm",
3+
"version": "0.0.0",
4+
"files": [
5+
"pkg"
6+
],
7+
"type": "module",
8+
"exports": "./pkg/demucs_wasm.js"
9+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"build-model": "uv run python tools/model-export/build_models.py",
1010
"verify-parity": "uv run python tools/model-export/verify_parity.py",
1111
"model-release": "uv run --no-sync tools/model_release.py",
12-
"build-wasm": "wasm-pack build crates/wasm --target web --release",
12+
"build-wasm": "wasm-pack build crates/wasm --target web --no-pack --release",
1313
"wasm-separate": "pnpm -C packages/app wasm-separate",
1414
"build": "pnpm build-wasm && pnpm -C packages/app build",
1515
"build-cf": "(command -v cargo >/dev/null || curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal) && PATH=\"$HOME/.cargo/bin:$PATH\" pnpm build",

packages/app/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
</head>
1717
<body>
1818
<div id="root"></div>
19-
<script type="module" src="/src/main.tsx"></script>
19+
<script type="module" src="./src/main.tsx"></script>
2020
</body>
2121
</html>

packages/app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"zod": "^4.4.3"
1919
},
2020
"devDependencies": {
21+
"@hiogawa/demucs-onnx-wasm": "workspace:*",
2122
"@playwright/test": "^1.61.1",
2223
"@tailwindcss/vite": "^4.3.2",
2324
"@types/node": "^26.1.1",

packages/app/src/lib/audio/separate.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1+
import init, {
2+
separate as separateWasm,
3+
type Host,
4+
} from "@hiogawa/demucs-onnx-wasm";
15
import ortWasmModuleUrl from "onnxruntime-web/ort-wasm-simd-threaded.mjs?url";
26
import ortWasmUrl from "onnxruntime-web/ort-wasm-simd-threaded.wasm?url";
37
// Browser capabilities plugged into the Rust/WASM separation driver. The worker owns
48
// messaging; this module owns fetch and onnxruntime-web only.
59
import * as ort from "onnxruntime-web/wasm";
6-
import init, {
7-
separate as separateWasm,
8-
type Host,
9-
} from "../../../../../crates/wasm/pkg/demucs_wasm.js";
1010
import {
1111
MODEL_INPUT_LENGTH,
1212
MODEL_OUTPUT_LENGTH,

pnpm-lock.yaml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
packages:
22
- packages/*
3+
- crates/wasm/
34
verifyDepsBeforeRun: false
45
allowBuilds:
56
esbuild: false

0 commit comments

Comments
 (0)