wevu 7.4.0 → 7.5.0

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.
Files changed (227) hide show
  1. package/README.md +2 -0
  2. package/dist/dev/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/defineProperty.mjs +1 -1
  3. package/dist/dev/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/toPrimitive.mjs +1 -1
  4. package/dist/dev/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/toPropertyKey.mjs +1 -1
  5. package/dist/dev/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/typeof.mjs +1 -1
  6. package/dist/dev/package.mjs +1 -1
  7. package/dist/dev/reactivity/core.mjs +1 -1
  8. package/dist/dev/reactivity/ref.mjs +1 -1
  9. package/dist/dev/runtime/app/diagnostics.mjs +5 -1
  10. package/dist/dev/runtime/app/diagnostics.mjs.map +1 -1
  11. package/dist/dev/runtime/app/mount.mjs +8 -3
  12. package/dist/dev/runtime/app/mount.mjs.map +1 -1
  13. package/dist/dev/runtime/app/setData/commitTracker.mjs +39 -4
  14. package/dist/dev/runtime/app/setData/commitTracker.mjs.map +1 -1
  15. package/dist/dev/runtime/app/setData/observation.mjs +109 -0
  16. package/dist/dev/runtime/app/setData/observation.mjs.map +1 -0
  17. package/dist/dev/runtime/app/setData/scheduler.mjs +12 -1
  18. package/dist/dev/runtime/app/setData/scheduler.mjs.map +1 -1
  19. package/dist/dev/runtime/app/setDataOptions.mjs +1 -0
  20. package/dist/dev/runtime/app/setDataOptions.mjs.map +1 -1
  21. package/dist/dev/runtime/define/initialComputed.mjs +13 -12
  22. package/dist/dev/runtime/define/initialComputed.mjs.map +1 -1
  23. package/dist/dev/runtime/define/props.mjs +5 -1
  24. package/dist/dev/runtime/define/props.mjs.map +1 -1
  25. package/dist/dev/runtime/define/scopedSlotOptions.mjs +2 -1
  26. package/dist/dev/runtime/define/scopedSlotOptions.mjs.map +1 -1
  27. package/dist/dev/runtime/define.mjs +1 -1
  28. package/dist/dev/runtime/define.mjs.map +1 -1
  29. package/dist/dev/runtime/features/scopedSlots.mjs.map +1 -1
  30. package/dist/dev/runtime/register/component/props.mjs +14 -4
  31. package/dist/dev/runtime/register/component/props.mjs.map +1 -1
  32. package/dist/dev/runtime/register/component/registerDefinition.mjs +27 -17
  33. package/dist/dev/runtime/register/component/registerDefinition.mjs.map +1 -1
  34. package/dist/dev/runtime/register/component.mjs +2 -1
  35. package/dist/dev/runtime/register/component.mjs.map +1 -1
  36. package/dist/dev/runtime/register/runtimeInstance/methodBridge.mjs +14 -7
  37. package/dist/dev/runtime/register/runtimeInstance/methodBridge.mjs.map +1 -1
  38. package/dist/dev/runtime/register/runtimeInstance/nativeDeclaration.mjs +78 -0
  39. package/dist/dev/runtime/register/runtimeInstance/nativeDeclaration.mjs.map +1 -0
  40. package/dist/dev/runtime/register/runtimeInstance/provideContext.mjs +52 -8
  41. package/dist/dev/runtime/register/runtimeInstance/provideContext.mjs.map +1 -1
  42. package/dist/dev/runtime/register/runtimeInstance/utils.mjs.map +1 -1
  43. package/dist/dev/runtime/register/runtimeInstance.mjs +60 -19
  44. package/dist/dev/runtime/register/runtimeInstance.mjs.map +1 -1
  45. package/dist/fetch.mjs +1 -1
  46. package/dist/internal-template.mjs +1 -1
  47. package/dist/package.mjs +1 -1
  48. package/dist/reactivity/core.mjs +1 -1
  49. package/dist/reactivity/reactive/patch.mjs +1 -1
  50. package/dist/reactivity/reactive/patchState.mjs +1 -1
  51. package/dist/reactivity/ref.mjs +1 -1
  52. package/dist/reactivity/watch/helpers.mjs +1 -1
  53. package/dist/router/initialNavigation.mjs +1 -1
  54. package/dist/router/useRoute.mjs +1 -1
  55. package/dist/routerInternal/matching.mjs +1 -1
  56. package/dist/routerInternal/params.mjs +1 -1
  57. package/dist/routerInternal/path.mjs +1 -1
  58. package/dist/routerInternal/query.mjs +1 -1
  59. package/dist/routerInternal/records.mjs +1 -1
  60. package/dist/runtime/app/context.mjs +1 -1
  61. package/dist/runtime/app/diagnostics.mjs +1 -1
  62. package/dist/runtime/app/mount.mjs +1 -1
  63. package/dist/runtime/app/setData/commitTracker.d.mts +2 -1
  64. package/dist/runtime/app/setData/commitTracker.mjs +1 -1
  65. package/dist/runtime/app/setData/observation.d.mts +12 -0
  66. package/dist/runtime/app/setData/observation.mjs +1 -0
  67. package/dist/runtime/app/setData/scheduler.d.mts +1 -0
  68. package/dist/runtime/app/setData/scheduler.mjs +1 -1
  69. package/dist/runtime/app/setDataOptions.mjs +1 -1
  70. package/dist/runtime/define/initialComputed.mjs +1 -1
  71. package/dist/runtime/define/props.mjs +1 -1
  72. package/dist/runtime/define/scopedSlotOptions.mjs +1 -1
  73. package/dist/runtime/define.mjs +1 -1
  74. package/dist/runtime/diff.mjs +1 -1
  75. package/dist/runtime/features/publicLayout.mjs +1 -1
  76. package/dist/runtime/features/scopedSlots.d.mts +2 -1
  77. package/dist/runtime/jsxIsland.mjs +1 -1
  78. package/dist/runtime/pageLayout.mjs +1 -1
  79. package/dist/runtime/pageScroll.mjs +1 -1
  80. package/dist/runtime/register/component/alipayRegistration.mjs +1 -1
  81. package/dist/runtime/register/component/lifecycle.mjs +1 -1
  82. package/dist/runtime/register/component/props.mjs +1 -1
  83. package/dist/runtime/register/component/registerDefinition.mjs +1 -1
  84. package/dist/runtime/register/component/registerNativeDefinition.mjs +1 -1
  85. package/dist/runtime/register/component.mjs +1 -1
  86. package/dist/runtime/register/runtimeInstance/methodBridge.mjs +1 -1
  87. package/dist/runtime/register/runtimeInstance/nativeDeclaration.mjs +1 -0
  88. package/dist/runtime/register/runtimeInstance/provideContext.mjs +1 -1
  89. package/dist/runtime/register/runtimeInstance.d.mts +8 -4
  90. package/dist/runtime/register/runtimeInstance.mjs +1 -1
  91. package/dist/runtime/setupTracking.mjs +1 -1
  92. package/dist/runtime/templateRefs.mjs +1 -1
  93. package/dist/runtime/types/runtime.d.mts +1 -0
  94. package/dist/runtime/types/setData.d.mts +30 -0
  95. package/dist/scheduler.mjs +1 -1
  96. package/dist/web-apis.mjs +1 -1
  97. package/package.json +10 -9
  98. package/dist/dev/api/vitest/setup.d.mts +0 -1
  99. package/dist/dev/api/vitest.d.mts +0 -1
  100. package/dist/dev/api.d.mts +0 -1
  101. package/dist/dev/compiler.d.mts +0 -1
  102. package/dist/dev/fetch.d.mts +0 -9
  103. package/dist/dev/index.d.mts +0 -72
  104. package/dist/dev/internal-reactivity.d.mts +0 -18
  105. package/dist/dev/internal-runtime.d.mts +0 -45
  106. package/dist/dev/internal-template.d.mts +0 -2
  107. package/dist/dev/jsxTypes.d.mts +0 -9
  108. package/dist/dev/macros/shared.d.mts +0 -83
  109. package/dist/dev/macros.d.mts +0 -71
  110. package/dist/dev/reactivity/asyncDerivation.d.mts +0 -41
  111. package/dist/dev/reactivity/computed.d.mts +0 -25
  112. package/dist/dev/reactivity/core.d.mts +0 -35
  113. package/dist/dev/reactivity/index.d.mts +0 -16
  114. package/dist/dev/reactivity/reactive/mutation.d.mts +0 -21
  115. package/dist/dev/reactivity/reactive/patch.d.mts +0 -18
  116. package/dist/dev/reactivity/reactive/shallow.d.mts +0 -22
  117. package/dist/dev/reactivity/reactive/shared.d.mts +0 -4
  118. package/dist/dev/reactivity/reactive.d.mts +0 -42
  119. package/dist/dev/reactivity/readonly.d.mts +0 -27
  120. package/dist/dev/reactivity/ref.d.mts +0 -27
  121. package/dist/dev/reactivity/shallowRef.d.mts +0 -19
  122. package/dist/dev/reactivity/toRefs.d.mts +0 -43
  123. package/dist/dev/reactivity/traverse.d.mts +0 -8
  124. package/dist/dev/reactivity/watch/types.d.mts +0 -43
  125. package/dist/dev/reactivity/watch.d.mts +0 -22
  126. package/dist/dev/router/auto-routes.d.mts +0 -8
  127. package/dist/dev/router/createRouter.d.mts +0 -9
  128. package/dist/dev/router/navigationCore.d.mts +0 -7
  129. package/dist/dev/router/resolve.d.mts +0 -7
  130. package/dist/dev/router/routeSync.d.mts +0 -2
  131. package/dist/dev/router/scrollRestoration/adapters.d.mts +0 -8
  132. package/dist/dev/router/scrollRestoration/controller.d.mts +0 -8
  133. package/dist/dev/router/scrollRestoration/host.d.mts +0 -3
  134. package/dist/dev/router/scrollRestoration/index.d.mts +0 -9
  135. package/dist/dev/router/scrollRestoration/types.d.mts +0 -61
  136. package/dist/dev/router/types.d.mts +0 -267
  137. package/dist/dev/router/useRoute.d.mts +0 -20
  138. package/dist/dev/router/useRouter.d.mts +0 -9
  139. package/dist/dev/router.d.mts +0 -30
  140. package/dist/dev/routerInternal/location.d.mts +0 -2
  141. package/dist/dev/routerInternal/matching.d.mts +0 -2
  142. package/dist/dev/routerInternal/params.d.mts +0 -2
  143. package/dist/dev/routerInternal/query.d.mts +0 -7
  144. package/dist/dev/routerInternal/records.d.mts +0 -2
  145. package/dist/dev/routerInternal/recordsWarnings.d.mts +0 -2
  146. package/dist/dev/routerInternal/shared.d.mts +0 -9
  147. package/dist/dev/routerInternal/snapshots.d.mts +0 -2
  148. package/dist/dev/routerInternal/types.d.mts +0 -9
  149. package/dist/dev/runtime/app/pending.d.mts +0 -10
  150. package/dist/dev/runtime/app/setData/commitTracker.d.mts +0 -13
  151. package/dist/dev/runtime/app/setData/scheduler.d.mts +0 -51
  152. package/dist/dev/runtime/app.d.mts +0 -8
  153. package/dist/dev/runtime/capabilities.d.mts +0 -78
  154. package/dist/dev/runtime/css.d.mts +0 -14
  155. package/dist/dev/runtime/defaults.d.mts +0 -12
  156. package/dist/dev/runtime/define.d.mts +0 -118
  157. package/dist/dev/runtime/disposables.d.mts +0 -31
  158. package/dist/dev/runtime/elementIntersectionObserver.d.mts +0 -26
  159. package/dist/dev/runtime/features/inlineEvents.d.mts +0 -7
  160. package/dist/dev/runtime/features/jsxIslands.d.mts +0 -7
  161. package/dist/dev/runtime/features/layout.d.mts +0 -7
  162. package/dist/dev/runtime/features/patchStrategy.d.mts +0 -7
  163. package/dist/dev/runtime/features/publicLayout.d.mts +0 -24
  164. package/dist/dev/runtime/features/scopedSlots.d.mts +0 -23
  165. package/dist/dev/runtime/features/setDataHighFrequencyWarning.d.mts +0 -7
  166. package/dist/dev/runtime/features/templateRefs.d.mts +0 -7
  167. package/dist/dev/runtime/hooks/base.d.mts +0 -27
  168. package/dist/dev/runtime/hooks/register.d.mts +0 -30
  169. package/dist/dev/runtime/hooks/vue.d.mts +0 -52
  170. package/dist/dev/runtime/hooks.d.mts +0 -4
  171. package/dist/dev/runtime/index.d.mts +0 -46
  172. package/dist/dev/runtime/intersectionObserver.d.mts +0 -14
  173. package/dist/dev/runtime/jsxIsland.d.mts +0 -37
  174. package/dist/dev/runtime/layoutBridge.d.mts +0 -55
  175. package/dist/dev/runtime/noSetData.d.mts +0 -5
  176. package/dist/dev/runtime/pageEnvironment.d.mts +0 -50
  177. package/dist/dev/runtime/pageLayout.d.mts +0 -25
  178. package/dist/dev/runtime/pageScroll.d.mts +0 -29
  179. package/dist/dev/runtime/provide.d.mts +0 -60
  180. package/dist/dev/runtime/provideStore.d.mts +0 -7
  181. package/dist/dev/runtime/publicRuntime.d.mts +0 -22
  182. package/dist/dev/runtime/pullDownRefresh.d.mts +0 -12
  183. package/dist/dev/runtime/register/app.d.mts +0 -14
  184. package/dist/dev/runtime/register/component.d.mts +0 -17
  185. package/dist/dev/runtime/register/inline.d.mts +0 -15
  186. package/dist/dev/runtime/register/runtimeInstance.d.mts +0 -26
  187. package/dist/dev/runtime/register/setup.d.mts +0 -11
  188. package/dist/dev/runtime/register/watch.d.mts +0 -12
  189. package/dist/dev/runtime/register.d.mts +0 -5
  190. package/dist/dev/runtime/selectorQuery.d.mts +0 -54
  191. package/dist/dev/runtime/template.d.mts +0 -6
  192. package/dist/dev/runtime/templateRefTypes.d.mts +0 -12
  193. package/dist/dev/runtime/types/core.d.mts +0 -35
  194. package/dist/dev/runtime/types/miniprogram.d.mts +0 -84
  195. package/dist/dev/runtime/types/miniprogramHost.d.mts +0 -45
  196. package/dist/dev/runtime/types/miniprogramHostSources.d.mts +0 -112
  197. package/dist/dev/runtime/types/options.d.mts +0 -138
  198. package/dist/dev/runtime/types/props/propTypes.d.mts +0 -79
  199. package/dist/dev/runtime/types/props/router.d.mts +0 -51
  200. package/dist/dev/runtime/types/props/setup.d.mts +0 -96
  201. package/dist/dev/runtime/types/props.d.mts +0 -4
  202. package/dist/dev/runtime/types/runtime.d.mts +0 -59
  203. package/dist/dev/runtime/types/setData.d.mts +0 -237
  204. package/dist/dev/runtime/types.d.mts +0 -29
  205. package/dist/dev/runtime/uniAppHost.d.mts +0 -8
  206. package/dist/dev/runtime/updatePerformance.d.mts +0 -13
  207. package/dist/dev/runtime/use.d.mts +0 -13
  208. package/dist/dev/runtime/vueCompat/context.d.mts +0 -8
  209. package/dist/dev/runtime/vueCompat/model.d.mts +0 -30
  210. package/dist/dev/runtime/vueCompat/router.d.mts +0 -29
  211. package/dist/dev/runtime/vueCompat/templateRef.d.mts +0 -9
  212. package/dist/dev/runtime/vueCompat.d.mts +0 -5
  213. package/dist/dev/scheduler.d.mts +0 -4
  214. package/dist/dev/store/define.d.mts +0 -8
  215. package/dist/dev/store/manager.d.mts +0 -16
  216. package/dist/dev/store/storeToRefs.d.mts +0 -11
  217. package/dist/dev/store/types.d.mts +0 -106
  218. package/dist/dev/store.d.mts +0 -5
  219. package/dist/dev/version.d.mts +0 -4
  220. package/dist/dev/vue-augment.d.mts +0 -8
  221. package/dist/dev/vue-demi.d.mts +0 -87
  222. package/dist/dev/vue-types.d.mts +0 -19
  223. package/dist/dev/web-apis.d.mts +0 -3
  224. /package/dist/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/defineProperty.mjs +0 -0
  225. /package/dist/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/toPrimitive.mjs +0 -0
  226. /package/dist/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/toPropertyKey.mjs +0 -0
  227. /package/dist/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/typeof.mjs +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"runtimeInstance.mjs","names":["effectScope","createEffectScope"],"sources":["../../../../src/runtime/register/runtimeInstance.ts"],"sourcesContent":["import type { SetDataAdapterSettlement, SetDataAdapterSettler, SetDataPayload } from '../app/setData/commitTracker'\nimport type {\n ComponentPropsOptions,\n ComputedDefinitions,\n DefineAppOptions,\n DefineComponentOptions,\n InternalRuntimeState,\n MethodDefinitions,\n RuntimeApp,\n RuntimeInstance,\n SetDataSnapshotOptions,\n} from '../types'\nimport type { AdapterWithSetData } from './runtimeInstance/utils'\nimport type { WatchMap } from './watch'\nimport {\n WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY,\n WEVU_EFFECT_SCOPE_KEY,\n WEVU_EXPOSED_KEY,\n WEVU_HOOKS_KEY,\n WEVU_HOST_COMMIT_PROMISE_KEY,\n WEVU_ON_BEFORE_UNMOUNT_HOOK,\n WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY,\n WEVU_PROPS_DERIVED_KEYS_KEY,\n WEVU_PUBLIC_RUNTIME_KEY,\n WEVU_SETUP_CONTEXT_INSTANCE_KEY,\n WEVU_SLOT_OWNER_ID_KEY,\n WEVU_WATCH_STOPS_KEY,\n} from '@weapp-core/constants'\nimport { effectScope as createEffectScope, isReactive, isRef } from '../../reactivity'\nimport { observeSetDataCompletion } from '../app/setData/commitTracker'\nimport { applySnapshotUpdate, isDeepEqualValue } from '../app/setData/snapshot'\nimport {\n isSetDataHighFrequencyWarningRequested,\n requireRuntimeCapability,\n runtimeCapabilityRegistry,\n} from '../capabilities'\nimport { callHookList } from '../hooks'\nimport { getMiniProgramRuntimeGlobalObject } from '../platform'\nimport { runTeardownSteps } from '../teardown'\nimport { bridgeRuntimeMethodsToTarget } from './runtimeInstance/methodBridge'\nimport { attachRuntimeProvideParentContext } from './runtimeInstance/provideContext'\nimport {\n attachRuntimeSlots,\n createNoopWatchStopHandle,\n safeMarkNoSetData,\n} from './runtimeInstance/setupContext'\nimport { runRuntimeSetupPhase } from './runtimeInstance/setupPhase'\nimport { restoreReactiveSetupSnapshot } from './runtimeInstance/setupSnapshot'\nimport {\n attachNativeInstanceRef,\n attachRuntimeInstance,\n attachRuntimeRef,\n callNativeSetData,\n ensureRuntimeProps,\n resolveNativeSetData,\n} from './runtimeInstance/utils'\nimport { registerWatches } from './watch'\n\nconst initialReactiveSetupSnapshots = new WeakMap<object, Record<string, unknown>>()\n\nfunction cloneInitialSnapshotValue(value: unknown, cache = new WeakMap<object, unknown>()): unknown {\n if (!value || typeof value !== 'object') {\n return value\n }\n if (cache.has(value as object)) {\n return cache.get(value as object)\n }\n if (Array.isArray(value)) {\n const next: unknown[] = []\n cache.set(value, next)\n for (const item of value) {\n next.push(cloneInitialSnapshotValue(item, cache))\n }\n return next\n }\n const next: Record<string, unknown> = {}\n cache.set(value as object, next)\n for (const [key, child] of Object.entries(value as Record<string, unknown>)) {\n next[key] = cloneInitialSnapshotValue(child, cache)\n }\n return next\n}\nfunction mergeBufferedSetDataPayload(\n buffered: SetDataPayload | undefined,\n incoming: SetDataPayload,\n): SetDataPayload {\n const merged = buffered ?? {}\n for (const [path, value] of Object.entries(incoming)) {\n let ancestorPath: string | undefined\n for (const candidate of Object.keys(merged)) {\n if (path.startsWith(`${candidate}.`)) {\n ancestorPath = candidate\n break\n }\n }\n if (ancestorPath) {\n const holder: Record<string, unknown> = { value: merged[ancestorPath] }\n applySnapshotUpdate(\n holder,\n `value.${path.slice(ancestorPath.length + 1)}`,\n value,\n 'set',\n { cloneValue: false, clonedParents: new WeakSet<object>() },\n )\n merged[ancestorPath] = holder.value\n continue\n }\n const descendantPrefix = `${path}.`\n for (const candidate of Object.keys(merged)) {\n if (candidate.startsWith(descendantPrefix)) {\n delete merged[candidate]\n }\n }\n merged[path] = value\n }\n return merged\n}\n\nfunction resolveInitialSnapshotFromNativeData(\n target: InternalRuntimeState,\n omitKeys?: string[],\n extraEntries?: Record<string, unknown>,\n) {\n const data = (target as any).data\n if ((!data || typeof data !== 'object') && (!extraEntries || !Object.keys(extraEntries).length)) {\n return undefined\n }\n const omitSet = Array.isArray(omitKeys) && omitKeys.length\n ? new Set(omitKeys)\n : undefined\n const snapshot: Record<string, any> = {}\n if (data && typeof data === 'object') {\n for (const [key, value] of Object.entries(data as Record<string, unknown>)) {\n if (omitSet?.has(key)) {\n continue\n }\n snapshot[key] = cloneInitialSnapshotValue(value)\n }\n }\n if (extraEntries) {\n for (const [key, value] of Object.entries(extraEntries)) {\n if (omitSet?.has(key)) {\n continue\n }\n snapshot[key] = cloneInitialSnapshotValue(value)\n }\n }\n return snapshot\n}\n\nfunction hasTemplateRuntimeBindings(runtimeApp: RuntimeApp<any, any, any>) {\n return Boolean((runtimeApp as any)?.__wevuHasTemplateRuntimeBindings)\n}\n\ntype RuntimeSetupFunction<\n D extends object,\n C extends ComputedDefinitions,\n M extends MethodDefinitions,\n> = DefineComponentOptions<ComponentPropsOptions, D, C, M>['setup']\n | DefineAppOptions<D, C, M>['setup']\n\ntype RuntimeInstanceWithSyncFlush<\n D extends object,\n C extends ComputedDefinitions,\n M extends MethodDefinitions,\n> = RuntimeInstance<D, C, M> & {\n __wevu_flushSetupSnapshotSync?: () => void\n __wevu_touchSetupMethodsVersion?: () => void\n __wevu_trackSetupReactiveKey?: (key: string) => void\n __wevu_cloneDispatchedSnapshot?: () => Record<string, any>\n}\n\ninterface BufferedSetDataSettlement {\n settle: SetDataAdapterSettler\n next: BufferedSetDataSettlement | undefined\n}\n\n/**\n * 挂载运行时实例(框架内部注册流程使用)。\n * @internal\n */\nexport function mountRuntimeInstance<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(\n target: InternalRuntimeState,\n runtimeApp: RuntimeApp<D, C, M>,\n watchMap: WatchMap | undefined,\n setup?: RuntimeSetupFunction<D, C, M>,\n options?: { deferSetData?: boolean, snapshotOmitKeys?: string[] },\n) {\n if (target.__wevu) {\n return target.__wevu as RuntimeInstance<D, C, M>\n }\n const runtimeSetDataOptions = (\n runtimeApp as typeof runtimeApp & { __wevuSetDataOptions?: SetDataSnapshotOptions }\n ).__wevuSetDataOptions\n const hasScopedSlotBindings = hasTemplateRuntimeBindings(runtimeApp)\n const scopedSlotHooks = hasScopedSlotBindings\n ? requireRuntimeCapability('scopedSlots', 'mountRuntimeInstance(scoped-slot bindings)')\n : undefined\n const scopedSlotState = scopedSlotHooks?.prepareMount(target)\n const templateRefBindings = target.__wevuTemplateRefs\n if (Array.isArray(templateRefBindings) && templateRefBindings.length) {\n requireRuntimeCapability('templateRefs', 'mountRuntimeInstance(template refs)')\n }\n const highFrequencyWarningRequested = isSetDataHighFrequencyWarningRequested(\n runtimeSetDataOptions?.highFrequencyWarning,\n )\n const highFrequencyWarningHooks = highFrequencyWarningRequested\n ? requireRuntimeCapability('setDataHighFrequencyWarning', 'mountRuntimeInstance(setData.highFrequencyWarning)')\n : undefined\n attachRuntimeProvideParentContext(target, runtimeApp as RuntimeApp<any, any, any>)\n safeMarkNoSetData(target)\n const suspendWhenHidden = Boolean(runtimeSetDataOptions?.suspendWhenHidden)\n const targetLabel = typeof (target as any).route === 'string' && (target as any).route\n ? `page:${(target as any).route}`\n : typeof (target as any).is === 'string' && (target as any).is\n ? `component:${(target as any).is}`\n : 'unknown-target'\n const highFrequencyWarning = highFrequencyWarningHooks?.createMonitor({\n option: runtimeSetDataOptions?.highFrequencyWarning,\n targetLabel,\n isInPageScrollHook: () => Number((target as any)[WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY] ?? 0) > 0,\n })\n let visible = true\n let enabled = !options?.deferSetData\n let disposed = false\n let dispatchGeneration = 0\n let pendingPayload: SetDataPayload | undefined\n let pendingSettlementHead: BufferedSetDataSettlement | undefined\n let pendingSettlementTail: BufferedSetDataSettlement | undefined\n let pendingRawCallbacks: Array<() => void> = []\n const ownsHostCommit = !(WEVU_HOST_COMMIT_PROMISE_KEY in target)\n let pendingHostCommits = 0\n let hostCommitFailed = false\n let hostCommitCause: unknown\n let hostCommitPromise: Promise<void> | undefined\n let resolveHostCommit: (() => void) | undefined\n let rejectHostCommit: ((cause: unknown) => void) | undefined\n\n const resetHostCommitFailure = () => {\n if (!pendingHostCommits && !pendingPayload && !hostCommitPromise) {\n hostCommitFailed = false\n hostCommitCause = undefined\n }\n }\n const flushHostCommitWaiter = () => {\n if (pendingHostCommits || pendingPayload) {\n return\n }\n if (hostCommitFailed) {\n rejectHostCommit?.(hostCommitCause)\n }\n else {\n resolveHostCommit?.()\n }\n hostCommitPromise = undefined\n resolveHostCommit = undefined\n rejectHostCommit = undefined\n }\n const beginHostCommit = () => {\n if (ownsHostCommit) {\n pendingHostCommits += 1\n }\n }\n const finishHostCommit = (settlement: SetDataAdapterSettlement = 'committed', cause?: unknown) => {\n if (!ownsHostCommit || disposed) {\n return\n }\n if (settlement === 'failed' && !hostCommitFailed) {\n hostCommitFailed = true\n hostCommitCause = cause\n }\n pendingHostCommits -= 1\n flushHostCommitWaiter()\n }\n const failHostCommit = (cause: unknown) => finishHostCommit('failed', cause)\n if (ownsHostCommit) {\n Object.defineProperty(target, WEVU_HOST_COMMIT_PROMISE_KEY, {\n configurable: true,\n enumerable: false,\n get: () => {\n if (!pendingHostCommits && !pendingPayload) {\n return hostCommitFailed ? Promise.reject(hostCommitCause) : undefined\n }\n // 只有实例 $nextTick 消费宿主屏障时才创建 Promise。\n hostCommitPromise ??= new Promise<void>((resolve, reject) => {\n resolveHostCommit = resolve\n rejectHostCommit = reject\n })\n return hostCommitPromise\n },\n })\n }\n\n const refreshOwnerSnapshot = () => {\n if (scopedSlotState) {\n runtimeCapabilityRegistry.scopedSlots?.refresh(target, scopedSlotState)\n }\n }\n const completeSuccessfulSetData = () => {\n if (disposed) {\n return\n }\n const bindings = target.__wevuTemplateRefs\n if (!runtimeCapabilityRegistry.templateRefs && (!Array.isArray(bindings) || !bindings.length)) {\n if (ownsHostCommit) {\n finishHostCommit()\n }\n return\n }\n requireRuntimeCapability(\n 'templateRefs',\n 'mountRuntimeInstance(template ref completion)',\n ).schedule(\n target,\n ownsHostCommit ? finishHostCommit : undefined,\n target,\n ownsHostCommit ? failHostCommit : undefined,\n )\n }\n const syncNativeOwnerId = () => {\n if (scopedSlotState) {\n scopedSlotHooks?.syncNativeOwnerId(target, scopedSlotState)\n }\n }\n const appendPendingSettlement = (settle: SetDataAdapterSettler) => {\n const record: BufferedSetDataSettlement = {\n settle,\n next: undefined,\n }\n if (pendingSettlementTail) {\n pendingSettlementTail.next = record\n }\n else {\n pendingSettlementHead = record\n }\n pendingSettlementTail = record\n }\n const settlePendingRecords = (\n first: BufferedSetDataSettlement | undefined,\n settlement: SetDataAdapterSettlement,\n cause?: unknown,\n ) => {\n let current = first\n let isFirst = true\n while (current) {\n const next = current.next\n current.next = undefined\n if (settlement === 'failed' && !isFirst) {\n current.settle('abandoned')\n }\n else {\n current.settle(settlement, cause)\n }\n current = next\n isFirst = false\n }\n }\n const dispatchPhysicalSetData = (\n payload: SetDataPayload,\n settle: SetDataAdapterSettler,\n ) => {\n const generation = dispatchGeneration\n beginHostCommit()\n refreshOwnerSnapshot()\n observeSetDataCompletion({\n invoke: (callback) => {\n const setData = resolveNativeSetData(target)\n if (!setData) {\n callback()\n return undefined\n }\n return callNativeSetData(target, setData, payload, callback)\n },\n completion: 'callback',\n settle: (settlement, cause) => {\n if (disposed || generation !== dispatchGeneration) {\n return\n }\n if (settlement !== 'committed') {\n finishHostCommit(settlement, cause)\n settle(settlement, cause)\n return\n }\n // 物理提交已成功,但实例屏障仍需等待原始回调;回调失败不能回滚快照账本。\n try {\n settle(settlement, cause)\n }\n catch (error) {\n finishHostCommit('failed', error)\n throw error\n }\n completeSuccessfulSetData()\n },\n })\n }\n const flushPendingSetData = () => {\n if (!pendingPayload) {\n return\n }\n const payload = pendingPayload\n const settlements = pendingSettlementHead\n const rawCallbacks = pendingRawCallbacks\n pendingPayload = undefined\n pendingSettlementHead = undefined\n pendingSettlementTail = undefined\n pendingRawCallbacks = []\n dispatchPhysicalSetData(payload, (settlement, cause) => {\n if (settlement === 'committed') {\n try {\n for (const callback of rawCallbacks) {\n callback()\n }\n }\n finally {\n settlePendingRecords(settlements, settlement, cause)\n }\n return\n }\n settlePendingRecords(settlements, settlement, cause)\n })\n }\n const abandonPendingSetData = () => {\n const settlements = pendingSettlementHead\n pendingPayload = undefined\n pendingSettlementHead = undefined\n pendingSettlementTail = undefined\n pendingRawCallbacks = []\n settlePendingRecords(settlements, 'abandoned')\n flushHostCommitWaiter()\n }\n const bufferPayload = (payload: SetDataPayload) => {\n resetHostCommitFailure()\n pendingPayload = mergeBufferedSetDataPayload(pendingPayload, payload)\n }\n\n const adapter: AdapterWithSetData = {\n setData(payload: Record<string, any>, callback?: () => void) {\n highFrequencyWarning?.()\n if (!enabled || (suspendWhenHidden && !visible)) {\n bufferPayload(payload)\n if (callback) {\n pendingRawCallbacks.push(callback)\n }\n refreshOwnerSnapshot()\n return undefined\n }\n\n refreshOwnerSnapshot()\n resetHostCommitFailure()\n beginHostCommit()\n const setData = resolveNativeSetData(target)\n if (!setData) {\n try {\n callback?.()\n }\n catch (cause) {\n finishHostCommit('failed', cause)\n throw cause\n }\n completeSuccessfulSetData()\n return undefined\n }\n\n let invoking = true\n let callbackCalled = false\n let returnIsAuthoritative = false\n let successHandled = false\n const handleFailure = (cause: unknown) => {\n if (successHandled) {\n return\n }\n successHandled = true\n finishHostCommit('failed', cause)\n }\n const handleSuccess = () => {\n if (successHandled) {\n return\n }\n successHandled = true\n completeSuccessfulSetData()\n }\n const nativeCallback = () => {\n try {\n callback?.()\n }\n catch (cause) {\n handleFailure(cause)\n throw cause\n }\n if (invoking) {\n callbackCalled = true\n return\n }\n if (!returnIsAuthoritative) {\n handleSuccess()\n }\n }\n let result: void | Promise<void>\n try {\n result = callNativeSetData(target, setData, payload, nativeCallback)\n }\n catch (cause) {\n handleFailure(cause)\n throw cause\n }\n invoking = false\n returnIsAuthoritative = Boolean(result && typeof result.then === 'function')\n if (result && typeof result.then === 'function') {\n return result.then(\n () => {\n handleSuccess()\n },\n (cause) => {\n handleFailure(cause)\n throw cause\n },\n )\n }\n if (callbackCalled) {\n handleSuccess()\n }\n return result\n },\n __wevu_dispatchSetData(payload, settle) {\n highFrequencyWarning?.()\n if (disposed) {\n settle('abandoned')\n return\n }\n if (!enabled || (suspendWhenHidden && !visible)) {\n bufferPayload(payload)\n appendPendingSettlement(settle)\n refreshOwnerSnapshot()\n return\n }\n resetHostCommitFailure()\n dispatchPhysicalSetData(payload, settle)\n },\n __wevu_enableSetData(discardPending = false) {\n enabled = true\n if (discardPending) {\n abandonPendingSetData()\n return\n }\n flushPendingSetData()\n },\n __wevu_setVisibility(nextVisible: boolean) {\n visible = nextVisible\n if (visible && enabled) {\n flushPendingSetData()\n }\n },\n __wevu_disposeSetData() {\n if (disposed) {\n return\n }\n disposed = true\n dispatchGeneration += 1\n pendingPayload = undefined\n pendingSettlementHead = undefined\n pendingSettlementTail = undefined\n pendingRawCallbacks = []\n pendingHostCommits = 0\n hostCommitFailed = false\n hostCommitCause = undefined\n flushHostCommitWaiter()\n if (ownsHostCommit) {\n Reflect.deleteProperty(target, WEVU_HOST_COMMIT_PROMISE_KEY)\n }\n },\n }\n\n const baseMountAdapter = {\n ...adapter,\n }\n Object.defineProperty(baseMountAdapter, '__wevu_reportSetDataError', {\n configurable: true,\n enumerable: false,\n value: (error: Error) => {\n callHookList(target, 'onError', [error])\n },\n writable: false,\n })\n Object.defineProperty(baseMountAdapter, '__wevu_targetLabel', {\n configurable: true,\n enumerable: false,\n value: targetLabel,\n writable: false,\n })\n const targetProperties = (target as any).properties\n if (targetProperties && typeof targetProperties === 'object') {\n Object.defineProperty(baseMountAdapter, '__wevu_initialProps', {\n configurable: true,\n enumerable: false,\n value: targetProperties,\n writable: false,\n })\n }\n if (Array.isArray(options?.snapshotOmitKeys) && options.snapshotOmitKeys.length) {\n Object.defineProperty(baseMountAdapter, '__wevu_snapshotOmitKeys', {\n configurable: true,\n enumerable: false,\n value: options.snapshotOmitKeys,\n writable: false,\n })\n }\n const initialSnapshot = resolveInitialSnapshotFromNativeData(\n target,\n options?.snapshotOmitKeys,\n )\n if (initialSnapshot && Object.keys(initialSnapshot).length) {\n Object.defineProperty(baseMountAdapter, '__wevu_initialSnapshot', {\n configurable: true,\n enumerable: false,\n value: initialSnapshot,\n writable: false,\n })\n }\n if (scopedSlotState) {\n Object.defineProperty(baseMountAdapter, '__wevu_initialState', {\n configurable: true,\n enumerable: false,\n value: { [WEVU_SLOT_OWNER_ID_KEY]: scopedSlotState.ownerId },\n writable: false,\n })\n }\n const shouldDeferInitialSnapshot = Boolean(options?.deferSetData)\n || Boolean(setup)\n || Boolean(targetProperties && typeof targetProperties === 'object' && Object.keys(targetProperties).length > 0)\n if (shouldDeferInitialSnapshot) {\n Object.defineProperty(baseMountAdapter, '__wevu_deferInitialSnapshot', {\n configurable: true,\n enumerable: false,\n value: true,\n writable: false,\n })\n }\n const runtime = runtimeApp.mount(baseMountAdapter)\n attachRuntimeInstance(runtime as RuntimeInstance<any, any, any>, target)\n const runtimeProxy = runtime?.proxy ?? {}\n const runtimeState = runtime?.state ?? {}\n const runtimeSetupState = runtime?.setupState ?? Object.create(null)\n if (runtimeState && typeof runtimeState === 'object') {\n attachRuntimeRef(runtimeState as Record<string, any>, runtime)\n attachNativeInstanceRef(runtimeState as Record<string, any>, target)\n }\n const runtimeComputed = (runtime as any)?.computed ?? Object.create(null)\n // 防护:适配器可能返回不完整的 runtime(或被插件篡改),此处兜底补齐\n if (!runtime?.methods) {\n try {\n ;(runtime as any).methods = Object.create(null)\n }\n catch {\n // 若对象只读则忽略,后续将使用兜底 runtimeMethods\n }\n }\n const runtimeMethods = runtime?.methods ?? Object.create(null)\n const runtimeWatch = (runtime as any)?.watch ?? (() => createNoopWatchStopHandle())\n const runtimeBindModel = (runtime as any)?.bindModel ?? (() => {})\n const runtimeWithDefaults = {\n ...(runtime ?? {}),\n state: runtimeState,\n setupState: runtimeSetupState,\n proxy: runtimeProxy,\n methods: runtimeMethods,\n computed: runtimeComputed,\n watch: runtimeWatch,\n bindModel: runtimeBindModel,\n snapshot: (runtime as any)?.snapshot ?? (() => Object.create(null)),\n unmount: (runtime as any)?.unmount ?? (() => {}),\n } satisfies RuntimeInstance<any, any, any>\n Object.defineProperty(runtimeWithDefaults, '__wevu_initialRuntimeSnapshot', {\n configurable: true,\n enumerable: false,\n value: cloneInitialSnapshotValue(runtimeState),\n writable: false,\n })\n const runtimeWithSyncFlush = runtimeWithDefaults as RuntimeInstanceWithSyncFlush<D, C, M>\n const internalRuntimeFields = {\n __wevu_flushSetupSnapshotSync: (runtime as RuntimeInstanceWithSyncFlush<D, C, M>).__wevu_flushSetupSnapshotSync,\n __wevu_touchSetupMethodsVersion: (runtime as RuntimeInstanceWithSyncFlush<D, C, M>).__wevu_touchSetupMethodsVersion,\n __wevu_trackSetupReactiveKey: (runtime as RuntimeInstanceWithSyncFlush<D, C, M>).__wevu_trackSetupReactiveKey,\n __wevu_cloneDispatchedSnapshot: (runtime as RuntimeInstanceWithSyncFlush<D, C, M>).__wevu_cloneDispatchedSnapshot,\n [WEVU_PROPS_DERIVED_KEYS_KEY]: (runtime as any)[WEVU_PROPS_DERIVED_KEYS_KEY],\n }\n for (const [key, value] of Object.entries(internalRuntimeFields)) {\n if (!value) {\n continue\n }\n Object.defineProperty(runtimeWithDefaults, key, {\n configurable: true,\n enumerable: false,\n value,\n writable: true,\n })\n }\n\n Object.defineProperty(target, WEVU_PUBLIC_RUNTIME_KEY, {\n value: runtimeWithDefaults,\n configurable: true,\n enumerable: false,\n writable: false,\n })\n target.__wevu = runtimeWithDefaults\n const runtimeProps = ensureRuntimeProps(target, runtimeState as Record<string, any>)\n attachRuntimeSlots(runtimeState as Record<string, any>, runtimeProps)\n\n if (scopedSlotState) {\n scopedSlotHooks?.attachMount(target, runtimeWithDefaults, scopedSlotState, Boolean(options?.deferSetData))\n }\n syncNativeOwnerId()\n\n const watchStops = watchMap\n ? registerWatches(runtimeWithDefaults, watchMap, target, {\n deferMissingSourceBaseline: Boolean(setup),\n })\n : []\n if (watchStops.length) {\n target[WEVU_WATCH_STOPS_KEY] = watchStops\n }\n\n if (setup) {\n try {\n runRuntimeSetupPhase({\n target,\n runtime,\n runtimeWithDefaults,\n runtimeState: runtimeState as Record<string, any>,\n runtimeProxy: runtimeProxy as Record<string, any>,\n setup,\n })\n if (typeof getMiniProgramRuntimeGlobalObject()?.[WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY]?.trackWevuComponent === 'function') {\n const initialReactiveSetupSnapshot: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(runtimeWithDefaults.setupState ?? {})) {\n if (isReactive(value)) {\n initialReactiveSetupSnapshot[key] = cloneInitialSnapshotValue(value)\n }\n }\n initialReactiveSetupSnapshots.set(runtimeWithDefaults, initialReactiveSetupSnapshot)\n }\n if (!options?.deferSetData) {\n runtimeWithSyncFlush.__wevu_flushSetupSnapshotSync?.()\n }\n if (!options?.deferSetData) {\n refreshOwnerSnapshot()\n }\n for (const stop of watchStops) {\n stop.resume()\n }\n }\n catch (error) {\n try {\n // eslint-disable-next-line ts/no-use-before-define -- setup 失败后复用统一 teardown 回滚已安装运行时\n teardownRuntimeInstance(target, { skipHooks: true })\n }\n catch {\n // setup 异常优先,回滚异常不能覆盖原始失败。\n }\n throw error\n }\n }\n else if (\n !options?.deferSetData\n && (target as any).properties\n && typeof (target as any).properties === 'object'\n && Object.keys((target as any).properties).length > 0\n ) {\n runtimeWithSyncFlush.__wevu_flushSetupSnapshotSync?.()\n refreshOwnerSnapshot()\n }\n\n // 将 runtime.methods 透传到原生实例,供小程序事件处理直接调用\n bridgeRuntimeMethodsToTarget(target, runtime)\n\n return runtime\n}\n\nfunction preserveRuntimeFacadeIdentity<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(\n target: InternalRuntimeState,\n previousRuntime: RuntimeInstance<D, C, M>,\n nextRuntime: RuntimeInstance<D, C, M>,\n) {\n for (const key of Reflect.ownKeys(previousRuntime)) {\n if (!Reflect.has(nextRuntime, key)) {\n const descriptor = Reflect.getOwnPropertyDescriptor(previousRuntime, key)\n if (descriptor?.configurable) {\n Reflect.deleteProperty(previousRuntime, key)\n }\n }\n }\n for (const key of Reflect.ownKeys(nextRuntime)) {\n const descriptor = Reflect.getOwnPropertyDescriptor(nextRuntime, key)\n if (!descriptor) {\n continue\n }\n try {\n Reflect.defineProperty(previousRuntime, key, descriptor)\n }\n catch {\n try {\n ;(previousRuntime as any)[key] = (nextRuntime as any)[key]\n }\n catch {\n // 宿主包装对象仍持有旧 runtime 时,保留无法覆盖的只读字段。\n }\n }\n }\n attachRuntimeRef(previousRuntime.state as Record<string, any>, previousRuntime)\n const nextInitialSetupSnapshot = initialReactiveSetupSnapshots.get(nextRuntime)\n if (nextInitialSetupSnapshot) {\n initialReactiveSetupSnapshots.set(previousRuntime, nextInitialSetupSnapshot)\n }\n target.__wevu = previousRuntime\n Object.defineProperty(target, WEVU_PUBLIC_RUNTIME_KEY, {\n value: previousRuntime,\n configurable: true,\n enumerable: false,\n writable: false,\n })\n return previousRuntime\n}\n\nfunction createRuntimeStateSnapshot(\n runtime: RuntimeInstance<any, any, any>,\n nativeData: Record<string, any> | undefined,\n preferredState?: Record<string, any>,\n) {\n const runtimeState = runtime.state as Record<string, any>\n const setupState = runtime.setupState as Record<string, any> | undefined\n const snapshot: Record<string, any> = {}\n for (const key of Object.keys(nativeData ?? {})) {\n if (!Object.prototype.hasOwnProperty.call(runtimeState, key)) {\n continue\n }\n const setupBinding = setupState?.[key]\n if (setupState && Object.prototype.hasOwnProperty.call(setupState, key) && !isRef(setupBinding) && !isReactive(setupBinding)) {\n continue\n }\n if (preferredState && Object.prototype.hasOwnProperty.call(preferredState, key)) {\n snapshot[key] = cloneInitialSnapshotValue(preferredState[key])\n continue\n }\n snapshot[key] = cloneInitialSnapshotValue(isRef(setupBinding) ? setupBinding.value : runtimeState[key])\n }\n return snapshot\n}\n\nfunction syncRuntimeStateFromNativeData(\n target: InternalRuntimeState,\n options?: { includeSetupState?: boolean, nativeData?: Record<string, any>, initialSetupState?: Record<string, unknown> },\n) {\n const runtime = target.__wevu\n const runtimeState = runtime?.state as Record<string, any> | undefined\n const setupState = runtime?.setupState as Record<string, any> | undefined\n const nativeData = options?.nativeData ?? (target as any).data as Record<string, any> | undefined\n if (!runtimeState || typeof runtimeState !== 'object' || !nativeData || typeof nativeData !== 'object') {\n return\n }\n const initialRuntimeSnapshot = (runtime as any)?.__wevu_initialRuntimeSnapshot as Record<string, any> | undefined\n for (const [key, value] of Object.entries(nativeData)) {\n if (!key || key === 'undefined') {\n continue\n }\n if (Object.prototype.hasOwnProperty.call(runtimeState, key)) {\n try {\n const setupBinding = setupState?.[key]\n const runtimeValue = cloneInitialSnapshotValue(value)\n if (setupState && Object.prototype.hasOwnProperty.call(setupState, key)) {\n // 普通 setup 值来自当前代码;仅 ref/reactive 绑定承接宿主状态。\n if (!options?.includeSetupState || (!isRef(setupBinding) && !isReactive(setupBinding))) {\n continue\n }\n }\n if (\n !options?.includeSetupState\n && initialRuntimeSnapshot\n && Object.prototype.hasOwnProperty.call(initialRuntimeSnapshot, key)\n && !isDeepEqualValue(runtimeState[key], initialRuntimeSnapshot[key], 20, { keys: 10_000 })\n ) {\n continue\n }\n if (\n !options?.includeSetupState\n && initialRuntimeSnapshot\n && !Object.prototype.hasOwnProperty.call(initialRuntimeSnapshot, key)\n ) {\n continue\n }\n if (isRef(setupBinding)) {\n setupBinding.value = runtimeValue\n continue\n }\n if (isReactive(setupBinding) && runtimeValue && typeof runtimeValue === 'object') {\n restoreReactiveSetupSnapshot(setupBinding, runtimeValue, options?.initialSetupState?.[key])\n continue\n }\n runtimeState[key] = runtimeValue\n }\n catch {\n // DevTools 热更新期间可能带入响应式 state 拒绝写入的临时 data key,跳过即可。\n }\n }\n }\n}\n\nexport function enableDeferredSetData(\n target: InternalRuntimeState,\n options?: { rehydrateSetupState?: boolean },\n) {\n const adapter = target.__wevu?.adapter as AdapterWithSetData | undefined\n syncRuntimeStateFromNativeData(target, {\n includeSetupState: options?.rehydrateSetupState,\n })\n adapter?.__wevu_enableSetData?.(true)\n ;(target as any).__wevu?.__wevu_flushSetupSnapshotSync?.()\n}\n\nexport function setRuntimeSetDataVisibility(target: InternalRuntimeState, visible: boolean) {\n const adapter = target.__wevu?.adapter as AdapterWithSetData | undefined\n adapter?.__wevu_setVisibility?.(visible)\n}\n\n/**\n * 卸载运行时实例(框架内部注册流程使用)。\n * @internal\n */\nexport function teardownRuntimeInstance(target: InternalRuntimeState, options?: { skipHooks?: boolean }) {\n const runtime = target.__wevu\n\n const stops = target[WEVU_WATCH_STOPS_KEY]\n const effectScope = target[WEVU_EFFECT_SCOPE_KEY]\n\n runTeardownSteps([\n () => {\n if (!options?.skipHooks && runtime && target[WEVU_HOOKS_KEY]?.[WEVU_ON_BEFORE_UNMOUNT_HOOK]) {\n if (effectScope?.active) {\n effectScope.run(() => callHookList(target, WEVU_ON_BEFORE_UNMOUNT_HOOK))\n }\n else {\n const teardownScope = createEffectScope(true)\n runTeardownSteps([\n () => teardownScope.run(() => callHookList(target, WEVU_ON_BEFORE_UNMOUNT_HOOK)),\n () => teardownScope.stop(),\n ])\n }\n }\n },\n () => runtimeCapabilityRegistry.scopedSlots?.teardown(target),\n () => {\n if (Array.isArray(target.__wevuTemplateRefs) && target.__wevuTemplateRefs.length > 0) {\n requireRuntimeCapability('templateRefs', 'teardownRuntimeInstance(template refs)').clear(target)\n }\n },\n () => {\n // 触发卸载钩子(仅在 teardown 首次执行时触发)\n if (!options?.skipHooks && runtime && target[WEVU_HOOKS_KEY]) {\n callHookList(target, 'onUnload', [])\n }\n },\n () => {\n // 清理注册的生命周期钩子\n if (target[WEVU_HOOKS_KEY]) {\n target[WEVU_HOOKS_KEY] = undefined\n }\n },\n () => {\n if (Array.isArray(stops)) {\n for (const stop of stops) {\n try {\n stop()\n }\n catch {\n // 避免 teardown 中断:单个 stop 失败不阻塞其他清理\n }\n }\n }\n },\n () => {\n target[WEVU_WATCH_STOPS_KEY] = undefined\n },\n () => {\n effectScope?.stop()\n },\n () => {\n target[WEVU_EFFECT_SCOPE_KEY] = undefined\n },\n () => runtime?.unmount(),\n () => {\n const adapter = runtime?.adapter as AdapterWithSetData | undefined\n adapter?.__wevu_disposeSetData?.()\n },\n () => {\n delete (target as any)[WEVU_SETUP_CONTEXT_INSTANCE_KEY]\n delete (target as any)[WEVU_EXPOSED_KEY]\n },\n () => {\n delete target.__wevu\n },\n () => {\n if (WEVU_PUBLIC_RUNTIME_KEY in target) {\n delete (target as any)[WEVU_PUBLIC_RUNTIME_KEY]\n }\n },\n ])\n}\n\n/**\n * 重建运行时实例,同时保持宿主包装对象持有的 runtime facade 身份稳定。\n * @internal\n */\nexport function refreshRuntimeInstance<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(\n target: InternalRuntimeState,\n runtimeApp: RuntimeApp<D, C, M>,\n watchMap: WatchMap | undefined,\n setup?: RuntimeSetupFunction<D, C, M>,\n options?: { snapshotOmitKeys?: string[], stateSnapshot?: Record<string, any> },\n) {\n const previousRuntime = target.__wevu as RuntimeInstance<D, C, M> | undefined\n const initialSetupState = previousRuntime ? initialReactiveSetupSnapshots.get(previousRuntime) : undefined\n const previousRuntimeState = previousRuntime\n ? createRuntimeStateSnapshot(previousRuntime, (target as any).data, options?.stateSnapshot)\n : undefined\n teardownRuntimeInstance(target, { skipHooks: true })\n const nextRuntime = mountRuntimeInstance(target, runtimeApp, watchMap, setup, {\n deferSetData: true,\n snapshotOmitKeys: options?.snapshotOmitKeys,\n })\n const stateSnapshot = previousRuntimeState ?? (options?.stateSnapshot\n ? createRuntimeStateSnapshot(nextRuntime, options.stateSnapshot, options.stateSnapshot)\n : undefined)\n if (stateSnapshot) {\n const nativeData = (target as any).data\n if (nativeData && typeof nativeData === 'object') {\n Object.assign(nativeData, cloneInitialSnapshotValue(stateSnapshot))\n }\n syncRuntimeStateFromNativeData(target, {\n includeSetupState: true,\n nativeData: stateSnapshot,\n initialSetupState,\n })\n }\n if (!previousRuntime || previousRuntime === nextRuntime) {\n return nextRuntime\n }\n return preserveRuntimeFacadeIdentity(target, previousRuntime, nextRuntime)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA0DA,MAAM,gDAAgC,IAAI,QAAyC;AAEnF,SAAS,0BAA0B,OAAgB,wBAAQ,IAAI,QAAyB,GAAY;CAClG,IAAI,CAAC,SAAS,OAAO,UAAU,UAC7B,OAAO;CAET,IAAI,MAAM,IAAI,KAAe,GAC3B,OAAO,MAAM,IAAI,KAAe;CAElC,IAAI,MAAM,QAAQ,KAAK,GAAG;EACxB,MAAM,OAAkB,CAAC;EACzB,MAAM,IAAI,OAAO,IAAI;EACrB,KAAK,MAAM,QAAQ,OACjB,KAAK,KAAK,0BAA0B,MAAM,KAAK,CAAC;EAElD,OAAO;CACT;CACA,MAAM,OAAgC,CAAC;CACvC,MAAM,IAAI,OAAiB,IAAI;CAC/B,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,KAAgC,GACxE,KAAK,OAAO,0BAA0B,OAAO,KAAK;CAEpD,OAAO;AACT;AACA,SAAS,4BACP,UACA,UACgB;CAChB,MAAM,SAAS,YAAY,CAAC;CAC5B,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,QAAQ,GAAG;EACpD,IAAI;EACJ,KAAK,MAAM,aAAa,OAAO,KAAK,MAAM,GACxC,IAAI,KAAK,WAAW,GAAG,UAAU,EAAE,GAAG;GACpC,eAAe;GACf;EACF;EAEF,IAAI,cAAc;GAChB,MAAM,SAAkC,EAAE,OAAO,OAAO,cAAc;GACtE,oBACE,QACA,SAAS,KAAK,MAAM,aAAa,SAAS,CAAC,KAC3C,OACA,OACA;IAAE,YAAY;IAAO,+BAAe,IAAI,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O,wBAAwB;EACjC;QACM;GACJ,eAAa,KAAK;EACpB;QACM;GACJ,OAAO,yBAAyB;EAClC;QACM,SAAS,QAAQ;QACjB;GAEJ,CADgB,SAAS,QAClB,EAAE,wBAAwB;EACnC;QACM;GACJ,OAAQ,OAAe;GACvB,OAAQ,OAAe;EACzB;QACM;GACJ,OAAO,OAAO;EAChB;QACM;GACJ,IAAI,2BAA2B,QAC7B,OAAQ,OAAe;EAE3B;CACF,CAAC;AACH;;;;;AAMA,SAAgB,uBACd,QACA,YACA,UACA,OACA,SACA;CACA,MAAM,kBAAkB,OAAO;CAC/B,MAAM,oBAAoB,kBAAkB,8BAA8B,IAAI,eAAe,IAAI;CACjG,MAAM,uBAAuB,kBACzB,2BAA2B,iBAAkB,OAAe,MAAM,SAAS,aAAa,IACxF;CACJ,wBAAwB,QAAQ,EAAE,WAAW,KAAK,CAAC;CACnD,MAAM,cAAc,qBAAqB,QAAQ,YAAY,UAAU,OAAO;EAC5E,cAAc;EACd,kBAAkB,SAAS;CAC7B,CAAC;CACD,MAAM,gBAAgB,yBAAyB,SAAS,gBACpD,2BAA2B,aAAa,QAAQ,eAAe,QAAQ,aAAa,IACpF;CACJ,IAAI,eAAe;EACjB,MAAM,aAAc,OAAe;EACnC,IAAI,cAAc,OAAO,eAAe,UACtC,OAAO,OAAO,YAAY,0BAA0B,aAAa,CAAC;EAEpE,+BAA+B,QAAQ;GACrC,mBAAmB;GACnB,YAAY;GACZ;EACF,CAAC;CACH;CACA,IAAI,CAAC,mBAAmB,oBAAoB,aAC1C,OAAO;CAET,OAAO,8BAA8B,QAAQ,iBAAiB,WAAW;AAC3E"}
