first commit

This commit is contained in:
2026-03-10 16:18:05 +00:00
commit 11f9c069b5
31635 changed files with 3187747 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
/**
* 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
*/
/**
* Simple way of adding additional parameters to the end of the define calls.
*
* This is used to add extra information to the generaic compiled modules (like
* the dependencyMap object or the list of inverse dependencies).
*/
declare function addParamsToDefineCall(code: string, ...paramsToAdd: Array<any>): string;
export default addParamsToDefineCall;

View File

@@ -0,0 +1 @@
module.exports = require("metro-transform-plugins/private/addParamsToDefineCall");

View File

@@ -0,0 +1,23 @@
/**
* 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 { PluginObj } from "@babel/core";
import type $$IMPORT_TYPEOF_1$$ from "@babel/traverse";
type Traverse = typeof $$IMPORT_TYPEOF_1$$;
import * as Types from "@babel/types";
export interface State {
stripped: boolean;
}
declare function constantFoldingPlugin(context: {
types: typeof Types;
traverse: Traverse;
}): PluginObj<State>;
export default constantFoldingPlugin;

View File

@@ -0,0 +1 @@
module.exports = require("metro-transform-plugins/private/constant-folding-plugin");

View File

@@ -0,0 +1,48 @@
/**
* 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 { PluginObj } from "@babel/core";
import type { Node, Statement, SourceLocation } from "@babel/types";
import * as Types from "@babel/types";
export interface _Options_out {
isESModule: boolean;
}
export interface Options {
readonly importDefault: string;
readonly importAll: string;
readonly resolve: boolean;
readonly out?: _Options_out;
}
export interface State {
exportAll: Array<{
file: string;
loc?: null | SourceLocation;
}>;
exportDefault: Array<{
local: string;
loc?: null | SourceLocation;
}>;
exportNamed: Array<{
local: string;
remote: string;
loc?: null | SourceLocation;
}>;
imports: Array<{
node: Statement;
}>;
importDefault: Node;
importAll: Node;
opts: Options;
}
declare function importExportPlugin($$PARAM_0$$: {
types: typeof Types;
}): PluginObj<State>;
export default importExportPlugin;

View File

@@ -0,0 +1 @@
module.exports = require("metro-transform-plugins/private/import-export-plugin");

View File

@@ -0,0 +1,16 @@
// See: https://github.com/facebook/metro/blob/v0.83.2/packages/metro-transform-plugins/src/index.js
// NOTE(cedric): this is quite a complicated CJS export, this can't be automatically typed
export type { Options as ImportExportPluginOptions } from './import-export-plugin';
export type { Options as InlinePluginOptions } from './inline-plugin';
export type { PluginOptions as InlineRequiresPluginOptions } from './inline-requires-plugin';
export { default as addParamsToDefineCall } from './addParamsToDefineCall';
export { default as constantFoldingPlugin } from './constant-folding-plugin';
export { default as importExportPlugin } from './import-export-plugin';
export { default as inlinePlugin } from './inline-plugin';
export { default as inlineRequiresPlugin } from './inline-requires-plugin';
export { default as normalizePseudoGlobals } from './normalizePseudoGlobals';
export function getTransformPluginCacheKeyFiles(): string[];

View File

@@ -0,0 +1 @@
module.exports = require("metro-transform-plugins");

View File

@@ -0,0 +1,27 @@
/**
* 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 { PluginObj } from "@babel/core";
import * as Types from "@babel/types";
export interface Options {
readonly dev: boolean;
readonly inlinePlatform: boolean;
readonly isWrapped: boolean;
readonly requireName?: string;
readonly platform: string;
}
export interface State {
opts: Options;
}
declare function inlinePlugin($$PARAM_0$$: {
types: typeof Types;
}, options: Options): PluginObj<State>;
export default inlinePlugin;

View File

@@ -0,0 +1 @@
module.exports = require("metro-transform-plugins/private/inline-plugin");

View File

@@ -0,0 +1,53 @@
/**
* 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
*
*/
import type { PluginObj } from "@babel/core";
import * as Babel from "@babel/core";
export interface PluginOptions {
readonly ignoredRequires?: ReadonlyArray<string>;
readonly inlineableCalls?: ReadonlyArray<string>;
readonly nonMemoizedModules?: ReadonlyArray<string>;
readonly memoizeCalls?: boolean;
}
export interface State {
opts?: PluginOptions;
ignoredRequires: Set<string>;
inlineableCalls: Set<string>;
membersAssigned: Map<string, Set<string>>;
}
/**
* This transform inlines top-level require(...) aliases with to enable lazy
* loading of dependencies. It is able to inline both single references and
* child property references.
*
* For instance:
* var Foo = require('foo');
* f(Foo);
*
* Will be transformed into:
* f(require('foo'));
*
* When the assigment expression has a property access, it will be inlined too,
* keeping the property. For instance:
* var Bar = require('foo').bar;
* g(Bar);
*
* Will be transformed into:
* g(require('foo').bar);
*
* Destructuring also works the same way. For instance:
* const {Baz} = require('foo');
* h(Baz);
*
* Is also successfully inlined into:
* g(require('foo').Baz);
*/
declare const $$EXPORT_DEFAULT_DECLARATION$$: ($$PARAM_0$$: typeof Babel) => PluginObj<State>;
export default $$EXPORT_DEFAULT_DECLARATION$$;

View File

@@ -0,0 +1 @@
module.exports = require("metro-transform-plugins/private/inline-requires-plugin");

View File

@@ -0,0 +1,17 @@
/**
* 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 { Node } from "@babel/types";
export interface Options {
reservedNames: ReadonlyArray<string>;
}
declare function normalizePseudoglobals(ast: Node, options?: Options): ReadonlyArray<string>;
export default normalizePseudoglobals;

View File

@@ -0,0 +1 @@
module.exports = require("metro-transform-plugins/private/normalizePseudoGlobals");

View File

@@ -0,0 +1,20 @@
/**
* 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 { Scope } from "@babel/traverse";
import type { CallExpression, MemberExpression } from "@babel/types";
import * as Types from "@babel/types";
export interface PlatformChecks {
isPlatformNode: (node: MemberExpression, scope: Scope, isWrappedModule: boolean) => boolean;
isPlatformSelectNode: (node: CallExpression, scope: Scope, isWrappedModule: boolean) => boolean;
}
declare function createInlinePlatformChecks(t: typeof Types, requireName?: string): PlatformChecks;
export default createInlinePlatformChecks;

View File

@@ -0,0 +1 @@
module.exports = require("metro-transform-plugins/private/utils/createInlinePlatformChecks");