@vue/language-core 2.0.0 → 2.0.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.
Files changed (63) hide show
  1. package/index.d.ts +13 -0
  2. package/index.js +31 -0
  3. package/lib/generators/script.d.ts +13 -0
  4. package/lib/generators/script.js +1060 -0
  5. package/lib/generators/template.d.ts +9 -0
  6. package/lib/generators/template.js +1567 -0
  7. package/lib/generators/utils.d.ts +6 -0
  8. package/lib/generators/utils.js +58 -0
  9. package/lib/languageModule.d.ts +5 -0
  10. package/lib/languageModule.js +114 -0
  11. package/lib/parsers/scriptRanges.d.ts +15 -0
  12. package/lib/parsers/scriptRanges.js +63 -0
  13. package/lib/parsers/scriptSetupRanges.d.ts +57 -0
  14. package/lib/parsers/scriptSetupRanges.js +298 -0
  15. package/lib/plugins/file-html.d.ts +3 -0
  16. package/lib/plugins/file-html.js +81 -0
  17. package/lib/plugins/file-md.d.ts +3 -0
  18. package/lib/plugins/file-md.js +71 -0
  19. package/lib/plugins/file-vue.d.ts +3 -0
  20. package/lib/plugins/file-vue.js +47 -0
  21. package/lib/plugins/vue-sfc-customblocks.d.ts +3 -0
  22. package/lib/plugins/vue-sfc-customblocks.js +28 -0
  23. package/lib/plugins/vue-sfc-scripts.d.ts +3 -0
  24. package/lib/plugins/vue-sfc-scripts.js +36 -0
  25. package/lib/plugins/vue-sfc-styles.d.ts +3 -0
  26. package/lib/plugins/vue-sfc-styles.js +28 -0
  27. package/lib/plugins/vue-sfc-template.d.ts +3 -0
  28. package/lib/plugins/vue-sfc-template.js +29 -0
  29. package/lib/plugins/vue-template-html.d.ts +3 -0
  30. package/lib/plugins/vue-template-html.js +169 -0
  31. package/lib/plugins/vue-tsx.d.ts +80 -0
  32. package/lib/plugins/vue-tsx.js +212 -0
  33. package/lib/plugins.d.ts +37 -0
  34. package/lib/plugins.js +64 -0
  35. package/lib/types.d.ts +142 -0
  36. package/lib/types.js +5 -0
  37. package/lib/utils/parseCssClassNames.d.ts +4 -0
  38. package/lib/utils/parseCssClassNames.js +19 -0
  39. package/lib/utils/parseCssVars.d.ts +5 -0
  40. package/lib/utils/parseCssVars.js +28 -0
  41. package/lib/utils/parseSfc.d.ts +2 -0
  42. package/lib/utils/parseSfc.js +121 -0
  43. package/lib/utils/shared.d.ts +3 -0
  44. package/lib/utils/shared.js +20 -0
  45. package/lib/utils/transform.d.ts +8 -0
  46. package/lib/utils/transform.js +195 -0
  47. package/lib/utils/ts.d.ts +8 -0
  48. package/lib/utils/ts.js +225 -0
  49. package/lib/utils/vue2TemplateCompiler.d.ts +2 -0
  50. package/lib/utils/vue2TemplateCompiler.js +89 -0
  51. package/lib/virtualFile/computedFiles.d.ts +3 -0
  52. package/lib/virtualFile/computedFiles.js +217 -0
  53. package/lib/virtualFile/computedMappings.d.ts +4 -0
  54. package/lib/virtualFile/computedMappings.js +36 -0
  55. package/lib/virtualFile/computedSfc.d.ts +4 -0
  56. package/lib/virtualFile/computedSfc.js +197 -0
  57. package/lib/virtualFile/computedVueSfc.d.ts +4 -0
  58. package/lib/virtualFile/computedVueSfc.js +41 -0
  59. package/lib/virtualFile/embeddedFile.d.ts +12 -0
  60. package/lib/virtualFile/embeddedFile.js +15 -0
  61. package/lib/virtualFile/vueFile.d.ts +25 -0
  62. package/lib/virtualFile/vueFile.js +43 -0
  63. package/package.json +4 -4
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const sfcBlockReg = /\<(script|style)\b([\s\S]*?)\>([\s\S]*?)\<\/\1\>/g;
4
+ const langReg = /\blang\s*=\s*(['\"]?)(\S*)\b\1/;
5
+ const plugin = () => {
6
+ return {
7
+ version: 2,
8
+ parseSFC(fileName, content) {
9
+ if (fileName.endsWith('.html')) {
10
+ let sfc = {
11
+ descriptor: {
12
+ filename: fileName,
13
+ source: content,
14
+ template: null,
15
+ script: null,
16
+ scriptSetup: null,
17
+ styles: [],
18
+ customBlocks: [],
19
+ cssVars: [],
20
+ shouldForceReload: () => false,
21
+ slotted: false,
22
+ },
23
+ errors: [],
24
+ };
25
+ let templateContent = content;
26
+ for (const match of content.matchAll(sfcBlockReg)) {
27
+ const matchText = match[0];
28
+ const tag = match[1];
29
+ const attrs = match[2];
30
+ const lang = attrs.match(langReg)?.[2];
31
+ const content = match[3];
32
+ const contentStart = match.index + matchText.indexOf(content);
33
+ if (tag === 'style') {
34
+ sfc.descriptor.styles.push({
35
+ attrs: {},
36
+ content,
37
+ loc: {
38
+ start: { column: -1, line: -1, offset: contentStart },
39
+ end: { column: -1, line: -1, offset: contentStart + content.length },
40
+ source: content,
41
+ },
42
+ type: 'style',
43
+ lang,
44
+ });
45
+ }
46
+ // ignore `<script src="...">`
47
+ else if (tag === 'script' && attrs.indexOf('src=') === -1) {
48
+ let type = attrs.indexOf('type=') >= 0 ? 'scriptSetup' : 'script';
49
+ sfc.descriptor[type] = {
50
+ attrs: {},
51
+ content,
52
+ loc: {
53
+ start: { column: -1, line: -1, offset: contentStart },
54
+ end: { column: -1, line: -1, offset: contentStart + content.length },
55
+ source: content,
56
+ },
57
+ type: 'script',
58
+ lang,
59
+ };
60
+ }
61
+ templateContent = templateContent.substring(0, match.index) + ' '.repeat(matchText.length) + templateContent.substring(match.index + matchText.length);
62
+ }
63
+ sfc.descriptor.template = {
64
+ attrs: {},
65
+ content: templateContent,
66
+ loc: {
67
+ start: { column: -1, line: -1, offset: 0 },
68
+ end: { column: -1, line: -1, offset: templateContent.length },
69
+ source: templateContent,
70
+ },
71
+ type: 'template',
72
+ ast: {},
73
+ };
74
+ return sfc;
75
+ }
76
+ ;
77
+ }
78
+ };
79
+ };
80
+ exports.default = plugin;
81
+ //# sourceMappingURL=file-html.js.map
@@ -0,0 +1,3 @@
1
+ import type { VueLanguagePlugin } from '../types';
2
+ declare const plugin: VueLanguagePlugin;
3
+ export default plugin;
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const language_core_1 = require("@volar/language-core");
4
+ const parseSfc_1 = require("../utils/parseSfc");
5
+ const codeblockReg = /(`{3,})[\s\S]+?\1/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: 2,
15
+ parseSFC(fileName, content) {
16
+ if (fileName.endsWith('.md')) {
17
+ content = content
18
+ // code block
19
+ .replace(codeblockReg, (match, quotes) => quotes + ' '.repeat(match.length - quotes.length * 2) + quotes)
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 language_core_1.SourceMap((0, language_core_1.buildMappings)(codes));
44
+ const sfc = (0, parseSfc_1.parse)((0, language_core_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.getSourceOffset(block.loc.start.offset)?.[0] ?? -1;
63
+ block.loc.end.offset = file2VueSourceMap.getSourceOffset(block.loc.end.offset)?.[0] ?? -1;
64
+ }
65
+ }
66
+ ;
67
+ }
68
+ };
69
+ };
70
+ exports.default = plugin;
71
+ //# sourceMappingURL=file-md.js.map
@@ -0,0 +1,3 @@
1
+ import type { VueLanguagePlugin } from '../types';
2
+ declare const plugin: VueLanguagePlugin;
3
+ export default plugin;
@@ -0,0 +1,47 @@
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: 2,
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
+ const oldContent = hitBlock.content;
23
+ const newContent = hitBlock.content =
24
+ hitBlock.content.substring(0, change.start - hitBlock.loc.start.offset)
25
+ + change.newText
26
+ + hitBlock.content.substring(change.end - hitBlock.loc.start.offset);
27
+ // #3449
28
+ const endTagRegex = new RegExp(`</\\s*${hitBlock.type}\\s*>`);
29
+ const insertedEndTag = !!oldContent.match(endTagRegex) !== !!newContent.match(endTagRegex);
30
+ if (insertedEndTag) {
31
+ return;
32
+ }
33
+ const lengthDiff = change.newText.length - (change.end - change.start);
34
+ for (const block of blocks) {
35
+ if (block.loc.start.offset > change.end) {
36
+ block.loc.start.offset += lengthDiff;
37
+ }
38
+ if (block.loc.end.offset >= change.end) {
39
+ block.loc.end.offset += lengthDiff;
40
+ }
41
+ }
42
+ return sfc;
43
+ },
44
+ };
45
+ };
46
+ exports.default = plugin;
47
+ //# sourceMappingURL=file-vue.js.map
@@ -0,0 +1,3 @@
1
+ import type { VueLanguagePlugin } from '../types';
2
+ declare const plugin: VueLanguagePlugin;
3
+ export default plugin;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("../generators/utils");
4
+ const plugin = () => {
5
+ return {
6
+ version: 2,
7
+ getEmbeddedCodes(_fileName, sfc) {
8
+ return sfc.customBlocks.map((customBlock, i) => ({
9
+ id: 'customBlock_' + i,
10
+ lang: customBlock.lang,
11
+ }));
12
+ },
13
+ resolveEmbeddedCode(_fileName, sfc, embeddedFile) {
14
+ if (embeddedFile.id.startsWith('customBlock_')) {
15
+ const index = parseInt(embeddedFile.id.slice('customBlock_'.length));
16
+ const customBlock = sfc.customBlocks[index];
17
+ embeddedFile.content.push([
18
+ customBlock.content,
19
+ customBlock.name,
20
+ 0,
21
+ (0, utils_1.enableAllFeatures)({}),
22
+ ]);
23
+ }
24
+ },
25
+ };
26
+ };
27
+ exports.default = plugin;
28
+ //# sourceMappingURL=vue-sfc-customblocks.js.map
@@ -0,0 +1,3 @@
1
+ import type { VueLanguagePlugin } from '../types';
2
+ declare const plugin: VueLanguagePlugin;
3
+ export default plugin;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("../generators/utils");
4
+ const plugin = () => {
5
+ return {
6
+ version: 2,
7
+ getEmbeddedCodes(_fileName, sfc) {
8
+ const names = [];
9
+ if (sfc.script) {
10
+ names.push({ id: 'scriptFormat', lang: sfc.script.lang });
11
+ }
12
+ if (sfc.scriptSetup) {
13
+ names.push({ id: 'scriptSetupFormat', lang: sfc.scriptSetup.lang });
14
+ }
15
+ return names;
16
+ },
17
+ resolveEmbeddedCode(_fileName, sfc, embeddedFile) {
18
+ const script = embeddedFile.id === 'scriptFormat' ? sfc.script
19
+ : embeddedFile.id === 'scriptSetupFormat' ? sfc.scriptSetup
20
+ : undefined;
21
+ if (script) {
22
+ embeddedFile.content.push([
23
+ script.content,
24
+ script.name,
25
+ 0,
26
+ (0, utils_1.disableAllFeatures)({
27
+ structure: true,
28
+ format: true,
29
+ }),
30
+ ]);
31
+ }
32
+ },
33
+ };
34
+ };
35
+ exports.default = plugin;
36
+ //# sourceMappingURL=vue-sfc-scripts.js.map
@@ -0,0 +1,3 @@
1
+ import type { VueLanguagePlugin } from '../types';
2
+ declare const plugin: VueLanguagePlugin;
3
+ export default plugin;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("../generators/utils");
4
+ const plugin = () => {
5
+ return {
6
+ version: 2,
7
+ getEmbeddedCodes(_fileName, sfc) {
8
+ return sfc.styles.map((style, i) => ({
9
+ id: 'style_' + i,
10
+ lang: style.lang,
11
+ }));
12
+ },
13
+ resolveEmbeddedCode(_fileName, sfc, embeddedFile) {
14
+ if (embeddedFile.id.startsWith('style_')) {
15
+ const index = parseInt(embeddedFile.id.slice('style_'.length));
16
+ const style = sfc.styles[index];
17
+ embeddedFile.content.push([
18
+ style.content,
19
+ style.name,
20
+ 0,
21
+ (0, utils_1.enableAllFeatures)({}),
22
+ ]);
23
+ }
24
+ },
25
+ };
26
+ };
27
+ exports.default = plugin;
28
+ //# sourceMappingURL=vue-sfc-styles.js.map
@@ -0,0 +1,3 @@
1
+ import type { VueLanguagePlugin } from '../types';
2
+ declare const plugin: VueLanguagePlugin;
3
+ export default plugin;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("../generators/utils");
4
+ const plugin = () => {
5
+ return {
6
+ version: 2,
7
+ getEmbeddedCodes(_fileName, sfc) {
8
+ if (sfc.template) {
9
+ return [{
10
+ id: 'template',
11
+ lang: sfc.template.lang,
12
+ }];
13
+ }
14
+ return [];
15
+ },
16
+ resolveEmbeddedCode(_fileName, sfc, embeddedFile) {
17
+ if (embeddedFile.id === 'template' && sfc.template) {
18
+ embeddedFile.content.push([
19
+ sfc.template.content,
20
+ sfc.template.name,
21
+ 0,
22
+ (0, utils_1.enableAllFeatures)({}),
23
+ ]);
24
+ }
25
+ },
26
+ };
27
+ };
28
+ exports.default = plugin;
29
+ //# sourceMappingURL=vue-sfc-template.js.map
@@ -0,0 +1,3 @@
1
+ import type { VueLanguagePlugin } from '../types';
2
+ declare const plugin: VueLanguagePlugin;
3
+ export default plugin;
@@ -0,0 +1,169 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const plugin = ({ modules }) => {
4
+ return {
5
+ version: 2,
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 === 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 === 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 === 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 === CompilerDOM.NodeTypes.ATTRIBUTE) {
59
+ if (node.value && !tryUpdateNode(node.value)) {
60
+ return false;
61
+ }
62
+ }
63
+ else if (node.type === 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 === CompilerDOM.NodeTypes.TEXT_CALL) {
78
+ if (!tryUpdateNode(node.content)) {
79
+ return false;
80
+ }
81
+ }
82
+ else if (node.type === 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 === 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 === 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 === CompilerDOM.NodeTypes.INTERPOLATION) {
121
+ if (!tryUpdateNode(node.content)) {
122
+ return false;
123
+ }
124
+ }
125
+ else if (node.type === 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
@@ -0,0 +1,80 @@
1
+ import { Mapping, StackNode } from '@volar/language-core';
2
+ import type { Code, Sfc, VueLanguagePlugin } from '../types';
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").ObjectLiteralExpression | undefined;
9
+ componentsOption: import("../types").TextRange | undefined;
10
+ componentsOptionNode: import("typescript").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
+ arg?: import("../types").TextRange | undefined;
23
+ typeArg?: import("../types").TextRange | undefined;
24
+ } & {
25
+ statement: import("../types").TextRange;
26
+ }) | undefined;
27
+ withDefaults?: (import("../types").TextRange & {
28
+ arg?: import("../types").TextRange | undefined;
29
+ }) | undefined;
30
+ };
31
+ slots: {
32
+ name?: string | undefined;
33
+ define?: (import("../types").TextRange & {
34
+ arg?: import("../types").TextRange | undefined;
35
+ typeArg?: import("../types").TextRange | undefined;
36
+ }) | undefined;
37
+ };
38
+ emits: {
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
+ expose: {
46
+ name?: string | undefined;
47
+ define?: (import("../types").TextRange & {
48
+ arg?: import("../types").TextRange | undefined;
49
+ typeArg?: import("../types").TextRange | undefined;
50
+ }) | undefined;
51
+ };
52
+ defineProp: {
53
+ name: import("../types").TextRange | undefined;
54
+ nameIsString: boolean;
55
+ type: import("../types").TextRange | undefined;
56
+ defaultValue: import("../types").TextRange | undefined;
57
+ required: boolean;
58
+ isModel?: boolean | undefined;
59
+ }[];
60
+ } | undefined;
61
+ lang: () => string;
62
+ generatedScript: () => {
63
+ codes: Code[];
64
+ codeStacks: StackNode[];
65
+ linkedCodeMappings: Mapping<any>[];
66
+ };
67
+ generatedTemplate: () => {
68
+ codes: Code[];
69
+ codeStacks: string[];
70
+ formatCodes: Code[];
71
+ formatCodeStacks: string[];
72
+ cssCodes: Code[];
73
+ cssCodeStacks: string[];
74
+ tagOffsetsMap: Map<string, number[]>;
75
+ accessedGlobalVariables: Set<string>;
76
+ hasSlot: boolean;
77
+ } | undefined;
78
+ }>;
79
+ declare const plugin: VueLanguagePlugin;
80
+ export default plugin;