@umijs/ast 4.0.0-rc.7 → 4.0.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.
|
@@ -79,10 +79,32 @@ function setConfigByName(ast, name, value) {
|
|
|
79
79
|
},
|
|
80
80
|
});
|
|
81
81
|
if (!isChanged) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
let modified = false;
|
|
83
|
+
traverse.default(ast, {
|
|
84
|
+
CallExpression(path) {
|
|
85
|
+
if (t.isExportDefaultDeclaration(path.parent) &&
|
|
86
|
+
t.isIdentifier(path.node.callee, { name: 'defineConfig' }) &&
|
|
87
|
+
t.isObjectExpression(path.node.arguments[0])) {
|
|
88
|
+
path.node.arguments[0].properties.push(t.objectProperty(t.identifier(name), valueObject));
|
|
89
|
+
modified = true;
|
|
90
|
+
path.stop();
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
ObjectExpression(path) {
|
|
94
|
+
if (t.isExportDefaultDeclaration(path.parent)) {
|
|
95
|
+
path.node.properties.push(t.objectProperty(t.identifier(name), valueObject));
|
|
96
|
+
modified = true;
|
|
97
|
+
path.stop();
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
if (!modified) {
|
|
102
|
+
console.error(`export config format can not be analysis, please reference to \nhttps://next.umijs.org/zh-CN/docs/guides/config-convention`);
|
|
103
|
+
throw Error(`Can't modify config file, due to file format`);
|
|
104
|
+
}
|
|
85
105
|
}
|
|
86
106
|
return ast;
|
|
87
107
|
}
|
|
88
108
|
exports.setConfigByName = setConfigByName;
|
|
109
|
+
const config = { dva: {} };
|
|
110
|
+
exports.default = config;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/ast",
|
|
3
|
-
"version": "4.0.0
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "@umijs/ast",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi-next/tree/master/packages/ast#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi-next/issues",
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
],
|
|
17
17
|
"scripts": {
|
|
18
18
|
"build": "pnpm tsc",
|
|
19
|
-
"build:deps": "
|
|
19
|
+
"build:deps": "umi-scripts bundleDeps",
|
|
20
20
|
"dev": "pnpm build -- --watch",
|
|
21
|
-
"test": "
|
|
21
|
+
"test": "umi-scripts jest-turbo"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@umijs/bundler-utils": "4.0.0
|
|
24
|
+
"@umijs/bundler-utils": "4.0.0"
|
|
25
25
|
},
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|