Sha256: 4fb4205ec0c2736c768ec4d291934c7d3b7fb14e600978d5261fb7867a5a9360

Contents?: true

Size: 1.58 KB

Versions: 8

Compression:

Stored size: 1.58 KB

Contents

// https://github.com/leebyron/ecmascript-more-export-from

"use strict";

exports.__esModule = true;
// istanbul ignore next

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; } }

var _types = require("../../../types");

var t = _interopRequireWildcard(_types);

var metadata = {
  stage: 1
};

exports.metadata = metadata;
/**
 * [Please add a description.]
 */

function build(node, nodes, scope) {
  var first = node.specifiers[0];
  if (!t.isExportNamespaceSpecifier(first) && !t.isExportDefaultSpecifier(first)) return;

  var specifier = node.specifiers.shift();
  var uid = scope.generateUidIdentifier(specifier.exported.name);

  var newSpecifier;
  if (t.isExportNamespaceSpecifier(specifier)) {
    newSpecifier = t.importNamespaceSpecifier(uid);
  } else {
    newSpecifier = t.importDefaultSpecifier(uid);
  }

  nodes.push(t.importDeclaration([newSpecifier], node.source));
  nodes.push(t.exportNamedDeclaration(null, [t.exportSpecifier(uid, specifier.exported)]));

  build(node, nodes, scope);
}

/**
 * [Please add a description.]
 */

var visitor = {

  /**
   * [Please add a description.]
   */

  ExportNamedDeclaration: function ExportNamedDeclaration(node, parent, scope) {
    var nodes = [];
    build(node, nodes, scope);
    if (!nodes.length) return;

    if (node.specifiers.length >= 1) {
      nodes.push(node);
    }

    return nodes;
  }
};
exports.visitor = visitor;

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
ilog-0.4.1 node_modules/babel/node_modules/babel-core/lib/transformation/transformers/es7/export-extensions.js
ilog-0.4.0 node_modules/babel/node_modules/babel-core/lib/transformation/transformers/es7/export-extensions.js
ilog-0.3.3 node_modules/babel/node_modules/babel-core/lib/transformation/transformers/es7/export-extensions.js
xcodebuild-helper-1.2.5 externals/ios-sim-master/node_modules/babel-core/lib/transformation/transformers/es7/export-extensions.js
xcodebuild-helper-1.2.3 externals/ios-sim-master/node_modules/babel-core/lib/transformation/transformers/es7/export-extensions.js
es6_tilt-0.1.2 test/dummy/app/assets/javascripts/node_modules/babel-core/lib/transformation/transformers/es7/export-extensions.js
es6_tilt-0.1.1 test/dummy/app/assets/javascripts/node_modules/babel-core/lib/transformation/transformers/es7/export-extensions.js
es6_tilt-0.1.0 test/dummy/app/assets/javascripts/node_modules/babel-core/lib/transformation/transformers/es7/export-extensions.js