umi 4.0.0-beta.9 → 4.0.0-canary-20240513.3

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/dist/cli/fork.js CHANGED
@@ -1,40 +1,90 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const child_process_1 = require("child_process");
4
- const usedPorts = [];
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
+ // src/cli/fork.ts
20
+ var fork_exports = {};
21
+ __export(fork_exports, {
22
+ default: () => start
23
+ });
24
+ module.exports = __toCommonJS(fork_exports);
25
+ var import_child_process = require("child_process");
26
+ var import_utils = require("@umijs/utils");
27
+ var usedPorts = [];
5
28
  function start({ scriptPath }) {
6
- const execArgv = process.execArgv.slice(0);
7
- const inspectArgvIndex = execArgv.findIndex((argv) => argv.includes('--inspect-brk'));
8
- if (inspectArgvIndex > -1) {
9
- const inspectArgv = execArgv[inspectArgvIndex];
10
- execArgv.splice(inspectArgvIndex, 1, inspectArgv.replace(/--inspect-brk=(.*)/, (_match, s1) => {
11
- let port;
12
- try {
13
- port = parseInt(s1) + 1;
14
- }
15
- catch (e) {
16
- port = 9230; // node default inspect port plus 1.
17
- }
18
- if (usedPorts.includes(port)) {
19
- port += 1;
20
- }
21
- usedPorts.push(port);
22
- return `--inspect-brk=${port}`;
23
- }));
29
+ const execArgv = process.execArgv.slice(0);
30
+ const inspectArgvIndex = execArgv.findIndex(
31
+ (argv) => argv.includes("--inspect-brk")
32
+ );
33
+ if (inspectArgvIndex > -1) {
34
+ const inspectArgv = execArgv[inspectArgvIndex];
35
+ execArgv.splice(
36
+ inspectArgvIndex,
37
+ 1,
38
+ inspectArgv.replace(/--inspect-brk=(.*)/, (_match, s1) => {
39
+ let port;
40
+ try {
41
+ port = parseInt(s1) + 1;
42
+ } catch (e) {
43
+ port = 9230;
44
+ }
45
+ if (usedPorts.includes(port)) {
46
+ port += 1;
47
+ }
48
+ usedPorts.push(port);
49
+ return `--inspect-brk=${port}`;
50
+ })
51
+ );
52
+ }
53
+ const child = (0, import_child_process.fork)(scriptPath, process.argv.slice(2), { execArgv });
54
+ child.on("message", (data) => {
55
+ var _a;
56
+ const { type, payload } = data || {};
57
+ if (type === "RESTART") {
58
+ child.kill();
59
+ if (payload == null ? void 0 : payload.port) {
60
+ utilPortValid(payload.port, 20, () => {
61
+ process.env.PORT = payload.port;
62
+ start({ scriptPath });
63
+ });
64
+ } else {
65
+ start({ scriptPath });
66
+ }
24
67
  }
25
- const child = (0, child_process_1.fork)(scriptPath, process.argv.slice(2), { execArgv });
26
- child.on('message', (data) => {
27
- var _a;
28
- const { type, payload } = data || {};
29
- if (type === 'RESTART') {
30
- child.kill();
31
- if (payload === null || payload === void 0 ? void 0 : payload.port) {
32
- process.env.PORT = payload.port;
33
- }
34
- start({ scriptPath });
68
+ (_a = process.send) == null ? void 0 : _a.call(process, data);
69
+ });
70
+ return child;
71
+ }
72
+ function utilPortValid(port, totalTry, callback) {
73
+ import_utils.portfinder.getPort({ startPort: port }, (err, findPort) => {
74
+ if (err)
75
+ callback(err);
76
+ else {
77
+ if (findPort === port) {
78
+ callback();
79
+ } else {
80
+ if (totalTry > 0) {
81
+ setTimeout(() => {
82
+ utilPortValid(port, totalTry - 1, callback);
83
+ }, 100);
84
+ } else {
85
+ callback(new Error(`Port ${port} is occupied`));
35
86
  }
36
- (_a = process.send) === null || _a === void 0 ? void 0 : _a.call(process, data);
37
- });
38
- return child;
87
+ }
88
+ }
89
+ });
39
90
  }
40
- exports.default = start;
@@ -1,51 +1,36 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const utils_1 = require("@umijs/utils");
13
- const constants_1 = require("../constants");
14
- const service_1 = require("../service/service");
15
- const node_1 = require("./node");
16
- (0, node_1.setNodeTitle)(`${constants_1.FRAMEWORK_NAME}-dev`);
17
- (0, node_1.setNoDeprecation)();
18
- (() => __awaiter(void 0, void 0, void 0, function* () {
19
- try {
20
- const args = (0, utils_1.yParser)(process.argv.slice(2));
21
- const service = new service_1.Service();
22
- yield service.run2({
23
- name: constants_1.DEV_COMMAND,
24
- args,
25
- });
26
- let closed = false;
27
- // kill(2) Ctrl-C
28
- process.once('SIGINT', () => onSignal('SIGINT'));
29
- // kill(3) Ctrl-\
30
- process.once('SIGQUIT', () => onSignal('SIGQUIT'));
31
- // kill(15) default
32
- process.once('SIGTERM', () => onSignal('SIGTERM'));
33
- function onSignal(signal) {
34
- if (closed)
35
- return;
36
- closed = true;
37
- // 退出时触发插件中的 onExit 事件
38
- service.applyPlugins({
39
- key: 'onExit',
40
- args: {
41
- signal,
42
- },
43
- });
44
- process.exit(0);
1
+ // src/cli/forkedDev.ts
2
+ var import_utils = require("@umijs/utils");
3
+ var import_constants = require("../constants");
4
+ var import_service = require("../service/service");
5
+ (0, import_utils.setNodeTitle)(`${import_constants.FRAMEWORK_NAME}-dev`);
6
+ (0, import_utils.setNoDeprecation)();
7
+ (async () => {
8
+ try {
9
+ let onSignal = function(signal) {
10
+ if (closed)
11
+ return;
12
+ closed = true;
13
+ service.applyPlugins({
14
+ key: "onExit",
15
+ args: {
16
+ signal
45
17
  }
46
- }
47
- catch (e) {
48
- utils_1.logger.error(e);
49
- process.exit(1);
50
- }
51
- }))();
18
+ });
19
+ process.exit(0);
20
+ };
21
+ const args = (0, import_utils.yParser)(process.argv.slice(2));
22
+ const service = new import_service.Service();
23
+ await service.run2({
24
+ name: import_constants.DEV_COMMAND,
25
+ args
26
+ });
27
+ let closed = false;
28
+ process.once("SIGINT", () => onSignal("SIGINT"));
29
+ process.once("SIGQUIT", () => onSignal("SIGQUIT"));
30
+ process.once("SIGTERM", () => onSignal("SIGTERM"));
31
+ } catch (e) {
32
+ import_utils.logger.fatal(e);
33
+ import_utils.printHelp.exit();
34
+ process.exit(1);
35
+ }
36
+ })();
@@ -1,5 +1,5 @@
1
1
  export declare const MIN_NODE_VERSION = 14;
2
- export declare const EXCLUDE_NODE_VERSION = 15;
3
2
  export declare const DEV_COMMAND = "dev";
3
+ export declare const FRAMEWORK_NAME: string;
4
4
  export declare const DEFAULT_CONFIG_FILES: string[];
5
- export declare const FRAMEWORK_NAME = "umi";
5
+ export declare const RUNTIME_TYPE_FILE_NAME = "runtimeConfig.d.ts";
package/dist/constants.js CHANGED
@@ -1,13 +1,46 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FRAMEWORK_NAME = exports.DEFAULT_CONFIG_FILES = exports.DEV_COMMAND = exports.EXCLUDE_NODE_VERSION = exports.MIN_NODE_VERSION = void 0;
4
- exports.MIN_NODE_VERSION = 14;
5
- exports.EXCLUDE_NODE_VERSION = 15;
6
- exports.DEV_COMMAND = 'dev';
7
- exports.DEFAULT_CONFIG_FILES = [
8
- '.umirc.ts',
9
- '.umirc.js',
10
- 'config/config.ts',
11
- 'config/config.js',
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
+ // src/constants.ts
20
+ var constants_exports = {};
21
+ __export(constants_exports, {
22
+ DEFAULT_CONFIG_FILES: () => DEFAULT_CONFIG_FILES,
23
+ DEV_COMMAND: () => DEV_COMMAND,
24
+ FRAMEWORK_NAME: () => FRAMEWORK_NAME,
25
+ MIN_NODE_VERSION: () => MIN_NODE_VERSION,
26
+ RUNTIME_TYPE_FILE_NAME: () => RUNTIME_TYPE_FILE_NAME
27
+ });
28
+ module.exports = __toCommonJS(constants_exports);
29
+ var MIN_NODE_VERSION = 14;
30
+ var DEV_COMMAND = "dev";
31
+ var FRAMEWORK_NAME = process.env.FRAMEWORK_NAME || "umi";
32
+ var DEFAULT_CONFIG_FILES = [
33
+ `.${FRAMEWORK_NAME}rc.ts`,
34
+ `.${FRAMEWORK_NAME}rc.js`,
35
+ "config/config.ts",
36
+ "config/config.js"
12
37
  ];
13
- exports.FRAMEWORK_NAME = 'umi';
38
+ var RUNTIME_TYPE_FILE_NAME = "runtimeConfig.d.ts";
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ DEFAULT_CONFIG_FILES,
42
+ DEV_COMMAND,
43
+ FRAMEWORK_NAME,
44
+ MIN_NODE_VERSION,
45
+ RUNTIME_TYPE_FILE_NAME
46
+ });
@@ -0,0 +1,10 @@
1
+ import { IConfigFromPlugins } from '@@/core/pluginConfig';
2
+ import type { IConfig } from '@umijs/preset-umi';
3
+ declare type ConfigType = IConfigFromPlugins & IConfig;
4
+ /**
5
+ * 通过方法的方式配置umi,能带来更好的 typescript 体验
6
+ * @param {ConfigType} config
7
+ * @returns ConfigType
8
+ */
9
+ export declare function defineConfig(config: ConfigType): ConfigType;
10
+ export {};
@@ -0,0 +1,31 @@
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
+ // src/defineConfig.ts
20
+ var defineConfig_exports = {};
21
+ __export(defineConfig_exports, {
22
+ defineConfig: () => defineConfig
23
+ });
24
+ module.exports = __toCommonJS(defineConfig_exports);
25
+ function defineConfig(config) {
26
+ return config;
27
+ }
28
+ // Annotate the CommonJS export names for ESM import in node:
29
+ 0 && (module.exports = {
30
+ defineConfig
31
+ });
@@ -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 {};
@@ -0,0 +1,31 @@
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
+ // src/defineMock.ts
20
+ var defineMock_exports = {};
21
+ __export(defineMock_exports, {
22
+ defineMock: () => defineMock
23
+ });
24
+ module.exports = __toCommonJS(defineMock_exports);
25
+ function defineMock(mockData) {
26
+ return mockData;
27
+ }
28
+ // Annotate the CommonJS export names for ESM import in node:
29
+ 0 && (module.exports = {
30
+ defineMock
31
+ });
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { IServicePluginAPI, PluginAPI } from '@umijs/core';
2
- import * as utils from '@umijs/utils';
3
- export declare type IApi = PluginAPI & IServicePluginAPI;
2
+ export { run } from './cli/cli';
3
+ export { RUNTIME_TYPE_FILE_NAME } from './constants';
4
+ export { defineConfig } from './defineConfig';
5
+ export { defineMock } from './defineMock';
4
6
  export * from './service/service';
5
- export { utils };
7
+ export declare type IApi = PluginAPI & IServicePluginAPI;
package/dist/index.js CHANGED
@@ -1,28 +1,41 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
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 });
20
8
  };
