@skaldapp/monaco-sfc 1.1.44 → 1.1.46
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/vue.worker.js +1031 -1096
- package/package.json +6 -6
package/dist/vue.worker.js
CHANGED
|
@@ -9618,6 +9618,7 @@ var require_names = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
9618
9618
|
asFunctionalSlot: "",
|
|
9619
9619
|
directiveBindingRestFields: "",
|
|
9620
9620
|
functionalComponentArgsRest: "",
|
|
9621
|
+
omit: "",
|
|
9621
9622
|
tryAsConstant: "",
|
|
9622
9623
|
vFor: "",
|
|
9623
9624
|
vSlot: "",
|
|
@@ -18104,7 +18105,7 @@ var require_elementProps = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
18104
18105
|
var elementEvents_1 = require_elementEvents();
|
|
18105
18106
|
var interpolation_1 = require_interpolation();
|
|
18106
18107
|
var objectProperty_1 = require_objectProperty();
|
|
18107
|
-
function* generateElementProps(options, ctx, node, props,
|
|
18108
|
+
function* generateElementProps(options, ctx, node, props, checkUnknownProps, failedPropExps) {
|
|
18108
18109
|
const isComponent = node.tagType === CompilerDOM.ElementTypes.COMPONENT;
|
|
18109
18110
|
for (const prop of props) if (prop.type === CompilerDOM.NodeTypes.DIRECTIVE && prop.name === "on") {
|
|
18110
18111
|
if (prop.arg?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION && !prop.arg.loc.source.startsWith("[") && !prop.arg.loc.source.endsWith("]")) {
|
|
@@ -18117,17 +18118,17 @@ var require_elementProps = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
18117
18118
|
} else yield `...{ '${(0, shared_1.camelize)("on-" + prop.arg.loc.source)}': {} as any },`;
|
|
18118
18119
|
yield utils_1.newLine;
|
|
18119
18120
|
} else if (prop.arg?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION && prop.exp?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION && prop.arg.loc.source.startsWith("[") && prop.arg.loc.source.endsWith("]")) {
|
|
18120
|
-
|
|
18121
|
+
failedPropExps?.push({
|
|
18121
18122
|
node: prop.arg,
|
|
18122
18123
|
prefix: `(`,
|
|
18123
18124
|
suffix: `)`
|
|
18124
18125
|
});
|
|
18125
|
-
|
|
18126
|
+
failedPropExps?.push({
|
|
18126
18127
|
node: prop.exp,
|
|
18127
18128
|
prefix: `() => {`,
|
|
18128
18129
|
suffix: `}`
|
|
18129
18130
|
});
|
|
18130
|
-
} else if (!prop.arg && prop.exp?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION)
|
|
18131
|
+
} else if (!prop.arg && prop.exp?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION) failedPropExps?.push({
|
|
18131
18132
|
node: prop.exp,
|
|
18132
18133
|
prefix: `(`,
|
|
18133
18134
|
suffix: `)`
|
|
@@ -18138,7 +18139,7 @@ var require_elementProps = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
18138
18139
|
if (prop.arg?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION) propName = prop.arg.constType === CompilerDOM.ConstantTypes.CAN_STRINGIFY ? prop.arg.content : prop.arg.loc.source;
|
|
18139
18140
|
else propName = getModelPropName(node, options.vueCompilerOptions);
|
|
18140
18141
|
if (propName === void 0 || options.vueCompilerOptions.dataAttributes.some((pattern) => (0, picomatch_1.isMatch)(propName, pattern))) {
|
|
18141
|
-
if (prop.exp && prop.exp.constType !== CompilerDOM.ConstantTypes.CAN_STRINGIFY)
|
|
18142
|
+
if (prop.exp && prop.exp.constType !== CompilerDOM.ConstantTypes.CAN_STRINGIFY) failedPropExps?.push({
|
|
18142
18143
|
node: prop.exp,
|
|
18143
18144
|
prefix: `(`,
|
|
18144
18145
|
suffix: `)`
|
|
@@ -18148,7 +18149,7 @@ var require_elementProps = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
18148
18149
|
if (prop.name === "bind" && prop.modifiers.some((m) => m.content === "prop" || m.content === "attr")) propName = propName.slice(1);
|
|
18149
18150
|
const shouldSpread = propName === "style" || propName === "class";
|
|
18150
18151
|
const shouldCamelize = getShouldCamelize(options, node, prop, propName);
|
|
18151
|
-
const features = getPropsCodeFeatures(
|
|
18152
|
+
const features = getPropsCodeFeatures(checkUnknownProps);
|
|
18152
18153
|
if (shouldSpread) yield `...{ `;
|
|
18153
18154
|
const token = yield* (0, boundary_1.startBoundary)("template", prop.loc.start.offset, codeFeatures_1.codeFeatures.verification);
|
|
18154
18155
|
if (prop.arg) yield* (0, objectProperty_1.generateObjectProperty)(options, ctx, propName, prop.arg.loc.start.offset, features, shouldCamelize);
|
|
@@ -18174,7 +18175,7 @@ var require_elementProps = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
18174
18175
|
if (options.vueCompilerOptions.dataAttributes.some((pattern) => (0, picomatch_1.isMatch)(prop.name, pattern))) continue;
|
|
18175
18176
|
const shouldSpread = prop.name === "style" || prop.name === "class";
|
|
18176
18177
|
const shouldCamelize = getShouldCamelize(options, node, prop, prop.name);
|
|
18177
|
-
const features = getPropsCodeFeatures(
|
|
18178
|
+
const features = getPropsCodeFeatures(checkUnknownProps);
|
|
18178
18179
|
if (shouldSpread) yield `...{ `;
|
|
18179
18180
|
const token = yield* (0, boundary_1.startBoundary)("template", prop.loc.start.offset, codeFeatures_1.codeFeatures.verification);
|
|
18180
18181
|
const prefix = options.template.content.slice(prop.loc.start.offset, prop.loc.start.offset + 1);
|
|
@@ -18192,7 +18193,7 @@ var require_elementProps = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
18192
18193
|
yield (0, boundary_1.endBoundary)(token, prop.loc.end.offset);
|
|
18193
18194
|
if (shouldSpread) yield ` }`;
|
|
18194
18195
|
yield `,${utils_1.newLine}`;
|
|
18195
|
-
} else if (prop.name === "bind" && !prop.arg && prop.exp?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION) if (prop.exp.loc.source === "$attrs")
|
|
18196
|
+
} else if (prop.name === "bind" && !prop.arg && prop.exp?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION) if (prop.exp.loc.source === "$attrs") failedPropExps?.push({
|
|
18196
18197
|
node: prop.exp,
|
|
18197
18198
|
prefix: `(`,
|
|
18198
18199
|
suffix: `)`
|
|
@@ -18239,10 +18240,11 @@ var require_elementProps = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
18239
18240
|
function getShouldCamelize(options, node, prop, propName) {
|
|
18240
18241
|
return (node.tagType === CompilerDOM.ElementTypes.COMPONENT || node.tagType === CompilerDOM.ElementTypes.SLOT) && (prop.type !== CompilerDOM.NodeTypes.DIRECTIVE || prop.arg?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION && prop.arg.isStatic) && (0, shared_2.hyphenateAttr)(propName) === propName && !options.vueCompilerOptions.htmlAttributes.some((pattern) => (0, picomatch_1.isMatch)(propName, pattern));
|
|
18241
18242
|
}
|
|
18242
|
-
function getPropsCodeFeatures(
|
|
18243
|
+
function getPropsCodeFeatures(checkUnknownProps) {
|
|
18243
18244
|
return {
|
|
18244
18245
|
...codeFeatures_1.codeFeatures.withoutHighlightAndCompletion,
|
|
18245
|
-
...
|
|
18246
|
+
...checkUnknownProps ? codeFeatures_1.codeFeatures.verification : codeFeatures_1.codeFeatures.doNotReportTs2353AndTs2561,
|
|
18247
|
+
__propsCompletion: true
|
|
18246
18248
|
};
|
|
18247
18249
|
}
|
|
18248
18250
|
function getModelPropName(node, vueCompilerOptions) {
|
|
@@ -18768,23 +18770,21 @@ var require_element = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
18768
18770
|
}
|
|
18769
18771
|
}
|
|
18770
18772
|
}
|
|
18771
|
-
yield* generateComponentBody(options, ctx, node, tag, startTagOffset, props, componentVar);
|
|
18772
|
-
}
|
|
18773
|
-
function* generateComponentBody(options, ctx, node, tag, tagOffset, props, componentVar) {
|
|
18774
18773
|
let isCtxVarUsed = false;
|
|
18775
18774
|
let isPropsVarUsed = false;
|
|
18776
18775
|
const getCtxVar = () => (isCtxVarUsed = true, ctxVar);
|
|
18777
18776
|
const getPropsVar = () => (isPropsVarUsed = true, propsVar);
|
|
18778
18777
|
ctx.components.push(getCtxVar);
|
|
18779
|
-
const failGeneratedExpressions = [];
|
|
18780
|
-
const propCodes = [...(0, elementProps_1.generateElementProps)(options, ctx, node, props, options.vueCompilerOptions.checkUnknownProps, failGeneratedExpressions)];
|
|
18781
18778
|
const functionalVar = ctx.getInternalVariable();
|
|
18782
18779
|
const vnodeVar = ctx.getInternalVariable();
|
|
18783
18780
|
const ctxVar = ctx.getInternalVariable();
|
|
18784
18781
|
const propsVar = ctx.getInternalVariable();
|
|
18782
|
+
const failedPropExps = [];
|
|
18783
|
+
const propCodes = [...(0, elementProps_1.generateElementProps)(options, ctx, node, props, options.vueCompilerOptions.checkUnknownProps, failedPropExps)];
|
|
18784
|
+
const propsStr = (0, muggle_string_1.toString)(propCodes);
|
|
18785
18785
|
yield `// @ts-ignore${utils_1.newLine}`;
|
|
18786
18786
|
yield `const ${functionalVar} = ${options.vueCompilerOptions.checkUnknownProps ? names_1.names.asFunctionalComponent0 : names_1.names.asFunctionalComponent1}(${componentVar}, new ${componentVar}({${utils_1.newLine}`;
|
|
18787
|
-
yield
|
|
18787
|
+
yield propsStr;
|
|
18788
18788
|
yield `}))${utils_1.endOfLine}`;
|
|
18789
18789
|
yield `const `;
|
|
18790
18790
|
const token = yield* (0, boundary_1.startBoundary)("template", node.loc.start.offset, codeFeatures_1.codeFeatures.doNotReportTs6133);
|
|
@@ -18804,32 +18804,44 @@ var require_element = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
18804
18804
|
yield `>`;
|
|
18805
18805
|
yield (0, boundary_1.endBoundary)(token, offset + content.length);
|
|
18806
18806
|
}
|
|
18807
|
+
const shouldInheritAttrs = hasVBindAttrs(options, ctx, node);
|
|
18807
18808
|
yield `(`;
|
|
18808
|
-
const token2 = yield* (0, boundary_1.startBoundary)("template",
|
|
18809
|
-
yield `{
|
|
18809
|
+
const token2 = yield* (0, boundary_1.startBoundary)("template", startTagOffset, shouldInheritAttrs && options.vueCompilerOptions.checkRequiredFallthroughAttributes ? {} : codeFeatures_1.codeFeatures.verification);
|
|
18810
|
+
yield `{`;
|
|
18811
|
+
yield [
|
|
18812
|
+
``,
|
|
18813
|
+
"template",
|
|
18814
|
+
node.loc.start.offset,
|
|
18815
|
+
{ __propsCompletion: true }
|
|
18816
|
+
];
|
|
18817
|
+
yield utils_1.newLine;
|
|
18810
18818
|
yield* propCodes;
|
|
18811
18819
|
yield `}`;
|
|
18812
|
-
yield (0, boundary_1.endBoundary)(token2,
|
|
18820
|
+
yield (0, boundary_1.endBoundary)(token2, startTagOffset + tag.length);
|
|
18813
18821
|
yield `, ...${names_1.names.functionalComponentArgsRest}(${functionalVar}))${utils_1.endOfLine}`;
|
|
18814
|
-
yield* generateFailedExpressions(options, ctx,
|
|
18822
|
+
yield* generateFailedExpressions(options, ctx, failedPropExps);
|
|
18815
18823
|
yield* (0, elementEvents_1.generateElementEvents)(options, ctx, node, componentVar, getCtxVar, getPropsVar);
|
|
18816
18824
|
yield* (0, elementDirectives_1.generateElementDirectives)(options, ctx, node);
|
|
18817
18825
|
const templateRef = getTemplateRef(node);
|
|
18818
|
-
const
|
|
18819
|
-
if (templateRef ||
|
|
18826
|
+
const isSingleRoot = ctx.singleRootNodes.has(node) && !options.vueCompilerOptions.fallthroughComponentNames.includes((0, shared_2.hyphenateTag)(tag));
|
|
18827
|
+
if (templateRef || isSingleRoot) {
|
|
18820
18828
|
const componentInstanceVar = ctx.getInternalVariable();
|
|
18821
|
-
yield `var ${componentInstanceVar}
|
|
18822
|
-
if (ctx.inVFor) yield `[]`;
|
|
18829
|
+
yield `var ${componentInstanceVar}!: Parameters<NonNullable<typeof ${getCtxVar()}['expose']>>[0]`;
|
|
18823
18830
|
yield utils_1.endOfLine;
|
|
18824
18831
|
if (templateRef) {
|
|
18825
|
-
|
|
18832
|
+
let typeExp = `typeof ${ctx.getHoistVariable(componentInstanceVar)} | null`;
|
|
18833
|
+
if (ctx.inVFor) typeExp = `(${typeExp})[]`;
|
|
18826
18834
|
ctx.addTemplateRef(templateRef[0], typeExp, templateRef[1]);
|
|
18827
18835
|
}
|
|
18828
|
-
if (
|
|
18836
|
+
if (isSingleRoot) ctx.singleRootElTypes.add(`NonNullable<typeof ${componentInstanceVar}>['$el']`);
|
|
18837
|
+
}
|
|
18838
|
+
if (shouldInheritAttrs) {
|
|
18839
|
+
const restsVar = ctx.getInternalVariable();
|
|
18840
|
+
yield `var ${restsVar} = ${names_1.names.omit}(${getPropsVar()}, {\n${propsStr}})${utils_1.endOfLine}`;
|
|
18841
|
+
ctx.inheritedAttrVars.add(restsVar);
|
|
18829
18842
|
}
|
|
18830
|
-
if (hasVBindAttrs(options, ctx, node)) ctx.inheritedAttrVars.add(getPropsVar());
|
|
18831
18843
|
yield* generateStyleScopedClassReferences(options, node);
|
|
18832
|
-
const slotDir = node.props.find(
|
|
18844
|
+
const slotDir = node.props.find(CompilerDOM.isVSlot);
|
|
18833
18845
|
if (slotDir || node.children.length) yield* (0, vSlot_1.generateVSlot)(options, ctx, node, slotDir, getCtxVar());
|
|
18834
18846
|
if (isCtxVarUsed) yield `var ${ctxVar}!: ${names_1.names.FunctionalComponentCtx}<typeof ${componentVar}, typeof ${vnodeVar}>${utils_1.endOfLine}`;
|
|
18835
18847
|
if (isPropsVarUsed) yield `var ${propsVar}!: ${names_1.names.FunctionalComponentProps}<typeof ${componentVar}, typeof ${vnodeVar}>${utils_1.endOfLine}`;
|
|
@@ -18929,9 +18941,9 @@ var require_element = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
18929
18941
|
offset += className.length + 1;
|
|
18930
18942
|
}
|
|
18931
18943
|
}
|
|
18932
|
-
function* generateFailedExpressions(options, ctx,
|
|
18933
|
-
for (const
|
|
18934
|
-
yield* (0, interpolation_1.generateInterpolation)(options, ctx, options.template, codeFeatures_1.codeFeatures.all,
|
|
18944
|
+
function* generateFailedExpressions(options, ctx, failedPropExps) {
|
|
18945
|
+
for (const { node, prefix, suffix } of failedPropExps) {
|
|
18946
|
+
yield* (0, interpolation_1.generateInterpolation)(options, ctx, options.template, codeFeatures_1.codeFeatures.all, node.loc.source, node.loc.start.offset, prefix, suffix);
|
|
18935
18947
|
yield utils_1.endOfLine;
|
|
18936
18948
|
}
|
|
18937
18949
|
}
|
|
@@ -19299,7 +19311,7 @@ var require_templateChild = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
19299
19311
|
var vFor_1 = require_vFor$1();
|
|
19300
19312
|
var vIf_1 = require_vIf$1();
|
|
19301
19313
|
var vSlot_1 = require_vSlot();
|
|
19302
|
-
function* generateTemplateChild(options, ctx, node, enterNode = true,
|
|
19314
|
+
function* generateTemplateChild(options, ctx, node, enterNode = true, treatTemplateAsFragment = false) {
|
|
19303
19315
|
if (enterNode && !ctx.enter(node)) return;
|
|
19304
19316
|
if (node.type === CompilerDOM.NodeTypes.ROOT) {
|
|
19305
19317
|
for (const item of collectSingleRootNodes(options, node.children)) ctx.singleRootNodes.add(item);
|
|
@@ -19308,7 +19320,7 @@ var require_templateChild = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
19308
19320
|
else {
|
|
19309
19321
|
const slotDir = node.props.find(CompilerDOM.isVSlot);
|
|
19310
19322
|
if (node.tagType === CompilerDOM.ElementTypes.TEMPLATE && ctx.components.length && slotDir) yield* (0, vSlot_1.generateVSlot)(options, ctx, node, slotDir, ctx.components.at(-1)());
|
|
19311
|
-
else if (node.tagType === CompilerDOM.ElementTypes.TEMPLATE &&
|
|
19323
|
+
else if (node.tagType === CompilerDOM.ElementTypes.TEMPLATE && treatTemplateAsFragment) yield* (0, element_1.generateFragment)(options, ctx, node);
|
|
19312
19324
|
else if (node.tagType === CompilerDOM.ElementTypes.COMPONENT) yield* (0, element_1.generateComponent)(options, ctx, node);
|
|
19313
19325
|
else yield* (0, element_1.generateElement)(options, ctx, node);
|
|
19314
19326
|
}
|
|
@@ -19323,7 +19335,7 @@ var require_templateChild = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
19323
19335
|
else if (node.type === CompilerDOM.NodeTypes.FOR) yield* (0, vFor_1.generateVFor)(options, ctx, node);
|
|
19324
19336
|
if (enterNode) yield* ctx.exit();
|
|
19325
19337
|
}
|
|
19326
|
-
function* collectSingleRootNodes(options, children) {
|
|
19338
|
+
function* collectSingleRootNodes(options, children, treatTemplateAsFragment = false) {
|
|
19327
19339
|
children = children.filter((node) => node.type !== CompilerDOM.NodeTypes.COMMENT);
|
|
19328
19340
|
if (children.length !== 1) {
|
|
19329
19341
|
if (children.length > 1) yield null;
|
|
@@ -19331,9 +19343,13 @@ var require_templateChild = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
19331
19343
|
}
|
|
19332
19344
|
const child = children[0];
|
|
19333
19345
|
if (child.type === CompilerDOM.NodeTypes.IF) {
|
|
19334
|
-
for (const branch of child.branches) yield* collectSingleRootNodes(options, branch.children);
|
|
19346
|
+
for (const branch of child.branches) yield* collectSingleRootNodes(options, branch.children, true);
|
|
19335
19347
|
return;
|
|
19336
19348
|
} else if (child.type !== CompilerDOM.NodeTypes.ELEMENT) return;
|
|
19349
|
+
if (child.tagType === CompilerDOM.ElementTypes.TEMPLATE && treatTemplateAsFragment) {
|
|
19350
|
+
yield* collectSingleRootNodes(options, child.children);
|
|
19351
|
+
return;
|
|
19352
|
+
}
|
|
19337
19353
|
yield child;
|
|
19338
19354
|
const tag = (0, shared_1.hyphenateTag)(child.tag);
|
|
19339
19355
|
if (options.vueCompilerOptions.fallthroughComponentNames.includes(tag)) yield* collectSingleRootNodes(options, child.children);
|
|
@@ -19384,7 +19400,7 @@ var require_template$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
19384
19400
|
if (template.ast) yield* (0, templateChild_1.generateTemplateChild)(options, ctx, template.ast);
|
|
19385
19401
|
yield* ctx.generateHoistVariables();
|
|
19386
19402
|
yield* generateSlotsType(options, ctx);
|
|
19387
|
-
yield* generateInheritedAttrsType(ctx);
|
|
19403
|
+
yield* generateInheritedAttrsType(options, ctx);
|
|
19388
19404
|
yield* generateTemplateRefsType(options, ctx);
|
|
19389
19405
|
yield* generateRootElType(ctx);
|
|
19390
19406
|
if (ctx.dollarVars.size) {
|
|
@@ -19422,10 +19438,11 @@ var require_template$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
19422
19438
|
}
|
|
19423
19439
|
yield utils_1.endOfLine;
|
|
19424
19440
|
}
|
|
19425
|
-
function* generateInheritedAttrsType(ctx) {
|
|
19441
|
+
function* generateInheritedAttrsType(options, ctx) {
|
|
19426
19442
|
if (!ctx.inheritedAttrVars.size) return;
|
|
19427
19443
|
ctx.generatedTypes.add(names_1.names.InheritedAttrs);
|
|
19428
|
-
|
|
19444
|
+
const type = [...ctx.inheritedAttrVars].map((name) => `typeof ${name}`).join(` & `);
|
|
19445
|
+
yield `type ${names_1.names.InheritedAttrs} = ${options.vueCompilerOptions.checkRequiredFallthroughAttributes ? type : `Partial<${type}>`}`;
|
|
19429
19446
|
yield utils_1.endOfLine;
|
|
19430
19447
|
}
|
|
19431
19448
|
function* generateTemplateRefsType(options, ctx) {
|
|
@@ -19623,6 +19640,7 @@ var require_compilerOptions = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
19623
19640
|
inferTemplateDollarSlots: false,
|
|
19624
19641
|
skipTemplateCodegen: false,
|
|
19625
19642
|
fallthroughAttributes: false,
|
|
19643
|
+
checkRequiredFallthroughAttributes: false,
|
|
19626
19644
|
resolveStyleImports: false,
|
|
19627
19645
|
resolveStyleClassNames: "scoped",
|
|
19628
19646
|
fallthroughComponentNames: [
|
|
@@ -19957,8 +19975,7 @@ var require_parseSfc = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
19957
19975
|
const [content, offset] = (0, shared_1.normalizeAttributeValue)(p.value);
|
|
19958
19976
|
return {
|
|
19959
19977
|
text: content,
|
|
19960
|
-
offset: offset - node.loc.start.offset
|
|
19961
|
-
quotes: offset > p.value.loc.start.offset
|
|
19978
|
+
offset: offset - node.loc.start.offset
|
|
19962
19979
|
};
|
|
19963
19980
|
}
|
|
19964
19981
|
}));
|
|
@@ -20131,29 +20148,29 @@ var require_vue_root_tags = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
20131
20148
|
lang: "vue-root-tags"
|
|
20132
20149
|
}];
|
|
20133
20150
|
},
|
|
20134
|
-
resolveEmbeddedCode(_fileName,
|
|
20151
|
+
resolveEmbeddedCode(_fileName, ir, embeddedFile) {
|
|
20135
20152
|
if (embeddedFile.id === "root_tags") {
|
|
20136
20153
|
embeddedFile.content.push([
|
|
20137
|
-
|
|
20154
|
+
ir.content,
|
|
20138
20155
|
void 0,
|
|
20139
20156
|
0,
|
|
20140
20157
|
shared_1.allCodeFeatures
|
|
20141
20158
|
]);
|
|
20142
20159
|
for (const block of [
|
|
20143
|
-
|
|
20144
|
-
|
|
20145
|
-
|
|
20146
|
-
...
|
|
20147
|
-
...
|
|
20160
|
+
ir.template,
|
|
20161
|
+
ir.script,
|
|
20162
|
+
ir.scriptSetup,
|
|
20163
|
+
...ir.styles,
|
|
20164
|
+
...ir.customBlocks
|
|
20148
20165
|
]) {
|
|
20149
20166
|
if (!block) continue;
|
|
20150
20167
|
const offset = block.content.lastIndexOf("\n", block.content.lastIndexOf("\n") - 1) + 1;
|
|
20151
|
-
(0, muggle_string_1.replaceSourceRange)(embeddedFile.content, void 0, block.startTagEnd, block.endTagStart,
|
|
20168
|
+
(0, muggle_string_1.replaceSourceRange)(embeddedFile.content, void 0, block.startTagEnd, block.endTagStart, ir.content.slice(block.startTagEnd, block.startTagEnd + offset), [
|
|
20152
20169
|
"",
|
|
20153
20170
|
void 0,
|
|
20154
20171
|
block.startTagEnd + offset,
|
|
20155
20172
|
{ structure: true }
|
|
20156
|
-
],
|
|
20173
|
+
], ir.content.slice(block.startTagEnd + offset, block.endTagStart));
|
|
20157
20174
|
}
|
|
20158
20175
|
} else embeddedFile.parentCodeId ??= "root_tags";
|
|
20159
20176
|
}
|
|
@@ -20183,16 +20200,16 @@ var require_vue_sfc_customblocks = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
20183
20200
|
var plugin = () => {
|
|
20184
20201
|
return {
|
|
20185
20202
|
version: 2.2,
|
|
20186
|
-
getEmbeddedCodes(_fileName,
|
|
20187
|
-
return
|
|
20203
|
+
getEmbeddedCodes(_fileName, ir) {
|
|
20204
|
+
return ir.customBlocks.map((customBlock, i) => ({
|
|
20188
20205
|
id: "custom_block_" + i,
|
|
20189
20206
|
lang: customBlock.lang
|
|
20190
20207
|
}));
|
|
20191
20208
|
},
|
|
20192
|
-
resolveEmbeddedCode(_fileName,
|
|
20209
|
+
resolveEmbeddedCode(_fileName, ir, embeddedFile) {
|
|
20193
20210
|
if (embeddedFile.id.startsWith("custom_block_")) {
|
|
20194
20211
|
const index = parseInt(embeddedFile.id.slice(13));
|
|
20195
|
-
const customBlock =
|
|
20212
|
+
const customBlock = ir.customBlocks[index];
|
|
20196
20213
|
embeddedFile.content.push([
|
|
20197
20214
|
customBlock.content,
|
|
20198
20215
|
customBlock.name,
|
|
@@ -20212,20 +20229,20 @@ var require_vue_sfc_scripts = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
20212
20229
|
var plugin = () => {
|
|
20213
20230
|
return {
|
|
20214
20231
|
version: 2.2,
|
|
20215
|
-
getEmbeddedCodes(_fileName,
|
|
20232
|
+
getEmbeddedCodes(_fileName, ir) {
|
|
20216
20233
|
const names = [];
|
|
20217
|
-
if (
|
|
20234
|
+
if (ir.script) names.push({
|
|
20218
20235
|
id: "script_raw",
|
|
20219
|
-
lang:
|
|
20236
|
+
lang: ir.script.lang
|
|
20220
20237
|
});
|
|
20221
|
-
if (
|
|
20238
|
+
if (ir.scriptSetup) names.push({
|
|
20222
20239
|
id: "scriptsetup_raw",
|
|
20223
|
-
lang:
|
|
20240
|
+
lang: ir.scriptSetup.lang
|
|
20224
20241
|
});
|
|
20225
20242
|
return names;
|
|
20226
20243
|
},
|
|
20227
|
-
resolveEmbeddedCode(_fileName,
|
|
20228
|
-
const script = embeddedFile.id === "script_raw" ?
|
|
20244
|
+
resolveEmbeddedCode(_fileName, ir, embeddedFile) {
|
|
20245
|
+
const script = embeddedFile.id === "script_raw" ? ir.script : embeddedFile.id === "scriptsetup_raw" ? ir.scriptSetup : void 0;
|
|
20229
20246
|
if (script) embeddedFile.content.push([
|
|
20230
20247
|
script.content,
|
|
20231
20248
|
script.name,
|
|
@@ -20248,10 +20265,10 @@ var require_vue_sfc_styles = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
20248
20265
|
var plugin = () => {
|
|
20249
20266
|
return {
|
|
20250
20267
|
version: 2.2,
|
|
20251
|
-
getEmbeddedCodes(_fileName,
|
|
20268
|
+
getEmbeddedCodes(_fileName, ir) {
|
|
20252
20269
|
const result = [];
|
|
20253
|
-
for (let i = 0; i <
|
|
20254
|
-
const style =
|
|
20270
|
+
for (let i = 0; i < ir.styles.length; i++) {
|
|
20271
|
+
const style = ir.styles[i];
|
|
20255
20272
|
if (style) {
|
|
20256
20273
|
result.push({
|
|
20257
20274
|
id: "style_" + i,
|
|
@@ -20265,10 +20282,10 @@ var require_vue_sfc_styles = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
20265
20282
|
}
|
|
20266
20283
|
return result;
|
|
20267
20284
|
},
|
|
20268
|
-
resolveEmbeddedCode(_fileName,
|
|
20285
|
+
resolveEmbeddedCode(_fileName, ir, embeddedFile) {
|
|
20269
20286
|
if (embeddedFile.id.startsWith("style_")) {
|
|
20270
20287
|
const index = parseInt(embeddedFile.id.split("_")[1]);
|
|
20271
|
-
const style =
|
|
20288
|
+
const style = ir.styles[index];
|
|
20272
20289
|
if (embeddedFile.id.endsWith("_inline_ts")) {
|
|
20273
20290
|
embeddedFile.parentCodeId = "style_" + index;
|
|
20274
20291
|
for (const binding of style.bindings) embeddedFile.content.push("(", [
|
|
@@ -20297,17 +20314,17 @@ var require_vue_sfc_template = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
20297
20314
|
var plugin = () => {
|
|
20298
20315
|
return {
|
|
20299
20316
|
version: 2.2,
|
|
20300
|
-
getEmbeddedCodes(_fileName,
|
|
20301
|
-
if (
|
|
20317
|
+
getEmbeddedCodes(_fileName, ir) {
|
|
20318
|
+
if (ir.template?.lang === "html") return [{
|
|
20302
20319
|
id: "template",
|
|
20303
|
-
lang:
|
|
20320
|
+
lang: ir.template.lang
|
|
20304
20321
|
}];
|
|
20305
20322
|
return [];
|
|
20306
20323
|
},
|
|
20307
|
-
resolveEmbeddedCode(_fileName,
|
|
20308
|
-
if (embeddedFile.id === "template" &&
|
|
20309
|
-
|
|
20310
|
-
|
|
20324
|
+
resolveEmbeddedCode(_fileName, ir, embeddedFile) {
|
|
20325
|
+
if (embeddedFile.id === "template" && ir.template?.lang === "html") embeddedFile.content.push([
|
|
20326
|
+
ir.template.content,
|
|
20327
|
+
ir.template.name,
|
|
20311
20328
|
0,
|
|
20312
20329
|
shared_1.allCodeFeatures
|
|
20313
20330
|
]);
|
|
@@ -20413,12 +20430,13 @@ var require_transformElement = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
20413
20430
|
if (isSlotOutlet && runtimeDirectives.length) context.onError((0, compiler_dom_1.createCompilerError)(compiler_dom_1.ErrorCodes.X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET, prop.loc));
|
|
20414
20431
|
}
|
|
20415
20432
|
if (isComponent) {
|
|
20416
|
-
let hasTemplateSlots = false;
|
|
20417
20433
|
let hasNamedDefaultSlot = false;
|
|
20418
20434
|
const implicitDefaultChildren = [];
|
|
20419
20435
|
const seenSlotNames = /* @__PURE__ */ new Set();
|
|
20420
20436
|
const onComponentSlot = (0, compiler_dom_1.findDir)(node, "slot", true);
|
|
20421
|
-
for (
|
|
20437
|
+
for (let child of node.children) {
|
|
20438
|
+
if (child.type === compiler_dom_1.NodeTypes.FOR) child = child.children[0];
|
|
20439
|
+
else if (child.type === compiler_dom_1.NodeTypes.IF) child = child.branches[0].children[0];
|
|
20422
20440
|
let slotDir;
|
|
20423
20441
|
if (!(0, compiler_dom_1.isTemplateNode)(child) || !(slotDir = (0, compiler_dom_1.findDir)(child, "slot", true))) {
|
|
20424
20442
|
if (child.type !== compiler_dom_1.NodeTypes.COMMENT) implicitDefaultChildren.push(child);
|
|
@@ -20428,8 +20446,6 @@ var require_transformElement = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
20428
20446
|
context.onError((0, compiler_dom_1.createCompilerError)(compiler_dom_1.ErrorCodes.X_V_SLOT_MIXED_SLOT_USAGE, slotDir.loc));
|
|
20429
20447
|
break;
|
|
20430
20448
|
}
|
|
20431
|
-
if ((0, compiler_dom_1.findDir)(child, /^(?:if|else-if|else|for)$/, true)) continue;
|
|
20432
|
-
hasTemplateSlots = true;
|
|
20433
20449
|
const staticSlotName = slotDir.arg ? (0, compiler_dom_1.isStaticExp)(slotDir.arg) ? slotDir.arg.content : void 0 : "default";
|
|
20434
20450
|
if (staticSlotName) {
|
|
20435
20451
|
if (seenSlotNames.has(staticSlotName)) {
|
|
@@ -20440,7 +20456,7 @@ var require_transformElement = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
20440
20456
|
if (staticSlotName === "default") hasNamedDefaultSlot = true;
|
|
20441
20457
|
}
|
|
20442
20458
|
}
|
|
20443
|
-
if (
|
|
20459
|
+
if (hasNamedDefaultSlot && implicitDefaultChildren.some((node) => node.type !== compiler_dom_1.NodeTypes.TEXT || !!node.content.trim())) context.onError((0, compiler_dom_1.createCompilerError)(compiler_dom_1.ErrorCodes.X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN, implicitDefaultChildren[0].loc));
|
|
20444
20460
|
context.components.add(node.tag);
|
|
20445
20461
|
}
|
|
20446
20462
|
};
|
|
@@ -20939,17 +20955,17 @@ var require_vue_template_inline_css = /* @__PURE__ */ __commonJSMin(((exports) =
|
|
|
20939
20955
|
var plugin = () => {
|
|
20940
20956
|
return {
|
|
20941
20957
|
version: 2.2,
|
|
20942
|
-
getEmbeddedCodes(_fileName,
|
|
20943
|
-
if (!
|
|
20958
|
+
getEmbeddedCodes(_fileName, ir) {
|
|
20959
|
+
if (!ir.template?.ast) return [];
|
|
20944
20960
|
return [{
|
|
20945
20961
|
id: "template_inline_css",
|
|
20946
20962
|
lang: "css"
|
|
20947
20963
|
}];
|
|
20948
20964
|
},
|
|
20949
|
-
resolveEmbeddedCode(_fileName,
|
|
20950
|
-
if (embeddedFile.id !== "template_inline_css" || !
|
|
20951
|
-
embeddedFile.parentCodeId =
|
|
20952
|
-
embeddedFile.content.push(...generate(
|
|
20965
|
+
resolveEmbeddedCode(_fileName, ir, embeddedFile) {
|
|
20966
|
+
if (embeddedFile.id !== "template_inline_css" || !ir.template?.ast) return;
|
|
20967
|
+
embeddedFile.parentCodeId = ir.template.lang === "md" ? "root_tags" : "template";
|
|
20968
|
+
embeddedFile.content.push(...generate(ir.template.ast));
|
|
20953
20969
|
}
|
|
20954
20970
|
};
|
|
20955
20971
|
};
|
|
@@ -21032,10 +21048,10 @@ var require_vue_template_inline_ts = /* @__PURE__ */ __commonJSMin(((exports) =>
|
|
|
21032
21048
|
const parseds = /* @__PURE__ */ new WeakMap();
|
|
21033
21049
|
return {
|
|
21034
21050
|
version: 2.2,
|
|
21035
|
-
getEmbeddedCodes(_fileName,
|
|
21036
|
-
if (!
|
|
21037
|
-
const parsed = parse(
|
|
21038
|
-
parseds.set(
|
|
21051
|
+
getEmbeddedCodes(_fileName, ir) {
|
|
21052
|
+
if (!ir.template?.ast) return [];
|
|
21053
|
+
const parsed = parse(ir);
|
|
21054
|
+
parseds.set(ir, parsed);
|
|
21039
21055
|
const result = [];
|
|
21040
21056
|
for (const [id] of parsed) result.push({
|
|
21041
21057
|
id,
|
|
@@ -21043,25 +21059,25 @@ var require_vue_template_inline_ts = /* @__PURE__ */ __commonJSMin(((exports) =>
|
|
|
21043
21059
|
});
|
|
21044
21060
|
return result;
|
|
21045
21061
|
},
|
|
21046
|
-
resolveEmbeddedCode(_fileName,
|
|
21062
|
+
resolveEmbeddedCode(_fileName, ir, embeddedFile) {
|
|
21047
21063
|
if (!embeddedFile.id.startsWith("template_inline_ts_")) return;
|
|
21048
|
-
|
|
21049
|
-
const parsed = parseds.get(
|
|
21064
|
+
ir.template?.content;
|
|
21065
|
+
const parsed = parseds.get(ir);
|
|
21050
21066
|
if (parsed) {
|
|
21051
21067
|
const codes = parsed.get(embeddedFile.id);
|
|
21052
21068
|
if (codes) {
|
|
21053
21069
|
embeddedFile.content.push(...codes);
|
|
21054
|
-
embeddedFile.parentCodeId =
|
|
21070
|
+
embeddedFile.parentCodeId = ir.template?.lang === "md" ? "root_tags" : "template";
|
|
21055
21071
|
}
|
|
21056
21072
|
}
|
|
21057
21073
|
}
|
|
21058
21074
|
};
|
|
21059
|
-
function parse(
|
|
21075
|
+
function parse(ir) {
|
|
21060
21076
|
const result = /* @__PURE__ */ new Map();
|
|
21061
|
-
if (!
|
|
21062
|
-
const template =
|
|
21077
|
+
if (!ir.template?.ast) return result;
|
|
21078
|
+
const template = ir.template;
|
|
21063
21079
|
let i = 0;
|
|
21064
|
-
|
|
21080
|
+
ir.template.ast.children.forEach(visit);
|
|
21065
21081
|
return result;
|
|
21066
21082
|
function visit(node) {
|
|
21067
21083
|
if (node.type === CompilerDOM.NodeTypes.COMMENT) {
|
|
@@ -21788,20 +21804,20 @@ var require_merge = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
21788
21804
|
exports.generateIntersectMerge = generateIntersectMerge;
|
|
21789
21805
|
exports.generateSpreadMerge = generateSpreadMerge;
|
|
21790
21806
|
var index_1 = require_utils$5();
|
|
21791
|
-
function* generateIntersectMerge(
|
|
21792
|
-
yield
|
|
21793
|
-
for (let i = 1; i <
|
|
21807
|
+
function* generateIntersectMerge(...codes) {
|
|
21808
|
+
yield codes[0];
|
|
21809
|
+
for (let i = 1; i < codes.length; i++) {
|
|
21794
21810
|
yield ` & `;
|
|
21795
|
-
yield
|
|
21811
|
+
yield codes[i];
|
|
21796
21812
|
}
|
|
21797
21813
|
}
|
|
21798
|
-
function* generateSpreadMerge(
|
|
21799
|
-
if (
|
|
21814
|
+
function* generateSpreadMerge(...codes) {
|
|
21815
|
+
if (codes.length <= 1) yield* codes;
|
|
21800
21816
|
else {
|
|
21801
21817
|
yield `{${index_1.newLine}`;
|
|
21802
|
-
for (const
|
|
21818
|
+
for (const code of codes) {
|
|
21803
21819
|
yield `...`;
|
|
21804
|
-
yield
|
|
21820
|
+
yield code;
|
|
21805
21821
|
yield `,${index_1.newLine}`;
|
|
21806
21822
|
}
|
|
21807
21823
|
yield `}`;
|
|
@@ -21828,70 +21844,60 @@ var require_component = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
21828
21844
|
yield `})`;
|
|
21829
21845
|
}
|
|
21830
21846
|
function* generateEmitsOption(options, scriptSetupRanges) {
|
|
21831
|
-
const
|
|
21832
|
-
const
|
|
21833
|
-
if (
|
|
21834
|
-
optionCodes.push([`{} as ${names_1.names.NormalizeEmits}<typeof ${names_1.names.modelEmit}>`]);
|
|
21835
|
-
typeOptionCodes.push([names_1.names.ModelEmit]);
|
|
21836
|
-
}
|
|
21837
|
-
if (scriptSetupRanges.defineEmits) {
|
|
21838
|
-
const { name, typeArg, hasUnionTypeArg } = scriptSetupRanges.defineEmits;
|
|
21839
|
-
optionCodes.push([`{} as ${names_1.names.NormalizeEmits}<typeof ${name ?? names_1.names.emit}>`]);
|
|
21840
|
-
if (typeArg && !hasUnionTypeArg) typeOptionCodes.push([names_1.names.Emit]);
|
|
21841
|
-
else typeOptionCodes.length = 0;
|
|
21842
|
-
}
|
|
21843
|
-
if (options.vueCompilerOptions.target >= 3.5 && typeOptionCodes.length) {
|
|
21847
|
+
const typeCodes = options.vueCompilerOptions.target >= 3.5 && !scriptSetupRanges.defineEmits?.hasUnionTypeArg ? [...generateTypeEmitsOption(scriptSetupRanges)] : [];
|
|
21848
|
+
const runtimeCodes = !typeCodes.length ? [...generateRuntimeEmitsOption(scriptSetupRanges)] : [];
|
|
21849
|
+
if (typeCodes.length) {
|
|
21844
21850
|
yield `__typeEmits: {} as `;
|
|
21845
|
-
yield* (0, merge_1.generateIntersectMerge)(
|
|
21851
|
+
yield* (0, merge_1.generateIntersectMerge)(...typeCodes);
|
|
21846
21852
|
yield `,${utils_1.newLine}`;
|
|
21847
|
-
} else if (
|
|
21853
|
+
} else if (runtimeCodes.length) {
|
|
21848
21854
|
yield `emits: `;
|
|
21849
|
-
yield* (0, merge_1.generateSpreadMerge)(
|
|
21855
|
+
yield* (0, merge_1.generateSpreadMerge)(...runtimeCodes);
|
|
21850
21856
|
yield `,${utils_1.newLine}`;
|
|
21851
21857
|
}
|
|
21852
21858
|
}
|
|
21859
|
+
function* generateTypeEmitsOption(scriptSetupRanges) {
|
|
21860
|
+
if (scriptSetupRanges.defineModel.length) yield names_1.names.ModelEmit;
|
|
21861
|
+
if (scriptSetupRanges.defineEmits?.typeArg) yield names_1.names.Emit;
|
|
21862
|
+
}
|
|
21863
|
+
function* generateRuntimeEmitsOption(scriptSetupRanges) {
|
|
21864
|
+
if (scriptSetupRanges.defineModel.length) yield `{} as ${names_1.names.NormalizeEmits}<typeof ${names_1.names.modelEmit}>`;
|
|
21865
|
+
if (scriptSetupRanges.defineEmits) yield `{} as ${names_1.names.NormalizeEmits}<typeof ${scriptSetupRanges.defineEmits.name ?? names_1.names.emit}>`;
|
|
21866
|
+
}
|
|
21853
21867
|
function* generatePropsOption(options, ctx, scriptSetup, scriptSetupRanges, hasEmitsOption) {
|
|
21854
|
-
const
|
|
21855
|
-
const
|
|
21856
|
-
if (
|
|
21857
|
-
const attrsType = hasEmitsOption ? `Omit<${names_1.names.InheritedAttrs}, keyof ${names_1.names.EmitProps}>` : names_1.names.InheritedAttrs;
|
|
21858
|
-
optionGenerates.push(function* () {
|
|
21859
|
-
const propsType = `${names_1.names.PickNotAny}<${ctx.localTypes.OmitIndexSignature}<${attrsType}>, {}>`;
|
|
21860
|
-
yield `{} as ${`${ctx.localTypes.TypePropsToOption}<${propsType}>`}`;
|
|
21861
|
-
});
|
|
21862
|
-
typeOptionGenerates.push(function* () {
|
|
21863
|
-
yield `{} as ${attrsType}`;
|
|
21864
|
-
});
|
|
21865
|
-
}
|
|
21866
|
-
if (ctx.generatedTypes.has(names_1.names.PublicProps)) {
|
|
21867
|
-
if (options.vueCompilerOptions.target < 3.6) optionGenerates.push(function* () {
|
|
21868
|
-
let propsType = `${ctx.localTypes.TypePropsToOption}<${names_1.names.PublicProps}>`;
|
|
21869
|
-
if (scriptSetupRanges.withDefaults?.arg) propsType = `${ctx.localTypes.WithDefaults}<${propsType}, typeof ${names_1.names.defaults}>`;
|
|
21870
|
-
yield `{} as ${propsType}`;
|
|
21871
|
-
});
|
|
21872
|
-
typeOptionGenerates.push(function* () {
|
|
21873
|
-
yield `{} as ${names_1.names.PublicProps}`;
|
|
21874
|
-
});
|
|
21875
|
-
}
|
|
21876
|
-
if (scriptSetupRanges.defineProps?.arg) {
|
|
21877
|
-
const { arg } = scriptSetupRanges.defineProps;
|
|
21878
|
-
optionGenerates.push(() => (0, utils_1.generateSfcBlockSection)(scriptSetup, arg.start, arg.end, codeFeatures_1.codeFeatures.navigation));
|
|
21879
|
-
typeOptionGenerates.length = 0;
|
|
21880
|
-
}
|
|
21881
|
-
const useTypeOption = options.vueCompilerOptions.target >= 3.5 && typeOptionGenerates.length;
|
|
21882
|
-
const useOption = (!useTypeOption || scriptSetupRanges.withDefaults) && optionGenerates.length;
|
|
21883
|
-
if (useTypeOption) {
|
|
21868
|
+
const typeCodes = options.vueCompilerOptions.target >= 3.5 && !scriptSetupRanges.defineProps?.arg ? [...generateTypePropsOption(options, ctx, hasEmitsOption)] : [];
|
|
21869
|
+
const runtimeCodes = scriptSetupRanges.withDefaults || !typeCodes.length ? [...generateRuntimePropsOption(options, ctx, scriptSetup, scriptSetupRanges, hasEmitsOption)] : [];
|
|
21870
|
+
if (typeCodes.length) {
|
|
21884
21871
|
if (options.vueCompilerOptions.target >= 3.6 && scriptSetupRanges.withDefaults?.arg) yield `__defaults: ${names_1.names.defaults},${utils_1.newLine}`;
|
|
21885
21872
|
yield `__typeProps: `;
|
|
21886
|
-
yield* (0, merge_1.generateSpreadMerge)(
|
|
21873
|
+
yield* (0, merge_1.generateSpreadMerge)(...typeCodes);
|
|
21887
21874
|
yield `,${utils_1.newLine}`;
|
|
21888
21875
|
}
|
|
21889
|
-
if (
|
|
21876
|
+
if (runtimeCodes.length) {
|
|
21890
21877
|
yield `props: `;
|
|
21891
|
-
yield* (0, merge_1.generateSpreadMerge)(
|
|
21878
|
+
yield* (0, merge_1.generateSpreadMerge)(...runtimeCodes);
|
|
21892
21879
|
yield `,${utils_1.newLine}`;
|
|
21893
21880
|
}
|
|
21894
21881
|
}
|
|
21882
|
+
function* generateTypePropsOption(options, ctx, hasEmitsOption) {
|
|
21883
|
+
if (options.templateAndStyleTypes.has(names_1.names.InheritedAttrs)) yield `{} as ${hasEmitsOption ? `Omit<${names_1.names.InheritedAttrs}, keyof ${names_1.names.EmitProps}>` : names_1.names.InheritedAttrs}`;
|
|
21884
|
+
if (ctx.generatedTypes.has(names_1.names.PublicProps)) yield `{} as ${names_1.names.PublicProps}`;
|
|
21885
|
+
}
|
|
21886
|
+
function* generateRuntimePropsOption(options, ctx, scriptSetup, scriptSetupRanges, hasEmitsOption) {
|
|
21887
|
+
if (options.templateAndStyleTypes.has(names_1.names.InheritedAttrs)) {
|
|
21888
|
+
const attrsType = hasEmitsOption ? `Omit<${names_1.names.InheritedAttrs}, keyof ${names_1.names.EmitProps}>` : names_1.names.InheritedAttrs;
|
|
21889
|
+
yield `{} as ${`${ctx.localTypes.TypePropsToOption}<${names_1.names.PickNotAny}<${ctx.localTypes.OmitIndexSignature}<${attrsType}>, {}>>`}`;
|
|
21890
|
+
}
|
|
21891
|
+
if (ctx.generatedTypes.has(names_1.names.PublicProps) && options.vueCompilerOptions.target < 3.6) {
|
|
21892
|
+
let propsType = `${ctx.localTypes.TypePropsToOption}<${names_1.names.PublicProps}>`;
|
|
21893
|
+
if (scriptSetupRanges.withDefaults?.arg) propsType = `${ctx.localTypes.WithDefaults}<${propsType}, typeof ${names_1.names.defaults}>`;
|
|
21894
|
+
yield `{} as ${propsType}`;
|
|
21895
|
+
}
|
|
21896
|
+
if (scriptSetupRanges.defineProps?.arg) {
|
|
21897
|
+
const { arg } = scriptSetupRanges.defineProps;
|
|
21898
|
+
yield* (0, utils_1.generateSfcBlockSection)(scriptSetup, arg.start, arg.end, codeFeatures_1.codeFeatures.navigation);
|
|
21899
|
+
}
|
|
21900
|
+
}
|
|
21895
21901
|
}));
|
|
21896
21902
|
//#endregion
|
|
21897
21903
|
//#region node_modules/@vue/language-core/lib/codegen/script/scriptSetup.js
|
|
@@ -22201,26 +22207,26 @@ var require_template = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
22201
22207
|
const exps = [];
|
|
22202
22208
|
const emitTypes = [];
|
|
22203
22209
|
const propTypes = [];
|
|
22204
|
-
if (vueCompilerOptions.petiteVueExtensions.some((ext) => fileName.endsWith(ext))) exps.push(
|
|
22205
|
-
if (selfType) exps.push(
|
|
22206
|
-
else exps.push(
|
|
22207
|
-
if (templateAndStyleTypes.has(names_1.names.StyleModules)) exps.push(
|
|
22210
|
+
if (vueCompilerOptions.petiteVueExtensions.some((ext) => fileName.endsWith(ext))) exps.push(`globalThis`);
|
|
22211
|
+
if (selfType) exps.push(`{} as InstanceType<${names_1.names.PickNotAny}<typeof ${selfType}, new () => {}>>`);
|
|
22212
|
+
else exps.push(`{} as import('${vueCompilerOptions.lib}').ComponentPublicInstance`);
|
|
22213
|
+
if (templateAndStyleTypes.has(names_1.names.StyleModules)) exps.push(`{} as ${names_1.names.StyleModules}`);
|
|
22208
22214
|
if (scriptSetupRanges?.defineEmits) emitTypes.push(`typeof ${scriptSetupRanges.defineEmits.name ?? names_1.names.emit}`);
|
|
22209
22215
|
if (scriptSetupRanges?.defineModel.length) emitTypes.push(`typeof ${names_1.names.modelEmit}`);
|
|
22210
22216
|
if (emitTypes.length) {
|
|
22211
22217
|
yield `type ${names_1.names.EmitProps} = ${names_1.names.EmitsToProps}<${names_1.names.NormalizeEmits}<${emitTypes.join(` & `)}>>${utils_1.endOfLine}`;
|
|
22212
|
-
exps.push(
|
|
22218
|
+
exps.push(`{} as { $emit: ${emitTypes.join(` & `)} }`);
|
|
22213
22219
|
}
|
|
22214
22220
|
if (scriptSetupRanges?.defineProps) propTypes.push(`typeof ${scriptSetupRanges.defineProps.name ?? names_1.names.props}`);
|
|
22215
22221
|
if (scriptSetupRanges?.defineModel.length) propTypes.push(names_1.names.ModelProps);
|
|
22216
22222
|
if (emitTypes.length) propTypes.push(names_1.names.EmitProps);
|
|
22217
22223
|
if (propTypes.length) {
|
|
22218
|
-
exps.push(
|
|
22219
|
-
exps.push(
|
|
22224
|
+
exps.push(`{} as { $props: ${propTypes.join(` & `)} }`);
|
|
22225
|
+
exps.push(`{} as ${propTypes.join(` & `)}`);
|
|
22220
22226
|
}
|
|
22221
|
-
if (ctx.generatedTypes.has(names_1.names.SetupExposed)) exps.push(
|
|
22227
|
+
if (ctx.generatedTypes.has(names_1.names.SetupExposed)) exps.push(`{} as ${names_1.names.SetupExposed}`);
|
|
22222
22228
|
yield `const ${names_1.names.ctx} = `;
|
|
22223
|
-
yield* (0, merge_1.generateSpreadMerge)(exps);
|
|
22229
|
+
yield* (0, merge_1.generateSpreadMerge)(...exps);
|
|
22224
22230
|
yield utils_1.endOfLine;
|
|
22225
22231
|
}
|
|
22226
22232
|
function* generateTemplateComponents({ vueCompilerOptions, script, scriptRanges }, ctx) {
|
|
@@ -23088,33 +23094,33 @@ var require_vue_tsx = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
23088
23094
|
var plugin = ({ modules: { typescript: ts }, vueCompilerOptions }) => {
|
|
23089
23095
|
return {
|
|
23090
23096
|
version: 2.2,
|
|
23091
|
-
getEmbeddedCodes(_fileName,
|
|
23092
|
-
const lang = computeLang(
|
|
23097
|
+
getEmbeddedCodes(_fileName, ir) {
|
|
23098
|
+
const lang = computeLang(ir);
|
|
23093
23099
|
return [{
|
|
23094
23100
|
lang,
|
|
23095
23101
|
id: "script_" + lang
|
|
23096
23102
|
}];
|
|
23097
23103
|
},
|
|
23098
|
-
resolveEmbeddedCode(fileName,
|
|
23104
|
+
resolveEmbeddedCode(fileName, ir, embeddedFile) {
|
|
23099
23105
|
if (/script_(js|jsx|ts|tsx)/.test(embeddedFile.id)) {
|
|
23100
|
-
let codegen = exports.tsCodegen.get(
|
|
23101
|
-
if (!codegen) exports.tsCodegen.set(
|
|
23106
|
+
let codegen = exports.tsCodegen.get(ir);
|
|
23107
|
+
if (!codegen) exports.tsCodegen.set(ir, codegen = useCodegen(ts, vueCompilerOptions, fileName, ir));
|
|
23102
23108
|
embeddedFile.content = [...codegen.getGeneratedScript().codes];
|
|
23103
23109
|
}
|
|
23104
23110
|
}
|
|
23105
23111
|
};
|
|
23106
|
-
function computeLang(
|
|
23107
|
-
let lang =
|
|
23108
|
-
if (
|
|
23109
|
-
else lang =
|
|
23112
|
+
function computeLang(ir) {
|
|
23113
|
+
let lang = ir.scriptSetup?.lang ?? ir.script?.lang;
|
|
23114
|
+
if (ir.script && ir.scriptSetup) if (ir.scriptSetup.lang !== "js") lang = ir.scriptSetup.lang;
|
|
23115
|
+
else lang = ir.script.lang;
|
|
23110
23116
|
if (lang && validLangs.has(lang)) return lang;
|
|
23111
23117
|
return "ts";
|
|
23112
23118
|
}
|
|
23113
23119
|
};
|
|
23114
23120
|
exports.default = plugin;
|
|
23115
|
-
function useCodegen(ts, vueCompilerOptions, fileName,
|
|
23121
|
+
function useCodegen(ts, vueCompilerOptions, fileName, ir) {
|
|
23116
23122
|
const getResolvedOptions = (0, alien_signals_1.computed)(() => {
|
|
23117
|
-
const options = (0, vueCompilerOptions_1.parseVueCompilerOptions)(
|
|
23123
|
+
const options = (0, vueCompilerOptions_1.parseVueCompilerOptions)(ir.comments);
|
|
23118
23124
|
if (options) {
|
|
23119
23125
|
const resolver = new compilerOptions_1.CompilerOptionsResolver(ts, () => void 0);
|
|
23120
23126
|
resolver.addConfig(options, path.dirname(fileName));
|
|
@@ -23122,15 +23128,15 @@ var require_vue_tsx = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
23122
23128
|
}
|
|
23123
23129
|
return vueCompilerOptions;
|
|
23124
23130
|
});
|
|
23125
|
-
const getScriptRanges = (0, alien_signals_1.computed)(() =>
|
|
23126
|
-
const getScriptSetupRanges = (0, alien_signals_1.computed)(() =>
|
|
23131
|
+
const getScriptRanges = (0, alien_signals_1.computed)(() => ir.script && validLangs.has(ir.script.lang) ? (0, scriptRanges_1.parseScriptRanges)(ts, ir.script.ast, getResolvedOptions()) : void 0);
|
|
23132
|
+
const getScriptSetupRanges = (0, alien_signals_1.computed)(() => ir.scriptSetup && validLangs.has(ir.scriptSetup.lang) ? (0, scriptSetupRanges_1.parseScriptSetupRanges)(ts, ir.scriptSetup.ast, getResolvedOptions()) : void 0);
|
|
23127
23133
|
const getImportedComponents = (0, signals_1.computedSet)(() => {
|
|
23128
23134
|
const names = /* @__PURE__ */ new Set();
|
|
23129
23135
|
const scriptSetupRanges = getScriptSetupRanges();
|
|
23130
|
-
if (
|
|
23131
|
-
for (const range of scriptSetupRanges.components) names.add(
|
|
23136
|
+
if (ir.scriptSetup && scriptSetupRanges) {
|
|
23137
|
+
for (const range of scriptSetupRanges.components) names.add(ir.scriptSetup.content.slice(range.start, range.end));
|
|
23132
23138
|
const scriptRange = getScriptRanges();
|
|
23133
|
-
if (
|
|
23139
|
+
if (ir.script && scriptRange) for (const range of scriptRange.components) names.add(ir.script.content.slice(range.start, range.end));
|
|
23134
23140
|
}
|
|
23135
23141
|
return names;
|
|
23136
23142
|
});
|
|
@@ -23153,10 +23159,10 @@ var require_vue_tsx = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
23153
23159
|
const getComponentName = (0, alien_signals_1.computed)(() => {
|
|
23154
23160
|
let name;
|
|
23155
23161
|
const componentOptions = getScriptRanges()?.exportDefault?.options;
|
|
23156
|
-
if (
|
|
23162
|
+
if (ir.script && componentOptions?.name) name = ir.script.content.slice(componentOptions.name.start + 1, componentOptions.name.end - 1);
|
|
23157
23163
|
else {
|
|
23158
23164
|
const { defineOptions } = getScriptSetupRanges() ?? {};
|
|
23159
|
-
if (
|
|
23165
|
+
if (ir.scriptSetup && defineOptions?.name) name = defineOptions.name;
|
|
23160
23166
|
else {
|
|
23161
23167
|
const baseName = path.basename(fileName);
|
|
23162
23168
|
name = baseName.slice(0, baseName.lastIndexOf("."));
|
|
@@ -23165,11 +23171,11 @@ var require_vue_tsx = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
23165
23171
|
return (0, shared_1.capitalize)((0, shared_1.camelize)(name));
|
|
23166
23172
|
});
|
|
23167
23173
|
const getGeneratedTemplate = (0, alien_signals_1.computed)(() => {
|
|
23168
|
-
if (getResolvedOptions().skipTemplateCodegen || !
|
|
23174
|
+
if (getResolvedOptions().skipTemplateCodegen || !ir.template) return;
|
|
23169
23175
|
return (0, template_1.generateTemplate)({
|
|
23170
23176
|
typescript: ts,
|
|
23171
23177
|
vueCompilerOptions: getResolvedOptions(),
|
|
23172
|
-
template:
|
|
23178
|
+
template: ir.template,
|
|
23173
23179
|
componentName: getComponentName(),
|
|
23174
23180
|
setupConsts: getSetupConsts(),
|
|
23175
23181
|
setupRefs: getSetupRefs(),
|
|
@@ -23180,11 +23186,11 @@ var require_vue_tsx = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
23180
23186
|
});
|
|
23181
23187
|
});
|
|
23182
23188
|
const getGeneratedStyle = (0, alien_signals_1.computed)(() => {
|
|
23183
|
-
if (!
|
|
23189
|
+
if (!ir.styles.length) return;
|
|
23184
23190
|
return (0, style_1.generateStyle)({
|
|
23185
23191
|
typescript: ts,
|
|
23186
23192
|
vueCompilerOptions: getResolvedOptions(),
|
|
23187
|
-
styles:
|
|
23193
|
+
styles: ir.styles,
|
|
23188
23194
|
setupConsts: getSetupConsts(),
|
|
23189
23195
|
setupRefs: getSetupRefs()
|
|
23190
23196
|
});
|
|
@@ -23192,21 +23198,21 @@ var require_vue_tsx = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
23192
23198
|
const getSetupExposed = (0, signals_1.computedSet)(() => {
|
|
23193
23199
|
const allVars = /* @__PURE__ */ new Set();
|
|
23194
23200
|
const scriptSetupRanges = getScriptSetupRanges();
|
|
23195
|
-
if (!
|
|
23201
|
+
if (!ir.scriptSetup || !scriptSetupRanges) return allVars;
|
|
23196
23202
|
for (const range of scriptSetupRanges.bindings) {
|
|
23197
|
-
const name =
|
|
23203
|
+
const name = ir.scriptSetup.content.slice(range.start, range.end);
|
|
23198
23204
|
allVars.add(name);
|
|
23199
23205
|
}
|
|
23200
23206
|
const scriptRanges = getScriptRanges();
|
|
23201
|
-
if (
|
|
23202
|
-
const name =
|
|
23207
|
+
if (ir.script && scriptRanges) for (const range of scriptRanges.bindings) {
|
|
23208
|
+
const name = ir.script.content.slice(range.start, range.end);
|
|
23203
23209
|
allVars.add(name);
|
|
23204
23210
|
}
|
|
23205
23211
|
if (!allVars.size) return allVars;
|
|
23206
23212
|
return new Set([
|
|
23207
23213
|
...getGeneratedTemplate()?.componentAccessMap.keys() ?? [],
|
|
23208
23214
|
...getGeneratedStyle()?.componentAccessMap.keys() ?? [],
|
|
23209
|
-
...
|
|
23215
|
+
...ir.template?.ast?.components.flatMap((name) => [(0, shared_1.camelize)(name), (0, shared_1.capitalize)((0, shared_1.camelize)(name))]) ?? []
|
|
23210
23216
|
].filter((name) => allVars.has(name)));
|
|
23211
23217
|
});
|
|
23212
23218
|
return {
|
|
@@ -23216,8 +23222,8 @@ var require_vue_tsx = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
23216
23222
|
return (0, script_1.generateScript)({
|
|
23217
23223
|
vueCompilerOptions: getResolvedOptions(),
|
|
23218
23224
|
fileName,
|
|
23219
|
-
script:
|
|
23220
|
-
scriptSetup:
|
|
23225
|
+
script: ir.script,
|
|
23226
|
+
scriptSetup: ir.scriptSetup,
|
|
23221
23227
|
exposed: getSetupExposed(),
|
|
23222
23228
|
scriptRanges: getScriptRanges(),
|
|
23223
23229
|
scriptSetupRanges: getScriptSetupRanges(),
|
|
@@ -23343,14 +23349,14 @@ var require_embeddedCodes = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
23343
23349
|
}
|
|
23344
23350
|
};
|
|
23345
23351
|
exports.VueEmbeddedCode = VueEmbeddedCode;
|
|
23346
|
-
function useEmbeddedCodes(plugins, fileName,
|
|
23352
|
+
function useEmbeddedCodes(plugins, fileName, ir) {
|
|
23347
23353
|
const getNameToBlockMap = (0, alien_signals_1.computed)(() => {
|
|
23348
23354
|
const blocks = {};
|
|
23349
|
-
if (
|
|
23350
|
-
if (
|
|
23351
|
-
if (
|
|
23352
|
-
for (const block of
|
|
23353
|
-
for (const block of
|
|
23355
|
+
if (ir.template) blocks[ir.template.name] = ir.template;
|
|
23356
|
+
if (ir.script) blocks[ir.script.name] = ir.script;
|
|
23357
|
+
if (ir.scriptSetup) blocks[ir.scriptSetup.name] = ir.scriptSetup;
|
|
23358
|
+
for (const block of ir.styles) blocks[block.name] = block;
|
|
23359
|
+
for (const block of ir.customBlocks) blocks[block.name] = block;
|
|
23354
23360
|
return blocks;
|
|
23355
23361
|
});
|
|
23356
23362
|
const pluginsResult = plugins.map(useEmbeddedCodesForPlugin);
|
|
@@ -23385,7 +23391,7 @@ var require_embeddedCodes = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
23385
23391
|
function useEmbeddedCodesForPlugin(plugin) {
|
|
23386
23392
|
const getMap = (0, alien_signals_1.computed)((prevMap) => {
|
|
23387
23393
|
if (!plugin.getEmbeddedCodes) return /* @__PURE__ */ new Map();
|
|
23388
|
-
const newCodeList = plugin.getEmbeddedCodes(fileName,
|
|
23394
|
+
const newCodeList = plugin.getEmbeddedCodes(fileName, ir);
|
|
23389
23395
|
const map = /* @__PURE__ */ new Map();
|
|
23390
23396
|
for (const { id, lang } of newCodeList) {
|
|
23391
23397
|
const key = id + "__" + lang;
|
|
@@ -23413,7 +23419,7 @@ var require_embeddedCodes = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
23413
23419
|
for (const plugin of plugins) {
|
|
23414
23420
|
if (!plugin.resolveEmbeddedCode) continue;
|
|
23415
23421
|
try {
|
|
23416
|
-
plugin.resolveEmbeddedCode(fileName,
|
|
23422
|
+
plugin.resolveEmbeddedCode(fileName, ir, code);
|
|
23417
23423
|
} catch (e) {
|
|
23418
23424
|
console.error(e);
|
|
23419
23425
|
}
|
|
@@ -23809,6 +23815,10 @@ var require_virtualCode = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
23809
23815
|
get vueSfc() {
|
|
23810
23816
|
return this._parsedSfcResult()?.result;
|
|
23811
23817
|
}
|
|
23818
|
+
get ir() {
|
|
23819
|
+
return this._ir;
|
|
23820
|
+
}
|
|
23821
|
+
/** @deprecated use `ir` instead */
|
|
23812
23822
|
get sfc() {
|
|
23813
23823
|
return this._ir;
|
|
23814
23824
|
}
|
|
@@ -84854,7 +84864,7 @@ var require_css = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
84854
84864
|
function isWithinNavigationVirtualCode(document, position) {
|
|
84855
84865
|
const info = (0, utils_1.resolveEmbeddedCode)(context, document.uri);
|
|
84856
84866
|
if (!info?.code.id.startsWith("style_")) return false;
|
|
84857
|
-
const block = info.root.
|
|
84867
|
+
const block = info.root.ir.styles.find((style) => style.name === info.code.id);
|
|
84858
84868
|
if (!block) return false;
|
|
84859
84869
|
let script;
|
|
84860
84870
|
for (const [key, value] of info.script.generated.embeddedCodes) if (key.startsWith("script_")) {
|
|
@@ -85073,8 +85083,8 @@ var require_vue_autoinsert_dotvalue = /* @__PURE__ */ __commonJSMin(((exports) =
|
|
|
85073
85083
|
if (document.offsetAt(selection) !== change.rangeOffset + change.text.length) return;
|
|
85074
85084
|
if (!isCharacterTyping(document, change)) return;
|
|
85075
85085
|
let sourceOffset;
|
|
85076
|
-
const {
|
|
85077
|
-
const scriptBlocks = [
|
|
85086
|
+
const { ir } = info.root;
|
|
85087
|
+
const scriptBlocks = [ir.script, ir.scriptSetup].filter((block) => !!block);
|
|
85078
85088
|
const map = context.language.maps.get(info.code, info.script);
|
|
85079
85089
|
if (!scriptBlocks.length) return;
|
|
85080
85090
|
for (const [offset] of map.toSourceLocation(document.offsetAt(selection))) {
|
|
@@ -85173,7 +85183,7 @@ var require_vue_compiler_dom_errors = /* @__PURE__ */ __commonJSMin(((exports) =
|
|
|
85173
85183
|
return { provideDiagnostics(document) {
|
|
85174
85184
|
const info = (0, utils_1.resolveEmbeddedCode)(context, document.uri);
|
|
85175
85185
|
if (info?.code.id !== "template") return;
|
|
85176
|
-
const { template } = info.root.
|
|
85186
|
+
const { template } = info.root.ir;
|
|
85177
85187
|
if (!template) return;
|
|
85178
85188
|
const diagnostics = [];
|
|
85179
85189
|
for (const [errors, severity] of [[template.errors, 1], [template.warnings, 2]]) for (const error of errors) diagnostics.push({
|
|
@@ -85210,7 +85220,7 @@ var require_vue_component_semantic_tokens = /* @__PURE__ */ __commonJSMin(((expo
|
|
|
85210
85220
|
return { async provideDocumentSemanticTokens(document, range, legend) {
|
|
85211
85221
|
const info = (0, utils_1.resolveEmbeddedCode)(context, document.uri);
|
|
85212
85222
|
if (info?.code.id !== "template") return;
|
|
85213
|
-
const { template } = info.root.
|
|
85223
|
+
const { template } = info.root.ir;
|
|
85214
85224
|
if (!template?.ast) return;
|
|
85215
85225
|
const componentSpans = [];
|
|
85216
85226
|
const start = document.offsetAt(range.start);
|
|
@@ -85317,101 +85327,6 @@ var require_vue_directive_comments = /* @__PURE__ */ __commonJSMin(((exports) =>
|
|
|
85317
85327
|
}
|
|
85318
85328
|
}));
|
|
85319
85329
|
//#endregion
|
|
85320
|
-
//#region node_modules/volar-service-typescript/lib/configs/getUserPreferences.js
|
|
85321
|
-
var require_getUserPreferences = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
85322
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
85323
|
-
exports.getUserPreferences = getUserPreferences;
|
|
85324
|
-
var path = require_path_browserify();
|
|
85325
|
-
var vscode_uri_1 = require_umd();
|
|
85326
|
-
var shared_1 = require_shared();
|
|
85327
|
-
async function getUserPreferences(ctx, document) {
|
|
85328
|
-
let currentDirectory = "";
|
|
85329
|
-
if (ctx.project.typescript) currentDirectory = ctx.project.typescript.languageServiceHost.getCurrentDirectory();
|
|
85330
|
-
const uri = vscode_uri_1.URI.parse(document.uri);
|
|
85331
|
-
const documentUri = ctx.decodeEmbeddedDocumentUri(uri)?.[0] ?? uri;
|
|
85332
|
-
const config = await ctx.env.getConfiguration?.((0, shared_1.getConfigTitle)(document)) ?? {};
|
|
85333
|
-
const preferencesConfig = config?.preferences ?? {};
|
|
85334
|
-
return {
|
|
85335
|
-
...config.unstable ?? {},
|
|
85336
|
-
quotePreference: getQuoteStylePreference(preferencesConfig),
|
|
85337
|
-
importModuleSpecifierPreference: getImportModuleSpecifierPreference(preferencesConfig),
|
|
85338
|
-
importModuleSpecifierEnding: getImportModuleSpecifierEndingPreference(preferencesConfig),
|
|
85339
|
-
jsxAttributeCompletionStyle: getJsxAttributeCompletionStyle(preferencesConfig),
|
|
85340
|
-
allowTextChangesInNewFiles: documentUri.scheme === "file",
|
|
85341
|
-
providePrefixAndSuffixTextForRename: (preferencesConfig.renameShorthandProperties ?? true) === false ? false : preferencesConfig.useAliasesForRenames ?? true,
|
|
85342
|
-
allowRenameOfImportPath: true,
|
|
85343
|
-
includeAutomaticOptionalChainCompletions: config.suggest?.includeAutomaticOptionalChainCompletions ?? true,
|
|
85344
|
-
provideRefactorNotApplicableReason: true,
|
|
85345
|
-
generateReturnInDocTemplate: config.suggest?.jsdoc?.generateReturns ?? true,
|
|
85346
|
-
includeCompletionsForImportStatements: config.suggest?.includeCompletionsForImportStatements ?? true,
|
|
85347
|
-
includeCompletionsWithSnippetText: config.suggest?.includeCompletionsWithSnippetText ?? true,
|
|
85348
|
-
includeCompletionsWithClassMemberSnippets: config.suggest?.classMemberSnippets?.enabled ?? true,
|
|
85349
|
-
includeCompletionsWithObjectLiteralMethodSnippets: config.suggest?.objectLiteralMethodSnippets?.enabled ?? true,
|
|
85350
|
-
autoImportFileExcludePatterns: getAutoImportFileExcludePatternsPreference(preferencesConfig, currentDirectory),
|
|
85351
|
-
autoImportSpecifierExcludeRegexes: preferencesConfig.autoImportSpecifierExcludeRegexes,
|
|
85352
|
-
useLabelDetailsInCompletionEntries: true,
|
|
85353
|
-
allowIncompleteCompletions: true,
|
|
85354
|
-
displayPartsForJSDoc: true,
|
|
85355
|
-
includeInlayParameterNameHints: getInlayParameterNameHintsPreference(config),
|
|
85356
|
-
includeInlayParameterNameHintsWhenArgumentMatchesName: !(config.inlayHints?.parameterNames?.suppressWhenArgumentMatchesName ?? true),
|
|
85357
|
-
includeInlayFunctionParameterTypeHints: config.inlayHints?.parameterTypes?.enabled ?? false,
|
|
85358
|
-
includeInlayVariableTypeHints: config.inlayHints?.variableTypes?.enabled ?? false,
|
|
85359
|
-
includeInlayVariableTypeHintsWhenTypeMatchesName: !(config.inlayHints?.variableTypes?.suppressWhenTypeMatchesName ?? true),
|
|
85360
|
-
includeInlayPropertyDeclarationTypeHints: config.inlayHints?.propertyDeclarationTypes?.enabled ?? false,
|
|
85361
|
-
includeInlayFunctionLikeReturnTypeHints: config.inlayHints?.functionLikeReturnTypes?.enabled ?? false,
|
|
85362
|
-
includeInlayEnumMemberValueHints: config.inlayHints?.enumMemberValues?.enabled ?? false,
|
|
85363
|
-
includeCompletionsForModuleExports: config.suggest?.autoImports ?? true,
|
|
85364
|
-
includeCompletionsWithInsertText: true,
|
|
85365
|
-
includePackageJsonAutoImports: preferencesConfig.includePackageJsonAutoImports ?? "auto"
|
|
85366
|
-
};
|
|
85367
|
-
}
|
|
85368
|
-
function getQuoteStylePreference(config) {
|
|
85369
|
-
switch (config.quoteStyle) {
|
|
85370
|
-
case "single": return "single";
|
|
85371
|
-
case "double": return "double";
|
|
85372
|
-
default: return "auto";
|
|
85373
|
-
}
|
|
85374
|
-
}
|
|
85375
|
-
function getAutoImportFileExcludePatternsPreference(config, workspacePath) {
|
|
85376
|
-
if (workspacePath) return config.autoImportFileExcludePatterns?.map((p) => {
|
|
85377
|
-
const slashNormalized = p.replace(/\\/g, "/");
|
|
85378
|
-
const isRelative = /^\.\.?($|\/)/.test(slashNormalized);
|
|
85379
|
-
return path.isAbsolute(p) ? p : p.startsWith("*") ? "/" + slashNormalized : isRelative ? path.join(workspacePath, p) : "/**/" + slashNormalized;
|
|
85380
|
-
});
|
|
85381
|
-
}
|
|
85382
|
-
function getImportModuleSpecifierPreference(config) {
|
|
85383
|
-
switch (config.importModuleSpecifier) {
|
|
85384
|
-
case "project-relative": return "project-relative";
|
|
85385
|
-
case "relative": return "relative";
|
|
85386
|
-
case "non-relative": return "non-relative";
|
|
85387
|
-
default: return;
|
|
85388
|
-
}
|
|
85389
|
-
}
|
|
85390
|
-
function getImportModuleSpecifierEndingPreference(config) {
|
|
85391
|
-
switch (config.importModuleSpecifierEnding) {
|
|
85392
|
-
case "minimal": return "minimal";
|
|
85393
|
-
case "index": return "index";
|
|
85394
|
-
case "js": return "js";
|
|
85395
|
-
default: return "minimal";
|
|
85396
|
-
}
|
|
85397
|
-
}
|
|
85398
|
-
function getJsxAttributeCompletionStyle(config) {
|
|
85399
|
-
switch (config.jsxAttributeCompletionStyle) {
|
|
85400
|
-
case "braces": return "braces";
|
|
85401
|
-
case "none": return "none";
|
|
85402
|
-
default: return "auto";
|
|
85403
|
-
}
|
|
85404
|
-
}
|
|
85405
|
-
function getInlayParameterNameHintsPreference(config) {
|
|
85406
|
-
switch (config.inlayHints?.parameterNames?.enabled) {
|
|
85407
|
-
case "none": return "none";
|
|
85408
|
-
case "literals": return "literals";
|
|
85409
|
-
case "all": return "all";
|
|
85410
|
-
default: return;
|
|
85411
|
-
}
|
|
85412
|
-
}
|
|
85413
|
-
}));
|
|
85414
|
-
//#endregion
|
|
85415
85330
|
//#region node_modules/@vue/language-service/lib/nameCasing.js
|
|
85416
85331
|
var require_nameCasing = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
85417
85332
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -85471,7 +85386,7 @@ var require_nameCasing = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
85471
85386
|
function collectTagsWithCache(code) {
|
|
85472
85387
|
let cache = collectCache.get(code);
|
|
85473
85388
|
if (!cache) {
|
|
85474
|
-
const ast = code.
|
|
85389
|
+
const ast = code.ir.template?.ast;
|
|
85475
85390
|
cache = ast ? collectTags(ast) : /* @__PURE__ */ new Map();
|
|
85476
85391
|
collectCache.set(code, cache);
|
|
85477
85392
|
}
|
|
@@ -85519,10 +85434,10 @@ var require_vue_extract_file = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
85519
85434
|
if (startOffset === endOffset) return;
|
|
85520
85435
|
const info = (0, utils_1.resolveEmbeddedCode)(context, document.uri);
|
|
85521
85436
|
if (info?.code.id !== "template") return;
|
|
85522
|
-
const {
|
|
85523
|
-
const script =
|
|
85524
|
-
if (!
|
|
85525
|
-
if (!selectTemplateCode(startOffset, endOffset,
|
|
85437
|
+
const { ir } = info.root;
|
|
85438
|
+
const script = ir.scriptSetup ?? ir.script;
|
|
85439
|
+
if (!ir.template || !script) return;
|
|
85440
|
+
if (!selectTemplateCode(startOffset, endOffset, ir.template)) return;
|
|
85526
85441
|
return [{
|
|
85527
85442
|
title: "Extract into new dumb component",
|
|
85528
85443
|
kind: "refactor.move.newFile.dumb",
|
|
@@ -85538,10 +85453,10 @@ var require_vue_extract_file = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
85538
85453
|
const [startOffset, endOffset] = range;
|
|
85539
85454
|
const info = (0, utils_1.resolveEmbeddedCode)(context, uri);
|
|
85540
85455
|
if (info?.code.id !== "template") return codeAction;
|
|
85541
|
-
const {
|
|
85542
|
-
const script =
|
|
85543
|
-
if (!
|
|
85544
|
-
const templateCodeRange = selectTemplateCode(startOffset, endOffset,
|
|
85456
|
+
const { ir } = info.root;
|
|
85457
|
+
const script = ir.scriptSetup ?? ir.script;
|
|
85458
|
+
if (!ir.template || !script) return codeAction;
|
|
85459
|
+
const templateCodeRange = selectTemplateCode(startOffset, endOffset, ir.template);
|
|
85545
85460
|
if (!templateCodeRange) return codeAction;
|
|
85546
85461
|
const toExtract = await collectExtractProps(info.root.fileName, templateCodeRange) ?? [];
|
|
85547
85462
|
const templateInitialIndent = await context.env.getConfiguration("vue.format.template.initialIndent") ?? true;
|
|
@@ -85551,9 +85466,9 @@ var require_vue_extract_file = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
85551
85466
|
const newUri = sfcDocument.uri.slice(0, sfcDocument.uri.lastIndexOf("/") + 1) + `${newName}.vue`;
|
|
85552
85467
|
const lastImportNode = getLastImportNode(ts, script.ast);
|
|
85553
85468
|
let newFileTags = [];
|
|
85554
|
-
newFileTags.push(constructTag("template", [], templateInitialIndent,
|
|
85469
|
+
newFileTags.push(constructTag("template", [], templateInitialIndent, ir.template.content.slice(templateCodeRange[0], templateCodeRange[1])));
|
|
85555
85470
|
if (toExtract.length) newFileTags.push(constructTag("script", ["setup", "lang=\"ts\""], scriptInitialIndent, generateNewScriptContents()));
|
|
85556
|
-
if (
|
|
85471
|
+
if (ir.template.startTagEnd > script.startTagEnd) newFileTags = newFileTags.reverse();
|
|
85557
85472
|
const templateEdits = [{
|
|
85558
85473
|
range: {
|
|
85559
85474
|
start: document.positionAt(templateCodeRange[0]),
|
|
@@ -85571,12 +85486,12 @@ var require_vue_extract_file = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
85571
85486
|
},
|
|
85572
85487
|
newText: `\nimport ${newName} from './${newName}.vue'`
|
|
85573
85488
|
}];
|
|
85574
|
-
if (
|
|
85575
|
-
const edit = createAddComponentToOptionEdit(ts,
|
|
85489
|
+
if (ir.script) {
|
|
85490
|
+
const edit = createAddComponentToOptionEdit(ts, ir, ir.script.ast, newName);
|
|
85576
85491
|
if (edit) sfcEdits.push({
|
|
85577
85492
|
range: {
|
|
85578
|
-
start: sfcDocument.positionAt(
|
|
85579
|
-
end: sfcDocument.positionAt(
|
|
85493
|
+
start: sfcDocument.positionAt(ir.script.startTagEnd + edit.range.start),
|
|
85494
|
+
end: sfcDocument.positionAt(ir.script.startTagEnd + edit.range.end)
|
|
85580
85495
|
},
|
|
85581
85496
|
newText: edit.newText
|
|
85582
85497
|
});
|
|
@@ -85674,8 +85589,8 @@ var require_vue_extract_file = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
85674
85589
|
else break;
|
|
85675
85590
|
return lastImportNode;
|
|
85676
85591
|
}
|
|
85677
|
-
function createAddComponentToOptionEdit(ts,
|
|
85678
|
-
const componentOptions = language_core_1.tsCodegen.get(
|
|
85592
|
+
function createAddComponentToOptionEdit(ts, ir, ast, componentName) {
|
|
85593
|
+
const componentOptions = language_core_1.tsCodegen.get(ir)?.getScriptRanges()?.exportDefault?.options;
|
|
85679
85594
|
if (!componentOptions) return;
|
|
85680
85595
|
const printer = ts.createPrinter();
|
|
85681
85596
|
if (componentOptions.components) {
|
|
@@ -85709,7 +85624,6 @@ var require_vue_document_drop = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
85709
85624
|
var language_core_1 = require_language_core();
|
|
85710
85625
|
var shared_1 = (init_shared_esm_bundler(), __toCommonJS(shared_esm_bundler_exports));
|
|
85711
85626
|
var path_browserify_1 = require_path_browserify();
|
|
85712
|
-
var getUserPreferences_1 = require_getUserPreferences();
|
|
85713
85627
|
var vscode_uri_1 = require_umd();
|
|
85714
85628
|
var nameCasing_1 = require_nameCasing();
|
|
85715
85629
|
var vue_extract_file_1 = require_vue_extract_file();
|
|
@@ -85726,24 +85640,17 @@ var require_vue_document_drop = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
85726
85640
|
let importUri;
|
|
85727
85641
|
for (const [mimeType, item] of dataTransfer) if (mimeType === "text/uri-list") importUri = item.value;
|
|
85728
85642
|
if (!importUri || !info.root.vueCompilerOptions.extensions.some((ext) => importUri.endsWith(ext))) return;
|
|
85729
|
-
const {
|
|
85730
|
-
const script =
|
|
85643
|
+
const { ir } = info.root;
|
|
85644
|
+
const script = ir.scriptSetup ?? ir.script;
|
|
85731
85645
|
if (!script) return;
|
|
85732
85646
|
const tagNameCasing = await (0, nameCasing_1.getTagNameCasing)(context, info.script.id);
|
|
85733
85647
|
const baseName = path_browserify_1.posix.basename(importUri);
|
|
85734
85648
|
const newName = (0, shared_1.capitalize)((0, shared_1.camelize)(baseName.slice(0, baseName.lastIndexOf("."))));
|
|
85735
85649
|
const additionalEdit = {};
|
|
85736
|
-
const code = [...(0, language_core_1.forEachEmbeddedCode)(info.root)].find((code) => code.id === (
|
|
85650
|
+
const code = [...(0, language_core_1.forEachEmbeddedCode)(info.root)].find((code) => code.id === (ir.scriptSetup ? "scriptsetup_raw" : "script_raw"));
|
|
85737
85651
|
const lastImportNode = (0, vue_extract_file_1.getLastImportNode)(ts, script.ast);
|
|
85738
85652
|
const incomingFileName = vscode_uri_1.URI.parse(importUri).fsPath.replace(/\\/g, "/");
|
|
85739
|
-
let importPath;
|
|
85740
|
-
const serviceScript = info.script.generated.languagePlugin.typescript?.getServiceScript(info.root);
|
|
85741
|
-
if (serviceScript) {
|
|
85742
|
-
const tsDocumentUri = context.encodeEmbeddedDocumentUri(info.script.id, serviceScript.code.id);
|
|
85743
|
-
const tsDocument = context.documents.get(tsDocumentUri, serviceScript.code.languageId, serviceScript.code.snapshot);
|
|
85744
|
-
const preferences = await (0, getUserPreferences_1.getUserPreferences)(context, tsDocument);
|
|
85745
|
-
importPath = await getImportPathForFile(info.root.fileName, incomingFileName, preferences);
|
|
85746
|
-
}
|
|
85653
|
+
let importPath = await getImportPathForFile(info.root.fileName, incomingFileName);
|
|
85747
85654
|
if (!importPath) {
|
|
85748
85655
|
importPath = path_browserify_1.posix.relative(path_browserify_1.posix.dirname(info.root.fileName), incomingFileName) || importUri.slice(importUri.lastIndexOf("/") + 1);
|
|
85749
85656
|
if (!importPath.startsWith("./") && !importPath.startsWith("../")) importPath = "./" + importPath;
|
|
@@ -85761,8 +85668,8 @@ var require_vue_document_drop = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
85761
85668
|
},
|
|
85762
85669
|
newText: `\nimport ${newName} from '${importPath}'` + (lastImportNode ? "" : "\n")
|
|
85763
85670
|
});
|
|
85764
|
-
if (
|
|
85765
|
-
const edit = (0, vue_extract_file_1.createAddComponentToOptionEdit)(ts,
|
|
85671
|
+
if (ir.script) {
|
|
85672
|
+
const edit = (0, vue_extract_file_1.createAddComponentToOptionEdit)(ts, ir, ir.script.ast, newName);
|
|
85766
85673
|
if (edit) additionalEdit.changes[embeddedDocumentUriStr].push({
|
|
85767
85674
|
range: {
|
|
85768
85675
|
start: document.positionAt(edit.range.start),
|
|
@@ -85796,7 +85703,7 @@ var require_vue_document_highlights = /* @__PURE__ */ __commonJSMin(((exports) =
|
|
|
85796
85703
|
return { async provideDocumentHighlights(document, position) {
|
|
85797
85704
|
const info = (0, utils_1.resolveEmbeddedCode)(context, document.uri);
|
|
85798
85705
|
if (info?.script.id.scheme !== "file" || info.code.id !== "main") return;
|
|
85799
|
-
const { template } = info.root.
|
|
85706
|
+
const { template } = info.root.ir;
|
|
85800
85707
|
const offset = document.offsetAt(position);
|
|
85801
85708
|
if (template?.ast && offset >= template.startTagEnd && offset <= template.endTagStart) {
|
|
85802
85709
|
const pos = offset - template.startTagEnd;
|
|
@@ -85873,13 +85780,13 @@ var require_vue_inlayhints = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
85873
85780
|
return settings[key] ??= await context.env.getConfiguration?.(key) ?? false;
|
|
85874
85781
|
}
|
|
85875
85782
|
const result = [];
|
|
85876
|
-
const {
|
|
85877
|
-
const codegen = language_core_1.tsCodegen.get(
|
|
85783
|
+
const { ir } = info.root;
|
|
85784
|
+
const codegen = language_core_1.tsCodegen.get(ir);
|
|
85878
85785
|
const inlayHints = [...codegen?.getGeneratedTemplate()?.inlayHints ?? [], ...codegen?.getGeneratedScript().inlayHints ?? []];
|
|
85879
85786
|
const scriptSetupRanges = codegen?.getScriptSetupRanges();
|
|
85880
|
-
if (scriptSetupRanges?.defineProps?.destructured &&
|
|
85787
|
+
if (scriptSetupRanges?.defineProps?.destructured && ir.scriptSetup?.ast) {
|
|
85881
85788
|
const setting = "vue.inlayHints.destructuredProps";
|
|
85882
|
-
if (await getSettingEnabled(setting)) for (const [prop, isShorthand] of findDestructuredProps(ts,
|
|
85789
|
+
if (await getSettingEnabled(setting)) for (const [prop, isShorthand] of findDestructuredProps(ts, ir.scriptSetup.ast, scriptSetupRanges.defineProps.destructured.keys())) {
|
|
85883
85790
|
const name = prop.text;
|
|
85884
85791
|
const end = prop.getEnd();
|
|
85885
85792
|
const pos = isShorthand ? end : end - name.length;
|
|
@@ -85893,9 +85800,9 @@ var require_vue_inlayhints = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
85893
85800
|
}
|
|
85894
85801
|
}
|
|
85895
85802
|
const blocks = [
|
|
85896
|
-
|
|
85897
|
-
|
|
85898
|
-
|
|
85803
|
+
ir.template,
|
|
85804
|
+
ir.script,
|
|
85805
|
+
ir.scriptSetup
|
|
85899
85806
|
];
|
|
85900
85807
|
const start = document.offsetAt(range.start);
|
|
85901
85808
|
const end = document.offsetAt(range.end);
|
|
@@ -86022,6 +85929,128 @@ var require_vue_inlayhints = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
86022
85929
|
}
|
|
86023
85930
|
}));
|
|
86024
85931
|
//#endregion
|
|
85932
|
+
//#region node_modules/@vue/language-service/lib/plugins/vue-missing-props-hints.js
|
|
85933
|
+
var require_vue_missing_props_hints = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
85934
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
85935
|
+
exports.create = create;
|
|
85936
|
+
var language_core_1 = require_language_core();
|
|
85937
|
+
var nameCasing_1 = require_nameCasing();
|
|
85938
|
+
var utils_1 = require_utils$1();
|
|
85939
|
+
function create({ getComponentProps }) {
|
|
85940
|
+
return {
|
|
85941
|
+
name: "vue-missing-props-hints",
|
|
85942
|
+
capabilities: { inlayHintProvider: {} },
|
|
85943
|
+
create(context) {
|
|
85944
|
+
return { async provideInlayHints(document, range, cancellationToken) {
|
|
85945
|
+
const info = (0, utils_1.resolveEmbeddedCode)(context, document.uri);
|
|
85946
|
+
if (info?.code.id !== "template") return;
|
|
85947
|
+
if (!(await context.env.getConfiguration?.("vue.inlayHints.missingProps") ?? false)) return;
|
|
85948
|
+
const { template } = info.root.ir;
|
|
85949
|
+
if (!template?.ast) return;
|
|
85950
|
+
const result = [];
|
|
85951
|
+
const attrNameCasing = await (0, nameCasing_1.getAttrNameCasing)(context, info.script.id);
|
|
85952
|
+
const map = context.language.maps.get(info.code, info.script);
|
|
85953
|
+
for (const node of (0, language_core_1.forEachElementNode)(template.ast)) {
|
|
85954
|
+
if (cancellationToken.isCancellationRequested) break;
|
|
85955
|
+
if (node.tagType !== 1) continue;
|
|
85956
|
+
const [startTagOffset] = (0, language_core_1.getElementTagOffsets)(node, template);
|
|
85957
|
+
const sourceOffset = startTagOffset + node.tag.length;
|
|
85958
|
+
let generatedOffset;
|
|
85959
|
+
for (const [offset] of map.toGeneratedLocation(template.startTagEnd + sourceOffset)) {
|
|
85960
|
+
generatedOffset = offset;
|
|
85961
|
+
break;
|
|
85962
|
+
}
|
|
85963
|
+
if (generatedOffset === void 0 || generatedOffset < document.offsetAt(range.start) || generatedOffset > document.offsetAt(range.end)) continue;
|
|
85964
|
+
const props = await getComponentProps(info.root.fileName, node.loc.start.offset) ?? [];
|
|
85965
|
+
const missingProps = new Map(props.filter((prop) => !prop.optional).map((prop) => [(0, language_core_1.hyphenateAttr)(prop.name), prop.name]));
|
|
85966
|
+
for (const prop of node.props) if (prop.type === 6) missingProps.delete((0, language_core_1.hyphenateAttr)(prop.name));
|
|
85967
|
+
else if (prop.type === 7) {
|
|
85968
|
+
if (prop.name === "bind") {
|
|
85969
|
+
if (prop.arg?.type === 4 && prop.arg.isStatic) missingProps.delete((0, language_core_1.hyphenateAttr)(prop.arg.content));
|
|
85970
|
+
else if (!prop.arg) missingProps.clear();
|
|
85971
|
+
} else if (prop.name === "model") {
|
|
85972
|
+
if (prop.arg?.type === 4 && prop.arg.isStatic) {
|
|
85973
|
+
missingProps.delete((0, language_core_1.hyphenateAttr)(prop.arg.content));
|
|
85974
|
+
missingProps.delete("on-update:" + (0, language_core_1.hyphenateAttr)(prop.arg.content));
|
|
85975
|
+
} else if (!prop.arg) {
|
|
85976
|
+
missingProps.delete("model-value");
|
|
85977
|
+
missingProps.delete("on-update:model-value");
|
|
85978
|
+
}
|
|
85979
|
+
} else if (prop.name === "on") {
|
|
85980
|
+
if (prop.arg?.type === 4 && prop.arg.isStatic) missingProps.delete("on-" + (0, language_core_1.hyphenateAttr)(prop.arg.content));
|
|
85981
|
+
}
|
|
85982
|
+
}
|
|
85983
|
+
for (const name of missingProps.values()) result.push({
|
|
85984
|
+
label: name,
|
|
85985
|
+
paddingLeft: true,
|
|
85986
|
+
position: document.positionAt(generatedOffset),
|
|
85987
|
+
kind: 2,
|
|
85988
|
+
textEdits: [{
|
|
85989
|
+
range: {
|
|
85990
|
+
start: document.positionAt(generatedOffset),
|
|
85991
|
+
end: document.positionAt(generatedOffset)
|
|
85992
|
+
},
|
|
85993
|
+
newText: ` :${attrNameCasing === 0 ? (0, language_core_1.hyphenateAttr)(name) : name}=`
|
|
85994
|
+
}]
|
|
85995
|
+
});
|
|
85996
|
+
}
|
|
85997
|
+
return result;
|
|
85998
|
+
} };
|
|
85999
|
+
}
|
|
86000
|
+
};
|
|
86001
|
+
}
|
|
86002
|
+
}));
|
|
86003
|
+
//#endregion
|
|
86004
|
+
//#region node_modules/@vue/language-service/lib/plugins/vue-scoped-class-links.js
|
|
86005
|
+
var require_vue_scoped_class_links = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
86006
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
86007
|
+
exports.create = create;
|
|
86008
|
+
var styleScopedClasses_1 = require_styleScopedClasses();
|
|
86009
|
+
var utils_1 = require_utils$1();
|
|
86010
|
+
function create() {
|
|
86011
|
+
return {
|
|
86012
|
+
name: "vue-scoped-class-links",
|
|
86013
|
+
capabilities: { documentLinkProvider: {} },
|
|
86014
|
+
create(context) {
|
|
86015
|
+
return { provideDocumentLinks(document) {
|
|
86016
|
+
const info = (0, utils_1.resolveEmbeddedCode)(context, document.uri);
|
|
86017
|
+
if (info?.code.id !== "template") return;
|
|
86018
|
+
const { ir } = info.root;
|
|
86019
|
+
if (!ir.template) return;
|
|
86020
|
+
const { resolveStyleClassNames } = info.root.vueCompilerOptions;
|
|
86021
|
+
if (!resolveStyleClassNames) return;
|
|
86022
|
+
const scopedClasses = styleScopedClasses_1.references.get(ir.template)?.[1] ?? [];
|
|
86023
|
+
const styleClasses = /* @__PURE__ */ new Map();
|
|
86024
|
+
for (const style of ir.styles) {
|
|
86025
|
+
if (!(resolveStyleClassNames === true || style.scoped)) continue;
|
|
86026
|
+
const styleDocumentUri = context.encodeEmbeddedDocumentUri(info.script.id, style.name);
|
|
86027
|
+
const styleVirtualCode = info.script.generated.embeddedCodes.get(style.name);
|
|
86028
|
+
if (!styleVirtualCode) continue;
|
|
86029
|
+
const styleDocument = context.documents.get(styleDocumentUri, styleVirtualCode.languageId, styleVirtualCode.snapshot);
|
|
86030
|
+
for (const { text, offset } of style.classNames) {
|
|
86031
|
+
const start = styleDocument.positionAt(offset);
|
|
86032
|
+
const end = styleDocument.positionAt(offset + text.length);
|
|
86033
|
+
const target = styleDocumentUri + `#L${start.line + 1},${start.character + 1}-L${end.line + 1},${end.character + 1}`;
|
|
86034
|
+
if (!styleClasses.has(text)) styleClasses.set(text, []);
|
|
86035
|
+
styleClasses.get(text).push(target);
|
|
86036
|
+
}
|
|
86037
|
+
}
|
|
86038
|
+
return scopedClasses.flatMap(([className, offset]) => {
|
|
86039
|
+
const range = {
|
|
86040
|
+
start: document.positionAt(offset),
|
|
86041
|
+
end: document.positionAt(offset + className.length)
|
|
86042
|
+
};
|
|
86043
|
+
return styleClasses.get("." + className)?.map((target) => ({
|
|
86044
|
+
range,
|
|
86045
|
+
target
|
|
86046
|
+
})) ?? [];
|
|
86047
|
+
});
|
|
86048
|
+
} };
|
|
86049
|
+
}
|
|
86050
|
+
};
|
|
86051
|
+
}
|
|
86052
|
+
}));
|
|
86053
|
+
//#endregion
|
|
86025
86054
|
//#region node_modules/vscode-html-languageservice/lib/esm/htmlLanguageTypes.js
|
|
86026
86055
|
var TokenType, ScannerState, ClientCapabilities, FileType;
|
|
86027
86056
|
var init_htmlLanguageTypes = __esmMin((() => {
|
|
@@ -104114,188 +104143,6 @@ var init_htmlLanguageService = __esmMin((() => {
|
|
|
104114
104143
|
defaultLanguageServiceOptions = {};
|
|
104115
104144
|
}));
|
|
104116
104145
|
//#endregion
|
|
104117
|
-
//#region node_modules/@vue/language-service/lib/plugins/vue-missing-props-hints.js
|
|
104118
|
-
var require_vue_missing_props_hints = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
104119
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
104120
|
-
if (k2 === void 0) k2 = k;
|
|
104121
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
104122
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
|
|
104123
|
-
enumerable: true,
|
|
104124
|
-
get: function() {
|
|
104125
|
-
return m[k];
|
|
104126
|
-
}
|
|
104127
|
-
};
|
|
104128
|
-
Object.defineProperty(o, k2, desc);
|
|
104129
|
-
}) : (function(o, m, k, k2) {
|
|
104130
|
-
if (k2 === void 0) k2 = k;
|
|
104131
|
-
o[k2] = m[k];
|
|
104132
|
-
}));
|
|
104133
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
104134
|
-
Object.defineProperty(o, "default", {
|
|
104135
|
-
enumerable: true,
|
|
104136
|
-
value: v
|
|
104137
|
-
});
|
|
104138
|
-
}) : function(o, v) {
|
|
104139
|
-
o["default"] = v;
|
|
104140
|
-
});
|
|
104141
|
-
var __importStar = exports && exports.__importStar || (function() {
|
|
104142
|
-
var ownKeys = function(o) {
|
|
104143
|
-
ownKeys = Object.getOwnPropertyNames || function(o) {
|
|
104144
|
-
var ar = [];
|
|
104145
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
104146
|
-
return ar;
|
|
104147
|
-
};
|
|
104148
|
-
return ownKeys(o);
|
|
104149
|
-
};
|
|
104150
|
-
return function(mod) {
|
|
104151
|
-
if (mod && mod.__esModule) return mod;
|
|
104152
|
-
var result = {};
|
|
104153
|
-
if (mod != null) {
|
|
104154
|
-
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
104155
|
-
}
|
|
104156
|
-
__setModuleDefault(result, mod);
|
|
104157
|
-
return result;
|
|
104158
|
-
};
|
|
104159
|
-
})();
|
|
104160
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
104161
|
-
exports.create = create;
|
|
104162
|
-
var language_core_1 = require_language_core();
|
|
104163
|
-
var html = __importStar((init_htmlLanguageService(), __toCommonJS(htmlLanguageService_exports)));
|
|
104164
|
-
var nameCasing_1 = require_nameCasing();
|
|
104165
|
-
var utils_1 = require_utils$1();
|
|
104166
|
-
function create({ getComponentNames, getElementNames, getComponentMeta }) {
|
|
104167
|
-
return {
|
|
104168
|
-
name: "vue-missing-props-hints",
|
|
104169
|
-
capabilities: { inlayHintProvider: {} },
|
|
104170
|
-
create(context) {
|
|
104171
|
-
let intrinsicElementNames;
|
|
104172
|
-
return { async provideInlayHints(document, range, cancellationToken) {
|
|
104173
|
-
const info = (0, utils_1.resolveEmbeddedCode)(context, document.uri);
|
|
104174
|
-
if (info?.code.id !== "template") return;
|
|
104175
|
-
if (!(await context.env.getConfiguration?.("vue.inlayHints.missingProps") ?? false)) return;
|
|
104176
|
-
const scanner = getScanner(context, document);
|
|
104177
|
-
if (!scanner) return;
|
|
104178
|
-
const result = [];
|
|
104179
|
-
const attrNameCasing = await (0, nameCasing_1.getAttrNameCasing)(context, info.script.id);
|
|
104180
|
-
const components = await getComponentNames(info.root.fileName) ?? [];
|
|
104181
|
-
const componentProps = /* @__PURE__ */ new Map();
|
|
104182
|
-
intrinsicElementNames ??= new Set(await getElementNames(info.root.fileName) ?? []);
|
|
104183
|
-
let token;
|
|
104184
|
-
let current;
|
|
104185
|
-
while ((token = scanner.scan()) !== html.TokenType.EOS) if (token === html.TokenType.StartTag) {
|
|
104186
|
-
const tagName = scanner.getTokenText();
|
|
104187
|
-
const tagOffset = scanner.getTokenOffset();
|
|
104188
|
-
const checkTag = tagName.includes(".") ? tagName : components.find((component) => component === tagName || (0, language_core_1.hyphenateTag)(component) === tagName);
|
|
104189
|
-
if (intrinsicElementNames.has(tagName) || !checkTag) continue;
|
|
104190
|
-
if (tagOffset < document.offsetAt(range.start)) continue;
|
|
104191
|
-
if (tagOffset > document.offsetAt(range.end)) break;
|
|
104192
|
-
if (!componentProps.has(checkTag)) {
|
|
104193
|
-
if (cancellationToken.isCancellationRequested) break;
|
|
104194
|
-
componentProps.set(checkTag, ((await getComponentMeta(info.root.fileName, checkTag))?.props ?? []).filter((prop) => prop.required));
|
|
104195
|
-
}
|
|
104196
|
-
current = {
|
|
104197
|
-
unburnedRequiredProps: [...componentProps.get(checkTag)],
|
|
104198
|
-
labelOffset: scanner.getTokenOffset() + scanner.getTokenLength()
|
|
104199
|
-
};
|
|
104200
|
-
} else if (token === html.TokenType.AttributeName) {
|
|
104201
|
-
if (current) {
|
|
104202
|
-
let attrText = scanner.getTokenText();
|
|
104203
|
-
if (attrText === "v-bind") current.unburnedRequiredProps = [];
|
|
104204
|
-
else {
|
|
104205
|
-
if (attrText.includes(".")) attrText = attrText.split(".")[0];
|
|
104206
|
-
if (attrText.startsWith("v-bind:")) attrText = attrText.slice(7);
|
|
104207
|
-
else if (attrText.startsWith(":")) attrText = attrText.slice(1);
|
|
104208
|
-
else if (attrText.startsWith("v-model:")) attrText = attrText.slice(8);
|
|
104209
|
-
else if (attrText === "v-model") attrText = "modelValue";
|
|
104210
|
-
else if (attrText.startsWith("v-on:")) attrText = "on-" + (0, language_core_1.hyphenateAttr)(attrText.slice(5));
|
|
104211
|
-
else if (attrText.startsWith("@")) attrText = "on-" + (0, language_core_1.hyphenateAttr)(attrText.slice(1));
|
|
104212
|
-
current.unburnedRequiredProps = current.unburnedRequiredProps.filter((prop) => {
|
|
104213
|
-
return attrText !== prop.name && attrText !== (0, language_core_1.hyphenateAttr)(prop.name);
|
|
104214
|
-
});
|
|
104215
|
-
}
|
|
104216
|
-
}
|
|
104217
|
-
} else if (token === html.TokenType.StartTagSelfClose || token === html.TokenType.StartTagClose) {
|
|
104218
|
-
if (current) {
|
|
104219
|
-
for (const requiredProp of current.unburnedRequiredProps) result.push({
|
|
104220
|
-
label: requiredProp.name,
|
|
104221
|
-
paddingLeft: true,
|
|
104222
|
-
position: document.positionAt(current.labelOffset),
|
|
104223
|
-
kind: 2,
|
|
104224
|
-
textEdits: [{
|
|
104225
|
-
range: {
|
|
104226
|
-
start: document.positionAt(current.labelOffset),
|
|
104227
|
-
end: document.positionAt(current.labelOffset)
|
|
104228
|
-
},
|
|
104229
|
-
newText: ` :${attrNameCasing === 0 ? (0, language_core_1.hyphenateAttr)(requiredProp.name) : requiredProp.name}=`
|
|
104230
|
-
}]
|
|
104231
|
-
});
|
|
104232
|
-
current = void 0;
|
|
104233
|
-
}
|
|
104234
|
-
}
|
|
104235
|
-
return result;
|
|
104236
|
-
} };
|
|
104237
|
-
}
|
|
104238
|
-
};
|
|
104239
|
-
function getScanner(context, document) {
|
|
104240
|
-
if (document.languageId === "html") return context.inject("html/languageService").createScanner(document.getText());
|
|
104241
|
-
else {
|
|
104242
|
-
const pugDocument = context.inject("pug/pugDocument", document);
|
|
104243
|
-
if (pugDocument) return context.inject("pug/languageService").createScanner(pugDocument);
|
|
104244
|
-
}
|
|
104245
|
-
}
|
|
104246
|
-
}
|
|
104247
|
-
}));
|
|
104248
|
-
//#endregion
|
|
104249
|
-
//#region node_modules/@vue/language-service/lib/plugins/vue-scoped-class-links.js
|
|
104250
|
-
var require_vue_scoped_class_links = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
104251
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
104252
|
-
exports.create = create;
|
|
104253
|
-
var styleScopedClasses_1 = require_styleScopedClasses();
|
|
104254
|
-
var utils_1 = require_utils$1();
|
|
104255
|
-
function create() {
|
|
104256
|
-
return {
|
|
104257
|
-
name: "vue-scoped-class-links",
|
|
104258
|
-
capabilities: { documentLinkProvider: {} },
|
|
104259
|
-
create(context) {
|
|
104260
|
-
return { provideDocumentLinks(document) {
|
|
104261
|
-
const info = (0, utils_1.resolveEmbeddedCode)(context, document.uri);
|
|
104262
|
-
if (info?.code.id !== "template") return;
|
|
104263
|
-
const { sfc } = info.root;
|
|
104264
|
-
if (!sfc.template) return;
|
|
104265
|
-
const { resolveStyleClassNames } = info.root.vueCompilerOptions;
|
|
104266
|
-
if (!resolveStyleClassNames) return;
|
|
104267
|
-
const scopedClasses = styleScopedClasses_1.references.get(sfc.template)?.[1] ?? [];
|
|
104268
|
-
const styleClasses = /* @__PURE__ */ new Map();
|
|
104269
|
-
for (const style of sfc.styles) {
|
|
104270
|
-
if (!(resolveStyleClassNames === true || style.scoped)) continue;
|
|
104271
|
-
const styleDocumentUri = context.encodeEmbeddedDocumentUri(info.script.id, style.name);
|
|
104272
|
-
const styleVirtualCode = info.script.generated.embeddedCodes.get(style.name);
|
|
104273
|
-
if (!styleVirtualCode) continue;
|
|
104274
|
-
const styleDocument = context.documents.get(styleDocumentUri, styleVirtualCode.languageId, styleVirtualCode.snapshot);
|
|
104275
|
-
for (const { text, offset } of style.classNames) {
|
|
104276
|
-
const start = styleDocument.positionAt(offset);
|
|
104277
|
-
const end = styleDocument.positionAt(offset + text.length);
|
|
104278
|
-
const target = styleDocumentUri + `#L${start.line + 1},${start.character + 1}-L${end.line + 1},${end.character + 1}`;
|
|
104279
|
-
if (!styleClasses.has(text)) styleClasses.set(text, []);
|
|
104280
|
-
styleClasses.get(text).push(target);
|
|
104281
|
-
}
|
|
104282
|
-
}
|
|
104283
|
-
return scopedClasses.flatMap(([className, offset]) => {
|
|
104284
|
-
const range = {
|
|
104285
|
-
start: document.positionAt(offset),
|
|
104286
|
-
end: document.positionAt(offset + className.length)
|
|
104287
|
-
};
|
|
104288
|
-
return styleClasses.get("." + className)?.map((target) => ({
|
|
104289
|
-
range,
|
|
104290
|
-
target
|
|
104291
|
-
})) ?? [];
|
|
104292
|
-
});
|
|
104293
|
-
} };
|
|
104294
|
-
}
|
|
104295
|
-
};
|
|
104296
|
-
}
|
|
104297
|
-
}));
|
|
104298
|
-
//#endregion
|
|
104299
104146
|
//#region node_modules/volar-service-html/index.js
|
|
104300
104147
|
var require_volar_service_html = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
104301
104148
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -109467,7 +109314,7 @@ var require_vue_sfc = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
109467
109314
|
"script",
|
|
109468
109315
|
"style"
|
|
109469
109316
|
];
|
|
109470
|
-
for (const customBlock of info.root.
|
|
109317
|
+
for (const customBlock of info.root.ir.customBlocks) blockTypes.push(customBlock.type);
|
|
109471
109318
|
return {
|
|
109472
109319
|
...options,
|
|
109473
109320
|
...formatSettings,
|
|
@@ -109508,11 +109355,11 @@ var require_vue_sfc = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
109508
109355
|
async provideDiagnostics(document, token) {
|
|
109509
109356
|
const info = (0, utils_1.resolveEmbeddedCode)(context, document.uri);
|
|
109510
109357
|
if (info?.code.id !== "root_tags") return [];
|
|
109511
|
-
const { vueSfc,
|
|
109358
|
+
const { vueSfc, ir } = info.root;
|
|
109512
109359
|
if (!vueSfc) return;
|
|
109513
109360
|
const originalResult = await htmlServiceInstance.provideDiagnostics?.(document, token);
|
|
109514
109361
|
const sfcErrors = [];
|
|
109515
|
-
const { template } =
|
|
109362
|
+
const { template } = ir;
|
|
109516
109363
|
const { startTagEnd = Infinity, endTagStart = -Infinity } = template ?? {};
|
|
109517
109364
|
for (const error of vueSfc.errors) if ("code" in error) {
|
|
109518
109365
|
const start = error.loc?.start.offset ?? 0;
|
|
@@ -109534,44 +109381,44 @@ var require_vue_sfc = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
109534
109381
|
const info = (0, utils_1.resolveEmbeddedCode)(context, document.uri);
|
|
109535
109382
|
if (info?.code.id !== "root_tags") return;
|
|
109536
109383
|
const result = [];
|
|
109537
|
-
const {
|
|
109538
|
-
if (
|
|
109384
|
+
const { ir } = info.root;
|
|
109385
|
+
if (ir.template) result.push({
|
|
109539
109386
|
name: "template",
|
|
109540
109387
|
kind: 2,
|
|
109541
109388
|
range: {
|
|
109542
|
-
start: document.positionAt(
|
|
109543
|
-
end: document.positionAt(
|
|
109389
|
+
start: document.positionAt(ir.template.start),
|
|
109390
|
+
end: document.positionAt(ir.template.end)
|
|
109544
109391
|
},
|
|
109545
109392
|
selectionRange: {
|
|
109546
|
-
start: document.positionAt(
|
|
109547
|
-
end: document.positionAt(
|
|
109393
|
+
start: document.positionAt(ir.template.start),
|
|
109394
|
+
end: document.positionAt(ir.template.startTagEnd)
|
|
109548
109395
|
}
|
|
109549
109396
|
});
|
|
109550
|
-
if (
|
|
109397
|
+
if (ir.script) result.push({
|
|
109551
109398
|
name: "script",
|
|
109552
109399
|
kind: 2,
|
|
109553
109400
|
range: {
|
|
109554
|
-
start: document.positionAt(
|
|
109555
|
-
end: document.positionAt(
|
|
109401
|
+
start: document.positionAt(ir.script.start),
|
|
109402
|
+
end: document.positionAt(ir.script.end)
|
|
109556
109403
|
},
|
|
109557
109404
|
selectionRange: {
|
|
109558
|
-
start: document.positionAt(
|
|
109559
|
-
end: document.positionAt(
|
|
109405
|
+
start: document.positionAt(ir.script.start),
|
|
109406
|
+
end: document.positionAt(ir.script.startTagEnd)
|
|
109560
109407
|
}
|
|
109561
109408
|
});
|
|
109562
|
-
if (
|
|
109409
|
+
if (ir.scriptSetup) result.push({
|
|
109563
109410
|
name: "script setup",
|
|
109564
109411
|
kind: 2,
|
|
109565
109412
|
range: {
|
|
109566
|
-
start: document.positionAt(
|
|
109567
|
-
end: document.positionAt(
|
|
109413
|
+
start: document.positionAt(ir.scriptSetup.start),
|
|
109414
|
+
end: document.positionAt(ir.scriptSetup.end)
|
|
109568
109415
|
},
|
|
109569
109416
|
selectionRange: {
|
|
109570
|
-
start: document.positionAt(
|
|
109571
|
-
end: document.positionAt(
|
|
109417
|
+
start: document.positionAt(ir.scriptSetup.start),
|
|
109418
|
+
end: document.positionAt(ir.scriptSetup.startTagEnd)
|
|
109572
109419
|
}
|
|
109573
109420
|
});
|
|
109574
|
-
for (const style of
|
|
109421
|
+
for (const style of ir.styles) {
|
|
109575
109422
|
let name = "style";
|
|
109576
109423
|
if (style.scoped) name += " scoped";
|
|
109577
109424
|
if (style.module) name += " module";
|
|
@@ -109588,7 +109435,7 @@ var require_vue_sfc = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
109588
109435
|
}
|
|
109589
109436
|
});
|
|
109590
109437
|
}
|
|
109591
|
-
for (const customBlock of
|
|
109438
|
+
for (const customBlock of ir.customBlocks) result.push({
|
|
109592
109439
|
name: customBlock.type,
|
|
109593
109440
|
kind: 2,
|
|
109594
109441
|
range: {
|
|
@@ -109677,9 +109524,7 @@ var require_vue_suggest_define_assignment = /* @__PURE__ */ __commonJSMin(((expo
|
|
|
109677
109524
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
109678
109525
|
exports.create = create;
|
|
109679
109526
|
var language_core_1 = require_language_core();
|
|
109680
|
-
var vscode_uri_1 = require_umd();
|
|
109681
109527
|
var utils_1 = require_utils$1();
|
|
109682
|
-
var documentToSourceFile = /* @__PURE__ */ new WeakMap();
|
|
109683
109528
|
function create(ts) {
|
|
109684
109529
|
return {
|
|
109685
109530
|
name: "vue-suggest-define-assignment",
|
|
@@ -109691,14 +109536,21 @@ var require_vue_suggest_define_assignment = /* @__PURE__ */ __commonJSMin(((expo
|
|
|
109691
109536
|
const info = (0, utils_1.resolveEmbeddedCode)(context, document.uri);
|
|
109692
109537
|
if (!info?.code.id.startsWith("script_")) return;
|
|
109693
109538
|
if (!(await context.env.getConfiguration?.("vue.suggest.defineAssignment") ?? true)) return;
|
|
109694
|
-
const {
|
|
109695
|
-
const codegen = language_core_1.tsCodegen.get(
|
|
109696
|
-
const scriptSetup =
|
|
109539
|
+
const { ir } = info.root;
|
|
109540
|
+
const codegen = language_core_1.tsCodegen.get(ir);
|
|
109541
|
+
const scriptSetup = ir.scriptSetup;
|
|
109697
109542
|
const scriptSetupRanges = codegen?.getScriptSetupRanges();
|
|
109698
109543
|
if (!scriptSetup || !scriptSetupRanges) return;
|
|
109699
|
-
|
|
109544
|
+
const map = context.language.maps.get(info.code, info.script);
|
|
109545
|
+
let sourceOffset;
|
|
109546
|
+
for (const [offset] of map.toSourceLocation(document.offsetAt(position))) {
|
|
109547
|
+
sourceOffset = offset;
|
|
109548
|
+
break;
|
|
109549
|
+
}
|
|
109550
|
+
if (sourceOffset === void 0) return;
|
|
109551
|
+
const node = ts.getTouchingPropertyName(scriptSetup.ast, sourceOffset - scriptSetup.startTagEnd);
|
|
109552
|
+
if (ts.isStringLiteralLike(node)) return;
|
|
109700
109553
|
const result = [];
|
|
109701
|
-
const mappings = [...context.language.maps.forEach(info.code)];
|
|
109702
109554
|
addDefineCompletionItem(scriptSetupRanges.defineProps?.statement, scriptSetupRanges.withDefaults?.exp ?? scriptSetupRanges.defineProps?.exp, "props");
|
|
109703
109555
|
addDefineCompletionItem(scriptSetupRanges.defineEmits?.statement, scriptSetupRanges.defineEmits?.exp, "emit");
|
|
109704
109556
|
addDefineCompletionItem(scriptSetupRanges.defineSlots?.statement, scriptSetupRanges.defineSlots?.exp, "slots");
|
|
@@ -109708,13 +109560,13 @@ var require_vue_suggest_define_assignment = /* @__PURE__ */ __commonJSMin(((expo
|
|
|
109708
109560
|
};
|
|
109709
109561
|
function addDefineCompletionItem(statement, exp, name) {
|
|
109710
109562
|
if (!exp || exp.start !== statement?.start) return;
|
|
109711
|
-
let
|
|
109712
|
-
for (const [
|
|
109713
|
-
|
|
109563
|
+
let generatedOffset;
|
|
109564
|
+
for (const [offset] of map.toGeneratedLocation(scriptSetup.startTagEnd + exp.start)) {
|
|
109565
|
+
generatedOffset = offset;
|
|
109714
109566
|
break;
|
|
109715
109567
|
}
|
|
109716
|
-
if (
|
|
109717
|
-
const pos = document.positionAt(
|
|
109568
|
+
if (generatedOffset === void 0) return;
|
|
109569
|
+
const pos = document.positionAt(generatedOffset);
|
|
109718
109570
|
result.push({
|
|
109719
109571
|
label: name,
|
|
109720
109572
|
kind: 6,
|
|
@@ -109737,28 +109589,6 @@ var require_vue_suggest_define_assignment = /* @__PURE__ */ __commonJSMin(((expo
|
|
|
109737
109589
|
}
|
|
109738
109590
|
};
|
|
109739
109591
|
}
|
|
109740
|
-
function shouldSkip(ts, node, pos) {
|
|
109741
|
-
if (ts.isStringLiteral(node) && pos >= node.getFullStart() && pos <= node.getEnd()) return true;
|
|
109742
|
-
else if (ts.isTemplateLiteral(node) && pos >= node.getFullStart() && pos <= node.getEnd()) return true;
|
|
109743
|
-
else {
|
|
109744
|
-
let _shouldSkip = false;
|
|
109745
|
-
node.forEachChild((node) => {
|
|
109746
|
-
if (_shouldSkip) return;
|
|
109747
|
-
if (pos >= node.getFullStart() && pos <= node.getEnd()) {
|
|
109748
|
-
if (shouldSkip(ts, node, pos)) _shouldSkip = true;
|
|
109749
|
-
}
|
|
109750
|
-
});
|
|
109751
|
-
return _shouldSkip;
|
|
109752
|
-
}
|
|
109753
|
-
}
|
|
109754
|
-
function getSourceFile(ts, document) {
|
|
109755
|
-
let sourceFile = documentToSourceFile.get(document);
|
|
109756
|
-
if (!sourceFile) {
|
|
109757
|
-
sourceFile = ts.createSourceFile(vscode_uri_1.URI.parse(document.uri).path, document.getText(), ts.ScriptTarget.Latest);
|
|
109758
|
-
documentToSourceFile.set(document, sourceFile);
|
|
109759
|
-
}
|
|
109760
|
-
return sourceFile;
|
|
109761
|
-
}
|
|
109762
109592
|
}));
|
|
109763
109593
|
//#endregion
|
|
109764
109594
|
//#region node_modules/volar-service-pug/empty.js
|
|
@@ -112783,7 +112613,7 @@ var require_vue_template = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
112783
112613
|
var shared_1 = (init_shared_esm_bundler(), __toCommonJS(shared_esm_bundler_exports));
|
|
112784
112614
|
var volar_service_html_1 = require_volar_service_html();
|
|
112785
112615
|
var volar_service_pug_1 = require_empty();
|
|
112786
|
-
var
|
|
112616
|
+
var lspConverters_1 = require_lspConverters();
|
|
112787
112617
|
var html = __importStar((init_htmlLanguageService(), __toCommonJS(htmlLanguageService_exports)));
|
|
112788
112618
|
var vscode_uri_1 = require_umd();
|
|
112789
112619
|
var data_1 = require_data();
|
|
@@ -112801,52 +112631,47 @@ var require_vue_template = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
112801
112631
|
var V_BIND_SHORTHAND = ":";
|
|
112802
112632
|
var DIRECTIVE_V_FOR_NAME = "v-for";
|
|
112803
112633
|
var V_FOR_SNIPPET = "=\"${1:value} in ${2:source}\"";
|
|
112634
|
+
var customData;
|
|
112804
112635
|
var builtInData;
|
|
112805
112636
|
var modelData;
|
|
112806
112637
|
function create(ts, languageId, tsserver) {
|
|
112807
|
-
|
|
112638
|
+
const defaultDataProvider = html.getDefaultHTMLDataProvider();
|
|
112639
|
+
let htmlData = [defaultDataProvider];
|
|
112808
112640
|
let modulePathCache;
|
|
112809
112641
|
const onDidChangeCustomDataListeners = /* @__PURE__ */ new Set();
|
|
112810
|
-
const
|
|
112811
|
-
onDidChangeCustomDataListeners.add(listener);
|
|
112812
|
-
return { dispose() {
|
|
112813
|
-
onDidChangeCustomDataListeners.delete(listener);
|
|
112814
|
-
} };
|
|
112815
|
-
};
|
|
112816
|
-
const getDocumentContext = (context) => ({ resolveReference(ref, base) {
|
|
112817
|
-
let baseUri = vscode_uri_1.URI.parse(base);
|
|
112818
|
-
const decoded = context.decodeEmbeddedDocumentUri(baseUri);
|
|
112819
|
-
if (decoded) baseUri = decoded[0];
|
|
112820
|
-
if (modulePathCache && baseUri.scheme === "file" && !ref.startsWith("./") && !ref.startsWith("../")) {
|
|
112821
|
-
const map = modulePathCache;
|
|
112822
|
-
if (!map.has(ref)) {
|
|
112823
|
-
const fileName = baseUri.fsPath.replace(/\\/g, "/");
|
|
112824
|
-
const promise = tsserver.resolveModuleName(fileName, ref);
|
|
112825
|
-
map.set(ref, promise);
|
|
112826
|
-
if (promise instanceof Promise) promise.then((res) => map.set(ref, res));
|
|
112827
|
-
}
|
|
112828
|
-
const cached = modulePathCache.get(ref);
|
|
112829
|
-
if (cached instanceof Promise) throw cached;
|
|
112830
|
-
if (cached) return vscode_uri_1.URI.file(cached).toString();
|
|
112831
|
-
}
|
|
112832
|
-
return (0, volar_service_html_1.resolveReference)(ref, baseUri, context.env.workspaceFolders);
|
|
112833
|
-
} });
|
|
112834
|
-
const defaultHTMLProvider = html.getDefaultHTMLDataProvider();
|
|
112835
|
-
const baseService = languageId === "jade" ? (0, volar_service_pug_1.create)({
|
|
112836
|
-
useDefaultDataProvider: false,
|
|
112837
|
-
getDocumentContext,
|
|
112838
|
-
getCustomData() {
|
|
112839
|
-
return htmlData;
|
|
112840
|
-
},
|
|
112841
|
-
onDidChangeCustomData
|
|
112842
|
-
}) : (0, volar_service_html_1.create)({
|
|
112843
|
-
documentSelector: ["html", "markdown"],
|
|
112642
|
+
const serviceOptions = {
|
|
112844
112643
|
useDefaultDataProvider: false,
|
|
112845
|
-
getDocumentContext,
|
|
112644
|
+
getDocumentContext: (context) => ({ resolveReference(ref, base) {
|
|
112645
|
+
let baseUri = vscode_uri_1.URI.parse(base);
|
|
112646
|
+
const decoded = context.decodeEmbeddedDocumentUri(baseUri);
|
|
112647
|
+
if (decoded) baseUri = decoded[0];
|
|
112648
|
+
if (modulePathCache && baseUri.scheme === "file" && !ref.startsWith("./") && !ref.startsWith("../")) {
|
|
112649
|
+
const map = modulePathCache;
|
|
112650
|
+
if (!map.has(ref)) {
|
|
112651
|
+
const fileName = baseUri.fsPath.replace(/\\/g, "/");
|
|
112652
|
+
const promise = tsserver.resolveModuleName(fileName, ref);
|
|
112653
|
+
map.set(ref, promise);
|
|
112654
|
+
if (promise instanceof Promise) promise.then((res) => map.set(ref, res));
|
|
112655
|
+
}
|
|
112656
|
+
const cached = modulePathCache.get(ref);
|
|
112657
|
+
if (cached instanceof Promise) throw cached;
|
|
112658
|
+
if (cached) return vscode_uri_1.URI.file(cached).toString();
|
|
112659
|
+
}
|
|
112660
|
+
return (0, volar_service_html_1.resolveReference)(ref, baseUri, context.env.workspaceFolders);
|
|
112661
|
+
} }),
|
|
112846
112662
|
getCustomData() {
|
|
112847
|
-
return htmlData;
|
|
112663
|
+
return customData?.length ? htmlData.concat(customData) : htmlData;
|
|
112848
112664
|
},
|
|
112849
|
-
onDidChangeCustomData
|
|
112665
|
+
onDidChangeCustomData(listener) {
|
|
112666
|
+
onDidChangeCustomDataListeners.add(listener);
|
|
112667
|
+
return { dispose() {
|
|
112668
|
+
onDidChangeCustomDataListeners.delete(listener);
|
|
112669
|
+
} };
|
|
112670
|
+
}
|
|
112671
|
+
};
|
|
112672
|
+
const baseService = languageId === "jade" ? (0, volar_service_pug_1.create)(serviceOptions) : (0, volar_service_html_1.create)({
|
|
112673
|
+
...serviceOptions,
|
|
112674
|
+
documentSelector: ["html", "markdown"]
|
|
112850
112675
|
});
|
|
112851
112676
|
return {
|
|
112852
112677
|
name: `vue-template (${languageId})`,
|
|
@@ -112863,7 +112688,7 @@ var require_vue_template = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
112863
112688
|
htmlService.parseHTMLDocument = (document) => {
|
|
112864
112689
|
const info = (0, utils_1.resolveEmbeddedCode)(context, document.uri);
|
|
112865
112690
|
if (info?.code.id === "template") {
|
|
112866
|
-
const templateAst = info.root.
|
|
112691
|
+
const templateAst = info.root.ir.template?.ast;
|
|
112867
112692
|
if (templateAst) {
|
|
112868
112693
|
let text = document.getText();
|
|
112869
112694
|
for (const node of (0, language_core_1.forEachInterpolationNode)(templateAst)) text = text.substring(0, node.loc.start.offset) + " ".repeat(node.loc.end.offset - node.loc.start.offset) + text.substring(node.loc.end.offset);
|
|
@@ -112878,10 +112703,10 @@ var require_vue_template = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
112878
112703
|
htmlService.format = (document, range, options) => {
|
|
112879
112704
|
let voidElements;
|
|
112880
112705
|
const info = (0, utils_1.resolveEmbeddedCode)(context, document.uri);
|
|
112881
|
-
const codegen = info && language_core_1.tsCodegen.get(info.root.
|
|
112706
|
+
const codegen = info && language_core_1.tsCodegen.get(info.root.ir);
|
|
112882
112707
|
if (codegen) {
|
|
112883
112708
|
const componentNames = new Set([...codegen.getImportedComponents(), ...codegen.getSetupExposed()]);
|
|
112884
|
-
voidElements =
|
|
112709
|
+
voidElements = defaultDataProvider.provideTags().filter((tag) => tag.void).map((tag) => tag.name).filter((tag) => !componentNames.has(tag) && !componentNames.has((0, shared_1.capitalize)(tag)));
|
|
112885
112710
|
}
|
|
112886
112711
|
return (0, htmlFormatter_1.format)(document, range, options, voidElements);
|
|
112887
112712
|
};
|
|
@@ -112892,8 +112717,8 @@ var require_vue_template = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
112892
112717
|
const vBindModifiers = extractDirectiveModifiers(builtInData.globalAttributes?.find((x) => x.name === "v-bind"));
|
|
112893
112718
|
const vModelModifiers = extractModelModifiers(modelData.globalAttributes);
|
|
112894
112719
|
const transformedItems = /* @__PURE__ */ new WeakSet();
|
|
112895
|
-
const
|
|
112896
|
-
for (const tag of
|
|
112720
|
+
const defaultTags = /* @__PURE__ */ new Map();
|
|
112721
|
+
for (const tag of defaultDataProvider.provideTags()) defaultTags.set(tag.name, tag);
|
|
112897
112722
|
let lastCompletionDocument;
|
|
112898
112723
|
return {
|
|
112899
112724
|
...baseServiceInstance,
|
|
@@ -112911,7 +112736,7 @@ var require_vue_template = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
112911
112736
|
},
|
|
112912
112737
|
end: position
|
|
112913
112738
|
}).match(/(\S)[\S]*$/)?.[1];
|
|
112914
|
-
const { result: htmlCompletion, info: { tagNameCasing, components } } = await runWithVueDataProvider(info.script.id, info.root, hint, "completion", () => baseServiceInstance.provideCompletionItems(document, position, completionContext, token));
|
|
112739
|
+
const { result: htmlCompletion, info: { tagNameCasing, components } } = await runWithVueDataProvider(info.script.id, info.root, document.offsetAt(position), hint, "completion", () => baseServiceInstance.provideCompletionItems(document, position, completionContext, token));
|
|
112915
112740
|
const componentSet = new Set(components);
|
|
112916
112741
|
if (!htmlCompletion) return;
|
|
112917
112742
|
if (!hint) htmlCompletion.isIncomplete = true;
|
|
@@ -112928,7 +112753,7 @@ var require_vue_template = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
112928
112753
|
for (const [sourceOffset] of map.toSourceLocation(offset)) {
|
|
112929
112754
|
const autoImport = await tsserver.getAutoImportSuggestions(info.root.fileName, sourceOffset);
|
|
112930
112755
|
if (!autoImport) continue;
|
|
112931
|
-
const tsCompletion = (0,
|
|
112756
|
+
const tsCompletion = (0, lspConverters_1.convertCompletionInfo)(ts, autoImport, document, position, (entry) => entry.data);
|
|
112932
112757
|
const placeholder = htmlCompletion.items[autoImportPlaceholderIndex];
|
|
112933
112758
|
for (const tsItem of tsCompletion.items) if (placeholder.textEdit) {
|
|
112934
112759
|
const newText = tsItem.textEdit?.newText ?? tsItem.label;
|
|
@@ -112978,7 +112803,7 @@ var require_vue_template = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
112978
112803
|
embeddedDocument,
|
|
112979
112804
|
map
|
|
112980
112805
|
], embeddedRange), embeddedDocument, context);
|
|
112981
|
-
(0,
|
|
112806
|
+
(0, lspConverters_1.applyCompletionEntryDetails)(ts, item, details, sourceDocument, (fileName) => vscode_uri_1.URI.file(fileName), () => void 0);
|
|
112982
112807
|
transformedItems.add(item);
|
|
112983
112808
|
}
|
|
112984
112809
|
}
|
|
@@ -112991,8 +112816,8 @@ var require_vue_template = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
112991
112816
|
if (document.languageId !== languageId) return;
|
|
112992
112817
|
const info = (0, utils_1.resolveEmbeddedCode)(context, document.uri);
|
|
112993
112818
|
if (info?.code.id !== "template") return;
|
|
112994
|
-
let { result: htmlHover } = await runWithVueDataProvider(info.script.id, info.root, void 0, "hover", () => baseServiceInstance.provideHover(document, position, token));
|
|
112995
|
-
const templateAst = info.root.
|
|
112819
|
+
let { result: htmlHover } = await runWithVueDataProvider(info.script.id, info.root, document.offsetAt(position), void 0, "hover", () => baseServiceInstance.provideHover(document, position, token));
|
|
112820
|
+
const templateAst = info.root.ir.template?.ast;
|
|
112996
112821
|
const enabledRichMessage = await context.env.getConfiguration?.("vue.hover.rich");
|
|
112997
112822
|
if (!templateAst || !enabledRichMessage || htmlHover && hasContents(htmlHover.contents)) return htmlHover;
|
|
112998
112823
|
for (const element of (0, language_core_1.forEachElementNode)(templateAst)) {
|
|
@@ -113090,166 +112915,163 @@ var require_vue_template = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
113090
112915
|
if (e instanceof Promise) await e;
|
|
113091
112916
|
else throw e;
|
|
113092
112917
|
}
|
|
113093
|
-
},
|
|
113094
|
-
provideDocumentSymbols(document, token) {
|
|
113095
|
-
if (document.languageId !== languageId) return;
|
|
113096
|
-
if ((0, utils_1.resolveEmbeddedCode)(context, document.uri)?.code.id !== "template") return;
|
|
113097
|
-
updateExtraCustomData([defaultHTMLProvider]);
|
|
113098
|
-
return baseServiceInstance.provideDocumentSymbols?.(document, token);
|
|
113099
112918
|
}
|
|
113100
112919
|
};
|
|
113101
|
-
async function runWithVueDataProvider(sourceDocumentUri, root, hint, mode, fn) {
|
|
112920
|
+
async function runWithVueDataProvider(sourceDocumentUri, root, position, hint, mode, fn) {
|
|
113102
112921
|
await fn();
|
|
113103
|
-
const { sync } = await provideHtmlData(sourceDocumentUri, root, hint, mode);
|
|
112922
|
+
const { sync } = await provideHtmlData(sourceDocumentUri, root, position, hint, mode);
|
|
113104
112923
|
let lastSync = await sync();
|
|
113105
112924
|
let result = await fn();
|
|
113106
112925
|
while (lastSync.version !== (lastSync = await sync()).version) result = await fn();
|
|
112926
|
+
updateHtmlData([defaultDataProvider]);
|
|
113107
112927
|
return {
|
|
113108
112928
|
result,
|
|
113109
112929
|
...lastSync
|
|
113110
112930
|
};
|
|
113111
112931
|
}
|
|
113112
|
-
async function provideHtmlData(sourceDocumentUri, root, hint, mode) {
|
|
112932
|
+
async function provideHtmlData(sourceDocumentUri, root, position, hint, mode) {
|
|
113113
112933
|
const [tagNameCasing, attrNameCasing] = await Promise.all([(0, nameCasing_1.getTagNameCasing)(context, sourceDocumentUri), (0, nameCasing_1.getAttrNameCasing)(context, sourceDocumentUri)]);
|
|
112934
|
+
customData ??= await getCustomData();
|
|
112935
|
+
const tasks = [];
|
|
113114
112936
|
let version = 0;
|
|
113115
112937
|
let components;
|
|
113116
|
-
|
|
113117
|
-
let directives;
|
|
113118
|
-
let values;
|
|
113119
|
-
const tasks = [];
|
|
113120
|
-
const tagDataMap = /* @__PURE__ */ new Map();
|
|
113121
|
-
updateExtraCustomData([{
|
|
112938
|
+
updateHtmlData([{
|
|
113122
112939
|
getId: () => "vue-template",
|
|
113123
112940
|
isApplicable: () => true,
|
|
113124
|
-
provideTags: (
|
|
113125
|
-
|
|
113126
|
-
|
|
113127
|
-
|
|
113128
|
-
|
|
113129
|
-
|
|
113130
|
-
|
|
113131
|
-
|
|
113132
|
-
}
|
|
113133
|
-
|
|
113134
|
-
|
|
113135
|
-
|
|
113136
|
-
|
|
113137
|
-
|
|
113138
|
-
const
|
|
113139
|
-
|
|
113140
|
-
|
|
112941
|
+
provideTags: createProvider({
|
|
112942
|
+
async fetch() {
|
|
112943
|
+
const res = await Promise.all([tsserver.getComponentNames(root.fileName), tsserver.getElementNames(root.fileName)]);
|
|
112944
|
+
components = res[0] ?? [];
|
|
112945
|
+
return {
|
|
112946
|
+
components,
|
|
112947
|
+
elements: res[1] ?? []
|
|
112948
|
+
};
|
|
112949
|
+
},
|
|
112950
|
+
provide({ components, elements }) {
|
|
112951
|
+
const codegen = language_core_1.tsCodegen.get(root.ir);
|
|
112952
|
+
const names = /* @__PURE__ */ new Set();
|
|
112953
|
+
const tags = /* @__PURE__ */ new Map();
|
|
112954
|
+
for (const tag of components) names.add(tagNameCasing === 0 ? (0, language_core_1.hyphenateTag)(tag) : tag);
|
|
112955
|
+
for (const tag of elements) names.add(tag);
|
|
112956
|
+
if (codegen) for (const name of [...codegen.getImportedComponents(), ...codegen.getSetupExposed()]) names.add(tagNameCasing === 0 ? (0, language_core_1.hyphenateTag)(name) : name);
|
|
112957
|
+
for (const name of names) tags.set(name, {
|
|
112958
|
+
...defaultTags.get(name),
|
|
113141
112959
|
name,
|
|
113142
112960
|
attributes: []
|
|
113143
112961
|
});
|
|
113144
|
-
|
|
113145
|
-
|
|
113146
|
-
|
|
113147
|
-
|
|
113148
|
-
|
|
113149
|
-
|
|
113150
|
-
const attributes = [];
|
|
113151
|
-
let addPlainAttrs = false;
|
|
113152
|
-
let addVBinds = false;
|
|
113153
|
-
let addVBindShorthands = false;
|
|
113154
|
-
let addVOns = false;
|
|
113155
|
-
let addVOnShorthands = false;
|
|
113156
|
-
if (!hint) {
|
|
113157
|
-
addVBindShorthands = true;
|
|
113158
|
-
addVOnShorthands = true;
|
|
113159
|
-
} else if (hint === ":") addVBindShorthands = true;
|
|
113160
|
-
else if (hint === "@") addVOnShorthands = true;
|
|
113161
|
-
else {
|
|
113162
|
-
addPlainAttrs = true;
|
|
113163
|
-
addVBinds = true;
|
|
113164
|
-
addVOns = true;
|
|
113165
|
-
addVBindShorthands = true;
|
|
113166
|
-
addVOnShorthands = true;
|
|
113167
|
-
}
|
|
113168
|
-
for (const attr of builtInData?.globalAttributes ?? []) {
|
|
113169
|
-
if (attr.name === "is" && tag.toLowerCase() !== "component") continue;
|
|
113170
|
-
if (attr.name === "ref" || attr.name.startsWith("v-")) {
|
|
113171
|
-
attributes.push(attr);
|
|
113172
|
-
continue;
|
|
112962
|
+
for (const tag of builtInData?.tags ?? []) {
|
|
112963
|
+
const name = tagNameCasing === 0 ? (0, language_core_1.hyphenateTag)(tag.name) : tag.name;
|
|
112964
|
+
tags.set(name, {
|
|
112965
|
+
...tag,
|
|
112966
|
+
name
|
|
112967
|
+
});
|
|
113173
112968
|
}
|
|
113174
|
-
|
|
113175
|
-
...attr,
|
|
113176
|
-
name: attr.name
|
|
113177
|
-
});
|
|
113178
|
-
if (addVBindShorthands) attributes.push({
|
|
113179
|
-
...attr,
|
|
113180
|
-
name: V_BIND_SHORTHAND + attr.name
|
|
113181
|
-
});
|
|
113182
|
-
if (addVBinds) attributes.push({
|
|
113183
|
-
...attr,
|
|
113184
|
-
name: DIRECTIVE_V_BIND + attr.name
|
|
113185
|
-
});
|
|
113186
|
-
}
|
|
113187
|
-
for (const [propName, propMeta] of [...meta?.props.map((prop) => [prop.name, prop]) ?? [], ...attrs.map((attr) => [attr.name, void 0])]) if (propName.match(EVENT_PROP_REGEX)) {
|
|
113188
|
-
let labelName = propName.slice(2);
|
|
113189
|
-
labelName = labelName.charAt(0).toLowerCase() + labelName.slice(1);
|
|
113190
|
-
if (attrNameCasing === 0) labelName = (0, language_core_1.hyphenateAttr)(labelName);
|
|
113191
|
-
if (addVOnShorthands) attributes.push({
|
|
113192
|
-
name: V_ON_SHORTHAND + labelName,
|
|
113193
|
-
description: propMeta && createDescription(propMeta)
|
|
113194
|
-
});
|
|
113195
|
-
if (addVOns) attributes.push({
|
|
113196
|
-
name: DIRECTIVE_V_ON + labelName,
|
|
113197
|
-
description: propMeta && createDescription(propMeta)
|
|
113198
|
-
});
|
|
113199
|
-
} else {
|
|
113200
|
-
const labelName = attrNameCasing === 1 ? propName : (0, language_core_1.hyphenateAttr)(propName);
|
|
113201
|
-
const propMeta2 = meta?.props.find((prop) => {
|
|
113202
|
-
return (attrNameCasing === 1 ? prop.name : (0, language_core_1.hyphenateAttr)(prop.name)) === labelName;
|
|
113203
|
-
});
|
|
113204
|
-
const isBoolean = propMeta2?.type === "boolean" || propMeta2?.type.startsWith("boolean ");
|
|
113205
|
-
if (addPlainAttrs) attributes.push({
|
|
113206
|
-
name: labelName,
|
|
113207
|
-
description: propMeta2 && createDescription(propMeta2)
|
|
113208
|
-
});
|
|
113209
|
-
if (addVBindShorthands) attributes.push({
|
|
113210
|
-
name: V_BIND_SHORTHAND + labelName,
|
|
113211
|
-
description: propMeta2 && createDescription(propMeta2),
|
|
113212
|
-
valueSet: isBoolean ? "v" : void 0
|
|
113213
|
-
});
|
|
113214
|
-
if (addVBinds) attributes.push({
|
|
113215
|
-
name: DIRECTIVE_V_BIND + labelName,
|
|
113216
|
-
description: propMeta2 && createDescription(propMeta2),
|
|
113217
|
-
valueSet: isBoolean ? "v" : void 0
|
|
113218
|
-
});
|
|
113219
|
-
}
|
|
113220
|
-
for (const event of meta?.events ?? []) {
|
|
113221
|
-
const eventName = attrNameCasing === 1 ? event.name : (0, language_core_1.hyphenateAttr)(event.name);
|
|
113222
|
-
if (addVOnShorthands) attributes.push({
|
|
113223
|
-
name: V_ON_SHORTHAND + eventName,
|
|
113224
|
-
description: event && createDescription(event)
|
|
113225
|
-
});
|
|
113226
|
-
if (addVOns) attributes.push({
|
|
113227
|
-
name: DIRECTIVE_V_ON + eventName,
|
|
113228
|
-
description: event && createDescription(event)
|
|
113229
|
-
});
|
|
112969
|
+
return [...tags.values()];
|
|
113230
112970
|
}
|
|
113231
|
-
|
|
113232
|
-
|
|
113233
|
-
|
|
113234
|
-
const
|
|
113235
|
-
|
|
113236
|
-
|
|
113237
|
-
|
|
113238
|
-
|
|
112971
|
+
}),
|
|
112972
|
+
provideAttributes: createProvider({
|
|
112973
|
+
async fetch(tag) {
|
|
112974
|
+
const res = await Promise.all([
|
|
112975
|
+
tsserver.getElementAttrs(root.fileName, tag),
|
|
112976
|
+
tsserver.getComponentProps(root.fileName, position),
|
|
112977
|
+
tsserver.getComponentDirectives(root.fileName)
|
|
112978
|
+
]);
|
|
112979
|
+
return {
|
|
112980
|
+
attrs: res[0] ?? [],
|
|
112981
|
+
props: res[1] ?? [],
|
|
112982
|
+
directives: res[2] ?? []
|
|
112983
|
+
};
|
|
112984
|
+
},
|
|
112985
|
+
provide({ attrs, props, directives }, tag) {
|
|
112986
|
+
const attributes = [];
|
|
112987
|
+
let addPlainAttrs = false;
|
|
112988
|
+
let addVBinds = false;
|
|
112989
|
+
let addVBindShorthands = false;
|
|
112990
|
+
let addVOns = false;
|
|
112991
|
+
let addVOnShorthands = false;
|
|
112992
|
+
if (!hint) {
|
|
112993
|
+
addVBindShorthands = true;
|
|
112994
|
+
addVOnShorthands = true;
|
|
112995
|
+
} else if (hint === ":") addVBindShorthands = true;
|
|
112996
|
+
else if (hint === "@") addVOnShorthands = true;
|
|
112997
|
+
else {
|
|
112998
|
+
addPlainAttrs = true;
|
|
112999
|
+
addVBinds = true;
|
|
113000
|
+
addVOns = true;
|
|
113001
|
+
addVBindShorthands = true;
|
|
113002
|
+
addVOnShorthands = true;
|
|
113003
|
+
}
|
|
113004
|
+
for (const attr of builtInData?.globalAttributes ?? []) {
|
|
113005
|
+
if (attr.name === "is" && tag.toLowerCase() !== "component") continue;
|
|
113006
|
+
if (attr.name === "ref" || attr.name.startsWith("v-")) {
|
|
113007
|
+
attributes.push(attr);
|
|
113008
|
+
continue;
|
|
113009
|
+
}
|
|
113010
|
+
if (addPlainAttrs) attributes.push({
|
|
113011
|
+
...attr,
|
|
113012
|
+
name: attr.name
|
|
113013
|
+
});
|
|
113014
|
+
if (addVBindShorthands) attributes.push({
|
|
113015
|
+
...attr,
|
|
113016
|
+
name: V_BIND_SHORTHAND + attr.name
|
|
113017
|
+
});
|
|
113018
|
+
if (addVBinds) attributes.push({
|
|
113019
|
+
...attr,
|
|
113020
|
+
name: DIRECTIVE_V_BIND + attr.name
|
|
113021
|
+
});
|
|
113022
|
+
}
|
|
113023
|
+
for (const [propName, propInfo] of [...props.map((prop) => [prop.name, prop]), ...attrs.map((attr) => [attr.name, attr])]) {
|
|
113024
|
+
if (propName.match(EVENT_PROP_REGEX)) {
|
|
113025
|
+
let labelName = propName.slice(2);
|
|
113026
|
+
labelName = labelName.charAt(0).toLowerCase() + labelName.slice(1);
|
|
113027
|
+
if (attrNameCasing === 0) labelName = (0, language_core_1.hyphenateAttr)(labelName);
|
|
113028
|
+
if (addVOnShorthands) attributes.push({
|
|
113029
|
+
name: V_ON_SHORTHAND + labelName,
|
|
113030
|
+
description: propInfo?.description
|
|
113031
|
+
});
|
|
113032
|
+
if (addVOns) attributes.push({
|
|
113033
|
+
name: DIRECTIVE_V_ON + labelName,
|
|
113034
|
+
description: propInfo?.description
|
|
113035
|
+
});
|
|
113036
|
+
} else {
|
|
113037
|
+
const labelName = attrNameCasing === 1 ? propName : (0, language_core_1.hyphenateAttr)(propName);
|
|
113038
|
+
if (addPlainAttrs) attributes.push({
|
|
113039
|
+
name: labelName,
|
|
113040
|
+
description: propInfo?.description,
|
|
113041
|
+
valueSet: propInfo?.boolean ? "v" : void 0
|
|
113042
|
+
});
|
|
113043
|
+
if (addVBindShorthands) attributes.push({
|
|
113044
|
+
name: V_BIND_SHORTHAND + labelName,
|
|
113045
|
+
description: propInfo?.description
|
|
113046
|
+
});
|
|
113047
|
+
if (addVBinds) attributes.push({
|
|
113048
|
+
name: DIRECTIVE_V_BIND + labelName,
|
|
113049
|
+
description: propInfo?.description
|
|
113050
|
+
});
|
|
113051
|
+
}
|
|
113052
|
+
if (propName.startsWith(UPDATE_PROP_PREFIX)) {
|
|
113053
|
+
const model = propName.slice(9);
|
|
113054
|
+
const label = DIRECTIVE_V_MODEL + (attrNameCasing === 1 ? model : (0, language_core_1.hyphenateAttr)(model));
|
|
113055
|
+
attributes.push({
|
|
113056
|
+
name: label,
|
|
113057
|
+
description: propInfo?.description
|
|
113058
|
+
});
|
|
113059
|
+
}
|
|
113060
|
+
}
|
|
113061
|
+
for (const directive of directives) attributes.push({ name: (0, language_core_1.hyphenateAttr)(directive) });
|
|
113062
|
+
if (mode === "hover") for (const item of attributes) item.description = void 0;
|
|
113063
|
+
return attributes;
|
|
113239
113064
|
}
|
|
113240
|
-
|
|
113241
|
-
|
|
113242
|
-
|
|
113243
|
-
|
|
113244
|
-
|
|
113245
|
-
|
|
113246
|
-
|
|
113065
|
+
}),
|
|
113066
|
+
provideValues: createProvider({
|
|
113067
|
+
async fetch(tag, attr) {
|
|
113068
|
+
if (tag === "slot" && attr === "name") return await tsserver.getComponentSlots(root.fileName) ?? [];
|
|
113069
|
+
return [];
|
|
113070
|
+
},
|
|
113071
|
+
provide(values) {
|
|
113072
|
+
return values.map((value) => ({ name: value }));
|
|
113247
113073
|
}
|
|
113248
|
-
|
|
113249
|
-
},
|
|
113250
|
-
provideValues: (tag, attr) => {
|
|
113251
|
-
return getAttrValues(tag, attr).map((value) => ({ name: value }));
|
|
113252
|
-
}
|
|
113074
|
+
})
|
|
113253
113075
|
}, {
|
|
113254
113076
|
getId: () => "vue-auto-imports",
|
|
113255
113077
|
isApplicable: () => true,
|
|
@@ -113270,70 +113092,36 @@ var require_vue_template = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
113270
113092
|
}
|
|
113271
113093
|
};
|
|
113272
113094
|
} };
|
|
113273
|
-
function
|
|
113274
|
-
|
|
113275
|
-
let
|
|
113276
|
-
|
|
113277
|
-
|
|
113278
|
-
|
|
113279
|
-
|
|
113280
|
-
|
|
113095
|
+
function createProvider(options) {
|
|
113096
|
+
let status = "idle";
|
|
113097
|
+
let data;
|
|
113098
|
+
return (...args) => {
|
|
113099
|
+
if (status === "idle") {
|
|
113100
|
+
status = "pending";
|
|
113101
|
+
tasks.push((async () => {
|
|
113102
|
+
data = await options.fetch(...args);
|
|
113103
|
+
status = "done";
|
|
113104
|
+
version++;
|
|
113105
|
+
})());
|
|
113106
|
+
} else if (status === "done") return options.provide(data, ...args);
|
|
113107
|
+
return [];
|
|
113281
113108
|
};
|
|
113282
113109
|
}
|
|
113283
|
-
|
|
113284
|
-
|
|
113285
|
-
|
|
113286
|
-
|
|
113287
|
-
|
|
113288
|
-
|
|
113289
|
-
|
|
113290
|
-
|
|
113291
|
-
|
|
113292
|
-
|
|
113293
|
-
|
|
113294
|
-
|
|
113295
|
-
if (!data) {
|
|
113296
|
-
data = {
|
|
113297
|
-
attrs: [],
|
|
113298
|
-
meta: void 0
|
|
113299
|
-
};
|
|
113300
|
-
tagDataMap.set(tag, data);
|
|
113301
|
-
tasks.push((async () => {
|
|
113302
|
-
tagDataMap.set(tag, {
|
|
113303
|
-
attrs: await tsserver.getElementAttrs(root.fileName, tag) ?? [],
|
|
113304
|
-
meta: await tsserver.getComponentMeta(root.fileName, tag)
|
|
113305
|
-
});
|
|
113306
|
-
version++;
|
|
113307
|
-
})());
|
|
113308
|
-
}
|
|
113309
|
-
return data;
|
|
113310
|
-
}
|
|
113311
|
-
function getDirectives() {
|
|
113312
|
-
if (!directives) {
|
|
113313
|
-
directives = [];
|
|
113314
|
-
tasks.push((async () => {
|
|
113315
|
-
directives = await tsserver.getComponentDirectives(root.fileName) ?? [];
|
|
113316
|
-
version++;
|
|
113317
|
-
})());
|
|
113110
|
+
}
|
|
113111
|
+
async function getCustomData() {
|
|
113112
|
+
const paths = await context.env.getConfiguration?.("html.customData") ?? [];
|
|
113113
|
+
const customData = [];
|
|
113114
|
+
for (const path of paths) for (const workspaceFolder of context.env.workspaceFolders) {
|
|
113115
|
+
const uri = vscode_uri_1.Utils.resolvePath(workspaceFolder, path);
|
|
113116
|
+
const text = await context.env.fs?.readFile(uri) ?? "";
|
|
113117
|
+
try {
|
|
113118
|
+
const data = JSON.parse(text);
|
|
113119
|
+
customData.push(html.newHTMLDataProvider(path, data));
|
|
113120
|
+
} catch (error) {
|
|
113121
|
+
console.error(error);
|
|
113318
113122
|
}
|
|
113319
|
-
return directives;
|
|
113320
|
-
}
|
|
113321
|
-
function getComponentsAndElements() {
|
|
113322
|
-
if (!components || !elements) {
|
|
113323
|
-
components = [];
|
|
113324
|
-
elements = [];
|
|
113325
|
-
tasks.push((async () => {
|
|
113326
|
-
const res = await Promise.all([tsserver.getComponentNames(root.fileName), tsserver.getElementNames(root.fileName)]);
|
|
113327
|
-
components = res[0] ?? [];
|
|
113328
|
-
elements = res[1] ?? [];
|
|
113329
|
-
version++;
|
|
113330
|
-
})());
|
|
113331
|
-
}
|
|
113332
|
-
return {
|
|
113333
|
-
components,
|
|
113334
|
-
elements
|
|
113335
|
-
};
|
|
113336
113123
|
}
|
|
113124
|
+
return customData;
|
|
113337
113125
|
}
|
|
113338
113126
|
function addDirectiveModifiers(list, item, document) {
|
|
113339
113127
|
const replacement = getReplacement(item, document);
|
|
@@ -113366,7 +113154,7 @@ var require_vue_template = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
113366
113154
|
}
|
|
113367
113155
|
}
|
|
113368
113156
|
};
|
|
113369
|
-
function
|
|
113157
|
+
function updateHtmlData(newData) {
|
|
113370
113158
|
htmlData = newData;
|
|
113371
113159
|
onDidChangeCustomDataListeners.forEach((l) => l());
|
|
113372
113160
|
}
|
|
@@ -113415,9 +113203,9 @@ var require_vue_template_ref_links = /* @__PURE__ */ __commonJSMin(((exports) =>
|
|
|
113415
113203
|
return { provideDocumentLinks(document) {
|
|
113416
113204
|
const info = (0, utils_1.resolveEmbeddedCode)(context, document.uri);
|
|
113417
113205
|
if (info?.code.id !== "scriptsetup_raw") return;
|
|
113418
|
-
const {
|
|
113419
|
-
const codegen = language_core_1.tsCodegen.get(
|
|
113420
|
-
if (!
|
|
113206
|
+
const { ir } = info.root;
|
|
113207
|
+
const codegen = language_core_1.tsCodegen.get(ir);
|
|
113208
|
+
if (!ir.scriptSetup) return;
|
|
113421
113209
|
const templateVirtualCode = info.script.generated.embeddedCodes.get("template");
|
|
113422
113210
|
if (!templateVirtualCode) return;
|
|
113423
113211
|
const templateDocumentUri = context.encodeEmbeddedDocumentUri(info.script.id, "template");
|
|
@@ -113425,7 +113213,7 @@ var require_vue_template_ref_links = /* @__PURE__ */ __commonJSMin(((exports) =>
|
|
|
113425
113213
|
const templateRefs = codegen?.getGeneratedTemplate()?.templateRefs;
|
|
113426
113214
|
return (codegen?.getScriptSetupRanges()?.useTemplateRef ?? []).flatMap(({ arg }) => {
|
|
113427
113215
|
if (!arg) return [];
|
|
113428
|
-
const name =
|
|
113216
|
+
const name = ir.scriptSetup.content.slice(arg.start + 1, arg.end - 1);
|
|
113429
113217
|
const range = {
|
|
113430
113218
|
start: document.positionAt(arg.start + 1),
|
|
113431
113219
|
end: document.positionAt(arg.end - 1)
|
|
@@ -113581,234 +113369,6 @@ var require_language_service = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
113581
113369
|
}
|
|
113582
113370
|
}));
|
|
113583
113371
|
//#endregion
|
|
113584
|
-
//#region node_modules/@vue/typescript-plugin/lib/common.js
|
|
113585
|
-
var require_common = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
113586
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
113587
|
-
exports.postprocessLanguageService = postprocessLanguageService;
|
|
113588
|
-
require_transform$1();
|
|
113589
|
-
require_utils$6();
|
|
113590
|
-
var language_core_1 = require_language_core();
|
|
113591
|
-
var shared_1 = (init_shared_esm_bundler(), __toCommonJS(shared_esm_bundler_exports));
|
|
113592
|
-
var windowsPathReg = /\\/g;
|
|
113593
|
-
function postprocessLanguageService(ts, language, languageService, vueOptions, asScriptId) {
|
|
113594
|
-
const proxyCache = /* @__PURE__ */ new Map();
|
|
113595
|
-
const getProxyMethod = (target, p) => {
|
|
113596
|
-
switch (p) {
|
|
113597
|
-
case "findReferences": return findReferences(target[p]);
|
|
113598
|
-
case "getCompletionsAtPosition": return getCompletionsAtPosition(target[p]);
|
|
113599
|
-
case "getCompletionEntryDetails": return getCompletionEntryDetails(target[p]);
|
|
113600
|
-
case "getCodeFixesAtPosition": return getCodeFixesAtPosition(target[p]);
|
|
113601
|
-
case "getDefinitionAndBoundSpan": return getDefinitionAndBoundSpan(target[p]);
|
|
113602
|
-
}
|
|
113603
|
-
};
|
|
113604
|
-
return new Proxy(languageService, { get(target, p, receiver) {
|
|
113605
|
-
if (!proxyCache.has(p)) proxyCache.set(p, getProxyMethod(target, p));
|
|
113606
|
-
const proxyMethod = proxyCache.get(p);
|
|
113607
|
-
if (proxyMethod) return proxyMethod;
|
|
113608
|
-
return Reflect.get(target, p, receiver);
|
|
113609
|
-
} });
|
|
113610
|
-
function findReferences(findReferences) {
|
|
113611
|
-
return (fileName, ...rest) => {
|
|
113612
|
-
const result = findReferences(fileName, ...rest);
|
|
113613
|
-
if (!result) return result;
|
|
113614
|
-
for (const { references } of result) for (const reference of references) {
|
|
113615
|
-
const sourceScript = language.scripts.get(asScriptId(reference.fileName));
|
|
113616
|
-
const root = sourceScript?.generated?.root;
|
|
113617
|
-
if (!sourceScript || !(root instanceof language_core_1.VueVirtualCode)) continue;
|
|
113618
|
-
const styles = root.sfc.styles;
|
|
113619
|
-
if (!styles.length) return result;
|
|
113620
|
-
if (!styles.some((style) => reference.textSpan.start >= style.startTagEnd && reference.textSpan.start + reference.textSpan.length <= style.endTagStart)) continue;
|
|
113621
|
-
if (sourceScript.snapshot.getText(reference.textSpan.start - 1, reference.textSpan.start) === ".") {
|
|
113622
|
-
reference.textSpan.start--;
|
|
113623
|
-
reference.textSpan.length++;
|
|
113624
|
-
}
|
|
113625
|
-
}
|
|
113626
|
-
return result;
|
|
113627
|
-
};
|
|
113628
|
-
}
|
|
113629
|
-
function getCompletionsAtPosition(getCompletionsAtPosition) {
|
|
113630
|
-
return (filePath, position, ...rests) => {
|
|
113631
|
-
const fileName = filePath.replace(windowsPathReg, "/");
|
|
113632
|
-
const result = getCompletionsAtPosition(fileName, position, ...rests);
|
|
113633
|
-
if (result) resolveCompletionResult(ts, language, asScriptId, vueOptions, fileName, position, result);
|
|
113634
|
-
return result;
|
|
113635
|
-
};
|
|
113636
|
-
}
|
|
113637
|
-
function getCompletionEntryDetails(getCompletionEntryDetails) {
|
|
113638
|
-
return (...args) => {
|
|
113639
|
-
const details = getCompletionEntryDetails(...args);
|
|
113640
|
-
if (details) resolveCompletionEntryDetails(language, details, args[6]);
|
|
113641
|
-
return details;
|
|
113642
|
-
};
|
|
113643
|
-
}
|
|
113644
|
-
function getCodeFixesAtPosition(getCodeFixesAtPosition) {
|
|
113645
|
-
return (...args) => {
|
|
113646
|
-
let result = getCodeFixesAtPosition(...args);
|
|
113647
|
-
result = result.filter((entry) => !entry.description.includes("__VLS_"));
|
|
113648
|
-
return result;
|
|
113649
|
-
};
|
|
113650
|
-
}
|
|
113651
|
-
function getDefinitionAndBoundSpan(getDefinitionAndBoundSpan) {
|
|
113652
|
-
return (fileName, position, ...rests) => {
|
|
113653
|
-
const result = getDefinitionAndBoundSpan(fileName, position, ...rests);
|
|
113654
|
-
const program = languageService.getProgram();
|
|
113655
|
-
const root = language.scripts.get(asScriptId(fileName))?.generated?.root;
|
|
113656
|
-
if (!(root instanceof language_core_1.VueVirtualCode)) return result;
|
|
113657
|
-
if (!result?.definitions?.length) return;
|
|
113658
|
-
if (!root.sfc.template || position < root.sfc.template.startTagEnd || position > root.sfc.template.endTagStart) return result;
|
|
113659
|
-
const definitions = new Set(result.definitions);
|
|
113660
|
-
const skippedDefinitions = [];
|
|
113661
|
-
if (result.definitions.length >= 2) {
|
|
113662
|
-
for (const definition of result.definitions) if (root.sfc.content[definition.textSpan.start - 1] === "@" || root.sfc.content.slice(definition.textSpan.start - 5, definition.textSpan.start) === "v-on:") definitions.delete(definition);
|
|
113663
|
-
}
|
|
113664
|
-
for (const definition of result.definitions) {
|
|
113665
|
-
if (vueOptions.extensions.some((ext) => definition.fileName.endsWith(ext))) continue;
|
|
113666
|
-
const sourceFile = program.getSourceFile(definition.fileName);
|
|
113667
|
-
if (!sourceFile) continue;
|
|
113668
|
-
visit(sourceFile, definition, sourceFile);
|
|
113669
|
-
}
|
|
113670
|
-
for (const definition of skippedDefinitions) definitions.delete(definition);
|
|
113671
|
-
return {
|
|
113672
|
-
definitions: [...definitions],
|
|
113673
|
-
textSpan: result.textSpan
|
|
113674
|
-
};
|
|
113675
|
-
function visit(node, definition, sourceFile) {
|
|
113676
|
-
if (ts.isPropertySignature(node) && node.type) proxy(node.name, node.type, definition, sourceFile);
|
|
113677
|
-
else if (ts.isVariableDeclaration(node) && ts.isIdentifier(node.name) && node.type && !node.initializer) proxy(node.name, node.type, definition, sourceFile);
|
|
113678
|
-
else ts.forEachChild(node, (child) => visit(child, definition, sourceFile));
|
|
113679
|
-
}
|
|
113680
|
-
function proxy(name, type, definition, sourceFile) {
|
|
113681
|
-
const { textSpan, fileName } = definition;
|
|
113682
|
-
const start = name.getStart(sourceFile);
|
|
113683
|
-
const end = name.getEnd();
|
|
113684
|
-
if (start !== textSpan.start || end - start !== textSpan.length) return;
|
|
113685
|
-
if (ts.isIndexedAccessTypeNode(type)) {
|
|
113686
|
-
const res = getDefinitionAndBoundSpan(fileName, type.indexType.getStart(sourceFile), ...rests);
|
|
113687
|
-
if (res?.definitions?.length) {
|
|
113688
|
-
for (const definition of res.definitions) definitions.add(definition);
|
|
113689
|
-
skippedDefinitions.push(definition);
|
|
113690
|
-
}
|
|
113691
|
-
} else if (ts.isImportTypeNode(type)) {
|
|
113692
|
-
const res = getDefinitionAndBoundSpan(fileName, type.argument.getStart(sourceFile), ...rests);
|
|
113693
|
-
if (res?.definitions?.length) {
|
|
113694
|
-
for (const definition of res.definitions) definitions.add(definition);
|
|
113695
|
-
skippedDefinitions.push(definition);
|
|
113696
|
-
}
|
|
113697
|
-
}
|
|
113698
|
-
}
|
|
113699
|
-
};
|
|
113700
|
-
}
|
|
113701
|
-
}
|
|
113702
|
-
function resolveCompletionResult(ts, language, asScriptId, vueOptions, fileName, position, result) {
|
|
113703
|
-
result.entries = result.entries.filter((entry) => !entry.name.includes("__VLS_") && !entry.labelDetails?.description?.includes("__VLS_"));
|
|
113704
|
-
const root = language.scripts.get(asScriptId(fileName))?.generated?.root;
|
|
113705
|
-
if (root instanceof language_core_1.VueVirtualCode) {
|
|
113706
|
-
if ([root.sfc.template, ...root.sfc.styles].filter(Boolean).map((block) => [block.startTagEnd, block.endTagStart]).some(([start, end]) => position >= start && position <= end)) {
|
|
113707
|
-
const globalKinds = new Set([
|
|
113708
|
-
"var",
|
|
113709
|
-
"function",
|
|
113710
|
-
"module"
|
|
113711
|
-
]);
|
|
113712
|
-
const globalsOrKeywords = ts.Completions.SortText.GlobalsOrKeywords;
|
|
113713
|
-
const sortTexts = new Set([
|
|
113714
|
-
globalsOrKeywords,
|
|
113715
|
-
"z" + globalsOrKeywords,
|
|
113716
|
-
globalsOrKeywords + "1"
|
|
113717
|
-
]);
|
|
113718
|
-
result.entries = result.entries.filter((entry) => !(entry.kind === "const" && entry.name in vueOptions.macros) && (!globalKinds.has(entry.kind) || !sortTexts.has(entry.sortText) || (0, shared_1.isGloballyAllowed)(entry.name)));
|
|
113719
|
-
}
|
|
113720
|
-
}
|
|
113721
|
-
for (const item of result.entries) if (item.source) {
|
|
113722
|
-
const data = item.data;
|
|
113723
|
-
const oldName = item.name;
|
|
113724
|
-
for (const vueExt of vueOptions.extensions) {
|
|
113725
|
-
const suffix = (0, shared_1.capitalize)(vueExt.slice(1));
|
|
113726
|
-
if (item.source.endsWith(vueExt) && item.name.endsWith(suffix)) {
|
|
113727
|
-
item.name = (0, shared_1.capitalize)(item.name.slice(0, -suffix.length));
|
|
113728
|
-
if (item.insertText) item.insertText = item.insertText.replace(`${suffix}$1`, "$1");
|
|
113729
|
-
if (data) data.__vue__componentAutoImport = {
|
|
113730
|
-
oldName,
|
|
113731
|
-
newName: item.name
|
|
113732
|
-
};
|
|
113733
|
-
break;
|
|
113734
|
-
}
|
|
113735
|
-
}
|
|
113736
|
-
if (data) data.__vue__autoImport = { fileName };
|
|
113737
|
-
}
|
|
113738
|
-
}
|
|
113739
|
-
function resolveCompletionEntryDetails(language, details, data) {
|
|
113740
|
-
if (data?.__vue__componentAutoImport) {
|
|
113741
|
-
const { oldName, newName } = data.__vue__componentAutoImport;
|
|
113742
|
-
for (const codeAction of details?.codeActions ?? []) for (const change of codeAction.changes) for (const textChange of change.textChanges) textChange.newText = textChange.newText.replace("import " + oldName + " from ", "import " + newName + " from ");
|
|
113743
|
-
}
|
|
113744
|
-
if (data?.__vue__autoImportSuggestions) for (const codeAction of details?.codeActions ?? []) for (const change of codeAction.changes) for (const textChange of change.textChanges) {
|
|
113745
|
-
if (data.__vue__componentAutoImport) {
|
|
113746
|
-
const { oldName, newName } = data.__vue__componentAutoImport;
|
|
113747
|
-
textChange.newText = textChange.newText.replace("import type " + oldName + " from ", "import " + newName + " from ");
|
|
113748
|
-
}
|
|
113749
|
-
const { entryName } = data.__vue__autoImportSuggestions;
|
|
113750
|
-
textChange.newText = textChange.newText.replace("import type { " + entryName + " } from ", "import { " + entryName + " } from ");
|
|
113751
|
-
}
|
|
113752
|
-
if (data?.__vue__autoImport) {
|
|
113753
|
-
const { fileName } = data.__vue__autoImport;
|
|
113754
|
-
const sourceScript = language.scripts.get(fileName);
|
|
113755
|
-
if (sourceScript?.generated?.root instanceof language_core_1.VueVirtualCode) {
|
|
113756
|
-
const { vueSfc } = sourceScript.generated.root;
|
|
113757
|
-
if (!vueSfc?.descriptor.script && !vueSfc?.descriptor.scriptSetup) for (const codeAction of details?.codeActions ?? []) {
|
|
113758
|
-
for (const change of codeAction.changes) {
|
|
113759
|
-
for (const textChange of change.textChanges) {
|
|
113760
|
-
textChange.newText = `<script setup lang="ts">${textChange.newText}<\/script>\n\n`;
|
|
113761
|
-
break;
|
|
113762
|
-
}
|
|
113763
|
-
break;
|
|
113764
|
-
}
|
|
113765
|
-
break;
|
|
113766
|
-
}
|
|
113767
|
-
}
|
|
113768
|
-
}
|
|
113769
|
-
}
|
|
113770
|
-
}));
|
|
113771
|
-
//#endregion
|
|
113772
|
-
//#region node_modules/@vue/typescript-plugin/lib/requests/collectExtractProps.js
|
|
113773
|
-
var require_collectExtractProps = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
113774
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
113775
|
-
exports.collectExtractProps = collectExtractProps;
|
|
113776
|
-
var language_core_1 = require_language_core();
|
|
113777
|
-
function collectExtractProps(ts, language, program, sourceScript, virtualCode, templateCodeRange, leadingOffset = 0) {
|
|
113778
|
-
const result = /* @__PURE__ */ new Map();
|
|
113779
|
-
const sourceFile = program.getSourceFile(virtualCode.fileName);
|
|
113780
|
-
const checker = program.getTypeChecker();
|
|
113781
|
-
const serviceScript = sourceScript.generated.languagePlugin.typescript?.getServiceScript(virtualCode);
|
|
113782
|
-
const maps = serviceScript ? [...language.maps.forEach(serviceScript.code)].map(([, map]) => map) : [];
|
|
113783
|
-
const { sfc } = virtualCode;
|
|
113784
|
-
sourceFile.forEachChild(function visit(node) {
|
|
113785
|
-
if (ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === language_core_1.names.ctx && ts.isIdentifier(node.name)) {
|
|
113786
|
-
const { name } = node;
|
|
113787
|
-
for (const map of maps) {
|
|
113788
|
-
let mapped = false;
|
|
113789
|
-
for (const source of map.toSourceLocation(name.getEnd() - leadingOffset)) if (source[0] >= sfc.template.startTagEnd + templateCodeRange[0] && source[0] <= sfc.template.startTagEnd + templateCodeRange[1] && (0, language_core_1.isSemanticTokensEnabled)(source[1].data)) {
|
|
113790
|
-
mapped = true;
|
|
113791
|
-
if (!result.has(name.text)) {
|
|
113792
|
-
const type = checker.getTypeAtLocation(node);
|
|
113793
|
-
const typeString = checker.typeToString(type, node, ts.TypeFormatFlags.NoTruncation);
|
|
113794
|
-
result.set(name.text, {
|
|
113795
|
-
name: name.text,
|
|
113796
|
-
type: typeString.includes("__VLS_") ? "any" : typeString,
|
|
113797
|
-
model: false
|
|
113798
|
-
});
|
|
113799
|
-
}
|
|
113800
|
-
if (ts.isPostfixUnaryExpression(node.parent) || ts.isBinaryExpression(node.parent)) result.get(name.text).model = true;
|
|
113801
|
-
break;
|
|
113802
|
-
}
|
|
113803
|
-
if (mapped) break;
|
|
113804
|
-
}
|
|
113805
|
-
}
|
|
113806
|
-
node.forEachChild(visit);
|
|
113807
|
-
});
|
|
113808
|
-
return [...result.values()];
|
|
113809
|
-
}
|
|
113810
|
-
}));
|
|
113811
|
-
//#endregion
|
|
113812
113372
|
//#region node_modules/@vue/typescript-plugin/lib/requests/utils.js
|
|
113813
113373
|
var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
113814
113374
|
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
@@ -113856,16 +113416,18 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
113856
113416
|
exports.getComponentType = getComponentType;
|
|
113857
113417
|
exports.getSelfComponentName = getSelfComponentName;
|
|
113858
113418
|
exports.getVariableType = getVariableType;
|
|
113419
|
+
exports.hasBooleanType = hasBooleanType;
|
|
113420
|
+
exports.forEachTouchingNode = forEachTouchingNode;
|
|
113859
113421
|
var language_core_1 = require_language_core();
|
|
113860
113422
|
var shared_1 = (init_shared_esm_bundler(), __toCommonJS(shared_esm_bundler_exports));
|
|
113861
113423
|
var path = __importStar(require_path_browserify());
|
|
113862
|
-
function getComponentType(ts, checker, sourceFile, { fileName,
|
|
113424
|
+
function getComponentType(ts, checker, sourceFile, { fileName, ir }, tag) {
|
|
113863
113425
|
const testNames = new Set([
|
|
113864
113426
|
tag,
|
|
113865
113427
|
(0, shared_1.camelize)(tag),
|
|
113866
113428
|
(0, shared_1.capitalize)((0, shared_1.camelize)(tag))
|
|
113867
113429
|
]);
|
|
113868
|
-
const codegen = language_core_1.tsCodegen.get(
|
|
113430
|
+
const codegen = language_core_1.tsCodegen.get(ir);
|
|
113869
113431
|
for (const importedName of codegen?.getImportedComponents() ?? []) if (testNames.has(importedName)) {
|
|
113870
113432
|
const node = searchDefaultImportIdentifier(ts, sourceFile, importedName);
|
|
113871
113433
|
if (node) return {
|
|
@@ -113923,6 +113485,248 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
113923
113485
|
else node.forEachChild(walk);
|
|
113924
113486
|
}
|
|
113925
113487
|
}
|
|
113488
|
+
function hasBooleanType(ts, type) {
|
|
113489
|
+
if (type.flags & ts.TypeFlags.BooleanLike) return true;
|
|
113490
|
+
if (type.isUnionOrIntersection()) return type.types.some((type) => hasBooleanType(ts, type));
|
|
113491
|
+
return false;
|
|
113492
|
+
}
|
|
113493
|
+
function* forEachTouchingNode(ts, sourceFile, position) {
|
|
113494
|
+
yield* binaryVisit(ts, sourceFile, sourceFile, position);
|
|
113495
|
+
}
|
|
113496
|
+
function* binaryVisit(ts, sourceFile, node, position) {
|
|
113497
|
+
const nodes = [];
|
|
113498
|
+
ts.forEachChild(node, (child) => {
|
|
113499
|
+
nodes.push(child);
|
|
113500
|
+
});
|
|
113501
|
+
let left = 0;
|
|
113502
|
+
let right = nodes.length - 1;
|
|
113503
|
+
while (left <= right) {
|
|
113504
|
+
const mid = Math.floor((left + right) / 2);
|
|
113505
|
+
const node = nodes[mid];
|
|
113506
|
+
if (position > node.end) left = mid + 1;
|
|
113507
|
+
else if (position < node.getStart(sourceFile)) right = mid - 1;
|
|
113508
|
+
else {
|
|
113509
|
+
yield node;
|
|
113510
|
+
yield* binaryVisit(ts, sourceFile, node, position);
|
|
113511
|
+
return;
|
|
113512
|
+
}
|
|
113513
|
+
}
|
|
113514
|
+
}
|
|
113515
|
+
}));
|
|
113516
|
+
//#endregion
|
|
113517
|
+
//#region node_modules/@vue/typescript-plugin/lib/common.js
|
|
113518
|
+
var require_common = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
113519
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
113520
|
+
exports.postprocessLanguageService = postprocessLanguageService;
|
|
113521
|
+
require_transform$1();
|
|
113522
|
+
require_utils$6();
|
|
113523
|
+
var language_core_1 = require_language_core();
|
|
113524
|
+
var shared_1 = (init_shared_esm_bundler(), __toCommonJS(shared_esm_bundler_exports));
|
|
113525
|
+
var utils_2 = require_utils();
|
|
113526
|
+
var windowsPathReg = /\\/g;
|
|
113527
|
+
function postprocessLanguageService(ts, language, languageService, vueOptions, asScriptId) {
|
|
113528
|
+
const proxyCache = /* @__PURE__ */ new Map();
|
|
113529
|
+
const getProxyMethod = (target, p) => {
|
|
113530
|
+
switch (p) {
|
|
113531
|
+
case "findReferences": return findReferences(target[p]);
|
|
113532
|
+
case "getCompletionsAtPosition": return getCompletionsAtPosition(target[p]);
|
|
113533
|
+
case "getCompletionEntryDetails": return getCompletionEntryDetails(target[p]);
|
|
113534
|
+
case "getCodeFixesAtPosition": return getCodeFixesAtPosition(target[p]);
|
|
113535
|
+
case "getDefinitionAndBoundSpan": return getDefinitionAndBoundSpan(target[p]);
|
|
113536
|
+
}
|
|
113537
|
+
};
|
|
113538
|
+
return new Proxy(languageService, { get(target, p, receiver) {
|
|
113539
|
+
if (!proxyCache.has(p)) proxyCache.set(p, getProxyMethod(target, p));
|
|
113540
|
+
const proxyMethod = proxyCache.get(p);
|
|
113541
|
+
if (proxyMethod) return proxyMethod;
|
|
113542
|
+
return Reflect.get(target, p, receiver);
|
|
113543
|
+
} });
|
|
113544
|
+
function findReferences(findReferences) {
|
|
113545
|
+
return (fileName, ...rest) => {
|
|
113546
|
+
const result = findReferences(fileName, ...rest);
|
|
113547
|
+
if (!result) return result;
|
|
113548
|
+
for (const { references } of result) for (const reference of references) {
|
|
113549
|
+
const sourceScript = language.scripts.get(asScriptId(reference.fileName));
|
|
113550
|
+
const root = sourceScript?.generated?.root;
|
|
113551
|
+
if (!sourceScript || !(root instanceof language_core_1.VueVirtualCode)) continue;
|
|
113552
|
+
const styles = root.ir.styles;
|
|
113553
|
+
if (!styles.length) return result;
|
|
113554
|
+
if (!styles.some((style) => reference.textSpan.start >= style.startTagEnd && reference.textSpan.start + reference.textSpan.length <= style.endTagStart)) continue;
|
|
113555
|
+
if (sourceScript.snapshot.getText(reference.textSpan.start - 1, reference.textSpan.start) === ".") {
|
|
113556
|
+
reference.textSpan.start--;
|
|
113557
|
+
reference.textSpan.length++;
|
|
113558
|
+
}
|
|
113559
|
+
}
|
|
113560
|
+
return result;
|
|
113561
|
+
};
|
|
113562
|
+
}
|
|
113563
|
+
function getCompletionsAtPosition(getCompletionsAtPosition) {
|
|
113564
|
+
return (filePath, position, ...rests) => {
|
|
113565
|
+
const fileName = filePath.replace(windowsPathReg, "/");
|
|
113566
|
+
const result = getCompletionsAtPosition(fileName, position, ...rests);
|
|
113567
|
+
if (result) resolveCompletionResult(ts, language, asScriptId, vueOptions, fileName, position, result);
|
|
113568
|
+
return result;
|
|
113569
|
+
};
|
|
113570
|
+
}
|
|
113571
|
+
function getCompletionEntryDetails(getCompletionEntryDetails) {
|
|
113572
|
+
return (...args) => {
|
|
113573
|
+
const details = getCompletionEntryDetails(...args);
|
|
113574
|
+
if (details) resolveCompletionEntryDetails(language, details, args[6]);
|
|
113575
|
+
return details;
|
|
113576
|
+
};
|
|
113577
|
+
}
|
|
113578
|
+
function getCodeFixesAtPosition(getCodeFixesAtPosition) {
|
|
113579
|
+
return (...args) => {
|
|
113580
|
+
let result = getCodeFixesAtPosition(...args);
|
|
113581
|
+
result = result.filter((entry) => !entry.description.includes("__VLS_"));
|
|
113582
|
+
return result;
|
|
113583
|
+
};
|
|
113584
|
+
}
|
|
113585
|
+
function getDefinitionAndBoundSpan(getDefinitionAndBoundSpan) {
|
|
113586
|
+
return (fileName, position, ...rests) => {
|
|
113587
|
+
const result = getDefinitionAndBoundSpan(fileName, position, ...rests);
|
|
113588
|
+
if (!result?.definitions?.length) return result;
|
|
113589
|
+
const program = languageService.getProgram();
|
|
113590
|
+
const root = language.scripts.get(asScriptId(fileName))?.generated?.root;
|
|
113591
|
+
if (!(root instanceof language_core_1.VueVirtualCode)) return result;
|
|
113592
|
+
if (!root.ir.template || position < root.ir.template.startTagEnd || position > root.ir.template.endTagStart) return result;
|
|
113593
|
+
const definitions = new Set(result.definitions);
|
|
113594
|
+
if (result.definitions.length >= 2) {
|
|
113595
|
+
for (const definition of result.definitions) if (root.ir.content[definition.textSpan.start - 1] === "@" || root.ir.content.slice(definition.textSpan.start - 5, definition.textSpan.start) === "v-on:") definitions.delete(definition);
|
|
113596
|
+
}
|
|
113597
|
+
for (const definition of result.definitions) {
|
|
113598
|
+
if (vueOptions.extensions.some((ext) => definition.fileName.endsWith(ext))) continue;
|
|
113599
|
+
const sourceFile = program.getSourceFile(definition.fileName);
|
|
113600
|
+
if (!sourceFile) continue;
|
|
113601
|
+
const node = visit(sourceFile, definition);
|
|
113602
|
+
if (!node) continue;
|
|
113603
|
+
const position = node.getStart(sourceFile);
|
|
113604
|
+
const res = getDefinitionAndBoundSpan(definition.fileName, position);
|
|
113605
|
+
if (res?.definitions?.length) {
|
|
113606
|
+
definitions.delete(definition);
|
|
113607
|
+
for (const definition of res.definitions) definitions.add(definition);
|
|
113608
|
+
}
|
|
113609
|
+
}
|
|
113610
|
+
return {
|
|
113611
|
+
definitions: [...definitions],
|
|
113612
|
+
textSpan: result.textSpan
|
|
113613
|
+
};
|
|
113614
|
+
function visit(sourceFile, definition) {
|
|
113615
|
+
for (const node of (0, utils_2.forEachTouchingNode)(ts, sourceFile, definition.textSpan.start)) if (ts.isPropertySignature(node) && node.type || ts.isVariableDeclaration(node) && ts.isIdentifier(node.name) && node.type) {
|
|
113616
|
+
if (definition.textSpan.start + definition.textSpan.length > node.name.end || definition.textSpan.start < node.name.getStart(sourceFile)) continue;
|
|
113617
|
+
let type = node.type;
|
|
113618
|
+
while (ts.isTypeReferenceNode(type) && type.typeArguments?.length) type = type.typeArguments[0];
|
|
113619
|
+
if (ts.isIndexedAccessTypeNode(type)) return type.indexType;
|
|
113620
|
+
else if (ts.isImportTypeNode(type)) return type.qualifier ?? type.argument;
|
|
113621
|
+
}
|
|
113622
|
+
}
|
|
113623
|
+
};
|
|
113624
|
+
}
|
|
113625
|
+
}
|
|
113626
|
+
function resolveCompletionResult(ts, language, asScriptId, vueOptions, fileName, position, result) {
|
|
113627
|
+
result.entries = result.entries.filter((entry) => !entry.name.includes("__VLS_") && !entry.labelDetails?.description?.includes("__VLS_"));
|
|
113628
|
+
const root = language.scripts.get(asScriptId(fileName))?.generated?.root;
|
|
113629
|
+
if (root instanceof language_core_1.VueVirtualCode) {
|
|
113630
|
+
if ([root.ir.template, ...root.ir.styles].filter(Boolean).map((block) => [block.startTagEnd, block.endTagStart]).some(([start, end]) => position >= start && position <= end)) {
|
|
113631
|
+
const globalKinds = new Set([
|
|
113632
|
+
"var",
|
|
113633
|
+
"function",
|
|
113634
|
+
"module"
|
|
113635
|
+
]);
|
|
113636
|
+
const globalsOrKeywords = ts.Completions.SortText.GlobalsOrKeywords;
|
|
113637
|
+
const sortTexts = new Set([
|
|
113638
|
+
globalsOrKeywords,
|
|
113639
|
+
"z" + globalsOrKeywords,
|
|
113640
|
+
globalsOrKeywords + "1"
|
|
113641
|
+
]);
|
|
113642
|
+
result.entries = result.entries.filter((entry) => !(entry.kind === "const" && entry.name in vueOptions.macros) && (!globalKinds.has(entry.kind) || !sortTexts.has(entry.sortText) || (0, shared_1.isGloballyAllowed)(entry.name)));
|
|
113643
|
+
}
|
|
113644
|
+
}
|
|
113645
|
+
for (const item of result.entries) if (item.source) {
|
|
113646
|
+
const data = item.data;
|
|
113647
|
+
const oldName = item.name;
|
|
113648
|
+
for (const vueExt of vueOptions.extensions) {
|
|
113649
|
+
const suffix = (0, shared_1.capitalize)(vueExt.slice(1));
|
|
113650
|
+
if (item.source.endsWith(vueExt) && item.name.endsWith(suffix)) {
|
|
113651
|
+
item.name = (0, shared_1.capitalize)(item.name.slice(0, -suffix.length));
|
|
113652
|
+
if (item.insertText) item.insertText = item.insertText.replace(`${suffix}$1`, "$1");
|
|
113653
|
+
if (data) data.__vue__componentAutoImport = {
|
|
113654
|
+
oldName,
|
|
113655
|
+
newName: item.name
|
|
113656
|
+
};
|
|
113657
|
+
break;
|
|
113658
|
+
}
|
|
113659
|
+
}
|
|
113660
|
+
if (data) data.__vue__autoImport = { fileName };
|
|
113661
|
+
}
|
|
113662
|
+
}
|
|
113663
|
+
function resolveCompletionEntryDetails(language, details, data) {
|
|
113664
|
+
if (data?.__vue__componentAutoImport) {
|
|
113665
|
+
const { oldName, newName } = data.__vue__componentAutoImport;
|
|
113666
|
+
for (const codeAction of details?.codeActions ?? []) for (const change of codeAction.changes) for (const textChange of change.textChanges) textChange.newText = textChange.newText.replace("import " + oldName + " from ", "import " + newName + " from ");
|
|
113667
|
+
}
|
|
113668
|
+
if (data?.__vue__autoImportSuggestions) for (const codeAction of details?.codeActions ?? []) for (const change of codeAction.changes) for (const textChange of change.textChanges) {
|
|
113669
|
+
if (data.__vue__componentAutoImport) {
|
|
113670
|
+
const { oldName, newName } = data.__vue__componentAutoImport;
|
|
113671
|
+
textChange.newText = textChange.newText.replace("import type " + oldName + " from ", "import " + newName + " from ");
|
|
113672
|
+
}
|
|
113673
|
+
const { entryName } = data.__vue__autoImportSuggestions;
|
|
113674
|
+
textChange.newText = textChange.newText.replace("import type { " + entryName + " } from ", "import { " + entryName + " } from ");
|
|
113675
|
+
}
|
|
113676
|
+
if (data?.__vue__autoImport) {
|
|
113677
|
+
const { fileName } = data.__vue__autoImport;
|
|
113678
|
+
const sourceScript = language.scripts.get(fileName);
|
|
113679
|
+
if (sourceScript?.generated?.root instanceof language_core_1.VueVirtualCode) {
|
|
113680
|
+
const { vueSfc } = sourceScript.generated.root;
|
|
113681
|
+
if (!vueSfc?.descriptor.script && !vueSfc?.descriptor.scriptSetup) for (const codeAction of details?.codeActions ?? []) {
|
|
113682
|
+
for (const change of codeAction.changes) {
|
|
113683
|
+
for (const textChange of change.textChanges) {
|
|
113684
|
+
textChange.newText = `<script setup lang="ts">${textChange.newText}<\/script>\n\n`;
|
|
113685
|
+
break;
|
|
113686
|
+
}
|
|
113687
|
+
break;
|
|
113688
|
+
}
|
|
113689
|
+
break;
|
|
113690
|
+
}
|
|
113691
|
+
}
|
|
113692
|
+
}
|
|
113693
|
+
}
|
|
113694
|
+
}));
|
|
113695
|
+
//#endregion
|
|
113696
|
+
//#region node_modules/@vue/typescript-plugin/lib/requests/collectExtractProps.js
|
|
113697
|
+
var require_collectExtractProps = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
113698
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
113699
|
+
exports.collectExtractProps = collectExtractProps;
|
|
113700
|
+
var language_core_1 = require_language_core();
|
|
113701
|
+
function collectExtractProps(ts, language, program, sourceScript, virtualCode, templateCodeRange, leadingOffset = 0) {
|
|
113702
|
+
const serviceScript = sourceScript.generated.languagePlugin.typescript?.getServiceScript(virtualCode);
|
|
113703
|
+
if (!serviceScript) return [];
|
|
113704
|
+
const result = /* @__PURE__ */ new Map();
|
|
113705
|
+
const sourceFile = program.getSourceFile(virtualCode.fileName);
|
|
113706
|
+
const checker = program.getTypeChecker();
|
|
113707
|
+
const map = language.maps.get(serviceScript.code, sourceScript);
|
|
113708
|
+
const { ir } = virtualCode;
|
|
113709
|
+
sourceFile.forEachChild(function visit(node) {
|
|
113710
|
+
if (ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === language_core_1.names.ctx && ts.isIdentifier(node.name)) {
|
|
113711
|
+
const { name } = node;
|
|
113712
|
+
for (const [offset] of map.toSourceLocation(name.getEnd() - leadingOffset, language_core_1.isSemanticTokensEnabled)) if (offset >= ir.template.startTagEnd + templateCodeRange[0] && offset <= ir.template.startTagEnd + templateCodeRange[1]) {
|
|
113713
|
+
if (!result.has(name.text)) {
|
|
113714
|
+
const type = checker.getTypeAtLocation(node);
|
|
113715
|
+
const typeString = checker.typeToString(type, node, ts.TypeFormatFlags.NoTruncation);
|
|
113716
|
+
result.set(name.text, {
|
|
113717
|
+
name: name.text,
|
|
113718
|
+
type: typeString.includes("__VLS_") ? "any" : typeString,
|
|
113719
|
+
model: false
|
|
113720
|
+
});
|
|
113721
|
+
}
|
|
113722
|
+
if (ts.isPostfixUnaryExpression(node.parent) || ts.isBinaryExpression(node.parent)) result.get(name.text).model = true;
|
|
113723
|
+
break;
|
|
113724
|
+
}
|
|
113725
|
+
}
|
|
113726
|
+
node.forEachChild(visit);
|
|
113727
|
+
});
|
|
113728
|
+
return [...result.values()];
|
|
113729
|
+
}
|
|
113926
113730
|
}));
|
|
113927
113731
|
//#endregion
|
|
113928
113732
|
//#region node_modules/@vue/typescript-plugin/lib/requests/getComponentDirectives.js
|
|
@@ -114072,7 +113876,7 @@ var require_scriptSetup = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
114072
113876
|
function getDefaultsFromScriptSetup(ts, printer, sourceScript) {
|
|
114073
113877
|
const virtualCode = sourceScript?.generated?.root;
|
|
114074
113878
|
if (!virtualCode) return;
|
|
114075
|
-
const sourceFile = virtualCode.
|
|
113879
|
+
const sourceFile = virtualCode.ir.scriptSetup?.ast;
|
|
114076
113880
|
if (!sourceFile) return;
|
|
114077
113881
|
const scriptSetupRanges = core.parseScriptSetupRanges(ts, sourceFile, virtualCode.vueCompilerOptions);
|
|
114078
113882
|
if (scriptSetupRanges) return collectPropDefaultsFromScriptSetup(ts, printer, sourceFile, scriptSetupRanges);
|
|
@@ -114384,11 +114188,14 @@ var require_schemaResolvers = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
114384
114188
|
const fileName = declaration.getSourceFile().fileName;
|
|
114385
114189
|
const sourceScript = getSourceScript(fileName);
|
|
114386
114190
|
if (sourceScript?.generated) {
|
|
114387
|
-
const
|
|
114388
|
-
if (
|
|
114389
|
-
|
|
114390
|
-
|
|
114391
|
-
|
|
114191
|
+
const serviceScript = sourceScript.generated.languagePlugin.typescript?.getServiceScript(sourceScript.generated.root);
|
|
114192
|
+
if (serviceScript) {
|
|
114193
|
+
const map = language.maps.get(serviceScript.code, sourceScript);
|
|
114194
|
+
for (const [start] of map.toSourceLocation(declaration.getStart())) for (const [end] of map.toSourceLocation(declaration.getEnd())) return {
|
|
114195
|
+
file: String(sourceScript.id),
|
|
114196
|
+
range: [start, end]
|
|
114197
|
+
};
|
|
114198
|
+
}
|
|
114392
114199
|
return;
|
|
114393
114200
|
}
|
|
114394
114201
|
return {
|
|
@@ -114588,17 +114395,56 @@ var require_getComponentNames = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
114588
114395
|
exports.getComponentNames = getComponentNames;
|
|
114589
114396
|
var language_core_1 = require_language_core();
|
|
114590
114397
|
var utils_1 = require_utils();
|
|
114591
|
-
function getComponentNames(ts, program,
|
|
114592
|
-
const sourceFile = program.getSourceFile(fileName);
|
|
114398
|
+
function getComponentNames(ts, program, virtualCode) {
|
|
114399
|
+
const sourceFile = program.getSourceFile(virtualCode.fileName);
|
|
114593
114400
|
if (!sourceFile) return [];
|
|
114594
114401
|
const checker = program.getTypeChecker();
|
|
114595
114402
|
const componentNames = (0, utils_1.getVariableType)(ts, checker, sourceFile, language_core_1.names.components)?.type.getProperties().map((c) => c.name).filter((entry) => !entry.includes("$") && !entry.startsWith("_")) ?? [];
|
|
114596
|
-
componentNames.push((0, utils_1.getSelfComponentName)(fileName));
|
|
114597
|
-
componentNames.push(...language_core_1.tsCodegen.get(
|
|
114403
|
+
componentNames.push((0, utils_1.getSelfComponentName)(virtualCode.fileName));
|
|
114404
|
+
componentNames.push(...language_core_1.tsCodegen.get(virtualCode.ir)?.getImportedComponents() ?? []);
|
|
114598
114405
|
return [...new Set(componentNames)];
|
|
114599
114406
|
}
|
|
114600
114407
|
}));
|
|
114601
114408
|
//#endregion
|
|
114409
|
+
//#region node_modules/@vue/typescript-plugin/lib/requests/getComponentProps.js
|
|
114410
|
+
var require_getComponentProps = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
114411
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
114412
|
+
exports.getComponentProps = getComponentProps;
|
|
114413
|
+
var transform_1 = require_transform$1();
|
|
114414
|
+
var language_core_1 = require_language_core();
|
|
114415
|
+
var utils_1 = require_utils();
|
|
114416
|
+
function getComponentProps(ts, tsLanguageService, program, language, sourceScript, virtualCode, position) {
|
|
114417
|
+
const serviceScript = sourceScript.generated.languagePlugin.typescript?.getServiceScript(virtualCode);
|
|
114418
|
+
if (!serviceScript) return [];
|
|
114419
|
+
const { ir } = virtualCode;
|
|
114420
|
+
if (!ir.template?.ast) return [];
|
|
114421
|
+
let node;
|
|
114422
|
+
for (const child of (0, language_core_1.forEachElementNode)(ir.template.ast)) if (position >= child.loc.start.offset) node = child;
|
|
114423
|
+
if (node?.tagType !== 1) return [];
|
|
114424
|
+
let position2;
|
|
114425
|
+
if (node.props.some((prop) => position >= prop.loc.start.offset && position <= prop.loc.end.offset)) position2 = (0, transform_1.toGeneratedOffset)(language, serviceScript, sourceScript, ir.template.startTagEnd + position - (ir.template.content[position - 1] === "-" ? 1 : 0), (data) => !!data.__propsCompletion);
|
|
114426
|
+
position2 ??= (0, transform_1.toGeneratedOffset)(language, serviceScript, sourceScript, ir.template.startTagEnd + node.loc.start.offset, (data) => !!data.__propsCompletion);
|
|
114427
|
+
if (!position2) return [];
|
|
114428
|
+
const completion = tsLanguageService.getCompletionsAtPosition(virtualCode.fileName, position2, { includeSymbol: true });
|
|
114429
|
+
if (!completion?.isMemberCompletion) return [];
|
|
114430
|
+
const props = [];
|
|
114431
|
+
const checker = program.getTypeChecker();
|
|
114432
|
+
for (const entry of completion.entries) {
|
|
114433
|
+
if (entry.isFromUncheckedFile) continue;
|
|
114434
|
+
const modifiers = entry.kindModifiers?.split(",");
|
|
114435
|
+
const type = entry.symbol && checker.getTypeOfSymbol(entry.symbol);
|
|
114436
|
+
const info = {
|
|
114437
|
+
name: entry.name.startsWith("\"") && entry.name.endsWith("\"") ? entry.name.slice(1, -1) : entry.name,
|
|
114438
|
+
description: entry.symbol && (ts.displayPartsToString(entry.symbol.getDocumentationComment(checker)) + "\n\n" + entry.symbol.getJsDocTags(checker).map((tag) => `*@${tag.name}*${tag.text?.length ? ` — ${ts.displayPartsToString(tag.text)}` : ""}`).join("\n\n")).trimEnd()
|
|
114439
|
+
};
|
|
114440
|
+
if (modifiers?.includes("optional")) info.optional = true;
|
|
114441
|
+
if (type && (0, utils_1.hasBooleanType)(ts, type)) info.boolean = true;
|
|
114442
|
+
props.push(info);
|
|
114443
|
+
}
|
|
114444
|
+
return props;
|
|
114445
|
+
}
|
|
114446
|
+
}));
|
|
114447
|
+
//#endregion
|
|
114602
114448
|
//#region node_modules/@vue/typescript-plugin/lib/requests/getComponentSlots.js
|
|
114603
114449
|
var require_getComponentSlots = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
114604
114450
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -114606,7 +114452,7 @@ var require_getComponentSlots = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
114606
114452
|
var language_core_1 = require_language_core();
|
|
114607
114453
|
var utils_1 = require_utils();
|
|
114608
114454
|
function getComponentSlots(ts, program, virtualCode) {
|
|
114609
|
-
const codegen = language_core_1.tsCodegen.get(virtualCode.
|
|
114455
|
+
const codegen = language_core_1.tsCodegen.get(virtualCode.ir);
|
|
114610
114456
|
if (!codegen) return [];
|
|
114611
114457
|
const sourceFile = program.getSourceFile(virtualCode.fileName);
|
|
114612
114458
|
if (!sourceFile) return [];
|
|
@@ -114632,10 +114478,11 @@ var require_getElementAttrs = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
114632
114478
|
if (!elements) return [];
|
|
114633
114479
|
const elementType = elements.type.getProperty(tag);
|
|
114634
114480
|
if (!elementType) return [];
|
|
114635
|
-
return checker.getTypeOfSymbol(elementType).getProperties().map((
|
|
114636
|
-
name:
|
|
114637
|
-
|
|
114638
|
-
|
|
114481
|
+
return checker.getTypeOfSymbol(elementType).getProperties().map((prop) => {
|
|
114482
|
+
const info = { name: prop.name };
|
|
114483
|
+
if ((0, utils_1.hasBooleanType)(ts, checker.getTypeOfSymbol(prop))) info.boolean = true;
|
|
114484
|
+
return info;
|
|
114485
|
+
});
|
|
114639
114486
|
}
|
|
114640
114487
|
}));
|
|
114641
114488
|
//#endregion
|
|
@@ -114674,35 +114521,23 @@ var require_getImportPathForFile = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
114674
114521
|
var require_isRefAtPosition = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
114675
114522
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
114676
114523
|
exports.isRefAtPosition = isRefAtPosition;
|
|
114524
|
+
var transform_1 = require_transform$1();
|
|
114677
114525
|
var language_core_1 = require_language_core();
|
|
114678
|
-
|
|
114526
|
+
var utils_1 = require_utils();
|
|
114527
|
+
function isRefAtPosition(ts, language, program, sourceScript, virtualCode, position) {
|
|
114679
114528
|
const serviceScript = sourceScript.generated.languagePlugin.typescript?.getServiceScript(virtualCode);
|
|
114680
114529
|
if (!serviceScript) return false;
|
|
114681
|
-
|
|
114682
|
-
|
|
114683
|
-
for (const [position2, mapping] of map.toGeneratedLocation(position)) if ((0, language_core_1.isCompletionEnabled)(mapping.data)) {
|
|
114684
|
-
position = position2;
|
|
114685
|
-
mapped = true;
|
|
114686
|
-
break;
|
|
114687
|
-
}
|
|
114688
|
-
if (mapped) break;
|
|
114689
|
-
}
|
|
114690
|
-
if (!mapped) return false;
|
|
114530
|
+
const position2 = (0, transform_1.toGeneratedOffset)(language, serviceScript, sourceScript, position, language_core_1.isCompletionEnabled);
|
|
114531
|
+
if (!position2) return false;
|
|
114691
114532
|
const sourceFile = program.getSourceFile(virtualCode.fileName);
|
|
114692
114533
|
if (!sourceFile) return false;
|
|
114693
|
-
|
|
114534
|
+
let node;
|
|
114535
|
+
for (const child of (0, utils_1.forEachTouchingNode)(ts, sourceFile, position2)) if (ts.isIdentifier(child)) {
|
|
114536
|
+
node = child;
|
|
114537
|
+
break;
|
|
114538
|
+
}
|
|
114694
114539
|
if (!node) return false;
|
|
114695
114540
|
return program.getTypeChecker().getTypeAtLocation(node).getProperties().some((prop) => prop.declarations?.some((decl) => ts.isPropertySignature(decl) && ts.isComputedPropertyName(decl.name) && ts.isIdentifier(decl.name.expression) && decl.name.expression.text === "RefSymbol"));
|
|
114696
|
-
function findPositionIdentifier(sourceFile, node, offset) {
|
|
114697
|
-
let result;
|
|
114698
|
-
node.forEachChild((child) => {
|
|
114699
|
-
if (!result) {
|
|
114700
|
-
if (child.end === offset && ts.isIdentifier(child)) result = child;
|
|
114701
|
-
else if (child.end >= offset && child.getStart(sourceFile) < offset) result = findPositionIdentifier(sourceFile, child, offset);
|
|
114702
|
-
}
|
|
114703
|
-
});
|
|
114704
|
-
return result;
|
|
114705
|
-
}
|
|
114706
114541
|
}
|
|
114707
114542
|
}));
|
|
114708
114543
|
//#endregion
|
|
@@ -263536,6 +263371,101 @@ var require_out = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
263536
263371
|
exports.createLanguageService = createLanguageService;
|
|
263537
263372
|
}));
|
|
263538
263373
|
//#endregion
|
|
263374
|
+
//#region node_modules/volar-service-typescript/lib/configs/getUserPreferences.js
|
|
263375
|
+
var require_getUserPreferences = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
263376
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
263377
|
+
exports.getUserPreferences = getUserPreferences;
|
|
263378
|
+
var path = require_path_browserify();
|
|
263379
|
+
var vscode_uri_1 = require_umd();
|
|
263380
|
+
var shared_1 = require_shared();
|
|
263381
|
+
async function getUserPreferences(ctx, document) {
|
|
263382
|
+
let currentDirectory = "";
|
|
263383
|
+
if (ctx.project.typescript) currentDirectory = ctx.project.typescript.languageServiceHost.getCurrentDirectory();
|
|
263384
|
+
const uri = vscode_uri_1.URI.parse(document.uri);
|
|
263385
|
+
const documentUri = ctx.decodeEmbeddedDocumentUri(uri)?.[0] ?? uri;
|
|
263386
|
+
const config = await ctx.env.getConfiguration?.((0, shared_1.getConfigTitle)(document)) ?? {};
|
|
263387
|
+
const preferencesConfig = config?.preferences ?? {};
|
|
263388
|
+
return {
|
|
263389
|
+
...config.unstable ?? {},
|
|
263390
|
+
quotePreference: getQuoteStylePreference(preferencesConfig),
|
|
263391
|
+
importModuleSpecifierPreference: getImportModuleSpecifierPreference(preferencesConfig),
|
|
263392
|
+
importModuleSpecifierEnding: getImportModuleSpecifierEndingPreference(preferencesConfig),
|
|
263393
|
+
jsxAttributeCompletionStyle: getJsxAttributeCompletionStyle(preferencesConfig),
|
|
263394
|
+
allowTextChangesInNewFiles: documentUri.scheme === "file",
|
|
263395
|
+
providePrefixAndSuffixTextForRename: (preferencesConfig.renameShorthandProperties ?? true) === false ? false : preferencesConfig.useAliasesForRenames ?? true,
|
|
263396
|
+
allowRenameOfImportPath: true,
|
|
263397
|
+
includeAutomaticOptionalChainCompletions: config.suggest?.includeAutomaticOptionalChainCompletions ?? true,
|
|
263398
|
+
provideRefactorNotApplicableReason: true,
|
|
263399
|
+
generateReturnInDocTemplate: config.suggest?.jsdoc?.generateReturns ?? true,
|
|
263400
|
+
includeCompletionsForImportStatements: config.suggest?.includeCompletionsForImportStatements ?? true,
|
|
263401
|
+
includeCompletionsWithSnippetText: config.suggest?.includeCompletionsWithSnippetText ?? true,
|
|
263402
|
+
includeCompletionsWithClassMemberSnippets: config.suggest?.classMemberSnippets?.enabled ?? true,
|
|
263403
|
+
includeCompletionsWithObjectLiteralMethodSnippets: config.suggest?.objectLiteralMethodSnippets?.enabled ?? true,
|
|
263404
|
+
autoImportFileExcludePatterns: getAutoImportFileExcludePatternsPreference(preferencesConfig, currentDirectory),
|
|
263405
|
+
autoImportSpecifierExcludeRegexes: preferencesConfig.autoImportSpecifierExcludeRegexes,
|
|
263406
|
+
useLabelDetailsInCompletionEntries: true,
|
|
263407
|
+
allowIncompleteCompletions: true,
|
|
263408
|
+
displayPartsForJSDoc: true,
|
|
263409
|
+
includeInlayParameterNameHints: getInlayParameterNameHintsPreference(config),
|
|
263410
|
+
includeInlayParameterNameHintsWhenArgumentMatchesName: !(config.inlayHints?.parameterNames?.suppressWhenArgumentMatchesName ?? true),
|
|
263411
|
+
includeInlayFunctionParameterTypeHints: config.inlayHints?.parameterTypes?.enabled ?? false,
|
|
263412
|
+
includeInlayVariableTypeHints: config.inlayHints?.variableTypes?.enabled ?? false,
|
|
263413
|
+
includeInlayVariableTypeHintsWhenTypeMatchesName: !(config.inlayHints?.variableTypes?.suppressWhenTypeMatchesName ?? true),
|
|
263414
|
+
includeInlayPropertyDeclarationTypeHints: config.inlayHints?.propertyDeclarationTypes?.enabled ?? false,
|
|
263415
|
+
includeInlayFunctionLikeReturnTypeHints: config.inlayHints?.functionLikeReturnTypes?.enabled ?? false,
|
|
263416
|
+
includeInlayEnumMemberValueHints: config.inlayHints?.enumMemberValues?.enabled ?? false,
|
|
263417
|
+
includeCompletionsForModuleExports: config.suggest?.autoImports ?? true,
|
|
263418
|
+
includeCompletionsWithInsertText: true,
|
|
263419
|
+
includePackageJsonAutoImports: preferencesConfig.includePackageJsonAutoImports ?? "auto"
|
|
263420
|
+
};
|
|
263421
|
+
}
|
|
263422
|
+
function getQuoteStylePreference(config) {
|
|
263423
|
+
switch (config.quoteStyle) {
|
|
263424
|
+
case "single": return "single";
|
|
263425
|
+
case "double": return "double";
|
|
263426
|
+
default: return "auto";
|
|
263427
|
+
}
|
|
263428
|
+
}
|
|
263429
|
+
function getAutoImportFileExcludePatternsPreference(config, workspacePath) {
|
|
263430
|
+
if (workspacePath) return config.autoImportFileExcludePatterns?.map((p) => {
|
|
263431
|
+
const slashNormalized = p.replace(/\\/g, "/");
|
|
263432
|
+
const isRelative = /^\.\.?($|\/)/.test(slashNormalized);
|
|
263433
|
+
return path.isAbsolute(p) ? p : p.startsWith("*") ? "/" + slashNormalized : isRelative ? path.join(workspacePath, p) : "/**/" + slashNormalized;
|
|
263434
|
+
});
|
|
263435
|
+
}
|
|
263436
|
+
function getImportModuleSpecifierPreference(config) {
|
|
263437
|
+
switch (config.importModuleSpecifier) {
|
|
263438
|
+
case "project-relative": return "project-relative";
|
|
263439
|
+
case "relative": return "relative";
|
|
263440
|
+
case "non-relative": return "non-relative";
|
|
263441
|
+
default: return;
|
|
263442
|
+
}
|
|
263443
|
+
}
|
|
263444
|
+
function getImportModuleSpecifierEndingPreference(config) {
|
|
263445
|
+
switch (config.importModuleSpecifierEnding) {
|
|
263446
|
+
case "minimal": return "minimal";
|
|
263447
|
+
case "index": return "index";
|
|
263448
|
+
case "js": return "js";
|
|
263449
|
+
default: return "minimal";
|
|
263450
|
+
}
|
|
263451
|
+
}
|
|
263452
|
+
function getJsxAttributeCompletionStyle(config) {
|
|
263453
|
+
switch (config.jsxAttributeCompletionStyle) {
|
|
263454
|
+
case "braces": return "braces";
|
|
263455
|
+
case "none": return "none";
|
|
263456
|
+
default: return "auto";
|
|
263457
|
+
}
|
|
263458
|
+
}
|
|
263459
|
+
function getInlayParameterNameHintsPreference(config) {
|
|
263460
|
+
switch (config.inlayHints?.parameterNames?.enabled) {
|
|
263461
|
+
case "none": return "none";
|
|
263462
|
+
case "literals": return "literals";
|
|
263463
|
+
case "all": return "all";
|
|
263464
|
+
default: return;
|
|
263465
|
+
}
|
|
263466
|
+
}
|
|
263467
|
+
}));
|
|
263468
|
+
//#endregion
|
|
263539
263469
|
//#region node_modules/volar-service-typescript/lib/utils/fixNames.js
|
|
263540
263470
|
var require_fixNames = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
263541
263471
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -269755,6 +269685,7 @@ var import_collectExtractProps = require_collectExtractProps();
|
|
|
269755
269685
|
var import_getComponentDirectives = require_getComponentDirectives();
|
|
269756
269686
|
var import_getComponentMeta = require_getComponentMeta();
|
|
269757
269687
|
var import_getComponentNames = require_getComponentNames();
|
|
269688
|
+
var import_getComponentProps = require_getComponentProps();
|
|
269758
269689
|
var import_getComponentSlots = require_getComponentSlots();
|
|
269759
269690
|
var import_getElementAttrs = require_getElementAttrs();
|
|
269760
269691
|
var import_getElementNames = require_getElementNames();
|
|
@@ -269807,10 +269738,10 @@ var asFileName = ({ path }) => path, asUri = (fileName) => URI$1.file(fileName),
|
|
|
269807
269738
|
asFileName,
|
|
269808
269739
|
asUri
|
|
269809
269740
|
}, useContext = (fileName, { languageService: { context } }) => {
|
|
269810
|
-
const { language } = context;
|
|
269811
|
-
const languageServiceHost = context.inject("typescript/languageServiceHost"), program = context.inject("typescript/languageService").getProgram(), sourceScript = language.scripts.get(asUri(fileName));
|
|
269741
|
+
const languageService = context.inject("typescript/languageService"), languageServiceHost = context.inject("typescript/languageServiceHost"), program = languageService.getProgram(), { language } = context, sourceScript = language.scripts.get(asUri(fileName));
|
|
269812
269742
|
return {
|
|
269813
269743
|
language,
|
|
269744
|
+
languageService,
|
|
269814
269745
|
languageServiceHost,
|
|
269815
269746
|
program,
|
|
269816
269747
|
sourceScript,
|
|
@@ -269870,6 +269801,10 @@ self.onmessage = () => {
|
|
|
269870
269801
|
const { program, virtualCode } = useContext(fileName, workerLanguageService);
|
|
269871
269802
|
return virtualCode && (0, import_getComponentNames.getComponentNames)(import_typescript.default, program, virtualCode);
|
|
269872
269803
|
},
|
|
269804
|
+
getComponentProps: (fileName, position) => {
|
|
269805
|
+
const { language, languageService, program, sourceScript, virtualCode } = useContext(fileName, workerLanguageService);
|
|
269806
|
+
return virtualCode && sourceScript && (0, import_getComponentProps.getComponentProps)(import_typescript.default, languageService, program, language, sourceScript, virtualCode, position);
|
|
269807
|
+
},
|
|
269873
269808
|
getComponentSlots(fileName) {
|
|
269874
269809
|
const { program, virtualCode } = useContext(fileName, workerLanguageService);
|
|
269875
269810
|
return virtualCode && (0, import_getComponentSlots.getComponentSlots)(import_typescript.default, program, virtualCode);
|
|
@@ -269884,8 +269819,8 @@ self.onmessage = () => {
|
|
|
269884
269819
|
return (0, import_getElementNames.getElementNames)(import_typescript.default, program, fileName);
|
|
269885
269820
|
},
|
|
269886
269821
|
getEncodedSemanticClassifications: () => void 0,
|
|
269887
|
-
getImportPathForFile: (fileName, incomingFileName
|
|
269888
|
-
const { languageServiceHost, program } = useContext(fileName, workerLanguageService);
|
|
269822
|
+
getImportPathForFile: (fileName, incomingFileName) => {
|
|
269823
|
+
const preferences = {}, { languageServiceHost, program } = useContext(fileName, workerLanguageService);
|
|
269889
269824
|
return (0, import_getImportPathForFile.getImportPathForFile)(import_typescript.default, languageServiceHost, program, fileName, incomingFileName, preferences);
|
|
269890
269825
|
},
|
|
269891
269826
|
getQuickInfoAtPosition: async (fileName, position) => {
|