@vue/language-core 1.8.4 → 1.8.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/out/generators/script.js +6 -6
- package/out/generators/template.js +9 -8
- package/out/languageModule.js +1 -1
- package/out/parsers/scriptSetupRanges.js +8 -1
- package/out/plugins/file-html.js +2 -2
- package/out/plugins/file-md.js +11 -6
- package/out/plugins/vue-sfc-customblocks.js +2 -1
- package/out/plugins/vue-sfc-scripts.js +4 -2
- package/out/plugins/vue-sfc-styles.js +2 -1
- package/out/plugins/vue-sfc-template.js +2 -1
- package/out/plugins/vue-tsx.js +4 -2
- package/out/sourceFile.js +2 -1
- package/out/utils/globalTypes.js +1 -0
- package/out/utils/parseCssClassNames.js +3 -3
- package/out/utils/parseCssVars.js +7 -5
- package/out/utils/ts.js +1 -1
- package/package.json +4 -4
package/out/generators/script.js
CHANGED
|
@@ -648,7 +648,7 @@ declare function defineProp<T>(value?: T | (() => T), required?: boolean, rest?:
|
|
|
648
648
|
const templateStart = (0, source_map_1.getLength)(codes);
|
|
649
649
|
codes.push(varName);
|
|
650
650
|
const templateEnd = (0, source_map_1.getLength)(codes);
|
|
651
|
-
codes.push(`: {} as typeof `);
|
|
651
|
+
codes.push(`: ${varName} as typeof `);
|
|
652
652
|
const scriptStart = (0, source_map_1.getLength)(codes);
|
|
653
653
|
codes.push(varName);
|
|
654
654
|
const scriptEnd = (0, source_map_1.getLength)(codes);
|
|
@@ -723,7 +723,7 @@ declare function defineProp<T>(value?: T | (() => T), required?: boolean, rest?:
|
|
|
723
723
|
continue;
|
|
724
724
|
codes.push(`${style.module}: Record<string, string> & __VLS_Prettify<{}`);
|
|
725
725
|
for (const className of style.classNames) {
|
|
726
|
-
generateCssClassProperty(i, className.text.substring(1), { start: className.offset, end: className.offset + className.text.length }, 'string', false);
|
|
726
|
+
generateCssClassProperty(i, className.text.substring(1), { start: className.offset, end: className.offset + className.text.length }, 'string', false, true);
|
|
727
727
|
}
|
|
728
728
|
codes.push('>;\n');
|
|
729
729
|
}
|
|
@@ -739,10 +739,10 @@ declare function defineProp<T>(value?: T | (() => T), required?: boolean, rest?:
|
|
|
739
739
|
codes.push('type __VLS_StyleScopedClasses = {}');
|
|
740
740
|
for (let i = 0; i < _sfc.styles.length; i++) {
|
|
741
741
|
const style = _sfc.styles[i];
|
|
742
|
-
if (!style.scoped)
|
|
742
|
+
if (!style.scoped && vueCompilerOptions.experimentalResolveStyleCssClasses !== 'always')
|
|
743
743
|
continue;
|
|
744
744
|
for (const className of style.classNames) {
|
|
745
|
-
generateCssClassProperty(i, className.text.substring(1), { start: className.offset, end: className.offset + className.text.length }, 'boolean', true);
|
|
745
|
+
generateCssClassProperty(i, className.text.substring(1), { start: className.offset, end: className.offset + className.text.length }, 'boolean', true, !style.module);
|
|
746
746
|
}
|
|
747
747
|
}
|
|
748
748
|
codes.push(';\n');
|
|
@@ -773,7 +773,7 @@ declare function defineProp<T>(value?: T | (() => T), required?: boolean, rest?:
|
|
|
773
773
|
}
|
|
774
774
|
codes.push(`return __VLS_slots;\n`);
|
|
775
775
|
return { cssIds };
|
|
776
|
-
function generateCssClassProperty(styleIndex, className, classRange, propertyType, optional) {
|
|
776
|
+
function generateCssClassProperty(styleIndex, className, classRange, propertyType, optional, referencesCodeLens) {
|
|
777
777
|
codes.push(`\n & { `);
|
|
778
778
|
codes.push([
|
|
779
779
|
'',
|
|
@@ -781,7 +781,7 @@ declare function defineProp<T>(value?: T | (() => T), required?: boolean, rest?:
|
|
|
781
781
|
classRange.start,
|
|
782
782
|
{
|
|
783
783
|
references: true,
|
|
784
|
-
referencesCodeLens
|
|
784
|
+
referencesCodeLens,
|
|
785
785
|
},
|
|
786
786
|
]);
|
|
787
787
|
codes.push(`'`);
|
|
@@ -41,7 +41,8 @@ const formatBrackets = {
|
|
|
41
41
|
curly: ['0 +', '+ 0;'],
|
|
42
42
|
event: ['() => ', ';'],
|
|
43
43
|
};
|
|
44
|
-
const
|
|
44
|
+
const validTsVarReg = /^[a-zA-Z_$][0-9a-zA-Z_$]*$/;
|
|
45
|
+
const colonReg = /:/g;
|
|
45
46
|
// @ts-ignore
|
|
46
47
|
const transformContext = {
|
|
47
48
|
onError: () => { },
|
|
@@ -121,7 +122,7 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
|
|
|
121
122
|
function generateStyleScopedClasses() {
|
|
122
123
|
const allClasses = new Set();
|
|
123
124
|
for (const block of sfc.styles) {
|
|
124
|
-
if (block.scoped) {
|
|
125
|
+
if (block.scoped || vueCompilerOptions.experimentalResolveStyleCssClasses === 'always') {
|
|
125
126
|
for (const className of block.classNames) {
|
|
126
127
|
allClasses.add(className.text.substring(1));
|
|
127
128
|
}
|
|
@@ -144,7 +145,7 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
|
|
|
144
145
|
codes.push('}\n');
|
|
145
146
|
}
|
|
146
147
|
function toCanonicalComponentName(tagText) {
|
|
147
|
-
return
|
|
148
|
+
return validTsVarReg.test(tagText) ? tagText : (0, shared_1.capitalize)((0, shared_1.camelize)(tagText.replace(colonReg, '-')));
|
|
148
149
|
}
|
|
149
150
|
function getPossibleOriginalComponentName(tagText) {
|
|
150
151
|
return [...new Set([
|
|
@@ -500,7 +501,7 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
|
|
|
500
501
|
else {
|
|
501
502
|
codes.push(`let ${var_originalComponent}!: `);
|
|
502
503
|
for (const componentName of getPossibleOriginalComponentName(tag)) {
|
|
503
|
-
codes.push(`'${componentName}' extends keyof typeof __VLS_ctx ? typeof __VLS_ctx${
|
|
504
|
+
codes.push(`'${componentName}' extends keyof typeof __VLS_ctx ? typeof __VLS_ctx${validTsVarReg.test(componentName) ? `.${componentName}` : `['${componentName}']`} : `);
|
|
504
505
|
}
|
|
505
506
|
codes.push(`typeof __VLS_resolvedLocalAndGlobalComponents['${toCanonicalComponentName(tag)}'];\n`);
|
|
506
507
|
}
|
|
@@ -586,7 +587,7 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
|
|
|
586
587
|
}
|
|
587
588
|
generateDirectives(node, var_originalComponent);
|
|
588
589
|
generateElReferences(node); // <el ref="foo" />
|
|
589
|
-
if (sfc.styles.some(s => s.scoped)) {
|
|
590
|
+
if (sfc.styles.some(s => s.scoped || vueCompilerOptions.experimentalResolveStyleCssClasses === 'always')) {
|
|
590
591
|
generateClassScoped(node);
|
|
591
592
|
}
|
|
592
593
|
if (componentCtxVar) {
|
|
@@ -1112,7 +1113,7 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
|
|
|
1112
1113
|
const varSlot = `__VLS_${elementIndex++}`;
|
|
1113
1114
|
const slotNameExpNode = getSlotNameExpNode();
|
|
1114
1115
|
if (hasScriptSetupSlots) {
|
|
1115
|
-
codes.push(['', 'template', node.loc.start.offset, capabilitiesPresets.diagnosticOnly], '__VLS_slots[', ['', 'template', node.loc.start.offset, capabilitiesPresets.diagnosticOnly], slotNameExpNode?.content ?? `('${getSlotName()}' as const)`, ['', 'template', node.loc.end.offset, capabilitiesPresets.diagnosticOnly], ']', ['', 'template', node.loc.end.offset, capabilitiesPresets.diagnosticOnly], '?.(', ['', 'template', startTagOffset, capabilitiesPresets.diagnosticOnly], '{\n');
|
|
1116
|
+
codes.push('__VLS_normalizeSlot(', ['', 'template', node.loc.start.offset, capabilitiesPresets.diagnosticOnly], '__VLS_slots[', ['', 'template', node.loc.start.offset, capabilitiesPresets.diagnosticOnly], slotNameExpNode?.content ?? `('${getSlotName()}' as const)`, ['', 'template', node.loc.end.offset, capabilitiesPresets.diagnosticOnly], ']', ['', 'template', node.loc.end.offset, capabilitiesPresets.diagnosticOnly], ')?.(', ['', 'template', startTagOffset, capabilitiesPresets.diagnosticOnly], '{\n');
|
|
1116
1117
|
}
|
|
1117
1118
|
else {
|
|
1118
1119
|
codes.push(`var ${varSlot} = {\n`);
|
|
@@ -1228,7 +1229,7 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
|
|
|
1228
1229
|
}
|
|
1229
1230
|
function createObjectPropertyCode(a, astHolder) {
|
|
1230
1231
|
const aStr = typeof a === 'string' ? a : a[0];
|
|
1231
|
-
if (
|
|
1232
|
+
if (validTsVarReg.test(aStr)) {
|
|
1232
1233
|
return [a];
|
|
1233
1234
|
}
|
|
1234
1235
|
else if (aStr.startsWith('[') && aStr.endsWith(']') && astHolder) {
|
|
@@ -1296,7 +1297,7 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
|
|
|
1296
1297
|
}
|
|
1297
1298
|
function createPropertyAccessCode(a, astHolder) {
|
|
1298
1299
|
const aStr = typeof a === 'string' ? a : a[0];
|
|
1299
|
-
if (!compilerOptions.noPropertyAccessFromIndexSignature &&
|
|
1300
|
+
if (!compilerOptions.noPropertyAccessFromIndexSignature && validTsVarReg.test(aStr)) {
|
|
1300
1301
|
return ['.', a];
|
|
1301
1302
|
}
|
|
1302
1303
|
else if (aStr.startsWith('[') && aStr.endsWith(']')) {
|
package/out/languageModule.js
CHANGED
|
@@ -23,7 +23,7 @@ function createLanguage(compilerOptions = {}, _vueCompilerOptions = {}, ts = req
|
|
|
23
23
|
},
|
|
24
24
|
resolveHost(host) {
|
|
25
25
|
const sharedTypesSnapshot = ts.ScriptSnapshot.fromString(sharedTypes.getTypesCode(vueCompilerOptions));
|
|
26
|
-
const sharedTypesFileName = path_1.posix.join(host.
|
|
26
|
+
const sharedTypesFileName = path_1.posix.join(host.rootPath, sharedTypes.baseName);
|
|
27
27
|
return {
|
|
28
28
|
...host,
|
|
29
29
|
getScriptFileNames() {
|
|
@@ -27,7 +27,14 @@ function parseScriptSetupRanges(ts, ast, vueCompilerOptions) {
|
|
|
27
27
|
&& !ts.isEmptyStatement(node)
|
|
28
28
|
// fix https://github.com/vuejs/language-tools/issues/1223
|
|
29
29
|
&& !ts.isImportEqualsDeclaration(node)) {
|
|
30
|
-
|
|
30
|
+
const commentRanges = ts.getLeadingCommentRanges(ast.getFullText(), node.getFullStart());
|
|
31
|
+
if (commentRanges?.length) {
|
|
32
|
+
const commentRange = commentRanges.sort((a, b) => a.pos - b.pos)[0];
|
|
33
|
+
importSectionEndOffset = commentRange.pos;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
importSectionEndOffset = node.getStart(ast);
|
|
37
|
+
}
|
|
31
38
|
foundNonImportExportNode = true;
|
|
32
39
|
}
|
|
33
40
|
});
|
package/out/plugins/file-html.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
const sfcBlockReg = /\<(script|style)\b([\s\S]*?)\>([\s\S]*?)\<\/\1\>/g;
|
|
3
|
+
const langReg = /\blang\s*=\s*(['\"]?)(\S*)\b\1/;
|
|
2
4
|
const plugin = () => {
|
|
3
5
|
return {
|
|
4
6
|
version: 1,
|
|
@@ -20,8 +22,6 @@ const plugin = () => {
|
|
|
20
22
|
errors: [],
|
|
21
23
|
};
|
|
22
24
|
let templateContent = content;
|
|
23
|
-
const sfcBlockReg = /\<(script|style)\b([\s\S]*?)\>([\s\S]*?)\<\/\1\>/g;
|
|
24
|
-
const langReg = /\blang\s*=\s*(['\"]?)(\S*)\b\1/;
|
|
25
25
|
for (const match of content.matchAll(sfcBlockReg)) {
|
|
26
26
|
const matchText = match[0];
|
|
27
27
|
const tag = match[1];
|
package/out/plugins/file-md.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const source_map_1 = require("@volar/source-map");
|
|
3
3
|
const parseSfc_1 = require("../utils/parseSfc");
|
|
4
|
+
const codeblockReg = /```[\s\S]+?```/g;
|
|
5
|
+
const inlineCodeblockReg = /`[^\n`]+?`/g;
|
|
6
|
+
const scriptSetupReg = /\\\<[\s\S]+?\>\n?/g;
|
|
7
|
+
const sfcBlockReg = /\<(script|style)\b[\s\S]*?\>([\s\S]*?)\<\/\1\>/g;
|
|
8
|
+
const angleBracketReg = /\<\S*\:\S*\>/g;
|
|
9
|
+
const linkReg = /\[[\s\S]*?\]\([\s\S]*?\)/g;
|
|
4
10
|
const plugin = () => {
|
|
5
11
|
return {
|
|
6
12
|
version: 1,
|
|
@@ -8,12 +14,11 @@ const plugin = () => {
|
|
|
8
14
|
if (fileName.endsWith('.md')) {
|
|
9
15
|
content = content
|
|
10
16
|
// code block
|
|
11
|
-
.replace(
|
|
17
|
+
.replace(codeblockReg, match => '```' + ' '.repeat(match.length - 6) + '```')
|
|
12
18
|
// inline code block
|
|
13
|
-
.replace(
|
|
19
|
+
.replace(inlineCodeblockReg, match => `\`${' '.repeat(match.length - 2)}\``)
|
|
14
20
|
// # \<script setup>
|
|
15
|
-
.replace(
|
|
16
|
-
const sfcBlockReg = /\<(script|style)\b[\s\S]*?\>([\s\S]*?)\<\/\1\>/g;
|
|
21
|
+
.replace(scriptSetupReg, match => ' '.repeat(match.length));
|
|
17
22
|
const codes = [];
|
|
18
23
|
for (const match of content.matchAll(sfcBlockReg)) {
|
|
19
24
|
if (match.index !== undefined) {
|
|
@@ -25,9 +30,9 @@ const plugin = () => {
|
|
|
25
30
|
}
|
|
26
31
|
content = content
|
|
27
32
|
// angle bracket: <http://foo.com>
|
|
28
|
-
.replace(
|
|
33
|
+
.replace(angleBracketReg, match => ' '.repeat(match.length))
|
|
29
34
|
// [foo](http://foo.com)
|
|
30
|
-
.replace(
|
|
35
|
+
.replace(linkReg, match => ' '.repeat(match.length));
|
|
31
36
|
codes.push('<template>\n');
|
|
32
37
|
codes.push([content, undefined, 0]);
|
|
33
38
|
codes.push('\n</template>');
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const language_core_1 = require("@volar/language-core");
|
|
3
|
+
const customBlockReg = /^(.*)\.customBlock_([^_]+)_(\d+)\.([^.]+)$/;
|
|
3
4
|
const plugin = () => {
|
|
4
5
|
return {
|
|
5
6
|
version: 1,
|
|
@@ -12,7 +13,7 @@ const plugin = () => {
|
|
|
12
13
|
return names;
|
|
13
14
|
},
|
|
14
15
|
resolveEmbeddedFile(_fileName, sfc, embeddedFile) {
|
|
15
|
-
const match = embeddedFile.fileName.match(
|
|
16
|
+
const match = embeddedFile.fileName.match(customBlockReg);
|
|
16
17
|
if (match) {
|
|
17
18
|
const index = parseInt(match[3]);
|
|
18
19
|
const customBlock = sfc.customBlocks[index];
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const language_core_1 = require("@volar/language-core");
|
|
3
|
+
const scriptFormatReg = /^(.*)\.script_format\.([^.]+)$/;
|
|
4
|
+
const scriptSetupFormatReg = /^(.*)\.scriptSetup_format\.([^.]+)$/;
|
|
3
5
|
const plugin = () => {
|
|
4
6
|
return {
|
|
5
7
|
version: 1,
|
|
@@ -14,8 +16,8 @@ const plugin = () => {
|
|
|
14
16
|
return names;
|
|
15
17
|
},
|
|
16
18
|
resolveEmbeddedFile(_fileName, sfc, embeddedFile) {
|
|
17
|
-
const scriptMatch = embeddedFile.fileName.match(
|
|
18
|
-
const scriptSetupMatch = embeddedFile.fileName.match(
|
|
19
|
+
const scriptMatch = embeddedFile.fileName.match(scriptFormatReg);
|
|
20
|
+
const scriptSetupMatch = embeddedFile.fileName.match(scriptSetupFormatReg);
|
|
19
21
|
const script = scriptMatch ? sfc.script : scriptSetupMatch ? sfc.scriptSetup : undefined;
|
|
20
22
|
if (script) {
|
|
21
23
|
embeddedFile.kind = language_core_1.FileKind.TextFile;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const language_core_1 = require("@volar/language-core");
|
|
3
|
+
const styleReg = /^(.*)\.style_(\d+)\.([^.]+)$/;
|
|
3
4
|
const plugin = () => {
|
|
4
5
|
return {
|
|
5
6
|
version: 1,
|
|
@@ -12,7 +13,7 @@ const plugin = () => {
|
|
|
12
13
|
return names;
|
|
13
14
|
},
|
|
14
15
|
resolveEmbeddedFile(_fileName, sfc, embeddedFile) {
|
|
15
|
-
const match = embeddedFile.fileName.match(
|
|
16
|
+
const match = embeddedFile.fileName.match(styleReg);
|
|
16
17
|
if (match) {
|
|
17
18
|
const index = parseInt(match[2]);
|
|
18
19
|
const style = sfc.styles[index];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const language_core_1 = require("@volar/language-core");
|
|
3
|
+
const templateReg = /^(.*)\.template\.([^.]+)$/;
|
|
3
4
|
const plugin = () => {
|
|
4
5
|
return {
|
|
5
6
|
version: 1,
|
|
@@ -10,7 +11,7 @@ const plugin = () => {
|
|
|
10
11
|
return [];
|
|
11
12
|
},
|
|
12
13
|
resolveEmbeddedFile(_fileName, sfc, embeddedFile) {
|
|
13
|
-
const match = embeddedFile.fileName.match(
|
|
14
|
+
const match = embeddedFile.fileName.match(templateReg);
|
|
14
15
|
if (match && sfc.template) {
|
|
15
16
|
embeddedFile.capabilities = language_core_1.FileCapabilities.full;
|
|
16
17
|
embeddedFile.content.push([
|
package/out/plugins/vue-tsx.js
CHANGED
|
@@ -7,6 +7,8 @@ const scriptRanges_1 = require("../parsers/scriptRanges");
|
|
|
7
7
|
const scriptSetupRanges_1 = require("../parsers/scriptSetupRanges");
|
|
8
8
|
const language_core_1 = require("@volar/language-core");
|
|
9
9
|
const muggle = require("muggle-string");
|
|
10
|
+
const templateFormatReg = /^\.template_format\.ts$/;
|
|
11
|
+
const templateStyleCssReg = /^\.template_style\.css$/;
|
|
10
12
|
const plugin = ({ modules, vueCompilerOptions, compilerOptions, codegenStack }) => {
|
|
11
13
|
const ts = modules.typescript;
|
|
12
14
|
const instances = new WeakMap();
|
|
@@ -43,7 +45,7 @@ const plugin = ({ modules, vueCompilerOptions, compilerOptions, codegenStack })
|
|
|
43
45
|
embeddedFile.mirrorBehaviorMappings = [...tsx.mirrorBehaviorMappings];
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
|
-
else if (suffix.match(
|
|
48
|
+
else if (suffix.match(templateFormatReg)) {
|
|
47
49
|
embeddedFile.parentFileName = fileName + '.template.' + sfc.template?.lang;
|
|
48
50
|
embeddedFile.kind = language_core_1.FileKind.TextFile;
|
|
49
51
|
embeddedFile.capabilities = {
|
|
@@ -72,7 +74,7 @@ const plugin = ({ modules, vueCompilerOptions, compilerOptions, codegenStack })
|
|
|
72
74
|
}
|
|
73
75
|
}
|
|
74
76
|
}
|
|
75
|
-
else if (suffix.match(
|
|
77
|
+
else if (suffix.match(templateStyleCssReg)) {
|
|
76
78
|
embeddedFile.parentFileName = fileName + '.template.' + sfc.template?.lang;
|
|
77
79
|
if (_tsx.htmlGen.value) {
|
|
78
80
|
const [content, contentStacks] = codegenStack ? muggle.track([..._tsx.htmlGen.value.cssCodes], [..._tsx.htmlGen.value.cssCodeStacks]) : [[..._tsx.htmlGen.value.cssCodes], [..._tsx.htmlGen.value.cssCodeStacks]];
|
package/out/sourceFile.js
CHANGED
|
@@ -7,6 +7,7 @@ const reactivity_1 = require("@vue/reactivity");
|
|
|
7
7
|
const muggle = require("muggle-string");
|
|
8
8
|
const parseCssVars_1 = require("./utils/parseCssVars");
|
|
9
9
|
const parseCssClassNames_1 = require("./utils/parseCssClassNames");
|
|
10
|
+
const jsxReg = /^\.(js|ts)x?$/;
|
|
10
11
|
class VueEmbeddedFile {
|
|
11
12
|
constructor(fileName, content, contentStacks) {
|
|
12
13
|
this.fileName = fileName;
|
|
@@ -23,7 +24,7 @@ class VueFile {
|
|
|
23
24
|
return this._compiledSfcTemplate.value;
|
|
24
25
|
}
|
|
25
26
|
get mainScriptName() {
|
|
26
|
-
return this._allEmbeddedFiles.value.find(e => e.file.fileName.replace(this.fileName, '').match(
|
|
27
|
+
return this._allEmbeddedFiles.value.find(e => e.file.fileName.replace(this.fileName, '').match(jsxReg))?.file.fileName ?? '';
|
|
27
28
|
}
|
|
28
29
|
get embeddedFiles() {
|
|
29
30
|
return this._embeddedFiles.value;
|
package/out/utils/globalTypes.js
CHANGED
|
@@ -111,6 +111,7 @@ declare function __VLS_pickFunctionalComponentCtx<T, K>(comp: T, compInstance: K
|
|
|
111
111
|
>;
|
|
112
112
|
type __VLS_AsFunctionOrAny<F> = unknown extends F ? any : ((...args: any) => any) extends F ? F : any;
|
|
113
113
|
|
|
114
|
+
declare function __VLS_normalizeSlot<S>(s: S): S extends () => infer R ? (props: {}) => R : S;
|
|
114
115
|
declare function __VLS_componentProps<T, K>(comp: T, fnReturn: K):
|
|
115
116
|
__VLS_PickNotAny<K, {}> extends { __ctx: { props: infer P } } ? NonNullable<P>
|
|
116
117
|
: T extends (props: infer P, ...args: any) => any ? NonNullable<P> :
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseCssClassNames = void 0;
|
|
4
4
|
const parseCssVars_1 = require("./parseCssVars");
|
|
5
|
+
const cssClassNameReg = /(?=([\.]{1}[a-zA-Z_]+[\w\_\-]*)[\s\.\+\{\>#\:]{1})/g;
|
|
5
6
|
function* parseCssClassNames(styleContent) {
|
|
6
7
|
styleContent = (0, parseCssVars_1.clearComments)(styleContent);
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
for (const match of matchs) {
|
|
8
|
+
const matches = styleContent.matchAll(cssClassNameReg);
|
|
9
|
+
for (const match of matches) {
|
|
10
10
|
if (match.index !== undefined) {
|
|
11
11
|
const matchText = match[1];
|
|
12
12
|
if (matchText !== undefined) {
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// https://github.com/vuejs/core/blob/main/packages/compiler-sfc/src/cssVars.ts#L47-L61
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.clearComments = exports.parseCssVars = void 0;
|
|
4
|
-
|
|
5
|
+
const vBindCssVarReg = /\bv-bind\(\s*(?:'([^']+)'|"([^"]+)"|([^'"][^)]*))\s*\)/g;
|
|
6
|
+
const commentReg1 = /\/\*([\s\S]*?)\*\//g;
|
|
7
|
+
const commentReg2 = /\/\/([\s\S]*?)\n/g;
|
|
5
8
|
function* parseCssVars(styleContent) {
|
|
6
9
|
styleContent = clearComments(styleContent);
|
|
7
|
-
const
|
|
8
|
-
const matchs = styleContent.matchAll(reg);
|
|
10
|
+
const matchs = styleContent.matchAll(vBindCssVarReg);
|
|
9
11
|
for (const match of matchs) {
|
|
10
12
|
if (match.index !== undefined) {
|
|
11
13
|
const matchText = match[1] ?? match[2] ?? match[3];
|
|
@@ -19,8 +21,8 @@ function* parseCssVars(styleContent) {
|
|
|
19
21
|
exports.parseCssVars = parseCssVars;
|
|
20
22
|
function clearComments(css) {
|
|
21
23
|
return css
|
|
22
|
-
.replace(
|
|
23
|
-
.replace(
|
|
24
|
+
.replace(commentReg1, match => `/*${' '.repeat(match.length - 4)}*/`)
|
|
25
|
+
.replace(commentReg2, match => `//${' '.repeat(match.length - 3)}\n`);
|
|
24
26
|
}
|
|
25
27
|
exports.clearComments = clearComments;
|
|
26
28
|
//# sourceMappingURL=parseCssVars.js.map
|
package/out/utils/ts.js
CHANGED
|
@@ -60,7 +60,7 @@ function createParsedCommandLine(ts, parseConfigHost, tsConfigPath) {
|
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
catch (err) {
|
|
63
|
-
console.warn('Failed to resolve tsconfig path:', tsConfigPath, err);
|
|
63
|
+
// console.warn('Failed to resolve tsconfig path:', tsConfigPath, err);
|
|
64
64
|
return {
|
|
65
65
|
fileNames: [],
|
|
66
66
|
options: {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/language-core",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.5",
|
|
4
4
|
"main": "out/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"directory": "packages/vue-language-core"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@volar/language-core": "~1.
|
|
17
|
-
"@volar/source-map": "~1.
|
|
16
|
+
"@volar/language-core": "~1.9.0",
|
|
17
|
+
"@volar/source-map": "~1.9.0",
|
|
18
18
|
"@vue/compiler-dom": "^3.3.0",
|
|
19
19
|
"@vue/reactivity": "^3.3.0",
|
|
20
20
|
"@vue/shared": "^3.3.0",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"optional": true
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "971820b55ea42cb7e8c8ba7c35c8998d5572b420"
|
|
38
38
|
}
|