Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling deps() fails to apply transforms #600

Closed
jwalton opened this issue Jan 21, 2014 · 3 comments
Closed

Calling deps() fails to apply transforms #600

jwalton opened this issue Jan 21, 2014 · 3 comments

Comments

@jwalton
Copy link
Contributor

jwalton commented Jan 21, 2014

fs = require 'fs'
browserify = require 'browserify'
b = browserify({extensions: ['.coffee']})
b.add './assets/browserify/reporting/reporting.coffee'
b.transform require 'coffeeify'

deps = fs.createWriteStream './reporting.js.deps'
b.deps({}).pipe deps

This will fail with:

Error: Parsing file /Users/jwalton/benbria/loop/assets/browserify/reporting/reporting.coffee: Line 1: Unexpected token ILLEGAL
  at parseDeps (/Users/jwalton/benbria/loop/node_modules/browserify/node_modules/module-deps/index.js:242:45)
  at done (/Users/jwalton/benbria/loop/node_modules/browserify/node_modules/module-deps/index.js:221:13)
  at applyTransforms (/Users/jwalton/benbria/loop/node_modules/browserify/node_modules/module-deps/index.js:197:41)
  at module.exports.trx (/Users/jwalton/benbria/loop/node_modules/browserify/node_modules/module-deps/index.js:169:17)
  at fs.readFile (fs.js:176:14)
  at Object.oncomplete (fs.js:297:15)

At a glance, it looks like module-deps is failing to run any transforms. Looking with a debugger, I see that here, transf.length is 0, as is trx.length, so when we get to parseDeps(), the src is still coffee-script.

It sounds like this has been broken for a while.

@jwalton
Copy link
Contributor Author

jwalton commented Jan 21, 2014

It looks like the problem is that deps() is not picking up the transforms from the b.transform() calls. Changing the above example to:

fs = require 'fs'
browserify = require 'browserify'
b = browserify({extensions: ['.coffee']})
b.add './assets/browserify/reporting/reporting.coffee'
coffeeify = require 'coffeeify'
b.transform coffeeify

deps = fs.createWriteStream './reporting.js.deps'
b.deps({transform: [coffeeify]}).pipe deps

seems to work (although it writes "[object Object][object Object]..." to the stream.)

@apaleslimghost
Copy link
Contributor

although it writes "[object Object][object Object]..." to the stream

It's an objectMode stream, and the WriteStream is just using .toString.

@jwalton
Copy link
Contributor Author

jwalton commented Feb 24, 2014

Yeah, exactly. :)

@ghost ghost closed this as completed in d65a3ba Mar 28, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants