0.2.0 • Published 10 years ago

amd-wrap-legacy v0.2.0

Weekly downloads
3
License
WTFPL
Repository
github
Last release
10 years ago

Simple Wrapping of CommonJS to AMD

All this module does is wrap your CommonJS modules into the simplified CommonJS wrapper format, i.e.:

define(function (require, exports, module) {
    // your CommonJS code here
});

It takes in a string and gives back a string:

var amdWrap = require("amd-wrap-legacy");

var wrapped = amdWrap("module.exports = 5;");
var wrapThis = amdWrap(fs.readFileSync(__filename));

Line numbers will line up, although the first column will be shifted by "define (function (require, exports, module) {".length characters.

Difference from amd-wrap

This is similar to amd-wrap but adds features that can help transition from a non-CommonJS style RequireJS codebase.

It will not wrap if:

  • the file is already wrapped
  • the file begins with function( that suggests a module on Window
  • the file starts with a comment // amd-wrap:disable
0.2.0

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago