From 11da67183a04ebf1d653fe64ab4ea2c16ca2786e Mon Sep 17 00:00:00 2001 From: fengmk2 Date: Sun, 31 Dec 2023 12:27:35 +0800 Subject: [PATCH] feat: export asyncLocalStorage instance to global (#269) pick from https://github.com/eggjs/egg-core/pull/266 and https://github.com/eggjs/egg-core/pull/268 --- .github/PULL_REQUEST_TEMPLATE.md | 24 - .github/workflows/codeql-analysis.yml | 72 --- .github/workflows/nodejs.yml | 10 +- .github/workflows/release.yml | 17 - CHANGELOG.md | 733 ++++++++++++++++++++++ History.md | 729 --------------------- lib/egg.js | 10 +- package.json | 1 + test/asyncLocalStorage.test.js | 12 + test/loader/mixin/load_middleware.test.js | 8 +- 10 files changed, 758 insertions(+), 858 deletions(-) delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/codeql-analysis.yml delete mode 100644 .github/workflows/release.yml delete mode 100644 History.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 48f9944f..00000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,24 +0,0 @@ - - -##### Checklist - - -- [ ] `npm test` passes -- [ ] tests and/or benchmarks are included -- [ ] documentation is changed or added -- [ ] commit message follows commit guidelines - -##### Affected core subsystem(s) - - - -##### Description of change - diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 38ee4915..00000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,72 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" - -on: - push: - branches: [ "master", 3.x ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ "master" ] - schedule: - - cron: '33 15 * * 2' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'javascript' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] - # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - - # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality - - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - # ℹ️ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index e40dcc95..8e9ae547 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -2,16 +2,14 @@ name: CI on: push: - branches: [ master, 4.x ] + branches: [ 4.x ] pull_request: - branches: [ master, 4.x ] - - workflow_dispatch: {} + branches: [ 4.x ] jobs: Job: name: Node.js - uses: artusjs/github-actions/.github/workflows/node-test.yml@v1 + uses: node-modules/github-actions/.github/workflows/node-test.yml@master with: - version: '8, 10, 12, 14.17.0, 14, 16, 18' + version: '8, 10, 12, 14.17.0, 14, 16, 18, 20' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 16125872..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Release - -on: - push: - branches: [ master ] - - workflow_dispatch: {} - -jobs: - release: - name: Node.js - uses: artusjs/github-actions/.github/workflows/node-release.yml@v1 - secrets: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - GIT_TOKEN: ${{ secrets.GIT_TOKEN }} - with: - checkTest: false diff --git a/CHANGELOG.md b/CHANGELOG.md index b236c637..45dab0d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,3 +13,736 @@ ### Features * auto register tsconfig-paths on env.EGG_TYPESCRIPT enable ([#254](https://github.com/eggjs/egg-core/issues/254)) ([6d75322](https://github.com/eggjs/egg-core/commit/6d75322e4bf7abbdc6a1405ab045e552aa41df08)) + + +--- + + +4.30.2 / 2023-04-07 +================== + +**fixes** + * [[`eaeabd6`](http://github.com/eggjs/egg-core/commit/eaeabd6b4c31f972739db2539d013aee86e21a12)] - fix: skip register tsconfig-paths if tsconfig.json not exists (#263) (fengmk2 <>) + +**others** + * [[`6319f16`](http://github.com/eggjs/egg-core/commit/6319f161825208d66eeccd42bb6e6deaeec40920)] - chore: add latest-4 publish tag (fengmk2 <>) + +4.29.0 / 2022-12-06 +================== + +**features** + * [[`0e48956`](http://github.com/eggjs/egg-core/commit/0e4895602bcc690e8e5ef6c6ccca64aed6732cbe)] - feat: enable asyncLocalStorage by default (#251) (fengmk2 <>) + +4.28.1 / 2022-11-28 +================== + +**fixes** + * [[`1d7d19b`](http://github.com/eggjs/egg-core/commit/1d7d19bc6c1fabdb8cea51dcd680fd608f5cc4fe)] - fix: fix call legacyReadyCallback with options (#250) (killa <>) + +4.28.0 / 2022-11-28 +================== + +**features** + * [[`d4080c0`](http://github.com/eggjs/egg-core/commit/d4080c0bdb727ea8a323c43a86e37baf7b6067e0)] - feat: add legacy timing (#249) (killa <>) + +4.27.0 / 2022-10-14 +================== + +**features** + * [[`7750ebc`](http://github.com/eggjs/egg-core/commit/7750ebc283543fb5c2ca9b704e247f04c7ca1ec8)] - feat: dump plugin info when it implicit enable by dependents plugin (#248) (TZ | 天猪 <>) + +4.26.1 / 2022-09-20 +================== + +**fixes** + * [[`0c571d8`](http://github.com/eggjs/egg-core/commit/0c571d81ef9b000da67918caafa2800c64be4987)] - fix: appInfo.scope no value (#247) (一剑 <>) + +4.26.0 / 2022-09-07 +================== + +**features** + * [[`7c6353f`](http://github.com/eggjs/egg-core/commit/7c6353f1dfe2ed4ebf0d9ae432356608372664bd)] - feat: extract plugin loader method for override (#246) (TZ | 天猪 <>) + +4.25.0 / 2022-09-07 +================== + +**features** + * [[`8ae1aad`](https://github.com/eggjs/egg-core.git/commit/8ae1aade1f3702f944b3c0e8794c88adc0a10459)] - feat: add load plugin methods (#245) (吖猩 <>) + +**others** + * [[`7c4707c`](https://github.com/eggjs/egg-core.git/commit/7c4707c64c6df365e2c2b77b9dd8c7581c62a97f)] - Create codeql-analysis.yml (fengmk2 <>) + +4.24.1 / 2022-06-23 +================== + +**fixes** + * [[`f8c069b`](http://github.com/eggjs/egg-core/commit/f8c069b0c1e8757ac8ee619c53d2d6f21ccd03db)] - fix: validate plugin.package (#244) (TZ | 天猪 <>) + +4.24.0 / 2022-06-21 +================== + +**others** + * [[`970134b`](http://github.com/eggjs/egg-core/commit/970134b28f72fbcbb4bda50944ec5c301c7b7d89)] - chore: update node engines to 8.9.0+ (#243) (TZ | 天猪 <>) + * [[`02bb843`](http://github.com/eggjs/egg-core/commit/02bb8434066f1508fa522aaa5e6490ac50b9d963)] - refactor: use require.resolve instead of fs.exists (#238) (TZ | 天猪 <>) + +4.23.0 / 2022-02-10 +================== + +**features** + * [[`f8169f1`](http://github.com/eggjs/egg-core/commit/f8169f1a6cfc451448364958e880f4db0cb33b63)] - feat: support plugin strict config (#240) (吖猩 <>) + +4.22.1 / 2022-01-28 +================== + +**fixes** + * [[`a9fc514`](http://github.com/eggjs/egg-core/commit/a9fc514f506a4f804099b60ea12c29351f373676)] - fix: plugin loader support pnpm (#239) (hyj1991 <>) + +4.22.0 / 2022-01-07 +================== + +**features** + * [[`43f15ad`](http://github.com/eggjs/egg-core/commit/43f15ada7291734aa583c274a8af5e321688deb5)] - feat: support pnpm node_modules style (#237) (TZ | 天猪 <>) + +4.21.0 / 2021-11-24 +================== + +**others** + * [[`4b523c5`](http://github.com/eggjs/egg-core/commit/4b523c55bfba9e95a2c1a5b965f32ab3633ec194)] - deps: use globby@10.0.2 to fix security warning (fengmk2 <>) + * [[`26ec6e4`](http://github.com/eggjs/egg-core/commit/26ec6e443f75daadceb558ddb32bcb8eebb39125)] - ci: remove travis (#233) (hyj1991 <>) + +4.20.0 / 2020-09-23 +================== + +**features** + * [[`9684589`](http://github.com/eggjs/egg-core/commit/9684589dd13cdd97068d4ecdfe98bca68aa51632)] - feat: expose set config meta (#227) (TZ | 天猪 <>) + +4.19.1 / 2020-09-15 +================== + +**fixes** + * [[`19a60de`](http://github.com/eggjs/egg-core/commit/19a60dec40279166968eae7a72a721eebe400141)] - fix: should end some timings (#226) (TZ | 天猪 <>) + +4.19.0 / 2020-09-11 +================== + +**features** + * [[`9e3b454`](http://github.com/eggjs/egg-core/commit/9e3b454dc6cb52deca371a4a5512c5c9fe07716b)] - feat: support process.env.EGG_APP_CONFIG (#225) (TZ | 天猪 <>) + * [[`b207f89`](http://github.com/eggjs/egg-core/commit/b207f89b214cfd2a432df87d771a5126ffce9289)] - feat: timing support Process Start/Script Start (#222) (killa <>) + +4.18.0 / 2020-08-18 +================== + +**features** + * [[`9b371fa`](http://github.com/eggjs/egg-core/commit/9b371fa55b80d8322995329da758e98fba3c5060)] - feat: support enable/disable/clear timing (#224) (TZ | 天猪 <>) + +4.17.6 / 2020-08-05 +================== + +**fixes** + * [[`f704e99`](http://github.com/eggjs/egg-core/commit/f704e99399833248e1ceb51f0fb440c5fdeff3fd)] - fix: this type in EggLoader (#223) (maxming <>) + +4.17.5 / 2020-08-04 +================== + +**others** + * [[`8cb0a6e`](http://github.com/eggjs/egg-core/commit/8cb0a6ef56f47b5e003a2fd8bc3be9d037736149)] - chore(typings): add EggLoader interface (#221) (Kiho · Cham <>) + +4.17.4 / 2019-12-11 +================== + +**fixes** + * [[`2935e16`](http://github.com/eggjs/egg-core/commit/2935e16376cf4c49e049b0e0d9cb7c0bf0b8870a)] - fix: fix before close order (#219) (killa <>) + +4.17.3 / 2019-07-07 +================== + +**fixes** + * [[`77e11f5`](http://github.com/eggjs/egg-core/commit/77e11f5fb38b3646fb20deb78bbc239b06bf8349)] - fix: fix ready callback id (#214) (killa <>) + +**others** + * [[`5bb4fe4`](http://github.com/eggjs/egg-core/commit/5bb4fe4ac7e13a44744e580fc797fc6c29191159)] - deps: upgrade dependencies (#215) (Haoliang Gao <>) + +4.17.2 / 2019-05-14 +================== + +4.17.1 / 2019-04-24 +================== + +**fixes** + * [[`947292c`](http://github.com/eggjs/egg-core/commit/947292c77c1e54f22af0a7a31d0bb918d8d2a70d)] - fix: ignore console instance on config meta (#211) (fengmk2 <>) + +4.17.0 / 2019-04-24 +================== + +**features** + * [[`515d50f`](http://github.com/eggjs/egg-core/commit/515d50f59a00e1987affc8a06002d353ee926ab2)] - feat: debug middleware enter log on every request (#210) (fengmk2 <>) + +4.16.2 / 2019-04-11 +================== + +**others** + * [[`1ba4d7c`](http://github.com/eggjs/egg-core/commit/1ba4d7ca8f137399ad10c54814a334264752a41f)] - fix(d.ts): caseStyle should return array (#209) (JimmyDaddy <>) + +4.16.1 / 2019-03-20 +================== + +**fixes** + * [[`6bbbca2`](http://github.com/eggjs/egg-core/commit/6bbbca275f6573f125979fa215fea62285be201d)] - fix: change non-exports type to interface (#206) (吖猩 <>) + +4.16.0 / 2019-03-19 +================== + +**features** + * [[`0b7b6e6`](http://github.com/eggjs/egg-core/commit/0b7b6e66d7dd3027c7f4b161b5e6601b8feed4c9)] - feat: custom loader support exports (#205) (TZ | 天猪 <>) + * [[`01201c3`](http://github.com/eggjs/egg-core/commit/01201c3e65383d90b3b33ddf7a20a17ce6b7e97c)] - feat: improve d.ts (#204) (吖猩 <>) + +**fixes** + * [[`ab3ffcf`](http://github.com/eggjs/egg-core/commit/ab3ffcf6e808a426178fe776604e500770e35e97)] - fix: customLoader should not overwrite the existing property (#203) (Haoliang Gao <>) + +4.15.0 / 2019-03-06 +================== + +**features** + * [[`3299be4`](http://github.com/eggjs/egg-core/commit/3299be492761f0082a37827c102d0d32204a03cd)] - feat: add new mixin loadCustomLoader in Loader (#202) (Haoliang Gao <>) + +**fixes** + * [[`d7c2c9a`](http://github.com/eggjs/egg-core/commit/d7c2c9a2d3ed0361cb2fb43c657bae57a06ec32d)] - fix: don't print when plugins that disabled by app is empty (#201) (Haoliang Gao <>) + +4.14.1 / 2019-02-15 +================== + +**others** + * [[`6d34013`](http://github.com/eggjs/egg-core/commit/6d34013a6551f4862b5836441c642c9abde77f18)] - deps: use egg router 2.0.0 (#200) (fengmk2 <>) + +4.14.0 / 2019-02-03 +================== + +**features** + * [[`2eb0076`](http://github.com/eggjs/egg-core/commit/2eb007695e9509eb41d8e86032c7739d085d3d2c)] - feat: support options.env to specific server env (#199) (Yiyu He <>) + +4.13.3 / 2019-01-30 +================== + +**others** + * [[`8bfbbea`](http://github.com/eggjs/egg-core/commit/8bfbbea160a819a7c63a2581bd7538d20ff5d7a0)] - chore: upgrade egg-router (#198) (Yiyu He <>) + +4.13.2 / 2019-01-30 +================== + +**others** + * [[`fcdf663`](http://github.com/eggjs/egg-core/commit/fcdf663b823f0b6203a8b7eb0013838a0f48e650)] - chore: use @eggjs/router instead of koa-router (#197) (Yiyu He <>) + * [[`29118e5`](http://github.com/eggjs/egg-core/commit/29118e5fe266b6598f9d3fdb4fabd96dca4569e8)] - Chore (gitignore, file_loader.test.js): Update files (#195) (Maledong <>) + +4.13.1 / 2019-01-11 +================== + +**others** + * [[`35ed3fa`](http://github.com/eggjs/egg-core/commit/35ed3fa2baf4cbcfee9f9e307e9f9f56fb93349d)] - refactor(jest-support): Replace require.extensions with Module._extensions (#196) (Gray <>) + +4.13.0 / 2018-12-14 +================== + +**features** + * [[`90cafae`](http://github.com/eggjs/egg-core/commit/90cafaea21f99a7dc97c50b591bbe3eae4eb039c)] - feat: loader support load file without extname (#194) (吖猩 <>) + +4.12.0 / 2018-12-11 +================== + +**features** + * [[`df1cc5b`](http://github.com/eggjs/egg-core/commit/df1cc5bd5b0764491e15a31932b357115371cf00)] - feat: support jest (#188) (吖猩 <>) + +**others** + * [[`b123b61`](http://github.com/eggjs/egg-core/commit/b123b618171fd7f2d10134bcb7e8f9f28ff5a033)] - chore: resolve EggApplication is not a Class (#186) (zhangdianpeng <>) + +4.11.0 / 2018-10-19 +================== + +**features** + * [[`fdc1ee5`](http://github.com/eggjs/egg-core/commit/fdc1ee546bc504dbf85d78f33ff61eaa266c0d02)] - feat: add 'configWillLoad' hook to lifecycle (#187) (fengmk2 <>) + +4.10.3 / 2018-09-29 +=================== + +**fixes** + * [[`58a49e4`](https://github.com/eggjs/egg-core/pull/184/commits/58a49e46684bf6adceada18abb1fe1b7086a764e)] - fix(lifecycle): forbid adding hook after initialization (#184) (initialwu) + +**others** + * [[`9c16f2e`](https://github.com/eggjs/egg-core/pull/184/commits/9c16f2e8919384b65ba36e2a7050db524d18c3a5)] - chore(eslint): set root=true to stop looking in parent folders (#183) (initialwu) + +4.10.2 / 2018-09-21 +================== + +**fixes** + * [[`0b0c23f`](http://github.com/eggjs/egg-core/commit/0b0c23f502fc0c2641fa7c1740a9777236e8f4db)] - fix: app.js export can be non-function (#182) (Yiyu He <>) + +4.10.1 / 2018-09-21 +================== + +**fixes** + * [[`33c07db`](http://github.com/eggjs/egg-core/commit/33c07db023ebc1a120d5ce1fa37da9e42b18e8f1)] - fix: ensure treat function app.js as configDidLoad (#181) (Yiyu He <>) + +4.10.0 / 2018-09-06 +================== + +**features** + * [[`9d2f2fc`](http://github.com/eggjs/egg-core/commit/9d2f2fc3655e29aca52ac06a574bf69c1ba4d239)] - feat: impl boot methods (#171) (killa <>) + +**others** + * [[`b71074d`](http://github.com/eggjs/egg-core/commit/b71074d7c0d5e5353ab8d3bbf279023184557809)] - fix(config) removes whitespace from both ends of serverEnv (#180) (supperchong <<2267805901@qq.com>>) + * [[`ae38fa4`](http://github.com/eggjs/egg-core/commit/ae38fa4c47c35c32d9ca73e0311f64305573acd4)] - chroe: add more comments for toAsyncFunction and toPromise (Maledong <>) + * [[`4d4113c`](http://github.com/eggjs/egg-core/commit/4d4113cfd27d1e8ce4ce65d2d19b0035b5291dcc)] - style(core): beautify reg and add .idea to ignore (#179) (Army <>) + +4.9.1 / 2018-07-12 +================== + + * revert: #172 loadUnit.name (#175) + * chore(typings): add pkg.types and pkg.files entry for index.d.ts (#176) + +4.9.0 / 2018-07-09 +================== + + * chore(typings): add index.d.ts (#169) + * feat: loadUnit should exports name (#172) + * fix: remove useless code (#170) + * docs: fix a typo (#168) + +4.8.0 / 2018-05-22 +================== + +**features** + * [[`bb24396`](http://github.com/eggjs/egg-core/commit/bb243964c98a633c6ccdfb5b0dc1f55a4d1ea301)] - feat: pick commit from 3.x (#166) (Haoliang Gao <>) + +**others** + * [[`72d33ae`](http://github.com/eggjs/egg-core/commit/72d33ae10cf8ff9e8e640bf3aba028da5ca7b90a)] - test: add testcase for loadExtend with function call (#167) (Haoliang Gao <>) + +4.7.1 / 2018-04-25 +================== + +**fixes** + * [[`4508c36`](http://github.com/eggjs/egg-core/commit/4508c364346ddf16a752e26bc7966216f9c09c10)] - fix: toAsyncFunction can't pass is.asyncFunction() (#159) (Khaidi Chu <>) + +4.7.0 / 2018-04-21 +================== + + * feat: support ts by env (#158) + +4.6.0 / 2018-04-09 +================== + +**features** + * [[`7f087e7`](http://github.com/eggjs/egg-core/commit/7f087e7d30bf9b07249b44fb943bcc9d109f26f6)] - feat: change assert to warning (#157) (Axes <>) + +4.5.0 / 2018-03-25 +================== + +**features** + * [[`2c6fbbf`](http://github.com/eggjs/egg-core/commit/2c6fbbf10c34420d623282312b555eecaaf3a755)] - feat: loader support custom extension (#156) (Axes <>) + +4.4.1 / 2018-03-09 +================== + +**fixes** + * [[`046ffdd`](http://github.com/eggjs/egg-core/commit/046ffdd5d4b918ddfc0e9f7980567374b594ef97)] - fix: should not load optional plugin & their deps (#154) (zōng yǔ <>) + +4.4.0 / 2018-01-18 +================== + +**features** + * [[`5323a9e`](git@github.com:eggjs/egg-core/commit/5323a9ec54d60a43aed06cfd67c617d02909715d)] - feat: add patch method for update (egg#1793) (#150) (吴建金 <>) + +4.3.2 / 2018-01-13 +================== + +**fixes** + * [[`2926058`](git@github.com:eggjs/egg-core/commit/29260580b387ba6657c76a7881f60c4ce44c295c)] - fix: mutli-path register. (#151) (SuperEVO <>) + +4.3.1 / 2018-01-12 +================== + +**fixes** + * [[`b41891d`](http://github.com/eggjs/egg-core/commit/b41891d160cd8be6e2df58b8540376b4ca6c76b8)] - fix: fix plugin sequence bug (#152) (zōng yǔ <>) + * [[`4f1c19a`](http://github.com/eggjs/egg-core/commit/4f1c19af711e4fe8cf65a2f0f01acdf5f276188b)] - fix: only filter the plugin which is disabled by app (#145) (#146) (Haoliang Gao <>) + +**others** + * [[`3384a87`](http://github.com/eggjs/egg-core/commit/3384a8796d878536e8144671c42f5872c3d0e3a9)] - refactor: replace `indexOf()` with `includes()` (#148) (m31271n <>) + * [[`613f236`](http://github.com/eggjs/egg-core/commit/613f236fba69f55ca27911d29d81a918c8d67c18)] - docs: fix typo (#147) (m31271n <>) + * [[`25b728c`](http://github.com/eggjs/egg-core/commit/25b728c41fdf941c97f23a2675b8b82443f28938)] - refactor: warning when the plugin disabled by app is enabled implicitly (#141) (Haoliang Gao <>) + +4.3.0 / 2017-12-13 +================== + +**features** + * [[`cbcf402`](http://github.com/eggjs/egg-core/commit/cbcf4028055a570c81b26dd39cadcfc548ffefd4)] - feat: support options.serverScope for egg-mock (#143) (Yiyu He <>) + +4.2.2 / 2017-12-12 +================== + +**fixes** + * [[`b327145`](git@github.com:eggjs/egg-core/commit/b327145d2c6f1328a5d0117186fef218c4b673a7)] - fix: should load router middleware in beforeStart (#139) (Yiyu He <>) + * [[`187fdec`](git@github.com:eggjs/egg-core/commit/187fdec6c63c22c73716741934771eefb54320a8)] - fix: check whether controller exists (#138) (TZ | 天猪 <>) + +4.2.1 / 2017-12-01 +================== + +**fixes** + * [[`035098c`](http://github.com/eggjs/egg-core/commit/035098cfca5b20c05a8dde719f0e3995037b9a04)] - fix: adjust implicitly enable logic (#135) (zōng yǔ <>) + +4.2.0 / 2017-11-29 +================== + +**features** + * [[`4979b98`](http://github.com/eggjs/egg-core/commit/4979b984e12cd39516ed1c6df5f1284c8faede2f)] - feat: export controller function's FULLPATH (#131) (#132) (fengmk2 <>) + +4.1.0 / 2017-11-20 +================== + +**features** + * [[`4bb7472`](git@github.com:eggjs/egg-core/commit/4bb7472b1c2365e5b44d5f7c7f7050cb5915aa75)] - feat: export egg utils (#130) (Yiyu He <>) + +**others** + * [[`a02df89`](git@github.com:eggjs/egg-core/commit/a02df8958f040dc1796dffb0094f535c5c3936e9)] - test: use async function instead of generator function (#128) (Yiyu He <>) + +4.0.0 / 2017-11-08 +================== + +**others** + * [[`ba0c9b9`](git@github.com:eggjs/egg-core/commit/ba0c9b9e44c57333485e5424b81f047249232232)] - refactor: upgrade to koa@2 and koa-router@7 [BREAKING_CHANGE] (#125) (Yiyu He <>) + +3.18.0 / 2017-11-08 +================== + +**features** + * [[`c944f79`](git@github.com:eggjs/egg-core/commit/c944f79cf9c4ec160bb56d97b41fc7d7e2c8d27c)] - feat: export app.options (#127) (Haoliang Gao <>) + +3.17.0 / 2017-11-07 +================== + +**features** + * [[`08b498f`](git@github.com:eggjs/egg-core/commit/08b498f76ff259ee049c20eb1933c5a294179cc8)] - feat: toAsyncFunction compact with async function (#126) (Yiyu He <>) + +3.16.0 / 2017-11-06 +================== + +**features** + * [[`f9b4ae8`](git@github.com:eggjs/egg-core/commit/f9b4ae89b9d0b51a042fe7f80ab0cee184f30445)] - feat: add toPromise and toAsyncFunction (#124) (Yiyu He <>) + +3.15.1 / 2017-10-29 +================== + +**others** + * [[`1eaa0c6`](http://github.com/eggjs/egg-core/commit/1eaa0c689aabd650955d0150228d3bd2a3dd8aa9)] - refactor: use utility to read json (#122) (Haoliang Gao <>) + +3.15.0 / 2017-10-20 +================== + +**features** + * [[`eedfd3d`](http://github.com/eggjs/egg-core/commit/eedfd3d4517f1931f541d0201c3f7d1c2fbf85a3)] - feat: support serverScope (#120) (Haoliang Gao <>) + +3.14.0 / 2017-10-17 +================== + +**features** + * [[`c2dec90`](http://github.com/eggjs/egg-core/commit/c2dec90b0f942384f62c432d61f4917c55652fd4)] - feat(core): adding support to register inherited methods when loading controllers (#119) (lkspc <>) + +3.13.1 / 2017-09-01 +=================== + + * fix: TypeError when DEBUG=* (#112) + +3.13.0 / 2017-07-24 +=================== + + * feat: controller support params by config (#110) + * style: spelling mistakes,orginal -> original (#109) + +3.12.2 / 2017-07-11 +=================== + + * fix: check loader existing before retrieve properties (#108) + +3.12.1 / 2017-07-05 +================== + + * fix: should ignore Object.getPrototypeOf check on null/undefined (#107) + +3.12.0 / 2017-07-05 +=================== + + * feat: generate configMeta (#106) + * deps: upgrade eslint (#104) + * docs: fix typo (#103) + * deps: upgrade dependencies (#102) + * refactor(plugin): ignore loop when push plugin.default.js (#101) + +3.11.0 / 2017-06-21 +================== + + * feat: framework can override getExtendFilePaths (#100) + +3.10.0 / 2017-06-08 +=================== + + * chore: improve cov (#91) + * feat: support app.middleware[name] (#98) + * test: add node 8 (#97) + +3.9.0 / 2017-05-31 +================== + + * feat: app timeout support config by env (#94) + * fix: load class controller should skip getter & setter (#96) + * refactor: use template literals in lib/utils/index.js (#95) + +3.8.0 / 2017-05-20 +================== + + * feat: support load custom file type (#93) + * chore(documentation): fix typo (#92) + * test: fix the testcase that is skipped (#89) + * refactor: change private function name to Symbol from being called outside. (#87) + * test: skip the failed testcase (#88) + * refactor: use es6 rest parameter. (#84) + +3.7.0 / 2017-05-03 +================== + + * feat(file_loader): support filter options (#86) + * feat: support custom directory (#85) + * refact: use es6 default parameter value synax. (#83) + +3.6.0 / 2017-05-02 +================== + + * feat: add fullPath property on class instance (#82) + +3.5.0 / 2017-04-26 +================== + + * feat(file_loader): ignore option support array in FileLoader (#81) + * fix: wrong optional dependencies in complex demo (#80) + +3.4.1 / 2017-04-21 +================== + + * fix: should support module.exports = function*(ctx) {} as a controller (#79) + +3.4.0 / 2017-04-18 +================== + + * refactor: export getHomedir that can be extended (#78) + * feat: expose eggPlugins (#77) + +3.3.1 / 2017-04-17 +================== + + * fix: optionally depend on a plugin which is disabled. (#76) + +3.3.0 / 2017-04-15 +================== + + * feat: always load extend/xx.unittest.js when run test (#75) + +3.2.2 / 2017-04-14 +================== + + * fix: don't replace plugin.default.js when serverEnv is default (#74) + +3.2.1 / 2017-04-13 +================== + + * fix: allow extend setter or getter alone (#73) + +3.2.0 / 2017-04-11 +================== + + * test: add testcase for appPlugins and customPlugins (#72) + * fix: find the true callee bebind proxy (#70) + * feat:expose appPlugins & customPlugins (#68) + * feat: expose BaseContextClass (#71) + +3.1.0 / 2017-04-10 +================== + + * feat: to keep controller function attributes (#69) + +3.0.1 / 2017-04-10 +================== + + * fix: ensure deprecate display the right call stack (#67) + +3.0.0 / 2017-03-07 +================== + + * feat: [BREAKING_CHANGE] array will be overridden when load config (#64) + +2.2.0 / 2017-02-27 +================== + + * fix: improve getPathName (#62) + * feat: FileLoader support caseStyle (#59) + * fix: improve require es module (#61) + +2.1.1 / 2017-02-17 +================== + + * fix: define egg.Service and egg.Controller in constructor (#58) + +2.1.0 / 2017-02-15 +================== + + * feat: load plugin.default.js rather than plugin.js (#57) + * refactor: seperate router api from app (#55) + +2.0.1 / 2017-02-15 +================== + + * fix: context loader cache independent in each request (#54) + +2.0.0 / 2017-02-10 +================== + + * feat: [BREAKING_CHANGE] can get error from .ready() (#53) + * fix: make sure close once (#51) + * feat: imporve error message of async controller (#52) + * deps: remove unuse devDeps (#49) + * feat: [BREAKING_CHANGE] all middleware support async function and common function (#50) + +1.8.0 / 2017-02-06 +================== + + * feat: app.beforeStart support async function same as beforeClose (#48) + * test: fix test on windows (#47) + * feat: add this.service in BaseContextClass (#46) + * feat: add this.config in BaseContextClass (#44) + * fix: execute beforeClose hooks in reverse order (#45) + +1.7.0 / 2017-01-26 +================== + + * feat: add app.beforeClose to register close function (#43) + +1.6.0 / 2017-01-20 +================== + + * feat: controller support class (#42) + +1.5.1 / 2017-01-19 +================== + + * fix: don't assert config.proxy (#41) + +1.5.0 / 2017-01-17 +================== + + * feat: plugin support optionalDependencies (#40) + +1.4.0 / 2017-01-12 +================== + + * refactor: support config/env instead of config/serverEnv (#37) + * fix(router): support app.get(url, controllerName) (#38) + * feat: support app.beforeStart (#39) + +1.3.3 / 2016-12-28 +================== + + * test: use assert instead of should + * refactor: warn only for redefine the same package + +1.3.2 / 2016-12-08 +================== + + * fix: distinguish property cache (#35) + +1.3.1 / 2016-12-03 +================== + + * fix: router.url can't parse multi params right (#34) + +1.3.0 / 2016-11-25 +================== + + * feat: make app middlewares also support enable (#33) + +1.2.0 / 2016-11-21 +================== + + * refactor: don't use core middleware when enable = false (#32) + * feat: core middlewares support enable/match/ignore options (#31) + +1.1.0 / 2016-11-09 +================== + + * refactor: extract getAppInfo that can be extend (#30) + +1.0.1 / 2016-11-07 +================== + + * chore: add pkg.files (#29) + +1.0.0 / 2016-11-04 +================== + + * feat: warn when redefine plugin (#28) + * refactor: assert eggPath should be string + +0.6.0 / 2016-10-28 +================== + + * feat: app support export generator (#26) + +0.5.0 / 2016-10-24 +================== + + * feat: app.js/agent.js support async function (#18) + * feat: add EGG_HOME to getHomedir for test (#25) + +0.4.0 / 2016-10-24 +================== + + * feat: support plugin.{env}.js (#20) + * feat: support {env}.js when load extend (#21) + * feat: app.close return a promise (#19) + * feat: [BREAKING_CHANGE] env as prod when EGG_SERVER_ENV undefined & NODE_ENV prod (#24) + * feat: warning when missing EGG_SERVER_ENV at production (#23) + * test: fix homedir testcase on Windows (#22) + +0.3.0 / 2016-10-13 +================== + + * fix: always get the executor's homedir (#17) + * doc: Plugable > Pluggable (#16) + * test: delete type testcase (#15) + * fix: can't get appConfig in appConfig (#14) + * feat: add plugin.from where declare the plugin (#13) + * feat: [BREAKING_CHANGE] remove compatible support loadExtend (#12) + +0.2.1 / 2016-08-18 +================== + + * fix: resolve the realpath of plugin path (#11) + +0.2.0 / 2016-08-17 +================== + + * feat: improve initializer && export Loader + +0.1.0 / 2016-08-16 +================== + + * feat: rename egg-loader to egg-core (#8) + * refactor: rename to egg-core (#6) + * doc: proofread readme documentation and correct english terms (#7) + * refactor API (#5) + * refactor: implement Loader instead of loading (#4) + +0.0.3 / 2016-07-30 +================== + + * test: add testcase (#3) + * fix: don't print middleware options on start log (#2) + +0.0.2 / 2016-07-16 +================== + + * first version diff --git a/History.md b/History.md deleted file mode 100644 index 1d8b3de6..00000000 --- a/History.md +++ /dev/null @@ -1,729 +0,0 @@ - -4.30.2 / 2023-04-07 -================== - -**fixes** - * [[`eaeabd6`](http://github.com/eggjs/egg-core/commit/eaeabd6b4c31f972739db2539d013aee86e21a12)] - fix: skip register tsconfig-paths if tsconfig.json not exists (#263) (fengmk2 <>) - -**others** - * [[`6319f16`](http://github.com/eggjs/egg-core/commit/6319f161825208d66eeccd42bb6e6deaeec40920)] - chore: add latest-4 publish tag (fengmk2 <>) - -4.29.0 / 2022-12-06 -================== - -**features** - * [[`0e48956`](http://github.com/eggjs/egg-core/commit/0e4895602bcc690e8e5ef6c6ccca64aed6732cbe)] - feat: enable asyncLocalStorage by default (#251) (fengmk2 <>) - -4.28.1 / 2022-11-28 -================== - -**fixes** - * [[`1d7d19b`](http://github.com/eggjs/egg-core/commit/1d7d19bc6c1fabdb8cea51dcd680fd608f5cc4fe)] - fix: fix call legacyReadyCallback with options (#250) (killa <>) - -4.28.0 / 2022-11-28 -================== - -**features** - * [[`d4080c0`](http://github.com/eggjs/egg-core/commit/d4080c0bdb727ea8a323c43a86e37baf7b6067e0)] - feat: add legacy timing (#249) (killa <>) - -4.27.0 / 2022-10-14 -================== - -**features** - * [[`7750ebc`](http://github.com/eggjs/egg-core/commit/7750ebc283543fb5c2ca9b704e247f04c7ca1ec8)] - feat: dump plugin info when it implicit enable by dependents plugin (#248) (TZ | 天猪 <>) - -4.26.1 / 2022-09-20 -================== - -**fixes** - * [[`0c571d8`](http://github.com/eggjs/egg-core/commit/0c571d81ef9b000da67918caafa2800c64be4987)] - fix: appInfo.scope no value (#247) (一剑 <>) - -4.26.0 / 2022-09-07 -================== - -**features** - * [[`7c6353f`](http://github.com/eggjs/egg-core/commit/7c6353f1dfe2ed4ebf0d9ae432356608372664bd)] - feat: extract plugin loader method for override (#246) (TZ | 天猪 <>) - -4.25.0 / 2022-09-07 -================== - -**features** - * [[`8ae1aad`](https://github.com/eggjs/egg-core.git/commit/8ae1aade1f3702f944b3c0e8794c88adc0a10459)] - feat: add load plugin methods (#245) (吖猩 <>) - -**others** - * [[`7c4707c`](https://github.com/eggjs/egg-core.git/commit/7c4707c64c6df365e2c2b77b9dd8c7581c62a97f)] - Create codeql-analysis.yml (fengmk2 <>) - -4.24.1 / 2022-06-23 -================== - -**fixes** - * [[`f8c069b`](http://github.com/eggjs/egg-core/commit/f8c069b0c1e8757ac8ee619c53d2d6f21ccd03db)] - fix: validate plugin.package (#244) (TZ | 天猪 <>) - -4.24.0 / 2022-06-21 -================== - -**others** - * [[`970134b`](http://github.com/eggjs/egg-core/commit/970134b28f72fbcbb4bda50944ec5c301c7b7d89)] - chore: update node engines to 8.9.0+ (#243) (TZ | 天猪 <>) - * [[`02bb843`](http://github.com/eggjs/egg-core/commit/02bb8434066f1508fa522aaa5e6490ac50b9d963)] - refactor: use require.resolve instead of fs.exists (#238) (TZ | 天猪 <>) - -4.23.0 / 2022-02-10 -================== - -**features** - * [[`f8169f1`](http://github.com/eggjs/egg-core/commit/f8169f1a6cfc451448364958e880f4db0cb33b63)] - feat: support plugin strict config (#240) (吖猩 <>) - -4.22.1 / 2022-01-28 -================== - -**fixes** - * [[`a9fc514`](http://github.com/eggjs/egg-core/commit/a9fc514f506a4f804099b60ea12c29351f373676)] - fix: plugin loader support pnpm (#239) (hyj1991 <>) - -4.22.0 / 2022-01-07 -================== - -**features** - * [[`43f15ad`](http://github.com/eggjs/egg-core/commit/43f15ada7291734aa583c274a8af5e321688deb5)] - feat: support pnpm node_modules style (#237) (TZ | 天猪 <>) - -4.21.0 / 2021-11-24 -================== - -**others** - * [[`4b523c5`](http://github.com/eggjs/egg-core/commit/4b523c55bfba9e95a2c1a5b965f32ab3633ec194)] - deps: use globby@10.0.2 to fix security warning (fengmk2 <>) - * [[`26ec6e4`](http://github.com/eggjs/egg-core/commit/26ec6e443f75daadceb558ddb32bcb8eebb39125)] - ci: remove travis (#233) (hyj1991 <>) - -4.20.0 / 2020-09-23 -================== - -**features** - * [[`9684589`](http://github.com/eggjs/egg-core/commit/9684589dd13cdd97068d4ecdfe98bca68aa51632)] - feat: expose set config meta (#227) (TZ | 天猪 <>) - -4.19.1 / 2020-09-15 -================== - -**fixes** - * [[`19a60de`](http://github.com/eggjs/egg-core/commit/19a60dec40279166968eae7a72a721eebe400141)] - fix: should end some timings (#226) (TZ | 天猪 <>) - -4.19.0 / 2020-09-11 -================== - -**features** - * [[`9e3b454`](http://github.com/eggjs/egg-core/commit/9e3b454dc6cb52deca371a4a5512c5c9fe07716b)] - feat: support process.env.EGG_APP_CONFIG (#225) (TZ | 天猪 <>) - * [[`b207f89`](http://github.com/eggjs/egg-core/commit/b207f89b214cfd2a432df87d771a5126ffce9289)] - feat: timing support Process Start/Script Start (#222) (killa <>) - -4.18.0 / 2020-08-18 -================== - -**features** - * [[`9b371fa`](http://github.com/eggjs/egg-core/commit/9b371fa55b80d8322995329da758e98fba3c5060)] - feat: support enable/disable/clear timing (#224) (TZ | 天猪 <>) - -4.17.6 / 2020-08-05 -================== - -**fixes** - * [[`f704e99`](http://github.com/eggjs/egg-core/commit/f704e99399833248e1ceb51f0fb440c5fdeff3fd)] - fix: this type in EggLoader (#223) (maxming <>) - -4.17.5 / 2020-08-04 -================== - -**others** - * [[`8cb0a6e`](http://github.com/eggjs/egg-core/commit/8cb0a6ef56f47b5e003a2fd8bc3be9d037736149)] - chore(typings): add EggLoader interface (#221) (Kiho · Cham <>) - -4.17.4 / 2019-12-11 -================== - -**fixes** - * [[`2935e16`](http://github.com/eggjs/egg-core/commit/2935e16376cf4c49e049b0e0d9cb7c0bf0b8870a)] - fix: fix before close order (#219) (killa <>) - -4.17.3 / 2019-07-07 -================== - -**fixes** - * [[`77e11f5`](http://github.com/eggjs/egg-core/commit/77e11f5fb38b3646fb20deb78bbc239b06bf8349)] - fix: fix ready callback id (#214) (killa <>) - -**others** - * [[`5bb4fe4`](http://github.com/eggjs/egg-core/commit/5bb4fe4ac7e13a44744e580fc797fc6c29191159)] - deps: upgrade dependencies (#215) (Haoliang Gao <>) - -4.17.2 / 2019-05-14 -================== - -4.17.1 / 2019-04-24 -================== - -**fixes** - * [[`947292c`](http://github.com/eggjs/egg-core/commit/947292c77c1e54f22af0a7a31d0bb918d8d2a70d)] - fix: ignore console instance on config meta (#211) (fengmk2 <>) - -4.17.0 / 2019-04-24 -================== - -**features** - * [[`515d50f`](http://github.com/eggjs/egg-core/commit/515d50f59a00e1987affc8a06002d353ee926ab2)] - feat: debug middleware enter log on every request (#210) (fengmk2 <>) - -4.16.2 / 2019-04-11 -================== - -**others** - * [[`1ba4d7c`](http://github.com/eggjs/egg-core/commit/1ba4d7ca8f137399ad10c54814a334264752a41f)] - fix(d.ts): caseStyle should return array (#209) (JimmyDaddy <>) - -4.16.1 / 2019-03-20 -================== - -**fixes** - * [[`6bbbca2`](http://github.com/eggjs/egg-core/commit/6bbbca275f6573f125979fa215fea62285be201d)] - fix: change non-exports type to interface (#206) (吖猩 <>) - -4.16.0 / 2019-03-19 -================== - -**features** - * [[`0b7b6e6`](http://github.com/eggjs/egg-core/commit/0b7b6e66d7dd3027c7f4b161b5e6601b8feed4c9)] - feat: custom loader support exports (#205) (TZ | 天猪 <>) - * [[`01201c3`](http://github.com/eggjs/egg-core/commit/01201c3e65383d90b3b33ddf7a20a17ce6b7e97c)] - feat: improve d.ts (#204) (吖猩 <>) - -**fixes** - * [[`ab3ffcf`](http://github.com/eggjs/egg-core/commit/ab3ffcf6e808a426178fe776604e500770e35e97)] - fix: customLoader should not overwrite the existing property (#203) (Haoliang Gao <>) - -4.15.0 / 2019-03-06 -================== - -**features** - * [[`3299be4`](http://github.com/eggjs/egg-core/commit/3299be492761f0082a37827c102d0d32204a03cd)] - feat: add new mixin loadCustomLoader in Loader (#202) (Haoliang Gao <>) - -**fixes** - * [[`d7c2c9a`](http://github.com/eggjs/egg-core/commit/d7c2c9a2d3ed0361cb2fb43c657bae57a06ec32d)] - fix: don't print when plugins that disabled by app is empty (#201) (Haoliang Gao <>) - -4.14.1 / 2019-02-15 -================== - -**others** - * [[`6d34013`](http://github.com/eggjs/egg-core/commit/6d34013a6551f4862b5836441c642c9abde77f18)] - deps: use egg router 2.0.0 (#200) (fengmk2 <>) - -4.14.0 / 2019-02-03 -================== - -**features** - * [[`2eb0076`](http://github.com/eggjs/egg-core/commit/2eb007695e9509eb41d8e86032c7739d085d3d2c)] - feat: support options.env to specific server env (#199) (Yiyu He <>) - -4.13.3 / 2019-01-30 -================== - -**others** - * [[`8bfbbea`](http://github.com/eggjs/egg-core/commit/8bfbbea160a819a7c63a2581bd7538d20ff5d7a0)] - chore: upgrade egg-router (#198) (Yiyu He <>) - -4.13.2 / 2019-01-30 -================== - -**others** - * [[`fcdf663`](http://github.com/eggjs/egg-core/commit/fcdf663b823f0b6203a8b7eb0013838a0f48e650)] - chore: use @eggjs/router instead of koa-router (#197) (Yiyu He <>) - * [[`29118e5`](http://github.com/eggjs/egg-core/commit/29118e5fe266b6598f9d3fdb4fabd96dca4569e8)] - Chore (gitignore, file_loader.test.js): Update files (#195) (Maledong <>) - -4.13.1 / 2019-01-11 -================== - -**others** - * [[`35ed3fa`](http://github.com/eggjs/egg-core/commit/35ed3fa2baf4cbcfee9f9e307e9f9f56fb93349d)] - refactor(jest-support): Replace require.extensions with Module._extensions (#196) (Gray <>) - -4.13.0 / 2018-12-14 -================== - -**features** - * [[`90cafae`](http://github.com/eggjs/egg-core/commit/90cafaea21f99a7dc97c50b591bbe3eae4eb039c)] - feat: loader support load file without extname (#194) (吖猩 <>) - -4.12.0 / 2018-12-11 -================== - -**features** - * [[`df1cc5b`](http://github.com/eggjs/egg-core/commit/df1cc5bd5b0764491e15a31932b357115371cf00)] - feat: support jest (#188) (吖猩 <>) - -**others** - * [[`b123b61`](http://github.com/eggjs/egg-core/commit/b123b618171fd7f2d10134bcb7e8f9f28ff5a033)] - chore: resolve EggApplication is not a Class (#186) (zhangdianpeng <>) - -4.11.0 / 2018-10-19 -================== - -**features** - * [[`fdc1ee5`](http://github.com/eggjs/egg-core/commit/fdc1ee546bc504dbf85d78f33ff61eaa266c0d02)] - feat: add 'configWillLoad' hook to lifecycle (#187) (fengmk2 <>) - -4.10.3 / 2018-09-29 -=================== - -**fixes** - * [[`58a49e4`](https://github.com/eggjs/egg-core/pull/184/commits/58a49e46684bf6adceada18abb1fe1b7086a764e)] - fix(lifecycle): forbid adding hook after initialization (#184) (initialwu) - -**others** - * [[`9c16f2e`](https://github.com/eggjs/egg-core/pull/184/commits/9c16f2e8919384b65ba36e2a7050db524d18c3a5)] - chore(eslint): set root=true to stop looking in parent folders (#183) (initialwu) - -4.10.2 / 2018-09-21 -================== - -**fixes** - * [[`0b0c23f`](http://github.com/eggjs/egg-core/commit/0b0c23f502fc0c2641fa7c1740a9777236e8f4db)] - fix: app.js export can be non-function (#182) (Yiyu He <>) - -4.10.1 / 2018-09-21 -================== - -**fixes** - * [[`33c07db`](http://github.com/eggjs/egg-core/commit/33c07db023ebc1a120d5ce1fa37da9e42b18e8f1)] - fix: ensure treat function app.js as configDidLoad (#181) (Yiyu He <>) - -4.10.0 / 2018-09-06 -================== - -**features** - * [[`9d2f2fc`](http://github.com/eggjs/egg-core/commit/9d2f2fc3655e29aca52ac06a574bf69c1ba4d239)] - feat: impl boot methods (#171) (killa <>) - -**others** - * [[`b71074d`](http://github.com/eggjs/egg-core/commit/b71074d7c0d5e5353ab8d3bbf279023184557809)] - fix(config) removes whitespace from both ends of serverEnv (#180) (supperchong <<2267805901@qq.com>>) - * [[`ae38fa4`](http://github.com/eggjs/egg-core/commit/ae38fa4c47c35c32d9ca73e0311f64305573acd4)] - chroe: add more comments for toAsyncFunction and toPromise (Maledong <>) - * [[`4d4113c`](http://github.com/eggjs/egg-core/commit/4d4113cfd27d1e8ce4ce65d2d19b0035b5291dcc)] - style(core): beautify reg and add .idea to ignore (#179) (Army <>) - -4.9.1 / 2018-07-12 -================== - - * revert: #172 loadUnit.name (#175) - * chore(typings): add pkg.types and pkg.files entry for index.d.ts (#176) - -4.9.0 / 2018-07-09 -================== - - * chore(typings): add index.d.ts (#169) - * feat: loadUnit should exports name (#172) - * fix: remove useless code (#170) - * docs: fix a typo (#168) - -4.8.0 / 2018-05-22 -================== - -**features** - * [[`bb24396`](http://github.com/eggjs/egg-core/commit/bb243964c98a633c6ccdfb5b0dc1f55a4d1ea301)] - feat: pick commit from 3.x (#166) (Haoliang Gao <>) - -**others** - * [[`72d33ae`](http://github.com/eggjs/egg-core/commit/72d33ae10cf8ff9e8e640bf3aba028da5ca7b90a)] - test: add testcase for loadExtend with function call (#167) (Haoliang Gao <>) - -4.7.1 / 2018-04-25 -================== - -**fixes** - * [[`4508c36`](http://github.com/eggjs/egg-core/commit/4508c364346ddf16a752e26bc7966216f9c09c10)] - fix: toAsyncFunction can't pass is.asyncFunction() (#159) (Khaidi Chu <>) - -4.7.0 / 2018-04-21 -================== - - * feat: support ts by env (#158) - -4.6.0 / 2018-04-09 -================== - -**features** - * [[`7f087e7`](http://github.com/eggjs/egg-core/commit/7f087e7d30bf9b07249b44fb943bcc9d109f26f6)] - feat: change assert to warning (#157) (Axes <>) - -4.5.0 / 2018-03-25 -================== - -**features** - * [[`2c6fbbf`](http://github.com/eggjs/egg-core/commit/2c6fbbf10c34420d623282312b555eecaaf3a755)] - feat: loader support custom extension (#156) (Axes <>) - -4.4.1 / 2018-03-09 -================== - -**fixes** - * [[`046ffdd`](http://github.com/eggjs/egg-core/commit/046ffdd5d4b918ddfc0e9f7980567374b594ef97)] - fix: should not load optional plugin & their deps (#154) (zōng yǔ <>) - -4.4.0 / 2018-01-18 -================== - -**features** - * [[`5323a9e`](git@github.com:eggjs/egg-core/commit/5323a9ec54d60a43aed06cfd67c617d02909715d)] - feat: add patch method for update (egg#1793) (#150) (吴建金 <>) - -4.3.2 / 2018-01-13 -================== - -**fixes** - * [[`2926058`](git@github.com:eggjs/egg-core/commit/29260580b387ba6657c76a7881f60c4ce44c295c)] - fix: mutli-path register. (#151) (SuperEVO <>) - -4.3.1 / 2018-01-12 -================== - -**fixes** - * [[`b41891d`](http://github.com/eggjs/egg-core/commit/b41891d160cd8be6e2df58b8540376b4ca6c76b8)] - fix: fix plugin sequence bug (#152) (zōng yǔ <>) - * [[`4f1c19a`](http://github.com/eggjs/egg-core/commit/4f1c19af711e4fe8cf65a2f0f01acdf5f276188b)] - fix: only filter the plugin which is disabled by app (#145) (#146) (Haoliang Gao <>) - -**others** - * [[`3384a87`](http://github.com/eggjs/egg-core/commit/3384a8796d878536e8144671c42f5872c3d0e3a9)] - refactor: replace `indexOf()` with `includes()` (#148) (m31271n <>) - * [[`613f236`](http://github.com/eggjs/egg-core/commit/613f236fba69f55ca27911d29d81a918c8d67c18)] - docs: fix typo (#147) (m31271n <>) - * [[`25b728c`](http://github.com/eggjs/egg-core/commit/25b728c41fdf941c97f23a2675b8b82443f28938)] - refactor: warning when the plugin disabled by app is enabled implicitly (#141) (Haoliang Gao <>) - -4.3.0 / 2017-12-13 -================== - -**features** - * [[`cbcf402`](http://github.com/eggjs/egg-core/commit/cbcf4028055a570c81b26dd39cadcfc548ffefd4)] - feat: support options.serverScope for egg-mock (#143) (Yiyu He <>) - -4.2.2 / 2017-12-12 -================== - -**fixes** - * [[`b327145`](git@github.com:eggjs/egg-core/commit/b327145d2c6f1328a5d0117186fef218c4b673a7)] - fix: should load router middleware in beforeStart (#139) (Yiyu He <>) - * [[`187fdec`](git@github.com:eggjs/egg-core/commit/187fdec6c63c22c73716741934771eefb54320a8)] - fix: check whether controller exists (#138) (TZ | 天猪 <>) - -4.2.1 / 2017-12-01 -================== - -**fixes** - * [[`035098c`](http://github.com/eggjs/egg-core/commit/035098cfca5b20c05a8dde719f0e3995037b9a04)] - fix: adjust implicitly enable logic (#135) (zōng yǔ <>) - -4.2.0 / 2017-11-29 -================== - -**features** - * [[`4979b98`](http://github.com/eggjs/egg-core/commit/4979b984e12cd39516ed1c6df5f1284c8faede2f)] - feat: export controller function's FULLPATH (#131) (#132) (fengmk2 <>) - -4.1.0 / 2017-11-20 -================== - -**features** - * [[`4bb7472`](git@github.com:eggjs/egg-core/commit/4bb7472b1c2365e5b44d5f7c7f7050cb5915aa75)] - feat: export egg utils (#130) (Yiyu He <>) - -**others** - * [[`a02df89`](git@github.com:eggjs/egg-core/commit/a02df8958f040dc1796dffb0094f535c5c3936e9)] - test: use async function instead of generator function (#128) (Yiyu He <>) - -4.0.0 / 2017-11-08 -================== - -**others** - * [[`ba0c9b9`](git@github.com:eggjs/egg-core/commit/ba0c9b9e44c57333485e5424b81f047249232232)] - refactor: upgrade to koa@2 and koa-router@7 [BREAKING_CHANGE] (#125) (Yiyu He <>) - -3.18.0 / 2017-11-08 -================== - -**features** - * [[`c944f79`](git@github.com:eggjs/egg-core/commit/c944f79cf9c4ec160bb56d97b41fc7d7e2c8d27c)] - feat: export app.options (#127) (Haoliang Gao <>) - -3.17.0 / 2017-11-07 -================== - -**features** - * [[`08b498f`](git@github.com:eggjs/egg-core/commit/08b498f76ff259ee049c20eb1933c5a294179cc8)] - feat: toAsyncFunction compact with async function (#126) (Yiyu He <>) - -3.16.0 / 2017-11-06 -================== - -**features** - * [[`f9b4ae8`](git@github.com:eggjs/egg-core/commit/f9b4ae89b9d0b51a042fe7f80ab0cee184f30445)] - feat: add toPromise and toAsyncFunction (#124) (Yiyu He <>) - -3.15.1 / 2017-10-29 -================== - -**others** - * [[`1eaa0c6`](http://github.com/eggjs/egg-core/commit/1eaa0c689aabd650955d0150228d3bd2a3dd8aa9)] - refactor: use utility to read json (#122) (Haoliang Gao <>) - -3.15.0 / 2017-10-20 -================== - -**features** - * [[`eedfd3d`](http://github.com/eggjs/egg-core/commit/eedfd3d4517f1931f541d0201c3f7d1c2fbf85a3)] - feat: support serverScope (#120) (Haoliang Gao <>) - -3.14.0 / 2017-10-17 -================== - -**features** - * [[`c2dec90`](http://github.com/eggjs/egg-core/commit/c2dec90b0f942384f62c432d61f4917c55652fd4)] - feat(core): adding support to register inherited methods when loading controllers (#119) (lkspc <>) - -3.13.1 / 2017-09-01 -=================== - - * fix: TypeError when DEBUG=* (#112) - -3.13.0 / 2017-07-24 -=================== - - * feat: controller support params by config (#110) - * style: spelling mistakes,orginal -> original (#109) - -3.12.2 / 2017-07-11 -=================== - - * fix: check loader existing before retrieve properties (#108) - -3.12.1 / 2017-07-05 -================== - - * fix: should ignore Object.getPrototypeOf check on null/undefined (#107) - -3.12.0 / 2017-07-05 -=================== - - * feat: generate configMeta (#106) - * deps: upgrade eslint (#104) - * docs: fix typo (#103) - * deps: upgrade dependencies (#102) - * refactor(plugin): ignore loop when push plugin.default.js (#101) - -3.11.0 / 2017-06-21 -================== - - * feat: framework can override getExtendFilePaths (#100) - -3.10.0 / 2017-06-08 -=================== - - * chore: improve cov (#91) - * feat: support app.middleware[name] (#98) - * test: add node 8 (#97) - -3.9.0 / 2017-05-31 -================== - - * feat: app timeout support config by env (#94) - * fix: load class controller should skip getter & setter (#96) - * refactor: use template literals in lib/utils/index.js (#95) - -3.8.0 / 2017-05-20 -================== - - * feat: support load custom file type (#93) - * chore(documentation): fix typo (#92) - * test: fix the testcase that is skipped (#89) - * refactor: change private function name to Symbol from being called outside. (#87) - * test: skip the failed testcase (#88) - * refactor: use es6 rest parameter. (#84) - -3.7.0 / 2017-05-03 -================== - - * feat(file_loader): support filter options (#86) - * feat: support custom directory (#85) - * refact: use es6 default parameter value synax. (#83) - -3.6.0 / 2017-05-02 -================== - - * feat: add fullPath property on class instance (#82) - -3.5.0 / 2017-04-26 -================== - - * feat(file_loader): ignore option support array in FileLoader (#81) - * fix: wrong optional dependencies in complex demo (#80) - -3.4.1 / 2017-04-21 -================== - - * fix: should support module.exports = function*(ctx) {} as a controller (#79) - -3.4.0 / 2017-04-18 -================== - - * refactor: export getHomedir that can be extended (#78) - * feat: expose eggPlugins (#77) - -3.3.1 / 2017-04-17 -================== - - * fix: optionally depend on a plugin which is disabled. (#76) - -3.3.0 / 2017-04-15 -================== - - * feat: always load extend/xx.unittest.js when run test (#75) - -3.2.2 / 2017-04-14 -================== - - * fix: don't replace plugin.default.js when serverEnv is default (#74) - -3.2.1 / 2017-04-13 -================== - - * fix: allow extend setter or getter alone (#73) - -3.2.0 / 2017-04-11 -================== - - * test: add testcase for appPlugins and customPlugins (#72) - * fix: find the true callee bebind proxy (#70) - * feat:expose appPlugins & customPlugins (#68) - * feat: expose BaseContextClass (#71) - -3.1.0 / 2017-04-10 -================== - - * feat: to keep controller function attributes (#69) - -3.0.1 / 2017-04-10 -================== - - * fix: ensure deprecate display the right call stack (#67) - -3.0.0 / 2017-03-07 -================== - - * feat: [BREAKING_CHANGE] array will be overridden when load config (#64) - -2.2.0 / 2017-02-27 -================== - - * fix: improve getPathName (#62) - * feat: FileLoader support caseStyle (#59) - * fix: improve require es module (#61) - -2.1.1 / 2017-02-17 -================== - - * fix: define egg.Service and egg.Controller in constructor (#58) - -2.1.0 / 2017-02-15 -================== - - * feat: load plugin.default.js rather than plugin.js (#57) - * refactor: seperate router api from app (#55) - -2.0.1 / 2017-02-15 -================== - - * fix: context loader cache independent in each request (#54) - -2.0.0 / 2017-02-10 -================== - - * feat: [BREAKING_CHANGE] can get error from .ready() (#53) - * fix: make sure close once (#51) - * feat: imporve error message of async controller (#52) - * deps: remove unuse devDeps (#49) - * feat: [BREAKING_CHANGE] all middleware support async function and common function (#50) - -1.8.0 / 2017-02-06 -================== - - * feat: app.beforeStart support async function same as beforeClose (#48) - * test: fix test on windows (#47) - * feat: add this.service in BaseContextClass (#46) - * feat: add this.config in BaseContextClass (#44) - * fix: execute beforeClose hooks in reverse order (#45) - -1.7.0 / 2017-01-26 -================== - - * feat: add app.beforeClose to register close function (#43) - -1.6.0 / 2017-01-20 -================== - - * feat: controller support class (#42) - -1.5.1 / 2017-01-19 -================== - - * fix: don't assert config.proxy (#41) - -1.5.0 / 2017-01-17 -================== - - * feat: plugin support optionalDependencies (#40) - -1.4.0 / 2017-01-12 -================== - - * refactor: support config/env instead of config/serverEnv (#37) - * fix(router): support app.get(url, controllerName) (#38) - * feat: support app.beforeStart (#39) - -1.3.3 / 2016-12-28 -================== - - * test: use assert instead of should - * refactor: warn only for redefine the same package - -1.3.2 / 2016-12-08 -================== - - * fix: distinguish property cache (#35) - -1.3.1 / 2016-12-03 -================== - - * fix: router.url can't parse multi params right (#34) - -1.3.0 / 2016-11-25 -================== - - * feat: make app middlewares also support enable (#33) - -1.2.0 / 2016-11-21 -================== - - * refactor: don't use core middleware when enable = false (#32) - * feat: core middlewares support enable/match/ignore options (#31) - -1.1.0 / 2016-11-09 -================== - - * refactor: extract getAppInfo that can be extend (#30) - -1.0.1 / 2016-11-07 -================== - - * chore: add pkg.files (#29) - -1.0.0 / 2016-11-04 -================== - - * feat: warn when redefine plugin (#28) - * refactor: assert eggPath should be string - -0.6.0 / 2016-10-28 -================== - - * feat: app support export generator (#26) - -0.5.0 / 2016-10-24 -================== - - * feat: app.js/agent.js support async function (#18) - * feat: add EGG_HOME to getHomedir for test (#25) - -0.4.0 / 2016-10-24 -================== - - * feat: support plugin.{env}.js (#20) - * feat: support {env}.js when load extend (#21) - * feat: app.close return a promise (#19) - * feat: [BREAKING_CHANGE] env as prod when EGG_SERVER_ENV undefined & NODE_ENV prod (#24) - * feat: warning when missing EGG_SERVER_ENV at production (#23) - * test: fix homedir testcase on Windows (#22) - -0.3.0 / 2016-10-13 -================== - - * fix: always get the executor's homedir (#17) - * doc: Plugable > Pluggable (#16) - * test: delete type testcase (#15) - * fix: can't get appConfig in appConfig (#14) - * feat: add plugin.from where declare the plugin (#13) - * feat: [BREAKING_CHANGE] remove compatible support loadExtend (#12) - -0.2.1 / 2016-08-18 -================== - - * fix: resolve the realpath of plugin path (#11) - -0.2.0 / 2016-08-17 -================== - - * feat: improve initializer && export Loader - -0.1.0 / 2016-08-16 -================== - - * feat: rename egg-loader to egg-core (#8) - * refactor: rename to egg-core (#6) - * doc: proofread readme documentation and correct english terms (#7) - * refactor API (#5) - * refactor: implement Loader instead of loading (#4) - -0.0.3 / 2016-07-30 -================== - - * test: add testcase (#3) - * fix: don't print middleware options on start log (#2) - -0.0.2 / 2016-07-16 -================== - - * first version diff --git a/lib/egg.js b/lib/egg.js index af4709fe..910b4992 100644 --- a/lib/egg.js +++ b/lib/egg.js @@ -38,9 +38,13 @@ class EggCore extends KoaApplication { assert(fs.statSync(options.baseDir).isDirectory(), `Directory ${options.baseDir} is not a directory`); assert(options.type === 'application' || options.type === 'agent', 'options.type should be application or agent'); - // enable asyncLocalStorage by default - // https://github.com/koajs/koa/pull/1721 - super({ asyncLocalStorage: enableAsyncLocalStorage }); + // disable koa als and use egg logic + super({ asyncLocalStorage: false }); + // can access the AsyncLocalStorage instance in global + if (enableAsyncLocalStorage) { + const { getAsyncLocalStorage } = require('gals'); + this.ctxStorage = getAsyncLocalStorage(); + } this.timing = new Timing(); diff --git a/package.json b/package.json index c13877a7..ebb21f87 100644 --- a/package.json +++ b/package.json @@ -66,6 +66,7 @@ "egg-logger": "^2.4.1", "egg-path-matching": "^1.0.1", "extend2": "^1.0.0", + "gals": "^1.0.2", "get-ready": "^2.0.1", "globby": "^10.0.2", "is-type-of": "^1.2.1", diff --git a/test/asyncLocalStorage.test.js b/test/asyncLocalStorage.test.js index 87d334f3..b239920c 100644 --- a/test/asyncLocalStorage.test.js +++ b/test/asyncLocalStorage.test.js @@ -28,4 +28,16 @@ describe('test/asyncLocalStorage.test.js', () => { } assert(app.currentContext === undefined); }); + + if (enableAsyncLocalStorage) { + it('should access als on global', async () => { + const { getAsyncLocalStorage, kGALS } = require('gals'); + const { AsyncLocalStorage } = require('async_hooks'); + assert(global[Symbol.for('gals#asyncLocalStorage')]); + assert(global[kGALS]); + assert(global[Symbol.for('gals#asyncLocalStorage')] instanceof AsyncLocalStorage); + assert.equal(app.ctxStorage, global[Symbol.for('gals#asyncLocalStorage')]); + assert.equal(app.ctxStorage, getAsyncLocalStorage()); + }); + } }); diff --git a/test/loader/mixin/load_middleware.test.js b/test/loader/mixin/load_middleware.test.js index 8b650aa1..1223aee8 100644 --- a/test/loader/mixin/load_middleware.test.js +++ b/test/loader/mixin/load_middleware.test.js @@ -3,7 +3,6 @@ const path = require('path'); const assert = require('assert'); const request = require('supertest'); -const enableAsyncLocalStorage = !!require('async_hooks').AsyncLocalStorage; const utils = require('../../utils'); describe('test/loader/mixin/load_middleware.test.js', function() { @@ -38,12 +37,7 @@ describe('test/loader/mixin/load_middleware.test.js', function() { for (const mw of app.middleware) { assert(typeof mw === 'function'); } - if (enableAsyncLocalStorage) { - // the first middleware is asyncCtxStorage - assert(Object.keys(app.middleware).length === 4); - } else { - assert(Object.keys(app.middleware).length === 3); - } + assert(Object.keys(app.middleware).length === 3); }); it('should override middlewares of plugin by framework', async () => {