@stryke/json 0.9.44 → 0.10.0
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 +7 -0
- package/dist/code-frames-BMkA9i6j.d.mts +17 -0
- package/dist/code-frames-BMkA9i6j.d.mts.map +1 -0
- package/dist/code-frames-BUtrssZ5.d.cts +17 -0
- package/dist/code-frames-BUtrssZ5.d.cts.map +1 -0
- package/dist/code-frames-Cv8r5tSN.cjs +82 -0
- package/dist/code-frames-DISWdYL6.mjs +77 -0
- package/dist/code-frames-DISWdYL6.mjs.map +1 -0
- package/dist/find-reference-BCg3dQx1.cjs +157 -0
- package/dist/find-reference-C-YleCds.d.cts +52 -0
- package/dist/find-reference-C-YleCds.d.cts.map +1 -0
- package/dist/find-reference-b7rRdLFx.d.mts +52 -0
- package/dist/find-reference-b7rRdLFx.d.mts.map +1 -0
- package/dist/find-reference-woYMiWzN.mjs +135 -0
- package/dist/find-reference-woYMiWzN.mjs.map +1 -0
- package/dist/index-B_e8BwCm.d.cts +1 -0
- package/dist/index-CDAfh8Ew.d.cts +1 -0
- package/dist/index-DwO9IdNa.d.mts +1 -0
- package/dist/index-VWno75SQ.d.mts +1 -0
- package/dist/index.cjs +32 -14
- package/dist/index.d.cts +11 -8
- package/dist/index.d.mts +12 -9
- package/dist/index.mjs +13 -8
- package/dist/is-number-BIwzZzyi.mjs +31 -0
- package/dist/is-number-BIwzZzyi.mjs.map +1 -0
- package/dist/is-number-c5xguIbS.cjs +42 -0
- package/dist/{type-checks/src/is-plain-object.mjs → is-object-BpfmzHWa.mjs} +19 -3
- package/dist/is-object-BpfmzHWa.mjs.map +1 -0
- package/dist/{type-checks/src/is-plain-object.cjs → is-object-umGh91v1.cjs} +24 -3
- package/dist/{type-checks/src/is-string.mjs → is-string-C2RK4Gjs.cjs} +7 -2
- package/dist/{type-checks/src/is-string.cjs → is-string-CLiBUSKV.mjs} +2 -2
- package/dist/is-string-CLiBUSKV.mjs.map +1 -0
- package/dist/{type-checks/src/is-undefined.cjs → is-undefined-CmyJWYGD.mjs} +2 -2
- package/dist/is-undefined-CmyJWYGD.mjs.map +1 -0
- package/dist/{type-checks/src/is-undefined.mjs → is-undefined-CnI0qe-z.cjs} +7 -2
- package/dist/parse-BGlhbY16.d.cts +9 -0
- package/dist/parse-BGlhbY16.d.cts.map +1 -0
- package/dist/parse-Crgv3Nl1.mjs +81 -0
- package/dist/parse-Crgv3Nl1.mjs.map +1 -0
- package/dist/parse-DZfi3d96.d.cts +51 -0
- package/dist/parse-DZfi3d96.d.cts.map +1 -0
- package/dist/parse-DgYW5BBj.d.mts +9 -0
- package/dist/parse-DgYW5BBj.d.mts.map +1 -0
- package/dist/parse-KiRakdIR.cjs +127 -0
- package/dist/parse-ZRTh45ZI.d.mts +51 -0
- package/dist/parse-ZRTh45ZI.d.mts.map +1 -0
- package/dist/parse-error-7K8s4vWf.d.cts +15 -0
- package/dist/parse-error-7K8s4vWf.d.cts.map +1 -0
- package/dist/parse-error-C3Qmubee.mjs +34 -0
- package/dist/parse-error-C3Qmubee.mjs.map +1 -0
- package/dist/parse-error-DY_MelEh.d.mts +15 -0
- package/dist/parse-error-DY_MelEh.d.mts.map +1 -0
- package/dist/parse-error-Dzwg4sdE.cjs +39 -0
- package/dist/parse-obdkJfj5.mjs +52 -0
- package/dist/parse-obdkJfj5.mjs.map +1 -0
- package/dist/parse-wxSDzBPf.cjs +62 -0
- package/dist/pointer/find-reference.cjs +5 -65
- package/dist/pointer/find-reference.d.cts +2 -52
- package/dist/pointer/find-reference.d.mts +2 -52
- package/dist/pointer/find-reference.mjs +2 -63
- package/dist/pointer/index.cjs +15 -14
- package/dist/pointer/index.d.cts +2 -2
- package/dist/pointer/index.d.mts +2 -2
- package/dist/pointer/index.mjs +3 -2
- package/dist/pointer/parse.cjs +9 -86
- package/dist/pointer/parse.d.cts +2 -44
- package/dist/pointer/parse.d.mts +2 -44
- package/dist/pointer/parse.mjs +2 -80
- package/dist/pointer-Cc7IR0Bj.cjs +0 -0
- package/dist/pointer-CiTXvh1G.mjs +0 -0
- package/dist/schema-B1RVJHzJ.d.cts +7 -0
- package/dist/schema-B1RVJHzJ.d.cts.map +1 -0
- package/dist/schema-CfhPLy30.mjs +9 -0
- package/dist/schema-CfhPLy30.mjs.map +1 -0
- package/dist/schema-D5Aqvh2i.cjs +14 -0
- package/dist/schema-ai_NU-JC.d.mts +7 -0
- package/dist/schema-ai_NU-JC.d.mts.map +1 -0
- package/dist/schema.cjs +3 -0
- package/dist/schema.d.cts +2 -0
- package/dist/schema.d.mts +3 -0
- package/dist/schema.mjs +3 -0
- package/dist/storm-json-6WpS7qnH.cjs +154 -0
- package/dist/storm-json-AaFeOao2.d.cts +70 -0
- package/dist/storm-json-AaFeOao2.d.cts.map +1 -0
- package/dist/storm-json-BvRkzAlR.d.mts +70 -0
- package/dist/storm-json-BvRkzAlR.d.mts.map +1 -0
- package/dist/storm-json-Cy3PuAhj.mjs +116 -0
- package/dist/storm-json-Cy3PuAhj.mjs.map +1 -0
- package/dist/storm-json.cjs +3 -116
- package/dist/storm-json.d.cts +2 -70
- package/dist/storm-json.d.mts +3 -70
- package/dist/storm-json.mjs +3 -115
- package/dist/stringify-B6iAeg0u.d.mts +13 -0
- package/dist/stringify-B6iAeg0u.d.mts.map +1 -0
- package/dist/stringify-Bc8OkhIr.d.cts +13 -0
- package/dist/stringify-Bc8OkhIr.d.cts.map +1 -0
- package/dist/stringify-D5baUfEe.mjs +68 -0
- package/dist/stringify-D5baUfEe.mjs.map +1 -0
- package/dist/stringify-DEw3S4_Z.cjs +78 -0
- package/dist/strip-comments-Bg3R_Y4S.d.mts +11 -0
- package/dist/strip-comments-Bg3R_Y4S.d.mts.map +1 -0
- package/dist/strip-comments-CMaAgTqz.mjs +89 -0
- package/dist/strip-comments-CMaAgTqz.mjs.map +1 -0
- package/dist/strip-comments-CtFoX0xG.cjs +94 -0
- package/dist/strip-comments-Cz_Wc25t.d.cts +11 -0
- package/dist/strip-comments-Cz_Wc25t.d.cts.map +1 -0
- package/dist/types-BUeTTE_U.d.cts +222 -0
- package/dist/types-BUeTTE_U.d.cts.map +1 -0
- package/dist/types-C_KlcCNw.d.mts +222 -0
- package/dist/types-C_KlcCNw.d.mts.map +1 -0
- package/dist/types.d.cts +2 -69
- package/dist/types.d.mts +2 -69
- package/dist/types.mjs +0 -1
- package/dist/utils/code-frames.cjs +2 -76
- package/dist/utils/code-frames.d.cts +2 -17
- package/dist/utils/code-frames.d.mts +2 -17
- package/dist/utils/code-frames.mjs +2 -76
- package/dist/utils/index.cjs +13 -12
- package/dist/utils/index.d.cts +5 -5
- package/dist/utils/index.d.mts +6 -5
- package/dist/utils/index.mjs +6 -5
- package/dist/utils/parse-error.cjs +2 -33
- package/dist/utils/parse-error.d.cts +2 -15
- package/dist/utils/parse-error.d.mts +2 -15
- package/dist/utils/parse-error.mjs +2 -33
- package/dist/utils/parse.cjs +3 -51
- package/dist/utils/parse.d.cts +2 -9
- package/dist/utils/parse.d.mts +2 -9
- package/dist/utils/parse.mjs +2 -51
- package/dist/utils/stringify.cjs +3 -67
- package/dist/utils/stringify.d.cts +2 -13
- package/dist/utils/stringify.d.mts +2 -13
- package/dist/utils/stringify.mjs +2 -67
- package/dist/utils/strip-comments.cjs +2 -85
- package/dist/utils/strip-comments.d.cts +2 -11
- package/dist/utils/strip-comments.d.mts +2 -11
- package/dist/utils/strip-comments.mjs +2 -86
- package/dist/utils-CVcIdLuL.mjs +0 -0
- package/dist/utils-Cz3OCwUK.cjs +0 -0
- package/package.json +7 -2
- package/dist/_virtual/rolldown_runtime.cjs +0 -29
- package/dist/pointer/find-reference.d.cts.map +0 -1
- package/dist/pointer/find-reference.d.mts.map +0 -1
- package/dist/pointer/find-reference.mjs.map +0 -1
- package/dist/pointer/parse.d.cts.map +0 -1
- package/dist/pointer/parse.d.mts.map +0 -1
- package/dist/pointer/parse.mjs.map +0 -1
- package/dist/storm-json.d.cts.map +0 -1
- package/dist/storm-json.d.mts.map +0 -1
- package/dist/storm-json.mjs.map +0 -1
- package/dist/type-checks/src/get-object-tag.cjs +0 -15
- package/dist/type-checks/src/get-object-tag.mjs +0 -15
- package/dist/type-checks/src/get-object-tag.mjs.map +0 -1
- package/dist/type-checks/src/is-empty.cjs +0 -20
- package/dist/type-checks/src/is-empty.mjs +0 -21
- package/dist/type-checks/src/is-empty.mjs.map +0 -1
- package/dist/type-checks/src/is-non-null-object.cjs +0 -16
- package/dist/type-checks/src/is-non-null-object.mjs +0 -17
- package/dist/type-checks/src/is-non-null-object.mjs.map +0 -1
- package/dist/type-checks/src/is-null.cjs +0 -12
- package/dist/type-checks/src/is-null.mjs +0 -12
- package/dist/type-checks/src/is-null.mjs.map +0 -1
- package/dist/type-checks/src/is-number.cjs +0 -18
- package/dist/type-checks/src/is-number.mjs +0 -18
- package/dist/type-checks/src/is-number.mjs.map +0 -1
- package/dist/type-checks/src/is-object.cjs +0 -19
- package/dist/type-checks/src/is-object.mjs +0 -20
- package/dist/type-checks/src/is-object.mjs.map +0 -1
- package/dist/type-checks/src/is-plain-object.mjs.map +0 -1
- package/dist/type-checks/src/is-set-object.cjs +0 -19
- package/dist/type-checks/src/is-set-object.mjs +0 -20
- package/dist/type-checks/src/is-set-object.mjs.map +0 -1
- package/dist/type-checks/src/is-set.cjs +0 -19
- package/dist/type-checks/src/is-set.mjs +0 -20
- package/dist/type-checks/src/is-set.mjs.map +0 -1
- package/dist/type-checks/src/is-string.mjs.map +0 -1
- package/dist/type-checks/src/is-undefined.mjs.map +0 -1
- package/dist/types/src/base.cjs +0 -6
- package/dist/types/src/base.mjs +0 -6
- package/dist/types/src/base.mjs.map +0 -1
- package/dist/types/src/json.d.cts +0 -12
- package/dist/types/src/json.d.cts.map +0 -1
- package/dist/types/src/json.d.mts +0 -12
- package/dist/types/src/json.d.mts.map +0 -1
- package/dist/types.d.cts.map +0 -1
- package/dist/types.d.mts.map +0 -1
- package/dist/utils/code-frames.d.cts.map +0 -1
- package/dist/utils/code-frames.d.mts.map +0 -1
- package/dist/utils/code-frames.mjs.map +0 -1
- package/dist/utils/parse-error.d.cts.map +0 -1
- package/dist/utils/parse-error.d.mts.map +0 -1
- package/dist/utils/parse-error.mjs.map +0 -1
- package/dist/utils/parse.d.cts.map +0 -1
- package/dist/utils/parse.d.mts.map +0 -1
- package/dist/utils/parse.mjs.map +0 -1
- package/dist/utils/stringify.d.cts.map +0 -1
- package/dist/utils/stringify.d.mts.map +0 -1
- package/dist/utils/stringify.mjs.map +0 -1
- package/dist/utils/strip-comments.d.cts.map +0 -1
- package/dist/utils/strip-comments.d.mts.map +0 -1
- package/dist/utils/strip-comments.mjs.map +0 -1
|
@@ -1,77 +1,3 @@
|
|
|
1
|
+
const require_code_frames = require('../code-frames-Cv8r5tSN.cjs');
|
|
1
2
|
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* RegExp to test for newlines in terminal.
|
|
5
|
-
*/
|
|
6
|
-
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
|
7
|
-
/**
|
|
8
|
-
* Extract what lines should be marked and highlighted.
|
|
9
|
-
*/
|
|
10
|
-
function getMarkerLines(loc, source, opts = {}) {
|
|
11
|
-
const startLoc = {
|
|
12
|
-
column: 0,
|
|
13
|
-
line: -1,
|
|
14
|
-
...loc.start
|
|
15
|
-
};
|
|
16
|
-
const endLoc = {
|
|
17
|
-
...startLoc,
|
|
18
|
-
...loc.end
|
|
19
|
-
};
|
|
20
|
-
const { linesAbove = 2, linesBelow = 3 } = opts || {};
|
|
21
|
-
const startLine = startLoc.line;
|
|
22
|
-
const startColumn = startLoc.column;
|
|
23
|
-
const endLine = endLoc.line;
|
|
24
|
-
const endColumn = endLoc.column;
|
|
25
|
-
let start = Math.max(startLine - (linesAbove + 1), 0);
|
|
26
|
-
let end = Math.min(source.length, endLine + linesBelow);
|
|
27
|
-
if (startLine === -1) start = 0;
|
|
28
|
-
if (endLine === -1) end = source.length;
|
|
29
|
-
const lineDiff = endLine - startLine;
|
|
30
|
-
const markerLines = {};
|
|
31
|
-
if (lineDiff) for (let i = 0; i <= lineDiff; i++) {
|
|
32
|
-
const lineNumber = i + startLine;
|
|
33
|
-
if (!startColumn) markerLines[lineNumber] = true;
|
|
34
|
-
else if (i === 0) markerLines[lineNumber] = [startColumn, (source[lineNumber - 1]?.length ?? 0) - startColumn + 1];
|
|
35
|
-
else if (i === lineDiff) markerLines[lineNumber] = [0, endColumn];
|
|
36
|
-
else markerLines[lineNumber] = [0, source[lineNumber - i]?.length ?? 0];
|
|
37
|
-
}
|
|
38
|
-
else if (startColumn === endColumn) markerLines[startLine] = startColumn ? [startColumn, 0] : true;
|
|
39
|
-
else markerLines[startLine] = [startColumn, endColumn - startColumn];
|
|
40
|
-
return {
|
|
41
|
-
start,
|
|
42
|
-
end,
|
|
43
|
-
markerLines
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
function codeFrameColumns(rawLines, loc, opts = {}) {
|
|
47
|
-
const { start, end, markerLines } = getMarkerLines(loc, rawLines.split(NEWLINE), opts);
|
|
48
|
-
const numberMaxWidth = String(end).length;
|
|
49
|
-
return (opts.highlight ? opts.highlight(rawLines) : rawLines).split(NEWLINE).slice(start, end).map((line, index) => {
|
|
50
|
-
const number = start + 1 + index;
|
|
51
|
-
const gutter = ` ${` ${number}`.slice(-numberMaxWidth)} | `;
|
|
52
|
-
const hasMarker = Boolean(markerLines[number] ?? false);
|
|
53
|
-
if (hasMarker) {
|
|
54
|
-
let markerLine = "";
|
|
55
|
-
if (Array.isArray(hasMarker)) {
|
|
56
|
-
const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
|
|
57
|
-
const numberOfMarkers = hasMarker[1] || 1;
|
|
58
|
-
markerLine = [
|
|
59
|
-
"\n ",
|
|
60
|
-
gutter.replace(/\d/g, " "),
|
|
61
|
-
markerSpacing,
|
|
62
|
-
"^".repeat(numberOfMarkers)
|
|
63
|
-
].join("");
|
|
64
|
-
}
|
|
65
|
-
return [
|
|
66
|
-
">",
|
|
67
|
-
gutter,
|
|
68
|
-
line,
|
|
69
|
-
markerLine
|
|
70
|
-
].join("");
|
|
71
|
-
}
|
|
72
|
-
return ` ${gutter}${line}`;
|
|
73
|
-
}).join("\n");
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
//#endregion
|
|
77
|
-
exports.codeFrameColumns = codeFrameColumns;
|
|
3
|
+
exports.codeFrameColumns = require_code_frames.codeFrameColumns;
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
column: number;
|
|
4
|
-
line: number;
|
|
5
|
-
}
|
|
6
|
-
interface NodeLocation {
|
|
7
|
-
end?: Location;
|
|
8
|
-
start?: Location;
|
|
9
|
-
}
|
|
10
|
-
declare function codeFrameColumns(rawLines: string, loc: NodeLocation, opts?: {
|
|
11
|
-
linesAbove?: number;
|
|
12
|
-
linesBelow?: number;
|
|
13
|
-
highlight?: (rawLines: string) => string;
|
|
14
|
-
}): string;
|
|
15
|
-
//#endregion
|
|
16
|
-
export { codeFrameColumns };
|
|
17
|
-
//# sourceMappingURL=code-frames.d.cts.map
|
|
1
|
+
import { t as codeFrameColumns } from "../code-frames-BUtrssZ5.cjs";
|
|
2
|
+
export { codeFrameColumns };
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
column: number;
|
|
4
|
-
line: number;
|
|
5
|
-
}
|
|
6
|
-
interface NodeLocation {
|
|
7
|
-
end?: Location;
|
|
8
|
-
start?: Location;
|
|
9
|
-
}
|
|
10
|
-
declare function codeFrameColumns(rawLines: string, loc: NodeLocation, opts?: {
|
|
11
|
-
linesAbove?: number;
|
|
12
|
-
linesBelow?: number;
|
|
13
|
-
highlight?: (rawLines: string) => string;
|
|
14
|
-
}): string;
|
|
15
|
-
//#endregion
|
|
16
|
-
export { codeFrameColumns };
|
|
17
|
-
//# sourceMappingURL=code-frames.d.mts.map
|
|
1
|
+
import { t as codeFrameColumns } from "../code-frames-BMkA9i6j.mjs";
|
|
2
|
+
export { codeFrameColumns };
|
|
@@ -1,77 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* RegExp to test for newlines in terminal.
|
|
4
|
-
*/
|
|
5
|
-
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
|
6
|
-
/**
|
|
7
|
-
* Extract what lines should be marked and highlighted.
|
|
8
|
-
*/
|
|
9
|
-
function getMarkerLines(loc, source, opts = {}) {
|
|
10
|
-
const startLoc = {
|
|
11
|
-
column: 0,
|
|
12
|
-
line: -1,
|
|
13
|
-
...loc.start
|
|
14
|
-
};
|
|
15
|
-
const endLoc = {
|
|
16
|
-
...startLoc,
|
|
17
|
-
...loc.end
|
|
18
|
-
};
|
|
19
|
-
const { linesAbove = 2, linesBelow = 3 } = opts || {};
|
|
20
|
-
const startLine = startLoc.line;
|
|
21
|
-
const startColumn = startLoc.column;
|
|
22
|
-
const endLine = endLoc.line;
|
|
23
|
-
const endColumn = endLoc.column;
|
|
24
|
-
let start = Math.max(startLine - (linesAbove + 1), 0);
|
|
25
|
-
let end = Math.min(source.length, endLine + linesBelow);
|
|
26
|
-
if (startLine === -1) start = 0;
|
|
27
|
-
if (endLine === -1) end = source.length;
|
|
28
|
-
const lineDiff = endLine - startLine;
|
|
29
|
-
const markerLines = {};
|
|
30
|
-
if (lineDiff) for (let i = 0; i <= lineDiff; i++) {
|
|
31
|
-
const lineNumber = i + startLine;
|
|
32
|
-
if (!startColumn) markerLines[lineNumber] = true;
|
|
33
|
-
else if (i === 0) markerLines[lineNumber] = [startColumn, (source[lineNumber - 1]?.length ?? 0) - startColumn + 1];
|
|
34
|
-
else if (i === lineDiff) markerLines[lineNumber] = [0, endColumn];
|
|
35
|
-
else markerLines[lineNumber] = [0, source[lineNumber - i]?.length ?? 0];
|
|
36
|
-
}
|
|
37
|
-
else if (startColumn === endColumn) markerLines[startLine] = startColumn ? [startColumn, 0] : true;
|
|
38
|
-
else markerLines[startLine] = [startColumn, endColumn - startColumn];
|
|
39
|
-
return {
|
|
40
|
-
start,
|
|
41
|
-
end,
|
|
42
|
-
markerLines
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
function codeFrameColumns(rawLines, loc, opts = {}) {
|
|
46
|
-
const { start, end, markerLines } = getMarkerLines(loc, rawLines.split(NEWLINE), opts);
|
|
47
|
-
const numberMaxWidth = String(end).length;
|
|
48
|
-
return (opts.highlight ? opts.highlight(rawLines) : rawLines).split(NEWLINE).slice(start, end).map((line, index) => {
|
|
49
|
-
const number = start + 1 + index;
|
|
50
|
-
const gutter = ` ${` ${number}`.slice(-numberMaxWidth)} | `;
|
|
51
|
-
const hasMarker = Boolean(markerLines[number] ?? false);
|
|
52
|
-
if (hasMarker) {
|
|
53
|
-
let markerLine = "";
|
|
54
|
-
if (Array.isArray(hasMarker)) {
|
|
55
|
-
const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
|
|
56
|
-
const numberOfMarkers = hasMarker[1] || 1;
|
|
57
|
-
markerLine = [
|
|
58
|
-
"\n ",
|
|
59
|
-
gutter.replace(/\d/g, " "),
|
|
60
|
-
markerSpacing,
|
|
61
|
-
"^".repeat(numberOfMarkers)
|
|
62
|
-
].join("");
|
|
63
|
-
}
|
|
64
|
-
return [
|
|
65
|
-
">",
|
|
66
|
-
gutter,
|
|
67
|
-
line,
|
|
68
|
-
markerLine
|
|
69
|
-
].join("");
|
|
70
|
-
}
|
|
71
|
-
return ` ${gutter}${line}`;
|
|
72
|
-
}).join("\n");
|
|
73
|
-
}
|
|
1
|
+
import { t as codeFrameColumns } from "../code-frames-DISWdYL6.mjs";
|
|
74
2
|
|
|
75
|
-
|
|
76
|
-
export { codeFrameColumns };
|
|
77
|
-
//# sourceMappingURL=code-frames.mjs.map
|
|
3
|
+
export { codeFrameColumns };
|
package/dist/utils/index.cjs
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
1
|
+
const require_strip_comments = require('../strip-comments-CtFoX0xG.cjs');
|
|
2
|
+
const require_parse = require('../parse-wxSDzBPf.cjs');
|
|
3
|
+
const require_code_frames = require('../code-frames-Cv8r5tSN.cjs');
|
|
4
|
+
const require_parse_error = require('../parse-error-Dzwg4sdE.cjs');
|
|
5
|
+
const require_stringify = require('../stringify-DEw3S4_Z.cjs');
|
|
6
|
+
require('../utils-Cz3OCwUK.cjs');
|
|
6
7
|
|
|
7
|
-
exports.codeFrameColumns =
|
|
8
|
-
exports.formatParseError =
|
|
9
|
-
exports.invalidKeyChars =
|
|
10
|
-
exports.parse =
|
|
11
|
-
exports.safeParse =
|
|
12
|
-
exports.stringify =
|
|
13
|
-
exports.stripComments =
|
|
8
|
+
exports.codeFrameColumns = require_code_frames.codeFrameColumns;
|
|
9
|
+
exports.formatParseError = require_parse_error.formatParseError;
|
|
10
|
+
exports.invalidKeyChars = require_stringify.invalidKeyChars;
|
|
11
|
+
exports.parse = require_parse.parse;
|
|
12
|
+
exports.safeParse = require_parse.safeParse;
|
|
13
|
+
exports.stringify = require_stringify.stringify;
|
|
14
|
+
exports.stripComments = require_strip_comments.stripComments;
|
package/dist/utils/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { codeFrameColumns } from "
|
|
2
|
-
import {
|
|
3
|
-
import { formatParseError } from "
|
|
4
|
-
import {
|
|
5
|
-
import { stripComments } from "
|
|
1
|
+
import { t as codeFrameColumns } from "../code-frames-BUtrssZ5.cjs";
|
|
2
|
+
import { n as parse, r as safeParse, t as Options } from "../parse-BGlhbY16.cjs";
|
|
3
|
+
import { t as formatParseError } from "../parse-error-7K8s4vWf.cjs";
|
|
4
|
+
import { n as stringify, t as invalidKeyChars } from "../stringify-Bc8OkhIr.cjs";
|
|
5
|
+
import { t as stripComments } from "../strip-comments-Cz_Wc25t.cjs";
|
|
6
6
|
export { Options, codeFrameColumns, formatParseError, invalidKeyChars, parse, safeParse, stringify, stripComments };
|
package/dist/utils/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { codeFrameColumns } from "
|
|
2
|
-
import {
|
|
3
|
-
import { formatParseError } from "
|
|
4
|
-
import {
|
|
5
|
-
import { stripComments } from "
|
|
1
|
+
import { t as codeFrameColumns } from "../code-frames-BMkA9i6j.mjs";
|
|
2
|
+
import { n as parse, r as safeParse, t as Options } from "../parse-DgYW5BBj.mjs";
|
|
3
|
+
import { t as formatParseError } from "../parse-error-DY_MelEh.mjs";
|
|
4
|
+
import { n as stringify, t as invalidKeyChars } from "../stringify-B6iAeg0u.mjs";
|
|
5
|
+
import { t as stripComments } from "../strip-comments-Bg3R_Y4S.mjs";
|
|
6
|
+
import "../index-VWno75SQ.mjs";
|
|
6
7
|
export { Options, codeFrameColumns, formatParseError, invalidKeyChars, parse, safeParse, stringify, stripComments };
|
package/dist/utils/index.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { stripComments } from "
|
|
2
|
-
import {
|
|
3
|
-
import { codeFrameColumns } from "
|
|
4
|
-
import { formatParseError } from "
|
|
5
|
-
import {
|
|
1
|
+
import { t as stripComments } from "../strip-comments-CMaAgTqz.mjs";
|
|
2
|
+
import { n as safeParse, t as parse } from "../parse-obdkJfj5.mjs";
|
|
3
|
+
import { t as codeFrameColumns } from "../code-frames-DISWdYL6.mjs";
|
|
4
|
+
import { t as formatParseError } from "../parse-error-C3Qmubee.mjs";
|
|
5
|
+
import { n as stringify, t as invalidKeyChars } from "../stringify-D5baUfEe.mjs";
|
|
6
|
+
import "../utils-CVcIdLuL.mjs";
|
|
6
7
|
|
|
7
8
|
export { codeFrameColumns, formatParseError, invalidKeyChars, parse, safeParse, stringify, stripComments };
|
|
@@ -1,34 +1,3 @@
|
|
|
1
|
-
const
|
|
2
|
-
const require_utils_code_frames = require('./code-frames.cjs');
|
|
3
|
-
let jsonc_parser = require("jsonc-parser");
|
|
4
|
-
let lines_and_columns = require("lines-and-columns");
|
|
1
|
+
const require_parse_error = require('../parse-error-Dzwg4sdE.cjs');
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Nicely formats a JSON error with context
|
|
9
|
-
*
|
|
10
|
-
* @param input - JSON content as string
|
|
11
|
-
* @param parseError - jsonc ParseError
|
|
12
|
-
* @returns
|
|
13
|
-
*/
|
|
14
|
-
function formatParseError(input, parseError) {
|
|
15
|
-
const { error, offset, length } = parseError;
|
|
16
|
-
const result = new lines_and_columns.LinesAndColumns(input).locationForIndex(offset);
|
|
17
|
-
let line = result?.line ?? 0;
|
|
18
|
-
let column = result?.column ?? 0;
|
|
19
|
-
line++;
|
|
20
|
-
column++;
|
|
21
|
-
return `${(0, jsonc_parser.printParseErrorCode)(error)} in JSON at ${line}:${column}\n${require_utils_code_frames.codeFrameColumns(input, {
|
|
22
|
-
start: {
|
|
23
|
-
line,
|
|
24
|
-
column
|
|
25
|
-
},
|
|
26
|
-
end: {
|
|
27
|
-
line,
|
|
28
|
-
column: column + length
|
|
29
|
-
}
|
|
30
|
-
})}\n`;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
//#endregion
|
|
34
|
-
exports.formatParseError = formatParseError;
|
|
3
|
+
exports.formatParseError = require_parse_error.formatParseError;
|
|
@@ -1,15 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
//#region src/utils/parse-error.d.ts
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Nicely formats a JSON error with context
|
|
7
|
-
*
|
|
8
|
-
* @param input - JSON content as string
|
|
9
|
-
* @param parseError - jsonc ParseError
|
|
10
|
-
* @returns
|
|
11
|
-
*/
|
|
12
|
-
declare function formatParseError(input: string, parseError: ParseError): string;
|
|
13
|
-
//#endregion
|
|
14
|
-
export { formatParseError };
|
|
15
|
-
//# sourceMappingURL=parse-error.d.cts.map
|
|
1
|
+
import { t as formatParseError } from "../parse-error-7K8s4vWf.cjs";
|
|
2
|
+
export { formatParseError };
|
|
@@ -1,15 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
//#region src/utils/parse-error.d.ts
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Nicely formats a JSON error with context
|
|
7
|
-
*
|
|
8
|
-
* @param input - JSON content as string
|
|
9
|
-
* @param parseError - jsonc ParseError
|
|
10
|
-
* @returns
|
|
11
|
-
*/
|
|
12
|
-
declare function formatParseError(input: string, parseError: ParseError): string;
|
|
13
|
-
//#endregion
|
|
14
|
-
export { formatParseError };
|
|
15
|
-
//# sourceMappingURL=parse-error.d.mts.map
|
|
1
|
+
import { t as formatParseError } from "../parse-error-DY_MelEh.mjs";
|
|
2
|
+
export { formatParseError };
|
|
@@ -1,34 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { printParseErrorCode } from "jsonc-parser";
|
|
3
|
-
import { LinesAndColumns } from "lines-and-columns";
|
|
1
|
+
import { t as formatParseError } from "../parse-error-C3Qmubee.mjs";
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Nicely formats a JSON error with context
|
|
8
|
-
*
|
|
9
|
-
* @param input - JSON content as string
|
|
10
|
-
* @param parseError - jsonc ParseError
|
|
11
|
-
* @returns
|
|
12
|
-
*/
|
|
13
|
-
function formatParseError(input, parseError) {
|
|
14
|
-
const { error, offset, length } = parseError;
|
|
15
|
-
const result = new LinesAndColumns(input).locationForIndex(offset);
|
|
16
|
-
let line = result?.line ?? 0;
|
|
17
|
-
let column = result?.column ?? 0;
|
|
18
|
-
line++;
|
|
19
|
-
column++;
|
|
20
|
-
return `${printParseErrorCode(error)} in JSON at ${line}:${column}\n${codeFrameColumns(input, {
|
|
21
|
-
start: {
|
|
22
|
-
line,
|
|
23
|
-
column
|
|
24
|
-
},
|
|
25
|
-
end: {
|
|
26
|
-
line,
|
|
27
|
-
column: column + length
|
|
28
|
-
}
|
|
29
|
-
})}\n`;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
//#endregion
|
|
33
|
-
export { formatParseError };
|
|
34
|
-
//# sourceMappingURL=parse-error.mjs.map
|
|
3
|
+
export { formatParseError };
|
package/dist/utils/parse.cjs
CHANGED
|
@@ -1,52 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_parse = require('../parse-wxSDzBPf.cjs');
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const suspectConstructorRx = /"(?: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*:/;
|
|
6
|
-
const JsonSigRx = /^\s*["[{]|^\s*-?\d{1,16}(?:\.\d{1,17})?(?:E[+-]?\d+)?\s*$/i;
|
|
7
|
-
function jsonParseTransform(key, value) {
|
|
8
|
-
if (key === "__proto__" || key === "constructor" && value && typeof value === "object" && "prototype" in value) {
|
|
9
|
-
console.warn(`Dropping "${key}" key to prevent prototype pollution.`);
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
return value;
|
|
13
|
-
}
|
|
14
|
-
function parse(value, options = {}) {
|
|
15
|
-
if (typeof value !== "string") return value;
|
|
16
|
-
let stripped = require_utils_strip_comments.stripComments(value);
|
|
17
|
-
if (stripped[0] === "\"" && stripped[stripped.length - 1] === "\"" && !stripped.includes("\\")) return stripped.slice(1, -1);
|
|
18
|
-
stripped = stripped.trim();
|
|
19
|
-
if (stripped.length <= 9) switch (stripped.toLowerCase()) {
|
|
20
|
-
case "true": return true;
|
|
21
|
-
case "false": return false;
|
|
22
|
-
case "undefined": return;
|
|
23
|
-
case "null": return null;
|
|
24
|
-
case "nan": return NaN;
|
|
25
|
-
case "infinity": return Number.POSITIVE_INFINITY;
|
|
26
|
-
case "-infinity": return Number.NEGATIVE_INFINITY;
|
|
27
|
-
}
|
|
28
|
-
if (!JsonSigRx.test(stripped)) {
|
|
29
|
-
if (options.strict) throw new Error("Invalid JSON");
|
|
30
|
-
return stripped;
|
|
31
|
-
}
|
|
32
|
-
try {
|
|
33
|
-
if (suspectProtoRx.test(stripped) || suspectConstructorRx.test(stripped)) {
|
|
34
|
-
if (options.strict) throw new Error("Possible prototype pollution");
|
|
35
|
-
return JSON.parse(stripped, jsonParseTransform);
|
|
36
|
-
}
|
|
37
|
-
return JSON.parse(stripped);
|
|
38
|
-
} catch (error) {
|
|
39
|
-
if (options.strict) throw error;
|
|
40
|
-
return value;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
function safeParse(value, options = {}) {
|
|
44
|
-
return parse(value, {
|
|
45
|
-
...options,
|
|
46
|
-
strict: true
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
//#endregion
|
|
51
|
-
exports.parse = parse;
|
|
52
|
-
exports.safeParse = safeParse;
|
|
3
|
+
exports.parse = require_parse.parse;
|
|
4
|
+
exports.safeParse = require_parse.safeParse;
|
package/dist/utils/parse.d.cts
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
strict?: boolean;
|
|
4
|
-
}
|
|
5
|
-
declare function parse<T = unknown>(value: any, options?: Options): T;
|
|
6
|
-
declare function safeParse<T = unknown>(value: any, options?: Options): T;
|
|
7
|
-
//#endregion
|
|
8
|
-
export { Options, parse, safeParse };
|
|
9
|
-
//# sourceMappingURL=parse.d.cts.map
|
|
1
|
+
import { n as parse, r as safeParse, t as Options } from "../parse-BGlhbY16.cjs";
|
|
2
|
+
export { Options, parse, safeParse };
|
package/dist/utils/parse.d.mts
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
strict?: boolean;
|
|
4
|
-
}
|
|
5
|
-
declare function parse<T = unknown>(value: any, options?: Options): T;
|
|
6
|
-
declare function safeParse<T = unknown>(value: any, options?: Options): T;
|
|
7
|
-
//#endregion
|
|
8
|
-
export { Options, parse, safeParse };
|
|
9
|
-
//# sourceMappingURL=parse.d.mts.map
|
|
1
|
+
import { n as parse, r as safeParse, t as Options } from "../parse-DgYW5BBj.mjs";
|
|
2
|
+
export { Options, parse, safeParse };
|
package/dist/utils/parse.mjs
CHANGED
|
@@ -1,52 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as safeParse, t as parse } from "../parse-obdkJfj5.mjs";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
const suspectProtoRx = /"(?:_|\\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*:/;
|
|
5
|
-
const suspectConstructorRx = /"(?: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*:/;
|
|
6
|
-
const JsonSigRx = /^\s*["[{]|^\s*-?\d{1,16}(?:\.\d{1,17})?(?:E[+-]?\d+)?\s*$/i;
|
|
7
|
-
function jsonParseTransform(key, value) {
|
|
8
|
-
if (key === "__proto__" || key === "constructor" && value && typeof value === "object" && "prototype" in value) {
|
|
9
|
-
console.warn(`Dropping "${key}" key to prevent prototype pollution.`);
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
return value;
|
|
13
|
-
}
|
|
14
|
-
function parse(value, options = {}) {
|
|
15
|
-
if (typeof value !== "string") return value;
|
|
16
|
-
let stripped = stripComments(value);
|
|
17
|
-
if (stripped[0] === "\"" && stripped[stripped.length - 1] === "\"" && !stripped.includes("\\")) return stripped.slice(1, -1);
|
|
18
|
-
stripped = stripped.trim();
|
|
19
|
-
if (stripped.length <= 9) switch (stripped.toLowerCase()) {
|
|
20
|
-
case "true": return true;
|
|
21
|
-
case "false": return false;
|
|
22
|
-
case "undefined": return;
|
|
23
|
-
case "null": return null;
|
|
24
|
-
case "nan": return NaN;
|
|
25
|
-
case "infinity": return Number.POSITIVE_INFINITY;
|
|
26
|
-
case "-infinity": return Number.NEGATIVE_INFINITY;
|
|
27
|
-
}
|
|
28
|
-
if (!JsonSigRx.test(stripped)) {
|
|
29
|
-
if (options.strict) throw new Error("Invalid JSON");
|
|
30
|
-
return stripped;
|
|
31
|
-
}
|
|
32
|
-
try {
|
|
33
|
-
if (suspectProtoRx.test(stripped) || suspectConstructorRx.test(stripped)) {
|
|
34
|
-
if (options.strict) throw new Error("Possible prototype pollution");
|
|
35
|
-
return JSON.parse(stripped, jsonParseTransform);
|
|
36
|
-
}
|
|
37
|
-
return JSON.parse(stripped);
|
|
38
|
-
} catch (error) {
|
|
39
|
-
if (options.strict) throw error;
|
|
40
|
-
return value;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
function safeParse(value, options = {}) {
|
|
44
|
-
return parse(value, {
|
|
45
|
-
...options,
|
|
46
|
-
strict: true
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
//#endregion
|
|
51
|
-
export { parse, safeParse };
|
|
52
|
-
//# sourceMappingURL=parse.mjs.map
|
|
3
|
+
export { parse, safeParse };
|
package/dist/utils/stringify.cjs
CHANGED
|
@@ -1,68 +1,4 @@
|
|
|
1
|
-
const
|
|
2
|
-
const require_is_undefined = require('../type-checks/src/is-undefined.cjs');
|
|
1
|
+
const require_stringify = require('../stringify-DEw3S4_Z.cjs');
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
"@",
|
|
7
|
-
"/",
|
|
8
|
-
"#",
|
|
9
|
-
"$",
|
|
10
|
-
" ",
|
|
11
|
-
":",
|
|
12
|
-
";",
|
|
13
|
-
",",
|
|
14
|
-
".",
|
|
15
|
-
"!",
|
|
16
|
-
"?",
|
|
17
|
-
"&",
|
|
18
|
-
"=",
|
|
19
|
-
"+",
|
|
20
|
-
"-",
|
|
21
|
-
"*",
|
|
22
|
-
"%",
|
|
23
|
-
"^",
|
|
24
|
-
"~",
|
|
25
|
-
"|",
|
|
26
|
-
"\\",
|
|
27
|
-
"\"",
|
|
28
|
-
"'",
|
|
29
|
-
"`",
|
|
30
|
-
"{",
|
|
31
|
-
"}",
|
|
32
|
-
"[",
|
|
33
|
-
"]",
|
|
34
|
-
"(",
|
|
35
|
-
")",
|
|
36
|
-
"<",
|
|
37
|
-
">"
|
|
38
|
-
];
|
|
39
|
-
/**
|
|
40
|
-
* Stringify a value to a JSON-like string.
|
|
41
|
-
*
|
|
42
|
-
* @param value - The value to stringify
|
|
43
|
-
* @param spacing - The spacing to use for the stringification
|
|
44
|
-
* @returns The stringified value
|
|
45
|
-
*/
|
|
46
|
-
const stringify = (value, spacing = 2) => {
|
|
47
|
-
const space = require_is_number.isNumber(spacing) ? " ".repeat(spacing) : spacing;
|
|
48
|
-
switch (value) {
|
|
49
|
-
case null: return "null";
|
|
50
|
-
case void 0: return "\"undefined\"";
|
|
51
|
-
case true: return "true";
|
|
52
|
-
case false: return "false";
|
|
53
|
-
case Number.POSITIVE_INFINITY: return "infinity";
|
|
54
|
-
case Number.NEGATIVE_INFINITY: return "-infinity";
|
|
55
|
-
}
|
|
56
|
-
if (Array.isArray(value)) return `[${space}${value.map((v) => stringify(v, space)).join(`,${space}`)}${space}]`;
|
|
57
|
-
if (value instanceof Uint8Array) return value.toString();
|
|
58
|
-
switch (typeof value) {
|
|
59
|
-
case "number": return `${value}`;
|
|
60
|
-
case "string": return JSON.stringify(value);
|
|
61
|
-
case "object": return `{${space}${Object.keys(value).filter((key) => !require_is_undefined.isUndefined(value[key])).map((key) => `${invalidKeyChars.some((invalidKeyChar) => key.includes(invalidKeyChar)) ? `"${key}"` : key}: ${space}${stringify(value[key], space)}`).join(`,${space}`)}${space}}`;
|
|
62
|
-
default: return "null";
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
//#endregion
|
|
67
|
-
exports.invalidKeyChars = invalidKeyChars;
|
|
68
|
-
exports.stringify = stringify;
|
|
3
|
+
exports.invalidKeyChars = require_stringify.invalidKeyChars;
|
|
4
|
+
exports.stringify = require_stringify.stringify;
|
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Stringify a value to a JSON-like string.
|
|
5
|
-
*
|
|
6
|
-
* @param value - The value to stringify
|
|
7
|
-
* @param spacing - The spacing to use for the stringification
|
|
8
|
-
* @returns The stringified value
|
|
9
|
-
*/
|
|
10
|
-
declare const stringify: (value: unknown, spacing?: string | number) => string;
|
|
11
|
-
//#endregion
|
|
12
|
-
export { invalidKeyChars, stringify };
|
|
13
|
-
//# sourceMappingURL=stringify.d.cts.map
|
|
1
|
+
import { n as stringify, t as invalidKeyChars } from "../stringify-Bc8OkhIr.cjs";
|
|
2
|
+
export { invalidKeyChars, stringify };
|
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Stringify a value to a JSON-like string.
|
|
5
|
-
*
|
|
6
|
-
* @param value - The value to stringify
|
|
7
|
-
* @param spacing - The spacing to use for the stringification
|
|
8
|
-
* @returns The stringified value
|
|
9
|
-
*/
|
|
10
|
-
declare const stringify: (value: unknown, spacing?: string | number) => string;
|
|
11
|
-
//#endregion
|
|
12
|
-
export { invalidKeyChars, stringify };
|
|
13
|
-
//# sourceMappingURL=stringify.d.mts.map
|
|
1
|
+
import { n as stringify, t as invalidKeyChars } from "../stringify-B6iAeg0u.mjs";
|
|
2
|
+
export { invalidKeyChars, stringify };
|