@vue/language-core 1.8.8 → 1.8.10
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.d.ts +3 -3
- package/out/generators/script.js +30 -7
- package/out/generators/template.d.ts +3 -2
- package/out/generators/template.js +55 -19
- package/out/index.d.ts +3 -0
- package/out/index.js +15 -2
- package/out/languageModule.d.ts +2 -1
- package/out/languageModule.js +25 -2
- package/out/parsers/scriptRanges.d.ts +1 -0
- package/out/parsers/scriptSetupRanges.d.ts +1 -0
- package/out/plugins/file-html.d.ts +2 -1
- package/out/plugins/file-html.js +2 -1
- package/out/plugins/file-md.d.ts +2 -1
- package/out/plugins/file-md.js +2 -1
- package/out/plugins/file-vue.d.ts +2 -1
- package/out/plugins/file-vue.js +2 -1
- package/out/plugins/vue-sfc-customblocks.d.ts +2 -1
- package/out/plugins/vue-sfc-customblocks.js +2 -1
- package/out/plugins/vue-sfc-scripts.d.ts +2 -1
- package/out/plugins/vue-sfc-scripts.js +2 -1
- package/out/plugins/vue-sfc-styles.d.ts +2 -1
- package/out/plugins/vue-sfc-styles.js +2 -1
- package/out/plugins/vue-sfc-template.d.ts +2 -1
- package/out/plugins/vue-sfc-template.js +2 -1
- package/out/plugins/vue-template-html.d.ts +2 -1
- package/out/plugins/vue-template-html.js +2 -1
- package/out/plugins/vue-tsx.d.ts +1 -0
- package/out/plugins/vue-tsx.js +25 -2
- package/out/plugins.d.ts +1 -0
- package/out/plugins.js +51 -20
- package/out/sourceFile.d.ts +9 -8
- package/out/sourceFile.js +24 -1
- package/out/types.d.ts +8 -7
- package/out/utils/globalTypes.d.ts +1 -0
- package/out/utils/parseCssClassNames.d.ts +1 -0
- package/out/utils/parseCssVars.d.ts +1 -0
- package/out/utils/parseSfc.d.ts +1 -0
- package/out/utils/parseSfc.js +24 -1
- package/out/utils/shared.d.ts +3 -0
- package/out/utils/shared.js +13 -1
- package/out/utils/transform.d.ts +1 -0
- package/out/utils/ts.d.ts +2 -1
- package/out/utils/ts.js +33 -6
- package/out/utils/vue2TemplateCompiler.d.ts +3 -3
- package/out/utils/vue2TemplateCompiler.js +23 -15
- package/package.json +2 -2
- package/out/utils/directorySharedTypes.d.ts +0 -4
- package/out/utils/directorySharedTypes.js +0 -150
package/out/plugins.js
CHANGED
|
@@ -1,33 +1,64 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
2
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
29
|
exports.getDefaultVueLanguagePlugins = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const vue_tsx_1 = require("./plugins/vue-tsx");
|
|
13
|
-
const CompilerDOM = require("@vue/compiler-dom");
|
|
14
|
-
const CompilerVue2 = require("./utils/vue2TemplateCompiler");
|
|
30
|
+
const file_html_1 = __importDefault(require("./plugins/file-html"));
|
|
31
|
+
const file_md_1 = __importDefault(require("./plugins/file-md"));
|
|
32
|
+
const file_vue_1 = __importDefault(require("./plugins/file-vue"));
|
|
33
|
+
const vue_sfc_customblocks_1 = __importDefault(require("./plugins/vue-sfc-customblocks"));
|
|
34
|
+
const vue_sfc_scripts_1 = __importDefault(require("./plugins/vue-sfc-scripts"));
|
|
35
|
+
const vue_sfc_styles_1 = __importDefault(require("./plugins/vue-sfc-styles"));
|
|
36
|
+
const vue_sfc_template_1 = __importDefault(require("./plugins/vue-sfc-template"));
|
|
37
|
+
const vue_template_html_1 = __importDefault(require("./plugins/vue-template-html"));
|
|
38
|
+
const vue_tsx_1 = __importDefault(require("./plugins/vue-tsx"));
|
|
39
|
+
const CompilerDOM = __importStar(require("@vue/compiler-dom"));
|
|
40
|
+
const CompilerVue2 = __importStar(require("./utils/vue2TemplateCompiler"));
|
|
15
41
|
function getDefaultVueLanguagePlugins(ts, compilerOptions, vueCompilerOptions, codegenStack) {
|
|
16
42
|
const plugins = [
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
43
|
+
file_md_1.default,
|
|
44
|
+
file_html_1.default,
|
|
45
|
+
file_vue_1.default,
|
|
46
|
+
vue_template_html_1.default,
|
|
47
|
+
vue_sfc_styles_1.default,
|
|
48
|
+
vue_sfc_customblocks_1.default,
|
|
49
|
+
vue_sfc_scripts_1.default,
|
|
50
|
+
vue_sfc_template_1.default,
|
|
25
51
|
vue_tsx_1.default,
|
|
26
52
|
...vueCompilerOptions.plugins,
|
|
27
53
|
];
|
|
28
54
|
const pluginCtx = {
|
|
29
55
|
modules: {
|
|
30
|
-
'@vue/compiler-dom': vueCompilerOptions.target < 3
|
|
56
|
+
'@vue/compiler-dom': vueCompilerOptions.target < 3
|
|
57
|
+
? {
|
|
58
|
+
...CompilerDOM,
|
|
59
|
+
compile: CompilerVue2.compile,
|
|
60
|
+
}
|
|
61
|
+
: CompilerDOM,
|
|
31
62
|
typescript: ts,
|
|
32
63
|
},
|
|
33
64
|
compilerOptions,
|
package/out/sourceFile.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FileCapabilities, VirtualFile, FileKind, FileRangeCapabilities, MirrorBehaviorCapabilities } from '@volar/language-core';
|
|
2
2
|
import { Mapping, Segment, StackNode, Stack } from '@volar/source-map';
|
|
3
|
-
import * as
|
|
3
|
+
import type * as CompilerDOM from '@vue/compiler-dom';
|
|
4
4
|
import type { SFCBlock, SFCParseResult, SFCScriptBlock, SFCStyleBlock, SFCTemplateBlock } from '@vue/compiler-sfc';
|
|
5
5
|
import { ComputedRef } from '@vue/reactivity';
|
|
6
6
|
import type * as ts from 'typescript/lib/tsserverlibrary';
|
|
@@ -31,7 +31,7 @@ export declare class VueFile implements VirtualFile {
|
|
|
31
31
|
compiledSFCTemplateCache: {
|
|
32
32
|
template: string;
|
|
33
33
|
snapshot: ts.IScriptSnapshot;
|
|
34
|
-
result:
|
|
34
|
+
result: CompilerDOM.CodegenResult;
|
|
35
35
|
plugin: ReturnType<VueLanguagePlugin>;
|
|
36
36
|
} | undefined;
|
|
37
37
|
capabilities: FileCapabilities;
|
|
@@ -39,18 +39,18 @@ export declare class VueFile implements VirtualFile {
|
|
|
39
39
|
mappings: Mapping<FileRangeCapabilities>[];
|
|
40
40
|
codegenStacks: Stack[];
|
|
41
41
|
get compiledSFCTemplate(): {
|
|
42
|
-
errors:
|
|
43
|
-
warnings:
|
|
44
|
-
ast:
|
|
42
|
+
errors: CompilerDOM.CompilerError[];
|
|
43
|
+
warnings: CompilerDOM.CompilerError[];
|
|
44
|
+
ast: CompilerDOM.RootNode | undefined;
|
|
45
45
|
} | undefined;
|
|
46
46
|
get mainScriptName(): string;
|
|
47
47
|
get embeddedFiles(): VirtualFile[];
|
|
48
48
|
sfc: Sfc;
|
|
49
49
|
_sfcBlocks: ComputedRef<Record<string, SfcBlock>>;
|
|
50
50
|
_compiledSfcTemplate: ComputedRef<{
|
|
51
|
-
errors:
|
|
52
|
-
warnings:
|
|
53
|
-
ast:
|
|
51
|
+
errors: CompilerDOM.CompilerError[];
|
|
52
|
+
warnings: CompilerDOM.CompilerError[];
|
|
53
|
+
ast: CompilerDOM.RootNode | undefined;
|
|
54
54
|
} | undefined>;
|
|
55
55
|
_pluginEmbeddedFiles: ComputedRef<{
|
|
56
56
|
file: VueEmbeddedFile;
|
|
@@ -76,3 +76,4 @@ export declare class VueFile implements VirtualFile {
|
|
|
76
76
|
parseCustomBlock(block: SFCBlock, i: number): Sfc['customBlocks'][number];
|
|
77
77
|
parseBlock(block: SFCBlock): Omit<SfcBlock, 'name' | 'lang'>;
|
|
78
78
|
}
|
|
79
|
+
//# sourceMappingURL=sourceFile.d.ts.map
|
package/out/sourceFile.js
CHANGED
|
@@ -1,10 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.VueFile = exports.VueEmbeddedFile = void 0;
|
|
4
27
|
const language_core_1 = require("@volar/language-core");
|
|
5
28
|
const source_map_1 = require("@volar/source-map");
|
|
6
29
|
const reactivity_1 = require("@vue/reactivity");
|
|
7
|
-
const muggle = require("muggle-string");
|
|
30
|
+
const muggle = __importStar(require("muggle-string"));
|
|
8
31
|
const parseCssVars_1 = require("./utils/parseCssVars");
|
|
9
32
|
const parseCssClassNames_1 = require("./utils/parseCssClassNames");
|
|
10
33
|
const jsxReg = /^\.(js|ts)x?$/;
|
package/out/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import type * as CompilerDOM from '@vue/compiler-dom';
|
|
1
2
|
import type { SFCParseResult } from '@vue/compiler-sfc';
|
|
2
|
-
import * as CompilerDom from '@vue/compiler-dom';
|
|
3
3
|
import type * as ts from 'typescript/lib/tsserverlibrary';
|
|
4
|
-
import { VueEmbeddedFile } from './sourceFile';
|
|
4
|
+
import type { VueEmbeddedFile } from './sourceFile';
|
|
5
5
|
export type { SFCParseResult } from '@vue/compiler-sfc';
|
|
6
6
|
export type RawVueCompilerOptions = Partial<Omit<VueCompilerOptions, 'target' | 'plugins'>> & {
|
|
7
7
|
target?: 'auto' | 2 | 2.7 | 3 | 3.3;
|
|
@@ -52,13 +52,13 @@ export type VueLanguagePlugin = (ctx: {
|
|
|
52
52
|
end: number;
|
|
53
53
|
newText: string;
|
|
54
54
|
}): SFCParseResult | undefined;
|
|
55
|
-
resolveTemplateCompilerOptions?(options:
|
|
56
|
-
compileSFCTemplate?(lang: string, template: string, options:
|
|
57
|
-
updateSFCTemplate?(oldResult:
|
|
55
|
+
resolveTemplateCompilerOptions?(options: CompilerDOM.CompilerOptions): CompilerDOM.CompilerOptions;
|
|
56
|
+
compileSFCTemplate?(lang: string, template: string, options: CompilerDOM.CompilerOptions): CompilerDOM.CodegenResult | undefined;
|
|
57
|
+
updateSFCTemplate?(oldResult: CompilerDOM.CodegenResult, textChange: {
|
|
58
58
|
start: number;
|
|
59
59
|
end: number;
|
|
60
60
|
newText: string;
|
|
61
|
-
}):
|
|
61
|
+
}): CompilerDOM.CodegenResult | undefined;
|
|
62
62
|
getEmbeddedFileNames?(fileName: string, sfc: Sfc): string[];
|
|
63
63
|
resolveEmbeddedFile?(fileName: string, sfc: Sfc, embeddedFile: VueEmbeddedFile): void;
|
|
64
64
|
};
|
|
@@ -97,7 +97,7 @@ export interface Sfc {
|
|
|
97
97
|
customBlocks: (SfcBlock & {
|
|
98
98
|
type: string;
|
|
99
99
|
})[];
|
|
100
|
-
templateAst:
|
|
100
|
+
templateAst: CompilerDOM.RootNode | undefined;
|
|
101
101
|
scriptAst: ts.SourceFile | undefined;
|
|
102
102
|
scriptSetupAst: ts.SourceFile | undefined;
|
|
103
103
|
}
|
|
@@ -105,3 +105,4 @@ export interface TextRange {
|
|
|
105
105
|
start: number;
|
|
106
106
|
end: number;
|
|
107
107
|
}
|
|
108
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -2,3 +2,4 @@ import { VueCompilerOptions } from '../types';
|
|
|
2
2
|
export declare const baseName = "__VLS_types.d.ts";
|
|
3
3
|
export declare function getTypesCode(vueCompilerOptions: VueCompilerOptions): string;
|
|
4
4
|
export declare function genConstructorOverloads(name?: string, nums?: number): string;
|
|
5
|
+
//# sourceMappingURL=globalTypes.d.ts.map
|
package/out/utils/parseSfc.d.ts
CHANGED
package/out/utils/parseSfc.js
CHANGED
|
@@ -1,7 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.parse = void 0;
|
|
4
|
-
const compiler = require("@vue/compiler-dom");
|
|
27
|
+
const compiler = __importStar(require("@vue/compiler-dom"));
|
|
5
28
|
function parse(source) {
|
|
6
29
|
const errors = [];
|
|
7
30
|
const ast = compiler.parse(source, {
|
package/out/utils/shared.d.ts
CHANGED
package/out/utils/shared.js
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getSlotsPropertyName = void 0;
|
|
3
|
+
exports.hyphenateAttr = exports.hyphenateTag = exports.getSlotsPropertyName = void 0;
|
|
4
|
+
const shared_1 = require("@vue/shared");
|
|
4
5
|
function getSlotsPropertyName(vueVersion) {
|
|
5
6
|
return vueVersion < 3 ? '$scopedSlots' : '$slots';
|
|
6
7
|
}
|
|
7
8
|
exports.getSlotsPropertyName = getSlotsPropertyName;
|
|
9
|
+
var shared_2 = require("@vue/shared");
|
|
10
|
+
Object.defineProperty(exports, "hyphenateTag", { enumerable: true, get: function () { return shared_2.hyphenate; } });
|
|
11
|
+
function hyphenateAttr(str) {
|
|
12
|
+
let hyphencase = (0, shared_1.hyphenate)(str);
|
|
13
|
+
// fix https://github.com/vuejs/core/issues/8811
|
|
14
|
+
if (str.length && str[0] !== str[0].toLowerCase()) {
|
|
15
|
+
hyphencase = '-' + hyphencase;
|
|
16
|
+
}
|
|
17
|
+
return hyphencase;
|
|
18
|
+
}
|
|
19
|
+
exports.hyphenateAttr = hyphenateAttr;
|
|
8
20
|
//# sourceMappingURL=shared.js.map
|
package/out/utils/transform.d.ts
CHANGED
|
@@ -6,3 +6,4 @@ export declare function walkInterpolationFragment(ts: typeof import('typescript/
|
|
|
6
6
|
offset: number;
|
|
7
7
|
}[];
|
|
8
8
|
export declare function colletVars(ts: typeof import('typescript/lib/tsserverlibrary'), node: ts.Node, result: string[]): void;
|
|
9
|
+
//# sourceMappingURL=transform.d.ts.map
|
package/out/utils/ts.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { VueCompilerOptions } from '../types';
|
|
|
3
3
|
export type ParsedCommandLine = ts.ParsedCommandLine & {
|
|
4
4
|
vueOptions: Partial<VueCompilerOptions>;
|
|
5
5
|
};
|
|
6
|
-
export declare function createParsedCommandLineByJson(ts: typeof import('typescript/lib/tsserverlibrary'), parseConfigHost: ts.ParseConfigHost, rootDir: string, json: any): ParsedCommandLine;
|
|
6
|
+
export declare function createParsedCommandLineByJson(ts: typeof import('typescript/lib/tsserverlibrary'), parseConfigHost: ts.ParseConfigHost, rootDir: string, json: any, configFileName?: string): ParsedCommandLine;
|
|
7
7
|
export declare function createParsedCommandLine(ts: typeof import('typescript/lib/tsserverlibrary'), parseConfigHost: ts.ParseConfigHost, tsConfigPath: string): ParsedCommandLine;
|
|
8
8
|
export declare function resolveVueCompilerOptions(vueOptions: Partial<VueCompilerOptions>): VueCompilerOptions;
|
|
9
|
+
//# sourceMappingURL=ts.d.ts.map
|
package/out/utils/ts.js
CHANGED
|
@@ -1,10 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.resolveVueCompilerOptions = exports.createParsedCommandLine = exports.createParsedCommandLineByJson = void 0;
|
|
4
|
-
const path = require("path");
|
|
5
|
-
function createParsedCommandLineByJson(ts, parseConfigHost, rootDir, json) {
|
|
27
|
+
const path = __importStar(require("path"));
|
|
28
|
+
function createParsedCommandLineByJson(ts, parseConfigHost, rootDir, json, configFileName = rootDir + '/jsconfig.json') {
|
|
6
29
|
const proxyHost = proxyParseConfigHostForExtendConfigPaths(parseConfigHost);
|
|
7
|
-
ts.parseJsonConfigFileContent(json, proxyHost.host, rootDir, {},
|
|
30
|
+
ts.parseJsonConfigFileContent(json, proxyHost.host, rootDir, {}, configFileName);
|
|
8
31
|
let vueOptions = {};
|
|
9
32
|
for (const extendPath of proxyHost.extendConfigPaths.reverse()) {
|
|
10
33
|
try {
|
|
@@ -15,7 +38,7 @@ function createParsedCommandLineByJson(ts, parseConfigHost, rootDir, json) {
|
|
|
15
38
|
}
|
|
16
39
|
catch (err) { }
|
|
17
40
|
}
|
|
18
|
-
const parsed = ts.parseJsonConfigFileContent(json, proxyHost.host, rootDir, {},
|
|
41
|
+
const parsed = ts.parseJsonConfigFileContent(json, proxyHost.host, rootDir, {}, configFileName, undefined, (vueOptions.extensions ?? ['.vue']).map(extension => ({
|
|
19
42
|
extension: extension.slice(1),
|
|
20
43
|
isMixedContent: true,
|
|
21
44
|
scriptKind: ts.ScriptKind.Deferred,
|
|
@@ -120,12 +143,16 @@ function getPartialVueCompilerOptions(ts, tsConfigSourceFile) {
|
|
|
120
143
|
if (resolvedPath) {
|
|
121
144
|
return require(resolvedPath);
|
|
122
145
|
}
|
|
146
|
+
else {
|
|
147
|
+
console.warn('Load plugin failed:', pluginPath);
|
|
148
|
+
}
|
|
123
149
|
}
|
|
124
150
|
catch (error) {
|
|
125
|
-
console.warn('Load plugin failed', pluginPath, error);
|
|
151
|
+
console.warn('Load plugin failed:', pluginPath, error);
|
|
126
152
|
}
|
|
153
|
+
return [];
|
|
127
154
|
})
|
|
128
|
-
.
|
|
155
|
+
.flat(Infinity);
|
|
129
156
|
result.plugins = plugins;
|
|
130
157
|
}
|
|
131
158
|
if (rawOptions.hooks) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
export
|
|
3
|
-
|
|
1
|
+
import * as CompilerDOM from '@vue/compiler-dom';
|
|
2
|
+
export declare function compile(template: string, options?: CompilerDOM.CompilerOptions): CompilerDOM.CodegenResult;
|
|
3
|
+
//# sourceMappingURL=vue2TemplateCompiler.d.ts.map
|
|
@@ -10,20 +10,28 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
11
|
o[k2] = m[k];
|
|
12
12
|
}));
|
|
13
|
-
var
|
|
14
|
-
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
15
24
|
};
|
|
16
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
26
|
exports.compile = void 0;
|
|
18
|
-
const
|
|
27
|
+
const CompilerDOM = __importStar(require("@vue/compiler-dom"));
|
|
19
28
|
const Vue2TemplateCompiler = require('vue-template-compiler/build');
|
|
20
|
-
__exportStar(require("@vue/compiler-dom"), exports);
|
|
21
29
|
function compile(template, options = {}) {
|
|
22
30
|
const onError = options.onError;
|
|
23
31
|
const onWarn = options.onWarn;
|
|
24
32
|
options.onError = (error) => {
|
|
25
|
-
if (error.code === 33
|
|
26
|
-
|| error.code === 29
|
|
33
|
+
if (error.code === 33 // :key binding allowed in v-for template child in vue 2
|
|
34
|
+
|| error.code === 29 // fix https://github.com/vuejs/language-tools/issues/1638
|
|
27
35
|
) {
|
|
28
36
|
return;
|
|
29
37
|
}
|
|
@@ -59,12 +67,12 @@ function compile(template, options = {}) {
|
|
|
59
67
|
},
|
|
60
68
|
});
|
|
61
69
|
}
|
|
62
|
-
return baseCompile(template, Object.assign({},
|
|
70
|
+
return baseCompile(template, Object.assign({}, CompilerDOM.parserOptions, options, {
|
|
63
71
|
nodeTransforms: [
|
|
64
|
-
...
|
|
72
|
+
...CompilerDOM.DOMNodeTransforms,
|
|
65
73
|
...(options.nodeTransforms || [])
|
|
66
74
|
],
|
|
67
|
-
directiveTransforms: Object.assign({},
|
|
75
|
+
directiveTransforms: Object.assign({}, CompilerDOM.DOMDirectiveTransforms, options.directiveTransforms || {}),
|
|
68
76
|
}));
|
|
69
77
|
}
|
|
70
78
|
exports.compile = compile;
|
|
@@ -73,19 +81,19 @@ function baseCompile(template, options = {}) {
|
|
|
73
81
|
const isModuleMode = options.mode === 'module';
|
|
74
82
|
const prefixIdentifiers = options.prefixIdentifiers === true || isModuleMode;
|
|
75
83
|
if (!prefixIdentifiers && options.cacheHandlers) {
|
|
76
|
-
onError(
|
|
84
|
+
onError(CompilerDOM.createCompilerError(49));
|
|
77
85
|
}
|
|
78
86
|
if (options.scopeId && !isModuleMode) {
|
|
79
|
-
onError(
|
|
87
|
+
onError(CompilerDOM.createCompilerError(50));
|
|
80
88
|
}
|
|
81
|
-
const ast =
|
|
82
|
-
const [nodeTransforms, directiveTransforms] =
|
|
89
|
+
const ast = CompilerDOM.baseParse(template, options);
|
|
90
|
+
const [nodeTransforms, directiveTransforms] = CompilerDOM.getBaseTransformPreset(prefixIdentifiers);
|
|
83
91
|
// v-for > v-if in vue 2
|
|
84
92
|
const transformIf = nodeTransforms[1];
|
|
85
93
|
const transformFor = nodeTransforms[3];
|
|
86
94
|
nodeTransforms[1] = transformFor;
|
|
87
95
|
nodeTransforms[3] = transformIf;
|
|
88
|
-
|
|
96
|
+
CompilerDOM.transform(ast, Object.assign({}, options, {
|
|
89
97
|
prefixIdentifiers,
|
|
90
98
|
nodeTransforms: [
|
|
91
99
|
...nodeTransforms,
|
|
@@ -94,7 +102,7 @@ function baseCompile(template, options = {}) {
|
|
|
94
102
|
directiveTransforms: Object.assign({}, directiveTransforms, options.directiveTransforms || {} // user transforms
|
|
95
103
|
)
|
|
96
104
|
}));
|
|
97
|
-
return
|
|
105
|
+
return CompilerDOM.generate(ast, Object.assign({}, options, {
|
|
98
106
|
prefixIdentifiers
|
|
99
107
|
}));
|
|
100
108
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/language-core",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.10",
|
|
4
4
|
"main": "out/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"optional": true
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "97d60fa475b653fe435a7fae6e2a626821658351"
|
|
38
38
|
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { VueCompilerOptions } from '../types';
|
|
2
|
-
export declare const baseName = "__VLS_types.d.ts";
|
|
3
|
-
export declare function getTypesCode(vueCompilerOptions: VueCompilerOptions): string;
|
|
4
|
-
export declare function genConstructorOverloads(name?: string, nums?: number): string;
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.genConstructorOverloads = exports.getTypesCode = exports.baseName = void 0;
|
|
4
|
-
const shared_1 = require("./shared");
|
|
5
|
-
exports.baseName = '__VLS_types.d.ts';
|
|
6
|
-
function getTypesCode(vueCompilerOptions) {
|
|
7
|
-
return `
|
|
8
|
-
// @ts-nocheck
|
|
9
|
-
|
|
10
|
-
type __VLS_IntrinsicElements = __VLS_PickNotAny<import('vue/jsx-runtime').JSX.IntrinsicElements, __VLS_PickNotAny<JSX.IntrinsicElements, Record<string, any>>>;
|
|
11
|
-
type __VLS_Element = __VLS_PickNotAny<import('vue/jsx-runtime').JSX.Element, JSX.Element>;
|
|
12
|
-
|
|
13
|
-
type __VLS_IsAny<T> = 0 extends 1 & T ? true : false;
|
|
14
|
-
type __VLS_PickNotAny<A, B> = __VLS_IsAny<A> extends true ? B : A;
|
|
15
|
-
|
|
16
|
-
type __VLS_Prettify<T> = {
|
|
17
|
-
[K in keyof T]: T[K];
|
|
18
|
-
} & {};
|
|
19
|
-
|
|
20
|
-
type __VLS_GlobalComponents =
|
|
21
|
-
__VLS_PickNotAny<import('vue').GlobalComponents, {}>
|
|
22
|
-
& __VLS_PickNotAny<import('@vue/runtime-core').GlobalComponents, {}>
|
|
23
|
-
& __VLS_PickNotAny<import('@vue/runtime-dom').GlobalComponents, {}>
|
|
24
|
-
& Pick<typeof import('${vueCompilerOptions.lib}'),
|
|
25
|
-
'Transition'
|
|
26
|
-
| 'TransitionGroup'
|
|
27
|
-
| 'KeepAlive'
|
|
28
|
-
| 'Suspense'
|
|
29
|
-
| 'Teleport'
|
|
30
|
-
>;
|
|
31
|
-
|
|
32
|
-
// v-for
|
|
33
|
-
declare function __VLS_getVForSourceType(source: number): [number, number, number][];
|
|
34
|
-
declare function __VLS_getVForSourceType(source: string): [string, number, number][];
|
|
35
|
-
declare function __VLS_getVForSourceType<T extends any[]>(source: T): [
|
|
36
|
-
T[number], // item
|
|
37
|
-
number, // key
|
|
38
|
-
number, // index
|
|
39
|
-
][];
|
|
40
|
-
declare function __VLS_getVForSourceType<T extends { [Symbol.iterator](): Iterator<any> }>(source: T): [
|
|
41
|
-
T extends { [Symbol.iterator](): Iterator<infer T1> } ? T1 : never, // item
|
|
42
|
-
number, // key
|
|
43
|
-
undefined, // index
|
|
44
|
-
][];
|
|
45
|
-
declare function __VLS_getVForSourceType<T>(source: T): [
|
|
46
|
-
T[keyof T], // item
|
|
47
|
-
keyof T, // key
|
|
48
|
-
number, // index
|
|
49
|
-
][];
|
|
50
|
-
|
|
51
|
-
declare function __VLS_getSlotParams<T>(slot: T): Parameters<__VLS_PickNotAny<NonNullable<T>, (...args: any[]) => any>>;
|
|
52
|
-
declare function __VLS_getSlotParam<T>(slot: T): Parameters<__VLS_PickNotAny<NonNullable<T>, (...args: any[]) => any>>[0];
|
|
53
|
-
declare function __VLS_directiveFunction<T>(dir: T):
|
|
54
|
-
T extends import('${vueCompilerOptions.lib}').ObjectDirective<infer E, infer V> | import('${vueCompilerOptions.lib}').FunctionDirective<infer E, infer V> ? (el: E, value: V) => void
|
|
55
|
-
: T;
|
|
56
|
-
declare function __VLS_withScope<T, K>(ctx: T, scope: K): ctx is T & K;
|
|
57
|
-
declare function __VLS_makeOptional<T>(t: T): { [K in keyof T]?: T[K] };
|
|
58
|
-
|
|
59
|
-
type __VLS_SelfComponent<N, C> = string extends N ? {} : N extends string ? { [P in N]: C } : {};
|
|
60
|
-
type __VLS_WithComponent<N0 extends string, Components, N1 extends string, N2 extends string, N3 extends string> =
|
|
61
|
-
N1 extends keyof Components ? N1 extends N0 ? Pick<Components, N0> : { [K in N0]: Components[N1] } :
|
|
62
|
-
N2 extends keyof Components ? N2 extends N0 ? Pick<Components, N0> : { [K in N0]: Components[N2] } :
|
|
63
|
-
N3 extends keyof Components ? N3 extends N0 ? Pick<Components, N0> : { [K in N0]: Components[N3] } :
|
|
64
|
-
${vueCompilerOptions.strictTemplates ? '{}' : '{ [K in N0]: unknown }'}
|
|
65
|
-
|
|
66
|
-
type __VLS_FillingEventArg_ParametersLength<E extends (...args: any) => any> = __VLS_IsAny<Parameters<E>> extends true ? -1 : Parameters<E>['length'];
|
|
67
|
-
type __VLS_FillingEventArg<E> = E extends (...args: any) => any ? __VLS_FillingEventArg_ParametersLength<E> extends 0 ? ($event?: undefined) => ReturnType<E> : E : E;
|
|
68
|
-
type __VLS_EmitEvent<F, E> =
|
|
69
|
-
F extends {
|
|
70
|
-
(event: E, ...payload: infer P): any
|
|
71
|
-
} ? (...payload: P) => void
|
|
72
|
-
: F extends {
|
|
73
|
-
(event: E, ...payload: infer P): any
|
|
74
|
-
(...args: any): any
|
|
75
|
-
} ? (...payload: P) => void
|
|
76
|
-
: F extends {
|
|
77
|
-
(event: E, ...payload: infer P): any
|
|
78
|
-
(...args: any): any
|
|
79
|
-
(...args: any): any
|
|
80
|
-
} ? (...payload: P) => void
|
|
81
|
-
: F extends {
|
|
82
|
-
(event: E, ...payload: infer P): any
|
|
83
|
-
(...args: any): any
|
|
84
|
-
(...args: any): any
|
|
85
|
-
(...args: any): any
|
|
86
|
-
} ? (...payload: P) => void
|
|
87
|
-
: unknown | '[Type Warning] Volar could not infer $emit event more than 4 overloads without DefineComponent. see https://github.com/vuejs/language-tools/issues/60';
|
|
88
|
-
declare function __VLS_asFunctionalComponent<T, K = T extends new (...args: any) => any ? InstanceType<T> : unknown>(t: T, instance?: K):
|
|
89
|
-
T extends new (...args: any) => any
|
|
90
|
-
? (props: (K extends { $props: infer Props } ? Props : any)${vueCompilerOptions.strictTemplates ? '' : ' & Record<string, unknown>'}, ctx?: {
|
|
91
|
-
attrs?: any,
|
|
92
|
-
slots?: K extends { ${(0, shared_1.getSlotsPropertyName)(vueCompilerOptions.target)}: infer Slots } ? Slots : any,
|
|
93
|
-
emit?: K extends { $emit: infer Emit } ? Emit : any
|
|
94
|
-
}) => JSX.Element & { __ctx?: typeof ctx & { props?: typeof props; expose?(exposed: K): void; } }
|
|
95
|
-
: T extends () => any ? (props: {}, ctx?: any) => ReturnType<T>
|
|
96
|
-
: T extends (...args: any) => any ? T
|
|
97
|
-
: (_: T extends import('${vueCompilerOptions.lib}').VNode | import('${vueCompilerOptions.lib}').VNode[] | string ? {}: T${vueCompilerOptions.strictTemplates ? '' : ' & Record<string, unknown>'}, ctx?: any) => { __ctx?: { attrs?: any, expose?: any, slots?: any, emit?: any, props?: T${vueCompilerOptions.strictTemplates ? '' : ' & Record<string, unknown>'} } }; // IntrinsicElement
|
|
98
|
-
declare function __VLS_functionalComponentArgsRest<T extends (...args: any) => any>(t: T): Parameters<T>['length'] extends 2 ? [any] : [];
|
|
99
|
-
declare function __VLS_pickEvent<Emit, K, E>(emit: Emit, emitKey: K, event: E): __VLS_FillingEventArg<
|
|
100
|
-
__VLS_PickNotAny<
|
|
101
|
-
__VLS_AsFunctionOrAny<E>,
|
|
102
|
-
__VLS_AsFunctionOrAny<__VLS_EmitEvent<Emit, K>>
|
|
103
|
-
>
|
|
104
|
-
> | undefined;
|
|
105
|
-
declare function __VLS_pickFunctionalComponentCtx<T, K>(comp: T, compInstance: K): __VLS_PickNotAny<
|
|
106
|
-
K extends { __ctx?: infer Ctx } ? Ctx : any,
|
|
107
|
-
T extends (props: any, ctx: infer Ctx) => any ? Ctx : any
|
|
108
|
-
>;
|
|
109
|
-
type __VLS_AsFunctionOrAny<F> = unknown extends F ? any : ((...args: any) => any) extends F ? F : any;
|
|
110
|
-
|
|
111
|
-
declare function __VLS_componentProps<T, K>(comp: T, fnReturn: K):
|
|
112
|
-
__VLS_PickNotAny<K, {}> extends { __ctx: { props: infer P } } ? NonNullable<P>
|
|
113
|
-
: T extends (props: infer P, ...args: any) => any ? NonNullable<P> :
|
|
114
|
-
{};
|
|
115
|
-
`.trim();
|
|
116
|
-
}
|
|
117
|
-
exports.getTypesCode = getTypesCode;
|
|
118
|
-
// TODO: not working for overloads > n (n = 8)
|
|
119
|
-
// see: https://github.com/vuejs/language-tools/issues/60
|
|
120
|
-
function genConstructorOverloads(name = 'ConstructorOverloads', nums) {
|
|
121
|
-
let code = '';
|
|
122
|
-
code += `type ${name}<T> =\n`;
|
|
123
|
-
if (nums === undefined) {
|
|
124
|
-
for (let i = 8; i >= 1; i--) {
|
|
125
|
-
gen(i);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
else if (nums > 0) {
|
|
129
|
-
gen(nums);
|
|
130
|
-
}
|
|
131
|
-
code += `// 0\n`;
|
|
132
|
-
code += `{};\n`;
|
|
133
|
-
return code;
|
|
134
|
-
function gen(i) {
|
|
135
|
-
code += `// ${i}\n`;
|
|
136
|
-
code += `T extends {\n`;
|
|
137
|
-
for (let j = 1; j <= i; j++) {
|
|
138
|
-
code += `(event: infer E${j}, ...payload: infer P${j}): void;\n`;
|
|
139
|
-
}
|
|
140
|
-
code += `} ? (\n`;
|
|
141
|
-
for (let j = 1; j <= i; j++) {
|
|
142
|
-
if (j > 1)
|
|
143
|
-
code += '& ';
|
|
144
|
-
code += `(E${j} extends string ? { [K${j} in E${j}]: (...payload: P${j}) => void } : {})\n`;
|
|
145
|
-
}
|
|
146
|
-
code += `) :\n`;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
exports.genConstructorOverloads = genConstructorOverloads;
|
|
150
|
-
//# sourceMappingURL=directorySharedTypes.js.map
|