Socket
Socket
Sign inDemoInstall

systemjs-builder

Package Overview
Dependencies
24
Maintainers
1
Versions
139
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    systemjs-builder

SystemJS Build Tool ===


Version published
Weekly downloads
15K
decreased by-3.18%
Maintainers
1
Install size
5.65 MB
Created
Weekly downloads
 

Readme

Source

SystemJS Build Tool

Provides a single-file build for SystemJS of mixed-dependency module trees.

Builds ES6 into ES5, CommonJS, AMD and globals into a single file in a way that supports the CSP SystemJS loader as well as circular references.

Example

app.js

import $ from "./jquery";
export var hello = 'es6';

jquery.js

define(function() {
  return 'this is jquery';
});

Builds into:

System.register('app', ['./jquery'], function(deps) {
  var $, hello;
  return {
    exports: {
      get hello() {
        return hello;
      },
      set hello(val) {
        hello = val;
      }
    },
    execute: function() {
      $ = deps[0]['default'];
      hello = 'es6';
    }
  }
});

define('jquery', function() {
  return 'this is jquery';
});

It also provides a CSP wrapping for CommonJS and Globals. For example, CommonJS is output as:

System.defined["some/cjs"] = {
  deps: [],
  executingRequire: true,
  execute: function(require, exports, __moduleName) {
    var global = System.global;
    var __define = global.define;
    global.define = undefined;
    var module = { exports: exports };
    var process = System.get("@@nodeProcess");
    exports.cjs = true;
    
    global.define = __define;
    return module.exports;
  }
};

Basic Use

  npm install systemjs-builder
  var builder = require('systemjs-builder');

  builder.build('myModule', {
    baseURL: path.resolve('some/folder'),

    // any map config
    map: {
      jquery: 'jquery-1.2.3/jquery'
    },

    // etc. any SystemJS config
  }, 'outfile.js')
  .then(function() {
    console.log('Build complete');
  })
  .catch(function(err) {
    console.log('Build error');
    console.log(err);
  });

FAQs

Last updated on 16 May 2014

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc