@vue/language-core 2.0.13 → 2.0.15
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/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/codegen/common.d.ts +11 -0
- package/lib/codegen/common.js +70 -0
- package/lib/codegen/script/component.d.ts +9 -0
- package/lib/codegen/script/component.js +109 -0
- package/lib/codegen/script/context.d.ts +25 -0
- package/lib/codegen/script/context.js +124 -0
- package/lib/{generators → codegen/script}/globalTypes.d.ts +1 -1
- package/lib/codegen/script/globalTypes.js +135 -0
- package/lib/codegen/script/index.d.ts +33 -0
- package/lib/codegen/script/index.js +127 -0
- package/lib/codegen/script/internalComponent.d.ts +5 -0
- package/lib/codegen/script/internalComponent.js +58 -0
- package/lib/codegen/script/scriptSetup.d.ts +6 -0
- package/lib/codegen/script/scriptSetup.js +371 -0
- package/lib/codegen/script/src.d.ts +2 -0
- package/lib/codegen/script/src.js +52 -0
- package/lib/codegen/script/template.d.ts +5 -0
- package/lib/codegen/script/template.js +196 -0
- package/lib/codegen/template/camelized.d.ts +2 -0
- package/lib/codegen/template/camelized.js +32 -0
- package/lib/codegen/template/context.d.ts +44 -0
- package/lib/codegen/template/context.js +170 -0
- package/lib/codegen/template/element.d.ts +8 -0
- package/lib/codegen/template/element.js +378 -0
- package/lib/codegen/template/elementChildren.d.ts +5 -0
- package/lib/codegen/template/elementChildren.js +26 -0
- package/lib/codegen/template/elementDirectives.d.ts +5 -0
- package/lib/codegen/template/elementDirectives.js +46 -0
- package/lib/codegen/template/elementEvents.d.ts +9 -0
- package/lib/codegen/template/elementEvents.js +157 -0
- package/lib/codegen/template/elementProps.d.ts +5 -0
- package/lib/codegen/template/elementProps.js +275 -0
- package/lib/codegen/template/index.d.ts +60 -0
- package/lib/codegen/template/index.js +130 -0
- package/lib/codegen/template/interpolation.d.ts +6 -0
- package/lib/{utils/transform.js → codegen/template/interpolation.js} +76 -46
- package/lib/codegen/template/objectProperty.d.ts +4 -0
- package/lib/codegen/template/objectProperty.js +31 -0
- package/lib/codegen/template/propertyAccess.d.ts +4 -0
- package/lib/codegen/template/propertyAccess.js +24 -0
- package/lib/codegen/template/slotOutlet.d.ts +5 -0
- package/lib/codegen/template/slotOutlet.js +72 -0
- package/lib/codegen/template/stringLiteralKey.d.ts +2 -0
- package/lib/codegen/template/stringLiteralKey.js +14 -0
- package/lib/codegen/template/templateChild.d.ts +7 -0
- package/lib/codegen/template/templateChild.js +160 -0
- package/lib/codegen/template/vFor.d.ts +12 -0
- package/lib/codegen/template/vFor.js +69 -0
- package/lib/codegen/template/vIf.d.ts +5 -0
- package/lib/codegen/template/vIf.js +53 -0
- package/lib/languageModule.d.ts +3 -4
- package/lib/languageModule.js +31 -14
- package/lib/parsers/scriptSetupRanges.d.ts +1 -0
- package/lib/parsers/scriptSetupRanges.js +6 -1
- package/lib/plugins/file-html.js +63 -66
- package/lib/plugins/file-md.js +47 -50
- package/lib/plugins/shared.d.ts +2 -0
- package/lib/plugins/shared.js +12 -0
- package/lib/plugins/vue-sfc-customblocks.js +2 -2
- package/lib/plugins/vue-sfc-scripts.js +2 -3
- package/lib/plugins/vue-sfc-styles.js +3 -3
- package/lib/plugins/vue-sfc-template.js +2 -2
- package/lib/plugins/vue-template-inline-css.js +34 -2
- package/lib/plugins/vue-template-inline-ts.js +10 -8
- package/lib/plugins/vue-tsx.d.ts +43 -5
- package/lib/plugins/vue-tsx.js +38 -28
- package/lib/plugins.d.ts +2 -1
- package/lib/plugins.js +18 -9
- package/lib/types.d.ts +3 -3
- package/lib/utils/ts.js +20 -32
- package/lib/virtualFile/computedFiles.d.ts +2 -1
- package/lib/virtualFile/computedFiles.js +41 -15
- package/lib/virtualFile/computedMappings.js +3 -3
- package/lib/virtualFile/computedSfc.js +22 -1
- package/lib/virtualFile/embeddedFile.d.ts +2 -3
- package/lib/virtualFile/embeddedFile.js +1 -2
- package/lib/virtualFile/vueFile.d.ts +3 -5
- package/lib/virtualFile/vueFile.js +6 -8
- package/package.json +3 -3
- package/lib/generators/globalTypes.js +0 -135
- package/lib/generators/inlineCss.d.ts +0 -3
- package/lib/generators/inlineCss.js +0 -37
- package/lib/generators/script.d.ts +0 -13
- package/lib/generators/script.js +0 -981
- package/lib/generators/template.d.ts +0 -19
- package/lib/generators/template.js +0 -1578
- package/lib/generators/utils.d.ts +0 -5
- package/lib/generators/utils.js +0 -54
- package/lib/utils/transform.d.ts +0 -8
package/lib/plugins.js
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const file_html_1 = require("./plugins/file-html");
|
|
5
|
-
const file_md_1 = require("./plugins/file-md");
|
|
6
|
-
const file_vue_1 = require("./plugins/file-vue");
|
|
17
|
+
exports.getBasePlugins = void 0;
|
|
7
18
|
const vue_sfc_customblocks_1 = require("./plugins/vue-sfc-customblocks");
|
|
8
19
|
const vue_sfc_scripts_1 = require("./plugins/vue-sfc-scripts");
|
|
9
20
|
const vue_sfc_styles_1 = require("./plugins/vue-sfc-styles");
|
|
@@ -13,11 +24,9 @@ const vue_template_inline_css_1 = require("./plugins/vue-template-inline-css");
|
|
|
13
24
|
const vue_template_inline_ts_1 = require("./plugins/vue-template-inline-ts");
|
|
14
25
|
const vue_tsx_1 = require("./plugins/vue-tsx");
|
|
15
26
|
const types_1 = require("./types");
|
|
16
|
-
|
|
27
|
+
__exportStar(require("./plugins/shared"), exports);
|
|
28
|
+
function getBasePlugins(pluginContext) {
|
|
17
29
|
const plugins = [
|
|
18
|
-
file_md_1.default, // .md for VitePress
|
|
19
|
-
file_html_1.default, // .html for PetiteVue
|
|
20
|
-
file_vue_1.default, // .vue and others for Vue
|
|
21
30
|
vue_template_html_1.default,
|
|
22
31
|
vue_template_inline_css_1.default,
|
|
23
32
|
vue_template_inline_ts_1.default,
|
|
@@ -53,5 +62,5 @@ function getDefaultVueLanguagePlugins(pluginContext) {
|
|
|
53
62
|
return valid;
|
|
54
63
|
});
|
|
55
64
|
}
|
|
56
|
-
exports.
|
|
65
|
+
exports.getBasePlugins = getBasePlugins;
|
|
57
66
|
//# sourceMappingURL=plugins.js.map
|
package/lib/types.d.ts
CHANGED
|
@@ -19,17 +19,18 @@ export interface VueCodeInformation extends CodeInformation {
|
|
|
19
19
|
paddingLeft?: boolean;
|
|
20
20
|
};
|
|
21
21
|
__combineLastMapping?: boolean;
|
|
22
|
+
__combineOffsetMapping?: number;
|
|
22
23
|
}
|
|
23
|
-
export type CodeAndStack = [code: Code, stack: string];
|
|
24
24
|
export type Code = Segment<VueCodeInformation>;
|
|
25
25
|
export interface VueCompilerOptions {
|
|
26
26
|
target: number;
|
|
27
27
|
lib: string;
|
|
28
28
|
extensions: string[];
|
|
29
|
+
vitePressExtensions: string[];
|
|
30
|
+
petiteVueExtensions: string[];
|
|
29
31
|
jsxSlots: boolean;
|
|
30
32
|
strictTemplates: boolean;
|
|
31
33
|
skipTemplateCodegen: boolean;
|
|
32
|
-
nativeTags: string[];
|
|
33
34
|
dataAttributes: string[];
|
|
34
35
|
htmlAttributes: string[];
|
|
35
36
|
optionsWrapper: [string, string] | [];
|
|
@@ -56,7 +57,6 @@ export type VueLanguagePlugin = (ctx: {
|
|
|
56
57
|
};
|
|
57
58
|
compilerOptions: ts.CompilerOptions;
|
|
58
59
|
vueCompilerOptions: VueCompilerOptions;
|
|
59
|
-
codegenStack: boolean;
|
|
60
60
|
globalTypesHolder: string | undefined;
|
|
61
61
|
}) => {
|
|
62
62
|
version: typeof pluginVersion;
|
package/lib/utils/ts.js
CHANGED
|
@@ -16,7 +16,11 @@ function createParsedCommandLineByJson(ts, parseConfigHost, rootDir, json, confi
|
|
|
16
16
|
catch (err) { }
|
|
17
17
|
}
|
|
18
18
|
const resolvedVueOptions = resolveVueCompilerOptions(vueOptions);
|
|
19
|
-
const parsed = ts.parseJsonConfigFileContent(json, proxyHost.host, rootDir, {}, configFileName, undefined,
|
|
19
|
+
const parsed = ts.parseJsonConfigFileContent(json, proxyHost.host, rootDir, {}, configFileName, undefined, [
|
|
20
|
+
...resolvedVueOptions.extensions,
|
|
21
|
+
...resolvedVueOptions.vitePressExtensions,
|
|
22
|
+
...resolvedVueOptions.petiteVueExtensions,
|
|
23
|
+
].map(extension => ({
|
|
20
24
|
extension: extension.slice(1),
|
|
21
25
|
isMixedContent: true,
|
|
22
26
|
scriptKind: ts.ScriptKind.Deferred,
|
|
@@ -47,7 +51,11 @@ function createParsedCommandLine(ts, parseConfigHost, tsConfigPath) {
|
|
|
47
51
|
catch (err) { }
|
|
48
52
|
}
|
|
49
53
|
const resolvedVueOptions = resolveVueCompilerOptions(vueOptions);
|
|
50
|
-
const parsed = ts.parseJsonSourceFileConfigFileContent(config, proxyHost.host, path.dirname(tsConfigPath), {}, tsConfigPath, undefined,
|
|
54
|
+
const parsed = ts.parseJsonSourceFileConfigFileContent(config, proxyHost.host, path.dirname(tsConfigPath), {}, tsConfigPath, undefined, [
|
|
55
|
+
...resolvedVueOptions.extensions,
|
|
56
|
+
...resolvedVueOptions.vitePressExtensions,
|
|
57
|
+
...resolvedVueOptions.petiteVueExtensions,
|
|
58
|
+
].map(extension => ({
|
|
51
59
|
extension: extension.slice(1),
|
|
52
60
|
isMixedContent: true,
|
|
53
61
|
scriptKind: ts.ScriptKind.Deferred,
|
|
@@ -121,7 +129,14 @@ function getPartialVueCompilerOptions(ts, tsConfigSourceFile) {
|
|
|
121
129
|
const resolvedPath = resolvePath(pluginPath);
|
|
122
130
|
if (resolvedPath) {
|
|
123
131
|
const plugin = require(resolvedPath);
|
|
124
|
-
plugin
|
|
132
|
+
if (Array.isArray(plugin)) {
|
|
133
|
+
for (let i = 0; i < plugin.length; i++) {
|
|
134
|
+
plugin[i].__moduleName = `${pluginPath} (${i})`;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
plugin.__moduleName = pluginPath;
|
|
139
|
+
}
|
|
125
140
|
return plugin;
|
|
126
141
|
}
|
|
127
142
|
else {
|
|
@@ -151,27 +166,6 @@ function getPartialVueCompilerOptions(ts, tsConfigSourceFile) {
|
|
|
151
166
|
}
|
|
152
167
|
}
|
|
153
168
|
}
|
|
154
|
-
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element
|
|
155
|
-
const HTML_TAGS = 'html,body,base,head,link,meta,style,title,address,article,aside,footer,' +
|
|
156
|
-
'header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,' +
|
|
157
|
-
'figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,' +
|
|
158
|
-
'data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,' +
|
|
159
|
-
'time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,' +
|
|
160
|
-
'canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,' +
|
|
161
|
-
'th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,' +
|
|
162
|
-
'option,output,progress,select,textarea,details,dialog,menu,' +
|
|
163
|
-
'summary,template,blockquote,iframe,tfoot';
|
|
164
|
-
// https://developer.mozilla.org/en-US/docs/Web/SVG/Element
|
|
165
|
-
const SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' +
|
|
166
|
-
'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' +
|
|
167
|
-
'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' +
|
|
168
|
-
'feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +
|
|
169
|
-
'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' +
|
|
170
|
-
'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' +
|
|
171
|
-
'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' +
|
|
172
|
-
'mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,' +
|
|
173
|
-
'polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,' +
|
|
174
|
-
'text,textPath,title,tspan,unknown,use,view';
|
|
175
169
|
function resolveVueCompilerOptions(vueOptions) {
|
|
176
170
|
const target = vueOptions.target ?? 3.3;
|
|
177
171
|
const lib = vueOptions.lib || (target < 2.7 ? '@vue/runtime-dom' : 'vue');
|
|
@@ -179,18 +173,12 @@ function resolveVueCompilerOptions(vueOptions) {
|
|
|
179
173
|
...vueOptions,
|
|
180
174
|
target,
|
|
181
175
|
extensions: vueOptions.extensions ?? ['.vue'],
|
|
176
|
+
vitePressExtensions: vueOptions.vitePressExtensions ?? [],
|
|
177
|
+
petiteVueExtensions: vueOptions.petiteVueExtensions ?? [],
|
|
182
178
|
lib,
|
|
183
179
|
jsxSlots: vueOptions.jsxSlots ?? false,
|
|
184
180
|
strictTemplates: vueOptions.strictTemplates ?? false,
|
|
185
181
|
skipTemplateCodegen: vueOptions.skipTemplateCodegen ?? false,
|
|
186
|
-
nativeTags: vueOptions.nativeTags ?? [...new Set([
|
|
187
|
-
...HTML_TAGS.split(','),
|
|
188
|
-
...SVG_TAGS.split(','),
|
|
189
|
-
// fix https://github.com/johnsoncodehk/volar/issues/1340
|
|
190
|
-
'hgroup',
|
|
191
|
-
'slot',
|
|
192
|
-
'component',
|
|
193
|
-
])],
|
|
194
182
|
dataAttributes: vueOptions.dataAttributes ?? [],
|
|
195
183
|
htmlAttributes: vueOptions.htmlAttributes ?? ['aria-*'],
|
|
196
184
|
optionsWrapper: vueOptions.optionsWrapper ?? (target >= 2.7
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { VirtualCode } from '@volar/language-core';
|
|
2
2
|
import type { Sfc, VueLanguagePlugin } from '../types';
|
|
3
|
-
export declare function computedFiles(plugins: ReturnType<VueLanguagePlugin>[], fileName: string, sfc: Sfc
|
|
3
|
+
export declare function computedFiles(plugins: ReturnType<VueLanguagePlugin>[], fileName: string, sfc: Sfc): () => VirtualCode[];
|
|
4
|
+
export declare function resolveCommonLanguageId(lang: string): string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.computedFiles = void 0;
|
|
3
|
+
exports.resolveCommonLanguageId = exports.computedFiles = void 0;
|
|
4
4
|
const language_core_1 = require("@volar/language-core");
|
|
5
5
|
const computeds_1 = require("computeds");
|
|
6
6
|
const embeddedFile_1 = require("./embeddedFile");
|
|
7
|
-
function computedFiles(plugins, fileName, sfc
|
|
7
|
+
function computedFiles(plugins, fileName, sfc) {
|
|
8
8
|
const nameToBlock = (0, computeds_1.computed)(() => {
|
|
9
9
|
const blocks = {};
|
|
10
10
|
if (sfc.template) {
|
|
@@ -24,7 +24,7 @@ function computedFiles(plugins, fileName, sfc, codegenStack) {
|
|
|
24
24
|
}
|
|
25
25
|
return blocks;
|
|
26
26
|
});
|
|
27
|
-
const pluginsResult = plugins.map(plugin => computedPluginFiles(plugins, plugin, fileName, sfc, nameToBlock
|
|
27
|
+
const pluginsResult = plugins.map(plugin => computedPluginFiles(plugins, plugin, fileName, sfc, nameToBlock));
|
|
28
28
|
const flatResult = (0, computeds_1.computed)(() => pluginsResult.map(r => r()).flat());
|
|
29
29
|
const structuredResult = (0, computeds_1.computed)(() => {
|
|
30
30
|
const embeddedCodes = [];
|
|
@@ -42,15 +42,14 @@ function computedFiles(plugins, fileName, sfc, codegenStack) {
|
|
|
42
42
|
return embeddedCodes;
|
|
43
43
|
function consumeRemain() {
|
|
44
44
|
for (let i = remain.length - 1; i >= 0; i--) {
|
|
45
|
-
const { file, snapshot, mappings
|
|
45
|
+
const { file, snapshot, mappings } = remain[i];
|
|
46
46
|
if (!file.parentCodeId) {
|
|
47
47
|
embeddedCodes.push({
|
|
48
48
|
id: file.id,
|
|
49
|
-
languageId:
|
|
49
|
+
languageId: resolveCommonLanguageId(file.lang),
|
|
50
50
|
linkedCodeMappings: file.linkedCodeMappings,
|
|
51
51
|
snapshot,
|
|
52
52
|
mappings,
|
|
53
|
-
codegenStacks,
|
|
54
53
|
embeddedCodes: [],
|
|
55
54
|
});
|
|
56
55
|
remain.splice(i, 1);
|
|
@@ -61,11 +60,10 @@ function computedFiles(plugins, fileName, sfc, codegenStack) {
|
|
|
61
60
|
parent.embeddedCodes ??= [];
|
|
62
61
|
parent.embeddedCodes.push({
|
|
63
62
|
id: file.id,
|
|
64
|
-
languageId:
|
|
63
|
+
languageId: resolveCommonLanguageId(file.lang),
|
|
65
64
|
linkedCodeMappings: file.linkedCodeMappings,
|
|
66
65
|
snapshot,
|
|
67
66
|
mappings,
|
|
68
|
-
codegenStacks,
|
|
69
67
|
embeddedCodes: [],
|
|
70
68
|
});
|
|
71
69
|
remain.splice(i, 1);
|
|
@@ -88,7 +86,7 @@ function computedFiles(plugins, fileName, sfc, codegenStack) {
|
|
|
88
86
|
return structuredResult;
|
|
89
87
|
}
|
|
90
88
|
exports.computedFiles = computedFiles;
|
|
91
|
-
function computedPluginFiles(plugins, plugin, fileName, sfc, nameToBlock
|
|
89
|
+
function computedPluginFiles(plugins, plugin, fileName, sfc, nameToBlock) {
|
|
92
90
|
const embeddedFiles = {};
|
|
93
91
|
const files = (0, computeds_1.computed)(() => {
|
|
94
92
|
try {
|
|
@@ -104,8 +102,8 @@ function computedPluginFiles(plugins, plugin, fileName, sfc, nameToBlock, codege
|
|
|
104
102
|
for (const fileInfo of fileInfos) {
|
|
105
103
|
if (!embeddedFiles[fileInfo.id]) {
|
|
106
104
|
embeddedFiles[fileInfo.id] = (0, computeds_1.computed)(() => {
|
|
107
|
-
const
|
|
108
|
-
const file = new embeddedFile_1.VueEmbeddedCode(fileInfo.id, fileInfo.lang, content
|
|
105
|
+
const content = [];
|
|
106
|
+
const file = new embeddedFile_1.VueEmbeddedCode(fileInfo.id, fileInfo.lang, content);
|
|
109
107
|
for (const plugin of plugins) {
|
|
110
108
|
if (!plugin.resolveEmbeddedCode) {
|
|
111
109
|
continue;
|
|
@@ -151,8 +149,10 @@ function computedPluginFiles(plugins, plugin, fileName, sfc, nameToBlock, codege
|
|
|
151
149
|
return files().map(_file => {
|
|
152
150
|
const { file, snapshot } = _file();
|
|
153
151
|
const mappings = (0, language_core_1.buildMappings)(file.content);
|
|
152
|
+
const newMappings = [];
|
|
154
153
|
let lastValidMapping;
|
|
155
|
-
for (
|
|
154
|
+
for (let i = 0; i < mappings.length; i++) {
|
|
155
|
+
const mapping = mappings[i];
|
|
156
156
|
if (mapping.source !== undefined) {
|
|
157
157
|
const block = nameToBlock()[mapping.source];
|
|
158
158
|
if (block) {
|
|
@@ -163,7 +163,17 @@ function computedPluginFiles(plugins, plugin, fileName, sfc, nameToBlock, codege
|
|
|
163
163
|
}
|
|
164
164
|
mapping.source = undefined;
|
|
165
165
|
}
|
|
166
|
-
if (mapping.data.
|
|
166
|
+
if (mapping.data.__combineOffsetMapping !== undefined) {
|
|
167
|
+
const offsetMapping = mappings[i - mapping.data.__combineOffsetMapping];
|
|
168
|
+
if (typeof offsetMapping === 'string' || !offsetMapping) {
|
|
169
|
+
throw new Error('Invalid offset mapping, mappings: ' + mappings.length + ', i: ' + i + ', offset: ' + mapping.data.__combineOffsetMapping);
|
|
170
|
+
}
|
|
171
|
+
offsetMapping.sourceOffsets.push(...mapping.sourceOffsets);
|
|
172
|
+
offsetMapping.generatedOffsets.push(...mapping.generatedOffsets);
|
|
173
|
+
offsetMapping.lengths.push(...mapping.lengths);
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
else if (mapping.data.__combineLastMapping) {
|
|
167
177
|
lastValidMapping.sourceOffsets.push(...mapping.sourceOffsets);
|
|
168
178
|
lastValidMapping.generatedOffsets.push(...mapping.generatedOffsets);
|
|
169
179
|
lastValidMapping.lengths.push(...mapping.lengths);
|
|
@@ -172,12 +182,12 @@ function computedPluginFiles(plugins, plugin, fileName, sfc, nameToBlock, codege
|
|
|
172
182
|
else {
|
|
173
183
|
lastValidMapping = mapping;
|
|
174
184
|
}
|
|
185
|
+
newMappings.push(mapping);
|
|
175
186
|
}
|
|
176
187
|
return {
|
|
177
188
|
file,
|
|
178
189
|
snapshot,
|
|
179
|
-
mappings:
|
|
180
|
-
codegenStacks: (0, language_core_1.buildStacks)(file.content, file.contentStacks),
|
|
190
|
+
mappings: newMappings,
|
|
181
191
|
};
|
|
182
192
|
});
|
|
183
193
|
});
|
|
@@ -205,4 +215,20 @@ function fullDiffTextChangeRange(oldText, newText) {
|
|
|
205
215
|
}
|
|
206
216
|
}
|
|
207
217
|
}
|
|
218
|
+
function resolveCommonLanguageId(lang) {
|
|
219
|
+
switch (lang) {
|
|
220
|
+
case 'js': return 'javascript';
|
|
221
|
+
case 'cjs': return 'javascript';
|
|
222
|
+
case 'mjs': return 'javascript';
|
|
223
|
+
case 'ts': return 'typescript';
|
|
224
|
+
case 'cts': return 'typescript';
|
|
225
|
+
case 'mts': return 'typescript';
|
|
226
|
+
case 'jsx': return 'javascriptreact';
|
|
227
|
+
case 'tsx': return 'typescriptreact';
|
|
228
|
+
case 'pug': return 'jade';
|
|
229
|
+
case 'md': return 'markdown';
|
|
230
|
+
}
|
|
231
|
+
return lang;
|
|
232
|
+
}
|
|
233
|
+
exports.resolveCommonLanguageId = resolveCommonLanguageId;
|
|
208
234
|
//# sourceMappingURL=computedFiles.js.map
|
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.computedMappings = void 0;
|
|
4
4
|
const language_core_1 = require("@volar/language-core");
|
|
5
5
|
const computeds_1 = require("computeds");
|
|
6
|
-
const
|
|
6
|
+
const shared_1 = require("../plugins/shared");
|
|
7
7
|
function computedMappings(snapshot, sfc) {
|
|
8
8
|
return (0, computeds_1.computed)(() => {
|
|
9
|
-
const str = [[snapshot().getText(0, snapshot().getLength()), undefined, 0,
|
|
9
|
+
const str = [[snapshot().getText(0, snapshot().getLength()), undefined, 0, shared_1.allCodeFeatures]];
|
|
10
10
|
for (const block of [
|
|
11
11
|
sfc.script,
|
|
12
12
|
sfc.scriptSetup,
|
|
@@ -55,7 +55,7 @@ function computedMappings(snapshot, sfc) {
|
|
|
55
55
|
sourceOffsets: offsets,
|
|
56
56
|
generatedOffsets: offsets,
|
|
57
57
|
lengths: offsets.map(() => 0),
|
|
58
|
-
data:
|
|
58
|
+
data: { structure: true },
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -32,7 +32,7 @@ function computedSfc(ts, plugins, fileName, snapshot, parsed) {
|
|
|
32
32
|
get ast() { return ast(); },
|
|
33
33
|
});
|
|
34
34
|
});
|
|
35
|
-
const
|
|
35
|
+
const scriptSetupOriginal = computedNullableSfcBlock('scriptSetup', 'js', (0, computeds_1.computed)(() => parsed()?.descriptor.scriptSetup ?? undefined), (block, base) => {
|
|
36
36
|
const generic = (0, computeds_1.computed)(() => {
|
|
37
37
|
const _block = block();
|
|
38
38
|
return typeof _block.attrs.generic === 'string' ? _block.attrs.generic : undefined;
|
|
@@ -48,6 +48,27 @@ function computedSfc(ts, plugins, fileName, snapshot, parsed) {
|
|
|
48
48
|
get ast() { return ast(); },
|
|
49
49
|
});
|
|
50
50
|
});
|
|
51
|
+
const hasScript = (0, computeds_1.computed)(() => !!parsed()?.descriptor.script);
|
|
52
|
+
const hasScriptSetup = (0, computeds_1.computed)(() => !!parsed()?.descriptor.scriptSetup);
|
|
53
|
+
const scriptSetup = (0, computeds_1.computed)(() => {
|
|
54
|
+
if (!hasScript() && !hasScriptSetup()) {
|
|
55
|
+
//#region monkey fix: https://github.com/vuejs/language-tools/pull/2113
|
|
56
|
+
return {
|
|
57
|
+
content: '',
|
|
58
|
+
lang: 'ts',
|
|
59
|
+
name: '',
|
|
60
|
+
start: 0,
|
|
61
|
+
end: 0,
|
|
62
|
+
startTagEnd: 0,
|
|
63
|
+
endTagStart: 0,
|
|
64
|
+
generic: undefined,
|
|
65
|
+
genericOffset: 0,
|
|
66
|
+
attrs: {},
|
|
67
|
+
ast: ts.createSourceFile('', '', 99, false, ts.ScriptKind.TS),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
return scriptSetupOriginal();
|
|
71
|
+
});
|
|
51
72
|
const styles = (0, computeds_1.computedArray)((0, computeds_1.computed)(() => parsed()?.descriptor.styles ?? []), (block, i) => {
|
|
52
73
|
const base = computedSfcBlock('style_' + i, 'css', block);
|
|
53
74
|
const module = (0, computeds_1.computed)(() => typeof block().module === 'string' ? block().module : block().module ? '$style' : undefined);
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import type { Mapping
|
|
1
|
+
import type { Mapping } from '@volar/language-core';
|
|
2
2
|
import type { Code } from '../types';
|
|
3
3
|
export declare class VueEmbeddedCode {
|
|
4
4
|
id: string;
|
|
5
5
|
lang: string;
|
|
6
6
|
content: Code[];
|
|
7
|
-
contentStacks: StackNode[];
|
|
8
7
|
parentCodeId?: string;
|
|
9
8
|
linkedCodeMappings: Mapping[];
|
|
10
9
|
embeddedCodes: VueEmbeddedCode[];
|
|
11
|
-
constructor(id: string, lang: string, content: Code[]
|
|
10
|
+
constructor(id: string, lang: string, content: Code[]);
|
|
12
11
|
}
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VueEmbeddedCode = void 0;
|
|
4
4
|
class VueEmbeddedCode {
|
|
5
|
-
constructor(id, lang, content
|
|
5
|
+
constructor(id, lang, content) {
|
|
6
6
|
this.id = id;
|
|
7
7
|
this.lang = lang;
|
|
8
8
|
this.content = content;
|
|
9
|
-
this.contentStacks = contentStacks;
|
|
10
9
|
this.linkedCodeMappings = [];
|
|
11
10
|
this.embeddedCodes = [];
|
|
12
11
|
}
|
|
@@ -1,25 +1,23 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { VirtualCode } from '@volar/language-core';
|
|
2
2
|
import { Signal } from 'computeds';
|
|
3
3
|
import type * as ts from 'typescript';
|
|
4
4
|
import type { VueCompilerOptions, VueLanguagePlugin } from '../types';
|
|
5
|
-
export declare class
|
|
5
|
+
export declare class VueVirtualCode implements VirtualCode {
|
|
6
6
|
fileName: string;
|
|
7
7
|
languageId: string;
|
|
8
8
|
initSnapshot: ts.IScriptSnapshot;
|
|
9
9
|
vueCompilerOptions: VueCompilerOptions;
|
|
10
10
|
plugins: ReturnType<VueLanguagePlugin>[];
|
|
11
11
|
ts: typeof import('typescript');
|
|
12
|
-
codegenStack: boolean;
|
|
13
12
|
id: string;
|
|
14
13
|
_snapshot: Signal<ts.IScriptSnapshot>;
|
|
15
14
|
getVueSfc: () => import("@vue/compiler-sfc").SFCParseResult | undefined;
|
|
16
15
|
sfc: import("../types").Sfc;
|
|
17
16
|
getMappings: () => import("@volar/language-core").CodeMapping[];
|
|
18
17
|
getEmbeddedCodes: () => VirtualCode[];
|
|
19
|
-
codegenStacks: Stack[];
|
|
20
18
|
get embeddedCodes(): VirtualCode[];
|
|
21
19
|
get snapshot(): ts.IScriptSnapshot;
|
|
22
20
|
get mappings(): import("@volar/language-core").CodeMapping[];
|
|
23
|
-
constructor(fileName: string, languageId: string, initSnapshot: ts.IScriptSnapshot, vueCompilerOptions: VueCompilerOptions, plugins: ReturnType<VueLanguagePlugin>[], ts: typeof import('typescript')
|
|
21
|
+
constructor(fileName: string, languageId: string, initSnapshot: ts.IScriptSnapshot, vueCompilerOptions: VueCompilerOptions, plugins: ReturnType<VueLanguagePlugin>[], ts: typeof import('typescript'));
|
|
24
22
|
update(newSnapshot: ts.IScriptSnapshot): void;
|
|
25
23
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.VueVirtualCode = void 0;
|
|
4
4
|
const computeds_1 = require("computeds");
|
|
5
5
|
const computedFiles_1 = require("./computedFiles");
|
|
6
6
|
const computedMappings_1 = require("./computedMappings");
|
|
7
7
|
const computedSfc_1 = require("./computedSfc");
|
|
8
8
|
const computedVueSfc_1 = require("./computedVueSfc");
|
|
9
|
-
class
|
|
9
|
+
class VueVirtualCode {
|
|
10
|
+
// others
|
|
10
11
|
get embeddedCodes() {
|
|
11
12
|
return this.getEmbeddedCodes();
|
|
12
13
|
}
|
|
@@ -16,28 +17,25 @@ class VueGeneratedCode {
|
|
|
16
17
|
get mappings() {
|
|
17
18
|
return this.getMappings();
|
|
18
19
|
}
|
|
19
|
-
constructor(fileName, languageId, initSnapshot, vueCompilerOptions, plugins, ts
|
|
20
|
+
constructor(fileName, languageId, initSnapshot, vueCompilerOptions, plugins, ts) {
|
|
20
21
|
this.fileName = fileName;
|
|
21
22
|
this.languageId = languageId;
|
|
22
23
|
this.initSnapshot = initSnapshot;
|
|
23
24
|
this.vueCompilerOptions = vueCompilerOptions;
|
|
24
25
|
this.plugins = plugins;
|
|
25
26
|
this.ts = ts;
|
|
26
|
-
this.codegenStack = codegenStack;
|
|
27
27
|
// sources
|
|
28
28
|
this.id = 'main';
|
|
29
29
|
// computeds
|
|
30
30
|
this.getVueSfc = (0, computedVueSfc_1.computedVueSfc)(this.plugins, this.fileName, () => this._snapshot());
|
|
31
31
|
this.sfc = (0, computedSfc_1.computedSfc)(this.ts, this.plugins, this.fileName, () => this._snapshot(), this.getVueSfc);
|
|
32
32
|
this.getMappings = (0, computedMappings_1.computedMappings)(() => this._snapshot(), this.sfc);
|
|
33
|
-
this.getEmbeddedCodes = (0, computedFiles_1.computedFiles)(this.plugins, this.fileName, this.sfc
|
|
34
|
-
// others
|
|
35
|
-
this.codegenStacks = [];
|
|
33
|
+
this.getEmbeddedCodes = (0, computedFiles_1.computedFiles)(this.plugins, this.fileName, this.sfc);
|
|
36
34
|
this._snapshot = (0, computeds_1.signal)(initSnapshot);
|
|
37
35
|
}
|
|
38
36
|
update(newSnapshot) {
|
|
39
37
|
this._snapshot.set(newSnapshot);
|
|
40
38
|
}
|
|
41
39
|
}
|
|
42
|
-
exports.
|
|
40
|
+
exports.VueVirtualCode = VueVirtualCode;
|
|
43
41
|
//# sourceMappingURL=vueFile.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/language-core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.15",
|
|
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.2.0-alpha.
|
|
15
|
+
"@volar/language-core": "2.2.0-alpha.12",
|
|
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": "095f44449d71cd5a4730306c9c8c40df4d44dce3"
|
|
38
38
|
}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateGlobalTypes = void 0;
|
|
4
|
-
const shared_1 = require("../utils/shared");
|
|
5
|
-
function generateGlobalTypes(vueCompilerOptions) {
|
|
6
|
-
const fnPropsType = `(K extends { $props: infer Props } ? Props : any)${vueCompilerOptions.strictTemplates ? '' : ' & Record<string, unknown>'}`;
|
|
7
|
-
return `
|
|
8
|
-
; export const __VLS_globalTypesStart = {};
|
|
9
|
-
declare global {
|
|
10
|
-
// @ts-ignore
|
|
11
|
-
type __VLS_IntrinsicElements = __VLS_PickNotAny<import('vue/jsx-runtime').JSX.IntrinsicElements, __VLS_PickNotAny<globalThis.JSX.IntrinsicElements, Record<string, any>>>;
|
|
12
|
-
// @ts-ignore
|
|
13
|
-
type __VLS_Element = __VLS_PickNotAny<import('vue/jsx-runtime').JSX.Element, globalThis.JSX.Element>;
|
|
14
|
-
// @ts-ignore
|
|
15
|
-
type __VLS_GlobalComponents = ${[
|
|
16
|
-
`__VLS_PickNotAny<import('vue').GlobalComponents, {}>`,
|
|
17
|
-
`__VLS_PickNotAny<import('@vue/runtime-core').GlobalComponents, {}>`,
|
|
18
|
-
`__VLS_PickNotAny<import('@vue/runtime-dom').GlobalComponents, {}>`,
|
|
19
|
-
`Pick<typeof import('${vueCompilerOptions.lib}'), 'Transition' | 'TransitionGroup' | 'KeepAlive' | 'Suspense' | 'Teleport'>`
|
|
20
|
-
].join(' & ')};
|
|
21
|
-
type __VLS_IsAny<T> = 0 extends 1 & T ? true : false;
|
|
22
|
-
type __VLS_PickNotAny<A, B> = __VLS_IsAny<A> extends true ? B : A;
|
|
23
|
-
|
|
24
|
-
const __VLS_intrinsicElements: __VLS_IntrinsicElements;
|
|
25
|
-
|
|
26
|
-
// v-for
|
|
27
|
-
function __VLS_getVForSourceType(source: number): [number, number, number][];
|
|
28
|
-
function __VLS_getVForSourceType(source: string): [string, number, number][];
|
|
29
|
-
function __VLS_getVForSourceType<T extends any[]>(source: T): [
|
|
30
|
-
item: T[number],
|
|
31
|
-
key: number,
|
|
32
|
-
index: number,
|
|
33
|
-
][];
|
|
34
|
-
function __VLS_getVForSourceType<T extends { [Symbol.iterator](): Iterator<any> }>(source: T): [
|
|
35
|
-
item: T extends { [Symbol.iterator](): Iterator<infer T1> } ? T1 : never,
|
|
36
|
-
key: number,
|
|
37
|
-
index: undefined,
|
|
38
|
-
][];
|
|
39
|
-
// #3845
|
|
40
|
-
function __VLS_getVForSourceType<T extends number | { [Symbol.iterator](): Iterator<any> }>(source: T): [
|
|
41
|
-
item: number | (Exclude<T, number> extends { [Symbol.iterator](): Iterator<infer T1> } ? T1 : never),
|
|
42
|
-
key: number,
|
|
43
|
-
index: undefined,
|
|
44
|
-
][];
|
|
45
|
-
function __VLS_getVForSourceType<T>(source: T): [
|
|
46
|
-
item: T[keyof T],
|
|
47
|
-
key: keyof T,
|
|
48
|
-
index: number,
|
|
49
|
-
][];
|
|
50
|
-
|
|
51
|
-
// @ts-ignore
|
|
52
|
-
function __VLS_getSlotParams<T>(slot: T): Parameters<__VLS_PickNotAny<NonNullable<T>, (...args: any[]) => any>>;
|
|
53
|
-
// @ts-ignore
|
|
54
|
-
function __VLS_getSlotParam<T>(slot: T): Parameters<__VLS_PickNotAny<NonNullable<T>, (...args: any[]) => any>>[0];
|
|
55
|
-
function __VLS_directiveFunction<T>(dir: T):
|
|
56
|
-
T extends import('${vueCompilerOptions.lib}').ObjectDirective<infer E, infer V> | import('${vueCompilerOptions.lib}').FunctionDirective<infer E, infer V> ? (value: V) => void
|
|
57
|
-
: T;
|
|
58
|
-
function __VLS_withScope<T, K>(ctx: T, scope: K): ctx is T & K;
|
|
59
|
-
function __VLS_makeOptional<T>(t: T): { [K in keyof T]?: T[K] };
|
|
60
|
-
|
|
61
|
-
type __VLS_SelfComponent<N, C> = string extends N ? {} : N extends string ? { [P in N]: C } : {};
|
|
62
|
-
type __VLS_WithComponent<N0 extends string, LocalComponents, N1 extends string, N2 extends string, N3 extends string> =
|
|
63
|
-
N1 extends keyof LocalComponents ? N1 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : { [K in N0]: LocalComponents[N1] } :
|
|
64
|
-
N2 extends keyof LocalComponents ? N2 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : { [K in N0]: LocalComponents[N2] } :
|
|
65
|
-
N3 extends keyof LocalComponents ? N3 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : { [K in N0]: LocalComponents[N3] } :
|
|
66
|
-
N1 extends keyof __VLS_GlobalComponents ? N1 extends N0 ? Pick<__VLS_GlobalComponents, N0 extends keyof __VLS_GlobalComponents ? N0 : never> : { [K in N0]: __VLS_GlobalComponents[N1] } :
|
|
67
|
-
N2 extends keyof __VLS_GlobalComponents ? N2 extends N0 ? Pick<__VLS_GlobalComponents, N0 extends keyof __VLS_GlobalComponents ? N0 : never> : { [K in N0]: __VLS_GlobalComponents[N2] } :
|
|
68
|
-
N3 extends keyof __VLS_GlobalComponents ? N3 extends N0 ? Pick<__VLS_GlobalComponents, N0 extends keyof __VLS_GlobalComponents ? N0 : never> : { [K in N0]: __VLS_GlobalComponents[N3] } :
|
|
69
|
-
${vueCompilerOptions.strictTemplates ? '{}' : '{ [K in N0]: unknown }'}
|
|
70
|
-
|
|
71
|
-
type __VLS_FillingEventArg_ParametersLength<E extends (...args: any) => any> = __VLS_IsAny<Parameters<E>> extends true ? -1 : Parameters<E>['length'];
|
|
72
|
-
type __VLS_FillingEventArg<E> = E extends (...args: any) => any ? __VLS_FillingEventArg_ParametersLength<E> extends 0 ? ($event?: undefined) => ReturnType<E> : E : E;
|
|
73
|
-
function __VLS_asFunctionalComponent<T, K = T extends new (...args: any) => any ? InstanceType<T> : unknown>(t: T, instance?: K):
|
|
74
|
-
T extends new (...args: any) => any
|
|
75
|
-
? (props: ${fnPropsType}, ctx?: any) => __VLS_Element & { __ctx?: {
|
|
76
|
-
attrs?: any,
|
|
77
|
-
slots?: K extends { ${(0, shared_1.getSlotsPropertyName)(vueCompilerOptions.target)}: infer Slots } ? Slots : any,
|
|
78
|
-
emit?: K extends { $emit: infer Emit } ? Emit : any
|
|
79
|
-
} & { props?: ${fnPropsType}; expose?(exposed: K): void; } }
|
|
80
|
-
: T extends () => any ? (props: {}, ctx?: any) => ReturnType<T>
|
|
81
|
-
: T extends (...args: any) => any ? T
|
|
82
|
-
: (_: {}${vueCompilerOptions.strictTemplates ? '' : ' & Record<string, unknown>'}, ctx?: any) => { __ctx?: { attrs?: any, expose?: any, slots?: any, emit?: any, props?: {}${vueCompilerOptions.strictTemplates ? '' : ' & Record<string, unknown>'} } };
|
|
83
|
-
function __VLS_elementAsFunctionalComponent<T>(t: T): (_: T${vueCompilerOptions.strictTemplates ? '' : ' & Record<string, unknown>'}, ctx?: any) => { __ctx?: { attrs?: any, expose?: any, slots?: any, emit?: any, props?: T${vueCompilerOptions.strictTemplates ? '' : ' & Record<string, unknown>'} } };
|
|
84
|
-
function __VLS_functionalComponentArgsRest<T extends (...args: any) => any>(t: T): Parameters<T>['length'] extends 2 ? [any] : [];
|
|
85
|
-
function __VLS_pickEvent<E1, E2>(emitEvent: E1, propEvent: E2): __VLS_FillingEventArg<
|
|
86
|
-
__VLS_PickNotAny<
|
|
87
|
-
__VLS_AsFunctionOrAny<E2>,
|
|
88
|
-
__VLS_AsFunctionOrAny<E1>
|
|
89
|
-
>
|
|
90
|
-
> | undefined;
|
|
91
|
-
function __VLS_pickFunctionalComponentCtx<T, K>(comp: T, compInstance: K): __VLS_PickNotAny<
|
|
92
|
-
'__ctx' extends keyof __VLS_PickNotAny<K, {}> ? K extends { __ctx?: infer Ctx } ? Ctx : never : any
|
|
93
|
-
, T extends (props: any, ctx: infer Ctx) => any ? Ctx : any
|
|
94
|
-
>;
|
|
95
|
-
type __VLS_FunctionalComponentProps<T, K> =
|
|
96
|
-
'__ctx' extends keyof __VLS_PickNotAny<K, {}> ? K extends { __ctx?: { props?: infer P } } ? NonNullable<P> : never
|
|
97
|
-
: T extends (props: infer P, ...args: any) => any ? P :
|
|
98
|
-
{};
|
|
99
|
-
type __VLS_AsFunctionOrAny<F> = unknown extends F ? any : ((...args: any) => any) extends F ? F : any;
|
|
100
|
-
|
|
101
|
-
function __VLS_normalizeSlot<S>(s: S): S extends () => infer R ? (props: {}) => R : S;
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* emit
|
|
105
|
-
*/
|
|
106
|
-
// fix https://github.com/vuejs/language-tools/issues/926
|
|
107
|
-
type __VLS_UnionToIntersection<U> = (U extends unknown ? (arg: U) => unknown : never) extends ((arg: infer P) => unknown) ? P : never;
|
|
108
|
-
type __VLS_OverloadUnionInner<T, U = unknown> = U & T extends (...args: infer A) => infer R
|
|
109
|
-
? U extends T
|
|
110
|
-
? never
|
|
111
|
-
: __VLS_OverloadUnionInner<T, Pick<T, keyof T> & U & ((...args: A) => R)> | ((...args: A) => R)
|
|
112
|
-
: never;
|
|
113
|
-
type __VLS_OverloadUnion<T> = Exclude<
|
|
114
|
-
__VLS_OverloadUnionInner<(() => never) & T>,
|
|
115
|
-
T extends () => never ? never : () => never
|
|
116
|
-
>;
|
|
117
|
-
type __VLS_ConstructorOverloads<T> = __VLS_OverloadUnion<T> extends infer F
|
|
118
|
-
? F extends (event: infer E, ...args: infer A) => any
|
|
119
|
-
? { [K in E & string]: (...args: A) => void; }
|
|
120
|
-
: never
|
|
121
|
-
: never;
|
|
122
|
-
type __VLS_NormalizeEmits<T> = __VLS_PrettifyGlobal<
|
|
123
|
-
__VLS_UnionToIntersection<
|
|
124
|
-
__VLS_ConstructorOverloads<T> & {
|
|
125
|
-
[K in keyof T]: T[K] extends any[] ? { (...args: T[K]): void } : never
|
|
126
|
-
}
|
|
127
|
-
>
|
|
128
|
-
>;
|
|
129
|
-
type __VLS_PrettifyGlobal<T> = { [K in keyof T]: T[K]; } & {};
|
|
130
|
-
}
|
|
131
|
-
export const __VLS_globalTypesEnd = {};`;
|
|
132
|
-
}
|
|
133
|
-
exports.generateGlobalTypes = generateGlobalTypes;
|
|
134
|
-
;
|
|
135
|
-
//# sourceMappingURL=globalTypes.js.map
|