Repository navigation
build: precompile schemas with schema-utils - #22774
Conversation
tooling/precompile-schemas.js now calls schema-utils' precompile with minify instead of carrying its own ajv keywords, error stripping and terser pass, so webpack's checks are built the same way as every plugin's and loader's. The checks are minified with webpack's own minifier, so the lint job links webpack like the test jobs do. Drops the ajv and commondir devDependencies.
🦋 Changeset detectedLatest commit: 4cab217 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.
|
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters: 32
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Change: Refactor Merge Risk: ⚪ Minimal · up to
|
|
This PR is packaged and the instant preview is available (b77c2d8). Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@b77c2d8
yarn add -D webpack@https://pkg.pr.new/webpack@b77c2d8
pnpm add -D webpack@https://pkg.pr.new/webpack@b77c2d8 |
Types CoverageCoverage after merging build/precompile-schemas-with-schema-utils into main will be
Coverage Report |
Generated code sizeComparing base (
Read No asset changed size. No runtime gained or lost a runtime module. Built |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #22774 +/- ##
==========================================
+ Coverage 96.49% 96.50% +0.01%
==========================================
Files 778 778
Lines 137417 137804 +387
Branches 46599 46827 +228
==========================================
+ Hits 132602 132991 +389
+ Misses 4815 4813 -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:
|
The schema-utils imports moved only with a stale local node_modules; a clean install generates the same types.d.ts as main.
|
The fix is webpack/schema-utils#238. Bundling Generated by Claude Code |
4.8.1 bundles without errors or warnings, which test/cases/large/big-assets needs now that the tooling uses schema-utils precompile.
#22754 changed what webpack's minifier writes, which the checks are now minified with.
Merging this PR will degrade performance by 81.18%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Memory | unit benchmark "html-printer-document-unit", beautify (wide table) |
34.4 KB | 183 KB | -81.18% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing build/precompile-schemas-with-schema-utils (4cab217) with main (f9705a6)
Footnotes
-
212 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [webpack](https://github.com/webpack/webpack) | [`5.112.0` → `5.112.2`](https://renovatebot.com/diffs/npm/webpack/5.112.0/5.112.2) |  |  | --- >⚠️ **Warning** > > Some dependencies could not be looked up. Check the [Dependency Dashboard](issues/99) for more information. --- ### Release Notes <details> <summary>webpack/webpack (webpack)</summary> ### [`v5.112.2`](https://github.com/webpack/webpack/blob/HEAD/CHANGELOG.md#51122) [Compare Source](webpack/webpack@v5.112.1...v5.112.2) ##### Patch Changes - Reduce repeated scans when concatenating imported modules. (by [@​xiaoxiaojx](https://github.com/xiaoxiaojx) in [#​22865](webpack/webpack#22865)) - Avoid allocating CSS module sets for single-group chunks. (by [@​xiaoxiaojx](https://github.com/xiaoxiaojx) in [#​22866](webpack/webpack#22866)) - Return the value of every module type loaded with `importModule()`. (by [@​alexander-akait](https://github.com/alexander-akait) in [#​22869](webpack/webpack#22869)) ### [`v5.112.1`](https://github.com/webpack/webpack/blob/HEAD/CHANGELOG.md#51121) [Compare Source](webpack/webpack@v5.112.0...v5.112.1) ##### Patch Changes - Rebuild a lazy barrel in watch when what it defers changes, and keep the imports and re-exports it still runs. (by [@​aryanraj45](https://github.com/aryanraj45) in [#​22699](webpack/webpack#22699)) - Rebuild under `cacheUnaffected` a module whose re-export target goes or returns. (by [@​aryanraj45](https://github.com/aryanraj45) in [#​22749](webpack/webpack#22749)) - Fix "Self-reference dependency has unused export name" for CommonJS namespace re-exports. (by [@​alexander-akait](https://github.com/alexander-akait) in [#​22791](webpack/webpack#22791)) - Fix `exportType: "style"` CSS modules throwing outside the runtime chunk. (by [@​lazerg](https://github.com/lazerg) in [#​22833](webpack/webpack#22833)) - Fix crash when a CSS module with `exportType: "style"` imports an ignored stylesheet. (by [@​codeXsidd](https://github.com/codeXsidd) in [#​22846](webpack/webpack#22846)) - Keep empty process environment variables that `.env` files don't define in `DotenvPlugin`. (by [@​alexander-akait](https://github.com/alexander-akait) in [#​22794](webpack/webpack#22794)) - Rehash an ESM entry chunk when a chunk it imports by file name changes. (by [@​alexander-akait](https://github.com/alexander-akait) in [#​22804](webpack/webpack#22804)) - Handle a NUL inside an HTML CDATA section the way the parsing spec does. (by [@​dependabot](https://github.com/apps/dependabot) in [#​22811](webpack/webpack#22811)) - Keep module exports live across chunks, runtimes, HMR and eval, sparing globals. (by [@​alexander-akait](https://github.com/alexander-akait) in [#​22733](webpack/webpack#22733)) - Await asynchronous modules that `ProvidePlugin` injects into ES modules. (by [@​alexander-akait](https://github.com/alexander-akait) in [#​22728](webpack/webpack#22728)) - Keep a resolve that ends after the compiler closed from throwing. (by [@​alexander-akait](https://github.com/alexander-akait) in [#​22795](webpack/webpack#22795)) - Preserve string names passed to SharedWorker constructors. (by [@​bjohansebas](https://github.com/bjohansebas) in [#​22770](webpack/webpack#22770)) - Preserve string contents when extracting source map comments. (by [@​bjohansebas](https://github.com/bjohansebas) in [#​22768](webpack/webpack#22768)) - Scope strict-mode, async and generator block function declarations to their block. (by [@​alexander-akait](https://github.com/alexander-akait) in [#​22800](webpack/webpack#22800)) - Preserve raw dotenv values when reusing cached environment files. (by [@​Eshiv-Pandey](https://github.com/Eshiv-Pandey) in [#​22787](webpack/webpack#22787)) - Preserve assigned or patched built-ins, conversions and pattern targets. (by [@​aryanraj45](https://github.com/aryanraj45) in [#​22761](webpack/webpack#22761)) - Keep globals a `globalThis` write replaces, and `slice` on a patched array. (by [@​alexander-akait](https://github.com/alexander-akait) in [#​22862](webpack/webpack#22862)) - Skip HTML script tags for shared chunks that emit no JavaScript. (by [@​bjohansebas](https://github.com/bjohansebas) in [#​22779](webpack/webpack#22779)) - Keep the digits Firefox lays out a minified CSS percentage with. (by [@​alexander-akait](https://github.com/alexander-akait) in [#​22718](webpack/webpack#22718)) - Reject a second `srcset` descriptor after a `0x` density descriptor. (by [@​alexander-akait](https://github.com/alexander-akait) in [#​22741](webpack/webpack#22741)) - Minify JavaScript faster, folding string methods on constants and `x -= 1`. (by [@​alexander-akait](https://github.com/alexander-akait) in [#​22823](webpack/webpack#22823)) - Shorten minified JavaScript, and keep it running like its source. (by [@​alexander-akait](https://github.com/alexander-akait) in [#​22717](webpack/webpack#22717)) - Drop more unused functions, arguments, calls, global reads and variable copies when minifying JavaScript. (by [@​alexander-akait](https://github.com/alexander-akait) in [#​22789](webpack/webpack#22789)) - Minify JavaScript smaller where swc does, and fold a function's `length` right. (by [@​alexander-akait](https://github.com/alexander-akait) in [#​22826](webpack/webpack#22826)) - Reduce JavaScript output size where oxc or swc produce smaller output. (by [@​alexander-akait](https://github.com/alexander-akait) in [#​22829](webpack/webpack#22829)) - Update watchpack to 2.6.3 and rebuild on a `node_modules` created mid-build. (by [@​alexander-akait](https://github.com/alexander-akait) in [#​22743](webpack/webpack#22743)) - Support `concatenateModules` with `cacheUnaffected`. (by [@​alexander-akait](https://github.com/alexander-akait) in [#​22746](webpack/webpack#22746)) - Update schema-utils to 4.8.1. (by [@​alexander-akait](https://github.com/alexander-akait) in [#​22774](webpack/webpack#22774)) - Keep CSS fallbacks, vendor overrides, `oklch()` hues and HTML elements. (by [@​alexander-akait](https://github.com/alexander-akait) in [#​22753](webpack/webpack#22753)) - Validate `CleanPlugin` and `DotenvPlugin` options with a precompiled check, so valid options no longer compile their schema at startup. (by [@​alexander-akait](https://github.com/alexander-akait) in [#​22758](webpack/webpack#22758)) - Speed up startup and CSS minification, sharing the compile cache with workers. (by [@​xiaoxiaojx](https://github.com/xiaoxiaojx) in [#​22706](webpack/webpack#22706)) - Use precise, generic types for modules, parsers, generators, stats and loaders. (by [@​alexander-akait](https://github.com/alexander-akait) in [#​22731](webpack/webpack#22731)) </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - "before 9am on tuesday" - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xNzUuMSIsInVwZGF0ZWRJblZlciI6IjQ0LjE3NS4xIiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZSJdfQ==--> Reviewed-on: https://code.futo.org/harbor/harbor/pulls/2035
Summary
tooling/precompile-schemas.jshad its own ajv setup: custom keywords, error-object stripping and a terser pass. Now it callsprecompile(schema, { minify: true })fromschema-utils(webpack/schema-utils#235), which does the same job. webpack's checks are now built the same way as every plugin's and loader's, and the script goes from 336 lines to 83.minifyuses webpack's own minifier, loaded aswebpack, so the lint job now runsyarn link/yarn link webpacklike the test jobs (and like_SETUP.mdasks of contributors). A change to the minifier's output can therefore restale the checks, whichlint:specialreports.schema-utilsgoes to^4.8.1. That release includes fix: bundle schema-utils without errors or warnings schema-utils#238, soschema-utilsbundles without errors or warnings, whichtest/cases/large/big-assetsneeds.ajvandcommondirdevDependencies are dropped.types.d.tsis unchanged.WebpackOptionschecks agree on all 4,021 configs intest/{config,watch,hot,stats}Cases. Two small differences:minLengthis now counted like the full validation, by code points;Falsyarray item that isundefined(inplugins,rulesand similar) is set tonull. webpack skips both.WebpackOptions.check.jsAll 43 checks together go from 613,573 B to 619,331 B.
What kind of change does this PR introduce?
build
Did you add tests for your changes?
No new tests. The generated checks are covered by the existing validation tests, and
lint:specialfails when one is stale. In a clean checkout,yarn lintandtest/cases/large/big-assetspass. Intest:unitandtest:basic, the only local failures also fail on unmodifiedmainin the same environment.Does this PR introduce a breaking change?
No.
If relevant, what needs to be documented once your changes are merged or what have you already documented?
n/a
Use of AI
Claude Code wrote the change, ran the comparisons and measurements above, and drafted this description; I reviewed the result.
Generated by Claude Code
Summary by CodeRabbit