Repository navigation
perf: pass a precompiled options check to getOptions - #1357
Conversation
Generate src/options.check.js with `schema-utils precompile --minify` and pass it to `this.getOptions`, so webpack 5.113.0 and later validate valid options without loading schema-utils or compiling the schema. Older webpack ignores the extra argument. Bump the webpack devDependency to ^5.113.0 so the tests run the check, and update the built-in CSS source map snapshots for its source names.
🦋 Changeset detectedLatest commit: da7add9 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 |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
No actionable comments were generated in the recent review. WalkthroughThe loader now passes a precompiled options checker to Merge Risk:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1357 +/- ##
=======================================
Coverage 96.72% 96.72%
=======================================
Files 2 2
Lines 1037 1038 +1
=======================================
+ Hits 1003 1004 +1
Misses 34 34 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
this.getOptions(schema)makes webpack loadschema-utilsand compile the options schema with ajv on the loader's first call. webpack 5.113.0 accepts a check precompiled withschema-utils precompile, which validates valid options without either step:schema-utilsvalidation, so the error messages are unchanged.src/options.check.jsis an ES module, generated bynpm run fix:schema.npm run lint:schemafails when it is out of date. Babel builds it into bothdist/esmanddist/cjs.schema-utils)Tests
validate-options.test.js: the check agrees with the schema on every value there, and options that are not an object never pass it.cssprefix, so the eight built-in CSS source map snapshots are updated.ValidationErrorfor invalid ones.npm run lint(types and schema check included) and the full test suite pass locally.Breaking change?
No. The peer range is unchanged. Older webpack ignores the second argument and validates against the schema as before.
Generated by Claude Code
Summary by CodeRabbit