@eggjs/tegg-plugin 4.0.0-beta.6 → 4.0.0-beta.8

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.
Files changed (72) hide show
  1. package/dist/AppLoadUnit-BOWdS4O9.d.ts +23 -0
  2. package/dist/AppLoadUnit-uyHgElRL.js +78 -0
  3. package/dist/AppLoadUnitInstance-4Z_vSQV3.js +69 -0
  4. package/dist/AppLoadUnitInstance-DQ-DxlmR.d.ts +24 -0
  5. package/dist/CompatibleUtil-CNhydb0E.js +96 -0
  6. package/dist/ConfigSourceLoadUnitHook-BV-R31vA.js +22 -0
  7. package/dist/EggAppLoader-DFYg65ry.js +106 -0
  8. package/dist/EggCompatibleObject-XfIZyirS.js +37 -0
  9. package/dist/EggCompatibleObject-lzUCfsIY.d.ts +21 -0
  10. package/dist/EggCompatibleProtoImpl-CPxLvSu4.js +50 -0
  11. package/dist/EggCompatibleProtoImpl-DpacWKFB.d.ts +25 -0
  12. package/dist/EggContextCompatibleHook-eFfN2xm6.js +31 -0
  13. package/dist/EggContextHandler-D8gfTbZs.js +29 -0
  14. package/dist/EggContextHandler-vGi67He5.d.ts +13 -0
  15. package/dist/EggContextImpl-DkCLPTzT.js +18 -0
  16. package/dist/EggModuleLoader-CCfQMmp5.js +50 -0
  17. package/dist/EggQualifierProtoHook-D5jNm-1y.js +48 -0
  18. package/dist/ModuleConfigLoader-CvZLf99E.js +84 -0
  19. package/dist/ModuleHandler-Dyx7JGj-.d.ts +17 -0
  20. package/dist/ModuleHandler-fKcUqWca.js +46 -0
  21. package/dist/Utils-11aRpnkd.js +33 -0
  22. package/dist/app/extend/application.d.ts +3 -56
  23. package/dist/app/extend/application.js +8 -70
  24. package/dist/app/extend/application.unittest.d.ts +1 -25
  25. package/dist/app/extend/application.unittest.js +2 -41
  26. package/dist/app/extend/context.d.ts +1 -23
  27. package/dist/app/extend/context.js +3 -28
  28. package/dist/app/middleware/tegg_ctx_lifecycle_middleware.d.ts +1 -1
  29. package/dist/app/middleware/tegg_ctx_lifecycle_middleware.js +2 -1
  30. package/dist/app.d.ts +4 -1
  31. package/dist/app.js +18 -10
  32. package/dist/application-Ccljinuy.d.ts +57 -0
  33. package/dist/application-DFI1junS.js +70 -0
  34. package/dist/application.unittest-Cmia71Fx.js +43 -0
  35. package/dist/application.unittest-CpoCu6-E.d.ts +26 -0
  36. package/dist/context-BWYE1dif.js +30 -0
  37. package/dist/context-BoIt2G5h.d.ts +24 -0
  38. package/dist/ctx_lifecycle_middleware-CIeSrbVY.js +27 -0
  39. package/dist/ctx_lifecycle_middleware-DV7uN5PG.d.ts +6 -0
  40. package/dist/index.d.ts +6 -1
  41. package/dist/index.js +13 -3
  42. package/dist/lib/AppLoadUnit.d.ts +1 -22
  43. package/dist/lib/AppLoadUnit.js +1 -76
  44. package/dist/lib/AppLoadUnitInstance.d.ts +1 -23
  45. package/dist/lib/AppLoadUnitInstance.js +1 -67
  46. package/dist/lib/CompatibleUtil.js +1 -94
  47. package/dist/lib/ConfigSourceLoadUnitHook.js +1 -20
  48. package/dist/lib/EggAppLoader.js +3 -104
  49. package/dist/lib/EggCompatibleObject.d.ts +2 -20
  50. package/dist/lib/EggCompatibleObject.js +2 -35
  51. package/dist/lib/EggCompatibleProtoImpl.d.ts +1 -24
  52. package/dist/lib/EggCompatibleProtoImpl.js +1 -48
  53. package/dist/lib/EggContextCompatibleHook.d.ts +1 -1
  54. package/dist/lib/EggContextCompatibleHook.js +7 -30
  55. package/dist/lib/EggContextHandler.d.ts +1 -12
  56. package/dist/lib/EggContextHandler.js +1 -27
  57. package/dist/lib/EggContextImpl.js +1 -16
  58. package/dist/lib/EggModuleLoader.js +4 -48
  59. package/dist/lib/EggQualifierProtoHook.js +4 -46
  60. package/dist/lib/ModuleConfigLoader.js +2 -82
  61. package/dist/lib/ModuleHandler.d.ts +1 -16
  62. package/dist/lib/ModuleHandler.js +6 -44
  63. package/dist/lib/Utils.js +1 -31
  64. package/dist/lib/ctx_lifecycle_middleware.d.ts +1 -5
  65. package/dist/lib/ctx_lifecycle_middleware.js +2 -25
  66. package/dist/lib/run_in_background.js +5 -50
  67. package/dist/run_in_background-CEUPBmDB.js +51 -0
  68. package/dist/types-BHg5p4Xk.js +3 -0
  69. package/dist/types-CuoKQV4X.d.ts +7 -0
  70. package/dist/types.d.ts +6 -7
  71. package/dist/types.js +13 -4
  72. package/package.json +11 -11
