@stryke/capnp 0.12.32 → 0.12.41

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.
Files changed (139) hide show
  1. package/README.md +18 -9
  2. package/bin/capnpc.cjs +9 -8304
  3. package/bin/capnpc.d.cts +4 -2
  4. package/bin/capnpc.d.cts.map +1 -0
  5. package/bin/capnpc.d.mts +8 -0
  6. package/bin/capnpc.d.mts.map +1 -0
  7. package/bin/capnpc.mjs +11 -0
  8. package/bin/capnpc.mjs.map +1 -0
  9. package/dist/compile-DN7i0G3X.d.mts +40 -0
  10. package/dist/compile-DN7i0G3X.d.mts.map +1 -0
  11. package/dist/compile-DOMgXQRn.cjs +1 -0
  12. package/dist/compile-DccxA7WZ.d.cts +40 -0
  13. package/dist/compile-DccxA7WZ.d.cts.map +1 -0
  14. package/dist/compile-cQ918Wl_.mjs +2 -0
  15. package/dist/compile-cQ918Wl_.mjs.map +1 -0
  16. package/dist/compile.cjs +1 -11
  17. package/dist/compile.d.cts +3 -39
  18. package/dist/compile.d.mts +3 -0
  19. package/dist/compile.mjs +1 -0
  20. package/dist/dist-BzGdCkHS.cjs +1 -0
  21. package/dist/dist-CvDcvswe.mjs +2 -0
  22. package/dist/dist-CvDcvswe.mjs.map +1 -0
  23. package/dist/helpers-BIiGufva.cjs +6 -0
  24. package/dist/helpers-BYBeqv2d.mjs +7 -0
  25. package/dist/helpers-BYBeqv2d.mjs.map +1 -0
  26. package/dist/helpers.cjs +1 -7
  27. package/dist/helpers.d.cts +5 -4
  28. package/dist/helpers.d.cts.map +1 -0
  29. package/dist/{helpers.d.ts → helpers.d.mts} +5 -4
  30. package/dist/helpers.d.mts.map +1 -0
  31. package/dist/helpers.mjs +1 -0
  32. package/dist/index.cjs +1 -134
  33. package/dist/index.d.cts +4 -6
  34. package/dist/index.d.mts +4 -0
  35. package/dist/index.mjs +1 -0
  36. package/dist/rpc.cjs +1 -139
  37. package/dist/rpc.d.cts +62 -59
  38. package/dist/rpc.d.cts.map +1 -0
  39. package/dist/rpc.d.mts +74 -0
  40. package/dist/rpc.d.mts.map +1 -0
  41. package/dist/rpc.mjs +2 -0
  42. package/dist/rpc.mjs.map +1 -0
  43. package/dist/types-B2gKzfwi.cjs +1 -0
  44. package/dist/types-D52qMMoK.d.cts +55 -0
  45. package/dist/types-D52qMMoK.d.cts.map +1 -0
  46. package/dist/types-DBd3Wi0H.d.mts +55 -0
  47. package/dist/types-DBd3Wi0H.d.mts.map +1 -0
  48. package/dist/types-y_yfxLs5.mjs +2 -0
  49. package/dist/types-y_yfxLs5.mjs.map +1 -0
  50. package/dist/types.cjs +1 -7
  51. package/dist/types.d.cts +2 -53
  52. package/dist/types.d.mts +2 -0
  53. package/dist/types.mjs +1 -0
  54. package/package.json +42 -69
  55. package/schemas/cpp.cjs +1 -7
  56. package/schemas/cpp.d.cts +3 -1
  57. package/schemas/cpp.d.cts.map +1 -0
  58. package/schemas/cpp.d.mts +5 -0
  59. package/schemas/cpp.d.mts.map +1 -0
  60. package/schemas/cpp.mjs +2 -0
  61. package/schemas/cpp.mjs.map +1 -0
  62. package/schemas/index-CDymg4xL.d.mts +96 -0
  63. package/schemas/index-CDymg4xL.d.mts.map +1 -0
  64. package/schemas/index-b7dam4EA.d.cts +96 -0
  65. package/schemas/index-b7dam4EA.d.cts.map +1 -0
  66. package/schemas/persistent.cjs +1 -171
  67. package/schemas/persistent.d.cts +55 -55
  68. package/schemas/persistent.d.cts.map +1 -0
  69. package/schemas/{persistent.d.ts → persistent.d.mts} +55 -55
  70. package/schemas/persistent.d.mts.map +1 -0
  71. package/schemas/persistent.mjs +2 -0
  72. package/schemas/persistent.mjs.map +1 -0
  73. package/schemas/rpc-twoparty.cjs +1 -209
  74. package/schemas/rpc-twoparty.d.cts +76 -74
  75. package/schemas/rpc-twoparty.d.cts.map +1 -0
  76. package/schemas/{rpc-twoparty.d.ts → rpc-twoparty.d.mts} +76 -74
  77. package/schemas/rpc-twoparty.d.mts.map +1 -0
  78. package/schemas/rpc-twoparty.mjs +2 -0
  79. package/schemas/rpc-twoparty.mjs.map +1 -0
  80. package/schemas/rpc.cjs +1 -2563
  81. package/schemas/rpc.d.cts +749 -747
  82. package/schemas/rpc.d.cts.map +1 -0
  83. package/schemas/{rpc.d.ts → rpc.d.mts} +749 -747
  84. package/schemas/rpc.d.mts.map +1 -0
  85. package/schemas/rpc.mjs +2 -0
  86. package/schemas/rpc.mjs.map +1 -0
  87. package/schemas/schema.cjs +1 -2718
  88. package/schemas/schema.d.cts +984 -982
  89. package/schemas/schema.d.cts.map +1 -0
  90. package/schemas/schema.d.mts +1456 -0
  91. package/schemas/schema.d.mts.map +1 -0
  92. package/schemas/schema.mjs +2 -0
  93. package/schemas/schema.mjs.map +1 -0
  94. package/schemas/src-CtkguuVd.mjs +7 -0
  95. package/schemas/src-CtkguuVd.mjs.map +1 -0
  96. package/schemas/src-DqnIPdOg.cjs +6 -0
  97. package/schemas/ts.cjs +1 -7
  98. package/schemas/ts.d.cts +3 -1
  99. package/schemas/ts.d.cts.map +1 -0
  100. package/schemas/ts.d.mts +5 -0
  101. package/schemas/ts.d.mts.map +1 -0
  102. package/schemas/ts.mjs +2 -0
  103. package/schemas/ts.mjs.map +1 -0
  104. package/bin/capnpc.d.ts +0 -6
  105. package/bin/capnpc.js +0 -8273
  106. package/dist/chunk-CCU32X36.js +0 -15
  107. package/dist/chunk-GI42NGKQ.js +0 -3305
  108. package/dist/chunk-H32XGT26.js +0 -4107
  109. package/dist/chunk-JREA5Q77.js +0 -1082
  110. package/dist/chunk-KMCJ5MIQ.cjs +0 -3305
  111. package/dist/chunk-KO6NZLWH.cjs +0 -1082
  112. package/dist/chunk-LFP6TIPQ.cjs +0 -4760
  113. package/dist/chunk-NN62B5Z3.cjs +0 -4107
  114. package/dist/chunk-R2JXWA7Q.cjs +0 -15
  115. package/dist/chunk-SHUYVCID.js +0 -6
  116. package/dist/chunk-USNT2KNT.cjs +0 -6
  117. package/dist/chunk-ZIENMW4V.js +0 -4760
  118. package/dist/compile.d.ts +0 -39
  119. package/dist/compile.js +0 -11
  120. package/dist/helpers.js +0 -7
  121. package/dist/index.d.ts +0 -6
  122. package/dist/index.js +0 -134
  123. package/dist/rpc.d.ts +0 -71
  124. package/dist/rpc.js +0 -139
  125. package/dist/types.d.ts +0 -53
  126. package/dist/types.js +0 -7
  127. package/schemas/chunk-RNSYVJGA.cjs +0 -4700
  128. package/schemas/chunk-SHUYVCID.js +0 -6
  129. package/schemas/chunk-SW2MRW3B.js +0 -4700
  130. package/schemas/chunk-USNT2KNT.cjs +0 -6
  131. package/schemas/cpp.d.ts +0 -3
  132. package/schemas/cpp.js +0 -7
  133. package/schemas/persistent.js +0 -171
  134. package/schemas/rpc-twoparty.js +0 -209
  135. package/schemas/rpc.js +0 -2563
  136. package/schemas/schema.d.ts +0 -1454
  137. package/schemas/schema.js +0 -2718
  138. package/schemas/ts.d.ts +0 -3
  139. package/schemas/ts.js +0 -7
