metro-react-native-babel-transformer
Advanced tools
Comparing version 0.76.7 to 0.77.0
{ | ||
"name": "metro-react-native-babel-transformer", | ||
"version": "0.76.7", | ||
"version": "0.77.0", | ||
"description": "Babel transformer for React Native applications.", | ||
@@ -23,4 +23,4 @@ "main": "src/index.js", | ||
"babel-preset-fbjs": "^3.4.0", | ||
"hermes-parser": "0.12.0", | ||
"metro-react-native-babel-preset": "0.76.7", | ||
"hermes-parser": "0.14.0", | ||
"metro-react-native-babel-preset": "0.77.0", | ||
"nullthrows": "^1.1.1" | ||
@@ -32,4 +32,4 @@ }, | ||
"engines": { | ||
"node": ">=16" | ||
"node": ">=18" | ||
} | ||
} |
@@ -12,6 +12,15 @@ /** | ||
// Note: This is a fork of the fb-specific transform.js | ||
// This file uses Flow comment syntax so that it may be used from source as a | ||
// transformer without itself requiring transformation, such as in | ||
// facebook/react-native's own tests. | ||
"use strict"; | ||
/*:: | ||
import type {BabelCoreOptions, Plugins, TransformResult} from '@babel/core'; | ||
import type { | ||
BabelTransformer, | ||
MetroBabelFileMetadata, | ||
} from 'metro-babel-transformer'; | ||
*/ | ||
const { parseSync, transformFromAstSync } = require("@babel/core"); | ||
@@ -30,6 +39,6 @@ const inlineRequiresPlugin = require("babel-preset-fbjs/plugins/inline-requires"); | ||
// TS detection conditions copied from metro-react-native-babel-preset | ||
function isTypeScriptSource(fileName) { | ||
function isTypeScriptSource(fileName /*: string */) { | ||
return !!fileName && fileName.endsWith(".ts"); | ||
} | ||
function isTSXSource(fileName) { | ||
function isTSXSource(fileName /*: string */) { | ||
return !!fileName && fileName.endsWith(".tsx"); | ||
@@ -44,3 +53,3 @@ } | ||
const getBabelRC = (function () { | ||
let babelRC = null; | ||
let babelRC /*: ?BabelCoreOptions */ = null; | ||
@@ -120,10 +129,10 @@ /* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's | ||
function buildBabelConfig( | ||
filename, | ||
filename /*: string */, | ||
/* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's | ||
* LTI update could not be added via codemod */ | ||
options, | ||
plugins = [] | ||
) { | ||
plugins /*:: ?: Plugins*/ = [] | ||
) /*: BabelCoreOptions*/ { | ||
const babelRC = getBabelRC(options); | ||
const extraConfig = { | ||
const extraConfig /*: BabelCoreOptions */ = { | ||
babelrc: | ||
@@ -138,3 +147,3 @@ typeof options.enableBabelRCLookup === "boolean" | ||
}; | ||
let config = { | ||
let config /*: BabelCoreOptions */ = { | ||
...babelRC, | ||
@@ -175,3 +184,8 @@ ...extraConfig, | ||
} | ||
const transform = ({ filename, options, src, plugins }) => { | ||
const transform /*: BabelTransformer['transform'] */ = ({ | ||
filename, | ||
options, | ||
src, | ||
plugins, | ||
}) => { | ||
const OLD_BABEL_ENV = process.env.BABEL_ENV; | ||
@@ -207,3 +221,4 @@ process.env.BABEL_ENV = options.dev | ||
}); | ||
const result = transformFromAstSync(sourceAst, src, babelConfig); | ||
const result /*: TransformResult<MetroBabelFileMetadata> */ = | ||
transformFromAstSync(sourceAst, src, babelConfig); | ||
@@ -233,5 +248,6 @@ // The result from `transformFromAstSync` can be null (if the file is ignored) | ||
} | ||
module.exports = { | ||
const babelTransformer /*: BabelTransformer */ = { | ||
transform, | ||
getCacheKey, | ||
}; | ||
module.exports = babelTransformer; |
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
15864
230
9
+ Addedhermes-estree@0.14.0(transitive)
+ Addedhermes-parser@0.14.0(transitive)
+ Addedmetro-react-native-babel-preset@0.77.0(transitive)
- Removedhermes-estree@0.12.0(transitive)
- Removedhermes-parser@0.12.0(transitive)
- Removedmetro-react-native-babel-preset@0.76.7(transitive)
Updatedhermes-parser@0.14.0