google/traceur-compiler

So which "compiler" is correct ???

aabatpurdue opened this issue · 3 comments

In another universe far, far away - the files in the acorn/src directory all have a '.js' suffix. The files themselves import/export from/to '"./xxx"' <- note no suffix. 'traceur' gets very unfriendly with that form of name specification. If each 'xxx.js' file is copied to 'xxx2.js' and modified to import/export from/to "xxx2.js", 'traceur' is happy.

So according to the newer ECMA specs, which one is correct - with or without?

-- Thanks,
-- Paul Townsend

arv commented

ECMAScript does not specify the resolve rules.

The only existing spec for this is in HTML (<script type=module>) which requires full URLs (it does not add .js) so you should include .js in your import declaration.

Not sure that I agree with the policy of requiring the '.js' suffix in the 'from "./zzz.js"'. It should work both with and without the suffix's presence. Are you familiar with the GNU 'make'. It goes to an extreme amount of trouble finding the proper source file. Maybe 'traceur' and other JS processors should follow suit. One article that I saw on the net said that 'traceur' used to accept '"zzz"'.

This should probably go in another 'issue' but I'm lazy. It seems that 'traceur' doesn't understand the *nix symlink. I get a bunch of strange errors when I attempt to use them. I have a Cygwin installation that sits on top of a Windows Vista Home Basic OS. When I make the following symlinks

cd master/acorn-master/src

for x in *.js ; do

rm ${x%.js}

ln -s $x ${x%.js}

done

traceur --out junk.js index.js

'traceur' produces beaucoup strange errors. If I make the following hard links instead

cd master/acorn-master/src

for x in *.js ; do

rm ${x%.js}

ln $x ${x%.js}

done

traceur --out junk.js index.js

everything seems to work.

-- Thanks,

-- Paul Townsend


From: Erik Arvidsson notifications@github.com
Sent: Thursday, October 6, 2016 12:08 AM
To: google/traceur-compiler
Cc: Paul Townsend; Author
Subject: Re: [google/traceur-compiler] So which "compiler" is correct ??? (#2136)

ECMAScript does not specify the resolve rules.

The only existing spec for this is in HTML (<script type=module>) which requires full URLs (it does not add .js) so you should include .js in your import declaration.

You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com//issues/2136#issuecomment-251862539, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AUVjrWnMhVTVXgXw2c8CstojAai85UFtks5qxHRTgaJpZM4KPdJ9.

arv commented

The implicit file ending has been discussed a lot elsewhere. It does not work on the web. I think having an option to use Node.js's require.resolve semantics might be an option that one could opt in to if they wanted.

The symlink one seems bad. @johnjbarton Any idea?