1
+ {"version":3,"file":"runtimeInstance.mjs","names":["effectScope","createEffectScope"],"sources":["../../../../src/runtime/register/runtimeInstance.ts"],"sourcesContent":["import type { SetDataAdapterSettlement, SetDataAdapterSettler, SetDataPayload } from '../app/setData/commitTracker'\nimport type { PhysicalSetDataObserver } from '../app/setData/observation'\nimport type {\n ComponentPropsOptions,\n ComputedDefinitions,\n DefineAppOptions,\n DefineComponentOptions,\n InternalRuntimeState,\n MethodDefinitions,\n RuntimeApp,\n RuntimeInstance,\n SetDataSnapshotOptions,\n} from '../types'\nimport type { AdapterWithSetData } from './runtimeInstance/utils'\nimport type { WatchMap } from './watch'\nimport {\n WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY,\n WEVU_EFFECT_SCOPE_KEY,\n WEVU_EXPOSED_KEY,\n WEVU_HOOKS_KEY,\n WEVU_HOST_COMMIT_PROMISE_KEY,\n WEVU_ON_BEFORE_UNMOUNT_HOOK,\n WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY,\n WEVU_PARENT_INSTANCE_KEY,\n WEVU_PROPS_DERIVED_KEYS_KEY,\n WEVU_PROVIDES_KEY,\n WEVU_PUBLIC_RUNTIME_KEY,\n WEVU_RUNTIME_APP_KEY,\n WEVU_SETUP_CONTEXT_INSTANCE_KEY,\n WEVU_SLOT_OWNER_ID_KEY,\n WEVU_WATCH_STOPS_KEY,\n} from '@weapp-core/constants'\nimport { effectScope as createEffectScope, isReactive, isRef } from '../../reactivity'\nimport { observeSetDataCompletion } from '../app/setData/commitTracker'\nimport { observePhysicalDispatch } from '../app/setData/observation'\nimport { applySnapshotUpdate, isDeepEqualValue } from '../app/setData/snapshot'\nimport {\n isSetDataHighFrequencyWarningRequested,\n requireRuntimeCapability,\n runtimeCapabilityRegistry,\n} from '../capabilities'\nimport { callHookList } from '../hooks'\nimport { isRuntimeLayoutComponentTarget } from '../layoutComponentMatcher'\nimport { getMiniProgramRuntimeGlobalObject } from '../platform'\nimport { runTeardownSteps } from '../teardown'\nimport { bridgeRuntimeMethodsToTarget } from './runtimeInstance/methodBridge'\nimport { releaseNativeDeclaration } from './runtimeInstance/nativeDeclaration'\nimport { attachRuntimeProvideParentContext } from './runtimeInstance/provideContext'\nimport {\n attachRuntimeSlots,\n createNoopWatchStopHandle,\n safeMarkNoSetData,\n} from './runtimeInstance/setupContext'\nimport { runRuntimeSetupPhase } from './runtimeInstance/setupPhase'\nimport { restoreReactiveSetupSnapshot } from './runtimeInstance/setupSnapshot'\nimport {\n attachNativeInstanceRef,\n attachRuntimeInstance,\n attachRuntimeRef,\n callNativeSetData,\n ensureRuntimeProps,\n resolveNativeSetData,\n} from './runtimeInstance/utils'\nimport { registerWatches } from './watch'\n\ntype ImportMetaWithEnv = ImportMeta & { env?: { PLATFORM?: string, PROD?: boolean } }\n\nconst initialReactiveSetupSnapshots = new WeakMap<object, Record<string, unknown>>()\n\nfunction cloneInitialSnapshotValue(value: unknown, cache = new WeakMap<object, unknown>()): unknown {\n if (!value || typeof value !== 'object') {\n return value\n }\n if (cache.has(value as object)) {\n return cache.get(value as object)\n }\n if (Array.isArray(value)) {\n const next: unknown[] = []\n cache.set(value, next)\n for (const item of value) {\n next.push(cloneInitialSnapshotValue(item, cache))\n }\n return next\n }\n const next: Record<string, unknown> = {}\n cache.set(value as object, next)\n for (const [key, child] of Object.entries(value as Record<string, unknown>)) {\n next[key] = cloneInitialSnapshotValue(child, cache)\n }\n return next\n}\nfunction mergeBufferedSetDataPayload(\n buffered: SetDataPayload | undefined,\n incoming: SetDataPayload,\n): SetDataPayload {\n const merged = buffered ?? {}\n for (const [path, value] of Object.entries(incoming)) {\n let ancestorPath: string | undefined\n for (const candidate of Object.keys(merged)) {\n if (path.startsWith(`${candidate}.`)) {\n ancestorPath = candidate\n break\n }\n }\n if (ancestorPath) {\n const holder: Record<string, unknown> = { value: merged[ancestorPath] }\n applySnapshotUpdate(\n holder,\n `value.${path.slice(ancestorPath.length + 1)}`,\n value,\n 'set',\n { cloneValue: false, clonedParents: new WeakSet<object>() },\n )\n merged[ancestorPath] = holder.value\n continue\n }\n const descendantPrefix = `${path}.`\n for (const candidate of Object.keys(merged)) {\n if (candidate.startsWith(descendantPrefix)) {\n delete merged[candidate]\n }\n }\n merged[path] = value\n }\n return merged\n}\n\nfunction resolveInitialSnapshotFromNativeData(\n target: InternalRuntimeState,\n omitKeys?: string[],\n extraEntries?: Record<string, unknown>,\n) {\n const data = (target as any).data\n if ((!data || typeof data !== 'object') && (!extraEntries || !Object.keys(extraEntries).length)) {\n return undefined\n }\n const omitSet = Array.isArray(omitKeys) && omitKeys.length\n ? new Set(omitKeys)\n : undefined\n const snapshot: Record<string, any> = {}\n if (data && typeof data === 'object') {\n for (const [key, value] of Object.entries(data as Record<string, unknown>)) {\n if (omitSet?.has(key)) {\n continue\n }\n snapshot[key] = cloneInitialSnapshotValue(value)\n }\n }\n if (extraEntries) {\n for (const [key, value] of Object.entries(extraEntries)) {\n if (omitSet?.has(key)) {\n continue\n }\n snapshot[key] = cloneInitialSnapshotValue(value)\n }\n }\n return snapshot\n}\n\nfunction hasTemplateRuntimeBindings(runtimeApp: RuntimeApp<any, any, any>) {\n return Boolean((runtimeApp as any)?.__wevuHasTemplateRuntimeBindings)\n}\n\ntype RuntimeSetupFunction<\n D extends object,\n C extends ComputedDefinitions,\n M extends MethodDefinitions,\n> = DefineComponentOptions<ComponentPropsOptions, D, C, M>['setup']\n | DefineAppOptions<D, C, M>['setup']\n\ntype RuntimeInstanceWithSyncFlush<\n D extends object,\n C extends ComputedDefinitions,\n M extends MethodDefinitions,\n> = RuntimeInstance<D, C, M> & {\n __wevu_flushSetupSnapshotSync?: () => void\n __wevu_touchSetupMethodsVersion?: () => void\n __wevu_trackSetupReactiveKey?: (key: string) => void\n __wevu_cloneDispatchedSnapshot?: () => Record<string, any>\n}\n\ninterface BufferedSetDataSettlement {\n settle: SetDataAdapterSettler\n next: BufferedSetDataSettlement | undefined\n}\n\ninterface RuntimeMountOptions {\n deferSetData?: boolean\n snapshotOmitKeys?: string[]\n attached?: boolean\n layoutParent?: InternalRuntimeState\n}\n\n/**\n * 挂载运行时实例(框架内部注册流程使用)。\n * @internal\n */\nexport function mountRuntimeInstance<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(\n target: InternalRuntimeState,\n runtimeApp: RuntimeApp<D, C, M>,\n watchMap: WatchMap | undefined,\n setup?: RuntimeSetupFunction<D, C, M>,\n options?: RuntimeMountOptions,\n): RuntimeInstance<D, C, M> {\n if (target.__wevu) {\n // 经典 HMR 可能复用宿主页面实例并重新执行页面脚本。此时旧 runtime\n // 仍然存在,但它绑定的是上一轮模块创建的 runtimeApp;继续直接返回会\n // 让新脚本闭包更新一份未被旧 tracker 订阅的 setup 状态。通过统一刷新\n // 路径重建响应式绑定,同时保留宿主实例和已提交的数据快照。\n // 只在应用明确为生产构建时裁剪;未提供 Vite env 的消费者保留刷新兼容。\n if ((import.meta as ImportMetaWithEnv).env?.PROD !== true && target[WEVU_RUNTIME_APP_KEY] && target[WEVU_RUNTIME_APP_KEY] !== runtimeApp) {\n // eslint-disable-next-line ts/no-use-before-define -- refreshRuntimeInstance 统一处理旧实例快照与 facade 复用。\n return refreshRuntimeInstance(target, runtimeApp, watchMap, setup, {\n snapshotOmitKeys: options?.snapshotOmitKeys,\n attached: options?.attached,\n })\n }\n return target.__wevu as RuntimeInstance<D, C, M>\n }\n try {\n // eslint-disable-next-line ts/no-use-before-define -- 统一事务边界覆盖声明注册后、setup 前的挂载失败。\n return mountRuntimeInstanceWithContext(target, runtimeApp, watchMap, setup, options)\n }\n catch (error) {\n try {\n // eslint-disable-next-line ts/no-use-before-define -- 所有挂载失败共用 teardown,不能留下原生声明地址。\n teardownRuntimeInstance(target, { skipHooks: true })\n }\n catch {\n // 保留原始挂载异常,清理异常不能覆盖它。\n }\n throw error\n }\n}\n\nfunction mountRuntimeInstanceWithContext<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(\n target: InternalRuntimeState,\n runtimeApp: RuntimeApp<D, C, M>,\n watchMap: WatchMap | undefined,\n setup?: RuntimeSetupFunction<D, C, M>,\n options?: RuntimeMountOptions,\n) {\n const runtimeSetDataOptions = (\n runtimeApp as typeof runtimeApp & { __wevuSetDataOptions?: SetDataSnapshotOptions }\n ).__wevuSetDataOptions\n const hasScopedSlotBindings = hasTemplateRuntimeBindings(runtimeApp)\n const scopedSlotHooks = hasScopedSlotBindings\n ? requireRuntimeCapability('scopedSlots', 'mountRuntimeInstance(scoped-slot bindings)')\n : undefined\n const scopedSlotState = scopedSlotHooks?.prepareMount(target)\n const templateRefBindings = target.__wevuTemplateRefs\n if (Array.isArray(templateRefBindings) && templateRefBindings.length) {\n requireRuntimeCapability('templateRefs', 'mountRuntimeInstance(template refs)')\n }\n const highFrequencyWarningRequested = isSetDataHighFrequencyWarningRequested(\n runtimeSetDataOptions?.highFrequencyWarning,\n )\n const highFrequencyWarningHooks = highFrequencyWarningRequested\n ? requireRuntimeCapability('setDataHighFrequencyWarning', 'mountRuntimeInstance(setData.highFrequencyWarning)')\n : undefined\n attachRuntimeProvideParentContext(target, runtimeApp, options?.attached, options?.layoutParent)\n safeMarkNoSetData(target)\n const suspendWhenHidden = Boolean(runtimeSetDataOptions?.suspendWhenHidden)\n const targetLabel = typeof (target as any).route === 'string' && (target as any).route\n ? `page:${(target as any).route}`\n : typeof (target as any).is === 'string' && (target as any).is\n ? `component:${(target as any).is}`\n : 'unknown-target'\n const highFrequencyWarning = highFrequencyWarningHooks?.createMonitor({\n option: runtimeSetDataOptions?.highFrequencyWarning,\n targetLabel,\n isInPageScrollHook: () => Number((target as any)[WEVU_PAGE_SCROLL_HOOK_DEPTH_KEY] ?? 0) > 0,\n })\n let visible = true\n let enabled = !options?.deferSetData\n let disposed = false\n let dispatchGeneration = 0\n let pendingPayload: SetDataPayload | undefined\n let pendingSettlementHead: BufferedSetDataSettlement | undefined\n let pendingSettlementTail: BufferedSetDataSettlement | undefined\n let pendingObservers: PhysicalSetDataObserver[] | undefined\n let pendingRawCallbacks: Array<() => void> = []\n const ownsHostCommit = !(WEVU_HOST_COMMIT_PROMISE_KEY in target)\n let pendingHostCommits = 0\n let hostCommitFailed = false\n let hostCommitCause: unknown\n let hostCommitPromise: Promise<void> | undefined\n let resolveHostCommit: (() => void) | undefined\n let rejectHostCommit: ((cause: unknown) => void) | undefined\n\n const resetHostCommitFailure = () => {\n if (!pendingHostCommits && !pendingPayload && !hostCommitPromise) {\n hostCommitFailed = false\n hostCommitCause = undefined\n }\n }\n const flushHostCommitWaiter = () => {\n if (pendingHostCommits || pendingPayload) {\n return\n }\n if (hostCommitFailed) {\n rejectHostCommit?.(hostCommitCause)\n }\n else {\n resolveHostCommit?.()\n }\n hostCommitPromise = undefined\n resolveHostCommit = undefined\n rejectHostCommit = undefined\n }\n const beginHostCommit = () => {\n if (ownsHostCommit) {\n pendingHostCommits += 1\n }\n }\n const finishHostCommit = (settlement: SetDataAdapterSettlement = 'committed', cause?: unknown) => {\n if (!ownsHostCommit || disposed) {\n return\n }\n if (settlement === 'failed' && !hostCommitFailed) {\n hostCommitFailed = true\n hostCommitCause = cause\n }\n pendingHostCommits -= 1\n flushHostCommitWaiter()\n }\n const failHostCommit = (cause: unknown) => finishHostCommit('failed', cause)\n if (ownsHostCommit) {\n Object.defineProperty(target, WEVU_HOST_COMMIT_PROMISE_KEY, {\n configurable: true,\n enumerable: false,\n get: () => {\n if (!pendingHostCommits && !pendingPayload) {\n return hostCommitFailed ? Promise.reject(hostCommitCause) : undefined\n }\n // 只有实例 $nextTick 消费宿主屏障时才创建 Promise。\n hostCommitPromise ??= new Promise<void>((resolve, reject) => {\n resolveHostCommit = resolve\n rejectHostCommit = reject\n })\n return hostCommitPromise\n },\n })\n }\n\n const refreshOwnerSnapshot = () => {\n if (scopedSlotState) {\n runtimeCapabilityRegistry.scopedSlots?.refresh(target, scopedSlotState)\n }\n }\n const completeSuccessfulSetData = () => {\n if (disposed) {\n return\n }\n const bindings = target.__wevuTemplateRefs\n if (!runtimeCapabilityRegistry.templateRefs && (!Array.isArray(bindings) || !bindings.length)) {\n if (ownsHostCommit) {\n finishHostCommit()\n }\n return\n }\n requireRuntimeCapability(\n 'templateRefs',\n 'mountRuntimeInstance(template ref completion)',\n ).schedule(\n target,\n ownsHostCommit ? finishHostCommit : undefined,\n target,\n ownsHostCommit ? failHostCommit : undefined,\n )\n }\n const syncNativeOwnerId = () => {\n if (scopedSlotState) {\n scopedSlotHooks?.syncNativeOwnerId(target, scopedSlotState)\n }\n }\n const appendPendingSettlement = (settle: SetDataAdapterSettler, observer?: PhysicalSetDataObserver) => {\n const record: BufferedSetDataSettlement = {\n settle,\n next: undefined,\n }\n if (pendingSettlementTail) {\n pendingSettlementTail.next = record\n }\n else {\n pendingSettlementHead = record\n }\n pendingSettlementTail = record\n if (observer) {\n (pendingObservers ??= []).push(observer)\n }\n }\n const settlePendingRecords = (\n first: BufferedSetDataSettlement | undefined,\n settlement: SetDataAdapterSettlement,\n cause?: unknown,\n ) => {\n let current = first\n let isFirst = true\n while (current) {\n const next = current.next\n current.next = undefined\n if (settlement === 'failed' && !isFirst) {\n current.settle('abandoned')\n }\n else {\n current.settle(settlement, cause)\n }\n current = next\n isFirst = false\n }\n }\n const dispatchPhysicalSetData = (\n payload: SetDataPayload,\n settle: SetDataAdapterSettler,\n observer?: PhysicalSetDataObserver,\n ) => {\n const generation = dispatchGeneration\n beginHostCommit()\n refreshOwnerSnapshot()\n observeSetDataCompletion({\n observer,\n invoke: (callback) => {\n const setData = resolveNativeSetData(target)\n if (!setData) {\n callback()\n return undefined\n }\n if (observer) {\n observePhysicalDispatch(observer, payload)\n }\n return callNativeSetData(target, setData, payload, callback)\n },\n completion: 'callback',\n settle: (settlement, cause) => {\n if (disposed || generation !== dispatchGeneration) {\n return\n }\n if (settlement !== 'committed') {\n finishHostCommit(settlement, cause)\n settle(settlement, cause)\n return\n }\n // 物理提交已成功,但实例屏障仍需等待原始回调;回调失败不能回滚快照账本。\n try {\n settle(settlement, cause)\n }\n catch (error) {\n finishHostCommit('failed', error)\n throw error\n }\n completeSuccessfulSetData()\n },\n })\n }\n const flushPendingSetData = () => {\n if (!pendingPayload) {\n return\n }\n const payload = pendingPayload\n const settlements = pendingSettlementHead\n const rawCallbacks = pendingRawCallbacks\n pendingPayload = undefined\n pendingSettlementHead = undefined\n pendingSettlementTail = undefined\n pendingRawCallbacks = []\n const observers = pendingObservers\n pendingObservers = undefined\n const observer: PhysicalSetDataObserver | undefined = observers && {\n dispatch: info => observers.forEach(item => item.dispatch(info)),\n returned: returnedAt => observers.forEach(item => item.returned(returnedAt)),\n complete: boundary => observers.forEach(item => item.complete(boundary)),\n }\n dispatchPhysicalSetData(payload, (settlement, cause) => {\n if (settlement === 'committed') {\n try {\n for (const callback of rawCallbacks) {\n callback()\n }\n }\n finally {\n settlePendingRecords(settlements, settlement, cause)\n }\n return\n }\n settlePendingRecords(settlements, settlement, cause)\n }, observer)\n }\n const abandonPendingSetData = () => {\n pendingObservers = undefined\n const settlements = pendingSettlementHead\n pendingPayload = undefined\n pendingSettlementHead = undefined\n pendingSettlementTail = undefined\n pendingRawCallbacks = []\n settlePendingRecords(settlements, 'abandoned')\n flushHostCommitWaiter()\n }\n const bufferPayload = (payload: SetDataPayload) => {\n resetHostCommitFailure()\n pendingPayload = mergeBufferedSetDataPayload(pendingPayload, payload)\n }\n\n const adapter: AdapterWithSetData = {\n setData(payload: Record<string, any>, callback?: () => void) {\n highFrequencyWarning?.()\n if (!enabled || (suspendWhenHidden && !visible)) {\n bufferPayload(payload)\n if (callback) {\n pendingRawCallbacks.push(callback)\n }\n refreshOwnerSnapshot()\n return undefined\n }\n\n refreshOwnerSnapshot()\n resetHostCommitFailure()\n beginHostCommit()\n const setData = resolveNativeSetData(target)\n if (!setData) {\n try {\n callback?.()\n }\n catch (cause) {\n finishHostCommit('failed', cause)\n throw cause\n }\n completeSuccessfulSetData()\n return undefined\n }\n\n let invoking = true\n let callbackCalled = false\n let returnIsAuthoritative = false\n let successHandled = false\n const handleFailure = (cause: unknown) => {\n if (successHandled) {\n return\n }\n successHandled = true\n finishHostCommit('failed', cause)\n }\n const handleSuccess = () => {\n if (successHandled) {\n return\n }\n successHandled = true\n completeSuccessfulSetData()\n }\n const nativeCallback = () => {\n try {\n callback?.()\n }\n catch (cause) {\n handleFailure(cause)\n throw cause\n }\n if (invoking) {\n callbackCalled = true\n return\n }\n if (!returnIsAuthoritative) {\n handleSuccess()\n }\n }\n let result: void | Promise<void>\n try {\n result = callNativeSetData(target, setData, payload, nativeCallback)\n }\n catch (cause) {\n handleFailure(cause)\n throw cause\n }\n invoking = false\n returnIsAuthoritative = Boolean(result && typeof result.then === 'function')\n if (result && typeof result.then === 'function') {\n return result.then(\n () => {\n handleSuccess()\n },\n (cause) => {\n handleFailure(cause)\n throw cause\n },\n )\n }\n if (callbackCalled) {\n handleSuccess()\n }\n return result\n },\n __wevu_dispatchSetData(payload, settle, observer) {\n highFrequencyWarning?.()\n if (disposed) {\n settle('abandoned')\n return\n }\n if (!enabled || (suspendWhenHidden && !visible)) {\n bufferPayload(payload)\n appendPendingSettlement(settle, observer)\n refreshOwnerSnapshot()\n return\n }\n resetHostCommitFailure()\n dispatchPhysicalSetData(payload, settle, observer)\n },\n __wevu_enableSetData(discardPending = false) {\n enabled = true\n if (discardPending) {\n abandonPendingSetData()\n return\n }\n flushPendingSetData()\n },\n __wevu_setVisibility(nextVisible: boolean) {\n visible = nextVisible\n if (visible && enabled) {\n flushPendingSetData()\n }\n },\n __wevu_disposeSetData() {\n if (disposed) {\n return\n }\n disposed = true\n dispatchGeneration += 1\n pendingPayload = undefined\n pendingSettlementHead = undefined\n pendingSettlementTail = undefined\n pendingRawCallbacks = []\n pendingHostCommits = 0\n hostCommitFailed = false\n hostCommitCause = undefined\n flushHostCommitWaiter()\n if (ownsHostCommit) {\n Reflect.deleteProperty(target, WEVU_HOST_COMMIT_PROMISE_KEY)\n }\n },\n }\n\n const baseMountAdapter = {\n ...adapter,\n }\n Object.defineProperty(baseMountAdapter, '__wevu_reportSetDataError', {\n configurable: true,\n enumerable: false,\n value: (error: Error) => {\n callHookList(target, 'onError', [error])\n },\n writable: false,\n })\n Object.defineProperty(baseMountAdapter, '__wevu_targetLabel', {\n configurable: true,\n enumerable: false,\n value: targetLabel,\n writable: false,\n })\n const targetProperties = (target as any).properties\n if (targetProperties && typeof targetProperties === 'object') {\n Object.defineProperty(baseMountAdapter, '__wevu_initialProps', {\n configurable: true,\n enumerable: false,\n value: targetProperties,\n writable: false,\n })\n }\n if (Array.isArray(options?.snapshotOmitKeys) && options.snapshotOmitKeys.length) {\n Object.defineProperty(baseMountAdapter, '__wevu_snapshotOmitKeys', {\n configurable: true,\n enumerable: false,\n value: options.snapshotOmitKeys,\n writable: false,\n })\n }\n const initialSnapshot = resolveInitialSnapshotFromNativeData(\n target,\n options?.snapshotOmitKeys,\n )\n if (initialSnapshot && Object.keys(initialSnapshot).length) {\n Object.defineProperty(baseMountAdapter, '__wevu_initialSnapshot', {\n configurable: true,\n enumerable: false,\n value: initialSnapshot,\n writable: false,\n })\n }\n if (scopedSlotState) {\n Object.defineProperty(baseMountAdapter, '__wevu_initialState', {\n configurable: true,\n enumerable: false,\n value: { [WEVU_SLOT_OWNER_ID_KEY]: scopedSlotState.ownerId },\n writable: false,\n })\n }\n const shouldDeferInitialSnapshot = Boolean(options?.deferSetData)\n || Boolean(setup)\n || Boolean(targetProperties && typeof targetProperties === 'object' && Object.keys(targetProperties).length > 0)\n if (shouldDeferInitialSnapshot) {\n Object.defineProperty(baseMountAdapter, '__wevu_deferInitialSnapshot', {\n configurable: true,\n enumerable: false,\n value: true,\n writable: false,\n })\n }\n const runtime = runtimeApp.mount(baseMountAdapter)\n attachRuntimeInstance(runtime as RuntimeInstance<any, any, any>, target)\n const runtimeProxy = runtime?.proxy ?? {}\n const runtimeState = runtime?.state ?? {}\n const runtimeSetupState = runtime?.setupState ?? Object.create(null)\n if (runtimeState && typeof runtimeState === 'object') {\n attachRuntimeRef(runtimeState as Record<string, any>, runtime)\n attachNativeInstanceRef(runtimeState as Record<string, any>, target)\n }\n const runtimeComputed = (runtime as any)?.computed ?? Object.create(null)\n // 防护:适配器可能返回不完整的 runtime(或被插件篡改),此处兜底补齐\n if (!runtime?.methods) {\n try {\n ;(runtime as any).methods = Object.create(null)\n }\n catch {\n // 若对象只读则忽略,后续将使用兜底 runtimeMethods\n }\n }\n const runtimeMethods = runtime?.methods ?? Object.create(null)\n const runtimeWatch = (runtime as any)?.watch ?? (() => createNoopWatchStopHandle())\n const runtimeBindModel = (runtime as any)?.bindModel ?? (() => {})\n const runtimeWithDefaults = {\n ...(runtime ?? {}),\n state: runtimeState,\n setupState: runtimeSetupState,\n proxy: runtimeProxy,\n methods: runtimeMethods,\n computed: runtimeComputed,\n watch: runtimeWatch,\n bindModel: runtimeBindModel,\n snapshot: (runtime as any)?.snapshot ?? (() => Object.create(null)),\n unmount: (runtime as any)?.unmount ?? (() => {}),\n } satisfies RuntimeInstance<any, any, any>\n Object.defineProperty(runtimeWithDefaults, '__wevu_initialRuntimeSnapshot', {\n configurable: true,\n enumerable: false,\n value: cloneInitialSnapshotValue(runtimeState),\n writable: false,\n })\n const runtimeWithSyncFlush = runtimeWithDefaults as RuntimeInstanceWithSyncFlush<D, C, M>\n const internalRuntimeFields = {\n __wevu_flushSetupSnapshotSync: (runtime as RuntimeInstanceWithSyncFlush<D, C, M>).__wevu_flushSetupSnapshotSync,\n __wevu_touchSetupMethodsVersion: (runtime as RuntimeInstanceWithSyncFlush<D, C, M>).__wevu_touchSetupMethodsVersion,\n __wevu_trackSetupReactiveKey: (runtime as RuntimeInstanceWithSyncFlush<D, C, M>).__wevu_trackSetupReactiveKey,\n __wevu_cloneDispatchedSnapshot: (runtime as RuntimeInstanceWithSyncFlush<D, C, M>).__wevu_cloneDispatchedSnapshot,\n [WEVU_PROPS_DERIVED_KEYS_KEY]: (runtime as any)[WEVU_PROPS_DERIVED_KEYS_KEY],\n }\n for (const [key, value] of Object.entries(internalRuntimeFields)) {\n if (!value) {\n continue\n }\n Object.defineProperty(runtimeWithDefaults, key, {\n configurable: true,\n enumerable: false,\n value,\n writable: true,\n })\n }\n\n Object.defineProperty(target, WEVU_PUBLIC_RUNTIME_KEY, {\n value: runtimeWithDefaults,\n configurable: true,\n enumerable: false,\n writable: false,\n })\n target.__wevu = runtimeWithDefaults\n const runtimeProps = ensureRuntimeProps(target, runtimeState as Record<string, any>)\n attachRuntimeSlots(runtimeState as Record<string, any>, runtimeProps)\n\n if (scopedSlotState) {\n scopedSlotHooks?.attachMount(target, runtimeWithDefaults, scopedSlotState, Boolean(options?.deferSetData))\n }\n syncNativeOwnerId()\n\n const watchStops = watchMap\n ? registerWatches(runtimeWithDefaults, watchMap, target, {\n deferMissingSourceBaseline: Boolean(setup),\n })\n : []\n if (watchStops.length) {\n target[WEVU_WATCH_STOPS_KEY] = watchStops\n }\n\n if (setup) {\n runRuntimeSetupPhase({\n target,\n runtime,\n runtimeWithDefaults,\n runtimeState: runtimeState as Record<string, any>,\n runtimeProxy: runtimeProxy as Record<string, any>,\n setup,\n })\n if ((import.meta as ImportMetaWithEnv).env?.PROD !== true && typeof getMiniProgramRuntimeGlobalObject()?.[WEAPP_VITE_STATEFUL_HMR_BRIDGE_KEY]?.trackWevuComponent === 'function') {\n const initialReactiveSetupSnapshot: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(runtimeWithDefaults.setupState ?? {})) {\n if (isReactive(value)) {\n initialReactiveSetupSnapshot[key] = cloneInitialSnapshotValue(value)\n }\n }\n initialReactiveSetupSnapshots.set(runtimeWithDefaults, initialReactiveSetupSnapshot)\n }\n if (!options?.deferSetData) {\n runtimeWithSyncFlush.__wevu_flushSetupSnapshotSync?.()\n }\n if (!options?.deferSetData) {\n refreshOwnerSnapshot()\n }\n for (const stop of watchStops) {\n stop.resume()\n }\n }\n else if (\n !options?.deferSetData\n && (target as any).properties\n && typeof (target as any).properties === 'object'\n && Object.keys((target as any).properties).length > 0\n ) {\n runtimeWithSyncFlush.__wevu_flushSetupSnapshotSync?.()\n refreshOwnerSnapshot()\n }\n\n // 将 runtime.methods 透传到原生实例,供小程序事件处理直接调用\n bridgeRuntimeMethodsToTarget(target, runtime)\n\n return runtime\n}\n\nfunction preserveRuntimeFacadeIdentity<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(\n target: InternalRuntimeState,\n previousRuntime: RuntimeInstance<D, C, M>,\n nextRuntime: RuntimeInstance<D, C, M>,\n) {\n for (const key of Reflect.ownKeys(previousRuntime)) {\n if (!Reflect.has(nextRuntime, key)) {\n const descriptor = Reflect.getOwnPropertyDescriptor(previousRuntime, key)\n if (descriptor?.configurable) {\n Reflect.deleteProperty(previousRuntime, key)\n }\n }\n }\n for (const key of Reflect.ownKeys(nextRuntime)) {\n const descriptor = Reflect.getOwnPropertyDescriptor(nextRuntime, key)\n if (!descriptor) {\n continue\n }\n try {\n Reflect.defineProperty(previousRuntime, key, descriptor)\n }\n catch {\n try {\n ;(previousRuntime as any)[key] = (nextRuntime as any)[key]\n }\n catch {\n // 宿主包装对象仍持有旧 runtime 时,保留无法覆盖的只读字段。\n }\n }\n }\n attachRuntimeRef(previousRuntime.state as Record<string, any>, previousRuntime)\n const nextInitialSetupSnapshot = initialReactiveSetupSnapshots.get(nextRuntime)\n if (nextInitialSetupSnapshot) {\n initialReactiveSetupSnapshots.set(previousRuntime, nextInitialSetupSnapshot)\n }\n target.__wevu = previousRuntime\n Object.defineProperty(target, WEVU_PUBLIC_RUNTIME_KEY, {\n value: previousRuntime,\n configurable: true,\n enumerable: false,\n writable: false,\n })\n return previousRuntime\n}\n\nfunction createRuntimeStateSnapshot(\n runtime: RuntimeInstance<any, any, any>,\n nativeData: Record<string, any> | undefined,\n preferredState?: Record<string, any>,\n) {\n const runtimeState = runtime.state as Record<string, any>\n const setupState = runtime.setupState as Record<string, any> | undefined\n const snapshot: Record<string, any> = {}\n for (const key of Object.keys(nativeData ?? {})) {\n if (!Object.prototype.hasOwnProperty.call(runtimeState, key)) {\n continue\n }\n const setupBinding = setupState?.[key]\n if (setupState && Object.prototype.hasOwnProperty.call(setupState, key) && !isRef(setupBinding) && !isReactive(setupBinding)) {\n continue\n }\n if (preferredState && Object.prototype.hasOwnProperty.call(preferredState, key)) {\n snapshot[key] = cloneInitialSnapshotValue(preferredState[key])\n continue\n }\n snapshot[key] = cloneInitialSnapshotValue(isRef(setupBinding) ? setupBinding.value : runtimeState[key])\n }\n return snapshot\n}\n\nfunction syncRuntimeStateFromNativeData(\n target: InternalRuntimeState,\n options?: { includeSetupState?: boolean, nativeData?: Record<string, any>, initialSetupState?: Record<string, unknown> },\n) {\n const runtime = target.__wevu\n const runtimeState = runtime?.state as Record<string, any> | undefined\n const setupState = runtime?.setupState as Record<string, any> | undefined\n const nativeData = options?.nativeData ?? (target as any).data as Record<string, any> | undefined\n if (!runtimeState || typeof runtimeState !== 'object' || !nativeData || typeof nativeData !== 'object') {\n return\n }\n const initialRuntimeSnapshot = (runtime as any)?.__wevu_initialRuntimeSnapshot as Record<string, any> | undefined\n for (const [key, value] of Object.entries(nativeData)) {\n if (!key || key === 'undefined') {\n continue\n }\n if (Object.prototype.hasOwnProperty.call(runtimeState, key)) {\n try {\n const setupBinding = setupState?.[key]\n const runtimeValue = cloneInitialSnapshotValue(value)\n if (setupState && Object.prototype.hasOwnProperty.call(setupState, key)) {\n // 普通 setup 值来自当前代码;仅 ref/reactive 绑定承接宿主状态。\n if (!options?.includeSetupState || (!isRef(setupBinding) && !isReactive(setupBinding))) {\n continue\n }\n }\n if (\n !options?.includeSetupState\n && initialRuntimeSnapshot\n && Object.prototype.hasOwnProperty.call(initialRuntimeSnapshot, key)\n && !isDeepEqualValue(runtimeState[key], initialRuntimeSnapshot[key], 20, { keys: 10_000 })\n ) {\n continue\n }\n if (\n !options?.includeSetupState\n && initialRuntimeSnapshot\n && !Object.prototype.hasOwnProperty.call(initialRuntimeSnapshot, key)\n ) {\n continue\n }\n if (isRef(setupBinding)) {\n setupBinding.value = runtimeValue\n continue\n }\n if (isReactive(setupBinding) && runtimeValue && typeof runtimeValue === 'object') {\n restoreReactiveSetupSnapshot(setupBinding, runtimeValue, options?.initialSetupState?.[key])\n continue\n }\n runtimeState[key] = runtimeValue\n }\n catch {\n // DevTools 热更新期间可能带入响应式 state 拒绝写入的临时 data key,跳过即可。\n }\n }\n }\n}\n\nexport function enableDeferredSetData(\n target: InternalRuntimeState,\n options?: { rehydrateSetupState?: boolean },\n) {\n const adapter = target.__wevu?.adapter as AdapterWithSetData | undefined\n syncRuntimeStateFromNativeData(target, {\n includeSetupState: options?.rehydrateSetupState,\n })\n adapter?.__wevu_enableSetData?.(true)\n ;(target as any).__wevu?.__wevu_flushSetupSnapshotSync?.()\n}\n\nexport function setRuntimeSetDataVisibility(target: InternalRuntimeState, visible: boolean) {\n const adapter = target.__wevu?.adapter as AdapterWithSetData | undefined\n adapter?.__wevu_setVisibility?.(visible)\n}\n\n/**\n * 卸载运行时实例(框架内部注册流程使用)。\n * @internal\n */\nexport function teardownRuntimeInstance(target: InternalRuntimeState, options?: {\n skipHooks?: boolean\n preserveNativeDeclarationChildren?: boolean\n}) {\n const runtime = target.__wevu\n\n const stops = target[WEVU_WATCH_STOPS_KEY]\n const effectScope = target[WEVU_EFFECT_SCOPE_KEY]\n\n runTeardownSteps([\n () => {\n if (!options?.skipHooks && runtime && target[WEVU_HOOKS_KEY]?.[WEVU_ON_BEFORE_UNMOUNT_HOOK]) {\n if (effectScope?.active) {\n effectScope.run(() => callHookList(target, WEVU_ON_BEFORE_UNMOUNT_HOOK))\n }\n else {\n const teardownScope = createEffectScope(true)\n runTeardownSteps([\n () => teardownScope.run(() => callHookList(target, WEVU_ON_BEFORE_UNMOUNT_HOOK)),\n () => teardownScope.stop(),\n ])\n }\n }\n },\n ...((!(import.meta as ImportMetaWithEnv).env?.PLATFORM || (import.meta as ImportMetaWithEnv).env?.PLATFORM === 'weapp')\n ? [() => releaseNativeDeclaration(target, options?.preserveNativeDeclarationChildren)]\n : []),\n () => runtimeCapabilityRegistry.scopedSlots?.teardown(target),\n () => {\n if (Array.isArray(target.__wevuTemplateRefs) && target.__wevuTemplateRefs.length > 0) {\n requireRuntimeCapability('templateRefs', 'teardownRuntimeInstance(template refs)').clear(target)\n }\n },\n () => {\n // 触发卸载钩子(仅在 teardown 首次执行时触发)\n if (!options?.skipHooks && runtime && target[WEVU_HOOKS_KEY]) {\n callHookList(target, 'onUnload', [])\n }\n },\n () => {\n // 清理注册的生命周期钩子\n if (target[WEVU_HOOKS_KEY]) {\n target[WEVU_HOOKS_KEY] = undefined\n }\n },\n () => {\n if (Array.isArray(stops)) {\n for (const stop of stops) {\n try {\n stop()\n }\n catch {\n // 避免 teardown 中断:单个 stop 失败不阻塞其他清理\n }\n }\n }\n },\n () => {\n target[WEVU_WATCH_STOPS_KEY] = undefined\n },\n () => {\n effectScope?.stop()\n },\n () => {\n target[WEVU_EFFECT_SCOPE_KEY] = undefined\n },\n () => runtime?.unmount(),\n () => {\n const adapter = runtime?.adapter as AdapterWithSetData | undefined\n adapter?.__wevu_disposeSetData?.()\n },\n () => {\n delete (target as any)[WEVU_SETUP_CONTEXT_INSTANCE_KEY]\n delete (target as any)[WEVU_EXPOSED_KEY]\n },\n () => {\n delete target.__wevu\n },\n () => {\n if (WEVU_PUBLIC_RUNTIME_KEY in target) {\n delete (target as any)[WEVU_PUBLIC_RUNTIME_KEY]\n }\n },\n () => {\n // 只解除宿主引用,不清空 provides 或撤销用户已持有的注入对象。\n delete target[WEVU_PARENT_INSTANCE_KEY]\n },\n () => {\n delete target[WEVU_PROVIDES_KEY]\n },\n () => {\n delete target[WEVU_RUNTIME_APP_KEY]\n },\n ])\n}\n\n/**\n * 重建运行时实例,同时保持宿主包装对象持有的 runtime facade 身份稳定。\n * @internal\n */\nexport function refreshRuntimeInstance<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(\n target: InternalRuntimeState,\n runtimeApp: RuntimeApp<D, C, M>,\n watchMap: WatchMap | undefined,\n setup?: RuntimeSetupFunction<D, C, M>,\n options?: { snapshotOmitKeys?: string[], stateSnapshot?: Record<string, any>, attached?: boolean },\n): RuntimeInstance<D, C, M> {\n const previousRuntime = target.__wevu as RuntimeInstance<D, C, M> | undefined\n const initialSetupState = previousRuntime ? initialReactiveSetupSnapshots.get(previousRuntime) : undefined\n const previousRuntimeState = previousRuntime\n ? createRuntimeStateSnapshot(previousRuntime, (target as any).data, options?.stateSnapshot)\n : undefined\n // 页面上方的 layout 由独立挂载插入;HMR 仅在本次重建期间保留仍存活的 layout。\n const parent = target[WEVU_PARENT_INSTANCE_KEY]\n const layoutParent = parent && isRuntimeLayoutComponentTarget(parent) ? parent : undefined\n teardownRuntimeInstance(target, { skipHooks: true, preserveNativeDeclarationChildren: true })\n const nextRuntime = mountRuntimeInstance(target, runtimeApp, watchMap, setup, {\n deferSetData: true,\n snapshotOmitKeys: options?.snapshotOmitKeys,\n attached: options?.attached,\n layoutParent,\n })\n const stateSnapshot = previousRuntimeState ?? (options?.stateSnapshot\n ? createRuntimeStateSnapshot(nextRuntime, options.stateSnapshot, options.stateSnapshot)\n : undefined)\n if (stateSnapshot) {\n const nativeData = (target as any).data\n if (nativeData && typeof nativeData === 'object') {\n Object.assign(nativeData, cloneInitialSnapshotValue(stateSnapshot))\n }\n syncRuntimeStateFromNativeData(target, {\n includeSetupState: true,\n nativeData: stateSnapshot,\n initialSetupState,\n })\n }\n if (!previousRuntime || previousRuntime === nextRuntime) {\n return nextRuntime\n }\n return preserveRuntimeFacadeIdentity(target, previousRuntime, nextRuntime)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmEA,MAAM,gDAAgC,IAAI,QAAyC;AAEnF,SAAS,0BAA0B,OAAgB,wBAAQ,IAAI,QAAyB,GAAY;CAClG,IAAI,CAAC,SAAS,OAAO,UAAU,UAC7B,OAAO;CAET,IAAI,MAAM,IAAI,KAAe,GAC3B,OAAO,MAAM,IAAI,KAAe;CAElC,IAAI,MAAM,QAAQ,KAAK,GAAG;EACxB,MAAM,OAAkB,CAAC;EACzB,MAAM,IAAI,OAAO,IAAI;EACrB,KAAK,MAAM,QAAQ,OACjB,KAAK,KAAK,0BAA0B,MAAM,KAAK,CAAC;EAElD,OAAO;CACT;CACA,MAAM,OAAgC,CAAC;CACvC,MAAM,IAAI,OAAiB,IAAI;CAC/B,KAAK,MAAM,CAAC,KAAK,UAA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Z;EACF,CAAC;CACH;CACA,IAAI,CAAC,mBAAmB,oBAAoB,aAC1C,OAAO;CAET,OAAO,8BAA8B,QAAQ,iBAAiB,WAAW;AAC3E"}
package/dist/fetch.mjs CHANGED
@@ -1 +1 @@
1
- import{fetch as e}from"@wevu/web-apis/fetch";export{e as fetch};
1
+ export{fetch}from"@wevu/web-apis/fetch";
@@ -1 +1 @@
1
- import{normalizeClass as e,normalizeStyle as t,resolvePropValue as n}from"./runtime/template.mjs";export{e as normalizeClass,t as normalizeStyle,n as resolvePropValue};
1
+ export{normalizeClass,normalizeStyle,resolvePropValue}from"./runtime/template.mjs";
package/dist/package.mjs CHANGED
@@ -1 +1 @@
1
- var e=`7.4.0`;export{e as version};
1
+ var e=`7.5.0`;export{e as version};
@@ -1 +1 @@
1
- import{queueJob as e}from"../scheduler.mjs";import t from"../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/defineProperty.mjs";const n=/* @__PURE__ */ new WeakMap;let r=null;const i=[];let a=!0,o,s=0,c=!1;const l=/* @__PURE__ */ new Set,u=/* @__PURE__ */ new Set;function d(e){if(e.active){if(e.scheduler){let t=o;o=e._scope;try{e.scheduler()}finally{o=t}return}e()}}function f(e){if(s>0||c){u.add(e);return}u.delete(e),e()}function p(){s++}function m(e){let t=e.values().next();if(!t.done)return e.delete(t.value),t.value}function h(){let e,t=!1;c=!0;try{for(;l.size;){let n=m(l);if(n)try{d(n)}catch(n){t||(e=n,t=!0)}}}finally{c=!1}for(;u.size;){let n=u.values().next().value;u.delete(n);try{n()}catch(n){t||(e=n,t=!0)}}if(t)throw e}function g(){s!==0&&(s--,s===0&&!c&&h())}function _(e){p();try{return e()}finally{g()}}function v(e){let{deps:t}=e;for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0}function y(e){e.active&&(e.active=!1,v(e),e.onStop?.())}var b=class{constructor(e=!1){if(this.detached=e,t(this,`active`,!0),t(this,`effects`,[]),t(this,`cleanups`,[]),t(this,`parent`,void 0),t(this,`scopes`,void 0),!e&&o){var n;if(!o.active){this.active=!1;return}this.parent=o,((n=o).scopes||(n.scopes=[])).push(this)}}run(e){if(!this.active)return;let t=o;o=this;try{return e()}finally{o=t}}stop(){if(!this.active)return;this.active=!1;let e=o;o=this;let t,n=!1,r=e=>{n||(t=e,n=!0)};try{let e=this.effects.splice(0);for(let t of e)try{y(t)}catch(e){r(e)}let t=this.cleanups.splice(0);for(let e of t)try{e()}catch(e){r(e)}let n=this.scopes;if(this.scopes=void 0,n){for(let e of n)try{e.stop()}catch(e){r(e)}n.length=0}}finally{if(this.parent?.scopes){let e=this.parent.scopes.indexOf(this);e>=0&&this.parent.scopes.splice(e,1)}this.parent=void 0,o=e}if(n)throw t}};function x(e=!1){return new b(e)}function S(){return o}function C(e){o?.active&&o.cleanups.push(e)}function w(e){let t=a;a=!1;try{return e()}finally{a=t}}function T(e){if(o){if(o.active){o.effects.push(e);return}y(e)}}function E(e,t={}){let n=function(){if(!n.active||n._running)return e();v(n);let t=o;o=n._scope;let s=a;try{return a=!0,n._running=!0,i.push(n),r=n,e()}finally{i.pop(),r=i[i.length-1]??null,n._running=!1,o=t,a=s}};return n.deps=[],n.scheduler=t.scheduler,n.onStop=t.onStop,n.active=!0,n._running=!1,n._fn=e,n._scope=o,n}function D(e,t,n){let r=E(e,t);return r._computed=n,T(r),t.lazy||r(),r}function O(e,t={}){return D(e,t,!1)}function k(e,t={}){return D(e,t,!0)}function A(e,t){if(!a||!r)return;let i=n.get(e);i||(i=/* @__PURE__ */ new Map,n.set(e,i));let o=i.get(t);o||(o=/* @__PURE__ */ new Set,i.set(t,o)),o.has(r)||(o.add(r),r.deps.push(o))}function j(e){if(!e._running){if(e._computed){d(e);return}if(s>0||c){l.add(e);return}d(e)}}function M(e,t){let i=n.get(e);if(!i)return;let a=i.get(t);if(!a)return;let o=/* @__PURE__ */ new Set;a.forEach(e=>{e!==r&&o.add(e)}),o.forEach(j)}function N(e){a&&r&&(e.has(r)||(e.add(r),r.deps.push(e)))}function P(e){new Set(e).forEach(j)}export{_ as batch,k as createComputedEffect,E as createReactiveEffect,O as effect,x as effectScope,g as endBatch,S as getCurrentScope,C as onScopeDispose,f as queueBatchCallback,e as queueJob,w as runWithoutTracking,p as startBatch,y as stop,A as track,N as trackEffects,M as trigger,P as triggerEffects};
1
+ import{queueJob as e}from"../scheduler.mjs";import t from"../_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/defineProperty.mjs";const n=/* @__PURE__ */ new WeakMap;let r=null;const i=[];let a=!0,o,s=0,c=!1;const l=/* @__PURE__ */ new Set,u=/* @__PURE__ */ new Set;function d(e){if(e.active){if(e.scheduler){let t=o;o=e._scope;try{e.scheduler()}finally{o=t}}else e()}}function f(e){s>0||c?u.add(e):(u.delete(e),e())}function p(){s++}function m(e){let t=e.values().next();if(!t.done)return e.delete(t.value),t.value}function h(){let e,t=!1;c=!0;try{for(;l.size;){let n=m(l);if(n)try{d(n)}catch(n){t||(e=n,t=!0)}}}finally{c=!1}for(;u.size;){let n=u.values().next().value;u.delete(n);try{n()}catch(n){t||(e=n,t=!0)}}if(t)throw e}function g(){s!==0&&(s--,s===0&&!c&&h())}function _(e){p();try{return e()}finally{g()}}function v(e){let{deps:t}=e;for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0}function y(e){e.active&&(e.active=!1,v(e),e.onStop?.())}var b=class{constructor(e=!1){if(this.detached=e,t(this,`active`,!0),t(this,`effects`,[]),t(this,`cleanups`,[]),t(this,`parent`,void 0),t(this,`scopes`,void 0),!e&&o){var n;if(!o.active){this.active=!1;return}this.parent=o,((n=o).scopes||(n.scopes=[])).push(this)}}run(e){if(!this.active)return;let t=o;o=this;try{return e()}finally{o=t}}stop(){if(!this.active)return;this.active=!1;let e=o;o=this;let t,n=!1,r=e=>{n||(t=e,n=!0)};try{let e=this.effects.splice(0);for(let t of e)try{y(t)}catch(e){r(e)}let t=this.cleanups.splice(0);for(let e of t)try{e()}catch(e){r(e)}let n=this.scopes;if(this.scopes=void 0,n){for(let e of n)try{e.stop()}catch(e){r(e)}n.length=0}}finally{if(this.parent?.scopes){let e=this.parent.scopes.indexOf(this);e>=0&&this.parent.scopes.splice(e,1)}this.parent=void 0,o=e}if(n)throw t}};function x(e=!1){return new b(e)}function S(){return o}function C(e){o?.active&&o.cleanups.push(e)}function w(e){let t=a;a=!1;try{return e()}finally{a=t}}function T(e){o&&(o.active?o.effects.push(e):y(e))}function E(e,t={}){let n=function(){if(!n.active||n._running)return e();v(n);let t=o;o=n._scope;let s=a;try{return a=!0,n._running=!0,i.push(n),r=n,e()}finally{i.pop(),r=i[i.length-1]??null,n._running=!1,o=t,a=s}};return n.deps=[],n.scheduler=t.scheduler,n.onStop=t.onStop,n.active=!0,n._running=!1,n._fn=e,n._scope=o,n}function D(e,t,n){let r=E(e,t);return r._computed=n,T(r),t.lazy||r(),r}function O(e,t={}){return D(e,t,!1)}function k(e,t={}){return D(e,t,!0)}function A(e,t){if(!a||!r)return;let i=n.get(e);i||(i=/* @__PURE__ */ new Map,n.set(e,i));let o=i.get(t);o||(o=/* @__PURE__ */ new Set,i.set(t,o)),o.has(r)||(o.add(r),r.deps.push(o))}function j(e){e._running||(e._computed?d(e):s>0||c?l.add(e):d(e))}function M(e,t){let i=n.get(e);if(!i)return;let a=i.get(t);if(!a)return;let o=/* @__PURE__ */ new Set;a.forEach(e=>{e!==r&&o.add(e)}),o.forEach(j)}function N(e){a&&r&&(e.has(r)||(e.add(r),r.deps.push(e)))}function P(e){new Set(e).forEach(j)}export{_ as batch,k as createComputedEffect,E as createReactiveEffect,O as effect,x as effectScope,g as endBatch,S as getCurrentScope,C as onScopeDispose,f as queueBatchCallback,e as queueJob,w as runWithoutTracking,p as startBatch,y as stop,A as track,N as trackEffects,M as trigger,P as triggerEffects};
@@ -1 +1 @@
1
- import{track as e}from"../core.mjs";import{adoptReactiveRoot as t,indexPatchNode as n,rawMultiParentSet as r,rawParentMap as i,rawParentsMap as a,rawPathMap as o,rawRootMap as s,rawVersionMap as c,recordParentLink as l,rootPatchNodesMap as u}from"./patchState.mjs";import{VERSION_KEY as d,isObject as f,toRaw as p}from"./shared.mjs";function m(e,i){let a=p(e);o.set(a,``),n(a,a);let s=i?.shouldIncludeTopKey,c=typeof i?.maxDepth==`number`?Math.max(0,Math.floor(i.maxDepth)):1/0,u=typeof i?.maxKeys==`number`?Math.max(0,Math.floor(i.maxKeys)):1/0,d=/* @__PURE__ */ new WeakSet,m=[{current:a,path:``,depth:0}],h=0;for(;m.length;){let e=m.pop();if(d.has(e.current)||(d.add(e.current),o.set(e.current,e.path),n(a,e.current),h+=1,h>=u)||e.depth>=c||Array.isArray(e.current))continue;let i=Object.entries(e.current);for(let[c,u]of i){if(e.path===``&&s&&!s(c)||!f(u)||u.__r_skip)continue;let i=p(u);if(t(i,e.current),l(i,e.current,c),!r.has(i)){let t=e.path?`${e.path}.${c}`:c;o.set(i,t)}n(a,i),m.push({current:i,path:e.path?`${e.path}.${c}`:c,depth:e.depth+1})}}}function h(e){let t=p(e),n=u.get(t);if(!n){o.delete(t);return}for(let e of n)i.delete(e),a.delete(e),o.delete(e),r.delete(e),s.delete(e),c.delete(e);u.delete(t)}function g(t){let n=p(t);e(n,d)}export{h as clearPatchIndices,m as prelinkReactiveTree,g as touchReactive};
1
+ import{track as e}from"../core.mjs";import{adoptReactiveRoot as t,indexPatchNode as n,rawMultiParentSet as r,rawParentMap as i,rawParentsMap as a,rawPathMap as o,rawRootMap as s,rawVersionMap as c,recordParentLink as l,rootPatchNodesMap as u}from"./patchState.mjs";import{VERSION_KEY as d,isObject as f,toRaw as p}from"./shared.mjs";function m(e,i){let a=p(e);o.set(a,``),n(a,a);let s=i?.shouldIncludeTopKey,c=typeof i?.maxDepth==`number`?Math.max(0,Math.floor(i.maxDepth)):1/0,u=typeof i?.maxKeys==`number`?Math.max(0,Math.floor(i.maxKeys)):1/0,d=/* @__PURE__ */ new WeakSet,m=[{current:a,path:``,depth:0}],h=0;for(;m.length;){let e=m.pop();if(d.has(e.current)||(d.add(e.current),o.set(e.current,e.path),n(a,e.current),h+=1,h>=u)||e.depth>=c||Array.isArray(e.current))continue;let i=Object.entries(e.current);for(let[c,u]of i){if(e.path===``&&s&&!s(c)||!f(u)||u.__r_skip)continue;let i=p(u);if(t(i,e.current),l(i,e.current,c),!r.has(i)){let t=e.path?`${e.path}.${c}`:c;o.set(i,t)}n(a,i),m.push({current:i,path:e.path?`${e.path}.${c}`:c,depth:e.depth+1})}}}function h(e){let t=p(e),n=u.get(t);if(!n)o.delete(t);else{for(let e of n)i.delete(e),a.delete(e),o.delete(e),r.delete(e),s.delete(e),c.delete(e);u.delete(t)}}function g(t){let n=p(t);e(n,d)}export{h as clearPatchIndices,m as prelinkReactiveTree,g as touchReactive};
@@ -1 +1 @@
1
- import{mutationRecorders as e}from"./mutation.mjs";const t=/* @__PURE__ */ new WeakMap,n=/* @__PURE__ */ new WeakMap,r=/* @__PURE__ */ new WeakMap,i=/* @__PURE__ */ new WeakMap,a=/* @__PURE__ */ new WeakSet,o=/* @__PURE__ */ new WeakMap,s=/* @__PURE__ */ new WeakMap;function c(e){let t=s.get(e);return t||(t=/* @__PURE__ */ new Set,s.set(e,t)),t}function l(e,t){c(e).add(t)}function u(e){n.set(e,(n.get(e)??0)+1)}function d(e){return n.get(e)??0}function f(e,n){let r=t.get(n)??n,i=t.get(e);(!i||i===e||i===n)&&t.set(e,r)}function p(e){let t=/* @__PURE__ */ new Set,n=[e];for(let e=0;e<2e3&&n.length;e++){let e=n.pop(),r=i.get(e);if(r)for(let e of r.keys())t.has(e)||(t.add(e),u(e),n.push(e))}}function m(e){let t=i.get(e);if(!t){a.delete(e),r.delete(e);return}let n,o,s=0;for(let[e,r]of t){for(let t of r){if(s+=1,s>1)break;n=e,o=t}if(s>1)break}if(s===1&&n&&o){a.delete(e),r.set(e,{parent:n,key:o});return}a.add(e),r.delete(e)}function h(n,o,s){if(typeof s!=`string`){a.add(n),r.delete(n);return}if(e.size){let e=t.get(o)??o;l(e,o),l(e,n)}let c=i.get(n);c||(c=/* @__PURE__ */ new Map,i.set(n,c));let u=c.get(o);u||(u=/* @__PURE__ */ new Set,c.set(o,u)),u.add(s),m(n)}function g(e,t,n){let r=i.get(e);if(!r)return;let a=r.get(t);a&&(a.delete(n),a.size||r.delete(t),r.size||i.delete(e),m(e))}function _(e,t){if(t===e)return[];if(a.has(t))return;let n=[],i=t;for(let t=0;t<2e3;t++){if(i===e)return n.reverse();if(a.has(i))return;let t=r.get(i);if(!t||typeof t.key!=`string`)return;n.push(t.key),i=t.parent}}export{f as adoptReactiveRoot,p as bumpAncestorVersions,u as bumpRawVersion,d as getRawVersion,l as indexPatchNode,a as rawMultiParentSet,r as rawParentMap,i as rawParentsMap,o as rawPathMap,t as rawRootMap,n as rawVersionMap,h as recordParentLink,g as removeParentLink,_ as resolvePathToTarget,s as rootPatchNodesMap};
1
+ import{mutationRecorders as e}from"./mutation.mjs";const t=/* @__PURE__ */ new WeakMap,n=/* @__PURE__ */ new WeakMap,r=/* @__PURE__ */ new WeakMap,i=/* @__PURE__ */ new WeakMap,a=/* @__PURE__ */ new WeakSet,o=/* @__PURE__ */ new WeakMap,s=/* @__PURE__ */ new WeakMap;function c(e){let t=s.get(e);return t||(t=/* @__PURE__ */ new Set,s.set(e,t)),t}function l(e,t){c(e).add(t)}function u(e){n.set(e,(n.get(e)??0)+1)}function d(e){return n.get(e)??0}function f(e,n){let r=t.get(n)??n,i=t.get(e);(!i||i===e||i===n)&&t.set(e,r)}function p(e){let t=/* @__PURE__ */ new Set,n=[e];for(let e=0;e<2e3&&n.length;e++){let e=n.pop(),r=i.get(e);if(r)for(let e of r.keys())t.has(e)||(t.add(e),u(e),n.push(e))}}function m(e){let t=i.get(e);if(!t){a.delete(e),r.delete(e);return}let n,o,s=0;for(let[e,r]of t){for(let t of r){if(s+=1,s>1)break;n=e,o=t}if(s>1)break}s===1&&n&&o?(a.delete(e),r.set(e,{parent:n,key:o})):(a.add(e),r.delete(e))}function h(n,o,s){if(typeof s!=`string`){a.add(n),r.delete(n);return}if(e.size){let e=t.get(o)??o;l(e,o),l(e,n)}let c=i.get(n);c||(c=/* @__PURE__ */ new Map,i.set(n,c));let u=c.get(o);u||(u=/* @__PURE__ */ new Set,c.set(o,u)),u.add(s),m(n)}function g(e,t,n){let r=i.get(e);if(!r)return;let a=r.get(t);a&&(a.delete(n),a.size||r.delete(t),r.size||i.delete(e),m(e))}function _(e,t){if(t===e)return[];if(a.has(t))return;let n=[],i=t;for(let t=0;t<2e3;t++){if(i===e)return n.reverse();if(a.has(i))return;let t=r.get(i);if(!t||typeof t.key!=`string`)return;n.push(t.key),i=t.parent}}export{f as adoptReactiveRoot,p as bumpAncestorVersions,u as bumpRawVersion,d as getRawVersion,l as indexPatchNode,a as rawMultiParentSet,r as rawParentMap,i as rawParentsMap,o as rawPathMap,t as rawRootMap,n as rawVersionMap,h as recordParentLink,g as removeParentLink,_ as resolvePathToTarget,s as rootPatchNodesMap};
@@ -1 +1 @@
1
- import e from"../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/defineProperty.mjs";import{trackEffects as t,triggerEffects as n}from"./core.mjs";import{convertToReactive as r,markRaw as i}from"./reactive.mjs";const a=`__v_isRef`;function o(e){try{Object.defineProperty(e,a,{value:!0,configurable:!0})}catch{e[a]=!0}return e}function s(e){return!!(e&&typeof e==`object`&&e.__v_isRef===!0)}var c=class{constructor(t){e(this,`_value`,void 0),e(this,`_rawValue`,void 0),e(this,`dep`,void 0),o(this),this._rawValue=t,this._value=r(t)}get value(){return this.dep||(this.dep=/* @__PURE__ */ new Set),t(this.dep),this._value}set value(e){Object.is(e,this._rawValue)||(this._rawValue=e,this._value=r(e),this.dep&&n(this.dep))}};function l(e){return s(e)?e:i(new c(e))}function u(e){return s(e)?e.value:e}function d(e){return typeof e==`function`?e():u(e)}var f=class{constructor(r,i){e(this,`_getValue`,void 0),e(this,`_setValue`,void 0),e(this,`dep`,void 0),o(this);let a=i,s=()=>{this.dep||(this.dep=/* @__PURE__ */ new Set),t(this.dep)},c=()=>{this.dep&&n(this.dep)},l=e=>e===void 0&&a!==void 0?a:e;if(typeof r==`function`){let e=r(s,c);this._getValue=()=>l(e.get()),this._setValue=t=>e.set(t);return}let u=r;this._getValue=()=>(s(),l(u.get())),this._setValue=e=>{u.set(e),c()}}get value(){return this._getValue()}set value(e){this._setValue(e)}};function p(e,t){return i(new f(e,t))}export{a as RefFlag,p as customRef,s as isRef,o as markAsRef,l as ref,d as toValue,u as unref};
1
+ import e from"../_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/defineProperty.mjs";import{trackEffects as t,triggerEffects as n}from"./core.mjs";import{convertToReactive as r,markRaw as i}from"./reactive.mjs";const a=`__v_isRef`;function o(e){try{Object.defineProperty(e,a,{value:!0,configurable:!0})}catch{e[a]=!0}return e}function s(e){return!!(e&&typeof e==`object`&&e.__v_isRef===!0)}var c=class{constructor(t){e(this,`_value`,void 0),e(this,`_rawValue`,void 0),e(this,`dep`,void 0),o(this),this._rawValue=t,this._value=r(t)}get value(){return this.dep||(this.dep=/* @__PURE__ */ new Set),t(this.dep),this._value}set value(e){Object.is(e,this._rawValue)||(this._rawValue=e,this._value=r(e),this.dep&&n(this.dep))}};function l(e){return s(e)?e:i(new c(e))}function u(e){return s(e)?e.value:e}function d(e){return typeof e==`function`?e():u(e)}var f=class{constructor(r,i){e(this,`_getValue`,void 0),e(this,`_setValue`,void 0),e(this,`dep`,void 0),o(this);let a=i,s=()=>{this.dep||(this.dep=/* @__PURE__ */ new Set),t(this.dep)},c=()=>{this.dep&&n(this.dep)},l=e=>e===void 0&&a!==void 0?a:e;if(typeof r==`function`){let e=r(s,c);this._getValue=()=>l(e.get()),this._setValue=t=>e.set(t);return}let u=r;this._getValue=()=>(s(),l(u.get())),this._setValue=e=>{u.set(e),c()}}get value(){return this._getValue()}set value(e){this._setValue(e)}};function p(e,t){return i(new f(e,t))}export{a as RefFlag,p as customRef,s as isRef,o as markAsRef,l as ref,d as toValue,u as unref};
@@ -1 +1 @@
1
- import{nextTick as e,queueJob as t}from"../../scheduler.mjs";import{touchReactive as n}from"../reactive/patch.mjs";import{isReactive as r}from"../reactive.mjs";import{isRef as i}from"../ref.mjs";import{isShallowRef as a}from"../shallowRef.mjs";import{traverse as o}from"../traverse.mjs";import{getDeepWatchStrategy as s}from"./types.mjs";function c(e){if(typeof e==`function`)return e();if(i(e))return e.value;if(r(e))return e;throw Error(`无效的 watch 源`)}function l(e){let t=Array.isArray(e),n=!t&&r(e),o=t?e.some(e=>r(e)):n,s=t?e.some(e=>a(e)):a(e),l;if(t){let t=e;l=()=>t.map(e=>c(e))}else if(typeof e==`function`)l=e;else if(i(e))l=()=>e.value;else if(n)l=()=>e;else throw Error(`无效的 watch 源`);return{getter:l,hasReactiveSource:o,hasShallowSource:s,isMultiSource:t,isReactiveSource:n}}function u(e,t,i,a,c){let l=i?t.some(e=>r(e)):a,u=c??l;if(u!==!0&&typeof u!=`number`)return e;let d=typeof u==`number`?u:u?1/0:0;return()=>{let t=e(),a=s();return i&&Array.isArray(t)?t.map(e=>a===`version`&&r(e)?(n(e),e):o(e,d)):a===`version`&&r(t)?(n(t),t):o(t,d)}}function d(n,r,i,a){if(a){a(n,i);return}if(r===`sync`){n();return}if(r===`post`){e(()=>t(n));return}i?n():t(n)}export{u as applyDeepWatchGetter,l as createWatchGetter,d as dispatchScheduledJob};
1
+ import{nextTick as e,queueJob as t}from"../../scheduler.mjs";import{touchReactive as n}from"../reactive/patch.mjs";import{isReactive as r}from"../reactive.mjs";import{isRef as i}from"../ref.mjs";import{isShallowRef as a}from"../shallowRef.mjs";import{traverse as o}from"../traverse.mjs";import{getDeepWatchStrategy as s}from"./types.mjs";function c(e){if(typeof e==`function`)return e();if(i(e))return e.value;if(r(e))return e;throw Error(`无效的 watch 源`)}function l(e){let t=Array.isArray(e),n=!t&&r(e),o=t?e.some(e=>r(e)):n,s=t?e.some(e=>a(e)):a(e),l;if(t){let t=e;l=()=>t.map(e=>c(e))}else if(typeof e==`function`)l=e;else if(i(e))l=()=>e.value;else if(n)l=()=>e;else throw Error(`无效的 watch 源`);return{getter:l,hasReactiveSource:o,hasShallowSource:s,isMultiSource:t,isReactiveSource:n}}function u(e,t,i,a,c){let l=i?t.some(e=>r(e)):a,u=c??l;if(u!==!0&&typeof u!=`number`)return e;let d=typeof u==`number`?u:u?1/0:0;return()=>{let t=e(),a=s();return i&&Array.isArray(t)?t.map(e=>a===`version`&&r(e)?(n(e),e):o(e,d)):a===`version`&&r(t)?(n(t),t):o(t,d)}}function d(n,r,i,a){a?a(n,i):r===`sync`?n():r===`post`?e(()=>t(n)):i?n():t(n)}export{u as applyDeepWatchGetter,l as createWatchGetter,d as dispatchScheduledJob};
@@ -1 +1 @@
1
- import{registerInitialNavigationLifecycle as e}from"../runtime/navigationLifecycle.mjs";import{getActiveRouter as t}from"./instance.mjs";import{WEVU_INITIAL_NAVIGATION_TIMEOUT_MARKER as n}from"@weapp-core/constants";import{queueMicrotaskPolyfill as r}from"@wevu/web-apis";const i=1e4,a=/* @__PURE__ */ new WeakMap,o=/* @__PURE__ */ new WeakMap;function s(e){return Number.isFinite(e)&&e>0?Math.max(1,Math.trunc(e)):i}function c(e){return{route:typeof e.route==`string`?e.route:void 0,__route__:typeof e.__route__==`string`?e.__route__:void 0,options:e.options&&typeof e.options==`object`?{...e.options}:void 0}}function l(e){if(!e||typeof e!=`object`)return;let t={};for(let[n,r]of Object.entries(e))t[n]=Array.isArray(r)?[...r]:r;return t}function u(){let e=t();return e?a.get(e)?.timeoutMs??1e4:i}function d(e){return!!(e&&typeof e==`object`&&e.__wevuNavigationFailure)}function f(e){return o.get(e)?.promise}function p(e,i,s={}){let f=o.get(e);if(f)return s.onComplete&&f.blocking&&f.subscribe(s.onComplete),s.start!==!1&&f.start(i),f.blocking?f.promise:void 0;let p=t(),m=p?a.get(p):void 0,h=m?.runner;if(!h)return;let g=m?.mode===`blocking`,_=c(e),v=l(i),y=`idle`,b,x=u(),S,C=/* @__PURE__ */ new Set,w=new Promise(e=>{S=e}),T=(e,t)=>{if(y!==`idle`&&y!==`running`)return;y=e,b!==void 0&&(clearTimeout(b),b=void 0);let n=[...C];C.clear(),h=void 0,_=void 0,v=void 0,S(t),r(()=>{if(y===`allowed`||y===`timed-out`)for(let e of n)e.active&&(e.callback(t),e.active=!1)})},E={promise:w,blocking:g,status:()=>y,subscribe(e){let t={callback:e,active:!0};return y!==`idle`&&y!==`running`?r(()=>{t.active&&(y===`allowed`||y===`timed-out`)&&(e(y===`allowed`||y===`timed-out`),t.active=!1)}):C.add(t),()=>{t.active=!1,C.delete(t)}},start(e){if(y!==`idle`)return;y=`running`,g&&(b=setTimeout(()=>{y===`running`&&(console.warn(`${n} initial navigation exceeded ${x}ms; mounting page`,_?.route??_?.__route__??``),T(`timed-out`,!0))},x));let t=_,r=l(e??v),i=h;if(h=void 0,!i||!t){T(`aborted`,!1);return}i(t,r,()=>y===`running`).then(e=>{let t=d(e);T(t?`aborted`:`allowed`,!t)},()=>{T(`aborted`,!1)})},cancel(){T(`cancelled`,!1)}};return o.set(e,E),s.onComplete&&g&&E.subscribe(s.onComplete),s.start!==!1&&E.start(i),g?w:void 0}function m(e){o.get(e)?.cancel()}function h(t,n,r=i,o=`blocking`){e({ensure:p,cancel:m}),a.set(t,{runner:n,mode:o,timeoutMs:s(r)})}export{i as DEFAULT_INITIAL_NAVIGATION_TIMEOUT,m as cancelInitialNavigation,p as ensureInitialNavigation,f as getInitialNavigationPromise,u as getInitialNavigationTimeout,h as registerInitialNavigationRunner};
1
+ import{registerInitialNavigationLifecycle as e}from"../runtime/navigationLifecycle.mjs";import{getActiveRouter as t}from"./instance.mjs";import{WEVU_INITIAL_NAVIGATION_TIMEOUT_MARKER as n}from"@weapp-core/constants";import{queueMicrotaskPolyfill as r}from"@wevu/web-apis";const i=1e4,a=/* @__PURE__ */ new WeakMap,o=/* @__PURE__ */ new WeakMap;function s(e){return Number.isFinite(e)&&e>0?Math.max(1,Math.trunc(e)):i}function c(e){return{route:typeof e.route==`string`?e.route:void 0,__route__:typeof e.__route__==`string`?e.__route__:void 0,options:e.options&&typeof e.options==`object`?{...e.options}:void 0}}function l(e){if(!e||typeof e!=`object`)return;let t={};for(let[n,r]of Object.entries(e))t[n]=Array.isArray(r)?[...r]:r;return t}function u(){let e=t();return e?a.get(e)?.timeoutMs??1e4:i}function d(e){return!!(e&&typeof e==`object`&&e.__wevuNavigationFailure)}function f(e){return o.get(e)?.promise}function p(e,i,s={}){let f=o.get(e);if(f)return s.onComplete&&f.blocking&&f.subscribe(s.onComplete),s.start!==!1&&f.start(i),f.blocking?f.promise:void 0;let p=t(),m=p?a.get(p):void 0,h=m?.runner;if(!h)return;let g=m?.mode===`blocking`,_=c(e),v=l(i),y=`idle`,b,x=u(),S,C=/* @__PURE__ */ new Set,w=new Promise(e=>{S=e}),T=(e,t)=>{if(y!==`idle`&&y!==`running`)return;y=e,b!==void 0&&(clearTimeout(b),b=void 0);let n=[...C];C.clear(),h=void 0,_=void 0,v=void 0,S(t),r(()=>{if(y===`allowed`||y===`timed-out`)for(let e of n)e.active&&(e.callback(t),e.active=!1)})},E={promise:w,blocking:g,status:()=>y,subscribe(e){let t={callback:e,active:!0};return y!==`idle`&&y!==`running`?r(()=>{t.active&&(y===`allowed`||y===`timed-out`)&&(e(y===`allowed`||y===`timed-out`),t.active=!1)}):C.add(t),()=>{t.active=!1,C.delete(t)}},start(e){if(y!==`idle`)return;y=`running`,g&&(b=setTimeout(()=>{y===`running`&&(console.warn(`${n} initial navigation exceeded ${x}ms; mounting page`,_?.route??_?.__route__??``),T(`timed-out`,!0))},x));let t=_,r=l(e??v),i=h;h=void 0,!i||!t?T(`aborted`,!1):i(t,r,()=>y===`running`).then(e=>{let t=d(e);T(t?`aborted`:`allowed`,!t)},()=>{T(`aborted`,!1)})},cancel(){T(`cancelled`,!1)}};return o.set(e,E),s.onComplete&&g&&E.subscribe(s.onComplete),s.start!==!1&&E.start(i),g?w:void 0}function m(e){o.get(e)?.cancel()}function h(t,n,r=i,o=`blocking`){e({ensure:p,cancel:m}),a.set(t,{runner:n,mode:o,timeoutMs:s(r)})}export{i as DEFAULT_INITIAL_NAVIGATION_TIMEOUT,m as cancelInitialNavigation,p as ensureInitialNavigation,f as getInitialNavigationPromise,u as getInitialNavigationTimeout,h as registerInitialNavigationRunner};
@@ -1 +1 @@
1
- import{reactive as e}from"../reactivity/reactive.mjs";import{readonly as t}from"../reactivity/readonly.mjs";import{getCurrentMiniProgramPages as n}from"../runtime/platform.mjs";import{getCurrentSetupContext as r}from"../runtime/hooks/base.mjs";import{onLoad as i,onReady as a,onRouteDone as o,onShow as s,onUnload as c}from"../runtime/hooks/register.mjs";import{registerRouteStateSyncHandler as l}from"./routeSync.mjs";import{resolveCurrentRoute as u,resolvePageRoute as d}from"../routerInternal/location.mjs";import{cloneLocationQuery as f,cloneRouteLocationRedirectedFrom as p,cloneRouteMeta as m,cloneRouteParams as h,cloneRouteRecordMatchedList as g}from"../routerInternal/snapshots.mjs";import{useNativePageRouter as _,useNativeRouter as v}from"../runtime/vueCompat/router.mjs";import{getActiveRouter as y}from"./instance.mjs";import{resolveRouteLocation as b}from"./resolve.mjs";import{WEVU_NATIVE_INSTANCE_KEY as x}from"@weapp-core/constants";function S(e){return typeof e.route==`string`||typeof e.__route__==`string`}function C(e){let t=e[x];return t&&typeof t==`object`?t:e}function w(e,t,r){if(r?.source===`router`||!t)return!0;let i=C(e);if(r?.page)return r.page===i;let a=n();return a[a.length-1]===i}function T(e,t){e.path=t.path,e.fullPath=t.fullPath,e.query=f(t.query),e.hash=t.hash,e.params=h(t.params),t.name===void 0?delete e.name:e.name=t.name,t.meta===void 0?delete e.meta:e.meta=m(t.meta),t.href===void 0?delete e.href:e.href=t.href,t.matched===void 0?delete e.matched:e.matched=g(t.matched),t.redirectedFrom===void 0?delete e.redirectedFrom:e.redirectedFrom=p(t.redirectedFrom)}function E(p={}){let m=r(),g=m?.instance&&typeof m.instance==`object`?m.instance:void 0,_=p.resolveRoute??(e=>y()?.resolve(e)??e),v=_(u(void 0,g)),x=e({path:v.path,fullPath:v.fullPath,query:f(v.query),hash:v.hash,params:h(v.params)});T(x,v);function E(e,t,n){let r=_(t||u(e,g));n&&p.beforeRouteStateSync?.(r,n),T(x,r)}if(!g)return l(e=>{if(e?.route){E(void 0,e.route,e);return}if(e?.url){E(void 0,b(e.url,x.path),e);return}if(e?.page){E(void 0,d(e.page),e);return}E(void 0,void 0,e)}),{route:t(x)};let D=g,O=C(D),k=S(O)||n().includes(O);i(e=>{E(e)}),a(()=>{E()}),s(()=>{E()}),o(()=>{E()});let A=l(e=>{if(w(D,k,e)){if(e?.route){E(void 0,e.route,e);return}if(e?.url){E(void 0,b(e.url,x.path),e);return}if(e?.page){E(void 0,d(e.page),e);return}E(void 0,void 0,e)}});return c(()=>{A()}),{route:t(x)}}function D(e={}){return E(e).route}function O(){return v()}function k(){return _()}export{E as createRouteStateController,k as useNativePageRouter,O as useNativeRouter,D as useRoute};
1
+ import{reactive as e}from"../reactivity/reactive.mjs";import{readonly as t}from"../reactivity/readonly.mjs";import{getCurrentMiniProgramPages as n}from"../runtime/platform.mjs";import{getCurrentSetupContext as r}from"../runtime/hooks/base.mjs";import{onLoad as i,onReady as a,onRouteDone as o,onShow as s,onUnload as c}from"../runtime/hooks/register.mjs";import{registerRouteStateSyncHandler as l}from"./routeSync.mjs";import{resolveCurrentRoute as u,resolvePageRoute as d}from"../routerInternal/location.mjs";import{cloneLocationQuery as f,cloneRouteLocationRedirectedFrom as p,cloneRouteMeta as m,cloneRouteParams as h,cloneRouteRecordMatchedList as g}from"../routerInternal/snapshots.mjs";import{useNativePageRouter as _,useNativeRouter as v}from"../runtime/vueCompat/router.mjs";import{getActiveRouter as y}from"./instance.mjs";import{resolveRouteLocation as b}from"./resolve.mjs";import{WEVU_NATIVE_INSTANCE_KEY as x}from"@weapp-core/constants";function S(e){return typeof e.route==`string`||typeof e.__route__==`string`}function C(e){let t=e[x];return t&&typeof t==`object`?t:e}function w(e,t,r){if(r?.source===`router`||!t)return!0;let i=C(e);if(r?.page)return r.page===i;let a=n();return a[a.length-1]===i}function T(e,t){e.path=t.path,e.fullPath=t.fullPath,e.query=f(t.query),e.hash=t.hash,e.params=h(t.params),t.name===void 0?delete e.name:e.name=t.name,t.meta===void 0?delete e.meta:e.meta=m(t.meta),t.href===void 0?delete e.href:e.href=t.href,t.matched===void 0?delete e.matched:e.matched=g(t.matched),t.redirectedFrom===void 0?delete e.redirectedFrom:e.redirectedFrom=p(t.redirectedFrom)}function E(p={}){let m=r(),g=m?.instance&&typeof m.instance==`object`?m.instance:void 0,_=p.resolveRoute??(e=>y()?.resolve(e)??e),v=_(u(void 0,g)),x=e({path:v.path,fullPath:v.fullPath,query:f(v.query),hash:v.hash,params:h(v.params)});T(x,v);function E(e,t,n){let r=_(t||u(e,g));n&&p.beforeRouteStateSync?.(r,n),T(x,r)}if(!g)return l(e=>{e?.route?E(void 0,e.route,e):e?.url?E(void 0,b(e.url,x.path),e):e?.page?E(void 0,d(e.page),e):E(void 0,void 0,e)}),{route:t(x)};let D=g,O=C(D),k=S(O)||n().includes(O);i(e=>{E(e)}),a(()=>{E()}),s(()=>{E()}),o(()=>{E()});let A=l(e=>{w(D,k,e)&&(e?.route?E(void 0,e.route,e):e?.url?E(void 0,b(e.url,x.path),e):e?.page?E(void 0,d(e.page),e):E(void 0,void 0,e))});return c(()=>{A()}),{route:t(x)}}function D(e={}){return E(e).route}function O(){return v()}function k(){return _()}export{E as createRouteStateController,k as useNativePageRouter,O as useNativeRouter,D as useRoute};
@@ -1 +1 @@
1
- import{isDynamicRoutePath as e}from"./path.mjs";import{decodeRouteParamSegment as t,parsePathParamToken as n}from"./params.mjs";function r(e){return e.split(`/`).filter(Boolean)}function i(e){return[e.path,...e.aliasPaths]}function a(e,t){let n=[],r=/* @__PURE__ */ new Set,i=e;for(;i&&!(r.has(i.name)||(r.add(i.name),n.unshift(i),!i.parentName));)i=t.recordByName.get(i.parentName);return n}function o(e){let t;for(let n of e)n.meta&&(t||(t=Object.create(null)),Object.assign(t,n.meta));return t}function s(e,t){let n=/* @__PURE__ */ new Set;if(!t.has(e))return n;n.add(e);let r=!0;for(;r;){r=!1;for(let[e,i]of t.entries())i.parentName&&!n.has(e)&&n.has(i.parentName)&&(n.add(e),r=!0)}return n}function c(e){let t={};for(let[n,r]of e.entries())r.length!==0&&(t[n]=r.length===1?r[0]:r);return t}function l(e,i){let a=r(e),o=r(i),s=/* @__PURE__ */ new Map,l=(e,t)=>{let n=s.get(e);if(n){n.push(t);return}s.set(e,[t])},u=e=>{let t=s.get(e);t&&t.length!==0&&(t.pop(),t.length===0&&s.delete(e))},d=(e,n,r)=>{for(let i=0;i<r;i+=1)l(e,t(o[n+i]));return()=>{for(let t=0;t<r;t+=1)u(e)}},f=(e,r)=>{if(e>=a.length)return r>=o.length;let i=a[e],s=n(i);if(!s)return r>=o.length||i!==o[r]?!1:f(e+1,r+1);if(s.modifier===``){if(r>=o.length)return!1;l(s.key,t(o[r]));let n=f(e+1,r+1);return n||u(s.key),n}if(s.modifier===`?`){if(r<o.length){if(l(s.key,t(o[r])),f(e+1,r+1))return!0;u(s.key)}return f(e+1,r)}let c=+(s.modifier===`+`),p=o.length-r;for(let t=p;t>=c;--t){let n=d(s.key,r,t);if(f(e+1,r+t))return!0;n()}return!1};if(f(0,0))return c(s)}function u(t,n){if(t.name){let e=n.recordByName.get(t.name);if(e)return{record:e,matchedRecords:a(e,n)}}let r=n.nameByStaticPath.get(t.path);if(r){let e=n.recordByName.get(r);if(e)return{record:e,matchedRecords:a(e,n),matchedPath:t.path}}for(let r of n.recordByName.values())for(let o of i(r)){if(!e(o))continue;let i=l(o,t.path);if(i)return{record:r,matchedRecords:a(r,n),matchedPath:o,params:i}}}export{s as collectRouteNamesForRemoval,o as mergeMatchedRouteMeta,u as resolveMatchedRouteRecord};
1
+ import{isDynamicRoutePath as e}from"./path.mjs";import{decodeRouteParamSegment as t,parsePathParamToken as n}from"./params.mjs";function r(e){return e.split(`/`).filter(Boolean)}function i(e){return[e.path,...e.aliasPaths]}function a(e,t){let n=[],r=/* @__PURE__ */ new Set,i=e;for(;i&&!(r.has(i.name)||(r.add(i.name),n.unshift(i),!i.parentName));)i=t.recordByName.get(i.parentName);return n}function o(e){let t;for(let n of e)n.meta&&(t||(t=Object.create(null)),Object.assign(t,n.meta));return t}function s(e,t){let n=/* @__PURE__ */ new Set;if(!t.has(e))return n;n.add(e);let r=!0;for(;r;){r=!1;for(let[e,i]of t.entries())i.parentName&&!n.has(e)&&n.has(i.parentName)&&(n.add(e),r=!0)}return n}function c(e){let t={};for(let[n,r]of e.entries())r.length!==0&&(t[n]=r.length===1?r[0]:r);return t}function l(e,i){let a=r(e),o=r(i),s=/* @__PURE__ */ new Map,l=(e,t)=>{let n=s.get(e);n?n.push(t):s.set(e,[t])},u=e=>{let t=s.get(e);t&&t.length!==0&&(t.pop(),t.length===0&&s.delete(e))},d=(e,n,r)=>{for(let i=0;i<r;i+=1)l(e,t(o[n+i]));return()=>{for(let t=0;t<r;t+=1)u(e)}},f=(e,r)=>{if(e>=a.length)return r>=o.length;let i=a[e],s=n(i);if(!s)return r>=o.length||i!==o[r]?!1:f(e+1,r+1);if(s.modifier===``){if(r>=o.length)return!1;l(s.key,t(o[r]));let n=f(e+1,r+1);return n||u(s.key),n}if(s.modifier===`?`){if(r<o.length){if(l(s.key,t(o[r])),f(e+1,r+1))return!0;u(s.key)}return f(e+1,r)}let c=+(s.modifier===`+`),p=o.length-r;for(let t=p;t>=c;--t){let n=d(s.key,r,t);if(f(e+1,r+t))return!0;n()}return!1};if(f(0,0))return c(s)}function u(t,n){if(t.name){let e=n.recordByName.get(t.name);if(e)return{record:e,matchedRecords:a(e,n)}}let r=n.nameByStaticPath.get(t.path);if(r){let e=n.recordByName.get(r);if(e)return{record:e,matchedRecords:a(e,n),matchedPath:t.path}}for(let r of n.recordByName.values())for(let o of i(r)){if(!e(o))continue;let i=l(o,t.path);if(i)return{record:r,matchedRecords:a(r,n),matchedPath:o,params:i}}}export{s as collectRouteNamesForRemoval,o as mergeMatchedRouteMeta,u as resolveMatchedRouteRecord};
@@ -1 +1 @@
1
- import{normalizeRouteParams as e}from"./query.mjs";const t=/^:(\w+)(?:\([^)]*\))?([+*?])?$/;function n(e){let n=t.exec(e);if(n)return{key:n[1],modifier:n[2]??``}}function r(e){return e===void 0?[]:Array.isArray(e)?e:[e]}function i(e){return encodeURIComponent(e)}function a(e){try{return decodeURIComponent(e)}catch{return e}}function o(e,t,a){let o=[],s=/* @__PURE__ */ new Set;for(let c of e.split(`/`)){if(!c)continue;let e=n(c);if(!e){o.push(c);continue}let l=r(t[e.key]);if(e.modifier===``){if(l.length!==1)throw Error(`Missing required param "${e.key}" for named route "${a}"`);s.add(e.key),o.push(i(l[0]));continue}if(e.modifier===`?`){if(l.length===0)continue;if(l.length>1)throw Error(`Param "${e.key}" for named route "${a}" must be a single value`);s.add(e.key),o.push(i(l[0]));continue}if(e.modifier===`+`){if(l.length===0)throw Error(`Missing required repeatable param "${e.key}" for named route "${a}"`);s.add(e.key);for(let e of l)o.push(i(e));continue}l.length>0&&s.add(e.key);for(let e of l)o.push(i(e))}return{path:o.join(`/`),consumedKeys:s}}function s(e){return e===void 0?!1:!Array.isArray(e)||e.length>0}function c(e,t,n){let r=Object.keys(e).filter(e=>!t.has(e)).filter(t=>s(e[t]));if(r.length!==0)throw Error(`Unexpected params for named route "${n}": ${r.join(`, `)}`)}function l(t,n,r){let i=t.name;if(typeof i!=`string`||!i||t.path!==void 0||t.fullPath!==void 0)return t;let a=n.recordByName.get(i);if(!a)throw Error(`Named route "${i}" is not defined in createRouter({ routes | namedRoutes })`);let s=t.params?e(t.params):{},l=o(a.path,s,i);return r===`strict`&&c(s,l.consumedKeys,i),{...t,path:l.path?`/${l.path}`:`/`,params:s}}export{a as decodeRouteParamSegment,n as parsePathParamToken,l as resolveNamedRouteLocation};
1
+ import{normalizeRouteParams as e}from"./query.mjs";const t=/^:(\w+)(?:\([^)]*\))?([+*?])?$/;function n(e){let n=t.exec(e);if(n)return{key:n[1],modifier:n[2]??``}}function r(e){return e===void 0?[]:Array.isArray(e)?e:[e]}function i(e){return encodeURIComponent(e)}function a(e){try{return decodeURIComponent(e)}catch{return e}}function o(e,t,a){let o=[],s=/* @__PURE__ */ new Set;for(let c of e.split(`/`)){if(!c)continue;let e=n(c);if(!e){o.push(c);continue}let l=r(t[e.key]);if(e.modifier===``){if(l.length!==1)throw Error(`Missing required param "${e.key}" for named route "${a}"`);s.add(e.key),o.push(i(l[0]))}else if(e.modifier===`?`){if(l.length===0)continue;if(l.length>1)throw Error(`Param "${e.key}" for named route "${a}" must be a single value`);s.add(e.key),o.push(i(l[0]))}else if(e.modifier===`+`){if(l.length===0)throw Error(`Missing required repeatable param "${e.key}" for named route "${a}"`);s.add(e.key);for(let e of l)o.push(i(e))}else{l.length>0&&s.add(e.key);for(let e of l)o.push(i(e))}}return{path:o.join(`/`),consumedKeys:s}}function s(e){return e===void 0?!1:!Array.isArray(e)||e.length>0}function c(e,t,n){let r=Object.keys(e).filter(e=>!t.has(e)).filter(t=>s(e[t]));if(r.length!==0)throw Error(`Unexpected params for named route "${n}": ${r.join(`, `)}`)}function l(t,n,r){let i=t.name;if(typeof i!=`string`||!i||t.path!==void 0||t.fullPath!==void 0)return t;let a=n.recordByName.get(i);if(!a)throw Error(`Named route "${i}" is not defined in createRouter({ routes | namedRoutes })`);let s=t.params?e(t.params):{},l=o(a.path,s,i);return r===`strict`&&c(s,l.consumedKeys,i),{...t,path:l.path?`/${l.path}`:`/`,params:s}}export{a as decodeRouteParamSegment,n as parsePathParamToken,l as resolveNamedRouteLocation};
@@ -1 +1 @@
1
- function e(e){let t=[];for(let n of e.split(`/`))if(n&&n!==`.`){if(n===`..`){t.length>0&&t.pop();continue}t.push(n)}return t}function t(t,n){if(!t)return e(n).join(`/`);if(t.startsWith(`/`))return e(t).join(`/`);if(t.startsWith(`./`)||t.startsWith(`../`)){let r=e(n);r.length>0&&r.pop();for(let e of t.split(`/`))if(e&&e!==`.`){if(e===`..`){r.length>0&&r.pop();continue}r.push(e)}return r.join(`/`)}return e(t).join(`/`)}function n(e){return e?`/${e}`:`/`}const r=/(?:^|\/):/;function i(e){return r.test(e)}export{n as createAbsoluteRoutePath,i as isDynamicRoutePath,t as resolvePath};
1
+ function e(e){let t=[];for(let n of e.split(`/`))n&&n!==`.`&&(n===`..`?t.length>0&&t.pop():t.push(n));return t}function t(t,n){if(!t)return e(n).join(`/`);if(t.startsWith(`/`))return e(t).join(`/`);if(t.startsWith(`./`)||t.startsWith(`../`)){let r=e(n);r.length>0&&r.pop();for(let e of t.split(`/`))e&&e!==`.`&&(e===`..`?r.length>0&&r.pop():r.push(e));return r.join(`/`)}return e(t).join(`/`)}function n(e){return e?`/${e}`:`/`}const r=/(?:^|\/):/;function i(e){return r.test(e)}export{n as createAbsoluteRoutePath,i as isDynamicRoutePath,t as resolvePath};
@@ -1 +1 @@
1
- const e=/\+/g;function t(t){return decodeURIComponent(t.replace(e,` `))}function n(e){return encodeURIComponent(e)}function r(e,t,n){let r=e[t];if(r===void 0){e[t]=n;return}if(Array.isArray(r)){r.push(n);return}e[t]=[r,n]}function i(e,t,n){let r=e[t];if(r===void 0){e[t]=n;return}if(Array.isArray(r)){r.push(n);return}e[t]=[r,n]}function a(e){if(e!==void 0)return e===null?null:String(e)}function o(e){let t={};for(let n of Object.keys(e)){let i=e[n];if(Array.isArray(i)){for(let e of i){let i=a(e);i!==void 0&&r(t,n,i)}continue}let o=a(i);o!==void 0&&r(t,n,o)}return t}function s(e){if(e!=null)return String(e)}function c(e){let t={};for(let n of Object.keys(e)){let r=e[n];if(Array.isArray(r)){for(let e of r){let r=s(e);r!==void 0&&i(t,n,r)}continue}let a=s(r);a!==void 0&&i(t,n,a)}return t}function l(e){return e?e.startsWith(`#`)?e:`#${e}`:``}function u(e){let n=e.startsWith(`?`)?e.slice(1):e,i={};if(!n)return i;for(let e of n.split(`&`)){if(!e)continue;let n=e.indexOf(`=`),a=n>=0?e.slice(0,n):e;a&&r(i,t(a),n>=0?t(e.slice(n+1)):null)}return i}function d(e={}){let t=o(e),r=[];for(let e of Object.keys(t)){let i=n(e),a=t[e];if(Array.isArray(a)){for(let e of a)e===null?r.push(i):r.push(`${i}=${n(e)}`);continue}if(a===null){r.push(i);continue}r.push(`${i}=${n(a)}`)}return r.join(`&`)}export{l as normalizeHash,o as normalizeQuery,c as normalizeRouteParams,u as parseQuery,d as stringifyQuery};
1
+ const e=/\+/g;function t(t){return decodeURIComponent(t.replace(e,` `))}function n(e){return encodeURIComponent(e)}function r(e,t,n){let r=e[t];r===void 0?e[t]=n:Array.isArray(r)?r.push(n):e[t]=[r,n]}function i(e,t,n){let r=e[t];r===void 0?e[t]=n:Array.isArray(r)?r.push(n):e[t]=[r,n]}function a(e){if(e!==void 0)return e===null?null:String(e)}function o(e){let t={};for(let n of Object.keys(e)){let i=e[n];if(Array.isArray(i)){for(let e of i){let i=a(e);i!==void 0&&r(t,n,i)}continue}let o=a(i);o!==void 0&&r(t,n,o)}return t}function s(e){if(e!=null)return String(e)}function c(e){let t={};for(let n of Object.keys(e)){let r=e[n];if(Array.isArray(r)){for(let e of r){let r=s(e);r!==void 0&&i(t,n,r)}continue}let a=s(r);a!==void 0&&i(t,n,a)}return t}function l(e){return e?e.startsWith(`#`)?e:`#${e}`:``}function u(e){let n=e.startsWith(`?`)?e.slice(1):e,i={};if(!n)return i;for(let e of n.split(`&`)){if(!e)continue;let n=e.indexOf(`=`),a=n>=0?e.slice(0,n):e;a&&r(i,t(a),n>=0?t(e.slice(n+1)):null)}return i}function d(e={}){let t=o(e),r=[];for(let e of Object.keys(t)){let i=n(e),a=t[e];if(Array.isArray(a))for(let e of a)e===null?r.push(i):r.push(`${i}=${n(e)}`);else a===null?r.push(i):r.push(`${i}=${n(a)}`)}return r.join(`&`)}export{l as normalizeHash,o as normalizeQuery,c as normalizeRouteParams,u as parseQuery,d as stringifyQuery};
@@ -1 +1 @@
1
- import{createAbsoluteRoutePath as e,isDynamicRoutePath as t,resolvePath as n}from"./path.mjs";import{warnRouteConfig as r}from"./recordsWarnings.mjs";function i(e){return e?Array.isArray(e)?e:[e]:[]}function a(e,t,n=`namedRoutes`){return typeof e.name==`string`&&e.name.trim()?e.name.trim():n===`routes`?t||`/`:``}function o(e,t){if(!e)return[];let r=Array.isArray(e)?e:[e],i=[];for(let e of r){if(typeof e!=`string`)continue;let r=n(e,``);r&&r!==t&&(i.includes(r)||i.push(r))}return i}function s(e,t,r=`namedRoutes`){let s=n(e.path,``);if(!s&&e.path!==`/`)return;let c=a(e,s,r);if(c)return{name:c,path:s,aliasPaths:o(e.alias,s),parentName:t,meta:e.meta,beforeEnterGuards:i(e.beforeEnter),redirect:e.redirect}}function c(t,r){return!r||t.startsWith(`/`)?n(t,``):n(`${e(r)}/${t}`,``)}function l(e){return e?Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.length>0):typeof e==`string`&&e.length>0?[e]:[]:[]}function u(e){let t=[];for(let n of e)n&&!t.includes(n)&&t.push(n);return t}function d(t){if(t.length!==0)return t.length===1?e(t[0]):t.map(t=>e(t))}function f(t,n,i,o=[],s,p=`namedRoutes`,m=/* @__PURE__ */ new Set){let h=[];for(let[g,_]of t.entries()){let t=`${p}[${g}]`;if(m.has(_)){r(`ignored route record at ${t}: detected circular children reference`);continue}if(typeof _.path!=`string`||!_.path){let e=typeof _?.name==`string`?_.name.trim():``;r(`ignored route record "${e}" at ${t}: route path is required`);continue}let v=c(_.path,n),y=a(_,v,s);if(!y){r(`ignored route record at ${t}: route name is required`);continue}let b=[],x=/* @__PURE__ */ new Map;for(let i of l(_.alias)){let a=c(i,n);if(!a)continue;if(a===v){r(`ignored alias "${e(a)}" for route "${y}" at ${t}: alias is same as route path`);continue}let o=x.get(a);if(o){r(`ignored duplicate alias "${e(a)}" for route "${y}" at ${t}: already declared by "${o}"`);continue}x.set(a,i),b.push(a)}let S=_.path.startsWith(`/`)?[]:o.map(e=>c(_.path,e)).filter(Boolean).filter(e=>e!==v),C=u([...b,...S]),w={name:y,path:v?e(v):`/`,alias:d(C),meta:_.meta,beforeEnter:_.beforeEnter,redirect:_.redirect};if(h.push({route:w,parentName:i,source:s}),Array.isArray(_.children)&&_.children.length>0){let e=new Set(m);e.add(_),h.push(...f(_.children,v,y,C,s,`${t}.children`,e))}}return h}function p(e,t=`namedRoutes`){if(!e)return[];if(Array.isArray(e))return f(e,void 0,void 0,[],t,t);let n=[];for(let[i,a]of Object.entries(e)){let e=typeof i==`string`?i.trim():``;if(!e){r(`ignored route record at ${t}: route name is required`);continue}if(typeof a!=`string`||!a){r(`ignored route record "${e}" at ${t}: route path is required`);continue}n.push({route:{name:e,path:a},source:t})}return n}function m(e){return[...p(e.routes,`routes`),...p(e.namedRoutes,`namedRoutes`)]}function h(e){let n=/* @__PURE__ */ new Map;for(let[r,i]of e.entries()){!t(i.path)&&!n.has(i.path)&&n.set(i.path,r);for(let e of i.aliasPaths)!t(e)&&!n.has(e)&&n.set(e,r)}return n}function g(e){let t=/* @__PURE__ */ new Map;for(let n of e){let e=s(n.route,n.parentName,n.source);e&&t.set(e.name,e)}return{recordByName:t,nameByStaticPath:h(t)}}export{g as createNamedRouteLookup,h as createNamedRouteNameByStaticPath,d as createRouteRecordAliasValue,f as flattenNamedRouteRecords,s as normalizeRouteRecordRaw,m as resolveRouteOptionEntries};
1
+ import{createAbsoluteRoutePath as e,isDynamicRoutePath as t,resolvePath as n}from"./path.mjs";import{warnRouteConfig as r}from"./recordsWarnings.mjs";function i(e){return e?Array.isArray(e)?e:[e]:[]}function a(e,t,n=`namedRoutes`){return typeof e.name==`string`&&e.name.trim()?e.name.trim():n===`routes`?t||`/`:``}function o(e,t){if(!e)return[];let r=Array.isArray(e)?e:[e],i=[];for(let e of r){if(typeof e!=`string`)continue;let r=n(e,``);r&&r!==t&&(i.includes(r)||i.push(r))}return i}function s(e,t,r=`namedRoutes`){let s=n(e.path,``);if(!s&&e.path!==`/`)return;let c=a(e,s,r);if(c)return{name:c,path:s,aliasPaths:o(e.alias,s),parentName:t,meta:e.meta,beforeEnterGuards:i(e.beforeEnter),redirect:e.redirect}}function c(t,r){return!r||t.startsWith(`/`)?n(t,``):n(`${e(r)}/${t}`,``)}function l(e){return e?Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.length>0):typeof e==`string`&&e.length>0?[e]:[]:[]}function u(e){let t=[];for(let n of e)n&&!t.includes(n)&&t.push(n);return t}function d(t){if(t.length!==0)return t.length===1?e(t[0]):t.map(t=>e(t))}function f(t,n,i,o=[],s,p=`namedRoutes`,m=/* @__PURE__ */ new Set){let h=[];for(let[g,_]of t.entries()){let t=`${p}[${g}]`;if(m.has(_)){r(`ignored route record at ${t}: detected circular children reference`);continue}if(typeof _.path!=`string`||!_.path){let e=typeof _?.name==`string`?_.name.trim():``;r(`ignored route record "${e}" at ${t}: route path is required`);continue}let v=c(_.path,n),y=a(_,v,s);if(!y){r(`ignored route record at ${t}: route name is required`);continue}let b=[],x=/* @__PURE__ */ new Map;for(let i of l(_.alias)){let a=c(i,n);if(!a)continue;if(a===v){r(`ignored alias "${e(a)}" for route "${y}" at ${t}: alias is same as route path`);continue}let o=x.get(a);o?r(`ignored duplicate alias "${e(a)}" for route "${y}" at ${t}: already declared by "${o}"`):(x.set(a,i),b.push(a))}let S=_.path.startsWith(`/`)?[]:o.map(e=>c(_.path,e)).filter(Boolean).filter(e=>e!==v),C=u([...b,...S]),w={name:y,path:v?e(v):`/`,alias:d(C),meta:_.meta,beforeEnter:_.beforeEnter,redirect:_.redirect};if(h.push({route:w,parentName:i,source:s}),Array.isArray(_.children)&&_.children.length>0){let e=new Set(m);e.add(_),h.push(...f(_.children,v,y,C,s,`${t}.children`,e))}}return h}function p(e,t=`namedRoutes`){if(!e)return[];if(Array.isArray(e))return f(e,void 0,void 0,[],t,t);let n=[];for(let[i,a]of Object.entries(e)){let e=typeof i==`string`?i.trim():``;e?typeof a!=`string`||!a?r(`ignored route record "${e}" at ${t}: route path is required`):n.push({route:{name:e,path:a},source:t}):r(`ignored route record at ${t}: route name is required`)}return n}function m(e){return[...p(e.routes,`routes`),...p(e.namedRoutes,`namedRoutes`)]}function h(e){let n=/* @__PURE__ */ new Map;for(let[r,i]of e.entries()){!t(i.path)&&!n.has(i.path)&&n.set(i.path,r);for(let e of i.aliasPaths)!t(e)&&!n.has(e)&&n.set(e,r)}return n}function g(e){let t=/* @__PURE__ */ new Map;for(let n of e){let e=s(n.route,n.parentName,n.source);e&&t.set(e.name,e)}return{recordByName:t,nameByStaticPath:h(t)}}export{g as createNamedRouteLookup,h as createNamedRouteNameByStaticPath,d as createRouteRecordAliasValue,f as flattenNamedRouteRecords,s as normalizeRouteRecordRaw,m as resolveRouteOptionEntries};
@@ -1 +1 @@
1
- import{nextTick as e}from"../../scheduler.mjs";import{toRaw as t}from"../../reactivity/reactive/shared.mjs";import{isRef as n,ref as r}from"../../reactivity/ref.mjs";import{hasOwn as i}from"../../utils.mjs";import{setComputedValue as a}from"../internal.mjs";import{normalizeEmitEventName as o,normalizeEmitPayload as s}from"../emit.mjs";import{isNativeBridgeMethod as c,markNativeBridgeMethod as l}from"../nativeBridge.mjs";import{createComputedAccessors as u}from"./computed.mjs";import{WEVU_COMPONENT_NAME_KEY as d,WEVU_HOST_COMMIT_PROMISE_KEY as f,WEVU_INLINE_MAP_KEY as p,WEVU_NATIVE_INSTANCE_KEY as m,WEVU_PARENT_INSTANCE_KEY as h,WEVU_PROPS_KEY as g,WEVU_RESOLVE_PUBLIC_INSTANCE_METHOD as _,WEVU_RUNTIME_APP_KEY as v,WEVU_RUNTIME_KEY as y}from"@weapp-core/constants";function b(b){let{state:x,setupState:S,computedDefs:C,methodDefs:w,appConfig:T,includeComputed:E,setDataStrategy:D}=b,O={},{computedRefs:k,computedSetters:A,dirtyComputedKeys:j,createTrackedComputed:M,computedProxy:N}=u({includeComputed:E,setDataStrategy:D}),P=r(0),F=Object.create(null),I=(e,n)=>{let r=t(e),i=r[y],a=i?.proxy,o=(e,t)=>{let n=e[t];return c(n)},s=t=>!(!t||typeof t!=`object`||t===e||t===n||t===a||o(t,`triggerEvent`)||o(t,`createSelectorQuery`)||o(t,`createIntersectionObserver`)||o(t,`setData`)),l=r[m];if(s(l))return l;let u=i?.instance;if(s(u))return u},L=e=>{if(i(O,e))return;let t=(...t)=>{let n=I(x,x);if(!n)return;let r=Reflect.get(n,e);if(typeof r==`function`)return r.apply(n,t)};l(t),O[e]=t},R=(e,t)=>{let n=/* @__PURE__ */ new Set,r=e;for(;r&&!n.has(r);){n.add(r);let e=r[v]?.config?.globalProperties;if(e&&i(e,t))return{found:!0,value:e[t]};r=r[h]}let a=typeof globalThis<`u`?globalThis.getApp:void 0;if(typeof a==`function`)try{let e=a()?.[v]?.config?.globalProperties;if(e&&i(e,t))return{found:!0,value:e[t]}}catch{}return{found:!1,value:void 0}},z=e=>{let t=e&&Reflect.get(e,`selectOwnerComponent`);if(typeof t==`function`)try{let n=t.call(e);if(!n||typeof n!=`object`)return;let r=Reflect.get(n,_);if(typeof r==`function`){let e=r.call(n);if(e)return e}return n[y]?.proxy??n.__wevu?.proxy??n}catch{return}},B=new Proxy(x,{get(n,r,a){if(typeof r==`string`){if(P.value,i(S,r))return Reflect.get(S,r,a);if(r===`props`){let e=n[g];if(e&&typeof e==`object`)return e}if(r===`$props`){let e=n[g];if(e&&typeof e==`object`)return e}let c=n[g];if(c&&typeof c==`object`&&i(c,r))return Reflect.get(c,r);if(r===`data`||r===`$state`)return x;if(r===`$computed`)return N;if(r===`$emit`)return(e,...t)=>{let r=I(n,a),i=r&&Reflect.get(r,`triggerEvent`);if(typeof i!=`function`)return;let{detail:c,options:l}=s(t);return i.call(r,o(e),c,l)};if(r===`$nextTick`)return async t=>{await e();let r=I(n,a),i=r&&Reflect.get(r,f);if(i&&(typeof i==`object`||typeof i==`function`)&&`then`in i&&typeof i.then==`function`&&await i,t)return t.call(B)};if(r===`$set`)return(e,t,n)=>(Reflect.set(e,t,n),n);if(r===`$delete`)return(e,t)=>Reflect.deleteProperty(e,t);if(r===`$slots`)return t(n).$slots??Object.freeze(Object.create(null));if(r===`$refs`)return t(n).$refs??Object.create(null);if(r===`$parent`)return z(I(n,a));if(r===`$options`){let e=I(n,a);return{name:e?.[d]??e?.name??e?.is}}if(i(F,r))return Reflect.get(F,r);if(i(O,r))return O[r];if(k[r])return k[r].value;if(i(T.globalProperties,r))return T.globalProperties[r];let l=R(I(n,a),r);if(l.found)return l.value}if(!Reflect.has(n,r)){let e=I(n,a);if(e&&Reflect.has(e,r)){let t=Reflect.get(e,r);return typeof t==`function`?t.bind(e):t}}let c=Reflect.get(n,r,a);return typeof r==`string`&&i(S,r)?Reflect.get(S,r,a):c},set(e,t,r,o){if(typeof t==`string`&&k[t])return a(A,t,r),!0;if(i(S,t)){let e=Reflect.get(S,t,o);return n(e)&&!n(r)?(e.value=r,!0):Reflect.set(S,t,r,o)}if(i(F,t))return Reflect.set(F,t,r);if(Reflect.has(e,t)){let a=Reflect.get(e,t,o);return n(a)&&!n(r)?(a.value=r,!0):i(e[g]??{},t)?Reflect.set(S,t,r,o):Reflect.set(e,t,r,o)}return Reflect.set(F,t,r)},has(e,t){if(t===`data`||t===`$emit`||t===`$nextTick`||t===`$set`||t===`$delete`||t===`$slots`||t===`$refs`||t===`$parent`||t===`$options`||typeof t==`string`&&(i(S,t)||k[t]||i(O,t))||i(F,t))return!0;let n=I(e,e);return typeof t==`string`&&R(n,t).found||n&&Reflect.has(n,t)?!0:Reflect.has(e,t)},ownKeys(e){let t=/* @__PURE__ */ new Set;return Reflect.ownKeys(e).forEach(e=>{t.add(e)}),Reflect.ownKeys(S).forEach(e=>{t.add(e)}),Reflect.ownKeys(F).forEach(e=>t.add(e)),Object.keys(O).forEach(e=>t.add(e)),Object.keys(k).forEach(e=>t.add(e)),[...t]},getOwnPropertyDescriptor(e,t){if(typeof t==`string`&&i(S,t))return Object.getOwnPropertyDescriptor(S,t);if(i(F,t))return Object.getOwnPropertyDescriptor(F,t);if(Reflect.has(e,t))return Object.getOwnPropertyDescriptor(e,t);if(typeof t==`string`){if(t===`data`)return{configurable:!0,enumerable:!1,get(){return x}};if(k[t])return{configurable:!0,enumerable:!0,get(){return k[t].value},set(e){a(A,t,e)}};if(i(O,t))return{configurable:!0,enumerable:!1,value:O[t]}}}});return Object.keys(w).forEach(e=>{let t=w[e];if(typeof t==`function`){O[e]=(...e)=>t.apply(B,e);return}e===p&&t&&typeof t==`object`&&(O[e]=t)}),L(`triggerEvent`),L(`createSelectorQuery`),L(`createIntersectionObserver`),L(`setData`),Object.keys(C).forEach(e=>{let t=C[e];if(typeof t==`function`)k[e]=M(e,()=>t.call(B));else{let n=t.get?.bind(B);if(!n)throw Error(`计算属性 "${e}" 需要提供 getter`);let r=t.set?.bind(B);r?(A[e]=r,k[e]=M(e,n,r)):k[e]=M(e,n)}}),{boundMethods:O,computedRefs:k,computedSetters:A,dirtyComputedKeys:j,computedProxy:N,publicInstance:B,touchSetupMethodsVersion(){P.value+=1}}}export{b as createRuntimeContext};
1
+ import{nextTick as e}from"../../scheduler.mjs";import{toRaw as t}from"../../reactivity/reactive/shared.mjs";import{isRef as n,ref as r}from"../../reactivity/ref.mjs";import{hasOwn as i}from"../../utils.mjs";import{setComputedValue as a}from"../internal.mjs";import{normalizeEmitEventName as o,normalizeEmitPayload as s}from"../emit.mjs";import{isNativeBridgeMethod as c,markNativeBridgeMethod as l}from"../nativeBridge.mjs";import{createComputedAccessors as u}from"./computed.mjs";import{WEVU_COMPONENT_NAME_KEY as d,WEVU_HOST_COMMIT_PROMISE_KEY as f,WEVU_INLINE_MAP_KEY as p,WEVU_NATIVE_INSTANCE_KEY as m,WEVU_PARENT_INSTANCE_KEY as h,WEVU_PROPS_KEY as g,WEVU_RESOLVE_PUBLIC_INSTANCE_METHOD as _,WEVU_RUNTIME_APP_KEY as v,WEVU_RUNTIME_KEY as y}from"@weapp-core/constants";function b(b){let{state:x,setupState:S,computedDefs:C,methodDefs:w,appConfig:T,includeComputed:E,setDataStrategy:D}=b,O={},{computedRefs:k,computedSetters:A,dirtyComputedKeys:j,createTrackedComputed:M,computedProxy:N}=u({includeComputed:E,setDataStrategy:D}),P=r(0),F=Object.create(null),I=(e,n)=>{let r=t(e),i=r[y],a=i?.proxy,o=(e,t)=>{let n=e[t];return c(n)},s=t=>!(!t||typeof t!=`object`||t===e||t===n||t===a||o(t,`triggerEvent`)||o(t,`createSelectorQuery`)||o(t,`createIntersectionObserver`)||o(t,`setData`)),l=r[m];if(s(l))return l;let u=i?.instance;if(s(u))return u},L=e=>{if(i(O,e))return;let t=(...t)=>{let n=I(x,x);if(!n)return;let r=Reflect.get(n,e);if(typeof r==`function`)return r.apply(n,t)};l(t),O[e]=t},R=(e,t)=>{let n=/* @__PURE__ */ new Set,r=e;for(;r&&!n.has(r);){n.add(r);let e=r[v]?.config?.globalProperties;if(e&&i(e,t))return{found:!0,value:e[t]};r=r[h]}let a=typeof globalThis<`u`?globalThis.getApp:void 0;if(typeof a==`function`)try{let e=a()?.[v]?.config?.globalProperties;if(e&&i(e,t))return{found:!0,value:e[t]}}catch{}return{found:!1,value:void 0}},z=e=>{let t=e&&Reflect.get(e,`selectOwnerComponent`);if(typeof t==`function`)try{let n=t.call(e);if(!n||typeof n!=`object`)return;let r=Reflect.get(n,_);if(typeof r==`function`){let e=r.call(n);if(e)return e}return n[y]?.proxy??n.__wevu?.proxy??n}catch{return}},B=new Proxy(x,{get(n,r,a){if(typeof r==`string`){if(P.value,i(S,r))return Reflect.get(S,r,a);if(r===`props`){let e=n[g];if(e&&typeof e==`object`)return e}if(r===`$props`){let e=n[g];if(e&&typeof e==`object`)return e}let c=n[g];if(c&&typeof c==`object`&&i(c,r))return Reflect.get(c,r);if(r===`data`||r===`$state`)return x;if(r===`$computed`)return N;if(r===`$emit`)return(e,...t)=>{let r=I(n,a),i=r&&Reflect.get(r,`triggerEvent`);if(typeof i!=`function`)return;let{detail:c,options:l}=s(t);return i.call(r,o(e),c,l)};if(r===`$nextTick`)return async t=>{await e();let r=I(n,a),i=r&&Reflect.get(r,f);if(i&&(typeof i==`object`||typeof i==`function`)&&`then`in i&&typeof i.then==`function`&&await i,t)return t.call(B)};if(r===`$set`)return(e,t,n)=>(Reflect.set(e,t,n),n);if(r===`$delete`)return(e,t)=>Reflect.deleteProperty(e,t);if(r===`$slots`)return t(n).$slots??Object.freeze(Object.create(null));if(r===`$refs`)return t(n).$refs??Object.create(null);if(r===`$parent`)return z(I(n,a));if(r===`$options`){let e=I(n,a);return{name:e?.[d]??e?.name??e?.is}}if(i(F,r))return Reflect.get(F,r);if(i(O,r))return O[r];if(k[r])return k[r].value;if(i(T.globalProperties,r))return T.globalProperties[r];let l=R(I(n,a),r);if(l.found)return l.value}if(!Reflect.has(n,r)){let e=I(n,a);if(e&&Reflect.has(e,r)){let t=Reflect.get(e,r);return typeof t==`function`?t.bind(e):t}}let c=Reflect.get(n,r,a);return typeof r==`string`&&i(S,r)?Reflect.get(S,r,a):c},set(e,t,r,o){if(typeof t==`string`&&k[t])return a(A,t,r),!0;if(i(S,t)){let e=Reflect.get(S,t,o);return n(e)&&!n(r)?(e.value=r,!0):Reflect.set(S,t,r,o)}if(i(F,t))return Reflect.set(F,t,r);if(Reflect.has(e,t)){let a=Reflect.get(e,t,o);return n(a)&&!n(r)?(a.value=r,!0):i(e[g]??{},t)?Reflect.set(S,t,r,o):Reflect.set(e,t,r,o)}return Reflect.set(F,t,r)},has(e,t){if(t===`data`||t===`$emit`||t===`$nextTick`||t===`$set`||t===`$delete`||t===`$slots`||t===`$refs`||t===`$parent`||t===`$options`||typeof t==`string`&&(i(S,t)||k[t]||i(O,t))||i(F,t))return!0;let n=I(e,e);return typeof t==`string`&&R(n,t).found||n&&Reflect.has(n,t)?!0:Reflect.has(e,t)},ownKeys(e){let t=/* @__PURE__ */ new Set;return Reflect.ownKeys(e).forEach(e=>{t.add(e)}),Reflect.ownKeys(S).forEach(e=>{t.add(e)}),Reflect.ownKeys(F).forEach(e=>t.add(e)),Object.keys(O).forEach(e=>t.add(e)),Object.keys(k).forEach(e=>t.add(e)),[...t]},getOwnPropertyDescriptor(e,t){if(typeof t==`string`&&i(S,t))return Object.getOwnPropertyDescriptor(S,t);if(i(F,t))return Object.getOwnPropertyDescriptor(F,t);if(Reflect.has(e,t))return Object.getOwnPropertyDescriptor(e,t);if(typeof t==`string`){if(t===`data`)return{configurable:!0,enumerable:!1,get(){return x}};if(k[t])return{configurable:!0,enumerable:!0,get(){return k[t].value},set(e){a(A,t,e)}};if(i(O,t))return{configurable:!0,enumerable:!1,value:O[t]}}}});return Object.keys(w).forEach(e=>{let t=w[e];typeof t==`function`?O[e]=(...e)=>t.apply(B,e):e===p&&t&&typeof t==`object`&&(O[e]=t)}),L(`triggerEvent`),L(`createSelectorQuery`),L(`createIntersectionObserver`),L(`setData`),Object.keys(C).forEach(e=>{let t=C[e];if(typeof t==`function`)k[e]=M(e,()=>t.call(B));else{let n=t.get?.bind(B);if(!n)throw Error(`计算属性 "${e}" 需要提供 getter`);let r=t.set?.bind(B);r?(A[e]=r,k[e]=M(e,n,r)):k[e]=M(e,n)}}),{boundMethods:O,computedRefs:k,computedSetters:A,dirtyComputedKeys:j,computedProxy:N,publicInstance:B,touchSetupMethodsVersion(){P.value+=1}}}export{b as createRuntimeContext};
@@ -1 +1 @@
1
- function e(e){return e!==`patch`&&e!==`diff`}function t(t){if(t!==`off`)return n=>{if(t===`fallback`&&!e(n.reason))return;let r=typeof n.bytes==`number`?n.bytes:n.estimatedBytes,i=typeof r==`number`?`${r}B`:`unknown`,a=[`mode=${n.mode}`,`reason=${n.reason}`,`pending=${n.pendingPatchKeys}`,`keys=${n.payloadKeys}`,`bytes=${i}`];if(typeof n.revision==`number`&&a.push(`revision=${n.revision}`),typeof n.committedRevision==`number`&&a.push(`committedRevision=${n.committedRevision}`),typeof n.mergedSiblingParents==`number`&&a.push(`mergedParents=${n.mergedSiblingParents}`),typeof n.computedDirtyKeys==`number`&&a.push(`computedDirty=${n.computedDirtyKeys}`),typeof n.flushCount==`number`&&a.push(`flushes=${n.flushCount}`),typeof n.windowMs==`number`&&a.push(`window=${n.windowMs}ms`),n.targetLabel&&a.push(`target=${n.targetLabel}`),n.bindings?.length){let e=n.bindings.map(e=>{let t=e.sourceLocation?.start;return t?`${e.id}@${e.sourceFile}:${t.line}:${t.column}`:`${e.id}@${e.sourceFile}`});a.push(`bindings=${e.join(`,`)}`)}n.message&&a.push(`message=${n.message}`);let o=`[wevu:setData] ${a.join(` `)}`;if(e(n.reason)){console.warn(o);return}console.info(o)}}export{t as createDiagnosticsLogger};
1
+ function e(e){return e!==`patch`&&e!==`diff`}function t(t){if(t!==`off`)return n=>{if(t===`fallback`&&!e(n.reason))return;let r=n.phase?n.phase.dispatch?.payloadBytes:typeof n.bytes==`number`?n.bytes:n.estimatedBytes,i=typeof r==`number`?`${r}B`:`unknown`,a=[`mode=${n.mode}`,`reason=${n.reason}`,`pending=${n.pendingPatchKeys}`,`keys=${n.payloadKeys}`,`bytes=${i}`];if(typeof n.revision==`number`&&a.push(`revision=${n.revision}`),typeof n.committedRevision==`number`&&a.push(`committedRevision=${n.committedRevision}`),n.phase){let e=n.phase;a.push(`phase=${e.name}`,`observer=${e.observerId}`,`result=${e.result}`,`completion=${e.completion}`,`dispatch=${e.dispatch?.id??`unknown`}`,`prepareMs=${e.prepareDurationMs??`unknown`}`,`dispatchMs=${e.dispatch?.durationMs??`unknown`}`,`commitMs=${e.commitDurationMs??`unknown`}`,`visibleAt=unknown`)}if(typeof n.mergedSiblingParents==`number`&&a.push(`mergedParents=${n.mergedSiblingParents}`),typeof n.computedDirtyKeys==`number`&&a.push(`computedDirty=${n.computedDirtyKeys}`),typeof n.flushCount==`number`&&a.push(`flushes=${n.flushCount}`),typeof n.windowMs==`number`&&a.push(`window=${n.windowMs}ms`),n.targetLabel&&a.push(`target=${n.targetLabel}`),n.bindings?.length){let e=n.bindings.map(e=>{let t=e.sourceLocation?.start;return t?`${e.id}@${e.sourceFile}:${t.line}:${t.column}`:`${e.id}@${e.sourceFile}`});a.push(`bindings=${e.join(`,`)}`)}n.message&&a.push(`message=${n.message}`);let o=`[wevu:setData] ${a.join(` `)}`;e(n.reason)?console.warn(o):console.info(o)}}export{t as createDiagnosticsLogger};
@@ -1 +1 @@
1
- import{queueJob as e}from"../../scheduler.mjs";import{effect as t,stop as n}from"../../reactivity/core.mjs";import{touchReactive as r}from"../../reactivity/reactive/patch.mjs";import{shallowReactive as i}from"../../reactivity/reactive/shallow.mjs";import{isReactive as a,reactive as o}from"../../reactivity/reactive.mjs";import{watch as ee}from"../../reactivity/watch.mjs";import{requireRuntimeCapability as s}from"../capabilities.mjs";import{hasOwn as c}from"../../utils.mjs";import{createBindModel as te}from"../bindModel.mjs";import{hasTrackableSetupBinding as ne,touchSetupBinding as re}from"../setupTracking.mjs";import{createRuntimeContext as ie}from"./context.mjs";import{createDiagnosticsLogger as l}from"./diagnostics.mjs";import{createSetDataScheduler as ae}from"./setData/scheduler.mjs";import{resolveSetDataOptions as oe}from"./setDataOptions.mjs";import{WEVU_ATTRS_KEY as se,WEVU_PROPS_DERIVED_KEYS_KEY as u,WEVU_PROPS_KEY as d,WEVU_SETUP_STATE_KEY as f}from"@weapp-core/constants";function p(e,t){let n=(()=>{e()});return n.stop=()=>n(),n.pause=()=>{t?.pause?.()},n.resume=()=>{t?.resume?.()},n}function ce(e){return typeof e==`function`?e():e??{}}function m(m){let{data:le,resolvedComputed:ue,resolvedMethods:de,appConfig:h,setDataOptions:g,bindingManifest:_}=m;return m=>{g?.strategy===`patch`&&s(`patchStrategy`,`createRuntimeMount(setData.strategy="patch")`);let v=ce(le),y=m?.__wevu_initialProps;if(v&&typeof v==`object`&&!c(v,d))try{Object.defineProperty(v,d,{value:i(Object.create(null)),configurable:!0,enumerable:!1,writable:!1})}catch{}let b=v&&typeof v==`object`?v[d]:void 0;b&&typeof b==`object`&&y&&typeof y==`object`&&Object.assign(b,y);let x=o(v),S=o(Object.create(null)),C=m?.__wevu_snapshotOmitKeys,fe=!!m?.__wevu_deferInitialSnapshot,w=m?.__wevu_initialSnapshot,T=m?.__wevu_initialState,E=new Set(C instanceof Set||Array.isArray(C)?C:[]);if(v&&typeof v==`object`&&!c(v,f))try{Object.defineProperty(v,f,{value:S,configurable:!0,enumerable:!1,writable:!1})}catch{}if(v&&typeof v==`object`&&T&&typeof T==`object`)for(let[e,t]of Object.entries(T))E.has(e)||(v[e]=t);let pe=ue,me=de,D=!0,O=[],k=/* @__PURE__ */ new Set;Object.keys(x).forEach(e=>{let t=x[e];ne(t)&&k.add(e)});let{includeComputed:A,setDataStrategy:j,maxPatchKeys:M,maxPayloadBytes:N,mergeSiblingThreshold:P,mergeSiblingMaxInflationRatio:F,mergeSiblingMaxParentBytes:I,mergeSiblingSkipArray:L,computedCompare:R,computedCompareMaxDepth:z,computedCompareMaxKeys:he,prelinkMaxDepth:ge,prelinkMaxKeys:_e,debug:B,diagnostics:V,loopWarning:H,debugWhen:ve,debugSampleRate:ye,elevateTopKeyThreshold:be,toPlainMaxDepth:xe,toPlainMaxKeys:Se,includeFunctions:Ce,functionPaths:we,shouldIncludeKey:Te}=oe(g),U=l(V),W=V===`off`&&H?l(`fallback`):void 0,Ee=B||U||W?e=>{if(typeof B==`function`)try{B(e)}catch{}U?.(e),e.reason===`loopWarning`&&W?.(e)}:void 0,De=V===`always`?`always`:ve,{boundMethods:Oe,computedRefs:G,computedSetters:ke,dirtyComputedKeys:Ae,computedProxy:je,publicInstance:K,touchSetupMethodsVersion:q}=ie({state:x,setupState:S,computedDefs:pe,methodDefs:me,appConfig:h,includeComputed:A,setDataStrategy:j}),J=m??{setData:()=>{}},Me=J.__wevu_targetLabel,Y,X={state:x,setupState:S,snapshotOmitKeys:E,computedRefs:G,dirtyComputedKeys:Ae,includeComputed:A,setDataStrategy:j,computedCompare:R,computedCompareMaxDepth:z,computedCompareMaxKeys:he,currentAdapter:J,shouldIncludeKey:Te,maxPatchKeys:M,maxPayloadBytes:N,mergeSiblingThreshold:P,mergeSiblingMaxInflationRatio:F,mergeSiblingMaxParentBytes:I,mergeSiblingSkipArray:L,elevateTopKeyThreshold:be,prelinkMaxDepth:ge,prelinkMaxKeys:_e,toPlainMaxDepth:xe,toPlainMaxKeys:Se,includeFunctions:Ce,functionPaths:we,debug:Ee,debugWhen:De,debugSampleRate:ye,bindingManifest:_,loopWarning:H,targetLabel:Me,runTracker:()=>Y?.(),isMounted:()=>D,initialSnapshot:w&&typeof w==`object`?w:void 0,initialState:T&&typeof T==`object`?T:void 0},Z=j===`patch`?s(`patchStrategy`,`createRuntimeMount(setData.strategy="patch")`).createScheduler(X):ae(X),Q=()=>Z.job();Y=t(()=>{r(x);let e=x[d];a(e)&&r(e);let t=x[se];a(t)&&r(t),k.forEach(e=>{let t=S[e]??x[e];re(t)})},{lazy:!0,scheduler:()=>e(Q)}),fe||Q(),O.push(p(()=>n(Y))),Z.start?.(),Z.dispose&&O.push(p(Z.dispose));function Ne(e,t,n){let r=ee(e,(e,n)=>t(e,n),n);return O.push(r),p(()=>{r();let e=O.indexOf(r);e>=0&&O.splice(e,1)},r)}let $={get state(){return x},get setupState(){return S},get proxy(){return K},get methods(){return Oe},get computed(){return je},get adapter(){return J},bindModel:te(K,x,G,ke,S),watch:Ne,snapshot:()=>Z.snapshot(),unmount:()=>{if(D){D=!1,Z.dispose?.();try{J.__wevu_disposeSetData?.()}catch{}O.forEach(e=>{try{e()}catch{}}),O.length=0}}};try{Object.defineProperty($,"__wevu_touchSetupMethodsVersion",{value:q,configurable:!0,enumerable:!1,writable:!1})}catch{$.__wevu_touchSetupMethodsVersion=q}try{Object.defineProperty($,"__wevu_flushSetupSnapshotSync",{value:Q,configurable:!0,enumerable:!1,writable:!1})}catch{$.__wevu_flushSetupSnapshotSync=Q}try{Object.defineProperty($,"__wevu_cloneDispatchedSnapshot",{value:Z.cloneLatestSnapshot,configurable:!0,enumerable:!1,writable:!1})}catch{$.__wevu_cloneDispatchedSnapshot=Z.cloneLatestSnapshot}try{Object.defineProperty($,"__wevu_trackSetupReactiveKey",{value:e=>{k.add(e)},configurable:!0,enumerable:!1,writable:!1})}catch{$.__wevu_trackSetupReactiveKey=e=>{k.add(e)}}try{Object.defineProperty($,u,{value:E,configurable:!0,enumerable:!1,writable:!1})}catch{$[u]=E}return $}}export{m as createRuntimeMount};
1
+ import{queueJob as e}from"../../scheduler.mjs";import{effect as t,stop as n}from"../../reactivity/core.mjs";import{touchReactive as r}from"../../reactivity/reactive/patch.mjs";import{shallowReactive as i}from"../../reactivity/reactive/shallow.mjs";import{isReactive as a,reactive as o}from"../../reactivity/reactive.mjs";import{watch as ee}from"../../reactivity/watch.mjs";import{requireRuntimeCapability as s}from"../capabilities.mjs";import{hasOwn as c}from"../../utils.mjs";import{createBindModel as te}from"../bindModel.mjs";import{hasTrackableSetupBinding as ne,touchSetupBinding as re}from"../setupTracking.mjs";import{createRuntimeContext as ie}from"./context.mjs";import{createDiagnosticsLogger as l}from"./diagnostics.mjs";import{createSetDataScheduler as ae}from"./setData/scheduler.mjs";import{resolveSetDataOptions as oe}from"./setDataOptions.mjs";import{WEVU_ATTRS_KEY as se,WEVU_PROPS_DERIVED_KEYS_KEY as u,WEVU_PROPS_KEY as d,WEVU_SETUP_STATE_KEY as f}from"@weapp-core/constants";function p(e,t){let n=(()=>{e()});return n.stop=()=>n(),n.pause=()=>{t?.pause?.()},n.resume=()=>{t?.resume?.()},n}function ce(e){return typeof e==`function`?e():e??{}}function m(m){let{data:le,resolvedComputed:ue,resolvedMethods:de,appConfig:fe,setDataOptions:h,bindingManifest:g}=m;return m=>{h?.strategy===`patch`&&s(`patchStrategy`,`createRuntimeMount(setData.strategy="patch")`);let _=ce(le),v=m?.__wevu_initialProps;if(_&&typeof _==`object`&&!c(_,d))try{Object.defineProperty(_,d,{value:i(Object.create(null)),configurable:!0,enumerable:!1,writable:!1})}catch{}let y=_&&typeof _==`object`?_[d]:void 0;y&&typeof y==`object`&&v&&typeof v==`object`&&Object.assign(y,v);let b=o(_),x=o(Object.create(null)),S=m?.__wevu_snapshotOmitKeys,pe=!!m?.__wevu_deferInitialSnapshot,C=m?.__wevu_initialSnapshot,w=m?.__wevu_initialState,T=new Set(S instanceof Set||Array.isArray(S)?S:[]);if(_&&typeof _==`object`&&!c(_,f))try{Object.defineProperty(_,f,{value:x,configurable:!0,enumerable:!1,writable:!1})}catch{}if(_&&typeof _==`object`&&w&&typeof w==`object`)for(let[e,t]of Object.entries(w))T.has(e)||(_[e]=t);let me=ue,he=de,E=!0,D=[],O=/* @__PURE__ */ new Set;Object.keys(b).forEach(e=>{let t=b[e];ne(t)&&O.add(e)});let{includeComputed:k,setDataStrategy:A,maxPatchKeys:j,maxPayloadBytes:M,mergeSiblingThreshold:N,mergeSiblingMaxInflationRatio:P,mergeSiblingMaxParentBytes:F,mergeSiblingSkipArray:I,computedCompare:L,computedCompareMaxDepth:R,computedCompareMaxKeys:ge,prelinkMaxDepth:_e,prelinkMaxKeys:ve,debug:z,diagnostics:B,loopWarning:V,debugWhen:ye,debugSampleRate:be,debugPhases:xe,elevateTopKeyThreshold:Se,toPlainMaxDepth:Ce,toPlainMaxKeys:we,includeFunctions:Te,functionPaths:Ee,shouldIncludeKey:De}=oe(h),H=l(B),U=B===`off`&&V?l(`fallback`):void 0,Oe=z||H||U?e=>{if(typeof z==`function`)try{z(e)}catch{}H?.(e),e.reason===`loopWarning`&&U?.(e)}:void 0,ke=B===`always`?`always`:ye,{boundMethods:Ae,computedRefs:W,computedSetters:je,dirtyComputedKeys:Me,computedProxy:Ne,publicInstance:G,touchSetupMethodsVersion:K}=ie({state:b,setupState:x,computedDefs:me,methodDefs:he,appConfig:fe,includeComputed:k,setDataStrategy:A}),q=m??{setData:()=>{}},Pe=q.__wevu_targetLabel,J,Y={state:b,setupState:x,snapshotOmitKeys:T,computedRefs:W,dirtyComputedKeys:Me,includeComputed:k,setDataStrategy:A,computedCompare:L,computedCompareMaxDepth:R,computedCompareMaxKeys:ge,currentAdapter:q,shouldIncludeKey:De,maxPatchKeys:j,maxPayloadBytes:M,mergeSiblingThreshold:N,mergeSiblingMaxInflationRatio:P,mergeSiblingMaxParentBytes:F,mergeSiblingSkipArray:I,elevateTopKeyThreshold:Se,prelinkMaxDepth:_e,prelinkMaxKeys:ve,toPlainMaxDepth:Ce,toPlainMaxKeys:we,includeFunctions:Te,functionPaths:Ee,debug:Oe,debugWhen:ke,debugSampleRate:be,debugPhases:xe,bindingManifest:g,loopWarning:V,targetLabel:Pe,runTracker:()=>J?.(),isMounted:()=>E,initialSnapshot:C&&typeof C==`object`?C:void 0,initialState:w&&typeof w==`object`?w:void 0},X=A===`patch`?s(`patchStrategy`,`createRuntimeMount(setData.strategy="patch")`).createScheduler(Y):ae(Y),Z=()=>X.job(),Q=()=>{J?.(),X.job()};J=t(()=>{r(b);let e=b[d];a(e)&&r(e);let t=b[se];a(t)&&r(t),O.forEach(e=>{let t=x[e]??b[e];re(t)})},{lazy:!0,scheduler:()=>e(Z)}),pe||Z(),D.push(p(()=>n(J))),X.start?.(),X.dispose&&D.push(p(X.dispose));function Fe(e,t,n){let r=ee(e,(e,n)=>t(e,n),n);return D.push(r),p(()=>{r();let e=D.indexOf(r);e>=0&&D.splice(e,1)},r)}let $={get state(){return b},get setupState(){return x},get proxy(){return G},get methods(){return Ae},get computed(){return Ne},get adapter(){return q},bindModel:te(G,b,W,je,x),watch:Fe,snapshot:()=>X.snapshot(),unmount:()=>{if(E){E=!1,X.dispose?.();try{q.__wevu_disposeSetData?.()}catch{}D.forEach(e=>{try{e()}catch{}}),D.length=0}}};try{Object.defineProperty($,"__wevu_touchSetupMethodsVersion",{value:K,configurable:!0,enumerable:!1,writable:!1})}catch{$.__wevu_touchSetupMethodsVersion=K}try{Object.defineProperty($,"__wevu_flushSetupSnapshotSync",{value:Q,configurable:!0,enumerable:!1,writable:!1})}catch{$.__wevu_flushSetupSnapshotSync=Q}try{Object.defineProperty($,"__wevu_cloneDispatchedSnapshot",{value:X.cloneLatestSnapshot,configurable:!0,enumerable:!1,writable:!1})}catch{$.__wevu_cloneDispatchedSnapshot=X.cloneLatestSnapshot}try{Object.defineProperty($,"__wevu_trackSetupReactiveKey",{value:e=>{O.add(e)},configurable:!0,enumerable:!1,writable:!1})}catch{$.__wevu_trackSetupReactiveKey=e=>{O.add(e)}}try{Object.defineProperty($,u,{value:T,configurable:!0,enumerable:!1,writable:!1})}catch{$[u]=T}return $}}export{m as createRuntimeMount};
@@ -1,11 +1,12 @@
1
1
  import { MiniProgramAdapter } from "../../types/miniprogram.mjs";
