@modern-js/utils 2.35.0 → 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 +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
@@ -1,30 +1,44 @@
|
|
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 getAddressUrls;
|
15
|
-
},
|
16
|
-
prettyInstructions: function() {
|
17
|
-
return prettyInstructions;
|
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 prettyInstructions_exports = {};
|
30
|
+
__export(prettyInstructions_exports, {
|
31
|
+
getAddressUrls: () => getAddressUrls,
|
32
|
+
prettyInstructions: () => prettyInstructions
|
19
33
|
});
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
34
|
+
module.exports = __toCommonJS(prettyInstructions_exports);
|
35
|
+
var import_os = __toESM(require("os"));
|
36
|
+
var import_compiled = require("../compiled");
|
37
|
+
var import_is = require("./is");
|
38
|
+
var import_constants = require("./constants");
|
25
39
|
const normalizeUrl = (url) => url.replace(/([^:]\/)\/+/g, "$1");
|
26
40
|
const getIpv4Interfaces = () => {
|
27
|
-
const interfaces =
|
41
|
+
const interfaces = import_os.default.networkInterfaces();
|
28
42
|
const ipv4Interfaces = [];
|
29
43
|
Object.keys(interfaces).forEach((key) => {
|
30
44
|
interfaces[key].forEach((detail) => {
|
@@ -39,11 +53,8 @@ const getIpv4Interfaces = () => {
|
|
39
53
|
const getAddressUrls = (protocol = "http", port, host) => {
|
40
54
|
const LOCAL_LABEL = "Local: ";
|
41
55
|
const NETWORK_LABEL = "Network: ";
|
42
|
-
const isLocalhost = (url) =>
|
43
|
-
|
44
|
-
return (_url = url) === null || _url === void 0 ? void 0 : _url.includes("localhost");
|
45
|
-
};
|
46
|
-
if (host && host !== _constants.DEFAULT_DEV_HOST) {
|
56
|
+
const isLocalhost = (url) => url === null || url === void 0 ? void 0 : url.includes("localhost");
|
57
|
+
if (host && host !== import_constants.DEFAULT_DEV_HOST) {
|
47
58
|
return [
|
48
59
|
{
|
49
60
|
label: isLocalhost(host) ? LOCAL_LABEL : NETWORK_LABEL,
|
@@ -70,29 +81,34 @@ const getAddressUrls = (protocol = "http", port, host) => {
|
|
70
81
|
const prettyInstructions = (appContext, config) => {
|
71
82
|
var _appContext_builder_context_devServer, _appContext_builder, _config_dev, _config_source;
|
72
83
|
const { entrypoints, serverRoutes, port, apiOnly, checkedEntries } = appContext;
|
73
|
-
const isHttps = (0,
|
84
|
+
const isHttps = (0, import_is.isDev)() && ((_appContext_builder = appContext.builder) === null || _appContext_builder === void 0 ? void 0 : (_appContext_builder_context_devServer = _appContext_builder.context.devServer) === null || _appContext_builder_context_devServer === void 0 ? void 0 : _appContext_builder_context_devServer.https);
|
74
85
|
const urls = getAddressUrls(isHttps ? "https" : "http", port, (_config_dev = config.dev) === null || _config_dev === void 0 ? void 0 : _config_dev.host);
|
75
86
|
const routes = !apiOnly ? serverRoutes.filter((route) => route.entryName) : serverRoutes;
|
76
|
-
let message = "
|
77
|
-
if ((0,
|
78
|
-
message += urls.map(({ label, url }) => ` ${
|
87
|
+
let message = "\n";
|
88
|
+
if ((0, import_is.isSingleEntry)(entrypoints, (_config_source = config.source) === null || _config_source === void 0 ? void 0 : _config_source.mainEntryName) || apiOnly) {
|
89
|
+
message += urls.map(({ label, url }) => ` ${import_compiled.chalk.bold(`> ${label.padEnd(10)}`)}${import_compiled.chalk.cyanBright(normalizeUrl(`${url}/${routes[0].urlPath}`))}
|
79
90
|
`).join("");
|
80
91
|
} else {
|
81
92
|
const maxNameLength = Math.max(...routes.map((r) => r.entryName.length));
|
82
93
|
urls.forEach(({ label, url }) => {
|
83
|
-
message += ` ${
|
94
|
+
message += ` ${import_compiled.chalk.bold(`> ${label}`)}${routes.length === 0 ? import_compiled.chalk.cyanBright(url) : ""}
|
84
95
|
`;
|
85
96
|
routes.forEach(({ entryName, urlPath, isSSR }) => {
|
86
97
|
if (!checkedEntries.includes(entryName)) {
|
87
98
|
return;
|
88
99
|
}
|
89
|
-
message += ` ${
|
100
|
+
message += ` ${import_compiled.chalk.yellowBright(isSSR ? "λ" : "○")} ${import_compiled.chalk.yellowBright(entryName.padEnd(maxNameLength + 8))}${import_compiled.chalk.cyanBright(normalizeUrl(`${url}/${urlPath}`))}
|
90
101
|
`;
|
91
102
|
});
|
92
103
|
});
|
93
104
|
message += "\n";
|
94
|
-
message +=
|
95
|
-
message +=
|
105
|
+
message += import_compiled.chalk.cyanBright(" λ (Server) server-side renders at runtime\n");
|
106
|
+
message += import_compiled.chalk.cyanBright(" ○ (Static) client-side renders as static HTML\n");
|
96
107
|
}
|
97
108
|
return message;
|
98
109
|
};
|
110
|
+
// Annotate the CommonJS export names for ESM import in node:
|
111
|
+
0 && (module.exports = {
|
112
|
+
getAddressUrls,
|
113
|
+
prettyInstructions
|
114
|
+
});
|
package/dist/cjs/cli/require.js
CHANGED
@@ -1,39 +1,35 @@
|
|
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 compatRequire;
|
15
|
-
},
|
16
|
-
dynamicImport: function() {
|
17
|
-
return dynamicImport;
|
18
|
-
},
|
19
|
-
requireExistModule: function() {
|
20
|
-
return requireExistModule;
|
21
|
-
},
|
22
|
-
cleanRequireCache: function() {
|
23
|
-
return cleanRequireCache;
|
24
|
-
},
|
25
|
-
deleteRequireCache: function() {
|
26
|
-
return deleteRequireCache;
|
27
|
-
},
|
28
|
-
tryResolve: function() {
|
29
|
-
return tryResolve;
|
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 });
|
30
15
|
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
var require_exports = {};
|
20
|
+
__export(require_exports, {
|
21
|
+
cleanRequireCache: () => cleanRequireCache,
|
22
|
+
compatRequire: () => compatRequire,
|
23
|
+
deleteRequireCache: () => deleteRequireCache,
|
24
|
+
dynamicImport: () => dynamicImport,
|
25
|
+
requireExistModule: () => requireExistModule,
|
26
|
+
tryResolve: () => tryResolve
|
31
27
|
});
|
32
|
-
|
28
|
+
module.exports = __toCommonJS(require_exports);
|
29
|
+
var import_fs = require("./fs");
|
33
30
|
const compatRequire = (filePath, interop = true) => {
|
34
|
-
var _mod;
|
35
31
|
const mod = require(filePath);
|
36
|
-
const rtnESMDefault = interop && (
|
32
|
+
const rtnESMDefault = interop && (mod === null || mod === void 0 ? void 0 : mod.__esModule);
|
37
33
|
return rtnESMDefault ? mod.default : mod;
|
38
34
|
};
|
39
35
|
const dynamicImport = new Function("modulePath", "return import(modulePath)");
|
@@ -46,7 +42,7 @@ const requireExistModule = (filename, opt) => {
|
|
46
42
|
interop: true,
|
47
43
|
...opt
|
48
44
|
};
|
49
|
-
const exist = (0,
|
45
|
+
const exist = (0, import_fs.findExists)(final.extensions.map((ext) => `${filename}${ext}`));
|
50
46
|
if (!exist) {
|
51
47
|
return null;
|
52
48
|
}
|
@@ -82,3 +78,12 @@ const tryResolve = (name, resolvePath) => {
|
|
82
78
|
}
|
83
79
|
return filePath;
|
84
80
|
};
|
81
|
+
// Annotate the CommonJS export names for ESM import in node:
|
82
|
+
0 && (module.exports = {
|
83
|
+
cleanRequireCache,
|
84
|
+
compatRequire,
|
85
|
+
deleteRequireCache,
|
86
|
+
dynamicImport,
|
87
|
+
requireExistModule,
|
88
|
+
tryResolve
|
89
|
+
});
|
@@ -1,17 +1,39 @@
|
|
1
1
|
"use strict";
|
2
|
-
Object.
|
3
|
-
|
4
|
-
|
5
|
-
Object.
|
6
|
-
|
7
|
-
|
8
|
-
|
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) => {
|
9
|
+
for (var name in all)
|
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 });
|
9
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 runtimeExports_exports = {};
|
30
|
+
__export(runtimeExports_exports, {
|
31
|
+
createRuntimeExportsUtils: () => createRuntimeExportsUtils
|
10
32
|
});
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
33
|
+
module.exports = __toCommonJS(runtimeExports_exports);
|
34
|
+
var import_path = __toESM(require("path"));
|
35
|
+
var import_compiled = require("../compiled");
|
36
|
+
var import_path2 = require("./path");
|
15
37
|
const memo = (fn) => {
|
16
38
|
const cache = /* @__PURE__ */ new Map();
|
17
39
|
return (...params) => {
|
@@ -26,13 +48,13 @@ const memo = (fn) => {
|
|
26
48
|
};
|
27
49
|
};
|
28
50
|
const createRuntimeExportsUtils = memo((pwd = "", namespace = "index") => {
|
29
|
-
const entryExportFile =
|
51
|
+
const entryExportFile = import_path.default.join(pwd, `.runtime-exports/${namespace}.js`);
|
30
52
|
const addExport = (statement) => {
|
31
|
-
statement = (0,
|
53
|
+
statement = (0, import_path2.normalizeOutputPath)(statement);
|
32
54
|
try {
|
33
|
-
|
34
|
-
if (!
|
35
|
-
|
55
|
+
import_compiled.fs.ensureFileSync(entryExportFile);
|
56
|
+
if (!import_compiled.fs.readFileSync(entryExportFile, "utf8").includes(statement)) {
|
57
|
+
import_compiled.fs.appendFileSync(entryExportFile, `${statement}
|
36
58
|
`);
|
37
59
|
}
|
38
60
|
} catch {
|
@@ -44,3 +66,7 @@ const createRuntimeExportsUtils = memo((pwd = "", namespace = "index") => {
|
|
44
66
|
getPath
|
45
67
|
};
|
46
68
|
});
|
69
|
+
// Annotate the CommonJS export names for ESM import in node:
|
70
|
+
0 && (module.exports = {
|
71
|
+
createRuntimeExportsUtils
|
72
|
+
});
|
package/dist/cjs/cli/watch.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 WatchChangeType;
|
15
|
-
},
|
16
|
-
watch: function() {
|
17
|
-
return watch;
|
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 watch_exports = {};
|
30
|
+
__export(watch_exports, {
|
31
|
+
WatchChangeType: () => WatchChangeType,
|
32
|
+
watch: () => watch
|
19
33
|
});
|
20
|
-
|
21
|
-
|
22
|
-
|
34
|
+
module.exports = __toCommonJS(watch_exports);
|
35
|
+
var import_path = __toESM(require("path"));
|
36
|
+
var import_compiled = require("../compiled");
|
23
37
|
const WatchChangeType = {
|
24
38
|
ADD: "add",
|
25
39
|
UNLINK: "unlink",
|
@@ -27,19 +41,19 @@ const WatchChangeType = {
|
|
27
41
|
};
|
28
42
|
const watch = (watchDir, runTask, ignored = []) => {
|
29
43
|
let ready = false;
|
30
|
-
const watcher =
|
44
|
+
const watcher = import_compiled.chokidar.watch(watchDir, {
|
31
45
|
ignored
|
32
46
|
});
|
33
47
|
watcher.on("ready", () => ready = true);
|
34
48
|
watcher.on("change", async (filePath) => {
|
35
|
-
const changedFilePath =
|
49
|
+
const changedFilePath = import_path.default.resolve(filePath);
|
36
50
|
await runTask({
|
37
51
|
changedFilePath,
|
38
52
|
changeType: WatchChangeType.CHANGE
|
39
53
|
});
|
40
54
|
});
|
41
55
|
watcher.on("add", async (filePath) => {
|
42
|
-
const changedFilePath =
|
56
|
+
const changedFilePath = import_path.default.resolve(filePath);
|
43
57
|
if (ready) {
|
44
58
|
await runTask({
|
45
59
|
changedFilePath,
|
@@ -48,7 +62,7 @@ const watch = (watchDir, runTask, ignored = []) => {
|
|
48
62
|
}
|
49
63
|
});
|
50
64
|
watcher.on("unlink", async (filePath) => {
|
51
|
-
const changedFilePath =
|
65
|
+
const changedFilePath = import_path.default.resolve(filePath);
|
52
66
|
await runTask({
|
53
67
|
changedFilePath,
|
54
68
|
changeType: WatchChangeType.UNLINK
|
@@ -59,3 +73,8 @@ const watch = (watchDir, runTask, ignored = []) => {
|
|
59
73
|
});
|
60
74
|
return watcher;
|
61
75
|
};
|
76
|
+
// Annotate the CommonJS export names for ESM import in node:
|
77
|
+
0 && (module.exports = {
|
78
|
+
WatchChangeType,
|
79
|
+
watch
|
80
|
+
});
|
package/dist/cjs/compiled.js
CHANGED
@@ -1,142 +1,131 @@
|
|
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 _fsextra.default;
|
15
|
-
},
|
16
|
-
ora: function() {
|
17
|
-
return _ora.default;
|
18
|
-
},
|
19
|
-
glob: function() {
|
20
|
-
return _glob.default;
|
21
|
-
},
|
22
|
-
yaml: function() {
|
23
|
-
return _jsyaml.default;
|
24
|
-
},
|
25
|
-
chalk: function() {
|
26
|
-
return _chalk.default;
|
27
|
-
},
|
28
|
-
debug: function() {
|
29
|
-
return _debug.default;
|
30
|
-
},
|
31
|
-
slash: function() {
|
32
|
-
return _slash.default;
|
33
|
-
},
|
34
|
-
execa: function() {
|
35
|
-
return _execa.default;
|
36
|
-
},
|
37
|
-
json5: function() {
|
38
|
-
return _json5.default;
|
39
|
-
},
|
40
|
-
upath: function() {
|
41
|
-
return _upath.default;
|
42
|
-
},
|
43
|
-
pkgUp: function() {
|
44
|
-
return _pkgup.default;
|
45
|
-
},
|
46
|
-
nanoid: function() {
|
47
|
-
return _nanoid.nanoid;
|
48
|
-
},
|
49
|
-
semver: function() {
|
50
|
-
return _semver.default;
|
51
|
-
},
|
52
|
-
dotenv: function() {
|
53
|
-
return _dotenv.default;
|
54
|
-
},
|
55
|
-
lodash: function() {
|
56
|
-
return _lodash.default;
|
57
|
-
},
|
58
|
-
globby: function() {
|
59
|
-
return _globby.default;
|
60
|
-
},
|
61
|
-
address: function() {
|
62
|
-
return _address.default;
|
63
|
-
},
|
64
|
-
signale: function() {
|
65
|
-
return _signale.default;
|
66
|
-
},
|
67
|
-
urlJoin: function() {
|
68
|
-
return _urljoin.default;
|
69
|
-
},
|
70
|
-
minimist: function() {
|
71
|
-
return _minimist.default;
|
72
|
-
},
|
73
|
-
fastGlob: function() {
|
74
|
-
return _fastglob.default;
|
75
|
-
},
|
76
|
-
filesize: function() {
|
77
|
-
return _filesize.default;
|
78
|
-
},
|
79
|
-
gzipSize: function() {
|
80
|
-
return _gzipsize.default;
|
81
|
-
},
|
82
|
-
stripAnsi: function() {
|
83
|
-
return _stripansi.default;
|
84
|
-
},
|
85
|
-
dotenvExpand: function() {
|
86
|
-
return _dotenvexpand.default;
|
87
|
-
},
|
88
|
-
browserslist: function() {
|
89
|
-
return _browserslist.default;
|
90
|
-
},
|
91
|
-
program: function() {
|
92
|
-
return _commander.program;
|
93
|
-
},
|
94
|
-
Command: function() {
|
95
|
-
return _commander.Command;
|
96
|
-
},
|
97
|
-
Signale: function() {
|
98
|
-
return _signale.Signale;
|
99
|
-
},
|
100
|
-
mime: function() {
|
101
|
-
return mime;
|
102
|
-
},
|
103
|
-
chokidar: function() {
|
104
|
-
return chokidar;
|
105
|
-
},
|
106
|
-
inquirer: function() {
|
107
|
-
return inquirer;
|
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 });
|
108
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 compiled_exports = {};
|
30
|
+
__export(compiled_exports, {
|
31
|
+
Command: () => import_commander.Command,
|
32
|
+
Signale: () => import_signale2.Signale,
|
33
|
+
address: () => import_address.default,
|
34
|
+
browserslist: () => import_browserslist.default,
|
35
|
+
chalk: () => import_chalk.default,
|
36
|
+
chokidar: () => chokidar,
|
37
|
+
debug: () => import_debug.default,
|
38
|
+
dotenv: () => import_dotenv.default,
|
39
|
+
dotenvExpand: () => import_dotenv_expand.default,
|
40
|
+
execa: () => import_execa.default,
|
41
|
+
fastGlob: () => import_fast_glob.default,
|
42
|
+
filesize: () => import_filesize.default,
|
43
|
+
fs: () => import_fs_extra.default,
|
44
|
+
glob: () => import_glob.default,
|
45
|
+
globby: () => import_globby.default,
|
46
|
+
gzipSize: () => import_gzip_size.default,
|
47
|
+
inquirer: () => inquirer,
|
48
|
+
json5: () => import_json5.default,
|
49
|
+
lodash: () => import_lodash.default,
|
50
|
+
mime: () => mime,
|
51
|
+
minimist: () => import_minimist.default,
|
52
|
+
nanoid: () => import_nanoid.nanoid,
|
53
|
+
ora: () => import_ora.default,
|
54
|
+
pkgUp: () => import_pkg_up.default,
|
55
|
+
program: () => import_commander.program,
|
56
|
+
semver: () => import_semver.default,
|
57
|
+
signale: () => import_signale.default,
|
58
|
+
slash: () => import_slash.default,
|
59
|
+
stripAnsi: () => import_strip_ansi.default,
|
60
|
+
upath: () => import_upath.default,
|
61
|
+
urlJoin: () => import_url_join.default,
|
62
|
+
yaml: () => import_js_yaml.default
|
63
|
+
});
|
64
|
+
module.exports = __toCommonJS(compiled_exports);
|
65
|
+
var import_import = require("./import");
|
66
|
+
var import_fs_extra = __toESM(require("../compiled/fs-extra"));
|
67
|
+
var import_ora = __toESM(require("../compiled/ora"));
|
68
|
+
var import_glob = __toESM(require("../compiled/glob"));
|
69
|
+
var import_js_yaml = __toESM(require("../compiled/js-yaml"));
|
70
|
+
var import_chalk = __toESM(require("../compiled/chalk"));
|
71
|
+
var import_debug = __toESM(require("../compiled/debug"));
|
72
|
+
var import_slash = __toESM(require("../compiled/slash"));
|
73
|
+
var import_execa = __toESM(require("../compiled/execa"));
|
74
|
+
var import_json5 = __toESM(require("../compiled/json5"));
|
75
|
+
var import_upath = __toESM(require("../compiled/upath"));
|
76
|
+
var import_pkg_up = __toESM(require("../compiled/pkg-up"));
|
77
|
+
var import_nanoid = require("../compiled/nanoid");
|
78
|
+
var import_semver = __toESM(require("../compiled/semver"));
|
79
|
+
var import_dotenv = __toESM(require("../compiled/dotenv"));
|
80
|
+
var import_lodash = __toESM(require("../compiled/lodash"));
|
81
|
+
var import_globby = __toESM(require("../compiled/globby"));
|
82
|
+
var import_address = __toESM(require("../compiled/address"));
|
83
|
+
var import_signale = __toESM(require("../compiled/signale"));
|
84
|
+
var import_url_join = __toESM(require("../compiled/url-join"));
|
85
|
+
var import_minimist = __toESM(require("../compiled/minimist"));
|
86
|
+
var import_fast_glob = __toESM(require("../compiled/fast-glob"));
|
87
|
+
var import_filesize = __toESM(require("../compiled/filesize"));
|
88
|
+
var import_gzip_size = __toESM(require("../compiled/gzip-size"));
|
89
|
+
var import_strip_ansi = __toESM(require("../compiled/strip-ansi"));
|
90
|
+
var import_dotenv_expand = __toESM(require("../compiled/dotenv-expand"));
|
91
|
+
var import_browserslist = __toESM(require("../compiled/browserslist"));
|
92
|
+
var import_commander = require("../compiled/commander");
|
93
|
+
var import_signale2 = require("../compiled/signale");
|
94
|
+
const mime = import_import.Import.lazy("../compiled/mime-types", require);
|
95
|
+
const chokidar = import_import.Import.lazy("../compiled/chokidar", require);
|
96
|
+
const inquirer = import_import.Import.lazy("../compiled/inquirer", require);
|
97
|
+
// Annotate the CommonJS export names for ESM import in node:
|
98
|
+
0 && (module.exports = {
|
99
|
+
Command,
|
100
|
+
Signale,
|
101
|
+
address,
|
102
|
+
browserslist,
|
103
|
+
chalk,
|
104
|
+
chokidar,
|
105
|
+
debug,
|
106
|
+
dotenv,
|
107
|
+
dotenvExpand,
|
108
|
+
execa,
|
109
|
+
fastGlob,
|
110
|
+
filesize,
|
111
|
+
fs,
|
112
|
+
glob,
|
113
|
+
globby,
|
114
|
+
gzipSize,
|
115
|
+
inquirer,
|
116
|
+
json5,
|
117
|
+
lodash,
|
118
|
+
mime,
|
119
|
+
minimist,
|
120
|
+
nanoid,
|
121
|
+
ora,
|
122
|
+
pkgUp,
|
123
|
+
program,
|
124
|
+
semver,
|
125
|
+
signale,
|
126
|
+
slash,
|
127
|
+
stripAnsi,
|
128
|
+
upath,
|
129
|
+
urlJoin,
|
130
|
+
yaml
|
109
131
|
});
|
110
|
-
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
111
|
-
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
112
|
-
const _import = require("./import");
|
113
|
-
const _fsextra = /* @__PURE__ */ _interop_require_default._(require("../compiled/fs-extra"));
|
114
|
-
const _ora = /* @__PURE__ */ _interop_require_default._(require("../compiled/ora"));
|
115
|
-
const _glob = /* @__PURE__ */ _interop_require_default._(require("../compiled/glob"));
|
116
|
-
const _jsyaml = /* @__PURE__ */ _interop_require_default._(require("../compiled/js-yaml"));
|
117
|
-
const _chalk = /* @__PURE__ */ _interop_require_default._(require("../compiled/chalk"));
|
118
|
-
const _debug = /* @__PURE__ */ _interop_require_default._(require("../compiled/debug"));
|
119
|
-
const _slash = /* @__PURE__ */ _interop_require_default._(require("../compiled/slash"));
|
120
|
-
const _execa = /* @__PURE__ */ _interop_require_default._(require("../compiled/execa"));
|
121
|
-
const _json5 = /* @__PURE__ */ _interop_require_default._(require("../compiled/json5"));
|
122
|
-
const _upath = /* @__PURE__ */ _interop_require_default._(require("../compiled/upath"));
|
123
|
-
const _pkgup = /* @__PURE__ */ _interop_require_default._(require("../compiled/pkg-up"));
|
124
|
-
const _nanoid = require("../compiled/nanoid");
|
125
|
-
const _semver = /* @__PURE__ */ _interop_require_default._(require("../compiled/semver"));
|
126
|
-
const _dotenv = /* @__PURE__ */ _interop_require_default._(require("../compiled/dotenv"));
|
127
|
-
const _lodash = /* @__PURE__ */ _interop_require_default._(require("../compiled/lodash"));
|
128
|
-
const _globby = /* @__PURE__ */ _interop_require_default._(require("../compiled/globby"));
|
129
|
-
const _address = /* @__PURE__ */ _interop_require_default._(require("../compiled/address"));
|
130
|
-
const _signale = /* @__PURE__ */ _interop_require_wildcard._(require("../compiled/signale"));
|
131
|
-
const _urljoin = /* @__PURE__ */ _interop_require_default._(require("../compiled/url-join"));
|
132
|
-
const _minimist = /* @__PURE__ */ _interop_require_default._(require("../compiled/minimist"));
|
133
|
-
const _fastglob = /* @__PURE__ */ _interop_require_default._(require("../compiled/fast-glob"));
|
134
|
-
const _filesize = /* @__PURE__ */ _interop_require_default._(require("../compiled/filesize"));
|
135
|
-
const _gzipsize = /* @__PURE__ */ _interop_require_default._(require("../compiled/gzip-size"));
|
136
|
-
const _stripansi = /* @__PURE__ */ _interop_require_default._(require("../compiled/strip-ansi"));
|
137
|
-
const _dotenvexpand = /* @__PURE__ */ _interop_require_default._(require("../compiled/dotenv-expand"));
|
138
|
-
const _browserslist = /* @__PURE__ */ _interop_require_default._(require("../compiled/browserslist"));
|
139
|
-
const _commander = require("../compiled/commander");
|
140
|
-
const mime = _import.Import.lazy("../compiled/mime-types", require);
|
141
|
-
const chokidar = _import.Import.lazy("../compiled/chokidar", require);
|
142
|
-
const inquirer = _import.Import.lazy("../compiled/inquirer", require);
|