// Copyright 2024 The Lynx Authors. All rights reserved. // Licensed under the Apache License Version 2.0 that can be found in the // LICENSE file in the root directory of this source tree. import { Suspense, createElement, lazy, cloneElement as preactCloneElement } from 'preact/compat'; import type { FC } from 'react'; import './runtime-marker.js'; import './lynx.js'; import { useMemo } from './core/hooks/react.js'; import { loadLazyBundle } from './core/lynx/lazy-bundle.js'; import * as ReactLynxInternalSelf from './internal.js'; import { __root } from './root.js'; import { factory as factory2 } from './snapshot/compat/componentIs.js'; import { BackgroundSnapshotInstance } from './snapshot/snapshot/backgroundSnapshot.js'; import { __page, __pageId, createSnapshot, snapshotManager } from './snapshot/snapshot/definition.js'; import { DynamicPartType } from './snapshot/snapshot/dynamicPartType.js'; import { snapshotCreateList } from './snapshot/snapshot/list.js'; import { SnapshotInstance, snapshotCreatorMap } from './snapshot/snapshot/snapshot.js'; import { setSnapshotCreatorRuntime } from './snapshot/snapshot/snapshotCreatorMap.js'; export { BITS, CHILDREN, COMPONENT, COMPONENT_DIRTY, DIFF, DOM, FLAGS, INDEX, PARENT, } from './shared/render-constants.js'; export { __page, __pageId, __root }; export { BackgroundSnapshotInstance, SnapshotInstance, snapshotCreateList, createSnapshot, snapshotManager, snapshotCreatorMap, }; export const __DynamicPartSlot: DynamicPartType = DynamicPartType.Slot; export const __DynamicPartMultiChildren: DynamicPartType = DynamicPartType.MultiChildren; export const __DynamicPartChildren: DynamicPartType = DynamicPartType.Children; export const __DynamicPartListChildren: DynamicPartType = DynamicPartType.ListChildren; export { __DynamicPartChildren_0, __DynamicPartSlotV2_0 } from './snapshot/snapshot/dynamicPartType.js'; // v2 slot export const __DynamicPartSlotV2: DynamicPartType = DynamicPartType.SlotV2; export const __DynamicPartListSlotV2: DynamicPartType = DynamicPartType.ListSlotV2; export { updateSpread } from './snapshot/snapshot/spread.js'; export { updateEvent } from './snapshot/snapshot/event.js'; export { updateRef, transformRef } from './snapshot/snapshot/ref.js'; export { updateWorkletEvent } from './snapshot/snapshot/workletEvent.js'; export { updateWorkletRef } from './snapshot/snapshot/workletRef.js'; export { updateGesture } from './snapshot/snapshot/gesture.js'; export { updateListItemPlatformInfo } from './snapshot/snapshot/platformInfo.js'; export { preactCloneElement }; export { options, // Component is not an internal API, but refresh needs it from 'react/internal' Component, process, } from 'preact'; export type { Options } from 'preact'; export { loadDynamicJS, __dynamicImport } from './core/lynx/dynamic-import.js'; // Re-exported so lazy bundle shells can reach the host runtime APIs // via `target[sExportsReactInternal]`. export { registerRuntimeVersion, getRuntimeVersion } from './core/lynx/runtime-version.js'; export { RUNTIME_BACKEND_ELEMENT_TEMPLATE, RUNTIME_BACKEND_SNAPSHOT, registerRuntimeBackend, } from './core/lynx/runtime-backend.js'; export { withInitDataInState } from './core/initData.js'; export { wrapWithLynxComponent } from './core/compat/lynxComponent.js'; /** * @internal a polyfill for */ export const __ComponentIsPolyfill: FC<{ is: string }> = /* @__PURE__ */ factory2( // eslint-disable-next-line @typescript-eslint/no-unsafe-argument { Suspense, lazy, createElement, useMemo } as any, loadLazyBundle, ); export { loadLazyBundle } from './core/lynx/lazy-bundle.js'; export { createBackgroundFunctionHandle as transformToWorklet } from './core/background-function/handle.js'; export { registerWorkletOnBackground } from './snapshot/worklet/hmr.js'; export { captureMainThreadObject } from './core/capture-main-thread-object.js'; if (__DEV__) { // Dev snapshot creators take the runtime as a parameter (they are // stringified for cross-thread HMR and must not capture module bindings); // register this namespace as that runtime. Production creators close over // their own module's runtime import, so this reference is dropped there. setSnapshotCreatorRuntime(ReactLynxInternalSelf); }