@modern-js/utils 2.32.1 → 2.32.2-alpha.1

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @modern-js/utils
2
2
 
3
+ ## 2.32.2-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - bc1f8daf0ff: feat(builder): support custom logger in dev server
8
+
9
+ feat(builder): 支持自定义 logger
10
+
3
11
  ## 2.32.1
4
12
 
5
13
  ## 2.32.0
@@ -12,7 +12,7 @@ const _interop_require_default = require("@swc/helpers/_/_interop_require_defaul
12
12
  const _net = /* @__PURE__ */ _interop_require_default._(require("net"));
13
13
  const _compiled = require("../compiled");
14
14
  const _logger = require("./logger");
15
- const getPort = async (port, { tryLimits = 20, strictPort = false } = {}) => {
15
+ const getPort = async (port, { tryLimits = 20, strictPort = false, slient = false } = {}) => {
16
16
  if (typeof port === "string") {
17
17
  port = parseInt(port, 10);
18
18
  }
@@ -47,7 +47,7 @@ const getPort = async (port, { tryLimits = 20, strictPort = false } = {}) => {
47
47
  if (port !== original) {
48
48
  if (strictPort) {
49
49
  throw new Error(`Port "${original}" is occupied, please choose another one.`);
50
- } else {
50
+ } else if (!slient) {
51
51
  _logger.logger.info(`Something is already running on port ${original}. ${_compiled.chalk.yellow(`Use port ${port} instead.`)}`);
52
52
  }
53
53
  }
@@ -5,12 +5,12 @@ import { chalk } from "../compiled";
5
5
  import { logger } from "./logger";
6
6
  export var getPort = function() {
7
7
  var _ref = _async_to_generator(function(port) {
8
- var _ref2, _ref_tryLimits, tryLimits, _ref_strictPort, strictPort, original, found, attempts, e;
8
+ var _ref2, _ref_tryLimits, tryLimits, _ref_strictPort, strictPort, _ref_slient, slient, original, found, attempts, e;
9
9
  var _arguments = arguments;
10
10
  return _ts_generator(this, function(_state) {
11
11
  switch (_state.label) {
12
12
  case 0:
13
- _ref2 = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {}, _ref_tryLimits = _ref2.tryLimits, tryLimits = _ref_tryLimits === void 0 ? 20 : _ref_tryLimits, _ref_strictPort = _ref2.strictPort, strictPort = _ref_strictPort === void 0 ? false : _ref_strictPort;
13
+ _ref2 = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {}, _ref_tryLimits = _ref2.tryLimits, tryLimits = _ref_tryLimits === void 0 ? 20 : _ref_tryLimits, _ref_strictPort = _ref2.strictPort, strictPort = _ref_strictPort === void 0 ? false : _ref_strictPort, _ref_slient = _ref2.slient, slient = _ref_slient === void 0 ? false : _ref_slient;
14
14
  if (typeof port === "string") {
15
15
  port = parseInt(port, 10);
16
16
  }
@@ -76,7 +76,7 @@ export var getPort = function() {
76
76
  if (port !== original) {
77
77
  if (strictPort) {
78
78
  throw new Error('Port "'.concat(original, '" is occupied, please choose another one.'));
79
- } else {
79
+ } else if (!slient) {
80
80
  logger.info("Something is already running on port ".concat(original, ". ").concat(chalk.yellow("Use port ".concat(port, " instead."))));
81
81
  }
82
82
  }
@@ -1,7 +1,7 @@
1
1
  import net from "net";
2
2
  import { chalk } from "../compiled";
3
3
  import { logger } from "./logger";
4
- export const getPort = async (port, { tryLimits = 20, strictPort = false } = {}) => {
4
+ export const getPort = async (port, { tryLimits = 20, strictPort = false, slient = false } = {}) => {
5
5
  if (typeof port === "string") {
6
6
  port = parseInt(port, 10);
7
7
  }
@@ -36,7 +36,7 @@ export const getPort = async (port, { tryLimits = 20, strictPort = false } = {})
36
36
  if (port !== original) {
37
37
  if (strictPort) {
38
38
  throw new Error(`Port "${original}" is occupied, please choose another one.`);
39
- } else {
39
+ } else if (!slient) {
40
40
  logger.info(`Something is already running on port ${original}. ${chalk.yellow(`Use port ${port} instead.`)}`);
41
41
  }
42
42
  }
@@ -7,8 +7,10 @@
7
7
  */
8
8
  export declare const getPort: (port: string | number, {
9
9
  tryLimits,
10
- strictPort
10
+ strictPort,
11
+ slient
11
12
  }?: {
12
13
  tryLimits?: number | undefined;
13
14
  strictPort?: boolean | undefined;
15
+ slient?: boolean | undefined;
14
16
  }) => Promise<number>;
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.32.1",
18
+ "version": "2.32.2-alpha.1",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -243,7 +243,7 @@
243
243
  "typescript": "^5",
244
244
  "webpack": "^5.88.1",
245
245
  "@types/serialize-javascript": "^5.0.1",
246
- "@modern-js/types": "2.32.1",
246
+ "@modern-js/types": "2.32.2-alpha.1",
247
247
  "@scripts/jest-config": "2.32.1",
248
248
  "@scripts/build": "2.32.1"
249
249
  },