cjfella
Rewrites heads of AMD modules to turn them into CommonJS
Works only with CoffeeScript files. JS port is welcome.
Man
Two types of rewrite are possible.
Simple unwrap
define -> consolelog "independent code" consolelog "independent code" consolelog "independent code" consolelog "independent code" consolelog "independent code"
results into:
consolelog "independent code"consolelog "independent code"consolelog "independent code"consolelog "independent code"consolelog "independent code"
Dependencies rewrite
define 'underscore' 'other-lib' _my_lib -> log = _bindconsolelogconsole log "dependent code"
Results into:
_ = require 'underscore'my_lib = require 'other-lib' log = _bindconsolelogconsolelog "dependent code"
Note that head of the cs file should comply to the format:
define [
'dep1-path'
'dep2-path'
], (
dep1name
, dep2name
) ->