umi 4.0.0-canary.20220718.2 → 4.0.0-canary.20220720.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.
Files changed (51) hide show
  1. package/client/client/plugin.js +263 -190
  2. package/client/client/utils.js +18 -11
  3. package/dist/cli/cli.d.ts +0 -1
  4. package/dist/cli/cli.js +66 -45
  5. package/dist/cli/dev.d.ts +0 -1
  6. package/dist/cli/dev.js +42 -23
  7. package/dist/cli/fork.d.ts +0 -1
  8. package/dist/cli/fork.js +59 -37
  9. package/dist/cli/forkedDev.d.ts +0 -1
  10. package/dist/cli/forkedDev.js +34 -40
  11. package/dist/cli/node.d.ts +0 -1
  12. package/dist/cli/node.js +48 -24
  13. package/dist/constants.d.ts +0 -1
  14. package/dist/constants.js +42 -11
  15. package/dist/defineConfig.d.ts +0 -1
  16. package/dist/defineConfig.js +29 -5
  17. package/dist/defineMock.d.ts +0 -1
  18. package/dist/defineMock.js +29 -5
  19. package/dist/index.d.ts +0 -1
  20. package/dist/index.js +36 -23
  21. package/dist/pluginUtils.d.ts +0 -1
  22. package/dist/pluginUtils.js +38 -37
  23. package/dist/service/cwd.d.ts +0 -1
  24. package/dist/service/cwd.js +35 -11
  25. package/dist/service/requireHook.d.ts +0 -1
  26. package/dist/service/requireHook.js +12 -13
  27. package/dist/service/service.d.ts +0 -1
  28. package/dist/service/service.js +78 -42
  29. package/dist/test.d.ts +0 -1
  30. package/dist/test.js +69 -59
  31. package/package.json +13 -14
  32. package/dist/cli/cli.d.ts.map +0 -1
  33. package/dist/cli/dev.d.ts.map +0 -1
  34. package/dist/cli/fork.d.ts.map +0 -1
  35. package/dist/cli/forkedDev.d.ts.map +0 -1
  36. package/dist/cli/node.d.ts.map +0 -1
  37. package/dist/client/plugin.d.ts +0 -35
  38. package/dist/client/plugin.d.ts.map +0 -1
  39. package/dist/client/plugin.js +0 -124
  40. package/dist/client/utils.d.ts +0 -7
  41. package/dist/client/utils.d.ts.map +0 -1
  42. package/dist/client/utils.js +0 -20
  43. package/dist/constants.d.ts.map +0 -1
  44. package/dist/defineConfig.d.ts.map +0 -1
  45. package/dist/defineMock.d.ts.map +0 -1
  46. package/dist/index.d.ts.map +0 -1
  47. package/dist/pluginUtils.d.ts.map +0 -1
  48. package/dist/service/cwd.d.ts.map +0 -1
  49. package/dist/service/requireHook.d.ts.map +0 -1
  50. package/dist/service/service.d.ts.map +0 -1
  51. package/dist/test.d.ts.map +0 -1
@@ -1,39 +1,40 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
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
- };
25
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
27
10
  };
28
- var __importDefault = (this && this.__importDefault) || function (mod) {
29
- return (mod && mod.__esModule) ? mod : { "default": mod };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
30
18
  };
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; } });
39
- __exportStar(require("@umijs/utils"), exports);
19
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
21
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
+
23
+ // pluginUtils.ts
24
+ var pluginUtils_exports = {};
25
+ __export(pluginUtils_exports, {
26
+ createServerRoutes: () => import_server.createServerRoutes,
27
+ express: () => import_express.default,
28
+ httpProxyMiddleware: () => httpProxyMiddleware
29
+ });
30
+ module.exports = __toCommonJS(pluginUtils_exports);
31
+ var import_express = __toESM(require("@umijs/bundler-utils/compiled/express"));
32
+ var httpProxyMiddleware = __toESM(require("@umijs/bundler-webpack/compiled/http-proxy-middleware"));
33
+ var import_server = require("@umijs/server");
34
+ __reExport(pluginUtils_exports, require("@umijs/utils"), module.exports);
35
+ // Annotate the CommonJS export names for ESM import in node:
36
+ 0 && (module.exports = {
37
+ createServerRoutes,
38
+ express,
39
+ httpProxyMiddleware
40
+ });
@@ -1,2 +1 @@
1
1
  export declare function getCwd(): string;