@@ -1,6 +1,2 @@
1
- import { Context, Next } from "egg";
2
-
3
- //#region src/lib/ctx_lifecycle_middleware.d.ts
4
- declare function ctxLifecycleMiddleware(ctx: Context, next: Next): Promise<void>;
5
- //#endregion
1
+ import { ctxLifecycleMiddleware } from "../ctx_lifecycle_middleware-DV7uN5PG.js";
6
2
  export { ctxLifecycleMiddleware };
@@ -1,27 +1,4 @@
1
- import { EggContextImpl } from "./EggContextImpl.js";
2
- import "@eggjs/tegg-runtime";
3
- import { ROOT_PROTO, TEGG_CONTEXT } from "@eggjs/egg-module-common";
1
+ import "../EggContextImpl-DkCLPTzT.js";
2
+ import { ctxLifecycleMiddleware } from "../ctx_lifecycle_middleware-CIeSrbVY.js";
4
3
 
5
- //#region src/lib/ctx_lifecycle_middleware.ts
6
- async function ctxLifecycleMiddleware(ctx, next) {
7
- if (ctx[TEGG_CONTEXT]) {
8
- await next();
9
- return;
10
- }
11
- const lifecycleCtx = {};
12
- const teggCtx = new EggContextImpl(ctx);
13
- const rootProto = ctx[ROOT_PROTO];
14
- if (rootProto) teggCtx.set(ROOT_PROTO, rootProto);
15
- if (teggCtx.init) await teggCtx.init(lifecycleCtx);
16
- try {
17
- await next();
18
- } finally {
19
- if (teggCtx.destroy) teggCtx.destroy(lifecycleCtx).catch((e) => {
20
- e.message = `[tegg/ctxLifecycleMiddleware] destroy tegg ctx failed: ${e.message}`;
21
- ctx.logger.error(e);
22
- });
23
- }
24
- }
25
-
26
- //#endregion
27
4
  export { ctxLifecycleMiddleware };
@@ -1,52 +1,7 @@
1
- import "../app/extend/context.js";
2
- import { getCalleeFromStack } from "./Utils.js";
3
- import "@eggjs/tegg-metadata";
4
- import { BackgroundTaskHelper, PrototypeUtil } from "@eggjs/tegg";
5
- import { TEGG_CONTEXT } from "@eggjs/egg-module-common";
6
- import { Application } from "egg";
1
+ import "../EggContextImpl-DkCLPTzT.js";
2
+ import "../ctx_lifecycle_middleware-CIeSrbVY.js";
3
+ import "../context-BWYE1dif.js";
4
+ import "../Utils-11aRpnkd.js";
5
+ import { LONG_STACK_DELIMITER, hijackRunInBackground } from "../run_in_background-CEUPBmDB.js";
7
6
 