2
2
  import "../../types.mjs";
3
+ import { PhysicalSetDataObserver } from "./observation.mjs";
3
4
  //#region src/runtime/app/setData/commitTracker.d.ts
4
5
  export type SetDataPayload = Record<string, unknown>;
5
6
  export type SetDataAdapterSettlement = 'committed' | 'failed' | 'abandoned';
6
7
  export type SetDataAdapterSettler = (settlement: SetDataAdapterSettlement, cause?: unknown) => void;
7
8
  export interface CommitAwareSetDataAdapter extends MiniProgramAdapter {
8
- __wevu_dispatchSetData?: (payload: SetDataPayload, settle: SetDataAdapterSettler) => void;
9
+ __wevu_dispatchSetData?: (payload: SetDataPayload, settle: SetDataAdapterSettler, observer?: PhysicalSetDataObserver) => void;
9
10
  __wevu_reportSetDataError?: (error: Error) => void;
10
11
  __wevu_disposeSetData?: () => void;
11
12
  }
@@ -1 +1 @@
1
- import{cloneSnapshotValue as e}from"./snapshot.mjs";const t=Promise.resolve();function n(e){return!(!e||typeof e!=`object`&&typeof e!=`function`||typeof e.then!=`function`)}function r(e){try{return e instanceof Error?e.message:String(e)}catch{return`<unprintable cause>`}}function i(e,t,n){let i=r(n),a=/* @__PURE__ */ Error(`[wevu] setData commit failed (${e===`adapter`?`adapter failure`:`out-of-order completion`}, revision=${t.revision}, mode=${t.mode}, kind=${t.kind}): ${i}`);return a.cause=n,a}function a(e){let t=!1,r=!0,i=!1,a=!1,o=(n,r)=>{t||(t=!0,e.settle(n,r))},s=()=>{if(r){i=!0;return}a||e.completion===`callback`&&o(`committed`)};try{let t=e.invoke(s),c=n(t);if(a=c,r=!1,c){t.then(()=>o(`committed`),e=>o(`failed`,e));return}(e.completion===`return`||i)&&o(`committed`)}catch(e){r=!1,o(`failed`,e)}}function o(n){let r=n.initialSnapshot?e(n.initialSnapshot):{},o=new Set(Object.keys(r)),s=0,c=0,l,u;function d(e){return e.inLedger?(e.commitPromise||(e.commitPromise=new Promise(t=>{e.resolveCommit=t})),e.commitPromise):t}let f={preparedSnapshot:r,dispatchedSnapshot:r,committedSnapshot:r,revision:0,committedRevision:0,failedRevision:void 0,needsFullSnapshot:!1,get commitPromise(){return u?d(u):t},disposed:!1},p=(e,t,r)=>{let a=i(e,t,r);try{n.onFailure({kind:e,revision:t.revision,committedRevision:f.committedRevision,mode:t.mode,cause:r,error:a,payloadKeys:t.payloadKeys,pendingPatchKeys:t.pendingPatchKeys})}catch{}},m=e=>{e.resolveCommit?.(),e.resolveCommit=void 0},h=e=>{let t=l;for(;t;){let n=t.next;if(t.inLedger=!1,t.next=void 0,m(t),t===e){l=n,l||(u=void 0);return}t=n}},g=()=>{let e=l;for(;e;){let t=e.next;e.inLedger=!1,e.next=void 0,e.physicalSettled||(e.status=`abandoned`),m(e),e=t}l=void 0,u=void 0,s+=1,c=f.committedRevision},_=()=>{f.needsFullSnapshot=!0},v=(e,t,n)=>{t.status=`failed`,f.failedRevision=t.revision,_(),g(),p(e,t,n)},y=()=>{for(;l?.status===`succeeded`;){let e=l;f.committedSnapshot=e.snapshot,f.committedRevision=e.revision,l=e.next,e.inLedger=!1,e.next=void 0,m(e)}l||(u=void 0)},b=e=>{f.committedSnapshot=e.snapshot,f.committedRevision=e.revision,f.failedRevision=void 0,f.needsFullSnapshot=!1,h(e),y()},x=(e,t,n)=>{if(t===`failed`){p(`adapter`,e,n);return}t===`committed`&&f.committedRevision>e.revision&&(l&&g(),_(),p(`out-of-order`,e,`revision ${e.revision} completed after committed revision ${f.committedRevision}`))},S=(e,t,n)=>{if(!(f.disposed||e.physicalSettled)){if(e.physicalSettled=!0,!e.inLedger||e.epoch!==s){x(e,t,n);return}if(t===`abandoned`){e.status=`abandoned`,_(),g();return}if(t===`failed`){v(`adapter`,e,n);return}if(e.status=`succeeded`,c>e.revision){v(`out-of-order`,e,`revision ${e.revision} completed after revision ${c}`);return}if(c=e.revision,e.kind===`full`){b(e);return}y()}};return{state:f,dispatch:t=>{if(f.disposed)return f.revision;let r=f.revision+1;f.revision=r,f.preparedSnapshot=t.snapshot;let i={revision:r,epoch:s,mode:t.mode,kind:t.kind,snapshot:t.snapshot,payloadKeys:Object.keys(t.payload).length,pendingPatchKeys:t.pendingPatchKeys,status:`dispatched`,physicalSettled:!1,inLedger:!0,next:void 0};u?u.next=i:l=i,u=i,f.dispatchedSnapshot=t.snapshot;for(let e of Object.keys(t.payload))o.add(e.split(`.`,1)[0]);let c=(e,t)=>{S(i,e,t)},d=e(t.payload);if(typeof n.adapter.__wevu_dispatchSetData==`function`)try{n.adapter.__wevu_dispatchSetData(d,c)}catch(e){c(`failed`,e)}else a({invoke:()=>n.adapter.setData?.(d),completion:`return`,settle:c});return r},createFullPayload:e=>{let t={},n=new Set(Object.keys(e));for(let[n,r]of Object.entries(e))t[n]=r===void 0?null:r;for(let e of o)n.has(e)||(t[e]=null);return t},dispose:()=>{f.disposed||(f.disposed=!0,g())}}}export{o as createSetDataCommitTracker,a as observeSetDataCompletion};
1
+ import{observePhysicalDispatch as e}from"./observation.mjs";import{cloneSnapshotValue as t}from"./snapshot.mjs";const n=Promise.resolve();function r(e){return!(!e||typeof e!=`object`&&typeof e!=`function`||typeof e.then!=`function`)}function i(e){try{return e instanceof Error?e.message:String(e)}catch{return`<unprintable cause>`}}function a(e,t,n){let r=i(n),a=/* @__PURE__ */ Error(`[wevu] setData commit failed (${e===`adapter`?`adapter failure`:`out-of-order completion`}, revision=${t.revision}, mode=${t.mode}, kind=${t.kind}): ${r}`);return a.cause=n,a}function o(t){let n=!1,i=!0,a=!1,o=!1,s=!1,c=t.completion,l=(e,r)=>{n||(n=!0,t.observer?.complete(c),t.settle(e,r))},u=()=>{i?a=!0:s||t.completion===`callback`&&l(`committed`)};try{t.observer&&t.payload&&e(t.observer,t.payload);let n=t.invoke(u),d=r(n);if(s=d,i=!1,t.observer&&!o&&(o=!0,t.observer.returned(Date.now())),d){c=`promise`,n.then(()=>l(`committed`),e=>l(`failed`,e));return}(t.completion===`return`||a)&&l(`committed`)}catch(e){c=`throw`,i=!1,t.observer&&!o&&(o=!0,t.observer.returned(Date.now())),l(`failed`,e)}}function s(e){let r=e.initialSnapshot?t(e.initialSnapshot):{},i=new Set(Object.keys(r)),s=0,c=0,l,u;function d(e){return e.inLedger?(e.commitPromise||(e.commitPromise=new Promise(t=>{e.resolveCommit=t})),e.commitPromise):n}let f={preparedSnapshot:r,dispatchedSnapshot:r,committedSnapshot:r,revision:0,committedRevision:0,failedRevision:void 0,needsFullSnapshot:!1,get commitPromise(){return u?d(u):n},disposed:!1},p=(t,n,r)=>{let i=a(t,n,r);try{e.onFailure({kind:t,revision:n.revision,committedRevision:f.committedRevision,mode:n.mode,cause:r,error:i,payloadKeys:n.payloadKeys,pendingPatchKeys:n.pendingPatchKeys})}catch{}},m=e=>{e.resolveCommit?.(),e.resolveCommit=void 0},h=e=>{let t=l;for(;t;){let n=t.next;if(t.inLedger=!1,t.next=void 0,m(t),t===e){l=n,l||(u=void 0);return}t=n}},g=()=>{let e,t=f.disposed?`disposed`:`abandoned`,n=l;for(;n;){let t=n.next;n.inLedger=!1,n.next=void 0,n.physicalSettled||(n.status=`abandoned`,n.observation&&(e??(e=[])).push(n.observation)),m(n),n=t}l=void 0,u=void 0,s+=1,c=f.committedRevision,e?.forEach(e=>e.finish(t))},_=()=>{f.needsFullSnapshot=!0},v=(e,t,n)=>{t.status=`failed`,f.failedRevision=t.revision,_(),g(),p(e,t,n)},y=()=>{for(;l?.status===`succeeded`;){let e=l;f.committedSnapshot=e.snapshot,f.committedRevision=e.revision,l=e.next,e.inLedger=!1,e.next=void 0,m(e)}l||(u=void 0)},b=e=>{f.committedSnapshot=e.snapshot,f.committedRevision=e.revision,f.failedRevision=void 0,f.needsFullSnapshot=!1,h(e),y()},x=(e,t,n)=>{t===`failed`?p(`adapter`,e,n):t===`committed`&&f.committedRevision>e.revision&&(l&&g(),_(),p(`out-of-order`,e,`revision ${e.revision} completed after committed revision ${f.committedRevision}`))},S=(e,t,n)=>{f.disposed||e.physicalSettled||(e.physicalSettled=!0,!e.inLedger||e.epoch!==s?x(e,t,n):t===`abandoned`?(e.status=`abandoned`,_(),g()):t===`failed`?v(`adapter`,e,n):(e.status=`succeeded`,c>e.revision?v(`out-of-order`,e,`revision ${e.revision} completed after revision ${c}`):(c=e.revision,e.kind===`full`?b(e):y())))},C=(e,t,n)=>{if(f.disposed||e.physicalSettled)return;if(!e.observation){S(e,t,n);return}let r=!e.inLedger||e.epoch!==s,i=t===`committed`&&(r?f.committedRevision>e.revision:c>e.revision);S(e,t,n),e.observation?.finish(i?`out-of-order`:r?t===`failed`?`late-failed`:t===`committed`?`late-committed`:`abandoned`:t)};return{state:f,dispatch:n=>{if(f.disposed)return f.revision;let r=f.revision+1;f.revision=r,f.preparedSnapshot=n.snapshot;let a={revision:r,epoch:s,mode:n.mode,kind:n.kind,snapshot:n.snapshot,payloadKeys:Object.keys(n.payload).length,pendingPatchKeys:n.pendingPatchKeys,status:`dispatched`,physicalSettled:!1,inLedger:!0,next:void 0};u?u.next=a:l=a,u=a,f.dispatchedSnapshot=n.snapshot;for(let e of Object.keys(n.payload))i.add(e.split(`.`,1)[0]);a.observation=e.observe?.(n,r);let c=(e,t)=>{C(a,e,t)},d=t(n.payload);if(typeof e.adapter.__wevu_dispatchSetData==`function`)try{e.adapter.__wevu_dispatchSetData(d,c,a.observation?.physical)}catch(e){c(`failed`,e)}else o({invoke:()=>e.adapter.setData?.(d),completion:`return`,settle:c,payload:d,observer:e.adapter.setData?a.observation?.physical:void 0});return r},createFullPayload:e=>{let t={},n=new Set(Object.keys(e));for(let[n,r]of Object.entries(e))t[n]=r===void 0?null:r;for(let e of i)n.has(e)||(t[e]=null);return t},dispose:()=>{f.disposed||(f.disposed=!0,g())}}}export{s as createSetDataCommitTracker,o as observeSetDataCompletion};
@@ -0,0 +1,12 @@
1
+ import { SetDataDebugInfo } from "../../types/setData.mjs";
2
+ import "../../types.mjs";
3
+ import "./commitTracker.mjs";
4
+ //#region src/runtime/app/setData/observation.d.ts
5
+ type Phase = NonNullable<SetDataDebugInfo['phase']>;
6
+ export type SetDataCompletionBoundary = Phase['completion'];
7
+ export interface PhysicalSetDataObserver {
8
+ dispatch: (dispatch: NonNullable<Phase['dispatch']>) => void;
9
+ returned: (returnedAt: number) => void;
10
+ complete: (boundary: SetDataCompletionBoundary) => void;
11
+ }
12
+ //#endregion
@@ -0,0 +1 @@
1
+ let e=0,t=0;function n(e,t){return e!==null&&t>=e?t-e:null}function r(e){try{let t=JSON.stringify(e),n=0;for(let e=0;e<t.length;e++){let r=t.charCodeAt(e);r<128?n+=1:r<2048?n+=2:r>=55296&&r<=56319&&t.charCodeAt(e+1)>=56320&&t.charCodeAt(e+1)<=57343?(n+=4,e+=1):n+=3}return n}catch{return null}}function i(e,n){let i=r(n);e.dispatch({id:++t,startedAt:Date.now(),payloadBytes:i,returnedAt:null,durationMs:null})}function a(t){let r=++e,i=null;return{prepare(){i=Date.now()},revision(e,a){let o=i;if(i=null,t.debugWhen===`fallback`&&(e.reason===`patch`||e.reason===`diff`)||t.debugSampleRate<=0||t.debugSampleRate<1&&Math.random()>=t.debugSampleRate)return;let s=Date.now(),c=null,l=`unknown`,u={mode:e.mode,reason:e.reason,pendingPatchKeys:e.pendingPatchKeys,payloadKeys:Object.keys(e.payload).length,revision:a,targetLabel:t.targetLabel},d=(e,i,a=null)=>{try{t.debug({...u,committedRevision:t.committedRevision(),phase:{version:1,observerId:r,name:e,result:i,completion:l,prepareStartedAt:o,preparedAt:s,prepareDurationMs:n(o,s),settledAt:a,commitDurationMs:a===null?null:n(c?.startedAt??null,a),visibleAt:null,dispatch:c?{...c}:null}})}catch{}};return d(`prepare`,`prepared`),{physical:{dispatch(e){c=e},returned(e){c&&(c={...c,returnedAt:e,durationMs:n(c.startedAt,e)},d(`dispatch`,`pending`))},complete(e){(c||e===`throw`)&&(l=e)}},finish(e){d(`commit`,e,Date.now())}}}}}export{a as createSetDataObservation,i as observePhysicalDispatch};
@@ -35,6 +35,7 @@ export interface SetDataSchedulerOptions {
35
35
  debug: ((info: SetDataDebugInfo) => void) | undefined;
36
36
  debugWhen: 'fallback' | 'always';
37
37
  debugSampleRate: number;
38
+ debugPhases?: boolean;
38
39
  bindingManifest?: WevuRuntimeBindingManifestV1;
39
40
  loopWarning: false | {
40
41
  sampleWindowMs: number;