@vue/language-core 1.8.8 → 1.8.11
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 +45 -9
- package/out/generators/template.d.ts +3 -2
- package/out/generators/template.js +72 -20
- 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/parsers/scriptSetupRanges.js +1 -1
- 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 +10 -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 +37 -7
- 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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
3
|
const plugin = ({ modules }) => {
|
|
3
4
|
return {
|
|
4
5
|
version: 1,
|
|
@@ -164,5 +165,5 @@ const plugin = ({ modules }) => {
|
|
|
164
165
|
},
|
|
165
166
|
};
|
|
166
167
|
};
|
|
167
|
-
|
|
168
|
+
exports.default = plugin;
|
|
168
169
|
//# sourceMappingURL=vue-template-html.js.map
|
package/out/plugins/vue-tsx.d.ts
CHANGED
package/out/plugins/vue-tsx.js
CHANGED
|
@@ -1,13 +1,36 @@
|
|
|
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.tsCodegen = void 0;
|
|
4
27
|
const reactivity_1 = require("@vue/reactivity");
|
|
5
28
|
const script_1 = require("../generators/script");
|
|
6
|
-
const templateGen = require("../generators/template");
|
|
29
|
+
const templateGen = __importStar(require("../generators/template"));
|
|
7
30
|
const scriptRanges_1 = require("../parsers/scriptRanges");
|
|
8
31
|
const scriptSetupRanges_1 = require("../parsers/scriptSetupRanges");
|
|
9
32
|
const language_core_1 = require("@volar/language-core");
|
|
10
|
-
const muggle = require("muggle-string");
|
|
33
|
+
const muggle = __importStar(require("muggle-string"));
|
|
11
34
|
const templateFormatReg = /^\.template_format\.ts$/;
|
|
12
35
|
const templateStyleCssReg = /^\.template_style\.css$/;
|
|
13
36
|
exports.tsCodegen = new WeakMap();
|
package/out/plugins.d.ts
CHANGED
|
@@ -22,3 +22,4 @@ export declare function getDefaultVueLanguagePlugins(ts: typeof import('typescri
|
|
|
22
22
|
getEmbeddedFileNames?(fileName: string, sfc: import("./types").Sfc): string[];
|
|
23
23
|
resolveEmbeddedFile?(fileName: string, sfc: import("./types").Sfc, embeddedFile: import("./sourceFile").VueEmbeddedFile): void;
|
|
24
24
|
}[];
|
|
25
|
+
//# sourceMappingURL=plugins.d.ts.map
|
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;
|
|
@@ -23,6 +23,8 @@ export interface VueCompilerOptions {
|
|
|
23
23
|
defineSlots: string[];
|
|
24
24
|
defineEmits: string[];
|
|
25
25
|
defineExpose: string[];
|
|
26
|
+
defineModel: string[];
|
|
27
|
+
defineOptions: string[];
|
|
26
28
|
withDefaults: string[];
|
|
27
29
|
};
|
|
28
30
|
plugins: VueLanguagePlugin[];
|
|
@@ -52,13 +54,13 @@ export type VueLanguagePlugin = (ctx: {
|
|
|
52
54
|
end: number;
|
|
53
55
|
newText: string;
|
|
54
56
|
}): SFCParseResult | undefined;
|
|
55
|
-
resolveTemplateCompilerOptions?(options:
|
|
56
|
-
compileSFCTemplate?(lang: string, template: string, options:
|
|
57
|
-
updateSFCTemplate?(oldResult:
|
|
57
|
+
resolveTemplateCompilerOptions?(options: CompilerDOM.CompilerOptions): CompilerDOM.CompilerOptions;
|
|
58
|
+
compileSFCTemplate?(lang: string, template: string, options: CompilerDOM.CompilerOptions): CompilerDOM.CodegenResult | undefined;
|
|
59
|
+
updateSFCTemplate?(oldResult: CompilerDOM.CodegenResult, textChange: {
|
|
58
60
|
start: number;
|
|
59
61
|
end: number;
|
|
60
62
|
newText: string;
|
|
61
|
-
}):
|
|
63
|
+
}): CompilerDOM.CodegenResult | undefined;
|
|
62
64
|
getEmbeddedFileNames?(fileName: string, sfc: Sfc): string[];
|
|
63
65
|
resolveEmbeddedFile?(fileName: string, sfc: Sfc, embeddedFile: VueEmbeddedFile): void;
|
|
64
66
|
};
|
|
@@ -97,7 +99,7 @@ export interface Sfc {
|
|
|
97
99
|
customBlocks: (SfcBlock & {
|
|
98
100
|
type: string;
|
|
99
101
|
})[];
|
|
100
|
-
templateAst:
|
|
102
|
+
templateAst: CompilerDOM.RootNode | undefined;
|
|
101
103
|
scriptAst: ts.SourceFile | undefined;
|
|
102
104
|
scriptSetupAst: ts.SourceFile | undefined;
|
|
103
105
|
}
|
|
@@ -105,3 +107,4 @@ export interface TextRange {
|
|
|
105
107
|
start: number;
|
|
106
108
|
end: number;
|
|
107
109
|
}
|
|
110
|
+
//# 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) {
|
|
@@ -198,12 +225,15 @@ function resolveVueCompilerOptions(vueOptions) {
|
|
|
198
225
|
optionsWrapper: vueOptions.optionsWrapper ?? (target >= 2.7
|
|
199
226
|
? [`(await import('${lib}')).defineComponent(`, `)`]
|
|
200
227
|
: [`(await import('vue')).default.extend(`, `)`]),
|
|
201
|
-
macros:
|
|
228
|
+
macros: {
|
|
202
229
|
defineProps: ['defineProps'],
|
|
203
230
|
defineSlots: ['defineSlots'],
|
|
204
231
|
defineEmits: ['defineEmits'],
|
|
205
232
|
defineExpose: ['defineExpose'],
|
|
233
|
+
defineModel: ['defineModel'],
|
|
234
|
+
defineOptions: ['defineOptions'],
|
|
206
235
|
withDefaults: ['withDefaults'],
|
|
236
|
+
...vueOptions.macros,
|
|
207
237
|
},
|
|
208
238
|
plugins: vueOptions.plugins ?? [],
|
|
209
239
|
hooks: vueOptions.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.11",
|
|
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": "cce193dcc182aad5d02f630fa3ae8a793d443680"
|
|
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;
|