lithent 1.25.5 → 1.25.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/devHelper/dist/componentMapControl.d.cts +1 -1
- package/devHelper/dist/componentMapControl.d.ts +1 -1
- package/devHelper/dist/createBoundary.d.cts +2 -2
- package/devHelper/dist/createBoundary.d.ts +2 -2
- package/devHelper/dist/lithentDevHelper.cjs +2 -2
- package/devHelper/dist/lithentDevHelper.cjs.map +1 -1
- package/devHelper/dist/lithentDevHelper.mjs +102 -112
- package/devHelper/dist/lithentDevHelper.mjs.map +1 -1
- package/devHelper/dist/lithentDevHelper.umd.js +2 -2
- package/devHelper/dist/lithentDevHelper.umd.js.map +1 -1
- package/devHelper/dist/tests/boundary-lifecycle.test.d.cts +1 -0
- package/devHelper/dist/tests/boundary-lifecycle.test.d.ts +1 -0
- package/devHelper/dist/tests/boundary-regressions.test.d.cts +1 -0
- package/devHelper/dist/tests/boundary-regressions.test.d.ts +1 -0
- package/devHelper/dist/tests/createBoundaryRetry.test.d.cts +1 -0
- package/devHelper/dist/tests/createBoundaryRetry.test.d.ts +1 -0
- package/devHelper/dist/tests/hmrBoundary.d.cts +14 -0
- package/devHelper/dist/tests/hmrBoundary.d.ts +14 -0
- package/dist/index.d.cts +2 -3
- package/dist/index.d.ts +2 -3
- package/dist/lithent-agent-addon.md +1 -1
- package/dist/lithent.cjs +2 -2
- package/dist/lithent.cjs.map +1 -1
- package/dist/lithent.mjs +501 -657
- package/dist/lithent.mjs.map +1 -1
- package/dist/lithent.umd.js +2 -2
- package/dist/lithent.umd.js.map +1 -1
- package/dist/skills/lithent/SKILL.md +1 -1
- package/dist/skills/lithent/constraints/mistakes.md +1 -1
- package/dist/skills/lithent/constraints/rules.md +1 -1
- package/dist/skills/lithent/constraints/troubleshooting.md +1 -1
- package/dist/skills/lithent/examples/quick-examples.md +1 -1
- package/dist/skills/lithent/reference/children-type.md +1 -1
- package/dist/skills/lithent/reference/concurrent.md +1 -1
- package/dist/skills/lithent/reference/element.md +1 -1
- package/dist/skills/lithent/reference/lstore-inference.md +1 -1
- package/dist/skills/lithent/reference/props-types.md +1 -1
- package/dist/tests/core-accessorUpgrade.test.d.cts +1 -0
- package/dist/tests/core-accessorUpgrade.test.d.ts +1 -0
- package/dist/tests/core-addedSubtrees.test.d.cts +1 -0
- package/dist/tests/core-addedSubtrees.test.d.ts +1 -0
- package/dist/tests/core-bulkRemoval.test.d.cts +1 -0
- package/dist/tests/core-bulkRemoval.test.d.ts +1 -0
- package/dist/tests/core-cachedIdentity.test.d.cts +1 -0
- package/dist/tests/core-cachedIdentity.test.d.ts +1 -0
- package/dist/tests/core-callback.d.cts +1 -0
- package/dist/tests/core-callback.d.ts +1 -0
- package/dist/tests/core-checkbox.d.cts +1 -0
- package/dist/tests/core-checkbox.d.ts +1 -0
- package/dist/tests/core-childrentest.d.cts +1 -0
- package/dist/tests/core-childrentest.d.ts +1 -0
- package/dist/tests/core-cleanupErrors.test.d.cts +1 -0
- package/dist/tests/core-cleanupErrors.test.d.ts +1 -0
- package/dist/tests/core-complexRootFragment.d.cts +1 -0
- package/dist/tests/core-complexRootFragment.d.ts +1 -0
- package/dist/tests/core-component-remount.test.d.cts +1 -0
- package/dist/tests/core-component-remount.test.d.ts +1 -0
- package/dist/tests/core-composedRenew.test.d.cts +1 -0
- package/dist/tests/core-composedRenew.test.d.ts +1 -0
- package/dist/tests/core-destroy.d.cts +1 -0
- package/dist/tests/core-destroy.d.ts +1 -0
- package/dist/tests/core-destroyForLoop.d.cts +1 -0
- package/dist/tests/core-destroyForLoop.d.ts +1 -0
- package/dist/tests/core-destroyUnmount.test.d.cts +1 -0
- package/dist/tests/core-destroyUnmount.test.d.ts +1 -0
- package/dist/tests/core-discardedListeners.test.d.cts +1 -0
- package/dist/tests/core-discardedListeners.test.d.ts +1 -0
- package/dist/tests/core-edgeRegressions.test.d.cts +1 -0
- package/dist/tests/core-edgeRegressions.test.d.ts +1 -0
- package/dist/tests/core-eventContract.test.d.cts +1 -0
- package/dist/tests/core-eventContract.test.d.ts +1 -0
- package/dist/tests/core-eventDispatch.test.d.cts +1 -0
- package/dist/tests/core-eventDispatch.test.d.ts +1 -0
- package/dist/tests/core-fragment.d.cts +1 -0
- package/dist/tests/core-fragment.d.ts +1 -0
- package/dist/tests/core-functional-vdom.test.d.cts +1 -0
- package/dist/tests/core-functional-vdom.test.d.ts +1 -0
- package/dist/tests/core-hoc.d.cts +1 -0
- package/dist/tests/core-hoc.d.ts +1 -0
- package/dist/tests/core-innerhtml.d.cts +1 -0
- package/dist/tests/core-innerhtml.d.ts +1 -0
- package/dist/tests/core-input.d.cts +1 -0
- package/dist/tests/core-input.d.ts +1 -0
- package/dist/tests/core-insert.d.cts +1 -0
- package/dist/tests/core-insert.d.ts +1 -0
- package/dist/tests/core-keyedConsumption.test.d.cts +1 -0
- package/dist/tests/core-keyedConsumption.test.d.ts +1 -0
- package/dist/tests/core-keyedFastPath.test.d.cts +1 -0
- package/dist/tests/core-keyedFastPath.test.d.ts +1 -0
- package/dist/tests/core-keyedPositional.test.d.cts +1 -0
- package/dist/tests/core-keyedPositional.test.d.ts +1 -0
- package/dist/tests/core-lmount.d.cts +1 -0
- package/dist/tests/core-lmount.d.ts +1 -0
- package/dist/tests/core-loop.d.cts +1 -0
- package/dist/tests/core-loop.d.ts +1 -0
- package/dist/tests/core-loopDomReuseWithoutKey.d.cts +1 -0
- package/dist/tests/core-loopDomReuseWithoutKey.d.ts +1 -0
- package/dist/tests/core-loopLifecycleOrder.d.cts +1 -0
- package/dist/tests/core-loopLifecycleOrder.d.ts +1 -0
- package/dist/tests/core-loopMoveOrder.d.cts +1 -0
- package/dist/tests/core-loopMoveOrder.d.ts +1 -0
- package/dist/tests/core-loopWithoutKey.d.cts +1 -0
- package/dist/tests/core-loopWithoutKey.d.ts +1 -0
- package/dist/tests/core-loopkey.d.cts +1 -0
- package/dist/tests/core-loopkey.d.ts +1 -0
- package/dist/tests/core-mixedComponentUpdate.d.cts +1 -0
- package/dist/tests/core-mixedComponentUpdate.d.ts +1 -0
- package/dist/tests/core-mountreadycallback.d.cts +1 -0
- package/dist/tests/core-mountreadycallback.d.ts +1 -0
- package/dist/tests/core-nested.d.cts +1 -0
- package/dist/tests/core-nested.d.ts +1 -0
- package/dist/tests/core-nestedUnmount.d.cts +1 -0
- package/dist/tests/core-nestedUnmount.d.ts +1 -0
- package/dist/tests/core-nullUpdater.test.d.cts +1 -0
- package/dist/tests/core-nullUpdater.test.d.ts +1 -0
- package/dist/tests/core-parentChildSync.d.cts +1 -0
- package/dist/tests/core-parentChildSync.d.ts +1 -0
- package/dist/tests/core-parentPosition.test.d.cts +1 -0
- package/dist/tests/core-parentPosition.test.d.ts +1 -0
- package/dist/tests/core-parentUpdateContract.test.d.cts +1 -0
- package/dist/tests/core-parentUpdateContract.test.d.ts +1 -0
- package/dist/tests/core-placementProof.test.d.cts +1 -0
- package/dist/tests/core-placementProof.test.d.ts +1 -0
- package/dist/tests/core-portal-events.test.d.cts +1 -0
- package/dist/tests/core-portal-events.test.d.ts +1 -0
- package/dist/tests/core-portal.d.cts +1 -0
- package/dist/tests/core-portal.d.ts +1 -0
- package/dist/tests/core-portalSiblings.test.d.cts +1 -0
- package/dist/tests/core-portalSiblings.test.d.ts +1 -0
- package/dist/tests/core-props-enumeration.test.d.cts +1 -0
- package/dist/tests/core-props-enumeration.test.d.ts +1 -0
- package/dist/tests/core-radio.d.cts +1 -0
- package/dist/tests/core-radio.d.ts +1 -0
- package/dist/tests/core-redrawRecovery.test.d.cts +1 -0
- package/dist/tests/core-redrawRecovery.test.d.ts +1 -0
- package/dist/tests/core-ref.d.cts +1 -0
- package/dist/tests/core-ref.d.ts +1 -0
- package/dist/tests/core-removedRedraw.test.d.cts +1 -0
- package/dist/tests/core-removedRedraw.test.d.ts +1 -0
- package/dist/tests/core-renderFuzz.test.d.cts +1 -0
- package/dist/tests/core-renderFuzz.test.d.ts +1 -0
- package/dist/tests/core-renderMatrix.test.d.cts +1 -0
- package/dist/tests/core-renderMatrix.test.d.ts +1 -0
- package/dist/tests/core-renew.d.cts +1 -0
- package/dist/tests/core-renew.d.ts +1 -0
- package/dist/tests/core-renewEventTest.d.cts +1 -0
- package/dist/tests/core-renewEventTest.d.ts +1 -0
- package/dist/tests/core-rootFragmentUpdate.d.cts +1 -0
- package/dist/tests/core-rootFragmentUpdate.d.ts +1 -0
- package/dist/tests/core-selectbox.d.cts +1 -0
- package/dist/tests/core-selectbox.d.ts +1 -0
- package/dist/tests/core-structuralRegressions.test.d.cts +1 -0
- package/dist/tests/core-structuralRegressions.test.d.ts +1 -0
- package/dist/tests/core-styleUpdate.d.cts +1 -0
- package/dist/tests/core-styleUpdate.d.ts +1 -0
- package/dist/tests/core-svg.d.cts +1 -0
- package/dist/tests/core-svg.d.ts +1 -0
- package/dist/tests/core-textarea.d.cts +1 -0
- package/dist/tests/core-textarea.d.ts +1 -0
- package/dist/tests/core-thrillProps.d.cts +1 -0
- package/dist/tests/core-thrillProps.d.ts +1 -0
- package/dist/tests/core-unmount.d.cts +1 -0
- package/dist/tests/core-unmount.d.ts +1 -0
- package/dist/tests/core-updatePaths.test.d.cts +1 -0
- package/dist/tests/core-updatePaths.test.d.ts +1 -0
- package/dist/tests/helpers/renderSpec.d.cts +131 -0
- package/dist/tests/helpers/renderSpec.d.ts +131 -0
- package/dist/tests/loopWithoutKey.d.cts +1 -0
- package/dist/tests/loopWithoutKey.d.ts +1 -0
- package/dist/utils/createWDom.d.cts +2 -2
- package/dist/utils/createWDom.d.ts +2 -2
- package/dist/utils/index.d.cts +3 -3
- package/dist/utils/index.d.ts +3 -3
- package/dist/utils/predicator.d.cts +3 -3
- package/dist/utils/predicator.d.ts +3 -3
- package/dist/wDom.d.cts +1 -1
- package/dist/wDom.d.ts +1 -1
- package/element/dist/index.d.cts +1 -1
- package/element/dist/index.d.ts +1 -1
- package/element/dist/lithentElement.cjs +3 -3
- package/element/dist/lithentElement.cjs.map +1 -1
- package/element/dist/lithentElement.mjs +86 -98
- package/element/dist/lithentElement.mjs.map +1 -1
- package/element/dist/lithentElement.umd.js +3 -3
- package/element/dist/lithentElement.umd.js.map +1 -1
- package/element/dist/tests/element-attributes.test.d.cts +1 -0
- package/element/dist/tests/element-attributes.test.d.ts +1 -0
- package/element/dist/tests/element-boundaries.test.d.cts +1 -0
- package/element/dist/tests/element-boundaries.test.d.ts +1 -0
- package/element/dist/tests/element-cleanupErrors.test.d.cts +1 -0
- package/element/dist/tests/element-cleanupErrors.test.d.ts +1 -0
- package/element/dist/tests/element-events.test.d.cts +1 -0
- package/element/dist/tests/element-events.test.d.ts +1 -0
- package/element/dist/tests/element-hardening.test.d.cts +1 -0
- package/element/dist/tests/element-hardening.test.d.ts +1 -0
- package/element/dist/tests/element-lifecycle.test.d.cts +1 -0
- package/element/dist/tests/element-lifecycle.test.d.ts +1 -0
- package/element/dist/tests/element-move.test.d.cts +1 -0
- package/element/dist/tests/element-move.test.d.ts +1 -0
- package/element/dist/tests/element-properties.test.d.cts +1 -0
- package/element/dist/tests/element-properties.test.d.ts +1 -0
- package/element/dist/tests/element-shadow.test.d.cts +1 -0
- package/element/dist/tests/element-shadow.test.d.ts +1 -0
- package/element/dist/tests/element-smoke.test.d.cts +1 -0
- package/element/dist/tests/element-smoke.test.d.ts +1 -0
- package/element/dist/tests/element-ssr.test.d.cts +1 -0
- package/element/dist/tests/element-ssr.test.d.ts +1 -0
- package/element/dist/tests/element-types.test.d.cts +4 -0
- package/element/dist/tests/element-types.test.d.ts +4 -0
- package/element/src/tests/element-cleanupErrors.test.ts +96 -0
- package/examples/dist/assets/index-C65xYpD_.js +2 -0
- package/examples/dist/assets/index-C65xYpD_.js.map +1 -0
- package/examples/dist/complextest.d.ts +1 -0
- package/examples/dist/htm.d.ts +1 -0
- package/examples/dist/index.d.ts +1 -0
- package/examples/dist/index.html +1 -1
- package/examples/dist/mdx.d.ts +1 -0
- package/examples/dist/sharedStore.d.ts +1 -0
- package/ftags/dist/index.d.cts +6 -6
- package/ftags/dist/index.d.ts +6 -6
- package/ftags/dist/lithentFTags.cjs +2 -2
- package/ftags/dist/lithentFTags.cjs.map +1 -1
- package/ftags/dist/lithentFTags.mjs +22 -30
- package/ftags/dist/lithentFTags.mjs.map +1 -1
- package/ftags/dist/lithentFTags.umd.js +2 -2
- package/ftags/dist/lithentFTags.umd.js.map +1 -1
- package/ftags/dist/tests/ftags.d.cts +1 -0
- package/ftags/dist/tests/ftags.d.ts +1 -0
- package/helper/dist/hook/context.d.cts +1 -2
- package/helper/dist/hook/context.d.ts +1 -2
- package/helper/dist/hook/lstore.d.cts +2 -2
- package/helper/dist/hook/lstore.d.ts +2 -2
- package/helper/dist/hook/store.d.cts +1 -1
- package/helper/dist/hook/store.d.ts +1 -1
- package/helper/dist/lifecycle/activity.d.cts +1 -1
- package/helper/dist/lifecycle/activity.d.ts +1 -1
- package/helper/dist/lifecycle/host.d.cts +3 -3
- package/helper/dist/lifecycle/host.d.ts +3 -3
- package/helper/dist/lifecycle/latest.d.cts +2 -2
- package/helper/dist/lifecycle/latest.d.ts +2 -2
- package/helper/dist/lifecycle/lithent.d.cts +1 -1
- package/helper/dist/lifecycle/lithent.d.ts +1 -1
- package/helper/dist/lifecycle/renderProtocol.d.cts +5 -5
- package/helper/dist/lifecycle/renderProtocol.d.ts +5 -5
- package/helper/dist/lifecycle/retainedView.d.cts +2 -2
- package/helper/dist/lifecycle/retainedView.d.ts +2 -2
- package/helper/dist/lifecycle/scopedTask.d.cts +2 -2
- package/helper/dist/lifecycle/scopedTask.d.ts +2 -2
- package/helper/dist/lithentHelper.cjs +2 -2
- package/helper/dist/lithentHelper.cjs.map +1 -1
- package/helper/dist/lithentHelper.mjs +604 -716
- package/helper/dist/lithentHelper.mjs.map +1 -1
- package/helper/dist/lithentHelper.umd.js +2 -2
- package/helper/dist/lithentHelper.umd.js.map +1 -1
- package/helper/dist/tests/cacheupdate-contract.d.cts +1 -0
- package/helper/dist/tests/cacheupdate-contract.d.ts +1 -0
- package/helper/dist/tests/cacheupdate.d.cts +1 -0
- package/helper/dist/tests/cacheupdate.d.ts +1 -0
- package/helper/dist/tests/computed.d.cts +1 -0
- package/helper/dist/tests/computed.d.ts +1 -0
- package/helper/dist/tests/context.d.cts +1 -0
- package/helper/dist/tests/context.d.ts +1 -0
- package/helper/dist/tests/contextRemoval.d.cts +1 -0
- package/helper/dist/tests/contextRemoval.d.ts +1 -0
- package/helper/dist/tests/effect.d.cts +1 -0
- package/helper/dist/tests/effect.d.ts +1 -0
- package/helper/dist/tests/laneInteraction.d.cts +1 -0
- package/helper/dist/tests/laneInteraction.d.ts +1 -0
- package/helper/dist/tests/lcontext.d.cts +1 -0
- package/helper/dist/tests/lcontext.d.ts +1 -0
- package/helper/dist/tests/lstore.d.cts +1 -0
- package/helper/dist/tests/lstore.d.ts +1 -0
- package/helper/dist/tests/renderprops.d.cts +1 -0
- package/helper/dist/tests/renderprops.d.ts +1 -0
- package/helper/dist/tests/state.d.cts +1 -0
- package/helper/dist/tests/state.d.ts +1 -0
- package/helper/dist/tests/store.d.cts +1 -0
- package/helper/dist/tests/store.d.ts +1 -0
- package/helper/dist/tests/store2.d.cts +1 -0
- package/helper/dist/tests/store2.d.ts +1 -0
- package/helper/dist/tests/storeObserver.d.cts +1 -0
- package/helper/dist/tests/storeObserver.d.ts +1 -0
- package/helper/dist/tests/storeOneValue.d.cts +1 -0
- package/helper/dist/tests/storeOneValue.d.ts +1 -0
- package/helper/dist/tests/storeVersion.d.cts +1 -0
- package/helper/dist/tests/storeVersion.d.ts +1 -0
- package/helper/dist/utils/children.d.cts +2 -2
- package/helper/dist/utils/children.d.ts +2 -2
- package/helper/dist/utils/types.d.cts +1 -1
- package/helper/dist/utils/types.d.ts +1 -1
- package/jsx-runtime/dist/index.d.cts +7 -8
- package/jsx-runtime/dist/index.d.ts +7 -8
- package/jsx-runtime/dist/jsxRuntime.cjs +2 -2
- package/jsx-runtime/dist/jsxRuntime.cjs.map +1 -1
- package/jsx-runtime/dist/jsxRuntime.mjs +20 -18
- package/jsx-runtime/dist/jsxRuntime.mjs.map +1 -1
- package/jsx-runtime/dist/jsxRuntime.umd.js +2 -2
- package/jsx-runtime/dist/jsxRuntime.umd.js.map +1 -1
- package/package.json +9 -5
- package/src/index.ts +1 -3
- package/src/tests/core-cleanupErrors.test.ts +310 -0
- package/src/utils/universalRef.ts +16 -1
- package/ssr/dist/helper/index.d.cts +1 -1
- package/ssr/dist/helper/index.d.ts +1 -1
- package/ssr/dist/hydration.d.cts +1 -1
- package/ssr/dist/hydration.d.ts +1 -1
- package/ssr/dist/index.d.cts +1 -1
- package/ssr/dist/index.d.ts +1 -1
- package/ssr/dist/lithentSsr.cjs +3 -3
- package/ssr/dist/lithentSsr.cjs.map +1 -1
- package/ssr/dist/lithentSsr.mjs +187 -182
- package/ssr/dist/lithentSsr.mjs.map +1 -1
- package/ssr/dist/lithentSsr.umd.js +3 -3
- package/ssr/dist/lithentSsr.umd.js.map +1 -1
- package/ssr/dist/renderToString.d.cts +1 -1
- package/ssr/dist/renderToString.d.ts +1 -1
- package/ssr/dist/tests/laneHydration.d.cts +1 -0
- package/ssr/dist/tests/laneHydration.d.ts +1 -0
- package/ssr/dist/tests/renderToString.test.d.cts +1 -0
- package/ssr/dist/tests/renderToString.test.d.ts +1 -0
- package/ssr/dist/tests/tostring.d.cts +1 -1
- package/ssr/dist/tests/tostring.d.ts +1 -1
- package/tag/dist/index.d.cts +8 -8
- package/tag/dist/index.d.ts +8 -8
- package/tag/dist/lithentTag.cjs +3 -3
- package/tag/dist/lithentTag.cjs.map +1 -1
- package/tag/dist/lithentTag.mjs +27 -27
- package/tag/dist/lithentTag.mjs.map +1 -1
- package/tag/dist/lithentTag.umd.js +3 -3
- package/tag/dist/lithentTag.umd.js.map +1 -1
- package/examples/dist/assets/index-Bs54zCvq.js +0 -2
- package/examples/dist/assets/index-Bs54zCvq.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { CompKey } from 'lithent';
|
|
2
2
|
export declare const enableComponentMapManualMode: () => void;
|
|
3
3
|
export declare const disableComponentMapManualMode: () => void;
|
|
4
4
|
export declare const removeComponentEntry: (compKey: CompKey) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { CompKey } from 'lithent';
|
|
2
2
|
export declare const enableComponentMapManualMode: () => void;
|
|
3
3
|
export declare const disableComponentMapManualMode: () => void;
|
|
4
4
|
export declare const removeComponentEntry: (compKey: CompKey) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { CompKey, TagFunction } from 'lithent';
|
|
2
2
|
export type BoundaryController = {
|
|
3
3
|
register: (compKey: CompKey, callerCtor?: TagFunction) => () => void;
|
|
4
4
|
update: (nextCtor: TagFunction) => boolean;
|
|
@@ -7,4 +7,4 @@ export type BoundaryController = {
|
|
|
7
7
|
export declare const registerBoundaryInstance: (moduleId: string, compKey: CompKey, callerCtor?: TagFunction) => () => void;
|
|
8
8
|
export declare const disposeBoundary: (moduleId: string) => void;
|
|
9
9
|
export declare const applyBoundaryUpdate: (moduleId: string, nextCtor: TagFunction) => boolean;
|
|
10
|
-
export declare const createBoundary: (moduleId: string, onFailure?: (
|
|
10
|
+
export declare const createBoundary: (moduleId: string, onFailure?: (reason: string) => void, onApplied?: () => void) => BoundaryController;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { CompKey, TagFunction } from 'lithent';
|
|
2
2
|
export type BoundaryController = {
|
|
3
3
|
register: (compKey: CompKey, callerCtor?: TagFunction) => () => void;
|
|
4
4
|
update: (nextCtor: TagFunction) => boolean;
|
|
@@ -7,4 +7,4 @@ export type BoundaryController = {
|
|
|
7
7
|
export declare const registerBoundaryInstance: (moduleId: string, compKey: CompKey, callerCtor?: TagFunction) => () => void;
|
|
8
8
|
export declare const disposeBoundary: (moduleId: string) => void;
|
|
9
9
|
export declare const applyBoundaryUpdate: (moduleId: string, nextCtor: TagFunction) => boolean;
|
|
10
|
-
export declare const createBoundary: (moduleId: string, onFailure?: (
|
|
10
|
+
export declare const createBoundary: (moduleId: string, onFailure?: (reason: string) => void, onApplied?: () => void) => BoundaryController;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=lithentDevHelper.cjs.map
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("lithent");var t=0,n=()=>{t+=1,(0,e.setComponentMapManualMode)(!0)},r=()=>{t=Math.max(0,t-1),t===0&&(0,e.setComponentMapManualMode)(!1)},i=t=>{(0,e.disposeComponentEntry)(t)},a=3,o=new Map,s=e=>{let t=o.get(e);return t||(t={instances:new Set,domMap:new Map,scheduled:!1,owners:0,registrations:new Map},o.set(e,t),n()),t},c=(t,n,r)=>{let i=s(t),a={callerCtor:r};return i.registrations.set(n,a),i.instances.add(n),queueMicrotask(()=>{var r;let s=e.componentMap.get(n),c=(s==null||(r=s.vd)==null?void 0:r.value)??null;c&&o.get(t)===i&&i.registrations.get(n)===a&&i.domMap.set(n,c)}),()=>{let e=o.get(t);e===i&&e.registrations.get(n)===a&&(e.registrations.delete(n),e.instances.delete(n),e.domMap.delete(n))}},l=e=>{let t=o.get(e);if(t){o.delete(e);for(let[e,n]of Array.from(t.registrations))n.callerCtor||i(e);t.instances.clear(),t.registrations.clear(),t.domMap.clear(),r()}},u=(e,t)=>{let n=o.get(e);return n!=null&&n.instances.size?(n.pendingUpdate={ctor:t,instances:new Map(n.registrations),retryCount:0,updated:!1},n.scheduled||(n.scheduled=!0,queueMicrotask(()=>d(e,n))),!0):!1},d=(t,n)=>{var r,s;if(o.get(t)!==n)return;n.scheduled=!1;let c=n.pendingUpdate;if(!c)return;n.pendingUpdate=void 0;let l=!1,u=Array.from(c.instances,([t,r])=>{var i;return{compKey:t,wDom:((i=e.componentMap.get(t))==null||(i=i.vd)==null?void 0:i.value)||n.domMap.get(t),registration:r}});if(c.instances.clear(),u.forEach(({compKey:r,wDom:a,registration:s})=>{if(o.get(t)!==n||n.registrations.get(r)!==s||a!=null&&a.il)return;if(!a||!a.el){c.instances.set(r,s);return}let{compProps:u,compChild:d}=a;if(!u||!d){c.instances.set(r,s);return}let f=s.callerCtor||c.ctor,p=a.ctor;!s.callerCtor&&p===f&&(a.ctor=void 0);try{s.callerCtor||i(r),(0,e.replaceWDom)(f,u,d,a),c.updated=!0}catch(e){l=!0,console.warn(`[Lithent HMR] boundary update 실패: ${t}`,e)}finally{a.ctor=p}}),o.get(t)===n){if(l?(r=n.onFailure)==null||r.call(n,`replacement failed: ${t}`):c.updated&&!c.instances.size&&((s=n.onApplied)==null||s.call(n)),!n.pendingUpdate&&!l&&c.instances.size){if(c.retryCount+=1,c.retryCount>a){var f;console.warn(`[Lithent HMR] boundary update failed after ${c.retryCount} attempts; aborting: ${t}`),(f=n.onFailure)==null||f.call(n,`missing DOM after ${c.retryCount} attempts: ${t}`);return}n.pendingUpdate=c}n.pendingUpdate&&!n.scheduled&&(n.scheduled=!0,setTimeout(()=>d(t,n),0))}},f=(e,t,n)=>{let r=s(e);r.owners+=1,r.onFailure=t,r.onApplied=n;let i=!1,a=()=>!i&&o.get(e)===r;return{register:(t,n)=>a()?c(e,t,n):()=>{},update:t=>a()&&u(e,t),dispose:()=>{a()&&(i=!0,--r.owners,r.owners||l(e))}}};exports.createBoundary=f;
|
|
2
|
+
//# sourceMappingURL=lithentDevHelper.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lithentDevHelper.cjs","sources":["../src/componentMapControl.ts","../src/createBoundary.ts"],"sourcesContent":["import type { CompKey } from 'lithent';\nimport { setComponentMapManualMode, disposeComponentEntry } from 'lithent';\n\nlet manualModeRefCount = 0;\n\nexport const enableComponentMapManualMode = (): void => {\n manualModeRefCount += 1;\n setComponentMapManualMode(true);\n};\n\nexport const disableComponentMapManualMode = (): void => {\n manualModeRefCount = Math.max(0, manualModeRefCount - 1);\n if (manualModeRefCount === 0) {\n setComponentMapManualMode(false);\n }\n};\n\nexport const removeComponentEntry = (compKey: CompKey): void => {\n disposeComponentEntry(compKey);\n};\n","import type { CompKey, TagFunction, WDom } from 'lithent';\nimport { componentMap, replaceWDom } from 'lithent';\nimport {\n disableComponentMapManualMode,\n enableComponentMapManualMode,\n removeComponentEntry,\n} from './componentMapControl';\n\nconst MAX_RETRY = 3;\n\ntype Registration = { callerCtor?: TagFunction };\n\ntype PendingUpdate = {\n ctor: TagFunction;\n instances: Map<CompKey, Registration>;\n retryCount: number;\n updated: boolean;\n};\n\ntype InstanceRegistry = {\n instances: Set<CompKey>;\n domMap: Map<CompKey, WDom>;\n scheduled: boolean;\n pendingUpdate?: PendingUpdate;\n owners: number;\n registrations: Map<CompKey, Registration>;\n onFailure?: (reason: string) => void;\n onApplied?: () => void;\n};\n\nconst boundaryRegistry = new Map<string, InstanceRegistry>();\n\nconst getRegistry = (moduleId: string): InstanceRegistry => {\n let registry = boundaryRegistry.get(moduleId);\n\n if (!registry) {\n registry = {\n instances: new Set(),\n domMap: new Map(),\n scheduled: false,\n owners: 0,\n registrations: new Map(),\n };\n boundaryRegistry.set(moduleId, registry);\n enableComponentMapManualMode();\n }\n\n return registry;\n};\n\nexport type BoundaryController = {\n register: (compKey: CompKey, callerCtor?: TagFunction) => () => void;\n update: (nextCtor: TagFunction) => boolean;\n dispose: () => void;\n};\n\nexport const registerBoundaryInstance = (\n moduleId: string,\n compKey: CompKey,\n callerCtor?: TagFunction\n) => {\n const registry = getRegistry(moduleId);\n\n const registration = { callerCtor };\n registry.registrations.set(compKey, registration);\n registry.instances.add(compKey);\n\n queueMicrotask(() => {\n const entry = componentMap.get(compKey);\n const currentWDom = entry?.vd?.value ?? null;\n\n if (\n currentWDom &&\n boundaryRegistry.get(moduleId) === registry &&\n registry.registrations.get(compKey) === registration\n ) {\n registry.domMap.set(compKey, currentWDom);\n }\n });\n\n return () => {\n const currentRegistry = boundaryRegistry.get(moduleId);\n if (\n currentRegistry !== registry ||\n currentRegistry.registrations.get(compKey) !== registration\n )\n return;\n\n currentRegistry.registrations.delete(compKey);\n currentRegistry.instances.delete(compKey);\n currentRegistry.domMap.delete(compKey);\n };\n};\n\nexport const disposeBoundary = (moduleId: string) => {\n const registry = boundaryRegistry.get(moduleId);\n\n if (!registry) return;\n boundaryRegistry.delete(moduleId);\n for (const [compKey, registration] of Array.from(registry.registrations)) {\n // A direct call observes its caller; it does not own that caller's lifetime.\n if (!registration.callerCtor) removeComponentEntry(compKey);\n }\n registry.instances.clear();\n registry.registrations.clear();\n registry.domMap.clear();\n disableComponentMapManualMode();\n};\n\nexport const applyBoundaryUpdate = (\n moduleId: string,\n nextCtor: TagFunction\n) => {\n const registry = boundaryRegistry.get(moduleId);\n\n if (!registry?.instances.size) return false;\n\n registry.pendingUpdate = {\n ctor: nextCtor,\n instances: new Map(registry.registrations),\n retryCount: 0,\n updated: false,\n };\n\n if (!registry.scheduled) {\n registry.scheduled = true;\n queueMicrotask(() => flushBoundary(moduleId, registry));\n }\n\n return true;\n};\n\nconst flushBoundary = (moduleId: string, registry: InstanceRegistry) => {\n if (boundaryRegistry.get(moduleId) !== registry) return;\n\n registry.scheduled = false;\n\n const update = registry.pendingUpdate;\n if (!update) return;\n\n registry.pendingUpdate = undefined;\n\n let failed = false;\n\n // Replacement can unregister old instances and register new descendants.\n // Never consume additions made during this flush, or revisit retired nodes.\n const instances = Array.from(update.instances, ([compKey, registration]) => ({\n compKey,\n wDom: componentMap.get(compKey)?.vd?.value || registry.domMap.get(compKey),\n registration,\n }));\n update.instances.clear();\n instances.forEach(({ compKey, wDom: currentWDom, registration }) => {\n if (\n boundaryRegistry.get(moduleId) !== registry ||\n registry.registrations.get(compKey) !== registration ||\n currentWDom?.il\n )\n return;\n\n if (!currentWDom || !currentWDom.el) {\n update.instances.set(compKey, registration);\n return;\n }\n\n const { compProps, compChild } = currentWDom;\n\n if (!compProps || !compChild) {\n update.instances.set(compKey, registration);\n return;\n }\n\n const ctor = registration.callerCtor || update.ctor;\n const previousCtor = currentWDom.ctor;\n // A stable HMR proxy has the same identity across versions. Force only this\n // replacement to remount; the new WDom retains the proxy for later redraws.\n if (!registration.callerCtor && previousCtor === ctor)\n currentWDom.ctor = undefined;\n try {\n // A remount reuses the props/key. Release the old hooks before the core\n // initializes its new hook state under that key.\n if (!registration.callerCtor) removeComponentEntry(compKey);\n replaceWDom(ctor, compProps, compChild, currentWDom);\n update.updated = true;\n } catch (error) {\n failed = true;\n console.warn(`[Lithent HMR] boundary update 실패: ${moduleId}`, error);\n } finally {\n currentWDom.ctor = previousCtor;\n }\n });\n\n if (boundaryRegistry.get(moduleId) !== registry) return;\n if (failed) registry.onFailure?.(`replacement failed: ${moduleId}`);\n else if (update.updated && !update.instances.size) registry.onApplied?.();\n\n // A newer update supersedes retries for the older implementation.\n if (!registry.pendingUpdate && !failed && update.instances.size) {\n update.retryCount += 1;\n\n if (update.retryCount > MAX_RETRY) {\n console.warn(\n `[Lithent HMR] boundary update failed after ${update.retryCount} attempts; aborting: ${moduleId}`\n );\n\n registry.onFailure?.(\n `missing DOM after ${update.retryCount} attempts: ${moduleId}`\n );\n\n return;\n }\n registry.pendingUpdate = update;\n }\n\n if (registry.pendingUpdate && !registry.scheduled) {\n registry.scheduled = true;\n setTimeout(() => flushBoundary(moduleId, registry), 0);\n }\n};\n\nexport const createBoundary = (\n moduleId: string,\n onFailure?: (reason: string) => void,\n onApplied?: () => void\n): BoundaryController => {\n const registry = getRegistry(moduleId);\n registry.owners += 1;\n registry.onFailure = onFailure;\n registry.onApplied = onApplied;\n\n let disposed = false;\n const active = () => !disposed && boundaryRegistry.get(moduleId) === registry;\n return {\n register: (compKey: CompKey, callerCtor?: TagFunction) =>\n active()\n ? registerBoundaryInstance(moduleId, compKey, callerCtor)\n : () => {},\n update: (nextCtor: TagFunction) =>\n active() && applyBoundaryUpdate(moduleId, nextCtor),\n dispose: () => {\n if (!active()) return;\n disposed = true;\n registry.owners -= 1;\n if (!registry.owners) disposeBoundary(moduleId);\n },\n };\n};\n"],"names":["manualModeRefCount","enableComponentMapManualMode","setComponentMapManualMode","disableComponentMapManualMode","removeComponentEntry","compKey","disposeComponentEntry","MAX_RETRY","boundaryRegistry","getRegistry","moduleId","registry","registerBoundaryInstance","callerCtor","registration","entry","componentMap","currentWDom","_a","currentRegistry","disposeBoundary","applyBoundaryUpdate","nextCtor","flushBoundary","update","failed","instances","compProps","compChild","ctor","previousCtor","replaceWDom","error","_c","createBoundary","onFailure","onApplied","disposed","active"],"mappings":"2GAGA,IAAIA,EAAqB,EAElB,MAAMC,EAA+B,IAAY,CAChCD,GAAA,EACtBE,EAAA,0BAA0B,EAAI,CAChC,EAEaC,EAAgC,IAAY,CACvDH,EAAqB,KAAK,IAAI,EAAGA,EAAqB,CAAC,EACnDA,IAAuB,GACzBE,EAAA,0BAA0B,EAAK,CAEnC,EAEaE,EAAwBC,GAA2B,CAC9DC,EAAA,sBAAsBD,CAAO,CAC/B,ECXME,EAAY,EAsBZC,MAAuB,IAEvBC,EAAeC,GAAuC,CACtD,IAAAC,EAAWH,EAAiB,IAAIE,CAAQ,EAE5C,OAAKC,IACQA,EAAA,CACT,cAAe,IACf,WAAY,IACZ,UAAW,GACX,OAAQ,EACR,kBAAmB,GAAI,EAERH,EAAA,IAAIE,EAAUC,CAAQ,EACVV,KAGxBU,CACT,EAQaC,EAA2B,CACtCF,EACAL,EACAQ,IACG,CACG,MAAAF,EAAWF,EAAYC,CAAQ,EAE/BI,EAAe,CAAE,WAAAD,GACd,OAAAF,EAAA,cAAc,IAAIN,EAASS,CAAY,EACvCH,EAAA,UAAU,IAAIN,CAAO,EAE9B,eAAe,IAAM,OACb,MAAAU,EAAQC,EAAAA,aAAa,IAAIX,CAAO,EAChCY,IAAcC,EAAAH,GAAA,YAAAA,EAAO,KAAP,YAAAG,EAAW,QAAS,KAGtCD,GACAT,EAAiB,IAAIE,CAAQ,IAAMC,GACnCA,EAAS,cAAc,IAAIN,CAAO,IAAMS,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AAA,GAGxFuB,EAAAtB,EAAA,YAAA,MAAAsB,EAAA,KAAAtB,EACP,qBAAqBa,EAAO,UAAU,cAAcd,CAAQ,IAG9D,MACF,CACAC,EAAS,cAAgBa,CAC3B,CAEIb,EAAS,eAAiB,CAACA,EAAS,YACtCA,EAAS,UAAY,GACrB,WAAW,IAAMY,EAAcb,EAAUC,CAAQ,EAAG,CAAC,GAEzD,EAEauB,EAAiB,CAC5BxB,EACAyB,EACAC,IACuB,CACjB,MAAAzB,EAAWF,EAAYC,CAAQ,EACrCC,EAAS,QAAU,EACnBA,EAAS,UAAYwB,EACrBxB,EAAS,UAAYyB,EAErB,IAAIC,EAAW,GACf,MAAMC,EAAS,IAAM,CAACD,GAAY7B,EAAiB,IAAIE,CAAQ,IAAMC,EAC9D,MAAA,CACL,SAAU,CAACN,EAAkBQ,IAC3ByB,EAAA,EACI1B,EAAyBF,EAAUL,EAASQ,CAAU,EACtD,IAAM,CAAC,EACb,OAASS,GACPgB,EAAY,GAAAjB,EAAoBX,EAAUY,CAAQ,EACpD,QAAS,IAAM,CACRgB,MACMD,EAAA,GACX1B,EAAS,QAAU,EACdA,EAAS,QAAQS,EAAgBV,CAAQ,EAChD,CAAA,CAEJ"}
|
|
1
|
+
{"version":3,"file":"lithentDevHelper.cjs","names":["componentMap","lithent","manualModeRefCount","enableComponentMapManualMode","disableComponentMapManualMode","removeComponentEntry","compKey","MAX_RETRY","boundaryRegistry","getRegistry","registry","moduleId","registerBoundaryInstance","registration","_entry$vd","entry","currentWDom","currentRegistry","disposeBoundary","applyBoundaryUpdate","nextCtor","flushBoundary","_registry$onFailure","_registry$onApplied","update","failed","instances","_componentMap$get","compProps","compChild","ctor","previousCtor","error","_registry$onFailure2","createBoundary","onFailure","onApplied","disposed","active","callerCtor"],"sources":["../src/componentMapControl.ts","../src/createBoundary.ts"],"sourcesContent":["import type { CompKey } from 'lithent';\nimport { setComponentMapManualMode, disposeComponentEntry } from 'lithent';\n\nlet manualModeRefCount = 0;\n\nexport const enableComponentMapManualMode = (): void => {\n manualModeRefCount += 1;\n setComponentMapManualMode(true);\n};\n\nexport const disableComponentMapManualMode = (): void => {\n manualModeRefCount = Math.max(0, manualModeRefCount - 1);\n if (manualModeRefCount === 0) {\n setComponentMapManualMode(false);\n }\n};\n\nexport const removeComponentEntry = (compKey: CompKey): void => {\n disposeComponentEntry(compKey);\n};\n","import type { CompKey, TagFunction, WDom } from 'lithent';\nimport { componentMap, replaceWDom } from 'lithent';\nimport {\n disableComponentMapManualMode,\n enableComponentMapManualMode,\n removeComponentEntry,\n} from './componentMapControl';\n\nconst MAX_RETRY = 3;\n\ntype Registration = { callerCtor?: TagFunction };\n\ntype PendingUpdate = {\n ctor: TagFunction;\n instances: Map<CompKey, Registration>;\n retryCount: number;\n updated: boolean;\n};\n\ntype InstanceRegistry = {\n instances: Set<CompKey>;\n domMap: Map<CompKey, WDom>;\n scheduled: boolean;\n pendingUpdate?: PendingUpdate;\n owners: number;\n registrations: Map<CompKey, Registration>;\n onFailure?: (reason: string) => void;\n onApplied?: () => void;\n};\n\nconst boundaryRegistry = new Map<string, InstanceRegistry>();\n\nconst getRegistry = (moduleId: string): InstanceRegistry => {\n let registry = boundaryRegistry.get(moduleId);\n\n if (!registry) {\n registry = {\n instances: new Set(),\n domMap: new Map(),\n scheduled: false,\n owners: 0,\n registrations: new Map(),\n };\n boundaryRegistry.set(moduleId, registry);\n enableComponentMapManualMode();\n }\n\n return registry;\n};\n\nexport type BoundaryController = {\n register: (compKey: CompKey, callerCtor?: TagFunction) => () => void;\n update: (nextCtor: TagFunction) => boolean;\n dispose: () => void;\n};\n\nexport const registerBoundaryInstance = (\n moduleId: string,\n compKey: CompKey,\n callerCtor?: TagFunction\n) => {\n const registry = getRegistry(moduleId);\n\n const registration = { callerCtor };\n registry.registrations.set(compKey, registration);\n registry.instances.add(compKey);\n\n queueMicrotask(() => {\n const entry = componentMap.get(compKey);\n const currentWDom = entry?.vd?.value ?? null;\n\n if (\n currentWDom &&\n boundaryRegistry.get(moduleId) === registry &&\n registry.registrations.get(compKey) === registration\n ) {\n registry.domMap.set(compKey, currentWDom);\n }\n });\n\n return () => {\n const currentRegistry = boundaryRegistry.get(moduleId);\n if (\n currentRegistry !== registry ||\n currentRegistry.registrations.get(compKey) !== registration\n )\n return;\n\n currentRegistry.registrations.delete(compKey);\n currentRegistry.instances.delete(compKey);\n currentRegistry.domMap.delete(compKey);\n };\n};\n\nexport const disposeBoundary = (moduleId: string) => {\n const registry = boundaryRegistry.get(moduleId);\n\n if (!registry) return;\n boundaryRegistry.delete(moduleId);\n for (const [compKey, registration] of Array.from(registry.registrations)) {\n // A direct call observes its caller; it does not own that caller's lifetime.\n if (!registration.callerCtor) removeComponentEntry(compKey);\n }\n registry.instances.clear();\n registry.registrations.clear();\n registry.domMap.clear();\n disableComponentMapManualMode();\n};\n\nexport const applyBoundaryUpdate = (\n moduleId: string,\n nextCtor: TagFunction\n) => {\n const registry = boundaryRegistry.get(moduleId);\n\n if (!registry?.instances.size) return false;\n\n registry.pendingUpdate = {\n ctor: nextCtor,\n instances: new Map(registry.registrations),\n retryCount: 0,\n updated: false,\n };\n\n if (!registry.scheduled) {\n registry.scheduled = true;\n queueMicrotask(() => flushBoundary(moduleId, registry));\n }\n\n return true;\n};\n\nconst flushBoundary = (moduleId: string, registry: InstanceRegistry) => {\n if (boundaryRegistry.get(moduleId) !== registry) return;\n\n registry.scheduled = false;\n\n const update = registry.pendingUpdate;\n if (!update) return;\n\n registry.pendingUpdate = undefined;\n\n let failed = false;\n\n // Replacement can unregister old instances and register new descendants.\n // Never consume additions made during this flush, or revisit retired nodes.\n const instances = Array.from(update.instances, ([compKey, registration]) => ({\n compKey,\n wDom: componentMap.get(compKey)?.vd?.value || registry.domMap.get(compKey),\n registration,\n }));\n update.instances.clear();\n instances.forEach(({ compKey, wDom: currentWDom, registration }) => {\n if (\n boundaryRegistry.get(moduleId) !== registry ||\n registry.registrations.get(compKey) !== registration ||\n currentWDom?.il\n )\n return;\n\n if (!currentWDom || !currentWDom.el) {\n update.instances.set(compKey, registration);\n return;\n }\n\n const { compProps, compChild } = currentWDom;\n\n if (!compProps || !compChild) {\n update.instances.set(compKey, registration);\n return;\n }\n\n const ctor = registration.callerCtor || update.ctor;\n const previousCtor = currentWDom.ctor;\n // A stable HMR proxy has the same identity across versions. Force only this\n // replacement to remount; the new WDom retains the proxy for later redraws.\n if (!registration.callerCtor && previousCtor === ctor)\n currentWDom.ctor = undefined;\n try {\n // A remount reuses the props/key. Release the old hooks before the core\n // initializes its new hook state under that key.\n if (!registration.callerCtor) removeComponentEntry(compKey);\n replaceWDom(ctor, compProps, compChild, currentWDom);\n update.updated = true;\n } catch (error) {\n failed = true;\n console.warn(`[Lithent HMR] boundary update 실패: ${moduleId}`, error);\n } finally {\n currentWDom.ctor = previousCtor;\n }\n });\n\n if (boundaryRegistry.get(moduleId) !== registry) return;\n if (failed) registry.onFailure?.(`replacement failed: ${moduleId}`);\n else if (update.updated && !update.instances.size) registry.onApplied?.();\n\n // A newer update supersedes retries for the older implementation.\n if (!registry.pendingUpdate && !failed && update.instances.size) {\n update.retryCount += 1;\n\n if (update.retryCount > MAX_RETRY) {\n console.warn(\n `[Lithent HMR] boundary update failed after ${update.retryCount} attempts; aborting: ${moduleId}`\n );\n\n registry.onFailure?.(\n `missing DOM after ${update.retryCount} attempts: ${moduleId}`\n );\n\n return;\n }\n registry.pendingUpdate = update;\n }\n\n if (registry.pendingUpdate && !registry.scheduled) {\n registry.scheduled = true;\n setTimeout(() => flushBoundary(moduleId, registry), 0);\n }\n};\n\nexport const createBoundary = (\n moduleId: string,\n onFailure?: (reason: string) => void,\n onApplied?: () => void\n): BoundaryController => {\n const registry = getRegistry(moduleId);\n registry.owners += 1;\n registry.onFailure = onFailure;\n registry.onApplied = onApplied;\n\n let disposed = false;\n const active = () => !disposed && boundaryRegistry.get(moduleId) === registry;\n return {\n register: (compKey: CompKey, callerCtor?: TagFunction) =>\n active()\n ? registerBoundaryInstance(moduleId, compKey, callerCtor)\n : () => {},\n update: (nextCtor: TagFunction) =>\n active() && applyBoundaryUpdate(moduleId, nextCtor),\n dispose: () => {\n if (!active()) return;\n disposed = true;\n registry.owners -= 1;\n if (!registry.owners) disposeBoundary(moduleId);\n },\n };\n};\n"],"mappings":"A,4FAGA,IAAIE,EAAqB,EAEZC,MAA2C,CACtD,GAAsB,GACtB,EAAAF,EAAA,0BAAA,CAA0B,EAAI,CAChC,EAEaG,MAA4C,CACvD,EAAqB,KAAK,IAAI,EAAGF,EAAqB,CAAC,EACnDA,IAAuB,IACzB,EAAAD,EAAA,0BAAA,CAA0B,EAAK,CAEnC,EAEaI,EAAwB,GAA2B,EAC9D,EAAAJ,EAAA,sBAAA,CAAsBK,CAAO,CAC/B,ECXMC,EAAY,EAsBZC,EAAmB,IAAI,IAEvBC,EAAe,GAAuC,CAC1D,IAAIC,EAAWF,EAAiB,IAAIG,CAAQ,EAc5C,OAZKD,IACH,EAAW,CACT,UAAW,IAAI,IACf,OAAQ,IAAI,IACZ,UAAW,GACX,OAAQ,EACR,cAAe,IAAI,GACrB,EACAF,EAAiB,IAAIG,EAAUD,CAAQ,EACvCP,EAA6B,GAGxBO,CACT,EAQaE,GACX,EACA,EACA,IACG,CACH,IAAMF,EAAWD,EAAYE,CAAQ,EAE/BE,EAAe,CAAE,YAAW,EAiBlC,OAhBAH,EAAS,cAAc,IAAIJ,EAASO,CAAY,EAChDH,EAAS,UAAU,IAAIJ,CAAO,EAE9B,mBAAqB,C,MACnB,IAAMS,EAAQf,EAAAA,aAAa,IAAIM,CAAO,EAChCU,GAAAD,GAAA,OAAA,EAAcA,EAAO,KAAA,KAAA,IAAA,GAAAD,EAAI,QAAS,KAGtCE,GACAR,EAAiB,IAAIG,CAAQ,IAAMD,GACnCA,EAAS,cAAc,IAAIJ,CAAO,IAAMO,GAExCH,EAAS,OAAO,IAAIJ,EAASU,CAAW,CAE5C,CAAC,MAEY,CACX,IAAMC,EAAkBT,EAAiB,IAAIG,CAAQ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50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const s = () => !l && i.get(n) === a;
|
|
101
|
-
return {
|
|
102
|
-
register: (r, f) => s() ? F(n, r, f) : () => {
|
|
103
|
-
},
|
|
104
|
-
update: (r) => s() && q(n, r),
|
|
105
|
-
dispose: () => {
|
|
106
|
-
s() && (l = !0, a.owners -= 1, a.owners || k(n));
|
|
107
|
-
}
|
|
108
|
-
};
|
|
1
|
+
import { componentMap as e, disposeComponentEntry as t, replaceWDom as n, setComponentMapManualMode as r } from "lithent";
|
|
2
|
+
// src/componentMapControl.ts
|
|
3
|
+
var i = 0, a = () => {
|
|
4
|
+
i += 1, r(!0);
|
|
5
|
+
}, o = () => {
|
|
6
|
+
i = Math.max(0, i - 1), i === 0 && r(!1);
|
|
7
|
+
}, s = (e) => {
|
|
8
|
+
t(e);
|
|
9
|
+
}, c = 3, l = /* @__PURE__ */ new Map(), u = (e) => {
|
|
10
|
+
let t = l.get(e);
|
|
11
|
+
return t || (t = {
|
|
12
|
+
instances: /* @__PURE__ */ new Set(),
|
|
13
|
+
domMap: /* @__PURE__ */ new Map(),
|
|
14
|
+
scheduled: !1,
|
|
15
|
+
owners: 0,
|
|
16
|
+
registrations: /* @__PURE__ */ new Map()
|
|
17
|
+
}, l.set(e, t), a()), t;
|
|
18
|
+
}, d = (t, n, r) => {
|
|
19
|
+
let i = u(t), a = { callerCtor: r };
|
|
20
|
+
return i.registrations.set(n, a), i.instances.add(n), queueMicrotask(() => {
|
|
21
|
+
var r;
|
|
22
|
+
let o = e.get(n), s = (o == null || (r = o.vd) == null ? void 0 : r.value) ?? null;
|
|
23
|
+
s && l.get(t) === i && i.registrations.get(n) === a && i.domMap.set(n, s);
|
|
24
|
+
}), () => {
|
|
25
|
+
let e = l.get(t);
|
|
26
|
+
e === i && e.registrations.get(n) === a && (e.registrations.delete(n), e.instances.delete(n), e.domMap.delete(n));
|
|
27
|
+
};
|
|
28
|
+
}, f = (e) => {
|
|
29
|
+
let t = l.get(e);
|
|
30
|
+
if (t) {
|
|
31
|
+
l.delete(e);
|
|
32
|
+
for (let [e, n] of Array.from(t.registrations)) n.callerCtor || s(e);
|
|
33
|
+
t.instances.clear(), t.registrations.clear(), t.domMap.clear(), o();
|
|
34
|
+
}
|
|
35
|
+
}, p = (e, t) => {
|
|
36
|
+
let n = l.get(e);
|
|
37
|
+
return n != null && n.instances.size ? (n.pendingUpdate = {
|
|
38
|
+
ctor: t,
|
|
39
|
+
instances: new Map(n.registrations),
|
|
40
|
+
retryCount: 0,
|
|
41
|
+
updated: !1
|
|
42
|
+
}, n.scheduled || (n.scheduled = !0, queueMicrotask(() => m(e, n))), !0) : !1;
|
|
43
|
+
}, m = (t, r) => {
|
|
44
|
+
var i, a;
|
|
45
|
+
if (l.get(t) !== r) return;
|
|
46
|
+
r.scheduled = !1;
|
|
47
|
+
let o = r.pendingUpdate;
|
|
48
|
+
if (!o) return;
|
|
49
|
+
r.pendingUpdate = void 0;
|
|
50
|
+
let u = !1, d = Array.from(o.instances, ([t, n]) => {
|
|
51
|
+
var i;
|
|
52
|
+
return {
|
|
53
|
+
compKey: t,
|
|
54
|
+
wDom: ((i = e.get(t)) == null || (i = i.vd) == null ? void 0 : i.value) || r.domMap.get(t),
|
|
55
|
+
registration: n
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
if (o.instances.clear(), d.forEach(({ compKey: e, wDom: i, registration: a }) => {
|
|
59
|
+
if (l.get(t) !== r || r.registrations.get(e) !== a || i != null && i.il) return;
|
|
60
|
+
if (!i || !i.el) {
|
|
61
|
+
o.instances.set(e, a);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
let { compProps: c, compChild: d } = i;
|
|
65
|
+
if (!c || !d) {
|
|
66
|
+
o.instances.set(e, a);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
let f = a.callerCtor || o.ctor, p = i.ctor;
|
|
70
|
+
!a.callerCtor && p === f && (i.ctor = void 0);
|
|
71
|
+
try {
|
|
72
|
+
a.callerCtor || s(e), n(f, c, d, i), o.updated = !0;
|
|
73
|
+
} catch (e) {
|
|
74
|
+
u = !0, console.warn(`[Lithent HMR] boundary update 실패: ${t}`, e);
|
|
75
|
+
} finally {
|
|
76
|
+
i.ctor = p;
|
|
77
|
+
}
|
|
78
|
+
}), l.get(t) === r) {
|
|
79
|
+
if (u ? (i = r.onFailure) == null || i.call(r, `replacement failed: ${t}`) : o.updated && !o.instances.size && ((a = r.onApplied) == null || a.call(r)), !r.pendingUpdate && !u && o.instances.size) {
|
|
80
|
+
if (o.retryCount += 1, o.retryCount > c) {
|
|
81
|
+
var f;
|
|
82
|
+
console.warn(`[Lithent HMR] boundary update failed after ${o.retryCount} attempts; aborting: ${t}`), (f = r.onFailure) == null || f.call(r, `missing DOM after ${o.retryCount} attempts: ${t}`);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
r.pendingUpdate = o;
|
|
86
|
+
}
|
|
87
|
+
r.pendingUpdate && !r.scheduled && (r.scheduled = !0, setTimeout(() => m(t, r), 0));
|
|
88
|
+
}
|
|
89
|
+
}, h = (e, t, n) => {
|
|
90
|
+
let r = u(e);
|
|
91
|
+
r.owners += 1, r.onFailure = t, r.onApplied = n;
|
|
92
|
+
let i = !1, a = () => !i && l.get(e) === r;
|
|
93
|
+
return {
|
|
94
|
+
register: (t, n) => a() ? d(e, t, n) : () => {},
|
|
95
|
+
update: (t) => a() && p(e, t),
|
|
96
|
+
dispose: () => {
|
|
97
|
+
a() && (i = !0, --r.owners, r.owners || f(e));
|
|
98
|
+
}
|
|
99
|
+
};
|
|
109
100
|
};
|
|
110
|
-
export {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
//# sourceMappingURL=lithentDevHelper.mjs.map
|
|
101
|
+
export { h as createBoundary };
|
|
102
|
+
|
|
103
|
+
//# sourceMappingURL=lithentDevHelper.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lithentDevHelper.mjs","sources":["../src/componentMapControl.ts","../src/createBoundary.ts"],"sourcesContent":["import type { CompKey } from 'lithent';\nimport { setComponentMapManualMode, disposeComponentEntry } from 'lithent';\n\nlet manualModeRefCount = 0;\n\nexport const enableComponentMapManualMode = (): void => {\n manualModeRefCount += 1;\n setComponentMapManualMode(true);\n};\n\nexport const disableComponentMapManualMode = (): void => {\n manualModeRefCount = Math.max(0, manualModeRefCount - 1);\n if (manualModeRefCount === 0) {\n setComponentMapManualMode(false);\n }\n};\n\nexport const removeComponentEntry = (compKey: CompKey): void => {\n disposeComponentEntry(compKey);\n};\n","import type { CompKey, TagFunction, WDom } from 'lithent';\nimport { componentMap, replaceWDom } from 'lithent';\nimport {\n disableComponentMapManualMode,\n enableComponentMapManualMode,\n removeComponentEntry,\n} from './componentMapControl';\n\nconst MAX_RETRY = 3;\n\ntype Registration = { callerCtor?: TagFunction };\n\ntype PendingUpdate = {\n ctor: TagFunction;\n instances: Map<CompKey, Registration>;\n retryCount: number;\n updated: boolean;\n};\n\ntype InstanceRegistry = {\n instances: Set<CompKey>;\n domMap: Map<CompKey, WDom>;\n scheduled: boolean;\n pendingUpdate?: PendingUpdate;\n owners: number;\n registrations: Map<CompKey, Registration>;\n onFailure?: (reason: string) => void;\n onApplied?: () => void;\n};\n\nconst boundaryRegistry = new Map<string, InstanceRegistry>();\n\nconst getRegistry = (moduleId: string): InstanceRegistry => {\n let registry = boundaryRegistry.get(moduleId);\n\n if (!registry) {\n registry = {\n instances: new Set(),\n domMap: new Map(),\n scheduled: false,\n owners: 0,\n registrations: new Map(),\n };\n boundaryRegistry.set(moduleId, registry);\n enableComponentMapManualMode();\n }\n\n return registry;\n};\n\nexport type BoundaryController = {\n register: (compKey: CompKey, callerCtor?: TagFunction) => () => void;\n update: (nextCtor: TagFunction) => boolean;\n dispose: () => void;\n};\n\nexport const registerBoundaryInstance = (\n moduleId: string,\n compKey: CompKey,\n callerCtor?: TagFunction\n) => {\n const registry = getRegistry(moduleId);\n\n const registration = { callerCtor };\n registry.registrations.set(compKey, registration);\n registry.instances.add(compKey);\n\n queueMicrotask(() => {\n const entry = componentMap.get(compKey);\n const currentWDom = entry?.vd?.value ?? null;\n\n if (\n currentWDom &&\n boundaryRegistry.get(moduleId) === registry &&\n registry.registrations.get(compKey) === registration\n ) {\n registry.domMap.set(compKey, currentWDom);\n }\n });\n\n return () => {\n const currentRegistry = boundaryRegistry.get(moduleId);\n if (\n currentRegistry !== registry ||\n currentRegistry.registrations.get(compKey) !== registration\n )\n return;\n\n currentRegistry.registrations.delete(compKey);\n currentRegistry.instances.delete(compKey);\n currentRegistry.domMap.delete(compKey);\n };\n};\n\nexport const disposeBoundary = (moduleId: string) => {\n const registry = boundaryRegistry.get(moduleId);\n\n if (!registry) return;\n boundaryRegistry.delete(moduleId);\n for (const [compKey, registration] of Array.from(registry.registrations)) {\n // A direct call observes its caller; it does not own that caller's lifetime.\n if (!registration.callerCtor) removeComponentEntry(compKey);\n }\n registry.instances.clear();\n registry.registrations.clear();\n registry.domMap.clear();\n disableComponentMapManualMode();\n};\n\nexport const applyBoundaryUpdate = (\n moduleId: string,\n nextCtor: TagFunction\n) => {\n const registry = boundaryRegistry.get(moduleId);\n\n if (!registry?.instances.size) return false;\n\n registry.pendingUpdate = {\n ctor: nextCtor,\n instances: new Map(registry.registrations),\n retryCount: 0,\n updated: false,\n };\n\n if (!registry.scheduled) {\n registry.scheduled = true;\n queueMicrotask(() => flushBoundary(moduleId, registry));\n }\n\n return true;\n};\n\nconst flushBoundary = (moduleId: string, registry: InstanceRegistry) => {\n if (boundaryRegistry.get(moduleId) !== registry) return;\n\n registry.scheduled = false;\n\n const update = registry.pendingUpdate;\n if (!update) return;\n\n registry.pendingUpdate = undefined;\n\n let failed = false;\n\n // Replacement can unregister old instances and register new descendants.\n // Never consume additions made during this flush, or revisit retired nodes.\n const instances = Array.from(update.instances, ([compKey, registration]) => ({\n compKey,\n wDom: componentMap.get(compKey)?.vd?.value || registry.domMap.get(compKey),\n registration,\n }));\n update.instances.clear();\n instances.forEach(({ compKey, wDom: currentWDom, registration }) => {\n if (\n boundaryRegistry.get(moduleId) !== registry ||\n registry.registrations.get(compKey) !== registration ||\n currentWDom?.il\n )\n return;\n\n if (!currentWDom || !currentWDom.el) {\n update.instances.set(compKey, registration);\n return;\n }\n\n const { compProps, compChild } = currentWDom;\n\n if (!compProps || !compChild) {\n update.instances.set(compKey, registration);\n return;\n }\n\n const ctor = registration.callerCtor || update.ctor;\n const previousCtor = currentWDom.ctor;\n // A stable HMR proxy has the same identity across versions. Force only this\n // replacement to remount; the new WDom retains the proxy for later redraws.\n if (!registration.callerCtor && previousCtor === ctor)\n currentWDom.ctor = undefined;\n try {\n // A remount reuses the props/key. Release the old hooks before the core\n // initializes its new hook state under that key.\n if (!registration.callerCtor) removeComponentEntry(compKey);\n replaceWDom(ctor, compProps, compChild, currentWDom);\n update.updated = true;\n } catch (error) {\n failed = true;\n console.warn(`[Lithent HMR] boundary update 실패: ${moduleId}`, error);\n } finally {\n currentWDom.ctor = previousCtor;\n }\n });\n\n if (boundaryRegistry.get(moduleId) !== registry) return;\n if (failed) registry.onFailure?.(`replacement failed: ${moduleId}`);\n else if (update.updated && !update.instances.size) registry.onApplied?.();\n\n // A newer update supersedes retries for the older implementation.\n if (!registry.pendingUpdate && !failed && update.instances.size) {\n update.retryCount += 1;\n\n if (update.retryCount > MAX_RETRY) {\n console.warn(\n `[Lithent HMR] boundary update failed after ${update.retryCount} attempts; aborting: ${moduleId}`\n );\n\n registry.onFailure?.(\n `missing DOM after ${update.retryCount} attempts: ${moduleId}`\n );\n\n return;\n }\n registry.pendingUpdate = update;\n }\n\n if (registry.pendingUpdate && !registry.scheduled) {\n registry.scheduled = true;\n setTimeout(() => flushBoundary(moduleId, registry), 0);\n }\n};\n\nexport const createBoundary = (\n moduleId: string,\n onFailure?: (reason: string) => void,\n onApplied?: () => void\n): BoundaryController => {\n const registry = getRegistry(moduleId);\n registry.owners += 1;\n registry.onFailure = onFailure;\n registry.onApplied = onApplied;\n\n let disposed = false;\n const active = () => !disposed && boundaryRegistry.get(moduleId) === registry;\n return {\n register: (compKey: CompKey, callerCtor?: TagFunction) =>\n active()\n ? registerBoundaryInstance(moduleId, compKey, callerCtor)\n : () => {},\n update: (nextCtor: TagFunction) =>\n active() && applyBoundaryUpdate(moduleId, nextCtor),\n dispose: () => {\n if (!active()) return;\n disposed = true;\n registry.owners -= 1;\n if (!registry.owners) disposeBoundary(moduleId);\n },\n };\n};\n"],"names":["manualModeRefCount","enableComponentMapManualMode","setComponentMapManualMode","disableComponentMapManualMode","removeComponentEntry","compKey","disposeComponentEntry","MAX_RETRY","boundaryRegistry","getRegistry","moduleId","registry","registerBoundaryInstance","callerCtor","registration","entry","componentMap","currentWDom","_a","currentRegistry","disposeBoundary","applyBoundaryUpdate","nextCtor","flushBoundary","update","failed","instances","_b","compProps","compChild","ctor","previousCtor","replaceWDom","error","_c","createBoundary","onFailure","onApplied","disposed","active"],"mappings":";AAGA,IAAIA,IAAqB;AAElB,MAAMC,IAA+B,MAAY;AAChC,EAAAD,KAAA,GACtBE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MAAAC,EAAS,gBAAgBa;AAAA,IAC3B;AAEA,IAAIb,EAAS,iBAAiB,CAACA,EAAS,cACtCA,EAAS,YAAY,IACrB,WAAW,MAAMY,EAAcb,GAAUC,CAAQ,GAAG,CAAC;AAAA;AAEzD,GAEawB,IAAiB,CAC5BzB,GACA0B,GACAC,MACuB;AACjB,QAAA1B,IAAWF,EAAYC,CAAQ;AACrC,EAAAC,EAAS,UAAU,GACnBA,EAAS,YAAYyB,GACrBzB,EAAS,YAAY0B;AAErB,MAAIC,IAAW;AACf,QAAMC,IAAS,MAAM,CAACD,KAAY9B,EAAiB,IAAIE,CAAQ,MAAMC;AAC9D,SAAA;AAAA,IACL,UAAU,CAACN,GAAkBQ,MAC3B0B,EAAA,IACI3B,EAAyBF,GAAUL,GAASQ,CAAU,IACtD,MAAM;AAAA,IAAC;AAAA,IACb,QAAQ,CAACS,MACPiB,EAAY,KAAAlB,EAAoBX,GAAUY,CAAQ;AAAA,IACpD,SAAS,MAAM;AACT,MAACiB,QACMD,IAAA,IACX3B,EAAS,UAAU,GACdA,EAAS,UAAQS,EAAgBV,CAAQ;AAAA,IAChD;AAAA,EAAA;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"lithentDevHelper.mjs","names":["manualModeRefCount","enableComponentMapManualMode","setComponentMapManualMode","disableComponentMapManualMode","removeComponentEntry","compKey","MAX_RETRY","boundaryRegistry","getRegistry","registry","moduleId","registerBoundaryInstance","registration","_entry$vd","entry","componentMap","currentWDom","currentRegistry","disposeBoundary","applyBoundaryUpdate","nextCtor","flushBoundary","_registry$onFailure","_registry$onApplied","update","failed","instances","_componentMap$get","compProps","compChild","ctor","previousCtor","replaceWDom","error","_registry$onFailure2","createBoundary","onFailure","onApplied","disposed","active","callerCtor"],"sources":["../src/componentMapControl.ts","../src/createBoundary.ts"],"sourcesContent":["import type { CompKey } from 'lithent';\nimport { setComponentMapManualMode, disposeComponentEntry } from 'lithent';\n\nlet manualModeRefCount = 0;\n\nexport const enableComponentMapManualMode = (): void => {\n manualModeRefCount += 1;\n setComponentMapManualMode(true);\n};\n\nexport const disableComponentMapManualMode = (): void => {\n manualModeRefCount = Math.max(0, manualModeRefCount - 1);\n if (manualModeRefCount === 0) {\n setComponentMapManualMode(false);\n }\n};\n\nexport const removeComponentEntry = (compKey: CompKey): void => {\n disposeComponentEntry(compKey);\n};\n","import type { CompKey, TagFunction, WDom } from 'lithent';\nimport { componentMap, replaceWDom } from 'lithent';\nimport {\n disableComponentMapManualMode,\n enableComponentMapManualMode,\n removeComponentEntry,\n} from './componentMapControl';\n\nconst MAX_RETRY = 3;\n\ntype Registration = { callerCtor?: TagFunction };\n\ntype PendingUpdate = {\n ctor: TagFunction;\n instances: Map<CompKey, Registration>;\n retryCount: number;\n updated: boolean;\n};\n\ntype InstanceRegistry = {\n instances: Set<CompKey>;\n domMap: Map<CompKey, WDom>;\n scheduled: boolean;\n pendingUpdate?: PendingUpdate;\n owners: number;\n registrations: Map<CompKey, Registration>;\n onFailure?: (reason: string) => void;\n onApplied?: () => void;\n};\n\nconst boundaryRegistry = new Map<string, InstanceRegistry>();\n\nconst getRegistry = (moduleId: string): InstanceRegistry => {\n let registry = boundaryRegistry.get(moduleId);\n\n if (!registry) {\n registry = {\n instances: new Set(),\n domMap: new Map(),\n scheduled: false,\n owners: 0,\n registrations: new Map(),\n };\n boundaryRegistry.set(moduleId, registry);\n enableComponentMapManualMode();\n }\n\n return registry;\n};\n\nexport type BoundaryController = {\n register: (compKey: CompKey, callerCtor?: TagFunction) => () => void;\n update: (nextCtor: TagFunction) => boolean;\n dispose: () => void;\n};\n\nexport const registerBoundaryInstance = (\n moduleId: string,\n compKey: CompKey,\n callerCtor?: TagFunction\n) => {\n const registry = getRegistry(moduleId);\n\n const registration = { callerCtor };\n registry.registrations.set(compKey, registration);\n registry.instances.add(compKey);\n\n queueMicrotask(() => {\n const entry = componentMap.get(compKey);\n const currentWDom = entry?.vd?.value ?? null;\n\n if (\n currentWDom &&\n boundaryRegistry.get(moduleId) === registry &&\n registry.registrations.get(compKey) === registration\n ) {\n registry.domMap.set(compKey, currentWDom);\n }\n });\n\n return () => {\n const currentRegistry = boundaryRegistry.get(moduleId);\n if (\n currentRegistry !== registry ||\n currentRegistry.registrations.get(compKey) !== registration\n )\n return;\n\n currentRegistry.registrations.delete(compKey);\n currentRegistry.instances.delete(compKey);\n currentRegistry.domMap.delete(compKey);\n };\n};\n\nexport const disposeBoundary = (moduleId: string) => {\n const registry = boundaryRegistry.get(moduleId);\n\n if (!registry) return;\n boundaryRegistry.delete(moduleId);\n for (const [compKey, registration] of Array.from(registry.registrations)) {\n // A direct call observes its caller; it does not own that caller's lifetime.\n if (!registration.callerCtor) removeComponentEntry(compKey);\n }\n registry.instances.clear();\n registry.registrations.clear();\n registry.domMap.clear();\n disableComponentMapManualMode();\n};\n\nexport const applyBoundaryUpdate = (\n moduleId: string,\n nextCtor: TagFunction\n) => {\n const registry = boundaryRegistry.get(moduleId);\n\n if (!registry?.instances.size) return false;\n\n registry.pendingUpdate = {\n ctor: nextCtor,\n instances: new Map(registry.registrations),\n retryCount: 0,\n updated: false,\n };\n\n if (!registry.scheduled) {\n registry.scheduled = true;\n queueMicrotask(() => flushBoundary(moduleId, registry));\n }\n\n return true;\n};\n\nconst flushBoundary = (moduleId: string, registry: InstanceRegistry) => {\n if (boundaryRegistry.get(moduleId) !== registry) return;\n\n registry.scheduled = false;\n\n const update = registry.pendingUpdate;\n if (!update) return;\n\n registry.pendingUpdate = undefined;\n\n let failed = false;\n\n // Replacement can unregister old instances and register new descendants.\n // Never consume additions made during this flush, or revisit retired nodes.\n const instances = Array.from(update.instances, ([compKey, registration]) => ({\n compKey,\n wDom: componentMap.get(compKey)?.vd?.value || registry.domMap.get(compKey),\n registration,\n }));\n update.instances.clear();\n instances.forEach(({ compKey, wDom: currentWDom, registration }) => {\n if (\n boundaryRegistry.get(moduleId) !== registry ||\n registry.registrations.get(compKey) !== registration ||\n currentWDom?.il\n )\n return;\n\n if (!currentWDom || !currentWDom.el) {\n update.instances.set(compKey, registration);\n return;\n }\n\n const { compProps, compChild } = currentWDom;\n\n if (!compProps || !compChild) {\n update.instances.set(compKey, registration);\n return;\n }\n\n const ctor = registration.callerCtor || update.ctor;\n const previousCtor = currentWDom.ctor;\n // A stable HMR proxy has the same identity across versions. Force only this\n // replacement to remount; the new WDom retains the proxy for later redraws.\n if (!registration.callerCtor && previousCtor === ctor)\n currentWDom.ctor = undefined;\n try {\n // A remount reuses the props/key. Release the old hooks before the core\n // initializes its new hook state under that key.\n if (!registration.callerCtor) removeComponentEntry(compKey);\n replaceWDom(ctor, compProps, compChild, currentWDom);\n update.updated = true;\n } catch (error) {\n failed = true;\n console.warn(`[Lithent HMR] boundary update 실패: ${moduleId}`, error);\n } finally {\n currentWDom.ctor = previousCtor;\n }\n });\n\n if (boundaryRegistry.get(moduleId) !== registry) return;\n if (failed) registry.onFailure?.(`replacement failed: ${moduleId}`);\n else if (update.updated && !update.instances.size) registry.onApplied?.();\n\n // A newer update supersedes retries for the older implementation.\n if (!registry.pendingUpdate && !failed && update.instances.size) {\n update.retryCount += 1;\n\n if (update.retryCount > MAX_RETRY) {\n console.warn(\n `[Lithent HMR] boundary update failed after ${update.retryCount} attempts; aborting: ${moduleId}`\n );\n\n registry.onFailure?.(\n `missing DOM after ${update.retryCount} attempts: ${moduleId}`\n );\n\n return;\n }\n registry.pendingUpdate = update;\n }\n\n if (registry.pendingUpdate && !registry.scheduled) {\n registry.scheduled = true;\n setTimeout(() => flushBoundary(moduleId, registry), 0);\n }\n};\n\nexport const createBoundary = (\n moduleId: string,\n onFailure?: (reason: string) => void,\n onApplied?: () => void\n): BoundaryController => {\n const registry = getRegistry(moduleId);\n registry.owners += 1;\n registry.onFailure = onFailure;\n registry.onApplied = onApplied;\n\n let disposed = false;\n const active = () => !disposed && boundaryRegistry.get(moduleId) === registry;\n return {\n register: (compKey: CompKey, callerCtor?: TagFunction) =>\n active()\n ? registerBoundaryInstance(moduleId, compKey, callerCtor)\n : () => {},\n update: (nextCtor: TagFunction) =>\n active() && applyBoundaryUpdate(moduleId, nextCtor),\n dispose: () => {\n if (!active()) return;\n disposed = true;\n registry.owners -= 1;\n if (!registry.owners) disposeBoundary(moduleId);\n },\n };\n};\n"],"mappings":";;AAGA,IAAIA,IAAqB,GAEZC,UAA2C;CAEtD,AADA,KAAsB,GACtBC,EAA0B,EAAI;AAChC,GAEaC,UAA4C;CAEvD,AADA,IAAqB,KAAK,IAAI,GAAGH,IAAqB,CAAC,GACnDA,MAAuB,KACzBE,EAA0B,EAAK;AAEnC,GAEaE,KAAwB,MAA2B;CAC9D,EAAsBC,CAAO;AAC/B,GCXMC,IAAY,GAsBZC,oBAAmB,IAAI,IAA8B,GAErDC,KAAe,MAAuC;CAC1D,IAAIC,IAAWF,EAAiB,IAAIG,CAAQ;CAc5C,OAZKD,MACH,IAAW;EACT,2BAAW,IAAI,IAAI;EACnB,wBAAQ,IAAI,IAAI;EAChB,WAAW;EACX,QAAQ;EACR,+BAAe,IAAI,IAAI;CACzB,GACAF,EAAiB,IAAIG,GAAUD,CAAQ,GACvCR,EAA6B,IAGxBQ;AACT,GAQaE,KACX,GACA,GACA,MACG;CACH,IAAMF,IAAWD,EAAYE,CAAQ,GAE/BE,IAAe,EAAE,cAAW;CAiBlC,OAhBAH,EAAS,cAAc,IAAIJ,GAASO,CAAY,GAChDH,EAAS,UAAU,IAAIJ,CAAO,GAE9B,qBAAqB;;EACnB,IAAMS,IAAQC,EAAa,IAAIV,CAAO,GAChCW,KAAAF,KAAA,SAAA,IAAcA,EAAO,OAAA,OAAA,KAAA,IAAAD,EAAI,UAAS;EAExC,AACEG,KACAT,EAAiB,IAAIG,CAAQ,MAAMD,KACnCA,EAAS,cAAc,IAAIJ,CAAO,MAAMO,KAExCH,EAAS,OAAO,IAAIJ,GAASW,CAAW;CAE5C,CAAC,SAEY;EACX,IAAMC,IAAkBV,EAAiB,IAAIG,CAAQ;EACrD,AACEO,MAAoBR,KACpBQ,EAAgB,cA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AgBc;EAC3B;EAEA,AAAIf,EAAS,iBAAiB,CAACA,EAAS,cACtC,EAAS,YAAY,IACrB,iBAAiBY,EAAcX,GAAUD,CAAQ,GAAG,CAAC;CAtBiB;AAwB1E,GAEa0B,KACX,GACA,GACA,MACuB;CACvB,IAAM1B,IAAWD,EAAYE,CAAQ;CAGrC,AAFA,EAAS,UAAU,GACnB,EAAS,YAAY0B,GACrB,EAAS,YAAYC;CAErB,IAAIC,IAAW,IACTC,UAAe,CAACD,KAAY/B,EAAiB,IAAIG,CAAQ,MAAMD;CACrE,OAAO;EACL,WAAW,GAAkB,MAC3B8B,EAAO,IACH5B,EAAyBD,GAAUL,GAASmC,CAAU,UAChD,CAAC;EACb,SAAS,MACPD,EAAO,KAAKpB,EAAoBT,GAAUU,CAAQ;EACpD,eAAe;GACb,AAAKmB,EAAO,MACZ,IAAW,IACX,IAAS,QACJ9B,EAAS,UAAQS,EAAgBR,CAAQ;EAChD;CACF;AACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
//# sourceMappingURL=lithentDevHelper.umd.js.map
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("lithent")):typeof define==`function`&&define.amd?define([`exports`,`lithent`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.lithentDevHelper={},e.lithent))})(this,function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var n=0,r=()=>{n+=1,(0,t.setComponentMapManualMode)(!0)},i=()=>{n=Math.max(0,n-1),n===0&&(0,t.setComponentMapManualMode)(!1)},a=e=>{(0,t.disposeComponentEntry)(e)},o=3,s=new Map,c=e=>{let t=s.get(e);return t||(t={instances:new Set,domMap:new Map,scheduled:!1,owners:0,registrations:new Map},s.set(e,t),r()),t},l=(e,n,r)=>{let i=c(e),a={callerCtor:r};return i.registrations.set(n,a),i.instances.add(n),queueMicrotask(()=>{var r;let o=t.componentMap.get(n),c=(o==null||(r=o.vd)==null?void 0:r.value)??null;c&&s.get(e)===i&&i.registrations.get(n)===a&&i.domMap.set(n,c)}),()=>{let t=s.get(e);t===i&&t.registrations.get(n)===a&&(t.registrations.delete(n),t.instances.delete(n),t.domMap.delete(n))}},u=e=>{let t=s.get(e);if(t){s.delete(e);for(let[e,n]of Array.from(t.registrations))n.callerCtor||a(e);t.instances.clear(),t.registrations.clear(),t.domMap.clear(),i()}},d=(e,t)=>{let n=s.get(e);return n!=null&&n.instances.size?(n.pendingUpdate={ctor:t,instances:new Map(n.registrations),retryCount:0,updated:!1},n.scheduled||(n.scheduled=!0,queueMicrotask(()=>f(e,n))),!0):!1},f=(e,n)=>{var r,i;if(s.get(e)!==n)return;n.scheduled=!1;let c=n.pendingUpdate;if(!c)return;n.pendingUpdate=void 0;let l=!1,u=Array.from(c.instances,([e,r])=>{var i;return{compKey:e,wDom:((i=t.componentMap.get(e))==null||(i=i.vd)==null?void 0:i.value)||n.domMap.get(e),registration:r}});if(c.instances.clear(),u.forEach(({compKey:r,wDom:i,registration:o})=>{if(s.get(e)!==n||n.registrations.get(r)!==o||i!=null&&i.il)return;if(!i||!i.el){c.instances.set(r,o);return}let{compProps:u,compChild:d}=i;if(!u||!d){c.instances.set(r,o);return}let f=o.callerCtor||c.ctor,p=i.ctor;!o.callerCtor&&p===f&&(i.ctor=void 0);try{o.callerCtor||a(r),(0,t.replaceWDom)(f,u,d,i),c.updated=!0}catch(t){l=!0,console.warn(`[Lithent HMR] boundary update 실패: ${e}`,t)}finally{i.ctor=p}}),s.get(e)===n){if(l?(r=n.onFailure)==null||r.call(n,`replacement failed: ${e}`):c.updated&&!c.instances.size&&((i=n.onApplied)==null||i.call(n)),!n.pendingUpdate&&!l&&c.instances.size){if(c.retryCount+=1,c.retryCount>o){var d;console.warn(`[Lithent HMR] boundary update failed after ${c.retryCount} attempts; aborting: ${e}`),(d=n.onFailure)==null||d.call(n,`missing DOM after ${c.retryCount} attempts: ${e}`);return}n.pendingUpdate=c}n.pendingUpdate&&!n.scheduled&&(n.scheduled=!0,setTimeout(()=>f(e,n),0))}};e.createBoundary=(e,t,n)=>{let r=c(e);r.owners+=1,r.onFailure=t,r.onApplied=n;let i=!1,a=()=>!i&&s.get(e)===r;return{register:(t,n)=>a()?l(e,t,n):()=>{},update:t=>a()&&d(e,t),dispose:()=>{a()&&(i=!0,--r.owners,r.owners||u(e))}}}});
|
|
2
|
+
//# sourceMappingURL=lithentDevHelper.umd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lithentDevHelper.umd.js","sources":["../src/componentMapControl.ts","../src/createBoundary.ts"],"sourcesContent":["import type { CompKey } from 'lithent';\nimport { setComponentMapManualMode, disposeComponentEntry } from 'lithent';\n\nlet manualModeRefCount = 0;\n\nexport const enableComponentMapManualMode = (): void => {\n manualModeRefCount += 1;\n setComponentMapManualMode(true);\n};\n\nexport const disableComponentMapManualMode = (): void => {\n manualModeRefCount = Math.max(0, manualModeRefCount - 1);\n if (manualModeRefCount === 0) {\n setComponentMapManualMode(false);\n }\n};\n\nexport const removeComponentEntry = (compKey: CompKey): void => {\n disposeComponentEntry(compKey);\n};\n","import type { CompKey, TagFunction, WDom } from 'lithent';\nimport { componentMap, replaceWDom } from 'lithent';\nimport {\n disableComponentMapManualMode,\n enableComponentMapManualMode,\n removeComponentEntry,\n} from './componentMapControl';\n\nconst MAX_RETRY = 3;\n\ntype Registration = { callerCtor?: TagFunction };\n\ntype PendingUpdate = {\n ctor: TagFunction;\n instances: Map<CompKey, Registration>;\n retryCount: number;\n updated: boolean;\n};\n\ntype InstanceRegistry = {\n instances: Set<CompKey>;\n domMap: Map<CompKey, WDom>;\n scheduled: boolean;\n pendingUpdate?: PendingUpdate;\n owners: number;\n registrations: Map<CompKey, Registration>;\n onFailure?: (reason: string) => void;\n onApplied?: () => void;\n};\n\nconst boundaryRegistry = new Map<string, InstanceRegistry>();\n\nconst getRegistry = (moduleId: string): InstanceRegistry => {\n let registry = boundaryRegistry.get(moduleId);\n\n if (!registry) {\n registry = {\n instances: new Set(),\n domMap: new Map(),\n scheduled: false,\n owners: 0,\n registrations: new Map(),\n };\n boundaryRegistry.set(moduleId, registry);\n enableComponentMapManualMode();\n }\n\n return registry;\n};\n\nexport type BoundaryController = {\n register: (compKey: CompKey, callerCtor?: TagFunction) => () => void;\n update: (nextCtor: TagFunction) => boolean;\n dispose: () => void;\n};\n\nexport const registerBoundaryInstance = (\n moduleId: string,\n compKey: CompKey,\n callerCtor?: TagFunction\n) => {\n const registry = getRegistry(moduleId);\n\n const registration = { callerCtor };\n registry.registrations.set(compKey, registration);\n registry.instances.add(compKey);\n\n queueMicrotask(() => {\n const entry = componentMap.get(compKey);\n const currentWDom = entry?.vd?.value ?? null;\n\n if (\n currentWDom &&\n boundaryRegistry.get(moduleId) === registry &&\n registry.registrations.get(compKey) === registration\n ) {\n registry.domMap.set(compKey, currentWDom);\n }\n });\n\n return () => {\n const currentRegistry = boundaryRegistry.get(moduleId);\n if (\n currentRegistry !== registry ||\n currentRegistry.registrations.get(compKey) !== registration\n )\n return;\n\n currentRegistry.registrations.delete(compKey);\n currentRegistry.instances.delete(compKey);\n currentRegistry.domMap.delete(compKey);\n };\n};\n\nexport const disposeBoundary = (moduleId: string) => {\n const registry = boundaryRegistry.get(moduleId);\n\n if (!registry) return;\n boundaryRegistry.delete(moduleId);\n for (const [compKey, registration] of Array.from(registry.registrations)) {\n // A direct call observes its caller; it does not own that caller's lifetime.\n if (!registration.callerCtor) removeComponentEntry(compKey);\n }\n registry.instances.clear();\n registry.registrations.clear();\n registry.domMap.clear();\n disableComponentMapManualMode();\n};\n\nexport const applyBoundaryUpdate = (\n moduleId: string,\n nextCtor: TagFunction\n) => {\n const registry = boundaryRegistry.get(moduleId);\n\n if (!registry?.instances.size) return false;\n\n registry.pendingUpdate = {\n ctor: nextCtor,\n instances: new Map(registry.registrations),\n retryCount: 0,\n updated: false,\n };\n\n if (!registry.scheduled) {\n registry.scheduled = true;\n queueMicrotask(() => flushBoundary(moduleId, registry));\n }\n\n return true;\n};\n\nconst flushBoundary = (moduleId: string, registry: InstanceRegistry) => {\n if (boundaryRegistry.get(moduleId) !== registry) return;\n\n registry.scheduled = false;\n\n const update = registry.pendingUpdate;\n if (!update) return;\n\n registry.pendingUpdate = undefined;\n\n let failed = false;\n\n // Replacement can unregister old instances and register new descendants.\n // Never consume additions made during this flush, or revisit retired nodes.\n const instances = Array.from(update.instances, ([compKey, registration]) => ({\n compKey,\n wDom: componentMap.get(compKey)?.vd?.value || registry.domMap.get(compKey),\n registration,\n }));\n update.instances.clear();\n instances.forEach(({ compKey, wDom: currentWDom, registration }) => {\n if (\n boundaryRegistry.get(moduleId) !== registry ||\n registry.registrations.get(compKey) !== registration ||\n currentWDom?.il\n )\n return;\n\n if (!currentWDom || !currentWDom.el) {\n update.instances.set(compKey, registration);\n return;\n }\n\n const { compProps, compChild } = currentWDom;\n\n if (!compProps || !compChild) {\n update.instances.set(compKey, registration);\n return;\n }\n\n const ctor = registration.callerCtor || update.ctor;\n const previousCtor = currentWDom.ctor;\n // A stable HMR proxy has the same identity across versions. Force only this\n // replacement to remount; the new WDom retains the proxy for later redraws.\n if (!registration.callerCtor && previousCtor === ctor)\n currentWDom.ctor = undefined;\n try {\n // A remount reuses the props/key. Release the old hooks before the core\n // initializes its new hook state under that key.\n if (!registration.callerCtor) removeComponentEntry(compKey);\n replaceWDom(ctor, compProps, compChild, currentWDom);\n update.updated = true;\n } catch (error) {\n failed = true;\n console.warn(`[Lithent HMR] boundary update 실패: ${moduleId}`, error);\n } finally {\n currentWDom.ctor = previousCtor;\n }\n });\n\n if (boundaryRegistry.get(moduleId) !== registry) return;\n if (failed) registry.onFailure?.(`replacement failed: ${moduleId}`);\n else if (update.updated && !update.instances.size) registry.onApplied?.();\n\n // A newer update supersedes retries for the older implementation.\n if (!registry.pendingUpdate && !failed && update.instances.size) {\n update.retryCount += 1;\n\n if (update.retryCount > MAX_RETRY) {\n console.warn(\n `[Lithent HMR] boundary update failed after ${update.retryCount} attempts; aborting: ${moduleId}`\n );\n\n registry.onFailure?.(\n `missing DOM after ${update.retryCount} attempts: ${moduleId}`\n );\n\n return;\n }\n registry.pendingUpdate = update;\n }\n\n if (registry.pendingUpdate && !registry.scheduled) {\n registry.scheduled = true;\n setTimeout(() => flushBoundary(moduleId, registry), 0);\n }\n};\n\nexport const createBoundary = (\n moduleId: string,\n onFailure?: (reason: string) => void,\n onApplied?: () => void\n): BoundaryController => {\n const registry = getRegistry(moduleId);\n registry.owners += 1;\n registry.onFailure = onFailure;\n registry.onApplied = onApplied;\n\n let disposed = false;\n const active = () => !disposed && boundaryRegistry.get(moduleId) === registry;\n return {\n register: (compKey: CompKey, callerCtor?: TagFunction) =>\n active()\n ? registerBoundaryInstance(moduleId, compKey, callerCtor)\n : () => {},\n update: (nextCtor: TagFunction) =>\n active() && applyBoundaryUpdate(moduleId, nextCtor),\n dispose: () => {\n if (!active()) return;\n disposed = true;\n registry.owners -= 1;\n if (!registry.owners) disposeBoundary(moduleId);\n },\n };\n};\n"],"names":["manualModeRefCount","enableComponentMapManualMode","setComponentMapManualMode","disableComponentMapManualMode","removeComponentEntry","compKey","disposeComponentEntry","MAX_RETRY","boundaryRegistry","getRegistry","moduleId","registry","registerBoundaryInstance","callerCtor","registration","entry","componentMap","currentWDom","_a","currentRegistry","disposeBoundary","applyBoundaryUpdate","nextCtor","flushBoundary","update","failed","instances","compProps","compChild","ctor","previousCtor","replaceWDom","error","_c","createBoundary","onFailure","onApplied","disposed","active"],"mappings":"iRAGA,IAAIA,EAAqB,EAElB,MAAMC,EAA+B,IAAY,CAChCD,GAAA,EACtBE,EAAA,0BAA0B,EAAI,CAChC,EAEaC,EAAgC,IAAY,CACvDH,EAAqB,KAAK,IAAI,EAAGA,EAAqB,CAAC,EACnDA,IAAuB,GACzBE,EAAA,0BAA0B,EAAK,CAEnC,EAEaE,EAAwBC,GAA2B,CAC9DC,EAAA,sBAAsBD,CAAO,CAC/B,ECXME,EAAY,EAsBZC,MAAuB,IAE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Y,CAAQ,EACpD,QAAS,IAAM,CACRgB,MACMD,EAAA,GACX1B,EAAS,QAAU,EACdA,EAAS,QAAQS,EAAgBV,CAAQ,EAChD,CAAA,CAEJ"}
|
|
1
|
+
{"version":3,"file":"lithentDevHelper.umd.js","names":["componentMap","factory","global","exports","manualModeRefCount","enableComponentMapManualMode","lithent","disableComponentMapManualMode","removeComponentEntry","compKey","MAX_RETRY","boundaryRegistry","getRegistry","registry","moduleId","registerBoundaryInstance","registration","_entry$vd","entry","currentWDom","currentRegistry","disposeBoundary","applyBoundaryUpdate","nextCtor","flushBoundary","_registry$onFailure","_registry$onApplied","update","failed","instances","_componentMap$get","compProps","compChild","ctor","previousCtor","error","_registry$onFailure2","onFailure","onApplied","disposed","active","callerCtor"],"sources":["../src/componentMapControl.ts","../src/createBoundary.ts"],"sourcesContent":["import type { CompKey } from 'lithent';\nimport { setComponentMapManualMode, disposeComponentEntry } from 'lithent';\n\nlet manualModeRefCount = 0;\n\nexport const enableComponentMapManualMode = (): void => {\n manualModeRefCount += 1;\n setComponentMapManualMode(true);\n};\n\nexport const disableComponentMapManualMode = (): void => {\n manualModeRefCount = Math.max(0, manualModeRefCount - 1);\n if (manualModeRefCount === 0) {\n setComponentMapManualMode(false);\n }\n};\n\nexport const removeComponentEntry = (compKey: CompKey): void => {\n disposeComponentEntry(compKey);\n};\n","import type { CompKey, TagFunction, WDom } from 'lithent';\nimport { componentMap, replaceWDom } from 'lithent';\nimport {\n disableComponentMapManualMode,\n enableComponentMapManualMode,\n removeComponentEntry,\n} from './componentMapControl';\n\nconst MAX_RETRY = 3;\n\ntype Registration = { callerCtor?: TagFunction };\n\ntype PendingUpdate = {\n ctor: TagFunction;\n instances: Map<CompKey, Registration>;\n retryCount: number;\n updated: boolean;\n};\n\ntype InstanceRegistry = {\n instances: Set<CompKey>;\n domMap: Map<CompKey, WDom>;\n scheduled: boolean;\n pendingUpdate?: PendingUpdate;\n owners: number;\n registrations: Map<CompKey, Registration>;\n onFailure?: (reason: string) => void;\n onApplied?: () => void;\n};\n\nconst boundaryRegistry = new Map<string, InstanceRegistry>();\n\nconst getRegistry = (moduleId: string): InstanceRegistry => {\n let registry = boundaryRegistry.get(moduleId);\n\n if (!registry) {\n registry = {\n instances: new Set(),\n domMap: new Map(),\n scheduled: false,\n owners: 0,\n registrations: new Map(),\n };\n boundaryRegistry.set(moduleId, registry);\n enableComponentMapManualMode();\n }\n\n return registry;\n};\n\nexport type BoundaryController = {\n register: (compKey: CompKey, callerCtor?: TagFunction) => () => void;\n update: (nextCtor: TagFunction) => boolean;\n dispose: () => void;\n};\n\nexport const registerBoundaryInstance = (\n moduleId: string,\n compKey: CompKey,\n callerCtor?: TagFunction\n) => {\n const registry = getRegistry(moduleId);\n\n const registration = { callerCtor };\n registry.registrations.set(compKey, registration);\n registry.instances.add(compKey);\n\n queueMicrotask(() => {\n const entry = componentMap.get(compKey);\n const currentWDom = entry?.vd?.value ?? null;\n\n if (\n currentWDom &&\n boundaryRegistry.get(moduleId) === registry &&\n registry.registrations.get(compKey) === registration\n ) {\n registry.domMap.set(compKey, currentWDom);\n }\n });\n\n return () => {\n const currentRegistry = boundaryRegistry.get(moduleId);\n if (\n currentRegistry !== registry ||\n currentRegistry.registrations.get(compKey) !== registration\n )\n return;\n\n currentRegistry.registrations.delete(compKey);\n currentRegistry.instances.delete(compKey);\n currentRegistry.domMap.delete(compKey);\n };\n};\n\nexport const disposeBoundary = (moduleId: string) => {\n const registry = boundaryRegistry.get(moduleId);\n\n if (!registry) return;\n boundaryRegistry.delete(moduleId);\n for (const [compKey, registration] of Array.from(registry.registrations)) {\n // A direct call observes its caller; it does not own that caller's lifetime.\n if (!registration.callerCtor) removeComponentEntry(compKey);\n }\n registry.instances.clear();\n registry.registrations.clear();\n registry.domMap.clear();\n disableComponentMapManualMode();\n};\n\nexport const applyBoundaryUpdate = (\n moduleId: string,\n nextCtor: TagFunction\n) => {\n const registry = boundaryRegistry.get(moduleId);\n\n if (!registry?.instances.size) return false;\n\n registry.pendingUpdate = {\n ctor: nextCtor,\n instances: new Map(registry.registrations),\n retryCount: 0,\n updated: false,\n };\n\n if (!registry.scheduled) {\n registry.scheduled = true;\n queueMicrotask(() => flushBoundary(moduleId, registry));\n }\n\n return true;\n};\n\nconst flushBoundary = (moduleId: string, registry: InstanceRegistry) => {\n if (boundaryRegistry.get(moduleId) !== registry) return;\n\n registry.scheduled = false;\n\n const update = registry.pendingUpdate;\n if (!update) return;\n\n registry.pendingUpdate = undefined;\n\n let failed = false;\n\n // Replacement can unregister old instances and register new descendants.\n // Never consume additions made during this flush, or revisit retired nodes.\n const instances = Array.from(update.instances, ([compKey, registration]) => ({\n compKey,\n wDom: componentMap.get(compKey)?.vd?.value || registry.domMap.get(compKey),\n registration,\n }));\n update.instances.clear();\n instances.forEach(({ compKey, wDom: currentWDom, registration }) => {\n if (\n boundaryRegistry.get(moduleId) !== registry ||\n registry.registrations.get(compKey) !== registration ||\n currentWDom?.il\n )\n return;\n\n if (!currentWDom || !currentWDom.el) {\n update.instances.set(compKey, registration);\n return;\n }\n\n const { compProps, compChild } = currentWDom;\n\n if (!compProps || !compChild) {\n update.instances.set(compKey, registration);\n return;\n }\n\n const ctor = registration.callerCtor || update.ctor;\n const previousCtor = currentWDom.ctor;\n // A stable HMR proxy has the same identity across versions. Force only this\n // replacement to remount; the new WDom retains the proxy for later redraws.\n if (!registration.callerCtor && previousCtor === ctor)\n currentWDom.ctor = undefined;\n try {\n // A remount reuses the props/key. Release the old hooks before the core\n // initializes its new hook state under that key.\n if (!registration.callerCtor) removeComponentEntry(compKey);\n replaceWDom(ctor, compProps, compChild, currentWDom);\n update.updated = true;\n } catch (error) {\n failed = true;\n console.warn(`[Lithent HMR] boundary update 실패: ${moduleId}`, error);\n } finally {\n currentWDom.ctor = previousCtor;\n }\n });\n\n if (boundaryRegistry.get(moduleId) !== registry) return;\n if (failed) registry.onFailure?.(`replacement failed: ${moduleId}`);\n else if (update.updated && !update.instances.size) registry.onApplied?.();\n\n // A newer update supersedes retries for the older implementation.\n if (!registry.pendingUpdate && !failed && update.instances.size) {\n update.retryCount += 1;\n\n if (update.retryCount > MAX_RETRY) {\n console.warn(\n `[Lithent HMR] boundary update failed after ${update.retryCount} attempts; aborting: ${moduleId}`\n );\n\n registry.onFailure?.(\n `missing DOM after ${update.retryCount} attempts: ${moduleId}`\n );\n\n return;\n }\n registry.pendingUpdate = update;\n }\n\n if (registry.pendingUpdate && !registry.scheduled) {\n registry.scheduled = true;\n setTimeout(() => flushBoundary(moduleId, registry), 0);\n }\n};\n\nexport const createBoundary = (\n moduleId: string,\n onFailure?: (reason: string) => void,\n onApplied?: () => void\n): BoundaryController => {\n const registry = getRegistry(moduleId);\n registry.owners += 1;\n registry.onFailure = onFailure;\n registry.onApplied = onApplied;\n\n let disposed = false;\n const active = () => !disposed && boundaryRegistry.get(moduleId) === registry;\n return {\n register: (compKey: CompKey, callerCtor?: TagFunction) =>\n active()\n ? registerBoundaryInstance(moduleId, compKey, callerCtor)\n : () => {},\n update: (nextCtor: TagFunction) =>\n active() && applyBoundaryUpdate(moduleId, nextCtor),\n dispose: () => {\n if (!active()) return;\n disposed = true;\n registry.owners -= 1;\n if (!registry.owners) disposeBoundary(moduleId);\n },\n };\n};\n"],"mappings":"C,gUAGA,IAAII,EAAqB,EAEZC,MAA2C,CACtD,GAAsB,GACtB,EAAAC,EAAA,0BAAA,CAA0B,EAAI,CAChC,EAEaC,MAA4C,CACvD,EAAqB,KAAK,IAAI,EAAGH,EAAqB,CAAC,EACnDA,IAAuB,IACzB,EAAAE,EAAA,0BAAA,CAA0B,EAAK,CAEnC,EAEaE,EAAwB,GAA2B,EAC9D,EAAAF,EAAA,sBAAA,CAAsBG,CAAO,CAC/B,ECXMC,EAAY,EAsBZC,EAAmB,IAAI,IAEvBC,EAAe,GAAuC,CAC1D,IAAIC,EAAWF,EAAiB,IAAIG,CAAQ,EAc5C,OAZKD,IACH,EAAW,CACT,UAAW,IAAI,IACf,OAAQ,IAAI,IACZ,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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type HotRuntime = {
|
|
2
|
+
data?: Record<string, unknown>;
|
|
3
|
+
accept: (cb: (mod: Record<string, unknown>) => void) => void;
|
|
4
|
+
dispose: (cb: (data: Record<string, unknown>) => void) => void;
|
|
5
|
+
invalidate?: () => void;
|
|
6
|
+
__lithentData?: Record<string, unknown>;
|
|
7
|
+
};
|
|
8
|
+
declare global {
|
|
9
|
+
interface ImportMeta {
|
|
10
|
+
hot?: HotRuntime;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
declare const App: () => any;
|
|
14
|
+
export default App;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type HotRuntime = {
|
|
2
|
+
data?: Record<string, unknown>;
|
|
3
|
+
accept: (cb: (mod: Record<string, unknown>) => void) => void;
|
|
4
|
+
dispose: (cb: (data: Record<string, unknown>) => void) => void;
|
|
5
|
+
invalidate?: () => void;
|
|
6
|
+
__lithentData?: Record<string, unknown>;
|
|
7
|
+
};
|
|
8
|
+
declare global {
|
|
9
|
+
interface ImportMeta {
|
|
10
|
+
hot?: HotRuntime;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
declare const App: () => any;
|
|
14
|
+
export default App;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Props } from './types/index.cjs';
|
|
2
2
|
export { h, Fragment, portal, mount, lmount, replaceWDom } from './wDom.cjs';
|
|
3
3
|
export { isPropType } from './utils/index.cjs';
|
|
4
4
|
export { componentUpdate } from './utils/redraw.cjs';
|
|
@@ -12,8 +12,7 @@ export { useRenew } from './hook/useRenew.cjs';
|
|
|
12
12
|
export type { WDom, TagFunction, TagFunctionResolver, FragmentFunction, Component, LComponent, ComponentSubKey, ComponentMap, ComponentInfo, CompKey, Props, Renew, MiddleStateWDomChildren, MiddleStateWDom, NodePointer, Param, } from './types/index.cjs';
|
|
13
13
|
declare global {
|
|
14
14
|
namespace JSX {
|
|
15
|
-
interface IntrinsicElements {
|
|
16
|
-
[name: string]: Props;
|
|
15
|
+
interface IntrinsicElements extends Record<string | number, Props> {
|
|
17
16
|
}
|
|
18
17
|
}
|
|
19
18
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Props } from './types/index.js';
|
|
2
2
|
export { h, Fragment, portal, mount, lmount, replaceWDom } from './wDom.js';
|
|
3
3
|
export { isPropType } from './utils/index.js';
|
|
4
4
|
export { componentUpdate } from './utils/redraw.js';
|
|
@@ -12,8 +12,7 @@ export { useRenew } from './hook/useRenew.js';
|
|
|
12
12
|
export type { WDom, TagFunction, TagFunctionResolver, FragmentFunction, Component, LComponent, ComponentSubKey, ComponentMap, ComponentInfo, CompKey, Props, Renew, MiddleStateWDomChildren, MiddleStateWDom, NodePointer, Param, } from './types/index.js';
|
|
13
13
|
declare global {
|
|
14
14
|
namespace JSX {
|
|
15
|
-
interface IntrinsicElements {
|
|
16
|
-
[name: string]: Props;
|
|
15
|
+
interface IntrinsicElements extends Record<string | number, Props> {
|
|
17
16
|
}
|
|
18
17
|
}
|
|
19
18
|
}
|