addons-scanner-utils 9.11.0 → 9.12.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.
@@ -1,6 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- /// <reference types="node" />
4
1
  import fs from 'fs';
5
2
  import { Request, RequestHandler } from 'express';
6
3
  import fetch from 'node-fetch';
package/dist/io/base.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import { Readable } from 'stream';
4
2
  import { Stderr } from '../stdio';
5
3
  type ScanFileFunction = (_path: string, isDirectory: boolean) => boolean;
package/dist/io/crx.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import defaultFs from 'fs';
4
2
  import yauzl, { ZipFile } from 'yauzl';
5
3
  import { IOBaseConstructorParams } from './base';
package/dist/io/crx.js CHANGED
@@ -3,7 +3,8 @@ 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.Crx = exports.defaultParseCRX = void 0;
6
+ exports.Crx = void 0;
7
+ exports.defaultParseCRX = defaultParseCRX;
7
8
  const fs_1 = __importDefault(require("fs"));
8
9
  const yauzl_1 = __importDefault(require("yauzl"));
9
10
  const xpi_1 = require("./xpi");
@@ -25,7 +26,6 @@ function defaultParseCRX(buf) {
25
26
  }
26
27
  throw new Error('Unexpected crx format version number.');
27
28
  }
28
- exports.defaultParseCRX = defaultParseCRX;
29
29
  /*
30
30
  * A CRX file is just a ZIP file (eg an XPI) with some extra header
31
31
  * information. We handle opening the file with a CRX parser, then treat it
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import { Readable } from 'stream';
4
2
  import { IOBase, IOBaseConstructorParams } from './base';
5
3
  import { walkPromise } from './utils';
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import fs from 'fs';
3
2
  import { Stderr } from '../stdio';
4
3
  export declare const lstat: typeof fs.lstat.__promisify__;
package/dist/io/utils.js CHANGED
@@ -12,7 +12,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.checkFileExists = exports.walkPromise = exports.readdir = exports.readFile = exports.lstat = void 0;
15
+ exports.readdir = exports.readFile = exports.lstat = void 0;
16
+ exports.walkPromise = walkPromise;
17
+ exports.checkFileExists = checkFileExists;
16
18
  const fs_1 = __importDefault(require("fs"));
17
19
  const path_1 = __importDefault(require("path"));
18
20
  const util_1 = require("util");
@@ -50,7 +52,6 @@ function walkPromise(curPath, { shouldIncludePath = () => true, stderr }) {
50
52
  };
51
53
  return walk(curPath);
52
54
  }
53
- exports.walkPromise = walkPromise;
54
55
  function checkFileExists(filePath_1) {
55
56
  return __awaiter(this, arguments, void 0, function* (filePath, { _lstat = exports.lstat } = {}) {
56
57
  const invalidMessage = new Error(`Path "${filePath}" is not a file or directory or does not exist.`);
@@ -69,4 +70,3 @@ function checkFileExists(filePath_1) {
69
70
  throw invalidMessage;
70
71
  });
71
72
  }
72
- exports.checkFileExists = checkFileExists;
package/dist/io/xpi.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import { Readable } from 'stream';
4
2
  import yauzl, { Entry, ZipFile } from 'yauzl';
5
3
  import { IOBaseConstructorParams, IOBase } from './base';
package/dist/io/xpi.js CHANGED
@@ -157,12 +157,13 @@ class Xpi extends base_1.IOBase {
157
157
  return __awaiter(this, void 0, void 0, function* () {
158
158
  const fileStream = yield this.getFileAsStream(path);
159
159
  return new Promise((resolve, reject) => {
160
- let buf = Buffer.from('');
160
+ const chunks = [];
161
161
  fileStream.on('data', (chunk) => {
162
- buf = Buffer.concat([buf, chunk]);
162
+ chunks.push(chunk);
163
163
  });
164
164
  // Once the file is assembled, resolve the promise.
165
165
  fileStream.on('end', () => {
166
+ const buf = Buffer.concat(chunks);
166
167
  const fileString = buf.toString('utf8');
167
168
  resolve(fileString);
168
169
  });
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Readable } from 'stream';
3
2
  import { ZipFile, RandomAccessReader } from 'yauzl';
4
3
  import { Stderr, Stdout } from './stdio';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "addons-scanner-utils",
3
- "version": "9.11.0",
3
+ "version": "9.12.0",
4
4
  "description": "Various addons related helpers to build CLIs.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -18,8 +18,8 @@
18
18
  "yauzl": "2.10.0"
19
19
  },
20
20
  "peerDependencies": {
21
- "body-parser": "1.20.2",
22
- "express": "4.19.2",
21
+ "body-parser": "1.20.3",
22
+ "express": "4.21.0",
23
23
  "node-fetch": "2.6.11",
24
24
  "safe-compare": "1.1.4"
25
25
  },
@@ -41,26 +41,26 @@
41
41
  "@types/common-tags": "^1.8.0",
42
42
  "@types/express": "4.17.21",
43
43
  "@types/jest": "^29.0.0",
44
- "@types/node": "^20.1.1",
44
+ "@types/node": "^22.0.0",
45
45
  "@types/node-fetch": "^2.6.4",
46
46
  "@types/safe-compare": "^1.1.0",
47
47
  "@types/sinon": "^17.0.1",
48
48
  "@types/supertest": "^6.0.2",
49
49
  "@typescript-eslint/eslint-plugin": "^7.0.0",
50
50
  "@typescript-eslint/parser": "^6.7.0",
51
- "body-parser": "1.20.2",
51
+ "body-parser": "1.20.3",
52
52
  "eslint": "^8.1.0",
53
53
  "eslint-config-amo": "^5.0.0",
54
54
  "eslint-plugin-amo": "^1.10.2",
55
- "express": "4.19.2",
55
+ "express": "4.21.0",
56
56
  "jest": "^29.0.0",
57
57
  "node-fetch": "2.6.11",
58
58
  "prettier": "2.8.8",
59
59
  "pretty-quick": "^3.0.0",
60
60
  "rimraf": "^5.0.0",
61
61
  "safe-compare": "1.1.4",
62
- "sinon": "^18.0.0",
63
- "supertest": "^6.0.0",
62
+ "sinon": "^19.0.2",
63
+ "supertest": "^7.0.0",
64
64
  "ts-jest": "^29.0.0",
65
65
  "type-coverage": "^2.3.0",
66
66
  "typescript": "^5.0.2"