@modern-js/utils 2.35.0 → 2.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/cli/alias.js +48 -49
- 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 +27 -10
- 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 +45 -41
- 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 -125
- 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 +50 -34
- package/dist/cjs/cli/require.js +36 -31
- 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 +28 -18
- package/dist/cjs/universal/pluginDagSort.js +25 -8
- package/dist/esm/cli/alias.js +13 -25
- 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 +7 -4
- 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 +23 -17
- 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 -123
- 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 +6 -3
- package/dist/esm/cli/prettyInstructions.js +8 -5
- package/dist/esm/cli/require.js +15 -8
- 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 +8 -5
- package/dist/esm/universal/pluginDagSort.js +5 -2
- package/dist/esm-node/cli/alias.js +11 -22
- 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 +7 -4
- 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 +23 -17
- 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 -108
- 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 +5 -2
- package/dist/esm-node/cli/prettyInstructions.js +8 -7
- package/dist/esm-node/cli/require.js +15 -8
- 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 +8 -5
- package/dist/esm-node/universal/pluginDagSort.js +5 -2
- package/dist/types/cli/alias.d.ts +0 -5
- package/dist/types/cli/constants/chainId.d.ts +2 -2
- 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 -64
- package/dist/types/cli/monorepo.d.ts +0 -1
- package/package.json +6 -84
- package/dist/cjs/cli/is/platform.js +0 -21
- package/dist/cjs/runtime/nestedRoutes.js +0 -149
- package/dist/cjs/runtime/remixRouter.js +0 -6
- package/dist/cjs/runtime/router.js +0 -6
- package/dist/cjs/runtime-browser/index.js +0 -6
- package/dist/cjs/runtime-browser/parsed.js +0 -28
- package/dist/cjs/runtime-node/index.js +0 -28
- package/dist/cjs/runtime-node/loaderContext/createLoaderCtx.js +0 -34
- package/dist/cjs/runtime-node/loaderContext/createRequestCtx.js +0 -38
- package/dist/cjs/runtime-node/loaderContext/index.js +0 -22
- package/dist/cjs/runtime-node/nestedRoutes.js +0 -28
- package/dist/cjs/runtime-node/router.js +0 -6
- package/dist/cjs/runtime-node/serialize.js +0 -17
- package/dist/cjs/runtime-node/storage.js +0 -48
- package/dist/cjs/universal/time.js +0 -38
- 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/runtime/nestedRoutes.js +0 -163
- package/dist/esm/runtime/remixRouter.js +0 -1
- package/dist/esm/runtime/router.js +0 -1
- package/dist/esm/runtime-browser/index.js +0 -1
- package/dist/esm/runtime-browser/parsed.js +0 -18
- package/dist/esm/runtime-node/index.js +0 -6
- package/dist/esm/runtime-node/loaderContext/createLoaderCtx.js +0 -20
- package/dist/esm/runtime-node/loaderContext/createRequestCtx.js +0 -24
- package/dist/esm/runtime-node/loaderContext/index.js +0 -3
- package/dist/esm/runtime-node/nestedRoutes.js +0 -20
- package/dist/esm/runtime-node/router.js +0 -1
- package/dist/esm/runtime-node/serialize.js +0 -6
- package/dist/esm/runtime-node/storage.js +0 -36
- package/dist/esm/universal/time.js +0 -29
- package/dist/esm-node/cli/is/platform.js +0 -2
- package/dist/esm-node/runtime/nestedRoutes.js +0 -129
- package/dist/esm-node/runtime/remixRouter.js +0 -1
- package/dist/esm-node/runtime/router.js +0 -1
- package/dist/esm-node/runtime-browser/index.js +0 -1
- package/dist/esm-node/runtime-browser/parsed.js +0 -18
- package/dist/esm-node/runtime-node/index.js +0 -6
- package/dist/esm-node/runtime-node/loaderContext/createLoaderCtx.js +0 -15
- package/dist/esm-node/runtime-node/loaderContext/createRequestCtx.js +0 -19
- package/dist/esm-node/runtime-node/loaderContext/index.js +0 -3
- package/dist/esm-node/runtime-node/nestedRoutes.js +0 -18
- package/dist/esm-node/runtime-node/router.js +0 -1
- package/dist/esm-node/runtime-node/serialize.js +0 -6
- package/dist/esm-node/runtime-node/storage.js +0 -38
- package/dist/esm-node/universal/time.js +0 -28
- package/dist/types/cli/is/platform.d.ts +0 -2
- package/dist/types/runtime/nestedRoutes.d.ts +0 -13
- package/dist/types/runtime/remixRouter.d.ts +0 -1
- package/dist/types/runtime/router.d.ts +0 -1
- package/dist/types/runtime-browser/index.d.ts +0 -1
- package/dist/types/runtime-browser/parsed.d.ts +0 -1
- package/dist/types/runtime-node/index.d.ts +0 -10
- package/dist/types/runtime-node/loaderContext/createLoaderCtx.d.ts +0 -7
- package/dist/types/runtime-node/loaderContext/createRequestCtx.d.ts +0 -7
- package/dist/types/runtime-node/loaderContext/index.d.ts +0 -4
- package/dist/types/runtime-node/nestedRoutes.d.ts +0 -3
- package/dist/types/runtime-node/router.d.ts +0 -1
- package/dist/types/runtime-node/serialize.d.ts +0 -1
- package/dist/types/runtime-node/storage.d.ts +0 -5
- package/dist/types/universal/time.d.ts +0 -1
package/dist/cjs/cli/alias.js
CHANGED
|
@@ -1,53 +1,46 @@
|
|
|
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 validAlias;
|
|
15
|
-
},
|
|
16
|
-
mergeAlias: function() {
|
|
17
|
-
return mergeAlias;
|
|
18
|
-
},
|
|
19
|
-
getAliasConfig: function() {
|
|
20
|
-
return getAliasConfig;
|
|
21
|
-
},
|
|
22
|
-
getUserAlias: function() {
|
|
23
|
-
return getUserAlias;
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
27
|
-
const _fs = /* @__PURE__ */ _interop_require_default._(require("fs"));
|
|
28
|
-
const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
|
|
29
|
-
const _compiled = require("../compiled");
|
|
30
|
-
const _get = require("./get");
|
|
31
|
-
const _applyOptionsChain = require("./applyOptionsChain");
|
|
32
|
-
const validAlias = (modernConfig, { tsconfigPath }) => {
|
|
33
|
-
const { source: { alias } } = modernConfig;
|
|
34
|
-
if (!alias) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
const isTsProject = _fs.default.existsSync(tsconfigPath);
|
|
38
|
-
if (!isTsProject) {
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
const userAlias = getUserAlias(alias);
|
|
42
|
-
if (Object.keys(userAlias).length > 0) {
|
|
43
|
-
return _compiled.chalk.red('Note: Please use `compilerOptions.paths` in "tsconfig.json" file replace `source.alias` config in "modern.config.js/ts" when project is typescript');
|
|
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 });
|
|
44
17
|
}
|
|
45
|
-
return
|
|
18
|
+
return to;
|
|
46
19
|
};
|
|
47
|
-
|
|
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 alias_exports = {};
|
|
30
|
+
__export(alias_exports, {
|
|
31
|
+
getAliasConfig: () => getAliasConfig,
|
|
32
|
+
getUserAlias: () => getUserAlias,
|
|
33
|
+
mergeAlias: () => mergeAlias
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(alias_exports);
|
|
36
|
+
var import_fs = __toESM(require("fs"));
|
|
37
|
+
var import_path = __toESM(require("path"));
|
|
38
|
+
var import_get = require("./get");
|
|
39
|
+
var import_applyOptionsChain = require("./applyOptionsChain");
|
|
40
|
+
const mergeAlias = (alias) => (0, import_applyOptionsChain.applyOptionsChain)({}, alias);
|
|
48
41
|
const getAliasConfig = (aliasOption, option) => {
|
|
49
|
-
var _tsconfig_compilerOptions,
|
|
50
|
-
const isTsProject =
|
|
42
|
+
var _tsconfig_compilerOptions, _tsconfig_compilerOptions1;
|
|
43
|
+
const isTsProject = import_fs.default.existsSync(option.tsconfigPath);
|
|
51
44
|
const alias = mergeAlias(aliasOption);
|
|
52
45
|
if (!isTsProject) {
|
|
53
46
|
return {
|
|
@@ -57,13 +50,13 @@ const getAliasConfig = (aliasOption, option) => {
|
|
|
57
50
|
isTsProject
|
|
58
51
|
};
|
|
59
52
|
}
|
|
60
|
-
const tsconfig = (0,
|
|
61
|
-
const baseUrl =
|
|
53
|
+
const tsconfig = (0, import_get.readTsConfigByFile)(option.tsconfigPath);
|
|
54
|
+
const baseUrl = tsconfig === null || tsconfig === void 0 ? void 0 : (_tsconfig_compilerOptions = tsconfig.compilerOptions) === null || _tsconfig_compilerOptions === void 0 ? void 0 : _tsconfig_compilerOptions.baseUrl;
|
|
62
55
|
return {
|
|
63
|
-
absoluteBaseUrl: baseUrl ?
|
|
56
|
+
absoluteBaseUrl: baseUrl ? import_path.default.join(option.appDirectory, baseUrl) : option.appDirectory,
|
|
64
57
|
paths: {
|
|
65
58
|
...alias,
|
|
66
|
-
...
|
|
59
|
+
...tsconfig === null || tsconfig === void 0 ? void 0 : (_tsconfig_compilerOptions1 = tsconfig.compilerOptions) === null || _tsconfig_compilerOptions1 === void 0 ? void 0 : _tsconfig_compilerOptions1.paths
|
|
67
60
|
},
|
|
68
61
|
isTsPath: true,
|
|
69
62
|
isTsProject
|
|
@@ -75,3 +68,9 @@ const getUserAlias = (alias = {}) => Object.keys(alias).reduce((o, k) => {
|
|
|
75
68
|
}
|
|
76
69
|
return o;
|
|
77
70
|
}, {});
|
|
71
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
72
|
+
0 && (module.exports = {
|
|
73
|
+
getAliasConfig,
|
|
74
|
+
getUserAlias,
|
|
75
|
+
mergeAlias
|
|
76
|
+
});
|
|
@@ -1,26 +1,39 @@
|
|
|
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 applyOptionsChain_exports = {};
|
|
20
|
+
__export(applyOptionsChain_exports, {
|
|
21
|
+
applyOptionsChain: () => applyOptionsChain
|
|
10
22
|
});
|
|
11
|
-
|
|
12
|
-
|
|
23
|
+
module.exports = __toCommonJS(applyOptionsChain_exports);
|
|
24
|
+
var import_is = require("./is");
|
|
25
|
+
var import_logger = require("./logger");
|
|
13
26
|
function applyOptionsChain(defaults, options, utils, mergeFn = Object.assign) {
|
|
14
27
|
if (!options) {
|
|
15
28
|
return defaults;
|
|
16
29
|
}
|
|
17
|
-
if ((0,
|
|
30
|
+
if ((0, import_is.isPlainObject)(options)) {
|
|
18
31
|
return mergeFn(defaults, options);
|
|
19
|
-
} else if ((0,
|
|
32
|
+
} else if ((0, import_is.isFunction)(options)) {
|
|
20
33
|
const ret = options(defaults, utils);
|
|
21
34
|
if (ret) {
|
|
22
|
-
if (!(0,
|
|
23
|
-
|
|
35
|
+
if (!(0, import_is.isPlainObject)(ret)) {
|
|
36
|
+
import_logger.logger.warn(`${options.name}: Function should mutate the config and return nothing, Or return a cloned or merged version of config object.`);
|
|
24
37
|
}
|
|
25
38
|
return ret;
|
|
26
39
|
}
|
|
@@ -32,3 +45,7 @@ default options is: ${JSON.stringify(defaults)}`);
|
|
|
32
45
|
}
|
|
33
46
|
return defaults;
|
|
34
47
|
}
|
|
48
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
+
0 && (module.exports = {
|
|
50
|
+
applyOptionsChain
|
|
51
|
+
});
|
package/dist/cjs/cli/babel.js
CHANGED
|
@@ -1,29 +1,34 @@
|
|
|
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 getBabelUtils;
|
|
15
|
-
},
|
|
16
|
-
applyUserBabelConfig: function() {
|
|
17
|
-
return applyUserBabelConfig;
|
|
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 babel_exports = {};
|
|
20
|
+
__export(babel_exports, {
|
|
21
|
+
applyUserBabelConfig: () => applyUserBabelConfig,
|
|
22
|
+
getBabelUtils: () => getBabelUtils
|
|
19
23
|
});
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
module.exports = __toCommonJS(babel_exports);
|
|
25
|
+
var import_path = require("path");
|
|
26
|
+
var import_applyOptionsChain = require("./applyOptionsChain");
|
|
27
|
+
var import_ensure = require("./ensure");
|
|
28
|
+
var import_path2 = require("./path");
|
|
24
29
|
const formatPath = (originPath) => {
|
|
25
|
-
if ((0,
|
|
26
|
-
return originPath.split(
|
|
30
|
+
if ((0, import_path.isAbsolute)(originPath)) {
|
|
31
|
+
return originPath.split(import_path.sep).join("/");
|
|
27
32
|
}
|
|
28
33
|
return originPath;
|
|
29
34
|
};
|
|
@@ -54,7 +59,7 @@ const removePlugins = (plugins, config) => {
|
|
|
54
59
|
if (!config.plugins) {
|
|
55
60
|
return;
|
|
56
61
|
}
|
|
57
|
-
const removeList = (0,
|
|
62
|
+
const removeList = (0, import_ensure.ensureArray)(plugins);
|
|
58
63
|
config.plugins = config.plugins.filter((item) => {
|
|
59
64
|
const name = getPluginItemName(item);
|
|
60
65
|
if (name) {
|
|
@@ -67,7 +72,7 @@ const removePresets = (presets, config) => {
|
|
|
67
72
|
if (!config.presets) {
|
|
68
73
|
return;
|
|
69
74
|
}
|
|
70
|
-
const removeList = (0,
|
|
75
|
+
const removeList = (0, import_ensure.ensureArray)(presets);
|
|
71
76
|
config.presets = config.presets.filter((item) => {
|
|
72
77
|
const name = getPluginItemName(item);
|
|
73
78
|
if (name) {
|
|
@@ -79,13 +84,13 @@ const removePresets = (presets, config) => {
|
|
|
79
84
|
const modifyPresetOptions = (presetName, options, presets = []) => {
|
|
80
85
|
presets.forEach((preset, index) => {
|
|
81
86
|
if (Array.isArray(preset)) {
|
|
82
|
-
if (typeof preset[0] === "string" && (0,
|
|
87
|
+
if (typeof preset[0] === "string" && (0, import_path2.normalizeToPosixPath)(preset[0]).includes(presetName)) {
|
|
83
88
|
preset[1] = {
|
|
84
89
|
...preset[1] || {},
|
|
85
90
|
...options
|
|
86
91
|
};
|
|
87
92
|
}
|
|
88
|
-
} else if (typeof preset === "string" && (0,
|
|
93
|
+
} else if (typeof preset === "string" && (0, import_path2.normalizeToPosixPath)(preset).includes(presetName)) {
|
|
89
94
|
presets[index] = [
|
|
90
95
|
preset,
|
|
91
96
|
options
|
|
@@ -116,7 +121,12 @@ const applyUserBabelConfig = (defaultOptions, userBabelConfig, extraBabelUtils)
|
|
|
116
121
|
...getBabelUtils(defaultOptions),
|
|
117
122
|
...extraBabelUtils
|
|
118
123
|
};
|
|
119
|
-
return (0,
|
|
124
|
+
return (0, import_applyOptionsChain.applyOptionsChain)(defaultOptions, userBabelConfig || {}, babelUtils);
|
|
120
125
|
}
|
|
121
126
|
return defaultOptions;
|
|
122
127
|
};
|
|
128
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
129
|
+
0 && (module.exports = {
|
|
130
|
+
applyUserBabelConfig,
|
|
131
|
+
getBabelUtils
|
|
132
|
+
});
|
package/dist/cjs/cli/commands.js
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
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 getFullArgv;
|
|
15
|
-
},
|
|
16
|
-
getArgv: function() {
|
|
17
|
-
return getArgv;
|
|
18
|
-
},
|
|
19
|
-
getCommand: function() {
|
|
20
|
-
return getCommand;
|
|
21
|
-
},
|
|
22
|
-
isDevCommand: function() {
|
|
23
|
-
return isDevCommand;
|
|
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 });
|
|
24
15
|
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var commands_exports = {};
|
|
20
|
+
__export(commands_exports, {
|
|
21
|
+
getArgv: () => getArgv,
|
|
22
|
+
getCommand: () => getCommand,
|
|
23
|
+
getFullArgv: () => getFullArgv,
|
|
24
|
+
isDevCommand: () => isDevCommand
|
|
25
25
|
});
|
|
26
|
+
module.exports = __toCommonJS(commands_exports);
|
|
26
27
|
const getFullArgv = () => {
|
|
27
28
|
var _process_env_MODERN_ARGV;
|
|
28
29
|
return ((_process_env_MODERN_ARGV = process.env.MODERN_ARGV) === null || _process_env_MODERN_ARGV === void 0 ? void 0 : _process_env_MODERN_ARGV.split(" ")) || process.argv;
|
|
@@ -39,3 +40,10 @@ const isDevCommand = () => {
|
|
|
39
40
|
const command = getCommand();
|
|
40
41
|
return command === "dev" || command === "start";
|
|
41
42
|
};
|
|
43
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
+
0 && (module.exports = {
|
|
45
|
+
getArgv,
|
|
46
|
+
getCommand,
|
|
47
|
+
getFullArgv,
|
|
48
|
+
isDevCommand
|
|
49
|
+
});
|
package/dist/cjs/cli/common.js
CHANGED
|
@@ -1,27 +1,30 @@
|
|
|
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 createDebugger;
|
|
15
|
-
},
|
|
16
|
-
clearConsole: function() {
|
|
17
|
-
return clearConsole;
|
|
18
|
-
},
|
|
19
|
-
wait: function() {
|
|
20
|
-
return wait;
|
|
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 });
|
|
21
15
|
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var common_exports = {};
|
|
20
|
+
__export(common_exports, {
|
|
21
|
+
clearConsole: () => clearConsole,
|
|
22
|
+
createDebugger: () => createDebugger,
|
|
23
|
+
wait: () => wait
|
|
22
24
|
});
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
module.exports = __toCommonJS(common_exports);
|
|
26
|
+
var import_debug = require("../../compiled/debug");
|
|
27
|
+
const createDebugger = (scope) => (0, import_debug.debug)(`modern-js:${scope}`);
|
|
25
28
|
const clearConsole = () => {
|
|
26
29
|
if (process.stdout.isTTY && !process.env.DEBUG) {
|
|
27
30
|
process.stdout.write("\x1B[H\x1B[2J");
|
|
@@ -30,3 +33,9 @@ const clearConsole = () => {
|
|
|
30
33
|
const wait = (time = 0) => new Promise((resolve) => {
|
|
31
34
|
setTimeout(resolve, time);
|
|
32
35
|
});
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
clearConsole,
|
|
39
|
+
createDebugger,
|
|
40
|
+
wait
|
|
41
|
+
});
|
package/dist/cjs/cli/config.js
CHANGED
|
@@ -1,15 +1,32 @@
|
|
|
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
|
+
isOverriddenConfigKey: () => isOverriddenConfigKey
|
|
10
22
|
});
|
|
23
|
+
module.exports = __toCommonJS(config_exports);
|
|
11
24
|
const isOverriddenConfigKey = (key) => [
|
|
12
25
|
"removeConsole",
|
|
13
26
|
"enableInlineScripts",
|
|
14
27
|
"enableInlineStyles"
|
|
15
28
|
].includes(key);
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
isOverriddenConfigKey
|
|
32
|
+
});
|
|
@@ -1,13 +1,26 @@
|
|
|
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 chainId_exports = {};
|
|
20
|
+
__export(chainId_exports, {
|
|
21
|
+
CHAIN_ID: () => CHAIN_ID
|
|
10
22
|
});
|
|
23
|
+
module.exports = __toCommonJS(chainId_exports);
|
|
11
24
|
const CHAIN_ID = {
|
|
12
25
|
/** Predefined rules */
|
|
13
26
|
RULE: {
|
|
@@ -99,8 +112,6 @@ const CHAIN_ID = {
|
|
|
99
112
|
STYLE: "style-loader",
|
|
100
113
|
/** postcss-loader */
|
|
101
114
|
POSTCSS: "postcss",
|
|
102
|
-
/** markdown-loader */
|
|
103
|
-
MARKDOWN: "markdown",
|
|
104
115
|
/** ignore-css-loader */
|
|
105
116
|
IGNORE_CSS: "ignore-css",
|
|
106
117
|
/** css-modules-typescript-loader */
|
|
@@ -181,7 +192,9 @@ const CHAIN_ID = {
|
|
|
181
192
|
/** HtmlAsyncChunkPlugin */
|
|
182
193
|
HTML_ASYNC_CHUNK: "html-async-chunk",
|
|
183
194
|
/** SWC_POLYFILL_CHECKER */
|
|
184
|
-
SWC_POLYFILL_CHECKER: "swc-polyfill-checker-plugin"
|
|
195
|
+
SWC_POLYFILL_CHECKER: "swc-polyfill-checker-plugin",
|
|
196
|
+
/** RouterPlugin */
|
|
197
|
+
ROUTER_MANIFEST: "route-plugin"
|
|
185
198
|
},
|
|
186
199
|
/** Predefined minimizers */
|
|
187
200
|
MINIMIZER: {
|
|
@@ -202,3 +215,7 @@ const CHAIN_ID = {
|
|
|
202
215
|
TS_CONFIG_PATHS: "ts-config-paths"
|
|
203
216
|
}
|
|
204
217
|
};
|
|
218
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
219
|
+
0 && (module.exports = {
|
|
220
|
+
CHAIN_ID
|
|
221
|
+
});
|