Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@volar/vue-language-core

Package Overview
Dependencies
Maintainers
1
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@volar/vue-language-core - npm Package Compare versions

Comparing version 1.0.0-alpha.3 to 1.0.0-alpha.4

33

out/generators/script.js

@@ -8,3 +8,2 @@ Object.defineProperty(exports, "__esModule", { value: true });

const shared_2 = require("../utils/shared");
const string_1 = require("../utils/string");
const transform_1 = require("../utils/transform");

@@ -368,3 +367,3 @@ /**

function writeTemplate() {
if (!vueCompilerOptions.experimentalDisableTemplateSupport) {
if (!vueCompilerOptions.skipTemplateCodegen) {
writeExportOptions();

@@ -467,7 +466,6 @@ writeConstNameOption();

codeGen.addText(`\n`);
codeGen.addText(`const __VLS_options = {\n`);
if (sfc.script && ((_a = scriptRanges === null || scriptRanges === void 0 ? void 0 : scriptRanges.exportDefault) === null || _a === void 0 ? void 0 : _a.args)) {
const args = scriptRanges.exportDefault.args;
codeGen.addText(`...(`);
codeGen.addCode2(sfc.script.content.substring(args.start, args.end), args.start, {
codeGen.addText(`const __VLS_componentsOption = `);
if (sfc.script && ((_a = scriptRanges === null || scriptRanges === void 0 ? void 0 : scriptRanges.exportDefault) === null || _a === void 0 ? void 0 : _a.componentsOption)) {
const componentsOption = scriptRanges.exportDefault.componentsOption;
codeGen.addCode2(sfc.script.content.substring(componentsOption.start, componentsOption.end), componentsOption.start, {
vueTag: 'script',

@@ -479,5 +477,7 @@ capabilities: {

});
codeGen.addText(`),\n`);
}
codeGen.addText(`};\n`);
else {
codeGen.addText('{}');
}
codeGen.addText(`;\n`);
}

@@ -487,7 +487,7 @@ function writeConstNameOption() {

codeGen.addText(`\n`);
if (sfc.script && ((_a = scriptRanges === null || scriptRanges === void 0 ? void 0 : scriptRanges.exportDefault) === null || _a === void 0 ? void 0 : _a.args)) {
const args = scriptRanges.exportDefault.args;
codeGen.addText(`const __VLS_name = (await import('./__VLS_types.js')).getNameOption(`);
codeGen.addText(`${sfc.script.content.substring(args.start, args.end)} as const`);
codeGen.addText(`);\n`);
if (sfc.script && ((_a = scriptRanges === null || scriptRanges === void 0 ? void 0 : scriptRanges.exportDefault) === null || _a === void 0 ? void 0 : _a.nameOption)) {
const nameOption = scriptRanges.exportDefault.nameOption;
codeGen.addText(`const __VLS_name = `);
codeGen.addText(`${sfc.script.content.substring(nameOption.start, nameOption.end)} as const`);
codeGen.addText(`;\n`);
}

@@ -519,10 +519,7 @@ else if (sfc.scriptSetup) {

codeGen.addText(`};\n`);
codeGen.addText(`let __VLS_vmUnwrap!: typeof __VLS_options & { components: { } };\n`);
/* Components */
codeGen.addText('/* Components */\n');
codeGen.addText(`let __VLS_otherComponents!: NonNullable<typeof __VLS_component extends { components: infer C } ? C : {}> & import('./__VLS_types.js').GlobalComponents & typeof __VLS_vmUnwrap.components & import('./__VLS_types.js').PickComponents<typeof __VLS_ctx>;\n`);
codeGen.addText(`let __VLS_otherComponents!: NonNullable<typeof __VLS_component extends { components: infer C } ? C : {}> & import('./__VLS_types.js').GlobalComponents & typeof __VLS_componentsOption & typeof __VLS_ctx;\n`);
codeGen.addText(`let __VLS_selfComponent!: import('./__VLS_types.js').SelfComponent<typeof __VLS_name, typeof __VLS_component & (new () => { ${(0, shared_2.getSlotsPropertyName)((_a = vueCompilerOptions.target) !== null && _a !== void 0 ? _a : 3)}: typeof __VLS_slots })>;\n`);
codeGen.addText(`let __VLS_components!: typeof __VLS_otherComponents & Omit<typeof __VLS_selfComponent, keyof typeof __VLS_otherComponents>;\n`);
codeGen.addText(`__VLS_components['${string_1.SearchTexts.Components}'];\n`);
codeGen.addText(`({} as import('./__VLS_types.js').GlobalAttrs)['${string_1.SearchTexts.GlobalAttrs}'];\n`);
/* Style Scoped */

@@ -529,0 +526,0 @@ codeGen.addText('/* Style Scoped */\n');

@@ -1,2 +0,1 @@

export * from './utils/string';
export * from './sourceFile';

@@ -3,0 +2,0 @@ export * from './types';

