jscrambler 6.4.20 → 6.4.23

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/CHANGELOG.md ADDED
@@ -0,0 +1,14 @@
1
+ # jscrambler
2
+
3
+ ## 6.4.23
4
+
5
+ ### Patch Changes
6
+
7
+ - [5cbeccd]: Set access to public on publishConfig
8
+
9
+ ## 6.4.22
10
+
11
+ ### Patch Changes
12
+
13
+ - [4fa2580]: Adjust transpilation settings to generate better code
14
+ - [4fa2580]: Infrastructure updates
@@ -1,33 +1,32 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
3
 
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); }
4
+ require("core-js/modules/es.symbol.description.js");
5
+ require("core-js/modules/es.regexp.exec.js");
6
+ require("core-js/modules/web.dom-collections.iterator.js");
5
7
  var _commander = _interopRequireDefault(require("commander"));
6
8
  var _lodash = _interopRequireDefault(require("lodash.defaults"));
7
9
  var _path = _interopRequireDefault(require("path"));
8
10
  var _filesizeParser = _interopRequireDefault(require("filesize-parser"));
9
- var _config3 = _interopRequireDefault(require("../config"));
11
+ var _config2 = _interopRequireDefault(require("../config"));
10
12
  var _ = _interopRequireDefault(require("../"));
11
13
  var _utils = require("../utils");
