Skip to content

feat(realtime): load transport SDKs through a configurable importModule - #13

Merged
3m1n3nc3 merged 3 commits into
mainfrom
feat/realtime-import-module
Oct 11, 2026
Merged

3m1n3nc3 merged 3 commits into
mainfrom
feat/realtime-import-module

Conversation

@3m1n3nc3

Copy link
Copy Markdown
Member

Summary

@arkstack/realtime loaded pusher-js and the firebase/* modules with a bare dynamic import(). A bundler resolves that, but a page without one can't, such as a plain <script> embed. In that case the transports failed and the app lost live updates.

RealtimeConfig.importModule (b029de20)

  • A function from a package specifier ('pusher-js', 'firebase/app', …) to the module. It defaults to the existing dynamic import(), so current apps are unaffected.
  • Used everywhere an SDK loads: the Pusher, Firebase messaging and Firebase database transports, and deviceToken() when it falls back to the firebase config.
  • createPusherTransport, createFirebaseTransport, createFirebaseDatabaseTransport and requestDeviceToken accept it as an optional last argument.
  • The notifications guide shows a jsDelivr-backed importer for bundler-less pages, and the changelog has an entry.

Motivation: the Arkyc verification widget ships a standalone IIFE build that doesn't bundle the SDKs and loads them from jsDelivr. This lets it use @arkstack/realtime without losing live updates in plain embeds.

Also included

  • 052ec3f7: maintainer refactor of the Express integration tests and container binding, plus Prettier configuration and formatting.

Test plan

  • New tests:
    • pusher-js and every Firebase module the database transport and device tokens need are loaded only through the supplied importer;
    • the "install pusher-js" error still appears when the importer fails.
  • pnpm lint, pnpm build, pnpm docs:build
  • vitest run: 580 passed, 5 skipped

…tainer binding logic

fix(testsSetup): enhance config retrieval logic for better defaults

chore(tsdown): update build configuration for improved output handling

fix(fs): optimize findUpConfig and exists functions for better error handling

chore(vitest): refine test configuration and setup for improved clarity

chore(prettier): add configuration and ignore files for consistent code formatting
@codecov

codecov Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

@3m1n3nc3
3m1n3nc3 merged commit e537d15 into main Oct 11, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant