Skip to content

docs(bundler): clarify metadata manifest and externals#5915

Merged
killagu merged 3 commits intonextfrom
agent/egg-doc/70eb664b
May 3, 2026
Merged

docs(bundler): clarify metadata manifest and externals#5915
killagu merged 3 commits intonextfrom
agent/egg-doc/70eb664b

Conversation

@killagu
Copy link
Copy Markdown
Contributor

@killagu killagu commented May 2, 2026

Summary: document metadataOnly manifest generation, clarify externals behavior for missing optional peer dependencies, and update the Egg Bundler wiki/log. Validation: git diff --check passed. pnpm exec oxfmt --check could not run because oxfmt is not installed in this checkout (node_modules is missing).

Summary by CodeRabbit

  • Documentation
    • Clarified manifest auto-generation fallback: the bundler now boots a temporary metadata-only instance to produce the manifest when missing (skips agent/normal boot and beforeClose hooks)
    • Updated externals/bundling guidance: detection runs against root dependencies, accounts for native addons and unresolved optional-peer names, and clarifies externals.inline vs externals.force
    • Added release log entry recording these docs updates

Copilot AI review requested due to automatic review settings May 2, 2026 18:05
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 2, 2026

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6aeab4b8-2e9c-4e60-8d32-0073cddcdac9

📥 Commits

Reviewing files that changed from the base of the PR and between fbd7361 and 1e82a25.

📒 Files selected for processing (2)
  • tools/egg-bundler/docs/output-structure.md
  • wiki/packages/egg-bundler.md
✅ Files skipped from review due to trivial changes (1)
  • tools/egg-bundler/docs/output-structure.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • wiki/packages/egg-bundler.md

📝 Walkthrough

Walkthrough

Documents egg-bundler behavior: when <baseDir>/.egg/manifest.json is missing, the bundler boots a temporary app with metadataOnly: true to run loadMetadata() and write the manifest; clarifies externals detection rules and externals.inline/externals.force semantics.

Changes

egg-bundler documentation updates