12
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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; }
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; }
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; }
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; }
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); } }
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); }); }; }
19
- var debug = !!process.env.DEBUG;
20
- var validateBool = function validateBool(option) {
21
- return function (val) {
22
- if (!/^(true|false)$/i.test(val)) {
23
- console.error("*".concat(option, "* requires a <bool> value."));
24
- process.exit(1);
25
- }
26
- return val.toLowerCase();
27
- };
15
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
16
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
17
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
18
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
19
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
20
+ const debug = !!process.env.DEBUG;
21
+ const validateBool = option => val => {
22
+ if (!/^(true|false)$/i.test(val)) {
23
+ console.error("*".concat(option, "* requires a <bool> value."));
24
+ process.exit(1);
25
+ }
26
+ return val.toLowerCase();
28
27
  };
29
- var validateCodeHardeningThreshold = function validateCodeHardeningThreshold(val) {
30
- var inBytes;
28
+ const validateCodeHardeningThreshold = val => {
29
+ let inBytes;
31
30
  try {
32
31
  inBytes = (0, _filesizeParser.default)(val);
33
32
  } catch (e) {
@@ -36,18 +35,18 @@ var validateCodeHardeningThreshold = function validateCodeHardeningThreshold(val
36
35
  }
37
36
  return inBytes;
38
37
  };
39
- var validateProfilingDataMode = function validateProfilingDataMode(mode) {
40
- var availableModes = ['automatic', 'annotations', 'off'];
41
- var normalizedMode = mode.toLowerCase();
38
+ const validateProfilingDataMode = mode => {
39
+ const availableModes = ['automatic', 'annotations', 'off'];
40
+ const normalizedMode = mode.toLowerCase();
42
41
  if (!availableModes.includes(normalizedMode)) {
43
42
  console.error("*profiling-data-mode* requires one of the following modes: {".concat(availableModes.toString(), "}. Example: --profiling-data-mode ").concat(availableModes[0]));
44
43
  process.exit(1);
45
44
  }
46
45
  return normalizedMode;
47
46
  };
48
- var availableEnvironments = ['node', 'browser', 'isomorphic', 'automatic'];
49
- var validateForceAppEnvironment = function validateForceAppEnvironment(env) {
50
- var normalizeEnvironment = env.toLowerCase();
47
+ const availableEnvironments = ['node', 'browser', 'isomorphic', 'automatic'];
48
+ const validateForceAppEnvironment = env => {
49
+ const normalizeEnvironment = env.toLowerCase();
51
50
  if (!availableEnvironments.includes(normalizeEnvironment)) {
52
51
  console.error("*force-app-environment* requires one of the following values: {".concat(availableEnvironments.toString(), "}. Example: --force-app-environment ").concat(availableEnvironments[0]));
53
52
  process.exit(1);
@@ -55,7 +54,7 @@ var validateForceAppEnvironment = function validateForceAppEnvironment(env) {
55
54
  return normalizeEnvironment;
56
55
  };
57
56
  _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;
57
+ let globSrc, filesSrc, config;
59
58
 
60
59
  // If -c, --config file was provided
61
60
  if (_commander.default.config) {
@@ -118,7 +117,7 @@ if (_commander.default.forceAppEnvironment) {
118
117
  } else {
119
118
  config.forceAppEnvironment = config.forceAppEnvironment ? validateForceAppEnvironment(config.forceAppEnvironment) : undefined;
120
119
  }
121
- config = (0, _lodash.default)(config, _config3.default);
120
+ config = (0, _lodash.default)(config, _config2.default);
122
121
  config.numberOfProtections = (0, _utils.validateNProtections)(_commander.default.N);
123
122
  if (config.codeHardeningThreshold) {
124
123
  config.codeHardeningThreshold = validateCodeHardeningThreshold(config.codeHardeningThreshold);
@@ -134,9 +133,9 @@ if (_commander.default.args.length > 0) {
134
133
  if (globSrc && globSrc.length) {
135
134
  // this will be translated to real files in the updateApplicationSources method
136
135
  filesSrc = globSrc;
137
- var nSources = 0;
136
+ let nSources = 0;
138
137
  // Iterate `globSrc` to build a list of source files into `filesSrc`
139
- for (var i = 0, l = globSrc.length; i < l; i += 1) {
138
+ for (let i = 0, l = globSrc.length; i < l; i += 1) {
140
139
  // Calling sync `glob` because async is pointless for the CLI use case
141
140
  // (as of now at least)
142
141
 
@@ -145,7 +144,7 @@ if (globSrc && globSrc.length) {
145
144
  console.error('Please provide either a zip file containing all your source files or use the minimatch syntax');
146
145
  process.exit(1);
147
146
  }
148
- var tmpGlob = (0, _utils.getMatchedFiles)(globSrc[i]);
147
+ const tmpGlob = (0, _utils.getMatchedFiles)(globSrc[i]);
149
148
  if (config.werror && tmpGlob.length === 0) {
150
149
  console.error("Pattern \"".concat(globSrc[i], "\" doesn't match any files."));
151
150
  process.exit(1);
@@ -155,7 +154,7 @@ if (globSrc && globSrc.length) {
155
154
  console.log("Pattern \"".concat(globSrc[i], "\" doesn't match any files. Will be ignored."));
156
155
  } else {
157
156
  console.log("Pattern \"".concat(globSrc[i], "\" matched the following files:"));
158
- tmpGlob.forEach(function (file) {
157
+ tmpGlob.forEach(file => {
159
158
  console.log(" ".concat(file));
160
159
  });
161
160
  }
@@ -169,48 +168,47 @@ if (globSrc && globSrc.length) {
169
168
  } else if (debug) {
170
169
  console.log('No filesSrc provided. Using the ones in the application (if any).');
171
170
  }
172
- var _config2 = config,
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;
210
- var incompatibleOptions = ['sourceMaps', 'instrument', 'startProfiling', 'stopProfiling'];
211
- var usedIncompatibleOptions = [];
212
- for (var _i = 0, _incompatibleOptions = incompatibleOptions; _i < _incompatibleOptions.length; _i++) {
213
- var incompatibleOption = _incompatibleOptions[_i];
171
+ const {
172
+ applicationId,
173
+ accessKey,
174
+ secretKey,
175
+ filesDest,
176
+ host,
177
+ port,
178
+ basePath,
179
+ protocol,
180
+ cafile,
181
+ applicationTypes,
182
+ languageSpecifications,
183
+ areSubscribersOrdered,
184
+ cwd,
185
+ randomizationSeed,
186
+ sourceMaps = false,
187
+ useRecommendedOrder,
188
+ werror,
189
+ tolerateMinification,
190
+ jscramblerVersion,
191
+ debugMode,
192
+ proxy,
193
+ codeHardeningThreshold,
194
+ useProfilingData,
195
+ profilingDataMode,
196
+ browsers,
197
+ useAppClassification,
198
+ removeProfilingData,
199
+ skipSources,
200
+ inputSymbolTable,
201
+ utc,
202
+ entryPoint,
203
+ excludeList,
204
+ numberOfProtections,
205
+ ensureCodeAnnotation,
206
+ forceAppEnvironment
207
+ } = config;
208
+ const params = config.params;
209
+ const incompatibleOptions = ['sourceMaps', 'instrument', 'startProfiling', 'stopProfiling'];
210
+ const usedIncompatibleOptions = [];
211
+ for (const incompatibleOption of incompatibleOptions) {
214
212
  if (_commander.default[incompatibleOption]) {
215
213
  usedIncompatibleOptions.push(incompatibleOption);
216
214
  }
@@ -219,158 +217,112 @@ if (usedIncompatibleOptions.length > 1) {
219
217
  console.error('Using mutually exclusive options:', usedIncompatibleOptions);
220
218
  process.exit(1);
221
219
  }
222
- var clientSettings = {
220
+ const clientSettings = {
223
221
  keys: {
224
- accessKey: accessKey,
225
- secretKey: secretKey
222
+ accessKey,
223
+ secretKey
226
224
  },
227
- host: host,
228
- port: port,
229
- basePath: basePath,
230
- protocol: protocol,
231
- cafile: cafile,
232
- proxy: proxy,
233
- utc: utc,
234
- jscramblerVersion: jscramblerVersion
225
+ host,
226
+ port,
227
+ basePath,
228
+ protocol,
229
+ cafile,
230
+ proxy,
231
+ utc,
232
+ jscramblerVersion
235
233
  };
236
234
  if (_commander.default.sourceMaps) {
237
235
  // Go, go, go download
238
- _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
239
- return _regeneratorRuntime().wrap(function _callee$(_context) {
240
- while (1) {
241
- switch (_context.prev = _context.next) {
242
- case 0:
243
- _context.prev = 0;
244
- _context.next = 3;
245
- return _.default.downloadSourceMaps(_objectSpread(_objectSpread({}, clientSettings), {}, {
246
- filesDest: filesDest,
247
- filesSrc: filesSrc,
248
- protectionId: _commander.default.sourceMaps
249
- }));
250
- case 3:
251
- _context.next = 9;
252
- break;
253
- case 5:
254
- _context.prev = 5;
255
- _context.t0 = _context["catch"](0);
256
- console.error(debug ? _context.t0 : _context.t0.message || _context.t0);
257
- process.exit(1);
258
- case 9:
259
- case "end":
260
- return _context.stop();
261
- }
262
- }
263
- }, _callee, null, [[0, 5]]);
264
- }))();
236
+ (async () => {
237
+ try {
238
+ await _.default.downloadSourceMaps(_objectSpread(_objectSpread({}, clientSettings), {}, {
239
+ filesDest,
240
+ filesSrc,
241
+ protectionId: _commander.default.sourceMaps
242
+ }));
243
+ } catch (error) {
244
+ console.error(debug ? error : error.message || error);
245
+ process.exit(1);
246
+ }
247
+ })();
265
248
  } else if (_commander.default.outputSymbolTable) {
266
249
  // Go, go, go download
267
- _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
268
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
269
- while (1) {
270
- switch (_context2.prev = _context2.next) {
271
- case 0:
272
- _context2.prev = 0;
273
- _context2.next = 3;
274
- return _.default.downloadSymbolTable(_objectSpread(_objectSpread({}, clientSettings), {}, {
275
- filesDest: filesDest,
276
- filesSrc: filesSrc,
277
- protectionId: _commander.default.outputSymbolTable
278
- }));
279
- case 3:
280
- _context2.next = 9;
281
- break;
282
- case 5:
283
- _context2.prev = 5;
284
- _context2.t0 = _context2["catch"](0);
285
- console.error(debug ? _context2.t0 : _context2.t0.message || _context2.t0);
286
- process.exit(1);
287
- case 9:
288
- case "end":
289
- return _context2.stop();
290
- }
291
- }
292
- }, _callee2, null, [[0, 5]]);
293
- }))();
250
+ (async () => {
251
+ try {
252
+ await _.default.downloadSymbolTable(_objectSpread(_objectSpread({}, clientSettings), {}, {
253
+ filesDest,
254
+ filesSrc,
255
+ protectionId: _commander.default.outputSymbolTable
256
+ }));
257
+ } catch (error) {
258
+ console.error(debug ? error : error.message || error);
259
+ process.exit(1);
260
+ }
261
+ })();
294
262
  } else if (_commander.default.instrument) {
295
263
  _.default.instrumentAndDownload(_objectSpread(_objectSpread({}, clientSettings), {}, {
296
- applicationId: applicationId,
297
- filesSrc: filesSrc,
298
- filesDest: filesDest,
299
- skipSources: skipSources,
300
- cwd: cwd
301
- })).catch(function (error) {
264
+ applicationId,
265
+ filesSrc,
266
+ filesDest,
267
+ skipSources,
268
+ cwd
269
+ })).catch(error => {
302
270
  console.error(debug ? error : error.message || error);
303
271
  process.exit(1);
304
272
  });
305
273
  } else if (_commander.default.startProfiling) {
306
274
  _.default.setProfilingState(_objectSpread(_objectSpread({}, clientSettings), {}, {
307
- applicationId: applicationId
308
- }), 'RUNNING', 'STARTED', "Exercise your application and when you're finished run *--stop-profiling* command").catch(function (error) {
275
+ applicationId
276
+ }), 'RUNNING', 'STARTED', "Exercise your application and when you're finished run *--stop-profiling* command").catch(error => {
309
277
  console.error(debug ? error : error.message || error);
310
278
  process.exit(1);
311
279
  });
312
280
  } else if (_commander.default.stopProfiling) {
313
281
  _.default.setProfilingState(_objectSpread(_objectSpread({}, clientSettings), {}, {
314
- applicationId: applicationId
315
- }), 'READY', 'STOPPED', 'Protect your application with 2 extra arguments: *--profiling-data-mode automatic* and *--skip-sources*').catch(function (error) {
282
+ applicationId
283
+ }), 'READY', 'STOPPED', 'Protect your application with 2 extra arguments: *--profiling-data-mode automatic* and *--skip-sources*').catch(error => {
316
284
  console.error(debug ? error : error.message || error);
317
285
  process.exit(1);
318
286
  });
319
287
  } else {
320
288
  // Go, go, go
321
- _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
322
- var protectAndDownloadOptions;
323
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
324
- while (1) {
325
- switch (_context3.prev = _context3.next) {
326
- case 0:
327
- protectAndDownloadOptions = _objectSpread(_objectSpread({}, clientSettings), {}, {
328
- applicationId: applicationId,
329
- filesSrc: filesSrc,
330
- filesDest: filesDest,
331
- params: params,
332
- applicationTypes: applicationTypes,
333
- languageSpecifications: languageSpecifications,
334
- areSubscribersOrdered: areSubscribersOrdered,
335
- cwd: cwd,
336
- sourceMaps: sourceMaps,
337
- randomizationSeed: randomizationSeed,
338
- useRecommendedOrder: useRecommendedOrder,
339
- tolerateMinification: tolerateMinification,
340
- debugMode: debugMode,
341
- codeHardeningThreshold: codeHardeningThreshold,
342
- useProfilingData: useProfilingData,
343
- profilingDataMode: profilingDataMode,
344
- browsers: browsers,
345
- useAppClassification: useAppClassification,
346
- skipSources: skipSources,
347
- removeProfilingData: removeProfilingData,
348
- inputSymbolTable: inputSymbolTable,
349
- entryPoint: entryPoint,
350
- excludeList: excludeList,
351
- ensureCodeAnnotation: ensureCodeAnnotation,
352
- numberOfProtections: numberOfProtections,
353
- forceAppEnvironment: forceAppEnvironment
354
- });
355
- _context3.prev = 1;
356
- if (typeof werror !== 'undefined') {
357
- protectAndDownloadOptions.bail = werror;
358
- }
359
- _context3.next = 5;
360
- return _.default.protectAndDownload(protectAndDownloadOptions);
361
- case 5:
362
- _context3.next = 11;
363
- break;
364
- case 7:
365
- _context3.prev = 7;
366
- _context3.t0 = _context3["catch"](1);
367
- console.error(debug ? _context3.t0 : _context3.t0.message || _context3.t0);
368
- process.exit(1);
369
- case 11:
370
- case "end":
371
- return _context3.stop();
372
- }
289
+ (async () => {
290
+ const protectAndDownloadOptions = _objectSpread(_objectSpread({}, clientSettings), {}, {
291
+ applicationId,
292
+ filesSrc,
293
+ filesDest,
294
+ params,
295
+ applicationTypes,
296
+ languageSpecifications,
297
+ areSubscribersOrdered,
298
+ cwd,
299
+ sourceMaps,
300
+ randomizationSeed,
301
+ useRecommendedOrder,
302
+ tolerateMinification,
303
+ debugMode,
304
+ codeHardeningThreshold,
305
+ useProfilingData,
306
+ profilingDataMode,
307
+ browsers,
308
+ useAppClassification,
309
+ skipSources,
310
+ removeProfilingData,
311
+ inputSymbolTable,
312
+ entryPoint,
313
+ excludeList,
314
+ ensureCodeAnnotation,
315
+ numberOfProtections,
316
+ forceAppEnvironment
317
+ });
318
+ try {
319
+ if (typeof werror !== 'undefined') {
320
+ protectAndDownloadOptions.bail = werror;
373
321
  }
374
- }, _callee3, null, [[1, 7]]);
375
- }))();
322
+ await _.default.protectAndDownload(protectAndDownloadOptions);
323
+ } catch (error) {
324
+ console.error(debug ? error : error.message || error);
325
+ process.exit(1);
326
+ }
327
+ })();
376
328
  }
@@ -4,16 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = cleanupInputFields;
7
+ require("core-js/modules/es.regexp.exec.js");
8
+ require("core-js/modules/es.string.replace.js");
9
+ require("core-js/modules/es.regexp.constructor.js");
7
10
  function cleanupInputFields(args, fragments) {
8
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
9
- var cleanedUpFragments = fragments;
10
- var dataArg = args.find(function (arg) {
11
- return arg.name === 'data';
12
- });
11
+ let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
12
+ let cleanedUpFragments = fragments;
13
+ const dataArg = args.find(arg => arg.name === 'data');
13
14
  function fieldCleanUp(field) {
14
- var hasFieldArg = dataArg && dataArg.type.inputFields.some(function (e) {
15
- return e.name === field;
16
- });
15
+ const hasFieldArg = dataArg && dataArg.type.inputFields.some(e => e.name === field);
17
16
  if (!hasFieldArg && typeof options[field] !== 'undefined') {
18
17
  options[field] = undefined;
19
18
  cleanedUpFragments = cleanedUpFragments.replace(new RegExp(",?[s|\n]*".concat(field)), '');