resuxjs 0.4.0 → 0.5.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cli.d.ts +2 -2
- package/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/dist/compiler/implementation.js +11 -2
- package/dist/compiler/index.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/runtime/index.d.ts +10 -2
- package/dist/runtime/index.js +353 -6
- package/dist/runtime/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1245,6 +1245,13 @@ function compileTemplateNode(node, state, options = {}) {
|
|
|
1245
1245
|
blockId: nextBindingId(state)
|
|
1246
1246
|
};
|
|
1247
1247
|
}
|
|
1248
|
+
if (node.tag === "component" && !element.if && !element.for) {
|
|
1249
|
+
const dynamicIs = node.props.find((prop) => prop.type === NodeTypes.DIRECTIVE && prop.name === "bind" && prop.arg?.type === NodeTypes.SIMPLE_EXPRESSION && prop.arg.content === "is");
|
|
1250
|
+
if (dynamicIs) element.if = {
|
|
1251
|
+
expression: registerTemplateExpression("true", state.templateRefBindings, state.file, dynamicIs, state),
|
|
1252
|
+
blockId: nextBindingId(state)
|
|
1253
|
+
};
|
|
1254
|
+
}
|
|
1248
1255
|
if (addedLocals > 0) state.activeLocals.splice(state.activeLocals.length - addedLocals, addedLocals);
|
|
1249
1256
|
return element;
|
|
1250
1257
|
}
|
|
@@ -1950,7 +1957,9 @@ function isResumableInitializer(node) {
|
|
|
1950
1957
|
"useResuxImage",
|
|
1951
1958
|
"usePackageReady",
|
|
1952
1959
|
"defineProps",
|
|
1953
|
-
"defineEmits"
|
|
1960
|
+
"defineEmits",
|
|
1961
|
+
"defineSlots",
|
|
1962
|
+
"defineModel"
|
|
1954
1963
|
].includes(node.expression.text);
|
|
1955
1964
|
}
|
|
1956
1965
|
if (ts.isAwaitExpression(node) && ts.isCallExpression(node.expression) && ts.isIdentifier(node.expression.expression)) {
|
|
@@ -2005,7 +2014,7 @@ function createComponentModuleSource(options) {
|
|
|
2005
2014
|
importsText,
|
|
2006
2015
|
`const __template = ${JSON.stringify(options.template, null, 2)};`,
|
|
2007
2016
|
`async function __rx_setup(__ctx) {`,
|
|
2008
|
-
`const { ref, reactive, computed, watch, watchEffect, readonly, toRef, toRefs, unref, isRef, isReactive, isReadonly, nextTick, useState, useAsyncData, useRoute, useRouter, useHead, useSeoMeta, useRuntimeConfig, useResuxApp, useResuxImage, apiURL, useFetch, $fetch, useError, clearError, showError, createError, useLazyPackage, useClientPackage, usePackageReady, defineLazyPackage, defineClientOnlyPackage, definePackageAdapter, defineClientEnhancement, useClientEnhancement, onMounted, definePageMeta, defineProps, defineEmits, useLocalePath, useSwitchLocalePath, useI18n, useDevice, $device, importComponent, scopeCache, devImportRevision, applyPatches } = __ctx;`,
|
|
2017
|
+
`const { ref, reactive, computed, watch, watchEffect, readonly, toRef, toRefs, unref, isRef, isReactive, isReadonly, nextTick, useState, useAsyncData, useRoute, useRouter, useHead, useSeoMeta, useRuntimeConfig, useResuxApp, useResuxImage, apiURL, useFetch, $fetch, useError, clearError, showError, createError, useLazyPackage, useClientPackage, usePackageReady, defineLazyPackage, defineClientOnlyPackage, definePackageAdapter, defineClientEnhancement, useClientEnhancement, onMounted, definePageMeta, defineProps, defineEmits, defineExpose, defineSlots, defineOptions, defineModel, useLocalePath, useSwitchLocalePath, useI18n, useDevice, $device, importComponent, scopeCache, devImportRevision, applyPatches } = __ctx;`,
|
|
2009
2018
|
options.analysis.setupBody,
|
|
2010
2019
|
`const __rx_expressions = {`,
|
|
2011
2020
|
expressionClosures,
|