Skip to content

Latest commit

 

History

History
31 lines (25 loc) · 1.15 KB

README.md

File metadata and controls

31 lines (25 loc) · 1.15 KB

seatransform

transform AMD/CommonJS/Module to CMD

NPM version Build Status

API

  • transform(code:String):String
    • transform source code to CMD
    • for CommonJs it will wrap define
    • for AMD it will:
      • delete define.AMD and define.AMD.xxx
      • modify the factory params to require, exports, module
      • add dependence by var dependence = require("dependence") in factory top
    • 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;
    • for ES6 it will transform to ES5
    • otherwise it will return your source code

INSTALL

npm install seatransform