json-as 1.2.0 → 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.
- package/README.md +2 -2
- package/package.json +1 -1
- package/.github/FUNDING.yml +0 -1
- package/.github/dependabot.yml +0 -11
- package/.github/workflows/benchmark.yml +0 -72
- package/.github/workflows/release-package.yml +0 -47
- package/.github/workflows/tests.yml +0 -25
- package/.prettierignore +0 -9
- package/.prettierrc.json +0 -7
- package/.trunk/configs/.markdownlint.yaml +0 -2
- package/.trunk/configs/.shellcheckrc +0 -7
- package/.trunk/configs/.yamllint.yaml +0 -7
- package/.trunk/trunk.yaml +0 -37
- package/CHANGELOG.md +0 -330
- package/SECURITY.md +0 -32
- package/asconfig.json +0 -7
- package/assembly/__benches__/abc.bench.ts +0 -28
- package/assembly/__benches__/large.bench.ts +0 -238
- package/assembly/__benches__/lib/bench.ts +0 -85
- package/assembly/__benches__/medium.bench.ts +0 -128
- package/assembly/__benches__/small.bench.ts +0 -46
- package/assembly/__benches__/throughput.ts +0 -172
- package/assembly/__benches__/vec3.bench.ts +0 -37
- package/assembly/__tests__/arbitrary.spec.ts +0 -35
- package/assembly/__tests__/array.spec.ts +0 -145
- package/assembly/__tests__/bool.spec.ts +0 -12
- package/assembly/__tests__/box.spec.ts +0 -27
- package/assembly/__tests__/custom.spec.ts +0 -56
- package/assembly/__tests__/date.spec.ts +0 -36
- package/assembly/__tests__/enum.spec.ts +0 -35
- package/assembly/__tests__/float.spec.ts +0 -42
- package/assembly/__tests__/generics.spec.ts +0 -49
- package/assembly/__tests__/hierarchy.spec.ts +0 -61
- package/assembly/__tests__/integer.spec.ts +0 -26
- package/assembly/__tests__/lib/index.ts +0 -41
- package/assembly/__tests__/map.spec.ts +0 -7
- package/assembly/__tests__/namespace.spec.ts +0 -63
- package/assembly/__tests__/null.spec.ts +0 -12
- package/assembly/__tests__/raw.spec.ts +0 -23
- package/assembly/__tests__/resolving.spec.ts +0 -55
- package/assembly/__tests__/staticarray.spec.ts +0 -12
- package/assembly/__tests__/string.spec.ts +0 -30
- package/assembly/__tests__/struct.spec.ts +0 -163
- package/assembly/__tests__/test.spec.ts +0 -3
- package/assembly/__tests__/types.spec.ts +0 -27
- package/assembly/__tests__/types.ts +0 -98
- package/assembly/test.tmp.ts +0 -133
- package/bench/abc.bench.ts +0 -25
- package/bench/large.bench.ts +0 -127
- package/bench/lib/bench.d.ts +0 -27
- package/bench/lib/bench.js +0 -53
- package/bench/lib/chart.ts +0 -217
- package/bench/medium.bench.ts +0 -68
- package/bench/runners/assemblyscript.js +0 -34
- package/bench/small.bench.ts +0 -34
- package/bench/throughput.ts +0 -87
- package/bench/tsconfig.json +0 -13
- package/bench/vec3.bench.ts +0 -30
- package/bench.ts +0 -18
- package/ci/bench/lib/bench.ts +0 -42
- package/ci/bench/runners/assemblyscript.js +0 -29
- package/ci/run-bench.as.sh +0 -63
- package/publish.sh +0 -78
- package/run-bench.as.sh +0 -60
- package/run-bench.js.sh +0 -36
- package/run-tests.sh +0 -51
- package/scripts/build-chart01.ts +0 -38
- package/scripts/build-chart02.ts +0 -38
- package/scripts/build-chart03.ts +0 -139
- package/scripts/build-chart05.ts +0 -47
- package/scripts/generate-as-class.ts +0 -50
- package/scripts/lib/bench-utils.ts +0 -308
- package/transform/src/builder.ts +0 -1375
- package/transform/src/index.ts +0 -1486
- package/transform/src/linkers/alias.ts +0 -58
- package/transform/src/linkers/custom.ts +0 -32
- package/transform/src/linkers/imports.ts +0 -22
- package/transform/src/types.ts +0 -300
- package/transform/src/util.ts +0 -128
- package/transform/src/visitor.ts +0 -530
package/README.md
CHANGED
|
@@ -392,9 +392,9 @@ The following charts compare JSON-AS (both SWAR and SIMD variants) against JavaS
|
|
|
392
392
|
|
|
393
393
|
> Note: Benchmarks reflect the **latest version**. Older versions may show different performance.
|
|
394
394
|
|
|
395
|
-
<img src="https://raw.githubusercontent.com/JairusSW/json-as/refs/heads/docs/
|
|
395
|
+
<img src="https://raw.githubusercontent.com/JairusSW/json-as/refs/heads/docs/charts/chart01.svg" alt="Performance Chart 1">
|
|
396
396
|
|
|
397
|
-
<img src="https://raw.githubusercontent.com/JairusSW/json-as/refs/heads/docs/
|
|
397
|
+
<img src="https://raw.githubusercontent.com/JairusSW/json-as/refs/heads/docs/charts/chart02.svg" alt="Performance Chart 2">
|
|
398
398
|
|
|
399
399
|
> Note: I have focused on extensively optimizing serialization. I used to have deserialization be highly unsafe and extremely fast, but I've since doubled down on safety for deserialization which has negatively affected performance. I will be optimizing soon.
|
|
400
400
|
|
package/package.json
CHANGED
package/.github/FUNDING.yml
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
github: [JairusSW]
|
package/.github/dependabot.yml
DELETED
|
@@ -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
package/.prettierrc.json
DELETED
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,330 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
## 2025-12-23 - 1.2.0
|
|
4
|
-
|
|
5
|
-
- feat: Implement SWAR based algorithms, SIMD improvements, and better documentation.
|
|
6
|
-
|
|
7
|
-
## 2025-12-21 - 1.1.26
|
|
8
|
-
|
|
9
|
-
- chore: remove log
|
|
10
|
-
|
|
11
|
-
## 2025-12-21 - 1.1.25
|
|
12
|
-
|
|
13
|
-
- feat: Implement SWAR-based string serialization
|
|
14
|
-
|
|
15
|
-
## 2025-11-28 - 1.1.24
|
|
16
|
-
|
|
17
|
-
- 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)
|
|
18
|
-
|
|
19
|
-
## 2025-11-06 - 1.1.23
|
|
20
|
-
|
|
21
|
-
- fix: Map keys should follow proper typing and quote rules [#161](https://github.com/JairusSW/json-as/issues/161)
|
|
22
|
-
|
|
23
|
-
## 2025-09-01 - 1.1.22
|
|
24
|
-
|
|
25
|
-
- fix: Type aliases should work across files [#154](https://github.com/JairusSW/json-as/issues/154)
|
|
26
|
-
|
|
27
|
-
## 2025-08-14 - 1.1.21
|
|
28
|
-
|
|
29
|
-
- fix: JSON.parse on classes with enums [#155](https://github.com/JairusSW/json-as/issues/155)
|
|
30
|
-
- fix: Resolve memory OOB issue within `serializeFloat` function [#153](https://github.com/JairusSW/json-as/issues/153)
|
|
31
|
-
|
|
32
|
-
## 2025-07-14 - 1.1.20
|
|
33
|
-
|
|
34
|
-
- feat: enable SIMD string serialization
|
|
35
|
-
|
|
36
|
-
## 2025-06-30 - 1.1.19
|
|
37
|
-
|
|
38
|
-
- fix: wrong path used in `readFileSync` when importing from a library
|
|
39
|
-
|
|
40
|
-
## 2025-06-30 - 1.1.18
|
|
41
|
-
|
|
42
|
-
- fix: [#150](https://github.com/JairusSW/json-as/issues/150)
|
|
43
|
-
|
|
44
|
-
## 2025-06-17 - 1.1.17
|
|
45
|
-
|
|
46
|
-
- fix: add support for classes within namespaces [#147](https://github.com/JairusSW/json-as/pull/147)
|
|
47
|
-
|
|
48
|
-
## 2025-06-12 - 1.1.16
|
|
49
|
-
|
|
50
|
-
- tests: properly support nulls (in testing lib)
|
|
51
|
-
- fix: initialize generic properties correctly
|
|
52
|
-
- fix: make generated imports compatible with windows
|
|
53
|
-
- feat: add support for fields marked with `readonly`
|
|
54
|
-
|
|
55
|
-
## 2025-06-09 - 1.1.15
|
|
56
|
-
|
|
57
|
-
- feat: add `.as<T>()` method to `JSON.Value`
|
|
58
|
-
- chore: remove all references to `__SERIALIZE_CUSTOM`
|
|
59
|
-
- feat: add support for `StaticArray` serialization
|
|
60
|
-
- feat: support `JSON.Raw` in array types
|
|
61
|
-
- tests: add tests for `JSON.Raw[]`
|
|
62
|
-
|
|
63
|
-
## 2025-05-29 - 1.1.14
|
|
64
|
-
|
|
65
|
-
- fix: hotfix schema resolver
|
|
66
|
-
|
|
67
|
-
## 2025-05-29 - 1.1.13
|
|
68
|
-
|
|
69
|
-
- fix: small issues with schema linking
|
|
70
|
-
- tests: add tests for schema linking and discovery
|
|
71
|
-
|
|
72
|
-
## 2025-05-29 - 1.1.12
|
|
73
|
-
|
|
74
|
-
- fix: add helpful warning on unknown or unaccessible types in fields
|
|
75
|
-
- feat: support deserialization of class generics
|
|
76
|
-
- fix: add support for numerical generics
|
|
77
|
-
- tests: add proper testing for generics
|
|
78
|
-
- feat: support type aliases with a custom type resolver/linker
|
|
79
|
-
- chore: add other linkers to tsconfig and clean up
|
|
80
|
-
- feat: add type alias resolving
|
|
81
|
-
|
|
82
|
-
## 2025-05-28 - 1.1.11
|
|
83
|
-
|
|
84
|
-
- fix: class resolving should only search top level statements for class declarations
|
|
85
|
-
- fix: add helpful error if class is missing an @json decorator
|
|
86
|
-
- fix: properly calculate relative path when json-as is a library
|
|
87
|
-
- fix: add proper null check when resolving imported classes
|
|
88
|
-
|
|
89
|
-
## 2025-05-28 - 1.1.10
|
|
90
|
-
|
|
91
|
-
- feat: add more debug levels (1 = print transform code, 2 = print keys/values at runtime)
|
|
92
|
-
- feat: add write out feature (`JSON_WRITE=path-to-file.ts`) which writes out generated code
|
|
93
|
-
- fix: complete full parity between port and original version for correct deserialization of all types
|
|
94
|
-
- feat: add proper schema resolution and dependency resolution
|
|
95
|
-
- feat: add proper type resolution to schema fields
|
|
96
|
-
- fix: properly calculate the relative path between imports to modules
|
|
97
|
-
|
|
98
|
-
## 2025-05-27 - 1.1.9
|
|
99
|
-
|
|
100
|
-
- change: strict mode is disabled by default. Enable it with JSON_STRICT=true
|
|
101
|
-
- fix: should ignore properties of same length and type if no matching key exists
|
|
102
|
-
- fix: should ignore properties of different type if no matching key exists
|
|
103
|
-
- fix: should ignore complex properties if no matching key exists
|
|
104
|
-
|
|
105
|
-
## 2025-05-27 - 1.1.8
|
|
106
|
-
|
|
107
|
-
- feat: add support for calling `JSON.stringify/JSON.parse` methods inside of custom serializers, but not yet deserializers
|
|
108
|
-
|
|
109
|
-
## 2025-05-27 - 1.1.7
|
|
110
|
-
|
|
111
|
-
- fix: bad boolean logic to decide whether to add 2nd break statement
|
|
112
|
-
|
|
113
|
-
## 2025-05-23 - 1.1.6
|
|
114
|
-
|
|
115
|
-
- fix: null and boolean fields would miscalculate offsets when deserializing
|
|
116
|
-
|
|
117
|
-
## 2025-05-23 - 1.1.5
|
|
118
|
-
|
|
119
|
-
- fix: index.js didn't point to correct file, thus creating a compiler crash
|
|
120
|
-
|
|
121
|
-
## 2025-05-23 - 1.1.4
|
|
122
|
-
|
|
123
|
-
- revert: grouping properties in favor of memory.compare
|
|
124
|
-
|
|
125
|
-
## 2025-05-23 - 1.1.3
|
|
126
|
-
|
|
127
|
-
- feat: group properties of structs before code generation
|
|
128
|
-
- fix: break out of switch case after completion
|
|
129
|
-
- ci: make compatible with act for local testing
|
|
130
|
-
|
|
131
|
-
## 2025-05-22 - 1.1.2
|
|
132
|
-
|
|
133
|
-
- fix: correct small typos in string value deserialization port
|
|
134
|
-
|
|
135
|
-
## 2025-05-22 - 1.1.1
|
|
136
|
-
|
|
137
|
-
- fix: remove random logs
|
|
138
|
-
|
|
139
|
-
## 2025-05-22 - 1.1.0
|
|
140
|
-
|
|
141
|
-
- fix: change _DESERIALIZE<T> to _JSON_T to avoid populating local scope
|
|
142
|
-
|
|
143
|
-
## 2025-05-22 - 1.0.9
|
|
144
|
-
|
|
145
|
-
- fix: [#132](https://github.com/JairusSW/json-as/issues/132)
|
|
146
|
-
- feat: allow base classes to use their child classes if the signatures match
|
|
147
|
-
- perf: rewrite struct deserialization to be significantly faster
|
|
148
|
-
- fix: [#131](https://github.com/JairusSW/json-as/issues/131) Generic classes with custom deserializer crashing
|
|
149
|
-
- fix: [#66](https://github.com/JairusSW/json-as/issues/66) Throw error when additional keys are in JSON
|
|
150
|
-
|
|
151
|
-
## 2025-05-21 - 1.0.8
|
|
152
|
-
|
|
153
|
-
- fix: inline warnings on layer-2 serialize and deserialize functions
|
|
154
|
-
- feat: fully support `JSON.Obj` and `JSON.Box` everywhere
|
|
155
|
-
- fix: temp disable SIMD
|
|
156
|
-
- feat: write fair benchmarks with `v8` using `jsvu`
|
|
157
|
-
|
|
158
|
-
## 2025-05-14 - 1.0.7
|
|
159
|
-
|
|
160
|
-
- 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)
|
|
161
|
-
|
|
162
|
-
## 2025-05-12 - 1.0.6
|
|
163
|
-
|
|
164
|
-
- fix: support zero-param serialization and make sure types are consistent
|
|
165
|
-
- fix: [#124](https://github.com/JairusSW/json-as/issues/124)
|
|
166
|
-
|
|
167
|
-
## 2025-05-11 - 1.0.5
|
|
168
|
-
|
|
169
|
-
- feat: add sanity checks for badly formatted strings
|
|
170
|
-
- fix: [#120](https://github.com/JairusSW/json-as/issues/120) handle empty `JSON.Obj` serialization
|
|
171
|
-
- feat: add SIMD optimization if SIMD is enabled by user
|
|
172
|
-
- fix: handle structs with nullable array as property [#123](https://github.com/JairusSW/json-as/pull/123)
|
|
173
|
-
- fix: struct serialization from writing to incorrect parts of memory when parsing nested structs [#125](https://github.com/JairusSW/json-as/pull/125)
|
|
174
|
-
- chore: add two new contributors
|
|
175
|
-
|
|
176
|
-
## 2025-04-07 - 1.0.4
|
|
177
|
-
|
|
178
|
-
- fix: paths must be resolved as POSIX in order to be valid TypeScript imports [#116](https://github.com/JairusSW/json-as/issues/116)
|
|
179
|
-
|
|
180
|
-
## 2025-03-24 - 1.0.3
|
|
181
|
-
|
|
182
|
-
- fix: make transform windows-compatible [#119](https://github.com/JairusSW/json-as/issues/119?reload=1)
|
|
183
|
-
|
|
184
|
-
## 2025-03-19 - 1.0.2
|
|
185
|
-
|
|
186
|
-
- fix: include check for nullable types for properties when deserialization is called internally [#118](https://github.com/JairusSW/json-as/pull/118)
|
|
187
|
-
|
|
188
|
-
## 2025-03-10 - 1.0.1
|
|
189
|
-
|
|
190
|
-
- docs: add comprehensive performance metrics
|
|
191
|
-
|
|
192
|
-
## 2025-03-09 - 1.0.0
|
|
193
|
-
|
|
194
|
-
- fix: relative paths pointing through node_modules would create a second Source
|
|
195
|
-
- feat: move behavior of `--lib` into transform itself
|
|
196
|
-
- 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)
|
|
197
|
-
|
|
198
|
-
## 2025-03-04 - 1.0.0-beta.17
|
|
199
|
-
|
|
200
|
-
- fix: forgot to build transform
|
|
201
|
-
|
|
202
|
-
## 2025-03-04 - 1.0.0-beta.16
|
|
203
|
-
|
|
204
|
-
- fix: isPrimitive should only trigger on actual primitives
|
|
205
|
-
|
|
206
|
-
## 2025-03-04 - 1.0.0-beta.15
|
|
207
|
-
|
|
208
|
-
- fix: deserialize custom should take in string
|
|
209
|
-
|
|
210
|
-
## 2025-03-04 - 1.0.0-beta.14
|
|
211
|
-
|
|
212
|
-
- fix: reference to nonexistent variable during custom deserialization layer 2
|
|
213
|
-
|
|
214
|
-
## 2025-03-04 - 1.0.0-beta.13
|
|
215
|
-
|
|
216
|
-
- fix: forgot to actually build the transform
|
|
217
|
-
|
|
218
|
-
## 2025-03-04 - 1.0.0-beta.12
|
|
219
|
-
|
|
220
|
-
- fix: build transform
|
|
221
|
-
|
|
222
|
-
## 2025-03-04 - 1.0.0-beta.11
|
|
223
|
-
|
|
224
|
-
- fix: wrongly assumed pointer types within arbitrary deserialization
|
|
225
|
-
- fix: wrong pointer type being passed during map deserialization
|
|
226
|
-
|
|
227
|
-
## 2025-03-04 - 1.0.0-beta.10
|
|
228
|
-
|
|
229
|
-
- fix: transform not generating the right load operations for keys
|
|
230
|
-
- fix: whitespace not working in objects or struct deserialization
|
|
231
|
-
- fix: JSON.Raw not working when deserializing as Map<string, JSON.Raw>
|
|
232
|
-
|
|
233
|
-
## 2025-03-03 - 1.0.0-beta.9
|
|
234
|
-
|
|
235
|
-
- rename: change libs folder to lib
|
|
236
|
-
|
|
237
|
-
## 2025-03-03 - 1.0.0-beta.8
|
|
238
|
-
|
|
239
|
-
- docs: add instructions for using `--lib` in README
|
|
240
|
-
|
|
241
|
-
## 2025-03-03 - 1.0.0-beta.7
|
|
242
|
-
|
|
243
|
-
- fix: add as-bs to `--lib` section
|
|
244
|
-
- chore: clean up transform
|
|
245
|
-
- refactor: transform should import `~lib/as-bs.ts` instead of relative path
|
|
246
|
-
|
|
247
|
-
## 2025-03-01 - 1.0.0-beta.6
|
|
248
|
-
|
|
249
|
-
- fix: import from base directory index.ts
|
|
250
|
-
|
|
251
|
-
## 2025-03-01 - 1.0.0-beta.5
|
|
252
|
-
|
|
253
|
-
- fix: revert pull request [#112](https://github.com/JairusSW/json-as/pull/112)
|
|
254
|
-
|
|
255
|
-
## 2025-02-25 - 1.0.0-beta.4
|
|
256
|
-
|
|
257
|
-
- fix: warn on presence of invalid types contained in a schema [#112](https://github.com/JairusSW/json-as/pull/112)
|
|
258
|
-
|
|
259
|
-
## 2025-02-25 - 1.0.0-beta.3
|
|
260
|
-
|
|
261
|
-
- feat: change `JSON.Raw` to actual class to facilitate proper support without transformations
|
|
262
|
-
- fix: remove old `JSON.Raw` logic from transform code
|
|
263
|
-
|
|
264
|
-
## 2025-02-25 - 1.0.0-beta.2
|
|
265
|
-
|
|
266
|
-
- feat: add support for custom serializers and deserializers [#110](https://github.com/JairusSW/json-as/pull/110)
|
|
267
|
-
|
|
268
|
-
## 2025-02-22 - 1.0.0-beta.1
|
|
269
|
-
|
|
270
|
-
- perf: add benchmarks for both AssemblyScript and JavaScript
|
|
271
|
-
- docs: publish preliminary benchmark results
|
|
272
|
-
- tests: ensure nested serialization works and add to tests
|
|
273
|
-
- feat: finish arbitrary type implementation
|
|
274
|
-
- feat: introduce `JSON.Obj` to handle objects effectively
|
|
275
|
-
- feat: reimplement arbitrary array deserialization
|
|
276
|
-
- fix: remove brace check on array deserialization
|
|
277
|
-
- feat: introduce native support for `JSON.Obj` transformations
|
|
278
|
-
- feat: implement arbitrary object serialization
|
|
279
|
-
- fix: deserialization of booleans panics on `false`
|
|
280
|
-
- fix: `bs.resize` should be type-safe
|
|
281
|
-
- impl: add `JSON.Obj` type as prototype to handle arbitrary object structures
|
|
282
|
-
- chore: rename static objects (schemas) to structs and name arbitrary objects as `obj`
|
|
283
|
-
- tests: add proper tests for arbitrary types
|
|
284
|
-
- fix: empty method generation using outdated function signature
|
|
285
|
-
- docs: update readme to be more concise
|
|
286
|
-
|
|
287
|
-
## 2025-02-13 - 1.0.0-alpha.4
|
|
288
|
-
|
|
289
|
-
- feat: reintroduce support for `Box<T>`-wrapped primitive types
|
|
290
|
-
- tests: add extensive tests to all supported types
|
|
291
|
-
- fix: 6-byte keys being recognized on deserialize
|
|
292
|
-
- perf: take advantage of aligned memory to use a single 64-bit load on 6-byte keys
|
|
293
|
-
- fix: `bs.proposeSize()` should increment `stackSize` by `size` instead of setting it
|
|
294
|
-
- fix: allow runtime to manage `bs.buffer`
|
|
295
|
-
- fix: memory leaks in `bs` module
|
|
296
|
-
- fix: add (possibly temporary) `JSON.Memory.shrink()` to shrink memory in `bs`
|
|
297
|
-
- perf: prefer growing memory by `nextPowerOf2(size + 64)` for less reallocations
|
|
298
|
-
- tests: add boolean tests to `Box<T>`
|
|
299
|
-
- fix: serialization of non-growable data types should grow `bs.stackSize`
|
|
300
|
-
|
|
301
|
-
## 2025-01-31 - 1.0.0-alpha.3
|
|
302
|
-
|
|
303
|
-
- fix: write to proper offset when deserializing string with \u0000-type escapes
|
|
304
|
-
- fix: simplify and fix memory offset issues with bs module
|
|
305
|
-
- fix: properly predict minimum size of to-be-serialized schemas
|
|
306
|
-
- fix: replace as-test with temporary framework to mitigate json-as versioning issues
|
|
307
|
-
- fix: fix multiple memory leaks during serialization
|
|
308
|
-
- feat: align memory allocations for better performance
|
|
309
|
-
- feat: achieve a space complexity of O(n) for serialization operations, unless dealing with \u0000-type escapes
|
|
310
|
-
|
|
311
|
-
## 2025-01-20 - 1.0.0-alpha.2
|
|
312
|
-
|
|
313
|
-
- fix: disable SIMD in generated transform code by default
|
|
314
|
-
- fix: re-add as-bs dependency so that it will not break in non-local environments
|
|
315
|
-
- fix: remove AS201 'conversion from type usize to i32' warning
|
|
316
|
-
- fix: add as-bs to peer dependencies so only one version is installed
|
|
317
|
-
- fix: point as-bs imports to submodule
|
|
318
|
-
- fix: remove submodule in favor of static module
|
|
319
|
-
- fix: bs.ensureSize would not grow and thus cause memory faults
|
|
320
|
-
- fix: bs.ensureSize triggering unintentionally
|
|
321
|
-
|
|
322
|
-
## 2025-01-20 - 1.0.0-alpha.1
|
|
323
|
-
|
|
324
|
-
- feat: finish implementation of arbitrary data serialization and deserialization using JSON.Value
|
|
325
|
-
- feat: reinstate usage of `JSON.Box<T>()` to support nullable primitive types
|
|
326
|
-
- feat: eliminate the need to import the `JSON` namespace when defining a schema
|
|
327
|
-
- feat: reduce memory usage so that it is viable for low-memory environments
|
|
328
|
-
- feat: write to a central buffer and reduce memory overhead
|
|
329
|
-
- feat: rewrite the transform to properly resolve schemas and link them together
|
|
330
|
-
- 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,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")
|