You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`lib/schemes/` — URI scheme plugins (HttpUri, DataUri, Virtual)
12
+
-`lib/javascript/` — JavaScript modules parsing and generation
13
+
-`lib/css/` — CSS modules parsing and generation
15
14
-`schemas/` — JSON schemas for webpack options
16
15
-`types.d.ts` — Auto-generated type definitions (do not edit manually)
17
-
-`tooling/` — Build tooling scripts
18
16
-`test/` — All tests
17
+
-`examples/` — Usage examples for webpack features and configuration options
19
18
-`.changeset/` — Changeset files for releases
20
19
21
20
All available commands are defined in `package.json` scripts. Refer to `package.json` for the latest definitions.
22
21
23
22
## Development Workflow
24
23
25
-
### 1. Making Changes to `lib/`
24
+
### 1. Modifying Schemas or Types (if needed)
26
25
27
-
After modifying source code in `lib/`:
26
+
If your change involves modifying or adding webpack configuration options:
28
27
29
-
```bash
30
-
yarn fix:code # ESLint autofix
31
-
yarn fmt # Prettier format
32
-
# Or combined:
33
-
yarn fix # runs fix:code + fix:special + fmt
34
-
```
35
-
36
-
### 2. Modifying Schemas or Types
37
-
38
-
If your change affects module exports, options, or type definitions:
39
-
40
-
1. Edit the relevant schema file in `schemas/` (e.g., `schemas/WebpackOptions.json`, `schemas/plugins/`)
28
+
1. Edit `schemas/WebpackOptions.json` (or relevant schema file in `schemas/plugins/`)
41
29
2. Run `yarn fix:special` to regenerate:
42
30
-`types.d.ts` (compiled from JSDoc + schemas)
43
31
- Precompiled schema validators
44
32
- Runtime code
45
-
3. Other files can then reference the updated types via JSDoc `@typedef {import("...")}` imports
33
+
3. Now `lib/` code can reference the updated types via JSDoc `@typedef {import("...")}` imports
34
+
35
+
### 2. Making Changes to `lib/`
36
+
37
+
Modify source code in `lib/` as needed. If step 1 was performed, the latest type definitions are already available.
46
38
47
39
### 3. Adding a Changeset
48
40
@@ -59,7 +51,18 @@ Description of the change.
59
51
60
52
Use `patch` for bug fixes, `minor` for new features, `major` for breaking changes.
61
53
62
-
### 4. Writing Tests
54
+
### 4. Linting and Formatting
55
+
56
+
Run linting and formatting **after** adding the changeset:
57
+
58
+
```bash
59
+
yarn fix:code # ESLint autofix
60
+
yarn fmt # Prettier format
61
+
```
62
+
63
+
If any `lib/` file's exports (public API) were modified, also run `yarn fix:special` to regenerate types and validators. Or use `yarn fix` which combines all three (`fix:code` + `fix:special` + `fmt`).
64
+
65
+
### 5. Writing Tests
63
66
64
67
Test files live in `test/` with naming conventions:
65
68
@@ -78,13 +81,15 @@ Test files live in `test/` with naming conventions:
78
81
79
82
For unit tests, use Jest directly. Example: `test/FileSystemInfo.unittest.js` uses `memfs` for filesystem mocking.
80
83
81
-
### 5. Running Tests
84
+
### 6. Running Tests
85
+
86
+
Only run tests when test files are modified or explicitly requested.
82
87
83
88
**Choose test command based on modified directory:**
@@ -104,3 +109,7 @@ yarn test:base -- --testNamePattern="pattern" # Run specific test name
104
109
```
105
110
106
111
Tests require `--expose-gc --max-old-space-size=4096 --experimental-vm-modules` (already configured in scripts).
112
+
113
+
### 7. Updating Examples (if needed)
114
+
115
+
If WebpackOptions were added or modified, consider adding or updating relevant examples in `examples/`. This step is typically done after running tests.
0 commit comments