@powerlines/deepkit 0.5.87 → 0.5.89
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/dist/{chunk-XTGDJ7HH.js → chunk-JPFSTX7K.js} +444 -238
- package/dist/{chunk-BRD4KKCQ.cjs → chunk-ZWL5JSVT.cjs} +444 -238
- package/dist/index.cjs +8 -8
- package/dist/index.js +1 -1
- package/dist/utilities.cjs +8 -8
- package/dist/utilities.js +1 -1
- package/package.json +8 -8
|
@@ -8,163 +8,261 @@ var isNull$1 = require('@stryke/type-checks/is-null');
|
|
|
8
8
|
var isString$1 = require('@stryke/type-checks/is-string');
|
|
9
9
|
var isUndefined$1 = require('@stryke/type-checks/is-undefined');
|
|
10
10
|
|
|
11
|
-
// ../../node_modules/.pnpm/@stryke+helpers@0.9.
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
for (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
return [...
|
|
11
|
+
// ../../node_modules/.pnpm/@stryke+helpers@0.9.36/node_modules/@stryke/helpers/dist/get-unique.mjs
|
|
12
|
+
function getUniqueBy(arr, mapper = (item) => item) {
|
|
13
|
+
const map = /* @__PURE__ */ new Map();
|
|
14
|
+
for (const item of arr) {
|
|
15
|
+
const key = mapper(item);
|
|
16
|
+
if (!map.has(key)) map.set(key, item);
|
|
17
|
+
}
|
|
18
|
+
return [...map.values()];
|
|
19
19
|
}
|
|
20
|
-
chunkUSNT2KNT_cjs.__name(
|
|
20
|
+
chunkUSNT2KNT_cjs.__name(getUniqueBy, "getUniqueBy");
|
|
21
21
|
|
|
22
|
-
// ../../node_modules/.pnpm/@stryke+json@0.9.
|
|
23
|
-
var
|
|
22
|
+
// ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/type-checks/src/get-object-tag.mjs
|
|
23
|
+
var getObjectTag = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((value) => {
|
|
24
|
+
if (value == null) return value === void 0 ? "[object Undefined]" : "[object Null]";
|
|
25
|
+
return Object.prototype.toString.call(value);
|
|
26
|
+
}, "getObjectTag");
|
|
24
27
|
|
|
25
|
-
// ../../node_modules/.pnpm/@stryke+json@0.9.
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
// ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/type-checks/src/is-plain-object.mjs
|
|
29
|
+
var isObjectLike = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((obj) => {
|
|
30
|
+
return typeof obj === "object" && obj !== null;
|
|
31
|
+
}, "isObjectLike");
|
|
32
|
+
var isPlainObject = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((obj) => {
|
|
33
|
+
if (!isObjectLike(obj) || getObjectTag(obj) !== "[object Object]") return false;
|
|
34
|
+
if (Object.getPrototypeOf(obj) === null) return true;
|
|
35
|
+
let proto = obj;
|
|
36
|
+
while (Object.getPrototypeOf(proto) !== null) proto = Object.getPrototypeOf(proto);
|
|
37
|
+
return Object.getPrototypeOf(obj) === proto;
|
|
38
|
+
}, "isPlainObject");
|
|
34
39
|
|
|
35
|
-
// ../../node_modules/.pnpm/@stryke+json@0.9.
|
|
36
|
-
var
|
|
40
|
+
// ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/type-checks/src/is-object.mjs
|
|
41
|
+
var isObject = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((value) => {
|
|
37
42
|
try {
|
|
38
|
-
return typeof
|
|
43
|
+
return typeof value === "object" || Boolean(value) && value?.constructor === Object || isPlainObject(value);
|
|
39
44
|
} catch {
|
|
40
45
|
return false;
|
|
41
46
|
}
|
|
42
|
-
}, "
|
|
47
|
+
}, "isObject");
|
|
43
48
|
|
|
44
|
-
// ../../node_modules/.pnpm/@stryke+json@0.9.
|
|
45
|
-
var
|
|
49
|
+
// ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/type-checks/src/is-string.mjs
|
|
50
|
+
var isString = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((value) => {
|
|
46
51
|
try {
|
|
47
|
-
return typeof
|
|
52
|
+
return typeof value === "string";
|
|
48
53
|
} catch {
|
|
49
54
|
return false;
|
|
50
55
|
}
|
|
51
|
-
}, "
|
|
56
|
+
}, "isString");
|
|
52
57
|
|
|
53
|
-
// ../../node_modules/.pnpm/@stryke+json@0.9.
|
|
54
|
-
var
|
|
58
|
+
// ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/types/src/base.mjs
|
|
59
|
+
var EMPTY_STRING = "";
|
|
55
60
|
|
|
56
|
-
// ../../node_modules/.pnpm/@stryke+json@0.9.
|
|
57
|
-
var
|
|
58
|
-
var
|
|
59
|
-
function
|
|
60
|
-
return
|
|
61
|
+
// ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/utils/strip-comments.mjs
|
|
62
|
+
var singleComment = Symbol("singleComment");
|
|
63
|
+
var multiComment = Symbol("multiComment");
|
|
64
|
+
function stripWithoutWhitespace() {
|
|
65
|
+
return "";
|
|
61
66
|
}
|
|
62
|
-
chunkUSNT2KNT_cjs.__name(
|
|
63
|
-
function
|
|
64
|
-
return
|
|
67
|
+
chunkUSNT2KNT_cjs.__name(stripWithoutWhitespace, "stripWithoutWhitespace");
|
|
68
|
+
function stripWithWhitespace(value, start, end) {
|
|
69
|
+
return value.slice(start, end).replace(/\S/g, " ");
|
|
65
70
|
}
|
|
66
|
-
chunkUSNT2KNT_cjs.__name(
|
|
67
|
-
function
|
|
68
|
-
let
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
chunkUSNT2KNT_cjs.__name(stripWithWhitespace, "stripWithWhitespace");
|
|
72
|
+
function isEscaped(value, quotePosition) {
|
|
73
|
+
let index = quotePosition - 1;
|
|
74
|
+
let backslashCount = 0;
|
|
75
|
+
while (value[index] === "\\") {
|
|
76
|
+
index -= 1;
|
|
77
|
+
backslashCount += 1;
|
|
78
|
+
}
|
|
79
|
+
return Boolean(backslashCount % 2);
|
|
71
80
|
}
|
|
72
|
-
chunkUSNT2KNT_cjs.__name(
|
|
73
|
-
function
|
|
74
|
-
if (typeof
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
chunkUSNT2KNT_cjs.__name(isEscaped, "isEscaped");
|
|
82
|
+
function stripComments(value, { whitespace = true, trailingCommas = false } = {}) {
|
|
83
|
+
if (typeof value !== "string") throw new TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof value}\``);
|
|
84
|
+
const strip = whitespace ? stripWithWhitespace : stripWithoutWhitespace;
|
|
85
|
+
let isInsideString = false;
|
|
86
|
+
let isInsideComment = false;
|
|
87
|
+
let offset = 0;
|
|
88
|
+
let buffer = "";
|
|
89
|
+
let result = "";
|
|
90
|
+
let commaIndex = -1;
|
|
91
|
+
for (let index = 0; index < value.length; index++) {
|
|
92
|
+
const currentCharacter = value[index];
|
|
93
|
+
const nextCharacter = value[index + 1];
|
|
94
|
+
if (!isInsideComment && currentCharacter === '"') {
|
|
95
|
+
if (!isEscaped(value, index)) isInsideString = !isInsideString;
|
|
96
|
+
}
|
|
97
|
+
if (isInsideString) continue;
|
|
98
|
+
if (!isInsideComment && currentCharacter + (nextCharacter ?? EMPTY_STRING) === "//") {
|
|
99
|
+
buffer += value.slice(offset, index);
|
|
100
|
+
offset = index;
|
|
101
|
+
isInsideComment = singleComment;
|
|
102
|
+
index++;
|
|
103
|
+
} else if (isInsideComment === singleComment && currentCharacter + (nextCharacter ?? EMPTY_STRING) === "\r\n") {
|
|
104
|
+
index++;
|
|
105
|
+
isInsideComment = false;
|
|
106
|
+
buffer += strip(value, offset, index);
|
|
107
|
+
offset = index;
|
|
108
|
+
} else if (isInsideComment === singleComment && currentCharacter === "\n") {
|
|
109
|
+
isInsideComment = false;
|
|
110
|
+
buffer += strip(value, offset, index);
|
|
111
|
+
offset = index;
|
|
112
|
+
} else if (!isInsideComment && currentCharacter + (nextCharacter ?? EMPTY_STRING) === "/*") {
|
|
113
|
+
buffer += value.slice(offset, index);
|
|
114
|
+
offset = index;
|
|
115
|
+
isInsideComment = multiComment;
|
|
116
|
+
index++;
|
|
117
|
+
} else if (isInsideComment === multiComment && currentCharacter + (nextCharacter ?? EMPTY_STRING) === "*/") {
|
|
118
|
+
index++;
|
|
119
|
+
isInsideComment = false;
|
|
120
|
+
buffer += strip(value, offset, index + 1);
|
|
121
|
+
offset = index + 1;
|
|
122
|
+
} else if (trailingCommas && !isInsideComment) {
|
|
123
|
+
if (commaIndex !== -1) {
|
|
124
|
+
if (currentCharacter === "}" || currentCharacter === "]") {
|
|
125
|
+
buffer += value.slice(offset, index);
|
|
126
|
+
result += strip(buffer, 0, 1) + buffer.slice(1);
|
|
127
|
+
buffer = "";
|
|
128
|
+
offset = index;
|
|
129
|
+
commaIndex = -1;
|
|
130
|
+
} else if (currentCharacter !== " " && currentCharacter !== " " && currentCharacter !== "\r" && currentCharacter !== "\n") {
|
|
131
|
+
buffer += value.slice(offset, index);
|
|
132
|
+
offset = index;
|
|
133
|
+
commaIndex = -1;
|
|
134
|
+
}
|
|
135
|
+
} else if (currentCharacter === ",") {
|
|
136
|
+
result += buffer + value.slice(offset, index);
|
|
137
|
+
buffer = "";
|
|
138
|
+
offset = index;
|
|
139
|
+
commaIndex = index;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return result + buffer + (isInsideComment ? strip(value.slice(offset)) : value.slice(offset));
|
|
84
144
|
}
|
|
85
|
-
chunkUSNT2KNT_cjs.__name(
|
|
145
|
+
chunkUSNT2KNT_cjs.__name(stripComments, "stripComments");
|
|
86
146
|
|
|
87
|
-
// ../../node_modules/.pnpm/@stryke+json@0.9.
|
|
88
|
-
var
|
|
89
|
-
var
|
|
90
|
-
var
|
|
91
|
-
function
|
|
92
|
-
if (
|
|
93
|
-
console.warn(`Dropping "${
|
|
147
|
+
// ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/utils/parse.mjs
|
|
148
|
+
var 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*:/;
|
|
149
|
+
var 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*:/;
|
|
150
|
+
var JsonSigRx = /^\s*["[{]|^\s*-?\d{1,16}(?:\.\d{1,17})?(?:E[+-]?\d+)?\s*$/i;
|
|
151
|
+
function jsonParseTransform(key, value) {
|
|
152
|
+
if (key === "__proto__" || key === "constructor" && value && typeof value === "object" && "prototype" in value) {
|
|
153
|
+
console.warn(`Dropping "${key}" key to prevent prototype pollution.`);
|
|
94
154
|
return;
|
|
95
155
|
}
|
|
96
|
-
return
|
|
156
|
+
return value;
|
|
97
157
|
}
|
|
98
|
-
chunkUSNT2KNT_cjs.__name(
|
|
99
|
-
function
|
|
100
|
-
if (typeof
|
|
101
|
-
let
|
|
102
|
-
if (
|
|
103
|
-
|
|
104
|
-
|
|
158
|
+
chunkUSNT2KNT_cjs.__name(jsonParseTransform, "jsonParseTransform");
|
|
159
|
+
function parse(value, options = {}) {
|
|
160
|
+
if (typeof value !== "string") return value;
|
|
161
|
+
let stripped = stripComments(value);
|
|
162
|
+
if (stripped[0] === '"' && stripped[stripped.length - 1] === '"' && !stripped.includes("\\")) return stripped.slice(1, -1);
|
|
163
|
+
stripped = stripped.trim();
|
|
164
|
+
if (stripped.length <= 9) switch (stripped.toLowerCase()) {
|
|
165
|
+
case "true":
|
|
105
166
|
return true;
|
|
106
|
-
case
|
|
167
|
+
case "false":
|
|
107
168
|
return false;
|
|
108
|
-
case
|
|
169
|
+
case "undefined":
|
|
109
170
|
return;
|
|
110
|
-
case
|
|
171
|
+
case "null":
|
|
111
172
|
return null;
|
|
112
|
-
case
|
|
173
|
+
case "nan":
|
|
113
174
|
return NaN;
|
|
114
|
-
case
|
|
115
|
-
return
|
|
116
|
-
case
|
|
117
|
-
return
|
|
175
|
+
case "infinity":
|
|
176
|
+
return Number.POSITIVE_INFINITY;
|
|
177
|
+
case "-infinity":
|
|
178
|
+
return Number.NEGATIVE_INFINITY;
|
|
118
179
|
}
|
|
119
|
-
if (!
|
|
120
|
-
if (
|
|
121
|
-
return
|
|
180
|
+
if (!JsonSigRx.test(stripped)) {
|
|
181
|
+
if (options.strict) throw new Error("Invalid JSON");
|
|
182
|
+
return stripped;
|
|
122
183
|
}
|
|
123
184
|
try {
|
|
124
|
-
if (
|
|
125
|
-
if (
|
|
126
|
-
return JSON.parse(
|
|
185
|
+
if (suspectProtoRx.test(stripped) || suspectConstructorRx.test(stripped)) {
|
|
186
|
+
if (options.strict) throw new Error("Possible prototype pollution");
|
|
187
|
+
return JSON.parse(stripped, jsonParseTransform);
|
|
127
188
|
}
|
|
128
|
-
return JSON.parse(
|
|
129
|
-
} catch (
|
|
130
|
-
if (
|
|
131
|
-
return
|
|
189
|
+
return JSON.parse(stripped);
|
|
190
|
+
} catch (error) {
|
|
191
|
+
if (options.strict) throw error;
|
|
192
|
+
return value;
|
|
132
193
|
}
|
|
133
194
|
}
|
|
134
|
-
chunkUSNT2KNT_cjs.__name(
|
|
195
|
+
chunkUSNT2KNT_cjs.__name(parse, "parse");
|
|
135
196
|
|
|
136
|
-
// ../../node_modules/.pnpm/@stryke+json@0.9.
|
|
137
|
-
var
|
|
138
|
-
function
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
197
|
+
// ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/utils/code-frames.mjs
|
|
198
|
+
var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
|
199
|
+
function getMarkerLines(loc, source, opts = {}) {
|
|
200
|
+
const startLoc = {
|
|
201
|
+
column: 0,
|
|
202
|
+
line: -1,
|
|
203
|
+
...loc.start
|
|
204
|
+
};
|
|
205
|
+
const endLoc = {
|
|
206
|
+
...startLoc,
|
|
207
|
+
...loc.end
|
|
208
|
+
};
|
|
209
|
+
const { linesAbove = 2, linesBelow = 3 } = opts || {};
|
|
210
|
+
const startLine = startLoc.line;
|
|
211
|
+
const startColumn = startLoc.column;
|
|
212
|
+
const endLine = endLoc.line;
|
|
213
|
+
const endColumn = endLoc.column;
|
|
214
|
+
let start = Math.max(startLine - (linesAbove + 1), 0);
|
|
215
|
+
let end = Math.min(source.length, endLine + linesBelow);
|
|
216
|
+
if (startLine === -1) start = 0;
|
|
217
|
+
if (endLine === -1) end = source.length;
|
|
218
|
+
const lineDiff = endLine - startLine;
|
|
219
|
+
const markerLines = {};
|
|
220
|
+
if (lineDiff) for (let i = 0; i <= lineDiff; i++) {
|
|
221
|
+
const lineNumber = i + startLine;
|
|
222
|
+
if (!startColumn) markerLines[lineNumber] = true;
|
|
223
|
+
else if (i === 0) markerLines[lineNumber] = [startColumn, (source[lineNumber - 1]?.length ?? 0) - startColumn + 1];
|
|
224
|
+
else if (i === lineDiff) markerLines[lineNumber] = [0, endColumn];
|
|
225
|
+
else markerLines[lineNumber] = [0, source[lineNumber - i]?.length ?? 0];
|
|
226
|
+
}
|
|
227
|
+
else if (startColumn === endColumn) markerLines[startLine] = startColumn ? [startColumn, 0] : true;
|
|
228
|
+
else markerLines[startLine] = [startColumn, endColumn - startColumn];
|
|
229
|
+
return {
|
|
230
|
+
start,
|
|
231
|
+
end,
|
|
232
|
+
markerLines
|
|
233
|
+
};
|
|
148
234
|
}
|
|
149
|
-
chunkUSNT2KNT_cjs.__name(
|
|
150
|
-
function
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
235
|
+
chunkUSNT2KNT_cjs.__name(getMarkerLines, "getMarkerLines");
|
|
236
|
+
function codeFrameColumns(rawLines, loc, opts = {}) {
|
|
237
|
+
const { start, end, markerLines } = getMarkerLines(loc, rawLines.split(NEWLINE), opts);
|
|
238
|
+
const numberMaxWidth = String(end).length;
|
|
239
|
+
return (opts.highlight ? opts.highlight(rawLines) : rawLines).split(NEWLINE).slice(start, end).map((line, index) => {
|
|
240
|
+
const number = start + 1 + index;
|
|
241
|
+
const gutter = ` ${` ${number}`.slice(-numberMaxWidth)} | `;
|
|
242
|
+
const hasMarker = Boolean(markerLines[number] ?? false);
|
|
243
|
+
if (hasMarker) {
|
|
244
|
+
let markerLine = "";
|
|
245
|
+
if (Array.isArray(hasMarker)) {
|
|
246
|
+
const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
|
|
247
|
+
const numberOfMarkers = hasMarker[1] || 1;
|
|
248
|
+
markerLine = [
|
|
249
|
+
"\n ",
|
|
250
|
+
gutter.replace(/\d/g, " "),
|
|
251
|
+
markerSpacing,
|
|
252
|
+
"^".repeat(numberOfMarkers)
|
|
253
|
+
].join("");
|
|
160
254
|
}
|
|
161
|
-
return [
|
|
255
|
+
return [
|
|
256
|
+
">",
|
|
257
|
+
gutter,
|
|
258
|
+
line,
|
|
259
|
+
markerLine
|
|
260
|
+
].join("");
|
|
162
261
|
}
|
|
163
|
-
return ` ${
|
|
164
|
-
}).join(
|
|
165
|
-
`);
|
|
262
|
+
return ` ${gutter}${line}`;
|
|
263
|
+
}).join("\n");
|
|
166
264
|
}
|
|
167
|
-
chunkUSNT2KNT_cjs.__name(
|
|
265
|
+
chunkUSNT2KNT_cjs.__name(codeFrameColumns, "codeFrameColumns");
|
|
168
266
|
|
|
169
267
|
// ../../node_modules/.pnpm/jsonc-parser@3.2.0/node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
170
268
|
function createScanner(text, ignoreTrivia = false) {
|
|
@@ -605,7 +703,7 @@ var ParseOptions;
|
|
|
605
703
|
allowTrailingComma: false
|
|
606
704
|
};
|
|
607
705
|
})(ParseOptions || (ParseOptions = {}));
|
|
608
|
-
function
|
|
706
|
+
function parse2(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
609
707
|
let currentProperty = null;
|
|
610
708
|
let currentParent = [];
|
|
611
709
|
const previousParents = [];
|
|
@@ -653,7 +751,7 @@ function parse(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
|
653
751
|
visit(text, visitor, options);
|
|
654
752
|
return currentParent[0];
|
|
655
753
|
}
|
|
656
|
-
chunkUSNT2KNT_cjs.__name(
|
|
754
|
+
chunkUSNT2KNT_cjs.__name(parse2, "parse");
|
|
657
755
|
function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
658
756
|
const _scanner = createScanner(text, false);
|
|
659
757
|
const _jsonPath = [];
|
|
@@ -984,7 +1082,7 @@ var SyntaxKind;
|
|
|
984
1082
|
SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
|
|
985
1083
|
SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
|
|
986
1084
|
})(SyntaxKind || (SyntaxKind = {}));
|
|
987
|
-
var
|
|
1085
|
+
var parse3 = parse2;
|
|
988
1086
|
var ParseErrorCode;
|
|
989
1087
|
(function(ParseErrorCode2) {
|
|
990
1088
|
ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
|
|
@@ -1104,58 +1202,107 @@ var LinesAndColumns = (
|
|
|
1104
1202
|
})()
|
|
1105
1203
|
);
|
|
1106
1204
|
|
|
1107
|
-
// ../../node_modules/.pnpm/@stryke+json@0.9.
|
|
1108
|
-
function
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1205
|
+
// ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/utils/parse-error.mjs
|
|
1206
|
+
function formatParseError(input, parseError) {
|
|
1207
|
+
const { error, offset, length } = parseError;
|
|
1208
|
+
const result = new LinesAndColumns(input).locationForIndex(offset);
|
|
1209
|
+
let line = result?.line ?? 0;
|
|
1210
|
+
let column = result?.column ?? 0;
|
|
1211
|
+
line++;
|
|
1212
|
+
column++;
|
|
1213
|
+
return `${printParseErrorCode(error)} in JSON at ${line}:${column}
|
|
1214
|
+
${codeFrameColumns(input, {
|
|
1215
|
+
start: {
|
|
1216
|
+
line,
|
|
1217
|
+
column
|
|
1218
|
+
},
|
|
1219
|
+
end: {
|
|
1220
|
+
line,
|
|
1221
|
+
column: column + length
|
|
1222
|
+
}
|
|
1223
|
+
})}
|
|
1112
1224
|
`;
|
|
1113
1225
|
}
|
|
1114
|
-
chunkUSNT2KNT_cjs.__name(
|
|
1226
|
+
chunkUSNT2KNT_cjs.__name(formatParseError, "formatParseError");
|
|
1115
1227
|
|
|
1116
|
-
// ../../node_modules/.pnpm/@stryke+json@0.9.
|
|
1117
|
-
var
|
|
1228
|
+
// ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/type-checks/src/is-number.mjs
|
|
1229
|
+
var isNumber = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((value) => {
|
|
1118
1230
|
try {
|
|
1119
|
-
return
|
|
1231
|
+
return value instanceof Number || typeof value === "number" || Number(value) === value;
|
|
1120
1232
|
} catch {
|
|
1121
1233
|
return false;
|
|
1122
1234
|
}
|
|
1123
|
-
}, "
|
|
1235
|
+
}, "isNumber");
|
|
1124
1236
|
|
|
1125
|
-
// ../../node_modules/.pnpm/@stryke+json@0.9.
|
|
1126
|
-
var
|
|
1237
|
+
// ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/type-checks/src/is-undefined.mjs
|
|
1238
|
+
var isUndefined = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((value) => {
|
|
1239
|
+
return value === void 0;
|
|
1240
|
+
}, "isUndefined");
|
|
1127
1241
|
|
|
1128
|
-
// ../../node_modules/.pnpm/@stryke+json@0.9.
|
|
1129
|
-
var
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1242
|
+
// ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/utils/stringify.mjs
|
|
1243
|
+
var invalidKeyChars = [
|
|
1244
|
+
"@",
|
|
1245
|
+
"/",
|
|
1246
|
+
"#",
|
|
1247
|
+
"$",
|
|
1248
|
+
" ",
|
|
1249
|
+
":",
|
|
1250
|
+
";",
|
|
1251
|
+
",",
|
|
1252
|
+
".",
|
|
1253
|
+
"!",
|
|
1254
|
+
"?",
|
|
1255
|
+
"&",
|
|
1256
|
+
"=",
|
|
1257
|
+
"+",
|
|
1258
|
+
"-",
|
|
1259
|
+
"*",
|
|
1260
|
+
"%",
|
|
1261
|
+
"^",
|
|
1262
|
+
"~",
|
|
1263
|
+
"|",
|
|
1264
|
+
"\\",
|
|
1265
|
+
'"',
|
|
1266
|
+
"'",
|
|
1267
|
+
"`",
|
|
1268
|
+
"{",
|
|
1269
|
+
"}",
|
|
1270
|
+
"[",
|
|
1271
|
+
"]",
|
|
1272
|
+
"(",
|
|
1273
|
+
")",
|
|
1274
|
+
"<",
|
|
1275
|
+
">"
|
|
1276
|
+
];
|
|
1277
|
+
var stringify = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((value, spacing = 2) => {
|
|
1278
|
+
const space = isNumber(spacing) ? " ".repeat(spacing) : spacing;
|
|
1279
|
+
switch (value) {
|
|
1133
1280
|
case null:
|
|
1134
|
-
return
|
|
1281
|
+
return "null";
|
|
1135
1282
|
case void 0:
|
|
1136
|
-
return
|
|
1283
|
+
return '"undefined"';
|
|
1137
1284
|
case true:
|
|
1138
|
-
return
|
|
1285
|
+
return "true";
|
|
1139
1286
|
case false:
|
|
1140
|
-
return
|
|
1141
|
-
case
|
|
1142
|
-
return
|
|
1143
|
-
case
|
|
1144
|
-
return
|
|
1145
|
-
}
|
|
1146
|
-
if (Array.isArray(
|
|
1147
|
-
if (
|
|
1148
|
-
switch (typeof
|
|
1149
|
-
case
|
|
1150
|
-
return `${
|
|
1151
|
-
case
|
|
1152
|
-
return JSON.stringify(
|
|
1153
|
-
case
|
|
1154
|
-
return `{${
|
|
1287
|
+
return "false";
|
|
1288
|
+
case Number.POSITIVE_INFINITY:
|
|
1289
|
+
return "infinity";
|
|
1290
|
+
case Number.NEGATIVE_INFINITY:
|
|
1291
|
+
return "-infinity";
|
|
1292
|
+
}
|
|
1293
|
+
if (Array.isArray(value)) return `[${space}${value.map((v) => stringify(v, space)).join(`,${space}`)}${space}]`;
|
|
1294
|
+
if (value instanceof Uint8Array) return value.toString();
|
|
1295
|
+
switch (typeof value) {
|
|
1296
|
+
case "number":
|
|
1297
|
+
return `${value}`;
|
|
1298
|
+
case "string":
|
|
1299
|
+
return JSON.stringify(value);
|
|
1300
|
+
case "object":
|
|
1301
|
+
return `{${space}${Object.keys(value).filter((key) => !isUndefined(value[key])).map((key) => `${invalidKeyChars.some((invalidKeyChar) => key.includes(invalidKeyChar)) ? `"${key}"` : key}: ${space}${stringify(value[key], space)}`).join(`,${space}`)}${space}}`;
|
|
1155
1302
|
default:
|
|
1156
|
-
return
|
|
1303
|
+
return "null";
|
|
1157
1304
|
}
|
|
1158
|
-
}, "
|
|
1305
|
+
}, "stringify");
|
|
1159
1306
|
|
|
1160
1307
|
// ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/double-indexed-kv.js
|
|
1161
1308
|
var DoubleIndexedKV = class {
|
|
@@ -1217,7 +1364,7 @@ var ClassRegistry = class extends Registry {
|
|
|
1217
1364
|
chunkUSNT2KNT_cjs.__name(this, "ClassRegistry");
|
|
1218
1365
|
}
|
|
1219
1366
|
constructor() {
|
|
1220
|
-
super((
|
|
1367
|
+
super((c) => c.name);
|
|
1221
1368
|
this.classToAllowedProps = /* @__PURE__ */ new Map();
|
|
1222
1369
|
}
|
|
1223
1370
|
register(value, options) {
|
|
@@ -1255,8 +1402,8 @@ function find(record, predicate) {
|
|
|
1255
1402
|
return values.find(predicate);
|
|
1256
1403
|
}
|
|
1257
1404
|
const valuesNotNever = values;
|
|
1258
|
-
for (let
|
|
1259
|
-
const value = valuesNotNever[
|
|
1405
|
+
for (let i = 0; i < valuesNotNever.length; i++) {
|
|
1406
|
+
const value = valuesNotNever[i];
|
|
1260
1407
|
if (predicate(value)) {
|
|
1261
1408
|
return value;
|
|
1262
1409
|
}
|
|
@@ -1273,8 +1420,8 @@ function includes(arr, value) {
|
|
|
1273
1420
|
}
|
|
1274
1421
|
chunkUSNT2KNT_cjs.__name(includes, "includes");
|
|
1275
1422
|
function findArr(record, predicate) {
|
|
1276
|
-
for (let
|
|
1277
|
-
const value = record[
|
|
1423
|
+
for (let i = 0; i < record.length; i++) {
|
|
1424
|
+
const value = record[i];
|
|
1278
1425
|
if (predicate(value)) {
|
|
1279
1426
|
return value;
|
|
1280
1427
|
}
|
|
@@ -1304,18 +1451,18 @@ var CustomTransformerRegistry = class {
|
|
|
1304
1451
|
|
|
1305
1452
|
// ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/is.js
|
|
1306
1453
|
var getType = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((payload) => Object.prototype.toString.call(payload).slice(8, -1), "getType");
|
|
1307
|
-
var
|
|
1454
|
+
var isUndefined2 = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((payload) => typeof payload === "undefined", "isUndefined");
|
|
1308
1455
|
var isNull = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((payload) => payload === null, "isNull");
|
|
1309
|
-
var
|
|
1456
|
+
var isPlainObject2 = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((payload) => {
|
|
1310
1457
|
if (typeof payload !== "object" || payload === null) return false;
|
|
1311
1458
|
if (payload === Object.prototype) return false;
|
|
1312
1459
|
if (Object.getPrototypeOf(payload) === null) return true;
|
|
1313
1460
|
return Object.getPrototypeOf(payload) === Object.prototype;
|
|
1314
1461
|
}, "isPlainObject");
|
|
1315
|
-
var isEmptyObject = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((payload) =>
|
|
1462
|
+
var isEmptyObject = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((payload) => isPlainObject2(payload) && Object.keys(payload).length === 0, "isEmptyObject");
|
|
1316
1463
|
var isArray = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((payload) => Array.isArray(payload), "isArray");
|
|
1317
|
-
var
|
|
1318
|
-
var
|
|
1464
|
+
var isString2 = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((payload) => typeof payload === "string", "isString");
|
|
1465
|
+
var isNumber2 = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((payload) => typeof payload === "number" && !isNaN(payload), "isNumber");
|
|
1319
1466
|
var isBoolean = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((payload) => typeof payload === "boolean", "isBoolean");
|
|
1320
1467
|
var isRegExp = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((payload) => payload instanceof RegExp, "isRegExp");
|
|
1321
1468
|
var isMap = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((payload) => payload instanceof Map, "isMap");
|
|
@@ -1324,7 +1471,7 @@ var isSymbol = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((payload) => getType(pay
|
|
|
1324
1471
|
var isDate = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((payload) => payload instanceof Date && !isNaN(payload.valueOf()), "isDate");
|
|
1325
1472
|
var isError = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((payload) => payload instanceof Error, "isError");
|
|
1326
1473
|
var isNaNValue = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((payload) => typeof payload === "number" && isNaN(payload), "isNaNValue");
|
|
1327
|
-
var isPrimitive = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((payload) => isBoolean(payload) || isNull(payload) ||
|
|
1474
|
+
var isPrimitive = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((payload) => isBoolean(payload) || isNull(payload) || isUndefined2(payload) || isNumber2(payload) || isString2(payload) || isSymbol(payload), "isPrimitive");
|
|
1328
1475
|
var isBigint = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((payload) => typeof payload === "bigint", "isBigint");
|
|
1329
1476
|
var isInfinite = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((payload) => payload === Infinity || payload === -Infinity, "isInfinite");
|
|
1330
1477
|
var isTypedArray = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((payload) => ArrayBuffer.isView(payload) && !(payload instanceof DataView), "isTypedArray");
|
|
@@ -1336,12 +1483,12 @@ var stringifyPath = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((path) => path.map(
|
|
|
1336
1483
|
var parsePath = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((string) => {
|
|
1337
1484
|
const result = [];
|
|
1338
1485
|
let segment = "";
|
|
1339
|
-
for (let
|
|
1340
|
-
let char = string.charAt(
|
|
1341
|
-
const isEscapedDot = char === "\\" && string.charAt(
|
|
1486
|
+
for (let i = 0; i < string.length; i++) {
|
|
1487
|
+
let char = string.charAt(i);
|
|
1488
|
+
const isEscapedDot = char === "\\" && string.charAt(i + 1) === ".";
|
|
1342
1489
|
if (isEscapedDot) {
|
|
1343
1490
|
segment += ".";
|
|
1344
|
-
|
|
1491
|
+
i++;
|
|
1345
1492
|
continue;
|
|
1346
1493
|
}
|
|
1347
1494
|
const isEndOfSegment = char === ".";
|
|
@@ -1368,7 +1515,7 @@ function simpleTransformation(isApplicable, annotation, transform, untransform)
|
|
|
1368
1515
|
}
|
|
1369
1516
|
chunkUSNT2KNT_cjs.__name(simpleTransformation, "simpleTransformation");
|
|
1370
1517
|
var simpleRules = [
|
|
1371
|
-
simpleTransformation(
|
|
1518
|
+
simpleTransformation(isUndefined2, "undefined", () => null, () => void 0),
|
|
1372
1519
|
simpleTransformation(isBigint, "bigint", (v) => v.toString(), (v) => {
|
|
1373
1520
|
if (typeof BigInt !== "undefined") {
|
|
1374
1521
|
return BigInt(v);
|
|
@@ -1387,13 +1534,13 @@ var simpleRules = [
|
|
|
1387
1534
|
});
|
|
1388
1535
|
return baseError;
|
|
1389
1536
|
}, (v, superJson) => {
|
|
1390
|
-
const
|
|
1391
|
-
|
|
1392
|
-
|
|
1537
|
+
const e = new Error(v.message);
|
|
1538
|
+
e.name = v.name;
|
|
1539
|
+
e.stack = v.stack;
|
|
1393
1540
|
superJson.allowedErrorProps.forEach((prop) => {
|
|
1394
|
-
|
|
1541
|
+
e[prop] = v[prop];
|
|
1395
1542
|
});
|
|
1396
|
-
return
|
|
1543
|
+
return e;
|
|
1397
1544
|
}),
|
|
1398
1545
|
simpleTransformation(isRegExp, "regexp", (v) => "" + v, (regex) => {
|
|
1399
1546
|
const body = regex.slice(1, regex.lastIndexOf("/"));
|
|
@@ -1449,8 +1596,8 @@ var symbolRule = compositeTransformation((s, superJson) => {
|
|
|
1449
1596
|
"symbol",
|
|
1450
1597
|
identifier
|
|
1451
1598
|
];
|
|
1452
|
-
}, (v) => v.description, (_,
|
|
1453
|
-
const value = superJson.symbolRegistry.getValue(
|
|
1599
|
+
}, (v) => v.description, (_, a, superJson) => {
|
|
1600
|
+
const value = superJson.symbolRegistry.getValue(a[1]);
|
|
1454
1601
|
if (!value) {
|
|
1455
1602
|
throw new Error("Trying to deserialize unknown symbol");
|
|
1456
1603
|
}
|
|
@@ -1475,8 +1622,8 @@ var typedArrayRule = compositeTransformation(isTypedArray, (v) => [
|
|
|
1475
1622
|
v.constructor.name
|
|
1476
1623
|
], (v) => [
|
|
1477
1624
|
...v
|
|
1478
|
-
], (v,
|
|
1479
|
-
const ctor = constructorToName[
|
|
1625
|
+
], (v, a) => {
|
|
1626
|
+
const ctor = constructorToName[a[1]];
|
|
1480
1627
|
if (!ctor) {
|
|
1481
1628
|
throw new Error("Trying to deserialize unknown typed array");
|
|
1482
1629
|
}
|
|
@@ -1508,10 +1655,10 @@ var classRule = compositeTransformation(isInstanceOfRegisteredClass, (clazz, sup
|
|
|
1508
1655
|
result[prop] = clazz[prop];
|
|
1509
1656
|
});
|
|
1510
1657
|
return result;
|
|
1511
|
-
}, (v,
|
|
1512
|
-
const clazz = superJson.classRegistry.getValue(
|
|
1658
|
+
}, (v, a, superJson) => {
|
|
1659
|
+
const clazz = superJson.classRegistry.getValue(a[1]);
|
|
1513
1660
|
if (!clazz) {
|
|
1514
|
-
throw new Error(`Trying to deserialize unknown class '${
|
|
1661
|
+
throw new Error(`Trying to deserialize unknown class '${a[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
|
|
1515
1662
|
}
|
|
1516
1663
|
return Object.assign(Object.create(clazz.prototype), v);
|
|
1517
1664
|
});
|
|
@@ -1526,8 +1673,8 @@ var customRule = compositeTransformation((value, superJson) => {
|
|
|
1526
1673
|
}, (value, superJson) => {
|
|
1527
1674
|
const transformer = superJson.customTransformerRegistry.findApplicable(value);
|
|
1528
1675
|
return transformer.serialize(value);
|
|
1529
|
-
}, (v,
|
|
1530
|
-
const transformer = superJson.customTransformerRegistry.findByName(
|
|
1676
|
+
}, (v, a, superJson) => {
|
|
1677
|
+
const transformer = superJson.customTransformerRegistry.findByName(a[1]);
|
|
1531
1678
|
if (!transformer) {
|
|
1532
1679
|
throw new Error("Trying to deserialize unknown custom value");
|
|
1533
1680
|
}
|
|
@@ -1584,12 +1731,12 @@ var untransformValue = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((json, type, sup
|
|
|
1584
1731
|
}, "untransformValue");
|
|
1585
1732
|
|
|
1586
1733
|
// ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/accessDeep.js
|
|
1587
|
-
var getNthKey = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((value,
|
|
1588
|
-
if (
|
|
1734
|
+
var getNthKey = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((value, n) => {
|
|
1735
|
+
if (n > value.size) throw new Error("index out of bounds");
|
|
1589
1736
|
const keys = value.keys();
|
|
1590
|
-
while (
|
|
1737
|
+
while (n > 0) {
|
|
1591
1738
|
keys.next();
|
|
1592
|
-
|
|
1739
|
+
n--;
|
|
1593
1740
|
}
|
|
1594
1741
|
return keys.next().value;
|
|
1595
1742
|
}, "getNthKey");
|
|
@@ -1607,13 +1754,13 @@ function validatePath(path) {
|
|
|
1607
1754
|
chunkUSNT2KNT_cjs.__name(validatePath, "validatePath");
|
|
1608
1755
|
var getDeep = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((object, path) => {
|
|
1609
1756
|
validatePath(path);
|
|
1610
|
-
for (let
|
|
1611
|
-
const key = path[
|
|
1757
|
+
for (let i = 0; i < path.length; i++) {
|
|
1758
|
+
const key = path[i];
|
|
1612
1759
|
if (isSet(object)) {
|
|
1613
1760
|
object = getNthKey(object, +key);
|
|
1614
1761
|
} else if (isMap(object)) {
|
|
1615
1762
|
const row = +key;
|
|
1616
|
-
const type = +path[++
|
|
1763
|
+
const type = +path[++i] === 0 ? "key" : "value";
|
|
1617
1764
|
const keyOfRow = getNthKey(object, row);
|
|
1618
1765
|
switch (type) {
|
|
1619
1766
|
case "key":
|
|
@@ -1635,23 +1782,23 @@ var setDeep = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((object, path, mapper) =>
|
|
|
1635
1782
|
return mapper(object);
|
|
1636
1783
|
}
|
|
1637
1784
|
let parent = object;
|
|
1638
|
-
for (let
|
|
1639
|
-
const key = path[
|
|
1785
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
1786
|
+
const key = path[i];
|
|
1640
1787
|
if (isArray(parent)) {
|
|
1641
1788
|
const index = +key;
|
|
1642
1789
|
parent = parent[index];
|
|
1643
|
-
} else if (
|
|
1790
|
+
} else if (isPlainObject2(parent)) {
|
|
1644
1791
|
parent = parent[key];
|
|
1645
1792
|
} else if (isSet(parent)) {
|
|
1646
1793
|
const row = +key;
|
|
1647
1794
|
parent = getNthKey(parent, row);
|
|
1648
1795
|
} else if (isMap(parent)) {
|
|
1649
|
-
const isEnd =
|
|
1796
|
+
const isEnd = i === path.length - 2;
|
|
1650
1797
|
if (isEnd) {
|
|
1651
1798
|
break;
|
|
1652
1799
|
}
|
|
1653
1800
|
const row = +key;
|
|
1654
|
-
const type = +path[++
|
|
1801
|
+
const type = +path[++i] === 0 ? "key" : "value";
|
|
1655
1802
|
const keyOfRow = getNthKey(parent, row);
|
|
1656
1803
|
switch (type) {
|
|
1657
1804
|
case "key":
|
|
@@ -1666,7 +1813,7 @@ var setDeep = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((object, path, mapper) =>
|
|
|
1666
1813
|
const lastKey = path[path.length - 1];
|
|
1667
1814
|
if (isArray(parent)) {
|
|
1668
1815
|
parent[+lastKey] = mapper(parent[+lastKey]);
|
|
1669
|
-
} else if (
|
|
1816
|
+
} else if (isPlainObject2(parent)) {
|
|
1670
1817
|
parent[lastKey] = mapper(parent[lastKey]);
|
|
1671
1818
|
}
|
|
1672
1819
|
if (isSet(parent)) {
|
|
@@ -1752,7 +1899,7 @@ function applyReferentialEqualityAnnotations(plain, annotations) {
|
|
|
1752
1899
|
return plain;
|
|
1753
1900
|
}
|
|
1754
1901
|
chunkUSNT2KNT_cjs.__name(applyReferentialEqualityAnnotations, "applyReferentialEqualityAnnotations");
|
|
1755
|
-
var isDeep = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((object, superJson) =>
|
|
1902
|
+
var isDeep = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((object, superJson) => isPlainObject2(object) || isArray(object) || isMap(object) || isSet(object) || isInstanceOfRegisteredClass(object, superJson), "isDeep");
|
|
1756
1903
|
function addIdentity(object, path, identities) {
|
|
1757
1904
|
const existingSet = identities.get(object);
|
|
1758
1905
|
if (existingSet) {
|
|
@@ -1772,7 +1919,7 @@ function generateReferentialEqualityAnnotations(identitites, dedupe) {
|
|
|
1772
1919
|
return;
|
|
1773
1920
|
}
|
|
1774
1921
|
if (!dedupe) {
|
|
1775
|
-
paths = paths.map((path) => path.map(String)).sort((
|
|
1922
|
+
paths = paths.map((path) => path.map(String)).sort((a, b) => a.length - b.length);
|
|
1776
1923
|
}
|
|
1777
1924
|
const [representativePath, ...identicalPaths] = paths;
|
|
1778
1925
|
if (representativePath.length === 0) {
|
|
@@ -1846,7 +1993,7 @@ var walker = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((object, identities, super
|
|
|
1846
1993
|
transformedValue[index] = recursiveResult.transformedValue;
|
|
1847
1994
|
if (isArray(recursiveResult.annotations)) {
|
|
1848
1995
|
innerAnnotations[index] = recursiveResult.annotations;
|
|
1849
|
-
} else if (
|
|
1996
|
+
} else if (isPlainObject2(recursiveResult.annotations)) {
|
|
1850
1997
|
forEach(recursiveResult.annotations, (tree, key) => {
|
|
1851
1998
|
innerAnnotations[escapeKey(index) + "." + key] = tree;
|
|
1852
1999
|
});
|
|
@@ -1879,24 +2026,24 @@ function isArray2(payload) {
|
|
|
1879
2026
|
return getType2(payload) === "Array";
|
|
1880
2027
|
}
|
|
1881
2028
|
chunkUSNT2KNT_cjs.__name(isArray2, "isArray");
|
|
1882
|
-
function
|
|
2029
|
+
function isPlainObject3(payload) {
|
|
1883
2030
|
if (getType2(payload) !== "Object") return false;
|
|
1884
2031
|
const prototype = Object.getPrototypeOf(payload);
|
|
1885
2032
|
return !!prototype && prototype.constructor === Object && prototype === Object.prototype;
|
|
1886
2033
|
}
|
|
1887
|
-
chunkUSNT2KNT_cjs.__name(
|
|
2034
|
+
chunkUSNT2KNT_cjs.__name(isPlainObject3, "isPlainObject");
|
|
1888
2035
|
function isNull2(payload) {
|
|
1889
2036
|
return getType2(payload) === "Null";
|
|
1890
2037
|
}
|
|
1891
2038
|
chunkUSNT2KNT_cjs.__name(isNull2, "isNull");
|
|
1892
|
-
function isOneOf(
|
|
1893
|
-
return (value) =>
|
|
2039
|
+
function isOneOf(a, b, c, d, e) {
|
|
2040
|
+
return (value) => a(value) || b(value) || !!c && c(value) || !!d && d(value) || !!e && e(value);
|
|
1894
2041
|
}
|
|
1895
2042
|
chunkUSNT2KNT_cjs.__name(isOneOf, "isOneOf");
|
|
1896
|
-
function
|
|
2043
|
+
function isUndefined3(payload) {
|
|
1897
2044
|
return getType2(payload) === "Undefined";
|
|
1898
2045
|
}
|
|
1899
|
-
chunkUSNT2KNT_cjs.__name(
|
|
2046
|
+
chunkUSNT2KNT_cjs.__name(isUndefined3, "isUndefined");
|
|
1900
2047
|
|
|
1901
2048
|
// ../../node_modules/.pnpm/copy-anything@3.0.5/node_modules/copy-anything/dist/index.js
|
|
1902
2049
|
function assignProp(carry, key, newVal, originalObject, includeNonenumerable) {
|
|
@@ -1916,7 +2063,7 @@ function copy(target, options = {}) {
|
|
|
1916
2063
|
if (isArray2(target)) {
|
|
1917
2064
|
return target.map((item) => copy(item, options));
|
|
1918
2065
|
}
|
|
1919
|
-
if (!
|
|
2066
|
+
if (!isPlainObject3(target)) {
|
|
1920
2067
|
return target;
|
|
1921
2068
|
}
|
|
1922
2069
|
const props = Object.getOwnPropertyNames(target);
|
|
@@ -2023,48 +2170,107 @@ SuperJSON.registerCustom;
|
|
|
2023
2170
|
SuperJSON.registerSymbol;
|
|
2024
2171
|
SuperJSON.allowErrorProps;
|
|
2025
2172
|
|
|
2026
|
-
// ../../node_modules/.pnpm/@stryke+json@0.9.
|
|
2027
|
-
var
|
|
2173
|
+
// ../../node_modules/.pnpm/@stryke+json@0.9.37/node_modules/@stryke/json/dist/storm-json.mjs
|
|
2174
|
+
var StormJSON = class StormJSON2 extends SuperJSON {
|
|
2028
2175
|
static {
|
|
2029
|
-
chunkUSNT2KNT_cjs.__name(this, "
|
|
2176
|
+
chunkUSNT2KNT_cjs.__name(this, "StormJSON");
|
|
2030
2177
|
}
|
|
2031
|
-
static #
|
|
2178
|
+
static #instance;
|
|
2032
2179
|
static get instance() {
|
|
2033
|
-
|
|
2180
|
+
if (!StormJSON2.#instance) StormJSON2.#instance = new StormJSON2();
|
|
2181
|
+
return StormJSON2.#instance;
|
|
2034
2182
|
}
|
|
2035
|
-
|
|
2036
|
-
|
|
2183
|
+
/**
|
|
2184
|
+
* Deserialize the given value with superjson using the given metadata
|
|
2185
|
+
*/
|
|
2186
|
+
static deserialize(payload) {
|
|
2187
|
+
return StormJSON2.instance.deserialize(payload);
|
|
2037
2188
|
}
|
|
2038
|
-
|
|
2039
|
-
|
|
2189
|
+
/**
|
|
2190
|
+
* Serialize the given value with superjson
|
|
2191
|
+
*/
|
|
2192
|
+
static serialize(object) {
|
|
2193
|
+
return StormJSON2.instance.serialize(object);
|
|
2040
2194
|
}
|
|
2041
|
-
|
|
2042
|
-
|
|
2195
|
+
/**
|
|
2196
|
+
* Parse the given string value with superjson using the given metadata
|
|
2197
|
+
*
|
|
2198
|
+
* @param value - The string value to parse
|
|
2199
|
+
* @returns The parsed data
|
|
2200
|
+
*/
|
|
2201
|
+
static parse(value) {
|
|
2202
|
+
return parse(value);
|
|
2043
2203
|
}
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2204
|
+
/**
|
|
2205
|
+
* Serializes the given data to a JSON string.
|
|
2206
|
+
* By default the JSON string is formatted with a 2 space indentation to be easy readable.
|
|
2207
|
+
*
|
|
2208
|
+
* @param value - Object which should be serialized to JSON
|
|
2209
|
+
* @param _options - JSON serialize options
|
|
2210
|
+
* @returns the formatted JSON representation of the object
|
|
2211
|
+
*/
|
|
2212
|
+
static stringify(value, _options) {
|
|
2213
|
+
const customTransformer = StormJSON2.instance.customTransformerRegistry.findApplicable(value);
|
|
2214
|
+
let result = value;
|
|
2215
|
+
if (customTransformer && customTransformer.isApplicable(value)) result = customTransformer.serialize(result);
|
|
2216
|
+
return stringify(result);
|
|
2047
2217
|
}
|
|
2048
|
-
|
|
2218
|
+
/**
|
|
2219
|
+
* Parses the given JSON string and returns the object the JSON content represents.
|
|
2220
|
+
* By default javascript-style comments and trailing commas are allowed.
|
|
2221
|
+
*
|
|
2222
|
+
* @param strData - JSON content as string
|
|
2223
|
+
* @param options - JSON parse options
|
|
2224
|
+
* @returns Object the JSON content represents
|
|
2225
|
+
*/
|
|
2226
|
+
static parseJson(strData, options) {
|
|
2049
2227
|
try {
|
|
2050
|
-
if (
|
|
2228
|
+
if (options?.expectComments === false) return StormJSON2.instance.parse(strData);
|
|
2051
2229
|
} catch {
|
|
2052
2230
|
}
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2231
|
+
const errors = [];
|
|
2232
|
+
const result = parse3(strData, errors, {
|
|
2233
|
+
allowTrailingComma: true,
|
|
2234
|
+
...options
|
|
2235
|
+
});
|
|
2236
|
+
if (errors.length > 0 && errors[0]) throw new Error(formatParseError(strData, errors[0]));
|
|
2237
|
+
return result;
|
|
2056
2238
|
}
|
|
2057
|
-
|
|
2058
|
-
|
|
2239
|
+
/**
|
|
2240
|
+
* Register a custom schema with superjson
|
|
2241
|
+
*
|
|
2242
|
+
* @param name - The name of the schema
|
|
2243
|
+
* @param serialize - The function to serialize the schema
|
|
2244
|
+
* @param deserialize - The function to deserialize the schema
|
|
2245
|
+
* @param isApplicable - The function to check if the schema is applicable
|
|
2246
|
+
*/
|
|
2247
|
+
static register(name, serialize2, deserialize2, isApplicable) {
|
|
2248
|
+
StormJSON2.instance.registerCustom({
|
|
2249
|
+
isApplicable,
|
|
2250
|
+
serialize: serialize2,
|
|
2251
|
+
deserialize: deserialize2
|
|
2252
|
+
}, name);
|
|
2059
2253
|
}
|
|
2060
|
-
|
|
2061
|
-
|
|
2254
|
+
/**
|
|
2255
|
+
* Register a class with superjson
|
|
2256
|
+
*
|
|
2257
|
+
* @param classConstructor - The class constructor to register
|
|
2258
|
+
*/
|
|
2259
|
+
static registerClass(classConstructor, options) {
|
|
2260
|
+
StormJSON2.instance.registerClass(classConstructor, {
|
|
2261
|
+
identifier: isString(options) ? options : options?.identifier || classConstructor.name,
|
|
2262
|
+
allowProps: options && isObject(options) && options?.allowProps && Array.isArray(options.allowProps) ? options.allowProps : ["__typename"]
|
|
2263
|
+
});
|
|
2062
2264
|
}
|
|
2063
2265
|
constructor() {
|
|
2064
2266
|
super({ dedupe: true });
|
|
2065
2267
|
}
|
|
2066
2268
|
};
|
|
2067
|
-
|
|
2269
|
+
StormJSON.instance.registerCustom({
|
|
2270
|
+
isApplicable: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((v) => buffer.Buffer.isBuffer(v), "isApplicable"),
|
|
2271
|
+
serialize: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((v) => v.toString("base64"), "serialize"),
|
|
2272
|
+
deserialize: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((v) => buffer.Buffer.from(v, "base64"), "deserialize")
|
|
2273
|
+
}, "Bytes");
|
|
2068
2274
|
function stringifyDefaultValue(property, value) {
|
|
2069
2275
|
return typeChecks.isSetObject(property) ? stringifyValue(property.type, value ?? property.getDefaultValue()) : stringifyValue({
|
|
2070
2276
|
kind: property
|
|
@@ -2076,14 +2282,14 @@ function stringifyStringValue(value) {
|
|
|
2076
2282
|
}
|
|
2077
2283
|
chunkUSNT2KNT_cjs.__name(stringifyStringValue, "stringifyStringValue");
|
|
2078
2284
|
function stringifyValue(type$1, value) {
|
|
2079
|
-
return isUndefined$1.isUndefined(value) ? "undefined" : isNull$1.isNull(value) ? "null" : type$1.kind === type.ReflectionKind.boolean ? String(value).trim().toLowerCase() === "true" ? "true" : "false" : type$1.kind === type.ReflectionKind.string || type$1.kind === type.ReflectionKind.literal && isString$1.isString(type$1.literal) ? stringifyStringValue(value) : type$1.kind === type.ReflectionKind.enum ? getEnumReflectionType(type$1).kind === type.ReflectionKind.string ? stringifyStringValue(value) : `${String(value)}` : type$1.kind === type.ReflectionKind.union ? isStringUnion(type$1) ? stringifyStringValue(value) : `${String(value)}` : type$1.kind === type.ReflectionKind.array ? stringifyStringValue(
|
|
2285
|
+
return isUndefined$1.isUndefined(value) ? "undefined" : isNull$1.isNull(value) ? "null" : type$1.kind === type.ReflectionKind.boolean ? String(value).trim().toLowerCase() === "true" ? "true" : "false" : type$1.kind === type.ReflectionKind.string || type$1.kind === type.ReflectionKind.literal && isString$1.isString(type$1.literal) ? stringifyStringValue(value) : type$1.kind === type.ReflectionKind.enum ? getEnumReflectionType(type$1).kind === type.ReflectionKind.string ? stringifyStringValue(value) : `${String(value)}` : type$1.kind === type.ReflectionKind.union ? isStringUnion(type$1) ? stringifyStringValue(value) : `${String(value)}` : type$1.kind === type.ReflectionKind.array ? stringifyStringValue(StormJSON.stringify(value)) : type$1.kind === type.ReflectionKind.object || type$1.kind === type.ReflectionKind.objectLiteral ? StormJSON.stringify(value) : type$1.kind === type.ReflectionKind.property || type$1.kind === type.ReflectionKind.parameter ? stringifyValue(type$1.type, value) : String(value)?.includes('"') || String(value)?.includes("'") ? stringifyStringValue(value) : String(value);
|
|
2080
2286
|
}
|
|
2081
2287
|
chunkUSNT2KNT_cjs.__name(stringifyValue, "stringifyValue");
|
|
2082
2288
|
function getEnumReflectionType(type$1) {
|
|
2083
2289
|
if (type$1.kind !== type.ReflectionKind.enum) {
|
|
2084
2290
|
throw new Error(`Expected a TypeEnum, but received ${type$1.kind}.`);
|
|
2085
2291
|
}
|
|
2086
|
-
const unique =
|
|
2292
|
+
const unique = getUniqueBy(type$1.values.filter((value) => value !== void 0 && value !== null), (enumMember) => isString$1.isString(enumMember) ? {
|
|
2087
2293
|
kind: type.ReflectionKind.string
|
|
2088
2294
|
} : {
|
|
2089
2295
|
kind: type.ReflectionKind.number
|
|
@@ -2100,7 +2306,7 @@ function getEnumReflectionType(type$1) {
|
|
|
2100
2306
|
chunkUSNT2KNT_cjs.__name(getEnumReflectionType, "getEnumReflectionType");
|
|
2101
2307
|
function getUnionTypes(type$1) {
|
|
2102
2308
|
if (type$1.kind === type.ReflectionKind.union && type$1.types.length > 0) {
|
|
2103
|
-
return
|
|
2309
|
+
return getUniqueBy(type$1.types, (member) => member.kind);
|
|
2104
2310
|
}
|
|
2105
2311
|
throw new Error(`Expected a TypeUnion, but received ${type$1.kind}.`);
|
|
2106
2312
|
}
|