js-confuser 1.4.2 → 1.5.1

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.
Files changed (63) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +9 -0
  3. package/dev.js +4 -5
  4. package/dist/compiler.js +3 -2
  5. package/dist/constants.js +1 -1
  6. package/dist/index.js +5 -5
  7. package/dist/obfuscator.js +14 -3
  8. package/dist/options.js +2 -2
  9. package/dist/order.js +1 -0
  10. package/dist/parser.js +2 -2
  11. package/dist/precedence.js +1 -1
  12. package/dist/presets.js +3 -0
  13. package/dist/probability.js +7 -1
  14. package/dist/transforms/calculator.js +15 -3
  15. package/dist/transforms/controlFlowFlattening/controlFlowFlattening.js +93 -19
  16. package/dist/transforms/deadCode.js +1 -1
  17. package/dist/transforms/dispatcher.js +3 -1
  18. package/dist/transforms/extraction/objectExtraction.js +7 -4
  19. package/dist/transforms/flatten.js +45 -13
  20. package/dist/transforms/hexadecimalNumbers.js +38 -0
  21. package/dist/transforms/hideInitializingCode.js +8 -3
  22. package/dist/transforms/identifier/globalConcealing.js +3 -1
  23. package/dist/transforms/identifier/nameRecycling.js +2 -1
  24. package/dist/transforms/lock/integrity.js +2 -1
  25. package/dist/transforms/lock/lock.js +2 -2
  26. package/dist/transforms/minify.js +8 -3
  27. package/dist/transforms/rgf.js +11 -8
  28. package/dist/transforms/stack.js +2 -1
  29. package/dist/transforms/string/stringConcealing.js +3 -3
  30. package/dist/transforms/transform.js +32 -8
  31. package/dist/traverse.js +4 -2
  32. package/dist/types.js +5 -1
  33. package/dist/util/compare.js +4 -4
  34. package/dist/util/gen.js +66 -47
  35. package/dist/util/guard.js +10 -0
  36. package/dist/util/identifiers.js +4 -4
  37. package/dist/util/insert.js +25 -16
  38. package/dist/util/object.js +3 -1
  39. package/dist/util/random.js +5 -5
  40. package/dist/util/scope.js +1 -1
  41. package/package.json +11 -11
  42. package/samples/high.js +1 -198
  43. package/samples/low.js +1 -26
  44. package/samples/medium.js +1 -40
  45. package/src/compiler.ts +5 -1
  46. package/src/obfuscator.ts +2 -0
  47. package/src/options.ts +8 -0
  48. package/src/order.ts +2 -0
  49. package/src/presets.ts +3 -0
  50. package/src/transforms/calculator.ts +36 -5
  51. package/src/transforms/controlFlowFlattening/controlFlowFlattening.ts +119 -2
  52. package/src/transforms/deadCode.ts +102 -0
  53. package/src/transforms/extraction/objectExtraction.ts +11 -5
  54. package/src/transforms/flatten.ts +166 -28
  55. package/src/transforms/hexadecimalNumbers.ts +31 -0
  56. package/src/transforms/minify.ts +9 -3
  57. package/src/transforms/transform.ts +10 -2
  58. package/src/util/gen.ts +1 -1
  59. package/src/util/guard.ts +7 -0
  60. package/test/transforms/extraction/objectExtraction.test.ts +23 -0
  61. package/test/transforms/flatten.test.ts +3 -3
  62. package/test/transforms/hexadecimalNumbers.test.ts +62 -0
  63. package/test/transforms/minify.test.ts +38 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,32 @@
