@vue/language-core 3.1.4 → 3.1.5
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/lib/codegen/globalTypes.js +4 -3
- package/lib/codegen/script/component.js +1 -1
- package/lib/codegen/script/index.js +1 -1
- package/lib/codegen/script/scriptSetup.js +2 -2
- package/lib/codegen/script/src.js +1 -1
- package/lib/codegen/style/classProperty.js +1 -1
- package/lib/codegen/style/imports.js +1 -1
- package/lib/codegen/template/context.d.ts +3 -3
- package/lib/codegen/template/context.js +2 -2
- package/lib/codegen/template/element.js +30 -17
- package/lib/codegen/template/elementDirectives.js +5 -5
- package/lib/codegen/template/elementEvents.d.ts +1 -1
- package/lib/codegen/template/elementEvents.js +4 -8
- package/lib/codegen/template/elementProps.d.ts +2 -2
- package/lib/codegen/template/elementProps.js +38 -83
- package/lib/codegen/template/index.d.ts +3 -3
- package/lib/codegen/template/index.js +2 -2
- package/lib/codegen/template/interpolation.js +38 -39
- package/lib/codegen/template/objectProperty.js +1 -1
- package/lib/codegen/template/slotOutlet.js +5 -10
- package/lib/codegen/template/styleScopedClasses.js +8 -8
- package/lib/codegen/template/vSlot.js +3 -4
- package/lib/codegen/utils/index.d.ts +0 -2
- package/lib/codegen/utils/index.js +0 -11
- package/lib/codegen/utils/stringLiteralKey.js +1 -1
- package/lib/codegen/utils/unicode.js +1 -1
- package/lib/codegen/utils/wrapWith.d.ts +1 -2
- package/lib/codegen/utils/wrapWith.js +1 -10
- package/lib/compilerOptions.d.ts +2 -5
- package/lib/compilerOptions.js +43 -66
- package/lib/languagePlugin.js +16 -23
- package/lib/plugins/vue-template-html.js +12 -9
- package/lib/plugins/vue-template-inline-css.js +8 -14
- package/lib/plugins/vue-tsx.d.ts +3 -3
- package/lib/plugins/vue-tsx.js +0 -1
- package/lib/utils/parseSfc.js +5 -10
- package/lib/utils/shared.d.ts +1 -0
- package/lib/utils/shared.js +8 -0
- package/lib/virtualFile/computedSfc.d.ts +1 -1
- package/lib/virtualFile/computedSfc.js +6 -2
- package/package.json +2 -2
package/lib/plugins/vue-tsx.d.ts
CHANGED
|
@@ -180,10 +180,10 @@ export declare const tsCodegen: WeakMap<Sfc, {
|
|
|
180
180
|
offset: number;
|
|
181
181
|
}[]>;
|
|
182
182
|
currentComponent: {
|
|
183
|
-
ctxVar: string;
|
|
184
|
-
|
|
183
|
+
get ctxVar(): string;
|
|
184
|
+
get propsVar(): string;
|
|
185
185
|
} | undefined;
|
|
186
|
-
singleRootElTypes: string
|
|
186
|
+
singleRootElTypes: Set<string>;
|
|
187
187
|
singleRootNodes: Set<import("@vue/compiler-dom").ElementNode | null>;
|
|
188
188
|
addTemplateRef(name: string, typeExp: string, offset: number): void;
|
|
189
189
|
accessExternalVariable(name: string, offset?: number): void;
|
package/lib/plugins/vue-tsx.js
CHANGED
package/lib/utils/parseSfc.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parse = parse;
|
|
4
4
|
const CompilerDOM = require("@vue/compiler-dom");
|
|
5
|
+
const shared_1 = require("./shared");
|
|
5
6
|
function parse(source) {
|
|
6
7
|
const errors = [];
|
|
7
8
|
const ast = CompilerDOM.parse(source, {
|
|
@@ -137,17 +138,11 @@ function parseAttr(p, node) {
|
|
|
137
138
|
if (!p.value) {
|
|
138
139
|
return true;
|
|
139
140
|
}
|
|
140
|
-
const
|
|
141
|
-
const source = p.value.loc.source;
|
|
142
|
-
let offset = p.value.loc.start.offset - node.loc.start.offset;
|
|
143
|
-
const quotes = source.startsWith('"') || source.startsWith("'");
|
|
144
|
-
if (quotes) {
|
|
145
|
-
offset++;
|
|
146
|
-
}
|
|
141
|
+
const offset = (0, shared_1.getAttributeValueOffset)(p.value);
|
|
147
142
|
return {
|
|
148
|
-
text,
|
|
149
|
-
offset,
|
|
150
|
-
quotes,
|
|
143
|
+
text: p.value.content,
|
|
144
|
+
offset: offset - node.loc.start.offset,
|
|
145
|
+
quotes: offset > p.value.loc.start.offset,
|
|
151
146
|
};
|
|
152
147
|
}
|
|
153
148
|
//# sourceMappingURL=parseSfc.js.map
|
package/lib/utils/shared.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type * as ts from 'typescript';
|
|
|
3
3
|
import type { Sfc, TextRange } from '../types';
|
|
4
4
|
export { hyphenate as hyphenateTag } from '@vue/shared';
|
|
5
5
|
export declare function hyphenateAttr(str: string): string;
|
|
6
|
+
export declare function getAttributeValueOffset(node: CompilerDOM.TextNode): number;
|
|
6
7
|
export declare function getElementTagOffsets(node: CompilerDOM.ElementNode, template: NonNullable<Sfc['template']>): [number] | [number, number];
|
|
7
8
|
export declare function getStartEnd(ts: typeof import('typescript'), node: ts.Node, ast: ts.SourceFile): TextRange;
|
|
8
9
|
export declare function getNodeText(ts: typeof import('typescript'), node: ts.Node, ast: ts.SourceFile): string;
|
package/lib/utils/shared.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.hyphenateTag = void 0;
|
|
4
4
|
exports.hyphenateAttr = hyphenateAttr;
|
|
5
|
+
exports.getAttributeValueOffset = getAttributeValueOffset;
|
|
5
6
|
exports.getElementTagOffsets = getElementTagOffsets;
|
|
6
7
|
exports.getStartEnd = getStartEnd;
|
|
7
8
|
exports.getNodeText = getNodeText;
|
|
@@ -16,6 +17,13 @@ function hyphenateAttr(str) {
|
|
|
16
17
|
}
|
|
17
18
|
return hyphencase;
|
|
18
19
|
}
|
|
20
|
+
function getAttributeValueOffset(node) {
|
|
21
|
+
let offset = node.loc.start.offset;
|
|
22
|
+
if (node.loc.source.startsWith('"') || node.loc.source.startsWith("'")) {
|
|
23
|
+
offset++;
|
|
24
|
+
}
|
|
25
|
+
return offset;
|
|
26
|
+
}
|
|
19
27
|
function getElementTagOffsets(node, template) {
|
|
20
28
|
const tagOffsets = [
|
|
21
29
|
template.content.indexOf(node.tag, node.loc.start.offset),
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.templateInlineTsAsts = void 0;
|
|
4
4
|
exports.computedSfc = computedSfc;
|
|
5
|
+
const CompilerDOM = require("@vue/compiler-dom");
|
|
5
6
|
const alien_signals_1 = require("alien-signals");
|
|
6
7
|
const signals_1 = require("../utils/signals");
|
|
7
8
|
exports.templateInlineTsAsts = new WeakMap();
|
|
@@ -225,10 +226,13 @@ function computedSfc(ts, plugins, fileName, getSnapshot, getParseResult) {
|
|
|
225
226
|
}
|
|
226
227
|
const errors = [];
|
|
227
228
|
const warnings = [];
|
|
229
|
+
const [nodeTransforms, directiveTransforms] = CompilerDOM.getBaseTransformPreset();
|
|
228
230
|
let options = {
|
|
229
|
-
onError:
|
|
230
|
-
onWarn:
|
|
231
|
+
onError: err => errors.push(err),
|
|
232
|
+
onWarn: err => warnings.push(err),
|
|
231
233
|
expressionPlugins: ['typescript'],
|
|
234
|
+
nodeTransforms,
|
|
235
|
+
directiveTransforms,
|
|
232
236
|
};
|
|
233
237
|
for (const plugin of plugins) {
|
|
234
238
|
if (plugin.resolveTemplateCompilerOptions) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/language-core",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.5",
|
|
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": "d124a88fbf169e793c39ae4248da2092098de92d"
|
|
40
40
|
}
|