metro-react-native-babel-preset
Advanced tools
Comparing version 0.59.0 to 0.60.0
{ | ||
"name": "metro-react-native-babel-preset", | ||
"version": "0.59.0", | ||
"version": "0.60.0", | ||
"description": "Babel preset for React Native applications", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -24,3 +24,3 @@ # metro-react-native-babel-preset | ||
```sh | ||
yarn add -d metro-react-native-babel-preset | ||
yarn add -D metro-react-native-babel-preset | ||
``` | ||
@@ -27,0 +27,0 @@ |
@@ -11,16 +11,33 @@ /** | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
if (enumerableOnly) | ||
symbols = symbols.filter(function(sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
}); | ||
keys.push.apply(keys, symbols); | ||
} | ||
return keys; | ||
} | ||
function _objectSpread(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
var ownKeys = Object.keys(source); | ||
if (typeof Object.getOwnPropertySymbols === "function") { | ||
ownKeys = ownKeys.concat( | ||
Object.getOwnPropertySymbols(source).filter(function(sym) { | ||
return Object.getOwnPropertyDescriptor(source, sym).enumerable; | ||
}) | ||
); | ||
if (i % 2) { | ||
ownKeys(Object(source), true).forEach(function(key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} else if (Object.getOwnPropertyDescriptors) { | ||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); | ||
} else { | ||
ownKeys(Object(source)).forEach(function(key) { | ||
Object.defineProperty( | ||
target, | ||
key, | ||
Object.getOwnPropertyDescriptor(source, key) | ||
); | ||
}); | ||
} | ||
ownKeys.forEach(function(key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} | ||
@@ -46,3 +63,6 @@ return target; | ||
return ( | ||
_arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread() | ||
_arrayWithoutHoles(arr) || | ||
_iterableToArray(arr) || | ||
_unsupportedIterableToArray(arr) || | ||
_nonIterableSpread() | ||
); | ||
@@ -52,10 +72,19 @@ } | ||
function _nonIterableSpread() { | ||
throw new TypeError("Invalid attempt to spread non-iterable instance"); | ||
throw new TypeError( | ||
"Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." | ||
); | ||
} | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) | ||
return _arrayLikeToArray(o, minLen); | ||
} | ||
function _iterableToArray(iter) { | ||
if ( | ||
Symbol.iterator in Object(iter) || | ||
Object.prototype.toString.call(iter) === "[object Arguments]" | ||
) | ||
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) | ||
return Array.from(iter); | ||
@@ -65,9 +94,11 @@ } | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) { | ||
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) | ||
arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
if (Array.isArray(arr)) return _arrayLikeToArray(arr); | ||
} | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
const lazyImports = require("./lazy-imports"); | ||
@@ -123,3 +154,3 @@ | ||
loose: true | ||
} | ||
} // dont 'a'.concat('b'), just use 'a'+'b' | ||
]; | ||
@@ -130,3 +161,8 @@ const exponentiationOperator = [ | ||
const objectAssign = [require("@babel/plugin-transform-object-assign")]; | ||
const objectRestSpread = [require("@babel/plugin-proposal-object-rest-spread")]; | ||
const objectRestSpread = [ | ||
require("@babel/plugin-proposal-object-rest-spread"), // Assume no dependence on getters or evaluation order. See https://github.com/babel/babel/pull/11520 | ||
{ | ||
loose: true | ||
} | ||
]; | ||
const nullishCoalescingOperator = [ | ||
@@ -166,3 +202,3 @@ require("@babel/plugin-proposal-nullish-coalescing-operator"), | ||
if (!options.useTransformReactJsxExperimental) { | ||
if (!options.useTransformReactJSXExperimental) { | ||
extraPlugins.push([require("@babel/plugin-transform-react-jsx")]); | ||
@@ -227,2 +263,3 @@ } | ||
if ( | ||
transformProfile !== "hermes-stable" && | ||
transformProfile !== "hermes-canary" && | ||
@@ -238,3 +275,3 @@ (isNull || src.indexOf("?.") !== -1) | ||
if (options && options.dev && !options.useTransformReactJsxExperimental) { | ||
if (options && options.dev && !options.useTransformReactJSXExperimental) { | ||
extraPlugins.push(reactJsxSource); | ||
@@ -248,10 +285,2 @@ extraPlugins.push(reactJsxSelf); | ||
let flowPlugins = {}; | ||
if (!options || !options.disableFlowStripTypesTransform) { | ||
flowPlugins = { | ||
plugins: [require("@babel/plugin-transform-flow-strip-types")] | ||
}; | ||
} | ||
return { | ||
@@ -263,4 +292,6 @@ comments: false, | ||
// there'll be a test case that fails if you don't. | ||
flowPlugins, | ||
{ | ||
plugins: [require("@babel/plugin-transform-flow-strip-types")] | ||
}, | ||
{ | ||
plugins: defaultPlugins | ||
@@ -306,5 +337,9 @@ }, | ||
null, | ||
_objectSpread({}, options, { | ||
dev: true | ||
}) | ||
_objectSpread( | ||
_objectSpread({}, options), | ||
{}, | ||
{ | ||
dev: true | ||
} | ||
) | ||
); | ||
@@ -311,0 +346,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17181
449