It sounds like the meat of your complaint is that streamline and
coffee-script both want to instrument .coffee files, and can clobber
each other. It seems easy enough for these two systems to detect if
there's already a require.extensions[".coffee"] and behave
appropriately.
As for the coffee-script repl, all that's needed is to set
`module.filename` and `module.paths` appropriately. Here's the two
lines that do this in node's lib/repl.js:
// hack for require.resolve("./relative") to work properly.
module.filename = process.cwd() + '/repl';
// hack for repl require to work properly with node_modules folders
module.paths = require('module')._nodeModulePaths(module.filename);
So, I'm not sure I buy that either of these problems are unsolvable
with the tools already exposed.
There have been a few requests to allow for a way to customize the
module lookup process. This *can* be done, though it's a bit
heavy-handed and brittle, by modifying
require("module")._resolveFilename or require("module")._findPath.
These APIs are undocumented and private, and any program that relies
on them should be considered a not-for-prime-time science experiment
(since unpublished APIs can change at any time, with no warning). But
if that's really a requirement for some use case, it might be good to
explore what kind of API would make sense there.
I cannot stress how important simplicity is in this area. There is a
fair amount of necessary complexity for the use cases we support, and
adding any unnecessary complexity makes it very easy to break every
node program, since *everyone* depends on modules loading properly.
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to nod...@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+un...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
It seems easy enough for these two systems to detect if
there's already a require.extensions[".coffee"] and behave
appropriately.
I think that could be done in a pretty backwards-compatible way.
Maybe something like this?
require("module").addTransform(".coffee", function (src, filename) {
if (src === null) src = fs.readFileSync(filename);
return someFancyStreamlineThingie(src, filename);
});
So, each thing like this pushes another transformer function onto a
queue. The first default item would be something like:
function (src, filename) { return fs.readFileSync(filename) }
That'd also be really handy for automatically adding code-coverage with burrito.
----
Aria Stewart
> > > On Fri, Jul 8, 2011 at 10:27, Aseem Kishore <aseem....@gmail.com (mailto:aseem....@gmail.com)>
> > > wrote:
> > > > Anyone have any thoughts or responses? =D
> > > > Aseem
> > > >
> > > > On Wed, Jul 6, 2011 at 7:41 PM, Aseem Kishore <aseem....@gmail.com (mailto:aseem....@gmail.com)>
> > > > To post to this group, send email to nod...@googlegroups.com (mailto:nod...@googlegroups.com)
> > > > To unsubscribe from this group, send email to
> > > > nodejs+un...@googlegroups.com (mailto:nodejs+un...@googlegroups.com)
> > > > For more options, visit this group at
> > > > http://groups.google.com/group/nodejs?hl=en?hl=en
> > >
> > > --
> > > Job Board: http://jobs.nodejs.org/
> > > Posting guidelines:
> > > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> > > You received this message because you are subscribed to the Google
> > > Groups "nodejs" group.
> > > To post to this group, send email to nod...@googlegroups.com (mailto:nod...@googlegroups.com)
> > > To unsubscribe from this group, send email to
> > > nodejs+un...@googlegroups.com (mailto:nodejs+un...@googlegroups.com)
> > > For more options, visit this group at
> > > http://groups.google.com/group/nodejs?hl=en?hl=en
> >
> > --
> > Job Board: http://jobs.nodejs.org/
> > Posting guidelines:
> > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> > You received this message because you are subscribed to the Google
> > Groups "nodejs" group.
> > To post to this group, send email to nod...@googlegroups.com (mailto:nod...@googlegroups.com)
> > To unsubscribe from this group, send email to
> > nodejs+un...@googlegroups.com (mailto:nodejs+un...@googlegroups.com)
> > For more options, visit this group at
> > http://groups.google.com/group/nodejs?hl=en?hl=en
>
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to nod...@googlegroups.com (mailto:nod...@googlegroups.com)
> To unsubscribe from this group, send email to
> nodejs+un...@googlegroups.com (mailto:nodejs+un...@googlegroups.com)