@sisin/egg-client 1.0.0 → 1.0.1

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 (2) hide show
  1. package/index.js +15 -2
  2. package/package.json +8 -3
package/index.js CHANGED
@@ -1,10 +1,23 @@
1
1
  'use strict';
2
2
 
3
- // 1) 重新导出 egg 框架,使 egg-bin 能找到 startCluster / Application / Controller 等
3
+ const path = require('path');
4
4
  const egg = require('egg');
5
+
6
+ const EGG_PATH = Symbol.for('egg#eggPath');
7
+
8
+ // 自定义 Application 子类,将 eggPath 指向 egg-client 自身目录
9
+ // 这样 getEggPaths() 遍历原型链时能找到 egg-client,框架 app.js 才能被加载
10
+ class FrameworkApplication extends egg.Application {
11
+ get [EGG_PATH]() {
12
+ return path.join(__dirname);
13
+ }
14
+ }
15
+
16
+ // 1) 重新导出 egg 框架,但 Application 替换为自定义子类
5
17
  Object.assign(exports, egg);
18
+ exports.Application = FrameworkApplication;
6
19
 
7
- // 2) 框架自定义导出(lazy getter,使用时才加载)
20
+ // 2) 框架自定义导出
8
21
  const customExports = {
9
22
  prisma: () => require('./app/utils/prisma'),
10
23
  PrismaManager:() => require('./app/utils/prisma-manager'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sisin/egg-client",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Egg.js 核心框架包 — 封装通用中间件、数据层、认证、日志、Redis 等基础设施",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -23,7 +23,12 @@
23
23
  "publish:minor": "npm version minor && npm publish",
24
24
  "publish:major": "npm version major && npm publish"
25
25
  },
26
- "keywords": ["egg", "egg-framework", "egg-client", "niceguy"],
26
+ "keywords": [
27
+ "egg",
28
+ "egg-framework",
29
+ "egg-client",
30
+ "niceguy"
31
+ ],
27
32
  "repository": {
28
33
  "type": "git",
29
34
  "url": "https://github.com/niceguy802/niceguy-core-web.git",
@@ -57,4 +62,4 @@
57
62
  "engines": {
58
63
  "node": ">=18.0.0"
59
64
  }
60
- }
65
+ }