@eggjs/tegg-plugin 4.0.2-beta.10 → 4.0.2-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,13 @@ declare class EggModuleLoader {
8
8
  app: Application;
9
9
  globalGraph: GlobalGraph;
10
10
  private pendingBuildHooks;
11
+ /**
12
+ * True when the app graph was built from a tegg manifest (bundle mode). In
13
+ * that case the module source files do not exist on disk, so module load
14
+ * units must reuse the manifest's precomputed decorated files instead of
15
+ * globbing the file system.
16
+ */
17
+ private loadedFromManifest;
11
18
  constructor(app: Application);
12
19
  registerBuildHook(hook: GlobalGraphBuildHook): void;
13
20
  private loadApp;
@@ -1,12 +1,19 @@
1
1
  import { EggAppLoader } from "./EggAppLoader.js";
2
2
  import { EggLoadUnitType, GlobalGraph, LoadUnitFactory, ModuleDescriptorDumper } from "@eggjs/metadata";
3
- import { LoaderFactory, TEGG_MANIFEST_KEY } from "@eggjs/tegg-loader";
3
+ import { LoaderFactory, ModuleLoader, TEGG_MANIFEST_KEY } from "@eggjs/tegg-loader";
4
4
 
5
5
  //#region src/lib/EggModuleLoader.ts
6
6
  var EggModuleLoader = class EggModuleLoader {
7
7
  app;
8
8
  globalGraph;
9
9
  pendingBuildHooks = [];
10
+ /**
11
+ * True when the app graph was built from a tegg manifest (bundle mode). In
12
+ * that case the module source files do not exist on disk, so module load
13
+ * units must reuse the manifest's precomputed decorated files instead of
14
+ * globbing the file system.
15
+ */
16
+ loadedFromManifest = false;
10
17
  constructor(app) {
11
18
  this.app = app;
12
19
  }
@@ -26,6 +33,7 @@ var EggModuleLoader = class EggModuleLoader {
26
33
  }
27
34
  const manifestTegg = this.app.loader.manifest.getExtension(TEGG_MANIFEST_KEY);
28
35
  const loadAppManifest = manifestTegg?.moduleDescriptors?.length ? manifestTegg : void 0;
36
+ this.loadedFromManifest = !!loadAppManifest;
29
37
  const loaderFS = this.app.loader.loaderFS;
30
38
  const moduleDescriptors = await LoaderFactory.loadApp(this.app.moduleReferences, loadAppManifest, loaderFS);
31
39
  if (!loadAppManifest) EggModuleLoader.collectTeggManifest(this.app, moduleDescriptors);
@@ -66,9 +74,18 @@ var EggModuleLoader = class EggModuleLoader {
66
74
  this.globalGraph.sort();
67
75
  const moduleConfigList = this.globalGraph.moduleConfigList;
68
76
  const loaderFS = this.app.loader.loaderFS;
77
+ const decoratedFilesMap = /* @__PURE__ */ new Map();
78
+ if (this.loadedFromManifest) {
79
+ const manifestTegg = this.app.loader.manifest.getExtension(TEGG_MANIFEST_KEY);
80
+ for (const desc of manifestTegg?.moduleDescriptors ?? []) decoratedFilesMap.set(desc.unitPath, desc.decoratedFiles);
81
+ }
69
82
  for (const moduleConfig of moduleConfigList) {
70
83
  const modulePath = moduleConfig.path;
71
- const loader = LoaderFactory.createLoader(modulePath, EggLoadUnitType.MODULE, loaderFS);
84
+ const precomputedFiles = decoratedFilesMap.get(modulePath);
85
+ const loader = precomputedFiles ? new ModuleLoader(modulePath, {
86
+ precomputedFiles,
87
+ loaderFS
88
+ }) : LoaderFactory.createLoader(modulePath, EggLoadUnitType.MODULE, loaderFS);
72
89
  const loadUnit = await LoadUnitFactory.createLoadUnit(modulePath, EggLoadUnitType.MODULE, loader);
73
90
  this.app.moduleHandler.loadUnits.push(loadUnit);
74
91
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eggjs/tegg-plugin",
3
- "version": "4.0.2-beta.10",
3
+ "version": "4.0.2-beta.11",
4
4
  "description": "module plugin for egg",
5
5
  "keywords": [
6
6
  "egg",
@@ -59,31 +59,31 @@
59
59
  "await-first": "^1.0.0",
60
60
  "extend2": "^4.0.0",
61
61
  "sdk-base": "^5.0.1",
62
- "@eggjs/background-task": "4.0.2-beta.10",
63
- "@eggjs/core-decorator": "4.0.2-beta.10",
64
- "@eggjs/dynamic-inject-runtime": "4.0.2-beta.10",
65
- "@eggjs/lifecycle": "4.0.2-beta.10",
66
- "@eggjs/tegg-common-util": "4.0.2-beta.10",
67
- "@eggjs/module-common": "4.0.2-beta.10",
68
- "@eggjs/metadata": "4.0.2-beta.10",
69
- "@eggjs/tegg-loader": "4.0.2-beta.10",
70
- "@eggjs/tegg-types": "4.0.2-beta.10",
71
- "@eggjs/tegg-runtime": "4.0.2-beta.10"
62
+ "@eggjs/background-task": "4.0.2-beta.11",
63
+ "@eggjs/core-decorator": "4.0.2-beta.11",
64
+ "@eggjs/dynamic-inject-runtime": "4.0.2-beta.11",
65
+ "@eggjs/metadata": "4.0.2-beta.11",
66
+ "@eggjs/lifecycle": "4.0.2-beta.11",
67
+ "@eggjs/module-common": "4.0.2-beta.11",
68
+ "@eggjs/tegg-common-util": "4.0.2-beta.11",
69
+ "@eggjs/tegg-types": "4.0.2-beta.11",
70
+ "@eggjs/tegg-runtime": "4.0.2-beta.11",
71
+ "@eggjs/tegg-loader": "4.0.2-beta.11"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@types/node": "^24.10.2",
75
75
  "egg-logger": "^3.5.0",
76
76
  "typescript": "^5.9.3",
77
- "@eggjs/mock": "7.0.2-beta.10",
78
- "@eggjs/core": "7.0.2-beta.10",
79
- "@eggjs/tegg": "4.0.2-beta.10",
80
- "@eggjs/tegg-config": "4.0.2-beta.10",
81
- "@eggjs/tracer": "4.0.2-beta.10",
82
- "egg": "4.1.2-beta.10"
77
+ "@eggjs/core": "7.0.2-beta.11",
78
+ "@eggjs/mock": "7.0.2-beta.11",
79
+ "@eggjs/tegg-config": "4.0.2-beta.11",
80
+ "@eggjs/tracer": "4.0.2-beta.11",
81
+ "@eggjs/tegg": "4.0.2-beta.11",
82
+ "egg": "4.1.2-beta.11"
83
83
  },
84
84
  "peerDependencies": {
85
- "@eggjs/tegg-config": "4.0.2-beta.10",
86
- "egg": "4.1.2-beta.10"
85
+ "@eggjs/tegg-config": "4.0.2-beta.11",
86
+ "egg": "4.1.2-beta.11"
87
87
  },
88
88
  "engines": {
89
89
  "node": ">=22.18.0"