Registry / devops / flipper-common

flipper-common

JSON →
library0.273.0jsnpmunverified

flipper-common is a core utility package within the Facebook Flipper debugging platform, designed to provide shared functionalities and interfaces for `flipper-ui`, `flipper-server`, and Flipper plugins. It encapsulates common logic and types used across different components of the Flipper ecosystem, ensuring consistency and reducing code duplication. The package is currently at version 0.273.0 and maintains a rapid release cadence, often seeing multiple updates per month to align with the active development of the broader Flipper project. Its key differentiators lie in its deep integration within the Flipper architecture, serving as a foundational layer for building robust mobile (iOS/Android) and web/Node.js debugging plugins and server-side interactions, rather than being a general-purpose, standalone utility library.

npm install flipper-common
INSTALL
IMPORT
SIG · FLIPPER-COMMON
F
flipper-common
devopsjavascriptv0.273.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Logger
✓ import { Logger } from 'flipper-common';
✗ const Logger = require('flipper-common');
Flipper common utilities are primarily consumed as ES Modules. CommonJS `require` is not officially supported and may lead to issues.
Id
✓ import { Id } from 'flipper-common';
✗ import Id from 'flipper-common'; // Id is a named export, not default
Many utilities, including ID generation, are named exports. Avoid default import syntax unless explicitly documented.
FlipperClient
✓ import type { FlipperClient } from 'flipper-common';
✗ import { FlipperClient } from 'flipper-common'; // FlipperClient is a type, not a runtime value
For TypeScript users, interfaces and types like `FlipperClient` should be imported using `import type` to ensure they are stripped from the JavaScript output.

This quickstart demonstrates how to initialize and use core utilities like `Logger` and `Id` within a simulated Flipper plugin context, leveraging TypeScript types such as `FlipperClient` for illustrative purposes.

import { Logger, Id, FlipperClient } from 'flipper-common'; interface MyPluginClient extends FlipperClient { sendEvent: (event: string, payload: any) => void; } class MyFlipperPlugin { id: Id; logger: Logger; client: MyPluginClient; constructor(client: MyPluginClient) { this.id = new Id(); this.logger = new Logger('MyFlipperPlugin'); this.client = client; this.logger.info(`Plugin initialized with ID: ${this.id.newID()}`); } initiateConnection() { this.client.sendEvent('plugin-connected', { pluginName: 'MyFlipperPlugin', version: '1.0.0' }); this.logger.debug('Sent connection event to Flipper desktop.'); } // Example of using another utility or type processData(data: any) { const transactionId = this.id.newID(); this.logger.verbose(`Processing data with transaction ID: ${transactionId}`); // Imagine further processing or sending data back via client this.client.sendEvent('data-processed', { id: transactionId, result: data }); } } // Simulate a Flipper client for demonstration const mockFlipperClient: MyPluginClient = { sendEvent: (event, payload) => { console.log(`[Mock Flipper Client] Event: ${event}, Payload: ${JSON.stringify(payload)}`); }, // In a real FlipperClient, there would be more methods like 'onMessage', 'call', etc. // These are omitted for a minimal runnable example. }; const plugin = new MyFlipperPlugin(mockFlipperClient); plugin.initiateConnection(); plugin.processData({ value: 123, status: 'complete' });
Debug
Known issues
breakingAs `flipper-common` is versioned `0.x.x` and part of a rapidly evolving internal Facebook project, breaking changes can be introduced in minor version increments. Always consult the detailed Flipper `CHANGELOG.md` (linked in npm metadata) when upgrading to a new minor version.
fix
Review the Flipper main repository's `desktop/static/CHANGELOG.md` for specific breaking changes and migration steps before upgrading. Ensure your `flipper-common` version aligns with other `flipper-*` packages you are using.
affects: >=0.x.x
gotchaThis `flipper-common` package is part of the Facebook Flipper debugging platform for mobile and web applications, not related to the Flipper Zero hardware device. Attempting to use these utilities for Flipper Zero development will result in incompatibility.
fix
For Flipper Zero development, refer to the Flipper Zero JavaScript SDK (e.g., `@flipperdevices/fz-sdk`) and documentation specific to that hardware platform.
affects: All
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'Logger')
Attempting to `require()` named exports from 'flipper-common' in a CommonJS environment, which primarily ships as ES Modules.
fix
Ensure your project is configured for ES Modules (e.g., `"type": "module"` in `package.json` or using `.mjs` files) and use `import { Logger } from 'flipper-common';` syntax. If truly stuck in CommonJS, you might need dynamic `import()` or a bundler to transpile.
Error: Package subpath './lib/Logger' is not defined by 'exports' in .../node_modules/flipper-common/package.json
Directly importing internal subpaths of the `flipper-common` package that are not exposed via its `exports` field in `package.json`.
fix
Always import symbols directly from the main package entry point: `import { Logger } from 'flipper-common';`. Do not attempt to import from `flipper-common/lib/Logger` or similar internal paths.
TS2305: Module ''flipper-common'' has no exported member 'SomeNonExistentType'.
Trying to import a type or function that does not exist or is not publicly exported by `flipper-common`.
fix
Consult the official Flipper documentation or the package's type definitions (`.d.ts` files) to verify the correct names and availability of exported members. Flipper's internal nature means not all internal types or functions are exposed publicly.
Upgrade
Version history
0.273.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
flipper-common — npm install flipper-common · libregistry