@wix/cli-app 1.1.81 → 1.1.83

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 (84) hide show
  1. package/build/{AddPermissionCommand-SFC44F4N.js → AddPermissionCommand-5X3K4KUG.js} +2 -2
  2. package/build/{CreateVersionCommand-DMS7UHEW.js → CreateVersionCommand-XWWXAFOX.js} +3 -3
  3. package/build/{DevCommand-IMACMU76.js → DevCommand-EOEGQX2B.js} +14 -14
  4. package/build/{GenerateCommand-BXBYWPR6.js → GenerateCommand-IOFKL3RC.js} +1009 -868
  5. package/build/GenerateCommand-IOFKL3RC.js.map +1 -0
  6. package/build/{LogsCommand-DXPP2Y63.js → LogsCommand-23QQRT3D.js} +3 -3
  7. package/build/PreviewCommand-FBODGF7Y.js +19 -0
  8. package/build/ReleaseCommand-SNCMQQXK.js +28 -0
  9. package/build/{ReleaseCommand-ZZFTWS7J.js.map → ReleaseCommand-SNCMQQXK.js.map} +1 -1
  10. package/build/ServeCommand-SGREOUDA.js +43 -0
  11. package/build/ServeCommand-SGREOUDA.js.map +1 -0
  12. package/build/{build-5B2A76I7.js → build-PYB5PAZO.js} +8 -8
  13. package/build/{chunk-GCHPKOS2.js → chunk-3X2VYRBF.js} +13 -7
  14. package/build/chunk-3X2VYRBF.js.map +1 -0
  15. package/build/{chunk-R3BD56LW.js → chunk-4PXJSX4C.js} +2 -2
  16. package/build/{chunk-32DDGTGH.js → chunk-5TP6T6QK.js} +84 -17
  17. package/build/chunk-5TP6T6QK.js.map +1 -0
  18. package/build/{chunk-PJJ6F4A3.js → chunk-63VDDLLQ.js} +2 -2
  19. package/build/{chunk-6GF7ZOLW.js → chunk-AN77SZN2.js} +9 -11
  20. package/build/{chunk-6GF7ZOLW.js.map → chunk-AN77SZN2.js.map} +1 -1
  21. package/build/{chunk-RZHKF2FT.js → chunk-E4UNGBQY.js} +2 -2
  22. package/build/{chunk-JYPZQDKR.js → chunk-GGDJQXOX.js} +3 -3
  23. package/build/{chunk-3BX4VLQC.js → chunk-KLBXSZ6R.js} +3 -3
  24. package/build/{chunk-ZVADFZDF.js → chunk-QREADZZF.js} +5 -5
  25. package/build/{chunk-DBASREIW.js → chunk-SIJDKP2Q.js} +1312 -534
  26. package/build/chunk-SIJDKP2Q.js.map +1 -0
  27. package/build/{chunk-D7ONS7OD.js → chunk-TJFERWU7.js} +5 -5
  28. package/build/{chunk-VV2OOBF3.js → chunk-VB3AXXRP.js} +2 -2
  29. package/build/{chunk-OPFPQV74.js → chunk-VLQG5SQF.js} +79 -4
  30. package/build/{chunk-OPFPQV74.js.map → chunk-VLQG5SQF.js.map} +1 -1
  31. package/build/{chunk-LNBDMMJU.js → chunk-WNR36YTI.js} +2 -2
  32. package/build/{chunk-42T5NHSS.js → chunk-Y4GJ3NS4.js} +2 -2
  33. package/build/{chunk-S426UONM.js → chunk-ZCUJ356B.js} +2 -2
  34. package/build/{chunk-2Y6DEXNR.js → chunk-ZLLXHWZF.js} +957 -375
  35. package/build/{chunk-2Y6DEXNR.js.map → chunk-ZLLXHWZF.js.map} +1 -1
  36. package/build/{chunk-CYJERK24.js → chunk-ZOZ5LJV7.js} +7 -7
  37. package/build/{chunk-CYJERK24.js.map → chunk-ZOZ5LJV7.js.map} +1 -1
  38. package/build/cloudflare-runtime/entry.js +33 -9
  39. package/build/cloudflare-runtime/getRegisteredExtensions.js +33 -9
  40. package/build/index.js +34 -31
  41. package/build/index.js.map +1 -1
  42. package/build/platform-sdk/chunk-MM2KVUBI.js +2 -0
  43. package/build/platform-sdk/chunk-MM2KVUBI.js.map +1 -0
  44. package/build/platform-sdk/dashboard.js +1 -1
  45. package/build/platform-sdk/editor.js +1 -1
  46. package/build/platform-sdk/site.js +1 -1
  47. package/build/{preview-XTPTMI6C.js → preview-PIFWQKW3.js} +13 -14
  48. package/build/{preview-XTPTMI6C.js.map → preview-PIFWQKW3.js.map} +1 -1
  49. package/build/{release-MNTPIKSG.js → release-6Z6LMTRW.js} +15 -16
  50. package/build/{release-MNTPIKSG.js.map → release-6Z6LMTRW.js.map} +1 -1
  51. package/build/{render-command-HQXTOVW5.js → render-command-3G25G5MU.js} +6 -6
  52. package/build/src-MHMTXBSY.js +1120 -0
  53. package/build/src-MHMTXBSY.js.map +1 -0
  54. package/package.json +8 -7
  55. package/build/GenerateCommand-BXBYWPR6.js.map +0 -1
  56. package/build/PreviewCommand-IKMUVCVS.js +0 -20
  57. package/build/ReleaseCommand-ZZFTWS7J.js +0 -29
  58. package/build/ServeCommand-2ESXE2E2.js +0 -169
  59. package/build/ServeCommand-2ESXE2E2.js.map +0 -1
  60. package/build/chunk-32DDGTGH.js.map +0 -1
  61. package/build/chunk-3FL4P2SD.js +0 -92
  62. package/build/chunk-3FL4P2SD.js.map +0 -1
  63. package/build/chunk-DBASREIW.js.map +0 -1
  64. package/build/chunk-GCHPKOS2.js.map +0 -1
  65. package/build/platform-sdk/chunk-BGEA2LRQ.js +0 -2
  66. package/build/platform-sdk/chunk-BGEA2LRQ.js.map +0 -1
  67. /package/build/{AddPermissionCommand-SFC44F4N.js.map → AddPermissionCommand-5X3K4KUG.js.map} +0 -0
  68. /package/build/{CreateVersionCommand-DMS7UHEW.js.map → CreateVersionCommand-XWWXAFOX.js.map} +0 -0
  69. /package/build/{DevCommand-IMACMU76.js.map → DevCommand-EOEGQX2B.js.map} +0 -0
  70. /package/build/{LogsCommand-DXPP2Y63.js.map → LogsCommand-23QQRT3D.js.map} +0 -0
  71. /package/build/{PreviewCommand-IKMUVCVS.js.map → PreviewCommand-FBODGF7Y.js.map} +0 -0
  72. /package/build/{build-5B2A76I7.js.map → build-PYB5PAZO.js.map} +0 -0
  73. /package/build/{chunk-R3BD56LW.js.map → chunk-4PXJSX4C.js.map} +0 -0
  74. /package/build/{chunk-PJJ6F4A3.js.map → chunk-63VDDLLQ.js.map} +0 -0
  75. /package/build/{chunk-RZHKF2FT.js.map → chunk-E4UNGBQY.js.map} +0 -0
  76. /package/build/{chunk-JYPZQDKR.js.map → chunk-GGDJQXOX.js.map} +0 -0
  77. /package/build/{chunk-3BX4VLQC.js.map → chunk-KLBXSZ6R.js.map} +0 -0
  78. /package/build/{chunk-ZVADFZDF.js.map → chunk-QREADZZF.js.map} +0 -0
  79. /package/build/{chunk-D7ONS7OD.js.map → chunk-TJFERWU7.js.map} +0 -0
  80. /package/build/{chunk-VV2OOBF3.js.map → chunk-VB3AXXRP.js.map} +0 -0
  81. /package/build/{chunk-LNBDMMJU.js.map → chunk-WNR36YTI.js.map} +0 -0
  82. /package/build/{chunk-42T5NHSS.js.map → chunk-Y4GJ3NS4.js.map} +0 -0
  83. /package/build/{chunk-S426UONM.js.map → chunk-ZCUJ356B.js.map} +0 -0
  84. /package/build/{render-command-HQXTOVW5.js.map → render-command-3G25G5MU.js.map} +0 -0
