Skip to content

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

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 lib/options.json, as the other webpack repos do. fix runs it first.
  • Keywords: schema-utils handles instanceof (Buffer, Function) itself and drops the documentation-only cli/link keywords. The custom generator re-implemented both.
  • Output: the check stays an ES module, because the package is "type": "module". It keeps the same path and default export, and imports no runtime helper. It goes from 174 KB to 54 KB.
  • 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.

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, types and spelling.
  • test/*.test.js passes in full (376 tests).
  • test/server passes apart from the two '::'/'::1' host tests. Those fail locally with EAFNOSUPPORT only because the container has no IPv6.
  • I didn't run the e2e and CLI suites locally.

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

  • Bug Fixes
    • Minimum-length checks for option values now count Unicode characters correctly, treating characters represented by surrogate pairs as one character.
  • Performance
    • The options validator is smaller and loads faster. Existing validation rules, including checks for allowed values, types, and numeric limits, remain in place.

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 174 KB to 54 KB.
@changeset-bot

changeset-bot Bot commented Nov 20, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: cc31692

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-server 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.1 ⏵ 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 schema lint and fix scripts now use minified schema-utils precompilation. The standalone Ajv generator and the Ajv development dependency are removed. The generated validator and its declarations are updated. String minimum-length validation now counts Unicode code points. A patch changeset documents the precompilation command.

Merge Risk: Minimal · up to cc316

This change replaces the custom schema-check generator with the schema-utils precompile command and regenerates the validator. 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, replacing the custom generator script. The raw summary confirms the custom generator `scripts/genera…
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, replacing the custom generator script. The raw summary confirms the custom generator scripts/generate-schema-check.mjs was deleted and package.json scripts now call schema-utils precompile. The title uses the conventional refactor: prefix and is concise. It does not mention the dependency bumps or the size reduction, which is acceptable because it need not cover every detail.

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: 9f87e1ec-5c06-4add-891e-618c084cbadf
Commits

Reviewing files that changed from the base of the PR and between 796262e and cc31692.

Files ignored due to path filters: 1

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

  • .changeset/schema-utils-precompile.md
  • lib/options.check.js
  • package.json
  • scripts/generate-schema-check.mjs
  • types/lib/options.check.d.ts
Files with no reviewable changes: 1

  • scripts/generate-schema-check.mjs

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 95.91%. Comparing base (796262e) to head (cc31692).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5809   +/-   ##
=======================================
  Coverage   95.91%   95.91%           
=======================================
  Files           6        6           
  Lines        5707     5709    +2     
=======================================
+ Hits         5474     5476    +2     
  Misses        233      233           

☔ 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 c7156a3 into main Nov 20, 2026
17 checks passed
@alexander-akait
alexander-akait deleted the refactor/schema-utils-precompile branch November 20, 2026 12:26
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