@umijs/utils 4.0.0-beta.9 → 4.0.0-rc.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/index.js CHANGED
@@ -82,7 +82,9 @@ exports.logger = logger;
82
82
  const updatePackageJSON_1 = __importDefault(require("./updatePackageJSON"));
83
83
  exports.updatePackageJSON = updatePackageJSON_1.default;
84
84
  __exportStar(require("./importLazy"), exports);
85
+ __exportStar(require("./isStyleFile"), exports);
85
86
  __exportStar(require("./npmClient"), exports);
86
87
  __exportStar(require("./randomColor/randomColor"), exports);
87
88
  exports.register = __importStar(require("./register"));
89
+ __exportStar(require("./tryPaths"), exports);
88
90
  __exportStar(require("./winPath"), exports);
@@ -0,0 +1,5 @@
1
+ export declare const AUTO_CSS_MODULE_EXTS: string[];
2
+ export declare const isStyleFile: ({ filename, ext, }: {
3
+ filename?: string | undefined;
4
+ ext?: string | undefined;
5
+ }) => boolean;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isStyleFile = exports.AUTO_CSS_MODULE_EXTS = void 0;
4
+ const path_1 = require("path");
5
+ exports.AUTO_CSS_MODULE_EXTS = [
6
+ '.css',
7
+ '.less',
8
+ '.sass',
9
+ '.scss',
10
+ '.stylus',
11
+ '.styl',
12
+ ];
13
+ const isStyleFile = ({ filename, ext, }) => {
14
+ return exports.AUTO_CSS_MODULE_EXTS.includes(ext !== null && ext !== void 0 ? ext : (0, path_1.extname)(filename));
15
+ };
16
+ exports.isStyleFile = isStyleFile;
package/dist/logger.d.ts CHANGED
@@ -5,10 +5,12 @@ export declare const prefixes: {
5
5
  ready: string;
6
6
  info: string;
7
7
  event: string;
8
+ debug: string;
8
9
  };
9
- export declare function wait(...message: string[]): void;
10
- export declare function error(...message: string[]): void;
11
- export declare function warn(...message: string[]): void;
12
- export declare function ready(...message: string[]): void;
13
- export declare function info(...message: string[]): void;
14
- export declare function event(...message: string[]): void;
10
+ export declare function wait(...message: any[]): void;
11
+ export declare function error(...message: any[]): void;
12
+ export declare function warn(...message: any[]): void;
13
+ export declare function ready(...message: any[]): void;
14
+ export declare function info(...message: any[]): void;
15
+ export declare function event(...message: any[]): void;
16
+ export declare function debug(...message: any[]): void;
package/dist/logger.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.event = exports.info = exports.ready = exports.warn = exports.error = exports.wait = exports.prefixes = void 0;
6
+ exports.debug = exports.event = exports.info = exports.ready = exports.warn = exports.error = exports.wait = exports.prefixes = void 0;
7
7
  const chalk_1 = __importDefault(require("../compiled/chalk"));
8
8
  exports.prefixes = {
9
9
  wait: chalk_1.default.cyan('wait') + ' -',
@@ -12,6 +12,7 @@ exports.prefixes = {
12
12
  ready: chalk_1.default.green('ready') + ' -',
13
13
  info: chalk_1.default.cyan('info') + ' -',
14
14
  event: chalk_1.default.magenta('event') + ' -',
15
+ debug: chalk_1.default.gray('debug') + ' -',
15
16
  };
16
17
  function wait(...message) {
17
18
  console.log(exports.prefixes.wait, ...message);
@@ -37,3 +38,9 @@ function event(...message) {
37
38
  console.log(exports.prefixes.event, ...message);
38
39
  }
39
40
  exports.event = event;
41
+ function debug(...message) {
42
+ if (process.env.DEBUG) {
43
+ console.log(exports.prefixes.debug, ...message);
44
+ }
45
+ }
46
+ exports.debug = debug;
@@ -0,0 +1 @@
1
+ export declare function tryPaths(paths: string[]): string | undefined;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.tryPaths = void 0;
4
+ const fs_1 = require("fs");
5
+ function tryPaths(paths) {
6
+ for (const path of paths) {
7
+ if ((0, fs_1.existsSync)(path))
8
+ return path;
9
+ }
10
+ }
11
+ exports.tryPaths = tryPaths;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/utils",
3
- "version": "4.0.0-beta.9",
3
+ "version": "4.0.0-rc.1",
4
4
  "homepage": "https://github.com/umijs/umi-next/tree/master/packages/utils#readme",
5
5
  "bugs": "https://github.com/umijs/umi-next/issues",
6
6
  "repository": {
@@ -27,18 +27,18 @@
27
27
  "@types/color": "3.0.2",
28
28
  "@types/cross-spawn": "6.0.2",
29
29
  "@types/debug": "4.1.7",
30
- "@types/lodash": "4.14.176",
30
+ "@types/lodash": "4.14.177",
31
31
  "@types/mustache": "4.1.2",
32
32
  "@types/prompts": "^2.0.14",
33
33
  "@types/rimraf": "3.0.2",
34
34
  "@types/semver": "7.3.9",
35
35
  "address": "1.1.2",
36
- "axios": "0.23.0",
36
+ "axios": "0.24.0",
37
37
  "chalk": "4.1.2",
38
38
  "cheerio": "1.0.0-rc.10",
39
- "color": "4.0.1",
39
+ "color": "4.0.2",
40
40
  "cross-spawn": "7.0.3",
41
- "debug": "4.3.2",
41
+ "debug": "4.3.3",
42
42
  "deepmerge": "4.2.2",
43
43
  "execa": "5.1.1",
44
44
  "fs-extra": "10.0.0",
@@ -55,7 +55,7 @@
55
55
  "rimraf": "3.0.2",
56
56
  "semver": "7.3.5",
57
57
  "strip-ansi": "6.0.1",
58
- "yargs-parser": "20.2.9"
58
+ "yargs-parser": "21.0.0"
59
59
  },
60
60
  "publishConfig": {
61
61
  "access": "public"