json-as 1.2.1 → 1.2.2-beta.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.
Files changed (79) hide show
  1. package/package.json +1 -1
  2. package/.github/FUNDING.yml +0 -1
  3. package/.github/dependabot.yml +0 -11
  4. package/.github/workflows/benchmark.yml +0 -72
  5. package/.github/workflows/release-package.yml +0 -47
  6. package/.github/workflows/tests.yml +0 -25
  7. package/.prettierignore +0 -9
  8. package/.prettierrc.json +0 -7
  9. package/.trunk/configs/.markdownlint.yaml +0 -2
  10. package/.trunk/configs/.shellcheckrc +0 -7
  11. package/.trunk/configs/.yamllint.yaml +0 -7
  12. package/.trunk/trunk.yaml +0 -37
  13. package/CHANGELOG.md +0 -334
  14. package/SECURITY.md +0 -32
  15. package/asconfig.json +0 -7
  16. package/assembly/__benches__/abc.bench.ts +0 -28
  17. package/assembly/__benches__/large.bench.ts +0 -238
  18. package/assembly/__benches__/lib/bench.ts +0 -85
  19. package/assembly/__benches__/medium.bench.ts +0 -128
  20. package/assembly/__benches__/small.bench.ts +0 -46
  21. package/assembly/__benches__/throughput.ts +0 -172
  22. package/assembly/__benches__/vec3.bench.ts +0 -37
  23. package/assembly/__tests__/arbitrary.spec.ts +0 -35
  24. package/assembly/__tests__/array.spec.ts +0 -145
  25. package/assembly/__tests__/bool.spec.ts +0 -12
  26. package/assembly/__tests__/box.spec.ts +0 -27
  27. package/assembly/__tests__/custom.spec.ts +0 -56
  28. package/assembly/__tests__/date.spec.ts +0 -36
  29. package/assembly/__tests__/enum.spec.ts +0 -35
  30. package/assembly/__tests__/float.spec.ts +0 -42
  31. package/assembly/__tests__/generics.spec.ts +0 -49
  32. package/assembly/__tests__/hierarchy.spec.ts +0 -61
  33. package/assembly/__tests__/integer.spec.ts +0 -26
  34. package/assembly/__tests__/lib/index.ts +0 -41
  35. package/assembly/__tests__/map.spec.ts +0 -7
  36. package/assembly/__tests__/namespace.spec.ts +0 -63
  37. package/assembly/__tests__/null.spec.ts +0 -12
  38. package/assembly/__tests__/raw.spec.ts +0 -23
  39. package/assembly/__tests__/resolving.spec.ts +0 -55
  40. package/assembly/__tests__/staticarray.spec.ts +0 -12
  41. package/assembly/__tests__/string.spec.ts +0 -30
  42. package/assembly/__tests__/struct.spec.ts +0 -163
  43. package/assembly/__tests__/test.spec.ts +0 -3
  44. package/assembly/__tests__/types.spec.ts +0 -27
  45. package/assembly/__tests__/types.ts +0 -98
  46. package/assembly/test.tmp.ts +0 -133
  47. package/bench/abc.bench.ts +0 -25
  48. package/bench/large.bench.ts +0 -127
  49. package/bench/lib/bench.d.ts +0 -27
  50. package/bench/lib/bench.js +0 -53
  51. package/bench/lib/chart.ts +0 -217
  52. package/bench/medium.bench.ts +0 -68
  53. package/bench/runners/assemblyscript.js +0 -34
  54. package/bench/small.bench.ts +0 -34
  55. package/bench/throughput.ts +0 -87
  56. package/bench/tsconfig.json +0 -13
  57. package/bench/vec3.bench.ts +0 -30
  58. package/bench.ts +0 -18
  59. package/ci/bench/lib/bench.ts +0 -42
  60. package/ci/bench/runners/assemblyscript.js +0 -29
  61. package/ci/run-bench.as.sh +0 -63
  62. package/publish.sh +0 -78
  63. package/run-bench.as.sh +0 -60
  64. package/run-bench.js.sh +0 -36
  65. package/run-tests.sh +0 -51
  66. package/scripts/build-chart01.ts +0 -38
  67. package/scripts/build-chart02.ts +0 -38
  68. package/scripts/build-chart03.ts +0 -139
  69. package/scripts/build-chart05.ts +0 -47
  70. package/scripts/generate-as-class.ts +0 -50
  71. package/scripts/lib/bench-utils.ts +0 -308
  72. package/transform/src/builder.ts +0 -1375
  73. package/transform/src/index.ts +0 -1486
  74. package/transform/src/linkers/alias.ts +0 -58
  75. package/transform/src/linkers/custom.ts +0 -32
  76. package/transform/src/linkers/imports.ts +0 -22
  77. package/transform/src/types.ts +0 -300
  78. package/transform/src/util.ts +0 -128
  79. package/transform/src/visitor.ts +0 -530
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "json-as",
3
- "version": "1.2.1",
3
+ "version": "1.2.2-beta.1",
4
4
  "author": "Jairus Tanaka",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1 +0,0 @@
