jscrambler 6.1.2 → 6.1.5
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/client.js +6 -0
- package/dist/index.js +11 -4
- package/dist/zip.js +21 -41
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -63,6 +63,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
|
|
|
63
63
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
64
64
|
|
|
65
65
|
var debug = !!process.env.DEBUG;
|
|
66
|
+
var metrics = !!process.env.METRICS;
|
|
66
67
|
|
|
67
68
|
var ClientError = /*#__PURE__*/function (_Error) {
|
|
68
69
|
_inherits(ClientError, _Error);
|
|
@@ -294,7 +295,12 @@ JScramblerClient.prototype.request = function (method, path) {
|
|
|
294
295
|
promise = this.axiosInstance[method.toLowerCase()](formattedUrl, data, settings);
|
|
295
296
|
}
|
|
296
297
|
|
|
298
|
+
var start = Date.now();
|
|
297
299
|
return promise.then(function (res) {
|
|
300
|
+
if (metrics || debug) {
|
|
301
|
+
console.log("".concat(method, " ").concat(path, " ").concat(((data || settings.params).query || '').split('(')[0].trim().replace(' ', '-'), " ").concat(JSON.stringify(data || settings.params).length, "B ").concat(Date.now() - start, "ms"));
|
|
302
|
+
}
|
|
303
|
+
|
|
298
304
|
return res.data;
|
|
299
305
|
}).catch(function (err) {
|
|
300
306
|
var errorMessage = 'Unexpected Response: ';
|
package/dist/index.js
CHANGED
|
@@ -172,7 +172,7 @@ var _default = {
|
|
|
172
172
|
switch (_context.prev = _context.next) {
|
|
173
173
|
case 0:
|
|
174
174
|
sources = _ref.sources, filesSrc = _ref.filesSrc, cwd = _ref.cwd, appProfiling = _ref.appProfiling;
|
|
175
|
-
promise =
|
|
175
|
+
promise = Promise.resolve();
|
|
176
176
|
|
|
177
177
|
if (!(sources || filesSrc && filesSrc.length)) {
|
|
178
178
|
_context.next = 6;
|
|
@@ -241,7 +241,12 @@ var _default = {
|
|
|
241
241
|
|
|
242
242
|
_context.next = 23;
|
|
243
243
|
return zipped.generateAsync({
|
|
244
|
-
type: 'base64'
|
|
244
|
+
type: 'base64',
|
|
245
|
+
compression: 'DEFLATE',
|
|
246
|
+
compressionOptions: {
|
|
247
|
+
// 1 - 9 (max compression)
|
|
248
|
+
level: 5
|
|
249
|
+
}
|
|
245
250
|
});
|
|
246
251
|
|
|
247
252
|
case 23:
|
|
@@ -256,11 +261,13 @@ var _default = {
|
|
|
256
261
|
filename: 'application.zip',
|
|
257
262
|
extension: 'zip'
|
|
258
263
|
};
|
|
259
|
-
promise.then(function (removeRes) {
|
|
264
|
+
promise = promise.then(function (removeRes) {
|
|
260
265
|
errorHandler(removeRes);
|
|
261
266
|
return _this.addApplicationSource(client, applicationId, source);
|
|
262
267
|
}).then(errorHandler).catch(function (e) {
|
|
263
|
-
|
|
268
|
+
if (debug) {
|
|
269
|
+
console.warn("Warning: Update application sources failed with ".concat(e.message));
|
|
270
|
+
}
|
|
264
271
|
});
|
|
265
272
|
|
|
266
273
|
case 27:
|
package/dist/zip.js
CHANGED
|
@@ -53,7 +53,7 @@ function zip(_x, _x2) {
|
|
|
53
53
|
|
|
54
54
|
function _zip() {
|
|
55
55
|
_zip = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(files, cwd) {
|
|
56
|
-
var deferred, hasFiles, _zip2, zipFile, _zip3, i, l, buffer, name, sPath
|
|
56
|
+
var deferred, hasFiles, _zip2, zipFile, _zip3, i, l, buffer, name, sPath;
|
|
57
57
|
|
|
58
58
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
59
59
|
while (1) {
|
|
@@ -70,32 +70,29 @@ function _zip() {
|
|
|
70
70
|
|
|
71
71
|
|
|
72
72
|
if (!(files.length === 1 && /^.*\.zip$/.test(files[0]))) {
|
|
73
|
-
_context.next =
|
|
73
|
+
_context.next = 14;
|
|
74
74
|
break;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
hasFiles = true;
|
|
78
78
|
_zip2 = new _jszip.default();
|
|
79
79
|
zipFile = (0, _fsExtra.readFileSync)(files[0]);
|
|
80
|
-
|
|
81
|
-
suffix: '.zip'
|
|
82
|
-
}).path, zipFile);
|
|
83
|
-
_context.next = 11;
|
|
80
|
+
_context.next = 10;
|
|
84
81
|
return _zip2.loadAsync(zipFile);
|
|
85
82
|
|
|
86
|
-
case
|
|
83
|
+
case 10:
|
|
87
84
|
zipFile = _context.sent;
|
|
88
85
|
deferred.resolve(zipFile);
|
|
89
|
-
_context.next =
|
|
86
|
+
_context.next = 31;
|
|
90
87
|
break;
|
|
91
88
|
|
|
92
|
-
case
|
|
89
|
+
case 14:
|
|
93
90
|
_zip3 = new _jszip.default();
|
|
94
91
|
i = 0, l = files.length;
|
|
95
92
|
|
|
96
|
-
case
|
|
93
|
+
case 16:
|
|
97
94
|
if (!(i < l)) {
|
|
98
|
-
_context.next =
|
|
95
|
+
_context.next = 28;
|
|
99
96
|
break;
|
|
100
97
|
}
|
|
101
98
|
|
|
@@ -110,13 +107,13 @@ function _zip() {
|
|
|
110
107
|
|
|
111
108
|
|
|
112
109
|
if (!/.*\.(git|hg)(\/.*|$)/.test(files[i].path || files[i])) {
|
|
113
|
-
_context.next =
|
|
110
|
+
_context.next = 20;
|
|
114
111
|
break;
|
|
115
112
|
}
|
|
116
113
|
|
|
117
|
-
return _context.abrupt("continue",
|
|
114
|
+
return _context.abrupt("continue", 25);
|
|
118
115
|
|
|
119
|
-
case
|
|
116
|
+
case 20:
|
|
120
117
|
buffer = void 0, name = void 0;
|
|
121
118
|
sPath = void 0;
|
|
122
119
|
|
|
@@ -150,43 +147,26 @@ function _zip() {
|
|
|
150
147
|
_zip3.file(name, buffer);
|
|
151
148
|
}
|
|
152
149
|
|
|
153
|
-
case
|
|
150
|
+
case 25:
|
|
154
151
|
++i;
|
|
155
|
-
_context.next =
|
|
152
|
+
_context.next = 16;
|
|
156
153
|
break;
|
|
157
154
|
|
|
158
|
-
case
|
|
159
|
-
if (
|
|
160
|
-
_context.next =
|
|
155
|
+
case 28:
|
|
156
|
+
if (hasFiles) {
|
|
157
|
+
_context.next = 30;
|
|
161
158
|
break;
|
|
162
159
|
}
|
|
163
160
|
|
|
164
|
-
tempFile = _temp.default.openSync({
|
|
165
|
-
suffix: '.zip'
|
|
166
|
-
});
|
|
167
|
-
_context.t0 = _fsExtra.outputFileSync;
|
|
168
|
-
_context.t1 = tempFile.path;
|
|
169
|
-
_context.next = 35;
|
|
170
|
-
return _zip3.generateAsync({
|
|
171
|
-
type: 'nodebuffer'
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
case 35:
|
|
175
|
-
_context.t2 = _context.sent;
|
|
176
|
-
(0, _context.t0)(_context.t1, _context.t2);
|
|
177
|
-
files[0] = tempFile.path;
|
|
178
|
-
files.length = 1;
|
|
179
|
-
deferred.resolve(_zip3);
|
|
180
|
-
_context.next = 43;
|
|
181
|
-
break;
|
|
182
|
-
|
|
183
|
-
case 42:
|
|
184
161
|
throw new Error('No source files found. If you intend to send a whole directory sufix your path with "**" (e.g. ./my-directory/**)');
|
|
185
162
|
|
|
186
|
-
case
|
|
163
|
+
case 30:
|
|
164
|
+
deferred.resolve(_zip3);
|
|
165
|
+
|
|
166
|
+
case 31:
|
|
187
167
|
return _context.abrupt("return", deferred.promise);
|
|
188
168
|
|
|
189
|
-
case
|
|
169
|
+
case 32:
|
|
190
170
|
case "end":
|
|
191
171
|
return _context.stop();
|
|
192
172
|
}
|