From 99801cdc341fef371f8900068de3a1f5d47013c1 Mon Sep 17 00:00:00 2001 From: killa Date: Mon, 11 May 2026 02:04:04 +0800 Subject: [PATCH 1/2] docs(core): document loaderFS option --- packages/core/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/core/README.md b/packages/core/README.md index 72f6768feb..96b5df4f46 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -214,6 +214,11 @@ export default async (ctx: Context) => { }; ``` +`LoaderOptions` accepts a `loaderFS` option for advanced loader integrations. +The value must implement the exported `LoaderFS` interface. When omitted, +`@eggjs/core` uses `RealLoaderFS`, which keeps the default Node.js filesystem, +glob, JSON, and file-loading behavior. + #### async loadExtend(name, target) Loader app/extend/xx.ts to target, For example, @@ -236,6 +241,7 @@ await this.loadExtend('application', app); | call | `Boolean` | determine whether invoke when exports is function | | inject | `Object` | an object that be the argument when invoke the function | | filter | `Function` | a function that filter the exports which can be loaded | +| loaderFS | `LoaderFS` | custom loader-facing filesystem implementation, default is `RealLoaderFS` | ## Timing From 5be779f5e558f43a327ddf11b8d4763342d51a77 Mon Sep 17 00:00:00 2001 From: killa Date: Mon, 11 May 2026 02:09:38 +0800 Subject: [PATCH 2/2] docs(core): refine loaderFS docs --- packages/core/README.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/core/README.md b/packages/core/README.md index 96b5df4f46..78b992fb2e 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -214,11 +214,6 @@ export default async (ctx: Context) => { }; ``` -`LoaderOptions` accepts a `loaderFS` option for advanced loader integrations. -The value must implement the exported `LoaderFS` interface. When omitted, -`@eggjs/core` uses `RealLoaderFS`, which keeps the default Node.js filesystem, -glob, JSON, and file-loading behavior. - #### async loadExtend(name, target) Loader app/extend/xx.ts to target, For example, @@ -229,11 +224,17 @@ await this.loadExtend('application', app); ### LoaderOptions +`LoaderOptions` accepts a `loaderFS` option for advanced loader integrations. +The value must implement the exported `LoaderFS` interface. When omitted by +`loadToApp` or `loadToContext`, it reuses the current loader's `loaderFS` +instance. `EggLoader` defaults that instance to `RealLoaderFS`, the default +`@eggjs/core` loader filesystem implementation. + | Param | Type | Description | -| ----------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------- | +| ----------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | directory | `String/Array` | directories to be loaded | | target | `Object` | attach the target object from loaded files | -| match | `String/Array` | match the files when load, default to `**/*.js`(if process.env.EGG\*TYPESCRIPT was true, default to `[ '\*\*/\_.(js | ts)', '!\*_/_.d.ts' ]`) | +| match | `String/Array` | match the files when load, default to `**/*.js` (if TypeScript support is enabled, default to ['**/*.(js|ts)', '!**/*.d.ts']) | | ignore | `String/Array` | ignore the files when load | | initializer | `Function` | custom file exports, receive two parameters, first is the inject object(if not js file, will be content buffer), second is an `options` object that contain `path` | | caseStyle | `String/Function` | set property's case when converting a filepath to property list. | @@ -241,7 +242,7 @@ await this.loadExtend('application', app); | call | `Boolean` | determine whether invoke when exports is function | | inject | `Object` | an object that be the argument when invoke the function | | filter | `Function` | a function that filter the exports which can be loaded | -| loaderFS | `LoaderFS` | custom loader-facing filesystem implementation, default is `RealLoaderFS` | +| loaderFS | `LoaderFS` | custom loader-facing filesystem implementation, defaults to the loader's `loaderFS` | ## Timing