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

amd-lite

v1.0.1

Published

Minimal AMD / RequireJS implementation. No plugins, no loaders, only module resolving.

Downloads

12

Readme

AmdLite

Minimal AMD / RequireJS implementation. No plugins, no loaders, only module resolving.

AMD modules in the browser for less than 4KB !

Why ?

AMD modules are not simple to use, RequireJS and r.js api are heavy and complex. AmdLite is here to offer modular JS in the browser with a minimal footprint and without configuration complexity.

This script is for you if :

  • You want modular JS in your browser.
  • You want to avoid loading libraries one at a time (HTTP2 push where are you?) for loading time optimization.
  • You don't want to include the huge require.js file in your javascript.
  • You have a compiler (let say Typescript) which can prepare AMD modules for you.
  • You don't need AMD plugins or RequireJS's library dynamic loading feature.
  • You want advanced resources management like code-splitting and dependency injection.

Usage

Include the amdLite.js or amdLite.min.js file in your bundle. You can insert it at any level of your bundle because unless like RequireJS, this is not polluting global scope with require and define methods automatically.

Create a config file (here is an example : amdLite.config.js). Include this config file after not optimized libraries, but before optimized ones.

amdLite will be injected into the global scope. This will be the public API if you want to use advanced features. Take a look at amdLite.js to see how it works.

Optimization

AmdLite is only compatible with optimized libraries.

An optimized module is a module with its path in the define statement :

  • Not optimized : define(['require', 'exports', 'react'], function () {...});
  • Optimized : define('path/to/Module', ['require', 'exports', 'react'], function () {...});

Not optimized modules are meant to be optimized with r.js (or the simpler grunt-amd-compile). They also can be loaded dynamically with XHR requests but this is not possible with amtLite, on purpose.

Tested libraries

We tested with compiled code from Typescript for AMD modules. Those modules were optimised with grunt-amd-compile Tested code was using these libraries as dependencies :

Links

  • Read this really good article about modular JS : https://addyosmani.com/writing-modular-js/
  • Solid JS framework is a Typescript framework using AmdLite
  • grunt-amd-compile is an ultra simple AMD optimizer, used in Solid JS
  • Almond is the main inspiration for this script.