Skip to content

Commit

Permalink
fix(*): add browser entries for pkgs (#760)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Jan 10, 2024
1 parent 1f5f00d commit 105ecad
Show file tree
Hide file tree
Showing 24 changed files with 123 additions and 46 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"devDependencies": {
"@emnapi/core": "^0.45.0",
"@emnapi/runtime": "^0.45.0",
"@napi-rs/cli": "^3.0.0-alpha.33",
"@napi-rs/cli": "^3.0.0-alpha.34",
"@swc-node/core": "^1.10.6",
"@swc-node/register": "^1.6.8",
"@swc/core": "^1.3.101",
Expand All @@ -46,7 +46,7 @@
"husky": "^8.0.3",
"lerna": "^8.0.1",
"lint-staged": "^15.2.0",
"memfs-browser": "^3.4.13000",
"memfs-browser": "^4.6.0",
"npm-run-all": "^4.1.5",
"prettier": "^3.1.1",
"ts-node": "^10.9.2",
Expand Down
1 change: 1 addition & 0 deletions packages/argon2/browser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@node-rs/argon2-wasm32-wasi'
2 changes: 1 addition & 1 deletion packages/argon2/npm/wasm32-wasi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@
"@emnapi/core": "^0.45.0",
"@emnapi/runtime": "^0.45.0",
"@tybys/wasm-util": "^0.8.1",
"memfs-browser": "^3.4.13000"
"memfs-browser": "^4.6.0"
}
}
6 changes: 4 additions & 2 deletions packages/argon2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"homepage": "https://github.com/napi-rs/node-rs",
"main": "index.js",
"types": "index.d.ts",
"browser": "browser.js",
"keywords": [
"argon2",
"argon2-password",
Expand Down Expand Up @@ -37,7 +38,8 @@
},
"files": [
"index.js",
"index.d.ts"
"index.d.ts",
"browser.js"
],
"publishConfig": {
"registry": "https://registry.npmjs.org/",
Expand All @@ -60,7 +62,7 @@
"version": "napi version"
},
"devDependencies": {
"@napi-rs/cli": "^3.0.0-alpha.33",
"@napi-rs/cli": "^3.0.0-alpha.34",
"argon2": "^0.31.2",
"cross-env": "^7.0.3"
}
Expand Down
4 changes: 4 additions & 0 deletions packages/argon2/wasi-worker-browser.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ const handler = new MessageHandler({
// eslint-disable-next-line no-console
console.log.apply(console, arguments)
},
printErr: function () {
// eslint-disable-next-line no-console
console.error.apply(console, arguments)
},
})
return instantiateNapiModuleSync(wasmModule, {
childThread: true,
Expand Down
1 change: 1 addition & 0 deletions packages/bcrypt/browser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@node-rs/bcrypt-wasm32-wasi'
2 changes: 1 addition & 1 deletion packages/bcrypt/npm/wasm32-wasi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@
"@emnapi/core": "^0.45.0",
"@emnapi/runtime": "^0.45.0",
"@tybys/wasm-util": "^0.8.1",
"memfs-browser": "^3.4.13000"
"memfs-browser": "^4.6.0"
}
}
4 changes: 3 additions & 1 deletion packages/bcrypt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
"license": "MIT",
"main": "index.js",
"typings": "index.d.ts",
"browser": "browser.js",
"files": [
"index.js",
"index.d.ts",
"binding.js",
"binding.d.ts",
"browser.js",
"LICENSE",
"LICENSE.rust-bcrypt"
],
Expand Down Expand Up @@ -68,7 +70,7 @@
"url": "https://github.com/napi-rs/node-rs/issues"
},
"devDependencies": {
"@napi-rs/cli": "^3.0.0-alpha.33",
"@napi-rs/cli": "^3.0.0-alpha.34",
"@types/bcrypt": "^5.0.2",
"bcrypt": "^5.1.1",
"bcryptjs": "^2.4.3",
Expand Down
4 changes: 4 additions & 0 deletions packages/bcrypt/wasi-worker-browser.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ const handler = new MessageHandler({
// eslint-disable-next-line no-console
console.log.apply(console, arguments)
},
printErr: function () {
// eslint-disable-next-line no-console
console.error.apply(console, arguments)
},
})
return instantiateNapiModuleSync(wasmModule, {
childThread: true,
Expand Down
1 change: 1 addition & 0 deletions packages/crc32/browser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@node-rs/crc32-wasm32-wasi'
2 changes: 1 addition & 1 deletion packages/crc32/npm/wasm32-wasi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@
"@emnapi/core": "^0.45.0",
"@emnapi/runtime": "^0.45.0",
"@tybys/wasm-util": "^0.8.1",
"memfs-browser": "^3.4.13000"
"memfs-browser": "^4.6.0"
}
}
4 changes: 3 additions & 1 deletion packages/crc32/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
"license": "MIT",
"main": "index.js",
"typings": "index.d.ts",
"browser": "browser.js",
"files": [
"index.js",
"index.d.ts",
"browser.js",
"LICENSE"
],
"napi": {
Expand Down Expand Up @@ -62,7 +64,7 @@
"url": "https://github.com/napi-rs/node-rs/issues"
},
"devDependencies": {
"@napi-rs/cli": "^3.0.0-alpha.33",
"@napi-rs/cli": "^3.0.0-alpha.34",
"@types/crc": "^3.8.3",
"buffer": "^6.0.3",
"crc": "^4.3.2",
Expand Down
4 changes: 4 additions & 0 deletions packages/crc32/wasi-worker-browser.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ const handler = new MessageHandler({
// eslint-disable-next-line no-console
console.log.apply(console, arguments)
},
printErr: function () {
// eslint-disable-next-line no-console
console.error.apply(console, arguments)
},
})
return instantiateNapiModuleSync(wasmModule, {
childThread: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/deno-lint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"typanion": "^3.14.0"
},
"devDependencies": {
"@napi-rs/cli": "^3.0.0-alpha.33",
"@napi-rs/cli": "^3.0.0-alpha.34",
"@types/webpack": "^5.28.5"
},
"funding": {
Expand Down
1 change: 1 addition & 0 deletions packages/jieba/browser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@node-rs/jieba-wasm32-wasi'
2 changes: 1 addition & 1 deletion packages/jieba/npm/wasm32-wasi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@
"@emnapi/core": "^0.45.0",
"@emnapi/runtime": "^0.45.0",
"@tybys/wasm-util": "^0.8.1",
"memfs-browser": "^3.4.13000"
"memfs-browser": "^4.6.0"
}
}
4 changes: 3 additions & 1 deletion packages/jieba/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
"license": "MIT",
"main": "index.js",
"typings": "index.d.ts",
"browser": "browser.js",
"files": [
"index.js",
"index.d.ts",
"browser.js",
"LICENSE"
],
"napi": {
Expand Down Expand Up @@ -62,7 +64,7 @@
"url": "https://github.com/napi-rs/node-rs/issues"
},
"devDependencies": {
"@napi-rs/cli": "^3.0.0-alpha.33",
"@napi-rs/cli": "^3.0.0-alpha.34",
"nodejieba": "^2.6.0"
},
"funding": {
Expand Down
4 changes: 4 additions & 0 deletions packages/jieba/wasi-worker-browser.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ const handler = new MessageHandler({
// eslint-disable-next-line no-console
console.log.apply(console, arguments)
},
printErr: function () {
// eslint-disable-next-line no-console
console.error.apply(console, arguments)
},
})
return instantiateNapiModuleSync(wasmModule, {
childThread: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/jsonwebtoken/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"node": ">= 10"
},
"devDependencies": {
"@napi-rs/cli": "^3.0.0-alpha.33",
"@napi-rs/cli": "^3.0.0-alpha.34",
"@types/jsonwebtoken": "^9.0.5",
"jsonwebtoken": "^9.0.2"
}
Expand Down
1 change: 1 addition & 0 deletions packages/xxhash/browser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@node-rs/xxhash-wasm32-wasi'
2 changes: 1 addition & 1 deletion packages/xxhash/npm/wasm32-wasi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@
"@emnapi/core": "^0.45.0",
"@emnapi/runtime": "^0.45.0",
"@tybys/wasm-util": "^0.8.1",
"memfs-browser": "^3.4.13000"
"memfs-browser": "^4.6.0"
}
}
6 changes: 4 additions & 2 deletions packages/xxhash/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@
"license": "MIT",
"main": "index.js",
"typings": "index.d.ts",
"browser": "browser.js",
"files": [
"index.js",
"index.d.ts"
"index.d.ts",
"browser.js"
],
"napi": {
"binaryName": "xxhash",
Expand Down Expand Up @@ -64,7 +66,7 @@
"url": "https://github.com/napi-rs/node-rs/issues"
},
"devDependencies": {
"@napi-rs/cli": "^3.0.0-alpha.33",
"@napi-rs/cli": "^3.0.0-alpha.34",
"@types/xxhashjs": "^0.2.4",
"webpack": "^5.89.0",
"xxhash": "^0.3.0",
Expand Down
4 changes: 4 additions & 0 deletions packages/xxhash/wasi-worker-browser.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ const handler = new MessageHandler({
// eslint-disable-next-line no-console
console.log.apply(console, arguments)
},
printErr: function () {
// eslint-disable-next-line no-console
console.error.apply(console, arguments)
},
})
return instantiateNapiModuleSync(wasmModule, {
childThread: true,
Expand Down

0 comments on commit 105ecad

Please sign in to comment.