metro-transform-plugins
Advanced tools
| /** | ||
| * 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<unknown> | ||
| ): string; | ||
| export default addParamsToDefineCall; |
| /** | ||
| * 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'; | ||
| import type * as $$IMPORT_TYPEOF_2$$ from '@babel/types'; | ||
| type Traverse = typeof $$IMPORT_TYPEOF_1$$; | ||
| type Types = typeof $$IMPORT_TYPEOF_2$$; | ||
| type State = {stripped: boolean}; | ||
| declare function constantFoldingPlugin(context: { | ||
| types: Types; | ||
| traverse: Traverse; | ||
| }): PluginObj<State>; | ||
| export default constantFoldingPlugin; |
| /** | ||
| * 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 * as $$IMPORT_TYPEOF_1$$ from '@babel/types'; | ||
| import type {Node, SourceLocation, Statement} from '@babel/types'; | ||
| type Types = typeof $$IMPORT_TYPEOF_1$$; | ||
| export type Options = Readonly<{ | ||
| importDefault: string; | ||
| importAll: string; | ||
| resolve: boolean; | ||
| out?: {isESModule: boolean}; | ||
| }>; | ||
| type State = { | ||
| exportAll: Array<{file: string; loc: null | undefined | SourceLocation}>; | ||
| exportDefault: Array<{ | ||
| local: string; | ||
| loc: null | undefined | SourceLocation; | ||
| }>; | ||
| exportNamed: Array<{ | ||
| local: string; | ||
| remote: string; | ||
| loc: null | undefined | SourceLocation; | ||
| }>; | ||
| imports: Array<{node: Statement}>; | ||
| importDefault: Node; | ||
| importAll: Node; | ||
| opts: Options; | ||
| }; | ||
| declare function importExportPlugin($$PARAM_0$$: { | ||
| types: Types; | ||
| }): PluginObj<State>; | ||
| export default importExportPlugin; |
| /** | ||
| * 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 * as $$IMPORT_TYPEOF_1$$ from '@babel/types'; | ||
| type Types = typeof $$IMPORT_TYPEOF_1$$; | ||
| export type Options = Readonly<{ | ||
| dev: boolean; | ||
| inlinePlatform: boolean; | ||
| isWrapped: boolean; | ||
| requireName?: string; | ||
| platform: string; | ||
| }>; | ||
| type State = {opts: Options}; | ||
| declare function inlinePlugin( | ||
| $$PARAM_0$$: {types: Types}, | ||
| options: Options, | ||
| ): PluginObj<State>; | ||
| export default inlinePlugin; |
| /** | ||
| * 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 * as $$IMPORT_TYPEOF_1$$ from '@babel/core'; | ||
| import type {PluginObj} from '@babel/core'; | ||
| type Babel = typeof $$IMPORT_TYPEOF_1$$; | ||
| export type PluginOptions = Readonly<{ | ||
| ignoredRequires?: ReadonlyArray<string>; | ||
| inlineableCalls?: ReadonlyArray<string>; | ||
| nonMemoizedModules?: ReadonlyArray<string>; | ||
| memoizeCalls?: boolean; | ||
| }>; | ||
| export type 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$$: Babel, | ||
| ) => PluginObj<State>; | ||
| declare type $$EXPORT_DEFAULT_DECLARATION$$ = | ||
| typeof $$EXPORT_DEFAULT_DECLARATION$$; | ||
| export default $$EXPORT_DEFAULT_DECLARATION$$; |
| /** | ||
| * 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 as BabelNode} from '@babel/types'; | ||
| export type Options = {reservedNames: ReadonlyArray<string>}; | ||
| declare function normalizePseudoglobals( | ||
| ast: BabelNode, | ||
| options?: Options, | ||
| ): ReadonlyArray<string>; | ||
| export default normalizePseudoglobals; |
| /** | ||
| * 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 * as $$IMPORT_TYPEOF_1$$ from '@babel/types'; | ||
| import type {CallExpression, MemberExpression} from '@babel/types'; | ||
| type Types = typeof $$IMPORT_TYPEOF_1$$; | ||
| type PlatformChecks = { | ||
| isPlatformNode: ( | ||
| node: MemberExpression, | ||
| scope: Scope, | ||
| isWrappedModule: boolean, | ||
| ) => boolean; | ||
| isPlatformSelectNode: ( | ||
| node: CallExpression, | ||
| scope: Scope, | ||
| isWrappedModule: boolean, | ||
| ) => boolean; | ||
| }; | ||
| declare function createInlinePlatformChecks( | ||
| t: Types, | ||
| requireName?: string, | ||
| ): PlatformChecks; | ||
| export default createInlinePlatformChecks; |
+4
-3
| { | ||
| "name": "metro-transform-plugins", | ||
| "version": "0.83.4", | ||
| "version": "0.83.5", | ||
| "description": "🚇 Transform plugins for Metro.", | ||
@@ -13,3 +13,4 @@ "main": "src/index.js", | ||
| "type": "git", | ||
| "url": "git@github.com:facebook/metro.git" | ||
| "url": "git+https://github.com/facebook/metro.git", | ||
| "directory": "packages/metro-transform-plugins" | ||
| }, | ||
@@ -36,3 +37,3 @@ "scripts": { | ||
| "babel-plugin-tester": "^6.0.1", | ||
| "metro": "0.83.4" | ||
| "metro": "0.83.5" | ||
| }, | ||
@@ -39,0 +40,0 @@ "engines": { |
@@ -10,7 +10,3 @@ "use strict"; | ||
| function _interopRequireDefault(e) { | ||
| return e && e.__esModule | ||
| ? e | ||
| : { | ||
| default: e, | ||
| }; | ||
| return e && e.__esModule ? e : { default: e }; | ||
| } | ||
@@ -17,0 +13,0 @@ const importTemplate = _template.default.statement(` |
@@ -11,7 +11,3 @@ "use strict"; | ||
| function _interopRequireDefault(e) { | ||
| return e && e.__esModule | ||
| ? e | ||
| : { | ||
| default: e, | ||
| }; | ||
| return e && e.__esModule ? e : { default: e }; | ||
| } | ||
@@ -18,0 +14,0 @@ const env = { |
@@ -10,7 +10,3 @@ "use strict"; | ||
| function _interopRequireDefault(e) { | ||
| return e && e.__esModule | ||
| ? e | ||
| : { | ||
| default: e, | ||
| }; | ||
| return e && e.__esModule ? e : { default: e }; | ||
| } | ||
@@ -17,0 +13,0 @@ function normalizePseudoglobals(ast, options) { |
105629
6.05%25
38.89%1564
14.16%