New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

broccoli-cjs-wrap

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

broccoli-cjs-wrap

broccoli filter for wrapping CommonJS modules

  • 0.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
36
decreased by-35.71%
Maintainers
1
Weekly downloads
 
Created
Source

build status

broccoli-cjs-wrap

Wrap naked CommonJS modules in a define wrapper for use in browser.

Installation

npm install --save-dev broccoli-cjs-wrap

Usage (Sample Brocfile.js)

var cjsWrap = require('broccoli-cjs-wrap');
var filterEs6Module = require('broccoli-es6-module-filter');
var pickFiles = require('broccoli-static-compiler');
var mergeTrees = require('broccoli-merge-trees');

module.exports = function (broccoli) {

  // in conjunction with es6 module filter
  var tree = broccoli.makeTree('lib');

  // create a CJS version
  var cjsTree = filterEs6Module(pickFiles(tree, {
    srcDir: '',
    destDir: 'cjs'
  }));

  var wrappedCjsTree = cjsWrap(pickFiles(cjsTree, {
    srcDir: '',
    destDir: 'cjs-wrapped'
  }));

  return mergeTrees([cjsTree, wrappedCjsTree]);
};

To build:

$ broccoli build output

Options

  • namespace - Namespace all your modules. ex: 'MyApp', MyApp/tracker
  • packageName - Name of your package, goes after the namespace.
  • main - main entry point of the module. ex: 'index', MyApp/tracker/index.js -> MyApp/tracker. You must pass a packageName and/or namespace if you use main
  • require - Require function that define is attached to. Defaults to this.require

Keywords

FAQs

Package last updated on 14 Nov 2014

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