Add static Math methods to plugin-transform-runtime (#8616)

* Add static Math methods to plugin-transform-runtime

* Remove methods which are not part of TC39 standard

* Use semver to conditionally include Math module
This commit is contained in:
Siddharth Parmar
2018-09-04 09:19:51 +05:30
committed by Logan Smyth
parent 4beb977f15
commit 262787bd92
5 changed files with 588 additions and 525 deletions

View File

@@ -4,7 +4,7 @@ import { declare } from "@babel/helper-plugin-utils";
import { addDefault, isModule } from "@babel/helper-module-imports";
import { types as t } from "@babel/core";
import definitions from "./definitions";
import getDefinitions from "./definitions";
function resolveAbsoluteRuntime(moduleName: string, dirname: string) {
try {
@@ -41,6 +41,8 @@ export default declare((api, options, dirname) => {
absoluteRuntime = false,
} = options;
const definitions = getDefinitions(runtimeVersion);
if (typeof useRuntimeRegenerator !== "boolean") {
throw new Error(
"The 'regenerator' option must be undefined, or a boolean.",