-
Notifications
You must be signed in to change notification settings - Fork 47k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transform updates to support Flow this annotation syntax #25918
Changes from all commits
80f2e10
c29471e
c9cedd6
e599d98
0d8af33
475e622
006863c
32262ad
795490d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @noflow | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These files contain flow syntax but are not flow checked. |
||
*/ | ||
|
||
// Provided by www | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
function getComments(path) { | ||
const allComments = path.hub.file.ast.comments; | ||
if (path.node.leadingComments) { | ||
// Babel AST includes comments. | ||
return path.node.leadingComments; | ||
} | ||
// In Hermes AST we need to find the comments by range. | ||
const comments = []; | ||
let line = path.node.loc.start.line; | ||
let i = allComments.length - 1; | ||
while (i >= 0 && allComments[i].loc.end.line >= line) { | ||
i--; | ||
} | ||
while (i >= 0 && allComments[i].loc.end.line === line - 1) { | ||
line = allComments[i].loc.start.line; | ||
comments.unshift(allComments[i]); | ||
i--; | ||
} | ||
return comments; | ||
} | ||
|
||
module.exports = getComments; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7920,6 +7920,20 @@ flow-bin@^0.190.0: | |
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.190.0.tgz#cfc50e1474facf8150232a6c498fe66a6bb75969" | ||
integrity sha512-Qo3bvN3cmGFXsq63ZxcHFZXQDvgx84fCuq8cXuKk5xbvuebBGwMqS+ku/rH+gEkciRrcTYrXqoSzb9b6ShcoJg== | ||
|
||
flow-parser@^0.196.1: | ||
version "0.196.1" | ||
resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.196.1.tgz#3c31f102454518f0c68eeb99f57501c2a0c9bff0" | ||
integrity sha512-V3yaKHyBWhl+LF6sxgbfqxMlwoFKs8UKh2DYTrGj1AHi9ST7Zyp+9ToF4l9eoL6l/DxdFwCNF3MAJ1vCVrgJmw== | ||
|
||
flow-remove-types@^2.196.1: | ||
version "2.196.1" | ||
resolved "https://registry.yarnpkg.com/flow-remove-types/-/flow-remove-types-2.196.1.tgz#c77ab53679beb1b1ba420c16865cea714a67defc" | ||
integrity sha512-pAEe2B/fKtV96MVGWQgmjP5Z1nLeFFe++r83ql1Zj86+p+3IujsbvwxiXCiF/SS6ObbB6TmciCxxd+FsOUyY3Q== | ||
dependencies: | ||
flow-parser "^0.196.1" | ||
pirates "^3.0.2" | ||
vlq "^0.2.1" | ||
|
||
[email protected]: | ||
version "0.13.0" | ||
resolved "https://registry.yarnpkg.com/fluent-syntax/-/fluent-syntax-0.13.0.tgz#417144d99cba94ff474c422b3e6623d5a842855a" | ||
|
@@ -8749,7 +8763,7 @@ [email protected]: | |
resolved "https://registry.yarnpkg.com/hermes-estree/-/hermes-estree-0.9.0.tgz#026e0abe6db1dcf50a81a79014b779a83db3b814" | ||
integrity sha512-5DZ7Y0CbHVk8zPqgRCvqp8iw+P05svnQDI1aJFjdqCfXJ/1CZ+8aYpGlhJ29zCG5SE5duGTzSxogAYYI4QqXqw== | ||
|
||
[email protected]: | ||
[email protected], hermes-parser@^0.9.0: | ||
version "0.9.0" | ||
resolved "https://registry.yarnpkg.com/hermes-parser/-/hermes-parser-0.9.0.tgz#ede3044d50479c61843cef5bbdcea83933d4e4ec" | ||
integrity sha512-IcvJIlAn+9tpHkP+HTsxWKrIdQPp0gvGrrQmxlL4XnNS+Oh6R/Fpxbcoflm2kY3zgQjEvxZxLiK/2+k3/5wsrw== | ||
|
@@ -12991,6 +13005,13 @@ pinpoint@^1.1.0: | |
resolved "https://registry.yarnpkg.com/pinpoint/-/pinpoint-1.1.0.tgz#0cf7757a6977f1bf7f6a32207b709e377388e874" | ||
integrity sha1-DPd1eml38b9/ajIge3CeN3OI6HQ= | ||
|
||
pirates@^3.0.2: | ||
version "3.0.2" | ||
resolved "https://registry.yarnpkg.com/pirates/-/pirates-3.0.2.tgz#7e6f85413fd9161ab4e12b539b06010d85954bb9" | ||
integrity sha512-c5CgUJq6H2k6MJz72Ak1F5sN9n9wlSlJyEnwvpm9/y3WB4E3pHBDT2c6PEiS1vyJvq2bUxUAIu0EGf8Cx4Ic7Q== | ||
dependencies: | ||
node-modules-regexp "^1.0.0" | ||
|
||
pirates@^4.0.0, pirates@^4.0.1: | ||
version "4.0.1" | ||
resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.1.tgz#643a92caf894566f91b2b986d2c66950a8e2fb87" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the new syntax as a test case that all systems now seem to be handling it