@mailwoman/sentencepiece-wasm 9.2.0 → 9.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/binding.cpp CHANGED
@@ -4,7 +4,7 @@
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
6
  * Embind wrapper for google/sentencepiece v0.2.2 — the mailwoman tokenizer's WASM core (task #26,
7
- * the SP 0.2.2 native-offsets lever from the 2026-07-30 Latin tokenizer survey).
7
+ * the SP 0.2.2 native-offsets change from the 2026-07-30 Latin tokenizer survey).
8
8
  *
9
9
  * Why this exists: the previous runtime (`@sctg/sentencepiece-js`, an emscripten build of an older
10
10
  * sentencepiece) exposed pieces + ids but never bound the offset-carrying proto API, forcing
package/build.sh CHANGED
@@ -18,7 +18,7 @@
18
18
  #
19
19
  # Single-file output on purpose: -sSINGLE_FILE=1 embeds the wasm as base64 in the .mjs, matching
20
20
  # how the previous runtime (@sctg/sentencepiece-js) shipped — no separate .wasm delivery path to
21
- # thread through neural-web, the docs demo, or the drop-in APIs. The size cost (~4/3× the wasm) is
21
+ # thread through the neural web loader, the docs demo, or the drop-in APIs. The size cost (~4/3× the wasm) is
22
22
  # accepted; the artifact is fetched once and cached.
23
23
 
24
24
  set -euo pipefail
@@ -82,5 +82,11 @@ emcc "$SCRIPT_DIR/binding.cpp" \
82
82
  -sFILESYSTEM=0 \
83
83
  -o "$SCRIPT_DIR/sentencepiece.mjs"
84
84
 
85
+ # The Node branch of the preamble imports `node:module` dynamically, behind ENVIRONMENT_IS_NODE. A browser bundler
86
+ # bundles a literal dynamic import, and webpack has no handler for the `node:` scheme; the comment tells webpack to
87
+ # leave the import to run time, where the branch never executes in a browser. esbuild and Vite ignore the comment
88
+ # and treat the specifier as a builtin, which is what the bundle-graph health check's allowance names.
89
+ sed -i 's|await import("node:module")|await import(/* webpackIgnore: true */ "node:module")|' "$SCRIPT_DIR/sentencepiece.mjs"
90
+
85
91
  echo "Built $SCRIPT_DIR/sentencepiece.mjs from sentencepiece $SP_TAG:"
86
92
  ls -la "$SCRIPT_DIR/sentencepiece.mjs"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mailwoman/sentencepiece-wasm",
3
- "version": "9.2.0",
3
+ "version": "9.4.0",
4
4
  "description": "google/sentencepiece v0.2.2 compiled to WASM with a native-offsets binding — the tokenizer core for @mailwoman/neural. Single-file ESM (wasm embedded), no runtime deps; per-piece byte offsets come from SentencePiece itself instead of TS-side reconstruction.",
5
5
  "license": "AGPL-3.0-only OR LicenseRef-Commercial",
6
6
  "repository": {
@@ -16,6 +16,13 @@
16
16
  "!test/**"
17
17
  ],
18
18
  "type": "module",
19
+ "imports": {
20
+ "#*": {
21
+ "types": "./out/*.d.ts",
22
+ "node": "./out/*.js",
23
+ "default": "./out/*.js"
24
+ }
25
+ },
19
26
  "exports": {
20
27
  "./package.json": "./package.json",
21
28
  ".": {
@@ -30,6 +37,13 @@
30
37
  "types": "./index.d.ts",
31
38
  "default": "./sentencepiece.mjs"
32
39
  }
40
+ },
41
+ "imports": {
42
+ "#*": {
43
+ "types": "./out/*.d.ts",
44
+ "node": "./out/*.js",
45
+ "default": "./out/*.js"
46
+ }
33
47
  }
34
48
  }
35
49
  }
package/sentencepiece.mjs CHANGED
Binary file