@coherentglobal/wasm-runner 0.1.4 → 0.2.4
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/README.md +137 -222
- package/dist/CancellationToken.js +2 -0
- package/dist/CancellationToken.js.map +1 -1
- package/dist/browser/logger.js +6 -2
- package/dist/browser/logger.js.map +1 -1
- package/dist/browser/template/main.template.js +1 -1
- package/dist/browser/template/main.template.js.map +1 -1
- package/dist/browser/template/worker.template.js +117 -108
- package/dist/browser/template/worker.template.js.map +1 -1
- package/dist/browser/template.js +2 -2
- package/dist/browser/template.js.map +1 -1
- package/dist/browser.d.ts +5 -5
- package/dist/browser.js +242 -257
- package/dist/browser.js.map +1 -1
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +2 -0
- package/dist/constants.js.map +1 -1
- package/dist/defaultExternalResolver.js +6 -15
- package/dist/defaultExternalResolver.js.map +1 -1
- package/dist/error.d.ts +5 -0
- package/dist/error.js +23 -5
- package/dist/error.js.map +1 -1
- package/dist/node/logger.d.ts +2 -1
- package/dist/node/logger.js +2 -2
- package/dist/node/logger.js.map +1 -1
- package/dist/node/logger.ts +2 -2
- package/dist/node/mockLogger.d.ts +2 -1
- package/dist/node/template/main.template.ejs +108 -69
- package/dist/node/threads/mockWorkerThread.d.ts +1 -0
- package/dist/node/threads/mockWorkerThread.js +10 -3
- package/dist/node/threads/mockWorkerThread.js.map +1 -1
- package/dist/node/threads/workerPool.d.ts +4 -5
- package/dist/node/threads/workerPool.js +8 -11
- package/dist/node/threads/workerPool.js.map +1 -1
- package/dist/node/threads/workerPool.ts +15 -10
- package/dist/node/threads/workerThread.d.ts +2 -2
- package/dist/node/threads/workerThread.js +36 -35
- package/dist/node/threads/workerThread.js.map +1 -1
- package/dist/node/threads/workerThread.ts +28 -25
- package/dist/node.d.ts +32 -7
- package/dist/node.js +602 -331
- package/dist/node.js.map +1 -1
- package/dist/responseTimeMetric.d.ts +20 -0
- package/dist/responseTimeMetric.js +159 -0
- package/dist/responseTimeMetric.js.map +1 -0
- package/dist/serializer/columnarSerializer.d.ts +9 -0
- package/dist/serializer/columnarSerializer.js +59 -30
- package/dist/serializer/columnarSerializer.js.map +1 -1
- package/dist/types.d.ts +36 -2
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +3 -1
- package/dist/utils.js +53 -59
- package/dist/utils.js.map +1 -1
- package/package.json +74 -60
package/dist/utils.js
CHANGED
|
@@ -1,96 +1,92 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
14
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
exports.formatMemory = exports.isEmpty = exports.ENVIRONMENT_IS_NODE = exports.ENVIRONMENT_IS_WEB = void 0;
|
|
7
|
+
exports.isPath = isPath;
|
|
8
|
+
exports.isHttpURL = isHttpURL;
|
|
9
|
+
exports.isFilePath = isFilePath;
|
|
10
|
+
exports.isBrowser = isBrowser;
|
|
11
|
+
exports.isWasmSupported = isWasmSupported;
|
|
12
|
+
exports.isWorkerSupported = isWorkerSupported;
|
|
13
|
+
exports.isCompatible = isCompatible;
|
|
14
|
+
exports.jsString2workerURL = jsString2workerURL;
|
|
15
|
+
exports.fn2workerURL = fn2workerURL;
|
|
16
|
+
exports.addScript = addScript;
|
|
17
|
+
exports.last = last;
|
|
18
|
+
exports.isV3Input = isV3Input;
|
|
19
|
+
exports.getSafeJSONObject = getSafeJSONObject;
|
|
20
|
+
exports.getSafeJSONString = getSafeJSONString;
|
|
21
|
+
exports.isNumber = isNumber;
|
|
18
22
|
const error_1 = __importDefault(require("./error"));
|
|
19
23
|
exports.ENVIRONMENT_IS_WEB = typeof window === "object";
|
|
20
24
|
exports.ENVIRONMENT_IS_NODE = typeof process === "object" &&
|
|
21
25
|
typeof process.versions === "object" &&
|
|
22
26
|
typeof process.versions.node === "string";
|
|
23
|
-
function isPath(str) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
27
|
+
async function isPath(str) {
|
|
28
|
+
// In browser environment, this always returns false
|
|
29
|
+
if (exports.ENVIRONMENT_IS_WEB) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
// For Node.js environment only
|
|
33
|
+
// This check prevents webpack from trying to bundle fs in browser builds
|
|
34
|
+
if (typeof require === "undefined") {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
// Use eval to prevent webpack from statically analyzing this require
|
|
39
|
+
const fs = eval("require")("fs");
|
|
40
|
+
const stats = await fs.promises.stat(str);
|
|
41
|
+
return stats.isFile();
|
|
42
|
+
}
|
|
43
|
+
catch (_err) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
33
46
|
}
|
|
34
|
-
exports.isPath = isPath;
|
|
35
47
|
/* istanbul ignore next */
|
|
36
48
|
function isHttpURL(str) {
|
|
37
|
-
let urlInstance;
|
|
38
49
|
try {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (exports.ENVIRONMENT_IS_WEB) {
|
|
43
|
-
urlInstance = new URL(str);
|
|
44
|
-
}
|
|
50
|
+
// Both Node.js and browser support URL constructor
|
|
51
|
+
const urlInstance = new URL(str);
|
|
52
|
+
return (urlInstance.protocol === "http:" || urlInstance.protocol === "https:");
|
|
45
53
|
}
|
|
46
|
-
catch (
|
|
54
|
+
catch (_err) {
|
|
47
55
|
return false;
|
|
48
56
|
}
|
|
49
|
-
return urlInstance.protocol === "http:" || urlInstance.protocol === "https:";
|
|
50
57
|
}
|
|
51
|
-
exports.isHttpURL = isHttpURL;
|
|
52
58
|
/* istanbul ignore next */
|
|
53
59
|
function isFilePath(str, ext) {
|
|
54
60
|
const idx = str.indexOf(`.${ext}`);
|
|
55
61
|
return idx > -1 && idx === str.length - `.${ext}`.length;
|
|
56
62
|
}
|
|
57
|
-
exports.isFilePath = isFilePath;
|
|
58
63
|
/* istanbul ignore next */
|
|
59
64
|
function isBrowser() {
|
|
60
65
|
try {
|
|
61
|
-
// eslint-disable-next-line no-undef
|
|
62
66
|
return window;
|
|
63
67
|
}
|
|
64
|
-
catch (
|
|
68
|
+
catch (_e) {
|
|
65
69
|
return false;
|
|
66
70
|
}
|
|
67
71
|
}
|
|
68
|
-
exports.isBrowser = isBrowser;
|
|
69
72
|
/* istanbul ignore next */
|
|
70
73
|
function isWasmSupported() {
|
|
71
74
|
try {
|
|
72
75
|
if (typeof WebAssembly === "object" &&
|
|
73
|
-
// eslint-disable-next-line no-undef
|
|
74
76
|
typeof WebAssembly.instantiate === "function") {
|
|
75
|
-
// eslint-disable-next-line no-undef
|
|
76
77
|
const module = new WebAssembly.Module(Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00));
|
|
77
|
-
// eslint-disable-next-line no-undef
|
|
78
78
|
if (module instanceof WebAssembly.Module)
|
|
79
|
-
// eslint-disable-next-line no-undef
|
|
80
79
|
return new WebAssembly.Instance(module) instanceof WebAssembly.Instance;
|
|
81
80
|
}
|
|
82
81
|
// eslint-disable-next-line no-empty
|
|
83
82
|
}
|
|
84
|
-
catch (
|
|
83
|
+
catch (_e) { }
|
|
85
84
|
return false;
|
|
86
85
|
}
|
|
87
|
-
exports.isWasmSupported = isWasmSupported;
|
|
88
86
|
/* istanbul ignore next */
|
|
89
87
|
function isWorkerSupported() {
|
|
90
|
-
// eslint-disable-next-line no-undef
|
|
91
88
|
return window.Worker;
|
|
92
89
|
}
|
|
93
|
-
exports.isWorkerSupported = isWorkerSupported;
|
|
94
90
|
/* istanbul ignore next */
|
|
95
91
|
function isCompatible() {
|
|
96
92
|
if (!isBrowser()) {
|
|
@@ -103,58 +99,48 @@ function isCompatible() {
|
|
|
103
99
|
throw new error_1.default.NotSupportedError("Web Worker");
|
|
104
100
|
}
|
|
105
101
|
}
|
|
106
|
-
exports.isCompatible = isCompatible;
|
|
107
102
|
/* istanbul ignore next */
|
|
108
103
|
function jsString2workerURL(str) {
|
|
109
|
-
// eslint-disable-next-line no-undef
|
|
110
104
|
const blob = new Blob([str], { type: "text/javascript" });
|
|
111
105
|
return URL.createObjectURL(blob);
|
|
112
106
|
}
|
|
113
|
-
exports.jsString2workerURL = jsString2workerURL;
|
|
114
107
|
function fn2workerURL(fn) {
|
|
115
|
-
// eslint-disable-next-line no-undef
|
|
116
108
|
const blob = new Blob([`(${fn.toString()})()`], {
|
|
117
109
|
type: "text/javascript",
|
|
118
110
|
});
|
|
119
111
|
return URL.createObjectURL(blob);
|
|
120
112
|
}
|
|
121
|
-
exports.fn2workerURL = fn2workerURL;
|
|
122
113
|
/* istanbul ignore next */
|
|
123
114
|
const isEmpty = (obj) => [Object, Array].includes((obj || {}).constructor) &&
|
|
124
115
|
!Object.entries(obj || {}).length;
|
|
125
116
|
exports.isEmpty = isEmpty;
|
|
126
117
|
/* istanbul ignore next */
|
|
127
118
|
function addScript(src) {
|
|
128
|
-
// eslint-disable-next-line no-undef
|
|
129
119
|
const s = document.createElement("script");
|
|
130
120
|
s.setAttribute("src", src);
|
|
131
121
|
s.setAttribute("async", "true");
|
|
132
|
-
// eslint-disable-next-line no-undef
|
|
133
122
|
document.body.appendChild(s);
|
|
134
123
|
}
|
|
135
|
-
exports.addScript = addScript;
|
|
136
124
|
/* istanbul ignore next */
|
|
137
125
|
function last(arr) {
|
|
138
126
|
if (!Array.isArray(arr)) {
|
|
139
127
|
throw new Error("Argument is not array");
|
|
140
128
|
}
|
|
141
|
-
const length = arr
|
|
129
|
+
const { length } = arr;
|
|
142
130
|
if (length === 0) {
|
|
143
131
|
return undefined;
|
|
144
132
|
}
|
|
145
133
|
return arr[length - 1];
|
|
146
134
|
}
|
|
147
|
-
exports.last = last;
|
|
148
135
|
/* istanbul ignore next */
|
|
149
136
|
function isV3Input(input) {
|
|
150
137
|
let isV3 = false;
|
|
151
|
-
if (
|
|
138
|
+
if (Object.prototype.hasOwnProperty.call(input, "request_data") &&
|
|
152
139
|
!Array.isArray(input.request_data.inputs)) {
|
|
153
140
|
isV3 = true;
|
|
154
141
|
}
|
|
155
142
|
return isV3;
|
|
156
143
|
}
|
|
157
|
-
exports.isV3Input = isV3Input;
|
|
158
144
|
/**
|
|
159
145
|
* Ensures that the value you'll get is a JSON object.
|
|
160
146
|
*
|
|
@@ -170,7 +156,6 @@ exports.isV3Input = isV3Input;
|
|
|
170
156
|
function getSafeJSONObject(data) {
|
|
171
157
|
return typeof data === "string" ? JSON.parse(data) : data;
|
|
172
158
|
}
|
|
173
|
-
exports.getSafeJSONObject = getSafeJSONObject;
|
|
174
159
|
/**
|
|
175
160
|
* Ensures that the value you'll get is stringified JSON object.
|
|
176
161
|
*
|
|
@@ -186,5 +171,14 @@ exports.getSafeJSONObject = getSafeJSONObject;
|
|
|
186
171
|
function getSafeJSONString(data) {
|
|
187
172
|
return typeof data === "object" ? JSON.stringify(data) : data;
|
|
188
173
|
}
|
|
189
|
-
|
|
174
|
+
const MB = 1024 * 1024;
|
|
175
|
+
const formatMemory = (usage) => {
|
|
176
|
+
// # bytes / KB / MB
|
|
177
|
+
const exactUsage = usage / MB;
|
|
178
|
+
return Math.round(exactUsage * 100) / 100;
|
|
179
|
+
};
|
|
180
|
+
exports.formatMemory = formatMemory;
|
|
181
|
+
function isNumber(value) {
|
|
182
|
+
return typeof value === "number" && !Number.isNaN(value);
|
|
183
|
+
}
|
|
190
184
|
//# sourceMappingURL=utils.js.map
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;AAQA,wBAoBC;AAGD,8BAUC;AAGD,gCAGC;AAGD,8BAMC;AAGD,0CAgBC;AAGD,8CAEC;AAGD,oCAcC;AAGD,gDAGC;AAED,oCAKC;AAQD,8BAMC;AAGD,oBAYC;AAGD,8BASC;AAcD,8CAEC;AAcD,8CAEC;AAUD,4BAEC;AAnMD,oDAAuC;AAE1B,QAAA,kBAAkB,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC;AAChD,QAAA,mBAAmB,GAC9B,OAAO,OAAO,KAAK,QAAQ;IAC3B,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ;IACpC,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,KAAK,QAAQ,CAAC;AAErC,KAAK,UAAU,MAAM,CAAC,GAAW;IACtC,oDAAoD;IACpD,IAAI,0BAAkB,EAAE,CAAC;QACvB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,+BAA+B;IAC/B,yEAAyE;IACzE,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE,CAAC;QACnC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,CAAC;QACH,qEAAqE;QACrE,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC;QACjC,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,QAAQ,CA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AI,CAAC;AACd,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,iBAAiB,CAAC,IAAS;IACzC,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5D,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,iBAAiB,CAAC,IAAS;IACzC,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAChE,CAAC;AAED,MAAM,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAEhB,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,EAAE;IACpC,qCAAqC;IACrC,MAAM,UAAU,GAAG,KAAK,GAAG,EAAE,CAAC;IAC9B,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AAC5C,CAAC,CAAC;AAJW,QAAA,YAAY,gBAIvB;AAEF,SAAgB,QAAQ,CAAC,KAAK;IAC5B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC3D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coherentglobal/wasm-runner",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Coherent WASM runner for Javascript and Node.js",
|
|
5
5
|
"main": "dist/node.js",
|
|
6
6
|
"browser": "dist/browser.js",
|
|
@@ -15,25 +15,27 @@
|
|
|
15
15
|
"format": "prettier --write .",
|
|
16
16
|
"build:ts": "tsc --declaration && cp -R ./src/node ./dist",
|
|
17
17
|
"build:template": "node tools/create-template.js",
|
|
18
|
-
"build": "
|
|
19
|
-
"bundle": "
|
|
18
|
+
"build": "npm run compress && npm run build:template && npm run build:ts",
|
|
19
|
+
"bundle": "npm run compress && npm run build:template && npm run bundle:full && npm run bundle:min",
|
|
20
20
|
"compress:runtime": "terser --compress --mangle --comments false src/browser/template/runtime.template.js > src/browser/template/runtime.template.min.js",
|
|
21
21
|
"compress:worker": "terser --compress --mangle --comments false src/browser/template/worker.template.js > src/browser/template/worker.template.min.js",
|
|
22
|
-
"compress": "
|
|
22
|
+
"compress": "npm run compress:runtime && npm run compress:worker",
|
|
23
23
|
"bundle:full": "browserify src/browser.ts --standalone CoherentGlobal -p [ tsify ] > lib/wasmrunner.js",
|
|
24
24
|
"bundle:min": "browserify src/browser.ts --standalone CoherentGlobal -p [ tsify ] | terser --compress --mangle --comments false > lib/wasmrunner.min.js",
|
|
25
|
-
"prep:samples:simple-html": "
|
|
26
|
-
"test:lcov": "
|
|
25
|
+
"prep:samples:simple-html": "npm run bundle && cp ./lib/wasmrunner.js example/simple-html/ && cp ./lib/wasmrunner.min.js example/simple-html/",
|
|
26
|
+
"test:lcov": "c8 --check-coverage --lines 30 --reporter=lcov npm run test",
|
|
27
27
|
"test:reporter": "NODE_ENV=test mocha -r ts-node/register tests/**/*.test.ts --bail --exit --recursive --timeout 100000 --reporter mocha-sonarqube-reporter tests --reporter-options output=./reports/test-reporter.xml",
|
|
28
|
-
"cover": "
|
|
28
|
+
"cover": "npm run test:lcov && npm run test:reporter",
|
|
29
29
|
"test": "cross-env NODE_ENV=test mocha -r ts-node/register tests/**/*.test.ts --bail --exit --recursive --timeout 100000 ",
|
|
30
30
|
"test:chrome": "cross-env BROWSER=chrome MODE=headless NODE_ENV=test mocha -r ts-node/register selenium/headless.test.js --bail --exit --recursive --timeout 100000",
|
|
31
31
|
"test:firefox": "cross-env BROWSER=firefox MODE=headless NODE_ENV=test mocha -r ts-node/register selenium/headless.test.js --bail --exit --recursive --timeout 100000",
|
|
32
32
|
"test:edge": "cross-env BROWSER=edge MODE=headless NODE_ENV=test mocha -r ts-node/register selenium/headless.test.js --bail --exit --recursive --timeout 100000",
|
|
33
33
|
"test:safari": "cross-env BROWSER=safari MODE=headless NODE_ENV=test mocha -r ts-node/register selenium/headless.test.js --bail --exit --recursive --timeout 100000",
|
|
34
|
-
"test:opera": "cross-env BROWSER=opera MODE=headless NODE_ENV=test mocha -r ts-node/register selenium/headless.test.js --bail --exit --recursive --timeout 100000"
|
|
34
|
+
"test:opera": "cross-env BROWSER=opera MODE=headless NODE_ENV=test mocha -r ts-node/register selenium/headless.test.js --bail --exit --recursive --timeout 100000",
|
|
35
|
+
"clean-up": "node scripts/cleanup.js",
|
|
36
|
+
"start:node": "cross-env NODE_ENV=test DEV_DEBUG_TMP_PATH=/tempZip ts-node ./example/nodejs-typescript/index.ts"
|
|
35
37
|
},
|
|
36
|
-
"
|
|
38
|
+
"c8": {
|
|
37
39
|
"exclude": [
|
|
38
40
|
"dist/",
|
|
39
41
|
"src/browser/logger.js",
|
|
@@ -41,72 +43,78 @@
|
|
|
41
43
|
"src/error.ts"
|
|
42
44
|
]
|
|
43
45
|
},
|
|
46
|
+
"resolutions": {
|
|
47
|
+
"brace-expansion": "2.0.2",
|
|
48
|
+
"form-data": "4.0.4",
|
|
49
|
+
"js-yaml": "4.1.1",
|
|
50
|
+
"glob": "11.1.0"
|
|
51
|
+
},
|
|
44
52
|
"devDependencies": {
|
|
45
|
-
"@babel/cli": "^7.
|
|
46
|
-
"@babel/core": "^7.
|
|
47
|
-
"@babel/eslint-parser": "^7.
|
|
48
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
49
|
-
"@babel/preset-env": "^7.
|
|
50
|
-
"@
|
|
51
|
-
"@
|
|
52
|
-
"@types/
|
|
53
|
-
"@types/
|
|
54
|
-
"@types/
|
|
55
|
-
"@types/
|
|
56
|
-
"@types/
|
|
53
|
+
"@babel/cli": "^7.28.3",
|
|
54
|
+
"@babel/core": "^7.28.5",
|
|
55
|
+
"@babel/eslint-parser": "^7.28.5",
|
|
56
|
+
"@babel/plugin-transform-runtime": "^7.28.5",
|
|
57
|
+
"@babel/preset-env": "^7.28.5",
|
|
58
|
+
"@eslint/eslintrc": "^3.2.0",
|
|
59
|
+
"@eslint/js": "^9.39.1",
|
|
60
|
+
"@types/isomorphic-fetch": "^0.0.39",
|
|
61
|
+
"@types/jest": "^30.0.0",
|
|
62
|
+
"@types/jsdom": "^27.0.0",
|
|
63
|
+
"@types/mocha": "^10.0.10",
|
|
64
|
+
"@types/sinon": "^21.0.0",
|
|
65
|
+
"@types/supertest": "^6.0.3",
|
|
66
|
+
"@typescript-eslint/eslint-plugin": "^8.47.0",
|
|
67
|
+
"@typescript-eslint/parser": "^8.47.0",
|
|
57
68
|
"babelify": "^10.0.0",
|
|
58
|
-
"browserify": "^17.0.
|
|
59
|
-
"
|
|
60
|
-
"
|
|
69
|
+
"browserify": "^17.0.1",
|
|
70
|
+
"c8": "^10.1.3",
|
|
71
|
+
"chai": "^6.2.1",
|
|
72
|
+
"chromedriver": "^142.0.2",
|
|
61
73
|
"cross-blob": "^3.0.2",
|
|
62
|
-
"cross-env": "^
|
|
63
|
-
"edgedriver": "^
|
|
64
|
-
"eslint": "^
|
|
65
|
-
"eslint-config-
|
|
66
|
-
"eslint-
|
|
67
|
-
"eslint-plugin-import": "^2.
|
|
68
|
-
"eslint-plugin-jsx-a11y": "^6.7.1",
|
|
74
|
+
"cross-env": "^10.1.0",
|
|
75
|
+
"edgedriver": "^6.1.2",
|
|
76
|
+
"eslint": "^9.39.1",
|
|
77
|
+
"eslint-config-prettier": "^10.1.8",
|
|
78
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
79
|
+
"eslint-plugin-import": "^2.32.0",
|
|
69
80
|
"eslint-plugin-node": "^11.1.0",
|
|
70
|
-
"eslint-plugin-prettier": "^
|
|
71
|
-
"
|
|
72
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
73
|
-
"geckodriver": "^4.0.1",
|
|
81
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
82
|
+
"geckodriver": "^6.0.2",
|
|
74
83
|
"isomorphic-blob": "^1.0.1",
|
|
75
84
|
"isomorphic-fetch": "^3.0.0",
|
|
76
|
-
"jest": "^
|
|
77
|
-
"jsdom": "^
|
|
78
|
-
"mocha": "^
|
|
85
|
+
"jest": "^30.2.0",
|
|
86
|
+
"jsdom": "^27.2.0",
|
|
87
|
+
"mocha": "^11.7.5",
|
|
79
88
|
"mocha-sonarqube-reporter": "^1.0.2",
|
|
80
|
-
"node-fetch": "^3.3.
|
|
81
|
-
"
|
|
82
|
-
"prettier": "^2.8.3",
|
|
89
|
+
"node-fetch": "^3.3.2",
|
|
90
|
+
"prettier": "^3.6.2",
|
|
83
91
|
"replace": "^1.2.2",
|
|
84
|
-
"selenium-webdriver": "^4.
|
|
92
|
+
"selenium-webdriver": "^4.38.0",
|
|
85
93
|
"should": "^13.2.3",
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"typescript": "^5.0.4"
|
|
94
|
+
"terser": "^5.44.1",
|
|
95
|
+
"ts-node": "^10.9.2",
|
|
96
|
+
"typescript": "^5.9.3"
|
|
90
97
|
},
|
|
91
98
|
"dependencies": {
|
|
92
|
-
"@babel/runtime": "^7.
|
|
93
|
-
"@paralleldrive/cuid2": "^2.2.
|
|
94
|
-
"@types/ejs": "^3.1.
|
|
99
|
+
"@babel/runtime": "^7.28.4",
|
|
100
|
+
"@paralleldrive/cuid2": "^2.2.2",
|
|
101
|
+
"@types/ejs": "^3.1.5",
|
|
95
102
|
"@types/got": "^9.6.12",
|
|
96
|
-
"@types/node": "
|
|
97
|
-
"@types/tmp": "^0.2.
|
|
98
|
-
"@types/unzipper": "^0.10.
|
|
99
|
-
"@types/worker-threads-pool": "^2.0.
|
|
100
|
-
"ejs": "^3.1.
|
|
103
|
+
"@types/node": "^24.10.1",
|
|
104
|
+
"@types/tmp": "^0.2.6",
|
|
105
|
+
"@types/unzipper": "^0.10.11",
|
|
106
|
+
"@types/worker-threads-pool": "^2.0.4",
|
|
107
|
+
"ejs": "^3.1.10",
|
|
101
108
|
"got": "11.8.6",
|
|
102
109
|
"is-buffer": "^2.0.5",
|
|
103
110
|
"memoizerific": "^1.11.3",
|
|
104
|
-
"pino": "^
|
|
105
|
-
"poolifier": "^
|
|
106
|
-
"
|
|
111
|
+
"pino": "^10.1.0",
|
|
112
|
+
"poolifier": "^5.1.7",
|
|
113
|
+
"semver": "^7.7.3",
|
|
114
|
+
"tmp": "^0.2.5",
|
|
107
115
|
"tsify": "^5.0.4",
|
|
108
|
-
"unzipit": "^1.4.
|
|
109
|
-
"unzipper": "^0.
|
|
116
|
+
"unzipit": "^1.4.3",
|
|
117
|
+
"unzipper": "^0.12.3"
|
|
110
118
|
},
|
|
111
119
|
"browserify": {
|
|
112
120
|
"transform": [
|
|
@@ -127,5 +135,11 @@
|
|
|
127
135
|
}
|
|
128
136
|
]
|
|
129
137
|
]
|
|
138
|
+
},
|
|
139
|
+
"overrides": {
|
|
140
|
+
"brace-expansion": "2.0.2",
|
|
141
|
+
"form-data": "4.0.4",
|
|
142
|
+
"glob": "11.1.0",
|
|
143
|
+
"js-yaml": "4.1.1"
|
|
130
144
|
}
|
|
131
|
-
}
|
|
145
|
+
}
|