Socket
Socket
Sign inDemoInstall

egg-aop

Package Overview
Dependencies
3
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.5.1 to 0.5.2

6

History.md
0.5.2 / 2018-08-09
==================
* feat: add context to Promise return value for aspect.
* fix: maybe trigger getter when lazyInject read default value.
0.5.1 / 2018-06-26

@@ -3,0 +9,0 @@ ==================

1

lib/aspect.d.ts
export declare type Throwable = Error | any;
export declare const FunctionContextSymbol: unique symbol;
export interface FunctionContext<T = any> {

@@ -3,0 +4,0 @@ readonly inst: T;

@@ -7,2 +7,3 @@ "use strict";

}
exports.FunctionContextSymbol = Symbol('FunctionContextSymbol');
function run(func, context) {

@@ -61,2 +62,7 @@ func && func(context);

}
Object.defineProperty(context.ret, exports.FunctionContextSymbol, {
enumerable: false,
configurable: true,
value: context,
});
return context.ret;

@@ -63,0 +69,0 @@ }

9

lib/decorators.js

@@ -7,3 +7,3 @@ "use strict";

const appctx_1 = require("./appctx");
const decorators_1 = require("power-di/lib/helper/decorators");
const utils_1 = require("power-di/utils");
/**

@@ -53,3 +53,3 @@ * register component

helper_1.inject({ type })(target, key);
const clsType = decorators_1.getClsTypeByDecorator(type, target, key);
const clsType = utils_1.getClsTypeByDecorator(type, target, key);
let value;

@@ -78,4 +78,5 @@ Object.defineProperty(target, key, {

helper_1.lazyInject({ type })(target, key);
const clsType = decorators_1.getClsTypeByDecorator(type, target, key);
const defaultValue = target[key];
const clsType = utils_1.getClsTypeByDecorator(type, target, key);
const descriptor = Object.getOwnPropertyDescriptor(target, key);
const defaultValue = descriptor && descriptor.value;
Object.defineProperty(target, key, {

@@ -82,0 +83,0 @@ configurable: true,

@@ -32,4 +32,3 @@ "use strict";

let ioc = undefined;
const useCtxProxyForAppComponent = app.config.aop.useCtxProxyForAppComponent;
const autoRegisterToCtx = app.config.aop.autoRegisterToCtx;
const { useCtxProxyForAppComponent, autoRegisterToCtx } = app.config.aop;
if (autoRegisterToCtx && !typeLoader_1.typeLoader.has(clsType)) {

@@ -36,0 +35,0 @@ typeLoader_1.register(clsType, clsType, clsType[exports.contextTypeSymbol] || 'Context');

{
"name": "egg-aop",
"version": "0.5.1",
"version": "0.5.2",
"description": "aop for egg.",

@@ -9,7 +9,7 @@ "main": "lib/index.js",

"app/**/*.js",
"app/**/*.ts",
"app/**/*.d.ts",
"config/**/*.js",
"config/**/*.ts",
"config/**/*.d.ts",
"lib/**/*.js",
"lib/**/*.ts"
"lib/**/*.d.ts"
],

@@ -23,3 +23,3 @@ "eggPlugin": {

"dependencies": {
"power-di": "^1.4.11",
"power-di": "^1.4.16",
"tslib": "^1.9.0"

@@ -55,3 +55,4 @@ },

"ts": "rimraf app/**/*.js lib/**/*.js && tsc",
"prepublish": "npm run ts"
"prepublish": "npm run ts",
"postpublish": "node scripts/published.js"
},

@@ -58,0 +59,0 @@ "ci": {

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc