Skip to content

Commit 3e7debb

Browse files
committed
release: v1.3.1
1 parent 2409f19 commit 3e7debb

9 files changed

Lines changed: 52 additions & 36 deletions

File tree

.npmignore

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1+
.as-test/
12
assembly/__tests__/
23
assembly/__benches__/
3-
.trunk/
4-
.github/
5-
.vscode/
6-
.git/
7-
bench/
4+
assembly/test.ts
5+
assembly/*.tmp.ts
86
build/
9-
node_modules/
107
scripts/
11-
.gitignore
12-
.prettierignore
13-
.prettierrc.json
8+
bench/
9+
images/
10+
tools/
1411
*.sh
15-
bun.lock
16-
*.tmp.ts
17-
CHANGELOG.md
12+
TODO
13+
ARCHITECTURE.md
14+
CONTRIBUTING.md
1815
SECURITY.md
16+
as-test.config.json
1917
asconfig.json
18+
lib/tsconfig.json
2019
transform/src/
21-
images/
20+
transform/tsconfig.json
21+
transform/lib/**/*.map
22+
transform/lib/**/*.d.ts.map

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Changelog
22

3-
## Unreleased
3+
## 2026-03-25 - 1.3.1
44

55
- feat: allow `JSON.Value` to store and re-serialize built-in typed arrays and `ArrayBuffer`
66
- feat: support `JSON.stringify<ArrayBuffer>(...)` directly without a dedicated helper
@@ -14,12 +14,14 @@
1414
- fix: make generated custom serializer wrappers use the provided `ptr` so indirect-call sites like `JSON.Value` serialize correctly
1515
- fix: resolve stdlib and `--lib` base classes during transform inheritance so `@json` subclasses of built-ins like `Uint8Array` include inherited fields instead of collapsing to empty objects
1616
- fix: stop preloading transform imports through `parser.parseFile(...)`, so repeated `asc()` calls in the same process no longer poison parser state or trip `lookupForeignFile` assertions
17+
- fix: rewrite nested `JSON.parse(...)` calls inside custom serializers and deserializers to `JSON.internal.parse(...)`, matching the existing internal stringify rewrite and documented behavior
1718
- docs: clarify that custom serializers and deserializers must always produce and consume valid JSON
1819
- docs: document how subclassing built-in container types behaves, including when `@json` custom overrides take effect
1920
- tests: expand custom serializer/deserializer coverage for nullable fields, multiple custom fields, escaped content, whitespace, and repeated round-trips
2021
- tests: add override coverage for plain and custom subclasses of `Array`, `Map`, `Set`, and typed arrays
2122
- tests: add `JSON.Value` regressions for undecorated and decorated typed-array subclasses
2223
- tests: add regression coverage for generated `@json` subclasses inheriting stdlib typed-array fields
24+
- chore: restrict published package contents to the runtime, declarations, built transform output, and top-level metadata files
2325
- perf: raise the serialization buffer minimum size to 1024 bytes and add adaptive `bs.shrink()`
2426
- perf: add a packed SWAR `u16_to_hex4_swar` helper for `\uXXXX` emission and use it across simple, SWAR, and SIMD string serializers
2527
- tests: add dedicated SWAR hex helper coverage, including exhaustive full-range round-trip validation

assembly/xid.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.

