Skip to content
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 .luau support to RojoResolver #496

Merged
merged 5 commits into from
Sep 10, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/RojoResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import path from "path";
const PACKAGE_ROOT = path.join(__dirname, "..");

const LUA_EXT = ".lua";
const LUAU_EXT = ".luau";
const JSON_EXT = ".json";

const INIT_NAME = "init";
Expand Down Expand Up @@ -94,7 +95,7 @@ export enum NetworkType {

function stripRojoExts(filePath: string) {
const ext = path.extname(filePath);
if (ext === LUA_EXT) {
if (ext === LUA_EXT || ext === LUAU_EXT) {
filePath = filePath.slice(0, -ext.length);
const subext = path.extname(filePath);
if (subext === SERVER_SUBEXT || subext === CLIENT_SUBEXT) {
Expand Down Expand Up @@ -249,7 +250,8 @@ export class RojoResolver {

private parsePath(itemPath: string) {
const realPath = fs.pathExistsSync(itemPath) ? fs.realpathSync(itemPath) : itemPath;
if (path.extname(itemPath) === LUA_EXT) {
const ext = path.extname(itemPath);
if (ext === LUA_EXT || ext === LUAU_EXT || ext === JSON_EXT) {
this.filePathToRbxPathMap.set(itemPath, [...this.rbxPath]);
} else {
const isDirectory = fs.pathExistsSync(realPath) && fs.statSync(realPath).isDirectory();
Expand Down
Loading