jscrambler 6.2.8 → 6.3.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.
@@ -2,90 +2,62 @@
2
2
  "use strict";
3
3
 
4
4
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
5
-
6
5
  var _commander = _interopRequireDefault(require("commander"));
7
-
8
6
  var _lodash = _interopRequireDefault(require("lodash.defaults"));
9
-
10
7
  var _path = _interopRequireDefault(require("path"));
11
-
12
8
  var _filesizeParser = _interopRequireDefault(require("filesize-parser"));
13
-
14
9
  var _config3 = _interopRequireDefault(require("../config"));
15
-
16
10
  var _ = _interopRequireDefault(require("../"));
17
-
18
11
  var _utils = require("../utils");
19
-
20
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
-
22
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
23
-
13
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
24
14
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
25
-
26
15
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
27
-
28
16
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
29
-
30
17
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
31
-
32
18
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
33
-
34
19
  var debug = !!process.env.DEBUG;
35
-
36
20
  var validateBool = function validateBool(option) {
37
21
  return function (val) {
38
22
  if (!/^(true|false)$/i.test(val)) {
39
23
  console.error("*".concat(option, "* requires a <bool> value."));
40
24
  process.exit(1);
41
25
  }
42
-
43
26
  return val.toLowerCase();
44
27
  };
45
28
  };
46
-
47
29
  var validateCodeHardeningThreshold = function validateCodeHardeningThreshold(val) {
48
30
  var inBytes;
49
-
50
31
  try {
51
32
  inBytes = (0, _filesizeParser.default)(val);
52
33
  } catch (e) {
53
34
  console.error('*code-hardening-threshold* requires a valid <threshold> value. Format: {number}{unit="b,kb,mb"}. Example: --code-hardening-threshold 200kb');
54
35
  process.exit(1);
55
36
  }
56
-
57
37
  return inBytes;
58
38
  };
59
-
60
39
  var validateProfilingDataMode = function validateProfilingDataMode(mode) {
61
40
  var availableModes = ['automatic', 'annotations', 'off'];
62
41
  var normalizedMode = mode.toLowerCase();
63
-
64
42
  if (!availableModes.includes(normalizedMode)) {
65
43
  console.error("*profiling-data-mode* requires one of the following modes: {".concat(availableModes.toString(), "}. Example: --profiling-data-mode ").concat(availableModes[0]));
66
44
  process.exit(1);
67
45
  }
68
-
69
46
  return normalizedMode;
70
47
  };
71
-
72
48
  var availableEnvironments = ['node', 'browser', 'isomorphic', 'automatic'];
73
-
74
49
  var validateForceAppEnvironment = function validateForceAppEnvironment(env) {
75
50
  var normalizeEnvironment = env.toLowerCase();
76
-
77
51
  if (!availableEnvironments.includes(normalizeEnvironment)) {
78
52
  console.error("*force-app-environment* requires one of the following values: {".concat(availableEnvironments.toString(), "}. Example: --force-app-environment ").concat(availableEnvironments[0]));
79
53
  process.exit(1);
80
54
  }
81
-
82
55
  return normalizeEnvironment;
83
56
  };
