egg 3.11.0 → 3.12.0

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.
@@ -3,15 +3,17 @@
3
3
  const path = require('path');
4
4
 
5
5
  module.exports = options => {
6
- return function siteFile(ctx, next) {
6
+ return async function siteFile(ctx, next) {
7
7
  if (ctx.method !== 'HEAD' && ctx.method !== 'GET') return next();
8
8
  /* istanbul ignore if */
9
9
  if (ctx.path[0] !== '/') return next();
10
10
 
11
- const content = options[ctx.path];
11
+ let content = options[ctx.path];
12
12
  if (!content) return next();
13
13
 
14
- // '/favicon.ico': 'https://eggjs.org/favicon.ico',
14
+ // '/favicon.ico': 'https://eggjs.org/favicon.ico' or '/favicon.ico': async (ctx) => 'https://eggjs.org/favicon.ico'
15
+ // content is function
16
+ if (typeof content === 'function') content = await content(ctx);
15
17
  // content is url
16
18
  if (typeof content === 'string') return ctx.redirect(content);
17
19
 
package/index.d.ts CHANGED
@@ -493,6 +493,7 @@ declare module 'egg' {
493
493
  csrf: any;
494
494
  ssrf: {
495
495
  ipBlackList: string[];
496
+ ipExceptionList: string[];
496
497
  checkAddress?(ip: string): boolean;
497
498
  };
498
499
  xframe: {
@@ -504,11 +505,6 @@ declare module 'egg' {
504
505
  noopen: { enable: boolean; }
505
506
  xssProtection: any;
506
507
  csp: any;
507
- ssrf: {
508
- ipBlackList: string[];
509
- ipExceptionList: string[];
510
- checkAddress(ip: string): boolean;
511
- };
512
508
  };
513
509
 
514
510
  siteFile: PlainObject<string | Buffer>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "egg",
3
- "version": "3.11.0",
3
+ "version": "3.12.0",
4
4
  "publishConfig": {
5
5
  "tag": "latest"
6
6
  },
@@ -81,14 +81,20 @@
81
81
  "jsdoc": "^3.6.11",
82
82
  "koa": "^2.13.4",
83
83
  "koa-static": "^5.0.0",
84
+ "node-libs-browser": "^2.2.1",
84
85
  "pedding": "^1.1.0",
85
86
  "prettier": "^2.7.1",
87
+ "react": "^16.14.0",
88
+ "react-dom": "^16.14.0",
89
+ "react-router": "^5.3.4",
86
90
  "runscript": "^1.5.3",
87
91
  "sdk-base": "^4.2.1",
88
92
  "spy": "^1.0.0",
89
93
  "supertest": "^6.2.4",
90
94
  "ts-node": "^10.9.1",
91
- "typescript": "^4.8.3"
95
+ "tsd": "^0.25.0",
96
+ "typescript": "^4.8.3",
97
+ "umi": "^3.5.36"
92
98
  },
93
99
  "main": "index.js",
94
100
  "types": "index.d.ts",
@@ -102,11 +108,12 @@
102
108
  ],
103
109
  "scripts": {
104
110
  "lint": "eslint app config lib test *.js",
105
- "test": "npm run lint -- --fix && egg-bin pkgfiles && npm run test-local",
111
+ "tsd": "tsd",
112
+ "test": "npm run lint -- --fix && npm run tsd && npm run test-local",
106
113
  "test-local": "egg-bin test",
107
114
  "test-local-changed": "egg-bin test --changed",
108
115
  "cov": "egg-bin cov --timeout 100000",
109
- "ci": "npm run lint && egg-bin pkgfiles --check && npm run cov",
116
+ "ci": "npm run lint && npm run tsd && npm run cov",
110
117
  "site:dev": "APP_ROOT=./site dumi dev",
111
118
  "site:build": "APP_ROOT=./site dumi build",
112
119
  "site:prettier": "prettier --config site/.prettierrc --ignore-path site/.prettierignore --write \"site/**/*.{js,jsx,tsx,ts,less,md,json}\"",