optiprune 2.3.4 → 2.3.5

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.
Files changed (2) hide show
  1. package/config.md +28 -6
  2. package/package.json +2 -2
package/config.md CHANGED
@@ -27,13 +27,35 @@ Create an `optiprune.json` or `optiprune.jsonc` file in the root directory of yo
27
27
 
28
28
  ## How OptiPrune Loads Configuration
29
29
 
30
- When OptiPrune initializes, it checks the workspace root in the following order of precedence:
31
-
32
- optiprune.json (Highest Priority )
33
-
34
- optiprune.jsonc (Allows comments //, /* */, and trailing commas)
30
+ OptiPrune resolves configuration from the directory passed to `--rootDir` (or the current working directory when `--rootDir` is omitted). It checks these sources in order; the first valid source wins:
31
+
32
+ | Priority | Source | Evaluation |
33
+ | --- | --- | --- |
34
+ | 1 | `optiprune.json` | Strict JSON; highest priority. |
35
+ | 2 | `optiprune.jsonc` | JSONC with comments and trailing commas. |
36
+ | 3 | `optiprune.config.ts` | Loaded through Jiti; use a default export. |
37
+ | 4 | `optiprune.config.js` | Loaded as JavaScript with a default export. |
38
+ | 5 | `optiprune.config.mjs` | Loaded as ESM JavaScript with a default export. |
39
+ | 6 | `package.json` | Uses the top-level `optiprune` object as a fallback. |
40
+
41
+ ### Recommended `optiprune.config.ts`
42
+
43
+ ```ts
44
+ import { defineConfig } from '@optiprune/core';
45
+
46
+ export default defineConfig({
47
+ rootDir: '.',
48
+ entry: ['src/index.ts'],
49
+ extensions: ['.ts', '.tsx', '.js', '.jsx'],
50
+ ignore: ['**/dist/**', '**/*.generated.ts'],
51
+ ignoreTests: true,
52
+ failOn: 'high',
53
+ output: 'terminal',
54
+ layers: { skip3: false, skip4: false },
55
+ });
56
+ ```
35
57
 
36
- package.json (Falls back to reading an "optiprune" key)
58
+ The config file must use a default export. `defineConfig` is a typed identity helper exported by `@optiprune/core`; it does not alter the object. Relative paths are resolved from the analyzed project root, and CLI options override loaded configuration values.
37
59
 
38
60
  ---
39
61
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "optiprune",
3
- "version": "2.3.4",
3
+ "version": "2.3.5",
4
4
  "description": "CLI for resilient static dead-code analyzer for TypeScript and JavaScript workspaces.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -69,7 +69,7 @@
69
69
  "./package.json": "./package.json"
70
70
  },
71
71
  "dependencies": {
72
- "@optiprune/core": "^1.12.14",
72
+ "@optiprune/core": "^1.12.20",
73
73
  "commander": "^15.0.0",
74
74
  "pathe": "2.0.3"
75
75
  },