umi 4.0.0-rc.8 → 4.0.1
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/client/client/plugin.js +131 -55
- package/client/client/utils.js +4 -3
- package/dist/cli/cli.js +37 -46
- package/dist/cli/forkedDev.js +6 -13
- package/dist/cli/node.js +3 -3
- package/dist/cli/printHelp.d.ts +1 -0
- package/dist/cli/printHelp.js +10 -0
- package/dist/client/plugin.js +21 -22
- package/dist/constants.d.ts +0 -1
- package/dist/constants.js +1 -2
- package/dist/defineMock.d.ts +8 -0
- package/dist/defineMock.js +7 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/pluginUtils.d.ts +4 -0
- package/dist/pluginUtils.js +22 -0
- package/dist/service/service.js +21 -24
- package/dist/test.js +19 -30
- package/eslint.js +7 -0
- package/index.d.ts +3 -2
- package/package.json +23 -9
- package/prettier.js +12 -0
- package/stylelint.js +7 -0
package/client/client/plugin.js
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
1
12
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
13
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
14
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -7,6 +18,33 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
18
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
19
|
});
|
|
9
20
|
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (_) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
10
48
|
import { assert, compose, isPromiseLike } from './utils';
|
|
11
49
|
export var ApplyPluginsType;
|
|
12
50
|
(function (ApplyPluginsType) {
|
|
@@ -14,27 +52,29 @@ export var ApplyPluginsType;
|
|
|
14
52
|
ApplyPluginsType["modify"] = "modify";
|
|
15
53
|
ApplyPluginsType["event"] = "event";
|
|
16
54
|
})(ApplyPluginsType || (ApplyPluginsType = {}));
|
|
17
|
-
|
|
18
|
-
|
|
55
|
+
var PluginManager = /** @class */ (function () {
|
|
56
|
+
function PluginManager(opts) {
|
|
19
57
|
this.hooks = {};
|
|
20
58
|
this.opts = opts;
|
|
21
59
|
}
|
|
22
|
-
register(plugin) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
60
|
+
PluginManager.prototype.register = function (plugin) {
|
|
61
|
+
var _this = this;
|
|
62
|
+
assert(plugin.apply, "plugin register failed, apply must supplied");
|
|
63
|
+
Object.keys(plugin.apply).forEach(function (key) {
|
|
64
|
+
assert(_this.opts.validKeys.indexOf(key) > -1, "register failed, invalid key ".concat(key, " ").concat(plugin.path ? "from plugin ".concat(plugin.path) : '', "."));
|
|
65
|
+
_this.hooks[key] = (_this.hooks[key] || []).concat(plugin.apply[key]);
|
|
27
66
|
});
|
|
28
|
-
}
|
|
29
|
-
getHooks(keyWithDot) {
|
|
30
|
-
|
|
31
|
-
|
|
67
|
+
};
|
|
68
|
+
PluginManager.prototype.getHooks = function (keyWithDot) {
|
|
69
|
+
var _a = keyWithDot.split('.'), key = _a[0], memberKeys = _a.slice(1);
|
|
70
|
+
var hooks = this.hooks[key] || [];
|
|
32
71
|
if (memberKeys.length) {
|
|
33
72
|
hooks = hooks
|
|
34
|
-
.map((hook)
|
|
73
|
+
.map(function (hook) {
|
|
35
74
|
try {
|
|
36
|
-
|
|
37
|
-
for (
|
|
75
|
+
var ret = hook;
|
|
76
|
+
for (var _i = 0, memberKeys_1 = memberKeys; _i < memberKeys_1.length; _i++) {
|
|
77
|
+
var memberKey = memberKeys_1[_i];
|
|
38
78
|
ret = ret[memberKey];
|
|
39
79
|
}
|
|
40
80
|
return ret;
|
|
@@ -46,76 +86,112 @@ export class PluginManager {
|
|
|
46
86
|
.filter(Boolean);
|
|
47
87
|
}
|
|
48
88
|
return hooks;
|
|
49
|
-
}
|
|
50
|
-
applyPlugins
|
|
51
|
-
|
|
89
|
+
};
|
|
90
|
+
PluginManager.prototype.applyPlugins = function (_a) {
|
|
91
|
+
var _this = this;
|
|
92
|
+
var key = _a.key, type = _a.type, initialValue = _a.initialValue, args = _a.args, async = _a.async;
|
|
93
|
+
var hooks = this.getHooks(key) || [];
|
|
52
94
|
if (args) {
|
|
53
|
-
assert(typeof args === 'object',
|
|
95
|
+
assert(typeof args === 'object', "applyPlugins failed, args must be plain object.");
|
|
96
|
+
}
|
|
97
|
+
if (async) {
|
|
98
|
+
assert(type === ApplyPluginsType.modify || type === ApplyPluginsType.event, "async only works with modify and event type.");
|
|
54
99
|
}
|
|
55
100
|
switch (type) {
|
|
56
101
|
case ApplyPluginsType.modify:
|
|
57
102
|
if (async) {
|
|
58
|
-
return hooks.reduce((memo, hook)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
103
|
+
return hooks.reduce(function (memo, hook) { return __awaiter(_this, void 0, void 0, function () {
|
|
104
|
+
var ret;
|
|
105
|
+
return __generator(this, function (_a) {
|
|
106
|
+
switch (_a.label) {
|
|
107
|
+
case 0:
|
|
108
|
+
assert(typeof hook === 'function' ||
|
|
109
|
+
typeof hook === 'object' ||
|
|
110
|
+
isPromiseLike(hook), "applyPlugins failed, all hooks for key ".concat(key, " must be function, plain object or Promise."));
|
|
111
|
+
if (!isPromiseLike(memo)) return [3 /*break*/, 2];
|
|
112
|
+
return [4 /*yield*/, memo];
|
|
113
|
+
case 1:
|
|
114
|
+
memo = _a.sent();
|
|
115
|
+
_a.label = 2;
|
|
116
|
+
case 2:
|
|
117
|
+
if (!(typeof hook === 'function')) return [3 /*break*/, 6];
|
|
118
|
+
ret = hook(memo, args);
|
|
119
|
+
if (!isPromiseLike(ret)) return [3 /*break*/, 4];
|
|
120
|
+
return [4 /*yield*/, ret];
|
|
121
|
+
case 3: return [2 /*return*/, _a.sent()];
|
|
122
|
+
case 4: return [2 /*return*/, ret];
|
|
123
|
+
case 5: return [3 /*break*/, 9];
|
|
124
|
+
case 6:
|
|
125
|
+
if (!isPromiseLike(hook)) return [3 /*break*/, 8];
|
|
126
|
+
return [4 /*yield*/, hook];
|
|
127
|
+
case 7:
|
|
128
|
+
hook = _a.sent();
|
|
129
|
+
_a.label = 8;
|
|
130
|
+
case 8: return [2 /*return*/, __assign(__assign({}, memo), hook)];
|
|
131
|
+
case 9: return [2 /*return*/];
|
|
69
132
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
if (isPromiseLike(hook)) {
|
|
76
|
-
hook = yield hook;
|
|
77
|
-
}
|
|
78
|
-
return Object.assign(Object.assign({}, memo), hook);
|
|
79
|
-
}
|
|
80
|
-
}), isPromiseLike(initialValue)
|
|
133
|
+
});
|
|
134
|
+
}); }, isPromiseLike(initialValue)
|
|
81
135
|
? initialValue
|
|
82
136
|
: Promise.resolve(initialValue));
|
|
83
137
|
}
|
|
84
138
|
else {
|
|
85
|
-
return hooks.reduce((memo, hook)
|
|
86
|
-
assert(typeof hook === 'function' || typeof hook === 'object',
|
|
139
|
+
return hooks.reduce(function (memo, hook) {
|
|
140
|
+
assert(typeof hook === 'function' || typeof hook === 'object', "applyPlugins failed, all hooks for key ".concat(key, " must be function or plain object."));
|
|
87
141
|
if (typeof hook === 'function') {
|
|
88
142
|
return hook(memo, args);
|
|
89
143
|
}
|
|
90
144
|
else {
|
|
91
145
|
// TODO: deepmerge?
|
|
92
|
-
return
|
|
146
|
+
return __assign(__assign({}, memo), hook);
|
|
93
147
|
}
|
|
94
148
|
}, initialValue);
|
|
95
149
|
}
|
|
96
150
|
case ApplyPluginsType.event:
|
|
97
|
-
return
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
151
|
+
return (function () { return __awaiter(_this, void 0, void 0, function () {
|
|
152
|
+
var _i, hooks_1, hook, ret;
|
|
153
|
+
return __generator(this, function (_a) {
|
|
154
|
+
switch (_a.label) {
|
|
155
|
+
case 0:
|
|
156
|
+
_i = 0, hooks_1 = hooks;
|
|
157
|
+
_a.label = 1;
|
|
158
|
+
case 1:
|
|
159
|
+
if (!(_i < hooks_1.length)) return [3 /*break*/, 4];
|
|
160
|
+
hook = hooks_1[_i];
|
|
161
|
+
assert(typeof hook === 'function', "applyPlugins failed, all hooks for key ".concat(key, " must be function."));
|
|
162
|
+
ret = hook(args);
|
|
163
|
+
if (!(async && isPromiseLike(ret))) return [3 /*break*/, 3];
|
|
164
|
+
return [4 /*yield*/, ret];
|
|
165
|
+
case 2:
|
|
166
|
+
_a.sent();
|
|
167
|
+
_a.label = 3;
|
|
168
|
+
case 3:
|
|
169
|
+
_i++;
|
|
170
|
+
return [3 /*break*/, 1];
|
|
171
|
+
case 4: return [2 /*return*/];
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
}); })();
|
|
101
175
|
case ApplyPluginsType.compose:
|
|
102
|
-
return ()
|
|
176
|
+
return function () {
|
|
103
177
|
return compose({
|
|
104
178
|
fns: hooks.concat(initialValue),
|
|
105
|
-
args,
|
|
179
|
+
args: args,
|
|
106
180
|
})();
|
|
107
181
|
};
|
|
108
182
|
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
|
|
183
|
+
};
|
|
184
|
+
PluginManager.create = function (opts) {
|
|
185
|
+
var pluginManager = new PluginManager({
|
|
112
186
|
validKeys: opts.validKeys,
|
|
113
187
|
});
|
|
114
|
-
opts.plugins.forEach((plugin)
|
|
188
|
+
opts.plugins.forEach(function (plugin) {
|
|
115
189
|
pluginManager.register(plugin);
|
|
116
190
|
});
|
|
117
191
|
return pluginManager;
|
|
118
|
-
}
|
|
119
|
-
|
|
192
|
+
};
|
|
193
|
+
return PluginManager;
|
|
194
|
+
}());
|
|
195
|
+
export { PluginManager };
|
|
120
196
|
// plugins meta info (in tmp file)
|
|
121
197
|
// hooks api: usePlugin
|
package/client/client/utils.js
CHANGED
|
@@ -2,12 +2,13 @@ export function assert(value, message) {
|
|
|
2
2
|
if (!value)
|
|
3
3
|
throw new Error(message);
|
|
4
4
|
}
|
|
5
|
-
export function compose(
|
|
5
|
+
export function compose(_a) {
|
|
6
|
+
var fns = _a.fns, args = _a.args;
|
|
6
7
|
if (fns.length === 1) {
|
|
7
8
|
return fns[0];
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
return fns.reduce((a, b)
|
|
10
|
+
var last = fns.pop();
|
|
11
|
+
return fns.reduce(function (a, b) { return function () { return b(a, args); }; }, last);
|
|
11
12
|
}
|
|
12
13
|
export function isPromiseLike(obj) {
|
|
13
14
|
return !!obj && typeof obj === 'object' && typeof obj.then === 'function';
|
package/dist/cli/cli.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.run = void 0;
|
|
13
4
|
const utils_1 = require("@umijs/utils");
|
|
@@ -15,44 +6,44 @@ const constants_1 = require("../constants");
|
|
|
15
6
|
const service_1 = require("../service/service");
|
|
16
7
|
const dev_1 = require("./dev");
|
|
17
8
|
const node_1 = require("./node");
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
9
|
+
const printHelp_1 = require("./printHelp");
|
|
10
|
+
async function run(opts) {
|
|
11
|
+
(0, node_1.checkVersion)();
|
|
12
|
+
(0, node_1.checkLocal)();
|
|
13
|
+
(0, node_1.setNodeTitle)();
|
|
14
|
+
(0, node_1.setNoDeprecation)();
|
|
15
|
+
const args = (0, utils_1.yParser)(process.argv.slice(2), {
|
|
16
|
+
alias: {
|
|
17
|
+
version: ['v'],
|
|
18
|
+
help: ['h'],
|
|
19
|
+
},
|
|
20
|
+
boolean: ['version'],
|
|
21
|
+
});
|
|
22
|
+
const command = args._[0];
|
|
23
|
+
if ([constants_1.DEV_COMMAND, 'setup'].includes(command)) {
|
|
24
|
+
process.env.NODE_ENV = 'development';
|
|
25
|
+
}
|
|
26
|
+
else if (command === 'build') {
|
|
27
|
+
process.env.NODE_ENV = 'production';
|
|
28
|
+
}
|
|
29
|
+
if (opts === null || opts === void 0 ? void 0 : opts.presets) {
|
|
30
|
+
process.env.UMI_PRESETS = opts.presets.join(',');
|
|
31
|
+
}
|
|
32
|
+
if (command === constants_1.DEV_COMMAND) {
|
|
33
|
+
(0, dev_1.dev)();
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
try {
|
|
37
|
+
await new service_1.Service().run2({
|
|
38
|
+
name: args._[0],
|
|
39
|
+
args,
|
|
40
|
+
});
|
|
43
41
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
args,
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
catch (e) {
|
|
52
|
-
utils_1.logger.error(e);
|
|
53
|
-
process.exit(1);
|
|
54
|
-
}
|
|
42
|
+
catch (e) {
|
|
43
|
+
utils_1.logger.fatal(e);
|
|
44
|
+
(0, printHelp_1.printHelp)();
|
|
45
|
+
process.exit(1);
|
|
55
46
|
}
|
|
56
|
-
}
|
|
47
|
+
}
|
|
57
48
|
}
|
|
58
49
|
exports.run = run;
|
package/dist/cli/forkedDev.js
CHANGED
|
@@ -1,25 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
const utils_1 = require("@umijs/utils");
|
|
13
4
|
const constants_1 = require("../constants");
|
|
14
5
|
const service_1 = require("../service/service");
|
|
15
6
|
const node_1 = require("./node");
|
|
7
|
+
const printHelp_1 = require("./printHelp");
|
|
16
8
|
(0, node_1.setNodeTitle)(`${constants_1.FRAMEWORK_NAME}-dev`);
|
|
17
9
|
(0, node_1.setNoDeprecation)();
|
|
18
|
-
(() =>
|
|
10
|
+
(async () => {
|
|
19
11
|
try {
|
|
20
12
|
const args = (0, utils_1.yParser)(process.argv.slice(2));
|
|
21
13
|
const service = new service_1.Service();
|
|
22
|
-
|
|
14
|
+
await service.run2({
|
|
23
15
|
name: constants_1.DEV_COMMAND,
|
|
24
16
|
args,
|
|
25
17
|
});
|
|
@@ -45,7 +37,8 @@ const node_1 = require("./node");
|
|
|
45
37
|
}
|
|
46
38
|
}
|
|
47
39
|
catch (e) {
|
|
48
|
-
utils_1.logger.
|
|
40
|
+
utils_1.logger.fatal(e);
|
|
41
|
+
(0, printHelp_1.printHelp)();
|
|
49
42
|
process.exit(1);
|
|
50
43
|
}
|
|
51
|
-
})
|
|
44
|
+
})();
|
package/dist/cli/node.js
CHANGED
|
@@ -5,14 +5,14 @@ const utils_1 = require("@umijs/utils");
|
|
|
5
5
|
const constants_1 = require("../constants");
|
|
6
6
|
function checkVersion() {
|
|
7
7
|
const v = parseInt(process.version.slice(1));
|
|
8
|
-
if (v < constants_1.MIN_NODE_VERSION || v ===
|
|
9
|
-
utils_1.logger.error(`Your node version ${v} is not supported, please upgrade to ${constants_1.MIN_NODE_VERSION} or above except
|
|
8
|
+
if (v < constants_1.MIN_NODE_VERSION || v === 15 || v === 17) {
|
|
9
|
+
utils_1.logger.error(`Your node version ${v} is not supported, please upgrade to ${constants_1.MIN_NODE_VERSION} or above except 15 or 17.`);
|
|
10
10
|
process.exit(1);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
exports.checkVersion = checkVersion;
|
|
14
14
|
function checkLocal() {
|
|
15
|
-
if (
|
|
15
|
+
if ((0, utils_1.isLocalDev)()) {
|
|
16
16
|
utils_1.logger.info('@local');
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function printHelp(): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.printHelp = void 0;
|
|
4
|
+
const utils_1 = require("@umijs/utils");
|
|
5
|
+
function printHelp() {
|
|
6
|
+
utils_1.logger.fatal('A complete log of this run can be found in:');
|
|
7
|
+
utils_1.logger.fatal(utils_1.logger.getLatestLogFilePath());
|
|
8
|
+
utils_1.logger.fatal('Consider reporting a GitHub issue on https://github.com/umijs/umi-next/issues');
|
|
9
|
+
}
|
|
10
|
+
exports.printHelp = printHelp;
|
package/dist/client/plugin.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.PluginManager = exports.ApplyPluginsType = void 0;
|
|
13
4
|
const utils_1 = require("./utils");
|
|
@@ -23,9 +14,9 @@ class PluginManager {
|
|
|
23
14
|
this.opts = opts;
|
|
24
15
|
}
|
|
25
16
|
register(plugin) {
|
|
26
|
-
(0, utils_1.assert)(plugin.apply
|
|
17
|
+
(0, utils_1.assert)(plugin.apply, `plugin register failed, apply must supplied`);
|
|
27
18
|
Object.keys(plugin.apply).forEach((key) => {
|
|
28
|
-
(0, utils_1.assert)(this.opts.validKeys.indexOf(key) > -1, `register failed, invalid key ${key} from plugin ${plugin.path}.`);
|
|
19
|
+
(0, utils_1.assert)(this.opts.validKeys.indexOf(key) > -1, `register failed, invalid key ${key} ${plugin.path ? `from plugin ${plugin.path}` : ''}.`);
|
|
29
20
|
this.hooks[key] = (this.hooks[key] || []).concat(plugin.apply[key]);
|
|
30
21
|
});
|
|
31
22
|
}
|
|
@@ -55,20 +46,23 @@ class PluginManager {
|
|
|
55
46
|
if (args) {
|
|
56
47
|
(0, utils_1.assert)(typeof args === 'object', `applyPlugins failed, args must be plain object.`);
|
|
57
48
|
}
|
|
49
|
+
if (async) {
|
|
50
|
+
(0, utils_1.assert)(type === ApplyPluginsType.modify || type === ApplyPluginsType.event, `async only works with modify and event type.`);
|
|
51
|
+
}
|
|
58
52
|
switch (type) {
|
|
59
53
|
case ApplyPluginsType.modify:
|
|
60
54
|
if (async) {
|
|
61
|
-
return hooks.reduce((memo, hook) =>
|
|
55
|
+
return hooks.reduce(async (memo, hook) => {
|
|
62
56
|
(0, utils_1.assert)(typeof hook === 'function' ||
|
|
63
57
|
typeof hook === 'object' ||
|
|
64
58
|
(0, utils_1.isPromiseLike)(hook), `applyPlugins failed, all hooks for key ${key} must be function, plain object or Promise.`);
|
|
65
59
|
if ((0, utils_1.isPromiseLike)(memo)) {
|
|
66
|
-
memo =
|
|
60
|
+
memo = await memo;
|
|
67
61
|
}
|
|
68
62
|
if (typeof hook === 'function') {
|
|
69
63
|
const ret = hook(memo, args);
|
|
70
64
|
if ((0, utils_1.isPromiseLike)(ret)) {
|
|
71
|
-
return
|
|
65
|
+
return await ret;
|
|
72
66
|
}
|
|
73
67
|
else {
|
|
74
68
|
return ret;
|
|
@@ -76,11 +70,11 @@ class PluginManager {
|
|
|
76
70
|
}
|
|
77
71
|
else {
|
|
78
72
|
if ((0, utils_1.isPromiseLike)(hook)) {
|
|
79
|
-
hook =
|
|
73
|
+
hook = await hook;
|
|
80
74
|
}
|
|
81
|
-
return
|
|
75
|
+
return { ...memo, ...hook };
|
|
82
76
|
}
|
|
83
|
-
}
|
|
77
|
+
}, (0, utils_1.isPromiseLike)(initialValue)
|
|
84
78
|
? initialValue
|
|
85
79
|
: Promise.resolve(initialValue));
|
|
86
80
|
}
|
|
@@ -92,15 +86,20 @@ class PluginManager {
|
|
|
92
86
|
}
|
|
93
87
|
else {
|
|
94
88
|
// TODO: deepmerge?
|
|
95
|
-
return
|
|
89
|
+
return { ...memo, ...hook };
|
|
96
90
|
}
|
|
97
91
|
}, initialValue);
|
|
98
92
|
}
|
|
99
93
|
case ApplyPluginsType.event:
|
|
100
|
-
return
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
94
|
+
return (async () => {
|
|
95
|
+
for (const hook of hooks) {
|
|
96
|
+
(0, utils_1.assert)(typeof hook === 'function', `applyPlugins failed, all hooks for key ${key} must be function.`);
|
|
97
|
+
const ret = hook(args);
|
|
98
|
+
if (async && (0, utils_1.isPromiseLike)(ret)) {
|
|
99
|
+
await ret;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
})();
|
|
104
103
|
case ApplyPluginsType.compose:
|
|
105
104
|
return () => {
|
|
106
105
|
return (0, utils_1.compose)({
|
package/dist/constants.d.ts
CHANGED
package/dist/constants.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FRAMEWORK_NAME = exports.DEFAULT_CONFIG_FILES = exports.DEV_COMMAND = exports.
|
|
3
|
+
exports.FRAMEWORK_NAME = exports.DEFAULT_CONFIG_FILES = exports.DEV_COMMAND = exports.MIN_NODE_VERSION = void 0;
|
|
4
4
|
exports.MIN_NODE_VERSION = 14;
|
|
5
|
-
exports.EXCLUDE_NODE_VERSION = 15;
|
|
6
5
|
exports.DEV_COMMAND = 'dev';
|
|
7
6
|
exports.DEFAULT_CONFIG_FILES = [
|
|
8
7
|
'.umirc.ts',
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RequestHandler } from '@umijs/bundler-webpack/compiled/express';
|
|
2
|
+
declare type MockDeclare = string | number | null | undefined | boolean | Record<string, any> | RequestHandler;
|
|
3
|
+
export declare function defineMock(mockData: {
|
|
4
|
+
[key: string]: MockDeclare;
|
|
5
|
+
}): {
|
|
6
|
+
[key: string]: MockDeclare;
|
|
7
|
+
};
|
|
8
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IServicePluginAPI, PluginAPI } from '@umijs/core';
|
|
2
2
|
export { run } from './cli/cli';
|
|
3
3
|
export { defineConfig } from './defineConfig';
|
|
4
|
+
export { defineMock } from './defineMock';
|
|
4
5
|
export * from './service/service';
|
|
5
6
|
export declare type IApi = PluginAPI & IServicePluginAPI;
|
package/dist/index.js
CHANGED
|
@@ -14,9 +14,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.defineConfig = exports.run = void 0;
|
|
17
|
+
exports.defineMock = exports.defineConfig = exports.run = void 0;
|
|
18
18
|
var cli_1 = require("./cli/cli");
|
|
19
19
|
Object.defineProperty(exports, "run", { enumerable: true, get: function () { return cli_1.run; } });
|
|
20
20
|
var defineConfig_1 = require("./defineConfig");
|
|
21
21
|
Object.defineProperty(exports, "defineConfig", { enumerable: true, get: function () { return defineConfig_1.defineConfig; } });
|
|
22
|
+
var defineMock_1 = require("./defineMock");
|
|
23
|
+
Object.defineProperty(exports, "defineMock", { enumerable: true, get: function () { return defineMock_1.defineMock; } });
|
|
22
24
|
__exportStar(require("./service/service"), exports);
|
package/dist/pluginUtils.d.ts
CHANGED
|
@@ -1 +1,5 @@
|
|
|
1
|
+
import express from '@umijs/bundler-utils/compiled/express';
|
|
2
|
+
import * as httpProxyMiddleware from '@umijs/bundler-webpack/compiled/http-proxy-middleware';
|
|
3
|
+
export { createServerRoutes } from '@umijs/server';
|
|
1
4
|
export * from '@umijs/utils';
|
|
5
|
+
export { httpProxyMiddleware, express };
|
package/dist/pluginUtils.js
CHANGED
|
@@ -10,8 +10,30 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
11
|
o[k2] = m[k];
|
|
12
12
|
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
13
25
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
26
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
27
|
};
|
|
28
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
+
};
|
|
16
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.express = exports.httpProxyMiddleware = exports.createServerRoutes = void 0;
|
|
33
|
+
const express_1 = __importDefault(require("@umijs/bundler-utils/compiled/express"));
|
|
34
|
+
exports.express = express_1.default;
|
|
35
|
+
const httpProxyMiddleware = __importStar(require("@umijs/bundler-webpack/compiled/http-proxy-middleware"));
|
|
36
|
+
exports.httpProxyMiddleware = httpProxyMiddleware;
|
|
37
|
+
var server_1 = require("@umijs/server");
|
|
38
|
+
Object.defineProperty(exports, "createServerRoutes", { enumerable: true, get: function () { return server_1.createServerRoutes; } });
|
|
17
39
|
__exportStar(require("@umijs/utils"), exports);
|
package/dist/service/service.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.Service = void 0;
|
|
13
4
|
const core_1 = require("@umijs/core");
|
|
@@ -19,24 +10,30 @@ class Service extends core_1.Service {
|
|
|
19
10
|
constructor(opts) {
|
|
20
11
|
process.env.UMI_DIR = (0, path_1.dirname)(require.resolve('../../package'));
|
|
21
12
|
const cwd = (0, cwd_1.getCwd)();
|
|
22
|
-
super(
|
|
13
|
+
super({
|
|
14
|
+
...opts,
|
|
15
|
+
env: process.env.NODE_ENV,
|
|
16
|
+
cwd,
|
|
17
|
+
defaultConfigFiles: constants_1.DEFAULT_CONFIG_FILES,
|
|
18
|
+
frameworkName: constants_1.FRAMEWORK_NAME,
|
|
19
|
+
presets: [require.resolve('@umijs/preset-umi'), ...((opts === null || opts === void 0 ? void 0 : opts.presets) || [])],
|
|
20
|
+
plugins: [
|
|
23
21
|
(0, fs_1.existsSync)((0, path_1.join)(cwd, 'plugin.ts')) && (0, path_1.join)(cwd, 'plugin.ts'),
|
|
24
22
|
(0, fs_1.existsSync)((0, path_1.join)(cwd, 'plugin.js')) && (0, path_1.join)(cwd, 'plugin.js'),
|
|
25
|
-
].filter(Boolean)
|
|
26
|
-
}
|
|
27
|
-
run2(opts) {
|
|
28
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
let name = opts.name;
|
|
30
|
-
if ((opts === null || opts === void 0 ? void 0 : opts.args.version) || name === 'v') {
|
|
31
|
-
name = 'version';
|
|
32
|
-
}
|
|
33
|
-
else if ((opts === null || opts === void 0 ? void 0 : opts.args.help) || !name || name === 'h') {
|
|
34
|
-
name = 'help';
|
|
35
|
-
}
|
|
36
|
-
// TODO
|
|
37
|
-
// initWebpack
|
|
38
|
-
return yield this.run(Object.assign(Object.assign({}, opts), { name }));
|
|
23
|
+
].filter(Boolean),
|
|
39
24
|
});
|
|
40
25
|
}
|
|
26
|
+
async run2(opts) {
|
|
27
|
+
let name = opts.name;
|
|
28
|
+
if ((opts === null || opts === void 0 ? void 0 : opts.args.version) || name === 'v') {
|
|
29
|
+
name = 'version';
|
|
30
|
+
}
|
|
31
|
+
else if ((opts === null || opts === void 0 ? void 0 : opts.args.help) || !name || name === 'h') {
|
|
32
|
+
name = 'help';
|
|
33
|
+
}
|
|
34
|
+
// TODO
|
|
35
|
+
// initWebpack
|
|
36
|
+
return await this.run({ ...opts, name });
|
|
37
|
+
}
|
|
41
38
|
}
|
|
42
39
|
exports.Service = Service;
|
package/dist/test.js
CHANGED
|
@@ -13,15 +13,6 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
17
|
exports.configUmiAlias = void 0;
|
|
27
18
|
const fs_1 = require("fs");
|
|
@@ -35,28 +26,26 @@ function getAliasPathWithKey(alias, key) {
|
|
|
35
26
|
return thePath;
|
|
36
27
|
}
|
|
37
28
|
let service;
|
|
38
|
-
function configUmiAlias(config) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
29
|
+
async function configUmiAlias(config) {
|
|
30
|
+
if (!service) {
|
|
31
|
+
service = new service_1.Service();
|
|
32
|
+
await service.run2({
|
|
33
|
+
name: 'setup',
|
|
34
|
+
args: { quiet: true },
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
config.moduleNameMapper || (config.moduleNameMapper = {});
|
|
38
|
+
const { alias } = service.config;
|
|
39
|
+
for (const key of Object.keys(alias)) {
|
|
40
|
+
const aliasPath = getAliasPathWithKey(alias, key);
|
|
41
|
+
if ((0, fs_1.existsSync)(aliasPath) && (0, fs_1.statSync)(aliasPath).isDirectory()) {
|
|
42
|
+
config.moduleNameMapper[`^${key}/(.*)$`] = `${aliasPath}/$1`;
|
|
43
|
+
config.moduleNameMapper[`^${key}$`] = aliasPath;
|
|
46
44
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
for (const key of Object.keys(alias)) {
|
|
50
|
-
const aliasPath = getAliasPathWithKey(alias, key);
|
|
51
|
-
if ((0, fs_1.existsSync)(aliasPath) && (0, fs_1.statSync)(aliasPath).isDirectory()) {
|
|
52
|
-
config.moduleNameMapper[`^${key}/(.*)$`] = `${aliasPath}/$1`;
|
|
53
|
-
config.moduleNameMapper[`^${key}$`] = aliasPath;
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
config.moduleNameMapper[`^${key}$`] = aliasPath;
|
|
57
|
-
}
|
|
45
|
+
else {
|
|
46
|
+
config.moduleNameMapper[`^${key}$`] = aliasPath;
|
|
58
47
|
}
|
|
59
|
-
|
|
60
|
-
|
|
48
|
+
}
|
|
49
|
+
return config;
|
|
61
50
|
}
|
|
62
51
|
exports.configUmiAlias = configUmiAlias;
|
package/eslint.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
try {
|
|
2
|
+
require.resolve('@umijs/lint/package.json');
|
|
3
|
+
} catch (err) {
|
|
4
|
+
throw new Error('@umijs/lint is not built-in, please install it manually before run umi lint.');
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
module.exports = process.env.LEGACY_ESLINT ? require('@umijs/lint/dist/config/eslint/legacy') : require('@umijs/lint/dist/config/eslint');
|
package/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// @ts-ignore
|
|
2
2
|
export * from '@@/exports';
|
|
3
|
-
export type { IApi, webpack } from '@umijs/preset-umi';
|
|
4
3
|
export type {
|
|
4
|
+
IApi,
|
|
5
|
+
webpack,
|
|
5
6
|
IRoute,
|
|
6
7
|
UmiApiRequest,
|
|
7
8
|
UmiApiResponse,
|
|
8
|
-
} from '@umijs/preset-umi
|
|
9
|
+
} from '@umijs/preset-umi';
|
|
9
10
|
export * from './dist';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "umi",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "umi",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi-next/tree/master/packages/umi#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi-next/issues",
|
|
@@ -23,21 +23,35 @@
|
|
|
23
23
|
"plugin.js",
|
|
24
24
|
"plugin-utils.d.ts",
|
|
25
25
|
"plugin-utils.js",
|
|
26
|
+
"prettier.js",
|
|
26
27
|
"test.d.ts",
|
|
27
|
-
"test.js"
|
|
28
|
+
"test.js",
|
|
29
|
+
"eslint.js",
|
|
30
|
+
"stylelint.js"
|
|
28
31
|
],
|
|
29
32
|
"scripts": {
|
|
30
33
|
"build": "pnpm tsc",
|
|
31
34
|
"build:client": "pnpm tsc --project ./tsconfig.client.json",
|
|
32
|
-
"build:deps": "
|
|
33
|
-
"dev": "pnpm build -- --watch"
|
|
35
|
+
"build:deps": "umi-scripts bundleDeps",
|
|
36
|
+
"dev": "pnpm build -- --watch",
|
|
37
|
+
"dev:client": "pnpm build:client -- --watch",
|
|
38
|
+
"test": "umi-scripts jest-turbo"
|
|
34
39
|
},
|
|
35
40
|
"dependencies": {
|
|
36
|
-
"@umijs/
|
|
37
|
-
"@umijs/
|
|
38
|
-
"@umijs/
|
|
39
|
-
"@umijs/
|
|
40
|
-
"@umijs/
|
|
41
|
+
"@umijs/bundler-utils": "4.0.1",
|
|
42
|
+
"@umijs/bundler-webpack": "4.0.1",
|
|
43
|
+
"@umijs/core": "4.0.1",
|
|
44
|
+
"@umijs/lint": "4.0.1",
|
|
45
|
+
"@umijs/preset-umi": "4.0.1",
|
|
46
|
+
"@umijs/renderer-react": "4.0.1",
|
|
47
|
+
"@umijs/server": "4.0.1",
|
|
48
|
+
"@umijs/test": "4.0.1",
|
|
49
|
+
"@umijs/utils": "4.0.1",
|
|
50
|
+
"prettier-plugin-organize-imports": "^2.3.4",
|
|
51
|
+
"prettier-plugin-packagejson": "^2.2.17"
|
|
52
|
+
},
|
|
53
|
+
"engines": {
|
|
54
|
+
"node": ">=14"
|
|
41
55
|
},
|
|
42
56
|
"publishConfig": {
|
|
43
57
|
"access": "public"
|
package/prettier.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
printWidth: 80,
|
|
3
|
+
singleQuote: true,
|
|
4
|
+
trailingComma: 'all',
|
|
5
|
+
proseWrap: 'never',
|
|
6
|
+
endOfLine: 'lf',
|
|
7
|
+
overrides: [{ files: '.prettierrc', options: { parser: 'json' } }],
|
|
8
|
+
plugins: [
|
|
9
|
+
require.resolve('prettier-plugin-packagejson'),
|
|
10
|
+
require.resolve('prettier-plugin-organize-imports'),
|
|
11
|
+
],
|
|
12
|
+
};
|