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

@bitecraft/jswhere

v0.0.4

Published

JSWhere is a lightweight and precise JavaScript library that detects the exact runtime environment of your application, including React Native, Expo, Vite, Next.js, NestJS, and more.

Readme

     _ ____  __        ___                   
    | / ___| \ \      / / |__   ___ _ __ ___ 
 _  | \___ \  \ \ /\ / /| '_ \ / _ \ '__/ _ \
| |_| |___) |  \ V  V / | | | |  __/ | |  __/
 \___/|____/    \_/\_/  |_| |_|\___|_|  \___|

JSWhere 🔍

A lightweight and precise JavaScript library that detects the exact runtime environment of your application, including React Native, Expo, Vite, Next.js, NestJS, and more. 🚀

License: MIT Node.js Version TypeScript

Table of Contents

Overview
Features
Installation
Usage
Supported EnvironmentsDevelopment
API Reference
Contributing
License

Overview 🎯

Runtime Environment Detector is a powerful utility that helps you identify the current JavaScript runtime environment your code is executing in. Whether you're running in Vite, React Native, Expo, or other environments, this library provides accurate detection.

Features ✨

  • 🔍 Accurate runtime environment detection
  • 🎯 Type-safe implementation
  • 🚀 Zero dependencies
  • 💨 Lightweight and fast
  • 🔌 Easy integration
  • 📦 Tree-shakeable

Installation 📦

# Using npm
npm install @bitecraft/jswhere

# Using Bun
bun install @bitecraft/jswhere

# Using pnpm
pnpm install @bitecraft/jswhere

# Using yarn
yarn add @bitecraft/jswhere

Usage 🚀

import { detectEnvironment } from '@bitecraft/jswhere';

const environment = detectEnvironment();
console.log(`Current runtime environment: ${environment}`);

Supported Environments ✅

Current implementation status:

  • [x] Vite
  • [x] React Native
  • [x] Expo
  • [ ] Next.js (Coming soon)
  • [ ] NestJS (Coming soon)
  • [ ] Browser (Coming soon)
  • [ ] Node.js (Coming soon)
  • [ ] Electron (Coming soon)
  • [ ] Remix (Coming soon)
  • [ ] Nuxt (Coming soon)
  • [ ] SvelteKit (Coming soon)
  • [ ] Deno (Coming soon)
  • [ ] Bun (Coming soon)

Development 🛠️

Prerequisites

  • Node.js >= 14.0.0
  • TypeScript/Javascript knowledge

Setting Up Development Environment

  1. Clone the repository:
git clone https://github.com/BiteCraft/jswhere.git
cd jswhere
  1. Install dependencies:
npm install
  1. Start development
npm run dev

Building the Project

npm run build

API Reference 📚

Main Function

function detectEnvironment(): RuntimeEnvironment

Returns one of the following types:

type RuntimeEnvironment =
  | "expo"
  | "react-native"
  | "vite"
  | "nextjs"
  | "nestjs"
  | "browser"
  | "node"
  | "electron"
  | "remix"
  | "nuxt"
  | "sveltekit"
  | "deno"
  | "bun"
  | "unknown";

Contributing 🤝

This project is currently a work in progress, and we welcome contributions! If you'd like to help, here are some ways you can contribute:

  1. Implement missing environment detectors
  2. Improve existing detectors
  3. Add tests
  4. Improve documentation

To contribute:

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/NewDetector)
  3. Commit your changes(git commit -m 'feat: add new environment detector')
  4. Push to the branch (git push origin feature/NewDetector)
  5. Open a Pull Request

License 📄

This project is licensed under the MIT License - see the LICENSE file for details.


Made with ❤️ using TypeScript