index.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. "use strict";
  2. exports.__esModule = true;
  3. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  4. var _getIterator3 = _interopRequireDefault(_getIterator2);
  5. exports.default = function () {
  6. return {
  7. visitor: {
  8. Program: function Program(path, state) {
  9. if (state.opts.strict === false || state.opts.strictMode === false) return;
  10. var node = path.node;
  11. for (var _iterator = node.directives, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  12. var _ref;
  13. if (_isArray) {
  14. if (_i >= _iterator.length) break;
  15. _ref = _iterator[_i++];
  16. } else {
  17. _i = _iterator.next();
  18. if (_i.done) break;
  19. _ref = _i.value;
  20. }
  21. var directive = _ref;
  22. if (directive.value.value === "use strict") return;
  23. }
  24. path.unshiftContainer("directives", t.directive(t.directiveLiteral("use strict")));
  25. }
  26. }
  27. };
  28. };
  29. var _babelTypes = require("babel-types");
  30. var t = _interopRequireWildcard(_babelTypes);
  31. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  32. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  33. module.exports = exports["default"];