Socket
Socket
Sign inDemoInstall

egg-core

Package Overview
Dependencies
Maintainers
4
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

egg-core - npm Package Compare versions

Comparing version 1.7.0 to 1.8.0

9

History.md
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

@@ -3,0 +12,0 @@ ==================

17

lib/egg.js

@@ -142,7 +142,7 @@ 'use strict';

*
* @param {GeneratorFunction} scope function will excute before app start
* @param {Function|GeneratorFunction|AsyncFunction} scope function will excute before app start
*/
beforeStart(scope) {
if (!is.generatorFunction(scope)) {
throw new Error('beforeStart only support generator function');
if (!is.function(scope)) {
throw new Error('beforeStart only support function');
}

@@ -156,3 +156,5 @@

process.nextTick(() => {
co(scope).then(() => done(), done);
co(function* () {
yield utils.callFn(scope);
}).then(() => done(), done);
});

@@ -171,5 +173,6 @@ }

// custom close
for (const fn of this[CLOSESET]) {
yield utils.callFn(fn);
// close in reverse order: first created, last closed
const closeFns = Array.from(this[CLOSESET]);
for (let i = closeFns.length - 1; i >= 0; i--) {
yield utils.callFn(closeFns[i]);
}

@@ -176,0 +179,0 @@

@@ -7,2 +7,4 @@ 'use strict';

this.app = ctx.app;
this.config = ctx.app.config;
this.service = ctx.service;
}

@@ -9,0 +11,0 @@ }

'use strict';
const path = require('path');
const interopRequire = require('interop-require');

@@ -39,7 +40,7 @@ const homedir = require('node-homedir');

// /path/to/app/controller/admin/config.js => controller.admin.config
getPathName(path, app) {
getPathName(fullpath, app) {
const baseDir = app.loader.appInfo.baseDir;
return path
.replace(`${baseDir}/app/`, '')
.replace(/\//g, '.')
return fullpath
.replace(path.join(baseDir, 'app/'), '')
.replace(/\/|\\/g, '.')
.replace(/\.js$/, '');

@@ -46,0 +47,0 @@ },

{
"name": "egg-core",
"version": "1.7.0",
"version": "1.8.0",
"description": "A core Pluggable framework based on koa",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc