@lynx-js/rspeedy 0.15.1 → 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,29 @@
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
+
3
27
  ## 0.15.1
4
28
 
5
29
  ### Patch 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
  });
@@ -22,6 +22,7 @@ function mergeJsOptions(baseOptions, threadOptions) {
22
22
  return merged.output?.minify?.jsOptions ?? {};
23
23
  }
24
24
  function pluginMinify(options) {
25
+ const keepNames = Boolean(process.env['REACT_DEVTOOL']);
25
26
  const defaultJsOptions = Object.freeze({
26
27
  minimizerOptions: {
27
28
  compress: {
@@ -31,14 +32,22 @@ function pluginMinify(options) {
31
32
  inline: 2,
32
33
  comparisons: false,
33
34
  toplevel: true,
34
- side_effects: false
35
+ side_effects: false,
36
+ ...keepNames ? {
37
+ keep_fnames: true,
38
+ keep_classnames: true
39
+ } : {}
35
40
  },
36
41
  format: {
37
42
  keep_quoted_props: true,
38
43
  comments: false
39
44
  },
40
45
  mangle: {
41
- toplevel: true
46
+ toplevel: true,
47
+ ...keepNames ? {
48
+ keep_fnames: true,
49
+ keep_classnames: true
50
+ } : {}
42
51
  }
43
52
  }
44
53
  });
@@ -1,18 +1,10 @@
1
1
  import { getESVersionTarget } from "./1~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
  });
@@ -303,7 +303,7 @@ async function exit_onExit(signal) {
303
303
  await Promise.allSettled(exitPromises);
304
304
  }
305
305
  var package_namespaceObject = {
306
- rE: "0.15.1"
306
+ rE: "0.15.2"
307
307
  };
308
308
  const version_version = package_namespaceObject.rE;
309
309
  const rspackVersion = rspack.rspackVersion;
@@ -490,7 +490,7 @@ function isDeno() {
490
490
  return false;
491
491
  }
492
492
  var package_namespaceObject = {
493
- rE: "0.15.1"
493
+ rE: "0.15.2"
494
494
  };
495
495
  const version_version = package_namespaceObject.rE;
496
496
  const rspackVersion = rspack.rspackVersion;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/rspeedy",
3
- "version": "0.15.1",
3
+ "version": "0.15.2",
4
4
  "description": "A webpack/rspack-based frontend toolchain for Lynx",
5
5
  "keywords": [
6
6
  "webpack",
@@ -53,8 +53,8 @@
53
53
  "@rsdoctor/rspack-plugin": "~1.5.6",
54
54
  "@lynx-js/cache-events-webpack-plugin": "^0.1.0",
55
55
  "@lynx-js/chunk-loading-webpack-plugin": "^0.4.0",
56
- "@lynx-js/debug-metadata-rsbuild-plugin": "^0.1.1",
57
- "@lynx-js/web-rsbuild-server-middleware": "0.22.0",
56
+ "@lynx-js/debug-metadata-rsbuild-plugin": "^0.1.2",
57
+ "@lynx-js/web-rsbuild-server-middleware": "0.22.1",
58
58
  "@lynx-js/webpack-dev-transport": "^0.3.0",
59
59
  "@lynx-js/websocket": "^0.0.4"
60
60
  },