@lynx-js/react 0.105.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/CHANGELOG.md +250 -0
- package/LICENSE +202 -0
- package/README.md +20 -0
- package/components/lib/Page.d.ts +3 -0
- package/components/lib/Page.js +56 -0
- package/components/lib/Page.js.map +1 -0
- package/components/lib/index.d.ts +1 -0
- package/components/lib/index.js +5 -0
- package/components/lib/index.js.map +1 -0
- package/components/src/Page.ts +75 -0
- package/components/src/index.ts +5 -0
- package/package.json +162 -0
- package/refresh/.gitignore +1 -0
- package/refresh/.npmignore +3 -0
- package/refresh/.turbo/turbo-build.log +8 -0
- package/refresh/dist/index.js +311 -0
- package/refresh/package.json +21 -0
- package/refresh/src/index.ts +6 -0
- package/refresh/src/prefresh.d.ts +11 -0
- package/refresh/tsconfig.json +4 -0
- package/refresh/turbo.json +15 -0
- package/runtime/jsx-dev-runtime/index.d.ts +5 -0
- package/runtime/jsx-dev-runtime/index.js +4 -0
- package/runtime/jsx-runtime/index.d.ts +4 -0
- package/runtime/jsx-runtime/index.js +4 -0
- package/runtime/lazy/import.d.ts +1 -0
- package/runtime/lazy/import.js +55 -0
- package/runtime/lazy/internal.js +39 -0
- package/runtime/lazy/jsx-dev-runtime.js +12 -0
- package/runtime/lazy/jsx-runtime.js +12 -0
- package/runtime/lazy/legacy-react-runtime.js +20 -0
- package/runtime/lazy/react-lepus.js +9 -0
- package/runtime/lazy/react.js +46 -0
- package/runtime/lazy/target.js +11 -0
- package/runtime/lepus/index.d.ts +4 -0
- package/runtime/lepus/index.js +43 -0
- package/runtime/lepus/jsx-dev-runtime/index.js +4 -0
- package/runtime/lepus/jsx-runtime/index.js +66 -0
- package/runtime/lib/backgroundSnapshot.d.ts +23 -0
- package/runtime/lib/backgroundSnapshot.js +348 -0
- package/runtime/lib/backgroundSnapshot.js.map +1 -0
- package/runtime/lib/compat/componentIs.d.ts +4 -0
- package/runtime/lib/compat/componentIs.js +20 -0
- package/runtime/lib/compat/componentIs.js.map +1 -0
- package/runtime/lib/compat/initData.d.ts +43 -0
- package/runtime/lib/compat/initData.js +93 -0
- package/runtime/lib/compat/initData.js.map +1 -0
- package/runtime/lib/compat/lynxComponent.d.ts +5 -0
- package/runtime/lib/compat/lynxComponent.js +71 -0
- package/runtime/lib/compat/lynxComponent.js.map +1 -0
- package/runtime/lib/debug/debug.d.ts +2 -0
- package/runtime/lib/debug/debug.js +9 -0
- package/runtime/lib/debug/debug.js.map +1 -0
- package/runtime/lib/debug/printSnapshot.d.ts +3 -0
- package/runtime/lib/debug/printSnapshot.js +21 -0
- package/runtime/lib/debug/printSnapshot.js.map +1 -0
- package/runtime/lib/debug/profile.d.ts +1 -0
- package/runtime/lib/debug/profile.js +51 -0
- package/runtime/lib/debug/profile.js.map +1 -0
- package/runtime/lib/document.d.ts +4 -0
- package/runtime/lib/document.js +49 -0
- package/runtime/lib/document.js.map +1 -0
- package/runtime/lib/gesture/processGesture.d.ts +4 -0
- package/runtime/lib/gesture/processGesture.js +48 -0
- package/runtime/lib/gesture/processGesture.js.map +1 -0
- package/runtime/lib/gesture/processGestureBagkround.d.ts +2 -0
- package/runtime/lib/gesture/processGestureBagkround.js +16 -0
- package/runtime/lib/gesture/processGestureBagkround.js.map +1 -0
- package/runtime/lib/gesture/types.d.ts +34 -0
- package/runtime/lib/gesture/types.js +13 -0
- package/runtime/lib/gesture/types.js.map +1 -0
- package/runtime/lib/hooks/react.d.ts +26 -0
- package/runtime/lib/hooks/react.js +35 -0
- package/runtime/lib/hooks/react.js.map +1 -0
- package/runtime/lib/hooks/useLynxGlobalEventListener.d.ts +29 -0
- package/runtime/lib/hooks/useLynxGlobalEventListener.js +53 -0
- package/runtime/lib/hooks/useLynxGlobalEventListener.js.map +1 -0
- package/runtime/lib/hydrate.d.ts +18 -0
- package/runtime/lib/hydrate.js +271 -0
- package/runtime/lib/hydrate.js.map +1 -0
- package/runtime/lib/index.d.ts +9 -0
- package/runtime/lib/index.js +46 -0
- package/runtime/lib/index.js.map +1 -0
- package/runtime/lib/internal.d.ts +26 -0
- package/runtime/lib/internal.js +41 -0
- package/runtime/lib/internal.js.map +1 -0
- package/runtime/lib/legacy-react-runtime/index.d.ts +7 -0
- package/runtime/lib/legacy-react-runtime/index.js +34 -0
- package/runtime/lib/legacy-react-runtime/index.js.map +1 -0
- package/runtime/lib/lifecycle/delayUnmount.d.ts +8 -0
- package/runtime/lib/lifecycle/delayUnmount.js +68 -0
- package/runtime/lib/lifecycle/delayUnmount.js.map +1 -0
- package/runtime/lib/lifecycle/destroy.d.ts +2 -0
- package/runtime/lib/lifecycle/destroy.js +21 -0
- package/runtime/lib/lifecycle/destroy.js.map +1 -0
- package/runtime/lib/lifecycle/pass.d.ts +3 -0
- package/runtime/lib/lifecycle/pass.js +12 -0
- package/runtime/lib/lifecycle/pass.js.map +1 -0
- package/runtime/lib/lifecycle/patchUpdate.d.ts +23 -0
- package/runtime/lib/lifecycle/patchUpdate.js +179 -0
- package/runtime/lib/lifecycle/patchUpdate.js.map +1 -0
- package/runtime/lib/lifecycle/reload.d.ts +3 -0
- package/runtime/lib/lifecycle/reload.js +63 -0
- package/runtime/lib/lifecycle/reload.js.map +1 -0
- package/runtime/lib/lifecycle/render.d.ts +2 -0
- package/runtime/lib/lifecycle/render.js +44 -0
- package/runtime/lib/lifecycle/render.js.map +1 -0
- package/runtime/lib/lifecycleConstant.d.ts +12 -0
- package/runtime/lib/lifecycleConstant.js +17 -0
- package/runtime/lib/lifecycleConstant.js.map +1 -0
- package/runtime/lib/list.d.ts +40 -0
- package/runtime/lib/list.js +305 -0
- package/runtime/lib/list.js.map +1 -0
- package/runtime/lib/lynx/calledByNative.d.ts +2 -0
- package/runtime/lib/lynx/calledByNative.js +113 -0
- package/runtime/lib/lynx/calledByNative.js.map +1 -0
- package/runtime/lib/lynx/component.d.ts +1 -0
- package/runtime/lib/lynx/component.js +69 -0
- package/runtime/lib/lynx/component.js.map +1 -0
- package/runtime/lib/lynx/dynamic-js.d.ts +2 -0
- package/runtime/lib/lynx/dynamic-js.js +31 -0
- package/runtime/lib/lynx/dynamic-js.js.map +1 -0
- package/runtime/lib/lynx/env.d.ts +1 -0
- package/runtime/lib/lynx/env.js +92 -0
- package/runtime/lib/lynx/env.js.map +1 -0
- package/runtime/lib/lynx/injectLepusMethods.d.ts +2 -0
- package/runtime/lib/lynx/injectLepusMethods.js +50 -0
- package/runtime/lib/lynx/injectLepusMethods.js.map +1 -0
- package/runtime/lib/lynx/lazy-bundle.d.ts +9 -0
- package/runtime/lib/lynx/lazy-bundle.js +119 -0
- package/runtime/lib/lynx/lazy-bundle.js.map +1 -0
- package/runtime/lib/lynx/performance.d.ts +29 -0
- package/runtime/lib/lynx/performance.js +100 -0
- package/runtime/lib/lynx/performance.js.map +1 -0
- package/runtime/lib/lynx/tt.d.ts +4 -0
- package/runtime/lib/lynx/tt.js +193 -0
- package/runtime/lib/lynx/tt.js.map +1 -0
- package/runtime/lib/lynx-api.d.ts +311 -0
- package/runtime/lib/lynx-api.js +116 -0
- package/runtime/lib/lynx-api.js.map +1 -0
- package/runtime/lib/lynx.d.ts +2 -0
- package/runtime/lib/lynx.js +91 -0
- package/runtime/lib/lynx.js.map +1 -0
- package/runtime/lib/opcodes.d.ts +2 -0
- package/runtime/lib/opcodes.js +59 -0
- package/runtime/lib/opcodes.js.map +1 -0
- package/runtime/lib/renderToOpcodes/constants.d.ts +17 -0
- package/runtime/lib/renderToOpcodes/constants.js +23 -0
- package/runtime/lib/renderToOpcodes/constants.js.map +1 -0
- package/runtime/lib/renderToOpcodes/index.d.ts +13 -0
- package/runtime/lib/renderToOpcodes/index.js +227 -0
- package/runtime/lib/renderToOpcodes/index.js.map +1 -0
- package/runtime/lib/root.d.ts +7 -0
- package/runtime/lib/root.js +17 -0
- package/runtime/lib/root.js.map +1 -0
- package/runtime/lib/snapshot/event.d.ts +3 -0
- package/runtime/lib/snapshot/event.js +24 -0
- package/runtime/lib/snapshot/event.js.map +1 -0
- package/runtime/lib/snapshot/gesture.d.ts +2 -0
- package/runtime/lib/snapshot/gesture.js +18 -0
- package/runtime/lib/snapshot/gesture.js.map +1 -0
- package/runtime/lib/snapshot/platformInfo.d.ts +4 -0
- package/runtime/lib/snapshot/platformInfo.js +35 -0
- package/runtime/lib/snapshot/platformInfo.js.map +1 -0
- package/runtime/lib/snapshot/ref.d.ts +10 -0
- package/runtime/lib/snapshot/ref.js +119 -0
- package/runtime/lib/snapshot/ref.js.map +1 -0
- package/runtime/lib/snapshot/spread.d.ts +5 -0
- package/runtime/lib/snapshot/spread.js +289 -0
- package/runtime/lib/snapshot/spread.js.map +1 -0
- package/runtime/lib/snapshot/workletEvent.d.ts +3 -0
- package/runtime/lib/snapshot/workletEvent.js +22 -0
- package/runtime/lib/snapshot/workletEvent.js.map +1 -0
- package/runtime/lib/snapshot/workletRef.d.ts +5 -0
- package/runtime/lib/snapshot/workletRef.js +52 -0
- package/runtime/lib/snapshot/workletRef.js.map +1 -0
- package/runtime/lib/snapshot.d.ts +81 -0
- package/runtime/lib/snapshot.js +477 -0
- package/runtime/lib/snapshot.js.map +1 -0
- package/runtime/lib/snapshotPatch.d.ts +14 -0
- package/runtime/lib/snapshotPatch.js +31 -0
- package/runtime/lib/snapshotPatch.js.map +1 -0
- package/runtime/lib/snapshotPatchApply.d.ts +2 -0
- package/runtime/lib/snapshotPatchApply.js +110 -0
- package/runtime/lib/snapshotPatchApply.js.map +1 -0
- package/runtime/lib/utils.d.ts +4 -0
- package/runtime/lib/utils.js +32 -0
- package/runtime/lib/utils.js.map +1 -0
- package/runtime/lib/worklet/ctx.d.ts +1 -0
- package/runtime/lib/worklet/ctx.js +17 -0
- package/runtime/lib/worklet/ctx.js.map +1 -0
- package/runtime/lib/worklet/execMap.d.ts +1 -0
- package/runtime/lib/worklet/execMap.js +42 -0
- package/runtime/lib/worklet/execMap.js.map +1 -0
- package/runtime/lib/worklet/functionality.d.ts +1 -0
- package/runtime/lib/worklet/functionality.js +11 -0
- package/runtime/lib/worklet/functionality.js.map +1 -0
- package/runtime/lib/worklet/hmr.d.ts +1 -0
- package/runtime/lib/worklet/hmr.js +21 -0
- package/runtime/lib/worklet/hmr.js.map +1 -0
- package/runtime/lib/worklet/indexMap.d.ts +8 -0
- package/runtime/lib/worklet/indexMap.js +17 -0
- package/runtime/lib/worklet/indexMap.js.map +1 -0
- package/runtime/lib/worklet/jsImpl.d.ts +11 -0
- package/runtime/lib/worklet/jsImpl.js +68 -0
- package/runtime/lib/worklet/jsImpl.js.map +1 -0
- package/runtime/lib/worklet/runWorklet.d.ts +14 -0
- package/runtime/lib/worklet/runWorklet.js +82 -0
- package/runtime/lib/worklet/runWorklet.js.map +1 -0
- package/runtime/lib/worklet/workletRef.d.ts +131 -0
- package/runtime/lib/worklet/workletRef.js +96 -0
- package/runtime/lib/worklet/workletRef.js.map +1 -0
- package/runtime/lib/worklet/workletRefPool.d.ts +2 -0
- package/runtime/lib/worklet/workletRefPool.js +22 -0
- package/runtime/lib/worklet/workletRefPool.js.map +1 -0
- package/runtime/src/backgroundSnapshot.ts +452 -0
- package/runtime/src/compat/componentIs.ts +30 -0
- package/runtime/src/compat/initData.ts +140 -0
- package/runtime/src/compat/lynxComponent.ts +80 -0
- package/runtime/src/debug/debug.ts +9 -0
- package/runtime/src/debug/printSnapshot.ts +28 -0
- package/runtime/src/debug/profile.ts +54 -0
- package/runtime/src/document.ts +53 -0
- package/runtime/src/gesture/processGesture.ts +77 -0
- package/runtime/src/gesture/processGestureBagkround.ts +15 -0
- package/runtime/src/gesture/types.ts +39 -0
- package/runtime/src/hooks/react.ts +62 -0
- package/runtime/src/hooks/useLynxGlobalEventListener.ts +59 -0
- package/runtime/src/hydrate.ts +364 -0
- package/runtime/src/index.ts +89 -0
- package/runtime/src/internal.ts +60 -0
- package/runtime/src/legacy-react-runtime/index.ts +40 -0
- package/runtime/src/lifecycle/delayUnmount.ts +77 -0
- package/runtime/src/lifecycle/destroy.ts +26 -0
- package/runtime/src/lifecycle/pass.ts +14 -0
- package/runtime/src/lifecycle/patchUpdate.ts +240 -0
- package/runtime/src/lifecycle/reload.ts +79 -0
- package/runtime/src/lifecycle/render.ts +46 -0
- package/runtime/src/lifecycleConstant.ts +16 -0
- package/runtime/src/list.ts +375 -0
- package/runtime/src/lynx/calledByNative.ts +132 -0
- package/runtime/src/lynx/component.ts +116 -0
- package/runtime/src/lynx/dynamic-js.ts +33 -0
- package/runtime/src/lynx/env.ts +110 -0
- package/runtime/src/lynx/injectLepusMethods.ts +53 -0
- package/runtime/src/lynx/lazy-bundle.ts +126 -0
- package/runtime/src/lynx/performance.ts +117 -0
- package/runtime/src/lynx/tt.ts +212 -0
- package/runtime/src/lynx-api.ts +374 -0
- package/runtime/src/lynx.ts +105 -0
- package/runtime/src/opcodes.ts +64 -0
- package/runtime/src/renderToOpcodes/constants.ts +24 -0
- package/runtime/src/renderToOpcodes/index.ts +301 -0
- package/runtime/src/root.ts +19 -0
- package/runtime/src/snapshot/event.ts +33 -0
- package/runtime/src/snapshot/gesture.ts +25 -0
- package/runtime/src/snapshot/platformInfo.ts +48 -0
- package/runtime/src/snapshot/ref.ts +151 -0
- package/runtime/src/snapshot/spread.ts +287 -0
- package/runtime/src/snapshot/workletEvent.ts +33 -0
- package/runtime/src/snapshot/workletRef.ts +63 -0
- package/runtime/src/snapshot.ts +576 -0
- package/runtime/src/snapshotPatch.ts +56 -0
- package/runtime/src/snapshotPatchApply.ts +117 -0
- package/runtime/src/utils.ts +35 -0
- package/runtime/src/worklet/ctx.ts +22 -0
- package/runtime/src/worklet/execMap.ts +50 -0
- package/runtime/src/worklet/functionality.ts +12 -0
- package/runtime/src/worklet/hmr.ts +26 -0
- package/runtime/src/worklet/indexMap.ts +20 -0
- package/runtime/src/worklet/jsImpl.ts +86 -0
- package/runtime/src/worklet/runWorklet.ts +88 -0
- package/runtime/src/worklet/workletRef.ts +229 -0
- package/runtime/src/worklet/workletRefPool.ts +25 -0
- package/transform/cjs/main.cjs +6 -0
- package/transform/cjs/main.d.cts +3 -0
- package/transform/cjs/package.json +3 -0
- package/transform/dist/wasm.cjs +8478 -0
- package/transform/index.d.ts +187 -0
- package/transform/main.js +15 -0
- package/types/react.d.ts +147 -0
- package/types/react.docs.d.ts +74 -0
- package/worklet-runtime/dist/dev.js +414 -0
- package/worklet-runtime/dist/dev.js.map +8 -0
- package/worklet-runtime/dist/main.js +414 -0
- package/worklet-runtime/dist/main.js.map +8 -0
- package/worklet-runtime/lib/api/element.d.ts +14 -0
- package/worklet-runtime/lib/api/element.js +71 -0
- package/worklet-runtime/lib/api/element.js.map +1 -0
- package/worklet-runtime/lib/api/lepusQuerySelector.d.ts +3 -0
- package/worklet-runtime/lib/api/lepusQuerySelector.js +23 -0
- package/worklet-runtime/lib/api/lepusQuerySelector.js.map +1 -0
- package/worklet-runtime/lib/api/lynxApi.d.ts +2 -0
- package/worklet-runtime/lib/api/lynxApi.js +35 -0
- package/worklet-runtime/lib/api/lynxApi.js.map +1 -0
- package/worklet-runtime/lib/bindings/bindings.d.ts +14 -0
- package/worklet-runtime/lib/bindings/bindings.js +61 -0
- package/worklet-runtime/lib/bindings/bindings.js.map +1 -0
- package/worklet-runtime/lib/bindings/events.d.ts +7 -0
- package/worklet-runtime/lib/bindings/events.js +9 -0
- package/worklet-runtime/lib/bindings/events.js.map +1 -0
- package/worklet-runtime/lib/bindings/index.d.ts +4 -0
- package/worklet-runtime/lib/bindings/index.js +7 -0
- package/worklet-runtime/lib/bindings/index.js.map +1 -0
- package/worklet-runtime/lib/bindings/loadRuntime.d.ts +8 -0
- package/worklet-runtime/lib/bindings/loadRuntime.js +25 -0
- package/worklet-runtime/lib/bindings/loadRuntime.js.map +1 -0
- package/worklet-runtime/lib/bindings/types.d.ts +35 -0
- package/worklet-runtime/lib/bindings/types.js +2 -0
- package/worklet-runtime/lib/bindings/types.js.map +1 -0
- package/worklet-runtime/lib/delayWorkletEvent.d.ts +11 -0
- package/worklet-runtime/lib/delayWorkletEvent.js +49 -0
- package/worklet-runtime/lib/delayWorkletEvent.js.map +1 -0
- package/worklet-runtime/lib/global.d.ts +15 -0
- package/worklet-runtime/lib/global.js +2 -0
- package/worklet-runtime/lib/global.js.map +1 -0
- package/worklet-runtime/lib/index.d.ts +1 -0
- package/worklet-runtime/lib/index.js +12 -0
- package/worklet-runtime/lib/index.js.map +1 -0
- package/worklet-runtime/lib/jsFunctionLifecycle.d.ts +18 -0
- package/worklet-runtime/lib/jsFunctionLifecycle.js +55 -0
- package/worklet-runtime/lib/jsFunctionLifecycle.js.map +1 -0
- package/worklet-runtime/lib/listeners.d.ts +2 -0
- package/worklet-runtime/lib/listeners.js +17 -0
- package/worklet-runtime/lib/listeners.js.map +1 -0
- package/worklet-runtime/lib/utils/profile.d.ts +1 -0
- package/worklet-runtime/lib/utils/profile.js +20 -0
- package/worklet-runtime/lib/utils/profile.js.map +1 -0
- package/worklet-runtime/lib/utils/version.d.ts +1 -0
- package/worklet-runtime/lib/utils/version.js +10 -0
- package/worklet-runtime/lib/utils/version.js.map +1 -0
- package/worklet-runtime/lib/workletRef.d.ts +12 -0
- package/worklet-runtime/lib/workletRef.js +50 -0
- package/worklet-runtime/lib/workletRef.js.map +1 -0
- package/worklet-runtime/lib/workletRuntime.d.ts +2 -0
- package/worklet-runtime/lib/workletRuntime.js +128 -0
- package/worklet-runtime/lib/workletRuntime.js.map +1 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/* auto-generated by NAPI-RS */
|
|
5
|
+
|
|
6
|
+
export interface TransformNodiffBundleOptions {
|
|
7
|
+
filename: string
|
|
8
|
+
pluginName: string
|
|
9
|
+
sourceFileName?: string
|
|
10
|
+
sourcemap: boolean | string
|
|
11
|
+
extractStr: boolean | ExtractStrConfig
|
|
12
|
+
minify?: boolean
|
|
13
|
+
}
|
|
14
|
+
export interface TransformNodiffBundleOutput {
|
|
15
|
+
code: string
|
|
16
|
+
map?: string
|
|
17
|
+
selectStrVec?: Array<string>
|
|
18
|
+
useWorklet?: boolean
|
|
19
|
+
errors: Array<PartialMessage>
|
|
20
|
+
warnings: Array<PartialMessage>
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* This is esbuild's PartialMessage definition.
|
|
24
|
+
* https://github.com/evanw/esbuild/blob/043ab306c490f692c68e8d254bbf00b6468be87d/lib/shared/types.ts#L421
|
|
25
|
+
*/
|
|
26
|
+
export interface PartialMessage {
|
|
27
|
+
id?: string
|
|
28
|
+
pluginName?: string
|
|
29
|
+
text?: string
|
|
30
|
+
location?: PartialLocation
|
|
31
|
+
notes?: Array<PartialNote>
|
|
32
|
+
detail?: string
|
|
33
|
+
}
|
|
34
|
+
export interface PartialNote {
|
|
35
|
+
text?: string
|
|
36
|
+
location?: PartialLocation
|
|
37
|
+
}
|
|
38
|
+
export interface PartialLocation {
|
|
39
|
+
file?: string
|
|
40
|
+
namespace?: string
|
|
41
|
+
line?: number
|
|
42
|
+
column?: number
|
|
43
|
+
length?: number
|
|
44
|
+
lineText?: string
|
|
45
|
+
suggestion?: string
|
|
46
|
+
}
|
|
47
|
+
export interface DarkModeConfig {
|
|
48
|
+
/** @public */
|
|
49
|
+
themeExpr: string
|
|
50
|
+
}
|
|
51
|
+
export interface CompatVisitorConfig {
|
|
52
|
+
/** @internal */
|
|
53
|
+
target: 'LEPUS' | 'JS' | 'MIXED'
|
|
54
|
+
/** @public */
|
|
55
|
+
componentsPkg: Array<string>
|
|
56
|
+
/** @public */
|
|
57
|
+
oldRuntimePkg: Array<string>
|
|
58
|
+
/** @public */
|
|
59
|
+
newRuntimePkg: string
|
|
60
|
+
/** @public */
|
|
61
|
+
additionalComponentAttributes: Array<string>
|
|
62
|
+
/** @public */
|
|
63
|
+
addComponentElement: boolean
|
|
64
|
+
/**
|
|
65
|
+
* @public
|
|
66
|
+
* @deprecated
|
|
67
|
+
*/
|
|
68
|
+
simplifyCtorLikeReactLynx2: boolean
|
|
69
|
+
/**
|
|
70
|
+
* @public
|
|
71
|
+
* @deprecated
|
|
72
|
+
*/
|
|
73
|
+
removeComponentAttrRegex?: string
|
|
74
|
+
/** @public */
|
|
75
|
+
disableDeprecatedWarning: boolean
|
|
76
|
+
/**
|
|
77
|
+
* @public
|
|
78
|
+
* @deprecated
|
|
79
|
+
*/
|
|
80
|
+
darkMode?: boolean | DarkModeConfig
|
|
81
|
+
}
|
|
82
|
+
export interface CssScopeVisitorConfig {
|
|
83
|
+
/** @public */
|
|
84
|
+
mode: 'all' | 'none' | 'modules'
|
|
85
|
+
/** @public */
|
|
86
|
+
filename: string
|
|
87
|
+
}
|
|
88
|
+
export interface DefineDceVisitorConfig {
|
|
89
|
+
/** @public */
|
|
90
|
+
define: Record<string, string>
|
|
91
|
+
}
|
|
92
|
+
export interface DirectiveDceVisitorConfig {
|
|
93
|
+
/** @internal */
|
|
94
|
+
target: 'LEPUS' | 'JS' | 'MIXED'
|
|
95
|
+
}
|
|
96
|
+
export interface DynamicImportVisitorConfig {
|
|
97
|
+
/** @internal */
|
|
98
|
+
runtimePkg: string
|
|
99
|
+
/** @internal */
|
|
100
|
+
layer: string
|
|
101
|
+
}
|
|
102
|
+
export interface ExtractStrConfig {
|
|
103
|
+
/** @public */
|
|
104
|
+
strLength: number
|
|
105
|
+
/** @internal */
|
|
106
|
+
extractedStrArr?: Array<string>
|
|
107
|
+
}
|
|
108
|
+
export interface InjectVisitorConfig {
|
|
109
|
+
inject: Record<string, ['expr', string] | ['importDefault', string] | ['importStarAs', string] | ['importNamed', string, string]>
|
|
110
|
+
}
|
|
111
|
+
export interface RefreshVisitorConfig {
|
|
112
|
+
library?: Array<string>
|
|
113
|
+
}
|
|
114
|
+
export interface ShakeVisitorConfig {
|
|
115
|
+
/** @public */
|
|
116
|
+
pkgName: Array<string>
|
|
117
|
+
/** @public */
|
|
118
|
+
retainProp: Array<string>
|
|
119
|
+
/** @public */
|
|
120
|
+
removeCallParams: Array<string>
|
|
121
|
+
}
|
|
122
|
+
export interface JsxTransformerConfig {
|
|
123
|
+
preserveJsx: boolean
|
|
124
|
+
runtimePkg: string
|
|
125
|
+
jsxImportSource?: string
|
|
126
|
+
filename: string
|
|
127
|
+
/** @internal */
|
|
128
|
+
target: 'LEPUS' | 'JS' | 'MIXED'
|
|
129
|
+
/** @internal */
|
|
130
|
+
isDynamicComponent?: boolean
|
|
131
|
+
}
|
|
132
|
+
export interface WorkletVisitorConfig {
|
|
133
|
+
/**
|
|
134
|
+
* @public
|
|
135
|
+
* During the compilation of worklet, when extracting external variable identifiers,
|
|
136
|
+
* global identifiers available in lepus context need to be ignored.
|
|
137
|
+
* In addition to the default lepus global identifier list provided by the compiler,
|
|
138
|
+
* users can customize the global identifier list through this option.
|
|
139
|
+
* This configuration will take effect together with the default lepus global identifier list.
|
|
140
|
+
*/
|
|
141
|
+
customGlobalIdentNames?: Array<string>
|
|
142
|
+
/** @internal */
|
|
143
|
+
filename: string
|
|
144
|
+
/** @internal */
|
|
145
|
+
target: 'LEPUS' | 'JS' | 'MIXED'
|
|
146
|
+
runtimePkg: string
|
|
147
|
+
}
|
|
148
|
+
export interface TransformNodiffOptions {
|
|
149
|
+
/**
|
|
150
|
+
* @internal
|
|
151
|
+
* This is used internally to make sure the test output is consistent.
|
|
152
|
+
*/
|
|
153
|
+
mode?: 'production' | 'development' | 'test'
|
|
154
|
+
pluginName: string
|
|
155
|
+
filename: string
|
|
156
|
+
sourceFileName?: string
|
|
157
|
+
sourcemap: boolean | string
|
|
158
|
+
sourceMapColumns?: boolean
|
|
159
|
+
inlineSourcesContent?: boolean
|
|
160
|
+
/**
|
|
161
|
+
* @public
|
|
162
|
+
* This is swc syntax config in JSON format
|
|
163
|
+
*/
|
|
164
|
+
syntaxConfig?: string
|
|
165
|
+
isModule?: boolean | 'unknown'
|
|
166
|
+
cssScope: boolean | CssScopeVisitorConfig
|
|
167
|
+
snapshot?: boolean | JsxTransformerConfig
|
|
168
|
+
shake: boolean | ShakeVisitorConfig
|
|
169
|
+
compat: boolean | CompatVisitorConfig
|
|
170
|
+
refresh: boolean | RefreshVisitorConfig
|
|
171
|
+
defineDCE: boolean | DefineDceVisitorConfig
|
|
172
|
+
directiveDCE: boolean | DirectiveDceVisitorConfig
|
|
173
|
+
worklet: boolean | WorkletVisitorConfig
|
|
174
|
+
dynamicImport?: boolean | DynamicImportVisitorConfig
|
|
175
|
+
/** @internal */
|
|
176
|
+
inject?: boolean | InjectVisitorConfig
|
|
177
|
+
}
|
|
178
|
+
export interface TransformNodiffOutput {
|
|
179
|
+
code: string
|
|
180
|
+
map?: string
|
|
181
|
+
errors: Array<PartialMessage>
|
|
182
|
+
warnings: Array<PartialMessage>
|
|
183
|
+
}
|
|
184
|
+
export function transformReactLynxSync(code: string, options?: TransformNodiffOptions | undefined | null): TransformNodiffOutput
|
|
185
|
+
export function transformReactLynx(code: string, options?: TransformNodiffOptions | undefined | null): Promise<TransformNodiffOutput>
|
|
186
|
+
export function transformBundleResultSync(code: string, options?: TransformNodiffBundleOptions | undefined | null): TransformNodiffBundleOutput
|
|
187
|
+
export function transformBundleResult(code: string, options?: TransformNodiffBundleOptions | undefined | null): Promise<TransformNodiffBundleOutput>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright 2024 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
import { createRequire } from 'node:module';
|
|
5
|
+
|
|
6
|
+
import exports from './cjs/main.cjs';
|
|
7
|
+
|
|
8
|
+
const require = createRequire(import.meta.url);
|
|
9
|
+
|
|
10
|
+
export const {
|
|
11
|
+
transformReactLynxSync,
|
|
12
|
+
transformBundleResultSync,
|
|
13
|
+
transformReactLynx,
|
|
14
|
+
transformBundleResult,
|
|
15
|
+
} = process.env['USE_NAPI'] ? require('./index.cjs') : exports;
|
package/types/react.d.ts
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
// Import to apply global declarations and then re-export documentable members.
|
|
2
|
+
import './react.docs.js';
|
|
3
|
+
export * from './react.docs.js';
|
|
4
|
+
|
|
5
|
+
// Types
|
|
6
|
+
export type {
|
|
7
|
+
Attributes,
|
|
8
|
+
CElement,
|
|
9
|
+
CFactory,
|
|
10
|
+
ChildContextProvider,
|
|
11
|
+
ClassAttributes,
|
|
12
|
+
ClassType,
|
|
13
|
+
ClassicComponent,
|
|
14
|
+
ClassicComponentClass,
|
|
15
|
+
ClassicElement,
|
|
16
|
+
ClassicFactory,
|
|
17
|
+
ComponentClass,
|
|
18
|
+
ComponentElement,
|
|
19
|
+
ComponentFactory,
|
|
20
|
+
ComponentLifecycle,
|
|
21
|
+
ComponentProps,
|
|
22
|
+
ComponentPropsWithRef,
|
|
23
|
+
ComponentPropsWithoutRef,
|
|
24
|
+
ComponentRef,
|
|
25
|
+
ComponentSpec,
|
|
26
|
+
ComponentState,
|
|
27
|
+
ComponentType,
|
|
28
|
+
Consumer,
|
|
29
|
+
ConsumerProps,
|
|
30
|
+
Context,
|
|
31
|
+
ContextType,
|
|
32
|
+
CustomComponentPropsWithRef,
|
|
33
|
+
DependencyList,
|
|
34
|
+
DeprecatedLifecycle,
|
|
35
|
+
Dispatch,
|
|
36
|
+
DispatchWithoutAction,
|
|
37
|
+
EffectCallback,
|
|
38
|
+
ElementRef,
|
|
39
|
+
ElementType,
|
|
40
|
+
ExoticComponent,
|
|
41
|
+
FC,
|
|
42
|
+
Factory,
|
|
43
|
+
ForwardRefExoticComponent,
|
|
44
|
+
ForwardRefRenderFunction,
|
|
45
|
+
ForwardedRef,
|
|
46
|
+
FunctionComponent,
|
|
47
|
+
FunctionComponentElement,
|
|
48
|
+
FunctionComponentFactory,
|
|
49
|
+
GetDerivedStateFromError,
|
|
50
|
+
GetDerivedStateFromProps,
|
|
51
|
+
JSXElementConstructor,
|
|
52
|
+
Key,
|
|
53
|
+
LazyExoticComponent,
|
|
54
|
+
LegacyRef,
|
|
55
|
+
MemoExoticComponent,
|
|
56
|
+
Mixin,
|
|
57
|
+
MutableRefObject,
|
|
58
|
+
NamedExoticComponent,
|
|
59
|
+
NewLifecycle,
|
|
60
|
+
PropsWithChildren,
|
|
61
|
+
PropsWithRef,
|
|
62
|
+
PropsWithoutRef,
|
|
63
|
+
Provider,
|
|
64
|
+
ProviderExoticComponent,
|
|
65
|
+
ProviderProps,
|
|
66
|
+
ReactComponentElement,
|
|
67
|
+
ReactElement,
|
|
68
|
+
ReactInstance,
|
|
69
|
+
ReactNode,
|
|
70
|
+
Reducer,
|
|
71
|
+
ReducerAction,
|
|
72
|
+
ReducerState,
|
|
73
|
+
ReducerStateWithoutAction,
|
|
74
|
+
ReducerWithoutAction,
|
|
75
|
+
Ref,
|
|
76
|
+
RefAttributes,
|
|
77
|
+
RefCallback,
|
|
78
|
+
RefObject,
|
|
79
|
+
SFCFactory,
|
|
80
|
+
SVGFactory,
|
|
81
|
+
SetStateAction,
|
|
82
|
+
StaticLifecycle,
|
|
83
|
+
TransitionFunction,
|
|
84
|
+
TransitionStartFunction,
|
|
85
|
+
VFC,
|
|
86
|
+
VoidFunctionComponent,
|
|
87
|
+
} from 'react';
|
|
88
|
+
|
|
89
|
+
import type { MainThread, NodesRef } from '@lynx-js/types';
|
|
90
|
+
import type { Key, ReactNode, Ref } from 'react';
|
|
91
|
+
|
|
92
|
+
import type { Lynx as LynxExtended } from './react.docs.js';
|
|
93
|
+
|
|
94
|
+
declare module '@lynx-js/types' {
|
|
95
|
+
interface StandardProps {
|
|
96
|
+
children?: ReactNode;
|
|
97
|
+
ref?: Ref<NodesRef>;
|
|
98
|
+
key?: Key;
|
|
99
|
+
'main-thread:ref'?: Ref<MainThread.Element>;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
interface Lynx extends LynxExtended {
|
|
103
|
+
/**
|
|
104
|
+
* Select the first element matching the given CSS selector in the page.
|
|
105
|
+
* @param selector - CSS Selector string.
|
|
106
|
+
* @public
|
|
107
|
+
*/
|
|
108
|
+
querySelector: (selector: string) => MainThread.Element | null;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Select all the elements matching the given CSS selector in the page.
|
|
112
|
+
* @param selector - CSS Selector string.
|
|
113
|
+
* @public
|
|
114
|
+
*/
|
|
115
|
+
querySelectorAll: (selector: string) => MainThread.Element[];
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface ListItemProps {
|
|
119
|
+
/**
|
|
120
|
+
* Control (mainly reduce) the reuse behavior of `<list-item />`
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
*
|
|
124
|
+
* Avoid unexpected reuse.
|
|
125
|
+
*
|
|
126
|
+
* ```tsx
|
|
127
|
+
* {[1, "2", 3].map((item) => {
|
|
128
|
+
* return (
|
|
129
|
+
* <list-item key={item} item-key={item} reuse-identifier={typeof item}>
|
|
130
|
+
* <text>{item}</text>
|
|
131
|
+
* </list-item>
|
|
132
|
+
* );
|
|
133
|
+
* })}
|
|
134
|
+
* ```
|
|
135
|
+
*
|
|
136
|
+
* When `<list-item />` is returned from the array `.map()`,
|
|
137
|
+
* since they have the same form and position at the compile stage,
|
|
138
|
+
* we will generate the same reuse-identifier for them,
|
|
139
|
+
* and we will think that this group of `<list-item />` can be reused with each other.
|
|
140
|
+
* Explicitly specifying the reuse-identifier can avoid some unexpected reuse.
|
|
141
|
+
* For example, in the above code, if we do not want numbers and strings to be reused with each other,
|
|
142
|
+
* we can use typeof item as the reuse-identifier.
|
|
143
|
+
* By default, the developer does not provide a reuse-identifier, which is determined by the framework at the compile stage.
|
|
144
|
+
*/
|
|
145
|
+
'reuse-identifier'?: Key;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Copyright 2024 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
declare global {
|
|
5
|
+
/**
|
|
6
|
+
* Determines if code should be placed in the background thread, used as a compile-time define macro
|
|
7
|
+
*
|
|
8
|
+
* @deprecated use `__BACKGROUND__` instead
|
|
9
|
+
*/
|
|
10
|
+
let __JS__: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Determines if code should be placed in the background thread, used as a compile-time define macro
|
|
13
|
+
*/
|
|
14
|
+
let __BACKGROUND__: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Determines if code should be placed in the main thread, used as a compile-time define macro
|
|
17
|
+
*
|
|
18
|
+
* @deprecated use `__MAIN_THREAD__` instead
|
|
19
|
+
*/
|
|
20
|
+
let __LEPUS__: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Determines if code should be placed in the main thread, used as a compile-time define macro
|
|
23
|
+
*/
|
|
24
|
+
let __MAIN_THREAD__: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Determines if running in dev mode
|
|
27
|
+
*/
|
|
28
|
+
let __DEV__: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Determines if running in profile mode
|
|
31
|
+
*/
|
|
32
|
+
let __PROFILE__: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Built-in React Hooks
|
|
37
|
+
* @see https://react.dev/reference/react/hooks
|
|
38
|
+
*/
|
|
39
|
+
export {
|
|
40
|
+
useCallback,
|
|
41
|
+
useContext,
|
|
42
|
+
useDebugValue,
|
|
43
|
+
useImperativeHandle,
|
|
44
|
+
useMemo,
|
|
45
|
+
useReducer,
|
|
46
|
+
useRef,
|
|
47
|
+
useState,
|
|
48
|
+
useSyncExternalStore,
|
|
49
|
+
} from 'react';
|
|
50
|
+
|
|
51
|
+
export { useEffect, useLayoutEffect } from '../runtime/lib/hooks/react.js';
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Built-in React APIs
|
|
55
|
+
* @see https://react.dev/reference/react/apis
|
|
56
|
+
*/
|
|
57
|
+
export { createContext, forwardRef, lazy, memo } from 'react';
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Built-in React Components
|
|
61
|
+
* @see https://react.dev/reference/react/components
|
|
62
|
+
*/
|
|
63
|
+
export { Fragment, Suspense } from 'react';
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Legacy React APIs
|
|
67
|
+
* @see https://react.dev/reference/react/legacy
|
|
68
|
+
*/
|
|
69
|
+
export { Component, PureComponent, createElement, createRef, isValidElement } from 'react';
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* RL-defined Lynx APIs
|
|
73
|
+
*/
|
|
74
|
+
export * from '../runtime/lib/lynx-api.js';
|