@vue/language-core 3.2.0 → 3.2.2

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.
@@ -20,7 +20,6 @@ export declare const TemplateRefs = "__VLS_TemplateRefs";
20
20
  export declare const RootEl = "__VLS_RootEl";
21
21
  export declare const ModelEmit = "__VLS_ModelEmit";
22
22
  export declare const EmitProps = "__VLS_EmitProps";
23
- export declare const InternalProps = "__VLS_InternalProps";
24
23
  export declare const Emit = "__VLS_Emit";
25
24
  export declare const SetupExposed = "__VLS_SetupExposed";
26
25
  export declare const PublicProps = "__VLS_PublicProps";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StyleModules = exports.PublicProps = exports.SetupExposed = exports.Emit = exports.InternalProps = exports.EmitProps = exports.ModelEmit = exports.RootEl = exports.TemplateRefs = exports.InheritedAttrs = exports.Slots = exports.Props = exports.ModelProps = exports._export = exports.intrinsics = exports.directives = exports.components = exports.setup = exports.exposed = exports.emit = exports.modelEmit = exports.defaultModels = exports.defaults = exports.props = exports.slots = exports.dollars = exports.ctx = void 0;
3
+ exports.StyleModules = exports.PublicProps = exports.SetupExposed = exports.Emit = exports.EmitProps = exports.ModelEmit = exports.RootEl = exports.TemplateRefs = exports.InheritedAttrs = exports.Slots = exports.Props = exports.ModelProps = exports._export = exports.intrinsics = exports.directives = exports.components = exports.setup = exports.exposed = exports.emit = exports.modelEmit = exports.defaultModels = exports.defaults = exports.props = exports.slots = exports.dollars = exports.ctx = void 0;
4
4
  exports.ctx = '__VLS_ctx';
5
5
  exports.dollars = '__VLS_dollars';
6
6
  exports.slots = '__VLS_slots';
@@ -23,7 +23,6 @@ exports.TemplateRefs = '__VLS_TemplateRefs';
23
23
  exports.RootEl = '__VLS_RootEl';
24
24
  exports.ModelEmit = '__VLS_ModelEmit';
25
25
  exports.EmitProps = '__VLS_EmitProps';
26
- exports.InternalProps = '__VLS_InternalProps';
27
26
  exports.Emit = '__VLS_Emit';
28
27
  exports.SetupExposed = '__VLS_SetupExposed';
29
28
  exports.PublicProps = '__VLS_PublicProps';
