@vue/language-core
Advanced tools
Comparing version 1.8.10 to 1.8.11
@@ -255,3 +255,3 @@ "use strict"; | ||
codes.push([ | ||
sfc.scriptSetup.content.substring(0, Math.max(scriptSetupRanges.importSectionEndOffset, scriptSetupRanges.leadingCommentEndOffset)), | ||
sfc.scriptSetup.content.substring(0, Math.max(scriptSetupRanges.importSectionEndOffset, scriptSetupRanges.leadingCommentEndOffset)) + '\n', | ||
'scriptSetup', | ||
@@ -437,3 +437,16 @@ 0, | ||
if (vueCompilerOptions.target >= 3.3) { | ||
codes.push(`const { defineProps, defineEmits, defineExpose, defineOptions, defineSlots, defineModel, withDefaults } = await import('${vueCompilerOptions.lib}');\n`); | ||
const bindings = new Set(scriptSetupRanges.bindings.map(range => sfc.scriptSetup.content.substring(range.start, range.end))); | ||
codes.push('const { '); | ||
for (const [macro, aliases] of Object.entries(vueCompilerOptions.macros)) { | ||
for (const alias of aliases) { | ||
if (!bindings.has(alias)) { | ||
codes.push(macro); | ||
if (alias !== macro) { | ||
codes.push(` : ${alias}`); | ||
} | ||
codes.push(`, `); | ||
} | ||
} | ||
} | ||
codes.push(`} = await import('${vueCompilerOptions.lib}');\n`); | ||
} | ||
@@ -440,0 +453,0 @@ if (definePropProposalA) { |
@@ -68,3 +68,3 @@ "use strict"; | ||
const callText = node.expression.getText(ast); | ||
if (callText === 'defineModel') { | ||
if (vueCompilerOptions.macros.defineModel.includes(callText)) { | ||
let name; | ||
@@ -71,0 +71,0 @@ let options; |
@@ -26,2 +26,4 @@ import type * as CompilerDOM from '@vue/compiler-dom'; | ||
defineExpose: string[]; | ||
defineModel: string[]; | ||
defineOptions: string[]; | ||
withDefaults: string[]; | ||
@@ -28,0 +30,0 @@ }; |
@@ -228,3 +228,3 @@ "use strict"; | ||
: [`(await import('vue')).default.extend(`, `)`]), | ||
macros: vueOptions.macros ?? { | ||
macros: { | ||
defineProps: ['defineProps'], | ||
@@ -234,3 +234,6 @@ defineSlots: ['defineSlots'], | ||
defineExpose: ['defineExpose'], | ||
defineModel: ['defineModel'], | ||
defineOptions: ['defineOptions'], | ||
withDefaults: ['withDefaults'], | ||
...vueOptions.macros, | ||
}, | ||
@@ -237,0 +240,0 @@ plugins: vueOptions.plugins ?? [], |
{ | ||
"name": "@vue/language-core", | ||
"version": "1.8.10", | ||
"version": "1.8.11", | ||
"main": "out/index.js", | ||
@@ -37,3 +37,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "97d60fa475b653fe435a7fae6e2a626821658351" | ||
"gitHead": "cce193dcc182aad5d02f630fa3ae8a793d443680" | ||
} |
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
257532
5594