@vue/language-core 1.9.0-alpha.3 → 2.0.0
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/package.json +6 -9
- package/out/generators/script.d.ts +0 -15
- package/out/generators/script.js +0 -887
- package/out/generators/template.d.ts +0 -21
- package/out/generators/template.js +0 -1506
- package/out/index.d.ts +0 -16
- package/out/index.js +0 -33
- package/out/languageModule.d.ts +0 -10
- package/out/languageModule.js +0 -99
- package/out/parsers/scriptRanges.d.ts +0 -16
- package/out/parsers/scriptRanges.js +0 -58
- package/out/parsers/scriptSetupRanges.d.ts +0 -49
- package/out/parsers/scriptSetupRanges.js +0 -291
- package/out/plugins/file-html.d.ts +0 -4
- package/out/plugins/file-html.js +0 -81
- package/out/plugins/file-md.d.ts +0 -4
- package/out/plugins/file-md.js +0 -71
- package/out/plugins/file-vue.d.ts +0 -4
- package/out/plugins/file-vue.js +0 -40
- package/out/plugins/vue-sfc-customblocks.d.ts +0 -4
- package/out/plugins/vue-sfc-customblocks.js +0 -33
- package/out/plugins/vue-sfc-scripts.d.ts +0 -4
- package/out/plugins/vue-sfc-scripts.js +0 -42
- package/out/plugins/vue-sfc-styles.d.ts +0 -4
- package/out/plugins/vue-sfc-styles.js +0 -33
- package/out/plugins/vue-sfc-template.d.ts +0 -4
- package/out/plugins/vue-sfc-template.js +0 -29
- package/out/plugins/vue-template-html.d.ts +0 -4
- package/out/plugins/vue-template-html.js +0 -169
- package/out/plugins/vue-tsx.d.ts +0 -73
- package/out/plugins/vue-tsx.js +0 -159
- package/out/plugins.d.ts +0 -25
- package/out/plugins.js +0 -58
- package/out/types.d.ts +0 -125
- package/out/types.js +0 -3
- package/out/utils/globalTypes.d.ts +0 -4
- package/out/utils/globalTypes.js +0 -135
- package/out/utils/parseCssClassNames.d.ts +0 -5
- package/out/utils/parseCssClassNames.js +0 -19
- package/out/utils/parseCssVars.d.ts +0 -6
- package/out/utils/parseCssVars.js +0 -28
- package/out/utils/parseSfc.d.ts +0 -3
- package/out/utils/parseSfc.js +0 -135
- package/out/utils/shared.d.ts +0 -4
- package/out/utils/shared.js +0 -20
- package/out/utils/transform.d.ts +0 -9
- package/out/utils/transform.js +0 -195
- package/out/utils/ts.d.ts +0 -9
- package/out/utils/ts.js +0 -237
- package/out/utils/vue2TemplateCompiler.d.ts +0 -3
- package/out/utils/vue2TemplateCompiler.js +0 -86
- package/out/virtualFile/computedFiles.d.ts +0 -4
- package/out/virtualFile/computedFiles.js +0 -204
- package/out/virtualFile/computedMappings.d.ts +0 -6
- package/out/virtualFile/computedMappings.js +0 -39
- package/out/virtualFile/computedSfc.d.ts +0 -5
- package/out/virtualFile/computedSfc.js +0 -197
- package/out/virtualFile/computedVueSfc.d.ts +0 -5
- package/out/virtualFile/computedVueSfc.js +0 -41
- package/out/virtualFile/embeddedFile.d.ts +0 -13
- package/out/virtualFile/embeddedFile.js +0 -16
- package/out/virtualFile/vueFile.d.ts +0 -28
- package/out/virtualFile/vueFile.js +0 -53
package/out/plugins/file-md.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const source_map_1 = require("@volar/source-map");
|
|
4
|
-
const parseSfc_1 = require("../utils/parseSfc");
|
|
5
|
-
const codeblockReg = /```[\s\S]+?```/g;
|
|
6
|
-
const inlineCodeblockReg = /`[^\n`]+?`/g;
|
|
7
|
-
const scriptSetupReg = /\\\<[\s\S]+?\>\n?/g;
|
|
8
|
-
const sfcBlockReg = /\<(script|style)\b[\s\S]*?\>([\s\S]*?)\<\/\1\>/g;
|
|
9
|
-
const angleBracketReg = /\<\S*\:\S*\>/g;
|
|
10
|
-
const linkReg = /\[[\s\S]*?\]\([\s\S]*?\)/g;
|
|
11
|
-
const codeSnippetImportReg = /^\s*<<<\s*.+/gm;
|
|
12
|
-
const plugin = () => {
|
|
13
|
-
return {
|
|
14
|
-
version: 1,
|
|
15
|
-
parseSFC(fileName, content) {
|
|
16
|
-
if (fileName.endsWith('.md')) {
|
|
17
|
-
content = content
|
|
18
|
-
// code block
|
|
19
|
-
.replace(codeblockReg, match => '```' + ' '.repeat(match.length - 6) + '```')
|
|
20
|
-
// inline code block
|
|
21
|
-
.replace(inlineCodeblockReg, match => `\`${' '.repeat(match.length - 2)}\``)
|
|
22
|
-
// # \<script setup>
|
|
23
|
-
.replace(scriptSetupReg, match => ' '.repeat(match.length))
|
|
24
|
-
// <<< https://vitepress.dev/guide/markdown#import-code-snippets
|
|
25
|
-
.replace(codeSnippetImportReg, match => ' '.repeat(match.length));
|
|
26
|
-
const codes = [];
|
|
27
|
-
for (const match of content.matchAll(sfcBlockReg)) {
|
|
28
|
-
if (match.index !== undefined) {
|
|
29
|
-
const matchText = match[0];
|
|
30
|
-
codes.push([matchText, undefined, match.index]);
|
|
31
|
-
codes.push('\n\n');
|
|
32
|
-
content = content.substring(0, match.index) + ' '.repeat(matchText.length) + content.substring(match.index + matchText.length);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
content = content
|
|
36
|
-
// angle bracket: <http://foo.com>
|
|
37
|
-
.replace(angleBracketReg, match => ' '.repeat(match.length))
|
|
38
|
-
// [foo](http://foo.com)
|
|
39
|
-
.replace(linkReg, match => ' '.repeat(match.length));
|
|
40
|
-
codes.push('<template>\n');
|
|
41
|
-
codes.push([content, undefined, 0]);
|
|
42
|
-
codes.push('\n</template>');
|
|
43
|
-
const file2VueSourceMap = new source_map_1.SourceMap((0, source_map_1.buildMappings)(codes));
|
|
44
|
-
const sfc = (0, parseSfc_1.parse)((0, source_map_1.toString)(codes));
|
|
45
|
-
if (sfc.descriptor.template) {
|
|
46
|
-
transformRange(sfc.descriptor.template);
|
|
47
|
-
}
|
|
48
|
-
if (sfc.descriptor.script) {
|
|
49
|
-
transformRange(sfc.descriptor.script);
|
|
50
|
-
}
|
|
51
|
-
if (sfc.descriptor.scriptSetup) {
|
|
52
|
-
transformRange(sfc.descriptor.scriptSetup);
|
|
53
|
-
}
|
|
54
|
-
for (const style of sfc.descriptor.styles) {
|
|
55
|
-
transformRange(style);
|
|
56
|
-
}
|
|
57
|
-
for (const customBlock of sfc.descriptor.customBlocks) {
|
|
58
|
-
transformRange(customBlock);
|
|
59
|
-
}
|
|
60
|
-
return sfc;
|
|
61
|
-
function transformRange(block) {
|
|
62
|
-
block.loc.start.offset = file2VueSourceMap.toSourceOffset(block.loc.start.offset)?.[0] ?? -1;
|
|
63
|
-
block.loc.end.offset = file2VueSourceMap.toSourceOffset(block.loc.end.offset)?.[0] ?? -1;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
;
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
exports.default = plugin;
|
|
71
|
-
//# sourceMappingURL=file-md.js.map
|
package/out/plugins/file-vue.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const parseSfc_1 = require("../utils/parseSfc");
|
|
4
|
-
const plugin = (_ctx) => {
|
|
5
|
-
return {
|
|
6
|
-
version: 1,
|
|
7
|
-
parseSFC(_fileName, content) {
|
|
8
|
-
return (0, parseSfc_1.parse)(content);
|
|
9
|
-
},
|
|
10
|
-
updateSFC(sfc, change) {
|
|
11
|
-
const blocks = [
|
|
12
|
-
sfc.descriptor.template,
|
|
13
|
-
sfc.descriptor.script,
|
|
14
|
-
sfc.descriptor.scriptSetup,
|
|
15
|
-
...sfc.descriptor.styles,
|
|
16
|
-
...sfc.descriptor.customBlocks,
|
|
17
|
-
].filter((block) => !!block);
|
|
18
|
-
const hitBlock = blocks.find(block => change.start >= block.loc.start.offset && change.end <= block.loc.end.offset);
|
|
19
|
-
if (!hitBlock) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
hitBlock.content =
|
|
23
|
-
hitBlock.content.substring(0, change.start - hitBlock.loc.start.offset)
|
|
24
|
-
+ change.newText
|
|
25
|
-
+ hitBlock.content.substring(change.end - hitBlock.loc.start.offset);
|
|
26
|
-
const lengthDiff = change.newText.length - (change.end - change.start);
|
|
27
|
-
for (const block of blocks) {
|
|
28
|
-
if (block.loc.start.offset > change.end) {
|
|
29
|
-
block.loc.start.offset += lengthDiff;
|
|
30
|
-
}
|
|
31
|
-
if (block.loc.end.offset >= change.end) {
|
|
32
|
-
block.loc.end.offset += lengthDiff;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return sfc;
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
exports.default = plugin;
|
|
40
|
-
//# sourceMappingURL=file-vue.js.map
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const language_core_1 = require("@volar/language-core");
|
|
4
|
-
const customBlockReg = /^(.*)\.customBlock_([^_]+)_(\d+)\.([^.]+)$/;
|
|
5
|
-
const plugin = () => {
|
|
6
|
-
return {
|
|
7
|
-
version: 1,
|
|
8
|
-
getEmbeddedFileNames(fileName, sfc) {
|
|
9
|
-
const names = [];
|
|
10
|
-
for (let i = 0; i < sfc.customBlocks.length; i++) {
|
|
11
|
-
const customBlock = sfc.customBlocks[i];
|
|
12
|
-
names.push(fileName + '.customBlock_' + customBlock.type + '_' + i + '.' + customBlock.lang);
|
|
13
|
-
}
|
|
14
|
-
return names;
|
|
15
|
-
},
|
|
16
|
-
resolveEmbeddedFile(_fileName, sfc, embeddedFile) {
|
|
17
|
-
const match = embeddedFile.fileName.match(customBlockReg);
|
|
18
|
-
if (match) {
|
|
19
|
-
const index = parseInt(match[3]);
|
|
20
|
-
const customBlock = sfc.customBlocks[index];
|
|
21
|
-
embeddedFile.capabilities = language_core_1.FileCapabilities.full;
|
|
22
|
-
embeddedFile.content.push([
|
|
23
|
-
customBlock.content,
|
|
24
|
-
customBlock.name,
|
|
25
|
-
0,
|
|
26
|
-
language_core_1.FileRangeCapabilities.full,
|
|
27
|
-
]);
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
exports.default = plugin;
|
|
33
|
-
//# sourceMappingURL=vue-sfc-customblocks.js.map
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const language_core_1 = require("@volar/language-core");
|
|
4
|
-
const scriptFormatReg = /^(.*)\.script_format\.([^.]+)$/;
|
|
5
|
-
const scriptSetupFormatReg = /^(.*)\.scriptSetup_format\.([^.]+)$/;
|
|
6
|
-
const plugin = () => {
|
|
7
|
-
return {
|
|
8
|
-
version: 1,
|
|
9
|
-
getEmbeddedFileNames(fileName, sfc) {
|
|
10
|
-
const names = [];
|
|
11
|
-
if (sfc.script) {
|
|
12
|
-
names.push(fileName + '.script_format.' + sfc.script.lang);
|
|
13
|
-
}
|
|
14
|
-
if (sfc.scriptSetup) {
|
|
15
|
-
names.push(fileName + '.scriptSetup_format.' + sfc.scriptSetup.lang);
|
|
16
|
-
}
|
|
17
|
-
return names;
|
|
18
|
-
},
|
|
19
|
-
resolveEmbeddedFile(_fileName, sfc, embeddedFile) {
|
|
20
|
-
const scriptMatch = embeddedFile.fileName.match(scriptFormatReg);
|
|
21
|
-
const scriptSetupMatch = embeddedFile.fileName.match(scriptSetupFormatReg);
|
|
22
|
-
const script = scriptMatch ? sfc.script : scriptSetupMatch ? sfc.scriptSetup : undefined;
|
|
23
|
-
if (script) {
|
|
24
|
-
embeddedFile.kind = language_core_1.FileKind.TextFile;
|
|
25
|
-
embeddedFile.capabilities = {
|
|
26
|
-
...language_core_1.FileCapabilities.full,
|
|
27
|
-
diagnostic: false,
|
|
28
|
-
codeAction: false,
|
|
29
|
-
inlayHint: false,
|
|
30
|
-
};
|
|
31
|
-
embeddedFile.content.push([
|
|
32
|
-
script.content,
|
|
33
|
-
script.name,
|
|
34
|
-
0,
|
|
35
|
-
{},
|
|
36
|
-
]);
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
exports.default = plugin;
|
|
42
|
-
//# sourceMappingURL=vue-sfc-scripts.js.map
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const language_core_1 = require("@volar/language-core");
|
|
4
|
-
const styleReg = /^(.*)\.style_(\d+)\.([^.]+)$/;
|
|
5
|
-
const plugin = () => {
|
|
6
|
-
return {
|
|
7
|
-
version: 1,
|
|
8
|
-
getEmbeddedFileNames(fileName, sfc) {
|
|
9
|
-
const names = [];
|
|
10
|
-
for (let i = 0; i < sfc.styles.length; i++) {
|
|
11
|
-
const style = sfc.styles[i];
|
|
12
|
-
names.push(fileName + '.style_' + i + '.' + style.lang);
|
|
13
|
-
}
|
|
14
|
-
return names;
|
|
15
|
-
},
|
|
16
|
-
resolveEmbeddedFile(_fileName, sfc, embeddedFile) {
|
|
17
|
-
const match = embeddedFile.fileName.match(styleReg);
|
|
18
|
-
if (match) {
|
|
19
|
-
const index = parseInt(match[2]);
|
|
20
|
-
const style = sfc.styles[index];
|
|
21
|
-
embeddedFile.capabilities = language_core_1.FileCapabilities.full;
|
|
22
|
-
embeddedFile.content.push([
|
|
23
|
-
style.content,
|
|
24
|
-
style.name,
|
|
25
|
-
0,
|
|
26
|
-
language_core_1.FileRangeCapabilities.full,
|
|
27
|
-
]);
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
exports.default = plugin;
|
|
33
|
-
//# sourceMappingURL=vue-sfc-styles.js.map
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const language_core_1 = require("@volar/language-core");
|
|
4
|
-
const templateReg = /^(.*)\.template\.([^.]+)$/;
|
|
5
|
-
const plugin = () => {
|
|
6
|
-
return {
|
|
7
|
-
version: 1,
|
|
8
|
-
getEmbeddedFileNames(fileName, sfc) {
|
|
9
|
-
if (sfc.template) {
|
|
10
|
-
return [fileName + '.template.' + sfc.template.lang];
|
|
11
|
-
}
|
|
12
|
-
return [];
|
|
13
|
-
},
|
|
14
|
-
resolveEmbeddedFile(_fileName, sfc, embeddedFile) {
|
|
15
|
-
const match = embeddedFile.fileName.match(templateReg);
|
|
16
|
-
if (match && sfc.template) {
|
|
17
|
-
embeddedFile.capabilities = language_core_1.FileCapabilities.full;
|
|
18
|
-
embeddedFile.content.push([
|
|
19
|
-
sfc.template.content,
|
|
20
|
-
sfc.template.name,
|
|
21
|
-
0,
|
|
22
|
-
language_core_1.FileRangeCapabilities.full,
|
|
23
|
-
]);
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
exports.default = plugin;
|
|
29
|
-
//# sourceMappingURL=vue-sfc-template.js.map
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const plugin = ({ modules }) => {
|
|
4
|
-
return {
|
|
5
|
-
version: 1,
|
|
6
|
-
compileSFCTemplate(lang, template, options) {
|
|
7
|
-
if (lang === 'html') {
|
|
8
|
-
const compiler = modules['@vue/compiler-dom'];
|
|
9
|
-
return compiler.compile(template, {
|
|
10
|
-
...options,
|
|
11
|
-
comments: true,
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
updateSFCTemplate(oldResult, change) {
|
|
16
|
-
const CompilerDOM = modules['@vue/compiler-dom'];
|
|
17
|
-
const lengthDiff = change.newText.length - (change.end - change.start);
|
|
18
|
-
let hitNodes = [];
|
|
19
|
-
if (tryUpdateNode(oldResult.ast) && hitNodes.length) {
|
|
20
|
-
hitNodes = hitNodes.sort((a, b) => a.loc.source.length - b.loc.source.length);
|
|
21
|
-
const hitNode = hitNodes[0];
|
|
22
|
-
if (hitNode.type === 4 /* CompilerDOM.NodeTypes.SIMPLE_EXPRESSION */) {
|
|
23
|
-
return oldResult;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
function tryUpdateNode(node) {
|
|
27
|
-
if (withinChangeRange(node.loc)) {
|
|
28
|
-
hitNodes.push(node);
|
|
29
|
-
}
|
|
30
|
-
if (tryUpdateNodeLoc(node.loc)) {
|
|
31
|
-
if (node.type === 0 /* CompilerDOM.NodeTypes.ROOT */) {
|
|
32
|
-
for (const child of node.children) {
|
|
33
|
-
if (!tryUpdateNode(child)) {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
else if (node.type === 1 /* CompilerDOM.NodeTypes.ELEMENT */) {
|
|
39
|
-
if (withinChangeRange(node.loc)) {
|
|
40
|
-
// if not self closing, should not hit tag name
|
|
41
|
-
const start = node.loc.start.offset + 2;
|
|
42
|
-
const end = node.loc.start.offset + node.loc.source.lastIndexOf('</');
|
|
43
|
-
if (!withinChangeRange({ start: { offset: start }, end: { offset: end }, source: '' })) {
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
for (const prop of node.props) {
|
|
48
|
-
if (!tryUpdateNode(prop)) {
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
for (const child of node.children) {
|
|
53
|
-
if (!tryUpdateNode(child)) {
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
else if (node.type === 6 /* CompilerDOM.NodeTypes.ATTRIBUTE */) {
|
|
59
|
-
if (node.value && !tryUpdateNode(node.value)) {
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
else if (node.type === 7 /* CompilerDOM.NodeTypes.DIRECTIVE */) {
|
|
64
|
-
if (node.arg && withinChangeRange(node.arg.loc) && node.name === 'slot') {
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
if (node.exp && withinChangeRange(node.exp.loc) && node.name === 'for') { // #2266
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
|
-
if (node.arg && !tryUpdateNode(node.arg)) {
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
if (node.exp && !tryUpdateNode(node.exp)) {
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
else if (node.type === 12 /* CompilerDOM.NodeTypes.TEXT_CALL */) {
|
|
78
|
-
if (!tryUpdateNode(node.content)) {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
else if (node.type === 8 /* CompilerDOM.NodeTypes.COMPOUND_EXPRESSION */) {
|
|
83
|
-
for (const childNode of node.children) {
|
|
84
|
-
if (typeof childNode === 'object') {
|
|
85
|
-
if (!tryUpdateNode(childNode)) {
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
else if (node.type === 9 /* CompilerDOM.NodeTypes.IF */) {
|
|
92
|
-
for (const branch of node.branches) {
|
|
93
|
-
if (branch.condition && !tryUpdateNode(branch.condition)) {
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
for (const child of branch.children) {
|
|
97
|
-
if (!tryUpdateNode(child)) {
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
else if (node.type === 11 /* CompilerDOM.NodeTypes.FOR */) {
|
|
104
|
-
for (const child of [
|
|
105
|
-
node.parseResult.source,
|
|
106
|
-
node.parseResult.value,
|
|
107
|
-
node.parseResult.key,
|
|
108
|
-
node.parseResult.index,
|
|
109
|
-
]) {
|
|
110
|
-
if (child && !tryUpdateNode(child)) {
|
|
111
|
-
return false;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
for (const child of node.children) {
|
|
115
|
-
if (!tryUpdateNode(child)) {
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
else if (node.type === 5 /* CompilerDOM.NodeTypes.INTERPOLATION */) {
|
|
121
|
-
if (!tryUpdateNode(node.content)) {
|
|
122
|
-
return false;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
else if (node.type === 4 /* CompilerDOM.NodeTypes.SIMPLE_EXPRESSION */) {
|
|
126
|
-
if (withinChangeRange(node.loc)) { // TODO: review this (slot name?)
|
|
127
|
-
if (node.isStatic) {
|
|
128
|
-
return false;
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
node.content = node.loc.source;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
return true;
|
|
136
|
-
}
|
|
137
|
-
return false;
|
|
138
|
-
}
|
|
139
|
-
function tryUpdateNodeLoc(loc) {
|
|
140
|
-
delete loc.__endOffset;
|
|
141
|
-
if (withinChangeRange(loc)) {
|
|
142
|
-
loc.source =
|
|
143
|
-
loc.source.substring(0, change.start - loc.start.offset)
|
|
144
|
-
+ change.newText
|
|
145
|
-
+ loc.source.substring(change.end - loc.start.offset);
|
|
146
|
-
loc.__endOffset = loc.end.offset;
|
|
147
|
-
loc.end.offset += lengthDiff;
|
|
148
|
-
return true;
|
|
149
|
-
}
|
|
150
|
-
else if (change.end <= loc.start.offset) {
|
|
151
|
-
loc.__endOffset = loc.end.offset;
|
|
152
|
-
loc.start.offset += lengthDiff;
|
|
153
|
-
loc.end.offset += lengthDiff;
|
|
154
|
-
return true;
|
|
155
|
-
}
|
|
156
|
-
else if (change.start >= loc.end.offset) {
|
|
157
|
-
return true; // no need update
|
|
158
|
-
}
|
|
159
|
-
return false;
|
|
160
|
-
}
|
|
161
|
-
function withinChangeRange(loc) {
|
|
162
|
-
const originalLocEnd = loc.__endOffset ?? loc.end.offset;
|
|
163
|
-
return change.start >= loc.start.offset && change.end <= originalLocEnd;
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
};
|
|
167
|
-
};
|
|
168
|
-
exports.default = plugin;
|
|
169
|
-
//# sourceMappingURL=vue-template-html.js.map
|
package/out/plugins/vue-tsx.d.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { Sfc, VueLanguagePlugin } from '../types';
|
|
2
|
-
import * as muggle from 'muggle-string';
|
|
3
|
-
export declare const tsCodegen: WeakMap<Sfc, {
|
|
4
|
-
scriptRanges: () => {
|
|
5
|
-
exportDefault: (import("../types").TextRange & {
|
|
6
|
-
expression: import("../types").TextRange;
|
|
7
|
-
args: import("../types").TextRange;
|
|
8
|
-
argsNode: import("typescript/lib/tsserverlibrary").ObjectLiteralExpression | undefined;
|
|
9
|
-
componentsOption: import("../types").TextRange | undefined;
|
|
10
|
-
componentsOptionNode: import("typescript/lib/tsserverlibrary").ObjectLiteralExpression | undefined;
|
|
11
|
-
nameOption: import("../types").TextRange | undefined;
|
|
12
|
-
}) | undefined;
|
|
13
|
-
bindings: import("../types").TextRange[];
|
|
14
|
-
} | undefined;
|
|
15
|
-
scriptSetupRanges: () => {
|
|
16
|
-
leadingCommentEndOffset: number;
|
|
17
|
-
importSectionEndOffset: number;
|
|
18
|
-
bindings: import("../types").TextRange[];
|
|
19
|
-
props: {
|
|
20
|
-
name?: string | undefined;
|
|
21
|
-
define?: (import("../types").TextRange & {
|
|
22
|
-
statement: import("../types").TextRange;
|
|
23
|
-
arg?: import("../types").TextRange | undefined;
|
|
24
|
-
typeArg?: import("../types").TextRange | undefined;
|
|
25
|
-
}) | undefined;
|
|
26
|
-
withDefaults?: (import("../types").TextRange & {
|
|
27
|
-
arg?: import("../types").TextRange | undefined;
|
|
28
|
-
}) | undefined;
|
|
29
|
-
};
|
|
30
|
-
slots: {
|
|
31
|
-
name?: string | undefined;
|
|
32
|
-
define?: import("../types").TextRange | undefined;
|
|
33
|
-
};
|
|
34
|
-
emits: {
|
|
35
|
-
name?: string | undefined;
|
|
36
|
-
define?: import("../types").TextRange | undefined;
|
|
37
|
-
};
|
|
38
|
-
expose: {
|
|
39
|
-
name?: string | undefined;
|
|
40
|
-
define?: (import("../types").TextRange & {
|
|
41
|
-
arg?: import("../types").TextRange | undefined;
|
|
42
|
-
typeArg?: import("../types").TextRange | undefined;
|
|
43
|
-
}) | undefined;
|
|
44
|
-
};
|
|
45
|
-
defineProp: {
|
|
46
|
-
name: import("../types").TextRange | undefined;
|
|
47
|
-
nameIsString: boolean;
|
|
48
|
-
type: import("../types").TextRange | undefined;
|
|
49
|
-
defaultValue: import("../types").TextRange | undefined;
|
|
50
|
-
required: boolean;
|
|
51
|
-
}[];
|
|
52
|
-
} | undefined;
|
|
53
|
-
lang: () => string;
|
|
54
|
-
generatedScript: () => {
|
|
55
|
-
codes: muggle.Segment<import("@volar/language-core").FileRangeCapabilities>[];
|
|
56
|
-
codeStacks: muggle.StackNode[];
|
|
57
|
-
mirrorBehaviorMappings: import("@volar/source-map").Mapping<[import("@volar/language-core").MirrorBehaviorCapabilities, import("@volar/language-core").MirrorBehaviorCapabilities]>[];
|
|
58
|
-
};
|
|
59
|
-
generatedTemplate: () => {
|
|
60
|
-
codes: (string | [string, string | undefined, number | [number, number], import("@volar/language-core").FileRangeCapabilities])[];
|
|
61
|
-
codeStacks: muggle.StackNode[];
|
|
62
|
-
formatCodes: (string | [string, string | undefined, number | [number, number], import("@volar/language-core").FileRangeCapabilities])[];
|
|
63
|
-
formatCodeStacks: muggle.StackNode[];
|
|
64
|
-
cssCodes: (string | [string, string | undefined, number | [number, number], import("@volar/language-core").FileRangeCapabilities])[];
|
|
65
|
-
cssCodeStacks: muggle.StackNode[];
|
|
66
|
-
tagNames: Record<string, number[]>;
|
|
67
|
-
accessedGlobalVariables: Set<string>;
|
|
68
|
-
hasSlot: boolean;
|
|
69
|
-
} | undefined;
|
|
70
|
-
}>;
|
|
71
|
-
declare const plugin: VueLanguagePlugin;
|
|
72
|
-
export default plugin;
|
|
73
|
-
//# sourceMappingURL=vue-tsx.d.ts.map
|