camstreamerlib 2.0.0 → 2.0.2
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/CameraVapix.js +1 -1
- package/CreatePackage.js +19 -1
- package/WsClient.js +2 -0
- package/package.json +1 -1
package/CameraVapix.js
CHANGED
|
@@ -237,7 +237,7 @@ class CameraVapix extends eventemitter2_1.EventEmitter2 {
|
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
239
|
isReservedEventName(eventName) {
|
|
240
|
-
return eventName == 'eventsConnect' || eventName == 'eventsDisconnect' || eventName == '
|
|
240
|
+
return eventName == 'eventsConnect' || eventName == 'eventsDisconnect' || eventName == 'eventsClose';
|
|
241
241
|
}
|
|
242
242
|
getBaseVapixConnectionParams() {
|
|
243
243
|
return {
|
package/CreatePackage.js
CHANGED
|
@@ -3,10 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const AdmZip = require("adm-zip");
|
|
4
4
|
const Path = require("path");
|
|
5
5
|
const fs = require("fs");
|
|
6
|
+
const child_process_1 = require("child_process");
|
|
6
7
|
function isDirectory(path) {
|
|
7
8
|
const stat = fs.statSync(path);
|
|
8
9
|
return stat.isDirectory();
|
|
9
10
|
}
|
|
11
|
+
const productionModulesFolder = 'production_modules';
|
|
10
12
|
function getPackageVersion(folder) {
|
|
11
13
|
try {
|
|
12
14
|
const manifest = fs.readFileSync(Path.join(folder, 'manifest.json'));
|
|
@@ -25,7 +27,7 @@ function createZipArchive(zip, folder, options) {
|
|
|
25
27
|
const isDir = isDirectory(path);
|
|
26
28
|
if (file[0] === '.' ||
|
|
27
29
|
zipFileRegex.test(file) ||
|
|
28
|
-
|
|
30
|
+
file === 'node_modules' ||
|
|
29
31
|
(file === 'src' && options.typeScriptPackage) ||
|
|
30
32
|
options.excludedFileNames.includes(file)) {
|
|
31
33
|
continue;
|
|
@@ -33,6 +35,9 @@ function createZipArchive(zip, folder, options) {
|
|
|
33
35
|
else if (file === 'dist' && options.typeScriptPackage) {
|
|
34
36
|
zip.addLocalFolder(path);
|
|
35
37
|
}
|
|
38
|
+
else if (file === productionModulesFolder && options.includeNodeModules) {
|
|
39
|
+
zip.addLocalFolder(Path.join(productionModulesFolder, 'node_modules'), 'node_modules');
|
|
40
|
+
}
|
|
36
41
|
else if (isDir) {
|
|
37
42
|
zip.addLocalFolder(path, file);
|
|
38
43
|
}
|
|
@@ -41,6 +46,16 @@ function createZipArchive(zip, folder, options) {
|
|
|
41
46
|
}
|
|
42
47
|
}
|
|
43
48
|
}
|
|
49
|
+
function installDependencies() {
|
|
50
|
+
if (!fs.existsSync(productionModulesFolder)) {
|
|
51
|
+
fs.mkdirSync(productionModulesFolder, {});
|
|
52
|
+
}
|
|
53
|
+
fs.cpSync('package.json', Path.join(productionModulesFolder, 'package.json'));
|
|
54
|
+
fs.cpSync('package-lock.json', Path.join(productionModulesFolder, 'package-lock.json'));
|
|
55
|
+
(0, child_process_1.execSync)(`npm ci --omit=dev`, {
|
|
56
|
+
cwd: Path.join(process.cwd(), productionModulesFolder),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
44
59
|
function main(args) {
|
|
45
60
|
const options = {
|
|
46
61
|
includeNodeModules: false,
|
|
@@ -55,6 +70,9 @@ function main(args) {
|
|
|
55
70
|
options.excludedFileNames = arg.substring(arg.indexOf('=') + 1).split(',');
|
|
56
71
|
}
|
|
57
72
|
}
|
|
73
|
+
if (options.includeNodeModules) {
|
|
74
|
+
installDependencies();
|
|
75
|
+
}
|
|
58
76
|
if (fs.existsSync('dist')) {
|
|
59
77
|
options.typeScriptPackage = true;
|
|
60
78
|
}
|
package/WsClient.js
CHANGED
|
@@ -64,6 +64,8 @@ class WsClient extends EventEmitter {
|
|
|
64
64
|
}
|
|
65
65
|
this.ws.on('unexpected-response', (req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
66
66
|
if (res.statusCode === 401 && res.headers['www-authenticate'] !== undefined) {
|
|
67
|
+
this.ws.removeAllListeners();
|
|
68
|
+
clearInterval(this.pingTimer);
|
|
67
69
|
this.open(res.headers['www-authenticate']);
|
|
68
70
|
}
|
|
69
71
|
else {
|