@vue/language-service 3.0.0-beta.3 → 3.0.0-beta.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/nameCasing.js +6 -6
- package/lib/plugins/utils.js +4 -4
- package/lib/plugins/vue-autoinsert-dotvalue.js +2 -1
- package/lib/plugins/vue-complete-define-assignment.js +1 -1
- package/lib/plugins/vue-document-drop.js +9 -7
- package/lib/plugins/vue-document-links.js +5 -3
- package/lib/plugins/vue-extract-file.js +11 -8
- package/lib/plugins/vue-inlayhints.js +22 -20
- package/lib/plugins/vue-missing-props-hints.js +1 -1
- package/lib/plugins/vue-sfc.js +25 -17
- package/lib/plugins/vue-template.js +12 -6
- package/lib/plugins/vue-twoslash-queries.js +5 -2
- package/package.json +7 -7
- package/scripts/update-html-data.js +14 -18
package/lib/nameCasing.js
CHANGED
|
@@ -16,17 +16,17 @@ var AttrNameCasing;
|
|
|
16
16
|
async function checkCasing(context, uri) {
|
|
17
17
|
const detected = detect(context, uri);
|
|
18
18
|
const [attr, tag] = await Promise.all([
|
|
19
|
-
context.env.getConfiguration?.('vue.
|
|
20
|
-
context.env.getConfiguration?.('vue.
|
|
19
|
+
context.env.getConfiguration?.('vue.suggest.propNameCasing', uri.toString()),
|
|
20
|
+
context.env.getConfiguration?.('vue.suggest.componentNameCasing', uri.toString()),
|
|
21
21
|
]);
|
|
22
|
-
const tagNameCasing = detected.tag.length === 1 && (tag === '
|
|
22
|
+
const tagNameCasing = detected.tag.length === 1 && (tag === 'preferPascalCase' || tag === 'preferKebabCase')
|
|
23
23
|
? detected.tag[0]
|
|
24
|
-
: (tag === '
|
|
24
|
+
: (tag === 'preferKebabCase' || tag === 'alwaysKebabCase')
|
|
25
25
|
? TagNameCasing.Kebab
|
|
26
26
|
: TagNameCasing.Pascal;
|
|
27
|
-
const attrNameCasing = detected.attr.length === 1 && (attr === '
|
|
27
|
+
const attrNameCasing = detected.attr.length === 1 && (attr === 'preferCamelCase' || attr === 'preferKebabCase')
|
|
28
28
|
? detected.attr[0]
|
|
29
|
-
: (attr === '
|
|
29
|
+
: (attr === 'preferCamelCase' || attr === 'alwaysCamelCase')
|
|
30
30
|
? AttrNameCasing.Camel
|
|
31
31
|
: AttrNameCasing.Kebab;
|
|
32
32
|
return {
|
package/lib/plugins/utils.js
CHANGED
|
@@ -6,9 +6,9 @@ function sleep(ms) {
|
|
|
6
6
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
7
7
|
}
|
|
8
8
|
function isTsDocument(document) {
|
|
9
|
-
return document.languageId === 'javascript'
|
|
10
|
-
document.languageId === 'typescript'
|
|
11
|
-
document.languageId === 'javascriptreact'
|
|
12
|
-
document.languageId === 'typescriptreact';
|
|
9
|
+
return document.languageId === 'javascript'
|
|
10
|
+
|| document.languageId === 'typescript'
|
|
11
|
+
|| document.languageId === 'javascriptreact'
|
|
12
|
+
|| document.languageId === 'typescriptreact';
|
|
13
13
|
}
|
|
14
14
|
//# sourceMappingURL=utils.js.map
|
|
@@ -123,7 +123,8 @@ function isBlacklistNode(ts, node, pos, allowAccessDotValue) {
|
|
|
123
123
|
else if (ts.isTypeReferenceNode(node)) {
|
|
124
124
|
return true;
|
|
125
125
|
}
|
|
126
|
-
else if (!allowAccessDotValue && ts.isPropertyAccessExpression(node) && node.expression.end === pos
|
|
126
|
+
else if (!allowAccessDotValue && ts.isPropertyAccessExpression(node) && node.expression.end === pos
|
|
127
|
+
&& node.name.text === 'value') {
|
|
127
128
|
return true;
|
|
128
129
|
}
|
|
129
130
|
else if (ts.isCallExpression(node)
|
|
@@ -17,7 +17,7 @@ function create() {
|
|
|
17
17
|
if (!(0, utils_1.isTsDocument)(document)) {
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
|
-
const enabled = await context.env.getConfiguration?.('vue.
|
|
20
|
+
const enabled = await context.env.getConfiguration?.('vue.suggest.defineAssignment') ?? true;
|
|
21
21
|
if (!enabled) {
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
@@ -80,13 +80,15 @@ function create(ts, getTsPluginClient) {
|
|
|
80
80
|
additionalEdit.changes ??= {};
|
|
81
81
|
additionalEdit.changes[embeddedDocumentUriStr] = [];
|
|
82
82
|
additionalEdit.changes[embeddedDocumentUriStr].push({
|
|
83
|
-
range: lastImportNode
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
83
|
+
range: lastImportNode
|
|
84
|
+
? {
|
|
85
|
+
start: script.ast.getLineAndCharacterOfPosition(lastImportNode.end),
|
|
86
|
+
end: script.ast.getLineAndCharacterOfPosition(lastImportNode.end),
|
|
87
|
+
}
|
|
88
|
+
: {
|
|
89
|
+
start: script.ast.getLineAndCharacterOfPosition(0),
|
|
90
|
+
end: script.ast.getLineAndCharacterOfPosition(0),
|
|
91
|
+
},
|
|
90
92
|
newText: `\nimport ${newName} from '${importPath}'`
|
|
91
93
|
+ (lastImportNode ? '' : '\n'),
|
|
92
94
|
});
|
|
@@ -16,7 +16,7 @@ function create() {
|
|
|
16
16
|
const decoded = context.decodeEmbeddedDocumentUri(uri);
|
|
17
17
|
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
18
18
|
const virtualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
|
|
19
|
-
if (!sourceScript?.generated || (virtualCode?.id !== 'template' && virtualCode?.id !==
|
|
19
|
+
if (!sourceScript?.generated || (virtualCode?.id !== 'template' && virtualCode?.id !== 'scriptsetup_raw')) {
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
22
|
const root = sourceScript.generated.root;
|
|
@@ -62,7 +62,8 @@ function create() {
|
|
|
62
62
|
start: document.positionAt(offset),
|
|
63
63
|
end: document.positionAt(offset + className.length),
|
|
64
64
|
},
|
|
65
|
-
target: context.encodeEmbeddedDocumentUri(decoded[0], 'style_' + style.index)
|
|
65
|
+
target: context.encodeEmbeddedDocumentUri(decoded[0], 'style_' + style.index)
|
|
66
|
+
+ `#L${start.line + 1},${start.character + 1}-L${end.line + 1},${end.character + 1}`,
|
|
66
67
|
});
|
|
67
68
|
}
|
|
68
69
|
}
|
|
@@ -93,7 +94,8 @@ function create() {
|
|
|
93
94
|
start: document.positionAt(arg.start + 1),
|
|
94
95
|
end: document.positionAt(arg.end - 1),
|
|
95
96
|
},
|
|
96
|
-
target: templateDocumentUri
|
|
97
|
+
target: templateDocumentUri
|
|
98
|
+
+ `#L${start.line + 1},${start.character + 1}-L${end.line + 1},${end.character + 1}`,
|
|
97
99
|
});
|
|
98
100
|
}
|
|
99
101
|
}
|
|
@@ -87,7 +87,8 @@ function create(ts, getTsPluginClient) {
|
|
|
87
87
|
return codeAction;
|
|
88
88
|
}
|
|
89
89
|
const templateInitialIndent = await context.env.getConfiguration('vue.format.template.initialIndent') ?? true;
|
|
90
|
-
const scriptInitialIndent = await context.env.getConfiguration('vue.format.script.initialIndent')
|
|
90
|
+
const scriptInitialIndent = await context.env.getConfiguration('vue.format.script.initialIndent')
|
|
91
|
+
?? false;
|
|
91
92
|
const document = context.documents.get(parsedUri, virtualCode.languageId, virtualCode.snapshot);
|
|
92
93
|
const sfcDocument = context.documents.get(sourceScript.id, sourceScript.languageId, sourceScript.snapshot);
|
|
93
94
|
const newUri = sfcDocument.uri.slice(0, sfcDocument.uri.lastIndexOf('/') + 1) + `${newName}.vue`;
|
|
@@ -111,13 +112,15 @@ function create(ts, getTsPluginClient) {
|
|
|
111
112
|
];
|
|
112
113
|
const sfcEdits = [
|
|
113
114
|
{
|
|
114
|
-
range: lastImportNode
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
115
|
+
range: lastImportNode
|
|
116
|
+
? {
|
|
117
|
+
start: sfcDocument.positionAt(script.startTagEnd + lastImportNode.end),
|
|
118
|
+
end: sfcDocument.positionAt(script.startTagEnd + lastImportNode.end),
|
|
119
|
+
}
|
|
120
|
+
: {
|
|
121
|
+
start: sfcDocument.positionAt(script.startTagEnd),
|
|
122
|
+
end: sfcDocument.positionAt(script.startTagEnd),
|
|
123
|
+
},
|
|
121
124
|
newText: `\nimport ${newName} from './${newName}.vue'`,
|
|
122
125
|
},
|
|
123
126
|
];
|
|
@@ -75,10 +75,12 @@ function create(ts) {
|
|
|
75
75
|
paddingLeft: hint.paddingLeft,
|
|
76
76
|
position: document.positionAt(hintOffset),
|
|
77
77
|
kind: 2,
|
|
78
|
-
tooltip: hint.tooltip
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
tooltip: hint.tooltip
|
|
79
|
+
? {
|
|
80
|
+
kind: 'markdown',
|
|
81
|
+
value: hint.tooltip,
|
|
82
|
+
}
|
|
83
|
+
: undefined,
|
|
82
84
|
});
|
|
83
85
|
}
|
|
84
86
|
return result;
|
|
@@ -100,7 +102,7 @@ function findDestructuredProps(ts, ast, props) {
|
|
|
100
102
|
rootScope[prop] = true;
|
|
101
103
|
}
|
|
102
104
|
function pushScope() {
|
|
103
|
-
scopeStack.push(
|
|
105
|
+
scopeStack.push(currentScope = Object.create(currentScope));
|
|
104
106
|
}
|
|
105
107
|
function popScope() {
|
|
106
108
|
scopeStack.pop();
|
|
@@ -123,20 +125,20 @@ function findDestructuredProps(ts, ast, props) {
|
|
|
123
125
|
walkVariableDeclaration(decl, isRoot);
|
|
124
126
|
}
|
|
125
127
|
}
|
|
126
|
-
else if (ts.isFunctionDeclaration(stmt)
|
|
127
|
-
ts.isClassDeclaration(stmt)) {
|
|
128
|
+
else if (ts.isFunctionDeclaration(stmt)
|
|
129
|
+
|| ts.isClassDeclaration(stmt)) {
|
|
128
130
|
const declare = ts.getModifiers(stmt)?.find(modifier => modifier.kind === ts.SyntaxKind.DeclareKeyword);
|
|
129
131
|
if (!stmt.name || declare) {
|
|
130
132
|
return;
|
|
131
133
|
}
|
|
132
134
|
registerLocalBinding(stmt.name);
|
|
133
135
|
}
|
|
134
|
-
else if ((ts.isForOfStatement(stmt) || ts.isForInStatement(stmt))
|
|
135
|
-
ts.isVariableDeclarationList(stmt.initializer)) {
|
|
136
|
+
else if ((ts.isForOfStatement(stmt) || ts.isForInStatement(stmt))
|
|
137
|
+
&& ts.isVariableDeclarationList(stmt.initializer)) {
|
|
136
138
|
walkVariableDeclaration(stmt.initializer.declarations[0], isRoot);
|
|
137
139
|
}
|
|
138
|
-
else if (ts.isLabeledStatement(stmt)
|
|
139
|
-
ts.isVariableDeclaration(stmt.statement)) {
|
|
140
|
+
else if (ts.isLabeledStatement(stmt)
|
|
141
|
+
&& ts.isVariableDeclaration(stmt.statement)) {
|
|
140
142
|
walkVariableDeclaration(stmt.statement, isRoot);
|
|
141
143
|
}
|
|
142
144
|
});
|
|
@@ -178,8 +180,8 @@ function findDestructuredProps(ts, ast, props) {
|
|
|
178
180
|
if (parent) {
|
|
179
181
|
parentStack.push(parent);
|
|
180
182
|
}
|
|
181
|
-
if (ts.isTypeLiteralNode(node)
|
|
182
|
-
ts.isTypeReferenceNode(node)) {
|
|
183
|
+
if (ts.isTypeLiteralNode(node)
|
|
184
|
+
|| ts.isTypeReferenceNode(node)) {
|
|
183
185
|
return false;
|
|
184
186
|
}
|
|
185
187
|
if (ts.isFunctionLike(node)) {
|
|
@@ -237,15 +239,15 @@ function findDestructuredProps(ts, ast, props) {
|
|
|
237
239
|
if (id.text === 'arguments') {
|
|
238
240
|
return false;
|
|
239
241
|
}
|
|
240
|
-
if (ts.isExpressionWithTypeArguments(parent)
|
|
241
|
-
ts.isInterfaceDeclaration(parent)
|
|
242
|
-
ts.isTypeAliasDeclaration(parent)
|
|
243
|
-
ts.isPropertySignature(parent)) {
|
|
242
|
+
if (ts.isExpressionWithTypeArguments(parent)
|
|
243
|
+
|| ts.isInterfaceDeclaration(parent)
|
|
244
|
+
|| ts.isTypeAliasDeclaration(parent)
|
|
245
|
+
|| ts.isPropertySignature(parent)) {
|
|
244
246
|
return false;
|
|
245
247
|
}
|
|
246
|
-
if (ts.isPropertyAccessExpression(parent)
|
|
247
|
-
ts.isPropertyAssignment(parent)
|
|
248
|
-
ts.isPropertyDeclaration(parent)) {
|
|
248
|
+
if (ts.isPropertyAccessExpression(parent)
|
|
249
|
+
|| ts.isPropertyAssignment(parent)
|
|
250
|
+
|| ts.isPropertyDeclaration(parent)) {
|
|
249
251
|
if (parent.name === id) {
|
|
250
252
|
return false;
|
|
251
253
|
}
|
|
@@ -99,7 +99,7 @@ function create(getTsPluginClient) {
|
|
|
99
99
|
attrText = attrText.slice('v-model:'.length);
|
|
100
100
|
}
|
|
101
101
|
else if (attrText === 'v-model') {
|
|
102
|
-
attrText = 'modelValue'; // TODO: support for experimentalModelPropName?
|
|
102
|
+
attrText = context.project.vue.compilerOptions.target >= 3 ? 'modelValue' : 'value'; // TODO: support for experimentalModelPropName?
|
|
103
103
|
}
|
|
104
104
|
else if (attrText.startsWith('v-on:')) {
|
|
105
105
|
attrText = 'on-' + (0, language_core_1.hyphenateAttr)(attrText.slice('v-on:'.length));
|
package/lib/plugins/vue-sfc.js
CHANGED
|
@@ -28,8 +28,10 @@ function create() {
|
|
|
28
28
|
wrapAttributes: await context.env.getConfiguration?.('vue.format.wrapAttributes') ?? 'auto',
|
|
29
29
|
unformatted: '',
|
|
30
30
|
contentUnformatted: blockTypes.join(','),
|
|
31
|
-
endWithNewline: options.insertFinalNewline
|
|
32
|
-
|
|
31
|
+
endWithNewline: options.insertFinalNewline
|
|
32
|
+
? true
|
|
33
|
+
: options.trimFinalNewlines
|
|
34
|
+
? false
|
|
33
35
|
: document.getText().endsWith('\n'),
|
|
34
36
|
};
|
|
35
37
|
}) ?? {};
|
|
@@ -193,9 +195,9 @@ function create() {
|
|
|
193
195
|
if (!result) {
|
|
194
196
|
return;
|
|
195
197
|
}
|
|
196
|
-
result.items = result.items.filter(item => item.label !== '!DOCTYPE'
|
|
197
|
-
item.label !== 'Custom Blocks'
|
|
198
|
-
item.label !== 'data-');
|
|
198
|
+
result.items = result.items.filter(item => item.label !== '!DOCTYPE'
|
|
199
|
+
&& item.label !== 'Custom Blocks'
|
|
200
|
+
&& item.label !== 'data-');
|
|
199
201
|
const tags = sfcDataProvider?.provideTags();
|
|
200
202
|
const scriptLangs = getLangs('script');
|
|
201
203
|
const scriptItems = result.items.filter(item => item.label === 'script' || item.label === 'script setup');
|
|
@@ -208,10 +210,12 @@ function create() {
|
|
|
208
210
|
detail: `.${lang}`,
|
|
209
211
|
kind: 17,
|
|
210
212
|
label: scriptItem.label + ' lang="' + lang + '"',
|
|
211
|
-
textEdit: scriptItem.textEdit
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
213
|
+
textEdit: scriptItem.textEdit
|
|
214
|
+
? {
|
|
215
|
+
...scriptItem.textEdit,
|
|
216
|
+
newText: scriptItem.textEdit.newText + ' lang="' + lang + '"',
|
|
217
|
+
}
|
|
218
|
+
: undefined,
|
|
215
219
|
});
|
|
216
220
|
}
|
|
217
221
|
}
|
|
@@ -238,10 +242,12 @@ function create() {
|
|
|
238
242
|
kind: 17,
|
|
239
243
|
detail: `.${lang}`,
|
|
240
244
|
label: templateItem.label + ' lang="' + lang + '"',
|
|
241
|
-
textEdit: templateItem.textEdit
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
+
textEdit: templateItem.textEdit
|
|
246
|
+
? {
|
|
247
|
+
...templateItem.textEdit,
|
|
248
|
+
newText: templateItem.textEdit.newText + ' lang="' + lang + '"',
|
|
249
|
+
}
|
|
250
|
+
: undefined,
|
|
245
251
|
});
|
|
246
252
|
}
|
|
247
253
|
}
|
|
@@ -275,10 +281,12 @@ function getStyleCompletionItem(styleItem, lang, attr) {
|
|
|
275
281
|
kind: 17,
|
|
276
282
|
detail: lang === 'postcss' ? '.css' : `.${lang}`,
|
|
277
283
|
label: styleItem.label + ' lang="' + lang + '"' + (attr ? ` ${attr}` : ''),
|
|
278
|
-
textEdit: styleItem.textEdit
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
284
|
+
textEdit: styleItem.textEdit
|
|
285
|
+
? {
|
|
286
|
+
...styleItem.textEdit,
|
|
287
|
+
newText: styleItem.textEdit.newText + ' lang="' + lang + '"' + (attr ? ` ${attr}` : ''),
|
|
288
|
+
}
|
|
289
|
+
: undefined,
|
|
282
290
|
};
|
|
283
291
|
}
|
|
284
292
|
//# sourceMappingURL=vue-sfc.js.map
|
|
@@ -107,7 +107,9 @@ function create(mode, getTsPluginClient) {
|
|
|
107
107
|
}
|
|
108
108
|
if (vModel) {
|
|
109
109
|
for (const modifier of modelData.globalAttributes ?? []) {
|
|
110
|
-
const description = typeof modifier.description === 'object'
|
|
110
|
+
const description = typeof modifier.description === 'object'
|
|
111
|
+
? modifier.description.value
|
|
112
|
+
: modifier.description;
|
|
111
113
|
const references = modifier.references?.map(ref => `[${ref.name}](${ref.url})`).join(' | ');
|
|
112
114
|
vModelModifiers[modifier.name] = description + '\n\n' + references;
|
|
113
115
|
}
|
|
@@ -374,9 +376,12 @@ function create(mode, getTsPluginClient) {
|
|
|
374
376
|
const isVOn = text.startsWith('v-on:') || text.startsWith('@') && text.length > 1;
|
|
375
377
|
const isVBind = text.startsWith('v-bind:') || text.startsWith(':') && text.length > 1;
|
|
376
378
|
const isVModel = text.startsWith('v-model:') || text === 'v-model';
|
|
377
|
-
const currentModifiers = isVOn
|
|
378
|
-
|
|
379
|
-
|
|
379
|
+
const currentModifiers = isVOn
|
|
380
|
+
? vOnModifiers
|
|
381
|
+
: isVBind
|
|
382
|
+
? vBindModifiers
|
|
383
|
+
: isVModel
|
|
384
|
+
? vModelModifiers
|
|
380
385
|
: undefined;
|
|
381
386
|
if (!currentModifiers) {
|
|
382
387
|
return;
|
|
@@ -420,7 +425,6 @@ function create(mode, getTsPluginClient) {
|
|
|
420
425
|
if (item.textEdit) {
|
|
421
426
|
item.textEdit.newText = text;
|
|
422
427
|
}
|
|
423
|
-
;
|
|
424
428
|
if (item.insertText) {
|
|
425
429
|
item.insertText = text;
|
|
426
430
|
}
|
|
@@ -475,7 +479,9 @@ function create(mode, getTsPluginClient) {
|
|
|
475
479
|
}
|
|
476
480
|
propInfo = cachedPropInfos.get(propName);
|
|
477
481
|
if (propInfo?.commentMarkdown) {
|
|
478
|
-
const originalDocumentation = typeof item.documentation === 'string'
|
|
482
|
+
const originalDocumentation = typeof item.documentation === 'string'
|
|
483
|
+
? item.documentation
|
|
484
|
+
: item.documentation?.value;
|
|
479
485
|
item.documentation = {
|
|
480
486
|
kind: 'markdown',
|
|
481
487
|
value: [
|
|
@@ -30,10 +30,13 @@ function create(getTsPluginClient) {
|
|
|
30
30
|
for (const pointer of document.getText(range).matchAll(twoslashReg)) {
|
|
31
31
|
const offset = pointer.index + pointer[0].indexOf('^?') + document.offsetAt(range.start);
|
|
32
32
|
const position = document.positionAt(offset);
|
|
33
|
-
hoverOffsets.push([
|
|
33
|
+
hoverOffsets.push([
|
|
34
|
+
position,
|
|
35
|
+
document.offsetAt({
|
|
34
36
|
line: position.line - 1,
|
|
35
37
|
character: position.character,
|
|
36
|
-
})
|
|
38
|
+
}),
|
|
39
|
+
]);
|
|
37
40
|
}
|
|
38
41
|
for (const [pointerPosition, hoverOffset] of hoverOffsets) {
|
|
39
42
|
const map = context.language.maps.get(virtualCode, sourceScript);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/language-service",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"data",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"update-html-data": "node ./scripts/update-html-data.js"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@volar/language-service": "2.4.
|
|
21
|
-
"@vue/language-core": "3.0.0-beta.
|
|
20
|
+
"@volar/language-service": "2.4.15",
|
|
21
|
+
"@vue/language-core": "3.0.0-beta.5",
|
|
22
22
|
"@vue/shared": "^3.5.0",
|
|
23
23
|
"path-browserify": "^1.0.1",
|
|
24
24
|
"volar-service-css": "0.0.64",
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^22.10.4",
|
|
37
37
|
"@types/path-browserify": "^1.0.1",
|
|
38
|
-
"@volar/kit": "2.4.
|
|
39
|
-
"@volar/typescript": "2.4.
|
|
38
|
+
"@volar/kit": "2.4.15",
|
|
39
|
+
"@volar/typescript": "2.4.15",
|
|
40
40
|
"@vue/compiler-dom": "^3.5.0",
|
|
41
|
-
"@vue/typescript-plugin": "3.0.0-beta.
|
|
41
|
+
"@vue/typescript-plugin": "3.0.0-beta.5",
|
|
42
42
|
"vscode-css-languageservice": "^6.3.1"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "3a4648914c60c90444d939cf762a016a4318ca09"
|
|
45
45
|
}
|
|
@@ -92,7 +92,6 @@ for (const lang of langs) {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
function localeWorker() {
|
|
95
|
-
|
|
96
95
|
const data = langs.map(({ name, url }) => ({ name, url }));
|
|
97
96
|
|
|
98
97
|
const writePath = path.resolve(__dirname, '../data/locale.json');
|
|
@@ -101,7 +100,6 @@ function localeWorker() {
|
|
|
101
100
|
}
|
|
102
101
|
|
|
103
102
|
async function sfcWorker(lang) {
|
|
104
|
-
|
|
105
103
|
const sfcDoc = await fetchText(lang.repoUrl + 'HEAD/src/api/sfc-spec.md', lang.url);
|
|
106
104
|
const cssFeaturesDoc = await fetchText(lang.repoUrl + 'HEAD/src/api/sfc-css-features.md', lang.url);
|
|
107
105
|
|
|
@@ -142,7 +140,7 @@ async function sfcWorker(lang) {
|
|
|
142
140
|
.split('\n## ')[2]
|
|
143
141
|
.split('\n### ')
|
|
144
142
|
.slice(1)
|
|
145
|
-
.map(
|
|
143
|
+
.map(section => {
|
|
146
144
|
const lines = section.split('\n');
|
|
147
145
|
const name = normalizeTagName(lines[0]);
|
|
148
146
|
/**
|
|
@@ -241,13 +239,12 @@ async function sfcWorker(lang) {
|
|
|
241
239
|
}
|
|
242
240
|
|
|
243
241
|
async function modelWorker(lang) {
|
|
244
|
-
|
|
245
242
|
const formsDoc = await fetchText(lang.repoUrl + 'HEAD/src/guide/essentials/forms.md', lang.url);
|
|
246
243
|
const modifiers = formsDoc
|
|
247
244
|
.split('\n## ')[3]
|
|
248
245
|
.split('\n### ')
|
|
249
246
|
.slice(1)
|
|
250
|
-
.map(
|
|
247
|
+
.map(section => {
|
|
251
248
|
const lines = section.split('\n');
|
|
252
249
|
let name = normalizeAttrName(lines[0]);
|
|
253
250
|
name = name.split('.')[1];
|
|
@@ -279,7 +276,6 @@ async function modelWorker(lang) {
|
|
|
279
276
|
}
|
|
280
277
|
|
|
281
278
|
async function templateWorker(lang) {
|
|
282
|
-
|
|
283
279
|
const componentsDoc = await fetchText(lang.repoUrl + 'HEAD/src/api/built-in-components.md', lang.url);
|
|
284
280
|
const elementsDoc = await fetchText(lang.repoUrl + 'HEAD/src/api/built-in-special-elements.md', lang.url);
|
|
285
281
|
const directivesDoc = await fetchText(lang.repoUrl + 'HEAD/src/api/built-in-directives.md', lang.url);
|
|
@@ -289,7 +285,7 @@ async function templateWorker(lang) {
|
|
|
289
285
|
const components = componentsDoc
|
|
290
286
|
.split('\n## ')
|
|
291
287
|
.slice(1)
|
|
292
|
-
.map(
|
|
288
|
+
.map(section => {
|
|
293
289
|
const lines = section.split('\n');
|
|
294
290
|
const name = normalizeTagName(lines[0]);
|
|
295
291
|
/**
|
|
@@ -309,7 +305,7 @@ async function templateWorker(lang) {
|
|
|
309
305
|
const elements = elementsDoc
|
|
310
306
|
.split('\n## ')
|
|
311
307
|
.slice(1)
|
|
312
|
-
.map(
|
|
308
|
+
.map(section => {
|
|
313
309
|
const lines = section.split('\n');
|
|
314
310
|
const name = normalizeTagName(lines[0]);
|
|
315
311
|
/**
|
|
@@ -329,7 +325,7 @@ async function templateWorker(lang) {
|
|
|
329
325
|
const directives = directivesDoc
|
|
330
326
|
.split('\n## ')
|
|
331
327
|
.slice(1)
|
|
332
|
-
.map(
|
|
328
|
+
.map(section => {
|
|
333
329
|
const lines = section.split('\n');
|
|
334
330
|
const name = normalizeAttrName(lines[0]);
|
|
335
331
|
/**
|
|
@@ -337,12 +333,12 @@ async function templateWorker(lang) {
|
|
|
337
333
|
*/
|
|
338
334
|
const data = {
|
|
339
335
|
name,
|
|
340
|
-
valueSet:
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
336
|
+
valueSet: name === 'v-cloak'
|
|
337
|
+
|| name === 'v-else'
|
|
338
|
+
|| name === 'v-once'
|
|
339
|
+
|| name === 'v-pre'
|
|
340
|
+
? 'v'
|
|
341
|
+
: undefined,
|
|
346
342
|
description: {
|
|
347
343
|
kind: 'markdown',
|
|
348
344
|
value: lines.slice(1).join('\n').trim(),
|
|
@@ -354,7 +350,7 @@ async function templateWorker(lang) {
|
|
|
354
350
|
const attributes = attributesDoc
|
|
355
351
|
.split('\n## ')
|
|
356
352
|
.slice(1)
|
|
357
|
-
.map(
|
|
353
|
+
.map(section => {
|
|
358
354
|
const lines = section.split('\n');
|
|
359
355
|
const name = normalizeAttrName(lines[0]);
|
|
360
356
|
/**
|
|
@@ -373,7 +369,7 @@ async function templateWorker(lang) {
|
|
|
373
369
|
const dataAllowMismatch = ssrDoc
|
|
374
370
|
.split(/## data-allow-mismatch.*\n/)
|
|
375
371
|
.slice(1)
|
|
376
|
-
.map(
|
|
372
|
+
.map(section => {
|
|
377
373
|
const lines = section.split('\n');
|
|
378
374
|
const name = 'data-allow-mismatch';
|
|
379
375
|
/**
|
|
@@ -417,7 +413,7 @@ async function templateWorker(lang) {
|
|
|
417
413
|
async function fetchText(url, baseUrl) {
|
|
418
414
|
let text = await (await fetch(url)).text();
|
|
419
415
|
text = text.replace(/```vue-html/g, '```html');
|
|
420
|
-
text = text.replace(/\{#.*?\}/g, '')
|
|
416
|
+
text = text.replace(/\{#.*?\}/g, '');
|
|
421
417
|
text = resolveMarkdownLinks(text, baseUrl);
|
|
422
418
|
return text;
|
|
423
419
|
}
|