2
- //# sourceMappingURL=cwd.d.ts.map
@@ -1,13 +1,37 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCwd = void 0;
4
- const path_1 = require("path");
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // cwd.ts
20
+ var cwd_exports = {};
21
+ __export(cwd_exports, {
22
+ getCwd: () => getCwd
23
+ });
24
+ module.exports = __toCommonJS(cwd_exports);
25
+ var import_path = require("path");
5
26
  function getCwd() {
6
- const cwd = process.cwd();
7
- const appRoot = process.env.APP_ROOT;
8
- if (appRoot) {
9
- return (0, path_1.isAbsolute)(appRoot) ? appRoot : (0, path_1.join)(cwd, appRoot);
10
- }
11
- return cwd;
27
+ const cwd = process.cwd();
28
+ const appRoot = process.env.APP_ROOT;
29
+ if (appRoot) {
30
+ return (0, import_path.isAbsolute)(appRoot) ? appRoot : (0, import_path.join)(cwd, appRoot);
31
+ }
32
+ return cwd;
12
33
  }
13
- exports.getCwd = getCwd;
34
+ // Annotate the CommonJS export names for ESM import in node:
35
+ 0 && (module.exports = {
36
+ getCwd
37
+ });
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=requireHook.d.ts.map
@@ -1,15 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const path_1 = require("path");
4
- const hookPropertyMap = new Map([
5
- ['umi', (0, path_1.join)(__dirname, '../index.js')],
6
- ['umi/plugin-utils', (0, path_1.join)(__dirname, '../../plugin-utils.js')],
1
+ // requireHook.ts
2
+ var import_path = require("path");
3
+ var hookPropertyMap = /* @__PURE__ */ new Map([
4
+ ["umi", (0, import_path.join)(__dirname, "../index.js")],
5
+ ["umi/plugin-utils", (0, import_path.join)(__dirname, "../../plugin-utils.js")]
7
6
  ]);
8
- const mod = require('module');
9
- const resolveFilename = mod._resolveFilename;
10
- mod._resolveFilename = function (request, parent, isMain, options) {
11
- const hookResolved = hookPropertyMap.get(request);
12
- if (hookResolved)
13
- request = hookResolved;
14
- return resolveFilename.call(mod, request, parent, isMain, options);
7
+ var mod = require("module");
8
+ var resolveFilename = mod._resolveFilename;
9
+ mod._resolveFilename = function(request, parent, isMain, options) {
10
+ const hookResolved = hookPropertyMap.get(request);
11
+ if (hookResolved)
12
+ request = hookResolved;
13
+ return resolveFilename.call(mod, request, parent, isMain, options);
15
14
  };
@@ -6,4 +6,3 @@ export declare class Service extends CoreService {
6
6
  args?: any;
7
7
  }): Promise<void>;
8
8
  }
9
- //# sourceMappingURL=service.d.ts.map
@@ -1,44 +1,80 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Service = void 0;
4
- const core_1 = require("@umijs/core");
5
- const fs_1 = require("fs");
6
- const path_1 = require("path");
7
- const constants_1 = require("../constants");
8
- const cwd_1 = require("./cwd");
9
- class Service extends core_1.Service {
10
- constructor(opts) {
11
- process.env.UMI_DIR = (0, path_1.dirname)(require.resolve('../../package'));
12
- const cwd = (0, cwd_1.getCwd)();
13
- // Why?
14
- // plugin import from umi but don't explicitly depend on it
15
- // and we may also have old umi installed
16
- // ref: https://github.com/umijs/umi/issues/8342#issuecomment-1182654076
17
- require('./requireHook');
18
- super({
19
- ...opts,
20
- env: process.env.NODE_ENV,
21
- cwd,
22
- defaultConfigFiles: constants_1.DEFAULT_CONFIG_FILES,
23
- frameworkName: constants_1.FRAMEWORK_NAME,
24
- presets: [require.resolve('@umijs/preset-umi'), ...((opts === null || opts === void 0 ? void 0 : opts.presets) || [])],
25
- plugins: [
26
- (0, fs_1.existsSync)((0, path_1.join)(cwd, 'plugin.ts')) && (0, path_1.join)(cwd, 'plugin.ts'),
27
- (0, fs_1.existsSync)((0, path_1.join)(cwd, 'plugin.js')) && (0, path_1.join)(cwd, 'plugin.js'),
28
- ].filter(Boolean),
29
- });
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ if (__getOwnPropSymbols)
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
30
20
  }
31
- async run2(opts) {
32
- let name = opts.name;
33
- if ((opts === null || opts === void 0 ? void 0 : opts.args.version) || name === 'v') {
34
- name = 'version';
35
- }
36
- else if ((opts === null || opts === void 0 ? void 0 : opts.args.help) || !name || name === 'h') {
37
- name = 'help';
38
- }
39
- // TODO
40
- // initWebpack
41
- return await this.run({ ...opts, name });
21
+ return a;
22
+ };
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
+ var __export = (target, all) => {
25
+ for (var name in all)
26
+ __defProp(target, name, { get: all[name], enumerable: true });
27
+ };
28
+ var __copyProps = (to, from, except, desc) => {
29
+ if (from && typeof from === "object" || typeof from === "function") {
30
+ for (let key of __getOwnPropNames(from))
31
+ if (!__hasOwnProp.call(to, key) && key !== except)
32
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
33
+ }
34
+ return to;
35
+ };
36
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
37
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
38
+
39
+ // service.ts
40
+ var service_exports = {};
41
+ __export(service_exports, {
42
+ Service: () => Service
43
+ });
44
+ module.exports = __toCommonJS(service_exports);
45
+ var import_core = require("@umijs/core");
46
+ var import_fs = require("fs");
47
+ var import_path = require("path");
48
+ var import_constants = require("../constants");
49
+ var import_cwd = require("./cwd");
50
+ var Service = class extends import_core.Service {
51
+ constructor(opts) {
52
+ process.env.UMI_DIR = (0, import_path.dirname)(require.resolve("../../package"));
53
+ const cwd = (0, import_cwd.getCwd)();
54
+ require("./requireHook");
55
+ super(__spreadProps(__spreadValues({}, opts), {
56
+ env: process.env.NODE_ENV,
57
+ cwd,
58
+ defaultConfigFiles: import_constants.DEFAULT_CONFIG_FILES,
59
+ frameworkName: import_constants.FRAMEWORK_NAME,
60
+ presets: [require.resolve("@umijs/preset-umi"), ...(opts == null ? void 0 : opts.presets) || []],
61
+ plugins: [
62
+ (0, import_fs.existsSync)((0, import_path.join)(cwd, "plugin.ts")) && (0, import_path.join)(cwd, "plugin.ts"),
63
+ (0, import_fs.existsSync)((0, import_path.join)(cwd, "plugin.js")) && (0, import_path.join)(cwd, "plugin.js")
64
+ ].filter(Boolean)
65
+ }));
66
+ }
67
+ async run2(opts) {
68
+ let name = opts.name;
69
+ if ((opts == null ? void 0 : opts.args.version) || name === "v") {
70
+ name = "version";
71
+ } else if ((opts == null ? void 0 : opts.args.help) || !name || name === "h") {
72
+ name = "help";
42
73
  }
43
- }
44
- exports.Service = Service;
74
+ return await this.run(__spreadProps(__spreadValues({}, opts), { name }));
75
+ }
76
+ };
77
+ // Annotate the CommonJS export names for ESM import in node:
78
+ 0 && (module.exports = {
79
+ Service
80
+ });
package/dist/test.d.ts CHANGED
@@ -117,4 +117,3 @@ export declare function configUmiAlias(config: Config.InitialOptions): Promise<P
117
117
  watchman: boolean;
118
118
  watchPlugins: (string | [string, Record<string, unknown>])[];
119
119
  }>>;
