gitea push
This commit is contained in:
+73
-26
@@ -1,26 +1,73 @@
|
||||
export declare const ctx = "__VLS_ctx";
|
||||
export declare const dollars = "__VLS_dollars";
|
||||
export declare const slots = "__VLS_slots";
|
||||
export declare const props = "__VLS_props";
|
||||
export declare const defaults = "__VLS_defaults";
|
||||
export declare const defaultModels = "__VLS_defaultModels";
|
||||
export declare const modelEmit = "__VLS_modelEmit";
|
||||
export declare const emit = "__VLS_emit";
|
||||
export declare const exposed = "__VLS_exposed";
|
||||
export declare const setup = "__VLS_setup";
|
||||
export declare const components = "__VLS_components";
|
||||
export declare const directives = "__VLS_directives";
|
||||
export declare const intrinsics = "__VLS_intrinsics";
|
||||
export declare const _export = "__VLS_export";
|
||||
export declare const ModelProps = "__VLS_ModelProps";
|
||||
export declare const Props = "__VLS_Props";
|
||||
export declare const Slots = "__VLS_Slots";
|
||||
export declare const InheritedAttrs = "__VLS_InheritedAttrs";
|
||||
export declare const TemplateRefs = "__VLS_TemplateRefs";
|
||||
export declare const RootEl = "__VLS_RootEl";
|
||||
export declare const ModelEmit = "__VLS_ModelEmit";
|
||||
export declare const EmitProps = "__VLS_EmitProps";
|
||||
export declare const Emit = "__VLS_Emit";
|
||||
export declare const SetupExposed = "__VLS_SetupExposed";
|
||||
export declare const PublicProps = "__VLS_PublicProps";
|
||||
export declare const StyleModules = "__VLS_StyleModules";
|
||||
declare const raw: {
|
||||
base: string;
|
||||
export: string;
|
||||
components: string;
|
||||
componentsOption: string;
|
||||
ctx: string;
|
||||
defaultModels: string;
|
||||
defaults: string;
|
||||
directives: string;
|
||||
directivesOption: string;
|
||||
dollars: string;
|
||||
emit: string;
|
||||
exposed: string;
|
||||
intrinsics: string;
|
||||
modelEmit: string;
|
||||
props: string;
|
||||
propsOption: string;
|
||||
self: string;
|
||||
setup: string;
|
||||
slots: string;
|
||||
src: string;
|
||||
Emit: string;
|
||||
EmitProps: string;
|
||||
GlobalComponents: string;
|
||||
InheritedAttrs: string;
|
||||
LocalComponents: string;
|
||||
LocalDirectives: string;
|
||||
ModelEmit: string;
|
||||
ModelProps: string;
|
||||
Props: string;
|
||||
PublicProps: string;
|
||||
RootEl: string;
|
||||
SetupExposed: string;
|
||||
Slots: string;
|
||||
StyleModules: string;
|
||||
StyleScopedClasses: string;
|
||||
TemplateRefs: string;
|
||||
asFunctionalComponent0: string;
|
||||
asFunctionalComponent1: string;
|
||||
asFunctionalDirective: string;
|
||||
asFunctionalElement0: string;
|
||||
asFunctionalElement1: string;
|
||||
asFunctionalSlot: string;
|
||||
directiveBindingRestFields: string;
|
||||
functionalComponentArgsRest: string;
|
||||
tryAsConstant: string;
|
||||
vFor: string;
|
||||
vSlot: string;
|
||||
ConstructorOverloads: string;
|
||||
Elements: string;
|
||||
EmitsToProps: string;
|
||||
FunctionalComponent0: string;
|
||||
FunctionalComponent1: string;
|
||||
FunctionalComponentCtx: string;
|
||||
FunctionalComponentProps: string;
|
||||
IsAny: string;
|
||||
IsFunction: string;
|
||||
NormalizeComponentEvent: string;
|
||||
NormalizeEmits: string;
|
||||
OverloadUnion: string;
|
||||
OverloadUnionInner: string;
|
||||
PickNotAny: string;
|
||||
PrettifyGlobal: string;
|
||||
ResolveDirectives: string;
|
||||
ResolveEmits: string;
|
||||
ShortEmits: string;
|
||||
ShortEmitsToObject: string;
|
||||
SpreadMerge: string;
|
||||
UnionToIntersection: string;
|
||||
WithComponent: string;
|
||||
};
|
||||
export declare const names: typeof raw;
|
||||
export {};
|
||||
|
||||
+75
-27
@@ -1,30 +1,78 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.StyleModules = exports.PublicProps = exports.SetupExposed = exports.Emit = exports.EmitProps = exports.ModelEmit = exports.RootEl = exports.TemplateRefs = exports.InheritedAttrs = exports.Slots = exports.Props = exports.ModelProps = exports._export = exports.intrinsics = exports.directives = exports.components = exports.setup = exports.exposed = exports.emit = exports.modelEmit = exports.defaultModels = exports.defaults = exports.props = exports.slots = exports.dollars = exports.ctx = void 0;
|
||||
exports.ctx = '__VLS_ctx';
|
||||
exports.dollars = '__VLS_dollars';
|
||||
exports.slots = '__VLS_slots';
|
||||
exports.props = '__VLS_props';
|
||||
exports.defaults = '__VLS_defaults';
|
||||
exports.defaultModels = '__VLS_defaultModels';
|
||||
exports.modelEmit = '__VLS_modelEmit';
|
||||
exports.emit = '__VLS_emit';
|
||||
exports.exposed = '__VLS_exposed';
|
||||
exports.setup = '__VLS_setup';
|
||||
exports.components = '__VLS_components';
|
||||
exports.directives = '__VLS_directives';
|
||||
exports.intrinsics = '__VLS_intrinsics';
|
||||
exports._export = '__VLS_export';
|
||||
exports.ModelProps = '__VLS_ModelProps';
|
||||
exports.Props = '__VLS_Props';
|
||||
exports.Slots = '__VLS_Slots';
|
||||
exports.InheritedAttrs = '__VLS_InheritedAttrs';
|
||||
exports.TemplateRefs = '__VLS_TemplateRefs';
|
||||
exports.RootEl = '__VLS_RootEl';
|
||||
exports.ModelEmit = '__VLS_ModelEmit';
|
||||
exports.EmitProps = '__VLS_EmitProps';
|
||||
exports.Emit = '__VLS_Emit';
|
||||
exports.SetupExposed = '__VLS_SetupExposed';
|
||||
exports.PublicProps = '__VLS_PublicProps';
|
||||
exports.StyleModules = '__VLS_StyleModules';
|
||||
exports.names = void 0;
|
||||
const raw = {
|
||||
base: '',
|
||||
export: '',
|
||||
components: '',
|
||||
componentsOption: '',
|
||||
ctx: '',
|
||||
defaultModels: '',
|
||||
defaults: '',
|
||||
directives: '',
|
||||
directivesOption: '',
|
||||
dollars: '',
|
||||
emit: '',
|
||||
exposed: '',
|
||||
intrinsics: '',
|
||||
modelEmit: '',
|
||||
props: '',
|
||||
propsOption: '',
|
||||
self: '',
|
||||
setup: '',
|
||||
slots: '',
|
||||
src: '',
|
||||
Emit: '',
|
||||
EmitProps: '',
|
||||
GlobalComponents: '',
|
||||
InheritedAttrs: '',
|
||||
LocalComponents: '',
|
||||
LocalDirectives: '',
|
||||
ModelEmit: '',
|
||||
ModelProps: '',
|
||||
Props: '',
|
||||
PublicProps: '',
|
||||
RootEl: '',
|
||||
SetupExposed: '',
|
||||
Slots: '',
|
||||
StyleModules: '',
|
||||
StyleScopedClasses: '',
|
||||
TemplateRefs: '',
|
||||
// #region template helpers
|
||||
asFunctionalComponent0: '',
|
||||
asFunctionalComponent1: '',
|
||||
asFunctionalDirective: '',
|
||||
asFunctionalElement0: '',
|
||||
asFunctionalElement1: '',
|
||||
asFunctionalSlot: '',
|
||||
directiveBindingRestFields: '',
|
||||
functionalComponentArgsRest: '',
|
||||
tryAsConstant: '',
|
||||
vFor: '',
|
||||
vSlot: '',
|
||||
ConstructorOverloads: '',
|
||||
Elements: '',
|
||||
EmitsToProps: '',
|
||||
FunctionalComponent0: '',
|
||||
FunctionalComponent1: '',
|
||||
FunctionalComponentCtx: '',
|
||||
FunctionalComponentProps: '',
|
||||
IsAny: '',
|
||||
IsFunction: '',
|
||||
NormalizeComponentEvent: '',
|
||||
NormalizeEmits: '',
|
||||
OverloadUnion: '',
|
||||
OverloadUnionInner: '',
|
||||
PickNotAny: '',
|
||||
PrettifyGlobal: '',
|
||||
ResolveDirectives: '',
|
||||
ResolveEmits: '',
|
||||
ShortEmits: '',
|
||||
ShortEmitsToObject: '',
|
||||
SpreadMerge: '',
|
||||
UnionToIntersection: '',
|
||||
WithComponent: '',
|
||||
// #endregion
|
||||
};
|
||||
exports.names = Object.fromEntries(Object.keys(raw).map(key => [key, `__VLS_${key}`]));
|
||||
//# sourceMappingURL=names.js.map
|
||||
+19
-58
@@ -1,66 +1,27 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.generateComponent = generateComponent;
|
||||
const codeFeatures_1 = require("../codeFeatures");
|
||||
const names = __importStar(require("../names"));
|
||||
const names_1 = require("../names");
|
||||
const utils_1 = require("../utils");
|
||||
const merge_1 = require("../utils/merge");
|
||||
function* generateComponent(options, ctx, scriptSetup, scriptSetupRanges) {
|
||||
yield `(await import('${options.vueCompilerOptions.lib}')).defineComponent({${utils_1.newLine}`;
|
||||
const returns = [];
|
||||
if (scriptSetupRanges.defineExpose) {
|
||||
returns.push([names.exposed]);
|
||||
}
|
||||
if (returns.length) {
|
||||
yield `setup: () => (`;
|
||||
yield* (0, merge_1.generateSpreadMerge)(returns);
|
||||
yield `),${utils_1.newLine}`;
|
||||
yield `setup: () => ${names_1.names.exposed},${utils_1.newLine}`;
|
||||
}
|
||||
const emitOptionCodes = [...generateEmitsOption(options, scriptSetupRanges)];
|
||||
yield* emitOptionCodes;
|
||||
yield* generatePropsOption(options, ctx, scriptSetup, scriptSetupRanges, !!emitOptionCodes.length);
|
||||
if (options.vueCompilerOptions.target >= 3.5
|
||||
&& options.vueCompilerOptions.inferComponentDollarRefs
|
||||
&& options.templateAndStyleTypes.has(names.TemplateRefs)) {
|
||||
yield `__typeRefs: {} as ${names.TemplateRefs},${utils_1.newLine}`;
|
||||
&& options.templateAndStyleTypes.has(names_1.names.TemplateRefs)) {
|
||||
yield `__typeRefs: {} as ${names_1.names.TemplateRefs},${utils_1.newLine}`;
|
||||
}
|
||||
if (options.vueCompilerOptions.target >= 3.5
|
||||
&& options.vueCompilerOptions.inferComponentDollarEl
|
||||
&& options.templateAndStyleTypes.has(names.RootEl)) {
|
||||
yield `__typeEl: {} as ${names.RootEl},${utils_1.newLine}`;
|
||||
&& options.templateAndStyleTypes.has(names_1.names.RootEl)) {
|
||||
yield `__typeEl: {} as ${names_1.names.RootEl},${utils_1.newLine}`;
|
||||
}
|
||||
yield `})`;
|
||||
}
|
||||
@@ -68,14 +29,14 @@ function* generateEmitsOption(options, scriptSetupRanges) {
|
||||
const optionCodes = [];
|
||||
const typeOptionCodes = [];
|
||||
if (scriptSetupRanges.defineModel.length) {
|
||||
optionCodes.push([`{} as __VLS_NormalizeEmits<typeof ${names.modelEmit}>`]);
|
||||
typeOptionCodes.push([names.ModelEmit]);
|
||||
optionCodes.push([`{} as ${names_1.names.NormalizeEmits}<typeof ${names_1.names.modelEmit}>`]);
|
||||
typeOptionCodes.push([names_1.names.ModelEmit]);
|
||||
}
|
||||
if (scriptSetupRanges.defineEmits) {
|
||||
const { name, typeArg, hasUnionTypeArg } = scriptSetupRanges.defineEmits;
|
||||
optionCodes.push([`{} as __VLS_NormalizeEmits<typeof ${name ?? names.emit}>`]);
|
||||
optionCodes.push([`{} as ${names_1.names.NormalizeEmits}<typeof ${name ?? names_1.names.emit}>`]);
|
||||
if (typeArg && !hasUnionTypeArg) {
|
||||
typeOptionCodes.push([names.Emit]);
|
||||
typeOptionCodes.push([names_1.names.Emit]);
|
||||
}
|
||||
else {
|
||||
typeOptionCodes.length = 0;
|
||||
@@ -95,12 +56,12 @@ function* generateEmitsOption(options, scriptSetupRanges) {
|
||||
function* generatePropsOption(options, ctx, scriptSetup, scriptSetupRanges, hasEmitsOption) {
|
||||
const optionGenerates = [];
|
||||
const typeOptionGenerates = [];
|
||||
if (options.templateAndStyleTypes.has(names.InheritedAttrs)) {
|
||||
if (options.templateAndStyleTypes.has(names_1.names.InheritedAttrs)) {
|
||||
const attrsType = hasEmitsOption
|
||||
? `Omit<${names.InheritedAttrs}, keyof ${names.EmitProps}>`
|
||||
: names.InheritedAttrs;
|
||||
? `Omit<${names_1.names.InheritedAttrs}, keyof ${names_1.names.EmitProps}>`
|
||||
: names_1.names.InheritedAttrs;
|
||||
optionGenerates.push(function* () {
|
||||
const propsType = `__VLS_PickNotAny<${ctx.localTypes.OmitIndexSignature}<${attrsType}>, {}>`;
|
||||
const propsType = `${names_1.names.PickNotAny}<${ctx.localTypes.OmitIndexSignature}<${attrsType}>, {}>`;
|
||||
const optionType = `${ctx.localTypes.TypePropsToOption}<${propsType}>`;
|
||||
yield `{} as ${optionType}`;
|
||||
});
|
||||
@@ -108,18 +69,18 @@ function* generatePropsOption(options, ctx, scriptSetup, scriptSetupRanges, hasE
|
||||
yield `{} as ${attrsType}`;
|
||||
});
|
||||
}
|
||||
if (ctx.generatedTypes.has(names.PublicProps)) {
|
||||
if (ctx.generatedTypes.has(names_1.names.PublicProps)) {
|
||||
if (options.vueCompilerOptions.target < 3.6) {
|
||||
optionGenerates.push(function* () {
|
||||
let propsType = `${ctx.localTypes.TypePropsToOption}<${names.PublicProps}>`;
|
||||
let propsType = `${ctx.localTypes.TypePropsToOption}<${names_1.names.PublicProps}>`;
|
||||
if (scriptSetupRanges.withDefaults?.arg) {
|
||||
propsType = `${ctx.localTypes.WithDefaults}<${propsType}, typeof ${names.defaults}>`;
|
||||
propsType = `${ctx.localTypes.WithDefaults}<${propsType}, typeof ${names_1.names.defaults}>`;
|
||||
}
|
||||
yield `{} as ${propsType}`;
|
||||
});
|
||||
}
|
||||
typeOptionGenerates.push(function* () {
|
||||
yield `{} as ${names.PublicProps}`;
|
||||
yield `{} as ${names_1.names.PublicProps}`;
|
||||
});
|
||||
}
|
||||
if (scriptSetupRanges.defineProps?.arg) {
|
||||
@@ -132,7 +93,7 @@ function* generatePropsOption(options, ctx, scriptSetup, scriptSetupRanges, hasE
|
||||
if (useTypeOption) {
|
||||
if (options.vueCompilerOptions.target >= 3.6
|
||||
&& scriptSetupRanges.withDefaults?.arg) {
|
||||
yield `__defaults: ${names.defaults},${utils_1.newLine}`;
|
||||
yield `__defaults: ${names_1.names.defaults},${utils_1.newLine}`;
|
||||
}
|
||||
yield `__typeProps: `;
|
||||
yield* (0, merge_1.generateSpreadMerge)(typeOptionGenerates.map(g => g()));
|
||||
|
||||
+12
-12
@@ -36,13 +36,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.generateScript = generate;
|
||||
const path = __importStar(require("path-browserify"));
|
||||
const codeFeatures_1 = require("../codeFeatures");
|
||||
const names = __importStar(require("../names"));
|
||||
const names_1 = require("../names");
|
||||
const utils_1 = require("../utils");
|
||||
const boundary_1 = require("../utils/boundary");
|
||||
const context_1 = require("./context");
|
||||
const scriptSetup_1 = require("./scriptSetup");
|
||||
const template_1 = require("./template");
|
||||
const exportExpression = `{} as typeof ${names._export}`;
|
||||
const exportExpression = `{} as typeof ${names_1.names.export}`;
|
||||
function generate(options) {
|
||||
const ctx = (0, context_1.createScriptCodegenContext)(options);
|
||||
const codeGenerator = generateWorker(options, ctx);
|
||||
@@ -60,7 +60,7 @@ function* generateWorker(options, ctx) {
|
||||
else if (src.endsWith('.tsx')) {
|
||||
src = src.slice(0, -'.tsx'.length) + '.jsx';
|
||||
}
|
||||
yield `import __VLS_default from `;
|
||||
yield `import ${names_1.names.src} from `;
|
||||
const token = yield* (0, boundary_1.startBoundary)('main', script.src.offset, {
|
||||
...codeFeatures_1.codeFeatures.all,
|
||||
...src !== script.src.text ? codeFeatures_1.codeFeatures.navigationWithoutRename : {},
|
||||
@@ -71,8 +71,8 @@ function* generateWorker(options, ctx) {
|
||||
yield `'`;
|
||||
yield (0, boundary_1.endBoundary)(token, script.src.offset + script.src.text.length);
|
||||
yield utils_1.endOfLine;
|
||||
yield `export default __VLS_default;${utils_1.endOfLine}`;
|
||||
yield* (0, template_1.generateTemplate)(options, ctx, '__VLS_default');
|
||||
yield `export default ${names_1.names.src}${utils_1.endOfLine}`;
|
||||
yield* (0, template_1.generateTemplate)(options, ctx, names_1.names.src);
|
||||
}
|
||||
// <script> + <script setup>
|
||||
else if (script && scriptRanges && scriptSetup && scriptSetupRanges) {
|
||||
@@ -81,14 +81,14 @@ function* generateWorker(options, ctx) {
|
||||
let selfType;
|
||||
const { exportDefault } = scriptRanges;
|
||||
if (exportDefault) {
|
||||
yield* generateScriptWithExportDefault(ctx, script, scriptRanges, exportDefault, vueCompilerOptions, selfType = '__VLS_self');
|
||||
yield* generateScriptWithExportDefault(ctx, script, scriptRanges, exportDefault, vueCompilerOptions, selfType = names_1.names.self);
|
||||
}
|
||||
else {
|
||||
yield* (0, utils_1.generateSfcBlockSection)(script, 0, script.content.length, codeFeatures_1.codeFeatures.all);
|
||||
yield `export default ${exportExpression}${utils_1.endOfLine}`;
|
||||
}
|
||||
// <script setup>
|
||||
yield* generateExportDeclareEqual(scriptSetup, names._export);
|
||||
yield* generateExportDeclareEqual(scriptSetup, names_1.names.export);
|
||||
if (scriptSetup.generic) {
|
||||
yield* (0, scriptSetup_1.generateGeneric)(options, ctx, scriptSetup, scriptSetupRanges, scriptSetup.generic, (0, scriptSetup_1.generateSetupFunction)(options, ctx, scriptSetup, scriptSetupRanges, (0, template_1.generateTemplate)(options, ctx, selfType)));
|
||||
}
|
||||
@@ -102,12 +102,12 @@ function* generateWorker(options, ctx) {
|
||||
else if (scriptSetup && scriptSetupRanges) {
|
||||
yield* (0, scriptSetup_1.generateScriptSetupImports)(scriptSetup, scriptSetupRanges);
|
||||
if (scriptSetup.generic) {
|
||||
yield* generateExportDeclareEqual(scriptSetup, names._export);
|
||||
yield* generateExportDeclareEqual(scriptSetup, names_1.names.export);
|
||||
yield* (0, scriptSetup_1.generateGeneric)(options, ctx, scriptSetup, scriptSetupRanges, scriptSetup.generic, (0, scriptSetup_1.generateSetupFunction)(options, ctx, scriptSetup, scriptSetupRanges, (0, template_1.generateTemplate)(options, ctx)));
|
||||
}
|
||||
else {
|
||||
// no script block, generate script setup code at root
|
||||
yield* (0, scriptSetup_1.generateSetupFunction)(options, ctx, scriptSetup, scriptSetupRanges, (0, template_1.generateTemplate)(options, ctx), generateExportDeclareEqual(scriptSetup, names._export));
|
||||
yield* (0, scriptSetup_1.generateSetupFunction)(options, ctx, scriptSetup, scriptSetupRanges, (0, template_1.generateTemplate)(options, ctx), generateExportDeclareEqual(scriptSetup, names_1.names.export));
|
||||
}
|
||||
yield `export default ${exportExpression}${utils_1.endOfLine}`;
|
||||
}
|
||||
@@ -115,13 +115,13 @@ function* generateWorker(options, ctx) {
|
||||
else if (script && scriptRanges) {
|
||||
const { exportDefault } = scriptRanges;
|
||||
if (exportDefault) {
|
||||
yield* generateScriptWithExportDefault(ctx, script, scriptRanges, exportDefault, vueCompilerOptions, names._export, (0, template_1.generateTemplate)(options, ctx, names._export));
|
||||
yield* generateScriptWithExportDefault(ctx, script, scriptRanges, exportDefault, vueCompilerOptions, names_1.names.export, (0, template_1.generateTemplate)(options, ctx, names_1.names.export));
|
||||
}
|
||||
else {
|
||||
yield* (0, utils_1.generateSfcBlockSection)(script, 0, script.content.length, codeFeatures_1.codeFeatures.all);
|
||||
yield* generateExportDeclareEqual(script, names._export);
|
||||
yield* generateExportDeclareEqual(script, names_1.names.export);
|
||||
yield `(await import('${vueCompilerOptions.lib}')).defineComponent({})${utils_1.endOfLine}`;
|
||||
yield* (0, template_1.generateTemplate)(options, ctx, names._export);
|
||||
yield* (0, template_1.generateTemplate)(options, ctx, names_1.names.export);
|
||||
yield `export default ${exportExpression}${utils_1.endOfLine}`;
|
||||
}
|
||||
}
|
||||
|
||||
+48
-81
@@ -1,44 +1,11 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.generateScriptSetupImports = generateScriptSetupImports;
|
||||
exports.generateGeneric = generateGeneric;
|
||||
exports.generateSetupFunction = generateSetupFunction;
|
||||
const shared_1 = require("@vue/shared");
|
||||
const codeFeatures_1 = require("../codeFeatures");
|
||||
const names = __importStar(require("../names"));
|
||||
const names_1 = require("../names");
|
||||
const utils_1 = require("../utils");
|
||||
const boundary_1 = require("../utils/boundary");
|
||||
const camelized_1 = require("../utils/camelized");
|
||||
@@ -63,34 +30,34 @@ function* generateGeneric(options, ctx, scriptSetup, scriptSetupRanges, generic,
|
||||
yield `>`;
|
||||
}
|
||||
yield `(${utils_1.newLine}`
|
||||
+ ` ${names.props}: NonNullable<Awaited<typeof ${names.setup}>>['props'],${utils_1.newLine}`
|
||||
+ ` ${names.ctx}?: ${ctx.localTypes.PrettifyLocal}<Pick<NonNullable<Awaited<typeof ${names.setup}>>, 'attrs' | 'emit' | 'slots'>>,${utils_1.newLine}` // use __VLS_Prettify for less dts code
|
||||
+ ` ${names.exposed}?: NonNullable<Awaited<typeof ${names.setup}>>['expose'],${utils_1.newLine}`
|
||||
+ ` ${names.setup} = (async () => {${utils_1.newLine}`;
|
||||
+ ` ${names_1.names.props}: NonNullable<Awaited<typeof ${names_1.names.setup}>>['props'],${utils_1.newLine}`
|
||||
+ ` ${names_1.names.ctx}?: ${ctx.localTypes.PrettifyLocal}<Pick<NonNullable<Awaited<typeof ${names_1.names.setup}>>, 'attrs' | 'emit' | 'slots'>>,${utils_1.newLine}`
|
||||
+ ` ${names_1.names.exposed}?: NonNullable<Awaited<typeof ${names_1.names.setup}>>['expose'],${utils_1.newLine}`
|
||||
+ ` ${names_1.names.setup} = (async () => {${utils_1.newLine}`;
|
||||
yield* body;
|
||||
const propTypes = [];
|
||||
const emitTypes = [];
|
||||
const { vueCompilerOptions } = options;
|
||||
if (ctx.generatedTypes.has(names.PublicProps)) {
|
||||
propTypes.push(names.PublicProps);
|
||||
if (ctx.generatedTypes.has(names_1.names.PublicProps)) {
|
||||
propTypes.push(names_1.names.PublicProps);
|
||||
}
|
||||
if (scriptSetupRanges.defineProps?.arg) {
|
||||
yield `const __VLS_propsOption = `;
|
||||
yield `const ${names_1.names.propsOption} = `;
|
||||
yield* (0, utils_1.generateSfcBlockSection)(scriptSetup, scriptSetupRanges.defineProps.arg.start, scriptSetupRanges.defineProps.arg.end, codeFeatures_1.codeFeatures.navigation);
|
||||
yield utils_1.endOfLine;
|
||||
propTypes.push(`import('${vueCompilerOptions.lib}').${vueCompilerOptions.target >= 3.3 ? `ExtractPublicPropTypes` : `ExtractPropTypes`}<typeof __VLS_propsOption>`);
|
||||
propTypes.push(`import('${vueCompilerOptions.lib}').${vueCompilerOptions.target >= 3.3 ? `ExtractPublicPropTypes` : `ExtractPropTypes`}<typeof ${names_1.names.propsOption}>`);
|
||||
}
|
||||
if (scriptSetupRanges.defineEmits || scriptSetupRanges.defineModel.length) {
|
||||
propTypes.push(names.EmitProps);
|
||||
propTypes.push(names_1.names.EmitProps);
|
||||
}
|
||||
if (options.templateAndStyleTypes.has(names.InheritedAttrs)) {
|
||||
propTypes.push(names.InheritedAttrs);
|
||||
if (options.templateAndStyleTypes.has(names_1.names.InheritedAttrs)) {
|
||||
propTypes.push(names_1.names.InheritedAttrs);
|
||||
}
|
||||
if (scriptSetupRanges.defineEmits) {
|
||||
emitTypes.push(`typeof ${scriptSetupRanges.defineEmits.name ?? names.emit}`);
|
||||
emitTypes.push(`typeof ${scriptSetupRanges.defineEmits.name ?? names_1.names.emit}`);
|
||||
}
|
||||
if (scriptSetupRanges.defineModel.length) {
|
||||
emitTypes.push(`typeof ${names.modelEmit}`);
|
||||
emitTypes.push(`typeof ${names_1.names.modelEmit}`);
|
||||
}
|
||||
yield `return {} as {${utils_1.newLine}`;
|
||||
yield ` props: `;
|
||||
@@ -107,62 +74,62 @@ function* generateGeneric(options, ctx, scriptSetup, scriptSetupRanges, generic,
|
||||
yield ` & (typeof globalThis extends { __VLS_PROPS_FALLBACK: infer P } ? P : {})${utils_1.endOfLine}`;
|
||||
yield ` expose: (exposed: `;
|
||||
yield scriptSetupRanges.defineExpose
|
||||
? `import('${vueCompilerOptions.lib}').ShallowUnwrapRef<typeof ${names.exposed}>`
|
||||
? `import('${vueCompilerOptions.lib}').ShallowUnwrapRef<typeof ${names_1.names.exposed}>`
|
||||
: `{}`;
|
||||
if (options.vueCompilerOptions.inferComponentDollarRefs
|
||||
&& options.templateAndStyleTypes.has(names.TemplateRefs)) {
|
||||
yield ` & { $refs: ${names.TemplateRefs}; }`;
|
||||
&& options.templateAndStyleTypes.has(names_1.names.TemplateRefs)) {
|
||||
yield ` & { $refs: ${names_1.names.TemplateRefs}; }`;
|
||||
}
|
||||
if (options.vueCompilerOptions.inferComponentDollarEl
|
||||
&& options.templateAndStyleTypes.has(names.RootEl)) {
|
||||
yield ` & { $el: ${names.RootEl}; }`;
|
||||
&& options.templateAndStyleTypes.has(names_1.names.RootEl)) {
|
||||
yield ` & { $el: ${names_1.names.RootEl}; }`;
|
||||
}
|
||||
yield `) => void${utils_1.endOfLine}`;
|
||||
yield ` attrs: any${utils_1.endOfLine}`;
|
||||
yield ` slots: ${hasSlotsType(options) ? names.Slots : `{}`}${utils_1.endOfLine}`;
|
||||
yield ` slots: ${hasSlotsType(options) ? names_1.names.Slots : `{}`}${utils_1.endOfLine}`;
|
||||
yield ` emit: ${emitTypes.length ? emitTypes.join(` & `) : `{}`}${utils_1.endOfLine}`;
|
||||
yield `}${utils_1.endOfLine}`;
|
||||
yield `})(),${utils_1.newLine}`; // __VLS_setup = (async () => {
|
||||
yield `) => ({} as import('${vueCompilerOptions.lib}').VNode & { __ctx?: Awaited<typeof ${names.setup}> }))${utils_1.endOfLine}`;
|
||||
yield `) => ({} as import('${vueCompilerOptions.lib}').VNode & { __ctx?: Awaited<typeof ${names_1.names.setup}> }))${utils_1.endOfLine}`;
|
||||
}
|
||||
function* generateSetupFunction(options, ctx, scriptSetup, scriptSetupRanges, body, output) {
|
||||
const transforms = [];
|
||||
if (scriptSetupRanges.defineProps) {
|
||||
const { name, statement, callExp, typeArg } = scriptSetupRanges.defineProps;
|
||||
const _callExp = scriptSetupRanges.withDefaults?.callExp ?? callExp;
|
||||
transforms.push(...generateDefineWithTypeTransforms(scriptSetup, statement, _callExp, typeArg, name, names.props, names.Props));
|
||||
transforms.push(...generateDefineWithTypeTransforms(scriptSetup, statement, _callExp, typeArg, name, names_1.names.props, names_1.names.Props));
|
||||
}
|
||||
if (scriptSetupRanges.defineEmits) {
|
||||
const { name, statement, callExp, typeArg } = scriptSetupRanges.defineEmits;
|
||||
transforms.push(...generateDefineWithTypeTransforms(scriptSetup, statement, callExp, typeArg, name, names.emit, names.Emit));
|
||||
transforms.push(...generateDefineWithTypeTransforms(scriptSetup, statement, callExp, typeArg, name, names_1.names.emit, names_1.names.Emit));
|
||||
}
|
||||
if (scriptSetupRanges.defineSlots) {
|
||||
const { name, statement, callExp, typeArg } = scriptSetupRanges.defineSlots;
|
||||
transforms.push(...generateDefineWithTypeTransforms(scriptSetup, statement, callExp, typeArg, name, names.slots, names.Slots));
|
||||
transforms.push(...generateDefineWithTypeTransforms(scriptSetup, statement, callExp, typeArg, name, names_1.names.slots, names_1.names.Slots));
|
||||
}
|
||||
if (scriptSetupRanges.defineExpose) {
|
||||
const { callExp, arg, typeArg } = scriptSetupRanges.defineExpose;
|
||||
if (typeArg) {
|
||||
transforms.push((0, transform_1.insert)(callExp.start, function* () {
|
||||
yield `let ${names.exposed}!: `;
|
||||
yield `let ${names_1.names.exposed}!: `;
|
||||
yield* (0, utils_1.generateSfcBlockSection)(scriptSetup, typeArg.start, typeArg.end, codeFeatures_1.codeFeatures.all);
|
||||
yield utils_1.endOfLine;
|
||||
}), (0, transform_1.replace)(typeArg.start, typeArg.end, function* () {
|
||||
yield `typeof ${names.exposed}`;
|
||||
yield `typeof ${names_1.names.exposed}`;
|
||||
}));
|
||||
}
|
||||
else if (arg) {
|
||||
transforms.push((0, transform_1.insert)(callExp.start, function* () {
|
||||
yield `const ${names.exposed} = `;
|
||||
yield `const ${names_1.names.exposed} = `;
|
||||
yield* (0, utils_1.generateSfcBlockSection)(scriptSetup, arg.start, arg.end, codeFeatures_1.codeFeatures.all);
|
||||
yield utils_1.endOfLine;
|
||||
}), (0, transform_1.replace)(arg.start, arg.end, function* () {
|
||||
yield `${names.exposed}`;
|
||||
yield names_1.names.exposed;
|
||||
}));
|
||||
}
|
||||
else {
|
||||
transforms.push((0, transform_1.insert)(callExp.start, function* () {
|
||||
yield `const ${names.exposed} = {}${utils_1.endOfLine}`;
|
||||
yield `const ${names_1.names.exposed} = {}${utils_1.endOfLine}`;
|
||||
}));
|
||||
}
|
||||
}
|
||||
@@ -171,7 +138,7 @@ function* generateSetupFunction(options, ctx, scriptSetup, scriptSetupRanges, bo
|
||||
transforms.push((0, transform_1.insert)(callExp.start, function* () {
|
||||
yield `(`;
|
||||
}), (0, transform_1.insert)(callExp.end, function* () {
|
||||
yield ` as typeof ${names.dollars}.$attrs)`;
|
||||
yield ` as typeof ${names_1.names.dollars}.$attrs)`;
|
||||
}));
|
||||
}
|
||||
}
|
||||
@@ -179,8 +146,8 @@ function* generateSetupFunction(options, ctx, scriptSetup, scriptSetupRanges, bo
|
||||
transforms.push((0, transform_1.insert)(callExp.start, function* () {
|
||||
yield `(`;
|
||||
}));
|
||||
const type = options.templateAndStyleTypes.has(names.StyleModules)
|
||||
? names.StyleModules
|
||||
const type = options.templateAndStyleTypes.has(names_1.names.StyleModules)
|
||||
? names_1.names.StyleModules
|
||||
: `{}`;
|
||||
if (arg) {
|
||||
transforms.push((0, transform_1.insert)(callExp.end, function* () {
|
||||
@@ -206,7 +173,7 @@ function* generateSetupFunction(options, ctx, scriptSetup, scriptSetupRanges, bo
|
||||
transforms.push((0, transform_1.insert)(callExp.start, function* () {
|
||||
yield `(`;
|
||||
}), (0, transform_1.insert)(callExp.end, function* () {
|
||||
yield ` as typeof ${names.dollars}.$slots)`;
|
||||
yield ` as typeof ${names_1.names.dollars}.$slots)`;
|
||||
}));
|
||||
}
|
||||
}
|
||||
@@ -216,7 +183,7 @@ function* generateSetupFunction(options, ctx, scriptSetup, scriptSetupRanges, bo
|
||||
}), (0, transform_1.insert)(callExp.end, function* () {
|
||||
yield ` as Readonly<import('${options.vueCompilerOptions.lib}').ShallowRef<`;
|
||||
if (arg) {
|
||||
yield names.TemplateRefs;
|
||||
yield names_1.names.TemplateRefs;
|
||||
yield `[`;
|
||||
yield* (0, utils_1.generateSfcBlockSection)(scriptSetup, arg.start, arg.end, codeFeatures_1.codeFeatures.withoutSemantic);
|
||||
yield `]`;
|
||||
@@ -239,11 +206,11 @@ function* generateSetupFunction(options, ctx, scriptSetup, scriptSetupRanges, bo
|
||||
yield* body;
|
||||
if (output) {
|
||||
if (hasSlotsType(options)) {
|
||||
yield `const __VLS_base = `;
|
||||
yield `const ${names_1.names.base} = `;
|
||||
yield* (0, component_1.generateComponent)(options, ctx, scriptSetup, scriptSetupRanges);
|
||||
yield utils_1.endOfLine;
|
||||
yield* output;
|
||||
yield `{} as ${ctx.localTypes.WithSlots}<typeof __VLS_base, ${names.Slots}>${utils_1.endOfLine}`;
|
||||
yield `{} as ${ctx.localTypes.WithSlots}<typeof ${names_1.names.base}, ${names_1.names.Slots}>${utils_1.endOfLine}`;
|
||||
}
|
||||
else {
|
||||
yield* output;
|
||||
@@ -316,28 +283,28 @@ function* generateDefineWithTypeTransforms(scriptSetup, statement, callExp, type
|
||||
}
|
||||
function* generatePublicProps(options, ctx, scriptSetup, scriptSetupRanges) {
|
||||
if (scriptSetupRanges.defineProps?.typeArg && scriptSetupRanges.withDefaults?.arg) {
|
||||
yield `const ${names.defaults} = `;
|
||||
yield `const ${names_1.names.defaults} = `;
|
||||
yield* (0, utils_1.generateSfcBlockSection)(scriptSetup, scriptSetupRanges.withDefaults.arg.start, scriptSetupRanges.withDefaults.arg.end, codeFeatures_1.codeFeatures.navigation);
|
||||
yield utils_1.endOfLine;
|
||||
}
|
||||
const propTypes = [];
|
||||
if (options.vueCompilerOptions.jsxSlots && hasSlotsType(options)) {
|
||||
propTypes.push(`${ctx.localTypes.PropsChildren}<${names.Slots}>`);
|
||||
propTypes.push(`${ctx.localTypes.PropsChildren}<${names_1.names.Slots}>`);
|
||||
}
|
||||
if (scriptSetupRanges.defineProps?.typeArg) {
|
||||
propTypes.push(names.Props);
|
||||
propTypes.push(names_1.names.Props);
|
||||
}
|
||||
if (scriptSetupRanges.defineModel.length) {
|
||||
propTypes.push(names.ModelProps);
|
||||
propTypes.push(names_1.names.ModelProps);
|
||||
}
|
||||
if (propTypes.length) {
|
||||
yield `type ${names.PublicProps} = ${propTypes.join(` & `)}${utils_1.endOfLine}`;
|
||||
ctx.generatedTypes.add(names.PublicProps);
|
||||
yield `type ${names_1.names.PublicProps} = ${propTypes.join(` & `)}${utils_1.endOfLine}`;
|
||||
ctx.generatedTypes.add(names_1.names.PublicProps);
|
||||
}
|
||||
}
|
||||
function hasSlotsType(options) {
|
||||
return !!(options.scriptSetupRanges?.defineSlots
|
||||
|| options.templateAndStyleTypes.has(names.Slots));
|
||||
|| options.templateAndStyleTypes.has(names_1.names.Slots));
|
||||
}
|
||||
function* generateModels(scriptSetup, scriptSetupRanges) {
|
||||
if (!scriptSetupRanges.defineModel.length) {
|
||||
@@ -361,7 +328,7 @@ function* generateModels(scriptSetup, scriptSetupRanges) {
|
||||
}
|
||||
else if (defineModel.defaultValue && propName) {
|
||||
// Infer from defineModel({ default: T })
|
||||
modelType = `typeof ${names.defaultModels}['${propName}']`;
|
||||
modelType = `typeof ${names_1.names.defaultModels}['${propName}']`;
|
||||
}
|
||||
else {
|
||||
modelType = `any`;
|
||||
@@ -373,22 +340,22 @@ function* generateModels(scriptSetup, scriptSetupRanges) {
|
||||
emitCodes.push(generateModelEmit(defineModel, propName, modelType));
|
||||
}
|
||||
if (defaultCodes.length) {
|
||||
yield `const ${names.defaultModels} = {${utils_1.newLine}`;
|
||||
yield `const ${names_1.names.defaultModels} = {${utils_1.newLine}`;
|
||||
yield* defaultCodes;
|
||||
yield `}${utils_1.endOfLine}`;
|
||||
}
|
||||
yield `type ${names.ModelProps} = {${utils_1.newLine}`;
|
||||
yield `type ${names_1.names.ModelProps} = {${utils_1.newLine}`;
|
||||
for (const codes of propCodes) {
|
||||
yield* codes;
|
||||
}
|
||||
yield `}${utils_1.endOfLine}`;
|
||||
yield `type ${names.ModelEmit} = {${utils_1.newLine}`;
|
||||
yield `type ${names_1.names.ModelEmit} = {${utils_1.newLine}`;
|
||||
for (const codes of emitCodes) {
|
||||
yield* codes;
|
||||
}
|
||||
yield `}${utils_1.endOfLine}`;
|
||||
// avoid `defineModel<...>()` to prevent JS AST issues
|
||||
yield `let ${names.modelEmit}!: __VLS_ShortEmits<${names.ModelEmit}>${utils_1.endOfLine}`;
|
||||
yield `let ${names_1.names.modelEmit}!: ${names_1.names.ShortEmits}<${names_1.names.ModelEmit}>${utils_1.endOfLine}`;
|
||||
}
|
||||
function* generateModelProp(scriptSetup, defineModel, propName, modelType) {
|
||||
if (defineModel.comments) {
|
||||
|
||||
+29
-63
@@ -1,41 +1,8 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.generateTemplate = generateTemplate;
|
||||
const codeFeatures_1 = require("../codeFeatures");
|
||||
const names = __importStar(require("../names"));
|
||||
const names_1 = require("../names");
|
||||
const utils_1 = require("../utils");
|
||||
const merge_1 = require("../utils/merge");
|
||||
function* generateTemplate(options, ctx, selfType) {
|
||||
@@ -55,87 +22,86 @@ function* generateTemplateCtx({ vueCompilerOptions, templateAndStyleTypes, scrip
|
||||
exps.push([`globalThis`]);
|
||||
}
|
||||
if (selfType) {
|
||||
exps.push([`{} as InstanceType<__VLS_PickNotAny<typeof ${selfType}, new () => {}>>`]);
|
||||
exps.push([`{} as InstanceType<${names_1.names.PickNotAny}<typeof ${selfType}, new () => {}>>`]);
|
||||
}
|
||||
else {
|
||||
exps.push([`{} as import('${vueCompilerOptions.lib}').ComponentPublicInstance`]);
|
||||
}
|
||||
if (templateAndStyleTypes.has(names.StyleModules)) {
|
||||
exps.push([`{} as ${names.StyleModules}`]);
|
||||
if (templateAndStyleTypes.has(names_1.names.StyleModules)) {
|
||||
exps.push([`{} as ${names_1.names.StyleModules}`]);
|
||||
}
|
||||
if (scriptSetupRanges?.defineEmits) {
|
||||
const { defineEmits } = scriptSetupRanges;
|
||||
emitTypes.push(`typeof ${defineEmits.name ?? names.emit}`);
|
||||
emitTypes.push(`typeof ${scriptSetupRanges.defineEmits.name ?? names_1.names.emit}`);
|
||||
}
|
||||
if (scriptSetupRanges?.defineModel.length) {
|
||||
emitTypes.push(`typeof ${names.modelEmit}`);
|
||||
emitTypes.push(`typeof ${names_1.names.modelEmit}`);
|
||||
}
|
||||
if (emitTypes.length) {
|
||||
yield `type ${names.EmitProps} = __VLS_EmitsToProps<__VLS_NormalizeEmits<${emitTypes.join(` & `)}>>${utils_1.endOfLine}`;
|
||||
yield `type ${names_1.names.EmitProps} = ${names_1.names.EmitsToProps}<${names_1.names.NormalizeEmits}<${emitTypes.join(` & `)}>>${utils_1.endOfLine}`;
|
||||
exps.push([`{} as { $emit: ${emitTypes.join(` & `)} }`]);
|
||||
}
|
||||
if (scriptSetupRanges?.defineProps) {
|
||||
propTypes.push(`typeof ${scriptSetupRanges.defineProps.name ?? names.props}`);
|
||||
propTypes.push(`typeof ${scriptSetupRanges.defineProps.name ?? names_1.names.props}`);
|
||||
}
|
||||
if (scriptSetupRanges?.defineModel.length) {
|
||||
propTypes.push(names.ModelProps);
|
||||
propTypes.push(names_1.names.ModelProps);
|
||||
}
|
||||
if (emitTypes.length) {
|
||||
propTypes.push(names.EmitProps);
|
||||
propTypes.push(names_1.names.EmitProps);
|
||||
}
|
||||
if (propTypes.length) {
|
||||
exps.push([`{} as { $props: ${propTypes.join(` & `)} }`]);
|
||||
exps.push([`{} as ${propTypes.join(` & `)}`]);
|
||||
}
|
||||
if (ctx.generatedTypes.has(names.SetupExposed)) {
|
||||
exps.push([`{} as ${names.SetupExposed}`]);
|
||||
if (ctx.generatedTypes.has(names_1.names.SetupExposed)) {
|
||||
exps.push([`{} as ${names_1.names.SetupExposed}`]);
|
||||
}
|
||||
yield `const ${names.ctx} = `;
|
||||
yield `const ${names_1.names.ctx} = `;
|
||||
yield* (0, merge_1.generateSpreadMerge)(exps);
|
||||
yield utils_1.endOfLine;
|
||||
}
|
||||
function* generateTemplateComponents({ vueCompilerOptions, script, scriptRanges }, ctx) {
|
||||
const types = [];
|
||||
if (ctx.generatedTypes.has(names.SetupExposed)) {
|
||||
types.push(names.SetupExposed);
|
||||
if (ctx.generatedTypes.has(names_1.names.SetupExposed)) {
|
||||
types.push(names_1.names.SetupExposed);
|
||||
}
|
||||
if (script && scriptRanges?.exportDefault?.options?.components) {
|
||||
const { components } = scriptRanges.exportDefault.options;
|
||||
yield `const __VLS_componentsOption = `;
|
||||
yield `const ${names_1.names.componentsOption} = `;
|
||||
yield* (0, utils_1.generateSfcBlockSection)(script, components.start, components.end, codeFeatures_1.codeFeatures.navigation);
|
||||
yield utils_1.endOfLine;
|
||||
types.push(`typeof __VLS_componentsOption`);
|
||||
types.push(`typeof ${names_1.names.componentsOption}`);
|
||||
}
|
||||
yield `type __VLS_LocalComponents = ${types.length ? types.join(` & `) : `{}`}${utils_1.endOfLine}`;
|
||||
yield `type __VLS_GlobalComponents = ${vueCompilerOptions.target >= 3.5
|
||||
yield `type ${names_1.names.LocalComponents} = ${types.length ? types.join(` & `) : `{}`}${utils_1.endOfLine}`;
|
||||
yield `type ${names_1.names.GlobalComponents} = ${vueCompilerOptions.target >= 3.5
|
||||
? `import('${vueCompilerOptions.lib}').GlobalComponents`
|
||||
: `import('${vueCompilerOptions.lib}').GlobalComponents & Pick<typeof import('${vueCompilerOptions.lib}'), 'Transition' | 'TransitionGroup' | 'KeepAlive' | 'Suspense' | 'Teleport'>`}${utils_1.endOfLine}`;
|
||||
yield `let ${names.components}!: __VLS_LocalComponents & __VLS_GlobalComponents${utils_1.endOfLine}`;
|
||||
yield `let ${names.intrinsics}!: ${vueCompilerOptions.target >= 3.3
|
||||
yield `let ${names_1.names.components}!: ${names_1.names.LocalComponents} & ${names_1.names.GlobalComponents}${utils_1.endOfLine}`;
|
||||
yield `let ${names_1.names.intrinsics}!: ${vueCompilerOptions.target >= 3.3
|
||||
? `import('${vueCompilerOptions.lib}/jsx-runtime').JSX.IntrinsicElements`
|
||||
: `globalThis.JSX.IntrinsicElements`}${utils_1.endOfLine}`;
|
||||
}
|
||||
function* generateTemplateDirectives({ vueCompilerOptions, script, scriptRanges }, ctx) {
|
||||
const types = [];
|
||||
if (ctx.generatedTypes.has(names.SetupExposed)) {
|
||||
types.push(names.SetupExposed);
|
||||
if (ctx.generatedTypes.has(names_1.names.SetupExposed)) {
|
||||
types.push(names_1.names.SetupExposed);
|
||||
}
|
||||
if (script && scriptRanges?.exportDefault?.options?.directives) {
|
||||
const { directives } = scriptRanges.exportDefault.options;
|
||||
yield `const __VLS_directivesOption = `;
|
||||
yield `const ${names_1.names.directivesOption} = `;
|
||||
yield* (0, utils_1.generateSfcBlockSection)(script, directives.start, directives.end, codeFeatures_1.codeFeatures.navigation);
|
||||
yield utils_1.endOfLine;
|
||||
types.push(`__VLS_ResolveDirectives<typeof __VLS_directivesOption>`);
|
||||
types.push(`${names_1.names.ResolveDirectives}<typeof ${names_1.names.directivesOption}>`);
|
||||
}
|
||||
yield `type __VLS_LocalDirectives = ${types.length ? types.join(` & `) : `{}`}${utils_1.endOfLine}`;
|
||||
yield `let ${names.directives}!: __VLS_LocalDirectives & import('${vueCompilerOptions.lib}').GlobalDirectives${utils_1.endOfLine}`;
|
||||
yield `type ${names_1.names.LocalDirectives} = ${types.length ? types.join(` & `) : `{}`}${utils_1.endOfLine}`;
|
||||
yield `let ${names_1.names.directives}!: ${names_1.names.LocalDirectives} & import('${vueCompilerOptions.lib}').GlobalDirectives${utils_1.endOfLine}`;
|
||||
}
|
||||
function* generateSetupExposed({ vueCompilerOptions, exposed }, ctx) {
|
||||
if (!exposed.size) {
|
||||
return;
|
||||
}
|
||||
ctx.generatedTypes.add(names.SetupExposed);
|
||||
yield `type ${names.SetupExposed} = import('${vueCompilerOptions.lib}').ShallowUnwrapRef<{${utils_1.newLine}`;
|
||||
ctx.generatedTypes.add(names_1.names.SetupExposed);
|
||||
yield `type ${names_1.names.SetupExposed} = import('${vueCompilerOptions.lib}').ShallowUnwrapRef<{${utils_1.newLine}`;
|
||||
for (const bindingName of exposed) {
|
||||
const token = Symbol(bindingName.length);
|
||||
yield ['', undefined, 0, { __linkedToken: token }];
|
||||
|
||||
+4
-37
@@ -1,41 +1,8 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.generateStyleModules = generateStyleModules;
|
||||
const codeFeatures_1 = require("../codeFeatures");
|
||||
const names = __importStar(require("../names"));
|
||||
const names_1 = require("../names");
|
||||
const utils_1 = require("../utils");
|
||||
const common_1 = require("./common");
|
||||
function* generateStyleModules({ styles, vueCompilerOptions }, ctx) {
|
||||
@@ -43,8 +10,8 @@ function* generateStyleModules({ styles, vueCompilerOptions }, ctx) {
|
||||
if (!styleModules.length) {
|
||||
return;
|
||||
}
|
||||
ctx.generatedTypes.add(names.StyleModules);
|
||||
yield `type ${names.StyleModules} = {${utils_1.newLine}`;
|
||||
ctx.generatedTypes.add(names_1.names.StyleModules);
|
||||
yield `type ${names_1.names.StyleModules} = {${utils_1.newLine}`;
|
||||
for (const style of styleModules) {
|
||||
if (style.module === true) {
|
||||
yield `$style`;
|
||||
@@ -62,7 +29,7 @@ function* generateStyleModules({ styles, vueCompilerOptions }, ctx) {
|
||||
if (!vueCompilerOptions.strictCssModules) {
|
||||
yield `Record<string, string> & `;
|
||||
}
|
||||
yield `__VLS_PrettifyGlobal<{}`;
|
||||
yield `${names_1.names.PrettifyGlobal}<{}`;
|
||||
if (vueCompilerOptions.resolveStyleImports) {
|
||||
yield* (0, common_1.generateStyleImports)(style);
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.generateStyleScopedClasses = generateStyleScopedClasses;
|
||||
const names_1 = require("../names");
|
||||
const styleScopedClasses_1 = require("../template/styleScopedClasses");
|
||||
const utils_1 = require("../utils");
|
||||
const common_1 = require("./common");
|
||||
@@ -15,7 +16,7 @@ function* generateStyleScopedClasses({ vueCompilerOptions, styles }) {
|
||||
}
|
||||
const visited = new Set();
|
||||
const deferredGenerations = [];
|
||||
yield `type __VLS_StyleScopedClasses = {}`;
|
||||
yield `type ${names_1.names.StyleScopedClasses} = {}`;
|
||||
for (const style of scopedStyles) {
|
||||
if (resolveStyleImports) {
|
||||
yield* (0, common_1.generateStyleImports)(style);
|
||||
|
||||
+28
-25
@@ -41,7 +41,7 @@ const muggle_string_1 = require("muggle-string");
|
||||
const shared_2 = require("../../utils/shared");
|
||||
const codeFeatures_1 = require("../codeFeatures");
|
||||
const inlayHints_1 = require("../inlayHints");
|
||||
const names = __importStar(require("../names"));
|
||||
const names_1 = require("../names");
|
||||
const utils_1 = require("../utils");
|
||||
const boundary_1 = require("../utils/boundary");
|
||||
const camelized_1 = require("../utils/camelized");
|
||||
@@ -114,9 +114,9 @@ function* generateComponent(options, ctx, node) {
|
||||
yield utils_1.endOfLine;
|
||||
}
|
||||
else {
|
||||
yield `let ${componentVar}!: __VLS_WithComponent<'${tag}', __VLS_LocalComponents, __VLS_GlobalComponents`;
|
||||
yield `let ${componentVar}!: ${names_1.names.WithComponent}<'${tag}', ${names_1.names.LocalComponents}, ${names_1.names.GlobalComponents}`;
|
||||
yield originalNames.has(options.componentName)
|
||||
? `, typeof ${names._export}`
|
||||
? `, typeof ${names_1.names.export}`
|
||||
: `, void`;
|
||||
for (const name of originalNames) {
|
||||
yield `, '${name}'`;
|
||||
@@ -131,18 +131,21 @@ function* generateComponent(options, ctx, node) {
|
||||
yield `]${utils_1.endOfLine}`;
|
||||
if (utils_1.identifierRegex.test((0, shared_1.camelize)(tag))) {
|
||||
// navigation support
|
||||
yield `/** @ts-ignore @type {typeof ${names.components}.`;
|
||||
yield* (0, camelized_1.generateCamelized)(tag, 'template', startTagOffset, codeFeatures_1.codeFeatures.navigation);
|
||||
if (tag[0] !== tag[0].toUpperCase()) {
|
||||
yield ` | typeof ${names.components}.`;
|
||||
yield* (0, camelized_1.generateCamelized)((0, shared_1.capitalize)(tag), 'template', startTagOffset, codeFeatures_1.codeFeatures.navigation);
|
||||
}
|
||||
if (endTagOffset !== undefined) {
|
||||
yield ` | typeof ${names.components}.`;
|
||||
yield* (0, camelized_1.generateCamelized)(tag, 'template', endTagOffset, codeFeatures_1.codeFeatures.navigation);
|
||||
yield `/** @ts-ignore @type {`;
|
||||
for (const offset of [startTagOffset, endTagOffset]) {
|
||||
if (offset === undefined) {
|
||||
continue;
|
||||
}
|
||||
yield ` | typeof ${names_1.names.components}.`;
|
||||
yield* (0, camelized_1.generateCamelized)(tag, 'template', offset, codeFeatures_1.codeFeatures.navigation);
|
||||
if (tag[0] !== tag[0].toUpperCase()) {
|
||||
yield ` | typeof ${names.components}.`;
|
||||
yield* (0, camelized_1.generateCamelized)((0, shared_1.capitalize)(tag), 'template', endTagOffset, codeFeatures_1.codeFeatures.navigation);
|
||||
yield ` | typeof ${names_1.names.components}.`;
|
||||
yield* (0, camelized_1.generateCamelized)((0, shared_1.capitalize)(tag), 'template', offset, codeFeatures_1.codeFeatures.navigation);
|
||||
}
|
||||
if (tag.includes('-')) {
|
||||
yield ` | typeof ${names_1.names.components}[`;
|
||||
yield* (0, stringLiteralKey_1.generateStringLiteralKey)(tag, offset, codeFeatures_1.codeFeatures.navigation);
|
||||
yield `]`;
|
||||
}
|
||||
}
|
||||
yield `} */${utils_1.newLine}`;
|
||||
@@ -163,16 +166,16 @@ function* generateComponentBody(options, ctx, node, tag, tagOffset, props, compo
|
||||
const failGeneratedExpressions = [];
|
||||
const propCodes = [...(0, elementProps_1.generateElementProps)(options, ctx, node, props, options.vueCompilerOptions.checkUnknownProps, failGeneratedExpressions)];
|
||||
const functionalVar = ctx.getInternalVariable();
|
||||
const vNodeVar = ctx.getInternalVariable();
|
||||
const vnodeVar = ctx.getInternalVariable();
|
||||
const ctxVar = ctx.getInternalVariable();
|
||||
const propsVar = ctx.getInternalVariable();
|
||||
yield `// @ts-ignore${utils_1.newLine}`;
|
||||
yield `const ${functionalVar} = ${options.vueCompilerOptions.checkUnknownProps ? '__VLS_asFunctionalComponent0' : '__VLS_asFunctionalComponent1'}(${componentVar}, new ${componentVar}({${utils_1.newLine}`;
|
||||
yield `const ${functionalVar} = ${options.vueCompilerOptions.checkUnknownProps ? names_1.names.asFunctionalComponent0 : names_1.names.asFunctionalComponent1}(${componentVar}, new ${componentVar}({${utils_1.newLine}`;
|
||||
yield (0, muggle_string_1.toString)(propCodes);
|
||||
yield `}))${utils_1.endOfLine}`;
|
||||
yield `const `;
|
||||
const token = yield* (0, boundary_1.startBoundary)('template', node.loc.start.offset, codeFeatures_1.codeFeatures.doNotReportTs6133);
|
||||
yield vNodeVar;
|
||||
yield vnodeVar;
|
||||
yield (0, boundary_1.endBoundary)(token, node.loc.end.offset);
|
||||
yield ` = ${functionalVar}`;
|
||||
if (ctx.currentInfo.generic) {
|
||||
@@ -189,7 +192,7 @@ function* generateComponentBody(options, ctx, node, tag, tagOffset, props, compo
|
||||
yield* propCodes;
|
||||
yield `}`;
|
||||
yield (0, boundary_1.endBoundary)(token2, tagOffset + tag.length);
|
||||
yield `, ...__VLS_functionalComponentArgsRest(${functionalVar}))${utils_1.endOfLine}`;
|
||||
yield `, ...${names_1.names.functionalComponentArgsRest}(${functionalVar}))${utils_1.endOfLine}`;
|
||||
yield* generateFailedExpressions(options, ctx, failGeneratedExpressions);
|
||||
yield* (0, elementEvents_1.generateElementEvents)(options, ctx, node, componentVar, getCtxVar, getPropsVar);
|
||||
yield* (0, elementDirectives_1.generateElementDirectives)(options, ctx, node);
|
||||
@@ -220,21 +223,21 @@ function* generateComponentBody(options, ctx, node, tag, tagOffset, props, compo
|
||||
yield* (0, vSlot_1.generateVSlot)(options, ctx, node, slotDir, getCtxVar());
|
||||
}
|
||||
if (isCtxVarUsed) {
|
||||
yield `var ${ctxVar}!: __VLS_FunctionalComponentCtx<typeof ${componentVar}, typeof ${vNodeVar}>${utils_1.endOfLine}`;
|
||||
yield `var ${ctxVar}!: ${names_1.names.FunctionalComponentCtx}<typeof ${componentVar}, typeof ${vnodeVar}>${utils_1.endOfLine}`;
|
||||
}
|
||||
if (isPropsVarUsed) {
|
||||
yield `var ${propsVar}!: __VLS_FunctionalComponentProps<typeof ${componentVar}, typeof ${vNodeVar}>${utils_1.endOfLine}`;
|
||||
yield `var ${propsVar}!: ${names_1.names.FunctionalComponentProps}<typeof ${componentVar}, typeof ${vnodeVar}>${utils_1.endOfLine}`;
|
||||
}
|
||||
ctx.components.pop();
|
||||
}
|
||||
function* generateElement(options, ctx, node) {
|
||||
const [startTagOffset, endTagOffset] = (0, shared_2.getElementTagOffsets)(node, options.template);
|
||||
const failedPropExps = [];
|
||||
yield `${options.vueCompilerOptions.checkUnknownProps ? `__VLS_asFunctionalElement0` : `__VLS_asFunctionalElement1`}(${names.intrinsics}`;
|
||||
yield `${options.vueCompilerOptions.checkUnknownProps ? names_1.names.asFunctionalElement0 : names_1.names.asFunctionalElement1}(${names_1.names.intrinsics}`;
|
||||
yield* (0, propertyAccess_1.generatePropertyAccess)(options, ctx, node.tag, startTagOffset, codeFeatures_1.codeFeatures.withoutHighlightAndCompletion);
|
||||
if (endTagOffset !== undefined) {
|
||||
yield `, `;
|
||||
yield names.intrinsics;
|
||||
yield names_1.names.intrinsics;
|
||||
yield* (0, propertyAccess_1.generatePropertyAccess)(options, ctx, node.tag, endTagOffset, codeFeatures_1.codeFeatures.withoutHighlightAndCompletion);
|
||||
}
|
||||
yield `)(`;
|
||||
@@ -248,17 +251,17 @@ function* generateElement(options, ctx, node) {
|
||||
yield* (0, elementDirectives_1.generateElementDirectives)(options, ctx, node);
|
||||
const templateRef = getTemplateRef(node);
|
||||
if (templateRef) {
|
||||
let typeExp = `__VLS_Elements['${node.tag}']`;
|
||||
let typeExp = `${names_1.names.Elements}['${node.tag}']`;
|
||||
if (ctx.inVFor) {
|
||||
typeExp += `[]`;
|
||||
}
|
||||
ctx.addTemplateRef(templateRef[0], typeExp, templateRef[1]);
|
||||
}
|
||||
if (ctx.singleRootNodes.has(node)) {
|
||||
ctx.singleRootElTypes.add(`__VLS_Elements['${node.tag}']`);
|
||||
ctx.singleRootElTypes.add(`${names_1.names.Elements}['${node.tag}']`);
|
||||
}
|
||||
if (hasVBindAttrs(options, ctx, node)) {
|
||||
ctx.inheritedAttrVars.add(`__VLS_intrinsics.${node.tag}`);
|
||||
ctx.inheritedAttrVars.add(`${names_1.names.intrinsics}.${node.tag}`);
|
||||
}
|
||||
yield* generateStyleScopedClassReferences(options, node);
|
||||
for (const child of node.children) {
|
||||
|
||||
Generated
Vendored
+4
-4
@@ -38,7 +38,7 @@ exports.generateModifiers = generateModifiers;
|
||||
const CompilerDOM = __importStar(require("@vue/compiler-dom"));
|
||||
const shared_1 = require("@vue/shared");
|
||||
const codeFeatures_1 = require("../codeFeatures");
|
||||
const names = __importStar(require("../names"));
|
||||
const names_1 = require("../names");
|
||||
const utils_1 = require("../utils");
|
||||
const boundary_1 = require("../utils/boundary");
|
||||
const camelized_1 = require("../utils/camelized");
|
||||
@@ -56,9 +56,9 @@ function* generateElementDirectives(options, ctx, node) {
|
||||
continue;
|
||||
}
|
||||
const token = yield* (0, boundary_1.startBoundary)('template', prop.loc.start.offset, codeFeatures_1.codeFeatures.verification);
|
||||
yield `__VLS_asFunctionalDirective(`;
|
||||
yield `${names_1.names.asFunctionalDirective}(`;
|
||||
yield* generateIdentifier(options, ctx, prop);
|
||||
yield `, {} as import('${options.vueCompilerOptions.lib}').ObjectDirective)(null!, { ...__VLS_directiveBindingRestFields, `;
|
||||
yield `, {} as import('${options.vueCompilerOptions.lib}').ObjectDirective)(null!, { ...${names_1.names.directiveBindingRestFields}, `;
|
||||
yield* generateArg(options, ctx, prop);
|
||||
yield* generateModifiers(options, ctx, prop);
|
||||
yield* generateValue(options, ctx, prop);
|
||||
@@ -71,7 +71,7 @@ function* generateIdentifier(options, ctx, prop) {
|
||||
const rawName = 'v-' + prop.name;
|
||||
const startOffset = prop.loc.start.offset;
|
||||
const token = yield* (0, boundary_1.startBoundary)('template', startOffset, codeFeatures_1.codeFeatures.verification);
|
||||
yield names.directives;
|
||||
yield names_1.names.directives;
|
||||
yield `.`;
|
||||
yield* (0, camelized_1.generateCamelized)(rawName, 'template', prop.loc.start.offset, {
|
||||
...codeFeatures_1.codeFeatures.withoutHighlightAndCompletion,
|
||||
|
||||
+3
-2
@@ -41,6 +41,7 @@ exports.isCompoundExpression = isCompoundExpression;
|
||||
const CompilerDOM = __importStar(require("@vue/compiler-dom"));
|
||||
const shared_1 = require("@vue/shared");
|
||||
const codeFeatures_1 = require("../codeFeatures");
|
||||
const names_1 = require("../names");
|
||||
const utils_1 = require("../utils");
|
||||
const boundary_1 = require("../utils/boundary");
|
||||
const camelized_1 = require("../utils/camelized");
|
||||
@@ -56,7 +57,7 @@ function* generateElementEvents(options, ctx, node, componentOriginalVar, getCtx
|
||||
&& (!prop.arg || prop.arg.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION && prop.arg.isStatic))) {
|
||||
if (!emitsVar) {
|
||||
emitsVar = ctx.getInternalVariable();
|
||||
yield `let ${emitsVar}!: __VLS_ResolveEmits<typeof ${componentOriginalVar}, typeof ${getCtxVar()}.emit>${utils_1.endOfLine}`;
|
||||
yield `let ${emitsVar}!: ${names_1.names.ResolveEmits}<typeof ${componentOriginalVar}, typeof ${getCtxVar()}.emit>${utils_1.endOfLine}`;
|
||||
}
|
||||
let source = prop.arg?.loc.source ?? 'model-value';
|
||||
let start = prop.arg?.loc.start.offset;
|
||||
@@ -75,7 +76,7 @@ function* generateElementEvents(options, ctx, node, componentOriginalVar, getCtx
|
||||
const propName = (0, shared_1.camelize)(propPrefix + source);
|
||||
const emitName = emitPrefix + source;
|
||||
const camelizedEmitName = (0, shared_1.camelize)(emitName);
|
||||
yield `const ${ctx.getInternalVariable()}: __VLS_NormalizeComponentEvent<typeof ${getPropsVar()}, typeof ${emitsVar}, '${propName}', '${emitName}', '${camelizedEmitName}'> = (${utils_1.newLine}`;
|
||||
yield `const ${ctx.getInternalVariable()}: ${names_1.names.NormalizeComponentEvent}<typeof ${getPropsVar()}, typeof ${emitsVar}, '${propName}', '${emitName}', '${camelizedEmitName}'> = (${utils_1.newLine}`;
|
||||
if (prop.name === 'on') {
|
||||
yield `{ `;
|
||||
yield* generateEventArg(options, source, start, emitPrefix.slice(0, -1), codeFeatures_1.codeFeatures.navigation);
|
||||
|
||||
+3
-3
@@ -41,7 +41,7 @@ const picomatch_1 = require("picomatch");
|
||||
const shared_2 = require("../../utils/shared");
|
||||
const codeFeatures_1 = require("../codeFeatures");
|
||||
const inlayHints_1 = require("../inlayHints");
|
||||
const names = __importStar(require("../names"));
|
||||
const names_1 = require("../names");
|
||||
const utils_1 = require("../utils");
|
||||
const boundary_1 = require("../utils/boundary");
|
||||
const camelized_1 = require("../utils/camelized");
|
||||
@@ -136,7 +136,7 @@ function* generateElementProps(options, ctx, node, props, strictPropsCheck, fail
|
||||
if (isComponent && prop.name === 'model' && prop.modifiers.length) {
|
||||
const propertyName = prop.arg?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION
|
||||
? !prop.arg.isStatic
|
||||
? `[__VLS_tryAsConstant(\`\${${prop.arg.content}}Modifiers\`)]`
|
||||
? `[${names_1.names.tryAsConstant}(\`\${${prop.arg.content}}Modifiers\`)]`
|
||||
: (0, shared_1.camelize)(propName) + `Modifiers`
|
||||
: `modelModifiers`;
|
||||
yield* (0, elementDirectives_1.generateModifiers)(options, ctx, prop, propertyName);
|
||||
@@ -219,7 +219,7 @@ function* generatePropExp(options, ctx, prop, exp) {
|
||||
}
|
||||
else {
|
||||
ctx.recordComponentAccess('template', propVariableName, exp.loc.start.offset);
|
||||
yield names.ctx;
|
||||
yield names_1.names.ctx;
|
||||
yield `.`;
|
||||
yield* codes;
|
||||
}
|
||||
|
||||
+16
-49
@@ -1,41 +1,8 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.generateTemplate = generate;
|
||||
const codeFeatures_1 = require("../codeFeatures");
|
||||
const names = __importStar(require("../names"));
|
||||
const names_1 = require("../names");
|
||||
const utils_1 = require("../utils");
|
||||
const boundary_1 = require("../utils/boundary");
|
||||
const context_1 = require("./context");
|
||||
@@ -84,24 +51,24 @@ function* generateWorker(options, ctx) {
|
||||
yield* generateTemplateRefsType(options, ctx);
|
||||
yield* generateRootElType(ctx);
|
||||
if (ctx.dollarVars.size) {
|
||||
yield `var ${names.dollars}!: {${utils_1.newLine}`;
|
||||
yield `var ${names_1.names.dollars}!: {${utils_1.newLine}`;
|
||||
if (ctx.dollarVars.has('$slots')) {
|
||||
const type = ctx.generatedTypes.has(names.Slots) ? names.Slots : `{}`;
|
||||
const type = ctx.generatedTypes.has(names_1.names.Slots) ? names_1.names.Slots : `{}`;
|
||||
yield `$slots: ${type}${utils_1.endOfLine}`;
|
||||
}
|
||||
if (ctx.dollarVars.has('$attrs')) {
|
||||
yield `$attrs: import('${vueCompilerOptions.lib}').ComponentPublicInstance['$attrs']`;
|
||||
if (ctx.generatedTypes.has(names.InheritedAttrs)) {
|
||||
yield ` & ${names.InheritedAttrs}`;
|
||||
if (ctx.generatedTypes.has(names_1.names.InheritedAttrs)) {
|
||||
yield ` & ${names_1.names.InheritedAttrs}`;
|
||||
}
|
||||
yield utils_1.endOfLine;
|
||||
}
|
||||
if (ctx.dollarVars.has('$refs')) {
|
||||
const type = ctx.generatedTypes.has(names.TemplateRefs) ? names.TemplateRefs : `{}`;
|
||||
const type = ctx.generatedTypes.has(names_1.names.TemplateRefs) ? names_1.names.TemplateRefs : `{}`;
|
||||
yield `$refs: ${type}${utils_1.endOfLine}`;
|
||||
}
|
||||
if (ctx.dollarVars.has('$el')) {
|
||||
const type = ctx.generatedTypes.has(names.RootEl) ? names.RootEl : `any`;
|
||||
const type = ctx.generatedTypes.has(names_1.names.RootEl) ? names_1.names.RootEl : `any`;
|
||||
yield `$el: ${type}${utils_1.endOfLine}`;
|
||||
}
|
||||
yield `} & { [K in keyof import('${vueCompilerOptions.lib}').ComponentPublicInstance]: unknown }${utils_1.endOfLine}`;
|
||||
@@ -110,14 +77,14 @@ function* generateWorker(options, ctx) {
|
||||
}
|
||||
function* generateSlotsType(options, ctx) {
|
||||
if (options.hasDefineSlots) {
|
||||
ctx.generatedTypes.add(names.Slots);
|
||||
ctx.generatedTypes.add(names_1.names.Slots);
|
||||
return;
|
||||
}
|
||||
if (!ctx.slots.length && !ctx.dynamicSlots.length) {
|
||||
return;
|
||||
}
|
||||
ctx.generatedTypes.add(names.Slots);
|
||||
yield `type ${names.Slots} = {}`;
|
||||
ctx.generatedTypes.add(names_1.names.Slots);
|
||||
yield `type ${names_1.names.Slots} = {}`;
|
||||
for (const { expVar, propsVar } of ctx.dynamicSlots) {
|
||||
yield `${utils_1.newLine}& { [K in NonNullable<typeof ${expVar}>]?: (props: typeof ${propsVar}) => any }`;
|
||||
}
|
||||
@@ -139,16 +106,16 @@ function* generateInheritedAttrsType(ctx) {
|
||||
if (!ctx.inheritedAttrVars.size) {
|
||||
return;
|
||||
}
|
||||
ctx.generatedTypes.add(names.InheritedAttrs);
|
||||
yield `type ${names.InheritedAttrs} = Partial<${[...ctx.inheritedAttrVars].map(name => `typeof ${name}`).join(` & `)}>`;
|
||||
ctx.generatedTypes.add(names_1.names.InheritedAttrs);
|
||||
yield `type ${names_1.names.InheritedAttrs} = Partial<${[...ctx.inheritedAttrVars].map(name => `typeof ${name}`).join(` & `)}>`;
|
||||
yield utils_1.endOfLine;
|
||||
}
|
||||
function* generateTemplateRefsType(options, ctx) {
|
||||
if (!ctx.templateRefs.size) {
|
||||
return;
|
||||
}
|
||||
ctx.generatedTypes.add(names.TemplateRefs);
|
||||
yield `type ${names.TemplateRefs} = {}`;
|
||||
ctx.generatedTypes.add(names_1.names.TemplateRefs);
|
||||
yield `type ${names_1.names.TemplateRefs} = {}`;
|
||||
for (const [name, refs] of ctx.templateRefs) {
|
||||
yield `${utils_1.newLine}& `;
|
||||
if (refs.length >= 2) {
|
||||
@@ -173,8 +140,8 @@ function* generateRootElType(ctx) {
|
||||
if (!ctx.singleRootElTypes.size || ctx.singleRootNodes.has(null)) {
|
||||
return;
|
||||
}
|
||||
ctx.generatedTypes.add(names.RootEl);
|
||||
yield `type ${names.RootEl} = `;
|
||||
ctx.generatedTypes.add(names_1.names.RootEl);
|
||||
yield `type ${names_1.names.RootEl} = `;
|
||||
for (const type of ctx.singleRootElTypes) {
|
||||
yield `${utils_1.newLine}| ${type}`;
|
||||
}
|
||||
|
||||
+3
-36
@@ -1,44 +1,11 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.generateInterpolation = generateInterpolation;
|
||||
const shared_1 = require("@vue/shared");
|
||||
const collectBindings_1 = require("../../utils/collectBindings");
|
||||
const shared_2 = require("../../utils/shared");
|
||||
const codeFeatures_1 = require("../codeFeatures");
|
||||
const names = __importStar(require("../names"));
|
||||
const names_1 = require("../names");
|
||||
const utils_1 = require("../utils");
|
||||
// https://github.com/vuejs/core/blob/fb0c3ca519f1fccf52049cd6b8db3a67a669afe9/packages/compiler-core/src/transforms/transformExpression.ts#L47
|
||||
const isLiteralWhitelisted = /*@__PURE__*/ (0, shared_1.makeMap)('true,false,null,this');
|
||||
@@ -95,11 +62,11 @@ function* forEachInterpolationSegment(ts, setupRefs, ctx, block, originalCode, s
|
||||
else {
|
||||
yield ['', offset, 'errorMappingOnly']; // #1205, #1264
|
||||
if (ctx.dollarVars.has(name)) {
|
||||
yield names.dollars;
|
||||
yield names_1.names.dollars;
|
||||
}
|
||||
else {
|
||||
ctx.recordComponentAccess(block.name, name, start - prefix.length + offset);
|
||||
yield names.ctx;
|
||||
yield names_1.names.ctx;
|
||||
}
|
||||
yield `.`;
|
||||
yield [name, offset, isShorthand ? 'shorthand' : undefined];
|
||||
|
||||
+2
-1
@@ -2,6 +2,7 @@
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.generateObjectProperty = generateObjectProperty;
|
||||
const shared_1 = require("@vue/shared");
|
||||
const names_1 = require("../names");
|
||||
const utils_1 = require("../utils");
|
||||
const boundary_1 = require("../utils/boundary");
|
||||
const camelized_1 = require("../utils/camelized");
|
||||
@@ -10,7 +11,7 @@ const interpolation_1 = require("./interpolation");
|
||||
function* generateObjectProperty(options, ctx, code, offset, features, shouldCamelize = false, shouldBeConstant = false) {
|
||||
if (code.startsWith('[') && code.endsWith(']')) {
|
||||
if (shouldBeConstant) {
|
||||
yield* (0, interpolation_1.generateInterpolation)(options, ctx, options.template, features, code.slice(1, -1), offset + 1, `[__VLS_tryAsConstant(`, `)]`);
|
||||
yield* (0, interpolation_1.generateInterpolation)(options, ctx, options.template, features, code.slice(1, -1), offset + 1, `[${names_1.names.tryAsConstant}(`, `)]`);
|
||||
}
|
||||
else {
|
||||
yield* (0, interpolation_1.generateInterpolation)(options, ctx, options.template, features, code, offset);
|
||||
|
||||
+5
-5
@@ -38,7 +38,7 @@ const CompilerDOM = __importStar(require("@vue/compiler-dom"));
|
||||
const shared_1 = require("../../utils/shared");
|
||||
const codeFeatures_1 = require("../codeFeatures");
|
||||
const inlayHints_1 = require("../inlayHints");
|
||||
const names = __importStar(require("../names"));
|
||||
const names_1 = require("../names");
|
||||
const utils_1 = require("../utils");
|
||||
const boundary_1 = require("../utils/boundary");
|
||||
const elementProps_1 = require("./elementProps");
|
||||
@@ -59,7 +59,7 @@ function* generateSlotOutlet(options, ctx, node) {
|
||||
}
|
||||
});
|
||||
if (options.hasDefineSlots) {
|
||||
yield `__VLS_asFunctionalSlot(`;
|
||||
yield `${names_1.names.asFunctionalSlot}(`;
|
||||
if (nameProp) {
|
||||
let codes;
|
||||
if (nameProp.type === CompilerDOM.NodeTypes.ATTRIBUTE && nameProp.value) {
|
||||
@@ -78,13 +78,13 @@ function* generateSlotOutlet(options, ctx, node) {
|
||||
codes = [`['default']`];
|
||||
}
|
||||
const token = yield* (0, boundary_1.startBoundary)('template', nameProp.loc.start.offset, codeFeatures_1.codeFeatures.verification);
|
||||
yield options.slotsAssignName ?? names.slots;
|
||||
yield options.slotsAssignName ?? names_1.names.slots;
|
||||
yield* codes;
|
||||
yield (0, boundary_1.endBoundary)(token, nameProp.loc.end.offset);
|
||||
}
|
||||
else {
|
||||
const token = yield* (0, boundary_1.startBoundary)('template', startTagOffset, codeFeatures_1.codeFeatures.verification);
|
||||
yield `${options.slotsAssignName ?? names.slots}[`;
|
||||
yield `${options.slotsAssignName ?? names_1.names.slots}[`;
|
||||
const token2 = yield* (0, boundary_1.startBoundary)('template', startTagOffset, codeFeatures_1.codeFeatures.verification);
|
||||
yield `'default'`;
|
||||
yield (0, boundary_1.endBoundary)(token2, startTagEndOffset);
|
||||
@@ -120,7 +120,7 @@ function* generateSlotOutlet(options, ctx, node) {
|
||||
ctx.inlayHints.push((0, inlayHints_1.createVBindShorthandInlayHintInfo)(nameProp.exp.loc, 'name'));
|
||||
}
|
||||
const expVar = ctx.getInternalVariable();
|
||||
yield `var ${expVar} = __VLS_tryAsConstant(`;
|
||||
yield `var ${expVar} = ${names_1.names.tryAsConstant}(`;
|
||||
yield* (0, interpolation_1.generateInterpolation)(options, ctx, options.template, isShortHand
|
||||
? codeFeatures_1.codeFeatures.withoutHighlightAndCompletion
|
||||
: codeFeatures_1.codeFeatures.all, nameProp.exp.content, nameProp.exp.loc.start.offset);
|
||||
|
||||
Generated
Vendored
+3
-2
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.references = void 0;
|
||||
exports.generateStyleScopedClassReference = generateStyleScopedClassReference;
|
||||
const codeFeatures_1 = require("../codeFeatures");
|
||||
const names_1 = require("../names");
|
||||
const utils_1 = require("../utils");
|
||||
const boundary_1 = require("../utils/boundary");
|
||||
const escaped_1 = require("../utils/escaped");
|
||||
@@ -11,7 +12,7 @@ const classNameEscapeRegex = /([\\'])/;
|
||||
exports.references = new WeakMap();
|
||||
function* generateStyleScopedClassReference(block, className, offset, fullStart = offset) {
|
||||
if (!className) {
|
||||
yield `/** @type {__VLS_StyleScopedClasses['`;
|
||||
yield `/** @type {${names_1.names.StyleScopedClasses}['`;
|
||||
yield ['', 'template', offset, codeFeatures_1.codeFeatures.completion];
|
||||
yield `']} */${utils_1.endOfLine}`;
|
||||
return;
|
||||
@@ -25,7 +26,7 @@ function* generateStyleScopedClassReference(block, className, offset, fullStart
|
||||
else {
|
||||
cache[1].push([className, offset]);
|
||||
}
|
||||
yield `/** @type {__VLS_StyleScopedClasses[`;
|
||||
yield `/** @type {${names_1.names.StyleScopedClasses}[`;
|
||||
const token = yield* (0, boundary_1.startBoundary)(block.name, fullStart, codeFeatures_1.codeFeatures.navigation);
|
||||
yield `'`;
|
||||
yield* (0, escaped_1.generateEscaped)(className, block.name, offset, codeFeatures_1.codeFeatures.navigationAndCompletion, classNameEscapeRegex);
|
||||
|
||||
+2
-1
@@ -38,6 +38,7 @@ exports.parseVForNode = parseVForNode;
|
||||
const CompilerDOM = __importStar(require("@vue/compiler-dom"));
|
||||
const collectBindings_1 = require("../../utils/collectBindings");
|
||||
const codeFeatures_1 = require("../codeFeatures");
|
||||
const names_1 = require("../names");
|
||||
const utils_1 = require("../utils");
|
||||
const interpolation_1 = require("./interpolation");
|
||||
const templateChild_1 = require("./templateChild");
|
||||
@@ -58,7 +59,7 @@ function* generateVFor(options, ctx, node) {
|
||||
}
|
||||
yield `] of `;
|
||||
if (source.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION) {
|
||||
yield `__VLS_vFor(`;
|
||||
yield `${names_1.names.vFor}(`;
|
||||
yield* (0, interpolation_1.generateInterpolation)(options, ctx, options.template, codeFeatures_1.codeFeatures.all, source.content, source.loc.start.offset, `(`, `)`);
|
||||
yield `!)`; // #3102
|
||||
}
|
||||
|
||||
+2
-1
@@ -38,6 +38,7 @@ const CompilerDOM = __importStar(require("@vue/compiler-dom"));
|
||||
const muggle_string_1 = require("muggle-string");
|
||||
const collectBindings_1 = require("../../utils/collectBindings");
|
||||
const codeFeatures_1 = require("../codeFeatures");
|
||||
const names_1 = require("../names");
|
||||
const utils_1 = require("../utils");
|
||||
const boundary_1 = require("../utils/boundary");
|
||||
const interpolation_1 = require("./interpolation");
|
||||
@@ -125,7 +126,7 @@ function* generateSlotParameters(options, ctx, ast, exp, slotVar) {
|
||||
}
|
||||
yield `const [`;
|
||||
yield* interpolation;
|
||||
yield `] = __VLS_vSlot(${slotVar}!`;
|
||||
yield `] = ${names_1.names.vSlot}(${slotVar}!`;
|
||||
if (types.some(t => t)) {
|
||||
yield `, `;
|
||||
const token = yield* (0, boundary_1.startBoundary)('template', exp.loc.start.offset, codeFeatures_1.codeFeatures.verification);
|
||||
|
||||
+2
-2
@@ -33,8 +33,6 @@ const plugin = ({ vueCompilerOptions }) => {
|
||||
.replace(frontmatterReg, match => ' '.repeat(match.length))
|
||||
// code block
|
||||
.replace(codeblockReg, (match, quotes) => quotes + ' '.repeat(match.length - quotes.length * 2) + quotes)
|
||||
// inline code block
|
||||
.replace(inlineCodeblockReg, match => `\`${' '.repeat(match.length - 2)}\``)
|
||||
// latex block
|
||||
.replace(latexBlockReg, (match, quotes) => quotes + ' '.repeat(match.length - quotes.length * 2) + quotes)
|
||||
// # \<script setup>
|
||||
@@ -50,6 +48,8 @@ const plugin = ({ vueCompilerOptions }) => {
|
||||
+ content.slice(match.index + matchText.length);
|
||||
}
|
||||
content = content
|
||||
// inline code block
|
||||
.replace(inlineCodeblockReg, match => `\`${' '.repeat(match.length - 2)}\``)
|
||||
// angle bracket: <http://foo.com>
|
||||
.replace(angleBracketReg, match => ' '.repeat(match.length))
|
||||
// [foo](http://foo.com)
|
||||
|
||||
+5
-22
@@ -206,28 +206,11 @@ function useCodegen(ts, vueCompilerOptions, fileName, sfc) {
|
||||
if (!allVars.size) {
|
||||
return allVars;
|
||||
}
|
||||
const exposedNames = new Set();
|
||||
const generatedTemplate = getGeneratedTemplate();
|
||||
const generatedStyle = getGeneratedStyle();
|
||||
for (const [name] of generatedTemplate?.componentAccessMap ?? []) {
|
||||
if (allVars.has(name)) {
|
||||
exposedNames.add(name);
|
||||
}
|
||||
}
|
||||
for (const [name] of generatedStyle?.componentAccessMap ?? []) {
|
||||
if (allVars.has(name)) {
|
||||
exposedNames.add(name);
|
||||
}
|
||||
}
|
||||
for (const component of sfc.template?.ast?.components ?? []) {
|
||||
const testNames = new Set([(0, shared_1.camelize)(component), (0, shared_1.capitalize)((0, shared_1.camelize)(component))]);
|
||||
for (const testName of testNames) {
|
||||
if (allVars.has(testName)) {
|
||||
exposedNames.add(testName);
|
||||
}
|
||||
}
|
||||
}
|
||||
return exposedNames;
|
||||
return new Set([
|
||||
...getGeneratedTemplate()?.componentAccessMap.keys() ?? [],
|
||||
...getGeneratedStyle()?.componentAccessMap.keys() ?? [],
|
||||
...sfc.template?.ast?.components.flatMap(name => [(0, shared_1.camelize)(name), (0, shared_1.capitalize)((0, shared_1.camelize)(name))]) ?? [],
|
||||
].filter(name => allVars.has(name)));
|
||||
});
|
||||
const getGeneratedScript = (0, alien_signals_1.computed)(() => {
|
||||
return (0, script_1.generateScript)({
|
||||
|
||||
Reference in New Issue
Block a user