@pushwoosh/frontend-builder-engine 4.1.0 → 4.3.0-beta.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
@@ -50,6 +50,18 @@ Chrome/Edge 94, Firefox 108 (import maps), Safari/iOS 16.4. To see it from a pro
50
50
  npx browserslist "$(node -p "require('@pushwoosh/frontend-builder-engine/lib/browser-targets').BROWSERSLIST_QUERY")"
51
51
  ```
52
52
 
53
+ ### Minification
54
+
55
+ Production builds are minified with `@swc/core` (`TerserPlugin.swcMinify`, `compress.passes: 2`) —
56
+ about a third less CPU than terser, same bundle size, and `*.LICENSE.txt` keeps the standard banners
57
+ (`/*!`, `/**!`, `@license`, `@preserve`, `@cc_on`). Unlike terser, the match is case-sensitive:
58
+ an uppercase `@LICENSE` comment is not extracted. To fall back to terser for one build, set
59
+ `ENGINE_MINIFIER=terser` (exact lowercase value):
60
+
61
+ ```bash
62
+ ENGINE_MINIFIER=terser npm run build
63
+ ```
64
+
53
65
  ## Migration from v3
54
66
 
55
67
  v3 is deprecated: its `dist/index.js` is not an ES module, and the platform loads native ES modules
@@ -36,8 +36,6 @@ export default tseslint.config(
36
36
  },
37
37
  rules: {
38
38
  ...hooksPlugin.configs.recommended.rules,
39
- 'react-hooks/set-state-in-effect': 'error',
40
- 'react-hooks/refs': 'off',
41
39
  'react-hooks/incompatible-library': 'error',
42
40
  'react/display-name': 'off',
43
41
  'react/no-array-index-key': 'error',
@@ -1,6 +1,7 @@
1
1
  const path = require('path');
2
2
  const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
3
3
  const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
4
+ const TerserPlugin = require('terser-webpack-plugin');
4
5
 
5
6
  const { BROWSERSLIST_QUERY } = require('../browser-targets');
6
7
 
@@ -48,6 +49,8 @@ function singleSpaDefaults(opts) {
48
49
  // externals.push('react', 'react-dom');
49
50
  // }
50
51
 
52
+ const useTerser = process.env.ENGINE_MINIFIER === 'terser';
53
+
51
54
  // Plugins
52
55
  const plugins = [
53
56
  new BundleAnalyzerPlugin({
@@ -152,6 +155,17 @@ function singleSpaDefaults(opts) {
152
155
  ],
153
156
  },
154
157
  devtool: 'source-map',
158
+ optimization: {
159
+ minimizer: [
160
+ new TerserPlugin({
161
+ ...(useTerser ? {} : {
162
+ minify: TerserPlugin.swcMinify,
163
+ extractComments: '^\\**!|@preserve|@license|@cc_on',
164
+ }),
165
+ terserOptions: { compress: { passes: 2 } },
166
+ }),
167
+ ],
168
+ },
155
169
  devServer: {
156
170
  historyApiFallback: true,
157
171
  headers: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/frontend-builder-engine",
3
- "version": "4.1.0",
3
+ "version": "4.3.0-beta.1",
4
4
  "description": "Pushwoosh frontend builder engine",
5
5
  "main": "./lib/pushwoosh-frontend-builder-engine.js",
6
6
  "publishConfig": {
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "scripts": {
10
10
  "test": "echo test",
11
- "docker-npm-install": "docker run --rm -e NPM_TOKEN=${NPM_TOKEN} -v ${PWD}:/app -w /app node:22-alpine npm install"
11
+ "docker-npm-install": "docker run --rm -e NPM_TOKEN=${NPM_TOKEN} -v ${PWD}:/app -w /app node:24.22.1-alpine npm install"
12
12
  },
13
13
  "bin": {
14
14
  "pushwoosh-engine": "bin/cli.js"
@@ -30,6 +30,7 @@
30
30
  "@eslint/js": "^9.13.0",
31
31
  "@stylistic/eslint-plugin": "^5.3.1",
32
32
  "@svgr/webpack": "^8.1.0",
33
+ "@swc/core": "1.16.18",
33
34
  "@types/eslint__js": "^8.42.3",
34
35
  "@types/webpack-env": "^1.18.4",
35
36
  "babel-loader": "^10.0.0",
@@ -46,6 +47,7 @@
46
47
  "html-webpack-plugin": "^5.6.0",
47
48
  "knip": "^6.35.1",
48
49
  "style-loader": "^4.0.0",
50
+ "terser-webpack-plugin": "^5.6.1",
49
51
  "ts-loader": "^9.5.1",
50
52
  "tsconfig-paths-webpack-plugin": "^4.1.0",
51
53
  "typescript": "^6.0.3",