Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

loader.js

Package Overview
Dependencies
Maintainers
6
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

loader.js

loader.js =========

  • 4.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
90K
decreased by-20.81%
Maintainers
6
Weekly downloads
 
Created
Source

loader.js Build Status

Minimal AMD loader mostly stolen from @wycats.

No Conflict

To prevent the loader from overriding require, define, or requirejs you can instruct the loader to use no conflict mode by providing it an alternative name for the various globals that are normally used.

Example:

loader.noConflict({
  define: 'newDefine',
  require: 'newRequire'
});

Note: To be able to take advantage of alternate define method name, you will also need to ensure that your build tooling generates using the alternate. An example of this is done in the emberjs-build project in the babel-enifed-module-formatter plugin.

wrapModules

It is possible to hook loader to augment or transform the loaded code. wrapModules is an optional method on the loader that is called as each module is originally loaded. wrapModules must be a function of the form wrapModules(name, callback). The callback is the original AMD callback. The return value of wrapModules is then used in subsequent requests for name

This functionality is useful for instrumenting code, for instance in code coverage libraries.

loader.wrapModules = function(name, callback) {
            if (shouldTransform(name) {
                    return myTransformer(name, callback);
                }
            }
            return callback;
    };

Tests

We use testem for running our test suite.

You may run them with:

npm test

You can also launch testem development mode with:

npm run test:dev

License

loader.js is MIT Licensed.

Keywords

FAQs

Package last updated on 24 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc