@modern-js/utils 2.35.1 → 2.36.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/cli/alias.js +45 -46
- package/dist/cjs/cli/applyOptionsChain.js +30 -13
- package/dist/cjs/cli/babel.js +36 -26
- package/dist/cjs/cli/commands.js +29 -21
- package/dist/cjs/cli/common.js +29 -20
- package/dist/cjs/cli/config.js +24 -7
- package/dist/cjs/cli/constants/chainId.js +24 -7
- package/dist/cjs/cli/constants/index.js +86 -104
- package/dist/cjs/cli/ensure.js +37 -18
- package/dist/cjs/cli/fs.js +29 -19
- package/dist/cjs/cli/get/config.js +26 -9
- package/dist/cjs/cli/get/data.js +67 -54
- package/dist/cjs/cli/get/index.js +46 -25
- package/dist/cjs/cli/index.js +58 -23
- package/dist/cjs/cli/is/config.js +37 -31
- package/dist/cjs/cli/is/env.js +32 -29
- package/dist/cjs/cli/is/index.js +26 -8
- package/dist/cjs/cli/is/project.js +67 -53
- package/dist/cjs/cli/is/type.js +39 -36
- package/dist/cjs/cli/logger.js +25 -130
- package/dist/cjs/cli/monorepo.js +58 -58
- package/dist/cjs/cli/package.js +34 -26
- package/dist/cjs/cli/path.js +64 -54
- package/dist/cjs/cli/port.js +39 -13
- package/dist/cjs/cli/prettyInstructions.js +48 -29
- package/dist/cjs/cli/require.js +35 -29
- package/dist/cjs/cli/runtimeExports.js +42 -16
- package/dist/cjs/cli/watch.js +41 -22
- package/dist/cjs/compiled.js +127 -138
- package/dist/cjs/import.js +25 -15
- package/dist/cjs/index.js +24 -6
- package/dist/cjs/universal/constants.js +29 -21
- package/dist/cjs/universal/formatWebpack.js +25 -15
- package/dist/cjs/universal/pluginDagSort.js +25 -8
- package/dist/esm/cli/alias.js +10 -22
- package/dist/esm/cli/applyOptionsChain.js +4 -1
- package/dist/esm/cli/babel.js +6 -2
- package/dist/esm/cli/commands.js +10 -4
- package/dist/esm/cli/common.js +8 -3
- package/dist/esm/cli/config.js +4 -1
- package/dist/esm/cli/constants/chainId.js +4 -1
- package/dist/esm/cli/constants/index.js +64 -31
- package/dist/esm/cli/ensure.js +6 -2
- package/dist/esm/cli/fs.js +6 -2
- package/dist/esm/cli/get/config.js +4 -1
- package/dist/esm/cli/get/data.js +18 -8
- package/dist/esm/cli/get/index.js +6 -2
- package/dist/esm/cli/is/config.js +14 -6
- package/dist/esm/cli/is/env.js +12 -8
- package/dist/esm/cli/is/index.js +0 -1
- package/dist/esm/cli/is/project.js +17 -8
- package/dist/esm/cli/is/type.js +20 -9
- package/dist/esm/cli/logger.js +4 -128
- package/dist/esm/cli/monorepo.js +14 -16
- package/dist/esm/cli/package.js +10 -4
- package/dist/esm/cli/path.js +24 -11
- package/dist/esm/cli/port.js +5 -2
- package/dist/esm/cli/prettyInstructions.js +6 -2
- package/dist/esm/cli/require.js +14 -6
- package/dist/esm/cli/runtimeExports.js +6 -3
- package/dist/esm/cli/watch.js +10 -6
- package/dist/esm/compiled.js +65 -31
- package/dist/esm/import.js +6 -3
- package/dist/esm/universal/constants.js +10 -4
- package/dist/esm/universal/formatWebpack.js +5 -2
- package/dist/esm/universal/pluginDagSort.js +5 -2
- package/dist/esm-node/cli/alias.js +8 -19
- package/dist/esm-node/cli/applyOptionsChain.js +4 -1
- package/dist/esm-node/cli/babel.js +6 -2
- package/dist/esm-node/cli/commands.js +10 -4
- package/dist/esm-node/cli/common.js +8 -3
- package/dist/esm-node/cli/config.js +4 -1
- package/dist/esm-node/cli/constants/chainId.js +4 -1
- package/dist/esm-node/cli/constants/index.js +64 -31
- package/dist/esm-node/cli/ensure.js +6 -2
- package/dist/esm-node/cli/fs.js +6 -2
- package/dist/esm-node/cli/get/config.js +4 -1
- package/dist/esm-node/cli/get/data.js +18 -8
- package/dist/esm-node/cli/get/index.js +6 -2
- package/dist/esm-node/cli/is/config.js +14 -6
- package/dist/esm-node/cli/is/env.js +12 -6
- package/dist/esm-node/cli/is/index.js +0 -1
- package/dist/esm-node/cli/is/project.js +16 -7
- package/dist/esm-node/cli/is/type.js +20 -9
- package/dist/esm-node/cli/logger.js +4 -113
- package/dist/esm-node/cli/monorepo.js +14 -18
- package/dist/esm-node/cli/package.js +10 -4
- package/dist/esm-node/cli/path.js +24 -11
- package/dist/esm-node/cli/port.js +4 -1
- package/dist/esm-node/cli/prettyInstructions.js +6 -2
- package/dist/esm-node/cli/require.js +14 -6
- package/dist/esm-node/cli/runtimeExports.js +4 -1
- package/dist/esm-node/cli/watch.js +6 -2
- package/dist/esm-node/compiled.js +65 -31
- package/dist/esm-node/import.js +5 -2
- package/dist/esm-node/universal/constants.js +10 -4
- package/dist/esm-node/universal/formatWebpack.js +5 -2
- package/dist/esm-node/universal/pluginDagSort.js +5 -2
- package/dist/types/cli/alias.d.ts +0 -5
- package/dist/types/cli/is/env.d.ts +1 -2
- package/dist/types/cli/is/index.d.ts +0 -1
- package/dist/types/cli/logger.d.ts +1 -69
- package/dist/types/cli/monorepo.d.ts +0 -1
- package/package.json +6 -13
- package/dist/cjs/cli/is/platform.js +0 -21
- package/dist/compiled/gradient-string/index.d.ts +0 -1
- package/dist/compiled/gradient-string/index.js +0 -1
- package/dist/compiled/gradient-string/license +0 -21
- package/dist/compiled/gradient-string/package.json +0 -1
- package/dist/compiled/webpack-dev-middleware/index.js +0 -7
- package/dist/compiled/webpack-dev-middleware/license +0 -20
- package/dist/compiled/webpack-dev-middleware/package.json +0 -1
- package/dist/compiled/webpack-dev-middleware/types/index.d.ts +0 -262
- package/dist/esm/cli/is/platform.js +0 -6
- package/dist/esm-node/cli/is/platform.js +0 -2
- package/dist/types/cli/is/platform.d.ts +0 -2
@@ -1,111 +1,58 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.defineProperty
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
6
7
|
for (var name in all)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
return ROUTE_SPEC_FILE;
|
15
|
-
},
|
16
|
-
NESTED_ROUTE_SPEC_FILE: function() {
|
17
|
-
return NESTED_ROUTE_SPEC_FILE;
|
18
|
-
},
|
19
|
-
MAIN_ENTRY_NAME: function() {
|
20
|
-
return MAIN_ENTRY_NAME;
|
21
|
-
},
|
22
|
-
SERVER_BUNDLE_DIRECTORY: function() {
|
23
|
-
return SERVER_BUNDLE_DIRECTORY;
|
24
|
-
},
|
25
|
-
SERVER_WORKER_BUNDLE_DIRECTORY: function() {
|
26
|
-
return SERVER_WORKER_BUNDLE_DIRECTORY;
|
27
|
-
},
|
28
|
-
ENTRY_NAME_PATTERN: function() {
|
29
|
-
return ENTRY_NAME_PATTERN;
|
30
|
-
},
|
31
|
-
SERVER_RENDER_FUNCTION_NAME: function() {
|
32
|
-
return SERVER_RENDER_FUNCTION_NAME;
|
33
|
-
},
|
34
|
-
LOADABLE_STATS_FILE: function() {
|
35
|
-
return LOADABLE_STATS_FILE;
|
36
|
-
},
|
37
|
-
API_DIR: function() {
|
38
|
-
return API_DIR;
|
39
|
-
},
|
40
|
-
SERVER_DIR: function() {
|
41
|
-
return SERVER_DIR;
|
42
|
-
},
|
43
|
-
SHARED_DIR: function() {
|
44
|
-
return SHARED_DIR;
|
45
|
-
},
|
46
|
-
CONFIG_CACHE_DIR: function() {
|
47
|
-
return CONFIG_CACHE_DIR;
|
48
|
-
},
|
49
|
-
CONFIG_FILE_EXTENSIONS: function() {
|
50
|
-
return CONFIG_FILE_EXTENSIONS;
|
51
|
-
},
|
52
|
-
OUTPUT_CONFIG_FILE: function() {
|
53
|
-
return OUTPUT_CONFIG_FILE;
|
54
|
-
},
|
55
|
-
DEFAULT_SERVER_CONFIG: function() {
|
56
|
-
return DEFAULT_SERVER_CONFIG;
|
57
|
-
},
|
58
|
-
ROUTE_MANIFEST_FILE: function() {
|
59
|
-
return ROUTE_MANIFEST_FILE;
|
60
|
-
},
|
61
|
-
LOADER_ROUTES_DIR: function() {
|
62
|
-
return LOADER_ROUTES_DIR;
|
63
|
-
},
|
64
|
-
DEFAULT_DEV_HOST: function() {
|
65
|
-
return DEFAULT_DEV_HOST;
|
66
|
-
},
|
67
|
-
INTERNAL_APP_TOOLS_PLUGINS: function() {
|
68
|
-
return INTERNAL_APP_TOOLS_PLUGINS;
|
69
|
-
},
|
70
|
-
INTERNAL_APP_TOOLS_RUNTIME_PLUGINS: function() {
|
71
|
-
return INTERNAL_APP_TOOLS_RUNTIME_PLUGINS;
|
72
|
-
},
|
73
|
-
INTERNAL_MODULE_TOOLS_PLUGINS: function() {
|
74
|
-
return INTERNAL_MODULE_TOOLS_PLUGINS;
|
75
|
-
},
|
76
|
-
INTERNAL_MONOREPO_TOOLS_PLUGINS: function() {
|
77
|
-
return INTERNAL_MONOREPO_TOOLS_PLUGINS;
|
78
|
-
},
|
79
|
-
INTERNAL_DOC_TOOLS_PLUGINS: function() {
|
80
|
-
return INTERNAL_DOC_TOOLS_PLUGINS;
|
81
|
-
},
|
82
|
-
INTERNAL_CLI_PLUGINS: function() {
|
83
|
-
return INTERNAL_CLI_PLUGINS;
|
84
|
-
},
|
85
|
-
SERVER_PLUGIN_BFF: function() {
|
86
|
-
return SERVER_PLUGIN_BFF;
|
87
|
-
},
|
88
|
-
SERVER_PLUGIN_EXPRESS: function() {
|
89
|
-
return SERVER_PLUGIN_EXPRESS;
|
90
|
-
},
|
91
|
-
SERVER_PLUGIN_KOA: function() {
|
92
|
-
return SERVER_PLUGIN_KOA;
|
93
|
-
},
|
94
|
-
SERVER_PLUGIN_SERVER: function() {
|
95
|
-
return SERVER_PLUGIN_SERVER;
|
96
|
-
},
|
97
|
-
SERVER_PLUGIN_POLYFILL: function() {
|
98
|
-
return SERVER_PLUGIN_POLYFILL;
|
99
|
-
},
|
100
|
-
INTERNAL_SERVER_PLUGINS: function() {
|
101
|
-
return INTERNAL_SERVER_PLUGINS;
|
102
|
-
},
|
103
|
-
DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS: function() {
|
104
|
-
return DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS;
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
+
};
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
+
for (let key of __getOwnPropNames(from))
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
105
15
|
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
20
|
+
var constants_exports = {};
|
21
|
+
__export(constants_exports, {
|
22
|
+
API_DIR: () => API_DIR,
|
23
|
+
CONFIG_CACHE_DIR: () => CONFIG_CACHE_DIR,
|
24
|
+
CONFIG_FILE_EXTENSIONS: () => CONFIG_FILE_EXTENSIONS,
|
25
|
+
DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS: () => DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS,
|
26
|
+
DEFAULT_DEV_HOST: () => DEFAULT_DEV_HOST,
|
27
|
+
DEFAULT_SERVER_CONFIG: () => DEFAULT_SERVER_CONFIG,
|
28
|
+
ENTRY_NAME_PATTERN: () => ENTRY_NAME_PATTERN,
|
29
|
+
INTERNAL_APP_TOOLS_PLUGINS: () => INTERNAL_APP_TOOLS_PLUGINS,
|
30
|
+
INTERNAL_APP_TOOLS_RUNTIME_PLUGINS: () => INTERNAL_APP_TOOLS_RUNTIME_PLUGINS,
|
31
|
+
INTERNAL_CLI_PLUGINS: () => INTERNAL_CLI_PLUGINS,
|
32
|
+
INTERNAL_DOC_TOOLS_PLUGINS: () => INTERNAL_DOC_TOOLS_PLUGINS,
|
33
|
+
INTERNAL_MODULE_TOOLS_PLUGINS: () => INTERNAL_MODULE_TOOLS_PLUGINS,
|
34
|
+
INTERNAL_MONOREPO_TOOLS_PLUGINS: () => INTERNAL_MONOREPO_TOOLS_PLUGINS,
|
35
|
+
INTERNAL_SERVER_PLUGINS: () => INTERNAL_SERVER_PLUGINS,
|
36
|
+
LOADABLE_STATS_FILE: () => LOADABLE_STATS_FILE,
|
37
|
+
LOADER_ROUTES_DIR: () => LOADER_ROUTES_DIR,
|
38
|
+
MAIN_ENTRY_NAME: () => MAIN_ENTRY_NAME,
|
39
|
+
NESTED_ROUTE_SPEC_FILE: () => NESTED_ROUTE_SPEC_FILE,
|
40
|
+
OUTPUT_CONFIG_FILE: () => OUTPUT_CONFIG_FILE,
|
41
|
+
ROUTE_MANIFEST_FILE: () => ROUTE_MANIFEST_FILE,
|
42
|
+
ROUTE_SPEC_FILE: () => ROUTE_SPEC_FILE,
|
43
|
+
SERVER_BUNDLE_DIRECTORY: () => SERVER_BUNDLE_DIRECTORY,
|
44
|
+
SERVER_DIR: () => SERVER_DIR,
|
45
|
+
SERVER_PLUGIN_BFF: () => SERVER_PLUGIN_BFF,
|
46
|
+
SERVER_PLUGIN_EXPRESS: () => SERVER_PLUGIN_EXPRESS,
|
47
|
+
SERVER_PLUGIN_KOA: () => SERVER_PLUGIN_KOA,
|
48
|
+
SERVER_PLUGIN_POLYFILL: () => SERVER_PLUGIN_POLYFILL,
|
49
|
+
SERVER_PLUGIN_SERVER: () => SERVER_PLUGIN_SERVER,
|
50
|
+
SERVER_RENDER_FUNCTION_NAME: () => SERVER_RENDER_FUNCTION_NAME,
|
51
|
+
SERVER_WORKER_BUNDLE_DIRECTORY: () => SERVER_WORKER_BUNDLE_DIRECTORY,
|
52
|
+
SHARED_DIR: () => SHARED_DIR
|
106
53
|
});
|
107
|
-
|
108
|
-
|
54
|
+
module.exports = __toCommonJS(constants_exports);
|
55
|
+
__reExport(constants_exports, require("./chainId"), module.exports);
|
109
56
|
const ROUTE_SPEC_FILE = "route.json";
|
110
57
|
const NESTED_ROUTE_SPEC_FILE = "nestedRoutes.json";
|
111
58
|
const MAIN_ENTRY_NAME = "main";
|
@@ -207,3 +154,38 @@ const DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS = {
|
|
207
154
|
optimizeConstEnums: true,
|
208
155
|
isTSX: true
|
209
156
|
};
|
157
|
+
// Annotate the CommonJS export names for ESM import in node:
|
158
|
+
0 && (module.exports = {
|
159
|
+
API_DIR,
|
160
|
+
CONFIG_CACHE_DIR,
|
161
|
+
CONFIG_FILE_EXTENSIONS,
|
162
|
+
DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS,
|
163
|
+
DEFAULT_DEV_HOST,
|
164
|
+
DEFAULT_SERVER_CONFIG,
|
165
|
+
ENTRY_NAME_PATTERN,
|
166
|
+
INTERNAL_APP_TOOLS_PLUGINS,
|
167
|
+
INTERNAL_APP_TOOLS_RUNTIME_PLUGINS,
|
168
|
+
INTERNAL_CLI_PLUGINS,
|
169
|
+
INTERNAL_DOC_TOOLS_PLUGINS,
|
170
|
+
INTERNAL_MODULE_TOOLS_PLUGINS,
|
171
|
+
INTERNAL_MONOREPO_TOOLS_PLUGINS,
|
172
|
+
INTERNAL_SERVER_PLUGINS,
|
173
|
+
LOADABLE_STATS_FILE,
|
174
|
+
LOADER_ROUTES_DIR,
|
175
|
+
MAIN_ENTRY_NAME,
|
176
|
+
NESTED_ROUTE_SPEC_FILE,
|
177
|
+
OUTPUT_CONFIG_FILE,
|
178
|
+
ROUTE_MANIFEST_FILE,
|
179
|
+
ROUTE_SPEC_FILE,
|
180
|
+
SERVER_BUNDLE_DIRECTORY,
|
181
|
+
SERVER_DIR,
|
182
|
+
SERVER_PLUGIN_BFF,
|
183
|
+
SERVER_PLUGIN_EXPRESS,
|
184
|
+
SERVER_PLUGIN_KOA,
|
185
|
+
SERVER_PLUGIN_POLYFILL,
|
186
|
+
SERVER_PLUGIN_SERVER,
|
187
|
+
SERVER_RENDER_FUNCTION_NAME,
|
188
|
+
SERVER_WORKER_BUNDLE_DIRECTORY,
|
189
|
+
SHARED_DIR,
|
190
|
+
...require("./chainId")
|
191
|
+
});
|
package/dist/cjs/cli/ensure.js
CHANGED
@@ -1,25 +1,39 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
var __create = Object.create;
|
3
|
+
var __defProp = Object.defineProperty;
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
+
var __export = (target, all) => {
|
6
9
|
for (var name in all)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
return ensureAbsolutePath;
|
15
|
-
},
|
16
|
-
ensureArray: function() {
|
17
|
-
return ensureArray;
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
11
|
+
};
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
14
|
+
for (let key of __getOwnPropNames(from))
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
18
17
|
}
|
18
|
+
return to;
|
19
|
+
};
|
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
|
+
var ensure_exports = {};
|
30
|
+
__export(ensure_exports, {
|
31
|
+
ensureAbsolutePath: () => ensureAbsolutePath,
|
32
|
+
ensureArray: () => ensureArray
|
19
33
|
});
|
20
|
-
|
21
|
-
|
22
|
-
const ensureAbsolutePath = (base, filePath) =>
|
34
|
+
module.exports = __toCommonJS(ensure_exports);
|
35
|
+
var import_path = __toESM(require("path"));
|
36
|
+
const ensureAbsolutePath = (base, filePath) => import_path.default.isAbsolute(filePath) ? filePath : import_path.default.resolve(base, filePath);
|
23
37
|
const ensureArray = (params) => {
|
24
38
|
if (Array.isArray(params)) {
|
25
39
|
return params;
|
@@ -28,3 +42,8 @@ const ensureArray = (params) => {
|
|
28
42
|
params
|
29
43
|
];
|
30
44
|
};
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
46
|
+
0 && (module.exports = {
|
47
|
+
ensureAbsolutePath,
|
48
|
+
ensureArray
|
49
|
+
});
|
package/dist/cjs/cli/fs.js
CHANGED
@@ -1,33 +1,43 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.defineProperty
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
6
7
|
for (var name in all)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
return findExists;
|
15
|
-
},
|
16
|
-
emptyDir: function() {
|
17
|
-
return emptyDir;
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
+
};
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
+
for (let key of __getOwnPropNames(from))
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
18
15
|
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
var fs_exports = {};
|
20
|
+
__export(fs_exports, {
|
21
|
+
emptyDir: () => emptyDir,
|
22
|
+
findExists: () => findExists
|
19
23
|
});
|
20
|
-
|
24
|
+
module.exports = __toCommonJS(fs_exports);
|
25
|
+
var import_compiled = require("../compiled");
|
21
26
|
const findExists = (files) => {
|
22
27
|
for (const file of files) {
|
23
|
-
if (
|
28
|
+
if (import_compiled.fs.existsSync(file) && import_compiled.fs.statSync(file).isFile()) {
|
24
29
|
return file;
|
25
30
|
}
|
26
31
|
}
|
27
32
|
return false;
|
28
33
|
};
|
29
34
|
const emptyDir = async (dir) => {
|
30
|
-
if (await
|
31
|
-
await
|
35
|
+
if (await import_compiled.fs.pathExists(dir)) {
|
36
|
+
await import_compiled.fs.emptyDir(dir);
|
32
37
|
}
|
33
38
|
};
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
40
|
+
0 && (module.exports = {
|
41
|
+
emptyDir,
|
42
|
+
findExists
|
43
|
+
});
|
@@ -1,21 +1,34 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.defineProperty
|
3
|
-
|
4
|
-
|
5
|
-
Object.
|
6
|
-
|
7
|
-
|
8
|
-
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
+
};
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
+
for (let key of __getOwnPropNames(from))
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
9
15
|
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
var config_exports = {};
|
20
|
+
__export(config_exports, {
|
21
|
+
getEntryOptions: () => getEntryOptions
|
10
22
|
});
|
11
|
-
|
23
|
+
module.exports = __toCommonJS(config_exports);
|
24
|
+
var import_is = require("../is");
|
12
25
|
const getEntryOptions = (name, isMainEntry, baseOptions, optionsByEntries, packageName) => {
|
13
26
|
if (optionsByEntries) {
|
14
27
|
let optionsByEntry = getOptionsByEntryName(name, optionsByEntries);
|
15
28
|
if (optionsByEntry === void 0 && isMainEntry && packageName) {
|
16
29
|
optionsByEntry = getOptionsByEntryName(packageName, optionsByEntries);
|
17
30
|
}
|
18
|
-
return optionsByEntry !== void 0 ? (0,
|
31
|
+
return optionsByEntry !== void 0 ? (0, import_is.isPlainObject)(optionsByEntry) && (0, import_is.isPlainObject)(baseOptions) ? {
|
19
32
|
...baseOptions,
|
20
33
|
...optionsByEntry
|
21
34
|
} : optionsByEntry : baseOptions;
|
@@ -24,3 +37,7 @@ const getEntryOptions = (name, isMainEntry, baseOptions, optionsByEntries, packa
|
|
24
37
|
}
|
25
38
|
};
|
26
39
|
const getOptionsByEntryName = (name, optionsByEntries) => optionsByEntries.hasOwnProperty(name) ? optionsByEntries[name] : void 0;
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
41
|
+
0 && (module.exports = {
|
42
|
+
getEntryOptions
|
43
|
+
});
|
package/dist/cjs/cli/get/data.js
CHANGED
@@ -1,75 +1,77 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
var __create = Object.create;
|
3
|
+
var __defProp = Object.defineProperty;
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
+
var __export = (target, all) => {
|
6
9
|
for (var name in all)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
return getPackageManager;
|
15
|
-
},
|
16
|
-
getCoreJsVersion: function() {
|
17
|
-
return getCoreJsVersion;
|
18
|
-
},
|
19
|
-
getAntdMajorVersion: function() {
|
20
|
-
return getAntdMajorVersion;
|
21
|
-
},
|
22
|
-
defaults: function() {
|
23
|
-
return defaults;
|
24
|
-
},
|
25
|
-
getBrowserslist: function() {
|
26
|
-
return getBrowserslist;
|
27
|
-
},
|
28
|
-
getInternalPlugins: function() {
|
29
|
-
return getInternalPlugins;
|
30
|
-
},
|
31
|
-
readTsConfig: function() {
|
32
|
-
return readTsConfig;
|
33
|
-
},
|
34
|
-
readTsConfigByFile: function() {
|
35
|
-
return readTsConfigByFile;
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
11
|
+
};
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
14
|
+
for (let key of __getOwnPropNames(from))
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
36
17
|
}
|
18
|
+
return to;
|
19
|
+
};
|
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
|
+
var data_exports = {};
|
30
|
+
__export(data_exports, {
|
31
|
+
defaults: () => defaults,
|
32
|
+
getAntdMajorVersion: () => getAntdMajorVersion,
|
33
|
+
getBrowserslist: () => getBrowserslist,
|
34
|
+
getCoreJsVersion: () => getCoreJsVersion,
|
35
|
+
getInternalPlugins: () => getInternalPlugins,
|
36
|
+
getPackageManager: () => getPackageManager,
|
37
|
+
readTsConfig: () => readTsConfig,
|
38
|
+
readTsConfigByFile: () => readTsConfigByFile
|
37
39
|
});
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
40
|
+
module.exports = __toCommonJS(data_exports);
|
41
|
+
var import_os = __toESM(require("os"));
|
42
|
+
var import_path = __toESM(require("path"));
|
43
|
+
var import_compiled = require("../../compiled");
|
44
|
+
var import_constants = require("../constants");
|
45
|
+
var import_is = require("../is");
|
46
|
+
var import_package = require("../package");
|
45
47
|
const MAX_TIMES = 5;
|
46
48
|
async function getPackageManager(cwd = process.cwd()) {
|
47
49
|
let appDirectory = cwd;
|
48
50
|
let times = 0;
|
49
|
-
while (
|
51
|
+
while (import_os.default.homedir() !== appDirectory && times < MAX_TIMES) {
|
50
52
|
times++;
|
51
|
-
if (
|
53
|
+
if (import_compiled.fs.existsSync(import_path.default.resolve(appDirectory, "pnpm-lock.yaml"))) {
|
52
54
|
return "pnpm";
|
53
55
|
}
|
54
|
-
if (
|
56
|
+
if (import_compiled.fs.existsSync(import_path.default.resolve(appDirectory, "yarn.lock"))) {
|
55
57
|
return "yarn";
|
56
58
|
}
|
57
|
-
if (
|
59
|
+
if (import_compiled.fs.existsSync(import_path.default.resolve(appDirectory, "package-lock.json"))) {
|
58
60
|
return "npm";
|
59
61
|
}
|
60
|
-
appDirectory =
|
62
|
+
appDirectory = import_path.default.join(appDirectory, "..");
|
61
63
|
}
|
62
|
-
if (await (0,
|
64
|
+
if (await (0, import_package.canUsePnpm)()) {
|
63
65
|
return "pnpm";
|
64
66
|
}
|
65
|
-
if (await (0,
|
67
|
+
if (await (0, import_package.canUseYarn)()) {
|
66
68
|
return "yarn";
|
67
69
|
}
|
68
70
|
return "npm";
|
69
71
|
}
|
70
72
|
const getCoreJsVersion = (corejsPkgPath) => {
|
71
73
|
try {
|
72
|
-
const { version } =
|
74
|
+
const { version } = import_compiled.fs.readJSONSync(corejsPkgPath);
|
73
75
|
const [major, minor] = version.split(".");
|
74
76
|
return `${major}.${minor}`;
|
75
77
|
} catch (err) {
|
@@ -94,17 +96,17 @@ const defaults = [
|
|
94
96
|
"not dead",
|
95
97
|
"not op_mini all"
|
96
98
|
];
|
97
|
-
const getBrowserslist = (appDirectory) =>
|
99
|
+
const getBrowserslist = (appDirectory) => import_compiled.browserslist.loadConfig({
|
98
100
|
path: appDirectory
|
99
101
|
}) || defaults;
|
100
|
-
function getInternalPlugins(appDirectory, internalPlugins =
|
102
|
+
function getInternalPlugins(appDirectory, internalPlugins = import_constants.INTERNAL_CLI_PLUGINS) {
|
101
103
|
return [
|
102
104
|
...Object.keys(internalPlugins).filter((name) => {
|
103
105
|
const config = internalPlugins[name];
|
104
106
|
if (typeof config !== "string" && config.forced === true) {
|
105
107
|
return true;
|
106
108
|
}
|
107
|
-
return (0,
|
109
|
+
return (0, import_is.isDepExists)(appDirectory, name);
|
108
110
|
}).map((name) => {
|
109
111
|
const config = internalPlugins[name];
|
110
112
|
if (typeof config !== "string") {
|
@@ -116,9 +118,20 @@ function getInternalPlugins(appDirectory, internalPlugins = _constants.INTERNAL_
|
|
116
118
|
];
|
117
119
|
}
|
118
120
|
const readTsConfig = (root) => {
|
119
|
-
return readTsConfigByFile(
|
121
|
+
return readTsConfigByFile(import_path.default.resolve(root, "./tsconfig.json"));
|
120
122
|
};
|
121
123
|
const readTsConfigByFile = (filename) => {
|
122
|
-
const content =
|
123
|
-
return
|
124
|
+
const content = import_compiled.fs.readFileSync(import_path.default.resolve(filename), "utf-8");
|
125
|
+
return import_compiled.json5.parse(content);
|
124
126
|
};
|
127
|
+
// Annotate the CommonJS export names for ESM import in node:
|
128
|
+
0 && (module.exports = {
|
129
|
+
defaults,
|
130
|
+
getAntdMajorVersion,
|
131
|
+
getBrowserslist,
|
132
|
+
getCoreJsVersion,
|
133
|
+
getInternalPlugins,
|
134
|
+
getPackageManager,
|
135
|
+
readTsConfig,
|
136
|
+
readTsConfigByFile
|
137
|
+
});
|
@@ -1,34 +1,55 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
var __create = Object.create;
|
3
|
+
var __defProp = Object.defineProperty;
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
+
var __export = (target, all) => {
|
6
9
|
for (var name in all)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
return getServerConfig;
|
15
|
-
},
|
16
|
-
getTargetDir: function() {
|
17
|
-
return getTargetDir;
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
11
|
+
};
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
14
|
+
for (let key of __getOwnPropNames(from))
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
18
17
|
}
|
18
|
+
return to;
|
19
|
+
};
|
20
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
27
|
+
mod
|
28
|
+
));
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
30
|
+
var get_exports = {};
|
31
|
+
__export(get_exports, {
|
32
|
+
getServerConfig: () => getServerConfig,
|
33
|
+
getTargetDir: () => getTargetDir
|
19
34
|
});
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
_export_star._(require("./config"), exports);
|
35
|
+
module.exports = __toCommonJS(get_exports);
|
36
|
+
var import_path = __toESM(require("path"));
|
37
|
+
var import_constants = require("../constants");
|
38
|
+
var import_fs = require("../fs");
|
39
|
+
__reExport(get_exports, require("./data"), module.exports);
|
40
|
+
__reExport(get_exports, require("./config"), module.exports);
|
27
41
|
const getServerConfig = async (appDirectory, configFile) => {
|
28
|
-
const configFilePath = (0,
|
42
|
+
const configFilePath = (0, import_fs.findExists)(import_constants.CONFIG_FILE_EXTENSIONS.map((extension) => import_path.default.resolve(appDirectory, `${configFile}${extension}`)));
|
29
43
|
return configFilePath;
|
30
44
|
};
|
31
45
|
const getTargetDir = (from, baseDir, targetBaseDir) => {
|
32
|
-
const relativePath =
|
33
|
-
return
|
46
|
+
const relativePath = import_path.default.relative(baseDir, from);
|
47
|
+
return import_path.default.resolve(targetBaseDir, relativePath);
|
34
48
|
};
|
49
|
+
// Annotate the CommonJS export names for ESM import in node:
|
50
|
+
0 && (module.exports = {
|
51
|
+
getServerConfig,
|
52
|
+
getTargetDir,
|
53
|
+
...require("./data"),
|
54
|
+
...require("./config")
|
55
|
+
});
|