jscrambler 6.2.6 → 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,92 +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
- var _cli = require("../cli");
19
-
20
11
  var _utils = require("../utils");
21
-
22
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
24
- 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; }
25
-
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; }
26
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; }
27
-
28
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; }
29
-
30
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; }
31
-
32
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); } }
33
-
34
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); }); }; }
35
-
36
19
  var debug = !!process.env.DEBUG;
37
-
38
20
  var validateBool = function validateBool(option) {
39
21
  return function (val) {
40
22
  if (!/^(true|false)$/i.test(val)) {
41
23
  console.error("*".concat(option, "* requires a <bool> value."));
42
24
  process.exit(1);
43
25
  }
44
-
45
26
  return val.toLowerCase();
46
27
  };
47
28
  };
48
-
49
29
  var validateCodeHardeningThreshold = function validateCodeHardeningThreshold(val) {
50
30
  var inBytes;
51
-
52
31
  try {
53
32
  inBytes = (0, _filesizeParser.default)(val);
54
33
  } catch (e) {
55
34
  console.error('*code-hardening-threshold* requires a valid <threshold> value. Format: {number}{unit="b,kb,mb"}. Example: --code-hardening-threshold 200kb');
56
35
  process.exit(1);
57
36
  }
58
-
59
37
  return inBytes;
60
38
  };
61
-
62
39
  var validateProfilingDataMode = function validateProfilingDataMode(mode) {
63
40
  var availableModes = ['automatic', 'annotations', 'off'];
64
41
  var normalizedMode = mode.toLowerCase();
65
-
66
42
  if (!availableModes.includes(normalizedMode)) {
67
43
  console.error("*profiling-data-mode* requires one of the following modes: {".concat(availableModes.toString(), "}. Example: --profiling-data-mode ").concat(availableModes[0]));
68
44
  process.exit(1);
69
45
  }
70
-
71
46
  return normalizedMode;
72
47
  };
73
-
74
48
  var availableEnvironments = ['node', 'browser', 'isomorphic', 'automatic'];
75
-
76
49
  var validateForceAppEnvironment = function validateForceAppEnvironment(env) {
77
50
  var normalizeEnvironment = env.toLowerCase();
78
-
79
51
  if (!availableEnvironments.includes(normalizeEnvironment)) {
80
52
  console.error("*force-app-environment* requires one of the following values: {".concat(availableEnvironments.toString(), "}. Example: --force-app-environment ").concat(availableEnvironments[0]));
81
53
  process.exit(1);
82
54
  }
83
-
84
55
  return normalizeEnvironment;
85
56
  };
86
-
87
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;
88
59
 
89
- var globSrc, filesSrc, config; // If -c, --config file was provided
90
-
60
+ // If -c, --config file was provided
91
61
  if (_commander.default.config) {
92
62
  // We're using `commander` (CLI) as the source of all truths, falling back to
93
63
  // the `config` provided by the file passed as argument
@@ -95,7 +65,6 @@ if (_commander.default.config) {
95
65
  } else {
96
66
  config = {};
97
67
  }
98
-
99
68
  config.accessKey = _commander.default.accessKey || (config.keys ? config.keys.accessKey : undefined);
100
69
  config.secretKey = _commander.default.secretKey || (config.keys ? config.keys.secretKey : undefined);
101
70
  config.host = _commander.default.host || config.host;
@@ -115,85 +84,72 @@ config.jscramblerVersion = _commander.default.jscramblerVersion || config.jscram
115
84
  config.inputSymbolTable = _commander.default.inputSymbolTable || config.inputSymbolTable;
116
85
  config.removeProfilingData = _commander.default.removeProfilingData;
117
86
  config.skipSources = _commander.default.skipSources;
118
- config.debugMode = _commander.default.debugMode || config.debugMode; // handle codeHardening = 0
87
+ config.debugMode = _commander.default.debugMode || config.debugMode;
119
88
 
89
+ // handle codeHardening = 0
120
90
  if (typeof _commander.default.codeHardeningThreshold === 'undefined') {
121
91
  config.codeHardeningThreshold = config.codeHardeningThreshold ? validateCodeHardeningThreshold(config.codeHardeningThreshold) : undefined;
122
92
  } else {
123
93
  config.codeHardeningThreshold = _commander.default.codeHardeningThreshold;
124
94
  }
125
-
126
95
  if (_commander.default.profilingDataMode) {
127
96
  config.profilingDataMode = _commander.default.profilingDataMode;
128
97
  } else {
129
98
  config.profilingDataMode = config.profilingDataMode ? validateProfilingDataMode(config.profilingDataMode) : undefined;
130
99
  }
131
-
132
100
  if (_commander.default.utc) {
133
101
  config.utc = _commander.default.utc !== 'false';
134
102
  }
135
-
136
103
  if (_commander.default.useProfilingData) {
137
104
  config.useProfilingData = _commander.default.useProfilingData !== 'false';
138
105
  }
139
-
140
106
  if (_commander.default.useAppClassification) {
141
107
  config.useAppClassification = _commander.default.useAppClassification !== 'false';
142
108
  }
143
-
144
109
  if (_commander.default.ensureCodeAnnotation) {
145
110
  config.ensureCodeAnnotation = _commander.default.ensureCodeAnnotation === 'true';
146
111
  }
147
-
148
112
  if (config.jscramblerVersion && !/^(?:\d+\.\d+(?:-f)?|stable|latest)$/.test(config.jscramblerVersion)) {
149
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)');
150
114
  process.exit(1);
151
115
  }
