Skip to content

fix: route loader runtime through manifest fs#5946

Open
killagu wants to merge 5 commits into
nextfrom
agent/egg-dev/c7776d34
Open

fix: route loader runtime through manifest fs#5946
killagu wants to merge 5 commits into
nextfrom
agent/egg-dev/c7776d34

Conversation

@killagu
Copy link
Copy Markdown
Contributor

@killagu killagu commented May 10, 2026

Summary

  • add a manifest-backed ManifestLoaderFS that can answer bundled file existence/stat/read/load calls from manifest data and generated bundle file hooks
  • route EggLoader plugin/config/package metadata loading through loaderFS instead of direct fs / utils.loadFile paths where possible
  • emit package metadata text into egg-bundler worker entries so bundled runtime can read plugin package.json without filesystem path replay

Validation

  • pnpm exec vitest run packages/core/test/loader/loader_fs.test.ts packages/core/test/loader/egg_loader.test.ts
  • pnpm --filter @eggjs/egg-bundler test -- EntryGenerator.test.ts
  • pnpm --filter @eggjs/core typecheck
  • pnpm --filter @eggjs/egg-bundler typecheck
  • pnpm exec oxlint --type-aware packages/core/src/global.ts packages/core/src/loader/egg_loader.ts packages/core/src/loader/loader_fs.ts packages/core/test/loader/egg_loader.test.ts packages/core/test/loader/loader_fs.test.ts tools/egg-bundler/src/lib/EntryGenerator.ts tools/egg-bundler/test/EntryGenerator.test.ts

Summary by CodeRabbit

  • New Features

    • Runtime hooks to access bundled text files and bundled modules, enabling package.json and other text resources to be embedded and read at runtime.
  • Refactor

    • Core loader now delegates filesystem and module operations to an abstracted loader with a manifest-backed virtual filesystem for bundled resources and caching.
  • Tests

    • Added tests covering manifest-backed file reads and delegated file/module loading.

Review Change Stack

Copilot AI review requested due to automatic review settings May 10, 2026 06:57
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 10, 2026

📝 Walkthrough

Walkthrough

This PR adds a global bundled text-file loader, implements ManifestLoaderFS to virtualize manifest/bundled paths, extends LoaderFS with readFile support and readFileWithLoaderFS, refactors EggLoader to use LoaderFS for filesystem/module ops, and updates the bundler to embed package.json-like text files and expose a runtime file loader.

Changes

Bundle File Loader Infrastructure

Layer / File(s) Summary
Global Type Contract
packages/core/src/global.ts
Adds optional globals __EGG_BUNDLE_FILE_LOADER__ and __EGG_BUNDLE_MODULE_LOADER__ declarations.
Bundler: collect & emit bundled text files
tools/egg-bundler/src/lib/EntryGenerator.ts
Classifies package.json resolveCache targets as bundled text files, reads their UTF-8 content at bundle time, emits __BUNDLE_TEXT_FILE_REL + __APP_TEXT_FILE_ALIASES, and installs globalThis.__EGG_BUNDLE_FILE_LOADER__ in the generated worker.
LoaderFS Interface & Implementations
packages/core/src/loader/loader_fs.ts
Adds readFile overloads to LoaderFS, exports readFileWithLoaderFS(...), implements readFile in RealLoaderFS, and adds ManifestLoaderFS which virtualizes exists/stat/realpath/readFile/readJSON/glob/loadFile for manifest/bundle-known paths.
EggLoader Refactoring
packages/core/src/loader/egg_loader.ts
Converts EggLoader to use the LoaderFS abstraction (loaderFS mutable), wraps with ManifestLoaderFS when appropriate, and routes all fs/module/glob/tsconfig/outDir operations through loaderFS/readFileWithLoaderFS/loadFile.
Tests
packages/core/test/loader/egg_loader.test.ts, packages/core/test/loader/loader_fs.test.ts, tools/egg-bundler/test/EntryGenerator.test.ts
Adds tests for EggLoader.loadFile delegation, ManifestLoaderFS manifest-backed and bundled-text behavior, and EntryGenerator emitting bundled text-file artifacts and loader markers.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • eggjs/egg#5936: Introduces the LoaderFS abstraction that this PR builds on and extends with ManifestLoaderFS and bundled file loading.
  • eggjs/egg#5911: Modifies bundler entry generation and runtime bundle loader wiring related to EGG_BUNDLE_FILE_LOADER and bundled text support.
  • eggjs/egg#5844: Adds manifest-backed resolution that this PR leverages through ManifestLoaderFS and EggLoader wiring.

