While it isn't technically needed because regenerator already handles
async functions, it doesn't play well with the Promise detection logic
used by @babel/preset-env's useBuiltIns and @babel/transform-runtime.
The plugin exclusion logic isn't removed, because
1) it will be useful when merging @babel/preset-modules
into @babel/preset-env
2) if/when regenerator will support injecting a custom promise,
we can enable this optimization again
17 lines
416 B
JavaScript
17 lines
416 B
JavaScript
"use strict";
|
|
|
|
module.exports = new Map();
|
|
|
|
// async -> regenerator is better than async -> generator -> regenerator
|
|
ifIncluded("transform-regenerator")
|
|
// https://github.com/babel/babel/issues/10678
|
|
// .isUnnecessary("transform-async-to-generator");
|
|
|
|
function ifIncluded(name) {
|
|
const set = new Set();
|
|
module.exports.set(name, set);
|
|
return {
|
|
isUnnecessary(name) { set.add(name); return this; }
|
|
};
|
|
}
|