@umijs/utils 4.0.49 → 4.0.51

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.
Files changed (2) hide show
  1. package/dist/logger.js +10 -1
  2. package/package.json +1 -1
package/dist/logger.js CHANGED
@@ -41,10 +41,11 @@ module.exports = __toCommonJS(logger_exports);
41
41
  var import_path = require("path");
42
42
  var import_chalk = __toESM(require("../compiled/chalk"));
43
43
  var import_fs_extra = __toESM(require("../compiled/fs-extra"));
44
+ var import_pkg_up = require("../compiled/pkg-up");
44
45
  var import_importLazy = require("./importLazy");
45
46
  var enableFSLogger = process.env.FS_LOGGER !== "none" && !process.versions.webcontainer;
46
47
  var profilers = {};
47
- var loggerDir = (0, import_path.join)(process.cwd(), "node_modules/.cache/logger");
48
+ var loggerDir = findLoggerDir();
48
49
  var loggerPath = (0, import_path.join)(loggerDir, "umi.log");
49
50
  var prefixes = {
50
51
  wait: import_chalk.default.cyan("wait") + " -",
@@ -150,6 +151,14 @@ function profile(id, ...message) {
150
151
  function getLatestLogFilePath() {
151
152
  return enableFSLogger ? loggerPath : null;
152
153
  }
154
+ function findLoggerDir() {
155
+ let baseDir = process.cwd();
156
+ const pkg = (0, import_pkg_up.pkgUpSync)({ cwd: baseDir });
157
+ if (pkg) {
158
+ baseDir = (0, import_path.dirname)(pkg);
159
+ }
160
+ return (0, import_path.join)(baseDir, "node_modules/.cache/logger");
161
+ }
153
162
  // Annotate the CommonJS export names for ESM import in node:
154
163
  0 && (module.exports = {
155
164
  debug,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/utils",
3
- "version": "4.0.49",
3
+ "version": "4.0.51",
4
4
  "homepage": "https://github.com/umijs/umi/tree/master/packages/utils#readme",
5
5
  "bugs": "https://github.com/umijs/umi/issues",
6
6
  "repository": {