Suggested reviewers

  • fengmk2
  • gxkl
  • jerryliang64
  • akitaSummer

Poem

🐰 A rabbit reads the bundled file so neat,
Hops through manifests with eager feet.
Global loaders hum, the worker sings,
ManifestLoaderFS pulls all the strings.
Tiny text, big joy — bundle complete!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: route loader runtime through manifest fs' directly and clearly describes the main objective of the changeset—refactoring the loader runtime to use a manifest-backed file system abstraction.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/egg-dev/c7776d34

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

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 10, 2026

Deploying egg with  Cloudflare Pages  Cloudflare Pages

Latest commit: e9eff2b
Status: ✅  Deploy successful!
Preview URL: https://377b74f5.egg-cci.pages.dev
Branch Preview URL: https://agent-egg-dev-c7776d34.egg-cci.pages.dev

View logs

@codecov
Copy link
Copy Markdown

codecov Bot commented May 10, 2026

Codecov Report

❌ Patch coverage is 92.85714% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.23%. Comparing base (0dec2c9) to head (e9eff2b).

Files with missing lines Patch % Lines
packages/core/src/loader/loader_fs.ts 91.08% 8 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             next    #5946      +/-   ##
==========================================
+ Coverage   85.21%   85.23%   +0.02%     
==========================================
  Files         669      669              
  Lines       19304    19412     +108     
  Branches     3787     3821      +34     
==========================================
+ Hits        16449    16546      +97     
- Misses       2463     2473      +10     
- Partials      392      393       +1     

☔ View full report in Codecov by Sentry.
📢 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.

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

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

Deploying egg-v3 with  Cloudflare Pages  Cloudflare Pages

Latest commit: e9eff2b
Status: ✅  Deploy successful!
Preview URL: https://d7336cd4.egg-v3.pages.dev
Branch Preview URL: https://agent-egg-dev-c7776d34.egg-v3.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 introduces a virtual file system abstraction (LoaderFS) to support loading application files from a manifest in bundled environments, including updates to EggLoader and egg-bundler. Feedback identifies critical issues with the initialization timing of ManifestLoaderFS, incorrect encoding logic in readFile, and behavioral inconsistencies in loadFile for JSON. Furthermore, the reviewer noted performance and correctness gaps in directory resolution and the synthetic Stats implementation.

Comment thread packages/core/src/loader/egg_loader.ts Outdated
Comment thread packages/core/src/loader/loader_fs.ts Outdated
Comment thread packages/core/src/loader/loader_fs.ts Outdated
Comment thread packages/core/src/loader/loader_fs.ts
Comment thread packages/core/src/loader/loader_fs.ts
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

This PR improves bundled-runtime compatibility by introducing a manifest-backed filesystem abstraction and routing Egg’s loader reads through it, enabling bundled workers to satisfy certain file reads (notably package.json) without replaying bundle-time filesystem paths.

Changes:

  • Add ManifestLoaderFS to serve exists/stat/realpath/readFile/readJSON/loadFile from manifest data and bundler-provided runtime hooks.
  • Update EggLoader to prefer loaderFS for environment/config/plugin/package metadata reads and to auto-wrap with ManifestLoaderFS when no custom loaderFS is provided.
  • Extend egg-bundler worker entry generation to embed resolved package.json text and expose it via globalThis.__EGG_BUNDLE_FILE_LOADER__, with tests/snapshots updated accordingly.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tools/egg-bundler/src/lib/EntryGenerator.ts Embed package.json contents into generated worker entry and expose a text-file loader hook.
tools/egg-bundler/test/EntryGenerator.test.ts Add coverage ensuring package.json targets are emitted via the bundled text loader (no static module imports).
tools/egg-bundler/test/snapshots/EntryGenerator.worker.canonical.snap Update canonical worker entry snapshot to include text-file maps/aliases and the new global hook.
packages/core/src/loader/loader_fs.ts Add readFile to LoaderFS; implement ManifestLoaderFS that can serve manifest-known files and bundled text/module loaders.
packages/core/src/loader/egg_loader.ts Route multiple filesystem reads through loaderFS and wrap default FS with ManifestLoaderFS for manifest/bundle-aware behavior.
packages/core/src/global.ts Declare __EGG_BUNDLE_FILE_LOADER__ global type for bundled text file support.
packages/core/test/loader/loader_fs.test.ts Add test verifying manifest-known paths do not hit delegate stat/exists.
packages/core/test/loader/egg_loader.test.ts Add test ensuring EggLoader.loadFile() uses loaderFS.loadFile().

Comment thread packages/core/src/loader/loader_fs.ts Outdated
Comment thread packages/core/src/loader/loader_fs.ts Outdated
Comment thread tools/egg-bundler/src/lib/EntryGenerator.ts Outdated
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: 2

