@pushwoosh/frontend-builder-engine 3.1.0 → 3.1.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/README.md CHANGED
@@ -12,8 +12,33 @@ The CLI is invoked via `pushwoosh-engine` (installed as a dependency in consumin
12
12
  pushwoosh-engine app:command:dev # Start webpack dev server (HTTPS)
13
13
  pushwoosh-engine app:command:build # Production build
14
14
  pushwoosh-engine app:command:analyze # Bundle analysis
15
+ pushwoosh-engine app:command:check-dead-code # Unused files, exports and dependencies (knip)
15
16
  ```
16
17
 
18
+ `app:command:check-dead-code` runs knip with the shipped `lib/knip.application.json`: entries are
19
+ `src/index.{ts,tsx}` plus every `src/parcels/**/index.{ts,tsx}`, so a file the entry graph never
20
+ reaches is reported as unused. Exports used only inside their own file and everything under a
21
+ `generated/` directory are not reported; the binaries and unlisted rules are off, since consuming
22
+ projects get eslint/tsc/webpack from this package rather than declaring them; config hints are
23
+ suppressed, since the config lives here and a consuming project cannot act on them. A project opts
24
+ in by adding the script and folding it into `check`:
25
+
26
+ ```json
27
+ "check": "npm run check:lint && npm run check:types && npm run check:dead-code",
28
+ "check:dead-code": "echo \"Run check:dead-code\" && `pushwoosh-engine app:command:check-dead-code`"
29
+ ```
30
+
31
+ `examples/application` ships with exactly that wiring, so a project copied from the template gets the
32
+ gate on its `pre-commit` hook from the first commit.
33
+
34
+ CI is a separate step: the shared `frontend/microfrontend-release.yml` pipeline runs `check:lint` and
35
+ `check:types` as their own jobs and never calls `npm run check`, so the script alone gates the
36
+ pre-commit hook only. Blocking a merge needs a `check:dead-code` job next to those two.
37
+
38
+ A project whose parcel entry sits outside the globs above (a file no other entry re-exports) needs
39
+ its own `knip.json` in the project root and a plain `knip` call — the shared config is passed with
40
+ `--config` and cannot be extended per project.
41
+
17
42
  ### Library commands (reusable packages)
18
43
 
19
44
  ```bash
@@ -27,6 +27,15 @@
27
27
  * - Below Chrome/Edge 91 it enables
28
28
  * plugin-bugfix-v8-spread-parameters-in-optional-chaining, which downlevels
29
29
  * every `?.` in the bundle.
30
+ * - Below Safari/iOS 16 it enables
31
+ * plugin-bugfix-safari-class-field-initializer-scope, wrapping initializers
32
+ * that resolve to a bare identifier reference (through calls, member access,
33
+ * arrays, objects, or templates) in an IIFE; literals, `this`, and
34
+ * function/arrow/class expressions are left alone. It guards WebKit 236843,
35
+ * which fires only on redundant parentheses inside the initializer; Babel
36
+ * wraps blindly because its default AST drops them. To check an artifact for
37
+ * real exposure, parse it with `createParenthesizedExpressions: true` and
38
+ * look for ParenthesizedExpression under ClassProperty/ClassPrivateProperty.
30
39
  */
31
40
  const BROWSER_TARGETS = [
32
41
  'Chrome >= 94',
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "https://unpkg.com/knip@6/schema.json",
3
+ "entry": [
4
+ "src/index.{ts,tsx}",
5
+ "src/parcels/**/index.{ts,tsx}"
6
+ ],
7
+ "project": [
8
+ "src/**/*.{ts,tsx}"
9
+ ],
10
+ "ignore": [
11
+ "**/generated/**"
12
+ ],
13
+ "ignoreExportsUsedInFile": true,
14
+ "includeEntryExports": false,
15
+ "rules": {
16
+ "binaries": "off",
17
+ "unlisted": "off"
18
+ }
19
+ }
@@ -112,6 +112,21 @@ program
112
112
  }),
113
113
  );
114
114
 
115
+ program
116
+ .addCommand(
117
+ new Command('app:command:check-dead-code')
118
+ .description('App dead code check command')
119
+ .action(async () => {
120
+ const cmd = [
121
+ './node_modules/.bin/knip',
122
+ '--config',
123
+ './node_modules/@pushwoosh/frontend-builder-engine/lib/knip.application.json',
124
+ '--no-config-hints',
125
+ ];
126
+ console.log(cmd.join(' '));
127
+ }),
128
+ );
129
+
115
130
  program
116
131
  .addCommand(
117
132
  new Command('app:command:analyze')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/frontend-builder-engine",
3
- "version": "3.1.0",
3
+ "version": "3.1.2",
4
4
  "description": "Pushwoosh frontend builder engine",
5
5
  "main": "./lib/pushwoosh-frontend-builder-engine.js",
6
6
  "publishConfig": {
@@ -44,6 +44,7 @@
44
44
  "eslint-plugin-react-hooks": "^7.0.1",
45
45
  "fork-ts-checker-webpack-plugin": "^9.0.2",
46
46
  "html-webpack-plugin": "^5.6.0",
47
+ "knip": "^6.35.1",
47
48
  "style-loader": "^4.0.0",
48
49
  "systemjs-webpack-interop": "^2.3.7",
49
50
  "ts-loader": "^9.5.1",