json-as 1.6.0 → 1.6.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 2026-09-01 - v1.6.1
4
+
5
+ - fix(transform): preserve exports from a consumer's default `assembly/index.ts` while retaining `JSON.Value`'s custom GC visitor; direct-source builds now identify json-as's library entry explicitly with `JSON_AS_LIBRARY_SOURCE` instead of inferring it from host filesystem paths ([#217](https://github.com/JairusSW/json-as/pull/217)).
6
+ - test(transform): compile a consumer entry with the real transform and assert its exports remain in the generated WebAssembly module; run the transform regression suite in CI.
7
+
3
8
  ## 2026-08-03 - v1.6.0
4
9
 
5
10
  - perf: much faster deserialization by using default values as a cache.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "json-as",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "author": "Jairus Tanaka <me@jairus.dev>",
5
5
  "repository": {
6
6
  "type": "git",
@@ -94,7 +94,7 @@
94
94
  "ci": "act",
95
95
  "test": "ast test --parallel --enable try-as",
96
96
  "test:rfc": "ast test --config rfc.config.json --parallel --enable try-as",
97
- "test:transform": "node transform/__tests__/normalize-base-rel.test.mjs && node transform/__tests__/compute-base-rel.test.mjs && node transform/__tests__/resolve-imports.test.mjs",
97
+ "test:transform": "node transform/__tests__/normalize-base-rel.test.mjs && node transform/__tests__/compute-base-rel.test.mjs && node transform/__tests__/resolve-imports.test.mjs && node transform/__tests__/user-entry-exports.test.mjs",
98
98
  "test:fast": "npm run build:transform && JSON_USE_FAST_PATH=1 ast test --parallel --mode swar,simd --enable try-as",
99
99
  "fuzz": "ast fuzz",
100
100
  "test:fuzz": "ast test --fuzz --parallel",
@@ -113,14 +113,14 @@
113
113
  "charts:rfc": "bun ./scripts/build-rfc-coverage.ts",
114
114
  "charts:publish": "bash ./scripts/publish-benchmarks.sh",
115
115
  "charts:serve": "serve ./build/charts/",
116
- "build:test": "JSON_DEBUG=0 JSON_WRITE=assembly/test.ts asc assembly/test.ts --transform ./transform -o ./build/test.wasm --textFile ./build/test.wat --enable simd --debug --config ./node_modules/@assemblyscript/wasi-shim/asconfig.json",
116
+ "build:test": "JSON_AS_LIBRARY_SOURCE=assembly/index JSON_DEBUG=0 JSON_WRITE=assembly/test.ts asc assembly/test.ts --transform ./transform -o ./build/test.wasm --textFile ./build/test.wat --enable simd --debug --config ./node_modules/@assemblyscript/wasi-shim/asconfig.json",
117
117
  "build:tmp:test": "JSON_DEBUG=1 asc assembly/test.tmp.ts -o ./build/test.wasm --textFile ./build/test.wat --enable simd --debug --config ./node_modules/@assemblyscript/wasi-shim/asconfig.json",
118
- "build:test:wine": "JSON_DEBUG=1 JSON_WRITE=assembly/test.ts NODE_SKIP_PLATFORM_CHECK=1 wineconsole --backend=curses ~/.win-bin/node/node.exe ./node_modules/assemblyscript/bin/asc.js assembly/test.ts --transform ./transform -o ./build/test.wasm --textFile ./build/test.wat --debug --config ./node_modules/@assemblyscript/wasi-shim/asconfig.json",
118
+ "build:test:wine": "JSON_AS_LIBRARY_SOURCE=assembly/index JSON_DEBUG=1 JSON_WRITE=assembly/test.ts NODE_SKIP_PLATFORM_CHECK=1 wineconsole --backend=curses ~/.win-bin/node/node.exe ./node_modules/assemblyscript/bin/asc.js assembly/test.ts --transform ./transform -o ./build/test.wasm --textFile ./build/test.wat --debug --config ./node_modules/@assemblyscript/wasi-shim/asconfig.json",
119
119
  "test:wasmtime": "wasmtime ./build/test.wasm",
120
120
  "test:wasmer": "wasmer ./build/test.wasm",
121
121
  "build:transform": "tsc -p ./transform",
122
- "build:playground": "npm run build:transform && JSON_DEBUG=0 JSON_WRITE=assembly/playground.ts asc assembly/playground.ts --transform ./transform -o ./build/playground.wasm --textFile ./build/playground.wat --enable simd --config ./node_modules/@assemblyscript/wasi-shim/asconfig.json",
123
- "build:playground:nosimd": "npm run build:transform && JSON_DEBUG=0 JSON_WRITE=assembly/playground.ts asc assembly/playground.ts --transform ./transform -o ./build/playground.wasm --textFile ./build/playground.wat --disable simd --config ./node_modules/@assemblyscript/wasi-shim/asconfig.json",
122
+ "build:playground": "npm run build:transform && JSON_AS_LIBRARY_SOURCE=assembly/index JSON_DEBUG=0 JSON_WRITE=assembly/playground.ts asc assembly/playground.ts --transform ./transform -o ./build/playground.wasm --textFile ./build/playground.wat --enable simd --config ./node_modules/@assemblyscript/wasi-shim/asconfig.json",
123
+ "build:playground:nosimd": "npm run build:transform && JSON_AS_LIBRARY_SOURCE=assembly/index JSON_DEBUG=0 JSON_WRITE=assembly/playground.ts asc assembly/playground.ts --transform ./transform -o ./build/playground.wasm --textFile ./build/playground.wat --disable simd --config ./node_modules/@assemblyscript/wasi-shim/asconfig.json",
124
124
  "build:pg": "npm run build:playground",
125
125
  "run:playground": "wasmtime ./build/playground.wasm",
126
126
  "run:pg": "npm run run:playground",
@@ -3501,9 +3501,11 @@ export default class Transformer extends Transform {
3501
3501
  writeFileSync(path.join(process.cwd(), this.baseDir, removeExtension(source.normalizedPath) + ".tmp.ts"), toString(source));
3502
3502
  }
3503
3503
  }
3504
+ const configuredLibrarySource = process.env["JSON_AS_LIBRARY_SOURCE"]?.trim();
3504
3505
  for (const source of parser.sources) {
3505
3506
  const p = source.internalPath;
3506
- if (p === "assembly/index" || p.endsWith("/json-as/assembly/index")) {
3507
+ if (p.endsWith("/json-as/assembly/index") ||
3508
+ (configuredLibrarySource && p === configuredLibrarySource)) {
3507
3509
  source.sourceKind = 2;
3508
3510
  }
3509
3511
  }