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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@scriptollc/require-kernel

v2.0.0

Published

A reference implementation of a CommonJS module loader.

Downloads

1

Readme

require-kernel

This is an implementation of the CommonJS module standard for a browser environment.

Usage

The kernel is a code fragment that evaluates to an unnamed function.

Interface

Modules can be loaded either synchronously and asynchronously:

  • module = require(path)
  • require(path1[, path2[, ...]], function (module1[, module2[, ...]]) {})

The kernel has the following methods:

  • define: A method for defining modules. It may be invoked one of several ways. In either case the path is expected to be fully qualified and the module a function with the signature (require, exports, module).
    • require.define(path, module)
    • require.define({path1: module1[, path2: module2[, ...]]})
  • setGlobalKeyPath: A string (such as "require" and "namespace.req") that evaluates to the kernel in the global scope. Asynchronous retrieval of modules using JSONP will happen if and only if this path is defined. Default is undefined.
  • setRootURI: The URI that non-library paths will be requested relative to. Default is undefined.
  • setLibraryURI: The URI that library paths (i.e. paths that do not match /^\.{0,2}\//) will be requested relative to. Default is undefined.
  • setRequestMaximum: The maximum number of concurrent requests. Default is 2.
  • setLibraryLookupComponent: A string (such as "node_modules"). If defined, libraries will be searched for in parent directories. Default is undefined.

Behavior

JSONP

If a global key path was set for the kernel and the request is allowed to be asynchronous, a JSONP will be used to request the module. The callback parameter sent in the request is the define method of require (as specified by the global key path).

Cross Origin Resources

JSONP accomplishes CORS, so if such a request is possible to make, it is made, else, if the user agent is capable of such a request, requests to cross origin resources can be made, if not (IE[6,7]), the kernel will attempt to make a request to a mirrored location on the same origin (http://static.example.com/javascripts/index.js becomes http://www.example.com/javascripts/index.js).

License

Released to the public domain. In any regions where transfer the public domain is not possible the software is granted under the terms of the MIT License.