json-as 0.5.9 → 0.5.10
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 +9 -9
- package/assembly/__benches__/as-json.ts +5 -1
- package/assembly/__tests__/as-json.spec.ts +4 -4
- package/assembly/src/chars.ts +3 -1
- package/assembly/src/json.ts +81 -45
- package/assembly/src/util.ts +17 -1
- package/assembly/test.ts +2 -5
- package/package.json +7 -7
- package/transform/package.json +4 -2
- package/tsconfig.json +103 -0
package/README.md
CHANGED
|
@@ -40,20 +40,20 @@ import { JSON } from "json-as/assembly";
|
|
|
40
40
|
// @ts-ignore
|
|
41
41
|
@json
|
|
42
42
|
class Vec3 {
|
|
43
|
-
x
|
|
44
|
-
y
|
|
45
|
-
z
|
|
43
|
+
x!: f32;
|
|
44
|
+
y!: f32;
|
|
45
|
+
z!: f32;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
// @ts-ignore
|
|
49
49
|
@json
|
|
50
50
|
class Player {
|
|
51
|
-
firstName
|
|
52
|
-
lastName
|
|
53
|
-
lastActive
|
|
54
|
-
age
|
|
55
|
-
pos
|
|
56
|
-
isVerified
|
|
51
|
+
firstName!: string;
|
|
52
|
+
lastName!: string;
|
|
53
|
+
lastActive!: i32[];
|
|
54
|
+
age!: i32;
|
|
55
|
+
pos!: Vec3 | null;
|
|
56
|
+
isVerified!: boolean;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
const player: Player = {
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
bench("1+1", () => {
|
|
2
|
+
blackbox("1+1".split("+w"))
|
|
3
|
+
})
|
|
4
|
+
/*import { JSON } from "..";
|
|
2
5
|
|
|
3
6
|
@json
|
|
4
7
|
class Vec2 {
|
|
@@ -73,3 +76,4 @@ bench("Stringify Float", () => {
|
|
|
73
76
|
bench("Parse Float", () => {
|
|
74
77
|
blackbox(JSON.parse<f32>(blackbox("3.14")));
|
|
75
78
|
});
|
|
79
|
+
*/
|
|
@@ -31,7 +31,7 @@ type Null = Nullable | null;
|
|
|
31
31
|
describe("Ser/de Nulls", () => {
|
|
32
32
|
canSerde<Null>(null);
|
|
33
33
|
});
|
|
34
|
-
|
|
34
|
+
/*
|
|
35
35
|
describe("Ser/de Numbers", () => {
|
|
36
36
|
it("should ser/de integers", () => {
|
|
37
37
|
canSerde<i32>(0);
|
|
@@ -40,7 +40,7 @@ describe("Ser/de Numbers", () => {
|
|
|
40
40
|
canSerde<u64>(101);
|
|
41
41
|
canSerde<i32>(-100);
|
|
42
42
|
canSerde<i64>(-101);
|
|
43
|
-
|
|
43
|
+
|
|
44
44
|
canSerde<u128>(u128.from("0"))
|
|
45
45
|
canSerde<u128>(u128.from("100"))
|
|
46
46
|
canSerde<u128>(u128.from("101"))
|
|
@@ -65,7 +65,7 @@ describe("Ser/de Numbers", () => {
|
|
|
65
65
|
canSerde<i128Safe>(i128Safe.from("100"))
|
|
66
66
|
canSerde<i128Safe>(i128Safe.from("101"))
|
|
67
67
|
canSerde<i128Safe>(i128Safe.from("-100"))
|
|
68
|
-
canSerde<i128Safe>(i128Safe.from("-101"))
|
|
68
|
+
canSerde<i128Safe>(i128Safe.from("-101"))
|
|
69
69
|
|
|
70
70
|
//canSerde<i256Safe>(new i256Safe(10, 11, 500, 501))
|
|
71
71
|
});
|
|
@@ -199,4 +199,4 @@ describe("Ser/de Objects", () => {
|
|
|
199
199
|
isVerified: true,
|
|
200
200
|
});
|
|
201
201
|
});
|
|
202
|
-
})
|
|
202
|
+
});*/
|
package/assembly/src/chars.ts
CHANGED
|
@@ -24,4 +24,6 @@ export const nullWord = "null";
|
|
|
24
24
|
export const leftBracketWord = "[";
|
|
25
25
|
export const emptyArrayWord = "[]";
|
|
26
26
|
export const commaWord = ",";
|
|
27
|
-
export const rightBracketWord = "]";
|
|
27
|
+
export const rightBracketWord = "]";
|
|
28
|
+
// Escape Codes
|
|
29
|
+
export const newLineCode = "\n".charCodeAt(0);
|
package/assembly/src/json.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { u128, u128Safe, u256, u256Safe, i128, i128Safe
|
|
1
|
+
import { u128, u128Safe, u256, u256Safe, i128, i128Safe } from "as-bignum/assembly";
|
|
2
2
|
import { StringSink } from "as-string-sink/assembly";
|
|
3
|
+
import { itoa32, itoa64, dtoa, dtoa_buffered } from "util/number";
|
|
3
4
|
import { isSpace } from "util/string";
|
|
4
5
|
import {
|
|
5
6
|
backSlashCode,
|
|
@@ -22,7 +23,7 @@ import {
|
|
|
22
23
|
uCode,
|
|
23
24
|
emptyArrayWord
|
|
24
25
|
} from "./chars";
|
|
25
|
-
import { isBigNum, unsafeCharCodeAt } from "./util";
|
|
26
|
+
import { escapeChar, isBigNum, unsafeCharCodeAt } from "./util";
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
29
|
* JSON Encoder/Decoder for AssemblyScript
|
|
@@ -39,7 +40,52 @@ export namespace JSON {
|
|
|
39
40
|
export function stringify<T>(data: T): string {
|
|
40
41
|
// String
|
|
41
42
|
if (isString<T>()) {
|
|
42
|
-
|
|
43
|
+
let result = new StringSink("\"");
|
|
44
|
+
// @ts-ignore
|
|
45
|
+
for (let i = 0; i < data.length; i++) {
|
|
46
|
+
// @ts-ignore
|
|
47
|
+
switch (unsafeCharCodeAt(data, i)) {
|
|
48
|
+
case 0x22: {
|
|
49
|
+
result.write("\\\"");
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
case 0x5C: {
|
|
53
|
+
result.write("\\\\");
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
case 0x08: {
|
|
57
|
+
result.write("\\b");
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
case 0x0A: {
|
|
61
|
+
result.write("\\n");
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
case 0x0D: {
|
|
65
|
+
result.write("\\r");
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
case 0x09: {
|
|
69
|
+
result.write("\\t");
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
case 0x0C: {
|
|
73
|
+
result.write("\\f");
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
case 0x0B: {
|
|
77
|
+
result.write("\\u000b");
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
default: {
|
|
81
|
+
// @ts-ignore
|
|
82
|
+
result.write(data.charAt(i));
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
result.write("\"");
|
|
88
|
+
return result.toString();
|
|
43
89
|
}
|
|
44
90
|
// Boolean
|
|
45
91
|
else if (isBoolean<T>()) {
|
|
@@ -81,8 +127,6 @@ export namespace JSON {
|
|
|
81
127
|
} else if ((isManaged<T>() || isReference<T>()) && isBigNum<T>()) {
|
|
82
128
|
// @ts-ignore
|
|
83
129
|
return data.toString();
|
|
84
|
-
} else if (data instanceof Date) {
|
|
85
|
-
return data.toISOString();
|
|
86
130
|
} else {
|
|
87
131
|
throw new Error(`Could not serialize data of type ${nameof<T>()}. Invalid data provided.`);
|
|
88
132
|
}
|
|
@@ -95,8 +139,9 @@ export namespace JSON {
|
|
|
95
139
|
* @param data string
|
|
96
140
|
* @returns T
|
|
97
141
|
*/
|
|
142
|
+
// @ts-ignore
|
|
98
143
|
export function parse<T>(data: string): T {
|
|
99
|
-
let type
|
|
144
|
+
let type: T;
|
|
100
145
|
if (isString<T>()) {
|
|
101
146
|
// @ts-ignore
|
|
102
147
|
return parseString(data);
|
|
@@ -118,16 +163,14 @@ export namespace JSON {
|
|
|
118
163
|
} else if ((isManaged<T>() || isReference<T>()) && isBigNum<T>()) {
|
|
119
164
|
// @ts-ignore
|
|
120
165
|
return parseBigNum<T>(data);
|
|
121
|
-
} else if (type instanceof Date) {
|
|
122
|
-
// @ts-ignore
|
|
123
|
-
return Date.fromString(data);
|
|
124
166
|
} else {
|
|
125
167
|
// @ts-ignore
|
|
126
168
|
throw new Error(`Could not deserialize data ${data} to type ${nameof<T>()}. Invalide data provided.`);
|
|
127
169
|
}
|
|
128
170
|
}
|
|
171
|
+
// @ts-ignore
|
|
129
172
|
function parseObjectValue<T>(data: string): T {
|
|
130
|
-
let type
|
|
173
|
+
let type: T;
|
|
131
174
|
if (isString<T>()) {
|
|
132
175
|
// @ts-ignore
|
|
133
176
|
return data.replaceAll('\\"', '"');
|
|
@@ -145,9 +188,7 @@ export namespace JSON {
|
|
|
145
188
|
return null;
|
|
146
189
|
// @ts-ignore
|
|
147
190
|
} else if (isDefined(type.__JSON_Set_Key)) {
|
|
148
|
-
|
|
149
|
-
//if (isNullable<T>()) return null;
|
|
150
|
-
return parseObject<T>(data);
|
|
191
|
+
return parseObject<T>(data.trimStart());
|
|
151
192
|
} else if ((isManaged<T>() || isReference<T>()) && isBigNum<T>()) {
|
|
152
193
|
// @ts-ignore
|
|
153
194
|
return parseBigNum<T>(data);
|
|
@@ -157,11 +198,6 @@ export namespace JSON {
|
|
|
157
198
|
throw new Error(`Could not deserialize data ${data} to type ${nameof<T>()}. Invalide data provided.`)
|
|
158
199
|
}
|
|
159
200
|
}
|
|
160
|
-
// @ts-ignore
|
|
161
|
-
@unsafe
|
|
162
|
-
export function createObjectUnsafe<T>(): T {
|
|
163
|
-
return changetype<nonnull<T>>(__new(offsetof<nonnull<T>>(), idof<nonnull<T>>()))
|
|
164
|
-
}
|
|
165
201
|
}
|
|
166
202
|
|
|
167
203
|
// @ts-ignore
|
|
@@ -200,37 +236,35 @@ function parseBoolean<T extends boolean>(data: string): T {
|
|
|
200
236
|
|
|
201
237
|
// @ts-ignore
|
|
202
238
|
@inline
|
|
203
|
-
|
|
204
|
-
|
|
239
|
+
// @ts-ignore
|
|
240
|
+
export function parseNumber<T>(data: string): T {
|
|
205
241
|
// @ts-ignore
|
|
206
|
-
|
|
242
|
+
const type: T = 0;
|
|
207
243
|
// @ts-ignore
|
|
208
|
-
|
|
244
|
+
if (type instanceof f64) return f32.parse(data);
|
|
209
245
|
// @ts-ignore
|
|
210
|
-
else if (type instanceof
|
|
246
|
+
else if (type instanceof f32) return f32.parse(data);
|
|
211
247
|
// @ts-ignore
|
|
212
|
-
else if (type instanceof
|
|
248
|
+
else if (type instanceof u64) return u64.parse(data);
|
|
213
249
|
// @ts-ignore
|
|
214
|
-
else if (type instanceof
|
|
250
|
+
else if (type instanceof u32) return u32.parse(data);
|
|
215
251
|
// @ts-ignore
|
|
216
|
-
else if (type instanceof
|
|
252
|
+
else if (type instanceof u8) return u8.parse(data);
|
|
217
253
|
// @ts-ignore
|
|
218
|
-
else if (type instanceof
|
|
254
|
+
else if (type instanceof u16) return u16.parse(data);
|
|
219
255
|
// @ts-ignore
|
|
220
|
-
else if (type instanceof
|
|
256
|
+
else if (type instanceof i64) return i64.parse(data);
|
|
221
257
|
// @ts-ignore
|
|
222
|
-
else if (type instanceof
|
|
258
|
+
else if (type instanceof i32) return i32.parse(data);
|
|
223
259
|
// @ts-ignore
|
|
224
|
-
else if (type instanceof
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
`JSON: Cannot parse invalid data into a number. Either "${data}" is not a valid number, or <${nameof<T>()}> is an invald number type.`
|
|
228
|
-
);
|
|
260
|
+
else if (type instanceof i16) return i16.parse(data);
|
|
261
|
+
// @ts-ignore
|
|
262
|
+
else if (type instanceof i8) return i8.parse(data);
|
|
229
263
|
}
|
|
230
264
|
|
|
231
265
|
// @ts-ignore
|
|
232
266
|
@inline
|
|
233
|
-
|
|
267
|
+
function parseObject<T>(data: string): T {
|
|
234
268
|
let schema: nonnull<T> = changetype<nonnull<T>>(__new(offsetof<nonnull<T>>(), idof<nonnull<T>>()));
|
|
235
269
|
let key = "";
|
|
236
270
|
let isKey = false;
|
|
@@ -347,9 +381,8 @@ export function parseObject<T>(data: string): T {
|
|
|
347
381
|
// @ts-ignore
|
|
348
382
|
@inline
|
|
349
383
|
// @ts-ignore
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
if (type instanceof String) {
|
|
384
|
+
function parseArray<T extends unknown[]>(data: string): T {
|
|
385
|
+
if (isString<valueof<T>>()) {
|
|
353
386
|
return <T>parseStringArray(data);
|
|
354
387
|
} else if (isBoolean<valueof<T>>()) {
|
|
355
388
|
// @ts-ignore
|
|
@@ -361,7 +394,10 @@ export function parseArray<T extends unknown[]>(data: string): T {
|
|
|
361
394
|
// @ts-ignore
|
|
362
395
|
return parseArrayArray<T>(data);
|
|
363
396
|
// @ts-ignore
|
|
364
|
-
}
|
|
397
|
+
}
|
|
398
|
+
const type = instantiate<T>();
|
|
399
|
+
// @ts-ignore
|
|
400
|
+
if (isDefined(type.__JSON_Set_Key)) {
|
|
365
401
|
// @ts-ignore
|
|
366
402
|
return parseObjectArray<T>(data);
|
|
367
403
|
}
|
|
@@ -369,7 +405,7 @@ export function parseArray<T extends unknown[]>(data: string): T {
|
|
|
369
405
|
|
|
370
406
|
// @ts-ignore
|
|
371
407
|
@inline
|
|
372
|
-
|
|
408
|
+
function parseStringArray(data: string): string[] {
|
|
373
409
|
const result: string[] = [];
|
|
374
410
|
let lastPos = 0;
|
|
375
411
|
let instr = false;
|
|
@@ -389,7 +425,7 @@ export function parseStringArray(data: string): string[] {
|
|
|
389
425
|
|
|
390
426
|
// @ts-ignore
|
|
391
427
|
@inline
|
|
392
|
-
|
|
428
|
+
function parseBooleanArray<T extends boolean[]>(data: string): T {
|
|
393
429
|
const result = instantiate<T>();
|
|
394
430
|
let lastPos = 1;
|
|
395
431
|
let char = 0;
|
|
@@ -417,7 +453,7 @@ export function parseBooleanArray<T extends boolean[]>(data: string): T {
|
|
|
417
453
|
|
|
418
454
|
// @ts-ignore
|
|
419
455
|
@inline
|
|
420
|
-
|
|
456
|
+
function parseNumberArray<T extends number[]>(data: string): T {
|
|
421
457
|
const result = instantiate<T>();
|
|
422
458
|
let lastPos = 0;
|
|
423
459
|
let char = 0;
|
|
@@ -443,7 +479,7 @@ export function parseNumberArray<T extends number[]>(data: string): T {
|
|
|
443
479
|
|
|
444
480
|
// @ts-ignore
|
|
445
481
|
@inline
|
|
446
|
-
|
|
482
|
+
function parseArrayArray<T extends unknown[][]>(data: string): T {
|
|
447
483
|
const result = instantiate<T>();
|
|
448
484
|
let char = 0;
|
|
449
485
|
let lastPos = 0;
|
|
@@ -473,7 +509,7 @@ export function parseArrayArray<T extends unknown[][]>(data: string): T {
|
|
|
473
509
|
|
|
474
510
|
// @ts-ignore
|
|
475
511
|
@inline
|
|
476
|
-
|
|
512
|
+
function parseObjectArray<T extends unknown[][]>(data: string): T {
|
|
477
513
|
const result = instantiate<T>();
|
|
478
514
|
let char = 0;
|
|
479
515
|
let lastPos = 1;
|
|
@@ -499,4 +535,4 @@ export function parseObjectArray<T extends unknown[][]>(data: string): T {
|
|
|
499
535
|
}
|
|
500
536
|
}
|
|
501
537
|
return result;
|
|
502
|
-
}
|
|
538
|
+
}
|
package/assembly/src/util.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { u128, u128Safe, u256, u256Safe, i128, i128Safe, i256Safe } from "as-big
|
|
|
5
5
|
|
|
6
6
|
// @ts-ignore
|
|
7
7
|
@inline
|
|
8
|
-
|
|
8
|
+
export function isBigNum<T>(): boolean {
|
|
9
9
|
if (idof<T>() == idof<u128>()) return true;
|
|
10
10
|
if (idof<T>() == idof<u128Safe>()) return true;
|
|
11
11
|
if (idof<T>() == idof<u256>()) return true;
|
|
@@ -43,3 +43,19 @@ export function removeWhitespace(data: string): string {
|
|
|
43
43
|
}
|
|
44
44
|
return result.toString();
|
|
45
45
|
}
|
|
46
|
+
|
|
47
|
+
// @ts-ignore
|
|
48
|
+
@inline
|
|
49
|
+
export function escapeChar(char: string): string {
|
|
50
|
+
switch (unsafeCharCodeAt(char, 0)) {
|
|
51
|
+
case 0x22: return '\\"';
|
|
52
|
+
case 0x5C: return "\\\\";
|
|
53
|
+
case 0x08: return "\\b";
|
|
54
|
+
case 0x0A: return "\\n";
|
|
55
|
+
case 0x0D: return "\\r";
|
|
56
|
+
case 0x09: return "\\t";
|
|
57
|
+
case 0x0C: return "\\f";
|
|
58
|
+
case 0x0B: return "\\u000b";
|
|
59
|
+
default: return char;
|
|
60
|
+
}
|
|
61
|
+
}
|
package/assembly/test.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { wasi_console } from "@assemblyscript/wasi-shim/assembly/wasi_console";
|
|
2
1
|
import { u128 } from "as-bignum/assembly";
|
|
3
2
|
import {
|
|
4
3
|
JSON
|
|
@@ -30,7 +29,6 @@ class Player {
|
|
|
30
29
|
firstName!: string;
|
|
31
30
|
lastName!: string;
|
|
32
31
|
lastActive!: i32[];
|
|
33
|
-
createdAt!: Date;
|
|
34
32
|
age!: i32;
|
|
35
33
|
pos!: Vec3 | null;
|
|
36
34
|
isVerified!: boolean;
|
|
@@ -41,7 +39,6 @@ const player: Player = {
|
|
|
41
39
|
firstName: "Emmet",
|
|
42
40
|
lastName: "West",
|
|
43
41
|
lastActive: [8, 27, 2022],
|
|
44
|
-
createdAt: Date.fromString("2021-12-08T00:59:26.230Z"),
|
|
45
42
|
age: 23,
|
|
46
43
|
pos: {
|
|
47
44
|
x: 3.4,
|
|
@@ -56,6 +53,6 @@ const player: Player = {
|
|
|
56
53
|
};
|
|
57
54
|
|
|
58
55
|
const serializedPlayer = JSON.stringify<Player>(player);
|
|
59
|
-
|
|
56
|
+
console.log("Serialized Player: " + serializedPlayer);
|
|
60
57
|
const deserializedPlayer = JSON.parse<Player>(serializedPlayer);
|
|
61
|
-
|
|
58
|
+
console.log("Deserialized Player: " + JSON.stringify(deserializedPlayer));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "json-as",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.10",
|
|
4
4
|
"description": "JSON encoder/decoder for AssemblyScript",
|
|
5
5
|
"types": "assembly/index.ts",
|
|
6
6
|
"author": "Jairus Tanaka",
|
|
@@ -19,15 +19,15 @@
|
|
|
19
19
|
"prettier": "as-prettier -w ."
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@as-pect/cli": "^
|
|
22
|
+
"@as-pect/cli": "^8.0.0",
|
|
23
23
|
"@as-tral/cli": "^1.2.0",
|
|
24
|
-
"@assemblyscript/loader": "^0.
|
|
24
|
+
"@assemblyscript/loader": "^0.25.0",
|
|
25
25
|
"@assemblyscript/wasi-shim": "^0.1.0",
|
|
26
26
|
"as-bignum": "^0.2.23",
|
|
27
|
-
"assemblyscript": "^0.
|
|
28
|
-
"assemblyscript-prettier": "^1.0.
|
|
29
|
-
"prettier": "^2.
|
|
30
|
-
"typescript": "^4.
|
|
27
|
+
"assemblyscript": "^0.25.0",
|
|
28
|
+
"assemblyscript-prettier": "^1.0.6",
|
|
29
|
+
"prettier": "^2.8.1",
|
|
30
|
+
"typescript": "^4.9.4"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"as-string-sink": "^0.5.0",
|
package/transform/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@json-as/transform",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.10",
|
|
4
4
|
"description": "JSON encoder/decoder for AssemblyScript",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"author": "Jairus Tanaka",
|
|
7
7
|
"contributors": [
|
|
8
|
-
"DogWhich"
|
|
8
|
+
"DogWhich",
|
|
9
|
+
"Josh Tenner",
|
|
10
|
+
"Rom"
|
|
9
11
|
],
|
|
10
12
|
"license": "MIT",
|
|
11
13
|
"devDependencies": {},
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
4
|
+
|
|
5
|
+
/* Projects */
|
|
6
|
+
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
|
7
|
+
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
|
+
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
|
9
|
+
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
|
10
|
+
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
11
|
+
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
|
+
|
|
13
|
+
/* Language and Environment */
|
|
14
|
+
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
15
|
+
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
|
+
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
17
|
+
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
|
18
|
+
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
19
|
+
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
20
|
+
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
21
|
+
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
|
22
|
+
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
|
23
|
+
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
24
|
+
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
25
|
+
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
26
|
+
|
|
27
|
+
/* Modules */
|
|
28
|
+
"module": "commonjs", /* Specify what module code is generated. */
|
|
29
|
+
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
30
|
+
// "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
31
|
+
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
32
|
+
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
33
|
+
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
34
|
+
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
35
|
+
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
36
|
+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
37
|
+
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
38
|
+
// "resolveJsonModule": true, /* Enable importing .json files. */
|
|
39
|
+
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
40
|
+
|
|
41
|
+
/* JavaScript Support */
|
|
42
|
+
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
43
|
+
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
44
|
+
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
45
|
+
|
|
46
|
+
/* Emit */
|
|
47
|
+
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
48
|
+
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
49
|
+
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
50
|
+
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
51
|
+
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
52
|
+
// "outDir": "./", /* Specify an output folder for all emitted files. */
|
|
53
|
+
// "removeComments": true, /* Disable emitting comments. */
|
|
54
|
+
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
55
|
+
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
56
|
+
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
|
57
|
+
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
58
|
+
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
59
|
+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
60
|
+
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
61
|
+
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
62
|
+
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
63
|
+
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
64
|
+
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
65
|
+
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
66
|
+
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
67
|
+
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
68
|
+
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
69
|
+
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
70
|
+
|
|
71
|
+
/* Interop Constraints */
|
|
72
|
+
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
73
|
+
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
74
|
+
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
|
75
|
+
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
76
|
+
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
77
|
+
|
|
78
|
+
/* Type Checking */
|
|
79
|
+
"strict": true, /* Enable all strict type-checking options. */
|
|
80
|
+
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
81
|
+
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
82
|
+
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
83
|
+
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
84
|
+
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
85
|
+
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
86
|
+
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
87
|
+
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
88
|
+
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
89
|
+
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
90
|
+
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
91
|
+
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
92
|
+
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
93
|
+
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
94
|
+
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
95
|
+
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
96
|
+
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
97
|
+
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
98
|
+
|
|
99
|
+
/* Completeness */
|
|
100
|
+
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
101
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
102
|
+
}
|
|
103
|
+
}
|