🧹 Nitpick comments (3)
tools/egg-bundler/src/lib/EntryGenerator.ts (2)

119-129: 💤 Low value

Sync readFileSync inside an async pipeline — acceptable at bundle time, but worth a thought.

#collectBundleTextFiles runs at bundle generation time within generate() (which is async). Using readFileSync here is fine and keeps ordering deterministic, but if any of the resolved text files are unexpectedly missing, the failure surfaces as a generic ENOENT from readFileSync with no context (which package.json, which relKey). Wrapping this in a small try/catch that throws a more descriptive error (relKey + absolute path attempted) would make manifest/bundle drift dramatically easier to debug.

🤖 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 `@tools/egg-bundler/src/lib/EntryGenerator.ts` around lines 119 - 129, The
helper `#collectBundleTextFiles` currently calls readFileSync (from within the
async generate() pipeline) without context on failure; wrap the readFileSync
call in a try/catch inside `#collectBundleTextFiles` and, on error, throw a new
Error that includes the relKey and the absolute path produced by
this.#absFromRelKey(relKey) (and preserve the original error.message or stack)
so consumers of BundleTextFile failures can see which file (relKey and abs path)
failed to read; keep the rest of the sorting/mapping logic unchanged.

119-133: 💤 Low value

Tighten the contract of #isTextFileEntry (or rename it to reflect package.json scope).

#isTextFileEntry is package.json-specific (endsWith('/package.json') || === 'package.json'), but the surrounding type (BundleTextFile), helper names (#collectBundleTextFiles, __BUNDLE_TEXT_FILE_REL, __setBundleTextFile, __getBundleTextFile, __APP_TEXT_FILE_ALIASES), and the runtime hook (__EGG_BUNDLE_FILE_LOADER__) all read as a generic text-file mechanism. If only package.json is intended, consider renaming the predicate to e.g. #isPackageJsonEntry so the constraint is visible at every call site. If text files beyond package.json are planned, this predicate is the central place to extend.

🤖 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 `@tools/egg-bundler/src/lib/EntryGenerator.ts` around lines 119 - 133, The
predicate `#isTextFileEntry` is actually package.json-specific; either tighten its
name to `#isPackageJsonEntry` and update all call sites (e.g.,
`#collectBundleTextFiles`, and any runtime helpers/aliases referenced by
__BUNDLE_TEXT_FILE_REL, __setBundleTextFile, __getBundleTextFile,
__APP_TEXT_FILE_ALIASES, __EGG_BUNDLE_FILE_LOADER__) so the contract is
explicit, or broaden the predicate to include other text-file patterns (e.g.,
.json/.txt/.md by extension or path checks) and document that change; implement
the chosen approach consistently by renaming the private method and replacing
its usages, or by extending its logic to return true for additional text-file
patterns.
packages/core/src/loader/loader_fs.ts (1)

102-111: 💤 Low value

loadFile returning Buffer.from(text) for bundle text is semantically off for a "load a module" API.

LoaderFS.loadFile is consumed by EggLoader.requireFile to obtain a module value (object/function/class). If a caller ever passes a path that hits __EGG_BUNDLE_FILE_LOADER__ (today only package.json), they will receive a Buffer rather than a parsed module. In the current call graph this branch is unreachable — EggLoader only uses readJSON for package.json — but the asymmetry between readFile (Buffer/string) and loadFile (module) is worth tightening so future callers can't trip over it. Two clean options:

  1. Drop the bundle-text branch from loadFile and let it fall through to delegate.loadFile, leaving text-file access to readFile/readJSON.
  2. If a JSON-shaped result is desired, parse it: return JSON.parse(text) (matches what readJSON would return).

Either keeps loadFile's contract consistent with its callers.

🤖 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 `@packages/core/src/loader/loader_fs.ts` around lines 102 - 111,
LoaderFS.loadFile currently returns Buffer.from(text) when `#bundleFileText` hits,
which violates the "module value" contract used by EggLoader.requireFile; change
loadFile to drop the bundle-text branch (remove the Buffer.from(text) return) so
that when `#bundleFileText` returns text it falls through to
this.#delegate.loadFile(filepath) instead; keep the __EGG_BUNDLE_MODULE_LOADER__
handling and the this.#unwrapDefault(bundleHit) behavior, and ensure callers
that need raw text/JSON still use readFile/readJSON (or, if you prefer JSON
semantics, replace the Buffer return with JSON.parse(text) instead — but do one
or the other to keep loadFile returning module-shaped values).
🤖 Prompt for all review comments with 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.