84
-
85
57
  _commander.default.version(require('../../package.json').version).usage('[options] <file ...>').option('-a, --access-key <accessKey>', 'Access key').option('-c, --config <config>', 'Jscrambler configuration options').option('-H, --host <host>', 'Hostname').option('-i, --application-id <id>', 'Application ID').option('-o, --output-dir <dir>', 'Output directory').option('-p, --port <port>', 'Port').option('--base-path <path>', 'Base Path').option('--protocol <protocol>', 'Protocol (http or https)').option('--cafile <path>', 'Internal certificate authority').option('-C, --cwd <dir>', 'Current Working Directory').option('-s, --secret-key <secretKey>', 'Secret key').option('-m, --source-maps <id>', 'Download source maps').option('-R, --randomization-seed <seed>', 'Set randomization seed').option('--instrument', 'Instrument file(s) before start profiling. ATTENTION: previous profiling information will be deleted').option('--start-profiling', 'Starts profiling (assumes an already instrumented application)').option('--stop-profiling', 'Stops profiling').option('--code-hardening-threshold <threshold>', 'Set code hardening file size threshold. Format: {value}{unit="b,kb,mb"}. Example: 200kb', validateCodeHardeningThreshold).option('--recommended-order <bool>', 'Use recommended order', validateBool('recommended-order')).option('-W, --werror <bool>', 'Set werror flag value (default: true)', validateBool('werror')).option('--utc <bool>', 'Set UTC as the request time zone. Otherwise it uses the local time zone (default: true)', validateBool('utc')).option('--tolerate-minification <bool>', "Don't detect minification as malicious tampering (default: true)", validateBool('tolerate-minification')).option('--use-profiling-data <bool>', "(version 6.2 only) Protection should use the existing profiling data (default: true)", validateBool('use-profiling-data')).option('--profiling-data-mode <mode>', "(version 6.3 and above) Select profiling mode (default: automatic)", validateProfilingDataMode).option('--remove-profiling-data', "Removes the current application profiling information").option('--use-app-classification <bool>', '(version 6.3 and above) Protection should use Application Classification metadata when protecting (default: true)', validateBool('--use-app-classification')).option('--input-symbol-table <file>', '(version 6.3 and above) Protection should use symbol table when protecting. (default: no file)').option('--output-symbol-table <id>', '(version 6.3 and above) Download output symbol table (json)').option('--jscramblerVersion <version>', 'Use a specific Jscrambler version').option('--debugMode', 'Protect in debug mode').option('--skip-sources', 'Prevent source files from being updated').option('--force-app-environment <environment>', "(version 7.1 and above) Override application's environment detected automatically. Possible values: ".concat(availableEnvironments.toString()), validateForceAppEnvironment).option('--ensure-code-annotation <bool>', "(version 7.3 and above) Fail protection if no annotations are found on the source code (default: false)", validateBool('ensure-code-annotation')).option('-n <number>', "(version 7.2 and above) Create multiple protections at once.").parse(process.argv);
58
+ var globSrc, filesSrc, config;
86
59
 
