Skip to content

refactor: generate the options check with schema-utils precompile - #2511

Merged
alexander-akait merged 1 commit into
mainfrom
refactor/schema-utils-precompile
Nov 20, 2026
Merged

alexander-akait merged 1 commit into
mainfrom
refactor/schema-utils-precompile

Conversation

@alexander-akait

@alexander-akait alexander-akait commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Summary

This replaces the custom scripts/generate-schema-check.mjs with schema-utils precompile --minify. That command now ships in schema-utils 4.8.5, so the repo no longer needs its own generator.

  • Scripts: lint:schema and fix:schema (renamed from lint:schema-check/fix:schema-check) run schema-utils precompile [--check] --minify src/options.json, as the other webpack repos do. fix runs it first.
  • Keywords: schema-utils handles instanceof itself, including Buffer, Function and RegExp. It also drops the documentation-only keywords. The custom generator re-implemented both of these.
  • Size: src/options.check.js goes from 95 KB to 29 KB, because the minified check leaves out the error objects a check never reports. It stays CommonJS, at the same path, and needs no runtime helper.
  • Dependencies:
    • schema-utils is bumped to ^4.8.5.
    • The ajv devDependency is removed, since only the script used it.
    • The webpack devDependency is bumped to ^5.113.0, which the minifier needs. The logging snapshots lose webpack/runtime/global, which 5.113 no longer emits for these builds.

What kind of change does this PR introduce?

refactor

Did you add tests for your changes?

The existing test/schema-check.test.js covers the new check. npm run lint passes, including lint:schema and types. The jest suite without e2e passes except two writeToDisk EACCES tests. Those fail locally only because the tests ran as root, where chmod doesn't block writes.

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?

Nothing.


Generated by Claude Code

Summary by CodeRabbit

  • Performance
    • Options validation now uses a precompiled check that is approximately one-third the size and faster to load.
  • Bug Fixes
    • Options validation continues to enforce the existing constraints. Validation errors now provide fewer details, reporting parameters without paths, keywords, or messages.

Replace the custom `scripts/generate-schema-check.mjs` with
`schema-utils precompile --minify`, which handles the `instanceof`
keyword and the documentation-only keywords itself, and minifies the
check from 95 KB to 29 KB.
@changeset-bot

changeset-bot Bot commented Nov 20, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6b7754f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
webpack-dev-middleware Patch

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

@socket-security

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.112.2 ⏵ 5.113.091 +1010093 +197100
Updatedschema-utils@​4.8.3 ⏵ 4.8.599 +110010097100

View full report

@coderabbitai

coderabbitai Bot commented Nov 20, 2026

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The options validator workflow now uses schema-utils precompile instead of the removed Ajv-based generator. The generated validator and its declarations are updated, and the package scripts and development dependencies change. Three verbose webpack stats snapshots remove the webpack/runtime/global module entry. A Changeset records a patch release.

Merge Risk: Minimal · up to 6b775

This change replaces the custom options-validator generator with schema-utils' own precompile command and shrinks the generated check. It also updates the webpack dev dependency and some test snapshots. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: the options check is now generated with schema-utils precompile instead of the custom generator. The title uses the refactor: prefix, which fits a change that remo…
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.
Full details: Title check

Explanation

The title names the main change: the options check is now generated with schema-utils precompile instead of the custom generator. The title uses the refactor: prefix, which fits a change that removes the custom generator and keeps behavior the same. The title does not mention the dependency bumps or the changed logging snapshots, but those are secondary details.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b62f717e-d9c9-4da3-8674-415824073804
Commits

Reviewing files that changed from the base of the PR and between e9aee43 and 6b7754f.

Files ignored due to path filters: 1

  • package-lock.json is excluded by !**/package-lock.json
Files selected for processing: 6

  • .changeset/schema-utils-precompile.md
  • package.json
  • scripts/generate-schema-check.mjs
  • src/options.check.js
  • test/__snapshots__/logging.test.js.snap.webpack5
  • types/options.check.d.ts
Files with no reviewable changes: 2

  • scripts/generate-schema-check.mjs
  • test/snapshots/logging.test.js.snap.webpack5

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

@codecov

codecov Bot commented Nov 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.97%. Comparing base (e9aee43) to head (6b7754f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2511   +/-   ##
=======================================
  Coverage   96.97%   96.97%           
=======================================
  Files          25       25           
  Lines        2711     2711           
=======================================
  Hits         2629     2629           
  Misses         82       82           

☔ 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.

@alexander-akait
alexander-akait merged commit c198ddc into main Nov 20, 2026
24 checks passed
@alexander-akait
alexander-akait deleted the refactor/schema-utils-precompile branch November 20, 2026 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant