-
Notifications
You must be signed in to change notification settings - Fork 112
Handle absolute as well as relative paths (issue #969) #1317
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
In the other discussion, @SethPoulsen said something which I think is useful here:
I think this is likely the right way to go. At the moment, all the built phase0 files have |
Agreed. (Though I'd like to potentially go further yet: I don't think we ought to preserve any actual directory names in the built output at all. I think we could anonymize the directories we encounter, as "a", "b", "c", "d', "a/a", "a/b", etc, thereby getting consistent builds across different people's machines, as long as their directory structures were merely isomorphic...) |
Does that need to be part of this PR? |
Not necessarily; I don't think your comment needs to be part of this PR either, per se. :) This just gets us to supporting other paths better, and a separate PR could normalize the paths however we choose. |
I've changed the However, there are still things like @blerner What's the benefit of getting rid of path names altogether? It seems kind of nice to have things like |
Have there been any decisions made yet as to what we want to do here? |
IMO we should just merge this since folks try it and its useful. The only reason I have hesitated on absolute paths is that if we decide to go to a system where we copy the directory structure of the source tree to a target tree, then absolutes are gnarly to handle. But given the way the compiler and locators work right now, there's no reason to not support this that I can see, and I think relative paths will have all the same issues. |
Sounds good to me. What is the argument for copying to a target tree? |
The main argument for copying to a target tree is interfacing with vanilla JS files that use built-in node Though this works for many simple cases, since all Pyret modules are copied into a single directory layer with hashed names, they can't reliably use relative path imports if they depend on other plain JavaScript files. However, if the compiler copied the directory structure of the compiled source, then any JS dependencies could be copied over with the same relative structure, and imports would Just Work. This also plays nicely with tools like webpack and browserify. Generally, it would make the compiled output of Pyret feel more like a regular JavaScript project instead of a language-specific cache. |
Same as pull request #1321 but comparing to horizon now. That really tested my git skills. Glad I got it figured out.