@vibeframe/mcp-server 0.113.7 → 0.113.9
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 +382 -213
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -291,6 +291,16 @@ var init_api_keys = __esm({
|
|
|
291
291
|
envExampleUrl: "https://openrouter.ai/keys",
|
|
292
292
|
keyFormat: { prefix: /^sk-or-/, example: "sk-or-..." }
|
|
293
293
|
});
|
|
294
|
+
defineApiKey({
|
|
295
|
+
configKey: "evolink",
|
|
296
|
+
envVar: "EVOLINK_API_KEY",
|
|
297
|
+
label: "Evolink",
|
|
298
|
+
showInSetup: true,
|
|
299
|
+
setupDescription: "GPT-5, Claude, Gemini, DeepSeek & more via one key \u2014 Agent only (pay per model)",
|
|
300
|
+
envExampleComment: "Evolink API Key (GPT-5, Claude, Gemini, DeepSeek & more via unified API, used by `vibe agent`)",
|
|
301
|
+
envExampleUrl: "https://evolink.ai/dashboard/keys",
|
|
302
|
+
keyFormat: { prefix: /^el-/, example: "el-..." }
|
|
303
|
+
});
|
|
294
304
|
defineApiKey({
|
|
295
305
|
configKey: "imgbb",
|
|
296
306
|
envVar: "IMGBB_API_KEY",
|
|
@@ -313,6 +323,12 @@ var init_api_keys = __esm({
|
|
|
313
323
|
apiKey: "openrouter",
|
|
314
324
|
kinds: ["llm"]
|
|
315
325
|
});
|
|
326
|
+
defineProvider({
|
|
327
|
+
id: "evolink",
|
|
328
|
+
label: "Evolink",
|
|
329
|
+
apiKey: "evolink",
|
|
330
|
+
kinds: ["llm"]
|
|
331
|
+
});
|
|
316
332
|
}
|
|
317
333
|
});
|
|
318
334
|
|
|
@@ -18808,7 +18824,8 @@ var init_schema = __esm({
|
|
|
18808
18824
|
gemini: "Gemini (Google)",
|
|
18809
18825
|
ollama: "Ollama (Local)",
|
|
18810
18826
|
xai: "Grok (xAI)",
|
|
18811
|
-
openrouter: "OpenRouter"
|
|
18827
|
+
openrouter: "OpenRouter",
|
|
18828
|
+
evolink: "Evolink"
|
|
18812
18829
|
};
|
|
18813
18830
|
PROVIDER_ENV_VARS = getProviderEnvVars();
|
|
18814
18831
|
PROVIDER_ENV_ALIASES = getProviderEnvAliases();
|
|
@@ -20632,6 +20649,7 @@ var init_api_key = __esm({
|
|
|
20632
20649
|
RUNWAY_API_SECRET: "runway",
|
|
20633
20650
|
KLING_API_KEY: "kling",
|
|
20634
20651
|
OPENROUTER_API_KEY: "openrouter",
|
|
20652
|
+
EVOLINK_API_KEY: "evolink",
|
|
20635
20653
|
IMGBB_API_KEY: "imgbb",
|
|
20636
20654
|
REPLICATE_API_TOKEN: "replicate"
|
|
20637
20655
|
};
|
|
@@ -20646,7 +20664,8 @@ var init_api_key = __esm({
|
|
|
20646
20664
|
RUNWAY_API_SECRET: "https://app.runwayml.com/settings/api-keys",
|
|
20647
20665
|
KLING_API_KEY: "https://klingai.com/dev",
|
|
20648
20666
|
REPLICATE_API_TOKEN: "https://replicate.com/account/api-tokens",
|
|
20649
|
-
IMGBB_API_KEY: "https://api.imgbb.com/"
|
|
20667
|
+
IMGBB_API_KEY: "https://api.imgbb.com/",
|
|
20668
|
+
EVOLINK_API_KEY: "https://evolink.ai/dashboard/keys"
|
|
20650
20669
|
};
|
|
20651
20670
|
ApiKeyError = class extends Error {
|
|
20652
20671
|
envVar;
|
|
@@ -120551,8 +120570,8 @@ var init_which_module = __esm({
|
|
|
120551
120570
|
});
|
|
120552
120571
|
|
|
120553
120572
|
// ../../node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/build/lib/command.js
|
|
120554
|
-
function command(
|
|
120555
|
-
return new CommandInstance(
|
|
120573
|
+
function command(usage4, validation3, globalMiddleware, shim4) {
|
|
120574
|
+
return new CommandInstance(usage4, validation3, globalMiddleware, shim4);
|
|
120556
120575
|
}
|
|
120557
120576
|
function isCommandBuilderDefinition(builder) {
|
|
120558
120577
|
return typeof builder === "object" && !!builder.builder && typeof builder.handler === "function";
|
|
@@ -120581,13 +120600,13 @@ var init_command = __esm({
|
|
|
120581
120600
|
init_which_module();
|
|
120582
120601
|
DEFAULT_MARKER = /(^\*)|(^\$0)/;
|
|
120583
120602
|
CommandInstance = class {
|
|
120584
|
-
constructor(
|
|
120603
|
+
constructor(usage4, validation3, globalMiddleware, shim4) {
|
|
120585
120604
|
this.requireCache = /* @__PURE__ */ new Set();
|
|
120586
120605
|
this.handlers = {};
|
|
120587
120606
|
this.aliasMap = {};
|
|
120588
120607
|
this.frozens = [];
|
|
120589
120608
|
this.shim = shim4;
|
|
120590
|
-
this.usage =
|
|
120609
|
+
this.usage = usage4;
|
|
120591
120610
|
this.globalMiddleware = globalMiddleware;
|
|
120592
120611
|
this.validation = validation3;
|
|
120593
120612
|
}
|
|
@@ -121153,10 +121172,10 @@ function usage(yargs, shim4) {
|
|
|
121153
121172
|
});
|
|
121154
121173
|
if (!usageDisabled) {
|
|
121155
121174
|
if (usages.length) {
|
|
121156
|
-
usages.forEach((
|
|
121157
|
-
ui3.div({ text: `${
|
|
121158
|
-
if (
|
|
121159
|
-
ui3.div({ text: `${
|
|
121175
|
+
usages.forEach((usage4) => {
|
|
121176
|
+
ui3.div({ text: `${usage4[0].replace(/\$0/g, base$0)}` });
|
|
121177
|
+
if (usage4[1]) {
|
|
121178
|
+
ui3.div({ text: `${usage4[1]}`, padding: [1, 0, 0, 0] });
|
|
121160
121179
|
}
|
|
121161
121180
|
});
|
|
121162
121181
|
ui3.div();
|
|
@@ -121576,8 +121595,8 @@ compdef _{{app_name}}_yargs_completions {{app_name}}
|
|
|
121576
121595
|
});
|
|
121577
121596
|
|
|
121578
121597
|
// ../../node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/build/lib/completion.js
|
|
121579
|
-
function completion(yargs,
|
|
121580
|
-
return new Completion(yargs,
|
|
121598
|
+
function completion(yargs, usage4, command3, shim4) {
|
|
121599
|
+
return new Completion(yargs, usage4, command3, shim4);
|
|
121581
121600
|
}
|
|
121582
121601
|
function isSyncCompletionFunction(completionFunction) {
|
|
121583
121602
|
return completionFunction.length < 3;
|
|
@@ -121594,10 +121613,10 @@ var init_completion = __esm({
|
|
|
121594
121613
|
init_is_promise();
|
|
121595
121614
|
init_parse_command();
|
|
121596
121615
|
Completion = class {
|
|
121597
|
-
constructor(yargs,
|
|
121616
|
+
constructor(yargs, usage4, command3, shim4) {
|
|
121598
121617
|
var _a9, _b3, _c3;
|
|
121599
121618
|
this.yargs = yargs;
|
|
121600
|
-
this.usage =
|
|
121619
|
+
this.usage = usage4;
|
|
121601
121620
|
this.command = command3;
|
|
121602
121621
|
this.shim = shim4;
|
|
121603
121622
|
this.completionKey = "get-yargs-completions";
|
|
@@ -121834,7 +121853,7 @@ var init_levenshtein = __esm({
|
|
|
121834
121853
|
});
|
|
121835
121854
|
|
|
121836
121855
|
// ../../node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/build/lib/validation.js
|
|
121837
|
-
function validation(yargs,
|
|
121856
|
+
function validation(yargs, usage4, shim4) {
|
|
121838
121857
|
const __ = shim4.y18n.__;
|
|
121839
121858
|
const __n = shim4.y18n.__n;
|
|
121840
121859
|
const self2 = {};
|
|
@@ -121845,22 +121864,22 @@ function validation(yargs, usage3, shim4) {
|
|
|
121845
121864
|
if (demandedCommands._ && (_s < demandedCommands._.min || _s > demandedCommands._.max)) {
|
|
121846
121865
|
if (_s < demandedCommands._.min) {
|
|
121847
121866
|
if (demandedCommands._.minMsg !== void 0) {
|
|
121848
|
-
|
|
121867
|
+
usage4.fail(demandedCommands._.minMsg ? demandedCommands._.minMsg.replace(/\$0/g, _s.toString()).replace(/\$1/, demandedCommands._.min.toString()) : null);
|
|
121849
121868
|
} else {
|
|
121850
|
-
|
|
121869
|
+
usage4.fail(__n("Not enough non-option arguments: got %s, need at least %s", "Not enough non-option arguments: got %s, need at least %s", _s, _s.toString(), demandedCommands._.min.toString()));
|
|
121851
121870
|
}
|
|
121852
121871
|
} else if (_s > demandedCommands._.max) {
|
|
121853
121872
|
if (demandedCommands._.maxMsg !== void 0) {
|
|
121854
|
-
|
|
121873
|
+
usage4.fail(demandedCommands._.maxMsg ? demandedCommands._.maxMsg.replace(/\$0/g, _s.toString()).replace(/\$1/, demandedCommands._.max.toString()) : null);
|
|
121855
121874
|
} else {
|
|
121856
|
-
|
|
121875
|
+
usage4.fail(__n("Too many non-option arguments: got %s, maximum of %s", "Too many non-option arguments: got %s, maximum of %s", _s, _s.toString(), demandedCommands._.max.toString()));
|
|
121857
121876
|
}
|
|
121858
121877
|
}
|
|
121859
121878
|
}
|
|
121860
121879
|
};
|
|
121861
121880
|
self2.positionalCount = function positionalCount(required, observed) {
|
|
121862
121881
|
if (observed < required) {
|
|
121863
|
-
|
|
121882
|
+
usage4.fail(__n("Not enough non-option arguments: got %s, need at least %s", "Not enough non-option arguments: got %s, need at least %s", observed, observed + "", required + ""));
|
|
121864
121883
|
}
|
|
121865
121884
|
};
|
|
121866
121885
|
self2.requiredArguments = function requiredArguments(argv, demandedOptions) {
|
|
@@ -121881,7 +121900,7 @@ function validation(yargs, usage3, shim4) {
|
|
|
121881
121900
|
}
|
|
121882
121901
|
const customMsg = customMsgs.length ? `
|
|
121883
121902
|
${customMsgs.join("\n")}` : "";
|
|
121884
|
-
|
|
121903
|
+
usage4.fail(__n("Missing required argument: %s", "Missing required arguments: %s", Object.keys(missing).length, Object.keys(missing).join(", ") + customMsg));
|
|
121885
121904
|
}
|
|
121886
121905
|
};
|
|
121887
121906
|
self2.unknownArguments = function unknownArguments(argv, aliases2, positionalMap, isDefaultCommand, checkPositionals = true) {
|
|
@@ -121915,7 +121934,7 @@ ${customMsgs.join("\n")}` : "";
|
|
|
121915
121934
|
}
|
|
121916
121935
|
}
|
|
121917
121936
|
if (unknown.length) {
|
|
121918
|
-
|
|
121937
|
+
usage4.fail(__n("Unknown argument: %s", "Unknown arguments: %s", unknown.length, unknown.map((s2) => s2.trim() ? s2 : `"${s2}"`).join(", ")));
|
|
121919
121938
|
}
|
|
121920
121939
|
};
|
|
121921
121940
|
self2.unknownCommands = function unknownCommands(argv) {
|
|
@@ -121930,7 +121949,7 @@ ${customMsgs.join("\n")}` : "";
|
|
|
121930
121949
|
});
|
|
121931
121950
|
}
|
|
121932
121951
|
if (unknown.length > 0) {
|
|
121933
|
-
|
|
121952
|
+
usage4.fail(__n("Unknown command: %s", "Unknown commands: %s", unknown.length, unknown.join(", ")));
|
|
121934
121953
|
return true;
|
|
121935
121954
|
} else {
|
|
121936
121955
|
return false;
|
|
@@ -121963,9 +121982,9 @@ ${customMsgs.join("\n")}` : "";
|
|
|
121963
121982
|
let msg = __("Invalid values:");
|
|
121964
121983
|
invalidKeys.forEach((key2) => {
|
|
121965
121984
|
msg += `
|
|
121966
|
-
${__("Argument: %s, Given: %s, Choices: %s", key2,
|
|
121985
|
+
${__("Argument: %s, Given: %s, Choices: %s", key2, usage4.stringifiedValues(invalid[key2]), usage4.stringifiedValues(options.choices[key2]))}`;
|
|
121967
121986
|
});
|
|
121968
|
-
|
|
121987
|
+
usage4.fail(msg);
|
|
121969
121988
|
};
|
|
121970
121989
|
let implied = {};
|
|
121971
121990
|
self2.implies = function implies(key2, value) {
|
|
@@ -122023,7 +122042,7 @@ ${customMsgs.join("\n")}` : "";
|
|
|
122023
122042
|
implyFail.forEach((value) => {
|
|
122024
122043
|
msg += value;
|
|
122025
122044
|
});
|
|
122026
|
-
|
|
122045
|
+
usage4.fail(msg);
|
|
122027
122046
|
}
|
|
122028
122047
|
};
|
|
122029
122048
|
let conflicting = {};
|
|
@@ -122051,7 +122070,7 @@ ${customMsgs.join("\n")}` : "";
|
|
|
122051
122070
|
if (conflicting[key2]) {
|
|
122052
122071
|
conflicting[key2].forEach((value) => {
|
|
122053
122072
|
if (value && argv[key2] !== void 0 && argv[value] !== void 0) {
|
|
122054
|
-
|
|
122073
|
+
usage4.fail(__("Arguments %s and %s are mutually exclusive", key2, value));
|
|
122055
122074
|
}
|
|
122056
122075
|
});
|
|
122057
122076
|
}
|
|
@@ -122060,7 +122079,7 @@ ${customMsgs.join("\n")}` : "";
|
|
|
122060
122079
|
Object.keys(conflicting).forEach((key2) => {
|
|
122061
122080
|
conflicting[key2].forEach((value) => {
|
|
122062
122081
|
if (value && argv[shim4.Parser.camelCase(key2)] !== void 0 && argv[shim4.Parser.camelCase(value)] !== void 0) {
|
|
122063
|
-
|
|
122082
|
+
usage4.fail(__("Arguments %s and %s are mutually exclusive", key2, value));
|
|
122064
122083
|
}
|
|
122065
122084
|
});
|
|
122066
122085
|
});
|
|
@@ -122079,7 +122098,7 @@ ${customMsgs.join("\n")}` : "";
|
|
|
122079
122098
|
}
|
|
122080
122099
|
}
|
|
122081
122100
|
if (recommended)
|
|
122082
|
-
|
|
122101
|
+
usage4.fail(__("Did you mean %s?", recommended));
|
|
122083
122102
|
};
|
|
122084
122103
|
self2.reset = function reset(localLookup) {
|
|
122085
122104
|
implied = objFilter(implied, (k2) => !localLookup[k2]);
|
|
@@ -152256,34 +152275,34 @@ ${lanes.join("\n")}
|
|
|
152256
152275
|
directories: directoriesMatcher,
|
|
152257
152276
|
exclude: excludeMatcher
|
|
152258
152277
|
};
|
|
152259
|
-
function getRegularExpressionForWildcard(specs, basePath,
|
|
152260
|
-
const patterns = getRegularExpressionsForWildcards(specs, basePath,
|
|
152278
|
+
function getRegularExpressionForWildcard(specs, basePath, usage4) {
|
|
152279
|
+
const patterns = getRegularExpressionsForWildcards(specs, basePath, usage4);
|
|
152261
152280
|
if (!patterns || !patterns.length) {
|
|
152262
152281
|
return void 0;
|
|
152263
152282
|
}
|
|
152264
152283
|
const pattern = patterns.map((pattern2) => `(?:${pattern2})`).join("|");
|
|
152265
|
-
const terminator =
|
|
152284
|
+
const terminator = usage4 === "exclude" ? "(?:$|/)" : "$";
|
|
152266
152285
|
return `^(?:${pattern})${terminator}`;
|
|
152267
152286
|
}
|
|
152268
|
-
function getRegularExpressionsForWildcards(specs, basePath,
|
|
152287
|
+
function getRegularExpressionsForWildcards(specs, basePath, usage4) {
|
|
152269
152288
|
if (specs === void 0 || specs.length === 0) {
|
|
152270
152289
|
return void 0;
|
|
152271
152290
|
}
|
|
152272
|
-
return flatMap(specs, (spec) => spec && getSubPatternFromSpec(spec, basePath,
|
|
152291
|
+
return flatMap(specs, (spec) => spec && getSubPatternFromSpec(spec, basePath, usage4, wildcardMatchers[usage4]));
|
|
152273
152292
|
}
|
|
152274
152293
|
function isImplicitGlob(lastPathComponent) {
|
|
152275
152294
|
return !/[.*?]/.test(lastPathComponent);
|
|
152276
152295
|
}
|
|
152277
|
-
function getPatternFromSpec(spec, basePath,
|
|
152278
|
-
const pattern = spec && getSubPatternFromSpec(spec, basePath,
|
|
152279
|
-
return pattern && `^(?:${pattern})${
|
|
152296
|
+
function getPatternFromSpec(spec, basePath, usage4) {
|
|
152297
|
+
const pattern = spec && getSubPatternFromSpec(spec, basePath, usage4, wildcardMatchers[usage4]);
|
|
152298
|
+
return pattern && `^(?:${pattern})${usage4 === "exclude" ? "(?:$|/)" : "$"}`;
|
|
152280
152299
|
}
|
|
152281
|
-
function getSubPatternFromSpec(spec, basePath,
|
|
152300
|
+
function getSubPatternFromSpec(spec, basePath, usage4, { singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter: replaceWildcardCharacter2 } = wildcardMatchers[usage4]) {
|
|
152282
152301
|
let subpattern = "";
|
|
152283
152302
|
let hasWrittenComponent = false;
|
|
152284
152303
|
const components = getNormalizedPathComponents(spec, basePath);
|
|
152285
152304
|
const lastComponent = last3(components);
|
|
152286
|
-
if (
|
|
152305
|
+
if (usage4 !== "exclude" && lastComponent === "**") {
|
|
152287
152306
|
return void 0;
|
|
152288
152307
|
}
|
|
152289
152308
|
components[0] = removeTrailingDirectorySeparator(components[0]);
|
|
@@ -152295,14 +152314,14 @@ ${lanes.join("\n")}
|
|
|
152295
152314
|
if (component === "**") {
|
|
152296
152315
|
subpattern += doubleAsteriskRegexFragment;
|
|
152297
152316
|
} else {
|
|
152298
|
-
if (
|
|
152317
|
+
if (usage4 === "directories") {
|
|
152299
152318
|
subpattern += "(?:";
|
|
152300
152319
|
optionalCount++;
|
|
152301
152320
|
}
|
|
152302
152321
|
if (hasWrittenComponent) {
|
|
152303
152322
|
subpattern += directorySeparator;
|
|
152304
152323
|
}
|
|
152305
|
-
if (
|
|
152324
|
+
if (usage4 !== "exclude") {
|
|
152306
152325
|
let componentPattern = "";
|
|
152307
152326
|
if (component.charCodeAt(0) === 42) {
|
|
152308
152327
|
componentPattern += "(?:[^./]" + singleAsteriskRegexFragment + ")?";
|
|
@@ -185600,27 +185619,27 @@ ${lanes.join("\n")}
|
|
|
185600
185619
|
}
|
|
185601
185620
|
return Debug.fail("There should exist two symbols, one as property declaration and one as parameter declaration");
|
|
185602
185621
|
}
|
|
185603
|
-
function isBlockScopedNameDeclaredBeforeUse(declaration,
|
|
185622
|
+
function isBlockScopedNameDeclaredBeforeUse(declaration, usage4) {
|
|
185604
185623
|
const declarationFile = getSourceFileOfNode(declaration);
|
|
185605
|
-
const useFile = getSourceFileOfNode(
|
|
185624
|
+
const useFile = getSourceFileOfNode(usage4);
|
|
185606
185625
|
const declContainer = getEnclosingBlockScopeContainer(declaration);
|
|
185607
185626
|
if (declarationFile !== useFile) {
|
|
185608
|
-
if (moduleKind && (declarationFile.externalModuleIndicator || useFile.externalModuleIndicator) || !compilerOptions.outFile || isInTypeQuery(
|
|
185627
|
+
if (moduleKind && (declarationFile.externalModuleIndicator || useFile.externalModuleIndicator) || !compilerOptions.outFile || isInTypeQuery(usage4) || declaration.flags & 33554432) {
|
|
185609
185628
|
return true;
|
|
185610
185629
|
}
|
|
185611
|
-
if (isUsedInFunctionOrInstanceProperty(
|
|
185630
|
+
if (isUsedInFunctionOrInstanceProperty(usage4, declaration)) {
|
|
185612
185631
|
return true;
|
|
185613
185632
|
}
|
|
185614
185633
|
const sourceFiles = host.getSourceFiles();
|
|
185615
185634
|
return sourceFiles.indexOf(declarationFile) <= sourceFiles.indexOf(useFile);
|
|
185616
185635
|
}
|
|
185617
|
-
if (!!(
|
|
185636
|
+
if (!!(usage4.flags & 16777216) || isInTypeQuery(usage4) || isInAmbientOrTypeNode(usage4)) {
|
|
185618
185637
|
return true;
|
|
185619
185638
|
}
|
|
185620
|
-
if (declaration.pos <=
|
|
185639
|
+
if (declaration.pos <= usage4.pos && !(isPropertyDeclaration(declaration) && isThisProperty(usage4.parent) && !declaration.initializer && !declaration.exclamationToken)) {
|
|
185621
185640
|
if (declaration.kind === 209) {
|
|
185622
185641
|
const errorBindingElement = getAncestor(
|
|
185623
|
-
|
|
185642
|
+
usage4,
|
|
185624
185643
|
209
|
|
185625
185644
|
/* BindingElement */
|
|
185626
185645
|
);
|
|
@@ -185631,41 +185650,41 @@ ${lanes.join("\n")}
|
|
|
185631
185650
|
declaration,
|
|
185632
185651
|
261
|
|
185633
185652
|
/* VariableDeclaration */
|
|
185634
|
-
),
|
|
185653
|
+
), usage4);
|
|
185635
185654
|
} else if (declaration.kind === 261) {
|
|
185636
|
-
return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration,
|
|
185655
|
+
return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage4);
|
|
185637
185656
|
} else if (isClassLike(declaration)) {
|
|
185638
|
-
const container = findAncestor(
|
|
185657
|
+
const container = findAncestor(usage4, (n2) => n2 === declaration ? "quit" : isComputedPropertyName(n2) ? n2.parent.parent === declaration : !legacyDecorators && isDecorator(n2) && (n2.parent === declaration || isMethodDeclaration(n2.parent) && n2.parent.parent === declaration || isGetOrSetAccessorDeclaration(n2.parent) && n2.parent.parent === declaration || isPropertyDeclaration(n2.parent) && n2.parent.parent === declaration || isParameter(n2.parent) && n2.parent.parent.parent === declaration));
|
|
185639
185658
|
if (!container) {
|
|
185640
185659
|
return true;
|
|
185641
185660
|
}
|
|
185642
185661
|
if (!legacyDecorators && isDecorator(container)) {
|
|
185643
|
-
return !!findAncestor(
|
|
185662
|
+
return !!findAncestor(usage4, (n2) => n2 === container ? "quit" : isFunctionLike(n2) && !getImmediatelyInvokedFunctionExpression(n2));
|
|
185644
185663
|
}
|
|
185645
185664
|
return false;
|
|
185646
185665
|
} else if (isPropertyDeclaration(declaration)) {
|
|
185647
185666
|
return !isPropertyImmediatelyReferencedWithinDeclaration(
|
|
185648
185667
|
declaration,
|
|
185649
|
-
|
|
185668
|
+
usage4,
|
|
185650
185669
|
/*stopAtAnyPropertyDeclaration*/
|
|
185651
185670
|
false
|
|
185652
185671
|
);
|
|
185653
185672
|
} else if (isParameterPropertyDeclaration(declaration, declaration.parent)) {
|
|
185654
|
-
return !(emitStandardClassFields && getContainingClass(declaration) === getContainingClass(
|
|
185673
|
+
return !(emitStandardClassFields && getContainingClass(declaration) === getContainingClass(usage4) && isUsedInFunctionOrInstanceProperty(usage4, declaration));
|
|
185655
185674
|
}
|
|
185656
185675
|
return true;
|
|
185657
185676
|
}
|
|
185658
|
-
if (
|
|
185677
|
+
if (usage4.parent.kind === 282 || usage4.parent.kind === 278 && usage4.parent.isExportEquals) {
|
|
185659
185678
|
return true;
|
|
185660
185679
|
}
|
|
185661
|
-
if (
|
|
185680
|
+
if (usage4.kind === 278 && usage4.isExportEquals) {
|
|
185662
185681
|
return true;
|
|
185663
185682
|
}
|
|
185664
|
-
if (isUsedInFunctionOrInstanceProperty(
|
|
185683
|
+
if (isUsedInFunctionOrInstanceProperty(usage4, declaration)) {
|
|
185665
185684
|
if (emitStandardClassFields && getContainingClass(declaration) && (isPropertyDeclaration(declaration) || isParameterPropertyDeclaration(declaration, declaration.parent))) {
|
|
185666
185685
|
return !isPropertyImmediatelyReferencedWithinDeclaration(
|
|
185667
185686
|
declaration,
|
|
185668
|
-
|
|
185687
|
+
usage4,
|
|
185669
185688
|
/*stopAtAnyPropertyDeclaration*/
|
|
185670
185689
|
true
|
|
185671
185690
|
);
|
|
@@ -186271,19 +186290,19 @@ ${lanes.join("\n")}
|
|
|
186271
186290
|
/* Default */
|
|
186272
186291
|
) || isExportSpecifier(node) || isNamespaceExport(node);
|
|
186273
186292
|
}
|
|
186274
|
-
function getEmitSyntaxForModuleSpecifierExpression(
|
|
186275
|
-
return isStringLiteralLike(
|
|
186293
|
+
function getEmitSyntaxForModuleSpecifierExpression(usage4) {
|
|
186294
|
+
return isStringLiteralLike(usage4) ? host.getEmitSyntaxForUsageLocation(getSourceFileOfNode(usage4), usage4) : void 0;
|
|
186276
186295
|
}
|
|
186277
186296
|
function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
|
|
186278
186297
|
return usageMode === 99 && targetMode === 1;
|
|
186279
186298
|
}
|
|
186280
|
-
function isOnlyImportableAsDefault(
|
|
186299
|
+
function isOnlyImportableAsDefault(usage4, resolvedModule) {
|
|
186281
186300
|
if (100 <= moduleKind && moduleKind <= 199) {
|
|
186282
|
-
const usageMode = getEmitSyntaxForModuleSpecifierExpression(
|
|
186301
|
+
const usageMode = getEmitSyntaxForModuleSpecifierExpression(usage4);
|
|
186283
186302
|
if (usageMode === 99) {
|
|
186284
186303
|
resolvedModule ?? (resolvedModule = resolveExternalModuleName(
|
|
186285
|
-
|
|
186286
|
-
|
|
186304
|
+
usage4,
|
|
186305
|
+
usage4,
|
|
186287
186306
|
/*ignoreErrors*/
|
|
186288
186307
|
true
|
|
186289
186308
|
));
|
|
@@ -186293,8 +186312,8 @@ ${lanes.join("\n")}
|
|
|
186293
186312
|
}
|
|
186294
186313
|
return false;
|
|
186295
186314
|
}
|
|
186296
|
-
function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias,
|
|
186297
|
-
const usageMode = file && getEmitSyntaxForModuleSpecifierExpression(
|
|
186315
|
+
function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, usage4) {
|
|
186316
|
+
const usageMode = file && getEmitSyntaxForModuleSpecifierExpression(usage4);
|
|
186298
186317
|
if (file && usageMode !== void 0) {
|
|
186299
186318
|
const targetMode = host.getImpliedNodeFormatForEmit(file);
|
|
186300
186319
|
if (usageMode === 99 && targetMode === 1 && 100 <= moduleKind && moduleKind <= 199) {
|
|
@@ -265001,43 +265020,43 @@ ${lanes.join("\n")}
|
|
|
265001
265020
|
}
|
|
265002
265021
|
return false;
|
|
265003
265022
|
}
|
|
265004
|
-
function getModeForUsageLocation(file,
|
|
265005
|
-
return getModeForUsageLocationWorker(file,
|
|
265023
|
+
function getModeForUsageLocation(file, usage4, compilerOptions) {
|
|
265024
|
+
return getModeForUsageLocationWorker(file, usage4, compilerOptions);
|
|
265006
265025
|
}
|
|
265007
|
-
function getModeForUsageLocationWorker(file,
|
|
265008
|
-
if (isImportDeclaration(
|
|
265009
|
-
const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(
|
|
265026
|
+
function getModeForUsageLocationWorker(file, usage4, compilerOptions) {
|
|
265027
|
+
if (isImportDeclaration(usage4.parent) || isExportDeclaration(usage4.parent) || isJSDocImportTag(usage4.parent)) {
|
|
265028
|
+
const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage4.parent);
|
|
265010
265029
|
if (isTypeOnly) {
|
|
265011
|
-
const override = getResolutionModeOverride(
|
|
265030
|
+
const override = getResolutionModeOverride(usage4.parent.attributes);
|
|
265012
265031
|
if (override) {
|
|
265013
265032
|
return override;
|
|
265014
265033
|
}
|
|
265015
265034
|
}
|
|
265016
265035
|
}
|
|
265017
|
-
if (
|
|
265018
|
-
const override = getResolutionModeOverride(
|
|
265036
|
+
if (usage4.parent.parent && isImportTypeNode(usage4.parent.parent)) {
|
|
265037
|
+
const override = getResolutionModeOverride(usage4.parent.parent.attributes);
|
|
265019
265038
|
if (override) {
|
|
265020
265039
|
return override;
|
|
265021
265040
|
}
|
|
265022
265041
|
}
|
|
265023
265042
|
if (compilerOptions && importSyntaxAffectsModuleResolution(compilerOptions)) {
|
|
265024
|
-
return getEmitSyntaxForUsageLocationWorker(file,
|
|
265043
|
+
return getEmitSyntaxForUsageLocationWorker(file, usage4, compilerOptions);
|
|
265025
265044
|
}
|
|
265026
265045
|
}
|
|
265027
|
-
function getEmitSyntaxForUsageLocationWorker(file,
|
|
265046
|
+
function getEmitSyntaxForUsageLocationWorker(file, usage4, compilerOptions) {
|
|
265028
265047
|
var _a9;
|
|
265029
265048
|
if (!compilerOptions) {
|
|
265030
265049
|
return void 0;
|
|
265031
265050
|
}
|
|
265032
|
-
const exprParentParent = (_a9 = walkUpParenthesizedExpressions(
|
|
265051
|
+
const exprParentParent = (_a9 = walkUpParenthesizedExpressions(usage4.parent)) == null ? void 0 : _a9.parent;
|
|
265033
265052
|
if (exprParentParent && isImportEqualsDeclaration(exprParentParent) || isRequireCall(
|
|
265034
|
-
|
|
265053
|
+
usage4.parent,
|
|
265035
265054
|
/*requireStringLiteralLikeArgument*/
|
|
265036
265055
|
false
|
|
265037
265056
|
)) {
|
|
265038
265057
|
return 1;
|
|
265039
265058
|
}
|
|
265040
|
-
if (isImportCall(walkUpParenthesizedExpressions(
|
|
265059
|
+
if (isImportCall(walkUpParenthesizedExpressions(usage4.parent))) {
|
|
265041
265060
|
return shouldTransformImportCallWorker(file, compilerOptions) ? 1 : 99;
|
|
265042
265061
|
}
|
|
265043
265062
|
const fileEmitMode = getEmitModuleFormatOfFileWorker(file, compilerOptions);
|
|
@@ -268190,11 +268209,11 @@ ${lanes.join("\n")}
|
|
|
268190
268209
|
}
|
|
268191
268210
|
return symlinks;
|
|
268192
268211
|
}
|
|
268193
|
-
function getModeForUsageLocation2(file,
|
|
268194
|
-
return getModeForUsageLocationWorker(file,
|
|
268212
|
+
function getModeForUsageLocation2(file, usage4) {
|
|
268213
|
+
return getModeForUsageLocationWorker(file, usage4, getCompilerOptionsForFile(file));
|
|
268195
268214
|
}
|
|
268196
|
-
function getEmitSyntaxForUsageLocation(file,
|
|
268197
|
-
return getEmitSyntaxForUsageLocationWorker(file,
|
|
268215
|
+
function getEmitSyntaxForUsageLocation(file, usage4) {
|
|
268216
|
+
return getEmitSyntaxForUsageLocationWorker(file, usage4, getCompilerOptionsForFile(file));
|
|
268198
268217
|
}
|
|
268199
268218
|
function getModeForResolutionAtIndex2(file, index) {
|
|
268200
268219
|
return getModeForUsageLocation2(file, getModuleNameStringLiteralAt(file, index));
|
|
@@ -286474,23 +286493,23 @@ interface Symbol {
|
|
|
286474
286493
|
addNewFileToTsconfig(program2, changes, oldFile.fileName, targetFile, hostGetCanonicalFileName(host));
|
|
286475
286494
|
}
|
|
286476
286495
|
}
|
|
286477
|
-
function getNewStatementsAndRemoveFromOldFile(oldFile, targetFile,
|
|
286496
|
+
function getNewStatementsAndRemoveFromOldFile(oldFile, targetFile, usage4, changes, toMove, program2, host, preferences, importAdderForNewFile, importAdderForOldFile) {
|
|
286478
286497
|
const checker = program2.getTypeChecker();
|
|
286479
286498
|
const prologueDirectives = takeWhile(oldFile.statements, isPrologueDirective);
|
|
286480
286499
|
const useEsModuleSyntax = !fileShouldUseJavaScriptRequire(targetFile.fileName, program2, host, !!oldFile.commonJsModuleIndicator);
|
|
286481
286500
|
const quotePreference = getQuotePreference(oldFile, preferences);
|
|
286482
|
-
addImportsForMovedSymbols(
|
|
286483
|
-
deleteUnusedOldImports(oldFile, toMove.all,
|
|
286501
|
+
addImportsForMovedSymbols(usage4.oldFileImportsFromTargetFile, targetFile.fileName, importAdderForOldFile, program2);
|
|
286502
|
+
deleteUnusedOldImports(oldFile, toMove.all, usage4.unusedImportsFromOldFile, importAdderForOldFile);
|
|
286484
286503
|
importAdderForOldFile.writeFixes(changes, quotePreference);
|
|
286485
286504
|
deleteMovedStatements(oldFile, toMove.ranges, changes);
|
|
286486
|
-
updateImportsInOtherFiles(changes, program2, host, oldFile,
|
|
286487
|
-
addExportsInOldFile(oldFile,
|
|
286488
|
-
addTargetFileImports(oldFile,
|
|
286505
|
+
updateImportsInOtherFiles(changes, program2, host, oldFile, usage4.movedSymbols, targetFile.fileName, quotePreference);
|
|
286506
|
+
addExportsInOldFile(oldFile, usage4.targetFileImportsFromOldFile, changes, useEsModuleSyntax);
|
|
286507
|
+
addTargetFileImports(oldFile, usage4.oldImportsNeededByTargetFile, usage4.targetFileImportsFromOldFile, checker, program2, importAdderForNewFile);
|
|
286489
286508
|
if (!isFullSourceFile(targetFile) && prologueDirectives.length) {
|
|
286490
286509
|
changes.insertStatementsInNewFile(targetFile.fileName, prologueDirectives, oldFile);
|
|
286491
286510
|
}
|
|
286492
286511
|
importAdderForNewFile.writeFixes(changes, quotePreference);
|
|
286493
|
-
const body = addExports(oldFile, toMove.all, arrayFrom(
|
|
286512
|
+
const body = addExports(oldFile, toMove.all, arrayFrom(usage4.oldFileImportsFromTargetFile.keys()), useEsModuleSyntax);
|
|
286494
286513
|
if (isFullSourceFile(targetFile) && targetFile.statements.length > 0) {
|
|
286495
286514
|
moveStatementsToTargetFile(changes, program2, body, targetFile, toMove);
|
|
286496
286515
|
} else if (isFullSourceFile(targetFile)) {
|
|
@@ -286909,7 +286928,7 @@ interface Symbol {
|
|
|
286909
286928
|
function createNewFileName(oldFile, program2, host, toMove) {
|
|
286910
286929
|
const checker = program2.getTypeChecker();
|
|
286911
286930
|
if (toMove) {
|
|
286912
|
-
const
|
|
286931
|
+
const usage4 = getUsageInfo(oldFile, toMove.all, checker);
|
|
286913
286932
|
const currentDirectory = getDirectoryPath(oldFile.fileName);
|
|
286914
286933
|
const extension2 = extensionFromPath(oldFile.fileName);
|
|
286915
286934
|
const newFileName = combinePaths(
|
|
@@ -286918,7 +286937,7 @@ interface Symbol {
|
|
|
286918
286937
|
// ensures the filename computed below isn't already taken
|
|
286919
286938
|
makeUniqueFilename(
|
|
286920
286939
|
// infers a name for the new file from the symbols being moved
|
|
286921
|
-
inferNewFileName(
|
|
286940
|
+
inferNewFileName(usage4.oldFileImportsFromTargetFile, usage4.movedSymbols),
|
|
286922
286941
|
extension2,
|
|
286923
286942
|
currentDirectory,
|
|
286924
286943
|
host
|
|
@@ -287489,12 +287508,12 @@ interface Symbol {
|
|
|
287489
287508
|
});
|
|
287490
287509
|
function doChange4(oldFile, program2, toMove, changes, host, context3, preferences) {
|
|
287491
287510
|
const checker = program2.getTypeChecker();
|
|
287492
|
-
const
|
|
287511
|
+
const usage4 = getUsageInfo(oldFile, toMove.all, checker);
|
|
287493
287512
|
const newFilename = createNewFileName(oldFile, program2, host, toMove);
|
|
287494
287513
|
const newSourceFile = createFutureSourceFile(newFilename, oldFile.externalModuleIndicator ? 99 : oldFile.commonJsModuleIndicator ? 1 : void 0, program2, host);
|
|
287495
287514
|
const importAdderForOldFile = ts_codefix_exports.createImportAdder(oldFile, context3.program, context3.preferences, context3.host);
|
|
287496
287515
|
const importAdderForNewFile = ts_codefix_exports.createImportAdder(newSourceFile, context3.program, context3.preferences, context3.host);
|
|
287497
|
-
getNewStatementsAndRemoveFromOldFile(oldFile, newSourceFile,
|
|
287516
|
+
getNewStatementsAndRemoveFromOldFile(oldFile, newSourceFile, usage4, changes, toMove, program2, host, preferences, importAdderForNewFile, importAdderForOldFile);
|
|
287498
287517
|
addNewFileToTsconfig(program2, changes, oldFile.fileName, newFilename, hostGetCanonicalFileName(host));
|
|
287499
287518
|
}
|
|
287500
287519
|
var ts_refactor_addOrRemoveBracesToArrowFunction_exports = {};
|
|
@@ -289678,10 +289697,10 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
|
|
|
289678
289697
|
const parameters = [];
|
|
289679
289698
|
const callArguments = [];
|
|
289680
289699
|
let writes;
|
|
289681
|
-
usagesInScope.forEach((
|
|
289700
|
+
usagesInScope.forEach((usage4, name) => {
|
|
289682
289701
|
let typeNode;
|
|
289683
289702
|
if (!isJS) {
|
|
289684
|
-
let type = checker.getTypeOfSymbolAtLocation(
|
|
289703
|
+
let type = checker.getTypeOfSymbolAtLocation(usage4.symbol, usage4.node);
|
|
289685
289704
|
type = checker.getBaseTypeOfLiteralType(type);
|
|
289686
289705
|
typeNode = ts_codefix_exports.typeToAutoImportableTypeNode(
|
|
289687
289706
|
checker,
|
|
@@ -289706,8 +289725,8 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
|
|
|
289706
289725
|
typeNode
|
|
289707
289726
|
);
|
|
289708
289727
|
parameters.push(paramDecl);
|
|
289709
|
-
if (
|
|
289710
|
-
(writes || (writes = [])).push(
|
|
289728
|
+
if (usage4.usage === 2) {
|
|
289729
|
+
(writes || (writes = [])).push(usage4);
|
|
289711
289730
|
}
|
|
289712
289731
|
callArguments.push(factory.createIdentifier(name));
|
|
289713
289732
|
});
|
|
@@ -290591,8 +290610,8 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
|
|
|
290591
290610
|
forEachChild(node, collectUsages);
|
|
290592
290611
|
}
|
|
290593
290612
|
}
|
|
290594
|
-
function recordUsage(n2,
|
|
290595
|
-
const symbolId = recordUsagebySymbol(n2,
|
|
290613
|
+
function recordUsage(n2, usage4, isTypeNode2) {
|
|
290614
|
+
const symbolId = recordUsagebySymbol(n2, usage4, isTypeNode2);
|
|
290596
290615
|
if (symbolId) {
|
|
290597
290616
|
for (let i2 = 0; i2 < scopes.length; i2++) {
|
|
290598
290617
|
const substitution = substitutionsPerScope[i2].get(symbolId);
|
|
@@ -290602,22 +290621,22 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
|
|
|
290602
290621
|
}
|
|
290603
290622
|
}
|
|
290604
290623
|
}
|
|
290605
|
-
function recordUsagebySymbol(identifier,
|
|
290624
|
+
function recordUsagebySymbol(identifier, usage4, isTypeName) {
|
|
290606
290625
|
const symbol = getSymbolReferencedByIdentifier(identifier);
|
|
290607
290626
|
if (!symbol) {
|
|
290608
290627
|
return void 0;
|
|
290609
290628
|
}
|
|
290610
290629
|
const symbolId = getSymbolId(symbol).toString();
|
|
290611
290630
|
const lastUsage = seenUsages.get(symbolId);
|
|
290612
|
-
if (lastUsage && lastUsage >=
|
|
290631
|
+
if (lastUsage && lastUsage >= usage4) {
|
|
290613
290632
|
return symbolId;
|
|
290614
290633
|
}
|
|
290615
|
-
seenUsages.set(symbolId,
|
|
290634
|
+
seenUsages.set(symbolId, usage4);
|
|
290616
290635
|
if (lastUsage) {
|
|
290617
290636
|
for (const perScope of usagesPerScope) {
|
|
290618
290637
|
const prevEntry = perScope.usages.get(identifier.text);
|
|
290619
290638
|
if (prevEntry) {
|
|
290620
|
-
perScope.usages.set(identifier.text, { usage:
|
|
290639
|
+
perScope.usages.set(identifier.text, { usage: usage4, symbol, node: identifier });
|
|
290621
290640
|
}
|
|
290622
290641
|
}
|
|
290623
290642
|
return symbolId;
|
|
@@ -290630,7 +290649,7 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
|
|
|
290630
290649
|
if (rangeContainsStartEnd(enclosingTextRange, declInFile.getStart(), declInFile.end)) {
|
|
290631
290650
|
return void 0;
|
|
290632
290651
|
}
|
|
290633
|
-
if (targetRange.facts & 2 &&
|
|
290652
|
+
if (targetRange.facts & 2 && usage4 === 2) {
|
|
290634
290653
|
const diag2 = createDiagnosticForNode(identifier, Messages5.cannotExtractRangeThatContainsWritesToReferencesLocatedOutsideOfTheTargetRangeInGenerators);
|
|
290635
290654
|
for (const errors of functionErrorsPerScope) {
|
|
290636
290655
|
errors.push(diag2);
|
|
@@ -290662,7 +290681,7 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
|
|
|
290662
290681
|
constantErrorsPerScope[i2].push(diag2);
|
|
290663
290682
|
}
|
|
290664
290683
|
} else {
|
|
290665
|
-
usagesPerScope[i2].usages.set(identifier.text, { usage:
|
|
290684
|
+
usagesPerScope[i2].usages.set(identifier.text, { usage: usage4, symbol, node: identifier });
|
|
290666
290685
|
}
|
|
290667
290686
|
}
|
|
290668
290687
|
}
|
|
@@ -297379,9 +297398,9 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
|
|
|
297379
297398
|
}
|
|
297380
297399
|
const checker = program2.getTypeChecker();
|
|
297381
297400
|
for (const specifier2 of nonTypeOnlySpecifiers) {
|
|
297382
|
-
const isUsedAsValue = ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(specifier2.name, checker, sourceFile, (
|
|
297383
|
-
const symbol = checker.getSymbolAtLocation(
|
|
297384
|
-
return !!symbol && checker.symbolIsValue(symbol) || !isValidTypeOnlyAliasUseSite(
|
|
297401
|
+
const isUsedAsValue = ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(specifier2.name, checker, sourceFile, (usage4) => {
|
|
297402
|
+
const symbol = checker.getSymbolAtLocation(usage4);
|
|
297403
|
+
return !!symbol && checker.symbolIsValue(symbol) || !isValidTypeOnlyAliasUseSite(usage4);
|
|
297385
297404
|
});
|
|
297386
297405
|
if (isUsedAsValue) {
|
|
297387
297406
|
return false;
|
|
@@ -304019,12 +304038,12 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
|
|
|
304019
304038
|
if (references.length === 0 || !declaration.parameters) {
|
|
304020
304039
|
return void 0;
|
|
304021
304040
|
}
|
|
304022
|
-
const
|
|
304041
|
+
const usage4 = createEmptyUsage();
|
|
304023
304042
|
for (const reference of references) {
|
|
304024
304043
|
cancellationToken.throwIfCancellationRequested();
|
|
304025
|
-
calculateUsageOfNode(reference,
|
|
304044
|
+
calculateUsageOfNode(reference, usage4);
|
|
304026
304045
|
}
|
|
304027
|
-
const calls = [...
|
|
304046
|
+
const calls = [...usage4.constructs || [], ...usage4.calls || []];
|
|
304028
304047
|
return declaration.parameters.map((parameter, parameterIndex) => {
|
|
304029
304048
|
const types2 = [];
|
|
304030
304049
|
const isRest = isRestParameter(parameter);
|
|
@@ -304054,99 +304073,99 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
|
|
|
304054
304073
|
});
|
|
304055
304074
|
}
|
|
304056
304075
|
function thisParameter() {
|
|
304057
|
-
const
|
|
304076
|
+
const usage4 = createEmptyUsage();
|
|
304058
304077
|
for (const reference of references) {
|
|
304059
304078
|
cancellationToken.throwIfCancellationRequested();
|
|
304060
|
-
calculateUsageOfNode(reference,
|
|
304079
|
+
calculateUsageOfNode(reference, usage4);
|
|
304061
304080
|
}
|
|
304062
|
-
return combineTypes(
|
|
304081
|
+
return combineTypes(usage4.candidateThisTypes || emptyArray);
|
|
304063
304082
|
}
|
|
304064
304083
|
function inferTypesFromReferencesSingle(references2) {
|
|
304065
|
-
const
|
|
304084
|
+
const usage4 = createEmptyUsage();
|
|
304066
304085
|
for (const reference of references2) {
|
|
304067
304086
|
cancellationToken.throwIfCancellationRequested();
|
|
304068
|
-
calculateUsageOfNode(reference,
|
|
304087
|
+
calculateUsageOfNode(reference, usage4);
|
|
304069
304088
|
}
|
|
304070
|
-
return inferTypes(
|
|
304089
|
+
return inferTypes(usage4);
|
|
304071
304090
|
}
|
|
304072
|
-
function calculateUsageOfNode(node,
|
|
304091
|
+
function calculateUsageOfNode(node, usage4) {
|
|
304073
304092
|
while (isRightSideOfQualifiedNameOrPropertyAccess(node)) {
|
|
304074
304093
|
node = node.parent;
|
|
304075
304094
|
}
|
|
304076
304095
|
switch (node.parent.kind) {
|
|
304077
304096
|
case 245:
|
|
304078
|
-
inferTypeFromExpressionStatement(node,
|
|
304097
|
+
inferTypeFromExpressionStatement(node, usage4);
|
|
304079
304098
|
break;
|
|
304080
304099
|
case 226:
|
|
304081
|
-
|
|
304100
|
+
usage4.isNumber = true;
|
|
304082
304101
|
break;
|
|
304083
304102
|
case 225:
|
|
304084
|
-
inferTypeFromPrefixUnaryExpression(node.parent,
|
|
304103
|
+
inferTypeFromPrefixUnaryExpression(node.parent, usage4);
|
|
304085
304104
|
break;
|
|
304086
304105
|
case 227:
|
|
304087
|
-
inferTypeFromBinaryExpression(node, node.parent,
|
|
304106
|
+
inferTypeFromBinaryExpression(node, node.parent, usage4);
|
|
304088
304107
|
break;
|
|
304089
304108
|
case 297:
|
|
304090
304109
|
case 298:
|
|
304091
|
-
inferTypeFromSwitchStatementLabel(node.parent,
|
|
304110
|
+
inferTypeFromSwitchStatementLabel(node.parent, usage4);
|
|
304092
304111
|
break;
|
|
304093
304112
|
case 214:
|
|
304094
304113
|
case 215:
|
|
304095
304114
|
if (node.parent.expression === node) {
|
|
304096
|
-
inferTypeFromCallExpression(node.parent,
|
|
304115
|
+
inferTypeFromCallExpression(node.parent, usage4);
|
|
304097
304116
|
} else {
|
|
304098
|
-
inferTypeFromContextualType(node,
|
|
304117
|
+
inferTypeFromContextualType(node, usage4);
|
|
304099
304118
|
}
|
|
304100
304119
|
break;
|
|
304101
304120
|
case 212:
|
|
304102
|
-
inferTypeFromPropertyAccessExpression(node.parent,
|
|
304121
|
+
inferTypeFromPropertyAccessExpression(node.parent, usage4);
|
|
304103
304122
|
break;
|
|
304104
304123
|
case 213:
|
|
304105
|
-
inferTypeFromPropertyElementExpression(node.parent, node,
|
|
304124
|
+
inferTypeFromPropertyElementExpression(node.parent, node, usage4);
|
|
304106
304125
|
break;
|
|
304107
304126
|
case 304:
|
|
304108
304127
|
case 305:
|
|
304109
|
-
inferTypeFromPropertyAssignment(node.parent,
|
|
304128
|
+
inferTypeFromPropertyAssignment(node.parent, usage4);
|
|
304110
304129
|
break;
|
|
304111
304130
|
case 173:
|
|
304112
|
-
inferTypeFromPropertyDeclaration(node.parent,
|
|
304131
|
+
inferTypeFromPropertyDeclaration(node.parent, usage4);
|
|
304113
304132
|
break;
|
|
304114
304133
|
case 261: {
|
|
304115
304134
|
const { name, initializer } = node.parent;
|
|
304116
304135
|
if (node === name) {
|
|
304117
304136
|
if (initializer) {
|
|
304118
|
-
addCandidateType(
|
|
304137
|
+
addCandidateType(usage4, checker.getTypeAtLocation(initializer));
|
|
304119
304138
|
}
|
|
304120
304139
|
break;
|
|
304121
304140
|
}
|
|
304122
304141
|
}
|
|
304123
304142
|
// falls through
|
|
304124
304143
|
default:
|
|
304125
|
-
return inferTypeFromContextualType(node,
|
|
304144
|
+
return inferTypeFromContextualType(node, usage4);
|
|
304126
304145
|
}
|
|
304127
304146
|
}
|
|
304128
|
-
function inferTypeFromContextualType(node,
|
|
304147
|
+
function inferTypeFromContextualType(node, usage4) {
|
|
304129
304148
|
if (isExpressionNode(node)) {
|
|
304130
|
-
addCandidateType(
|
|
304149
|
+
addCandidateType(usage4, checker.getContextualType(node));
|
|
304131
304150
|
}
|
|
304132
304151
|
}
|
|
304133
|
-
function inferTypeFromExpressionStatement(node,
|
|
304134
|
-
addCandidateType(
|
|
304152
|
+
function inferTypeFromExpressionStatement(node, usage4) {
|
|
304153
|
+
addCandidateType(usage4, isCallExpression(node) ? checker.getVoidType() : checker.getAnyType());
|
|
304135
304154
|
}
|
|
304136
|
-
function inferTypeFromPrefixUnaryExpression(node,
|
|
304155
|
+
function inferTypeFromPrefixUnaryExpression(node, usage4) {
|
|
304137
304156
|
switch (node.operator) {
|
|
304138
304157
|
case 46:
|
|
304139
304158
|
case 47:
|
|
304140
304159
|
case 41:
|
|
304141
304160
|
case 55:
|
|
304142
|
-
|
|
304161
|
+
usage4.isNumber = true;
|
|
304143
304162
|
break;
|
|
304144
304163
|
case 40:
|
|
304145
|
-
|
|
304164
|
+
usage4.isNumberOrString = true;
|
|
304146
304165
|
break;
|
|
304147
304166
|
}
|
|
304148
304167
|
}
|
|
304149
|
-
function inferTypeFromBinaryExpression(node, parent2,
|
|
304168
|
+
function inferTypeFromBinaryExpression(node, parent2, usage4) {
|
|
304150
304169
|
switch (parent2.operatorToken.kind) {
|
|
304151
304170
|
// ExponentiationOperator
|
|
304152
304171
|
case 43:
|
|
@@ -304189,23 +304208,23 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
|
|
|
304189
304208
|
case 34:
|
|
304190
304209
|
const operandType = checker.getTypeAtLocation(parent2.left === node ? parent2.right : parent2.left);
|
|
304191
304210
|
if (operandType.flags & 1056) {
|
|
304192
|
-
addCandidateType(
|
|
304211
|
+
addCandidateType(usage4, operandType);
|
|
304193
304212
|
} else {
|
|
304194
|
-
|
|
304213
|
+
usage4.isNumber = true;
|
|
304195
304214
|
}
|
|
304196
304215
|
break;
|
|
304197
304216
|
case 65:
|
|
304198
304217
|
case 40:
|
|
304199
304218
|
const otherOperandType = checker.getTypeAtLocation(parent2.left === node ? parent2.right : parent2.left);
|
|
304200
304219
|
if (otherOperandType.flags & 1056) {
|
|
304201
|
-
addCandidateType(
|
|
304220
|
+
addCandidateType(usage4, otherOperandType);
|
|
304202
304221
|
} else if (otherOperandType.flags & 296) {
|
|
304203
|
-
|
|
304222
|
+
usage4.isNumber = true;
|
|
304204
304223
|
} else if (otherOperandType.flags & 402653316) {
|
|
304205
|
-
|
|
304224
|
+
usage4.isString = true;
|
|
304206
304225
|
} else if (otherOperandType.flags & 1) {
|
|
304207
304226
|
} else {
|
|
304208
|
-
|
|
304227
|
+
usage4.isNumberOrString = true;
|
|
304209
304228
|
}
|
|
304210
304229
|
break;
|
|
304211
304230
|
// AssignmentOperators
|
|
@@ -304217,11 +304236,11 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
|
|
|
304217
304236
|
case 77:
|
|
304218
304237
|
case 78:
|
|
304219
304238
|
case 76:
|
|
304220
|
-
addCandidateType(
|
|
304239
|
+
addCandidateType(usage4, checker.getTypeAtLocation(parent2.left === node ? parent2.right : parent2.left));
|
|
304221
304240
|
break;
|
|
304222
304241
|
case 103:
|
|
304223
304242
|
if (node === parent2.left) {
|
|
304224
|
-
|
|
304243
|
+
usage4.isString = true;
|
|
304225
304244
|
}
|
|
304226
304245
|
break;
|
|
304227
304246
|
// LogicalOperator Or NullishCoalescing
|
|
@@ -304232,7 +304251,7 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
|
|
|
304232
304251
|
/*excludeCompoundAssignment*/
|
|
304233
304252
|
true
|
|
304234
304253
|
))) {
|
|
304235
|
-
addCandidateType(
|
|
304254
|
+
addCandidateType(usage4, checker.getTypeAtLocation(parent2.right));
|
|
304236
304255
|
}
|
|
304237
304256
|
break;
|
|
304238
304257
|
case 56:
|
|
@@ -304241,10 +304260,10 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
|
|
|
304241
304260
|
break;
|
|
304242
304261
|
}
|
|
304243
304262
|
}
|
|
304244
|
-
function inferTypeFromSwitchStatementLabel(parent2,
|
|
304245
|
-
addCandidateType(
|
|
304263
|
+
function inferTypeFromSwitchStatementLabel(parent2, usage4) {
|
|
304264
|
+
addCandidateType(usage4, checker.getTypeAtLocation(parent2.parent.parent.expression));
|
|
304246
304265
|
}
|
|
304247
|
-
function inferTypeFromCallExpression(parent2,
|
|
304266
|
+
function inferTypeFromCallExpression(parent2, usage4) {
|
|
304248
304267
|
const call = {
|
|
304249
304268
|
argumentTypes: [],
|
|
304250
304269
|
return_: createEmptyUsage()
|
|
@@ -304256,41 +304275,41 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
|
|
|
304256
304275
|
}
|
|
304257
304276
|
calculateUsageOfNode(parent2, call.return_);
|
|
304258
304277
|
if (parent2.kind === 214) {
|
|
304259
|
-
(
|
|
304278
|
+
(usage4.calls || (usage4.calls = [])).push(call);
|
|
304260
304279
|
} else {
|
|
304261
|
-
(
|
|
304280
|
+
(usage4.constructs || (usage4.constructs = [])).push(call);
|
|
304262
304281
|
}
|
|
304263
304282
|
}
|
|
304264
|
-
function inferTypeFromPropertyAccessExpression(parent2,
|
|
304283
|
+
function inferTypeFromPropertyAccessExpression(parent2, usage4) {
|
|
304265
304284
|
const name = escapeLeadingUnderscores(parent2.name.text);
|
|
304266
|
-
if (!
|
|
304267
|
-
|
|
304285
|
+
if (!usage4.properties) {
|
|
304286
|
+
usage4.properties = /* @__PURE__ */ new Map();
|
|
304268
304287
|
}
|
|
304269
|
-
const propertyUsage =
|
|
304288
|
+
const propertyUsage = usage4.properties.get(name) || createEmptyUsage();
|
|
304270
304289
|
calculateUsageOfNode(parent2, propertyUsage);
|
|
304271
|
-
|
|
304290
|
+
usage4.properties.set(name, propertyUsage);
|
|
304272
304291
|
}
|
|
304273
|
-
function inferTypeFromPropertyElementExpression(parent2, node,
|
|
304292
|
+
function inferTypeFromPropertyElementExpression(parent2, node, usage4) {
|
|
304274
304293
|
if (node === parent2.argumentExpression) {
|
|
304275
|
-
|
|
304294
|
+
usage4.isNumberOrString = true;
|
|
304276
304295
|
return;
|
|
304277
304296
|
} else {
|
|
304278
304297
|
const indexType = checker.getTypeAtLocation(parent2.argumentExpression);
|
|
304279
304298
|
const indexUsage = createEmptyUsage();
|
|
304280
304299
|
calculateUsageOfNode(parent2, indexUsage);
|
|
304281
304300
|
if (indexType.flags & 296) {
|
|
304282
|
-
|
|
304301
|
+
usage4.numberIndex = indexUsage;
|
|
304283
304302
|
} else {
|
|
304284
|
-
|
|
304303
|
+
usage4.stringIndex = indexUsage;
|
|
304285
304304
|
}
|
|
304286
304305
|
}
|
|
304287
304306
|
}
|
|
304288
|
-
function inferTypeFromPropertyAssignment(assignment,
|
|
304307
|
+
function inferTypeFromPropertyAssignment(assignment, usage4) {
|
|
304289
304308
|
const nodeWithRealType = isVariableDeclaration(assignment.parent.parent) ? assignment.parent.parent : assignment.parent;
|
|
304290
|
-
addCandidateThisType(
|
|
304309
|
+
addCandidateThisType(usage4, checker.getTypeAtLocation(nodeWithRealType));
|
|
304291
304310
|
}
|
|
304292
|
-
function inferTypeFromPropertyDeclaration(declaration,
|
|
304293
|
-
addCandidateThisType(
|
|
304311
|
+
function inferTypeFromPropertyDeclaration(declaration, usage4) {
|
|
304312
|
+
addCandidateThisType(usage4, checker.getTypeAtLocation(declaration.parent));
|
|
304294
304313
|
}
|
|
304295
304314
|
function removeLowPriorityInferences(inferences, priorities) {
|
|
304296
304315
|
const toRemove = [];
|
|
@@ -304304,8 +304323,8 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
|
|
|
304304
304323
|
}
|
|
304305
304324
|
return inferences.filter((i2) => toRemove.every((f2) => !f2(i2)));
|
|
304306
304325
|
}
|
|
304307
|
-
function combineFromUsage(
|
|
304308
|
-
return combineTypes(inferTypes(
|
|
304326
|
+
function combineFromUsage(usage4) {
|
|
304327
|
+
return combineTypes(inferTypes(usage4));
|
|
304309
304328
|
}
|
|
304310
304329
|
function combineTypes(inferences) {
|
|
304311
304330
|
if (!inferences.length) return checker.getAnyType();
|
|
@@ -304400,26 +304419,26 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
|
|
|
304400
304419
|
indexInfos
|
|
304401
304420
|
);
|
|
304402
304421
|
}
|
|
304403
|
-
function inferTypes(
|
|
304422
|
+
function inferTypes(usage4) {
|
|
304404
304423
|
var _a9, _b3, _c3;
|
|
304405
304424
|
const types2 = [];
|
|
304406
|
-
if (
|
|
304425
|
+
if (usage4.isNumber) {
|
|
304407
304426
|
types2.push(checker.getNumberType());
|
|
304408
304427
|
}
|
|
304409
|
-
if (
|
|
304428
|
+
if (usage4.isString) {
|
|
304410
304429
|
types2.push(checker.getStringType());
|
|
304411
304430
|
}
|
|
304412
|
-
if (
|
|
304431
|
+
if (usage4.isNumberOrString) {
|
|
304413
304432
|
types2.push(checker.getUnionType([checker.getStringType(), checker.getNumberType()]));
|
|
304414
304433
|
}
|
|
304415
|
-
if (
|
|
304416
|
-
types2.push(checker.createArrayType(combineFromUsage(
|
|
304434
|
+
if (usage4.numberIndex) {
|
|
304435
|
+
types2.push(checker.createArrayType(combineFromUsage(usage4.numberIndex)));
|
|
304417
304436
|
}
|
|
304418
|
-
if (((_a9 =
|
|
304419
|
-
types2.push(inferStructuralType(
|
|
304437
|
+
if (((_a9 = usage4.properties) == null ? void 0 : _a9.size) || ((_b3 = usage4.constructs) == null ? void 0 : _b3.length) || usage4.stringIndex) {
|
|
304438
|
+
types2.push(inferStructuralType(usage4));
|
|
304420
304439
|
}
|
|
304421
|
-
const candidateTypes = (
|
|
304422
|
-
const callsType = ((_c3 =
|
|
304440
|
+
const candidateTypes = (usage4.candidateTypes || []).map((t2) => checker.getBaseTypeOfLiteralType(t2));
|
|
304441
|
+
const callsType = ((_c3 = usage4.calls) == null ? void 0 : _c3.length) ? inferStructuralType(usage4) : void 0;
|
|
304423
304442
|
if (callsType && candidateTypes) {
|
|
304424
304443
|
types2.push(checker.getUnionType(
|
|
304425
304444
|
[callsType, ...candidateTypes],
|
|
@@ -304434,23 +304453,23 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
|
|
|
304434
304453
|
types2.push(...candidateTypes);
|
|
304435
304454
|
}
|
|
304436
304455
|
}
|
|
304437
|
-
types2.push(...inferNamedTypesFromProperties(
|
|
304456
|
+
types2.push(...inferNamedTypesFromProperties(usage4));
|
|
304438
304457
|
return types2;
|
|
304439
304458
|
}
|
|
304440
|
-
function inferStructuralType(
|
|
304459
|
+
function inferStructuralType(usage4) {
|
|
304441
304460
|
const members = /* @__PURE__ */ new Map();
|
|
304442
|
-
if (
|
|
304443
|
-
|
|
304461
|
+
if (usage4.properties) {
|
|
304462
|
+
usage4.properties.forEach((u2, name) => {
|
|
304444
304463
|
const symbol = checker.createSymbol(4, name);
|
|
304445
304464
|
symbol.links.type = combineFromUsage(u2);
|
|
304446
304465
|
members.set(name, symbol);
|
|
304447
304466
|
});
|
|
304448
304467
|
}
|
|
304449
|
-
const callSignatures =
|
|
304450
|
-
const constructSignatures =
|
|
304451
|
-
const indexInfos =
|
|
304468
|
+
const callSignatures = usage4.calls ? [getSignatureFromCalls(usage4.calls)] : [];
|
|
304469
|
+
const constructSignatures = usage4.constructs ? [getSignatureFromCalls(usage4.constructs)] : [];
|
|
304470
|
+
const indexInfos = usage4.stringIndex ? [checker.createIndexInfo(
|
|
304452
304471
|
checker.getStringType(),
|
|
304453
|
-
combineFromUsage(
|
|
304472
|
+
combineFromUsage(usage4.stringIndex),
|
|
304454
304473
|
/*isReadonly*/
|
|
304455
304474
|
false
|
|
304456
304475
|
)] : [];
|
|
@@ -304463,17 +304482,17 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
|
|
|
304463
304482
|
indexInfos
|
|
304464
304483
|
);
|
|
304465
304484
|
}
|
|
304466
|
-
function inferNamedTypesFromProperties(
|
|
304467
|
-
if (!
|
|
304468
|
-
const types2 = builtins.filter((t2) => allPropertiesAreAssignableToUsage(t2,
|
|
304485
|
+
function inferNamedTypesFromProperties(usage4) {
|
|
304486
|
+
if (!usage4.properties || !usage4.properties.size) return [];
|
|
304487
|
+
const types2 = builtins.filter((t2) => allPropertiesAreAssignableToUsage(t2, usage4));
|
|
304469
304488
|
if (0 < types2.length && types2.length < 3) {
|
|
304470
|
-
return types2.map((t2) => inferInstantiationFromUsage(t2,
|
|
304489
|
+
return types2.map((t2) => inferInstantiationFromUsage(t2, usage4));
|
|
304471
304490
|
}
|
|
304472
304491
|
return [];
|
|
304473
304492
|
}
|
|
304474
|
-
function allPropertiesAreAssignableToUsage(type,
|
|
304475
|
-
if (!
|
|
304476
|
-
return !forEachEntry(
|
|
304493
|
+
function allPropertiesAreAssignableToUsage(type, usage4) {
|
|
304494
|
+
if (!usage4.properties) return false;
|
|
304495
|
+
return !forEachEntry(usage4.properties, (propUsage, name) => {
|
|
304477
304496
|
const source3 = checker.getTypeOfPropertyOfType(type, name);
|
|
304478
304497
|
if (!source3) {
|
|
304479
304498
|
return true;
|
|
@@ -304490,15 +304509,15 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
|
|
|
304490
304509
|
}
|
|
304491
304510
|
});
|
|
304492
304511
|
}
|
|
304493
|
-
function inferInstantiationFromUsage(type,
|
|
304494
|
-
if (!(getObjectFlags(type) & 4) || !
|
|
304512
|
+
function inferInstantiationFromUsage(type, usage4) {
|
|
304513
|
+
if (!(getObjectFlags(type) & 4) || !usage4.properties) {
|
|
304495
304514
|
return type;
|
|
304496
304515
|
}
|
|
304497
304516
|
const generic = type.target;
|
|
304498
304517
|
const singleTypeParameter = singleOrUndefined(generic.typeParameters);
|
|
304499
304518
|
if (!singleTypeParameter) return type;
|
|
304500
304519
|
const types2 = [];
|
|
304501
|
-
|
|
304520
|
+
usage4.properties.forEach((propUsage, name) => {
|
|
304502
304521
|
const genericPropertyType = checker.getTypeOfPropertyOfType(generic, name);
|
|
304503
304522
|
Debug.assert(!!genericPropertyType, "generic should have all the properties of its reference.");
|
|
304504
304523
|
types2.push(...inferTypeParameters(genericPropertyType, combineFromUsage(propUsage), singleTypeParameter));
|
|
@@ -304599,14 +304618,14 @@ ${newComment.split("\n").map((c2) => ` * ${c2}`).join("\n")}
|
|
|
304599
304618
|
/* None */
|
|
304600
304619
|
);
|
|
304601
304620
|
}
|
|
304602
|
-
function addCandidateType(
|
|
304621
|
+
function addCandidateType(usage4, type) {
|
|
304603
304622
|
if (type && !(type.flags & 1) && !(type.flags & 131072)) {
|
|
304604
|
-
(
|
|
304623
|
+
(usage4.candidateTypes || (usage4.candidateTypes = [])).push(type);
|
|
304605
304624
|
}
|
|
304606
304625
|
}
|
|
304607
|
-
function addCandidateThisType(
|
|
304626
|
+
function addCandidateThisType(usage4, type) {
|
|
304608
304627
|
if (type && !(type.flags & 1) && !(type.flags & 131072)) {
|
|
304609
|
-
(
|
|
304628
|
+
(usage4.candidateThisTypes || (usage4.candidateThisTypes = [])).push(type);
|
|
304610
304629
|
}
|
|
304611
304630
|
}
|
|
304612
304631
|
}
|
|
@@ -324805,10 +324824,10 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
324805
324824
|
Debug.assertIsDefined(originalProgram, "no original program found");
|
|
324806
324825
|
const originalProgramTypeChecker = originalProgram.getTypeChecker();
|
|
324807
324826
|
const usageInfoRange = getUsageInfoRangeForPasteEdits(copiedFrom);
|
|
324808
|
-
const
|
|
324827
|
+
const usage4 = getUsageInfo(copiedFrom.file, statements, originalProgramTypeChecker, getExistingLocals(updatedFile, statements, originalProgramTypeChecker), usageInfoRange);
|
|
324809
324828
|
const useEsModuleSyntax = !fileShouldUseJavaScriptRequire(targetFile.fileName, originalProgram, host, !!copiedFrom.file.commonJsModuleIndicator);
|
|
324810
|
-
addExportsInOldFile(copiedFrom.file,
|
|
324811
|
-
addTargetFileImports(copiedFrom.file,
|
|
324829
|
+
addExportsInOldFile(copiedFrom.file, usage4.targetFileImportsFromOldFile, changes, useEsModuleSyntax);
|
|
324830
|
+
addTargetFileImports(copiedFrom.file, usage4.oldImportsNeededByTargetFile, usage4.targetFileImportsFromOldFile, originalProgramTypeChecker, updatedProgram, importAdder);
|
|
324812
324831
|
} else {
|
|
324813
324832
|
const context3 = {
|
|
324814
324833
|
sourceFile: updatedFile,
|
|
@@ -465719,11 +465738,11 @@ var init_AbstractChatCompletionRunner = __esm({
|
|
|
465719
465738
|
prompt_tokens: 0,
|
|
465720
465739
|
total_tokens: 0
|
|
465721
465740
|
};
|
|
465722
|
-
for (const { usage:
|
|
465723
|
-
if (
|
|
465724
|
-
total.completion_tokens +=
|
|
465725
|
-
total.prompt_tokens +=
|
|
465726
|
-
total.total_tokens +=
|
|
465741
|
+
for (const { usage: usage4 } of this._chatCompletions) {
|
|
465742
|
+
if (usage4) {
|
|
465743
|
+
total.completion_tokens += usage4.completion_tokens;
|
|
465744
|
+
total.prompt_tokens += usage4.prompt_tokens;
|
|
465745
|
+
total.total_tokens += usage4.total_tokens;
|
|
465727
465746
|
}
|
|
465728
465747
|
}
|
|
465729
465748
|
return total;
|
|
@@ -471025,11 +471044,11 @@ var init_compose_scenes_skills = __esm({
|
|
|
471025
471044
|
if (!text) {
|
|
471026
471045
|
throw new ComposeBeatError("no-text-block", "Gemini response had no text content.");
|
|
471027
471046
|
}
|
|
471028
|
-
const
|
|
471047
|
+
const usage4 = response.response.usageMetadata;
|
|
471029
471048
|
return {
|
|
471030
471049
|
text,
|
|
471031
|
-
inputTokens:
|
|
471032
|
-
outputTokens:
|
|
471050
|
+
inputTokens: usage4?.promptTokenCount ?? 0,
|
|
471051
|
+
outputTokens: usage4?.candidatesTokenCount ?? 0
|
|
471033
471052
|
};
|
|
471034
471053
|
};
|
|
471035
471054
|
CONFIG_PROVIDER_BY_COMPOSER = {
|
|
@@ -486968,6 +486987,109 @@ var init_openrouter = __esm({
|
|
|
486968
486987
|
}
|
|
486969
486988
|
});
|
|
486970
486989
|
|
|
486990
|
+
// ../cli/src/agent/adapters/evolink.ts
|
|
486991
|
+
var evolink_exports = {};
|
|
486992
|
+
__export(evolink_exports, {
|
|
486993
|
+
EvolinkAdapter: () => EvolinkAdapter
|
|
486994
|
+
});
|
|
486995
|
+
var EvolinkAdapter;
|
|
486996
|
+
var init_evolink = __esm({
|
|
486997
|
+
"../cli/src/agent/adapters/evolink.ts"() {
|
|
486998
|
+
"use strict";
|
|
486999
|
+
init_openai2();
|
|
487000
|
+
EvolinkAdapter = class {
|
|
487001
|
+
provider = "evolink";
|
|
487002
|
+
client = null;
|
|
487003
|
+
model = "gpt-5.2";
|
|
487004
|
+
async initialize(apiKey) {
|
|
487005
|
+
this.client = new openai_default({
|
|
487006
|
+
apiKey,
|
|
487007
|
+
baseURL: "https://direct.evolink.ai/v1",
|
|
487008
|
+
defaultHeaders: {
|
|
487009
|
+
"HTTP-Referer": "https://vibeframe.dev",
|
|
487010
|
+
"X-Title": "VibeFrame"
|
|
487011
|
+
}
|
|
487012
|
+
});
|
|
487013
|
+
}
|
|
487014
|
+
isInitialized() {
|
|
487015
|
+
return this.client !== null;
|
|
487016
|
+
}
|
|
487017
|
+
setModel(model) {
|
|
487018
|
+
this.model = model;
|
|
487019
|
+
}
|
|
487020
|
+
async chat(messages, tools2) {
|
|
487021
|
+
if (!this.client) {
|
|
487022
|
+
throw new Error("Evolink adapter not initialized");
|
|
487023
|
+
}
|
|
487024
|
+
const openaiMessages = messages.map(
|
|
487025
|
+
(msg) => {
|
|
487026
|
+
if (msg.role === "tool") {
|
|
487027
|
+
return {
|
|
487028
|
+
role: "tool",
|
|
487029
|
+
tool_call_id: msg.toolCallId,
|
|
487030
|
+
content: msg.content
|
|
487031
|
+
};
|
|
487032
|
+
}
|
|
487033
|
+
if (msg.role === "assistant" && msg.toolCalls) {
|
|
487034
|
+
return {
|
|
487035
|
+
role: "assistant",
|
|
487036
|
+
content: msg.content || null,
|
|
487037
|
+
tool_calls: msg.toolCalls.map((tc) => ({
|
|
487038
|
+
id: tc.id,
|
|
487039
|
+
type: "function",
|
|
487040
|
+
function: {
|
|
487041
|
+
name: tc.name,
|
|
487042
|
+
arguments: JSON.stringify(tc.arguments)
|
|
487043
|
+
}
|
|
487044
|
+
}))
|
|
487045
|
+
};
|
|
487046
|
+
}
|
|
487047
|
+
return {
|
|
487048
|
+
role: msg.role,
|
|
487049
|
+
content: msg.content
|
|
487050
|
+
};
|
|
487051
|
+
}
|
|
487052
|
+
);
|
|
487053
|
+
const openaiTools = tools2.map((tool) => ({
|
|
487054
|
+
type: "function",
|
|
487055
|
+
function: {
|
|
487056
|
+
name: tool.name,
|
|
487057
|
+
description: tool.description,
|
|
487058
|
+
parameters: tool.parameters
|
|
487059
|
+
}
|
|
487060
|
+
}));
|
|
487061
|
+
const response = await this.client.chat.completions.create({
|
|
487062
|
+
model: this.model,
|
|
487063
|
+
messages: openaiMessages,
|
|
487064
|
+
tools: openaiTools.length > 0 ? openaiTools : void 0,
|
|
487065
|
+
tool_choice: openaiTools.length > 0 ? "auto" : void 0
|
|
487066
|
+
});
|
|
487067
|
+
const choice = response.choices[0];
|
|
487068
|
+
const message = choice.message;
|
|
487069
|
+
let toolCalls;
|
|
487070
|
+
if (message.tool_calls && message.tool_calls.length > 0) {
|
|
487071
|
+
toolCalls = message.tool_calls.map((tc) => ({
|
|
487072
|
+
id: tc.id,
|
|
487073
|
+
name: tc.function.name,
|
|
487074
|
+
arguments: JSON.parse(tc.function.arguments)
|
|
487075
|
+
}));
|
|
487076
|
+
}
|
|
487077
|
+
let finishReason = "stop";
|
|
487078
|
+
if (choice.finish_reason === "tool_calls") {
|
|
487079
|
+
finishReason = "tool_calls";
|
|
487080
|
+
} else if (choice.finish_reason === "length") {
|
|
487081
|
+
finishReason = "length";
|
|
487082
|
+
}
|
|
487083
|
+
return {
|
|
487084
|
+
content: message.content || "",
|
|
487085
|
+
toolCalls,
|
|
487086
|
+
finishReason
|
|
487087
|
+
};
|
|
487088
|
+
}
|
|
487089
|
+
};
|
|
487090
|
+
}
|
|
487091
|
+
});
|
|
487092
|
+
|
|
486971
487093
|
// ../cli/src/commands/detect.ts
|
|
486972
487094
|
var detect_exports = {};
|
|
486973
487095
|
__export(detect_exports, {
|
|
@@ -493542,6 +493664,7 @@ init_gemini2();
|
|
|
493542
493664
|
init_ollama2();
|
|
493543
493665
|
init_xai();
|
|
493544
493666
|
init_openrouter();
|
|
493667
|
+
init_evolink();
|
|
493545
493668
|
async function createAdapter(provider) {
|
|
493546
493669
|
switch (provider) {
|
|
493547
493670
|
case "openai": {
|
|
@@ -493568,6 +493691,10 @@ async function createAdapter(provider) {
|
|
|
493568
493691
|
const { OpenRouterAdapter: OpenRouterAdapter2 } = await Promise.resolve().then(() => (init_openrouter(), openrouter_exports));
|
|
493569
493692
|
return new OpenRouterAdapter2();
|
|
493570
493693
|
}
|
|
493694
|
+
case "evolink": {
|
|
493695
|
+
const { EvolinkAdapter: EvolinkAdapter2 } = await Promise.resolve().then(() => (init_evolink(), evolink_exports));
|
|
493696
|
+
return new EvolinkAdapter2();
|
|
493697
|
+
}
|
|
493571
493698
|
default:
|
|
493572
493699
|
throw new Error(`Unknown provider: ${provider}`);
|
|
493573
493700
|
}
|
|
@@ -499730,7 +499857,49 @@ function makeElicitFn(server3, env4 = process.env) {
|
|
|
499730
499857
|
);
|
|
499731
499858
|
}
|
|
499732
499859
|
|
|
499860
|
+
// src/cli-flags.ts
|
|
499861
|
+
function usage3(version) {
|
|
499862
|
+
return [
|
|
499863
|
+
`VibeFrame MCP Server v${version}`,
|
|
499864
|
+
"",
|
|
499865
|
+
"AI-native video editing exposed over the Model Context Protocol (stdio).",
|
|
499866
|
+
"It is launched by an MCP client (Claude Desktop, Cursor, Claude Code), not",
|
|
499867
|
+
"run directly \u2014 there is normally nothing to interact with on the terminal.",
|
|
499868
|
+
"",
|
|
499869
|
+
"Add it to your client config:",
|
|
499870
|
+
"",
|
|
499871
|
+
" {",
|
|
499872
|
+
' "mcpServers": {',
|
|
499873
|
+
' "vibeframe": {',
|
|
499874
|
+
' "command": "npx",',
|
|
499875
|
+
' "args": ["-y", "@vibeframe/mcp-server"]',
|
|
499876
|
+
" }",
|
|
499877
|
+
" }",
|
|
499878
|
+
" }",
|
|
499879
|
+
"",
|
|
499880
|
+
"Options:",
|
|
499881
|
+
" -h, --help Show this help and exit",
|
|
499882
|
+
" -V, --version Print the version and exit",
|
|
499883
|
+
"",
|
|
499884
|
+
"Docs: https://github.com/vericontext/vibeframe#mcp-integration"
|
|
499885
|
+
].join("\n");
|
|
499886
|
+
}
|
|
499887
|
+
function handleCliFlags(argv, version) {
|
|
499888
|
+
if (argv.includes("--help") || argv.includes("-h")) {
|
|
499889
|
+
console.log(usage3(version));
|
|
499890
|
+
return true;
|
|
499891
|
+
}
|
|
499892
|
+
if (argv.includes("--version") || argv.includes("-V")) {
|
|
499893
|
+
console.log(version);
|
|
499894
|
+
return true;
|
|
499895
|
+
}
|
|
499896
|
+
return false;
|
|
499897
|
+
}
|
|
499898
|
+
|
|
499733
499899
|
// src/index.ts
|
|
499900
|
+
if (handleCliFlags(process.argv.slice(2), "0.113.9")) {
|
|
499901
|
+
process.exit(0);
|
|
499902
|
+
}
|
|
499734
499903
|
console.log = (...args) => console.error(...args);
|
|
499735
499904
|
console.info = (...args) => console.error(...args);
|
|
499736
499905
|
console.debug = (...args) => console.error(...args);
|
|
@@ -499741,7 +499910,7 @@ var server2 = new Server(
|
|
|
499741
499910
|
{
|
|
499742
499911
|
name: "vibeframe",
|
|
499743
499912
|
// Stamped with the package version by build.js at bundle time.
|
|
499744
|
-
version: "0.113.
|
|
499913
|
+
version: "0.113.9"
|
|
499745
499914
|
},
|
|
499746
499915
|
{
|
|
499747
499916
|
capabilities: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibeframe/mcp-server",
|
|
3
|
-
"version": "0.113.
|
|
3
|
+
"version": "0.113.9",
|
|
4
4
|
"description": "VibeFrame MCP Server - AI-native video editing via Model Context Protocol",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"tsx": "^4.21.0",
|
|
61
61
|
"typescript": "^5.3.3",
|
|
62
62
|
"vitest": "^1.2.2",
|
|
63
|
-
"@vibeframe/
|
|
64
|
-
"@vibeframe/
|
|
63
|
+
"@vibeframe/cli": "0.113.9",
|
|
64
|
+
"@vibeframe/core": "0.113.9"
|
|
65
65
|
},
|
|
66
66
|
"engines": {
|
|
67
67
|
"node": ">=20"
|