-
Notifications
You must be signed in to change notification settings - Fork 150
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
coffeescript is broken on current master #604
Comments
The two tests that are failing have to do with CoffeeScript registering to handle |
Thanks @GeoffreyBooth. The behaviour changed in nodejs/node#22382. I don't know exactly how CoffeeScript configures the module loader, but with this simple test, I can't make it work (in Node 10): echo "console.log('in a.coffee')" > a.coffee
echo "console.log('in b.coffee.md')" > b.coffee.md // test.js
require.extensions['.coffee'] = () => console.log('.coffee');
require.extensions['.coffee.md'] = () => console.log('.coffee.md');
require('./a')
require('./b') $ ./node test.js
.coffee /home/mzasso/git/nodejs/node/a.coffee
in b.coffee.md We can see that the |
CoffeeScript does some hacking of https://github.com/jashkenas/coffeescript/blob/master/src/register.coffee#L12-L37 (generated JS) This code was last edited in 2013. Obviously from looking at it whoever wrote it shouldn’t have expected it to last forever, considering the overriding of Node’s prototypes and using of Node’s private methods that it’s doing . . . but does it need to break just yet? I’d love to leave all the CommonJS code in here alone and only worry about refactoring for ESM when that day comes. @targos Your test needs a few tweaks. First, by definition Literate CoffeeScript (the echo "console.log 'in a.coffee'" > a.coffee
echo " console.log 'in b.coffee.md'" > b.coffee.md
echo "require('coffeescript/register'); require('./a'); require('./b');" > test.js
npm install coffeescript And running it: $ node -v
v10.11.0
$ node test.js
in a.coffee
in b.coffee.md |
The nodejs/node#22382 filters Under the nodejs/node#22382 change for The legacy behavior allowed Node to find the path of For CoffeeScript, the way to work with nodejs/node#22382 would be to register a The other option is for Node to revert nodejs/node#22382 and flip to supporting multi-part extensions in |
@MylesBorins I don’t have a strong preference, but if we do decide to do something in Node.js core, I like the last option proposed by @jdalton (reverting + making multi-extension loading work). |
I am on the same page as @addaleax |
Ok. In the short term I'll try to get a PR out today or tomorrow to revert nodejs/node#22382 (if someone wants to beat me to it that's cool too). @GeoffreyBooth would you like to pair program with me this week to create a PR to make |
It seems serious, because related to the module loader:
/cc @jashkenas @GeoffreyBooth
Tested with this nightly build: https://nodejs.org/download/nightly/v11.0.0-nightly201809222b29df71eb/
The text was updated successfully, but these errors were encountered: