@eggjs/tegg-aop-plugin 3.8.0 → 3.9.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.
Files changed (2) hide show
  1. package/README.md +7 -2
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -61,7 +61,10 @@ import { ContextProto } from '@eggjs/tegg';
61
61
 
62
62
  @ContextProto()
63
63
  export class Hello {
64
- @Pointcut(AdviceExample)
64
+
65
+ // 创建 Hello.hello 的切面 AdviceExample,并传递 adviceParams 给 AdviceExample
66
+ // AdviceExample 的切面函数可以通过 ctx.adviceParams 拿到注解传入的参数
67
+ @Pointcut(AdviceExample, { adviceParams: { foo: 'bar' } })
65
68
  async hello(name: string) {
66
69
  return `hello ${name}`;
67
70
  }
@@ -81,11 +84,13 @@ export class Hello {
81
84
  import { Crosscut, Advice, IAdvice } from '@eggjs/tegg/aop';
82
85
 
83
86
  // 通过类型来指定
87
+ // 创建 CrosscutClassAdviceExample.hello 的切面 CrosscutExample,并传递 adviceParams 给 CrosscutExample
88
+ // CrosscutExample 的切面函数可以通过 ctx.adviceParams 拿到注解传入的参数
84
89
  @Crosscut({
85
90
  type: PointcutType.CLASS,
86
91
  clazz: CrosscutExample,
87
92
  methodName: 'hello',
88
- })
93
+ }, { adviceParams: { foo: 'bar' } })
89
94
  @Advice()
90
95
  export class CrosscutClassAdviceExample implements IAdvice {
91
96
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eggjs/tegg-aop-plugin",
3
- "version": "3.8.0",
3
+ "version": "3.9.0",
4
4
  "eggPlugin": {
5
5
  "name": "aopModule",
6
6
  "dependencies": [
@@ -40,12 +40,12 @@
40
40
  "node": ">=14.0.0"
41
41
  },
42
42
  "dependencies": {
43
- "@eggjs/tegg": "^3.8.0",
44
- "@eggjs/tegg-aop-runtime": "^3.8.0"
43
+ "@eggjs/tegg": "^3.9.0",
44
+ "@eggjs/tegg-aop-runtime": "^3.9.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@eggjs/tegg-config": "^3.8.0",
48
- "@eggjs/tegg-plugin": "^3.8.0",
48
+ "@eggjs/tegg-plugin": "^3.9.0",
49
49
  "@types/mocha": "^10.0.1",
50
50
  "@types/node": "^20.2.4",
51
51
  "cross-env": "^7.0.3",
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "2c683c3dfce4d0483c1ecfa79b6e34af52bdc0ed"
61
+ "gitHead": "b5dddc912ad523d6075b400798e813dc2e2e080b"
62
62
  }