-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
parser: add parse-only support for "import.meta" #6958
Conversation
Summary: Resolves facebook#6913. As with `new.target`, we can parse the expression, but we fail to typecheck it. Clients can use a suppression comment to ignore uses of `import.meta` in an otherwise valid file. The parse error message on inputs like `import.notMeta` was chosen to be consistent with the message emitted by Babylon. Test Plan: Unit tests added, and all existing tests pass. wchargin-branch: parse-import-meta
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.
@mroch is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
@mroch is this still on your radar? |
/cc @mroch |
1 similar comment
I went ahead and merged in changes over the last year, fixed conflicts, |
2dbb33d
to
400f03c
Compare
400f03c
to
a9190bc
Compare
Happy birthday! This pull request is two years old. As such, I’ve again |
You're so brave @wchargin This issue is the reason I'm going to TypeScript. I thought Flow was a better idea overall than TypeScript, but the latest versions and the governance of the project made me lose trust in it. Happy birthday to the issue! |
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.
@jbrown215 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
From @mroch:
The lint errors are ocamlformat errors. I can fix that on my side! |
Any chance to get this PR merged? |
Hi @jbrown215 @mroch! Any new on this feature? |
Get it merged, you turkeys |
This pull request has been merged in 0851b3e. |
Bless. |
There you go |
Is there any way to type |
What should that be? Do you have links to documentation? |
It's used by Vite to access environment variables. It works identically to process.env |
If I add a So you could do
|
I think it would be fine, anyways most of the times all you do is doing a string comparison so even if it's mixed it will work just fine. Of course having a way to extend such types in user land would be optimal, as import.meta is thought to be user extensible. |
…property lookup Summary: "The import.meta object exposes context-specific metadata to a JavaScript module." This means it can contain arbitrary data. To allow our users to access this data in a safe way, we can add a `[string]: mixed` indexer. Requested in GitHub: #6958 (comment) Changelog: [feature] Allow access of arbitrary properties from `import.meta`. They are typed as `mixed` Reviewed By: SamChou19815 Differential Revision: D39072638 fbshipit-source-id: 099dd4b17755210d8a893edf2c2c9a94ae38bd74
Summary:
Resolves #6913. As with
new.target
, we can parse the expression, butwe fail to typecheck it. Clients can use a suppression comment to ignore
uses of
import.meta
in an otherwise valid file.The parse error message on inputs like
import.notMeta
was chosen to beconsistent with the message emitted by Babylon.
Test Plan:
Unit tests added, and all existing tests pass.
wchargin-branch: parse-import-meta