addons-scanner-utils 4.11.0 → 6.2.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.
- package/dist/const.d.ts +1 -1
- package/dist/const.js +1 -1
- package/dist/errors.d.ts +6 -0
- package/dist/errors.js +16 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/io/xpi.js +17 -3
- package/package.json +9 -10
package/dist/const.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const ECMA_VERSION =
|
|
1
|
+
export declare const ECMA_VERSION = 13;
|
package/dist/const.js
CHANGED
package/dist/errors.d.ts
ADDED
package/dist/errors.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable max-classes-per-file */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.DuplicateZipEntryError = exports.InvalidZipFileError = void 0;
|
|
5
|
+
class InvalidZipFileError extends Error {
|
|
6
|
+
get name() {
|
|
7
|
+
return 'InvalidZipFileError';
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.InvalidZipFileError = InvalidZipFileError;
|
|
11
|
+
class DuplicateZipEntryError extends Error {
|
|
12
|
+
get name() {
|
|
13
|
+
return 'DuplicateZipFileEntry';
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.DuplicateZipEntryError = DuplicateZipEntryError;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/io/xpi.js
CHANGED
|
@@ -18,6 +18,7 @@ const first_chunk_stream_1 = __importDefault(require("first-chunk-stream"));
|
|
|
18
18
|
const strip_bom_stream_1 = __importDefault(require("strip-bom-stream"));
|
|
19
19
|
const common_tags_1 = require("common-tags");
|
|
20
20
|
const base_1 = require("./base");
|
|
21
|
+
const errors_1 = require("../errors");
|
|
21
22
|
/*
|
|
22
23
|
* Simple Promise wrapper for the Yauzl unzipping lib to unpack add-on .xpis.
|
|
23
24
|
*
|
|
@@ -43,7 +44,17 @@ class Xpi extends base_1.IOBase {
|
|
|
43
44
|
resolve(this.zipfile);
|
|
44
45
|
return;
|
|
45
46
|
}
|
|
46
|
-
this.zipLib.open(this.path, {
|
|
47
|
+
this.zipLib.open(this.path, {
|
|
48
|
+
autoClose: this.autoClose,
|
|
49
|
+
// Enable checks on invalid chars in zip entries filenames.
|
|
50
|
+
strictFileNames: true,
|
|
51
|
+
// Decode automatically filenames and zip entries content from buffer into strings
|
|
52
|
+
// and autodetects their encoding.
|
|
53
|
+
//
|
|
54
|
+
// NOTE: this is also mandatory because without this option set to true
|
|
55
|
+
// strictFileNames option is ignored.
|
|
56
|
+
decodeStrings: true,
|
|
57
|
+
}, (err, zipfile) => {
|
|
47
58
|
if (err) {
|
|
48
59
|
return reject(err);
|
|
49
60
|
}
|
|
@@ -63,8 +74,8 @@ class Xpi extends base_1.IOBase {
|
|
|
63
74
|
if (this.entries.includes(entry.fileName)) {
|
|
64
75
|
this.stderr.info((0, common_tags_1.oneLine) `found duplicate file entry: "${entry.fileName}"
|
|
65
76
|
in package`);
|
|
66
|
-
reject(new
|
|
67
|
-
|
|
77
|
+
reject(new errors_1.DuplicateZipEntryError((0, common_tags_1.oneLine) `Entry "${entry.fileName}" has already
|
|
78
|
+
been seen`));
|
|
68
79
|
return;
|
|
69
80
|
}
|
|
70
81
|
this.entries.push(entry.fileName);
|
|
@@ -88,6 +99,9 @@ class Xpi extends base_1.IOBase {
|
|
|
88
99
|
}
|
|
89
100
|
const zipfile = yield this.open();
|
|
90
101
|
return new Promise((resolve, reject) => {
|
|
102
|
+
zipfile.on('error', (err) => {
|
|
103
|
+
reject(new errors_1.InvalidZipFileError(err.message));
|
|
104
|
+
});
|
|
91
105
|
zipfile.on('entry', (entry) => {
|
|
92
106
|
this.handleEntry(entry, reject);
|
|
93
107
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "addons-scanner-utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"description": "Various addons related helpers to build CLIs.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"license": "MPL-2.0",
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@types/yauzl": "2.9.2",
|
|
14
|
-
"common-tags": "1.8.
|
|
14
|
+
"common-tags": "1.8.2",
|
|
15
15
|
"first-chunk-stream": "3.0.0",
|
|
16
16
|
"strip-bom-stream": "4.0.0",
|
|
17
17
|
"upath": "2.0.1",
|
|
@@ -33,21 +33,20 @@
|
|
|
33
33
|
"@types/safe-compare": "^1.1.0",
|
|
34
34
|
"@types/sinon": "^10.0.0",
|
|
35
35
|
"@types/supertest": "^2.0.8",
|
|
36
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
37
|
-
"@typescript-eslint/parser": "^
|
|
36
|
+
"@typescript-eslint/eslint-plugin": "^5.0.0",
|
|
37
|
+
"@typescript-eslint/parser": "^5.0.0",
|
|
38
38
|
"body-parser": "1.19.0",
|
|
39
|
-
"codecov": "^3.5.0",
|
|
40
39
|
"download": "8.0.0",
|
|
41
|
-
"eslint": "^
|
|
42
|
-
"eslint-config-amo": "^
|
|
40
|
+
"eslint": "^8.1.0",
|
|
41
|
+
"eslint-config-amo": "^5.0.0",
|
|
43
42
|
"eslint-plugin-amo": "^1.10.2",
|
|
44
43
|
"express": "4.17.1",
|
|
45
44
|
"jest": "^27.0.0",
|
|
46
|
-
"prettier": "2.
|
|
45
|
+
"prettier": "2.5.1",
|
|
47
46
|
"pretty-quick": "^3.0.0",
|
|
48
47
|
"rimraf": "^3.0.0",
|
|
49
48
|
"safe-compare": "1.1.4",
|
|
50
|
-
"sinon": "^
|
|
49
|
+
"sinon": "^12.0.0",
|
|
51
50
|
"supertest": "^6.0.0",
|
|
52
51
|
"ts-jest": "^27.0.0",
|
|
53
52
|
"type-coverage": "^2.3.0",
|
|
@@ -61,7 +60,7 @@
|
|
|
61
60
|
"prettier-ci": "prettier --list-different '**' || (echo '\n\nThis failure means you did not run `yarn prettier-dev` before committing\n\n' && exit 1)",
|
|
62
61
|
"prettier-dev": "pretty-quick --branch master",
|
|
63
62
|
"test": "jest",
|
|
64
|
-
"test-ci": "yarn test --coverage
|
|
63
|
+
"test-ci": "yarn test --coverage",
|
|
65
64
|
"type-coverage": "type-coverage",
|
|
66
65
|
"typecheck": "tsc --noEmit"
|
|
67
66
|
},
|