├── example ├── src │ ├── .gitkeep │ └── client │ │ └── init.client.lua ├── selene.toml ├── .gitignore ├── example.rbxl ├── wally.toml ├── README.md └── default.project.json ├── .gitignore ├── selene.toml ├── extractor ├── selene.toml ├── .gitignore ├── src │ ├── lib.rs │ ├── sources │ │ ├── common │ │ │ ├── mod.rs │ │ │ └── source_utils.rs │ │ └── mod.rs │ ├── main.rs │ └── constants.rs ├── README.md ├── Cargo.toml └── resources │ └── sourceReplacements │ └── getJestMatchers.roblox.lua ├── modules ├── Math │ ├── default.project.json │ ├── src │ │ ├── .robloxrc │ │ ├── clz32.lua │ │ └── init.lua │ └── wally.toml ├── Boolean │ ├── default.project.json │ ├── src │ │ ├── .robloxrc │ │ ├── init.lua │ │ └── toJSBoolean.lua │ └── wally.toml ├── Console │ ├── default.project.json │ ├── src │ │ ├── .robloxrc │ │ └── init.lua │ └── wally.toml ├── Number │ ├── default.project.json │ ├── src │ │ ├── .robloxrc │ │ ├── isFinite.lua │ │ ├── MAX_SAFE_INTEGER.lua │ │ ├── MIN_SAFE_INTEGER.lua │ │ ├── isNaN.lua │ │ ├── isInteger.lua │ │ ├── isSafeInteger.lua │ │ ├── init.lua │ │ └── toExponential.lua │ └── wally.toml ├── String │ ├── default.project.json │ ├── src │ │ ├── .robloxrc │ │ ├── trimEnd.lua │ │ ├── trimStart.lua │ │ ├── trim.lua │ │ ├── substr.lua │ │ ├── endsWith.lua │ │ ├── startsWith.lua │ │ ├── init.lua │ │ ├── charCodeAt.lua │ │ ├── includes.lua │ │ ├── indexOf.lua │ │ ├── slice.lua │ │ ├── lastIndexOf.lua │ │ └── findOr.lua │ └── wally.toml ├── Symbol │ ├── default.project.json │ ├── src │ │ ├── .robloxrc │ │ ├── GlobalRegistry.lua │ │ ├── init.lua │ │ └── Symbol.lua │ └── wally.toml ├── Timers │ ├── default.project.json │ ├── src │ │ ├── .robloxrc │ │ ├── init.lua │ │ ├── makeTimerImpl.lua │ │ └── makeIntervalImpl.lua │ └── wally.toml ├── ES7Types │ ├── default.project.json │ └── wally.toml ├── InstanceOf │ ├── default.project.json │ ├── src │ │ ├── .robloxrc │ │ ├── init.lua │ │ └── instanceof.lua │ └── wally.toml ├── Collections │ ├── default.project.json │ ├── src │ │ ├── .robloxrc │ │ ├── Map │ │ │ ├── init.lua │ │ │ ├── coerceToMap.lua │ │ │ └── coerceToTable.lua │ │ ├── init.lua │ │ ├── Object │ │ │ ├── None.lua │ │ │ ├── is.lua │ │ │ ├── seal.lua │ │ │ ├── freeze.lua │ │ │ ├── isFrozen.lua │ │ │ ├── init.lua │ │ │ ├── preventExtensions.lua │ │ │ ├── keys.lua │ │ │ ├── values.lua │ │ │ └── entries.lua │ │ ├── Array │ │ │ ├── includes.lua │ │ │ ├── reverse.lua │ │ │ ├── findIndex.lua │ │ │ ├── find.lua │ │ │ ├── shift.lua │ │ │ ├── join.lua │ │ │ ├── isArray.lua │ │ │ ├── unshift.lua │ │ │ ├── init.lua │ │ │ ├── from │ │ │ │ ├── fromSet.lua │ │ │ │ ├── fromMap.lua │ │ │ │ ├── fromArray.lua │ │ │ │ ├── fromString.lua │ │ │ │ └── init.lua │ │ │ ├── indexOf.lua │ │ │ ├── slice.lua │ │ │ ├── some.lua │ │ │ ├── sort.lua │ │ │ ├── forEach.lua │ │ │ ├── reduce.lua │ │ │ ├── every.lua │ │ │ ├── map.lua │ │ │ ├── filter.lua │ │ │ ├── concat.lua │ │ │ └── splice.lua │ │ └── WeakMap.lua │ └── wally.toml ├── React-9c8468d8-8a7220fd │ ├── default.project.json │ ├── wally.toml │ └── src │ │ ├── None.roblox.lua │ │ ├── ReactMutableSource.lua │ │ └── ReactCreateRef.lua ├── Shared-9c8468d8-8a7220fd │ ├── default.project.json │ ├── wally.toml │ └── src │ │ ├── ReactVersion.lua │ │ ├── enqueueTask.roblox.lua │ │ ├── ExecutionEnvironment.lua │ │ ├── ReactSharedInternals │ │ ├── IsSomeRendererActing.lua │ │ ├── ReactCurrentBatchConfig.lua │ │ ├── ReactCurrentOwner.lua │ │ └── ReactDebugCurrentFrame.lua │ │ ├── objectIs.lua │ │ ├── PropMarkers │ │ ├── Tag.lua │ │ ├── Event.lua │ │ └── Change.lua │ │ ├── ReactFiberHostConfig │ │ ├── WithNoTestSelectors.lua │ │ ├── WithNoPersistence.lua │ │ ├── init.lua │ │ └── WithNoHydration.lua │ │ ├── formatProdErrorMessage.lua │ │ ├── invariant.lua │ │ ├── shallowEqual.lua │ │ ├── Symbol.roblox.lua │ │ ├── console.lua │ │ ├── Type.roblox.lua │ │ ├── UninitializedState.roblox.lua │ │ ├── ReactElementType.lua │ │ └── consoleWithStackDev.lua ├── Scheduler-9c8468d8-8a7220fd │ ├── default.project.json │ ├── wally.toml │ └── src │ │ ├── SchedulerFeatureFlags.lua │ │ ├── SchedulerPriorities.lua │ │ ├── SchedulerHostConfig.lua │ │ ├── getJestMatchers.roblox.lua │ │ └── unstable_mock.lua ├── LuauPolyfill-2fca3173-1.1.0 │ ├── default.project.json │ ├── src │ │ ├── .robloxrc │ │ ├── Error │ │ │ └── .robloxrc │ │ ├── AssertionError │ │ │ └── init.lua │ │ ├── Promise.lua │ │ ├── extends.lua │ │ └── encodeURIComponent.lua │ └── wally.toml ├── ReactRoblox-9c8468d8-8a7220fd │ ├── default.project.json │ ├── src │ │ ├── ReactReconciler.roblox.lua │ │ └── init.lua │ └── wally.toml ├── RoactCompat-9c8468d8-8a7220fd │ ├── default.project.json │ ├── wally.toml │ └── src │ │ ├── createFragment.lua │ │ ├── Portal.lua │ │ ├── warnOnce.lua │ │ ├── setGlobalConfig.lua │ │ └── oneChild.lua └── ReactReconciler-9c8468d8-8a7220fd │ ├── default.project.json │ ├── src │ ├── forks │ │ └── ReactFiberHostConfig.test.lua │ ├── ReactFiberReconciler.lua │ ├── ReactRootTags.lua │ ├── MaxInts.lua │ ├── ReactHookEffectTags.lua │ ├── ReactTypeOfMode.lua │ ├── ReactFiberTransition.lua │ ├── ReactFiberErrorDialog.lua │ ├── ReactCapturedValue.lua │ ├── ReactPortal.lua │ ├── ReactFiberSchedulerPriorities.roblox.lua │ ├── ReactWorkTags.lua │ ├── ReactFiberLazyComponent.new.lua │ ├── init.lua │ ├── ReactFiberWorkInProgress.lua │ ├── ReactFiberOffscreenComponent.lua │ └── ReactFiberHostConfig.lua │ └── wally.toml ├── aftman.toml ├── tools └── publish.sh └── CHANGELOG.md /example/src/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /example/selene.toml: -------------------------------------------------------------------------------- 1 | std = "roblox" 2 | -------------------------------------------------------------------------------- /selene.toml: -------------------------------------------------------------------------------- 1 | std = "roblox+remodel" 2 | -------------------------------------------------------------------------------- /extractor/selene.toml: -------------------------------------------------------------------------------- 1 | std = "roblox" 2 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | Packages/ 2 | 3 | *.rbxl.lock 4 | -------------------------------------------------------------------------------- /extractor/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /extractor/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod constants; 2 | pub mod domain; 3 | pub mod sources; 4 | -------------------------------------------------------------------------------- /example/example.rbxl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsdotlua/CorePackages/HEAD/example/example.rbxl -------------------------------------------------------------------------------- /modules/Math/default.project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "math", 3 | "tree": { 4 | "$path": "src/" 5 | } 6 | } -------------------------------------------------------------------------------- /modules/Boolean/default.project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "boolean", 3 | "tree": { 4 | "$path": "src/" 5 | } 6 | } -------------------------------------------------------------------------------- /modules/Console/default.project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "console", 3 | "tree": { 4 | "$path": "src/" 5 | } 6 | } -------------------------------------------------------------------------------- /modules/Number/default.project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "number", 3 | "tree": { 4 | "$path": "src/" 5 | } 6 | } -------------------------------------------------------------------------------- /modules/String/default.project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "string", 3 | "tree": { 4 | "$path": "src/" 5 | } 6 | } -------------------------------------------------------------------------------- /modules/Symbol/default.project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "symbol", 3 | "tree": { 4 | "$path": "src/" 5 | } 6 | } -------------------------------------------------------------------------------- /modules/Timers/default.project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "timers", 3 | "tree": { 4 | "$path": "src/" 5 | } 6 | } -------------------------------------------------------------------------------- /modules/ES7Types/default.project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "es-7-types", 3 | "tree": { 4 | "$path": "src/" 5 | } 6 | } -------------------------------------------------------------------------------- /modules/InstanceOf/default.project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "instance-of", 3 | "tree": { 4 | "$path": "src/" 5 | } 6 | } -------------------------------------------------------------------------------- /modules/Collections/default.project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "collections", 3 | "tree": { 4 | "$path": "src/" 5 | } 6 | } -------------------------------------------------------------------------------- /modules/Math/src/.robloxrc: -------------------------------------------------------------------------------- 1 | { 2 | "language": { 3 | "mode": "strict" 4 | }, 5 | "lint": { 6 | "*": "enabled" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /modules/Number/src/.robloxrc: -------------------------------------------------------------------------------- 1 | { 2 | "language": { 3 | "mode": "strict" 4 | }, 5 | "lint": { 6 | "*": "enabled" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /modules/React-9c8468d8-8a7220fd/default.project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react", 3 | "tree": { 4 | "$path": "src/" 5 | } 6 | } -------------------------------------------------------------------------------- /modules/Shared-9c8468d8-8a7220fd/default.project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "shared", 3 | "tree": { 4 | "$path": "src/" 5 | } 6 | } -------------------------------------------------------------------------------- /modules/String/src/.robloxrc: -------------------------------------------------------------------------------- 1 | { 2 | "language": { 3 | "mode": "strict" 4 | }, 5 | "lint": { 6 | "*": "enabled" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /modules/Symbol/src/.robloxrc: -------------------------------------------------------------------------------- 1 | { 2 | "language": { 3 | "mode": "strict" 4 | }, 5 | "lint": { 6 | "*": "enabled" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /modules/Timers/src/.robloxrc: -------------------------------------------------------------------------------- 1 | { 2 | "language": { 3 | "mode": "strict" 4 | }, 5 | "lint": { 6 | "*": "enabled" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /modules/Boolean/src/.robloxrc: -------------------------------------------------------------------------------- 1 | { 2 | "language": { 3 | "mode": "strict" 4 | }, 5 | "lint": { 6 | "*": "enabled" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /modules/Collections/src/.robloxrc: -------------------------------------------------------------------------------- 1 | { 2 | "language": { 3 | "mode": "strict" 4 | }, 5 | "lint": { 6 | "*": "enabled" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /modules/Console/src/.robloxrc: -------------------------------------------------------------------------------- 1 | { 2 | "language": { 3 | "mode": "strict" 4 | }, 5 | "lint": { 6 | "*": "enabled" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /modules/InstanceOf/src/.robloxrc: -------------------------------------------------------------------------------- 1 | { 2 | "language": { 3 | "mode": "strict" 4 | }, 5 | "lint": { 6 | "*": "enabled" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /modules/Scheduler-9c8468d8-8a7220fd/default.project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "scheduler", 3 | "tree": { 4 | "$path": "src/" 5 | } 6 | } -------------------------------------------------------------------------------- /extractor/README.md: -------------------------------------------------------------------------------- 1 | # Roact17 Extractor 2 | 3 | Automatically extracts Roact17 from a built-in plugin. 4 | 5 | TODO: Write more info. 6 | -------------------------------------------------------------------------------- /modules/LuauPolyfill-2fca3173-1.1.0/default.project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "luau-polyfill", 3 | "tree": { 4 | "$path": "src/" 5 | } 6 | } -------------------------------------------------------------------------------- /modules/ReactRoblox-9c8468d8-8a7220fd/default.project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-roblox", 3 | "tree": { 4 | "$path": "src/" 5 | } 6 | } -------------------------------------------------------------------------------- /modules/RoactCompat-9c8468d8-8a7220fd/default.project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "roact-compat", 3 | "tree": { 4 | "$path": "src/" 5 | } 6 | } -------------------------------------------------------------------------------- /modules/ReactReconciler-9c8468d8-8a7220fd/default.project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-reconciler", 3 | "tree": { 4 | "$path": "src/" 5 | } 6 | } -------------------------------------------------------------------------------- /modules/LuauPolyfill-2fca3173-1.1.0/src/.robloxrc: -------------------------------------------------------------------------------- 1 | { 2 | "language": { 3 | "mode": "nonstrict" 4 | }, 5 | "lint": { 6 | "*": "enabled" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /aftman.toml: -------------------------------------------------------------------------------- 1 | [tools] 2 | rojo = "Roblox/rojo@7.2.1" 3 | wally = "UpliftGames/wally@0.3.1" 4 | wally-package-types = "JohnnyMorganz/wally-package-types@1.1.1" 5 | -------------------------------------------------------------------------------- /modules/LuauPolyfill-2fca3173-1.1.0/src/Error/.robloxrc: -------------------------------------------------------------------------------- 1 | { 2 | "language": { 3 | "mode": "strict" 4 | }, 5 | "lint": { 6 | "*": "enabled" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /modules/Math/src/clz32.lua: -------------------------------------------------------------------------------- 1 | -- NOTE: This file is too small and/or simple to be sufficiently rewritten under a new license. Assume MIT. 2 | return bit32.countlz 3 | -------------------------------------------------------------------------------- /tools/publish.sh: -------------------------------------------------------------------------------- 1 | for f in modules/*; do 2 | if [ -d "$f" ]; then 3 | echo "$f" 4 | 5 | wally publish --project-path "$f" 6 | fi 7 | done 8 | -------------------------------------------------------------------------------- /modules/InstanceOf/src/init.lua: -------------------------------------------------------------------------------- 1 | -- NOTE: This file is too small and/or simple to be sufficiently rewritten under a new license. Assume MIT. 2 | local instanceof = require(script.instanceof) 3 | 4 | return instanceof 5 | -------------------------------------------------------------------------------- /example/wally.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "brooke/example" 3 | version = "0.1.0" 4 | registry = "https://github.com/UpliftGames/wally-index" 5 | realm = "shared" 6 | 7 | [dependencies] 8 | Roact = "core-packages/roact-compat@17.0.1-rc.16.1" 9 | -------------------------------------------------------------------------------- /extractor/src/sources/common/mod.rs: -------------------------------------------------------------------------------- 1 | //! Contains common logic between all CorePackage sources. 2 | 3 | pub mod output; 4 | mod package_registry; 5 | pub mod package_resolution; 6 | pub mod source_utils; 7 | pub mod thunk_parser; 8 | 9 | pub use package_registry::PackageRegistry; 10 | -------------------------------------------------------------------------------- /modules/Math/wally.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = 'core-packages/math' 3 | description = 'https://github.com/grilme99/CorePackages' 4 | version = '1.1.0' 5 | license = 'MIT' 6 | authors = ['Roblox Corporation'] 7 | registry = 'https://github.com/UpliftGames/wally-index' 8 | realm = 'shared' 9 | 10 | [dependencies] 11 | -------------------------------------------------------------------------------- /modules/Number/wally.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = 'core-packages/number' 3 | description = 'https://github.com/grilme99/CorePackages' 4 | version = '1.1.0' 5 | license = 'MIT' 6 | authors = ['Roblox Corporation'] 7 | registry = 'https://github.com/UpliftGames/wally-index' 8 | realm = 'shared' 9 | 10 | [dependencies] 11 | -------------------------------------------------------------------------------- /modules/Symbol/wally.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = 'core-packages/symbol' 3 | description = 'https://github.com/grilme99/CorePackages' 4 | version = '1.1.0' 5 | license = 'MIT' 6 | authors = ['Roblox Corporation'] 7 | registry = 'https://github.com/UpliftGames/wally-index' 8 | realm = 'shared' 9 | 10 | [dependencies] 11 | -------------------------------------------------------------------------------- /modules/ES7Types/wally.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = 'core-packages/es-7-types' 3 | description = 'https://github.com/grilme99/CorePackages' 4 | version = '1.1.0' 5 | license = 'MIT' 6 | authors = ['Roblox Corporation'] 7 | registry = 'https://github.com/UpliftGames/wally-index' 8 | realm = 'shared' 9 | 10 | [dependencies] 11 | -------------------------------------------------------------------------------- /modules/InstanceOf/wally.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = 'core-packages/instance-of' 3 | description = 'https://github.com/grilme99/CorePackages' 4 | version = '1.1.0' 5 | license = 'MIT' 6 | authors = ['Roblox Corporation'] 7 | registry = 'https://github.com/UpliftGames/wally-index' 8 | realm = 'shared' 9 | 10 | [dependencies] 11 | -------------------------------------------------------------------------------- /modules/Boolean/wally.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = 'core-packages/boolean' 3 | description = 'https://github.com/grilme99/CorePackages' 4 | version = '1.1.0' 5 | license = 'MIT' 6 | authors = ['Roblox Corporation'] 7 | registry = 'https://github.com/UpliftGames/wally-index' 8 | realm = 'shared' 9 | 10 | [dependencies] 11 | Number = 'core-packages/number@1.1.0' 12 | -------------------------------------------------------------------------------- /modules/Timers/wally.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = 'core-packages/timers' 3 | description = 'https://github.com/grilme99/CorePackages' 4 | version = '1.1.0' 5 | license = 'MIT' 6 | authors = ['Roblox Corporation'] 7 | registry = 'https://github.com/UpliftGames/wally-index' 8 | realm = 'shared' 9 | 10 | [dependencies] 11 | Collections = 'core-packages/collections@1.1.0' 12 | -------------------------------------------------------------------------------- /modules/Console/wally.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = 'core-packages/console' 3 | description = 'https://github.com/grilme99/CorePackages' 4 | version = '1.1.0' 5 | license = 'MIT' 6 | authors = ['Roblox Corporation'] 7 | registry = 'https://github.com/UpliftGames/wally-index' 8 | realm = 'shared' 9 | 10 | [dependencies] 11 | Collections = 'core-packages/collections@1.1.0' 12 | -------------------------------------------------------------------------------- /modules/Shared-9c8468d8-8a7220fd/wally.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = 'core-packages/shared' 3 | description = 'https://github.com/grilme99/CorePackages' 4 | version = '17.0.1-rc.16' 5 | license = 'MIT' 6 | authors = ['Roblox Corporation'] 7 | registry = 'https://github.com/UpliftGames/wally-index' 8 | realm = 'shared' 9 | 10 | [dependencies] 11 | LuauPolyfill = 'core-packages/luau-polyfill@1.1.0' 12 | -------------------------------------------------------------------------------- /modules/String/wally.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = 'core-packages/string' 3 | description = 'https://github.com/grilme99/CorePackages' 4 | version = '1.1.0' 5 | license = 'MIT' 6 | authors = ['Roblox Corporation'] 7 | registry = 'https://github.com/UpliftGames/wally-index' 8 | realm = 'shared' 9 | 10 | [dependencies] 11 | ES7Types = 'core-packages/es-7-types@1.1.0' 12 | Number = 'core-packages/number@1.1.0' 13 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # example 2 | Generated by [Rojo](https://github.com/rojo-rbx/rojo) 7.2.1. 3 | 4 | ## Getting Started 5 | To build the place from scratch, use: 6 | 7 | ```bash 8 | rojo build -o "example.rbxlx" 9 | ``` 10 | 11 | Next, open `example.rbxlx` in Roblox Studio and start the Rojo server: 12 | 13 | ```bash 14 | rojo serve 15 | ``` 16 | 17 | For more help, check out [the Rojo documentation](https://rojo.space/docs). -------------------------------------------------------------------------------- /modules/Collections/wally.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = 'core-packages/collections' 3 | description = 'https://github.com/grilme99/CorePackages' 4 | version = '1.1.0' 5 | license = 'MIT' 6 | authors = ['Roblox Corporation'] 7 | registry = 'https://github.com/UpliftGames/wally-index' 8 | realm = 'shared' 9 | 10 | [dependencies] 11 | ES7Types = 'core-packages/es-7-types@1.1.0' 12 | InstanceOf = 'core-packages/instance-of@1.1.0' 13 | -------------------------------------------------------------------------------- /modules/Scheduler-9c8468d8-8a7220fd/wally.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = 'core-packages/scheduler' 3 | description = 'https://github.com/grilme99/CorePackages' 4 | version = '17.0.1-rc.16' 5 | license = 'MIT' 6 | authors = ['Roblox Corporation'] 7 | registry = 'https://github.com/UpliftGames/wally-index' 8 | realm = 'shared' 9 | 10 | [dependencies] 11 | LuauPolyfill = 'core-packages/luau-polyfill@1.1.0' 12 | Shared = 'core-packages/shared@17.0.1-rc.16' 13 | -------------------------------------------------------------------------------- /modules/React-9c8468d8-8a7220fd/wally.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = 'core-packages/react' 3 | description = 'https://github.com/grilme99/CorePackages' 4 | version = '17.0.1-rc.16' 5 | license = 'MIT + Apache 2.0' 6 | authors = ['Roblox Corporation'] 7 | registry = 'https://github.com/UpliftGames/wally-index' 8 | realm = 'shared' 9 | 10 | [dependencies] 11 | Cryo = 'freddylist/llama@1.1.1' 12 | LuauPolyfill = 'core-packages/luau-polyfill@1.1.0' 13 | Shared = 'core-packages/shared@17.0.1-rc.16' 14 | -------------------------------------------------------------------------------- /modules/Shared-9c8468d8-8a7220fd/src/ReactVersion.lua: -------------------------------------------------------------------------------- 1 | -- upstream: https://github.com/facebook/react/blob/a89854bc936668d325cac9a22e2ebfa128c7addf/packages/shared/ReactVersion.js 2 | --!strict 3 | --[[* 4 | * Copyright (c) Facebook, Inc. and its affiliates. 5 | * 6 | * This source code is licensed under the MIT license found in the 7 | * LICENSE file in the root directory of this source tree. 8 | ]] 9 | 10 | -- TODO: this is special because it gets imported during build. 11 | return "17.0.1" 12 | -------------------------------------------------------------------------------- /modules/Collections/src/Map/init.lua: -------------------------------------------------------------------------------- 1 | -- NOTE: This file is too small and/or simple to be sufficiently rewritten under a new license. Assume MIT. 2 | local Packages = script.Parent.Parent 3 | 4 | local ES7Types = require(Packages.ES7Types) 5 | 6 | local Map = require(script.Map) 7 | local coerceToMap = require(script.coerceToMap) 8 | local coerceToTable = require(script.coerceToTable) 9 | 10 | export type Map = ES7Types.Map 11 | 12 | return { 13 | Map = Map, 14 | coerceToMap = coerceToMap, 15 | coerceToTable = coerceToTable, 16 | } 17 | -------------------------------------------------------------------------------- /modules/Scheduler-9c8468d8-8a7220fd/src/SchedulerFeatureFlags.lua: -------------------------------------------------------------------------------- 1 | --!strict 2 | -- upstream https://github.com/facebook/react/blob/9abc2785cb070148d64fae81e523246b90b92016/packages/scheduler/src/SchedulerFeatureFlags.js 3 | --[[* 4 | * Copyright (c) Facebook, Inc. and its affiliates. 5 | * 6 | * This source code is licensed under the MIT license found in the 7 | * LICENSE file in the root directory of this source tree. 8 | * 9 | ]] 10 | 11 | return { 12 | enableSchedulerDebugging = false, 13 | enableIsInputPending = false, 14 | enableProfiling = _G.__PROFILE__, 15 | } 16 | -------------------------------------------------------------------------------- /modules/ReactRoblox-9c8468d8-8a7220fd/src/ReactReconciler.roblox.lua: -------------------------------------------------------------------------------- 1 | -- NOTE: This file is too small and/or simple to be sufficiently rewritten under a new license. Assume MIT. 2 | --!strict 3 | -- ROBLOX deviation: Initializes the reconciler with this package's host 4 | -- config and returns the resulting module 5 | 6 | local Packages = script.Parent.Parent 7 | local initializeReconciler = require(Packages.ReactReconciler) 8 | 9 | local ReactRobloxHostConfig = require(script.Parent.client.ReactRobloxHostConfig) 10 | 11 | return initializeReconciler(ReactRobloxHostConfig) 12 | -------------------------------------------------------------------------------- /modules/RoactCompat-9c8468d8-8a7220fd/wally.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = 'core-packages/roact-compat' 3 | description = 'https://github.com/grilme99/CorePackages' 4 | version = '17.0.1-rc.16.1' 5 | license = 'MIT + Apache 2.0' 6 | authors = ['Roblox Corporation'] 7 | registry = 'https://github.com/UpliftGames/wally-index' 8 | realm = 'shared' 9 | 10 | [dependencies] 11 | LuauPolyfill = 'core-packages/luau-polyfill@1.1.0' 12 | React = 'core-packages/react@17.0.1-rc.16' 13 | ReactRoblox = 'core-packages/react-roblox@17.0.1-rc.16' 14 | Shared = 'core-packages/shared@17.0.1-rc.16' 15 | -------------------------------------------------------------------------------- /modules/ReactReconciler-9c8468d8-8a7220fd/src/forks/ReactFiberHostConfig.test.lua: -------------------------------------------------------------------------------- 1 | -- upstream: https://github.com/facebook/react/blob/b87aabdfe1b7461e7331abb3601d9e6bb27544bc/packages/react-reconciler/src/forks/ReactFiberHostConfig.test.js 2 | --[[* 3 | * Copyright (c) Facebook, Inc. and its affiliates. 4 | * 5 | * This source code is licensed under the MIT license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | * 8 | * @flow 9 | ]] 10 | 11 | local Packages = script.Parent.Parent.Parent 12 | 13 | return require(Packages.Dev.ReactTestRenderer) 14 | -------------------------------------------------------------------------------- /modules/ReactReconciler-9c8468d8-8a7220fd/src/ReactFiberReconciler.lua: -------------------------------------------------------------------------------- 1 | --!strict 2 | -- ROBLOX upstream: https://github.com/facebook/react/blob/faa697f4f9afe9f1c98e315b2a9e70f5a74a7a74/packages/react-reconciler/src/ReactFiberReconciler.js 3 | --[[* 4 | * Copyright (c) Facebook, Inc. and its affiliates. 5 | * 6 | * This source code is licensed under the MIT license found in the 7 | * LICENSE file in the root directory of this source tree. 8 | * 9 | * @flow 10 | ]] 11 | 12 | -- deviation: old version of reconciler not ported 13 | return require(script.Parent["ReactFiberReconciler.new"]) 14 | -------------------------------------------------------------------------------- /modules/ReactReconciler-9c8468d8-8a7220fd/src/ReactRootTags.lua: -------------------------------------------------------------------------------- 1 | -- upstream: https://github.com/facebook/react/blob/c5d2fc7127654e43de59fff865b74765a103c4a5/packages/react-reconciler/src/ReactRootTags.js 2 | --!strict 3 | --[[* 4 | * Copyright (c) Facebook, Inc. and its affiliates. 5 | * 6 | * This source code is licensed under the MIT license found in the 7 | * LICENSE file in the root directory of this source tree. 8 | * 9 | * @flow 10 | ]] 11 | 12 | export type RootTag = number 13 | 14 | return { 15 | LegacyRoot = 0, 16 | BlockingRoot = 1, 17 | ConcurrentRoot = 2, 18 | } 19 | -------------------------------------------------------------------------------- /modules/Shared-9c8468d8-8a7220fd/src/enqueueTask.roblox.lua: -------------------------------------------------------------------------------- 1 | --!strict 2 | --[[* 3 | * Copyright (c) Facebook, Inc. and its affiliates. 4 | * 5 | * This source code is licensed under the MIT license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | * 8 | * 9 | ]] 10 | local Packages = script.Parent.Parent 11 | local LuauPolyfill = require(Packages.LuauPolyfill) 12 | local setTimeout = LuauPolyfill.setTimeout 13 | 14 | return function(task) 15 | -- deviation: Replace with setImmediate once we create an equivalent polyfill 16 | return setTimeout(task, 0) 17 | end 18 | -------------------------------------------------------------------------------- /modules/ReactRoblox-9c8468d8-8a7220fd/src/init.lua: -------------------------------------------------------------------------------- 1 | --!strict 2 | -- ROBLOX upstream: https://github.com/facebook/react/blob/efd8f6442d1aa7c4566fe812cba03e7e83aaccc3/packages/react-native-renderer/index.js 3 | --[[* 4 | * Copyright (c) Facebook, Inc. and its affiliates. 5 | * 6 | * This source code is licensed under the MIT license found in the 7 | * LICENSE file in the root directory of this source tree. 8 | * 9 | * @flow 10 | ]] 11 | 12 | local HostTypes = require(script.client["ReactRobloxHostTypes.roblox"]) 13 | export type RootType = HostTypes.RootType 14 | return require(script.client.ReactRoblox) 15 | -------------------------------------------------------------------------------- /modules/Shared-9c8468d8-8a7220fd/src/ExecutionEnvironment.lua: -------------------------------------------------------------------------------- 1 | --!strict 2 | -- ROBLOX upstream: https://github.com/facebook/react/blob/55cb0b7eeb0e539d89858b8ed69beabf7fe2fb46/packages/shared/ExecutionEnvironment.js 3 | --[[* 4 | * Copyright (c) Facebook, Inc. and its affiliates. 5 | * 6 | * This source code is licensed under the MIT license found in the 7 | * LICENSE file in the root directory of this source tree. 8 | * 9 | * @flow 10 | ]] 11 | local exports = {} 12 | 13 | exports.canUseDOM = function() 14 | -- ROBLOX deviation START 15 | return false 16 | -- ROBLOX deviation END 17 | end 18 | 19 | return exports 20 | -------------------------------------------------------------------------------- /modules/ReactReconciler-9c8468d8-8a7220fd/wally.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = 'core-packages/react-reconciler' 3 | description = 'https://github.com/grilme99/CorePackages' 4 | version = '17.0.1-rc.16' 5 | license = 'MIT' 6 | authors = ['Roblox Corporation'] 7 | registry = 'https://github.com/UpliftGames/wally-index' 8 | realm = 'shared' 9 | 10 | [dependencies] 11 | Cryo = 'freddylist/llama@1.1.1' 12 | LuauPolyfill = 'core-packages/luau-polyfill@1.1.0' 13 | Promise = 'evaera/promise@4.0.0' 14 | React = 'core-packages/react@17.0.1-rc.16' 15 | Scheduler = 'core-packages/scheduler@17.0.1-rc.16' 16 | Shared = 'core-packages/shared@17.0.1-rc.16' 17 | -------------------------------------------------------------------------------- /modules/ReactRoblox-9c8468d8-8a7220fd/wally.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = 'core-packages/react-roblox' 3 | description = 'https://github.com/grilme99/CorePackages' 4 | version = '17.0.1-rc.16' 5 | license = 'MIT + Apache 2.0' 6 | authors = ['Roblox Corporation'] 7 | registry = 'https://github.com/UpliftGames/wally-index' 8 | realm = 'shared' 9 | 10 | [dependencies] 11 | LuauPolyfill = 'core-packages/luau-polyfill@1.1.0' 12 | React = 'core-packages/react@17.0.1-rc.16' 13 | ReactReconciler = 'core-packages/react-reconciler@17.0.1-rc.16' 14 | Scheduler = 'core-packages/scheduler@17.0.1-rc.16' 15 | Shared = 'core-packages/shared@17.0.1-rc.16' 16 | -------------------------------------------------------------------------------- /modules/Shared-9c8468d8-8a7220fd/src/ReactSharedInternals/IsSomeRendererActing.lua: -------------------------------------------------------------------------------- 1 | --!strict 2 | -- upstream: https://github.com/facebook/react/blob/a457e02ae3a2d3903fcf8748380b1cc293a2445e/packages/react/src/IsSomeRendererActing.js 3 | --[[* 4 | * Copyright (c) Facebook, Inc. and its affiliates. 5 | * 6 | * This source code is licensed under the MIT license found in the 7 | * LICENSE file in the root directory of this source tree. 8 | * 9 | * @flow 10 | ]] 11 | 12 | --[[* 13 | * Used by act() to track whether you're inside an act() scope. 14 | ]] 15 | 16 | local IsSomeRendererActing = { 17 | current = false, 18 | } 19 | return IsSomeRendererActing 20 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Changelog 4 | 5 | All notable changes to this project will be documented in this file. 6 | 7 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 8 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 9 | 10 | 11 | ## [Unreleased] - ReleaseDate 12 | 13 | ## [1.0.0] - 2022-11-01 14 | ### Changed 15 | - Converted the program into a CLI app 16 | ### Fixed 17 | - Dependency resolution bugs 18 | 19 | ## [0.1.0] - 2022-10-30 20 | ### Added 21 | - Initial release 22 | -------------------------------------------------------------------------------- /modules/ReactReconciler-9c8468d8-8a7220fd/src/MaxInts.lua: -------------------------------------------------------------------------------- 1 | --!strict 2 | -- upstream: https://github.com/facebook/react/blob/c5d2fc7127654e43de59fff865b74765a103c4a5/packages/react-reconciler/src/MaxInts.js 3 | -- /** 4 | -- * Copyright (c) Facebook, Inc. and its affiliates. 5 | -- * 6 | -- * This source code is licensed under the MIT license found in the 7 | -- * LICENSE file in the root directory of this source tree. 8 | -- * 9 | -- * @flow 10 | -- */ 11 | 12 | -- // Max 31 bit integer. The max integer size in V8 for 32-bit systems. 13 | -- // Math.pow(2, 30) - 1 14 | -- // 0b111111111111111111111111111111 15 | return { MAX_SIGNED_31_BIT_INT = 1073741823 } 16 | -------------------------------------------------------------------------------- /modules/Scheduler-9c8468d8-8a7220fd/src/SchedulerPriorities.lua: -------------------------------------------------------------------------------- 1 | --!strict 2 | -- upstream: https://github.com/facebook/react/blob/00748c53e183952696157088a858352cc77b0010/packages/scheduler/src/SchedulerHostConfig.js 3 | --[[* 4 | * Copyright (c) Facebook, Inc. and its affiliates. 5 | * 6 | * This source code is licensed under the MIT license found in the 7 | * LICENSE file in the root directory of this source tree. 8 | * 9 | * @flow 10 | ]] 11 | 12 | export type PriorityLevel = number 13 | 14 | -- TODO: Use symbols? 15 | return { 16 | NoPriority = 0, 17 | ImmediatePriority = 1, 18 | UserBlockingPriority = 2, 19 | NormalPriority = 3, 20 | LowPriority = 4, 21 | IdlePriority = 5, 22 | } 23 | -------------------------------------------------------------------------------- /extractor/src/sources/mod.rs: -------------------------------------------------------------------------------- 1 | mod common; 2 | mod local; 3 | 4 | use std::path::PathBuf; 5 | 6 | use serde::{Deserialize, Serialize}; 7 | 8 | pub use local::LocalPackageSource; 9 | 10 | use crate::domain::PackageName; 11 | 12 | #[derive(Debug, Deserialize, Serialize)] 13 | pub enum Source { 14 | /// Fetch CorePackages from the local studio installation. 15 | Local, 16 | // /// Fetch CorePackages from the online Client Tracker. 17 | // ClientTracker, 18 | } 19 | 20 | pub trait CorePackageSource { 21 | fn extract_packages( 22 | extract_to: &PathBuf, 23 | root_packages: &Vec, 24 | bypass_license_check: &bool, 25 | ) -> anyhow::Result<()>; 26 | } 27 | -------------------------------------------------------------------------------- /modules/Scheduler-9c8468d8-8a7220fd/src/SchedulerHostConfig.lua: -------------------------------------------------------------------------------- 1 | --!strict 2 | -- upstream: https://github.com/facebook/react/blob/00748c53e183952696157088a858352cc77b0010/packages/scheduler/src/SchedulerHostConfig.js 3 | --[[* 4 | * Copyright (c) Facebook, Inc. and its affiliates. 5 | * 6 | * This source code is licensed under the MIT license found in the 7 | * LICENSE file in the root directory of this source tree. 8 | * 9 | * @flow 10 | ]] 11 | 12 | -- deviation: In React, this module throws an error and is expected to be 13 | -- replaced via a bundler. In our case, we mock it explicitly when we need to 14 | -- mock it, and return the "default" here 15 | return require(script.Parent.forks["SchedulerHostConfig.default"]) 16 | -------------------------------------------------------------------------------- /extractor/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "extractor" 3 | version = "1.0.0" 4 | edition = "2021" 5 | 6 | [lib] 7 | name = "libextractor" 8 | path = "src/lib.rs" 9 | 10 | [dependencies] 11 | anyhow = "1.0.65" 12 | clap = { version = "4.0.18", features = ["derive"] } 13 | console = "0.15.2" 14 | convert_case = "0.6.0" 15 | derive_more = "0.99.17" 16 | full_moon = { version = "0.16.2", features = ["roblox"] } 17 | phf = { version = "0.11", features = ["macros"] } 18 | rbx_binary = "0.6.6" 19 | rbx_dom_weak = "2.4.0" 20 | roblox_install = "1.0.0" 21 | semver = { version = "1.0.14", features = ["serde"] } 22 | serde = { version = "1.0.147", features = ["derive"] } 23 | serde_json = "1.0.87" 24 | toml = "0.5.9" 25 | walkdir = "2.3.2" 26 | -------------------------------------------------------------------------------- /modules/Shared-9c8468d8-8a7220fd/src/ReactSharedInternals/ReactCurrentBatchConfig.lua: -------------------------------------------------------------------------------- 1 | --!strict 2 | -- upstream: https://github.com/facebook/react/blob/92fcd46cc79bbf45df4ce86b0678dcef3b91078d/packages/react/src/ReactCurrentBatchConfig.js 3 | --[[* 4 | * Copyright (c) Facebook, Inc. and its affiliates. 5 | * 6 | * This source code is licensed under the MIT license found in the 7 | * LICENSE file in the root directory of this source tree. 8 | * 9 | * @flow 10 | ]] 11 | 12 | --[[* 13 | * Keeps track of the current batch's configuration such as how long an update 14 | * should suspend for if it needs to. 15 | ]] 16 | local ReactCurrentBatchConfig = { 17 | transition = 0, 18 | } 19 | 20 | return ReactCurrentBatchConfig 21 | -------------------------------------------------------------------------------- /modules/Math/src/init.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | return { 17 | clz32 = require(script.clz32), 18 | } 19 | -------------------------------------------------------------------------------- /modules/Boolean/src/init.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | return { 17 | toJSBoolean = require(script.toJSBoolean), 18 | } 19 | -------------------------------------------------------------------------------- /modules/Console/src/init.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local makeConsoleImpl = require(script.makeConsoleImpl) 17 | 18 | return makeConsoleImpl() 19 | -------------------------------------------------------------------------------- /modules/LuauPolyfill-2fca3173-1.1.0/wally.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = 'core-packages/luau-polyfill' 3 | description = 'https://github.com/grilme99/CorePackages' 4 | version = '1.1.0' 5 | license = 'MIT' 6 | authors = ['Roblox Corporation'] 7 | registry = 'https://github.com/UpliftGames/wally-index' 8 | realm = 'shared' 9 | 10 | [dependencies] 11 | Boolean = 'core-packages/boolean@1.1.0' 12 | Collections = 'core-packages/collections@1.1.0' 13 | Console = 'core-packages/console@1.1.0' 14 | ES7Types = 'core-packages/es-7-types@1.1.0' 15 | InstanceOf = 'core-packages/instance-of@1.1.0' 16 | Math = 'core-packages/math@1.1.0' 17 | Number = 'core-packages/number@1.1.0' 18 | String = 'core-packages/string@1.1.0' 19 | Symbol = 'core-packages/symbol@1.1.0' 20 | Timers = 'core-packages/timers@1.1.0' 21 | -------------------------------------------------------------------------------- /modules/String/src/trimEnd.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | return function(source: string): string 17 | return (source:gsub("[%s]+$", "")) 18 | end 19 | -------------------------------------------------------------------------------- /modules/String/src/trimStart.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | return function(source: string): string 17 | return (source:gsub("^[%s]+", "")) 18 | end 19 | -------------------------------------------------------------------------------- /modules/ReactReconciler-9c8468d8-8a7220fd/src/ReactHookEffectTags.lua: -------------------------------------------------------------------------------- 1 | -- upstream: https://github.com/facebook/react/blob/16654436039dd8f16a63928e71081c7745872e8f/packages/react-reconciler/src/ReactHookEffectTags.js 2 | --!strict 3 | --[[* 4 | * Copyright (c) Facebook, Inc. and its affiliates. 5 | * 6 | * This source code is licensed under the MIT license found in the 7 | * LICENSE file in the root directory of this source tree. 8 | * 9 | * @flow 10 | ]] 11 | 12 | export type HookFlags = number 13 | 14 | return { 15 | NoFlags = --[[ ]] 0b000, 16 | 17 | -- Represents whether effect should fire. 18 | HasEffect = --[[ ]] 0b001, 19 | 20 | -- Represents the phase in which the effect (not the clean-up) fires. 21 | Layout = --[[ ]] 0b010, 22 | Passive = --[[ ]] 0b100, 23 | } 24 | -------------------------------------------------------------------------------- /modules/ReactReconciler-9c8468d8-8a7220fd/src/ReactTypeOfMode.lua: -------------------------------------------------------------------------------- 1 | -- upstream: https://github.com/facebook/react/blob/22dc2e42bdc00d87fc19c5e75fc7c0b3fdcdc572/packages/react-reconciler/src/ReactTypeOfMode.js 2 | --!strict 3 | --[[* 4 | * Copyright (c) Facebook, Inc. and its affiliates. 5 | * 6 | * This source code is licensed under the MIT license found in the 7 | * LICENSE file in the root directory of this source tree. 8 | * 9 | * @flow 10 | ]] 11 | 12 | export type TypeOfMode = number 13 | 14 | return { 15 | NoMode = 0b00000, 16 | StrictMode = 0b00001, 17 | -- TODO: Remove BlockingMode and ConcurrentMode by reading from the root 18 | -- tag instead 19 | BlockingMode = 0b00010, 20 | ConcurrentMode = 0b00100, 21 | ProfileMode = 0b01000, 22 | DebugTracingMode = 0b10000, 23 | } 24 | -------------------------------------------------------------------------------- /modules/Number/src/isFinite.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | return function(value) 17 | return typeof(value) == "number" and value == value and value ~= math.huge and value ~= -math.huge 18 | end 19 | -------------------------------------------------------------------------------- /modules/Number/src/MAX_SAFE_INTEGER.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER 17 | return 9007199254740991 18 | -------------------------------------------------------------------------------- /modules/Number/src/MIN_SAFE_INTEGER.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MIN_SAFE_INTEGER 17 | return -9007199254740991 18 | -------------------------------------------------------------------------------- /modules/ReactReconciler-9c8468d8-8a7220fd/src/ReactFiberTransition.lua: -------------------------------------------------------------------------------- 1 | --!strict 2 | -- upstream: https://github.com/facebook/react/blob/ddd1faa1972b614dfbfae205f2aa4a6c0b39a759/packages/react-reconciler/src/ReactFiberTransition.js 3 | --[[* 4 | * Copyright (c) Facebook, Inc. and its affiliates. 5 | * 6 | * This source code is licensed under the MIT license found in the 7 | * LICENSE file in the root directory of this source tree. 8 | * 9 | * @flow 10 | ]] 11 | 12 | local Packages = script.Parent.Parent 13 | 14 | local ReactSharedInternals = require(Packages.Shared).ReactSharedInternals 15 | 16 | local ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig 17 | 18 | return { 19 | NoTransition = 0, 20 | requestCurrentTransition = function(): number 21 | return ReactCurrentBatchConfig.transition 22 | end, 23 | } 24 | -------------------------------------------------------------------------------- /modules/Number/src/isNaN.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN 17 | return function(value) 18 | return type(value) == "number" and value ~= value 19 | end 20 | -------------------------------------------------------------------------------- /extractor/resources/sourceReplacements/getJestMatchers.roblox.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Brooke Rhodes. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | 16 | -- This module is only relevant to Roblox's Jest implementation, which isn't available under MIT. 17 | -- Just a stub. 18 | 19 | return function() 20 | return {} 21 | end 22 | -------------------------------------------------------------------------------- /modules/Scheduler-9c8468d8-8a7220fd/src/getJestMatchers.roblox.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Brooke Rhodes. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | 16 | -- This module is only relevant to Roblox's Jest implementation, which isn't available under MIT. 17 | -- Just a stub. 18 | 19 | return function() 20 | return {} 21 | end 22 | -------------------------------------------------------------------------------- /modules/LuauPolyfill-2fca3173-1.1.0/src/AssertionError/init.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | local AssertionErrorModule = require(script.AssertionError) 16 | 17 | export type AssertionError = AssertionErrorModule.AssertionError 18 | 19 | return AssertionErrorModule.AssertionError 20 | -------------------------------------------------------------------------------- /modules/String/src/trim.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | 17 | local trimStart = require(script.Parent.trimStart) 18 | local trimEnd = require(script.Parent.trimEnd) 19 | 20 | return function(source: string): string 21 | return trimStart(trimEnd(source)) 22 | end 23 | -------------------------------------------------------------------------------- /modules/ReactReconciler-9c8468d8-8a7220fd/src/ReactFiberErrorDialog.lua: -------------------------------------------------------------------------------- 1 | --!strict 2 | -- upstream: https://github.com/facebook/react/blob/56e9feead0f91075ba0a4f725c9e4e343bca1c67/packages/react-reconciler/src/ReactFiberErrorDialog.js 3 | --[[* 4 | * Copyright (c) Facebook, Inc. and its affiliates. 5 | * 6 | * This source code is licensed under the MIT license found in the 7 | * LICENSE file in the root directory of this source tree. 8 | * 9 | * @flow 10 | ]] 11 | 12 | -- This module is forked in different environments. 13 | -- By default, return `true` to log errors to the console. 14 | -- Forks can return `false` if this isn't desirable. 15 | local exports = {} 16 | 17 | exports.showErrorDialog = function( 18 | boundary, 19 | errorInfo 20 | ): boolean 21 | -- ROBLOX TODO: we may replace this with something that sends telemetry LUAFDN-222 22 | return true 23 | end 24 | 25 | return exports 26 | -------------------------------------------------------------------------------- /modules/Shared-9c8468d8-8a7220fd/src/objectIs.lua: -------------------------------------------------------------------------------- 1 | --!strict 2 | -- upstream: https://github.com/facebook/react/blob/6faf6f5eb1705eef39a1d762d6ee381930f36775/packages/shared/objectIs.js 3 | --[[* 4 | * Copyright (c) Facebook, Inc. and its affiliates. 5 | * 6 | * This source code is licensed under the MIT license found in the 7 | * LICENSE file in the root directory of this source tree. 8 | * 9 | * @flow 10 | ]] 11 | 12 | --[[* 13 | * inlined Object.is polyfill to avoid requiring consumers ship their own 14 | * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is 15 | ]] 16 | local function is(x: any, y: any): boolean 17 | return x == y and (x ~= 0 or 1 / x == 1 / y) or x ~= x and y ~= y -- eslint-disable-line no-self-compare 18 | end 19 | 20 | -- deviation: Object isn't a global in lua, so `Object.is` will never exist 21 | local objectIs = is 22 | 23 | return objectIs 24 | -------------------------------------------------------------------------------- /modules/Number/src/isInteger.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger 17 | return function(value) 18 | return type(value) == "number" and value ~= math.huge and value == math.floor(value) 19 | end 20 | -------------------------------------------------------------------------------- /modules/Shared-9c8468d8-8a7220fd/src/PropMarkers/Tag.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --[[ 16 | Special value for assigning tags to roblox instances via Roact 17 | ]] 18 | local Symbol = require(script.Parent.Parent["Symbol.roblox"]) 19 | 20 | local Tag = Symbol.named("RobloxTag") 21 | 22 | return Tag 23 | -------------------------------------------------------------------------------- /modules/Collections/src/init.lua: -------------------------------------------------------------------------------- 1 | -- NOTE: This file is too small and/or simple to be sufficiently rewritten under a new license. Assume MIT. 2 | --!strict 3 | local Packages = script.Parent 4 | 5 | local Array = require(script.Array) 6 | local Map = require(script.Map) 7 | local Object = require(script.Object) 8 | local Set = require(script.Set) 9 | local WeakMap = require(script.WeakMap) 10 | local inspect = require(script.inspect) 11 | 12 | local types = require(Packages.ES7Types) 13 | 14 | export type Array = types.Array 15 | export type Map = types.Map 16 | export type Object = types.Object 17 | export type Set = types.Set 18 | export type WeakMap = types.WeakMap 19 | 20 | return { 21 | Array = Array, 22 | Object = Object, 23 | Map = Map.Map, 24 | coerceToMap = Map.coerceToMap, 25 | coerceToTable = Map.coerceToTable, 26 | Set = Set, 27 | WeakMap = WeakMap, 28 | inspect = inspect, 29 | } 30 | -------------------------------------------------------------------------------- /modules/Collections/src/Object/None.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!nonstrict 16 | -- Marker used to specify that the value is nothing, because nil cannot be 17 | -- stored in tables. 18 | local None = newproxy(true) 19 | local mt = getmetatable(None) 20 | mt.__tostring = function() 21 | return "Object.None" 22 | end 23 | 24 | return None 25 | -------------------------------------------------------------------------------- /modules/String/src/substr.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | return function(s: string, startIndex: number, numberOfCharacters: number?): string 17 | if numberOfCharacters and numberOfCharacters <= 0 then 18 | return "" 19 | end 20 | return string.sub(s, startIndex, numberOfCharacters and startIndex + numberOfCharacters - 1 or nil) 21 | end 22 | -------------------------------------------------------------------------------- /modules/Shared-9c8468d8-8a7220fd/src/ReactSharedInternals/ReactCurrentOwner.lua: -------------------------------------------------------------------------------- 1 | --!strict 2 | -- upstream: https://github.com/facebook/react/blob/376d5c1b5aa17724c5fea9412f8fcde14a7b23f1/packages/react/src/ReactCurrentOwner.js 3 | --[[* 4 | * Copyright (c) Facebook, Inc. and its affiliates. 5 | * 6 | * This source code is licensed under the MIT license found in the 7 | * LICENSE file in the root directory of this source tree. 8 | * 9 | * @flow 10 | ]] 11 | 12 | --[[* 13 | * Keeps track of the current owner. 14 | * 15 | * The current owner is the component who should own any components that are 16 | * currently being constructed. 17 | ]] 18 | local ReactCurrentOwner = { 19 | --[[* 20 | * @internal 21 | * @type {ReactComponent} 22 | ]] 23 | -- ROBLOX deviation START: upstream types this as Fiber, but that would incur a circular dependency between reconciler and shared 24 | current = nil :: any, 25 | -- ROBLOX deviation END 26 | } 27 | 28 | return ReactCurrentOwner 29 | -------------------------------------------------------------------------------- /modules/Boolean/src/toJSBoolean.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local Packages = script.Parent.Parent 17 | local Number = require(Packages.Number) 18 | 19 | -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean 20 | return function(val: any): boolean 21 | return not not val and val ~= 0 and val ~= "" and not Number.isNaN(val) 22 | end 23 | -------------------------------------------------------------------------------- /modules/Number/src/isSafeInteger.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger 17 | local isInteger = require(script.Parent.isInteger) 18 | local MAX_SAFE_INTEGER = require(script.Parent.MAX_SAFE_INTEGER) 19 | 20 | return function(value) 21 | return isInteger(value) and math.abs(value) <= MAX_SAFE_INTEGER 22 | end 23 | -------------------------------------------------------------------------------- /example/src/client/init.client.lua: -------------------------------------------------------------------------------- 1 | local ReplicatedStorage = game:GetService("ReplicatedStorage") 2 | local Players = game:GetService("Players") 3 | 4 | local Packages = ReplicatedStorage:WaitForChild("Packages") 5 | local Roact = require(Packages:WaitForChild("Roact")) 6 | 7 | local e = Roact.createElement 8 | local useState = Roact.useState 9 | 10 | local function Button() 11 | local clicks, setClicks = useState(0) 12 | 13 | return e("TextButton", { 14 | AnchorPoint = Vector2.new(0.5, 0.5), 15 | Position = UDim2.fromScale(0.5, 0.5), 16 | Size = UDim2.fromOffset(240, 240), 17 | 18 | Text = "Clicks: " .. clicks, 19 | 20 | [Roact.Event.Activated] = function() 21 | setClicks(clicks + 1) 22 | end, 23 | }) 24 | end 25 | 26 | local function SetupUi() 27 | local player = Players.LocalPlayer 28 | 29 | local root = e("ScreenGui", {}, { 30 | e(Button), 31 | }) 32 | 33 | Roact.mount(root, player.PlayerGui, "ExampleUI") 34 | end 35 | 36 | SetupUi() 37 | -------------------------------------------------------------------------------- /modules/Collections/src/Object/is.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | -- Implements Javascript's `Object.is` as defined below 16 | -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is 17 | return function(value1: any, value2: any): boolean 18 | if value1 == value2 then 19 | return value1 ~= 0 or 1 / value1 == 1 / value2 20 | else 21 | return value1 ~= value1 and value2 ~= value2 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /modules/Collections/src/Array/includes.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local Array = script.Parent 17 | local Packages = Array.Parent.Parent 18 | local types = require(Packages.ES7Types) 19 | type Array = types.Array 20 | local indexOf = require(script.Parent.indexOf) 21 | 22 | return function(array: Array, searchElement: T, fromIndex: number?): boolean 23 | return indexOf(array, searchElement, fromIndex) ~= -1 24 | end 25 | -------------------------------------------------------------------------------- /modules/Number/src/init.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | return { 17 | isFinite = require(script.isFinite), 18 | isInteger = require(script.isInteger), 19 | isNaN = require(script.isNaN), 20 | isSafeInteger = require(script.isSafeInteger), 21 | MAX_SAFE_INTEGER = require(script.MAX_SAFE_INTEGER), 22 | MIN_SAFE_INTEGER = require(script.MIN_SAFE_INTEGER), 23 | NaN = 0 / 0, 24 | toExponential = require(script.toExponential), 25 | } 26 | -------------------------------------------------------------------------------- /modules/Timers/src/init.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local Packages = script.Parent 17 | 18 | local Object = require(Packages.Collections).Object 19 | 20 | local makeTimerImpl = require(script.makeTimerImpl) 21 | local makeIntervalImpl = require(script.makeIntervalImpl) 22 | 23 | export type Timeout = makeTimerImpl.Timeout 24 | export type Interval = makeIntervalImpl.Interval 25 | 26 | return Object.assign({}, makeTimerImpl(task.delay), makeIntervalImpl(task.delay)) 27 | -------------------------------------------------------------------------------- /modules/Collections/src/Object/seal.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local Object = script.Parent 17 | local Packages = Object.Parent.Parent 18 | 19 | local types = require(Packages.ES7Types) 20 | type Array = types.Array 21 | type Object = types.Object 22 | 23 | return function(t: T & (Object | Array)): T 24 | -- Luau FIXME: model freeze better so it passes through the type constraint and doesn't erase 25 | return (table.freeze(t :: any) :: any) :: T 26 | end 27 | -------------------------------------------------------------------------------- /modules/Collections/src/Object/freeze.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local Object = script.Parent 17 | local Packages = Object.Parent.Parent 18 | 19 | local types = require(Packages.ES7Types) 20 | type Array = types.Array 21 | type Object = types.Object 22 | 23 | return function(t: T & (Object | Array)): T 24 | -- Luau FIXME: model freeze better so it passes through the type constraint and doesn't erase 25 | return (table.freeze(t :: any) :: any) :: T 26 | end 27 | -------------------------------------------------------------------------------- /modules/Symbol/src/GlobalRegistry.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | local Symbol = require(script.Parent.Symbol) 16 | 17 | local GlobalRegistry: { [string]: Symbol.Symbol } = {} 18 | 19 | return { 20 | getOrInit = function(name: string): Symbol.Symbol 21 | if GlobalRegistry[name] == nil then 22 | GlobalRegistry[name] = Symbol.new(name) 23 | end 24 | 25 | return GlobalRegistry[name] 26 | end, 27 | -- Used for testing 28 | __clear = function() 29 | GlobalRegistry = {} 30 | end, 31 | } 32 | -------------------------------------------------------------------------------- /modules/Collections/src/Array/reverse.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | -- https://programming-idioms.org/idiom/19/reverse-a-list/1314/lua 17 | local Array = script.Parent 18 | local Packages = Array.Parent.Parent 19 | local types = require(Packages.ES7Types) 20 | type Array = types.Array 21 | 22 | return function(t: Array): Array 23 | local n = #t 24 | local i = 1 25 | while i < n do 26 | t[i], t[n] = t[n], t[i] 27 | i = i + 1 28 | n = n - 1 29 | end 30 | return t 31 | end 32 | -------------------------------------------------------------------------------- /modules/Collections/src/Object/isFrozen.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local Object = script.Parent 17 | local Packages = Object.Parent.Parent 18 | 19 | local types = require(Packages.ES7Types) 20 | type Array = types.Array 21 | type Object = types.Object 22 | 23 | return function(t: Object | Array): boolean 24 | if _G.__DEV__ then 25 | print("Luau now has a direct table.isfrozen call that can save the overhead of this library function call") 26 | end 27 | return table.isfrozen(t) 28 | end 29 | -------------------------------------------------------------------------------- /modules/RoactCompat-9c8468d8-8a7220fd/src/createFragment.lua: -------------------------------------------------------------------------------- 1 | --!strict 2 | --[[ 3 | * Copyright (c) Roblox Corporation. All rights reserved. 4 | * Licensed under the MIT License (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://opensource.org/licenses/MIT 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | ]] 16 | local Packages = script.Parent.Parent 17 | local React = require(Packages.React) 18 | 19 | local warnOnce = require(script.Parent.warnOnce) 20 | 21 | return function(elements) 22 | if _G.__DEV__ and _G.__COMPAT_WARNINGS__ then 23 | warnOnce( 24 | "createFragment", 25 | "Please instead use:\n\tReact.createElement(React.Fragment, ...)" 26 | ) 27 | end 28 | return React.createElement(React.Fragment, nil, elements) 29 | end 30 | -------------------------------------------------------------------------------- /modules/Collections/src/Array/findIndex.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local Array = script.Parent 17 | local Packages = Array.Parent.Parent 18 | local types = require(Packages.ES7Types) 19 | type Array = types.Array 20 | type PredicateFunction = (T, number, Array) -> boolean 21 | 22 | return function(array: Array, predicate: PredicateFunction): number 23 | for i = 1, #array do 24 | local element = array[i] 25 | if predicate(element, i, array) then 26 | return i 27 | end 28 | end 29 | return -1 30 | end 31 | -------------------------------------------------------------------------------- /modules/RoactCompat-9c8468d8-8a7220fd/src/Portal.lua: -------------------------------------------------------------------------------- 1 | --!strict 2 | --[[ 3 | * Copyright (c) Roblox Corporation. All rights reserved. 4 | * Licensed under the MIT License (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://opensource.org/licenses/MIT 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | ]] 16 | 17 | local Packages = script.Parent.Parent 18 | local ReactRoblox = require(Packages.ReactRoblox) 19 | 20 | local warnOnce = require(script.Parent.warnOnce) 21 | 22 | local function PortalComponent(props) 23 | if _G.__DEV__ and _G.__COMPAT_WARNINGS__ then 24 | warnOnce("Roact.Portal", "Please use the createPortal API on ReactRoblox instead") 25 | end 26 | return ReactRoblox.createPortal(props.children, props.target) 27 | end 28 | 29 | return PortalComponent 30 | -------------------------------------------------------------------------------- /modules/Collections/src/Array/find.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local Array = script.Parent 17 | local Packages = Array.Parent.Parent 18 | local types = require(Packages.ES7Types) 19 | type Array = types.Array 20 | type PredicateFunction = (value: T, index: number, array: Array) -> boolean 21 | 22 | return function(array: Array, predicate: PredicateFunction): T | nil 23 | for i = 1, #array do 24 | local element = array[i] 25 | if predicate(element, i, array) then 26 | return element 27 | end 28 | end 29 | return nil 30 | end 31 | -------------------------------------------------------------------------------- /modules/RoactCompat-9c8468d8-8a7220fd/src/warnOnce.lua: -------------------------------------------------------------------------------- 1 | --!strict 2 | --[[ 3 | * Copyright (c) Roblox Corporation. All rights reserved. 4 | * Licensed under the MIT License (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://opensource.org/licenses/MIT 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | ]] 16 | 17 | local Packages = script.Parent.Parent 18 | local console = require(Packages.Shared).console 19 | 20 | local warnedAbout = {} 21 | 22 | local function warnOnce(name: string, message: string) 23 | if not warnedAbout[name] then 24 | console.warn( 25 | "The legacy Roact API '%s' is deprecated, and will be removed " 26 | .. "in a future release.\n\n%s", 27 | name, 28 | message 29 | ) 30 | end 31 | warnedAbout[name] = true 32 | end 33 | 34 | return warnOnce 35 | -------------------------------------------------------------------------------- /modules/React-9c8468d8-8a7220fd/src/None.roblox.lua: -------------------------------------------------------------------------------- 1 | --!strict 2 | -- code derived from https://github.com/Roblox/roact/blob/master/src/None.lua 3 | --[[ 4 | * Copyright (c) Roblox Corporation. All rights reserved. 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | ]] 17 | 18 | local Packages = script.Parent.Parent 19 | local LuauPolyfill = require(Packages.LuauPolyfill) 20 | 21 | -- Roact uses `Object.assign` internally to assign new state values; the same 22 | -- None value should give us the proper semantics. We can re-export this value 23 | -- as React.None for easy use, and to mirror Roact.None in legacy Roact. 24 | return LuauPolyfill.Object.None 25 | -------------------------------------------------------------------------------- /modules/RoactCompat-9c8468d8-8a7220fd/src/setGlobalConfig.lua: -------------------------------------------------------------------------------- 1 | --!strict 2 | --[[ 3 | * Copyright (c) Roblox Corporation. All rights reserved. 4 | * Licensed under the MIT License (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://opensource.org/licenses/MIT 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | ]] 16 | 17 | local warnOnce = require(script.Parent.warnOnce) 18 | 19 | return function(_config) 20 | if _G.__DEV__ and _G.__COMPAT_WARNINGS__ then 21 | warnOnce( 22 | "setGlobalConfig", 23 | "Roact 17 uses a `_G.__DEV__` flag to enable development behavior. " 24 | .. "If you're seeing this warning, you already have it enabled. " 25 | .. "Please remove any redundant uses of `setGlobalConfig`." 26 | ) 27 | end 28 | -- No equivalent behavior can be applied here 29 | end 30 | -------------------------------------------------------------------------------- /modules/Collections/src/Array/shift.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local Array = script.Parent 17 | local Packages = Array.Parent.Parent 18 | local isArray = require(Array.isArray) 19 | local types = require(Packages.ES7Types) 20 | type Array = types.Array 21 | 22 | return function(value: Array): T? 23 | if _G.__DEV__ then 24 | if not isArray(value) then 25 | error(string.format("Array.shift called on non-array %s", typeof(value))) 26 | end 27 | end 28 | 29 | if #value > 0 then 30 | return table.remove(value, 1) 31 | else 32 | return nil 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /modules/Shared-9c8468d8-8a7220fd/src/ReactFiberHostConfig/WithNoTestSelectors.lua: -------------------------------------------------------------------------------- 1 | -- upstream: https://github.com/facebook/react/blob/3cde22a84e246fc5361f038bf0c23405b2572c22/packages/react-reconciler/src/ReactFiberHostConfigWithNoTestSelectors.js 2 | --[[* 3 | * Copyright (c) Facebook, Inc. and its affiliates. 4 | * 5 | * This source code is licensed under the MIT license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | * 8 | * @flow 9 | ]] 10 | 11 | local invariant = require(script.Parent.Parent.invariant) 12 | 13 | -- Renderers that don't support test selectors 14 | -- can re-export everything from this module. 15 | 16 | local function shim(...) 17 | invariant( 18 | false, 19 | "The current renderer does not support test selectors. " 20 | .. "This error is likely caused by a bug in React. " 21 | .. "Please file an issue." 22 | ) 23 | end 24 | 25 | -- Test selectors (when unsupported) 26 | return { 27 | supportsTestSelectors = false, 28 | findFiberRoot = shim, 29 | getBoundingRect = shim, 30 | getTextContent = shim, 31 | isHiddenSubtree = shim, 32 | matchAccessibilityRole = shim, 33 | setFocusIfFocusable = shim, 34 | setupIntersectionObserver = shim, 35 | } 36 | -------------------------------------------------------------------------------- /modules/Collections/src/Object/init.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | 17 | return { 18 | assign = require(script.assign), 19 | entries = require(script.entries), 20 | freeze = require(script.freeze), 21 | is = require(script.is), 22 | isFrozen = require(script.isFrozen), 23 | keys = require(script.keys), 24 | preventExtensions = require(script.preventExtensions), 25 | seal = require(script.seal), 26 | values = require(script.values), 27 | -- Special marker type used in conjunction with `assign` to remove values 28 | -- from tables, since nil cannot be stored in a table 29 | None = require(script.None), 30 | } 31 | -------------------------------------------------------------------------------- /modules/ReactReconciler-9c8468d8-8a7220fd/src/ReactCapturedValue.lua: -------------------------------------------------------------------------------- 1 | --!strict 2 | -- upstream: https://github.com/facebook/react/blob/56e9feead0f91075ba0a4f725c9e4e343bca1c67/packages/react-reconciler/src/ReactCapturedValue.js 3 | --[[* 4 | * Copyright (c) Facebook, Inc. and its affiliates. 5 | * 6 | * This source code is licensed under the MIT license found in the 7 | * LICENSE file in the root directory of this source tree. 8 | * 9 | * @flow 10 | ]] 11 | 12 | local ReactInternalTypes = require(script.Parent.ReactInternalTypes) 13 | type Fiber = ReactInternalTypes.Fiber 14 | 15 | local getStackByFiberInDevAndProd = require(script.Parent.ReactFiberComponentStack).getStackByFiberInDevAndProd 16 | 17 | export type CapturedValue = { 18 | value: T, 19 | source: Fiber | nil, 20 | stack: string | nil, 21 | } 22 | 23 | local exports = {} 24 | 25 | exports.createCapturedValue = function( 26 | value: T, 27 | source: Fiber | nil 28 | ): CapturedValue 29 | -- If the value is an error, call this function immediately after it is thrown 30 | -- so the stack is accurate. 31 | return { 32 | value = value, 33 | source = source, 34 | stack = getStackByFiberInDevAndProd(source), 35 | } 36 | end 37 | 38 | return exports 39 | -------------------------------------------------------------------------------- /modules/String/src/endsWith.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local function endsWith(value: string, substring: string, optionalLength: number?): boolean 17 | local substringLength = substring:len() 18 | if substringLength == 0 then 19 | return true 20 | end 21 | local valueLength = value:len() 22 | local length = optionalLength or valueLength 23 | if length > valueLength then 24 | length = valueLength 25 | end 26 | if length < 1 then 27 | return false 28 | end 29 | local position = length - substringLength + 1 30 | return value:find(substring, position, true) == position 31 | end 32 | 33 | return endsWith 34 | -------------------------------------------------------------------------------- /modules/Collections/src/Array/join.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local Array = script.Parent 17 | local Packages = Array.Parent.Parent 18 | local types = require(Packages.ES7Types) 19 | type Array = types.Array 20 | local map = require(Array.map) 21 | 22 | return function(arr: Array, separator: string?): string 23 | if #arr == 0 then 24 | return "" 25 | end 26 | -- JS does tostring conversion implicitely but in Lua we need to do that explicitely 27 | local stringifiedArray = map(arr, function(item) 28 | return tostring(item) 29 | end) 30 | 31 | return table.concat(stringifiedArray, separator or ",") 32 | end 33 | -------------------------------------------------------------------------------- /modules/Shared-9c8468d8-8a7220fd/src/ReactFiberHostConfig/WithNoPersistence.lua: -------------------------------------------------------------------------------- 1 | -- upstream: https://github.com/facebook/react/blob/c5d2fc7127654e43de59fff865b74765a103c4a5/packages/react-reconciler/src/ReactFiberHostConfigWithNoPersistence.js 2 | --[[* 3 | * Copyright (c) Facebook, Inc. and its affiliates. 4 | * 5 | * This source code is licensed under the MIT license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | * 8 | * @flow 9 | ]] 10 | 11 | local invariant = require(script.Parent.Parent.invariant) 12 | 13 | -- Renderers that don't support persistence 14 | -- can re-export everything from this module. 15 | 16 | local function shim(...) 17 | invariant( 18 | false, 19 | "The current renderer does not support persistence. " 20 | .. "This error is likely caused by a bug in React. " 21 | .. "Please file an issue." 22 | ) 23 | end 24 | 25 | -- Persistence (when unsupported) 26 | return { 27 | supportsPersistence = false, 28 | cloneInstance = shim, 29 | cloneFundamentalInstance = shim, 30 | createContainerChildSet = shim, 31 | appendChildToContainerChildSet = shim, 32 | finalizeContainerChildren = shim, 33 | replaceContainerChildren = shim, 34 | cloneHiddenInstance = shim, 35 | cloneHiddenTextInstance = shim, 36 | } 37 | -------------------------------------------------------------------------------- /modules/React-9c8468d8-8a7220fd/src/ReactMutableSource.lua: -------------------------------------------------------------------------------- 1 | --!strict 2 | -- upstream: https://github.com/facebook/react/blob/142d4f1c00c66f3d728177082dbc027fd6335115/packages/react-reconciler/src/ReactMutableSource.js 3 | -- [[ 4 | -- * Copyright (c) Facebook, Inc. and its affiliates. 5 | -- * 6 | -- * This source code is licensed under the MIT license found in the 7 | -- * LICENSE file in the root directory of this source tree. 8 | -- * 9 | -- * @flow 10 | -- ]] 11 | 12 | local Packages = script.Parent.Parent 13 | local ReactTypes = require(Packages.Shared) 14 | type MutableSourceGetVersionFn = ReactTypes.MutableSourceGetVersionFn 15 | type MutableSource = ReactTypes.MutableSource 16 | 17 | local function createMutableSource( 18 | source: Source, 19 | getVersion: MutableSourceGetVersionFn 20 | ): MutableSource 21 | local mutableSource: MutableSource = { 22 | _getVersion = getVersion, 23 | _source = source, 24 | _workInProgressVersionPrimary = nil, 25 | _workInProgressVersionSecondary = nil, 26 | } 27 | 28 | if _G.__DEV__ then 29 | mutableSource._currentPrimaryRenderer = nil 30 | mutableSource._currentSecondaryRenderer = nil 31 | end 32 | 33 | return mutableSource 34 | end 35 | 36 | return createMutableSource -------------------------------------------------------------------------------- /modules/String/src/startsWith.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local function startsWith(value: string, substring: string, position: number?): boolean 17 | if string.len(substring) == 0 then 18 | return true 19 | end 20 | -- Luau FIXME: we have to use a tmp variable, as Luau doesn't understand the logic below narrow position to `number` 21 | local position_ 22 | if position == nil or position < 1 then 23 | position_ = 1 24 | else 25 | position_ = position 26 | end 27 | 28 | if position_ > string.len(value) then 29 | return false 30 | end 31 | return value:find(substring, position_, true) == position_ 32 | end 33 | 34 | return startsWith 35 | -------------------------------------------------------------------------------- /modules/Collections/src/Array/isArray.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | return function(value: any): boolean 17 | if typeof(value) ~= "table" then 18 | return false 19 | end 20 | if next(value) == nil then 21 | -- an empty table is an empty array 22 | return true 23 | end 24 | 25 | local length = #value 26 | 27 | if length == 0 then 28 | return false 29 | end 30 | 31 | local count = 0 32 | local sum = 0 33 | for key in pairs(value) do 34 | if typeof(key) ~= "number" then 35 | return false 36 | end 37 | if key % 1 ~= 0 or key < 1 then 38 | return false 39 | end 40 | count += 1 41 | sum += key 42 | end 43 | 44 | return sum == (count * (count + 1) / 2) 45 | end 46 | -------------------------------------------------------------------------------- /modules/ReactReconciler-9c8468d8-8a7220fd/src/ReactPortal.lua: -------------------------------------------------------------------------------- 1 | -- upstream: https://github.com/facebook/react/blob/142d4f1c00c66f3d728177082dbc027fd6335115/packages/react-reconciler/src/ReactPortal.js 2 | --[[* 3 | * Copyright (c) Facebook, Inc. and its affiliates. 4 | * 5 | * This source code is licensed under the MIT license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | * 8 | * @flow 9 | ]] 10 | 11 | local Packages = script.Parent.Parent 12 | 13 | local REACT_PORTAL_TYPE = require(Packages.Shared).ReactSymbols.REACT_PORTAL_TYPE 14 | 15 | local ReactTypes = require(Packages.Shared) 16 | type ReactNodeList = ReactTypes.ReactNodeList 17 | type ReactPortal = ReactTypes.ReactPortal 18 | 19 | local function createPortal( 20 | children: ReactNodeList, 21 | containerInfo: any, 22 | -- TODO: figure out the API for cross-renderer implementation. 23 | implementation: any, 24 | key: string? 25 | ): ReactPortal 26 | if key ~= nil then 27 | key = tostring(key) 28 | end 29 | return { 30 | -- This tag allow us to uniquely identify this as a React Portal 31 | ["$$typeof"] = REACT_PORTAL_TYPE, 32 | key = key, 33 | children = children, 34 | containerInfo = containerInfo, 35 | implementation = implementation, 36 | } 37 | end 38 | 39 | return { 40 | createPortal = createPortal 41 | } 42 | -------------------------------------------------------------------------------- /modules/Shared-9c8468d8-8a7220fd/src/formatProdErrorMessage.lua: -------------------------------------------------------------------------------- 1 | -- upstream: https://github.com/facebook/react/blob/75955bf1d7ff6c2c1f4052f4a84dd2ce6944c62e/packages/shared/formatProdErrorMessage.js 2 | --!strict 3 | --[[* 4 | * Copyright (c) Facebook, Inc. and its affiliates. 5 | * 6 | * This source code is licensed under the MIT license found in the 7 | * LICENSE file in the root directory of this source tree. 8 | * 9 | ]] 10 | 11 | -- Do not require this module directly! Use normal `invariant` calls with 12 | -- template literal strings. The messages will be replaced with error codes 13 | -- during build. 14 | 15 | local HttpService = game:GetService("HttpService") 16 | 17 | local function formatProdErrorMessage(code, ...) 18 | local url = "https://reactjs.org/docs/error-decoder.html?invariant=" .. tostring(code) 19 | local argsLength = select("#", ...) 20 | for i = 1, argsLength, 1 do 21 | -- deviation: UrlEncode should be equivalent to encodeURIComponent 22 | url = url .. "&args[]=" .. HttpService:UrlEncode(select(i, ...)) 23 | end 24 | return string.format( 25 | "Minified React error #%d; visit %s for the full message or " 26 | .. "use the non-minified dev environment for full errors and additional " 27 | .. "helpful warnings.", 28 | code, 29 | url 30 | ) 31 | end 32 | 33 | return formatProdErrorMessage 34 | -------------------------------------------------------------------------------- /modules/String/src/init.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | return { 16 | charCodeAt = require(script.charCodeAt), 17 | endsWith = require(script.endsWith), 18 | findOr = require(script.findOr), 19 | includes = require(script.includes), 20 | indexOf = require(script.indexOf), 21 | lastIndexOf = require(script.lastIndexOf), 22 | slice = require(script.slice), 23 | split = require(script.split), 24 | startsWith = require(script.startsWith), 25 | substr = require(script.substr), 26 | trim = require(script.trim), 27 | trimEnd = require(script.trimEnd), 28 | trimStart = require(script.trimStart), 29 | -- aliases for trimEnd and trimStart 30 | trimRight = require(script.trimEnd), 31 | trimLeft = require(script.trimStart), 32 | } 33 | -------------------------------------------------------------------------------- /modules/Collections/src/Array/unshift.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local Array = script.Parent 17 | local Packages = Array.Parent.Parent 18 | local isArray = require(Array.isArray) 19 | local types = require(Packages.ES7Types) 20 | type Array = types.Array 21 | 22 | return function(array: Array, ...: T): number 23 | if _G.__DEV__ then 24 | if not isArray(array) then 25 | error(string.format("Array.unshift called on non-array %s", typeof(array))) 26 | end 27 | end 28 | 29 | local numberOfItems = select("#", ...) 30 | if numberOfItems > 0 then 31 | for i = numberOfItems, 1, -1 do 32 | local toInsert = select(i, ...) 33 | table.insert(array, 1, toInsert) 34 | end 35 | end 36 | 37 | return #array 38 | end 39 | -------------------------------------------------------------------------------- /modules/Shared-9c8468d8-8a7220fd/src/invariant.lua: -------------------------------------------------------------------------------- 1 | --!strict 2 | -- upstream: https://github.com/facebook/react/blob/42c3c967d1e4ca4731b47866f2090bc34caa086c/packages/shared/invariant.js 3 | --[[* 4 | * Copyright (c) Facebook, Inc. and its affiliates. 5 | * 6 | * This source code is licensed under the MIT license found in the 7 | * LICENSE file in the root directory of this source tree. 8 | * 9 | ]] 10 | 11 | --[[* 12 | * Use invariant() to assert state which your program assumes to be true. 13 | * 14 | * Provide sprintf-style format (only %s is supported) and arguments 15 | * to provide information about what broke and what you were 16 | * expecting. 17 | * 18 | * The invariant message will be stripped in production, but the invariant 19 | * will remain to ensure logic does not differ in production. 20 | ]] 21 | local Packages = script.Parent.Parent 22 | local LuauPolyfill = require(Packages.LuauPolyfill) 23 | local Error = LuauPolyfill.Error 24 | 25 | local function invariant(condition, format, ...) 26 | -- ROBLOX TODO: we should encapsulate all formatting compatibility here, 27 | -- rather than spreading workarounds throughout the codebase, eg this 28 | -- should print an array without the need for a table.concat on the consumer side 29 | if not condition then 30 | error(Error(string.format(format, ...))) 31 | end 32 | end 33 | 34 | return invariant 35 | -------------------------------------------------------------------------------- /modules/Collections/src/Map/coerceToMap.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | local MapModule = script.Parent 16 | local Collections = MapModule.Parent 17 | local Packages = Collections.Parent 18 | 19 | local Map = require(MapModule.Map) 20 | local Object = require(Collections.Object) 21 | local instanceOf = require(Packages.InstanceOf) 22 | local types = require(Packages.ES7Types) 23 | 24 | type Map = types.Map 25 | type Table = types.Table 26 | 27 | local function coerceToMap(mapLike: Map | Table): Map 28 | return instanceOf(mapLike, Map) and mapLike :: Map -- ROBLOX: order is preserved 29 | or Map.new(Object.entries(mapLike)) -- ROBLOX: order is not preserved 30 | end 31 | 32 | return coerceToMap 33 | -------------------------------------------------------------------------------- /modules/ReactReconciler-9c8468d8-8a7220fd/src/ReactFiberSchedulerPriorities.roblox.lua: -------------------------------------------------------------------------------- 1 | --!strict 2 | -- upstream https://github.com/facebook/react/blob/d17086c7c813402a550d15a2f56dc43f1dbd1735/packages/react-reconciler/src/SchedulerWithReactIntegration.new.js 3 | --[[ 4 | * Copyright (c) Facebook, Inc. and its affiliates. 5 | * 6 | * This source code is licensed under the MIT license found in the 7 | * LICENSE file in the root directory of this source tree. 8 | * 9 | * @flow 10 | ]] 11 | 12 | -- deviation: Type definition and values extracted from 13 | -- SchedulerWithReactIntegration.new. This helps avoid a cyclic dependency that 14 | -- can occur between SchedulerWithReactIntegration.new, ReactFiberLanes, and 15 | -- various files that depend upon them 16 | 17 | export type ReactPriorityLevel = number 18 | 19 | local exports: { [string]: ReactPriorityLevel } = { 20 | -- // Except for NoPriority, these correspond to Scheduler priorities. We use 21 | -- // ascending numbers so we can compare them like numbers. They start at 90 to 22 | -- // avoid clashing with Scheduler's priorities. 23 | ImmediatePriority = 99, 24 | UserBlockingPriority = 98, 25 | NormalPriority = 97, 26 | LowPriority = 96, 27 | IdlePriority = 95, 28 | -- // NoPriority is the absence of priority. Also React-only. 29 | NoPriority = 90, 30 | } 31 | 32 | 33 | return exports 34 | -------------------------------------------------------------------------------- /modules/Shared-9c8468d8-8a7220fd/src/shallowEqual.lua: -------------------------------------------------------------------------------- 1 | -- upstream: https://github.com/facebook/react/blob/a9b035b0c2b8235405835beca0c4db2cc37f18d0/packages/shared/shallowEqual.js 2 | --!strict 3 | --[[* 4 | * Copyright (c) Facebook, Inc. and its affiliates. 5 | * 6 | * This source code is licensed under the MIT license found in the 7 | * LICENSE file in the root directory of this source tree. 8 | * 9 | * 10 | ]] 11 | local is = require(script.Parent.objectIs) 12 | 13 | --[[* 14 | * Performs equality by iterating through keys on an object and returning false 15 | * when any key has values which are not strictly equal between the arguments. 16 | * Returns true when the values of all keys are strictly equal. 17 | ]] 18 | local function shallowEqual(objA, objB) 19 | if is(objA, objB) then 20 | return true 21 | end 22 | 23 | if 24 | typeof(objA) ~= "table" 25 | or objA == nil 26 | or typeof(objB) ~= "table" 27 | or objB == nil 28 | then 29 | return false 30 | end 31 | 32 | -- deviation: `Object.keys` does not have an equivalent in Lua, so we 33 | -- iterate through each table instead 34 | for key, value in objA do 35 | if not is(objB[key], value) then 36 | return false 37 | end 38 | end 39 | 40 | for key, value in objB do 41 | if not is(objA[key], value) then 42 | return false 43 | end 44 | end 45 | 46 | return true 47 | end 48 | 49 | return shallowEqual 50 | -------------------------------------------------------------------------------- /modules/Symbol/src/init.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --[[ 16 | A 'Symbol' is an opaque marker type, implemented to behave similarly to JS: 17 | https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol 18 | ]] 19 | local Symbol = require(script.Symbol) 20 | export type Symbol = Symbol.Symbol 21 | local GlobalRegistry = require(script.GlobalRegistry) 22 | 23 | local SymbolObject = setmetatable({}, { 24 | --[[ 25 | Creates a new symbol, using the given name when printed. Symbols are 26 | opaque, so this will always create a new, unique object 27 | ]] 28 | __call = function(_, name: string?): Symbol.Symbol 29 | return Symbol.new(name) 30 | end, 31 | }) 32 | 33 | SymbolObject.for_ = GlobalRegistry.getOrInit 34 | 35 | return SymbolObject 36 | -------------------------------------------------------------------------------- /modules/ReactReconciler-9c8468d8-8a7220fd/src/ReactWorkTags.lua: -------------------------------------------------------------------------------- 1 | -- upstream: https://github.com/facebook/react/blob/56e9feead0f91075ba0a4f725c9e4e343bca1c67/packages/react-reconciler/src/ReactWorkTags.js 2 | --!strict 3 | --[[* 4 | * Copyright (c) Facebook, Inc. and its affiliates. 5 | * 6 | * This source code is licensed under the MIT license found in the 7 | * LICENSE file in the root directory of this source tree. 8 | * 9 | * @flow 10 | ]] 11 | 12 | export type WorkTag = number 13 | 14 | return { 15 | FunctionComponent = 0, 16 | ClassComponent = 1, 17 | IndeterminateComponent = 2; -- Before we know whether it is function or class 18 | HostRoot = 3; -- Root of a host tree. Could be nested inside another node. 19 | HostPortal = 4; -- A subtree. Could be an entry point to a different renderer. 20 | HostComponent = 5, 21 | HostText = 6, 22 | Fragment = 7, 23 | Mode = 8, 24 | ContextConsumer = 9, 25 | ContextProvider = 10, 26 | ForwardRef = 11, 27 | Profiler = 12, 28 | SuspenseComponent = 13, 29 | MemoComponent = 14, 30 | SimpleMemoComponent = 15, 31 | LazyComponent = 16, 32 | IncompleteClassComponent = 17, 33 | DehydratedFragment = 18, 34 | SuspenseListComponent = 19, 35 | FundamentalComponent = 20, 36 | ScopeComponent = 21, 37 | Block = 22, 38 | OffscreenComponent = 23, 39 | LegacyHiddenComponent = 24, 40 | } 41 | -------------------------------------------------------------------------------- /modules/Shared-9c8468d8-8a7220fd/src/Symbol.roblox.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --[[ 16 | A 'Symbol' is an opaque marker type. 17 | 18 | Symbols have the type 'userdata', but when printed to the console, the name 19 | of the symbol is shown. 20 | ]] 21 | 22 | local Symbol = {} 23 | 24 | --[[ 25 | Creates a Symbol with the given name. 26 | 27 | When printed or coerced to a string, the symbol will turn into the string 28 | given as its name. 29 | ]] 30 | function Symbol.named(name) 31 | assert(type(name) == "string", "Symbols must be created using a string name!") 32 | 33 | local self = newproxy(true) 34 | 35 | local wrappedName = string.format("Symbol(%s)", name) 36 | 37 | getmetatable(self).__tostring = function() 38 | return wrappedName 39 | end 40 | 41 | return self 42 | end 43 | 44 | return Symbol 45 | -------------------------------------------------------------------------------- /example/default.project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "tree": { 4 | "$className": "DataModel", 5 | 6 | "ReplicatedStorage": { 7 | "Packages": { 8 | "$path": "Packages" 9 | } 10 | }, 11 | 12 | "StarterPlayer": { 13 | "StarterPlayerScripts": { 14 | "Client": { 15 | "$path": "src/client" 16 | } 17 | } 18 | }, 19 | 20 | "Workspace": { 21 | "$properties": { 22 | "FilteringEnabled": true 23 | }, 24 | "Baseplate": { 25 | "$className": "Part", 26 | "$properties": { 27 | "Anchored": true, 28 | "Color": [ 29 | 0.38823, 30 | 0.37254, 31 | 0.38823 32 | ], 33 | "Locked": true, 34 | "Position": [ 35 | 0, 36 | -10, 37 | 0 38 | ], 39 | "Size": [ 40 | 512, 41 | 20, 42 | 512 43 | ] 44 | } 45 | } 46 | }, 47 | "Lighting": { 48 | "$properties": { 49 | "Ambient": [ 50 | 0, 51 | 0, 52 | 0 53 | ], 54 | "Brightness": 2, 55 | "GlobalShadows": true, 56 | "Outlines": false, 57 | "Technology": "Voxel" 58 | } 59 | }, 60 | "SoundService": { 61 | "$properties": { 62 | "RespectFilteringEnabled": true 63 | } 64 | } 65 | } 66 | } -------------------------------------------------------------------------------- /modules/Collections/src/Map/coerceToTable.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | local MapModule = script.Parent 16 | local Collections = MapModule.Parent 17 | local Packages = Collections.Parent 18 | 19 | local Map = require(MapModule.Map) 20 | local instanceOf = require(Packages.InstanceOf) 21 | local arrayReduce = require(Collections.Array.reduce) 22 | local types = require(Packages.ES7Types) 23 | 24 | type Map = types.Map 25 | type Table = types.Table 26 | 27 | local function coerceToTable(mapLike: Map | Table): Table 28 | if not instanceOf(mapLike, Map) then 29 | return mapLike :: Table 30 | end 31 | 32 | -- create table from map 33 | return arrayReduce(mapLike:entries(), function(tbl, entry) 34 | tbl[entry[1]] = entry[2] 35 | return tbl 36 | end, {}) 37 | end 38 | 39 | return coerceToTable 40 | -------------------------------------------------------------------------------- /modules/Collections/src/Object/preventExtensions.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local Object = script.Parent 17 | local Packages = Object.Parent.Parent 18 | 19 | local types = require(Packages.ES7Types) 20 | type Array = types.Array 21 | type Object = types.Object 22 | 23 | -- FIXME: This should be updated to be closer to the actual 24 | -- `Object.preventExtensions` functionality in JS. This requires additional 25 | -- support from the VM 26 | local function preventExtensions(t: T & (Object | Array)): T 27 | local name = tostring(t) 28 | 29 | return ( 30 | setmetatable(t :: any, { 31 | __newindex = function(self, key, value) 32 | local message = ("%q (%s) is not a valid member of %s"):format(tostring(key), typeof(key), name) 33 | 34 | error(message, 2) 35 | end, 36 | __metatable = false, 37 | }) :: any 38 | ) :: T 39 | end 40 | 41 | return preventExtensions 42 | -------------------------------------------------------------------------------- /modules/Shared-9c8468d8-8a7220fd/src/console.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | 16 | -- deviation: this lets us have the same functionality as in React, without 17 | -- having something like Babel to inject a different implementation of 18 | -- console.warn and console.error into the code 19 | -- Instead of using `LuauPolyfill.console`, React internals should use this 20 | -- wrapper to be able to use consoleWithStackDev in dev mode 21 | local Shared = script.Parent 22 | local Packages = Shared.Parent 23 | local LuauPolyfill = require(Packages.LuauPolyfill) 24 | local console = LuauPolyfill.console 25 | local consoleWithStackDev = require(Shared.consoleWithStackDev) 26 | 27 | if _G.__DEV__ then 28 | local newConsole = setmetatable({ 29 | warn = consoleWithStackDev.warn, 30 | error = consoleWithStackDev.error, 31 | }, { 32 | __index = console, 33 | }) 34 | return newConsole 35 | end 36 | 37 | return console 38 | -------------------------------------------------------------------------------- /modules/Symbol/src/Symbol.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | --[[ 17 | Symbols have the type 'userdata', but when printed or coerced to a string, 18 | the symbol will turn into the string given as its name. 19 | 20 | **This implementation provides only the `Symbol()` constructor and the 21 | global registry via `Symbol.for_`.** 22 | 23 | Other behaviors, including the ability to find all symbol properties on 24 | objects, are not implemented. 25 | ]] 26 | export type Symbol = typeof(newproxy(true)) & { [string]: any } 27 | 28 | return { 29 | new = function(name: string?): Symbol 30 | local self = newproxy(true) :: any 31 | 32 | local wrappedName = "Symbol()" 33 | if name then 34 | wrappedName = ("Symbol(%s)"):format(name) 35 | end 36 | 37 | getmetatable(self).__tostring = function() 38 | return wrappedName 39 | end 40 | 41 | return (self :: any) :: Symbol 42 | end, 43 | } 44 | -------------------------------------------------------------------------------- /modules/ReactReconciler-9c8468d8-8a7220fd/src/ReactFiberLazyComponent.new.lua: -------------------------------------------------------------------------------- 1 | --!strict 2 | -- upstream: https://github.com/facebook/react/blob/17f582e0453b808860be59ed3437c6a426ae52de/packages/react-reconciler/src/ReactFiberLazyComponent.new.js 3 | --[[* 4 | * Copyright (c) Facebook, Inc. and its affiliates. 5 | * 6 | * This source code is licensed under the MIT license found in the 7 | * LICENSE file in the root directory of this source tree. 8 | * 9 | * @flow 10 | ]] 11 | 12 | local Packages = script.Parent.Parent 13 | local LuauPolyfill = require(Packages.LuauPolyfill) 14 | local Object = LuauPolyfill.Object 15 | 16 | type Object = { [any]: any } 17 | 18 | local function resolveDefaultProps(Component: any, baseProps: Object): Object 19 | -- ROBLOX deviation: check if type is table before checking defaultProps to prevent non-table index 20 | if typeof(Component) == 'table' and Component and Component.defaultProps then 21 | -- Resolve default props. Taken from ReactElement 22 | -- ROBLOX FIXME Luau: hard cast to object until we can model this better in Luau. avoids Expected type table, got 'Object & any & any & { [any]: any }' instead 23 | local props = Object.assign({}, baseProps) :: Object 24 | local defaultProps = Component.defaultProps 25 | for propName, _ in defaultProps do 26 | if props[propName] == nil then 27 | props[propName] = defaultProps[propName] 28 | end 29 | end 30 | return props 31 | end 32 | return baseProps 33 | end 34 | 35 | return { 36 | resolveDefaultProps = resolveDefaultProps, 37 | } 38 | -------------------------------------------------------------------------------- /modules/ReactReconciler-9c8468d8-8a7220fd/src/init.lua: -------------------------------------------------------------------------------- 1 | -- ROBLOX upstream: https://github.com/facebook/react/blob/43363e2795393a00fd77312a16d6b80e626c29de/packages/react-reconciler/src/index.js 2 | --[[* 3 | * Copyright (c) Facebook, Inc. and its affiliates. 4 | * 5 | * This source code is licensed under the MIT license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | * 8 | * @flow 9 | ]] 10 | 11 | --!strict 12 | local ReactInternalTypes = require(script.ReactInternalTypes) 13 | local ReactRootTags = require(script.ReactRootTags) 14 | 15 | export type Dispatcher = ReactInternalTypes.Dispatcher 16 | export type Fiber = ReactInternalTypes.Fiber 17 | export type FiberRoot = ReactInternalTypes.FiberRoot 18 | 19 | -- ROBLOX deviation: explicit export for use in createReactNoop 20 | export type UpdateQueue = ReactInternalTypes.UpdateQueue 21 | 22 | export type RootTag = ReactRootTags.RootTag 23 | 24 | -- ROBLOX deviation: In order to allow host config to be spliced in, we export 25 | -- this top-level package as an initializer function that returns the configured 26 | -- reconciler module 27 | -- ROBLOX TODO: this effectively disconnects type checking from above to reconciler to below 28 | local function initialize(config): { [string]: any } 29 | local ReactFiberHostConfig = require(script.ReactFiberHostConfig) 30 | for name, implementation in config do 31 | ReactFiberHostConfig[name] = implementation 32 | end 33 | 34 | return require(script.ReactFiberReconciler) 35 | end 36 | 37 | return initialize 38 | -------------------------------------------------------------------------------- /modules/Shared-9c8468d8-8a7220fd/src/Type.roblox.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --[[ 16 | Contains markers for annotating objects with types. 17 | 18 | To set the type of an object, use `Type` as a key and the actual marker as 19 | the value: 20 | 21 | local foo = { 22 | [Type] = Type.Foo, 23 | } 24 | ]] 25 | 26 | local Symbol = require(script.Parent["Symbol.roblox"]) 27 | 28 | local Type = newproxy(true) 29 | 30 | local TypeInternal = {} 31 | 32 | local function addType(name) 33 | TypeInternal[name] = Symbol.named("Roact" .. name) 34 | end 35 | 36 | addType("HostChangeEvent") 37 | addType("HostEvent") 38 | 39 | function TypeInternal.of(value) 40 | if typeof(value) ~= "table" then 41 | return nil 42 | end 43 | 44 | return value[Type] 45 | end 46 | 47 | getmetatable(Type).__index = TypeInternal 48 | 49 | getmetatable(Type).__tostring = function() 50 | return "RoactType" 51 | end 52 | 53 | return Type 54 | -------------------------------------------------------------------------------- /modules/Shared-9c8468d8-8a7220fd/src/PropMarkers/Event.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --[[ 16 | Index into `Event` to get a prop key for attaching to an event on a Roblox 17 | Instance. 18 | 19 | Example: 20 | 21 | Roact.createElement("TextButton", { 22 | Text = "Hello, world!", 23 | 24 | [Roact.Event.MouseButton1Click] = function(rbx) 25 | print("Clicked", rbx) 26 | end 27 | }) 28 | ]] 29 | 30 | local Type = require(script.Parent.Parent["Type.roblox"]) 31 | 32 | local Event = {} 33 | 34 | local eventMetatable = { 35 | __tostring = function(self) 36 | return string.format("RoactHostEvent(%s)", self.name) 37 | end, 38 | } 39 | 40 | setmetatable(Event, { 41 | __index = function(self, eventName) 42 | local event = { 43 | [Type] = Type.HostEvent, 44 | name = eventName, 45 | } 46 | 47 | setmetatable(event, eventMetatable) 48 | 49 | Event[eventName] = event 50 | 51 | return event 52 | end, 53 | }) 54 | 55 | return Event 56 | -------------------------------------------------------------------------------- /modules/String/src/charCodeAt.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local String = script.Parent 17 | local Packages = String.Parent 18 | local Number = require(Packages.Number) 19 | 20 | local NaN = Number.NaN 21 | 22 | -- js https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt 23 | -- lua http://www.lua.org/manual/5.4/manual.html#pdf-utf8.codepoint 24 | return function(str: string, index: number): number 25 | if typeof(index) ~= "number" then 26 | index = 1 27 | end 28 | 29 | local strLen, invalidBytePosition = utf8.len(str) 30 | assert(strLen ~= nil, ("string `%s` has an invalid byte at position %s"):format(str, tostring(invalidBytePosition))) 31 | if index > strLen or index < 1 then 32 | return NaN 33 | end 34 | 35 | local offset = utf8.offset(str, index) 36 | local value = utf8.codepoint(str, offset, offset) 37 | 38 | if value == nil then 39 | return NaN 40 | end 41 | 42 | return value 43 | end 44 | -------------------------------------------------------------------------------- /modules/ReactReconciler-9c8468d8-8a7220fd/src/ReactFiberWorkInProgress.lua: -------------------------------------------------------------------------------- 1 | --!strict 2 | -- ROBLOX deviation: this is an extraction of a single state field 3 | -- (and associated mutation/getters) from ReactFiberWorkLooop.new 4 | -- which allows us to break dependency cycles involving that module 5 | -- ROBLOX upstream: https://github.com/facebook/react/blob/56e9feead0f91075ba0a4f725c9e4e343bca1c67/packages/react-reconciler/src/ReactFiberWorkLoop.new.js 6 | --[[* 7 | * Copyright (c) Facebook, Inc. and its affiliates. 8 | * 9 | * This source code is licensed under the MIT license found in the 10 | * LICENSE file in the root directory of this source tree. 11 | * 12 | * @flow 13 | ]] 14 | 15 | local ReactFiberLane = require(script.Parent.ReactFiberLane) 16 | local _workInProgressRootSkippedLanes: Lanes = ReactFiberLane.NoLanes 17 | local mergeLanes = ReactFiberLane.mergeLanes 18 | type Lanes = ReactFiberLane.Lanes 19 | type Lane = ReactFiberLane.Lane 20 | 21 | local exports = {} 22 | 23 | -- ROBLOX TODO: turn this into newindex property accessor 24 | exports.workInProgressRootSkippedLanes = function(value: Lanes?): Lanes 25 | if value == nil then 26 | return _workInProgressRootSkippedLanes 27 | end 28 | 29 | -- ROBLOX FIXME Luau: Luau should narrow based on guard above 30 | _workInProgressRootSkippedLanes = value :: Lanes 31 | return _workInProgressRootSkippedLanes 32 | end 33 | 34 | exports.markSkippedUpdateLanes = function(lane: Lane | Lanes): () 35 | _workInProgressRootSkippedLanes = mergeLanes( 36 | lane, 37 | _workInProgressRootSkippedLanes 38 | ) 39 | end 40 | 41 | return exports -------------------------------------------------------------------------------- /modules/Shared-9c8468d8-8a7220fd/src/UninitializedState.roblox.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local console = require(script.Parent.console) 17 | 18 | -- ROBLOX DEVIATION: Initialize state to a singleton that warns on access and errors on assignment 19 | -- initial state singleton 20 | local UninitializedState = {} 21 | 22 | setmetatable(UninitializedState, { 23 | __index = function(table, key) 24 | if _G.__DEV__ then 25 | console.warn( 26 | "Attempted to access uninitialized state. Use setState to initialize state" 27 | ) 28 | end 29 | return nil 30 | end, 31 | __newindex = function(table, key) 32 | if _G.__DEV__ then 33 | console.error( 34 | "Attempted to directly mutate state. Use setState to assign new values to state." 35 | ) 36 | end 37 | return nil 38 | end, 39 | __tostring = function(self) 40 | return "" 41 | end, 42 | __metatable = "UninitializedState", 43 | }) 44 | 45 | return UninitializedState 46 | -------------------------------------------------------------------------------- /modules/Collections/src/Array/init.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local Packages = script.Parent.Parent 17 | local ES7Types = require(Packages.ES7Types) 18 | 19 | export type Array = ES7Types.Array 20 | 21 | return { 22 | concat = require(script.concat), 23 | every = require(script.every), 24 | filter = require(script.filter), 25 | find = require(script.find), 26 | findIndex = require(script.findIndex), 27 | forEach = require(script.forEach), 28 | from = require(script.from), 29 | includes = require(script.includes), 30 | indexOf = require(script.indexOf), 31 | isArray = require(script.isArray), 32 | join = require(script.join), 33 | map = require(script.map), 34 | reduce = require(script.reduce), 35 | reverse = require(script.reverse), 36 | shift = require(script.shift), 37 | slice = require(script.slice), 38 | some = require(script.some), 39 | sort = require(script.sort), 40 | splice = require(script.splice), 41 | unshift = require(script.unshift), 42 | } 43 | -------------------------------------------------------------------------------- /modules/ReactReconciler-9c8468d8-8a7220fd/src/ReactFiberOffscreenComponent.lua: -------------------------------------------------------------------------------- 1 | -- ROBLOX upstream: https://github.com/facebook/react/blob/1faf9e3dd5d6492f3607d5c721055819e4106bc6/packages/react-reconciler/src/ReactFiberOffscreenComponent.js 2 | --!strict 3 | -- /** 4 | -- * Copyright (c) Facebook, Inc. and its affiliates. 5 | -- * 6 | -- * This source code is licensed under the MIT license found in the 7 | -- * LICENSE file in the root directory of this source tree. 8 | -- * 9 | -- * @flow 10 | -- */ 11 | 12 | local Packages = script.Parent.Parent 13 | local ReactTypes = require(Packages.Shared) 14 | type ReactNodeList = ReactTypes.ReactNodeList 15 | 16 | local ReactFiberLanes = require(script.Parent.ReactFiberLane) 17 | type Lanes = ReactFiberLanes.Lanes; 18 | 19 | 20 | export type OffscreenProps = { 21 | -- TODO: Pick an API before exposing the Offscreen type. I've chosen an enum 22 | -- for now, since we might have multiple variants. For example, hiding the 23 | -- content without changing the layout. 24 | -- 25 | -- Default mode is visible. Kind of a weird default for a component 26 | -- called "Offscreen." Possible alt: ? 27 | mode: string | nil, 28 | children: ReactNodeList, 29 | } 30 | 31 | -- We use the existence of the state object as an indicator that the component 32 | -- is hidden. 33 | export type OffscreenState = { 34 | -- TODO: This doesn't do anything, yet. It's always NoLanes. But eventually it 35 | -- will represent the pending work that must be included in the render in 36 | -- order to unhide the component. 37 | baseLanes: Lanes 38 | } 39 | 40 | return {} -------------------------------------------------------------------------------- /modules/Shared-9c8468d8-8a7220fd/src/ReactSharedInternals/ReactDebugCurrentFrame.lua: -------------------------------------------------------------------------------- 1 | --!strict 2 | -- upstream: https://github.com/facebook/react/blob/98d410f5005988644d01c9ec79b7181c3dd6c847/packages/react/src/ReactDebugCurrentFrame.js 3 | --[[* 4 | * Copyright (c) Facebook, Inc. and its affiliates. 5 | * 6 | * This source code is licensed under the MIT license found in the 7 | * LICENSE file in the root directory of this source tree. 8 | * 9 | * @flow 10 | ]] 11 | 12 | local ReactDebugCurrentFrame = {} 13 | 14 | local currentExtraStackFrame = (nil :: nil | string) 15 | 16 | function ReactDebugCurrentFrame.setExtraStackFrame(stack: string?): () 17 | if _G.__DEV__ then 18 | currentExtraStackFrame = stack 19 | end 20 | end 21 | 22 | if _G.__DEV__ then 23 | -- deviation: in Lua, the implementation is duplicated 24 | -- function ReactDebugCurrentFrame.setExtraStackFrame(stack: string?) 25 | -- if _G.__DEV__ then 26 | -- currentExtraStackFrame = stack 27 | -- end 28 | -- end 29 | 30 | -- Stack implementation injected by the current renderer. 31 | ReactDebugCurrentFrame.getCurrentStack = (nil :: nil | (() -> string)) 32 | 33 | function ReactDebugCurrentFrame.getStackAddendum(): string 34 | local stack = "" 35 | 36 | -- Add an extra top frame while an element is being validated 37 | if currentExtraStackFrame then 38 | stack = stack .. currentExtraStackFrame 39 | end 40 | 41 | -- Delegate to the injected renderer-specific implementation 42 | local impl = ReactDebugCurrentFrame.getCurrentStack 43 | if impl then 44 | stack = stack .. (impl() or "") 45 | end 46 | 47 | return stack 48 | end 49 | end 50 | 51 | return ReactDebugCurrentFrame 52 | -------------------------------------------------------------------------------- /modules/Shared-9c8468d8-8a7220fd/src/PropMarkers/Change.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --[[ 16 | Change is used to generate special prop keys that can be used to connect to 17 | GetPropertyChangedSignal. 18 | 19 | Generally, Change is indexed by a Roblox property name: 20 | 21 | Roact.createElement("TextBox", { 22 | [Roact.Change.Text] = function(rbx) 23 | print("The TextBox", rbx, "changed text to", rbx.Text) 24 | end, 25 | }) 26 | ]] 27 | 28 | local Type = require(script.Parent.Parent["Type.roblox"]) 29 | 30 | local Change = {} 31 | 32 | local changeMetatable = { 33 | __tostring = function(self) 34 | return string.format("RoactHostChangeEvent(%s)", self.name) 35 | end, 36 | } 37 | 38 | setmetatable(Change, { 39 | __index = function(self, propertyName) 40 | local changeListener = { 41 | [Type] = Type.HostChangeEvent, 42 | name = propertyName, 43 | } 44 | 45 | setmetatable(changeListener, changeMetatable) 46 | Change[propertyName] = changeListener 47 | 48 | return changeListener 49 | end, 50 | }) 51 | 52 | return Change 53 | -------------------------------------------------------------------------------- /modules/Shared-9c8468d8-8a7220fd/src/ReactElementType.lua: -------------------------------------------------------------------------------- 1 | --!strict 2 | --[[* 3 | * Copyright (c) Facebook, Inc. and its affiliates. 4 | * 5 | * This source code is licensed under the MIT license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | * 8 | * @flow 9 | ]] 10 | local Packages = script.Parent.Parent 11 | local LuauPolyfill = require(Packages.LuauPolyfill) 12 | type Object = LuauPolyfill.Object 13 | 14 | local flowtypes = require(script.Parent["flowtypes.roblox"]) 15 | type React_Element = flowtypes.React_Element 16 | type React_StatelessFunctionalComponent

= flowtypes.React_StatelessFunctionalComponent< 17 | P 18 | > 19 | type React_ComponentType

= flowtypes.React_ComponentType

20 | 21 | export type Source = { 22 | fileName: string, 23 | lineNumber: number, 24 | } 25 | type Key = string | number 26 | -- ROBLOX deviation: we're using the TypeScript definition here, which is more strict 27 | export type ReactElement

= { 28 | ["$$typeof"]: number, 29 | 30 | -- ROBLOX FIXME Luau: Luau has some trouble and inlining the type param from createElement doesn't help 31 | type: React_StatelessFunctionalComponent

| React_ComponentType

| string, 32 | -- type: T, 33 | key: Key | nil, 34 | ref: any, 35 | props: P, 36 | 37 | -- ROBLOX deviation: upstream has this as interface, which is extensible, Luau types are closed by default 38 | -- ReactFiber 39 | _owner: any, 40 | 41 | -- __DEV__ 42 | _store: any?, 43 | _self: React_Element?, 44 | _shadowChildren: any?, 45 | _source: Source?, 46 | } 47 | 48 | -- deviation: Return something so that the module system is happy 49 | return {} 50 | -------------------------------------------------------------------------------- /extractor/src/main.rs: -------------------------------------------------------------------------------- 1 | use std::{env, path::PathBuf}; 2 | 3 | use anyhow::Context; 4 | use clap::Parser; 5 | use libextractor::{ 6 | domain::PackageName, 7 | sources::{CorePackageSource, LocalPackageSource}, 8 | }; 9 | 10 | /// Extracts Roblox CorePackages into the specified directory, structured specifically for Wally. 11 | #[derive(Debug, Parser)] 12 | struct Args { 13 | /// List of packages names to search for first. 14 | #[arg(short, long, required = true)] 15 | root_packages: Vec, 16 | 17 | #[arg(short, long, required = true)] 18 | /// Directory to write all extracted packages. 19 | export_to: PathBuf, 20 | 21 | /// Bypass MIT and Apache2 license checks. Be warned, using unlicensed code could be breaking the law. 22 | #[arg(long, default_value_t = false)] 23 | bypass_license_check: bool, 24 | } 25 | 26 | fn main() -> anyhow::Result<()> { 27 | let args = Args::parse(); 28 | 29 | let path = resolve_path(&args.export_to); 30 | let bypass_license_check = &args.bypass_license_check; 31 | 32 | let root_packages = &args 33 | .root_packages 34 | .iter() 35 | .map(|i| PackageName(i.to_owned())) 36 | .collect(); 37 | 38 | LocalPackageSource::extract_packages(&path, root_packages, bypass_license_check) 39 | .context("Failed to extract CorePackages")?; 40 | 41 | Ok(()) 42 | } 43 | 44 | // https://github.com/rojo-rbx/rojo/blob/b88d34c639b7d7bdd4171b7846a64c2b13f0c2d5/src/cli/mod.rs#L124 45 | fn resolve_path(path: &PathBuf) -> PathBuf { 46 | if path.is_absolute() { 47 | path.to_owned() 48 | } else { 49 | env::current_dir().unwrap().join(path) 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /modules/Collections/src/Object/keys.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | local Object = script.Parent 16 | local Collections = Object.Parent 17 | local Packages = Object.Parent.Parent 18 | 19 | local Set = require(Collections.Set) 20 | local types = require(Packages.ES7Types) 21 | local instanceOf = require(Packages.InstanceOf) 22 | type Array = types.Array 23 | type Set = types.Set 24 | type Table = { [any]: any } 25 | 26 | return function(value: Set | Table | string): Array 27 | if value == nil then 28 | error("cannot extract keys from a nil value") 29 | end 30 | 31 | local valueType = typeof(value) 32 | 33 | local keys 34 | if valueType == "table" then 35 | keys = {} 36 | if instanceOf(value, Set) then 37 | return keys 38 | end 39 | 40 | for key in pairs(value :: Table) do 41 | table.insert(keys, key) 42 | end 43 | elseif valueType == "string" then 44 | local length = (value :: string):len() 45 | keys = table.create(length) 46 | for i = 1, length do 47 | keys[i] = tostring(i) 48 | end 49 | end 50 | 51 | return keys 52 | end 53 | -------------------------------------------------------------------------------- /modules/Collections/src/Object/values.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local Object = script.Parent 17 | local Packages = Object.Parent.Parent 18 | 19 | local types = require(Packages.ES7Types) 20 | type Array = types.Array 21 | 22 | -- TODO Luau: needs overloads to model this more correctly 23 | return function(value: { [string]: T } | Array | string): Array | Array 24 | if value == nil then 25 | error("cannot extract values from a nil value") 26 | end 27 | local valueType = typeof(value) 28 | 29 | local array: Array | Array 30 | if valueType == "table" then 31 | array = {} :: Array 32 | for _, keyValue in pairs(value :: { [string]: T } | Array) do 33 | table.insert(array, keyValue) 34 | end 35 | elseif valueType == "string" then 36 | -- optimization to avoid rehashing/growth 37 | local valueStringLength = (value :: string):len() 38 | array = table.create(valueStringLength) 39 | for i = 1, valueStringLength do 40 | (array :: Array)[i] = (value :: string):sub(i, i) 41 | end 42 | end 43 | 44 | return array 45 | end 46 | -------------------------------------------------------------------------------- /modules/Shared-9c8468d8-8a7220fd/src/ReactFiberHostConfig/init.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --[[ 16 | ROBLOX deviation: ReactFiberHostConfig captures singleton state across the 17 | whole workspace. This file and the modules it requires were moved from React 18 | to untangle a cyclic workspace member dependency. 19 | 20 | Before: 21 | * ReactFiberHostConfig (and the 5 associated modules) lived in React 22 | * React had a dependency on Shared 23 | * Shared reached into React source to re-export ReactFiberHostConfig (cycle) 24 | 25 | After: 26 | * ReactFiberHostConfig (and the 5 associated modules) live in Shared 27 | * React depends on Shared 28 | * Shared has no intra-workspace dependencies (no cycles) 29 | ]] 30 | 31 | -- types that are common across ReactFiberHostConfig files, moved here to avoid circular deps 32 | type Object = { [string]: any } 33 | export type OpaqueIDType = string | Object 34 | 35 | return { 36 | WithNoHydration = require(script.WithNoHydration), 37 | WithNoPersistence = require(script.WithNoPersistence), 38 | WithNoTestSelectors = require(script.WithNoTestSelectors), 39 | } 40 | -------------------------------------------------------------------------------- /modules/String/src/includes.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | 17 | -- excluding the `+` and `*` character, since findOr tests and graphql use them explicitly 18 | local luaPatternCharacters = "([" .. ("$%^()-[].?"):gsub("(.)", "%%%1") .. "])" 19 | 20 | local function includes(str: string, substring: string, position: (string | number)?): boolean 21 | local strLen, invalidBytePosition = utf8.len(str) 22 | assert(strLen ~= nil, ("string `%s` has an invalid byte at position %s"):format(str, tostring(invalidBytePosition))) 23 | if strLen == 0 then 24 | return false 25 | end 26 | 27 | if #substring == 0 then 28 | return true 29 | end 30 | 31 | local startIndex = 1 32 | if position ~= nil then 33 | startIndex = tonumber(position) or 1 34 | if startIndex > strLen then 35 | return false 36 | end 37 | end 38 | 39 | if startIndex < 1 then 40 | startIndex = 1 41 | end 42 | 43 | local init = utf8.offset(str, startIndex) 44 | local value = substring:gsub(luaPatternCharacters, "%%%1") 45 | local iStart, _ = string.find(str, value, init) 46 | return iStart ~= nil 47 | end 48 | 49 | return includes 50 | -------------------------------------------------------------------------------- /modules/Collections/src/Array/from/fromSet.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local Array = script.Parent.Parent 17 | local Packages = Array.Parent.Parent 18 | local types = require(Packages.ES7Types) 19 | type Object = types.Object 20 | type Array = types.Array 21 | type Set = types.Set 22 | type mapFn = (element: T, index: number) -> U 23 | type mapFnWithThisArg = (thisArg: any, element: T, index: number) -> U 24 | 25 | return function( 26 | value: Set, 27 | mapFn: (mapFn | mapFnWithThisArg)?, 28 | thisArg: Object? 29 | -- FIXME Luau: need overloading so the return type on this is more sane and doesn't require manual casts 30 | ): Array | Array | Array 31 | local array = {} 32 | 33 | if mapFn then 34 | array = {} 35 | for i, v in value :: any do 36 | if thisArg ~= nil then 37 | (array :: Array)[i] = (mapFn :: mapFnWithThisArg)(thisArg, v, i) 38 | else 39 | (array :: Array)[i] = (mapFn :: mapFn)(v, i) 40 | end 41 | end 42 | else 43 | array = table.clone((value :: any)._array) 44 | end 45 | 46 | return array 47 | end 48 | -------------------------------------------------------------------------------- /modules/Collections/src/Object/entries.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local Object = script.Parent 17 | local Packages = Object.Parent.Parent 18 | 19 | local types = require(Packages.ES7Types) 20 | type Array = types.Array 21 | type Map = types.Map 22 | type Tuple = types.Tuple 23 | 24 | return function(value: string | { [string]: T } | Array | Map): Array> 25 | assert(value :: any ~= nil, "cannot get entries from a nil value") 26 | local valueType = typeof(value) 27 | 28 | local entries: Array> = {} 29 | if valueType == "table" then 30 | for key, keyValue in pairs(value :: { [string]: T } | Array) do 31 | -- Luau FIXME: Luau should see entries as Array, given object is [string]: any, but it sees it as Array> despite all the manual annotation 32 | table.insert(entries, { key, keyValue }) 33 | end 34 | elseif valueType == "string" then 35 | -- TODO: should we be using utf8.len? 36 | for i = 1, string.len(value :: string) do 37 | entries[i] = { tostring(i), string.sub(value :: string, i, i) } 38 | end 39 | end 40 | 41 | return entries 42 | end 43 | -------------------------------------------------------------------------------- /modules/Collections/src/Array/from/fromMap.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local Array = script.Parent.Parent 17 | local Packages = Array.Parent.Parent 18 | local types = require(Packages.ES7Types) 19 | type Object = types.Object 20 | type Array = types.Array 21 | type Map = types.Map 22 | type mapFn = (element: T, index: number) -> U 23 | type mapFnWithThisArg = (thisArg: any, element: T, index: number) -> U 24 | 25 | return function( 26 | value: Map, 27 | mapFn: (mapFn | mapFnWithThisArg)?, 28 | thisArg: Object? 29 | -- FIXME Luau: need overloading so the return type on this is more sane and doesn't require manual casts 30 | ): Array | Array | Array 31 | local array = {} 32 | 33 | if mapFn then 34 | array = {} 35 | for i, v in value :: any do 36 | if thisArg ~= nil then 37 | (array :: Array)[i] = (mapFn :: mapFnWithThisArg)(thisArg, v, i) 38 | else 39 | (array :: Array)[i] = (mapFn :: mapFn)(v, i) 40 | end 41 | end 42 | else 43 | array = {} 44 | for i, v in value :: any do 45 | (array :: Array)[i] = v 46 | end 47 | end 48 | 49 | return array 50 | end 51 | -------------------------------------------------------------------------------- /modules/Scheduler-9c8468d8-8a7220fd/src/unstable_mock.lua: -------------------------------------------------------------------------------- 1 | --!strict 2 | --[[* 3 | * Copyright (c) Facebook, Inc. and its affiliates. 4 | * 5 | * This source code is licensed under the MIT license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | *]] 8 | local Tracing = require(script.Parent.Tracing) 9 | local TracingSubscriptions = require(script.Parent.TracingSubscriptions) 10 | -- ROBLOX deviation: export Tracing type from the package exports to avoid direct file access 11 | export type Interaction = Tracing.Interaction 12 | 13 | local initializeScheduler = require(script.Parent.Scheduler) 14 | local HostConfig = require(script.Parent.forks["SchedulerHostConfig.mock"]) 15 | 16 | local Scheduler = initializeScheduler(HostConfig) 17 | 18 | local exports = {} 19 | exports.tracing = {} 20 | -- ROBLOX FIXME Luau: need to fix CLI-56768 to remove any casts 21 | for key, value in Scheduler :: any do 22 | exports[key] = value 23 | end 24 | for key, value in Tracing :: any do 25 | exports.tracing[key] = value 26 | end 27 | for key, value in TracingSubscriptions :: any do 28 | exports.tracing[key] = value 29 | end 30 | 31 | exports.unstable_flushAllWithoutAsserting = HostConfig.unstable_flushAllWithoutAsserting 32 | exports.unstable_flushNumberOfYields = HostConfig.unstable_flushNumberOfYields 33 | exports.unstable_flushExpired = HostConfig.unstable_flushExpired 34 | exports.unstable_clearYields = HostConfig.unstable_clearYields 35 | exports.unstable_flushUntilNextPaint = HostConfig.unstable_flushUntilNextPaint 36 | exports.unstable_flushAll = HostConfig.unstable_flushAll 37 | exports.unstable_yieldValue = HostConfig.unstable_yieldValue 38 | exports.unstable_advanceTime = HostConfig.unstable_advanceTime 39 | exports.unstable_Profiling = Scheduler.unstable_Profiling 40 | 41 | return exports 42 | -------------------------------------------------------------------------------- /modules/String/src/indexOf.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | 17 | -- excluding the `+` and `*` character, since findOr tests and graphql use them explicitly 18 | local luaPatternCharacters = "([" .. ("$%^()-[].?"):gsub("(.)", "%%%1") .. "])" 19 | 20 | -- Implements equivalent functionality to JavaScript's `String.indexOf`, 21 | -- implementing the interface and behaviors defined at: 22 | -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf 23 | return function(str: string, searchElement: string, fromIndex: number?): number 24 | local length = #str 25 | local fromIndex_ = if fromIndex ~= nil then if fromIndex < 1 then 1 else fromIndex :: number else 1 26 | 27 | if #searchElement == 0 then 28 | return if fromIndex_ > length then length else fromIndex_ 29 | end 30 | 31 | if fromIndex_ > length then 32 | return -1 33 | end 34 | 35 | searchElement = searchElement:gsub(luaPatternCharacters, "%%%1") 36 | local searchElementLength = #searchElement 37 | 38 | for i = fromIndex_, length do 39 | if string.sub(str, i, i + searchElementLength - 1) == searchElement then 40 | return i 41 | end 42 | end 43 | 44 | return -1 45 | end 46 | -------------------------------------------------------------------------------- /modules/RoactCompat-9c8468d8-8a7220fd/src/oneChild.lua: -------------------------------------------------------------------------------- 1 | -- ROBLOX upstream: https://github.com/Roblox/roact/blob/master/src/oneChild.lua 2 | --[[ 3 | * Copyright (c) Roblox Corporation. All rights reserved. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | ]] 16 | local Packages = script.Parent.Parent 17 | local React = require(Packages.React) 18 | 19 | local warnOnce = require(script.Parent.warnOnce) 20 | 21 | local function oneChild(children) 22 | if _G.__DEV__ and _G.__COMPAT_WARNINGS__ then 23 | warnOnce( 24 | "oneChild", 25 | "You likely don't need this at all! If you were assigning children " 26 | .. "via `React.oneChild(someChildren)`, you can simply use " 27 | .. "`someChildren` directly." 28 | ) 29 | end 30 | 31 | -- This behavior is a bit different from upstream, so we're adapting current 32 | -- Roact's logic (which will unwrap a table with a single member) 33 | if not children then 34 | return nil 35 | end 36 | 37 | local key, child = next(children) 38 | 39 | if not child then 40 | return nil 41 | end 42 | 43 | local after = next(children, key) 44 | 45 | if after then 46 | error("Expected at most one child, had more than one child.", 2) 47 | end 48 | 49 | return React.Children.only(child) 50 | end 51 | 52 | return oneChild 53 | -------------------------------------------------------------------------------- /modules/Timers/src/makeTimerImpl.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | local Status = newproxy(false) 16 | 17 | type TaskStatus = number 18 | export type Timeout = { [typeof(Status)]: TaskStatus } 19 | 20 | local SCHEDULED = 1 21 | local DONE = 2 22 | local CANCELLED = 3 23 | 24 | return function(delayImpl) 25 | local function setTimeout(callback, delayTime: number?, ...): Timeout 26 | local args = { ... } 27 | local task = { 28 | [Status] = SCHEDULED, 29 | } 30 | 31 | -- delayTime is an optional parameter 32 | if delayTime == nil then 33 | delayTime = 0 34 | end 35 | 36 | -- To mimic the JS interface, we're expecting delayTime to be in ms 37 | local delayTimeMs = delayTime :: number / 1000 38 | delayImpl(delayTimeMs, function() 39 | if task[Status] == SCHEDULED then 40 | callback(unpack(args)) 41 | task[Status] = DONE 42 | end 43 | end) 44 | 45 | return task 46 | end 47 | 48 | local function clearTimeout(task: Timeout) 49 | if task == nil then 50 | return 51 | end 52 | if task[Status] == SCHEDULED then 53 | task[Status] = CANCELLED 54 | end 55 | end 56 | 57 | return { 58 | setTimeout = setTimeout, 59 | clearTimeout = clearTimeout, 60 | } 61 | end 62 | -------------------------------------------------------------------------------- /modules/Collections/src/Array/indexOf.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local Array = script.Parent 17 | local Packages = Array.Parent.Parent 18 | local types = require(Packages.ES7Types) 19 | type Array = types.Array 20 | 21 | -- Implements equivalent functionality to JavaScript's `array.indexOf`, 22 | -- implementing the interface and behaviors defined at: 23 | -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf 24 | -- 25 | -- This implementation is loosely based on the one described in the polyfill 26 | -- source in the above link 27 | return function(array: Array, searchElement: T, fromIndex: number?): number 28 | local fromIndex_ = fromIndex or 1 29 | local length = #array 30 | 31 | -- In the JS impl, a negative fromIndex means we should use length - index; 32 | -- with Lua, of course, this means that 0 is still valid, but refers to the 33 | -- end of the array the way that '-1' would in JS 34 | if fromIndex_ < 1 then 35 | fromIndex_ = math.max(length - math.abs(fromIndex_), 1) 36 | end 37 | 38 | for i = fromIndex_, length do 39 | if array[i] == searchElement then 40 | return i 41 | end 42 | end 43 | 44 | return -1 45 | end 46 | -------------------------------------------------------------------------------- /modules/Collections/src/Array/from/fromArray.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local Array = script.Parent.Parent 17 | local Packages = Array.Parent.Parent 18 | local types = require(Packages.ES7Types) 19 | type Object = types.Object 20 | 21 | type Array = types.Array 22 | type mapFn = (element: T, index: number) -> U 23 | type mapFnWithThisArg = (thisArg: any, element: T, index: number) -> U 24 | 25 | return function( 26 | value: Array, 27 | mapFn: (mapFn | mapFnWithThisArg)?, 28 | thisArg: Object? 29 | -- FIXME Luau: need overloading so the return type on this is more sane and doesn't require manual casts 30 | ): Array | Array | Array 31 | local array = {} 32 | 33 | if mapFn then 34 | local arrayLength = #(value :: Array) 35 | array = table.create(arrayLength) 36 | for i = 1, arrayLength do 37 | if thisArg ~= nil then 38 | (array :: Array)[i] = (mapFn :: mapFnWithThisArg)(thisArg, (value :: Array)[i], i) 39 | else 40 | (array :: Array)[i] = (mapFn :: mapFn)((value :: Array)[i], i) 41 | end 42 | end 43 | else 44 | array = table.clone(value :: Array) 45 | end 46 | 47 | return array 48 | end 49 | -------------------------------------------------------------------------------- /modules/Collections/src/WeakMap.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local Collections = script.Parent 17 | local Packages = Collections.Parent 18 | 19 | local ES7Types = require(Packages.ES7Types) 20 | 21 | type WeakMap = ES7Types.WeakMap 22 | 23 | type WeakMapPrivate = { 24 | _weakMap: { [K]: V }, 25 | -- method definitions 26 | get: (self: WeakMapPrivate, K) -> V, 27 | set: (self: WeakMapPrivate, K, V) -> WeakMapPrivate, 28 | has: (self: WeakMapPrivate, K) -> boolean, 29 | } 30 | type WeakMap_Statics = { 31 | new: () -> WeakMap, 32 | } 33 | 34 | local WeakMap: WeakMapPrivate & WeakMap_Statics = {} :: any; 35 | (WeakMap :: any).__index = WeakMap 36 | 37 | function WeakMap.new(): WeakMap 38 | local weakMap = setmetatable({}, { __mode = "k" }) 39 | return setmetatable({ _weakMap = weakMap }, WeakMap) :: any 40 | end 41 | 42 | function WeakMap:get(key) 43 | return self._weakMap[key] 44 | end 45 | 46 | function WeakMap:set(key, value) 47 | self._weakMap[key] = value 48 | return self 49 | end 50 | 51 | function WeakMap:has(key): boolean 52 | return self._weakMap[key] ~= nil 53 | end 54 | 55 | return WeakMap :: WeakMap & WeakMap_Statics 56 | -------------------------------------------------------------------------------- /modules/LuauPolyfill-2fca3173-1.1.0/src/Promise.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | -- this maps onto community promise libraries which won't support Luau, so we inline 17 | export type PromiseLike = { 18 | andThen: ( 19 | self: PromiseLike, 20 | resolve: ((T) -> ...(nil | T | PromiseLike))?, 21 | reject: ((any) -> ...(nil | T | PromiseLike))? 22 | ) -> PromiseLike, 23 | } 24 | 25 | type PromiseStatus = "Started" | "Resolved" | "Rejected" | "Cancelled" 26 | 27 | export type Promise = { 28 | andThen: ( 29 | self: Promise, 30 | resolve: ((T) -> ...(nil | T | PromiseLike))?, 31 | reject: ((any) -> ...(nil | T | PromiseLike))? 32 | ) -> Promise, 33 | 34 | catch: (Promise, ((any) -> ...(nil | T | PromiseLike))) -> Promise, 35 | 36 | onCancel: (Promise, () -> ()?) -> boolean, 37 | 38 | expect: (Promise) -> ...T, 39 | 40 | -- FIXME Luau: need union type packs to parse (...T) | () | PromiseLike here 41 | await: (Promise) -> (boolean, ...(T | any)), 42 | 43 | getStatus: (self: Promise) -> PromiseStatus, 44 | -- FIXME Luau: need union type packs to parse (...T) | () | PromiseLike here 45 | awaitStatus: (self: Promise) -> (PromiseStatus, ...(T | any)), 46 | } 47 | 48 | return {} 49 | -------------------------------------------------------------------------------- /modules/Number/src/toExponential.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toExponential 17 | return function(value: string | number, fractionDigits: number?): string | nil 18 | local num = value 19 | if typeof(value) == "string" then 20 | -- ROBLOX FIXME: add parseInt to encapsulate this logic and use it here 21 | local NaN = 0 / 0 22 | num = tonumber(value) or NaN -- works because 0 is truthy in Lua 23 | end 24 | -- returns nil for invalid input instead of nan to be more lua-native 25 | if typeof(num) ~= "number" then 26 | return "nan" 27 | end 28 | 29 | if fractionDigits ~= nil then 30 | if typeof(fractionDigits) ~= "number" then 31 | error("TypeError: fractionDigits must be a number between 0 and 100") 32 | end 33 | if fractionDigits < 0 or fractionDigits > 100 then 34 | error("RangeError: fractionDigits must be between 0 and 100") 35 | end 36 | end 37 | 38 | local formatString 39 | if fractionDigits == nil then 40 | formatString = "%e" 41 | else 42 | formatString = "%." .. tostring(fractionDigits) .. "e" 43 | end 44 | 45 | local retval = string.format(formatString, num):gsub("%+0", "+"):gsub("%-0", "-"):gsub("0*e", "e") 46 | 47 | return retval 48 | end 49 | -------------------------------------------------------------------------------- /modules/Timers/src/makeIntervalImpl.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | local Status = newproxy(false) 16 | 17 | type TaskStatus = number 18 | export type Interval = { [typeof(Status)]: TaskStatus } 19 | 20 | local SCHEDULED = 1 21 | local CANCELLED = 3 22 | 23 | return function(delayImpl) 24 | local function setInterval(callback, intervalTime: number, ...): Interval 25 | local args = { ... } 26 | local task = { 27 | [Status] = SCHEDULED, 28 | } 29 | 30 | -- delayTime is an optional parameter 31 | if intervalTime == nil then 32 | intervalTime = 0 33 | end 34 | 35 | -- To mimic the JS interface, we're expecting delayTime to be in ms 36 | local intervalTimeMs = intervalTime / 1000 37 | local delay_ 38 | delay_ = function() 39 | delayImpl(intervalTimeMs, function() 40 | if task[Status] == SCHEDULED then 41 | callback(unpack(args)) 42 | delay_() 43 | end 44 | end) 45 | end 46 | 47 | delay_() 48 | 49 | return task 50 | end 51 | 52 | local function clearInterval(task: Interval) 53 | if task == nil then 54 | return 55 | end 56 | 57 | if task[Status] == SCHEDULED then 58 | task[Status] = CANCELLED 59 | end 60 | end 61 | 62 | return { 63 | setInterval = setInterval, 64 | clearInterval = clearInterval, 65 | } 66 | end 67 | -------------------------------------------------------------------------------- /modules/Collections/src/Array/from/fromString.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local Array = script.Parent.Parent 17 | local Packages = Array.Parent.Parent 18 | local types = require(Packages.ES7Types) 19 | type Object = types.Object 20 | type Array = types.Array 21 | 22 | type mapFn = (element: T, index: number) -> U 23 | type mapFnWithThisArg = (thisArg: any, element: T, index: number) -> U 24 | 25 | return function( 26 | value: string, 27 | mapFn: (mapFn | mapFnWithThisArg)?, 28 | thisArg: Object? 29 | -- FIXME Luau: need overloading so the return type on this is more sane and doesn't require manual casts 30 | ): Array | Array | Array 31 | local array = {} 32 | 33 | local valueStringLength = #value 34 | array = table.create(valueStringLength) 35 | if mapFn then 36 | for i = 1, valueStringLength do 37 | if thisArg ~= nil then 38 | (array :: Array)[i] = (mapFn :: mapFnWithThisArg)(thisArg, string.sub(value, i, i) :: any, i) 39 | else 40 | (array :: Array)[i] = (mapFn :: mapFn)(string.sub(value, i, i) :: any, i) 41 | end 42 | end 43 | else 44 | for i = 1, valueStringLength do 45 | (array :: Array)[i] = string.sub(value, i, i) 46 | end 47 | end 48 | 49 | return array 50 | end 51 | -------------------------------------------------------------------------------- /modules/Collections/src/Array/slice.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local Array = script.Parent 17 | local Packages = Array.Parent.Parent 18 | local types = require(Packages.ES7Types) 19 | type Array = types.Array 20 | 21 | -- Implements Javascript's `Array.prototype.slice` as defined below, but with 1-indexing 22 | -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice 23 | return function(t: Array, start_idx: number?, end_idx: number?): Array 24 | if typeof(t) ~= "table" then 25 | error(string.format("Array.slice called on %s", typeof(t))) 26 | end 27 | local length = #t 28 | 29 | local start_idx_ = start_idx or 1 30 | local end_idx_ 31 | if end_idx == nil or end_idx > length + 1 then 32 | end_idx_ = length + 1 33 | else 34 | end_idx_ = end_idx 35 | end 36 | 37 | if start_idx_ > length + 1 then 38 | return {} 39 | end 40 | 41 | local slice = {} 42 | 43 | if start_idx_ < 1 then 44 | start_idx_ = math.max(length - math.abs(start_idx_), 1) 45 | end 46 | if end_idx_ < 1 then 47 | end_idx_ = math.max(length - math.abs(end_idx_), 1) 48 | end 49 | 50 | local idx = start_idx_ 51 | local i = 1 52 | while idx < end_idx_ do 53 | slice[i] = t[idx] 54 | idx = idx + 1 55 | i = i + 1 56 | end 57 | 58 | return slice 59 | end 60 | -------------------------------------------------------------------------------- /modules/InstanceOf/src/instanceof.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | -- polyfill for https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof 17 | 18 | -- FIXME Luau: typing class as Object gives: Type '{ @metatable {| __call: (a, ...any) -> Error, __tostring: ({+ message: b, name: c +}) -> string |}, Error }' could not be converted into 'table' 19 | local function instanceof(tbl: any, class: any): boolean 20 | if _G.__DEV__ then 21 | assert(typeof(class) == "table", "Received a non-table as the second argument for instanceof") 22 | end 23 | 24 | if typeof(tbl) ~= "table" then 25 | return false 26 | end 27 | 28 | local ok, hasNew = pcall(function() 29 | return class.new ~= nil and tbl.new == class.new 30 | end) 31 | if ok and hasNew then 32 | return true 33 | end 34 | 35 | local seen = { tbl = true } 36 | 37 | while tbl and typeof(tbl) == "table" do 38 | tbl = getmetatable(tbl) 39 | if typeof(tbl) == "table" then 40 | tbl = tbl.__index 41 | 42 | if tbl == class then 43 | return true 44 | end 45 | end 46 | 47 | -- if we still have a valid table then check against seen 48 | if typeof(tbl) == "table" then 49 | if seen[tbl] then 50 | return false 51 | end 52 | seen[tbl] = true 53 | end 54 | end 55 | 56 | return false 57 | end 58 | 59 | return instanceof 60 | -------------------------------------------------------------------------------- /modules/Collections/src/Array/some.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local Array = script.Parent 17 | local Packages = Array.Parent.Parent 18 | local types = require(Packages.ES7Types) 19 | type Array = types.Array 20 | type Object = types.Object 21 | 22 | -- note: JS version can return anything that's truthy, but that won't work for us since Lua deviates (0 is truthy) 23 | type callbackFn = (element: T, index: number, array: Array) -> boolean 24 | type callbackFnWithThisArg = (thisArg: U, element: T, index: number, array: Array) -> boolean 25 | 26 | -- Implements Javascript's `Array.prototype.map` as defined below 27 | -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some 28 | return function(t: Array, callback: callbackFn | callbackFnWithThisArg, thisArg: U?): boolean 29 | if typeof(t) ~= "table" then 30 | error(string.format("Array.some called on %s", typeof(t))) 31 | end 32 | if typeof(callback) ~= "function" then 33 | error("callback is not a function") 34 | end 35 | 36 | for i, value in t do 37 | if thisArg ~= nil then 38 | if value ~= nil and (callback :: callbackFnWithThisArg)(thisArg, value, i, t) then 39 | return true 40 | end 41 | else 42 | if value ~= nil and (callback :: callbackFn)(value, i, t) then 43 | return true 44 | end 45 | end 46 | end 47 | return false 48 | end 49 | -------------------------------------------------------------------------------- /modules/Collections/src/Array/sort.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local Array = script.Parent 17 | local Collections = Array.Parent 18 | local Packages = Collections.Parent 19 | local None = require(Collections.Object.None) 20 | local types = require(Packages.ES7Types) 21 | type Array = types.Array 22 | type Comparable = (any, any) -> number 23 | local defaultSort = function(a: T, b: T): boolean 24 | return type(a) .. tostring(a) < type(b) .. tostring(b) 25 | end 26 | 27 | return function(array: Array, compare: Comparable?): Array 28 | -- wrapperCompare interprets compare return value to be compatible with Lua's table.sort 29 | local wrappedCompare = defaultSort 30 | if compare ~= nil and compare ~= None then 31 | if typeof(compare :: any) ~= "function" then 32 | error("invalid argument to Array.sort: compareFunction must be a function") 33 | end 34 | wrappedCompare = function(a: T, b: T) 35 | local result = compare(a, b) 36 | if typeof(result) ~= "number" then 37 | -- deviation: throw an error because 38 | -- it's not clearly defined what is 39 | -- the behavior when the compare function 40 | -- does not return a number 41 | error(("invalid result from compare function, expected number but got %s"):format(typeof(result))) 42 | end 43 | return result < 0 44 | end 45 | end 46 | table.sort(array, wrappedCompare) 47 | return array 48 | end 49 | -------------------------------------------------------------------------------- /modules/ReactReconciler-9c8468d8-8a7220fd/src/ReactFiberHostConfig.lua: -------------------------------------------------------------------------------- 1 | --!strict 2 | -- upstream: https://github.com/facebook/react/blob/9ac42dd074c42b66ecc0334b75200b1d2989f892/packages/react-reconciler/src/ReactFiberHostConfig.js 3 | --[[* 4 | * Copyright (c) Facebook, Inc. and its affiliates. 5 | * 6 | * This source code is licensed under the MIT license found in the 7 | * LICENSE file in the root directory of this source tree. 8 | * 9 | * @flow 10 | ]] 11 | 12 | --[[ eslint-disable react-internal/invariant-args ]] 13 | 14 | -- ROBLOX FIXME: Cannot carry types over via the module overriding that's in use 15 | -- here; this is a particularly tricky case of cross-dependency type definitions 16 | -- Use a common set of typedefs across ReactTestHostConfig and ReactRobloxHostTypes 17 | type Object = { [string]: any } 18 | 19 | export type Instance = Object 20 | export type HostInstance = Instance 21 | export type TextInstance = Instance 22 | export type Container = Object 23 | export type HostContext = Object 24 | export type HydratableInstance = Instance | SuspenseInstance 25 | export type SuspenseInstance = Object 26 | export type PublicInstance = HostInstance 27 | 28 | export type Type = string 29 | export type Props = Object 30 | export type ChildSet = {} -- void, unused 31 | export type RendererInspectionConfig = Object 32 | 33 | -- if _G.__NO_LOADMODULE__ then 34 | local exports: { [string]: any } = {} 35 | return exports 36 | -- end 37 | 38 | -- -- We expect that our Rollup, Jest, and Flow configurations 39 | -- -- always shim this module with the corresponding host config 40 | -- -- (either provided by a renderer, or a generic shim for npm). 41 | -- -- 42 | -- -- We should never resolve to this file, but it exists to make 43 | -- -- sure that if we *do* accidentally break the configuration, 44 | -- -- the failure isn't silent. 45 | 46 | -- -- deviation: FIXME (roblox): is there a way to configure luau to account for this module 47 | -- -- being shimmed? 48 | -- error('This module must be shimmed by a specific renderer.') 49 | -------------------------------------------------------------------------------- /modules/Collections/src/Array/forEach.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local Array = script.Parent 17 | local Packages = Array.Parent.Parent 18 | local types = require(Packages.ES7Types) 19 | type Array = types.Array 20 | type Object = types.Object 21 | type callbackFn = (element: T, index: number, array: Array) -> () 22 | type callbackFnWithThisArg = (thisArg: U, element: T, index: number, array: Array) -> () 23 | 24 | -- Implements Javascript's `Array.prototype.forEach` as defined below 25 | -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach 26 | return function(t: Array, callback: callbackFn | callbackFnWithThisArg, thisArg: U?): () 27 | if _G.__DEV__ then 28 | if typeof(t) ~= "table" then 29 | error(string.format("Array.forEach called on %s", typeof(t))) 30 | end 31 | if typeof(callback) ~= "function" then 32 | error("callback is not a function") 33 | end 34 | end 35 | 36 | local len = #t 37 | local k = 1 38 | 39 | while k <= len do 40 | local kValue = t[k] 41 | 42 | if thisArg ~= nil then 43 | (callback :: callbackFnWithThisArg)(thisArg, kValue, k, t) 44 | else 45 | (callback :: callbackFn)(kValue, k, t) 46 | end 47 | 48 | if #t < len then 49 | -- don't iterate on removed items, don't iterate more than original length 50 | len = #t 51 | end 52 | k += 1 53 | end 54 | end 55 | -------------------------------------------------------------------------------- /modules/String/src/slice.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local function slice(str: string, startIndexStr: string | number, lastIndexStr: (string | number)?): string 17 | local strLen, invalidBytePosition = utf8.len(str) 18 | assert(strLen ~= nil, ("string `%s` has an invalid byte at position %s"):format(str, tostring(invalidBytePosition))) 19 | local startIndex = tonumber(startIndexStr) 20 | assert(typeof(startIndex) == "number", "startIndexStr should be a number") 21 | 22 | if startIndex + strLen < 0 then 23 | -- then |start index| is greater than string length 24 | startIndex = 1 25 | end 26 | 27 | if startIndex > strLen then 28 | return "" 29 | end 30 | 31 | -- if no last index length set, go to str length + 1 32 | local lastIndex = strLen + 1 33 | if lastIndexStr ~= nil then 34 | -- ROBLOX FIXME: add parseInt to encapsulate this logic and use it here 35 | local NaN = 0 / 0 36 | lastIndex = tonumber(lastIndexStr) or NaN -- this works because 0 is truthy in Lua 37 | end 38 | assert(typeof(lastIndex) == "number", "lastIndexStr should convert to number") 39 | 40 | if lastIndex > strLen then 41 | lastIndex = strLen + 1 42 | end 43 | 44 | local startIndexByte = utf8.offset(str, startIndex) 45 | -- get char length of charset retunred at offset 46 | local lastIndexByte = utf8.offset(str, lastIndex) - 1 47 | 48 | return string.sub(str, startIndexByte, lastIndexByte) 49 | end 50 | 51 | return slice 52 | -------------------------------------------------------------------------------- /modules/Collections/src/Array/reduce.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local Array = script.Parent 17 | local Packages = Array.Parent.Parent 18 | local types = require(Packages.ES7Types) 19 | type Array = types.Array 20 | type reduceFn = (previousValue: U, currentValue: T, currentIndex: number, array: Array) -> U 21 | 22 | -- Implements Javascript's `Array.prototype.reduce` as defined below 23 | -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce 24 | -- TODO Luau: when Luau supports overloads, use them here so that reduceFn can correctly use T when initialValue (U) isn't supplied 25 | return function(array: Array, callback: reduceFn, initialValue: U?): U 26 | if _G.__DEV__ then 27 | if typeof(array) ~= "table" then 28 | error(string.format("Array.reduce called on %s", typeof(array))) 29 | end 30 | if typeof(callback) ~= "function" then 31 | error("callback is not a function") 32 | end 33 | end 34 | 35 | local length = #array 36 | 37 | local value: T | U 38 | local initial = 1 39 | 40 | if initialValue ~= nil then 41 | value = initialValue 42 | else 43 | initial = 2 44 | if length == 0 then 45 | error("reduce of empty array with no initial value") 46 | end 47 | value = array[1] 48 | end 49 | 50 | for i = initial, length do 51 | value = callback(value :: U, array[i], i, array) 52 | end 53 | 54 | return value :: U 55 | end 56 | -------------------------------------------------------------------------------- /modules/String/src/lastIndexOf.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local function lastIndexOf(str: string, searchValue: string, fromIndex: number?): number 17 | local strLength = string.len(str) 18 | local calculatedFromIndex 19 | if fromIndex then 20 | calculatedFromIndex = fromIndex 21 | else 22 | calculatedFromIndex = strLength 23 | end 24 | if fromIndex and fromIndex < 1 then 25 | calculatedFromIndex = 1 26 | end 27 | if fromIndex and fromIndex > strLength then 28 | calculatedFromIndex = strLength 29 | end 30 | if searchValue == "" then 31 | -- FIXME: Luau DFA doesn't understand that 32 | return calculatedFromIndex :: number 33 | end 34 | 35 | local lastFoundStartIndex, foundStartIndex 36 | -- Luau FIXME: Luau doesn't look beyond assignment for type, it should infer number? from loop bound 37 | local foundEndIndex: number? = 0 38 | repeat 39 | lastFoundStartIndex = foundStartIndex 40 | -- Luau FIXME: DFA doesn't understand until clause means foundEndIndex is never nil within loop 41 | foundStartIndex, foundEndIndex = string.find(str, searchValue, foundEndIndex :: number + 1, true) 42 | until foundStartIndex == nil or foundStartIndex > calculatedFromIndex 43 | 44 | if lastFoundStartIndex == nil then 45 | return -1 46 | end 47 | -- Luau FIXME: Luau should see the predicate above and known the line below can only be a number 48 | return lastFoundStartIndex :: number 49 | end 50 | 51 | return lastIndexOf 52 | -------------------------------------------------------------------------------- /modules/Collections/src/Array/every.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local Array = script.Parent 17 | local Packages = Array.Parent.Parent 18 | local types = require(Packages.ES7Types) 19 | type Array = types.Array 20 | type Object = types.Object 21 | type callbackFn = (element: T, index: number, array: Array) -> boolean 22 | type callbackFnWithThisArg = (self: U, element: T, index: number, array: Array) -> boolean 23 | 24 | -- Implements Javascript's `Array.prototype.every` as defined below 25 | -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every 26 | return function(t: Array, callback: callbackFn | callbackFnWithThisArg, thisArg: U?): boolean 27 | if _G.__DEV__ then 28 | if typeof(t) ~= "table" then 29 | error(string.format("Array.every called on %s", typeof(t))) 30 | end 31 | if typeof(callback) ~= "function" then 32 | error("callback is not a function") 33 | end 34 | end 35 | 36 | local len = #t 37 | local k = 1 38 | 39 | while k <= len do 40 | local kValue = t[k] 41 | local testResult 42 | 43 | if kValue ~= nil then 44 | if thisArg ~= nil then 45 | testResult = (callback :: callbackFnWithThisArg)(thisArg, kValue, k, t) 46 | else 47 | testResult = (callback :: callbackFn)(kValue, k, t) 48 | end 49 | 50 | if not testResult then 51 | return false 52 | end 53 | end 54 | k += 1 55 | end 56 | return true 57 | end 58 | -------------------------------------------------------------------------------- /modules/Collections/src/Array/map.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | 17 | local Array = script.Parent 18 | local Packages = Array.Parent.Parent 19 | local types = require(Packages.ES7Types) 20 | type Array = types.Array 21 | type Object = types.Object 22 | type callbackFn = (element: T, index: number, array: Array) -> U 23 | type callbackFnWithThisArg = (thisArg: V, element: T, index: number, array: Array) -> U 24 | 25 | -- Implements Javascript's `Array.prototype.map` as defined below 26 | -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map 27 | return function(t: Array, callback: callbackFn | callbackFnWithThisArg, thisArg: V?): Array 28 | if _G.__DEV__ then 29 | if typeof(t) ~= "table" then 30 | error(string.format("Array.map called on %s", typeof(t))) 31 | end 32 | if typeof(callback) ~= "function" then 33 | error("callback is not a function") 34 | end 35 | end 36 | 37 | local len = #t 38 | local A = {} 39 | local k = 1 40 | 41 | while k <= len do 42 | local kValue = t[k] 43 | 44 | if kValue ~= nil then 45 | local mappedValue 46 | 47 | if thisArg ~= nil then 48 | mappedValue = (callback :: callbackFnWithThisArg)(thisArg, kValue, k, t) 49 | else 50 | mappedValue = (callback :: callbackFn)(kValue, k, t) 51 | end 52 | 53 | A[k] = mappedValue 54 | end 55 | k += 1 56 | end 57 | 58 | return A 59 | end 60 | -------------------------------------------------------------------------------- /modules/Shared-9c8468d8-8a7220fd/src/ReactFiberHostConfig/WithNoHydration.lua: -------------------------------------------------------------------------------- 1 | -- upstream: https://github.com/facebook/react/blob/c5d2fc7127654e43de59fff865b74765a103c4a5/packages/react-reconciler/src/ReactFiberHostConfigWithNoHydration.js 2 | --[[* 3 | * Copyright (c) Facebook, Inc. and its affiliates. 4 | * 5 | * This source code is licensed under the MIT license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | * 8 | * @flow 9 | ]] 10 | 11 | local invariant = require(script.Parent.Parent.invariant) 12 | 13 | -- Renderers that don't support hydration 14 | -- can re-export everything from this module. 15 | 16 | function shim(...) 17 | invariant( 18 | false, 19 | "The current renderer does not support hydration. " 20 | .. "This error is likely caused by a bug in React. " 21 | .. "Please file an issue." 22 | ) 23 | end 24 | 25 | -- Hydration (when unsupported) 26 | export type SuspenseInstance = any 27 | return { 28 | supportsHydration = false, 29 | canHydrateInstance = shim, 30 | canHydrateTextInstance = shim, 31 | canHydrateSuspenseInstance = shim, 32 | isSuspenseInstancePending = shim, 33 | isSuspenseInstanceFallback = shim, 34 | registerSuspenseInstanceRetry = shim, 35 | getNextHydratableSibling = shim, 36 | getFirstHydratableChild = shim, 37 | hydrateInstance = shim, 38 | hydrateTextInstance = shim, 39 | hydrateSuspenseInstance = shim, 40 | getNextHydratableInstanceAfterSuspenseInstance = shim, 41 | commitHydratedContainer = shim, 42 | commitHydratedSuspenseInstance = shim, 43 | clearSuspenseBoundary = shim, 44 | clearSuspenseBoundaryFromContainer = shim, 45 | didNotMatchHydratedContainerTextInstance = shim, 46 | didNotMatchHydratedTextInstance = shim, 47 | didNotHydrateContainerInstance = shim, 48 | didNotHydrateInstance = shim, 49 | didNotFindHydratableContainerInstance = shim, 50 | didNotFindHydratableContainerTextInstance = shim, 51 | didNotFindHydratableContainerSuspenseInstance = shim, 52 | didNotFindHydratableInstance = shim, 53 | didNotFindHydratableTextInstance = shim, 54 | didNotFindHydratableSuspenseInstance = shim, 55 | } 56 | -------------------------------------------------------------------------------- /modules/LuauPolyfill-2fca3173-1.1.0/src/extends.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!nonstrict 16 | --[[ 17 | deviation: Our constructors currently have no notion of 'super' so any 18 | such behavior in upstream JS must be implemented manually by setting fields 19 | 20 | A constructor passed to this class would typically look along the lines of: 21 | function(self, arg, otherArg) 22 | self.arg = arg 23 | self.otherArg = otherArg 24 | end 25 | 26 | But even something like function() end can be passed in as the constructor 27 | if no fields need to be set. In upstream JS, the equivalent would be 28 | returning an empty object from the constructor. 29 | ]] 30 | return function(parent, childName, constructor) 31 | local Child = {} 32 | Child.__index = Child 33 | Child.__tostring = function(self) 34 | return getmetatable(parent).__tostring(self) 35 | end 36 | 37 | local mt = {} 38 | 39 | Child.new = function(...) 40 | local self = {} 41 | constructor(self, ...) 42 | return setmetatable(self, Child) 43 | end 44 | 45 | if typeof(getmetatable(parent)) == "table" and getmetatable(parent).__call then 46 | mt.__call = function(_, ...) 47 | return Child.new(...) 48 | end 49 | end 50 | 51 | mt.__index = parent 52 | mt.__tostring = function(self) 53 | -- Printing class name 54 | if self == Child then 55 | return tostring(childName) 56 | end 57 | return getmetatable(parent).__tostring(self) 58 | end 59 | 60 | setmetatable(Child, mt) 61 | 62 | return Child 63 | end 64 | -------------------------------------------------------------------------------- /modules/LuauPolyfill-2fca3173-1.1.0/src/encodeURIComponent.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | -- reference documentation: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent 16 | local HttpService = game:GetService("HttpService") 17 | 18 | local root = script.Parent 19 | local Packages = root.Parent 20 | 21 | local String = require(Packages.String) 22 | local charCodeAt = String.charCodeAt 23 | local Error = require(script.Parent.Error) 24 | 25 | local function encodeURIComponent(value: string): string 26 | local valueLength = utf8.len(value) 27 | if valueLength == 0 or valueLength == nil then 28 | return "" 29 | end 30 | -- we don't exhaustively test the whole string for invalid characters like ECMA-262 15.1.3 says 31 | local check = charCodeAt(value, 1) 32 | if valueLength == 1 then 33 | if check == 0xD800 then 34 | error(Error.new("URI malformed")) 35 | end 36 | if check == 0xDFFF then 37 | error(Error.new("URI malformed")) 38 | end 39 | end 40 | if check >= 0xDC00 and check < 0xDFFF then 41 | error(Error.new("URI malformed")) 42 | end 43 | local encoded = HttpService:UrlEncode(value) 44 | -- reverting encoded chars which are not encoded by JS 45 | local result = encoded 46 | :gsub("%%2D", "-") 47 | :gsub("%%5F", "_") 48 | :gsub("%%2E", ".") 49 | :gsub("%%21", "!") 50 | :gsub("%%7E", "~") 51 | :gsub("%%2A", "*") 52 | :gsub("%%27", "'") 53 | :gsub("%%28", "(") 54 | :gsub("%%29", ")") 55 | return result 56 | end 57 | 58 | return encodeURIComponent 59 | -------------------------------------------------------------------------------- /extractor/src/sources/common/source_utils.rs: -------------------------------------------------------------------------------- 1 | use std::fs; 2 | use std::path::{Path, PathBuf}; 3 | 4 | use crate::constants::{ 5 | ALLOWED_MODULES, APACHE_LICENSE_PHRASES, MIT_LICENSE_PHRASES, SOURCE_REPLACEMENTS, 6 | }; 7 | use crate::domain::License; 8 | 9 | pub fn infer_script_license(source: &str, path: &PathBuf) -> Option { 10 | if source_matches_license_list(source, MIT_LICENSE_PHRASES.to_vec()) { 11 | return Some(License::MIT); 12 | } else { 13 | if is_script_whitelisted(path) { 14 | return Some(License::MIT); 15 | } 16 | } 17 | 18 | if source_matches_license_list(source, APACHE_LICENSE_PHRASES.to_vec()) { 19 | return Some(License::Apache2); 20 | } 21 | 22 | None 23 | } 24 | 25 | /// Returns a files source, supporting manual overrides for file rewrites 26 | pub fn get_file_source(path: &Path) -> anyhow::Result { 27 | for (replacement_path, content) in SOURCE_REPLACEMENTS.into_iter() { 28 | let path = path.to_str().unwrap(); 29 | let path = path.replace("\\", "/"); 30 | 31 | if path.contains(replacement_path) { 32 | return Ok((*content).to_owned()); 33 | } 34 | } 35 | 36 | let mut source = fs::read_to_string(&path)?; 37 | if is_script_whitelisted(&path.to_owned()) { 38 | source.insert_str( 39 | 0, 40 | "-- NOTE: This file is too small and/or simple to be sufficiently rewritten under a new license. Assume MIT.\n", 41 | ); 42 | } 43 | 44 | Ok(source) 45 | } 46 | 47 | fn source_matches_license_list(source: &str, license_list: Vec<&str>) -> bool { 48 | for phrase in license_list { 49 | if source.to_lowercase().contains(&phrase.to_lowercase()) { 50 | return true; 51 | } 52 | } 53 | 54 | false 55 | } 56 | 57 | fn is_script_whitelisted(path: &PathBuf) -> bool { 58 | let path = path.to_str().unwrap(); 59 | let path = path.replace("\\", "/"); 60 | 61 | for module_path in ALLOWED_MODULES { 62 | if path.contains(module_path) { 63 | return true; 64 | } 65 | } 66 | 67 | false 68 | } 69 | -------------------------------------------------------------------------------- /modules/Collections/src/Array/filter.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local Array = script.Parent 17 | local Packages = Array.Parent.Parent 18 | local types = require(Packages.ES7Types) 19 | type Array = types.Array 20 | type Object = types.Object 21 | type callbackFn = (element: T, index: number, array: Array) -> boolean 22 | type callbackFnWithThisArg = (thisArg: U, element: T, index: number, array: Array) -> boolean 23 | 24 | -- Implements Javascript's `Array.prototype.filter` as defined below 25 | -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter 26 | return function(t: Array, callback: callbackFn | callbackFnWithThisArg, thisArg: U?): Array 27 | if _G.__DEV__ then 28 | if typeof(t) ~= "table" then 29 | error(string.format("Array.filter called on %s", typeof(t))) 30 | end 31 | if typeof(callback) ~= "function" then 32 | error("callback is not a function") 33 | end 34 | end 35 | 36 | local len = #t 37 | local res = {} 38 | local index = 1 39 | 40 | if thisArg == nil then 41 | for i = 1, len do 42 | local kValue = t[i] 43 | if kValue ~= nil then 44 | if (callback :: callbackFn)(kValue, i, t) then 45 | res[index] = kValue 46 | index += 1 47 | end 48 | end 49 | end 50 | else 51 | for i = 1, len do 52 | local kValue = t[i] 53 | if kValue ~= nil then 54 | if (callback :: callbackFnWithThisArg)(thisArg, kValue, i, t) then 55 | res[index] = kValue 56 | index += 1 57 | end 58 | end 59 | end 60 | end 61 | 62 | return res 63 | end 64 | -------------------------------------------------------------------------------- /modules/Shared-9c8468d8-8a7220fd/src/consoleWithStackDev.lua: -------------------------------------------------------------------------------- 1 | -- upstream: https://github.com/facebook/react/blob/cb141681750c8221ac799074df09df2bb448c7a4/packages/shared/consoleWithStackDev.js 2 | --[[* 3 | * Copyright (c) Facebook, Inc. and its affiliates. 4 | * 5 | * This source code is licensed under the MIT license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | ]] 8 | local Packages = script.Parent.Parent 9 | local LuauPolyfill = require(Packages.LuauPolyfill) 10 | local console = LuauPolyfill.console 11 | local Array = LuauPolyfill.Array 12 | 13 | local ReactSharedInternals = require(script.Parent.ReactSharedInternals) 14 | -- In DEV, calls to console.warn and console.error get replaced 15 | -- by calls to these methods by a Babel plugin. 16 | -- 17 | -- In PROD (or in packages without access to React internals), 18 | -- they are left as they are instead. 19 | 20 | -- deviation: declare this ahead of time so that `warn` and `error` are able to 21 | -- reference it 22 | local printWarning 23 | 24 | local exports = {} 25 | exports.warn = function(format, ...) 26 | if _G.__DEV__ then 27 | printWarning("warn", format, { ... }) 28 | end 29 | end 30 | exports.error = function(format, ...) 31 | if _G.__DEV__ then 32 | printWarning("error", format, { ... }) 33 | end 34 | end 35 | 36 | function printWarning(level, format, args) 37 | -- When changing this logic, you might want to also 38 | -- update consoleWithStackDev.www.js as well. 39 | if _G.__DEV__ then 40 | local ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame 41 | local stack = ReactDebugCurrentFrame.getStackAddendum() 42 | 43 | if stack ~= "" then 44 | format ..= "%s" 45 | -- deviation: no array `concat` function in lua 46 | args = Array.slice(args, 1) 47 | table.insert(args, stack) 48 | end 49 | 50 | local argsWithFormat = Array.map(args, tostring) 51 | -- Careful: RN currently depends on this prefix 52 | table.insert(argsWithFormat, 1, "Warning: " .. format) 53 | -- We intentionally don't use spread (or .apply) directly because it 54 | -- breaks IE9: https://github.com/facebook/react/issues/13610 55 | -- eslint-disable-next-line react-internal/no-production-logging 56 | console[level](unpack(argsWithFormat)) 57 | end 58 | end 59 | 60 | return exports 61 | -------------------------------------------------------------------------------- /extractor/src/constants.rs: -------------------------------------------------------------------------------- 1 | use phf::phf_map; 2 | 3 | /// Some packages are unlicensed and can be replaced with something else. Block them 4 | /// entirely here. 5 | pub const BANNED_PACKAGE_NAMES: [&str; 15] = [ 6 | "Cryo", 7 | "Promise", 8 | // Ban old versions of packages 9 | "LuauPolyfill-12e911c4-90b08185", 10 | "LuauPolyfill-2fca3173-0.4.2", 11 | "LuauPolyfill-2fca3173-0.3.4", 12 | "React-04005deb-0fbbfa70", 13 | "ReactDebugTools-04005deb-0fbbfa70", 14 | "ReactDevtoolsExtensions-04005deb-0fbbfa70", 15 | "ReactDevtoolsShared-04005deb-0fbbfa70", 16 | "ReactIs-04005deb-0fbbfa70", 17 | "ReactReconciler-04005deb-0fbbfa70", 18 | "ReactRoblox-04005deb-0fbbfa70", 19 | "RoactCompat-04005deb-0fbbfa70", 20 | "Scheduler-04005deb-0fbbfa70", 21 | "Shared-04005deb-0fbbfa70", 22 | ]; 23 | 24 | pub static DEPENDENCY_ALIASES: phf::Map<&'static str, &'static str> = phf_map! { 25 | "Promise" => "evaera/promise@4.0.0", 26 | "Cryo" => "freddylist/llama@1.1.1", 27 | }; 28 | 29 | pub static PACKAGE_VERSION_OVERRIDES: phf::Map<&'static str, &'static str> = phf_map! { 30 | "RoactCompat-9c8468d8-8a7220fd" => "17.0.1-rc.16.1", 31 | }; 32 | 33 | pub const MIT_LICENSE_PHRASES: [&str; 2] = [ 34 | "licensed under the MIT license", 35 | "Copyright Node.js contributors. All rights reserved", 36 | ]; 37 | 38 | pub const APACHE_LICENSE_PHRASES: [&str; 1] = ["licensed under the Apache License, Version 2.0"]; 39 | 40 | // Some modules are so small that it's impossible to rewrite them enough to be considered unique. 41 | // Explicitly allow those modules here. 42 | pub const ALLOWED_MODULES: [&str; 5] = [ 43 | "Collections/Collections/Map/init.lua", 44 | "Collections/Collections/init.lua", 45 | "Math/Math/clz32.lua", 46 | "ReactRoblox-9c8468d8-8a7220fd/ReactRoblox/ReactReconciler.roblox.lua", 47 | "InstanceOf/InstanceOf/init.lua", 48 | ]; 49 | 50 | // Any module that needs to be rewritten should be included here 51 | pub static SOURCE_REPLACEMENTS: phf::Map<&'static str, &'static str> = phf_map! { 52 | "Scheduler/getJestMatchers.roblox.lua" => 53 | include_str!("../resources/sourceReplacements/getJestMatchers.roblox.lua"), 54 | "RoactCompat-9c8468d8-8a7220fd/RoactCompat/init.lua" => 55 | include_str!("../resources/sourceReplacements/RoactCompat.lua"), 56 | }; 57 | -------------------------------------------------------------------------------- /modules/String/src/findOr.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | type Match = { 17 | index: number, 18 | match: string, 19 | } 20 | 21 | -- excluding the `+` and `*` character, since findOr tests and graphql use them explicitly 22 | local luaPatternCharacters = "([" .. ("$%^()-[].?"):gsub("(.)", "%%%1") .. "])" 23 | 24 | local function findOr(str: string, patternTable: { string }, initIndex: number?): Match | nil 25 | -- loop through all options in patern patternTable 26 | 27 | local init = utf8.offset(str, initIndex or 1) 28 | local matches = {} 29 | for _, value in patternTable do 30 | value = value:gsub(luaPatternCharacters, "%%%1") 31 | local iStart, iEnd = string.find(str, value, init) 32 | if iStart then 33 | local prefix = string.sub(str, 1, iStart - 1) 34 | local prefixEnd, invalidBytePosition = utf8.len(prefix) 35 | if prefixEnd == nil then 36 | error(("string `%s` has an invalid byte at position %s"):format(prefix, tostring(invalidBytePosition))) 37 | end 38 | local iStartIndex = prefixEnd :: number + 1 39 | local match = { 40 | index = iStartIndex, 41 | match = string.sub(str, iStart, iEnd), 42 | } 43 | table.insert(matches, match) 44 | end 45 | end 46 | 47 | -- if no matches, return nil 48 | if #matches == 0 then 49 | return nil 50 | end 51 | 52 | -- find the first matched index (after the init param) 53 | -- for each, if we get a hit, return the earliest index and matched term 54 | 55 | local firstMatch 56 | for _, value in matches do 57 | -- load first condition 58 | if firstMatch == nil then 59 | firstMatch = value 60 | end 61 | -- identify if current match comes before first match 62 | if value.index < firstMatch.index then 63 | firstMatch = value 64 | end 65 | end 66 | 67 | -- return first match 68 | return firstMatch 69 | end 70 | 71 | return findOr 72 | -------------------------------------------------------------------------------- /modules/Collections/src/Array/from/init.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local Array = script.Parent 17 | local Collections = Array.Parent 18 | local Packages = Collections.Parent 19 | local Set = require(Collections.Set) 20 | local Map = require(Collections.Map.Map) 21 | local isArray = require(Array.isArray) 22 | local instanceof = require(Packages.InstanceOf) 23 | local types = require(Packages.ES7Types) 24 | 25 | local fromString = require(script.fromString) 26 | local fromSet = require(script.fromSet) 27 | local fromMap = require(script.fromMap) 28 | local fromArray = require(script.fromArray) 29 | 30 | type Array = types.Array 31 | type Object = types.Object 32 | type Set = types.Set 33 | type Map = types.Map 34 | type mapFn = (element: T, index: number) -> U 35 | type mapFnWithThisArg = (thisArg: any, element: T, index: number) -> U 36 | 37 | return function( 38 | value: string | Array | Set | Map, 39 | mapFn: (mapFn | mapFnWithThisArg)?, 40 | thisArg: Object? 41 | -- FIXME Luau: need overloading so the return type on this is more sane and doesn't require manual casts 42 | ): Array | Array | Array 43 | if value == nil then 44 | error("cannot create array from a nil value") 45 | end 46 | local valueType = typeof(value) 47 | 48 | local array: Array | Array | Array 49 | 50 | if valueType == "table" and isArray(value) then 51 | array = fromArray(value :: Array, mapFn, thisArg) 52 | elseif instanceof(value, Set) then 53 | array = fromSet(value :: Set, mapFn, thisArg) 54 | elseif instanceof(value, Map) then 55 | array = fromMap(value :: Map, mapFn, thisArg) 56 | elseif valueType == "string" then 57 | array = fromString(value :: string, mapFn, thisArg) 58 | else 59 | array = {} 60 | end 61 | 62 | return array 63 | end 64 | -------------------------------------------------------------------------------- /modules/React-9c8468d8-8a7220fd/src/ReactCreateRef.lua: -------------------------------------------------------------------------------- 1 | -- upstream: https://github.com/facebook/react/blob/b87aabdfe1b7461e7331abb3601d9e6bb27544bc/packages/react/src/ReactCreateRef.js 2 | --!strict 3 | --[[* 4 | * Copyright (c) Facebook, Inc. and its affiliates. 5 | * 6 | * This source code is licensed under the MIT license found in the 7 | * LICENSE file in the root directory of this source tree. 8 | * @flow 9 | *]] 10 | 11 | local Packages = script.Parent.Parent 12 | local ReactTypes = require(Packages.Shared) 13 | type RefObject = ReactTypes.RefObject 14 | 15 | -- ROBLOX DEVIATION: In Roact, refs are implemented in terms of bindings 16 | --[[ 17 | A ref is nothing more than a binding with a special field 'current' 18 | that maps to the getValue method of the binding 19 | ]] 20 | local Binding = require(script.Parent["ReactBinding.roblox"]) 21 | 22 | local exports = {} 23 | 24 | -- an immutable object with a single mutable value 25 | exports.createRef = function(): RefObject 26 | local binding, _ = Binding.create(nil) 27 | 28 | local ref = {} 29 | 30 | -- ROBLOX DEVIATION: Since refs are used as bindings, they can often be 31 | -- assigned to fields of other Instances; we track creation here parallel to 32 | -- how we do with bindings created via `createBinding` to improve messaging 33 | -- when something goes wrong 34 | if _G.__DEV__ then 35 | -- ROBLOX TODO: LUAFDN-619 - improve debug stacktraces for refs 36 | binding._source = debug.traceback("Ref created at:", 1) 37 | end 38 | 39 | --[[ 40 | A ref is just redirected to a binding via its metatable 41 | ]] 42 | setmetatable(ref, { 43 | __index = function(self, key) 44 | if key == "current" then 45 | return binding:getValue() 46 | else 47 | return binding[key] 48 | end 49 | end, 50 | __newindex = function(self, key, value) 51 | if key == "current" then 52 | -- ROBLOX FIXME: Bindings - This is not allowed in Roact, but is okay in 53 | -- React. Lots of discussion at 54 | -- https://github.com/DefinitelyTyped/DefinitelyTyped/issues/31065 55 | -- error("Cannot assign to the 'current' property of refs", 2) 56 | Binding.update(binding, value) 57 | end 58 | 59 | binding[key] = value 60 | end, 61 | __tostring = function(self) 62 | return string.format("Ref(%s)", tostring(binding:getValue())) 63 | end, 64 | }) 65 | 66 | return (ref :: any) :: RefObject 67 | end 68 | 69 | return exports 70 | -------------------------------------------------------------------------------- /modules/Collections/src/Array/concat.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local Array = script.Parent 17 | local Packages = Array.Parent.Parent 18 | local isArray = require(Array.isArray) 19 | local types = require(Packages.ES7Types) 20 | type Array = types.Array 21 | 22 | local RECEIVED_OBJECT_ERROR = "Array.concat(...) only works with array-like tables but " 23 | .. "it received an object-like table.\nYou can avoid this error by wrapping the " 24 | .. "object-like table into an array. Example: `concat({1, 2}, {a = true})` should " 25 | .. "be `concat({1, 2}, { {a = true} }`" 26 | 27 | -- capture two separate generic arguments so that the type error in abuse cases is actionable, but needs CLI-49876 to avoid a false negative 28 | local function concat(source: Array | T, ...: Array | S): Array & Array 29 | local array 30 | local elementCount = 0 31 | 32 | if isArray(source) then 33 | array = table.clone(source :: Array) 34 | elementCount = #(source :: Array) 35 | else 36 | elementCount += 1 37 | array = {} 38 | array[elementCount] = source :: T 39 | end 40 | 41 | for i = 1, select("#", ...) do 42 | local value = select(i, ...) 43 | local valueType = typeof(value) 44 | if value == nil then 45 | -- do not insert nil 46 | elseif valueType == "table" then 47 | -- deviation: assume that table is an array, to avoid the expensive 48 | -- `isArray` check. In DEV mode, we throw if it is given an object-like 49 | -- table. 50 | if _G.__DEV__ then 51 | if not isArray(value) then 52 | error(RECEIVED_OBJECT_ERROR) 53 | end 54 | end 55 | for k = 1, #value do 56 | elementCount += 1 57 | array[elementCount] = value[k] 58 | end 59 | else 60 | elementCount += 1 61 | array[elementCount] = value 62 | end 63 | end 64 | 65 | return (array :: any) :: Array & Array 66 | end 67 | 68 | return concat 69 | -------------------------------------------------------------------------------- /modules/Collections/src/Array/splice.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | * Copyright (c) Roblox Corporation. All rights reserved. 3 | * Licensed under the MIT License (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * https://opensource.org/licenses/MIT 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | ]] 15 | --!strict 16 | local Array = script.Parent 17 | local Packages = Array.Parent.Parent 18 | local types = require(Packages.ES7Types) 19 | type Array = types.Array 20 | 21 | -- Implements equivalent functionality to JavaScript's `array.splice`, including 22 | -- the interface and behaviors defined at: 23 | -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice 24 | return function(array: Array, start: number, deleteCount: number?, ...: T): Array 25 | -- Append varargs without removing anything 26 | if start > #array then 27 | local varargCount = select("#", ...) 28 | for i = 1, varargCount do 29 | local toInsert = select(i, ...) 30 | table.insert(array, toInsert) 31 | end 32 | return {} 33 | else 34 | local length = #array 35 | -- In the JS impl, a negative fromIndex means we should use length - 36 | -- index; with Lua, of course, this means that 0 is still valid, but 37 | -- refers to the end of the array the way that '-1' would in JS 38 | if start < 1 then 39 | start = math.max(length - math.abs(start), 1) 40 | end 41 | 42 | local deletedItems = {} :: Array 43 | -- If no deleteCount was provided, we want to delete the rest of the 44 | -- array starting with `start` 45 | local deleteCount_: number = deleteCount or length 46 | if deleteCount_ > 0 then 47 | local lastIndex = math.min(length, start + math.max(0, deleteCount_ - 1)) 48 | 49 | for i = start, lastIndex do 50 | local deleted = table.remove(array, start) :: T 51 | table.insert(deletedItems, deleted) 52 | end 53 | end 54 | 55 | local varargCount = select("#", ...) 56 | -- Do this in reverse order so we can always insert in the same spot 57 | for i = varargCount, 1, -1 do 58 | local toInsert = select(i, ...) 59 | table.insert(array, start, toInsert) 60 | end 61 | 62 | return deletedItems 63 | end 64 | end 65 | --------------------------------------------------------------------------------