@xo-code/cli 0.1.2 → 0.1.3
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/LICENSE +21 -0
- package/dist/index.js +648 -497
- package/package.json +11 -12
package/dist/index.js
CHANGED
|
@@ -1559,14 +1559,14 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1559
1559
|
* @return {Command} `this` command for chaining
|
|
1560
1560
|
* @private
|
|
1561
1561
|
*/
|
|
1562
|
-
_optionEx(
|
|
1562
|
+
_optionEx(config2, flags, description, fn, defaultValue) {
|
|
1563
1563
|
if (typeof flags === "object" && flags instanceof Option2) {
|
|
1564
1564
|
throw new Error(
|
|
1565
1565
|
"To add an Option object use addOption() instead of option() or requiredOption()"
|
|
1566
1566
|
);
|
|
1567
1567
|
}
|
|
1568
1568
|
const option = this.createOption(flags, description);
|
|
1569
|
-
option.makeOptionMandatory(!!
|
|
1569
|
+
option.makeOptionMandatory(!!config2.mandatory);
|
|
1570
1570
|
if (typeof fn === "function") {
|
|
1571
1571
|
option.default(defaultValue).argParser(fn);
|
|
1572
1572
|
} else if (fn instanceof RegExp) {
|
|
@@ -2470,9 +2470,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2470
2470
|
this._outputConfiguration.writeErr("\n");
|
|
2471
2471
|
this.outputHelp({ error: true });
|
|
2472
2472
|
}
|
|
2473
|
-
const
|
|
2474
|
-
const exitCode =
|
|
2475
|
-
const code =
|
|
2473
|
+
const config2 = errorOptions || {};
|
|
2474
|
+
const exitCode = config2.exitCode || 1;
|
|
2475
|
+
const code = config2.code || "commander.error";
|
|
2476
2476
|
this._exit(exitCode, code, message);
|
|
2477
2477
|
}
|
|
2478
2478
|
/**
|
|
@@ -33374,19 +33374,19 @@ ${lanes.join("\n")}
|
|
|
33374
33374
|
pollScheduled = host.setTimeout(pollQueue, 2e3, "pollQueue");
|
|
33375
33375
|
}
|
|
33376
33376
|
}
|
|
33377
|
-
function createSingleWatcherPerName(
|
|
33377
|
+
function createSingleWatcherPerName(cache2, useCaseSensitiveFileNames2, name, callback, createWatcher) {
|
|
33378
33378
|
const toCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames2);
|
|
33379
33379
|
const path14 = toCanonicalFileName(name);
|
|
33380
|
-
const existing =
|
|
33380
|
+
const existing = cache2.get(path14);
|
|
33381
33381
|
if (existing) {
|
|
33382
33382
|
existing.callbacks.push(callback);
|
|
33383
33383
|
} else {
|
|
33384
|
-
|
|
33384
|
+
cache2.set(path14, {
|
|
33385
33385
|
watcher: createWatcher(
|
|
33386
33386
|
// Cant infer types correctly so lets satisfy checker
|
|
33387
33387
|
(param1, param2, param3) => {
|
|
33388
33388
|
var _a;
|
|
33389
|
-
return (_a =
|
|
33389
|
+
return (_a = cache2.get(path14)) == null ? void 0 : _a.callbacks.slice().forEach((cb) => cb(param1, param2, param3));
|
|
33390
33390
|
}
|
|
33391
33391
|
),
|
|
33392
33392
|
callbacks: [callback]
|
|
@@ -33394,10 +33394,10 @@ ${lanes.join("\n")}
|
|
|
33394
33394
|
}
|
|
33395
33395
|
return {
|
|
33396
33396
|
close: () => {
|
|
33397
|
-
const watcher =
|
|
33397
|
+
const watcher = cache2.get(path14);
|
|
33398
33398
|
if (!watcher) return;
|
|
33399
33399
|
if (!orderedRemoveItem(watcher.callbacks, callback) || watcher.callbacks.length) return;
|
|
33400
|
-
|
|
33400
|
+
cache2.delete(path14);
|
|
33401
33401
|
closeFileWatcherOf(watcher);
|
|
33402
33402
|
}
|
|
33403
33403
|
};
|
|
@@ -33433,7 +33433,7 @@ ${lanes.join("\n")}
|
|
|
33433
33433
|
setTimeout: setTimeout2,
|
|
33434
33434
|
clearTimeout: clearTimeout2
|
|
33435
33435
|
}) {
|
|
33436
|
-
const
|
|
33436
|
+
const cache2 = /* @__PURE__ */ new Map();
|
|
33437
33437
|
const callbackCache = createMultiMap();
|
|
33438
33438
|
const cacheToUpdateChildWatches = /* @__PURE__ */ new Map();
|
|
33439
33439
|
let timerToUpdateChildWatches;
|
|
@@ -33442,7 +33442,7 @@ ${lanes.join("\n")}
|
|
|
33442
33442
|
return (dirName, callback, recursive, options) => recursive ? createDirectoryWatcher(dirName, options, callback) : watchDirectory(dirName, callback, recursive, options);
|
|
33443
33443
|
function createDirectoryWatcher(dirName, options, callback, link) {
|
|
33444
33444
|
const dirPath = toCanonicalFilePath(dirName);
|
|
33445
|
-
let directoryWatcher =
|
|
33445
|
+
let directoryWatcher = cache2.get(dirPath);
|
|
33446
33446
|
if (directoryWatcher) {
|
|
33447
33447
|
directoryWatcher.refCount++;
|
|
33448
33448
|
} else {
|
|
@@ -33453,7 +33453,7 @@ ${lanes.join("\n")}
|
|
|
33453
33453
|
var _a;
|
|
33454
33454
|
if (isIgnoredPath(fileName, options)) return;
|
|
33455
33455
|
if (options == null ? void 0 : options.synchronousWatchDirectory) {
|
|
33456
|
-
if (!((_a =
|
|
33456
|
+
if (!((_a = cache2.get(dirPath)) == null ? void 0 : _a.targetWatcher)) invokeCallbacks(dirName, dirPath, fileName);
|
|
33457
33457
|
updateChildWatches(dirName, dirPath, options);
|
|
33458
33458
|
} else {
|
|
33459
33459
|
nonSyncUpdateChildWatches(dirName, dirPath, fileName, options);
|
|
@@ -33468,7 +33468,7 @@ ${lanes.join("\n")}
|
|
|
33468
33468
|
targetWatcher: void 0,
|
|
33469
33469
|
links: void 0
|
|
33470
33470
|
};
|
|
33471
|
-
|
|
33471
|
+
cache2.set(dirPath, directoryWatcher);
|
|
33472
33472
|
updateChildWatches(dirName, dirPath, options);
|
|
33473
33473
|
}
|
|
33474
33474
|
if (link) (directoryWatcher.links ?? (directoryWatcher.links = /* @__PURE__ */ new Set())).add(link);
|
|
@@ -33480,12 +33480,12 @@ ${lanes.join("\n")}
|
|
|
33480
33480
|
dirName,
|
|
33481
33481
|
close: () => {
|
|
33482
33482
|
var _a;
|
|
33483
|
-
const directoryWatcher2 = Debug.checkDefined(
|
|
33483
|
+
const directoryWatcher2 = Debug.checkDefined(cache2.get(dirPath));
|
|
33484
33484
|
if (callbackToAdd) callbackCache.remove(dirPath, callbackToAdd);
|
|
33485
33485
|
if (link) (_a = directoryWatcher2.links) == null ? void 0 : _a.delete(link);
|
|
33486
33486
|
directoryWatcher2.refCount--;
|
|
33487
33487
|
if (directoryWatcher2.refCount) return;
|
|
33488
|
-
|
|
33488
|
+
cache2.delete(dirPath);
|
|
33489
33489
|
directoryWatcher2.links = void 0;
|
|
33490
33490
|
closeFileWatcherOf(directoryWatcher2);
|
|
33491
33491
|
closeTargetWatcher(directoryWatcher2);
|
|
@@ -33521,7 +33521,7 @@ ${lanes.join("\n")}
|
|
|
33521
33521
|
}
|
|
33522
33522
|
}
|
|
33523
33523
|
});
|
|
33524
|
-
(_b = (_a =
|
|
33524
|
+
(_b = (_a = cache2.get(dirPath)) == null ? void 0 : _a.links) == null ? void 0 : _b.forEach((link) => {
|
|
33525
33525
|
const toPathInLink = (fileName2) => combinePaths(link, getRelativePathFromDirectory(dirName, fileName2, toCanonicalFilePath));
|
|
33526
33526
|
if (invokeMap) {
|
|
33527
33527
|
invokeCallbacks(link, toCanonicalFilePath(link), invokeMap, fileNames == null ? void 0 : fileNames.map(toPathInLink));
|
|
@@ -33531,7 +33531,7 @@ ${lanes.join("\n")}
|
|
|
33531
33531
|
});
|
|
33532
33532
|
}
|
|
33533
33533
|
function nonSyncUpdateChildWatches(dirName, dirPath, fileName, options) {
|
|
33534
|
-
const parentWatcher =
|
|
33534
|
+
const parentWatcher = cache2.get(dirPath);
|
|
33535
33535
|
if (parentWatcher && fileSystemEntryExists(
|
|
33536
33536
|
dirName,
|
|
33537
33537
|
1
|
|
@@ -33569,7 +33569,7 @@ ${lanes.join("\n")}
|
|
|
33569
33569
|
const { value: [dirPath, { dirName, options, fileNames }] } = result;
|
|
33570
33570
|
cacheToUpdateChildWatches.delete(dirPath);
|
|
33571
33571
|
const hasChanges = updateChildWatches(dirName, dirPath, options);
|
|
33572
|
-
if (!((_a =
|
|
33572
|
+
if (!((_a = cache2.get(dirPath)) == null ? void 0 : _a.targetWatcher)) invokeCallbacks(dirName, dirPath, invokeMap, hasChanges ? void 0 : fileNames);
|
|
33573
33573
|
}
|
|
33574
33574
|
sysLog(`sysLog:: invokingWatchers:: Elapsed:: ${timestamp() - start}ms:: ${cacheToUpdateChildWatches.size}`);
|
|
33575
33575
|
callbackCache.forEach((callbacks, rootDirName) => {
|
|
@@ -33593,7 +33593,7 @@ ${lanes.join("\n")}
|
|
|
33593
33593
|
parentWatcher.childWatches = emptyArray;
|
|
33594
33594
|
for (const childWatcher of existingChildWatches) {
|
|
33595
33595
|
childWatcher.close();
|
|
33596
|
-
removeChildWatches(
|
|
33596
|
+
removeChildWatches(cache2.get(toCanonicalFilePath(childWatcher.dirName)));
|
|
33597
33597
|
}
|
|
33598
33598
|
}
|
|
33599
33599
|
function closeTargetWatcher(watcher) {
|
|
@@ -33603,7 +33603,7 @@ ${lanes.join("\n")}
|
|
|
33603
33603
|
}
|
|
33604
33604
|
}
|
|
33605
33605
|
function updateChildWatches(parentDir, parentDirPath, options) {
|
|
33606
|
-
const parentWatcher =
|
|
33606
|
+
const parentWatcher = cache2.get(parentDirPath);
|
|
33607
33607
|
if (!parentWatcher) return false;
|
|
33608
33608
|
const target = normalizePath(realpath(parentDir));
|
|
33609
33609
|
let hasChanges;
|
|
@@ -34036,9 +34036,9 @@ ${lanes.join("\n")}
|
|
|
34036
34036
|
path14,
|
|
34037
34037
|
data,
|
|
34038
34038
|
!!writeBom,
|
|
34039
|
-
(
|
|
34040
|
-
(
|
|
34041
|
-
(
|
|
34039
|
+
(path23, data2, writeByteOrderMark) => originalWriteFile.call(sys2, path23, data2, writeByteOrderMark),
|
|
34040
|
+
(path23) => sys2.createDirectory(path23),
|
|
34041
|
+
(path23) => sys2.directoryExists(path23)
|
|
34042
34042
|
);
|
|
34043
34043
|
}
|
|
34044
34044
|
var sys = (() => {
|
|
@@ -48056,13 +48056,13 @@ ${lanes.join("\n")}
|
|
|
48056
48056
|
function hasAnySymlinks() {
|
|
48057
48057
|
return !!(symlinkedFiles == null ? void 0 : symlinkedFiles.size) || !!symlinkedDirectories && !!forEachEntry(symlinkedDirectories, (value) => !!value);
|
|
48058
48058
|
}
|
|
48059
|
-
function processResolution(
|
|
48059
|
+
function processResolution(cache2, resolution) {
|
|
48060
48060
|
if (!resolution || !resolution.originalPath || !resolution.resolvedFileName) return;
|
|
48061
48061
|
const { resolvedFileName, originalPath } = resolution;
|
|
48062
|
-
|
|
48062
|
+
cache2.setSymlinkedFile(toPath(originalPath, cwd, getCanonicalFileName), resolvedFileName);
|
|
48063
48063
|
const [commonResolved, commonOriginal] = guessDirectorySymlink(resolvedFileName, originalPath, cwd, getCanonicalFileName) || emptyArray;
|
|
48064
48064
|
if (commonResolved && commonOriginal) {
|
|
48065
|
-
|
|
48065
|
+
cache2.setSymlinkedDirectory(
|
|
48066
48066
|
commonOriginal,
|
|
48067
48067
|
{
|
|
48068
48068
|
real: ensureTrailingDirectorySeparator(commonResolved),
|
|
@@ -48245,13 +48245,13 @@ ${lanes.join("\n")}
|
|
|
48245
48245
|
visitDirectory(basePath, combinePaths(currentDirectory, basePath), depth);
|
|
48246
48246
|
}
|
|
48247
48247
|
return flatten(results);
|
|
48248
|
-
function visitDirectory(
|
|
48248
|
+
function visitDirectory(path23, absolutePath, depth2) {
|
|
48249
48249
|
const canonicalPath = toCanonical(realpath(absolutePath));
|
|
48250
48250
|
if (visited.has(canonicalPath)) return;
|
|
48251
48251
|
visited.set(canonicalPath, true);
|
|
48252
|
-
const { files, directories } = getFileSystemEntries(
|
|
48252
|
+
const { files, directories } = getFileSystemEntries(path23);
|
|
48253
48253
|
for (const current of toSorted(files, compareStringsCaseSensitive)) {
|
|
48254
|
-
const name = combinePaths(
|
|
48254
|
+
const name = combinePaths(path23, current);
|
|
48255
48255
|
const absoluteName = combinePaths(absolutePath, current);
|
|
48256
48256
|
if (extensions && !fileExtensionIsOneOf(name, extensions)) continue;
|
|
48257
48257
|
if (excludeRegex && excludeRegex.test(absoluteName)) continue;
|
|
@@ -48271,7 +48271,7 @@ ${lanes.join("\n")}
|
|
|
48271
48271
|
}
|
|
48272
48272
|
}
|
|
48273
48273
|
for (const current of toSorted(directories, compareStringsCaseSensitive)) {
|
|
48274
|
-
const name = combinePaths(
|
|
48274
|
+
const name = combinePaths(path23, current);
|
|
48275
48275
|
const absoluteName = combinePaths(absolutePath, current);
|
|
48276
48276
|
if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) && (!excludeRegex || !excludeRegex.test(absoluteName))) {
|
|
48277
48277
|
visitDirectory(name, absoluteName, depth2);
|
|
@@ -48532,10 +48532,10 @@ ${lanes.join("\n")}
|
|
|
48532
48532
|
const match = str2.match(/\//g);
|
|
48533
48533
|
return match ? match.length : 0;
|
|
48534
48534
|
}
|
|
48535
|
-
function compareNumberOfDirectorySeparators(path1,
|
|
48535
|
+
function compareNumberOfDirectorySeparators(path1, path23) {
|
|
48536
48536
|
return compareValues(
|
|
48537
48537
|
numberOfDirectorySeparators(path1),
|
|
48538
|
-
numberOfDirectorySeparators(
|
|
48538
|
+
numberOfDirectorySeparators(path23)
|
|
48539
48539
|
);
|
|
48540
48540
|
}
|
|
48541
48541
|
var extensionsToRemove = [
|
|
@@ -70632,7 +70632,7 @@ ${lanes.join("\n")}
|
|
|
70632
70632
|
const pathOptions = { configFilePath: getNormalizedAbsolutePath(configFileName, host.getCurrentDirectory()), useCaseSensitiveFileNames: host.useCaseSensitiveFileNames };
|
|
70633
70633
|
const optionMap = serializeCompilerOptions(configParseResult.options, pathOptions);
|
|
70634
70634
|
const watchOptionMap = configParseResult.watchOptions && serializeWatchOptions(configParseResult.watchOptions);
|
|
70635
|
-
const
|
|
70635
|
+
const config2 = {
|
|
70636
70636
|
compilerOptions: {
|
|
70637
70637
|
...optionMapToObject(optionMap),
|
|
70638
70638
|
showConfig: void 0,
|
|
@@ -70666,8 +70666,8 @@ ${lanes.join("\n")}
|
|
|
70666
70666
|
}
|
|
70667
70667
|
}
|
|
70668
70668
|
}
|
|
70669
|
-
assign(
|
|
70670
|
-
return
|
|
70669
|
+
assign(config2.compilerOptions, optionMapToObject(serializeCompilerOptions(impliedCompilerOptions, pathOptions)));
|
|
70670
|
+
return config2;
|
|
70671
70671
|
}
|
|
70672
70672
|
function optionMapToObject(optionMap) {
|
|
70673
70673
|
return Object.fromEntries(optionMap);
|
|
@@ -70685,12 +70685,12 @@ ${lanes.join("\n")}
|
|
|
70685
70685
|
const includeRe = patterns.includeFilePattern && getRegexFromPattern(patterns.includeFilePattern, host.useCaseSensitiveFileNames);
|
|
70686
70686
|
if (includeRe) {
|
|
70687
70687
|
if (excludeRe) {
|
|
70688
|
-
return (
|
|
70688
|
+
return (path23) => !(includeRe.test(path23) && !excludeRe.test(path23));
|
|
70689
70689
|
}
|
|
70690
|
-
return (
|
|
70690
|
+
return (path23) => !includeRe.test(path23);
|
|
70691
70691
|
}
|
|
70692
70692
|
if (excludeRe) {
|
|
70693
|
-
return (
|
|
70693
|
+
return (path23) => excludeRe.test(path23);
|
|
70694
70694
|
}
|
|
70695
70695
|
return returnTrue;
|
|
70696
70696
|
}
|
|
@@ -71394,7 +71394,7 @@ ${lanes.join("\n")}
|
|
|
71394
71394
|
if (extendedConfigCache && (value = extendedConfigCache.get(path14))) {
|
|
71395
71395
|
({ extendedResult, extendedConfig } = value);
|
|
71396
71396
|
} else {
|
|
71397
|
-
extendedResult = readJsonConfigFile(extendedConfigPath, (
|
|
71397
|
+
extendedResult = readJsonConfigFile(extendedConfigPath, (path23) => host.readFile(path23));
|
|
71398
71398
|
if (!extendedResult.parseDiagnostics.length) {
|
|
71399
71399
|
extendedConfig = parseConfig(
|
|
71400
71400
|
/*json*/
|
|
@@ -71893,7 +71893,7 @@ ${lanes.join("\n")}
|
|
|
71893
71893
|
Debug.assert(extensionIsTS(resolved.extension));
|
|
71894
71894
|
return { fileName: resolved.path, packageId: resolved.packageId };
|
|
71895
71895
|
}
|
|
71896
|
-
function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state,
|
|
71896
|
+
function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state, cache2, alternateResult) {
|
|
71897
71897
|
if (!state.resultFromCache && !state.compilerOptions.preserveSymlinks && resolved && isExternalLibraryImport && !resolved.originalPath && !isExternalModuleNameRelative(moduleName)) {
|
|
71898
71898
|
const { resolvedFileName, originalPath } = getOriginalAndResolvedFileName(resolved.path, state.host, state.traceEnabled);
|
|
71899
71899
|
if (originalPath) resolved = { ...resolved, path: resolvedFileName, originalPath };
|
|
@@ -71905,13 +71905,13 @@ ${lanes.join("\n")}
|
|
|
71905
71905
|
affectingLocations,
|
|
71906
71906
|
diagnostics,
|
|
71907
71907
|
state.resultFromCache,
|
|
71908
|
-
|
|
71908
|
+
cache2,
|
|
71909
71909
|
alternateResult
|
|
71910
71910
|
);
|
|
71911
71911
|
}
|
|
71912
|
-
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache,
|
|
71912
|
+
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache, cache2, alternateResult) {
|
|
71913
71913
|
if (resultFromCache) {
|
|
71914
|
-
if (!(
|
|
71914
|
+
if (!(cache2 == null ? void 0 : cache2.isReadonly)) {
|
|
71915
71915
|
resultFromCache.failedLookupLocations = updateResolutionField(resultFromCache.failedLookupLocations, failedLookupLocations);
|
|
71916
71916
|
resultFromCache.affectingLocations = updateResolutionField(resultFromCache.affectingLocations, affectingLocations);
|
|
71917
71917
|
resultFromCache.resolutionDiagnostics = updateResolutionField(resultFromCache.resolutionDiagnostics, diagnostics);
|
|
@@ -72067,9 +72067,9 @@ ${lanes.join("\n")}
|
|
|
72067
72067
|
return typeRoots;
|
|
72068
72068
|
}
|
|
72069
72069
|
var nodeModulesAtTypes = combinePaths("node_modules", "@types");
|
|
72070
|
-
function arePathsEqual(path1,
|
|
72070
|
+
function arePathsEqual(path1, path23, host) {
|
|
72071
72071
|
const useCaseSensitiveFileNames2 = typeof host.useCaseSensitiveFileNames === "function" ? host.useCaseSensitiveFileNames() : host.useCaseSensitiveFileNames;
|
|
72072
|
-
return comparePaths(path1,
|
|
72072
|
+
return comparePaths(path1, path23, !useCaseSensitiveFileNames2) === 0;
|
|
72073
72073
|
}
|
|
72074
72074
|
function getOriginalAndResolvedFileName(fileName, host, traceEnabled) {
|
|
72075
72075
|
const resolvedFileName = realPath(fileName, host, traceEnabled);
|
|
@@ -72084,16 +72084,16 @@ ${lanes.join("\n")}
|
|
|
72084
72084
|
const nameForLookup = endsWith(typeRoot, "/node_modules/@types") || endsWith(typeRoot, "/node_modules/@types/") ? mangleScopedPackageNameWithTrace(typeReferenceDirectiveName, moduleResolutionState) : typeReferenceDirectiveName;
|
|
72085
72085
|
return combinePaths(typeRoot, nameForLookup);
|
|
72086
72086
|
}
|
|
72087
|
-
function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference,
|
|
72087
|
+
function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, cache2, resolutionMode) {
|
|
72088
72088
|
Debug.assert(typeof typeReferenceDirectiveName === "string", "Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself.");
|
|
72089
72089
|
const traceEnabled = isTraceEnabled(options, host);
|
|
72090
72090
|
if (redirectedReference) {
|
|
72091
72091
|
options = redirectedReference.commandLine.options;
|
|
72092
72092
|
}
|
|
72093
72093
|
const containingDirectory = containingFile ? getDirectoryPath(containingFile) : void 0;
|
|
72094
|
-
let result = containingDirectory ?
|
|
72094
|
+
let result = containingDirectory ? cache2 == null ? void 0 : cache2.getFromDirectoryCache(typeReferenceDirectiveName, resolutionMode, containingDirectory, redirectedReference) : void 0;
|
|
72095
72095
|
if (!result && containingDirectory && !isExternalModuleNameRelative(typeReferenceDirectiveName)) {
|
|
72096
|
-
result =
|
|
72096
|
+
result = cache2 == null ? void 0 : cache2.getFromNonRelativeNameCache(typeReferenceDirectiveName, resolutionMode, containingDirectory, redirectedReference);
|
|
72097
72097
|
}
|
|
72098
72098
|
if (result) {
|
|
72099
72099
|
if (traceEnabled) {
|
|
@@ -72141,7 +72141,7 @@ ${lanes.join("\n")}
|
|
|
72141
72141
|
traceEnabled,
|
|
72142
72142
|
failedLookupLocations,
|
|
72143
72143
|
affectingLocations,
|
|
72144
|
-
packageJsonInfoCache:
|
|
72144
|
+
packageJsonInfoCache: cache2,
|
|
72145
72145
|
features,
|
|
72146
72146
|
conditions,
|
|
72147
72147
|
requestContainingDirectory: containingDirectory,
|
|
@@ -72175,15 +72175,15 @@ ${lanes.join("\n")}
|
|
|
72175
72175
|
affectingLocations: initializeResolutionField(affectingLocations),
|
|
72176
72176
|
resolutionDiagnostics: initializeResolutionField(diagnostics)
|
|
72177
72177
|
};
|
|
72178
|
-
if (containingDirectory &&
|
|
72179
|
-
|
|
72178
|
+
if (containingDirectory && cache2 && !cache2.isReadonly) {
|
|
72179
|
+
cache2.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(
|
|
72180
72180
|
typeReferenceDirectiveName,
|
|
72181
72181
|
/*mode*/
|
|
72182
72182
|
resolutionMode,
|
|
72183
72183
|
result
|
|
72184
72184
|
);
|
|
72185
72185
|
if (!isExternalModuleNameRelative(typeReferenceDirectiveName)) {
|
|
72186
|
-
|
|
72186
|
+
cache2.getOrCreateCacheForNonRelativeName(typeReferenceDirectiveName, resolutionMode, redirectedReference).set(containingDirectory, result);
|
|
72187
72187
|
}
|
|
72188
72188
|
}
|
|
72189
72189
|
if (traceEnabled) traceResult(result);
|
|
@@ -72318,8 +72318,8 @@ ${lanes.join("\n")}
|
|
|
72318
72318
|
}
|
|
72319
72319
|
return concatenate(conditions, options.customConditions);
|
|
72320
72320
|
}
|
|
72321
|
-
function resolvePackageNameToPackageJson(packageName, containingDirectory, options, host,
|
|
72322
|
-
const moduleResolutionState = getTemporaryModuleResolutionState(
|
|
72321
|
+
function resolvePackageNameToPackageJson(packageName, containingDirectory, options, host, cache2) {
|
|
72322
|
+
const moduleResolutionState = getTemporaryModuleResolutionState(cache2 == null ? void 0 : cache2.getPackageJsonInfoCache(), host, options);
|
|
72323
72323
|
return forEachAncestorDirectory(containingDirectory, (ancestorDirectory) => {
|
|
72324
72324
|
if (getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
72325
72325
|
const nodeModulesFolder = combinePaths(ancestorDirectory, "node_modules");
|
|
@@ -72459,27 +72459,27 @@ ${lanes.join("\n")}
|
|
|
72459
72459
|
}
|
|
72460
72460
|
}
|
|
72461
72461
|
function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName) {
|
|
72462
|
-
let
|
|
72462
|
+
let cache2;
|
|
72463
72463
|
return { getPackageJsonInfo: getPackageJsonInfo2, setPackageJsonInfo, clear: clear2, getInternalMap };
|
|
72464
72464
|
function getPackageJsonInfo2(packageJsonPath) {
|
|
72465
|
-
return
|
|
72465
|
+
return cache2 == null ? void 0 : cache2.get(toPath(packageJsonPath, currentDirectory, getCanonicalFileName));
|
|
72466
72466
|
}
|
|
72467
72467
|
function setPackageJsonInfo(packageJsonPath, info) {
|
|
72468
|
-
(
|
|
72468
|
+
(cache2 || (cache2 = /* @__PURE__ */ new Map())).set(toPath(packageJsonPath, currentDirectory, getCanonicalFileName), info);
|
|
72469
72469
|
}
|
|
72470
72470
|
function clear2() {
|
|
72471
|
-
|
|
72471
|
+
cache2 = void 0;
|
|
72472
72472
|
}
|
|
72473
72473
|
function getInternalMap() {
|
|
72474
|
-
return
|
|
72474
|
+
return cache2;
|
|
72475
72475
|
}
|
|
72476
72476
|
}
|
|
72477
72477
|
function getOrCreateCache(cacheWithRedirects, redirectedReference, key, create) {
|
|
72478
|
-
const
|
|
72479
|
-
let result =
|
|
72478
|
+
const cache2 = cacheWithRedirects.getOrCreateMapOfCacheRedirects(redirectedReference);
|
|
72479
|
+
let result = cache2.get(key);
|
|
72480
72480
|
if (!result) {
|
|
72481
72481
|
result = create();
|
|
72482
|
-
|
|
72482
|
+
cache2.set(key, result);
|
|
72483
72483
|
}
|
|
72484
72484
|
return result;
|
|
72485
72485
|
}
|
|
@@ -72514,17 +72514,17 @@ ${lanes.join("\n")}
|
|
|
72514
72514
|
function createModeAwareCache() {
|
|
72515
72515
|
const underlying = /* @__PURE__ */ new Map();
|
|
72516
72516
|
const memoizedReverseKeys = /* @__PURE__ */ new Map();
|
|
72517
|
-
const
|
|
72517
|
+
const cache2 = {
|
|
72518
72518
|
get(specifier, mode) {
|
|
72519
72519
|
return underlying.get(getUnderlyingCacheKey(specifier, mode));
|
|
72520
72520
|
},
|
|
72521
72521
|
set(specifier, mode, value) {
|
|
72522
72522
|
underlying.set(getUnderlyingCacheKey(specifier, mode), value);
|
|
72523
|
-
return
|
|
72523
|
+
return cache2;
|
|
72524
72524
|
},
|
|
72525
72525
|
delete(specifier, mode) {
|
|
72526
72526
|
underlying.delete(getUnderlyingCacheKey(specifier, mode));
|
|
72527
|
-
return
|
|
72527
|
+
return cache2;
|
|
72528
72528
|
},
|
|
72529
72529
|
has(specifier, mode) {
|
|
72530
72530
|
return underlying.has(getUnderlyingCacheKey(specifier, mode));
|
|
@@ -72539,7 +72539,7 @@ ${lanes.join("\n")}
|
|
|
72539
72539
|
return underlying.size;
|
|
72540
72540
|
}
|
|
72541
72541
|
};
|
|
72542
|
-
return
|
|
72542
|
+
return cache2;
|
|
72543
72543
|
function getUnderlyingCacheKey(specifier, mode) {
|
|
72544
72544
|
const result = createModeAwareCacheKey(specifier, mode);
|
|
72545
72545
|
memoizedReverseKeys.set(result, [specifier, mode]);
|
|
@@ -72685,12 +72685,12 @@ ${lanes.join("\n")}
|
|
|
72685
72685
|
function getOptionsForLibraryResolution(options) {
|
|
72686
72686
|
return { moduleResolution: 2, traceResolution: options.traceResolution };
|
|
72687
72687
|
}
|
|
72688
|
-
function resolveLibrary(libraryName, resolveFrom, compilerOptions, host,
|
|
72689
|
-
return resolveModuleName(libraryName, resolveFrom, getOptionsForLibraryResolution(compilerOptions), host,
|
|
72688
|
+
function resolveLibrary(libraryName, resolveFrom, compilerOptions, host, cache2) {
|
|
72689
|
+
return resolveModuleName(libraryName, resolveFrom, getOptionsForLibraryResolution(compilerOptions), host, cache2);
|
|
72690
72690
|
}
|
|
72691
|
-
function resolveModuleNameFromCache(moduleName, containingFile,
|
|
72691
|
+
function resolveModuleNameFromCache(moduleName, containingFile, cache2, mode) {
|
|
72692
72692
|
const containingDirectory = getDirectoryPath(containingFile);
|
|
72693
|
-
return
|
|
72693
|
+
return cache2.getFromDirectoryCache(
|
|
72694
72694
|
moduleName,
|
|
72695
72695
|
mode,
|
|
72696
72696
|
containingDirectory,
|
|
@@ -72698,7 +72698,7 @@ ${lanes.join("\n")}
|
|
|
72698
72698
|
void 0
|
|
72699
72699
|
);
|
|
72700
72700
|
}
|
|
72701
|
-
function resolveModuleName(moduleName, containingFile, compilerOptions, host,
|
|
72701
|
+
function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache2, redirectedReference, resolutionMode) {
|
|
72702
72702
|
const traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
72703
72703
|
if (redirectedReference) {
|
|
72704
72704
|
compilerOptions = redirectedReference.commandLine.options;
|
|
@@ -72710,7 +72710,7 @@ ${lanes.join("\n")}
|
|
|
72710
72710
|
}
|
|
72711
72711
|
}
|
|
72712
72712
|
const containingDirectory = getDirectoryPath(containingFile);
|
|
72713
|
-
let result =
|
|
72713
|
+
let result = cache2 == null ? void 0 : cache2.getFromDirectoryCache(moduleName, resolutionMode, containingDirectory, redirectedReference);
|
|
72714
72714
|
if (result) {
|
|
72715
72715
|
if (traceEnabled) {
|
|
72716
72716
|
trace(host, Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
|
|
@@ -72729,27 +72729,27 @@ ${lanes.join("\n")}
|
|
|
72729
72729
|
}
|
|
72730
72730
|
switch (moduleResolution) {
|
|
72731
72731
|
case 3:
|
|
72732
|
-
result = node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
72732
|
+
result = node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache2, redirectedReference, resolutionMode);
|
|
72733
72733
|
break;
|
|
72734
72734
|
case 99:
|
|
72735
|
-
result = nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
72735
|
+
result = nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache2, redirectedReference, resolutionMode);
|
|
72736
72736
|
break;
|
|
72737
72737
|
case 2:
|
|
72738
|
-
result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
72738
|
+
result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache2, redirectedReference, resolutionMode ? getConditions(compilerOptions, resolutionMode) : void 0);
|
|
72739
72739
|
break;
|
|
72740
72740
|
case 1:
|
|
72741
|
-
result = classicNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
72741
|
+
result = classicNameResolver(moduleName, containingFile, compilerOptions, host, cache2, redirectedReference);
|
|
72742
72742
|
break;
|
|
72743
72743
|
case 100:
|
|
72744
|
-
result = bundlerModuleNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
72744
|
+
result = bundlerModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache2, redirectedReference, resolutionMode ? getConditions(compilerOptions, resolutionMode) : void 0);
|
|
72745
72745
|
break;
|
|
72746
72746
|
default:
|
|
72747
72747
|
return Debug.fail(`Unexpected moduleResolution: ${moduleResolution}`);
|
|
72748
72748
|
}
|
|
72749
|
-
if (
|
|
72750
|
-
|
|
72749
|
+
if (cache2 && !cache2.isReadonly) {
|
|
72750
|
+
cache2.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(moduleName, resolutionMode, result);
|
|
72751
72751
|
if (!isExternalModuleNameRelative(moduleName)) {
|
|
72752
|
-
|
|
72752
|
+
cache2.getOrCreateCacheForNonRelativeName(moduleName, resolutionMode, redirectedReference).set(containingDirectory, result);
|
|
72753
72753
|
}
|
|
72754
72754
|
}
|
|
72755
72755
|
}
|
|
@@ -72896,31 +72896,31 @@ ${lanes.join("\n")}
|
|
|
72896
72896
|
NodeResolutionFeatures2[NodeResolutionFeatures2["EsmMode"] = 32] = "EsmMode";
|
|
72897
72897
|
return NodeResolutionFeatures2;
|
|
72898
72898
|
})(NodeResolutionFeatures || {});
|
|
72899
|
-
function node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
72899
|
+
function node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache2, redirectedReference, resolutionMode) {
|
|
72900
72900
|
return nodeNextModuleNameResolverWorker(
|
|
72901
72901
|
30,
|
|
72902
72902
|
moduleName,
|
|
72903
72903
|
containingFile,
|
|
72904
72904
|
compilerOptions,
|
|
72905
72905
|
host,
|
|
72906
|
-
|
|
72906
|
+
cache2,
|
|
72907
72907
|
redirectedReference,
|
|
72908
72908
|
resolutionMode
|
|
72909
72909
|
);
|
|
72910
72910
|
}
|
|
72911
|
-
function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
72911
|
+
function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache2, redirectedReference, resolutionMode) {
|
|
72912
72912
|
return nodeNextModuleNameResolverWorker(
|
|
72913
72913
|
30,
|
|
72914
72914
|
moduleName,
|
|
72915
72915
|
containingFile,
|
|
72916
72916
|
compilerOptions,
|
|
72917
72917
|
host,
|
|
72918
|
-
|
|
72918
|
+
cache2,
|
|
72919
72919
|
redirectedReference,
|
|
72920
72920
|
resolutionMode
|
|
72921
72921
|
);
|
|
72922
72922
|
}
|
|
72923
|
-
function nodeNextModuleNameResolverWorker(features, moduleName, containingFile, compilerOptions, host,
|
|
72923
|
+
function nodeNextModuleNameResolverWorker(features, moduleName, containingFile, compilerOptions, host, cache2, redirectedReference, resolutionMode, conditions) {
|
|
72924
72924
|
const containingDirectory = getDirectoryPath(containingFile);
|
|
72925
72925
|
const esmMode = resolutionMode === 99 ? 32 : 0;
|
|
72926
72926
|
let extensions = compilerOptions.noDtsResolution ? 3 : 1 | 2 | 4;
|
|
@@ -72933,7 +72933,7 @@ ${lanes.join("\n")}
|
|
|
72933
72933
|
containingDirectory,
|
|
72934
72934
|
compilerOptions,
|
|
72935
72935
|
host,
|
|
72936
|
-
|
|
72936
|
+
cache2,
|
|
72937
72937
|
extensions,
|
|
72938
72938
|
/*isConfigLookup*/
|
|
72939
72939
|
false,
|
|
@@ -72959,7 +72959,7 @@ ${lanes.join("\n")}
|
|
|
72959
72959
|
void 0
|
|
72960
72960
|
);
|
|
72961
72961
|
}
|
|
72962
|
-
function bundlerModuleNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
72962
|
+
function bundlerModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache2, redirectedReference, conditions) {
|
|
72963
72963
|
const containingDirectory = getDirectoryPath(containingFile);
|
|
72964
72964
|
let extensions = compilerOptions.noDtsResolution ? 3 : 1 | 2 | 4;
|
|
72965
72965
|
if (getResolveJsonModule(compilerOptions)) {
|
|
@@ -72971,7 +72971,7 @@ ${lanes.join("\n")}
|
|
|
72971
72971
|
containingDirectory,
|
|
72972
72972
|
compilerOptions,
|
|
72973
72973
|
host,
|
|
72974
|
-
|
|
72974
|
+
cache2,
|
|
72975
72975
|
extensions,
|
|
72976
72976
|
/*isConfigLookup*/
|
|
72977
72977
|
false,
|
|
@@ -72979,7 +72979,7 @@ ${lanes.join("\n")}
|
|
|
72979
72979
|
conditions
|
|
72980
72980
|
);
|
|
72981
72981
|
}
|
|
72982
|
-
function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
72982
|
+
function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache2, redirectedReference, conditions, isConfigLookup) {
|
|
72983
72983
|
let extensions;
|
|
72984
72984
|
if (isConfigLookup) {
|
|
72985
72985
|
extensions = 8;
|
|
@@ -72989,7 +72989,7 @@ ${lanes.join("\n")}
|
|
|
72989
72989
|
} else {
|
|
72990
72990
|
extensions = getResolveJsonModule(compilerOptions) ? 1 | 2 | 4 | 8 : 1 | 2 | 4;
|
|
72991
72991
|
}
|
|
72992
|
-
return nodeModuleNameResolverWorker(conditions ? 30 : 0, moduleName, getDirectoryPath(containingFile), compilerOptions, host,
|
|
72992
|
+
return nodeModuleNameResolverWorker(conditions ? 30 : 0, moduleName, getDirectoryPath(containingFile), compilerOptions, host, cache2, extensions, !!isConfigLookup, redirectedReference, conditions);
|
|
72993
72993
|
}
|
|
72994
72994
|
function nodeNextJsonConfigResolver(moduleName, containingFile, host) {
|
|
72995
72995
|
return nodeModuleNameResolverWorker(
|
|
@@ -73012,7 +73012,7 @@ ${lanes.join("\n")}
|
|
|
73012
73012
|
void 0
|
|
73013
73013
|
);
|
|
73014
73014
|
}
|
|
73015
|
-
function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host,
|
|
73015
|
+
function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache2, extensions, isConfigLookup, redirectedReference, conditions) {
|
|
73016
73016
|
var _a, _b, _c, _d, _e;
|
|
73017
73017
|
const traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
73018
73018
|
const failedLookupLocations = [];
|
|
@@ -73030,7 +73030,7 @@ ${lanes.join("\n")}
|
|
|
73030
73030
|
traceEnabled,
|
|
73031
73031
|
failedLookupLocations,
|
|
73032
73032
|
affectingLocations,
|
|
73033
|
-
packageJsonInfoCache:
|
|
73033
|
+
packageJsonInfoCache: cache2,
|
|
73034
73034
|
features,
|
|
73035
73035
|
conditions: conditions ?? emptyArray,
|
|
73036
73036
|
requestContainingDirectory: containingDirectory,
|
|
@@ -73092,7 +73092,7 @@ ${lanes.join("\n")}
|
|
|
73092
73092
|
affectingLocations,
|
|
73093
73093
|
diagnostics,
|
|
73094
73094
|
state,
|
|
73095
|
-
|
|
73095
|
+
cache2,
|
|
73096
73096
|
alternateResult
|
|
73097
73097
|
);
|
|
73098
73098
|
function tryResolve(extensions2, state2) {
|
|
@@ -73111,10 +73111,10 @@ ${lanes.join("\n")}
|
|
|
73111
73111
|
if (!isExternalModuleNameRelative(moduleName)) {
|
|
73112
73112
|
let resolved2;
|
|
73113
73113
|
if (features & 2 && startsWith(moduleName, "#")) {
|
|
73114
|
-
resolved2 = loadModuleFromImports(extensions2, moduleName, containingDirectory, state2,
|
|
73114
|
+
resolved2 = loadModuleFromImports(extensions2, moduleName, containingDirectory, state2, cache2, redirectedReference);
|
|
73115
73115
|
}
|
|
73116
73116
|
if (!resolved2 && features & 4) {
|
|
73117
|
-
resolved2 = loadModuleFromSelfNameReference(extensions2, moduleName, containingDirectory, state2,
|
|
73117
|
+
resolved2 = loadModuleFromSelfNameReference(extensions2, moduleName, containingDirectory, state2, cache2, redirectedReference);
|
|
73118
73118
|
}
|
|
73119
73119
|
if (!resolved2) {
|
|
73120
73120
|
if (moduleName.includes(":")) {
|
|
@@ -73126,7 +73126,7 @@ ${lanes.join("\n")}
|
|
|
73126
73126
|
if (traceEnabled) {
|
|
73127
73127
|
trace(host, Diagnostics.Loading_module_0_from_node_modules_folder_target_file_types_Colon_1, moduleName, formatExtensions(extensions2));
|
|
73128
73128
|
}
|
|
73129
|
-
resolved2 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state2,
|
|
73129
|
+
resolved2 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state2, cache2, redirectedReference);
|
|
73130
73130
|
}
|
|
73131
73131
|
if (extensions2 & 4) {
|
|
73132
73132
|
resolved2 ?? (resolved2 = resolveFromTypeRoot(moduleName, state2));
|
|
@@ -73400,14 +73400,14 @@ ${lanes.join("\n")}
|
|
|
73400
73400
|
const versionPaths = packageInfo && getVersionPathsOfPackageJsonInfo(packageInfo, state);
|
|
73401
73401
|
return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths), state);
|
|
73402
73402
|
}
|
|
73403
|
-
function getEntrypointsFromPackageJsonInfo(packageJsonInfo, options, host,
|
|
73403
|
+
function getEntrypointsFromPackageJsonInfo(packageJsonInfo, options, host, cache2, resolveJs) {
|
|
73404
73404
|
if (!resolveJs && packageJsonInfo.contents.resolvedEntrypoints !== void 0) {
|
|
73405
73405
|
return packageJsonInfo.contents.resolvedEntrypoints;
|
|
73406
73406
|
}
|
|
73407
73407
|
let entrypoints;
|
|
73408
73408
|
const extensions = 1 | 4 | (resolveJs ? 2 : 0);
|
|
73409
73409
|
const features = getNodeResolutionFeatures(options);
|
|
73410
|
-
const loadPackageJsonMainState = getTemporaryModuleResolutionState(
|
|
73410
|
+
const loadPackageJsonMainState = getTemporaryModuleResolutionState(cache2 == null ? void 0 : cache2.getPackageJsonInfoCache(), host, options);
|
|
73411
73411
|
loadPackageJsonMainState.conditions = getConditions(options);
|
|
73412
73412
|
loadPackageJsonMainState.requestContainingDirectory = packageJsonInfo.packageDirectory;
|
|
73413
73413
|
const mainResolution = loadNodeModuleFromDirectoryWorker(
|
|
@@ -73709,7 +73709,7 @@ ${lanes.join("\n")}
|
|
|
73709
73709
|
function noKeyStartsWithDot(obj) {
|
|
73710
73710
|
return !some(getOwnKeys(obj), (k) => startsWith(k, "."));
|
|
73711
73711
|
}
|
|
73712
|
-
function loadModuleFromSelfNameReference(extensions, moduleName, directory, state,
|
|
73712
|
+
function loadModuleFromSelfNameReference(extensions, moduleName, directory, state, cache2, redirectedReference) {
|
|
73713
73713
|
var _a, _b;
|
|
73714
73714
|
const directoryPath = getNormalizedAbsolutePath(directory, (_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a));
|
|
73715
73715
|
const scope = getPackageScopeForPath(directoryPath, state);
|
|
@@ -73727,13 +73727,13 @@ ${lanes.join("\n")}
|
|
|
73727
73727
|
const trailingParts = parts.slice(nameParts.length);
|
|
73728
73728
|
const subpath = !length(trailingParts) ? "." : `.${directorySeparator}${trailingParts.join(directorySeparator)}`;
|
|
73729
73729
|
if (getAllowJSCompilerOption(state.compilerOptions) && !pathContainsNodeModules(directory)) {
|
|
73730
|
-
return loadModuleFromExports(scope, extensions, subpath, state,
|
|
73730
|
+
return loadModuleFromExports(scope, extensions, subpath, state, cache2, redirectedReference);
|
|
73731
73731
|
}
|
|
73732
73732
|
const priorityExtensions = extensions & (1 | 4);
|
|
73733
73733
|
const secondaryExtensions = extensions & ~(1 | 4);
|
|
73734
|
-
return loadModuleFromExports(scope, priorityExtensions, subpath, state,
|
|
73734
|
+
return loadModuleFromExports(scope, priorityExtensions, subpath, state, cache2, redirectedReference) || loadModuleFromExports(scope, secondaryExtensions, subpath, state, cache2, redirectedReference);
|
|
73735
73735
|
}
|
|
73736
|
-
function loadModuleFromExports(scope, extensions, subpath, state,
|
|
73736
|
+
function loadModuleFromExports(scope, extensions, subpath, state, cache2, redirectedReference) {
|
|
73737
73737
|
if (!scope.contents.packageJsonContent.exports) {
|
|
73738
73738
|
return void 0;
|
|
73739
73739
|
}
|
|
@@ -73748,7 +73748,7 @@ ${lanes.join("\n")}
|
|
|
73748
73748
|
const loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(
|
|
73749
73749
|
extensions,
|
|
73750
73750
|
state,
|
|
73751
|
-
|
|
73751
|
+
cache2,
|
|
73752
73752
|
redirectedReference,
|
|
73753
73753
|
subpath,
|
|
73754
73754
|
scope,
|
|
@@ -73776,7 +73776,7 @@ ${lanes.join("\n")}
|
|
|
73776
73776
|
const result = loadModuleFromImportsOrExports(
|
|
73777
73777
|
extensions,
|
|
73778
73778
|
state,
|
|
73779
|
-
|
|
73779
|
+
cache2,
|
|
73780
73780
|
redirectedReference,
|
|
73781
73781
|
subpath,
|
|
73782
73782
|
scope.contents.packageJsonContent.exports,
|
|
@@ -73796,7 +73796,7 @@ ${lanes.join("\n")}
|
|
|
73796
73796
|
void 0
|
|
73797
73797
|
);
|
|
73798
73798
|
}
|
|
73799
|
-
function loadModuleFromImports(extensions, moduleName, directory, state,
|
|
73799
|
+
function loadModuleFromImports(extensions, moduleName, directory, state, cache2, redirectedReference) {
|
|
73800
73800
|
var _a, _b;
|
|
73801
73801
|
if (moduleName === "#" || startsWith(moduleName, "#/")) {
|
|
73802
73802
|
if (state.traceEnabled) {
|
|
@@ -73830,7 +73830,7 @@ ${lanes.join("\n")}
|
|
|
73830
73830
|
const result = loadModuleFromImportsOrExports(
|
|
73831
73831
|
extensions,
|
|
73832
73832
|
state,
|
|
73833
|
-
|
|
73833
|
+
cache2,
|
|
73834
73834
|
redirectedReference,
|
|
73835
73835
|
moduleName,
|
|
73836
73836
|
scope.contents.packageJsonContent.imports,
|
|
@@ -73862,8 +73862,8 @@ ${lanes.join("\n")}
|
|
|
73862
73862
|
if (b.length > a.length) return 1;
|
|
73863
73863
|
return 0;
|
|
73864
73864
|
}
|
|
73865
|
-
function loadModuleFromImportsOrExports(extensions, state,
|
|
73866
|
-
const loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state,
|
|
73865
|
+
function loadModuleFromImportsOrExports(extensions, state, cache2, redirectedReference, moduleName, lookupTable, scope, isImports) {
|
|
73866
|
+
const loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache2, redirectedReference, moduleName, scope, isImports);
|
|
73867
73867
|
if (!endsWith(moduleName, directorySeparator) && !moduleName.includes("*") && hasProperty(lookupTable, moduleName)) {
|
|
73868
73868
|
const target = lookupTable[moduleName];
|
|
73869
73869
|
return loadModuleFromTargetImportOrExport(
|
|
@@ -73921,7 +73921,7 @@ ${lanes.join("\n")}
|
|
|
73921
73921
|
const firstStar = patternKey.indexOf("*");
|
|
73922
73922
|
return firstStar !== -1 && firstStar === patternKey.lastIndexOf("*");
|
|
73923
73923
|
}
|
|
73924
|
-
function getLoadModuleFromTargetImportOrExport(extensions, state,
|
|
73924
|
+
function getLoadModuleFromTargetImportOrExport(extensions, state, cache2, redirectedReference, moduleName, scope, isImports) {
|
|
73925
73925
|
return loadModuleFromTargetImportOrExport;
|
|
73926
73926
|
function loadModuleFromTargetImportOrExport(target, subpath, pattern, key) {
|
|
73927
73927
|
if (typeof target === "string") {
|
|
@@ -73945,7 +73945,7 @@ ${lanes.join("\n")}
|
|
|
73945
73945
|
scope.packageDirectory + "/",
|
|
73946
73946
|
state.compilerOptions,
|
|
73947
73947
|
state.host,
|
|
73948
|
-
|
|
73948
|
+
cache2,
|
|
73949
73949
|
extensions,
|
|
73950
73950
|
/*isConfigLookup*/
|
|
73951
73951
|
false,
|
|
@@ -74157,7 +74157,7 @@ ${lanes.join("\n")}
|
|
|
74157
74157
|
if (!range) return false;
|
|
74158
74158
|
return range.test(version);
|
|
74159
74159
|
}
|
|
74160
|
-
function loadModuleFromNearestNodeModulesDirectory(extensions, moduleName, directory, state,
|
|
74160
|
+
function loadModuleFromNearestNodeModulesDirectory(extensions, moduleName, directory, state, cache2, redirectedReference) {
|
|
74161
74161
|
return loadModuleFromNearestNodeModulesDirectoryWorker(
|
|
74162
74162
|
extensions,
|
|
74163
74163
|
moduleName,
|
|
@@ -74165,7 +74165,7 @@ ${lanes.join("\n")}
|
|
|
74165
74165
|
state,
|
|
74166
74166
|
/*typesScopeOnly*/
|
|
74167
74167
|
false,
|
|
74168
|
-
|
|
74168
|
+
cache2,
|
|
74169
74169
|
redirectedReference
|
|
74170
74170
|
);
|
|
74171
74171
|
}
|
|
@@ -74183,7 +74183,7 @@ ${lanes.join("\n")}
|
|
|
74183
74183
|
void 0
|
|
74184
74184
|
);
|
|
74185
74185
|
}
|
|
74186
|
-
function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, typesScopeOnly,
|
|
74186
|
+
function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, typesScopeOnly, cache2, redirectedReference) {
|
|
74187
74187
|
const mode = state.features === 0 ? void 0 : state.features & 32 ? 99 : 1;
|
|
74188
74188
|
const priorityExtensions = extensions & (1 | 4);
|
|
74189
74189
|
const secondaryExtensions = extensions & ~(1 | 4);
|
|
@@ -74199,23 +74199,23 @@ ${lanes.join("\n")}
|
|
|
74199
74199
|
function lookup(extensions2) {
|
|
74200
74200
|
return forEachAncestorDirectory(normalizeSlashes(directory), (ancestorDirectory) => {
|
|
74201
74201
|
if (getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
74202
|
-
const resolutionFromCache = tryFindNonRelativeModuleNameInCache(
|
|
74202
|
+
const resolutionFromCache = tryFindNonRelativeModuleNameInCache(cache2, moduleName, mode, ancestorDirectory, redirectedReference, state);
|
|
74203
74203
|
if (resolutionFromCache) {
|
|
74204
74204
|
return resolutionFromCache;
|
|
74205
74205
|
}
|
|
74206
|
-
return toSearchResult(loadModuleFromImmediateNodeModulesDirectory(extensions2, moduleName, ancestorDirectory, state, typesScopeOnly,
|
|
74206
|
+
return toSearchResult(loadModuleFromImmediateNodeModulesDirectory(extensions2, moduleName, ancestorDirectory, state, typesScopeOnly, cache2, redirectedReference));
|
|
74207
74207
|
}
|
|
74208
74208
|
});
|
|
74209
74209
|
}
|
|
74210
74210
|
}
|
|
74211
|
-
function loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, directory, state, typesScopeOnly,
|
|
74211
|
+
function loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, directory, state, typesScopeOnly, cache2, redirectedReference) {
|
|
74212
74212
|
const nodeModulesFolder = combinePaths(directory, "node_modules");
|
|
74213
74213
|
const nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host);
|
|
74214
74214
|
if (!nodeModulesFolderExists && state.traceEnabled) {
|
|
74215
74215
|
trace(state.host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesFolder);
|
|
74216
74216
|
}
|
|
74217
74217
|
if (!typesScopeOnly) {
|
|
74218
|
-
const packageResult = loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, state,
|
|
74218
|
+
const packageResult = loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, state, cache2, redirectedReference);
|
|
74219
74219
|
if (packageResult) {
|
|
74220
74220
|
return packageResult;
|
|
74221
74221
|
}
|
|
@@ -74229,10 +74229,10 @@ ${lanes.join("\n")}
|
|
|
74229
74229
|
}
|
|
74230
74230
|
nodeModulesAtTypesExists = false;
|
|
74231
74231
|
}
|
|
74232
|
-
return loadModuleFromSpecificNodeModulesDirectory(4, mangleScopedPackageNameWithTrace(moduleName, state), nodeModulesAtTypes2, nodeModulesAtTypesExists, state,
|
|
74232
|
+
return loadModuleFromSpecificNodeModulesDirectory(4, mangleScopedPackageNameWithTrace(moduleName, state), nodeModulesAtTypes2, nodeModulesAtTypesExists, state, cache2, redirectedReference);
|
|
74233
74233
|
}
|
|
74234
74234
|
}
|
|
74235
|
-
function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state,
|
|
74235
|
+
function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache2, redirectedReference) {
|
|
74236
74236
|
var _a, _b;
|
|
74237
74237
|
const candidate = normalizePath(combinePaths(nodeModulesDirectory, moduleName));
|
|
74238
74238
|
const { packageName, rest } = parsePackageName(moduleName);
|
|
@@ -74275,7 +74275,7 @@ ${lanes.join("\n")}
|
|
|
74275
74275
|
state.resolvedPackageDirectory = true;
|
|
74276
74276
|
}
|
|
74277
74277
|
if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & 8) {
|
|
74278
|
-
return (_b = loadModuleFromExports(packageInfo, extensions, combinePaths(".", rest), state,
|
|
74278
|
+
return (_b = loadModuleFromExports(packageInfo, extensions, combinePaths(".", rest), state, cache2, redirectedReference)) == null ? void 0 : _b.value;
|
|
74279
74279
|
}
|
|
74280
74280
|
const versionPaths = rest !== "" && packageInfo ? getVersionPathsOfPackageJsonInfo(packageInfo, state) : void 0;
|
|
74281
74281
|
if (versionPaths) {
|
|
@@ -74317,9 +74317,9 @@ ${lanes.join("\n")}
|
|
|
74317
74317
|
}
|
|
74318
74318
|
const extension = tryGetExtensionFromPath2(subst);
|
|
74319
74319
|
if (extension !== void 0) {
|
|
74320
|
-
const
|
|
74321
|
-
if (
|
|
74322
|
-
return noPackageId({ path:
|
|
74320
|
+
const path23 = tryFile(candidate, onlyRecordFailures, state);
|
|
74321
|
+
if (path23 !== void 0) {
|
|
74322
|
+
return noPackageId({ path: path23, ext: extension, resolvedUsingTsExtension: void 0 });
|
|
74323
74323
|
}
|
|
74324
74324
|
}
|
|
74325
74325
|
return loader(extensions, candidate, onlyRecordFailures || !directoryProbablyExists(getDirectoryPath(candidate), state.host), state);
|
|
@@ -74357,8 +74357,8 @@ ${lanes.join("\n")}
|
|
|
74357
74357
|
function unmangleScopedPackageName(typesPackageName) {
|
|
74358
74358
|
return typesPackageName.includes(mangledScopedPackageSeparator) ? "@" + typesPackageName.replace(mangledScopedPackageSeparator, directorySeparator) : typesPackageName;
|
|
74359
74359
|
}
|
|
74360
|
-
function tryFindNonRelativeModuleNameInCache(
|
|
74361
|
-
const result =
|
|
74360
|
+
function tryFindNonRelativeModuleNameInCache(cache2, moduleName, mode, containingDirectory, redirectedReference, state) {
|
|
74361
|
+
const result = cache2 && cache2.getFromNonRelativeNameCache(moduleName, mode, containingDirectory, redirectedReference);
|
|
74362
74362
|
if (result) {
|
|
74363
74363
|
if (state.traceEnabled) {
|
|
74364
74364
|
trace(state.host, Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
|
|
@@ -74375,7 +74375,7 @@ ${lanes.join("\n")}
|
|
|
74375
74375
|
};
|
|
74376
74376
|
}
|
|
74377
74377
|
}
|
|
74378
|
-
function classicNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
74378
|
+
function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache2, redirectedReference) {
|
|
74379
74379
|
const traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
74380
74380
|
const failedLookupLocations = [];
|
|
74381
74381
|
const affectingLocations = [];
|
|
@@ -74387,7 +74387,7 @@ ${lanes.join("\n")}
|
|
|
74387
74387
|
traceEnabled,
|
|
74388
74388
|
failedLookupLocations,
|
|
74389
74389
|
affectingLocations,
|
|
74390
|
-
packageJsonInfoCache:
|
|
74390
|
+
packageJsonInfoCache: cache2,
|
|
74391
74391
|
features: 0,
|
|
74392
74392
|
conditions: [],
|
|
74393
74393
|
requestContainingDirectory: containingDirectory,
|
|
@@ -74408,7 +74408,7 @@ ${lanes.join("\n")}
|
|
|
74408
74408
|
affectingLocations,
|
|
74409
74409
|
diagnostics,
|
|
74410
74410
|
state,
|
|
74411
|
-
|
|
74411
|
+
cache2
|
|
74412
74412
|
);
|
|
74413
74413
|
function tryResolve(extensions) {
|
|
74414
74414
|
const resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
|
|
@@ -74418,7 +74418,7 @@ ${lanes.join("\n")}
|
|
|
74418
74418
|
if (!isExternalModuleNameRelative(moduleName)) {
|
|
74419
74419
|
const resolved2 = forEachAncestorDirectory(containingDirectory, (directory) => {
|
|
74420
74420
|
const resolutionFromCache = tryFindNonRelativeModuleNameInCache(
|
|
74421
|
-
|
|
74421
|
+
cache2,
|
|
74422
74422
|
moduleName,
|
|
74423
74423
|
/*mode*/
|
|
74424
74424
|
void 0,
|
|
@@ -78200,9 +78200,9 @@ ${lanes.join("\n")}
|
|
|
78200
78200
|
if (!moduleSourceFile) {
|
|
78201
78201
|
return emptyArray;
|
|
78202
78202
|
}
|
|
78203
|
-
const
|
|
78204
|
-
const cached =
|
|
78205
|
-
return [cached == null ? void 0 : cached.kind, cached == null ? void 0 : cached.moduleSpecifiers, moduleSourceFile, cached == null ? void 0 : cached.modulePaths,
|
|
78203
|
+
const cache2 = (_a = host.getModuleSpecifierCache) == null ? void 0 : _a.call(host);
|
|
78204
|
+
const cached = cache2 == null ? void 0 : cache2.get(importingSourceFile.path, moduleSourceFile.path, userPreferences, options);
|
|
78205
|
+
return [cached == null ? void 0 : cached.kind, cached == null ? void 0 : cached.moduleSpecifiers, moduleSourceFile, cached == null ? void 0 : cached.modulePaths, cache2];
|
|
78206
78206
|
}
|
|
78207
78207
|
function getModuleSpecifiers(moduleSymbol, checker, compilerOptions, importingSourceFile, host, userPreferences, options = {}) {
|
|
78208
78208
|
return getModuleSpecifiersWithCacheInfo(
|
|
@@ -78227,7 +78227,7 @@ ${lanes.join("\n")}
|
|
|
78227
78227
|
computedWithoutCache
|
|
78228
78228
|
};
|
|
78229
78229
|
}
|
|
78230
|
-
let [kind, specifiers, moduleSourceFile, modulePaths,
|
|
78230
|
+
let [kind, specifiers, moduleSourceFile, modulePaths, cache2] = tryGetModuleSpecifiersFromCacheWorker(
|
|
78231
78231
|
moduleSymbol,
|
|
78232
78232
|
importingSourceFile,
|
|
78233
78233
|
host,
|
|
@@ -78247,7 +78247,7 @@ ${lanes.join("\n")}
|
|
|
78247
78247
|
options,
|
|
78248
78248
|
forAutoImport
|
|
78249
78249
|
);
|
|
78250
|
-
|
|
78250
|
+
cache2 == null ? void 0 : cache2.set(importingSourceFile.path, moduleSourceFile.path, userPreferences, options, result.kind, modulePaths, result.moduleSpecifiers);
|
|
78251
78251
|
return result;
|
|
78252
78252
|
}
|
|
78253
78253
|
function getLocalModuleSpecifierBetweenFileNames(importingFile, targetFileName, compilerOptions, host, preferences, options = {}) {
|
|
@@ -78475,14 +78475,14 @@ ${lanes.join("\n")}
|
|
|
78475
78475
|
var _a;
|
|
78476
78476
|
const importingFilePath = toPath(info.importingSourceFileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host));
|
|
78477
78477
|
const importedFilePath = toPath(importedFileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host));
|
|
78478
|
-
const
|
|
78479
|
-
if (
|
|
78480
|
-
const cached =
|
|
78478
|
+
const cache2 = (_a = host.getModuleSpecifierCache) == null ? void 0 : _a.call(host);
|
|
78479
|
+
if (cache2) {
|
|
78480
|
+
const cached = cache2.get(importingFilePath, importedFilePath, preferences, options);
|
|
78481
78481
|
if (cached == null ? void 0 : cached.modulePaths) return cached.modulePaths;
|
|
78482
78482
|
}
|
|
78483
78483
|
const modulePaths = getAllModulePathsWorker(info, importedFileName, host, compilerOptions, options);
|
|
78484
|
-
if (
|
|
78485
|
-
|
|
78484
|
+
if (cache2) {
|
|
78485
|
+
cache2.setModulePaths(importingFilePath, importedFilePath, preferences, options, modulePaths);
|
|
78486
78486
|
}
|
|
78487
78487
|
return modulePaths;
|
|
78488
78488
|
}
|
|
@@ -78499,11 +78499,11 @@ ${lanes.join("\n")}
|
|
|
78499
78499
|
}
|
|
78500
78500
|
function getAllModulePathsWorker(info, importedFileName, host, compilerOptions, options) {
|
|
78501
78501
|
var _a, _b;
|
|
78502
|
-
const
|
|
78502
|
+
const cache2 = (_a = host.getModuleResolutionCache) == null ? void 0 : _a.call(host);
|
|
78503
78503
|
const links = (_b = host.getSymlinkCache) == null ? void 0 : _b.call(host);
|
|
78504
|
-
if (
|
|
78504
|
+
if (cache2 && links && host.readFile && !pathContainsNodeModules(info.importingSourceFileName)) {
|
|
78505
78505
|
Debug.type(host);
|
|
78506
|
-
const state = getTemporaryModuleResolutionState(
|
|
78506
|
+
const state = getTemporaryModuleResolutionState(cache2.getPackageJsonInfoCache(), host, {});
|
|
78507
78507
|
const packageJson = getPackageScopeForPath(getDirectoryPath(info.importingSourceFileName), state);
|
|
78508
78508
|
if (packageJson) {
|
|
78509
78509
|
const toResolve = getAllRuntimeDependencies(packageJson.contents.packageJsonContent);
|
|
@@ -78513,7 +78513,7 @@ ${lanes.join("\n")}
|
|
|
78513
78513
|
combinePaths(packageJson.packageDirectory, "package.json"),
|
|
78514
78514
|
compilerOptions,
|
|
78515
78515
|
host,
|
|
78516
|
-
|
|
78516
|
+
cache2,
|
|
78517
78517
|
/*redirectedReference*/
|
|
78518
78518
|
void 0,
|
|
78519
78519
|
options.overrideImportMode
|
|
@@ -83143,11 +83143,11 @@ ${lanes.join("\n")}
|
|
|
83143
83143
|
return void 0;
|
|
83144
83144
|
}
|
|
83145
83145
|
const links = getSymbolLinks(symbol);
|
|
83146
|
-
const
|
|
83146
|
+
const cache2 = links.accessibleChainCache || (links.accessibleChainCache = /* @__PURE__ */ new Map());
|
|
83147
83147
|
const firstRelevantLocation = forEachSymbolTableInScope(enclosingDeclaration, (_, __, ___, node) => node);
|
|
83148
83148
|
const key = `${useOnlyExternalAliasing ? 0 : 1}|${firstRelevantLocation && getNodeId(firstRelevantLocation)}|${meaning}`;
|
|
83149
|
-
if (
|
|
83150
|
-
return
|
|
83149
|
+
if (cache2.has(key)) {
|
|
83150
|
+
return cache2.get(key);
|
|
83151
83151
|
}
|
|
83152
83152
|
const id = getSymbolId(symbol);
|
|
83153
83153
|
let visitedSymbolTables = visitedSymbolTablesMap.get(id);
|
|
@@ -83155,7 +83155,7 @@ ${lanes.join("\n")}
|
|
|
83155
83155
|
visitedSymbolTablesMap.set(id, visitedSymbolTables = []);
|
|
83156
83156
|
}
|
|
83157
83157
|
const result = forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable);
|
|
83158
|
-
|
|
83158
|
+
cache2.set(key, result);
|
|
83159
83159
|
return result;
|
|
83160
83160
|
function getAccessibleSymbolChainFromSymbolTable(symbols, ignoreQualification, isLocalNameLookup) {
|
|
83161
83161
|
if (!pushIfUnique(visitedSymbolTables, symbols)) {
|
|
@@ -95826,21 +95826,21 @@ ${lanes.join("\n")}
|
|
|
95826
95826
|
}
|
|
95827
95827
|
}
|
|
95828
95828
|
function getSimplifiedIndexedAccessType(type, writing) {
|
|
95829
|
-
const
|
|
95830
|
-
if (type[
|
|
95831
|
-
return type[
|
|
95829
|
+
const cache2 = writing ? "simplifiedForWriting" : "simplifiedForReading";
|
|
95830
|
+
if (type[cache2]) {
|
|
95831
|
+
return type[cache2] === circularConstraintType ? type : type[cache2];
|
|
95832
95832
|
}
|
|
95833
|
-
type[
|
|
95833
|
+
type[cache2] = circularConstraintType;
|
|
95834
95834
|
const objectType = getSimplifiedType(type.objectType, writing);
|
|
95835
95835
|
const indexType = getSimplifiedType(type.indexType, writing);
|
|
95836
95836
|
const distributedOverIndex = distributeObjectOverIndexType(objectType, indexType, writing);
|
|
95837
95837
|
if (distributedOverIndex) {
|
|
95838
|
-
return type[
|
|
95838
|
+
return type[cache2] = distributedOverIndex;
|
|
95839
95839
|
}
|
|
95840
95840
|
if (!(indexType.flags & 465829888)) {
|
|
95841
95841
|
const distributedOverObject = distributeIndexOverObjectType(objectType, indexType, writing);
|
|
95842
95842
|
if (distributedOverObject) {
|
|
95843
|
-
return type[
|
|
95843
|
+
return type[cache2] = distributedOverObject;
|
|
95844
95844
|
}
|
|
95845
95845
|
}
|
|
95846
95846
|
if (isGenericTupleType(objectType) && indexType.flags & 296) {
|
|
@@ -95852,15 +95852,15 @@ ${lanes.join("\n")}
|
|
|
95852
95852
|
writing
|
|
95853
95853
|
);
|
|
95854
95854
|
if (elementType) {
|
|
95855
|
-
return type[
|
|
95855
|
+
return type[cache2] = elementType;
|
|
95856
95856
|
}
|
|
95857
95857
|
}
|
|
95858
95858
|
if (isGenericMappedType(objectType)) {
|
|
95859
95859
|
if (getMappedTypeNameTypeKind(objectType) !== 2) {
|
|
95860
|
-
return type[
|
|
95860
|
+
return type[cache2] = mapType(substituteIndexedMappedType(objectType, type.indexType), (t) => getSimplifiedType(t, writing));
|
|
95861
95861
|
}
|
|
95862
95862
|
}
|
|
95863
|
-
return type[
|
|
95863
|
+
return type[cache2] = type;
|
|
95864
95864
|
}
|
|
95865
95865
|
function getSimplifiedConditionalType(type, writing) {
|
|
95866
95866
|
const checkType = type.checkType;
|
|
@@ -104381,12 +104381,12 @@ ${lanes.join("\n")}
|
|
|
104381
104381
|
}
|
|
104382
104382
|
function getTypeAtFlowLoopLabel(flow) {
|
|
104383
104383
|
const id = getFlowNodeId(flow);
|
|
104384
|
-
const
|
|
104384
|
+
const cache2 = flowLoopCaches[id] || (flowLoopCaches[id] = /* @__PURE__ */ new Map());
|
|
104385
104385
|
const key2 = getOrSetCacheKey();
|
|
104386
104386
|
if (!key2) {
|
|
104387
104387
|
return declaredType;
|
|
104388
104388
|
}
|
|
104389
|
-
const cached =
|
|
104389
|
+
const cached = cache2.get(key2);
|
|
104390
104390
|
if (cached) {
|
|
104391
104391
|
return cached;
|
|
104392
104392
|
}
|
|
@@ -104420,7 +104420,7 @@ ${lanes.join("\n")}
|
|
|
104420
104420
|
flowType = getTypeAtFlowNode(antecedent);
|
|
104421
104421
|
flowTypeCache = saveFlowTypeCache;
|
|
104422
104422
|
flowLoopCount--;
|
|
104423
|
-
const cached2 =
|
|
104423
|
+
const cached2 = cache2.get(key2);
|
|
104424
104424
|
if (cached2) {
|
|
104425
104425
|
return cached2;
|
|
104426
104426
|
}
|
|
@@ -104446,7 +104446,7 @@ ${lanes.join("\n")}
|
|
|
104446
104446
|
true
|
|
104447
104447
|
);
|
|
104448
104448
|
}
|
|
104449
|
-
|
|
104449
|
+
cache2.set(key2, result);
|
|
104450
104450
|
return result;
|
|
104451
104451
|
}
|
|
104452
104452
|
function getUnionOrEvolvingArrayType(types, subtypeReduction) {
|
|
@@ -115286,8 +115286,8 @@ ${lanes.join("\n")}
|
|
|
115286
115286
|
/* TypeOnly */
|
|
115287
115287
|
);
|
|
115288
115288
|
if (flowInvocationCount !== startInvocationCount) {
|
|
115289
|
-
const
|
|
115290
|
-
|
|
115289
|
+
const cache2 = flowTypeCache || (flowTypeCache = []);
|
|
115290
|
+
cache2[getNodeId(node)] = type;
|
|
115291
115291
|
setNodeFlags(
|
|
115292
115292
|
node,
|
|
115293
115293
|
node.flags | 268435456
|
|
@@ -157157,8 +157157,8 @@ ${lanes.join("\n")}
|
|
|
157157
157157
|
}
|
|
157158
157158
|
function generateNameCached(node, privateName, flags, prefix, suffix) {
|
|
157159
157159
|
const nodeId = getNodeId(node);
|
|
157160
|
-
const
|
|
157161
|
-
return
|
|
157160
|
+
const cache2 = privateName ? nodeIdToGeneratedPrivateName : nodeIdToGeneratedName;
|
|
157161
|
+
return cache2[nodeId] || (cache2[nodeId] = generateNameForNode(node, privateName, flags ?? 0, formatGeneratedNamePart(prefix, generateName), formatGeneratedNamePart(suffix)));
|
|
157162
157162
|
}
|
|
157163
157163
|
function isUniqueName(name, privateName) {
|
|
157164
157164
|
return isFileLevelUniqueNameInCurrentFile(name, privateName) && !isReservedName(name, privateName) && !generatedNames.has(name);
|
|
@@ -158964,7 +158964,7 @@ ${lanes.join("\n")}
|
|
|
158964
158964
|
getName: getModuleResolutionName,
|
|
158965
158965
|
getMode: (entry, file, compilerOptions) => getModeForUsageLocation(file, entry, compilerOptions)
|
|
158966
158966
|
};
|
|
158967
|
-
function createModuleResolutionLoader(containingFile, redirectedReference, options, host,
|
|
158967
|
+
function createModuleResolutionLoader(containingFile, redirectedReference, options, host, cache2) {
|
|
158968
158968
|
return {
|
|
158969
158969
|
nameAndMode: moduleResolutionNameAndModeGetter,
|
|
158970
158970
|
resolve: (moduleName, resolutionMode) => resolveModuleName(
|
|
@@ -158972,7 +158972,7 @@ ${lanes.join("\n")}
|
|
|
158972
158972
|
containingFile,
|
|
158973
158973
|
options,
|
|
158974
158974
|
host,
|
|
158975
|
-
|
|
158975
|
+
cache2,
|
|
158976
158976
|
redirectedReference,
|
|
158977
158977
|
resolutionMode
|
|
158978
158978
|
)
|
|
@@ -158985,7 +158985,7 @@ ${lanes.join("\n")}
|
|
|
158985
158985
|
getName: getTypeReferenceResolutionName,
|
|
158986
158986
|
getMode: (entry, file, compilerOptions) => getModeForFileReference(entry, file && getDefaultResolutionModeForFileWorker(file, compilerOptions))
|
|
158987
158987
|
};
|
|
158988
|
-
function createTypeReferenceResolutionLoader(containingFile, redirectedReference, options, host,
|
|
158988
|
+
function createTypeReferenceResolutionLoader(containingFile, redirectedReference, options, host, cache2) {
|
|
158989
158989
|
return {
|
|
158990
158990
|
nameAndMode: typeReferenceResolutionNameAndModeGetter,
|
|
158991
158991
|
resolve: (typeRef, resoluionMode) => resolveTypeReferenceDirective(
|
|
@@ -158994,7 +158994,7 @@ ${lanes.join("\n")}
|
|
|
158994
158994
|
options,
|
|
158995
158995
|
host,
|
|
158996
158996
|
redirectedReference,
|
|
158997
|
-
|
|
158997
|
+
cache2,
|
|
158998
158998
|
resoluionMode
|
|
158999
158999
|
)
|
|
159000
159000
|
};
|
|
@@ -159002,15 +159002,15 @@ ${lanes.join("\n")}
|
|
|
159002
159002
|
function loadWithModeAwareCache(entries, containingFile, redirectedReference, options, containingSourceFile, host, resolutionCache, createLoader) {
|
|
159003
159003
|
if (entries.length === 0) return emptyArray;
|
|
159004
159004
|
const resolutions = [];
|
|
159005
|
-
const
|
|
159005
|
+
const cache2 = /* @__PURE__ */ new Map();
|
|
159006
159006
|
const loader = createLoader(containingFile, redirectedReference, options, host, resolutionCache);
|
|
159007
159007
|
for (const entry of entries) {
|
|
159008
159008
|
const name = loader.nameAndMode.getName(entry);
|
|
159009
159009
|
const mode = loader.nameAndMode.getMode(entry, containingSourceFile, (redirectedReference == null ? void 0 : redirectedReference.commandLine.options) || options);
|
|
159010
159010
|
const key = createModeAwareCacheKey(name, mode);
|
|
159011
|
-
let result =
|
|
159011
|
+
let result = cache2.get(key);
|
|
159012
159012
|
if (!result) {
|
|
159013
|
-
|
|
159013
|
+
cache2.set(key, result = loader.resolve(name, mode));
|
|
159014
159014
|
}
|
|
159015
159015
|
resolutions.push(result);
|
|
159016
159016
|
}
|
|
@@ -165414,7 +165414,7 @@ ${lanes.join("\n")}
|
|
|
165414
165414
|
const watcher = fileWatchesOfAffectingLocations.get(path14);
|
|
165415
165415
|
if (watcher == null ? void 0 : watcher.resolutions) (affectingPathChecks ?? (affectingPathChecks = /* @__PURE__ */ new Set())).add(path14);
|
|
165416
165416
|
if (watcher == null ? void 0 : watcher.files) (affectingPathChecksForFile ?? (affectingPathChecksForFile = /* @__PURE__ */ new Set())).add(path14);
|
|
165417
|
-
(_a = watcher == null ? void 0 : watcher.symlinks) == null ? void 0 : _a.forEach((
|
|
165417
|
+
(_a = watcher == null ? void 0 : watcher.symlinks) == null ? void 0 : _a.forEach((path23) => invalidateAffectingFileWatcher(path23, packageJsonMap));
|
|
165418
165418
|
packageJsonMap == null ? void 0 : packageJsonMap.delete(resolutionHost.toPath(path14));
|
|
165419
165419
|
}
|
|
165420
165420
|
function watchFailedLookupLocationOfNonRelativeModuleResolutions() {
|
|
@@ -165564,8 +165564,8 @@ ${lanes.join("\n")}
|
|
|
165564
165564
|
/* Recursive */
|
|
165565
165565
|
);
|
|
165566
165566
|
}
|
|
165567
|
-
function removeResolutionsOfFileFromCache(
|
|
165568
|
-
const resolutions =
|
|
165567
|
+
function removeResolutionsOfFileFromCache(cache2, filePath, getResolutionWithResolvedFileName) {
|
|
165568
|
+
const resolutions = cache2.get(filePath);
|
|
165569
165569
|
if (resolutions) {
|
|
165570
165570
|
resolutions.forEach(
|
|
165571
165571
|
(resolution) => stopWatchFailedLookupLocationOfResolution(
|
|
@@ -165574,7 +165574,7 @@ ${lanes.join("\n")}
|
|
|
165574
165574
|
getResolutionWithResolvedFileName
|
|
165575
165575
|
)
|
|
165576
165576
|
);
|
|
165577
|
-
|
|
165577
|
+
cache2.delete(filePath);
|
|
165578
165578
|
}
|
|
165579
165579
|
}
|
|
165580
165580
|
function removeResolutionsFromProjectReferenceRedirects(filePath) {
|
|
@@ -166623,12 +166623,12 @@ ${lanes.join("\n")}
|
|
|
166623
166623
|
missingFilesMap = void 0;
|
|
166624
166624
|
}
|
|
166625
166625
|
if (parsedConfigs) {
|
|
166626
|
-
clearMap(parsedConfigs, (
|
|
166626
|
+
clearMap(parsedConfigs, (config2) => {
|
|
166627
166627
|
var _a;
|
|
166628
|
-
(_a =
|
|
166629
|
-
|
|
166630
|
-
if (
|
|
166631
|
-
|
|
166628
|
+
(_a = config2.watcher) == null ? void 0 : _a.close();
|
|
166629
|
+
config2.watcher = void 0;
|
|
166630
|
+
if (config2.watchedDirectories) clearMap(config2.watchedDirectories, closeFileWatcherOf);
|
|
166631
|
+
config2.watchedDirectories = void 0;
|
|
166632
166632
|
});
|
|
166633
166633
|
parsedConfigs = void 0;
|
|
166634
166634
|
}
|
|
@@ -166931,32 +166931,32 @@ ${lanes.join("\n")}
|
|
|
166931
166931
|
}
|
|
166932
166932
|
function getParsedCommandLine(configFileName2) {
|
|
166933
166933
|
const configPath = toPath3(configFileName2);
|
|
166934
|
-
let
|
|
166935
|
-
if (
|
|
166936
|
-
if (!
|
|
166937
|
-
if (
|
|
166934
|
+
let config2 = parsedConfigs == null ? void 0 : parsedConfigs.get(configPath);
|
|
166935
|
+
if (config2) {
|
|
166936
|
+
if (!config2.updateLevel) return config2.parsedCommandLine;
|
|
166937
|
+
if (config2.parsedCommandLine && config2.updateLevel === 1 && !host.getParsedCommandLine) {
|
|
166938
166938
|
writeLog("Reloading new file names and options");
|
|
166939
166939
|
Debug.assert(compilerOptions);
|
|
166940
166940
|
const fileNames = getFileNamesFromConfigSpecs(
|
|
166941
|
-
|
|
166941
|
+
config2.parsedCommandLine.options.configFile.configFileSpecs,
|
|
166942
166942
|
getNormalizedAbsolutePath(getDirectoryPath(configFileName2), currentDirectory),
|
|
166943
166943
|
compilerOptions,
|
|
166944
166944
|
parseConfigFileHost
|
|
166945
166945
|
);
|
|
166946
|
-
|
|
166947
|
-
|
|
166948
|
-
return
|
|
166946
|
+
config2.parsedCommandLine = { ...config2.parsedCommandLine, fileNames };
|
|
166947
|
+
config2.updateLevel = void 0;
|
|
166948
|
+
return config2.parsedCommandLine;
|
|
166949
166949
|
}
|
|
166950
166950
|
}
|
|
166951
166951
|
writeLog(`Loading config file: ${configFileName2}`);
|
|
166952
166952
|
const parsedCommandLine = host.getParsedCommandLine ? host.getParsedCommandLine(configFileName2) : getParsedCommandLineFromConfigFileHost(configFileName2);
|
|
166953
|
-
if (
|
|
166954
|
-
|
|
166955
|
-
|
|
166953
|
+
if (config2) {
|
|
166954
|
+
config2.parsedCommandLine = parsedCommandLine;
|
|
166955
|
+
config2.updateLevel = void 0;
|
|
166956
166956
|
} else {
|
|
166957
|
-
(parsedConfigs || (parsedConfigs = /* @__PURE__ */ new Map())).set(configPath,
|
|
166957
|
+
(parsedConfigs || (parsedConfigs = /* @__PURE__ */ new Map())).set(configPath, config2 = { parsedCommandLine });
|
|
166958
166958
|
}
|
|
166959
|
-
watchReferencedProject(configFileName2, configPath,
|
|
166959
|
+
watchReferencedProject(configFileName2, configPath, config2);
|
|
166960
166960
|
return parsedCommandLine;
|
|
166961
166961
|
}
|
|
166962
166962
|
function getParsedCommandLineFromConfigFileHost(configFileName2) {
|
|
@@ -166976,11 +166976,11 @@ ${lanes.join("\n")}
|
|
|
166976
166976
|
function onReleaseParsedCommandLine(fileName) {
|
|
166977
166977
|
var _a;
|
|
166978
166978
|
const path14 = toPath3(fileName);
|
|
166979
|
-
const
|
|
166980
|
-
if (!
|
|
166979
|
+
const config2 = parsedConfigs == null ? void 0 : parsedConfigs.get(path14);
|
|
166980
|
+
if (!config2) return;
|
|
166981
166981
|
parsedConfigs.delete(path14);
|
|
166982
|
-
if (
|
|
166983
|
-
(_a =
|
|
166982
|
+
if (config2.watchedDirectories) clearMap(config2.watchedDirectories, closeFileWatcherOf);
|
|
166983
|
+
(_a = config2.watcher) == null ? void 0 : _a.close();
|
|
166984
166984
|
clearSharedExtendedConfigFileWatcher(path14, sharedExtendedConfigFileWatchers);
|
|
166985
166985
|
}
|
|
166986
166986
|
function watchFilePath(path14, file, callback, pollingInterval, options, watchType) {
|
|
@@ -167076,8 +167076,8 @@ ${lanes.join("\n")}
|
|
|
167076
167076
|
if (configFileName && toPath3(configFileName) === projectPath) {
|
|
167077
167077
|
updateLevel = 2;
|
|
167078
167078
|
} else {
|
|
167079
|
-
const
|
|
167080
|
-
if (
|
|
167079
|
+
const config2 = parsedConfigs == null ? void 0 : parsedConfigs.get(projectPath);
|
|
167080
|
+
if (config2) config2.updateLevel = 2;
|
|
167081
167081
|
resolutionCache.removeResolutionsFromProjectReferenceRedirects(projectPath);
|
|
167082
167082
|
}
|
|
167083
167083
|
scheduleProgramUpdate();
|
|
@@ -167096,8 +167096,8 @@ ${lanes.join("\n")}
|
|
|
167096
167096
|
configFileName2,
|
|
167097
167097
|
(_fileName, eventKind) => {
|
|
167098
167098
|
updateCachedSystemWithFile(configFileName2, configPath, eventKind);
|
|
167099
|
-
const
|
|
167100
|
-
if (
|
|
167099
|
+
const config2 = parsedConfigs == null ? void 0 : parsedConfigs.get(configPath);
|
|
167100
|
+
if (config2) config2.updateLevel = 2;
|
|
167101
167101
|
resolutionCache.removeResolutionsFromProjectReferenceRedirects(configPath);
|
|
167102
167102
|
scheduleProgramUpdate();
|
|
167103
167103
|
},
|
|
@@ -167118,22 +167118,22 @@ ${lanes.join("\n")}
|
|
|
167118
167118
|
cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
|
|
167119
167119
|
}
|
|
167120
167120
|
nextSourceFileVersion(fileOrDirectoryPath);
|
|
167121
|
-
const
|
|
167122
|
-
if (!(
|
|
167121
|
+
const config2 = parsedConfigs == null ? void 0 : parsedConfigs.get(configPath);
|
|
167122
|
+
if (!(config2 == null ? void 0 : config2.parsedCommandLine)) return;
|
|
167123
167123
|
if (isIgnoredFileFromWildCardWatching({
|
|
167124
167124
|
watchedDirPath: toPath3(directory),
|
|
167125
167125
|
fileOrDirectory,
|
|
167126
167126
|
fileOrDirectoryPath,
|
|
167127
167127
|
configFileName: configFileName2,
|
|
167128
|
-
options:
|
|
167129
|
-
program:
|
|
167128
|
+
options: config2.parsedCommandLine.options,
|
|
167129
|
+
program: config2.parsedCommandLine.fileNames,
|
|
167130
167130
|
currentDirectory,
|
|
167131
167131
|
useCaseSensitiveFileNames: useCaseSensitiveFileNames2,
|
|
167132
167132
|
writeLog,
|
|
167133
167133
|
toPath: toPath3
|
|
167134
167134
|
})) return;
|
|
167135
|
-
if (
|
|
167136
|
-
|
|
167135
|
+
if (config2.updateLevel !== 2) {
|
|
167136
|
+
config2.updateLevel = 1;
|
|
167137
167137
|
scheduleProgramUpdate();
|
|
167138
167138
|
}
|
|
167139
167139
|
},
|
|
@@ -167572,14 +167572,14 @@ ${lanes.join("\n")}
|
|
|
167572
167572
|
}
|
|
167573
167573
|
function disableCache(state) {
|
|
167574
167574
|
if (!state.cache) return;
|
|
167575
|
-
const { cache, host, compilerHost, extendedConfigCache, moduleResolutionCache, typeReferenceDirectiveResolutionCache, libraryResolutionCache } = state;
|
|
167576
|
-
host.readFile =
|
|
167577
|
-
host.fileExists =
|
|
167578
|
-
host.directoryExists =
|
|
167579
|
-
host.createDirectory =
|
|
167580
|
-
host.writeFile =
|
|
167581
|
-
compilerHost.getSourceFile =
|
|
167582
|
-
state.readFileWithCache =
|
|
167575
|
+
const { cache: cache2, host, compilerHost, extendedConfigCache, moduleResolutionCache, typeReferenceDirectiveResolutionCache, libraryResolutionCache } = state;
|
|
167576
|
+
host.readFile = cache2.originalReadFile;
|
|
167577
|
+
host.fileExists = cache2.originalFileExists;
|
|
167578
|
+
host.directoryExists = cache2.originalDirectoryExists;
|
|
167579
|
+
host.createDirectory = cache2.originalCreateDirectory;
|
|
167580
|
+
host.writeFile = cache2.originalWriteFile;
|
|
167581
|
+
compilerHost.getSourceFile = cache2.originalGetSourceFile;
|
|
167582
|
+
state.readFileWithCache = cache2.originalReadFileWithCache;
|
|
167583
167583
|
extendedConfigCache.clear();
|
|
167584
167584
|
moduleResolutionCache == null ? void 0 : moduleResolutionCache.clear();
|
|
167585
167585
|
typeReferenceDirectiveResolutionCache == null ? void 0 : typeReferenceDirectiveResolutionCache.clear();
|
|
@@ -167624,29 +167624,29 @@ ${lanes.join("\n")}
|
|
|
167624
167624
|
state.projectPendingBuild.delete(projectPath);
|
|
167625
167625
|
return state.diagnostics.has(projectPath) ? 1 : 0;
|
|
167626
167626
|
}
|
|
167627
|
-
function createUpdateOutputFileStampsProject(state, project, projectPath,
|
|
167627
|
+
function createUpdateOutputFileStampsProject(state, project, projectPath, config2, buildOrder) {
|
|
167628
167628
|
let updateOutputFileStampsPending = true;
|
|
167629
167629
|
return {
|
|
167630
167630
|
kind: 1,
|
|
167631
167631
|
project,
|
|
167632
167632
|
projectPath,
|
|
167633
167633
|
buildOrder,
|
|
167634
|
-
getCompilerOptions: () =>
|
|
167634
|
+
getCompilerOptions: () => config2.options,
|
|
167635
167635
|
getCurrentDirectory: () => state.compilerHost.getCurrentDirectory(),
|
|
167636
167636
|
updateOutputFileStatmps: () => {
|
|
167637
|
-
updateOutputTimestamps(state,
|
|
167637
|
+
updateOutputTimestamps(state, config2, projectPath);
|
|
167638
167638
|
updateOutputFileStampsPending = false;
|
|
167639
167639
|
},
|
|
167640
167640
|
done: () => {
|
|
167641
167641
|
if (updateOutputFileStampsPending) {
|
|
167642
|
-
updateOutputTimestamps(state,
|
|
167642
|
+
updateOutputTimestamps(state, config2, projectPath);
|
|
167643
167643
|
}
|
|
167644
167644
|
mark("SolutionBuilder::Timestamps only updates");
|
|
167645
167645
|
return doneInvalidatedProject(state, projectPath);
|
|
167646
167646
|
}
|
|
167647
167647
|
};
|
|
167648
167648
|
}
|
|
167649
|
-
function createBuildOrUpdateInvalidedProject(state, project, projectPath, projectIndex,
|
|
167649
|
+
function createBuildOrUpdateInvalidedProject(state, project, projectPath, projectIndex, config2, status, buildOrder) {
|
|
167650
167650
|
let step = 0;
|
|
167651
167651
|
let program3;
|
|
167652
167652
|
let buildResult;
|
|
@@ -167655,7 +167655,7 @@ ${lanes.join("\n")}
|
|
|
167655
167655
|
project,
|
|
167656
167656
|
projectPath,
|
|
167657
167657
|
buildOrder,
|
|
167658
|
-
getCompilerOptions: () =>
|
|
167658
|
+
getCompilerOptions: () => config2.options,
|
|
167659
167659
|
getCurrentDirectory: () => state.compilerHost.getCurrentDirectory(),
|
|
167660
167660
|
getBuilderProgram: () => withProgramOrUndefined(identity),
|
|
167661
167661
|
getProgram: () => withProgramOrUndefined(
|
|
@@ -167727,23 +167727,23 @@ ${lanes.join("\n")}
|
|
|
167727
167727
|
return;
|
|
167728
167728
|
}
|
|
167729
167729
|
if (state.options.verbose) reportStatus(state, Diagnostics.Building_project_0, project);
|
|
167730
|
-
if (
|
|
167731
|
-
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(
|
|
167730
|
+
if (config2.fileNames.length === 0) {
|
|
167731
|
+
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config2));
|
|
167732
167732
|
buildResult = 0;
|
|
167733
167733
|
step = 2;
|
|
167734
167734
|
return;
|
|
167735
167735
|
}
|
|
167736
167736
|
const { host, compilerHost } = state;
|
|
167737
|
-
state.projectCompilerOptions =
|
|
167738
|
-
(_a = state.moduleResolutionCache) == null ? void 0 : _a.update(
|
|
167739
|
-
(_b = state.typeReferenceDirectiveResolutionCache) == null ? void 0 : _b.update(
|
|
167737
|
+
state.projectCompilerOptions = config2.options;
|
|
167738
|
+
(_a = state.moduleResolutionCache) == null ? void 0 : _a.update(config2.options);
|
|
167739
|
+
(_b = state.typeReferenceDirectiveResolutionCache) == null ? void 0 : _b.update(config2.options);
|
|
167740
167740
|
program3 = host.createProgram(
|
|
167741
|
-
|
|
167742
|
-
|
|
167741
|
+
config2.fileNames,
|
|
167742
|
+
config2.options,
|
|
167743
167743
|
compilerHost,
|
|
167744
|
-
getOldProgram(state, projectPath,
|
|
167745
|
-
getConfigFileParsingDiagnostics(
|
|
167746
|
-
|
|
167744
|
+
getOldProgram(state, projectPath, config2),
|
|
167745
|
+
getConfigFileParsingDiagnostics(config2),
|
|
167746
|
+
config2.projectReferences
|
|
167747
167747
|
);
|
|
167748
167748
|
if (state.watch) {
|
|
167749
167749
|
const internalMap = (_c = state.moduleResolutionCache) == null ? void 0 : _c.getPackageJsonInfoCache().getInternalMap();
|
|
@@ -167818,7 +167818,7 @@ ${lanes.join("\n")}
|
|
|
167818
167818
|
customTransformers || ((_b = (_a = state.host).getCustomTransformers) == null ? void 0 : _b.call(_a, project))
|
|
167819
167819
|
);
|
|
167820
167820
|
if ((!options.noEmitOnError || !diagnostics.length) && (emittedOutputs.size || status.type !== 8)) {
|
|
167821
|
-
updateOutputTimestampsWorker(state,
|
|
167821
|
+
updateOutputTimestampsWorker(state, config2, projectPath, Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
|
|
167822
167822
|
}
|
|
167823
167823
|
state.projectErrorsReported.set(projectPath, true);
|
|
167824
167824
|
buildResult = ((_c = program3.hasChangedEmitSignature) == null ? void 0 : _c.call(program3)) ? 0 : 2;
|
|
@@ -167826,7 +167826,7 @@ ${lanes.join("\n")}
|
|
|
167826
167826
|
state.diagnostics.delete(projectPath);
|
|
167827
167827
|
state.projectStatus.set(projectPath, {
|
|
167828
167828
|
type: 1,
|
|
167829
|
-
oldestOutputFileName: firstOrUndefinedIterator(emittedOutputs.values()) ?? getFirstProjectOutput(
|
|
167829
|
+
oldestOutputFileName: firstOrUndefinedIterator(emittedOutputs.values()) ?? getFirstProjectOutput(config2, !host.useCaseSensitiveFileNames())
|
|
167830
167830
|
});
|
|
167831
167831
|
} else {
|
|
167832
167832
|
state.diagnostics.set(projectPath, diagnostics);
|
|
@@ -167848,7 +167848,7 @@ ${lanes.join("\n")}
|
|
|
167848
167848
|
emit(writeFile2, cancellationToken, customTransformers);
|
|
167849
167849
|
break;
|
|
167850
167850
|
case 2:
|
|
167851
|
-
queueReferencingProjects(state, project, projectPath, projectIndex,
|
|
167851
|
+
queueReferencingProjects(state, project, projectPath, projectIndex, config2, buildOrder, Debug.checkDefined(buildResult));
|
|
167852
167852
|
step++;
|
|
167853
167853
|
break;
|
|
167854
167854
|
case 3:
|
|
@@ -167872,29 +167872,29 @@ ${lanes.join("\n")}
|
|
|
167872
167872
|
reportQueue = false;
|
|
167873
167873
|
reportBuildQueue(state, buildOrder);
|
|
167874
167874
|
}
|
|
167875
|
-
const
|
|
167876
|
-
if (!
|
|
167875
|
+
const config2 = parseConfigFile(state, project, projectPath);
|
|
167876
|
+
if (!config2) {
|
|
167877
167877
|
reportParseConfigFileDiagnostic(state, projectPath);
|
|
167878
167878
|
projectPendingBuild.delete(projectPath);
|
|
167879
167879
|
continue;
|
|
167880
167880
|
}
|
|
167881
167881
|
if (updateLevel === 2) {
|
|
167882
|
-
watchConfigFile(state, project, projectPath,
|
|
167883
|
-
watchExtendedConfigFiles(state, projectPath,
|
|
167884
|
-
watchWildCardDirectories(state, project, projectPath,
|
|
167885
|
-
watchInputFiles(state, project, projectPath,
|
|
167886
|
-
watchPackageJsonFiles(state, project, projectPath,
|
|
167882
|
+
watchConfigFile(state, project, projectPath, config2);
|
|
167883
|
+
watchExtendedConfigFiles(state, projectPath, config2);
|
|
167884
|
+
watchWildCardDirectories(state, project, projectPath, config2);
|
|
167885
|
+
watchInputFiles(state, project, projectPath, config2);
|
|
167886
|
+
watchPackageJsonFiles(state, project, projectPath, config2);
|
|
167887
167887
|
} else if (updateLevel === 1) {
|
|
167888
|
-
|
|
167889
|
-
updateErrorForNoInputFiles(
|
|
167890
|
-
watchInputFiles(state, project, projectPath,
|
|
167891
|
-
watchPackageJsonFiles(state, project, projectPath,
|
|
167888
|
+
config2.fileNames = getFileNamesFromConfigSpecs(config2.options.configFile.configFileSpecs, getDirectoryPath(project), config2.options, state.parseConfigFileHost);
|
|
167889
|
+
updateErrorForNoInputFiles(config2.fileNames, project, config2.options.configFile.configFileSpecs, config2.errors, canJsonReportNoInputFiles(config2.raw));
|
|
167890
|
+
watchInputFiles(state, project, projectPath, config2);
|
|
167891
|
+
watchPackageJsonFiles(state, project, projectPath, config2);
|
|
167892
167892
|
}
|
|
167893
|
-
const status = getUpToDateStatus(state,
|
|
167893
|
+
const status = getUpToDateStatus(state, config2, projectPath);
|
|
167894
167894
|
if (!options.force) {
|
|
167895
167895
|
if (status.type === 1) {
|
|
167896
167896
|
verboseReportProjectStatus(state, project, status);
|
|
167897
|
-
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(
|
|
167897
|
+
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config2));
|
|
167898
167898
|
projectPendingBuild.delete(projectPath);
|
|
167899
167899
|
if (options.dry) {
|
|
167900
167900
|
reportStatus(state, Diagnostics.Project_0_is_up_to_date, project);
|
|
@@ -167902,20 +167902,20 @@ ${lanes.join("\n")}
|
|
|
167902
167902
|
continue;
|
|
167903
167903
|
}
|
|
167904
167904
|
if (status.type === 2 || status.type === 15) {
|
|
167905
|
-
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(
|
|
167905
|
+
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config2));
|
|
167906
167906
|
return {
|
|
167907
167907
|
kind: 1,
|
|
167908
167908
|
status,
|
|
167909
167909
|
project,
|
|
167910
167910
|
projectPath,
|
|
167911
167911
|
projectIndex,
|
|
167912
|
-
config
|
|
167912
|
+
config: config2
|
|
167913
167913
|
};
|
|
167914
167914
|
}
|
|
167915
167915
|
}
|
|
167916
167916
|
if (status.type === 12) {
|
|
167917
167917
|
verboseReportProjectStatus(state, project, status);
|
|
167918
|
-
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(
|
|
167918
|
+
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config2));
|
|
167919
167919
|
projectPendingBuild.delete(projectPath);
|
|
167920
167920
|
if (options.verbose) {
|
|
167921
167921
|
reportStatus(
|
|
@@ -167929,7 +167929,7 @@ ${lanes.join("\n")}
|
|
|
167929
167929
|
}
|
|
167930
167930
|
if (status.type === 16) {
|
|
167931
167931
|
verboseReportProjectStatus(state, project, status);
|
|
167932
|
-
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(
|
|
167932
|
+
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config2));
|
|
167933
167933
|
projectPendingBuild.delete(projectPath);
|
|
167934
167934
|
continue;
|
|
167935
167935
|
}
|
|
@@ -167939,7 +167939,7 @@ ${lanes.join("\n")}
|
|
|
167939
167939
|
project,
|
|
167940
167940
|
projectPath,
|
|
167941
167941
|
projectIndex,
|
|
167942
|
-
config
|
|
167942
|
+
config: config2
|
|
167943
167943
|
};
|
|
167944
167944
|
}
|
|
167945
167945
|
return void 0;
|
|
@@ -168379,9 +168379,9 @@ ${lanes.join("\n")}
|
|
|
168379
168379
|
oldestOutputFileName: getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
|
|
168380
168380
|
});
|
|
168381
168381
|
}
|
|
168382
|
-
function queueReferencingProjects(state, project, projectPath, projectIndex,
|
|
168382
|
+
function queueReferencingProjects(state, project, projectPath, projectIndex, config2, buildOrder, buildResult) {
|
|
168383
168383
|
if (state.options.stopBuildOnErrors && buildResult & 4) return;
|
|
168384
|
-
if (!
|
|
168384
|
+
if (!config2.options.composite) return;
|
|
168385
168385
|
for (let index = projectIndex + 1; index < buildOrder.length; index++) {
|
|
168386
168386
|
const nextProject = buildOrder[index];
|
|
168387
168387
|
const nextProjectPath = toResolvedConfigFilePath(state, nextProject);
|
|
@@ -169732,8 +169732,8 @@ ${lanes.join("\n")}
|
|
|
169732
169732
|
function createReportErrorSummary(sys2, options) {
|
|
169733
169733
|
return shouldBePretty(sys2, options) ? (errorCount, filesInError) => sys2.write(getErrorSummaryText(errorCount, filesInError, sys2.newLine, sys2)) : void 0;
|
|
169734
169734
|
}
|
|
169735
|
-
function performCompilation(sys2, cb, reportDiagnostic,
|
|
169736
|
-
const { fileNames, options, projectReferences } =
|
|
169735
|
+
function performCompilation(sys2, cb, reportDiagnostic, config2) {
|
|
169736
|
+
const { fileNames, options, projectReferences } = config2;
|
|
169737
169737
|
const host = createCompilerHostWorker(
|
|
169738
169738
|
options,
|
|
169739
169739
|
/*setParentNodes*/
|
|
@@ -169755,7 +169755,7 @@ ${lanes.join("\n")}
|
|
|
169755
169755
|
options,
|
|
169756
169756
|
projectReferences,
|
|
169757
169757
|
host,
|
|
169758
|
-
configFileParsingDiagnostics: getConfigFileParsingDiagnostics(
|
|
169758
|
+
configFileParsingDiagnostics: getConfigFileParsingDiagnostics(config2)
|
|
169759
169759
|
};
|
|
169760
169760
|
const program3 = createProgram(programOptions);
|
|
169761
169761
|
const exitStatus = emitFilesAndReportErrorsAndGetExitStatus(
|
|
@@ -169773,8 +169773,8 @@ ${lanes.join("\n")}
|
|
|
169773
169773
|
cb(program3);
|
|
169774
169774
|
return sys2.exit(exitStatus);
|
|
169775
169775
|
}
|
|
169776
|
-
function performIncrementalCompilation2(sys2, cb, reportDiagnostic,
|
|
169777
|
-
const { options, fileNames, projectReferences } =
|
|
169776
|
+
function performIncrementalCompilation2(sys2, cb, reportDiagnostic, config2) {
|
|
169777
|
+
const { options, fileNames, projectReferences } = config2;
|
|
169778
169778
|
enableStatisticsAndTracing(
|
|
169779
169779
|
sys2,
|
|
169780
169780
|
options,
|
|
@@ -169788,7 +169788,7 @@ ${lanes.join("\n")}
|
|
|
169788
169788
|
system: sys2,
|
|
169789
169789
|
rootNames: fileNames,
|
|
169790
169790
|
options,
|
|
169791
|
-
configFileParsingDiagnostics: getConfigFileParsingDiagnostics(
|
|
169791
|
+
configFileParsingDiagnostics: getConfigFileParsingDiagnostics(config2),
|
|
169792
169792
|
projectReferences,
|
|
169793
169793
|
reportDiagnostic,
|
|
169794
169794
|
reportErrorSummary: createReportErrorSummary(sys2, options),
|
|
@@ -174178,7 +174178,7 @@ ${lanes.join("\n")}
|
|
|
174178
174178
|
const symbols = /* @__PURE__ */ new Map();
|
|
174179
174179
|
const packages = /* @__PURE__ */ new Map();
|
|
174180
174180
|
let usableByFileName;
|
|
174181
|
-
const
|
|
174181
|
+
const cache2 = {
|
|
174182
174182
|
isUsableByFile: (importingFile) => importingFile === usableByFileName,
|
|
174183
174183
|
isEmpty: () => !exportInfo.size,
|
|
174184
174184
|
clear: () => {
|
|
@@ -174188,7 +174188,7 @@ ${lanes.join("\n")}
|
|
|
174188
174188
|
},
|
|
174189
174189
|
add: (importingFile, symbol, symbolTableKey, moduleSymbol, moduleFile, exportKind, isFromPackageJson, checker) => {
|
|
174190
174190
|
if (importingFile !== usableByFileName) {
|
|
174191
|
-
|
|
174191
|
+
cache2.clear();
|
|
174192
174192
|
usableByFileName = importingFile;
|
|
174193
174193
|
}
|
|
174194
174194
|
let packageName;
|
|
@@ -174276,7 +174276,7 @@ ${lanes.join("\n")}
|
|
|
174276
174276
|
// Changes elsewhere in the file can change the *type* of an export in a module augmentation,
|
|
174277
174277
|
// but type info is gathered in getCompletionEntryDetails, which doesn't use the cache.
|
|
174278
174278
|
!arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations) || !ambientModuleDeclarationsAreEqual(oldSourceFile, newSourceFile)) {
|
|
174279
|
-
|
|
174279
|
+
cache2.clear();
|
|
174280
174280
|
return true;
|
|
174281
174281
|
}
|
|
174282
174282
|
usableByFileName = newSourceFile.path;
|
|
@@ -174284,9 +174284,9 @@ ${lanes.join("\n")}
|
|
|
174284
174284
|
}
|
|
174285
174285
|
};
|
|
174286
174286
|
if (Debug.isDebugging) {
|
|
174287
|
-
Object.defineProperty(
|
|
174287
|
+
Object.defineProperty(cache2, "__cache", { value: exportInfo });
|
|
174288
174288
|
}
|
|
174289
|
-
return
|
|
174289
|
+
return cache2;
|
|
174290
174290
|
function rehydrateCachedInfo(info) {
|
|
174291
174291
|
if (info.symbol && info.moduleSymbol) return info;
|
|
174292
174292
|
const { id, exportKind, targetFlags, isFromPackageJson, moduleFileName } = info;
|
|
@@ -174481,7 +174481,7 @@ ${lanes.join("\n")}
|
|
|
174481
174481
|
var _a, _b, _c, _d, _e;
|
|
174482
174482
|
const start = timestamp();
|
|
174483
174483
|
(_a = host.getPackageJsonAutoImportProvider) == null ? void 0 : _a.call(host);
|
|
174484
|
-
const
|
|
174484
|
+
const cache2 = ((_b = host.getCachedExportInfoMap) == null ? void 0 : _b.call(host)) || createCacheableExportInfoMap({
|
|
174485
174485
|
getCurrentProgram: () => program3,
|
|
174486
174486
|
getPackageJsonAutoImportProvider: () => {
|
|
174487
174487
|
var _a2;
|
|
@@ -174492,9 +174492,9 @@ ${lanes.join("\n")}
|
|
|
174492
174492
|
return (_a2 = host.getGlobalTypingsCacheLocation) == null ? void 0 : _a2.call(host);
|
|
174493
174493
|
}
|
|
174494
174494
|
});
|
|
174495
|
-
if (
|
|
174495
|
+
if (cache2.isUsableByFile(importingFile.path)) {
|
|
174496
174496
|
(_c = host.log) == null ? void 0 : _c.call(host, "getExportInfoMap: cache hit");
|
|
174497
|
-
return
|
|
174497
|
+
return cache2;
|
|
174498
174498
|
}
|
|
174499
174499
|
(_d = host.log) == null ? void 0 : _d.call(host, "getExportInfoMap: cache miss or empty; calculating new results");
|
|
174500
174500
|
let moduleCount = 0;
|
|
@@ -174511,7 +174511,7 @@ ${lanes.join("\n")}
|
|
|
174511
174511
|
const checker = program22.getTypeChecker();
|
|
174512
174512
|
const defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker);
|
|
174513
174513
|
if (defaultInfo && isImportableSymbol(defaultInfo.symbol, checker)) {
|
|
174514
|
-
|
|
174514
|
+
cache2.add(
|
|
174515
174515
|
importingFile.path,
|
|
174516
174516
|
defaultInfo.symbol,
|
|
174517
174517
|
defaultInfo.exportKind === 1 ? "default" : "export=",
|
|
@@ -174524,7 +174524,7 @@ ${lanes.join("\n")}
|
|
|
174524
174524
|
}
|
|
174525
174525
|
checker.forEachExportAndPropertyOfModule(moduleSymbol, (exported, key) => {
|
|
174526
174526
|
if (exported !== (defaultInfo == null ? void 0 : defaultInfo.symbol) && isImportableSymbol(exported, checker) && addToSeen(seenExports, key)) {
|
|
174527
|
-
|
|
174527
|
+
cache2.add(
|
|
174528
174528
|
importingFile.path,
|
|
174529
174529
|
exported,
|
|
174530
174530
|
key,
|
|
@@ -174539,11 +174539,11 @@ ${lanes.join("\n")}
|
|
|
174539
174539
|
}
|
|
174540
174540
|
);
|
|
174541
174541
|
} catch (err) {
|
|
174542
|
-
|
|
174542
|
+
cache2.clear();
|
|
174543
174543
|
throw err;
|
|
174544
174544
|
}
|
|
174545
174545
|
(_e = host.log) == null ? void 0 : _e.call(host, `getExportInfoMap: done in ${timestamp() - start} ms`);
|
|
174546
|
-
return
|
|
174546
|
+
return cache2;
|
|
174547
174547
|
}
|
|
174548
174548
|
function getDefaultLikeExportInfo(moduleSymbol, checker) {
|
|
174549
174549
|
const exportEquals = checker.resolveExternalModuleSymbol(moduleSymbol);
|
|
@@ -199562,8 +199562,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
199562
199562
|
function completionEntryDataIsResolved(data) {
|
|
199563
199563
|
return !!(data == null ? void 0 : data.moduleSpecifier);
|
|
199564
199564
|
}
|
|
199565
|
-
function continuePreviousIncompleteResponse(
|
|
199566
|
-
const previousResponse =
|
|
199565
|
+
function continuePreviousIncompleteResponse(cache2, file, location, program3, host, preferences, cancellationToken, position) {
|
|
199566
|
+
const previousResponse = cache2.get();
|
|
199567
199567
|
if (!previousResponse) return void 0;
|
|
199568
199568
|
const touchNode = getTouchingPropertyName(file, position);
|
|
199569
199569
|
const lowerCaseTokenText = location.text.toLowerCase();
|
|
@@ -199750,12 +199750,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
199750
199750
|
];
|
|
199751
199751
|
}
|
|
199752
199752
|
return patternWorker(path14, pattern, initializer, dotDotDotToken, { tabstop: 1 });
|
|
199753
|
-
function patternWorker(
|
|
199753
|
+
function patternWorker(path23, pattern2, initializer2, dotDotDotToken2, counter) {
|
|
199754
199754
|
if (isObjectBindingPattern(pattern2) && !dotDotDotToken2) {
|
|
199755
199755
|
const oldTabstop = counter.tabstop;
|
|
199756
199756
|
const childCounter = { tabstop: oldTabstop };
|
|
199757
199757
|
const rootParam = getJSDocParamAnnotation(
|
|
199758
|
-
|
|
199758
|
+
path23,
|
|
199759
199759
|
initializer2,
|
|
199760
199760
|
dotDotDotToken2,
|
|
199761
199761
|
isJs,
|
|
@@ -199769,7 +199769,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
199769
199769
|
);
|
|
199770
199770
|
let childTags = [];
|
|
199771
199771
|
for (const element of pattern2.elements) {
|
|
199772
|
-
const elementTags = elementWorker(
|
|
199772
|
+
const elementTags = elementWorker(path23, element, childCounter);
|
|
199773
199773
|
if (!elementTags) {
|
|
199774
199774
|
childTags = void 0;
|
|
199775
199775
|
break;
|
|
@@ -199784,7 +199784,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
199784
199784
|
}
|
|
199785
199785
|
return [
|
|
199786
199786
|
getJSDocParamAnnotation(
|
|
199787
|
-
|
|
199787
|
+
path23,
|
|
199788
199788
|
initializer2,
|
|
199789
199789
|
dotDotDotToken2,
|
|
199790
199790
|
isJs,
|
|
@@ -199798,13 +199798,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
199798
199798
|
)
|
|
199799
199799
|
];
|
|
199800
199800
|
}
|
|
199801
|
-
function elementWorker(
|
|
199801
|
+
function elementWorker(path23, element, counter) {
|
|
199802
199802
|
if (!element.propertyName && isIdentifier(element.name) || isIdentifier(element.name)) {
|
|
199803
199803
|
const propertyName = element.propertyName ? tryGetTextOfPropertyName(element.propertyName) : element.name.text;
|
|
199804
199804
|
if (!propertyName) {
|
|
199805
199805
|
return void 0;
|
|
199806
199806
|
}
|
|
199807
|
-
const paramName = `${
|
|
199807
|
+
const paramName = `${path23}.${propertyName}`;
|
|
199808
199808
|
return [
|
|
199809
199809
|
getJSDocParamAnnotation(
|
|
199810
199810
|
paramName,
|
|
@@ -199822,7 +199822,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
199822
199822
|
];
|
|
199823
199823
|
} else if (element.propertyName) {
|
|
199824
199824
|
const propertyName = tryGetTextOfPropertyName(element.propertyName);
|
|
199825
|
-
return propertyName && patternWorker(`${
|
|
199825
|
+
return propertyName && patternWorker(`${path23}.${propertyName}`, element.name, element.initializer, element.dotDotDotToken, counter);
|
|
199826
199826
|
}
|
|
199827
199827
|
return void 0;
|
|
199828
199828
|
}
|
|
@@ -223450,9 +223450,9 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
223450
223450
|
// TODO: GH#18217
|
|
223451
223451
|
};
|
|
223452
223452
|
var noopConfigFileWatcher = { close: noop };
|
|
223453
|
-
function getConfigFileNameFromCache(info,
|
|
223454
|
-
if (!
|
|
223455
|
-
return
|
|
223453
|
+
function getConfigFileNameFromCache(info, cache2) {
|
|
223454
|
+
if (!cache2 || isAncestorConfigFileInfo(info)) return void 0;
|
|
223455
|
+
return cache2.get(info.path);
|
|
223456
223456
|
}
|
|
223457
223457
|
function isOpenScriptInfo(infoOrFileNameOrConfig) {
|
|
223458
223458
|
return !!infoOrFileNameOrConfig.containingProjects;
|
|
@@ -224239,18 +224239,18 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
224239
224239
|
/**
|
|
224240
224240
|
* This is to watch whenever files are added or removed to the wildcard directories
|
|
224241
224241
|
*/
|
|
224242
|
-
watchWildcardDirectory(directory, flags, configFileName,
|
|
224242
|
+
watchWildcardDirectory(directory, flags, configFileName, config2) {
|
|
224243
224243
|
let watcher = this.watchFactory.watchDirectory(
|
|
224244
224244
|
directory,
|
|
224245
224245
|
(fileOrDirectory) => this.onWildCardDirectoryWatcherInvoke(
|
|
224246
224246
|
directory,
|
|
224247
224247
|
configFileName,
|
|
224248
|
-
|
|
224248
|
+
config2,
|
|
224249
224249
|
result,
|
|
224250
224250
|
fileOrDirectory
|
|
224251
224251
|
),
|
|
224252
224252
|
flags,
|
|
224253
|
-
this.getWatchOptionsFromProjectWatchOptions(
|
|
224253
|
+
this.getWatchOptionsFromProjectWatchOptions(config2.parsedCommandLine.watchOptions, getDirectoryPath(configFileName)),
|
|
224254
224254
|
WatchType.WildcardDirectory,
|
|
224255
224255
|
configFileName
|
|
224256
224256
|
);
|
|
@@ -224271,9 +224271,9 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
224271
224271
|
};
|
|
224272
224272
|
return result;
|
|
224273
224273
|
}
|
|
224274
|
-
onWildCardDirectoryWatcherInvoke(directory, configFileName,
|
|
224274
|
+
onWildCardDirectoryWatcherInvoke(directory, configFileName, config2, wildCardWatcher, fileOrDirectory) {
|
|
224275
224275
|
const fileOrDirectoryPath = this.toPath(fileOrDirectory);
|
|
224276
|
-
const fsResult =
|
|
224276
|
+
const fsResult = config2.cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
|
|
224277
224277
|
if (getBaseFileName(fileOrDirectoryPath) === "package.json" && !isInsideNodeModules(fileOrDirectoryPath) && (fsResult && fsResult.fileExists || !fsResult && this.host.fileExists(fileOrDirectory))) {
|
|
224278
224278
|
const file = this.getNormalizedAbsolutePath(fileOrDirectory);
|
|
224279
224279
|
this.logger.info(`Config: ${configFileName} Detected new package.json: ${file}`);
|
|
@@ -224291,15 +224291,15 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
224291
224291
|
configFileName,
|
|
224292
224292
|
extraFileExtensions: this.hostConfiguration.extraFileExtensions,
|
|
224293
224293
|
currentDirectory: this.currentDirectory,
|
|
224294
|
-
options:
|
|
224295
|
-
program: (configuredProjectForConfig == null ? void 0 : configuredProjectForConfig.getCurrentProgram()) ||
|
|
224294
|
+
options: config2.parsedCommandLine.options,
|
|
224295
|
+
program: (configuredProjectForConfig == null ? void 0 : configuredProjectForConfig.getCurrentProgram()) || config2.parsedCommandLine.fileNames,
|
|
224296
224296
|
useCaseSensitiveFileNames: this.host.useCaseSensitiveFileNames,
|
|
224297
224297
|
writeLog: (s) => this.logger.info(s),
|
|
224298
224298
|
toPath: (s) => this.toPath(s),
|
|
224299
224299
|
getScriptKind: configuredProjectForConfig ? (fileName) => configuredProjectForConfig.getScriptKind(fileName) : void 0
|
|
224300
224300
|
})) return;
|
|
224301
|
-
if (
|
|
224302
|
-
|
|
224301
|
+
if (config2.updateLevel !== 2) config2.updateLevel = 1;
|
|
224302
|
+
config2.projects.forEach((watchWildcardDirectories, projectCanonicalPath) => {
|
|
224303
224303
|
var _a;
|
|
224304
224304
|
if (!watchWildcardDirectories) return;
|
|
224305
224305
|
const project = this.getConfiguredProjectByCanonicalConfigFilePath(projectCanonicalPath);
|
|
@@ -225060,22 +225060,22 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
225060
225060
|
return configFileExistenceInfo;
|
|
225061
225061
|
}
|
|
225062
225062
|
/** @internal */
|
|
225063
|
-
watchWildcards(configFileName, { exists, config }, forProject) {
|
|
225064
|
-
|
|
225063
|
+
watchWildcards(configFileName, { exists, config: config2 }, forProject) {
|
|
225064
|
+
config2.projects.set(forProject.canonicalConfigFilePath, true);
|
|
225065
225065
|
if (exists) {
|
|
225066
|
-
if (
|
|
225067
|
-
|
|
225066
|
+
if (config2.watchedDirectories && !config2.watchedDirectoriesStale) return;
|
|
225067
|
+
config2.watchedDirectoriesStale = false;
|
|
225068
225068
|
updateWatchingWildcardDirectories(
|
|
225069
|
-
|
|
225070
|
-
|
|
225069
|
+
config2.watchedDirectories || (config2.watchedDirectories = /* @__PURE__ */ new Map()),
|
|
225070
|
+
config2.parsedCommandLine.wildcardDirectories,
|
|
225071
225071
|
// Create new directory watcher
|
|
225072
|
-
(directory, flags) => this.watchWildcardDirectory(directory, flags, configFileName,
|
|
225072
|
+
(directory, flags) => this.watchWildcardDirectory(directory, flags, configFileName, config2)
|
|
225073
225073
|
);
|
|
225074
225074
|
} else {
|
|
225075
|
-
|
|
225076
|
-
if (!
|
|
225077
|
-
clearMap(
|
|
225078
|
-
|
|
225075
|
+
config2.watchedDirectoriesStale = false;
|
|
225076
|
+
if (!config2.watchedDirectories) return;
|
|
225077
|
+
clearMap(config2.watchedDirectories, closeFileWatcherOf);
|
|
225078
|
+
config2.watchedDirectories = void 0;
|
|
225079
225079
|
}
|
|
225080
225080
|
}
|
|
225081
225081
|
/** @internal */
|
|
@@ -225184,21 +225184,21 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
225184
225184
|
project.markAsDirty();
|
|
225185
225185
|
return project.updateGraph();
|
|
225186
225186
|
}
|
|
225187
|
-
reloadFileNamesOfParsedConfig(configFileName,
|
|
225188
|
-
if (
|
|
225187
|
+
reloadFileNamesOfParsedConfig(configFileName, config2) {
|
|
225188
|
+
if (config2.updateLevel === void 0) return config2.parsedCommandLine.fileNames;
|
|
225189
225189
|
Debug.assert(
|
|
225190
|
-
|
|
225190
|
+
config2.updateLevel === 1
|
|
225191
225191
|
/* RootNamesAndUpdate */
|
|
225192
225192
|
);
|
|
225193
|
-
const configFileSpecs =
|
|
225193
|
+
const configFileSpecs = config2.parsedCommandLine.options.configFile.configFileSpecs;
|
|
225194
225194
|
const fileNames = getFileNamesFromConfigSpecs(
|
|
225195
225195
|
configFileSpecs,
|
|
225196
225196
|
getDirectoryPath(configFileName),
|
|
225197
|
-
|
|
225198
|
-
|
|
225197
|
+
config2.parsedCommandLine.options,
|
|
225198
|
+
config2.cachedDirectoryStructureHost,
|
|
225199
225199
|
this.hostConfiguration.extraFileExtensions
|
|
225200
225200
|
);
|
|
225201
|
-
|
|
225201
|
+
config2.parsedCommandLine = { ...config2.parsedCommandLine, fileNames };
|
|
225202
225202
|
return fileNames;
|
|
225203
225203
|
}
|
|
225204
225204
|
/** @internal */
|
|
@@ -226256,7 +226256,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
226256
226256
|
this.removeOrphanScriptInfos();
|
|
226257
226257
|
}
|
|
226258
226258
|
tryInvokeWildCardDirectories(info) {
|
|
226259
|
-
this.configFileExistenceInfoCache.forEach((configFileExistenceInfo,
|
|
226259
|
+
this.configFileExistenceInfoCache.forEach((configFileExistenceInfo, config2) => {
|
|
226260
226260
|
var _a, _b;
|
|
226261
226261
|
if (!((_a = configFileExistenceInfo.config) == null ? void 0 : _a.parsedCommandLine) || contains(
|
|
226262
226262
|
configFileExistenceInfo.config.parsedCommandLine.fileNames,
|
|
@@ -226267,10 +226267,10 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
226267
226267
|
}
|
|
226268
226268
|
(_b = configFileExistenceInfo.config.watchedDirectories) == null ? void 0 : _b.forEach((watcher, directory) => {
|
|
226269
226269
|
if (containsPath(directory, info.fileName, !this.host.useCaseSensitiveFileNames)) {
|
|
226270
|
-
this.logger.info(`Invoking ${
|
|
226270
|
+
this.logger.info(`Invoking ${config2}:: wildcard for open scriptInfo:: ${info.fileName}`);
|
|
226271
226271
|
this.onWildCardDirectoryWatcherInvoke(
|
|
226272
226272
|
directory,
|
|
226273
|
-
|
|
226273
|
+
config2,
|
|
226274
226274
|
configFileExistenceInfo.config,
|
|
226275
226275
|
watcher.watcher,
|
|
226276
226276
|
info.fileName
|
|
@@ -226939,8 +226939,8 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
226939
226939
|
}
|
|
226940
226940
|
};
|
|
226941
226941
|
}
|
|
226942
|
-
function isConfigFile(
|
|
226943
|
-
return
|
|
226942
|
+
function isConfigFile(config2) {
|
|
226943
|
+
return config2.kind !== void 0;
|
|
226944
226944
|
}
|
|
226945
226945
|
function printProjectWithoutFileNames(project) {
|
|
226946
226946
|
project.print(
|
|
@@ -226954,12 +226954,12 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
226954
226954
|
}
|
|
226955
226955
|
function createModuleSpecifierCache(host) {
|
|
226956
226956
|
let containedNodeModulesWatchers;
|
|
226957
|
-
let
|
|
226957
|
+
let cache2;
|
|
226958
226958
|
let currentKey;
|
|
226959
226959
|
const result = {
|
|
226960
226960
|
get(fromFileName, toFileName2, preferences, options) {
|
|
226961
|
-
if (!
|
|
226962
|
-
return
|
|
226961
|
+
if (!cache2 || currentKey !== key(fromFileName, preferences, options)) return void 0;
|
|
226962
|
+
return cache2.get(toFileName2);
|
|
226963
226963
|
},
|
|
226964
226964
|
set(fromFileName, toFileName2, preferences, options, kind, modulePaths, moduleSpecifiers2) {
|
|
226965
226965
|
ensureCache(fromFileName, preferences, options).set(toFileName2, createInfo(
|
|
@@ -226987,12 +226987,12 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
226987
226987
|
}
|
|
226988
226988
|
},
|
|
226989
226989
|
setModulePaths(fromFileName, toFileName2, preferences, options, modulePaths) {
|
|
226990
|
-
const
|
|
226991
|
-
const info =
|
|
226990
|
+
const cache22 = ensureCache(fromFileName, preferences, options);
|
|
226991
|
+
const info = cache22.get(toFileName2);
|
|
226992
226992
|
if (info) {
|
|
226993
226993
|
info.modulePaths = modulePaths;
|
|
226994
226994
|
} else {
|
|
226995
|
-
|
|
226995
|
+
cache22.set(toFileName2, createInfo(
|
|
226996
226996
|
/*kind*/
|
|
226997
226997
|
void 0,
|
|
226998
226998
|
modulePaths,
|
|
@@ -227006,13 +227006,13 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
227006
227006
|
}
|
|
227007
227007
|
},
|
|
227008
227008
|
setBlockedByPackageJsonDependencies(fromFileName, toFileName2, preferences, options, packageName, isBlockedByPackageJsonDependencies) {
|
|
227009
|
-
const
|
|
227010
|
-
const info =
|
|
227009
|
+
const cache22 = ensureCache(fromFileName, preferences, options);
|
|
227010
|
+
const info = cache22.get(toFileName2);
|
|
227011
227011
|
if (info) {
|
|
227012
227012
|
info.isBlockedByPackageJsonDependencies = isBlockedByPackageJsonDependencies;
|
|
227013
227013
|
info.packageName = packageName;
|
|
227014
227014
|
} else {
|
|
227015
|
-
|
|
227015
|
+
cache22.set(toFileName2, createInfo(
|
|
227016
227016
|
/*kind*/
|
|
227017
227017
|
void 0,
|
|
227018
227018
|
/*modulePaths*/
|
|
@@ -227026,25 +227026,25 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
227026
227026
|
},
|
|
227027
227027
|
clear() {
|
|
227028
227028
|
containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.forEach(closeFileWatcher);
|
|
227029
|
-
|
|
227029
|
+
cache2 == null ? void 0 : cache2.clear();
|
|
227030
227030
|
containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.clear();
|
|
227031
227031
|
currentKey = void 0;
|
|
227032
227032
|
},
|
|
227033
227033
|
count() {
|
|
227034
|
-
return
|
|
227034
|
+
return cache2 ? cache2.size : 0;
|
|
227035
227035
|
}
|
|
227036
227036
|
};
|
|
227037
227037
|
if (Debug.isDebugging) {
|
|
227038
|
-
Object.defineProperty(result, "__cache", { get: () =>
|
|
227038
|
+
Object.defineProperty(result, "__cache", { get: () => cache2 });
|
|
227039
227039
|
}
|
|
227040
227040
|
return result;
|
|
227041
227041
|
function ensureCache(fromFileName, preferences, options) {
|
|
227042
227042
|
const newKey = key(fromFileName, preferences, options);
|
|
227043
|
-
if (
|
|
227043
|
+
if (cache2 && currentKey !== newKey) {
|
|
227044
227044
|
result.clear();
|
|
227045
227045
|
}
|
|
227046
227046
|
currentKey = newKey;
|
|
227047
|
-
return
|
|
227047
|
+
return cache2 || (cache2 = /* @__PURE__ */ new Map());
|
|
227048
227048
|
}
|
|
227049
227049
|
function key(fromFileName, preferences, options) {
|
|
227050
227050
|
return `${fromFileName},${preferences.importModuleSpecifierEnding},${preferences.importModuleSpecifierPreference},${options.overrideImportMode}`;
|
|
@@ -231200,9 +231200,9 @@ ${e.message}`;
|
|
|
231200
231200
|
_ScriptVersionCache.maxVersions = 8;
|
|
231201
231201
|
var ScriptVersionCache = _ScriptVersionCache;
|
|
231202
231202
|
var LineIndexSnapshot = class _LineIndexSnapshot {
|
|
231203
|
-
constructor(version2,
|
|
231203
|
+
constructor(version2, cache2, index, changesSincePreviousVersion = emptyArray2) {
|
|
231204
231204
|
this.version = version2;
|
|
231205
|
-
this.cache =
|
|
231205
|
+
this.cache = cache2;
|
|
231206
231206
|
this.index = index;
|
|
231207
231207
|
this.changesSincePreviousVersion = changesSincePreviousVersion;
|
|
231208
231208
|
}
|
|
@@ -237541,9 +237541,9 @@ ${nodeLocation}` : message;
|
|
|
237541
237541
|
return ts__namespace.createLanguageServiceSourceFile(filePath, scriptSnapshot, optionsOrScriptTarget ?? ts__namespace.ScriptTarget.Latest, version, setParentNodes, scriptKind);
|
|
237542
237542
|
}
|
|
237543
237543
|
function createDocumentCache(files) {
|
|
237544
|
-
const
|
|
237545
|
-
|
|
237546
|
-
return
|
|
237544
|
+
const cache2 = new InternalDocumentCache();
|
|
237545
|
+
cache2._addFiles(files);
|
|
237546
|
+
return cache2;
|
|
237547
237547
|
}
|
|
237548
237548
|
var FileSystemDocumentCache = class {
|
|
237549
237549
|
#documentCache;
|
|
@@ -292642,50 +292642,104 @@ function ora(options) {
|
|
|
292642
292642
|
|
|
292643
292643
|
// src/index.ts
|
|
292644
292644
|
var import_node_child_process = require("child_process");
|
|
292645
|
+
var import_node_path2 = __toESM(require("path"));
|
|
292646
|
+
var import_node_os3 = __toESM(require("os"));
|
|
292647
|
+
var import_fs_extra14 = __toESM(require_lib());
|
|
292648
|
+
var import_prompts2 = __toESM(require_prompts3());
|
|
292649
|
+
|
|
292650
|
+
// src/global-config.ts
|
|
292645
292651
|
var import_node_path = __toESM(require("path"));
|
|
292646
292652
|
var import_node_os2 = __toESM(require("os"));
|
|
292647
|
-
var
|
|
292648
|
-
var
|
|
292653
|
+
var import_fs_extra = __toESM(require_lib());
|
|
292654
|
+
var CONFIG_PATH = import_node_path.default.join(import_node_os2.default.homedir(), ".xo", "config.json");
|
|
292655
|
+
var DEFAULTS = {
|
|
292656
|
+
autoUpdate: true,
|
|
292657
|
+
registryUrl: "https://registry.npmjs.org"
|
|
292658
|
+
};
|
|
292659
|
+
var CONFIG_META = {
|
|
292660
|
+
autoUpdate: {
|
|
292661
|
+
description: "Show update notifications after each command",
|
|
292662
|
+
type: "boolean",
|
|
292663
|
+
default: "true"
|
|
292664
|
+
},
|
|
292665
|
+
registryUrl: {
|
|
292666
|
+
description: "npm registry URL used for update checks",
|
|
292667
|
+
type: "string",
|
|
292668
|
+
default: "https://registry.npmjs.org"
|
|
292669
|
+
},
|
|
292670
|
+
githubToken: {
|
|
292671
|
+
description: "GitHub personal access token for private generator repos",
|
|
292672
|
+
type: "string"
|
|
292673
|
+
}
|
|
292674
|
+
};
|
|
292675
|
+
async function readGlobalConfig() {
|
|
292676
|
+
if (!await import_fs_extra.default.pathExists(CONFIG_PATH)) return { ...DEFAULTS };
|
|
292677
|
+
const stored = await import_fs_extra.default.readJson(CONFIG_PATH).catch(() => ({}));
|
|
292678
|
+
return { ...DEFAULTS, ...stored };
|
|
292679
|
+
}
|
|
292680
|
+
async function getConfigValue(key) {
|
|
292681
|
+
if (!(key in CONFIG_META)) throw new Error(unknownKeyMsg(key));
|
|
292682
|
+
const config2 = await readGlobalConfig();
|
|
292683
|
+
return config2[key];
|
|
292684
|
+
}
|
|
292685
|
+
async function setConfigValue(key, raw) {
|
|
292686
|
+
if (!(key in CONFIG_META)) throw new Error(unknownKeyMsg(key));
|
|
292687
|
+
const meta = CONFIG_META[key];
|
|
292688
|
+
let value = raw;
|
|
292689
|
+
if (meta.type === "boolean") {
|
|
292690
|
+
if (raw === "true") value = true;
|
|
292691
|
+
else if (raw === "false") value = false;
|
|
292692
|
+
else throw new Error(`Invalid value for "${key}": expected true or false, got "${raw}"`);
|
|
292693
|
+
}
|
|
292694
|
+
const current = await readGlobalConfig();
|
|
292695
|
+
await import_fs_extra.default.ensureDir(import_node_path.default.dirname(CONFIG_PATH));
|
|
292696
|
+
await import_fs_extra.default.writeJson(CONFIG_PATH, { ...current, [key]: value }, { spaces: 2 });
|
|
292697
|
+
}
|
|
292698
|
+
function unknownKeyMsg(key) {
|
|
292699
|
+
return `Unknown config key: "${key}"
|
|
292700
|
+
Valid keys: ${Object.keys(CONFIG_META).join(", ")}`;
|
|
292701
|
+
}
|
|
292649
292702
|
|
|
292650
292703
|
// ../core/dist/index.mjs
|
|
292651
292704
|
var import_path = __toESM(require("path"), 1);
|
|
292652
|
-
var
|
|
292705
|
+
var import_fs_extra2 = __toESM(require_lib(), 1);
|
|
292653
292706
|
var import_yaml = __toESM(require_dist2(), 1);
|
|
292654
292707
|
var import_path2 = __toESM(require("path"), 1);
|
|
292655
|
-
var
|
|
292708
|
+
var import_fs_extra3 = __toESM(require_lib(), 1);
|
|
292656
292709
|
var import_crypto = require("crypto");
|
|
292657
292710
|
var import_path3 = __toESM(require("path"), 1);
|
|
292658
292711
|
var import_os = __toESM(require("os"), 1);
|
|
292659
|
-
var import_fs_extra3 = __toESM(require_lib(), 1);
|
|
292660
|
-
var import_path4 = __toESM(require("path"), 1);
|
|
292661
292712
|
var import_fs_extra4 = __toESM(require_lib(), 1);
|
|
292713
|
+
var import_path4 = __toESM(require("path"), 1);
|
|
292714
|
+
var import_fs_extra5 = __toESM(require_lib(), 1);
|
|
292662
292715
|
var import_prompts = __toESM(require_prompts3(), 1);
|
|
292663
292716
|
var import_handlebars = __toESM(require_lib3(), 1);
|
|
292664
292717
|
var import_path5 = __toESM(require("path"), 1);
|
|
292665
|
-
var
|
|
292666
|
-
var import_child_process = require("child_process");
|
|
292718
|
+
var import_https = __toESM(require("https"), 1);
|
|
292667
292719
|
var import_fs_extra6 = __toESM(require_lib(), 1);
|
|
292720
|
+
var import_child_process = require("child_process");
|
|
292721
|
+
var import_fs_extra7 = __toESM(require_lib(), 1);
|
|
292668
292722
|
var import_path6 = __toESM(require("path"), 1);
|
|
292669
292723
|
var import_path7 = __toESM(require("path"), 1);
|
|
292670
292724
|
var import_os2 = __toESM(require("os"), 1);
|
|
292671
|
-
var
|
|
292725
|
+
var import_fs_extra8 = __toESM(require_lib(), 1);
|
|
292672
292726
|
var import_yaml2 = __toESM(require_dist2(), 1);
|
|
292673
292727
|
var import_path8 = __toESM(require("path"), 1);
|
|
292674
292728
|
var import_os3 = __toESM(require("os"), 1);
|
|
292675
|
-
var
|
|
292729
|
+
var import_fs_extra9 = __toESM(require_lib(), 1);
|
|
292676
292730
|
var import_yaml3 = __toESM(require_dist2(), 1);
|
|
292677
292731
|
var import_path9 = __toESM(require("path"), 1);
|
|
292678
|
-
var
|
|
292732
|
+
var import_fs_extra10 = __toESM(require_lib(), 1);
|
|
292679
292733
|
var import_ts_morph = __toESM(require_ts_morph(), 1);
|
|
292680
292734
|
var import_path10 = __toESM(require("path"), 1);
|
|
292681
|
-
var
|
|
292735
|
+
var import_fs_extra11 = __toESM(require_lib(), 1);
|
|
292682
292736
|
var import_path11 = __toESM(require("path"), 1);
|
|
292683
292737
|
var import_os4 = __toESM(require("os"), 1);
|
|
292684
|
-
var
|
|
292738
|
+
var import_fs_extra12 = __toESM(require_lib(), 1);
|
|
292685
292739
|
var import_yaml4 = __toESM(require_dist2(), 1);
|
|
292686
292740
|
var import_path12 = __toESM(require("path"), 1);
|
|
292687
292741
|
var import_os5 = __toESM(require("os"), 1);
|
|
292688
|
-
var
|
|
292742
|
+
var import_fs_extra13 = __toESM(require_lib(), 1);
|
|
292689
292743
|
var import_yaml5 = __toESM(require_dist2(), 1);
|
|
292690
292744
|
function interpolate(template, ctx) {
|
|
292691
292745
|
return template.replace(/\{\{([^}]+)\}\}/g, (match, key) => {
|
|
@@ -292711,7 +292765,7 @@ var DEFAULT_CONFIG_FILE = "xo.config.yaml";
|
|
|
292711
292765
|
async function findConfigFile(cwd) {
|
|
292712
292766
|
for (const filename of CONFIG_FILES) {
|
|
292713
292767
|
const filePath = import_path.default.join(cwd, filename);
|
|
292714
|
-
if (await
|
|
292768
|
+
if (await import_fs_extra2.default.pathExists(filePath)) {
|
|
292715
292769
|
return { filePath, isYaml: !filename.endsWith(".json") };
|
|
292716
292770
|
}
|
|
292717
292771
|
}
|
|
@@ -292721,18 +292775,18 @@ async function readConfig(cwd) {
|
|
|
292721
292775
|
const found = await findConfigFile(cwd);
|
|
292722
292776
|
if (!found) return {};
|
|
292723
292777
|
try {
|
|
292724
|
-
const content = await
|
|
292778
|
+
const content = await import_fs_extra2.default.readFile(found.filePath, "utf8");
|
|
292725
292779
|
return found.isYaml ? (0, import_yaml.parse)(content) : JSON.parse(content);
|
|
292726
292780
|
} catch {
|
|
292727
292781
|
return {};
|
|
292728
292782
|
}
|
|
292729
292783
|
}
|
|
292730
|
-
async function writeConfig(cwd,
|
|
292784
|
+
async function writeConfig(cwd, config2) {
|
|
292731
292785
|
const found = await findConfigFile(cwd);
|
|
292732
292786
|
const filePath = found?.filePath ?? import_path.default.join(cwd, DEFAULT_CONFIG_FILE);
|
|
292733
292787
|
const isYaml = !filePath.endsWith(".json");
|
|
292734
|
-
const content = isYaml ? (0, import_yaml.stringify)(
|
|
292735
|
-
await
|
|
292788
|
+
const content = isYaml ? (0, import_yaml.stringify)(config2) : JSON.stringify(config2, null, 2);
|
|
292789
|
+
await import_fs_extra2.default.writeFile(filePath, content, "utf8");
|
|
292736
292790
|
}
|
|
292737
292791
|
async function mergeConfig(cwd, patch) {
|
|
292738
292792
|
const existing = await readConfig(cwd);
|
|
@@ -292745,13 +292799,13 @@ async function getStatePath(cwd) {
|
|
|
292745
292799
|
}
|
|
292746
292800
|
async function readState(cwd) {
|
|
292747
292801
|
const statePath = await getStatePath(cwd);
|
|
292748
|
-
if (!await
|
|
292749
|
-
return
|
|
292802
|
+
if (!await import_fs_extra3.default.pathExists(statePath)) return { operations: [] };
|
|
292803
|
+
return import_fs_extra3.default.readJson(statePath).catch(() => ({ operations: [] }));
|
|
292750
292804
|
}
|
|
292751
292805
|
async function writeState(cwd, state) {
|
|
292752
292806
|
const statePath = await getStatePath(cwd);
|
|
292753
|
-
await
|
|
292754
|
-
await
|
|
292807
|
+
await import_fs_extra3.default.ensureDir(import_path2.default.dirname(statePath));
|
|
292808
|
+
await import_fs_extra3.default.writeJson(statePath, state, { spaces: 2 });
|
|
292755
292809
|
}
|
|
292756
292810
|
async function recordOperation(cwd, generator, type, files) {
|
|
292757
292811
|
const state = await readState(cwd);
|
|
@@ -292771,11 +292825,11 @@ async function undoLastOperation(cwd) {
|
|
|
292771
292825
|
for (const snap of [...op.files].reverse()) {
|
|
292772
292826
|
const absPath = import_path2.default.join(cwd, snap.filePath);
|
|
292773
292827
|
if (snap.action === "created") {
|
|
292774
|
-
await
|
|
292828
|
+
await import_fs_extra3.default.remove(absPath);
|
|
292775
292829
|
} else if (snap.action === "modified" && snap.before !== void 0) {
|
|
292776
|
-
await
|
|
292830
|
+
await import_fs_extra3.default.outputFile(absPath, snap.before, "utf8");
|
|
292777
292831
|
} else if (snap.action === "deleted" && snap.before !== void 0) {
|
|
292778
|
-
await
|
|
292832
|
+
await import_fs_extra3.default.outputFile(absPath, snap.before, "utf8");
|
|
292779
292833
|
}
|
|
292780
292834
|
}
|
|
292781
292835
|
await writeState(cwd, state);
|
|
@@ -292787,17 +292841,17 @@ async function listOperations(cwd) {
|
|
|
292787
292841
|
}
|
|
292788
292842
|
async function snapshotFile(cwd, filePath) {
|
|
292789
292843
|
const absPath = import_path2.default.join(cwd, filePath);
|
|
292790
|
-
if (!await
|
|
292791
|
-
return
|
|
292844
|
+
if (!await import_fs_extra3.default.pathExists(absPath)) return void 0;
|
|
292845
|
+
return import_fs_extra3.default.readFile(absPath, "utf8");
|
|
292792
292846
|
}
|
|
292793
292847
|
var REGISTRY_PATH = import_path3.default.join(import_os.default.homedir(), ".xo", "registry.json");
|
|
292794
292848
|
async function readRegistry() {
|
|
292795
|
-
if (!await
|
|
292796
|
-
return
|
|
292849
|
+
if (!await import_fs_extra4.default.pathExists(REGISTRY_PATH)) return {};
|
|
292850
|
+
return import_fs_extra4.default.readJson(REGISTRY_PATH).catch(() => ({}));
|
|
292797
292851
|
}
|
|
292798
292852
|
async function writeRegistry(registry2) {
|
|
292799
|
-
await
|
|
292800
|
-
await
|
|
292853
|
+
await import_fs_extra4.default.ensureDir(import_path3.default.dirname(REGISTRY_PATH));
|
|
292854
|
+
await import_fs_extra4.default.writeJson(REGISTRY_PATH, registry2, { spaces: 2 });
|
|
292801
292855
|
}
|
|
292802
292856
|
async function addToRegistry(name, url, path132) {
|
|
292803
292857
|
const registry2 = await readRegistry();
|
|
@@ -292835,13 +292889,13 @@ function validateConflicts(conflicts, appliedWorkflows) {
|
|
|
292835
292889
|
}
|
|
292836
292890
|
async function checkRule(rule, cwd) {
|
|
292837
292891
|
if (rule.file !== void 0) {
|
|
292838
|
-
const exists = await
|
|
292892
|
+
const exists = await import_fs_extra5.default.pathExists(import_path4.default.join(cwd, rule.file));
|
|
292839
292893
|
return rule.exists !== void 0 ? exists === rule.exists : exists;
|
|
292840
292894
|
}
|
|
292841
292895
|
if (rule.pkg !== void 0) {
|
|
292842
292896
|
const pkgPath = import_path4.default.join(cwd, "package.json");
|
|
292843
|
-
if (!await
|
|
292844
|
-
const json = await
|
|
292897
|
+
if (!await import_fs_extra5.default.pathExists(pkgPath)) return rule.exists === false;
|
|
292898
|
+
const json = await import_fs_extra5.default.readJson(pkgPath).catch(() => ({}));
|
|
292845
292899
|
const allDeps = { ...json.dependencies, ...json.devDependencies };
|
|
292846
292900
|
const version = allDeps[rule.pkg];
|
|
292847
292901
|
if (rule.exists !== void 0) return Boolean(version) === rule.exists;
|
|
@@ -292856,15 +292910,24 @@ async function validateDetects(detects, cwd) {
|
|
|
292856
292910
|
const results = await Promise.all(detects.map((r) => checkRule(r, cwd)));
|
|
292857
292911
|
return results.every(Boolean);
|
|
292858
292912
|
}
|
|
292913
|
+
function normalizeChoice(c) {
|
|
292914
|
+
if (typeof c === "string") return { title: c, value: c };
|
|
292915
|
+
return { title: c.label ?? c.value, value: c.value };
|
|
292916
|
+
}
|
|
292859
292917
|
async function collectInputs(inputs, prefilled = {}) {
|
|
292860
|
-
const
|
|
292861
|
-
const
|
|
292862
|
-
|
|
292918
|
+
const withDefaults = { ...prefilled };
|
|
292919
|
+
for (const [name, input] of Object.entries(inputs)) {
|
|
292920
|
+
if (withDefaults[name] === void 0 && input.default !== void 0) {
|
|
292921
|
+
withDefaults[name] = input.default;
|
|
292922
|
+
}
|
|
292923
|
+
}
|
|
292924
|
+
const toPrompt = Object.entries(inputs).filter(
|
|
292925
|
+
([name]) => withDefaults[name] === void 0
|
|
292926
|
+
);
|
|
292927
|
+
if (toPrompt.length === 0) return withDefaults;
|
|
292863
292928
|
const questions = toPrompt.map(([name, input]) => {
|
|
292864
|
-
const
|
|
292865
|
-
|
|
292866
|
-
message: input.prompt
|
|
292867
|
-
};
|
|
292929
|
+
const message = input.prompt ?? input.description ?? name;
|
|
292930
|
+
const base = { name, message };
|
|
292868
292931
|
if (input.type === "confirm") {
|
|
292869
292932
|
return {
|
|
292870
292933
|
...base,
|
|
@@ -292872,9 +292935,9 @@ async function collectInputs(inputs, prefilled = {}) {
|
|
|
292872
292935
|
initial: input.default === true || input.default === "true"
|
|
292873
292936
|
};
|
|
292874
292937
|
}
|
|
292875
|
-
if (input.type === "select" || input.type === "multiselect") {
|
|
292876
|
-
const choices = (input.choices ?? []).map(
|
|
292877
|
-
const initialIndex = input.default ? (input.choices ?? []).
|
|
292938
|
+
if (input.type === "select" || input.type === "multiselect" || input.type === "list") {
|
|
292939
|
+
const choices = (input.choices ?? []).map(normalizeChoice);
|
|
292940
|
+
const initialIndex = input.default ? (input.choices ?? []).map(normalizeChoice).findIndex((c) => c.value === String(input.default)) : 0;
|
|
292878
292941
|
if (input.type === "multiselect") {
|
|
292879
292942
|
return { ...base, type: "multiselect", choices };
|
|
292880
292943
|
}
|
|
@@ -292885,16 +292948,6 @@ async function collectInputs(inputs, prefilled = {}) {
|
|
|
292885
292948
|
initial: Math.max(0, initialIndex)
|
|
292886
292949
|
};
|
|
292887
292950
|
}
|
|
292888
|
-
if (input.type === "list") {
|
|
292889
|
-
const choices = (input.choices ?? []).map((c) => ({ title: c, value: c }));
|
|
292890
|
-
const initialIndex = input.default ? (input.choices ?? []).indexOf(String(input.default)) : 0;
|
|
292891
|
-
return {
|
|
292892
|
-
...base,
|
|
292893
|
-
type: "select",
|
|
292894
|
-
choices,
|
|
292895
|
-
initial: Math.max(0, initialIndex)
|
|
292896
|
-
};
|
|
292897
|
-
}
|
|
292898
292951
|
return {
|
|
292899
292952
|
...base,
|
|
292900
292953
|
type: "text",
|
|
@@ -292907,7 +292960,7 @@ async function collectInputs(inputs, prefilled = {}) {
|
|
|
292907
292960
|
process.exit(0);
|
|
292908
292961
|
}
|
|
292909
292962
|
});
|
|
292910
|
-
return { ...
|
|
292963
|
+
return { ...withDefaults, ...answers };
|
|
292911
292964
|
}
|
|
292912
292965
|
import_handlebars.default.registerHelper("eq", (a, b) => a === b);
|
|
292913
292966
|
import_handlebars.default.registerHelper("ne", (a, b) => a !== b);
|
|
@@ -292940,39 +292993,61 @@ function renderTemplate(source, ctx) {
|
|
|
292940
292993
|
function renderFilename(name, ctx) {
|
|
292941
292994
|
return renderTemplate(name, ctx);
|
|
292942
292995
|
}
|
|
292996
|
+
async function fetchText(url) {
|
|
292997
|
+
return new Promise((resolve, reject) => {
|
|
292998
|
+
import_https.default.get(url, (res) => {
|
|
292999
|
+
if (res.statusCode === 301 || res.statusCode === 302) {
|
|
293000
|
+
return fetchText(res.headers.location).then(resolve, reject);
|
|
293001
|
+
}
|
|
293002
|
+
if (res.statusCode !== 200) {
|
|
293003
|
+
return reject(new Error(`HTTP ${res.statusCode} fetching ${url}`));
|
|
293004
|
+
}
|
|
293005
|
+
let data = "";
|
|
293006
|
+
res.on("data", (c) => data += c);
|
|
293007
|
+
res.on("end", () => resolve(data));
|
|
293008
|
+
}).on("error", reject);
|
|
293009
|
+
});
|
|
293010
|
+
}
|
|
293011
|
+
async function readSource(generatorDir, source) {
|
|
293012
|
+
const rawbasePath = import_path5.default.join(generatorDir, ".rawbase");
|
|
293013
|
+
if (await import_fs_extra6.default.pathExists(rawbasePath)) {
|
|
293014
|
+
const base = (await import_fs_extra6.default.readFile(rawbasePath, "utf8")).trim();
|
|
293015
|
+
return fetchText(`${base}/${source}`);
|
|
293016
|
+
}
|
|
293017
|
+
return import_fs_extra6.default.readFile(import_path5.default.join(generatorDir, source), "utf8");
|
|
293018
|
+
}
|
|
292943
293019
|
function resolveTarget(target, ctx) {
|
|
292944
293020
|
return renderFilename(interpolate(target, ctx), ctx);
|
|
292945
293021
|
}
|
|
292946
293022
|
async function copyFile(generatorDir, cwd, action, ctx) {
|
|
292947
|
-
const
|
|
293023
|
+
const content = await readSource(generatorDir, action.source);
|
|
292948
293024
|
const dest = import_path5.default.join(cwd, resolveTarget(action.target, ctx));
|
|
292949
|
-
await
|
|
292950
|
-
await
|
|
293025
|
+
await import_fs_extra6.default.ensureDir(import_path5.default.dirname(dest));
|
|
293026
|
+
await import_fs_extra6.default.writeFile(dest, content, "utf8");
|
|
292951
293027
|
}
|
|
292952
293028
|
async function templateFile(generatorDir, cwd, action, ctx) {
|
|
292953
|
-
const
|
|
292954
|
-
const raw = await import_fs_extra5.default.readFile(src, "utf8");
|
|
293029
|
+
const raw = await readSource(generatorDir, action.source);
|
|
292955
293030
|
const rendered = renderTemplate(raw, ctx);
|
|
292956
293031
|
const dest = import_path5.default.join(cwd, resolveTarget(action.target, ctx));
|
|
292957
|
-
await
|
|
292958
|
-
await
|
|
293032
|
+
await import_fs_extra6.default.ensureDir(import_path5.default.dirname(dest));
|
|
293033
|
+
await import_fs_extra6.default.writeFile(dest, rendered, "utf8");
|
|
292959
293034
|
}
|
|
292960
293035
|
async function appendToFile(cwd, action, ctx) {
|
|
292961
293036
|
const dest = import_path5.default.join(cwd, resolveTarget(action.target, ctx));
|
|
292962
293037
|
const content = renderTemplate(interpolate(action.content, ctx), ctx);
|
|
292963
293038
|
const prefix = action.newline !== false ? "\n" : "";
|
|
292964
|
-
await
|
|
292965
|
-
if (await
|
|
292966
|
-
await
|
|
293039
|
+
await import_fs_extra6.default.ensureDir(import_path5.default.dirname(dest));
|
|
293040
|
+
if (await import_fs_extra6.default.pathExists(dest)) {
|
|
293041
|
+
await import_fs_extra6.default.appendFile(dest, prefix + content, "utf8");
|
|
292967
293042
|
} else {
|
|
292968
|
-
await
|
|
293043
|
+
await import_fs_extra6.default.writeFile(dest, content, "utf8");
|
|
292969
293044
|
}
|
|
292970
293045
|
}
|
|
292971
293046
|
async function injectIntoFile(cwd, action, ctx) {
|
|
292972
293047
|
const dest = import_path5.default.join(cwd, resolveTarget(action.target, ctx));
|
|
292973
|
-
if (!await
|
|
293048
|
+
if (!await import_fs_extra6.default.pathExists(dest)) throw new Error(`inject: target file not found: ${dest}`);
|
|
292974
293049
|
const content = renderTemplate(interpolate(action.content, ctx), ctx);
|
|
292975
|
-
let text = await
|
|
293050
|
+
let text = await import_fs_extra6.default.readFile(dest, "utf8");
|
|
292976
293051
|
if (action.after) {
|
|
292977
293052
|
const marker = interpolate(action.after, ctx);
|
|
292978
293053
|
const idx = text.indexOf(marker);
|
|
@@ -292987,41 +293062,41 @@ async function injectIntoFile(cwd, action, ctx) {
|
|
|
292987
293062
|
} else {
|
|
292988
293063
|
text = text + "\n" + content;
|
|
292989
293064
|
}
|
|
292990
|
-
await
|
|
293065
|
+
await import_fs_extra6.default.writeFile(dest, text, "utf8");
|
|
292991
293066
|
}
|
|
292992
293067
|
async function replaceInFile(cwd, action, ctx) {
|
|
292993
293068
|
const dest = import_path5.default.join(cwd, resolveTarget(action.target, ctx));
|
|
292994
|
-
if (!await
|
|
292995
|
-
const text = await
|
|
293069
|
+
if (!await import_fs_extra6.default.pathExists(dest)) throw new Error(`replace: target file not found: ${dest}`);
|
|
293070
|
+
const text = await import_fs_extra6.default.readFile(dest, "utf8");
|
|
292996
293071
|
const search = interpolate(action.search, ctx);
|
|
292997
293072
|
const replacement = renderTemplate(interpolate(action.replace, ctx), ctx);
|
|
292998
293073
|
const regex2 = new RegExp(search, action.flags ?? "g");
|
|
292999
|
-
await
|
|
293074
|
+
await import_fs_extra6.default.writeFile(dest, text.replace(regex2, replacement), "utf8");
|
|
293000
293075
|
}
|
|
293001
293076
|
async function mergeJsonFile(cwd, action, ctx) {
|
|
293002
293077
|
const dest = import_path5.default.join(cwd, resolveTarget(action.target, ctx));
|
|
293003
|
-
await
|
|
293004
|
-
const existing = await
|
|
293078
|
+
await import_fs_extra6.default.ensureDir(import_path5.default.dirname(dest));
|
|
293079
|
+
const existing = await import_fs_extra6.default.pathExists(dest) ? await import_fs_extra6.default.readJson(dest).catch(() => ({})) : {};
|
|
293005
293080
|
const merged = action.deep ? deepMerge(existing, action.merge) : { ...existing, ...action.merge };
|
|
293006
|
-
await
|
|
293081
|
+
await import_fs_extra6.default.writeJson(dest, merged, { spaces: 2 });
|
|
293007
293082
|
}
|
|
293008
293083
|
async function setEnvVar(cwd, action, ctx) {
|
|
293009
293084
|
const dest = import_path5.default.join(cwd, action.target ?? ".env");
|
|
293010
|
-
await
|
|
293085
|
+
await import_fs_extra6.default.ensureDir(import_path5.default.dirname(dest));
|
|
293011
293086
|
const key = interpolate(action.key, ctx);
|
|
293012
293087
|
const value = interpolate(action.value, ctx);
|
|
293013
293088
|
const line = `${key}=${value}`;
|
|
293014
|
-
if (await
|
|
293015
|
-
let text = await
|
|
293089
|
+
if (await import_fs_extra6.default.pathExists(dest)) {
|
|
293090
|
+
let text = await import_fs_extra6.default.readFile(dest, "utf8");
|
|
293016
293091
|
const keyRegex = new RegExp(`^${key}=.*$`, "m");
|
|
293017
293092
|
if (keyRegex.test(text)) {
|
|
293018
293093
|
text = text.replace(keyRegex, line);
|
|
293019
293094
|
} else {
|
|
293020
293095
|
text = text.endsWith("\n") ? text + line + "\n" : text + "\n" + line + "\n";
|
|
293021
293096
|
}
|
|
293022
|
-
await
|
|
293097
|
+
await import_fs_extra6.default.writeFile(dest, text, "utf8");
|
|
293023
293098
|
} else {
|
|
293024
|
-
await
|
|
293099
|
+
await import_fs_extra6.default.writeFile(dest, line + "\n", "utf8");
|
|
293025
293100
|
}
|
|
293026
293101
|
}
|
|
293027
293102
|
function deepMerge(target, source) {
|
|
@@ -293049,7 +293124,7 @@ function runCommand(cwd, action, ctx, dryRun = false) {
|
|
|
293049
293124
|
}
|
|
293050
293125
|
async function runScript(generatorDir, cwd, action, ctx, dryRun = false) {
|
|
293051
293126
|
const scriptPath = import_path6.default.join(generatorDir, interpolate(action.script, ctx));
|
|
293052
|
-
if (!await
|
|
293127
|
+
if (!await import_fs_extra7.default.pathExists(scriptPath)) {
|
|
293053
293128
|
throw new Error(`Script not found: ${scriptPath}`);
|
|
293054
293129
|
}
|
|
293055
293130
|
const execCwd = action.cwd ? import_path6.default.join(cwd, interpolate(action.cwd, ctx)) : cwd;
|
|
@@ -293101,7 +293176,7 @@ function authHeaders() {
|
|
|
293101
293176
|
const token = process.env["XO_GITHUB_TOKEN"];
|
|
293102
293177
|
return token ? { Authorization: `token ${token}` } : {};
|
|
293103
293178
|
}
|
|
293104
|
-
async function
|
|
293179
|
+
async function fetchText2(url) {
|
|
293105
293180
|
try {
|
|
293106
293181
|
const res = await fetch(url, { headers: authHeaders() });
|
|
293107
293182
|
if (!res.ok) return null;
|
|
@@ -293129,13 +293204,13 @@ async function resolveGitHubWorkflow(ref, trigger) {
|
|
|
293129
293204
|
}
|
|
293130
293205
|
candidates.push(`${base}/workflow.yaml`, `${base}/workflow.yml`);
|
|
293131
293206
|
for (const url of candidates) {
|
|
293132
|
-
const content = await
|
|
293207
|
+
const content = await fetchText2(url);
|
|
293133
293208
|
if (!content) continue;
|
|
293134
293209
|
const workflow = parseWorkflow(content);
|
|
293135
|
-
await
|
|
293136
|
-
await
|
|
293137
|
-
await
|
|
293138
|
-
await
|
|
293210
|
+
await import_fs_extra9.default.ensureDir(dir);
|
|
293211
|
+
await import_fs_extra9.default.writeFile(import_path8.default.join(dir, "workflow.yaml"), (0, import_yaml3.stringify)(workflow));
|
|
293212
|
+
await import_fs_extra9.default.writeFile(import_path8.default.join(dir, ".rawbase"), base);
|
|
293213
|
+
await import_fs_extra9.default.writeFile(import_path8.default.join(dir, ".ref"), JSON.stringify(ref));
|
|
293139
293214
|
return { workflow, dir, ref };
|
|
293140
293215
|
}
|
|
293141
293216
|
return null;
|
|
@@ -293144,14 +293219,14 @@ async function loadFromCacheDir(dir, trigger) {
|
|
|
293144
293219
|
if (trigger) {
|
|
293145
293220
|
for (const ext of ["yaml", "yml"]) {
|
|
293146
293221
|
const file2 = import_path8.default.join(dir, "workflows", `${trigger}.${ext}`);
|
|
293147
|
-
if (await
|
|
293148
|
-
return parseWorkflow(await
|
|
293222
|
+
if (await import_fs_extra9.default.pathExists(file2)) {
|
|
293223
|
+
return parseWorkflow(await import_fs_extra9.default.readFile(file2, "utf8"));
|
|
293149
293224
|
}
|
|
293150
293225
|
}
|
|
293151
293226
|
}
|
|
293152
293227
|
const file = import_path8.default.join(dir, "workflow.yaml");
|
|
293153
|
-
if (await
|
|
293154
|
-
return parseWorkflow(await
|
|
293228
|
+
if (await import_fs_extra9.default.pathExists(file)) {
|
|
293229
|
+
return parseWorkflow(await import_fs_extra9.default.readFile(file, "utf8"));
|
|
293155
293230
|
}
|
|
293156
293231
|
return null;
|
|
293157
293232
|
}
|
|
@@ -293177,7 +293252,7 @@ async function loadLocalAction(uses, generatorDir) {
|
|
|
293177
293252
|
const fullPath = import_path7.default.resolve(generatorDir, uses);
|
|
293178
293253
|
const ext = import_path7.default.extname(uses);
|
|
293179
293254
|
if ([".js", ".mjs", ".cjs"].includes(ext)) {
|
|
293180
|
-
if (!await
|
|
293255
|
+
if (!await import_fs_extra8.default.pathExists(fullPath)) {
|
|
293181
293256
|
throw new Error(`Script action not found: ${fullPath}`);
|
|
293182
293257
|
}
|
|
293183
293258
|
return { def: {}, dir: import_path7.default.dirname(fullPath), type: "node", mainPath: fullPath };
|
|
@@ -293186,16 +293261,16 @@ async function loadLocalAction(uses, generatorDir) {
|
|
|
293186
293261
|
if (![".yaml", ".yml"].includes(ext)) {
|
|
293187
293262
|
for (const name of ["action.yaml", "action.yml"]) {
|
|
293188
293263
|
const candidate = import_path7.default.join(fullPath, name);
|
|
293189
|
-
if (await
|
|
293264
|
+
if (await import_fs_extra8.default.pathExists(candidate)) {
|
|
293190
293265
|
yamlPath = candidate;
|
|
293191
293266
|
break;
|
|
293192
293267
|
}
|
|
293193
293268
|
}
|
|
293194
293269
|
}
|
|
293195
|
-
if (!await
|
|
293270
|
+
if (!await import_fs_extra8.default.pathExists(yamlPath)) {
|
|
293196
293271
|
throw new Error(`Action not found: ${fullPath}`);
|
|
293197
293272
|
}
|
|
293198
|
-
const def = (0, import_yaml2.parse)(await
|
|
293273
|
+
const def = (0, import_yaml2.parse)(await import_fs_extra8.default.readFile(yamlPath, "utf8"));
|
|
293199
293274
|
const dir = import_path7.default.dirname(yamlPath);
|
|
293200
293275
|
if (def.runs?.using === "node" && def.runs.main) {
|
|
293201
293276
|
return { def, dir, type: "node", mainPath: import_path7.default.resolve(dir, def.runs.main) };
|
|
@@ -293220,14 +293295,14 @@ async function loadGitHubAction(uses) {
|
|
|
293220
293295
|
const res = await fetch(`${base}/${filename}`, { headers });
|
|
293221
293296
|
if (!res.ok) continue;
|
|
293222
293297
|
const def = (0, import_yaml2.parse)(await res.text());
|
|
293223
|
-
await
|
|
293224
|
-
await
|
|
293298
|
+
await import_fs_extra8.default.ensureDir(cacheDir2);
|
|
293299
|
+
await import_fs_extra8.default.writeFile(import_path7.default.join(cacheDir2, "action.yaml"), (0, import_yaml2.stringify)(def));
|
|
293225
293300
|
if (def.runs?.using === "node" && def.runs.main) {
|
|
293226
293301
|
const mainRes = await fetch(`${base}/${def.runs.main}`, { headers });
|
|
293227
293302
|
if (!mainRes.ok) throw new Error(`Failed to fetch action main: ${base}/${def.runs.main}`);
|
|
293228
293303
|
const mainPath = import_path7.default.join(cacheDir2, def.runs.main);
|
|
293229
|
-
await
|
|
293230
|
-
await
|
|
293304
|
+
await import_fs_extra8.default.ensureDir(import_path7.default.dirname(mainPath));
|
|
293305
|
+
await import_fs_extra8.default.writeFile(mainPath, await mainRes.text());
|
|
293231
293306
|
return { def, dir: cacheDir2, type: "node", mainPath };
|
|
293232
293307
|
}
|
|
293233
293308
|
return { def, dir: cacheDir2, type: "composite" };
|
|
@@ -293244,8 +293319,8 @@ Tried: ${base}/action.yaml and action.yml
|
|
|
293244
293319
|
}
|
|
293245
293320
|
async function loadCachedAction(dir) {
|
|
293246
293321
|
const yamlPath = import_path7.default.join(dir, "action.yaml");
|
|
293247
|
-
if (!await
|
|
293248
|
-
const def = (0, import_yaml2.parse)(await
|
|
293322
|
+
if (!await import_fs_extra8.default.pathExists(yamlPath)) return null;
|
|
293323
|
+
const def = (0, import_yaml2.parse)(await import_fs_extra8.default.readFile(yamlPath, "utf8"));
|
|
293249
293324
|
if (def.runs?.using === "node" && def.runs.main) {
|
|
293250
293325
|
return { def, dir, type: "node", mainPath: import_path7.default.resolve(dir, def.runs.main) };
|
|
293251
293326
|
}
|
|
@@ -293322,31 +293397,31 @@ async function runScriptAction(loaded, withArgs, parentContext) {
|
|
|
293322
293397
|
}) ?? {};
|
|
293323
293398
|
}
|
|
293324
293399
|
async function detectPackageManager(cwd) {
|
|
293325
|
-
if (await
|
|
293326
|
-
if (await
|
|
293400
|
+
if (await import_fs_extra11.default.pathExists(import_path10.default.join(cwd, "pnpm-lock.yaml"))) return "pnpm";
|
|
293401
|
+
if (await import_fs_extra11.default.pathExists(import_path10.default.join(cwd, "bun.lockb")) || await import_fs_extra11.default.pathExists(import_path10.default.join(cwd, "bun.lock")))
|
|
293327
293402
|
return "bun";
|
|
293328
|
-
if (await
|
|
293403
|
+
if (await import_fs_extra11.default.pathExists(import_path10.default.join(cwd, "yarn.lock"))) return "yarn";
|
|
293329
293404
|
return "npm";
|
|
293330
293405
|
}
|
|
293331
293406
|
async function detectLanguage(cwd) {
|
|
293332
|
-
if (await
|
|
293407
|
+
if (await import_fs_extra11.default.pathExists(import_path10.default.join(cwd, "tsconfig.json"))) return "typescript";
|
|
293333
293408
|
const pkgPath = import_path10.default.join(cwd, "package.json");
|
|
293334
|
-
if (await
|
|
293335
|
-
const pkg = await
|
|
293409
|
+
if (await import_fs_extra11.default.pathExists(pkgPath)) {
|
|
293410
|
+
const pkg = await import_fs_extra11.default.readJson(pkgPath).catch(() => ({}));
|
|
293336
293411
|
const allDeps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
293337
293412
|
if (allDeps["typescript"] || allDeps["ts-node"]) return "typescript";
|
|
293338
293413
|
}
|
|
293339
|
-
if (await
|
|
293340
|
-
if (await
|
|
293341
|
-
if (await
|
|
293342
|
-
if (await
|
|
293414
|
+
if (await import_fs_extra11.default.pathExists(import_path10.default.join(cwd, "pubspec.yaml"))) return "dart";
|
|
293415
|
+
if (await import_fs_extra11.default.pathExists(import_path10.default.join(cwd, "go.mod"))) return "go";
|
|
293416
|
+
if (await import_fs_extra11.default.pathExists(import_path10.default.join(cwd, "Cargo.toml"))) return "rust";
|
|
293417
|
+
if (await import_fs_extra11.default.pathExists(import_path10.default.join(cwd, "requirements.txt")) || await import_fs_extra11.default.pathExists(import_path10.default.join(cwd, "pyproject.toml")))
|
|
293343
293418
|
return "python";
|
|
293344
293419
|
return "javascript";
|
|
293345
293420
|
}
|
|
293346
293421
|
async function isPkgInstalled(cwd, pkg) {
|
|
293347
293422
|
const pkgPath = import_path10.default.join(cwd, "package.json");
|
|
293348
|
-
if (!await
|
|
293349
|
-
const json = await
|
|
293423
|
+
if (!await import_fs_extra11.default.pathExists(pkgPath)) return { installed: false };
|
|
293424
|
+
const json = await import_fs_extra11.default.readJson(pkgPath).catch(() => ({}));
|
|
293350
293425
|
const allDeps = {
|
|
293351
293426
|
...json.dependencies,
|
|
293352
293427
|
...json.devDependencies,
|
|
@@ -293357,8 +293432,8 @@ async function isPkgInstalled(cwd, pkg) {
|
|
|
293357
293432
|
}
|
|
293358
293433
|
async function readJsonAtPath(cwd, file, jsonPath) {
|
|
293359
293434
|
const absPath = import_path10.default.join(cwd, file);
|
|
293360
|
-
if (!await
|
|
293361
|
-
const json = await
|
|
293435
|
+
if (!await import_fs_extra11.default.pathExists(absPath)) return void 0;
|
|
293436
|
+
const json = await import_fs_extra11.default.readJson(absPath).catch(() => void 0);
|
|
293362
293437
|
if (json === void 0) return void 0;
|
|
293363
293438
|
const parts = jsonPath.split(".");
|
|
293364
293439
|
let cur = json;
|
|
@@ -293391,7 +293466,7 @@ function dotToNested(dotPath, value) {
|
|
|
293391
293466
|
}
|
|
293392
293467
|
async function astAddImport(cwd, args, ctx) {
|
|
293393
293468
|
const targetPath = import_path9.default.join(cwd, interpolate(args.file, ctx));
|
|
293394
|
-
if (!await
|
|
293469
|
+
if (!await import_fs_extra10.default.pathExists(targetPath)) {
|
|
293395
293470
|
throw new Error(`xo/ast-import: file not found: ${targetPath}`);
|
|
293396
293471
|
}
|
|
293397
293472
|
const project = new import_ts_morph.Project({ useInMemoryFileSystem: false });
|
|
@@ -293427,7 +293502,7 @@ async function runBuiltinAction(actionName, args, ctx, context) {
|
|
|
293427
293502
|
}
|
|
293428
293503
|
if (actionName === "xo/file-exists") {
|
|
293429
293504
|
const filePath = str(w.path);
|
|
293430
|
-
const exists = await
|
|
293505
|
+
const exists = await import_fs_extra10.default.pathExists(import_path9.default.join(cwd, filePath));
|
|
293431
293506
|
if (!dryRun) console.log(` \u2714 xo/file-exists(${filePath}) \u2192 ${exists}`);
|
|
293432
293507
|
return { exists };
|
|
293433
293508
|
}
|
|
@@ -293609,18 +293684,18 @@ async function runJobs(jobs, context, onJobStart) {
|
|
|
293609
293684
|
}
|
|
293610
293685
|
var LINKED_PATH = import_path11.default.join(import_os4.default.homedir(), ".xo", "linked.json");
|
|
293611
293686
|
async function read() {
|
|
293612
|
-
if (!await
|
|
293613
|
-
return
|
|
293687
|
+
if (!await import_fs_extra12.default.pathExists(LINKED_PATH)) return {};
|
|
293688
|
+
return import_fs_extra12.default.readJson(LINKED_PATH).catch(() => ({}));
|
|
293614
293689
|
}
|
|
293615
293690
|
async function write(data) {
|
|
293616
|
-
await
|
|
293617
|
-
await
|
|
293691
|
+
await import_fs_extra12.default.ensureDir(import_path11.default.dirname(LINKED_PATH));
|
|
293692
|
+
await import_fs_extra12.default.writeJson(LINKED_PATH, data, { spaces: 2 });
|
|
293618
293693
|
}
|
|
293619
293694
|
async function readWorkflowName(dir) {
|
|
293620
293695
|
for (const filename of ["workflow.yaml", "workflow.yml"]) {
|
|
293621
293696
|
const file = import_path11.default.join(dir, filename);
|
|
293622
|
-
if (await
|
|
293623
|
-
const content = await
|
|
293697
|
+
if (await import_fs_extra12.default.pathExists(file)) {
|
|
293698
|
+
const content = await import_fs_extra12.default.readFile(file, "utf8");
|
|
293624
293699
|
const wf = (0, import_yaml4.parse)(content);
|
|
293625
293700
|
return wf.name ?? null;
|
|
293626
293701
|
}
|
|
@@ -293628,8 +293703,8 @@ async function readWorkflowName(dir) {
|
|
|
293628
293703
|
for (const trigger of ["add", "create", "run"]) {
|
|
293629
293704
|
for (const ext of ["yaml", "yml"]) {
|
|
293630
293705
|
const file = import_path11.default.join(dir, "workflows", `${trigger}.${ext}`);
|
|
293631
|
-
if (await
|
|
293632
|
-
const content = await
|
|
293706
|
+
if (await import_fs_extra12.default.pathExists(file)) {
|
|
293707
|
+
const content = await import_fs_extra12.default.readFile(file, "utf8");
|
|
293633
293708
|
const wf = (0, import_yaml4.parse)(content);
|
|
293634
293709
|
return wf.name ?? null;
|
|
293635
293710
|
}
|
|
@@ -293678,15 +293753,15 @@ async function loadFromDir(dir, trigger) {
|
|
|
293678
293753
|
if (trigger) {
|
|
293679
293754
|
for (const ext of ["yaml", "yml"]) {
|
|
293680
293755
|
const file = import_path12.default.join(dir, "workflows", `${trigger}.${ext}`);
|
|
293681
|
-
if (await
|
|
293682
|
-
return parseWorkflow2(await
|
|
293756
|
+
if (await import_fs_extra13.default.pathExists(file)) {
|
|
293757
|
+
return parseWorkflow2(await import_fs_extra13.default.readFile(file, "utf8"));
|
|
293683
293758
|
}
|
|
293684
293759
|
}
|
|
293685
293760
|
}
|
|
293686
293761
|
for (const filename of WORKFLOW_FILES) {
|
|
293687
293762
|
const file = import_path12.default.join(dir, filename);
|
|
293688
|
-
if (await
|
|
293689
|
-
return parseWorkflow2(await
|
|
293763
|
+
if (await import_fs_extra13.default.pathExists(file)) {
|
|
293764
|
+
return parseWorkflow2(await import_fs_extra13.default.readFile(file, "utf8"));
|
|
293690
293765
|
}
|
|
293691
293766
|
}
|
|
293692
293767
|
return null;
|
|
@@ -293712,9 +293787,9 @@ async function fetchFromRegistryEntry(url, subpath, name, trigger) {
|
|
|
293712
293787
|
const content = await res.text();
|
|
293713
293788
|
const workflow = parseWorkflow2(content);
|
|
293714
293789
|
const cacheDir2 = import_path12.default.join(CACHE_DIR2, name.replace(/\//g, import_path12.default.sep));
|
|
293715
|
-
await
|
|
293716
|
-
await
|
|
293717
|
-
await
|
|
293790
|
+
await import_fs_extra13.default.ensureDir(cacheDir2);
|
|
293791
|
+
await import_fs_extra13.default.writeFile(import_path12.default.join(cacheDir2, "workflow.yaml"), (0, import_yaml5.stringify)(workflow));
|
|
293792
|
+
await import_fs_extra13.default.writeFile(import_path12.default.join(cacheDir2, ".rawbase"), rawBase2);
|
|
293718
293793
|
return { workflow, dir: cacheDir2 };
|
|
293719
293794
|
} catch {
|
|
293720
293795
|
continue;
|
|
@@ -293793,7 +293868,7 @@ async function runWorkflow(name, cwd, opts = {}) {
|
|
|
293793
293868
|
const { dryRun = false, local = false } = opts;
|
|
293794
293869
|
const trigger = opts.trigger ?? "add";
|
|
293795
293870
|
const { workflow, dir: generatorDir } = await loadWorkflow(name, cwd, trigger, local);
|
|
293796
|
-
const
|
|
293871
|
+
const config2 = await readConfig(cwd);
|
|
293797
293872
|
if (workflow.detects?.length) {
|
|
293798
293873
|
const ok = await validateDetects(workflow.detects, cwd);
|
|
293799
293874
|
if (!ok) {
|
|
@@ -293815,7 +293890,7 @@ async function runWorkflow(name, cwd, opts = {}) {
|
|
|
293815
293890
|
const inputs = workflow.inputs && !dryRun ? await collectInputs(workflow.inputs, opts.inputs ?? {}) : { ...opts.inputs ?? {} };
|
|
293816
293891
|
const context = {
|
|
293817
293892
|
inputs,
|
|
293818
|
-
config,
|
|
293893
|
+
config: config2,
|
|
293819
293894
|
steps: {},
|
|
293820
293895
|
// populated as steps with `id:` run
|
|
293821
293896
|
env: process.env,
|
|
@@ -293825,7 +293900,7 @@ async function runWorkflow(name, cwd, opts = {}) {
|
|
|
293825
293900
|
};
|
|
293826
293901
|
const filesChanged = [];
|
|
293827
293902
|
if (!dryRun) {
|
|
293828
|
-
const flatCtx = { inputs, config, steps: {}, env: process.env };
|
|
293903
|
+
const flatCtx = { inputs, config: config2, steps: {}, env: process.env };
|
|
293829
293904
|
const targets = extractTargetFiles(workflow, flatCtx);
|
|
293830
293905
|
for (const filePath of targets) {
|
|
293831
293906
|
const before = await snapshotFile(cwd, filePath);
|
|
@@ -293841,7 +293916,7 @@ async function runWorkflow(name, cwd, opts = {}) {
|
|
|
293841
293916
|
if (trigger === "create") {
|
|
293842
293917
|
await mergeConfig(cwd, { template: name });
|
|
293843
293918
|
} else {
|
|
293844
|
-
const existing =
|
|
293919
|
+
const existing = config2.features ?? [];
|
|
293845
293920
|
await mergeConfig(cwd, { features: [.../* @__PURE__ */ new Set([...existing, name])] });
|
|
293846
293921
|
}
|
|
293847
293922
|
}
|
|
@@ -293850,7 +293925,7 @@ async function runWorkflow(name, cwd, opts = {}) {
|
|
|
293850
293925
|
|
|
293851
293926
|
// src/index.ts
|
|
293852
293927
|
var program2 = new Command();
|
|
293853
|
-
program2.name("xo").description("Local workflow engine for developers \u2014 compose actions into workflows").version("0.1.
|
|
293928
|
+
program2.name("xo").description("Local workflow engine for developers \u2014 compose actions into workflows").version("0.1.3");
|
|
293854
293929
|
function parseInputFlags(flags) {
|
|
293855
293930
|
const result = {};
|
|
293856
293931
|
for (const flag of flags) {
|
|
@@ -294057,7 +294132,7 @@ registry.command("list").description("List all registered generators").action(as
|
|
|
294057
294132
|
console.log();
|
|
294058
294133
|
});
|
|
294059
294134
|
program2.command("init [dir]").description("Scaffold a new generator repo (workflow.yaml, templates/, actions/)").action(async (dir) => {
|
|
294060
|
-
const targetDir =
|
|
294135
|
+
const targetDir = import_node_path2.default.resolve(dir ?? process.cwd());
|
|
294061
294136
|
console.log(source_default.bold("\nInitializing new xo generator\n"));
|
|
294062
294137
|
const answers = await (0, import_prompts2.default)([
|
|
294063
294138
|
{
|
|
@@ -294086,27 +294161,27 @@ program2.command("init [dir]").description("Scaffold a new generator repo (workf
|
|
|
294086
294161
|
const { name, description, triggers } = answers;
|
|
294087
294162
|
const triggersYaml = `[${triggers.join(", ")}]`;
|
|
294088
294163
|
const hasMultipleTriggers = triggers.length > 1;
|
|
294089
|
-
await
|
|
294090
|
-
await
|
|
294091
|
-
await
|
|
294164
|
+
await import_fs_extra14.default.ensureDir(targetDir);
|
|
294165
|
+
await import_fs_extra14.default.ensureDir(import_node_path2.default.join(targetDir, "templates"));
|
|
294166
|
+
await import_fs_extra14.default.ensureDir(import_node_path2.default.join(targetDir, "actions"));
|
|
294092
294167
|
if (hasMultipleTriggers) {
|
|
294093
|
-
await
|
|
294168
|
+
await import_fs_extra14.default.ensureDir(import_node_path2.default.join(targetDir, "workflows"));
|
|
294094
294169
|
for (const trigger of triggers) {
|
|
294095
|
-
await
|
|
294096
|
-
|
|
294170
|
+
await import_fs_extra14.default.writeFile(
|
|
294171
|
+
import_node_path2.default.join(targetDir, "workflows", `${trigger}.yaml`),
|
|
294097
294172
|
buildWorkflowYaml(name, `[${trigger}]`, description),
|
|
294098
294173
|
"utf8"
|
|
294099
294174
|
);
|
|
294100
294175
|
}
|
|
294101
294176
|
} else {
|
|
294102
|
-
await
|
|
294103
|
-
|
|
294177
|
+
await import_fs_extra14.default.writeFile(
|
|
294178
|
+
import_node_path2.default.join(targetDir, "workflow.yaml"),
|
|
294104
294179
|
buildWorkflowYaml(name, triggersYaml, description),
|
|
294105
294180
|
"utf8"
|
|
294106
294181
|
);
|
|
294107
294182
|
}
|
|
294108
|
-
await
|
|
294109
|
-
|
|
294183
|
+
await import_fs_extra14.default.writeFile(
|
|
294184
|
+
import_node_path2.default.join(targetDir, "README.md"),
|
|
294110
294185
|
buildReadme(name, description, triggers),
|
|
294111
294186
|
"utf8"
|
|
294112
294187
|
);
|
|
@@ -294129,6 +294204,44 @@ program2.command("init [dir]").description("Scaffold a new generator repo (workf
|
|
|
294129
294204
|
console.log(source_default.dim(` 3. Run ${source_default.white("xo link")} to test locally`));
|
|
294130
294205
|
console.log();
|
|
294131
294206
|
});
|
|
294207
|
+
var cache = program2.command("cache").description("Manage the local xo cache");
|
|
294208
|
+
cache.command("clear [owner]").description("Clear cached GitHub workflows. Optionally scope to a specific owner (e.g. betaversionio).").action(async (owner) => {
|
|
294209
|
+
const cacheDir2 = owner ? import_node_path2.default.join(import_node_os3.default.homedir(), ".xo", "cache", "github", owner) : import_node_path2.default.join(import_node_os3.default.homedir(), ".xo", "cache", "github");
|
|
294210
|
+
if (!await import_fs_extra14.default.pathExists(cacheDir2)) {
|
|
294211
|
+
console.log(source_default.dim("Cache is already empty."));
|
|
294212
|
+
return;
|
|
294213
|
+
}
|
|
294214
|
+
await import_fs_extra14.default.remove(cacheDir2);
|
|
294215
|
+
const label = owner ? source_default.cyan(`@github/${owner}`) : "all GitHub workflows";
|
|
294216
|
+
console.log(source_default.green(`\u2714 Cleared cache for ${label}`));
|
|
294217
|
+
});
|
|
294218
|
+
cache.command("list").description("Show what is currently cached.").action(async () => {
|
|
294219
|
+
const cacheDir2 = import_node_path2.default.join(import_node_os3.default.homedir(), ".xo", "cache", "github");
|
|
294220
|
+
if (!await import_fs_extra14.default.pathExists(cacheDir2)) {
|
|
294221
|
+
console.log(source_default.dim("Cache is empty."));
|
|
294222
|
+
return;
|
|
294223
|
+
}
|
|
294224
|
+
const owners = await import_fs_extra14.default.readdir(cacheDir2);
|
|
294225
|
+
if (owners.length === 0) {
|
|
294226
|
+
console.log(source_default.dim("Cache is empty."));
|
|
294227
|
+
return;
|
|
294228
|
+
}
|
|
294229
|
+
console.log(source_default.bold("\nCached GitHub workflows:\n"));
|
|
294230
|
+
for (const owner of owners) {
|
|
294231
|
+
const ownerDir = import_node_path2.default.join(cacheDir2, owner);
|
|
294232
|
+
const repos = await import_fs_extra14.default.readdir(ownerDir).catch(() => []);
|
|
294233
|
+
for (const repo of repos) {
|
|
294234
|
+
const repoDir = import_node_path2.default.join(ownerDir, repo);
|
|
294235
|
+
const refs = await import_fs_extra14.default.readdir(repoDir).catch(() => []);
|
|
294236
|
+
for (const ref of refs) {
|
|
294237
|
+
const rawbasePath = import_node_path2.default.join(repoDir, ref, ".rawbase");
|
|
294238
|
+
const base = await import_fs_extra14.default.pathExists(rawbasePath) ? (await import_fs_extra14.default.readFile(rawbasePath, "utf8")).trim() : `github.com/${owner}/${repo}@${ref}`;
|
|
294239
|
+
console.log(` ${source_default.cyan(`@github/${owner}/${repo}`)} ${source_default.dim(base)}`);
|
|
294240
|
+
}
|
|
294241
|
+
}
|
|
294242
|
+
}
|
|
294243
|
+
console.log();
|
|
294244
|
+
});
|
|
294132
294245
|
program2.command("self-update").description("Check for a newer version of xo and update if available").action(async () => {
|
|
294133
294246
|
const PACKAGE = "@xo-code/cli";
|
|
294134
294247
|
const current = program2.version() ?? "0.0.0";
|
|
@@ -294153,6 +294266,41 @@ program2.command("self-update").description("Check for a newer version of xo and
|
|
|
294153
294266
|
process.exit(1);
|
|
294154
294267
|
}
|
|
294155
294268
|
});
|
|
294269
|
+
var config = program2.command("config").description("Get and set global xo configuration");
|
|
294270
|
+
config.command("get <key>").description("Get a config value").action(async (key) => {
|
|
294271
|
+
try {
|
|
294272
|
+
const value = await getConfigValue(key);
|
|
294273
|
+
if (value === void 0) {
|
|
294274
|
+
console.log(source_default.dim(`${key} is not set`));
|
|
294275
|
+
} else {
|
|
294276
|
+
console.log(`${source_default.dim(key + ":")} ${source_default.white(String(value))}`);
|
|
294277
|
+
}
|
|
294278
|
+
} catch (err) {
|
|
294279
|
+
console.error(source_default.red(`\u2716 ${err.message}`));
|
|
294280
|
+
process.exit(1);
|
|
294281
|
+
}
|
|
294282
|
+
});
|
|
294283
|
+
config.command("set <key> <value>").description("Set a config value").action(async (key, value) => {
|
|
294284
|
+
try {
|
|
294285
|
+
await setConfigValue(key, value);
|
|
294286
|
+
console.log(source_default.green(`\u2714 ${key} = ${value}`));
|
|
294287
|
+
} catch (err) {
|
|
294288
|
+
console.error(source_default.red(`\u2716 ${err.message}`));
|
|
294289
|
+
process.exit(1);
|
|
294290
|
+
}
|
|
294291
|
+
});
|
|
294292
|
+
config.command("list").description("List all config keys, their current values, and defaults").action(async () => {
|
|
294293
|
+
const current = await readGlobalConfig();
|
|
294294
|
+
console.log(source_default.bold("\nxo global config\n"));
|
|
294295
|
+
for (const [key, meta] of Object.entries(CONFIG_META)) {
|
|
294296
|
+
const value = current[key];
|
|
294297
|
+
const valueStr = value === void 0 ? source_default.dim("(not set)") : source_default.white(String(value));
|
|
294298
|
+
const defaultStr = meta.default ? source_default.dim(` default: ${meta.default}`) : "";
|
|
294299
|
+
console.log(` ${source_default.cyan(key.padEnd(16))} ${valueStr}${defaultStr}`);
|
|
294300
|
+
console.log(` ${" ".repeat(16)} ${source_default.dim(meta.description)}`);
|
|
294301
|
+
console.log();
|
|
294302
|
+
}
|
|
294303
|
+
});
|
|
294156
294304
|
function collect(val, acc) {
|
|
294157
294305
|
acc.push(val);
|
|
294158
294306
|
return acc;
|
|
@@ -294215,36 +294363,39 @@ xo unlink # remove when done
|
|
|
294215
294363
|
\`\`\`
|
|
294216
294364
|
`;
|
|
294217
294365
|
}
|
|
294218
|
-
var UPDATE_CACHE =
|
|
294366
|
+
var UPDATE_CACHE = import_node_path2.default.join(import_node_os3.default.homedir(), ".xo", "update-check.json");
|
|
294219
294367
|
var CHECK_INTERVAL_MS = 24 * 60 * 60 * 1e3;
|
|
294220
294368
|
program2.hook("postAction", async () => {
|
|
294221
294369
|
try {
|
|
294222
|
-
|
|
294223
|
-
if (
|
|
294224
|
-
|
|
294370
|
+
const globalConfig = await readGlobalConfig();
|
|
294371
|
+
if (!globalConfig.autoUpdate) return;
|
|
294372
|
+
let cache2 = { lastCheck: 0, latest: "0.1.3" };
|
|
294373
|
+
if (await import_fs_extra14.default.pathExists(UPDATE_CACHE)) {
|
|
294374
|
+
cache2 = await import_fs_extra14.default.readJson(UPDATE_CACHE).catch(() => cache2);
|
|
294225
294375
|
}
|
|
294226
294376
|
const now = Date.now();
|
|
294227
|
-
let latest =
|
|
294228
|
-
if (now -
|
|
294377
|
+
let latest = cache2.latest;
|
|
294378
|
+
if (now - cache2.lastCheck >= CHECK_INTERVAL_MS) {
|
|
294379
|
+
const registryBase = globalConfig.registryUrl.replace(/\/$/, "");
|
|
294229
294380
|
const controller = new AbortController();
|
|
294230
294381
|
const timer = setTimeout(() => controller.abort(), 3e3);
|
|
294231
294382
|
try {
|
|
294232
|
-
const res = await fetch(
|
|
294383
|
+
const res = await fetch(`${registryBase}/@xo-code/cli/latest`, {
|
|
294233
294384
|
signal: controller.signal
|
|
294234
294385
|
});
|
|
294235
294386
|
if (res.ok) {
|
|
294236
294387
|
({ version: latest } = await res.json());
|
|
294237
|
-
await
|
|
294238
|
-
await
|
|
294388
|
+
await import_fs_extra14.default.ensureDir(import_node_path2.default.dirname(UPDATE_CACHE));
|
|
294389
|
+
await import_fs_extra14.default.writeJson(UPDATE_CACHE, { lastCheck: now, latest });
|
|
294239
294390
|
}
|
|
294240
294391
|
} finally {
|
|
294241
294392
|
clearTimeout(timer);
|
|
294242
294393
|
}
|
|
294243
294394
|
}
|
|
294244
|
-
if (isNewer(latest, "0.1.
|
|
294395
|
+
if (isNewer(latest, "0.1.3")) {
|
|
294245
294396
|
console.log(
|
|
294246
294397
|
source_default.dim(`
|
|
294247
|
-
Update available `) + source_default.yellow("0.1.
|
|
294398
|
+
Update available `) + source_default.yellow("0.1.3") + source_default.dim(" \u2192 ") + source_default.green(latest) + source_default.dim(" run ") + source_default.white("xo self-update")
|
|
294248
294399
|
);
|
|
294249
294400
|
}
|
|
294250
294401
|
} catch {
|