@volar/vue-language-core
Advanced tools
Comparing version 1.6.0 to 1.6.1
@@ -11,5 +11,5 @@ import { Segment } from '@volar/source-map'; | ||
import type { VueCompilerOptions } from '../types'; | ||
export declare function generate(ts: typeof import('typescript/lib/tsserverlibrary'), fileName: string, _sfc: Sfc, lang: string, scriptRanges: ScriptRanges | undefined, scriptSetupRanges: ScriptSetupRanges | undefined, cssVars: ReturnType<typeof collectCssVars>, cssModuleClasses: ReturnType<typeof collectStyleCssClasses>, cssScopedClasses: ReturnType<typeof collectStyleCssClasses>, htmlGen: ReturnType<typeof templateGen['generate']> | undefined, compilerOptions: ts.CompilerOptions, vueCompilerOptions: VueCompilerOptions, codes?: Segment<FileRangeCapabilities>[], mirrorBehaviorMappings?: SourceMaps.Mapping<[MirrorBehaviorCapabilities, MirrorBehaviorCapabilities]>[]): { | ||
export declare function generate(ts: typeof import('typescript/lib/tsserverlibrary'), fileName: string, _sfc: Sfc, lang: string, scriptRanges: ScriptRanges | undefined, scriptSetupRanges: ScriptSetupRanges | undefined, cssVars: ReturnType<typeof collectCssVars>, cssModuleClasses: ReturnType<typeof collectStyleCssClasses>, cssScopedClasses: ReturnType<typeof collectStyleCssClasses>, htmlGen: ReturnType<typeof templateGen['generate']> | undefined, compilerOptions: ts.CompilerOptions, vueCompilerOptions: VueCompilerOptions, sharedTypesImport: string): { | ||
codes: Segment<FileRangeCapabilities>[]; | ||
mirrorBehaviorMappings: SourceMaps.Mapping<[MirrorBehaviorCapabilities, MirrorBehaviorCapabilities]>[]; | ||
}; |
@@ -10,5 +10,7 @@ "use strict"; | ||
const transform_1 = require("../utils/transform"); | ||
const localTypes_1 = require("../utils/localTypes"); | ||
const sharedTypes = require("../utils/directorySharedTypes"); | ||
const muggle = require("muggle-string"); | ||
function generate(ts, fileName, _sfc, lang, scriptRanges, scriptSetupRanges, cssVars, cssModuleClasses, cssScopedClasses, htmlGen, compilerOptions, vueCompilerOptions, codes = [], mirrorBehaviorMappings = []) { | ||
function generate(ts, fileName, _sfc, lang, scriptRanges, scriptSetupRanges, cssVars, cssModuleClasses, cssScopedClasses, htmlGen, compilerOptions, vueCompilerOptions, sharedTypesImport) { | ||
const codes = []; | ||
const mirrorBehaviorMappings = []; | ||
//#region monkey fix: https://github.com/johnsoncodehk/volar/pull/2113 | ||
@@ -50,3 +52,2 @@ const sfc = { | ||
const bypassDefineComponent = lang === 'js' || lang === 'jsx'; | ||
const vueLibName = (0, shared_2.getVueLibraryName)(vueCompilerOptions.target); | ||
const usedHelperTypes = { | ||
@@ -88,7 +89,7 @@ DefinePropsToOptions: false, | ||
if (compilerOptions.exactOptionalPropertyTypes) { | ||
codes.push(`type __VLS_TypePropsToRuntimeProps<T> = { [K in keyof T]-?: {} extends Pick<T, K> ? { type: import('${vueLibName}').PropType<T[K]> } : { type: import('${vueLibName}').PropType<T[K]>, required: true } };\n`); | ||
codes.push(`type __VLS_TypePropsToRuntimeProps<T> = { [K in keyof T]-?: {} extends Pick<T, K> ? { type: import('${vueCompilerOptions.lib}').PropType<T[K]> } : { type: import('${vueCompilerOptions.lib}').PropType<T[K]>, required: true } };\n`); | ||
} | ||
else { | ||
codes.push(`type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;\n`); | ||
codes.push(`type __VLS_TypePropsToRuntimeProps<T> = { [K in keyof T]-?: {} extends Pick<T, K> ? { type: import('${vueLibName}').PropType<__VLS_NonUndefinedable<T[K]>> } : { type: import('${vueLibName}').PropType<T[K]>, required: true } };\n`); | ||
codes.push(`type __VLS_TypePropsToRuntimeProps<T> = { [K in keyof T]-?: {} extends Pick<T, K> ? { type: import('${vueCompilerOptions.lib}').PropType<__VLS_NonUndefinedable<T[K]>> } : { type: import('${vueCompilerOptions.lib}').PropType<T[K]>, required: true } };\n`); | ||
} | ||
@@ -110,6 +111,6 @@ } | ||
if (scriptSetupRanges && scriptSetupRanges.emitsTypeNums !== -1) { | ||
codes.push((0, localTypes_1.genConstructorOverloads)('__VLS_ConstructorOverloads', scriptSetupRanges.emitsTypeNums)); | ||
codes.push(sharedTypes.genConstructorOverloads('__VLS_ConstructorOverloads', scriptSetupRanges.emitsTypeNums)); | ||
} | ||
else { | ||
codes.push((0, localTypes_1.genConstructorOverloads)('__VLS_ConstructorOverloads')); | ||
codes.push(sharedTypes.genConstructorOverloads('__VLS_ConstructorOverloads')); | ||
} | ||
@@ -274,3 +275,3 @@ } | ||
codes.push('(\n'); | ||
codes.push(`__VLS_props: typeof __VLS_setup['props'] & import('vue').VNodeProps,\n`); | ||
codes.push(`__VLS_props: typeof __VLS_setup['props']`, `& import('${vueCompilerOptions.lib}').VNodeProps`, `& import('${vueCompilerOptions.lib}').AllowedComponentProps`, `& import('${vueCompilerOptions.lib}').ComponentCustomProps,\n`); | ||
codes.push(`__VLS_ctx?: Pick<typeof __VLS_setup, 'attrs' | 'emit' | 'slots'>,\n`); | ||
@@ -370,3 +371,3 @@ codes.push('__VLS_setup = (() => {\n'); | ||
else if (scriptSetupRanges.emitsRuntimeArg) { | ||
codes.push(`(await import('vue')).defineEmits(`); | ||
codes.push(`defineEmits(`); | ||
addExtraReferenceVirtualCode('scriptSetup', scriptSetupRanges.emitsRuntimeArg.start, scriptSetupRanges.emitsRuntimeArg.end); | ||
@@ -387,3 +388,3 @@ codes.push(');\n'); | ||
codes.push('})(),\n'); | ||
codes.push(') => ({} as import("vue").VNode & { __ctx?: typeof __VLS_setup }))'); | ||
codes.push(`) => ({} as import('${vueCompilerOptions.lib}').VNode & { __ctx?: typeof __VLS_setup }))`); | ||
} | ||
@@ -430,9 +431,9 @@ else if (!sfc.script) { | ||
if (vueCompilerOptions.target >= 3.3) { | ||
codes.push(`const { defineProps, defineEmits, defineExpose, defineOptions, defineSlots, defineModel, withDefaults } = await import('vue');\n`); | ||
codes.push(`const { defineProps, defineEmits, defineExpose, defineOptions, defineSlots, defineModel, withDefaults } = await import('${vueCompilerOptions.lib}');\n`); | ||
} | ||
if (definePropProposalA) { | ||
codes.push(` | ||
declare function defineProp<T>(name: string, options: { required: true } & Record<string, unknown>): import('vue').ComputedRef<T>; | ||
declare function defineProp<T>(name: string, options: { default: any } & Record<string, unknown>): import('vue').ComputedRef<T>; | ||
declare function defineProp<T>(name?: string, options?: any): import('vue').ComputedRef<T | undefined>; | ||
declare function defineProp<T>(name: string, options: { required: true } & Record<string, unknown>): import('${vueCompilerOptions.lib}').ComputedRef<T>; | ||
declare function defineProp<T>(name: string, options: { default: any } & Record<string, unknown>): import('${vueCompilerOptions.lib}').ComputedRef<T>; | ||
declare function defineProp<T>(name?: string, options?: any): import('${vueCompilerOptions.lib}').ComputedRef<T | undefined>; | ||
`.trim() + '\n'); | ||
@@ -442,5 +443,5 @@ } | ||
codes.push(` | ||
declare function defineProp<T>(value: T | (() => T), required?: boolean, rest?: any): import('vue').ComputedRef<T>; | ||
declare function defineProp<T>(value: T | (() => T) | undefined, required: true, rest?: any): import('vue').ComputedRef<T>; | ||
declare function defineProp<T>(value?: T | (() => T), required?: boolean, rest?: any): import('vue').ComputedRef<T | undefined>; | ||
declare function defineProp<T>(value: T | (() => T), required?: boolean, rest?: any): import('${vueCompilerOptions.lib}').ComputedRef<T>; | ||
declare function defineProp<T>(value: T | (() => T) | undefined, required: true, rest?: any): import('${vueCompilerOptions.lib}').ComputedRef<T>; | ||
declare function defineProp<T>(value?: T | (() => T), required?: boolean, rest?: any): import('${vueCompilerOptions.lib}').ComputedRef<T | undefined>; | ||
`.trim() + '\n'); | ||
@@ -463,3 +464,3 @@ } | ||
else { | ||
codes.push(`const __VLS_publicComponent = (await import('${vueLibName}')).defineComponent({\n`); | ||
codes.push(`const __VLS_publicComponent = (await import('${vueCompilerOptions.lib}')).defineComponent({\n`); | ||
} | ||
@@ -492,6 +493,6 @@ if (scriptSetupRanges.defineProp.length) { | ||
if (defineProp.required) { | ||
codes.push(`{ required: true, type: import('vue').PropType<${type}> },\n`); | ||
codes.push(`{ required: true, type: import('${vueCompilerOptions.lib}').PropType<${type}> },\n`); | ||
} | ||
else { | ||
codes.push(`import('vue').PropType<${type}>,\n`); | ||
codes.push(`import('${vueCompilerOptions.lib}').PropType<${type}>,\n`); | ||
} | ||
@@ -547,3 +548,3 @@ } | ||
// NOTE: defineProps is inaccurate for $props | ||
codes.push(`$props: (await import('./__VLS_types.d.ts')).makeOptional(defineProps<`); | ||
codes.push(`$props: (await import('${sharedTypesImport}')).makeOptional(defineProps<`); | ||
addExtraReferenceVirtualCode('scriptSetup', scriptSetupRanges.propsTypeArg.start, scriptSetupRanges.propsTypeArg.end); | ||
@@ -554,3 +555,3 @@ codes.push(`>()),\n`); | ||
// NOTE: defineProps is inaccurate for $props | ||
codes.push(`$props: (await import('./__VLS_types.d.ts')).makeOptional(defineProps(`); | ||
codes.push(`$props: (await import('${sharedTypesImport}')).makeOptional(defineProps(`); | ||
addExtraReferenceVirtualCode('scriptSetup', scriptSetupRanges.propsRuntimeArg.start, scriptSetupRanges.propsRuntimeArg.end); | ||
@@ -634,3 +635,3 @@ codes.push(`)),\n`); | ||
if (sfc.scriptSetup && scriptSetupRanges) { | ||
codes.push(`const __VLS_internalComponent = (await import('${vueLibName}')).defineComponent({\n`); | ||
codes.push(`const __VLS_internalComponent = (await import('${vueCompilerOptions.lib}')).defineComponent({\n`); | ||
codes.push(`setup() {\n`); | ||
@@ -695,3 +696,3 @@ codes.push(`return {\n`); | ||
else { | ||
codes.push(`const __VLS_internalComponent = (await import('${vueLibName}')).defineComponent({});\n`); | ||
codes.push(`const __VLS_internalComponent = (await import('${vueCompilerOptions.lib}')).defineComponent({});\n`); | ||
} | ||
@@ -738,8 +739,8 @@ } | ||
if (sfc.scriptSetup) { | ||
codes.push(`InstanceType<import('./__VLS_types.d.ts').PickNotAny<typeof __VLS_publicComponent, new () => {}>> & `); | ||
codes.push(`InstanceType<import('${sharedTypesImport}').PickNotAny<typeof __VLS_publicComponent, new () => {}>> & `); | ||
} | ||
codes.push(`InstanceType<import('./__VLS_types.d.ts').PickNotAny<typeof __VLS_internalComponent, new () => {}>> & {\n`); | ||
codes.push(`InstanceType<import('${sharedTypesImport}').PickNotAny<typeof __VLS_internalComponent, new () => {}>> & {\n`); | ||
/* CSS Module */ | ||
for (const cssModule of cssModuleClasses) { | ||
codes.push(`${cssModule.style.module}: Record<string, string> & import('./__VLS_types.d.ts').Prettify<{}`); | ||
codes.push(`${cssModule.style.module}: Record<string, string> & import('${sharedTypesImport}').Prettify<{}`); | ||
for (const classNameRange of cssModule.classNameRanges) { | ||
@@ -754,4 +755,4 @@ generateCssClassProperty(cssModule.index, cssModule.style.content.substring(classNameRange.start + 1, classNameRange.end), classNameRange, 'string', false); | ||
codes.push(`let __VLS_localComponents!: NonNullable<typeof __VLS_internalComponent extends { components: infer C } ? C : {}> & typeof __VLS_componentsOption & typeof __VLS_ctx;\n`); | ||
codes.push(`let __VLS_otherComponents!: typeof __VLS_localComponents & import('./__VLS_types.d.ts').GlobalComponents;\n`); | ||
codes.push(`let __VLS_own!: import('./__VLS_types.d.ts').SelfComponent<typeof __VLS_name, typeof __VLS_internalComponent & typeof __VLS_publicComponent & (new () => { ${(0, shared_2.getSlotsPropertyName)(vueCompilerOptions.target)}: typeof __VLS_slots })>;\n`); | ||
codes.push(`let __VLS_otherComponents!: typeof __VLS_localComponents & import('${sharedTypesImport}').GlobalComponents;\n`); | ||
codes.push(`let __VLS_own!: import('${sharedTypesImport}').SelfComponent<typeof __VLS_name, typeof __VLS_internalComponent & typeof __VLS_publicComponent & (new () => { ${(0, shared_2.getSlotsPropertyName)(vueCompilerOptions.target)}: typeof __VLS_slots })>;\n`); | ||
codes.push(`let __VLS_components!: typeof __VLS_otherComponents & Omit<typeof __VLS_own, keyof typeof __VLS_otherComponents>;\n`); | ||
@@ -758,0 +759,0 @@ /* Style Scoped */ |
@@ -6,3 +6,3 @@ import { Segment } from '@volar/source-map'; | ||
type Code = Segment<FileRangeCapabilities>; | ||
export declare function generate(ts: typeof import('typescript/lib/tsserverlibrary'), vueCompilerOptions: VueCompilerOptions, sourceTemplate: string, sourceLang: string, templateAst: CompilerDOM.RootNode, hasScriptSetupSlots: boolean, cssScopedClasses?: string[]): { | ||
export declare function generate(ts: typeof import('typescript/lib/tsserverlibrary'), vueCompilerOptions: VueCompilerOptions, sourceTemplate: string, sourceLang: string, templateAst: CompilerDOM.RootNode, hasScriptSetupSlots: boolean, sharedTypesImport: string, cssScopedClasses?: string[]): { | ||
codes: Code[]; | ||
@@ -9,0 +9,0 @@ formatCodes: Code[]; |
export * from './generators/template'; | ||
export * from './languageModule'; | ||
export * as scriptRanges from './parsers/scriptRanges'; | ||
export * from './parsers/scriptSetupRanges'; | ||
@@ -8,6 +7,7 @@ export * from './plugins'; | ||
export * from './types'; | ||
export * as localTypes from './utils/localTypes'; | ||
export * from './utils/ts'; | ||
export * from './utils/parseSfc'; | ||
export * as scriptRanges from './parsers/scriptRanges'; | ||
export * as sharedTypes from './utils/directorySharedTypes'; | ||
export * from '@volar/language-core'; | ||
export * from '@volar/source-map'; |
@@ -17,6 +17,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.localTypes = exports.scriptRanges = void 0; | ||
exports.sharedTypes = exports.scriptRanges = void 0; | ||
__exportStar(require("./generators/template"), exports); | ||
__exportStar(require("./languageModule"), exports); | ||
exports.scriptRanges = require("./parsers/scriptRanges"); | ||
__exportStar(require("./parsers/scriptSetupRanges"), exports); | ||
@@ -26,7 +25,8 @@ __exportStar(require("./plugins"), exports); | ||
__exportStar(require("./types"), exports); | ||
exports.localTypes = require("./utils/localTypes"); | ||
__exportStar(require("./utils/ts"), exports); | ||
__exportStar(require("./utils/parseSfc"), exports); | ||
exports.scriptRanges = require("./parsers/scriptRanges"); | ||
exports.sharedTypes = require("./utils/directorySharedTypes"); | ||
__exportStar(require("@volar/language-core"), exports); | ||
__exportStar(require("@volar/source-map"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -7,7 +7,7 @@ "use strict"; | ||
const sourceFile_1 = require("./sourceFile"); | ||
const localTypes = require("./utils/localTypes"); | ||
const sharedTypes = require("./utils/directorySharedTypes"); | ||
function createLanguageModules(ts, compilerOptions, vueCompilerOptions) { | ||
patchResolveModuleNames(ts, vueCompilerOptions); | ||
const vueLanguagePlugin = (0, plugins_1.getDefaultVueLanguagePlugins)(ts, compilerOptions, vueCompilerOptions); | ||
const sharedTypesSnapshot = ts.ScriptSnapshot.fromString(localTypes.getTypesCode(vueCompilerOptions.target, vueCompilerOptions)); | ||
const sharedTypesSnapshot = ts.ScriptSnapshot.fromString(sharedTypes.getTypesCode(vueCompilerOptions)); | ||
const languageModule = { | ||
@@ -28,3 +28,3 @@ createFile(fileName, snapshot, languageId) { | ||
const basename = path_1.posix.basename(fileName); | ||
if (basename === localTypes.typesFileName) { | ||
if (basename === sharedTypes.baseName) { | ||
return true; | ||
@@ -43,3 +43,3 @@ } | ||
const basename = path_1.posix.basename(fileName); | ||
if (basename === localTypes.typesFileName) { | ||
if (basename === sharedTypes.baseName) { | ||
return ''; | ||
@@ -51,3 +51,3 @@ } | ||
const basename = path_1.posix.basename(fileName); | ||
if (basename === localTypes.typesFileName) { | ||
if (basename === sharedTypes.baseName) { | ||
return sharedTypesSnapshot; | ||
@@ -67,3 +67,3 @@ } | ||
const moduleFileDirs = [...new Set(moduleFiles.map(path_1.posix.dirname))]; | ||
return moduleFileDirs.map(dir => path_1.posix.join(dir, localTypes.typesFileName)); | ||
return moduleFileDirs.map(dir => path_1.posix.join(dir, sharedTypes.baseName)); | ||
} | ||
@@ -70,0 +70,0 @@ } |
@@ -12,5 +12,7 @@ "use strict"; | ||
const parseCssVars_1 = require("../utils/parseCssVars"); | ||
const sharedTypes = require("../utils/directorySharedTypes"); | ||
const plugin = ({ modules, vueCompilerOptions, compilerOptions }) => { | ||
const ts = modules.typescript; | ||
const instances = new WeakMap(); | ||
const sharedTypesImport = sharedTypes.getImportName(compilerOptions); | ||
return { | ||
@@ -110,3 +112,3 @@ version: 1, | ||
return; | ||
return templateGen.generate(ts, vueCompilerOptions, _sfc.template?.content ?? '', _sfc.template?.lang ?? 'html', _sfc.templateAst, hasScriptSetupSlots.value, Object.values(cssScopedClasses.value).map(style => style.classNames).flat()); | ||
return templateGen.generate(ts, vueCompilerOptions, _sfc.template?.content ?? '', _sfc.template?.lang ?? 'html', _sfc.templateAst, hasScriptSetupSlots.value, sharedTypesImport, Object.values(cssScopedClasses.value).map(style => style.classNames).flat()); | ||
}); | ||
@@ -116,3 +118,3 @@ const hasScriptSetupSlots = (0, reactivity_1.shallowRef)(false); // remove when https://github.com/vuejs/core/pull/5912 merged | ||
hasScriptSetupSlots.value = !!scriptSetupRanges.value?.slotsTypeArg; | ||
return (0, script_1.generate)(ts, fileName, _sfc, lang.value, scriptRanges.value, scriptSetupRanges.value, cssVars.value, cssModuleClasses.value, cssScopedClasses.value, htmlGen.value, compilerOptions, vueCompilerOptions); | ||
return (0, script_1.generate)(ts, fileName, _sfc, lang.value, scriptRanges.value, scriptSetupRanges.value, cssVars.value, cssModuleClasses.value, cssScopedClasses.value, htmlGen.value, compilerOptions, vueCompilerOptions, sharedTypesImport); | ||
}); | ||
@@ -119,0 +121,0 @@ return { |
@@ -16,2 +16,3 @@ import * as embedded from '@volar/language-core'; | ||
target: number; | ||
lib: string; | ||
extensions: string[]; | ||
@@ -18,0 +19,0 @@ jsxSlots: boolean; |
import { VueCompilerOptions } from '../types'; | ||
export declare const typesFileName = "__VLS_types.d.ts"; | ||
import type * as ts from 'typescript/lib/tsserverlibrary'; | ||
export declare const baseName = "__VLS_types.d.ts"; | ||
export declare function getImportName(compilerOptions: ts.CompilerOptions): "./__VLS_types" | "./__VLS_types.js"; | ||
export declare function getTypesCode(vueVersion: number, vueCompilerOptions: VueCompilerOptions): string; | ||
export declare function genConstructorOverloads(name?: string, nums?: number): string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.genConstructorOverloads = exports.getTypesCode = exports.typesFileName = void 0; | ||
exports.genConstructorOverloads = exports.getTypesCode = exports.getImportName = exports.baseName = void 0; | ||
const shared_1 = require("./shared"); | ||
const shared_2 = require("./shared"); | ||
exports.typesFileName = '__VLS_types.d.ts'; | ||
exports.baseName = '__VLS_types.d.ts'; | ||
function getImportName(compilerOptions) { | ||
if (!compilerOptions.module || compilerOptions.module === 1) { | ||
return './__VLS_types'; | ||
} | ||
return './__VLS_types.js'; | ||
} | ||
exports.getImportName = getImportName; | ||
; | ||
function getTypesCode(vueVersion, vueCompilerOptions) { | ||
@@ -97,3 +105,3 @@ const libName = (0, shared_2.getVueLibraryName)(vueVersion); | ||
: T extends (...args: any) => any ? T | ||
: (_: T extends import('vue').VNode ? {}: T & Record<string, unknown>, ctx?: any) => { __ctx?: { attrs?: unknown, expose?: unknown, slots?: unknown, emit?: unknown, props?: T & Record<string, unknown> } }; // IntrinsicElement | ||
: (_: T extends VNode | VNode[] | string ? {}: T & Record<string, unknown>, ctx?: any) => { __ctx?: { attrs?: unknown, expose?: unknown, slots?: unknown, emit?: unknown, props?: T & Record<string, unknown> } }; // IntrinsicElement | ||
declare function functionalComponentArgsRest<T extends (...args: any) => any>(t: T): Parameters<T>['length'] extends 2 ? [any] : []; | ||
@@ -100,0 +108,0 @@ export declare function pickEvent<Emit, K, E>(emit: Emit, emitKey: K, event: E): FillingEventArg< |
export declare function getSlotsPropertyName(vueVersion: number): "$scopedSlots" | "$slots"; | ||
export declare function getVueLibraryName(vueVersion: number): "@vue/runtime-dom" | "vue"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getVueLibraryName = exports.getSlotsPropertyName = void 0; | ||
exports.getSlotsPropertyName = void 0; | ||
function getSlotsPropertyName(vueVersion) { | ||
@@ -8,6 +8,2 @@ return vueVersion < 3 ? '$scopedSlots' : '$slots'; | ||
exports.getSlotsPropertyName = getSlotsPropertyName; | ||
function getVueLibraryName(vueVersion) { | ||
return vueVersion < 2.7 ? '@vue/runtime-dom' : 'vue'; | ||
} | ||
exports.getVueLibraryName = getVueLibraryName; | ||
//# sourceMappingURL=shared.js.map |
@@ -145,2 +145,3 @@ "use strict"; | ||
const target = vueOptions.target ?? 3.3; | ||
const lib = vueOptions.lib || (target < 2.7 ? '@vue/runtime-dom' : 'vue'); | ||
return { | ||
@@ -150,2 +151,3 @@ ...vueOptions, | ||
extensions: vueOptions.extensions ?? ['.vue'], | ||
lib, | ||
jsxSlots: vueOptions.jsxSlots ?? false, | ||
@@ -157,3 +159,3 @@ strictTemplates: vueOptions.strictTemplates ?? false, | ||
optionsWrapper: vueOptions.optionsWrapper ?? (target >= 2.7 | ||
? [`(await import('vue')).defineComponent(`, `)`] | ||
? [`(await import('${lib}')).defineComponent(`, `)`] | ||
: [`(await import('vue')).default.extend(`, `)`]), | ||
@@ -160,0 +162,0 @@ macros: vueOptions.macros ?? { |
{ | ||
"name": "@volar/vue-language-core", | ||
"version": "1.6.0", | ||
"version": "1.6.1", | ||
"main": "out/index.js", | ||
@@ -29,3 +29,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "34b578e2c0fc23645b2f60e9206d91c1bd3833d0" | ||
"gitHead": "93408e358cf4e6d7ba86d0949333032a17c8d109" | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
238984
56
5236