metro-react-native-babel-preset
Advanced tools
Comparing version 0.64.0 to 0.65.0
{ | ||
"name": "metro-react-native-babel-preset", | ||
"version": "0.64.0", | ||
"version": "0.65.0", | ||
"description": "Babel preset for React Native applications", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -18,3 +18,2 @@ /** | ||
"Button", | ||
"CheckBox", | ||
"DatePickerIOS", | ||
@@ -31,2 +30,3 @@ "DrawerLayoutAndroid", | ||
"PickerIOS", | ||
"Pressable", | ||
"ProgressBarAndroid", | ||
@@ -42,3 +42,2 @@ "ProgressViewIOS", | ||
"StatusBar", | ||
"SwipeableFlatList", | ||
"Text", | ||
@@ -52,6 +51,8 @@ "TextInput", | ||
"View", | ||
"VirtualizedList", // APIs | ||
"VirtualizedList", | ||
"VirtualizedSectionList", // APIs | ||
"ActionSheetIOS", | ||
"Alert", | ||
"Animated", | ||
"Appearance", | ||
"AppRegistry", | ||
@@ -61,3 +62,2 @@ "AppState", | ||
"BackHandler", | ||
"CameraRoll", | ||
"Clipboard", | ||
@@ -90,4 +90,3 @@ "DatePickerAndroid", | ||
"UTFSequence", | ||
"Vibration", | ||
"YellowBox", // Plugins | ||
"Vibration", // Plugins | ||
"RCTDeviceEventEmitter", | ||
@@ -94,0 +93,0 @@ "RCTNativeAppEventEmitter", |
@@ -11,98 +11,2 @@ /** | ||
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] : {}; | ||
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) | ||
); | ||
}); | ||
} | ||
} | ||
return target; | ||
} | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function _toConsumableArray(arr) { | ||
return ( | ||
_arrayWithoutHoles(arr) || | ||
_iterableToArray(arr) || | ||
_unsupportedIterableToArray(arr) || | ||
_nonIterableSpread() | ||
); | ||
} | ||
function _nonIterableSpread() { | ||
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 (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) | ||
return Array.from(iter); | ||
} | ||
function _arrayWithoutHoles(arr) { | ||
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"); | ||
@@ -131,4 +35,4 @@ | ||
[require("@babel/plugin-syntax-dynamic-import")], | ||
[require("@babel/plugin-syntax-export-default-from")] | ||
].concat(_toConsumableArray(passthroughSyntaxPlugins), [ | ||
[require("@babel/plugin-syntax-export-default-from")], | ||
...passthroughSyntaxPlugins, | ||
[require("@babel/plugin-transform-destructuring")], | ||
@@ -141,60 +45,3 @@ [require("@babel/plugin-transform-function-name")], | ||
[require("@babel/plugin-transform-unicode-regex")] | ||
]); | ||
const es2015ArrowFunctions = [ | ||
require("@babel/plugin-transform-arrow-functions") | ||
]; | ||
const es2015Classes = [require("@babel/plugin-transform-classes")]; | ||
const es2015ForOf = [ | ||
require("@babel/plugin-transform-for-of"), | ||
{ | ||
loose: true | ||
} | ||
]; | ||
const es2015ComputedProperty = [ | ||
require("@babel/plugin-transform-computed-properties") | ||
]; | ||
const es2015Spread = [require("@babel/plugin-transform-spread")]; | ||
const es2015TemplateLiterals = [ | ||
require("@babel/plugin-transform-template-literals"), | ||
{ | ||
loose: true | ||
} // dont 'a'.concat('b'), just use 'a'+'b' | ||
]; | ||
const exponentiationOperator = [ | ||
require("@babel/plugin-transform-exponentiation-operator") | ||
]; | ||
const shorthandProperties = [ | ||
require("@babel/plugin-transform-shorthand-properties") | ||
]; | ||
const objectAssign = [require("@babel/plugin-transform-object-assign")]; | ||
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 = [ | ||
require("@babel/plugin-proposal-nullish-coalescing-operator"), | ||
{ | ||
loose: true | ||
} | ||
]; | ||
const optionalChaining = [ | ||
require("@babel/plugin-proposal-optional-chaining"), | ||
{ | ||
loose: true | ||
} | ||
]; | ||
const reactDisplayName = [ | ||
require("@babel/plugin-transform-react-display-name") | ||
]; | ||
const reactJsxSource = [require("@babel/plugin-transform-react-jsx-source")]; | ||
const reactJsxSelf = [require("@babel/plugin-transform-react-jsx-self")]; | ||
const babelRuntime = [ | ||
require("@babel/plugin-transform-runtime"), | ||
{ | ||
helpers: true, | ||
regenerator: true | ||
} | ||
]; | ||
@@ -237,31 +84,50 @@ const getPreset = (src, options) => { | ||
if (hasClass) { | ||
extraPlugins.push(es2015Classes); | ||
extraPlugins.push([require("@babel/plugin-transform-classes")]); | ||
} // TODO(gaearon): put this back into '=>' indexOf bailout | ||
// and patch react-refresh to not depend on this transform. | ||
extraPlugins.push(es2015ArrowFunctions); | ||
extraPlugins.push([require("@babel/plugin-transform-arrow-functions")]); | ||
if (!isHermesCanary) { | ||
extraPlugins.push(es2015ComputedProperty); | ||
if (!isHermes) { | ||
extraPlugins.push([require("@babel/plugin-transform-computed-properties")]); | ||
} | ||
if (!isHermesCanary && (isNull || hasClass || src.indexOf("...") !== -1)) { | ||
extraPlugins.push(es2015Spread); | ||
extraPlugins.push(objectRestSpread); | ||
if (!isHermes && (isNull || hasClass || src.indexOf("...") !== -1)) { | ||
extraPlugins.push( | ||
[require("@babel/plugin-transform-spread")], | ||
[ | ||
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 | ||
} | ||
] | ||
); | ||
} | ||
if (!isHermes && (isNull || src.indexOf("`") !== -1)) { | ||
extraPlugins.push(es2015TemplateLiterals); | ||
extraPlugins.push([ | ||
require("@babel/plugin-transform-template-literals"), | ||
{ | ||
loose: true | ||
} // dont 'a'.concat('b'), just use 'a'+'b' | ||
]); | ||
} | ||
if (isNull || src.indexOf("**") !== -1) { | ||
extraPlugins.push(exponentiationOperator); | ||
if (!isHermes && (isNull || src.indexOf("**") !== -1)) { | ||
extraPlugins.push([ | ||
require("@babel/plugin-transform-exponentiation-operator") | ||
]); | ||
} | ||
if (isNull || src.indexOf("Object.assign") !== -1) { | ||
extraPlugins.push(objectAssign); | ||
if (!isHermes && (isNull || src.indexOf("Object.assign")) !== -1) { | ||
extraPlugins.push([require("@babel/plugin-transform-object-assign")]); | ||
} | ||
if (hasForOf) { | ||
extraPlugins.push(es2015ForOf); | ||
extraPlugins.push([ | ||
require("@babel/plugin-transform-for-of"), | ||
{ | ||
loose: true | ||
} | ||
]); | ||
} | ||
@@ -274,24 +140,42 @@ | ||
) { | ||
extraPlugins.push(reactDisplayName); | ||
extraPlugins.push([require("@babel/plugin-transform-react-display-name")]); | ||
} | ||
if (!isHermes && (isNull || src.indexOf("?.") !== -1)) { | ||
extraPlugins.push(optionalChaining); | ||
extraPlugins.push([ | ||
require("@babel/plugin-proposal-optional-chaining"), | ||
{ | ||
loose: true | ||
} | ||
]); | ||
} | ||
if (isNull || src.indexOf("??") !== -1) { | ||
extraPlugins.push(nullishCoalescingOperator); | ||
extraPlugins.push([ | ||
require("@babel/plugin-proposal-nullish-coalescing-operator"), | ||
{ | ||
loose: true | ||
} | ||
]); | ||
} | ||
if (!isHermes) { | ||
extraPlugins.push(shorthandProperties); | ||
extraPlugins.push([ | ||
require("@babel/plugin-transform-shorthand-properties") | ||
]); | ||
} | ||
if (options && options.dev && !options.useTransformReactJSXExperimental) { | ||
extraPlugins.push(reactJsxSource); | ||
extraPlugins.push(reactJsxSelf); | ||
extraPlugins.push([require("@babel/plugin-transform-react-jsx-source")]); | ||
extraPlugins.push([require("@babel/plugin-transform-react-jsx-self")]); | ||
} | ||
if (!options || options.enableBabelRuntime !== false) { | ||
extraPlugins.push(babelRuntime); | ||
extraPlugins.push([ | ||
require("@babel/plugin-transform-runtime"), | ||
{ | ||
helpers: true, | ||
regenerator: true | ||
} | ||
]); | ||
} | ||
@@ -347,12 +231,3 @@ | ||
if (!env || env === "development") { | ||
return getPreset( | ||
null, | ||
_objectSpread( | ||
_objectSpread({}, options), | ||
{}, | ||
{ | ||
dev: true | ||
} | ||
) | ||
); | ||
return getPreset(null, { ...options, dev: true }); | ||
} | ||
@@ -359,0 +234,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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
14323
348