Skip to content

Commit 7c0e9cc

Browse files
committed
feat: add ./toy subpath export
Build toy/ to dist/toy/ with a separate tsconfig so it can be imported as @mni-ml/framework/toy without pulling in the native addon. Needed for the browser demo.
1 parent 155f6c4 commit 7c0e9cc

3 files changed

Lines changed: 127 additions & 33 deletions

File tree

package-lock.json

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

package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
".": {
2828
"types": "./dist/index.d.ts",
2929
"import": "./dist/index.js"
30+
},
31+
"./toy": {
32+
"types": "./dist/toy/index.d.ts",
33+
"import": "./dist/toy/index.js"
3034
}
3135
},
3236
"files": [
@@ -50,10 +54,12 @@
5054
},
5155
"devDependencies": {
5256
"@types/node": "^22.0.0",
53-
"typescript": "^5.9.3"
57+
"@webgpu/types": "^0.1.69",
58+
"typescript": "^5.9.3",
59+
"webgpu": "^0.4.0"
5460
},
5561
"scripts": {
56-
"build": "tsc",
62+
"build": "tsc && tsc -p tsconfig.toy.json",
5763
"build:native": "cd src/native && cargo build --release --features cpu && cp target/release/libmni_framework_native.dylib mni-framework-native.darwin-arm64.node",
5864
"build:native:cuda": "cd src/native && cargo build --release --no-default-features --features cuda && cp target/release/libmni_framework_native.so mni-framework-native.linux-x64-gnu.node",
5965
"build:native:webgpu": "cd src/native && cargo build --release --no-default-features --features webgpu && cp target/release/libmni_framework_native.dylib mni-framework-native.darwin-arm64.node",

tsconfig.toy.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"composite": false,
5+
"rootDir": "./toy",
6+
"outDir": "./dist/toy",
7+
"types": ["node", "@webgpu/types"]
8+
},
9+
"include": ["toy/**/*.ts"],
10+
"exclude": ["**/*.test.ts", "dist", "node_modules"]
11+
}

0 commit comments

Comments
 (0)