120
- //# sourceMappingURL=test.d.ts.map
package/dist/test.js CHANGED
@@ -1,67 +1,77 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
15
16
  };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.configUmiAlias = exports.getUmiAlias = exports.getAliasPathWithKey = void 0;
18
- const fs_1 = require("fs");
19
- const service_1 = require("./service/service");
20
- __exportStar(require("@umijs/test"), exports);
17
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // test.ts
21
+ var test_exports = {};
22
+ __export(test_exports, {
23
+ configUmiAlias: () => configUmiAlias,
24
+ getAliasPathWithKey: () => getAliasPathWithKey,
25
+ getUmiAlias: () => getUmiAlias
26
+ });
27
+ module.exports = __toCommonJS(test_exports);
28
+ var import_fs = require("fs");
29
+ var import_service = require("./service/service");
30
+ __reExport(test_exports, require("@umijs/test"), module.exports);
21
31
  function getAliasPathWithKey(alias, key) {
22
- if (alias[key]) {
23
- return getAliasPathWithKey(alias, alias[key]);
24
- }
25
- const aliasKeys = Object.keys(alias);
26
- const keyStartedWith = aliasKeys.find((k) => !k.endsWith('$') && key.startsWith(`${k}/`));
27
- if (keyStartedWith) {
28
- const realPath = alias[keyStartedWith];
29
- const newKey = realPath + key.slice(keyStartedWith.length);
30
- return getAliasPathWithKey(alias, newKey);
31
- }
32
- else {
33
- return key;
34
- }
32
+ if (alias[key]) {
33
+ return getAliasPathWithKey(alias, alias[key]);
34
+ }
35
+ const aliasKeys = Object.keys(alias);
36
+ const keyStartedWith = aliasKeys.find((k) => !k.endsWith("$") && key.startsWith(`${k}/`));
37
+ if (keyStartedWith) {
38
+ const realPath = alias[keyStartedWith];
39
+ const newKey = realPath + key.slice(keyStartedWith.length);
40
+ return getAliasPathWithKey(alias, newKey);
41
+ } else {
42
+ return key;
43
+ }
35
44
  }
