@stryke/json 0.9.16 → 0.9.23
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/CHANGELOG.md +404 -0
- package/README.md +18 -9
- package/dist/code-frames-BQI7PKd_.mjs +4 -0
- package/dist/code-frames-BQI7PKd_.mjs.map +1 -0
- package/dist/code-frames-CXX37tnR.d.mts +17 -0
- package/dist/code-frames-CXX37tnR.d.mts.map +1 -0
- package/dist/code-frames-DEWi5iIn.cjs +3 -0
- package/dist/code-frames-DViwqU8S.d.cts +17 -0
- package/dist/code-frames-DViwqU8S.d.cts.map +1 -0
- package/dist/find-reference-AvNORSzC.d.mts +52 -0
- package/dist/find-reference-AvNORSzC.d.mts.map +1 -0
- package/dist/find-reference-BUIYIOS4.mjs +2 -0
- package/dist/find-reference-BUIYIOS4.mjs.map +1 -0
- package/dist/find-reference-ChoPoDcB.d.cts +52 -0
- package/dist/find-reference-ChoPoDcB.d.cts.map +1 -0
- package/dist/find-reference-DQJK1LbJ.cjs +1 -0
- package/dist/index-CMuRFTR3.d.mts +1 -0
- package/dist/index-uTS5iDq_.d.cts +1 -0
- package/dist/index.cjs +1 -38
- package/dist/index.d.cts +8 -0
- package/dist/index.d.mts +9 -0
- package/dist/index.mjs +1 -1
- package/dist/is-number-CebQk_B0.mjs +2 -0
- package/dist/is-number-CebQk_B0.mjs.map +1 -0
- package/dist/is-number-wfNPC3Mj.cjs +1 -0
- package/dist/is-object-CGB7EeiA.cjs +1 -0
- package/dist/is-object-DDPbtSWR.mjs +2 -0
- package/dist/is-object-DDPbtSWR.mjs.map +1 -0
- package/dist/is-string-D5yKZC0U.cjs +1 -0
- package/dist/is-string-VB7nGKjX.mjs +2 -0
- package/dist/is-string-VB7nGKjX.mjs.map +1 -0
- package/dist/is-undefined-D6sfLkFq.mjs +2 -0
- package/dist/is-undefined-D6sfLkFq.mjs.map +1 -0
- package/dist/is-undefined-Pevixi0g.cjs +1 -0
- package/dist/parse-BYhuR8fo.mjs +2 -0
- package/dist/parse-BYhuR8fo.mjs.map +1 -0
- package/dist/parse-BpylFCf0.mjs +2 -0
- package/dist/parse-BpylFCf0.mjs.map +1 -0
- package/dist/parse-BwhwGAkA.cjs +1 -0
- package/dist/parse-D-7TqXVh.d.mts +51 -0
- package/dist/parse-D-7TqXVh.d.mts.map +1 -0
- package/dist/parse-DU-kIQN6.d.cts +51 -0
- package/dist/parse-DU-kIQN6.d.cts.map +1 -0
- package/dist/parse-DmriuGKI.cjs +1 -0
- package/dist/parse-error-0BAtatMf.cjs +1 -0
- package/dist/parse-error-CJTV0jdn.d.mts +15 -0
- package/dist/parse-error-CJTV0jdn.d.mts.map +1 -0
- package/dist/parse-error-DLuqEXmf.d.cts +15 -0
- package/dist/parse-error-DLuqEXmf.d.cts.map +1 -0
- package/dist/parse-error-DrJJkemH.mjs +2 -0
- package/dist/parse-error-DrJJkemH.mjs.map +1 -0
- package/dist/parse-fX7NFKdt.d.cts +9 -0
- package/dist/parse-fX7NFKdt.d.cts.map +1 -0
- package/dist/parse-xFkFesIF.d.mts +9 -0
- package/dist/parse-xFkFesIF.d.mts.map +1 -0
- package/dist/pointer/find-reference.cjs +1 -39
- package/dist/pointer/find-reference.d.cts +2 -0
- package/dist/pointer/find-reference.d.mts +2 -0
- package/dist/pointer/find-reference.mjs +1 -1
- package/dist/pointer/index.cjs +1 -27
- package/dist/pointer/index.d.cts +3 -0
- package/dist/pointer/index.d.mts +3 -0
- package/dist/pointer/index.mjs +1 -1
- package/dist/pointer/parse.cjs +1 -55
- package/dist/pointer/parse.d.cts +2 -0
- package/dist/pointer/parse.d.mts +2 -0
- package/dist/pointer/parse.mjs +1 -1
- package/dist/storm-json-BsdLpzM_.mjs +2 -0
- package/dist/storm-json-BsdLpzM_.mjs.map +1 -0
- package/dist/storm-json-CfqJ0KzG.d.mts +70 -0
- package/dist/storm-json-CfqJ0KzG.d.mts.map +1 -0
- package/dist/storm-json-DBxiMujR.cjs +1 -0
- package/dist/storm-json-Q1bOIv3-.d.cts +70 -0
- package/dist/storm-json-Q1bOIv3-.d.cts.map +1 -0
- package/dist/storm-json.cjs +1 -72
- package/dist/storm-json.d.cts +2 -0
- package/dist/storm-json.d.mts +3 -0
- package/dist/storm-json.mjs +1 -1
- package/dist/stringify-BpBMOhle.d.cts +13 -0
- package/dist/stringify-BpBMOhle.d.cts.map +1 -0
- package/dist/stringify-DjBDt8SC.mjs +2 -0
- package/dist/stringify-DjBDt8SC.mjs.map +1 -0
- package/dist/stringify-Dp0lF-wN.cjs +1 -0
- package/dist/stringify-ln223ZC9.d.mts +13 -0
- package/dist/stringify-ln223ZC9.d.mts.map +1 -0
- package/dist/strip-comments-BhdK_E8s.cjs +4 -0
- package/dist/strip-comments-CKLSXchM.d.cts +11 -0
- package/dist/strip-comments-CKLSXchM.d.cts.map +1 -0
- package/dist/strip-comments-DdsCzji6.d.mts +11 -0
- package/dist/strip-comments-DdsCzji6.d.mts.map +1 -0
- package/dist/strip-comments-LcqiBhvo.mjs +5 -0
- package/dist/strip-comments-LcqiBhvo.mjs.map +1 -0
- package/dist/types-CEiKQHlk.d.cts +69 -0
- package/dist/types-CEiKQHlk.d.cts.map +1 -0
- package/dist/types-CQHq94S4.d.mts +69 -0
- package/dist/types-CQHq94S4.d.mts.map +1 -0
- package/dist/types.cjs +0 -1
- package/dist/types.d.cts +2 -0
- package/dist/types.d.mts +2 -0
- package/dist/types.mjs +1 -0
- package/dist/utils/code-frames.cjs +1 -72
- package/dist/utils/code-frames.d.cts +2 -0
- package/dist/utils/code-frames.d.mts +2 -0
- package/dist/utils/code-frames.mjs +1 -3
- package/dist/utils/index.cjs +1 -60
- package/dist/utils/index.d.cts +6 -0
- package/dist/utils/index.d.mts +7 -0
- package/dist/utils/index.mjs +1 -1
- package/dist/utils/parse-error.cjs +1 -31
- package/dist/utils/parse-error.d.cts +2 -0
- package/dist/utils/parse-error.d.mts +2 -0
- package/dist/utils/parse-error.mjs +1 -3
- package/dist/utils/parse.cjs +1 -59
- package/dist/utils/parse.d.cts +2 -0
- package/dist/utils/parse.d.mts +2 -0
- package/dist/utils/parse.mjs +1 -1
- package/dist/utils/stringify.cjs +1 -42
- package/dist/utils/stringify.d.cts +2 -0
- package/dist/utils/stringify.d.mts +2 -0
- package/dist/utils/stringify.mjs +1 -1
- package/dist/utils/strip-comments.cjs +1 -43
- package/dist/utils/strip-comments.d.cts +2 -0
- package/dist/utils/strip-comments.d.mts +2 -0
- package/dist/utils/strip-comments.mjs +1 -4
- package/dist/utils-BkLHzBxb.mjs +1 -0
- package/dist/utils-DFU9Wltn.cjs +0 -0
- package/package.json +44 -238
- package/dist/index.d.ts +0 -11
- package/dist/pointer/find-reference.d.ts +0 -48
- package/dist/pointer/index.d.ts +0 -2
- package/dist/pointer/parse.d.ts +0 -38
- package/dist/storm-json.d.ts +0 -64
- package/dist/types.d.ts +0 -64
- package/dist/utils/code-frames.d.ts +0 -14
- package/dist/utils/index.d.ts +0 -5
- package/dist/utils/parse-error.d.ts +0 -9
- package/dist/utils/parse.d.ts +0 -5
- package/dist/utils/stringify.d.ts +0 -9
- package/dist/utils/strip-comments.d.ts +0 -4
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { ParseOptions } from "jsonc-parser";
|
|
2
|
+
|
|
3
|
+
//#region src/types.d.ts
|
|
4
|
+
type PrimitiveJsonValue = string | number | boolean | undefined | null;
|
|
5
|
+
interface Class {
|
|
6
|
+
new (...args: any[]): any;
|
|
7
|
+
}
|
|
8
|
+
type JsonValue = PrimitiveJsonValue | JsonArray | JsonObject;
|
|
9
|
+
type JsonArray = Array<JsonValue>;
|
|
10
|
+
interface JsonObject {
|
|
11
|
+
[key: string]: JsonValue;
|
|
12
|
+
}
|
|
13
|
+
type ClassInstance = any;
|
|
14
|
+
type SerializableJsonValue = symbol | Set<JsonValue> | Map<JsonValue, JsonValue> | undefined | bigint | Date | ClassInstance | RegExp;
|
|
15
|
+
type Tree<T> = InnerNode<T> | Leaf<T>;
|
|
16
|
+
type Leaf<T> = [T];
|
|
17
|
+
type InnerNode<T> = [T, Record<string, Tree<T>>];
|
|
18
|
+
type PrimitiveTypeAnnotation = "number" | "undefined" | "bigint";
|
|
19
|
+
type LeafTypeAnnotation = PrimitiveTypeAnnotation | "regexp" | "Date" | "Error" | "URL";
|
|
20
|
+
type TypedArrayAnnotation = ["typed-array", string];
|
|
21
|
+
type ClassTypeAnnotation = ["class", string];
|
|
22
|
+
type SymbolTypeAnnotation = ["symbol", string];
|
|
23
|
+
type CustomTypeAnnotation = ["custom", string];
|
|
24
|
+
type SimpleTypeAnnotation = LeafTypeAnnotation | "map" | "set";
|
|
25
|
+
type CompositeTypeAnnotation = TypedArrayAnnotation | ClassTypeAnnotation | SymbolTypeAnnotation | CustomTypeAnnotation;
|
|
26
|
+
type TypeAnnotation = SimpleTypeAnnotation | CompositeTypeAnnotation;
|
|
27
|
+
interface JsonParseOptions extends ParseOptions {
|
|
28
|
+
/**
|
|
29
|
+
* Expect JSON with javascript-style
|
|
30
|
+
*
|
|
31
|
+
* @defaultValue false
|
|
32
|
+
*/
|
|
33
|
+
expectComments?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Disallow javascript-style
|
|
36
|
+
*
|
|
37
|
+
* @defaultValue false
|
|
38
|
+
*/
|
|
39
|
+
disallowComments?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Allow trailing commas in the JSON content
|
|
42
|
+
*/
|
|
43
|
+
allowTrailingComma?: boolean;
|
|
44
|
+
}
|
|
45
|
+
interface JsonSerializeOptions {
|
|
46
|
+
/**
|
|
47
|
+
* the whitespaces to add as indentation to make the output more readable.
|
|
48
|
+
*
|
|
49
|
+
* @defaultValue 2
|
|
50
|
+
*/
|
|
51
|
+
spaces?: number;
|
|
52
|
+
}
|
|
53
|
+
interface JsonParserResult {
|
|
54
|
+
json: JsonValue;
|
|
55
|
+
meta?: {
|
|
56
|
+
values?: Tree<TypeAnnotation> | Record<string, Tree<TypeAnnotation>> | undefined;
|
|
57
|
+
referentialEqualities?: Record<string, string[]> | [string[]] | [string[], Record<string, string[]>];
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
interface JsonParserInterface {
|
|
61
|
+
parse: <TData = any>(strData: string) => TData;
|
|
62
|
+
stringify: <TData = any>(data: TData) => string;
|
|
63
|
+
serialize: (object: JsonValue) => JsonParserResult;
|
|
64
|
+
deserialize: <TData = any>(payload: JsonParserResult) => TData;
|
|
65
|
+
register: <TData = any, TJsonValue extends JsonValue = JsonValue>(name: string, serialize: (object: JsonValue) => TJsonValue, deserialize: (payload: TJsonValue) => TData, isApplicable: (data: any) => data is TData) => void;
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
export { TypedArrayAnnotation as C, TypeAnnotation as S, PrimitiveTypeAnnotation as _, CustomTypeAnnotation as a, SymbolTypeAnnotation as b, JsonObject as c, JsonParserResult as d, JsonSerializeOptions as f, PrimitiveJsonValue as g, LeafTypeAnnotation as h, CompositeTypeAnnotation as i, JsonParseOptions as l, Leaf as m, ClassInstance as n, InnerNode as o, JsonValue as p, ClassTypeAnnotation as r, JsonArray as s, Class as t, JsonParserInterface as u, SerializableJsonValue as v, Tree as x, SimpleTypeAnnotation as y };
|
|
69
|
+
//# sourceMappingURL=types-CQHq94S4.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-CQHq94S4.d.mts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;KAoBY,kBAAA;UAEK,KAAA;EAFL,KAAA,GAAA,IAAA,EAAA,GAAA,EAAA,CAAA,EAAkB,GAAA;AAE9B;AAIY,KAAA,SAAA,GAAY,kBAAH,GAAwB,SAAxB,GAAoC,UAApC;AAAG,KAEZ,SAAA,GAAY,KAFA,CAEM,SAFN,CAAA;AAAqB,UAI5B,UAAA,CAJ4B;EAAY,CAAA,GAAA,EAAA,MAAA,CAAA,EAKxC,SALwC;;AAE7C,KAMA,aAAA,GANkB,GAAA;AAEb,KA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nnotation, _ as PrimitiveTypeAnnotation, a as CustomTypeAnnotation, b as SymbolTypeAnnotation, c as JsonObject, d as JsonParserResult, f as JsonSerializeOptions, g as PrimitiveJsonValue, h as LeafTypeAnnotation, i as CompositeTypeAnnotation, l as JsonParseOptions, m as Leaf, n as ClassInstance, o as InnerNode, p as JsonValue, r as ClassTypeAnnotation, s as JsonArray, t as Class, u as JsonParserInterface, v as SerializableJsonValue, x as Tree, y as SimpleTypeAnnotation } from "./types-CEiKQHlk.cjs";
|
|
2
|
+
export { Class, ClassInstance, ClassTypeAnnotation, CompositeTypeAnnotation, CustomTypeAnnotation, InnerNode, JsonArray, JsonObject, JsonParseOptions, JsonParserInterface, JsonParserResult, JsonSerializeOptions, JsonValue, Leaf, LeafTypeAnnotation, PrimitiveJsonValue, PrimitiveTypeAnnotation, SerializableJsonValue, SimpleTypeAnnotation, SymbolTypeAnnotation, Tree, TypeAnnotation, TypedArrayAnnotation };
|
package/dist/types.d.mts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { C as TypedArrayAnnotation, S as TypeAnnotation, _ as PrimitiveTypeAnnotation, a as CustomTypeAnnotation, b as SymbolTypeAnnotation, c as JsonObject, d as JsonParserResult, f as JsonSerializeOptions, g as PrimitiveJsonValue, h as LeafTypeAnnotation, i as CompositeTypeAnnotation, l as JsonParseOptions, m as Leaf, n as ClassInstance, o as InnerNode, p as JsonValue, r as ClassTypeAnnotation, s as JsonArray, t as Class, u as JsonParserInterface, v as SerializableJsonValue, x as Tree, y as SimpleTypeAnnotation } from "./types-CQHq94S4.mjs";
|
|
2
|
+
export { Class, ClassInstance, ClassTypeAnnotation, CompositeTypeAnnotation, CustomTypeAnnotation, InnerNode, JsonArray, JsonObject, JsonParseOptions, JsonParserInterface, JsonParserResult, JsonSerializeOptions, JsonValue, Leaf, LeafTypeAnnotation, PrimitiveJsonValue, PrimitiveTypeAnnotation, SerializableJsonValue, SimpleTypeAnnotation, SymbolTypeAnnotation, Tree, TypeAnnotation, TypedArrayAnnotation };
|
package/dist/types.mjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
|
@@ -1,72 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.codeFrameColumns = codeFrameColumns;
|
|
7
|
-
const k = /\r\n|[\n\r\u2028\u2029]/;
|
|
8
|
-
function N(s, l, a = {}) {
|
|
9
|
-
const c = {
|
|
10
|
-
column: 0,
|
|
11
|
-
line: -1,
|
|
12
|
-
...s.start
|
|
13
|
-
},
|
|
14
|
-
m = {
|
|
15
|
-
...c,
|
|
16
|
-
...s.end
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
linesAbove: h = 2,
|
|
20
|
-
linesBelow: f = 3
|
|
21
|
-
} = a || {},
|
|
22
|
-
i = c.line,
|
|
23
|
-
t = c.column,
|
|
24
|
-
b = m.line,
|
|
25
|
-
o = m.column;
|
|
26
|
-
let d = Math.max(i - (h + 1), 0),
|
|
27
|
-
u = Math.min(l.length, b + f);
|
|
28
|
-
i === -1 && (d = 0), b === -1 && (u = l.length);
|
|
29
|
-
const L = b - i,
|
|
30
|
-
e = {};
|
|
31
|
-
if (L) for (let n = 0; n <= L; n++) {
|
|
32
|
-
const r = n + i;
|
|
33
|
-
if (!t) e[r] = !0;else if (n === 0) {
|
|
34
|
-
const g = l[r - 1]?.length ?? 0;
|
|
35
|
-
e[r] = [t, g - t + 1];
|
|
36
|
-
} else if (n === L) e[r] = [0, o];else {
|
|
37
|
-
const g = l[r - n]?.length ?? 0;
|
|
38
|
-
e[r] = [0, g];
|
|
39
|
-
}
|
|
40
|
-
} else t === o ? e[i] = t ? [t, 0] : !0 : e[i] = [t, o - t];
|
|
41
|
-
return {
|
|
42
|
-
start: d,
|
|
43
|
-
end: u,
|
|
44
|
-
markerLines: e
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
function codeFrameColumns(s, l, a = {}) {
|
|
48
|
-
const c = s.split(k),
|
|
49
|
-
{
|
|
50
|
-
start: m,
|
|
51
|
-
end: h,
|
|
52
|
-
markerLines: f
|
|
53
|
-
} = N(l, c, a),
|
|
54
|
-
i = String(h).length;
|
|
55
|
-
return (a.highlight ? a.highlight(s) : s).split(k).slice(m, h).map((o, d) => {
|
|
56
|
-
const u = m + 1 + d,
|
|
57
|
-
e = ` ${` ${u}`.slice(-i)} | `,
|
|
58
|
-
n = !!(f[u] ?? !1);
|
|
59
|
-
if (n) {
|
|
60
|
-
let r = "";
|
|
61
|
-
if (Array.isArray(n)) {
|
|
62
|
-
const g = o.slice(0, Math.max(n[0] - 1, 0)).replace(/[^\t]/g, " "),
|
|
63
|
-
p = n[1] || 1;
|
|
64
|
-
r = [`
|
|
65
|
-
`, e.replace(/\d/g, " "), g, "^".repeat(p)].join("");
|
|
66
|
-
}
|
|
67
|
-
return [">", e, o, r].join("");
|
|
68
|
-
}
|
|
69
|
-
return ` ${e}${o}`;
|
|
70
|
-
}).join(`
|
|
71
|
-
`);
|
|
72
|
-
}
|
|
1
|
+
const e=require(`../code-frames-DEWi5iIn.cjs`);exports.codeFrameColumns=e.t;
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
|
|
2
|
-
`,e.replace(/\d/g," "),g,"^".repeat(p)].join("")}return[">",e,o,r].join("")}return` ${e}${o}`}).join(`
|
|
3
|
-
`)}
|
|
1
|
+
import{t as e}from"../code-frames-BQI7PKd_.mjs";export{e as codeFrameColumns};
|
package/dist/utils/index.cjs
CHANGED
|
@@ -1,60 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _codeFrames = require("./code-frames.cjs");
|
|
7
|
-
Object.keys(_codeFrames).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _codeFrames[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _codeFrames[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
var _parse = require("./parse.cjs");
|
|
18
|
-
Object.keys(_parse).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _parse[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _parse[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
var _parseError = require("./parse-error.cjs");
|
|
29
|
-
Object.keys(_parseError).forEach(function (key) {
|
|
30
|
-
if (key === "default" || key === "__esModule") return;
|
|
31
|
-
if (key in exports && exports[key] === _parseError[key]) return;
|
|
32
|
-
Object.defineProperty(exports, key, {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () {
|
|
35
|
-
return _parseError[key];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
var _stringify = require("./stringify.cjs");
|
|
40
|
-
Object.keys(_stringify).forEach(function (key) {
|
|
41
|
-
if (key === "default" || key === "__esModule") return;
|
|
42
|
-
if (key in exports && exports[key] === _stringify[key]) return;
|
|
43
|
-
Object.defineProperty(exports, key, {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
get: function () {
|
|
46
|
-
return _stringify[key];
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
var _stripComments = require("./strip-comments.cjs");
|
|
51
|
-
Object.keys(_stripComments).forEach(function (key) {
|
|
52
|
-
if (key === "default" || key === "__esModule") return;
|
|
53
|
-
if (key in exports && exports[key] === _stripComments[key]) return;
|
|
54
|
-
Object.defineProperty(exports, key, {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
get: function () {
|
|
57
|
-
return _stripComments[key];
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
});
|
|
1
|
+
const e=require(`../strip-comments-BhdK_E8s.cjs`),t=require(`../parse-DmriuGKI.cjs`),n=require(`../code-frames-DEWi5iIn.cjs`),r=require(`../parse-error-0BAtatMf.cjs`),i=require(`../stringify-Dp0lF-wN.cjs`);require(`../utils-DFU9Wltn.cjs`),exports.codeFrameColumns=n.t,exports.formatParseError=r.t,exports.invalidKeyChars=i.t,exports.parse=t.t,exports.safeParse=t.n,exports.stringify=i.n,exports.stripComments=e.t;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { t as codeFrameColumns } from "../code-frames-DViwqU8S.cjs";
|
|
2
|
+
import { n as parse, r as safeParse, t as Options } from "../parse-fX7NFKdt.cjs";
|
|
3
|
+
import { t as formatParseError } from "../parse-error-DLuqEXmf.cjs";
|
|
4
|
+
import { n as stringify, t as invalidKeyChars } from "../stringify-BpBMOhle.cjs";
|
|
5
|
+
import { t as stripComments } from "../strip-comments-CKLSXchM.cjs";
|
|
6
|
+
export { Options, codeFrameColumns, formatParseError, invalidKeyChars, parse, safeParse, stringify, stripComments };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { t as codeFrameColumns } from "../code-frames-CXX37tnR.mjs";
|
|
2
|
+
import { n as parse, r as safeParse, t as Options } from "../parse-xFkFesIF.mjs";
|
|
3
|
+
import { t as formatParseError } from "../parse-error-CJTV0jdn.mjs";
|
|
4
|
+
import { n as stringify, t as invalidKeyChars } from "../stringify-ln223ZC9.mjs";
|
|
5
|
+
import { t as stripComments } from "../strip-comments-DdsCzji6.mjs";
|
|
6
|
+
import "../index-CMuRFTR3.mjs";
|
|
7
|
+
export { Options, codeFrameColumns, formatParseError, invalidKeyChars, parse, safeParse, stringify, stripComments };
|
package/dist/utils/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{t as e}from"../strip-comments-LcqiBhvo.mjs";import{n as t,t as n}from"../parse-BpylFCf0.mjs";import{t as r}from"../code-frames-BQI7PKd_.mjs";import{t as i}from"../parse-error-DrJJkemH.mjs";import{n as a,t as o}from"../stringify-DjBDt8SC.mjs";import"../utils-BkLHzBxb.mjs";export{r as codeFrameColumns,i as formatParseError,o as invalidKeyChars,n as parse,t as safeParse,a as stringify,e as stripComments};
|
|
@@ -1,31 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.formatParseError = formatParseError;
|
|
7
|
-
var _jsoncParser = require("jsonc-parser");
|
|
8
|
-
var _linesAndColumns = require("lines-and-columns");
|
|
9
|
-
var _codeFrames = require("./code-frames.cjs");
|
|
10
|
-
function formatParseError(n, t) {
|
|
11
|
-
const {
|
|
12
|
-
error: m,
|
|
13
|
-
offset: s,
|
|
14
|
-
length: l
|
|
15
|
-
} = t,
|
|
16
|
-
e = new _linesAndColumns.LinesAndColumns(n).locationForIndex(s);
|
|
17
|
-
let r = e?.line ?? 0,
|
|
18
|
-
o = e?.column ?? 0;
|
|
19
|
-
return r++, o++, `${(0, _jsoncParser.printParseErrorCode)(m)} in JSON at ${r}:${o}
|
|
20
|
-
${(0, _codeFrames.codeFrameColumns)(n, {
|
|
21
|
-
start: {
|
|
22
|
-
line: r,
|
|
23
|
-
column: o
|
|
24
|
-
},
|
|
25
|
-
end: {
|
|
26
|
-
line: r,
|
|
27
|
-
column: o + l
|
|
28
|
-
}
|
|
29
|
-
})}
|
|
30
|
-
`;
|
|
31
|
-
}
|
|
1
|
+
const e=require(`../parse-error-0BAtatMf.cjs`);exports.formatParseError=e.t;
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
${c(n,{start:{line:r,column:o},end:{line:r,column:o+l}})}
|
|
3
|
-
`}
|
|
1
|
+
import{t as e}from"../parse-error-DrJJkemH.mjs";export{e as formatParseError};
|
package/dist/utils/parse.cjs
CHANGED
|
@@ -1,59 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.parse = parse;
|
|
7
|
-
exports.safeParse = safeParse;
|
|
8
|
-
var _stripComments = require("./strip-comments.cjs");
|
|
9
|
-
const o = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,
|
|
10
|
-
u = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,
|
|
11
|
-
i = /^\s*["[{]|^\s*-?\d{1,16}(?:\.\d{1,17})?(?:E[+-]?\d+)?\s*$/i;
|
|
12
|
-
function c(t, n) {
|
|
13
|
-
if (t === "__proto__" || t === "constructor" && n && typeof n == "object" && "prototype" in n) {
|
|
14
|
-
console.warn(`Dropping "${t}" key to prevent prototype pollution.`);
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
return n;
|
|
18
|
-
}
|
|
19
|
-
function parse(t, n = {}) {
|
|
20
|
-
if (typeof t != "string") return t;
|
|
21
|
-
let r = (0, _stripComments.stripComments)(t);
|
|
22
|
-
if (r[0] === '"' && r[r.length - 1] === '"' && !r.includes("\\")) return r.slice(1, -1);
|
|
23
|
-
if (r = r.trim(), r.length <= 9) switch (r.toLowerCase()) {
|
|
24
|
-
case "true":
|
|
25
|
-
return !0;
|
|
26
|
-
case "false":
|
|
27
|
-
return !1;
|
|
28
|
-
case "undefined":
|
|
29
|
-
return;
|
|
30
|
-
case "null":
|
|
31
|
-
return null;
|
|
32
|
-
case "nan":
|
|
33
|
-
return Number.NaN;
|
|
34
|
-
case "infinity":
|
|
35
|
-
return Number.POSITIVE_INFINITY;
|
|
36
|
-
case "-infinity":
|
|
37
|
-
return Number.NEGATIVE_INFINITY;
|
|
38
|
-
}
|
|
39
|
-
if (!i.test(r)) {
|
|
40
|
-
if (n.strict) throw new Error("Invalid JSON");
|
|
41
|
-
return r;
|
|
42
|
-
}
|
|
43
|
-
try {
|
|
44
|
-
if (o.test(r) || u.test(r)) {
|
|
45
|
-
if (n.strict) throw new Error("Possible prototype pollution");
|
|
46
|
-
return JSON.parse(r, c);
|
|
47
|
-
}
|
|
48
|
-
return JSON.parse(r);
|
|
49
|
-
} catch (e) {
|
|
50
|
-
if (n.strict) throw e;
|
|
51
|
-
return t;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
function safeParse(t, n = {}) {
|
|
55
|
-
return parse(t, {
|
|
56
|
-
...n,
|
|
57
|
-
strict: !0
|
|
58
|
-
});
|
|
59
|
-
}
|
|
1
|
+
const e=require(`../parse-DmriuGKI.cjs`);exports.parse=e.t,exports.safeParse=e.n;
|
package/dist/utils/parse.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{n as e,t}from"../parse-BpylFCf0.mjs";export{t as parse,e as safeParse};
|
package/dist/utils/stringify.cjs
CHANGED
|
@@ -1,42 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.stringify = exports.invalidKeyChars = void 0;
|
|
7
|
-
var _isNumber = require("@stryke/type-checks/is-number");
|
|
8
|
-
var _isUndefined = require("@stryke/type-checks/is-undefined");
|
|
9
|
-
const invalidKeyChars = exports.invalidKeyChars = ["@", "/", "#", "$", " ", ":", ";", ",", ".", "!", "?", "&", "=", "+", "-", "*", "%", "^", "~", "|", "\\", '"', "'", "`", "{", "}", "[", "]", "(", ")", "<", ">"],
|
|
10
|
-
stringify = (r, e = 2) => {
|
|
11
|
-
const n = (0, _isNumber.isNumber)(e) ? " ".repeat(e) : e;
|
|
12
|
-
switch (r) {
|
|
13
|
-
case null:
|
|
14
|
-
return "null";
|
|
15
|
-
case void 0:
|
|
16
|
-
return '"undefined"';
|
|
17
|
-
case !0:
|
|
18
|
-
return "true";
|
|
19
|
-
case !1:
|
|
20
|
-
return "false";
|
|
21
|
-
case Number.POSITIVE_INFINITY:
|
|
22
|
-
return "infinity";
|
|
23
|
-
case Number.NEGATIVE_INFINITY:
|
|
24
|
-
return "-infinity";
|
|
25
|
-
}
|
|
26
|
-
if (Array.isArray(r)) return `[${n}${r.map(s => stringify(s, n)).join(`,${n}`)}${n}]`;
|
|
27
|
-
if (r instanceof Uint8Array) return r.toString();
|
|
28
|
-
switch (typeof r) {
|
|
29
|
-
case "number":
|
|
30
|
-
return `${r}`;
|
|
31
|
-
case "string":
|
|
32
|
-
return JSON.stringify(r);
|
|
33
|
-
case "object":
|
|
34
|
-
{
|
|
35
|
-
const s = Object.keys(r).filter(t => !(0, _isUndefined.isUndefined)(r[t]));
|
|
36
|
-
return `{${n}${s.map(t => `${invalidKeyChars.some(i => t.includes(i)) ? `"${t}"` : t}: ${n}${stringify(r[t], n)}`).join(`,${n}`)}${n}}`;
|
|
37
|
-
}
|
|
38
|
-
default:
|
|
39
|
-
return "null";
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
exports.stringify = stringify;
|
|
1
|
+
const e=require(`../stringify-Dp0lF-wN.cjs`);exports.invalidKeyChars=e.t,exports.stringify=e.n;
|
package/dist/utils/stringify.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{n as e,t}from"../stringify-DjBDt8SC.mjs";export{t as invalidKeyChars,e as stringify};
|
|
@@ -1,43 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.stripComments = stripComments;
|
|
7
|
-
var _base = require("@stryke/types/base");
|
|
8
|
-
const h = Symbol("singleComment"),
|
|
9
|
-
a = Symbol("multiComment");
|
|
10
|
-
function d() {
|
|
11
|
-
return "";
|
|
12
|
-
}
|
|
13
|
-
function C(t, f, c) {
|
|
14
|
-
return t.slice(f, c).replace(/\S/g, " ");
|
|
15
|
-
}
|
|
16
|
-
function y(t, f) {
|
|
17
|
-
let c = f - 1,
|
|
18
|
-
o = 0;
|
|
19
|
-
for (; t[c] === "\\";) c -= 1, o += 1;
|
|
20
|
-
return !!(o % 2);
|
|
21
|
-
}
|
|
22
|
-
function stripComments(t, {
|
|
23
|
-
whitespace: f = !0,
|
|
24
|
-
trailingCommas: c = !1
|
|
25
|
-
} = {}) {
|
|
26
|
-
if (typeof t != "string") throw new TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof t}\``);
|
|
27
|
-
const o = f ? C : d;
|
|
28
|
-
let g = !1,
|
|
29
|
-
i = !1,
|
|
30
|
-
s = 0,
|
|
31
|
-
n = "",
|
|
32
|
-
b = "",
|
|
33
|
-
l = -1;
|
|
34
|
-
for (let e = 0; e < t.length; e++) {
|
|
35
|
-
const r = t[e],
|
|
36
|
-
m = t[e + 1];
|
|
37
|
-
!i && r === '"' && (y(t, e) || (g = !g)), !g && (!i && r + (m ?? _base.EMPTY_STRING) === "//" ? (n += t.slice(s, e), s = e, i = h, e++) : i === h && r + (m ?? _base.EMPTY_STRING) === `\r
|
|
38
|
-
` ? (e++, i = !1, n += o(t, s, e), s = e) : i === h && r === `
|
|
39
|
-
` ? (i = !1, n += o(t, s, e), s = e) : !i && r + (m ?? _base.EMPTY_STRING) === "/*" ? (n += t.slice(s, e), s = e, i = a, e++) : i === a && r + (m ?? _base.EMPTY_STRING) === "*/" ? (e++, i = !1, n += o(t, s, e + 1), s = e + 1) : c && !i && (l !== -1 ? r === "}" || r === "]" ? (n += t.slice(s, e), b += o(n, 0, 1) + n.slice(1), n = "", s = e, l = -1) : r !== " " && r !== " " && r !== "\r" && r !== `
|
|
40
|
-
` && (n += t.slice(s, e), s = e, l = -1) : r === "," && (b += n + t.slice(s, e), n = "", s = e, l = e)));
|
|
41
|
-
}
|
|
42
|
-
return b + n + (i ? o(t.slice(s)) : t.slice(s));
|
|
43
|
-
}
|
|
1
|
+
const e=require(`../strip-comments-BhdK_E8s.cjs`);exports.stripComments=e.t;
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`?(e++,i=!1,n+=o(t,s,e),s=e):i===h&&r===`
|
|
3
|
-
`?(i=!1,n+=o(t,s,e),s=e):!i&&r+(m??p)==="/*"?(n+=t.slice(s,e),s=e,i=a,e++):i===a&&r+(m??p)==="*/"?(e++,i=!1,n+=o(t,s,e+1),s=e+1):c&&!i&&(l!==-1?r==="}"||r==="]"?(n+=t.slice(s,e),b+=o(n,0,1)+n.slice(1),n="",s=e,l=-1):r!==" "&&r!==" "&&r!=="\r"&&r!==`
|
|
4
|
-
`&&(n+=t.slice(s,e),s=e,l=-1):r===","&&(b+=n+t.slice(s,e),n="",s=e,l=e)))}return b+n+(i?o(t.slice(s)):t.slice(s))}
|
|
1
|
+
import{t as e}from"../strip-comments-LcqiBhvo.mjs";export{e as stripComments};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
|
File without changes
|