-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add support for emitting .luau
files
#2
Conversation
src/PathTranslator.ts
Outdated
@@ -193,7 +209,7 @@ export class PathTranslator { | |||
pathInfo.fileName = INIT_NAME; | |||
} | |||
|
|||
pathInfo.exts.push(LUA_EXT); // push .lua | |||
pathInfo.exts.push(this.getLuauExt()); // push .luau |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not backwards compatible. Packages that still use .lua
would not be resolved correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it is.
getImportPath()
is only ever used "virtually". This is because it needs to understand files which don't exist yet (i.e. outDir
hasn't been created).
The result is passed into RojoResolver to figure out the RbxPath
of the file without ever looking at the filesystem itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A realization I had while writing this:
RojoResolver stores references to .lua
file paths exactly if a $path
points to a .lua
file. Will need to find a solution here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This implementation does not cover converting .lua
input file paths to .luau
when copying them from src
to out
(which goes via getOutputPath
). Do we want to do that?
I don't think we should. This feels a bit too magic. The compiler should just copy your non-compiled files as-is. |
Depends on: - roblox-ts/path-translator#2 - roblox-ts/rojo-resolver#496 Allows for both emitting .luau files to `outDir` and importing packages contain `.luau` files (or `.lua` for backwards compatibility). Unit tests pass with the above two PR branches installed locally.
Temporarily behind a flag because the compiler will have a
--luau
flag which defaults to true. Users will be able to do--luau=false
if emitting.luau
files breaks their workflows.Fixes #1