@volar/vue-language-core
Advanced tools
Comparing version 1.3.6 to 1.3.7
@@ -398,3 +398,3 @@ "use strict"; | ||
if (generateFunctionType) { | ||
codeGen.push(`return {} as Omit<JSX.Element, 'props' | 'children'> & Omit<InstanceType<typeof __VLS_publicComponent>, '$slots' | '$emit'>`); | ||
codeGen.push(`return {} as Omit<import('./__VLS_types.js').Element, 'props' | 'children'> & Omit<InstanceType<typeof __VLS_publicComponent>, '$slots' | '$emit'>`); | ||
codeGen.push(` & {\n`); | ||
@@ -580,2 +580,3 @@ if (scriptSetupRanges.propsTypeArg) { | ||
const useGlobalThisTypeInCtx = fileName.endsWith('.html'); | ||
codeGen.push(`let __VLS_any: any;\n`); | ||
codeGen.push(`let __VLS_ctx!: ${useGlobalThisTypeInCtx ? 'typeof globalThis &' : ''}`); | ||
@@ -582,0 +583,0 @@ if (sfc.scriptSetup) { |
import { Segment } from '@volar/source-map'; | ||
import { FileRangeCapabilities } from '@volar/language-core'; | ||
import * as CompilerDOM from '@vue/compiler-dom'; | ||
import type * as ts from 'typescript/lib/tsserverlibrary'; | ||
import { VueCompilerOptions } from '../types'; | ||
export declare function generate(ts: typeof import('typescript/lib/tsserverlibrary'), compilerOptions: ts.CompilerOptions, vueCompilerOptions: VueCompilerOptions, sourceTemplate: string, sourceLang: string, templateAst: CompilerDOM.RootNode, hasScriptSetup: boolean, cssScopedClasses?: string[]): { | ||
export declare function generate(ts: typeof import('typescript/lib/tsserverlibrary'), vueCompilerOptions: VueCompilerOptions, sourceTemplate: string, sourceLang: string, templateAst: CompilerDOM.RootNode, hasScriptSetup: boolean, cssScopedClasses?: string[]): { | ||
codeGen: Segment<FileRangeCapabilities>[]; | ||
@@ -8,0 +7,0 @@ formatCodeGen: Segment<FileRangeCapabilities>[]; |
@@ -122,6 +122,10 @@ "use strict"; | ||
else if (node.type === 4 /* CompilerDOM.NodeTypes.SIMPLE_EXPRESSION */) { | ||
if (withinChangeRange(node.loc) && node.isStatic) { // TODO: review this (slot name?) | ||
return false; | ||
if (withinChangeRange(node.loc)) { // TODO: review this (slot name?) | ||
if (node.isStatic) { | ||
return false; | ||
} | ||
else { | ||
node.content = node.loc.source; | ||
} | ||
} | ||
node.content = node.loc.source; | ||
} | ||
@@ -128,0 +132,0 @@ return true; |
@@ -120,3 +120,3 @@ "use strict"; | ||
return; | ||
return templateGen.generate(ts, compilerOptions, vueCompilerOptions, _sfc.template?.content ?? '', _sfc.template?.lang ?? 'html', templateAst, !!_sfc.scriptSetup, Object.values(cssScopedClasses.value).map(style => style.classNames).flat()); | ||
return templateGen.generate(ts, vueCompilerOptions, _sfc.template?.content ?? '', _sfc.template?.lang ?? 'html', templateAst, !!_sfc.scriptSetup, Object.values(cssScopedClasses.value).map(style => style.classNames).flat()); | ||
}); | ||
@@ -123,0 +123,0 @@ const tsxGen = (0, reactivity_1.computed)(() => (0, script_1.generate)(ts, fileName, _sfc, lang.value, scriptRanges.value, scriptSetupRanges.value, cssVars.value, cssModuleClasses.value, cssScopedClasses.value, htmlGen.value, compilerOptions, vueCompilerOptions)); |
@@ -32,3 +32,2 @@ import * as embedded from '@volar/language-core'; | ||
hooks: string[]; | ||
narrowingTypesInInlineHandlers: boolean; | ||
experimentalResolveStyleCssClasses: 'scoped' | 'always' | 'never'; | ||
@@ -35,0 +34,0 @@ experimentalModelPropName: Record<string, Record<string, boolean | Record<string, string> | Record<string, string>[]>>; |
@@ -19,3 +19,7 @@ "use strict"; | ||
} from '${libName}'; | ||
${vueCompilerOptions.target >= 3.3 ? `import { JSX } from 'vue/jsx-runtime';` : ''} | ||
export type IntrinsicElements = JSX.IntrinsicElements; | ||
export type Element = JSX.Element; | ||
type IsAny<T> = boolean extends (T extends never ? true : false) ? true : false; | ||
@@ -61,4 +65,5 @@ export type PickNotAny<A, B> = IsAny<A> extends true ? B : A; | ||
IsAny<T> extends true ? Record<string, any> | ||
: T extends { ${slots}?: infer S } ? { [K in keyof S]-?: S[K] extends ((obj: infer O) => any) | undefined ? O : any } | ||
: T extends { children?: infer S } ? { [K in keyof S]-?: S[K] extends ((obj: infer O) => any) | undefined ? O : any } | ||
: T extends { ${slots}?: infer S } ? S | ||
: T extends { children?: infer S } ? S | ||
: T extends { [K in keyof PickNotAny<JSX.ElementChildrenAttribute, {}>]?: infer S } ? S | ||
: Record<string, any>; | ||
@@ -113,11 +118,11 @@ | ||
${vueCompilerOptions.strictTemplates ? '{}' : '{ [K in N0]: any }'}; | ||
export type ComponentProps<T> = | ||
export type asFunctionalComponent<T> = | ||
${vueCompilerOptions.strictTemplates ? '' : 'Record<string, unknown> &'} | ||
( | ||
T extends new (...args: any) => { $props: infer Props } ? Props | ||
: T extends (props: infer Props, ...args: any) => any ? Props | ||
: T extends (...args: any) => { props: infer Props } ? Props | ||
: T extends new (...args: any) => any ? {} | ||
: T extends (...args: any) => any ? {} | ||
: T // IntrinsicElement | ||
T extends new (...args: any) => { $props: infer Props } ? (_: Props) => any | ||
: T extends (props: infer Props, ...args: any) => any ? T | ||
: T extends (...args: any) => { props: infer Props } ? (_: Props) => any | ||
: T extends new (...args: any) => any ? (_: {}) => any | ||
: T extends (...args: any) => any ? (_: {}) => any | ||
: (_: T) => any // IntrinsicElement | ||
); | ||
@@ -134,4 +139,2 @@ export type InstanceProps<I, C> = I extends { $props: infer Props } ? Props & Record<string, unknown> : C & Record<string, unknown>; | ||
}; | ||
type IntrinsicElements = JSX.IntrinsicElements; | ||
`.trim(); | ||
@@ -138,0 +141,0 @@ } |
@@ -188,3 +188,2 @@ "use strict"; | ||
}, | ||
narrowingTypesInInlineHandlers: vueOptions.narrowingTypesInInlineHandlers ?? false, | ||
plugins: vueOptions.plugins ?? [], | ||
@@ -191,0 +190,0 @@ hooks: vueOptions.hooks ?? [], |
{ | ||
"name": "@volar/vue-language-core", | ||
"version": "1.3.6", | ||
"version": "1.3.7", | ||
"main": "out/index.js", | ||
@@ -16,4 +16,4 @@ "license": "MIT", | ||
"dependencies": { | ||
"@volar/language-core": "1.4.0-alpha.4", | ||
"@volar/source-map": "1.4.0-alpha.4", | ||
"@volar/language-core": "1.4.0-alpha.5", | ||
"@volar/source-map": "1.4.0-alpha.5", | ||
"@vue/compiler-dom": "^3.2.47", | ||
@@ -30,3 +30,3 @@ "@vue/compiler-sfc": "^3.2.47", | ||
}, | ||
"gitHead": "b2bb45f91fa262128b75ba92a2c64f5aedb5d875" | ||
"gitHead": "7ce8724a60d8cd2c5b952048c9146e1d20d6ae50" | ||
} |
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
232440
56
5208
+ Added@volar/language-core@1.4.0-alpha.5(transitive)
+ Added@volar/source-map@1.4.0-alpha.5(transitive)
- Removed@volar/language-core@1.4.0-alpha.4(transitive)
- Removed@volar/source-map@1.4.0-alpha.4(transitive)