Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add supports for polyfill computed methods (#10398)
- Loading branch information
1 parent
5c859b1
commit 8769903
Showing
12 changed files
with
107 additions
and
19 deletions.
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
5 changes: 5 additions & 0 deletions
5
...-plugin-transform-runtime/test/fixtures/runtime-corejs2/evaluated-static-methods/input.js
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,5 @@ | ||
var _isArray = "isArray"; | ||
|
||
Array["from"]; // polyfill | ||
Array[_isArray]; // polyfill | ||
Array[of]; // don't polyfill |
3 changes: 3 additions & 0 deletions
3
...gin-transform-runtime/test/fixtures/runtime-corejs2/evaluated-static-methods/options.json
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,3 @@ | ||
{ | ||
"plugins": [["transform-runtime", { "corejs": 2 }]] | ||
} |
10 changes: 10 additions & 0 deletions
10
...plugin-transform-runtime/test/fixtures/runtime-corejs2/evaluated-static-methods/output.js
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,10 @@ | ||
var _Array$isArray = require("@babel/runtime-corejs2/core-js/array/is-array"); | ||
|
||
var _Array$from = require("@babel/runtime-corejs2/core-js/array/from"); | ||
|
||
var _isArray = "isArray"; | ||
_Array$from; // polyfill | ||
|
||
_Array$isArray; // polyfill | ||
|
||
Array[of]; // don't polyfill |
2 changes: 1 addition & 1 deletion
2
...s/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/instance-computed/input.js
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 |
---|---|---|
@@ -1 +1 @@ | ||
bar[filter]() | ||
bar[filter]() |
9 changes: 9 additions & 0 deletions
9
...lugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-instance-methods/input.js
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,9 @@ | ||
var _map = "map"; | ||
|
||
object["filter"]; // polyfill | ||
object[_map]; // polyfill | ||
object[find]; // don't polyfill | ||
|
||
object["filter"](); // polyfill | ||
object[_map](); // polyfill | ||
object[find](); // don't polyfill |
5 changes: 5 additions & 0 deletions
5
...n-transform-runtime/test/fixtures/runtime-corejs3/evaluated-instance-methods/options.json
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,5 @@ | ||
{ | ||
"plugins": [ | ||
["transform-runtime", { "corejs": { "version": 3, "proposals": true } }] | ||
] | ||
} |
21 changes: 21 additions & 0 deletions
21
...ugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-instance-methods/output.js
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,21 @@ | ||
var _mapInstanceProperty = require("@babel/runtime-corejs3/core-js/instance/map"); | ||
|
||
var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js/instance/filter"); | ||
|
||
var _map = "map"; | ||
|
||
_filterInstanceProperty(object); // polyfill | ||
|
||
|
||
_mapInstanceProperty(object); // polyfill | ||
|
||
|
||
object[find]; // don't polyfill | ||
|
||
_filterInstanceProperty(object).call(object); // polyfill | ||
|
||
|
||
_mapInstanceProperty(object).call(object); // polyfill | ||
|
||
|
||
object[find](); // don't polyfill |
5 changes: 5 additions & 0 deletions
5
...-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-static-methods/input.js
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,5 @@ | ||
var _isArray = "isArray"; | ||
|
||
Array["from"]; // polyfill | ||
Array[_isArray]; // polyfill | ||
Array[of]; // don't polyfill |
5 changes: 5 additions & 0 deletions
5
...gin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-static-methods/options.json
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,5 @@ | ||
{ | ||
"plugins": [ | ||
["transform-runtime", { "corejs": { "version": 3, "proposals": true } }] | ||
] | ||
} |
10 changes: 10 additions & 0 deletions
10
...plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-static-methods/output.js
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,10 @@ | ||
var _Array$isArray = require("@babel/runtime-corejs3/core-js/array/is-array"); | ||
|
||
var _Array$from = require("@babel/runtime-corejs3/core-js/array/from"); | ||
|
||
var _isArray = "isArray"; | ||
_Array$from; // polyfill | ||
|
||
_Array$isArray; // polyfill | ||
|
||
Array[of]; // don't polyfill |
2 changes: 1 addition & 1 deletion
2
...s/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/instance-computed/input.js
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 |
---|---|---|
@@ -1 +1 @@ | ||
bar[filter]() | ||
bar['filter']() |