87
- var globSrc, filesSrc, config; // If -c, --config file was provided
88
-
60
+ // If -c, --config file was provided
89
61
  if (_commander.default.config) {
90
62
  // We're using `commander` (CLI) as the source of all truths, falling back to
91
63
  // the `config` provided by the file passed as argument
@@ -93,7 +65,6 @@ if (_commander.default.config) {
93
65
  } else {
94
66
  config = {};
95
67
  }
96
-
97
68
  config.accessKey = _commander.default.accessKey || (config.keys ? config.keys.accessKey : undefined);
98
69
  config.secretKey = _commander.default.secretKey || (config.keys ? config.keys.secretKey : undefined);
99
70
  config.host = _commander.default.host || config.host;
@@ -113,85 +84,72 @@ config.jscramblerVersion = _commander.default.jscramblerVersion || config.jscram
113
84
  config.inputSymbolTable = _commander.default.inputSymbolTable || config.inputSymbolTable;
114
85
  config.removeProfilingData = _commander.default.removeProfilingData;
115
86
  config.skipSources = _commander.default.skipSources;
116
- config.debugMode = _commander.default.debugMode || config.debugMode; // handle codeHardening = 0
87
+ config.debugMode = _commander.default.debugMode || config.debugMode;
117
88
 
89
+ // handle codeHardening = 0
118
90
  if (typeof _commander.default.codeHardeningThreshold === 'undefined') {
119
91
  config.codeHardeningThreshold = config.codeHardeningThreshold ? validateCodeHardeningThreshold(config.codeHardeningThreshold) : undefined;
120
92
  } else {
121
93
  config.codeHardeningThreshold = _commander.default.codeHardeningThreshold;
122
94
  }
123
-
124
95
  if (_commander.default.profilingDataMode) {
125
96
  config.profilingDataMode = _commander.default.profilingDataMode;
126
97
  } else {
127
98
  config.profilingDataMode = config.profilingDataMode ? validateProfilingDataMode(config.profilingDataMode) : undefined;
128
99
  }
129
-
130
100
  if (_commander.default.utc) {
131
101
  config.utc = _commander.default.utc !== 'false';
132
102
  }
133
-
134
103
  if (_commander.default.useProfilingData) {
135
104
  config.useProfilingData = _commander.default.useProfilingData !== 'false';
136
105
  }
137
-
138
106
  if (_commander.default.useAppClassification) {
139
107
  config.useAppClassification = _commander.default.useAppClassification !== 'false';
140
108
  }
141
-
142
109
  if (_commander.default.ensureCodeAnnotation) {
143
110
  config.ensureCodeAnnotation = _commander.default.ensureCodeAnnotation === 'true';
144
111
  }
145
-
146
112
  if (config.jscramblerVersion && !/^(?:\d+\.\d+(?:-f)?|stable|latest)$/.test(config.jscramblerVersion)) {
147
113
  console.error('The Jscrambler version must be in the form of $major.$minor or the words stable and latest. (e.g. 5.2, stable, latest)');
148
114
  process.exit(1);
149
115
  }
150
-
151
116
  if (_commander.default.forceAppEnvironment) {
152
117
  config.forceAppEnvironment = _commander.default.forceAppEnvironment;
153
118
  } else {
154
119
  config.forceAppEnvironment = config.forceAppEnvironment ? validateForceAppEnvironment(config.forceAppEnvironment) : undefined;
155
120
  }
156
-
157
121
  config = (0, _lodash.default)(config, _config3.default);
158
122
  config.numberOfProtections = (0, _utils.validateNProtections)(_commander.default.N);
159
-
160
123
  if (config.codeHardeningThreshold) {
161
124
  config.codeHardeningThreshold = validateCodeHardeningThreshold(config.codeHardeningThreshold);
162
125
  }
163
-
164
126
  if (config.profilingDataMode) {
165
127
  config.profilingDataMode = validateProfilingDataMode(config.profilingDataMode);
166
128
  }
167
-
168
- globSrc = config.filesSrc; // If src paths have been provided
169
-
129
+ globSrc = config.filesSrc;
130
+ // If src paths have been provided
170
131
  if (_commander.default.args.length > 0) {
171
132
  globSrc = _commander.default.args;
172
133
  }
173
-
174
134
  if (globSrc && globSrc.length) {
175
135
  // this will be translated to real files in the updateApplicationSources method
176
136
  filesSrc = globSrc;
177
- var nSources = 0; // Iterate `globSrc` to build a list of source files into `filesSrc`
178
-
137
+ var nSources = 0;
138
+ // Iterate `globSrc` to build a list of source files into `filesSrc`
179
139
  for (var i = 0, l = globSrc.length; i < l; i += 1) {
180
140
  // Calling sync `glob` because async is pointless for the CLI use case
181
141
  // (as of now at least)
142
+
182
143
  // If the user is providing a zip alongside more files
183
144
  if (_path.default.extname(globSrc[i]) === '.zip' && globSrc.length > 1) {
184
145
  console.error('Please provide either a zip file containing all your source files or use the minimatch syntax');
185
146
  process.exit(1);
186
147
  }
187
-
188
148
  var tmpGlob = (0, _utils.getMatchedFiles)(globSrc[i]);
189
-
190
149
  if (config.werror && tmpGlob.length === 0) {
191
150
  console.error("Pattern \"".concat(globSrc[i], "\" doesn't match any files."));
192
151
  process.exit(1);
193
152
  }
194
-
195
153
  if (debug) {
196
154
  if (tmpGlob.length === 0) {
197
155
  console.log("Pattern \"".concat(globSrc[i], "\" doesn't match any files. Will be ignored."));
@@ -202,10 +160,8 @@ if (globSrc && globSrc.length) {
202
160
  });
203
161
  }
204
162
  }
205
-
206
163
  nSources += tmpGlob.length;
207
164
  }
208
-
209
165
  if (nSources === 0) {
210
166
  console.error('No files matched.');
211
167
  process.exit(1);
@@ -213,61 +169,56 @@ if (globSrc && globSrc.length) {
213
169
  } else if (debug) {
214
170
  console.log('No filesSrc provided. Using the ones in the application (if any).');
215
171
  }
216
-
217
172
  var _config2 = config,
218
- applicationId = _config2.applicationId,
219
- accessKey = _config2.accessKey,
220
- secretKey = _config2.secretKey,
221
- filesDest = _config2.filesDest,
222
- host = _config2.host,
223
- port = _config2.port,
224
- basePath = _config2.basePath,
225
- protocol = _config2.protocol,
226
- cafile = _config2.cafile,
227
- applicationTypes = _config2.applicationTypes,
228
- languageSpecifications = _config2.languageSpecifications,
229
- areSubscribersOrdered = _config2.areSubscribersOrdered,
230
- cwd = _config2.cwd,
231
- randomizationSeed = _config2.randomizationSeed,
232
- _config2$sourceMaps = _config2.sourceMaps,
233
- sourceMaps = _config2$sourceMaps === void 0 ? false : _config2$sourceMaps,
234
- useRecommendedOrder = _config2.useRecommendedOrder,
235
- werror = _config2.werror,
236
- tolerateMinification = _config2.tolerateMinification,
237
- jscramblerVersion = _config2.jscramblerVersion,
238
- debugMode = _config2.debugMode,
239
- proxy = _config2.proxy,
240
- codeHardeningThreshold = _config2.codeHardeningThreshold,
241
- useProfilingData = _config2.useProfilingData,
242
- profilingDataMode = _config2.profilingDataMode,
243
- browsers = _config2.browsers,
244
- useAppClassification = _config2.useAppClassification,
245
- removeProfilingData = _config2.removeProfilingData,
246
- skipSources = _config2.skipSources,
247
- inputSymbolTable = _config2.inputSymbolTable,
248
- utc = _config2.utc,
249
- entryPoint = _config2.entryPoint,
250
- excludeList = _config2.excludeList,
251
- numberOfProtections = _config2.numberOfProtections,
252
- ensureCodeAnnotation = _config2.ensureCodeAnnotation,
253
- forceAppEnvironment = _config2.forceAppEnvironment;
173
+ applicationId = _config2.applicationId,
174
+ accessKey = _config2.accessKey,
175
+ secretKey = _config2.secretKey,
176
+ filesDest = _config2.filesDest,
177
+ host = _config2.host,
178
+ port = _config2.port,
179
+ basePath = _config2.basePath,
180
+ protocol = _config2.protocol,
181
+ cafile = _config2.cafile,
182
+ applicationTypes = _config2.applicationTypes,
183
+ languageSpecifications = _config2.languageSpecifications,
184
+ areSubscribersOrdered = _config2.areSubscribersOrdered,
185
+ cwd = _config2.cwd,
186
+ randomizationSeed = _config2.randomizationSeed,
187
+ _config2$sourceMaps = _config2.sourceMaps,
188
+ sourceMaps = _config2$sourceMaps === void 0 ? false : _config2$sourceMaps,
189
+ useRecommendedOrder = _config2.useRecommendedOrder,
190
+ werror = _config2.werror,
191
+ tolerateMinification = _config2.tolerateMinification,
192
+ jscramblerVersion = _config2.jscramblerVersion,
193
+ debugMode = _config2.debugMode,
194
+ proxy = _config2.proxy,
195
+ codeHardeningThreshold = _config2.codeHardeningThreshold,
196
+ useProfilingData = _config2.useProfilingData,
197
+ profilingDataMode = _config2.profilingDataMode,
198
+ browsers = _config2.browsers,
199
+ useAppClassification = _config2.useAppClassification,
200
+ removeProfilingData = _config2.removeProfilingData,
201
+ skipSources = _config2.skipSources,
202
+ inputSymbolTable = _config2.inputSymbolTable,
203
+ utc = _config2.utc,
204
+ entryPoint = _config2.entryPoint,
205
+ excludeList = _config2.excludeList,
206
+ numberOfProtections = _config2.numberOfProtections,
207
+ ensureCodeAnnotation = _config2.ensureCodeAnnotation,
208
+ forceAppEnvironment = _config2.forceAppEnvironment;
254
209
  var params = config.params;
255
210
  var incompatibleOptions = ['sourceMaps', 'instrument', 'startProfiling', 'stopProfiling'];
256
211
  var usedIncompatibleOptions = [];
257
-
258
212
  for (var _i = 0, _incompatibleOptions = incompatibleOptions; _i < _incompatibleOptions.length; _i++) {
259
213
  var incompatibleOption = _incompatibleOptions[_i];
260
-
261
214
  if (_commander.default[incompatibleOption]) {
262
215
  usedIncompatibleOptions.push(incompatibleOption);
263
216
  }
264
217
  }
265
-
266
218
  if (usedIncompatibleOptions.length > 1) {
267
219
  console.error('Using mutually exclusive options:', usedIncompatibleOptions);
268
220
  process.exit(1);
269
221
  }
270
-
271
222
  var clientSettings = {
272
223
  keys: {
273
224
  accessKey: accessKey,
@@ -282,7 +233,6 @@ var clientSettings = {
282
233
  utc: utc,
283
234
  jscramblerVersion: jscramblerVersion
284
235
  };
285
-
286
236
  if (_commander.default.sourceMaps) {
287
237
  // Go, go, go download
288
238
  _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
@@ -297,17 +247,14 @@ if (_commander.default.sourceMaps) {
297
247
  filesSrc: filesSrc,
298
248
  protectionId: _commander.default.sourceMaps
299
249
  }));
300
-
301
250
  case 3:
302
251
  _context.next = 9;
303
252
  break;
304
-
305
253
  case 5:
306
254
  _context.prev = 5;
307
255
  _context.t0 = _context["catch"](0);
308
256
  console.error(debug ? _context.t0 : _context.t0.message || _context.t0);
309
257
  process.exit(1);
310
-
311
258
  case 9:
312
259
  case "end":
313
260
  return _context.stop();
@@ -329,17 +276,14 @@ if (_commander.default.sourceMaps) {
329
276
  filesSrc: filesSrc,
330
277
  protectionId: _commander.default.outputSymbolTable
331
278
  }));
332
-
333
279
  case 3:
334
280
  _context2.next = 9;
335
281
  break;
336
-
337
282
  case 5:
338
283
  _context2.prev = 5;
339
284
  _context2.t0 = _context2["catch"](0);
340
285
  console.error(debug ? _context2.t0 : _context2.t0.message || _context2.t0);
341
286
  process.exit(1);
342
-
343
287
  case 9:
344
288
  case "end":
345
289
  return _context2.stop();
@@ -409,24 +353,19 @@ if (_commander.default.sourceMaps) {
409
353
  forceAppEnvironment: forceAppEnvironment
410
354
  });
