@vue/language-core 3.1.1 → 3.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -25,17 +25,14 @@ function generateGlobalTypes(options) {
|
|
|
25
25
|
const __VLS_directiveBindingRestFields: { instance: null, oldValue: null, modifiers: any, dir: any };
|
|
26
26
|
const __VLS_unref: typeof import('${lib}').unref;
|
|
27
27
|
const __VLS_placeholder: any;
|
|
28
|
+
const __VLS_intrinsics: ${target >= 3.3
|
|
29
|
+
? `import('${lib}/jsx-runtime').JSX.IntrinsicElements`
|
|
30
|
+
: `globalThis.JSX.IntrinsicElements`};
|
|
28
31
|
|
|
29
|
-
type
|
|
30
|
-
type __VLS_IntrinsicElements = ${target >= 3.3
|
|
31
|
-
? `import('${lib}/jsx-runtime').JSX.IntrinsicElements;`
|
|
32
|
-
: `globalThis.JSX.IntrinsicElements;`}
|
|
33
|
-
type __VLS_Element = ${target >= 3.3
|
|
34
|
-
? `import('${lib}/jsx-runtime').JSX.Element;`
|
|
35
|
-
: `globalThis.JSX.Element;`}
|
|
32
|
+
type __VLS_Elements = __VLS_SpreadMerge<SVGElementTagNameMap, HTMLElementTagNameMap>;
|
|
36
33
|
type __VLS_GlobalComponents = ${target >= 3.5
|
|
37
|
-
? `import('${lib}').GlobalComponents
|
|
38
|
-
: `import('${lib}').GlobalComponents & Pick<typeof import('${lib}'), 'Transition' | 'TransitionGroup' | 'KeepAlive' | 'Suspense' | 'Teleport'
|
|
34
|
+
? `import('${lib}').GlobalComponents`
|
|
35
|
+
: `import('${lib}').GlobalComponents & Pick<typeof import('${lib}'), 'Transition' | 'TransitionGroup' | 'KeepAlive' | 'Suspense' | 'Teleport'>`};
|
|
39
36
|
type __VLS_GlobalDirectives = import('${lib}').GlobalDirectives;
|
|
40
37
|
type __VLS_IsAny<T> = 0 extends 1 & T ? true : false;
|
|
41
38
|
type __VLS_PickNotAny<A, B> = __VLS_IsAny<A> extends true ? B : A;
|
|
@@ -57,7 +54,9 @@ function generateGlobalTypes(options) {
|
|
|
57
54
|
? K extends { __ctx?: { props?: infer P } } ? NonNullable<P> : never
|
|
58
55
|
: T extends (props: infer P, ...args: any) => any ? P
|
|
59
56
|
: {};
|
|
60
|
-
type __VLS_FunctionalComponent<T> = (props: ${fnPropsType}, ctx?: any) =>
|
|
57
|
+
type __VLS_FunctionalComponent<T> = (props: ${fnPropsType}, ctx?: any) => ${target >= 3.3
|
|
58
|
+
? `import('${lib}/jsx-runtime').JSX.Element`
|
|
59
|
+
: `globalThis.JSX.Element`} & {
|
|
61
60
|
__ctx?: {
|
|
62
61
|
attrs?: any;
|
|
63
62
|
slots?: T extends { $slots: infer Slots } ? Slots : Record<string, any>;
|
|
@@ -91,7 +91,7 @@ function* generatePropsOption(options, ctx, scriptSetup, scriptSetupRanges, hasE
|
|
|
91
91
|
if (options.templateCodegen?.inheritedAttrVars.size) {
|
|
92
92
|
let attrsType = `__VLS_InheritedAttrs`;
|
|
93
93
|
if (hasEmitsOption) {
|
|
94
|
-
attrsType = `Omit<${attrsType},
|
|
94
|
+
attrsType = `Omit<${attrsType}, keyof __VLS_EmitProps>`;
|
|
95
95
|
}
|
|
96
96
|
getOptionCodes.push(() => {
|
|
97
97
|
const propsType = `__VLS_PickNotAny<${ctx.localTypes.OmitIndexSignature}<${attrsType}>, {}>`;
|
|
@@ -65,7 +65,7 @@ function* generateScriptSetup(options, ctx, scriptSetup, scriptSetupRanges) {
|
|
|
65
65
|
emitTypes.push(`typeof __VLS_modelEmit`);
|
|
66
66
|
}
|
|
67
67
|
yield `return {} as {${utils_1.newLine}`
|
|
68
|
-
+ ` props: ${ctx.localTypes.PrettifyLocal}<${propTypes.join(` & `)}> & ${options.vueCompilerOptions.target >= 3.4
|
|
68
|
+
+ ` props: ${propTypes.length ? `${ctx.localTypes.PrettifyLocal}<${propTypes.join(` & `)}> & ` : ``}${options.vueCompilerOptions.target >= 3.4
|
|
69
69
|
? `import('${options.vueCompilerOptions.lib}').PublicProps`
|
|
70
70
|
: options.vueCompilerOptions.target >= 3
|
|
71
71
|
? `import('${options.vueCompilerOptions.lib}').VNodeProps`
|
|
@@ -15,7 +15,6 @@ function* generateTemplate(options, ctx) {
|
|
|
15
15
|
ctx.generatedTemplate = true;
|
|
16
16
|
yield* generateSelf(options);
|
|
17
17
|
yield* generateTemplateCtx(options, ctx);
|
|
18
|
-
yield* generateTemplateElements();
|
|
19
18
|
yield* generateTemplateComponents(options);
|
|
20
19
|
yield* generateTemplateDirectives(options);
|
|
21
20
|
yield* generateTemplateBody(options, ctx);
|
|
@@ -93,9 +92,6 @@ function* generateTemplateCtx(options, ctx) {
|
|
|
93
92
|
yield* (0, merge_1.generateSpreadMerge)(exps);
|
|
94
93
|
yield utils_1.endOfLine;
|
|
95
94
|
}
|
|
96
|
-
function* generateTemplateElements() {
|
|
97
|
-
yield `let __VLS_elements!: __VLS_IntrinsicElements${utils_1.endOfLine}`;
|
|
98
|
-
}
|
|
99
95
|
function* generateTemplateComponents(options) {
|
|
100
96
|
const types = [`typeof __VLS_ctx`];
|
|
101
97
|
if (options.sfc.script && options.scriptRanges?.componentOptions?.components) {
|
|
@@ -182,10 +182,10 @@ function* generateComponent(options, ctx, node) {
|
|
|
182
182
|
function* generateElement(options, ctx, node) {
|
|
183
183
|
const [startTagOffset, endTagOffset] = (0, shared_2.getElementTagOffsets)(node, options.template);
|
|
184
184
|
const failedPropExps = [];
|
|
185
|
-
yield `__VLS_asFunctionalElement(
|
|
185
|
+
yield `__VLS_asFunctionalElement(__VLS_intrinsics`;
|
|
186
186
|
yield* (0, propertyAccess_1.generatePropertyAccess)(options, ctx, node.tag, startTagOffset, codeFeatures_1.codeFeatures.withoutHighlightAndCompletion);
|
|
187
187
|
if (endTagOffset !== undefined) {
|
|
188
|
-
yield `,
|
|
188
|
+
yield `, __VLS_intrinsics`;
|
|
189
189
|
yield* (0, propertyAccess_1.generatePropertyAccess)(options, ctx, node.tag, endTagOffset, codeFeatures_1.codeFeatures.withoutHighlightAndCompletion);
|
|
190
190
|
}
|
|
191
191
|
yield `)(`;
|
|
@@ -195,17 +195,17 @@ function* generateElement(options, ctx, node) {
|
|
|
195
195
|
yield* (0, elementDirectives_1.generateElementDirectives)(options, ctx, node);
|
|
196
196
|
const reference = yield* generateElementReference(options, ctx, node);
|
|
197
197
|
if (reference) {
|
|
198
|
-
let typeExp = `
|
|
198
|
+
let typeExp = `__VLS_Elements['${node.tag}']`;
|
|
199
199
|
if (ctx.inVFor) {
|
|
200
200
|
typeExp += `[]`;
|
|
201
201
|
}
|
|
202
202
|
ctx.addTemplateRef(reference.name, typeExp, reference.offset);
|
|
203
203
|
}
|
|
204
204
|
if (ctx.singleRootNodes.has(node)) {
|
|
205
|
-
ctx.singleRootElTypes.push(`
|
|
205
|
+
ctx.singleRootElTypes.push(`__VLS_Elements['${node.tag}']`);
|
|
206
206
|
}
|
|
207
207
|
if (hasVBindAttrs(options, ctx, node)) {
|
|
208
|
-
ctx.inheritedAttrVars.add(`
|
|
208
|
+
ctx.inheritedAttrVars.add(`__VLS_intrinsics.${node.tag}`);
|
|
209
209
|
}
|
|
210
210
|
(0, styleScopedClasses_1.collectStyleScopedClassReferences)(options, ctx, node);
|
|
211
211
|
const { currentComponent } = ctx;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/language-core",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"optional": true
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "0d7edee43568f1d90adae6e8fcda0f7f565b3f6a"
|
|
40
40
|
}
|