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

babel-plugin-transform-cjs-system-wrapper

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-cjs-system-wrapper

Wraps CommonJS scripts into `System.registerDynamic(...`

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
16K
increased by8.02%
Maintainers
1
Weekly downloads
 
Created
Source

babel-plugin-transform-cjs-system-wrapper

Wraps CommonJS scripts into System.registerDynamic(...

Example

In

'use strict';

var foo = require('foo/');

Babel Options

{
  moduleId: 'foobar'
  plugins: [
    ['transform-cjs-system-wrapper', {
      deps: ['bar'],
      globals: {
        f: foo
      }
    }]
  ]
}

Out

System.registerDynamic('foobar', ['bar'], true, function ($__require, exports, module) {
  'use strict';

  var f = $__require('foo');
  var define,
      global = this,
      GLOBAL = this;
  var foo = $__require('foo');
  return module.exports;
});

Installation

$ npm install babel-plugin-transform-cjs-system-wrapper

Usage

Via .babelrc

.babelrc

{
  "moduleId": "foobar",
  "plugins": [
    ["transform-cjs-system-wrapper", {
      "systemGlobal": "SystemJS",
      "path": "/path/to/foobar",
      "optimize": true,
      "static": true,
      "deps": ["bar"],
      "globals": {
        "f": "foo"
      }
    }]
  ]
}

Via CLI

$ babel --plugins transform-cjs-system-wrapper script.js
require("babel-core").transform("code", {
  moduleId: 'foobar', // optional (default: '')
  plugins: [
    ["transform-cjs-system-wrapper", {
      systemGlobal: "SystemJS", // optional (default: 'SystemJS')
      path: "/path/to/foobar", // optional (default: '')
      optimize: true, // optional (default: false)
      static: true, // optional (default: false)
      deps: ['bar'], // optional (default: [])
      globals: {  // optional (default: {})
        f: foo
      }
    }]
  ]
});

Keywords

FAQs

Package last updated on 03 Aug 2016

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