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

vscode-loader

v1.0.2

Published

An universal AMD Loader

Downloads

14

Readme

VSCode Loader

An universal Asynchronous Module Definition (AMD) Loader developed primarily to load VSCode's sources.

Supported environments

  • IE 11, Edge, Firefox, Chrome, Safari, Opera
  • nodejs
  • electron (renderer & browser processes) In nodejs and electron, when loading a module, if it cannot be found with the AMD rules, it delegates loading them to the native require.

Features

  • Runs factory methods as soon as dependencies are resolved.
  • Contains a CSS loader (vs/css).
  • Contains a natural language strings loader (vs/nls).

Using

  • In a browser environment:
<script type="text/javascript" src="loader.js"></script>
<script>
	require.config({
		// ...
	});
	require(['an/amd/module'], function(value) {
		// code is loaded here
	});
</script>
  • In a node environment:
var loader = require('loader');
loader.config({
	// ...
});
loader(['an/amd/module'], function(value) {
	// code is loaded here
});
  • Supported config options:
  • baseUrl - The prefix that will be aplied to all modules when they are resolved to a location
  • paths - Redirect rules for modules. The redirect rules will affect the module ids themselves
  • config - Per-module configuration
  • catchError - Catch errors when invoking the module factories
  • recordStats - Record statistics
  • urlArgs - The suffix that will be aplied to all modules when they are resolved to a location
  • onError - Callback that will be called when errors are encountered
  • ignoreDuplicateModules - The loader will issue warnings when duplicate modules are encountered. This list will inhibit those warnings if duplicate modules are expected.
  • isBuild - Flag to indicate if current execution is as part of a build.
  • cspNonce - Allows setting a Content Security Policy nonce value on script tags created by the loader.
  • nodeRequire - The main entry point node's require
  • nodeInstrumenter - An optional transformation applied to the source before it is loaded in node's vm

Custom features

  • Recording loading statistics for detailed script loading times:
require.config({
	recordStats: true
});
// ...
console.log(require.getRecorder().getEvents());
  • Extracting loading metadata for a bundler:
var loader = require('loader');
loader.config({
	isBuild: true
});
// ...
console.log(loader.getBuildInfo());

Testing

To run the tests:

  • code loading in node: npm run test
  • amd spec tests, unit tests & code loading in browser:
    • npm run simpleserver
    • open http://localhost:9999/tests/run-tests.htm

The project uses as a submodule the AMD compliance tests. The goal is to support as many tests without adding eval() or an equivalent. It is also not a goal to support loading CommonJS code:

  • Basic AMD Functionality (basic)
  • The Basic require() Method (require)
  • Anonymous Module Support (anon)
  • ~~CommonJS Compatibility (funcString)~~
  • ~~CommonJS Compatibility with Named Modules (namedWrap)~~
  • AMD Loader Plugins (plugins)
  • ~~Dynamic Plugins (pluginsDynamic)~~
  • ~~Common Config: Packages~~
  • ~~Common Config: Map~~
  • ~~Common Config: Module~~
  • Common Config: Path
  • ~~Common Config: Shim~~

Developing

  • Clone the repository
  • Run git submodule init
  • Run git submodule update
  • Run npm install
  • Compile in the background with npm run watch1 and npm run watch2

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

License

MIT