@@ -1,1082 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
-
3
- var _chunkUSNT2KNTcjs = require('./chunk-USNT2KNT.cjs');
4
-
5
- // src/helpers.ts
6
- var _console = require('@storm-software/config-tools/logger/console');
7
-
8
- // ../convert/src/to-array.ts
9
- function toArray(array) {
10
- array = _nullishCoalesce(array, () => ( []));
11
- return Array.isArray(array) ? array : [
12
- array
13
- ];
14
- }
15
- _chunkUSNT2KNTcjs.__name.call(void 0, toArray, "toArray");
16
-
17
- // ../fs/src/exists.ts
18
- var _fs = require('fs');
19
- var _promises = require('fs/promises');
20
- function existsSync(filePath) {
21
- return _fs.existsSync.call(void 0, filePath);
22
- }
23
- _chunkUSNT2KNTcjs.__name.call(void 0, existsSync, "existsSync");
24
-
25
- // ../type-checks/src/get-object-tag.ts
26
- var getObjectTag = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (value) => {
27
- if (value == null) {
28
- return value === void 0 ? "[object Undefined]" : "[object Null]";
29
- }
30
- return Object.prototype.toString.call(value);
31
- }, "getObjectTag");
32
-
33
- // ../type-checks/src/is-plain-object.ts
34
- var isObjectLike = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (obj) => {
35
- return typeof obj === "object" && obj !== null;
36
- }, "isObjectLike");
37
- var isPlainObject = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (obj) => {
38
- if (!isObjectLike(obj) || getObjectTag(obj) !== "[object Object]") {
39
- return false;
40
- }
41
- if (Object.getPrototypeOf(obj) === null) {
42
- return true;
43
- }
44
- let proto = obj;
45
- while (Object.getPrototypeOf(proto) !== null) {
46
- proto = Object.getPrototypeOf(proto);
47
- }
48
- return Object.getPrototypeOf(obj) === proto;
49
- }, "isPlainObject");
50
-
51
- // ../type-checks/src/is-object.ts
52
- var isObject = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (value) => {
53
- try {
54
- return typeof value === "object" || Boolean(value) && _optionalChain([value, 'optionalAccess', _ => _.constructor]) === Object || isPlainObject(value);
55
- } catch (e) {
56
- return false;
57
- }
58
- }, "isObject");
59
-
60
- // ../type-checks/src/is-string.ts
61
- var isString = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (value) => {
62
- try {
63
- return typeof value === "string";
64
- } catch (e2) {
65
- return false;
66
- }
67
- }, "isString");
68
-
69
- // ../json/src/storm-json.ts
70
- var _jsoncparser = require('jsonc-parser');
71
- var _buffer = require('buffer');
72
- var _superjson = require('superjson'); var _superjson2 = _interopRequireDefault(_superjson);
73
-
74
- // ../types/src/base.ts
75
- var EMPTY_STRING = "";
76
- var $NestedValue = Symbol("NestedValue");
77
-
78
- // ../json/src/utils/strip-comments.ts
79
- var singleComment = Symbol("singleComment");
80
- var multiComment = Symbol("multiComment");
81
- function stripWithoutWhitespace() {
82
- return "";
83
- }
84
- _chunkUSNT2KNTcjs.__name.call(void 0, stripWithoutWhitespace, "stripWithoutWhitespace");
85
- function stripWithWhitespace(value, start, end) {
86
- return value.slice(start, end).replace(/\S/g, " ");
87
- }
88
- _chunkUSNT2KNTcjs.__name.call(void 0, stripWithWhitespace, "stripWithWhitespace");
89
- function isEscaped(value, quotePosition) {
90
- let index = quotePosition - 1;
91
- let backslashCount = 0;
92
- while (value[index] === "\\") {
93
- index -= 1;
94
- backslashCount += 1;
95
- }
96
- return Boolean(backslashCount % 2);
97
- }
98
- _chunkUSNT2KNTcjs.__name.call(void 0, isEscaped, "isEscaped");
99
- function stripComments(value, { whitespace = true, trailingCommas = false } = {}) {
100
- if (typeof value !== "string") {
101
- throw new TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof value}\``);
102
- }
103
- const strip = whitespace ? stripWithWhitespace : stripWithoutWhitespace;
104
- let isInsideString = false;
105
- let isInsideComment = false;
106
- let offset = 0;
107
- let buffer = "";
108
- let result = "";
109
- let commaIndex = -1;
110
- for (let index = 0; index < value.length; index++) {
111
- const currentCharacter = value[index];
112
- const nextCharacter = value[index + 1];
113
- if (!isInsideComment && currentCharacter === '"') {
114
- const escaped = isEscaped(value, index);
115
- if (!escaped) {
116
- isInsideString = !isInsideString;
117
- }
118
- }
119
- if (isInsideString) {
120
- continue;
121
- }
122
- if (!isInsideComment && currentCharacter + (_nullishCoalesce(nextCharacter, () => ( EMPTY_STRING))) === "//") {
123
- buffer += value.slice(offset, index);
124
- offset = index;
125
- isInsideComment = singleComment;
126
- index++;
127
- } else if (isInsideComment === singleComment && currentCharacter + (_nullishCoalesce(nextCharacter, () => ( EMPTY_STRING))) === "\r\n") {
128
- index++;
129
- isInsideComment = false;
130
- buffer += strip(value, offset, index);
131
- offset = index;
132
- } else if (isInsideComment === singleComment && currentCharacter === "\n") {
133
- isInsideComment = false;
134
- buffer += strip(value, offset, index);
135
- offset = index;
136
- } else if (!isInsideComment && currentCharacter + (_nullishCoalesce(nextCharacter, () => ( EMPTY_STRING))) === "/*") {
137
- buffer += value.slice(offset, index);
138
- offset = index;
139
- isInsideComment = multiComment;
140
- index++;
141
- } else if (isInsideComment === multiComment && currentCharacter + (_nullishCoalesce(nextCharacter, () => ( EMPTY_STRING))) === "*/") {
142
- index++;
143
- isInsideComment = false;
144
- buffer += strip(value, offset, index + 1);
145
- offset = index + 1;
146
- } else if (trailingCommas && !isInsideComment) {
147
- if (commaIndex !== -1) {
148
- if (currentCharacter === "}" || currentCharacter === "]") {
149
- buffer += value.slice(offset, index);
150
- result += strip(buffer, 0, 1) + buffer.slice(1);
151
- buffer = "";
152
- offset = index;
153
- commaIndex = -1;
154
- } else if (currentCharacter !== " " && currentCharacter !== " " && currentCharacter !== "\r" && currentCharacter !== "\n") {
155
- buffer += value.slice(offset, index);
156
- offset = index;
157
- commaIndex = -1;
158
- }
159
- } else if (currentCharacter === ",") {
160
- result += buffer + value.slice(offset, index);
161
- buffer = "";
162
- offset = index;
163
- commaIndex = index;
164
- }
165
- }
166
- }
167
- return result + buffer + (isInsideComment ? strip(value.slice(offset)) : value.slice(offset));
168
- }
169
- _chunkUSNT2KNTcjs.__name.call(void 0, stripComments, "stripComments");
170
-
171
- // ../json/src/utils/parse.ts
172
- 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*:/;
173
- 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*:/;
174
- var JsonSigRx = /^\s*["[{]|^\s*-?\d{1,16}(?:\.\d{1,17})?(?:E[+-]?\d+)?\s*$/i;
175
- function jsonParseTransform(key, value) {
176
- if (key === "__proto__" || key === "constructor" && value && typeof value === "object" && "prototype" in value) {
177
- console.warn(`Dropping "${key}" key to prevent prototype pollution.`);
178
- return;
179
- }
180
- return value;
181
- }
182
- _chunkUSNT2KNTcjs.__name.call(void 0, jsonParseTransform, "jsonParseTransform");
183
- function parse(value, options = {}) {
184
- if (typeof value !== "string") {
185
- return value;
186
- }
187
- let stripped = stripComments(value);
188
- if (stripped[0] === '"' && stripped[stripped.length - 1] === '"' && !stripped.includes("\\")) {
189
- return stripped.slice(1, -1);
190
- }
191
- stripped = stripped.trim();
192
- if (stripped.length <= 9) {
193
- switch (stripped.toLowerCase()) {
194
- case "true": {
195
- return true;
196
- }
197
- case "false": {
198
- return false;
199
- }
200
- case "undefined": {
201
- return void 0;
202
- }
203
- case "null": {
204
- return null;
205
- }
206
- case "nan": {
207
- return Number.NaN;
208
- }
209
- case "infinity": {
210
- return Number.POSITIVE_INFINITY;
211
- }
212
- case "-infinity": {
213
- return Number.NEGATIVE_INFINITY;
214
- }
215
- }
216
- }
217
- if (!JsonSigRx.test(stripped)) {
218
- if (options.strict) {
219
- throw new Error("Invalid JSON");
220
- }
221
- return stripped;
222
- }
223
- try {
224
- if (suspectProtoRx.test(stripped) || suspectConstructorRx.test(stripped)) {
225
- if (options.strict) {
226
- throw new Error("Possible prototype pollution");
227
- }
228
- return JSON.parse(stripped, jsonParseTransform);
229
- }
230
- return JSON.parse(stripped);
231
- } catch (error) {
232
- if (options.strict) {
233
- throw error;
234
- }
235
- return value;
236
- }
237
- }
238
- _chunkUSNT2KNTcjs.__name.call(void 0, parse, "parse");
239
-
240
- // ../json/src/utils/parse-error.ts
241
-
242
- var _linesandcolumns = require('lines-and-columns');
243
-
244
- // ../json/src/utils/code-frames.ts
245
- var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
246
- function getMarkerLines(loc, source, opts = {}) {
247
- const startLoc = {
248
- column: 0,
249
- line: -1,
250
- ...loc.start
251
- };
252
- const endLoc = {
253
- ...startLoc,
254
- ...loc.end
255
- };
256
- const { linesAbove = 2, linesBelow = 3 } = opts || {};
257
- const startLine = startLoc.line;
258
- const startColumn = startLoc.column;
259
- const endLine = endLoc.line;
260
- const endColumn = endLoc.column;
261
- let start = Math.max(startLine - (linesAbove + 1), 0);
262
- let end = Math.min(source.length, endLine + linesBelow);
263
- if (startLine === -1) {
264
- start = 0;
265
- }
266
- if (endLine === -1) {
267
- end = source.length;
268
- }
269
- const lineDiff = endLine - startLine;
270
- const markerLines = {};
271
- if (lineDiff) {
272
- for (let i = 0; i <= lineDiff; i++) {
273
- const lineNumber = i + startLine;
274
- if (!startColumn) {
275
- markerLines[lineNumber] = true;
276
- } else if (i === 0) {
277
- const sourceLength = _nullishCoalesce(_optionalChain([source, 'access', _2 => _2[lineNumber - 1], 'optionalAccess', _3 => _3.length]), () => ( 0));
278
- markerLines[lineNumber] = [
279
- startColumn,
280
- sourceLength - startColumn + 1
281
- ];
282
- } else if (i === lineDiff) {
283
- markerLines[lineNumber] = [
284
- 0,
285
- endColumn
286
- ];
287
- } else {
288
- const sourceLength = _nullishCoalesce(_optionalChain([source, 'access', _4 => _4[lineNumber - i], 'optionalAccess', _5 => _5.length]), () => ( 0));
289
- markerLines[lineNumber] = [
290
- 0,
291
- sourceLength
292
- ];
293
- }
294
- }
295
- } else if (startColumn === endColumn) {
296
- markerLines[startLine] = startColumn ? [
297
- startColumn,
298
- 0
299
- ] : true;
300
- } else {
301
- markerLines[startLine] = [
302
- startColumn,
303
- endColumn - startColumn
304
- ];
305
- }
306
- return {
307
- start,
308
- end,
309
- markerLines
310
- };
311
- }
312
- _chunkUSNT2KNTcjs.__name.call(void 0, getMarkerLines, "getMarkerLines");
313
- function codeFrameColumns(rawLines, loc, opts = {}) {
314
- const lines = rawLines.split(NEWLINE);
315
- const { start, end, markerLines } = getMarkerLines(loc, lines, opts);
316
- const numberMaxWidth = String(end).length;
317
- const highlightedLines = opts.highlight ? opts.highlight(rawLines) : rawLines;
318
- const frame = highlightedLines.split(NEWLINE).slice(start, end).map((line, index) => {
319
- const number = start + 1 + index;
320
- const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
321
- const gutter = ` ${paddedNumber} | `;
322
- const hasMarker = Boolean(_nullishCoalesce(markerLines[number], () => ( false)));
323
- if (hasMarker) {
324
- let markerLine = "";
325
- if (Array.isArray(hasMarker)) {
326
- const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
327
- const numberOfMarkers = hasMarker[1] || 1;
328
- markerLine = [
329
- "\n ",
330
- gutter.replace(/\d/g, " "),
331
- markerSpacing,
332
- "^".repeat(numberOfMarkers)
333
- ].join("");
334
- }
335
- return [
336
- ">",
337
- gutter,
338
- line,
339
- markerLine
340
- ].join("");
341
- }
342
- return ` ${gutter}${line}`;
343
- }).join("\n");
344
- return frame;
345
- }
346
- _chunkUSNT2KNTcjs.__name.call(void 0, codeFrameColumns, "codeFrameColumns");
347
-
348
- // ../json/src/utils/parse-error.ts
349
- function formatParseError(input, parseError) {
350
- const { error, offset, length } = parseError;
351
- const result = new (0, _linesandcolumns.LinesAndColumns)(input).locationForIndex(offset);
352
- let line = _nullishCoalesce(_optionalChain([result, 'optionalAccess', _6 => _6.line]), () => ( 0));
353
- let column = _nullishCoalesce(_optionalChain([result, 'optionalAccess', _7 => _7.column]), () => ( 0));
354
- line++;
355
- column++;
356
- return `${_jsoncparser.printParseErrorCode.call(void 0, error)} in JSON at ${line}:${column}
357
- ${codeFrameColumns(input, {
358
- start: {
359
- line,
360
- column
361
- },
362
- end: {
363
- line,
364
- column: column + length
365
- }
366
- })}
367
- `;
368
- }
369
- _chunkUSNT2KNTcjs.__name.call(void 0, formatParseError, "formatParseError");
370
-
371
- // ../type-checks/src/is-number.ts
372
- var isNumber = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (value) => {
373
- try {
374
- return value instanceof Number || typeof value === "number" || Number(value) === value;
375
- } catch (e3) {
376
- return false;
377
- }
378
- }, "isNumber");
379
-
380
- // ../type-checks/src/is-undefined.ts
381
- var isUndefined = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (value) => {
382
- return value === void 0;
383
- }, "isUndefined");
384
-
385
- // ../json/src/utils/stringify.ts
386
- var invalidKeyChars = [
387
- "@",
388
- "/",
389
- "#",
390
- "$",
391
- " ",
392
- ":",
393
- ";",
394
- ",",
395
- ".",
396
- "!",
397
- "?",
398
- "&",
399
- "=",
400
- "+",
401
- "-",
402
- "*",
403
- "%",
404
- "^",
405
- "~",
406
- "|",
407
- "\\",
408
- '"',
409
- "'",
410
- "`",
411
- "{",
412
- "}",
413
- "[",
414
- "]",
415
- "(",
416
- ")",
417
- "<",
418
- ">"
419
- ];
420
- var stringify = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (value, spacing = 2) => {
421
- const space = isNumber(spacing) ? " ".repeat(spacing) : spacing;
422
- switch (value) {
423
- case null: {
424
- return "null";
425
- }
426
- case void 0: {
427
- return '"undefined"';
428
- }
429
- case true: {
430
- return "true";
431
- }
432
- case false: {
433
- return "false";
434
- }
435
- case Number.POSITIVE_INFINITY: {
436
- return "infinity";
437
- }
438
- case Number.NEGATIVE_INFINITY: {
439
- return "-infinity";
440
- }
441
- }
442
- if (Array.isArray(value)) {
443
- return `[${space}${value.map((v) => stringify(v, space)).join(`,${space}`)}${space}]`;
444
- }
445
- if (value instanceof Uint8Array) {
446
- return value.toString();
447
- }
448
- switch (typeof value) {
449
- case "number": {
450
- return `${value}`;
451
- }
452
- case "string": {
453
- return JSON.stringify(value);
454
- }
455
- case "object": {
456
- const keys = Object.keys(value).filter((key) => !isUndefined(value[key]));
457
- return `{${space}${keys.map((key) => `${invalidKeyChars.some((invalidKeyChar) => key.includes(invalidKeyChar)) ? `"${key}"` : key}: ${space}${stringify(value[key], space)}`).join(`,${space}`)}${space}}`;
458
- }
459
- default:
460
- return "null";
461
- }
462
- }, "stringify");
463
-
464
- // ../json/src/storm-json.ts
465
- var StormJSON = class _StormJSON extends _superjson2.default {
466
- static {
467
- _chunkUSNT2KNTcjs.__name.call(void 0, this, "StormJSON");
468
- }
469
- static #instance;
470
- static get instance() {
471
- if (!_StormJSON.#instance) {
472
- _StormJSON.#instance = new _StormJSON();
473
- }
474
- return _StormJSON.#instance;
475
- }
476
- /**
477
- * Deserialize the given value with superjson using the given metadata
478
- */
479
- static deserialize(payload) {
480
- return _StormJSON.instance.deserialize(payload);
481
- }
482
- /**
483
- * Serialize the given value with superjson
484
- */
485
- static serialize(object) {
486
- return _StormJSON.instance.serialize(object);
487
- }
488
- /**
489
- * Parse the given string value with superjson using the given metadata
490
- *
491
- * @param value - The string value to parse
492
- * @returns The parsed data
493
- */
494
- static parse(value) {
495
- return parse(value);
496
- }
497
- /**
498
- * Serializes the given data to a JSON string.
499
- * By default the JSON string is formatted with a 2 space indentation to be easy readable.
500
- *
501
- * @param value - Object which should be serialized to JSON
502
- * @param _options - JSON serialize options
503
- * @returns the formatted JSON representation of the object
504
- */
505
- static stringify(value, _options) {
506
- const customTransformer = _StormJSON.instance.customTransformerRegistry.findApplicable(value);
507
- let result = value;
508
- if (customTransformer && customTransformer.isApplicable(value)) {
509
- result = customTransformer.serialize(result);
510
- }
511
- return stringify(result);
512
- }
513
- /**
514
- * Parses the given JSON string and returns the object the JSON content represents.
515
- * By default javascript-style comments and trailing commas are allowed.
516
- *
517
- * @param strData - JSON content as string
518
- * @param options - JSON parse options
519
- * @returns Object the JSON content represents
520
- */
521
- static parseJson(strData, options) {
522
- try {
523
- if (_optionalChain([options, 'optionalAccess', _8 => _8.expectComments]) === false) {
524
- return _StormJSON.instance.parse(strData);
525
- }
526
- } catch (e4) {
527
- }
528
- const errors = [];
529
- const opts = {
530
- allowTrailingComma: true,
531
- ...options
532
- };
533
- const result = _jsoncparser.parse.call(void 0, strData, errors, opts);
534
- if (errors.length > 0 && errors[0]) {
535
- throw new Error(formatParseError(strData, errors[0]));
536
- }
537
- return result;
538
- }
539
- /**
540
- * Register a custom schema with superjson
541
- *
542
- * @param name - The name of the schema
543
- * @param serialize - The function to serialize the schema
544
- * @param deserialize - The function to deserialize the schema
545
- * @param isApplicable - The function to check if the schema is applicable
546
- */
547
- static register(name, serialize, deserialize, isApplicable) {
548
- _StormJSON.instance.registerCustom({
549
- isApplicable,
550
- serialize,
551
- deserialize
552
- }, name);
553
- }
554
- /**
555
- * Register a class with superjson
556
- *
557
- * @param classConstructor - The class constructor to register
558
- */
559
- static registerClass(classConstructor, options) {
560
- _StormJSON.instance.registerClass(classConstructor, {
561
- identifier: isString(options) ? options : _optionalChain([options, 'optionalAccess', _9 => _9.identifier]) || classConstructor.name,
562
- allowProps: options && isObject(options) && _optionalChain([options, 'optionalAccess', _10 => _10.allowProps]) && Array.isArray(options.allowProps) ? options.allowProps : [
563
- "__typename"
564
- ]
565
- });
566
- }
567
- constructor() {
568
- super({
569
- dedupe: true
570
- });
571
- }
572
- };
573
- StormJSON.instance.registerCustom({
574
- isApplicable: /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (v) => _buffer.Buffer.isBuffer(v), "isApplicable"),
575
- serialize: /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (v) => v.toString("base64"), "serialize"),
576
- deserialize: /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (v) => _buffer.Buffer.from(v, "base64"), "deserialize")
577
- }, "Bytes");
578
-
579
- // ../type-checks/src/is-error.ts
580
- var isError = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (obj) => {
581
- if (!isObject(obj)) {
582
- return false;
583
- }
584
- const tag = getObjectTag(obj);
585
- return tag === "[object Error]" || tag === "[object DOMException]" || typeof _optionalChain([obj, 'optionalAccess', _11 => _11.message]) === "string" && typeof _optionalChain([obj, 'optionalAccess', _12 => _12.name]) === "string" && !isPlainObject(obj);
586
- }, "isError");
587
-
588
- // ../fs/src/read-file.ts
589
-
590
-
591
- var readFile = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async (filePath) => {
592
- if (!filePath) {
593
- throw new Error("No file path provided to read data");
594
- }
595
- return _promises.readFile.call(void 0, filePath, {
596
- encoding: "utf8"
597
- });
598
- }, "readFile");
599
-
600
- // ../path/src/cwd.ts
601
- function cwd() {
602
- if (typeof process !== "undefined" && typeof process.cwd === "function") {
603
- return process.cwd().replace(/\\/g, "/");
604
- }
605
- return "/";
606
- }
607
- _chunkUSNT2KNTcjs.__name.call(void 0, cwd, "cwd");
608
-
609
- // ../path/src/regex.ts
610
- var DRIVE_LETTER_START_REGEX = /^[A-Z]:\//i;
611
- var DRIVE_LETTER_REGEX = /^[A-Z]:$/i;
612
- var UNC_REGEX = /^[/\\]{2}/;
613
- var ABSOLUTE_PATH_REGEX = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^~[/\\]|^[A-Z]:[/\\]/i;
614
- var ROOT_FOLDER_REGEX = /^\/([A-Z]:)?$/i;
615
- var FILE_EXTENSION_REGEX = /\.[0-9a-z]+$/i;
616
-
617
- // ../path/src/is-type.ts
618
- function isAbsolutePath(path) {
619
- return ABSOLUTE_PATH_REGEX.test(slash(path));
620
- }
621
- _chunkUSNT2KNTcjs.__name.call(void 0, isAbsolutePath, "isAbsolutePath");
622
- function isAbsolute(path) {
623
- return isAbsolutePath(path);
624
- }
625
- _chunkUSNT2KNTcjs.__name.call(void 0, isAbsolute, "isAbsolute");
626
-
627
- // ../path/src/slash.ts
628
- function slash(path) {
629
- if (path.startsWith("\\\\?\\")) {
630
- return path;
631
- }
632
- return path.replace(/\\/g, "/");
633
- }
634
- _chunkUSNT2KNTcjs.__name.call(void 0, slash, "slash");
635
-
636
- // ../path/src/join-paths.ts
637
- function normalizeWindowsPath(input = "") {
638
- if (!input) {
639
- return input;
640
- }
641
- return input.replace(/\\/g, "/").replace(DRIVE_LETTER_START_REGEX, (r) => r.toUpperCase());
642
- }
643
- _chunkUSNT2KNTcjs.__name.call(void 0, normalizeWindowsPath, "normalizeWindowsPath");
644
- function correctPaths(path) {
645
- if (!path || path.length === 0) {
646
- return ".";
647
- }
648
- path = normalizeWindowsPath(path);
649
- const isUNCPath = path.match(UNC_REGEX);
650
- const isPathAbsolute = isAbsolute(path);
651
- const trailingSeparator = path[path.length - 1] === "/";
652
- path = normalizeString(path, !isPathAbsolute);
653
- if (path.length === 0) {
654
- if (isPathAbsolute) {
655
- return "/";
656
- }
657
- return trailingSeparator ? "./" : ".";
658
- }
659
- if (trailingSeparator) {
660
- path += "/";
661
- }
662
- if (DRIVE_LETTER_REGEX.test(path)) {
663
- path += "/";
664
- }
665
- if (isUNCPath) {
666
- if (!isPathAbsolute) {
667
- return `//./${path}`;
668
- }
669
- return `//${path}`;
670
- }
671
- return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
672
- }
673
- _chunkUSNT2KNTcjs.__name.call(void 0, correctPaths, "correctPaths");
674
- function joinPaths(...segments) {
675
- let path = "";
676
- for (const seg of segments) {
677
- if (!seg) {
678
- continue;
679
- }
680
- if (path.length > 0) {
681
- const pathTrailing = path[path.length - 1] === "/";
682
- const segLeading = seg[0] === "/";
683
- const both = pathTrailing && segLeading;
684
- if (both) {
685
- path += seg.slice(1);
686
- } else {
687
- path += pathTrailing || segLeading ? seg : `/${seg}`;
688
- }
689
- } else {
690
- path += seg;
691
- }
692
- }
693
- return correctPaths(path);
694
- }
695
- _chunkUSNT2KNTcjs.__name.call(void 0, joinPaths, "joinPaths");
696
- function normalizeString(path, allowAboveRoot) {
697
- let res = "";
698
- let lastSegmentLength = 0;
699
- let lastSlash = -1;
700
- let dots = 0;
701
- let char = null;
702
- for (let index = 0; index <= path.length; ++index) {
703
- if (index < path.length) {
704
- char = path[index];
705
- } else if (char === "/") {
706
- break;
707
- } else {
708
- char = "/";
709
- }
710
- if (char === "/") {
711
- if (lastSlash === index - 1 || dots === 1) {
712
- } else if (dots === 2) {
713
- if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
714
- if (res.length > 2) {
715
- const lastSlashIndex = res.lastIndexOf("/");
716
- if (lastSlashIndex === -1) {
717
- res = "";
718
- lastSegmentLength = 0;
719
- } else {
720
- res = res.slice(0, lastSlashIndex);
721
- lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
722
- }
723
- lastSlash = index;
724
- dots = 0;
725
- continue;
726
- } else if (res.length > 0) {
727
- res = "";
728
- lastSegmentLength = 0;
729
- lastSlash = index;
730
- dots = 0;
731
- continue;
732
- }
733
- }
734
- if (allowAboveRoot) {
735
- res += res.length > 0 ? "/.." : "..";
736
- lastSegmentLength = 2;
737
- }
738
- } else {
739
- if (res.length > 0) {
740
- res += `/${path.slice(lastSlash + 1, index)}`;
741
- } else {
742
- res = path.slice(lastSlash + 1, index);
743
- }
744
- lastSegmentLength = index - lastSlash - 1;
745
- }
746
- lastSlash = index;
747
- dots = 0;
748
- } else if (char === "." && dots !== -1) {
749
- ++dots;
750
- } else {
751
- dots = -1;
752
- }
753
- }
754
- return res;
755
- }
756
- _chunkUSNT2KNTcjs.__name.call(void 0, normalizeString, "normalizeString");
757
-
758
- // ../path/src/correct-path.ts
759
- function normalizeWindowsPath2(input = "") {
760
- if (!input) {
761
- return input;
762
- }
763
- return slash(input).replace(DRIVE_LETTER_START_REGEX, (r) => r.toUpperCase());
764
- }
765
- _chunkUSNT2KNTcjs.__name.call(void 0, normalizeWindowsPath2, "normalizeWindowsPath");
766
- function normalizeString2(path, allowAboveRoot) {
767
- let res = "";
768
- let lastSegmentLength = 0;
769
- let lastSlash = -1;
770
- let dots = 0;
771
- let char = null;
772
- for (let index = 0; index <= path.length; ++index) {
773
- if (index < path.length) {
774
- char = path[index];
775
- } else if (char === "/") {
776
- break;
777
- } else {
778
- char = "/";
779
- }
780
- if (char === "/") {
781
- if (lastSlash === index - 1 || dots === 1) {
782
- } else if (dots === 2) {
783
- if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
784
- if (res.length > 2) {
785
- const lastSlashIndex = res.lastIndexOf("/");
786
- if (lastSlashIndex === -1) {
787
- res = "";
788
- lastSegmentLength = 0;
789
- } else {
790
- res = res.slice(0, lastSlashIndex);
791
- lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
792
- }
793
- lastSlash = index;
794
- dots = 0;
795
- continue;
796
- } else if (res.length > 0) {
797
- res = "";
798
- lastSegmentLength = 0;
799
- lastSlash = index;
800
- dots = 0;
801
- continue;
802
- }
803
- }
804
- if (allowAboveRoot) {
805
- res += res.length > 0 ? "/.." : "..";
806
- lastSegmentLength = 2;
807
- }
808
- } else {
809
- if (res.length > 0) {
810
- res += `/${path.slice(lastSlash + 1, index)}`;
811
- } else {
812
- res = path.slice(lastSlash + 1, index);
813
- }
814
- lastSegmentLength = index - lastSlash - 1;
815
- }
816
- lastSlash = index;
817
- dots = 0;
818
- } else if (char === "." && dots !== -1) {
819
- ++dots;
820
- } else {
821
- dots = -1;
822
- }
823
- }
824
- return res;
825
- }
826
- _chunkUSNT2KNTcjs.__name.call(void 0, normalizeString2, "normalizeString");
827
-
828
- // ../type-checks/src/is-null.ts
829
- var isNull = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (value) => {
830
- try {
831
- return value === null;
832
- } catch (e5) {
833
- return false;
834
- }
835
- }, "isNull");
836
-
837
- // ../type-checks/src/is-empty.ts
838
- var isEmpty = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (value) => {
839
- try {
840
- return isUndefined(value) || isNull(value);
841
- } catch (e6) {
842
- return false;
843
- }
844
- }, "isEmpty");
845
-
846
- // ../type-checks/src/is-set.ts
847
- var isSet = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (value) => {
848
- try {
849
- return !isEmpty(value);
850
- } catch (e7) {
851
- return false;
852
- }
853
- }, "isSet");
854
-
855
- // ../type-checks/src/is-set-string.ts
856
- var isSetString = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (value) => {
857
- try {
858
- return isSet(value) && isString(value) && value.length > 0;
859
- } catch (e8) {
860
- return false;
861
- }
862
- }, "isSetString");
863
-
864
- // ../path/src/file-path-fns.ts
865
- function findFileName(filePath, options = {}) {
866
- const { requireExtension = false, withExtension = true } = options;
867
- const result = _nullishCoalesce(_optionalChain([normalizeWindowsPath2, 'call', _13 => _13(filePath), 'optionalAccess', _14 => _14.split, 'call', _15 => _15(_optionalChain([filePath, 'optionalAccess', _16 => _16.includes, 'call', _17 => _17("\\")]) ? "\\" : "/"), 'optionalAccess', _18 => _18.pop, 'call', _19 => _19()]), () => ( ""));
868
- if (requireExtension === true && !result.includes(".")) {
869
- return EMPTY_STRING;
870
- }
871
- if (withExtension === false && result.includes(".")) {
872
- return result.replace(`.${_nullishCoalesce(findFileExtension(result), () => ( ""))}`, "") || EMPTY_STRING;
873
- }
874
- return result;
875
- }
876
- _chunkUSNT2KNTcjs.__name.call(void 0, findFileName, "findFileName");
877
- function findFilePath(filePath) {
878
- const normalizedPath = normalizeWindowsPath2(filePath);
879
- const result = normalizedPath.replace(findFileName(normalizedPath, {
880
- requireExtension: true
881
- }), "");
882
- return result === "/" ? result : result.replace(/\/$/, "");
883
- }
884
- _chunkUSNT2KNTcjs.__name.call(void 0, findFilePath, "findFilePath");
885
- function findFileExtension(filePath) {
886
- if (filePath.endsWith(".") || filePath.endsWith("/")) {
887
- return void 0;
888
- }
889
- const match = FILE_EXTENSION_REGEX.exec(normalizeWindowsPath2(filePath));
890
- return match && match.length > 0 && isSetString(match[0]) ? match[0].replace(".", "") : void 0;
891
- }
892
- _chunkUSNT2KNTcjs.__name.call(void 0, findFileExtension, "findFileExtension");
893
- function resolve(...paths) {
894
- paths = paths.map((argument) => normalizeWindowsPath2(argument));
895
- let resolvedPath = "";
896
- let resolvedAbsolute = false;
897
- for (let index = paths.length - 1; index >= -1 && !resolvedAbsolute; index--) {
898
- const path = index >= 0 ? paths[index] : cwd();
899
- if (!path || path.length === 0) {
900
- continue;
901
- }
902
- resolvedPath = `${path}/${resolvedPath}`;
903
- resolvedAbsolute = isAbsolute(path);
904
- }
905
- resolvedPath = normalizeString2(resolvedPath, !resolvedAbsolute);
906
- if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
907
- return `/${resolvedPath}`;
908
- }
909
- return resolvedPath.length > 0 ? resolvedPath : ".";
910
- }
911
- _chunkUSNT2KNTcjs.__name.call(void 0, resolve, "resolve");
912
- function relative(from, to) {
913
- const _from = resolve(from).replace(ROOT_FOLDER_REGEX, "$1").split("/");
914
- const _to = resolve(to).replace(ROOT_FOLDER_REGEX, "$1").split("/");
915
- if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
916
- return _to.join("/");
917
- }
918
- const _fromCopy = [
919
- ..._from
920
- ];
921
- for (const segment of _fromCopy) {
922
- if (_to[0] !== segment) {
923
- break;
924
- }
925
- _from.shift();
926
- _to.shift();
927
- }
928
- return [
929
- ..._from.map(() => ".."),
930
- ..._to
931
- ].join("/");
932
- }
933
- _chunkUSNT2KNTcjs.__name.call(void 0, relative, "relative");
934
- function relativePath(from, to, withEndSlash = false) {
935
- return relative(withEndSlash !== true ? from.replace(/\/$/, "") : from, withEndSlash !== true ? to.replace(/\/$/, "") : to);
936
- }
937
- _chunkUSNT2KNTcjs.__name.call(void 0, relativePath, "relativePath");
938
-
939
- // ../fs/src/write-file.ts
940
-
941
-
942
-
943
- // ../fs/src/helpers.ts
944
- var _nanotar = require('nanotar');
945
-
946
-
947
-
948
- // ../fs/src/json.ts
949
- async function readJsonFile(path, options) {
950
- const content = await readFile(path);
951
- if (options) {
952
- options.endsWithNewline = content.codePointAt(content.length - 1) === 10;
953
- }
954
- try {
955
- return StormJSON.parseJson(content, options);
956
- } catch (error) {
957
- if (isError(error)) {
958
- error.message = error.message.replace("JSON", path);
959
- throw error;
960
- }
961
- throw new Error(`Failed to parse JSON: ${path}`);
962
- }
963
- }
964
- _chunkUSNT2KNTcjs.__name.call(void 0, readJsonFile, "readJsonFile");
965
-
966
- // ../type-checks/src/is-buffer.ts
967
- var isBufferExists = typeof Buffer !== "undefined";
968
- var isBuffer = isBufferExists ? Buffer.isBuffer.bind(Buffer) : (
969
- /**
970
- * Check if the provided value's type is `Buffer`
971
-
972
- * @param value - The value to type check
973
- * @returns An indicator specifying if the value provided is of type `Buffer`
974
- */
975
- /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, function isBuffer2(value) {
976
- return false;
977
- }, "isBuffer")
978
- );
979
-
980
- // ../type-checks/src/type-detect.ts
981
- var globalObject = ((Obj) => {
982
- if (typeof globalThis === "object") {
983
- return globalThis;
984
- }
985
- Object.defineProperty(Obj, "typeDetectGlobalObject", {
986
- get() {
987
- return this;
988
- },
989
- configurable: true
990
- });
991
- return globalThis;
992
- })(Object.prototype);
993
-
994
- // ../fs/src/list-files.ts
995
- var _defu = require('defu'); var _defu2 = _interopRequireDefault(_defu);
996
- var _glob = require('glob');
997
- var DEFAULT_OPTIONS = {
998
- dot: true
999
- };
1000
- async function list(filesGlob, options) {
1001
- return _glob.glob.call(void 0, isString(filesGlob) ? filesGlob.includes("*") ? filesGlob : joinPaths(filesGlob, "**/*") : filesGlob.input ? joinPaths(filesGlob.input, filesGlob.glob) : filesGlob.glob, _defu2.default.call(void 0, isString(filesGlob) ? {} : {
1002
- dot: filesGlob.dot,
1003
- ignore: filesGlob.ignore
1004
- }, _nullishCoalesce(options, () => ( {})), DEFAULT_OPTIONS));
1005
- }
1006
- _chunkUSNT2KNTcjs.__name.call(void 0, list, "list");
1007
- async function listFiles(filesGlob, options) {
1008
- const result = (await list(filesGlob, _defu2.default.call(void 0, {
1009
- withFileTypes: true
1010
- }, _nullishCoalesce(options, () => ( {}))))).filter((ret) => ret.isFile());
1011
- if (!_optionalChain([options, 'optionalAccess', _20 => _20.withFileTypes])) {
1012
- return result.map((file) => file.fullpath());
1013
- }
1014
- return result;
1015
- }
1016
- _chunkUSNT2KNTcjs.__name.call(void 0, listFiles, "listFiles");
1017
-
1018
- // src/helpers.ts
1019
- var _typescript = require('typescript');
1020
- async function resolveOptions(options) {
1021
- const tsconfigPath = options.tsconfigPath ? options.tsconfigPath.replace("{projectRoot}", options.projectRoot).replace("{workspaceRoot}", options.workspaceRoot) : joinPaths(options.projectRoot, "tsconfig.json");
1022
- const schemas = toArray(options.schemas ? options.schemas : joinPaths(options.projectRoot, "schemas/**/*.capnp")).filter(Boolean).map((schema) => schema.replace("{projectRoot}", options.projectRoot).replace("{workspaceRoot}", options.workspaceRoot));
1023
- let resolvedTsconfig;
1024
- if (options.tsconfig) {
1025
- resolvedTsconfig = options.tsconfig;
1026
- } else {
1027
- if (!tsconfigPath || !existsSync(tsconfigPath)) {
1028
- const errorMessage = tsconfigPath ? `\u2716 The specified TypeScript configuration file "${tsconfigPath}" does not exist. Please provide a valid path.` : "\u2716 The specified TypeScript configuration file does not exist. Please provide a valid path.";
1029
- _console.writeFatal.call(void 0, errorMessage, {
1030
- logLevel: "all"
1031
- });
1032
- throw new Error(errorMessage);
1033
- }
1034
- const tsconfigFile = await readJsonFile(tsconfigPath);
1035
- resolvedTsconfig = _typescript.parseJsonConfigFileContent.call(void 0, tsconfigFile, _typescript.sys, findFilePath(tsconfigPath));
1036
- if (!resolvedTsconfig) {
1037
- const errorMessage = `\u2716 The specified TypeScript configuration file "${tsconfigPath}" is invalid. Please provide a valid configuration.`;
1038
- _console.writeFatal.call(void 0, errorMessage, {
1039
- logLevel: "all"
1040
- });
1041
- throw new Error(errorMessage);
1042
- }
1043
- resolvedTsconfig.options.configFilePath = tsconfigPath;
1044
- resolvedTsconfig.options.noImplicitOverride = false;
1045
- resolvedTsconfig.options.noUnusedLocals = false;
1046
- resolvedTsconfig.options.noUnusedParameters = false;
1047
- }
1048
- const resolvedSchemas = [];
1049
- for (const schema of schemas) {
1050
- let formattedSchema = schema;
1051
- if (!schema.endsWith(".capnp") && !schema.includes("*")) {
1052
- formattedSchema = `${schema.replace(/\/$/g, "")}/*.capnp`;
1053
- }
1054
- resolvedSchemas.push(...await listFiles(formattedSchema));
1055
- }
1056
- if (resolvedSchemas.length === 0 || !resolvedSchemas[0]) {
1057
- _console.writeWarning.call(void 0, `\u2716 No Cap'n Proto schema files found in the specified source paths: ${schemas.join(", ")}. As a result, the Cap'n Proto compiler will not be able to generate any output files. Please ensure that the paths are correct and contain .capnp files.`, {
1058
- logLevel: "all"
1059
- });
1060
- return null;
1061
- }
1062
- const output = options.output ? options.output.replace("{projectRoot}", options.projectRoot).replace("{workspaceRoot}", options.workspaceRoot) : joinPaths(options.projectRoot, relativePath(tsconfigPath ? findFilePath(tsconfigPath) : options.projectRoot, joinPaths(options.workspaceRoot, resolvedSchemas[0].endsWith(".capnp") ? findFilePath(resolvedSchemas[0]) : resolvedSchemas[0])));
1063
- resolvedTsconfig.options.outDir = output;
1064
- return {
1065
- ...options,
1066
- importPath: options.importPath ? options.importPath.split(",").map((dir) => dir.trim()) : [],
1067
- workspaceRoot: options.workspaceRoot,
1068
- projectRoot: options.projectRoot,
1069
- schemas: resolvedSchemas,
1070
- output,
1071
- js: options.js === true,
1072
- ts: options.noTs !== true,
1073
- dts: _nullishCoalesce(options.dts, () => ( options.noDts !== true)),
1074
- tsconfig: resolvedTsconfig
1075
- };
1076
- }
1077
- _chunkUSNT2KNTcjs.__name.call(void 0, resolveOptions, "resolveOptions");
1078
-
1079
-
1080
-
1081
-
1082
- exports.existsSync = existsSync; exports.resolveOptions = resolveOptions;