411
355
  _context3.prev = 1;
412
-
413
356
  if (typeof werror !== 'undefined') {
414
357
  protectAndDownloadOptions.bail = werror;
415
358
  }
416
-
417
359
  _context3.next = 5;
418
360
  return _.default.protectAndDownload(protectAndDownloadOptions);
419
-
420
361
  case 5:
421
362
  _context3.next = 11;
422
363
  break;
423
-
424
364
  case 7:
425
365
  _context3.prev = 7;
426
366
  _context3.t0 = _context3["catch"](1);
427
367
  console.error(debug ? _context3.t0 : _context3.t0.message || _context3.t0);
428
368
  process.exit(1);
429
-
430
369
  case 11:
431
370
  case "end":
432
371
  return _context3.stop();
@@ -4,26 +4,22 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = cleanupInputFields;
7
-
8
7
  function cleanupInputFields(args, fragments) {
9
8
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
10
9
  var cleanedUpFragments = fragments;
11
10
  var dataArg = args.find(function (arg) {
12
11
  return arg.name === 'data';
13
12
  });
14
-
15
13
  function fieldCleanUp(field) {
16
14
  var hasFieldArg = dataArg && dataArg.type.inputFields.some(function (e) {
17
15
  return e.name === field;
18
16
  });
19
-
20
17
  if (!hasFieldArg && typeof options[field] !== 'undefined') {
21
18
  options[field] = undefined;
22
19
  cleanedUpFragments = cleanedUpFragments.replace(new RegExp(",?[s|\n]*".concat(field)), '');
23
20
  console.warn("This API Version does not support the ".concat(field, " argument."));
24
21
  }
25
22
  }
26
-
27
23
  ['tolerateMinification', 'useProfilingData', 'useAppClassification', 'inputSymbolTable', 'entryPoint', 'ensureCodeAnnotation'].forEach(fieldCleanUp);
28
24
  return [options, cleanedUpFragments];
29
25
  }