adnbn 0.11.0 → 0.13.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.
- package/README.md +3 -0
- package/dist/cli/builders/manifest/ManifestBase.js +1 -1
- package/dist/cli/bundler/index.d.ts +1 -0
- package/dist/cli/bundler/index.js +1 -0
- package/dist/cli/bundler/index.js.map +1 -1
- package/dist/cli/bundler/layers.d.ts +5 -0
- package/dist/cli/bundler/layers.js +11 -0
- package/dist/cli/bundler/layers.js.map +1 -0
- package/dist/cli/bundler/plugins/build-assets-map/BuildAssetsMapPlugin.js +44 -15
- package/dist/cli/bundler/plugins/build-assets-map/BuildAssetsMapPlugin.js.map +1 -1
- package/dist/cli/bundler/plugins/build-assets-map/index.d.ts +1 -2
- package/dist/cli/bundler/plugins/build-assets-map/index.js +0 -3
- package/dist/cli/bundler/plugins/build-assets-map/index.js.map +1 -1
- package/dist/cli/bundler/plugins/build-assets-map/normalize.d.ts +3 -0
- package/dist/cli/bundler/plugins/build-assets-map/normalize.js +24 -0
- package/dist/cli/bundler/plugins/build-assets-map/normalize.js.map +1 -0
- package/dist/cli/bundler/plugins/build-assets-map/templates/runtime.template.d.ts +2 -0
- package/dist/cli/bundler/plugins/build-assets-map/templates.d.ts +9 -0
- package/dist/cli/bundler/plugins/build-assets-map/templates.js +32 -0
- package/dist/cli/bundler/plugins/build-assets-map/usage.d.ts +3 -6
- package/dist/cli/bundler/plugins/build-assets-map/usage.js +6 -3
- package/dist/cli/bundler/plugins/build-assets-map/usage.js.map +1 -1
- package/dist/cli/bundler/plugins/entrypoint/EntrypointPlugin.js +11 -0
- package/dist/cli/bundler/plugins/entrypoint/EntrypointPlugin.js.map +1 -1
- package/dist/cli/bundler/plugins/index.d.ts +2 -2
- package/dist/cli/bundler/plugins/index.js +2 -6
- package/dist/cli/bundler/plugins/index.js.map +1 -1
- package/dist/cli/bundler/plugins/isolated-styles/IsolatedStylesPlugin.d.ts +1 -1
- package/dist/cli/bundler/plugins/isolated-styles/IsolatedStylesPlugin.js +38 -13
- package/dist/cli/bundler/plugins/isolated-styles/IsolatedStylesPlugin.js.map +1 -1
- package/dist/cli/bundler/plugins/isolated-styles/chunks.d.ts +7 -0
- package/dist/cli/bundler/plugins/isolated-styles/chunks.js +33 -0
- package/dist/cli/bundler/plugins/isolated-styles/chunks.js.map +1 -0
- package/dist/cli/bundler/plugins/isolated-styles/split-chunks.d.ts +4 -0
- package/dist/cli/bundler/plugins/isolated-styles/split-chunks.js +51 -0
- package/dist/cli/bundler/plugins/isolated-styles/split-chunks.js.map +1 -0
- package/dist/cli/bundler/plugins/isolated-styles/templates.js +36 -6
- package/dist/cli/bundler/plugins/manifest/ManifestPlugin.js +1 -2
- package/dist/cli/bundler/plugins/manifest/ManifestPlugin.js.map +1 -1
- package/dist/cli/bundler/plugins/types.d.ts +4 -0
- package/dist/cli/bundler/plugins/utils/compilation-assets.d.ts +4 -0
- package/dist/cli/bundler/plugins/utils/compilation-assets.js +12 -0
- package/dist/cli/bundler/plugins/utils/compilation-assets.js.map +1 -0
- package/dist/cli/bundler/plugins/utils/index.d.ts +2 -0
- package/dist/cli/bundler/plugins/utils/index.js +5 -0
- package/dist/cli/bundler/plugins/utils/index.js.map +1 -1
- package/dist/cli/bundler/plugins/utils/runtime-module.d.ts +3 -0
- package/dist/cli/bundler/plugins/utils/runtime-module.js +11 -0
- package/dist/cli/bundler/plugins/utils/runtime-module.js.map +1 -0
- package/dist/cli/bundler/utils/app-filename.d.ts +2 -0
- package/dist/cli/bundler/utils/app-filename.js +19 -0
- package/dist/cli/bundler/utils/app-filename.js.map +1 -0
- package/dist/cli/bundler/utils/assets.d.ts +3 -0
- package/dist/cli/bundler/utils/{output.js → assets.js} +22 -33
- package/dist/cli/bundler/utils/assets.js.map +1 -0
- package/dist/cli/bundler/utils/index.d.ts +2 -3
- package/dist/cli/bundler/utils/index.js +2 -3
- package/dist/cli/bundler/utils/index.js.map +1 -1
- package/dist/cli/entrypoint/file/injectors/core.js +1 -1
- package/dist/cli/entrypoint/finder/ContentFinder.d.ts +1 -1
- package/dist/cli/entrypoint/parser/ContentParser.d.ts +2 -2
- package/dist/cli/entrypoint/parser/ContentParser.js +6 -22
- package/dist/cli/entrypoint/parser/ContentParser.js.map +1 -1
- package/dist/cli/entrypoint/parser/RelayParser.js +1 -1
- package/dist/cli/entrypoint/parser/utils/content/default-render.d.ts +3 -0
- package/dist/cli/entrypoint/parser/utils/content/default-render.js +21 -0
- package/dist/cli/entrypoint/parser/utils/content/default-render.js.map +1 -0
- package/dist/cli/plugins/content/Content.d.ts +1 -1
- package/dist/cli/plugins/content/ContentDriver.d.ts +1 -1
- package/dist/cli/plugins/content/ContentManager.d.ts +1 -1
- package/dist/cli/plugins/content/ContentManager.js +1 -1
- package/dist/cli/plugins/content/ContentName.d.ts +1 -1
- package/dist/cli/plugins/content/ContentName.js +1 -1
- package/dist/cli/plugins/content/Relay.d.ts +1 -1
- package/dist/cli/plugins/content/RelayDriver.d.ts +1 -1
- package/dist/cli/plugins/content/RelayDriver.js +1 -1
- package/dist/cli/plugins/content/bundler.d.ts +1 -4
- package/dist/cli/plugins/content/bundler.js +5 -21
- package/dist/cli/plugins/content/bundler.js.map +1 -1
- package/dist/cli/plugins/content/index.js +4 -5
- package/dist/cli/plugins/content/index.js.map +1 -1
- package/dist/cli/plugins/content/types.d.ts +1 -1
- package/dist/cli/plugins/content/utils.d.ts +1 -1
- package/dist/cli/plugins/content/utils.js +1 -1
- package/dist/cli/plugins/index.d.ts +1 -1
- package/dist/cli/plugins/index.js +1 -1
- package/dist/cli/plugins/locale/Locale.js +5 -2
- package/dist/cli/plugins/locale/Locale.js.map +1 -1
- package/dist/cli/plugins/locale/index.js +2 -2
- package/dist/cli/plugins/locale/index.js.map +1 -1
- package/dist/cli/plugins/output/index.d.ts +2 -0
- package/dist/cli/plugins/{output.js → output/index.js} +11 -13
- package/dist/cli/plugins/output/index.js.map +1 -0
- package/dist/cli/plugins/output/runtime.d.ts +26 -0
- package/dist/cli/plugins/output/runtime.js +19 -0
- package/dist/cli/plugins/output/runtime.js.map +1 -0
- package/dist/cli/plugins/style/index.d.ts +1 -2
- package/dist/cli/plugins/style/index.js +19 -30
- package/dist/cli/plugins/style/index.js.map +1 -1
- package/dist/cli/resolvers/config.js +1 -2
- package/dist/cli/resolvers/config.js.map +1 -1
- package/dist/cli/virtual/index.js +4 -4
- package/dist/cli/virtual/virtual.d.ts +8 -3
- package/dist/content/index.d.ts +3 -0
- package/dist/content/index.js +8 -0
- package/dist/content/index.js.map +1 -0
- package/dist/entry/content/adapters/react/Builder.d.ts +7 -6
- package/dist/entry/content/adapters/react/Builder.js +12 -19
- package/dist/entry/content/adapters/react/Builder.js.map +1 -1
- package/dist/entry/content/adapters/react/Node.d.ts +6 -14
- package/dist/entry/content/adapters/react/Node.js +11 -35
- package/dist/entry/content/adapters/react/Node.js.map +1 -1
- package/dist/entry/content/adapters/react/definition.d.ts +2 -0
- package/dist/entry/content/adapters/react/definition.js +12 -0
- package/dist/entry/content/adapters/react/definition.js.map +1 -0
- package/dist/entry/content/adapters/react/index.d.ts +2 -1
- package/dist/entry/content/adapters/react/index.js +3 -1
- package/dist/entry/content/adapters/react/index.js.map +1 -1
- package/dist/entry/content/adapters/vanilla/Builder.d.ts +7 -5
- package/dist/entry/content/adapters/vanilla/Builder.js +17 -14
- package/dist/entry/content/adapters/vanilla/Builder.js.map +1 -1
- package/dist/entry/content/adapters/vanilla/Node.d.ts +5 -11
- package/dist/entry/content/adapters/vanilla/Node.js +11 -37
- package/dist/entry/content/adapters/vanilla/Node.js.map +1 -1
- package/dist/entry/content/adapters/vanilla/definition.d.ts +2 -0
- package/dist/entry/content/adapters/vanilla/definition.js +9 -0
- package/dist/entry/content/adapters/vanilla/definition.js.map +1 -0
- package/dist/entry/content/adapters/vanilla/index.d.ts +2 -1
- package/dist/entry/content/adapters/vanilla/index.js +3 -1
- package/dist/entry/content/adapters/vanilla/index.js.map +1 -1
- package/dist/entry/content/adapters/vanilla/utils.d.ts +1 -0
- package/dist/entry/content/adapters/vanilla/utils.js +7 -0
- package/dist/entry/content/adapters/vanilla/utils.js.map +1 -0
- package/dist/entry/content/index.d.ts +5 -1
- package/dist/entry/content/index.js +8 -1
- package/dist/entry/content/index.js.map +1 -1
- package/dist/entry/content/lifecycle/Builder.d.ts +32 -0
- package/dist/entry/content/lifecycle/Builder.js +254 -0
- package/dist/entry/content/lifecycle/Builder.js.map +1 -0
- package/dist/entry/content/lifecycle/IsolationSetup.d.ts +16 -0
- package/dist/entry/content/lifecycle/IsolationSetup.js +37 -0
- package/dist/entry/content/lifecycle/IsolationSetup.js.map +1 -0
- package/dist/entry/content/lifecycle/MountBuilder.d.ts +11 -0
- package/dist/entry/content/lifecycle/MountBuilder.js +73 -0
- package/dist/entry/content/lifecycle/MountBuilder.js.map +1 -0
- package/dist/entry/content/lifecycle/context/ContainerRegistry.d.ts +7 -0
- package/dist/entry/content/lifecycle/context/ContainerRegistry.js +45 -0
- package/dist/entry/content/lifecycle/context/ContainerRegistry.js.map +1 -0
- package/dist/entry/content/lifecycle/context/Context.d.ts +17 -0
- package/dist/entry/content/lifecycle/context/Context.js +88 -0
- package/dist/entry/content/lifecycle/context/Context.js.map +1 -0
- package/dist/entry/content/{core → lifecycle}/context/EventEmitter.d.ts +2 -2
- package/dist/entry/content/{core → lifecycle}/context/EventEmitter.js +3 -3
- package/dist/entry/content/lifecycle/context/EventEmitter.js.map +1 -0
- package/dist/entry/content/lifecycle/context/ManagedContext.d.ts +8 -0
- package/dist/entry/content/lifecycle/context/ManagedContext.js +19 -0
- package/dist/entry/content/lifecycle/context/ManagedContext.js.map +1 -0
- package/dist/entry/content/{core → lifecycle}/context/index.d.ts +1 -0
- package/dist/entry/content/lifecycle/context/index.js +11 -0
- package/dist/entry/content/lifecycle/context/index.js.map +1 -0
- package/dist/entry/content/{core → lifecycle}/markers/AbstractMarker.d.ts +2 -2
- package/dist/entry/content/{core → lifecycle}/markers/AbstractMarker.js +3 -3
- package/dist/entry/content/lifecycle/markers/AbstractMarker.js.map +1 -0
- package/dist/entry/content/{core → lifecycle}/markers/AttributeMarker.d.ts +2 -2
- package/dist/entry/content/{core → lifecycle}/markers/AttributeMarker.js +5 -3
- package/dist/entry/content/lifecycle/markers/AttributeMarker.js.map +1 -0
- package/dist/entry/content/{core → lifecycle}/markers/WeakMarker.d.ts +2 -2
- package/dist/entry/content/{core → lifecycle}/markers/WeakMarker.js +2 -2
- package/dist/entry/content/lifecycle/markers/WeakMarker.js.map +1 -0
- package/dist/entry/content/lifecycle/markers/index.js.map +1 -0
- package/dist/entry/content/lifecycle/nodes/EventNode.d.ts +15 -0
- package/dist/entry/content/lifecycle/nodes/EventNode.js +49 -0
- package/dist/entry/content/lifecycle/nodes/EventNode.js.map +1 -0
- package/dist/entry/content/lifecycle/nodes/FrameNode.d.ts +30 -0
- package/dist/entry/content/lifecycle/nodes/FrameNode.js +190 -0
- package/dist/entry/content/lifecycle/nodes/FrameNode.js.map +1 -0
- package/dist/entry/content/{core → lifecycle}/nodes/MarkerNode.d.ts +3 -2
- package/dist/entry/content/{core → lifecycle}/nodes/MarkerNode.js +5 -2
- package/dist/entry/content/lifecycle/nodes/MarkerNode.js.map +1 -0
- package/dist/entry/content/lifecycle/nodes/MountNode.d.ts +17 -0
- package/dist/entry/content/lifecycle/nodes/MountNode.js +80 -0
- package/dist/entry/content/lifecycle/nodes/MountNode.js.map +1 -0
- package/dist/entry/content/{core → lifecycle}/nodes/Node.d.ts +2 -2
- package/dist/entry/content/{core → lifecycle}/nodes/Node.js +2 -2
- package/dist/entry/content/lifecycle/nodes/Node.js.map +1 -0
- package/dist/entry/content/lifecycle/nodes/RenderNode.d.ts +28 -0
- package/dist/entry/content/lifecycle/nodes/RenderNode.js +140 -0
- package/dist/entry/content/lifecycle/nodes/RenderNode.js.map +1 -0
- package/dist/entry/content/lifecycle/nodes/ShadowNode.d.ts +22 -0
- package/dist/entry/content/lifecycle/nodes/ShadowNode.js +124 -0
- package/dist/entry/content/lifecycle/nodes/ShadowNode.js.map +1 -0
- package/dist/entry/content/{core → lifecycle}/nodes/index.d.ts +1 -0
- package/dist/entry/content/lifecycle/nodes/index.js +17 -0
- package/dist/entry/content/lifecycle/nodes/index.js.map +1 -0
- package/dist/entry/content/{core → lifecycle}/nodes/isolated-styles.d.ts +1 -1
- package/dist/entry/content/{core → lifecycle}/nodes/isolated-styles.js +2 -2
- package/dist/entry/content/lifecycle/nodes/isolated-styles.js.map +1 -0
- package/dist/entry/content/lifecycle/types.d.ts +28 -0
- package/dist/entry/content/resolvers/anchor.d.ts +2 -0
- package/dist/entry/content/{core/resolvers → resolvers}/anchor.js +2 -2
- package/dist/entry/content/resolvers/anchor.js.map +1 -0
- package/dist/entry/content/resolvers/container.d.ts +2 -0
- package/dist/entry/content/{core/resolvers → resolvers}/container.js +2 -2
- package/dist/entry/content/resolvers/container.js.map +1 -0
- package/dist/entry/content/resolvers/definition.d.ts +5 -0
- package/dist/entry/content/resolvers/definition.js +24 -0
- package/dist/entry/content/resolvers/definition.js.map +1 -0
- package/dist/entry/content/{core/resolvers → resolvers}/index.d.ts +1 -1
- package/dist/entry/content/{core/resolvers → resolvers}/index.js +1 -1
- package/dist/entry/content/resolvers/index.js.map +1 -0
- package/dist/entry/content/resolvers/mount.d.ts +2 -0
- package/dist/entry/content/{core/resolvers → resolvers}/mount.js +3 -3
- package/dist/entry/content/resolvers/mount.js.map +1 -0
- package/dist/entry/content/resolvers/target.d.ts +3 -0
- package/dist/entry/content/resolvers/target.js +34 -0
- package/dist/entry/content/resolvers/target.js.map +1 -0
- package/dist/entry/content/resolvers/watch.d.ts +6 -0
- package/dist/entry/content/resolvers/watch.js +81 -0
- package/dist/entry/content/resolvers/watch.js.map +1 -0
- package/dist/entry/relay/Builder.d.ts +8 -8
- package/dist/entry/relay/Builder.js +28 -19
- package/dist/entry/relay/Builder.js.map +1 -1
- package/dist/entry/relay/TransportBuilder.d.ts +3 -2
- package/dist/entry/relay/TransportBuilder.js +3 -3
- package/dist/entry/relay/TransportBuilder.js.map +1 -1
- package/dist/entry/relay/index.d.ts +5 -2
- package/dist/entry/relay/index.js +8 -2
- package/dist/entry/relay/index.js.map +1 -1
- package/dist/entry/relay/resolvers/definition.d.ts +4 -0
- package/dist/entry/relay/resolvers/definition.js +16 -0
- package/dist/entry/relay/resolvers/definition.js.map +1 -0
- package/dist/main/content.d.ts +4 -6
- package/dist/main/content.js +3 -16
- package/dist/main/content.js.map +1 -1
- package/dist/main/entrypoint.js +1 -1
- package/dist/main/entrypoint.js.map +1 -1
- package/dist/main/relay.d.ts +2 -1
- package/dist/main/relay.js.map +1 -1
- package/dist/relay/RelayPermission.js +1 -1
- package/dist/shared/content/isolation.d.ts +1 -1
- package/dist/shared/content/isolation.js +13 -20
- package/dist/shared/content/isolation.js.map +1 -1
- package/dist/shared/locale/index.d.ts +1 -1
- package/dist/shared/locale/index.js +3 -1
- package/dist/shared/locale/index.js.map +1 -1
- package/dist/shared/locale/messages.d.ts +4 -0
- package/dist/shared/locale/messages.js +12 -0
- package/dist/shared/locale/messages.js.map +1 -1
- package/dist/types/content/adapters/index.d.ts +2 -0
- package/dist/types/content/adapters/index.js +1 -0
- package/dist/types/content/adapters/index.js.map +1 -0
- package/dist/types/content/adapters/react.d.ts +4 -0
- package/dist/types/content/adapters/react.js +1 -0
- package/dist/types/content/adapters/react.js.map +1 -0
- package/dist/types/content/adapters/vanilla.d.ts +1 -0
- package/dist/types/content/adapters/vanilla.js +1 -0
- package/dist/types/content/adapters/vanilla.js.map +1 -0
- package/dist/types/content/boundary.d.ts +17 -0
- package/dist/types/content/boundary.js +1 -0
- package/dist/types/content/boundary.js.map +1 -0
- package/dist/types/{content.d.ts → content/common.d.ts} +32 -53
- package/dist/types/{content.js → content/common.js} +1 -1
- package/dist/types/content/common.js.map +1 -0
- package/dist/types/content/definition.d.ts +66 -0
- package/dist/types/content/definition.js +1 -0
- package/dist/types/content/definition.js.map +1 -0
- package/dist/types/content/index.d.ts +7 -0
- package/dist/types/content/index.js +2 -0
- package/dist/types/content/index.js.map +1 -0
- package/dist/types/content/prepare.d.ts +9 -0
- package/dist/types/content/prepare.js +1 -0
- package/dist/types/content/prepare.js.map +1 -0
- package/dist/types/content/render.d.ts +6 -0
- package/dist/types/content/render.js +1 -0
- package/dist/types/content/render.js.map +1 -0
- package/dist/types/content/target.d.ts +13 -0
- package/dist/types/content/target.js +1 -0
- package/dist/types/content/target.js.map +1 -0
- package/dist/types/locale.d.ts +3 -0
- package/dist/types/locale.js.map +1 -1
- package/dist/types/manifest.d.ts +1 -1
- package/dist/types/relay.d.ts +3 -4
- package/dist/types/relay.js.map +1 -1
- package/dist/virtual/modules.d.ts +4 -3
- package/dist/virtual/{entrypoint.d.ts → runtime.d.ts} +3 -0
- package/dist/virtual/runtime.js +9 -0
- package/dist/virtual/runtime.js.map +1 -0
- package/package.json +32 -25
- package/scripts/merge-coverage.mjs +12 -0
- package/scripts/pre-commit.mjs +22 -0
- package/scripts/test-inventory.mjs +38 -0
- package/scripts/test-run.mjs +25 -0
- package/types/client.d.ts +3 -3
- package/dist/cli/bundler/plugins/build-assets-map/entrypoint-module.d.ts +0 -13
- package/dist/cli/bundler/plugins/build-assets-map/entrypoint-module.js +0 -16
- package/dist/cli/bundler/plugins/build-assets-map/entrypoint-module.js.map +0 -1
- package/dist/cli/bundler/utils/layers.d.ts +0 -4
- package/dist/cli/bundler/utils/layers.js +0 -10
- package/dist/cli/bundler/utils/layers.js.map +0 -1
- package/dist/cli/bundler/utils/output.d.ts +0 -6
- package/dist/cli/bundler/utils/output.js.map +0 -1
- package/dist/cli/bundler/utils/styles.d.ts +0 -5
- package/dist/cli/bundler/utils/styles.js +0 -30
- package/dist/cli/bundler/utils/styles.js.map +0 -1
- package/dist/cli/plugins/output.d.ts +0 -2
- package/dist/cli/plugins/output.js.map +0 -1
- package/dist/cli/plugins/style/types.d.ts +0 -5
- package/dist/entry/content/adapters/react/resolvers/index.d.ts +0 -1
- package/dist/entry/content/adapters/react/resolvers/index.js +0 -2
- package/dist/entry/content/adapters/react/resolvers/index.js.map +0 -1
- package/dist/entry/content/adapters/react/resolvers/render.d.ts +0 -2
- package/dist/entry/content/adapters/react/resolvers/render.js +0 -11
- package/dist/entry/content/adapters/react/resolvers/render.js.map +0 -1
- package/dist/entry/content/core/Builder.d.ts +0 -26
- package/dist/entry/content/core/Builder.js +0 -128
- package/dist/entry/content/core/Builder.js.map +0 -1
- package/dist/entry/content/core/MountBuilder.d.ts +0 -10
- package/dist/entry/content/core/MountBuilder.js +0 -48
- package/dist/entry/content/core/MountBuilder.js.map +0 -1
- package/dist/entry/content/core/context/Context.d.ts +0 -12
- package/dist/entry/content/core/context/Context.js +0 -50
- package/dist/entry/content/core/context/Context.js.map +0 -1
- package/dist/entry/content/core/context/EventEmitter.js.map +0 -1
- package/dist/entry/content/core/context/ManagedContext.d.ts +0 -5
- package/dist/entry/content/core/context/ManagedContext.js +0 -12
- package/dist/entry/content/core/context/ManagedContext.js.map +0 -1
- package/dist/entry/content/core/context/index.js +0 -9
- package/dist/entry/content/core/context/index.js.map +0 -1
- package/dist/entry/content/core/markers/AbstractMarker.js.map +0 -1
- package/dist/entry/content/core/markers/AttributeMarker.js.map +0 -1
- package/dist/entry/content/core/markers/WeakMarker.js.map +0 -1
- package/dist/entry/content/core/markers/index.js.map +0 -1
- package/dist/entry/content/core/nodes/EventNode.d.ts +0 -11
- package/dist/entry/content/core/nodes/EventNode.js +0 -35
- package/dist/entry/content/core/nodes/EventNode.js.map +0 -1
- package/dist/entry/content/core/nodes/FrameNode.d.ts +0 -23
- package/dist/entry/content/core/nodes/FrameNode.js +0 -125
- package/dist/entry/content/core/nodes/FrameNode.js.map +0 -1
- package/dist/entry/content/core/nodes/MarkerNode.js.map +0 -1
- package/dist/entry/content/core/nodes/MountNode.d.ts +0 -12
- package/dist/entry/content/core/nodes/MountNode.js +0 -42
- package/dist/entry/content/core/nodes/MountNode.js.map +0 -1
- package/dist/entry/content/core/nodes/Node.js.map +0 -1
- package/dist/entry/content/core/nodes/ShadowNode.d.ts +0 -14
- package/dist/entry/content/core/nodes/ShadowNode.js +0 -67
- package/dist/entry/content/core/nodes/ShadowNode.js.map +0 -1
- package/dist/entry/content/core/nodes/index.js +0 -15
- package/dist/entry/content/core/nodes/index.js.map +0 -1
- package/dist/entry/content/core/nodes/isolated-styles.js.map +0 -1
- package/dist/entry/content/core/resolvers/anchor.d.ts +0 -2
- package/dist/entry/content/core/resolvers/anchor.js.map +0 -1
- package/dist/entry/content/core/resolvers/container.d.ts +0 -2
- package/dist/entry/content/core/resolvers/container.js.map +0 -1
- package/dist/entry/content/core/resolvers/definition.d.ts +0 -3
- package/dist/entry/content/core/resolvers/definition.js +0 -12
- package/dist/entry/content/core/resolvers/definition.js.map +0 -1
- package/dist/entry/content/core/resolvers/index.js.map +0 -1
- package/dist/entry/content/core/resolvers/mount.d.ts +0 -2
- package/dist/entry/content/core/resolvers/mount.js.map +0 -1
- package/dist/entry/content/core/resolvers/render.d.ts +0 -3
- package/dist/entry/content/core/resolvers/render.js +0 -18
- package/dist/entry/content/core/resolvers/render.js.map +0 -1
- package/dist/entry/content/core/resolvers/watch.d.ts +0 -4
- package/dist/entry/content/core/resolvers/watch.js +0 -62
- package/dist/entry/content/core/resolvers/watch.js.map +0 -1
- package/dist/entry/content/frame/Builder.d.ts +0 -7
- package/dist/entry/content/frame/Builder.js +0 -14
- package/dist/entry/content/frame/Builder.js.map +0 -1
- package/dist/entry/content/frame/index.d.ts +0 -4
- package/dist/entry/content/frame/index.js +0 -7
- package/dist/entry/content/frame/index.js.map +0 -1
- package/dist/types/content.js.map +0 -1
- package/dist/virtual/entrypoint.js +0 -7
- package/dist/virtual/entrypoint.js.map +0 -1
- /package/dist/entry/content/{core → lifecycle}/markers/index.d.ts +0 -0
- /package/dist/entry/content/{core → lifecycle}/markers/index.js +0 -0
- /package/dist/{cli/plugins/style → entry/content/lifecycle}/types.js +0 -0
- /package/dist/{cli/plugins/style → entry/content/lifecycle}/types.js.map +0 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
class MountNode {
|
|
2
|
+
constructor(node, registry, mounter) {
|
|
3
|
+
this.node = node;
|
|
4
|
+
this.registry = registry;
|
|
5
|
+
this.mounter = mounter;
|
|
6
|
+
}
|
|
7
|
+
node;
|
|
8
|
+
registry;
|
|
9
|
+
mounter;
|
|
10
|
+
unregister;
|
|
11
|
+
cleanup;
|
|
12
|
+
unmounting = false;
|
|
13
|
+
get anchor() {
|
|
14
|
+
return this.node.anchor;
|
|
15
|
+
}
|
|
16
|
+
get container() {
|
|
17
|
+
return this.node.container;
|
|
18
|
+
}
|
|
19
|
+
get target() {
|
|
20
|
+
return this.node.target;
|
|
21
|
+
}
|
|
22
|
+
get boundary() {
|
|
23
|
+
return this.node.boundary;
|
|
24
|
+
}
|
|
25
|
+
mount() {
|
|
26
|
+
var _a;
|
|
27
|
+
if (this.unmounting) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
this.node.mount();
|
|
31
|
+
const container = this.container;
|
|
32
|
+
if (!container || container.isConnected || !this.mounter) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
(_a = this.unregister) == null ? void 0 : _a.call(this);
|
|
36
|
+
const unregister = this.registry.register(container, this.anchor);
|
|
37
|
+
this.unregister = unregister;
|
|
38
|
+
try {
|
|
39
|
+
const cleanup = this.mounter(this.anchor, container);
|
|
40
|
+
if (this.unregister !== unregister || this.container !== container) {
|
|
41
|
+
cleanup == null ? void 0 : cleanup();
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
this.cleanup = cleanup || void 0;
|
|
45
|
+
return true;
|
|
46
|
+
} catch (error) {
|
|
47
|
+
unregister();
|
|
48
|
+
if (this.unregister === unregister) {
|
|
49
|
+
this.unregister = void 0;
|
|
50
|
+
}
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
unmount() {
|
|
55
|
+
if (this.unmounting) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
const unregister = this.unregister;
|
|
59
|
+
const cleanup = this.cleanup;
|
|
60
|
+
this.unregister = void 0;
|
|
61
|
+
this.cleanup = void 0;
|
|
62
|
+
this.unmounting = true;
|
|
63
|
+
let removed = false;
|
|
64
|
+
try {
|
|
65
|
+
unregister == null ? void 0 : unregister();
|
|
66
|
+
try {
|
|
67
|
+
cleanup == null ? void 0 : cleanup();
|
|
68
|
+
} finally {
|
|
69
|
+
removed = !!this.node.unmount();
|
|
70
|
+
}
|
|
71
|
+
} finally {
|
|
72
|
+
this.unmounting = false;
|
|
73
|
+
}
|
|
74
|
+
return removed;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
MountNode as default
|
|
79
|
+
};
|
|
80
|
+
//# sourceMappingURL=MountNode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/entry/content/lifecycle/nodes/MountNode.ts"],"sourcesContent":["import {ContentScriptNode, ContentScriptBoundary, ContentScriptMountFunction} from \"@typing/content\";\nimport type ContainerRegistry from \"../context/ContainerRegistry\";\n\nexport default class MountNode implements ContentScriptNode {\n private unregister?: () => void;\n private cleanup?: () => void;\n private unmounting = false;\n\n constructor(\n protected node: ContentScriptNode,\n private readonly registry: ContainerRegistry,\n protected mounter?: ContentScriptMountFunction\n ) {}\n\n public get anchor(): Element {\n return this.node.anchor;\n }\n\n public get container(): Element | undefined {\n return this.node.container;\n }\n\n public get target(): Element | undefined {\n return this.node.target;\n }\n\n public get boundary(): ContentScriptBoundary {\n return this.node.boundary;\n }\n\n public mount(): boolean {\n if (this.unmounting) {\n return false;\n }\n\n this.node.mount();\n const container = this.container;\n\n if (!container || container.isConnected || !this.mounter) {\n return false;\n }\n\n this.unregister?.();\n const unregister = this.registry.register(container, this.anchor);\n this.unregister = unregister;\n\n try {\n const cleanup = this.mounter(this.anchor, container);\n\n if (this.unregister !== unregister || this.container !== container) {\n // A synchronous cancellation must not retain cleanup or revive the registration.\n cleanup?.();\n\n return false;\n }\n\n this.cleanup = cleanup || undefined;\n\n return true;\n } catch (error) {\n unregister();\n\n if (this.unregister === unregister) {\n this.unregister = undefined;\n }\n\n throw error;\n }\n }\n\n public unmount(): boolean {\n if (this.unmounting) {\n return false;\n }\n\n const unregister = this.unregister;\n const cleanup = this.cleanup;\n this.unregister = undefined;\n this.cleanup = undefined;\n this.unmounting = true;\n let removed = false;\n\n try {\n unregister?.();\n\n try {\n cleanup?.();\n } finally {\n removed = !!this.node.unmount();\n }\n } finally {\n this.unmounting = false;\n }\n\n return removed;\n }\n}\n"],"mappings":"AAGA,MAAO,UAAqD;AAAA,EAKxD,YACc,MACO,UACP,SACZ;AAHY;AACO;AACP;AAAA,EACX;AAAA,EAHW;AAAA,EACO;AAAA,EACP;AAAA,EAPN;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EAQrB,IAAW,SAAkB;AACzB,WAAO,KAAK,KAAK;AAAA,EACrB;AAAA,EAEA,IAAW,YAAiC;AACxC,WAAO,KAAK,KAAK;AAAA,EACrB;AAAA,EAEA,IAAW,SAA8B;AACrC,WAAO,KAAK,KAAK;AAAA,EACrB;AAAA,EAEA,IAAW,WAAkC;AACzC,WAAO,KAAK,KAAK;AAAA,EACrB;AAAA,EAEO,QAAiB;AA9B5B;AA+BQ,QAAI,KAAK,YAAY;AACjB,aAAO;AAAA,IACX;AAEA,SAAK,KAAK,MAAM;AAChB,UAAM,YAAY,KAAK;AAEvB,QAAI,CAAC,aAAa,UAAU,eAAe,CAAC,KAAK,SAAS;AACtD,aAAO;AAAA,IACX;AAEA,eAAK,eAAL;AACA,UAAM,aAAa,KAAK,SAAS,SAAS,WAAW,KAAK,MAAM;AAChE,SAAK,aAAa;AAElB,QAAI;AACA,YAAM,UAAU,KAAK,QAAQ,KAAK,QAAQ,SAAS;AAEnD,UAAI,KAAK,eAAe,cAAc,KAAK,cAAc,WAAW;AAEhE;AAEA,eAAO;AAAA,MACX;AAEA,WAAK,UAAU,WAAW;AAE1B,aAAO;AAAA,IACX,SAAS,OAAO;AACZ,iBAAW;AAEX,UAAI,KAAK,eAAe,YAAY;AAChC,aAAK,aAAa;AAAA,MACtB;AAEA,YAAM;AAAA,IACV;AAAA,EACJ;AAAA,EAEO,UAAmB;AACtB,QAAI,KAAK,YAAY;AACjB,aAAO;AAAA,IACX;AAEA,UAAM,aAAa,KAAK;AACxB,UAAM,UAAU,KAAK;AACrB,SAAK,aAAa;AAClB,SAAK,UAAU;AACf,SAAK,aAAa;AAClB,QAAI,UAAU;AAEd,QAAI;AACA;AAEA,UAAI;AACA;AAAA,MACJ,UAAE;AACE,kBAAU,CAAC,CAAC,KAAK,KAAK,QAAQ;AAAA,MAClC;AAAA,IACJ,UAAE;AACE,WAAK,aAAa;AAAA,IACtB;AAEA,WAAO;AAAA,EACX;AACJ;","names":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ContentScriptNode } from "../../../../types/content.js";
|
|
2
|
-
export default class implements ContentScriptNode {
|
|
1
|
+
import type { ContentScriptNode } from "../../../../types/content/index.js";
|
|
2
|
+
export default class Node implements ContentScriptNode {
|
|
3
3
|
readonly anchor: Element;
|
|
4
4
|
container?: Element | undefined;
|
|
5
5
|
private readonly _container?;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class Node {
|
|
2
2
|
constructor(anchor, container) {
|
|
3
3
|
this.anchor = anchor;
|
|
4
4
|
this.container = container;
|
|
@@ -29,6 +29,6 @@ class Node_default {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
export {
|
|
32
|
-
|
|
32
|
+
Node as default
|
|
33
33
|
};
|
|
34
34
|
//# sourceMappingURL=Node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/entry/content/lifecycle/nodes/Node.ts"],"sourcesContent":["import type {ContentScriptNode} from \"@typing/content\";\n\nexport default class Node implements ContentScriptNode {\n private readonly _container?: Element;\n\n constructor(\n public readonly anchor: Element,\n public container?: Element\n ) {\n if (this.container) {\n this._container = this.container.cloneNode(false) as Element;\n }\n }\n\n public get target(): Element | undefined {\n return this.container;\n }\n\n public mount(): boolean {\n if (!this.container && this._container) {\n this.container = this._container.cloneNode(false) as Element;\n\n return true;\n }\n\n return false;\n }\n\n public unmount(): boolean {\n if (this.container) {\n this.container.remove();\n this.container = undefined;\n\n return true;\n }\n\n return false;\n }\n}\n"],"mappings":"AAEA,MAAO,KAAgD;AAAA,EAGnD,YACoB,QACT,WACT;AAFkB;AACT;AAEP,QAAI,KAAK,WAAW;AAChB,WAAK,aAAa,KAAK,UAAU,UAAU,KAAK;AAAA,IACpD;AAAA,EACJ;AAAA,EANoB;AAAA,EACT;AAAA,EAJM;AAAA,EAWjB,IAAW,SAA8B;AACrC,WAAO,KAAK;AAAA,EAChB;AAAA,EAEO,QAAiB;AACpB,QAAI,CAAC,KAAK,aAAa,KAAK,YAAY;AACpC,WAAK,YAAY,KAAK,WAAW,UAAU,KAAK;AAEhD,aAAO;AAAA,IACX;AAEA,WAAO;AAAA,EACX;AAAA,EAEO,UAAmB;AACtB,QAAI,KAAK,WAAW;AAChB,WAAK,UAAU,OAAO;AACtB,WAAK,YAAY;AAEjB,aAAO;AAAA,IACX;AAEA,WAAO;AAAA,EACX;AACJ;","names":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ContentScriptNode, ContentScriptBoundary, ContentScriptProps, ContentScriptRenderHandler, ContentScriptRenderValue } from "../../../../types/content/index.js";
|
|
2
|
+
import type { ContentScriptRenderLifecycle, ContentScriptRenderOptions } from "../types.js";
|
|
3
|
+
/** Runs the adapter only after mounting DOM and invalidates work when its target is replaced. */
|
|
4
|
+
export default abstract class RenderNode<Data = unknown> implements ContentScriptNode, ContentScriptRenderLifecycle {
|
|
5
|
+
protected readonly node: ContentScriptNode;
|
|
6
|
+
private readonly resolve;
|
|
7
|
+
private readonly props;
|
|
8
|
+
private readonly options?;
|
|
9
|
+
private generation;
|
|
10
|
+
private renderedTarget?;
|
|
11
|
+
private pendingTarget?;
|
|
12
|
+
private mountHandler?;
|
|
13
|
+
private errorHandler?;
|
|
14
|
+
private empty;
|
|
15
|
+
constructor(node: ContentScriptNode, resolve: ContentScriptRenderHandler<Data>, props: () => ContentScriptProps<Data>, options?: ContentScriptRenderOptions | undefined);
|
|
16
|
+
get anchor(): Element;
|
|
17
|
+
get container(): Element | undefined;
|
|
18
|
+
get target(): Element | undefined;
|
|
19
|
+
get boundary(): ContentScriptBoundary;
|
|
20
|
+
protected abstract render(value: ContentScriptRenderValue<Data> | undefined, target: Element): boolean;
|
|
21
|
+
protected abstract clear(): void;
|
|
22
|
+
setMountHandler(handler: () => void): void;
|
|
23
|
+
setErrorHandler(handler: (error: unknown) => void): void;
|
|
24
|
+
mount(): boolean;
|
|
25
|
+
private completeRender;
|
|
26
|
+
private renderTarget;
|
|
27
|
+
unmount(): boolean;
|
|
28
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
class RenderNode {
|
|
2
|
+
constructor(node, resolve, props, options) {
|
|
3
|
+
this.node = node;
|
|
4
|
+
this.resolve = resolve;
|
|
5
|
+
this.props = props;
|
|
6
|
+
this.options = options;
|
|
7
|
+
}
|
|
8
|
+
node;
|
|
9
|
+
resolve;
|
|
10
|
+
props;
|
|
11
|
+
options;
|
|
12
|
+
generation = 0;
|
|
13
|
+
renderedTarget;
|
|
14
|
+
pendingTarget;
|
|
15
|
+
mountHandler;
|
|
16
|
+
errorHandler;
|
|
17
|
+
empty = false;
|
|
18
|
+
get anchor() {
|
|
19
|
+
return this.node.anchor;
|
|
20
|
+
}
|
|
21
|
+
get container() {
|
|
22
|
+
return this.node.container;
|
|
23
|
+
}
|
|
24
|
+
get target() {
|
|
25
|
+
return this.node.target;
|
|
26
|
+
}
|
|
27
|
+
get boundary() {
|
|
28
|
+
return this.node.boundary;
|
|
29
|
+
}
|
|
30
|
+
setMountHandler(handler) {
|
|
31
|
+
this.mountHandler = handler;
|
|
32
|
+
}
|
|
33
|
+
setErrorHandler(handler) {
|
|
34
|
+
this.errorHandler = handler;
|
|
35
|
+
}
|
|
36
|
+
mount() {
|
|
37
|
+
var _a;
|
|
38
|
+
if (this.empty || !this.anchor.isConnected) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
const ready = (_a = this.options) == null ? void 0 : _a.ready;
|
|
42
|
+
const onError = this.errorHandler;
|
|
43
|
+
if (ready && !onError) {
|
|
44
|
+
throw new Error("Deferred content rendering requires an error handler before mount");
|
|
45
|
+
}
|
|
46
|
+
this.node.mount();
|
|
47
|
+
const target = this.target;
|
|
48
|
+
if (!target) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
if (target === this.renderedTarget || target === this.pendingTarget) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
this.clear();
|
|
55
|
+
const generation = ++this.generation;
|
|
56
|
+
this.pendingTarget = void 0;
|
|
57
|
+
const replacedAnchor = !this.anchor.isConnected;
|
|
58
|
+
if (ready && onError) {
|
|
59
|
+
const loading = ready();
|
|
60
|
+
this.pendingTarget = target;
|
|
61
|
+
void loading.then(
|
|
62
|
+
() => {
|
|
63
|
+
if (generation !== this.generation || target !== this.target) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
this.pendingTarget = void 0;
|
|
67
|
+
try {
|
|
68
|
+
this.completeRender(target, generation, replacedAnchor);
|
|
69
|
+
} catch (error) {
|
|
70
|
+
onError(error);
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
() => {
|
|
74
|
+
if (generation === this.generation) {
|
|
75
|
+
this.pendingTarget = void 0;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
return this.completeRender(target, generation, replacedAnchor);
|
|
82
|
+
}
|
|
83
|
+
completeRender(target, generation, replacedAnchor) {
|
|
84
|
+
var _a;
|
|
85
|
+
const rendered = this.renderTarget(target, generation, replacedAnchor);
|
|
86
|
+
if (rendered && generation === this.generation && target === this.target) {
|
|
87
|
+
(_a = this.mountHandler) == null ? void 0 : _a.call(this);
|
|
88
|
+
}
|
|
89
|
+
return rendered;
|
|
90
|
+
}
|
|
91
|
+
renderTarget(target, generation, replacedAnchor) {
|
|
92
|
+
var _a, _b;
|
|
93
|
+
if (generation !== this.generation || target !== this.target) {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
if (!this.anchor.isConnected && !(replacedAnchor && ((_a = this.container) == null ? void 0 : _a.isConnected))) {
|
|
97
|
+
this.unmount();
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
this.renderedTarget = target;
|
|
101
|
+
try {
|
|
102
|
+
const value = this.resolve(this.props());
|
|
103
|
+
if (generation !== this.generation || target !== this.target) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
if (!this.anchor.isConnected && !(replacedAnchor && ((_b = this.container) == null ? void 0 : _b.isConnected))) {
|
|
107
|
+
this.unmount();
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
if (!this.render(value, target)) {
|
|
111
|
+
this.empty = true;
|
|
112
|
+
this.node.unmount();
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
return true;
|
|
116
|
+
} catch (error) {
|
|
117
|
+
if (generation !== this.generation) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
this.unmount();
|
|
121
|
+
throw error;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
unmount() {
|
|
125
|
+
this.generation++;
|
|
126
|
+
this.renderedTarget = void 0;
|
|
127
|
+
this.pendingTarget = void 0;
|
|
128
|
+
let removed = false;
|
|
129
|
+
try {
|
|
130
|
+
this.clear();
|
|
131
|
+
} finally {
|
|
132
|
+
removed = !!this.node.unmount();
|
|
133
|
+
}
|
|
134
|
+
return removed;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
export {
|
|
138
|
+
RenderNode as default
|
|
139
|
+
};
|
|
140
|
+
//# sourceMappingURL=RenderNode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/entry/content/lifecycle/nodes/RenderNode.ts"],"sourcesContent":["import type {\n ContentScriptNode,\n ContentScriptBoundary,\n ContentScriptProps,\n ContentScriptRenderHandler,\n ContentScriptRenderValue,\n} from \"@typing/content\";\nimport type {ContentScriptRenderLifecycle, ContentScriptRenderOptions} from \"../types\";\n\n/** Runs the adapter only after mounting DOM and invalidates work when its target is replaced. */\nexport default abstract class RenderNode<Data = unknown> implements ContentScriptNode, ContentScriptRenderLifecycle {\n private generation = 0;\n private renderedTarget?: Element;\n private pendingTarget?: Element;\n private mountHandler?: () => void;\n private errorHandler?: (error: unknown) => void;\n private empty = false;\n\n constructor(\n protected readonly node: ContentScriptNode,\n private readonly resolve: ContentScriptRenderHandler<Data>,\n private readonly props: () => ContentScriptProps<Data>,\n private readonly options?: ContentScriptRenderOptions\n ) {}\n\n public get anchor(): Element {\n return this.node.anchor;\n }\n\n public get container(): Element | undefined {\n return this.node.container;\n }\n\n public get target(): Element | undefined {\n return this.node.target;\n }\n\n public get boundary(): ContentScriptBoundary {\n return this.node.boundary;\n }\n\n protected abstract render(value: ContentScriptRenderValue<Data> | undefined, target: Element): boolean;\n\n protected abstract clear(): void;\n\n public setMountHandler(handler: () => void): void {\n this.mountHandler = handler;\n }\n\n public setErrorHandler(handler: (error: unknown) => void): void {\n this.errorHandler = handler;\n }\n\n public mount(): boolean {\n if (this.empty || !this.anchor.isConnected) {\n return false;\n }\n\n const ready = this.options?.ready;\n const onError = this.errorHandler;\n\n if (ready && !onError) {\n throw new Error(\"Deferred content rendering requires an error handler before mount\");\n }\n\n this.node.mount();\n\n const target = this.target;\n\n if (!target) {\n return false;\n }\n\n if (target === this.renderedTarget || target === this.pendingTarget) {\n return false;\n }\n\n this.clear();\n\n const generation = ++this.generation;\n this.pendingTarget = undefined;\n\n const replacedAnchor = !this.anchor.isConnected;\n\n if (ready && onError) {\n const loading = ready();\n this.pendingTarget = target;\n\n void loading.then(\n () => {\n if (generation !== this.generation || target !== this.target) {\n return;\n }\n\n this.pendingTarget = undefined;\n\n try {\n this.completeRender(target, generation, replacedAnchor);\n } catch (error) {\n onError(error);\n }\n },\n () => {\n // The style runtime reports the failure. A later mount can retry this target.\n if (generation === this.generation) {\n this.pendingTarget = undefined;\n }\n }\n );\n\n return false;\n }\n\n return this.completeRender(target, generation, replacedAnchor);\n }\n\n private completeRender(target: Element, generation: number, replacedAnchor: boolean): boolean {\n const rendered = this.renderTarget(target, generation, replacedAnchor);\n\n if (rendered && generation === this.generation && target === this.target) {\n this.mountHandler?.();\n }\n\n return rendered;\n }\n\n private renderTarget(target: Element, generation: number, replacedAnchor: boolean): boolean {\n if (generation !== this.generation || target !== this.target) {\n return false;\n }\n\n if (!this.anchor.isConnected && !(replacedAnchor && this.container?.isConnected)) {\n this.unmount();\n\n return false;\n }\n\n // Prevent a render callback from recursively rendering into the same target.\n this.renderedTarget = target;\n\n try {\n const value = this.resolve(this.props());\n\n if (generation !== this.generation || target !== this.target) {\n return false;\n }\n\n // A synchronous custom mount (including append: Replace) can deliberately replace its anchor.\n if (!this.anchor.isConnected && !(replacedAnchor && this.container?.isConnected)) {\n this.unmount();\n\n return false;\n }\n\n if (!this.render(value, target)) {\n this.empty = true;\n this.node.unmount();\n\n return false;\n }\n\n return true;\n } catch (error) {\n if (generation !== this.generation) {\n return false;\n }\n\n this.unmount();\n\n throw error;\n }\n }\n\n public unmount(): boolean {\n this.generation++;\n this.renderedTarget = undefined;\n this.pendingTarget = undefined;\n\n let removed = false;\n\n try {\n this.clear();\n } finally {\n removed = !!this.node.unmount();\n }\n\n return removed;\n }\n}\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type IsolationSetup from "../IsolationSetup.js";
|
|
2
|
+
import { ContentScriptNode, type ContentScriptShadowOptions } from "../../../../types/content/index.js";
|
|
3
|
+
export default class ShadowNode<Data = unknown> implements ContentScriptNode {
|
|
4
|
+
protected readonly node: ContentScriptNode;
|
|
5
|
+
private readonly options;
|
|
6
|
+
private readonly isolation;
|
|
7
|
+
private root?;
|
|
8
|
+
private _target?;
|
|
9
|
+
private runtime?;
|
|
10
|
+
private cleanupBoundary?;
|
|
11
|
+
private mounting;
|
|
12
|
+
private unmounting;
|
|
13
|
+
constructor(node: ContentScriptNode, options: ContentScriptShadowOptions | undefined, isolation: IsolationSetup<Data, "shadow">);
|
|
14
|
+
get anchor(): Element;
|
|
15
|
+
get container(): Element | undefined;
|
|
16
|
+
get target(): Element | undefined;
|
|
17
|
+
get boundary(): ShadowRoot | undefined;
|
|
18
|
+
ready(): Promise<void>;
|
|
19
|
+
mount(): boolean;
|
|
20
|
+
private mountNode;
|
|
21
|
+
unmount(): boolean;
|
|
22
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { getContentScriptStylesRuntime } from "./isolated-styles.js";
|
|
2
|
+
import {
|
|
3
|
+
ContentScriptShadowMode
|
|
4
|
+
} from "./../../../../types/content/index.js";
|
|
5
|
+
class ShadowNode {
|
|
6
|
+
constructor(node, options = {}, isolation) {
|
|
7
|
+
this.node = node;
|
|
8
|
+
this.options = options;
|
|
9
|
+
this.isolation = isolation;
|
|
10
|
+
}
|
|
11
|
+
node;
|
|
12
|
+
options;
|
|
13
|
+
isolation;
|
|
14
|
+
root;
|
|
15
|
+
_target;
|
|
16
|
+
runtime;
|
|
17
|
+
cleanupBoundary;
|
|
18
|
+
mounting = false;
|
|
19
|
+
unmounting = false;
|
|
20
|
+
get anchor() {
|
|
21
|
+
return this.node.anchor;
|
|
22
|
+
}
|
|
23
|
+
get container() {
|
|
24
|
+
return this.node.container;
|
|
25
|
+
}
|
|
26
|
+
get target() {
|
|
27
|
+
return this._target;
|
|
28
|
+
}
|
|
29
|
+
get boundary() {
|
|
30
|
+
return this.root;
|
|
31
|
+
}
|
|
32
|
+
ready() {
|
|
33
|
+
return this.root && this.runtime ? this.runtime.ready(this.root) : Promise.resolve();
|
|
34
|
+
}
|
|
35
|
+
mount() {
|
|
36
|
+
if (this.mounting || this.unmounting) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
this.mounting = true;
|
|
40
|
+
try {
|
|
41
|
+
return this.mountNode();
|
|
42
|
+
} finally {
|
|
43
|
+
this.mounting = false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
mountNode() {
|
|
47
|
+
const mounted = !!this.node.mount();
|
|
48
|
+
if (!this.container || this.root) {
|
|
49
|
+
return mounted;
|
|
50
|
+
}
|
|
51
|
+
if (!("attachShadow" in this.container) || typeof this.container.attachShadow !== "function") {
|
|
52
|
+
throw new Error("Content script container does not support Shadow DOM");
|
|
53
|
+
}
|
|
54
|
+
if (this.container.shadowRoot) {
|
|
55
|
+
throw new Error("Content script container already has an open ShadowRoot");
|
|
56
|
+
}
|
|
57
|
+
let root;
|
|
58
|
+
try {
|
|
59
|
+
root = this.container.attachShadow({ mode: this.options.mode ?? ContentScriptShadowMode.Open });
|
|
60
|
+
} catch (cause) {
|
|
61
|
+
throw new Error(
|
|
62
|
+
"Cannot attach ShadowRoot: the content script container may already have a root or not support Shadow DOM",
|
|
63
|
+
{ cause }
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
this.root = root;
|
|
67
|
+
try {
|
|
68
|
+
const cleanup = this.isolation.setup(root);
|
|
69
|
+
if (this.root !== root) {
|
|
70
|
+
cleanup == null ? void 0 : cleanup();
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
this.cleanupBoundary = cleanup || void 0;
|
|
74
|
+
const target = this.isolation.createTarget(root, this.container.ownerDocument);
|
|
75
|
+
if (this.root !== root) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
root.appendChild(target);
|
|
79
|
+
this._target = target;
|
|
80
|
+
this.runtime = getContentScriptStylesRuntime();
|
|
81
|
+
this.runtime.add(root, target);
|
|
82
|
+
} catch (error) {
|
|
83
|
+
if (this.root === root) {
|
|
84
|
+
this.unmount();
|
|
85
|
+
}
|
|
86
|
+
throw error;
|
|
87
|
+
}
|
|
88
|
+
return mounted;
|
|
89
|
+
}
|
|
90
|
+
unmount() {
|
|
91
|
+
var _a;
|
|
92
|
+
if (this.unmounting) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
this.unmounting = true;
|
|
96
|
+
this._target = void 0;
|
|
97
|
+
const cleanup = this.cleanupBoundary;
|
|
98
|
+
this.cleanupBoundary = void 0;
|
|
99
|
+
let removed = false;
|
|
100
|
+
try {
|
|
101
|
+
try {
|
|
102
|
+
cleanup == null ? void 0 : cleanup();
|
|
103
|
+
} finally {
|
|
104
|
+
try {
|
|
105
|
+
if (this.root) {
|
|
106
|
+
(_a = this.runtime) == null ? void 0 : _a.delete(this.root);
|
|
107
|
+
}
|
|
108
|
+
} finally {
|
|
109
|
+
this.root = void 0;
|
|
110
|
+
this._target = void 0;
|
|
111
|
+
this.runtime = void 0;
|
|
112
|
+
removed = !!this.node.unmount();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return removed;
|
|
116
|
+
} finally {
|
|
117
|
+
this.unmounting = false;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
export {
|
|
122
|
+
ShadowNode as default
|
|
123
|
+
};
|
|
124
|
+
//# sourceMappingURL=ShadowNode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/entry/content/lifecycle/nodes/ShadowNode.ts"],"sourcesContent":["import type IsolationSetup from \"../IsolationSetup\";\n\nimport {getContentScriptStylesRuntime} from \"./isolated-styles\";\n\nimport {\n ContentScriptNode,\n ContentScriptShadowMode,\n type ContentScriptShadowOptions,\n type ContentScriptStylesRuntime,\n type ContentScriptBoundaryCleanup,\n} from \"@typing/content\";\n\nexport default class ShadowNode<Data = unknown> implements ContentScriptNode {\n private root?: ShadowRoot;\n\n private _target?: Element;\n\n private runtime?: ContentScriptStylesRuntime;\n private cleanupBoundary?: ContentScriptBoundaryCleanup;\n\n private mounting = false;\n private unmounting = false;\n\n public constructor(\n protected readonly node: ContentScriptNode,\n private readonly options: ContentScriptShadowOptions = {},\n private readonly isolation: IsolationSetup<Data, \"shadow\">\n ) {}\n\n public get anchor(): Element {\n return this.node.anchor;\n }\n\n public get container(): Element | undefined {\n return this.node.container;\n }\n\n public get target(): Element | undefined {\n return this._target;\n }\n\n public get boundary(): ShadowRoot | undefined {\n return this.root;\n }\n\n public ready(): Promise<void> {\n return this.root && this.runtime ? this.runtime.ready(this.root) : Promise.resolve();\n }\n\n public mount(): boolean {\n if (this.mounting || this.unmounting) {\n return false;\n }\n\n this.mounting = true;\n\n try {\n return this.mountNode();\n } finally {\n this.mounting = false;\n }\n }\n\n private mountNode(): boolean {\n const mounted = !!this.node.mount();\n\n if (!this.container || this.root) {\n return mounted;\n }\n\n if (!(\"attachShadow\" in this.container) || typeof this.container.attachShadow !== \"function\") {\n throw new Error(\"Content script container does not support Shadow DOM\");\n }\n\n if (this.container.shadowRoot) {\n throw new Error(\"Content script container already has an open ShadowRoot\");\n }\n\n let root: ShadowRoot;\n\n try {\n root = this.container.attachShadow({mode: this.options.mode ?? ContentScriptShadowMode.Open});\n } catch (cause) {\n // A pre-existing closed root is not observable through container.shadowRoot.\n throw new Error(\n \"Cannot attach ShadowRoot: the content script container may already have a root or not support Shadow DOM\",\n {cause}\n );\n }\n\n this.root = root;\n\n try {\n const cleanup = this.isolation.setup(root);\n\n if (this.root !== root) {\n cleanup?.();\n\n return false;\n }\n\n this.cleanupBoundary = cleanup || undefined;\n const target = this.isolation.createTarget(root, this.container.ownerDocument);\n\n if (this.root !== root) {\n return false;\n }\n\n root.appendChild(target);\n\n this._target = target;\n this.runtime = getContentScriptStylesRuntime();\n this.runtime.add(root, target);\n } catch (error) {\n if (this.root === root) {\n this.unmount();\n }\n\n throw error;\n }\n\n return mounted;\n }\n\n public unmount(): boolean {\n if (this.unmounting) {\n return false;\n }\n\n this.unmounting = true;\n this._target = undefined;\n\n const cleanup = this.cleanupBoundary;\n\n this.cleanupBoundary = undefined;\n\n let removed = false;\n\n try {\n try {\n cleanup?.();\n } finally {\n try {\n if (this.root) {\n this.runtime?.delete(this.root);\n }\n } finally {\n this.root = undefined;\n this._target = undefined;\n this.runtime = undefined;\n removed = !!this.node.unmount();\n }\n }\n\n return removed;\n } finally {\n this.unmounting = false;\n }\n }\n}\n"],"mappings":"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","names":[]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as Node } from "./Node.js";
|
|
2
|
+
export { default as RenderNode } from "./RenderNode.js";
|
|
2
3
|
export { default as MountNode } from "./MountNode.js";
|
|
3
4
|
export { default as MarkerNode } from "./MarkerNode.js";
|
|
4
5
|
export { default as EventNode } from "./EventNode.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { default as default2 } from "./Node.js";
|
|
2
|
+
import { default as default3 } from "./RenderNode.js";
|
|
3
|
+
import { default as default4 } from "./MountNode.js";
|
|
4
|
+
import { default as default5 } from "./MarkerNode.js";
|
|
5
|
+
import { default as default6 } from "./EventNode.js";
|
|
6
|
+
import { default as default7 } from "./ShadowNode.js";
|
|
7
|
+
import { default as default8 } from "./FrameNode.js";
|
|
8
|
+
export {
|
|
9
|
+
default6 as EventNode,
|
|
10
|
+
default8 as FrameNode,
|
|
11
|
+
default5 as MarkerNode,
|
|
12
|
+
default4 as MountNode,
|
|
13
|
+
default2 as Node,
|
|
14
|
+
default3 as RenderNode,
|
|
15
|
+
default7 as ShadowNode
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/entry/content/lifecycle/nodes/index.ts"],"sourcesContent":["export {default as Node} from \"./Node\";\nexport {default as RenderNode} from \"./RenderNode\";\nexport {default as MountNode} from \"./MountNode\";\nexport {default as MarkerNode} from \"./MarkerNode\";\nexport {default as EventNode} from \"./EventNode\";\nexport {default as ShadowNode} from \"./ShadowNode\";\nexport {default as FrameNode} from \"./FrameNode\";\n"],"mappings":"AAAA,SAAmB,WAAXA,gBAAsB;AAC9B,SAAmB,WAAXA,gBAA4B;AACpC,SAAmB,WAAXA,gBAA2B;AACnC,SAAmB,WAAXA,gBAA4B;AACpC,SAAmB,WAAXA,gBAA2B;AACnC,SAAmB,WAAXA,gBAA4B;AACpC,SAAmB,WAAXA,gBAA2B;","names":["default"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ContentScriptStylesRuntime } from "../../../../types/content/index.js";
|
|
2
2
|
export declare const getContentScriptStylesRuntime: () => ContentScriptStylesRuntime;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getUrl } from "@addon-core/browser";
|
|
2
|
-
import {
|
|
2
|
+
import { readContentStyles } from "#adnbn/runtime";
|
|
3
3
|
const getContentScriptStylesRuntime = () => {
|
|
4
|
-
const runtime =
|
|
4
|
+
const runtime = readContentStyles();
|
|
5
5
|
if (!runtime) {
|
|
6
6
|
throw new Error("Isolated styles runtime is unavailable in this content entrypoint");
|
|
7
7
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/entry/content/lifecycle/nodes/isolated-styles.ts"],"sourcesContent":["import {getUrl} from \"@addon-core/browser\";\nimport {readContentStyles} from \"#adnbn/runtime\";\n\nimport type {ContentScriptStylesRuntime} from \"@typing/content\";\n\nexport const getContentScriptStylesRuntime = (): ContentScriptStylesRuntime => {\n const runtime = readContentStyles();\n\n if (!runtime) {\n throw new Error(\"Isolated styles runtime is unavailable in this content entrypoint\");\n }\n\n runtime.initialize(getUrl);\n\n return runtime;\n};\n"],"mappings":"AAAA,SAAQ,cAAa;AACrB,SAAQ,yBAAwB;AAIzB,MAAM,gCAAgC,MAAkC;AAC3E,QAAM,UAAU,kBAAkB;AAElC,MAAI,CAAC,SAAS;AACV,UAAM,IAAI,MAAM,mEAAmE;AAAA,EACvF;AAEA,UAAQ,WAAW,MAAM;AAEzB,SAAO;AACX;","names":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ContentScriptNode } from "../../../types/content/index.js";
|
|
2
|
+
/** One owner drains discovery requests for a single builder generation. */
|
|
3
|
+
export interface ContentScriptCycle {
|
|
4
|
+
generation: number;
|
|
5
|
+
pending: boolean;
|
|
6
|
+
promise: Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
/** One completion callback for the event decorator paired with this renderer. */
|
|
9
|
+
export interface ContentScriptMountNotifier {
|
|
10
|
+
setMountHandler(handler: () => void): void;
|
|
11
|
+
}
|
|
12
|
+
export interface ContentScriptRenderLifecycle extends ContentScriptMountNotifier {
|
|
13
|
+
/** The owning lifecycle handles deferred renderer failures without throwing. */
|
|
14
|
+
setErrorHandler(handler: (error: unknown) => void): void;
|
|
15
|
+
}
|
|
16
|
+
/** Internal composition result; only renderers supply their own completion signal. */
|
|
17
|
+
export interface ContentScriptNodeAssembly {
|
|
18
|
+
node: ContentScriptNode;
|
|
19
|
+
renderer?: ContentScriptRenderLifecycle;
|
|
20
|
+
}
|
|
21
|
+
export interface ContentScriptRenderOptions {
|
|
22
|
+
ready?: () => Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
/** The isolation stage supplies a node and optional readiness for its render target. */
|
|
25
|
+
export interface ContentScriptIsolationAssembly {
|
|
26
|
+
node: ContentScriptNode;
|
|
27
|
+
ready?: () => Promise<void>;
|
|
28
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const createAnchorResolver = (anchor) => async () => {
|
|
2
2
|
let resolved = typeof anchor === "function" ? anchor() : anchor;
|
|
3
3
|
if (resolved instanceof Promise) {
|
|
4
4
|
resolved = await resolved;
|
|
@@ -9,6 +9,6 @@ const contentScriptAnchorResolver = (anchor) => async () => {
|
|
|
9
9
|
return resolved;
|
|
10
10
|
};
|
|
11
11
|
export {
|
|
12
|
-
|
|
12
|
+
createAnchorResolver
|
|
13
13
|
};
|
|
14
14
|
//# sourceMappingURL=anchor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/entry/content/resolvers/anchor.ts"],"sourcesContent":["import {ContentScriptAnchor, ContentScriptAnchorGetter} from \"@typing/content\";\n\n// prettier-ignore\nexport const createAnchorResolver =\n (anchor?: ContentScriptAnchor | ContentScriptAnchorGetter): ContentScriptAnchorGetter =>\n async (): Promise<ContentScriptAnchor> => {\n let resolved = typeof anchor === \"function\" ? anchor() : anchor;\n\n if (resolved instanceof Promise) {\n resolved = await resolved;\n }\n\n if (resolved === undefined || resolved === null) {\n return document.body;\n }\n\n return resolved;\n };\n"],"mappings":"AAGO,MAAM,uBACT,CAAC,WACG,YAA0C;AACtC,MAAI,WAAW,OAAO,WAAW,aAAa,OAAO,IAAI;AAEzD,MAAI,oBAAoB,SAAS;AAC7B,eAAW,MAAM;AAAA,EACrB;AAEA,MAAI,aAAa,UAAa,aAAa,MAAM;AAC7C,WAAO,SAAS;AAAA,EACpB;AAEA,SAAO;AACX;","names":[]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { ContentScriptContainerCreator, ContentScriptContainerFactory, ContentScriptContainerOptions, ContentScriptContainerTag } from "../../../types/content/index.js";
|
|
2
|
+
export declare const createContainerResolver: <Data = unknown>(container?: ContentScriptContainerTag | ContentScriptContainerOptions | ContentScriptContainerFactory<Data>) => ContentScriptContainerCreator<Data>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const createContainerResolver = (container) => async (props) => {
|
|
2
2
|
let resolvedContainer = typeof container === "function" ? container(props) : container;
|
|
3
3
|
if (resolvedContainer instanceof Promise) {
|
|
4
4
|
resolvedContainer = await resolvedContainer;
|
|
@@ -16,6 +16,6 @@ const contentScriptContainerResolver = (container) => async (props) => {
|
|
|
16
16
|
return resolvedContainer;
|
|
17
17
|
};
|
|
18
18
|
export {
|
|
19
|
-
|
|
19
|
+
createContainerResolver
|
|
20
20
|
};
|
|
21
21
|
//# sourceMappingURL=container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/entry/content/resolvers/container.ts"],"sourcesContent":["import {\n ContentScriptContainerCreator,\n ContentScriptContainerFactory,\n ContentScriptContainerOptions,\n ContentScriptContainerTag,\n ContentScriptContainerProps,\n} from \"@typing/content\";\n\n// prettier-ignore\nexport const createContainerResolver = <Data = unknown>(\n container?:\n ContentScriptContainerTag |\n ContentScriptContainerOptions |\n ContentScriptContainerFactory<Data>\n): ContentScriptContainerCreator<Data> =>\n async (props: ContentScriptContainerProps<Data>): Promise<Element> => {\n let resolvedContainer = typeof container === \"function\" ? container(props) : container;\n\n if (resolvedContainer instanceof Promise) {\n resolvedContainer = await resolvedContainer;\n }\n\n if (resolvedContainer === undefined || typeof resolvedContainer === \"string\") {\n resolvedContainer = document.createElement(resolvedContainer || \"div\");\n } else if (typeof resolvedContainer === \"object\" && resolvedContainer.constructor === Object) {\n const {tagName = \"div\", ...options} = resolvedContainer as ContentScriptContainerOptions;\n\n resolvedContainer = document.createElement(tagName);\n\n Object.assign(resolvedContainer, options);\n }\n\n if (!(resolvedContainer instanceof Element)) {\n throw new Error(\"The content script container must be a valid element\");\n }\n\n return resolvedContainer;\n };\n"],"mappings":"AASO,MAAM,0BAA0B,CACnC,cAKA,OAAO,UAA+D;AAClE,MAAI,oBAAoB,OAAO,cAAc,aAAa,UAAU,KAAK,IAAI;AAE7E,MAAI,6BAA6B,SAAS;AACtC,wBAAoB,MAAM;AAAA,EAC9B;AAEA,MAAI,sBAAsB,UAAa,OAAO,sBAAsB,UAAU;AAC1E,wBAAoB,SAAS,cAAc,qBAAqB,KAAK;AAAA,EACzE,WAAW,OAAO,sBAAsB,YAAY,kBAAkB,gBAAgB,QAAQ;AAC1F,UAAM,EAAC,UAAU,OAAO,GAAG,QAAO,IAAI;AAEtC,wBAAoB,SAAS,cAAc,OAAO;AAElD,WAAO,OAAO,mBAAmB,OAAO;AAAA,EAC5C;AAEA,MAAI,EAAE,6BAA6B,UAAU;AACzC,UAAM,IAAI,MAAM,sDAAsD;AAAA,EAC1E;AAEA,SAAO;AACX;","names":[]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ContentScriptDefinition } from "../../../types/content/index.js";
|
|
2
|
+
/** Merge module exports using the selected adapter's interpretation of the default value. */
|
|
3
|
+
export declare const mergeDefinition: (module: object, isRenderInput: (value: unknown) => boolean) => ContentScriptDefinition;
|
|
4
|
+
/** Resolve exports without a renderer; the content parser validates default render exports before navigation. */
|
|
5
|
+
export declare const resolveDefinition: (module: object) => ContentScriptDefinition;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const isDefinitionObject = (value) => {
|
|
2
|
+
return value !== null && typeof value === "object" && value.constructor === Object;
|
|
3
|
+
};
|
|
4
|
+
const mergeDefinition = (module, isRenderInput) => {
|
|
5
|
+
const { default: defaultDefinition, ...definition } = module;
|
|
6
|
+
if (isRenderInput(defaultDefinition)) {
|
|
7
|
+
return { ...definition, render: defaultDefinition };
|
|
8
|
+
}
|
|
9
|
+
if (isDefinitionObject(defaultDefinition)) {
|
|
10
|
+
return { ...definition, ...defaultDefinition };
|
|
11
|
+
}
|
|
12
|
+
return definition;
|
|
13
|
+
};
|
|
14
|
+
const resolveDefinition = (module) => {
|
|
15
|
+
return mergeDefinition(
|
|
16
|
+
module,
|
|
17
|
+
(value) => value != null && value !== "" && typeof value !== "boolean" && !isDefinitionObject(value)
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
mergeDefinition,
|
|
22
|
+
resolveDefinition
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=definition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/entry/content/resolvers/definition.ts"],"sourcesContent":["import type {ContentScriptDefinition} from \"@typing/content\";\n\n/** Adapters must recognize their render objects before falling back to an options object. */\nconst isDefinitionObject = (value: unknown): value is ContentScriptDefinition => {\n return value !== null && typeof value === \"object\" && value.constructor === Object;\n};\n\n/** Merge module exports using the selected adapter's interpretation of the default value. */\nexport const mergeDefinition = (\n module: object,\n isRenderInput: (value: unknown) => boolean\n): ContentScriptDefinition => {\n const {default: defaultDefinition, ...definition} = module as Record<string, unknown>;\n\n if (isRenderInput(defaultDefinition)) {\n return {...definition, render: defaultDefinition} as ContentScriptDefinition;\n }\n\n if (isDefinitionObject(defaultDefinition)) {\n return {...definition, ...defaultDefinition};\n }\n\n return definition;\n};\n\n/** Resolve exports without a renderer; the content parser validates default render exports before navigation. */\nexport const resolveDefinition = (module: object): ContentScriptDefinition => {\n return mergeDefinition(\n module,\n value => value != null && value !== \"\" && typeof value !== \"boolean\" && !isDefinitionObject(value)\n );\n};\n"],"mappings":"AAGA,MAAM,qBAAqB,CAAC,UAAqD;AAC7E,SAAO,UAAU,QAAQ,OAAO,UAAU,YAAY,MAAM,gBAAgB;AAChF;AAGO,MAAM,kBAAkB,CAC3B,QACA,kBAC0B;AAC1B,QAAM,EAAC,SAAS,mBAAmB,GAAG,WAAU,IAAI;AAEpD,MAAI,cAAc,iBAAiB,GAAG;AAClC,WAAO,EAAC,GAAG,YAAY,QAAQ,kBAAiB;AAAA,EACpD;AAEA,MAAI,mBAAmB,iBAAiB,GAAG;AACvC,WAAO,EAAC,GAAG,YAAY,GAAG,kBAAiB;AAAA,EAC/C;AAEA,SAAO;AACX;AAGO,MAAM,oBAAoB,CAAC,WAA4C;AAC1E,SAAO;AAAA,IACH;AAAA,IACA,WAAS,SAAS,QAAQ,UAAU,MAAM,OAAO,UAAU,aAAa,CAAC,mBAAmB,KAAK;AAAA,EACrG;AACJ;","names":[]}
|