json-as 1.4.0 → 1.6.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.
Files changed (108) hide show
  1. package/CHANGELOG.md +54 -29
  2. package/README.md +126 -33
  3. package/assembly/custom/chars.ts +39 -78
  4. package/assembly/deserialize/error.ts +21 -0
  5. package/assembly/deserialize/index/arbitrary.ts +50 -11
  6. package/assembly/deserialize/index/array.ts +2 -1
  7. package/assembly/deserialize/index/bool.ts +1 -1
  8. package/assembly/deserialize/index/float.ts +2 -4
  9. package/assembly/deserialize/index/integer.ts +2 -4
  10. package/assembly/deserialize/index/object.ts +9 -1
  11. package/assembly/deserialize/index/string.ts +39 -7
  12. package/assembly/deserialize/index/unsigned.ts +2 -4
  13. package/assembly/deserialize/index.ts +0 -1
  14. package/assembly/deserialize/naive/array/arbitrary.ts +3 -2
  15. package/assembly/deserialize/naive/array/array.ts +1 -0
  16. package/assembly/deserialize/naive/array/bool.ts +21 -11
  17. package/assembly/deserialize/naive/array/box.ts +13 -33
  18. package/assembly/deserialize/naive/array/float.ts +23 -13
  19. package/assembly/deserialize/naive/array/integer.ts +34 -22
  20. package/assembly/deserialize/naive/array/map.ts +1 -1
  21. package/assembly/deserialize/naive/array/object.ts +2 -1
  22. package/assembly/deserialize/naive/array/string.ts +29 -16
  23. package/assembly/deserialize/naive/array/struct.ts +19 -1
  24. package/assembly/deserialize/naive/bool.ts +18 -10
  25. package/assembly/deserialize/naive/date.ts +1 -2
  26. package/assembly/deserialize/naive/float.ts +3 -9
  27. package/assembly/deserialize/naive/integer.ts +1 -2
  28. package/assembly/deserialize/naive/map.ts +342 -43
  29. package/assembly/deserialize/naive/object.ts +250 -55
  30. package/assembly/deserialize/naive/raw.ts +10 -2
  31. package/assembly/deserialize/naive/set.ts +2 -5
  32. package/assembly/deserialize/naive/staticarray.ts +4 -4
  33. package/assembly/deserialize/naive/string.ts +46 -60
  34. package/assembly/deserialize/naive/unsigned.ts +1 -2
  35. package/assembly/deserialize/parseMode.ts +216 -0
  36. package/assembly/deserialize/simd/array/integer.ts +8 -10
  37. package/assembly/deserialize/simd/float.ts +38 -34
  38. package/assembly/deserialize/simd/integer.ts +2 -7
  39. package/assembly/deserialize/simd/string.ts +84 -39
  40. package/assembly/deserialize/string-validation.ts +34 -0
  41. package/assembly/deserialize/swar/array/arbitrary.ts +1 -2
  42. package/assembly/deserialize/swar/array/array.ts +64 -15
  43. package/assembly/deserialize/swar/array/bool.ts +15 -5
  44. package/assembly/deserialize/swar/array/box.ts +1 -2
  45. package/assembly/deserialize/swar/array/float.ts +399 -30
  46. package/assembly/deserialize/swar/array/generic.ts +13 -4
  47. package/assembly/deserialize/swar/array/integer.ts +29 -78
  48. package/assembly/deserialize/swar/array/map.ts +1 -2
  49. package/assembly/deserialize/swar/array/object.ts +12 -4
  50. package/assembly/deserialize/swar/array/raw.ts +1 -2
  51. package/assembly/deserialize/swar/array/shared.ts +7 -14
  52. package/assembly/deserialize/swar/array/string.ts +37 -13
  53. package/assembly/deserialize/swar/array/struct.ts +109 -21
  54. package/assembly/deserialize/swar/array.ts +1 -3
  55. package/assembly/deserialize/swar/float.ts +23 -21
  56. package/assembly/deserialize/swar/integer.ts +2 -7
  57. package/assembly/deserialize/swar/string.ts +81 -124
  58. package/assembly/deserialize/swar/typedarray.ts +4 -4
  59. package/assembly/index.d.ts +35 -24
  60. package/assembly/index.ts +1775 -281
  61. package/assembly/serialize/index/arbitrary.ts +70 -4
  62. package/assembly/serialize/index/bool.ts +1 -1
  63. package/assembly/serialize/index/float.ts +1 -5
  64. package/assembly/serialize/index/integer.ts +1 -1
  65. package/assembly/serialize/index/jsonarray.ts +51 -0
  66. package/assembly/serialize/index/object.ts +42 -3
  67. package/assembly/serialize/index/string.ts +1 -2
  68. package/assembly/serialize/index/typedarray.ts +1 -2
  69. package/assembly/serialize/index.ts +1 -0
  70. package/assembly/serialize/naive/array.ts +87 -34
  71. package/assembly/serialize/naive/bool.ts +0 -1
  72. package/assembly/serialize/naive/float.ts +15 -29
  73. package/assembly/serialize/naive/integer.ts +1 -5
  74. package/assembly/serialize/naive/map.ts +37 -0
  75. package/assembly/serialize/naive/raw.ts +1 -2
  76. package/assembly/serialize/naive/set.ts +0 -5
  77. package/assembly/serialize/naive/staticarray.ts +0 -6
  78. package/assembly/serialize/naive/string.ts +1 -10
  79. package/assembly/serialize/naive/typedarray.ts +0 -7
  80. package/assembly/serialize/simd/string.ts +1 -3
  81. package/assembly/serialize/swar/string.ts +1 -2
  82. package/assembly/util/atoi-fast.ts +4 -14
  83. package/assembly/util/bytes.ts +1 -2
  84. package/assembly/util/eisel-lemire.ts +179 -0
  85. package/assembly/util/idofd.ts +1 -2
  86. package/assembly/util/isSpace.ts +1 -2
  87. package/assembly/util/itoa-fast.ts +6 -9
  88. package/assembly/util/nextPowerOf2.ts +1 -2
  89. package/assembly/util/parsefloat-fast.ts +3 -5
  90. package/assembly/util/prettyWhitespaceSimd.ts +69 -0
  91. package/assembly/util/ptrToStr.ts +1 -2
  92. package/assembly/util/scanValueEndSimd.ts +83 -22
  93. package/assembly/util/scanValueEndSwar.ts +67 -25
  94. package/assembly/util/scientific.ts +5 -8
  95. package/assembly/util/snp.ts +1 -2
  96. package/assembly/util/swar-int.ts +5 -10
  97. package/assembly/util/swar.ts +2 -4
  98. package/assembly/util/validateJson.ts +338 -0
  99. package/lib/as-bs.ts +51 -51
  100. package/package.json +25 -8
  101. package/transform/lib/index.d.ts +6 -0
  102. package/transform/lib/index.js +874 -171
  103. package/transform/lib/types.d.ts +3 -1
  104. package/transform/lib/types.js +6 -0
  105. package/assembly/deserialize/index/struct.ts +0 -1
  106. package/assembly/deserialize/naive/struct.ts +0 -21
  107. package/assembly/util/dragonbox-cache.ts +0 -445
  108. package/assembly/util/dragonbox.ts +0 -652
