Repository navigation
feat: record the license banner in the asset info, URL built without path - #764
Conversation
…path Build the URL the default banner names the license file by from the asset names, which are URL paths, instead of path.relative. Record the comment written and that URL as `licenseBanner` in the asset info, so a tool that inlines the asset into another file can rebase the URL without matching the banner's wording.
🦋 Changeset detectedLatest commit: 3506364 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #764 +/- ##
==========================================
+ Coverage 97.67% 97.69% +0.02%
==========================================
Files 5 5
Lines 1718 1739 +21
Branches 664 671 +7
==========================================
+ Hits 1678 1699 +21
Misses 39 39
Partials 1 1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
npm audit reports four advisories against fast-uri up to 3.1.8, which fails the lint job's security step.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the
Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review.
|
There was a problem hiding this comment.
Actionable comments posted: 3

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:
a145ef2f-a014-4fdf-893f-220549e1b3e7
Files selected for processing: 4-
.changeset/license-banner-info.mdREADME.mdsrc/index.jstest/extractComments-option.test.js
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
-
A query can hold a `/`, which the relative URL would read as a directory.
1dbae2b to
317f692
Compare
Asset info merges field by field, so a banner without an `href` kept an earlier banner's. A result cached before the banner was recorded is now recomputed rather than restored without it.
Summary
When webpack inlines a minified chunk into an HTML page (
output.html.inline, webpack/webpack#22992), theextractCommentsbanner must name the license file from the page, not from the chunk. Today webpack finds the banner by matching its English wording, so a custombanneris never rebased. This PR records the banner in the asset info so a tool can rebase it exactly.path.relativefollowed by a backslash fix. The output is identical; all 837 existing snapshots pass unchanged.licenseBanner: { comment, href }, kept across cached rebuilds:What kind of change does this PR introduce?
feat
Did you add tests for your changes?
Yes, five tests in
test/extractComments-option.test.js: the default banner across directories, a cached rebuild, a custom function banner, a string banner naming no file, andbanner: false.Does this PR introduce a breaking change?
No. The banner text is unchanged; the asset info only gains a field.
If relevant, what needs to be documented once your changes are merged or what have you already documented?
Documented
licenseBannerin the README'sbannersection.Use of AI
Written with Claude Code: it found where the banner is built, wrote the change and tests, and ran the suite and lint. The requester chose the design and reviewed it.
Generated by Claude Code
Summary by CodeRabbit