fella

1.0.3 • Public • Published

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 ->
  console.log "independent code"
  console.log "independent code"
  console.log "independent code"
  console.log "independent code"
  console.log "independent code"

results into:

console.log "independent code"
console.log "independent code"
console.log "independent code"
console.log "independent code"
console.log "independent code"

Dependencies rewrite

define [
  'underscore'
  'other-lib'
](
  _
my_lib
) ->
 
  log = _.bind(console.logconsole)
  log "dependent code"

Results into:

= require 'underscore'
my_lib = require 'other-lib'
 
log = _.bind(console.logconsole)
log "dependent code"

Note that head of the cs file should comply to the format:

define [
  'dep1-path'
  'dep2-path'
], (
  dep1name
, dep2name
) ->

Package Sidebar

Install

npm i fella

Weekly Downloads

0

Version

1.0.3

License

MIT

Last publish

Collaborators

  • ognivo