36
- exports.getAliasPathWithKey = getAliasPathWithKey;
37
- let service;
45
+ var service;
38
46
  async function getUmiAlias() {
39
- if (!service) {
40
- service = new service_1.Service();
41
- await service.run2({
42
- name: 'setup',
43
- args: { quiet: true },
44
- });
45
- }
46
- return service.config.alias;
47
+ if (!service) {
48
+ service = new import_service.Service();
49
+ await service.run2({
50
+ name: "setup",
51
+ args: { quiet: true }
52
+ });
53
+ }
54
+ return service.config.alias;
47
55
  }
48
- exports.getUmiAlias = getUmiAlias;
49
56
  async function configUmiAlias(config) {
50
- config.moduleNameMapper || (config.moduleNameMapper = {});
51
- const alias = await getUmiAlias();
52
- for (const key of Object.keys(alias)) {
53
- const aliasPath = getAliasPathWithKey(alias, key);
54
- if (key.endsWith('$')) {
55
- config.moduleNameMapper[`^${key}`] = aliasPath;
56
- }
57
- else if ((0, fs_1.existsSync)(aliasPath) && (0, fs_1.statSync)(aliasPath).isDirectory()) {
58
- config.moduleNameMapper[`^${key}/(.*)$`] = `${aliasPath}/$1`;
59
- config.moduleNameMapper[`^${key}$`] = aliasPath;
60
- }
61
- else {
62
- config.moduleNameMapper[`^${key}$`] = aliasPath;
63
- }
57
+ config.moduleNameMapper || (config.moduleNameMapper = {});
58
+ const alias = await getUmiAlias();
59
+ for (const key of Object.keys(alias)) {
60
+ const aliasPath = getAliasPathWithKey(alias, key);
61
+ if (key.endsWith("$")) {
62
+ config.moduleNameMapper[`^${key}`] = aliasPath;
63
+ } else if ((0, import_fs.existsSync)(aliasPath) && (0, import_fs.statSync)(aliasPath).isDirectory()) {
64
+ config.moduleNameMapper[`^${key}/(.*)$`] = `${aliasPath}/$1`;
65
+ config.moduleNameMapper[`^${key}$`] = aliasPath;
66
+ } else {
67
+ config.moduleNameMapper[`^${key}$`] = aliasPath;
64
68
  }
65
- return config;
69
+ }
70
+ return config;
66
71
  }
67
- exports.configUmiAlias = configUmiAlias;
72
+ // Annotate the CommonJS export names for ESM import in node:
73
+ 0 && (module.exports = {
74
+ configUmiAlias,
75
+ getAliasPathWithKey,
76
+ getUmiAlias
77
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "umi",
3
- "version": "4.0.0-canary.20220718.2",
3
+ "version": "4.0.0-canary.20220720.1",
4
4
  "description": "umi",
5
5
  "homepage": "https://github.com/umijs/umi/tree/master/packages/umi#readme",
6
6
  "bugs": "https://github.com/umijs/umi/issues",
@@ -30,23 +30,22 @@
30
30
  "stylelint.js"
31
31
  ],
32
32
  "scripts": {
33
- "build": "pnpm tsc",
34
- "build:client": "pnpm tsc --project ./tsconfig.client.json",
33
+ "build": "pnpm father build",
35
34
  "build:deps": "umi-scripts bundleDeps",
36
- "dev": "pnpm build --watch",
37
- "dev:client": "pnpm build:client -- --watch",
35
+ "dev": "pnpm father dev",
38
36
  "test": "umi-scripts jest-turbo"
39
37
  },
40
38
  "dependencies": {
41
- "@umijs/bundler-utils": "4.0.0-canary.20220718.2",
42
- "@umijs/bundler-webpack": "4.0.0-canary.20220718.2",
43
- "@umijs/core": "4.0.0-canary.20220718.2",
44
- "@umijs/lint": "4.0.0-canary.20220718.2",
45
- "@umijs/preset-umi": "4.0.0-canary.20220718.2",
46
- "@umijs/renderer-react": "4.0.0-canary.20220718.2",
47
- "@umijs/server": "4.0.0-canary.20220718.2",
48
- "@umijs/test": "4.0.0-canary.20220718.2",
49
- "@umijs/utils": "4.0.0-canary.20220718.2",
39
+ "@babel/runtime": "7.17.9",
40
+ "@umijs/bundler-utils": "4.0.0-canary.20220720.1",
41
+ "@umijs/bundler-webpack": "4.0.0-canary.20220720.1",
42
+ "@umijs/core": "4.0.0-canary.20220720.1",
43
+ "@umijs/lint": "4.0.0-canary.20220720.1",
44
+ "@umijs/preset-umi": "4.0.0-canary.20220720.1",
45
+ "@umijs/renderer-react": "4.0.0-canary.20220720.1",
46
+ "@umijs/server": "4.0.0-canary.20220720.1",
47
+ "@umijs/test": "4.0.0-canary.20220720.1",
48
+ "@umijs/utils": "4.0.0-canary.20220720.1",
50
49
  "prettier-plugin-organize-imports": "^2.3.4",
51
50
  "prettier-plugin-packagejson": "^2.2.17"
52
51
  },
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli/cli.ts"],"names":[],"mappings":"AAWA,UAAU,KAAK;IACb,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,wBAAsB,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,iBAoCrC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/cli/dev.ts"],"names":[],"mappings":"AAEA,wBAAgB,GAAG,SAiBlB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"fork.d.ts","sourceRoot":"","sources":["../../src/cli/fork.ts"],"names":[],"mappings":";AAIA,UAAU,KAAK;IACb,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAE,UAAU,EAAE,EAAE,KAAK,wCA0ClD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"forkedDev.d.ts","sourceRoot":"","sources":["../../src/cli/forkedDev.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/cli/node.ts"],"names":[],"mappings":"AAGA,wBAAgB,YAAY,SAQ3B;AAED,wBAAgB,UAAU,SAIzB;AAED,wBAAgB,YAAY,CAAC,IAAI,CAAC,EAAE,MAAM,QAIzC;AAED,wBAAgB,gBAAgB,SAK/B"}
@@ -1,35 +0,0 @@
1
- export declare enum ApplyPluginsType {
2
- compose = "compose",
3
- modify = "modify",
4
- event = "event"
5
- }
6
- interface IPlugin {
7
- path?: string;
8
- apply: Record<string, any>;
9
- }
10
- export declare class PluginManager {
11
- opts: {
12
- validKeys: string[];
13
- };
14
- hooks: {
15
- [key: string]: any;
16
- };
17
- constructor(opts: {
18
- validKeys: string[];
19
- });
20
- register(plugin: IPlugin): void;
21
- getHooks(keyWithDot: string): any;
22
- applyPlugins({ key, type, initialValue, args, async, }: {
23
- key: string;
24
- type: ApplyPluginsType;
25
- initialValue?: any;
26
- args?: object;
27
- async?: boolean;
28
- }): any;
29
- static create(opts: {
30
- validKeys: string[];
31
- plugins: IPlugin[];
32
- }): PluginManager;
33
- }
34
- export {};
35
- //# sourceMappingURL=plugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/client/plugin.ts"],"names":[],"mappings":"AAEA,oBAAY,gBAAgB;IAC1B,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,KAAK,UAAU;CAChB;AAED,UAAU,OAAO;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC5B;AAED,qBAAa,aAAa;IACxB,IAAI,EAAE;QAAE,SAAS,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAC9B,KAAK,EAAE;QACL,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAM;gBACK,IAAI,EAAE;QAAE,SAAS,EAAE,MAAM,EAAE,CAAA;KAAE;IAIzC,QAAQ,CAAC,MAAM,EAAE,OAAO;IAaxB,QAAQ,CAAC,UAAU,EAAE,MAAM;IAqB3B,YAAY,CAAC,EACX,GAAG,EACH,IAAI,EACJ,YAAY,EACZ,IAAI,EACJ,KAAK,GACN,EAAE;QACD,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,gBAAgB,CAAC;QACvB,YAAY,CAAC,EAAE,GAAG,CAAC;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB;IAuFD,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;QAAE,SAAS,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,EAAE,OAAO,EAAE,CAAA;KAAE;CAShE"}