@e-mc/module 0.10.6 → 0.10.8

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 (3) hide show
  1. package/README.md +6 -6
  2. package/index.js +7 -22
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  ## Interface
11
11
 
12
- * [View Source](https://www.unpkg.com/@e-mc/types@0.10.6/lib/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.10.8/lib/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { LogStatus } from "./squared";
@@ -407,11 +407,11 @@ interface LoggerModule {
407
407
 
408
408
  ## References
409
409
 
410
- - https://www.unpkg.com/@e-mc/types@0.10.6/lib/core.d.ts
411
- - https://www.unpkg.com/@e-mc/types@0.10.6/lib/logger.d.ts
412
- - https://www.unpkg.com/@e-mc/types@0.10.6/lib/module.d.ts
413
- - https://www.unpkg.com/@e-mc/types@0.10.6/lib/node.d.ts
414
- - https://www.unpkg.com/@e-mc/types@0.10.6/lib/settings.d.ts
410
+ - https://www.unpkg.com/@e-mc/types@0.10.8/lib/core.d.ts
411
+ - https://www.unpkg.com/@e-mc/types@0.10.8/lib/logger.d.ts
412
+ - https://www.unpkg.com/@e-mc/types@0.10.8/lib/module.d.ts
413
+ - https://www.unpkg.com/@e-mc/types@0.10.8/lib/node.d.ts
414
+ - https://www.unpkg.com/@e-mc/types@0.10.8/lib/settings.d.ts
415
415
 
416
416
  * https://www.npmjs.com/package/@types/node
417
417
 
package/index.js CHANGED
@@ -142,7 +142,7 @@ const SUPPORTED_CANPARSE = (0, types_1.supported)(19, 9) || (0, types_1.supporte
142
142
  const REGEXP_TORRENT = /^(?:magnet:\?xt=|(?:https?|s?ftp):\/\/[^/][^\n]*?\.(?:torrent|metalink|meta4)(?:\?[^\n]*)?$)/i;
143
143
  const REGEXP_PROTOCOL = /^([a-z][a-z\d+-.]*):\/\/[^@:[\]\\^<>|\s]/i;
144
144
  const REGEXP_CLIESCAPE = /[^\w+-.,/:@]/g;
145
- const REGEXP_CLIOPTION = /^(-[^\s=]+|--[^-\s=][^\s=]*)(=)?\s*(.*)$/;
145
+ const REGEXP_CLIOPTION = /^(-[^\s=]+|--[^-\s=][^\s=]*)(=)?\s*(.*)$/s;
146
146
  const REGEXP_ANSIESCAPE = /[\u001B\u009B]/;
147
147
  const LOG_CPUBARCOLOR = SETTINGS.process.cpu_bar_color;
148
148
  const LOG_DIVIDER = chalk.blackBright('|');
@@ -917,7 +917,6 @@ function truncateStart(value, length = LOG_MIN_WIDTH, style = false) {
917
917
  function truncateEnd(value, length) {
918
918
  return (REGEXP_ANSIESCAPE.test(value) ? stripansi(value) : value).length > length ? '...' + value.substring(value.length - length + 3) : value;
919
919
  }
920
- const escapeArg = (value) => value.replace(REGEXP_CLIESCAPE, capture => capture === '\n' ? "'\n'" : (capture === '$' || capture === '`' ? '\\' : '') + '\\' + capture);
921
920
  const isMeterUnit = (type, ident) => (type & 256) === 256 && !ident;
922
921
  const formatLogMessage = (type, message, unit, ident) => isMeterUnit(type, ident) ? (unit + LOG_DIVIDER + message).trimEnd() : unit ? (message + (ident ? '' : ' ') + unit).trimStart() : message;
923
922
  const hideAbort = (err) => err.name === 'AbortError' && SETTINGS.abort === false;
@@ -961,7 +960,7 @@ class Module extends EventEmitter {
961
960
  this[_g] = null;
962
961
  }
963
962
  static get VERSION() {
964
- return "0.10.6";
963
+ return "0.10.8";
965
964
  }
966
965
  static get LOG_TYPE() {
967
966
  return types_1.LOG_TYPE;
@@ -2353,7 +2352,7 @@ class Module extends EventEmitter {
2353
2352
  value = opt[3];
2354
2353
  }
2355
2354
  if (value) {
2356
- const quoted = /^(["'])(.*)\1$/.exec(value);
2355
+ const quoted = /^(["'])(.*)\1$/s.exec(value);
2357
2356
  if (PLATFORM_WIN32) {
2358
2357
  if (quoted) {
2359
2358
  if (quoted[1] === '"') {
@@ -2366,33 +2365,19 @@ class Module extends EventEmitter {
2366
2365
  value = wrapQuote(value);
2367
2366
  }
2368
2367
  }
2369
- else {
2370
- let type = doubleQuote;
2371
- if (quoted) {
2372
- if (quoted[1] === "'") {
2373
- result[i] = leading + value;
2374
- continue;
2375
- }
2376
- value = quoted[2];
2377
- type = true;
2378
- }
2368
+ else if (!quoted) {
2379
2369
  if (REGEXP_CLIESCAPE.test(value)) {
2380
- if (type) {
2381
- value = '"' + escapeArg(value) + '"';
2382
- }
2383
- else {
2384
- value = "'" + value.replaceAll("'", "'\\''") + "'";
2385
- }
2370
+ value = doubleQuote ? `"${value.replace(/(?<!\\)"/g, '\\"')}"` : `'${value.replaceAll("'", "'\\''")}'`;
2386
2371
  }
2387
2372
  else if (RESERVED_SHELL.includes(value)) {
2388
- value = "'" + value + "'";
2373
+ value = `'${value}'`;
2389
2374
  }
2390
2375
  }
2391
2376
  }
2392
2377
  else if (opt) {
2393
2378
  leading = leading.trim();
2394
2379
  if (!PLATFORM_WIN32 && leading.length > 2 && leading[1] !== '-') {
2395
- leading = escapeArg(leading);
2380
+ leading.replace(REGEXP_CLIESCAPE, capture => '\\' + capture);
2396
2381
  }
2397
2382
  }
2398
2383
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/module",
3
- "version": "0.10.6",
3
+ "version": "0.10.8",
4
4
  "description": "Module base class for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -20,7 +20,7 @@
20
20
  "license": "BSD-3-Clause",
21
21
  "homepage": "https://github.com/anpham6/e-mc#readme",
22
22
  "dependencies": {
23
- "@e-mc/types": "0.10.6",
23
+ "@e-mc/types": "0.10.8",
24
24
  "chalk": "4.1.2",
25
25
  "file-type": "^18.7.0",
26
26
  "js-yaml": "^4.1.0",