@lynx-js/react 0.122.0 → 0.123.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 +99 -0
- package/components/lib/DeferredListItem.jsx +4 -3
- 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 -4
- package/components/src/Page.ts +1 -1
- package/package.json +1 -1
- package/runtime/lazy/compat.js +1 -0
- package/runtime/lazy/internal.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/element-template/background/hydration-listener.js +91 -84
- package/runtime/lib/element-template/background/hydration-listener.js.map +1 -1
- package/runtime/lib/element-template/protocol/types.d.ts +1 -1
- package/runtime/lib/index.d.ts +2 -2
- package/runtime/lib/index.js +3 -2
- package/runtime/lib/index.js.map +1 -1
- package/runtime/lib/internal.d.ts +2 -0
- package/runtime/lib/internal.js +11 -1
- 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 +9 -1
- 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 +5 -0
- package/runtime/lib/snapshot/lynx/element.js +100 -10
- 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.d.ts +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.d.ts +4 -0
- package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js +35 -6
- package/runtime/lib/snapshot/snapshot/backgroundSnapshot.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/constants.d.ts +4 -0
- package/runtime/lib/snapshot/snapshot/constants.js +4 -0
- package/runtime/lib/snapshot/snapshot/constants.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/definition.d.ts +1 -0
- package/runtime/lib/snapshot/snapshot/definition.js +44 -2
- package/runtime/lib/snapshot/snapshot/definition.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 +5 -6
- package/runtime/lib/snapshot/snapshot/snapshot.js +42 -19
- package/runtime/lib/snapshot/snapshot/snapshot.js.map +1 -1
- package/runtime/lib/snapshot/snapshot/snapshotCreatorMap.d.ts +19 -0
- package/runtime/lib/snapshot/snapshot/snapshotCreatorMap.js +16 -0
- package/runtime/lib/snapshot/snapshot/snapshotCreatorMap.js.map +1 -0
- 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/snapshot/snapshot/types.d.ts +2 -0
- package/runtime/lib/snapshot/snapshot/utils.d.ts +6 -0
- package/runtime/lib/snapshot/snapshot/utils.js +19 -1
- package/runtime/lib/snapshot/snapshot/utils.js.map +1 -1
- package/runtime/lib/tsconfig.tsbuildinfo +1 -1
- package/testing-library/dist/0~@rstest/adapter-rsbuild.js +59 -7
- package/transform/dist/wasm.cjs +332 -125
- package/transform/index.d.ts +40 -0
- package/types/react.docs.d.ts +13 -0
- 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
|
@@ -1,19 +1,60 @@
|
|
|
1
|
+
import { dirname, isAbsolute as external_node_path_isAbsolute, normalize, resolve } from "node:path";
|
|
1
2
|
import { mergeRsbuildConfig } from "@rsbuild/core";
|
|
2
|
-
|
|
3
|
+
import "node:module";
|
|
4
|
+
const resolveCacheDependency = ({ dependency, configPath, root })=>{
|
|
5
|
+
if (external_node_path_isAbsolute(dependency)) return normalize(dependency);
|
|
6
|
+
if (configPath) return normalize(resolve(dirname(configPath), dependency));
|
|
7
|
+
return root ? normalize(resolve(root, dependency)) : dependency;
|
|
8
|
+
};
|
|
9
|
+
const resolveBuildCache = ({ buildCache, configPath, root })=>{
|
|
10
|
+
if (void 0 === buildCache) return;
|
|
11
|
+
if (false === buildCache) return false;
|
|
12
|
+
if (true === buildCache) return configPath ? {
|
|
13
|
+
buildDependencies: [
|
|
14
|
+
normalize(configPath)
|
|
15
|
+
]
|
|
16
|
+
} : true;
|
|
17
|
+
const buildDependencies = buildCache.buildDependencies?.map((dependency)=>resolveCacheDependency({
|
|
18
|
+
dependency,
|
|
19
|
+
configPath,
|
|
20
|
+
root
|
|
21
|
+
}));
|
|
22
|
+
const nextBuildDependencies = configPath ? Array.from(new Set([
|
|
23
|
+
...buildDependencies || [],
|
|
24
|
+
normalize(configPath)
|
|
25
|
+
])) : buildDependencies;
|
|
26
|
+
return {
|
|
27
|
+
cacheDirectory: buildCache.cacheDirectory,
|
|
28
|
+
cacheDigest: buildCache.cacheDigest,
|
|
29
|
+
buildDependencies: nextBuildDependencies
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
const isNodeTarget = (target)=>{
|
|
33
|
+
const targets = Array.isArray(target) ? target.filter(Boolean) : 'string' == typeof target ? [
|
|
34
|
+
target
|
|
35
|
+
] : [];
|
|
36
|
+
return targets.some((t)=>'async-node' === t || t.startsWith('node'));
|
|
37
|
+
};
|
|
38
|
+
const resolveTestEnvironmentFromTarget = (target)=>isNodeTarget(target) ? 'node' : 'happy-dom';
|
|
39
|
+
function toRstestConfig({ configPath, environmentName, rsbuildConfig: rawRsbuildConfig, modifyRsbuildConfig }) {
|
|
3
40
|
const { environments, ...rawBuildConfig } = rawRsbuildConfig;
|
|
4
41
|
const environmentConfig = environmentName ? environments?.[environmentName] : void 0;
|
|
5
42
|
const rsbuildConfig = environmentConfig ? mergeRsbuildConfig(rawBuildConfig, environmentConfig) : rawBuildConfig;
|
|
6
43
|
const finalBuildConfig = modifyRsbuildConfig ? modifyRsbuildConfig(rsbuildConfig) : rsbuildConfig;
|
|
7
44
|
const { rspack, swc, bundlerChain } = finalBuildConfig.tools || {};
|
|
8
|
-
const {
|
|
9
|
-
const {
|
|
10
|
-
|
|
45
|
+
const { buildCache } = finalBuildConfig.performance || {};
|
|
46
|
+
const { cssModules, emitAssets, target, module } = finalBuildConfig.output || {};
|
|
47
|
+
const { assetsInclude, decorators, define, include, exclude, tsconfigPath, transformImport } = finalBuildConfig.source || {};
|
|
48
|
+
const rstestConfig = {
|
|
11
49
|
root: finalBuildConfig.root,
|
|
12
50
|
name: environmentName,
|
|
51
|
+
forceRerunTriggers: configPath ? [
|
|
52
|
+
normalize(configPath)
|
|
53
|
+
] : void 0,
|
|
13
54
|
plugins: [
|
|
14
55
|
...finalBuildConfig.plugins || [],
|
|
15
56
|
{
|
|
16
|
-
name: 'remove-useless-plugins',
|
|
57
|
+
name: 'rsbuild-adapter:remove-useless-plugins',
|
|
17
58
|
remove: [
|
|
18
59
|
'rsbuild:type-check'
|
|
19
60
|
],
|
|
@@ -21,23 +62,34 @@ function toRstestConfig({ environmentName, rsbuildConfig: rawRsbuildConfig, modi
|
|
|
21
62
|
}
|
|
22
63
|
],
|
|
23
64
|
source: {
|
|
65
|
+
assetsInclude,
|
|
24
66
|
decorators,
|
|
25
67
|
define,
|
|
26
68
|
include,
|
|
27
69
|
exclude,
|
|
28
|
-
tsconfigPath
|
|
70
|
+
tsconfigPath,
|
|
71
|
+
transformImport
|
|
29
72
|
},
|
|
30
73
|
resolve: finalBuildConfig.resolve,
|
|
31
74
|
output: {
|
|
32
75
|
cssModules,
|
|
76
|
+
emitAssets,
|
|
33
77
|
module
|
|
34
78
|
},
|
|
79
|
+
performance: {
|
|
80
|
+
buildCache: resolveBuildCache({
|
|
81
|
+
buildCache,
|
|
82
|
+
configPath,
|
|
83
|
+
root: finalBuildConfig.root
|
|
84
|
+
})
|
|
85
|
+
},
|
|
35
86
|
tools: {
|
|
36
87
|
rspack,
|
|
37
88
|
swc,
|
|
38
89
|
bundlerChain
|
|
39
90
|
},
|
|
40
|
-
testEnvironment:
|
|
91
|
+
testEnvironment: resolveTestEnvironmentFromTarget(target)
|
|
41
92
|
};
|
|
93
|
+
return rstestConfig;
|
|
42
94
|
}
|
|
43
95
|
export { toRstestConfig };
|