-
Notifications
You must be signed in to change notification settings - Fork 47.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(compiler): Support
import.meta
MetaProperty
Resolves #29737
- Loading branch information
Showing
14 changed files
with
146 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
...l-plugin-react-compiler/src/__tests__/fixtures/compiler/meta-property.expect.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
|
||
## Input | ||
|
||
```javascript | ||
function a() { | ||
return import.meta.url; | ||
} | ||
|
||
function b() { | ||
let a = 0; | ||
if (import.meta.url) { | ||
a = 1; | ||
} | ||
return a; | ||
} | ||
|
||
function c() { | ||
let a = 0; | ||
if (import.meta.foo) { | ||
a = 1; | ||
} | ||
return a; | ||
} | ||
|
||
function d() { | ||
let a = 0; | ||
if (import.meta) { | ||
a = 1; | ||
} | ||
return a; | ||
} | ||
|
||
``` | ||
## Code | ||
```javascript | ||
function a() { | ||
return import.meta.url; | ||
} | ||
|
||
function b() { | ||
let a = 0; | ||
if (import.meta.url) { | ||
a = 1; | ||
} | ||
return a; | ||
} | ||
|
||
function c() { | ||
let a = 0; | ||
if (import.meta.foo) { | ||
a = 1; | ||
} | ||
return a; | ||
} | ||
|
||
function d() { | ||
let a = 0; | ||
if (import.meta) { | ||
a = 1; | ||
} | ||
return a; | ||
} | ||
|
||
``` | ||
27 changes: 27 additions & 0 deletions
27
...er/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/meta-property.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
function a() { | ||
return import.meta.url; | ||
} | ||
|
||
function b() { | ||
let a = 0; | ||
if (import.meta.url) { | ||
a = 1; | ||
} | ||
return a; | ||
} | ||
|
||
function c() { | ||
let a = 0; | ||
if (import.meta.foo) { | ||
a = 1; | ||
} | ||
return a; | ||
} | ||
|
||
function d() { | ||
let a = 0; | ||
if (import.meta) { | ||
a = 1; | ||
} | ||
return a; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters