@lynx-js/react-rsbuild-plugin 0.19.0 → 0.19.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 +20 -0
- package/dist/index.js +27 -3
- package/package.json +9 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @lynx-js/react-rsbuild-plugin
|
|
2
2
|
|
|
3
|
+
## 0.19.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Apply the Lynx build engine automatically when it is not already applied, so `pluginReactLynx` works with plain Rsbuild. ([#3578](https://github.com/lynx-family/lynx-stack/pull/3578))
|
|
8
|
+
|
|
9
|
+
- Read the bundle filename from the Rsbuild config instead of the Rspeedy API. ([#3570](https://github.com/lynx-family/lynx-stack/pull/3570))
|
|
10
|
+
|
|
11
|
+
- Emit the Lynx template for callers other than `rslib` and `rstest`. ([#3572](https://github.com/lynx-family/lynx-stack/pull/3572))
|
|
12
|
+
|
|
13
|
+
- Widen the `@lynx-js/react` peer dependency range to include 0.125. ([#3551](https://github.com/lynx-family/lynx-stack/pull/3551))
|
|
14
|
+
- Updated dependencies [[`1d08862`](https://github.com/lynx-family/lynx-stack/commit/1d08862ef9a1883fe98f2b9f7dce59d092d14d68), [`99ed745`](https://github.com/lynx-family/lynx-stack/commit/99ed7451d190cd18a45f78f731141994104a054b), [`0d10b79`](https://github.com/lynx-family/lynx-stack/commit/0d10b796d219e6f661709885d9ff2a4e61f4e65b), [`0d10b79`](https://github.com/lynx-family/lynx-stack/commit/0d10b796d219e6f661709885d9ff2a4e61f4e65b), [`0d10b79`](https://github.com/lynx-family/lynx-stack/commit/0d10b796d219e6f661709885d9ff2a4e61f4e65b), [`0d10b79`](https://github.com/lynx-family/lynx-stack/commit/0d10b796d219e6f661709885d9ff2a4e61f4e65b), [`92b54ed`](https://github.com/lynx-family/lynx-stack/commit/92b54edba5adea2a4ddd355c821ff25205273479), [`37497d5`](https://github.com/lynx-family/lynx-stack/commit/37497d58fe4e0762d687001d61181ec5e0e650b9)]:
|
|
15
|
+
- @lynx-js/react-webpack-plugin@0.11.1
|
|
16
|
+
- @lynx-js/rsbuild-plugin@0.0.3
|
|
17
|
+
- @lynx-js/react-alias-rsbuild-plugin@0.19.1
|
|
18
|
+
- @lynx-js/use-sync-external-store@1.5.0
|
|
19
|
+
- @lynx-js/react-refresh-webpack-plugin@0.4.2
|
|
20
|
+
- @lynx-js/css-extract-webpack-plugin@0.10.1
|
|
21
|
+
- @lynx-js/template-webpack-plugin@0.15.2
|
|
22
|
+
|
|
3
23
|
## 0.19.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|
package/dist/index.js
CHANGED
|
@@ -2,10 +2,32 @@ import { createRequire } from "node:module";
|
|
|
2
2
|
import { pluginReactAlias } from "@lynx-js/react-alias-rsbuild-plugin";
|
|
3
3
|
import { LAYERS, ReactWebpackPlugin } from "@lynx-js/react-webpack-plugin";
|
|
4
4
|
import { LynxEncodePlugin, LynxTemplatePlugin, WebEncodePlugin } from "@lynx-js/template-webpack-plugin";
|
|
5
|
+
import { PLUGIN_LYNX_NAME, pluginLynx } from "@lynx-js/rsbuild-plugin";
|
|
5
6
|
import node_path from "node:path";
|
|
6
7
|
import { fileURLToPath } from "node:url";
|
|
7
8
|
import { RuntimeWrapperWebpackPlugin } from "@lynx-js/runtime-wrapper-webpack-plugin";
|
|
8
9
|
import { ReactRefreshRspackPlugin } from "@lynx-js/react-refresh-webpack-plugin";
|
|
10
|
+
const S_PLUGIN_LYNX_APPLIED = Symbol.for('@lynx-js/rsbuild-plugin:applied');
|
|
11
|
+
function pluginAutoLynx() {
|
|
12
|
+
return {
|
|
13
|
+
name: 'lynx:react:auto-lynx',
|
|
14
|
+
async setup (api) {
|
|
15
|
+
const { callerName } = api.context;
|
|
16
|
+
if ('rslib' === callerName || 'rstest' === callerName) return;
|
|
17
|
+
if (api.isPluginExists(PLUGIN_LYNX_NAME) || Object.hasOwn(api.context, S_PLUGIN_LYNX_APPLIED)) return;
|
|
18
|
+
Object.defineProperty(api.context, S_PLUGIN_LYNX_APPLIED, {
|
|
19
|
+
value: true
|
|
20
|
+
});
|
|
21
|
+
const original = api.getRsbuildConfig('original');
|
|
22
|
+
for (const plugin of pluginLynx()){
|
|
23
|
+
const { action } = api.context;
|
|
24
|
+
if ('function' != typeof plugin.apply || plugin.apply(original, {
|
|
25
|
+
action
|
|
26
|
+
})) await plugin.setup(api);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
9
31
|
const DETECT_IMPORT_ERROR = 'react:detect-import-error';
|
|
10
32
|
const ALIAS_BACKGROUND_ONLY_MAIN = 'react:alias-background-only-main';
|
|
11
33
|
const ALIAS_BACKGROUND_ONLY_BACKGROUND = 'react:alias-background-only-background';
|
|
@@ -144,8 +166,9 @@ function applyEntry(api, options) {
|
|
|
144
166
|
const chunkSplitStrategy = userConfig.performance?.chunkSplit?.strategy;
|
|
145
167
|
const enableChunkSplitting = void 0 === userConfig.splitChunks ? chunkSplitStrategy ? 'all-in-one' !== chunkSplitStrategy : false !== rsbuildConfig.splitChunks : false !== rsbuildConfig.splitChunks;
|
|
146
168
|
const rspeedyConfig = 'rspeedy' === api.context.callerName ? api.useExposed(Symbol.for('rspeedy.api'))?.config : void 0;
|
|
147
|
-
const
|
|
148
|
-
|
|
169
|
+
const bundleFilenameConfig = api.getRsbuildConfig('original').output?.filename;
|
|
170
|
+
const emitTemplate = 'rslib' !== api.context.callerName && 'rstest' !== api.context.callerName;
|
|
171
|
+
if (emitTemplate) {
|
|
149
172
|
const entries = chain.entryPoints.entries() ?? {};
|
|
150
173
|
const isLynx = 'lynx' === environment.name || environment.name.startsWith('lynx-');
|
|
151
174
|
const isWeb = 'web' === environment.name || environment.name.startsWith('web-');
|
|
@@ -155,7 +178,7 @@ function applyEntry(api, options) {
|
|
|
155
178
|
chain.entryPoints.clear();
|
|
156
179
|
Object.entries(entries).forEach(([entryName, entryPoint])=>{
|
|
157
180
|
const { imports } = getChunks(entryName, entryPoint.values());
|
|
158
|
-
const bundleFilename =
|
|
181
|
+
const bundleFilename = bundleFilenameConfig?.bundle ?? bundleFilenameConfig?.template;
|
|
159
182
|
let templateFilename;
|
|
160
183
|
let lazyBundleFilename;
|
|
161
184
|
if ('function' == typeof bundleFilename) {
|
|
@@ -1428,6 +1451,7 @@ function pluginReactLynx(userOptions) {
|
|
|
1428
1451
|
engineVersion
|
|
1429
1452
|
});
|
|
1430
1453
|
return [
|
|
1454
|
+
pluginAutoLynx(),
|
|
1431
1455
|
pluginReactAlias({
|
|
1432
1456
|
lazy: resolvedOptions.experimental_isLazyBundle,
|
|
1433
1457
|
elementTemplate: resolvedOptions.experimental_useElementTemplate,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/react-rsbuild-plugin",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.1",
|
|
4
4
|
"description": "A rsbuild plugin for ReactLynx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rsbuild",
|
|
@@ -34,11 +34,12 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"tiny-invariant": "^1.3.3",
|
|
36
36
|
"@lynx-js/css-extract-webpack-plugin": "0.10.1",
|
|
37
|
-
"@lynx-js/react-alias-rsbuild-plugin": "0.19.
|
|
37
|
+
"@lynx-js/react-alias-rsbuild-plugin": "0.19.1",
|
|
38
38
|
"@lynx-js/react-refresh-webpack-plugin": "0.4.2",
|
|
39
|
-
"@lynx-js/react-webpack-plugin": "0.11.
|
|
39
|
+
"@lynx-js/react-webpack-plugin": "0.11.1",
|
|
40
|
+
"@lynx-js/rsbuild-plugin": "0.0.3",
|
|
40
41
|
"@lynx-js/runtime-wrapper-webpack-plugin": "0.2.3",
|
|
41
|
-
"@lynx-js/template-webpack-plugin": "0.15.
|
|
42
|
+
"@lynx-js/template-webpack-plugin": "0.15.2",
|
|
42
43
|
"@lynx-js/use-sync-external-store": "1.5.0",
|
|
43
44
|
"background-only": "^0.0.1"
|
|
44
45
|
},
|
|
@@ -55,15 +56,15 @@
|
|
|
55
56
|
"type-fest": "^5.8.0",
|
|
56
57
|
"typia": "12.1.1",
|
|
57
58
|
"typia-rspack-plugin": "3.0.1",
|
|
58
|
-
"@lynx-js/config-rsbuild-plugin": "0.2.2",
|
|
59
59
|
"@lynx-js/debug-metadata": "0.1.0",
|
|
60
|
-
"@lynx-js/
|
|
60
|
+
"@lynx-js/config-rsbuild-plugin": "0.2.2",
|
|
61
|
+
"@lynx-js/react": "0.125.0",
|
|
61
62
|
"@lynx-js/react-transform": "0.2.0",
|
|
62
|
-
"@lynx-js/rspeedy": "0.16.
|
|
63
|
+
"@lynx-js/rspeedy": "0.16.5",
|
|
63
64
|
"@lynx-js/test-tools": "0.0.0"
|
|
64
65
|
},
|
|
65
66
|
"peerDependencies": {
|
|
66
|
-
"@lynx-js/react": "^0.124.0"
|
|
67
|
+
"@lynx-js/react": "^0.124.0 || ^0.125.0"
|
|
67
68
|
},
|
|
68
69
|
"peerDependenciesMeta": {
|
|
69
70
|
"@lynx-js/react": {
|