@pushwoosh/frontend-builder-engine 4.3.0 → 4.3.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/README.md CHANGED
@@ -62,6 +62,25 @@ an uppercase `@LICENSE` comment is not extracted. To fall back to terser for one
62
62
  ENGINE_MINIFIER=terser npm run build
63
63
  ```
64
64
 
65
+ ### React Compiler (opt-in)
66
+
67
+ `babel-plugin-react-compiler` ships with the engine and is off by default: a project switches it on in
68
+ its `pushwoosh.config.js`, so micro-frontends move to it one at a time.
69
+
70
+ ```js
71
+ module.exports = {
72
+ reactCompiler: true,
73
+ // or compiler options, e.g. compile only components marked with 'use memo':
74
+ // reactCompiler: { compilationMode: 'annotation' },
75
+ };
76
+ ```
77
+
78
+ The plugin runs first in `lib/babel.application.config.js` with `target: '19'`, so it needs no
79
+ `react-compiler-runtime` package: the memo cache comes from `react/compiler-runtime` of the project's own
80
+ React 19, bundled into `index.mjs` while `react` itself stays external. Components the compiler cannot
81
+ handle are left as they are (the default `panicThreshold: 'none'`). The option affects application
82
+ builds only; `lib:build` does not read it.
83
+
65
84
  ## Migration from v3
66
85
 
67
86
  v3 is deprecated: its `dist/index.js` is not an ES module, and the platform loads native ES modules
@@ -12,6 +12,16 @@ const fromEngine = (name) => require.resolve(name);
12
12
  const runtimeVersion = require('@babel/runtime/package.json').version;
13
13
 
14
14
  const { BROWSER_TARGETS } = require('./browser-targets');
15
+ const { loadPushwooshConfig } = require('./helpers');
16
+
17
+ // Opt-in per project (pushwoosh.config.js `reactCompiler`); the compiler has to run before every other plugin.
18
+ const reactCompilerPlugins = (option) => {
19
+ if (!option) {
20
+ return [];
21
+ }
22
+
23
+ return [[fromEngine('babel-plugin-react-compiler'), { target: '19', ...(typeof option === 'object' ? option : {}) }]];
24
+ };
15
25
 
16
26
  module.exports = (api) => {
17
27
  api.cache(true);
@@ -30,6 +40,7 @@ module.exports = (api) => {
30
40
  fromEngine('@babel/preset-typescript')
31
41
  ],
32
42
  plugins: [
43
+ ...reactCompilerPlugins(loadPushwooshConfig().reactCompiler),
33
44
  [
34
45
  fromEngine('@babel/plugin-transform-runtime'),
35
46
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/frontend-builder-engine",
3
- "version": "4.3.0",
3
+ "version": "4.3.1",
4
4
  "description": "Pushwoosh frontend builder engine",
5
5
  "main": "./lib/pushwoosh-frontend-builder-engine.js",
6
6
  "publishConfig": {
@@ -34,6 +34,7 @@
34
34
  "@types/eslint__js": "^8.42.3",
35
35
  "@types/webpack-env": "^1.18.4",
36
36
  "babel-loader": "^10.0.0",
37
+ "babel-plugin-react-compiler": "^1.0.0",
37
38
  "babel-plugin-styled-components": "^2.1.4",
38
39
  "babel-plugin-transform-imports": "^2.0.0",
39
40
  "commander": "^12.0.0",