@@ -84,9 +84,8 @@ function* generateTemplateCtx({ vueCompilerOptions, templateAndStyleTypes, scrip
84
84
  propTypes.push(names.EmitProps);
85
85
  }
86
86
  if (propTypes.length) {
87
- yield `type ${names.InternalProps} = ${propTypes.join(` & `)}${utils_1.endOfLine}`;
88
- exps.push([`{} as { $props: ${names.InternalProps} }`]);
89
- exps.push([`{} as ${names.InternalProps}`]);
87
+ exps.push([`{} as { $props: ${propTypes.join(` & `)} }`]);
88
+ exps.push([`{} as ${propTypes.join(` & `)}`]);
90
89
  }
91
90
  if (ctx.generatedTypes.has(names.SetupExposed)) {
92
91
  exps.push([`{} as ${names.SetupExposed}`]);
@@ -58,6 +58,7 @@ function* generateComponent(options, ctx, node) {
58
58
  let { tag, props } = node;
59
59
  let [startTagOffset, endTagOffset] = (0, shared_2.getElementTagOffsets)(node, options.template);
60
60
  let isExpression = false;
61
+ let isIsShorthand = false;
61
62
  if (tag.includes('.')) {
62
63
  isExpression = true;
63
64
  }
@@ -67,7 +68,8 @@ function* generateComponent(options, ctx, node) {
67
68
  && prop.name === 'bind'
68
69
  && prop.arg?.loc.source === 'is'
69
70
  && prop.exp?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION) {
70
- if (prop.arg.loc.end.offset === prop.exp.loc.end.offset) {
71
+ isIsShorthand = prop.arg.loc.end.offset === prop.exp.loc.end.offset;
72
+ if (isIsShorthand) {
71
73
  ctx.inlayHints.push((0, inlayHints_1.createVBindShorthandInlayHintInfo)(prop.exp.loc, 'is'));
72
74
  }
73
75
  isExpression = true;
@@ -82,7 +84,9 @@ function* generateComponent(options, ctx, node) {
82
84
  const componentVar = ctx.getInternalVariable();
83
85
  if (isExpression) {
84
86
  yield `const ${componentVar} = `;
85
- yield* (0, interpolation_1.generateInterpolation)(options, ctx, options.template, codeFeatures_1.codeFeatures.all, tag, startTagOffset, `(`, `)`);
87
+ yield* (0, interpolation_1.generateInterpolation)(options, ctx, options.template, isIsShorthand
88
+ ? codeFeatures_1.codeFeatures.withoutHighlightAndCompletion
89
+ : codeFeatures_1.codeFeatures.all, tag, startTagOffset, `(`, `)`);
86
90
  if (endTagOffset !== undefined) {
87
91
  yield ` || `;
88
92
  yield* (0, interpolation_1.generateInterpolation)(options, ctx, options.template, codeFeatures_1.codeFeatures.withoutCompletion, tag, endTagOffset, `(`, `)`);
@@ -266,18 +270,9 @@ function* generateStyleScopedClassReferences({ template, typescript: ts }, node)
266
270
  if (prop.type === CompilerDOM.NodeTypes.ATTRIBUTE
267
271
  && prop.name === 'class'
268
272
  && prop.value) {
269
- if (template.lang === 'pug') {
270
- const getClassOffset = Reflect.get(prop.value.loc.start, 'getClassOffset');
271
- const content = prop.value.loc.source.slice(1, -1);
272
- for (const [className, pos] of forEachClassName(content)) {
273
- yield* (0, styleScopedClasses_1.generateStyleScopedClassReference)(template, className, getClassOffset(pos + 1));
274
- }
275
- }
276
- else {
277
- const [text, start] = (0, shared_2.normalizeAttributeValue)(prop.value);
278
- for (const [className, offset] of forEachClassName(text)) {
279
- yield* (0, styleScopedClasses_1.generateStyleScopedClassReference)(template, className, start + offset);
280
- }
273
+ const [text, start] = (0, shared_2.normalizeAttributeValue)(prop.value);
274
+ for (const [className, offset] of forEachClassName(text)) {
275
+ yield* (0, styleScopedClasses_1.generateStyleScopedClassReference)(template, className, start + offset);
281
276
  }
282
277
  }
283
278
  else if (prop.type === CompilerDOM.NodeTypes.DIRECTIVE
@@ -154,7 +154,16 @@ function* generateElementProps(options, ctx, node, props, strictPropsCheck, fail
154
154
  yield `...{ `;
155
155
  }
156
156
  const token = yield* (0, boundary_1.startBoundary)('template', prop.loc.start.offset, codeFeatures_1.codeFeatures.verification);
157
- yield* (0, objectProperty_1.generateObjectProperty)(options, ctx, prop.name, prop.loc.start.offset, features, shouldCamelize);
157
+ const prefix = options.template.content.slice(prop.loc.start.offset, prop.loc.start.offset + 1);
158
+ if (prefix === '.' || prefix === '#') {
159
+ // Pug shorthand syntax
160
+ for (const char of prop.name) {
161
+ yield [char, 'template', prop.loc.start.offset, features];
162
+ }
163
+ }
164
+ else {
165
+ yield* (0, objectProperty_1.generateObjectProperty)(options, ctx, prop.name, prop.loc.start.offset, features, shouldCamelize);
166
+ }
158
167
  yield `: `;
159
168
  if (prop.name === 'style') {
160
169
  yield `{}`;
@@ -121,7 +121,9 @@ function* generateSlotOutlet(options, ctx, node) {
121
121
  }
122
122
  const expVar = ctx.getInternalVariable();
123
123
  yield `var ${expVar} = __VLS_tryAsConstant(`;
124
- yield* (0, interpolation_1.generateInterpolation)(options, ctx, options.template, codeFeatures_1.codeFeatures.all, nameProp.exp.content, nameProp.exp.loc.start.offset);
124
+ yield* (0, interpolation_1.generateInterpolation)(options, ctx, options.template, isShortHand
125
+ ? codeFeatures_1.codeFeatures.withoutHighlightAndCompletion
126
+ : codeFeatures_1.codeFeatures.all, nameProp.exp.content, nameProp.exp.loc.start.offset);
125
127
  yield `)${utils_1.endOfLine}`;
126
128
  ctx.dynamicSlots.push({
127
129
  expVar: ctx.getHoistVariable(expVar),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/language-core",
3
- "version": "3.2.0",
3
+ "version": "3.2.2",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "**/*.js",
@@ -28,5 +28,5 @@
28
28
  "@volar/typescript": "2.4.27",
29
29
  "@vue/compiler-sfc": "^3.5.0"
30
30
  },
31
- "gitHead": "3138110d767d3d6110899bc46518b53c4b456271"
31
+ "gitHead": "17394f4e80c2267e8b7159468ab40c948ea37d65"
32
32
  }
@@ -108,7 +108,7 @@ declare global {
108
108
 
109
109
  function __VLS_vFor<T>(source: T): T extends number ? [number, number][]
110
110
  : T extends string ? [string, number][]
111
- : T extends any[] ? [T[number], number][]
111
+ : T extends (infer U)[] ? [U, number][]
112
112
  : T extends Iterable<infer V> ? [V, number][]
113
113
  : [T[keyof T], `${keyof T & (string | number)}`, number][];
114
114
  function __VLS_vSlot<S, D extends S>(slot: S, decl?: D): D extends (...args: infer P) => any ? P : any[];