Sha256: 52f847e493ca9e035a983c01bbf09c0afa800968a9851e195edf36054bb37da1

Contents?: true

Size: 820 Bytes

Versions: 8

Compression:

Stored size: 820 Bytes

Contents

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

exports["default"] = function (_ref) {
  var Plugin = _ref.Plugin;
  var parse = _ref.parse;
  var traverse = _ref.traverse;

  return new Plugin("eval", {
    metadata: {
      group: "builtin-pre"
    },

    visitor: {
      CallExpression: function CallExpression(node) {
        if (this.get("callee").isIdentifier({ name: "eval" }) && node.arguments.length === 1) {
          var evaluate = this.get("arguments")[0].evaluate();
          if (!evaluate.confident) return;

          var code = evaluate.value;
          if (typeof code !== "string") return;

          var ast = parse(code);
          traverse.removeProperties(ast);
          return ast.program;
        }
      }
    }
  });
};

module.exports = exports["default"];

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
ilog-0.4.1 node_modules/babel-plugin-eval/lib/index.js
ilog-0.4.0 node_modules/babel-plugin-eval/lib/index.js
ilog-0.3.3 node_modules/babel-plugin-eval/lib/index.js
xcodebuild-helper-1.2.5 externals/ios-sim-master/node_modules/babel-plugin-eval/lib/index.js
xcodebuild-helper-1.2.3 externals/ios-sim-master/node_modules/babel-plugin-eval/lib/index.js
es6_tilt-0.1.2 test/dummy/app/assets/javascripts/node_modules/babel-plugin-eval/lib/index.js
es6_tilt-0.1.1 test/dummy/app/assets/javascripts/node_modules/babel-plugin-eval/lib/index.js
es6_tilt-0.1.0 test/dummy/app/assets/javascripts/node_modules/babel-plugin-eval/lib/index.js