@lynx-js/react-rsbuild-plugin 0.20.2 → 0.20.3
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 +16 -0
- package/README.md +1 -1
- package/dist/index.d.ts +11 -9
- package/dist/index.js +8 -18
- package/package.json +15 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @lynx-js/react-rsbuild-plugin
|
|
2
2
|
|
|
3
|
+
## 0.20.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Default `performance.profile` to `true` in `pluginLynx` when `DEBUG` includes `lynx`, `rsbuild`, `rspeedy` or `*`, to align with Rspeedy. ([#3973](https://github.com/lynx-family/lynx-stack/pull/3973))
|
|
8
|
+
|
|
9
|
+
- Add `@lynx-js/rspeedy` `^0.18.0` to the peer dependency range. ([#3971](https://github.com/lynx-family/lynx-stack/pull/3971))
|
|
10
|
+
- Updated dependencies [[`388e50e`](https://github.com/lynx-family/lynx-stack/commit/388e50e42106e5f11751b317b82c0313089b29b2), [`b5241dd`](https://github.com/lynx-family/lynx-stack/commit/b5241dd52770e97cb9bc5f08d9aa3bdbf7be9ce8), [`bb272ef`](https://github.com/lynx-family/lynx-stack/commit/bb272efaea7d3cd757e8d0f86ebe67261715b44e), [`c5809d0`](https://github.com/lynx-family/lynx-stack/commit/c5809d097d6cd3c29ba8a140288fce0846b60b2c), [`4ccff90`](https://github.com/lynx-family/lynx-stack/commit/4ccff90024f05d12eb48d1a8b6303a2a8618270c), [`4ccff90`](https://github.com/lynx-family/lynx-stack/commit/4ccff90024f05d12eb48d1a8b6303a2a8618270c), [`4c453b9`](https://github.com/lynx-family/lynx-stack/commit/4c453b9ed1c58860f96cde9c4e91722f5d145470), [`f5779c6`](https://github.com/lynx-family/lynx-stack/commit/f5779c6364caba15152181baf7205a33b2037870), [`0cea2a3`](https://github.com/lynx-family/lynx-stack/commit/0cea2a3d34cb4dee019f0bc82ba07ef3a664ef23), [`c8a6aaf`](https://github.com/lynx-family/lynx-stack/commit/c8a6aafdde20972252898eae32da0aa385f31d6e), [`8eb5c3a`](https://github.com/lynx-family/lynx-stack/commit/8eb5c3aab2c99fa306313cd2382ec7369e97408e), [`10a10bc`](https://github.com/lynx-family/lynx-stack/commit/10a10bcd73f207482fec3bb79a2f04d7c26086d9)]:
|
|
11
|
+
- @lynx-js/react-webpack-plugin@0.12.0
|
|
12
|
+
- @lynx-js/template-webpack-plugin@0.16.2
|
|
13
|
+
- @lynx-js/react-refresh-webpack-plugin@0.4.3
|
|
14
|
+
- @lynx-js/rsbuild-plugin@0.1.3
|
|
15
|
+
- @lynx-js/react-alias-rsbuild-plugin@0.20.3
|
|
16
|
+
- @lynx-js/use-sync-external-store@1.5.0
|
|
17
|
+
- @lynx-js/css-extract-webpack-plugin@0.11.0
|
|
18
|
+
|
|
3
19
|
## 0.20.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ npm install -D @lynx-js/react-rsbuild-plugin
|
|
|
25
25
|
|
|
26
26
|
```js
|
|
27
27
|
import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
|
|
28
|
-
import { defineConfig } from '@
|
|
28
|
+
import { defineConfig } from '@rsbuild/core'
|
|
29
29
|
|
|
30
30
|
export default defineConfig({
|
|
31
31
|
plugins: [
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import type { RsbuildPlugin } from '@rsbuild/core';
|
|
|
10
10
|
import type { TemplateHooks } from '@lynx-js/template-webpack-plugin';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* {@
|
|
13
|
+
* {@inheritDoc CompatVisitorConfig.addComponentElement}
|
|
14
14
|
* @public
|
|
15
15
|
*/
|
|
16
16
|
export declare interface AddComponentElementConfig {
|
|
@@ -41,7 +41,7 @@ export declare interface AddComponentElementConfig {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
|
-
* {@
|
|
44
|
+
* {@inheritDoc PluginReactLynxOptions.compat}
|
|
45
45
|
* @public
|
|
46
46
|
*/
|
|
47
47
|
export declare interface CompatVisitorConfig {
|
|
@@ -293,9 +293,10 @@ export declare interface CompatVisitorConfig {
|
|
|
293
293
|
*/
|
|
294
294
|
disableDeprecatedWarning: boolean
|
|
295
295
|
/**
|
|
296
|
+
* Dark mode configuration
|
|
297
|
+
*
|
|
296
298
|
* @public
|
|
297
299
|
* @deprecated
|
|
298
|
-
* Dark mode configuration
|
|
299
300
|
*
|
|
300
301
|
* @defaultValue `undefined`
|
|
301
302
|
*
|
|
@@ -362,7 +363,7 @@ declare interface DarkModeConfig {
|
|
|
362
363
|
}
|
|
363
364
|
|
|
364
365
|
/**
|
|
365
|
-
* {@
|
|
366
|
+
* {@inheritDoc PluginReactLynxOptions.defineDCE}
|
|
366
367
|
* @public
|
|
367
368
|
*/
|
|
368
369
|
export declare interface DefineDceVisitorConfig {
|
|
@@ -416,7 +417,7 @@ export declare interface DefineDceVisitorConfig {
|
|
|
416
417
|
}
|
|
417
418
|
|
|
418
419
|
/**
|
|
419
|
-
* {@
|
|
420
|
+
* {@inheritDoc @lynx-js/react-rsbuild-plugin#PluginReactLynxOptions.extractStr}
|
|
420
421
|
* @public
|
|
421
422
|
*/
|
|
422
423
|
export declare interface ExtractStrConfig {
|
|
@@ -477,7 +478,7 @@ export declare function pluginReactLynx(userOptions?: PluginReactLynxOptions): R
|
|
|
477
478
|
*/
|
|
478
479
|
export declare interface PluginReactLynxOptions {
|
|
479
480
|
/**
|
|
480
|
-
*
|
|
481
|
+
* Generate UI source maps in the main-thread transform.
|
|
481
482
|
*
|
|
482
483
|
* @defaultValue `false`
|
|
483
484
|
*/
|
|
@@ -518,7 +519,8 @@ export declare interface PluginReactLynxOptions {
|
|
|
518
519
|
* By setting `customCSSInheritanceList: ['direction', 'overflow']`, only the `direction` and `overflow` properties are inheritable.
|
|
519
520
|
*
|
|
520
521
|
* ```js
|
|
521
|
-
* import {
|
|
522
|
+
* import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
|
|
523
|
+
* import { defineConfig } from '@rsbuild/core'
|
|
522
524
|
*
|
|
523
525
|
* export default defineConfig({
|
|
524
526
|
* plugins: [
|
|
@@ -527,7 +529,7 @@ export declare interface PluginReactLynxOptions {
|
|
|
527
529
|
* customCSSInheritanceList: ['direction', 'overflow']
|
|
528
530
|
* }),
|
|
529
531
|
* ],
|
|
530
|
-
* }
|
|
532
|
+
* })
|
|
531
533
|
* ```
|
|
532
534
|
*
|
|
533
535
|
* @defaultValue `undefined`
|
|
@@ -772,7 +774,7 @@ export declare interface PluginReactLynxOptions {
|
|
|
772
774
|
}
|
|
773
775
|
|
|
774
776
|
/**
|
|
775
|
-
* {@
|
|
777
|
+
* {@inheritDoc PluginReactLynxOptions.shake}
|
|
776
778
|
* @public
|
|
777
779
|
*/
|
|
778
780
|
export declare interface ShakeVisitorConfig {
|
package/dist/index.js
CHANGED
|
@@ -331,7 +331,7 @@ function applyEntry(api, options) {
|
|
|
331
331
|
(api.logger ?? console).warn('`extractStr` is changed to `false` because it is only supported when chunk splitting is disabled, please set `splitChunks` to `false` to use `extractStr.`');
|
|
332
332
|
extractStr = false;
|
|
333
333
|
}
|
|
334
|
-
const { resolve } = api.useExposed(Symbol.for('@lynx-js/react/internal:resolve'));
|
|
334
|
+
const { resolve, version: runtimeVersion } = api.useExposed(Symbol.for('@lynx-js/react/internal:resolve'));
|
|
335
335
|
chain.plugin(PLUGIN_NAME_REACT).after(PLUGIN_NAME_TEMPLATE).use(ReactWebpackPlugin, [
|
|
336
336
|
{
|
|
337
337
|
disableCreateSelectorQueryIncompatibleWarning: compat?.disableCreateSelectorQueryIncompatibleWarning ?? false,
|
|
@@ -345,7 +345,8 @@ function applyEntry(api, options) {
|
|
|
345
345
|
experimental_useElementTemplate: options.experimental_useElementTemplate,
|
|
346
346
|
profile: getDefaultProfile(),
|
|
347
347
|
workletRuntimePath: await resolve(`@lynx-js/react/${isDev ? 'worklet-dev-runtime' : 'worklet-runtime'}`),
|
|
348
|
-
lazyBundleFetcher
|
|
348
|
+
lazyBundleFetcher,
|
|
349
|
+
runtimeVersion
|
|
349
350
|
}
|
|
350
351
|
]);
|
|
351
352
|
const isHostEnvironment = isApplication && !experimental_isLazyBundle;
|
|
@@ -355,21 +356,10 @@ function applyEntry(api, options) {
|
|
|
355
356
|
function getDefaultProfile() {
|
|
356
357
|
const environmentProfile = rspeedyConfig?.environments?.[environment.name]?.performance?.profile;
|
|
357
358
|
if (void 0 !== environmentProfile) return environmentProfile;
|
|
358
|
-
|
|
359
|
-
if (void 0 !== userProfile) return userProfile;
|
|
360
|
-
if (isDebug()) return true;
|
|
359
|
+
return lynxConfig?.performance.profile;
|
|
361
360
|
}
|
|
362
361
|
});
|
|
363
362
|
}
|
|
364
|
-
const isDebug = ()=>{
|
|
365
|
-
if (!process.env['DEBUG']) return false;
|
|
366
|
-
const values = process.env['DEBUG'].toLocaleLowerCase().split(',');
|
|
367
|
-
return [
|
|
368
|
-
'lynx',
|
|
369
|
-
'rspeedy',
|
|
370
|
-
'*'
|
|
371
|
-
].some((key)=>values.includes(key));
|
|
372
|
-
};
|
|
373
363
|
function getChunks(entryName, entryValue) {
|
|
374
364
|
const chunks = [
|
|
375
365
|
entryName
|
|
@@ -398,13 +388,13 @@ function getChunks(entryName, entryValue) {
|
|
|
398
388
|
function getBackgroundFilename(entryName, config, isProd, experimental_isLazyBundle) {
|
|
399
389
|
const { filename } = config.output;
|
|
400
390
|
if ('string' == typeof filename.js) return filename.js.replaceAll('[name]', entryName).replaceAll('.js', '/background.js');
|
|
401
|
-
return `${entryName}/background${getHash(config, isProd, experimental_isLazyBundle)}.js`;
|
|
391
|
+
else return `${entryName}/background${getHash(config, isProd, experimental_isLazyBundle)}.js`;
|
|
402
392
|
}
|
|
403
393
|
function getHash(config, isProd, experimental_isLazyBundle) {
|
|
404
394
|
if ('string' == typeof config.output?.filenameHash) return config.output.filenameHash ? `.[${config.output.filenameHash}]` : EMPTY_HASH;
|
|
405
|
-
if (config.output?.filenameHash === false) return EMPTY_HASH;
|
|
406
|
-
if (isProd || experimental_isLazyBundle) return DEFAULT_FILENAME_HASH;
|
|
407
|
-
return EMPTY_HASH;
|
|
395
|
+
else if (config.output?.filenameHash === false) return EMPTY_HASH;
|
|
396
|
+
else if (isProd || experimental_isLazyBundle) return DEFAULT_FILENAME_HASH;
|
|
397
|
+
else return EMPTY_HASH;
|
|
408
398
|
}
|
|
409
399
|
function applyGenerator(api, options) {
|
|
410
400
|
api.modifyBundlerChain({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/react-rsbuild-plugin",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.3",
|
|
4
4
|
"description": "A rsbuild plugin for ReactLynx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rsbuild",
|
|
@@ -33,30 +33,30 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@lynx-js/css-extract-webpack-plugin": "0.11.0",
|
|
36
|
-
"@lynx-js/react-alias-rsbuild-plugin": "0.20.
|
|
37
|
-
"@lynx-js/react-refresh-webpack-plugin": "0.4.
|
|
38
|
-
"@lynx-js/react-webpack-plugin": "0.
|
|
39
|
-
"@lynx-js/rsbuild-plugin": "0.1.
|
|
36
|
+
"@lynx-js/react-alias-rsbuild-plugin": "0.20.3",
|
|
37
|
+
"@lynx-js/react-refresh-webpack-plugin": "0.4.3",
|
|
38
|
+
"@lynx-js/react-webpack-plugin": "0.12.0",
|
|
39
|
+
"@lynx-js/rsbuild-plugin": "0.1.3",
|
|
40
40
|
"@lynx-js/runtime-config-webpack-plugin": "0.0.1",
|
|
41
41
|
"@lynx-js/runtime-wrapper-webpack-plugin": "0.2.4",
|
|
42
|
-
"@lynx-js/template-webpack-plugin": "0.16.
|
|
42
|
+
"@lynx-js/template-webpack-plugin": "0.16.2",
|
|
43
43
|
"@lynx-js/use-sync-external-store": "1.5.0",
|
|
44
44
|
"background-only": "^0.0.1",
|
|
45
45
|
"tiny-invariant": "^1.3.3"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@lynx-js/config-rsbuild-plugin": "0.2.
|
|
48
|
+
"@lynx-js/config-rsbuild-plugin": "0.2.4",
|
|
49
49
|
"@lynx-js/debug-metadata": "0.1.0",
|
|
50
|
-
"@lynx-js/react": "0.126.
|
|
50
|
+
"@lynx-js/react": "0.126.2",
|
|
51
51
|
"@lynx-js/react-transform": "0.2.0",
|
|
52
|
-
"@lynx-js/rspeedy": "0.
|
|
52
|
+
"@lynx-js/rspeedy": "0.18.0",
|
|
53
53
|
"@lynx-js/test-tools": "0.0.0",
|
|
54
|
-
"@microsoft/api-extractor": "7.
|
|
55
|
-
"@rsbuild/core": "2.2.
|
|
54
|
+
"@microsoft/api-extractor": "7.59.1",
|
|
55
|
+
"@rsbuild/core": "2.2.9",
|
|
56
56
|
"@rsbuild/plugin-sass": "2.0.1",
|
|
57
57
|
"@rsbuild/plugin-typed-css-modules": "1.2.4",
|
|
58
|
-
"@rstest/core": "0.
|
|
59
|
-
"rsbuild-plugin-arethetypeswrong": "0.
|
|
58
|
+
"@rstest/core": "0.12.1",
|
|
59
|
+
"rsbuild-plugin-arethetypeswrong": "0.4.0",
|
|
60
60
|
"rsbuild-plugin-publint": "1.0.0",
|
|
61
61
|
"source-map": "^0.8.0",
|
|
62
62
|
"tailwindcss": "^3.4.19",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
68
|
"@lynx-js/react": "^0.124.0 || ^0.125.0 || ^0.126.0",
|
|
69
|
-
"@lynx-js/rspeedy": "^0.17.0",
|
|
69
|
+
"@lynx-js/rspeedy": "^0.17.0 || ^0.18.0",
|
|
70
70
|
"@rsbuild/core": "^2.0.0"
|
|
71
71
|
},
|
|
72
72
|
"peerDependenciesMeta": {
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
},
|
|
89
89
|
"scripts": {
|
|
90
90
|
"api-extractor": "api-extractor run --verbose",
|
|
91
|
-
"build": "rslib
|
|
91
|
+
"build": "rslib",
|
|
92
92
|
"test": "rstest"
|
|
93
93
|
}
|
|
94
94
|
}
|