feat(core): add ManifestStore.fromBundle for bundled artifacts#5876
Conversation
Add `ManifestStore.fromBundle(data, baseDir)` that creates a store from pre-validated bundled manifest data, skipping the lockfile / config fingerprint checks that would fail for a frozen artifact shipped across environments. Only the manifest `version` field is validated — the caller (bundler) is responsible for guaranteeing the data matches the artifact. Required by the upcoming @eggjs/egg-bundler to bootstrap a bundled Egg app without re-running filesystem discovery.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces a fromBundle static method to the ManifestStore class, allowing the creation of a store from pre-validated bundled data while skipping standard invalidation checks. The review feedback suggests improving the robustness of this new method by adding null checks for the input data, verifying the presence of required properties like invalidation, and including a debug log for better observability.
There was a problem hiding this comment.
Pull request overview
Adds a new public factory API on @eggjs/core’s ManifestStore to support bundled runtime artifacts by constructing a store from pre-validated manifest data and bypassing the normal invalidation checks.
Changes:
- Add
ManifestStore.fromBundle(data, baseDir)for bundled startup paths - Validate bundled manifest version before constructing the store
Deploying egg-v3 with
|
| Latest commit: |
60804b3
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://04a1b50d.egg-v3.pages.dev |
| Branch Preview URL: | https://split-05-core-from-bundle.egg-v3.pages.dev |
Deploying egg with
|
| Latest commit: |
60804b3
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://fcab2648.egg-cci.pages.dev |
| Branch Preview URL: | https://split-05-core-from-bundle.egg-cci.pages.dev |
Adds static `ManifestStore.fromBundle(data, baseDir)` that creates a store from pre-validated bundled manifest data, skipping lockfile/config fingerprint checks. Part of #5863 split. Tracking: #5871. Stacked on: #5867 (A1) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
## Summary Source branch: origin/split/01-utils-bundle-module-loader Base: origin/next @ 101ab97 Patch-equivalence checks showed several source commits had equivalent counterparts already on next, but review-fix deltas were still missing or had evolved under different SHAs. This PR ports the equivalent patch set onto latest next without merging the old split branch history. Ported source commits / equivalent patches: - a4430eb feat(core): add ManifestStore.fromBundle for bundled artifacts (#5876) - 141d261 feat(core): add ManifestStore.setBundleStore hook (#5877) - 4cb2192 fix(bundler): address externals resolver review - af022dc fix(bundler): bundle framework packages by default - c26d172 fix(bundler): harden manifest loader normalization - 963fa03 fix(bundler): disable manifest auto generation default - 6f7b8f5 fix(core): restore global bundle store typing - 0d816c2 fix(bundler): address manifest loader review - ff1eba3 fix(bundler): address manifest subprocess review - ebb103d fix(bundler): emit only worker entry in single mode Already covered on next by equivalent/evolved commits and not re-applied directly: - 3e8b6c8 feat(bundler): add ExternalsResolver - f47dedc feat(bundler): add ManifestLoader with realpath normalization - 36bf376 fix(bundler): address entry generator review - scaffold/public API/PackRunner commits that would regress newer Bundler and egg-bin changes if replayed wholesale ## Validation - pnpm vitest run packages/core/test/loader/manifest.test.ts - pnpm --filter @eggjs/egg-bundler test -- test/EntryGenerator.test.ts test/ExternalsResolver.test.ts test/ManifestLoader.test.ts test/integration.test.ts - pnpm --filter @eggjs/core typecheck - pnpm --filter @eggjs/egg-bundler typecheck - pnpm --filter @eggjs/egg-bundler lint <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Package exports now declare types and import targets for better TypeScript support * Manifest auto-generation is opt-in by default * **New Features** * Bundler now emits a single worker entry (no standalone agent entry by default) * **Bug Fixes** * Stronger validation and clearer errors for bundled manifests * Bundle usage respects base-directory and environment isolation * Optional dependencies are considered for externalization; framework packages are bundled by default * **Tests** * Expanded coverage for manifest loading, bundling, externals, and generation flows <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Adds static
ManifestStore.fromBundle(data, baseDir)that creates a store from pre-validated bundled manifest data, skipping lockfile/config fingerprint checks.Part of #5863 split. Tracking: #5871. Stacked on: #5867 (A1)
🤖 Generated with Claude Code