GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat(html): add optimization.minimize.html.tagOmission by aryanraj45 · Pull Request #21678 · webpack/webpack Conversation
|
🦋 Changeset detectedLatest commit: 80c2109 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 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Note
|
| Layer / File(s) | Summary |
|---|---|
Option contract and wiring schemas/WebpackOptions.json, lib/util/SourceProcessor.js, lib/html/htmlMinify.js |
Adds the tagOmission option and forwards it from HTML minimization to the print context. |
Shell-tag printing tooling/generate-html-data.js, lib/html/syntax.js |
Adds shell-tag eligibility data and conditionally omits eligible <html>, <head>, and <body> tags. |
Configuration and validation test/configCases/html/minimize-tag-omission/*, test/configCases/html/minimize-tag-omission-keep-head-body/*, .changeset/159-html-tag-omission.md |
Adds webpack configuration cases, fixtures, output assertions, and a release note for the new option. |
Possibly related PRs
lib/html/syntax.js.tagOmission.| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title uses the required Conventional Commit format and accurately describes the added HTML tag omission option. |
| 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. |
Comment @coderabbitai help to get the list of available commands.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
tooling/generate-html-data.js (1)
1238-1243: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winCommit the generated HTML data module.
lib/html/syntax.jsnow readsBODY_START_KEPT_BEFORE, but this PR only changes its generator. Without the regenerated export, the imported value isundefined. WithtagOmission: trueand a body that starts with an element,_canOmitShellStartcalls.has()and throws.Regenerate and commit the generated HTML data output.
Also applies to: 1306-1311
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tooling/generate-html-data.js` around lines 1238 - 1243, Regenerate and commit the generated HTML data module so the output exports BODY_START_KEPT_BEFORE alongside the entries listed in EXPORT_NAMES. Ensure lib/html/syntax.js receives a defined set for _canOmitShellStart when tagOmission is enabled, rather than leaving the generated import undefined.
test/configCases/html/minimize-tag-omission/index.js (1)
6-6: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winReplace both tautological entry assertions with behavior checks.
Both entry tests assert a constant instead of verifying tag omission.
test/configCases/html/minimize-tag-omission/index.js#L6-L6: Assert unrestricted shell-tag omission through generated HTML or parsed DOM output.test/configCases/html/minimize-tag-omission-keep-head-body/index.js#L4-L4: Assert that<head>and<body>remain while<html>tags are omitted.As per path instructions, tests must use explicit assertions for behavior, invariants, equivalences, and errors.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/configCases/html/minimize-tag-omission/index.js` at line 6, Replace the tautological assertion in test/configCases/html/minimize-tag-omission/index.js:6-6 with explicit assertions against generated HTML or parsed DOM output that verify unrestricted shell-tag omission. Also replace the tautological assertion in test/configCases/html/minimize-tag-omission-keep-head-body/index.js:4-4 with assertions confirming <head> and <body> remain while <html> tags are omitted.Source: Path instructions
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/html/syntax.js`:
- Around line 8611-8630: Update _canOmitShellStart so the body-omission branch
rejects a first text node when its initial character is HTML whitespace, rather
than relying on isAllWs(path.data(first)). Preserve omission for text beginning
with non-whitespace content, and add a regression fixture covering <body>
text</body>.
---
Outside diff comments:
In `@tooling/generate-html-data.js`:
- Around line 1238-1243: Regenerate and commit the generated HTML data module so
the output exports BODY_START_KEPT_BEFORE alongside the entries listed in
EXPORT_NAMES. Ensure lib/html/syntax.js receives a defined set for
_canOmitShellStart when tagOmission is enabled, rather than leaving the
generated import undefined.
---
Nitpick comments:
In `@test/configCases/html/minimize-tag-omission/index.js`:
- Line 6: Replace the tautological assertion in
test/configCases/html/minimize-tag-omission/index.js:6-6 with explicit
assertions against generated HTML or parsed DOM output that verify unrestricted
shell-tag omission. Also replace the tautological assertion in
test/configCases/html/minimize-tag-omission-keep-head-body/index.js:4-4 with
assertions confirming <head> and <body> remain while <html> tags are omitted.
Fix all unresolved CodeRabbit comments on this PR:
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 92c77e0a-c388-47dd-9b68-ccffbaf18760
declarations/WebpackOptions.d.ts is excluded by !declarations/**lib/html/data.js is excluded by !lib/html/data.jsschemas/WebpackOptions.check.js is excluded by !schemas/**/*.check.jstest/__snapshots__/Cli.basictest.js.snap is excluded by !**/*.snap, !test/**/__snapshots__/**test/configCases/html/minimize-tag-omission-keep-head-body/__snapshots__/ConfigCacheTest.snap is excluded by !**/*.snap, !test/**/__snapshots__/**test/configCases/html/minimize-tag-omission-keep-head-body/__snapshots__/ConfigTest.snap is excluded by !**/*.snap, !test/**/__snapshots__/**test/configCases/html/minimize-tag-omission/__snapshots__/ConfigCacheTest.snap is excluded by !**/*.snap, !test/**/__snapshots__/**test/configCases/html/minimize-tag-omission/__snapshots__/ConfigTest.snap is excluded by !**/*.snap, !test/**/__snapshots__/**types.d.ts is excluded by !types.d.ts.changeset/159-html-tag-omission.mdlib/html/htmlMinify.jslib/html/syntax.jslib/util/SourceProcessor.jsschemas/WebpackOptions.jsontest/configCases/html/minimize-tag-omission-keep-head-body/index.jstest/configCases/html/minimize-tag-omission-keep-head-body/page.htmltest/configCases/html/minimize-tag-omission-keep-head-body/test.config.jstest/configCases/html/minimize-tag-omission-keep-head-body/webpack.config.jstest/configCases/html/minimize-tag-omission/head-content.htmltest/configCases/html/minimize-tag-omission/index.jstest/configCases/html/minimize-tag-omission/kept-comment.htmltest/configCases/html/minimize-tag-omission/page.htmltest/configCases/html/minimize-tag-omission/test.config.jstest/configCases/html/minimize-tag-omission/webpack.config.jstooling/generate-html-data.jsCodeRabbit considers these linked repositories for cross-repo context during reviews:
webpack/schema-utils (auto-detected)webpack/tapable (auto-detected)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
§13.1.2.4 asks whether the first thing inside is whitespace, and isAllWs only rejected an all-whitespace node, so " text" dropped the tag and the space then landed in <head> on reparse. Same test for the whitespace after </head>.
|
Fixed in the main, co-author with you, thanks for working on it |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
thanks! closing #21694 in favour of this as yours covers it and does both directions, mine only did the forward scan |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.