@volar/vue-language-core
Advanced tools
Comparing version 1.3.19 to 1.4.0
@@ -13,4 +13,3 @@ import { Segment } from '@volar/source-map'; | ||
codes: Segment<FileRangeCapabilities>[]; | ||
extraMappings: SourceMaps.Mapping<any>[]; | ||
mirrorBehaviorMappings: SourceMaps.Mapping<[MirrorBehaviorCapabilities, MirrorBehaviorCapabilities]>[]; | ||
}; |
@@ -61,2 +61,5 @@ "use strict"; | ||
} | ||
else { | ||
codes.push('/** __vue_virtual_code_placeholder */\n'); | ||
} | ||
let generatedTemplate = false; | ||
@@ -81,22 +84,4 @@ generateSrc(); | ||
} | ||
// fix https://github.com/johnsoncodehk/volar/issues/1048 | ||
// fix https://github.com/johnsoncodehk/volar/issues/435 | ||
const text = (0, source_map_1.toString)(codes); | ||
const start = text.length - text.trimStart().length; | ||
const end = text.trimEnd().length; | ||
const extraMappings = [ | ||
{ | ||
sourceRange: [0, 0], | ||
generatedRange: [start, start], | ||
data: {}, | ||
}, | ||
{ | ||
sourceRange: [0, 0], | ||
generatedRange: [end, end], | ||
data: {}, | ||
}, | ||
]; | ||
return { | ||
codes, | ||
extraMappings, | ||
mirrorBehaviorMappings, | ||
@@ -199,9 +184,2 @@ }; | ||
if (!!sfc.scriptSetup && scriptRanges?.exportDefault) { | ||
// fix https://github.com/johnsoncodehk/volar/issues/1127 | ||
codes.push([ | ||
'', | ||
'scriptSetup', | ||
0, | ||
{ diagnostic: true }, | ||
]); | ||
addVirtualCode('script', 0, scriptRanges.exportDefault.expression.start); | ||
@@ -245,12 +223,2 @@ } | ||
} | ||
function generateExportDefault() { | ||
// fix https://github.com/johnsoncodehk/volar/issues/1127 | ||
codes.push([ | ||
'', | ||
'scriptSetup', | ||
0, | ||
{ diagnostic: true }, | ||
]); | ||
codes.push('export default '); | ||
} | ||
function generateExportDefaultEndMapping() { | ||
@@ -277,3 +245,3 @@ if (!sfc.scriptSetup) { | ||
if (!scriptRanges?.exportDefault) { | ||
generateExportDefault(); | ||
codes.push('export default '); | ||
} | ||
@@ -411,3 +379,3 @@ codes.push(`(<`); | ||
if (!scriptRanges?.exportDefault) { | ||
generateExportDefault(); | ||
codes.push('export default '); | ||
} | ||
@@ -418,5 +386,2 @@ codes.push('(() => {\n'); | ||
} | ||
if (scriptRanges?.exportDefault && scriptRanges.exportDefault.expression.end !== scriptRanges.exportDefault.end) { | ||
addVirtualCode('script', scriptRanges.exportDefault.expression.end, scriptRanges.exportDefault.end); | ||
} | ||
generateExportDefaultEndMapping(); | ||
@@ -604,3 +569,3 @@ if (scriptSetupGeneratedOffset !== undefined) { | ||
else if (mode === 'export') { | ||
generateExportDefault(); | ||
codes.push('export default '); | ||
} | ||
@@ -607,0 +572,0 @@ if (mode === 'return' || mode === 'export') { |
@@ -5,6 +5,7 @@ import { Segment } from '@volar/source-map'; | ||
import { VueCompilerOptions } from '../types'; | ||
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[]): { | ||
codes: Segment<FileRangeCapabilities>[]; | ||
formatCodes: Segment<FileRangeCapabilities>[]; | ||
cssCodes: Segment<FileRangeCapabilities>[]; | ||
codes: Code[]; | ||
formatCodes: Code[]; | ||
cssCodes: Code[]; | ||
tagNames: Record<string, number[]>; | ||
@@ -15,2 +16,2 @@ identifiers: Set<string>; | ||
export declare function walkElementNodes(node: CompilerDOM.RootNode | CompilerDOM.TemplateChildNode, cb: (node: CompilerDOM.ElementNode) => void): void; | ||
export declare function getPatchForSlotNode(node: CompilerDOM.ElementNode): CompilerDOM.ForNode | undefined; | ||
export {}; |
@@ -43,3 +43,2 @@ "use strict"; | ||
embeddedFile.content = [...tsx.codes]; | ||
embeddedFile.extraMappings = [...tsx.extraMappings]; | ||
embeddedFile.mirrorBehaviorMappings = [...tsx.mirrorBehaviorMappings]; | ||
@@ -46,0 +45,0 @@ } |
@@ -14,3 +14,2 @@ import { FileCapabilities, VirtualFile, FileKind, FileRangeCapabilities, MirrorBehaviorCapabilities } from '@volar/language-core'; | ||
content: Segment<FileRangeCapabilities>[]; | ||
extraMappings: Mapping<FileRangeCapabilities>[]; | ||
mirrorBehaviorMappings: Mapping<[MirrorBehaviorCapabilities, MirrorBehaviorCapabilities]>[]; | ||
@@ -17,0 +16,0 @@ constructor(fileName: string); |
@@ -14,3 +14,2 @@ "use strict"; | ||
this.content = []; | ||
this.extraMappings = []; | ||
this.mirrorBehaviorMappings = []; | ||
@@ -201,3 +200,3 @@ } | ||
const file = _file.value; | ||
const mappings = [...(0, source_map_1.buildMappings)(file.content), ...file.extraMappings]; | ||
const mappings = (0, source_map_1.buildMappings)(file.content); | ||
for (const mapping of mappings) { | ||
@@ -204,0 +203,0 @@ if (mapping.source !== undefined) { |
@@ -9,2 +9,3 @@ "use strict"; | ||
return ` | ||
// @ts-nocheck | ||
import type { | ||
@@ -48,2 +49,4 @@ ObjectDirective, | ||
export declare function getVForSourceType<T>(source: T): ForableSource<NonNullable<T extends number ? number[] : T extends string ? string[] : T>>; | ||
export declare function getSlotParams<T>(slot: T): Parameters<NonNullable<T>>; | ||
export declare function getSlotParam<T>(slot: T): Parameters<NonNullable<T>>[0]; | ||
export declare function directiveFunction<T>(dir: T): | ||
@@ -89,3 +92,3 @@ T extends ObjectDirective<infer E, infer V> ? undefined extends V ? (value?: V) => void : (value: V) => void | ||
? (props: Props, ctx?: { attrs?: any, expose?(exposed: K): void, slots?: Slots, emit?: Emit }) => JSX.Element & { __ctx?: typeof ctx, __props?: typeof props } | ||
: (_: T, ctx?: any) => { __ctx?: { attrs?: undefined, expose?: undefined, slots?: undefined, emit?: undefined }, __props?: T }; // IntrinsicElement | ||
: (_: T & Record<string, unknown>, ctx?: any) => { __ctx?: { attrs?: undefined, expose?: undefined, slots?: undefined, emit?: undefined }, __props?: T & Record<string, unknown> }; // IntrinsicElement | ||
export declare function pickEvent<Emit, K, E>(emit: Emit, emitKey: K, event: E): FillingEventArg< | ||
@@ -92,0 +95,0 @@ PickNotAny< |
{ | ||
"name": "@volar/vue-language-core", | ||
"version": "1.3.19", | ||
"version": "1.4.0", | ||
"main": "out/index.js", | ||
@@ -16,4 +16,4 @@ "license": "MIT", | ||
"dependencies": { | ||
"@volar/language-core": "1.4.0-alpha.12", | ||
"@volar/source-map": "1.4.0-alpha.12", | ||
"@volar/language-core": "1.4.0", | ||
"@volar/source-map": "1.4.0", | ||
"@vue/compiler-dom": "^3.2.0", | ||
@@ -30,3 +30,3 @@ "@vue/compiler-sfc": "^3.2.0", | ||
}, | ||
"gitHead": "61cc61b4b91e060f900fb04d2b4208ab330bdcf3" | ||
"gitHead": "5a9f46db24151563e0b4f324c20d60561d82097d" | ||
} |
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
232919
5155
+ Added@volar/language-core@1.4.0(transitive)
+ Added@volar/source-map@1.4.0(transitive)
- Removed@volar/language-core@1.4.0-alpha.12(transitive)
- Removed@volar/source-map@1.4.0-alpha.12(transitive)
Updated@volar/language-core@1.4.0
Updated@volar/source-map@1.4.0