package.json

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "json-as",
3-
"version": "1.3.0",
3+
"version": "1.3.1",
44
"author": "Jairus Tanaka",
55
"repository": {
66
"type": "git",
@@ -41,6 +41,24 @@
4141
],
4242
"description": "The only JSON library you'll need for AssemblyScript with SIMD and SWAR",
4343
"homepage": "https://github.com/JairusSW/json-as#readme",
44+
"files": [
45+
"assembly/custom/",
46+
"assembly/deserialize/",
47+
"assembly/globals/",
48+
"assembly/serialize/",
49+
"assembly/util/",
50+
"assembly/index.ts",
51+
"assembly/index.d.ts",
52+
"assembly/types.ts",
53+
"assembly/tsconfig.json",
54+
"lib/as-bs.ts",
55+
"transform/lib/",
56+
"transform/package.json",
57+
"index.ts",
58+
"README.md",
59+
"CHANGELOG.md",
60+
"LICENSE"
61+
],
4462
"keywords": [
4563
"assemblyscript",
4664
"json",

transform/lib/linkers/custom.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

transform/lib/linkers/custom.js

Lines changed: 7 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

transform/lib/linkers/custom.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

transform/src/builder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// tslint:disable: as-internal-case
33

44
import { ArrayLiteralExpression, ArrowKind, AssertionExpression, AssertionKind, BinaryExpression, BlockStatement, BreakStatement, CallExpression, ClassDeclaration, ClassExpression, CommaExpression, CommonFlags, ContinueStatement, DeclarationStatement, DecoratorNode, DoStatement, ElementAccessExpression, EmptyStatement, EnumDeclaration, EnumValueDeclaration, ExportDefaultStatement, ExportImportStatement, ExportMember, ExportStatement, Expression, ExpressionStatement, FalseExpression, FieldDeclaration, FloatLiteralExpression, ForOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, FunctionTypeNode, IdentifierExpression, IfStatement, ImportDeclaration, ImportStatement, IndexSignatureNode, InstanceOfExpression, IntegerLiteralExpression, InterfaceDeclaration, isTypeOmitted, LiteralExpression, LiteralKind, MethodDeclaration, NamedTypeNode, NamespaceDeclaration, NewExpression, Node, NodeKind, NullExpression, ObjectLiteralExpression, operatorTokenToString, ParameterKind, ParameterNode, ParenthesizedExpression, PropertyAccessExpression, RegexpLiteralExpression, ReturnStatement, Source, StringLiteralExpression, SwitchCase, SwitchStatement, TemplateLiteralExpression, TernaryExpression, ThrowStatement, TrueExpression, TryStatement, TypeDeclaration, TypeName, TypeNode, TypeParameterNode, UnaryExpression, UnaryPostfixExpression, UnaryPrefixExpression, util, VariableDeclaration, VariableStatement, WhileStatement } from "assemblyscript/dist/assemblyscript.js";
5-
import { SuperExpression, ThisExpression } from "types:assemblyscript/src/ast";
5+
import { ThisExpression } from "types:assemblyscript/src/ast";
66
import { Visitor } from "./visitor.js";
77

88
function assert<T>(isTruish: T, message: string = "assertion error"): T {

transform/src/linkers/custom.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ export class CustomTransform extends Visitor {
66
private modify: boolean = false;
77
visitCallExpression(node: CallExpression) {
88
super.visit(node.args, node);
9-
if (node.expression.kind != NodeKind.PropertyAccess || (node.expression as PropertyAccessExpression).property.text != "stringify") return;
10-
if ((node.expression as PropertyAccessExpression).expression.kind != NodeKind.Identifier || ((node.expression as PropertyAccessExpression).expression as IdentifierExpression).text != "JSON") return;
9+
if (node.expression.kind != NodeKind.PropertyAccess) return;
10+
const expression = node.expression as PropertyAccessExpression;
11+
const property = expression.property.text;
12+
if (property != "stringify" && property != "parse") return;
13+
if (expression.expression.kind != NodeKind.Identifier || (expression.expression as IdentifierExpression).text != "JSON") return;
1114

1215
if (this.modify) {
13-
(node.expression as PropertyAccessExpression).expression = Node.createPropertyAccessExpression(Node.createIdentifierExpression("JSON", node.expression.range), Node.createIdentifierExpression("internal", node.expression.range), node.expression.range);
16+
expression.expression = Node.createPropertyAccessExpression(Node.createIdentifierExpression("JSON", node.expression.range), Node.createIdentifierExpression("internal", node.expression.range), node.expression.range);
1417
}
1518
this.modify = true;
1619

0 commit comments

Comments
 (0)