GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: minify a precompiled check by alexander-akait · Pull Request #235 · webpack/schema-utils

Conversation

@alexander-akait

@alexander-akait alexander-akait commented Oct 18, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Summary

A check from schema-utils precompile is loaded every time the tool that ships it starts. For webpack's own options it comes out at 983 KB and takes ~21 ms to load. webpack's tooling/precompile-schemas.js produces 423 KB that loads in ~13 ms, so webpack can't switch to schema-utils precompile without slowing every start.

--minify (or precompile(schema, { minify: true })) closes that gap:

  • Drops the error objects a check never reports. This uses the same regex as webpack's tooling.
  • Inlines equal and ucs2length. Both are small and self-contained, and loading them through schema-utils/dist/runtime costs ~1.3 ms, more than a check takes to run. uri still comes from the runtime.
  • Defines the absolutePath regex once with ajv's gen.scopeValue, instead of writing it out at every use (56 places for webpack) and creating a new RegExp on every call.
  • Minifies with terser, using the same settings as webpack. terser is an optional peer dependency, loaded only for minify, with a clear error when it's missing. ES module checks are minified as modules.

Measurements

webpack's WebpackOptions.json, median of 21 fresh Node 22 processes:

Size Load First call
precompile (current) 983 KB 21.0 ms 4.3 ms
precompile --minify 438 KB 13.2 ms 3.9 ms
webpack's own check 423 KB 13.2 ms 3.7 ms

The remaining ~15 KB is ucs2length. webpack's check uses .length for minLength, which accepts a single emoji for minLength: 2 where validate rejects it. That's the unsafe direction for a check, so the minified check keeps counting characters the way validate does.

Compatibility

Without --minify, the output is byte-identical to 4.7. Checks already committed, such as minimizer-webpack-plugin's, stay up to date under --check. All of the changes above apply only with --minify.

Tests

  • I ran the full parity suite (every schema/value case compares a check with full validation) once locally with every check minified. All 1038 cases agree.
  • New tests:
    • no error objects or requires, and the regex written once;
    • correct results, including astral characters, enum objects and absolutePath;
    • ES module output stays an ES module;
    • the error when terser is missing;
    • the CLI: --minify writes the minified check, and --check with --minify passes on it, while --check without --minify reports it out of date.
  • npm run lint and the full suite (1043 tests) pass. Coverage is 100% statements in cli.js and 99% in precompile.js.

Generated by Claude Code

Summary by CodeRabbit

  • New Features
    • Added a --minify option to precompilation, also available through the precompile API. It generates smaller checks that load faster while preserving validation behavior.
    • Minification omits error details a check would not report. Terser must be installed to use this option.
  • Documentation
    • Updated precompilation guidance with minification details and performance examples. Use the same minification setting when generating and checking precompiled output.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@alexander-akait @claude
feat: minify a precompiled check
dd1e1a5
`schema-utils precompile --minify` and `precompile(schema, { minify: true })`
drop the error objects a check never reports, write the `equal` and
`ucs2length` helpers into the check instead of loading them from
`schema-utils`, keep the `absolutePath` regex in one constant, and minify
with terser, an optional peer dependency.

For webpack's options the check goes from 983 KB to 438 KB and loads in
13ms instead of 21ms, the same as webpack's own tooling/precompile-schemas.js
output, while still counting characters the way `validate` does.

Without --minify the output is byte-identical, so checks generated with
4.6/4.7 stay up to date.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYPkbvwyRWt2SHgXDoYRdo
@codecov

codecov Bot commented Oct 18, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.21%. Comparing base (f0e381d) to head (665060b).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #235      +/-   ##
==========================================
+ Coverage   97.17%   97.21%   +0.03%     
==========================================
  Files          13       13              
  Lines        1204     1220      +16     
  Branches      465      472       +7     
==========================================
+ Hits         1170     1186      +16     
  Misses         32       32              
  Partials        2        2              
Flag Coverage Δ
integration 97.21% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 34 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 46fec07d-1e37-445d-a346-89099cb462f7
📥 Commits

Reviewing files that changed from the base of the PR and between 1a6ba01 and 665060b.

⛔ Files ignored due to path filters: 1
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing: 7
  • .changeset/precompile-minify.md
  • README.md
  • declarations/precompile.d.ts
  • package.json
  • src/cli.js
  • src/precompile.js
  • test/precompile.test.js

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ff8dde11-a15a-47c1-8f6d-2321a3fee516
📥 Commits

Reviewing files that changed from the base of the PR and between dd1e1a5 and 1a6ba01.

📒 Files selected for processing: 2
  • src/precompile.js
  • test/precompile.test.js
🚧 Files skipped from review as they are similar to previous changes: 1
  • test/precompile.test.js

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

Walkthrough

The precompile API and CLI now support a minify option. When enabled, code generation inlines selected helpers and uses Terser to minify generated checks. The option is documented, and tests cover generated output, validation behavior, missing Terser, and CLI checks.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 1a6ba

Minified checks preserve the reported schema-pattern behavior, and no actionable merge risk remains.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: adding minification for precompiled checks.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 5 files.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
  • X
  • Mastodon
  • Reddit
  • LinkedIn

Comment @coderabbitai help to get the list of available commands.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

