feat: support JSON Schema const in CLI flag generation#21087
Conversation
Run webpack-cli in-process via its async run() against a mock of the webpack API (cli.getArguments/processArguments delegating to the real implementation over a schema covering every argument type, including const), injected through the documented WEBPACK_PACKAGE env var. Only process.exit/console.error are spied.
Collect flags from the then/else (and if) branches of a conditional schema so they are recognized as CLI options. The not keyword has no flag mapping and remains unsupported.
Thread a JSON-pointer originPath through the schema traversal and store it on each PathItem, then surface it in the conflicting-schema error so it points at the exact schema location.
Store only the per-node JSON pointer segment on each PathItem and join the ancestor chain into a full pointer on demand in the error, instead of growing the full string at every schema node during traversal.
🦋 Changeset detectedLatest commit: 332b1dd The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
This PR is packaged and the instant preview is available (135322b). Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@135322b
yarn add -D webpack@https://pkg.pr.new/webpack@135322b
pnpm add -D webpack@https://pkg.pr.new/webpack@135322b |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #21087 +/- ##
=======================================
Coverage 91.66% 91.66%
=======================================
Files 581 581
Lines 61089 61117 +28
Branches 16659 16674 +15
=======================================
+ Hits 55995 56025 +30
+ Misses 5094 5092 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merging this PR will degrade performance by 24.06%
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
webpack-cli requires a newer Node than webpack itself, so derive its minimum from webpack-cli's engines field and skip the suite on older Node.
No description provided.