Skip to content

Commit

Permalink
deps: use @eggjs/koa
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Jun 8, 2024
1 parent 6580f0c commit 1e5072f
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 24 deletions.
7 changes: 3 additions & 4 deletions benchmark/middleware/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

**Please run benchmark with node 7+ for async await support.**
# Benchmark

## Benchmark Result

Expand Down Expand Up @@ -34,7 +33,7 @@ Transfer/sec: 6.01MB

Enable asyncLocalStorage

```
```bash
v18.12.1
server started at 7001
------- generator middleware -------
Expand Down Expand Up @@ -130,7 +129,7 @@ Transfer/sec: 5.47MB

Disable asyncLocalStorage

```
```bash
v18.12.1
server started at 7001
------- generator middleware -------
Expand Down
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import KoaApplication = require('koa');
import KoaApplication from '@eggjs/koa';
import depd = require('depd');
import { Logger } from 'egg-logger';

Expand Down
2 changes: 1 addition & 1 deletion lib/egg.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const assert = require('assert');
const fs = require('fs');
const KoaApplication = require('koa');
const KoaApplication = require('@eggjs/koa').default;
const EggConsoleLogger = require('egg-logger').EggConsoleLogger;
const debug = require('debug')('egg-core');
const is = require('is-type-of');
Expand Down
8 changes: 4 additions & 4 deletions lib/loader/mixin/extend.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ const deprecate = require('depd')('egg');
const path = require('path');

const originalPrototypes = {
request: require('koa/lib/request'),
response: require('koa/lib/response'),
context: require('koa/lib/context'),
application: require('koa/lib/application'),
request: require('@eggjs/koa/lib/request').default.prototype,
response: require('@eggjs/koa/lib/response').default.prototype,
context: require('@eggjs/koa/lib/context').default.prototype,
application: require('@eggjs/koa/lib/application').default.prototype,
};

module.exports = {
Expand Down
27 changes: 13 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@
"name": "@eggjs/core",
"version": "5.3.1",
"description": "A core Pluggable framework based on koa",
"main": "index.js",
"types": "index.d.ts",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"files": [
"index.js",
"lib",
"index.d.ts"
"lib"
],
"scripts": {
"lint": "eslint .",
"test": "npm run lint -- --fix && npm run test-local",
"test-local": "egg-bin test -p",
"test-single": "egg-bin test",
"cov": "egg-bin cov -p",
"test-local": "egg-bin test -p --ts false",
"test-single": "egg-bin test --ts false",
"cov": "egg-bin cov -p --ts false",
"ci": "npm run lint && npm run cov",
"contributor": "git-contributor"
},
Expand All @@ -36,23 +34,25 @@
"node": ">= 16.13.0"
},
"devDependencies": {
"@eggjs/tsconfig": "^1.3.3",
"await-event": "^2.1.0",
"coffee": "^5.2.1",
"egg-bin": "^5.9.0",
"egg-bin": "^6.4.1",
"egg-utils": "^2.4.1",
"eslint": "^8.31.0",
"eslint-config-egg": "^12.1.0",
"git-contributor": "^1.0.10",
"eslint": "^8.42.0",
"eslint-config-egg": "^12.2.1",
"git-contributor": "2",
"js-yaml": "^3.13.1",
"mm": "^3.2.1",
"pedding": "^1.1.0",
"spy": "^1.0.0",
"supertest": "^4.0.2",
"ts-node": "^10.9.1",
"typescript": "^4.9.4",
"typescript": "^5.1.3",
"urllib": "^3.10.0"
},
"dependencies": {
"@eggjs/koa": "^2.15.0",
"@eggjs/router": "^2.0.0",
"@types/depd": "^1.1.32",
"@types/koa": "^2.13.5",
Expand All @@ -66,7 +66,6 @@
"get-ready": "^2.0.1",
"globby": "^11.0.2",
"is-type-of": "^1.2.1",
"koa": "^2.14.0",
"koa-convert": "^1.2.0",
"node-homedir": "^1.1.1",
"ready-callback": "^3.0.0",
Expand Down
16 changes: 16 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "@eggjs/tsconfig",
"compilerOptions": {
"target": "ES2022",
"module": "Node16",
"outDir": "lib",
"useUnknownInCatchVariables": false
},
"include": [
"src"
],
"exclude": [
"node_modules",
"test"
]
}

0 comments on commit 1e5072f

Please sign in to comment.