21
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
22
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
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;
23
16
  };
24
- Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.utils = void 0;
26
- const utils = __importStar(require("@umijs/utils"));
27
- exports.utils = utils;
28
- __exportStar(require("./service/service"), 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
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ RUNTIME_TYPE_FILE_NAME: () => import_constants.RUNTIME_TYPE_FILE_NAME,
24
+ defineConfig: () => import_defineConfig.defineConfig,
25
+ defineMock: () => import_defineMock.defineMock,
26
+ run: () => import_cli.run
27
+ });
28
+ module.exports = __toCommonJS(src_exports);
29
+ var import_cli = require("./cli/cli");
30
+ var import_constants = require("./constants");
31
+ var import_defineConfig = require("./defineConfig");
32
+ var import_defineMock = require("./defineMock");
33
+ __reExport(src_exports, require("./service/service"), module.exports);
34
+ // Annotate the CommonJS export names for ESM import in node:
35
+ 0 && (module.exports = {
36
+ RUNTIME_TYPE_FILE_NAME,
37
+ defineConfig,
38
+ defineMock,
39
+ run,
40
+ ...require("./service/service")
41
+ });
@@ -0,0 +1,5 @@
1
+ import express from '@umijs/bundler-utils/compiled/express';
2
+ import * as httpProxyMiddleware from '@umijs/bundler-utils/compiled/http-proxy-middleware';
3
+ export { createServerRoutes } from '@umijs/server';
4
+ export * from '@umijs/utils';
5
+ export { httpProxyMiddleware, express };
@@ -0,0 +1,48 @@
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 });
10
+ };
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;
18
+ };
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(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/pluginUtils.ts
31
+ var pluginUtils_exports = {};
32
+ __export(pluginUtils_exports, {
33
+ createServerRoutes: () => import_server.createServerRoutes,
34
+ express: () => import_express.default,
35
+ httpProxyMiddleware: () => httpProxyMiddleware
36
+ });
37
+ module.exports = __toCommonJS(pluginUtils_exports);
38
+ var import_express = __toESM(require("@umijs/bundler-utils/compiled/express"));
39
+ var httpProxyMiddleware = __toESM(require("@umijs/bundler-utils/compiled/http-proxy-middleware"));
40
+ var import_server = require("@umijs/server");
41
+ __reExport(pluginUtils_exports, require("@umijs/utils"), module.exports);
42
+ // Annotate the CommonJS export names for ESM import in node:
43
+ 0 && (module.exports = {
44
+ createServerRoutes,
45
+ express,
46
+ httpProxyMiddleware,
47
+ ...require("@umijs/utils")
48
+ });
@@ -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
+ // src/service/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
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ // src/service/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")]
6
+ ]);
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);
14
+ };