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

fix: update relevant files to use .luau #34

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
root = true

[*.lua]
[*.luau]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
Expand Down
8 changes: 4 additions & 4 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
/*.md
/*.tgz

/globalTypes.d.lua
/globalTypes.d.luau
**/sourcemap.json
**/*.project.json

**/__tests__
**/*.test.lua
**/*.spec.lua
**/jest.config.lua
**/*.test.luau
**/*.spec.luau
**/jest.config.luau

**/*.rbxl
**/*.rbxlx
Expand Down
2 changes: 1 addition & 1 deletion .styluaignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
*.snap.lua
*.snap.luau
2 changes: 1 addition & 1 deletion DEVIATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ This would be a simple compatibility layer that should require very little maint

#### Implemented Alignment

The `createFragment` function described above was added to React.lua in [#92](https://github.com/Roblox/roact-alignment/pull/92/files).
The `createFragment` function described above was added to React.luau in [#92](https://github.com/Roblox/roact-alignment/pull/92/files).
</details>

### Ref Forwarding
Expand Down
2 changes: 1 addition & 1 deletion WorkspaceStatic/jest.config.luau
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local Workspace = script.Parent

-- In case we need to specify a custom testSetupFile for a project, we need to do that in in a separate jest.config.lua file that's in the project's root folder.
-- In case we need to specify a custom testSetupFile for a project, we need to do that in in a separate jest.config.luau file that's in the project's root folder.
-- Therefore we specify the project here and provide it to the "projects" field in this config file.
-- We also need to add the project to the "testPathIgnorePatterns" field so that Jest doesn't try to run the project's tests again.
local projectsWithCustomJestConfig = {
Expand Down
2 changes: 1 addition & 1 deletion WorkspaceStatic/jest/matchers/createConsoleMatcher.luau
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ local function normalizeCodeLocInfo(str)

-- ROBLOX deviation: In roblox/luau, we're using the stack frame from luau,
-- which looks like:
-- in Component (at ModulePath.FileName.lua:123)
-- in Component (at ModulePath.FileName.luau:123)
return (string.gsub(str, "\n in ([%w%-%._]+)[^\n]*", "\n in %1 (at **)"))
end

Expand Down
12 changes: 6 additions & 6 deletions bin/ci-benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ roblox-cli analyze tests.project.json
selene --version
selene --config selene.toml modules/
stylua --version
stylua -c modules -g "*[a-bdh-km-oquvyz].lua"
stylua -c modules -g "*[a-bdh-km-oquvyz].luau"

echo "Run benchmarks"
robloxdev-cli run --load.model model.rbxm --run bin/run-first-render-benchmark.lua --fastFlags.allOnLuau --fastFlags.overrides EnableLoadModule=true EnableDelayedTaskMethods=true --headlessRenderer 1
robloxdev-cli run --load.model model.rbxm --run bin/run-frame-rate-benchmark.lua --fastFlags.allOnLuau --fastFlags.overrides EnableLoadModule=true EnableDelayedTaskMethods=true --headlessRenderer 1
robloxdev-cli run --load.model model.rbxm --run bin/run-deep-tree-benchmark.lua --fastFlags.allOnLuau --fastFlags.overrides EnableLoadModule=true EnableDelayedTaskMethods=true --headlessRenderer 1
robloxdev-cli run --load.model model.rbxm --run bin/run-wide-tree-benchmark.lua --fastFlags.allOnLuau --fastFlags.overrides EnableLoadModule=true EnableDelayedTaskMethods=true --headlessRenderer 1
robloxdev-cli run --load.model model.rbxm --run bin/run-sierpinski-triangle-benchmark.lua --fastFlags.allOnLuau --fastFlags.overrides EnableLoadModule=true EnableDelayedTaskMethods=true --headlessRenderer 1
robloxdev-cli run --load.model model.rbxm --run bin/run-first-render-benchmark.luau --fastFlags.allOnLuau --fastFlags.overrides EnableLoadModule=true EnableDelayedTaskMethods=true --headlessRenderer 1
robloxdev-cli run --load.model model.rbxm --run bin/run-frame-rate-benchmark.luau --fastFlags.allOnLuau --fastFlags.overrides EnableLoadModule=true EnableDelayedTaskMethods=true --headlessRenderer 1
robloxdev-cli run --load.model model.rbxm --run bin/run-deep-tree-benchmark.luau --fastFlags.allOnLuau --fastFlags.overrides EnableLoadModule=true EnableDelayedTaskMethods=true --headlessRenderer 1
robloxdev-cli run --load.model model.rbxm --run bin/run-wide-tree-benchmark.luau --fastFlags.allOnLuau --fastFlags.overrides EnableLoadModule=true EnableDelayedTaskMethods=true --headlessRenderer 1
robloxdev-cli run --load.model model.rbxm --run bin/run-sierpinski-triangle-benchmark.luau --fastFlags.allOnLuau --fastFlags.overrides EnableLoadModule=true EnableDelayedTaskMethods=true --headlessRenderer 1
4 changes: 2 additions & 2 deletions bin/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ stylua -c modules bin WorkspaceStatic

echo "Run tests in DEV"
robloxdev-cli run --load.model tests.project.json \
--run bin/spec.lua \
--run bin/spec.luau \
--fastFlags.allOnLuau --fastFlags.overrides UseDateTimeType3=true EnableLoadModule=true DebugDisableOptimizedBytecode=true EnableDelayedTaskMethods=true MaxDeferReentrancyDepth=65 \
--load.asRobloxScript --headlessRenderer 1 --virtualInput 1 --fs.readwrite=$PWD --lua.globals=__COMPAT_WARNINGS__=true \
--lua.globals=UPDATESNAPSHOT=false --lua.globals=CI=true --lua.globals=__ROACT_17_MOCK_SCHEDULER__=true \
--lua.globals=__DEV__=true

echo "Run tests in release"
robloxdev-cli run --load.model tests.project.json \
--run bin/spec.lua \
--run bin/spec.luau \
--fastFlags.allOnLuau --fastFlags.overrides UseDateTimeType3=true EnableLoadModule=true DebugDisableOptimizedBytecode=true EnableDelayedTaskMethods=true MaxDeferReentrancyDepth=65 \
--load.asRobloxScript --headlessRenderer 1 --virtualInput 1 --fs.readwrite=$PWD \
--lua.globals=UPDATESNAPSHOT=false --lua.globals=CI=true --lua.globals=__ROACT_17_MOCK_SCHEDULER__=true
4 changes: 2 additions & 2 deletions bin/convert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

for file in *.js
do
mv "$file" "${file/.js/.lua}"
mv "$file" "${file/.js/.luau}"
done

for file in *.lua
for file in *.luau
do
sed -i '' -e "s/\/\*/--[[/g" "$file"
sed -i '' -e "s/\*\//]]/g" "$file"
Expand Down
2 changes: 1 addition & 1 deletion bin/run-benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Pass --runs or -r to set how many time each benchmark is run (ex: -r 5)
# Pass --dev or -d to run tests in DEV and COMPAT_WARNINGS mode (ex: --dev)

BENCHMARK_FILES = "bin/run-*-benchmark.lua"
BENCHMARK_FILES = "bin/run-*-benchmark.luau"
PROJECT_JSON = "tests.project.json"
OUTPUT_PATTERN = r"(.+) x ([\d\.]+) ([/\w]+) ±([\d\.]+)\% \((\d+) runs sampled\)"

Expand Down
16 changes: 8 additions & 8 deletions bin/testing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ set -e
bin/testing.sh
bin/testing.sh -a
bin/testing.sh --snapshot
bin/testing.sh -p bin/run-wide-tree-benchmark.lua
bin/testing.sh -p bin/run-wide-tree-benchmark.luau
comment

# Parse the args
Expand All @@ -34,7 +34,7 @@ while (( "$#" )); do
PROFILE=$2
shift 2
else
echo "Error: Argument for $1 is missing, please specify a lua file to run (ie: bin/run-sierpinski-triangle-benchmark.lua)" >&2
echo "Error: Argument for $1 is missing, please specify a lua file to run (ie: bin/run-sierpinski-triangle-benchmark.luau)" >&2
exit 1
fi
;;
Expand All @@ -60,8 +60,8 @@ eval set -- "$PARAMS"
if [[ $SNAPSHOT ]]; then
echo "Generating snapshots..."
# Figure out how to enable PROFILING global in jestSetup once we upgrade to jest 28
# roblox-cli run --load.model tests.project.json --run bin/spec.lua --fastFlags.overrides EnableLoadModule=true --fastFlags.allOnLuau --lua.globals=__DEV__=true --lua.globals=__COMPAT_WARNINGS__=true --lua.globals=__PROFILE__=true --lua.globals=UPDATESNAPSHOT="all" --load.asRobloxScript --fs.readwrite="$(pwd)"
roblox-cli run --load.model tests.project.json --run bin/spec.lua --fastFlags.overrides EnableLoadModule=true DebugDisableOptimizedBytecode=true --fastFlags.allOnLuau --lua.globals=__DEV__=true --lua.globals=__COMPAT_WARNINGS__=true --lua.globals=UPDATESNAPSHOT="all" --load.asRobloxScript --fs.readwrite="$(pwd)"
# roblox-cli run --load.model tests.project.json --run bin/spec.luau --fastFlags.overrides EnableLoadModule=true --fastFlags.allOnLuau --lua.globals=__DEV__=true --lua.globals=__COMPAT_WARNINGS__=true --lua.globals=__PROFILE__=true --lua.globals=UPDATESNAPSHOT="all" --load.asRobloxScript --fs.readwrite="$(pwd)"
roblox-cli run --load.model tests.project.json --run bin/spec.luau --fastFlags.overrides EnableLoadModule=true DebugDisableOptimizedBytecode=true --fastFlags.allOnLuau --lua.globals=__DEV__=true --lua.globals=__COMPAT_WARNINGS__=true --lua.globals=UPDATESNAPSHOT="all" --load.asRobloxScript --fs.readwrite="$(pwd)"
exit 0
fi

Expand All @@ -82,16 +82,16 @@ if [[ $PROFILE ]]; then
fi

if [[ $DEFERRED ]]; then
echo "Running tests with deferred lua enabled..."
roblox-cli run --load.model tests.project.json --run bin/spec.lua --fastFlags.allOn \
echo "Running tests with deferred luau enabled..."
roblox-cli run --load.model tests.project.json --run bin/spec.luau --fastFlags.allOn \
--fastFlags.overrides EnableLoadModule=true DebugDisableOptimizedBytecode=true EnableSignalBehavior=true DebugForceDeferredSignalBehavior=true \
--fastFlags.overrides MaxDeferReentrancyDepth=40 \
--lua.globals=__DEV__=true --lua.globals=__COMPAT_WARNINGS__=true
else
echo "Running tests..."
# Figure out how to enable PROFILING global in jestSetup once we upgrade to jest 28
#roblox-cli run --load.model tests.project.json --run bin/spec.lua --fastFlags.overrides EnableLoadModule=true --fastFlags.allOnLuau --lua.globals=__DEV__=true --lua.globals=__COMPAT_WARNINGS__=true --lua.globals=__PROFILE__=true
roblox-cli run --load.model tests.project.json --run bin/spec.lua --fastFlags.allOn \
#roblox-cli run --load.model tests.project.json --run bin/spec.luau --fastFlags.overrides EnableLoadModule=true --fastFlags.allOnLuau --lua.globals=__DEV__=true --lua.globals=__COMPAT_WARNINGS__=true --lua.globals=__PROFILE__=true
roblox-cli run --load.model tests.project.json --run bin/spec.luau --fastFlags.allOn \
--fastFlags.overrides MaxDeferReentrancyDepth=40 \
--lua.globals=__DEV__=true --lua.globals=__COMPAT_WARNINGS__=true
fi
Expand Down
6 changes: 3 additions & 3 deletions bin/upstream-tag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ target_folder:
fi

count=0
for file in $(find * -name "*.lua")
for file in $(find * -name "*.luau")
do
if [[ "$file" == *"roblox-jest"* ]] || [[ "$file" == *"roblox-js-polyfill"* ]]; then
echo "SKIP: $file is Roblox-only"
continue
fi

if [[ "$file" == *".roblox."*"lua" ]]; then
if [[ "$file" == *".roblox."*"luau" ]]; then
echo "SKIP: $file is Roblox-only"
continue
fi
Expand All @@ -40,7 +40,7 @@ do

targetFileName="${file/-internal.spec/-test.internal}"
targetFileName="${targetFileName/.spec/-test}"
targetFileName="${targetFileName/.lua/.js}"
targetFileName="${targetFileName/.luau/.js}"
targetFile="$EQUIVALENT_FOLDER/$targetFileName"

if [[ ! -f "$REACT_PATH/$targetFile" ]]; then
Expand Down
32 changes: 16 additions & 16 deletions js-to-lua.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = {
repo: "react-lua",
primaryBranch: "main",
patterns: [
"**/*.lua"
"**/*.luau"
],
ignorePatterns: [
"Packages/**/*"
Expand All @@ -31,46 +31,46 @@ module.exports = {

],
[
(filename) => filename.includes("modules/react/src/ReactSharedInternals.lua"),
(filename) => filename.replace("modules/react/src/ReactSharedInternals.lua", "modules/shared/src/ReactSharedInternals/init.lua")
(filename) => filename.includes("modules/react/src/ReactSharedInternals.luau"),
(filename) => filename.replace("modules/react/src/ReactSharedInternals.luau", "modules/shared/src/ReactSharedInternals/init.luau")
],
[
(filename) => filename.includes("modules/react/src/ReactCurrentDispatcher.lua") || filename.includes("modules/react/src/ReactCurrentBatchConfig.lua") || filename.includes("modules/react/src/ReactCurrentActQueue.lua") || filename.includes("modules/react/src/ReactCurrentOwner.lua") || filename.includes("modules/react/src/ReactDebugCurrentFrame.lua"),
(filename) => filename.includes("modules/react/src/ReactCurrentDispatcher.luau") || filename.includes("modules/react/src/ReactCurrentBatchConfig.luau") || filename.includes("modules/react/src/ReactCurrentActQueue.luau") || filename.includes("modules/react/src/ReactCurrentOwner.luau") || filename.includes("modules/react/src/ReactDebugCurrentFrame.luau"),
(filename) => filename.replace("modules/react/src/", "modules/shared/src/ReactSharedInternals/")
],
[
(filename) => filename.includes("modules/react-reconciler/src/ReactFiberHostConfigWithNoHydration.lua"),
(filename) => filename.replace("modules/react-reconciler/src/ReactFiberHostConfigWithNoHydration.lua", "modules/shared/src/ReactFiberHostConfig/WithNoHydration.lua")
(filename) => filename.includes("modules/react-reconciler/src/ReactFiberHostConfigWithNoHydration.luau"),
(filename) => filename.replace("modules/react-reconciler/src/ReactFiberHostConfigWithNoHydration.luau", "modules/shared/src/ReactFiberHostConfig/WithNoHydration.luau")
],
[
(filename) => filename.includes("modules/react-reconciler/src/ReactFiberHostConfigWithNoPersistence.lua"),
(filename) => filename.replace("modules/react-reconciler/src/ReactFiberHostConfigWithNoPersistence.lua", "modules/shared/src/ReactFiberHostConfig/WithNoPersistence.lua")
(filename) => filename.includes("modules/react-reconciler/src/ReactFiberHostConfigWithNoPersistence.luau"),
(filename) => filename.replace("modules/react-reconciler/src/ReactFiberHostConfigWithNoPersistence.luau", "modules/shared/src/ReactFiberHostConfig/WithNoPersistence.luau")
],
[
(filename) => filename.includes("modules/react-reconciler/src/ReactFiberHostConfigWithNoTestSelectors.lua"),
(filename) => filename.replace("modules/react-reconciler/src/ReactFiberHostConfigWithNoTestSelectors.lua", "modules/shared/src/ReactFiberHostConfig/WithNoTestSelectors.lua")
(filename) => filename.includes("modules/react-reconciler/src/ReactFiberHostConfigWithNoTestSelectors.luau"),
(filename) => filename.replace("modules/react-reconciler/src/ReactFiberHostConfigWithNoTestSelectors.luau", "modules/shared/src/ReactFiberHostConfig/WithNoTestSelectors.luau")
],
[
(filename) => filename.includes("__tests__/") && !filename.includes("src/__tests__/") && !filename.includes("PropMarkers/__tests__/") && !filename.includes("client/__tests__/"),
(filename) => filename.replace("__tests__/", "src/__tests__/")
],
[
(filename) => filename.endsWith("-test.lua"),
(filename) => filename.replace("-test.lua", ".spec.lua")
(filename) => filename.endsWith("-test.luau"),
(filename) => filename.replace("-test.luau", ".spec.luau")

],
[
(filename) => filename.endsWith("-test.internal.lua"),
(filename) => filename.replace("-test.internal.lua", "-internal.spec.lua")
(filename) => filename.endsWith("-test.internal.luau"),
(filename) => filename.replace("-test.internal.luau", "-internal.spec.luau")

],
[
(filename) => filename.includes("scripts/jest/matchers"),
(filename) => filename.replace("scripts/jest/matchers", "WorkspaceStatic/jest/matchers")
],
[
(filename) => filename.endsWith("fixtures/legacy-jsx-runtimes/setupTests.lua"),
(filename) => filename.replace("fixtures/legacy-jsx-runtimes/setupTests.lua", "WorkspaceStatic/jest/matchers/createConsoleMatcher.lua")
(filename) => filename.endsWith("fixtures/legacy-jsx-runtimes/setupTests.luau"),
(filename) => filename.replace("fixtures/legacy-jsx-runtimes/setupTests.luau", "WorkspaceStatic/jest/matchers/createConsoleMatcher.luau")
],
],
}
8 changes: 4 additions & 4 deletions modules/jest-react/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ rotriever.toml
.luaurc
default.project.json

/globalTypes.d.lua
/globalTypes.d.luau
**/sourcemap.json
**/*.project.json

**/__tests__
**/*.test.lua
**/*.spec.lua
**/jest.config.lua
**/*.test.luau
**/*.spec.luau
**/jest.config.luau

**/*.rbxl
**/*.rbxlx
Expand Down
8 changes: 4 additions & 4 deletions modules/react-cache/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ rotriever.toml
.luaurc
default.project.json

/globalTypes.d.lua
/globalTypes.d.luau
**/sourcemap.json
**/*.project.json

**/__tests__
**/*.test.lua
**/*.spec.lua
**/jest.config.lua
**/*.test.luau
**/*.spec.luau
**/jest.config.luau

**/*.rbxl
**/*.rbxlx
Expand Down
2 changes: 1 addition & 1 deletion modules/react-cache/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"directory": "modules/react-cache"
},
"license": "MIT",
"main": "src/init.lua",
"main": "src/init.luau",
"scripts": {
"prepare": "npmluau"
},
Expand Down
8 changes: 4 additions & 4 deletions modules/react-debug-tools/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ rotriever.toml
.luaurc
default.project.json

/globalTypes.d.lua
/globalTypes.d.luau
**/sourcemap.json
**/*.project.json

**/__tests__
**/*.test.lua
**/*.spec.lua
**/jest.config.lua
**/*.test.luau
**/*.spec.luau
**/jest.config.luau

**/*.rbxl
**/*.rbxlx
Expand Down
2 changes: 1 addition & 1 deletion modules/react-debug-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"directory": "modules/react-debug-tools"
},
"license": "MIT",
"main": "src/init.lua",
"main": "src/init.luau",
"scripts": {
"prepare": "npmluau"
},
Expand Down
8 changes: 4 additions & 4 deletions modules/react-devtools-extensions/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ rotriever.toml
.luaurc
default.project.json

/globalTypes.d.lua
/globalTypes.d.luau
**/sourcemap.json
**/*.project.json

**/__tests__
**/*.test.lua
**/*.spec.lua
**/jest.config.lua
**/*.test.luau
**/*.spec.luau
**/jest.config.luau

**/*.rbxl
**/*.rbxlx
Expand Down
2 changes: 1 addition & 1 deletion modules/react-devtools-extensions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"directory": "modules/react-devtools-extensions"
},
"license": "MIT",
"main": "src/init.lua",
"main": "src/init.luau",
"scripts": {
"prepare": "npmluau"
},
Expand Down
8 changes: 4 additions & 4 deletions modules/react-devtools-shared/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ rotriever.toml
.luaurc
default.project.json

/globalTypes.d.lua
/globalTypes.d.luau
**/sourcemap.json
**/*.project.json

**/__tests__
**/*.test.lua
**/*.spec.lua
**/jest.config.lua
**/*.test.luau
**/*.spec.luau
**/jest.config.luau

**/*.rbxl
**/*.rbxlx
Expand Down
2 changes: 1 addition & 1 deletion modules/react-devtools-shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"directory": "modules/react-devtools-shared"
},
"license": "MIT",
"main": "src/init.lua",
"main": "src/init.luau",
"scripts": {
"prepare": "npmluau"
},
Expand Down
Loading
Loading