@modern-js/utils 3.0.0-alpha.1 → 3.0.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/common.js +12 -2
- package/dist/cjs/cli/get/data.js +0 -15
- package/dist/cjs/cli/index.js +32 -39
- package/dist/cjs/cli/is/project.js +7 -12
- package/dist/cjs/cli/require.js +32 -30
- package/dist/cjs/compiled.js +90 -89
- package/dist/cjs/import.js +23 -28
- package/dist/compiled/commander/index.mjs +2 -0
- package/dist/compiled/js-yaml/index.js +102 -99
- package/dist/compiled/js-yaml/index.mjs +2167 -0
- package/dist/compiled/js-yaml/index.mjs.LICENSE.txt +1 -0
- package/dist/compiled/js-yaml/package.json +1 -1
- package/dist/compiled/lodash/index.mjs +1 -0
- package/dist/compiled/nanoid/index.js +4 -4
- package/dist/compiled/nanoid/index.mjs +69 -0
- package/dist/compiled/nanoid/package.json +1 -1
- package/dist/compiled/tsconfig-paths/index.mjs +2 -0
- package/dist/esm/cli/alias.mjs +2 -2
- package/dist/esm/cli/applyOptionsChain.mjs +2 -2
- package/dist/esm/cli/commands.mjs +1 -1
- package/dist/esm/cli/common.mjs +2 -4
- package/dist/esm/cli/constants.mjs +1 -1
- package/dist/esm/cli/fs.mjs +1 -1
- package/dist/esm/cli/get/config.mjs +1 -1
- package/dist/esm/cli/get/data.mjs +4 -13
- package/dist/esm/cli/get/index.mjs +4 -4
- package/dist/esm/cli/index.mjs +21 -22
- package/dist/esm/cli/is/config.mjs +2 -2
- package/dist/esm/cli/is/index.mjs +4 -4
- package/dist/esm/cli/is/project.mjs +10 -39
- package/dist/esm/cli/monorepo.mjs +1 -1
- package/dist/esm/cli/package.mjs +1 -1
- package/dist/esm/cli/path.mjs +1 -1
- package/dist/esm/cli/port.mjs +2 -2
- package/dist/esm/cli/prettyInstructions.mjs +3 -3
- package/dist/esm/cli/require.mjs +43 -37
- package/dist/esm/cli/route.mjs +1 -1
- package/dist/esm/cli/watch.mjs +1 -1
- package/dist/esm/compiled.mjs +46 -111
- package/dist/esm/import.mjs +3 -19
- package/dist/esm/index.mjs +3 -3
- package/dist/esm/universal/index.mjs +1 -1
- package/dist/esm-node/cli/alias.mjs +1 -0
- package/dist/esm-node/cli/applyOptionsChain.mjs +1 -0
- package/dist/esm-node/cli/commands.mjs +1 -0
- package/dist/esm-node/cli/common.mjs +3 -4
- package/dist/esm-node/cli/config.mjs +1 -0
- package/dist/esm-node/cli/constants.mjs +1 -0
- package/dist/esm-node/cli/ensure.mjs +1 -0
- package/dist/esm-node/cli/fs.mjs +1 -0
- package/dist/esm-node/cli/get/config.mjs +1 -0
- package/dist/esm-node/cli/get/data.mjs +3 -11
- package/dist/esm-node/cli/get/index.mjs +1 -0
- package/dist/esm-node/cli/index.mjs +1 -1
- package/dist/esm-node/cli/is/config.mjs +1 -0
- package/dist/esm-node/cli/is/env.mjs +1 -0
- package/dist/esm-node/cli/is/index.mjs +1 -0
- package/dist/esm-node/cli/is/project.mjs +7 -35
- package/dist/esm-node/cli/is/type.mjs +1 -0
- package/dist/esm-node/cli/logger.mjs +1 -0
- package/dist/esm-node/cli/monorepo.mjs +1 -0
- package/dist/esm-node/cli/package.mjs +1 -0
- package/dist/esm-node/cli/path.mjs +1 -0
- package/dist/esm-node/cli/port.mjs +1 -0
- package/dist/esm-node/cli/prettyInstructions.mjs +1 -0
- package/dist/esm-node/cli/require.mjs +43 -36
- package/dist/esm-node/cli/route.mjs +1 -0
- package/dist/esm-node/cli/runtimeExports.mjs +1 -0
- package/dist/esm-node/cli/version.mjs +1 -0
- package/dist/esm-node/cli/watch.mjs +1 -0
- package/dist/esm-node/compiled.mjs +38 -113
- package/dist/esm-node/import.mjs +4 -19
- package/dist/esm-node/index.mjs +1 -0
- package/dist/esm-node/universal/constants.mjs +1 -0
- package/dist/esm-node/universal/index.mjs +1 -0
- package/dist/esm-node/universal/path.mjs +1 -0
- package/dist/esm-node/universal/pluginDagSort.mjs +1 -0
- package/dist/types/cli/common.d.ts +2 -1
- package/dist/types/cli/get/data.d.ts +0 -2
- package/dist/types/cli/index.d.ts +0 -1
- package/dist/types/cli/require.d.ts +1 -13
- package/dist/types/compiled.d.ts +2 -1
- package/dist/types/import.d.ts +2 -2
- package/package.json +38 -58
- package/rslib.config.mts +49 -26
- package/rstest.config.ts +8 -0
- package/dist/cjs/cli/babel.js +0 -113
- package/dist/esm/cli/babel.mjs +0 -76
- package/dist/esm-node/cli/babel.mjs +0 -76
- package/dist/types/cli/babel.d.ts +0 -3
package/dist/cjs/cli/common.js
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
3
12
|
(()=>{
|
|
4
13
|
__webpack_require__.d = (exports1, definition)=>{
|
|
5
14
|
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
@@ -28,8 +37,9 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
28
37
|
wait: ()=>wait,
|
|
29
38
|
createDebugger: ()=>createDebugger
|
|
30
39
|
});
|
|
31
|
-
const
|
|
32
|
-
|
|
40
|
+
const index_js_namespaceObject = require("../../compiled/debug/index.js");
|
|
41
|
+
var index_js_default = /*#__PURE__*/ __webpack_require__.n(index_js_namespaceObject);
|
|
42
|
+
const createDebugger = (scope)=>index_js_default()(`modern-js:${scope}`);
|
|
33
43
|
const clearConsole = ()=>{
|
|
34
44
|
if (process.stdout.isTTY && !process.env.DEBUG) process.stdout.write('\x1B[H\x1B[2J');
|
|
35
45
|
};
|
package/dist/cjs/cli/get/data.js
CHANGED
|
@@ -35,9 +35,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
35
35
|
__webpack_require__.d(__webpack_exports__, {
|
|
36
36
|
getPackageManager: ()=>getPackageManager,
|
|
37
37
|
getCoreJsVersion: ()=>getCoreJsVersion,
|
|
38
|
-
getBrowserslist: ()=>getBrowserslist,
|
|
39
38
|
getInternalPlugins: ()=>getInternalPlugins,
|
|
40
|
-
defaults: ()=>defaults,
|
|
41
39
|
readTsConfig: ()=>readTsConfig,
|
|
42
40
|
readTsConfigByFile: ()=>readTsConfigByFile
|
|
43
41
|
});
|
|
@@ -72,15 +70,6 @@ const getCoreJsVersion = (corejsPkgPath)=>{
|
|
|
72
70
|
return '3';
|
|
73
71
|
}
|
|
74
72
|
};
|
|
75
|
-
const defaults = [
|
|
76
|
-
'chrome >= 87',
|
|
77
|
-
'edge >= 88',
|
|
78
|
-
'firefox >= 78',
|
|
79
|
-
'safari >= 14'
|
|
80
|
-
];
|
|
81
|
-
const getBrowserslist = (appDirectory)=>external_compiled_js_namespaceObject.browserslist.loadConfig({
|
|
82
|
-
path: appDirectory
|
|
83
|
-
}) || defaults;
|
|
84
73
|
function getInternalPlugins(appDirectory, internalPlugins = {}) {
|
|
85
74
|
return [
|
|
86
75
|
...Object.keys(internalPlugins).filter((name)=>{
|
|
@@ -99,16 +88,12 @@ const readTsConfigByFile = (filename)=>{
|
|
|
99
88
|
const content = external_compiled_js_namespaceObject.fs.readFileSync(external_path_default().resolve(filename), 'utf-8');
|
|
100
89
|
return external_compiled_js_namespaceObject.json5.parse(content);
|
|
101
90
|
};
|
|
102
|
-
exports.defaults = __webpack_exports__.defaults;
|
|
103
|
-
exports.getBrowserslist = __webpack_exports__.getBrowserslist;
|
|
104
91
|
exports.getCoreJsVersion = __webpack_exports__.getCoreJsVersion;
|
|
105
92
|
exports.getInternalPlugins = __webpack_exports__.getInternalPlugins;
|
|
106
93
|
exports.getPackageManager = __webpack_exports__.getPackageManager;
|
|
107
94
|
exports.readTsConfig = __webpack_exports__.readTsConfig;
|
|
108
95
|
exports.readTsConfigByFile = __webpack_exports__.readTsConfigByFile;
|
|
109
96
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
110
|
-
"defaults",
|
|
111
|
-
"getBrowserslist",
|
|
112
97
|
"getCoreJsVersion",
|
|
113
98
|
"getInternalPlugins",
|
|
114
99
|
"getPackageManager",
|
package/dist/cjs/cli/index.js
CHANGED
|
@@ -6,9 +6,6 @@ var __webpack_modules__ = {
|
|
|
6
6
|
"./applyOptionsChain" (module) {
|
|
7
7
|
module.exports = require("./applyOptionsChain.js");
|
|
8
8
|
},
|
|
9
|
-
"./babel" (module) {
|
|
10
|
-
module.exports = require("./babel.js");
|
|
11
|
-
},
|
|
12
9
|
"./commands" (module) {
|
|
13
10
|
module.exports = require("./commands.js");
|
|
14
11
|
},
|
|
@@ -130,73 +127,69 @@ var __webpack_exports__ = {};
|
|
|
130
127
|
var __rspack_reexport = {};
|
|
131
128
|
for(const __rspack_import_key in _applyOptionsChain__rspack_import_4)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_applyOptionsChain__rspack_import_4[__rspack_import_key];
|
|
132
129
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
133
|
-
var
|
|
134
|
-
var __rspack_reexport = {};
|
|
135
|
-
for(const __rspack_import_key in _babel__rspack_import_5)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_babel__rspack_import_5[__rspack_import_key];
|
|
136
|
-
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
137
|
-
var _commands__rspack_import_6 = __webpack_require__("./commands");
|
|
130
|
+
var _commands__rspack_import_5 = __webpack_require__("./commands");
|
|
138
131
|
var __rspack_reexport = {};
|
|
139
|
-
for(const __rspack_import_key in
|
|
132
|
+
for(const __rspack_import_key in _commands__rspack_import_5)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_commands__rspack_import_5[__rspack_import_key];
|
|
140
133
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
141
|
-
var
|
|
134
|
+
var _common__rspack_import_6 = __webpack_require__("./common");
|
|
142
135
|
var __rspack_reexport = {};
|
|
143
|
-
for(const __rspack_import_key in
|
|
136
|
+
for(const __rspack_import_key in _common__rspack_import_6)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_common__rspack_import_6[__rspack_import_key];
|
|
144
137
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
145
|
-
var
|
|
138
|
+
var _ensure__rspack_import_7 = __webpack_require__("./ensure");
|
|
146
139
|
var __rspack_reexport = {};
|
|
147
|
-
for(const __rspack_import_key in
|
|
140
|
+
for(const __rspack_import_key in _ensure__rspack_import_7)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_ensure__rspack_import_7[__rspack_import_key];
|
|
148
141
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
149
|
-
var
|
|
142
|
+
var _fs__rspack_import_8 = __webpack_require__("./fs");
|
|
150
143
|
var __rspack_reexport = {};
|
|
151
|
-
for(const __rspack_import_key in
|
|
144
|
+
for(const __rspack_import_key in _fs__rspack_import_8)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_fs__rspack_import_8[__rspack_import_key];
|
|
152
145
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
153
|
-
var
|
|
146
|
+
var _logger__rspack_import_9 = __webpack_require__("./logger");
|
|
154
147
|
var __rspack_reexport = {};
|
|
155
|
-
for(const __rspack_import_key in
|
|
148
|
+
for(const __rspack_import_key in _logger__rspack_import_9)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_logger__rspack_import_9[__rspack_import_key];
|
|
156
149
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
157
|
-
var
|
|
150
|
+
var _monorepo__rspack_import_10 = __webpack_require__("./monorepo");
|
|
158
151
|
var __rspack_reexport = {};
|
|
159
|
-
for(const __rspack_import_key in
|
|
152
|
+
for(const __rspack_import_key in _monorepo__rspack_import_10)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_monorepo__rspack_import_10[__rspack_import_key];
|
|
160
153
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
161
|
-
var
|
|
154
|
+
var _package__rspack_import_11 = __webpack_require__("./package");
|
|
162
155
|
var __rspack_reexport = {};
|
|
163
|
-
for(const __rspack_import_key in
|
|
156
|
+
for(const __rspack_import_key in _package__rspack_import_11)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_package__rspack_import_11[__rspack_import_key];
|
|
164
157
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
165
|
-
var
|
|
158
|
+
var _path__rspack_import_12 = __webpack_require__("./path");
|
|
166
159
|
var __rspack_reexport = {};
|
|
167
|
-
for(const __rspack_import_key in
|
|
160
|
+
for(const __rspack_import_key in _path__rspack_import_12)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_path__rspack_import_12[__rspack_import_key];
|
|
168
161
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
169
|
-
var
|
|
162
|
+
var _port__rspack_import_13 = __webpack_require__("./port");
|
|
170
163
|
var __rspack_reexport = {};
|
|
171
|
-
for(const __rspack_import_key in
|
|
164
|
+
for(const __rspack_import_key in _port__rspack_import_13)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_port__rspack_import_13[__rspack_import_key];
|
|
172
165
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
173
|
-
var
|
|
166
|
+
var _prettyInstructions__rspack_import_14 = __webpack_require__("./prettyInstructions");
|
|
174
167
|
var __rspack_reexport = {};
|
|
175
|
-
for(const __rspack_import_key in
|
|
168
|
+
for(const __rspack_import_key in _prettyInstructions__rspack_import_14)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_prettyInstructions__rspack_import_14[__rspack_import_key];
|
|
176
169
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
177
|
-
var
|
|
170
|
+
var _require__rspack_import_15 = __webpack_require__("./require");
|
|
178
171
|
var __rspack_reexport = {};
|
|
179
|
-
for(const __rspack_import_key in
|
|
172
|
+
for(const __rspack_import_key in _require__rspack_import_15)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_require__rspack_import_15[__rspack_import_key];
|
|
180
173
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
181
|
-
var
|
|
174
|
+
var _runtimeExports__rspack_import_16 = __webpack_require__("./runtimeExports");
|
|
182
175
|
var __rspack_reexport = {};
|
|
183
|
-
for(const __rspack_import_key in
|
|
176
|
+
for(const __rspack_import_key in _runtimeExports__rspack_import_16)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_runtimeExports__rspack_import_16[__rspack_import_key];
|
|
184
177
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
185
|
-
var
|
|
178
|
+
var _watch__rspack_import_17 = __webpack_require__("./watch");
|
|
186
179
|
var __rspack_reexport = {};
|
|
187
|
-
for(const __rspack_import_key in
|
|
180
|
+
for(const __rspack_import_key in _watch__rspack_import_17)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_watch__rspack_import_17[__rspack_import_key];
|
|
188
181
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
189
|
-
var
|
|
182
|
+
var _config__rspack_import_18 = __webpack_require__("./config");
|
|
190
183
|
var __rspack_reexport = {};
|
|
191
|
-
for(const __rspack_import_key in
|
|
184
|
+
for(const __rspack_import_key in _config__rspack_import_18)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_config__rspack_import_18[__rspack_import_key];
|
|
192
185
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
193
|
-
var
|
|
186
|
+
var _version__rspack_import_19 = __webpack_require__("./version");
|
|
194
187
|
var __rspack_reexport = {};
|
|
195
|
-
for(const __rspack_import_key in
|
|
188
|
+
for(const __rspack_import_key in _version__rspack_import_19)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_version__rspack_import_19[__rspack_import_key];
|
|
196
189
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
197
|
-
var
|
|
190
|
+
var _route__rspack_import_20 = __webpack_require__("./route");
|
|
198
191
|
var __rspack_reexport = {};
|
|
199
|
-
for(const __rspack_import_key in
|
|
192
|
+
for(const __rspack_import_key in _route__rspack_import_20)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_route__rspack_import_20[__rspack_import_key];
|
|
200
193
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
201
194
|
})();
|
|
202
195
|
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
@@ -46,12 +46,13 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
46
46
|
});
|
|
47
47
|
const external_path_namespaceObject = require("path");
|
|
48
48
|
var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
|
|
49
|
-
const
|
|
50
|
-
var
|
|
49
|
+
const index_js_namespaceObject = require("../../../compiled/pkg-up/index.js");
|
|
50
|
+
var index_js_default = /*#__PURE__*/ __webpack_require__.n(index_js_namespaceObject);
|
|
51
51
|
const external_compiled_js_namespaceObject = require("../../compiled.js");
|
|
52
52
|
const external_commands_js_namespaceObject = require("../commands.js");
|
|
53
53
|
const external_common_js_namespaceObject = require("../common.js");
|
|
54
54
|
const external_ensure_js_namespaceObject = require("../ensure.js");
|
|
55
|
+
const external_require_js_namespaceObject = require("../require.js");
|
|
55
56
|
const debug = (0, external_common_js_namespaceObject.createDebugger)('judge-depExists');
|
|
56
57
|
const isDepExists = (appDirectory, name)=>{
|
|
57
58
|
const pkgPath = external_path_default().resolve(appDirectory, './package.json');
|
|
@@ -59,15 +60,13 @@ const isDepExists = (appDirectory, name)=>{
|
|
|
59
60
|
debug("can't find package.json under: %s", appDirectory);
|
|
60
61
|
return false;
|
|
61
62
|
}
|
|
62
|
-
const json =
|
|
63
|
+
const json = external_compiled_js_namespaceObject.fs.readJSONSync(pkgPath);
|
|
63
64
|
const { dependencies = {}, devDependencies = {} } = json;
|
|
64
65
|
return dependencies.hasOwnProperty(name) || devDependencies.hasOwnProperty(name);
|
|
65
66
|
};
|
|
66
67
|
const isPackageInstalled = (name, resolvePaths)=>{
|
|
67
68
|
try {
|
|
68
|
-
|
|
69
|
-
paths: (0, external_ensure_js_namespaceObject.ensureArray)(resolvePaths)
|
|
70
|
-
});
|
|
69
|
+
(0, external_require_js_namespaceObject.tryResolve)(name, ...(0, external_ensure_js_namespaceObject.ensureArray)(resolvePaths));
|
|
71
70
|
return true;
|
|
72
71
|
} catch (err) {
|
|
73
72
|
return false;
|
|
@@ -86,7 +85,7 @@ const isWebOnly = async ()=>{
|
|
|
86
85
|
};
|
|
87
86
|
const isVersionBeyond17 = (version)=>external_compiled_js_namespaceObject.semver.gte(external_compiled_js_namespaceObject.semver.minVersion(version), '17.0.0');
|
|
88
87
|
const getReactVersion = (cwd)=>{
|
|
89
|
-
const pkgPath =
|
|
88
|
+
const pkgPath = index_js_default().sync({
|
|
90
89
|
cwd
|
|
91
90
|
});
|
|
92
91
|
if (!pkgPath) return false;
|
|
@@ -97,11 +96,7 @@ const getReactVersion = (cwd)=>{
|
|
|
97
96
|
};
|
|
98
97
|
if ('string' != typeof deps.react) return false;
|
|
99
98
|
try {
|
|
100
|
-
const reactPath =
|
|
101
|
-
paths: [
|
|
102
|
-
cwd
|
|
103
|
-
]
|
|
104
|
-
});
|
|
99
|
+
const reactPath = (0, external_require_js_namespaceObject.tryResolve)('react/package.json', cwd);
|
|
105
100
|
const reactVersion = JSON.parse(external_compiled_js_namespaceObject.fs.readFileSync(reactPath, 'utf8')).version;
|
|
106
101
|
return reactVersion;
|
|
107
102
|
} catch (error) {
|
package/dist/cjs/cli/require.js
CHANGED
|
@@ -26,32 +26,46 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
27
|
compatibleRequire: ()=>compatibleRequire,
|
|
28
28
|
dynamicImport: ()=>dynamicImport,
|
|
29
|
-
loadFromProject: ()=>loadFromProject,
|
|
30
29
|
requireExistModule: ()=>requireExistModule,
|
|
31
30
|
tryResolve: ()=>tryResolve,
|
|
32
31
|
cleanRequireCache: ()=>cleanRequireCache,
|
|
33
|
-
|
|
32
|
+
loadFromProject: ()=>loadFromProject
|
|
34
33
|
});
|
|
35
34
|
const external_node_path_namespaceObject = require("node:path");
|
|
36
35
|
const external_node_url_namespaceObject = require("node:url");
|
|
37
36
|
const external_fs_js_namespaceObject = require("./fs.js");
|
|
38
|
-
async function
|
|
37
|
+
async function importPath(path, options) {
|
|
38
|
+
const modulePath = (0, external_node_path_namespaceObject.isAbsolute)(path) ? (0, external_node_url_namespaceObject.pathToFileURL)(path).href : path;
|
|
39
|
+
if ('development' !== process.env.NODE_ENV) return await import(modulePath, options);
|
|
40
|
+
{
|
|
41
|
+
const timestamp = Date.now();
|
|
42
|
+
return await import(`${modulePath}?t=${timestamp}`, options);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async function compatibleRequireESM(path, interop = true) {
|
|
46
|
+
if (path.endsWith('.json')) {
|
|
47
|
+
const res = await importPath(path, {
|
|
48
|
+
with: {
|
|
49
|
+
type: 'json'
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
return res.default;
|
|
53
|
+
}
|
|
54
|
+
const requiredModule = await importPath(path);
|
|
55
|
+
return interop ? requiredModule.default : requiredModule;
|
|
56
|
+
}
|
|
57
|
+
async function compatibleRequireCJS(path, interop = true) {
|
|
39
58
|
if (path.endsWith('.json')) return require(path);
|
|
40
|
-
let requiredModule;
|
|
41
59
|
try {
|
|
42
|
-
requiredModule = require(path);
|
|
60
|
+
const requiredModule = require(path);
|
|
61
|
+
return interop && requiredModule?.__esModule ? requiredModule.default : requiredModule;
|
|
43
62
|
} catch (err) {
|
|
44
|
-
if ('ERR_REQUIRE_ESM' === err.code)
|
|
45
|
-
const modulePath = (0, external_node_path_namespaceObject.isAbsolute)(path) ? (0, external_node_url_namespaceObject.pathToFileURL)(path).href : path;
|
|
46
|
-
if ('development' === process.env.NODE_ENV) {
|
|
47
|
-
const timestamp = Date.now();
|
|
48
|
-
requiredModule = await import(`${modulePath}?t=${timestamp}`);
|
|
49
|
-
} else requiredModule = await import(modulePath);
|
|
50
|
-
return interop ? requiredModule.default : requiredModule;
|
|
51
|
-
}
|
|
63
|
+
if ('ERR_REQUIRE_ESM' === err.code) return await compatibleRequireESM(path, interop);
|
|
52
64
|
throw err;
|
|
53
65
|
}
|
|
54
|
-
|
|
66
|
+
}
|
|
67
|
+
async function compatibleRequire(path, interop = true) {
|
|
68
|
+
return await compatibleRequireCJS(path, interop);
|
|
55
69
|
}
|
|
56
70
|
async function loadFromProject(moduleName, appDir) {
|
|
57
71
|
let requiredModule;
|
|
@@ -60,12 +74,8 @@ async function loadFromProject(moduleName, appDir) {
|
|
|
60
74
|
process.cwd()
|
|
61
75
|
];
|
|
62
76
|
try {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
paths
|
|
66
|
-
});
|
|
67
|
-
requiredModule = require(modulePath);
|
|
68
|
-
}
|
|
77
|
+
const modulePath = tryResolve(moduleName, ...paths);
|
|
78
|
+
requiredModule = require(modulePath);
|
|
69
79
|
return requiredModule.default || requiredModule;
|
|
70
80
|
} catch (error) {
|
|
71
81
|
if ('MODULE_NOT_FOUND' === error.code) throw new Error(`Cannot find module ${moduleName}.`);
|
|
@@ -91,17 +101,11 @@ const cleanRequireCache = (filelist)=>{
|
|
|
91
101
|
if (require.cache) delete require.cache[filepath];
|
|
92
102
|
});
|
|
93
103
|
};
|
|
94
|
-
|
|
95
|
-
if (require.cache[path]) delete require.cache[path];
|
|
96
|
-
if (module.children) module.children = module.children.filter((item)=>item.filename !== path);
|
|
97
|
-
}
|
|
98
|
-
const tryResolve = (name, resolvePath)=>{
|
|
104
|
+
const tryResolve = (name, ...resolvePath)=>{
|
|
99
105
|
let filePath = '';
|
|
100
106
|
try {
|
|
101
107
|
filePath = require.resolve(name, {
|
|
102
|
-
paths:
|
|
103
|
-
resolvePath
|
|
104
|
-
]
|
|
108
|
+
paths: resolvePath
|
|
105
109
|
});
|
|
106
110
|
delete require.cache[filePath];
|
|
107
111
|
} catch (err) {
|
|
@@ -112,7 +116,6 @@ const tryResolve = (name, resolvePath)=>{
|
|
|
112
116
|
};
|
|
113
117
|
exports.cleanRequireCache = __webpack_exports__.cleanRequireCache;
|
|
114
118
|
exports.compatibleRequire = __webpack_exports__.compatibleRequire;
|
|
115
|
-
exports.deleteRequireCache = __webpack_exports__.deleteRequireCache;
|
|
116
119
|
exports.dynamicImport = __webpack_exports__.dynamicImport;
|
|
117
120
|
exports.loadFromProject = __webpack_exports__.loadFromProject;
|
|
118
121
|
exports.requireExistModule = __webpack_exports__.requireExistModule;
|
|
@@ -120,7 +123,6 @@ exports.tryResolve = __webpack_exports__.tryResolve;
|
|
|
120
123
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
121
124
|
"cleanRequireCache",
|
|
122
125
|
"compatibleRequire",
|
|
123
|
-
"deleteRequireCache",
|
|
124
126
|
"dynamicImport",
|
|
125
127
|
"loadFromProject",
|
|
126
128
|
"requireExistModule",
|
package/dist/cjs/compiled.js
CHANGED
|
@@ -36,101 +36,102 @@ var __webpack_require__ = {};
|
|
|
36
36
|
var __webpack_exports__ = {};
|
|
37
37
|
__webpack_require__.r(__webpack_exports__);
|
|
38
38
|
__webpack_require__.d(__webpack_exports__, {
|
|
39
|
-
urlJoin: ()=>
|
|
40
|
-
stripAnsi: ()=>
|
|
41
|
-
gzipSize: ()=>
|
|
39
|
+
urlJoin: ()=>url_join_index_js_default(),
|
|
40
|
+
stripAnsi: ()=>strip_ansi_index_js_default(),
|
|
41
|
+
gzipSize: ()=>gzip_size_index_js_default(),
|
|
42
42
|
inquirer: ()=>inquirer,
|
|
43
|
-
dotenvExpand: ()=>
|
|
44
|
-
nanoid: ()=>
|
|
45
|
-
signale: ()=>
|
|
46
|
-
chalk: ()=>
|
|
47
|
-
glob: ()=>
|
|
48
|
-
json5: ()=>
|
|
43
|
+
dotenvExpand: ()=>dotenv_expand_index_js_default(),
|
|
44
|
+
nanoid: ()=>nanoid_index_js_namespaceObject.nanoid,
|
|
45
|
+
signale: ()=>signale_index_js_default(),
|
|
46
|
+
chalk: ()=>chalk_index_js_default(),
|
|
47
|
+
glob: ()=>glob_index_js_default(),
|
|
48
|
+
json5: ()=>json5_index_js_default(),
|
|
49
49
|
chokidar: ()=>chokidar,
|
|
50
|
-
slash: ()=>
|
|
51
|
-
filesize: ()=>
|
|
52
|
-
lodash: ()=>
|
|
53
|
-
Command: ()=>
|
|
54
|
-
address: ()=>
|
|
55
|
-
debug: ()=>
|
|
56
|
-
yaml: ()=>
|
|
57
|
-
ora: ()=>
|
|
58
|
-
browserslist: ()=>
|
|
59
|
-
globby: ()=>
|
|
60
|
-
pkgUp: ()=>
|
|
61
|
-
fs: ()=>
|
|
62
|
-
program: ()=>
|
|
63
|
-
minimist: ()=>
|
|
64
|
-
upath: ()=>
|
|
65
|
-
semver: ()=>
|
|
66
|
-
Signale: ()=>
|
|
67
|
-
fastGlob: ()=>
|
|
68
|
-
dotenv: ()=>
|
|
50
|
+
slash: ()=>slash_index_js_default(),
|
|
51
|
+
filesize: ()=>filesize_index_js_default(),
|
|
52
|
+
lodash: ()=>lodash_index_js_default(),
|
|
53
|
+
Command: ()=>commander_index_js_namespaceObject.Command,
|
|
54
|
+
address: ()=>address_index_js_default(),
|
|
55
|
+
debug: ()=>debug_index_js_default(),
|
|
56
|
+
yaml: ()=>js_yaml_index_js_default(),
|
|
57
|
+
ora: ()=>ora_index_js_default(),
|
|
58
|
+
browserslist: ()=>browserslist_index_js_default(),
|
|
59
|
+
globby: ()=>globby_index_js_default(),
|
|
60
|
+
pkgUp: ()=>pkg_up_index_js_default(),
|
|
61
|
+
fs: ()=>index_js_default(),
|
|
62
|
+
program: ()=>commander_index_js_namespaceObject.program,
|
|
63
|
+
minimist: ()=>minimist_index_js_default(),
|
|
64
|
+
upath: ()=>upath_index_js_default(),
|
|
65
|
+
semver: ()=>semver_index_js_default(),
|
|
66
|
+
Signale: ()=>Signale,
|
|
67
|
+
fastGlob: ()=>fast_glob_index_js_default(),
|
|
68
|
+
dotenv: ()=>dotenv_index_js_default(),
|
|
69
69
|
mime: ()=>mime,
|
|
70
|
-
execa: ()=>
|
|
70
|
+
execa: ()=>execa_index_js_default()
|
|
71
71
|
});
|
|
72
72
|
const external_node_module_namespaceObject = require("node:module");
|
|
73
73
|
const external_import_js_namespaceObject = require("./import.js");
|
|
74
|
-
const
|
|
75
|
-
var
|
|
76
|
-
const
|
|
77
|
-
var
|
|
78
|
-
const
|
|
79
|
-
var
|
|
80
|
-
const
|
|
81
|
-
var
|
|
82
|
-
const
|
|
83
|
-
var
|
|
84
|
-
const
|
|
85
|
-
var
|
|
86
|
-
const
|
|
87
|
-
var
|
|
88
|
-
const
|
|
89
|
-
var
|
|
90
|
-
const
|
|
91
|
-
var
|
|
92
|
-
const
|
|
93
|
-
var
|
|
94
|
-
const
|
|
95
|
-
var
|
|
96
|
-
const
|
|
97
|
-
const
|
|
98
|
-
var
|
|
99
|
-
const
|
|
100
|
-
var
|
|
101
|
-
const
|
|
102
|
-
var
|
|
103
|
-
const
|
|
104
|
-
var
|
|
105
|
-
const
|
|
106
|
-
var
|
|
107
|
-
const
|
|
108
|
-
var
|
|
109
|
-
const
|
|
110
|
-
var
|
|
111
|
-
const
|
|
112
|
-
var
|
|
113
|
-
const
|
|
114
|
-
var
|
|
115
|
-
const
|
|
116
|
-
var
|
|
117
|
-
const
|
|
118
|
-
var
|
|
119
|
-
const
|
|
120
|
-
var
|
|
121
|
-
const
|
|
122
|
-
var
|
|
123
|
-
const
|
|
124
|
-
var
|
|
125
|
-
const
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
if ('function' == typeof
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const
|
|
133
|
-
const
|
|
74
|
+
const index_js_namespaceObject = require("../compiled/fs-extra/index.js");
|
|
75
|
+
var index_js_default = /*#__PURE__*/ __webpack_require__.n(index_js_namespaceObject);
|
|
76
|
+
const ora_index_js_namespaceObject = require("../compiled/ora/index.js");
|
|
77
|
+
var ora_index_js_default = /*#__PURE__*/ __webpack_require__.n(ora_index_js_namespaceObject);
|
|
78
|
+
const glob_index_js_namespaceObject = require("../compiled/glob/index.js");
|
|
79
|
+
var glob_index_js_default = /*#__PURE__*/ __webpack_require__.n(glob_index_js_namespaceObject);
|
|
80
|
+
const js_yaml_index_js_namespaceObject = require("../compiled/js-yaml/index.js");
|
|
81
|
+
var js_yaml_index_js_default = /*#__PURE__*/ __webpack_require__.n(js_yaml_index_js_namespaceObject);
|
|
82
|
+
const chalk_index_js_namespaceObject = require("../compiled/chalk/index.js");
|
|
83
|
+
var chalk_index_js_default = /*#__PURE__*/ __webpack_require__.n(chalk_index_js_namespaceObject);
|
|
84
|
+
const debug_index_js_namespaceObject = require("../compiled/debug/index.js");
|
|
85
|
+
var debug_index_js_default = /*#__PURE__*/ __webpack_require__.n(debug_index_js_namespaceObject);
|
|
86
|
+
const slash_index_js_namespaceObject = require("../compiled/slash/index.js");
|
|
87
|
+
var slash_index_js_default = /*#__PURE__*/ __webpack_require__.n(slash_index_js_namespaceObject);
|
|
88
|
+
const execa_index_js_namespaceObject = require("../compiled/execa/index.js");
|
|
89
|
+
var execa_index_js_default = /*#__PURE__*/ __webpack_require__.n(execa_index_js_namespaceObject);
|
|
90
|
+
const json5_index_js_namespaceObject = require("../compiled/json5/index.js");
|
|
91
|
+
var json5_index_js_default = /*#__PURE__*/ __webpack_require__.n(json5_index_js_namespaceObject);
|
|
92
|
+
const upath_index_js_namespaceObject = require("../compiled/upath/index.js");
|
|
93
|
+
var upath_index_js_default = /*#__PURE__*/ __webpack_require__.n(upath_index_js_namespaceObject);
|
|
94
|
+
const pkg_up_index_js_namespaceObject = require("../compiled/pkg-up/index.js");
|
|
95
|
+
var pkg_up_index_js_default = /*#__PURE__*/ __webpack_require__.n(pkg_up_index_js_namespaceObject);
|
|
96
|
+
const nanoid_index_js_namespaceObject = require("../compiled/nanoid/index.js");
|
|
97
|
+
const semver_index_js_namespaceObject = require("../compiled/semver/index.js");
|
|
98
|
+
var semver_index_js_default = /*#__PURE__*/ __webpack_require__.n(semver_index_js_namespaceObject);
|
|
99
|
+
const dotenv_index_js_namespaceObject = require("../compiled/dotenv/index.js");
|
|
100
|
+
var dotenv_index_js_default = /*#__PURE__*/ __webpack_require__.n(dotenv_index_js_namespaceObject);
|
|
101
|
+
const lodash_index_js_namespaceObject = require("../compiled/lodash/index.js");
|
|
102
|
+
var lodash_index_js_default = /*#__PURE__*/ __webpack_require__.n(lodash_index_js_namespaceObject);
|
|
103
|
+
const globby_index_js_namespaceObject = require("../compiled/globby/index.js");
|
|
104
|
+
var globby_index_js_default = /*#__PURE__*/ __webpack_require__.n(globby_index_js_namespaceObject);
|
|
105
|
+
const address_index_js_namespaceObject = require("../compiled/address/index.js");
|
|
106
|
+
var address_index_js_default = /*#__PURE__*/ __webpack_require__.n(address_index_js_namespaceObject);
|
|
107
|
+
const signale_index_js_namespaceObject = require("../compiled/signale/index.js");
|
|
108
|
+
var signale_index_js_default = /*#__PURE__*/ __webpack_require__.n(signale_index_js_namespaceObject);
|
|
109
|
+
const url_join_index_js_namespaceObject = require("../compiled/url-join/index.js");
|
|
110
|
+
var url_join_index_js_default = /*#__PURE__*/ __webpack_require__.n(url_join_index_js_namespaceObject);
|
|
111
|
+
const minimist_index_js_namespaceObject = require("../compiled/minimist/index.js");
|
|
112
|
+
var minimist_index_js_default = /*#__PURE__*/ __webpack_require__.n(minimist_index_js_namespaceObject);
|
|
113
|
+
const fast_glob_index_js_namespaceObject = require("../compiled/fast-glob/index.js");
|
|
114
|
+
var fast_glob_index_js_default = /*#__PURE__*/ __webpack_require__.n(fast_glob_index_js_namespaceObject);
|
|
115
|
+
const filesize_index_js_namespaceObject = require("../compiled/filesize/index.js");
|
|
116
|
+
var filesize_index_js_default = /*#__PURE__*/ __webpack_require__.n(filesize_index_js_namespaceObject);
|
|
117
|
+
const gzip_size_index_js_namespaceObject = require("../compiled/gzip-size/index.js");
|
|
118
|
+
var gzip_size_index_js_default = /*#__PURE__*/ __webpack_require__.n(gzip_size_index_js_namespaceObject);
|
|
119
|
+
const strip_ansi_index_js_namespaceObject = require("../compiled/strip-ansi/index.js");
|
|
120
|
+
var strip_ansi_index_js_default = /*#__PURE__*/ __webpack_require__.n(strip_ansi_index_js_namespaceObject);
|
|
121
|
+
const dotenv_expand_index_js_namespaceObject = require("../compiled/dotenv-expand/index.js");
|
|
122
|
+
var dotenv_expand_index_js_default = /*#__PURE__*/ __webpack_require__.n(dotenv_expand_index_js_namespaceObject);
|
|
123
|
+
const browserslist_index_js_namespaceObject = require("../compiled/browserslist/index.js");
|
|
124
|
+
var browserslist_index_js_default = /*#__PURE__*/ __webpack_require__.n(browserslist_index_js_namespaceObject);
|
|
125
|
+
const commander_index_js_namespaceObject = require("../compiled/commander/index.js");
|
|
126
|
+
const { Signale } = signale_index_js_default();
|
|
127
|
+
const getNodeRequire = ()=>{
|
|
128
|
+
if ('object' == typeof global && 'function' == typeof global.require) return global.require;
|
|
129
|
+
if ('object' == typeof globalThis && 'function' == typeof globalThis.require) return globalThis.require;
|
|
130
|
+
return /*#__PURE__*/ (0, external_node_module_namespaceObject.createRequire)(__rslib_import_meta_url__);
|
|
131
|
+
};
|
|
132
|
+
const mime = external_import_js_namespaceObject.Import.lazy('../compiled/mime-types', getNodeRequire);
|
|
133
|
+
const chokidar = external_import_js_namespaceObject.Import.lazy('../compiled/chokidar', getNodeRequire);
|
|
134
|
+
const inquirer = external_import_js_namespaceObject.Import.lazy('../compiled/inquirer', getNodeRequire);
|
|
134
135
|
exports.Command = __webpack_exports__.Command;
|
|
135
136
|
exports.Signale = __webpack_exports__.Signale;
|
|
136
137
|
exports.address = __webpack_exports__.address;
|
package/dist/cjs/import.js
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
11
|
-
var module = __webpack_module_cache__[moduleId] = {
|
|
12
|
-
exports: {}
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
13
10
|
};
|
|
14
|
-
|
|
15
|
-
return module.exports;
|
|
16
|
-
}
|
|
11
|
+
})();
|
|
17
12
|
(()=>{
|
|
18
13
|
__webpack_require__.d = (exports1, definition)=>{
|
|
19
14
|
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
@@ -36,20 +31,20 @@ function __webpack_require__(moduleId) {
|
|
|
36
31
|
};
|
|
37
32
|
})();
|
|
38
33
|
var __webpack_exports__ = {};
|
|
39
|
-
(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
Import: ()=>Import,
|
|
37
|
+
lazyImport: ()=>lazy
|
|
38
|
+
});
|
|
39
|
+
const index_js_namespaceObject = require("../compiled/import-lazy/index.js");
|
|
40
|
+
var index_js_default = /*#__PURE__*/ __webpack_require__.n(index_js_namespaceObject);
|
|
41
|
+
const lazy = (moduleName, getRequireFn)=>{
|
|
42
|
+
const importLazyLocal = index_js_default()(getRequireFn());
|
|
43
|
+
return importLazyLocal(moduleName);
|
|
44
|
+
};
|
|
45
|
+
const Import = {
|
|
46
|
+
lazy
|
|
47
|
+
};
|
|
53
48
|
exports.Import = __webpack_exports__.Import;
|
|
54
49
|
exports.lazyImport = __webpack_exports__.lazyImport;
|
|
55
50
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|