152
-
153
116
  if (_commander.default.forceAppEnvironment) {
154
117
  config.forceAppEnvironment = _commander.default.forceAppEnvironment;
155
118
  } else {
156
119
  config.forceAppEnvironment = config.forceAppEnvironment ? validateForceAppEnvironment(config.forceAppEnvironment) : undefined;
157
120
  }
158
-
159
121
  config = (0, _lodash.default)(config, _config3.default);
160
122
  config.numberOfProtections = (0, _utils.validateNProtections)(_commander.default.N);
161
-
162
123
  if (config.codeHardeningThreshold) {
163
124
  config.codeHardeningThreshold = validateCodeHardeningThreshold(config.codeHardeningThreshold);
164
125
  }
165
-
166
126
  if (config.profilingDataMode) {
167
127
  config.profilingDataMode = validateProfilingDataMode(config.profilingDataMode);
168
128
  }
169
-
170
- globSrc = config.filesSrc; // If src paths have been provided
171
-
129
+ globSrc = config.filesSrc;
130
+ // If src paths have been provided
172
131
  if (_commander.default.args.length > 0) {
173
132
  globSrc = _commander.default.args;
174
133
  }
175
-
176
134
  if (globSrc && globSrc.length) {
177
135
  // this will be translated to real files in the updateApplicationSources method
178
136
  filesSrc = globSrc;
179
- var nSources = 0; // Iterate `globSrc` to build a list of source files into `filesSrc`
180
-
137
+ var nSources = 0;
138
+ // Iterate `globSrc` to build a list of source files into `filesSrc`
181
139
  for (var i = 0, l = globSrc.length; i < l; i += 1) {
182
140
  // Calling sync `glob` because async is pointless for the CLI use case
183
141
  // (as of now at least)
142
+
184
143
  // If the user is providing a zip alongside more files
185
144
  if (_path.default.extname(globSrc[i]) === '.zip' && globSrc.length > 1) {
186
145
  console.error('Please provide either a zip file containing all your source files or use the minimatch syntax');
187
146
  process.exit(1);
188
147
  }
189
-
190
148
  var tmpGlob = (0, _utils.getMatchedFiles)(globSrc[i]);
191
-
192
149
  if (config.werror && tmpGlob.length === 0) {
193
150
  console.error("Pattern \"".concat(globSrc[i], "\" doesn't match any files."));
194
151
  process.exit(1);
195
152
  }
196
-
197
153
  if (debug) {
198
154
  if (tmpGlob.length === 0) {
199
155
  console.log("Pattern \"".concat(globSrc[i], "\" doesn't match any files. Will be ignored."));
@@ -204,10 +160,8 @@ if (globSrc && globSrc.length) {
204
160
  });
205
161
  }
206
162
  }
207
-
208
163
  nSources += tmpGlob.length;
209
164
  }
