json-as 0.9.25 → 0.9.27
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 +1 -1
- package/assembly/index.ts +4 -9
- package/package.json +2 -4
- package/transform/package.json +1 -1
- package/CHANGELOG +0 -43
package/README.md
CHANGED
package/assembly/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { serializeString } from "./serialize/string";
|
|
|
3
3
|
import { serializeBool } from "./serialize/bool";
|
|
4
4
|
import { serializeInteger } from "./serialize/integer";
|
|
5
5
|
import { serializeFloat } from "./serialize/float";
|
|
6
|
-
import { serializeObject
|
|
6
|
+
import { serializeObject } from "./serialize/object";
|
|
7
7
|
import { serializeDate } from "./serialize/date";
|
|
8
8
|
import { serializeArray } from "./serialize/array";
|
|
9
9
|
import { serializeMap } from "./serialize/map";
|
|
@@ -13,19 +13,12 @@ import { deserializeFloat } from "./deserialize/float";
|
|
|
13
13
|
import { deserializeObject, deserializeObject_Safe } from "./deserialize/object";
|
|
14
14
|
import { deserializeMap, deserializeMap_Safe } from "./deserialize/map";
|
|
15
15
|
import { deserializeDate } from "./deserialize/date";
|
|
16
|
-
import {
|
|
16
|
+
import { NULL_WORD } from "./custom/chars";
|
|
17
17
|
import { deserializeInteger, deserializeInteger_Safe } from "./deserialize/integer";
|
|
18
18
|
import { deserializeString, deserializeString_Safe } from "./deserialize/string";
|
|
19
19
|
import { Sink } from "./custom/sink";
|
|
20
20
|
import { getArrayDepth } from "./custom/util";
|
|
21
21
|
|
|
22
|
-
// Config
|
|
23
|
-
class SerializeOptions {
|
|
24
|
-
public pretty: bool = false;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const DEFAULT_SERIALIZE_OPTIONS = new SerializeOptions();
|
|
28
|
-
|
|
29
22
|
/**
|
|
30
23
|
* Offset of the 'storage' property in the JSON.Value class.
|
|
31
24
|
*/
|
|
@@ -177,6 +170,8 @@ export namespace JSON {
|
|
|
177
170
|
@inline export function stringify<T>(data: T/*, options: SerializeOptions = DEFAULT_SERIALIZE_OPTIONS*/): string {
|
|
178
171
|
if (isBoolean<T>()) {
|
|
179
172
|
return serializeBool(data as bool);
|
|
173
|
+
} else if (isInteger<T>() && nameof<T>() == "usize" && data == 0) {
|
|
174
|
+
return NULL_WORD;
|
|
180
175
|
} else if (isInteger<T>()) {
|
|
181
176
|
// @ts-ignore
|
|
182
177
|
return serializeInteger<T>(data);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "json-as",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.27",
|
|
4
4
|
"description": "The only JSON library you'll need for AssemblyScript. SIMD enabled",
|
|
5
5
|
"types": "assembly/index.ts",
|
|
6
6
|
"author": "Jairus Tanaka",
|
|
@@ -44,9 +44,7 @@
|
|
|
44
44
|
"visitor-as": "^0.11.4"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"
|
|
48
|
-
"as-virtual": "^0.2.0",
|
|
49
|
-
"chalk": "^5.3.0"
|
|
47
|
+
"as-virtual": "^0.2.0"
|
|
50
48
|
},
|
|
51
49
|
"overrides": {
|
|
52
50
|
"assemblyscript": "$assemblyscript"
|
package/transform/package.json
CHANGED
package/CHANGELOG
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
v0.8.2 - Properties starting with `static` or `private` would be ignored
|
|
2
|
-
v0.8.3 - Dirty fix to issue #68. Add __JSON_Stringify callable to global scope.
|
|
3
|
-
v0.8.4 - Fix #71. Classes with the extending class overriding a property cause the property to be serialized twice.
|
|
4
|
-
v0.8.5 - Fix #73. Support for nullable primatives with Box<T> from as-container
|
|
5
|
-
v0.8.6 - Fix. Forgot to stash before publishing. Stash and push what should have been v0.8.5
|
|
6
|
-
|
|
7
|
-
v0.9.0 - BREAKING CHANGE - API changed from JSON.parse(data, defaultValues) to JSON.parse(data). Default Values defaults to true. Large update. Refactor all the code, nullable primitives, rewrite the transform, allow extensibility with @omit keywords, and fix a plethora of bugs
|
|
8
|
-
v0.9.1 - Fix #71
|
|
9
|
-
v0.9.2 - Fix #75 + Build sizes significantly reduced
|
|
10
|
-
v0.9.3 - Fix #76
|
|
11
|
-
v0.9.4 - Fix #77
|
|
12
|
-
v0.9.5 - Fix #46
|
|
13
|
-
v0.9.6 - Fix bugs
|
|
14
|
-
v0.9.7 - Update testing framework and readme logo
|
|
15
|
-
v0.9.8 - Update dependencies
|
|
16
|
-
v0.9.8a - Fix #80 - Empty Maps were not serialized to {}, instead, threw memory out of bounds
|
|
17
|
-
v0.9.8b - Fix #81 - Revert transform
|
|
18
|
-
v0.9.9 - Fix #82 - Initialize maps
|
|
19
|
-
v0.9.9a - Remove extraneous logs from transform
|
|
20
|
-
v0.9.10 - Fix transform type checks. switch to nodekind checks
|
|
21
|
-
v0.9.11 - Remove MpZ--implement custom serializers and deserializers in the works
|
|
22
|
-
v0.9.12 - Add compat with aspect
|
|
23
|
-
v0.9.13 - Fix empty strings not indexing correctly
|
|
24
|
-
v0.9.14 - Ignore properties of type Function
|
|
25
|
-
v0.9.15 - Support JSON.Raw blocks
|
|
26
|
-
v0.9.16 - JSON.Raw should be completely untouched
|
|
27
|
-
v0.9.17 - A schema's parent's fields should be included properly
|
|
28
|
-
v0.9.18 - Should be able to use @alias and @omit*** or JSON.Raw
|
|
29
|
-
v0.9.19 - Fix arguments in @omitif declarations not working properly
|
|
30
|
-
v0.9.20 - Strings were being received with quotes attached via the toString functionality. Removed that.
|
|
31
|
-
v0.9.22 - Fix #89 and #93. Several bug fixes some severe such as ",null" being prepended when using @omit. Properly warn when a schema has fields that are not compatible with json
|
|
32
|
-
v0.9.23 - Comment out SIMD-related code for now
|
|
33
|
-
v0.9.24 - Remove transform changes from previous release
|
|
34
|
-
v0.9.25 - Implement JSON.parseSafe
|
|
35
|
-
[UNRELEASED] v1.0.0
|
|
36
|
-
- Allow nullable primitives
|
|
37
|
-
- Port over JSON.Value
|
|
38
|
-
- Performance improvements
|
|
39
|
-
- Add SIMD support
|
|
40
|
-
- Introduce options
|
|
41
|
-
- Custom serializers
|
|
42
|
-
- Support arbitrary-length integers (@hypercubed/as-mpz)
|
|
43
|
-
- Remove as-container (Box<T>)
|