@firela/hk-hsbc-credit 0.1.1 → 0.1.2

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.
Files changed (2) hide show
  1. package/index-node.mjs +19 -0
  2. package/package.json +4 -2
package/index-node.mjs ADDED
@@ -0,0 +1,19 @@
1
+ // ESM entry for Node.js consumers (Phase 74 UAT gap-closure, test 8).
2
+ //
3
+ // Why this exists: the isomorphic loaders branch ONLY at module-load. The CJS
4
+ // loader (index-node.cjs) reads the wasm via fs + WebAssembly.instantiate(bytes);
5
+ // the Worker loader (index-worker.js) does a static `import mod from '*.wasm'`,
6
+ // which is valid only under a Cloudflare Worker bundler — Node ESM `import` of
7
+ // the Worker entry throws ERR_UNKNOWN_FILE_EXTENSION. package.json routes Node
8
+ // ESM resolution here via exports.node.import.
9
+ //
10
+ // We bridge to the PROVEN CJS loader with createRequire instead of duplicating
11
+ // the FFI cycle — index-node.cjs locates the wasm via path.join(__dirname, ...),
12
+ // and __dirname inside that .cjs is its own directory, so the wasm resolves
13
+ // correctly regardless of how the .cjs was required. The parse/detect contract
14
+ // is therefore byte-identical to the CommonJS path (no second implementation).
15
+ import { createRequire } from 'node:module';
16
+
17
+ const require = createRequire(import.meta.url);
18
+
19
+ export const { parse, detect } = require('./index-node.cjs');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firela/hk-hsbc-credit",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "firela parser/sanitizer WASM module — isomorphic Node.js + Cloudflare Worker loader (ADR-0101 compiled-only).",
5
5
  "type": "module",
6
6
  "main": "./index-node.cjs",
@@ -8,7 +8,8 @@
8
8
  "exports": {
9
9
  ".": {
10
10
  "node": {
11
- "require": "./index-node.cjs"
11
+ "require": "./index-node.cjs",
12
+ "import": "./index-node.mjs"
12
13
  },
13
14
  "worker": "./index-worker.js",
14
15
  "default": "./index-worker.js"
@@ -17,6 +18,7 @@
17
18
  },
18
19
  "files": [
19
20
  "index-node.cjs",
21
+ "index-node.mjs",
20
22
  "index-worker.js",
21
23
  "index.d.ts",
22
24
  "hk_hsbc_credit.opt.wasm"