@umijs/utils 4.0.0-canary.20221221.1 → 4.0.0-canary.20230109.1
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/getDevBanner.js +2 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/isMonorepo.d.ts +5 -0
- package/dist/isMonorepo.js +43 -0
- package/dist/isStyleFile.d.ts +1 -1
- package/dist/isStyleFile.js +1 -1
- package/package.json +1 -1
package/dist/getDevBanner.js
CHANGED
|
@@ -40,7 +40,8 @@ function getDevBanner(protocol, host = "0.0.0.0", port, offset = 8) {
|
|
|
40
40
|
const header = " App listening at:";
|
|
41
41
|
const footer = import_chalk.default.bold(" Now you can open browser with the above addresses\u2191 ");
|
|
42
42
|
const local = ` ${import_chalk.default.gray(">")} Local: ${import_chalk.default.green(`${protocol}//${host === "0.0.0.0" ? "localhost" : host}:${port}`)} `;
|
|
43
|
-
const
|
|
43
|
+
const ip = import_address.default.ip();
|
|
44
|
+
const network = ` ${import_chalk.default.gray(">")} Network: ${ip ? import_chalk.default.green(`${protocol}//${ip}:${port}`) : import_chalk.default.gray("Not available")} `;
|
|
44
45
|
const maxLen = Math.max(...[header, footer, local, network].map((x) => (0, import_strip_ansi.default)(x).length));
|
|
45
46
|
const beforeLines = [
|
|
46
47
|
`${BORDERS.TL}${import_chalk.default.gray.dim("".padStart(maxLen, BORDERS.H_PURE))}${BORDERS.TR}`,
|
package/dist/index.d.ts
CHANGED
|
@@ -41,4 +41,5 @@ export * as register from './register';
|
|
|
41
41
|
export * from './tryPaths';
|
|
42
42
|
export * from './winPath';
|
|
43
43
|
export * from './setNoDeprecation';
|
|
44
|
+
export * from './isMonorepo';
|
|
44
45
|
export { address, axios, chalk, cheerio, chokidar, crossSpawn, debug, deepmerge, execa, fsExtra, glob, Generator, BaseGenerator, generateFile, installDeps, lodash, logger, Mustache, pkgUp, portfinder, prompts, resolve, rimraf, semver, stripAnsi, updatePackageJSON, yParser, getGitInfo, printHelp, filesize, gzipSize, fastestLevenshtein, };
|
package/dist/index.js
CHANGED
|
@@ -101,6 +101,7 @@ var register = __toESM(require("./register"));
|
|
|
101
101
|
__reExport(src_exports, require("./tryPaths"), module.exports);
|
|
102
102
|
__reExport(src_exports, require("./winPath"), module.exports);
|
|
103
103
|
__reExport(src_exports, require("./setNoDeprecation"), module.exports);
|
|
104
|
+
__reExport(src_exports, require("./isMonorepo"), module.exports);
|
|
104
105
|
// Annotate the CommonJS export names for ESM import in node:
|
|
105
106
|
0 && (module.exports = {
|
|
106
107
|
BaseGenerator,
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/isMonorepo.ts
|
|
20
|
+
var isMonorepo_exports = {};
|
|
21
|
+
__export(isMonorepo_exports, {
|
|
22
|
+
isMonorepo: () => isMonorepo
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(isMonorepo_exports);
|
|
25
|
+
var import_path = require("path");
|
|
26
|
+
var import_fs = require("fs");
|
|
27
|
+
var MONOREPO_FILE = ["pnpm-workspace.yaml", "lerna.json"];
|
|
28
|
+
function isMonorepo(opts) {
|
|
29
|
+
const pkgPath = (0, import_path.join)(opts.root, "package.json");
|
|
30
|
+
let pkg = {};
|
|
31
|
+
try {
|
|
32
|
+
pkg = require(pkgPath);
|
|
33
|
+
} catch (e) {
|
|
34
|
+
}
|
|
35
|
+
const pkgExist = (0, import_fs.existsSync)(pkgPath);
|
|
36
|
+
return pkgExist && (MONOREPO_FILE.some((file) => {
|
|
37
|
+
return (0, import_fs.existsSync)((0, import_path.join)(opts.root, file));
|
|
38
|
+
}) || (pkg == null ? void 0 : pkg.workspaces));
|
|
39
|
+
}
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
isMonorepo
|
|
43
|
+
});
|
package/dist/isStyleFile.d.ts
CHANGED
package/dist/isStyleFile.js
CHANGED
|
@@ -36,7 +36,7 @@ var isStyleFile = ({
|
|
|
36
36
|
filename,
|
|
37
37
|
ext
|
|
38
38
|
}) => {
|
|
39
|
-
return AUTO_CSS_MODULE_EXTS.includes(ext || (0, import_path.extname)(filename));
|
|
39
|
+
return filename && AUTO_CSS_MODULE_EXTS.includes(ext || (0, import_path.extname)(filename));
|
|
40
40
|
};
|
|
41
41
|
// Annotate the CommonJS export names for ESM import in node:
|
|
42
42
|
0 && (module.exports = {
|
package/package.json
CHANGED