1
- github: [JairusSW]
@@ -1,11 +0,0 @@
1
- # To get started with Dependabot version updates, you'll need to specify which
2
- # package ecosystems to update and where the package manifests are located.
3
- # Please see the documentation for all configuration options:
4
- # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5
-
6
- version: 2
7
- updates:
8
- - package-ecosystem: "npm" # Set to npm since you're using npm
9
- directory: "/" # Location of package manifests, assuming package.json is at the root
10
- schedule:
11
- interval: "weekly" # Frequency of updates: "daily", "weekly", or "monthly"
@@ -1,72 +0,0 @@
1
- name: Benchmark
2
-
3
- on:
4
- push:
5
- branches: [ main ]
6
- pull_request:
7
- branches: [ main ]
8
- workflow_dispatch:
9
- repository_dispatch:
10
-
11
- jobs:
12
- benchmark:
13
- runs-on: ubuntu-latest
14
- steps:
15
- - name: Checkout Repository
16
- uses: actions/checkout@v3
17
- continue-on-error: false
18
-
19
- - name: Setup Bun
20
- uses: oven-sh/setup-bun@v1
21
- continue-on-error: true
22
-
23
- - name: Install Dependencies
24
- run: bun install || true
25
- continue-on-error: true
26
-
27
- - name: Install JSVU and V8
28
- run: |
29
- bunx jsvu --os=linux64 --engines=v8 || true
30
- echo "${HOME}/.jsvu/bin" >> $GITHUB_PATH
31
- continue-on-error: true
32
-
33
- - name: Install Binaryen
34
- run: sudo apt-get update && sudo apt-get install -y binaryen || true
35
- continue-on-error: true
36
-
37
- - name: Run AssemblyScript Benchmarks
38
- run: ./run-bench.as.sh || true
39
- continue-on-error: true
40
-
41
- - name: Run JavaScript Benchmarks
42
- run: ./run-bench.js.sh || true
43
- continue-on-error: true
44
-
45
- - name: Build Charts
46
- run: |
47
- mkdir -p data
48
- bun ./scripts/build-chart01.ts || true
49
- bun ./scripts/build-chart02.ts || true
50
- continue-on-error: true
51
-
52
- - name: Commit Charts to docs branch
53
- continue-on-error: true
54
- run: |
55
- set -e
56
- git config user.name "github-actions"
57
- git config user.email "actions@github.com"
58
-
59
- # Ensure the docs branch exists locally
60
- git fetch origin docs || true
61
- if git rev-parse --verify docs >/dev/null 2>&1; then
62
- git branch -D docs || true
63
- fi
64
- git checkout -b docs origin/docs || git checkout --orphan docs || true
65
-
66
- # Copy generated charts
67
- mkdir -p charts
68
- cp data/*.svg charts/ || true
69
-
70
- git add charts/ || true
71
- git commit -m "Update benchmark charts [skip ci]" || echo "No changes to commit"
72
- git push origin docs --force || true
@@ -1,47 +0,0 @@
1
- name: Node.js Package
2
-
3
- on:
4
- release:
5
- types: [created]
6
-
7
- jobs:
8
- build:
9
- runs-on: ubuntu-latest
10
- steps:
11
- - uses: actions/checkout@v4
12
- - uses: actions/setup-node@v3
13
- with:
14
- node-version: 16
15
-
16
- - name: Install Wasmtime
17
- uses: jcbhmr/setup-wasmtime@v2
18
-
19
- - name: Setup Node.js
20
- uses: actions/setup-node@v2
21
-
22
- - name: Install dependencies
23
- if: steps.node-cache.outputs.cache-hit != 'true'
24
- run: yarn
25
-
26
- - name: Build tests
27
- run: yarn run tests:build
28
-
29
- - name: Perform tests
30
- run: yarn run test
31
-
32
- publish-gpr:
33
- needs: build
34
- runs-on: ubuntu-latest
35
- permissions:
36
- packages: write
37
- contents: read
38
- steps:
39
- - uses: actions/checkout@v4
40
- - uses: actions/setup-node@v3
41
- with:
42
- node-version: 22
43
- registry-url: https://npm.pkg.github.com/
44
- - run: npm ci
45
- - run: npm publish
46
- env:
47
- NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
@@ -1,25 +0,0 @@
1
- name: Bun/Wasmtime CI
2
-
3
- on: [push, pull_request]
4
-
5
- jobs:
6
- build:
7
- runs-on: ubuntu-latest
8
-
9
- steps:
10
- - name: Checkout the repository
11
- uses: actions/checkout@v4
12
-
13
- - name: Install Wasmtime
14
- run: |
15
- curl https://wasmtime.dev/install.sh -sSf | bash
16
- echo "$HOME/.wasmtime/bin" >> $GITHUB_PATH
17
-
18
- - name: Setup Bun
19
- uses: oven-sh/setup-bun@v1
20
-
21
- - name: Install Dependencies
22
- run: bun install
23
-
24
- - name: Run Tests
25
- run: bash ./run-tests.sh
package/.prettierignore DELETED
@@ -1,9 +0,0 @@
1
- # Build artifacts
2
- build/
3
- transform/lib
4
-
5
- # Tables
6
- assembly/globals/tables.ts
7
-
8
- # Markdown
9
- *.md
package/.prettierrc.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "pluginSearchDirs": ["node_modules"],
3
- "plugins": ["assemblyscript-prettier"],
4
- "singleQuote": false,
5
- "printWidth": 65536,
6
- "tabWidth": 2
7
- }
@@ -1,2 +0,0 @@
1
- # Prettier friendly markdownlint config (all formatting rules disabled)
2
- extends: markdownlint/style/prettier
@@ -1,7 +0,0 @@
1
- enable=all
2
- source-path=SCRIPTDIR
3
- disable=SC2154
4
-
5
- # If you're having issues with shellcheck following source, disable the errors via:
6
- # disable=SC1090
7
- # disable=SC1091
@@ -1,7 +0,0 @@
1
- rules:
2
- quoted-strings:
3
- required: only-when-needed
4
- extra-allowed: ["{|}"]
5
- key-duplicates: {}
6
- octal-values:
7
- forbid-implicit-octal: true
package/.trunk/trunk.yaml DELETED
@@ -1,37 +0,0 @@
1
- # This file controls the behavior of Trunk: https://docs.trunk.io/cli
2
- # To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml
3
- version: 0.1
4
- cli:
5
- version: 1.22.10
6
- # Trunk provides extensibility via plugins. (https://docs.trunk.io/plugins)
7
- plugins:
8
- sources:
9
- - id: trunk
10
- ref: v1.6.7
11
- uri: https://github.com/trunk-io/plugins
12
- # Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes)
13
- runtimes:
14
- enabled:
15
- - go@1.21.0
16
- - node@18.20.5
17
- - python@3.10.8
18
- # This is the section where you manage your linters. (https://docs.trunk.io/check/configuration)
19
- lint:
20
- disabled:
21
- - markdownlint
22
- enabled:
23
- - actionlint@1.7.7
24
- - checkov@3.2.377
25
- - git-diff-check
26
- - prettier@3.5.2
27
- - shellcheck@0.10.0
28
- - shfmt@3.6.0
29
- - trufflehog@3.88.13
30
- - yamllint@1.35.1
31
- actions:
32
- disabled:
33
- - trunk-announce
34
- - trunk-check-pre-push
35
- - trunk-fmt-pre-commit
36
- enabled:
37
- - trunk-upgrade-available
package/CHANGELOG.md DELETED
@@ -1,334 +0,0 @@
1
- # Change Log
2
-
3
- ## 2025-12-23 - 1.2.1
4
-
5
- - chore: fix chart link in readme
6
-
7
- ## 2025-12-23 - 1.2.0
8
-
9
- - feat: Implement SWAR based algorithms, SIMD improvements, and better documentation.
10
-
11
- ## 2025-12-21 - 1.1.26
12
-
13
- - chore: remove log
14
-
15
- ## 2025-12-21 - 1.1.25
16
-
17
- - feat: Implement SWAR-based string serialization
18
-
19
- ## 2025-11-28 - 1.1.24
20
-
21
- - feat: Implement a moving average window to determine buffer size (essentially, allow the buffer size to shrink) [#163](https://github.com/JairusSW/json-as/pull/163)
22
-
23
- ## 2025-11-06 - 1.1.23
24
-
25
- - fix: Map keys should follow proper typing and quote rules [#161](https://github.com/JairusSW/json-as/issues/161)
26
-
27
- ## 2025-09-01 - 1.1.22
28
-
29
- - fix: Type aliases should work across files [#154](https://github.com/JairusSW/json-as/issues/154)
30
-
31
- ## 2025-08-14 - 1.1.21
32
-
33
- - fix: JSON.parse on classes with enums [#155](https://github.com/JairusSW/json-as/issues/155)
34
- - fix: Resolve memory OOB issue within `serializeFloat` function [#153](https://github.com/JairusSW/json-as/issues/153)
35
-
36
- ## 2025-07-14 - 1.1.20
37
-
38
- - feat: enable SIMD string serialization
39
-
40
- ## 2025-06-30 - 1.1.19
41
-
42
- - fix: wrong path used in `readFileSync` when importing from a library
43
-
44
- ## 2025-06-30 - 1.1.18
45
-
46
- - fix: [#150](https://github.com/JairusSW/json-as/issues/150)
47
-
48
- ## 2025-06-17 - 1.1.17
49
-
50
- - fix: add support for classes within namespaces [#147](https://github.com/JairusSW/json-as/pull/147)
51
-
52
- ## 2025-06-12 - 1.1.16
53
-
54
- - tests: properly support nulls (in testing lib)
55
- - fix: initialize generic properties correctly
56
- - fix: make generated imports compatible with windows
57
- - feat: add support for fields marked with `readonly`
58
-
59
- ## 2025-06-09 - 1.1.15
60
-
61
- - feat: add `.as<T>()` method to `JSON.Value`
62
- - chore: remove all references to `__SERIALIZE_CUSTOM`
63
- - feat: add support for `StaticArray` serialization
64
- - feat: support `JSON.Raw` in array types
65
- - tests: add tests for `JSON.Raw[]`
66
-
67
- ## 2025-05-29 - 1.1.14
68
-
69
- - fix: hotfix schema resolver
70
-
71
- ## 2025-05-29 - 1.1.13
72
-
73
- - fix: small issues with schema linking
74
- - tests: add tests for schema linking and discovery
75
-
76
- ## 2025-05-29 - 1.1.12
77
-
78
- - fix: add helpful warning on unknown or unaccessible types in fields
79
- - feat: support deserialization of class generics
80
- - fix: add support for numerical generics
81
- - tests: add proper testing for generics
82
- - feat: support type aliases with a custom type resolver/linker
83
- - chore: add other linkers to tsconfig and clean up
84
- - feat: add type alias resolving
85
-
86
- ## 2025-05-28 - 1.1.11
87
-
88
- - fix: class resolving should only search top level statements for class declarations
89
- - fix: add helpful error if class is missing an @json decorator
90
- - fix: properly calculate relative path when json-as is a library
91
- - fix: add proper null check when resolving imported classes
92
-
93
- ## 2025-05-28 - 1.1.10
94
-
95
- - feat: add more debug levels (1 = print transform code, 2 = print keys/values at runtime)
96
- - feat: add write out feature (`JSON_WRITE=path-to-file.ts`) which writes out generated code
97
- - fix: complete full parity between port and original version for correct deserialization of all types
98
- - feat: add proper schema resolution and dependency resolution
99
- - feat: add proper type resolution to schema fields
100
- - fix: properly calculate the relative path between imports to modules
101
-
102
- ## 2025-05-27 - 1.1.9
103
-
104
- - change: strict mode is disabled by default. Enable it with JSON_STRICT=true
105
- - fix: should ignore properties of same length and type if no matching key exists
106
- - fix: should ignore properties of different type if no matching key exists
107
- - fix: should ignore complex properties if no matching key exists
108
-
109
- ## 2025-05-27 - 1.1.8
110
-
111
- - feat: add support for calling `JSON.stringify/JSON.parse` methods inside of custom serializers, but not yet deserializers
112
-
113
- ## 2025-05-27 - 1.1.7
114
-
115
- - fix: bad boolean logic to decide whether to add 2nd break statement
116
-
117
- ## 2025-05-23 - 1.1.6
118
-
119
- - fix: null and boolean fields would miscalculate offsets when deserializing
120
-
121
- ## 2025-05-23 - 1.1.5
122
-
123
- - fix: index.js didn't point to correct file, thus creating a compiler crash
124
-
125
- ## 2025-05-23 - 1.1.4
126
-
127
- - revert: grouping properties in favor of memory.compare
128
-
129
- ## 2025-05-23 - 1.1.3
130
-
131
- - feat: group properties of structs before code generation
132
- - fix: break out of switch case after completion
133
- - ci: make compatible with act for local testing
134
-
135
- ## 2025-05-22 - 1.1.2
136
-
137
- - fix: correct small typos in string value deserialization port
138
-
139
- ## 2025-05-22 - 1.1.1
140
-
141
- - fix: remove random logs
142
-
143
- ## 2025-05-22 - 1.1.0
144
-
145
- - fix: change _DESERIALIZE<T> to _JSON_T to avoid populating local scope
146
-
147
- ## 2025-05-22 - 1.0.9
148
-
149
- - fix: [#132](https://github.com/JairusSW/json-as/issues/132)
150
- - feat: allow base classes to use their child classes if the signatures match
151
- - perf: rewrite struct deserialization to be significantly faster
152
- - fix: [#131](https://github.com/JairusSW/json-as/issues/131) Generic classes with custom deserializer crashing
153
- - fix: [#66](https://github.com/JairusSW/json-as/issues/66) Throw error when additional keys are in JSON
154
-
155
- ## 2025-05-21 - 1.0.8
156
-
157
- - fix: inline warnings on layer-2 serialize and deserialize functions
158
- - feat: fully support `JSON.Obj` and `JSON.Box` everywhere
159
- - fix: temp disable SIMD
160
- - feat: write fair benchmarks with `v8` using `jsvu`
161
-
162
- ## 2025-05-14 - 1.0.7
163
-
164
- - merge: pull request [#128](https://github.com/JairusSW/json-as/pull/128) from [loredanacirstea/nested-custom-serializer-fix](https://github.com/loredanacirstea/nested-custom-serializer-fix)
165
-
166
- ## 2025-05-12 - 1.0.6
167
-
168
- - fix: support zero-param serialization and make sure types are consistent
169
- - fix: [#124](https://github.com/JairusSW/json-as/issues/124)
170
-
171
- ## 2025-05-11 - 1.0.5
172
-
173
- - feat: add sanity checks for badly formatted strings
174
- - fix: [#120](https://github.com/JairusSW/json-as/issues/120) handle empty `JSON.Obj` serialization
175
- - feat: add SIMD optimization if SIMD is enabled by user
176
- - fix: handle structs with nullable array as property [#123](https://github.com/JairusSW/json-as/pull/123)
177
- - fix: struct serialization from writing to incorrect parts of memory when parsing nested structs [#125](https://github.com/JairusSW/json-as/pull/125)
178
- - chore: add two new contributors
179
-
180
- ## 2025-04-07 - 1.0.4
181
-
182
- - fix: paths must be resolved as POSIX in order to be valid TypeScript imports [#116](https://github.com/JairusSW/json-as/issues/116)
183
-
184
- ## 2025-03-24 - 1.0.3
185
-
186
- - fix: make transform windows-compatible [#119](https://github.com/JairusSW/json-as/issues/119?reload=1)
187
-
188
- ## 2025-03-19 - 1.0.2
189
-
190
- - fix: include check for nullable types for properties when deserialization is called internally [#118](https://github.com/JairusSW/json-as/pull/118)
191
-
192
- ## 2025-03-10 - 1.0.1
193
-
194
- - docs: add comprehensive performance metrics
195
-
196
- ## 2025-03-09 - 1.0.0
197
-
198
- - fix: relative paths pointing through node_modules would create a second Source
199
- - feat: move behavior of `--lib` into transform itself
200
- - fix: object with an object as a value containing a rhs bracket or brace would exit early [3b33e94](https://github.com/JairusSW/json-as/commit/3b33e9414dc04779d22d65272863372fcd7af4a6)
201
-
202
- ## 2025-03-04 - 1.0.0-beta.17
203
-
204
- - fix: forgot to build transform
205
-
206
- ## 2025-03-04 - 1.0.0-beta.16
207
-
208
- - fix: isPrimitive should only trigger on actual primitives
209
-
210
- ## 2025-03-04 - 1.0.0-beta.15
211
-
212
- - fix: deserialize custom should take in string
213
-
214
- ## 2025-03-04 - 1.0.0-beta.14
215
-
216
- - fix: reference to nonexistent variable during custom deserialization layer 2
217
-
218
- ## 2025-03-04 - 1.0.0-beta.13
219
-
220
- - fix: forgot to actually build the transform
221
-
222
- ## 2025-03-04 - 1.0.0-beta.12
223
-
224
- - fix: build transform
225
-
226
- ## 2025-03-04 - 1.0.0-beta.11
227
-
228
- - fix: wrongly assumed pointer types within arbitrary deserialization
229
- - fix: wrong pointer type being passed during map deserialization
230
-
231
- ## 2025-03-04 - 1.0.0-beta.10
232
-
233
- - fix: transform not generating the right load operations for keys
234
- - fix: whitespace not working in objects or struct deserialization
235
- - fix: JSON.Raw not working when deserializing as Map<string, JSON.Raw>
236
-
237
- ## 2025-03-03 - 1.0.0-beta.9
238
-
239
- - rename: change libs folder to lib
240
-
241
- ## 2025-03-03 - 1.0.0-beta.8
242
-
243
- - docs: add instructions for using `--lib` in README
244
-
245
- ## 2025-03-03 - 1.0.0-beta.7
246
-
247
- - fix: add as-bs to `--lib` section
248
- - chore: clean up transform
249
- - refactor: transform should import `~lib/as-bs.ts` instead of relative path
250
-
251
- ## 2025-03-01 - 1.0.0-beta.6
252
-
253
- - fix: import from base directory index.ts
254
-
255
- ## 2025-03-01 - 1.0.0-beta.5
256
-
257
- - fix: revert pull request [#112](https://github.com/JairusSW/json-as/pull/112)
258
-
259
- ## 2025-02-25 - 1.0.0-beta.4
260
-
261
- - fix: warn on presence of invalid types contained in a schema [#112](https://github.com/JairusSW/json-as/pull/112)
262
-
263
- ## 2025-02-25 - 1.0.0-beta.3
264
-
265
- - feat: change `JSON.Raw` to actual class to facilitate proper support without transformations
266
- - fix: remove old `JSON.Raw` logic from transform code
267
-
268
- ## 2025-02-25 - 1.0.0-beta.2
269
-
270
- - feat: add support for custom serializers and deserializers [#110](https://github.com/JairusSW/json-as/pull/110)
271
-
272
- ## 2025-02-22 - 1.0.0-beta.1
273
-
274
- - perf: add benchmarks for both AssemblyScript and JavaScript
275
- - docs: publish preliminary benchmark results
276
- - tests: ensure nested serialization works and add to tests
277
- - feat: finish arbitrary type implementation
278
- - feat: introduce `JSON.Obj` to handle objects effectively
279
- - feat: reimplement arbitrary array deserialization
280
- - fix: remove brace check on array deserialization
281
- - feat: introduce native support for `JSON.Obj` transformations
282
- - feat: implement arbitrary object serialization
283
- - fix: deserialization of booleans panics on `false`
284
- - fix: `bs.resize` should be type-safe
285
- - impl: add `JSON.Obj` type as prototype to handle arbitrary object structures
286
- - chore: rename static objects (schemas) to structs and name arbitrary objects as `obj`
287
- - tests: add proper tests for arbitrary types
288
- - fix: empty method generation using outdated function signature
289
- - docs: update readme to be more concise
290
-
291
- ## 2025-02-13 - 1.0.0-alpha.4
292
-
293
- - feat: reintroduce support for `Box<T>`-wrapped primitive types
294
- - tests: add extensive tests to all supported types
295
- - fix: 6-byte keys being recognized on deserialize
296
- - perf: take advantage of aligned memory to use a single 64-bit load on 6-byte keys
297
- - fix: `bs.proposeSize()` should increment `stackSize` by `size` instead of setting it
298
- - fix: allow runtime to manage `bs.buffer`
299
- - fix: memory leaks in `bs` module
300
- - fix: add (possibly temporary) `JSON.Memory.shrink()` to shrink memory in `bs`
301
- - perf: prefer growing memory by `nextPowerOf2(size + 64)` for less reallocations
302
- - tests: add boolean tests to `Box<T>`
303
- - fix: serialization of non-growable data types should grow `bs.stackSize`
304
-
305
- ## 2025-01-31 - 1.0.0-alpha.3
306
-
307
- - fix: write to proper offset when deserializing string with \u0000-type escapes
308
- - fix: simplify and fix memory offset issues with bs module
309
- - fix: properly predict minimum size of to-be-serialized schemas
310
- - fix: replace as-test with temporary framework to mitigate json-as versioning issues
311
- - fix: fix multiple memory leaks during serialization
312
- - feat: align memory allocations for better performance
313
- - feat: achieve a space complexity of O(n) for serialization operations, unless dealing with \u0000-type escapes
314
-
315
- ## 2025-01-20 - 1.0.0-alpha.2
316
-
317
- - fix: disable SIMD in generated transform code by default
318
- - fix: re-add as-bs dependency so that it will not break in non-local environments
319
- - fix: remove AS201 'conversion from type usize to i32' warning
320
- - fix: add as-bs to peer dependencies so only one version is installed
321
- - fix: point as-bs imports to submodule
322
- - fix: remove submodule in favor of static module
323
- - fix: bs.ensureSize would not grow and thus cause memory faults
324
- - fix: bs.ensureSize triggering unintentionally
325
-
326
- ## 2025-01-20 - 1.0.0-alpha.1
327
-
328
- - feat: finish implementation of arbitrary data serialization and deserialization using JSON.Value
329
- - feat: reinstate usage of `JSON.Box<T>()` to support nullable primitive types
330
- - feat: eliminate the need to import the `JSON` namespace when defining a schema
331
- - feat: reduce memory usage so that it is viable for low-memory environments
332
- - feat: write to a central buffer and reduce memory overhead
333
- - feat: rewrite the transform to properly resolve schemas and link them together
334
- - feat: pre-allocate and compute the minimum size of a schema to avoid memory out of range errors
package/SECURITY.md DELETED
@@ -1,32 +0,0 @@
1
- # Security Policy
2
-
3
- ## Supported Versions
4
-
5
- | Version | Supported |
6
- | ------- | ------------------ |
7
- | 1.x.x | Active Development |
8
- | 0.9.x | Maintainence |
9
- | <=0.8.x | Unsupported |
10
-
11
- ## Reporting a Vulnerability
12
-
13
- If you believe you have discovered a security vulnerability in this project, please report it as soon as possible. Follow the steps below to report a vulnerability:
14
-
15
- 1. **Report via GitHub Issues**: Please submit your vulnerability report via the [GitHub Issues](https://github.com/JairusSW/json-as/issues) page. If you prefer, you can also send an email directly to [me@jairus.dev](mailto:me@jairus.dev).
16
-
17
- 2. **Provide Details**: Include as much detail as possible, including the steps to reproduce, what you believe the impact is, and any suggested remediation if applicable.
18
-
19
- 3. **Acknowledgment**: Once your report is received, we will acknowledge it within 48 hours. You will then receive an update on the progress of the investigation and a timeline for a potential fix.
20
-
21
- 4. **Resolution Timeline**:
22
-
23
- - Critical vulnerabilities will be prioritized, and we aim to issue a patch within 7 business days.
24
- - Non-critical vulnerabilities will be evaluated and addressed in the next stable release.
25
- - If the vulnerability is accepted, a fix will be issued, and a security advisory will be published.
26
- - If the vulnerability is declined, you will be notified of the decision with an explanation.
27
-
28
- 5. **Confidentiality**: Please do not disclose the vulnerability to the public or other parties until the issue has been addressed. This helps ensure that users of the project are not at risk before a patch is available.
29
-
30
- 6. **Credits**: If your report leads to a fix, we will credit your contribution in the release notes, if you are comfortable with that.
31
-
32
- Thank you for helping us keep this project secure!
package/asconfig.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "targets": {},
3
- "options": {
4
- "transform": [],
5
- "disableWarning": []
6
- }
7
- }
@@ -1,28 +0,0 @@
1
- import { JSON } from "..";
2
- import { expect } from "../__tests__/lib";
3
- import { bench, blackbox, dumpToFile } from "./lib/bench";
4
-
5
- const v1 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
6
- const v2 = '"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"';
7
-
8
- expect(JSON.stringify(v1)).toBe(v2);
9
-
10
- bench(
11
- "Serialize Alphabet",
12
- () => {
13
- blackbox(inline.always(JSON.stringify(v1)));
14
- },
15
- 24_000_00,
16
- v1.length << 1,
17
- );
18
- dumpToFile("abc", "serialize")
19
-
20
- bench(
21
- "Deserialize Alphabet",
22
- () => {
23
- blackbox(inline.always(JSON.parse<string>(v2)));
24
- },
25
- 24_000_00,
26
- v2.length << 1,
27
- );
28
- dumpToFile("abc", "deserialize")