babel-plugin-zova-bean-module 1.1.0 → 1.2.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.
- package/LICENSE +0 -0
- package/README.md +0 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +5 -5
- package/package.json +20 -16
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
File without changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { PluginPass } from '@babel/core';
|
|
2
2
|
import type { Visitor } from '@babel/traverse';
|
|
3
|
-
export
|
|
3
|
+
export interface PluginZovaBeanModuleOptions {
|
|
4
|
+
brandName: 'zova' | 'vona';
|
|
5
|
+
}
|
|
6
|
+
export default function (_plugin: any, options: PluginZovaBeanModuleOptions): {
|
|
4
7
|
visitor: Visitor<PluginPass>;
|
|
5
8
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { /* template, */ types as t } from '@babel/core';
|
|
2
2
|
import { parseInfoFromPath } from '@cabloy/module-info';
|
|
3
|
-
export default function () {
|
|
3
|
+
export default function (_plugin, options) {
|
|
4
4
|
const visitor = {
|
|
5
5
|
Program(path, state) {
|
|
6
6
|
const beanInfo = __parseBeanInfo(state);
|
|
@@ -14,7 +14,7 @@ export default function () {
|
|
|
14
14
|
path.traverse(createVisitor(context, beanInfo));
|
|
15
15
|
// insertImport
|
|
16
16
|
if (context.needBeanInfo) {
|
|
17
|
-
insertImport(path);
|
|
17
|
+
insertImport(path, options);
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
};
|
|
@@ -32,8 +32,8 @@ function createVisitor(context, beanInfo) {
|
|
|
32
32
|
},
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
function insertImport(path) {
|
|
36
|
-
const nodeImport = t.importDeclaration([t.importSpecifier(t.identifier('__z_BeanInfo'), t.stringLiteral('BeanInfo'))], t.stringLiteral(
|
|
35
|
+
function insertImport(path, options) {
|
|
36
|
+
const nodeImport = t.importDeclaration([t.importSpecifier(t.identifier('__z_BeanInfo'), t.stringLiteral('BeanInfo'))], t.stringLiteral(options.brandName));
|
|
37
37
|
path.get('body')[0].insertBefore(nodeImport);
|
|
38
38
|
}
|
|
39
39
|
function __parseBeanInfo(state) {
|
|
@@ -72,7 +72,7 @@ function __createDecoratorNode(beanInfo) {
|
|
|
72
72
|
function __checkIfValid(fileName) {
|
|
73
73
|
if (!fileName)
|
|
74
74
|
return false;
|
|
75
|
-
return !['src/boot/app/', '.zova/app/'].some(item => {
|
|
75
|
+
return !['src/boot/app/', '.zova/app/', 'src/backend/', '.vona/'].some(item => {
|
|
76
76
|
return fileName.includes(item);
|
|
77
77
|
});
|
|
78
78
|
}
|
package/package.json
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babel-plugin-zova-bean-module",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"gitHead": "f98cfc976a1569ca212000ced3f10f1a211bb97e",
|
|
5
5
|
"description": "babel-plugin-zova-bean-module",
|
|
6
|
-
"publishConfig": {
|
|
7
|
-
"access": "public"
|
|
8
|
-
},
|
|
9
|
-
"author": "zhennann",
|
|
10
|
-
"license": "MIT",
|
|
11
6
|
"keywords": [
|
|
12
|
-
"egg",
|
|
13
|
-
"egg-born",
|
|
14
7
|
"framework",
|
|
15
8
|
"zova"
|
|
16
9
|
],
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"author": "zhennann",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"type": "module",
|
|
17
16
|
"exports": {
|
|
18
17
|
".": {
|
|
19
18
|
"types": [
|
|
@@ -24,12 +23,17 @@
|
|
|
24
23
|
},
|
|
25
24
|
"./package.json": "./package.json"
|
|
26
25
|
},
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
30
29
|
"dependencies": {
|
|
31
|
-
"@
|
|
32
|
-
"@
|
|
30
|
+
"@babel/core": "^7.28.0",
|
|
31
|
+
"@babel/traverse": "^7.28.0",
|
|
32
|
+
"@cabloy/module-info": "^2.0.0",
|
|
33
|
+
"@cabloy/word-utils": "^2.1.0"
|
|
33
34
|
},
|
|
34
|
-
"
|
|
35
|
-
|
|
35
|
+
"scripts": {
|
|
36
|
+
"clean": "rimraf dist tsconfig.tsbuildinfo",
|
|
37
|
+
"tsc:publish": "npm run clean && tsc"
|
|
38
|
+
}
|
|
39
|
+
}
|