@vue/language-core 3.2.1 → 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.
@@ -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.1",
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": "fad5a89205579e6a0902d7ee5bae3db7b510e2f4"
31
+ "gitHead": "17394f4e80c2267e8b7159468ab40c948ea37d65"
32
32
  }