Skip to content

Conversation

@Ansonhkg
Copy link
Collaborator

@Ansonhkg Ansonhkg commented Jan 9, 2026

WHAT

  • Add browser and node storage subpath entrypoints to prevent client bundlers from pulling in node-localstorage.
  • Narrow root storagePlugins to browser-only and update node consumers to import from @lit-protocol/auth/storage-node.
  • Update docs and TS path mappings to reflect the new entrypoints.
  • Added SDK Buffer polyfills for browser safety
  • Expanded app-tests with Next.js, TanStack, Vite React, and Svelte demos plus a portal index and standardized ports
  • Updating the pack/install workflow to keep demos in sync with local tarballs.

Examples

// BEFORE                                                                                                                                                                                                                                             
import { createAuthManager, storagePlugins } from "@lit-protocol/auth";                                                                                                                                                                               
                                                                                                                                                                                                                                                      
const authManager = createAuthManager({                                                                                                                                                                                                               
  storage: storagePlugins.localStorageNode({                
    appName: "my-app",                                      
    networkName: "naga-dev",                                
    storagePath: "./lit-auth-storage",                      
  }),                                                       
});                                                         

// AFTER                                                    
import { createAuthManager } from "@lit-protocol/auth";                                                                   
import { storagePlugins } from "@lit-protocol/auth/storage-node";                                                         

const authManager = createAuthManager({                     
  storage: storagePlugins.localStorageNode({                
    appName: "my-app",                                      
    networkName: "naga-dev",                                
    storagePath: "./lit-auth-storage",                      
  }),                                                       
});                               

Tests

pnpm dev:apps

Then, go to localhost:5554

image

Copilot AI review requested due to automatic review settings January 9, 2026 18:09
@Ansonhkg Ansonhkg added 🐞 Bug Fix Something isn't working v8 | Naga labels Jan 9, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR splits storage entrypoints into separate browser and node paths to prevent client bundlers from pulling in the node-localstorage dependency. The root storagePlugins export is narrowed to browser-only (localStorage), while Node.js consumers are updated to import from a dedicated @lit-protocol/auth/storage-node entrypoint.

  • Created separate storage subpath exports: @lit-protocol/auth/storage (browser) and @lit-protocol/auth/storage-node (Node.js)
  • Updated all Node.js consumers (e2e tests, artillery, auth-services) to use the new storage-node import path
  • Updated documentation and examples to reflect the new import patterns

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tsconfig.base.json Adds TypeScript path mappings for the new storage and storage-node entrypoints
packages/auth/storage.ts New entrypoint file that re-exports browser storage from src/storage.ts
packages/auth/storage-node.ts New entrypoint file that re-exports node storage from src/storage-node.ts
packages/auth/src/storage.ts New source file exporting browser-only localStorage and storagePlugins
packages/auth/src/storage-node.ts New source file exporting Node.js localStorageNode and storagePlugins
packages/auth/src/lib/storage/localStorageNode.ts Updated usage documentation comment to reference the new import path
packages/auth/src/index.ts Removed localStorageNode from exports, keeping only browser-compatible localStorage
packages/auth/package.json Added package exports and typesVersions configuration for the new subpath entrypoints
packages/e2e/src/**/*.ts (7 files) Updated imports to use storagePlugins from @lit-protocol/auth/storage-node
packages/auth-services/src/_setup/initSystemContext.ts Updated imports to use storagePlugins from @lit-protocol/auth/storage-node
packages/artillery/src/**/*.ts (2 files) Updated imports to use storagePlugins from @lit-protocol/auth/storage-node
docs/**/*.mdx (3 files) Updated documentation examples to show correct import paths for both browser and node environments

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…' of github.com:LIT-Protocol/js-sdk into fix-auth-split-storage-entrypoints-for-browser-and-node
- contracts: export map now routes custom-network-signatures to Node-only builds and keeps browser defaults.
- e2e: awaits async nagaLocal.withLocalContext.
- networks: naga-local loads custom signatures via Node-only dynamic import to avoid bundling fs in browsers.
- schemas: moved AuthConfig/AuthData + Lit resource schemas into schemas.ts and removed duplicate exports to fix circular/ambiguous exports.
- Updated package.json to include new applications (vite-react, svelte, portal) in dev:apps and test:apps scripts.
- Modified ensure-app-test-deps.mjs to include paths for vite-react and svelte applications.
- Expanded pack-auth-tarball.mjs to pack additional packages: auth-helpers and schemas.
- Added serve-app-tests-index.mjs to serve the app tests index over HTTP.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 Bug Fix Something isn't working v8 | Naga

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants