diff --git a/src/babel/transformation/transformers/other/flow.js b/src/babel/transformation/transformers/other/flow.js index f058924a59..84dda2a7d5 100644 --- a/src/babel/transformation/transformers/other/flow.js +++ b/src/babel/transformation/transformers/other/flow.js @@ -5,6 +5,13 @@ export var metadata = { }; export var visitor = { + Program(node, parent, scope, file) { + for (var comment of (file.ast.comments: Array)) { + if (comment.value.indexOf("@flow") >= 0) { + comment._displayed = true; + } + } + }, Flow() { this.dangerouslyRemove(); }, diff --git a/test/core/fixtures/transformation/flow/strip-directive/actual.js b/test/core/fixtures/transformation/flow/strip-directive/actual.js new file mode 100644 index 0000000000..575f234bbc --- /dev/null +++ b/test/core/fixtures/transformation/flow/strip-directive/actual.js @@ -0,0 +1,9 @@ +/*@flow*/ + +/* @flow */ + +/** + * @flow + */ + +foo(); diff --git a/test/core/fixtures/transformation/flow/strip-directive/expected.js b/test/core/fixtures/transformation/flow/strip-directive/expected.js new file mode 100644 index 0000000000..a280f9a5cc --- /dev/null +++ b/test/core/fixtures/transformation/flow/strip-directive/expected.js @@ -0,0 +1 @@ +foo();