coderabbitai[bot]
coderabbitai Bot reviewed Oct 18, 2026
View reviewed changes

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ee8e9462-fa2b-4ee7-8706-ae4b63d0659e
📥 Commits

Reviewing files that changed from the base of the PR and between f0e381d and dd1e1a5.

⛔ Files ignored due to path filters: 1
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing: 8
  • .changeset/precompile-minify.md
  • README.md
  • declarations/precompile.d.ts
  • package.json
  • src/cli.js
  • src/precompile.js
  • test/helpers/precompiled.js
  • test/precompile.test.js

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/precompile.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

alexander-akait and others added 2 commits October 18, 2026 19:03
@alexander-akait @claude
fix: strip only the error objects ajv assigns
1a6ba01
The regex removing error objects also matched a schema string or pattern
that only looked like one, such as `\{instancePathx,keyword:y,`, and
changed what it matched. It now needs the assignment and the exact shape
ajv writes. webpack's minified options check is byte-identical.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYPkbvwyRWt2SHgXDoYRdo
@alexander-akait @claude
feat: minify precompiled checks with webpack's minifier
665060b
Use webpack's own JavaScript minifier (webpack 5.112.0 or later, an
optional peer) instead of terser, so --minify needs nothing beyond
webpack itself.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYPkbvwyRWt2SHgXDoYRdo
@socket-security

socket-security Bot commented Oct 18, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedwebpack@​5.110.3 ⏵ 5.112.081 -1210093 +197 -2100

View full report

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@alexander-akait
alexander-akait merged commit 898f9a0 into main Oct 18, 2026
33 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@alexander-akait
alexander-akait deleted the feat/precompile-minify branch October 18, 2026 21:53
@github-actions github-actions Bot mentioned this pull request Oct 18, 2026
chore(release): new release #236
Merged
This was referenced Oct 18, 2026
build: precompile schemas with schema-utils webpack/webpack#22774
Merged
fix: bundle schema-utils without errors or warnings #238
Merged
@SergeyMaltsev SergeyMaltsev mentioned this pull request Oct 19, 2026
Angular webpack demos fail to build after schema-utils 4.8.0 added peer webpack bryntum/bryntum#13974
Closed
@lorenzodallavecchia

lorenzodallavecchia commented Oct 19, 2026

Copy link
Copy Markdown

Just letting you know that the new peer dependency breaks builds that already use a webpack 5.x version older than 5.112. Strictly speaking, this is a breaking change: we should have declared 5.0.0 as a peer dependency.
In most cases, the quickest solution is just updating webpack to 5.112 or later.

SchroederSteffen reacted with thumbs up emoji SchroederSteffen reacted with eyes emoji
All reactions
  • 👍 1 reaction
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SchroederSteffen

SchroederSteffen commented Nov 5, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Just letting you know that the new peer dependency breaks builds that already use a webpack 5.x version older than 5.112. Strictly speaking, this is a breaking change: we should have declared 5.0.0 as a peer dependency. In most cases, the quickest solution is just updating webpack to 5.112 or later.

This affects users of NestJS v11 which pins [email protected]: https://github.com/nestjs/nest-cli/blob/c8a68da18e5160e3a1a8291a2fc0d15026055c38/package.json#L57

npm ls webpack outputs:

└─┬ @nestjs/[email protected]
  ├─┬ [email protected]
  │ └─┬ [email protected]
  │   ├─┬ [email protected]
  │   │ ├─┬ [email protected]
  │   │ │ └── [email protected] deduped
  │   │ └── [email protected] deduped
  │   └─┬ [email protected]
  │     └── [email protected] deduped
  └─┬ [email protected]
    ├─┬ [email protected]
    │ └── [email protected] deduped invalid: "^5.112.0" from node_modules/@nestjs/cli/node_modules/webpack/node_modules/schema-utils
    └─┬ [email protected]
      ├─┬ [email protected]
      │ └── [email protected] deduped
      └── [email protected] deduped

npm error code ELSPROBLEMS

Opened nestjs/nest-cli#3674 for this.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SchroederSteffen SchroederSteffen mentioned this pull request Nov 5, 2026
v11: Upgrade webpack to at least 5.112.0 nestjs/nest-cli#3674
Closed
2 of 4 tasks
@alexander-akait alexander-akait mentioned this pull request Nov 6, 2026
fix: accept any webpack 5 as the optional peer dependency #244
Merged
alexander-akait added a commit that referenced this pull request Nov 6, 2026
@alexander-akait @claude
fix: accept any webpack 5 as the optional peer dependency (#244)
6dbe083
The ^5.112.0 peer range added in #235 broke installs that use an older
webpack 5 (e.g. NestJS CLI pins [email protected]): npm reports the peer
as invalid even though it is optional. Only precompile with minify needs
webpack 5.112.0+, and it already throws a clear error otherwise.


Claude-Session: https://claude.ai/code/session_013FhutRAVeDugCL2BfYpLty

Co-authored-by: Claude <[email protected]>
@SchroederSteffen

SchroederSteffen commented Nov 23, 2026

Copy link
Copy Markdown

The above issue was solved by #244 in 4.8.3, thanks!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@coderabbitai coderabbitai[bot] coderabbitai[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@alexander-akait @lorenzodallavecchia @SchroederSteffen
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.