@volar/vue-language-core
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -213,3 +213,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
]); | ||
codeGen.push('export default await (async () => {\n'); | ||
codeGen.push('export default await (async '); | ||
if (vueCompilerOptions.experimentalRfc436 && sfc.scriptSetup.generic) { | ||
codeGen.push(`<${sfc.scriptSetup.generic}>`); | ||
} | ||
codeGen.push('() => {\n'); | ||
} | ||
@@ -324,3 +328,3 @@ codeGen.push('const __VLS_setup = async () => {\n'); | ||
codeGen.push(`},\n`); | ||
if (sfc.script && ((_a = scriptRanges === null || scriptRanges === void 0 ? void 0 : scriptRanges.exportDefault) === null || _a === void 0 ? void 0 : _a.args)) { | ||
if ((_a = scriptRanges === null || scriptRanges === void 0 ? void 0 : scriptRanges.exportDefault) === null || _a === void 0 ? void 0 : _a.args) { | ||
addVirtualCode('script', scriptRanges.exportDefault.args.start + 1, scriptRanges.exportDefault.args.end - 1); | ||
@@ -330,11 +334,28 @@ } | ||
writeTemplate(); | ||
codeGen.push(`return {} as typeof __VLS_Component`); | ||
if (htmlGen === null || htmlGen === void 0 ? void 0 : htmlGen.slotsNum) { | ||
codeGen.push(`return {} as typeof __VLS_Component & (new () => { ${(0, shared_2.getSlotsPropertyName)(vueVersion)}: ReturnType<typeof __VLS_template> });\n`); | ||
codeGen.push(` & (new () => { ${(0, shared_2.getSlotsPropertyName)(vueVersion)}: ReturnType<typeof __VLS_template> })`); | ||
} | ||
else { | ||
codeGen.push(`return {} as typeof __VLS_Component;\n`); | ||
if (vueCompilerOptions.experimentalRfc436 && sfc.scriptSetup.generic) { | ||
codeGen.push(` & (new <${sfc.scriptSetup.generic}>() => {\n`); | ||
if (scriptSetupRanges.propsTypeArg) { | ||
codeGen.push(`$props: `); | ||
addVirtualCode('scriptSetup', scriptSetupRanges.propsTypeArg.start, scriptSetupRanges.propsTypeArg.end); | ||
codeGen.push(`,\n`); | ||
} | ||
if (scriptSetupRanges.emitsTypeArg) { | ||
codeGen.push(`$emit: `); | ||
addVirtualCode('scriptSetup', scriptSetupRanges.emitsTypeArg.start, scriptSetupRanges.emitsTypeArg.end); | ||
codeGen.push(`,\n`); | ||
} | ||
codeGen.push(`})`); | ||
} | ||
codeGen.push(`;\n`); | ||
codeGen.push(`};\n`); | ||
codeGen.push(`return await __VLS_setup();\n`); | ||
codeGen.push(`})();`); | ||
codeGen.push(`})()`); | ||
if ((scriptRanges === null || scriptRanges === void 0 ? void 0 : scriptRanges.exportDefault) && scriptRanges.exportDefault.expression.end !== scriptRanges.exportDefault.end) { | ||
addVirtualCode('script', scriptRanges.exportDefault.expression.end, scriptRanges.exportDefault.end); | ||
} | ||
codeGen.push(`;`); | ||
// fix https://github.com/johnsoncodehk/volar/issues/1127 | ||
@@ -341,0 +362,0 @@ codeGen.push([ |
@@ -7,4 +7,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
const bindings = hasScriptSetup ? (0, scriptSetupRanges_1.parseBindingRanges)(ts, ast, false) : []; | ||
ast.forEachChild(node => { | ||
if (ts.isExportAssignment(node)) { | ||
ast.forEachChild(raw => { | ||
if (ts.isExportAssignment(raw)) { | ||
let node = raw; | ||
while (ts.isAsExpression(node.expression) || ts.isParenthesizedExpression(node.expression)) { // fix https://github.com/johnsoncodehk/volar/issues/1882 | ||
node = node.expression; | ||
} | ||
let obj; | ||
@@ -33,3 +37,3 @@ if (ts.isObjectLiteralExpression(node.expression)) { | ||
}); | ||
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 }); | ||
exportDefault = Object.assign(Object.assign({}, _getStartEnd(raw)), { 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 }); | ||
} | ||
@@ -36,0 +40,0 @@ } |
@@ -264,2 +264,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
lang: (_a = block.lang) !== null && _a !== void 0 ? _a : 'js', | ||
generic: typeof block.attrs.generic === 'string' ? block.attrs.generic : undefined, | ||
} : null; | ||
@@ -266,0 +267,0 @@ if (self.sfc.scriptSetup && newData) { |
@@ -26,2 +26,3 @@ import * as embedded from '@volar/language-core'; | ||
experimentalResolveStyleCssClasses: 'scoped' | 'always' | 'never'; | ||
experimentalRfc436: boolean; | ||
} | ||
@@ -68,3 +69,5 @@ export type VueLanguagePlugin = (ctx: { | ||
}) | null; | ||
scriptSetup: SfcBlock | null; | ||
scriptSetup: SfcBlock & { | ||
generic: string | undefined; | ||
} | null; | ||
styles: (SfcBlock & { | ||
@@ -71,0 +74,0 @@ module: string | undefined; |
@@ -39,3 +39,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
function resolveVueCompilerOptions(vueOptions) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p; | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q; | ||
const target = (_a = vueOptions.target) !== null && _a !== void 0 ? _a : 3; | ||
@@ -46,3 +46,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, skipTemplateCodegen: (_d = vueOptions.skipTemplateCodegen) !== null && _d !== void 0 ? _d : false, dataAttributes: (_e = vueOptions.dataAttributes) !== null && _e !== void 0 ? _e : ['data-*'], htmlAttributes: (_f = vueOptions.htmlAttributes) !== null && _f !== void 0 ? _f : ['aria-*'], optionsWrapper: (_g = vueOptions.optionsWrapper) !== null && _g !== void 0 ? _g : (target >= 2.7 | ||
// experimental | ||
experimentalRuntimeMode: (_l = vueOptions.experimentalRuntimeMode) !== null && _l !== void 0 ? _l : 'runtime-dom', experimentalTemplateCompilerOptions: (_m = vueOptions.experimentalTemplateCompilerOptions) !== null && _m !== void 0 ? _m : {}, experimentalTemplateCompilerOptionsRequirePath: (_o = vueOptions.experimentalTemplateCompilerOptionsRequirePath) !== null && _o !== void 0 ? _o : undefined, experimentalResolveStyleCssClasses: (_p = vueOptions.experimentalResolveStyleCssClasses) !== null && _p !== void 0 ? _p : 'scoped' }); | ||
experimentalRuntimeMode: (_l = vueOptions.experimentalRuntimeMode) !== null && _l !== void 0 ? _l : 'runtime-dom', experimentalTemplateCompilerOptions: (_m = vueOptions.experimentalTemplateCompilerOptions) !== null && _m !== void 0 ? _m : {}, experimentalTemplateCompilerOptionsRequirePath: (_o = vueOptions.experimentalTemplateCompilerOptionsRequirePath) !== null && _o !== void 0 ? _o : undefined, experimentalResolveStyleCssClasses: (_p = vueOptions.experimentalResolveStyleCssClasses) !== null && _p !== void 0 ? _p : 'scoped', experimentalRfc436: (_q = vueOptions.experimentalRfc436) !== null && _q !== void 0 ? _q : false }); | ||
} | ||
@@ -49,0 +49,0 @@ exports.resolveVueCompilerOptions = resolveVueCompilerOptions; |
{ | ||
"name": "@volar/vue-language-core", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"main": "out/index.js", | ||
@@ -16,4 +16,4 @@ "license": "MIT", | ||
"dependencies": { | ||
"@volar/language-core": "1.0.2", | ||
"@volar/source-map": "1.0.2", | ||
"@volar/language-core": "1.0.3", | ||
"@volar/source-map": "1.0.3", | ||
"@vue/compiler-dom": "^3.2.38", | ||
@@ -29,3 +29,3 @@ "@vue/compiler-sfc": "^3.2.38", | ||
}, | ||
"gitHead": "4e750f808450c0f70b0a439cb6954cf29345e8f2" | ||
"gitHead": "2576804e9479aec58f049bad2ea5d2a81f9cba28" | ||
} |
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
224273
4875
+ Added@volar/language-core@1.0.3(transitive)
+ Added@volar/source-map@1.0.3(transitive)
- Removed@volar/language-core@1.0.2(transitive)
- Removed@volar/source-map@1.0.2(transitive)
Updated@volar/language-core@1.0.3
Updated@volar/source-map@1.0.3