8
- //#region src/lib/run_in_background.ts
9
- const LONG_STACK_DELIMITER = "\n --------------------\n";
10
- function addLongStackTrace(err, causeError) {
11
- const callSiteStack = causeError.stack;
12
- if (!callSiteStack || typeof callSiteStack !== "string") return;
13
- const index = callSiteStack.indexOf("\n");
14
- if (index !== -1) err.stack += LONG_STACK_DELIMITER + callSiteStack.substring(index + 1);
15
- }
16
- function hijackRunInBackground(app) {
17
- const eggRunInBackground = app.context.runInBackground;
18
- app.context.runInBackground = function runInBackground(scope) {
19
- if (!this[TEGG_CONTEXT]) return Reflect.apply(eggRunInBackground, this, [scope]);
20
- const caseError = /* @__PURE__ */ new Error("cause");
21
- let resolveBackgroundTask;
22
- const backgroundTaskPromise = new Promise((resolve) => {
23
- resolveBackgroundTask = resolve;
24
- });
25
- const newScope = async () => {
26
- try {
27
- await scope(this);
28
- } catch (e) {
29
- addLongStackTrace(e, caseError);
30
- throw e;
31
- } finally {
32
- resolveBackgroundTask();
33
- }
34
- };
35
- const taskName = scope._name || scope.name || getCalleeFromStack(true, 2);
36
- scope._name = taskName;
37
- Object.defineProperty(newScope, "name", {
38
- value: taskName,
39
- enumerable: false,
40
- configurable: true,
41
- writable: false
42
- });
43
- Reflect.apply(eggRunInBackground, this, [newScope]);
44
- const proto = PrototypeUtil.getClazzProto(BackgroundTaskHelper);
45
- app.eggContainerFactory.getEggObject(proto).obj.run(async () => {
46
- await backgroundTaskPromise;
47
- });
48
- };
49
- }
50
-
51
- //#endregion
52
7
  export { LONG_STACK_DELIMITER, hijackRunInBackground };
@@ -0,0 +1,51 @@
1
+ import { getCalleeFromStack } from "./Utils-11aRpnkd.js";
2
+ import "@eggjs/tegg-metadata";
3
+ import { BackgroundTaskHelper, PrototypeUtil } from "@eggjs/tegg";
4
+ import { TEGG_CONTEXT } from "@eggjs/egg-module-common";
5
+ import { Application } from "egg";
6
+
7
+ //#region src/lib/run_in_background.ts
8
+ const LONG_STACK_DELIMITER = "\n --------------------\n";
9
+ function addLongStackTrace(err, causeError) {
10
+ const callSiteStack = causeError.stack;
11
+ if (!callSiteStack || typeof callSiteStack !== "string") return;
12
+ const index = callSiteStack.indexOf("\n");
13
+ if (index !== -1) err.stack += LONG_STACK_DELIMITER + callSiteStack.substring(index + 1);
14
+ }
15
+ function hijackRunInBackground(app) {
16
+ const eggRunInBackground = app.context.runInBackground;
17
+ app.context.runInBackground = function runInBackground(scope) {
18
+ if (!this[TEGG_CONTEXT]) return Reflect.apply(eggRunInBackground, this, [scope]);
19
+ const caseError = /* @__PURE__ */ new Error("cause");
20
+ let resolveBackgroundTask;
21
+ const backgroundTaskPromise = new Promise((resolve) => {
22
+ resolveBackgroundTask = resolve;
23
+ });
24
+ const newScope = async () => {
25
+ try {
26
+ await scope(this);
27
+ } catch (e) {
28
+ addLongStackTrace(e, caseError);
29
+ throw e;
30
+ } finally {
31
+ resolveBackgroundTask();
32
+ }
33
+ };
34
+ const taskName = scope._name || scope.name || getCalleeFromStack(true, 2);
35
+ scope._name = taskName;
36
+ Object.defineProperty(newScope, "name", {
37
+ value: taskName,
38
+ enumerable: false,
39
+ configurable: true,
40
+ writable: false
41
+ });
42
+ Reflect.apply(eggRunInBackground, this, [newScope]);
43
+ const proto = PrototypeUtil.getClazzProto(BackgroundTaskHelper);
44
+ app.eggContainerFactory.getEggObject(proto).obj.run(async () => {
45
+ await backgroundTaskPromise;
46
+ });
47
+ };
48
+ }
49
+
50
+ //#endregion
51
+ export { LONG_STACK_DELIMITER, hijackRunInBackground };
@@ -0,0 +1,3 @@
1
+ import "@eggjs/tegg-config/types";
2
+
3
+ export { };
@@ -0,0 +1,7 @@
1
+ import "@eggjs/tegg-config/types";
2
+
3
+ //#region src/types.d.ts
4
+
5
+ declare module 'egg' {
6
+ interface EggModule {}
7
+ }
package/dist/types.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- import "@eggjs/tegg-config/types";
2
-
3
- //#region src/types.d.ts
4
-
5
- declare module 'egg' {
6
- interface EggModule {}
7
- }
1
+ import "./ModuleHandler-Dyx7JGj-.js";
2
+ import "./EggContextHandler-vGi67He5.js";
3
+ import "./application-Ccljinuy.js";
4
+ import "./application.unittest-CpoCu6-E.js";
5
+ import "./context-BoIt2G5h.js";
6
+ import "./types-CuoKQV4X.js";
package/dist/types.js CHANGED
@@ -1,6 +1,15 @@
1
- import "./app/extend/context.js";
2
- import "./app/extend/application.js";
3
- import "./app/extend/application.unittest.js";
4
- import "@eggjs/tegg-config/types";
1
+ import "./EggCompatibleProtoImpl-CPxLvSu4.js";
2
+ import "./ModuleConfigLoader-CvZLf99E.js";
3
+ import "./EggAppLoader-DFYg65ry.js";
4
+ import "./EggModuleLoader-CCfQMmp5.js";
5
+ import "./CompatibleUtil-CNhydb0E.js";
6
+ import "./ModuleHandler-fKcUqWca.js";
7
+ import "./EggContextHandler-D8gfTbZs.js";
8
+ import "./EggContextImpl-DkCLPTzT.js";
9
+ import "./ctx_lifecycle_middleware-CIeSrbVY.js";
10
+ import "./context-BWYE1dif.js";
11
+ import "./application-DFI1junS.js";
12
+ import "./application.unittest-Cmia71Fx.js";
13
+ import "./types-BHg5p4Xk.js";
5
14
 
