@vue/language-core 2.0.6 → 2.0.7
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/generators/script.js +54 -30
- package/lib/generators/template.js +18 -9
- package/lib/plugins/file-vue.js +1 -1
- package/lib/plugins/vue-tsx.js +3 -2
- package/lib/plugins.js +5 -3
- package/lib/utils/transform.js +6 -3
- package/lib/utils/ts.d.ts +1 -1
- package/lib/utils/ts.js +9 -5
- package/lib/utils/vue2TemplateCompiler.js +2 -2
- package/lib/virtualFile/computedMappings.js +1 -1
- package/package.json +3 -3
package/lib/generators/script.js
CHANGED
|
@@ -173,19 +173,25 @@ const __VLS_intrinsicElements: __VLS_IntrinsicElements;
|
|
|
173
173
|
function __VLS_getVForSourceType(source: number): [number, number, number][];
|
|
174
174
|
function __VLS_getVForSourceType(source: string): [string, number, number][];
|
|
175
175
|
function __VLS_getVForSourceType<T extends any[]>(source: T): [
|
|
176
|
-
T[number],
|
|
177
|
-
number,
|
|
178
|
-
number,
|
|
176
|
+
item: T[number],
|
|
177
|
+
key: number,
|
|
178
|
+
index: number,
|
|
179
179
|
][];
|
|
180
180
|
function __VLS_getVForSourceType<T extends { [Symbol.iterator](): Iterator<any> }>(source: T): [
|
|
181
|
-
T extends { [Symbol.iterator](): Iterator<infer T1> } ? T1 : never,
|
|
182
|
-
number,
|
|
183
|
-
undefined,
|
|
181
|
+
item: T extends { [Symbol.iterator](): Iterator<infer T1> } ? T1 : never,
|
|
182
|
+
key: number,
|
|
183
|
+
index: undefined,
|
|
184
|
+
][];
|
|
185
|
+
// #3845
|
|
186
|
+
function __VLS_getVForSourceType<T extends number | { [Symbol.iterator](): Iterator<any> }>(source: T): [
|
|
187
|
+
item: number | (Exclude<T, number> extends { [Symbol.iterator](): Iterator<infer T1> } ? T1 : never),
|
|
188
|
+
key: number,
|
|
189
|
+
index: undefined,
|
|
184
190
|
][];
|
|
185
191
|
function __VLS_getVForSourceType<T>(source: T): [
|
|
186
|
-
T[keyof T],
|
|
187
|
-
keyof T,
|
|
188
|
-
number,
|
|
192
|
+
item: T[keyof T],
|
|
193
|
+
key: keyof T,
|
|
194
|
+
index: number,
|
|
189
195
|
][];
|
|
190
196
|
|
|
191
197
|
// @ts-ignore
|
|
@@ -284,17 +290,22 @@ type __VLS_PrettifyGlobal<T> = { [K in keyof T]: T[K]; } & {};
|
|
|
284
290
|
}
|
|
285
291
|
}
|
|
286
292
|
function* generateSrc() {
|
|
287
|
-
if (!script?.src)
|
|
293
|
+
if (!script?.src) {
|
|
288
294
|
return;
|
|
295
|
+
}
|
|
289
296
|
let src = script.src;
|
|
290
|
-
if (src.endsWith('.d.ts'))
|
|
297
|
+
if (src.endsWith('.d.ts')) {
|
|
291
298
|
src = src.substring(0, src.length - '.d.ts'.length);
|
|
292
|
-
|
|
299
|
+
}
|
|
300
|
+
else if (src.endsWith('.ts')) {
|
|
293
301
|
src = src.substring(0, src.length - '.ts'.length);
|
|
294
|
-
|
|
302
|
+
}
|
|
303
|
+
else if (src.endsWith('.tsx')) {
|
|
295
304
|
src = src.substring(0, src.length - '.tsx'.length) + '.jsx';
|
|
296
|
-
|
|
305
|
+
}
|
|
306
|
+
if (!src.endsWith('.js') && !src.endsWith('.jsx')) {
|
|
297
307
|
src = src + '.js';
|
|
308
|
+
}
|
|
298
309
|
yield _(`export * from `);
|
|
299
310
|
yield _([
|
|
300
311
|
`'${src}'`,
|
|
@@ -325,15 +336,19 @@ type __VLS_PrettifyGlobal<T> = { [K in keyof T]: T[K]; } & {};
|
|
|
325
336
|
yield _(`export { default } from '${src}';\n`);
|
|
326
337
|
}
|
|
327
338
|
function* generateScriptContentBeforeExportDefault() {
|
|
328
|
-
if (!script)
|
|
339
|
+
if (!script) {
|
|
329
340
|
return;
|
|
330
|
-
|
|
341
|
+
}
|
|
342
|
+
if (!!scriptSetup && scriptRanges?.exportDefault) {
|
|
331
343
|
return yield _(generateSourceCode(script, 0, scriptRanges.exportDefault.expression.start));
|
|
344
|
+
}
|
|
332
345
|
let isExportRawObject = false;
|
|
333
|
-
if (scriptRanges?.exportDefault)
|
|
346
|
+
if (scriptRanges?.exportDefault) {
|
|
334
347
|
isExportRawObject = script.content.substring(scriptRanges.exportDefault.expression.start, scriptRanges.exportDefault.expression.end).startsWith('{');
|
|
335
|
-
|
|
348
|
+
}
|
|
349
|
+
if (!isExportRawObject || !vueCompilerOptions.optionsWrapper.length || !scriptRanges?.exportDefault) {
|
|
336
350
|
return yield _(generateSourceCode(script, 0, script.content.length));
|
|
351
|
+
}
|
|
337
352
|
yield _(generateSourceCode(script, 0, scriptRanges.exportDefault.expression.start));
|
|
338
353
|
yield _(vueCompilerOptions.optionsWrapper[0]);
|
|
339
354
|
yield _(['', 'script', scriptRanges.exportDefault.expression.start, (0, utils_1.disableAllFeatures)({
|
|
@@ -358,14 +373,17 @@ type __VLS_PrettifyGlobal<T> = { [K in keyof T]: T[K]; } & {};
|
|
|
358
373
|
yield _(generateSourceCode(script, scriptRanges.exportDefault.expression.end, script.content.length));
|
|
359
374
|
}
|
|
360
375
|
function* generateScriptContentAfterExportDefault() {
|
|
361
|
-
if (!script)
|
|
376
|
+
if (!script) {
|
|
362
377
|
return;
|
|
363
|
-
|
|
378
|
+
}
|
|
379
|
+
if (!!scriptSetup && scriptRanges?.exportDefault) {
|
|
364
380
|
yield _(generateSourceCode(script, scriptRanges.exportDefault.expression.end, script.content.length));
|
|
381
|
+
}
|
|
365
382
|
}
|
|
366
383
|
function* generateScriptSetupImports() {
|
|
367
|
-
if (!scriptSetup || !scriptSetupRanges)
|
|
384
|
+
if (!scriptSetup || !scriptSetupRanges) {
|
|
368
385
|
return;
|
|
386
|
+
}
|
|
369
387
|
yield _([
|
|
370
388
|
scriptSetup.content.substring(0, Math.max(scriptSetupRanges.importSectionEndOffset, scriptSetupRanges.leadingCommentEndOffset)) + '\n',
|
|
371
389
|
'scriptSetup',
|
|
@@ -381,8 +399,9 @@ type __VLS_PrettifyGlobal<T> = { [K in keyof T]: T[K]; } & {};
|
|
|
381
399
|
if (scriptSetupRanges.defineProp.length) {
|
|
382
400
|
yield _(` & ReturnType<typeof import('${vueCompilerOptions.lib}').defineEmits<{\n`);
|
|
383
401
|
for (const defineProp of scriptSetupRanges.defineProp) {
|
|
384
|
-
if (!defineProp.isModel)
|
|
402
|
+
if (!defineProp.isModel) {
|
|
385
403
|
continue;
|
|
404
|
+
}
|
|
386
405
|
let propName = 'modelValue';
|
|
387
406
|
if (defineProp.name) {
|
|
388
407
|
propName = scriptSetup.content.substring(defineProp.name.start, defineProp.name.end);
|
|
@@ -402,8 +421,9 @@ type __VLS_PrettifyGlobal<T> = { [K in keyof T]: T[K]; } & {};
|
|
|
402
421
|
yield _(`;\n`);
|
|
403
422
|
}
|
|
404
423
|
function* generateScriptSetupAndTemplate() {
|
|
405
|
-
if (!scriptSetup || !scriptSetupRanges)
|
|
424
|
+
if (!scriptSetup || !scriptSetupRanges) {
|
|
406
425
|
return;
|
|
426
|
+
}
|
|
407
427
|
const definePropMirrors = new Map();
|
|
408
428
|
if (scriptSetup.generic) {
|
|
409
429
|
if (!scriptRanges?.exportDefault) {
|
|
@@ -543,8 +563,9 @@ type __VLS_PrettifyGlobal<T> = { [K in keyof T]: T[K]; } & {};
|
|
|
543
563
|
}
|
|
544
564
|
}
|
|
545
565
|
function* generateSetupFunction(functional, mode, definePropMirrors) {
|
|
546
|
-
if (!scriptSetupRanges || !scriptSetup)
|
|
566
|
+
if (!scriptSetupRanges || !scriptSetup) {
|
|
547
567
|
return;
|
|
568
|
+
}
|
|
548
569
|
const definePropProposalA = scriptSetup.content.trimStart().startsWith('// @experimentalDefinePropProposal=kevinEdition') || vueCompilerOptions.experimentalDefinePropProposal === 'kevinEdition';
|
|
549
570
|
const definePropProposalB = scriptSetup.content.trimStart().startsWith('// @experimentalDefinePropProposal=johnsonEdition') || vueCompilerOptions.experimentalDefinePropProposal === 'johnsonEdition';
|
|
550
571
|
if (vueCompilerOptions.target >= 3.3) {
|
|
@@ -699,8 +720,9 @@ type __VLS_PrettifyGlobal<T> = { [K in keyof T]: T[K]; } & {};
|
|
|
699
720
|
}
|
|
700
721
|
}
|
|
701
722
|
function* generateComponent(functional) {
|
|
702
|
-
if (!scriptSetupRanges)
|
|
723
|
+
if (!scriptSetupRanges) {
|
|
703
724
|
return;
|
|
725
|
+
}
|
|
704
726
|
if (script && scriptRanges?.exportDefault && scriptRanges.exportDefault.expression.start !== scriptRanges.exportDefault.args.start) {
|
|
705
727
|
// use defineComponent() from user space code if it exist
|
|
706
728
|
yield _(generateSourceCode(script, scriptRanges.exportDefault.expression.start, scriptRanges.exportDefault.args.start));
|
|
@@ -772,12 +794,14 @@ type __VLS_PrettifyGlobal<T> = { [K in keyof T]: T[K]; } & {};
|
|
|
772
794
|
}
|
|
773
795
|
yield _(`},\n`);
|
|
774
796
|
}
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
797
|
+
if (ranges.defineProp.filter(p => p.isModel).length || ranges.emits.define) {
|
|
798
|
+
yield _(`emits: ({} as __VLS_NormalizeEmits<typeof __VLS_modelEmitsType`);
|
|
799
|
+
if (ranges.emits.define) {
|
|
800
|
+
yield _(` & typeof `);
|
|
801
|
+
yield _(ranges.emits.name ?? '__VLS_emit');
|
|
802
|
+
}
|
|
803
|
+
yield _(`>),\n`);
|
|
779
804
|
}
|
|
780
|
-
yield _(`>),\n`);
|
|
781
805
|
}
|
|
782
806
|
if (script && scriptRanges?.exportDefault?.args) {
|
|
783
807
|
yield _(generateSourceCode(script, scriptRanges.exportDefault.args.start + 1, scriptRanges.exportDefault.args.end - 1));
|
|
@@ -243,11 +243,13 @@ function* generate(ts, compilerOptions, vueCompilerOptions, template, shouldGene
|
|
|
243
243
|
function* generatePreResolveComponents() {
|
|
244
244
|
yield _ts(`let __VLS_resolvedLocalAndGlobalComponents!: {}\n`);
|
|
245
245
|
for (const [tagName] of tagOffsetsMap) {
|
|
246
|
-
if (nativeTags.has(tagName))
|
|
246
|
+
if (nativeTags.has(tagName)) {
|
|
247
247
|
continue;
|
|
248
|
+
}
|
|
248
249
|
const isNamespacedTag = tagName.indexOf('.') >= 0;
|
|
249
|
-
if (isNamespacedTag)
|
|
250
|
+
if (isNamespacedTag) {
|
|
250
251
|
continue;
|
|
252
|
+
}
|
|
251
253
|
yield _ts(`& __VLS_WithComponent<'${getCanonicalComponentName(tagName)}', typeof __VLS_localComponents, `);
|
|
252
254
|
// order is important: https://github.com/vuejs/language-tools/issues/2010
|
|
253
255
|
yield _ts(`"${(0, shared_1.capitalize)((0, shared_1.camelize)(tagName))}", `);
|
|
@@ -385,12 +387,15 @@ function* generate(ts, compilerOptions, vueCompilerOptions, template, shouldGene
|
|
|
385
387
|
let originalBlockConditionsLength = blockConditions.length;
|
|
386
388
|
for (let i = 0; i < node.branches.length; i++) {
|
|
387
389
|
const branch = node.branches[i];
|
|
388
|
-
if (i === 0)
|
|
390
|
+
if (i === 0) {
|
|
389
391
|
yield _ts('if');
|
|
390
|
-
|
|
392
|
+
}
|
|
393
|
+
else if (branch.condition) {
|
|
391
394
|
yield _ts('else if');
|
|
392
|
-
|
|
395
|
+
}
|
|
396
|
+
else {
|
|
393
397
|
yield _ts('else');
|
|
398
|
+
}
|
|
394
399
|
let addedBlockCondition = false;
|
|
395
400
|
if (branch.condition?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION) {
|
|
396
401
|
yield _ts(` `);
|
|
@@ -424,8 +429,9 @@ function* generate(ts, compilerOptions, vueCompilerOptions, template, shouldGene
|
|
|
424
429
|
if (leftExpressionRange && leftExpressionText) {
|
|
425
430
|
const collectAst = createTsAst(node.parseResult, `const [${leftExpressionText}]`);
|
|
426
431
|
(0, transform_1.collectVars)(ts, collectAst, collectAst, forBlockVars);
|
|
427
|
-
for (const varName of forBlockVars)
|
|
432
|
+
for (const varName of forBlockVars) {
|
|
428
433
|
localVars.set(varName, (localVars.get(varName) ?? 0) + 1);
|
|
434
|
+
}
|
|
429
435
|
yield _ts([leftExpressionText, 'template', leftExpressionRange.start, presetInfos.all]);
|
|
430
436
|
yield* generateTsFormat(leftExpressionText, leftExpressionRange.start, formatBrackets.normal);
|
|
431
437
|
}
|
|
@@ -445,8 +451,9 @@ function* generate(ts, compilerOptions, vueCompilerOptions, template, shouldGene
|
|
|
445
451
|
yield _ts('}\n');
|
|
446
452
|
yield* generateTsFormat(source.content, source.loc.start.offset, formatBrackets.normal);
|
|
447
453
|
}
|
|
448
|
-
for (const varName of forBlockVars)
|
|
454
|
+
for (const varName of forBlockVars) {
|
|
449
455
|
localVars.set(varName, localVars.get(varName) - 1);
|
|
456
|
+
}
|
|
450
457
|
}
|
|
451
458
|
function* generateElement(node, parentEl, componentCtxVar) {
|
|
452
459
|
yield _ts(`{\n`);
|
|
@@ -985,8 +992,9 @@ function* generate(ts, compilerOptions, vueCompilerOptions, template, shouldGene
|
|
|
985
992
|
|| (prop.name === 'style' && ++styleAttrNum >= 2)
|
|
986
993
|
|| (prop.name === 'class' && ++classAttrNum >= 2)
|
|
987
994
|
|| (prop.name === 'name' && node.tag === 'slot') // #2308
|
|
988
|
-
)
|
|
995
|
+
) {
|
|
989
996
|
continue;
|
|
997
|
+
}
|
|
990
998
|
if (vueCompilerOptions.target < 3
|
|
991
999
|
&& (node.tag === 'transition' || node.tag === 'Transition')
|
|
992
1000
|
&& prop.name === 'persisted') {
|
|
@@ -1264,8 +1272,9 @@ function* generate(ts, compilerOptions, vueCompilerOptions, template, shouldGene
|
|
|
1264
1272
|
}
|
|
1265
1273
|
}
|
|
1266
1274
|
function* generateExtraAutoImport() {
|
|
1267
|
-
if (!tempVars.length)
|
|
1275
|
+
if (!tempVars.length) {
|
|
1268
1276
|
return;
|
|
1277
|
+
}
|
|
1269
1278
|
yield _ts('// @ts-ignore\n'); // #2304
|
|
1270
1279
|
yield _ts('[');
|
|
1271
1280
|
for (const _vars of tempVars) {
|
package/lib/plugins/file-vue.js
CHANGED
package/lib/plugins/vue-tsx.js
CHANGED
|
@@ -9,7 +9,7 @@ const utils_1 = require("../generators/utils");
|
|
|
9
9
|
const scriptRanges_1 = require("../parsers/scriptRanges");
|
|
10
10
|
const scriptSetupRanges_1 = require("../parsers/scriptSetupRanges");
|
|
11
11
|
exports.tsCodegen = new WeakMap();
|
|
12
|
-
const plugin =
|
|
12
|
+
const plugin = ctx => {
|
|
13
13
|
return {
|
|
14
14
|
version: 2,
|
|
15
15
|
requiredCompilerOptions: [
|
|
@@ -126,8 +126,9 @@ function createTsx(fileName, _sfc, ctx) {
|
|
|
126
126
|
return classes;
|
|
127
127
|
});
|
|
128
128
|
const generatedTemplate = (0, computeds_1.computed)(() => {
|
|
129
|
-
if (!_sfc.template)
|
|
129
|
+
if (!_sfc.template) {
|
|
130
130
|
return;
|
|
131
|
+
}
|
|
131
132
|
const tsCodes = [];
|
|
132
133
|
const tsFormatCodes = [];
|
|
133
134
|
const inlineCssCodes = [];
|
package/lib/plugins.js
CHANGED
|
@@ -27,7 +27,9 @@ function getDefaultVueLanguagePlugins(pluginContext) {
|
|
|
27
27
|
const pluginInstances = plugins
|
|
28
28
|
.map(plugin => {
|
|
29
29
|
try {
|
|
30
|
-
|
|
30
|
+
const instance = plugin(pluginContext);
|
|
31
|
+
instance.name ??= plugin.__moduleName;
|
|
32
|
+
return instance;
|
|
31
33
|
}
|
|
32
34
|
catch (err) {
|
|
33
35
|
console.warn('[Vue] Failed to create plugin', err);
|
|
@@ -39,10 +41,10 @@ function getDefaultVueLanguagePlugins(pluginContext) {
|
|
|
39
41
|
const bOrder = b.order ?? 0;
|
|
40
42
|
return aOrder - bOrder;
|
|
41
43
|
});
|
|
42
|
-
return pluginInstances.filter(
|
|
44
|
+
return pluginInstances.filter(plugin => {
|
|
43
45
|
const valid = plugin.version === types_1.pluginVersion;
|
|
44
46
|
if (!valid) {
|
|
45
|
-
console.warn(`[Vue] Plugin ${JSON.stringify(plugin.name)} API version incompatible, expected ${
|
|
47
|
+
console.warn(`[Vue] Plugin ${JSON.stringify(plugin.name)} API version incompatible, expected "${types_1.pluginVersion}" but got "${plugin.version}".`);
|
|
46
48
|
}
|
|
47
49
|
return valid;
|
|
48
50
|
});
|
package/lib/utils/transform.js
CHANGED
|
@@ -103,8 +103,9 @@ function walkIdentifiers(ts, node, ast, cb, localVars, blockVars = [], isRoot =
|
|
|
103
103
|
for (const varName of blockVars) {
|
|
104
104
|
localVars.set(varName, (localVars.get(varName) ?? 0) + 1);
|
|
105
105
|
}
|
|
106
|
-
if (node.initializer)
|
|
106
|
+
if (node.initializer) {
|
|
107
107
|
walkIdentifiers(ts, node.initializer, ast, cb, localVars, blockVars, false);
|
|
108
|
+
}
|
|
108
109
|
}
|
|
109
110
|
else if (ts.isArrowFunction(node) || ts.isFunctionExpression(node)) {
|
|
110
111
|
const functionArgs = [];
|
|
@@ -114,11 +115,13 @@ function walkIdentifiers(ts, node, ast, cb, localVars, blockVars = [], isRoot =
|
|
|
114
115
|
walkIdentifiers(ts, param.type, ast, cb, localVars, blockVars, false);
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
|
-
for (const varName of functionArgs)
|
|
118
|
+
for (const varName of functionArgs) {
|
|
118
119
|
localVars.set(varName, (localVars.get(varName) ?? 0) + 1);
|
|
120
|
+
}
|
|
119
121
|
walkIdentifiers(ts, node.body, ast, cb, localVars, blockVars, false);
|
|
120
|
-
for (const varName of functionArgs)
|
|
122
|
+
for (const varName of functionArgs) {
|
|
121
123
|
localVars.set(varName, localVars.get(varName) - 1);
|
|
124
|
+
}
|
|
122
125
|
}
|
|
123
126
|
else if (ts.isObjectLiteralExpression(node)) {
|
|
124
127
|
for (const prop of node.properties) {
|
package/lib/utils/ts.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type * as ts from 'typescript';
|
|
2
2
|
import type { VueCompilerOptions } from '../types';
|
|
3
3
|
export type ParsedCommandLine = ts.ParsedCommandLine & {
|
|
4
|
-
vueOptions:
|
|
4
|
+
vueOptions: VueCompilerOptions;
|
|
5
5
|
};
|
|
6
6
|
export declare function createParsedCommandLineByJson(ts: typeof import('typescript'), parseConfigHost: ts.ParseConfigHost, rootDir: string, json: any, configFileName?: string): ParsedCommandLine;
|
|
7
7
|
export declare function createParsedCommandLine(ts: typeof import('typescript'), parseConfigHost: ts.ParseConfigHost, tsConfigPath: string): ParsedCommandLine;
|
package/lib/utils/ts.js
CHANGED
|
@@ -15,7 +15,8 @@ function createParsedCommandLineByJson(ts, parseConfigHost, rootDir, json, confi
|
|
|
15
15
|
}
|
|
16
16
|
catch (err) { }
|
|
17
17
|
}
|
|
18
|
-
const
|
|
18
|
+
const resolvedVueOptions = resolveVueCompilerOptions(vueOptions);
|
|
19
|
+
const parsed = ts.parseJsonConfigFileContent(json, proxyHost.host, rootDir, {}, configFileName, undefined, resolvedVueOptions.extensions.map(extension => ({
|
|
19
20
|
extension: extension.slice(1),
|
|
20
21
|
isMixedContent: true,
|
|
21
22
|
scriptKind: ts.ScriptKind.Deferred,
|
|
@@ -26,7 +27,7 @@ function createParsedCommandLineByJson(ts, parseConfigHost, rootDir, json, confi
|
|
|
26
27
|
parsed.options.outDir = undefined;
|
|
27
28
|
return {
|
|
28
29
|
...parsed,
|
|
29
|
-
vueOptions,
|
|
30
|
+
vueOptions: resolvedVueOptions,
|
|
30
31
|
};
|
|
31
32
|
}
|
|
32
33
|
exports.createParsedCommandLineByJson = createParsedCommandLineByJson;
|
|
@@ -45,7 +46,8 @@ function createParsedCommandLine(ts, parseConfigHost, tsConfigPath) {
|
|
|
45
46
|
}
|
|
46
47
|
catch (err) { }
|
|
47
48
|
}
|
|
48
|
-
const
|
|
49
|
+
const resolvedVueOptions = resolveVueCompilerOptions(vueOptions);
|
|
50
|
+
const parsed = ts.parseJsonSourceFileConfigFileContent(config, proxyHost.host, path.dirname(tsConfigPath), {}, tsConfigPath, undefined, resolvedVueOptions.extensions.map(extension => ({
|
|
49
51
|
extension: extension.slice(1),
|
|
50
52
|
isMixedContent: true,
|
|
51
53
|
scriptKind: ts.ScriptKind.Deferred,
|
|
@@ -56,7 +58,7 @@ function createParsedCommandLine(ts, parseConfigHost, tsConfigPath) {
|
|
|
56
58
|
parsed.options.outDir = undefined;
|
|
57
59
|
return {
|
|
58
60
|
...parsed,
|
|
59
|
-
vueOptions,
|
|
61
|
+
vueOptions: resolvedVueOptions,
|
|
60
62
|
};
|
|
61
63
|
}
|
|
62
64
|
catch (err) {
|
|
@@ -118,7 +120,9 @@ function getPartialVueCompilerOptions(ts, tsConfigSourceFile) {
|
|
|
118
120
|
try {
|
|
119
121
|
const resolvedPath = resolvePath(pluginPath);
|
|
120
122
|
if (resolvedPath) {
|
|
121
|
-
|
|
123
|
+
const plugin = require(resolvedPath);
|
|
124
|
+
plugin.__moduleName = pluginPath;
|
|
125
|
+
return plugin;
|
|
122
126
|
}
|
|
123
127
|
else {
|
|
124
128
|
console.warn('[Vue] Load plugin failed:', pluginPath);
|
|
@@ -9,7 +9,7 @@ const compile = (template, options = {}) => {
|
|
|
9
9
|
}
|
|
10
10
|
const onError = options.onError;
|
|
11
11
|
const onWarn = options.onWarn;
|
|
12
|
-
options.onError =
|
|
12
|
+
options.onError = error => {
|
|
13
13
|
if (error.code === 33 // :key binding allowed in v-for template child in vue 2
|
|
14
14
|
|| error.code === 29 // fix https://github.com/vuejs/language-tools/issues/1638
|
|
15
15
|
) {
|
|
@@ -57,7 +57,7 @@ const compile = (template, options = {}) => {
|
|
|
57
57
|
};
|
|
58
58
|
exports.compile = compile;
|
|
59
59
|
function baseCompile(template, options = {}) {
|
|
60
|
-
const onError = options.onError || (
|
|
60
|
+
const onError = options.onError || (error => { throw error; });
|
|
61
61
|
const isModuleMode = options.mode === 'module';
|
|
62
62
|
const prefixIdentifiers = options.prefixIdentifiers === true || isModuleMode;
|
|
63
63
|
if (!prefixIdentifiers && options.cacheHandlers) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/language-core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"directory": "packages/language-core"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@volar/language-core": "~2.1.
|
|
15
|
+
"@volar/language-core": "~2.1.3",
|
|
16
16
|
"@vue/compiler-dom": "^3.4.0",
|
|
17
17
|
"@vue/shared": "^3.4.0",
|
|
18
18
|
"computeds": "^0.0.1",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"optional": true
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "4a37e8f3ebcf31ecfd2ea627f7611d5990ec5df6"
|
|
38
38
|
}
|