bililive-cli 1.5.0 → 1.6.0

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.
@@ -3,35 +3,103 @@
3
3
  var os$3 = require('node:os');
4
4
  var path$5 = require('node:path');
5
5
  var fs$3 = require('node:fs');
6
- var index = require('./bili-BLevGPF2.js');
6
+ var index = require('./index--sFOOs5S.js');
7
7
  var require$$0$1 = require('fs');
8
8
  var require$$0 = require('path');
9
9
  var require$$0$2 = require('child_process');
10
- var require$$0$3 = require('os');
11
- var require$$1 = require('util');
10
+ var require$$1 = require('os');
11
+ var require$$1$1 = require('util');
12
12
  var require$$5 = require('assert');
13
- var require$$0$4 = require('events');
14
- var require$$0$6 = require('buffer');
15
- var require$$0$5 = require('stream');
13
+ var require$$0$3 = require('events');
14
+ var require$$0$4 = require('buffer');
15
+ var stream$1 = require('stream');
16
16
  var process$2 = require('node:process');
17
- var v4 = require('./v4-D4KzFnn8.js');
18
- require('node:crypto');
17
+ require('constants');
18
+ require('url');
19
+ require('node:events');
20
+ require('ntsuspend');
19
21
  require('node:child_process');
22
+ require('node:readline');
20
23
  require('http');
21
24
  require('https');
22
- require('url');
23
- require('tty');
25
+ require('node:crypto');
24
26
  require('zlib');
25
- require('node:events');
26
- require('crypto');
27
- require('node:url');
28
- require('constants');
29
- require('node:module');
30
27
  require('net');
31
28
  require('dns');
29
+ require('crypto');
32
30
  require('tls');
33
- require('@autorecord/manager');
34
- require('@autorecord/douyu-recorder');
31
+ require('punycode');
32
+ require('tty');
33
+ require('node:url');
34
+ require('vm');
35
+ require('node:net');
36
+ require('node:https');
37
+ require('node:buffer');
38
+ require('node:zlib');
39
+
40
+ // Unique ID creation requires a high quality random # generator. In the browser we therefore
41
+ // require the crypto API and do not support built-in fallback to lower quality random number
42
+ // generators (like Math.random()).
43
+ var getRandomValues;
44
+ var rnds8 = new Uint8Array(16);
45
+ function rng() {
46
+ // lazy load so that environments that need to polyfill have a chance to do so
47
+ if (!getRandomValues) {
48
+ // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
49
+ // find the complete implementation of crypto (msCrypto) on IE11.
50
+ getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
51
+
52
+ if (!getRandomValues) {
53
+ throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
54
+ }
55
+ }
56
+
57
+ return getRandomValues(rnds8);
58
+ }
59
+
60
+ var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
61
+
62
+ function validate(uuid) {
63
+ return typeof uuid === 'string' && REGEX.test(uuid);
64
+ }
65
+
66
+ /**
67
+ * Convert array of 16 byte values to UUID string format of the form:
68
+ * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
69
+ */
70
+
71
+ var byteToHex = [];
72
+
73
+ for (var i = 0; i < 256; ++i) {
74
+ byteToHex.push((i + 0x100).toString(16).substr(1));
75
+ }
76
+
77
+ function stringify(arr) {
78
+ var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
79
+ // Note: Be careful editing this code! It's been tuned for performance
80
+ // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
81
+ var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one
82
+ // of the following:
83
+ // - One or more input array values don't map to a hex octet (leading to
84
+ // "undefined" in the uuid)
85
+ // - Invalid input values for the RFC `version` or `variant` fields
86
+
87
+ if (!validate(uuid)) {
88
+ throw TypeError('Stringified UUID is invalid');
89
+ }
90
+
91
+ return uuid;
92
+ }
93
+
94
+ function v4(options, buf, offset) {
95
+ options = options || {};
96
+ var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
97
+
98
+ rnds[6] = rnds[6] & 0x0f | 0x40;
99
+ rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
100
+
101
+ return stringify(rnds);
102
+ }
35
103
 
36
104
  var xdgTrashdir$1 = {exports: {}};
37
105
 