210
-
211
165
  if (nSources === 0) {
212
166
  console.error('No files matched.');
213
167
  process.exit(1);
@@ -215,61 +169,56 @@ if (globSrc && globSrc.length) {
215
169
  } else if (debug) {
216
170
  console.log('No filesSrc provided. Using the ones in the application (if any).');
217
171
  }
218
-
219
172
  var _config2 = config,
220
- applicationId = _config2.applicationId,
221
- accessKey = _config2.accessKey,
222
- secretKey = _config2.secretKey,
223
- filesDest = _config2.filesDest,
224
- host = _config2.host,
225
- port = _config2.port,
226
- basePath = _config2.basePath,
227
- protocol = _config2.protocol,
228
- cafile = _config2.cafile,
229
- applicationTypes = _config2.applicationTypes,
230
- languageSpecifications = _config2.languageSpecifications,
231
- areSubscribersOrdered = _config2.areSubscribersOrdered,
232
- cwd = _config2.cwd,
233
- randomizationSeed = _config2.randomizationSeed,
234
- _config2$sourceMaps = _config2.sourceMaps,
235
- sourceMaps = _config2$sourceMaps === void 0 ? false : _config2$sourceMaps,
236
- useRecommendedOrder = _config2.useRecommendedOrder,
237
- werror = _config2.werror,
238
- tolerateMinification = _config2.tolerateMinification,
239
- jscramblerVersion = _config2.jscramblerVersion,
240
- debugMode = _config2.debugMode,
241
- proxy = _config2.proxy,
242
- codeHardeningThreshold = _config2.codeHardeningThreshold,
243
- useProfilingData = _config2.useProfilingData,
244
- profilingDataMode = _config2.profilingDataMode,
245
- browsers = _config2.browsers,
246
- useAppClassification = _config2.useAppClassification,
247
- removeProfilingData = _config2.removeProfilingData,
248
- skipSources = _config2.skipSources,
249
- inputSymbolTable = _config2.inputSymbolTable,
250
- utc = _config2.utc,
251
- entryPoint = _config2.entryPoint,
252
- excludeList = _config2.excludeList,
253
- numberOfProtections = _config2.numberOfProtections,
254
- ensureCodeAnnotation = _config2.ensureCodeAnnotation,
255
- forceAppEnvironment = _config2.forceAppEnvironment;
256
- var params = (0, _cli.mergeAndParseParams)(_commander.default, config.params);
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;
209
+ var params = config.params;
257
210
  var incompatibleOptions = ['sourceMaps', 'instrument', 'startProfiling', 'stopProfiling'];
258
211
  var usedIncompatibleOptions = [];
259
-
260
212
  for (var _i = 0, _incompatibleOptions = incompatibleOptions; _i < _incompatibleOptions.length; _i++) {
261
213
  var incompatibleOption = _incompatibleOptions[_i];
262
-
263
214
  if (_commander.default[incompatibleOption]) {
264
215
  usedIncompatibleOptions.push(incompatibleOption);
265
216
  }
266
217
  }
267
-
268
218
  if (usedIncompatibleOptions.length > 1) {
269
219
  console.error('Using mutually exclusive options:', usedIncompatibleOptions);
270
220
  process.exit(1);
271
221
  }
272
-
273
222
  var clientSettings = {
274
223
  keys: {
275
224
  accessKey: accessKey,
@@ -284,7 +233,6 @@ var clientSettings = {
284
233
  utc: utc,
285
234
  jscramblerVersion: jscramblerVersion
286
235
  };
287
-
288
236
  if (_commander.default.sourceMaps) {
289
237
  // Go, go, go download
290
238
  _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
@@ -299,17 +247,14 @@ if (_commander.default.sourceMaps) {
299
247
  filesSrc: filesSrc,
300
248
  protectionId: _commander.default.sourceMaps
301
249
  }));
302
-
303
250
  case 3:
304
251
  _context.next = 9;
305
252
  break;
306
-
307
253
  case 5:
308
254
  _context.prev = 5;
309
255
  _context.t0 = _context["catch"](0);
310
256
  console.error(debug ? _context.t0 : _context.t0.message || _context.t0);
311
257
  process.exit(1);
312
-
313
258
  case 9:
314
259
  case "end":
315
260
  return _context.stop();
@@ -331,17 +276,14 @@ if (_commander.default.sourceMaps) {
331
276
  filesSrc: filesSrc,
332
277
  protectionId: _commander.default.outputSymbolTable
333
278
  }));
334
-
335
279
  case 3:
336
280
  _context2.next = 9;
337
281
  break;
338
-
339
282
  case 5:
340
283
  _context2.prev = 5;
341
284
  _context2.t0 = _context2["catch"](0);
342
285
  console.error(debug ? _context2.t0 : _context2.t0.message || _context2.t0);
343
286
  process.exit(1);
344
-
345
287
  case 9:
346
288
  case "end":
347
289
  return _context2.stop();
@@ -411,24 +353,19 @@ if (_commander.default.sourceMaps) {
411
353
  forceAppEnvironment: forceAppEnvironment
412
354
  });
413
355
  _context3.prev = 1;
414
-
415
356
  if (typeof werror !== 'undefined') {
416
357
  protectAndDownloadOptions.bail = werror;
417
358
  }
418
-
419
359
  _context3.next = 5;
420
360
  return _.default.protectAndDownload(protectAndDownloadOptions);
421
-
422
361
  case 5:
423
362
  _context3.next = 11;
424
363
  break;
425
-
426
364
  case 7:
427
365
  _context3.prev = 7;
428
366
  _context3.t0 = _context3["catch"](1);
429
367
  console.error(debug ? _context3.t0 : _context3.t0.message || _context3.t0);
430
368
  process.exit(1);
431
-
432
369
  case 11:
433
370
  case "end":
434
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
  }