npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

expo-targets

v0.2.7

Published

Expo config plugin for Apple targets and Android app extensions

Readme

expo-targets

Add iOS widgets, App Clips, iMessage stickers, and other native extensions to your Expo app with a simple, type-safe API.

Part of the expo-targets monorepo. See the main README for complete documentation.

Quick Start

bun add expo-targets
// targets/hello-widget/index.ts
import { defineTarget } from 'expo-targets';

export const HelloWidget = defineTarget({
  name: 'hello-widget',
  appGroup: 'group.com.yourapp',
  type: 'widget',
  platforms: {
    ios: {
      deploymentTarget: '14.0',
      colors: {
        $accent: '#007AFF',
      },
    },
  },
});

export type HelloWidgetData = {
  message: string;
};
// App.tsx
import { HelloWidget } from './targets/hello-widget';

HelloWidget.set('message', 'Hello Widget!');
HelloWidget.refresh();

Package Structure

This package contains four components:

1. TypeScript API (src/)

Runtime API for data sharing and widget control.

import {
  defineTarget,
  refreshAllTargets,
  close,
  openHostApp,
} from 'expo-targets';

Exports:

  • defineTarget(options): Create type-safe target instance
  • TargetStorage: Legacy storage class
  • AppGroupStorage: Low-level storage class
  • refreshAllTargets(): Refresh all widgets/controls
  • close(): Close extension (share/action)
  • openHostApp(path): Open main app from extension
  • clearSharedData(): Clear shared data

2. Config Plugin (plugin/)

Expo config plugin for automatic Xcode project setup.

{
  "expo": {
    "plugins": ["expo-targets"]
  }
}

Features:

  • Scans targets/*/index.ts for defineTarget() calls
  • Parses configuration using Babel AST
  • Creates native Xcode targets
  • Links Swift files from targets/*/ios/
  • Generates color and image assets
  • Syncs entitlements from main app
  • Configures frameworks and build settings

3. Metro Wrapper (metro/)

Metro bundler wrapper for React Native extensions.

import { withTargetsMetro } from 'expo-targets/metro';

Usage:

// metro.config.js
const { getDefaultConfig } = require('expo/metro-config');
const { withTargetsMetro } = require('expo-targets/metro');

module.exports = withTargetsMetro(getDefaultConfig(__dirname));

Required for:

  • Share extensions with React Native
  • Action extensions with React Native
  • App Clips with React Native

4. Native Module (ios/)

Swift module for data storage and widget lifecycle.

Capabilities:

  • App Group storage via UserDefaults
  • Widget refresh (WidgetCenter API)
  • Control Center refresh (iOS 18+)
  • Extension lifecycle management
  • Deep linking to main app

Exports

Main Package

// Core API
import {
  defineTarget,
  TargetStorage,
  AppGroupStorage,
  refreshAllTargets,
  close,
  openHostApp,
  clearSharedData,
} from 'expo-targets';

// Types
import type {
  Target,
  DefineTargetOptions,
  TargetConfig,
  IOSTargetConfig,
  AndroidTargetConfig,
  ExtensionType,
  Color,
} from 'expo-targets';

Metro Subpath

import { withTargetsMetro } from 'expo-targets/metro';

Development

Build

bun run build        # Build all components
bun run build:main   # Build TypeScript API
bun run build:plugin # Build config plugin
bun run build:metro  # Build Metro wrapper

Clean

bun run clean        # Remove all build artifacts

Lint

bun run lint         # Lint source code

Documentation

Examples

Features

  • 🎯 Type-Safe API: Full TypeScript support with IDE autocomplete
  • 📦 Simple Configuration: Single index.ts file per target
  • 🔄 Data Sharing: Built-in App Group storage
  • ⚛️ React Native: Optional RN rendering in compatible extensions
  • 🎨 Asset Generation: Automatic colors and images
  • 🔧 Xcode Integration: Full project manipulation
  • 📱 iOS Production Ready: Widgets, clips, iMessage tested

Platform Support

  • iOS: ✅ Production ready (iOS 14+)
  • Android: 📋 Coming soon (architecture prepared)

Requirements

  • Expo SDK 50+
  • iOS 14+ (for widgets)
  • macOS with Xcode 14+
  • TypeScript recommended

Version

Current version: 0.1.0

See CHANGELOG.md for version history.

License

MIT

Contributing

See Contributing Guide (coming soon)

Support

Credits

Part of expo-targets by [Your Organization]

Inspired by @bacons/apple-targets, expo-widgets, and others.