@lynx-js/react 0.122.1 → 0.123.1
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 +88 -0
- package/components/lib/DeferredListItem.d.ts +8 -2
- package/components/lib/DeferredListItem.jsx.map +1 -1
- package/components/lib/Page.js +1 -1
- package/components/lib/Page.js.map +1 -1
- package/components/src/DeferredListItem.tsx +7 -2
- package/components/src/Page.ts +1 -1
- package/package.json +4 -4
- package/refresh/dist/index.js +4 -2
- package/runtime/lazy/compat.js +1 -0
- package/runtime/lazy/react.js +1 -0
- package/runtime/lib/core/lynx/dynamic-import.d.ts +1 -0
- package/runtime/lib/core/lynx/dynamic-import.js +3 -2
- package/runtime/lib/core/lynx/dynamic-import.js.map +1 -1
- package/runtime/lib/core/lynx/lazy-bundle.d.ts +7 -1
- package/runtime/lib/core/lynx/lazy-bundle.js +182 -3
- package/runtime/lib/core/lynx/lazy-bundle.js.map +1 -1
- package/runtime/lib/core/lynx-data-processors.d.ts +1 -0
- package/runtime/lib/core/lynx-data-processors.js +19 -1
- package/runtime/lib/core/lynx-data-processors.js.map +1 -1
- package/runtime/lib/index.d.ts +1 -0
- package/runtime/lib/index.js.map +1 -1
- package/runtime/lib/internal.js +9 -0
- package/runtime/lib/internal.js.map +1 -1
- package/runtime/lib/lynx-api.d.ts +19 -0
- package/runtime/lib/lynx-api.js +38 -5
- package/runtime/lib/lynx-api.js.map +1 -1
- package/runtime/lib/lynx.js +5 -0
- package/runtime/lib/lynx.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/constant.d.ts +3 -2
- package/runtime/lib/snapshot/lifecycle/constant.js +4 -1
- package/runtime/lib/snapshot/lifecycle/constant.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/event/firstScreenSync.d.ts +9 -0
- package/runtime/lib/snapshot/lifecycle/event/firstScreenSync.js +80 -0
- package/runtime/lib/snapshot/lifecycle/event/firstScreenSync.js.map +1 -0
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatchApply.js +5 -4
- package/runtime/lib/snapshot/lifecycle/patch/snapshotPatchApply.js.map +1 -1
- package/runtime/lib/snapshot/lifecycle/reload.js +3 -3
- package/runtime/lib/snapshot/lifecycle/reload.js.map +1 -1
- package/runtime/lib/snapshot/list/listUpdateInfo.js +8 -0
- package/runtime/lib/snapshot/list/listUpdateInfo.js.map +1 -1
- package/runtime/lib/snapshot/lynx/calledByNative.js +20 -9
- package/runtime/lib/snapshot/lynx/calledByNative.js.map +1 -1
- package/runtime/lib/snapshot/lynx/element.d.ts +28 -5
- package/runtime/lib/snapshot/lynx/element.js +9 -5
- package/runtime/lib/snapshot/lynx/element.js.map +1 -1
- package/runtime/lib/snapshot/lynx/injectLepusMethods.js +1 -1
- package/runtime/lib/snapshot/lynx/injectLepusMethods.js.map +1 -1
- package/runtime/lib/snapshot/lynx/lazyBundleConstants.d.ts +4 -0
- package/runtime/lib/snapshot/lynx/lazyBundleConstants.js +8 -0
- package/runtime/lib/snapshot/lynx/lazyBundleConstants.js.map +1 -0
- package/runtime/lib/snapshot/lynx/prepareLazyBundleMTS.d.ts +1 -0
- package/runtime/lib/snapshot/lynx/prepareLazyBundleMTS.js +60 -0
- package/runtime/lib/snapshot/lynx/prepareLazyBundleMTS.js.map +1 -0
- package/runtime/lib/snapshot/lynx/tt.js +3 -3
- package/runtime/lib/snapshot/lynx/tt.js.map +1 -1
- package/runtime/lib/snapshot/renderToOpcodes/hydrate.js +7 -0
- package/runtime/lib/snapshot/renderToOpcodes/hydrate.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js +5 -2
- package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/definition.js +4 -4
- package/runtime/lib/snapshot/snapshot/definition.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/list.js +8 -1
- package/runtime/lib/snapshot/snapshot/list.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/platformInfo.d.ts +3 -1
- package/runtime/lib/snapshot/snapshot/platformInfo.js +21 -2
- package/runtime/lib/snapshot/snapshot/platformInfo.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/snapshot.d.ts +2 -5
- package/runtime/lib/snapshot/snapshot/snapshot.js +14 -16
- package/runtime/lib/snapshot/snapshot/snapshot.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/snapshotCreatorMap.d.ts +16 -1
- package/runtime/lib/snapshot/snapshot/snapshotCreatorMap.js +8 -0
- package/runtime/lib/snapshot/snapshot/snapshotCreatorMap.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/snapshotInstanceManager.d.ts +6 -0
- package/runtime/lib/snapshot/snapshot/snapshotInstanceManager.js +16 -0
- package/runtime/lib/snapshot/snapshot/snapshotInstanceManager.js.map +1 -0
- package/runtime/lib/snapshot/snapshot/spread.d.ts +1 -1
- package/runtime/lib/snapshot/snapshot/spread.js +11 -5
- package/runtime/lib/snapshot/snapshot/spread.js.map +1 -1
- package/runtime/lib/tsconfig.tsbuildinfo +1 -1
- package/testing-library/dist/0-@rstest/adapter-rsbuild.js +95 -0
- package/testing-library/dist/index.d.ts +2 -2
- package/testing-library/dist/pure.js +1 -1
- package/testing-library/dist/rstest-config.js +1 -1
- package/transform/dist/wasm.cjs +333 -126
- package/transform/index.d.ts +40 -0
- package/types/react.docs.d.ts +28 -2
- package/runtime/lib/snapshot/lifecycle/event/jsReady.d.ts +0 -6
- package/runtime/lib/snapshot/lifecycle/event/jsReady.js +0 -44
- package/runtime/lib/snapshot/lifecycle/event/jsReady.js.map +0 -1
- package/testing-library/dist/0~@rstest/adapter-rsbuild.js +0 -43
- /package/testing-library/dist/{0~rslib-runtime.js → 0-rslib-runtime.js} +0 -0
package/transform/index.d.ts
CHANGED
|
@@ -362,6 +362,40 @@ export interface CompatVisitorConfig {
|
|
|
362
362
|
* ```
|
|
363
363
|
*/
|
|
364
364
|
darkMode?: boolean | DarkModeConfig
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Compile dynamic children as children + wrapper (the pre-SlotV2 slot
|
|
368
|
+
* codegen: `Slot`/`Children` dynamic parts rendered through wrapper
|
|
369
|
+
* elements) instead of the default SlotV2 codegen (`$N` slot props).
|
|
370
|
+
*
|
|
371
|
+
* @remarks
|
|
372
|
+
*
|
|
373
|
+
* Enable this when the compiled output needs to run on legacy
|
|
374
|
+
* `@lynx-js/react` runtimes without `SlotV2` support (`< 0.120.0`),
|
|
375
|
+
* e.g. a standalone lazy bundle consumed by a host App that ships an
|
|
376
|
+
* older runtime. It only changes the compile output; the runtime
|
|
377
|
+
* supports both forms.
|
|
378
|
+
*
|
|
379
|
+
* @example
|
|
380
|
+
*
|
|
381
|
+
* ```js
|
|
382
|
+
* import { defineConfig } from '@lynx-js/rspeedy'
|
|
383
|
+
* import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
|
|
384
|
+
*
|
|
385
|
+
* export default defineConfig({
|
|
386
|
+
* plugins: [
|
|
387
|
+
* pluginReactLynx({
|
|
388
|
+
* compat: {
|
|
389
|
+
* legacySlot: true,
|
|
390
|
+
* },
|
|
391
|
+
* })
|
|
392
|
+
* ],
|
|
393
|
+
* })
|
|
394
|
+
* ```
|
|
395
|
+
*
|
|
396
|
+
* @defaultValue `false`
|
|
397
|
+
*/
|
|
398
|
+
legacySlot?: boolean
|
|
365
399
|
}
|
|
366
400
|
export interface CssScopeVisitorConfig {
|
|
367
401
|
/** @public */
|
|
@@ -598,6 +632,10 @@ export interface JsxTransformerConfig {
|
|
|
598
632
|
enableUiSourceMap?: boolean
|
|
599
633
|
/** @internal */
|
|
600
634
|
isDynamicComponent?: boolean
|
|
635
|
+
/** @internal */
|
|
636
|
+
isExternalBundle?: boolean
|
|
637
|
+
/** @internal */
|
|
638
|
+
legacySlot?: boolean
|
|
601
639
|
}
|
|
602
640
|
/** @internal */
|
|
603
641
|
export interface ElementTemplateConfig {
|
|
@@ -613,6 +651,8 @@ export interface ElementTemplateConfig {
|
|
|
613
651
|
target: 'LEPUS' | 'JS' | 'MIXED'
|
|
614
652
|
/** @internal */
|
|
615
653
|
isDynamicComponent?: boolean
|
|
654
|
+
/** @internal */
|
|
655
|
+
isExternalBundle?: boolean
|
|
616
656
|
}
|
|
617
657
|
export interface WorkletVisitorConfig {
|
|
618
658
|
/**
|
package/types/react.docs.d.ts
CHANGED
|
@@ -40,6 +40,12 @@ declare global {
|
|
|
40
40
|
* environment variable `REACT_DEVTOOL=true`.
|
|
41
41
|
*/
|
|
42
42
|
let __REACT_DEVTOOL__: boolean | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Which lazy bundle fetcher the build is wired up to. `'FetchBundle'`
|
|
45
|
+
* enables the `lynx.fetchBundle`-based path (and `import(..., { with: { mode } })`
|
|
46
|
+
* mode hints); `'QueryComponent'` is the legacy `lynx.QueryComponent` path.
|
|
47
|
+
*/
|
|
48
|
+
let __LAZY_BUNDLE_FETCHER__: 'FetchBundle' | 'QueryComponent';
|
|
43
49
|
}
|
|
44
50
|
|
|
45
51
|
/**
|
|
@@ -76,9 +82,9 @@ export { Fragment, Suspense } from 'react';
|
|
|
76
82
|
* Legacy React APIs
|
|
77
83
|
* @see https://react.dev/reference/react/legacy
|
|
78
84
|
*/
|
|
79
|
-
export { Component, PureComponent,
|
|
85
|
+
export { Component, PureComponent, createRef, isValidElement } from 'react';
|
|
80
86
|
|
|
81
|
-
export type { ReactLynxChildren } from '../runtime/lib/index.js';
|
|
87
|
+
export type { CloneElement, CreateElement, ReactLynxChildren } from '../runtime/lib/index.js';
|
|
82
88
|
|
|
83
89
|
/**
|
|
84
90
|
* ReactLynx children utilities.
|
|
@@ -97,6 +103,26 @@ export const Children: ReactLynxChildren;
|
|
|
97
103
|
*/
|
|
98
104
|
export { createPortal } from '../runtime/lib/index.js';
|
|
99
105
|
|
|
106
|
+
/**
|
|
107
|
+
* Creates a ReactLynx element from a Lynx intrinsic element name or a
|
|
108
|
+
* component type. Lynx intrinsic elements are processed by the ReactLynx
|
|
109
|
+
* snapshot runtime.
|
|
110
|
+
*
|
|
111
|
+
* @see https://react.dev/reference/react/createElement
|
|
112
|
+
* @public
|
|
113
|
+
*/
|
|
114
|
+
export { createElement } from '../runtime/lib/index.js';
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Clones an existing ReactLynx element and applies new props through the
|
|
118
|
+
* ReactLynx runtime. Runtime-created elements and components may also receive
|
|
119
|
+
* replacement children.
|
|
120
|
+
*
|
|
121
|
+
* @see https://react.dev/reference/react/cloneElement
|
|
122
|
+
* @public
|
|
123
|
+
*/
|
|
124
|
+
export { cloneElement } from '../runtime/lib/index.js';
|
|
125
|
+
|
|
100
126
|
/**
|
|
101
127
|
* RL-defined Lynx APIs
|
|
102
128
|
*/
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
// Copyright 2025 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 { __root } from '../../../root.js';
|
|
5
|
-
import { profileEnd, profileStart } from '../../../shared/profile.js';
|
|
6
|
-
import { LifecycleConstant } from '../../lifecycle/constant.js';
|
|
7
|
-
let isJSReady;
|
|
8
|
-
let jsReadyEventIdSwap;
|
|
9
|
-
function jsReady() {
|
|
10
|
-
isJSReady = true;
|
|
11
|
-
if (typeof __PROFILE__ !== 'undefined' && __PROFILE__) {
|
|
12
|
-
profileStart('ReactLynx::serializeRoot');
|
|
13
|
-
}
|
|
14
|
-
const root = JSON.stringify(__root);
|
|
15
|
-
if (typeof __PROFILE__ !== 'undefined' && __PROFILE__) {
|
|
16
|
-
profileEnd();
|
|
17
|
-
}
|
|
18
|
-
if (typeof __PROFILE__ !== 'undefined' && __PROFILE__) {
|
|
19
|
-
profileStart('ReactLynx::transferRoot');
|
|
20
|
-
}
|
|
21
|
-
__OnLifecycleEvent([
|
|
22
|
-
LifecycleConstant.firstScreen, /* FIRST_SCREEN */
|
|
23
|
-
{
|
|
24
|
-
root,
|
|
25
|
-
jsReadyEventIdSwap,
|
|
26
|
-
},
|
|
27
|
-
]);
|
|
28
|
-
if (typeof __PROFILE__ !== 'undefined' && __PROFILE__) {
|
|
29
|
-
profileEnd();
|
|
30
|
-
}
|
|
31
|
-
jsReadyEventIdSwap = {};
|
|
32
|
-
}
|
|
33
|
-
function clearJSReadyEventIdSwap() {
|
|
34
|
-
jsReadyEventIdSwap = {};
|
|
35
|
-
}
|
|
36
|
-
function resetJSReady() {
|
|
37
|
-
isJSReady = false;
|
|
38
|
-
jsReadyEventIdSwap = {};
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* @internal
|
|
42
|
-
*/
|
|
43
|
-
export { jsReady, isJSReady, jsReadyEventIdSwap, clearJSReadyEventIdSwap, resetJSReady };
|
|
44
|
-
//# sourceMappingURL=jsReady.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsReady.js","sourceRoot":"","sources":["../../../../src/snapshot/lifecycle/event/jsReady.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,IAAI,SAAkB,CAAC;AACvB,IAAI,kBAAmD,CAAC;AAExD,SAAS,OAAO;IACd,SAAS,GAAG,IAAI,CAAC;IAEjB,IAAI,OAAO,WAAW,KAAK,WAAW,IAAI,WAAW,EAAE,CAAC;QACtD,YAAY,CAAC,0BAA0B,CAAC,CAAC;IAC3C,CAAC;IACD,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,OAAO,WAAW,KAAK,WAAW,IAAI,WAAW,EAAE,CAAC;QACtD,UAAU,EAAE,CAAC;IACf,CAAC;IACD,IAAI,OAAO,WAAW,KAAK,WAAW,IAAI,WAAW,EAAE,CAAC;QACtD,YAAY,CAAC,yBAAyB,CAAC,CAAC;IAC1C,CAAC;IACD,kBAAkB,CAAC;QACjB,iBAAiB,CAAC,WAAW,EAAE,kBAAkB;QACjD;YACE,IAAI;YACJ,kBAAkB;SACnB;KACF,CAAC,CAAC;IACH,IAAI,OAAO,WAAW,KAAK,WAAW,IAAI,WAAW,EAAE,CAAC;QACtD,UAAU,EAAE,CAAC;IACf,CAAC;IACD,kBAAkB,GAAG,EAAE,CAAC;AAC1B,CAAC;AAED,SAAS,uBAAuB;IAC9B,kBAAkB,GAAG,EAAE,CAAC;AAC1B,CAAC;AAED,SAAS,YAAY;IACnB,SAAS,GAAG,KAAK,CAAC;IAClB,kBAAkB,GAAG,EAAE,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { mergeRsbuildConfig } from "@rsbuild/core";
|
|
2
|
-
function toRstestConfig({ environmentName, rsbuildConfig: rawRsbuildConfig, modifyRsbuildConfig }) {
|
|
3
|
-
const { environments, ...rawBuildConfig } = rawRsbuildConfig;
|
|
4
|
-
const environmentConfig = environmentName ? environments?.[environmentName] : void 0;
|
|
5
|
-
const rsbuildConfig = environmentConfig ? mergeRsbuildConfig(rawBuildConfig, environmentConfig) : rawBuildConfig;
|
|
6
|
-
const finalBuildConfig = modifyRsbuildConfig ? modifyRsbuildConfig(rsbuildConfig) : rsbuildConfig;
|
|
7
|
-
const { rspack, swc, bundlerChain } = finalBuildConfig.tools || {};
|
|
8
|
-
const { cssModules, target, module } = finalBuildConfig.output || {};
|
|
9
|
-
const { decorators, define, include, exclude, tsconfigPath } = finalBuildConfig.source || {};
|
|
10
|
-
return {
|
|
11
|
-
root: finalBuildConfig.root,
|
|
12
|
-
name: environmentName,
|
|
13
|
-
plugins: [
|
|
14
|
-
...finalBuildConfig.plugins || [],
|
|
15
|
-
{
|
|
16
|
-
name: 'remove-useless-plugins',
|
|
17
|
-
remove: [
|
|
18
|
-
'rsbuild:type-check'
|
|
19
|
-
],
|
|
20
|
-
setup: ()=>{}
|
|
21
|
-
}
|
|
22
|
-
],
|
|
23
|
-
source: {
|
|
24
|
-
decorators,
|
|
25
|
-
define,
|
|
26
|
-
include,
|
|
27
|
-
exclude,
|
|
28
|
-
tsconfigPath
|
|
29
|
-
},
|
|
30
|
-
resolve: finalBuildConfig.resolve,
|
|
31
|
-
output: {
|
|
32
|
-
cssModules,
|
|
33
|
-
module
|
|
34
|
-
},
|
|
35
|
-
tools: {
|
|
36
|
-
rspack,
|
|
37
|
-
swc,
|
|
38
|
-
bundlerChain
|
|
39
|
-
},
|
|
40
|
-
testEnvironment: 'node' === target ? 'node' : 'happy-dom'
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
export { toRstestConfig };
|
|
File without changes
|