@vue/language-core 3.0.0-alpha.6 → 3.0.0-alpha.8
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 +2 -5
- package/lib/codegen/localTypes.js +1 -2
- package/lib/codegen/script/index.js +1 -14
- package/lib/codegen/script/scriptSetup.js +3 -5
- package/lib/codegen/template/element.js +1 -3
- package/lib/codegen/template/elementProps.js +2 -6
- package/lib/codegen/template/index.js +2 -4
- package/lib/languagePlugin.js +1 -7
- package/lib/parsers/scriptRanges.d.ts +2 -3
- package/lib/parsers/scriptRanges.js +3 -10
- package/lib/plugins/file-md.js +3 -0
- package/lib/plugins/vue-tsx.d.ts +1 -2
- package/lib/plugins/vue-tsx.js +1 -1
- package/lib/types.d.ts +1 -1
- package/lib/utils/shared.d.ts +0 -1
- package/lib/utils/shared.js +0 -4
- package/lib/utils/ts.js +1 -3
- package/lib/virtualFile/computedSfc.js +4 -4
- package/package.json +4 -6
- package/lib/plugins/vue-style-css.d.ts +0 -3
- package/lib/plugins/vue-style-css.js +0 -18
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getGlobalTypesFileName = getGlobalTypesFileName;
|
|
4
4
|
exports.generateGlobalTypes = generateGlobalTypes;
|
|
5
|
-
const shared_1 = require("../utils/shared");
|
|
6
5
|
function getGlobalTypesFileName({ lib, target, checkUnknownProps, checkUnknownEvents, checkUnknownComponents, }) {
|
|
7
6
|
return [
|
|
8
7
|
lib,
|
|
@@ -62,7 +61,7 @@ function generateGlobalTypes({ lib, target, checkUnknownProps, checkUnknownEvent
|
|
|
62
61
|
type __VLS_FunctionalComponent<T> = (props: ${fnPropsType}, ctx?: any) => __VLS_Element & {
|
|
63
62
|
__ctx?: {
|
|
64
63
|
attrs?: any,
|
|
65
|
-
slots?: T extends { $
|
|
64
|
+
slots?: T extends { $slots: infer Slots } ? Slots : Record<string, any>,
|
|
66
65
|
emit?: T extends { $emit: infer Emit } ? Emit : {},
|
|
67
66
|
props?: ${fnPropsType},
|
|
68
67
|
expose?: (exposed: T) => void,
|
|
@@ -150,9 +149,7 @@ function generateGlobalTypes({ lib, target, checkUnknownProps, checkUnknownEvent
|
|
|
150
149
|
function __VLS_makeOptional<T>(t: T): { [K in keyof T]?: T[K] };
|
|
151
150
|
function __VLS_asFunctionalComponent<T, K = T extends new (...args: any) => any ? InstanceType<T> : unknown>(t: T, instance?: K):
|
|
152
151
|
T extends new (...args: any) => any ? __VLS_FunctionalComponent<K>
|
|
153
|
-
: T extends () => any ? (props: {}, ctx?: any) => ReturnType<T
|
|
154
|
-
? `: T extends import('${lib}').AsyncComponent ? (props: {}, ctx?: any) => any`
|
|
155
|
-
: ``)}
|
|
152
|
+
: T extends () => any ? (props: {}, ctx?: any) => ReturnType<T>
|
|
156
153
|
: T extends (...args: any) => any ? T
|
|
157
154
|
: __VLS_FunctionalComponent<{}>;
|
|
158
155
|
function __VLS_functionalComponentArgsRest<T extends (...args: any) => any>(t: T): 2 extends Parameters<T>['length'] ? [any] : [];
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getLocalTypesGenerator = getLocalTypesGenerator;
|
|
4
|
-
const shared_1 = require("../utils/shared");
|
|
5
4
|
const utils_1 = require("./utils");
|
|
6
5
|
function getLocalTypesGenerator(vueCompilerOptions) {
|
|
7
6
|
const used = new Set();
|
|
@@ -21,7 +20,7 @@ type __VLS_WithDefaults<P, D> = {
|
|
|
21
20
|
const WithSlots = defineHelper(`__VLS_WithSlots`, () => `
|
|
22
21
|
type __VLS_WithSlots<T, S> = T & {
|
|
23
22
|
new(): {
|
|
24
|
-
$
|
|
23
|
+
$slots: S;
|
|
25
24
|
${vueCompilerOptions.jsxSlots ? `$props: ${PropsChildren.name}<S>;` : ''}
|
|
26
25
|
}
|
|
27
26
|
};
|
|
@@ -36,7 +36,7 @@ function* generateScript(options) {
|
|
|
36
36
|
yield* (0, scriptSetup_1.generateScriptSetupImports)(options.sfc.scriptSetup, options.scriptSetupRanges);
|
|
37
37
|
}
|
|
38
38
|
if (options.sfc.script && options.scriptRanges) {
|
|
39
|
-
const { exportDefault
|
|
39
|
+
const { exportDefault } = options.scriptRanges;
|
|
40
40
|
const isExportRawObject = exportDefault
|
|
41
41
|
&& options.sfc.script.content[exportDefault.expression.start] === '{';
|
|
42
42
|
if (options.sfc.scriptSetup && options.scriptSetupRanges) {
|
|
@@ -77,19 +77,6 @@ function* generateScript(options) {
|
|
|
77
77
|
yield options.vueCompilerOptions.optionsWrapper[1];
|
|
78
78
|
yield (0, utils_1.generateSfcBlockSection)(options.sfc.script, exportDefault.expression.end, options.sfc.script.content.length, codeFeatures_1.codeFeatures.all);
|
|
79
79
|
}
|
|
80
|
-
else if (classBlockEnd !== undefined) {
|
|
81
|
-
if (options.vueCompilerOptions.skipTemplateCodegen) {
|
|
82
|
-
yield (0, utils_1.generateSfcBlockSection)(options.sfc.script, 0, options.sfc.script.content.length, codeFeatures_1.codeFeatures.all);
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
yield (0, utils_1.generateSfcBlockSection)(options.sfc.script, 0, classBlockEnd, codeFeatures_1.codeFeatures.all);
|
|
86
|
-
yield `__VLS_template = () => {${utils_1.newLine}`;
|
|
87
|
-
const templateCodegenCtx = yield* (0, template_1.generateTemplate)(options, ctx);
|
|
88
|
-
yield* (0, componentSelf_1.generateComponentSelf)(options, ctx, templateCodegenCtx);
|
|
89
|
-
yield `}${utils_1.endOfLine}`;
|
|
90
|
-
yield (0, utils_1.generateSfcBlockSection)(options.sfc.script, classBlockEnd, options.sfc.script.content.length, codeFeatures_1.codeFeatures.all);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
80
|
else {
|
|
94
81
|
yield (0, utils_1.generateSfcBlockSection)(options.sfc.script, 0, options.sfc.script.content.length, codeFeatures_1.codeFeatures.all);
|
|
95
82
|
yield* generateScriptSectionPartiallyEnding(options.sfc.script.name, options.sfc.script.content.length, '#3632/script.vue');
|
|
@@ -340,11 +340,9 @@ function* generateComponentProps(options, ctx, scriptSetup, scriptSetupRanges) {
|
|
|
340
340
|
yield `})${utils_1.endOfLine}`;
|
|
341
341
|
yield `type __VLS_BuiltInPublicProps = ${options.vueCompilerOptions.target >= 3.4
|
|
342
342
|
? `import('${options.vueCompilerOptions.lib}').PublicProps`
|
|
343
|
-
: options.vueCompilerOptions.
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
+ ` & import('${options.vueCompilerOptions.lib}').ComponentCustomProps`
|
|
347
|
-
: `globalThis.JSX.IntrinsicAttributes`}`;
|
|
343
|
+
: `import('${options.vueCompilerOptions.lib}').VNodeProps`
|
|
344
|
+
+ ` & import('${options.vueCompilerOptions.lib}').AllowedComponentProps`
|
|
345
|
+
+ ` & import('${options.vueCompilerOptions.lib}').ComponentCustomProps`}`;
|
|
348
346
|
yield utils_1.endOfLine;
|
|
349
347
|
yield `type __VLS_OwnProps = `;
|
|
350
348
|
yield `${ctx.localTypes.OmitKeepDiscriminatedUnion}<InstanceType<typeof __VLS_fnComponent>['$props'], keyof __VLS_BuiltInPublicProps>`;
|
|
@@ -103,9 +103,7 @@ function* generateComponent(options, ctx, node) {
|
|
|
103
103
|
else if (!isComponentTag) {
|
|
104
104
|
yield `const ${componentOriginalVar} = ({} as __VLS_WithComponent<'${getCanonicalComponentName(node.tag)}', __VLS_LocalComponents, `;
|
|
105
105
|
if (options.selfComponentName && possibleOriginalNames.includes(options.selfComponentName)) {
|
|
106
|
-
yield `typeof __VLS_self & (new () => {
|
|
107
|
-
+ (0, shared_2.getSlotsPropertyName)(options.vueCompilerOptions.target)
|
|
108
|
-
+ `: __VLS_Slots }), `;
|
|
106
|
+
yield `typeof __VLS_self & (new () => { $slots: __VLS_Slots }), `;
|
|
109
107
|
}
|
|
110
108
|
else {
|
|
111
109
|
yield `void, `;
|
|
@@ -111,11 +111,7 @@ function* generateElementProps(options, ctx, node, props, strictPropsCheck, enab
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
else if (prop.type === CompilerDOM.NodeTypes.ATTRIBUTE) {
|
|
114
|
-
if (options.vueCompilerOptions.dataAttributes.some(pattern => (0, minimatch_1.minimatch)(prop.name, pattern))
|
|
115
|
-
// Vue 2 Transition doesn't support "persisted" property but `@vue/compiler-dom` always adds it (#3881)
|
|
116
|
-
|| (options.vueCompilerOptions.target < 3
|
|
117
|
-
&& prop.name === 'persisted'
|
|
118
|
-
&& node.tag.toLowerCase() === 'transition')) {
|
|
114
|
+
if (options.vueCompilerOptions.dataAttributes.some(pattern => (0, minimatch_1.minimatch)(prop.name, pattern))) {
|
|
119
115
|
continue;
|
|
120
116
|
}
|
|
121
117
|
const shouldSpread = prop.name === 'style' || prop.name === 'class';
|
|
@@ -272,6 +268,6 @@ function getModelPropName(node, vueCompilerOptions) {
|
|
|
272
268
|
}
|
|
273
269
|
}
|
|
274
270
|
}
|
|
275
|
-
return
|
|
271
|
+
return 'modelValue';
|
|
276
272
|
}
|
|
277
273
|
//# sourceMappingURL=elementProps.js.map
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.generateTemplate = generateTemplate;
|
|
4
4
|
exports.forEachElementNode = forEachElementNode;
|
|
5
5
|
const CompilerDOM = require("@vue/compiler-dom");
|
|
6
|
-
const shared_1 = require("../../utils/shared");
|
|
7
6
|
const utils_1 = require("../utils");
|
|
8
7
|
const wrapWith_1 = require("../utils/wrapWith");
|
|
9
8
|
const context_1 = require("./context");
|
|
@@ -18,9 +17,8 @@ function* generateTemplate(options) {
|
|
|
18
17
|
if (options.propsAssignName) {
|
|
19
18
|
ctx.addLocalVariable(options.propsAssignName);
|
|
20
19
|
}
|
|
21
|
-
const slotsPropertyName = (0, shared_1.getSlotsPropertyName)(options.vueCompilerOptions.target);
|
|
22
20
|
if (options.vueCompilerOptions.inferTemplateDollarSlots) {
|
|
23
|
-
ctx.dollarVars.add(
|
|
21
|
+
ctx.dollarVars.add('$slots');
|
|
24
22
|
}
|
|
25
23
|
if (options.vueCompilerOptions.inferTemplateDollarAttrs) {
|
|
26
24
|
ctx.dollarVars.add('$attrs');
|
|
@@ -37,7 +35,7 @@ function* generateTemplate(options) {
|
|
|
37
35
|
yield* (0, styleScopedClasses_1.generateStyleScopedClassReferences)(ctx);
|
|
38
36
|
yield* ctx.generateHoistVariables();
|
|
39
37
|
const speicalTypes = [
|
|
40
|
-
[
|
|
38
|
+
['$slots', yield* generateSlots(options, ctx)],
|
|
41
39
|
['$attrs', yield* generateInheritedAttrs(options, ctx)],
|
|
42
40
|
['$refs', yield* generateTemplateRefs(options, ctx)],
|
|
43
41
|
['$el', yield* generateRootEl(ctx)]
|
package/lib/languagePlugin.js
CHANGED
|
@@ -6,7 +6,6 @@ exports.getAllExtensions = getAllExtensions;
|
|
|
6
6
|
const language_core_1 = require("@volar/language-core");
|
|
7
7
|
const CompilerDOM = require("@vue/compiler-dom");
|
|
8
8
|
const plugins_1 = require("./plugins");
|
|
9
|
-
const CompilerVue2 = require("./utils/vue2TemplateCompiler");
|
|
10
9
|
const vueFile_1 = require("./virtualFile/vueFile");
|
|
11
10
|
const fileRegistries = [];
|
|
12
11
|
function getVueFileRegistry(key, plugins) {
|
|
@@ -38,12 +37,7 @@ function getFileRegistryKey(compilerOptions, vueCompilerOptions, plugins) {
|
|
|
38
37
|
function createVueLanguagePlugin(ts, compilerOptions, vueCompilerOptions, asFileName) {
|
|
39
38
|
const pluginContext = {
|
|
40
39
|
modules: {
|
|
41
|
-
'@vue/compiler-dom':
|
|
42
|
-
? {
|
|
43
|
-
...CompilerDOM,
|
|
44
|
-
compile: CompilerVue2.compile,
|
|
45
|
-
}
|
|
46
|
-
: CompilerDOM,
|
|
40
|
+
'@vue/compiler-dom': CompilerDOM,
|
|
47
41
|
typescript: ts,
|
|
48
42
|
},
|
|
49
43
|
compilerOptions,
|
|
@@ -2,18 +2,17 @@ import type * as ts from 'typescript';
|
|
|
2
2
|
import type { TextRange } from '../types';
|
|
3
3
|
export interface ScriptRanges extends ReturnType<typeof parseScriptRanges> {
|
|
4
4
|
}
|
|
5
|
-
export declare function parseScriptRanges(ts: typeof import('typescript'), ast: ts.SourceFile, hasScriptSetup: boolean
|
|
5
|
+
export declare function parseScriptRanges(ts: typeof import('typescript'), ast: ts.SourceFile, hasScriptSetup: boolean): {
|
|
6
6
|
exportDefault: (TextRange & {
|
|
7
7
|
expression: TextRange;
|
|
8
8
|
args: TextRange;
|
|
9
|
-
argsNode: ts.ObjectLiteralExpression
|
|
9
|
+
argsNode: ts.ObjectLiteralExpression;
|
|
10
10
|
componentsOption: TextRange | undefined;
|
|
11
11
|
componentsOptionNode: ts.ObjectLiteralExpression | undefined;
|
|
12
12
|
directivesOption: TextRange | undefined;
|
|
13
13
|
nameOption: TextRange | undefined;
|
|
14
14
|
inheritAttrsOption: string | undefined;
|
|
15
15
|
}) | undefined;
|
|
16
|
-
classBlockEnd: number | undefined;
|
|
17
16
|
bindings: {
|
|
18
17
|
range: TextRange;
|
|
19
18
|
moduleName?: string;
|
|
@@ -3,9 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.parseScriptRanges = parseScriptRanges;
|
|
4
4
|
const shared_1 = require("../utils/shared");
|
|
5
5
|
const scriptSetupRanges_1 = require("./scriptSetupRanges");
|
|
6
|
-
function parseScriptRanges(ts, ast, hasScriptSetup
|
|
6
|
+
function parseScriptRanges(ts, ast, hasScriptSetup) {
|
|
7
7
|
let exportDefault;
|
|
8
|
-
let classBlockEnd;
|
|
9
8
|
const bindings = hasScriptSetup ? (0, scriptSetupRanges_1.parseBindingRanges)(ts, ast) : [];
|
|
10
9
|
ts.forEachChild(ast, raw => {
|
|
11
10
|
if (ts.isExportAssignment(raw)) {
|
|
@@ -49,24 +48,18 @@ function parseScriptRanges(ts, ast, hasScriptSetup, withNode) {
|
|
|
49
48
|
..._getStartEnd(raw),
|
|
50
49
|
expression: _getStartEnd(node.expression),
|
|
51
50
|
args: _getStartEnd(obj),
|
|
52
|
-
argsNode:
|
|
51
|
+
argsNode: obj,
|
|
53
52
|
componentsOption: componentsOptionNode ? _getStartEnd(componentsOptionNode) : undefined,
|
|
54
|
-
componentsOptionNode
|
|
53
|
+
componentsOptionNode,
|
|
55
54
|
directivesOption: directivesOptionNode ? _getStartEnd(directivesOptionNode) : undefined,
|
|
56
55
|
nameOption: nameOptionNode ? _getStartEnd(nameOptionNode) : undefined,
|
|
57
56
|
inheritAttrsOption,
|
|
58
57
|
};
|
|
59
58
|
}
|
|
60
59
|
}
|
|
61
|
-
if (ts.isClassDeclaration(raw)
|
|
62
|
-
&& raw.modifiers?.some(mod => mod.kind === ts.SyntaxKind.ExportKeyword)
|
|
63
|
-
&& raw.modifiers?.some(mod => mod.kind === ts.SyntaxKind.DefaultKeyword)) {
|
|
64
|
-
classBlockEnd = raw.end - 1;
|
|
65
|
-
}
|
|
66
60
|
});
|
|
67
61
|
return {
|
|
68
62
|
exportDefault,
|
|
69
|
-
classBlockEnd,
|
|
70
63
|
bindings,
|
|
71
64
|
};
|
|
72
65
|
function _getStartEnd(node) {
|
package/lib/plugins/file-md.js
CHANGED
|
@@ -4,6 +4,7 @@ const language_core_1 = require("@volar/language-core");
|
|
|
4
4
|
const muggle_string_1 = require("muggle-string");
|
|
5
5
|
const buildMappings_1 = require("../utils/buildMappings");
|
|
6
6
|
const parseSfc_1 = require("../utils/parseSfc");
|
|
7
|
+
const frontmatterReg = /^---[\s\S]*?\n---(?:\r?\n|$)/;
|
|
7
8
|
const codeblockReg = /(`{3,})[\s\S]+?\1/g;
|
|
8
9
|
const inlineCodeblockReg = /`[^\n`]+?`/g;
|
|
9
10
|
const latexBlockReg = /(\${2,})[\s\S]+?\1/g;
|
|
@@ -28,6 +29,8 @@ const plugin = ({ vueCompilerOptions }) => {
|
|
|
28
29
|
return;
|
|
29
30
|
}
|
|
30
31
|
content = content
|
|
32
|
+
// frontmatter
|
|
33
|
+
.replace(frontmatterReg, match => ' '.repeat(match.length))
|
|
31
34
|
// code block
|
|
32
35
|
.replace(codeblockReg, (match, quotes) => quotes + ' '.repeat(match.length - quotes.length * 2) + quotes)
|
|
33
36
|
// inline code block
|
package/lib/plugins/vue-tsx.d.ts
CHANGED
|
@@ -4,14 +4,13 @@ export declare const tsCodegen: WeakMap<Sfc, {
|
|
|
4
4
|
exportDefault: (import("../types").TextRange & {
|
|
5
5
|
expression: import("../types").TextRange;
|
|
6
6
|
args: import("../types").TextRange;
|
|
7
|
-
argsNode: import("typescript").ObjectLiteralExpression
|
|
7
|
+
argsNode: import("typescript").ObjectLiteralExpression;
|
|
8
8
|
componentsOption: import("../types").TextRange | undefined;
|
|
9
9
|
componentsOptionNode: import("typescript").ObjectLiteralExpression | undefined;
|
|
10
10
|
directivesOption: import("../types").TextRange | undefined;
|
|
11
11
|
nameOption: import("../types").TextRange | undefined;
|
|
12
12
|
inheritAttrsOption: string | undefined;
|
|
13
13
|
}) | undefined;
|
|
14
|
-
classBlockEnd: number | undefined;
|
|
15
14
|
bindings: {
|
|
16
15
|
range: import("../types").TextRange;
|
|
17
16
|
moduleName?: string;
|
package/lib/plugins/vue-tsx.js
CHANGED
|
@@ -81,7 +81,7 @@ function createTsx(fileName, sfc, ctx, appendGlobalTypes) {
|
|
|
81
81
|
return ctx.vueCompilerOptions;
|
|
82
82
|
});
|
|
83
83
|
const getScriptRanges = (0, alien_signals_1.computed)(() => sfc.script && validLangs.has(sfc.script.lang)
|
|
84
|
-
? (0, scriptRanges_1.parseScriptRanges)(ts, sfc.script.ast, !!sfc.scriptSetup
|
|
84
|
+
? (0, scriptRanges_1.parseScriptRanges)(ts, sfc.script.ast, !!sfc.scriptSetup)
|
|
85
85
|
: undefined);
|
|
86
86
|
const getScriptSetupRanges = (0, alien_signals_1.computed)(() => sfc.scriptSetup && validLangs.has(sfc.scriptSetup.lang)
|
|
87
87
|
? (0, scriptSetupRanges_1.parseScriptSetupRanges)(ts, sfc.scriptSetup.ast, getResolvedOptions())
|
package/lib/types.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export type { SFCParseResult } from '@vue/compiler-sfc';
|
|
|
8
8
|
export { VueEmbeddedCode };
|
|
9
9
|
export type RawVueCompilerOptions = Partial<Omit<VueCompilerOptions, 'target' | 'plugins'>> & {
|
|
10
10
|
strictTemplates?: boolean;
|
|
11
|
-
target?: 'auto' |
|
|
11
|
+
target?: 'auto' | 3 | 3.3 | 3.5 | 3.6 | 99 | number;
|
|
12
12
|
plugins?: string[];
|
|
13
13
|
};
|
|
14
14
|
export interface VueCodeInformation extends CodeInformation {
|
package/lib/utils/shared.d.ts
CHANGED
|
@@ -2,6 +2,5 @@ import type * as ts from 'typescript';
|
|
|
2
2
|
import type { TextRange } from '../types';
|
|
3
3
|
export { hyphenate as hyphenateTag } from '@vue/shared';
|
|
4
4
|
export declare function hyphenateAttr(str: string): string;
|
|
5
|
-
export declare function getSlotsPropertyName(vueVersion: number): "$scopedSlots" | "$slots";
|
|
6
5
|
export declare function getStartEnd(ts: typeof import('typescript'), node: ts.Node, ast: ts.SourceFile): TextRange;
|
|
7
6
|
export declare function getNodeText(ts: typeof import('typescript'), node: ts.Node, ast: ts.SourceFile): string;
|
package/lib/utils/shared.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.hyphenateTag = void 0;
|
|
4
4
|
exports.hyphenateAttr = hyphenateAttr;
|
|
5
|
-
exports.getSlotsPropertyName = getSlotsPropertyName;
|
|
6
5
|
exports.getStartEnd = getStartEnd;
|
|
7
6
|
exports.getNodeText = getNodeText;
|
|
8
7
|
const shared_1 = require("@vue/shared");
|
|
@@ -16,9 +15,6 @@ function hyphenateAttr(str) {
|
|
|
16
15
|
}
|
|
17
16
|
return hyphencase;
|
|
18
17
|
}
|
|
19
|
-
function getSlotsPropertyName(vueVersion) {
|
|
20
|
-
return vueVersion < 3 ? '$scopedSlots' : '$slots';
|
|
21
|
-
}
|
|
22
18
|
function getStartEnd(ts, node, ast) {
|
|
23
19
|
return {
|
|
24
20
|
start: ts.getTokenPosOfNode(node, ast),
|
package/lib/utils/ts.js
CHANGED
|
@@ -239,9 +239,7 @@ function getDefaultCompilerOptions(target = 99, lib = 'vue', strictTemplates = f
|
|
|
239
239
|
],
|
|
240
240
|
dataAttributes: [],
|
|
241
241
|
htmlAttributes: ['aria-*'],
|
|
242
|
-
optionsWrapper:
|
|
243
|
-
? [`(await import('${lib}')).defineComponent(`, `)`]
|
|
244
|
-
: [`(await import('${lib}')).default.extend(`, `)`],
|
|
242
|
+
optionsWrapper: [`(await import('${lib}')).defineComponent(`, `)`],
|
|
245
243
|
macros: {
|
|
246
244
|
defineProps: ['defineProps'],
|
|
247
245
|
defineSlots: ['defineSlots'],
|
|
@@ -7,9 +7,9 @@ const parseCssVars_1 = require("../utils/parseCssVars");
|
|
|
7
7
|
const signals_1 = require("../utils/signals");
|
|
8
8
|
function computedSfc(ts, plugins, fileName, getSnapshot, getParseResult) {
|
|
9
9
|
const getUntrackedSnapshot = () => {
|
|
10
|
-
(0, alien_signals_1.
|
|
10
|
+
const pausedSub = (0, alien_signals_1.setCurrentSub)(undefined);
|
|
11
11
|
const res = getSnapshot();
|
|
12
|
-
(0, alien_signals_1.
|
|
12
|
+
(0, alien_signals_1.setCurrentSub)(pausedSub);
|
|
13
13
|
return res;
|
|
14
14
|
};
|
|
15
15
|
const getContent = (0, alien_signals_1.computed)(() => {
|
|
@@ -127,9 +127,9 @@ function computedSfc(ts, plugins, fileName, getSnapshot, getParseResult) {
|
|
|
127
127
|
if (cache?.plugin.updateSFCTemplate) {
|
|
128
128
|
const change = getUntrackedSnapshot().getChangeRange(cache.snapshot);
|
|
129
129
|
if (change) {
|
|
130
|
-
(0, alien_signals_1.
|
|
130
|
+
const pausedSub = (0, alien_signals_1.setCurrentSub)(undefined);
|
|
131
131
|
const templateOffset = base.startTagEnd;
|
|
132
|
-
(0, alien_signals_1.
|
|
132
|
+
(0, alien_signals_1.setCurrentSub)(pausedSub);
|
|
133
133
|
const newText = getUntrackedSnapshot().getText(change.span.start, change.span.start + change.newLength);
|
|
134
134
|
const newResult = cache.plugin.updateSFCTemplate(cache.result, {
|
|
135
135
|
start: change.span.start - templateOffset,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/language-core",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -15,15 +15,13 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@volar/language-core": "~2.4.13",
|
|
17
17
|
"@vue/compiler-dom": "^3.5.0",
|
|
18
|
-
"@vue/compiler-vue2": "^2.7.16",
|
|
19
18
|
"@vue/shared": "^3.5.0",
|
|
20
|
-
"alien-signals": "^
|
|
21
|
-
"minimatch": "^
|
|
19
|
+
"alien-signals": "^2.0.5",
|
|
20
|
+
"minimatch": "^10.0.1",
|
|
22
21
|
"muggle-string": "^0.4.1",
|
|
23
22
|
"path-browserify": "^1.0.1"
|
|
24
23
|
},
|
|
25
24
|
"devDependencies": {
|
|
26
|
-
"@types/minimatch": "^5.1.2",
|
|
27
25
|
"@types/node": "^22.10.4",
|
|
28
26
|
"@types/path-browserify": "^1.0.1",
|
|
29
27
|
"@volar/typescript": "~2.4.13",
|
|
@@ -37,5 +35,5 @@
|
|
|
37
35
|
"optional": true
|
|
38
36
|
}
|
|
39
37
|
},
|
|
40
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "d38cb93558fe8015c7ffe9ceacfdd3296e3692f6"
|
|
41
39
|
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const css = require("css-tree");
|
|
4
|
-
const plugin = () => {
|
|
5
|
-
return {
|
|
6
|
-
version: 2.1,
|
|
7
|
-
compileSFCStyle(lang, style) {
|
|
8
|
-
if (lang === 'css' || lang === 'scss' || lang === 'sass' || lang === 'less') {
|
|
9
|
-
return css.parse(style, {
|
|
10
|
-
filename: 'test.' + lang,
|
|
11
|
-
positions: true,
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
exports.default = plugin;
|
|
18
|
-
//# sourceMappingURL=vue-style-css.js.map
|