Sign In

@insforge/shared

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@insforge/shared

Shared utilities and React contexts for Insforge packages

latest
npmnpm
Version
1.1.5
Version published
Weekly downloads
492
-25.23%
Maintainers
1
Weekly downloads
 
Created
Source

@insforge/shared

Shared utilities, types, and React contexts for Insforge packages.

Purpose

This package centralizes React Context definitions to prevent duplication issues when using tsup with multiple entry points. By defining contexts here, all Insforge packages (@insforge/react, @insforge/nextjs, etc.) import from the same source, ensuring a single Context instance.

Architecture Pattern

Inspired by @clerk/shared, this package solves the Context duplication problem:

The Problem

When using bundle: true with multiple entry points:

// tsup.config.ts
entry: {
  index: 'src/index.ts',
  hooks: 'src/hooks/index.ts',
  components: 'src/components/index.ts'
}

Each entry point bundles its own copy of Context → Provider uses Context instance A, but components use Context instance B → useContext returns undefined.

The Solution

  • Centralized Context: Define all Contexts in @insforge/shared
  • External React: Mark react as external in tsup config
  • Shared Import: All packages import Context from @insforge/shared
// packages/shared/tsup.config.ts
export default defineConfig({
  external: ['react', 'react-dom'], // Critical!
  bundle: true,
});

Exports

Main Entry (@insforge/shared)

import type { InsforgeUser, InsforgeContextValue, OAuthProvider } from '@insforge/shared';

React Entry (@insforge/shared/react)

import { InsforgeContext } from '@insforge/shared/react';

Usage

This package is intended for internal use within the Insforge monorepo. Application developers should not need to import from it directly.

License

MIT

Keywords

insforge

FAQs

Package last updated on 23 Jan 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts