omnius 1.0.899 → 1.0.901
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -2
- package/dist/postinstall-daemon.cjs +11 -0
- package/dist/update-worker-runtime.js +1075 -314
- package/npm-shrinkwrap.json +44 -44
- package/package.json +1 -1
|
@@ -57172,7 +57172,7 @@ var require_util = __commonJS({
|
|
|
57172
57172
|
return path3;
|
|
57173
57173
|
}
|
|
57174
57174
|
exports.normalize = normalize;
|
|
57175
|
-
function
|
|
57175
|
+
function join22(aRoot, aPath) {
|
|
57176
57176
|
if (aRoot === "") {
|
|
57177
57177
|
aRoot = ".";
|
|
57178
57178
|
}
|
|
@@ -57204,7 +57204,7 @@ var require_util = __commonJS({
|
|
|
57204
57204
|
}
|
|
57205
57205
|
return joined;
|
|
57206
57206
|
}
|
|
57207
|
-
exports.join =
|
|
57207
|
+
exports.join = join22;
|
|
57208
57208
|
exports.isAbsolute = function(aPath) {
|
|
57209
57209
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
57210
57210
|
};
|
|
@@ -57377,7 +57377,7 @@ var require_util = __commonJS({
|
|
|
57377
57377
|
parsed.path = parsed.path.substring(0, index + 1);
|
|
57378
57378
|
}
|
|
57379
57379
|
}
|
|
57380
|
-
sourceURL =
|
|
57380
|
+
sourceURL = join22(urlGenerate(parsed), sourceURL);
|
|
57381
57381
|
}
|
|
57382
57382
|
return normalize(sourceURL);
|
|
57383
57383
|
}
|
|
@@ -64716,7 +64716,7 @@ ${lanes.join("\n")}
|
|
|
64716
64716
|
recursionIdentityMap.set(recursionIdentity, recursionToken);
|
|
64717
64717
|
}
|
|
64718
64718
|
}
|
|
64719
|
-
const
|
|
64719
|
+
const descriptor2 = {
|
|
64720
64720
|
id: type.id,
|
|
64721
64721
|
intrinsicName: type.intrinsicName,
|
|
64722
64722
|
symbolName: (symbol == null ? void 0 : symbol.escapedName) && unescapeLeadingUnderscores(symbol.escapedName),
|
|
@@ -64737,7 +64737,7 @@ ${lanes.join("\n")}
|
|
|
64737
64737
|
flags: Debug.formatTypeFlags(type.flags).split("|"),
|
|
64738
64738
|
display
|
|
64739
64739
|
};
|
|
64740
|
-
fs.writeSync(typesFd, JSON.stringify(
|
|
64740
|
+
fs.writeSync(typesFd, JSON.stringify(descriptor2));
|
|
64741
64741
|
if (i < numTypes - 1) {
|
|
64742
64742
|
fs.writeSync(typesFd, ",\n");
|
|
64743
64743
|
}
|
|
@@ -67864,7 +67864,7 @@ ${lanes.join("\n")}
|
|
|
67864
67864
|
writeOutputIsTTY() {
|
|
67865
67865
|
return process.stdout.isTTY;
|
|
67866
67866
|
},
|
|
67867
|
-
readFile,
|
|
67867
|
+
readFile: readFile2,
|
|
67868
67868
|
writeFile: writeFile2,
|
|
67869
67869
|
watchFile: watchFile2,
|
|
67870
67870
|
watchDirectory,
|
|
@@ -68070,7 +68070,7 @@ ${lanes.join("\n")}
|
|
|
68070
68070
|
callback
|
|
68071
68071
|
);
|
|
68072
68072
|
}
|
|
68073
|
-
function
|
|
68073
|
+
function readFile2(fileName, _encoding) {
|
|
68074
68074
|
let buffer;
|
|
68075
68075
|
try {
|
|
68076
68076
|
buffer = _fs.readFileSync(fileName);
|
|
@@ -90487,7 +90487,7 @@ ${lanes.join("\n")}
|
|
|
90487
90487
|
/* AdviseOnEmitNode */
|
|
90488
90488
|
);
|
|
90489
90489
|
}
|
|
90490
|
-
function createDecorateHelper(decoratorExpressions, target, memberName,
|
|
90490
|
+
function createDecorateHelper(decoratorExpressions, target, memberName, descriptor2) {
|
|
90491
90491
|
context.requestEmitHelper(decorateHelper);
|
|
90492
90492
|
const argumentsArray = [];
|
|
90493
90493
|
argumentsArray.push(factory2.createArrayLiteralExpression(
|
|
@@ -90498,8 +90498,8 @@ ${lanes.join("\n")}
|
|
|
90498
90498
|
argumentsArray.push(target);
|
|
90499
90499
|
if (memberName) {
|
|
90500
90500
|
argumentsArray.push(memberName);
|
|
90501
|
-
if (
|
|
90502
|
-
argumentsArray.push(
|
|
90501
|
+
if (descriptor2) {
|
|
90502
|
+
argumentsArray.push(descriptor2);
|
|
90503
90503
|
}
|
|
90504
90504
|
}
|
|
90505
90505
|
return factory2.createCallExpression(
|
|
@@ -104753,7 +104753,7 @@ ${lanes.join("\n")}
|
|
|
104753
104753
|
const possibleOption = getSpellingSuggestion(unknownOption, diagnostics.optionDeclarations, getOptionName);
|
|
104754
104754
|
return possibleOption ? createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownDidYouMeanDiagnostic, unknownOptionErrorText || unknownOption, possibleOption.name) : createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption);
|
|
104755
104755
|
}
|
|
104756
|
-
function parseCommandLineWorker(diagnostics, commandLine,
|
|
104756
|
+
function parseCommandLineWorker(diagnostics, commandLine, readFile2) {
|
|
104757
104757
|
const options = {};
|
|
104758
104758
|
let watchOptions;
|
|
104759
104759
|
const fileNames = [];
|
|
@@ -104801,7 +104801,7 @@ ${lanes.join("\n")}
|
|
|
104801
104801
|
}
|
|
104802
104802
|
}
|
|
104803
104803
|
function parseResponseFile(fileName) {
|
|
104804
|
-
const text2 = tryReadFile(fileName,
|
|
104804
|
+
const text2 = tryReadFile(fileName, readFile2 || ((fileName2) => sys.readFile(fileName2)));
|
|
104805
104805
|
if (!isString(text2)) {
|
|
104806
104806
|
errors.push(text2);
|
|
104807
104807
|
return;
|
|
@@ -104904,8 +104904,8 @@ ${lanes.join("\n")}
|
|
|
104904
104904
|
unknownDidYouMeanDiagnostic: Diagnostics.Unknown_compiler_option_0_Did_you_mean_1,
|
|
104905
104905
|
optionTypeMismatchDiagnostic: Diagnostics.Compiler_option_0_expects_an_argument
|
|
104906
104906
|
};
|
|
104907
|
-
function parseCommandLine(commandLine,
|
|
104908
|
-
return parseCommandLineWorker(compilerOptionsDidYouMeanDiagnostics, commandLine,
|
|
104907
|
+
function parseCommandLine(commandLine, readFile2) {
|
|
104908
|
+
return parseCommandLineWorker(compilerOptionsDidYouMeanDiagnostics, commandLine, readFile2);
|
|
104909
104909
|
}
|
|
104910
104910
|
function getOptionFromName(optionName, allowShort) {
|
|
104911
104911
|
return getOptionDeclarationFromName(getOptionsNameMap, optionName, allowShort);
|
|
@@ -104987,8 +104987,8 @@ ${lanes.join("\n")}
|
|
|
104987
104987
|
watchOptionsToExtend
|
|
104988
104988
|
);
|
|
104989
104989
|
}
|
|
104990
|
-
function readConfigFile(fileName,
|
|
104991
|
-
const textOrDiagnostic = tryReadFile(fileName,
|
|
104990
|
+
function readConfigFile(fileName, readFile2) {
|
|
104991
|
+
const textOrDiagnostic = tryReadFile(fileName, readFile2);
|
|
104992
104992
|
return isString(textOrDiagnostic) ? parseConfigFileTextToJson(fileName, textOrDiagnostic) : { config: {}, error: textOrDiagnostic };
|
|
104993
104993
|
}
|
|
104994
104994
|
function parseConfigFileTextToJson(fileName, jsonText) {
|
|
@@ -105003,14 +105003,14 @@ ${lanes.join("\n")}
|
|
|
105003
105003
|
error: jsonSourceFile.parseDiagnostics.length ? jsonSourceFile.parseDiagnostics[0] : void 0
|
|
105004
105004
|
};
|
|
105005
105005
|
}
|
|
105006
|
-
function readJsonConfigFile(fileName,
|
|
105007
|
-
const textOrDiagnostic = tryReadFile(fileName,
|
|
105006
|
+
function readJsonConfigFile(fileName, readFile2) {
|
|
105007
|
+
const textOrDiagnostic = tryReadFile(fileName, readFile2);
|
|
105008
105008
|
return isString(textOrDiagnostic) ? parseJsonText(fileName, textOrDiagnostic) : { fileName, parseDiagnostics: [textOrDiagnostic] };
|
|
105009
105009
|
}
|
|
105010
|
-
function tryReadFile(fileName,
|
|
105010
|
+
function tryReadFile(fileName, readFile2) {
|
|
105011
105011
|
let text2;
|
|
105012
105012
|
try {
|
|
105013
|
-
text2 =
|
|
105013
|
+
text2 = readFile2(fileName);
|
|
105014
105014
|
} catch (e) {
|
|
105015
105015
|
return createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message);
|
|
105016
105016
|
}
|
|
@@ -105292,7 +105292,7 @@ ${lanes.join("\n")}
|
|
|
105292
105292
|
const pathOptions = { configFilePath: getNormalizedAbsolutePath(configFileName, host.getCurrentDirectory()), useCaseSensitiveFileNames: host.useCaseSensitiveFileNames };
|
|
105293
105293
|
const optionMap = serializeCompilerOptions(configParseResult.options, pathOptions);
|
|
105294
105294
|
const watchOptionMap = configParseResult.watchOptions && serializeWatchOptions(configParseResult.watchOptions);
|
|
105295
|
-
const
|
|
105295
|
+
const config2 = {
|
|
105296
105296
|
compilerOptions: {
|
|
105297
105297
|
...optionMapToObject(optionMap),
|
|
105298
105298
|
showConfig: void 0,
|
|
@@ -105326,8 +105326,8 @@ ${lanes.join("\n")}
|
|
|
105326
105326
|
}
|
|
105327
105327
|
}
|
|
105328
105328
|
}
|
|
105329
|
-
assign(
|
|
105330
|
-
return
|
|
105329
|
+
assign(config2.compilerOptions, optionMapToObject(serializeCompilerOptions(impliedCompilerOptions, pathOptions)));
|
|
105330
|
+
return config2;
|
|
105331
105331
|
}
|
|
105332
105332
|
function optionDependsOn(option, dependsOn) {
|
|
105333
105333
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -105941,8 +105941,8 @@ ${lanes.join("\n")}
|
|
|
105941
105941
|
function shouldReportNoInputFiles(fileNames, canJsonReportNoInutFiles, resolutionStack) {
|
|
105942
105942
|
return fileNames.length === 0 && canJsonReportNoInutFiles && (!resolutionStack || resolutionStack.length === 0);
|
|
105943
105943
|
}
|
|
105944
|
-
function isSolutionConfig(
|
|
105945
|
-
return !
|
|
105944
|
+
function isSolutionConfig(config2) {
|
|
105945
|
+
return !config2.fileNames.length && hasProperty(config2.raw, "references");
|
|
105946
105946
|
}
|
|
105947
105947
|
function canJsonReportNoInputFiles(raw) {
|
|
105948
105948
|
return !hasProperty(raw, "files") && !hasProperty(raw, "references");
|
|
@@ -169059,8 +169059,8 @@ ${lanes.join("\n")}
|
|
|
169059
169059
|
return expression;
|
|
169060
169060
|
} else {
|
|
169061
169061
|
const name = isComputedPropertyName(propertyName) ? propertyName.expression : isIdentifier(propertyName) ? factory2.createStringLiteral(unescapeLeadingUnderscores(propertyName.escapedText)) : propertyName;
|
|
169062
|
-
const
|
|
169063
|
-
return factory2.createObjectDefinePropertyCall(receiver, name,
|
|
169062
|
+
const descriptor2 = factory2.createPropertyDescriptor({ value: initializer, configurable: true, writable: true, enumerable: true });
|
|
169063
|
+
return factory2.createObjectDefinePropertyCall(receiver, name, descriptor2);
|
|
169064
169064
|
}
|
|
169065
169065
|
}
|
|
169066
169066
|
function enableSubstitutionForClassAliases() {
|
|
@@ -170384,12 +170384,12 @@ ${lanes.join("\n")}
|
|
|
170384
170384
|
/* Ambient */
|
|
170385
170385
|
)
|
|
170386
170386
|
);
|
|
170387
|
-
const
|
|
170387
|
+
const descriptor2 = isPropertyDeclaration(member) && !hasAccessorModifier(member) ? factory2.createVoidZero() : factory2.createNull();
|
|
170388
170388
|
const helper = emitHelpers().createDecorateHelper(
|
|
170389
170389
|
decoratorExpressions,
|
|
170390
170390
|
prefix,
|
|
170391
170391
|
memberName,
|
|
170392
|
-
|
|
170392
|
+
descriptor2
|
|
170393
170393
|
);
|
|
170394
170394
|
setEmitFlags(
|
|
170395
170395
|
helper,
|
|
@@ -171576,13 +171576,13 @@ ${lanes.join("\n")}
|
|
|
171576
171576
|
if (isMethodOrAccessor(member)) {
|
|
171577
171577
|
const methodExtraInitializersName = isStatic(member) ? classInfo2.staticMethodExtraInitializersName : classInfo2.instanceMethodExtraInitializersName;
|
|
171578
171578
|
Debug.assertIsDefined(methodExtraInitializersName);
|
|
171579
|
-
let
|
|
171579
|
+
let descriptor2;
|
|
171580
171580
|
if (isPrivateIdentifierClassElementDeclaration(member) && createDescriptor) {
|
|
171581
|
-
|
|
171581
|
+
descriptor2 = createDescriptor(member, visitNodes2(modifiers, (node) => tryCast(node, isAsyncModifier), isModifier));
|
|
171582
171582
|
memberInfo.memberDescriptorName = descriptorName = createHelperVariable(member, "descriptor");
|
|
171583
|
-
|
|
171583
|
+
descriptor2 = factory2.createAssignment(descriptorName, descriptor2);
|
|
171584
171584
|
}
|
|
171585
|
-
const esDecorateExpression = emitHelpers().createESDecorateHelper(factory2.createThis(),
|
|
171585
|
+
const esDecorateExpression = emitHelpers().createESDecorateHelper(factory2.createThis(), descriptor2 ?? factory2.createNull(), memberDecoratorsName, context2, factory2.createNull(), methodExtraInitializersName);
|
|
171586
171586
|
const esDecorateStatement = factory2.createExpressionStatement(esDecorateExpression);
|
|
171587
171587
|
setSourceMapRange(esDecorateStatement, moveRangePastDecorators(member));
|
|
171588
171588
|
statements.push(esDecorateStatement);
|
|
@@ -171592,19 +171592,19 @@ ${lanes.join("\n")}
|
|
|
171592
171592
|
if (isStatic(member)) {
|
|
171593
171593
|
thisArg = classInfo2.classThis;
|
|
171594
171594
|
}
|
|
171595
|
-
let
|
|
171595
|
+
let descriptor2;
|
|
171596
171596
|
if (isPrivateIdentifierClassElementDeclaration(member) && hasAccessorModifier(member) && createDescriptor) {
|
|
171597
|
-
|
|
171597
|
+
descriptor2 = createDescriptor(
|
|
171598
171598
|
member,
|
|
171599
171599
|
/*modifiers*/
|
|
171600
171600
|
void 0
|
|
171601
171601
|
);
|
|
171602
171602
|
memberInfo.memberDescriptorName = descriptorName = createHelperVariable(member, "descriptor");
|
|
171603
|
-
|
|
171603
|
+
descriptor2 = factory2.createAssignment(descriptorName, descriptor2);
|
|
171604
171604
|
}
|
|
171605
171605
|
const esDecorateExpression = emitHelpers().createESDecorateHelper(
|
|
171606
171606
|
isAutoAccessorPropertyDeclaration(member) ? factory2.createThis() : factory2.createNull(),
|
|
171607
|
-
|
|
171607
|
+
descriptor2 ?? factory2.createNull(),
|
|
171608
171608
|
memberDecoratorsName,
|
|
171609
171609
|
context2,
|
|
171610
171610
|
initializersName,
|
|
@@ -195112,12 +195112,12 @@ ${lanes.join("\n")}
|
|
|
195112
195112
|
function createCompilerHost(options, setParentNodes) {
|
|
195113
195113
|
return createCompilerHostWorker(options, setParentNodes);
|
|
195114
195114
|
}
|
|
195115
|
-
function createGetSourceFile(
|
|
195115
|
+
function createGetSourceFile(readFile2, setParentNodes) {
|
|
195116
195116
|
return (fileName, languageVersionOrOptions, onError) => {
|
|
195117
195117
|
let text2;
|
|
195118
195118
|
try {
|
|
195119
195119
|
mark("beforeIORead");
|
|
195120
|
-
text2 =
|
|
195120
|
+
text2 = readFile2(fileName);
|
|
195121
195121
|
mark("afterIORead");
|
|
195122
195122
|
measure("I/O Read", "beforeIORead", "afterIORead");
|
|
195123
195123
|
} catch (e) {
|
|
@@ -196021,7 +196021,7 @@ ${lanes.join("\n")}
|
|
|
196021
196021
|
getRedirectFromOutput,
|
|
196022
196022
|
forEachResolvedProjectReference: forEachResolvedProjectReference2
|
|
196023
196023
|
});
|
|
196024
|
-
const
|
|
196024
|
+
const readFile2 = host.readFile.bind(host);
|
|
196025
196025
|
(_e = tracing) == null ? void 0 : _e.push(tracing.Phase.Program, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
|
|
196026
196026
|
const shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
|
|
196027
196027
|
(_f = tracing) == null ? void 0 : _f.pop();
|
|
@@ -196242,7 +196242,7 @@ ${lanes.join("\n")}
|
|
|
196242
196242
|
shouldTransformImportCall,
|
|
196243
196243
|
emitBuildInfo,
|
|
196244
196244
|
fileExists,
|
|
196245
|
-
readFile,
|
|
196245
|
+
readFile: readFile2,
|
|
196246
196246
|
directoryExists,
|
|
196247
196247
|
getSymlinkCache,
|
|
196248
196248
|
realpath: (_o = host.realpath) == null ? void 0 : _o.bind(host),
|
|
@@ -203302,12 +203302,12 @@ ${lanes.join("\n")}
|
|
|
203302
203302
|
missingFilesMap = void 0;
|
|
203303
203303
|
}
|
|
203304
203304
|
if (parsedConfigs) {
|
|
203305
|
-
clearMap(parsedConfigs, (
|
|
203305
|
+
clearMap(parsedConfigs, (config2) => {
|
|
203306
203306
|
var _a3;
|
|
203307
|
-
(_a3 =
|
|
203308
|
-
|
|
203309
|
-
if (
|
|
203310
|
-
|
|
203307
|
+
(_a3 = config2.watcher) == null ? void 0 : _a3.close();
|
|
203308
|
+
config2.watcher = void 0;
|
|
203309
|
+
if (config2.watchedDirectories) clearMap(config2.watchedDirectories, closeFileWatcherOf);
|
|
203310
|
+
config2.watchedDirectories = void 0;
|
|
203311
203311
|
});
|
|
203312
203312
|
parsedConfigs = void 0;
|
|
203313
203313
|
}
|
|
@@ -203380,8 +203380,8 @@ ${lanes.join("\n")}
|
|
|
203380
203380
|
watchConfigFileWildCardDirectories();
|
|
203381
203381
|
if (configFileName) updateExtendedConfigFilesWatches(toPath3(configFileName), compilerOptions, watchOptions, WatchType.ExtendedConfigFile);
|
|
203382
203382
|
} else {
|
|
203383
|
-
const
|
|
203384
|
-
if (
|
|
203383
|
+
const config2 = parsedConfigs == null ? void 0 : parsedConfigs.get(configPath);
|
|
203384
|
+
if (config2) watchReferencedProject(configFile, configPath, config2);
|
|
203385
203385
|
}
|
|
203386
203386
|
});
|
|
203387
203387
|
staleWatches = void 0;
|
|
@@ -203625,30 +203625,30 @@ ${lanes.join("\n")}
|
|
|
203625
203625
|
}
|
|
203626
203626
|
function getParsedCommandLine(configFileName2) {
|
|
203627
203627
|
const configPath = toPath3(configFileName2);
|
|
203628
|
-
let
|
|
203629
|
-
if (
|
|
203630
|
-
if (!
|
|
203631
|
-
if (
|
|
203628
|
+
let config2 = parsedConfigs == null ? void 0 : parsedConfigs.get(configPath);
|
|
203629
|
+
if (config2) {
|
|
203630
|
+
if (!config2.updateLevel) return config2.parsedCommandLine;
|
|
203631
|
+
if (config2.parsedCommandLine && config2.updateLevel === 1 && !host.getParsedCommandLine) {
|
|
203632
203632
|
writeLog("Reloading new file names and options");
|
|
203633
203633
|
Debug.assert(compilerOptions);
|
|
203634
203634
|
const fileNames = getFileNamesFromConfigSpecs(
|
|
203635
|
-
|
|
203635
|
+
config2.parsedCommandLine.options.configFile.configFileSpecs,
|
|
203636
203636
|
getNormalizedAbsolutePath(getDirectoryPath(configFileName2), currentDirectory),
|
|
203637
203637
|
compilerOptions,
|
|
203638
203638
|
parseConfigFileHost
|
|
203639
203639
|
);
|
|
203640
|
-
|
|
203641
|
-
|
|
203642
|
-
return
|
|
203640
|
+
config2.parsedCommandLine = { ...config2.parsedCommandLine, fileNames };
|
|
203641
|
+
config2.updateLevel = void 0;
|
|
203642
|
+
return config2.parsedCommandLine;
|
|
203643
203643
|
}
|
|
203644
203644
|
}
|
|
203645
203645
|
writeLog(`Loading config file: ${configFileName2}`);
|
|
203646
203646
|
const parsedCommandLine = host.getParsedCommandLine ? host.getParsedCommandLine(configFileName2) : getParsedCommandLineFromConfigFileHost(configFileName2);
|
|
203647
|
-
if (
|
|
203648
|
-
|
|
203649
|
-
|
|
203647
|
+
if (config2) {
|
|
203648
|
+
config2.parsedCommandLine = parsedCommandLine;
|
|
203649
|
+
config2.updateLevel = void 0;
|
|
203650
203650
|
} else {
|
|
203651
|
-
(parsedConfigs || (parsedConfigs = /* @__PURE__ */ new Map())).set(configPath,
|
|
203651
|
+
(parsedConfigs || (parsedConfigs = /* @__PURE__ */ new Map())).set(configPath, config2 = { parsedCommandLine });
|
|
203652
203652
|
}
|
|
203653
203653
|
(staleWatches ?? (staleWatches = /* @__PURE__ */ new Map())).set(configPath, configFileName2);
|
|
203654
203654
|
return parsedCommandLine;
|
|
@@ -203670,11 +203670,11 @@ ${lanes.join("\n")}
|
|
|
203670
203670
|
function onReleaseParsedCommandLine(fileName) {
|
|
203671
203671
|
var _a3;
|
|
203672
203672
|
const path3 = toPath3(fileName);
|
|
203673
|
-
const
|
|
203674
|
-
if (!
|
|
203673
|
+
const config2 = parsedConfigs == null ? void 0 : parsedConfigs.get(path3);
|
|
203674
|
+
if (!config2) return;
|
|
203675
203675
|
parsedConfigs.delete(path3);
|
|
203676
|
-
if (
|
|
203677
|
-
(_a3 =
|
|
203676
|
+
if (config2.watchedDirectories) clearMap(config2.watchedDirectories, closeFileWatcherOf);
|
|
203677
|
+
(_a3 = config2.watcher) == null ? void 0 : _a3.close();
|
|
203678
203678
|
clearSharedExtendedConfigFileWatcher(path3, sharedExtendedConfigFileWatchers);
|
|
203679
203679
|
}
|
|
203680
203680
|
function watchFilePath(path3, file, callback, pollingInterval, options, watchType) {
|
|
@@ -203770,8 +203770,8 @@ ${lanes.join("\n")}
|
|
|
203770
203770
|
if (configFileName && toPath3(configFileName) === projectPath) {
|
|
203771
203771
|
updateLevel = 2;
|
|
203772
203772
|
} else {
|
|
203773
|
-
const
|
|
203774
|
-
if (
|
|
203773
|
+
const config2 = parsedConfigs == null ? void 0 : parsedConfigs.get(projectPath);
|
|
203774
|
+
if (config2) config2.updateLevel = 2;
|
|
203775
203775
|
resolutionCache.removeResolutionsFromProjectReferenceRedirects(projectPath);
|
|
203776
203776
|
}
|
|
203777
203777
|
scheduleProgramUpdate();
|
|
@@ -203790,8 +203790,8 @@ ${lanes.join("\n")}
|
|
|
203790
203790
|
configFileName2,
|
|
203791
203791
|
(_fileName, eventKind) => {
|
|
203792
203792
|
updateCachedSystemWithFile(configFileName2, configPath, eventKind);
|
|
203793
|
-
const
|
|
203794
|
-
if (
|
|
203793
|
+
const config2 = parsedConfigs == null ? void 0 : parsedConfigs.get(configPath);
|
|
203794
|
+
if (config2) config2.updateLevel = 2;
|
|
203795
203795
|
resolutionCache.removeResolutionsFromProjectReferenceRedirects(configPath);
|
|
203796
203796
|
scheduleProgramUpdate();
|
|
203797
203797
|
},
|
|
@@ -203812,22 +203812,22 @@ ${lanes.join("\n")}
|
|
|
203812
203812
|
cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
|
|
203813
203813
|
}
|
|
203814
203814
|
nextSourceFileVersion(fileOrDirectoryPath);
|
|
203815
|
-
const
|
|
203816
|
-
if (!(
|
|
203815
|
+
const config2 = parsedConfigs == null ? void 0 : parsedConfigs.get(configPath);
|
|
203816
|
+
if (!(config2 == null ? void 0 : config2.parsedCommandLine)) return;
|
|
203817
203817
|
if (isIgnoredFileFromWildCardWatching({
|
|
203818
203818
|
watchedDirPath: toPath3(directory),
|
|
203819
203819
|
fileOrDirectory,
|
|
203820
203820
|
fileOrDirectoryPath,
|
|
203821
203821
|
configFileName: configFileName2,
|
|
203822
|
-
options:
|
|
203823
|
-
program:
|
|
203822
|
+
options: config2.parsedCommandLine.options,
|
|
203823
|
+
program: config2.parsedCommandLine.fileNames,
|
|
203824
203824
|
currentDirectory,
|
|
203825
203825
|
useCaseSensitiveFileNames: useCaseSensitiveFileNames2,
|
|
203826
203826
|
writeLog,
|
|
203827
203827
|
toPath: toPath3
|
|
203828
203828
|
})) return;
|
|
203829
|
-
if (
|
|
203830
|
-
|
|
203829
|
+
if (config2.updateLevel !== 2) {
|
|
203830
|
+
config2.updateLevel = 1;
|
|
203831
203831
|
scheduleProgramUpdate();
|
|
203832
203832
|
}
|
|
203833
203833
|
},
|
|
@@ -204318,29 +204318,29 @@ ${lanes.join("\n")}
|
|
|
204318
204318
|
state.projectPendingBuild.delete(projectPath);
|
|
204319
204319
|
return state.diagnostics.has(projectPath) ? 1 : 0;
|
|
204320
204320
|
}
|
|
204321
|
-
function createUpdateOutputFileStampsProject(state, project, projectPath,
|
|
204321
|
+
function createUpdateOutputFileStampsProject(state, project, projectPath, config2, buildOrder) {
|
|
204322
204322
|
let updateOutputFileStampsPending = true;
|
|
204323
204323
|
return {
|
|
204324
204324
|
kind: 1,
|
|
204325
204325
|
project,
|
|
204326
204326
|
projectPath,
|
|
204327
204327
|
buildOrder,
|
|
204328
|
-
getCompilerOptions: () =>
|
|
204328
|
+
getCompilerOptions: () => config2.options,
|
|
204329
204329
|
getCurrentDirectory: () => state.compilerHost.getCurrentDirectory(),
|
|
204330
204330
|
updateOutputFileStatmps: () => {
|
|
204331
|
-
updateOutputTimestamps(state,
|
|
204331
|
+
updateOutputTimestamps(state, config2, projectPath);
|
|
204332
204332
|
updateOutputFileStampsPending = false;
|
|
204333
204333
|
},
|
|
204334
204334
|
done: () => {
|
|
204335
204335
|
if (updateOutputFileStampsPending) {
|
|
204336
|
-
updateOutputTimestamps(state,
|
|
204336
|
+
updateOutputTimestamps(state, config2, projectPath);
|
|
204337
204337
|
}
|
|
204338
204338
|
mark("SolutionBuilder::Timestamps only updates");
|
|
204339
204339
|
return doneInvalidatedProject(state, projectPath);
|
|
204340
204340
|
}
|
|
204341
204341
|
};
|
|
204342
204342
|
}
|
|
204343
|
-
function createBuildOrUpdateInvalidedProject(state, project, projectPath, projectIndex,
|
|
204343
|
+
function createBuildOrUpdateInvalidedProject(state, project, projectPath, projectIndex, config2, status, buildOrder) {
|
|
204344
204344
|
let step = 0;
|
|
204345
204345
|
let program;
|
|
204346
204346
|
let buildResult;
|
|
@@ -204349,7 +204349,7 @@ ${lanes.join("\n")}
|
|
|
204349
204349
|
project,
|
|
204350
204350
|
projectPath,
|
|
204351
204351
|
buildOrder,
|
|
204352
|
-
getCompilerOptions: () =>
|
|
204352
|
+
getCompilerOptions: () => config2.options,
|
|
204353
204353
|
getCurrentDirectory: () => state.compilerHost.getCurrentDirectory(),
|
|
204354
204354
|
getBuilderProgram: () => withProgramOrUndefined(identity),
|
|
204355
204355
|
getProgram: () => withProgramOrUndefined(
|
|
@@ -204421,23 +204421,23 @@ ${lanes.join("\n")}
|
|
|
204421
204421
|
return;
|
|
204422
204422
|
}
|
|
204423
204423
|
if (state.options.verbose) reportStatus(state, Diagnostics.Building_project_0, project);
|
|
204424
|
-
if (
|
|
204425
|
-
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(
|
|
204424
|
+
if (config2.fileNames.length === 0) {
|
|
204425
|
+
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config2));
|
|
204426
204426
|
buildResult = 0;
|
|
204427
204427
|
step = 2;
|
|
204428
204428
|
return;
|
|
204429
204429
|
}
|
|
204430
204430
|
const { host, compilerHost } = state;
|
|
204431
|
-
state.projectCompilerOptions =
|
|
204432
|
-
(_a3 = state.moduleResolutionCache) == null ? void 0 : _a3.update(
|
|
204433
|
-
(_b = state.typeReferenceDirectiveResolutionCache) == null ? void 0 : _b.update(
|
|
204431
|
+
state.projectCompilerOptions = config2.options;
|
|
204432
|
+
(_a3 = state.moduleResolutionCache) == null ? void 0 : _a3.update(config2.options);
|
|
204433
|
+
(_b = state.typeReferenceDirectiveResolutionCache) == null ? void 0 : _b.update(config2.options);
|
|
204434
204434
|
program = host.createProgram(
|
|
204435
|
-
|
|
204436
|
-
|
|
204435
|
+
config2.fileNames,
|
|
204436
|
+
config2.options,
|
|
204437
204437
|
compilerHost,
|
|
204438
|
-
getOldProgram(state, projectPath,
|
|
204439
|
-
getConfigFileParsingDiagnostics(
|
|
204440
|
-
|
|
204438
|
+
getOldProgram(state, projectPath, config2),
|
|
204439
|
+
getConfigFileParsingDiagnostics(config2),
|
|
204440
|
+
config2.projectReferences
|
|
204441
204441
|
);
|
|
204442
204442
|
if (state.watch) {
|
|
204443
204443
|
const internalMap = (_c = state.moduleResolutionCache) == null ? void 0 : _c.getPackageJsonInfoCache().getInternalMap();
|
|
@@ -204512,7 +204512,7 @@ ${lanes.join("\n")}
|
|
|
204512
204512
|
customTransformers || ((_b = (_a3 = state.host).getCustomTransformers) == null ? void 0 : _b.call(_a3, project))
|
|
204513
204513
|
);
|
|
204514
204514
|
if ((!options.noEmitOnError || !diagnostics.length) && (emittedOutputs.size || status.type !== 8)) {
|
|
204515
|
-
updateOutputTimestampsWorker(state,
|
|
204515
|
+
updateOutputTimestampsWorker(state, config2, projectPath, Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
|
|
204516
204516
|
}
|
|
204517
204517
|
state.projectErrorsReported.set(projectPath, true);
|
|
204518
204518
|
buildResult = ((_c = program.hasChangedEmitSignature) == null ? void 0 : _c.call(program)) ? 0 : 2;
|
|
@@ -204520,7 +204520,7 @@ ${lanes.join("\n")}
|
|
|
204520
204520
|
state.diagnostics.delete(projectPath);
|
|
204521
204521
|
state.projectStatus.set(projectPath, {
|
|
204522
204522
|
type: 1,
|
|
204523
|
-
oldestOutputFileName: firstOrUndefinedIterator(emittedOutputs.values()) ?? getFirstProjectOutput(
|
|
204523
|
+
oldestOutputFileName: firstOrUndefinedIterator(emittedOutputs.values()) ?? getFirstProjectOutput(config2, !host.useCaseSensitiveFileNames())
|
|
204524
204524
|
});
|
|
204525
204525
|
} else {
|
|
204526
204526
|
state.diagnostics.set(projectPath, diagnostics);
|
|
@@ -204542,7 +204542,7 @@ ${lanes.join("\n")}
|
|
|
204542
204542
|
emit(writeFile2, cancellationToken, customTransformers);
|
|
204543
204543
|
break;
|
|
204544
204544
|
case 2:
|
|
204545
|
-
queueReferencingProjects(state, project, projectPath, projectIndex,
|
|
204545
|
+
queueReferencingProjects(state, project, projectPath, projectIndex, config2, buildOrder, Debug.checkDefined(buildResult));
|
|
204546
204546
|
step++;
|
|
204547
204547
|
break;
|
|
204548
204548
|
// Should never be done
|
|
@@ -204567,35 +204567,35 @@ ${lanes.join("\n")}
|
|
|
204567
204567
|
reportQueue = false;
|
|
204568
204568
|
reportBuildQueue(state, buildOrder);
|
|
204569
204569
|
}
|
|
204570
|
-
const
|
|
204571
|
-
if (!
|
|
204570
|
+
const config2 = parseConfigFile(state, project, projectPath);
|
|
204571
|
+
if (!config2) {
|
|
204572
204572
|
reportParseConfigFileDiagnostic(state, projectPath);
|
|
204573
204573
|
projectPendingBuild.delete(projectPath);
|
|
204574
204574
|
continue;
|
|
204575
204575
|
}
|
|
204576
204576
|
if (updateLevel === 2) {
|
|
204577
|
-
watchConfigFile(state, project, projectPath,
|
|
204578
|
-
watchExtendedConfigFiles(state, projectPath,
|
|
204579
|
-
watchWildCardDirectories(state, project, projectPath,
|
|
204580
|
-
watchInputFiles(state, project, projectPath,
|
|
204581
|
-
watchPackageJsonFiles(state, project, projectPath,
|
|
204577
|
+
watchConfigFile(state, project, projectPath, config2);
|
|
204578
|
+
watchExtendedConfigFiles(state, projectPath, config2);
|
|
204579
|
+
watchWildCardDirectories(state, project, projectPath, config2);
|
|
204580
|
+
watchInputFiles(state, project, projectPath, config2);
|
|
204581
|
+
watchPackageJsonFiles(state, project, projectPath, config2);
|
|
204582
204582
|
} else if (updateLevel === 1) {
|
|
204583
|
-
|
|
204583
|
+
config2.fileNames = getFileNamesFromConfigSpecs(config2.options.configFile.configFileSpecs, getDirectoryPath(project), config2.options, state.parseConfigFileHost);
|
|
204584
204584
|
updateErrorForNoInputFiles(
|
|
204585
|
-
|
|
204585
|
+
config2.fileNames,
|
|
204586
204586
|
project,
|
|
204587
|
-
|
|
204588
|
-
|
|
204589
|
-
canJsonReportNoInputFiles(
|
|
204587
|
+
config2.options.configFile.configFileSpecs,
|
|
204588
|
+
config2.errors,
|
|
204589
|
+
canJsonReportNoInputFiles(config2.raw)
|
|
204590
204590
|
);
|
|
204591
|
-
watchInputFiles(state, project, projectPath,
|
|
204592
|
-
watchPackageJsonFiles(state, project, projectPath,
|
|
204591
|
+
watchInputFiles(state, project, projectPath, config2);
|
|
204592
|
+
watchPackageJsonFiles(state, project, projectPath, config2);
|
|
204593
204593
|
}
|
|
204594
|
-
const status = getUpToDateStatus(state,
|
|
204594
|
+
const status = getUpToDateStatus(state, config2, projectPath);
|
|
204595
204595
|
if (!options.force) {
|
|
204596
204596
|
if (status.type === 1) {
|
|
204597
204597
|
verboseReportProjectStatus(state, project, status);
|
|
204598
|
-
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(
|
|
204598
|
+
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config2));
|
|
204599
204599
|
projectPendingBuild.delete(projectPath);
|
|
204600
204600
|
if (options.dry) {
|
|
204601
204601
|
reportStatus(state, Diagnostics.Project_0_is_up_to_date, project);
|
|
@@ -204603,20 +204603,20 @@ ${lanes.join("\n")}
|
|
|
204603
204603
|
continue;
|
|
204604
204604
|
}
|
|
204605
204605
|
if (status.type === 2 || status.type === 15) {
|
|
204606
|
-
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(
|
|
204606
|
+
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config2));
|
|
204607
204607
|
return {
|
|
204608
204608
|
kind: 1,
|
|
204609
204609
|
status,
|
|
204610
204610
|
project,
|
|
204611
204611
|
projectPath,
|
|
204612
204612
|
projectIndex,
|
|
204613
|
-
config
|
|
204613
|
+
config: config2
|
|
204614
204614
|
};
|
|
204615
204615
|
}
|
|
204616
204616
|
}
|
|
204617
204617
|
if (status.type === 12) {
|
|
204618
204618
|
verboseReportProjectStatus(state, project, status);
|
|
204619
|
-
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(
|
|
204619
|
+
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config2));
|
|
204620
204620
|
projectPendingBuild.delete(projectPath);
|
|
204621
204621
|
if (options.verbose) {
|
|
204622
204622
|
reportStatus(
|
|
@@ -204630,7 +204630,7 @@ ${lanes.join("\n")}
|
|
|
204630
204630
|
}
|
|
204631
204631
|
if (status.type === 16) {
|
|
204632
204632
|
verboseReportProjectStatus(state, project, status);
|
|
204633
|
-
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(
|
|
204633
|
+
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config2));
|
|
204634
204634
|
projectPendingBuild.delete(projectPath);
|
|
204635
204635
|
continue;
|
|
204636
204636
|
}
|
|
@@ -204640,7 +204640,7 @@ ${lanes.join("\n")}
|
|
|
204640
204640
|
project,
|
|
204641
204641
|
projectPath,
|
|
204642
204642
|
projectIndex,
|
|
204643
|
-
config
|
|
204643
|
+
config: config2
|
|
204644
204644
|
};
|
|
204645
204645
|
}
|
|
204646
204646
|
return void 0;
|
|
@@ -205078,9 +205078,9 @@ ${lanes.join("\n")}
|
|
|
205078
205078
|
oldestOutputFileName: getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
|
|
205079
205079
|
});
|
|
205080
205080
|
}
|
|
205081
|
-
function queueReferencingProjects(state, project, projectPath, projectIndex,
|
|
205081
|
+
function queueReferencingProjects(state, project, projectPath, projectIndex, config2, buildOrder, buildResult) {
|
|
205082
205082
|
if (state.options.stopBuildOnErrors && buildResult & 4) return;
|
|
205083
|
-
if (!
|
|
205083
|
+
if (!config2.options.composite) return;
|
|
205084
205084
|
for (let index = projectIndex + 1; index < buildOrder.length; index++) {
|
|
205085
205085
|
const nextProject = buildOrder[index];
|
|
205086
205086
|
const nextProjectPath = toResolvedConfigFilePath(state, nextProject);
|
|
@@ -206442,8 +206442,8 @@ ${lanes.join("\n")}
|
|
|
206442
206442
|
function createReportErrorSummary(sys2, options) {
|
|
206443
206443
|
return shouldBePretty(sys2, options) ? (errorCount, filesInError) => sys2.write(getErrorSummaryText(errorCount, filesInError, sys2.newLine, sys2)) : void 0;
|
|
206444
206444
|
}
|
|
206445
|
-
function performCompilation(sys2, cb, reportDiagnostic,
|
|
206446
|
-
const { fileNames, options, projectReferences } =
|
|
206445
|
+
function performCompilation(sys2, cb, reportDiagnostic, config2) {
|
|
206446
|
+
const { fileNames, options, projectReferences } = config2;
|
|
206447
206447
|
const host = createCompilerHostWorker(
|
|
206448
206448
|
options,
|
|
206449
206449
|
/*setParentNodes*/
|
|
@@ -206465,7 +206465,7 @@ ${lanes.join("\n")}
|
|
|
206465
206465
|
options,
|
|
206466
206466
|
projectReferences,
|
|
206467
206467
|
host,
|
|
206468
|
-
configFileParsingDiagnostics: getConfigFileParsingDiagnostics(
|
|
206468
|
+
configFileParsingDiagnostics: getConfigFileParsingDiagnostics(config2)
|
|
206469
206469
|
};
|
|
206470
206470
|
const program = createProgram(programOptions);
|
|
206471
206471
|
const exitStatus = emitFilesAndReportErrorsAndGetExitStatus(
|
|
@@ -206483,8 +206483,8 @@ ${lanes.join("\n")}
|
|
|
206483
206483
|
cb(program);
|
|
206484
206484
|
return sys2.exit(exitStatus);
|
|
206485
206485
|
}
|
|
206486
|
-
function performIncrementalCompilation2(sys2, cb, reportDiagnostic,
|
|
206487
|
-
const { options, fileNames, projectReferences } =
|
|
206486
|
+
function performIncrementalCompilation2(sys2, cb, reportDiagnostic, config2) {
|
|
206487
|
+
const { options, fileNames, projectReferences } = config2;
|
|
206488
206488
|
enableStatisticsAndTracing(
|
|
206489
206489
|
sys2,
|
|
206490
206490
|
options,
|
|
@@ -206498,7 +206498,7 @@ ${lanes.join("\n")}
|
|
|
206498
206498
|
system: sys2,
|
|
206499
206499
|
rootNames: fileNames,
|
|
206500
206500
|
options,
|
|
206501
|
-
configFileParsingDiagnostics: getConfigFileParsingDiagnostics(
|
|
206501
|
+
configFileParsingDiagnostics: getConfigFileParsingDiagnostics(config2),
|
|
206502
206502
|
projectReferences,
|
|
206503
206503
|
reportDiagnostic,
|
|
206504
206504
|
reportErrorSummary: createReportErrorSummary(sys2, options),
|
|
@@ -220150,37 +220150,37 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
220150
220150
|
return containingFunction ? [containingFunction, containingClass] : [containingClass];
|
|
220151
220151
|
}
|
|
220152
220152
|
}
|
|
220153
|
-
const
|
|
220153
|
+
const scopes2 = [];
|
|
220154
220154
|
while (true) {
|
|
220155
220155
|
current = current.parent;
|
|
220156
220156
|
if (current.kind === 170) {
|
|
220157
220157
|
current = findAncestor(current, (parent2) => isFunctionLikeDeclaration(parent2)).parent;
|
|
220158
220158
|
}
|
|
220159
220159
|
if (isScope(current)) {
|
|
220160
|
-
|
|
220160
|
+
scopes2.push(current);
|
|
220161
220161
|
if (current.kind === 308) {
|
|
220162
|
-
return
|
|
220162
|
+
return scopes2;
|
|
220163
220163
|
}
|
|
220164
220164
|
}
|
|
220165
220165
|
}
|
|
220166
220166
|
}
|
|
220167
220167
|
function getFunctionExtractionAtIndex(targetRange, context, requestedChangesIndex) {
|
|
220168
|
-
const { scopes, readsAndWrites: { target, usagesPerScope, functionErrorsPerScope, exposedVariableDeclarations } } = getPossibleExtractionsWorker(targetRange, context);
|
|
220168
|
+
const { scopes: scopes2, readsAndWrites: { target, usagesPerScope, functionErrorsPerScope, exposedVariableDeclarations } } = getPossibleExtractionsWorker(targetRange, context);
|
|
220169
220169
|
Debug.assert(!functionErrorsPerScope[requestedChangesIndex].length, "The extraction went missing? How?");
|
|
220170
220170
|
context.cancellationToken.throwIfCancellationRequested();
|
|
220171
|
-
return extractFunctionInScope(target,
|
|
220171
|
+
return extractFunctionInScope(target, scopes2[requestedChangesIndex], usagesPerScope[requestedChangesIndex], exposedVariableDeclarations, targetRange, context);
|
|
220172
220172
|
}
|
|
220173
220173
|
function getConstantExtractionAtIndex(targetRange, context, requestedChangesIndex) {
|
|
220174
|
-
const { scopes, readsAndWrites: { target, usagesPerScope, constantErrorsPerScope, exposedVariableDeclarations } } = getPossibleExtractionsWorker(targetRange, context);
|
|
220174
|
+
const { scopes: scopes2, readsAndWrites: { target, usagesPerScope, constantErrorsPerScope, exposedVariableDeclarations } } = getPossibleExtractionsWorker(targetRange, context);
|
|
220175
220175
|
Debug.assert(!constantErrorsPerScope[requestedChangesIndex].length, "The extraction went missing? How?");
|
|
220176
220176
|
Debug.assert(exposedVariableDeclarations.length === 0, "Extract constant accepted a range containing a variable declaration?");
|
|
220177
220177
|
context.cancellationToken.throwIfCancellationRequested();
|
|
220178
220178
|
const expression = isExpression(target) ? target : target.statements[0].expression;
|
|
220179
|
-
return extractConstantInScope(expression,
|
|
220179
|
+
return extractConstantInScope(expression, scopes2[requestedChangesIndex], usagesPerScope[requestedChangesIndex], targetRange.facts, context);
|
|
220180
220180
|
}
|
|
220181
220181
|
function getPossibleExtractions(targetRange, context) {
|
|
220182
|
-
const { scopes, affectedTextRange, readsAndWrites: { functionErrorsPerScope, constantErrorsPerScope } } = getPossibleExtractionsWorker(targetRange, context);
|
|
220183
|
-
const extractions =
|
|
220182
|
+
const { scopes: scopes2, affectedTextRange, readsAndWrites: { functionErrorsPerScope, constantErrorsPerScope } } = getPossibleExtractionsWorker(targetRange, context);
|
|
220183
|
+
const extractions = scopes2.map((scope, i) => {
|
|
220184
220184
|
const functionDescriptionPart = getDescriptionForFunctionInScope(scope);
|
|
220185
220185
|
const constantDescriptionPart = getDescriptionForConstantInScope(scope);
|
|
220186
220186
|
const scopeDescription = isFunctionLikeDeclaration(scope) ? getDescriptionForFunctionLikeDeclaration(scope) : isClassLike(scope) ? getDescriptionForClassLikeDeclaration(scope) : getDescriptionForModuleLikeDeclaration(scope);
|
|
@@ -220214,17 +220214,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
220214
220214
|
}
|
|
220215
220215
|
function getPossibleExtractionsWorker(targetRange, context) {
|
|
220216
220216
|
const { file: sourceFile } = context;
|
|
220217
|
-
const
|
|
220217
|
+
const scopes2 = collectEnclosingScopes(targetRange);
|
|
220218
220218
|
const enclosingTextRange = getEnclosingTextRange(targetRange, sourceFile);
|
|
220219
220219
|
const readsAndWrites = collectReadsAndWrites(
|
|
220220
220220
|
targetRange,
|
|
220221
|
-
|
|
220221
|
+
scopes2,
|
|
220222
220222
|
enclosingTextRange,
|
|
220223
220223
|
sourceFile,
|
|
220224
220224
|
context.program.getTypeChecker(),
|
|
220225
220225
|
context.cancellationToken
|
|
220226
220226
|
);
|
|
220227
|
-
return { scopes, affectedTextRange: enclosingTextRange, readsAndWrites };
|
|
220227
|
+
return { scopes: scopes2, affectedTextRange: enclosingTextRange, readsAndWrites };
|
|
220228
220228
|
}
|
|
220229
220229
|
function getDescriptionForFunctionInScope(scope) {
|
|
220230
220230
|
return isFunctionLikeDeclaration(scope) ? "inner function" : isClassLike(scope) ? "method" : "function";
|
|
@@ -221018,7 +221018,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
221018
221018
|
function getEnclosingTextRange(targetRange, sourceFile) {
|
|
221019
221019
|
return isReadonlyArray(targetRange.range) ? { pos: first(targetRange.range).getStart(sourceFile), end: last(targetRange.range).getEnd() } : targetRange.range;
|
|
221020
221020
|
}
|
|
221021
|
-
function collectReadsAndWrites(targetRange,
|
|
221021
|
+
function collectReadsAndWrites(targetRange, scopes2, enclosingTextRange, sourceFile, checker, cancellationToken) {
|
|
221022
221022
|
const allTypeParameterUsages = /* @__PURE__ */ new Map();
|
|
221023
221023
|
const usagesPerScope = [];
|
|
221024
221024
|
const substitutionsPerScope = [];
|
|
@@ -221038,7 +221038,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
221038
221038
|
} else if (checker.getTypeAtLocation(expression).flags & (16 | 262144)) {
|
|
221039
221039
|
expressionDiagnostic = createDiagnosticForNode(expression, Messages.uselessConstantType);
|
|
221040
221040
|
}
|
|
221041
|
-
for (const scope of
|
|
221041
|
+
for (const scope of scopes2) {
|
|
221042
221042
|
usagesPerScope.push({ usages: /* @__PURE__ */ new Map(), typeParameterUsages: /* @__PURE__ */ new Map(), substitutions: /* @__PURE__ */ new Map() });
|
|
221043
221043
|
substitutionsPerScope.push(/* @__PURE__ */ new Map());
|
|
221044
221044
|
functionErrorsPerScope.push([]);
|
|
@@ -221066,8 +221066,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
221066
221066
|
if (allTypeParameterUsages.size > 0) {
|
|
221067
221067
|
const seenTypeParameterUsages = /* @__PURE__ */ new Map();
|
|
221068
221068
|
let i = 0;
|
|
221069
|
-
for (let curr = unmodifiedNode; curr !== void 0 && i <
|
|
221070
|
-
if (curr ===
|
|
221069
|
+
for (let curr = unmodifiedNode; curr !== void 0 && i < scopes2.length; curr = curr.parent) {
|
|
221070
|
+
if (curr === scopes2[i]) {
|
|
221071
221071
|
seenTypeParameterUsages.forEach((typeParameter, id2) => {
|
|
221072
221072
|
usagesPerScope[i].typeParameterUsages.set(id2, typeParameter);
|
|
221073
221073
|
});
|
|
@@ -221082,19 +221082,19 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
221082
221082
|
}
|
|
221083
221083
|
}
|
|
221084
221084
|
}
|
|
221085
|
-
Debug.assert(i ===
|
|
221085
|
+
Debug.assert(i === scopes2.length, "Should have iterated all scopes");
|
|
221086
221086
|
}
|
|
221087
221087
|
if (visibleDeclarationsInExtractedRange.length) {
|
|
221088
|
-
const containingLexicalScopeOfExtraction = isBlockScope(
|
|
221088
|
+
const containingLexicalScopeOfExtraction = isBlockScope(scopes2[0], scopes2[0].parent) ? scopes2[0] : getEnclosingBlockScopeContainer(scopes2[0]);
|
|
221089
221089
|
forEachChild(containingLexicalScopeOfExtraction, checkForUsedDeclarations);
|
|
221090
221090
|
}
|
|
221091
|
-
for (let i = 0; i <
|
|
221091
|
+
for (let i = 0; i < scopes2.length; i++) {
|
|
221092
221092
|
const scopeUsages = usagesPerScope[i];
|
|
221093
221093
|
if (i > 0 && (scopeUsages.usages.size > 0 || scopeUsages.typeParameterUsages.size > 0)) {
|
|
221094
221094
|
const errorNode = isReadonlyArray(targetRange.range) ? targetRange.range[0] : targetRange.range;
|
|
221095
221095
|
constantErrorsPerScope[i].push(createDiagnosticForNode(errorNode, Messages.cannotAccessVariablesFromNestedScopes));
|
|
221096
221096
|
}
|
|
221097
|
-
if (targetRange.facts & 16 && isClassLike(
|
|
221097
|
+
if (targetRange.facts & 16 && isClassLike(scopes2[i])) {
|
|
221098
221098
|
functionErrorsPerScope[i].push(createDiagnosticForNode(targetRange.thisNode, Messages.cannotExtractFunctionsContainingThisToMethod));
|
|
221099
221099
|
}
|
|
221100
221100
|
let hasWrite = false;
|
|
@@ -221185,7 +221185,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
221185
221185
|
function recordUsage(n, usage, isTypeNode2) {
|
|
221186
221186
|
const symbolId = recordUsagebySymbol(n, usage, isTypeNode2);
|
|
221187
221187
|
if (symbolId) {
|
|
221188
|
-
for (let i = 0; i <
|
|
221188
|
+
for (let i = 0; i < scopes2.length; i++) {
|
|
221189
221189
|
const substitution = substitutionsPerScope[i].get(symbolId);
|
|
221190
221190
|
if (substitution) {
|
|
221191
221191
|
usagesPerScope[i].substitutions.set(getNodeId(n).toString(), substitution);
|
|
@@ -221230,8 +221230,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
221230
221230
|
errors.push(diag2);
|
|
221231
221231
|
}
|
|
221232
221232
|
}
|
|
221233
|
-
for (let i = 0; i <
|
|
221234
|
-
const scope =
|
|
221233
|
+
for (let i = 0; i < scopes2.length; i++) {
|
|
221234
|
+
const scope = scopes2[i];
|
|
221235
221235
|
const resolvedSymbol = checker.resolveName(
|
|
221236
221236
|
symbol.name,
|
|
221237
221237
|
scope,
|
|
@@ -223856,36 +223856,36 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
223856
223856
|
const range2 = ts_formatting_exports.getRangeOfEnclosingComment(sourceFile, position);
|
|
223857
223857
|
return range2 && (!onlyMultiLine || range2.kind === 3) ? createTextSpanFromRange(range2) : void 0;
|
|
223858
223858
|
}
|
|
223859
|
-
function getTodoComments(fileName,
|
|
223859
|
+
function getTodoComments(fileName, descriptors2) {
|
|
223860
223860
|
synchronizeHostData();
|
|
223861
223861
|
const sourceFile = getValidSourceFile(fileName);
|
|
223862
223862
|
cancellationToken.throwIfCancellationRequested();
|
|
223863
223863
|
const fileContents = sourceFile.text;
|
|
223864
223864
|
const result = [];
|
|
223865
|
-
if (
|
|
223865
|
+
if (descriptors2.length > 0 && !isNodeModulesFile(sourceFile.fileName)) {
|
|
223866
223866
|
const regExp = getTodoCommentsRegExp();
|
|
223867
223867
|
let matchArray;
|
|
223868
223868
|
while (matchArray = regExp.exec(fileContents)) {
|
|
223869
223869
|
cancellationToken.throwIfCancellationRequested();
|
|
223870
223870
|
const firstDescriptorCaptureIndex = 3;
|
|
223871
|
-
Debug.assert(matchArray.length ===
|
|
223871
|
+
Debug.assert(matchArray.length === descriptors2.length + firstDescriptorCaptureIndex);
|
|
223872
223872
|
const preamble = matchArray[1];
|
|
223873
223873
|
const matchPosition = matchArray.index + preamble.length;
|
|
223874
223874
|
if (!isInComment(sourceFile, matchPosition)) {
|
|
223875
223875
|
continue;
|
|
223876
223876
|
}
|
|
223877
|
-
let
|
|
223878
|
-
for (let i = 0; i <
|
|
223877
|
+
let descriptor2;
|
|
223878
|
+
for (let i = 0; i < descriptors2.length; i++) {
|
|
223879
223879
|
if (matchArray[i + firstDescriptorCaptureIndex]) {
|
|
223880
|
-
|
|
223880
|
+
descriptor2 = descriptors2[i];
|
|
223881
223881
|
}
|
|
223882
223882
|
}
|
|
223883
|
-
if (
|
|
223884
|
-
if (isLetterOrDigit(fileContents.charCodeAt(matchPosition +
|
|
223883
|
+
if (descriptor2 === void 0) return Debug.fail();
|
|
223884
|
+
if (isLetterOrDigit(fileContents.charCodeAt(matchPosition + descriptor2.text.length))) {
|
|
223885
223885
|
continue;
|
|
223886
223886
|
}
|
|
223887
223887
|
const message = matchArray[2];
|
|
223888
|
-
result.push({ descriptor, message, position: matchPosition });
|
|
223888
|
+
result.push({ descriptor: descriptor2, message, position: matchPosition });
|
|
223889
223889
|
}
|
|
223890
223890
|
}
|
|
223891
223891
|
return result;
|
|
@@ -223897,7 +223897,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
223897
223897
|
const multiLineCommentStart = /(?:\/\*+\s*)/.source;
|
|
223898
223898
|
const anyNumberOfSpacesAndAsterisksAtStartOfLine = /(?:^(?:\s|\*)*)/.source;
|
|
223899
223899
|
const preamble = "(" + anyNumberOfSpacesAndAsterisksAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")";
|
|
223900
|
-
const literals = "(?:" + map(
|
|
223900
|
+
const literals = "(?:" + map(descriptors2, (d) => "(" + escapeRegExp(d.text) + ")").join("|") + ")";
|
|
223901
223901
|
const endOfLineOrEndOfComment = /(?:$|\*\/)/.source;
|
|
223902
223902
|
const messageRemainder = /(?:.*?)/.source;
|
|
223903
223903
|
const messagePortion = "(" + literals + messageRemainder + ")";
|
|
@@ -225273,8 +225273,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
225273
225273
|
}
|
|
225274
225274
|
function getFixes(context) {
|
|
225275
225275
|
const diagnostics = getDiagnostics(context);
|
|
225276
|
-
const
|
|
225277
|
-
return flatMap(
|
|
225276
|
+
const registrations2 = errorCodeToFixes.get(String(context.errorCode));
|
|
225277
|
+
return flatMap(registrations2, (f) => map(f.getCodeActions(context), removeFixIdIfFixAllUnavailable(f, diagnostics)));
|
|
225278
225278
|
}
|
|
225279
225279
|
function getAllFixes(context) {
|
|
225280
225280
|
return fixIdToRegistration.get(cast(context.fixId, isString)).getAllCodeActions(context);
|
|
@@ -262727,18 +262727,18 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
262727
262727
|
/**
|
|
262728
262728
|
* This is to watch whenever files are added or removed to the wildcard directories
|
|
262729
262729
|
*/
|
|
262730
|
-
watchWildcardDirectory(directory, flags, configFileName,
|
|
262730
|
+
watchWildcardDirectory(directory, flags, configFileName, config2) {
|
|
262731
262731
|
let watcher = this.watchFactory.watchDirectory(
|
|
262732
262732
|
directory,
|
|
262733
262733
|
(fileOrDirectory) => this.onWildCardDirectoryWatcherInvoke(
|
|
262734
262734
|
directory,
|
|
262735
262735
|
configFileName,
|
|
262736
|
-
|
|
262736
|
+
config2,
|
|
262737
262737
|
result,
|
|
262738
262738
|
fileOrDirectory
|
|
262739
262739
|
),
|
|
262740
262740
|
flags,
|
|
262741
|
-
this.getWatchOptionsFromProjectWatchOptions(
|
|
262741
|
+
this.getWatchOptionsFromProjectWatchOptions(config2.parsedCommandLine.watchOptions, getDirectoryPath(configFileName)),
|
|
262742
262742
|
WatchType.WildcardDirectory,
|
|
262743
262743
|
configFileName
|
|
262744
262744
|
);
|
|
@@ -262759,9 +262759,9 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
262759
262759
|
};
|
|
262760
262760
|
return result;
|
|
262761
262761
|
}
|
|
262762
|
-
onWildCardDirectoryWatcherInvoke(directory, configFileName,
|
|
262762
|
+
onWildCardDirectoryWatcherInvoke(directory, configFileName, config2, wildCardWatcher, fileOrDirectory) {
|
|
262763
262763
|
const fileOrDirectoryPath = this.toPath(fileOrDirectory);
|
|
262764
|
-
const fsResult =
|
|
262764
|
+
const fsResult = config2.cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
|
|
262765
262765
|
if (getBaseFileName(fileOrDirectoryPath) === "package.json" && !isInsideNodeModules(fileOrDirectoryPath) && (fsResult && fsResult.fileExists || !fsResult && this.host.fileExists(fileOrDirectory))) {
|
|
262766
262766
|
const file = this.getNormalizedAbsolutePath(fileOrDirectory);
|
|
262767
262767
|
this.logger.info(`Config: ${configFileName} Detected new package.json: ${file}`);
|
|
@@ -262779,15 +262779,15 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
262779
262779
|
configFileName,
|
|
262780
262780
|
extraFileExtensions: this.hostConfiguration.extraFileExtensions,
|
|
262781
262781
|
currentDirectory: this.currentDirectory,
|
|
262782
|
-
options:
|
|
262783
|
-
program: (configuredProjectForConfig == null ? void 0 : configuredProjectForConfig.getCurrentProgram()) ||
|
|
262782
|
+
options: config2.parsedCommandLine.options,
|
|
262783
|
+
program: (configuredProjectForConfig == null ? void 0 : configuredProjectForConfig.getCurrentProgram()) || config2.parsedCommandLine.fileNames,
|
|
262784
262784
|
useCaseSensitiveFileNames: this.host.useCaseSensitiveFileNames,
|
|
262785
262785
|
writeLog: (s) => this.logger.info(s),
|
|
262786
262786
|
toPath: (s) => this.toPath(s),
|
|
262787
262787
|
getScriptKind: configuredProjectForConfig ? ((fileName) => configuredProjectForConfig.getScriptKind(fileName)) : void 0
|
|
262788
262788
|
})) return;
|
|
262789
|
-
if (
|
|
262790
|
-
|
|
262789
|
+
if (config2.updateLevel !== 2) config2.updateLevel = 1;
|
|
262790
|
+
config2.projects.forEach((watchWildcardDirectories, projectCanonicalPath) => {
|
|
262791
262791
|
var _a3;
|
|
262792
262792
|
if (!watchWildcardDirectories) return;
|
|
262793
262793
|
const project = this.getConfiguredProjectByCanonicalConfigFilePath(projectCanonicalPath);
|
|
@@ -263251,9 +263251,9 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
263251
263251
|
/** Caches the configFilename for script info or ancestor of open script info */
|
|
263252
263252
|
setConfigFileNameForFileInCache(info, configFileName) {
|
|
263253
263253
|
if (!this.openFiles.has(info.path)) return;
|
|
263254
|
-
const
|
|
263254
|
+
const config2 = configFileName || false;
|
|
263255
263255
|
if (!isAncestorConfigFileInfo(info)) {
|
|
263256
|
-
this.configFileForOpenFiles.set(info.path,
|
|
263256
|
+
this.configFileForOpenFiles.set(info.path, config2);
|
|
263257
263257
|
} else {
|
|
263258
263258
|
let configFileForOpenFile = this.configFileForOpenFiles.get(info.path);
|
|
263259
263259
|
if (!configFileForOpenFile || isString(configFileForOpenFile)) {
|
|
@@ -263262,7 +263262,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
263262
263262
|
configFileForOpenFile = (/* @__PURE__ */ new Map()).set(false, configFileForOpenFile)
|
|
263263
263263
|
);
|
|
263264
263264
|
}
|
|
263265
|
-
configFileForOpenFile.set(info.fileName,
|
|
263265
|
+
configFileForOpenFile.set(info.fileName, config2);
|
|
263266
263266
|
}
|
|
263267
263267
|
}
|
|
263268
263268
|
/**
|
|
@@ -263585,22 +263585,22 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
263585
263585
|
return configFileExistenceInfo;
|
|
263586
263586
|
}
|
|
263587
263587
|
/** @internal */
|
|
263588
|
-
watchWildcards(configFileName, { exists, config }, forProject) {
|
|
263589
|
-
|
|
263588
|
+
watchWildcards(configFileName, { exists, config: config2 }, forProject) {
|
|
263589
|
+
config2.projects.set(forProject.canonicalConfigFilePath, true);
|
|
263590
263590
|
if (exists) {
|
|
263591
|
-
if (
|
|
263592
|
-
|
|
263591
|
+
if (config2.watchedDirectories && !config2.watchedDirectoriesStale) return;
|
|
263592
|
+
config2.watchedDirectoriesStale = false;
|
|
263593
263593
|
updateWatchingWildcardDirectories(
|
|
263594
|
-
|
|
263595
|
-
|
|
263594
|
+
config2.watchedDirectories || (config2.watchedDirectories = /* @__PURE__ */ new Map()),
|
|
263595
|
+
config2.parsedCommandLine.wildcardDirectories,
|
|
263596
263596
|
// Create new directory watcher
|
|
263597
|
-
(directory, flags) => this.watchWildcardDirectory(directory, flags, configFileName,
|
|
263597
|
+
(directory, flags) => this.watchWildcardDirectory(directory, flags, configFileName, config2)
|
|
263598
263598
|
);
|
|
263599
263599
|
} else {
|
|
263600
|
-
|
|
263601
|
-
if (!
|
|
263602
|
-
clearMap(
|
|
263603
|
-
|
|
263600
|
+
config2.watchedDirectoriesStale = false;
|
|
263601
|
+
if (!config2.watchedDirectories) return;
|
|
263602
|
+
clearMap(config2.watchedDirectories, closeFileWatcherOf);
|
|
263603
|
+
config2.watchedDirectories = void 0;
|
|
263604
263604
|
}
|
|
263605
263605
|
}
|
|
263606
263606
|
/** @internal */
|
|
@@ -263700,11 +263700,11 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
263700
263700
|
* @internal
|
|
263701
263701
|
*/
|
|
263702
263702
|
reloadFileNamesOfConfiguredProject(project) {
|
|
263703
|
-
const
|
|
263704
|
-
project.updateErrorOnNoInputFiles(
|
|
263703
|
+
const config2 = this.reloadFileNamesOfParsedConfig(project.getConfigFilePath(), this.configFileExistenceInfoCache.get(project.canonicalConfigFilePath).config);
|
|
263704
|
+
project.updateErrorOnNoInputFiles(config2);
|
|
263705
263705
|
this.updateNonInferredProjectFiles(
|
|
263706
263706
|
project,
|
|
263707
|
-
|
|
263707
|
+
config2.fileNames.concat(project.getExternalFiles(
|
|
263708
263708
|
1
|
|
263709
263709
|
/* RootNamesAndUpdate */
|
|
263710
263710
|
)),
|
|
@@ -263713,23 +263713,23 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
263713
263713
|
project.markAsDirty();
|
|
263714
263714
|
return project.updateGraph();
|
|
263715
263715
|
}
|
|
263716
|
-
reloadFileNamesOfParsedConfig(configFileName,
|
|
263717
|
-
if (
|
|
263716
|
+
reloadFileNamesOfParsedConfig(configFileName, config2) {
|
|
263717
|
+
if (config2.updateLevel === void 0) return config2.parsedCommandLine;
|
|
263718
263718
|
Debug.assert(
|
|
263719
|
-
|
|
263719
|
+
config2.updateLevel === 1
|
|
263720
263720
|
/* RootNamesAndUpdate */
|
|
263721
263721
|
);
|
|
263722
|
-
const configFileSpecs =
|
|
263722
|
+
const configFileSpecs = config2.parsedCommandLine.options.configFile.configFileSpecs;
|
|
263723
263723
|
const fileNames = getFileNamesFromConfigSpecs(
|
|
263724
263724
|
configFileSpecs,
|
|
263725
263725
|
getDirectoryPath(configFileName),
|
|
263726
|
-
|
|
263727
|
-
|
|
263726
|
+
config2.parsedCommandLine.options,
|
|
263727
|
+
config2.cachedDirectoryStructureHost,
|
|
263728
263728
|
this.hostConfiguration.extraFileExtensions
|
|
263729
263729
|
);
|
|
263730
|
-
|
|
263731
|
-
|
|
263732
|
-
return
|
|
263730
|
+
config2.parsedCommandLine = { ...config2.parsedCommandLine, fileNames };
|
|
263731
|
+
config2.updateLevel = void 0;
|
|
263732
|
+
return config2.parsedCommandLine;
|
|
263733
263733
|
}
|
|
263734
263734
|
/** @internal */
|
|
263735
263735
|
setFileNamesOfAutoImportProviderOrAuxillaryProject(project, fileNames) {
|
|
@@ -264735,14 +264735,14 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
264735
264735
|
reloadedProjects
|
|
264736
264736
|
);
|
|
264737
264737
|
}
|
|
264738
|
-
isMatchedByConfig(configFileName,
|
|
264739
|
-
if (
|
|
264738
|
+
isMatchedByConfig(configFileName, config2, info) {
|
|
264739
|
+
if (config2.fileNames.some((rootName) => this.toPath(rootName) === info.path)) return true;
|
|
264740
264740
|
if (isSupportedSourceFileName(
|
|
264741
264741
|
info.fileName,
|
|
264742
|
-
|
|
264742
|
+
config2.options,
|
|
264743
264743
|
this.hostConfiguration.extraFileExtensions
|
|
264744
264744
|
)) return false;
|
|
264745
|
-
const { validatedFilesSpec, validatedIncludeSpecs, validatedExcludeSpecs } =
|
|
264745
|
+
const { validatedFilesSpec, validatedIncludeSpecs, validatedExcludeSpecs } = config2.options.configFile.configFileSpecs;
|
|
264746
264746
|
const basePath = toNormalizedPath(getNormalizedAbsolutePath(getDirectoryPath(configFileName), this.currentDirectory));
|
|
264747
264747
|
if (validatedFilesSpec == null ? void 0 : validatedFilesSpec.some((fileSpec) => this.toPath(getNormalizedAbsolutePath(fileSpec, basePath)) === info.path)) return true;
|
|
264748
264748
|
if (!(validatedIncludeSpecs == null ? void 0 : validatedIncludeSpecs.length)) return false;
|
|
@@ -264959,7 +264959,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
264959
264959
|
this.removeOrphanScriptInfos();
|
|
264960
264960
|
}
|
|
264961
264961
|
tryInvokeWildCardDirectories(info) {
|
|
264962
|
-
this.configFileExistenceInfoCache.forEach((configFileExistenceInfo,
|
|
264962
|
+
this.configFileExistenceInfoCache.forEach((configFileExistenceInfo, config2) => {
|
|
264963
264963
|
var _a3, _b;
|
|
264964
264964
|
if (!((_a3 = configFileExistenceInfo.config) == null ? void 0 : _a3.parsedCommandLine) || contains(
|
|
264965
264965
|
configFileExistenceInfo.config.parsedCommandLine.fileNames,
|
|
@@ -264970,10 +264970,10 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
264970
264970
|
}
|
|
264971
264971
|
(_b = configFileExistenceInfo.config.watchedDirectories) == null ? void 0 : _b.forEach((watcher, directory) => {
|
|
264972
264972
|
if (containsPath(directory, info.fileName, !this.host.useCaseSensitiveFileNames)) {
|
|
264973
|
-
this.logger.info(`Invoking ${
|
|
264973
|
+
this.logger.info(`Invoking ${config2}:: wildcard for open scriptInfo:: ${info.fileName}`);
|
|
264974
264974
|
this.onWildCardDirectoryWatcherInvoke(
|
|
264975
264975
|
directory,
|
|
264976
|
-
|
|
264976
|
+
config2,
|
|
264977
264977
|
configFileExistenceInfo.config,
|
|
264978
264978
|
watcher.watcher,
|
|
264979
264979
|
info.fileName
|
|
@@ -265661,8 +265661,8 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
265661
265661
|
}
|
|
265662
265662
|
};
|
|
265663
265663
|
}
|
|
265664
|
-
function isConfigFile(
|
|
265665
|
-
return
|
|
265664
|
+
function isConfigFile(config2) {
|
|
265665
|
+
return config2.kind !== void 0;
|
|
265666
265666
|
}
|
|
265667
265667
|
function printProjectWithoutFileNames(project) {
|
|
265668
265668
|
project.print(
|
|
@@ -268366,7 +268366,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
268366
268366
|
}
|
|
268367
268367
|
}
|
|
268368
268368
|
});
|
|
268369
|
-
(_a3 = result.seenConfigs) == null ? void 0 : _a3.forEach((
|
|
268369
|
+
(_a3 = result.seenConfigs) == null ? void 0 : _a3.forEach((config2) => (notMatchedByConfig ?? (notMatchedByConfig = [])).push(config2));
|
|
268370
268370
|
return {
|
|
268371
268371
|
notMatchedByConfig,
|
|
268372
268372
|
notInProject,
|
|
@@ -272790,7 +272790,7 @@ var require_path_browserify = __commonJS({
|
|
|
272790
272790
|
assertPath(path3);
|
|
272791
272791
|
return path3.length > 0 && path3.charCodeAt(0) === 47;
|
|
272792
272792
|
},
|
|
272793
|
-
join: function
|
|
272793
|
+
join: function join22() {
|
|
272794
272794
|
if (arguments.length === 0)
|
|
272795
272795
|
return ".";
|
|
272796
272796
|
var joined;
|
|
@@ -273665,7 +273665,7 @@ var require_scan = __commonJS({
|
|
|
273665
273665
|
var require_parse = __commonJS({
|
|
273666
273666
|
"node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js"(exports, module) {
|
|
273667
273667
|
"use strict";
|
|
273668
|
-
var
|
|
273668
|
+
var constants4 = require_constants();
|
|
273669
273669
|
var utils = require_utils();
|
|
273670
273670
|
var {
|
|
273671
273671
|
MAX_LENGTH,
|
|
@@ -273673,7 +273673,7 @@ var require_parse = __commonJS({
|
|
|
273673
273673
|
REGEX_NON_SPECIAL_CHARS,
|
|
273674
273674
|
REGEX_SPECIAL_CHARS_BACKREF,
|
|
273675
273675
|
REPLACEMENTS
|
|
273676
|
-
} =
|
|
273676
|
+
} = constants4;
|
|
273677
273677
|
var expandRange = (args, options) => {
|
|
273678
273678
|
if (typeof options.expandRange === "function") {
|
|
273679
273679
|
return options.expandRange(...args, options);
|
|
@@ -273879,7 +273879,7 @@ var require_parse = __commonJS({
|
|
|
273879
273879
|
if (options.maxExtglobRecursion === false) {
|
|
273880
273880
|
return { risky: false };
|
|
273881
273881
|
}
|
|
273882
|
-
const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion :
|
|
273882
|
+
const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants4.DEFAULT_MAX_EXTGLOB_RECURSION;
|
|
273883
273883
|
const branches = splitTopLevel(body).map((branch) => branch.trim());
|
|
273884
273884
|
if (branches.length > 1) {
|
|
273885
273885
|
if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) {
|
|
@@ -273911,8 +273911,8 @@ var require_parse = __commonJS({
|
|
|
273911
273911
|
const bos = { type: "bos", value: "", output: opts.prepend || "" };
|
|
273912
273912
|
const tokens = [bos];
|
|
273913
273913
|
const capture = opts.capture ? "" : "?:";
|
|
273914
|
-
const PLATFORM_CHARS =
|
|
273915
|
-
const EXTGLOB_CHARS =
|
|
273914
|
+
const PLATFORM_CHARS = constants4.globChars(opts.windows);
|
|
273915
|
+
const EXTGLOB_CHARS = constants4.extglobChars(PLATFORM_CHARS);
|
|
273916
273916
|
const {
|
|
273917
273917
|
DOT_LITERAL,
|
|
273918
273918
|
PLUS_LITERAL,
|
|
@@ -274607,7 +274607,7 @@ var require_parse = __commonJS({
|
|
|
274607
274607
|
NO_DOTS_SLASH,
|
|
274608
274608
|
STAR,
|
|
274609
274609
|
START_ANCHOR
|
|
274610
|
-
} =
|
|
274610
|
+
} = constants4.globChars(opts.windows);
|
|
274611
274611
|
const nodot = opts.dot ? NO_DOTS : NO_DOT;
|
|
274612
274612
|
const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
|
|
274613
274613
|
const capture = opts.capture ? "" : "?:";
|
|
@@ -274665,7 +274665,7 @@ var require_picomatch = __commonJS({
|
|
|
274665
274665
|
var scan = require_scan();
|
|
274666
274666
|
var parse2 = require_parse();
|
|
274667
274667
|
var utils = require_utils();
|
|
274668
|
-
var
|
|
274668
|
+
var constants4 = require_constants();
|
|
274669
274669
|
var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
|
|
274670
274670
|
var picomatch = (glob2, options, returnState = false) => {
|
|
274671
274671
|
if (Array.isArray(glob2)) {
|
|
@@ -274793,7 +274793,7 @@ var require_picomatch = __commonJS({
|
|
|
274793
274793
|
return /$^/;
|
|
274794
274794
|
}
|
|
274795
274795
|
};
|
|
274796
|
-
picomatch.constants =
|
|
274796
|
+
picomatch.constants = constants4;
|
|
274797
274797
|
module.exports = picomatch;
|
|
274798
274798
|
}
|
|
274799
274799
|
});
|
|
@@ -278624,7 +278624,7 @@ ${nodeLocation}` : message;
|
|
|
278624
278624
|
}
|
|
278625
278625
|
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
278626
278626
|
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
278627
|
-
var
|
|
278627
|
+
var descriptor2 = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
278628
278628
|
var _, done = false;
|
|
278629
278629
|
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
278630
278630
|
var context = {};
|
|
@@ -278634,19 +278634,19 @@ ${nodeLocation}` : message;
|
|
|
278634
278634
|
if (done) throw new TypeError("Cannot add initializers after decoration has completed");
|
|
278635
278635
|
extraInitializers.push(accept(f || null));
|
|
278636
278636
|
};
|
|
278637
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get:
|
|
278637
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor2.get, set: descriptor2.set } : descriptor2[key], context);
|
|
278638
278638
|
if (kind === "accessor") {
|
|
278639
278639
|
if (result === void 0) continue;
|
|
278640
278640
|
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
278641
|
-
if (_ = accept(result.get))
|
|
278642
|
-
if (_ = accept(result.set))
|
|
278641
|
+
if (_ = accept(result.get)) descriptor2.get = _;
|
|
278642
|
+
if (_ = accept(result.set)) descriptor2.set = _;
|
|
278643
278643
|
if (_ = accept(result.init)) initializers.unshift(_);
|
|
278644
278644
|
} else if (_ = accept(result)) {
|
|
278645
278645
|
if (kind === "field") initializers.unshift(_);
|
|
278646
|
-
else
|
|
278646
|
+
else descriptor2[key] = _;
|
|
278647
278647
|
}
|
|
278648
278648
|
}
|
|
278649
|
-
if (target) Object.defineProperty(target, contextIn.name,
|
|
278649
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor2);
|
|
278650
278650
|
done = true;
|
|
278651
278651
|
}
|
|
278652
278652
|
function __runInitializers(thisArg, initializers, value) {
|
|
@@ -288151,7 +288151,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
288151
288151
|
}
|
|
288152
288152
|
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
288153
288153
|
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
288154
|
-
var
|
|
288154
|
+
var descriptor2 = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
288155
288155
|
var _, done = false;
|
|
288156
288156
|
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
288157
288157
|
var context = {};
|
|
@@ -288161,19 +288161,19 @@ Node text: ${this.#forgottenText}`;
|
|
|
288161
288161
|
if (done) throw new TypeError("Cannot add initializers after decoration has completed");
|
|
288162
288162
|
extraInitializers.push(accept(f || null));
|
|
288163
288163
|
};
|
|
288164
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get:
|
|
288164
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor2.get, set: descriptor2.set } : descriptor2[key], context);
|
|
288165
288165
|
if (kind === "accessor") {
|
|
288166
288166
|
if (result === void 0) continue;
|
|
288167
288167
|
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
288168
|
-
if (_ = accept(result.get))
|
|
288169
|
-
if (_ = accept(result.set))
|
|
288168
|
+
if (_ = accept(result.get)) descriptor2.get = _;
|
|
288169
|
+
if (_ = accept(result.set)) descriptor2.set = _;
|
|
288170
288170
|
if (_ = accept(result.init)) initializers.unshift(_);
|
|
288171
288171
|
} else if (_ = accept(result)) {
|
|
288172
288172
|
if (kind === "field") initializers.unshift(_);
|
|
288173
|
-
else
|
|
288173
|
+
else descriptor2[key] = _;
|
|
288174
288174
|
}
|
|
288175
288175
|
}
|
|
288176
|
-
if (target) Object.defineProperty(target, contextIn.name,
|
|
288176
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor2);
|
|
288177
288177
|
done = true;
|
|
288178
288178
|
}
|
|
288179
288179
|
function __runInitializers(thisArg, initializers, value) {
|
|
@@ -303239,7 +303239,7 @@ import {
|
|
|
303239
303239
|
writeSync as writeSync2
|
|
303240
303240
|
} from "node:fs";
|
|
303241
303241
|
import { homedir as homedir16 } from "node:os";
|
|
303242
|
-
import { dirname as dirname10, isAbsolute as isAbsolute8, join as
|
|
303242
|
+
import { dirname as dirname10, isAbsolute as isAbsolute8, join as join18, relative as relative2, resolve as resolve12 } from "node:path";
|
|
303243
303243
|
|
|
303244
303244
|
// packages/cli/src/service-version.ts
|
|
303245
303245
|
var OmniusVersionError = class extends Error {
|
|
@@ -303294,11 +303294,41 @@ function compareOmniusVersions(left, right) {
|
|
|
303294
303294
|
return 0;
|
|
303295
303295
|
}
|
|
303296
303296
|
|
|
303297
|
+
// packages/cli/src/npm-recovery-retention.ts
|
|
303298
|
+
import { lstat, readdir, readFile, rm } from "node:fs/promises";
|
|
303299
|
+
import { join as join16 } from "node:path";
|
|
303300
|
+
var RECOVERY_NAME = /^\.omnius-update-recovery-[a-f0-9-]{36}$/;
|
|
303301
|
+
async function pruneStaleUpdateRecoveries(modulesRoot, options = {}) {
|
|
303302
|
+
const keep = Math.max(0, options.keep ?? 1);
|
|
303303
|
+
const minAgeMs = options.minAgeMs ?? 60 * 60 * 1e3;
|
|
303304
|
+
const now = options.now ?? Date.now();
|
|
303305
|
+
const uid = process.getuid?.();
|
|
303306
|
+
const candidates = [];
|
|
303307
|
+
for (const name of await readdir(modulesRoot)) {
|
|
303308
|
+
if (!RECOVERY_NAME.test(name)) continue;
|
|
303309
|
+
const path3 = join16(modulesRoot, name);
|
|
303310
|
+
if (options.exclude?.has(path3)) continue;
|
|
303311
|
+
const metadata = await lstat(path3).catch(() => void 0);
|
|
303312
|
+
if (!metadata?.isDirectory() || metadata.isSymbolicLink() || uid !== void 0 && metadata.uid !== uid) continue;
|
|
303313
|
+
if (now - metadata.mtimeMs < minAgeMs) continue;
|
|
303314
|
+
const manifest = await readFile(join16(path3, "package.json"), "utf8").then((text2) => JSON.parse(text2), () => null);
|
|
303315
|
+
candidates.push({ path: path3, mtimeMs: metadata.mtimeMs, restorable: manifest?.name === "omnius" && typeof manifest.version === "string" });
|
|
303316
|
+
}
|
|
303317
|
+
const kept = new Set(candidates.filter((item) => item.restorable).sort((a, b) => b.mtimeMs - a.mtimeMs).slice(0, keep).map((item) => item.path));
|
|
303318
|
+
const removed = [];
|
|
303319
|
+
for (const item of candidates) {
|
|
303320
|
+
if (kept.has(item.path)) continue;
|
|
303321
|
+
await rm(item.path, { recursive: true, force: true });
|
|
303322
|
+
removed.push(item.path);
|
|
303323
|
+
}
|
|
303324
|
+
return removed;
|
|
303325
|
+
}
|
|
303326
|
+
|
|
303297
303327
|
// packages/cli/src/npm-install-recovery.ts
|
|
303298
303328
|
import { createHash as createHash2, randomUUID as randomUUID2 } from "node:crypto";
|
|
303299
303329
|
import { closeSync as closeSync3, constants, fstatSync, fsyncSync, ftruncateSync, lstatSync, openSync as openSync3, readFileSync as readFileSync7, readdirSync, readSync as readSync2, unlinkSync as unlinkSync3, writeFileSync as writeFileSync5 } from "node:fs";
|
|
303300
|
-
import { chmod, cp, lstat, mkdir, readdir, realpath, rename, rm } from "node:fs/promises";
|
|
303301
|
-
import { basename as basename8, dirname as dirname9, isAbsolute as isAbsolute7, join as
|
|
303330
|
+
import { chmod, cp, lstat as lstat2, mkdir, readdir as readdir2, realpath, rename, rm as rm2 } from "node:fs/promises";
|
|
303331
|
+
import { basename as basename8, dirname as dirname9, isAbsolute as isAbsolute7, join as join17, resolve as resolve11 } from "node:path";
|
|
303302
303332
|
var NpmInstallBusyError = class extends Error {
|
|
303303
303333
|
code = "NPM_INSTALL_BUSY";
|
|
303304
303334
|
constructor(message = "Another installer owns this npm modules directory. Wait for it to settle before retrying.") {
|
|
@@ -303324,7 +303354,7 @@ function parseNpmRenameCollision(diagnostic) {
|
|
|
303324
303354
|
}
|
|
303325
303355
|
function retiredNpmPackagePath(packagePath) {
|
|
303326
303356
|
const suffix = createHash2("sha1").update(packagePath).digest("base64").replace(/[^a-zA-Z0-9]/g, "").slice(0, 8);
|
|
303327
|
-
return
|
|
303357
|
+
return join17(dirname9(packagePath), `.${basename8(packagePath)}-${suffix}`);
|
|
303328
303358
|
}
|
|
303329
303359
|
function assertNotCancelled(signal) {
|
|
303330
303360
|
signal?.throwIfAborted();
|
|
@@ -303340,7 +303370,7 @@ function assertOwnedDirectory(metadata, label) {
|
|
|
303340
303370
|
async function recoverNpmRetirementCollision(collision, modulesRoot, options = {}) {
|
|
303341
303371
|
assertNotCancelled(options.signal);
|
|
303342
303372
|
if (collision.code !== "ENOTEMPTY" && collision.code !== "EEXIST" || collision.syscall !== "rename" || !isAbsolute7(modulesRoot) || /[\x00-\x1f\x7f]/.test(modulesRoot + collision.path + collision.dest)) return null;
|
|
303343
|
-
const root = resolve11(modulesRoot), source =
|
|
303373
|
+
const root = resolve11(modulesRoot), source = join17(root, "omnius"), retired = retiredNpmPackagePath(source);
|
|
303344
303374
|
if (collision.path !== source || collision.dest !== retired || dirname9(retired) !== root) return null;
|
|
303345
303375
|
return prepareNpmRetirementSlot(root, options);
|
|
303346
303376
|
}
|
|
@@ -303352,30 +303382,30 @@ async function prepareNpmRetirementSlot(modulesRoot, options = {}) {
|
|
|
303352
303382
|
};
|
|
303353
303383
|
current();
|
|
303354
303384
|
if (!isAbsolute7(modulesRoot) || /[\x00-\x1f\x7f]/.test(modulesRoot)) throw new Error("npm modules root must be an absolute directory path.");
|
|
303355
|
-
const root = resolve11(modulesRoot), retired = retiredNpmPackagePath(
|
|
303356
|
-
const rootBefore = await
|
|
303385
|
+
const root = resolve11(modulesRoot), retired = retiredNpmPackagePath(join17(root, "omnius"));
|
|
303386
|
+
const rootBefore = await lstat2(root);
|
|
303357
303387
|
assertOwnedDirectory(rootBefore, "global modules root");
|
|
303358
303388
|
const canonicalRoot = await realpath(root);
|
|
303359
303389
|
let before;
|
|
303360
303390
|
try {
|
|
303361
|
-
before = await
|
|
303391
|
+
before = await lstat2(retired);
|
|
303362
303392
|
} catch (error) {
|
|
303363
303393
|
if (error.code === "ENOENT") return null;
|
|
303364
303394
|
throw error;
|
|
303365
303395
|
}
|
|
303366
303396
|
assertOwnedDirectory(before, "retired package");
|
|
303367
|
-
const backup =
|
|
303397
|
+
const backup = join17(root, `.omnius-update-recovery-${randomUUID2()}`);
|
|
303368
303398
|
const receipt = { modulesRoot: root, retiredPath: retired, backupPath: backup, device: before.dev, inode: before.ino };
|
|
303369
303399
|
current();
|
|
303370
303400
|
await options.onPrepare?.({ ...receipt });
|
|
303371
303401
|
current();
|
|
303372
303402
|
try {
|
|
303373
|
-
await
|
|
303403
|
+
await lstat2(backup);
|
|
303374
303404
|
throw new Error("The planned npm retirement backup is already occupied; no directory was moved.");
|
|
303375
303405
|
} catch (error) {
|
|
303376
303406
|
if (error.code !== "ENOENT") throw error;
|
|
303377
303407
|
}
|
|
303378
|
-
const [rootNow, candidateNow] = await Promise.all([
|
|
303408
|
+
const [rootNow, candidateNow] = await Promise.all([lstat2(root), lstat2(retired)]);
|
|
303379
303409
|
if (!sameIdentity(rootBefore, rootNow) || !sameIdentity(before, candidateNow) || await realpath(root) !== canonicalRoot) throw new Error("npm retirement directory changed before recovery; no cleanup was attempted.");
|
|
303380
303410
|
assertOwnedDirectory(rootNow, "global modules root");
|
|
303381
303411
|
assertOwnedDirectory(candidateNow, "retired package");
|
|
@@ -303481,12 +303511,12 @@ function provedAbsent(owner) {
|
|
|
303481
303511
|
async function acquireNpmInstallLease(modulesRoot, options = {}) {
|
|
303482
303512
|
assertNotCancelled(options.signal);
|
|
303483
303513
|
if (!isAbsolute7(modulesRoot) || /[\x00-\x1f\x7f]/.test(modulesRoot) || options.operationId !== void 0 && !/^[a-zA-Z0-9_-]{1,128}$/.test(options.operationId)) throw new Error("Invalid npm install scope.");
|
|
303484
|
-
const logical = resolve11(modulesRoot), logicalMetadata = await
|
|
303514
|
+
const logical = resolve11(modulesRoot), logicalMetadata = await lstat2(logical);
|
|
303485
303515
|
assertOwnedDirectory(logicalMetadata, "global modules root");
|
|
303486
|
-
const root = await realpath(logical), rootMetadata = await
|
|
303516
|
+
const root = await realpath(logical), rootMetadata = await lstat2(root);
|
|
303487
303517
|
assertOwnedDirectory(rootMetadata, "global modules root");
|
|
303488
303518
|
if (!sameIdentity(logicalMetadata, rootMetadata)) throw new Error("npm modules root changed before installer admission.");
|
|
303489
|
-
const lockPath =
|
|
303519
|
+
const lockPath = join17(root, ".omnius-install.lock"), guardPath = lockPath + ".guard", nonce = randomUUID2();
|
|
303490
303520
|
const assertRoot = () => {
|
|
303491
303521
|
const current = lstatSync(root);
|
|
303492
303522
|
assertOwnedDirectory(current, "global modules root");
|
|
@@ -303628,21 +303658,21 @@ function inspectRuntimeDirectory(canonical, root) {
|
|
|
303628
303658
|
const before = lstatSync(canonical);
|
|
303629
303659
|
assertOwnedDirectory(lstatSync(root), "global modules root");
|
|
303630
303660
|
assertOwnedDirectory(before, "Omnius package");
|
|
303631
|
-
assertOwnedDirectory(lstatSync(
|
|
303661
|
+
assertOwnedDirectory(lstatSync(join17(canonical, "dist")), "Omnius runtime");
|
|
303632
303662
|
const files = {};
|
|
303633
|
-
for (const file of REQUIRED_OMNIUS_RUNTIME_FILES) files[file] = hashOwnedFile(
|
|
303634
|
-
const manifest = JSON.parse(readFileSync7(
|
|
303663
|
+
for (const file of REQUIRED_OMNIUS_RUNTIME_FILES) files[file] = hashOwnedFile(join17(canonical, file));
|
|
303664
|
+
const manifest = JSON.parse(readFileSync7(join17(canonical, "package.json"), "utf8"));
|
|
303635
303665
|
if (manifest.name !== "omnius" || typeof manifest.version !== "string" || !/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/.test(manifest.version))
|
|
303636
303666
|
throw new Error("Omnius runtime manifest is invalid.");
|
|
303637
303667
|
const binTarget = typeof manifest.bin === "string" ? manifest.bin : manifest.bin?.omnius;
|
|
303638
303668
|
if (typeof binTarget !== "string" || !/^[A-Za-z0-9_./-]+$/.test(binTarget) || isAbsolute7(binTarget) || binTarget.split("/").some((part) => !part || part === ".." || part === "."))
|
|
303639
303669
|
throw new Error("Omnius runtime manifest has no safe declared omnius executable.");
|
|
303640
|
-
for (const directory of binTarget.split("/").slice(0, -1).reduce((paths, part) => [...paths,
|
|
303670
|
+
for (const directory of binTarget.split("/").slice(0, -1).reduce((paths, part) => [...paths, join17(paths.at(-1) ?? canonical, part)], []))
|
|
303641
303671
|
assertOwnedDirectory(lstatSync(directory), "Omnius executable directory");
|
|
303642
|
-
files[binTarget] ??= hashOwnedFile(
|
|
303643
|
-
if (!readFileSync7(
|
|
303672
|
+
files[binTarget] ??= hashOwnedFile(join17(canonical, binTarget));
|
|
303673
|
+
if (!readFileSync7(join17(canonical, "dist/update-worker.js"), "utf8").includes("omnius.update-worker-bootstrap.v2"))
|
|
303644
303674
|
throw new Error("Omnius runtime has no compatible update worker bootstrap.");
|
|
303645
|
-
if (hashOwnedFile(
|
|
303675
|
+
if (hashOwnedFile(join17(canonical, "package.json")) !== files["package.json"] || !sameIdentity(before, lstatSync(canonical)))
|
|
303646
303676
|
throw new Error("Omnius package changed during runtime verification.");
|
|
303647
303677
|
return {
|
|
303648
303678
|
modulesRoot: root,
|
|
@@ -303656,7 +303686,7 @@ function inspectRuntimeDirectory(canonical, root) {
|
|
|
303656
303686
|
};
|
|
303657
303687
|
}
|
|
303658
303688
|
async function preserveVerifiedNpmInstallation(snapshot, options) {
|
|
303659
|
-
const root = resolve11(snapshot.modulesRoot), source =
|
|
303689
|
+
const root = resolve11(snapshot.modulesRoot), source = join17(root, "omnius");
|
|
303660
303690
|
const current = () => {
|
|
303661
303691
|
options.lease.assertOwnedForRecovery();
|
|
303662
303692
|
options.assertOwned();
|
|
@@ -303666,18 +303696,18 @@ async function preserveVerifiedNpmInstallation(snapshot, options) {
|
|
|
303666
303696
|
if (root !== options.lease.modulesRoot) throw new Error("Package preservation belongs to a different npm lease.");
|
|
303667
303697
|
const before = inspectNpmRuntimeInstallation(source);
|
|
303668
303698
|
if (before.device !== snapshot.device || before.inode !== snapshot.inode || before.packageHash !== snapshot.packageHash || JSON.stringify(before.files) !== JSON.stringify(snapshot.files)) throw new Error("Prior runtime changed before preservation.");
|
|
303669
|
-
const backupPath =
|
|
303699
|
+
const backupPath = join17(root, `.omnius-update-recovery-${randomUUID2()}`);
|
|
303670
303700
|
await mkdir(backupPath, { mode: 448 });
|
|
303671
|
-
const metadata = await
|
|
303701
|
+
const metadata = await lstat2(backupPath);
|
|
303672
303702
|
const backup = { modulesRoot: root, retiredPath: retiredNpmPackagePath(source), backupPath, device: metadata.dev, inode: metadata.ino };
|
|
303673
303703
|
await options.onPrepare?.({ ...backup });
|
|
303674
303704
|
assertNotCancelled(options.signal);
|
|
303675
303705
|
current();
|
|
303676
|
-
for (const name of await
|
|
303706
|
+
for (const name of await readdir2(source)) {
|
|
303677
303707
|
assertNotCancelled(options.signal);
|
|
303678
303708
|
current();
|
|
303679
|
-
if (!sameIdentity(metadata, await
|
|
303680
|
-
await cp(
|
|
303709
|
+
if (!sameIdentity(metadata, await lstat2(backupPath))) throw new Error("Package preservation directory changed during copying.");
|
|
303710
|
+
await cp(join17(source, name), join17(backupPath, name), {
|
|
303681
303711
|
recursive: true,
|
|
303682
303712
|
errorOnExist: true,
|
|
303683
303713
|
force: false,
|
|
@@ -303703,14 +303733,14 @@ async function preserveVerifiedNpmInstallation(snapshot, options) {
|
|
|
303703
303733
|
return { backup, installation };
|
|
303704
303734
|
}
|
|
303705
303735
|
async function restoreVerifiedNpmInstallation(snapshot, options) {
|
|
303706
|
-
const root = resolve11(snapshot.modulesRoot), canonical =
|
|
303736
|
+
const root = resolve11(snapshot.modulesRoot), canonical = join17(root, "omnius");
|
|
303707
303737
|
const current = () => {
|
|
303708
303738
|
options.lease.assertOwnedForRecovery();
|
|
303709
303739
|
options.assertOwned();
|
|
303710
303740
|
};
|
|
303711
303741
|
current();
|
|
303712
303742
|
if (root !== options.lease.modulesRoot || !isAbsolute7(snapshot.modulesRoot)) throw new Error("Package recovery belongs to a different npm lease.");
|
|
303713
|
-
const rootBefore = await
|
|
303743
|
+
const rootBefore = await lstat2(root);
|
|
303714
303744
|
assertOwnedDirectory(rootBefore, "global modules root");
|
|
303715
303745
|
const validPath = (path3) => path3 === canonical || path3 === retiredNpmPackagePath(canonical) || options.backups?.some((backup) => backup.modulesRoot === root && backup.backupPath === path3 && dirname9(path3) === root && /^\.omnius-update-recovery-[a-f0-9-]{36}$/.test(basename8(path3)));
|
|
303716
303746
|
const matches = (path3) => {
|
|
@@ -303724,11 +303754,11 @@ async function restoreVerifiedNpmInstallation(snapshot, options) {
|
|
|
303724
303754
|
}
|
|
303725
303755
|
if (metadata.dev !== snapshot.device || metadata.ino !== snapshot.inode) return false;
|
|
303726
303756
|
assertOwnedDirectory(metadata, "prior Omnius package");
|
|
303727
|
-
assertOwnedDirectory(lstatSync(
|
|
303757
|
+
assertOwnedDirectory(lstatSync(join17(path3, "dist")), "prior Omnius runtime");
|
|
303728
303758
|
for (const [file, digest] of Object.entries(snapshot.files)) {
|
|
303729
|
-
if (!/^[A-Za-z0-9_./-]+$/.test(file) || isAbsolute7(file) || file.split("/").some((part) => !part || part === "." || part === "..") || hashOwnedFile(
|
|
303759
|
+
if (!/^[A-Za-z0-9_./-]+$/.test(file) || isAbsolute7(file) || file.split("/").some((part) => !part || part === "." || part === "..") || hashOwnedFile(join17(path3, file)) !== digest) throw new Error("Prior Omnius runtime changed; restoration was held.");
|
|
303730
303760
|
}
|
|
303731
|
-
for (const directory of snapshot.binTarget.split("/").slice(0, -1).reduce((paths, part) => [...paths,
|
|
303761
|
+
for (const directory of snapshot.binTarget.split("/").slice(0, -1).reduce((paths, part) => [...paths, join17(paths.at(-1) ?? path3, part)], []))
|
|
303732
303762
|
assertOwnedDirectory(lstatSync(directory), "prior Omnius executable directory");
|
|
303733
303763
|
return true;
|
|
303734
303764
|
};
|
|
@@ -303744,20 +303774,20 @@ async function restoreVerifiedNpmInstallation(snapshot, options) {
|
|
|
303744
303774
|
if (source === canonical) return recovery;
|
|
303745
303775
|
let partial;
|
|
303746
303776
|
try {
|
|
303747
|
-
partial = await
|
|
303777
|
+
partial = await lstat2(canonical);
|
|
303748
303778
|
assertOwnedDirectory(partial, "failed Omnius replacement");
|
|
303749
303779
|
} catch (error) {
|
|
303750
303780
|
if (error.code !== "ENOENT") throw error;
|
|
303751
303781
|
}
|
|
303752
|
-
if (partial) recovery.partialPath =
|
|
303782
|
+
if (partial) recovery.partialPath = join17(root, `.omnius-update-recovery-${randomUUID2()}`);
|
|
303753
303783
|
await options.onPrepare?.({ ...recovery });
|
|
303754
303784
|
current();
|
|
303755
|
-
if (!sameIdentity(rootBefore, await
|
|
303785
|
+
if (!sameIdentity(rootBefore, await lstat2(root)) || !matches(source)) throw new Error("npm recovery identity changed before restoration.");
|
|
303756
303786
|
if (partial) {
|
|
303757
|
-
const now = await
|
|
303787
|
+
const now = await lstat2(canonical);
|
|
303758
303788
|
if (!sameIdentity(partial, now)) throw new Error("Failed Omnius replacement changed before preservation.");
|
|
303759
303789
|
try {
|
|
303760
|
-
await
|
|
303790
|
+
await lstat2(recovery.partialPath);
|
|
303761
303791
|
throw new Error("Failed-package preservation path is already occupied.");
|
|
303762
303792
|
} catch (error) {
|
|
303763
303793
|
if (error.code !== "ENOENT") throw error;
|
|
@@ -303767,7 +303797,7 @@ async function restoreVerifiedNpmInstallation(snapshot, options) {
|
|
|
303767
303797
|
}
|
|
303768
303798
|
current();
|
|
303769
303799
|
try {
|
|
303770
|
-
await
|
|
303800
|
+
await lstat2(canonical);
|
|
303771
303801
|
throw new Error("Canonical Omnius path changed before restoration.");
|
|
303772
303802
|
} catch (error) {
|
|
303773
303803
|
if (error.code !== "ENOENT") throw error;
|
|
@@ -303790,17 +303820,17 @@ async function restoreVerifiedNpmInstallation(snapshot, options) {
|
|
|
303790
303820
|
}
|
|
303791
303821
|
async function removeVerifiedNpmRetirementBackup(backup) {
|
|
303792
303822
|
const root = resolve11(backup.modulesRoot);
|
|
303793
|
-
if (!isAbsolute7(backup.modulesRoot) || dirname9(backup.backupPath) !== root || !/^\.omnius-update-recovery-[a-f0-9-]{36}$/.test(basename8(backup.backupPath)) || backup.retiredPath !== retiredNpmPackagePath(
|
|
303823
|
+
if (!isAbsolute7(backup.modulesRoot) || dirname9(backup.backupPath) !== root || !/^\.omnius-update-recovery-[a-f0-9-]{36}$/.test(basename8(backup.backupPath)) || backup.retiredPath !== retiredNpmPackagePath(join17(root, "omnius"))) {
|
|
303794
303824
|
throw new Error("Refusing cleanup outside the preserved npm retirement directory.");
|
|
303795
303825
|
}
|
|
303796
|
-
const rootMetadata = await
|
|
303826
|
+
const rootMetadata = await lstat2(root);
|
|
303797
303827
|
assertOwnedDirectory(rootMetadata, "global modules root");
|
|
303798
|
-
const metadata = await
|
|
303828
|
+
const metadata = await lstat2(backup.backupPath);
|
|
303799
303829
|
assertOwnedDirectory(metadata, "preserved retirement directory");
|
|
303800
303830
|
if (metadata.dev !== backup.device || metadata.ino !== backup.inode) {
|
|
303801
303831
|
throw new Error("Preserved npm retirement directory identity changed; its contents were retained.");
|
|
303802
303832
|
}
|
|
303803
|
-
await
|
|
303833
|
+
await rm2(backup.backupPath, { recursive: true });
|
|
303804
303834
|
}
|
|
303805
303835
|
|
|
303806
303836
|
// packages/cli/src/update-service.ts
|
|
@@ -303814,7 +303844,7 @@ var UpdateOwnershipBusyError = class extends Error {
|
|
|
303814
303844
|
};
|
|
303815
303845
|
function cancellationPath(operationId, paths) {
|
|
303816
303846
|
if (!/^[a-zA-Z0-9_-]{1,128}$/.test(operationId)) throw new Error("Invalid update operation identity");
|
|
303817
|
-
return
|
|
303847
|
+
return join18(paths.stateDir, `cancel-${operationId}.json`);
|
|
303818
303848
|
}
|
|
303819
303849
|
function watchUpdateCancellation(operationId, paths = resolveUpdatePaths()) {
|
|
303820
303850
|
const controller = new AbortController();
|
|
@@ -303842,16 +303872,16 @@ function watchUpdateCancellation(operationId, paths = resolveUpdatePaths()) {
|
|
|
303842
303872
|
} };
|
|
303843
303873
|
}
|
|
303844
303874
|
function resolveUpdatePaths(env = process.env, platform2 = process.platform, home = homedir16()) {
|
|
303845
|
-
const stateBase = platform2 === "win32" ? env["LOCALAPPDATA"] ||
|
|
303846
|
-
const cacheBase = platform2 === "win32" ? env["LOCALAPPDATA"] ||
|
|
303847
|
-
const stateDir =
|
|
303848
|
-
const cacheDir =
|
|
303875
|
+
const stateBase = platform2 === "win32" ? env["LOCALAPPDATA"] || join18(home, "AppData", "Local") : platform2 === "darwin" ? join18(home, "Library", "Application Support") : env["XDG_STATE_HOME"] || join18(home, ".local", "state");
|
|
303876
|
+
const cacheBase = platform2 === "win32" ? env["LOCALAPPDATA"] || join18(home, "AppData", "Local") : platform2 === "darwin" ? join18(home, "Library", "Caches") : env["XDG_CACHE_HOME"] || join18(home, ".cache");
|
|
303877
|
+
const stateDir = join18(stateBase, platform2 === "win32" ? "Omnius" : "omnius", "update");
|
|
303878
|
+
const cacheDir = join18(cacheBase, platform2 === "win32" ? "Omnius" : "omnius", "npm-update");
|
|
303849
303879
|
return {
|
|
303850
303880
|
stateDir,
|
|
303851
303881
|
cacheDir,
|
|
303852
|
-
stateFile:
|
|
303853
|
-
lockFile:
|
|
303854
|
-
logFile:
|
|
303882
|
+
stateFile: join18(stateDir, "state.json"),
|
|
303883
|
+
lockFile: join18(stateDir, "update.lock"),
|
|
303884
|
+
logFile: join18(stateDir, "update.log")
|
|
303855
303885
|
};
|
|
303856
303886
|
}
|
|
303857
303887
|
function ensurePrivateDirectories(paths) {
|
|
@@ -304032,7 +304062,7 @@ function assertExactUpdateTarget(targetVersion, fromVersion) {
|
|
|
304032
304062
|
}
|
|
304033
304063
|
function npmCandidates(execPath = process.execPath) {
|
|
304034
304064
|
const nodeDir = dirname10(execPath);
|
|
304035
|
-
return process.platform === "win32" ? [
|
|
304065
|
+
return process.platform === "win32" ? [join18(nodeDir, "npm.cmd"), join18(nodeDir, "npm.exe"), "npm.cmd", "npm"] : [join18(nodeDir, "npm"), "/usr/local/bin/npm", "/usr/bin/npm", "npm"];
|
|
304036
304066
|
}
|
|
304037
304067
|
function runnableCommand(candidate) {
|
|
304038
304068
|
return candidate.includes("/") || candidate.includes("\\") ? existsSync7(candidate) : true;
|
|
@@ -304160,10 +304190,10 @@ async function runUpdateCommand(command, args, options = {}) {
|
|
|
304160
304190
|
}
|
|
304161
304191
|
var runCommand = runUpdateCommand;
|
|
304162
304192
|
function globalPackageCandidates(prefix) {
|
|
304163
|
-
return process.platform === "win32" ? [
|
|
304193
|
+
return process.platform === "win32" ? [join18(prefix, "node_modules", "omnius", "package.json"), join18(prefix, "omnius", "package.json")] : [join18(prefix, "lib", "node_modules", "omnius", "package.json"), join18(prefix, "node_modules", "omnius", "package.json")];
|
|
304164
304194
|
}
|
|
304165
304195
|
function globalExecutableCandidates(prefix) {
|
|
304166
|
-
return process.platform === "win32" ? [
|
|
304196
|
+
return process.platform === "win32" ? [join18(prefix, "omnius.cmd"), join18(prefix, "omnius.exe"), join18(prefix, "bin", "omnius.cmd")] : [join18(prefix, "bin", "omnius")];
|
|
304167
304197
|
}
|
|
304168
304198
|
async function inspectGlobalOmniusInstall(expectedVersion, options = {}) {
|
|
304169
304199
|
const npmPath = options.npmPath ?? resolveNpmPath();
|
|
@@ -304255,7 +304285,7 @@ async function installGlobalPackageStreaming(input) {
|
|
|
304255
304285
|
}
|
|
304256
304286
|
function restoreOmniusExecutableLink(prefix, installation) {
|
|
304257
304287
|
const executable = globalExecutableCandidates(prefix)[0];
|
|
304258
|
-
const target =
|
|
304288
|
+
const target = join18(installation.modulesRoot, "omnius", installation.binTarget);
|
|
304259
304289
|
if (process.platform === "win32") {
|
|
304260
304290
|
if (!existsSync7(executable)) throw new Error("The restored Omnius Windows executable shim is missing.");
|
|
304261
304291
|
return;
|
|
@@ -304362,14 +304392,19 @@ async function runVerifiedUpdateTransaction(initial, dependencies, paths = resol
|
|
|
304362
304392
|
const rootProbe = await runCommand(npmPath, ["root", "-g"], { env, cwd, timeout: 1e4, signal: dependencies.signal });
|
|
304363
304393
|
throwIfCancelled();
|
|
304364
304394
|
const npmRoot = rootProbe.stdout.trim();
|
|
304365
|
-
const expectedRoot = process.platform === "win32" ?
|
|
304395
|
+
const expectedRoot = process.platform === "win32" ? join18(npmPrefix, "node_modules") : join18(npmPrefix, "lib", "node_modules");
|
|
304366
304396
|
if (rootProbe.status !== 0 || !isAbsolute8(npmRoot) || resolve12(npmRoot) !== resolve12(expectedRoot)) throw new Error("Could not verify the selected npm global modules directory; no package was changed.");
|
|
304367
304397
|
state = await transition(state, { npm_path: npmPath, npm_prefix: npmPrefix, npm_modules_root: npmRoot }, paths);
|
|
304368
304398
|
installLease = await acquireNpmInstallLease(npmRoot, { signal: dependencies.signal, operationId: state.operation_id });
|
|
304369
304399
|
state = await transition(state, { npm_modules_root: installLease.modulesRoot }, paths);
|
|
304370
304400
|
assertOwned();
|
|
304371
304401
|
try {
|
|
304372
|
-
|
|
304402
|
+
await pruneStaleUpdateRecoveries(installLease.modulesRoot);
|
|
304403
|
+
} catch (error) {
|
|
304404
|
+
state = await transition(state, { npm_cleanup_warning: error instanceof Error ? error.message : String(error) }, paths);
|
|
304405
|
+
}
|
|
304406
|
+
try {
|
|
304407
|
+
previousInstallation = inspectNpmRuntimeInstallation(join18(installLease.modulesRoot, "omnius"));
|
|
304373
304408
|
} catch {
|
|
304374
304409
|
}
|
|
304375
304410
|
await preserveRetirement("before_install");
|
|
@@ -304478,6 +304513,13 @@ async function runVerifiedUpdateTransaction(initial, dependencies, paths = resol
|
|
|
304478
304513
|
);
|
|
304479
304514
|
}
|
|
304480
304515
|
daemonQuiesced = false;
|
|
304516
|
+
if ((dependencies.stabilityWindowMs ?? 0) > 0) {
|
|
304517
|
+
await new Promise((resolve13) => setTimeout(resolve13, dependencies.stabilityWindowMs));
|
|
304518
|
+
throwIfCancelled();
|
|
304519
|
+
const settled = await dependencies.observeDaemon();
|
|
304520
|
+
if (settled?.bootVersion !== target || settled.bootPackageHash !== evidence.packageHash)
|
|
304521
|
+
throw new Error(`The updated daemon did not stay up for ${Math.round(dependencies.stabilityWindowMs / 1e3)}s after restart (observed ${settled?.bootVersion ?? "unreachable"})`);
|
|
304522
|
+
}
|
|
304481
304523
|
state = await transition(state, {
|
|
304482
304524
|
phase: "runtime_verified",
|
|
304483
304525
|
daemon_version: daemon.bootVersion,
|
|
@@ -304538,6 +304580,7 @@ async function runVerifiedUpdateTransaction(initial, dependencies, paths = resol
|
|
|
304538
304580
|
let recoveryNote;
|
|
304539
304581
|
let packageRecoveryNote;
|
|
304540
304582
|
let restoredPackageVerified = false;
|
|
304583
|
+
let rolledBack = false;
|
|
304541
304584
|
if (installStarted && installerSettled && !packageVerified && installLease && previousInstallation) {
|
|
304542
304585
|
state = await transition(state, { phase: "recovering" }, paths);
|
|
304543
304586
|
const journal = (recovery) => ({
|
|
@@ -304590,11 +304633,60 @@ async function runVerifiedUpdateTransaction(initial, dependencies, paths = resol
|
|
|
304590
304633
|
packageRecoveryNote = `Package recovery could not be verified: ${detail}`;
|
|
304591
304634
|
}
|
|
304592
304635
|
}
|
|
304593
|
-
if (
|
|
304636
|
+
if (!cancelled && packageVerified && installerSettled && installLease && previousInstallation && previousInstallationCopy) {
|
|
304637
|
+
state = await transition(state, { phase: "rolling_back" }, paths);
|
|
304638
|
+
try {
|
|
304639
|
+
const recovered = await restoreVerifiedNpmInstallation(previousInstallationCopy, {
|
|
304640
|
+
lease: installLease,
|
|
304641
|
+
backups: retirementBackups,
|
|
304642
|
+
assertOwned: assertRecoveryOwned,
|
|
304643
|
+
async onPrepare(recovery) {
|
|
304644
|
+
state = await transition(state, { package_recovery: {
|
|
304645
|
+
status: "planned",
|
|
304646
|
+
version: recovery.version,
|
|
304647
|
+
package_hash: recovery.packageHash,
|
|
304648
|
+
source_path: recovery.sourcePath,
|
|
304649
|
+
...recovery.partialPath ? { partial_path: recovery.partialPath } : {}
|
|
304650
|
+
} }, paths);
|
|
304651
|
+
}
|
|
304652
|
+
});
|
|
304653
|
+
if (!recovered) throw new Error("the preserved prior installation was no longer available");
|
|
304654
|
+
assertRecoveryOwned();
|
|
304655
|
+
restoreOmniusExecutableLink(state.npm_prefix, previousInstallation);
|
|
304656
|
+
const verified = await inspectGlobalOmniusInstall(previousInstallation.version, { npmPath, env, cwd });
|
|
304657
|
+
if (verified.packageHash !== previousInstallation.packageHash) throw new Error("the restored manifest differs from the pre-install verification");
|
|
304658
|
+
restoredPackageVerified = rolledBack = true;
|
|
304659
|
+
state = await transition(state, {
|
|
304660
|
+
rolled_back_to: verified.installedVersion,
|
|
304661
|
+
package_recovery: {
|
|
304662
|
+
status: "restored",
|
|
304663
|
+
version: recovered.version,
|
|
304664
|
+
package_hash: recovered.packageHash,
|
|
304665
|
+
source_path: recovered.sourcePath,
|
|
304666
|
+
...recovered.partialPath ? { partial_path: recovered.partialPath } : {}
|
|
304667
|
+
},
|
|
304668
|
+
npm_recoveries: state.npm_recoveries?.map((item) => item.backup_path === recovered.sourcePath ? { ...item, status: "restored" } : item),
|
|
304669
|
+
package_json_path: verified.packageJsonPath,
|
|
304670
|
+
global_executable: verified.executablePath,
|
|
304671
|
+
installed_version: verified.installedVersion,
|
|
304672
|
+
executable_version: verified.executableVersion,
|
|
304673
|
+
installed_package_hash: verified.packageHash
|
|
304674
|
+
}, paths);
|
|
304675
|
+
packageRecoveryNote = `Rolled back to the previous verified Omnius v${verified.installedVersion}.${recovered.partialPath ? ` The failed v${target} files remain at ${recovered.partialPath}.` : ""}`;
|
|
304676
|
+
} catch (rollbackError) {
|
|
304677
|
+
const detail = rollbackError instanceof Error ? rollbackError.message : String(rollbackError);
|
|
304678
|
+
state = await transition(state, { package_recovery: { ...state.package_recovery, status: "failed", error: detail } }, paths);
|
|
304679
|
+
packageRecoveryNote = `Rollback could not be verified: ${detail}`;
|
|
304680
|
+
}
|
|
304681
|
+
}
|
|
304682
|
+
if ((daemonQuiesced || rolledBack) && dependencies.recoverDaemon && installerSettled && (!installStarted || packageVerified || restoredPackageVerified)) {
|
|
304594
304683
|
state = await transition(state, { phase: "recovering" }, paths);
|
|
304595
304684
|
try {
|
|
304596
304685
|
const recovered = await dependencies.recoverDaemon();
|
|
304597
304686
|
recoveryNote = recovered ? "The daemon was restarted after the interrupted update." : "The daemon could not be recovered automatically after the failed update.";
|
|
304687
|
+
if (rolledBack && state.tray_was_running && dependencies.restartTray && state.global_executable) {
|
|
304688
|
+
recoveryNote += await dependencies.restartTray(state.global_executable).catch(() => false) ? " The indicator was relaunched on the restored version." : " The indicator could not be relaunched on the restored version.";
|
|
304689
|
+
}
|
|
304598
304690
|
} catch (recoveryError) {
|
|
304599
304691
|
recoveryNote = `Daemon recovery failed: ${recoveryError instanceof Error ? recoveryError.message : String(recoveryError)}`;
|
|
304600
304692
|
}
|
|
@@ -304628,20 +304720,31 @@ async function runVerifiedUpdateTransaction(initial, dependencies, paths = resol
|
|
|
304628
304720
|
// packages/cli/src/tray.ts
|
|
304629
304721
|
import { spawn as spawn4 } from "node:child_process";
|
|
304630
304722
|
import {
|
|
304631
|
-
closeSync as
|
|
304723
|
+
closeSync as closeSync6,
|
|
304632
304724
|
chmodSync as chmodSync2,
|
|
304633
|
-
existsSync as
|
|
304634
|
-
mkdirSync as
|
|
304635
|
-
openSync as
|
|
304636
|
-
readFileSync as
|
|
304725
|
+
existsSync as existsSync9,
|
|
304726
|
+
mkdirSync as mkdirSync8,
|
|
304727
|
+
openSync as openSync6,
|
|
304728
|
+
readFileSync as readFileSync10,
|
|
304637
304729
|
realpathSync as realpathSync2,
|
|
304638
|
-
renameSync as
|
|
304639
|
-
unlinkSync as
|
|
304640
|
-
writeFileSync as
|
|
304730
|
+
renameSync as renameSync7,
|
|
304731
|
+
unlinkSync as unlinkSync6,
|
|
304732
|
+
writeFileSync as writeFileSync8,
|
|
304641
304733
|
writeSync as writeSync3
|
|
304642
304734
|
} from "node:fs";
|
|
304643
|
-
import { homedir as
|
|
304644
|
-
import { basename as basename9, delimiter, dirname as dirname11, join as
|
|
304735
|
+
import { homedir as homedir18, tmpdir as tmpdir6 } from "node:os";
|
|
304736
|
+
import { basename as basename9, delimiter, dirname as dirname11, join as join21 } from "node:path";
|
|
304737
|
+
|
|
304738
|
+
// packages/cli/src/config-home.ts
|
|
304739
|
+
import { homedir as homedir17 } from "node:os";
|
|
304740
|
+
import { join as join19 } from "node:path";
|
|
304741
|
+
function omniusConfigDir(...parts) {
|
|
304742
|
+
return join19(
|
|
304743
|
+
process.env["OMNIUS_CONFIG_HOME"] ?? homedir17(),
|
|
304744
|
+
".omnius",
|
|
304745
|
+
...parts
|
|
304746
|
+
);
|
|
304747
|
+
}
|
|
304645
304748
|
|
|
304646
304749
|
// packages/cli/src/tray-menu.ts
|
|
304647
304750
|
import { execFile as execFile4 } from "node:child_process";
|
|
@@ -304668,30 +304771,686 @@ var run = promisify4(execFile4);
|
|
|
304668
304771
|
init_daemon();
|
|
304669
304772
|
|
|
304670
304773
|
// packages/cli/src/updater.ts
|
|
304671
|
-
import { join as
|
|
304774
|
+
import { join as join20 } from "node:path";
|
|
304672
304775
|
var UPDATE_CHECK_INTERVAL_MS = 60 * 1e3;
|
|
304673
304776
|
var CACHE_DIR = resolveUpdatePaths().stateDir;
|
|
304674
|
-
var CACHE_FILE =
|
|
304777
|
+
var CACHE_FILE = join20(CACHE_DIR, "registry-check.json");
|
|
304778
|
+
|
|
304779
|
+
// packages/backend-vllm/dist/providerRegistry.js
|
|
304780
|
+
var CHAT_CAPABILITIES = [
|
|
304781
|
+
"chat",
|
|
304782
|
+
"streaming",
|
|
304783
|
+
"models",
|
|
304784
|
+
"tools",
|
|
304785
|
+
"structured-output"
|
|
304786
|
+
];
|
|
304787
|
+
var OPENAI_CAPABILITIES = [
|
|
304788
|
+
...CHAT_CAPABILITIES,
|
|
304789
|
+
"embeddings"
|
|
304790
|
+
];
|
|
304791
|
+
var bearerAuth = (required, keyPrefix, staticHeaders) => ({
|
|
304792
|
+
strategy: "bearer",
|
|
304793
|
+
required,
|
|
304794
|
+
...keyPrefix ? { keyPrefix } : {},
|
|
304795
|
+
...staticHeaders ? { staticHeaders } : {}
|
|
304796
|
+
});
|
|
304797
|
+
var descriptor = (value) => Object.freeze({
|
|
304798
|
+
...value,
|
|
304799
|
+
aliases: Object.freeze([...value.aliases]),
|
|
304800
|
+
paths: Object.freeze({ ...value.paths }),
|
|
304801
|
+
auth: Object.freeze({
|
|
304802
|
+
...value.auth,
|
|
304803
|
+
...value.auth.staticHeaders ? { staticHeaders: Object.freeze({ ...value.auth.staticHeaders }) } : {}
|
|
304804
|
+
}),
|
|
304805
|
+
capabilities: Object.freeze([...value.capabilities]),
|
|
304806
|
+
...value.availability ? { availability: Object.freeze({ ...value.availability }) } : {}
|
|
304807
|
+
});
|
|
304808
|
+
var registrations = [
|
|
304809
|
+
{
|
|
304810
|
+
descriptor: descriptor({
|
|
304811
|
+
id: "mesh",
|
|
304812
|
+
aliases: [],
|
|
304813
|
+
label: "Sponsored inference mesh",
|
|
304814
|
+
protocol: "openai-chat",
|
|
304815
|
+
local: false,
|
|
304816
|
+
apiPrefix: "/v1",
|
|
304817
|
+
paths: { chat: "/v1/chat/completions", models: "/v1/models" },
|
|
304818
|
+
auth: bearerAuth(true),
|
|
304819
|
+
capabilities: CHAT_CAPABILITIES,
|
|
304820
|
+
defaultUrl: "http://127.0.0.1:11436/v1",
|
|
304821
|
+
description: "Opt-in remote sponsor inference through your private authenticated mesh gateway."
|
|
304822
|
+
}),
|
|
304823
|
+
// A loopback port is not provider identity. Select this transport explicitly.
|
|
304824
|
+
match: () => false
|
|
304825
|
+
},
|
|
304826
|
+
{
|
|
304827
|
+
descriptor: descriptor({
|
|
304828
|
+
id: "anthropic",
|
|
304829
|
+
aliases: ["claude"],
|
|
304830
|
+
label: "Anthropic (Claude)",
|
|
304831
|
+
protocol: "anthropic-messages",
|
|
304832
|
+
local: false,
|
|
304833
|
+
apiPrefix: "/v1",
|
|
304834
|
+
paths: {
|
|
304835
|
+
chat: "/v1/messages",
|
|
304836
|
+
models: "/v1/models"
|
|
304837
|
+
},
|
|
304838
|
+
auth: {
|
|
304839
|
+
strategy: "anthropic-api-key",
|
|
304840
|
+
required: true,
|
|
304841
|
+
keyPrefix: "sk-ant-",
|
|
304842
|
+
staticHeaders: { "anthropic-version": "2023-06-01" }
|
|
304843
|
+
},
|
|
304844
|
+
capabilities: CHAT_CAPABILITIES,
|
|
304845
|
+
defaultUrl: "https://api.anthropic.com/v1",
|
|
304846
|
+
apiKeyUrl: "https://console.anthropic.com/settings/keys",
|
|
304847
|
+
docsUrl: "https://docs.anthropic.com/en/api",
|
|
304848
|
+
description: "Claude through Anthropic's native Messages API."
|
|
304849
|
+
}),
|
|
304850
|
+
match: (url) => url.hostname.toLowerCase() === "api.anthropic.com"
|
|
304851
|
+
},
|
|
304852
|
+
{
|
|
304853
|
+
descriptor: descriptor({
|
|
304854
|
+
id: "gemini",
|
|
304855
|
+
aliases: ["google", "google-ai"],
|
|
304856
|
+
label: "Google Gemini",
|
|
304857
|
+
protocol: "openai-chat",
|
|
304858
|
+
local: false,
|
|
304859
|
+
apiPrefix: "/v1beta/openai",
|
|
304860
|
+
paths: {
|
|
304861
|
+
chat: "/v1beta/openai/chat/completions",
|
|
304862
|
+
models: "/v1beta/openai/models",
|
|
304863
|
+
embeddings: "/v1beta/openai/embeddings"
|
|
304864
|
+
},
|
|
304865
|
+
auth: bearerAuth(true, void 0, {
|
|
304866
|
+
"x-goog-api-client": "omnius/{version}"
|
|
304867
|
+
}),
|
|
304868
|
+
capabilities: OPENAI_CAPABILITIES,
|
|
304869
|
+
defaultUrl: "https://generativelanguage.googleapis.com/v1beta/openai",
|
|
304870
|
+
apiKeyUrl: "https://aistudio.google.com/app/apikey",
|
|
304871
|
+
docsUrl: "https://ai.google.dev/gemini-api/docs/openai",
|
|
304872
|
+
description: "Gemini through Google's official OpenAI-compatible API."
|
|
304873
|
+
}),
|
|
304874
|
+
match: (url) => url.hostname.toLowerCase() === "generativelanguage.googleapis.com"
|
|
304875
|
+
},
|
|
304876
|
+
{
|
|
304877
|
+
descriptor: descriptor({
|
|
304878
|
+
id: "openai",
|
|
304879
|
+
aliases: [],
|
|
304880
|
+
label: "OpenAI",
|
|
304881
|
+
protocol: "openai-chat",
|
|
304882
|
+
local: false,
|
|
304883
|
+
apiPrefix: "/v1",
|
|
304884
|
+
paths: {
|
|
304885
|
+
chat: "/v1/chat/completions",
|
|
304886
|
+
models: "/v1/models",
|
|
304887
|
+
embeddings: "/v1/embeddings"
|
|
304888
|
+
},
|
|
304889
|
+
auth: bearerAuth(true, "sk-"),
|
|
304890
|
+
capabilities: OPENAI_CAPABILITIES,
|
|
304891
|
+
defaultUrl: "https://api.openai.com/v1",
|
|
304892
|
+
apiKeyUrl: "https://platform.openai.com/api-keys",
|
|
304893
|
+
docsUrl: "https://platform.openai.com/docs/api-reference",
|
|
304894
|
+
description: "OpenAI API models."
|
|
304895
|
+
}),
|
|
304896
|
+
match: (url) => url.hostname.toLowerCase() === "api.openai.com"
|
|
304897
|
+
},
|
|
304898
|
+
{
|
|
304899
|
+
descriptor: descriptor({
|
|
304900
|
+
id: "openrouter",
|
|
304901
|
+
aliases: [],
|
|
304902
|
+
label: "OpenRouter",
|
|
304903
|
+
protocol: "openai-chat",
|
|
304904
|
+
local: false,
|
|
304905
|
+
apiPrefix: "/v1",
|
|
304906
|
+
paths: {
|
|
304907
|
+
chat: "/v1/chat/completions",
|
|
304908
|
+
models: "/v1/models",
|
|
304909
|
+
embeddings: "/v1/embeddings"
|
|
304910
|
+
},
|
|
304911
|
+
auth: bearerAuth(true, "sk-or-"),
|
|
304912
|
+
capabilities: OPENAI_CAPABILITIES,
|
|
304913
|
+
defaultUrl: "https://openrouter.ai/api/v1",
|
|
304914
|
+
apiKeyUrl: "https://openrouter.ai/keys",
|
|
304915
|
+
docsUrl: "https://openrouter.ai/docs",
|
|
304916
|
+
description: "OpenAI-compatible routing across hosted models."
|
|
304917
|
+
}),
|
|
304918
|
+
match: (url) => url.hostname.toLowerCase() === "openrouter.ai"
|
|
304919
|
+
},
|
|
304920
|
+
{
|
|
304921
|
+
descriptor: descriptor({
|
|
304922
|
+
id: "groq",
|
|
304923
|
+
aliases: [],
|
|
304924
|
+
label: "Groq",
|
|
304925
|
+
protocol: "openai-chat",
|
|
304926
|
+
local: false,
|
|
304927
|
+
apiPrefix: "/openai/v1",
|
|
304928
|
+
paths: {
|
|
304929
|
+
chat: "/openai/v1/chat/completions",
|
|
304930
|
+
models: "/openai/v1/models",
|
|
304931
|
+
embeddings: "/openai/v1/embeddings"
|
|
304932
|
+
},
|
|
304933
|
+
auth: bearerAuth(true, "gsk_"),
|
|
304934
|
+
capabilities: OPENAI_CAPABILITIES,
|
|
304935
|
+
defaultUrl: "https://api.groq.com/openai/v1",
|
|
304936
|
+
apiKeyUrl: "https://console.groq.com/keys",
|
|
304937
|
+
docsUrl: "https://console.groq.com/docs",
|
|
304938
|
+
description: "Groq OpenAI-compatible inference."
|
|
304939
|
+
}),
|
|
304940
|
+
match: (url) => url.hostname.toLowerCase() === "api.groq.com"
|
|
304941
|
+
},
|
|
304942
|
+
{
|
|
304943
|
+
descriptor: descriptor({
|
|
304944
|
+
id: "deepinfra",
|
|
304945
|
+
aliases: [],
|
|
304946
|
+
label: "DeepInfra",
|
|
304947
|
+
protocol: "openai-chat",
|
|
304948
|
+
local: false,
|
|
304949
|
+
apiPrefix: "/v1/openai",
|
|
304950
|
+
paths: {
|
|
304951
|
+
chat: "/v1/openai/chat/completions",
|
|
304952
|
+
models: "/v1/openai/models",
|
|
304953
|
+
embeddings: "/v1/openai/embeddings"
|
|
304954
|
+
},
|
|
304955
|
+
auth: bearerAuth(true),
|
|
304956
|
+
capabilities: OPENAI_CAPABILITIES,
|
|
304957
|
+
defaultUrl: "https://api.deepinfra.com/v1/openai",
|
|
304958
|
+
apiKeyUrl: "https://deepinfra.com/dash/api_keys",
|
|
304959
|
+
docsUrl: "https://deepinfra.com/docs/openai_api",
|
|
304960
|
+
description: "DeepInfra OpenAI-compatible hosted models."
|
|
304961
|
+
}),
|
|
304962
|
+
match: (url) => url.hostname.toLowerCase() === "api.deepinfra.com"
|
|
304963
|
+
},
|
|
304964
|
+
{
|
|
304965
|
+
descriptor: descriptor({
|
|
304966
|
+
id: "fireworks",
|
|
304967
|
+
aliases: ["fireworks-ai"],
|
|
304968
|
+
label: "Fireworks AI",
|
|
304969
|
+
protocol: "openai-chat",
|
|
304970
|
+
local: false,
|
|
304971
|
+
apiPrefix: "/inference/v1",
|
|
304972
|
+
paths: {
|
|
304973
|
+
chat: "/inference/v1/chat/completions",
|
|
304974
|
+
models: "/inference/v1/models",
|
|
304975
|
+
embeddings: "/inference/v1/embeddings"
|
|
304976
|
+
},
|
|
304977
|
+
auth: bearerAuth(true, "fw_"),
|
|
304978
|
+
capabilities: OPENAI_CAPABILITIES,
|
|
304979
|
+
defaultUrl: "https://api.fireworks.ai/inference/v1",
|
|
304980
|
+
apiKeyUrl: "https://fireworks.ai/account/api-keys",
|
|
304981
|
+
docsUrl: "https://docs.fireworks.ai",
|
|
304982
|
+
description: "Fireworks OpenAI-compatible inference."
|
|
304983
|
+
}),
|
|
304984
|
+
match: (url) => url.hostname.toLowerCase() === "api.fireworks.ai"
|
|
304985
|
+
},
|
|
304986
|
+
{
|
|
304987
|
+
descriptor: descriptor({
|
|
304988
|
+
id: "together",
|
|
304989
|
+
aliases: ["together-ai"],
|
|
304990
|
+
label: "Together AI",
|
|
304991
|
+
protocol: "openai-chat",
|
|
304992
|
+
local: false,
|
|
304993
|
+
apiPrefix: "/v1",
|
|
304994
|
+
paths: {
|
|
304995
|
+
chat: "/v1/chat/completions",
|
|
304996
|
+
models: "/v1/models",
|
|
304997
|
+
embeddings: "/v1/embeddings"
|
|
304998
|
+
},
|
|
304999
|
+
auth: bearerAuth(true),
|
|
305000
|
+
capabilities: OPENAI_CAPABILITIES,
|
|
305001
|
+
defaultUrl: "https://api.together.ai/v1",
|
|
305002
|
+
apiKeyUrl: "https://api.together.xyz/settings/api-keys",
|
|
305003
|
+
docsUrl: "https://docs.together.ai",
|
|
305004
|
+
description: "Together OpenAI-compatible inference."
|
|
305005
|
+
}),
|
|
305006
|
+
match: (url) => ["api.together.ai", "api.together.xyz"].includes(url.hostname.toLowerCase())
|
|
305007
|
+
},
|
|
305008
|
+
{
|
|
305009
|
+
descriptor: descriptor({
|
|
305010
|
+
id: "chutes",
|
|
305011
|
+
aliases: ["chutes-ai"],
|
|
305012
|
+
label: "Chutes AI",
|
|
305013
|
+
protocol: "openai-chat",
|
|
305014
|
+
local: false,
|
|
305015
|
+
apiPrefix: "/v1",
|
|
305016
|
+
paths: {
|
|
305017
|
+
chat: "/v1/chat/completions",
|
|
305018
|
+
models: "/v1/models",
|
|
305019
|
+
embeddings: "/v1/embeddings"
|
|
305020
|
+
},
|
|
305021
|
+
auth: bearerAuth(true, "cpk_"),
|
|
305022
|
+
capabilities: OPENAI_CAPABILITIES,
|
|
305023
|
+
defaultUrl: "https://llm.chutes.ai/v1",
|
|
305024
|
+
apiKeyUrl: "https://chutes.ai/app/api",
|
|
305025
|
+
docsUrl: "https://docs.chutes.ai",
|
|
305026
|
+
description: "Chutes OpenAI-compatible model endpoint."
|
|
305027
|
+
}),
|
|
305028
|
+
match: (url) => ["llm.chutes.ai", "chutes.ai"].includes(url.hostname.toLowerCase())
|
|
305029
|
+
},
|
|
305030
|
+
{
|
|
305031
|
+
descriptor: descriptor({
|
|
305032
|
+
id: "mistral",
|
|
305033
|
+
aliases: ["mistral-ai"],
|
|
305034
|
+
label: "Mistral AI",
|
|
305035
|
+
protocol: "openai-chat",
|
|
305036
|
+
local: false,
|
|
305037
|
+
apiPrefix: "/v1",
|
|
305038
|
+
paths: {
|
|
305039
|
+
chat: "/v1/chat/completions",
|
|
305040
|
+
models: "/v1/models",
|
|
305041
|
+
embeddings: "/v1/embeddings"
|
|
305042
|
+
},
|
|
305043
|
+
auth: bearerAuth(true),
|
|
305044
|
+
capabilities: OPENAI_CAPABILITIES,
|
|
305045
|
+
defaultUrl: "https://api.mistral.ai/v1",
|
|
305046
|
+
apiKeyUrl: "https://console.mistral.ai/api-keys",
|
|
305047
|
+
docsUrl: "https://docs.mistral.ai",
|
|
305048
|
+
description: "Mistral hosted model endpoint."
|
|
305049
|
+
}),
|
|
305050
|
+
match: (url) => url.hostname.toLowerCase() === "api.mistral.ai"
|
|
305051
|
+
},
|
|
305052
|
+
{
|
|
305053
|
+
descriptor: descriptor({
|
|
305054
|
+
id: "cerebras",
|
|
305055
|
+
aliases: [],
|
|
305056
|
+
label: "Cerebras",
|
|
305057
|
+
protocol: "openai-chat",
|
|
305058
|
+
local: false,
|
|
305059
|
+
apiPrefix: "/v1",
|
|
305060
|
+
paths: {
|
|
305061
|
+
chat: "/v1/chat/completions",
|
|
305062
|
+
models: "/v1/models",
|
|
305063
|
+
embeddings: "/v1/embeddings"
|
|
305064
|
+
},
|
|
305065
|
+
auth: bearerAuth(true, "csk-"),
|
|
305066
|
+
capabilities: OPENAI_CAPABILITIES,
|
|
305067
|
+
defaultUrl: "https://api.cerebras.ai/v1",
|
|
305068
|
+
apiKeyUrl: "https://cloud.cerebras.ai/platform",
|
|
305069
|
+
docsUrl: "https://inference-docs.cerebras.ai",
|
|
305070
|
+
description: "Cerebras OpenAI-compatible inference."
|
|
305071
|
+
}),
|
|
305072
|
+
match: (url) => url.hostname.toLowerCase() === "api.cerebras.ai"
|
|
305073
|
+
},
|
|
305074
|
+
{
|
|
305075
|
+
descriptor: descriptor({
|
|
305076
|
+
id: "sambanova",
|
|
305077
|
+
aliases: ["samba-nova"],
|
|
305078
|
+
label: "SambaNova",
|
|
305079
|
+
protocol: "openai-chat",
|
|
305080
|
+
local: false,
|
|
305081
|
+
apiPrefix: "/v1",
|
|
305082
|
+
paths: {
|
|
305083
|
+
chat: "/v1/chat/completions",
|
|
305084
|
+
models: "/v1/models",
|
|
305085
|
+
embeddings: "/v1/embeddings"
|
|
305086
|
+
},
|
|
305087
|
+
auth: bearerAuth(true),
|
|
305088
|
+
capabilities: OPENAI_CAPABILITIES,
|
|
305089
|
+
defaultUrl: "https://api.sambanova.ai/v1",
|
|
305090
|
+
apiKeyUrl: "https://cloud.sambanova.ai/apis",
|
|
305091
|
+
docsUrl: "https://docs.sambanova.ai",
|
|
305092
|
+
description: "SambaNova OpenAI-compatible inference."
|
|
305093
|
+
}),
|
|
305094
|
+
match: (url) => url.hostname.toLowerCase() === "api.sambanova.ai"
|
|
305095
|
+
},
|
|
305096
|
+
{
|
|
305097
|
+
descriptor: descriptor({
|
|
305098
|
+
id: "nvidia",
|
|
305099
|
+
aliases: ["nvidia-nim", "nim"],
|
|
305100
|
+
label: "NVIDIA NIM",
|
|
305101
|
+
protocol: "openai-chat",
|
|
305102
|
+
local: false,
|
|
305103
|
+
apiPrefix: "/v1",
|
|
305104
|
+
paths: {
|
|
305105
|
+
chat: "/v1/chat/completions",
|
|
305106
|
+
models: "/v1/models",
|
|
305107
|
+
embeddings: "/v1/embeddings"
|
|
305108
|
+
},
|
|
305109
|
+
auth: bearerAuth(true, "nvapi-"),
|
|
305110
|
+
capabilities: OPENAI_CAPABILITIES,
|
|
305111
|
+
defaultUrl: "https://integrate.api.nvidia.com/v1",
|
|
305112
|
+
apiKeyUrl: "https://build.nvidia.com",
|
|
305113
|
+
docsUrl: "https://docs.api.nvidia.com/nim",
|
|
305114
|
+
description: "NVIDIA-hosted NIM models."
|
|
305115
|
+
}),
|
|
305116
|
+
match: (url) => url.hostname.toLowerCase() === "integrate.api.nvidia.com"
|
|
305117
|
+
},
|
|
305118
|
+
{
|
|
305119
|
+
descriptor: descriptor({
|
|
305120
|
+
id: "hyperbolic",
|
|
305121
|
+
aliases: [],
|
|
305122
|
+
label: "Hyperbolic",
|
|
305123
|
+
protocol: "openai-chat",
|
|
305124
|
+
local: false,
|
|
305125
|
+
apiPrefix: "/v1",
|
|
305126
|
+
paths: {
|
|
305127
|
+
chat: "/v1/chat/completions",
|
|
305128
|
+
models: "/v1/models",
|
|
305129
|
+
embeddings: "/v1/embeddings"
|
|
305130
|
+
},
|
|
305131
|
+
auth: bearerAuth(true),
|
|
305132
|
+
capabilities: OPENAI_CAPABILITIES,
|
|
305133
|
+
defaultUrl: "https://api.hyperbolic.xyz/v1",
|
|
305134
|
+
apiKeyUrl: "https://app.hyperbolic.xyz/settings",
|
|
305135
|
+
docsUrl: "https://docs.hyperbolic.xyz",
|
|
305136
|
+
description: "Retired Hyperbolic serverless API. Explicit custom deployments require their own URL.",
|
|
305137
|
+
availability: { state: "retired", reason: "Hyperbolic's serverless inference API has been retired; old serverless models no longer accept requests, including with valid keys.", docsUrl: "https://www.hyperbolic.ai/docs/faq/inference-models" }
|
|
305138
|
+
}),
|
|
305139
|
+
match: (url) => url.hostname.toLowerCase() === "api.hyperbolic.xyz"
|
|
305140
|
+
},
|
|
305141
|
+
{
|
|
305142
|
+
descriptor: descriptor({
|
|
305143
|
+
id: "ollama",
|
|
305144
|
+
aliases: [],
|
|
305145
|
+
label: "Ollama (local)",
|
|
305146
|
+
protocol: "ollama",
|
|
305147
|
+
local: true,
|
|
305148
|
+
apiPrefix: "",
|
|
305149
|
+
paths: {
|
|
305150
|
+
chat: "/v1/chat/completions",
|
|
305151
|
+
nativeChat: "/api/chat",
|
|
305152
|
+
models: "/api/tags",
|
|
305153
|
+
embeddings: "/api/embed",
|
|
305154
|
+
health: "/api/tags"
|
|
305155
|
+
},
|
|
305156
|
+
auth: bearerAuth(false),
|
|
305157
|
+
capabilities: OPENAI_CAPABILITIES,
|
|
305158
|
+
defaultUrl: "http://127.0.0.1:11434",
|
|
305159
|
+
docsUrl: "https://docs.ollama.com/api",
|
|
305160
|
+
description: "Local Ollama runtime."
|
|
305161
|
+
}),
|
|
305162
|
+
match: (url) => url.port === "11434"
|
|
305163
|
+
},
|
|
305164
|
+
{
|
|
305165
|
+
descriptor: descriptor({
|
|
305166
|
+
id: "lmstudio",
|
|
305167
|
+
aliases: ["lm-studio"],
|
|
305168
|
+
label: "LM Studio (local)",
|
|
305169
|
+
protocol: "openai-chat",
|
|
305170
|
+
local: true,
|
|
305171
|
+
apiPrefix: "/v1",
|
|
305172
|
+
paths: {
|
|
305173
|
+
chat: "/v1/chat/completions",
|
|
305174
|
+
models: "/v1/models",
|
|
305175
|
+
embeddings: "/v1/embeddings"
|
|
305176
|
+
},
|
|
305177
|
+
auth: bearerAuth(false),
|
|
305178
|
+
capabilities: OPENAI_CAPABILITIES,
|
|
305179
|
+
defaultUrl: "http://127.0.0.1:1234/v1",
|
|
305180
|
+
docsUrl: "https://lmstudio.ai/docs",
|
|
305181
|
+
description: "Local LM Studio OpenAI-compatible server."
|
|
305182
|
+
}),
|
|
305183
|
+
match: (url) => url.port === "1234"
|
|
305184
|
+
},
|
|
305185
|
+
{
|
|
305186
|
+
descriptor: descriptor({
|
|
305187
|
+
id: "vllm",
|
|
305188
|
+
aliases: ["v-llm"],
|
|
305189
|
+
label: "vLLM (local)",
|
|
305190
|
+
protocol: "openai-chat",
|
|
305191
|
+
local: true,
|
|
305192
|
+
apiPrefix: "/v1",
|
|
305193
|
+
paths: {
|
|
305194
|
+
chat: "/v1/chat/completions",
|
|
305195
|
+
models: "/v1/models",
|
|
305196
|
+
embeddings: "/v1/embeddings",
|
|
305197
|
+
health: "/health"
|
|
305198
|
+
},
|
|
305199
|
+
auth: bearerAuth(false),
|
|
305200
|
+
capabilities: OPENAI_CAPABILITIES,
|
|
305201
|
+
defaultUrl: "http://127.0.0.1:8000/v1",
|
|
305202
|
+
docsUrl: "https://docs.vllm.ai",
|
|
305203
|
+
description: "Self-hosted vLLM OpenAI-compatible endpoint."
|
|
305204
|
+
}),
|
|
305205
|
+
match: (url) => url.port === "8000"
|
|
305206
|
+
}
|
|
305207
|
+
];
|
|
305208
|
+
var descriptors = registrations.map((entry) => entry.descriptor);
|
|
305209
|
+
function listProviderDescriptors() {
|
|
305210
|
+
return [...descriptors].sort((left, right) => Number(right.local) - Number(left.local)).map((entry) => ({
|
|
305211
|
+
...entry,
|
|
305212
|
+
aliases: [...entry.aliases],
|
|
305213
|
+
paths: { ...entry.paths },
|
|
305214
|
+
auth: {
|
|
305215
|
+
...entry.auth,
|
|
305216
|
+
...entry.auth.staticHeaders ? { staticHeaders: { ...entry.auth.staticHeaders } } : {}
|
|
305217
|
+
},
|
|
305218
|
+
capabilities: [...entry.capabilities],
|
|
305219
|
+
...entry.availability ? { availability: { ...entry.availability } } : {}
|
|
305220
|
+
}));
|
|
305221
|
+
}
|
|
305222
|
+
|
|
305223
|
+
// packages/backend-vllm/dist/normalizeUrl.js
|
|
305224
|
+
function normalizeBaseUrl(url) {
|
|
305225
|
+
let value = url.trim().replace(/\/+$/, "");
|
|
305226
|
+
value = value.replace(/\/chat\/completions$/, "");
|
|
305227
|
+
value = value.replace(/\/completions$/, "");
|
|
305228
|
+
value = value.replace(/\/embeddings$/, "");
|
|
305229
|
+
value = value.replace(/\/models(?:\/.*)?$/, "");
|
|
305230
|
+
value = value.replace(/\/+$/, "");
|
|
305231
|
+
value = value.replace(/\/v1\/openai$/, "");
|
|
305232
|
+
value = value.replace(/\/+$/, "");
|
|
305233
|
+
value = value.replace(/\/v1$/, "");
|
|
305234
|
+
return value.replace(/\/+$/, "");
|
|
305235
|
+
}
|
|
305236
|
+
function toProviderInfo(provider) {
|
|
305237
|
+
const normalizedDefault = provider.defaultUrl ? normalizeBaseUrl(provider.defaultUrl) : "";
|
|
305238
|
+
const absoluteModelsUrl = provider.defaultUrl && provider.paths.models ? `${new URL(provider.defaultUrl).origin}${provider.paths.models}` : "";
|
|
305239
|
+
const modelsPath = normalizedDefault && absoluteModelsUrl.startsWith(normalizedDefault) ? absoluteModelsUrl.slice(normalizedDefault.length) || "/models" : provider.paths.models ?? `${provider.apiPrefix}/models`;
|
|
305240
|
+
return {
|
|
305241
|
+
id: provider.id,
|
|
305242
|
+
label: provider.label,
|
|
305243
|
+
local: provider.local,
|
|
305244
|
+
authRequired: provider.auth.required,
|
|
305245
|
+
...provider.auth.keyPrefix ? { keyPrefix: provider.auth.keyPrefix } : {},
|
|
305246
|
+
// Compatibility path relative to normalizeBaseUrl(defaultUrl). New code
|
|
305247
|
+
// should use resolveProviderTransport().urls.models directly.
|
|
305248
|
+
modelsPath,
|
|
305249
|
+
...provider.defaultUrl ? { defaultUrl: provider.defaultUrl } : {},
|
|
305250
|
+
...provider.apiKeyUrl ? { apiKeyUrl: provider.apiKeyUrl } : {},
|
|
305251
|
+
...provider.docsUrl ? { docsUrl: provider.docsUrl } : {},
|
|
305252
|
+
description: provider.description,
|
|
305253
|
+
protocol: provider.protocol,
|
|
305254
|
+
apiPrefix: provider.apiPrefix,
|
|
305255
|
+
aliases: provider.aliases
|
|
305256
|
+
};
|
|
305257
|
+
}
|
|
305258
|
+
var PROVIDER_PRESETS = [
|
|
305259
|
+
...listProviderDescriptors().filter((provider) => provider.availability?.state !== "retired").map(toProviderInfo),
|
|
305260
|
+
{
|
|
305261
|
+
id: "custom",
|
|
305262
|
+
label: "Custom endpoint",
|
|
305263
|
+
local: false,
|
|
305264
|
+
authRequired: false,
|
|
305265
|
+
modelsPath: "/v1/models",
|
|
305266
|
+
description: "Custom endpoint; an explicit ollama, openai-chat, or anthropic-messages protocol is required."
|
|
305267
|
+
}
|
|
305268
|
+
];
|
|
305269
|
+
|
|
305270
|
+
// packages/cli/src/provider-credentials.ts
|
|
305271
|
+
import { constants as constants3, closeSync as closeSync5, existsSync as existsSync8, fstatSync as fstatSync3, fsyncSync as fsyncSync3, lstatSync as lstatSync3, mkdirSync as mkdirSync7, openSync as openSync5, readFileSync as readFileSync9, readdirSync as readdirSync2, renameSync as renameSync6, unlinkSync as unlinkSync5, writeFileSync as writeFileSync7 } from "node:fs";
|
|
305272
|
+
var NOFOLLOW = constants3.O_NOFOLLOW ?? 0;
|
|
305273
|
+
|
|
305274
|
+
// packages/cli/src/config.ts
|
|
305275
|
+
var DEFAULT_CONFIG2 = Object.freeze({
|
|
305276
|
+
backendUrl: "http://127.0.0.1:11434",
|
|
305277
|
+
model: "",
|
|
305278
|
+
backendType: "ollama",
|
|
305279
|
+
apiKey: "",
|
|
305280
|
+
maxRetries: 3,
|
|
305281
|
+
timeoutMs: 3e5,
|
|
305282
|
+
dryRun: false,
|
|
305283
|
+
verbose: false,
|
|
305284
|
+
debug: false,
|
|
305285
|
+
thinking: false,
|
|
305286
|
+
dbPath: omniusConfigDir("memory.db")
|
|
305287
|
+
});
|
|
305288
|
+
var LEGACY_LOCAL_INFERENCE = Object.freeze({
|
|
305289
|
+
backendUrl: "http://127.0.0.1:11434",
|
|
305290
|
+
backendType: "ollama",
|
|
305291
|
+
model: ""
|
|
305292
|
+
});
|
|
305293
|
+
|
|
305294
|
+
// packages/cli/src/redact/secret-redactor.ts
|
|
305295
|
+
var _PREFIX_PATTERNS = [
|
|
305296
|
+
"sk-[A-Za-z0-9_-]{10,}",
|
|
305297
|
+
// OpenAI / OpenRouter / Anthropic (sk-ant-*)
|
|
305298
|
+
"ghp_[A-Za-z0-9]{10,}",
|
|
305299
|
+
// GitHub PAT (classic)
|
|
305300
|
+
"github_pat_[A-Za-z0-9_]{10,}",
|
|
305301
|
+
// GitHub PAT (fine-grained)
|
|
305302
|
+
"xox[baprs]-[A-Za-z0-9-]{10,}",
|
|
305303
|
+
// Slack tokens
|
|
305304
|
+
"AIza[A-Za-z0-9_-]{30,}",
|
|
305305
|
+
// Google API keys
|
|
305306
|
+
"pplx-[A-Za-z0-9]{10,}",
|
|
305307
|
+
// Perplexity
|
|
305308
|
+
"fal_[A-Za-z0-9_-]{10,}",
|
|
305309
|
+
// Fal.ai
|
|
305310
|
+
"fc-[A-Za-z0-9]{10,}",
|
|
305311
|
+
// Firecrawl
|
|
305312
|
+
"bb_live_[A-Za-z0-9_-]{10,}",
|
|
305313
|
+
// BrowserBase
|
|
305314
|
+
"gAAAA[A-Za-z0-9_=-]{20,}",
|
|
305315
|
+
// Codex encrypted tokens
|
|
305316
|
+
"AKIA[A-Z0-9]{16}",
|
|
305317
|
+
// AWS Access Key ID
|
|
305318
|
+
"sk_live_[A-Za-z0-9]{10,}",
|
|
305319
|
+
// Stripe secret key (live)
|
|
305320
|
+
"sk_test_[A-Za-z0-9]{10,}",
|
|
305321
|
+
// Stripe secret key (test)
|
|
305322
|
+
"rk_live_[A-Za-z0-9]{10,}",
|
|
305323
|
+
// Stripe restricted key
|
|
305324
|
+
"SG\\.[A-Za-z0-9_-]{10,}",
|
|
305325
|
+
// SendGrid API key
|
|
305326
|
+
"hf_[A-Za-z0-9]{10,}",
|
|
305327
|
+
// HuggingFace token
|
|
305328
|
+
"r8_[A-Za-z0-9]{10,}",
|
|
305329
|
+
// Replicate API token
|
|
305330
|
+
"npm_[A-Za-z0-9]{10,}",
|
|
305331
|
+
// npm access token
|
|
305332
|
+
"pypi-[A-Za-z0-9_-]{10,}",
|
|
305333
|
+
// PyPI API token
|
|
305334
|
+
"dop_v1_[A-Za-z0-9]{10,}",
|
|
305335
|
+
// DigitalOcean PAT
|
|
305336
|
+
"doo_v1_[A-Za-z0-9]{10,}",
|
|
305337
|
+
// DigitalOcean OAuth
|
|
305338
|
+
"am_[A-Za-z0-9_-]{10,}"
|
|
305339
|
+
// AgentMail API key
|
|
305340
|
+
];
|
|
305341
|
+
var _SECRET_ENV_NAMES = "(?:API_?KEY|TOKEN|SECRET|PASSWORD|PASSWD|CREDENTIAL|AUTH)";
|
|
305342
|
+
var _JSON_KEY_NAMES = "(?:api_?[Kk]ey|token|secret|password|access_token|refresh_token|auth_token|bearer|secret_value|raw_secret|secret_input|key_material)";
|
|
305343
|
+
var _PREFIX_RE = new RegExp(
|
|
305344
|
+
"(?<![A-Za-z0-9_-])(" + _PREFIX_PATTERNS.join("|") + ")(?![A-Za-z0-9_-])",
|
|
305345
|
+
"g"
|
|
305346
|
+
);
|
|
305347
|
+
var _ENV_ASSIGN_RE = new RegExp(
|
|
305348
|
+
"(?<![A-Z_])([A-Z_]*" + _SECRET_ENV_NAMES + `[A-Z_]*)\\s*=\\s*(['"]?)(\\S+)\\2`,
|
|
305349
|
+
"gi"
|
|
305350
|
+
);
|
|
305351
|
+
var _JSON_FIELD_RE = new RegExp(
|
|
305352
|
+
'("' + _JSON_KEY_NAMES + '")\\s*:\\s*"([^"]+)"',
|
|
305353
|
+
"gi"
|
|
305354
|
+
);
|
|
305355
|
+
|
|
305356
|
+
// packages/cli/src/tui/omnius-directory.ts
|
|
305357
|
+
init_dist5();
|
|
305358
|
+
|
|
305359
|
+
// packages/cli/src/tui/theme.ts
|
|
305360
|
+
var TERMINAL_DEFAULTS = {
|
|
305361
|
+
mode: "system",
|
|
305362
|
+
bg: -1,
|
|
305363
|
+
accent: -1,
|
|
305364
|
+
textPrimary: -1,
|
|
305365
|
+
textDim: -1,
|
|
305366
|
+
boxColor: -1
|
|
305367
|
+
};
|
|
305368
|
+
var config = { ...TERMINAL_DEFAULTS };
|
|
305369
|
+
|
|
305370
|
+
// packages/cli/src/tui/native/output-scope.ts
|
|
305371
|
+
import { AsyncLocalStorage as AsyncLocalStorage5 } from "node:async_hooks";
|
|
305372
|
+
var scopes = new AsyncLocalStorage5();
|
|
305373
|
+
|
|
305374
|
+
// packages/cli/src/ui/brand-palette.ts
|
|
305375
|
+
var OMNIUS_EARTH_HEX = Object.freeze({
|
|
305376
|
+
ink: "#101310",
|
|
305377
|
+
void: "#080a08",
|
|
305378
|
+
canvas: "#0d100d",
|
|
305379
|
+
backdropTop: "#171813",
|
|
305380
|
+
backdropBottom: "#2a2019",
|
|
305381
|
+
panel: "#111510",
|
|
305382
|
+
panelRaised: "#1d241e",
|
|
305383
|
+
panelHover: "#29322a",
|
|
305384
|
+
paper: "#f3f2ec",
|
|
305385
|
+
ground: "#d4d1c3",
|
|
305386
|
+
moss: "#506a55",
|
|
305387
|
+
sage: "#91aa93",
|
|
305388
|
+
muted: "#b8bcb5",
|
|
305389
|
+
lichen: "#d8ed9d",
|
|
305390
|
+
bark: "#936658",
|
|
305391
|
+
soil: "#2a1d17",
|
|
305392
|
+
clay: "#d27b61",
|
|
305393
|
+
ochre: "#dfbd73",
|
|
305394
|
+
success: "#7fd48b"
|
|
305395
|
+
});
|
|
305396
|
+
var OMNIUS_EARTH_256 = Object.freeze({
|
|
305397
|
+
background: 233,
|
|
305398
|
+
surface: 234,
|
|
305399
|
+
surfaceRaised: 235,
|
|
305400
|
+
accent: 108,
|
|
305401
|
+
accentDim: 65,
|
|
305402
|
+
textPrimary: 254,
|
|
305403
|
+
textDim: 145,
|
|
305404
|
+
ground: 187,
|
|
305405
|
+
focus: 193,
|
|
305406
|
+
success: 114,
|
|
305407
|
+
warning: 180,
|
|
305408
|
+
error: 173,
|
|
305409
|
+
info: 108,
|
|
305410
|
+
bark: 137
|
|
305411
|
+
});
|
|
305412
|
+
|
|
305413
|
+
// packages/cli/src/tui/text-selection.ts
|
|
305414
|
+
var SEL_BG = OMNIUS_EARTH_256.accent;
|
|
305415
|
+
var SEL_FG = 30;
|
|
305416
|
+
var SEL_START = `\x1B[${SEL_FG}m\x1B[48;5;${SEL_BG}m`;
|
|
305417
|
+
|
|
305418
|
+
// packages/cli/src/tui/task-complete-box.ts
|
|
305419
|
+
var TASK_COMPLETE_GREEN_256 = 114;
|
|
305420
|
+
var GREEN = `\x1B[38;5;${TASK_COMPLETE_GREEN_256}m`;
|
|
305421
|
+
var FG_BORDER = `\x1B[38;5;${TASK_COMPLETE_GREEN_256}m`;
|
|
305422
|
+
var FG_TITLE = `\x1B[1;38;5;${TASK_COMPLETE_GREEN_256}m`;
|
|
305423
|
+
var wrapGraphemes = new Intl.Segmenter(void 0, {
|
|
305424
|
+
granularity: "grapheme"
|
|
305425
|
+
});
|
|
305426
|
+
|
|
305427
|
+
// packages/cli/src/tui/omnius-directory.ts
|
|
305428
|
+
var MAX_CONTEXT_LEDGER_BYTES = 512 * 1024;
|
|
305429
|
+
var SAME_TASK_REPLACE_WINDOW_MS = 12 * 60 * 60 * 1e3;
|
|
305430
|
+
|
|
305431
|
+
// packages/cli/src/service-auto-update.ts
|
|
305432
|
+
var SERVICE_AUTO_UPDATE_INTERVAL_MS = 60 * 60 * 1e3;
|
|
305433
|
+
var FAILED_TARGET_RETRY_MS = 24 * 60 * 60 * 1e3;
|
|
304675
305434
|
|
|
304676
305435
|
// packages/cli/src/tray.ts
|
|
304677
305436
|
var DEFAULT_ENDPOINT = "http://127.0.0.1:11435";
|
|
304678
305437
|
function uidSuffix() {
|
|
304679
305438
|
return typeof process.getuid === "function" ? String(process.getuid()) : "user";
|
|
304680
305439
|
}
|
|
304681
|
-
function resolveTrayPaths(env = process.env, platform2 = process.platform, home =
|
|
304682
|
-
const runtimeBase = env["XDG_RUNTIME_DIR"] ||
|
|
304683
|
-
const stateBase = platform2 === "win32" ? env["LOCALAPPDATA"] ||
|
|
304684
|
-
const configBase = platform2 === "win32" ? env["APPDATA"] ||
|
|
304685
|
-
const runtimeDir =
|
|
304686
|
-
const stateDir = platform2 === "win32" ?
|
|
304687
|
-
const autostartFile = platform2 === "darwin" ?
|
|
305440
|
+
function resolveTrayPaths(env = process.env, platform2 = process.platform, home = homedir18()) {
|
|
305441
|
+
const runtimeBase = env["XDG_RUNTIME_DIR"] || join21(tmpdir6(), `omnius-${uidSuffix()}`);
|
|
305442
|
+
const stateBase = platform2 === "win32" ? env["LOCALAPPDATA"] || join21(home, "AppData", "Local") : env["XDG_STATE_HOME"] || join21(home, ".local", "state");
|
|
305443
|
+
const configBase = platform2 === "win32" ? env["APPDATA"] || join21(home, "AppData", "Roaming") : env["XDG_CONFIG_HOME"] || join21(home, ".config");
|
|
305444
|
+
const runtimeDir = join21(runtimeBase, "omnius");
|
|
305445
|
+
const stateDir = platform2 === "win32" ? join21(stateBase, "Omnius") : join21(stateBase, "omnius");
|
|
305446
|
+
const autostartFile = platform2 === "darwin" ? join21(home, "Library", "LaunchAgents", "ai.omnius.tray.plist") : platform2 === "win32" ? join21(configBase, "Microsoft", "Windows", "Start Menu", "Programs", "Startup", "omnius-tray.cmd") : join21(configBase, "autostart", "omnius-tray.desktop");
|
|
304688
305447
|
return {
|
|
304689
305448
|
runtimeDir,
|
|
304690
305449
|
stateDir,
|
|
304691
|
-
pidFile:
|
|
304692
|
-
stateFile:
|
|
304693
|
-
stdoutLog:
|
|
304694
|
-
stderrLog:
|
|
305450
|
+
pidFile: join21(runtimeDir, "tray.pid"),
|
|
305451
|
+
stateFile: join21(runtimeDir, "tray-state.json"),
|
|
305452
|
+
stdoutLog: join21(stateDir, "tray.log"),
|
|
305453
|
+
stderrLog: join21(stateDir, "tray.err.log"),
|
|
304695
305454
|
autostartFile
|
|
304696
305455
|
};
|
|
304697
305456
|
}
|
|
@@ -304765,7 +305524,7 @@ function isProcessAlive2(pid) {
|
|
|
304765
305524
|
}
|
|
304766
305525
|
function readPid(path3) {
|
|
304767
305526
|
try {
|
|
304768
|
-
const pid = Number(
|
|
305527
|
+
const pid = Number(readFileSync10(path3, "utf8").trim());
|
|
304769
305528
|
return Number.isInteger(pid) && pid > 0 ? pid : null;
|
|
304770
305529
|
} catch {
|
|
304771
305530
|
return null;
|
|
@@ -304773,7 +305532,7 @@ function readPid(path3) {
|
|
|
304773
305532
|
}
|
|
304774
305533
|
function readProcessState(path3) {
|
|
304775
305534
|
try {
|
|
304776
|
-
return JSON.parse(
|
|
305535
|
+
return JSON.parse(readFileSync10(path3, "utf8"));
|
|
304777
305536
|
} catch {
|
|
304778
305537
|
return null;
|
|
304779
305538
|
}
|
|
@@ -304807,7 +305566,7 @@ async function commandOutput(command, args, timeout = 2e3) {
|
|
|
304807
305566
|
async function processCommandLine(pid) {
|
|
304808
305567
|
try {
|
|
304809
305568
|
if (process.platform === "linux") {
|
|
304810
|
-
return
|
|
305569
|
+
return readFileSync10(`/proc/${pid}/cmdline`, "utf8").replace(/\0/g, " ");
|
|
304811
305570
|
}
|
|
304812
305571
|
if (process.platform !== "win32") {
|
|
304813
305572
|
return (await commandOutput("ps", ["-p", String(pid), "-o", "command="])).trim();
|
|
@@ -304826,7 +305585,7 @@ async function getTrayStatus(explicitEndpoint) {
|
|
|
304826
305585
|
const running = pid !== null && isProcessAlive2(pid);
|
|
304827
305586
|
if (pid && !running) {
|
|
304828
305587
|
try {
|
|
304829
|
-
|
|
305588
|
+
unlinkSync6(paths.pidFile);
|
|
304830
305589
|
} catch {
|
|
304831
305590
|
}
|
|
304832
305591
|
}
|
|
@@ -304841,7 +305600,7 @@ async function getTrayStatus(explicitEndpoint) {
|
|
|
304841
305600
|
// requested endpoint. This previously kept resurrecting an obsolete
|
|
304842
305601
|
// custom port (for example 11535) after the daemon had returned to 11435.
|
|
304843
305602
|
endpoint: running || !explicitEndpoint ? state?.endpoint || requestedEndpoint : requestedEndpoint,
|
|
304844
|
-
registered:
|
|
305603
|
+
registered: existsSync9(paths.autostartFile),
|
|
304845
305604
|
registrationFile: paths.autostartFile,
|
|
304846
305605
|
...state?.health ? { health: state.health } : {},
|
|
304847
305606
|
supported: support.supported,
|
|
@@ -304854,11 +305613,11 @@ async function stopTray() {
|
|
|
304854
305613
|
const pid = readPid(paths.pidFile);
|
|
304855
305614
|
if (!pid || !isProcessAlive2(pid)) {
|
|
304856
305615
|
try {
|
|
304857
|
-
|
|
305616
|
+
unlinkSync6(paths.pidFile);
|
|
304858
305617
|
} catch {
|
|
304859
305618
|
}
|
|
304860
305619
|
try {
|
|
304861
|
-
|
|
305620
|
+
unlinkSync6(paths.stateFile);
|
|
304862
305621
|
} catch {
|
|
304863
305622
|
}
|
|
304864
305623
|
return false;
|
|
@@ -304875,11 +305634,11 @@ async function stopTray() {
|
|
|
304875
305634
|
for (let i = 0; i < 30; i++) {
|
|
304876
305635
|
if (!isProcessAlive2(pid)) {
|
|
304877
305636
|
try {
|
|
304878
|
-
|
|
305637
|
+
unlinkSync6(paths.pidFile);
|
|
304879
305638
|
} catch {
|
|
304880
305639
|
}
|
|
304881
305640
|
try {
|
|
304882
|
-
|
|
305641
|
+
unlinkSync6(paths.stateFile);
|
|
304883
305642
|
} catch {
|
|
304884
305643
|
}
|
|
304885
305644
|
return true;
|
|
@@ -304894,11 +305653,11 @@ async function stopTray() {
|
|
|
304894
305653
|
for (let i = 0; i < 20; i++) {
|
|
304895
305654
|
if (!isProcessAlive2(pid)) {
|
|
304896
305655
|
try {
|
|
304897
|
-
|
|
305656
|
+
unlinkSync6(paths.pidFile);
|
|
304898
305657
|
} catch {
|
|
304899
305658
|
}
|
|
304900
305659
|
try {
|
|
304901
|
-
|
|
305660
|
+
unlinkSync6(paths.stateFile);
|
|
304902
305661
|
} catch {
|
|
304903
305662
|
}
|
|
304904
305663
|
return true;
|
|
@@ -304964,6 +305723,8 @@ async function runUpdateWorkerRuntime(state, paths, endpoint) {
|
|
|
304964
305723
|
} : null;
|
|
304965
305724
|
},
|
|
304966
305725
|
restartTray: trayWasRunning ? (executable) => restartTrayWithInstalledExecutable(executable, endpoint) : void 0,
|
|
305726
|
+
// A daemon that boots but crashes shortly after is an update failure.
|
|
305727
|
+
stabilityWindowMs: 15e3,
|
|
304967
305728
|
signal: cancellation.signal
|
|
304968
305729
|
},
|
|
304969
305730
|
paths
|