mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix build-types script, align internal babel-register (#49133)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/49133 Follow up to D68960540. Changelog: [Internal] Reviewed By: robhogan Differential Revision: D69053411 fbshipit-source-id: ffc8aba923aab8f4cd0d74fb61c49893ff09b6c1
This commit is contained in:
committed by
Facebook GitHub Bot
parent
1a67214a3a
commit
4348a57503
@@ -16,7 +16,6 @@ const {
|
||||
} = require('./consts');
|
||||
|
||||
let isRegisteredForMonorepo = false;
|
||||
let isRegisteredForScriptsDir = false;
|
||||
|
||||
/**
|
||||
* Calling this function enables all Node.js packages to run from source when
|
||||
@@ -44,6 +43,7 @@ function registerForMonorepo() {
|
||||
} else {
|
||||
require('metro-babel-register')([
|
||||
PACKAGES_DIR,
|
||||
SCRIPTS_DIR,
|
||||
RN_INTEGRATION_TESTS_RUNNER_DIR,
|
||||
]);
|
||||
}
|
||||
@@ -60,13 +60,7 @@ function registerForMonorepo() {
|
||||
* ```
|
||||
*/
|
||||
function registerForScript() {
|
||||
if (isRegisteredForScriptsDir) {
|
||||
return;
|
||||
}
|
||||
|
||||
require('metro-babel-register')([SCRIPTS_DIR]);
|
||||
|
||||
isRegisteredForScriptsDir = true;
|
||||
registerForMonorepo();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
@@ -104,11 +104,11 @@ async function main() {
|
||||
);
|
||||
}
|
||||
|
||||
function getPackageName(file: string): string {
|
||||
function getPackageName(file /*: string */) /*: string */ {
|
||||
return path.relative(PACKAGES_DIR, file).split(path.sep)[0];
|
||||
}
|
||||
|
||||
function getBuildPath(file: string): string {
|
||||
function getBuildPath(file /*: string */) /*: string */ {
|
||||
const packageDir = path.join(PACKAGES_DIR, getPackageName(file));
|
||||
|
||||
return path.join(
|
||||
@@ -120,9 +120,9 @@ function getBuildPath(file: string): string {
|
||||
);
|
||||
}
|
||||
|
||||
function ignoreShadowedFiles(files: Array<string>): Array<string> {
|
||||
const shadowedPrefixes: Record<string, boolean> = {};
|
||||
const result: Array<string> = [];
|
||||
function ignoreShadowedFiles(files /*: Array<string> */) /*: Array<string> */ {
|
||||
const shadowedPrefixes /*: Record<string, boolean> */ = {};
|
||||
const result /*: Array<string> */ = [];
|
||||
|
||||
// Find all flow definition files that shadow other files
|
||||
for (const file of files) {
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
* @oncall react_native
|
||||
*/
|
||||
|
||||
require('../babel-register').registerForScript();
|
||||
|
||||
import type {BabelCoreOptions} from '@babel/core';
|
||||
|
||||
const {ModuleResolutionKind} = require('typescript');
|
||||
|
||||
Reference in New Issue
Block a user