diff --git a/MODULES.md b/MODULES.md index 69a63e483e..e50bd12760 100644 --- a/MODULES.md +++ b/MODULES.md @@ -109,6 +109,27 @@ export function bar() { }); ``` +### Ignore + + +**In** + +```javascript +import foo from "foo"; + +export function bar() { + return foo("foobar"); +} +``` + +**Out** + +```javascript +function bar() { + return foo("foobar"); +} +``` + ## Custom You can alternatively specify module names instead of one of the built-in types. diff --git a/lib/6to5/modules/ignore.js b/lib/6to5/modules/ignore.js new file mode 100644 index 0000000000..766e9f5ff4 --- /dev/null +++ b/lib/6to5/modules/ignore.js @@ -0,0 +1,21 @@ +module.exports = IgnoreFormatter; + +function IgnoreFormatter(file) { + +} + +IgnoreFormatter.prototype.import = function (node, nodes) { + +}; + +IgnoreFormatter.prototype.importSpecifier = function (specifier, node, nodes) { + +}; + +IgnoreFormatter.prototype.export = function (node, nodes) { + nodes.push(node.declaration); +}; + +IgnoreFormatter.prototype.exportSpecifier = function (specifier, node, nodes) { + +}; diff --git a/lib/6to5/transform.js b/lib/6to5/transform.js index 27ec29dcec..6a3047a25a 100644 --- a/lib/6to5/transform.js +++ b/lib/6to5/transform.js @@ -117,6 +117,7 @@ transform.transformers = { transform.moduleFormatters = { common: require("./modules/common"), + ignore: require("./modules/ignore"), amd: require("./modules/amd"), umd: require("./modules/umd") };