feat(bundler): inject manifest loader fs into worker (#5944)
Summary
- add
ManifestLoaderFSon top of the shared@eggjs/loader-fscontracts and export it through@eggjs/core- thread
loaderFSthroughstartEggandEggCoreintoEggLoader, including manifest-backed package metadata reads- generate bundled worker entries that create a manifest-backed
LoaderFSfrom the inline manifest store and pass it via loader options- update entry generator/runtime tests, loader tests, manifest coverage, and snapshots
Tests
pnpm installpnpm exec vitest run packages/core/test/index.test.ts packages/core/test/egg.test.ts packages/core/test/loader/egg_loader.test.ts packages/core/test/loader/manifest_loader_fs.test.ts packages/core/test/loader/manifest_coverage.test.tspnpm exec vitest run test/EntryGenerator.test.tsfromtools/egg-bundlerpnpm --filter @eggjs/core typecheckpnpm --filter egg typecheckpnpm --filter @eggjs/egg-bundler typecheckpnpm exec oxlint --type-aware packages/core/src/index.ts packages/core/src/egg.ts packages/core/src/loader/egg_loader.ts packages/core/src/loader/loader_fs.ts packages/core/test/egg.test.ts packages/core/test/loader/egg_loader.test.ts packages/core/test/loader/manifest_loader_fs.test.ts packages/core/test/loader/manifest_coverage.test.ts packages/egg/src/lib/start.ts tools/egg-bundler/src/lib/EntryGenerator.ts tools/egg-bundler/test/EntryGenerator.test.ts(0 errors; existing warnings in untouched sections)git diff --check origin/next..HEADIssue: EGG-97
Summary by CodeRabbit
- New Features
- Added a configurable loaderFS option and a manifest-backed filesystem to support bundled-app file resolution; bundler now wires this into startup.
- Tests
- Expanded test coverage for manifest-backed FS behavior, file discovery and resolve caching, loader precedence, and generated bundler runtime hooks.
- Chores
- Declared multimatch dependency to improve pattern matching for manifest-backed globs.
English | 简体中文
Features
Quickstart
Follow the commands listed below.
Monorepo Structure
This project is structured as a pnpm monorepo with the following packages:
packages/egg- Main Eggjs frameworkexamples/helloworld-commonjs- CommonJS example applicationexamples/helloworld-typescript- TypeScript example applicationsite- Documentation websiteThe monorepo uses pnpm catalog mode for centralized dependency management, ensuring consistent versions across all packages.
Development Commands
Local External Services
Some DAL, ORM, Redis, and ecosystem benchmark paths need local MySQL and Redis services. Start the repository-aligned Docker services before running those tests on a clean machine:
This starts MySQL 8 and Redis 7, matching the main CI service versions, and creates the databases used by local DAL/ORM/e2e fixtures:
test,apple,banana,test_runtime_datasource,test_runtime_dao,test_dal_plugin,test_dal_standalone,cnpmcore, andcnpmcore_unittest.Useful commands:
The default host ports are
127.0.0.1:3306for MySQL and127.0.0.1:6379for Redis. If either port is already used, the start command stops before changing containers. Keep using the existing service if it is compatible with CI, or stop it and run the command again. You can change Docker host ports withEGG_DEV_SERVICES_MYSQL_PORTandEGG_DEV_SERVICES_REDIS_PORT; however, the full DAL/ORM/Redis local test path still expects the default host ports.Image overrides are available for compatibility checks:
Run
utoo run dev:services:resetbefore switching MySQL image families, for example between MySQL 8 and MySQL 5.7, because MySQL data directories are not downgrade-compatible across major versions.Current hard-coded service assumptions:
plugins/redis/test/fixtures/apps/**/config.*use127.0.0.1:6379; skipped Redis plugin tests become runnable when that port is available.plugins/session/test/fixtures/redis-session/config/config.default.jsuse127.0.0.1:6379.tegg/core/dal-runtime/test/DataSource.test.tsandtegg/core/dal-runtime/test/DAO.test.tsuse local MySQL on port3306.tegg/plugin/dal/test/fixtures/apps/dal-app/modules/dal/module.ymlandtegg/standalone/standalone/test/fixtures/dal-*/module.ymluse local MySQL on port3306.tegg/plugin/orm/test/fixtures/prepare.jsandtegg/plugin/orm/test/fixtures/apps/orm-app/config/config.default.tsuse local MySQL on port3306.Documentations
Contributors
How to Contribute
Please let us know how can we help. Do check out issues for bug reports or suggestions first.
To become a contributor, please follow our contributing guide, and review the repository guidelines for day-to-day development tips.
Sponsors and Backers
License
MIT