@@ -0,0 +1,1120 @@
1
+ import { createRequire as _createRequire } from 'node:module';
2
+ const require = _createRequire(import.meta.url);
3
+ import {
4
+ init_esm_shims
5
+ } from "./chunk-PYIAC2GK.js";
6
+
7
+ // ../../node_modules/tsconfck/src/index.js
8
+ init_esm_shims();
9
+
10
+ // ../../node_modules/tsconfck/src/find.js
11
+ init_esm_shims();
12
+ import path2 from "node:path";
13
+ import fs2 from "node:fs";
14
+
15
+ // ../../node_modules/tsconfck/src/util.js
16
+ init_esm_shims();
17
+ import path from "node:path";
18
+ import { promises as fs } from "node:fs";
19
+ var POSIX_SEP_RE = new RegExp("\\" + path.posix.sep, "g");
20
+ var NATIVE_SEP_RE = new RegExp("\\" + path.sep, "g");
21
+ var PATTERN_REGEX_CACHE = /* @__PURE__ */ new Map();
22
+ var GLOB_ALL_PATTERN = `**/*`;
23
+ var TS_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts"];
24
+ var JS_EXTENSIONS = [".js", ".jsx", ".mjs", ".cjs"];
25
+ var TSJS_EXTENSIONS = TS_EXTENSIONS.concat(JS_EXTENSIONS);
26
+ var TS_EXTENSIONS_RE_GROUP = `\\.(?:${TS_EXTENSIONS.map((ext) => ext.substring(1)).join("|")})`;
27
+ var TSJS_EXTENSIONS_RE_GROUP = `\\.(?:${TSJS_EXTENSIONS.map((ext) => ext.substring(1)).join(
28
+ "|"
29
+ )})`;
30
+ var IS_POSIX = path.posix.sep === path.sep;
31
+ function makePromise() {
32
+ let resolve, reject;
33
+ const promise = new Promise((res, rej) => {
34
+ resolve = res;
35
+ reject = rej;
36
+ });
37
+ return { promise, resolve, reject };
38
+ }
39
+ async function loadTS() {
40
+ try {
41
+ return import("typescript").then((m) => m.default);
42
+ } catch (e) {
43
+ console.error('typescript must be installed to use "native" functions');
44
+ throw e;
45
+ }
46
+ }
47
+ async function resolveTSConfigJson(filename, cache) {
48
+ if (path.extname(filename) !== ".json") {
49
+ return;
50
+ }
51
+ const tsconfig = path.resolve(filename);
52
+ if (cache && (cache.hasParseResult(tsconfig) || cache.hasParseResult(filename))) {
53
+ return tsconfig;
54
+ }
55
+ return fs.stat(tsconfig).then((stat) => {
56
+ if (stat.isFile() || stat.isFIFO()) {
57
+ return tsconfig;
58
+ } else {
59
+ throw new Error(`${filename} exists but is not a regular file.`);
60
+ }
61
+ });
62
+ }
63
+ var isInNodeModules = IS_POSIX ? (dir) => dir.includes("/node_modules/") : (dir) => dir.match(/[/\\]node_modules[/\\]/);
64
+ var posix2native = IS_POSIX ? (filename) => filename : (filename) => filename.replace(POSIX_SEP_RE, path.sep);
65
+ var native2posix = IS_POSIX ? (filename) => filename : (filename) => filename.replace(NATIVE_SEP_RE, path.posix.sep);
66
+ var resolve2posix = IS_POSIX ? (dir, filename) => dir ? path.resolve(dir, filename) : path.resolve(filename) : (dir, filename) => native2posix(
67
+ dir ? path.resolve(posix2native(dir), posix2native(filename)) : path.resolve(posix2native(filename))
68
+ );
69
+ function resolveReferencedTSConfigFiles(result, options) {
70
+ const dir = path.dirname(result.tsconfigFile);
71
+ return result.tsconfig.references.map((ref) => {
72
+ const refPath = ref.path.endsWith(".json") ? ref.path : path.join(ref.path, options?.configName ?? "tsconfig.json");
73
+ return resolve2posix(dir, refPath);
74
+ });
75
+ }
76
+ function resolveSolutionTSConfig(filename, result) {
77
+ const allowJs = result.tsconfig.compilerOptions?.allowJs;
78
+ const extensions = allowJs ? TSJS_EXTENSIONS : TS_EXTENSIONS;
79
+ if (result.referenced && extensions.some((ext) => filename.endsWith(ext)) && !isIncluded(filename, result)) {
80
+ const solutionTSConfig = result.referenced.find(
81
+ (referenced) => isIncluded(filename, referenced)
82
+ );
83
+ if (solutionTSConfig) {
84
+ return solutionTSConfig;
85
+ }
86
+ }
87
+ return result;
88
+ }
89
+ function isIncluded(filename, result) {
90
+ const dir = native2posix(path.dirname(result.tsconfigFile));
91
+ const files = (result.tsconfig.files || []).map((file) => resolve2posix(dir, file));
92
+ const absoluteFilename = resolve2posix(null, filename);
93
+ if (files.includes(filename)) {
94
+ return true;
95
+ }
96
+ const allowJs = result.tsconfig.compilerOptions?.allowJs;
97
+ const isIncluded2 = isGlobMatch(
98
+ absoluteFilename,
99
+ dir,
100
+ result.tsconfig.include || (result.tsconfig.files ? [] : [GLOB_ALL_PATTERN]),
101
+ allowJs
102
+ );
103
+ if (isIncluded2) {
104
+ const isExcluded = isGlobMatch(absoluteFilename, dir, result.tsconfig.exclude || [], allowJs);
105
+ return !isExcluded;
106
+ }
107
+ return false;
108
+ }
109
+ function isGlobMatch(filename, dir, patterns, allowJs) {
110
+ const extensions = allowJs ? TSJS_EXTENSIONS : TS_EXTENSIONS;
111
+ return patterns.some((pattern) => {
112
+ let lastWildcardIndex = pattern.length;
113
+ let hasWildcard = false;
114
+ let hasExtension = false;
115
+ let hasSlash = false;
116
+ let lastSlashIndex = -1;
117
+ for (let i = pattern.length - 1; i > -1; i--) {
118
+ const c = pattern[i];
119
+ if (!hasWildcard) {
120
+ if (c === "*" || c === "?") {
121
+ lastWildcardIndex = i;
122
+ hasWildcard = true;
123
+ }
124
+ }
125
+ if (!hasSlash) {
126
+ if (c === ".") {
127
+ hasExtension = true;
128
+ } else if (c === "/") {
129
+ lastSlashIndex = i;
130
+ hasSlash = true;
131
+ }
132
+ }
133
+ if (hasWildcard && hasSlash) {
134
+ break;
135
+ }
136
+ }
137
+ if (!hasExtension && (!hasWildcard || lastWildcardIndex < lastSlashIndex)) {
138
+ pattern += `${pattern.endsWith("/") ? "" : "/"}${GLOB_ALL_PATTERN}`;
139
+ lastWildcardIndex = pattern.length - 1;
140
+ hasWildcard = true;
141
+ }
142
+ if (lastWildcardIndex < pattern.length - 1 && !filename.endsWith(pattern.slice(lastWildcardIndex + 1))) {
143
+ return false;
144
+ }
145
+ if (pattern.endsWith("*") && !extensions.some((ext) => filename.endsWith(ext))) {
146
+ return false;
147
+ }
148
+ if (pattern === GLOB_ALL_PATTERN) {
149
+ return filename.startsWith(`${dir}/`);
150
+ }
151
+ const resolvedPattern = resolve2posix(dir, pattern);
152
+ let firstWildcardIndex = -1;
153
+ for (let i = 0; i < resolvedPattern.length; i++) {
154
+ if (resolvedPattern[i] === "*" || resolvedPattern[i] === "?") {
155
+ firstWildcardIndex = i;
156
+ hasWildcard = true;
157
+ break;
158
+ }
159
+ }
160
+ if (firstWildcardIndex > 1 && !filename.startsWith(resolvedPattern.slice(0, firstWildcardIndex - 1))) {
161
+ return false;
162
+ }
163
+ if (!hasWildcard) {
164
+ return filename === resolvedPattern;
165
+ } else if (firstWildcardIndex + GLOB_ALL_PATTERN.length === resolvedPattern.length - (pattern.length - 1 - lastWildcardIndex) && resolvedPattern.slice(firstWildcardIndex, firstWildcardIndex + GLOB_ALL_PATTERN.length) === GLOB_ALL_PATTERN) {
166
+ return true;
167
+ }
168
+ if (PATTERN_REGEX_CACHE.has(resolvedPattern)) {
169
+ return PATTERN_REGEX_CACHE.get(resolvedPattern).test(filename);
170
+ }
171
+ const regex = pattern2regex(resolvedPattern, allowJs);
172
+ PATTERN_REGEX_CACHE.set(resolvedPattern, regex);
173
+ return regex.test(filename);
174
+ });
175
+ }
176
+ function pattern2regex(resolvedPattern, allowJs) {
177
+ let regexStr = "^";
178
+ for (let i = 0; i < resolvedPattern.length; i++) {
179
+ const char = resolvedPattern[i];
180
+ if (char === "?") {
181
+ regexStr += "[^\\/]";
182
+ continue;
183
+ }
184
+ if (char === "*") {
185
+ if (resolvedPattern[i + 1] === "*" && resolvedPattern[i + 2] === "/") {
186
+ i += 2;
187
+ regexStr += "(?:[^\\/]*\\/)*";
188
+ continue;
189
+ }
190
+ regexStr += "[^\\/]*";
191
+ continue;
192
+ }
193
+ if ("/.+^${}()|[]\\".includes(char)) {
194
+ regexStr += `\\`;
195
+ }
196
+ regexStr += char;
197
+ }
198
+ if (resolvedPattern.endsWith("*")) {
199
+ regexStr += allowJs ? TSJS_EXTENSIONS_RE_GROUP : TS_EXTENSIONS_RE_GROUP;
200
+ }
201
+ regexStr += "$";
202
+ return new RegExp(regexStr);
203
+ }
204
+ function replaceTokens(result) {
205
+ if (result.tsconfig) {
206
+ result.tsconfig = JSON.parse(
207
+ JSON.stringify(result.tsconfig).replaceAll(/"\${configDir}/g, `"${native2posix(path.dirname(result.tsconfigFile))}`)
208
+ );
209
+ }
210
+ }
211
+
212
+ // ../../node_modules/tsconfck/src/find.js
213
+ async function find(filename, options) {
214
+ let dir = path2.dirname(path2.resolve(filename));
215
+ if (options?.ignoreNodeModules && isInNodeModules(dir)) {
216
+ return null;
217
+ }
218
+ const cache = options?.cache;
219
+ const configName = options?.configName ?? "tsconfig.json";
220
+ if (cache?.hasConfigPath(dir, configName)) {
221
+ return cache.getConfigPath(dir, configName);
222
+ }
223
+ const {
224
+ /** @type {Promise<string|null>} */
225
+ promise,
226
+ resolve,
227
+ reject
228
+ } = makePromise();
229
+ if (options?.root && !path2.isAbsolute(options.root)) {
230
+ options.root = path2.resolve(options.root);
231
+ }
232
+ findUp(dir, { promise, resolve, reject }, options);
233
+ return promise;
234
+ }
235
+ function findUp(dir, { resolve, reject, promise }, options) {
236
+ const { cache, root, configName } = options ?? {};
237
+ if (cache) {
238
+ if (cache.hasConfigPath(dir, configName)) {
239
+ let cached;
240
+ try {
241
+ cached = cache.getConfigPath(dir, configName);
242
+ } catch (e) {
243
+ reject(e);
244
+ return;
245
+ }
246
+ if (cached?.then) {
247
+ cached.then(resolve).catch(reject);
248
+ } else {
249
+ resolve(cached);
250
+ }
251
+ } else {
252
+ cache.setConfigPath(dir, promise, configName);
253
+ }
254
+ }
255
+ const tsconfig = path2.join(dir, options?.configName ?? "tsconfig.json");
256
+ fs2.stat(tsconfig, (err, stats) => {
257
+ if (stats && (stats.isFile() || stats.isFIFO())) {
258
+ resolve(tsconfig);
259
+ } else if (err?.code !== "ENOENT") {
260
+ reject(err);
261
+ } else {
262
+ let parent;
263
+ if (root === dir || (parent = path2.dirname(dir)) === dir) {
264
+ resolve(null);
265
+ } else {
266
+ findUp(parent, { promise, resolve, reject }, options);
267
+ }
268
+ }
269
+ });
270
+ }
271
+
272
+ // ../../node_modules/tsconfck/src/find-all.js
273
+ init_esm_shims();
274
+ import path3 from "node:path";
275
+ import { readdir } from "node:fs";
276
+ var sep = path3.sep;
277
+ async function findAll(dir, options) {
278
+ const state = {
279
+ files: [],
280
+ calls: 0,
281
+ skip: options?.skip,
282
+ err: false,
283
+ configNames: options?.configNames ?? ["tsconfig.json"]
284
+ };
285
+ return new Promise((resolve, reject) => {
286
+ walk(path3.resolve(dir), state, (err, files) => err ? reject(err) : resolve(files));
287
+ });
288
+ }
289
+ function walk(dir, state, done) {
290
+ if (state.err) {
291
+ return;
292
+ }
293
+ state.calls++;
294
+ readdir(dir, { withFileTypes: true }, (err, entries = []) => {
295
+ if (state.err) {
296
+ return;
297
+ }
298
+ if (err && !(err.code === "ENOENT" || err.code === "EACCES" || err.code === "EPERM")) {
299
+ state.err = true;
300
+ done(err);
301
+ } else {
302
+ for (const ent of entries) {
303
+ if (ent.isDirectory() && !state.skip?.(ent.name)) {
304
+ walk(`${dir}${sep}${ent.name}`, state, done);
305
+ } else if (ent.isFile() && state.configNames.includes(ent.name)) {
306
+ state.files.push(`${dir}${sep}${ent.name}`);
307
+ }
308
+ }
309
+ if (--state.calls === 0) {
310
+ if (!state.err) {
311
+ done(null, state.files);
312
+ }
313
+ }
314
+ }
315
+ });
316
+ }
317
+
318
+ // ../../node_modules/tsconfck/src/to-json.js
319
+ init_esm_shims();
320
+ function toJson(tsconfigJson) {
321
+ const stripped = stripDanglingComma(stripJsonComments(stripBom(tsconfigJson)));
322
+ if (stripped.trim() === "") {
323
+ return "{}";
324
+ } else {
325
+ return stripped;
326
+ }
327
+ }
328
+ function stripDanglingComma(pseudoJson) {
329
+ let insideString = false;
330
+ let offset = 0;
331
+ let result = "";
332
+ let danglingCommaPos = null;
333
+ for (let i = 0; i < pseudoJson.length; i++) {
334
+ const currentCharacter = pseudoJson[i];
335
+ if (currentCharacter === '"') {
336
+ const escaped = isEscaped(pseudoJson, i);
337
+ if (!escaped) {
338
+ insideString = !insideString;
339
+ }
340
+ }
341
+ if (insideString) {
342
+ danglingCommaPos = null;
343
+ continue;
344
+ }
345
+ if (currentCharacter === ",") {
346
+ danglingCommaPos = i;
347
+ continue;
348
+ }
349
+ if (danglingCommaPos) {
350
+ if (currentCharacter === "}" || currentCharacter === "]") {
351
+ result += pseudoJson.slice(offset, danglingCommaPos) + " ";
352
+ offset = danglingCommaPos + 1;
353
+ danglingCommaPos = null;
354
+ } else if (!currentCharacter.match(/\s/)) {
355
+ danglingCommaPos = null;
356
+ }
357
+ }
358
+ }
359
+ return result + pseudoJson.substring(offset);
360
+ }
361
+ function isEscaped(jsonString, quotePosition) {
362
+ let index = quotePosition - 1;
363
+ let backslashCount = 0;
364
+ while (jsonString[index] === "\\") {
365
+ index -= 1;
366
+ backslashCount += 1;
367
+ }
368
+ return Boolean(backslashCount % 2);
369
+ }
370
+ function strip(string, start, end) {
371
+ return string.slice(start, end).replace(/\S/g, " ");
372
+ }
373
+ var singleComment = Symbol("singleComment");
374
+ var multiComment = Symbol("multiComment");
375
+ function stripJsonComments(jsonString) {
376
+ let isInsideString = false;
377
+ let isInsideComment = false;
378
+ let offset = 0;
379
+ let result = "";
380
+ for (let index = 0; index < jsonString.length; index++) {
381
+ const currentCharacter = jsonString[index];
382
+ const nextCharacter = jsonString[index + 1];
383
+ if (!isInsideComment && currentCharacter === '"') {
384
+ const escaped = isEscaped(jsonString, index);
385
+ if (!escaped) {
386
+ isInsideString = !isInsideString;
387
+ }
388
+ }
389
+ if (isInsideString) {
390
+ continue;
391
+ }
392
+ if (!isInsideComment && currentCharacter + nextCharacter === "//") {
393
+ result += jsonString.slice(offset, index);
394
+ offset = index;
395
+ isInsideComment = singleComment;
396
+ index++;
397
+ } else if (isInsideComment === singleComment && currentCharacter + nextCharacter === "\r\n") {
398
+ index++;
399
+ isInsideComment = false;
400
+ result += strip(jsonString, offset, index);
401
+ offset = index;
402
+ } else if (isInsideComment === singleComment && currentCharacter === "\n") {
403
+ isInsideComment = false;
404
+ result += strip(jsonString, offset, index);
405
+ offset = index;
406
+ } else if (!isInsideComment && currentCharacter + nextCharacter === "/*") {
407
+ result += jsonString.slice(offset, index);
408
+ offset = index;
409
+ isInsideComment = multiComment;
410
+ index++;
411
+ } else if (isInsideComment === multiComment && currentCharacter + nextCharacter === "*/") {
412
+ index++;
413
+ isInsideComment = false;
414
+ result += strip(jsonString, offset, index + 1);
415
+ offset = index + 1;
416
+ }
417
+ }
418
+ return result + (isInsideComment ? strip(jsonString.slice(offset)) : jsonString.slice(offset));
419
+ }
420
+ function stripBom(string) {
421
+ if (string.charCodeAt(0) === 65279) {
422
+ return string.slice(1);
423
+ }
424
+ return string;
425
+ }
426
+
427
+ // ../../node_modules/tsconfck/src/parse.js
428
+ init_esm_shims();
429
+ import path4 from "node:path";
430
+ import { promises as fs3 } from "node:fs";
431
+ import { createRequire } from "module";
432
+ var not_found_result = {
433
+ tsconfigFile: null,
434
+ tsconfig: {}
435
+ };
436
+ async function parse(filename, options) {
437
+ const cache = options?.cache;
438
+ if (cache?.hasParseResult(filename)) {
439
+ return getParsedDeep(filename, cache, options);
440
+ }
441
+ const {
442
+ resolve,
443
+ reject,
444
+ /** @type {Promise<import('./public.d.ts').TSConfckParseResult>}*/
445
+ promise
446
+ } = makePromise();
447
+ cache?.setParseResult(filename, promise, true);
448
+ try {
449
+ let tsconfigFile = await resolveTSConfigJson(filename, cache) || await find(filename, options);
450
+ if (!tsconfigFile) {
451
+ resolve(not_found_result);
452
+ return promise;
453
+ }
454
+ let result;
455
+ if (filename !== tsconfigFile && cache?.hasParseResult(tsconfigFile)) {
456
+ result = await getParsedDeep(tsconfigFile, cache, options);
457
+ } else {
458
+ result = await parseFile(tsconfigFile, cache, filename === tsconfigFile);
459
+ await Promise.all([parseExtends(result, cache), parseReferences(result, options)]);
460
+ }
461
+ replaceTokens(result);
462
+ resolve(resolveSolutionTSConfig(filename, result));
463
+ } catch (e) {
464
+ reject(e);
465
+ }
466
+ return promise;
467
+ }
468
+ async function getParsedDeep(filename, cache, options) {
469
+ const result = await cache.getParseResult(filename);
470
+ if (result.tsconfig.extends && !result.extended || result.tsconfig.references && !result.referenced) {
471
+ const promise = Promise.all([
472
+ parseExtends(result, cache),
473
+ parseReferences(result, options)
474
+ ]).then(() => result);
475
+ cache.setParseResult(filename, promise, true);
476
+ return promise;
477
+ }
478
+ return result;
479
+ }
480
+ async function parseFile(tsconfigFile, cache, skipCache) {
481
+ if (!skipCache && cache?.hasParseResult(tsconfigFile) && !cache.getParseResult(tsconfigFile)._isRootFile_) {
482
+ return cache.getParseResult(tsconfigFile);
483
+ }
484
+ const promise = fs3.readFile(tsconfigFile, "utf-8").then(toJson).then((json) => {
485
+ const parsed = JSON.parse(json);
486
+ applyDefaults(parsed, tsconfigFile);
487
+ return {
488
+ tsconfigFile,
489
+ tsconfig: normalizeTSConfig(parsed, path4.dirname(tsconfigFile))
490
+ };
491
+ }).catch((e) => {
492
+ throw new TSConfckParseError(
493
+ `parsing ${tsconfigFile} failed: ${e}`,
494
+ "PARSE_FILE",
495
+ tsconfigFile,
496
+ e
497
+ );
498
+ });
499
+ if (!skipCache && (!cache?.hasParseResult(tsconfigFile) || !cache.getParseResult(tsconfigFile)._isRootFile_)) {
500
+ cache?.setParseResult(tsconfigFile, promise);
501
+ }
502
+ return promise;
503
+ }
504
+ function normalizeTSConfig(tsconfig, dir) {
505
+ const baseUrl = tsconfig.compilerOptions?.baseUrl;
506
+ if (baseUrl && !baseUrl.startsWith("${") && !path4.isAbsolute(baseUrl)) {
507
+ tsconfig.compilerOptions.baseUrl = resolve2posix(dir, baseUrl);
508
+ }
509
+ return tsconfig;
510
+ }
511
+ async function parseReferences(result, options) {
512
+ if (!result.tsconfig.references) {
513
+ return;
514
+ }
515
+ const referencedFiles = resolveReferencedTSConfigFiles(result, options);
516
+ const referenced = await Promise.all(
517
+ referencedFiles.map((file) => parseFile(file, options?.cache))
518
+ );
519
+ await Promise.all(referenced.map((ref) => parseExtends(ref, options?.cache)));
520
+ referenced.forEach((ref) => {
521
+ ref.solution = result;
522
+ replaceTokens(ref);
523
+ });
524
+ result.referenced = referenced;
525
+ }
526
+ async function parseExtends(result, cache) {
527
+ if (!result.tsconfig.extends) {
528
+ return;
529
+ }
530
+ const extended = [
531
+ { tsconfigFile: result.tsconfigFile, tsconfig: JSON.parse(JSON.stringify(result.tsconfig)) }
532
+ ];
533
+ let pos = 0;
534
+ const extendsPath = [];
535
+ let currentBranchDepth = 0;
536
+ while (pos < extended.length) {
537
+ const extending = extended[pos];
538
+ extendsPath.push(extending.tsconfigFile);
539
+ if (extending.tsconfig.extends) {
540
+ currentBranchDepth += 1;
541
+ let resolvedExtends;
542
+ if (!Array.isArray(extending.tsconfig.extends)) {
543
+ resolvedExtends = [resolveExtends(extending.tsconfig.extends, extending.tsconfigFile)];
544
+ } else {
545
+ resolvedExtends = extending.tsconfig.extends.reverse().map((ex) => resolveExtends(ex, extending.tsconfigFile));
546
+ }
547
+ const circularExtends = resolvedExtends.find(
548
+ (tsconfigFile) => extendsPath.includes(tsconfigFile)
549
+ );
550
+ if (circularExtends) {
551
+ const circle = extendsPath.concat([circularExtends]).join(" -> ");
552
+ throw new TSConfckParseError(
553
+ `Circular dependency in "extends": ${circle}`,
554
+ "EXTENDS_CIRCULAR",
555
+ result.tsconfigFile
556
+ );
557
+ }
558
+ extended.splice(
559
+ pos + 1,
560
+ 0,
561
+ ...await Promise.all(resolvedExtends.map((file) => parseFile(file, cache)))
562
+ );
563
+ } else {
564
+ extendsPath.splice(-currentBranchDepth);
565
+ currentBranchDepth = 0;
566
+ }
567
+ pos = pos + 1;
568
+ }
569
+ result.extended = extended;
570
+ for (const ext of result.extended.slice(1)) {
571
+ extendTSConfig(result, ext);
572
+ }
573
+ }
574
+ function resolveExtends(extended, from) {
575
+ if (extended === "..") {
576
+ extended = "../tsconfig.json";
577
+ }
578
+ const req = createRequire(from);
579
+ let error;
580
+ try {
581
+ return req.resolve(extended);
582
+ } catch (e) {
583
+ error = e;
584
+ }
585
+ if (extended[0] !== "." && !path4.isAbsolute(extended)) {
586
+ try {
587
+ return req.resolve(`${extended}/tsconfig.json`);
588
+ } catch (e) {
589
+ error = e;
590
+ }
591
+ }
592
+ throw new TSConfckParseError(
593
+ `failed to resolve "extends":"${extended}" in ${from}`,
594
+ "EXTENDS_RESOLVE",
595
+ from,
596
+ error
597
+ );
598
+ }
599
+ var EXTENDABLE_KEYS = [
600
+ "compilerOptions",
601
+ "files",
602
+ "include",
603
+ "exclude",
604
+ "watchOptions",
605
+ "compileOnSave",
606
+ "typeAcquisition",
607
+ "buildOptions"
608
+ ];
609
+ function extendTSConfig(extending, extended) {
610
+ const extendingConfig = extending.tsconfig;
611
+ const extendedConfig = extended.tsconfig;
612
+ const relativePath = native2posix(
613
+ path4.relative(path4.dirname(extending.tsconfigFile), path4.dirname(extended.tsconfigFile))
614
+ );
615
+ for (const key of Object.keys(extendedConfig).filter((key2) => EXTENDABLE_KEYS.includes(key2))) {
616
+ if (key === "compilerOptions") {
617
+ if (!extendingConfig.compilerOptions) {
618
+ extendingConfig.compilerOptions = {};
619
+ }
620
+ for (const option of Object.keys(extendedConfig.compilerOptions)) {
621
+ if (Object.prototype.hasOwnProperty.call(extendingConfig.compilerOptions, option)) {
622
+ continue;
623
+ }
624
+ extendingConfig.compilerOptions[option] = rebaseRelative(
625
+ option,
626
+ extendedConfig.compilerOptions[option],
627
+ relativePath
628
+ );
629
+ }
630
+ } else if (extendingConfig[key] === void 0) {
631
+ if (key === "watchOptions") {
632
+ extendingConfig.watchOptions = {};
633
+ for (const option of Object.keys(extendedConfig.watchOptions)) {
634
+ extendingConfig.watchOptions[option] = rebaseRelative(
635
+ option,
636
+ extendedConfig.watchOptions[option],
637
+ relativePath
638
+ );
639
+ }
640
+ } else {
641
+ extendingConfig[key] = rebaseRelative(key, extendedConfig[key], relativePath);
642
+ }
643
+ }
644
+ }
645
+ }
646
+ var REBASE_KEYS = [
647
+ // root
648
+ "files",
649
+ "include",
650
+ "exclude",
651
+ // compilerOptions
652
+ "baseUrl",
653
+ "rootDir",
654
+ "rootDirs",
655
+ "typeRoots",
656
+ "outDir",
657
+ "outFile",
658
+ "declarationDir",
659
+ // watchOptions
660
+ "excludeDirectories",
661
+ "excludeFiles"
662
+ ];
663
+ function rebaseRelative(key, value, prependPath) {
664
+ if (!REBASE_KEYS.includes(key)) {
665
+ return value;
666
+ }
667
+ if (Array.isArray(value)) {
668
+ return value.map((x) => rebasePath(x, prependPath));
669
+ } else {
670
+ return rebasePath(value, prependPath);
671
+ }
672
+ }
673
+ function rebasePath(value, prependPath) {
674
+ if (path4.isAbsolute(value) || value.startsWith("${configDir}")) {
675
+ return value;
676
+ } else {
677
+ return path4.posix.normalize(path4.posix.join(prependPath, value));
678
+ }
679
+ }
680
+ var TSConfckParseError = class _TSConfckParseError extends Error {
681
+ /**
682
+ * error code
683
+ * @type {string}
684
+ */
685
+ code;
686
+ /**
687
+ * error cause
688
+ * @type { Error | undefined}
689
+ */
690
+ cause;
691
+ /**
692
+ * absolute path of tsconfig file where the error happened
693
+ * @type {string}
694
+ */
695
+ tsconfigFile;
696
+ /**
697
+ *
698
+ * @param {string} message - error message
699
+ * @param {string} code - error code
700
+ * @param {string} tsconfigFile - path to tsconfig file
701
+ * @param {Error?} cause - cause of this error
702
+ */
703
+ constructor(message, code, tsconfigFile, cause) {
704
+ super(message);
705
+ Object.setPrototypeOf(this, _TSConfckParseError.prototype);
706
+ this.name = _TSConfckParseError.name;
707
+ this.code = code;
708
+ this.cause = cause;
709
+ this.tsconfigFile = tsconfigFile;
710
+ }
711
+ };
712
+ function applyDefaults(tsconfig, tsconfigFile) {
713
+ if (isJSConfig(tsconfigFile)) {
714
+ tsconfig.compilerOptions = {
715
+ ...DEFAULT_JSCONFIG_COMPILER_OPTIONS,
716
+ ...tsconfig.compilerOptions
717
+ };
718
+ }
719
+ }
720
+ var DEFAULT_JSCONFIG_COMPILER_OPTIONS = {
721
+ allowJs: true,
722
+ maxNodeModuleJsDepth: 2,
723
+ allowSyntheticDefaultImports: true,
724
+ skipLibCheck: true,
725
+ noEmit: true
726
+ };
727
+ function isJSConfig(configFileName) {
728
+ return path4.basename(configFileName) === "jsconfig.json";
729
+ }
730
+
731
+ // ../../node_modules/tsconfck/src/find-native.js
732
+ init_esm_shims();
733
+ import path5 from "node:path";
734
+ async function findNative(filename, options) {
735
+ let dir = native2posix(path5.dirname(path5.resolve(filename)));
736
+ if (options?.ignoreNodeModules && isInNodeModules(dir)) {
737
+ return null;
738
+ }
739
+ const cache = options?.cache;
740
+ const root = options?.root ? native2posix(path5.resolve(options.root)) : void 0;
741
+ const configName = options?.configName ?? "tsconfig.json";
742
+ if (cache?.hasConfigPath(dir, configName)) {
743
+ return cache.getConfigPath(dir, configName);
744
+ }
745
+ const ts = await loadTS();
746
+ const { findConfigFile, sys } = ts;
747
+ let tsconfigFile = findConfigFile(dir, sys.fileExists, configName);
748
+ if (!tsconfigFile || is_out_of_root(tsconfigFile, root)) {
749
+ tsconfigFile = null;
750
+ }
751
+ if (cache) {
752
+ cache_result(tsconfigFile, dir, cache, root, configName);
753
+ }
754
+ return tsconfigFile;
755
+ }
756
+ function is_out_of_root(tsconfigFile, root) {
757
+ return root && !tsconfigFile.startsWith(root);
758
+ }
759
+ function cache_result(tsconfigFile, fileDir, cache, root, configName) {
760
+ const tsconfigDir = tsconfigFile ? path5.dirname(tsconfigFile) : root;
761
+ const directories = [];
762
+ let dir = fileDir;
763
+ while (dir) {
764
+ directories.push(dir);
765
+ const parent = path5.dirname(dir);
766
+ if (tsconfigDir === dir || parent === dir) {
767
+ break;
768
+ } else {
769
+ dir = parent;
770
+ }
771
+ }
772
+ directories.forEach((d) => {
773
+ cache.setConfigPath(d, Promise.resolve(tsconfigFile), configName);
774
+ });
775
+ }
776
+
777
+ // ../../node_modules/tsconfck/src/parse-native.js
778
+ init_esm_shims();
779
+ import path6 from "node:path";
780
+ var notFoundResult = {
781
+ tsconfigFile: null,
782
+ tsconfig: {},
783
+ result: null
784
+ };
785
+ async function parseNative(filename, options) {
786
+ const cache = options?.cache;
787
+ if (cache?.hasParseResult(filename)) {
788
+ return cache.getParseResult(filename);
789
+ }
790
+ const {
791
+ resolve,
792
+ reject,
793
+ /** @type {Promise<import('./public.d.ts').TSConfckParseNativeResult>}*/
794
+ promise
795
+ } = makePromise();
796
+ cache?.setParseResult(filename, promise);
797
+ try {
798
+ const tsconfigFile = await resolveTSConfigJson(filename, cache) || await findNative(filename, options);
799
+ if (!tsconfigFile) {
800
+ resolve(notFoundResult);
801
+ return promise;
802
+ }
803
+ let result;
804
+ if (filename !== tsconfigFile && cache?.hasParseResult(tsconfigFile)) {
805
+ result = await cache.getParseResult(tsconfigFile);
806
+ } else {
807
+ const ts = await loadTS();
808
+ result = await parseFile2(tsconfigFile, ts, options, filename === tsconfigFile);
809
+ await parseReferences2(result, ts, options);
810
+ cache?.setParseResult(tsconfigFile, Promise.resolve(result));
811
+ }
812
+ resolve(resolveSolutionTSConfig(filename, result));
813
+ return promise;
814
+ } catch (e) {
815
+ reject(e);
816
+ return promise;
817
+ }
818
+ }
819
+ function parseFile2(tsconfigFile, ts, options, skipCache) {
820
+ const cache = options?.cache;
821
+ if (!skipCache && cache?.hasParseResult(tsconfigFile)) {
822
+ return cache.getParseResult(tsconfigFile);
823
+ }
824
+ const posixTSConfigFile = native2posix(tsconfigFile);
825
+ const { parseJsonConfigFileContent, readConfigFile, sys } = ts;
826
+ const { config, error } = readConfigFile(posixTSConfigFile, sys.readFile);
827
+ if (error) {
828
+ throw new TSConfckParseNativeError(error, tsconfigFile, null);
829
+ }
830
+ const host = {
831
+ useCaseSensitiveFileNames: false,
832
+ readDirectory: sys.readDirectory,
833
+ fileExists: sys.fileExists,
834
+ readFile: sys.readFile
835
+ };
836
+ if (options?.ignoreSourceFiles) {
837
+ config.files = [];
838
+ config.include = [];
839
+ }
840
+ const nativeResult = parseJsonConfigFileContent(
841
+ config,
842
+ host,
843
+ path6.dirname(posixTSConfigFile),
844
+ void 0,
845
+ posixTSConfigFile
846
+ );
847
+ checkErrors(nativeResult, tsconfigFile);
848
+ const result = {
849
+ tsconfigFile,
850
+ tsconfig: result2tsconfig(nativeResult, ts, tsconfigFile),
851
+ result: nativeResult
852
+ };
853
+ if (!skipCache) {
854
+ cache?.setParseResult(tsconfigFile, Promise.resolve(result));
855
+ }
856
+ return result;
857
+ }
858
+ async function parseReferences2(result, ts, options) {
859
+ if (!result.tsconfig.references) {
860
+ return;
861
+ }
862
+ const referencedFiles = resolveReferencedTSConfigFiles(result, options);
863
+ result.referenced = await Promise.all(
864
+ referencedFiles.map((file) => parseFile2(file, ts, options))
865
+ );
866
+ result.referenced.forEach((ref) => ref.solution = result);
867
+ }
868
+ function checkErrors(nativeResult, tsconfigFile) {
869
+ const ignoredErrorCodes = [
870
+ // see https://github.com/microsoft/TypeScript/blob/main/src/compiler/diagnosticMessages.json
871
+ 18002,
872
+ // empty files list
873
+ 18003
874
+ // no inputs
875
+ ];
876
+ const criticalError = nativeResult.errors?.find(
877
+ (error) => error.category === 1 && !ignoredErrorCodes.includes(error.code)
878
+ );
879
+ if (criticalError) {
880
+ throw new TSConfckParseNativeError(criticalError, tsconfigFile, nativeResult);
881
+ }
882
+ }
883
+ function result2tsconfig(result, ts, tsconfigFile) {
884
+ const tsconfig = JSON.parse(JSON.stringify(result.raw));
885
+ const ignoredOptions = ["configFilePath", "pathsBasePath"];
886
+ if (result.options && Object.keys(result.options).some((o) => !ignoredOptions.includes(o))) {
887
+ tsconfig.compilerOptions = {
888
+ ...result.options
889
+ };
890
+ for (const ignored of ignoredOptions) {
891
+ delete tsconfig.compilerOptions[ignored];
892
+ }
893
+ }
894
+ const compilerOptions = tsconfig.compilerOptions;
895
+ if (compilerOptions) {
896
+ if (compilerOptions.lib != null) {
897
+ compilerOptions.lib = compilerOptions.lib.map(
898
+ (x) => x.replace(/^lib\./, "").replace(/\.d\.ts$/, "")
899
+ );
900
+ }
901
+ const enumProperties = [
902
+ { name: "importsNotUsedAsValues", enumeration: ts.ImportsNotUsedAsValues },
903
+ { name: "module", enumeration: ts.ModuleKind },
904
+ {
905
+ name: "moduleResolution",
906
+ enumeration: {
907
+ ...ts.ModuleResolutionKind,
908
+ 2: "node"
909
+ /*ts.ModuleResolutionKind uses "Node10" but in tsconfig it is just node"*/
910
+ }
911
+ },
912
+ {
913
+ name: "newLine",
914
+ enumeration: { 0: "crlf", 1: "lf" }
915
+ /*ts.NewLineKind uses different names*/
916
+ },
917
+ { name: "target", enumeration: ts.ScriptTarget }
918
+ ];
919
+ for (const prop of enumProperties) {
920
+ if (compilerOptions[prop.name] != null && typeof compilerOptions[prop.name] === "number") {
921
+ compilerOptions[prop.name] = prop.enumeration[compilerOptions[prop.name]].toLowerCase();
922
+ }
923
+ }
924
+ if (compilerOptions.target === "latest") {
925
+ compilerOptions.target = "esnext";
926
+ }
927
+ }
928
+ if (result.watchOptions) {
929
+ tsconfig.watchOptions = {
930
+ ...result.watchOptions
931
+ };
932
+ }
933
+ const watchOptions = tsconfig.watchOptions;
934
+ if (watchOptions) {
935
+ const enumProperties = [
936
+ { name: "watchFile", enumeration: ts.WatchFileKind },
937
+ { name: "watchDirectory", enumeration: ts.WatchDirectoryKind },
938
+ { name: "fallbackPolling", enumeration: ts.PollingWatchKind }
939
+ ];
940
+ for (const prop of enumProperties) {
941
+ if (watchOptions[prop.name] != null && typeof watchOptions[prop.name] === "number") {
942
+ const enumVal = prop.enumeration[watchOptions[prop.name]];
943
+ watchOptions[prop.name] = enumVal.charAt(0).toLowerCase() + enumVal.slice(1);
944
+ }
945
+ }
946
+ }
947
+ if (tsconfig.compileOnSave === false) {
948
+ delete tsconfig.compileOnSave;
949
+ }
950
+ const parseResult = { tsconfig, tsconfigFile };
951
+ replaceTokens(parseResult);
952
+ return parseResult.tsconfig;
953
+ }
954
+ var TSConfckParseNativeError = class _TSConfckParseNativeError extends Error {
955
+ /**
956
+ *
957
+ * @param {TSDiagnosticError} diagnostic - diagnostics of ts
958
+ * @param {string} tsconfigFile - file that errored
959
+ * @param {any?} result - parsed result, if any
960
+ */
961
+ constructor(diagnostic, tsconfigFile, result) {
962
+ super(diagnostic.messageText);
963
+ Object.setPrototypeOf(this, _TSConfckParseNativeError.prototype);
964
+ this.name = _TSConfckParseNativeError.name;
965
+ this.code = `TS ${diagnostic.code}`;
966
+ this.diagnostic = diagnostic;
967
+ this.result = result;
968
+ this.tsconfigFile = tsconfigFile;
969
+ }
970
+ /**
971
+ * code of typescript diagnostic, prefixed with "TS "
972
+ * @type {string}
973
+ */
974
+ code;
975
+ /**
976
+ * full ts diagnostic that caused this error
977
+ * @type {TSDiagnosticError}
978
+ */
979
+ diagnostic;
980
+ /**
981
+ * absolute path of tsconfig file where the error happened
982
+ * @type {string}
983
+ */
984
+ tsconfigFile;
985
+ /**
986
+ * native result if present, contains all errors in result.errors
987
+ * @type {any|undefined}
988
+ */
989
+ result;
990
+ };
991
+
992
+ // ../../node_modules/tsconfck/src/cache.js
993
+ init_esm_shims();
994
+ var TSConfckCache = class {
995
+ /**
996
+ * clear cache, use this if you have a long running process and tsconfig files have been added,changed or deleted
997
+ */
998
+ clear() {
999
+ this.#configPaths.clear();
1000
+ this.#parsed.clear();
1001
+ }
1002
+ /**
1003
+ * has cached closest config for files in dir
1004
+ * @param {string} dir
1005
+ * @param {string} [configName=tsconfig.json]
1006
+ * @returns {boolean}
1007
+ */
1008
+ hasConfigPath(dir, configName = "tsconfig.json") {
1009
+ return this.#configPaths.has(`${dir}/${configName}`);
1010
+ }
1011
+ /**
1012
+ * get cached closest tsconfig for files in dir
1013
+ * @param {string} dir
1014
+ * @param {string} [configName=tsconfig.json]
1015
+ * @returns {Promise<string|null>|string|null}
1016
+ * @throws {unknown} if cached value is an error
1017
+ */
1018
+ getConfigPath(dir, configName = "tsconfig.json") {
1019
+ const key = `${dir}/${configName}`;
1020
+ const value = this.#configPaths.get(key);
1021
+ if (value == null || value.length || value.then) {
1022
+ return value;
1023
+ } else {
1024
+ throw value;
1025
+ }
1026
+ }
1027
+ /**
1028
+ * has parsed tsconfig for file
1029
+ * @param {string} file
1030
+ * @returns {boolean}
1031
+ */
1032
+ hasParseResult(file) {
1033
+ return this.#parsed.has(file);
1034
+ }
1035
+ /**
1036
+ * get parsed tsconfig for file
1037
+ * @param {string} file
1038
+ * @returns {Promise<T>|T}
1039
+ * @throws {unknown} if cached value is an error
1040
+ */
1041
+ getParseResult(file) {
1042
+ const value = this.#parsed.get(file);
1043
+ if (value.then || value.tsconfig) {
1044
+ return value;
1045
+ } else {
1046
+ throw value;
1047
+ }
1048
+ }
1049
+ /**
1050
+ * @internal
1051
+ * @private
1052
+ * @param file
1053
+ * @param {boolean} isRootFile a flag to check if current file which involking the parse() api, used to distinguish the normal cache which only parsed by parseFile()
1054
+ * @param {Promise<T>} result
1055
+ */
1056
+ setParseResult(file, result, isRootFile = false) {
1057
+ Object.defineProperty(result, "_isRootFile_", {
1058
+ value: isRootFile,
1059
+ writable: false,
1060
+ enumerable: false,
1061
+ configurable: false
1062
+ });
1063
+ this.#parsed.set(file, result);
1064
+ result.then((parsed) => {
1065
+ if (this.#parsed.get(file) === result) {
1066
+ this.#parsed.set(file, parsed);
1067
+ }
1068
+ }).catch((e) => {
1069
+ if (this.#parsed.get(file) === result) {
1070
+ this.#parsed.set(file, e);
1071
+ }
1072
+ });
1073
+ }
1074
+ /**
1075
+ * @internal
1076
+ * @private
1077
+ * @param {string} dir
1078
+ * @param {Promise<string|null>} configPath
1079
+ * @param {string} [configName=tsconfig.json]
1080
+ */
1081
+ setConfigPath(dir, configPath, configName = "tsconfig.json") {
1082
+ const key = `${dir}/${configName}`;
1083
+ this.#configPaths.set(key, configPath);
1084
+ configPath.then((path7) => {
1085
+ if (this.#configPaths.get(key) === configPath) {
1086
+ this.#configPaths.set(key, path7);
1087
+ }
1088
+ }).catch((e) => {
1089
+ if (this.#configPaths.get(key) === configPath) {
1090
+ this.#configPaths.set(key, e);
1091
+ }
1092
+ });
1093
+ }
1094
+ /**
1095
+ * map directories to their closest tsconfig.json
1096
+ * @internal
1097
+ * @private
1098
+ * @type{Map<string,(Promise<string|null>|string|null)>}
1099
+ */
1100
+ #configPaths = /* @__PURE__ */ new Map();
1101
+ /**
1102
+ * map files to their parsed tsconfig result
1103
+ * @internal
1104
+ * @private
1105
+ * @type {Map<string,(Promise<T>|T)> }
1106
+ */
1107
+ #parsed = /* @__PURE__ */ new Map();
1108
+ };
1109
+ export {
1110
+ TSConfckCache,
1111
+ TSConfckParseError,
1112
+ TSConfckParseNativeError,
1113
+ find,
1114
+ findAll,
1115
+ findNative,
1116
+ parse,
1117
+ parseNative,
1118
+ toJson
1119
+ };
1120
+ //# sourceMappingURL=src-MHMTXBSY.js.map