1
+ # `1.5.1`
2
+ Object Extraction Fix
3
+
4
+ - Fixed [#37](https://github.com/MichaelXF/js-confuser/issues/37)
5
+ - - Object Extraction was applying to objects with get/set methods, fixed in this version.
6
+
7
+ - Slight improvement to `Flatten`
8
+
9
+ # `1.5.0`
10
+ Hexadecimal Numbers
11
+
12
+ - The hexadecimal representation can now be used. [#29](https://github.com/MichaelXF/js-confuser/issues/29)
13
+ - New option `hexadecimalNumbers` to control this behavior.
14
+
15
+ ### `hexadecimalNumbers`
16
+
17
+ Uses the hexadecimal representation (`50` -> `0x32`) for numbers. (`true/false`) -->
18
+
19
+ - Slight improvement to `Control Flow Flattening`
20
+ - Slight improvement to `Calculator`
21
+
22
+ # `1.4.3`
23
+ Minify Fix
24
+
25
+ - Fixed [#34](https://github.com/MichaelXF/js-confuser/issues/34)
26
+ - - Minify was removing `return` statements too aggressively, fixed in this version.
27
+
28
+ - Slight improvement to Control Flow Flattening
29
+
1
30
  # `1.4.2`
2
31
  Eval Fix
3
32
 
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  JS-Confuser is a JavaScript obfuscation tool to make your programs _impossible_ to read. [Try the web version](https://jsconfuser.com).
4
4
 
5
+ [![NPM](https://img.shields.io/badge/NPM-%23000000.svg?style=for-the-badge&logo=npm&logoColor=white)](https://npmjs.com/package/js-confuser) [![GitHub](https://img.shields.io/badge/github-%23121011.svg?style=for-the-badge&logo=github&logoColor=white)](https://github.com/MichaelXF/js-confuser) [![Netlify](https://img.shields.io/badge/netlify-%23000000.svg?style=for-the-badge&logo=netlify&logoColor=#00C7B7)](https://jsconfuser.com)
6
+
5
7
  ## Key features
6
8
 
7
9
  - Variable renaming
@@ -115,6 +117,10 @@ JsConfuser.obfuscate(`<source code>`, {
115
117
 
116
118
  Remove's whitespace from the final output. Enabled by default. (`true/false`)
117
119
 
120
+ ### `hexadecimalNumbers`
121
+
122
+ Uses the hexadecimal representation (`50` -> `0x32`) for numbers. (`true/false`)
123
+
118
124
  ### `minify`
119
125
 
120
126
  Minifies redundant code. (`true/false`)
@@ -528,6 +534,7 @@ function iVQoGQD(...iVQoGQD){
528
534
 
529
535
  calculator: true,
530
536
  compact: true,
537
+ hexadecimalNumbers: true,
531
538
  controlFlowFlattening: 0.75,
532
539
  deadCode: 0.2,
533
540
  dispatcher: true,
@@ -562,6 +569,7 @@ function iVQoGQD(...iVQoGQD){
562
569
 
563
570
  calculator: true,
564
571
  compact: true,
572
+ hexadecimalNumbers: true,
565
573
  controlFlowFlattening: 0.5,
566
574
  deadCode: 0.025,
567
575
  dispatcher: 0.75,
@@ -590,6 +598,7 @@ function iVQoGQD(...iVQoGQD){
590
598
 
591
599
  calculator: true,
592
600
  compact: true,
601
+ hexadecimalNumbers: true,
593
602
  controlFlowFlattening: 0.25,
594
603
  deadCode: 0.01,
595
604
  dispatcher: 0.5,
package/dev.js CHANGED
@@ -1,9 +1,8 @@
1
1
  require("@babel/register")({
2
- presets: [
3
- ["@babel/preset-env", { targets: { esmodules: true } }],
4
- "@babel/preset-typescript",
5
- ],
6
- extensions: [".js", ".jsx", ".ts", ".tsx"],
2
+ presets: ["@babel/preset-typescript"],
3
+ extensions: [".js", ".ts"],
4
+ cache: true,
5
+ retainLines: true,
7
6
  });
8
7
 
9
8
  module.exports = require("./dev.ts");
package/dist/compiler.js CHANGED
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = compileJs;
7
6
  exports.compileJsSync = compileJsSync;
7
+ exports.default = compileJs;
8
8
 
9
9
  const escodegen = require("escodegen");
10
10
 
@@ -14,7 +14,8 @@ async function compileJs(tree, options) {
14
14
 
15
15
  function compileJsSync(tree, options) {
16
16
  var api = {
17
- format: escodegen.FORMAT_MINIFY
17
+ format: { ...escodegen.FORMAT_MINIFY
18
+ }
18
19
  };
19
20
 
20
21
  if (!options.compact) {
package/dist/constants.js CHANGED
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.reservedIdentifiers = exports.reservedKeywords = void 0;
6
+ exports.reservedKeywords = exports.reservedIdentifiers = void 0;
7
7
 
8
8
  /**
9
9
  * Keywords disallowed for variable names in ES5 and under.
package/dist/index.js CHANGED
@@ -3,8 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.obfuscate = obfuscate;
7
- exports.obfuscateAST = obfuscateAST;
8
6
  Object.defineProperty(exports, "Obfuscator", {
9
7
  enumerable: true,
10
8
  get: function () {
@@ -17,13 +15,15 @@ Object.defineProperty(exports, "Transform", {
17
15
  return _transform.default;
18
16
  }
19
17
  });
18
+ exports.default = exports.debugTransformations = exports.debugObfuscation = void 0;
19
+ exports.obfuscate = obfuscate;
20
+ exports.obfuscateAST = obfuscateAST;
20
21
  Object.defineProperty(exports, "presets", {
21
22
  enumerable: true,
22
23
  get: function () {
23
24
  return _presets.default;
24
25
  }
25
26
  });
26
- exports.default = exports.debugObfuscation = exports.debugTransformations = void 0;
27
27
 
28
28
  var _compiler = _interopRequireWildcard(require("./compiler"));
29
29
 
@@ -43,9 +43,9 @@ var _options = require("./options");
43
43
 
44
44
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
45
45
 
46
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
46
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
47
47
 
48
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
48
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
49
49
 
50
50
  /**
51
51
  * **JsConfuser**: Obfuscates JavaScript.
@@ -67,6 +67,8 @@ var _antiTooling = _interopRequireDefault(require("./transforms/antiTooling"));
67
67
 
68
68
  var _hideInitializingCode = _interopRequireDefault(require("./transforms/hideInitializingCode"));
69
69
 
70
+ var _hexadecimalNumbers = _interopRequireDefault(require("./transforms/hexadecimalNumbers"));
71
+
70
72
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
71
73
 
72
74
  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; }
@@ -76,7 +78,10 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
76
78
  */
77
79
  class Obfuscator extends _events.EventEmitter {
78
80
  constructor(options) {
81
+ var _this;
82
+
79
83
  super();
84
+ _this = this;
80
85
  this.options = options;
81
86
 
82
87
  _defineProperty(this, "varCount", void 0);
@@ -95,10 +100,14 @@ class Obfuscator extends _events.EventEmitter {
95
100
  this.push(new _preparation.default(this));
96
101
  this.push(new _renameLabels.default(this));
97
102
 
98
- const test = (map, ...transformers) => {
103
+ const test = function (map) {
99
104
  if ((0, _probability.isProbabilityMapProbable)(map)) {
105
+ for (var _len = arguments.length, transformers = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
106
+ transformers[_key - 1] = arguments[_key];
107
+ }
108
+
100
109
  // options.verbose && console.log("+ Added " + transformer.name);
101
- transformers.forEach(Transformer => this.push(new Transformer(this)));
110
+ transformers.forEach(Transformer => _this.push(new Transformer(_this)));
102
111
  } else {// options.verbose && console.log("- Skipped adding " + transformer.name);
103
112
  }
104
113
  }; // Optimization: Only add needed transformers. If a probability always return false, no need in running that extra code.
@@ -128,6 +137,7 @@ class Obfuscator extends _events.EventEmitter {
128
137
  test(options.stack, _stack.default);
129
138
  test(true, _antiTooling.default);
130
139
  test(options.hideInitializingCode, _hideInitializingCode.default);
140
+ test(options.hexadecimalNumbers, _hexadecimalNumbers.default);
131
141
 
132
142
  if (options.lock && Object.keys(options.lock).filter(x => x == "domainLock" ? options.lock.domainLock && options.lock.domainLock.length : options.lock[x]).length) {
133
143
  test(true, _lock.default);
@@ -153,7 +163,8 @@ class Obfuscator extends _events.EventEmitter {
153
163
  this.state = "transform";
154
164
  }
155
165
 
156
- async apply(tree, debugMode = false) {
166
+ async apply(tree) {
167
+ let debugMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
157
168
  (0, _assert.ok)(tree.type == "Program", "The root node must be type 'Program'");
158
169
  (0, _assert.ok)(Array.isArray(tree.body), "The root's body property must be an array");
159
170
  (0, _assert.ok)(Array.isArray(this.array));
package/dist/options.js CHANGED
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.validateOptions = validateOptions;
7
6
  exports.correctOptions = correctOptions;
7
+ exports.validateOptions = validateOptions;
8
8
 
9
9
  var _assert = require("assert");
10
10
 
@@ -12,7 +12,7 @@ var _presets = _interopRequireDefault(require("./presets"));
12
12
 
13
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
14
 
15
- const validProperties = new Set(["preset", "target", "indent", "compact", "minify", "es5", "renameVariables", "renameGlobals", "identifierGenerator", "nameRecycling", "controlFlowFlattening", "hideInitializingCode", "globalConcealing", "stringCompression", "stringConcealing", "stringEncoding", "stringSplitting", "duplicateLiteralsRemoval", "dispatcher", "eval", "rgf", "objectExtraction", "flatten", "deadCode", "calculator", "lock", "movedDeclarations", "opaquePredicates", "shuffle", "stack", "verbose", "globalVariables", "debugComments"]);
15
+ const validProperties = new Set(["preset", "target", "indent", "compact", "hexadecimalNumbers", "minify", "es5", "renameVariables", "renameGlobals", "identifierGenerator", "nameRecycling", "controlFlowFlattening", "hideInitializingCode", "globalConcealing", "stringCompression", "stringConcealing", "stringEncoding", "stringSplitting", "duplicateLiteralsRemoval", "dispatcher", "eval", "rgf", "objectExtraction", "flatten", "deadCode", "calculator", "lock", "movedDeclarations", "opaquePredicates", "shuffle", "stack", "verbose", "globalVariables", "debugComments"]);
16
16
  const validOses = new Set(["windows", "linux", "osx", "ios", "android"]);
17
17
  const validBrowsers = new Set(["firefox", "chrome", "iexplorer", "edge", "safari", "opera"]);
18
18
 
package/dist/order.js CHANGED
@@ -39,4 +39,5 @@ exports.ObfuscateOrder = ObfuscateOrder;
39
39
  ObfuscateOrder[ObfuscateOrder["ES5"] = 31] = "ES5";
40
40
  ObfuscateOrder[ObfuscateOrder["StringEncoding"] = 32] = "StringEncoding";
41
41
  ObfuscateOrder[ObfuscateOrder["AntiTooling"] = 34] = "AntiTooling";
42
+ ObfuscateOrder[ObfuscateOrder["HexadecimalNumbers"] = 35] = "HexadecimalNumbers";
42
43
  })(ObfuscateOrder || (exports.ObfuscateOrder = ObfuscateOrder = {}));
package/dist/parser.js CHANGED
@@ -9,9 +9,9 @@ exports.parseSync = parseSync;
9
9
 
10
10
  var assert = _interopRequireWildcard(require("assert"));
11
11
 
12
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
12
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
13
 
14
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
15
 
16
16
  const acorn = require("acorn");
17
17
  /**
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.EXPRESSIONS_PRECEDENCE = exports.NEEDS_PARENTHESES = exports.OPERATOR_PRECEDENCE = void 0;
6
+ exports.OPERATOR_PRECEDENCE = exports.NEEDS_PARENTHESES = exports.EXPRESSIONS_PRECEDENCE = void 0;
7
7
  const OPERATOR_PRECEDENCE = {
8
8
  "||": 3,
9
9
  "&&": 4,
package/dist/presets.js CHANGED
@@ -33,6 +33,7 @@ const highPreset = {
33
33
  preset: "high",
34
34
  calculator: true,
35
35
  compact: true,
36
+ hexadecimalNumbers: true,
36
37
  controlFlowFlattening: 0.75,
37
38
  deadCode: 0.2,
38
39
  dispatcher: true,
@@ -69,6 +70,7 @@ const mediumPreset = {
69
70
  preset: "medium",
70
71
  calculator: true,
71
72
  compact: true,
73
+ hexadecimalNumbers: true,
72
74
  controlFlowFlattening: 0.5,
73
75
  deadCode: 0.025,
74
76
  dispatcher: 0.75,
@@ -96,6 +98,7 @@ const lowPreset = {
96
98
  preset: "low",
97
99
  calculator: true,
98
100
  compact: true,
101
+ hexadecimalNumbers: true,
99
102
  controlFlowFlattening: 0.25,
100
103
  deadCode: 0.01,
101
104
  dispatcher: 0.5,
@@ -16,7 +16,9 @@ var _object = require("./util/object");
16
16
  * @param runner Custom function to determine return value
17
17
  * @param customFnArgs Args given to user-implemented function, such as a variable name.
18
18
  */
19
- function ComputeProbabilityMap(map, runner = x => x, ...customFnArgs) {
19
+ function ComputeProbabilityMap(map) {
20
+ let runner = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : x => x;
21
+
20
22
  if (!map) {
21
23
  return runner();
22
24
  }
@@ -30,6 +32,10 @@ function ComputeProbabilityMap(map, runner = x => x, ...customFnArgs) {
30
32
  }
31
33
 
32
34
  if (typeof map === "function") {
35
+ for (var _len = arguments.length, customFnArgs = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
36
+ customFnArgs[_key - 2] = arguments[_key];
37
+ }
38
+
33
39
  return map(...customFnArgs);
34
40
  }
35
41
 
@@ -19,6 +19,8 @@ var _assert = require("assert");
19
19
 
20
20
  var _precedence = require("../precedence");
21
21
 
22
+ var _template = _interopRequireDefault(require("../templates/template"));
23
+
22
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
25
 
24
26
  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; }
@@ -35,9 +37,15 @@ class Calculator extends _transform.default {
35
37
 
36
38
  _defineProperty(this, "calculatorFn", void 0);
37
39
 
40
+ _defineProperty(this, "calculatorOpVar", void 0);
41
+
42
+ _defineProperty(this, "calculatorSetOpFn", void 0);
43
+
38
44
  this.ops = Object.create(null);
39
45
  this.statesUsed = new Set();
40
46
  this.calculatorFn = this.getPlaceholder();
47
+ this.calculatorOpVar = this.getPlaceholder();
48
+ this.calculatorSetOpFn = this.getPlaceholder();
41
49
  this.gen = this.getGenerator();
42
50
  }
43
51
 
@@ -48,7 +56,6 @@ class Calculator extends _transform.default {
48
56
  return;
49
57
  }
50
58
 
51
- var opArg = this.getPlaceholder();
52
59
  var leftArg = this.getPlaceholder();
53
60
  var rightArg = this.getPlaceholder();
54
61
  var switchCases = [];
@@ -58,7 +65,12 @@ class Calculator extends _transform.default {
58
65
  var body = [(0, _gen.ReturnStatement)(factory(operator, (0, _gen.Identifier)(leftArg), (0, _gen.Identifier)(rightArg)))];
59
66
  switchCases.push((0, _gen.SwitchCase)((0, _gen.Literal)(code), body));
60
67
  });
61
- var func = (0, _gen.FunctionDeclaration)(this.calculatorFn, [opArg, leftArg, rightArg].map(x => (0, _gen.Identifier)(x)), [(0, _gen.SwitchStatement)((0, _gen.Identifier)(opArg), switchCases)]);
68
+ var func = (0, _gen.FunctionDeclaration)(this.calculatorFn, [leftArg, rightArg].map(x => (0, _gen.Identifier)(x)), [(0, _gen.SwitchStatement)((0, _gen.Identifier)(this.calculatorOpVar), switchCases)]);
69
+ (0, _insert.prepend)(tree, (0, _gen.VariableDeclaration)((0, _gen.VariableDeclarator)(this.calculatorOpVar)));
70
+ (0, _insert.prepend)(tree, (0, _template.default)("function {name}(a){\n a = {b} + ({b}=a, 0);\n return a;\n }").single({
71
+ name: this.calculatorSetOpFn,
72
+ b: this.calculatorOpVar
73
+ }));
62
74
  (0, _insert.prepend)(tree, func);
63
75
  }
64
76
 
@@ -99,7 +111,7 @@ class Calculator extends _transform.default {
99
111
  this.log(operator, "calc(".concat(newState, ", left, right)"));
100
112
  }
101
113
 
102
- this.replace(object, (0, _gen.CallExpression)((0, _gen.Identifier)(this.calculatorFn), [(0, _gen.Literal)(this.ops[operator]), object.left, object.right]));
114
+ this.replace(object, (0, _gen.CallExpression)((0, _gen.Identifier)(this.calculatorFn), [object.left, object.right, (0, _random.choice)([(0, _gen.AssignmentExpression)("=", (0, _gen.Identifier)(this.calculatorOpVar), (0, _gen.Literal)(this.ops[operator])), (0, _gen.CallExpression)((0, _gen.Identifier)(this.calculatorSetOpFn), [(0, _gen.Literal)(this.ops[operator])])])]));
103
115
  };
104
116
  }
105
117
 
@@ -71,6 +71,8 @@ class ControlFlowFlattening extends _transform.default {
71
71
  }
72
72
 
73
73
  transform(object, parents) {
74
+ var _this = this;
75
+
74
76
  return () => {
75
77
  if (object.body.length < 3) {
76
78
  return;
@@ -193,20 +195,30 @@ class ControlFlowFlattening extends _transform.default {
193
195
 
194
196
  var resultVar = this.getPlaceholder();
195
197
  var argVar = this.getPlaceholder();
198
+ var testVar = this.getPlaceholder();
199
+ var stringBankVar = this.getPlaceholder();
200
+ var stringBank = Object.create(null);
201
+ var stringBankByLabels = Object.create(null);
202
+ let stringBankGen = this.getGenerator();
203
+ var needsTestVar = false;
196
204
  var needsResultAndArgVar = false;
205
+ var needsStringBankVar = false;
197
206
  var fnToLabel = Object.create(null);
198
207
  fnNames.forEach(fnName => {
199
208
  fnToLabel[fnName] = this.getPlaceholder();
200
209
  });
201
210
 
202
- const flattenBody = (body, startingLabel = this.getPlaceholder()) => {
211
+ const flattenBody = function (body) {
212
+ let startingLabel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _this.getPlaceholder();
203
213
  var chunks = [];
204
214
  var currentBody = [];
205
215
  var currentLabel = startingLabel;
206
216
 
207
- const finishCurrentChunk = (pointingLabel, newLabel, addGotoStatement = true) => {
217
+ const finishCurrentChunk = function (pointingLabel, newLabel) {
218
+ let addGotoStatement = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
219
+
208
220
  if (!newLabel) {
209
- newLabel = this.getPlaceholder();
221
+ newLabel = _this.getPlaceholder();
210
222
  }
211
223
 
212
224
  if (!pointingLabel) {
@@ -224,6 +236,25 @@ class ControlFlowFlattening extends _transform.default {
224
236
  label: currentLabel,
225
237
  body: [...currentBody]
226
238
  });
239
+ (0, _traverse.walk)(currentBody, [], (o, p) => {
240
+ if (o.type == "Literal" && typeof o.value == "string" && !o.regex && Math.random() / (Object.keys(stringBank).length / 2 + 1) > 0.5) {
241
+ needsStringBankVar = true;
242
+
243
+ if (!stringBankByLabels[currentLabel]) {
244
+ stringBankByLabels[currentLabel] = new Set();
245
+ }
246
+
247
+ stringBankByLabels[currentLabel].add(o.value);
248
+
249
+ if (typeof stringBank[o.value] === "undefined") {
250
+ stringBank[o.value] = stringBankGen.generate();
251
+ }
252
+
253
+ return () => {
254
+ _this.replaceIdentifierOrLiteral(o, (0, _gen.MemberExpression)((0, _gen.Identifier)(stringBankVar), (0, _gen.Literal)(stringBank[o.value]), true), p);
255
+ };
256
+ }
257
+ });
227
258
  currentLabel = newLabel;
228
259
  currentBody = [];
229
260
  };
@@ -241,7 +272,8 @@ class ControlFlowFlattening extends _transform.default {
241
272
  }
242
273
 
243
274
  if (stmt.$callExpression && fnToLabel[stmt.$fnName]) {
244
- var afterPath = this.getPlaceholder();
275
+ var afterPath = _this.getPlaceholder();
276
+
245
277
  var args = [];
246
278
 
247
279
  switch (stmt.$callExpression) {
@@ -298,10 +330,15 @@ class ControlFlowFlattening extends _transform.default {
298
330
 
299
331
  var isLoop = !isSwitchStatement;
300
332
  var supportContinueStatement = isLoop;
301
- var testPath = this.getPlaceholder();
302
- var updatePath = this.getPlaceholder();
303
- var bodyPath = this.getPlaceholder();
304
- var afterPath = this.getPlaceholder();
333
+
334
+ var testPath = _this.getPlaceholder();
335
+
336
+ var updatePath = _this.getPlaceholder();
337
+
338
+ var bodyPath = _this.getPlaceholder();
339
+
340
+ var afterPath = _this.getPlaceholder();
341
+
305
342
  var possible = true;
306
343
  var toReplace = [];
307
344
  (0, _traverse.walk)(control.body, [], (o, p) => {
@@ -327,15 +364,19 @@ class ControlFlowFlattening extends _transform.default {
327
364
  return;
328
365
  }
329
366
 
330
- toReplace.forEach(v => this.replace(v[0], v[1]));
367
+ toReplace.forEach(v => _this.replace(v[0], v[1]));
331
368
 
332
369
  if (isSwitchStatement) {
333
- var switchVarName = this.getPlaceholder();
370
+ var switchVarName = _this.getPlaceholder();
371
+
334
372
  currentBody.push((0, _gen.VariableDeclaration)((0, _gen.VariableDeclarator)(switchVarName, control.discriminant)));
335
- var afterPath = this.getPlaceholder();
373
+
374
+ var afterPath = _this.getPlaceholder();
375
+
336
376
  finishCurrentChunk();
337
377
  control.cases.forEach((switchCase, i) => {
338
- var entryPath = this.getPlaceholder();
378
+ var entryPath = _this.getPlaceholder();
379
+
339
380
  currentBody.push((0, _gen.IfStatement)((0, _gen.BinaryExpression)("===", (0, _gen.Identifier)(switchVarName), switchCase.test), [{
340
381
  type: "GotoStatement",
341
382
  label: entryPath
@@ -364,13 +405,18 @@ class ControlFlowFlattening extends _transform.default {
364
405
 
365
406
 
366
407
  finishCurrentChunk(isPostTest ? bodyPath : testPath, testPath);
367
- currentBody.push((0, _gen.IfStatement)(control.test || (0, _gen.Literal)(true), [{
408
+ currentBody.push((0, _gen.ExpressionStatement)((0, _gen.AssignmentExpression)("=", (0, _gen.Identifier)(testVar), control.test || (0, _gen.Literal)(true))));
409
+ needsTestVar = true;
410
+ finishCurrentChunk();
411
+ currentBody.push((0, _gen.IfStatement)((0, _gen.Identifier)(testVar), [{
368
412
  type: "GotoStatement",
369
413
  label: bodyPath
370
414
  }])); // create new label called `bodyPath` and have test body point to afterPath (goto afterPath)
371
415
 
372
416
  finishCurrentChunk(afterPath, bodyPath);
373
- var innerBothPath = this.getPlaceholder();
417
+
418
+ var innerBothPath = _this.getPlaceholder();
419
+
374
420
  chunks.push(...flattenBody([...control.body.body, {
375
421
  type: "GotoStatement",
376
422
  label: updatePath
@@ -388,13 +434,20 @@ class ControlFlowFlattening extends _transform.default {
388
434
  }
389
435
 
390
436
  if (stmt.type == "IfStatement" && stmt.consequent.type == "BlockStatement" && (!stmt.alternate || stmt.alternate.type == "BlockStatement")) {
437
+ finishCurrentChunk();
438
+ currentBody.push((0, _gen.ExpressionStatement)((0, _gen.AssignmentExpression)("=", (0, _gen.Identifier)(testVar), stmt.test)));
439
+ needsTestVar = true;
391
440
  finishCurrentChunk();
392
441
  var hasAlternate = !!stmt.alternate;
393
442
  (0, _assert.ok)(!(hasAlternate && stmt.alternate.type !== "BlockStatement"));
394
- var yesPath = this.getPlaceholder();
395
- var noPath = this.getPlaceholder();
396
- var afterPath = this.getPlaceholder();
397
- currentBody.push((0, _gen.IfStatement)(stmt.test, [{
443
+
444
+ var yesPath = _this.getPlaceholder();
445
+
446
+ var noPath = _this.getPlaceholder();
447
+
448
+ var afterPath = _this.getPlaceholder();
449
+
450
+ currentBody.push((0, _gen.IfStatement)((0, _gen.Identifier)(testVar), [{
398
451
  type: "GotoStatement",
399
452
  label: yesPath
400
453
  }]));
@@ -574,6 +627,7 @@ class ControlFlowFlattening extends _transform.default {
574
627
  var made = 1;
575
628
  var breaksInsertion = [];
576
629
  var staticStateValues = [...labelToStates[chunk.label]];
630
+ var potentialBranches = new Set();
577
631
  chunk.body.forEach((stmt, stmtIndex) => {
578
632
  var addBreak = false;
579
633
  (0, _traverse.walk)(stmt, [], (o, p) => {
@@ -603,6 +657,7 @@ class ControlFlowFlattening extends _transform.default {
603
657
  p[blockIndex].body.splice(childIndex + 1, 0, (0, _gen.BreakStatement)(switchLabel));
604
658
  }
605
659
 
660
+ potentialBranches.add(o.label);
606
661
  var mutatingStateValues = [...labelToStates[chunk.label]];
607
662
  var nextStateValues = labelToStates[o.label];
608
663
  (0, _assert.ok)(nextStateValues, o.label);
@@ -622,10 +677,21 @@ class ControlFlowFlattening extends _transform.default {
622
677
  breaksInsertion.reverse();
623
678
  breaksInsertion.forEach(index => {
624
679
  chunk.body.splice(index + 1, 0, (0, _gen.BreakStatement)(switchLabel));
625
- }); // var c = Identifier("undefined");
680
+ });
681
+
682
+ for (var branch of Array.from(potentialBranches)) {
683
+ var strings = stringBankByLabels[branch];
684
+
685
+ if (strings) {
686
+ chunk.body.unshift((0, _gen.ExpressionStatement)((0, _gen.SequenceExpression)(Array.from(strings).map(strValue => {
687
+ return (0, _gen.AssignmentExpression)("=", (0, _gen.MemberExpression)((0, _gen.Identifier)(stringBankVar), (0, _gen.Literal)(stringBank[strValue]), true), (0, _gen.Literal)(strValue));
688
+ }))));
689
+ }
690
+ } // var c = Identifier("undefined");
626
691
  // this.addComment(c, stateValues.join(", "));
627
692
  // transitionStatements.push(c);
628
693
 
694
+
629
695
  var caseObject = {
630
696
  body: chunk.body,
631
697
  state: state,
@@ -658,11 +724,19 @@ class ControlFlowFlattening extends _transform.default {
658
724
  }));
659
725
  var declarations = [];
660
726
 
727
+ if (needsTestVar) {
728
+ declarations.push((0, _gen.VariableDeclarator)(testVar));
729
+ }
730
+
661
731
  if (needsResultAndArgVar) {
662
732
  declarations.push((0, _gen.VariableDeclarator)(resultVar));
663
733
  declarations.push((0, _gen.VariableDeclarator)(argVar));
664
734
  }
665
735
 
736
+ if (needsStringBankVar) {
737
+ declarations.push((0, _gen.VariableDeclarator)(stringBankVar, (0, _gen.ObjectExpression)(stringBankByLabels[startLabel] ? Array.from(stringBankByLabels[startLabel]).map(strValue => (0, _gen.Property)((0, _gen.Literal)(stringBank[strValue]), (0, _gen.Literal)(strValue), false)) : [])));
738
+ }
739
+
666
740
  declarations.push(...stateVars.map((stateVar, i) => {
667
741
  return (0, _gen.VariableDeclarator)(stateVar, (0, _gen.Literal)(initStateValues[i]));
668
742
  }));
@@ -25,7 +25,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
25
25
 
26
26
  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; }
27
27
 
28
- const templates = [(0, _template.default)("\n function curCSS( elem, name, computed ) {\n var ret;\n \n computed = computed || getStyles( elem );\n \n if ( computed ) {\n ret = computed.getPropertyValue( name ) || computed[ name ];\n \n if ( ret === \"\" && !isAttached( elem ) ) {\n ret = redacted.style( elem, name );\n }\n }\n \n return ret !== undefined ?\n \n // Support: IE <=9 - 11+\n // IE returns zIndex value as an integer.\n ret + \"\" :\n ret;\n }"), (0, _template.default)("\n function Example() {\n var state = redacted.useState(false);\n return x(\n ErrorBoundary,\n null,\n x(\n DisplayName,\n null,\n )\n );\n }"), (0, _template.default)("\n const path = require('path');\nconst { version } = require('../../package');\nconst { version: dashboardPluginVersion } = require('@redacted/enterprise-plugin/package');\nconst { version: componentsVersion } = require('@redacted/components/package');\nconst { sdkVersion } = require('@redacted/enterprise-plugin');\nconst isStandaloneExecutable = require('../utils/isStandaloneExecutable');\nconst resolveLocalRedactedPath = require('./resolve-local-redacted-path');\n\nconst redactedPath = path.resolve(__dirname, '../redacted.js');"), (0, _template.default)("\nmodule.exports = async (resolveLocalRedactedPath = ()=>{throw new Error(\"No redacted path provided\")}) => {\n const cliParams = new Set(process.argv.slice(2));\n if (!cliParams.has('--version')) {\n if (cliParams.size !== 1) return false;\n if (!cliParams.has('-v')) return false;\n }\n\n const installationModePostfix = await (async (isStandaloneExecutable, redactedPath) => {\n if (isStandaloneExecutable) return ' (standalone)';\n if (redactedPath === (await resolveLocalRedactedPath())) return ' (local)';\n return '';\n })();\n\n return true;\n};"), (0, _template.default)("\nfunction setCookie(cname, cvalue, exdays) {\n var d = new Date();\n d.setTime(d.getTime() + (exdays*24*60*60*1000));\n var expires = \"expires=\"+ d.toUTCString();\n document.cookie = cname + \"=\" + cvalue + \";\" + expires + \";path=/\";\n}"), (0, _template.default)("function getCookie(cname) {\n var name = cname + \"=\";\n var decodedCookie = decodeURIComponent(document.cookie);\n var ca = decodedCookie.split(';');\n for(var i = 0; i <ca.length; i++) {\n var c = ca[i];\n while (c.charAt(0) == ' ') {\n c = c.substring(1);\n }\n if (c.indexOf(name) == 0) {\n return c.substring(name.length, c.length);\n }\n }\n return \"\";\n}"), (0, _template.default)("function getLocalStorageValue(key, cb){\n if ( typeof key !== \"string\" ) {\n throw new Error(\"Invalid data key provided (not type string)\")\n }\n if ( !key ) {\n throw new Error(\"Invalid data key provided (empty string)\")\n }\n var value = window.localStorage.getItem(key)\n try {\n value = JSON.parse(value)\n } catch ( e ) {\n cb(new Error(\"Serialization error for data '\" + key + \"': \" + e.message))\n }\n\n cb(null, value)\n }"), (0, _template.default)("\n \n var __ = \"(c=ak(<~F$VU'9f)~><&85dBPL-module/from\";\n var s = \"q:function(){var ad=ad=>b(ad-29);if(!T.r[(typeof ab==ad(123)?\";\n var g = \"return U[c[c[d(-199)]-b(205)]]||V[ae(b(166))];case T.o[c[c[c[d(-199)]+d(-174)]-(c[b(119)]-(c[d(-199)]-163))]+ae(b(146))](0)==b(167)?d(-130):-d(-144)\";\n\n __.match(s + g);\n ")];
28
+ const templates = [(0, _template.default)("\n function curCSS( elem, name, computed ) {\n var ret;\n \n computed = computed || getStyles( elem );\n \n if ( computed ) {\n ret = computed.getPropertyValue( name ) || computed[ name ];\n \n if ( ret === \"\" && !isAttached( elem ) ) {\n ret = redacted.style( elem, name );\n }\n }\n \n return ret !== undefined ?\n \n // Support: IE <=9 - 11+\n // IE returns zIndex value as an integer.\n ret + \"\" :\n ret;\n }"), (0, _template.default)("\n function Example() {\n var state = redacted.useState(false);\n return x(\n ErrorBoundary,\n null,\n x(\n DisplayName,\n null,\n )\n );\n }"), (0, _template.default)("\n const path = require('path');\nconst { version } = require('../../package');\nconst { version: dashboardPluginVersion } = require('@redacted/enterprise-plugin/package');\nconst { version: componentsVersion } = require('@redacted/components/package');\nconst { sdkVersion } = require('@redacted/enterprise-plugin');\nconst isStandaloneExecutable = require('../utils/isStandaloneExecutable');\nconst resolveLocalRedactedPath = require('./resolve-local-redacted-path');\n\nconst redactedPath = path.resolve(__dirname, '../redacted.js');"), (0, _template.default)("\nmodule.exports = async (resolveLocalRedactedPath = ()=>{throw new Error(\"No redacted path provided\")}) => {\n const cliParams = new Set(process.argv.slice(2));\n if (!cliParams.has('--version')) {\n if (cliParams.size !== 1) return false;\n if (!cliParams.has('-v')) return false;\n }\n\n const installationModePostfix = await (async (isStandaloneExecutable, redactedPath) => {\n if (isStandaloneExecutable) return ' (standalone)';\n if (redactedPath === (await resolveLocalRedactedPath())) return ' (local)';\n return '';\n })();\n\n return true;\n};"), (0, _template.default)("\nfunction setCookie(cname, cvalue, exdays) {\n var d = new Date();\n d.setTime(d.getTime() + (exdays*24*60*60*1000));\n var expires = \"expires=\"+ d.toUTCString();\n document.cookie = cname + \"=\" + cvalue + \";\" + expires + \";path=/\";\n}"), (0, _template.default)("function getCookie(cname) {\n var name = cname + \"=\";\n var decodedCookie = decodeURIComponent(document.cookie);\n var ca = decodedCookie.split(';');\n for(var i = 0; i <ca.length; i++) {\n var c = ca[i];\n while (c.charAt(0) == ' ') {\n c = c.substring(1);\n }\n if (c.indexOf(name) == 0) {\n return c.substring(name.length, c.length);\n }\n }\n return \"\";\n}"), (0, _template.default)("function getLocalStorageValue(key, cb){\n if ( typeof key !== \"string\" ) {\n throw new Error(\"Invalid data key provided (not type string)\")\n }\n if ( !key ) {\n throw new Error(\"Invalid data key provided (empty string)\")\n }\n var value = window.localStorage.getItem(key)\n try {\n value = JSON.parse(value)\n } catch ( e ) {\n cb(new Error(\"Serialization error for data '\" + key + \"': \" + e.message))\n }\n\n cb(null, value)\n }"), (0, _template.default)("\n \n var __ = \"(c=ak(<~F$VU'9f)~><&85dBPL-module/from\";\n var s = \"q:function(){var ad=ad=>b(ad-29);if(!T.r[(typeof ab==ad(123)?\";\n var g = \"return U[c[c[d(-199)]-b(205)]]||V[ae(b(166))];case T.o[c[c[c[d(-199)]+d(-174)]-(c[b(119)]-(c[d(-199)]-163))]+ae(b(146))](0)==b(167)?d(-130):-d(-144)\";\n\n __.match(s + g);\n "), (0, _template.default)("\n function vec_pack(vec) {\n return vec[1] * 67108864 + (vec[0] < 0 ? 33554432 | vec[0] : vec[0]);\n }\n \n function vec_unpack(number) {\n switch (((number & 33554432) !== 0) * 1 + (number < 0) * 2) {\n case 0:\n return [number % 33554432, Math.trunc(number / 67108864)];\n case 1:\n return [\n (number % 33554432) - 33554432,\n Math.trunc(number / 67108864) + 1,\n ];\n case 2:\n return [\n (((number + 33554432) % 33554432) + 33554432) % 33554432,\n Math.round(number / 67108864),\n ];\n case 3:\n return [number % 33554432, Math.trunc(number / 67108864)];\n }\n }\n \n let a = vec_pack([2, 4]);\n let b = vec_pack([1, 2]);\n \n let c = a + b; // Vector addition\n let d = c - b; // Vector subtraction\n let e = d * 2; // Scalar multiplication\n let f = e / 2; // Scalar division\n \n console.log(vec_unpack(c)); // [3, 6]\n console.log(vec_unpack(d)); // [2, 4]\n console.log(vec_unpack(e)); // [4, 8]\n console.log(vec_unpack(f)); // [2, 4]\n "), (0, _template.default)("\n function buildCharacterMap(str) {\n const characterMap = {};\n \n for (let char of str.replace(/[^w]/g, \"\").toLowerCase())\n characterMap[char] = characterMap[char] + 1 || 1;\n \n return characterMap;\n }\n \n function isAnagrams(stringA, stringB) {\n const stringAMap = buildCharMap(stringA);\n const stringBMap = buildCharMap(stringB);\n \n for (let char in stringAMap) {\n if (stringAMap[char] !== stringBMap[char]) {\n return false;\n }\n }\n \n if (Object.keys(stringAMap).length !== Object.keys(stringBMap).length) {\n return false;\n }\n \n return true;\n }\n \n /**\n * @param {TreeNode} root\n * @return {boolean}\n */\n function isBalanced(root) {\n const height = getHeightBalanced(root);\n return height !== Infinity;\n }\n \n function getHeightBalanced(node) {\n if (!node) {\n return -1;\n }\n \n const leftTreeHeight = getHeightBalanced(node.left);\n const rightTreeHeight = getHeightBalanced(node.right);\n \n const heightDiff = Math.abs(leftTreeHeight - rightTreeHeight);\n \n if (\n leftTreeHeight === Infinity ||\n rightTreeHeight === Infinity ||\n heightDiff > 1\n ) {\n return Infinity;\n }\n \n const currentHeight = Math.max(leftTreeHeight, rightTreeHeight) + 1;\n return currentHeight;\n }\n \n window[\"__GLOBAL__HELPERS__\"] = {\n buildCharacterMap,\n isAnagrams,\n isBalanced,\n getHeightBalanced,\n };\n ")];
29
29
  /**
30
30
  * Adds dead code to blocks.
31
31
  *
@@ -255,7 +255,9 @@ class Dispatcher extends _transform.default {
255
255
  (0, _insert.prepend)(object, (0, _gen.VariableDeclaration)((0, _gen.VariableDeclarator)(payloadArg, (0, _gen.ArrayExpression)([]))));
256
256
  }
257
257
 
258
- identifiers.forEach(([o, p]) => {
258
+ identifiers.forEach(_ref => {
259
+ let [o, p] = _ref;
260
+
259
261
  if (o.type != "Identifier") {
260
262
  return;
261
263
  }