Skip to content

Commit

Permalink
[0.74] Stub com.facebook.react.settings on 0.74
Browse files Browse the repository at this point in the history
  • Loading branch information
cortinico committed Jul 26, 2024
1 parent 8e5a936 commit 9a56f57
Show file tree
Hide file tree
Showing 473 changed files with 1,711 additions and 78 deletions.
22 changes: 22 additions & 0 deletions packages/core-cli-utils/dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
* @format
* @oncall react_native
*/

import { tasks as _android } from "./private/android.js";
import { tasks as _app } from "./private/app.js";
import { tasks as _apple } from "./private/apple.js";
import { tasks as _clean } from "./private/clean.js";
import * as _version from "./public/version.js";
export declare const android: typeof _android;
export declare const app: typeof _app;
export declare const apple: typeof _apple;
export declare const clean: typeof _clean;
export declare const version: typeof _version;
export type { Task } from "./private/types";
80 changes: 80 additions & 0 deletions packages/core-cli-utils/dist/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true,
});
exports.version =
exports.clean =
exports.apple =
exports.app =
exports.android =
void 0;
var _android2 = require("./private/android.js");
var _app2 = require("./private/app.js");
var _apple2 = require("./private/apple.js");
var _clean2 = require("./private/clean.js");
var _version = _interopRequireWildcard(require("./public/version.js"));
function _getRequireWildcardCache(nodeInterop) {
if (typeof WeakMap !== "function") return null;
var cacheBabelInterop = new WeakMap();
var cacheNodeInterop = new WeakMap();
return (_getRequireWildcardCache = function (nodeInterop) {
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
})(nodeInterop);
}
function _interopRequireWildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
if (obj === null || (typeof obj !== "object" && typeof obj !== "function")) {
return { default: obj };
}
var cache = _getRequireWildcardCache(nodeInterop);
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor =
Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var key in obj) {
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor
? Object.getOwnPropertyDescriptor(obj, key)
: null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
* @format
* @oncall react_native
*/

// @babel/register doesn't like export {foo} from './bar'; statements,
// so we have to jump through hoops here.

const android = _android2.tasks;
exports.android = android;
const app = _app2.tasks;
exports.app = app;
const apple = _apple2.tasks;
exports.apple = apple;
const clean = _clean2.tasks;
exports.clean = clean;
const version = _version;
exports.version = version;
26 changes: 26 additions & 0 deletions packages/core-cli-utils/dist/index.js.flow
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
* @oncall react_native
*/

// @babel/register doesn't like export {foo} from './bar'; statements,
// so we have to jump through hoops here.
import { tasks as _android } from "./private/android.js";
import { tasks as _app } from "./private/app.js";
import { tasks as _apple } from "./private/apple.js";
import { tasks as _clean } from "./private/clean.js";
import * as _version from "./public/version.js";

declare export const android: typeof _android;
declare export const app: typeof _app;
declare export const apple: typeof _apple;
declare export const clean: typeof _clean;
declare export const version: typeof _version;

export type { Task } from "./private/types";
29 changes: 29 additions & 0 deletions packages/core-cli-utils/dist/private/android.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
* @format
* @oncall react_native
*/

import type { Task } from "./types";
import type { ExecaPromise } from "execa";
type AndroidBuildMode = "Debug" | "Release";
type Path = string;
type Args = ReadonlyArray<string>;
type Config = {
cwd: Path;
hermes?: boolean;
mode: AndroidBuildMode;
name: string;
newArchitecture?: boolean;
sdk?: Path;
};
export declare const tasks: (config: Config) => {
assemble: (...gradleArgs: Args) => { run: Task<ExecaPromise> };
build: (...gradleArgs: Args) => { run: Task<ExecaPromise> };
install: (...gradleArgs: Args) => { run: Task<ExecaPromise> };
};
100 changes: 100 additions & 0 deletions packages/core-cli-utils/dist/private/android.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true,
});
exports.tasks = void 0;
var _utils = require("./utils");
var _execa = _interopRequireDefault(require("execa"));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
* @format
* @oncall react_native
*/

function gradle(taskName, args, options) {
const gradlew = _utils.isWindows ? "gradlew.bat" : "./gradlew";
return (0, _execa.default)(gradlew, [taskName, ...args], {
cwd: options.cwd,
env: options.env,
});
}
function androidSdkPath(sdk) {
return sdk ?? process.env.ANDROID_HOME ?? process.env.ANDROID_SDK ?? "";
}
function boolToStr(value) {
return value ? "true" : "false";
}
const FIRST = 1;