6
15
  export { };
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "teggConfig"
7
7
  ]
8
8
  },
9
- "version": "4.0.0-beta.6",
9
+ "version": "4.0.0-beta.8",
10
10
  "description": "module plugin for egg",
11
11
  "keywords": [
12
12
  "egg",
@@ -61,18 +61,18 @@
61
61
  "dependencies": {
62
62
  "extend2": "^4.0.0",
63
63
  "sdk-base": "^5.0.1",
64
- "@eggjs/egg-module-common": "4.0.0-beta.6",
65
- "@eggjs/tegg-background-task": "4.0.0-beta.6",
66
- "@eggjs/tegg-common-util": "4.0.0-beta.6",
67
- "@eggjs/tegg": "4.0.0-beta.6",
68
- "@eggjs/tegg-dynamic-inject-runtime": "4.0.0-beta.6",
69
- "@eggjs/tegg-runtime": "4.0.0-beta.6",
70
- "@eggjs/tegg-loader": "4.0.0-beta.6",
71
- "@eggjs/tegg-metadata": "4.0.0-beta.6"
64
+ "@eggjs/tegg": "4.0.0-beta.8",
65
+ "@eggjs/tegg-background-task": "4.0.0-beta.8",
66
+ "@eggjs/tegg-common-util": "4.0.0-beta.8",
67
+ "@eggjs/tegg-dynamic-inject-runtime": "4.0.0-beta.8",
68
+ "@eggjs/tegg-loader": "4.0.0-beta.8",
69
+ "@eggjs/egg-module-common": "4.0.0-beta.8",
70
+ "@eggjs/tegg-runtime": "4.0.0-beta.8",
71
+ "@eggjs/tegg-metadata": "4.0.0-beta.8"
72
72
  },
73
73
  "peerDependencies": {
74
74
  "egg": "beta",
75
- "@eggjs/tegg-config": "4.0.0-beta.6"
75
+ "@eggjs/tegg-config": "4.0.0-beta.8"
76
76
  },
77
77
  "devDependencies": {
78
78
  "@eggjs/bin": "beta",
@@ -86,7 +86,7 @@
86
86
  "typescript": "^5.9.3",
87
87
  "tsdown": "^0.15.6",
88
88
  "unplugin-unused": "^0.5.3",
89
- "@eggjs/tegg-config": "4.0.0-beta.6"
89
+ "@eggjs/tegg-config": "4.0.0-beta.8"
90
90
  },
91
91
  "publishConfig": {
92
92
  "access": "public"