@@ -254,15 +322,17 @@ function escapeArgument(arg, doubleEscapeMetaChars) {
254
322
  arg = `${arg}`;
255
323
 
256
324
  // Algorithm below is based on https://qntm.org/cmd
325
+ // It's slightly altered to disable JS backtracking to avoid hanging on specially crafted input
326
+ // Please see https://github.com/moxystudio/node-cross-spawn/pull/160 for more information
257
327
 
258
328
  // Sequence of backslashes followed by a double quote:
259
329
  // double up all the backslashes and escape the double quote
260
- arg = arg.replace(/(\\*)"/g, '$1$1\\"');
330
+ arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"');
261
331
 
262
332
  // Sequence of backslashes followed by the end of the string
263
333
  // (which will become a double quote later):
264
334
  // double up all the backslashes
265
- arg = arg.replace(/(\\*)$/, '$1$1');
335
+ arg = arg.replace(/(?=(\\+?)?)\1$/, '$1$1');
266
336
 
267
337
  // All other backslashes occur literally
268
338
 
@@ -646,8 +716,8 @@ onetime$2.exports.callCount = function_ => {
646
716
 
647
717
  var onetimeExports = onetime$2.exports;
648
718
 
649
- const os$2 = require$$0$3;
650
- const util = require$$1;
719
+ const os$2 = require$$1;
720
+ const util = require$$1$1;
651
721
 
652
722
  const getCode = (error, code) => {
653
723
  if (error && error.code) {
@@ -886,7 +956,7 @@ if (!processOk(process$1)) {
886
956
  var signals = requireSignals();
887
957
  var isWin = /^win/i.test(process$1.platform);
888
958
 
889
- var EE = require$$0$4;
959
+ var EE = require$$0$3;
890
960
  /* istanbul ignore if */
891
961
  if (typeof EE !== 'function') {
892
962
  EE = EE.EventEmitter;
@@ -1078,7 +1148,7 @@ var pFinally$1 = async (
1078
1148
  return value;
1079
1149
  };
1080
1150
 
1081
- const os$1 = require$$0$3;
1151
+ const os$1 = require$$1;
1082
1152
  const onExit = signalExitExports;
1083
1153
  const pFinally = pFinally$1;
1084
1154
 
@@ -1308,7 +1378,11 @@ var endOfStream = eos$1;
1308
1378
 
1309
1379
  var once = index.onceExports;
1310
1380
  var eos = endOfStream;
1311
- var fs$1 = require$$0$1; // we only need fs to get the ReadStream and WriteStream prototypes
1381
+ var fs$1;
1382
+
1383
+ try {
1384
+ fs$1 = require('fs'); // we only need fs to get the ReadStream and WriteStream prototypes
1385
+ } catch (e) {}
1312
1386
 
1313
1387
  var noop = function () {};
1314
1388
  var ancient = /^v?\.0/.test(process.version);
@@ -1389,7 +1463,7 @@ var pump$1 = function () {
1389
1463
 
1390
1464
  var pump_1 = pump$1;
1391
1465
 
1392
- const {PassThrough: PassThroughStream} = require$$0$5;
1466
+ const {PassThrough: PassThroughStream} = stream$1;
1393
1467
 
1394
1468
  var bufferStream$1 = options => {
1395
1469
  options = {...options};
@@ -1441,7 +1515,7 @@ var bufferStream$1 = options => {
1441
1515
  return stream;
1442
1516
  };
1443
1517
 
1444
- const {constants: BufferConstants} = require$$0$6;
1518
+ const {constants: BufferConstants} = require$$0$4;
1445
1519
  const pump = pump_1;
1446
1520
  const bufferStream = bufferStream$1;
1447
1521
 
@@ -1503,7 +1577,7 @@ getStream$2.exports.MaxBufferError = MaxBufferError;
1503
1577
 
1504
1578
  var getStreamExports = getStream$2.exports;
1505
1579
 
1506
- const { PassThrough } = require$$0$5;
1580
+ const { PassThrough } = stream$1;
1507
1581
 
1508
1582
  var mergeStream$1 = function (/*streams...*/) {
1509
1583
  var sources = [];
@@ -2540,7 +2614,7 @@ var mountPoint$1 = function (file) {
2540
2614
  });
2541
2615
  };
2542
2616
 
2543
- var os = require$$0$3;
2617
+ var os = require$$1;
2544
2618
 
2545
2619
  function homedir() {
2546
2620
  var env = process.env;
@@ -2569,7 +2643,7 @@ var userHome$1 = osHomedir();
2569
2643
  var xdgBasedir$1 = {};
2570
2644
 
2571
2645
  (function (exports) {
2572
- const os = require$$0$3;
2646
+ const os = require$$1;
2573
2647
  const path = require$$0;
2574
2648
 
2575
2649
  const homeDirectory = os.homedir();
@@ -2718,7 +2792,7 @@ function escapeStringRegexp(string) {
2718
2792
 
2719
2793
  const extractPathRegex = /\s+at.*[(\s](.*)\)?/;
2720
2794
  const pathRegex = /^(?:(?:(?:node|node:[\w/]+|(?:(?:node:)?internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)(?:\.js)?:\d+:\d+)|native)/;
2721
- const homeDir = typeof require$$0$3.homedir === 'undefined' ? '' : require$$0$3.homedir().replace(/\\/g, '/');
2795
+ const homeDir = typeof require$$1.homedir === 'undefined' ? '' : require$$1.homedir().replace(/\\/g, '/');
2722
2796
 
2723
2797
  function cleanStack(stack, {pretty = false, basePath} = {}) {
2724
2798
  const basePathRegex = basePath && new RegExp(`(at | \\()${escapeStringRegexp(basePath.replace(/\\/g, '/'))}`, 'g');
@@ -3454,7 +3528,7 @@ const getDeletionDate = date => date.getFullYear()
3454
3528
  + ':' + pad(date.getSeconds());
3455
3529
 
3456
3530
  const trash = async (filePath, trashPaths) => {
3457
- const name = v4.v4();
3531
+ const name = v4();
3458
3532
  const destination = path$5.join(trashPaths.filesPath, name);
3459
3533
  const trashInfoPath = path$5.join(trashPaths.infoPath, `${name}.trashinfo`);
3460
3534
 
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var os = require('node:os');
4
- var chunkedExec = require('./chunked-exec-D0BsLh9V.js');
4
+ var chunkedExec = require('./chunked-exec-DzOIaGn1.js');
5
5
  require('node:util');
6
6
  require('node:child_process');
7
7
  require('node:url');
@@ -10,7 +10,7 @@ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentS
10
10
  const isOlderThanMountainLion = Number(os.release().split('.')[0]) < 12;
11
11
 
12
12
  // Binary source: https://github.com/sindresorhus/macos-trash
13
- const binary = new URL('macos-trash', (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('macos-BaatW38k.js', document.baseURI).href)));
13
+ const binary = new URL('macos-trash', (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('macos-CAOfJ0Q9.js', document.baseURI).href)));
14
14
 
15
15
  async function macOS(paths) {
16
16
  if (isOlderThanMountainLion) {
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkedExec = require('./chunked-exec-D0BsLh9V.js');
3
+ var chunkedExec = require('./chunked-exec-DzOIaGn1.js');
4
4
  require('node:util');
5
5
  require('node:child_process');
6
6
  require('node:url');
7
7
 
8
8
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
9
9
  // Binary source: https://github.com/sindresorhus/recycle-bin
10
- const binary = new URL('windows-trash.exe', (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('windows-B0oX8Um0.js', document.baseURI).href)));
10
+ const binary = new URL('windows-trash.exe', (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('windows-DgdPRZEm.js', document.baseURI).href)));
11
11
 
12
12
  async function windows(paths) {
13
13
  await chunkedExec.chunkedExec(binary, paths, 200);
package/package.json CHANGED
@@ -1,12 +1,15 @@
1
1
  {
2
2
  "name": "bililive-cli",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "type": "module",
5
5
  "description": "biliLive-tools的cli程序",
6
6
  "main": "./lib/index.js",
7
7
  "author": "renmu123",
8
8
  "license": "GPL-3.0",
9
9
  "homepage": "https://github.com/renmu123/biliLive-tools",
10
+ "pkg": {
11
+ "assets": "./lib/node_modules/**"
12
+ },
10
13
  "bin": {
11
14
  "biliLive": "./lib/index.cjs"
12
15
  },
@@ -21,27 +24,29 @@
21
24
  "lib"
22
25
  ],
23
26
  "dependencies": {
24
- "@napi-rs/canvas": "^0.1.53"
27
+ "@napi-rs/canvas": "^0.1.53",
28
+ "ntsuspend": "^1.0.2"
25
29
  },
26
30
  "devDependencies": {
27
31
  "@types/cli-progress": "^3.11.5",
28
- "@yao-pkg/pkg": "^5.11.5",
32
+ "@yao-pkg/pkg": "^6.0.0",
29
33
  "bestzip": "^2.2.1",
30
- "rollup-plugin-natives": "^0.7.8",
31
- "tsx": "^4.7.2",
32
34
  "cli-progress": "^3.12.0",
33
35
  "commander": "^12.0.0",
34
- "@biliLive-tools/http": "1.5.0",
35
- "@biliLive-tools/shared": "1.5.0",
36
- "@biliLive-tools/types": "1.5.0"
36
+ "rimraf": "^6.0.1",
37
+ "tsx": "^4.7.2",
38
+ "@biliLive-tools/http": "1.6.0",
39
+ "@biliLive-tools/shared": "1.6.0",
40
+ "@biliLive-tools/types": "1.6.0"
37
41
  },
38
42
  "scripts": {
39
43
  "start": "tsx src/index.ts",
40
44
  "dev": "rollup --config rollup.config.js -w",
41
- "build:cli": "pnpm run build && pnpm run pkg",
42
- "build": "rollup --config rollup.config.js",
45
+ "build:cli": "pnpm run build && pnpm run movePackage && pnpm run pkg",
46
+ "build": "rimraf lib && rollup --config rollup.config.js",
47
+ "movePackage": "node ./scripts/copy_module.js",
43
48
  "pkg": "pkg ./lib/index.cjs --output ./dist/biliLive",
44
- "zip:win": "cd dist && bestzip biliLive-cli-win-x64.zip ./biliLive.exe",
49
+ "zip:win": "cd dist && bestzip biliLive-cli-win-x64.zip biliLive.exe",
45
50
  "zip:linux": "cd dist && bestzip biliLive-cli-linux-x64.zip ./biliLive",
46
51
  "release": "pnpm run build && pnpm publish --access=public"
47
52
  }