transform AMD/CommonJS/Module to CMD
- transform(code:String):String
- transform source code to CMD
- for CommonJs it will wrap define
- for AMD it will:
- delete
define.AMD
anddefine.AMD.xxx
- modify the factory params to
require, exports, module
- add dependence by
var dependence = require("dependence")
in factory top
- delete
- for ES6 module it will:
- transform module from:
var dependence = require("dependence")
- transform import from:
var property;!function(){var _0_=require("dependence");property=_0_.property;}();
- also support alias:
var alias;!function(){var _0_=require("dependence");alias=_0_.property;}();
- export var and function:
var v;function f(){};exports.v=v;exports.f=f;
- export default:
module.exports=something;
- transform module from:
- for ES6 it will transform to ES5
- otherwise it will return your source code
npm install seatransform