package/lib/as-bs.ts CHANGED
@@ -40,15 +40,17 @@ export namespace bs {
40
40
  * Using bit shifts for efficiency: alpha = 1/8, so (1 - alpha) = 7/8
41
41
  * @param newSize - The new size to incorporate into the average
42
42
  */
43
- // @ts-expect-error: @inline is a valid decorator
44
- @inline function updateTypicalSize(newSize: usize): void {
45
- // EMA: typicalSize = (newSize >> 3) + typicalSize - (typicalSize >> 3)
46
- // Simplified: typicalSize += (newSize - typicalSize) >> 3
47
- typicalSize += (newSize - typicalSize) >> EMA_ALPHA_SHIFT;
43
+ function updateTypicalSize(newSize: usize): void {
44
+ // Keep the delta unsigned in both directions. `(newSize - typicalSize)`
45
+ // underflows when output shrinks because usize arithmetic wraps.
46
+ if (newSize >= typicalSize) {
47
+ typicalSize += (newSize - typicalSize) >> EMA_ALPHA_SHIFT;
48
+ } else {
49
+ typicalSize -= (typicalSize - newSize) >> EMA_ALPHA_SHIFT;
50
+ }
48
51
  }
49
52
 
50
- // @ts-expect-error: @inline is a valid decorator
51
- @inline function renewBuffer(newSize: usize): void {
53
+ function renewBuffer(newSize: usize): void {
52
54
  const oldPtr = buffer;
53
55
  const relOffset = offset - oldPtr;
54
56
  const newPtr = heap.realloc(oldPtr, newSize);
@@ -57,8 +59,7 @@ export namespace bs {
57
59
  bufferSize = newSize;
58
60
  }
59
61
 
60
- // @ts-expect-error: @inline is a valid decorator
61
- @inline function reserve(requiredSize: usize, extra: usize): void {
62
+ function reserve(requiredSize: usize, extra: usize): void {
62
63
  if (requiredSize <= bufferSize) return;
63
64
  // Grow aggressively (2x) to minimize realloc frequency in hot serialization paths.
64
65
  let next = bufferSize << 1;
@@ -67,12 +68,14 @@ export namespace bs {
67
68
  renewBuffer(next);
68
69
  }
69
70
 
70
- // @ts-expect-error: @inline is a valid decorator
71
- @inline function finalizeDynamicOutput(len: usize): void {
71
+ function finalizeDynamicOutput(len: usize): void {
72
72
  counter += 1;
73
- updateTypicalSize(len);
74
- if ((counter & SHRINK_EVERY_N_MASK) == 0 && bufferSize > typicalSize << 2) {
75
- resize(u32(typicalSize << 1));
73
+ // Resizing is intentionally sampled. Updating an EMA on every tiny
74
+ // stringify used to put several integer ops on the hottest return path even
75
+ // though we only consult it once per 256 outputs.
76
+ if ((counter & SHRINK_EVERY_N_MASK) == 0) {
77
+ updateTypicalSize(len);
78
+ if (bufferSize > typicalSize << 2) resize(u32(typicalSize << 1));
76
79
  }
77
80
  offset = buffer;
78
81
  stackSize = 0;
@@ -83,8 +86,7 @@ export namespace bs {
83
86
  /**
84
87
  * Stores the state of the buffer, allowing further changes to be reset
85
88
  */
86
- // @ts-expect-error: @inline is a valid decorator
87
- @inline export function saveState(): void {
89
+ export function saveState(): void {
88
90
  pauseOffsets.push(offset - buffer);
89
91
  pauseStackSizes.push(stackSize);
90
92
  }
@@ -93,8 +95,7 @@ export namespace bs {
93
95
  * Resets the buffer to the state it was in when `pause()` was called.
94
96
  * This allows for changes made after the pause to be discarded.
95
97
  */
96
- // @ts-expect-error: @inline is a valid decorator
97
- @inline export function loadState(): void {
98
+ export function loadState(): void {
98
99
  const length = pauseOffsets.length;
99
100
  if (length == 0) return;
100
101
  const index = length - 1;
@@ -109,10 +110,11 @@ export namespace bs {
109
110
  * serialize/deserialize op mid-flight: a partial run can leave `offset`
110
111
  * advanced and the pause stacks non-empty, which would corrupt the next op.
111
112
  */
112
- // @ts-expect-error: @inline is a valid decorator
113
- @inline export function reset(): void {
113
+ export function reset(): void {
114
114
  offset = buffer;
115
115
  stackSize = 0;
116
+ cacheOutput = 0;
117
+ cacheOutputLen = 0;
116
118
  pauseOffsets.length = 0;
117
119
  pauseStackSizes.length = 0;
118
120
  }
@@ -122,8 +124,7 @@ export namespace bs {
122
124
  * If necessary, reallocates the buffer to the exact new size.
123
125
  * @param size - The size to propose.
124
126
  */
125
- // @ts-expect-error: @inline is a valid decorator
126
- @inline export function ensureSize(size: u32): void {
127
+ export function ensureSize(size: u32): void {
127
128
  reserve(offset - buffer + usize(size), MIN_BUFFER_SIZE);
128
129
  }
129
130
 
@@ -132,8 +133,7 @@ export namespace bs {
132
133
  * If necessary, reallocates the buffer to the exact new size.
133
134
  * @param size - The size to propose.w
134
135
  */
135
- // @ts-expect-error: @inline is a valid decorator
136
- @inline export function proposeSize(size: u32): void {
136
+ export function proposeSize(size: u32): void {
137
137
  stackSize += size;
138
138
  reserve(stackSize, 0);
139
139
  }
@@ -143,8 +143,7 @@ export namespace bs {
143
143
  * If necessary, reallocates the buffer to the exact new size.
144
144
  * @param size - The size to grow by.
145
145
  */
146
- // @ts-expect-error: @inline is a valid decorator
147
- @inline export function growSize(size: u32): void {
146
+ export function growSize(size: u32): void {
148
147
  stackSize += size;
149
148
  reserve(stackSize, MIN_BUFFER_SIZE);
150
149
  }
@@ -153,8 +152,7 @@ export namespace bs {
153
152
  * Resizes the buffer to the specified size.
154
153
  * @param newSize - The new buffer size.
155
154
  */
156
- // @ts-expect-error: @inline is a valid decorator
157
- @inline export function resize(newSize: u32): void {
155
+ export function resize(newSize: u32): void {
158
156
  const oldPtr = buffer;
159
157
  const relOffset = offset - oldPtr;
160
158
  const newPtr = heap.realloc(buffer, newSize);
@@ -168,8 +166,7 @@ export namespace bs {
168
166
  * finalization. Keeps enough capacity for the recent typical output size while
169
167
  * releasing clearly excess memory.
170
168
  */
171
- // @ts-expect-error: @inline is a valid decorator
172
- @inline export function shrink(): void {
169
+ export function shrink(): void {
173
170
  let next = typicalSize << 1;
174
171
  if (next < MIN_BUFFER_SIZE) next = MIN_BUFFER_SIZE;
175
172
  if (bufferSize > next) {
@@ -184,8 +181,20 @@ export namespace bs {
184
181
  * Copies the buffer's content to a new object of a specified type. Does not shrink the buffer.
185
182
  * @returns The new object containing the buffer's content.
186
183
  */
187
- // @ts-expect-error: @inline is a valid decorator
188
- @inline export function cpyOut<T>(): T {
184
+ export function cpyOut<T>(): T {
185
+ if (cacheOutput !== 0) {
186
+ // A nested/internal stringify can still cover its complete local output
187
+ // with a cached source slice when its saved offset is zero. Copy that
188
+ // slice and restore the caller's staging state just like the regular
189
+ // paused-buffer branch below.
190
+ // @ts-expect-error: __new is a runtime builtin
191
+ const _out = __new(cacheOutputLen, idof<T>());
192
+ memory.copy(_out, cacheOutput, cacheOutputLen);
193
+ cacheOutput = 0;
194
+ cacheOutputLen = 0;
195
+ bs.loadState();
196
+ return changetype<T>(_out);
197
+ }
189
198
  if (pauseOffsets.length == 0) {
190
199
  const len = offset - buffer;
191
200
  // @ts-expect-error: __new is a runtime builtin
@@ -214,8 +223,7 @@ export namespace bs {
214
223
  * Note: this restores only `offset`. Deserialization paths do not currently depend on
215
224
  * `stackSize`, which is tracked for serialization growth heuristics.
216
225
  */
217
- // @ts-expect-error: @inline is a valid decorator
218
- @inline export function sliceOut<T>(start: usize): T {
226
+ export function sliceOut<T>(start: usize): T {
219
227
  const sliceStart = buffer + start;
220
228
  const len = offset - sliceStart;
221
229
  // @ts-expect-error: __new is a runtime builtin
@@ -229,8 +237,7 @@ export namespace bs {
229
237
  * Copies the slice starting at a caller-provided relative buffer offset into a string field
230
238
  * and restores `offset` back to that slice start.
231
239
  */
232
- // @ts-expect-error: @inline is a valid decorator
233
- @inline export function toField(start: usize, dstFieldPtr: usize): void {
240
+ export function toField(start: usize, dstFieldPtr: usize): void {
234
241
  const sliceStart = buffer + start;
235
242
  const byteLength = <u32>(offset - sliceStart);
236
243
  if (byteLength == 0) {
@@ -265,8 +272,7 @@ export namespace bs {
265
272
  * adaptive buffer management - shrinks buffer when consistently oversized.
266
273
  * @returns The new object containing the buffer's content.
267
274
  */
268
- // @ts-expect-error: @inline is a valid decorator
269
- @inline export function out<T>(): T {
275
+ export function out<T>(): T {
270
276
  let out: usize;
271
277
  if (cacheOutput === 0) {
272
278
  const len = offset - buffer;
@@ -296,8 +302,7 @@ export namespace bs {
296
302
  * can pass an empty/uninitialized target on the first call. Mirrors the reuse
297
303
  * policy of `toField`, but for the top-level return value.
298
304
  */
299
- // @ts-expect-error: @inline is a valid decorator
300
- @inline export function outTo<T>(target: usize): T {
305
+ export function outTo<T>(target: usize): T {
301
306
  if (target < __heap_base) return out<T>();
302
307
  let len: usize;
303
308
  let src: usize;
@@ -309,7 +314,7 @@ export namespace bs {
309
314
  src = cacheOutput;
310
315
  }
311
316
  let dst = target;
312
- if (changetype<OBJECT>(target - TOTAL_OVERHEAD).rtSize != len) {
317
+ if (changetype<OBJECT>(target - TOTAL_OVERHEAD).rtSize != <u32>len) {
313
318
  // @ts-expect-error: __renew is a runtime builtin
314
319
  dst = __renew(target, len);
315
320
  }
@@ -371,12 +376,9 @@ export namespace bs {
371
376
  * avoiding re-serialization of previously seen strings.
372
377
  */
373
378
  export namespace sc {
374
- // @ts-expect-error: @inline is a valid decorator
375
- @inline export const ENTRY_KEY = offsetof<sc.Entry>("key");
376
- // @ts-expect-error: @inline is a valid decorator
377
- @inline export const ENTRY_PTR = offsetof<sc.Entry>("ptr");
378
- // @ts-expect-error: @inline is a valid decorator
379
- @inline export const ENTRY_LEN = offsetof<sc.Entry>("len");
379
+ export const ENTRY_KEY = offsetof<sc.Entry>("key");
380
+ export const ENTRY_PTR = offsetof<sc.Entry>("ptr");
381
+ export const ENTRY_LEN = offsetof<sc.Entry>("len");
380
382
 
381
383
  // @ts-expect-error: JSON_CACHE may not be defined. If so, it will default to false.
382
384
  export const CACHE_ENABLED: bool = isDefined(JSON_CACHE) ? JSON_CACHE : false;
@@ -425,8 +427,7 @@ export namespace sc {
425
427
  * Uses pointer address shifted right by 4 bits (aligned to 16-byte boundaries)
426
428
  * masked to fit within cache size.
427
429
  */
428
- // @ts-expect-error: @inline is a valid decorator
429
- @inline
430
+
430
431
  export function indexFor(ptr: usize): usize {
431
432
  return (ptr >> 4) & CACHE_MASK;
432
433
  }
@@ -437,8 +438,7 @@ export namespace sc {
437
438
  * @param key - The string pointer to look up
438
439
  * @returns true if cache hit, false if cache miss
439
440
  */
440
- // @ts-expect-error: @inline is a valid decorator
441
- @inline
441
+
442
442
  export function tryEmitCached(key: usize): bool {
443
443
  const e = unchecked(entries[indexFor(key)]);
444
444
  if (e.key == key) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "json-as",
3
- "version": "1.4.0",
4
- "author": "Jairus Tanaka",
3
+ "version": "1.6.0",
4
+ "author": "Jairus Tanaka <me@jairus.dev>",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/JairusSW/json-as.git"
@@ -11,15 +11,16 @@
11
11
  "devDependencies": {
12
12
  "@assemblyscript/wasi-shim": "^0.1.0",
13
13
  "@eslint/js": "^10.0.1",
14
- "@types/node": "^25.9.1",
14
+ "@types/node": "^25.9.2",
15
15
  "as-heap-analyzer": "^1.2.0",
16
- "as-test": "^1.6.0",
17
- "assemblyscript": "^0.28.17",
16
+ "as-test": "github:JairusSW/as-test#332ae81bedeb68b98b824563c6efe7e050eaef4e",
17
+ "assemblyscript": "^0.28.18",
18
18
  "assemblyscript-json": "^1.1.0",
19
19
  "assemblyscript-prettier": "^3.0.4",
20
+ "canvas": "^3.2.3",
20
21
  "chartjs-node-canvas": "^5.0.0",
21
22
  "chartjs-plugin-datalabels": "^2.2.0",
22
- "eslint": "^10.4.0",
23
+ "eslint": "^10.4.1",
23
24
  "fast-json-parse": "^1.0.3",
24
25
  "fast-json-stringify": "^6.4.0",
25
26
  "husky": "^9.1.7",
@@ -29,7 +30,8 @@
29
30
  "tinybench": "^6.0.2",
30
31
  "try-as": "^1.1.4",
31
32
  "typescript": "^6.0.3",
32
- "typescript-eslint": "^8.60.0"
33
+ "typescript-eslint": "^8.60.1",
34
+ "warpo": "^3.1.1"
33
35
  },
34
36
  "bugs": {
35
37
  "url": "https://github.com/JairusSW/json-as/issues"
@@ -46,6 +48,7 @@
46
48
  "Loredana Cirstea",
47
49
  "Accipiter Nisus",
48
50
  "Deon Groenewald",
51
+ "Guillermo Diez",
49
52
  "yoyo837"
50
53
  ],
51
54
  "description": "The only JSON library you'll need for AssemblyScript with SIMD and SWAR",
@@ -98,10 +101,16 @@
98
101
  "test:ci": "ast test --parallel --clean --enable try-as",
99
102
  "test:coverage": "ast test --enable coverage --enable try-as",
100
103
  "bench": "bash -c 'bash ./scripts/run-bench.as.sh \"$@\" && { arg=\"${1:-}\"; if [ -z \"$arg\" ] || [ \"${arg#custom/}\" = \"$arg\" ]; then bash ./scripts/run-bench.js.sh \"$@\"; fi; } && bash ./scripts/build-charts.sh' --",
104
+ "bench:all": "bash ./scripts/bench-all.sh",
101
105
  "bench:as": "bash ./scripts/run-bench.as.sh",
102
106
  "bench:js": "bash ./scripts/run-bench.js.sh",
107
+ "bench:runtimes": "bash ./scripts/run-bench.runtimes.sh",
108
+ "bench:warpo": "bash ./scripts/run-bench.warpo.sh",
103
109
  "charts": "bun run charts:build && bun run charts:serve",
104
110
  "charts:build": "bash ./scripts/build-charts.sh",
111
+ "charts:runtimes": "bun ./scripts/build-chart-runtimes.ts",
112
+ "charts:warpo": "bun ./scripts/build-chart-warpo.ts",
113
+ "charts:rfc": "bun ./scripts/build-rfc-coverage.ts",
105
114
  "charts:publish": "bash ./scripts/publish-benchmarks.sh",
106
115
  "charts:serve": "serve ./build/charts/",
107
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",
@@ -111,10 +120,15 @@
111
120
  "test:wasmer": "wasmer ./build/test.wasm",
112
121
  "build:transform": "tsc -p ./transform",
113
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",
114
124
  "build:pg": "npm run build:playground",
115
125
  "run:playground": "wasmtime ./build/playground.wasm",
116
126
  "run:pg": "npm run run:playground",
117
127
  "playground": "npm run build:playground && npm run run:playground",
128
+ "playground:nosimd": "npm run build:playground:nosimd && npm run run:playground",
129
+ "build:playground:tmp": "asc assembly/playground.tmp.ts -o ./build/playground.tmp.wasm --textFile ./build/playground.tmp.wat -O3 --noAssert --uncheckedBehavior always --runtime incremental --enable bulk-memory --enable simd --use JSON_MODE=1 --exportStart start --exportRuntime",
130
+ "playground:tmp": "npm run build:playground:tmp && v8 --no-liftoff --module ./bench/runners/assemblyscript.js -- playground.tmp.wasm",
131
+ "pg:tmp": "npm run playground:tmp",
118
132
  "play": "npm run playground",
119
133
  "pg": "npm run playground",
120
134
  "bench:wasmer": "wasmer ./build/bench.wasm --llvm",
@@ -132,5 +146,8 @@
132
146
  "prepare": "husky"
133
147
  },
134
148
  "type": "module",
135
- "types": "assembly/index.ts"
149
+ "types": "assembly/index.ts",
150
+ "dependencies": {
151
+ "xjb-as": "^0.1.0"
152
+ }
136
153
  }
@@ -21,6 +21,12 @@ export declare class JSONTransform extends Visitor {
21
21
  private collectInheritedFieldMembers;
22
22
  visitClassDeclarationRef(node: ClassDeclaration): void;
23
23
  resolveType(type: string, source: Src, visited?: Set<string>): string;
24
+ private getDefaultSchema;
25
+ private getDefaultElementType;
26
+ private getDefaultExpressionJSON;
27
+ private getImplicitDefaultJSON;
28
+ private getDefaultObjectJSON;
29
+ private getDefaultMatcherSource;
24
30
  visitClassDeclaration(node: ClassDeclaration): void;
25
31
  getSchema(name: string): Schema | null;
26
32
  generateEmptyMethods(node: ClassDeclaration): void;