@lynx-js/rspeedy 0.15.0 → 0.15.2

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 CHANGED
@@ -1,5 +1,39 @@
1
1
  # @lynx-js/rspeedy
2
2
 
3
+ ## 0.15.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Support enabling preact devtools in production via the `REACT_DEVTOOL` environment variable. ([#2880](https://github.com/lynx-family/lynx-stack/pull/2880))
8
+
9
+ By default `@lynx-js/preact-devtools` is aliased away in production builds. Setting the `REACT_DEVTOOL` environment variable now:
10
+
11
+ 1. keeps a user-imported `@lynx-js/preact-devtools` from being stripped;
12
+ 2. defines `__REACT_DEVTOOL__`, which gates the dev-only runtime hooks devtools depends on (such as `injectLepusMethods`) so they also run in production;
13
+ 3. keeps function/class names during minification (`keep_fnames`/`keep_classnames`), which devtools needs to resolve component names (`type.name`) and to reconstruct the hook tree (it matches minified stack frames by function name).
14
+
15
+ `@lynx-js/react/debug` remains development-only.
16
+
17
+ - Fix the `web` environment crashing in development because its main thread was bundled with the Rsbuild web HMR runtime. ([#2910](https://github.com/lynx-family/lynx-stack/pull/2910))
18
+
19
+ Previously the `web` environment was compiled with `target: 'web'`, which makes Rsbuild inject its own HMR client (`@rsbuild/core/dist/client/hmr.js`). That client drives `__webpack_require__.hmrM`, which is implemented with `lynx.requireModuleAsync` — an API the web main thread does not provide — so hot updates crashed.
20
+
21
+ The `web` environment now uses the same target and HMR entry as the `lynx` environment, going through Lynx's own HMR runtime instead of the Rsbuild web one.
22
+
23
+ - Updated dependencies [[`7a6577a`](https://github.com/lynx-family/lynx-stack/commit/7a6577a5b29db4020cbba22a911f712bafde7e66)]:
24
+ - @lynx-js/debug-metadata-rsbuild-plugin@0.1.2
25
+ - @lynx-js/web-rsbuild-server-middleware@0.22.1
26
+
27
+ ## 0.15.1
28
+
29
+ ### Patch Changes
30
+
31
+ - Add Rspeedy config types for `entry.dependOn` and `cssLoader.modules`. ([#2871](https://github.com/lynx-family/lynx-stack/pull/2871))
32
+
33
+ - Updated dependencies [[`cd195c1`](https://github.com/lynx-family/lynx-stack/commit/cd195c13fb3f6dd890562db1f2f3ca260b29f484)]:
34
+ - @lynx-js/debug-metadata-rsbuild-plugin@0.1.1
35
+ - @lynx-js/web-rsbuild-server-middleware@0.22.0
36
+
3
37
  ## 0.15.0
4
38
 
5
39
  ### Minor Changes
@@ -18,6 +18,7 @@ function mergeJsOptions(baseOptions, threadOptions) {
18
18
  return merged.output?.minify?.jsOptions ?? {};
19
19
  }
20
20
  function pluginMinify(options) {
21
+ const keepNames = Boolean(process.env['REACT_DEVTOOL']);
21
22
  const defaultJsOptions = Object.freeze({
22
23
  minimizerOptions: {
23
24
  compress: {
@@ -27,14 +28,22 @@ function pluginMinify(options) {
27
28
  inline: 2,
28
29
  comparisons: false,
29
30
  toplevel: true,
30
- side_effects: false
31
+ side_effects: false,
32
+ ...keepNames ? {
33
+ keep_fnames: true,
34
+ keep_classnames: true
35
+ } : {}
31
36
  },
32
37
  format: {
33
38
  keep_quoted_props: true,
34
39
  comments: false
35
40
  },
36
41
  mangle: {
37
- toplevel: true
42
+ toplevel: true,
43
+ ...keepNames ? {
44
+ keep_fnames: true,
45
+ keep_classnames: true
46
+ } : {}
38
47
  }
39
48
  }
40
49
  });
@@ -1,18 +1,10 @@
1
1
  import { getESVersionTarget } from "./0~getESVersionTarget.js";
2
- function isWeb(environment) {
3
- const environmentName = 'string' == typeof environment ? environment : environment.name;
4
- return 'web' === environmentName || environmentName.startsWith('web-');
5
- }
6
2
  function pluginTarget() {
7
3
  return {
8
4
  name: 'lynx:rsbuild:target',
9
5
  setup (api) {
10
- api.modifyBundlerChain((options, { environment })=>{
11
- if (isWeb(environment)) options.target([
12
- getESVersionTarget(),
13
- 'web'
14
- ]);
15
- else options.target([
6
+ api.modifyBundlerChain((options)=>{
7
+ options.target([
16
8
  getESVersionTarget()
17
9
  ]);
18
10
  });