@@ -17,3 +17,2 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {

exports._1 = exports._0 = exports.localTypes = exports.scriptSetupConvertRanges = exports.scriptRanges = void 0;
__exportStar(require("./utils/string"), exports);
__exportStar(require("./sourceFile"), exports);

@@ -20,0 +19,0 @@ __exportStar(require("./types"), exports);

@@ -22,3 +22,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

const vueCompilerOptions = (0, ts_1.resolveVueCompilerOptions)(_vueCompilerOptions);
const sharedTypesSnapshot = ts.ScriptSnapshot.fromString(localTypes.getTypesCode(vueCompilerOptions.target));
const sharedTypesSnapshot = ts.ScriptSnapshot.fromString(localTypes.getTypesCode(vueCompilerOptions.target, vueCompilerOptions));
const languageModule = {

@@ -25,0 +25,0 @@ createSourceFile(fileName, snapshot) {

@@ -5,3 +5,3 @@ import type { TextRange } from '@volar/language-core';

}
export declare function parseScriptRanges(ts: typeof import('typescript/lib/tsserverlibrary'), ast: ts.SourceFile, hasScriptSetup: boolean, withComponentOption: boolean, withNode: boolean): {
export declare function parseScriptRanges(ts: typeof import('typescript/lib/tsserverlibrary'), ast: ts.SourceFile, hasScriptSetup: boolean, withNode: boolean): {
exportDefault: (TextRange & {

@@ -13,4 +13,5 @@ expression: TextRange;

componentsOptionNode: ts.ObjectLiteralExpression | undefined;
nameOption: TextRange | undefined;
}) | undefined;
bindings: TextRange[];
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseScriptRanges = void 0;
const scriptSetupRanges_1 = require("./scriptSetupRanges");
function parseScriptRanges(ts, ast, hasScriptSetup, withComponentOption, withNode) {
function parseScriptRanges(ts, ast, hasScriptSetup, withNode) {
let exportDefault;

@@ -21,12 +21,14 @@ const bindings = hasScriptSetup ? (0, scriptSetupRanges_1.parseBindingRanges)(ts, ast, false) : [];

let componentsOptionNode;
if (withComponentOption) {
obj.forEachChild(node => {
if (ts.isPropertyAssignment(node) && ts.isIdentifier(node.name)) {
if (node.name.escapedText === 'components' && ts.isObjectLiteralExpression(node.initializer)) {
componentsOptionNode = node.initializer;
}
let nameOptionNode;
obj.forEachChild(node => {
if (ts.isPropertyAssignment(node) && ts.isIdentifier(node.name)) {
if (node.name.escapedText === 'components' && ts.isObjectLiteralExpression(node.initializer)) {
componentsOptionNode = node.initializer;
}
});
}
exportDefault = Object.assign(Object.assign({}, _getStartEnd(node)), { expression: _getStartEnd(node.expression), args: _getStartEnd(obj), argsNode: withNode ? obj : undefined, componentsOption: componentsOptionNode ? _getStartEnd(componentsOptionNode) : undefined, componentsOptionNode: withNode ? componentsOptionNode : undefined });
if (node.name.escapedText === 'name') {
nameOptionNode = node.initializer;
}
}
});
exportDefault = Object.assign(Object.assign({}, _getStartEnd(node)), { expression: _getStartEnd(node.expression), args: _getStartEnd(obj), argsNode: withNode ? obj : undefined, componentsOption: componentsOptionNode ? _getStartEnd(componentsOptionNode) : undefined, componentsOptionNode: withNode ? componentsOptionNode : undefined, nameOption: nameOptionNode ? _getStartEnd(nameOptionNode) : undefined });
}

@@ -33,0 +35,0 @@ }

@@ -12,9 +12,46 @@ Object.defineProperty(exports, "__esModule", { value: true });

const ts = modules.typescript;
const gen = new WeakMap();
const _fileName = (0, reactivity_1.shallowRef)('');
const _sfc = (0, reactivity_1.shallowRef)({});
const lang = (0, reactivity_1.computed)(() => {
let lang = !_sfc.value.script && !_sfc.value.scriptSetup ? 'ts'
: _sfc.value.scriptSetup && _sfc.value.scriptSetup.lang !== 'js' ? _sfc.value.scriptSetup.lang
: _sfc.value.script && _sfc.value.script.lang !== 'js' ? _sfc.value.script.lang
: 'js';
if (vueCompilerOptions.jsxTemplates) {
if (lang === 'js') {
lang = 'jsx';
}
else if (lang === 'ts') {
lang = 'tsx';
}
}
return lang;
});
const cssVars = (0, reactivity_1.computed)(() => collectCssVars(_sfc.value));
const scriptRanges = (0, reactivity_1.computed)(() => _sfc.value.scriptAst
? (0, scriptRanges_1.parseScriptRanges)(ts, _sfc.value.scriptAst, !!_sfc.value.scriptSetup, false)
: undefined);
const scriptSetupRanges = (0, reactivity_1.computed)(() => _sfc.value.scriptSetupAst
? (0, scriptSetupRanges_1.parseScriptSetupRanges)(ts, _sfc.value.scriptSetupAst)
: undefined);
const cssModuleClasses = (0, reactivity_1.computed)(() => collectStyleCssClasses(_sfc.value, style => !!style.module));
const cssScopedClasses = (0, reactivity_1.computed)(() => collectStyleCssClasses(_sfc.value, style => {
const setting = vueCompilerOptions.experimentalResolveStyleCssClasses;
return (setting === 'scoped' && style.scoped) || setting === 'always';
}));
const htmlGen = (0, reactivity_1.computed)(() => {
var _a, _b, _c, _d;
const templateAst = _sfc.value.getTemplateAst();
if (!templateAst)
return;
return templateGen.generate(ts, vueCompilerOptions, (_b = (_a = _sfc.value.template) === null || _a === void 0 ? void 0 : _a.content) !== null && _b !== void 0 ? _b : '', (_d = (_c = _sfc.value.template) === null || _c === void 0 ? void 0 : _c.lang) !== null && _d !== void 0 ? _d : 'html', templateAst, !!_sfc.value.scriptSetup, Object.values(cssScopedClasses.value).map(style => style.classNames).flat());
});
const tsxGen = (0, reactivity_1.computed)(() => (0, script_1.generate)(ts, _fileName.value, _sfc.value, lang.value, scriptRanges.value, scriptSetupRanges.value, cssVars.value, cssModuleClasses.value, cssScopedClasses.value, htmlGen.value, compilerOptions, vueCompilerOptions));
return {
getEmbeddedFileNames(fileName, sfc) {
_fileName.value = fileName;
_sfc.value = sfc;
const fileNames = [];
const _gen = useGen(fileName, sfc);
if ((_gen === null || _gen === void 0 ? void 0 : _gen.lang.value) && ['js', 'ts', 'jsx', 'tsx'].includes(_gen.lang.value)) {
fileNames.push(fileName + '.' + _gen.lang.value);
if (['js', 'ts', 'jsx', 'tsx'].includes(lang.value)) {
fileNames.push(fileName + '.' + lang.value);
}

@@ -29,5 +66,6 @@ if (sfc.template) {

var _a, _b;
_fileName.value = fileName;
_sfc.value = sfc;
const suffix = embeddedFile.fileName.replace(fileName, '');
const _gen = useGen(fileName, sfc);
if (suffix === '.' + (_gen === null || _gen === void 0 ? void 0 : _gen.lang.value)) {
if (suffix === '.' + lang.value) {
embeddedFile.isTsHostFile = true;

@@ -42,3 +80,3 @@ embeddedFile.capabilities = {

};
const tsx = _gen === null || _gen === void 0 ? void 0 : _gen.tsxGen.value;
const tsx = tsxGen.value;
if (tsx) {

@@ -61,5 +99,5 @@ embeddedFile.codeGen.addText(tsx.codeGen.getText());

embeddedFile.isTsHostFile = false;
if (_gen === null || _gen === void 0 ? void 0 : _gen.htmlGen.value) {
embeddedFile.codeGen.addText(_gen.htmlGen.value.formatCodeGen.getText());
embeddedFile.codeGen.mappings = [..._gen.htmlGen.value.formatCodeGen.mappings];
if (htmlGen.value) {
embeddedFile.codeGen.addText(htmlGen.value.formatCodeGen.getText());
embeddedFile.codeGen.mappings = [...htmlGen.value.formatCodeGen.mappings];
}

@@ -69,5 +107,5 @@ }

embeddedFile.parentFileName = fileName + '.template.' + ((_b = sfc.template) === null || _b === void 0 ? void 0 : _b.lang);
if (_gen === null || _gen === void 0 ? void 0 : _gen.htmlGen.value) {
embeddedFile.codeGen.addText(_gen.htmlGen.value.cssCodeGen.getText());
embeddedFile.codeGen.mappings = [..._gen.htmlGen.value.cssCodeGen.mappings];
if (htmlGen.value) {
embeddedFile.codeGen.addText(htmlGen.value.cssCodeGen.getText());
embeddedFile.codeGen.mappings = [...htmlGen.value.cssCodeGen.mappings];
}

@@ -77,49 +115,2 @@ }

};
function useGen(fileName, sfc) {
if (!gen.has(sfc)) {
gen.set(sfc, createGen(fileName, sfc));
}
return gen.get(sfc);
}
function createGen(fileName, sfc) {
const lang = (0, reactivity_1.computed)(() => {
let lang = !sfc.script && !sfc.scriptSetup ? 'ts'
: sfc.scriptSetup && sfc.scriptSetup.lang !== 'js' ? sfc.scriptSetup.lang
: sfc.script && sfc.script.lang !== 'js' ? sfc.script.lang
: 'js';
if (vueCompilerOptions.jsxTemplates) {
if (lang === 'js') {
lang = 'jsx';
}
else if (lang === 'ts') {
lang = 'tsx';
}
}
return lang;
});
const cssVars = (0, reactivity_1.computed)(() => collectCssVars(sfc));
const scriptRanges = (0, reactivity_1.computed)(() => sfc.scriptAst
? (0, scriptRanges_1.parseScriptRanges)(ts, sfc.scriptAst, !!sfc.scriptSetup, false, false)
: undefined);
const scriptSetupRanges = (0, reactivity_1.computed)(() => sfc.scriptSetupAst
? (0, scriptSetupRanges_1.parseScriptSetupRanges)(ts, sfc.scriptSetupAst)
: undefined);
const cssModuleClasses = (0, reactivity_1.computed)(() => collectStyleCssClasses(sfc, style => !!style.module));
const cssScopedClasses = (0, reactivity_1.computed)(() => collectStyleCssClasses(sfc, style => {
const setting = vueCompilerOptions.experimentalResolveStyleCssClasses;
return (setting === 'scoped' && style.scoped) || setting === 'always';
}));
const htmlGen = (0, reactivity_1.computed)(() => {
var _a, _b, _c, _d;
if (!sfc.templateAst)
return;
return templateGen.generate(ts, vueCompilerOptions, (_b = (_a = sfc.template) === null || _a === void 0 ? void 0 : _a.content) !== null && _b !== void 0 ? _b : '', (_d = (_c = sfc.template) === null || _c === void 0 ? void 0 : _c.lang) !== null && _d !== void 0 ? _d : 'html', sfc.templateAst, !!sfc.scriptSetup, Object.values(cssScopedClasses.value).map(style => style.classNames).flat());
});
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));
return {
lang,
htmlGen,
tsxGen,
};
}
};

@@ -126,0 +117,0 @@ exports.default = plugin;

@@ -1,2 +0,2 @@

import { DocumentCapabilities, EmbeddedFileSourceMap, SourceFile, PositionCapabilities, Teleport, TeleportMappingData, EmbeddedFile } from '@volar/language-core';
import { DocumentCapabilities, EmbeddedFile, EmbeddedFileSourceMap, PositionCapabilities, SourceFile, Teleport, TeleportMappingData } from '@volar/language-core';
import { SFCParseResult } from '@vue/compiler-sfc';

@@ -36,14 +36,4 @@ import { ComputedRef, Ref } from '@vue/reactivity';

private plugins;
sfc: Sfc;
get text(): string;
get compiledSFCTemplate(): {
errors: CompilerDom.CompilerError[];
warnings: CompilerDom.CompilerError[];
ast: CompilerDom.RootNode | undefined;
} | undefined;
get tsFileName(): string;
get embeddeds(): EmbeddedFile[];
_snapshot: Ref<ts.IScriptSnapshot>;
_text: ComputedRef<string>;
_parsedSfcCache: {
static parsedSfcCache: {
fileName: string;
snapshot: ts.IScriptSnapshot;

@@ -53,3 +43,6 @@ sfc: SFCParseResult;

} | undefined;
_compiledSFCTemplateCache: {
static compiledSFCTemplateCache: {
fileName: string;
template: string;
templateOffset: number;
snapshot: ts.IScriptSnapshot;

@@ -59,13 +52,26 @@ result: CompilerDom.CodegenResult;

} | undefined;
_parsedSfc: ComputedRef<SFCParseResult | undefined>;
_compiledSFCTemplate: ComputedRef<{
static getSFC(plugins: ReturnType<VueLanguagePlugin>[], fileName: string, snapshot: ts.IScriptSnapshot): SFCParseResult | undefined;
static getCompiledSFCTemplate(plugins: ReturnType<VueLanguagePlugin>[], sourceFile: VueSourceFile, newSnapshot: ts.IScriptSnapshot): {
errors: CompilerDom.CompilerError[];
warnings: CompilerDom.CompilerError[];
ast: CompilerDom.RootNode | undefined;
} | undefined>;
_pluginEmbeddedFiles: ComputedRef<[VueEmbeddedFile, EmbeddedFile][]>[];
_allEmbeddeds: ComputedRef<[VueEmbeddedFile, EmbeddedFile][]>;
_embeddeds: ComputedRef<EmbeddedFile[]>;
} | undefined;
static current: import("@vue/reactivity").ShallowRef<VueSourceFile>;
static _pluginEmbeddedFiles: ComputedRef<ComputedRef<[VueEmbeddedFile, EmbeddedFile][]>[]>;
static _allEmbeddeds: ComputedRef<[VueEmbeddedFile, EmbeddedFile][]>;
static _embeddeds: ComputedRef<EmbeddedFile[]>;
sfc: Sfc;
get text(): string;
get compiledSFCTemplate(): {
errors: CompilerDom.CompilerError[];
warnings: CompilerDom.CompilerError[];
ast: CompilerDom.RootNode | undefined;
} | undefined;
get tsFileName(): string;
get embeddeds(): EmbeddedFile[];
_snapshot: Ref<ts.IScriptSnapshot>;
_allEmbeddeds: import("@vue/reactivity").ShallowRef<[VueEmbeddedFile, EmbeddedFile][]>;
_embeddeds: import("@vue/reactivity").ShallowRef<EmbeddedFile[]>;
constructor(fileName: string, pscriptSnapshot: ts.IScriptSnapshot, ts: typeof import('typescript/lib/tsserverlibrary'), plugins: ReturnType<VueLanguagePlugin>[]);
update(newScriptSnapshot: ts.IScriptSnapshot, init?: boolean): void;
}

@@ -18,6 +18,6 @@ Object.defineProperty(exports, "__esModule", { value: true });

customBlocks: [],
templateAst: (0, reactivity_1.computed)(() => {
getTemplateAst: () => {
var _a;
return (_a = this._compiledSFCTemplate.value) === null || _a === void 0 ? void 0 : _a.ast;
}),
return (_a = this.compiledSFCTemplate) === null || _a === void 0 ? void 0 : _a.ast;
},
scriptAst: (0, reactivity_1.computed)(() => {

@@ -34,94 +34,80 @@ if (this.sfc.script) {

}) /* avoid Sfc unwrap in .d.ts by reactive */;
this._text = (0, reactivity_1.computed)(() => this._snapshot.value.getText(0, this._snapshot.value.getLength()));
// computeds
this._parsedSfc = (0, reactivity_1.computed)(() => {
var _a, _b;
// incremental update
if ((_a = this._parsedSfcCache) === null || _a === void 0 ? void 0 : _a.plugin.updateSFC) {
const change = this._snapshot.value.getChangeRange(this._parsedSfcCache.snapshot);
if (change) {
const newSfc = this._parsedSfcCache.plugin.updateSFC(this._parsedSfcCache.sfc, {
start: change.span.start,
end: change.span.start + change.span.length,
newText: this._snapshot.value.getText(change.span.start, change.span.start + change.newLength),
});
if (newSfc) {
this._parsedSfcCache.snapshot = this._snapshot.value;
this._parsedSfcCache.sfc = newSfc;
return newSfc;
}
this._allEmbeddeds = (0, reactivity_1.shallowRef)([]);
this._embeddeds = (0, reactivity_1.shallowRef)([]);
this._snapshot = (0, reactivity_1.shallowRef)(this.pscriptSnapshot);
this.update(this._snapshot.value, true);
}
static getSFC(plugins, fileName, snapshot) {
var _a, _b, _c;
if (((_a = VueSourceFile.parsedSfcCache) === null || _a === void 0 ? void 0 : _a.snapshot) === snapshot) {
return VueSourceFile.parsedSfcCache.sfc;
}
// incremental update
if (((_b = VueSourceFile.parsedSfcCache) === null || _b === void 0 ? void 0 : _b.fileName) === fileName && VueSourceFile.parsedSfcCache.plugin.updateSFC) {
const change = snapshot.getChangeRange(VueSourceFile.parsedSfcCache.snapshot);
if (change) {
const newSfc = VueSourceFile.parsedSfcCache.plugin.updateSFC(VueSourceFile.parsedSfcCache.sfc, {
start: change.span.start,
end: change.span.start + change.span.length,
newText: snapshot.getText(change.span.start, change.span.start + change.newLength),
});
if (newSfc) {
VueSourceFile.parsedSfcCache.snapshot = snapshot;
VueSourceFile.parsedSfcCache.sfc = newSfc;
return newSfc;
}
}
for (const plugin of this.plugins) {
const sfc = (_b = plugin.parseSFC) === null || _b === void 0 ? void 0 : _b.call(plugin, this.fileName, this._text.value);
if (sfc) {
if (!sfc.errors.length) {
this._parsedSfcCache = {
snapshot: this._snapshot.value,
sfc,
plugin,
};
}
return sfc;
}
for (const plugin of plugins) {
const sfc = (_c = plugin.parseSFC) === null || _c === void 0 ? void 0 : _c.call(plugin, fileName, snapshot.getText(0, snapshot.getLength()));
if (sfc) {
if (!sfc.errors.length) {
VueSourceFile.parsedSfcCache = {
fileName,
snapshot,
sfc,
plugin,
};
}
return sfc;
}
});
this._compiledSFCTemplate = (0, reactivity_1.computed)(() => {
var _a, _b;
if (this.sfc.template) {
(0, reactivity_1.pauseTracking)();
// don't tracking
const newSnapshot = this._snapshot.value;
const templateOffset = this.sfc.template.startTagEnd;
(0, reactivity_1.resetTracking)();
// tracking
this.sfc.template.content;
// incremental update
if ((_a = this._compiledSFCTemplateCache) === null || _a === void 0 ? void 0 : _a.plugin.updateSFCTemplate) {
const change = newSnapshot.getChangeRange(this._compiledSFCTemplateCache.snapshot);
if (change) {
const newText = newSnapshot.getText(change.span.start, change.span.start + change.newLength);
const newResult = this._compiledSFCTemplateCache.plugin.updateSFCTemplate(this._compiledSFCTemplateCache.result, {
start: change.span.start - templateOffset,
end: change.span.start + change.span.length - templateOffset,
newText,
});
if (newResult) {
this._compiledSFCTemplateCache.snapshot = newSnapshot;
this._compiledSFCTemplateCache.result = newResult;
return {
errors: [],
warnings: [],
ast: newResult.ast,
};
}
}
}
for (const plugin of this.plugins) {
const errors = [];
const warnings = [];
let result;
try {
result = (_b = plugin.compileSFCTemplate) === null || _b === void 0 ? void 0 : _b.call(plugin, this.sfc.template.lang, this.sfc.template.content, {
onError: (err) => errors.push(err),
onWarn: (err) => warnings.push(err),
expressionPlugins: ['typescript'],
});
}
catch (e) {
const err = e;
errors.push(err);
}
if (result || errors.length) {
if (result && !errors.length && !warnings.length) {
this._compiledSFCTemplateCache = {
snapshot: newSnapshot,
result: result,
plugin,
};
}
}
}
static getCompiledSFCTemplate(plugins, sourceFile, newSnapshot) {
var _a, _b, _c, _d, _e;
if (((_a = VueSourceFile.compiledSFCTemplateCache) === null || _a === void 0 ? void 0 : _a.snapshot) === newSnapshot) {
return {
errors: [],
warnings: [],
ast: VueSourceFile.compiledSFCTemplateCache.result.ast,
};
}
if (((_b = VueSourceFile.compiledSFCTemplateCache) === null || _b === void 0 ? void 0 : _b.fileName) === sourceFile.fileName
&& VueSourceFile.compiledSFCTemplateCache.template === ((_c = sourceFile.sfc.template) === null || _c === void 0 ? void 0 : _c.content)
&& VueSourceFile.compiledSFCTemplateCache.templateOffset === sourceFile.sfc.template.startTagEnd) {
return {
errors: [],
warnings: [],
ast: VueSourceFile.compiledSFCTemplateCache.result.ast,
};
}
if (sourceFile.sfc.template) {
// incremental update
if ((_d = VueSourceFile.compiledSFCTemplateCache) === null || _d === void 0 ? void 0 : _d.plugin.updateSFCTemplate) {
const change = newSnapshot.getChangeRange(VueSourceFile.compiledSFCTemplateCache.snapshot);
const templateOffset = sourceFile.sfc.template.startTagEnd;
if (change) {
const newText = newSnapshot.getText(change.span.start, change.span.start + change.newLength);
const newResult = VueSourceFile.compiledSFCTemplateCache.plugin.updateSFCTemplate(VueSourceFile.compiledSFCTemplateCache.result, {
start: change.span.start - templateOffset,
end: change.span.start + change.span.length - templateOffset,
newText,
});
if (newResult) {
VueSourceFile.compiledSFCTemplateCache.snapshot = newSnapshot;
VueSourceFile.compiledSFCTemplateCache.result = newResult;
return {
errors,
warnings,
ast: result === null || result === void 0 ? void 0 : result.ast,
errors: [],
warnings: [],
ast: newResult.ast,
};

@@ -131,170 +117,42 @@ }

}
});
this._pluginEmbeddedFiles = this.plugins.map(plugin => {
const embeddedFiles = {};
const files = (0, reactivity_1.computed)(() => {
if (plugin.getEmbeddedFileNames) {
const embeddedFileNames = plugin.getEmbeddedFileNames(this.fileName, this.sfc);
for (const oldFileName of Object.keys(embeddedFiles)) {
if (!embeddedFileNames.includes(oldFileName)) {
delete embeddedFiles[oldFileName];
}
}
for (const embeddedFileName of embeddedFileNames) {
if (!embeddedFiles[embeddedFileName]) {
embeddedFiles[embeddedFileName] = (0, reactivity_1.computed)(() => {
const file = {
fileName: embeddedFileName,
capabilities: {
diagnostics: false,
foldingRanges: false,
formatting: false,
documentSymbol: false,
codeActions: false,
inlayHints: false,
},
isTsHostFile: false,
codeGen: new code_gen_1.CodeGen(),
teleportMappings: [],
};
for (const plugin of this.plugins) {
if (plugin.resolveEmbeddedFile) {
plugin.resolveEmbeddedFile(this.fileName, this.sfc, file);
}
}
return file;
});
}
}
for (const plugin of plugins) {
const errors = [];
const warnings = [];
let result;
try {
result = (_e = plugin.compileSFCTemplate) === null || _e === void 0 ? void 0 : _e.call(plugin, sourceFile.sfc.template.lang, sourceFile.sfc.template.content, {
onError: (err) => errors.push(err),
onWarn: (err) => warnings.push(err),
expressionPlugins: ['typescript'],
});
}
return Object.values(embeddedFiles);
});
return (0, reactivity_1.computed)(() => {
const self = this;
const baseOffsetMap = new Map();
return files.value.map(_file => {
const file = _file.value;
const node = {
fileName: file.fileName,
text: file.codeGen.getText(),
capabilities: file.capabilities,
isTsHostFile: file.isTsHostFile,
mappings: file.codeGen.mappings.map(mapping => {
return Object.assign(Object.assign({}, mapping), { data: mapping.data.capabilities, sourceRange: embeddedRangeToVueRange(mapping.data, mapping.sourceRange), additional: mapping.additional ? mapping.additional.map(add => {
const addVueRange = embeddedRangeToVueRange(mapping.data, add.sourceRange);
return Object.assign(Object.assign({}, add), { sourceRange: addVueRange });
}) : undefined });
}),
teleportMappings: file.teleportMappings,
embeddeds: [],
};
return [file, node];
});
function embeddedRangeToVueRange(data, range) {
var _a;
if (data.vueTag) {
const key = data.vueTag + '-' + data.vueTagIndex;
let baseOffset = baseOffsetMap.get(key);
if (baseOffset === undefined) {
if (data.vueTag === 'script' && self.sfc.script) {
baseOffset = self.sfc.script.startTagEnd;
}
else if (data.vueTag === 'scriptSetup' && self.sfc.scriptSetup) {
baseOffset = self.sfc.scriptSetup.startTagEnd;
}
else if (data.vueTag === 'template' && self.sfc.template) {
baseOffset = self.sfc.template.startTagEnd;
}
else if (data.vueTag === 'style') {
baseOffset = self.sfc.styles[data.vueTagIndex].startTagEnd;
}
else if (data.vueTag === 'customBlock') {
baseOffset = self.sfc.customBlocks[data.vueTagIndex].startTagEnd;
}
if (baseOffset !== undefined) {
baseOffsetMap.set(key, baseOffset);
}
}
if (baseOffset !== undefined) {
return {
start: baseOffset + range.start,
end: baseOffset + range.end,
};
}
}
if (data.vueTag === 'scriptSrc' && ((_a = self.sfc.script) === null || _a === void 0 ? void 0 : _a.src)) {
const vueStart = self._text.value.substring(0, self.sfc.script.startTagEnd).lastIndexOf(self.sfc.script.src);
const vueEnd = vueStart + self.sfc.script.src.length;
return {
start: vueStart - 1,
end: vueEnd + 1,
catch (e) {
const err = e;
errors.push(err);
}
if (result || errors.length) {
if (result && !errors.length && !warnings.length) {
VueSourceFile.compiledSFCTemplateCache = {
fileName: sourceFile.fileName,
template: sourceFile.sfc.template.content,
templateOffset: sourceFile.sfc.template.startTagEnd,
snapshot: newSnapshot,
result: result,
plugin,
};
}
return range;
return {
errors,
warnings,
ast: result === null || result === void 0 ? void 0 : result.ast,
};
}
});
});
this._allEmbeddeds = (0, reactivity_1.computed)(() => {
const all = [];
for (const embeddedFiles of this._pluginEmbeddedFiles) {
for (const embedded of embeddedFiles.value) {
all.push(embedded);
}
}
return all;
});
this._embeddeds = (0, reactivity_1.computed)(() => {
const childs = [];
// const embeddeds: EmbeddedStructure[] = [];
let remain = [...this._allEmbeddeds.value];
while (remain.length) {
const beforeLength = remain.length;
consumeRemain();
if (beforeLength === remain.length) {
break;
}
}
for (const [embedded, node] of remain) {
childs.push(node);
if (embedded) {
console.error('Unable to resolve embedded: ' + embedded.parentFileName + ' -> ' + embedded.fileName);
}
}
return childs;
function consumeRemain() {
for (let i = remain.length - 1; i >= 0; i--) {
const [embedded, node] = remain[i];
if (!embedded.parentFileName) {
childs.push(node);
remain.splice(i, 1);
}
else {
const parent = findParentStructure(embedded.parentFileName, childs);
if (parent) {
parent.embeddeds.push(node);
remain.splice(i, 1);
}
}
}
}
function findParentStructure(fileName, strus) {
for (const stru of strus) {
if (stru.fileName === fileName) {
return stru;
}
let _stru = findParentStructure(fileName, stru.embeddeds);
if (_stru) {
return _stru;
}
}
}
});
this._snapshot = (0, reactivity_1.shallowRef)(this.pscriptSnapshot);
this.update(this._snapshot.value, true);
}
}
get text() {
return this._text.value;
return this._snapshot.value.getText(0, this._snapshot.value.getLength());
}
get compiledSFCTemplate() {
return this._compiledSFCTemplate.value;
return VueSourceFile.getCompiledSFCTemplate(this.plugins, this, this._snapshot.value);
}

@@ -313,10 +171,11 @@ get tsFileName() {

}
const parsedSfc = VueSourceFile.getSFC(this.plugins, this.fileName, newScriptSnapshot);
this._snapshot.value = newScriptSnapshot;
// TODO: wait for https://github.com/vuejs/core/pull/5912
if (this._parsedSfc.value) {
updateTemplate(this._parsedSfc.value.descriptor.template);
updateScript(this._parsedSfc.value.descriptor.script);
updateScriptSetup(this._parsedSfc.value.descriptor.scriptSetup);
updateStyles(this._parsedSfc.value.descriptor.styles);
updateCustomBlocks(this._parsedSfc.value.descriptor.customBlocks);
if (parsedSfc) {
updateTemplate(parsedSfc.descriptor.template);
updateScript(parsedSfc.descriptor.script);
updateScriptSetup(parsedSfc.descriptor.scriptSetup);
updateStyles(parsedSfc.descriptor.styles);
updateCustomBlocks(parsedSfc.descriptor.customBlocks);
}

@@ -330,2 +189,5 @@ else {

}
VueSourceFile.current.value = this;
this._allEmbeddeds.value = VueSourceFile._allEmbeddeds.value;
this._embeddeds.value = VueSourceFile._embeddeds.value;
function updateTemplate(block) {

@@ -335,4 +197,4 @@ var _a;

tag: 'template',
start: self._text.value.substring(0, block.loc.start.offset).lastIndexOf('<'),
end: block.loc.end.offset + self._text.value.substring(block.loc.end.offset).indexOf('>') + 1,
start: self._snapshot.value.getText(0, block.loc.start.offset).lastIndexOf('<'),
end: block.loc.end.offset + self._snapshot.value.getText(block.loc.end.offset, self._snapshot.value.getLength()).indexOf('>') + 1,
startTagEnd: block.loc.start.offset,

@@ -354,4 +216,4 @@ endTagStart: block.loc.end.offset,

tag: 'script',
start: self._text.value.substring(0, block.loc.start.offset).lastIndexOf('<'),
end: block.loc.end.offset + self._text.value.substring(block.loc.end.offset).indexOf('>') + 1,
start: self._snapshot.value.getText(0, block.loc.start.offset).lastIndexOf('<'),
end: block.loc.end.offset + self._snapshot.value.getText(block.loc.end.offset, self._snapshot.value.getLength()).indexOf('>') + 1,
startTagEnd: block.loc.start.offset,

@@ -374,4 +236,4 @@ endTagStart: block.loc.end.offset,

tag: 'scriptSetup',
start: self._text.value.substring(0, block.loc.start.offset).lastIndexOf('<'),
end: block.loc.end.offset + self._text.value.substring(block.loc.end.offset).indexOf('>') + 1,
start: self._snapshot.value.getText(0, block.loc.start.offset).lastIndexOf('<'),
end: block.loc.end.offset + self._snapshot.value.getText(block.loc.end.offset, self._snapshot.value.getLength()).indexOf('>') + 1,
startTagEnd: block.loc.start.offset,

@@ -395,4 +257,4 @@ endTagStart: block.loc.end.offset,

tag: 'style',
start: self._text.value.substring(0, block.loc.start.offset).lastIndexOf('<'),
end: block.loc.end.offset + self._text.value.substring(block.loc.end.offset).indexOf('>') + 1,
start: self._snapshot.value.getText(0, block.loc.start.offset).lastIndexOf('<'),
end: block.loc.end.offset + self._snapshot.value.getText(block.loc.end.offset, self._snapshot.value.getLength()).indexOf('>') + 1,
startTagEnd: block.loc.start.offset,

@@ -422,4 +284,4 @@ endTagStart: block.loc.end.offset,

tag: 'customBlock',
start: self._text.value.substring(0, block.loc.start.offset).lastIndexOf('<'),
end: block.loc.end.offset + self._text.value.substring(block.loc.end.offset).indexOf('>') + 1,
start: self._snapshot.value.getText(0, block.loc.start.offset).lastIndexOf('<'),
end: block.loc.end.offset + self._snapshot.value.getText(block.loc.end.offset, self._snapshot.value.getLength()).indexOf('>') + 1,
startTagEnd: block.loc.start.offset,

@@ -450,2 +312,161 @@ endTagStart: block.loc.end.offset,

exports.VueSourceFile = VueSourceFile;
VueSourceFile.current = (0, reactivity_1.shallowRef)({});
VueSourceFile._pluginEmbeddedFiles = (0, reactivity_1.computed)(() => VueSourceFile.current.value.plugins.map(plugin => {
const embeddedFiles = {};
const files = (0, reactivity_1.computed)(() => {
if (plugin.getEmbeddedFileNames) {
const embeddedFileNames = plugin.getEmbeddedFileNames(VueSourceFile.current.value.fileName, VueSourceFile.current.value.sfc);
for (const oldFileName of Object.keys(embeddedFiles)) {
if (!embeddedFileNames.includes(oldFileName)) {
delete embeddedFiles[oldFileName];
}
}
for (const embeddedFileName of embeddedFileNames) {
if (!embeddedFiles[embeddedFileName]) {
embeddedFiles[embeddedFileName] = (0, reactivity_1.computed)(() => {
const file = {
fileName: embeddedFileName,
capabilities: {
diagnostics: false,
foldingRanges: false,
formatting: false,
documentSymbol: false,
codeActions: false,
inlayHints: false,
},
isTsHostFile: false,
codeGen: new code_gen_1.CodeGen(),
teleportMappings: [],
};
for (const plugin of VueSourceFile.current.value.plugins) {
if (plugin.resolveEmbeddedFile) {
plugin.resolveEmbeddedFile(VueSourceFile.current.value.fileName, VueSourceFile.current.value.sfc, file);
}
}
return file;
});
}
}
}
return Object.values(embeddedFiles);
});
return (0, reactivity_1.computed)(() => {
const baseOffsetMap = new Map();
return files.value.map(_file => {
const file = _file.value;
const node = {
fileName: file.fileName,
text: file.codeGen.getText(),
capabilities: file.capabilities,
isTsHostFile: file.isTsHostFile,
mappings: file.codeGen.mappings.map(mapping => {
return Object.assign(Object.assign({}, mapping), { data: mapping.data.capabilities, sourceRange: embeddedRangeToVueRange(mapping.data, mapping.sourceRange), additional: mapping.additional ? mapping.additional.map(add => {
const addVueRange = embeddedRangeToVueRange(mapping.data, add.sourceRange);
return Object.assign(Object.assign({}, add), { sourceRange: addVueRange });
}) : undefined });
}),
teleportMappings: file.teleportMappings,
embeddeds: [],
};
return [file, node];
});
function embeddedRangeToVueRange(data, range) {
var _a;
if (data.vueTag) {
const key = data.vueTag + '-' + data.vueTagIndex;
let baseOffset = baseOffsetMap.get(key);
if (baseOffset === undefined) {
if (data.vueTag === 'script' && VueSourceFile.current.value.sfc.script) {
baseOffset = VueSourceFile.current.value.sfc.script.startTagEnd;
}
else if (data.vueTag === 'scriptSetup' && VueSourceFile.current.value.sfc.scriptSetup) {
baseOffset = VueSourceFile.current.value.sfc.scriptSetup.startTagEnd;
}
else if (data.vueTag === 'template' && VueSourceFile.current.value.sfc.template) {
baseOffset = VueSourceFile.current.value.sfc.template.startTagEnd;
}
else if (data.vueTag === 'style') {
baseOffset = VueSourceFile.current.value.sfc.styles[data.vueTagIndex].startTagEnd;
}
else if (data.vueTag === 'customBlock') {
baseOffset = VueSourceFile.current.value.sfc.customBlocks[data.vueTagIndex].startTagEnd;
}
if (baseOffset !== undefined) {
baseOffsetMap.set(key, baseOffset);
}
}
if (baseOffset !== undefined) {
return {
start: baseOffset + range.start,
end: baseOffset + range.end,
};
}
}
if (data.vueTag === 'scriptSrc' && ((_a = VueSourceFile.current.value.sfc.script) === null || _a === void 0 ? void 0 : _a.src)) {
const vueStart = VueSourceFile.current.value._snapshot.value.getText(0, VueSourceFile.current.value.sfc.script.startTagEnd).lastIndexOf(VueSourceFile.current.value.sfc.script.src);
const vueEnd = vueStart + VueSourceFile.current.value.sfc.script.src.length;
return {
start: vueStart - 1,
end: vueEnd + 1,
};
}
return range;
}
});
}));
VueSourceFile._allEmbeddeds = (0, reactivity_1.computed)(() => {
const all = [];
for (const embeddedFiles of VueSourceFile._pluginEmbeddedFiles.value) {
for (const embedded of embeddedFiles.value) {
all.push(embedded);
}
}
return all;
});
VueSourceFile._embeddeds = (0, reactivity_1.computed)(() => {
const childs = [];
// const embeddeds: EmbeddedStructure[] = [];
let remain = [...VueSourceFile._allEmbeddeds.value];
while (remain.length) {
const beforeLength = remain.length;
consumeRemain();
if (beforeLength === remain.length) {
break;
}
}
for (const [embedded, node] of remain) {
childs.push(node);
if (embedded) {
console.error('Unable to resolve embedded: ' + embedded.parentFileName + ' -> ' + embedded.fileName);
}
}
return childs;
function consumeRemain() {
for (let i = remain.length - 1; i >= 0; i--) {
const [embedded, node] = remain[i];
if (!embedded.parentFileName) {
childs.push(node);
remain.splice(i, 1);
}
else {
const parent = findParentStructure(embedded.parentFileName, childs);
if (parent) {
parent.embeddeds.push(node);
remain.splice(i, 1);
}
}
}
}
function findParentStructure(fileName, strus) {
for (const stru of strus) {
if (stru.fileName === fileName) {
return stru;
}
let _stru = findParentStructure(fileName, stru.embeddeds);
if (_stru) {
return _stru;
}
}
}
});
//# sourceMappingURL=sourceFile.js.map

@@ -14,2 +14,3 @@ import * as embedded from '@volar/language-core';

strictTemplates: boolean;
skipTemplateCodegen: boolean;
plugins: string[];

@@ -22,3 +23,2 @@ experimentalComponentOptionsWrapper: [string, string];

experimentalTemplateCompilerOptionsRequirePath: string | undefined;
experimentalDisableTemplateSupport: boolean;
experimentalResolveStyleCssClasses: 'scoped' | 'always' | 'never';

@@ -73,5 +73,5 @@ experimentalAllowTypeNarrowingInInlineHandlers: boolean;

})[];
templateAst: CompilerDom.RootNode | undefined;
getTemplateAst: () => CompilerDom.RootNode | undefined;
scriptAst: ts.SourceFile | undefined;
scriptSetupAst: ts.SourceFile | undefined;
}

@@ -0,3 +1,4 @@

import { ResolvedVueCompilerOptions } from '../types';
export declare const typesFileName = "__VLS_types.ts";
export declare function getTypesCode(vueVersion: number): string;
export declare function getTypesCode(vueVersion: number, vueCompilerOptions: ResolvedVueCompilerOptions): string;
export declare function genConstructorOverloads(name?: string, nums?: number): string;

@@ -5,3 +5,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

exports.typesFileName = '__VLS_types.ts';
function getTypesCode(vueVersion) {
function getTypesCode(vueVersion, vueCompilerOptions) {
const libName = (0, shared_1.getVueLibraryName)(vueVersion);

@@ -24,3 +24,3 @@ const slots = (0, shared_1.getSlotsPropertyName)(vueVersion);

type ForableSource<T> = [
T extends { [Symbol.iterator](): IterableIterator<infer T1> } ? T1 : T[keyof T], // item
T extends { [Symbol.iterator](): Iterator<infer T1> } ? T1 : T[keyof T], // item
typeof Symbol.iterator extends keyof T ? number : T extends T ? keyof T : never, // key

@@ -47,3 +47,2 @@ typeof Symbol.iterator extends keyof T ? undefined : number, // index

export declare function getVforSourceType<T>(source: T): ForableSource<NonNullable<T extends number ? number[] : T extends string ? string[] : T>>;
export declare function getNameOption<T>(t?: T): T extends { name: infer N } ? N : undefined;
export declare function directiveFunction<T>(dir: T):

@@ -68,6 +67,2 @@ T extends ObjectDirective<infer E, infer V> ? undefined extends V ? (value?: V) => void : (value: V) => void

: T; // IntrinsicElement
export type ExtractEmit2<T> =
T extends FunctionalComponent<infer _, infer E> ? SetupContext<E>['emit']
: T extends new (...args: any) => { $emit: infer Emit } ? Emit
: unknown;
export type ReturnVoid<T> = T extends (...payload: infer P) => any ? (...payload: P) => void : (...args: any) => void;

@@ -113,4 +108,23 @@ export type EmitEvent2<F, E> =

export type SelfComponent<N, C> = string extends N ? {} : N extends string ? { [P in N]: C } : {};
export type PickComponents<T> = ComponentKeys<T> extends keyof T ? Pick<T, ComponentKeys<T>> : T;
export type ConvertInvalidJsxElement<T> = IsComponent<T> extends true ? T : any;
export type GetComponents<Components, N1, N2 = unknown, N3 = unknown> =
N1 extends keyof Components ? Components[N1] :
N2 extends keyof Components ? Components[N2] :
N3 extends keyof Components ? Components[N3] :
unknown;
export type ComponentProps<T> =
${vueCompilerOptions.strictTemplates ? '' : 'Record<string, unknown> &'}
GlobalAttrs &
ExtractProps<T>;
export type InstanceProps<I, C> = I extends { $props: infer Props } ? Props & Record<string, unknown> : C & Record<string, unknown>;
export type EventObject<I, K1 extends string, C, E1, E2> = {
[K in K1]: import('./__VLS_types.js').FillingEventArg<
import('./__VLS_types.js').FirstFunction<
import('./__VLS_types.js').EmitEvent<C, K1>,
E1,
I extends { $emit: infer Emit } ? import('./__VLS_types.js').EmitEvent2<Emit, K1> : unknown,
E2,
>
>
};

@@ -121,3 +135,2 @@ type IsComponent<T> =

: IsAny<T>
type ComponentKeys<T> = keyof { [K in keyof T as IsComponent<T[K]> extends true ? K : never]: any };
`;

@@ -124,0 +137,0 @@ }

export declare const SearchTexts: {
Components: string;
GlobalAttrs: string;
PropsCompletion: (tag: string) => string;
EmitCompletion: (tag: string) => string;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SearchTexts = void 0;
const shared_1 = require("@vue/shared");
exports.SearchTexts = {
Components: '/* __VLS_.SearchTexts.Components */',
GlobalAttrs: '/* __VLS_.SearchTexts.GlobalAttrs */',
PropsCompletion: (tag) => `/* __VLS_.SearchTexts.Completion.Props.${tag} */`,
EmitCompletion: (tag) => `/* __VLS_.SearchTexts.Completion.Emit.${tag} */`,
PropsCompletion: (tag) => `/* __VLS_.SearchTexts.Completion.Props.${(0, shared_1.hyphenate)(tag)} */`,
EmitCompletion: (tag) => `/* __VLS_.SearchTexts.Completion.Emit.${(0, shared_1.hyphenate)(tag)} */`,
};
//# sourceMappingURL=string.js.map

@@ -41,7 +41,7 @@ Object.defineProperty(exports, "__esModule", { value: true });

const target = (_a = vueOptions.target) !== null && _a !== void 0 ? _a : 3;
return Object.assign(Object.assign({}, vueOptions), { target, jsxTemplates: (_b = vueOptions.jsxTemplates) !== null && _b !== void 0 ? _b : false, strictTemplates: (_c = vueOptions.strictTemplates) !== null && _c !== void 0 ? _c : false, plugins: (_d = vueOptions.plugins) !== null && _d !== void 0 ? _d : [],
return Object.assign(Object.assign({}, vueOptions), { target, jsxTemplates: (_b = vueOptions.jsxTemplates) !== null && _b !== void 0 ? _b : false, strictTemplates: (_c = vueOptions.strictTemplates) !== null && _c !== void 0 ? _c : false, skipTemplateCodegen: (_d = vueOptions.skipTemplateCodegen) !== null && _d !== void 0 ? _d : false, plugins: (_e = vueOptions.plugins) !== null && _e !== void 0 ? _e : [],
// experimental
experimentalComponentOptionsWrapper: (_e = vueOptions.experimentalComponentOptionsWrapper) !== null && _e !== void 0 ? _e : (target >= 2.7
experimentalComponentOptionsWrapper: (_f = vueOptions.experimentalComponentOptionsWrapper) !== null && _f !== void 0 ? _f : (target >= 2.7
? [`(await import('vue')).defineComponent(`, `)`]
: [`(await import('vue')).default.extend(`, `)`]), experimentalComponentOptionsWrapperEnable: (_f = vueOptions.experimentalComponentOptionsWrapperEnable) !== null && _f !== void 0 ? _f : 'onlyJs', experimentalRuntimeMode: (_g = vueOptions.experimentalRuntimeMode) !== null && _g !== void 0 ? _g : 'runtime-dom', experimentalDowngradePropsAndEmitsToSetupReturnOnScriptSetup: (_h = vueOptions.experimentalDowngradePropsAndEmitsToSetupReturnOnScriptSetup) !== null && _h !== void 0 ? _h : 'onlyJs', experimentalTemplateCompilerOptions: (_j = vueOptions.experimentalTemplateCompilerOptions) !== null && _j !== void 0 ? _j : {}, experimentalTemplateCompilerOptionsRequirePath: (_k = vueOptions.experimentalTemplateCompilerOptionsRequirePath) !== null && _k !== void 0 ? _k : undefined, experimentalDisableTemplateSupport: (_l = vueOptions.experimentalDisableTemplateSupport) !== null && _l !== void 0 ? _l : false, experimentalResolveStyleCssClasses: (_m = vueOptions.experimentalResolveStyleCssClasses) !== null && _m !== void 0 ? _m : 'scoped', experimentalAllowTypeNarrowingInInlineHandlers: (_o = vueOptions.experimentalAllowTypeNarrowingInInlineHandlers) !== null && _o !== void 0 ? _o : false });
: [`(await import('vue')).default.extend(`, `)`]), experimentalComponentOptionsWrapperEnable: (_g = vueOptions.experimentalComponentOptionsWrapperEnable) !== null && _g !== void 0 ? _g : 'onlyJs', experimentalRuntimeMode: (_h = vueOptions.experimentalRuntimeMode) !== null && _h !== void 0 ? _h : 'runtime-dom', experimentalDowngradePropsAndEmitsToSetupReturnOnScriptSetup: (_j = vueOptions.experimentalDowngradePropsAndEmitsToSetupReturnOnScriptSetup) !== null && _j !== void 0 ? _j : 'onlyJs', experimentalTemplateCompilerOptions: (_k = vueOptions.experimentalTemplateCompilerOptions) !== null && _k !== void 0 ? _k : {}, experimentalTemplateCompilerOptionsRequirePath: (_l = vueOptions.experimentalTemplateCompilerOptionsRequirePath) !== null && _l !== void 0 ? _l : undefined, experimentalResolveStyleCssClasses: (_m = vueOptions.experimentalResolveStyleCssClasses) !== null && _m !== void 0 ? _m : 'scoped', experimentalAllowTypeNarrowingInInlineHandlers: (_o = vueOptions.experimentalAllowTypeNarrowingInInlineHandlers) !== null && _o !== void 0 ? _o : false });
}

@@ -48,0 +48,0 @@ exports.resolveVueCompilerOptions = resolveVueCompilerOptions;

{
"name": "@volar/vue-language-core",
"version": "1.0.0-alpha.3",
"version": "1.0.0-alpha.4",
"main": "out/index.js",

@@ -19,5 +19,5 @@ "license": "MIT",

"dependencies": {
"@volar/code-gen": "1.0.0-alpha.3",
"@volar/language-core": "1.0.0-alpha.3",
"@volar/source-map": "1.0.0-alpha.3",
"@volar/code-gen": "1.0.0-alpha.4",
"@volar/language-core": "1.0.0-alpha.4",
"@volar/source-map": "1.0.0-alpha.4",
"@vue/compiler-dom": "^3.2.38",

@@ -29,3 +29,3 @@ "@vue/compiler-sfc": "^3.2.38",

},
"gitHead": "55a1d3fa143411dd4520020f407e427df4e4e26a"
"gitHead": "712fc3178ed7a7414da73e940c5c5e8b54eebea1"
}

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc