Skip to content

Commit 46d88f8

Browse files
committed
Do not put WASM build in NPM package. And fix Typescript types for
projects using `compilerOptions.moduleResolution=node` in their tsconfig.ts Node and Typescript don't pick types from `exports` in package.json when moduleResolution is not `bundler` so we expose a more classical way using `types`. Also renamed `build:lib` script to build so is easier to publish and lastly do not include WASM module for RPC in NPM package because is only necessary for other languages not JS
1 parent 18661d2 commit 46d88f8

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ coverage
2727
out/
2828
build
2929
dist
30-
30+
dist-rpc
3131

3232
# Debug
3333
npm-debug.log*

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"type": "module",
88
"main": "./dist/index.cjs",
99
"module": "./dist/index.js",
10+
"types": "./dist/index.d.ts",
1011
"exports": {
1112
".": {
1213
"import": {
@@ -24,7 +25,7 @@
2425
],
2526
"scripts": {
2627
"dev": "rollup -c -w",
27-
"build:lib": "rollup -c",
28+
"build": "rollup -c",
2829
"build:rpc": "rollup -c rollup.config.rpc.mjs",
2930
"test": "vitest run",
3031
"test:watch": "vitest",

rollup.config.rpc.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default {
2626
input: 'src/index.rpc.ts',
2727
output: [
2828
{
29-
file: 'dist/promptl.js',
29+
file: 'dist-rpc/promptl.js',
3030
format: 'es',
3131
},
3232
],
@@ -49,8 +49,8 @@ export default {
4949
'-J simd-json-builtins=y',
5050
'-J text-encoding=y',
5151
'-J event-loop=y',
52-
'-o dist/promptl.wasm',
53-
'dist/promptl.js',
52+
'-o dist-rpc/promptl.wasm',
53+
'dist-rpc/promptl.js',
5454
].join(' '),
5555
]),
5656
],

0 commit comments

Comments
 (0)