Layer / File(s) Summary
Behavior Summary / README
tools/egg-bundler/README.md
Documents startup-manifest fallback: missing <baseDir>/.egg/manifest.json triggers booting the app with metadataOnly: true, running loadMetadata() hooks, exiting the manifest-generation child process after writing the manifest, and suppressing beforeClose hooks.
Externals Rules
tools/egg-bundler/docs/output-structure.md
Rewrites "Externals": externals.force is always external; auto-detected externals include root peerDependencies/optionalDependencies, root dependencies with native addons/native binaries, and root dependencies whose optional peer deps cannot be resolved (including the missing package names). Native-addon and missing-optional-peer checks are performed only for the app root deps (non-recursive). externals.inline removes an auto-detected external unless it is also listed in externals.force. Updates default bundling wording for ESM-only packages, egg, @swc/helpers, and @eggjs/*.
Package Wiki
wiki/packages/egg-bundler.md
Updates updated_at and documents ManifestLoader missing-manifest handling (metadataOnly: true boot, loadMetadata() usage, skipped agent/normal lifecycle, suppressed beforeClose) and restates externals/bundling defaults and override semantics.
Wiki Log
wiki/log.md
Adds 2026-05-03 entry enumerating touched sources/pages and noting manifest auto-generation in metadataOnly mode and root-level externals detection and externals.inline behavior.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~4 minutes

Possibly related PRs

Suggested reviewers

  • jerryliang64

🐰
When manifest hides, I wake the app at dawn,
metadataOnly light, then write and yawn,
No agents stirred, no beforeClose chime,
Just hooks for metadata, then back to thyme.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'docs(bundler): clarify metadata manifest and externals' directly and clearly summarizes the main changes - it documents manifest generation and clarifies externals behavior across all four updated documentation files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/egg-doc/70eb664b

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
Review rate limit: 5/8 reviews remaining, refill in 20 minutes and 25 seconds.

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

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 2, 2026

Deploying egg with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1e82a25
Status: ✅  Deploy successful!
Preview URL: https://d82dfb5a.egg-cci.pages.dev
Branch Preview URL: https://agent-egg-doc-70eb664b.egg-cci.pages.dev

View logs

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the documentation for the egg-bundler tool, specifically detailing the manifest auto-generation process in metadataOnly mode and refining the list of externalized dependencies in the output structure and wiki. Feedback was provided to clarify that the automatic detection of native addons and missing optional peers by the ExternalsResolver applies specifically to root-level dependencies to prevent potential misconceptions.

Comment on lines +64 to +66
`optionalDependencies`, packages with native addons/native binaries, packages
whose optional peer dependencies are missing, and those missing optional peer
package names. They must be installed alongside the bundle — typically by
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The ExternalsResolver implementation only iterates over the application's root dependencies to auto-detect native modules and missing optional peers. It does not recursively scan the entire dependency tree. Clarifying that this auto-detection applies specifically to root-level packages prevents the misconception that all native modules in the tree are automatically handled.

Suggested change
`optionalDependencies`, packages with native addons/native binaries, packages
whose optional peer dependencies are missing, and those missing optional peer
package names. They must be installed alongside the bundle — typically by
`optionalDependencies`, root packages with native addons/native binaries, root
packages whose optional peer dependencies are missing, and those missing optional peer
package names. They must be installed alongside the bundle — typically by

Comment thread wiki/packages/egg-bundler.md Outdated
Comment on lines +47 to +48
`optionalDependencies`, native addons, packages with missing optional peers,
and the missing optional peer package names are external.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Consistent with the changes in output-structure.md, it's important to specify that the automatic externalization of native addons and packages with missing optional peers is limited to root dependencies. Deep dependencies with these characteristics are not automatically detected by the current ExternalsResolver logic.

Suggested change
`optionalDependencies`, native addons, packages with missing optional peers,
and the missing optional peer package names are external.
`optionalDependencies`, root packages with native addons, root packages with
missing optional peers, and the missing optional peer package names are external.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a 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

♻️ Duplicate comments (1)
wiki/packages/egg-bundler.md (1)

46-48: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Same clarity issue: missing optional peer dependencies.

This section contains the same ambiguous phrasing as in tools/egg-bundler/docs/output-structure.md (lines 64-66): "packages with missing optional peers, and the missing optional peer package names". Please apply the same clarification to maintain consistency across documentation.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@wiki/packages/egg-bundler.md` around lines 46 - 48, Rephrase the ambiguous
clause in the sentence that lists externals so it clearly distinguishes the
package entries that have unresolved optional peer deps from the actual package
names of those missing peers; replace "packages with missing optional peers, and
the missing optional peer package names are external" with wording like
"packages that declare optional peerDependencies which could not be resolved
(these packages are treated as external), and the names of the missing optional
peer packages themselves are also treated as external" so it matches the
clarification applied in tools/egg-bundler/docs/output-structure.md; update the
single sentence containing Explicit `externals.force` entries, root
`peerDependencies`, root `optionalDependencies`, native addons, ... to use this
clearer phrasing.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tools/egg-bundler/docs/output-structure.md`:
- Around line 64-72: The sentence about "packages whose optional peer
dependencies are missing, and those missing optional peer package names" is
ambiguous; update the text in output-structure.md to either merge into a single
clear phrase ("packages whose optional peer dependencies are missing") if they
mean the same thing, or explicitly describe the two distinct cases (1) packages
that list optional peer dependencies but those peer packages are not installed,
and (2) packages that only reference optional peer package names without
providing the actual packages — and clarify how each case is treated with
respect to bundling/externalization and ExternalsResolver/externals.force
behavior; reference the terms optionalDependencies, optional peer dependencies,
ExternalsResolver, and externals.force when clarifying.

---

Duplicate comments:
In `@wiki/packages/egg-bundler.md`:
- Around line 46-48: Rephrase the ambiguous clause in the sentence that lists
externals so it clearly distinguishes the package entries that have unresolved
optional peer deps from the actual package names of those missing peers; replace
"packages with missing optional peers, and the missing optional peer package
names are external" with wording like "packages that declare optional
peerDependencies which could not be resolved (these packages are treated as
external), and the names of the missing optional peer packages themselves are
also treated as external" so it matches the clarification applied in
tools/egg-bundler/docs/output-structure.md; update the single sentence
containing Explicit `externals.force` entries, root `peerDependencies`, root
`optionalDependencies`, native addons, ... to use this clearer phrasing.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 26406707-3173-4596-908d-8eab94dc58db

📥 Commits

Reviewing files that changed from the base of the PR and between 30514fa and 1afdfa9.

📒 Files selected for processing (4)
  • tools/egg-bundler/README.md
  • tools/egg-bundler/docs/output-structure.md
  • wiki/log.md
  • wiki/packages/egg-bundler.md

Comment thread tools/egg-bundler/docs/output-structure.md Outdated
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 2, 2026

Deploying egg-v3 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1e82a25
Status: ✅  Deploy successful!
Preview URL: https://5e4e748b.egg-v3.pages.dev
Branch Preview URL: https://agent-egg-doc-70eb664b.egg-v3.pages.dev

View logs

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates Egg bundler documentation to better reflect current manifest auto-generation behavior and how ExternalsResolver decides what stays external versus bundled.

Changes:

  • Documented startup manifest auto-generation when <baseDir>/.egg/manifest.json is missing (via metadataOnly: true run).
  • Clarified which dependency categories are externalized, including handling for missing optional peer dependencies.
  • Updated the wiki package page metadata and added a wiki log entry for the documentation refinement.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
wiki/packages/egg-bundler.md Updates wiki page metadata date and expands notes on manifest generation + externals rules.
wiki/log.md Adds a new log entry describing the bundler docs refinement.
tools/egg-bundler/docs/output-structure.md Refines externals explanation to include missing optional peer dependency behavior.
tools/egg-bundler/README.md Adds a short explanation of manifest auto-generation using metadataOnly mode.

Comment on lines +66 to +72
package names. They must be installed alongside the bundle — typically by
copying the app's `package.json` next to `worker.js` and running
`npm ci --omit=dev`, or by deploying into an environment where these
dependencies are already installed. ESM-only packages, `egg`, `@swc/helpers`,
and `@eggjs/*` packages are bundled by default unless `ExternalsResolver`
externalizes them through `externals.force`, dependency metadata, or native
addon detection.
Comment thread wiki/packages/egg-bundler.md Outdated
Comment on lines +46 to +50
- Explicit `externals.force` entries, root `peerDependencies`, root
`optionalDependencies`, native addons, packages with missing optional peers,
and the missing optional peer package names are external.
- ESM-only packages, `egg`, `@swc/helpers`, and `@eggjs/*` packages are bundled
by default unless force-external or dependency/native-addon rules apply.
@killagu killagu force-pushed the agent/egg-doc/70eb664b branch from 1afdfa9 to 2149996 Compare May 2, 2026 18:10
Copilot AI review requested due to automatic review settings May 2, 2026 18:11
@killagu killagu force-pushed the agent/egg-doc/70eb664b branch from 2149996 to 04a2ac0 Compare May 2, 2026 18:11
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment thread wiki/packages/egg-bundler.md Outdated
Comment on lines +42 to +44
with `metadataOnly: true` to generate it. This skips the agent and normal boot
lifecycle, runs `loadMetadata()` hooks, and skips registered `beforeClose`
hooks when the temporary app closes.
Comment thread tools/egg-bundler/README.md Outdated
Comment on lines +26 to +27
lifecycle, runs `loadMetadata()` hooks, and does not run registered
`beforeClose` hooks while closing the temporary app.
Copilot AI review requested due to automatic review settings May 2, 2026 18:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@killagu killagu merged commit 5219cd7 into next May 3, 2026
14 checks passed
@killagu killagu deleted the agent/egg-doc/70eb664b branch May 3, 2026 02:38
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.

2 participants