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

@besar1/simple-sdk-loader

v1.0.0

Published

Dynamic loader for simple-sdk with version management

Readme

Simple SDK Loader

A dynamic loader for @besar1/simple-sdk that can load different versions from NPM or CDN based on configuration.

Installation

npm install @besar1/simple-sdk-loader
# or
pnpm add @besar1/simple-sdk-loader
# or
yarn add @besar1/simple-sdk-loader

Usage

Loading from NPM

import { SimpleSDKLoader } from '@besar1/simple-sdk-loader';

const loader = new SimpleSDKLoader({
  package: 'npm',
  version: '1.0.0' // optional, defaults to 'latest'
});

const sdk = await loader.load();
const result = await sdk.doSomething();
console.log(result);

Note: For NPM loading with specific versions, the loader uses ESM imports from CDN since dynamic imports can't specify package versions directly. For 'latest' version, it first tries to import locally installed packages, then falls back to CDN.

Loading from CDN

import { SimpleSDKLoader } from '@besar1/simple-sdk-loader';

const loader = new SimpleSDKLoader({
  package: 'umd',
  version: '1.0.0',
  cdnUrl: 'https://unpkg.com' // optional, defaults to unpkg
});

const sdk = await loader.load();
const result = await sdk.doSomething();
console.log(result);

Browser Usage

<script src="https://unpkg.com/@besar1/simple-sdk-loader@latest/dist/index.umd.js"></script>
<script>
  const loader = new SimpleSDKLoader.SimpleSDKLoader({
    package: 'umd',
    version: 'latest'
  });
  
  loader.load().then(sdk => {
    return sdk.doSomething();
  }).then(result => {
    console.log(result);
  });
</script>

API

SimpleSDKLoader

Constructor

new SimpleSDKLoader(config: LoaderConfig, options?: LoaderOptions)

Configuration

interface LoaderConfig {
  package: 'npm' | 'umd';
  version?: string | 'latest';
  cdnUrl?: string; // Custom CDN URL for UMD loading
}

interface LoaderOptions {
  timeout?: number; // Timeout for loading SDK (default: 10000ms)
  retries?: number; // Number of retries for failed loads (default: 3)
}

Methods

  • load(): Promise<SDKClient> - Load the SDK and return the client instance
  • getSDK(): SDKClient | null - Get the currently loaded SDK instance
  • isLoaded(): boolean - Check if SDK is loaded
  • getConfig(): LoaderConfig - Get current configuration

Version Loading Strategy

NPM Package Loading (package: 'npm')

  • Latest version: Tries local import first, falls back to CDN ESM
  • Specific version: Always loads from CDN using ESM format
  • URL format: https://unpkg.com/@besar1/simple-sdk@{version}/dist/index.esm.js

CDN Loading (package: 'umd')

  • Any version: Loads UMD bundle from CDN
  • URL format: https://unpkg.com/@besar1/simple-sdk@{version}/dist/index.umd.js

Features

  • ✅ Dynamic loading from NPM or CDN
  • Version-specific loading: Load exact versions specified in configuration
  • ✅ TypeScript support with proper type re-exports
  • ✅ Configurable timeouts and retries
  • ✅ Browser and Node.js support
  • ✅ Custom CDN URL support
  • ✅ Fallback strategies for different environments

How it works

  1. NPM Loading:
    • For 'latest': Tries dynamic import of locally installed package, falls back to CDN ESM
    • For specific versions: Uses CDN ESM imports with version-specific URLs
  2. CDN Loading: Dynamically injects script tags to load UMD bundles from CDN
  3. Type Safety: Re-exports types from the core SDK to ensure interface compatibility
  4. Version Management: Constructs version-specific URLs for precise version loading

License

MIT