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

amd-wrapper

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amd-wrapper

The AMD wrapper for CommonJS files

  • 0.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

amd-wrapper

Dependency Status devDependency Status NPM Version

A node utility to simple wrapping CommonJs file to AMD. Optionally, resolving the require module id to ensure the require id can work in AMD environment.

How to use

Install

npm install amd-wrapper --save

Usage

var amdWrap = require('amd-wrapper');

// only simple wrapping like this
// define(function (require, exports, module) { ... })
var result = amdWrap('code'); 

result = amdWrap('code', { // resolve require id
    resolveRequire: true, 
    filePath: 'a/b.js',
    requireConfig: {
        baseUrl: 'src',
        packages: []
    },
    projectRoot: 'root absolute path',
    componentDirName: 'dep'
});

Options

  • code string: the code to transform

  • options Object optional: the options to transform

  • options.resolveRequire boolean optional: whether resolve require module id to ensure the amd module loader require work, by default false

  • options.filePath string: the file path host the code

  • options.requireConfig string|function():Object: the amd require config

  • options.projectRoot string: the project root absolute path, by default the execute directory currently

  • ptions.componentDirName string optional: the directory to install the package to resolve, by default node_modules

  • options.extensions Array.<string> optional: array of file extensions to search the require module in order, by default, ['.js']

  • checkUMD boolean optional: whether check UMD module style, if the code exists UMD define, the transform will ignore, by default false

  • options.debug boolean optional: whether to output resolve fail module info, by default false

Keywords

FAQs

Package last updated on 01 Mar 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