Inline comments:
In `@packages/core/src/global.ts`:
- Around line 4-6: The core package's global declarations are missing
__EGG_BUNDLE_MODULE_LOADER__, causing a type gap when loader_fs.ts calls
globalThis.__EGG_BUNDLE_MODULE_LOADER__;. Add a declaration alongside the
existing __EGG_BUNDLE_STORE__ and __EGG_BUNDLE_FILE_LOADER__ in
packages/core/src/global.ts by declaring var __EGG_BUNDLE_MODULE_LOADER__:
((filepath: string) => unknown) | undefined; so the global symbol used by
loader_fs.ts is typed within the core package.

In `@packages/core/src/loader/loader_fs.ts`:
- Around line 119-134: The manifest lookup in `#manifestEntryType` incorrectly
uses this.#manifest.data.fileDiscovery[rel] which can hit prototype properties;
change that check to use Object.hasOwn(this.#manifest.data.fileDiscovery, rel)
(preserving the existing behavior that empty rel means 'directory'), so the
first conditional becomes "if (rel === '' ||
Object.hasOwn(this.#manifest.data.fileDiscovery, rel)) return 'directory'";
leave the subsequent loops (including the
Object.values(this.#manifest.data.resolveCache) check and the
path.posix.relative test) unchanged and keep using this.#toRelative and
this.#normalize as before.

---

Nitpick comments:
In `@packages/core/src/loader/loader_fs.ts`:
- Around line 102-111: LoaderFS.loadFile currently returns Buffer.from(text)
when `#bundleFileText` hits, which violates the "module value" contract used by
EggLoader.requireFile; change loadFile to drop the bundle-text branch (remove
the Buffer.from(text) return) so that when `#bundleFileText` returns text it falls
through to this.#delegate.loadFile(filepath) instead; keep the
__EGG_BUNDLE_MODULE_LOADER__ handling and the this.#unwrapDefault(bundleHit)
behavior, and ensure callers that need raw text/JSON still use readFile/readJSON
(or, if you prefer JSON semantics, replace the Buffer return with
JSON.parse(text) instead — but do one or the other to keep loadFile returning
module-shaped values).

In `@tools/egg-bundler/src/lib/EntryGenerator.ts`:
- Around line 119-129: The helper `#collectBundleTextFiles` currently calls
readFileSync (from within the async generate() pipeline) without context on
failure; wrap the readFileSync call in a try/catch inside
`#collectBundleTextFiles` and, on error, throw a new Error that includes the
relKey and the absolute path produced by this.#absFromRelKey(relKey) (and
preserve the original error.message or stack) so consumers of BundleTextFile
failures can see which file (relKey and abs path) failed to read; keep the rest
of the sorting/mapping logic unchanged.
- Around line 119-133: The predicate `#isTextFileEntry` is actually
package.json-specific; either tighten its name to `#isPackageJsonEntry` and update
all call sites (e.g., `#collectBundleTextFiles`, and any runtime helpers/aliases
referenced by __BUNDLE_TEXT_FILE_REL, __setBundleTextFile, __getBundleTextFile,
__APP_TEXT_FILE_ALIASES, __EGG_BUNDLE_FILE_LOADER__) so the contract is
explicit, or broaden the predicate to include other text-file patterns (e.g.,
.json/.txt/.md by extension or path checks) and document that change; implement
the chosen approach consistently by renaming the private method and replacing
its usages, or by extending its logic to return true for additional text-file
patterns.
🪄 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: 4490d3d2-ab20-475f-bcbe-ed18da5d1ad6

📥 Commits

Reviewing files that changed from the base of the PR and between 0dec2c9 and e06769e.

⛔ Files ignored due to path filters (1)
  • tools/egg-bundler/test/__snapshots__/EntryGenerator.worker.canonical.snap is excluded by !**/*.snap
📒 Files selected for processing (7)
  • packages/core/src/global.ts
  • packages/core/src/loader/egg_loader.ts
  • packages/core/src/loader/loader_fs.ts
  • packages/core/test/loader/egg_loader.test.ts
  • packages/core/test/loader/loader_fs.test.ts
  • tools/egg-bundler/src/lib/EntryGenerator.ts
  • tools/egg-bundler/test/EntryGenerator.test.ts

Comment thread packages/core/src/global.ts
Comment thread packages/core/src/loader/loader_fs.ts
Copilot AI review requested due to automatic review settings May 10, 2026 07:08
Copy link
Copy Markdown
Contributor Author

killagu commented May 10, 2026

Addressed the review feedback in follow-up commits:

  • Installed ManifestLoaderFS before early EggLoader package/env/tsconfig reads when a matching bundled manifest is registered.
  • Indexed manifest-known files/directories once, including parent directories, and included bundled text files in virtual exists/stat handling.
  • Preserved readFile encoding behavior and parsed bundled JSON from loadFile to match utils.loadFile expectations.
  • Added fuller synthetic Stats defaults.
  • Kept LoaderFS.readFile backward-compatible by making it optional and routing callers through readFileWithLoaderFS fallback behavior.
  • Switched bundled text-file entry generation from sync readFileSync to async fs.readFile over sorted keys.
  • Added the missing core global declaration for __EGG_BUNDLE_MODULE_LOADER__.

Latest local checks pass.

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 9 out of 9 changed files in this pull request and generated no new comments.

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.

🧹 Nitpick comments (1)
packages/core/src/loader/loader_fs.ts (1)

120-131: ⚡ Quick win

Mirror #bundleFileText's two-key lookup in loadFile for consistency and robustness.

#bundleFileText queries the bundle file loader with both #normalize(filepath) and the relative form (#toRelative). loadFile only passes this.#normalize(filepath) to __EGG_BUNDLE_MODULE_LOADER__. While the bundler initializes the module map with dual-key registration when possible (line 327–328 in EntryGenerator.ts: if input is relative, it stores under both relative and absolute), this guarantee doesn't hold for all paths. Mirroring the two-key fallback pattern from #bundleFileText ensures consistency and guards against edge cases where a module is keyed only by relative path.

Suggested fix (mirrors `#bundleFileText` pattern)
   async loadFile(filepath: string): Promise<unknown> {
     const normalized = this.#normalize(filepath);
-    const bundleHit = globalThis.__EGG_BUNDLE_MODULE_LOADER__?.(normalized);
-    if (bundleHit !== undefined) return this.#unwrapDefault(bundleHit);
+    const moduleLoader = globalThis.__EGG_BUNDLE_MODULE_LOADER__;
+    if (moduleLoader) {
+      const direct = moduleLoader(normalized);
+      if (direct !== undefined) return this.#unwrapDefault(direct);
+      const rel = this.#toRelative(filepath);
+      if (rel !== normalized) {
+        const fallback = moduleLoader(rel);
+        if (fallback !== undefined) return this.#unwrapDefault(fallback);
+      }
+    }
🤖 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 `@packages/core/src/loader/loader_fs.ts` around lines 120 - 131, loadFile
currently calls __EGG_BUNDLE_MODULE_LOADER__ with only this.#normalize(filepath)
but `#bundleFileText` does a two-key lookup (normalized and
this.#toRelative(filepath)); update loadFile to mirror that pattern: first call
globalThis.__EGG_BUNDLE_MODULE_LOADER__ with normalized, and if it returns
undefined call it again with this.#toRelative(filepath) before falling back to
`#bundleFileText` and `#delegate.loadFile`; use the same unwrap logic
(this.#unwrapDefault) for any hit to ensure consistent behavior between loadFile
and `#bundleFileText`.
🤖 Prompt for all review comments with 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.

Nitpick comments:
In `@packages/core/src/loader/loader_fs.ts`:
- Around line 120-131: loadFile currently calls __EGG_BUNDLE_MODULE_LOADER__
with only this.#normalize(filepath) but `#bundleFileText` does a two-key lookup
(normalized and this.#toRelative(filepath)); update loadFile to mirror that
pattern: first call globalThis.__EGG_BUNDLE_MODULE_LOADER__ with normalized, and
if it returns undefined call it again with this.#toRelative(filepath) before
falling back to `#bundleFileText` and `#delegate.loadFile`; use the same unwrap
logic (this.#unwrapDefault) for any hit to ensure consistent behavior between
loadFile and `#bundleFileText`.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a9ec137b-cfa0-4364-85df-db6c534b8ba6

📥 Commits

Reviewing files that changed from the base of the PR and between e06769e and e9eff2b.

⛔ Files ignored due to path filters (1)
  • packages/core/test/__snapshots__/index.test.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (6)
  • packages/core/src/global.ts
  • packages/core/src/loader/egg_loader.ts
  • packages/core/src/loader/loader_fs.ts
  • packages/core/test/loader/egg_loader.test.ts
  • packages/core/test/loader/loader_fs.test.ts
  • tools/egg-bundler/src/lib/EntryGenerator.ts
✅ Files skipped from review due to trivial changes (1)
  • packages/core/test/loader/egg_loader.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • tools/egg-bundler/src/lib/EntryGenerator.ts
  • packages/core/src/loader/egg_loader.ts

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