//
// Android Tasks
//
const tasks = (config) => ({
assemble: (...gradleArgs) => ({
run: (0, _utils.task)(FIRST, "Assemble Android App", () => {
const args = [];
if (config.hermes != null) {
args.push(`-PhermesEnabled=${boolToStr(config.hermes)}`);
}
if (config.newArchitecture != null) {
args.push(`-PnewArchEnabled=${boolToStr(config.newArchitecture)}`);
}
args.push(...gradleArgs);
return gradle(`${config.name}:assemble${config.mode}`, gradleArgs, {
cwd: config.cwd,
env: {
ANDROID_HOME: androidSdkPath(config.sdk),
},
});
}),
}),
build: (...gradleArgs) => ({
run: (0, _utils.task)(FIRST, "Assembles and tests Android App", () => {
const args = [];
if (config.hermes != null) {
args.push(`-PhermesEnabled=${boolToStr(config.hermes)}`);
}
if (config.newArchitecture != null) {
args.push(`-PnewArchEnabled=${boolToStr(config.newArchitecture)}`);
}
args.push(...gradleArgs);
return gradle(`${config.name}:bundle${config.mode}`, args, {
cwd: config.cwd,
env: {
ANDROID_HOME: androidSdkPath(config.sdk),
},
});
}),
}),
/**
* Useful extra gradle arguments:
*
* -PreactNativeDevServerPort=8081 sets the port for the installed app to point towards a Metro
* server on (for example) 8081.
*/
install: (...gradleArgs) => ({
run: (0, _utils.task)(FIRST, "Installs the assembled Android App", () =>
gradle(`${config.name}:install${config.mode}`, gradleArgs, {
cwd: config.cwd,
env: {
ANDROID_HOME: androidSdkPath(config.sdk),
},
})
),
}),

// We are not supporting launching the app and setting up the tunnel for metro <-> app, this is
// a framework concern. For an example of how one could do this, please look at the community
// CLI's code:
// https://github.com/react-native-community/cli/blob/54d48a4e08a1aef334ae6168788e0157a666b4f5/packages/cli-platform-android/src/commands/runAndroid/index.ts#L272C1-L290C2
});
exports.tasks = tasks;
42 changes: 42 additions & 0 deletions packages/core-cli-utils/dist/private/android.js.flow
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
* @oncall react_native
*/

import type { Task } from "./types";
import type { ExecaPromise } from "execa";

type AndroidBuildMode = "Debug" | "Release";

type Path = string;
type Args = $ReadOnlyArray<string>;

type Config = {
cwd: Path,
hermes?: boolean,
mode: AndroidBuildMode,
name: string,
newArchitecture?: boolean,
sdk?: Path,
};

//
// Android Tasks
//
declare export const tasks: (config: Config) => {
assemble: (...gradleArgs: Args) => {
run: Task<ExecaPromise>,
},
build: (...gradleArgs: Args) => {
run: Task<ExecaPromise>,
},
install: (...gradleArgs: Args) => {
run: Task<ExecaPromise>,
},
};
37 changes: 37 additions & 0 deletions packages/core-cli-utils/dist/private/app.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
* @format
* @oncall react_native
*/

import type { Task } from "./types";
import type { ExecaPromise } from "execa";
type BundlerOptions =
/**
* > 39 | ...Bundler,
* | ^^^^^^^^^^ Unsupported feature: Translating "object types with spreads in the middle or at the end" is currently not supported.
**/
any;
type HermesConfig = { path: string; hermesc: string };
type BundlerWatch = {
readonly mode: "watch";
callback?: (metro: ExecaPromise) => void;
};
type BundlerBuild = { readonly mode: "bundle" };
type Bundler = BundlerWatch | BundlerBuild;
export declare const tasks: {
bundle: (options: BundlerOptions, ...args: ReadonlyArray<string>) => Bundle;
};
type Bundle = {
validate?: Task<void>;
javascript: Task<ExecaPromise>;
sourcemap?: Task<void>;
validateHermesc?: Task<ExecaPromise>;
convert?: Task<ExecaPromise>;
compose?: Task<ExecaPromise>;
};
Loading

0 comments on commit 9a56f57

Please sign in to comment.