diff --git a/.darklua-dev.json b/.darklua-dev.json new file mode 100644 index 00000000..f3e217a3 --- /dev/null +++ b/.darklua-dev.json @@ -0,0 +1,29 @@ +{ + "process": [ + { + "rule": "inject_global_value", + "identifier": "__DEV__", + "value": true + }, + { + "rule": "convert_require", + "current": { + "name": "path", + "sources": { + "@pkg": "node_modules/.luau-aliases" + } + }, + "target": { + "name": "roblox", + "rojo_sourcemap": "./sourcemap.json", + "indexing_style": "wait_for_child" + } + }, + "compute_expression", + "remove_unused_if_branch", + "remove_unused_while", + "filter_after_early_return", + "remove_nil_declaration", + "remove_empty_do" + ] +} diff --git a/.darklua-wally.json b/.darklua-wally.json new file mode 100644 index 00000000..b6101b9e --- /dev/null +++ b/.darklua-wally.json @@ -0,0 +1,24 @@ +{ + "process": [ + { + "rule": "convert_require", + "current": { + "name": "path", + "sources": { + "@pkg": "." + } + }, + "target": { + "name": "roblox", + "indexing_style": "wait_for_child", + "rojo_sourcemap": "./sourcemap.json" + } + }, + "compute_expression", + "remove_unused_if_branch", + "remove_unused_while", + "filter_after_early_return", + "remove_nil_declaration", + "remove_empty_do" + ] +} diff --git a/.darklua.json b/.darklua.json new file mode 100644 index 00000000..6d599d65 --- /dev/null +++ b/.darklua.json @@ -0,0 +1,29 @@ +{ + "process": [ + { + "rule": "inject_global_value", + "identifier": "__DEV__", + "value": false + }, + { + "rule": "convert_require", + "current": { + "name": "path", + "sources": { + "@pkg": "node_modules/.luau-aliases" + } + }, + "target": { + "name": "roblox", + "rojo_sourcemap": "./sourcemap.json", + "indexing_style": "wait_for_child" + } + }, + "compute_expression", + "remove_unused_if_branch", + "remove_unused_while", + "filter_after_early_return", + "remove_nil_declaration", + "remove_empty_do" + ] +} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..b109ce77 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,212 @@ +name: Release + +on: + workflow_dispatch: + inputs: + release_tag: + description: "The version to release starting with `v`" + required: true + type: string + + release_ref: + description: "The branch, tag or SHA to checkout (default to latest)" + default: "" + type: string + +permissions: + contents: write + +jobs: + publish-package: + name: Publish package + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v3 + with: + node-version: "latest" + cache: "yarn" + cache-dependency-path: "yarn.lock" + + - name: Update yarn + run: yarn set version stable + + - name: Install packages + run: yarn install --immutable + + - name: Run npmluau + run: yarn run prepare + + - name: Authenticate yarn + run: | + yarn config set npmAlwaysAuth true + yarn config set npmScopes.jsdotlua.npmAuthToken $NPM_AUTH_TOKEN + env: + NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - run: yarn workspaces foreach --all --no-private npm publish --access public + + publish-wally-package: + needs: publish-package + + name: Publish wally package + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: Roblox/setup-foreman@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - uses: actions/setup-node@v3 + with: + node-version: "latest" + cache: "yarn" + cache-dependency-path: "yarn.lock" + + - name: Update yarn + run: yarn set version stable + + - name: Install packages + run: yarn install --immutable + + - name: Run npmluau + run: yarn run prepare + + - name: Build assets + run: yarn run build-assets + + - name: Login to wally + run: wally login --project-path build/wally/shared --token ${{ secrets.WALLY_ACCESS_TOKEN }} + + - name: Publish shared to wally + run: wally publish --project-path build/wally/shared + + - name: Publish scheduler to wally + run: wally publish --project-path build/wally/scheduler + + - name: Publish react-is to wally + run: wally publish --project-path build/wally/react-is + + - name: Publish react to wally + run: wally publish --project-path build/wally/react + + - name: Publish react-cache to wally + run: wally publish --project-path build/wally/react-cache + + - name: Publish react-reconciler to wally + run: wally publish --project-path build/wally/react-reconciler + + - name: Publish react-roblox to wally + run: wally publish --project-path build/wally/react-roblox + + - name: Publish react-test-renderer to wally + run: wally publish --project-path build/wally/react-test-renderer + + - name: Publish react-shallow-renderer to wally + run: wally publish --project-path build/wally/react-shallow-renderer + + - name: Publish roact-compat to wally + run: wally publish --project-path build/wally/roact-compat + + - name: Publish react-devtools-shared to wally + run: wally publish --project-path build/wally/react-devtools-shared + + - name: Publish react-debug-tools to wally + run: wally publish --project-path build/wally/react-debug-tools + + - name: Publish react-devtools-extensions to wally + run: wally publish --project-path build/wally/react-devtools-extensions + + + create-release: + needs: publish-package + + name: Create release + runs-on: ubuntu-latest + + outputs: + upload_url: ${{ steps.create_release.outputs.upload_url }} + + steps: + - uses: actions/checkout@v4 + + - name: Create tag + run: | + git fetch --tags --no-recurse-submodules + if [ ! $(git tag -l ${{ inputs.release_tag }}) ]; then + git tag ${{ inputs.release_tag }} + git push origin ${{ inputs.release_tag }} + fi + + - name: Create release + id: create_release + uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ inputs.release_tag }} + name: ${{ inputs.release_tag }} + draft: false + + build-assets: + needs: create-release + + name: Add assets + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + include: + - artifact-name: react-lua.rbxm + path: build/react-lua.rbxm + asset-type: application/octet-stream + + - artifact-name: react-lua-dev.rbxm + path: build/debug/react-lua.rbxm + asset-type: application/octet-stream + + steps: + - uses: actions/checkout@v4 + + - uses: Roblox/setup-foreman@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - uses: actions/setup-node@v3 + with: + node-version: "latest" + cache: "yarn" + cache-dependency-path: "yarn.lock" + + - name: Update yarn + run: yarn set version stable + + - name: Install packages + run: yarn install --immutable + + - name: Run npmluau + run: yarn run prepare + + - name: Build assets + run: yarn run build-assets + + - name: Upload asset + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.artifact-name }} + path: ${{ matrix.path }} + + - name: Add asset to Release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create-release.outputs.upload_url }} + asset_path: ${{ matrix.path }} + asset_name: ${{ matrix.artifact-name }} + asset_content_type: ${{ matrix.asset-type }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..63a02c95 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,45 @@ +name: Tests + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + test: + name: Run tests + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: Roblox/setup-foreman@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - uses: actions/setup-node@v3 + with: + node-version: "latest" + cache: "yarn" + cache-dependency-path: "yarn.lock" + + - name: Update yarn + run: yarn set version stable + + - name: Install packages + run: yarn install --immutable + + - name: Run npmluau + run: yarn run prepare + + - name: Run linter + run: yarn run lint + + - name: Verify code style + run: yarn run style-check + + - name: Build assets + run: yarn run build-assets diff --git a/.gitignore b/.gitignore index 1e923871..2d96e898 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,11 @@ site/ default_modules modules_* + +.yarn +/*.tgz + +**/sourcemap.json +**/node_modules +/build +/roblox diff --git a/.npmignore b/.npmignore new file mode 100644 index 00000000..3d28e3e0 --- /dev/null +++ b/.npmignore @@ -0,0 +1,33 @@ +/.* +/bin +/Packages +**/.robloxrc +rotriever.toml + +/.github/ +/.vscode/ + +/roblox +/build + +/*.json +/*.toml +/*.yml +/*.md +/*.tgz + +/globalTypes.d.lua +**/sourcemap.json +**/*.project.json + +**/__tests__ +**/*.test.lua +**/*.spec.lua +**/jest.config.lua + +**/*.rbxl +**/*.rbxlx +**/*.rbxl.lock +**/*.rbxlx.lock +**/*.rbxm +**/*.rbxmx diff --git a/.yarnrc.yml b/.yarnrc.yml new file mode 100644 index 00000000..3186f3f0 --- /dev/null +++ b/.yarnrc.yml @@ -0,0 +1 @@ +nodeLinker: node-modules diff --git a/default.project.json b/default.project.json new file mode 100644 index 00000000..7ec90a40 --- /dev/null +++ b/default.project.json @@ -0,0 +1,9 @@ +{ + "name": "ReactLua", + "tree": { + "$path": "roblox-model", + "node_modules": { + "$path": "node_modules" + } + } +} \ No newline at end of file diff --git a/foreman.toml b/foreman.toml index fcb5d36a..9ce7b7bd 100644 --- a/foreman.toml +++ b/foreman.toml @@ -1,4 +1,8 @@ [tools] rojo = { source = "rojo-rbx/rojo", version = "7.3.0" } selene = { source = "Kampfkarren/selene", version = "0.26.1" } -stylua = { source = "JohnnyMorganz/StyLua", version = "0.19.1" } +stylua = { source = "JohnnyMorganz/StyLua", version = "=0.15.1" } +wally = { github = "UpliftGames/wally", version = "=0.3.2" } +luau-lsp = { github = "johnnymorganz/luau-lsp", version = "=1.23.0"} +darklua = { github = "seaofvoices/darklua", version = "=0.12.1" } +lune = { github = "filiptibell/lune", version = "0.7.11" } diff --git a/modules/TestRunner/default.project.json b/modules/TestRunner/default.project.json index 5d3bb4db..6a2165f9 100644 --- a/modules/TestRunner/default.project.json +++ b/modules/TestRunner/default.project.json @@ -1,5 +1,5 @@ { - "name": "TestRunner", + "name": "test-runner", "tree": { "Src": { "$path": "src" diff --git a/modules/jest-react/.npmignore b/modules/jest-react/.npmignore new file mode 100644 index 00000000..835df8f5 --- /dev/null +++ b/modules/jest-react/.npmignore @@ -0,0 +1,26 @@ +**/.robloxrc +rotriever.toml + +/roblox +/build + +.darklua* +.luau-analyze.json +.luaurc +default.project.json + +/globalTypes.d.lua +**/sourcemap.json +**/*.project.json + +**/__tests__ +**/*.test.lua +**/*.spec.lua +**/jest.config.lua + +**/*.rbxl +**/*.rbxlx +**/*.rbxl.lock +**/*.rbxlx.lock +**/*.rbxm +**/*.rbxmx diff --git a/modules/jest-react/default.project.json b/modules/jest-react/default.project.json index 6e5f73d5..8ba79527 100644 --- a/modules/jest-react/default.project.json +++ b/modules/jest-react/default.project.json @@ -1,5 +1,5 @@ { - "name": "JestReact", + "name": "jest-react", "tree": { "$path": "src" } diff --git a/modules/jest-react/src/JestReact.lua b/modules/jest-react/src/JestReact.lua index 9682eafd..3eabfcf7 100644 --- a/modules/jest-react/src/JestReact.lua +++ b/modules/jest-react/src/JestReact.lua @@ -5,8 +5,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. ]] -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array -- ROBLOX deviation START: not used -- local Boolean = LuauPolyfill.Boolean @@ -14,19 +13,19 @@ local Array = LuauPolyfill.Array local Object = LuauPolyfill.Object local exports = {} -- ROBLOX deviation START: fix import --- local JestGlobals = require(Packages.Dev.JestGlobals) -local JestGlobals = require(Packages.JestGlobals) +-- local JestGlobals = require("@pkg/@jsdotlua/jest-globals") +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local expect = JestGlobals.expect -- ROBLOX deviation END -- ROBLOX deviation START: fix import -- local sharedReactSymbolsModule = require(Packages.shared.ReactSymbols) -local sharedReactSymbolsModule = require(Packages.Shared).ReactSymbols +local sharedReactSymbolsModule = require("@pkg/@jsdotlua/shared").ReactSymbols -- ROBLOX deviation END local REACT_ELEMENT_TYPE = sharedReactSymbolsModule.REACT_ELEMENT_TYPE local REACT_FRAGMENT_TYPE = sharedReactSymbolsModule.REACT_FRAGMENT_TYPE -- ROBLOX deviation START: fix import --- local invariant = require(Packages.shared.invariant).default -local invariant = require(Packages.Shared).invariant +-- local invariant = require("@pkg/@jsdotlua/shared").default +local invariant = require("@pkg/@jsdotlua/shared").invariant -- ROBLOX deviation END -- ROBLOX deviation START: predeclare variables local jsonChildToJSXChild, jsonChildrenToJSXChildren diff --git a/modules/jest-react/src/init.lua b/modules/jest-react/src/init.lua index 2ba651cb..e52fdf43 100644 --- a/modules/jest-react/src/init.lua +++ b/modules/jest-react/src/init.lua @@ -5,12 +5,11 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. ]] -local Packages = script.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Object = LuauPolyfill.Object local exports = {} -- ROBLOX deviation START: extract to variable, fix import and export type -- Object.assign(exports, require(script.src.JestReact)) -local jestReactModule = Object.assign(exports, require(script.JestReact)) +local jestReactModule = Object.assign(exports, require("./JestReact")) return exports :: typeof(exports) & typeof(jestReactModule) -- ROBLOX deviation END diff --git a/modules/react-cache/.npmignore b/modules/react-cache/.npmignore new file mode 100644 index 00000000..835df8f5 --- /dev/null +++ b/modules/react-cache/.npmignore @@ -0,0 +1,26 @@ +**/.robloxrc +rotriever.toml + +/roblox +/build + +.darklua* +.luau-analyze.json +.luaurc +default.project.json + +/globalTypes.d.lua +**/sourcemap.json +**/*.project.json + +**/__tests__ +**/*.test.lua +**/*.spec.lua +**/jest.config.lua + +**/*.rbxl +**/*.rbxlx +**/*.rbxl.lock +**/*.rbxlx.lock +**/*.rbxm +**/*.rbxmx diff --git a/modules/react-cache/default.project.json b/modules/react-cache/default.project.json index df2d6ece..9df2b5be 100644 --- a/modules/react-cache/default.project.json +++ b/modules/react-cache/default.project.json @@ -1,5 +1,5 @@ { - "name": "ReactCache", + "name": "react-cache", "tree": { "$path": "src" } diff --git a/modules/react-cache/package.json b/modules/react-cache/package.json new file mode 100644 index 00000000..d08588ac --- /dev/null +++ b/modules/react-cache/package.json @@ -0,0 +1,23 @@ +{ + "name": "@jsdotlua/react-cache", + "version": "17.0.2", + "repository": { + "type": "git", + "url": "https://github.com/jsdotlua/react-lua.git", + "directory": "modules/react-cache" + }, + "license": "MIT", + "main": "src/init.lua", + "scripts": { + "prepare": "npmluau" + }, + "dependencies": { + "@jsdotlua/luau-polyfill": "^1.2.6", + "@jsdotlua/react": "workspace:^", + "@jsdotlua/scheduler": "workspace:^", + "@jsdotlua/shared": "workspace:^" + }, + "devDependencies": { + "npmluau": "^0.1.0" + } +} diff --git a/modules/react-cache/src/LRU.lua b/modules/react-cache/src/LRU.lua index 5907c8cd..71b7eb40 100644 --- a/modules/react-cache/src/LRU.lua +++ b/modules/react-cache/src/LRU.lua @@ -7,13 +7,12 @@ * * @flow ]] -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") type Object = LuauPolyfill.Object local exports = {} -- ROBLOX deviation START: fix import --- local Scheduler = require(Packages.scheduler) -- Intentionally not named imports because Rollup would -local Scheduler = require(Packages.Scheduler) +-- local Scheduler = require("@pkg/@jsdotlua/scheduler") -- Intentionally not named imports because Rollup would +local Scheduler = require("@pkg/@jsdotlua/scheduler") -- ROBLOX deviation END -- use dynamic dispatch for CommonJS interop named imports. local scheduleCallback, IdlePriority = diff --git a/modules/react-cache/src/ReactCacheOld.lua b/modules/react-cache/src/ReactCacheOld.lua index d5603252..f3cebdc4 100644 --- a/modules/react-cache/src/ReactCacheOld.lua +++ b/modules/react-cache/src/ReactCacheOld.lua @@ -7,8 +7,7 @@ * * @flow ]] -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") -- ROBLOX deviation START: unnecessary import -- local Boolean = LuauPolyfill.Boolean -- ROBLOX deviation END @@ -21,7 +20,7 @@ local inspect = LuauPolyfill.util.inspect -- ROBLOX deviation END -- ROBLOX deviation START: use console from React Shared -- local console = LuauPolyfill.console -local console = require(Packages.Shared).console +local console = require("@pkg/@jsdotlua/shared").console -- ROBLOX deviation END type Map = LuauPolyfill.Map local exports = {} @@ -31,13 +30,13 @@ local deleteEntry -- ROBLOX deviation START: fix import -- local sharedReactTypesModule = require(Packages.shared.ReactTypes) -- type Thenable = sharedReactTypesModule.Thenable -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") type Thenable = ReactTypes.Thenable -- ROBLOX deviation END -local React = require(Packages.React) -local createLRU = require(script.Parent.LRU).createLRU +local React = require("@pkg/@jsdotlua/react") +local createLRU = require("./LRU").createLRU -- ROBLOX deviation START: add this type in an attempt to tighten up the types to detect bugs found manually -local LRU = require(script.Parent.LRU) +local LRU = require("./LRU") type Entry = LRU.Entry type Record = { [K]: V } -- ROBLOX deviation END @@ -71,7 +70,7 @@ local Rejected = 2 local ReactCurrentDispatcher = -- ROBLOX deviation START: import from Shared package -- React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher - require(Packages.Shared).ReactSharedInternals.ReactCurrentDispatcher + require("@pkg/@jsdotlua/shared").ReactSharedInternals.ReactCurrentDispatcher -- ROBLOX deviation END local function readContext(Context, observedBits) local dispatcher = ReactCurrentDispatcher.current diff --git a/modules/react-cache/src/__tests__/ReactCacheOld-internal.spec.lua b/modules/react-cache/src/__tests__/ReactCacheOld-internal.spec.lua index 40b3af4d..e2a236e4 100644 --- a/modules/react-cache/src/__tests__/ReactCacheOld-internal.spec.lua +++ b/modules/react-cache/src/__tests__/ReactCacheOld-internal.spec.lua @@ -7,8 +7,7 @@ * * @emails react-core ]] -local Packages = script.Parent.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") -- ROBLOX deviation START: unused imports -- local Array = LuauPolyfill.Array -- local Boolean = LuauPolyfill.Boolean @@ -18,11 +17,8 @@ local LuauPolyfill = require(Packages.LuauPolyfill) type Error = LuauPolyfill.Error -- ROBLOX deviation END local setTimeout = LuauPolyfill.setTimeout --- ROBLOX deviation START: import promise from dev dependencies --- local Promise = require(Packages.Promise) -local Promise = require(Packages.Dev.Promise) --- ROBLOX deviation END -local JestGlobals = require(Packages.Dev.JestGlobals) +local Promise = require("@pkg/@jsdotlua/promise") +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local beforeEach = JestGlobals.beforeEach local describe = JestGlobals.describe local expect = JestGlobals.expect @@ -46,24 +42,24 @@ describe("ReactCache", function() -- ROBLOX deviation END -- ROBLOX deviation START: fix require -- ReactFeatureFlags = require_("shared/ReactFeatureFlags") - ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags + ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags -- ROBLOX deviation END ReactFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback = false -- ROBLOX deviation START: fix require -- React = require_("react") - React = require(Packages.React) + React = require("@pkg/@jsdotlua/react") -- ROBLOX deviation END Suspense = React.Suspense -- ROBLOX deviation START: fix require -- ReactCache = require_("react-cache") - ReactCache = require(script.Parent.Parent) + ReactCache = require(".") -- ROBLOX deviation END createResource = ReactCache.unstable_createResource -- ROBLOX deviation START: fix requires -- ReactTestRenderer = require_("react-test-renderer") -- Scheduler = require_("scheduler") - ReactTestRenderer = require(Packages.Dev.ReactTestRenderer) - Scheduler = require(Packages.Scheduler) + ReactTestRenderer = require("@pkg/@jsdotlua/react-test-renderer") + Scheduler = require("@pkg/@jsdotlua/scheduler") -- ROBLOX deviation END -- ROBLOX deviation START: explicit type -- TextResource = createResource(function(ref0) diff --git a/modules/react-cache/src/init.lua b/modules/react-cache/src/init.lua index 60d74650..9316c5c1 100644 --- a/modules/react-cache/src/init.lua +++ b/modules/react-cache/src/init.lua @@ -9,11 +9,11 @@ ]] -- ROBLOX deviation START: simplify -- local Packages --[[ ROBLOX comment: must define Packages module ]] --- local LuauPolyfill = require(Packages.LuauPolyfill) +-- local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") -- local Object = LuauPolyfill.Object -- local exports = {} -- -- Object.assign(exports, require(script.src.ReactCacheOld)) -- return exports -return require(script.ReactCacheOld) +return require("./ReactCacheOld") -- ROBLOX deviation END diff --git a/modules/react-debug-tools/.npmignore b/modules/react-debug-tools/.npmignore new file mode 100644 index 00000000..835df8f5 --- /dev/null +++ b/modules/react-debug-tools/.npmignore @@ -0,0 +1,26 @@ +**/.robloxrc +rotriever.toml + +/roblox +/build + +.darklua* +.luau-analyze.json +.luaurc +default.project.json + +/globalTypes.d.lua +**/sourcemap.json +**/*.project.json + +**/__tests__ +**/*.test.lua +**/*.spec.lua +**/jest.config.lua + +**/*.rbxl +**/*.rbxlx +**/*.rbxl.lock +**/*.rbxlx.lock +**/*.rbxm +**/*.rbxmx diff --git a/modules/react-debug-tools/package.json b/modules/react-debug-tools/package.json new file mode 100644 index 00000000..2edea765 --- /dev/null +++ b/modules/react-debug-tools/package.json @@ -0,0 +1,22 @@ +{ + "name": "@jsdotlua/react-debug-tools", + "version": "17.0.2", + "repository": { + "type": "git", + "url": "https://github.com/jsdotlua/react-lua.git", + "directory": "modules/react-debug-tools" + }, + "license": "MIT", + "main": "src/init.lua", + "scripts": { + "prepare": "npmluau" + }, + "dependencies": { + "@jsdotlua/luau-polyfill": "^1.2.6", + "@jsdotlua/react-reconciler": "workspace:^", + "@jsdotlua/shared": "workspace:^" + }, + "devDependencies": { + "npmluau": "^0.1.0" + } +} diff --git a/modules/react-debug-tools/src/ReactDebugHooks.lua b/modules/react-debug-tools/src/ReactDebugHooks.lua index a1efd48a..72584691 100644 --- a/modules/react-debug-tools/src/ReactDebugHooks.lua +++ b/modules/react-debug-tools/src/ReactDebugHooks.lua @@ -8,8 +8,7 @@ * @flow ]] type void = nil --[[ ROBLOX FIXME: adding `void` type alias to make it easier to use Luau `void` equivalent when supported ]] -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array -- ROBLOX deviation START: not needed -- local Boolean = LuauPolyfill.Boolean @@ -31,7 +30,7 @@ local exports = {} -- type MutableSourceSubscribeFn = sharedReactTypesModule.MutableSourceSubscribeFn -- type ReactContext = sharedReactTypesModule.ReactContext -- type ReactProviderType = sharedReactTypesModule.ReactProviderType -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") type MutableSource = ReactTypes.MutableSource type MutableSourceGetSnapshotFn = ReactTypes.MutableSourceGetSnapshotFn< Source, @@ -56,23 +55,24 @@ type ReactBindingUpdater = ReactTypes.ReactBindingUpdater -- ROBLOX deviation START: fix import -- local reactReconcilerSrcReactInternalTypesModule = -- require(Packages["react-reconciler"].src.ReactInternalTypes) -local reactReconcilerSrcReactInternalTypesModule = require(Packages.ReactReconciler) +local reactReconcilerSrcReactInternalTypesModule = + require("@pkg/@jsdotlua/react-reconciler") -- ROBLOX deviation END type Fiber = reactReconcilerSrcReactInternalTypesModule.Fiber type DispatcherType = reactReconcilerSrcReactInternalTypesModule.Dispatcher -- ROBLOX deviation START: fix import - import from Shared -- local reactReconcilerSrcReactFiberHostConfigModule = -- require(Packages["react-reconciler"].src.ReactFiberHostConfig) -local reactReconcilerSrcReactFiberHostConfigModule = require(Packages.Shared) +local reactReconcilerSrcReactFiberHostConfigModule = require("@pkg/@jsdotlua/shared") -- ROBLOX deviation END type OpaqueIDType = reactReconcilerSrcReactFiberHostConfigModule.OpaqueIDType -- ROBLOX deviation START: fix import -- local NoMode = require(Packages["react-reconciler"].src.ReactTypeOfMode).NoMode -local ReconcilerModule = require(Packages.ReactReconciler)({}) +local ReconcilerModule = require("@pkg/@jsdotlua/react-reconciler")({}) local NoMode = ReconcilerModule.ReactTypeOfMode.NoMode -- ROBLOX deviation END -- ROBLOX deviation START: add inline ErrorStackParser implementation --- local ErrorStackParser = require(Packages["error-stack-parser"]).default +-- local ErrorStackParser = require("@pkg/error-stack-parser").default type StackFrame = { source: string?, functionName: string?, @@ -99,7 +99,7 @@ local ErrorStackParser = { -- ROBLOX deviation START: import from Shared -- local ReactSharedInternals = require(Packages.shared.ReactSharedInternals).default -- local REACT_OPAQUE_ID_TYPE = require(Packages.shared.ReactSymbols).REACT_OPAQUE_ID_TYPE -local SharedModule = require(Packages.Shared) +local SharedModule = require("@pkg/@jsdotlua/shared") local ReactSharedInternals = SharedModule.ReactSharedInternals local ReactSymbols = SharedModule.ReactSymbols local REACT_OPAQUE_ID_TYPE = ReactSymbols.REACT_OPAQUE_ID_TYPE diff --git a/modules/react-debug-tools/src/ReactDebugTools.lua b/modules/react-debug-tools/src/ReactDebugTools.lua index a218566e..70e75f6b 100644 --- a/modules/react-debug-tools/src/ReactDebugTools.lua +++ b/modules/react-debug-tools/src/ReactDebugTools.lua @@ -8,7 +8,7 @@ * @flow ]] local exports = {} -local reactDebugHooksModule = require(script.Parent.ReactDebugHooks) +local reactDebugHooksModule = require("./ReactDebugHooks") -- ROBLOX deviation START: add re-exporting of types export type HooksNode = reactDebugHooksModule.HooksNode export type HooksTree = reactDebugHooksModule.HooksTree diff --git a/modules/react-debug-tools/src/__tests__/ReactDevToolsHooksIntegration.spec.lua b/modules/react-debug-tools/src/__tests__/ReactDevToolsHooksIntegration.spec.lua index 5fdd600c..9f2fc835 100644 --- a/modules/react-debug-tools/src/__tests__/ReactDevToolsHooksIntegration.spec.lua +++ b/modules/react-debug-tools/src/__tests__/ReactDevToolsHooksIntegration.spec.lua @@ -9,12 +9,12 @@ * @jest-environment node ]] local Packages = script.Parent.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") -- ROBLOX deviation START: not needed -- local Boolean = LuauPolyfill.Boolean -- ROBLOX deviation END local Error = LuauPolyfill.Error -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") -- ROBLOX deviation START: add additional import local afterEach = JestGlobals.afterEach -- ROBLOX deviation END @@ -53,10 +53,10 @@ describe("React hooks DevTools integration", function() -- ReactDebugTools = require_("react-debug-tools") -- ReactTestRenderer = require_("react-test-renderer") -- Scheduler = require_("scheduler") - ReactTestRenderer = require(Packages.Dev.ReactTestRenderer) - React = require(Packages.Dev.React) - ReactDebugTools = require(Packages.ReactDebugTools) - Scheduler = require(Packages.Dev.Scheduler) + ReactTestRenderer = require("@pkg/@jsdotlua/react-test-renderer") + React = require("@pkg/@jsdotlua/react") + ReactDebugTools = require("@pkg/@jsdotlua/react-debug-tools") + Scheduler = require("@pkg/@jsdotlua/scheduler") -- ROBLOX deviation END act = ReactTestRenderer.act end) diff --git a/modules/react-debug-tools/src/__tests__/ReactHooksInspection.spec.lua b/modules/react-debug-tools/src/__tests__/ReactHooksInspection.spec.lua index 3e0ef6ed..23520f81 100644 --- a/modules/react-debug-tools/src/__tests__/ReactHooksInspection.spec.lua +++ b/modules/react-debug-tools/src/__tests__/ReactHooksInspection.spec.lua @@ -10,10 +10,10 @@ ]] local Packages = script.Parent.Parent.Parent -- ROBLOX deviation START: not needed --- local LuauPolyfill = require(Packages.LuauPolyfill) +-- local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") -- local Boolean = LuauPolyfill.Boolean -- ROBLOX deviation END -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local beforeEach = JestGlobals.beforeEach local describe = JestGlobals.describe local expect = JestGlobals.expect @@ -28,8 +28,8 @@ describe("ReactHooksInspection", function() -- ROBLOX deviation START: fix requires -- React = require_("react") -- ReactDebugTools = require_("react-debug-tools") - React = require(Packages.Dev.React) - ReactDebugTools = require(Packages.ReactDebugTools) + React = require("@pkg/@jsdotlua/react") + ReactDebugTools = require("@pkg/@jsdotlua/react-debug-tools") -- ROBLOX deviation END end) it("should inspect a simple useState hook", function() diff --git a/modules/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration.spec.lua b/modules/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration.spec.lua index 8ea71c61..9a60ff9a 100644 --- a/modules/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration.spec.lua +++ b/modules/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration.spec.lua @@ -8,16 +8,15 @@ * @emails react-core * @jest-environment node ]] -local Packages = script.Parent.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") -- ROBLOX deviation START: not needed -- local Boolean = LuauPolyfill.Boolean -- ROBLOX deviation END -- ROBLOX deviation START: import from dev dependencies --- local Promise = require(Packages.Promise) -local Promise = require(Packages.Dev.Promise) +-- local Promise = require("@pkg/@jsdotlua/promise") +local Promise = require("@pkg/@jsdotlua/promise") -- ROBLOX deviation END -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local beforeEach = JestGlobals.beforeEach local describe = JestGlobals.describe local expect = JestGlobals.expect @@ -39,14 +38,14 @@ describe("ReactHooksInspectionIntegration", function() -- React = require_("react") -- ReactTestRenderer = require_("react-test-renderer") -- Scheduler = require_("scheduler") - ReactTestRenderer = require(Packages.Dev.ReactTestRenderer) - Scheduler = require(Packages.Dev.Scheduler) - React = require(Packages.Dev.React) + ReactTestRenderer = require("@pkg/@jsdotlua/react-test-renderer") + Scheduler = require("@pkg/@jsdotlua/scheduler") + React = require("@pkg/@jsdotlua/react") -- ROBLOX deviation END act = ReactTestRenderer.unstable_concurrentAct -- ROBLOX deviation START: fix requires -- ReactDebugTools = require_("react-debug-tools") - ReactDebugTools = require(Packages.ReactDebugTools) + ReactDebugTools = require("@pkg/@jsdotlua/react-debug-tools") -- ROBLOX deviation END end) it("should inspect the current state of useState hooks", function() diff --git a/modules/react-debug-tools/src/init.lua b/modules/react-debug-tools/src/init.lua index 2c07d670..c6857d90 100644 --- a/modules/react-debug-tools/src/init.lua +++ b/modules/react-debug-tools/src/init.lua @@ -7,12 +7,12 @@ ]] -- ROBLOX deviation START: simplify and re-export types -- local Packages --[[ ROBLOX comment: must define Packages module ]] --- local LuauPolyfill = require(Packages.LuauPolyfill) +-- local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") -- local Object = LuauPolyfill.Object -- local exports = {} -- Object.assign(exports, require(script.src.ReactDebugTools)) -- return exports -local reactDebugToolsModule = require(script.ReactDebugTools) +local reactDebugToolsModule = require("./ReactDebugTools") export type HooksNode = reactDebugToolsModule.HooksNode export type HooksTree = reactDebugToolsModule.HooksTree return reactDebugToolsModule diff --git a/modules/react-devtools-extensions/.npmignore b/modules/react-devtools-extensions/.npmignore new file mode 100644 index 00000000..835df8f5 --- /dev/null +++ b/modules/react-devtools-extensions/.npmignore @@ -0,0 +1,26 @@ +**/.robloxrc +rotriever.toml + +/roblox +/build + +.darklua* +.luau-analyze.json +.luaurc +default.project.json + +/globalTypes.d.lua +**/sourcemap.json +**/*.project.json + +**/__tests__ +**/*.test.lua +**/*.spec.lua +**/jest.config.lua + +**/*.rbxl +**/*.rbxlx +**/*.rbxl.lock +**/*.rbxlx.lock +**/*.rbxm +**/*.rbxmx diff --git a/modules/react-devtools-extensions/default.project.json b/modules/react-devtools-extensions/default.project.json index 01014997..c2740df2 100644 --- a/modules/react-devtools-extensions/default.project.json +++ b/modules/react-devtools-extensions/default.project.json @@ -1,5 +1,5 @@ { - "name": "ReactDevtoolsExtensions", + "name": "react-devtools-extensions", "tree": { "$path": "src" } diff --git a/modules/react-devtools-extensions/package.json b/modules/react-devtools-extensions/package.json new file mode 100644 index 00000000..185556a4 --- /dev/null +++ b/modules/react-devtools-extensions/package.json @@ -0,0 +1,24 @@ +{ + "name": "@jsdotlua/react-devtools-extensions", + "version": "17.0.2", + "repository": { + "type": "git", + "url": "https://github.com/jsdotlua/react-lua.git", + "directory": "modules/react-devtools-extensions" + }, + "license": "MIT", + "main": "src/init.lua", + "scripts": { + "prepare": "npmluau" + }, + "dependencies": { + "@jsdotlua/luau-polyfill": "^1.2.6", + "@jsdotlua/react": "workspace:^", + "@jsdotlua/react-devtools-shared": "workspace:^", + "@jsdotlua/react-roblox": "workspace:^", + "@jsdotlua/shared": "workspace:^" + }, + "devDependencies": { + "npmluau": "^0.1.0" + } +} diff --git a/modules/react-devtools-extensions/src/__tests__/devtools-integration.roblox.spec.lua b/modules/react-devtools-extensions/src/__tests__/devtools-integration.roblox.spec.lua index ceaa0f01..fa7bb32f 100644 --- a/modules/react-devtools-extensions/src/__tests__/devtools-integration.roblox.spec.lua +++ b/modules/react-devtools-extensions/src/__tests__/devtools-integration.roblox.spec.lua @@ -3,8 +3,7 @@ ]] type Function = (...any) -> any? -local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local jest = JestGlobals.jest local describe = JestGlobals.describe @@ -19,11 +18,11 @@ describe("Devtools Integration", function() local React beforeEach(function() - React = require(Packages.React) + React = require("@pkg/@jsdotlua/react") jest.resetModules() jest.useFakeTimers() - local DeveloperTools = require(Packages.Dev.DeveloperTools) - ReactDevtoolsExtensions = require(Packages.ReactDevtoolsExtensions) + local DeveloperTools = require("@pkg//@jsdotlua/developer-tools") + ReactDevtoolsExtensions = require("@pkg/@jsdotlua/react-devtools-extensions") inspector = DeveloperTools.forLibrary("UniversalApp", {}) inspector:initRoact(ReactDevtoolsExtensions) @@ -46,10 +45,10 @@ describe("Devtools Integration", function() itSkipIfNonDEV( "can connect to a Roact tree and inspect its children and child branch nodes", function() - local ReactRoblox = require(Packages.ReactRoblox) + local ReactRoblox = require("@pkg/@jsdotlua/react-roblox") local function act(callback: Function): () - local actTestRenderer = require(Packages.Dev.ReactTestRenderer).act + local actTestRenderer = require("@pkg/@jsdotlua/react-test-renderer").act actTestRenderer(function() callback() diff --git a/modules/react-devtools-extensions/src/backend.lua b/modules/react-devtools-extensions/src/backend.lua index 63c10316..ccda7494 100644 --- a/modules/react-devtools-extensions/src/backend.lua +++ b/modules/react-devtools-extensions/src/backend.lua @@ -1,6 +1,5 @@ -- ROBLOX upstream: https://github.com/facebook/react/blob/v17.0.2/packages/react-devtools-extensions/src/backend.js -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") -- ROBLOX deviation START: not needed -- local Boolean = LuauPolyfill.Boolean -- ROBLOX deviation END @@ -44,7 +43,7 @@ local function setup(hook) -- local Agent = require_("react-devtools-shared/src/backend/agent").default -- local Bridge = require_("react-devtools-shared/src/bridge").default -- local initBackend = require_("react-devtools-shared/src/backend").initBackend - local ReactDevtoolsShared = require(Packages.ReactDevtoolsShared) + local ReactDevtoolsShared = require("@pkg/@jsdotlua/react-devtools-shared") local backend = ReactDevtoolsShared.backend local Agent = backend.agent local Bridge = ReactDevtoolsShared.bridge diff --git a/modules/react-devtools-extensions/src/init.lua b/modules/react-devtools-extensions/src/init.lua index 9ad8478c..3a16f071 100644 --- a/modules/react-devtools-extensions/src/init.lua +++ b/modules/react-devtools-extensions/src/init.lua @@ -1,6 +1,5 @@ -- ROBLOX note: no upstream -- ROBLOX note: The setup function adds the glue required for DeveloperTools to initialize the Roact devtools correctly -local Packages = script.Parent return { setup = function(debugMode: boolean) @@ -13,8 +12,8 @@ return { -- direct mapping between the Inspector tree and the Explorer tree as requested by design. _G.__REACT_DEVTOOLS_COMPONENT_FILTERS__ = {} - local ReactDevtoolsShared = require(Packages.ReactDevtoolsShared) - local setup = require(Packages.ReactDevtoolsExtensions.backend).setup + local ReactDevtoolsShared = require("@pkg/@jsdotlua/react-devtools-shared") + local setup = require("./backend").setup local installHook = ReactDevtoolsShared.hook.installHook local Store = ReactDevtoolsShared.devtools.store @@ -22,14 +21,14 @@ return { installHook(_G) -- ROBLOX note: Ensure that ReactRoblox is loaded after injection so that the ReactHostConfig is populated correctly - require(Packages.React) - require(Packages.ReactRoblox) + require("@pkg/@jsdotlua/react") + require("@pkg/@jsdotlua/react-roblox") local hook = _G.__REACT_DEVTOOLS_GLOBAL_HOOK__ -- ROBLOX note: Make sure that this method was called before ReactRoblox was first required, -- otherwise the profiler will not be enabled for the session. - local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags + local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags if not ReactFeatureFlags.enableSchedulingProfiler then warn( "[DeveloperTools] React was initialized before DeveloperTools. Call inspector.setupReactDevtools before requiring React to enable profiling." diff --git a/modules/react-devtools-shared/.npmignore b/modules/react-devtools-shared/.npmignore new file mode 100644 index 00000000..835df8f5 --- /dev/null +++ b/modules/react-devtools-shared/.npmignore @@ -0,0 +1,26 @@ +**/.robloxrc +rotriever.toml + +/roblox +/build + +.darklua* +.luau-analyze.json +.luaurc +default.project.json + +/globalTypes.d.lua +**/sourcemap.json +**/*.project.json + +**/__tests__ +**/*.test.lua +**/*.spec.lua +**/jest.config.lua + +**/*.rbxl +**/*.rbxlx +**/*.rbxl.lock +**/*.rbxlx.lock +**/*.rbxm +**/*.rbxmx diff --git a/modules/react-devtools-shared/default.project.json b/modules/react-devtools-shared/default.project.json index 6be6fdad..d18baed5 100644 --- a/modules/react-devtools-shared/default.project.json +++ b/modules/react-devtools-shared/default.project.json @@ -1,5 +1,5 @@ { - "name": "ReactDevtoolsShared", + "name": "react-devtools-shared", "tree": { "$path": "src" } diff --git a/modules/react-devtools-shared/package.json b/modules/react-devtools-shared/package.json new file mode 100644 index 00000000..0b553184 --- /dev/null +++ b/modules/react-devtools-shared/package.json @@ -0,0 +1,26 @@ +{ + "name": "@jsdotlua/react-devtools-shared", + "version": "17.0.2", + "repository": { + "type": "git", + "url": "https://github.com/jsdotlua/react-lua.git", + "directory": "modules/react-devtools-shared" + }, + "license": "MIT", + "main": "src/init.lua", + "scripts": { + "prepare": "npmluau" + }, + "dependencies": { + "@jsdotlua/luau-polyfill": "^1.2.6", + "@jsdotlua/react": "workspace:^", + "@jsdotlua/react-debug-tools": "workspace:^", + "@jsdotlua/react-is": "workspace:^", + "@jsdotlua/react-reconciler": "workspace:^", + "@jsdotlua/react-roblox": "workspace:^", + "@jsdotlua/shared": "workspace:^" + }, + "devDependencies": { + "npmluau": "^0.1.0" + } +} diff --git a/modules/react-devtools-shared/src/__tests__/bridge.spec.lua b/modules/react-devtools-shared/src/__tests__/bridge.spec.lua index 9f074ebd..586a5995 100644 --- a/modules/react-devtools-shared/src/__tests__/bridge.spec.lua +++ b/modules/react-devtools-shared/src/__tests__/bridge.spec.lua @@ -6,7 +6,7 @@ * LICENSE file in the root directory of this source tree. ]] local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local describe = JestGlobals.describe local it = JestGlobals.it local beforeEach = JestGlobals.beforeEach @@ -19,7 +19,7 @@ describe("bridge", function() beforeEach(function() jest.resetModules() jest.useFakeTimers() - Bridge = require(script.Parent.Parent.bridge) + Bridge = require("./bridge") end) it("should shutdown properly", function() diff --git a/modules/react-devtools-shared/src/__tests__/console.spec.lua b/modules/react-devtools-shared/src/__tests__/console.spec.lua index df964459..23279e5f 100644 --- a/modules/react-devtools-shared/src/__tests__/console.spec.lua +++ b/modules/react-devtools-shared/src/__tests__/console.spec.lua @@ -6,7 +6,7 @@ * LICENSE file in the root directory of this source tree. ]] local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local describe = JestGlobals.describe local xit = JestGlobals.xit local beforeEach = JestGlobals.beforeEach @@ -30,7 +30,7 @@ local Console = { local React local ReactRoblox -local utils = require(script.Parent.utils) +local utils = require("./utils") describe("console", function() local act @@ -78,8 +78,8 @@ describe("console", function() Console.registerRenderer(internals) end - React = require(Packages.React) - ReactRoblox = require(Packages.ReactRoblox) + React = require("@pkg/@jsdotlua/react") + ReactRoblox = require("@pkg/@jsdotlua/react-roblox") act = utils.act end) diff --git a/modules/react-devtools-shared/src/__tests__/events.spec.lua b/modules/react-devtools-shared/src/__tests__/events.spec.lua index 4b1155d4..353d8f1d 100644 --- a/modules/react-devtools-shared/src/__tests__/events.spec.lua +++ b/modules/react-devtools-shared/src/__tests__/events.spec.lua @@ -9,8 +9,8 @@ -- */ local Packages = script.Parent.Parent.Parent -local Error = require(Packages.LuauPolyfill).Error -local JestGlobals = require(Packages.Dev.JestGlobals) +local Error = require("@pkg/@jsdotlua/luau-polyfill").Error +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local describe = JestGlobals.describe local it = JestGlobals.it local beforeEach = JestGlobals.beforeEach @@ -21,7 +21,7 @@ describe("events", function() local dispatcher beforeEach(function() jest.resetModules() - local EventEmitter = require(script.Parent.Parent.events) + local EventEmitter = require("./events") dispatcher = EventEmitter.new() end) diff --git a/modules/react-devtools-shared/src/__tests__/profilerStore.spec.lua b/modules/react-devtools-shared/src/__tests__/profilerStore.spec.lua index 2703ddf0..2245d2dd 100644 --- a/modules/react-devtools-shared/src/__tests__/profilerStore.spec.lua +++ b/modules/react-devtools-shared/src/__tests__/profilerStore.spec.lua @@ -10,14 +10,14 @@ ]] local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jest = JestGlobals.jest local jestExpect = JestGlobals.expect local xdescribe = JestGlobals.xdescribe local it = JestGlobals.it local beforeEach = JestGlobals.beforeEach -local devtoolsTypes = require(script.Parent.Parent.devtools.types) +local devtoolsTypes = require("./devtools/types") type Store = devtoolsTypes.Store local global = _G @@ -31,16 +31,16 @@ xdescribe("ProfilerStore", function() local act beforeEach(function() - utils = require(script.Parent.utils) + utils = require("./utils") act = utils.act store = global.store store:setCollapseNodesByDefault(false) store:setRecordChangeDescriptions(true) - React = require(Packages.React) - ReactRoblox = require(Packages.ReactRoblox) - LuauPolyfill = require(Packages.LuauPolyfill) + React = require("@pkg/@jsdotlua/react") + ReactRoblox = require("@pkg/@jsdotlua/react-roblox") + LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") utils.beforeEachProfiling() end) diff --git a/modules/react-devtools-shared/src/__tests__/profilingCache.spec.lua b/modules/react-devtools-shared/src/__tests__/profilingCache.spec.lua index 9e676369..5aa33ebe 100644 --- a/modules/react-devtools-shared/src/__tests__/profilingCache.spec.lua +++ b/modules/react-devtools-shared/src/__tests__/profilingCache.spec.lua @@ -10,7 +10,7 @@ ]] local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local xdescribe = JestGlobals.xdescribe local it = JestGlobals.it @@ -18,16 +18,16 @@ local xit = JestGlobals.xit local beforeEach = JestGlobals.beforeEach local afterEach = JestGlobals.afterEach -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Error = LuauPolyfill.Error -local Bridge = require(script.Parent.Parent.bridge) +local Bridge = require("./bridge") type FrontendBridge = Bridge.FrontendBridge -local devtoolsTypes = require(script.Parent.Parent.devtools.types) +local devtoolsTypes = require("./devtools/types") type Store = devtoolsTypes.Store -local ProfilerTypes = require(script.Parent.Parent.devtools.views.Profiler.types) +local ProfilerTypes = require("./devtools/views/Profiler/types") type ProfilingDataFrontend = ProfilerTypes.ProfilingDataFrontend local global = _G @@ -65,7 +65,7 @@ xdescribe("ProfilingCache", function() beforeEach(function() _G.__PROFILE__ = true - utils = require(script.Parent.utils) + utils = require("./utils") act = utils.act bridge = global.bridge @@ -74,9 +74,9 @@ xdescribe("ProfilingCache", function() store:setRecordChangeDescriptions(true) --PropTypes = require_("prop-types") - React = require(Packages.React) - ReactRoblox = require(Packages.ReactRoblox) - Scheduler = require(Packages.Dev.Scheduler) + React = require("@pkg/@jsdotlua/react") + ReactRoblox = require("@pkg/@jsdotlua/react-roblox") + Scheduler = require("@pkg/@jsdotlua/scheduler") SchedulerTracing = Scheduler.tracing utils.beforeEachProfiling() diff --git a/modules/react-devtools-shared/src/__tests__/profilingCharts.spec.lua b/modules/react-devtools-shared/src/__tests__/profilingCharts.spec.lua index c8250e15..8b486ab1 100644 --- a/modules/react-devtools-shared/src/__tests__/profilingCharts.spec.lua +++ b/modules/react-devtools-shared/src/__tests__/profilingCharts.spec.lua @@ -10,7 +10,7 @@ ]] local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local xdescribe = JestGlobals.xdescribe local beforeEach = JestGlobals.beforeEach local afterEach = JestGlobals.afterEach @@ -18,7 +18,7 @@ local describe = JestGlobals.describe local it = JestGlobals.it local jestExpect = JestGlobals.expect -local devtoolsTypes = require(script.Parent.Parent.devtools.types) +local devtoolsTypes = require("./devtools/types") type Store = devtoolsTypes.Store xdescribe("profiling charts", function() @@ -31,15 +31,15 @@ xdescribe("profiling charts", function() local utils beforeEach(function() _G.__PROFILE__ = true - utils = require(script.Parent.utils) + utils = require("./utils") utils.beforeEachProfiling() store = _G.store store:setCollapseNodesByDefault(false) store:setRecordChangeDescriptions(true) - React = require(Packages.React) - ReactRoblox = require(Packages.ReactRoblox) - Scheduler = require(Packages.Dev.Scheduler) + React = require("@pkg/@jsdotlua/react") + ReactRoblox = require("@pkg/@jsdotlua/react-roblox") + Scheduler = require("@pkg/@jsdotlua/scheduler") SchedulerTracing = Scheduler.tracing end) afterEach(function() diff --git a/modules/react-devtools-shared/src/__tests__/profilingCommitTreeBuilder.spec.lua b/modules/react-devtools-shared/src/__tests__/profilingCommitTreeBuilder.spec.lua index bd90e612..0924d485 100644 --- a/modules/react-devtools-shared/src/__tests__/profilingCommitTreeBuilder.spec.lua +++ b/modules/react-devtools-shared/src/__tests__/profilingCommitTreeBuilder.spec.lua @@ -11,13 +11,13 @@ ]] local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local xdescribe = JestGlobals.xdescribe local beforeEach = JestGlobals.beforeEach local it = JestGlobals.it local jestExpect = JestGlobals.expect -local devtoolsTypes = require(script.Parent.Parent.devtools.types) +local devtoolsTypes = require("./devtools/types") type Store = devtoolsTypes.Store local global = _G @@ -31,7 +31,7 @@ xdescribe("commit tree", function() local act beforeEach(function() - utils = require(script.Parent.utils) + utils = require("./utils") act = utils.act utils.beforeEachProfiling() @@ -39,9 +39,9 @@ xdescribe("commit tree", function() store:setCollapseNodesByDefault(false) store:setRecordChangeDescriptions(true) - React = require(Packages.React) - ReactRoblox = require(Packages.ReactRoblox) - Scheduler = require(Packages.Dev.Scheduler) + React = require("@pkg/@jsdotlua/react") + ReactRoblox = require("@pkg/@jsdotlua/react-roblox") + Scheduler = require("@pkg/@jsdotlua/scheduler") end) it("should be able to rebuild the store tree for each commit", function() local function Child() diff --git a/modules/react-devtools-shared/src/__tests__/profilingUtils.spec.lua b/modules/react-devtools-shared/src/__tests__/profilingUtils.spec.lua index a369ee16..467735b1 100644 --- a/modules/react-devtools-shared/src/__tests__/profilingUtils.spec.lua +++ b/modules/react-devtools-shared/src/__tests__/profilingUtils.spec.lua @@ -9,7 +9,7 @@ ]] local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local describe = JestGlobals.describe local it = JestGlobals.it @@ -18,7 +18,7 @@ local beforeEach = JestGlobals.beforeEach describe("profiling utils", function() local utils beforeEach(function() - utils = require(script.Parent.Parent.devtools.views.Profiler.utils) + utils = require("./devtools/views/Profiler/utils") end) it("should throw if importing older/unsupported data", function() jestExpect(function() diff --git a/modules/react-devtools-shared/src/__tests__/setupTests.lua b/modules/react-devtools-shared/src/__tests__/setupTests.lua index aa5c9434..5dbc6aa6 100644 --- a/modules/react-devtools-shared/src/__tests__/setupTests.lua +++ b/modules/react-devtools-shared/src/__tests__/setupTests.lua @@ -8,14 +8,14 @@ * @flow *]] local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local beforeEach = JestGlobals.beforeEach local beforeAll = JestGlobals.beforeAll -local jest = require(Packages.Dev.JestGlobals).jest +local jest = require("@pkg/@jsdotlua/jest-globals").jest local afterEach = JestGlobals.afterEach -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array local global = _G @@ -37,12 +37,12 @@ beforeEach(function() -- rather than imported at the head of the module. -- That's because we reset modules between tests, -- which disconnects the DevTool's cache from the current dispatcher ref. - local Agent = require(script.Parent.Parent.backend.agent) - local initBackend = require(script.Parent.Parent.backend).initBackend - local Bridge = require(script.Parent.Parent.bridge) - local Store = require(script.Parent.Parent.devtools.store) - local installHook = require(script.Parent.Parent.hook).installHook - local utils = require(script.Parent.Parent.utils) + local Agent = require("./backend/agent") + local initBackend = require("./backend").initBackend + local Bridge = require("./bridge") + local Store = require("./devtools/store") + local installHook = require("./hook").installHook + local utils = require("./utils") local getDefaultComponentFilters = utils.getDefaultComponentFilters local saveComponentFilters = utils.saveComponentFilters @@ -81,7 +81,7 @@ beforeEach(function() global.bridge = bridge global.store = store - local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags + local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags ReactFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback = true end) diff --git a/modules/react-devtools-shared/src/__tests__/store.spec.lua b/modules/react-devtools-shared/src/__tests__/store.spec.lua index bdceb04d..bd8c63db 100644 --- a/modules/react-devtools-shared/src/__tests__/store.spec.lua +++ b/modules/react-devtools-shared/src/__tests__/store.spec.lua @@ -17,7 +17,7 @@ local fill = function(count, value) end local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jest = JestGlobals.jest local jestExpect = JestGlobals.expect local describe = JestGlobals.describe @@ -25,8 +25,8 @@ local it = JestGlobals.it local xit = JestGlobals.xit local beforeEach = JestGlobals.beforeEach -local Promise = require(Packages.Dev.Promise) -local LuauPolyfill = require(Packages.LuauPolyfill) +local Promise = require("@pkg/@jsdotlua/promise") +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array local Object = LuauPolyfill.Object @@ -36,7 +36,7 @@ type Array = { [number]: T } local ReactRoblox local React -- ROBLOX deviation: bring in the Agent type -local Agent = require(script.Parent.Parent.backend.agent) +local Agent = require("./backend/agent") type Agent = Agent.Agent describe("Store", function() @@ -51,15 +51,15 @@ describe("Store", function() agent = global.agent store = global.store - React = require(Packages.React) + React = require("@pkg/@jsdotlua/react") jest.resetModules() - ReactRoblox = require(Packages.ReactRoblox) - devtoolsUtils = require(script.Parent.Parent.devtools.utils) - constants = require(script.Parent.Parent.constants) + ReactRoblox = require("@pkg/@jsdotlua/react-roblox") + devtoolsUtils = require("./devtools/utils") + constants = require("./constants") jest.useFakeTimers() - local utils = require(script.Parent.utils) + local utils = require("./utils") act = utils.act getRendererID = utils.getRendererID end) diff --git a/modules/react-devtools-shared/src/__tests__/storeComponentFilters.spec.lua b/modules/react-devtools-shared/src/__tests__/storeComponentFilters.spec.lua index 4d18546c..d8299c53 100644 --- a/modules/react-devtools-shared/src/__tests__/storeComponentFilters.spec.lua +++ b/modules/react-devtools-shared/src/__tests__/storeComponentFilters.spec.lua @@ -11,7 +11,7 @@ type Function = (...any) -> ...any local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jest = JestGlobals.jest local describe = JestGlobals.describe local it = JestGlobals.it @@ -20,9 +20,9 @@ local jestExpect = JestGlobals.expect local global = _G -local bridgeModule = require(script.Parent.Parent.bridge) +local bridgeModule = require("./bridge") type FrontendBridge = bridgeModule.FrontendBridge -local devtoolsTypes = require(script.Parent.Parent.devtools.types) +local devtoolsTypes = require("./devtools/types") type Store = devtoolsTypes.Store describe("Store component filters", function() @@ -50,14 +50,14 @@ describe("Store component filters", function() store:setComponentFilters({}) store:setRecordChangeDescriptions(true) - local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags + local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags ReactFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback = true - React = require(Packages.React) - ReactRoblox = require(Packages.ReactRoblox) - Types = require(script.Parent.Parent.types) - utils = require(script.Parent.utils) - devtoolsUtils = require(script.Parent.Parent.devtools.utils) + React = require("@pkg/@jsdotlua/react") + ReactRoblox = require("@pkg/@jsdotlua/react-roblox") + Types = require("./types") + utils = require("./utils") + devtoolsUtils = require("./devtools/utils") end) it("should throw if filters are updated while profiling", function() diff --git a/modules/react-devtools-shared/src/__tests__/storeOwners.spec.lua b/modules/react-devtools-shared/src/__tests__/storeOwners.spec.lua index bd6ce9ab..662960e9 100644 --- a/modules/react-devtools-shared/src/__tests__/storeOwners.spec.lua +++ b/modules/react-devtools-shared/src/__tests__/storeOwners.spec.lua @@ -10,7 +10,7 @@ ]] local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local describe = JestGlobals.describe local it = JestGlobals.it @@ -34,14 +34,14 @@ describeIfDev("Store owners list", function() store = global.store store:setCollapseNodesByDefault(false) - LuauPolyfill = require(Packages.LuauPolyfill) + LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") Boolean = LuauPolyfill.Boolean - React = require(Packages.React) - ReactRoblox = require(Packages.ReactRoblox) - devtoolsUtils = require(script.Parent.Parent.devtools.utils) + React = require("@pkg/@jsdotlua/react") + ReactRoblox = require("@pkg/@jsdotlua/react-roblox") + devtoolsUtils = require("./devtools/utils") printOwnersList = devtoolsUtils.printOwnersList - local utils = require(script.Parent.utils) + local utils = require("./utils") act = utils.act end) diff --git a/modules/react-devtools-shared/src/__tests__/utils.lua b/modules/react-devtools-shared/src/__tests__/utils.lua index b2ba3a79..90068540 100644 --- a/modules/react-devtools-shared/src/__tests__/utils.lua +++ b/modules/react-devtools-shared/src/__tests__/utils.lua @@ -9,11 +9,11 @@ local HttpService = game:GetService("HttpService") ]] local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jest = JestGlobals.jest local jestExpect = JestGlobals.expect -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array local Number = LuauPolyfill.Number local Object = LuauPolyfill.Object @@ -21,13 +21,13 @@ type Function = (...any) -> any? local global = _G local exports = {} -local Bridge = require(script.Parent.Parent.bridge) +local Bridge = require("./bridge") type FrontendBridge = Bridge.FrontendBridge -local devtoolsTypes = require(script.Parent.Parent.devtools.types) +local devtoolsTypes = require("./devtools/types") type Store = devtoolsTypes.Store -local ProfilerTypes = require(script.Parent.Parent.devtools.views.Profiler.types) +local ProfilerTypes = require("./devtools/views/Profiler/types") type ProfilingDataFrontend = ProfilerTypes.ProfilingDataFrontend -local Types = require(script.Parent.Parent.types) +local Types = require("./types") type ElementType = Types.ElementType exports.act = function(callback: () -> ()): () @@ -35,9 +35,9 @@ exports.act = function(callback: () -> ()): () -- one another right now. All of the ported tests in this package are -- using only the ReactRoblox renderer, so we only wrap with it directly - -- local actTestRenderer = require(Packages.Dev.ReactTestRenderer).act + -- local actTestRenderer = require("@pkg/@jsdotlua/react-test-renderer").act - local actDOM = require(Packages.ReactRoblox).act + local actDOM = require("@pkg/@jsdotlua/react-roblox").act actDOM(function() -- actTestRenderer(function() @@ -62,9 +62,9 @@ exports.actAsync = function(cb: () -> any, recursivelyFlush: boolean?) -- ROBLOX deviation: TestRenderer and RobloxRenderer do not play nice with -- one another right now. All of the ported tests in this package are -- using only the ReactRoblox renderer, so we only wrap with it directly - -- local actTestRenderer = require(Packages.Dev.ReactTestRenderer).act + -- local actTestRenderer = require("@pkg/@jsdotlua/react-test-renderer").act - local actDOM = require(Packages.ReactRoblox).act + local actDOM = require("@pkg/@jsdotlua/react-roblox").act if recursivelyFlush then while jest.getTimerCount() > 0 do @@ -96,7 +96,7 @@ exports.beforeEachProfiling = function(): () -- ROBLOX deviation: os.clock not performance -- ROBLOX TODO: Can you actually spy on os.clock? -- ROBLOX deviation BEGIN: We need to do slightly more targeted mocking until - local Scheduler = require(Packages.Dev.Scheduler) + local Scheduler = require("@pkg/@jsdotlua/scheduler") jest.mockOsClock(Scheduler.unstable_now) -- jest.spyOn(os, "clock").mockImplementation( -- jest.requireActual("scheduler/unstable_mock").unstable_now @@ -184,7 +184,7 @@ exports.requireTestRenderer = function(): any global.__REACT_DEVTOOLS_GLOBAL_HOOK__ = nil local success, module = pcall(function() - return require(Packages.Dev.ReactTestRenderer) + return require("@pkg/@jsdotlua/react-test-renderer") end) global.__REACT_DEVTOOLS_GLOBAL_HOOK__ = hook @@ -198,7 +198,7 @@ exports.requireTestRenderer = function(): any end exports.exportImportHelper = function(bridge: FrontendBridge, store: Store): () - local utils = require(script.Parent.Parent.devtools.views.Profiler.utils) + local utils = require("./devtools/views/Profiler/utils") local prepareProfilingDataExport = utils.prepareProfilingDataExport local prepareProfilingDataFrontendFromExport = utils.prepareProfilingDataFrontendFromExport diff --git a/modules/react-devtools-shared/src/__tests__/utils.spec.lua b/modules/react-devtools-shared/src/__tests__/utils.spec.lua index 4ed365cb..a7e0cde8 100644 --- a/modules/react-devtools-shared/src/__tests__/utils.spec.lua +++ b/modules/react-devtools-shared/src/__tests__/utils.spec.lua @@ -8,26 +8,26 @@ -- * @flow -- */ local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local describe = JestGlobals.describe local it = JestGlobals.it local xit = JestGlobals.xit local beforeEach = JestGlobals.beforeEach -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Symbol = LuauPolyfill.Symbol -local utils = require(script.Parent.Parent.utils) +local utils = require("./utils") local getDisplayName = utils.getDisplayName local getDisplayNameForReactElement = utils.getDisplayNameForReactElement local SuspenseList, StrictMode local createElement beforeEach(function() - local ReactSymbols = require(Packages.Shared).ReactSymbols + local ReactSymbols = require("@pkg/@jsdotlua/shared").ReactSymbols SuspenseList = ReactSymbols.REACT_SUSPENSE_LIST_TYPE StrictMode = ReactSymbols.REACT_STRICT_MODE_TYPE - local React = require(Packages.React) + local React = require("@pkg/@jsdotlua/react") createElement = React.createElement end) diff --git a/modules/react-devtools-shared/src/backend/agent.lua b/modules/react-devtools-shared/src/backend/agent.lua index f0dd7ae2..730f70a8 100644 --- a/modules/react-devtools-shared/src/backend/agent.lua +++ b/modules/react-devtools-shared/src/backend/agent.lua @@ -6,8 +6,7 @@ * LICENSE file in the root directory of this source tree. ]] -local Packages = script.Parent.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") type Set = LuauPolyfill.Set local console = LuauPolyfill.console local JSON = game:GetService("HttpService") @@ -16,46 +15,46 @@ type Function = (...any) -> ...any type Array = { [number]: T } type Object = { [string]: any } -local EventEmitter = require(script.Parent.Parent.events) +local EventEmitter = require("../events") type EventEmitter = EventEmitter.EventEmitter -- ROBLOX FIXME: need to implement lodash.throttle, pass through for now -- import throttle from 'lodash.throttle'; local throttle = function(fn: Function, _limit: number): Function return fn end -local constants = require(script.Parent.Parent.constants) +local constants = require("../constants") local SESSION_STORAGE_LAST_SELECTION_KEY = constants.SESSION_STORAGE_LAST_SELECTION_KEY local SESSION_STORAGE_RELOAD_AND_PROFILE_KEY = constants.SESSION_STORAGE_RELOAD_AND_PROFILE_KEY local SESSION_STORAGE_RECORD_CHANGE_DESCRIPTIONS_KEY = constants.SESSION_STORAGE_RECORD_CHANGE_DESCRIPTIONS_KEY local __DEBUG__ = constants.__DEBUG__ -local storage = require(script.Parent.Parent.storage) +local storage = require("../storage") local sessionStorageGetItem = storage.sessionStorageGetItem local sessionStorageRemoveItem = storage.sessionStorageRemoveItem local sessionStorageSetItem = storage.sessionStorageSetItem --- local Highlighter = require(script.Parent.views.Highlighter) +-- local Highlighter = require("./views/Highlighter") -- local setupHighlighter = Highlighter.default -- ROBLOX TODO: stub for now local setupHighlighter = function(bridge, agent) end --- local TraceUpdates = require(script.Parent.views.TraceUpdates) +-- local TraceUpdates = require("./views/TraceUpdates") -- local setupTraceUpdates = TraceUpdates.initialize -- local setTraceUpdatesEnabled = TraceUpdates.toggleEnabled -- ROBLOX TODO: stub these for now local setupTraceUpdates = function(agent) end local setTraceUpdatesEnabled = function(enabled: boolean) end --- local console = require(script.Parent.console) +-- local console = require("./console") -- local patchConsole = console.patch -- local unpatchConsole = console.unpatch -- ROBLOX TODO: stub these for now. they're used to force the debugger to break immediately when console.error is called local patchConsole = function(obj) end local unpatchConsole = function() end -local Bridge = require(script.Parent.Parent.bridge) +local Bridge = require("../bridge") type BackendBridge = Bridge.BackendBridge -local BackendTypes = require(script.Parent.types) +local BackendTypes = require("./types") type InstanceAndStyle = BackendTypes.InstanceAndStyle type NativeType = BackendTypes.NativeType type OwnersList = BackendTypes.OwnersList @@ -64,7 +63,7 @@ type PathMatch = BackendTypes.PathMatch type RendererID = BackendTypes.RendererID type RendererInterface = BackendTypes.RendererInterface -local SharedTypes = require(script.Parent.Parent.types) +local SharedTypes = require("../types") type ComponentFilter = SharedTypes.ComponentFilter local debug_ = function(methodName, ...) diff --git a/modules/react-devtools-shared/src/backend/console.lua b/modules/react-devtools-shared/src/backend/console.lua index e1581fab..0a983ceb 100644 --- a/modules/react-devtools-shared/src/backend/console.lua +++ b/modules/react-devtools-shared/src/backend/console.lua @@ -8,7 +8,7 @@ -- * @flow -- */ -local Types = require(script.Parent.types) +local Types = require("./types") type ReactRenderer = Types.ReactRenderer local exports = {} diff --git a/modules/react-devtools-shared/src/backend/init.lua b/modules/react-devtools-shared/src/backend/init.lua index 8bc63eb7..c9dc49b9 100644 --- a/modules/react-devtools-shared/src/backend/init.lua +++ b/modules/react-devtools-shared/src/backend/init.lua @@ -7,14 +7,13 @@ * LICENSE file in the root directory of this source tree. ]] -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array -local Agent = require(script.agent) +local Agent = require("./agent") type Agent = Agent.Agent -local types = require(script.types) +local types = require("./types") export type DevToolsHook = types.DevToolsHook export type ReactRenderer = types.ReactRenderer export type RendererInterface = types.RendererInterface @@ -57,7 +56,7 @@ local function initBackend(hook: DevToolsHook, agent: Agent, global: Object): () local attachRenderer = function(id: number, renderer: ReactRenderer) -- ROBLOX deviation: require attach lazily to avoid the require of renderer causing Roact to initialize prematurely. - local attach = require(script.renderer).attach + local attach = require("./renderer").attach local rendererInterface = hook.rendererInterfaces:get(id) @@ -131,8 +130,8 @@ end return { initBackend = initBackend, - agent = require(script.agent), + agent = require("./agent"), NativeStyleEditor = { - types = require(script.NativeStyleEditor.types), + types = require("./NativeStyleEditor/types"), }, } diff --git a/modules/react-devtools-shared/src/backend/renderer.lua b/modules/react-devtools-shared/src/backend/renderer.lua index ca3e6a85..82d84f10 100644 --- a/modules/react-devtools-shared/src/backend/renderer.lua +++ b/modules/react-devtools-shared/src/backend/renderer.lua @@ -7,10 +7,8 @@ * LICENSE file in the root directory of this source tree. ]] -local Packages = script.Parent.Parent.Parent - -local LuauPolyfill = require(Packages.LuauPolyfill) -local Shared = require(Packages.Shared) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") +local Shared = require("@pkg/@jsdotlua/shared") local console = Shared.console local Map = LuauPolyfill.Map local Set = LuauPolyfill.Set @@ -31,12 +29,12 @@ type Object = LuauPolyfill.Object local window = _G local exports = {} -local invariant = require(Packages.Shared).invariant +local invariant = require("@pkg/@jsdotlua/shared").invariant -- ROBLOX deviation: we don't currently need semver, as we only support one version of React -- local semver = require(semver) -- local gte = semver.gte -local types = require(script.Parent.Parent.types) +local types = require("./types") local ComponentFilterDisplayName = types.ComponentFilterDisplayName local ComponentFilterElementType = types.ComponentFilterElementType local ComponentFilterHOC = types.ComponentFilterHOC @@ -52,7 +50,7 @@ local ElementTypeProfiler = types.ElementTypeProfiler local ElementTypeRoot = types.ElementTypeRoot local ElementTypeSuspense = types.ElementTypeSuspense local ElementTypeSuspenseList = types.ElementTypeSuspenseList -local utils = require(script.Parent.Parent.utils) +local utils = require("./utils") local deletePathInObject = utils.deletePathInObject local getDisplayName = utils.getDisplayName local getDefaultComponentFilters = utils.getDefaultComponentFilters @@ -62,15 +60,15 @@ local renamePathInObject = utils.renamePathInObject local setInObject = utils.setInObject -- ROBLOX deviation: Don't encode strings -- local utfEncodeString = utils.utfEncodeString -local storage = require(script.Parent.Parent.storage) +local storage = require("../storage") local sessionStorageGetItem = storage.sessionStorageGetItem -local backendUtils = require(script.Parent.utils) +local backendUtils = require("./utils") local cleanForBridge = backendUtils.cleanForBridge local copyToClipboard = backendUtils.copyToClipboard local copyWithDelete = backendUtils.copyWithDelete local copyWithRename = backendUtils.copyWithRename local copyWithSet = backendUtils.copyWithSet -local constants = require(script.Parent.Parent.constants) +local constants = require("../constants") local __DEBUG__ = constants.__DEBUG__ local SESSION_STORAGE_RELOAD_AND_PROFILE_KEY = constants.SESSION_STORAGE_RELOAD_AND_PROFILE_KEY @@ -81,12 +79,12 @@ local TREE_OPERATION_REMOVE = constants.TREE_OPERATION_REMOVE local TREE_OPERATION_REORDER_CHILDREN = constants.TREE_OPERATION_REORDER_CHILDREN local TREE_OPERATION_UPDATE_TREE_BASE_DURATION = constants.TREE_OPERATION_UPDATE_TREE_BASE_DURATION -local ReactDebugTools = require(Packages.ReactDebugTools) +local ReactDebugTools = require("@pkg/@jsdotlua/react-debug-tools") local inspectHooksOfFiber = ReactDebugTools.inspectHooksOfFiber -local Console = require(script.Parent.console) +local Console = require("./console") local patchConsole = Console.patch local registerRendererWithConsole = Console.registerRenderer -local ReactSymbols = require(script.Parent.ReactSymbols) +local ReactSymbols = require("./ReactSymbols") local CONCURRENT_MODE_NUMBER = ReactSymbols.CONCURRENT_MODE_NUMBER local CONCURRENT_MODE_SYMBOL_STRING = ReactSymbols.CONCURRENT_MODE_SYMBOL_STRING local DEPRECATED_ASYNC_MODE_SYMBOL_STRING = @@ -107,15 +105,15 @@ local MEMO_NUMBER = ReactSymbols.MEMO_NUMBER local MEMO_SYMBOL_STRING = ReactSymbols.MEMO_SYMBOL_STRING local is = Shared.objectIs -- ROBLOX FIXME: pass in a real host config, or make this able to use basic enums without initializing -local ReactReconciler = require(Packages.ReactReconciler)({}) +local ReactReconciler = require("@pkg/@jsdotlua/react-reconciler")({}) -- ROBLOX deviation: Require shared functionality rather than copying and pasting it inline local getNearestMountedFiber = ReactReconciler.getNearestMountedFiber -- ROBLOX deviation: ReactInternalTypes is re-exported from top-level reconciler to respect the module encapsulation boundary -local ReactInternalTypes = require(Packages.ReactReconciler) +local ReactInternalTypes = require("@pkg/@jsdotlua/react-reconciler") type Fiber = ReactInternalTypes.Fiber -local BackendTypes = require(script.Parent.types) +local BackendTypes = require("./types") type ChangeDescription = BackendTypes.ChangeDescription type CommitDataBackend = BackendTypes.CommitDataBackend type DevToolsHook = BackendTypes.DevToolsHook @@ -132,9 +130,9 @@ type ReactRenderer = BackendTypes.ReactRenderer type RendererInterface = BackendTypes.RendererInterface type WorkTagMap = BackendTypes.WorkTagMap -local ProfilerTypes = require(script.Parent.Parent.devtools.views.Profiler.types) +local ProfilerTypes = require("../devtools/views/Profiler/types") type Interaction = ProfilerTypes.Interaction -local TypesModules = require(script.Parent.Parent.types) +local TypesModules = require("../types") type ComponentFilter = TypesModules.ComponentFilter type ElementType = TypesModules.ElementType diff --git a/modules/react-devtools-shared/src/backend/types.lua b/modules/react-devtools-shared/src/backend/types.lua index 256afea9..821ea615 100644 --- a/modules/react-devtools-shared/src/backend/types.lua +++ b/modules/react-devtools-shared/src/backend/types.lua @@ -8,8 +8,7 @@ -- * @flow -- */ -local Packages = script.Parent.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") type Object = LuauPolyfill.Object type Array = LuauPolyfill.Array type Function = (...any) -> any @@ -19,17 +18,16 @@ type Symbol = Object local exports = {} -- ROBLOX deviation: rotriever re-exports types to the top-level export -local ReactShared = require(Packages.Shared) +local ReactShared = require("@pkg/@jsdotlua/shared") type ReactContext = ReactShared.ReactContext type Source = ReactShared.Source -local ReactInternalTypes = require(Packages.ReactReconciler) +local ReactInternalTypes = require("@pkg/@jsdotlua/react-reconciler") type Fiber = ReactInternalTypes.Fiber -local Types = require(script.Parent.Parent.types) +local Types = require("../types") type ComponentFilter = Types.ComponentFilter type ElementType = Types.ElementType -local DevToolsViewsProfilerTypes = - require(script.Parent.Parent.devtools.views.Profiler.types) +local DevToolsViewsProfilerTypes = require("../devtools/views/Profiler/types") type Interaction = DevToolsViewsProfilerTypes.Interaction type ResolveNativeStyle = (any) -> Object? diff --git a/modules/react-devtools-shared/src/backend/utils.lua b/modules/react-devtools-shared/src/backend/utils.lua index 31ff4f26..960d00cb 100644 --- a/modules/react-devtools-shared/src/backend/utils.lua +++ b/modules/react-devtools-shared/src/backend/utils.lua @@ -5,18 +5,16 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. ]] -local Packages = script.Parent.Parent.Parent - -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Set = LuauPolyfill.Set local Array = LuauPolyfill.Array type Array = LuauPolyfill.Array type Object = LuauPolyfill.Object -local hydration = require(script.Parent.Parent.hydration) +local hydration = require("../hydration") local dehydrate = hydration.dehydrate -local ComponentsTypes = require(script.Parent.Parent.devtools.views.Components.types) +local ComponentsTypes = require("../devtools/views/Components/types") type DehydratedData = ComponentsTypes.DehydratedData -- ROBLOX deviation: Use HttpService for JSON diff --git a/modules/react-devtools-shared/src/bridge.lua b/modules/react-devtools-shared/src/bridge.lua index 0a8785ff..f0adb1f6 100644 --- a/modules/react-devtools-shared/src/bridge.lua +++ b/modules/react-devtools-shared/src/bridge.lua @@ -6,19 +6,18 @@ -- * This source code is licensed under the MIT license found in the -- * LICENSE file in the root directory of this source tree. -- */ -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) -local console = require(Packages.Shared).console +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") +local console = require("@pkg/@jsdotlua/shared").console type Array = { [number]: T } type Function = (...any) -> ...any -local EventEmitter = require(script.Parent.events) +local EventEmitter = require("./events") type EventEmitter = EventEmitter.EventEmitter -local Types = require(script.Parent.types) +local Types = require("./types") type ComponentFilter = Types.ComponentFilter type Wall = Types.Wall -local BackendTypes = require(script.Parent.backend.types) +local BackendTypes = require("./backend/types") type InspectedElementPayload = BackendTypes.InspectedElementPayload type OwnersList = BackendTypes.OwnersList type ProfilingDataBackend = BackendTypes.ProfilingDataBackend diff --git a/modules/react-devtools-shared/src/devtools/ProfilerStore.lua b/modules/react-devtools-shared/src/devtools/ProfilerStore.lua index 0deeed9c..4d37a8d1 100644 --- a/modules/react-devtools-shared/src/devtools/ProfilerStore.lua +++ b/modules/react-devtools-shared/src/devtools/ProfilerStore.lua @@ -8,8 +8,7 @@ * @flow ]] -local Packages = script.Parent.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array local Map = LuauPolyfill.Map local Set = LuauPolyfill.Set @@ -19,25 +18,24 @@ type Map = LuauPolyfill.Map type Object = LuauPolyfill.Object type Set = LuauPolyfill.Set -local EventEmitter = require(script.Parent.Parent.events) +local EventEmitter = require("../events") type EventEmitter = EventEmitter.EventEmitter -local prepareProfilingDataFrontendFromBackendAndStore = require( - script.Parent.views.Profiler.utils -).prepareProfilingDataFrontendFromBackendAndStore +local prepareProfilingDataFrontendFromBackendAndStore = + require("./views/Profiler/utils").prepareProfilingDataFrontendFromBackendAndStore -local devtoolsTypes = require(script.Parent.types) +local devtoolsTypes = require("./types") type ProfilingCache = devtoolsTypes.ProfilingCache export type ProfilerStore = devtoolsTypes.ProfilerStore type Store = devtoolsTypes.Store -local Bridge = require(script.Parent.Parent.bridge) +local Bridge = require("../bridge") type FrontendBridge = Bridge.FrontendBridge -local backendTypes = require(script.Parent.Parent.backend.types) +local backendTypes = require("../backend/types") type ProfilingDataBackend = backendTypes.ProfilingDataBackend -local profilerTypes = require(script.Parent.views.Profiler.types) +local profilerTypes = require("./views/Profiler/types") type CommitDataFrontend = profilerTypes.CommitDataFrontend type ProfilingDataForRootFrontend = profilerTypes.ProfilingDataForRootFrontend type ProfilingDataFrontend = profilerTypes.ProfilingDataFrontend @@ -52,7 +50,7 @@ type ProfilerStore_statics = { __index: {}, } -local ProfilingCache = require(script.Parent.ProfilingCache) +local ProfilingCache = require("./ProfilingCache") local ProfilerStore: ProfilerStore & ProfilerStore_statics = ( setmetatable({}, { __index = EventEmitter }) :: any @@ -274,7 +272,7 @@ function ProfilerStore:profilingCache(): ProfilingCache end function ProfilerStore:profilingData( value: ProfilingDataFrontend | nil -): (...ProfilingDataFrontend?) +): ...ProfilingDataFrontend? if value == nil then return self._dataFrontend end @@ -292,7 +290,7 @@ function ProfilerStore:profilingData( self:emit("profilingData") return end -function ProfilerStore:clear(): (...any?) +function ProfilerStore:clear(): ...any? Array.splice(self._dataBackends, 0) self._dataFrontend = nil self._initialRendererIDs:clear() @@ -303,13 +301,13 @@ function ProfilerStore:clear(): (...any?) self._cache:invalidate() self:emit("profilingData") end -function ProfilerStore:startProfiling(): (...any?) +function ProfilerStore:startProfiling(): ...any? self._bridge:send("startProfiling", self._store:getRecordChangeDescriptions()) -- Don't actually update the local profiling boolean yet! -- Wait for onProfilingStatus() to confirm the status has changed. -- This ensures the frontend and backend are in sync wrt which commits were profiled. -- We do this to avoid mismatches on e.g. CommitTreeBuilder that would cause errors. end -function ProfilerStore:stopProfiling(): (...any?) +function ProfilerStore:stopProfiling(): ...any? self._bridge:send("stopProfiling") -- Don't actually update the local profiling boolean yet! -- Wait for onProfilingStatus() to confirm the status has changed. -- This ensures the frontend and backend are in sync wrt which commits were profiled. diff --git a/modules/react-devtools-shared/src/devtools/ProfilingCache.lua b/modules/react-devtools-shared/src/devtools/ProfilingCache.lua index ed05cbe1..c733873f 100644 --- a/modules/react-devtools-shared/src/devtools/ProfilingCache.lua +++ b/modules/react-devtools-shared/src/devtools/ProfilingCache.lua @@ -7,40 +7,38 @@ * * @flow ]] -local Packages = script.Parent.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array local Map = LuauPolyfill.Map type Map = LuauPolyfill.Map type Array = LuauPolyfill.Array -local ProfilerViews = script.Parent.views.Profiler - -local CommitTreeBuilderModule = require(ProfilerViews.CommitTreeBuilder) +local CommitTreeBuilderModule = require("./views/Profiler/CommitTreeBuilder") local getCommitTree = CommitTreeBuilderModule.getCommitTree local invalidateCommitTrees = CommitTreeBuilderModule.invalidateCommitTrees -local FlamegraphChartBuilderModule = require(ProfilerViews.FlamegraphChartBuilder) +local FlamegraphChartBuilderModule = require("./views/Profiler/FlamegraphChartBuilder") local getFlamegraphChartData = FlamegraphChartBuilderModule.getChartData local invalidateFlamegraphChartData = FlamegraphChartBuilderModule.invalidateChartData -local InteractionsChartBuilderModule = require(ProfilerViews.InteractionsChartBuilder) +local InteractionsChartBuilderModule = + require("./views/Profiler/InteractionsChartBuilder") local getInteractionsChartData = InteractionsChartBuilderModule.getChartData local invalidateInteractionsChartData = InteractionsChartBuilderModule.invalidateChartData -local RankedChartBuilderModule = require(ProfilerViews.RankedChartBuilder) +local RankedChartBuilderModule = require("./views/Profiler/RankedChartBuilder") local getRankedChartData = RankedChartBuilderModule.getChartData local invalidateRankedChartData = RankedChartBuilderModule.invalidateChartData -local typesModule = require(ProfilerViews.types) +local typesModule = require("./views/Profiler/types") type CommitTree = typesModule.CommitTree type FlamegraphChartData = FlamegraphChartBuilderModule.ChartData type InteractionsChartData = InteractionsChartBuilderModule.ChartData type RankedChartData = RankedChartBuilderModule.ChartData -local devtoolsTypes = require(script.Parent.types) +local devtoolsTypes = require("./types") type ProfilingCache = devtoolsTypes.ProfilingCache type ProfilerStore = devtoolsTypes.ProfilerStore diff --git a/modules/react-devtools-shared/src/devtools/cache.lua b/modules/react-devtools-shared/src/devtools/cache.lua index f64a6137..2e16ea45 100644 --- a/modules/react-devtools-shared/src/devtools/cache.lua +++ b/modules/react-devtools-shared/src/devtools/cache.lua @@ -7,18 +7,17 @@ * LICENSE file in the root directory of this source tree. ]] -local Packages = script.Parent.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Error = LuauPolyfill.Error local Map = LuauPolyfill.Map type Map = LuauPolyfill.Map local WeakMap = LuauPolyfill.WeakMap type WeakMap = LuauPolyfill.WeakMap -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") export type Thenable = ReactTypes.Thenable -local React = require(Packages.React) +local React = require("@pkg/@jsdotlua/react") local createContext = React.createContext -- Cache implementation was forked from the React repo: diff --git a/modules/react-devtools-shared/src/devtools/init.lua b/modules/react-devtools-shared/src/devtools/init.lua index 72c22ee7..1f4f703b 100644 --- a/modules/react-devtools-shared/src/devtools/init.lua +++ b/modules/react-devtools-shared/src/devtools/init.lua @@ -1,11 +1,11 @@ return { - utils = require(script.utils), - store = require(script.store), - cache = require(script.cache), + utils = require("./utils"), + store = require("./store"), + cache = require("./cache"), devtools = { Components = { views = { - types = require(script.views.Components.types), + types = require("./views/Components/types"), }, }, }, diff --git a/modules/react-devtools-shared/src/devtools/store.lua b/modules/react-devtools-shared/src/devtools/store.lua index e4feb966..0464f809 100644 --- a/modules/react-devtools-shared/src/devtools/store.lua +++ b/modules/react-devtools-shared/src/devtools/store.lua @@ -7,9 +7,7 @@ * LICENSE file in the root directory of this source tree. ]] -local Packages = script.Parent.Parent.Parent - -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local inspect = LuauPolyfill.util.inspect local Array = LuauPolyfill.Array local Error = LuauPolyfill.Error @@ -21,42 +19,42 @@ type Array = LuauPolyfill.Array type Map = LuauPolyfill.Map type Object = LuauPolyfill.Object type Set = LuauPolyfill.Set -local console = require(Packages.Shared).console +local console = require("@pkg/@jsdotlua/shared").console -local EventEmitter = require(script.Parent.Parent.events) +local EventEmitter = require("../events") type EventEmitter = EventEmitter.EventEmitter -local constants = require(script.Parent.Parent.constants) +local constants = require("../constants") local TREE_OPERATION_ADD = constants.TREE_OPERATION_ADD local TREE_OPERATION_REMOVE = constants.TREE_OPERATION_REMOVE local TREE_OPERATION_REORDER_CHILDREN = constants.TREE_OPERATION_REORDER_CHILDREN local TREE_OPERATION_UPDATE_TREE_BASE_DURATION = constants.TREE_OPERATION_UPDATE_TREE_BASE_DURATION -local types = require(script.Parent.Parent.types) +local types = require("../types") local ElementTypeRoot = types.ElementTypeRoot -local utils = require(script.Parent.Parent.utils) +local utils = require("../utils") local getSavedComponentFilters = utils.getSavedComponentFilters local saveComponentFilters = utils.saveComponentFilters local separateDisplayNameAndHOCs = utils.separateDisplayNameAndHOCs local shallowDiffers = utils.shallowDiffers -- ROBLOX deviation: don't use string encoding -- local utfDecodeString = utils.utfDecodeString -local storage = require(script.Parent.Parent.storage) +local storage = require("../storage") local localStorageGetItem = storage.localStorageGetItem local localStorageSetItem = storage.localStorageSetItem local __DEBUG__ = constants.__DEBUG__ -local ProfilerStore = require(script.Parent.ProfilerStore) +local ProfilerStore = require("./ProfilerStore") type ProfilerStore = ProfilerStore.ProfilerStore -local ComponentsTypes = require(script.Parent.Parent.devtools.views.Components.types) +local ComponentsTypes = require("./views/Components/types") type Element = ComponentsTypes.Element -local Types = require(script.Parent.Parent.types) +local Types = require("../types") type ComponentFilter = Types.ComponentFilter type ElementType = Types.ElementType -local Bridge = require(script.Parent.Parent.bridge) +local Bridge = require("../bridge") type FrontendBridge = Bridge.FrontendBridge -local devtoolsTypes = require(script.Parent.types) +local devtoolsTypes = require("./types") type Store = devtoolsTypes.Store type Capabilities = devtoolsTypes.Capabilities @@ -1105,7 +1103,7 @@ function Store:onBridgeOperations(operations: Array): () end if __DEBUG__ then -- ROBLOX deviation: inline require here to work around circular dependency - local devtoolsUtils = require(script.Parent.utils) :: any + local devtoolsUtils = require("./utils") :: any local printStore = devtoolsUtils.printStore console.log(printStore(self, true)) console.groupEnd() diff --git a/modules/react-devtools-shared/src/devtools/types.lua b/modules/react-devtools-shared/src/devtools/types.lua index 783b4e5a..6438126f 100644 --- a/modules/react-devtools-shared/src/devtools/types.lua +++ b/modules/react-devtools-shared/src/devtools/types.lua @@ -1,29 +1,27 @@ --!strict -local Packages = script.Parent.Parent.Parent - -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") type Array = LuauPolyfill.Array type Map = LuauPolyfill.Map type Object = LuauPolyfill.Object type Set = LuauPolyfill.Set -local ComponentsTypes = require(script.Parent.Parent.devtools.views.Components.types) +local ComponentsTypes = require("./views/Components/types") type Element = ComponentsTypes.Element -local Types = require(script.Parent.Parent.types) +local Types = require("../types") type ComponentFilter = Types.ComponentFilter type ElementType = Types.ElementType -local EventEmitter = require(script.Parent.Parent.events) +local EventEmitter = require("../events") type EventEmitter = EventEmitter.EventEmitter -local Bridge = require(script.Parent.Parent.bridge) +local Bridge = require("../bridge") type FrontendBridge = Bridge.FrontendBridge -local backendTypes = require(script.Parent.Parent.backend.types) +local backendTypes = require("../backend/types") type ProfilingDataBackend = backendTypes.ProfilingDataBackend -local profilerTypes = require(script.Parent.views.Profiler.types) +local profilerTypes = require("./views/Profiler/types") type CommitDataFrontend = profilerTypes.CommitDataFrontend type ProfilingDataForRootFrontend = profilerTypes.ProfilingDataForRootFrontend type ProfilingDataFrontend = profilerTypes.ProfilingDataFrontend diff --git a/modules/react-devtools-shared/src/devtools/utils.lua b/modules/react-devtools-shared/src/devtools/utils.lua index a854dbdf..1e3a5e38 100644 --- a/modules/react-devtools-shared/src/devtools/utils.lua +++ b/modules/react-devtools-shared/src/devtools/utils.lua @@ -7,9 +7,7 @@ * LICENSE file in the root directory of this source tree. ]] -local Packages = script.Parent.Parent.Parent - -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array type Array = LuauPolyfill.Array -- ROBLOX deviation: Use HttpService for JSON @@ -17,9 +15,9 @@ local JSON = game:GetService("HttpService") local exports = {} -local ViewsComponentsTypes = require(script.Parent.views.Components.types) +local ViewsComponentsTypes = require("./views/Components/types") type Element = ViewsComponentsTypes.Element -local devtoolsTypes = require(script.Parent.types) +local devtoolsTypes = require("./types") type Store = devtoolsTypes.Store exports.printElement = function(element: Element, includeWeight: boolean?) diff --git a/modules/react-devtools-shared/src/devtools/views/Components/types.lua b/modules/react-devtools-shared/src/devtools/views/Components/types.lua index a979aecd..238245fb 100644 --- a/modules/react-devtools-shared/src/devtools/views/Components/types.lua +++ b/modules/react-devtools-shared/src/devtools/views/Components/types.lua @@ -8,18 +8,17 @@ -- * @flow -- */ -local Packages = script.Parent.Parent.Parent.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") type Array = LuauPolyfill.Array type Object = LuauPolyfill.Object -local ReactShared = require(Packages.Shared) +local ReactShared = require("@pkg/@jsdotlua/shared") type Source = ReactShared.Source -local Hydration = require(script.Parent.Parent.Parent.Parent.hydration) +local Hydration = require("../../../hydration") type Dehydrated = Hydration.Dehydrated type Unserializable = Hydration.Unserializable -local ReactDevtoolsSharedTypes = require(script.Parent.Parent.Parent.Parent.types) +local ReactDevtoolsSharedTypes = require("../../../types") type ElementType = ReactDevtoolsSharedTypes.ElementType -- Each element on the frontend corresponds to a Fiber on the backend. diff --git a/modules/react-devtools-shared/src/devtools/views/Profiler/CommitTreeBuilder.lua b/modules/react-devtools-shared/src/devtools/views/Profiler/CommitTreeBuilder.lua index 2f0491b2..cb2a51f0 100644 --- a/modules/react-devtools-shared/src/devtools/views/Profiler/CommitTreeBuilder.lua +++ b/modules/react-devtools-shared/src/devtools/views/Profiler/CommitTreeBuilder.lua @@ -7,8 +7,7 @@ * * @flow ]] -local Packages = script.Parent.Parent.Parent.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array local Map = LuauPolyfill.Map local console = LuauPolyfill.console @@ -25,7 +24,7 @@ local exports = {} * * @flow ]] -local constantsModule = require(script.Parent.Parent.Parent.Parent.constants) +local constantsModule = require("../../../constants") local __DEBUG__ = constantsModule.__DEBUG__ local TREE_OPERATION_ADD = constantsModule.TREE_OPERATION_ADD local TREE_OPERATION_REMOVE = constantsModule.TREE_OPERATION_REMOVE @@ -33,14 +32,14 @@ local TREE_OPERATION_REORDER_CHILDREN = constantsModule.TREE_OPERATION_REORDER_C local TREE_OPERATION_UPDATE_TREE_BASE_DURATION = constantsModule.TREE_OPERATION_UPDATE_TREE_BASE_DURATION -local devtoolsTypes = require(script.Parent.Parent.Parent.types) +local devtoolsTypes = require("../../types") type ProfilerStore = devtoolsTypes.ProfilerStore -local ElementTypeRoot = require(script.Parent.Parent.Parent.Parent.types).ElementTypeRoot -local typesModule = require(script.Parent.Parent.Parent.Parent.types) +local ElementTypeRoot = require("../../../types").ElementTypeRoot +local typesModule = require("../../../types") type ElementType = typesModule.ElementType -local Profiler_typesModule = require(script.Parent.types) +local Profiler_typesModule = require("./types") type CommitTree = Profiler_typesModule.CommitTree type CommitTreeNode = Profiler_typesModule.CommitTreeNode type ProfilingDataForRootFrontend = Profiler_typesModule.ProfilingDataForRootFrontend @@ -71,6 +70,8 @@ local function __printTree(commitTree: CommitTree) ) ) end + + -- selene: allow(bad_string_escape) console.log( string.format( "%s%s:%s %s (%s)", diff --git a/modules/react-devtools-shared/src/devtools/views/Profiler/FlamegraphChartBuilder.lua b/modules/react-devtools-shared/src/devtools/views/Profiler/FlamegraphChartBuilder.lua index 2b27fc7c..00a388ac 100644 --- a/modules/react-devtools-shared/src/devtools/views/Profiler/FlamegraphChartBuilder.lua +++ b/modules/react-devtools-shared/src/devtools/views/Profiler/FlamegraphChartBuilder.lua @@ -7,8 +7,7 @@ * * @flow ]] -local Packages = script.Parent.Parent.Parent.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Boolean = LuauPolyfill.Boolean local Map = LuauPolyfill.Map local Set = LuauPolyfill.Set @@ -19,11 +18,11 @@ type Set = LuauPolyfill.Set local exports = {} -local devtoolsTypes = require(script.Parent.Parent.Parent.types) +local devtoolsTypes = require("./types") type ProfilerStore = devtoolsTypes.ProfilerStore -local formatDuration = require(script.Parent.utils).formatDuration -local typesModule = require(script.Parent.types) +local formatDuration = require("./utils").formatDuration +local typesModule = require("./types") type CommitTree = typesModule.CommitTree type CommitTreeNode = typesModule.CommitTreeNode diff --git a/modules/react-devtools-shared/src/devtools/views/Profiler/InteractionsChartBuilder.lua b/modules/react-devtools-shared/src/devtools/views/Profiler/InteractionsChartBuilder.lua index e6958d00..7b36bf05 100644 --- a/modules/react-devtools-shared/src/devtools/views/Profiler/InteractionsChartBuilder.lua +++ b/modules/react-devtools-shared/src/devtools/views/Profiler/InteractionsChartBuilder.lua @@ -7,8 +7,7 @@ * * @flow ]] -local Packages = script.Parent.Parent.Parent.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array local Map = LuauPolyfill.Map @@ -17,9 +16,9 @@ type Array = LuauPolyfill.Array local exports = {} -local devtoolsTypes = require(script.Parent.Parent.Parent.types) +local devtoolsTypes = require("./types") type ProfilerStore = devtoolsTypes.ProfilerStore -local typesModule = require(script.Parent.types) +local typesModule = require("./types") type Interaction = typesModule.Interaction export type ChartData = { interactions: Array, diff --git a/modules/react-devtools-shared/src/devtools/views/Profiler/RankedChartBuilder.lua b/modules/react-devtools-shared/src/devtools/views/Profiler/RankedChartBuilder.lua index 2b7de115..6712ed81 100644 --- a/modules/react-devtools-shared/src/devtools/views/Profiler/RankedChartBuilder.lua +++ b/modules/react-devtools-shared/src/devtools/views/Profiler/RankedChartBuilder.lua @@ -7,8 +7,7 @@ * * @flow ]] -local Packages = script.Parent.Parent.Parent.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array local Boolean = LuauPolyfill.Boolean local Map = LuauPolyfill.Map @@ -19,14 +18,14 @@ type Set = LuauPolyfill.Set local exports = {} -local devtoolsTypes = require(script.Parent.Parent.Parent.types) +local devtoolsTypes = require("./types") type ProfilerStore = devtoolsTypes.ProfilerStore -local typesModule = require(script.Parent.Parent.Parent.Parent.types) +local typesModule = require("./types") local ElementTypeForwardRef = typesModule.ElementTypeForwardRef local ElementTypeMemo = typesModule.ElementTypeMemo -local formatDuration = require(script.Parent.utils).formatDuration -local Profiler_typesModule = require(script.Parent.types) +local formatDuration = require("./utils").formatDuration +local Profiler_typesModule = require("./types") type CommitTree = Profiler_typesModule.CommitTree type CommitTreeNode = Profiler_typesModule.CommitTreeNode diff --git a/modules/react-devtools-shared/src/devtools/views/Profiler/types.lua b/modules/react-devtools-shared/src/devtools/views/Profiler/types.lua index 1a53a69b..bd1fdb3f 100644 --- a/modules/react-devtools-shared/src/devtools/views/Profiler/types.lua +++ b/modules/react-devtools-shared/src/devtools/views/Profiler/types.lua @@ -9,13 +9,12 @@ -- * @flow -- */ -local Packages = script.Parent.Parent.Parent.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") type Map = LuauPolyfill.Map type Array = LuauPolyfill.Array local exports = {} -local ReactDevtoolsSharedTypes = require(script.Parent.Parent.Parent.Parent.types) +local ReactDevtoolsSharedTypes = require("../../../types") type ElementType = ReactDevtoolsSharedTypes.ElementType diff --git a/modules/react-devtools-shared/src/devtools/views/Profiler/utils.lua b/modules/react-devtools-shared/src/devtools/views/Profiler/utils.lua index f13910ef..cff3f963 100644 --- a/modules/react-devtools-shared/src/devtools/views/Profiler/utils.lua +++ b/modules/react-devtools-shared/src/devtools/views/Profiler/utils.lua @@ -7,8 +7,7 @@ * * @flow ]] -local Packages = script.Parent.Parent.Parent.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array local Boolean = LuauPolyfill.Boolean local Error = LuauPolyfill.Error @@ -20,11 +19,10 @@ type Array = LuauPolyfill.Array local exports = {} -local PROFILER_EXPORT_VERSION = - require(script.Parent.Parent.Parent.Parent.constants).PROFILER_EXPORT_VERSION -local backendTypes = require(script.Parent.Parent.Parent.Parent.backend.types) +local PROFILER_EXPORT_VERSION = require("../../../constants").PROFILER_EXPORT_VERSION +local backendTypes = require("../../../backend/types") type ProfilingDataBackend = backendTypes.ProfilingDataBackend -local profilerTypes = require(script.Parent.types) +local profilerTypes = require("./types") type ProfilingDataExport = profilerTypes.ProfilingDataExport type ProfilingDataForRootExport = profilerTypes.ProfilingDataForRootExport type ProfilingDataForRootFrontend = profilerTypes.ProfilingDataForRootFrontend diff --git a/modules/react-devtools-shared/src/events.lua b/modules/react-devtools-shared/src/events.lua index d572b6df..bec7309c 100644 --- a/modules/react-devtools-shared/src/events.lua +++ b/modules/react-devtools-shared/src/events.lua @@ -8,8 +8,7 @@ -- * -- */ -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array local Map = LuauPolyfill.Map type Array = LuauPolyfill.Array diff --git a/modules/react-devtools-shared/src/hook.lua b/modules/react-devtools-shared/src/hook.lua index 9846b842..b3b70dae 100644 --- a/modules/react-devtools-shared/src/hook.lua +++ b/modules/react-devtools-shared/src/hook.lua @@ -6,9 +6,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. ]] -local Packages = script.Parent.Parent - -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array local Map = LuauPolyfill.Map local Set = LuauPolyfill.Set @@ -17,11 +15,11 @@ type Map = LuauPolyfill.Map type Function = (...any) -> any local exports = {} -local console = require(script.Parent.backend.console) +local console = require("./backend/console") local patchConsole = console.patch local registerRendererWithConsole = console.registerRenderer -local BackendTypes = require(script.Parent.backend.types) +local BackendTypes = require("./backend/types") type DevToolsHook = BackendTypes.DevToolsHook local window = _G diff --git a/modules/react-devtools-shared/src/hydration.lua b/modules/react-devtools-shared/src/hydration.lua index 841e1f7c..0236f2d0 100644 --- a/modules/react-devtools-shared/src/hydration.lua +++ b/modules/react-devtools-shared/src/hydration.lua @@ -6,9 +6,7 @@ -- * LICENSE file in the root directory of this source tree. -- */ -local Packages = script.Parent.Parent - -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Symbol = LuauPolyfill.Symbol type Array = { [number]: T } type Object = { [string]: any } @@ -23,7 +21,7 @@ end local exports = {} --ROBLOX TODO: circular dependency, inline for now and submit PR to fix upstream ---local ComponentsTypes = require(script.Parent.devtools.views.Components.types) +--local ComponentsTypes = require("./devtools/views/Components/types") export type DehydratedData = { cleaned: Array>, data: string diff --git a/modules/react-devtools-shared/src/init.lua b/modules/react-devtools-shared/src/init.lua index f9a62f25..88971bd6 100644 --- a/modules/react-devtools-shared/src/init.lua +++ b/modules/react-devtools-shared/src/init.lua @@ -1,9 +1,9 @@ -- ROBLOX note: upstream doesn't have a root index.js, we may want to contribute a proper contract upstream return { - backend = require(script.backend), - bridge = require(script.bridge), - devtools = require(script.devtools), - hydration = require(script.hydration), - hook = require(script.hook), - utils = require(script.utils), + backend = require("./backend"), + bridge = require("./bridge"), + devtools = require("./devtools"), + hydration = require("./hydration"), + hook = require("./hook"), + utils = require("./utils"), } diff --git a/modules/react-devtools-shared/src/utils.lua b/modules/react-devtools-shared/src/utils.lua index 43c9c632..fd98b385 100644 --- a/modules/react-devtools-shared/src/utils.lua +++ b/modules/react-devtools-shared/src/utils.lua @@ -7,9 +7,7 @@ -- */ -- * LICENSE file in the root directory of this source tree. -local Packages = script.Parent.Parent - -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array local WeakMap = LuauPolyfill.WeakMap local Number = LuauPolyfill.Number @@ -25,10 +23,10 @@ local exports = {} -- ROBLOX TODO: pull in smarter cache when there's a performance reason to do so -- local LRU = require() -- ROBLOX deviation: pull in getComponentName for Lua-specific logic to extract component names -local Shared = require(Packages.Shared) +local Shared = require("@pkg/@jsdotlua/shared") local getComponentName = Shared.getComponentName -local ReactIs = require(Packages.ReactIs) +local ReactIs = require("@pkg/@jsdotlua/react-is") local isElement = ReactIs.isElement local typeOf = ReactIs.typeOf local ContextConsumer = ReactIs.ContextConsumer @@ -41,15 +39,15 @@ local Portal = ReactIs.Portal local Profiler = ReactIs.Profiler local StrictMode = ReactIs.StrictMode local Suspense = ReactIs.Suspense -local ReactSymbols = require(Packages.Shared).ReactSymbols +local ReactSymbols = require("@pkg/@jsdotlua/shared").ReactSymbols local SuspenseList = ReactSymbols.REACT_SUSPENSE_LIST_TYPE -local constants = require(script.Parent.constants) +local constants = require("./constants") local TREE_OPERATION_ADD = constants.TREE_OPERATION_ADD local TREE_OPERATION_REMOVE = constants.TREE_OPERATION_REMOVE local TREE_OPERATION_REORDER_CHILDREN = constants.TREE_OPERATION_REORDER_CHILDREN local TREE_OPERATION_UPDATE_TREE_BASE_DURATION = constants.TREE_OPERATION_UPDATE_TREE_BASE_DURATION -local types = require(script.Parent.types) +local types = require("./types") local ElementTypeRoot = types.ElementTypeRoot local LOCAL_STORAGE_FILTER_PREFERENCES_KEY = constants.LOCAL_STORAGE_FILTER_PREFERENCES_KEY @@ -63,10 +61,10 @@ local ElementTypeClass = types.ElementTypeClass local ElementTypeForwardRef = types.ElementTypeForwardRef local ElementTypeFunction = types.ElementTypeFunction local ElementTypeMemo = types.ElementTypeMemo -local storage = require(script.Parent.storage) +local storage = require("./storage") local localStorageGetItem = storage.localStorageGetItem local localStorageSetItem = storage.localStorageSetItem -local hydration = require(script.Parent.hydration) +local hydration = require("./hydration") local meta = hydration.meta type ComponentFilter = types.ComponentFilter type ElementType = types.ElementType diff --git a/modules/react-is/.npmignore b/modules/react-is/.npmignore new file mode 100644 index 00000000..835df8f5 --- /dev/null +++ b/modules/react-is/.npmignore @@ -0,0 +1,26 @@ +**/.robloxrc +rotriever.toml + +/roblox +/build + +.darklua* +.luau-analyze.json +.luaurc +default.project.json + +/globalTypes.d.lua +**/sourcemap.json +**/*.project.json + +**/__tests__ +**/*.test.lua +**/*.spec.lua +**/jest.config.lua + +**/*.rbxl +**/*.rbxlx +**/*.rbxl.lock +**/*.rbxlx.lock +**/*.rbxm +**/*.rbxmx diff --git a/modules/react-is/default.project.json b/modules/react-is/default.project.json index 2d309d08..5696967e 100644 --- a/modules/react-is/default.project.json +++ b/modules/react-is/default.project.json @@ -1,5 +1,5 @@ { - "name": "ReactIs", + "name": "react-is", "tree": { "$path": "src" } diff --git a/modules/react-is/package.json b/modules/react-is/package.json new file mode 100644 index 00000000..06cac67f --- /dev/null +++ b/modules/react-is/package.json @@ -0,0 +1,20 @@ +{ + "name": "@jsdotlua/react-is", + "version": "17.0.2", + "repository": { + "type": "git", + "url": "https://github.com/jsdotlua/react-lua.git", + "directory": "modules/react-is" + }, + "license": "MIT", + "main": "src/init.lua", + "scripts": { + "prepare": "npmluau" + }, + "dependencies": { + "@jsdotlua/shared": "workspace:^" + }, + "devDependencies": { + "npmluau": "^0.1.0" + } +} diff --git a/modules/react-is/src/__tests__/ReactIs.spec.lua b/modules/react-is/src/__tests__/ReactIs.spec.lua index 6af35068..6ec03e01 100644 --- a/modules/react-is/src/__tests__/ReactIs.spec.lua +++ b/modules/react-is/src/__tests__/ReactIs.spec.lua @@ -8,16 +8,14 @@ * * @emails react-core ]] -local Packages = script.Parent.Parent.Parent -- ROBLOX deviation START: fix import --- local LuauPolyfill = require(Packages.LuauPolyfill) -local LuauPolyfill = require(Packages.Dev.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") -- ROBLOX deviation END -- ROBLOX deviation START: not used -- local Boolean = LuauPolyfill.Boolean -- ROBLOX deviation END local Object = LuauPolyfill.Object -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local beforeEach = JestGlobals.beforeEach local describe = JestGlobals.describe local expect = JestGlobals.expect @@ -25,8 +23,8 @@ local it = JestGlobals.it local jest = JestGlobals.jest -- ROBLOX deviation START: add imports -local Promise = require(Packages.Dev.Promise) -local ReactTypes = require(Packages.Shared) +local Promise = require("@pkg/@jsdotlua/promise") +local ReactTypes = require("@pkg/@jsdotlua/shared") type React_Component = ReactTypes.React_Component -- ROBLOX deviation END local React @@ -36,16 +34,16 @@ describe("ReactIs", function() beforeEach(function() jest.resetModules() -- ROBLOX deviation START: additional flag to switch for tests - local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags + local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags ReactFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback = false -- ROBLOX deviation END -- ROBLOX deviation START: fix imports -- React = require_("react") -- ReactDOM = require_("react-dom") -- ReactIs = require_("react-is") - React = require(Packages.Dev.React) - ReactIs = require(Packages.ReactIs) - ReactDOM = require(Packages.Dev.ReactRoblox) + React = require("@pkg/@jsdotlua/react") + ReactIs = require("@pkg/@jsdotlua/react-is") + ReactDOM = require("@pkg/@jsdotlua/react-roblox") -- ROBLOX deviation END end) it("should return undefined for unknown/invalid types", function() diff --git a/modules/react-is/src/init.lua b/modules/react-is/src/init.lua index dcbc325d..9d02f5ed 100644 --- a/modules/react-is/src/init.lua +++ b/modules/react-is/src/init.lua @@ -8,19 +8,18 @@ * * @flow ]] -local Packages = script.Parent -- ROBLOX deviation START: not used --- local LuauPolyfill = require(Packages.LuauPolyfill) +-- local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") -- local Boolean = LuauPolyfill.Boolean -- ROBLOX deviation END -- ROBLOX deviation START: use patched console from shared -- local console = LuauPolyfill.console -local console = require(Packages.Shared).console +local console = require("@pkg/@jsdotlua/shared").console -- ROBLOX deviation END local exports = {} -- ROBLOX deviation START: fix import -- local sharedReactSymbolsModule = require(Packages.shared.ReactSymbols) -local sharedReactSymbolsModule = require(Packages.Shared).ReactSymbols +local sharedReactSymbolsModule = require("@pkg/@jsdotlua/shared").ReactSymbols -- ROBLOX deviation END local REACT_CONTEXT_TYPE = sharedReactSymbolsModule.REACT_CONTEXT_TYPE local REACT_ELEMENT_TYPE = sharedReactSymbolsModule.REACT_ELEMENT_TYPE @@ -36,7 +35,7 @@ local REACT_SUSPENSE_TYPE = sharedReactSymbolsModule.REACT_SUSPENSE_TYPE local REACT_SUSPENSE_LIST_TYPE = sharedReactSymbolsModule.REACT_SUSPENSE_LIST_TYPE -- ROBLOX deviation START: fix import -- local isValidElementType = require(Packages.shared.isValidElementType).default -local isValidElementType = require(Packages.Shared).isValidElementType +local isValidElementType = require("@pkg/@jsdotlua/shared").isValidElementType -- ROBLOX deviation END -- ROBLOX deviation START: additional imports local REACT_BINDING_TYPE = sharedReactSymbolsModule.REACT_BINDING_TYPE diff --git a/modules/react-noop-renderer/.npmignore b/modules/react-noop-renderer/.npmignore new file mode 100644 index 00000000..835df8f5 --- /dev/null +++ b/modules/react-noop-renderer/.npmignore @@ -0,0 +1,26 @@ +**/.robloxrc +rotriever.toml + +/roblox +/build + +.darklua* +.luau-analyze.json +.luaurc +default.project.json + +/globalTypes.d.lua +**/sourcemap.json +**/*.project.json + +**/__tests__ +**/*.test.lua +**/*.spec.lua +**/jest.config.lua + +**/*.rbxl +**/*.rbxlx +**/*.rbxl.lock +**/*.rbxlx.lock +**/*.rbxm +**/*.rbxmx diff --git a/modules/react-noop-renderer/default.project.json b/modules/react-noop-renderer/default.project.json index 58a27657..b8b68a69 100644 --- a/modules/react-noop-renderer/default.project.json +++ b/modules/react-noop-renderer/default.project.json @@ -1,5 +1,5 @@ { - "name": "ReactNoopRenderer", + "name": "react-noop-renderer", "tree": { "$path": "src" } diff --git a/modules/react-noop-renderer/package(placeholder).json b/modules/react-noop-renderer/package(placeholder).json new file mode 100644 index 00000000..5aa07b56 --- /dev/null +++ b/modules/react-noop-renderer/package(placeholder).json @@ -0,0 +1,23 @@ +{ + "name": "@jsdotlua/react-noop-renderer", + "version": "17.0.2", + "repository": { + "type": "git", + "url": "https://github.com/jsdotlua/react-lua.git", + "directory": "modules/react-noop-renderer" + }, + "license": "MIT", + "main": "src/init.lua", + "scripts": { + "prepare": "npmluau" + }, + "dependencies": { + "@jsdotlua/luau-polyfill": "^1.2.6", + "@jsdotlua/react-reconciler": "workspace:^", + "@jsdotlua/scheduler": "workspace:^", + "@jsdotlua/shared": "workspace:^" + }, + "devDependencies": { + "npmluau": "^0.1.0" + } +} diff --git a/modules/react-noop-renderer/src/ReactNoop.lua b/modules/react-noop-renderer/src/ReactNoop.lua index ddb8b9c8..212ebe76 100644 --- a/modules/react-noop-renderer/src/ReactNoop.lua +++ b/modules/react-noop-renderer/src/ReactNoop.lua @@ -16,9 +16,8 @@ * environment. ]] -local Packages = script.Parent.Parent -local ReactFiberReconciler = require(Packages.ReactReconciler) -local createReactNoop = require(script.Parent.createReactNoop) +local ReactFiberReconciler = require("@pkg/@jsdotlua/react-reconciler") +local createReactNoop = require("./createReactNoop") local NoopRenderer = createReactNoop( ReactFiberReconciler, -- reconciler diff --git a/modules/react-noop-renderer/src/createReactNoop.lua b/modules/react-noop-renderer/src/createReactNoop.lua index 73eddf94..ad7ead6b 100644 --- a/modules/react-noop-renderer/src/createReactNoop.lua +++ b/modules/react-noop-renderer/src/createReactNoop.lua @@ -16,8 +16,7 @@ * environment. ]] -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array local Error = LuauPolyfill.Error @@ -25,20 +24,20 @@ local Object = LuauPolyfill.Object type Function = (...any) -> ...any local setTimeout = LuauPolyfill.setTimeout local clearTimeout = LuauPolyfill.clearTimeout -local console = require(Packages.Shared).console -local jest = require(Packages.JestGlobals).jest +local console = require("@pkg/@jsdotlua/shared").console +local jest = require("@pkg/@jsdotlua/jest-globals").jest -local ReactReconciler = require(Packages.ReactReconciler) +local ReactReconciler = require("@pkg/@jsdotlua/react-reconciler") type Fiber = ReactReconciler.Fiber type UpdateQueue = ReactReconciler.UpdateQueue -local ReactShared = require(Packages.Shared) +local ReactShared = require("@pkg/@jsdotlua/shared") type ReactNodeList = ReactShared.ReactNodeList type Thenable = ReactShared.Thenable type RootTag = ReactReconciler.RootTag -local Scheduler = require(Packages.Scheduler) +local Scheduler = require("@pkg/@jsdotlua/scheduler") -- deviation: These are only used for the JSX logic that's currently omitted -local ReactSymbols = require(Packages.Shared).ReactSymbols +local ReactSymbols = require("@pkg/@jsdotlua/shared").ReactSymbols local REACT_FRAGMENT_TYPE = ReactSymbols.REACT_FRAGMENT_TYPE local REACT_ELEMENT_TYPE = ReactSymbols.REACT_ELEMENT_TYPE @@ -46,8 +45,8 @@ local REACT_ELEMENT_TYPE = ReactSymbols.REACT_ELEMENT_TYPE -- local BlockingRoot = ReactRootTags.BlockingRoot -- local LegacyRoot = ReactRootTags.LegacyRoot -local ReactSharedInternals = require(Packages.Shared).ReactSharedInternals -local enqueueTask = require(Packages.Shared).enqueueTask +local ReactSharedInternals = require("@pkg/@jsdotlua/shared").ReactSharedInternals +local enqueueTask = require("@pkg/@jsdotlua/shared").enqueueTask local IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing type Object = { [string]: any } diff --git a/modules/react-noop-renderer/src/init.lua b/modules/react-noop-renderer/src/init.lua index 7bfa2459..511aab24 100644 --- a/modules/react-noop-renderer/src/init.lua +++ b/modules/react-noop-renderer/src/init.lua @@ -9,4 +9,4 @@ *]] --!strict -return require(script.ReactNoop) +return require("./ReactNoop") diff --git a/modules/react-reconciler/.npmignore b/modules/react-reconciler/.npmignore new file mode 100644 index 00000000..835df8f5 --- /dev/null +++ b/modules/react-reconciler/.npmignore @@ -0,0 +1,26 @@ +**/.robloxrc +rotriever.toml + +/roblox +/build + +.darklua* +.luau-analyze.json +.luaurc +default.project.json + +/globalTypes.d.lua +**/sourcemap.json +**/*.project.json + +**/__tests__ +**/*.test.lua +**/*.spec.lua +**/jest.config.lua + +**/*.rbxl +**/*.rbxlx +**/*.rbxl.lock +**/*.rbxlx.lock +**/*.rbxm +**/*.rbxmx diff --git a/modules/react-reconciler/default.project.json b/modules/react-reconciler/default.project.json index ad6cd12d..681f810b 100644 --- a/modules/react-reconciler/default.project.json +++ b/modules/react-reconciler/default.project.json @@ -1,5 +1,5 @@ { - "name": "ReactReconciler", + "name": "react-reconciler", "tree": { "$path": "src" } diff --git a/modules/react-reconciler/package.json b/modules/react-reconciler/package.json new file mode 100644 index 00000000..65389f35 --- /dev/null +++ b/modules/react-reconciler/package.json @@ -0,0 +1,24 @@ +{ + "name": "@jsdotlua/react-reconciler", + "version": "17.0.2", + "repository": { + "type": "git", + "url": "https://github.com/jsdotlua/react-lua.git", + "directory": "modules/react-reconciler" + }, + "license": "MIT", + "main": "src/init.lua", + "scripts": { + "prepare": "npmluau" + }, + "dependencies": { + "@jsdotlua/luau-polyfill": "^1.2.6", + "@jsdotlua/promise": "^3.5.0", + "@jsdotlua/react": "workspace:^", + "@jsdotlua/scheduler": "workspace:^", + "@jsdotlua/shared": "workspace:^" + }, + "devDependencies": { + "npmluau": "^0.1.0" + } +} diff --git a/modules/react-reconciler/src/DebugTracing.lua b/modules/react-reconciler/src/DebugTracing.lua index ff78925f..59f6489c 100644 --- a/modules/react-reconciler/src/DebugTracing.lua +++ b/modules/react-reconciler/src/DebugTracing.lua @@ -8,12 +8,11 @@ -- * @flow -- */ -local Packages = script.Parent.Parent type Array = { [number]: T } type Map = { [K]: V } type Object = { [string]: any } type Function = (any) -> any? -local Shared = require(Packages.Shared) +local Shared = require("@pkg/@jsdotlua/shared") local console = Shared.console local exports = {} @@ -21,12 +20,13 @@ local exports = {} local log -- ROBLOX deviation: the nucelus emoji `(%c\u{269B}\u{FE0F}%c)` has been replaced with `*` -local ReactFiberLaneModule = require(script.Parent.ReactFiberLane) +local ReactFiberLaneModule = require("./ReactFiberLane") type Lane = ReactFiberLaneModule.Lane type Lanes = ReactFiberLaneModule.Lanes type Wakeable = Shared.Wakeable -local enableDebugTracing = require(Packages.Shared).ReactFeatureFlags.enableDebugTracing +local enableDebugTracing = + require("@pkg/@jsdotlua/shared").ReactFeatureFlags.enableDebugTracing local nativeConsole: Object = console local nativeConsoleLog: nil | Function = nil diff --git a/modules/react-reconciler/src/ReactCapturedValue.lua b/modules/react-reconciler/src/ReactCapturedValue.lua index 04db7bc0..dc01805e 100644 --- a/modules/react-reconciler/src/ReactCapturedValue.lua +++ b/modules/react-reconciler/src/ReactCapturedValue.lua @@ -9,11 +9,11 @@ * @flow ]] -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") type Fiber = ReactInternalTypes.Fiber local getStackByFiberInDevAndProd = - require(script.Parent.ReactFiberComponentStack).getStackByFiberInDevAndProd + require("./ReactFiberComponentStack").getStackByFiberInDevAndProd export type CapturedValue = { value: T, diff --git a/modules/react-reconciler/src/ReactChildFiber.new.lua b/modules/react-reconciler/src/ReactChildFiber.new.lua index c5d93a67..97411dba 100644 --- a/modules/react-reconciler/src/ReactChildFiber.new.lua +++ b/modules/react-reconciler/src/ReactChildFiber.new.lua @@ -9,8 +9,7 @@ * @flow ]] local __DEV__ = _G.__DEV__ :: boolean -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array local Error = LuauPolyfill.Error type Array = { [number]: T } @@ -18,36 +17,36 @@ type Set = { [T]: boolean } type Object = { [any]: any } type Map = { [K]: V } -- ROBLOX: use patched console from shared -local console = require(Packages.Shared).console -local describeError = require(Packages.Shared).describeError +local console = require("@pkg/@jsdotlua/shared").console +local describeError = require("@pkg/@jsdotlua/shared").describeError -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") -- ROBLOX deviation: ReactElement is defined at the top level of Shared along -- with the rest of the ReactTypes type ReactElement = ReactTypes.ReactElement type ReactPortal = ReactTypes.ReactPortal -local React = require(Packages.React) +local React = require("@pkg/@jsdotlua/react") type LazyComponent = React.LazyComponent -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") type Fiber = ReactInternalTypes.Fiber type RoactStableKey = ReactInternalTypes.RoactStableKey -local ReactFiberLanes = require(script.Parent.ReactFiberLane) +local ReactFiberLanes = require("./ReactFiberLane") type Lanes = ReactFiberLanes.Lanes -local getComponentName = require(Packages.Shared).getComponentName -local ReactFiberFlags = require(script.Parent.ReactFiberFlags) +local getComponentName = require("@pkg/@jsdotlua/shared").getComponentName +local ReactFiberFlags = require("./ReactFiberFlags") local Placement = ReactFiberFlags.Placement local Deletion = ReactFiberFlags.Deletion -local ReactSymbols = require(Packages.Shared).ReactSymbols +local ReactSymbols = require("@pkg/@jsdotlua/shared").ReactSymbols local getIteratorFn = ReactSymbols.getIteratorFn local REACT_ELEMENT_TYPE = ReactSymbols.REACT_ELEMENT_TYPE local REACT_FRAGMENT_TYPE = ReactSymbols.REACT_FRAGMENT_TYPE local REACT_PORTAL_TYPE = ReactSymbols.REACT_PORTAL_TYPE local REACT_LAZY_TYPE = ReactSymbols.REACT_LAZY_TYPE local REACT_BLOCK_TYPE = ReactSymbols.REACT_BLOCK_TYPE -local ReactWorkTags = require(script.Parent.ReactWorkTags) +local ReactWorkTags = require("./ReactWorkTags") local FunctionComponent = ReactWorkTags.FunctionComponent local ClassComponent = ReactWorkTags.ClassComponent local HostText = ReactWorkTags.HostText @@ -56,14 +55,14 @@ local ForwardRef = ReactWorkTags.ForwardRef local Fragment = ReactWorkTags.Fragment local SimpleMemoComponent = ReactWorkTags.SimpleMemoComponent local Block = ReactWorkTags.Block -local invariant = require(Packages.Shared).invariant -local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags +local invariant = require("@pkg/@jsdotlua/shared").invariant +local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags -- ROBLOX deviation: we do not support string refs -- local warnAboutStringRefs = ReactFeatureFlags.warnAboutStringRefs local enableLazyElements = ReactFeatureFlags.enableLazyElements local enableBlocksAPI = ReactFeatureFlags.enableBlocksAPI -local ReactFiber = require(script.Parent["ReactFiber.new"]) +local ReactFiber = require("./ReactFiber.new.lua") local createWorkInProgress = ReactFiber.createWorkInProgress local resetWorkInProgress = ReactFiber.resetWorkInProgress local createFiberFromElement = ReactFiber.createFiberFromElement @@ -72,12 +71,12 @@ local createFiberFromText = ReactFiber.createFiberFromText local createFiberFromPortal = ReactFiber.createFiberFromPortal -- ROBLOX deviation: we do not support string refs -- local emptyRefsObject = --- require(script.Parent["ReactFiberClassComponent.new"]).emptyRefsObject --- local ReactFiberHotReloading = require(script.Parent["ReactFiberHotReloading.new"]) +-- require("./ReactFiberClassComponent.new.lua").emptyRefsObject +-- local ReactFiberHotReloading = require("./ReactFiberHotReloading.new.lua") -- local isCompatibleFamilyForHotReloading = -- ReactFiberHotReloading.isCompatibleFamilyForHotReloading -- ROBLOX deviation: we do not support string refs, which removes our use of StrictMode --- local StrictMode = require(script.Parent.ReactTypeOfMode).StrictMode +-- local StrictMode = require("./ReactTypeOfMode").StrictMode local exports = {} diff --git a/modules/react-reconciler/src/ReactCurrentFiber.lua b/modules/react-reconciler/src/ReactCurrentFiber.lua index 1ef78941..5eac5c95 100644 --- a/modules/react-reconciler/src/ReactCurrentFiber.lua +++ b/modules/react-reconciler/src/ReactCurrentFiber.lua @@ -9,15 +9,14 @@ * @flow ]] local __DEV__ = _G.__DEV__ :: boolean -local Packages = script.Parent.Parent -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") type Fiber = ReactInternalTypes.Fiber -local ReactSharedInternals = require(Packages.Shared).ReactSharedInternals -local ReactFiberComponentStack = require(script.Parent.ReactFiberComponentStack) +local ReactSharedInternals = require("@pkg/@jsdotlua/shared").ReactSharedInternals +local ReactFiberComponentStack = require("./ReactFiberComponentStack") local getStackByFiberInDevAndProd = ReactFiberComponentStack.getStackByFiberInDevAndProd -local getComponentName = require(Packages.Shared).getComponentName +local getComponentName = require("@pkg/@jsdotlua/shared").getComponentName local ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame diff --git a/modules/react-reconciler/src/ReactFiber.new.lua b/modules/react-reconciler/src/ReactFiber.new.lua index c8c663cd..e781b93f 100644 --- a/modules/react-reconciler/src/ReactFiber.new.lua +++ b/modules/react-reconciler/src/ReactFiber.new.lua @@ -10,16 +10,15 @@ ]] local __DEV__ = _G.__DEV__ -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Object = LuauPolyfill.Object local Array = LuauPolyfill.Array local inspect = LuauPolyfill.util.inspect -- ROBLOX: use patched console from shared -local console = require(Packages.Shared).console +local console = require("@pkg/@jsdotlua/shared").console -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") -- ROBLOX deviation: ReactElement is defined at the top level of Shared along -- with the rest of the ReactTypes type ReactElement = ReactTypes.ReactElement @@ -27,30 +26,30 @@ type ReactFragment = ReactTypes.ReactFragment type ReactPortal = ReactTypes.ReactPortal type ReactFundamentalComponent = ReactTypes.ReactFundamentalComponent type ReactScope = ReactTypes.ReactScope -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") export type Fiber = ReactInternalTypes.Fiber -- ROBLOX deviation: Allow number keys for sparse arrays type RoactStableKey = ReactInternalTypes.RoactStableKey -local ReactRootTags = require(script.Parent.ReactRootTags) +local ReactRootTags = require("./ReactRootTags") type RootTag = ReactRootTags.RootTag -local ReactWorkTags = require(script.Parent.ReactWorkTags) +local ReactWorkTags = require("./ReactWorkTags") type WorkTag = ReactWorkTags.WorkTag -local ReactTypeOfMode = require(script.Parent.ReactTypeOfMode) +local ReactTypeOfMode = require("./ReactTypeOfMode") type TypeOfMode = ReactTypeOfMode.TypeOfMode -local ReactFiberLane = require(script.Parent.ReactFiberLane) +local ReactFiberLane = require("./ReactFiberLane") type Lanes = ReactFiberLane.Lanes -local ReactFiberHostConfig = require(script.Parent.ReactFiberHostConfig) +local ReactFiberHostConfig = require("./ReactFiberHostConfig") type SuspenseInstance = ReactFiberHostConfig.SuspenseInstance -local ReactFiberOffscreenComponent = require(script.Parent.ReactFiberOffscreenComponent) +local ReactFiberOffscreenComponent = require("./ReactFiberOffscreenComponent") type OffscreenProps = ReactFiberOffscreenComponent.OffscreenProps -local invariant = require(Packages.Shared).invariant -local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags +local invariant = require("@pkg/@jsdotlua/shared").invariant +local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags local enableProfilerTimer = ReactFeatureFlags.enableProfilerTimer -- local enableFundamentalAPI = ReactFeatureFlags.enableFundamentalAPI -- local enableScopeAPI = ReactFeatureFlags.enableScopeAPI -local ReactFiberFlags = require(script.Parent.ReactFiberFlags) +local ReactFiberFlags = require("./ReactFiberFlags") local NoFlags = ReactFiberFlags.NoFlags local Placement = ReactFiberFlags.Placement local StaticMask = ReactFiberFlags.StaticMask @@ -79,11 +78,11 @@ local FundamentalComponent = ReactWorkTags.FundamentalComponent local ScopeComponent = ReactWorkTags.ScopeComponent local OffscreenComponent = ReactWorkTags.OffscreenComponent local LegacyHiddenComponent = ReactWorkTags.LegacyHiddenComponent -local getComponentName = require(Packages.Shared).getComponentName +local getComponentName = require("@pkg/@jsdotlua/shared").getComponentName -local ReactFiberDevToolsHook = require(script.Parent["ReactFiberDevToolsHook.new"]) +local ReactFiberDevToolsHook = require("./ReactFiberDevToolsHook.new.lua") local isDevToolsPresent = ReactFiberDevToolsHook.isDevToolsPresent -local ReactFiberHotReloading = require(script.Parent["ReactFiberHotReloading.new"]) +local ReactFiberHotReloading = require("./ReactFiberHotReloading.new.lua") local resolveClassForHotReloading = ReactFiberHotReloading.resolveClassForHotReloading local resolveFunctionForHotReloading = ReactFiberHotReloading.resolveFunctionForHotReloading @@ -96,7 +95,7 @@ local DebugTracingMode = ReactTypeOfMode.DebugTracingMode local ProfileMode = ReactTypeOfMode.ProfileMode local StrictMode = ReactTypeOfMode.StrictMode local BlockingMode = ReactTypeOfMode.BlockingMode -local ReactSymbols = require(Packages.Shared).ReactSymbols +local ReactSymbols = require("@pkg/@jsdotlua/shared").ReactSymbols local REACT_FORWARD_REF_TYPE = ReactSymbols.REACT_FORWARD_REF_TYPE local REACT_FRAGMENT_TYPE = ReactSymbols.REACT_FRAGMENT_TYPE local REACT_ELEMENT_TYPE = ReactSymbols.REACT_ELEMENT_TYPE diff --git a/modules/react-reconciler/src/ReactFiberBeginWork.new.lua b/modules/react-reconciler/src/ReactFiberBeginWork.new.lua index daf50866..8e01fa23 100644 --- a/modules/react-reconciler/src/ReactFiberBeginWork.new.lua +++ b/modules/react-reconciler/src/ReactFiberBeginWork.new.lua @@ -23,46 +23,44 @@ local __DISABLE_ALL_WARNINGS_EXCEPT_PROP_VALIDATION__ = _G.__DISABLE_ALL_WARNINGS_EXCEPT_PROP_VALIDATION__ :: boolean local __COMPAT_WARNINGS__ = _G.__COMPAT_WARNINGS__ :: boolean -local Packages = script.Parent.Parent -- ROBLOX: use patched console from Shared -local Shared = require(Packages.Shared) +local Shared = require("@pkg/@jsdotlua/shared") local console = Shared.console -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array local Object = LuauPolyfill.Object local inspect = LuauPolyfill.util.inspect -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") type ReactProviderType = ReactTypes.ReactProviderType type ReactContext = ReactTypes.ReactContext type React_Component = ReactTypes.React_Component -local React = require(Packages.React) +local React = require("@pkg/@jsdotlua/react") type LazyComponentType = React.LazyComponent -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") type Fiber = ReactInternalTypes.Fiber type FiberRoot = ReactInternalTypes.FiberRoot -local ReactFiberLane = require(script.Parent.ReactFiberLane) +local ReactFiberLane = require("./ReactFiberLane") type Lanes = ReactFiberLane.Lanes -- type Lane = ReactFiberLane.Lane; -- local type {MutableSource} = require(Packages.Shared.ReactTypes) -local ReactFiberSuspenseComponent = - require(script.Parent["ReactFiberSuspenseComponent.new"]) +local ReactFiberSuspenseComponent = require("./ReactFiberSuspenseComponent.new.lua") type SuspenseState = ReactFiberSuspenseComponent.SuspenseState type SuspenseListRenderState = ReactFiberSuspenseComponent.SuspenseListRenderState type SuspenseListTailMode = ReactFiberSuspenseComponent.SuspenseListTailMode -local ReactFiberSuspenseContext = require(script.Parent["ReactFiberSuspenseContext.new"]) +local ReactFiberSuspenseContext = require("./ReactFiberSuspenseContext.new.lua") type SuspenseContext = ReactFiberSuspenseContext.SuspenseContext -local ReactFiberOffscreenComponent = require(script.Parent.ReactFiberOffscreenComponent) +local ReactFiberOffscreenComponent = require("./ReactFiberOffscreenComponent") type OffscreenProps = ReactFiberOffscreenComponent.OffscreenProps type OffscreenState = ReactFiberOffscreenComponent.OffscreenState -local checkPropTypes = require(Packages.Shared).checkPropTypes +local checkPropTypes = require("@pkg/@jsdotlua/shared").checkPropTypes -local ReactWorkTags = require(script.Parent.ReactWorkTags) +local ReactWorkTags = require("./ReactWorkTags") -- local IndeterminateComponent = ReactWorkTags.IndeterminateComponent local FunctionComponent = ReactWorkTags.FunctionComponent local ClassComponent = ReactWorkTags.ClassComponent @@ -86,7 +84,7 @@ local IncompleteClassComponent = ReactWorkTags.IncompleteClassComponent -- local ScopeComponent = ReactWorkTags.ScopeComponent local OffscreenComponent = ReactWorkTags.OffscreenComponent local LegacyHiddenComponent = ReactWorkTags.LegacyHiddenComponent -local ReactFiberFlags = require(script.Parent.ReactFiberFlags) +local ReactFiberFlags = require("./ReactFiberFlags") local NoFlags = ReactFiberFlags.NoFlags local StaticMask = ReactFiberFlags.StaticMask local PerformedWork = ReactFiberFlags.PerformedWork @@ -98,8 +96,8 @@ local DidCapture = ReactFiberFlags.DidCapture local Ref = ReactFiberFlags.Ref local Deletion = ReactFiberFlags.Deletion local ForceUpdateForLegacySuspense = ReactFiberFlags.ForceUpdateForLegacySuspense -local ReactSharedInternals = require(Packages.Shared).ReactSharedInternals -local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags +local ReactSharedInternals = require("@pkg/@jsdotlua/shared").ReactSharedInternals +local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags local debugRenderPhaseSideEffectsForStrictMode = ReactFeatureFlags.debugRenderPhaseSideEffectsForStrictMode local disableLegacyContext = ReactFeatureFlags.disableLegacyContext @@ -111,19 +109,19 @@ local enableSuspenseServerRenderer = ReactFeatureFlags.enableSuspenseServerRende local warnAboutDefaultPropsOnFunctionComponents = ReactFeatureFlags.warnAboutDefaultPropsOnFunctionComponents -- local enableScopeAPI = ReactFeatureFlags.enableScopeAPI -local invariant = require(Packages.Shared).invariant -local describeError = require(Packages.Shared).describeError -local shallowEqual = require(Packages.Shared).shallowEqual -local getComponentName = require(Packages.Shared).getComponentName -local ReactSymbols = require(Packages.Shared).ReactSymbols +local invariant = require("@pkg/@jsdotlua/shared").invariant +local describeError = require("@pkg/@jsdotlua/shared").describeError +local shallowEqual = require("@pkg/@jsdotlua/shared").shallowEqual +local getComponentName = require("@pkg/@jsdotlua/shared").getComponentName +local ReactSymbols = require("@pkg/@jsdotlua/shared").ReactSymbols local REACT_LAZY_TYPE = ReactSymbols.REACT_LAZY_TYPE local _getIteratorFn = ReactSymbols.getIteratorFn -local ReactStrictModeWarnings = require(script.Parent["ReactStrictModeWarnings.new"]) -local ReactCurrentFiber = require(script.Parent.ReactCurrentFiber) +local ReactStrictModeWarnings = require("./ReactStrictModeWarnings.new.lua") +local ReactCurrentFiber = require("./ReactCurrentFiber") local getCurrentFiberOwnerNameInDevOrNull = ReactCurrentFiber.getCurrentFiberOwnerNameInDevOrNull local setIsRendering = ReactCurrentFiber.setIsRendering -local ReactFiberHotReloadingModule = require(script.Parent["ReactFiberHotReloading.new"]) +local ReactFiberHotReloadingModule = require("./ReactFiberHotReloading.new.lua") local resolveFunctionForHotReloading = ReactFiberHotReloadingModule.resolveFunctionForHotReloading local resolveForwardRefForHotReloading = @@ -131,21 +129,21 @@ local resolveForwardRefForHotReloading = local resolveClassForHotReloading = ReactFiberHotReloadingModule.resolveClassForHotReloading -local ReactChildFiber = require(script.Parent["ReactChildFiber.new"]) :: any +local ReactChildFiber = require("./ReactChildFiber.new.lua") :: any local mountChildFibers = ReactChildFiber.mountChildFibers local reconcileChildFibers = ReactChildFiber.reconcileChildFibers local cloneChildFibers = ReactChildFiber.cloneChildFibers -local ReactUpdateQueue = require(script.Parent["ReactUpdateQueue.new"]) +local ReactUpdateQueue = require("./ReactUpdateQueue.new.lua") local processUpdateQueue = ReactUpdateQueue.processUpdateQueue local cloneUpdateQueue = ReactUpdateQueue.cloneUpdateQueue local initializeUpdateQueue = ReactUpdateQueue.initializeUpdateQueue -local ReactTypeOfMode = require(script.Parent.ReactTypeOfMode) +local ReactTypeOfMode = require("./ReactTypeOfMode") local ConcurrentMode = ReactTypeOfMode.ConcurrentMode local NoMode = ReactTypeOfMode.NoMode local ProfileMode = ReactTypeOfMode.ProfileMode local StrictMode = ReactTypeOfMode.StrictMode local BlockingMode = ReactTypeOfMode.BlockingMode -local ReactFiberHostConfig = require(script.Parent.ReactFiberHostConfig) +local ReactFiberHostConfig = require("./ReactFiberHostConfig") local shouldSetTextContent = ReactFiberHostConfig.shouldSetTextContent local isSuspenseInstancePending = ReactFiberHostConfig.isSuspenseInstancePending local isSuspenseInstanceFallback = ReactFiberHostConfig.isSuspenseInstanceFallback @@ -153,7 +151,7 @@ local registerSuspenseInstanceRetry = ReactFiberHostConfig.registerSuspenseInsta local supportsHydration = ReactFiberHostConfig.supportsHydration type SuspenseInstance = ReactFiberHostConfig.SuspenseInstance -local ReactFiberHostContext = require(script.Parent["ReactFiberHostContext.new"]) +local ReactFiberHostContext = require("./ReactFiberHostContext.new.lua") local pushHostContext = ReactFiberHostContext.pushHostContext local pushHostContainer = ReactFiberHostContext.pushHostContainer local suspenseStackCursor = ReactFiberSuspenseContext.suspenseStackCursor @@ -166,10 +164,10 @@ local pushSuspenseContext = ReactFiberSuspenseContext.pushSuspenseContext -- local setShallowSuspenseContext = ReactFiberSuspenseContext.setShallowSuspenseContext local setDefaultShallowSuspenseContext = ReactFiberSuspenseContext.setDefaultShallowSuspenseContext --- local {findFirstSuspended} = require(script.Parent.ReactFiberSuspenseComponent.new) +-- local {findFirstSuspended} = require("./ReactFiberSuspenseComponent/new") -- local { -- , -local ReactFiberNewContext = require(script.Parent["ReactFiberNewContext.new"]) +local ReactFiberNewContext = require("./ReactFiberNewContext.new.lua") local propagateContextChange = ReactFiberNewContext.propagateContextChange local readContext = ReactFiberNewContext.readContext local calculateChangedBits = ReactFiberNewContext.calculateChangedBits @@ -186,15 +184,14 @@ local lazyRefs = { local function shouldSuspend(fiber: Fiber): boolean if not lazyRefs.shouldSuspendRef then - lazyRefs.shouldSuspendRef = - require(script.Parent.ReactFiberReconciler).shouldSuspend + lazyRefs.shouldSuspendRef = require("./ReactFiberReconciler").shouldSuspend end return lazyRefs.shouldSuspendRef(fiber) end -- ROBLOX deviation: collective lazy init methods from ReactFiberHooks local function initReactFiberHooks() - local ReactFiberHooks = require(script.Parent["ReactFiberHooks.new"]) + local ReactFiberHooks = require("./ReactFiberHooks.new.lua") lazyRefs.renderWithHooksRef = ReactFiberHooks.renderWithHooks lazyRefs.bailoutHooksRef = ReactFiberHooks.bailoutHooks end @@ -216,8 +213,8 @@ local function bailoutHooks(...) end local stopProfilerTimerIfRunning = - require(script.Parent["ReactProfilerTimer.new"]).stopProfilerTimerIfRunning -local ReactFiberContext = require(script.Parent["ReactFiberContext.new"]) + require("./ReactProfilerTimer.new.lua").stopProfilerTimerIfRunning +local ReactFiberContext = require("./ReactFiberContext.new.lua") local getMaskedContext = ReactFiberContext.getMaskedContext local getUnmaskedContext = ReactFiberContext.getUnmaskedContext local hasLegacyContextChanged = ReactFiberContext.hasContextChanged @@ -226,8 +223,7 @@ local isLegacyContextProvider = ReactFiberContext.isContextProvider local pushTopLevelContextObject = ReactFiberContext.pushTopLevelContextObject local invalidateContextProvider = ReactFiberContext.invalidateContextProvider -local ReactFiberHydrationContext = - require(script.Parent["ReactFiberHydrationContext.new"]) +local ReactFiberHydrationContext = require("./ReactFiberHydrationContext.new.lua") local resetHydrationState = ReactFiberHydrationContext.resetHydrationState local enterHydrationState = ReactFiberHydrationContext.enterHydrationState local reenterHydrationStateFromDehydratedSuspenseInstance = @@ -235,8 +231,7 @@ local reenterHydrationStateFromDehydratedSuspenseInstance = local tryToClaimNextHydratableInstance = ReactFiberHydrationContext.tryToClaimNextHydratableInstance local warnIfHydrating = ReactFiberHydrationContext.warnIfHydrating -local ReactFiberClassComponent = - require(script.Parent["ReactFiberClassComponent.new"]) :: any +local ReactFiberClassComponent = require("./ReactFiberClassComponent.new.lua") :: any local adoptClassInstance = ReactFiberClassComponent.adoptClassInstance local applyDerivedStateFromProps = ReactFiberClassComponent.applyDerivedStateFromProps local constructClassInstance = ReactFiberClassComponent.constructClassInstance @@ -245,8 +240,8 @@ local resumeMountClassInstance = ReactFiberClassComponent.resumeMountClassInstan local updateClassInstance = ReactFiberClassComponent.updateClassInstance local resolveDefaultProps = - require(script.Parent["ReactFiberLazyComponent.new"]).resolveDefaultProps -local ReactFiber = require(script.Parent["ReactFiber.new"]) + require("./ReactFiberLazyComponent.new.lua").resolveDefaultProps +local ReactFiber = require("./ReactFiber.new.lua") local resolveLazyComponentTag = ReactFiber.resolveLazyComponentTag local createFiberFromFragment = ReactFiber.createFiberFromFragment local createFiberFromOffscreen = ReactFiber.createFiberFromOffscreen @@ -254,7 +249,7 @@ local createFiberFromOffscreen = ReactFiber.createFiberFromOffscreen local createFiberFromTypeAndProps = ReactFiber.createFiberFromTypeAndProps local isSimpleFunctionComponent = ReactFiber.isSimpleFunctionComponent local createWorkInProgress = ReactFiber.createWorkInProgress -local ReactFiberWorkLoop = require(script.Parent["ReactFiberWorkLoop.new"]) :: any +local ReactFiberWorkLoop = require("./ReactFiberWorkLoop.new.lua") :: any local pushRenderLanes = ReactFiberWorkLoop.pushRenderLanes local markSpawnedWork = ReactFiberWorkLoop.markSpawnedWork local retryDehydratedSuspenseBoundary = ReactFiberWorkLoop.retryDehydratedSuspenseBoundary @@ -267,10 +262,10 @@ local NoContext = ReactFiberWorkLoop.NoContext local Schedule_tracing_wrap local setWorkInProgressVersion = - require(script.Parent["ReactMutableSource.new"]).setWorkInProgressVersion + require("./ReactMutableSource.new.lua").setWorkInProgressVersion local markSkippedUpdateLanes = - require(script.Parent.ReactFiberWorkInProgress).markSkippedUpdateLanes -local ConsolePatchingDev = require(Packages.Shared).ConsolePatchingDev + require("./ReactFiberWorkInProgress").markSkippedUpdateLanes +local ConsolePatchingDev = require("@pkg/@jsdotlua/shared").ConsolePatchingDev local disableLogs = ConsolePatchingDev.disableLogs local reenableLogs = ConsolePatchingDev.reenableLogs @@ -2552,7 +2547,8 @@ function updateDehydratedSuspenseComponent( if enableSchedulerTracing then if Schedule_tracing_wrap == nil then - Schedule_tracing_wrap = require(Packages.Scheduler).tracing.unstable_wrap + Schedule_tracing_wrap = + require("@pkg/@jsdotlua/scheduler").tracing.unstable_wrap end retry = Schedule_tracing_wrap(retry) end diff --git a/modules/react-reconciler/src/ReactFiberClassComponent.new.lua b/modules/react-reconciler/src/ReactFiberClassComponent.new.lua index 758eea83..66ba52f6 100644 --- a/modules/react-reconciler/src/ReactFiberClassComponent.new.lua +++ b/modules/react-reconciler/src/ReactFiberClassComponent.new.lua @@ -10,30 +10,29 @@ ]] local __DEV__ = _G.__DEV__ :: boolean -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Object = LuauPolyfill.Object -- ROBLOX: use patched console from shared -local console = require(Packages.Shared).console -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local console = require("@pkg/@jsdotlua/shared").console +local ReactInternalTypes = require("./ReactInternalTypes") type Fiber = ReactInternalTypes.Fiber -local ReactFiberLane = require(script.Parent.ReactFiberLane) +local ReactFiberLane = require("./ReactFiberLane") type Lanes = ReactFiberLane.Lanes -local ReactUpdateQueue = require(script.Parent["ReactUpdateQueue.new"]) +local ReactUpdateQueue = require("./ReactUpdateQueue.new.lua") type UpdateQueue = ReactInternalTypes.UpdateQueue -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") type React_Component = ReactTypes.React_Component -local React = require(Packages.React) +local React = require("@pkg/@jsdotlua/react") -local ReactFiberFlags = require(script.Parent.ReactFiberFlags) +local ReactFiberFlags = require("./ReactFiberFlags") local Update = ReactFiberFlags.Update local Snapshot = ReactFiberFlags.Snapshot local MountLayoutDev = ReactFiberFlags.MountLayoutDev -local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags +local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags local debugRenderPhaseSideEffectsForStrictMode = ReactFeatureFlags.debugRenderPhaseSideEffectsForStrictMode local disableLegacyContext = ReactFeatureFlags.disableLegacyContext @@ -42,23 +41,23 @@ local enableSchedulingProfiler = ReactFeatureFlags.enableSchedulingProfiler local warnAboutDeprecatedLifecycles = ReactFeatureFlags.warnAboutDeprecatedLifecycles local enableDoubleInvokingEffects = ReactFeatureFlags.enableDoubleInvokingEffects -local ReactStrictModeWarnings = require(script.Parent["ReactStrictModeWarnings.new"]) -local isMounted = require(script.Parent.ReactFiberTreeReflection).isMounted -local ReactInstanceMap = require(Packages.Shared).ReactInstanceMap +local ReactStrictModeWarnings = require("./ReactStrictModeWarnings.new.lua") +local isMounted = require("./ReactFiberTreeReflection").isMounted +local ReactInstanceMap = require("@pkg/@jsdotlua/shared").ReactInstanceMap local getInstance = ReactInstanceMap.get local setInstance = ReactInstanceMap.set -local shallowEqual = require(Packages.Shared).shallowEqual -local getComponentName = require(Packages.Shared).getComponentName -local UninitializedState = require(Packages.Shared).UninitializedState -local describeError = require(Packages.Shared).describeError --- local invariant = require(Packages.Shared).invariant -local ReactSymbols = require(Packages.Shared).ReactSymbols +local shallowEqual = require("@pkg/@jsdotlua/shared").shallowEqual +local getComponentName = require("@pkg/@jsdotlua/shared").getComponentName +local UninitializedState = require("@pkg/@jsdotlua/shared").UninitializedState +local describeError = require("@pkg/@jsdotlua/shared").describeError +-- local invariant = require("@pkg/@jsdotlua/shared").invariant +local ReactSymbols = require("@pkg/@jsdotlua/shared").ReactSymbols local REACT_CONTEXT_TYPE = ReactSymbols.REACT_CONTEXT_TYPE local REACT_PROVIDER_TYPE = ReactSymbols.REACT_PROVIDER_TYPE local resolveDefaultProps = - require(script.Parent["ReactFiberLazyComponent.new"]).resolveDefaultProps -local ReactTypeOfMode = require(script.Parent.ReactTypeOfMode) + require("./ReactFiberLazyComponent.new.lua").resolveDefaultProps +local ReactTypeOfMode = require("./ReactTypeOfMode") local DebugTracingMode = ReactTypeOfMode.DebugTracingMode local StrictMode = ReactTypeOfMode.StrictMode @@ -75,29 +74,29 @@ local initializeUpdateQueue = ReactUpdateQueue.initializeUpdateQueue local cloneUpdateQueue = ReactUpdateQueue.cloneUpdateQueue local NoLanes = ReactFiberLane.NoLanes -local ReactFiberContext = require(script.Parent["ReactFiberContext.new"]) +local ReactFiberContext = require("./ReactFiberContext.new.lua") local cacheContext = ReactFiberContext.cacheContext local getMaskedContext = ReactFiberContext.getMaskedContext local getUnmaskedContext = ReactFiberContext.getUnmaskedContext local hasContextChanged = ReactFiberContext.hasContextChanged local emptyContextObject = ReactFiberContext.emptyContextObject -local ReactFiberNewContext = require(script.Parent["ReactFiberNewContext.new"]) +local ReactFiberNewContext = require("./ReactFiberNewContext.new.lua") local readContext = ReactFiberNewContext.readContext --- local ReactFiberWorkLoop = require(script.Parent["ReactFiberWorkLoop.new"]) +-- local ReactFiberWorkLoop = require("./ReactFiberWorkLoop.new.lua") -- local requestEventTime = ReactFiberWorkLoop.requestEventTime -- local requestUpdateLane = ReactFiberWorkLoop.requestUpdateLane -- local scheduleUpdateOnFiber = ReactFiberWorkLoop.scheduleUpdateOnFiber -local DebugTracing = require(script.Parent.DebugTracing) +local DebugTracing = require("./DebugTracing") local logForceUpdateScheduled = DebugTracing.logForceUpdateScheduled local logStateUpdateScheduled = DebugTracing.logStateUpdateScheduled -local ConsolePatchingDev = require(Packages.Shared).ConsolePatchingDev +local ConsolePatchingDev = require("@pkg/@jsdotlua/shared").ConsolePatchingDev local disableLogs = ConsolePatchingDev.disableLogs local reenableLogs = ConsolePatchingDev.reenableLogs -local SchedulingProfiler = require(script.Parent.SchedulingProfiler) +local SchedulingProfiler = require("./SchedulingProfiler") local markForceUpdateScheduled = SchedulingProfiler.markForceUpdateScheduled local markStateUpdateScheduled = SchedulingProfiler.markStateUpdateScheduled @@ -243,7 +242,7 @@ end -- deviation: lazy initialize this to avoid cycles local classComponentUpdater = nil local function initializeClassComponentUpdater() - local ReactFiberWorkLoop = require(script.Parent["ReactFiberWorkLoop.new"]) + local ReactFiberWorkLoop = require("./ReactFiberWorkLoop.new.lua") local requestEventTime = ReactFiberWorkLoop.requestEventTime local requestUpdateLane = ReactFiberWorkLoop.requestUpdateLane local scheduleUpdateOnFiber = ReactFiberWorkLoop.scheduleUpdateOnFiber diff --git a/modules/react-reconciler/src/ReactFiberCommitWork.new.lua b/modules/react-reconciler/src/ReactFiberCommitWork.new.lua index 2d296a67..e5d09a08 100644 --- a/modules/react-reconciler/src/ReactFiberCommitWork.new.lua +++ b/modules/react-reconciler/src/ReactFiberCommitWork.new.lua @@ -40,15 +40,14 @@ local function isCallable(value) return false end -local Packages = script.Parent.Parent -- ROBLOX: use patched console from shared -local console = require(Packages.Shared).console -local LuauPolyfill = require(Packages.LuauPolyfill) +local console = require("@pkg/@jsdotlua/shared").console +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Error = LuauPolyfill.Error local Set = LuauPolyfill.Set type Array = { [number]: T } -local ReactFiberHostConfig = require(script.Parent.ReactFiberHostConfig) +local ReactFiberHostConfig = require("./ReactFiberHostConfig") type Instance = ReactFiberHostConfig.Instance type Container = ReactFiberHostConfig.Container type TextInstance = ReactFiberHostConfig.TextInstance @@ -58,19 +57,18 @@ type TextInstance = ReactFiberHostConfig.TextInstance -- ChildSet, -- UpdatePayload, type UpdatePayload = Array --- } = require(script.Parent.ReactFiberHostConfig) +-- } = require("./ReactFiberHostConfig") -- ROBLOX deviation END -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") type Fiber = ReactInternalTypes.Fiber type FiberRoot = ReactInternalTypes.FiberRoot -local ReactFiberSuspenseComponent = - require(script.Parent["ReactFiberSuspenseComponent.new"]) +local ReactFiberSuspenseComponent = require("./ReactFiberSuspenseComponent.new.lua") type SuspenseState = ReactFiberSuspenseComponent.SuspenseState -local ReactUpdateQueueModule = require(script.Parent["ReactUpdateQueue.new"]) +local ReactUpdateQueueModule = require("./ReactUpdateQueue.new.lua") type UpdateQueue = ReactInternalTypes.UpdateQueue --- local ReactFiberHooks = require(script.Parent["ReactFiberHooks.new"]) +-- local ReactFiberHooks = require("./ReactFiberHooks.new.lua") -- type FunctionComponentUpdateQueue = ReactFiberHooks.FunctionComponentUpdateQueue -- ROBLOX deviation: inline the typedef here to avoid circular dependency type Effect = { @@ -84,18 +82,18 @@ type FunctionComponentUpdateQueue = { lastEffect: Effect?, } -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") type Wakeable = ReactTypes.Wakeable type ReactPriorityLevel = ReactInternalTypes.ReactPriorityLevel -local ReactFiberOffscreenComponent = require(script.Parent.ReactFiberOffscreenComponent) +local ReactFiberOffscreenComponent = require("./ReactFiberOffscreenComponent") type OffscreenState = ReactFiberOffscreenComponent.OffscreenState -local ReactHookEffectTags = require(script.Parent.ReactHookEffectTags) +local ReactHookEffectTags = require("./ReactHookEffectTags") type HookFlags = ReactHookEffectTags.HookFlags -- ROBLOX deviation: import tracing as a top-level export to avoid direct file access -local Schedule_tracing_wrap = require(Packages.Scheduler).tracing.unstable_wrap -local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags +local Schedule_tracing_wrap = require("@pkg/@jsdotlua/scheduler").tracing.unstable_wrap +local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags local enableSchedulerTracing = ReactFeatureFlags.enableSchedulerTracing local enableProfilerTimer = ReactFeatureFlags.enableProfilerTimer local enableProfilerCommitHooks = ReactFeatureFlags.enableProfilerCommitHooks @@ -104,7 +102,7 @@ local enableProfilerCommitHooks = ReactFeatureFlags.enableProfilerCommitHooks local enableSuspenseCallback = ReactFeatureFlags.enableSuspenseCallback -- local enableScopeAPI = ReactFeatureFlags.enableScopeAPI local enableDoubleInvokingEffects = ReactFeatureFlags.enableDoubleInvokingEffects -local ReactWorkTags = require(script.Parent.ReactWorkTags) +local ReactWorkTags = require("./ReactWorkTags") local FunctionComponent = ReactWorkTags.FunctionComponent local ForwardRef = ReactWorkTags.ForwardRef local ClassComponent = ReactWorkTags.ClassComponent @@ -124,11 +122,11 @@ local ScopeComponent = ReactWorkTags.ScopeComponent local Block = ReactWorkTags.Block local OffscreenComponent = ReactWorkTags.OffscreenComponent local LegacyHiddenComponent = ReactWorkTags.LegacyHiddenComponent -local ReactErrorUtils = require(Packages.Shared).ReactErrorUtils +local ReactErrorUtils = require("@pkg/@jsdotlua/shared").ReactErrorUtils local invokeGuardedCallback = ReactErrorUtils.invokeGuardedCallback local hasCaughtError = ReactErrorUtils.hasCaughtError local clearCaughtError = ReactErrorUtils.clearCaughtError -local ReactFiberFlags = require(script.Parent.ReactFiberFlags) +local ReactFiberFlags = require("./ReactFiberFlags") local NoFlags = ReactFiberFlags.NoFlags local ContentReset = ReactFiberFlags.ContentReset local Placement = ReactFiberFlags.Placement @@ -138,25 +136,24 @@ local Callback = ReactFiberFlags.Callback local LayoutMask = ReactFiberFlags.LayoutMask local PassiveMask = ReactFiberFlags.PassiveMask local Ref = ReactFiberFlags.Ref -local getComponentName = require(Packages.Shared).getComponentName -local invariant = require(Packages.Shared).invariant -local describeError = require(Packages.Shared).describeError -local ReactCurrentFiber = require(script.Parent.ReactCurrentFiber) +local getComponentName = require("@pkg/@jsdotlua/shared").getComponentName +local invariant = require("@pkg/@jsdotlua/shared").invariant +local describeError = require("@pkg/@jsdotlua/shared").describeError +local ReactCurrentFiber = require("./ReactCurrentFiber") -- ROBLOX deviation: this property would be captured as values instead of bound local currentDebugFiberInDEV = ReactCurrentFiber.current local resetCurrentDebugFiberInDEV = ReactCurrentFiber.resetCurrentFiber local setCurrentDebugFiberInDEV = ReactCurrentFiber.setCurrentFiber -local onCommitUnmount = - require(script.Parent["ReactFiberDevToolsHook.new"]).onCommitUnmount +local onCommitUnmount = require("./ReactFiberDevToolsHook.new.lua").onCommitUnmount local resolveDefaultProps = - require(script.Parent["ReactFiberLazyComponent.new"]).resolveDefaultProps -local ReactProfilerTimer = require(script.Parent["ReactProfilerTimer.new"]) + require("./ReactFiberLazyComponent.new.lua").resolveDefaultProps +local ReactProfilerTimer = require("./ReactProfilerTimer.new.lua") local startLayoutEffectTimer = ReactProfilerTimer.startLayoutEffectTimer local recordPassiveEffectDuration = ReactProfilerTimer.recordPassiveEffectDuration local recordLayoutEffectDuration = ReactProfilerTimer.recordLayoutEffectDuration local startPassiveEffectTimer = ReactProfilerTimer.startPassiveEffectTimer local getCommitTime = ReactProfilerTimer.getCommitTime -local ProfileMode = require(script.Parent.ReactTypeOfMode).ProfileMode +local ProfileMode = require("./ReactTypeOfMode").ProfileMode local commitUpdateQueue = ReactUpdateQueueModule.commitUpdateQueue local getPublicInstance = ReactFiberHostConfig.getPublicInstance local supportsMutation = ReactFiberHostConfig.supportsMutation @@ -192,14 +189,14 @@ local ReactFiberWorkLoop local function resolveRetryWakeable(boundaryFiber: Fiber, wakeable: Wakeable): () if not ReactFiberWorkLoop then - ReactFiberWorkLoop = require(script.Parent["ReactFiberWorkLoop.new"]) :: any + ReactFiberWorkLoop = require("./ReactFiberWorkLoop.new.lua") :: any end ReactFiberWorkLoop.resolveRetryWakeable(boundaryFiber, wakeable) end local function markCommitTimeOfFallback(): () if not ReactFiberWorkLoop then - ReactFiberWorkLoop = require(script.Parent["ReactFiberWorkLoop.new"]) :: any + ReactFiberWorkLoop = require("./ReactFiberWorkLoop.new.lua") :: any end ReactFiberWorkLoop.markCommitTimeOfFallback() end @@ -234,7 +231,7 @@ local didWarnAboutReassigningPropsRef local didWarnAboutReassigningProps = function() if not didWarnAboutReassigningPropsRef then didWarnAboutReassigningPropsRef = - require(script.Parent["ReactFiberBeginWork.new"]).didWarnAboutReassigningProps + require("./ReactFiberBeginWork.new.lua").didWarnAboutReassigningProps end return didWarnAboutReassigningPropsRef end diff --git a/modules/react-reconciler/src/ReactFiberCompleteWork.new.lua b/modules/react-reconciler/src/ReactFiberCompleteWork.new.lua index 6beb41d6..8aa40116 100644 --- a/modules/react-reconciler/src/ReactFiberCompleteWork.new.lua +++ b/modules/react-reconciler/src/ReactFiberCompleteWork.new.lua @@ -15,20 +15,18 @@ local function unimplemented(message: string) error("FIXME (roblox): " .. message .. " is unimplemented", 2) end -local Packages = script.Parent.Parent - -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") type Fiber = ReactInternalTypes.Fiber -local ReactFiberLane = require(script.Parent.ReactFiberLane) +local ReactFiberLane = require("./ReactFiberLane") type Lanes = ReactFiberLane.Lanes type Lane = ReactFiberLane.Lane local OffscreenLane = ReactFiberLane.OffscreenLane -- local type { -- ReactFundamentalComponentInstance, -- ReactScopeInstance, --- } = require(Packages.Shared).ReactTypes --- local type {FiberRoot} = require(script.Parent.ReactInternalTypes) -local ReactFiberHostConfig = require(script.Parent.ReactFiberHostConfig) +-- } = require("@pkg/@jsdotlua/shared").ReactTypes +-- local type {FiberRoot} = require("./ReactInternalTypes") +local ReactFiberHostConfig = require("./ReactFiberHostConfig") type Instance = ReactFiberHostConfig.Instance type Type = ReactFiberHostConfig.Type type Props = ReactFiberHostConfig.Props @@ -37,17 +35,17 @@ type ChildSet = ReactFiberHostConfig.ChildSet -- local type { -- SuspenseState, -- SuspenseListRenderState, --- } = require(script.Parent.ReactFiberSuspenseComponent.new) -local ReactFiberOffscreenComponent = require(script.Parent.ReactFiberOffscreenComponent) +-- } = require("./ReactFiberSuspenseComponent/new") +local ReactFiberOffscreenComponent = require("./ReactFiberOffscreenComponent") type OffscreenState = ReactFiberOffscreenComponent.OffscreenState -local ReactMutableSource = require(script.Parent["ReactMutableSource.new"]) +local ReactMutableSource = require("./ReactMutableSource.new.lua") local resetMutableSourceWorkInProgressVersions = ReactMutableSource.resetWorkInProgressVersions --- local {now} = require(script.Parent.SchedulerWithReactIntegration.new) +-- local {now} = require("./SchedulerWithReactIntegration/new") -local ReactWorkTags = require(script.Parent.ReactWorkTags) +local ReactWorkTags = require("./ReactWorkTags") local IndeterminateComponent = ReactWorkTags.IndeterminateComponent local FunctionComponent = ReactWorkTags.FunctionComponent local ClassComponent = ReactWorkTags.ClassComponent @@ -72,18 +70,17 @@ local ScopeComponent = ReactWorkTags.ScopeComponent local Block = ReactWorkTags.Block local OffscreenComponent = ReactWorkTags.OffscreenComponent local LegacyHiddenComponent = ReactWorkTags.LegacyHiddenComponent -local ReactFiberSuspenseComponent = - require(script.Parent["ReactFiberSuspenseComponent.new"]) +local ReactFiberSuspenseComponent = require("./ReactFiberSuspenseComponent.new.lua") type SuspenseState = ReactFiberSuspenseComponent.SuspenseState type SuspenseListRenderState = ReactFiberSuspenseComponent.SuspenseState -local ReactTypeOfMode = require(script.Parent.ReactTypeOfMode) +local ReactTypeOfMode = require("./ReactTypeOfMode") local NoMode = ReactTypeOfMode.NoMode local ConcurrentMode = ReactTypeOfMode.ConcurrentMode local BlockingMode = ReactTypeOfMode.BlockingMode local ProfileMode = ReactTypeOfMode.ProfileMode -local ReactFiberFlags = require(script.Parent.ReactFiberFlags) +local ReactFiberFlags = require("./ReactFiberFlags") local Ref = ReactFiberFlags.Ref local Update = ReactFiberFlags.Update local Callback = ReactFiberFlags.Callback @@ -98,7 +95,7 @@ local PassiveMask = ReactFiberFlags.PassiveMask local StaticMask = ReactFiberFlags.StaticMask local PerformedWork = ReactFiberFlags.PerformedWork -local invariant = require(Packages.Shared).invariant +local invariant = require("@pkg/@jsdotlua/shared").invariant local createInstance = ReactFiberHostConfig.createInstance local createTextInstance = ReactFiberHostConfig.createTextInstance @@ -119,13 +116,13 @@ local finalizeContainerChildren = ReactFiberHostConfig.finalizeContainerChildren -- local shouldUpdateFundamentalComponent = ReactFiberHostConfig.shouldUpdateFundamentalComponent local preparePortalMount = ReactFiberHostConfig.preparePortalMount -- local prepareScopeUpdate = ReactFiberHostConfig.prepareScopeUpdate -local ReactFiberHostContext = require(script.Parent["ReactFiberHostContext.new"]) +local ReactFiberHostContext = require("./ReactFiberHostContext.new.lua") local getRootHostContainer = ReactFiberHostContext.getRootHostContainer local popHostContext = ReactFiberHostContext.popHostContext local getHostContext = ReactFiberHostContext.getHostContext local popHostContainer = ReactFiberHostContext.popHostContainer -local ReactFiberSuspenseContext = require(script.Parent["ReactFiberSuspenseContext.new"]) +local ReactFiberSuspenseContext = require("./ReactFiberSuspenseContext.new.lua") local popSuspenseContext = ReactFiberSuspenseContext.popSuspenseContext local suspenseStackCursor = ReactFiberSuspenseContext.suspenseStackCursor local InvisibleParentSuspenseContext = @@ -137,15 +134,14 @@ type SuspenseContext = ReactFiberSuspenseContext.SuspenseContext -- local ForceSuspenseFallback = ReactFiberSuspenseContext.ForceSuspenseFallback -- local setDefaultShallowSuspenseContext = ReactFiberSuspenseContext.setDefaultShallowSuspenseContext --- local {findFirstSuspended} = require(script.Parent.ReactFiberSuspenseComponent.new) -local ReactFiberContext = require(script.Parent["ReactFiberContext.new"]) +-- local {findFirstSuspended} = require("./ReactFiberSuspenseComponent/new") +local ReactFiberContext = require("./ReactFiberContext.new.lua") local isLegacyContextProvider = ReactFiberContext.isContextProvider local popLegacyContext = ReactFiberContext.popContext local popTopLevelLegacyContextObject = ReactFiberContext.popTopLevelContextObject -local popProvider = require(script.Parent["ReactFiberNewContext.new"]).popProvider +local popProvider = require("./ReactFiberNewContext.new.lua").popProvider -local ReactFiberHydrationContext = - require(script.Parent["ReactFiberHydrationContext.new"]) +local ReactFiberHydrationContext = require("./ReactFiberHydrationContext.new.lua") local prepareToHydrateHostSuspenseInstance = ReactFiberHydrationContext.prepareToHydrateHostSuspenseInstance local popHydrationState = ReactFiberHydrationContext.popHydrationState @@ -155,7 +151,7 @@ local prepareToHydrateHostInstance = ReactFiberHydrationContext.prepareToHydrateHostInstance local prepareToHydrateHostTextInstance = ReactFiberHydrationContext.prepareToHydrateHostTextInstance -local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags +local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags local enableSchedulerTracing = ReactFeatureFlags.enableSchedulerTracing local enableSuspenseCallback = ReactFeatureFlags.enableSuspenseCallback local enableSuspenseServerRenderer = ReactFeatureFlags.enableSuspenseServerRenderer @@ -163,7 +159,7 @@ local enableFundamentalAPI = ReactFeatureFlags.enableFundamentalAPI -- local enableScopeAPI = ReactFeatureFlags.enableScopeAPI local enableProfilerTimer = ReactFeatureFlags.enableProfilerTimer -local ReactFiberWorkLoop = require(script.Parent["ReactFiberWorkLoop.new"]) :: any +local ReactFiberWorkLoop = require("./ReactFiberWorkLoop.new.lua") :: any local popRenderLanes = ReactFiberWorkLoop.popRenderLanes -- ROBLOX deviation: this is a live value in WorkLoop's module state, so it must be accessed directly and not 'cached' @@ -174,16 +170,16 @@ local renderDidSuspendDelayIfPossible = ReactFiberWorkLoop.renderDidSuspendDelay -- local renderHasNotSuspendedYet = ReactFiberWorkLoop.renderHasNotSuspendedYet -- local getRenderTargetTime = ReactFiberWorkLoop.getRenderTargetTime --- local {createFundamentalStateInstance} = require(script.Parent.ReactFiberFundamental.new) +-- local {createFundamentalStateInstance} = require("./ReactFiberFundamental/new") -- local OffscreenLane = ReactFiberLane.OffscreenLane -- local SomeRetryLane = ReactFiberLane.SomeRetryLane local NoLanes = ReactFiberLane.NoLanes local includesSomeLane = ReactFiberLane.includesSomeLane local mergeLanes = ReactFiberLane.mergeLanes --- local {resetChildFibers} = require(script.Parent.ReactChildFiber.new) --- local {createScopeInstance} = require(script.Parent.ReactFiberScope.new) -local ReactProfilerTimer = require(script.Parent["ReactProfilerTimer.new"]) +-- local {resetChildFibers} = require("./ReactChildFiber/new") +-- local {createScopeInstance} = require("./ReactFiberScope/new") +local ReactProfilerTimer = require("./ReactProfilerTimer.new.lua") local transferActualDuration = ReactProfilerTimer.transferActualDuration local function markUpdate(workInProgress: Fiber) diff --git a/modules/react-reconciler/src/ReactFiberComponentStack.lua b/modules/react-reconciler/src/ReactFiberComponentStack.lua index d0fff391..25b12992 100644 --- a/modules/react-reconciler/src/ReactFiberComponentStack.lua +++ b/modules/react-reconciler/src/ReactFiberComponentStack.lua @@ -9,15 +9,14 @@ * @flow ]] -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") type Function = (...any) -> ...any type Error = LuauPolyfill.Error -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") type Fiber = ReactInternalTypes.Fiber -local ReactWorkTags = require(script.Parent.ReactWorkTags) +local ReactWorkTags = require("./ReactWorkTags") local HostComponent = ReactWorkTags.HostComponent local LazyComponent = ReactWorkTags.LazyComponent local SuspenseComponent = ReactWorkTags.SuspenseComponent @@ -28,7 +27,7 @@ local ForwardRef = ReactWorkTags.ForwardRef local SimpleMemoComponent = ReactWorkTags.SimpleMemoComponent local ClassComponent = ReactWorkTags.ClassComponent -local ReactComponentStackFrame = require(Packages.Shared).ReactComponentStackFrame +local ReactComponentStackFrame = require("@pkg/@jsdotlua/shared").ReactComponentStackFrame local describeBuiltInComponentFrame = ReactComponentStackFrame.describeBuiltInComponentFrame local describeFunctionComponentFrame = diff --git a/modules/react-reconciler/src/ReactFiberContext.new.lua b/modules/react-reconciler/src/ReactFiberContext.new.lua index 4dc8f31a..20e308db 100644 --- a/modules/react-reconciler/src/ReactFiberContext.new.lua +++ b/modules/react-reconciler/src/ReactFiberContext.new.lua @@ -12,27 +12,26 @@ local __DEV__ = _G.__DEV__ :: boolean local __DISABLE_ALL_WARNINGS_EXCEPT_PROP_VALIDATION__ = _G.__DISABLE_ALL_WARNINGS_EXCEPT_PROP_VALIDATION__ :: boolean -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Object = LuauPolyfill.Object local Error = LuauPolyfill.Error -- ROBLOX: use patched console from shared -local console = require(Packages.Shared).console +local console = require("@pkg/@jsdotlua/shared").console -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") type Fiber = ReactInternalTypes.Fiber -local ReactFiberStack = require(script.Parent["ReactFiberStack.new"]) +local ReactFiberStack = require("./ReactFiberStack.new.lua") type StackCursor = ReactFiberStack.StackCursor -local isFiberMounted = require(script.Parent.ReactFiberTreeReflection).isFiberMounted +local isFiberMounted = require("./ReactFiberTreeReflection").isFiberMounted local disableLegacyContext = - require(Packages.Shared).ReactFeatureFlags.disableLegacyContext -local ReactWorkTags = require(script.Parent.ReactWorkTags) + require("@pkg/@jsdotlua/shared").ReactFeatureFlags.disableLegacyContext +local ReactWorkTags = require("./ReactWorkTags") local ClassComponent = ReactWorkTags.ClassComponent local HostRoot = ReactWorkTags.HostRoot -local getComponentName = require(Packages.Shared).getComponentName -local checkPropTypes = require(Packages.Shared).checkPropTypes +local getComponentName = require("@pkg/@jsdotlua/shared").getComponentName +local checkPropTypes = require("@pkg/@jsdotlua/shared").checkPropTypes local createCursor = ReactFiberStack.createCursor local push = ReactFiberStack.push diff --git a/modules/react-reconciler/src/ReactFiberDevToolsHook.new.lua b/modules/react-reconciler/src/ReactFiberDevToolsHook.new.lua index a32165cf..a3477e0d 100644 --- a/modules/react-reconciler/src/ReactFiberDevToolsHook.new.lua +++ b/modules/react-reconciler/src/ReactFiberDevToolsHook.new.lua @@ -8,10 +8,9 @@ * @flow ]] -local Packages = script.Parent.Parent -- ROBLOX: use patched console from shared -local console = require(Packages.Shared).console -local LuauPolyfill = require(Packages.LuauPolyfill) +local console = require("@pkg/@jsdotlua/shared").console +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") type Object = LuauPolyfill.Object local exports = {} @@ -41,16 +40,17 @@ local function isCallable(value) return false end -local enableProfilerTimer = require(Packages.Shared).ReactFeatureFlags.enableProfilerTimer +local enableProfilerTimer = + require("@pkg/@jsdotlua/shared").ReactFeatureFlags.enableProfilerTimer -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") type Fiber = ReactInternalTypes.Fiber type FiberRoot = ReactInternalTypes.FiberRoot type ReactPriorityLevel = ReactInternalTypes.ReactPriorityLevel -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") type ReactNodeList = ReactTypes.ReactNodeList -local DidCapture = require(script.Parent.ReactFiberFlags).DidCapture +local DidCapture = require("./ReactFiberFlags").DidCapture -- ROBLOX deviation: we'll inject this a different way -- declare var __REACT_DEVTOOLS_GLOBAL_HOOK__: Object | void diff --git a/modules/react-reconciler/src/ReactFiberErrorLogger.lua b/modules/react-reconciler/src/ReactFiberErrorLogger.lua index 6c4beb0b..fa9b486a 100644 --- a/modules/react-reconciler/src/ReactFiberErrorLogger.lua +++ b/modules/react-reconciler/src/ReactFiberErrorLogger.lua @@ -9,24 +9,23 @@ * @flow ]] -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") type Error = LuauPolyfill.Error local inspect = LuauPolyfill.util.inspect local setTimeout = LuauPolyfill.setTimeout -local Shared = require(Packages.Shared) +local Shared = require("@pkg/@jsdotlua/shared") local console = Shared.console local errorToString = Shared.errorToString -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") type Fiber = ReactInternalTypes.Fiber -local ReactCapturedValue = require(script.Parent.ReactCapturedValue) +local ReactCapturedValue = require("./ReactCapturedValue") type CapturedValue = ReactCapturedValue.CapturedValue -local showErrorDialog = require(script.Parent.ReactFiberErrorDialog).showErrorDialog -local ClassComponent = require(script.Parent.ReactWorkTags).ClassComponent -local getComponentName = require(Packages.Shared).getComponentName +local showErrorDialog = require("./ReactFiberErrorDialog").showErrorDialog +local ClassComponent = require("./ReactWorkTags").ClassComponent +local getComponentName = require("@pkg/@jsdotlua/shared").getComponentName local exports = {} diff --git a/modules/react-reconciler/src/ReactFiberHooks.new.lua b/modules/react-reconciler/src/ReactFiberHooks.new.lua index 4952796a..db032701 100644 --- a/modules/react-reconciler/src/ReactFiberHooks.new.lua +++ b/modules/react-reconciler/src/ReactFiberHooks.new.lua @@ -16,20 +16,19 @@ local function unimplemented(message: string) error("FIXME (roblox): " .. message .. " is unimplemented") end local __DEV__ = _G.__DEV__ :: boolean -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array local Error = LuauPolyfill.Error local Object = LuauPolyfill.Object -- ROBLOX: use Bindings to implement useRef -local createRef = require(Packages.React).createRef -local createBinding = require(Packages.React).createBinding +local createRef = require("@pkg/@jsdotlua/react").createRef +local createBinding = require("@pkg/@jsdotlua/react").createBinding -- ROBLOX: use patched console from shared -local console = require(Packages.Shared).console +local console = require("@pkg/@jsdotlua/shared").console -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") type ReactContext = ReactTypes.ReactContext type ReactBinding = ReactTypes.ReactBinding type ReactBindingUpdater = ReactTypes.ReactBindingUpdater @@ -43,31 +42,31 @@ type MutableSourceSubscribeFn = ReactTypes.MutableSourceSubscr Snapshot > -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") type Fiber = ReactInternalTypes.Fiber type Dispatcher = ReactInternalTypes.Dispatcher type HookType = ReactInternalTypes.HookType type ReactPriorityLevel = ReactInternalTypes.ReactPriorityLevel -local ReactFiberLane = require(script.Parent.ReactFiberLane) +local ReactFiberLane = require("./ReactFiberLane") type Lanes = ReactFiberLane.Lanes type Lane = ReactFiberLane.Lane -local ReactHookEffectTags = require(script.Parent.ReactHookEffectTags) +local ReactHookEffectTags = require("./ReactHookEffectTags") type HookFlags = ReactHookEffectTags.HookFlags type FiberRoot = ReactInternalTypes.FiberRoot -- ROBLOX TODO: figure out how to expose types through dynamic exports --- local type {OpaqueIDType} = require(script.Parent.ReactFiberHostConfig) +-- local type {OpaqueIDType} = require("./ReactFiberHostConfig") type OpaqueIDType = any -local ReactSharedInternals = require(Packages.Shared).ReactSharedInternals -local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags +local ReactSharedInternals = require("@pkg/@jsdotlua/shared").ReactSharedInternals +local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags local enableDebugTracing: boolean? = ReactFeatureFlags.enableDebugTracing local enableSchedulingProfiler: boolean? = ReactFeatureFlags.enableSchedulingProfiler local enableNewReconciler: boolean? = ReactFeatureFlags.enableNewReconciler -- local decoupleUpdatePriorityFromScheduler = ReactFeatureFlags.decoupleUpdatePriorityFromScheduler local enableDoubleInvokingEffects = ReactFeatureFlags.enableDoubleInvokingEffects --- local ReactTypeOfMode = require(script.Parent.ReactTypeOfMode) -local DebugTracingMode = require(script.Parent.ReactTypeOfMode).DebugTracingMode +-- local ReactTypeOfMode = require("./ReactTypeOfMode") +local DebugTracingMode = require("./ReactTypeOfMode").DebugTracingMode local NoLane = ReactFiberLane.NoLane local NoLanes = ReactFiberLane.NoLanes -- local InputContinuousLanePriority = ReactFiberLane.InputContinuousLanePriority @@ -80,9 +79,9 @@ local markRootMutableRead = ReactFiberLane.markRootMutableRead -- local setCurrentUpdateLanePriority = ReactFiberLane.setCurrentUpdateLanePriority -- local higherLanePriority = ReactFiberLane.higherLanePriority -- local DefaultLanePriority = ReactFiberLane.DefaultLanePriority -local ReactFiberNewContext = require(script.Parent["ReactFiberNewContext.new"]) +local ReactFiberNewContext = require("./ReactFiberNewContext.new.lua") local readContext = ReactFiberNewContext.readContext -local ReactFiberFlags = require(script.Parent.ReactFiberFlags) +local ReactFiberFlags = require("./ReactFiberFlags") local UpdateEffect = ReactFiberFlags.Update local PassiveEffect = ReactFiberFlags.Passive local PassiveStaticEffect = ReactFiberFlags.PassiveStatic @@ -91,7 +90,7 @@ local MountPassiveDevEffect = ReactFiberFlags.MountPassiveDev local HookHasEffect = ReactHookEffectTags.HasEffect local HookLayout = ReactHookEffectTags.Layout local HookPassive = ReactHookEffectTags.Passive -local ReactFiberWorkLoop = require(script.Parent["ReactFiberWorkLoop.new"]) :: any +local ReactFiberWorkLoop = require("./ReactFiberWorkLoop.new.lua") :: any local warnIfNotCurrentlyActingUpdatesInDEV = ReactFiberWorkLoop.warnIfNotCurrentlyActingUpdatesInDEV local scheduleUpdateOnFiber = ReactFiberWorkLoop.scheduleUpdateOnFiber @@ -107,44 +106,41 @@ local warnIfNotCurrentlyActingEffectsInDEV = -- requestUpdateLane, -- requestEventTime, -- warnIfNotCurrentlyActingEffectsInDEV, --- } = require(script.Parent.ReactFiberWorkLoop.new) +-- } = require("./ReactFiberWorkLoop/new") -local invariant = require(Packages.Shared).invariant -local getComponentName = require(Packages.Shared).getComponentName --- local is = require(Packages.Shared).objectIs +local invariant = require("@pkg/@jsdotlua/shared").invariant +local getComponentName = require("@pkg/@jsdotlua/shared").getComponentName +-- local is = require("@pkg/@jsdotlua/shared").objectIs local function is(x: any, y: any) return x == y and (x ~= 0 or 1 / x == 1 / y) or x ~= x and y ~= y -- eslint-disable-line no-self-compare end local markWorkInProgressReceivedUpdate = - require(script.Parent["ReactFiberBeginWork.new"]).markWorkInProgressReceivedUpdate :: any + require("./ReactFiberBeginWork.new.lua").markWorkInProgressReceivedUpdate :: any -- local { -- UserBlockingPriority, -- NormalPriority, -- runWithPriority, -- getCurrentPriorityLevel, --- } = require(script.Parent.SchedulerWithReactIntegration.new) -local getIsHydrating = - require(script.Parent["ReactFiberHydrationContext.new"]).getIsHydrating +-- } = require("./SchedulerWithReactIntegration/new") +local getIsHydrating = require("./ReactFiberHydrationContext.new.lua").getIsHydrating -- local { -- makeClientId, -- makeClientIdInDEV, -- makeOpaqueHydratingObject, -local ReactFiberHostConfig = require(script.Parent.ReactFiberHostConfig) +local ReactFiberHostConfig = require("./ReactFiberHostConfig") local makeClientId = ReactFiberHostConfig.makeClientId -- local makeOpaqueHydratingObject = ReactFiberHostConfig.makeOpaqueHydratingObject -- local makeClientIdInDEV = ReactFiberHostConfig.makeClientIdInDEV -local ReactMutableSource = require(script.Parent["ReactMutableSource.new"]) +local ReactMutableSource = require("./ReactMutableSource.new.lua") local warnAboutMultipleRenderersDEV = ReactMutableSource.warnAboutMultipleRenderersDEV local getWorkInProgressVersion = ReactMutableSource.getWorkInProgressVersion local setWorkInProgressVersion = ReactMutableSource.setWorkInProgressVersion local markSourceAsDirty = ReactMutableSource.markSourceAsDirty --- local getIsRendering = require(script.Parent.ReactCurrentFiber).getIsRendering -local logStateUpdateScheduled = - require(script.Parent.DebugTracing).logStateUpdateScheduled -local markStateUpdateScheduled = - require(script.Parent.SchedulingProfiler).markStateUpdateScheduled +-- local getIsRendering = require("./ReactCurrentFiber").getIsRendering +local logStateUpdateScheduled = require("./DebugTracing").logStateUpdateScheduled +local markStateUpdateScheduled = require("./SchedulingProfiler").markStateUpdateScheduled local ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher -- local ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig diff --git a/modules/react-reconciler/src/ReactFiberHostContext.new.lua b/modules/react-reconciler/src/ReactFiberHostContext.new.lua index c9df0451..094a43ff 100644 --- a/modules/react-reconciler/src/ReactFiberHostContext.new.lua +++ b/modules/react-reconciler/src/ReactFiberHostContext.new.lua @@ -9,17 +9,15 @@ * @flow ]] --- local Packages = script.Parent.Parent - -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") type Fiber = ReactInternalTypes.Fiber -local ReactFiberStack = require(script.Parent["ReactFiberStack.new"]) +local ReactFiberStack = require("./ReactFiberStack.new.lua") type StackCursor = ReactFiberStack.StackCursor -local ReactFiberHostConfig = require(script.Parent.ReactFiberHostConfig) +local ReactFiberHostConfig = require("./ReactFiberHostConfig") type Container = ReactFiberHostConfig.Container type HostContext = ReactFiberHostConfig.HostContext --- local invariant = require(Packages.Shared).invariant +-- local invariant = require("@pkg/@jsdotlua/shared").invariant local getChildHostContext = ReactFiberHostConfig.getChildHostContext local getRootHostContext = ReactFiberHostConfig.getRootHostContext diff --git a/modules/react-reconciler/src/ReactFiberHotReloading.new.lua b/modules/react-reconciler/src/ReactFiberHotReloading.new.lua index 671bc952..320a4dc4 100644 --- a/modules/react-reconciler/src/ReactFiberHotReloading.new.lua +++ b/modules/react-reconciler/src/ReactFiberHotReloading.new.lua @@ -9,27 +9,25 @@ * @flow ]] -local Packages = script.Parent.Parent - -local ReactElementType = require(Packages.Shared) +local ReactElementType = require("@pkg/@jsdotlua/shared") -- ROBLOX deviation: ReactElement is defined at the top level of Shared along -- with the rest of the ReactTypes type ReactElement = ReactElementType.ReactElement -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") type Fiber = ReactInternalTypes.Fiber --- local type {FiberRoot} = require(script.Parent.ReactInternalTypes) --- local type {Instance} = require(script.Parent.ReactFiberHostConfig) --- local type {ReactNodeList} = require(Packages.Shared).ReactTypes +-- local type {FiberRoot} = require("./ReactInternalTypes") +-- local type {Instance} = require("./ReactFiberHostConfig") +-- local type {ReactNodeList} = require("@pkg/@jsdotlua/shared").ReactTypes -- local { -- flushSync, -- scheduleUpdateOnFiber, -- flushPassiveEffects, --- } = require(script.Parent.ReactFiberWorkLoop.new) --- local {updateContainer} = require(script.Parent.ReactFiberReconciler.new) --- local {emptyContextObject} = require(script.Parent.ReactFiberContext.new) --- local {SyncLane, NoTimestamp} = require(script.Parent.ReactFiberLane) +-- } = require("./ReactFiberWorkLoop/new") +-- local {updateContainer} = require("./ReactFiberReconciler/new") +-- local {emptyContextObject} = require("./ReactFiberContext/new") +-- local {SyncLane, NoTimestamp} = require("./ReactFiberLane") -- local { -- ClassComponent, -- FunctionComponent, @@ -39,8 +37,8 @@ type Fiber = ReactInternalTypes.Fiber -- HostRoot, -- MemoComponent, -- SimpleMemoComponent, --- } = require(script.Parent.ReactWorkTags) -local ReactSymbols = require(Packages.Shared).ReactSymbols +-- } = require("./ReactWorkTags") +local ReactSymbols = require("@pkg/@jsdotlua/shared").ReactSymbols local REACT_FORWARD_REF_TYPE = ReactSymbols.REACT_FORWARD_REF_TYPE -- REACT_MEMO_TYPE, -- REACT_LAZY_TYPE, diff --git a/modules/react-reconciler/src/ReactFiberHydrationContext.new.lua b/modules/react-reconciler/src/ReactFiberHydrationContext.new.lua index 9049d496..a2a64b19 100644 --- a/modules/react-reconciler/src/ReactFiberHydrationContext.new.lua +++ b/modules/react-reconciler/src/ReactFiberHydrationContext.new.lua @@ -9,9 +9,8 @@ * @flow ]] -local Packages = script.Parent.Parent -- ROBLOX: use patched console from shared -local console = require(Packages.Shared).console +local console = require("@pkg/@jsdotlua/shared").console -- FIXME (roblox): remove this when our unimplemented local function unimplemented(message: string) @@ -21,9 +20,9 @@ local function unimplemented(message: string) error("FIXME (roblox): " .. message .. " is unimplemented", 2) end -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") type Fiber = ReactInternalTypes.Fiber -local ReactFiberHostConfig = require(script.Parent.ReactFiberHostConfig) +local ReactFiberHostConfig = require("./ReactFiberHostConfig") type Instance = ReactFiberHostConfig.Instance type TextInstance = ReactFiberHostConfig.TextInstance type HydratableInstance = ReactFiberHostConfig.HydratableInstance @@ -31,23 +30,22 @@ type SuspenseInstance = ReactFiberHostConfig.SuspenseInstance type Container = ReactFiberHostConfig.Container type HostContext = ReactFiberHostConfig.HostContext -local ReactFiberSuspenseComponent = - require(script.Parent["ReactFiberSuspenseComponent.new"]) +local ReactFiberSuspenseComponent = require("./ReactFiberSuspenseComponent.new.lua") type SuspenseState = ReactFiberSuspenseComponent.SuspenseState -local ReactWorkTags = require(script.Parent.ReactWorkTags) +local ReactWorkTags = require("./ReactWorkTags") local HostComponent = ReactWorkTags.HostComponent local HostText = ReactWorkTags.HostText local HostRoot = ReactWorkTags.HostRoot local SuspenseComponent = ReactWorkTags.SuspenseComponent -local ReactFiberFlags = require(script.Parent.ReactFiberFlags) +local ReactFiberFlags = require("./ReactFiberFlags") local Placement = ReactFiberFlags.Placement local Hydrating = ReactFiberFlags.Hydrating -- local Deletion = ReactFiberFlags.Deletion -local invariant = require(Packages.Shared).invariant +local invariant = require("@pkg/@jsdotlua/shared").invariant -local ReactFiber = require(script.Parent["ReactFiber.new"]) +local ReactFiber = require("./ReactFiber.new.lua") -- local createFiberFromHostInstanceForDeletion = ReactFiber.createFiberFromHostInstanceForDeletion local createFiberFromDehydratedFragment = ReactFiber.createFiberFromDehydratedFragment @@ -79,8 +77,8 @@ local shouldSetTextContent = ReactFiberHostConfig.shouldSetTextContent -- didNotFindHydratableSuspenseInstance, -- } = require(Packages../ReactFiberHostConfig' local enableSuspenseServerRenderer = - require(Packages.Shared).ReactFeatureFlags.enableSuspenseServerRenderer -local OffscreenLane = require(script.Parent.ReactFiberLane).OffscreenLane + require("@pkg/@jsdotlua/shared").ReactFeatureFlags.enableSuspenseServerRenderer +local OffscreenLane = require("./ReactFiberLane").OffscreenLane -- The deepest Fiber on the stack involved in a hydration context. -- This may have been an insertion or a hydration. diff --git a/modules/react-reconciler/src/ReactFiberLane.lua b/modules/react-reconciler/src/ReactFiberLane.lua index 1e4e74e6..1fb71a22 100644 --- a/modules/react-reconciler/src/ReactFiberLane.lua +++ b/modules/react-reconciler/src/ReactFiberLane.lua @@ -8,14 +8,13 @@ * * @flow ]] -local Packages = script.Parent.Parent -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") type FiberRoot = ReactInternalTypes.FiberRoot type ReactPriorityLevel = ReactInternalTypes.ReactPriorityLevel -local console = require(Packages.Shared).console +local console = require("@pkg/@jsdotlua/shared").console local ReactFiberSchedulerPriorities = - require(script.Parent["ReactFiberSchedulerPriorities.roblox"]) + require("./ReactFiberSchedulerPriorities.roblox.lua") -- deviation: Instead of defining these here, and and re-exporting in -- `ReactInternalTypes`, we depend on and re-export them here to avoid cyclical @@ -25,7 +24,7 @@ export type Lane = ReactInternalTypes.Lane export type Lanes = ReactInternalTypes.Lanes export type LaneMap = ReactInternalTypes.LaneMap -local invariant = require(Packages.Shared).invariant +local invariant = require("@pkg/@jsdotlua/shared").invariant local ImmediateSchedulerPriority = ReactFiberSchedulerPriorities.ImmediatePriority local UserBlockingSchedulerPriority = ReactFiberSchedulerPriorities.UserBlockingPriority diff --git a/modules/react-reconciler/src/ReactFiberNewContext.new.lua b/modules/react-reconciler/src/ReactFiberNewContext.new.lua index 7ba8829c..f53e36d2 100644 --- a/modules/react-reconciler/src/ReactFiberNewContext.new.lua +++ b/modules/react-reconciler/src/ReactFiberNewContext.new.lua @@ -9,34 +9,33 @@ * @flow ]] -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Number = LuauPolyfill.Number local Error = LuauPolyfill.Error -- ROBLOX: use patched console from shared -local console = require(Packages.Shared).console +local console = require("@pkg/@jsdotlua/shared").console -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") type ReactContext = ReactTypes.ReactContext -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") type Fiber = ReactInternalTypes.Fiber type ContextDependency = ReactInternalTypes.ContextDependency -local ReactFiberStack = require(script.Parent["ReactFiberStack.new"]) +local ReactFiberStack = require("./ReactFiberStack.new.lua") type StackCursor = ReactFiberStack.StackCursor -local ReactFiberLane = require(script.Parent.ReactFiberLane) +local ReactFiberLane = require("./ReactFiberLane") type Lanes = ReactFiberLane.Lanes -local ReactUpdateQueue = require(script.Parent["ReactUpdateQueue.new"]) +local ReactUpdateQueue = require("./ReactUpdateQueue.new.lua") type SharedQueue = ReactUpdateQueue.SharedQueue -local ReactFiberHostConfig = require(script.Parent.ReactFiberHostConfig) +local ReactFiberHostConfig = require("./ReactFiberHostConfig") local isPrimaryRenderer = ReactFiberHostConfig.isPrimaryRenderer local createCursor = ReactFiberStack.createCursor local push = ReactFiberStack.push local pop = ReactFiberStack.pop -local MAX_SIGNED_31_BIT_INT = require(script.Parent.MaxInts).MAX_SIGNED_31_BIT_INT -local ReactWorkTags = require(script.Parent.ReactWorkTags) +local MAX_SIGNED_31_BIT_INT = require("./MaxInts").MAX_SIGNED_31_BIT_INT +local ReactWorkTags = require("./ReactWorkTags") local ContextProvider = ReactWorkTags.ContextProvider local ClassComponent = ReactWorkTags.ClassComponent -- local DehydratedFragment = ReactWorkTags.DehydratedFragment @@ -47,12 +46,12 @@ local includesSomeLane = ReactFiberLane.includesSomeLane local mergeLanes = ReactFiberLane.mergeLanes local pickArbitraryLane = ReactFiberLane.pickArbitraryLane -local is = require(Packages.Shared).objectIs +local is = require("@pkg/@jsdotlua/shared").objectIs local createUpdate = ReactUpdateQueue.createUpdate local ForceUpdate = ReactUpdateQueue.ForceUpdate -- deviation: passed in as an arg to eliminate cycle --- local markWorkInProgressReceivedUpdate = require(script.Parent["ReactFiberBeginWork.new"]).markWorkInProgressReceivedUpdate --- local enableSuspenseServerRenderer = require(Packages.Shared).ReactFeatureFlags.enableSuspenseServerRenderer +-- local markWorkInProgressReceivedUpdate = require("./ReactFiberBeginWork.new.lua").markWorkInProgressReceivedUpdate +-- local enableSuspenseServerRenderer = require("@pkg/@jsdotlua/shared").ReactFeatureFlags.enableSuspenseServerRenderer local exports = {} diff --git a/modules/react-reconciler/src/ReactFiberOffscreenComponent.lua b/modules/react-reconciler/src/ReactFiberOffscreenComponent.lua index ce0fe1b5..68aef5c0 100644 --- a/modules/react-reconciler/src/ReactFiberOffscreenComponent.lua +++ b/modules/react-reconciler/src/ReactFiberOffscreenComponent.lua @@ -9,11 +9,10 @@ -- * @flow -- */ -local Packages = script.Parent.Parent -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") type ReactNodeList = ReactTypes.ReactNodeList -local ReactFiberLanes = require(script.Parent.ReactFiberLane) +local ReactFiberLanes = require("./ReactFiberLane") type Lanes = ReactFiberLanes.Lanes export type OffscreenProps = { diff --git a/modules/react-reconciler/src/ReactFiberReconciler.lua b/modules/react-reconciler/src/ReactFiberReconciler.lua index c3dd9ae7..e9619ded 100644 --- a/modules/react-reconciler/src/ReactFiberReconciler.lua +++ b/modules/react-reconciler/src/ReactFiberReconciler.lua @@ -10,4 +10,4 @@ ]] -- deviation: old version of reconciler not ported -return require(script.Parent["ReactFiberReconciler.new"]) +return require("./ReactFiberReconciler.new.lua") diff --git a/modules/react-reconciler/src/ReactFiberReconciler.new.lua b/modules/react-reconciler/src/ReactFiberReconciler.new.lua index 685a5718..785a51fb 100644 --- a/modules/react-reconciler/src/ReactFiberReconciler.new.lua +++ b/modules/react-reconciler/src/ReactFiberReconciler.new.lua @@ -9,76 +9,74 @@ ]] local __DEV__ = _G.__DEV__ :: boolean -local Packages = script.Parent.Parent -local flowtypes = require(Packages.Shared) +local flowtypes = require("@pkg/@jsdotlua/shared") type React_Component = flowtypes.React_Component -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array local Object = LuauPolyfill.Object type Function = (...any) -> ...any -- ROBLOX: use patched console from shared -local console = require(Packages.Shared).console +local console = require("@pkg/@jsdotlua/shared").console type Object = { [string]: any } type Array = { [number]: T } -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") type Fiber = ReactInternalTypes.Fiber type SuspenseHydrationCallbacks = ReactInternalTypes.SuspenseHydrationCallbacks type FiberRoot = ReactInternalTypes.FiberRoot -local ReactRootTags = require(script.Parent.ReactRootTags) +local ReactRootTags = require("./ReactRootTags") type RootTag = ReactRootTags.RootTag -local ReactFiberFlags = require(script.Parent.ReactFiberFlags) +local ReactFiberFlags = require("./ReactFiberFlags") -local ReactFiberHostConfig = require(script.Parent.ReactFiberHostConfig) +local ReactFiberHostConfig = require("./ReactFiberHostConfig") type Instance = ReactFiberHostConfig.Instance type TextInstance = ReactFiberHostConfig.TextInstance type Container = ReactFiberHostConfig.Container type PublicInstance = ReactFiberHostConfig.PublicInstance type RendererInspectionConfig = ReactFiberHostConfig.RendererInspectionConfig -local ReactWorkTags = require(script.Parent.ReactWorkTags) +local ReactWorkTags = require("./ReactWorkTags") local FundamentalComponent = ReactWorkTags.FundamentalComponent -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") type ReactNodeList = ReactTypes.ReactNodeList -local ReactFiberLane = require(script.Parent.ReactFiberLane) +local ReactFiberLane = require("./ReactFiberLane") type Lane = ReactFiberLane.Lane type LanePriority = ReactFiberLane.LanePriority -local ReactFiberSuspenseComponent = - require(script.Parent["ReactFiberSuspenseComponent.new"]) +local ReactFiberSuspenseComponent = require("./ReactFiberSuspenseComponent.new.lua") type SuspenseState = ReactFiberSuspenseComponent.SuspenseState -local ReactFiberTreeReflection = require(script.Parent.ReactFiberTreeReflection) +local ReactFiberTreeReflection = require("./ReactFiberTreeReflection") local findCurrentHostFiber = ReactFiberTreeReflection.findCurrentHostFiber local findCurrentHostFiberWithNoPortals = ReactFiberTreeReflection.findCurrentHostFiberWithNoPortals -local getInstance = require(Packages.Shared).ReactInstanceMap.get +local getInstance = require("@pkg/@jsdotlua/shared").ReactInstanceMap.get local HostComponent = ReactWorkTags.HostComponent local ClassComponent = ReactWorkTags.ClassComponent local HostRoot = ReactWorkTags.HostRoot local SuspenseComponent = ReactWorkTags.SuspenseComponent -local getComponentName = require(Packages.Shared).getComponentName -local invariant = require(Packages.Shared).invariant -local describeError = require(Packages.Shared).describeError +local getComponentName = require("@pkg/@jsdotlua/shared").getComponentName +local invariant = require("@pkg/@jsdotlua/shared").invariant +local describeError = require("@pkg/@jsdotlua/shared").describeError local enableSchedulingProfiler = - require(Packages.Shared).ReactFeatureFlags.enableSchedulingProfiler -local ReactSharedInternals = require(Packages.Shared).ReactSharedInternals -local getPublicInstance = require(script.Parent.ReactFiberHostConfig).getPublicInstance -local ReactFiberContext = require(script.Parent["ReactFiberContext.new"]) + require("@pkg/@jsdotlua/shared").ReactFeatureFlags.enableSchedulingProfiler +local ReactSharedInternals = require("@pkg/@jsdotlua/shared").ReactSharedInternals +local getPublicInstance = require("./ReactFiberHostConfig").getPublicInstance +local ReactFiberContext = require("./ReactFiberContext.new.lua") local findCurrentUnmaskedContext = ReactFiberContext.findCurrentUnmaskedContext local processChildContext = ReactFiberContext.processChildContext local emptyContextObject = ReactFiberContext.emptyContextObject local isLegacyContextProvider = ReactFiberContext.isContextProvider -local ReactFiberRoot = require(script.Parent["ReactFiberRoot.new"]) +local ReactFiberRoot = require("./ReactFiberRoot.new.lua") local createFiberRoot = ReactFiberRoot.createFiberRoot -local ReactFiberDevToolsHook = require(script.Parent["ReactFiberDevToolsHook.new"]) +local ReactFiberDevToolsHook = require("./ReactFiberDevToolsHook.new.lua") local injectInternals = ReactFiberDevToolsHook.injectInternals local onScheduleRoot = ReactFiberDevToolsHook.onScheduleRoot -local ReactFiberWorkLoop = require(script.Parent["ReactFiberWorkLoop.new"]) :: any +local ReactFiberWorkLoop = require("./ReactFiberWorkLoop.new.lua") :: any local requestEventTime = ReactFiberWorkLoop.requestEventTime local requestUpdateLane = ReactFiberWorkLoop.requestUpdateLane local scheduleUpdateOnFiber = ReactFiberWorkLoop.scheduleUpdateOnFiber @@ -96,16 +94,16 @@ local warnIfNotScopedWithMatchingAct = ReactFiberWorkLoop.warnIfNotScopedWithMat local warnIfUnmockedScheduler = ReactFiberWorkLoop.warnIfUnmockedScheduler local IsThisRendererActing = ReactFiberWorkLoop.IsThisRendererActing local act = ReactFiberWorkLoop.act :: (() -> ()) -> () -local ReactUpdateQueue = require(script.Parent["ReactUpdateQueue.new"]) +local ReactUpdateQueue = require("./ReactUpdateQueue.new.lua") local createUpdate = ReactUpdateQueue.createUpdate local enqueueUpdate = ReactUpdateQueue.enqueueUpdate -local ReactCurrentFiber = require(script.Parent.ReactCurrentFiber) +local ReactCurrentFiber = require("./ReactCurrentFiber") local ReactCurrentFiberIsRendering = ReactCurrentFiber.isRendering -- deviation: this property would be captured as values instead of bound -- local ReactCurrentFiber.current = ReactCurrentFiber.current local resetCurrentDebugFiberInDEV = ReactCurrentFiber.resetCurrentFiber local setCurrentDebugFiberInDEV = ReactCurrentFiber.setCurrentFiber -local ReactTypeOfMode = require(script.Parent.ReactTypeOfMode) +local ReactTypeOfMode = require("./ReactTypeOfMode") local StrictMode = ReactTypeOfMode.StrictMode local SyncLane = ReactFiberLane.SyncLane local InputDiscreteHydrationLane = ReactFiberLane.InputDiscreteHydrationLane @@ -115,12 +113,12 @@ local getHighestPriorityPendingLanes = ReactFiberLane.getHighestPriorityPendingL local higherPriorityLane = ReactFiberLane.higherPriorityLane local getCurrentUpdateLanePriority = ReactFiberLane.getCurrentUpdateLanePriority local setCurrentUpdateLanePriority = ReactFiberLane.setCurrentUpdateLanePriority --- local ReactFiberHotReloading = require(script.Parent["ReactFiberHotReloading.new"]) +-- local ReactFiberHotReloading = require("./ReactFiberHotReloading.new.lua") -- local scheduleRefresh = ReactFiberHotReloading.scheduleRefresh -- local scheduleRoot = ReactFiberHotReloading.scheduleRoot -- local setRefreshHandler = ReactFiberHotReloading.setRefreshHandler -- local findHostInstancesForRefresh = ReactFiberHotReloading.findHostInstancesForRefresh -local markRenderScheduled = require(script.Parent.SchedulingProfiler).markRenderScheduled +local markRenderScheduled = require("./SchedulingProfiler").markRenderScheduled local exports = {} @@ -136,9 +134,9 @@ exports.getNearestMountedFiber = ReactFiberTreeReflection.getNearestMountedFiber exports.findCurrentFiberUsingSlowPath = ReactFiberTreeReflection.findCurrentFiberUsingSlowPath --- exports.registerMutableSourceForHydration = require(script.Parent["ReactMutableSource.new"]).registerMutableSourceForHydration -exports.createPortal = require(script.Parent.ReactPortal).createPortal --- local ReactTestSelectors = require(script.Parent.ReactTestSelectors) +-- exports.registerMutableSourceForHydration = require("./ReactMutableSource.new.lua").registerMutableSourceForHydration +exports.createPortal = require("./ReactPortal").createPortal +-- local ReactTestSelectors = require("./ReactTestSelectors") -- exports.createComponentSelector = ReactTestSelectors.createComponentSelector -- ROBLOX FIXME: Should we deviate and fix this typo? -- exports.createHasPsuedoClassSelector = ReactTestSelectors.createHasPsuedoClassSelector diff --git a/modules/react-reconciler/src/ReactFiberRoot.new.lua b/modules/react-reconciler/src/ReactFiberRoot.new.lua index 8f1417b3..f5203310 100644 --- a/modules/react-reconciler/src/ReactFiberRoot.new.lua +++ b/modules/react-reconciler/src/ReactFiberRoot.new.lua @@ -9,35 +9,34 @@ * @flow ]] -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Set = LuauPolyfill.Set local Map = LuauPolyfill.Map -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") type Fiber = ReactInternalTypes.Fiber type FiberRoot = ReactInternalTypes.FiberRoot type SuspenseHydrationCallbacks = ReactInternalTypes.SuspenseHydrationCallbacks -local ReactRootTags = require(script.Parent.ReactRootTags) +local ReactRootTags = require("./ReactRootTags") type RootTag = ReactRootTags.RootTag -local ReactFiberHostConfig = require(script.Parent.ReactFiberHostConfig) +local ReactFiberHostConfig = require("./ReactFiberHostConfig") local noTimeout = ReactFiberHostConfig.noTimeout local supportsHydration = ReactFiberHostConfig.supportsHydration -local ReactFiber = require(script.Parent["ReactFiber.new"]) +local ReactFiber = require("./ReactFiber.new.lua") local createHostRootFiber = ReactFiber.createHostRootFiber -local ReactFiberLane = require(script.Parent.ReactFiberLane) +local ReactFiberLane = require("./ReactFiberLane") local NoLanes = ReactFiberLane.NoLanes local NoLanePriority = ReactFiberLane.NoLanePriority local NoTimestamp = ReactFiberLane.NoTimestamp local createLaneMap = ReactFiberLane.createLaneMap -local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags +local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags local enableSchedulerTracing = ReactFeatureFlags.enableSchedulerTracing local enableSuspenseCallback = ReactFeatureFlags.enableSuspenseCallback -- ROBLOX deviation: import from tracing from Scheduler export to avoid direct file access -local Scheduler = require(Packages.Scheduler).tracing +local Scheduler = require("@pkg/@jsdotlua/scheduler").tracing local unstable_getThreadID = Scheduler.unstable_getThreadID -local ReactUpdateQueue = require(script.Parent["ReactUpdateQueue.new"]) +local ReactUpdateQueue = require("./ReactUpdateQueue.new.lua") local initializeUpdateQueue = ReactUpdateQueue.initializeUpdateQueue local LegacyRoot = ReactRootTags.LegacyRoot local BlockingRoot = ReactRootTags.BlockingRoot diff --git a/modules/react-reconciler/src/ReactFiberStack.new.lua b/modules/react-reconciler/src/ReactFiberStack.new.lua index 7fdf50cf..c78bb027 100644 --- a/modules/react-reconciler/src/ReactFiberStack.new.lua +++ b/modules/react-reconciler/src/ReactFiberStack.new.lua @@ -8,11 +8,10 @@ * * @flow ]] -local Packages = script.Parent.Parent -- ROBLOX: use patched console from shared -local console = require(Packages.Shared).console +local console = require("@pkg/@jsdotlua/shared").console -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") type Fiber = ReactInternalTypes.Fiber type Array = { [number]: T } diff --git a/modules/react-reconciler/src/ReactFiberSuspenseComponent.new.lua b/modules/react-reconciler/src/ReactFiberSuspenseComponent.new.lua index 9fe1cba4..9ce03567 100644 --- a/modules/react-reconciler/src/ReactFiberSuspenseComponent.new.lua +++ b/modules/react-reconciler/src/ReactFiberSuspenseComponent.new.lua @@ -9,22 +9,20 @@ * @flow ]] -local Packages = script.Parent.Parent - -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") type ReactNodeList = ReactTypes.ReactNodeList type Wakeable = ReactTypes.Wakeable -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") type Fiber = ReactInternalTypes.Fiber -local ReactFiberHostConfig = require(script.Parent.ReactFiberHostConfig) +local ReactFiberHostConfig = require("./ReactFiberHostConfig") type SuspenseInstance = ReactFiberHostConfig.SuspenseInstance -local ReactFiberLane = require(script.Parent.ReactFiberLane) +local ReactFiberLane = require("./ReactFiberLane") type Lane = ReactFiberLane.Lane -local ReactWorkTags = require(script.Parent.ReactWorkTags) +local ReactWorkTags = require("./ReactWorkTags") local SuspenseComponent = ReactWorkTags.SuspenseComponent local SuspenseListComponent = ReactWorkTags.SuspenseListComponent -local ReactFiberFlags = require(script.Parent.ReactFiberFlags) +local ReactFiberFlags = require("./ReactFiberFlags") local NoFlags = ReactFiberFlags.NoFlags local DidCapture = ReactFiberFlags.DidCapture local isSuspenseInstancePending = ReactFiberHostConfig.isSuspenseInstancePending diff --git a/modules/react-reconciler/src/ReactFiberSuspenseContext.new.lua b/modules/react-reconciler/src/ReactFiberSuspenseContext.new.lua index c3f9376c..6e0d010c 100644 --- a/modules/react-reconciler/src/ReactFiberSuspenseContext.new.lua +++ b/modules/react-reconciler/src/ReactFiberSuspenseContext.new.lua @@ -10,10 +10,10 @@ * @flow ]] -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") type Fiber = ReactInternalTypes.Fiber -local ReactFiberStack = require(script.Parent["ReactFiberStack.new"]) +local ReactFiberStack = require("./ReactFiberStack.new.lua") type StackCursor = ReactFiberStack.StackCursor local createCursor = ReactFiberStack.createCursor diff --git a/modules/react-reconciler/src/ReactFiberThrow.new.lua b/modules/react-reconciler/src/ReactFiberThrow.new.lua index d6fec8fa..8cedc971 100644 --- a/modules/react-reconciler/src/ReactFiberThrow.new.lua +++ b/modules/react-reconciler/src/ReactFiberThrow.new.lua @@ -9,45 +9,44 @@ * @flow ]] -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Object = LuauPolyfill.Object -- ROBLOX: use patched console from shared -local console = require(Packages.Shared).console +local console = require("@pkg/@jsdotlua/shared").console type Error = LuauPolyfill.Error type Map = { [K]: V } type Object = { [string]: any } type Set = { [T]: boolean } -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") type Fiber = ReactInternalTypes.Fiber type FiberRoot = ReactInternalTypes.FiberRoot type ReactPriorityLevel = ReactInternalTypes.ReactPriorityLevel -local ReactFiberLane = require(script.Parent.ReactFiberLane) +local ReactFiberLane = require("./ReactFiberLane") type Lanes = ReactFiberLane.Lanes type Lane = ReactFiberLane.Lane -local ReactCapturedValue = require(script.Parent.ReactCapturedValue) +local ReactCapturedValue = require("./ReactCapturedValue") type CapturedValue = ReactCapturedValue.CapturedValue -local ReactUpdateQueue = require(script.Parent["ReactUpdateQueue.new"]) +local ReactUpdateQueue = require("./ReactUpdateQueue.new.lua") type Update = ReactInternalTypes.Update -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") type React_Component = ReactTypes.React_Component type Thenable = ReactTypes.Thenable type Wakeable = ReactTypes.Wakeable -local ReactFiberSuspenseContext = require(script.Parent["ReactFiberSuspenseContext.new"]) +local ReactFiberSuspenseContext = require("./ReactFiberSuspenseContext.new.lua") type SuspenseContext = ReactFiberSuspenseContext.SuspenseContext -local getComponentName = require(Packages.Shared).getComponentName +local getComponentName = require("@pkg/@jsdotlua/shared").getComponentName -local ReactWorkTags = require(script.Parent.ReactWorkTags) +local ReactWorkTags = require("./ReactWorkTags") local ClassComponent = ReactWorkTags.ClassComponent local HostRoot = ReactWorkTags.HostRoot local SuspenseComponent = ReactWorkTags.SuspenseComponent local IncompleteClassComponent = ReactWorkTags.IncompleteClassComponent -local ReactFiberFlags = require(script.Parent.ReactFiberFlags) +local ReactFiberFlags = require("./ReactFiberFlags") local DidCapture = ReactFiberFlags.DidCapture local Incomplete = ReactFiberFlags.Incomplete local NoFlags = ReactFiberFlags.NoFlags @@ -55,15 +54,15 @@ local ShouldCapture = ReactFiberFlags.ShouldCapture local LifecycleEffectMask = ReactFiberFlags.LifecycleEffectMask local ForceUpdateForLegacySuspense = ReactFiberFlags.ForceUpdateForLegacySuspense local shouldCaptureSuspense = - require(script.Parent["ReactFiberSuspenseComponent.new"]).shouldCaptureSuspense -local ReactTypeOfMode = require(script.Parent.ReactTypeOfMode) + require("./ReactFiberSuspenseComponent.new.lua").shouldCaptureSuspense +local ReactTypeOfMode = require("./ReactTypeOfMode") local NoMode = ReactTypeOfMode.NoMode local BlockingMode = ReactTypeOfMode.BlockingMode local DebugTracingMode = ReactTypeOfMode.DebugTracingMode -local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags +local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags local enableDebugTracing = ReactFeatureFlags.enableDebugTracing local enableSchedulingProfiler = ReactFeatureFlags.enableSchedulingProfiler -local createCapturedValue = require(script.Parent.ReactCapturedValue).createCapturedValue +local createCapturedValue = require("./ReactCapturedValue").createCapturedValue local enqueueCapturedUpdate = ReactUpdateQueue.enqueueCapturedUpdate local createUpdate = ReactUpdateQueue.createUpdate @@ -87,7 +86,7 @@ local markLegacyErrorBoundaryAsFailedRef, isAlreadyFailedLegacyErrorBoundaryRef, -- ROBLOX deviation: lazy initialize ReactFiberWorkLoop to prevent cyclic module dependency local markLegacyErrorBoundaryAsFailed = function(...) if not markLegacyErrorBoundaryAsFailedRef then - ReactFiberWorkLoop = require(script.Parent["ReactFiberWorkLoop.new"]) + ReactFiberWorkLoop = require("./ReactFiberWorkLoop.new.lua") markLegacyErrorBoundaryAsFailedRef = ReactFiberWorkLoop.markLegacyErrorBoundaryAsFailed end @@ -102,24 +101,23 @@ end -- } = require(Packages../ReactFiberWorkLoop.new' local pingSuspendedRoot = function(...) if ReactFiberWorkLoop == nil then - ReactFiberWorkLoop = require(script.Parent["ReactFiberWorkLoop.new"]) + ReactFiberWorkLoop = require("./ReactFiberWorkLoop.new.lua") end pingSuspendedRootRef = ReactFiberWorkLoop.pingSuspendedRoot return pingSuspendedRootRef(...) end local isAlreadyFailedLegacyErrorBoundary = function(...) if ReactFiberWorkLoop == nil then - ReactFiberWorkLoop = require(script.Parent["ReactFiberWorkLoop.new"]) + ReactFiberWorkLoop = require("./ReactFiberWorkLoop.new.lua") end isAlreadyFailedLegacyErrorBoundaryRef = ReactFiberWorkLoop.isAlreadyFailedLegacyErrorBoundary return isAlreadyFailedLegacyErrorBoundaryRef(...) end -local logCapturedError = require(script.Parent.ReactFiberErrorLogger).logCapturedError -local logComponentSuspended = require(script.Parent.DebugTracing).logComponentSuspended -local markComponentSuspended = - require(script.Parent.SchedulingProfiler).markComponentSuspended +local logCapturedError = require("./ReactFiberErrorLogger").logCapturedError +local logComponentSuspended = require("./DebugTracing").logComponentSuspended +local markComponentSuspended = require("./SchedulingProfiler").markComponentSuspended local SyncLane = ReactFiberLane.SyncLane local NoTimestamp = ReactFiberLane.NoTimestamp diff --git a/modules/react-reconciler/src/ReactFiberTransition.lua b/modules/react-reconciler/src/ReactFiberTransition.lua index 2c9c704b..612ece43 100644 --- a/modules/react-reconciler/src/ReactFiberTransition.lua +++ b/modules/react-reconciler/src/ReactFiberTransition.lua @@ -9,9 +9,7 @@ * @flow ]] -local Packages = script.Parent.Parent - -local ReactSharedInternals = require(Packages.Shared).ReactSharedInternals +local ReactSharedInternals = require("@pkg/@jsdotlua/shared").ReactSharedInternals local ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig diff --git a/modules/react-reconciler/src/ReactFiberTreeReflection.lua b/modules/react-reconciler/src/ReactFiberTreeReflection.lua index 52775e89..0d62b991 100644 --- a/modules/react-reconciler/src/ReactFiberTreeReflection.lua +++ b/modules/react-reconciler/src/ReactFiberTreeReflection.lua @@ -9,25 +9,23 @@ * @flow ]] -local Packages = script.Parent.Parent -- ROBLOX: use patched console from shared -local console = require(Packages.Shared).console +local console = require("@pkg/@jsdotlua/shared").console -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") type Fiber = ReactInternalTypes.Fiber -local ReactFiberHostConfig = require(script.Parent.ReactFiberHostConfig) +local ReactFiberHostConfig = require("./ReactFiberHostConfig") type Container = ReactFiberHostConfig.Container type SuspenseInstance = ReactFiberHostConfig.SuspenseInstance -local ReactFiberSuspenseComponent = - require(script.Parent["ReactFiberSuspenseComponent.new"]) +local ReactFiberSuspenseComponent = require("./ReactFiberSuspenseComponent.new.lua") type SuspenseState = ReactFiberSuspenseComponent.SuspenseState -local invariant = require(Packages.Shared).invariant +local invariant = require("@pkg/@jsdotlua/shared").invariant -local getInstance = require(Packages.Shared).ReactInstanceMap.get -local ReactSharedInternals = require(Packages.Shared).ReactSharedInternals -local getComponentName = require(Packages.Shared).getComponentName -local ReactWorkTags = require(script.Parent.ReactWorkTags) +local getInstance = require("@pkg/@jsdotlua/shared").ReactInstanceMap.get +local ReactSharedInternals = require("@pkg/@jsdotlua/shared").ReactSharedInternals +local getComponentName = require("@pkg/@jsdotlua/shared").getComponentName +local ReactWorkTags = require("./ReactWorkTags") local ClassComponent = ReactWorkTags.ClassComponent local HostComponent = ReactWorkTags.HostComponent local HostRoot = ReactWorkTags.HostRoot @@ -35,12 +33,12 @@ local HostPortal = ReactWorkTags.HostPortal local HostText = ReactWorkTags.HostText local FundamentalComponent = ReactWorkTags.FundamentalComponent local SuspenseComponent = ReactWorkTags.SuspenseComponent -local ReactFiberFlags = require(script.Parent.ReactFiberFlags) +local ReactFiberFlags = require("./ReactFiberFlags") local NoFlags = ReactFiberFlags.NoFlags local Placement = ReactFiberFlags.Placement local Hydrating = ReactFiberFlags.Hydrating local enableFundamentalAPI = - require(Packages.Shared).ReactFeatureFlags.enableFundamentalAPI + require("@pkg/@jsdotlua/shared").ReactFeatureFlags.enableFundamentalAPI local ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner diff --git a/modules/react-reconciler/src/ReactFiberUnwindWork.new.lua b/modules/react-reconciler/src/ReactFiberUnwindWork.new.lua index c09d4166..6edad46b 100644 --- a/modules/react-reconciler/src/ReactFiberUnwindWork.new.lua +++ b/modules/react-reconciler/src/ReactFiberUnwindWork.new.lua @@ -9,52 +9,48 @@ * @flow ]] -local Packages = script.Parent.Parent - -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") type Fiber = ReactInternalTypes.Fiber -local ReactFiberLane = require(script.Parent.ReactFiberLane) +local ReactFiberLane = require("./ReactFiberLane") type Lanes = ReactFiberLane.Lanes -local ReactFiberSuspenseComponent = - require(script.Parent["ReactFiberSuspenseComponent.new"]) +local ReactFiberSuspenseComponent = require("./ReactFiberSuspenseComponent.new.lua") type SuspenseState = ReactFiberSuspenseComponent.SuspenseState local resetMutableSourceWorkInProgressVersions = - require(script.Parent["ReactMutableSource.new"]).resetWorkInProgressVersions -local ReactWorkTags = require(script.Parent.ReactWorkTags) --- local {ReactFiberFlags.DidCapture, ReactFiberFlags.NoFlags, ReactFiberFlags.ShouldCapture} = require(script.Parent.ReactFiberFlags) -local ReactFiberFlags = require(script.Parent.ReactFiberFlags) -local ReactTypeOfMode = require(script.Parent.ReactTypeOfMode) + require("./ReactMutableSource.new.lua").resetWorkInProgressVersions +local ReactWorkTags = require("./ReactWorkTags") +-- local {ReactFiberFlags.DidCapture, ReactFiberFlags.NoFlags, ReactFiberFlags.ShouldCapture} = require("./ReactFiberFlags") +local ReactFiberFlags = require("./ReactFiberFlags") +local ReactTypeOfMode = require("./ReactTypeOfMode") -local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags +local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags local enableSuspenseServerRenderer = ReactFeatureFlags.enableSuspenseServerRenderer local enableProfilerTimer = ReactFeatureFlags.enableProfilerTimer -local ReactFiberHostContext = require(script.Parent["ReactFiberHostContext.new"]) +local ReactFiberHostContext = require("./ReactFiberHostContext.new.lua") local popHostContainer = ReactFiberHostContext.popHostContainer local popHostContext = ReactFiberHostContext.popHostContext local popSuspenseContext = - require(script.Parent["ReactFiberSuspenseContext.new"]).popSuspenseContext + require("./ReactFiberSuspenseContext.new.lua").popSuspenseContext local resetHydrationState = - require(script.Parent["ReactFiberHydrationContext.new"]).resetHydrationState -local ReactFiberContext = require(script.Parent["ReactFiberContext.new"]) + require("./ReactFiberHydrationContext.new.lua").resetHydrationState +local ReactFiberContext = require("./ReactFiberContext.new.lua") local isLegacyContextProvider = ReactFiberContext.isContextProvider local popLegacyContext = ReactFiberContext.popContext local popTopLevelLegacyContextObject = ReactFiberContext.popTopLevelContextObject -local popProvider = require(script.Parent["ReactFiberNewContext.new"]).popProvider +local popProvider = require("./ReactFiberNewContext.new.lua").popProvider -- ROBLOX FIXME: this causes a circular require local popRenderLanesRef local popRenderLanes = function(...) if not popRenderLanesRef then - popRenderLanesRef = - require(script.Parent["ReactFiberWorkLoop.new"]).popRenderLanes + popRenderLanesRef = require("./ReactFiberWorkLoop.new.lua").popRenderLanes end return popRenderLanesRef(...) end local transferActualDuration = - require(script.Parent["ReactProfilerTimer.new"]).transferActualDuration + require("./ReactProfilerTimer.new.lua").transferActualDuration -local invariant = require(Packages.Shared).invariant +local invariant = require("@pkg/@jsdotlua/shared").invariant local function unwindWork(workInProgress: Fiber, renderLanes: Lanes): Fiber? if workInProgress.tag == ReactWorkTags.ClassComponent then diff --git a/modules/react-reconciler/src/ReactFiberWorkInProgress.lua b/modules/react-reconciler/src/ReactFiberWorkInProgress.lua index b3d34700..a90cedc8 100644 --- a/modules/react-reconciler/src/ReactFiberWorkInProgress.lua +++ b/modules/react-reconciler/src/ReactFiberWorkInProgress.lua @@ -12,7 +12,7 @@ * @flow ]] -local ReactFiberLane = require(script.Parent.ReactFiberLane) +local ReactFiberLane = require("./ReactFiberLane") local _workInProgressRootSkippedLanes: Lanes = ReactFiberLane.NoLanes local mergeLanes = ReactFiberLane.mergeLanes type Lanes = ReactFiberLane.Lanes diff --git a/modules/react-reconciler/src/ReactFiberWorkLoop.new.lua b/modules/react-reconciler/src/ReactFiberWorkLoop.new.lua index a12cb2d4..c9aaed58 100644 --- a/modules/react-reconciler/src/ReactFiberWorkLoop.new.lua +++ b/modules/react-reconciler/src/ReactFiberWorkLoop.new.lua @@ -11,40 +11,38 @@ local __DEV__ = _G.__DEV__ local __YOLO__ = _G.__YOLO__ -local Packages = script.Parent.Parent -- ROBLOX: use patched console from shared -local console = require(Packages.Shared).console -local LuauPolyfill = require(Packages.LuauPolyfill) +local console = require("@pkg/@jsdotlua/shared").console +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Set = LuauPolyfill.Set type Set = LuauPolyfill.Set type Array = LuauPolyfill.Array local exports: any = {} -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") type Thenable = ReactTypes.Thenable type Wakeable = ReactTypes.Wakeable -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") type Fiber = ReactInternalTypes.Fiber type FiberRoot = ReactInternalTypes.FiberRoot type ReactPriorityLevel = ReactInternalTypes.ReactPriorityLevel -local ReactFiberLane = require(script.Parent.ReactFiberLane) +local ReactFiberLane = require("./ReactFiberLane") type Lanes = ReactFiberLane.Lanes type Lane = ReactFiberLane.Lane -- The scheduler is imported here *only* to detect whether it's been mocked -local Scheduler = require(Packages.Scheduler) +local Scheduler = require("@pkg/@jsdotlua/scheduler") -- ROBLOX deviation: we import from top-level Scheduler exports to avoid direct file access type Interaction = Scheduler.Interaction -local ReactFiberSuspenseComponent = - require(script.Parent["ReactFiberSuspenseComponent.new"]) +local ReactFiberSuspenseComponent = require("./ReactFiberSuspenseComponent.new.lua") type SuspenseState = ReactFiberSuspenseComponent.SuspenseState -local ReactFiberStack = require(script.Parent["ReactFiberStack.new"]) +local ReactFiberStack = require("./ReactFiberStack.new.lua") type StackCursor = ReactFiberStack.StackCursor -local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags +local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags -- deviation: Use some properties directly instead of localizing to avoid 200 limit -- local enableSuspenseServerRenderer = ReactFeatureFlags.enableSuspenseServerRenderer -- local replayFailedUnitOfWorkWithInvokeGuardedCallback = ReactFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback @@ -55,15 +53,14 @@ local enableDebugTracing = ReactFeatureFlags.enableDebugTracing local enableSchedulingProfiler = ReactFeatureFlags.enableSchedulingProfiler local skipUnmountedBoundaries = ReactFeatureFlags.skipUnmountedBoundaries local enableDoubleInvokingEffects = ReactFeatureFlags.enableDoubleInvokingEffects -local ReactShared = require(Packages.Shared) +local ReactShared = require("@pkg/@jsdotlua/shared") -- ROBLOX deviation: we pull in Dispatcher type because we need it for our lazy loading deviations to typecheck type Dispatcher = ReactShared.Dispatcher -local describeError = require(Packages.Shared).describeError +local describeError = require("@pkg/@jsdotlua/shared").describeError local ReactSharedInternals = ReactShared.ReactSharedInternals local invariant = ReactShared.invariant -local SchedulerWithReactIntegration = - require(script.Parent["SchedulerWithReactIntegration.new"]) +local SchedulerWithReactIntegration = require("./SchedulerWithReactIntegration.new.lua") local scheduleCallback = SchedulerWithReactIntegration.scheduleCallback local cancelCallback = SchedulerWithReactIntegration.cancelCallback local getCurrentPriorityLevel = SchedulerWithReactIntegration.getCurrentPriorityLevel @@ -87,7 +84,7 @@ local scheduleSyncCallback = SchedulerWithReactIntegration.scheduleSyncCallback -- DebugTracing.logPassiveEffectsStopped, -- DebugTracing.logRenderStarted, -- DebugTracing.logRenderStopped, -local DebugTracing = require(script.Parent.DebugTracing) +local DebugTracing = require("./DebugTracing") -- local { -- SchedulingProfiler.markCommitStarted, -- SchedulingProfiler.markCommitStopped, @@ -98,13 +95,13 @@ local DebugTracing = require(script.Parent.DebugTracing) -- SchedulingProfiler.markRenderStarted, -- SchedulingProfiler.markRenderYielded, -- SchedulingProfiler.markRenderStopped, -local SchedulingProfiler = require(script.Parent.SchedulingProfiler) +local SchedulingProfiler = require("./SchedulingProfiler") -local SchedulerTracing = require(Packages.Scheduler).tracing +local SchedulerTracing = require("@pkg/@jsdotlua/scheduler").tracing local __interactionsRef, __subscriberRef = SchedulerTracing.__interactionsRef, SchedulerTracing.__subscriberRef -local ReactFiberHostConfig = require(script.Parent.ReactFiberHostConfig) +local ReactFiberHostConfig = require("./ReactFiberHostConfig") -- deviation: Use properties directly instead of localizing to avoid 200 limit -- local prepareForCommit = ReactFiberHostConfig.prepareForCommit -- local resetAfterCommit = ReactFiberHostConfig.resetAfterCommit @@ -116,18 +113,18 @@ local ReactFiberHostConfig = require(script.Parent.ReactFiberHostConfig) -- local afterActiveInstanceBlur = ReactFiberHostConfig.afterActiveInstanceBlur -- local clearContainer = ReactFiberHostConfig.clearContainer -local ReactFiber = require(script.Parent["ReactFiber.new"]) +local ReactFiber = require("./ReactFiber.new.lua") -- deviation: Use properties directly instead of localizing to avoid 200 limit -- local createWorkInProgress = ReactFiber.createWorkInProgress -- local assignFiberPropertiesInDEV = ReactFiber.assignFiberPropertiesInDEV -local ReactTypeOfMode = require(script.Parent.ReactTypeOfMode) +local ReactTypeOfMode = require("./ReactTypeOfMode") -- deviation: Use properties directly instead of localizing to avoid 200 limit -- local NoMode = ReactTypeOfMode.NoMode -- local StrictMode = ReactTypeOfMode.StrictMode -- local ProfileMode = ReactTypeOfMode.ProfileMode -- local BlockingMode = ReactTypeOfMode.BlockingMode -- local ConcurrentMode = ReactTypeOfMode.ConcurrentMode -local ReactWorkTags = require(script.Parent.ReactWorkTags) +local ReactWorkTags = require("./ReactWorkTags") -- deviation: Use properties directly instead of localizing to avoid 200 limit -- local HostRoot = ReactWorkTags.HostRoot -- local IndeterminateComponent = ReactWorkTags.IndeterminateComponent @@ -138,8 +135,8 @@ local ReactWorkTags = require(script.Parent.ReactWorkTags) -- local ForwardRef = ReactWorkTags.ForwardRef -- local MemoComponent = ReactWorkTags.MemoComponent -- local SimpleMemoComponent = ReactWorkTags.SimpleMemoComponent -local LegacyRoot = require(script.Parent.ReactRootTags).LegacyRoot -local ReactFiberFlags = require(script.Parent.ReactFiberFlags) +local LegacyRoot = require("./ReactRootTags").LegacyRoot +local ReactFiberFlags = require("./ReactFiberFlags") type Flags = ReactFiberFlags.Flags -- ROBLOX deviation: Use properties directly instead of localizing to avoid 200 limit -- local NoFlags = ReactFiberFlags.NoFlags @@ -183,19 +180,19 @@ local markDiscreteUpdatesExpired = ReactFiberLane.markDiscreteUpdatesExpired local markRootFinished = ReactFiberLane.markRootFinished local schedulerPriorityToLanePriority = ReactFiberLane.schedulerPriorityToLanePriority local lanePriorityToSchedulerPriority = ReactFiberLane.lanePriorityToSchedulerPriority -local ReactFiberTransition = require(script.Parent.ReactFiberTransition) +local ReactFiberTransition = require("./ReactFiberTransition") -- deviation: Use properties directly instead of localizing to avoid 200 limit -- local requestCurrentTransition = ReactFiberTransition.requestCurrentTransition -- local NoTransition = ReactFiberTransition.NoTransition -local ReactFiberUnwindWork = require(script.Parent["ReactFiberUnwindWork.new"]) :: any +local ReactFiberUnwindWork = require("./ReactFiberUnwindWork.new.lua") :: any local unwindWork = ReactFiberUnwindWork.unwindWork local unwindInterruptedWork = ReactFiberUnwindWork.unwindInterruptedWork -local ReactFiberThrow = require(script.Parent["ReactFiberThrow.new"]) :: any +local ReactFiberThrow = require("./ReactFiberThrow.new.lua") :: any local throwException = ReactFiberThrow.throwException local createRootErrorUpdate = ReactFiberThrow.createRootErrorUpdate local createClassErrorUpdate = ReactFiberThrow.createClassErrorUpdate -local ReactFiberCommitWork = require(script.Parent["ReactFiberCommitWork.new"]) +local ReactFiberCommitWork = require("./ReactFiberCommitWork.new.lua") local commitBeforeMutationEffectOnFiber = ReactFiberCommitWork.commitBeforeMutationLifeCycles local commitPlacement = ReactFiberCommitWork.commitPlacement @@ -216,12 +213,12 @@ local invokePassiveEffectUnmountInDEV = ReactFiberCommitWork.invokePassiveEffectUnmountInDEV local recursivelyCommitLayoutEffects = ReactFiberCommitWork.recursivelyCommitLayoutEffects -local Promise = require(Packages.Promise) +local Promise = require("@pkg/@jsdotlua/promise") -local enqueueUpdate = require(script.Parent["ReactUpdateQueue.new"]).enqueueUpdate +local enqueueUpdate = require("./ReactUpdateQueue.new.lua").enqueueUpdate local resetContextDependencies = - require(script.Parent["ReactFiberNewContext.new"]).resetContextDependencies + require("./ReactFiberNewContext.new.lua").resetContextDependencies -- ROBLOX deviation: Pre-declare function local ensureRootIsScheduled @@ -240,7 +237,7 @@ local originalBeginWork = function(current: Fiber | nil, workInProgress: Fiber, renderLanes: Lanes): Fiber | nil if not lazyInitRefs.originalBeginWorkRef then lazyInitRefs.originalBeginWorkRef = - require(script.Parent["ReactFiberBeginWork.new"]).beginWork + require("./ReactFiberBeginWork.new.lua").beginWork end return lazyInitRefs.originalBeginWorkRef(current, workInProgress, renderLanes) end @@ -249,7 +246,7 @@ local completeWork = function(current: Fiber | nil, workInProgress: Fiber, renderLanes: Lanes): Fiber | nil if not lazyInitRefs.completeWorkRef then lazyInitRefs.completeWorkRef = - require(script.Parent["ReactFiberCompleteWork.new"]).completeWork + require("./ReactFiberCompleteWork.new.lua").completeWork end return (lazyInitRefs.completeWorkRef :: any)(current, workInProgress, renderLanes) end @@ -257,7 +254,7 @@ local completeWork = local ReactFiberHooks -- ROBLOX deviation: lazy init for functions from ReactFiberHooks local function initReactFiberHooks() - ReactFiberHooks = require(script.Parent["ReactFiberHooks.new"]) + ReactFiberHooks = require("./ReactFiberHooks.new.lua") lazyInitRefs.resetHooksAfterThrowRef = ReactFiberHooks.resetHooksAfterThrow lazyInitRefs.ContextOnlyDispatcherRef = ReactFiberHooks.ContextOnlyDispatcher lazyInitRefs.getIsUpdatingOpaqueValueInRenderPhaseInDEVRef = @@ -288,33 +285,32 @@ local getIsUpdatingOpaqueValueInRenderPhaseInDEV = function(): boolean? return lazyInitRefs.getIsUpdatingOpaqueValueInRenderPhaseInDEVRef() end -local createCapturedValue = require(script.Parent.ReactCapturedValue).createCapturedValue +local createCapturedValue = require("./ReactCapturedValue").createCapturedValue local pushToStack = ReactFiberStack.push local popFromStack = ReactFiberStack.pop local createCursor = ReactFiberStack.createCursor -local ReactProfilerTimer = require(script.Parent["ReactProfilerTimer.new"]) +local ReactProfilerTimer = require("./ReactProfilerTimer.new.lua") -- DEV stuff -local getComponentName = require(Packages.Shared).getComponentName -local ReactStrictModeWarnings = require(script.Parent["ReactStrictModeWarnings.new"]) -local ReactCurrentFiber = require(script.Parent.ReactCurrentFiber) +local getComponentName = require("@pkg/@jsdotlua/shared").getComponentName +local ReactStrictModeWarnings = require("./ReactStrictModeWarnings.new.lua") +local ReactCurrentFiber = require("./ReactCurrentFiber") -- deviation: these two properties would be captured as values instead of bound -- local ReactCurrentDebugFiberIsRenderingInDEV = ReactCurrentFiber.isRendering local ReactCurrentFiberCurrent = ReactCurrentFiber.current local resetCurrentDebugFiberInDEV = ReactCurrentFiber.resetCurrentFiber local setCurrentDebugFiberInDEV = ReactCurrentFiber.setCurrentFiber -local ReactErrorUtils = require(Packages.Shared).ReactErrorUtils +local ReactErrorUtils = require("@pkg/@jsdotlua/shared").ReactErrorUtils local invokeGuardedCallback = ReactErrorUtils.invokeGuardedCallback local hasCaughtError = ReactErrorUtils.hasCaughtError local clearCaughtError = ReactErrorUtils.clearCaughtError -local onCommitRootDevTools = - require(script.Parent["ReactFiberDevToolsHook.new"]).onCommitRoot -local onCommitRootTestSelector = require(script.Parent.ReactTestSelectors).onCommitRoot +local onCommitRootDevTools = require("./ReactFiberDevToolsHook.new.lua").onCommitRoot +local onCommitRootTestSelector = require("./ReactTestSelectors").onCommitRoot -- Used by `act` -local enqueueTask = require(Packages.Shared).enqueueTask -local doesFiberContain = require(script.Parent.ReactFiberTreeReflection).doesFiberContain +local enqueueTask = require("@pkg/@jsdotlua/shared").enqueueTask +local doesFiberContain = require("./ReactFiberTreeReflection").doesFiberContain local ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher local ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner @@ -392,7 +388,7 @@ local workInProgressRootFatalError: any = nil local workInProgressRootIncludedLanes: Lanes = ReactFiberLane.NoLanes -- The work left over by components that were visited during this render. Only -- includes unprocessed updates, not work in bailed out children. -local ReactFiberWorkInProgress = require(script.Parent.ReactFiberWorkInProgress) +local ReactFiberWorkInProgress = require("./ReactFiberWorkInProgress") local workInProgressRootSkippedLanes: (value: Lanes?) -> Lanes = ReactFiberWorkInProgress.workInProgressRootSkippedLanes --: Lanes = ReactFiberLane.NoLanes -- Lanes that were updated (in an interleaved event) during this render. @@ -3631,7 +3627,7 @@ exports.warnIfUnmockedScheduler = function(fiber: Fiber) .. "to guarantee consistent behaviour across tests and client application. " .. "For example, with Jest: \n" -- Break up requires to avoid accidentally parsing them as dependencies. - .. "jest.mock('scheduler', function() return require(Packages.Scheduler).unstable_mock end)\n\n" + .. "jest.mock('scheduler', function() return require(@pkg/scheduler).unstable_mock end)\n\n" .. "For more info, visit https://reactjs.org/link/mock-scheduler" ) elseif ReactFeatureFlags.warnAboutUnmockedScheduler == true then @@ -3646,7 +3642,7 @@ exports.warnIfUnmockedScheduler = function(fiber: Fiber) .. "to guarantee consistent behaviour across tests and client applications. " .. "For example, with Jest: \n" -- Break up requires to avoid accidentally parsing them as dependencies. - .. "jest.mock('scheduler', function() return require(Packages.Scheduler).unstable_mock end)\n\n" + .. "jest.mock('scheduler', function() return require(@pkg/scheduler).unstable_mock end)\n\n" .. "For more info, visit https://reactjs.org/link/mock-scheduler" ) end diff --git a/modules/react-reconciler/src/ReactInternalTypes.lua b/modules/react-reconciler/src/ReactInternalTypes.lua index b02132a9..336b55fb 100644 --- a/modules/react-reconciler/src/ReactInternalTypes.lua +++ b/modules/react-reconciler/src/ReactInternalTypes.lua @@ -9,8 +9,7 @@ * @flow ]] -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") type Array = LuauPolyfill.Array type Map = LuauPolyfill.Map type Object = { [string]: any } @@ -18,7 +17,7 @@ type SimpleSet = { [T]: boolean } type SimpleMap = { [K]: V } type Set = LuauPolyfill.Set -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") -- ROBLOX deviation: ReactElement is defined at the top level of Shared along -- with the rest of the ReactTypes type Source = ReactTypes.Source @@ -36,15 +35,15 @@ type MutableSourceGetSnapshotFn = ReactTypes.MutableSourceGetS > -- ROBLOX deviation START: These are 'mixed' by default, and specialized by the renderer, need complicated dynamic resolution to do this properly --- local ReactFiberHostConfig = require(script.Parent.ReactFiberHostConfig) +-- local ReactFiberHostConfig = require("./ReactFiberHostConfig") -- type SuspenseInstance = ReactFiberHostConfig.SuspenseInstance type SuspenseInstance = any -- ROBLOX deviation END -local ReactWorkTags = require(script.Parent.ReactWorkTags) +local ReactWorkTags = require("./ReactWorkTags") type WorkTag = ReactWorkTags.WorkTag -local ReactTypeOfMode = require(script.Parent.ReactTypeOfMode) +local ReactTypeOfMode = require("./ReactTypeOfMode") type TypeOfMode = ReactTypeOfMode.TypeOfMode -local ReactFiberFlags = require(script.Parent.ReactFiberFlags) +local ReactFiberFlags = require("./ReactFiberFlags") type Flags = ReactFiberFlags.Flags -- deviation: FiberLane types are defined and exported from here to avoid -- cyclical requires @@ -98,7 +97,7 @@ export type HookType = | "useTransition" | "useMutableSource" | "useOpaqueIdentifier" -local ReactRootTags = require(script.Parent.ReactRootTags) +local ReactRootTags = require("./ReactRootTags") type RootTag = ReactRootTags.RootTag -- ROBLOX deviation: we can't import types for dynamic imports like HostConfig files -- type TimeoutHandle = ReactFiberHostConfig.TimeoutHandle; @@ -106,10 +105,10 @@ type RootTag = ReactRootTags.RootTag type TimeoutHandle = any type NoTimeout = any -- ROBLOX deviation: type forwarded to top-level export -local Shared = require(Packages.Shared) +local Shared = require("@pkg/@jsdotlua/shared") type Wakeable = Shared.Wakeable -- ROBLOX deviation: Interaction type forwarded to top-level export -local Scheduler = require(Packages.Scheduler) +local Scheduler = require("@pkg/@jsdotlua/scheduler") type Interaction = Scheduler.Interaction -- ROBLOX deciation: Luau doesn't support type literals: 99 | 98 | 97 | 96 | 95 | 90 diff --git a/modules/react-reconciler/src/ReactMutableSource.new.lua b/modules/react-reconciler/src/ReactMutableSource.new.lua index 2e921721..15f7100f 100644 --- a/modules/react-reconciler/src/ReactMutableSource.new.lua +++ b/modules/react-reconciler/src/ReactMutableSource.new.lua @@ -8,21 +8,20 @@ * @flow ]] -local Packages = script.Parent.Parent -- ROBLOX: use patched console from shared -local console = require(Packages.Shared).console +local console = require("@pkg/@jsdotlua/shared").console type Array = { [number]: T } local exports = {} -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") type MutableSource = ReactTypes.MutableSource type MutableSourceVersion = ReactTypes.MutableSourceVersion -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") type FiberRoot = ReactInternalTypes.FiberRoot -local isPrimaryRenderer = require(script.Parent.ReactFiberHostConfig).isPrimaryRenderer +local isPrimaryRenderer = require("./ReactFiberHostConfig").isPrimaryRenderer -- Work in progress version_ numbers only apply to a single render, -- and should be reset before starting a new render. diff --git a/modules/react-reconciler/src/ReactPortal.lua b/modules/react-reconciler/src/ReactPortal.lua index 56075209..991696f6 100644 --- a/modules/react-reconciler/src/ReactPortal.lua +++ b/modules/react-reconciler/src/ReactPortal.lua @@ -8,11 +8,9 @@ * @flow ]] -local Packages = script.Parent.Parent +local REACT_PORTAL_TYPE = require("@pkg/@jsdotlua/shared").ReactSymbols.REACT_PORTAL_TYPE -local REACT_PORTAL_TYPE = require(Packages.Shared).ReactSymbols.REACT_PORTAL_TYPE - -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") type ReactNodeList = ReactTypes.ReactNodeList type ReactPortal = ReactTypes.ReactPortal diff --git a/modules/react-reconciler/src/ReactProfilerTimer.new.lua b/modules/react-reconciler/src/ReactProfilerTimer.new.lua index 950d37ae..64b30aac 100644 --- a/modules/react-reconciler/src/ReactProfilerTimer.new.lua +++ b/modules/react-reconciler/src/ReactProfilerTimer.new.lua @@ -8,21 +8,19 @@ -- * @flow -- */ -local Packages = script.Parent.Parent - -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") type Fiber = ReactInternalTypes.Fiber -local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags +local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags local enableProfilerTimer = ReactFeatureFlags.enableProfilerTimer local enableProfilerCommitHooks = ReactFeatureFlags.enableProfilerCommitHooks -local ReactWorkTags = require(script.Parent.ReactWorkTags) +local ReactWorkTags = require("./ReactWorkTags") local Profiler = ReactWorkTags.Profiler -- Intentionally not named imports because Rollup would use dynamic dispatch for -- CommonJS interop named imports. -local Scheduler = require(Packages.Scheduler) +local Scheduler = require("@pkg/@jsdotlua/scheduler") local now = Scheduler.unstable_now diff --git a/modules/react-reconciler/src/ReactStrictModeWarnings.new.lua b/modules/react-reconciler/src/ReactStrictModeWarnings.new.lua index e7d12065..7963521e 100644 --- a/modules/react-reconciler/src/ReactStrictModeWarnings.new.lua +++ b/modules/react-reconciler/src/ReactStrictModeWarnings.new.lua @@ -9,17 +9,16 @@ * @flow ]] -local Packages = script.Parent.Parent -- ROBLOX: use patched console from shared -local console = require(Packages.Shared).console +local console = require("@pkg/@jsdotlua/shared").console -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") type Fiber = ReactInternalTypes.Fiber -local ReactCurrentFiber = require(script.Parent.ReactCurrentFiber) +local ReactCurrentFiber = require("./ReactCurrentFiber") local resetCurrentDebugFiberInDEV = ReactCurrentFiber.resetCurrentFiber local setCurrentDebugFiberInDEV = ReactCurrentFiber.setCurrentFiber -local getComponentName = require(Packages.Shared).getComponentName -local StrictMode = require(script.Parent.ReactTypeOfMode).StrictMode +local getComponentName = require("@pkg/@jsdotlua/shared").getComponentName +local StrictMode = require("./ReactTypeOfMode").StrictMode type Set = { [T]: boolean } type Array = { [number]: T } diff --git a/modules/react-reconciler/src/ReactTestSelectors.lua b/modules/react-reconciler/src/ReactTestSelectors.lua index f99e202b..b07cb171 100644 --- a/modules/react-reconciler/src/ReactTestSelectors.lua +++ b/modules/react-reconciler/src/ReactTestSelectors.lua @@ -7,21 +7,20 @@ * * @flow ]] -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") type Set = { [T]: boolean } type Array = LuauPolyfill.Array type Function = (...any) -> ...any type Object = LuauPolyfill.Object --- local type {Fiber} = require(Packages.react-reconciler/src/ReactInternalTypes' --- local type {Instance} = require(Packages../ReactFiberHostConfig' +-- local type {Fiber} = require(Packages.react-reconciler/src/ReactInternalTypes') +-- local type {Instance} = require(Packages../ReactFiberHostConfig') --- local invariant = require(Packages.shared/invariant' --- local {HostComponent, HostText} = require(Packages.react-reconciler/src/ReactWorkTags' --- local getComponentName = require(Packages.shared/getComponentName' +-- local invariant = require(Packages.shared/invariant') +-- local {HostComponent, HostText} = require(Packages.react-reconciler/src/ReactWorkTags') +-- local getComponentName = require(Packages.shared/getComponentName') -local ReactFiberHostConfig = require(script.Parent.ReactFiberHostConfig) +local ReactFiberHostConfig = require("./ReactFiberHostConfig") local supportsTestSelectors = ReactFiberHostConfig.supportsTestSelectors -- local { -- findFiberRoot, @@ -33,7 +32,7 @@ local supportsTestSelectors = ReactFiberHostConfig.supportsTestSelectors -- setFocusIfFocusable, -- setupIntersectionObserver, -- , --- } = require(Packages../ReactFiberHostConfig' +-- } = require(Packages../ReactFiberHostConfig') -- local COMPONENT_TYPE = 0b000 -- local HAS_PSEUDO_CLASS_TYPE = 0b001 diff --git a/modules/react-reconciler/src/ReactUpdateQueue.new.lua b/modules/react-reconciler/src/ReactUpdateQueue.new.lua index b9f16c7e..918eaac2 100644 --- a/modules/react-reconciler/src/ReactUpdateQueue.new.lua +++ b/modules/react-reconciler/src/ReactUpdateQueue.new.lua @@ -89,61 +89,60 @@ local __DEV__ = _G.__DEV__ local __YOLO__ = _G.__YOLO__ -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Object = LuauPolyfill.Object -- ROBLOX: use patched console from shared -local console = require(Packages.Shared).console +local console = require("@pkg/@jsdotlua/shared").console -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") type Fiber = ReactInternalTypes.Fiber type Lane = ReactInternalTypes.Lane type Lanes = ReactInternalTypes.Lanes -local ReactFiberLane = require(script.Parent.ReactFiberLane) +local ReactFiberLane = require("./ReactFiberLane") local NoLane = ReactFiberLane.NoLane local NoLanes = ReactFiberLane.NoLanes local isSubsetOfLanes = ReactFiberLane.isSubsetOfLanes local mergeLanes = ReactFiberLane.mergeLanes -- ROBLOX deviation: lazy instantiate to avoid circular require -local ReactFiberNewContext --= require(script.Parent["ReactFiberNewContext.new"]) +local ReactFiberNewContext --= require("./ReactFiberNewContext.new.lua") -- local enterDisallowedContextReadInDEV = ReactFiberNewContext.enterDisallowedContextReadInDEV -- local exitDisallowedContextReadInDEV = ReactFiberNewContext.exitDisallowedContextReadInDEV local function enterDisallowedContextReadInDEV() if not ReactFiberNewContext then - ReactFiberNewContext = require(script.Parent["ReactFiberNewContext.new"]) :: any + ReactFiberNewContext = require("./ReactFiberNewContext.new.lua") :: any end ReactFiberNewContext.enterDisallowedContextReadInDEV() end local function exitDisallowedContextReadInDEV() if not ReactFiberNewContext then - ReactFiberNewContext = require(script.Parent["ReactFiberNewContext.new"]) :: any + ReactFiberNewContext = require("./ReactFiberNewContext.new.lua") :: any end ReactFiberNewContext.exitDisallowedContextReadInDEV() end -local ReactFiberFlags = require(script.Parent.ReactFiberFlags) +local ReactFiberFlags = require("./ReactFiberFlags") local Callback = ReactFiberFlags.Callback local ShouldCapture = ReactFiberFlags.ShouldCapture local DidCapture = ReactFiberFlags.DidCapture -local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags +local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags local debugRenderPhaseSideEffectsForStrictMode = ReactFeatureFlags.debugRenderPhaseSideEffectsForStrictMode -local ReactTypeOfMode = require(script.Parent.ReactTypeOfMode) +local ReactTypeOfMode = require("./ReactTypeOfMode") local StrictMode = ReactTypeOfMode.StrictMode --- local ReactFiberWorkLoop = require(script.Parent["ReactFiberWorkLoop.new"]) +-- local ReactFiberWorkLoop = require("./ReactFiberWorkLoop.new.lua") local markSkippedUpdateLanes = - require(script.Parent.ReactFiberWorkInProgress).markSkippedUpdateLanes + require("./ReactFiberWorkInProgress").markSkippedUpdateLanes -- ROBLOX deviation START: use if-then-error, which avoid string format and function call overhead, as in React 18 --- local invariant = require(Packages.Shared).invariant +-- local invariant = require("@pkg/@jsdotlua/shared").invariant -- ROBLOX deviation END -local describeError = require(Packages.Shared).describeError +local describeError = require("@pkg/@jsdotlua/shared").describeError -local ConsolePatchingDev = require(Packages.Shared).ConsolePatchingDev +local ConsolePatchingDev = require("@pkg/@jsdotlua/shared").ConsolePatchingDev local disableLogs = ConsolePatchingDev.disableLogs local reenableLogs = ConsolePatchingDev.reenableLogs diff --git a/modules/react-reconciler/src/SchedulerWithReactIntegration.new.lua b/modules/react-reconciler/src/SchedulerWithReactIntegration.new.lua index a476d4bc..46a101cf 100644 --- a/modules/react-reconciler/src/SchedulerWithReactIntegration.new.lua +++ b/modules/react-reconciler/src/SchedulerWithReactIntegration.new.lua @@ -9,24 +9,23 @@ * @flow ]] -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") export type ReactPriorityLevel = ReactInternalTypes.ReactPriorityLevel -- Intentionally not named imports because Rollup would use dynamic dispatch for -- CommonJS interop named imports. -local Scheduler = require(Packages.Scheduler) +local Scheduler = require("@pkg/@jsdotlua/scheduler") -- local __interactionsRef = require(Packages.Scheduler.tracing).__interactionsRef -local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags +local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags -- local enableSchedulerTracing = ReactFeatureFlags.enableSchedulerTracing local decoupleUpdatePriorityFromScheduler = ReactFeatureFlags.decoupleUpdatePriorityFromScheduler -local invariant = require(Packages.Shared).invariant -local describeError = require(Packages.Shared).describeError -local ReactFiberLane = require(script.Parent.ReactFiberLane) +local invariant = require("@pkg/@jsdotlua/shared").invariant +local describeError = require("@pkg/@jsdotlua/shared").describeError +local ReactFiberLane = require("./ReactFiberLane") local SyncLanePriority = ReactFiberLane.SyncLanePriority local getCurrentUpdateLanePriority = ReactFiberLane.getCurrentUpdateLanePriority local setCurrentUpdateLanePriority = ReactFiberLane.setCurrentUpdateLanePriority @@ -48,7 +47,7 @@ local Scheduler_IdlePriority = Scheduler.unstable_IdlePriority -- with _just_ these constant definitions; it helps us avoid a circular require -- issue with `ReactFiberLanes` local ReactFiberSchedulerPriorities = - require(script.Parent["ReactFiberSchedulerPriorities.roblox"]) + require("./ReactFiberSchedulerPriorities.roblox.lua") local ImmediatePriority = ReactFiberSchedulerPriorities.ImmediatePriority local UserBlockingPriority = ReactFiberSchedulerPriorities.UserBlockingPriority local NormalPriority = ReactFiberSchedulerPriorities.NormalPriority diff --git a/modules/react-reconciler/src/SchedulingProfiler.lua b/modules/react-reconciler/src/SchedulingProfiler.lua index 983ceb19..4e7d4cf7 100644 --- a/modules/react-reconciler/src/SchedulingProfiler.lua +++ b/modules/react-reconciler/src/SchedulingProfiler.lua @@ -10,25 +10,24 @@ -- */ local exports = {} -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local WeakMap = LuauPolyfill.WeakMap type WeakMap = LuauPolyfill.WeakMap -local ReactFiberLane = require(script.Parent.ReactFiberLane) +local ReactFiberLane = require("./ReactFiberLane") type Lane = ReactFiberLane.Lane type Lanes = ReactFiberLane.Lanes -local ReactInternalTypes = require(script.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") type Fiber = ReactInternalTypes.Fiber -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") type Wakeable = ReactTypes.Wakeable -local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags +local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags local enableSchedulingProfiler = ReactFeatureFlags.enableSchedulingProfiler -local ReactVersion = require(Packages.Shared).ReactVersion -local getComponentName = require(Packages.Shared).getComponentName +local ReactVersion = require("@pkg/@jsdotlua/shared").ReactVersion +local getComponentName = require("@pkg/@jsdotlua/shared").getComponentName -- /** -- * If performance exists and supports the subset of the User Timing API that we diff --git a/modules/react-reconciler/src/__tests__/DebugTracing-test.internal.spec.lua b/modules/react-reconciler/src/__tests__/DebugTracing-test.internal.spec.lua index 9d949942..e57285b1 100644 --- a/modules/react-reconciler/src/__tests__/DebugTracing-test.internal.spec.lua +++ b/modules/react-reconciler/src/__tests__/DebugTracing-test.internal.spec.lua @@ -30,15 +30,15 @@ -- end local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local describe = JestGlobals.describe local beforeEach = JestGlobals.beforeEach local jest = JestGlobals.jest local it = JestGlobals.it local xit = JestGlobals.xit local jestExpect = JestGlobals.expect -local console = require(Packages.Shared).console -local Promise = require(Packages.Promise) +local console = require("@pkg/@jsdotlua/shared").console +local Promise = require("@pkg/@jsdotlua/promise") -- ROBLOX Test Noise: jest capabilities needed to spy on console describe("DebugTracing", function() @@ -49,16 +49,16 @@ describe("DebugTracing", function() jest.resetModules() -- ROBLOX deviation: upstream uses special comments to know which flags to flip. we do it manually. - local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags + local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags ReactFeatureFlags.enableDebugTracing = true ReactFeatureFlags.enableSchedulingProfiler = true ReactFeatureFlags.enableProfilerTimer = true ReactFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback = true ReactFeatureFlags.enableSuspenseServerRenderer = true ReactFeatureFlags.decoupleUpdatePriorityFromScheduler = true - React = require(Packages.React) - ReactTestRenderer = require(Packages.Dev.ReactTestRenderer) - Scheduler = require(Packages.Scheduler) + React = require("@pkg/@jsdotlua/react") + ReactTestRenderer = require("@pkg/@jsdotlua/react-test-renderer") + Scheduler = require("@pkg/@jsdotlua/scheduler") -- local groups = {} diff --git a/modules/react-reconciler/src/__tests__/ReactClassSetStateCallback.spec.lua b/modules/react-reconciler/src/__tests__/ReactClassSetStateCallback.spec.lua index 15bcca19..358232b0 100644 --- a/modules/react-reconciler/src/__tests__/ReactClassSetStateCallback.spec.lua +++ b/modules/react-reconciler/src/__tests__/ReactClassSetStateCallback.spec.lua @@ -16,7 +16,7 @@ local React local ReactNoop local Scheduler -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local beforeEach = JestGlobals.beforeEach local it = JestGlobals.it @@ -26,9 +26,9 @@ beforeEach(function() jest.resetModules() jest.useFakeTimers() - React = require(Packages.React) - ReactNoop = require(Packages.Dev.ReactNoopRenderer) - Scheduler = require(Packages.Scheduler) + React = require("@pkg/@jsdotlua/react") + ReactNoop = require("@pkg/@jsdotlua/react-noop-renderer") + Scheduler = require("@pkg/@jsdotlua/scheduler") end) local function Text(props) diff --git a/modules/react-reconciler/src/__tests__/ReactComponentLifeCycle.roblox.spec.lua b/modules/react-reconciler/src/__tests__/ReactComponentLifeCycle.roblox.spec.lua index 5b082b69..d5368d73 100644 --- a/modules/react-reconciler/src/__tests__/ReactComponentLifeCycle.roblox.spec.lua +++ b/modules/react-reconciler/src/__tests__/ReactComponentLifeCycle.roblox.spec.lua @@ -18,7 +18,7 @@ local HttpService = game:GetService("HttpService") local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local describe = JestGlobals.describe local beforeEach = JestGlobals.beforeEach @@ -102,15 +102,15 @@ beforeEach(function() prevCompatWarnings = _G.__COMPAT_WARNINGS__ _G.__COMPAT_WARNINGS__ = false - React = require(Packages.React) - ReactNoop = require(Packages.Dev.ReactNoopRenderer) + React = require("@pkg/@jsdotlua/react") + ReactNoop = require("@pkg/@jsdotlua/react-noop-renderer") -- ReactDOM = require('react-dom') -- ReactTestUtils = require('react-dom/test-utils') -- PropTypes = require('prop-types') -- ROBLOX deviation: these tests are failing with debugRenderPhaseSideEffectsForStrictMode on. -- https://github.com/Roblox/roact-alignment/issues/105 - local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags + local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags ReactFeatureFlags.debugRenderPhaseSideEffectsForStrictMode = false end) @@ -716,9 +716,9 @@ describe("Naming conventions", function() _G.__COMPAT_WARNINGS__ = true jest.resetModules() jest.useFakeTimers() - React = require(Packages.React) - ReactNoop = require(Packages.Dev.ReactNoopRenderer) - local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags + React = require("@pkg/@jsdotlua/react") + ReactNoop = require("@pkg/@jsdotlua/react-noop-renderer") + local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags ReactFeatureFlags.debugRenderPhaseSideEffectsForStrictMode = false end) diff --git a/modules/react-reconciler/src/__tests__/ReactComponentLifeCycle.spec.lua b/modules/react-reconciler/src/__tests__/ReactComponentLifeCycle.spec.lua index ebe4c8e6..717213e0 100644 --- a/modules/react-reconciler/src/__tests__/ReactComponentLifeCycle.spec.lua +++ b/modules/react-reconciler/src/__tests__/ReactComponentLifeCycle.spec.lua @@ -16,14 +16,14 @@ ]] local HttpService = game:GetService("HttpService") local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jest = JestGlobals.jest local jestExpect = JestGlobals.expect local it = JestGlobals.it local xit = JestGlobals.xit local beforeEach = JestGlobals.beforeEach -local Error = require(Packages.LuauPolyfill).Error +local Error = require("@pkg/@jsdotlua/luau-polyfill").Error -- deviation: Move all of the following into the test function body to match -- convention @@ -97,15 +97,15 @@ beforeEach(function() jest.resetModules() jest.useFakeTimers() - React = require(Packages.React) - ReactNoop = require(Packages.Dev.ReactNoopRenderer) + React = require("@pkg/@jsdotlua/react") + ReactNoop = require("@pkg/@jsdotlua/react-noop-renderer") -- ReactDOM = require('react-dom') -- ReactTestUtils = require('react-dom/test-utils') -- PropTypes = require('prop-types') -- ROBLOX deviation: these tests are failing with debugRenderPhaseSideEffectsForStrictMode on. -- https://github.com/Roblox/roact-alignment/issues/105 - local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags + local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags ReactFeatureFlags.debugRenderPhaseSideEffectsForStrictMode = false end) diff --git a/modules/react-reconciler/src/__tests__/ReactErrorBoundaries-internal.spec.lua b/modules/react-reconciler/src/__tests__/ReactErrorBoundaries-internal.spec.lua index f456c6e6..87d2dfaf 100644 --- a/modules/react-reconciler/src/__tests__/ReactErrorBoundaries-internal.spec.lua +++ b/modules/react-reconciler/src/__tests__/ReactErrorBoundaries-internal.spec.lua @@ -15,10 +15,10 @@ local React local ReactNoop -- local act local Scheduler -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array -local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags -local JestGlobals = require(Packages.Dev.JestGlobals) +local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local beforeEach = JestGlobals.beforeEach local describe = JestGlobals.describe @@ -71,12 +71,12 @@ describe("ReactErrorBoundaries", function() jest.useFakeTimers() -- PropTypes = require('prop-types') - ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags + ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags ReactFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback = false -- ReactDOM = require('react-dom') - React = require(Packages.React) - ReactNoop = require(Packages.Dev.ReactNoopRenderer) - Scheduler = require(Packages.Scheduler) + React = require("@pkg/@jsdotlua/react") + ReactNoop = require("@pkg/@jsdotlua/react-noop-renderer") + Scheduler = require("@pkg/@jsdotlua/scheduler") -- act = require('react-dom/test-utils').unstable_concurrentAct BrokenConstructor = React.Component:extend("BrokenConstructor") diff --git a/modules/react-reconciler/src/__tests__/ReactFiberComponentStack.roblox.spec.lua b/modules/react-reconciler/src/__tests__/ReactFiberComponentStack.roblox.spec.lua index c2b82f77..506bb13d 100644 --- a/modules/react-reconciler/src/__tests__/ReactFiberComponentStack.roblox.spec.lua +++ b/modules/react-reconciler/src/__tests__/ReactFiberComponentStack.roblox.spec.lua @@ -1,13 +1,13 @@ local Packages = script.Parent.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Error = LuauPolyfill.Error -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local describe = JestGlobals.describe local beforeEach = JestGlobals.beforeEach local it = JestGlobals.it local jest = JestGlobals.jest -local ReactInternalTypes = require(script.Parent.Parent.ReactInternalTypes) +local ReactInternalTypes = require("./ReactInternalTypes") type Fiber = ReactInternalTypes.Fiber local ReactFiberComponentStack @@ -15,7 +15,7 @@ local ReactFiberComponentStack describe("ReactFiberComponentStack", function() beforeEach(function() jest.resetModules() - ReactFiberComponentStack = require(script.Parent.Parent.ReactFiberComponentStack) + ReactFiberComponentStack = require("./ReactFiberComponentStack") end) it("given a nil fiber then it gives correct error message", function() diff --git a/modules/react-reconciler/src/__tests__/ReactFiberContext-internal.spec.lua b/modules/react-reconciler/src/__tests__/ReactFiberContext-internal.spec.lua index cc8c8d51..5df607b4 100644 --- a/modules/react-reconciler/src/__tests__/ReactFiberContext-internal.spec.lua +++ b/modules/react-reconciler/src/__tests__/ReactFiberContext-internal.spec.lua @@ -10,7 +10,7 @@ ]] local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local jest = JestGlobals.jest local beforeEach = JestGlobals.beforeEach @@ -25,10 +25,10 @@ local ReactFeatureFlags beforeEach(function() jest.resetModules() - ReactFiberContext = require(script.Parent.Parent["ReactFiberContext.new"]) - ReactFiber = require(script.Parent.Parent["ReactFiber.new"]) - ReactRootTags = require(script.Parent.Parent.ReactRootTags) - ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags + ReactFiberContext = require("./ReactFiberContext.new.lua") + ReactFiber = require("./ReactFiber.new.lua") + ReactRootTags = require("./ReactRootTags") + ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags ReactFeatureFlags.disableLegacyContext = false end) diff --git a/modules/react-reconciler/src/__tests__/ReactFiberDevToolsHook-internal.spec.lua b/modules/react-reconciler/src/__tests__/ReactFiberDevToolsHook-internal.spec.lua index e296f5bf..99348ff3 100644 --- a/modules/react-reconciler/src/__tests__/ReactFiberDevToolsHook-internal.spec.lua +++ b/modules/react-reconciler/src/__tests__/ReactFiberDevToolsHook-internal.spec.lua @@ -10,7 +10,7 @@ ]] local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local beforeEach = JestGlobals.beforeEach local jest = JestGlobals.jest @@ -19,15 +19,15 @@ local beforeAll = JestGlobals.beforeAll local afterAll = JestGlobals.afterAll local it = JestGlobals.it -local Map = require(Packages.LuauPolyfill).Map +local Map = require("@pkg/@jsdotlua/luau-polyfill").Map local ReactFiberDevToolsHook, ReactDevtoolsShared beforeEach(function() jest.resetModules() - ReactFiberDevToolsHook = require(script.Parent.Parent["ReactFiberDevToolsHook.new"]) - ReactDevtoolsShared = require(Packages.Dev.ReactDevtoolsShared) + ReactFiberDevToolsHook = require("./ReactFiberDevToolsHook.new.lua") + ReactDevtoolsShared = require("@dev-packages/ReactDevtoolsShared") end) describe("DevTools hook detection", function() diff --git a/modules/react-reconciler/src/__tests__/ReactFiberHostContext-internal.spec.lua b/modules/react-reconciler/src/__tests__/ReactFiberHostContext-internal.spec.lua index 371e27bf..8f165cb3 100644 --- a/modules/react-reconciler/src/__tests__/ReactFiberHostContext-internal.spec.lua +++ b/modules/react-reconciler/src/__tests__/ReactFiberHostContext-internal.spec.lua @@ -10,7 +10,7 @@ ]] local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local jest = JestGlobals.jest local describe = JestGlobals.describe @@ -24,9 +24,9 @@ describe("ReactFiberHostContext", function() beforeEach(function() jest.resetModules() - React = require(Packages.React) - ReactFiberReconciler = require(script.Parent.Parent) - ConcurrentRoot = require(script.Parent.Parent.ReactRootTags) + React = require("@pkg/@jsdotlua/react") + ReactFiberReconciler = require(".") + ConcurrentRoot = require("./ReactRootTags") end) it("works with nil host context", function() diff --git a/modules/react-reconciler/src/__tests__/ReactFiberLane.roblox.spec.lua b/modules/react-reconciler/src/__tests__/ReactFiberLane.roblox.spec.lua index 218cc00b..196470a8 100644 --- a/modules/react-reconciler/src/__tests__/ReactFiberLane.roblox.spec.lua +++ b/modules/react-reconciler/src/__tests__/ReactFiberLane.roblox.spec.lua @@ -9,18 +9,17 @@ * @jest-environment node ]] -local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local jest = JestGlobals.jest local beforeEach = JestGlobals.beforeEach local describe = JestGlobals.describe local it = JestGlobals.it -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Object = LuauPolyfill.Object local ReactFiberSchedulerPriorities = - require(script.Parent.Parent["ReactFiberSchedulerPriorities.roblox"]) + require("../ReactFiberSchedulerPriorities.roblox.lua") local ImmediatePriority = ReactFiberSchedulerPriorities.ImmediatePriority local NormalPriority = ReactFiberSchedulerPriorities.NormalPriority local NoPriority = ReactFiberSchedulerPriorities.NoPriority @@ -30,7 +29,7 @@ local ReactFiberLane beforeEach(function() jest.resetModules() - ReactFiberLane = require(script.Parent.Parent.ReactFiberLane) + ReactFiberLane = require("../ReactFiberLane") end) describe("lanePriorityToSchedulerPriority", function() diff --git a/modules/react-reconciler/src/__tests__/ReactFiberRoot.roblox.spec.lua b/modules/react-reconciler/src/__tests__/ReactFiberRoot.roblox.spec.lua index 5e49a202..c1b902ce 100644 --- a/modules/react-reconciler/src/__tests__/ReactFiberRoot.roblox.spec.lua +++ b/modules/react-reconciler/src/__tests__/ReactFiberRoot.roblox.spec.lua @@ -10,7 +10,7 @@ ]] local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local jest = JestGlobals.jest local beforeEach = JestGlobals.beforeEach @@ -22,8 +22,8 @@ local ReactRootTags beforeEach(function() jest.resetModules() - ReactFiberRoot = require(script.Parent.Parent["ReactFiberRoot.new"]) - ReactRootTags = require(script.Parent.Parent.ReactRootTags) + ReactFiberRoot = require("./ReactFiberRoot.new.lua") + ReactRootTags = require("./ReactRootTags") end) it("should properly initialize a fiber created with createFiberRoot", function() diff --git a/modules/react-reconciler/src/__tests__/ReactFiberStack-test.roblox.spec.lua b/modules/react-reconciler/src/__tests__/ReactFiberStack-test.roblox.spec.lua index 5379e563..d9d566bb 100644 --- a/modules/react-reconciler/src/__tests__/ReactFiberStack-test.roblox.spec.lua +++ b/modules/react-reconciler/src/__tests__/ReactFiberStack-test.roblox.spec.lua @@ -1,5 +1,5 @@ local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local describe = JestGlobals.describe local beforeEach = JestGlobals.beforeEach @@ -11,7 +11,7 @@ local ReactFiberStack describe("ReactFiberStack", function() beforeEach(function() jest.resetModules() - ReactFiberStack = require(script.Parent.Parent["ReactFiberStack.new"]) + ReactFiberStack = require("./ReactFiberStack.new.lua") end) it("creates a cursor with the given default value", function() diff --git a/modules/react-reconciler/src/__tests__/ReactFiberSuspenseComponent.roblox.spec.lua b/modules/react-reconciler/src/__tests__/ReactFiberSuspenseComponent.roblox.spec.lua index 5afe8c69..45bfb02d 100644 --- a/modules/react-reconciler/src/__tests__/ReactFiberSuspenseComponent.roblox.spec.lua +++ b/modules/react-reconciler/src/__tests__/ReactFiberSuspenseComponent.roblox.spec.lua @@ -1,6 +1,4 @@ -local Reconciler = script.Parent.Parent -local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local jest = JestGlobals.jest local beforeEach = JestGlobals.beforeEach @@ -13,8 +11,7 @@ describe("ReactFiberSuspenseComponent", function() beforeEach(function() jest.resetModules() - ReactFiberSuspenseComponent = - require(Reconciler["ReactFiberSuspenseComponent.new"]) + ReactFiberSuspenseComponent = require("../ReactFiberSuspenseComponent.new.lua") end) describe("shouldCaptureSuspense", function() diff --git a/modules/react-reconciler/src/__tests__/ReactFiberSuspenseContext.roblox.spec.lua b/modules/react-reconciler/src/__tests__/ReactFiberSuspenseContext.roblox.spec.lua index 710eea24..a92cea07 100644 --- a/modules/react-reconciler/src/__tests__/ReactFiberSuspenseContext.roblox.spec.lua +++ b/modules/react-reconciler/src/__tests__/ReactFiberSuspenseContext.roblox.spec.lua @@ -1,19 +1,18 @@ local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local jest = JestGlobals.jest local beforeEach = JestGlobals.beforeEach local describe = JestGlobals.describe local it = JestGlobals.it -local ReactFiber = require(script.Parent.Parent["ReactFiber.new"]) +local ReactFiber = require("./ReactFiber.new.lua") local ReactFiberSuspenseContext describe("ReactFiberSuspenseContext", function() beforeEach(function() jest.resetModules() - ReactFiberSuspenseContext = - require(script.Parent.Parent["ReactFiberSuspenseContext.new"]) + ReactFiberSuspenseContext = require("./ReactFiberSuspenseContext.new.lua") end) describe("suspense context stack", function() diff --git a/modules/react-reconciler/src/__tests__/ReactFiberTreeReflection.roblox.spec.lua b/modules/react-reconciler/src/__tests__/ReactFiberTreeReflection.roblox.spec.lua index 1013e6a0..ab76d295 100644 --- a/modules/react-reconciler/src/__tests__/ReactFiberTreeReflection.roblox.spec.lua +++ b/modules/react-reconciler/src/__tests__/ReactFiberTreeReflection.roblox.spec.lua @@ -1,26 +1,24 @@ -local Reconciler = script.Parent.Parent -local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local jest = JestGlobals.jest local beforeEach = JestGlobals.beforeEach local describe = JestGlobals.describe local it = JestGlobals.it -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Object = LuauPolyfill.Object -local setInstance = require(Packages.Shared).ReactInstanceMap.set -local ReactWorkTags = require(Reconciler.ReactWorkTags) +local setInstance = require("@pkg/@jsdotlua/shared").ReactInstanceMap.set +local ReactWorkTags = require("../ReactWorkTags") local ClassComponent = ReactWorkTags.ClassComponent local HostRoot = ReactWorkTags.HostRoot local FunctionComponent = ReactWorkTags.FunctionComponent local SuspenseComponent = ReactWorkTags.SuspenseComponent -local ReactFiberFlags = require(Reconciler.ReactFiberFlags) +local ReactFiberFlags = require("../ReactFiberFlags") local NoFlags = ReactFiberFlags.NoFlags local Placement = ReactFiberFlags.Placement local Hydrating = ReactFiberFlags.Hydrating -local ReactFiberLane = require(Reconciler.ReactFiberLane) +local ReactFiberLane = require("../ReactFiberLane") local ReactFiberTreeReflection @@ -28,7 +26,7 @@ describe("ReactFiberTreeReflection", function() beforeEach(function() jest.resetModules() - ReactFiberTreeReflection = require(Reconciler.ReactFiberTreeReflection) + ReactFiberTreeReflection = require("../ReactFiberTreeReflection") end) describe("getSuspenseInstanceFromFiber", function() diff --git a/modules/react-reconciler/src/__tests__/ReactHooks-internal.spec.lua b/modules/react-reconciler/src/__tests__/ReactHooks-internal.spec.lua index 02bbf2b8..ed0ddb6f 100644 --- a/modules/react-reconciler/src/__tests__/ReactHooks-internal.spec.lua +++ b/modules/react-reconciler/src/__tests__/ReactHooks-internal.spec.lua @@ -16,7 +16,7 @@ local Scheduler -- local ReactDOMServer local act local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local beforeEach = JestGlobals.beforeEach local jest = JestGlobals.jest @@ -24,8 +24,8 @@ local it = JestGlobals.it local xit = JestGlobals.xit local describe = JestGlobals.describe describe("ReactHooks", function() - local Promise = require(Packages.Promise) - local LuauPolyfill = require(Packages.LuauPolyfill) + local Promise = require("@pkg/@jsdotlua/promise") + local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array type Array = LuauPolyfill.Array type Function = (...any) -> ...any @@ -33,10 +33,10 @@ describe("ReactHooks", function() beforeEach(function() jest.resetModules() - ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags - React = require(Packages.React) - ReactTestRenderer = require(Packages.Dev.ReactTestRenderer) - Scheduler = require(Packages.Scheduler) + ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags + React = require("@pkg/@jsdotlua/react") + ReactTestRenderer = require("@pkg/@jsdotlua/react-test-renderer") + Scheduler = require("@pkg/@jsdotlua/scheduler") -- ReactDOMServer = require("react-dom/server") act = ReactTestRenderer.unstable_concurrentAct end) diff --git a/modules/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer.spec.lua b/modules/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer.spec.lua index d4478cd8..c38481c8 100644 --- a/modules/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer.spec.lua +++ b/modules/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer.spec.lua @@ -15,7 +15,7 @@ local Packages = script.Parent.Parent.Parent local React local Promise -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local clearTimeout = LuauPolyfill.clearTimeout local setTimeout = LuauPolyfill.setTimeout local Array = LuauPolyfill.Array @@ -44,7 +44,7 @@ local forwardRef local memo local act -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local jest = JestGlobals.jest local beforeEach = JestGlobals.beforeEach @@ -55,15 +55,15 @@ local xit = JestGlobals.xit beforeEach(function() jest.resetModules() jest.useFakeTimers() - Promise = require(Packages.Promise) + Promise = require("@pkg/@jsdotlua/promise") - LuauPolyfill = require(Packages.LuauPolyfill) + LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") clearTimeout = LuauPolyfill.clearTimeout setTimeout = LuauPolyfill.setTimeout - React = require(Packages.React) - ReactNoop = require(Packages.Dev.ReactNoopRenderer) - Scheduler = require(Packages.Scheduler) + React = require("@pkg/@jsdotlua/react") + ReactNoop = require("@pkg/@jsdotlua/react-noop-renderer") + Scheduler = require("@pkg/@jsdotlua/scheduler") -- SchedulerTracing = require(Scheduler.tracing) useState = React.useState useReducer = React.useReducer diff --git a/modules/react-reconciler/src/__tests__/ReactIdentity.spec.lua b/modules/react-reconciler/src/__tests__/ReactIdentity.spec.lua index 2ca2584a..fff93abf 100644 --- a/modules/react-reconciler/src/__tests__/ReactIdentity.spec.lua +++ b/modules/react-reconciler/src/__tests__/ReactIdentity.spec.lua @@ -13,7 +13,7 @@ local React, Scheduler local ReactRoblox, reactRobloxRoot local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local beforeEach = JestGlobals.beforeEach local it = JestGlobals.it @@ -23,9 +23,9 @@ local jest = JestGlobals.jest beforeEach(function() jest.resetModules() jest.useFakeTimers() - React = require(Packages.React) - ReactRoblox = require(Packages.Dev.ReactRoblox) - Scheduler = require(Packages.Scheduler) + React = require("@pkg/@jsdotlua/react") + ReactRoblox = require("@pkg/@jsdotlua/react-roblox") + Scheduler = require("@pkg/@jsdotlua/scheduler") local parent = Instance.new("Folder") reactRobloxRoot = ReactRoblox.createRoot(parent) end) diff --git a/modules/react-reconciler/src/__tests__/ReactIncremental.spec.lua b/modules/react-reconciler/src/__tests__/ReactIncremental.spec.lua index c1d1b8b3..e8493abc 100644 --- a/modules/react-reconciler/src/__tests__/ReactIncremental.spec.lua +++ b/modules/react-reconciler/src/__tests__/ReactIncremental.spec.lua @@ -10,17 +10,17 @@ -- */ local Packages = script.Parent.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Error = LuauPolyfill.Error -local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags +local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags local React local ReactNoop local Scheduler local PropTypes local HttpService = game:GetService("HttpService") -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local describe = JestGlobals.describe local beforeEach = JestGlobals.beforeEach @@ -53,9 +53,9 @@ describe("ReactIncremental", function() beforeEach(function() jest.resetModules() - React = require(Packages.React) - ReactNoop = require(Packages.Dev.ReactNoopRenderer) - Scheduler = require(Packages.Scheduler) + React = require("@pkg/@jsdotlua/react") + ReactNoop = require("@pkg/@jsdotlua/react-noop-renderer") + Scheduler = require("@pkg/@jsdotlua/scheduler") end) -- Note: This is based on a similar component we use in www. We can delete diff --git a/modules/react-reconciler/src/__tests__/ReactIncrementalErrorReplay.spec.lua b/modules/react-reconciler/src/__tests__/ReactIncrementalErrorReplay.spec.lua index 16e9d803..af675e2c 100644 --- a/modules/react-reconciler/src/__tests__/ReactIncrementalErrorReplay.spec.lua +++ b/modules/react-reconciler/src/__tests__/ReactIncrementalErrorReplay.spec.lua @@ -15,7 +15,7 @@ local React local ReactNoop local Scheduler -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local beforeEach = JestGlobals.beforeEach local jest = JestGlobals.jest @@ -24,9 +24,9 @@ local it = JestGlobals.it beforeEach(function() jest.resetModules() - React = require(Packages.React) - ReactNoop = require(Packages.Dev.ReactNoopRenderer) - Scheduler = require(Packages.Scheduler) + React = require("@pkg/@jsdotlua/react") + ReactNoop = require("@pkg/@jsdotlua/react-noop-renderer") + Scheduler = require("@pkg/@jsdotlua/scheduler") end) -- ROBLOX deviation: this test doesn't make sense in not JSX diff --git a/modules/react-reconciler/src/__tests__/ReactIncrementalReflection.spec.lua b/modules/react-reconciler/src/__tests__/ReactIncrementalReflection.spec.lua index 2fea13e7..517a9ff5 100644 --- a/modules/react-reconciler/src/__tests__/ReactIncrementalReflection.spec.lua +++ b/modules/react-reconciler/src/__tests__/ReactIncrementalReflection.spec.lua @@ -12,9 +12,9 @@ local Packages = script.Parent.Parent.Parent local React local ReactNoop local Scheduler -local console = require(Packages.Shared).console +local console = require("@pkg/@jsdotlua/shared").console -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local beforeEach = JestGlobals.beforeEach local describe = JestGlobals.describe @@ -26,9 +26,9 @@ describe("ReactIncrementalReflection", function() beforeEach(function() jest.resetModules() - React = require(Packages.React) - ReactNoop = require(Packages.Dev.ReactNoopRenderer) - Scheduler = require(Packages.Scheduler) + React = require("@pkg/@jsdotlua/react") + ReactNoop = require("@pkg/@jsdotlua/react-noop-renderer") + Scheduler = require("@pkg/@jsdotlua/scheduler") end) local function div(...) diff --git a/modules/react-reconciler/src/__tests__/ReactIncrementalScheduling.spec.lua b/modules/react-reconciler/src/__tests__/ReactIncrementalScheduling.spec.lua index b7223974..e5201541 100644 --- a/modules/react-reconciler/src/__tests__/ReactIncrementalScheduling.spec.lua +++ b/modules/react-reconciler/src/__tests__/ReactIncrementalScheduling.spec.lua @@ -13,7 +13,7 @@ local Packages = script.Parent.Parent.Parent local React local ReactNoop local Scheduler -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local jest = JestGlobals.jest local describe = JestGlobals.describe @@ -24,9 +24,9 @@ describe("ReactIncrementalScheduling", function() beforeEach(function() jest.resetModules() - React = require(Packages.React) - ReactNoop = require(Packages.Dev.ReactNoopRenderer) - Scheduler = require(Packages.Scheduler) + React = require("@pkg/@jsdotlua/react") + ReactNoop = require("@pkg/@jsdotlua/react-noop-renderer") + Scheduler = require("@pkg/@jsdotlua/scheduler") end) local function span(prop) diff --git a/modules/react-reconciler/src/__tests__/ReactIncrementalSideEffects.spec.lua b/modules/react-reconciler/src/__tests__/ReactIncrementalSideEffects.spec.lua index efd6d019..1e1205f7 100644 --- a/modules/react-reconciler/src/__tests__/ReactIncrementalSideEffects.spec.lua +++ b/modules/react-reconciler/src/__tests__/ReactIncrementalSideEffects.spec.lua @@ -15,7 +15,7 @@ local React local ReactNoop local Scheduler -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local jest = JestGlobals.jest local describe = JestGlobals.describe @@ -26,9 +26,9 @@ describe("ReactIncrementalSideEffects", function() beforeEach(function() jest.resetModules() - React = require(Packages.React) - ReactNoop = require(Packages.Dev.ReactNoopRenderer) - Scheduler = require(Packages.Scheduler) + React = require("@pkg/@jsdotlua/react") + ReactNoop = require("@pkg/@jsdotlua/react-noop-renderer") + Scheduler = require("@pkg/@jsdotlua/scheduler") end) local function div(...) diff --git a/modules/react-reconciler/src/__tests__/ReactIncrementalUpdates.spec.lua b/modules/react-reconciler/src/__tests__/ReactIncrementalUpdates.spec.lua index 5a9247f5..46504451 100644 --- a/modules/react-reconciler/src/__tests__/ReactIncrementalUpdates.spec.lua +++ b/modules/react-reconciler/src/__tests__/ReactIncrementalUpdates.spec.lua @@ -9,14 +9,14 @@ -- */ local Packages = script.Parent.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Object = LuauPolyfill.Object -local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags +local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags local React local ReactNoop local Scheduler local InputContinuousLanePriority = 10 -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local describe = JestGlobals.describe local beforeEach = JestGlobals.beforeEach @@ -31,9 +31,9 @@ describe("ReactIncrementalUpdates", function() beforeEach(function() jest.resetModules() - React = require(Packages.React) - ReactNoop = require(Packages.Dev.ReactNoopRenderer) - Scheduler = require(Packages.Scheduler) + React = require("@pkg/@jsdotlua/react") + ReactNoop = require("@pkg/@jsdotlua/react-noop-renderer") + Scheduler = require("@pkg/@jsdotlua/scheduler") end) local function span(prop) diff --git a/modules/react-reconciler/src/__tests__/ReactIncrementalUpdatesMinimalism.spec.lua b/modules/react-reconciler/src/__tests__/ReactIncrementalUpdatesMinimalism.spec.lua index e54a53ee..d89d61fa 100644 --- a/modules/react-reconciler/src/__tests__/ReactIncrementalUpdatesMinimalism.spec.lua +++ b/modules/react-reconciler/src/__tests__/ReactIncrementalUpdatesMinimalism.spec.lua @@ -12,7 +12,7 @@ local React local ReactNoop local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jest = JestGlobals.jest local jestExpect = JestGlobals.expect local describe = JestGlobals.describe @@ -22,8 +22,8 @@ local it = JestGlobals.it describe("ReactIncrementalUpdatesMinimalism", function() beforeEach(function() jest.resetModules() - React = require(Packages.React) - ReactNoop = require(Packages.Dev.ReactNoopRenderer) + React = require("@pkg/@jsdotlua/react") + ReactNoop = require("@pkg/@jsdotlua/react-noop-renderer") end) it("should render a simple component", function() local function Child() diff --git a/modules/react-reconciler/src/__tests__/ReactLazy-internal.spec.lua b/modules/react-reconciler/src/__tests__/ReactLazy-internal.spec.lua index 15bf3d72..7ed342ec 100644 --- a/modules/react-reconciler/src/__tests__/ReactLazy-internal.spec.lua +++ b/modules/react-reconciler/src/__tests__/ReactLazy-internal.spec.lua @@ -8,11 +8,11 @@ local lazy local Packages = script.Parent.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Error = LuauPolyfill.Error local setTimeout = LuauPolyfill.setTimeout -local Promise = require(Packages.Promise) -local JestGlobals = require(Packages.Dev.JestGlobals) +local Promise = require("@pkg/@jsdotlua/promise") +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local describe = JestGlobals.describe local beforeEach = JestGlobals.beforeEach @@ -38,14 +38,14 @@ describe("ReactLazy", function() beforeEach(function() jest.resetModules() - ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags + ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags ReactFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback = false -- PropTypes = require('prop-types'); - React = require(Packages.React) + React = require("@pkg/@jsdotlua/react") Suspense = React.Suspense lazy = React.lazy - ReactTestRenderer = require(Packages.Dev.ReactTestRenderer) - Scheduler = require(Packages.Scheduler) + ReactTestRenderer = require("@pkg/@jsdotlua/react-test-renderer") + Scheduler = require("@pkg/@jsdotlua/scheduler") end) -- local verifyInnerPropTypesAreChecked = _async(function(Add) diff --git a/modules/react-reconciler/src/__tests__/ReactNewContext.spec.lua b/modules/react-reconciler/src/__tests__/ReactNewContext.spec.lua index d044d3d1..4d291593 100644 --- a/modules/react-reconciler/src/__tests__/ReactNewContext.spec.lua +++ b/modules/react-reconciler/src/__tests__/ReactNewContext.spec.lua @@ -10,7 +10,7 @@ ]] local Packages = script.Parent.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array local Error = LuauPolyfill.Error @@ -20,7 +20,7 @@ local ReactNoop local Scheduler -- local gen -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local beforeEach = JestGlobals.beforeEach local jest = JestGlobals.jest @@ -31,10 +31,10 @@ beforeEach(function() jest.resetModules() jest.useFakeTimers() - React = require(Packages.React) + React = require("@pkg/@jsdotlua/react") useContext = React.useContext - ReactNoop = require(Packages.Dev.ReactNoopRenderer) - Scheduler = require(Packages.Scheduler) + ReactNoop = require("@pkg/@jsdotlua/react-noop-renderer") + Scheduler = require("@pkg/@jsdotlua/scheduler") -- gen = nil -- require('random-seed') end) @@ -1128,9 +1128,9 @@ describe("Context.Provider", function() -- Get a new copy of ReactNoop jest.resetModules() - React = require(Packages.React) - ReactNoop = require(Packages.Dev.ReactNoopRenderer) - Scheduler = require(Packages.Scheduler) + React = require("@pkg/@jsdotlua/react") + ReactNoop = require("@pkg/@jsdotlua/react-noop-renderer") + Scheduler = require("@pkg/@jsdotlua/scheduler") -- Render the provider again using a different renderer ReactNoop.render(React.createElement(App, { value = 1 })) diff --git a/modules/react-reconciler/src/__tests__/ReactNoopRendererAct.spec.lua b/modules/react-reconciler/src/__tests__/ReactNoopRendererAct.spec.lua index c43b8364..7304de6b 100644 --- a/modules/react-reconciler/src/__tests__/ReactNoopRendererAct.spec.lua +++ b/modules/react-reconciler/src/__tests__/ReactNoopRendererAct.spec.lua @@ -15,8 +15,8 @@ local React local ReactNoop local Scheduler -local JestGlobals = require(Packages.Dev.JestGlobals) -local Promise = require(Packages.Promise) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") +local Promise = require("@pkg/@jsdotlua/promise") local jestExpect = JestGlobals.expect local beforeEach = JestGlobals.beforeEach local it = JestGlobals.it @@ -25,9 +25,9 @@ local jest = JestGlobals.jest beforeEach(function() jest.resetModules() - React = require(Packages.React) - ReactNoop = require(Packages.Dev.ReactNoopRenderer) - Scheduler = require(Packages.Scheduler) + React = require("@pkg/@jsdotlua/react") + ReactNoop = require("@pkg/@jsdotlua/react-noop-renderer") + Scheduler = require("@pkg/@jsdotlua/scheduler") end) it("can use act to flush effects", function() diff --git a/modules/react-reconciler/src/__tests__/ReactSuspense-internal.spec.lua b/modules/react-reconciler/src/__tests__/ReactSuspense-internal.spec.lua index 16d0da55..fac48831 100644 --- a/modules/react-reconciler/src/__tests__/ReactSuspense-internal.spec.lua +++ b/modules/react-reconciler/src/__tests__/ReactSuspense-internal.spec.lua @@ -20,7 +20,7 @@ local TextResource local textResourceShouldFail local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local beforeEach = JestGlobals.beforeEach local afterEach = JestGlobals.afterEach @@ -29,9 +29,9 @@ local xit = JestGlobals.xit local describe = JestGlobals.describe local jest = JestGlobals.jest -local jestMock = require(Packages.Dev.JestGlobals).jest -local Promise = require(Packages.Promise) -local LuauPolyfill = require(Packages.LuauPolyfill) +local jestMock = require("@pkg/@jsdotlua/jest-globals").jest +local Promise = require("@pkg/@jsdotlua/promise") +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local setTimeout = LuauPolyfill.setTimeout local Error = LuauPolyfill.Error -- Additional tests can be found in ReactSuspenseWithNoopRenderer. Plan is @@ -46,15 +46,15 @@ describe("ReactSuspense", function() beforeEach(function() jest.resetModules() - ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags + ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags ReactFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback = false ReactFeatureFlags.enableSchedulerTracing = true - React = require(Packages.React) - ReactTestRenderer = require(Packages.Dev.ReactTestRenderer) + React = require("@pkg/@jsdotlua/react") + ReactTestRenderer = require("@pkg/@jsdotlua/react-test-renderer") _act = ReactTestRenderer.unstable_concurrentAct - Scheduler = require(Packages.Scheduler) + Scheduler = require("@pkg/@jsdotlua/scheduler") SchedulerTracing = Scheduler.tracing - ReactCache = require(Packages.Dev.ReactCache) + ReactCache = require("@pkg/@jsdotlua/react-cache") Suspense = React.Suspense TextResource = ReactCache.unstable_createResource(function(input) local text, ms = input[1], (input[2] or 0) diff --git a/modules/react-reconciler/src/__tests__/ReactTopLevelFragment.spec.lua b/modules/react-reconciler/src/__tests__/ReactTopLevelFragment.spec.lua index 2d3a53ab..4d56b7d1 100644 --- a/modules/react-reconciler/src/__tests__/ReactTopLevelFragment.spec.lua +++ b/modules/react-reconciler/src/__tests__/ReactTopLevelFragment.spec.lua @@ -11,7 +11,7 @@ --!strict local Packages = script.Parent.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") type Array = LuauPolyfill.Array local React local ReactNoop @@ -20,7 +20,7 @@ local Scheduler -- This is a new feature in Fiber so I put it in its own test file. It could -- probably move to one of the other test files once it is official. -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local beforeEach = JestGlobals.beforeEach local it = JestGlobals.it @@ -29,9 +29,9 @@ local jest = JestGlobals.jest beforeEach(function() jest.resetModules() - React = require(Packages.React) - ReactNoop = require(Packages.Dev.ReactNoopRenderer) - Scheduler = require(Packages.Scheduler) + React = require("@pkg/@jsdotlua/react") + ReactNoop = require("@pkg/@jsdotlua/react-noop-renderer") + Scheduler = require("@pkg/@jsdotlua/scheduler") end) it("should render a simple fragment at the top of a component", function() diff --git a/modules/react-reconciler/src/__tests__/ReactTopLevelText.spec.lua b/modules/react-reconciler/src/__tests__/ReactTopLevelText.spec.lua index 8ea8d913..5bbc5d52 100644 --- a/modules/react-reconciler/src/__tests__/ReactTopLevelText.spec.lua +++ b/modules/react-reconciler/src/__tests__/ReactTopLevelText.spec.lua @@ -17,7 +17,7 @@ local Scheduler -- This is a new feature in Fiber so I put it in its own test file. It could -- probably move to one of the other test files once it is official. -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local beforeEach = JestGlobals.beforeEach local it = JestGlobals.it @@ -28,9 +28,9 @@ describe("ReactTopLevelText", function() beforeEach(function() jest.resetModules() - React = require(Packages.React) - ReactNoop = require(Packages.Dev.ReactNoopRenderer) - Scheduler = require(Packages.Scheduler) + React = require("@pkg/@jsdotlua/react") + ReactNoop = require("@pkg/@jsdotlua/react-noop-renderer") + Scheduler = require("@pkg/@jsdotlua/scheduler") end) it("should render a component returning strings directly from render", function() diff --git a/modules/react-reconciler/src/__tests__/ReactUpdateQueue.roblox.spec.lua b/modules/react-reconciler/src/__tests__/ReactUpdateQueue.roblox.spec.lua index 22c223c5..bb3a82b9 100644 --- a/modules/react-reconciler/src/__tests__/ReactUpdateQueue.roblox.spec.lua +++ b/modules/react-reconciler/src/__tests__/ReactUpdateQueue.roblox.spec.lua @@ -4,7 +4,7 @@ ]] local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local beforeEach = JestGlobals.beforeEach local it = JestGlobals.it @@ -23,10 +23,10 @@ local updatePayload = { myVariable = 90210 } beforeEach(function() jest.resetModules() - React = require(Packages.React) - ReactUpdateQueue = require(script.Parent.Parent["ReactUpdateQueue.new"]) - Fiber = require(script.Parent.Parent["ReactFiber.new"]) - FiberLane = require(script.Parent.Parent.ReactFiberLane) + React = require("@pkg/@jsdotlua/react") + ReactUpdateQueue = require("./ReactUpdateQueue.new.lua") + Fiber = require("./ReactFiber.new.lua") + FiberLane = require("./ReactFiberLane") component = React.Component:extend("fundamental") fundamentalFiber = Fiber.createFiberFromFundamental(component) @@ -159,7 +159,7 @@ describe("enqueueCapturedUpdate", function() update.lane = lane ReactUpdateQueue.initializeUpdateQueue(fundamentalFiber) workInProgress = Fiber.createWorkInProgress(fundamentalFiber, nextProps) - local ReactFiberFlags = require(script.Parent.Parent.ReactFiberFlags) + local ReactFiberFlags = require("./ReactFiberFlags") workInProgress.flags = bit32.bor(0, ReactFiberFlags.ShouldCapture) end) diff --git a/modules/react-reconciler/src/__tests__/ReactUseRef.roblox.spec.lua b/modules/react-reconciler/src/__tests__/ReactUseRef.roblox.spec.lua index fd686b0f..6931936f 100644 --- a/modules/react-reconciler/src/__tests__/ReactUseRef.roblox.spec.lua +++ b/modules/react-reconciler/src/__tests__/ReactUseRef.roblox.spec.lua @@ -4,7 +4,7 @@ local ReactRoblox local Scheduler --ROBLOX NOTE: Tests for the Bindings-based useRef approach -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local beforeEach = JestGlobals.beforeEach local it = JestGlobals.it @@ -16,9 +16,9 @@ describe("useRef", function() beforeEach(function() jest.resetModules() - React = require(Packages.React) - ReactRoblox = require(Packages.Dev.ReactRoblox) - Scheduler = require(Packages.Scheduler) + React = require("@pkg/@jsdotlua/react") + ReactRoblox = require("@pkg/@jsdotlua/react-roblox") + Scheduler = require("@pkg/@jsdotlua/scheduler") useRef = React.useRef end) diff --git a/modules/react-reconciler/src/__tests__/SchedulingProfiler-internal.spec.lua b/modules/react-reconciler/src/__tests__/SchedulingProfiler-internal.spec.lua index 3a70c394..d20bd9cc 100644 --- a/modules/react-reconciler/src/__tests__/SchedulingProfiler-internal.spec.lua +++ b/modules/react-reconciler/src/__tests__/SchedulingProfiler-internal.spec.lua @@ -9,8 +9,8 @@ -- * @jest-environment node -- */ local Packages = script.Parent.Parent.Parent -local ReactVersion = require(Packages.Shared).ReactVersion -local JestGlobals = require(Packages.Dev.JestGlobals) +local ReactVersion = require("@pkg/@jsdotlua/shared").ReactVersion +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local beforeEach = JestGlobals.beforeEach local afterEach = JestGlobals.afterEach @@ -18,10 +18,10 @@ local it = JestGlobals.it local xit = JestGlobals.xit local jest = JestGlobals.jest local describe = JestGlobals.describe -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array local Error = LuauPolyfill.Error -local Promise = require(Packages.Promise) +local Promise = require("@pkg/@jsdotlua/promise") describe("SchedulingProfiler", function() local React @@ -46,7 +46,7 @@ describe("SchedulingProfiler", function() _G.performance = createUserTimingPolyfill() marks = {} - local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags + local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags ReactFeatureFlags.enableSchedulingProfiler = true ReactFeatureFlags.enableProfilerTimer = true ReactFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback = true @@ -89,13 +89,13 @@ describe("SchedulingProfiler", function() ReactFeatureFlags.enableDoubleInvokingEffects = false - React = require(Packages.React) + React = require("@pkg/@jsdotlua/react") -- ReactNoop must be imported after ReactTestRenderer! - ReactTestRenderer = require(Packages.Dev.ReactTestRenderer) - ReactNoop = require(Packages.Dev.ReactNoopRenderer) + ReactTestRenderer = require("@pkg/@jsdotlua/react-test-renderer") + ReactNoop = require("@pkg/@jsdotlua/react-noop-renderer") - Scheduler = require(Packages.Scheduler) + Scheduler = require("@pkg/@jsdotlua/scheduler") end) afterEach(function() diff --git a/modules/react-reconciler/src/__tests__/useMutableSource-internal.spec.lua b/modules/react-reconciler/src/__tests__/useMutableSource-internal.spec.lua index e38a25b3..b26ae5bc 100644 --- a/modules/react-reconciler/src/__tests__/useMutableSource-internal.spec.lua +++ b/modules/react-reconciler/src/__tests__/useMutableSource-internal.spec.lua @@ -16,11 +16,11 @@ local act local createMutableSource local useMutableSource -local LuauPolyfill = require(Packages.LuauPolyfill) -local Promise = require(Packages.Promise) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") +local Promise = require("@pkg/@jsdotlua/promise") local Array = LuauPolyfill.Array -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local jest = JestGlobals.jest local beforeEach = JestGlobals.beforeEach @@ -31,12 +31,12 @@ local describe = JestGlobals.describe local function loadModules() jest.resetModules() jest.useFakeTimers() - local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags + local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags ReactFeatureFlags.enableSchedulerTracing = true ReactFeatureFlags.enableProfilerTimer = true - React = require(Packages.React) - ReactNoop = require(Packages.Dev.ReactNoopRenderer) - Scheduler = require(Packages.Scheduler) + React = require("@pkg/@jsdotlua/react") + ReactNoop = require("@pkg/@jsdotlua/react-noop-renderer") + Scheduler = require("@pkg/@jsdotlua/scheduler") act = ReactNoop.act createMutableSource = React.createMutableSource useMutableSource = React.useMutableSource diff --git a/modules/react-reconciler/src/forks/ReactFiberHostConfig.test.lua b/modules/react-reconciler/src/forks/ReactFiberHostConfig.test.lua index 826a265d..a60106fb 100644 --- a/modules/react-reconciler/src/forks/ReactFiberHostConfig.test.lua +++ b/modules/react-reconciler/src/forks/ReactFiberHostConfig.test.lua @@ -8,6 +8,4 @@ * @flow ]] -local Packages = script.Parent.Parent.Parent - -return require(Packages.Dev.ReactTestRenderer) +return require("@pkg/@jsdotlua/react-test-renderer") diff --git a/modules/react-reconciler/src/init.lua b/modules/react-reconciler/src/init.lua index 3842a20b..ae25bdee 100644 --- a/modules/react-reconciler/src/init.lua +++ b/modules/react-reconciler/src/init.lua @@ -9,8 +9,8 @@ ]] --!strict -local ReactInternalTypes = require(script.ReactInternalTypes) -local ReactRootTags = require(script.ReactRootTags) +local ReactInternalTypes = require("./ReactInternalTypes") +local ReactRootTags = require("./ReactRootTags") export type Dispatcher = ReactInternalTypes.Dispatcher export type Fiber = ReactInternalTypes.Fiber @@ -26,12 +26,12 @@ export type RootTag = ReactRootTags.RootTag -- reconciler module -- ROBLOX TODO: this effectively disconnects type checking from above to reconciler to below local function initialize(config): { [string]: any } - local ReactFiberHostConfig = require(script.ReactFiberHostConfig) + local ReactFiberHostConfig = require("./ReactFiberHostConfig") for name, implementation in config do ReactFiberHostConfig[name] = implementation end - return require(script.ReactFiberReconciler) + return require("./ReactFiberReconciler") end return initialize diff --git a/modules/react-roblox/.npmignore b/modules/react-roblox/.npmignore new file mode 100644 index 00000000..835df8f5 --- /dev/null +++ b/modules/react-roblox/.npmignore @@ -0,0 +1,26 @@ +**/.robloxrc +rotriever.toml + +/roblox +/build + +.darklua* +.luau-analyze.json +.luaurc +default.project.json + +/globalTypes.d.lua +**/sourcemap.json +**/*.project.json + +**/__tests__ +**/*.test.lua +**/*.spec.lua +**/jest.config.lua + +**/*.rbxl +**/*.rbxlx +**/*.rbxl.lock +**/*.rbxlx.lock +**/*.rbxm +**/*.rbxmx diff --git a/modules/react-roblox/default.project.json b/modules/react-roblox/default.project.json index 5004457d..a828507c 100644 --- a/modules/react-roblox/default.project.json +++ b/modules/react-roblox/default.project.json @@ -1,5 +1,5 @@ { - "name": "ReactRoblox", + "name": "react-roblox", "tree": { "$path": "src" } diff --git a/modules/react-roblox/package.json b/modules/react-roblox/package.json new file mode 100644 index 00000000..952124ab --- /dev/null +++ b/modules/react-roblox/package.json @@ -0,0 +1,24 @@ +{ + "name": "@jsdotlua/react-roblox", + "version": "17.0.2", + "repository": { + "type": "git", + "url": "https://github.com/jsdotlua/react-lua.git", + "directory": "modules/react-roblox" + }, + "license": "MIT", + "main": "src/init.lua", + "scripts": { + "prepare": "npmluau" + }, + "dependencies": { + "@jsdotlua/luau-polyfill": "^1.2.6", + "@jsdotlua/react": "workspace:^", + "@jsdotlua/react-reconciler": "workspace:^", + "@jsdotlua/scheduler": "workspace:^", + "@jsdotlua/shared": "workspace:^" + }, + "devDependencies": { + "npmluau": "^0.1.0" + } +} diff --git a/modules/react-roblox/src/ReactReconciler.roblox.lua b/modules/react-roblox/src/ReactReconciler.roblox.lua index 8fa2a3f1..a776b71f 100644 --- a/modules/react-roblox/src/ReactReconciler.roblox.lua +++ b/modules/react-roblox/src/ReactReconciler.roblox.lua @@ -2,9 +2,8 @@ -- ROBLOX deviation: Initializes the reconciler with this package's host -- config and returns the resulting module -local Packages = script.Parent.Parent -local initializeReconciler = require(Packages.ReactReconciler) +local initializeReconciler = require("@pkg/@jsdotlua/react-reconciler") -local ReactRobloxHostConfig = require(script.Parent.client.ReactRobloxHostConfig) +local ReactRobloxHostConfig = require("./client/ReactRobloxHostConfig") return initializeReconciler(ReactRobloxHostConfig) diff --git a/modules/react-roblox/src/client/ReactRoblox.lua b/modules/react-roblox/src/client/ReactRoblox.lua index 1029fb19..ff19a410 100644 --- a/modules/react-roblox/src/client/ReactRoblox.lua +++ b/modules/react-roblox/src/client/ReactRoblox.lua @@ -8,15 +8,13 @@ * * @flow ]] -local Packages = script.Parent.Parent.Parent - -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") type ReactNodeList = ReactTypes.ReactNodeList -local ReactRobloxHostTypes = require(script.Parent["ReactRobloxHostTypes.roblox"]) +local ReactRobloxHostTypes = require("./ReactRobloxHostTypes.roblox.lua") type Container = ReactRobloxHostTypes.Container -- local '../shared/checkReact' --- local ReactRobloxLegacy = require(script.Parent.ReactRobloxLegacy) +-- local ReactRobloxLegacy = require("./ReactRobloxLegacy") -- local findDOMNode = ReactRobloxLegacy.findDOMNode -- local render = ReactRobloxLegacy.render -- local hydrate = ReactRobloxLegacy.hydrate @@ -24,15 +22,15 @@ type Container = ReactRobloxHostTypes.Container -- local unmountComponentAtNode = ReactRobloxLegacy.unmountComponentAtNode local ReactRobloxRoot -ReactRobloxRoot = require(script.Parent.ReactRobloxRoot) +ReactRobloxRoot = require("./ReactRobloxRoot") local createRoot = ReactRobloxRoot.createRoot local createBlockingRoot = ReactRobloxRoot.createBlockingRoot local createLegacyRoot = ReactRobloxRoot.createLegacyRoot local isValidContainer = ReactRobloxRoot.isValidContainer --- local createEventHandle = require(script.Parent.ReactDOMEventHandle).createEventHandle +-- local createEventHandle = require("./ReactDOMEventHandle").createEventHandle -- ROBLOX deviation: Use the config-injecting entry point for the reconciler -local ReactReconciler = require(script.Parent.Parent["ReactReconciler.roblox"]) +local ReactReconciler = require("../ReactReconciler.roblox.lua") -- local batchedEventUpdates = ReactReconciler.batchedEventUpdates local batchedUpdates = ReactReconciler.batchedUpdates -- local discreteUpdates = ReactReconciler.discreteUpdates @@ -50,19 +48,19 @@ local IsThisRendererActing = ReactReconciler.IsThisRendererActing -- local getCurrentUpdateLanePriority = ReactReconciler.getCurrentUpdateLanePriority local createPortalImpl = ReactReconciler.createPortal --- local canUseDOM = require(Packages.Shared).ExecutionEnvironment.canUseDOM -local ReactVersion = require(Packages.Shared).ReactVersion -local invariant = require(Packages.Shared).invariant -local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags +-- local canUseDOM = require("@pkg/@jsdotlua/shared").ExecutionEnvironment.canUseDOM +local ReactVersion = require("@pkg/@jsdotlua/shared").ReactVersion +local invariant = require("@pkg/@jsdotlua/shared").invariant +local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags -- local warnUnstableRenderSubtreeIntoContainer = ReactFeatureFlags.warnUnstableRenderSubtreeIntoContainer local enableNewReconciler = ReactFeatureFlags.enableNewReconciler -local ReactRobloxComponentTree = require(script.Parent.ReactRobloxComponentTree) +local ReactRobloxComponentTree = require("./ReactRobloxComponentTree") local getInstanceFromNode = ReactRobloxComponentTree.getInstanceFromNode local getNodeFromInstance = ReactRobloxComponentTree.getNodeFromInstance local getFiberCurrentPropsFromNode = ReactRobloxComponentTree.getFiberCurrentPropsFromNode local getClosestInstanceFromNode = ReactRobloxComponentTree.getClosestInstanceFromNode --- local restoreControlledState = require(script.Parent.ReactRobloxComponent).restoreControlledState +-- local restoreControlledState = require("./ReactRobloxComponent").restoreControlledState -- local ReactDOMEventReplaying = require(Packages.Parent.Parent.events.ReactDOMEventReplaying) -- local setAttemptSynchronousHydration = ReactDOMEventReplaying.setAttemptSynchronousHydration @@ -74,14 +72,14 @@ local getClosestInstanceFromNode = ReactRobloxComponentTree.getClosestInstanceFr -- local setAttemptHydrationAtPriority = ReactDOMEventReplaying.setAttemptHydrationAtPriority -- local setBatchingImplementation = require(Packages.Parent.Parent.events.ReactDOMUpdateBatching).setBatchingImplementation --- local ReactDOMControlledComponent = require(script.Parent.Parent.events.ReactDOMControlledComponent) +-- local ReactDOMControlledComponent = require("./events/ReactDOMControlledComponent") -- local setRestoreImplementation = ReactDOMControlledComponent.setRestoreImplementation -- local enqueueStateRestore = ReactDOMControlledComponent.enqueueStateRestore -- local restoreStateIfNeeded = ReactDOMControlledComponent.restoreStateIfNeeded -local Event = require(Packages.Shared).Event -local Change = require(Packages.Shared).Change -local Tag = require(Packages.Shared).Tag +local Event = require("@pkg/@jsdotlua/shared").Event +local Change = require("@pkg/@jsdotlua/shared").Change +local Tag = require("@pkg/@jsdotlua/shared").Tag -- setAttemptSynchronousHydration(attemptSynchronousHydration) -- setAttemptUserBlockingHydration(attemptUserBlockingHydration) diff --git a/modules/react-roblox/src/client/ReactRobloxComponent.lua b/modules/react-roblox/src/client/ReactRobloxComponent.lua index 14270e62..9b70302a 100644 --- a/modules/react-roblox/src/client/ReactRobloxComponent.lua +++ b/modules/react-roblox/src/client/ReactRobloxComponent.lua @@ -9,13 +9,12 @@ * @flow ]] -local Packages = script.Parent.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Object = LuauPolyfill.Object -local RobloxComponentProps = require(script.Parent.roblox.RobloxComponentProps) +local RobloxComponentProps = require("./roblox/RobloxComponentProps") -local ReactRobloxHostTypes = require(script.Parent["ReactRobloxHostTypes.roblox"]) +local ReactRobloxHostTypes = require("./ReactRobloxHostTypes.roblox.lua") type HostInstance = ReactRobloxHostTypes.HostInstance -- deviation: Essentially a placeholder for dom-specific logic, taking the place diff --git a/modules/react-roblox/src/client/ReactRobloxComponentTree.lua b/modules/react-roblox/src/client/ReactRobloxComponentTree.lua index 5dde29df..78fe97ff 100644 --- a/modules/react-roblox/src/client/ReactRobloxComponentTree.lua +++ b/modules/react-roblox/src/client/ReactRobloxComponentTree.lua @@ -10,18 +10,16 @@ * @flow ]] -local Packages = script.Parent.Parent.Parent - -local ReactRobloxHostTypes = require(script.Parent["ReactRobloxHostTypes.roblox"]) +local ReactRobloxHostTypes = require("./ReactRobloxHostTypes.roblox.lua") type HostInstance = ReactRobloxHostTypes.HostInstance type TextInstance = ReactRobloxHostTypes.TextInstance type SuspenseInstance = ReactRobloxHostTypes.SuspenseInstance type Container = ReactRobloxHostTypes.Container type Props = ReactRobloxHostTypes.Props -local ReactInternalTypes = require(Packages.ReactReconciler) +local ReactInternalTypes = require("@pkg/@jsdotlua/react-reconciler") type Fiber = ReactInternalTypes.Fiber -local Shared = require(Packages.Shared) +local Shared = require("@pkg/@jsdotlua/shared") type ReactScopeInstance = Shared.ReactScopeInstance -- local type { -- ReactDOMEventHandle, @@ -187,8 +185,7 @@ end exports.getInstanceFromNode = function(node): Fiber? -- ROBLOX deviation: lazy initialize to avoid circular dependency if ReactWorkTags == nil then - local ReactReconciler = - require(script.Parent.Parent["ReactReconciler.roblox"]) :: any + local ReactReconciler = require("../ReactReconciler.roblox.lua") :: any ReactWorkTags = ReactReconciler.ReactWorkTags HostComponent = ReactWorkTags.HostComponent diff --git a/modules/react-roblox/src/client/ReactRobloxHostConfig.lua b/modules/react-roblox/src/client/ReactRobloxHostConfig.lua index 9e967c85..9ec7fbcd 100644 --- a/modules/react-roblox/src/client/ReactRobloxHostConfig.lua +++ b/modules/react-roblox/src/client/ReactRobloxHostConfig.lua @@ -18,22 +18,21 @@ local function unimplemented(message: string) end local CollectionService = game:GetService("CollectionService") -local Packages = script.Parent.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local inspect = LuauPolyfill.util.inspect -local console = require(Packages.Shared).console +local console = require("@pkg/@jsdotlua/shared").console local Object = LuauPolyfill.Object local setTimeout = LuauPolyfill.setTimeout local clearTimeout = LuauPolyfill.clearTimeout --- local type {DOMEventName} = require(Packages.../events/DOMEventNames' --- local type {Fiber, FiberRoot} = require(Packages.react-reconciler/src/ReactInternalTypes' +-- local type {DOMEventName} = require(Packages.../events/DOMEventNames') +-- local type {Fiber, FiberRoot} = require(Packages.react-reconciler/src/ReactInternalTypes') -- local type { -- BoundingRect, -- IntersectionObserverOptions, -- ObserveVisibleRectsCallback, --- } = require(Packages.react-reconciler/src/ReactTestSelectors' -local ReactRobloxHostTypes = require(script.Parent["ReactRobloxHostTypes.roblox"]) +-- } = require(Packages.react-reconciler/src/ReactTestSelectors') +local ReactRobloxHostTypes = require("./ReactRobloxHostTypes.roblox.lua") type RootType = ReactRobloxHostTypes.RootType type Container = ReactRobloxHostTypes.Container type HostInstance = ReactRobloxHostTypes.HostInstance @@ -43,10 +42,10 @@ type Props = ReactRobloxHostTypes.Props type Type = ReactRobloxHostTypes.Type type HostContext = ReactRobloxHostTypes.HostContext --- local type {ReactScopeInstance} = require(Packages.shared/ReactTypes' --- local type {ReactDOMFundamentalComponentInstance} = require(Packages.../shared/ReactDOMTypes' +-- local type {ReactScopeInstance} = require(Packages.shared/ReactTypes') +-- local type {ReactDOMFundamentalComponentInstance} = require(Packages.../shared/ReactDOMTypes') -local ReactRobloxComponentTree = require(script.Parent.ReactRobloxComponentTree) +local ReactRobloxComponentTree = require("./ReactRobloxComponentTree") local precacheFiberNode = ReactRobloxComponentTree.precacheFiberNode local uncacheFiberNode = ReactRobloxComponentTree.uncacheFiberNode local updateFiberProps = ReactRobloxComponentTree.updateFiberProps @@ -55,8 +54,8 @@ local updateFiberProps = ReactRobloxComponentTree.updateFiberProps -- local getInstanceFromNodeDOMTree = ReactRobloxComponentTree.getInstanceFromNode -- local isContainerMarkedAsRoot = ReactRobloxComponentTree.isContainerMarkedAsRoot --- local {hasRole} = require(Packages../DOMAccessibilityRoles' -local ReactRobloxComponent = require(script.Parent.ReactRobloxComponent) +-- local {hasRole} = require(Packages../DOMAccessibilityRoles') +local ReactRobloxComponent = require("./ReactRobloxComponent") -- local createElement = ReactRobloxComponent.createElement -- local createTextNode = ReactRobloxComponent.createTextNode local setInitialProperties = ReactRobloxComponent.setInitialProperties @@ -71,38 +70,38 @@ local cleanupHostComponent = ReactRobloxComponent.cleanupHostComponent -- local warnForDeletedHydratableText = ReactRobloxComponent.warnForDeletedHydratableText -- local warnForInsertedHydratedElement = ReactRobloxComponent.warnForInsertedHydratedElement -- local warnForInsertedHydratedText = ReactRobloxComponent.warnForInsertedHydratedText --- local {getSelectionInformation, restoreSelection} = require(Packages../ReactInputSelection' --- local setTextContent = require(Packages../setTextContent' --- local {validateDOMNesting, updatedAncestorInfo} = require(Packages../validateDOMNesting' +-- local {getSelectionInformation, restoreSelection} = require(Packages../ReactInputSelection') +-- local setTextContent = require(Packages../setTextContent') +-- local {validateDOMNesting, updatedAncestorInfo} = require(Packages../validateDOMNesting') -- local { -- isEnabled as ReactBrowserEventEmitterIsEnabled, -- setEnabled as ReactBrowserEventEmitterSetEnabled, --- } = require(Packages.../events/ReactDOMEventListener' --- local {getChildNamespace} = require(Packages.../shared/DOMNamespaces' +-- } = require(Packages.../events/ReactDOMEventListener') +-- local {getChildNamespace} = require(Packages.../shared/DOMNamespaces') -- local { -- ELEMENT_NODE, -- TEXT_NODE, -- COMMENT_NODE, -- DOCUMENT_NODE, -- DOCUMENT_FRAGMENT_NODE, --- } = require(Packages.../shared/HTMLNodeType' --- local dangerousStyleValue = require(Packages.../shared/dangerousStyleValue' +-- } = require(Packages.../shared/HTMLNodeType') +-- local dangerousStyleValue = require(Packages.../shared/dangerousStyleValue') --- local {REACT_OPAQUE_ID_TYPE} = require(Packages.shared/ReactSymbols' --- local {retryIfBlockedOn} = require(Packages.../events/ReactDOMEventReplaying' +-- local {REACT_OPAQUE_ID_TYPE} = require(Packages.shared/ReactSymbols') +-- local {retryIfBlockedOn} = require(Packages.../events/ReactDOMEventReplaying') -local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags +local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags -- local enableSuspenseServerRenderer = ReactFeatureFlags.enableSuspenseServerRenderer -- local enableFundamentalAPI = ReactFeatureFlags.enableFundamentalAPI local enableCreateEventHandleAPI = ReactFeatureFlags.enableCreateEventHandleAPI -- local enableScopeAPI = ReactFeatureFlags.enableScopeAPI -- local enableEagerRootListeners = ReactFeatureFlags.enableEagerRootListeners --- local {HostComponent, HostText} = require(Packages.react-reconciler/src/ReactWorkTags' +-- local {HostComponent, HostText} = require(Packages.react-reconciler/src/ReactWorkTags') -- local { -- listenToReactEvent, -- listenToAllSupportedEvents, --- } = require(Packages.../events/DOMPluginEventSystem' +-- } = require(Packages.../events/DOMPluginEventSystem') type Array = { [number]: T } type Object = { [any]: any } @@ -218,7 +217,10 @@ local function recursivelyUncacheFiberNode(node: HostInstance) end local exports: { [any]: any } = {} -Object.assign(exports, require(Packages.Shared).ReactFiberHostConfig.WithNoPersistence) +Object.assign( + exports, + require("@pkg/@jsdotlua/shared").ReactFiberHostConfig.WithNoPersistence +) exports.getRootHostContext = function(rootContainerInstance: Container): HostContext -- ROBLOX deviation: This is a lot of HTML-DOM specific logic; I'm not clear on diff --git a/modules/react-roblox/src/client/ReactRobloxHostTypes.roblox.lua b/modules/react-roblox/src/client/ReactRobloxHostTypes.roblox.lua index 589ebd19..b3f7366f 100644 --- a/modules/react-roblox/src/client/ReactRobloxHostTypes.roblox.lua +++ b/modules/react-roblox/src/client/ReactRobloxHostTypes.roblox.lua @@ -9,12 +9,10 @@ * * @flow ]] -local Packages = script.Parent.Parent.Parent - -local ReactReconciler = require(Packages.ReactReconciler) +local ReactReconciler = require("@pkg/@jsdotlua/react-reconciler") type FiberRoot = ReactReconciler.FiberRoot -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") type MutableSource = ReactTypes.MutableSource type ReactNodeList = ReactTypes.ReactNodeList diff --git a/modules/react-roblox/src/client/ReactRobloxRoot.lua b/modules/react-roblox/src/client/ReactRobloxRoot.lua index 329d6ff1..43253385 100644 --- a/modules/react-roblox/src/client/ReactRobloxRoot.lua +++ b/modules/react-roblox/src/client/ReactRobloxRoot.lua @@ -9,45 +9,43 @@ * @flow ]] -local Packages = script.Parent.Parent.Parent - -local ReactRobloxHostTypes = require(script.Parent["ReactRobloxHostTypes.roblox"]) +local ReactRobloxHostTypes = require("./ReactRobloxHostTypes.roblox.lua") type Container = ReactRobloxHostTypes.Container type RootType = ReactRobloxHostTypes.RootType type RootOptions = ReactRobloxHostTypes.RootOptions -local ReconcilerTypes = require(Packages.ReactReconciler) +local ReconcilerTypes = require("@pkg/@jsdotlua/react-reconciler") type RootTag = ReconcilerTypes.RootTag -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") type MutableSource = ReactTypes.MutableSource type ReactNodeList = ReactTypes.ReactNodeList -local ReactInternalTypes = require(Packages.ReactReconciler) +local ReactInternalTypes = require("@pkg/@jsdotlua/react-reconciler") type FiberRoot = ReactInternalTypes.FiberRoot type Array = { [number]: T } -local ReactRobloxComponentTree = require(script.Parent.ReactRobloxComponentTree) +local ReactRobloxComponentTree = require("./ReactRobloxComponentTree") -- local isContainerMarkedAsRoot = ReactRobloxComponentTree.isContainerMarkedAsRoot local markContainerAsRoot = ReactRobloxComponentTree.markContainerAsRoot local unmarkContainerAsRoot = ReactRobloxComponentTree.unmarkContainerAsRoot --- local listenToAllSupportedEvents = require(script.Parent.Parent.events.DOMPluginEventSystem).listenToAllSupportedEvents --- local eagerlyTrapReplayableEvents = require(script.Parent.Parent.events.ReactDOMEventReplaying).eagerlyTrapReplayableEvents --- local HTMLNodeType = require(script.Parent.Parent.shared.HTMLNodeType) +-- local listenToAllSupportedEvents = require("./events/DOMPluginEventSystem").listenToAllSupportedEvents +-- local eagerlyTrapReplayableEvents = require("./events/ReactDOMEventReplaying").eagerlyTrapReplayableEvents +-- local HTMLNodeType = require("./shared/HTMLNodeType") -- local ELEMENT_NODE = HTMLNodeType.ELEMENT_NODE -- local COMMENT_NODE = HTMLNodeType.COMMENT_NODE -- local DOCUMENT_NODE = HTMLNodeType.DOCUMENT_NODE -- local DOCUMENT_FRAGMENT_NODE = HTMLNodeType.DOCUMENT_FRAGMENT_NODE --- local ensureListeningTo = require(Packages.ReactDOMComponent).ensureListeningTo +-- local ensureListeningTo = require("@pkg/ReactDOMComponent").ensureListeningTo -- ROBLOX deviation: Use the config-injecting entry point for the reconciler -local ReactFiberReconciler = require(script.Parent.Parent["ReactReconciler.roblox"]) +local ReactFiberReconciler = require("../ReactReconciler.roblox.lua") local createContainer = ReactFiberReconciler.createContainer local updateContainer = ReactFiberReconciler.updateContainer -- local findHostInstanceWithNoPortals = ReactFiberReconciler.findHostInstanceWithNoPortals -- local registerMutableSourceForHydration = ReactFiberReconciler.registerMutableSourceForHydration -local invariant = require(Packages.Shared).invariant +local invariant = require("@pkg/@jsdotlua/shared").invariant local enableEagerRootListeners = - require(Packages.Shared).ReactFeatureFlags.enableEagerRootListeners + require("@pkg/@jsdotlua/shared").ReactFeatureFlags.enableEagerRootListeners local BlockingRoot = ReactFiberReconciler.ReactRootTags.BlockingRoot local ConcurrentRoot = ReactFiberReconciler.ReactRootTags.ConcurrentRoot diff --git a/modules/react-roblox/src/client/__tests__/PropAssignmentErrors.roblox.spec.lua b/modules/react-roblox/src/client/__tests__/PropAssignmentErrors.roblox.spec.lua index 6e36dbbe..f4f4a989 100644 --- a/modules/react-roblox/src/client/__tests__/PropAssignmentErrors.roblox.spec.lua +++ b/modules/react-roblox/src/client/__tests__/PropAssignmentErrors.roblox.spec.lua @@ -1,6 +1,6 @@ local Packages = script.Parent.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local beforeEach = JestGlobals.beforeEach local it = JestGlobals.it @@ -15,14 +15,14 @@ local parent beforeEach(function() jest.resetModules() jest.useFakeTimers() - local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags + local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags ReactFeatureFlags.debugRenderPhaseSideEffectsForStrictMode = false - React = require(Packages.React) - ReactRoblox = require(Packages.ReactRoblox) + React = require("@pkg/@jsdotlua/react") + ReactRoblox = require("@pkg/@jsdotlua/react-roblox") parent = Instance.new("Folder") reactRobloxRoot = ReactRoblox.createRoot(parent) - Scheduler = require(Packages.Scheduler) + Scheduler = require("@pkg/@jsdotlua/scheduler") end) it("should provide a useful error when initial prop assignment fails", function() diff --git a/modules/react-roblox/src/client/__tests__/ReactRobloxBindings.roblox.spec.lua b/modules/react-roblox/src/client/__tests__/ReactRobloxBindings.roblox.spec.lua index 9e54c92b..99b4119e 100644 --- a/modules/react-roblox/src/client/__tests__/ReactRobloxBindings.roblox.spec.lua +++ b/modules/react-roblox/src/client/__tests__/ReactRobloxBindings.roblox.spec.lua @@ -15,7 +15,7 @@ local Packages = script.Parent.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local jest = JestGlobals.jest local beforeEach = JestGlobals.beforeEach @@ -30,11 +30,11 @@ local parent beforeEach(function() jest.resetModules() jest.useFakeTimers() - local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags + local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags ReactFeatureFlags.debugRenderPhaseSideEffectsForStrictMode = false - React = require(Packages.React) - ReactRoblox = require(Packages.ReactRoblox) + React = require("@pkg/@jsdotlua/react") + ReactRoblox = require("@pkg/@jsdotlua/react-roblox") parent = Instance.new("Folder") reactRobloxRoot = ReactRoblox.createRoot(parent) end) diff --git a/modules/react-roblox/src/client/__tests__/ReactRobloxComponentTree.roblox.spec.lua b/modules/react-roblox/src/client/__tests__/ReactRobloxComponentTree.roblox.spec.lua index a5e5ce8b..7b6fca42 100644 --- a/modules/react-roblox/src/client/__tests__/ReactRobloxComponentTree.roblox.spec.lua +++ b/modules/react-roblox/src/client/__tests__/ReactRobloxComponentTree.roblox.spec.lua @@ -10,7 +10,7 @@ local Packages = script.Parent.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local jest = JestGlobals.jest local beforeEach = JestGlobals.beforeEach @@ -26,13 +26,13 @@ local parent beforeEach(function() jest.resetModules() jest.useFakeTimers() - local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags + local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags ReactFeatureFlags.debugRenderPhaseSideEffectsForStrictMode = false - React = require(Packages.React) - ReactRoblox = require(Packages.ReactRoblox) - Scheduler = require(Packages.Scheduler) - ReactRobloxComponentTree = require(script.Parent.Parent.ReactRobloxComponentTree) + React = require("@pkg/@jsdotlua/react") + ReactRoblox = require("@pkg/@jsdotlua/react-roblox") + Scheduler = require("@pkg/@jsdotlua/scheduler") + ReactRobloxComponentTree = require("./ReactRobloxComponentTree") parent = Instance.new("Folder") reactRobloxRoot = ReactRoblox.createRoot(parent) end) diff --git a/modules/react-roblox/src/client/__tests__/ReactRobloxFiber.spec.lua b/modules/react-roblox/src/client/__tests__/ReactRobloxFiber.spec.lua index b16f6a95..e69cf984 100644 --- a/modules/react-roblox/src/client/__tests__/ReactRobloxFiber.spec.lua +++ b/modules/react-roblox/src/client/__tests__/ReactRobloxFiber.spec.lua @@ -19,7 +19,7 @@ local parent -- local PropTypes = require('prop-types') -- local container -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local jest = JestGlobals.jest local beforeEach = JestGlobals.beforeEach @@ -32,11 +32,11 @@ beforeEach(function() -- document.body.appendChild(container) jest.resetModules() jest.useFakeTimers() - React = require(Packages.React) - ReactRoblox = require(Packages.ReactRoblox) + React = require("@pkg/@jsdotlua/react") + ReactRoblox = require("@pkg/@jsdotlua/react-roblox") parent = Instance.new("Folder") reactRobloxRoot = ReactRoblox.createRoot(parent) - Scheduler = require(Packages.Scheduler) + Scheduler = require("@pkg/@jsdotlua/scheduler") end) -- ROBLOX DEVIATION: Document logic does not apply to Roblox diff --git a/modules/react-roblox/src/client/__tests__/RobloxRenderer.roblox.spec.lua b/modules/react-roblox/src/client/__tests__/RobloxRenderer.roblox.spec.lua index e02f55fd..7c2ae202 100644 --- a/modules/react-roblox/src/client/__tests__/RobloxRenderer.roblox.spec.lua +++ b/modules/react-roblox/src/client/__tests__/RobloxRenderer.roblox.spec.lua @@ -1,6 +1,6 @@ local Packages = script.Parent.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local jest = JestGlobals.jest local expect = jestExpect @@ -18,11 +18,11 @@ beforeEach(function() jest.resetModules() jest.useFakeTimers() - React = require(Packages.React) - ReactRoblox = require(Packages.ReactRoblox) + React = require("@pkg/@jsdotlua/react") + ReactRoblox = require("@pkg/@jsdotlua/react-roblox") parent = Instance.new("Folder") reactRobloxRoot = ReactRoblox.createRoot(parent) - Scheduler = require(Packages.Scheduler) + Scheduler = require("@pkg/@jsdotlua/scheduler") end) describe("mounting instances", function() diff --git a/modules/react-roblox/src/client/roblox/RobloxComponentProps.lua b/modules/react-roblox/src/client/roblox/RobloxComponentProps.lua index 05843eff..5ca0a5e1 100644 --- a/modules/react-roblox/src/client/roblox/RobloxComponentProps.lua +++ b/modules/react-roblox/src/client/roblox/RobloxComponentProps.lua @@ -14,24 +14,23 @@ ]] local __DEV__ = _G.__DEV__ :: boolean local CollectionService = game:GetService("CollectionService") -local Packages = script.Parent.Parent.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Object = LuauPolyfill.Object local Set = LuauPolyfill.Set local String = LuauPolyfill.String local inspect = LuauPolyfill.util.inspect -local console = require(Packages.Shared).console +local console = require("@pkg/@jsdotlua/shared").console -local React = require(Packages.React) -local ReactSymbols = require(Packages.Shared).ReactSymbols -local SingleEventManager = require(script.Parent.SingleEventManager) +local React = require("@pkg/@jsdotlua/react") +local ReactSymbols = require("@pkg/@jsdotlua/shared").ReactSymbols +local SingleEventManager = require("./SingleEventManager") type EventManager = SingleEventManager.EventManager -local Type = require(Packages.Shared).Type -local getDefaultInstanceProperty = require(script.Parent.getDefaultInstanceProperty) -local ReactRobloxHostTypes = require(script.Parent.Parent["ReactRobloxHostTypes.roblox"]) +local Type = require("@pkg/@jsdotlua/shared").Type +local getDefaultInstanceProperty = require("./getDefaultInstanceProperty") +local ReactRobloxHostTypes = require("../ReactRobloxHostTypes.roblox.lua") type HostInstance = ReactRobloxHostTypes.HostInstance -local Tag = require(Packages.React).Tag +local Tag = require("@pkg/@jsdotlua/react").Tag -- ROBLOX deviation: Essentially a placeholder for dom-specific logic, taking the place -- of ReactDOMComponent. Most of the logic will differ pretty dramatically diff --git a/modules/react-roblox/src/client/roblox/SingleEventManager.lua b/modules/react-roblox/src/client/roblox/SingleEventManager.lua index 27a0432a..9c2915cb 100644 --- a/modules/react-roblox/src/client/roblox/SingleEventManager.lua +++ b/modules/react-roblox/src/client/roblox/SingleEventManager.lua @@ -18,9 +18,7 @@ A manager for a single host virtual node's connected events. ]] -local Packages = script.Parent.Parent.Parent.Parent - -local console = require(Packages.Shared).console +local console = require("@pkg/@jsdotlua/shared").console type Function = (...any) -> ...any local CHANGE_PREFIX = "Change." diff --git a/modules/react-roblox/src/client/roblox/__tests__/RobloxComponentProps.roblox.spec.lua b/modules/react-roblox/src/client/roblox/__tests__/RobloxComponentProps.roblox.spec.lua index 82044302..4eb8ae74 100644 --- a/modules/react-roblox/src/client/roblox/__tests__/RobloxComponentProps.roblox.spec.lua +++ b/modules/react-roblox/src/client/roblox/__tests__/RobloxComponentProps.roblox.spec.lua @@ -4,7 +4,7 @@ local Scheduler local RobloxComponentProps local Packages = script.Parent.Parent.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local jest = JestGlobals.jest local beforeEach = JestGlobals.beforeEach @@ -12,10 +12,10 @@ local it = JestGlobals.it beforeEach(function() jest.resetModules() - React = require(Packages.React) - ReactRoblox = require(Packages.ReactRoblox) - Scheduler = require(Packages.Scheduler) - RobloxComponentProps = require(script.Parent.Parent.RobloxComponentProps) + React = require("@pkg/@jsdotlua/react") + ReactRoblox = require("@pkg/@jsdotlua/react-roblox") + Scheduler = require("@pkg/@jsdotlua/scheduler") + RobloxComponentProps = require("./RobloxComponentProps") end) local function getSizeOfMap(map) diff --git a/modules/react-roblox/src/client/roblox/__tests__/SingleEventManager.spec.lua b/modules/react-roblox/src/client/roblox/__tests__/SingleEventManager.spec.lua index aff7a474..58844b73 100644 --- a/modules/react-roblox/src/client/roblox/__tests__/SingleEventManager.spec.lua +++ b/modules/react-roblox/src/client/roblox/__tests__/SingleEventManager.spec.lua @@ -15,16 +15,16 @@ ]] local Packages = script.Parent.Parent.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local jest = JestGlobals.jest local it = JestGlobals.it local describe = JestGlobals.describe -- ROBLOX FIXME --- local Logging = require(script.Parent.Parent.Logging) +-- local Logging = require("./Logging") -local SingleEventManager = require(script.Parent.Parent.SingleEventManager) -local waitForEvents = require(script.Parent.waitForEvents) +local SingleEventManager = require("./SingleEventManager") +local waitForEvents = require("./waitForEvents") describe("new", function() it("should create a SingleEventManager", function() diff --git a/modules/react-roblox/src/client/roblox/__tests__/Tagging.spec.lua b/modules/react-roblox/src/client/roblox/__tests__/Tagging.spec.lua index 7589e1e9..c688cac0 100644 --- a/modules/react-roblox/src/client/roblox/__tests__/Tagging.spec.lua +++ b/modules/react-roblox/src/client/roblox/__tests__/Tagging.spec.lua @@ -21,10 +21,10 @@ local Tag local CollectionService = game:GetService("CollectionService") local Packages = script.Parent.Parent.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local jest = JestGlobals.jest -local waitForEvents = require(script.Parent.waitForEvents) +local waitForEvents = require("./waitForEvents") local beforeEach = JestGlobals.beforeEach local afterEach = JestGlobals.afterEach local it = JestGlobals.it @@ -32,10 +32,10 @@ local describe = JestGlobals.describe beforeEach(function() jest.resetModules() - React = require(Packages.React) - ReactRoblox = require(Packages.ReactRoblox) - Scheduler = require(Packages.Scheduler) - Tag = require(Packages.React).Tag + React = require("@pkg/@jsdotlua/react") + ReactRoblox = require("@pkg/@jsdotlua/react-roblox") + Scheduler = require("@pkg/@jsdotlua/scheduler") + Tag = require("@pkg/@jsdotlua/react").Tag end) describe("adding tags", function() diff --git a/modules/react-roblox/src/client/roblox/__tests__/getDefaultInstanceProperty.spec.lua b/modules/react-roblox/src/client/roblox/__tests__/getDefaultInstanceProperty.spec.lua index e3cb297c..48bdc797 100644 --- a/modules/react-roblox/src/client/roblox/__tests__/getDefaultInstanceProperty.spec.lua +++ b/modules/react-roblox/src/client/roblox/__tests__/getDefaultInstanceProperty.spec.lua @@ -15,11 +15,10 @@ ]] local Packages = script.Parent.Parent.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local it = JestGlobals.it -local getDefaultInstanceProperty = - require(script.Parent.Parent.getDefaultInstanceProperty) +local getDefaultInstanceProperty = require("./getDefaultInstanceProperty") it("should get default name string values", function() local _, defaultName = getDefaultInstanceProperty("StringValue", "Name") diff --git a/modules/react-roblox/src/client/roblox/getDefaultInstanceProperty.lua b/modules/react-roblox/src/client/roblox/getDefaultInstanceProperty.lua index 40f7d84f..92b92e87 100644 --- a/modules/react-roblox/src/client/roblox/getDefaultInstanceProperty.lua +++ b/modules/react-roblox/src/client/roblox/getDefaultInstanceProperty.lua @@ -24,8 +24,7 @@ of an object without constructing an instance of it. ]] -local Packages = script.Parent.Parent.Parent.Parent -local Symbol = require(Packages.Shared).Symbol +local Symbol = require("@pkg/@jsdotlua/shared").Symbol local Nil = Symbol.named("Nil") local _cachedPropertyValues = {} diff --git a/modules/react-roblox/src/init.lua b/modules/react-roblox/src/init.lua index d2c87118..33ea3cd7 100644 --- a/modules/react-roblox/src/init.lua +++ b/modules/react-roblox/src/init.lua @@ -9,6 +9,6 @@ * @flow ]] -local HostTypes = require(script.client["ReactRobloxHostTypes.roblox"]) +local HostTypes = require("./client/ReactRobloxHostTypes.roblox.lua") export type RootType = HostTypes.RootType -return require(script.client.ReactRoblox) +return require("./client/ReactRoblox") diff --git a/modules/react-shallow-renderer/.npmignore b/modules/react-shallow-renderer/.npmignore new file mode 100644 index 00000000..835df8f5 --- /dev/null +++ b/modules/react-shallow-renderer/.npmignore @@ -0,0 +1,26 @@ +**/.robloxrc +rotriever.toml + +/roblox +/build + +.darklua* +.luau-analyze.json +.luaurc +default.project.json + +/globalTypes.d.lua +**/sourcemap.json +**/*.project.json + +**/__tests__ +**/*.test.lua +**/*.spec.lua +**/jest.config.lua + +**/*.rbxl +**/*.rbxlx +**/*.rbxl.lock +**/*.rbxlx.lock +**/*.rbxm +**/*.rbxmx diff --git a/modules/react-shallow-renderer/default.project.json b/modules/react-shallow-renderer/default.project.json index 0efa967a..3b890ac6 100644 --- a/modules/react-shallow-renderer/default.project.json +++ b/modules/react-shallow-renderer/default.project.json @@ -1,5 +1,5 @@ { - "name": "ReactShallowRenderer", + "name": "react-shallow-renderer", "tree": { "$path": "src" } diff --git a/modules/react-shallow-renderer/package.json b/modules/react-shallow-renderer/package.json new file mode 100644 index 00000000..1bfaeb1a --- /dev/null +++ b/modules/react-shallow-renderer/package.json @@ -0,0 +1,23 @@ +{ + "name": "@jsdotlua/react-shallow-renderer", + "version": "17.0.2", + "repository": { + "type": "git", + "url": "https://github.com/jsdotlua/react-lua.git", + "directory": "modules/react-shallow-renderer" + }, + "license": "MIT", + "main": "src/init.lua", + "scripts": { + "prepare": "npmluau" + }, + "dependencies": { + "@jsdotlua/luau-polyfill": "^1.2.6", + "@jsdotlua/react": "workspace:^", + "@jsdotlua/react-is": "workspace:^", + "@jsdotlua/shared": "workspace:^" + }, + "devDependencies": { + "npmluau": "^0.1.0" + } +} diff --git a/modules/react-shallow-renderer/src/__tests__/ReactShallowRenderer.spec.lua b/modules/react-shallow-renderer/src/__tests__/ReactShallowRenderer.spec.lua index 8038f67e..0bee26c5 100644 --- a/modules/react-shallow-renderer/src/__tests__/ReactShallowRenderer.spec.lua +++ b/modules/react-shallow-renderer/src/__tests__/ReactShallowRenderer.spec.lua @@ -10,23 +10,23 @@ -- local Dependencies = script.Parent.Parent.Parent.Parent.Packages local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local beforeEach = JestGlobals.beforeEach local jestExpect = JestGlobals.expect local it = JestGlobals.it -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array local Error = LuauPolyfill.Error local UninitializedState --- local PropTypes = require(Dependencies.PropTypes) +-- local PropTypes = require("./Packages/PropTypes") local React local ReactShallowRenderer local createRenderer beforeEach(function() - UninitializedState = require(Packages.Shared).UninitializedState - React = require(Packages.React) - ReactShallowRenderer = require(script.Parent.Parent) + UninitializedState = require("@pkg/@jsdotlua/shared").UninitializedState + React = require("@pkg/@jsdotlua/react") + ReactShallowRenderer = require(".") createRenderer = ReactShallowRenderer.createRenderer end) diff --git a/modules/react-shallow-renderer/src/__tests__/ReactShallowRendererHooks.spec.lua b/modules/react-shallow-renderer/src/__tests__/ReactShallowRendererHooks.spec.lua index 33a35055..b81bb4c0 100644 --- a/modules/react-shallow-renderer/src/__tests__/ReactShallowRendererHooks.spec.lua +++ b/modules/react-shallow-renderer/src/__tests__/ReactShallowRendererHooks.spec.lua @@ -9,7 +9,7 @@ ]] local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local beforeEach = JestGlobals.beforeEach local jestExpect = JestGlobals.expect local describe = JestGlobals.describe @@ -20,8 +20,8 @@ local ReactShallowRenderer local createRenderer beforeEach(function() - React = require(Packages.React) - ReactShallowRenderer = require(script.Parent.Parent) + React = require("@pkg/@jsdotlua/react") + ReactShallowRenderer = require(".") createRenderer = ReactShallowRenderer.createRenderer end) diff --git a/modules/react-shallow-renderer/src/init.lua b/modules/react-shallow-renderer/src/init.lua index 7e67ad6f..cf993773 100644 --- a/modules/react-shallow-renderer/src/init.lua +++ b/modules/react-shallow-renderer/src/init.lua @@ -7,28 +7,27 @@ * ]] -local Packages = script.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Object = LuauPolyfill.Object local Error = LuauPolyfill.Error local Array = LuauPolyfill.Array type Array = LuauPolyfill.Array -local React = require(Packages.React) +local React = require("@pkg/@jsdotlua/react") -local ReactIs = require(Packages.ReactIs) +local ReactIs = require("@pkg/@jsdotlua/react-is") local isForwardRef = ReactIs.isForwardRef local isMemo = ReactIs.isMemo local ForwardRef = ReactIs.ForwardRef -local ReactComponentStackFrame = require(Packages.Shared).ReactComponentStackFrame +local ReactComponentStackFrame = require("@pkg/@jsdotlua/shared").ReactComponentStackFrame local describeComponentFrame = ReactComponentStackFrame.describeComponentFrame -local getComponentName = require(Packages.Shared).getComponentName -local shallowEqual = require(Packages.Shared).shallowEqual -local checkPropTypes = require(Packages.Shared).checkPropTypes -local ReactSharedInternals = require(Packages.Shared).ReactSharedInternals -local consoleWithStackDev = require(Packages.Shared).consoleWithStackDev -local is = require(Packages.Shared).objectIs +local getComponentName = require("@pkg/@jsdotlua/shared").getComponentName +local shallowEqual = require("@pkg/@jsdotlua/shared").shallowEqual +local checkPropTypes = require("@pkg/@jsdotlua/shared").checkPropTypes +local ReactSharedInternals = require("@pkg/@jsdotlua/shared").ReactSharedInternals +local consoleWithStackDev = require("@pkg/@jsdotlua/shared").consoleWithStackDev +local is = require("@pkg/@jsdotlua/shared").objectIs local ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher local ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame diff --git a/modules/react-test-renderer/.npmignore b/modules/react-test-renderer/.npmignore new file mode 100644 index 00000000..835df8f5 --- /dev/null +++ b/modules/react-test-renderer/.npmignore @@ -0,0 +1,26 @@ +**/.robloxrc +rotriever.toml + +/roblox +/build + +.darklua* +.luau-analyze.json +.luaurc +default.project.json + +/globalTypes.d.lua +**/sourcemap.json +**/*.project.json + +**/__tests__ +**/*.test.lua +**/*.spec.lua +**/jest.config.lua + +**/*.rbxl +**/*.rbxlx +**/*.rbxl.lock +**/*.rbxlx.lock +**/*.rbxm +**/*.rbxmx diff --git a/modules/react-test-renderer/default.project.json b/modules/react-test-renderer/default.project.json index 2b4bf9c6..e3a0d183 100644 --- a/modules/react-test-renderer/default.project.json +++ b/modules/react-test-renderer/default.project.json @@ -1,5 +1,5 @@ { - "name": "ReactTestRenderer", + "name": "react-test-renderer", "tree": { "$path": "src" } diff --git a/modules/react-test-renderer/package.json b/modules/react-test-renderer/package.json new file mode 100644 index 00000000..dab91e3e --- /dev/null +++ b/modules/react-test-renderer/package.json @@ -0,0 +1,24 @@ +{ + "name": "@jsdotlua/react-test-renderer", + "version": "17.0.2", + "repository": { + "type": "git", + "url": "https://github.com/jsdotlua/react-lua.git", + "directory": "modules/react-test-renderer" + }, + "license": "MIT", + "main": "src/init.lua", + "scripts": { + "prepare": "npmluau" + }, + "dependencies": { + "@jsdotlua/luau-polyfill": "^1.2.6", + "@jsdotlua/react": "workspace:^", + "@jsdotlua/react-reconciler": "workspace:^", + "@jsdotlua/scheduler": "workspace:^", + "@jsdotlua/shared": "workspace:^" + }, + "devDependencies": { + "npmluau": "^0.1.0" + } +} diff --git a/modules/react-test-renderer/src/ReactTestHostConfig.lua b/modules/react-test-renderer/src/ReactTestHostConfig.lua index 8459fcfa..00d80736 100644 --- a/modules/react-test-renderer/src/ReactTestHostConfig.lua +++ b/modules/react-test-renderer/src/ReactTestHostConfig.lua @@ -9,9 +9,7 @@ * @flow ]] -local Packages = script.Parent.Parent - -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array local Object = LuauPolyfill.Object @@ -20,18 +18,18 @@ local setTimeout = LuauPolyfill.setTimeout local clearTimeout = LuauPolyfill.clearTimeout -- ROBLOX: use patched console from shared -local console = require(Packages.Shared).console +local console = require("@pkg/@jsdotlua/shared").console -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") type ReactFundamentalComponentInstance = ReactTypes.ReactFundamentalComponentInstance< T, U > -local ReactSymbols = require(Packages.Shared).ReactSymbols +local ReactSymbols = require("@pkg/@jsdotlua/shared").ReactSymbols local REACT_OPAQUE_ID_TYPE = ReactSymbols.REACT_OPAQUE_ID_TYPE -local RobloxComponentProps = require(script.Parent.roblox.RobloxComponentProps) +local RobloxComponentProps = require("./roblox/RobloxComponentProps") type Array = { [number]: T } type Function = (any) -> any @@ -78,7 +76,7 @@ export type OpaqueIDType = string | Object export type RendererInspectionConfig = {} -local ReactFiberHostConfig = require(Packages.Shared).ReactFiberHostConfig +local ReactFiberHostConfig = require("@pkg/@jsdotlua/shared").ReactFiberHostConfig local exports = Object.assign( {}, ReactFiberHostConfig.WithNoPersistence, diff --git a/modules/react-test-renderer/src/ReactTestRenderer.lua b/modules/react-test-renderer/src/ReactTestRenderer.lua index d96357c3..0564c2fc 100644 --- a/modules/react-test-renderer/src/ReactTestRenderer.lua +++ b/modules/react-test-renderer/src/ReactTestRenderer.lua @@ -8,30 +8,28 @@ -- * @flow -- */ -local Packages = script.Parent.Parent -local Scheduler = require(Packages.Scheduler) -local console = require(Packages.Shared).console -local LuauPolyfill = require(Packages.LuauPolyfill) +local Scheduler = require("@pkg/@jsdotlua/scheduler") +local console = require("@pkg/@jsdotlua/shared").console +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Symbol = LuauPolyfill.Symbol local Array = LuauPolyfill.Array local Object = LuauPolyfill.Object local setTimeout = LuauPolyfill.setTimeout -local ReactTypes = require(Packages.Shared) -local getInstancesForTag = - require(script.Parent.roblox.RobloxComponentProps).getInstancesForTag +local ReactTypes = require("@pkg/@jsdotlua/shared") +local getInstancesForTag = require("./roblox/RobloxComponentProps").getInstancesForTag type ReactElement = ReactTypes.ReactElement -local ReactInternalTypes = require(Packages.ReactReconciler) +local ReactInternalTypes = require("@pkg/@jsdotlua/react-reconciler") type Fiber = ReactInternalTypes.Fiber type FiberRoot = ReactInternalTypes.FiberRoot type Thenable = ReactTypes.Thenable -- ROBLOX TODO: split below to silence analyze, but why is analyze throwing in first place? -local ReactTestHostConfig = require(script.Parent.ReactTestHostConfig) +local ReactTestHostConfig = require("./ReactTestHostConfig") -- ROBLOX deviation: For all tests, we mock the reconciler into a configurable -- function interface that allows injection of HostConfig -local ReactReconciler = require(Packages.ReactReconciler) +local ReactReconciler = require("@pkg/@jsdotlua/react-reconciler") local ReactFiberReconciler = ReactReconciler(ReactTestHostConfig) local getPublicRootInstance = ReactFiberReconciler.getPublicRootInstance @@ -61,12 +59,12 @@ local SimpleMemoComponent = ReactWorkTags.SimpleMemoComponent local Block = ReactWorkTags.Block local IncompleteClassComponent = ReactWorkTags.IncompleteClassComponent local ScopeComponent = ReactWorkTags.ScopeComponent -local Shared = require(Packages.Shared) +local Shared = require("@pkg/@jsdotlua/shared") local invariant = Shared.invariant local getComponentName = Shared.getComponentName local ReactVersion = Shared.ReactVersion -local ReactSharedInternals = require(Packages.Shared).ReactSharedInternals +local ReactSharedInternals = require("@pkg/@jsdotlua/shared").ReactSharedInternals local enqueueTask = Shared.enqueueTask local getPublicInstance = ReactTestHostConfig.getPublicInstance local ReactRootTags = ReactFiberReconciler.ReactRootTags diff --git a/modules/react-test-renderer/src/__tests__/ReactTestRenderer-internal.spec.lua b/modules/react-test-renderer/src/__tests__/ReactTestRenderer-internal.spec.lua index 1596d8af..db39349d 100644 --- a/modules/react-test-renderer/src/__tests__/ReactTestRenderer-internal.spec.lua +++ b/modules/react-test-renderer/src/__tests__/ReactTestRenderer-internal.spec.lua @@ -9,7 +9,6 @@ -- */ -- !strict -local Packages = script.Parent.Parent.Parent local ReactFeatureFlags local React @@ -17,10 +16,10 @@ local ReactTestRenderer -- local prettyFormat = require('pretty-format') -- Isolate noop renderer --- local ReactNoop = require(Packages.ReactNoopRenderer) --- local Scheduler = require(Packages.Scheduler) +-- local ReactNoop = require("@pkg/ReactNoopRenderer") +-- local Scheduler = require("@pkg/@jsdotlua/scheduler") -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array local Symbol = LuauPolyfill.Symbol @@ -56,7 +55,7 @@ local function cleanNodeOrArray(node) end end -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local beforeEach = JestGlobals.beforeEach local jestExpect = JestGlobals.expect local describe = JestGlobals.describe @@ -67,11 +66,11 @@ describe("ReactTestRenderer", function() beforeEach(function() jest.resetModules() - ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags + ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags ReactFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback = false - React = require(Packages.React) - ReactTestRenderer = require(Packages.ReactTestRenderer) + React = require("@pkg/@jsdotlua/react") + ReactTestRenderer = require("@pkg/@jsdotlua/react-test-renderer") -- local prettyFormat = require('pretty-format') end) it("renders a simple component", function() diff --git a/modules/react-test-renderer/src/__tests__/ReactTestRenderer.spec.lua b/modules/react-test-renderer/src/__tests__/ReactTestRenderer.spec.lua index 7a447d6d..efb4cc72 100644 --- a/modules/react-test-renderer/src/__tests__/ReactTestRenderer.spec.lua +++ b/modules/react-test-renderer/src/__tests__/ReactTestRenderer.spec.lua @@ -9,10 +9,9 @@ -- 'use strict' -local Packages = script.Parent.Parent.Parent local ReactRoblox local ReactTestRenderer -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local beforeEach = JestGlobals.beforeEach local jestExpect = JestGlobals.expect local describe = JestGlobals.describe @@ -23,11 +22,11 @@ describe("ReactTestRenderer", function() beforeEach(function() jest.resetModules() jest.useRealTimers() - ReactRoblox = require(Packages.Dev.ReactRoblox) + ReactRoblox = require("@pkg/@jsdotlua/react-roblox") -- Isolate test renderer. jest.resetModules() - ReactTestRenderer = require(Packages.ReactTestRenderer) + ReactTestRenderer = require("@pkg/@jsdotlua/react-test-renderer") end) it("should warn if used to render a ReactRoblox portal", function() diff --git a/modules/react-test-renderer/src/__tests__/ReactTestRendererAct.spec.lua b/modules/react-test-renderer/src/__tests__/ReactTestRendererAct.spec.lua index d76849e0..d1c9890c 100644 --- a/modules/react-test-renderer/src/__tests__/ReactTestRendererAct.spec.lua +++ b/modules/react-test-renderer/src/__tests__/ReactTestRendererAct.spec.lua @@ -4,27 +4,25 @@ local Scheduler local act local useState, useEffect, useReducer -local Packages = script.Parent.Parent.Parent - -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local beforeEach = JestGlobals.beforeEach local jestExpect = JestGlobals.expect local describe = JestGlobals.describe local it = JestGlobals.it local jest = JestGlobals.jest -local Promise = require(Packages.Dev.Promise) +local Promise = require("@pkg/@jsdotlua/promise") describe("ReactTestRenderer.act()", function() beforeEach(function() jest.resetModules() jest.useRealTimers() - React = require(Packages.React) + React = require("@pkg/@jsdotlua/react") useState, useEffect, useReducer = React.useState, React.useEffect, React.useReducer - ReactTestRenderer = require(Packages.ReactTestRenderer) - Scheduler = require(Packages.Scheduler) + ReactTestRenderer = require("@pkg/@jsdotlua/react-test-renderer") + Scheduler = require("@pkg/@jsdotlua/scheduler") act = ReactTestRenderer.act end) it("can use .act() to flush effects", function() diff --git a/modules/react-test-renderer/src/__tests__/ReactTestRendererMockPropMarkers.roblox.spec.lua b/modules/react-test-renderer/src/__tests__/ReactTestRendererMockPropMarkers.roblox.spec.lua index 1a435f19..720d82b3 100644 --- a/modules/react-test-renderer/src/__tests__/ReactTestRendererMockPropMarkers.roblox.spec.lua +++ b/modules/react-test-renderer/src/__tests__/ReactTestRendererMockPropMarkers.roblox.spec.lua @@ -9,12 +9,11 @@ -- */ -- !strict -local Packages = script.Parent.Parent.Parent local React local ReactTestRenderer -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local beforeEach = JestGlobals.beforeEach local jestExpect = JestGlobals.expect local describe = JestGlobals.describe @@ -25,8 +24,8 @@ describe("ReactTestRenderer", function() beforeEach(function() jest.resetModules() - React = require(Packages.React) - ReactTestRenderer = require(Packages.ReactTestRenderer) + React = require("@pkg/@jsdotlua/react") + ReactTestRenderer = require("@pkg/@jsdotlua/react-test-renderer") end) it("renders a component with React.Change, React.Event, React.Tag props", function() local onTextChangedCallback = function() end diff --git a/modules/react-test-renderer/src/__tests__/ReactTestRendererTraversal.spec.lua b/modules/react-test-renderer/src/__tests__/ReactTestRendererTraversal.spec.lua index f82cde3d..bbacd13e 100644 --- a/modules/react-test-renderer/src/__tests__/ReactTestRendererTraversal.spec.lua +++ b/modules/react-test-renderer/src/__tests__/ReactTestRendererTraversal.spec.lua @@ -10,16 +10,14 @@ -- * @jest-environment node -- */ -local Packages = script.Parent.Parent.Parent - -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local beforeEach = JestGlobals.beforeEach local jestExpect = JestGlobals.expect local describe = JestGlobals.describe local it = JestGlobals.it local jest = JestGlobals.jest -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Object = LuauPolyfill.Object local React @@ -38,11 +36,11 @@ describe("ReactTestRendererTraversal", function() beforeEach(function() jest.resetModules() - React = require(Packages.React) + React = require("@pkg/@jsdotlua/react") View = function(props) return React.createElement(RCTView, props) end - ReactTestRenderer = require(Packages.ReactTestRenderer) + ReactTestRenderer = require("@pkg/@jsdotlua/react-test-renderer") ExampleSpread = React.Component:extend("ExampleSpread") Context = React.createContext(nil) diff --git a/modules/react-test-renderer/src/__tests__/RobloxComponentProps.roblox.spec.lua b/modules/react-test-renderer/src/__tests__/RobloxComponentProps.roblox.spec.lua index f46296f6..3386772e 100644 --- a/modules/react-test-renderer/src/__tests__/RobloxComponentProps.roblox.spec.lua +++ b/modules/react-test-renderer/src/__tests__/RobloxComponentProps.roblox.spec.lua @@ -1,5 +1,3 @@ -local Packages = script.Parent.Parent.Parent - local RobloxComponentProps local setInitialTags local updateTags @@ -7,7 +5,7 @@ local removeTags local getInstancesForTag local Tag -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local beforeEach = JestGlobals.beforeEach local jestExpect = JestGlobals.expect local describe = JestGlobals.describe @@ -17,12 +15,12 @@ local jest = JestGlobals.jest describe("TestRenderer Tag Support", function() beforeEach(function() jest.resetModules() - RobloxComponentProps = require(script.Parent.Parent.roblox.RobloxComponentProps) + RobloxComponentProps = require("./roblox/RobloxComponentProps") setInitialTags = RobloxComponentProps.setInitialTags updateTags = RobloxComponentProps.updateTags removeTags = RobloxComponentProps.removeTags getInstancesForTag = RobloxComponentProps.getInstancesForTag - Tag = require(Packages.Shared).Tag + Tag = require("@pkg/@jsdotlua/shared").Tag end) it("should set initial tags for an instance", function() diff --git a/modules/react-test-renderer/src/init.lua b/modules/react-test-renderer/src/init.lua index 1d8b4412..8e199df7 100644 --- a/modules/react-test-renderer/src/init.lua +++ b/modules/react-test-renderer/src/init.lua @@ -8,4 +8,4 @@ * * @emails react-core ]] -return require(script.ReactTestRenderer) +return require("./ReactTestRenderer") diff --git a/modules/react-test-renderer/src/roblox/RobloxComponentProps.lua b/modules/react-test-renderer/src/roblox/RobloxComponentProps.lua index 149c3251..8188ed51 100644 --- a/modules/react-test-renderer/src/roblox/RobloxComponentProps.lua +++ b/modules/react-test-renderer/src/roblox/RobloxComponentProps.lua @@ -1,7 +1,5 @@ -local Packages = script.Parent.Parent.Parent - -local Shared = require(Packages.Shared) -local LuauPolyfill = require(Packages.LuauPolyfill) +local Shared = require("@pkg/@jsdotlua/shared") +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") type Object = LuauPolyfill.Object type Array = LuauPolyfill.Array diff --git a/modules/react/.npmignore b/modules/react/.npmignore new file mode 100644 index 00000000..835df8f5 --- /dev/null +++ b/modules/react/.npmignore @@ -0,0 +1,26 @@ +**/.robloxrc +rotriever.toml + +/roblox +/build + +.darklua* +.luau-analyze.json +.luaurc +default.project.json + +/globalTypes.d.lua +**/sourcemap.json +**/*.project.json + +**/__tests__ +**/*.test.lua +**/*.spec.lua +**/jest.config.lua + +**/*.rbxl +**/*.rbxlx +**/*.rbxl.lock +**/*.rbxlx.lock +**/*.rbxm +**/*.rbxmx diff --git a/modules/react/default.project.json b/modules/react/default.project.json index ea48cd10..5570d93c 100644 --- a/modules/react/default.project.json +++ b/modules/react/default.project.json @@ -1,5 +1,5 @@ { - "name": "React", + "name": "react", "tree": { "$path": "src" } diff --git a/modules/react/package.json b/modules/react/package.json new file mode 100644 index 00000000..e09bace9 --- /dev/null +++ b/modules/react/package.json @@ -0,0 +1,21 @@ +{ + "name": "@jsdotlua/react", + "version": "17.0.2", + "repository": { + "type": "git", + "url": "https://github.com/jsdotlua/react-lua.git", + "directory": "modules/react" + }, + "license": "MIT", + "main": "src/init.lua", + "scripts": { + "prepare": "npmluau" + }, + "dependencies": { + "@jsdotlua/luau-polyfill": "^1.2.6", + "@jsdotlua/shared": "workspace:^" + }, + "devDependencies": { + "npmluau": "^0.1.0" + } +} diff --git a/modules/react/src/None.roblox.lua b/modules/react/src/None.roblox.lua index 85ca3836..ceea055b 100644 --- a/modules/react/src/None.roblox.lua +++ b/modules/react/src/None.roblox.lua @@ -15,8 +15,7 @@ * limitations under the License. ]] -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") -- Roact uses `Object.assign` internally to assign new state values; the same -- None value should give us the proper semantics. We can re-export this value diff --git a/modules/react/src/React.lua b/modules/react/src/React.lua index 0ced5de3..d75f30b2 100644 --- a/modules/react/src/React.lua +++ b/modules/react/src/React.lua @@ -9,35 +9,33 @@ * @flow *]] -local React = script.Parent -local Packages = React.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") type Object = LuauPolyfill.Object -local createMutableSource = require(React.ReactMutableSource) -local ReactSharedInternals = require(Packages.Shared).ReactSharedInternals -local ReactBaseClasses = require(React.ReactBaseClasses) -local ReactChildren = require(React.ReactChildren) -local ReactElementValidator = require(React.ReactElementValidator) -local ReactElement = require(React.ReactElement) -local ReactCreateRef = require(React.ReactCreateRef) -local ReactForwardRef = require(React.ReactForwardRef) -local ReactHooks = require(React.ReactHooks) -local ReactMemo = require(React.ReactMemo) -local ReactContext = require(React.ReactContext) -local ReactLazy = require(React.ReactLazy) +local createMutableSource = require("./ReactMutableSource") +local ReactSharedInternals = require("@pkg/@jsdotlua/shared").ReactSharedInternals +local ReactBaseClasses = require("./ReactBaseClasses") +local ReactChildren = require("./ReactChildren") +local ReactElementValidator = require("./ReactElementValidator") +local ReactElement = require("./ReactElement") +local ReactCreateRef = require("./ReactCreateRef") +local ReactForwardRef = require("./ReactForwardRef") +local ReactHooks = require("./ReactHooks") +local ReactMemo = require("./ReactMemo") +local ReactContext = require("./ReactContext") +local ReactLazy = require("./ReactLazy") type LazyComponent = ReactLazy.LazyComponent -- ROBLOX DEVIATION: Bindings -local ReactBinding = require(React["ReactBinding.roblox"]) +local ReactBinding = require("./ReactBinding.roblox.lua") -- ROBLOX DEVIATION: Re-export `None` marker -local ReactNone = require(React["None.roblox"]) +local ReactNone = require("./None.roblox.lua") -local SharedModule = require(Packages.Shared) +local SharedModule = require("@pkg/@jsdotlua/shared") local ReactSymbols = SharedModule.ReactSymbols local shouldValidate = _G.__DEV__ or _G.__DISABLE_ALL_WARNINGS_EXCEPT_PROP_VALIDATION__ -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") export type React_StatelessFunctionalComponent

= ReactTypes.React_StatelessFunctionalComponent

export type React_ComponentType

= ReactTypes.React_ComponentType

@@ -144,12 +142,12 @@ return { __subscribeToBinding = ReactBinding.subscribe, -- ROBLOX DEVIATION: export Change, Event, and Tag from React - Event = require(Packages.Shared).Event, - Change = require(Packages.Shared).Change, - Tag = require(Packages.Shared).Tag, + Event = require("@pkg/@jsdotlua/shared").Event, + Change = require("@pkg/@jsdotlua/shared").Change, + Tag = require("@pkg/@jsdotlua/shared").Tag, -- ROBLOX DEVIATION: used by error reporters to parse caught errors. React -- stringifies at its boundaries to maintain compatibility with -- ScriptContext signals that may ultimately catch them - unstable_parseReactError = require(Packages.Shared).parseReactError, + unstable_parseReactError = require("@pkg/@jsdotlua/shared").parseReactError, } diff --git a/modules/react/src/ReactBaseClasses.lua b/modules/react/src/ReactBaseClasses.lua index 07713773..445e46c1 100644 --- a/modules/react/src/ReactBaseClasses.lua +++ b/modules/react/src/ReactBaseClasses.lua @@ -8,19 +8,18 @@ ]] local __DEV__ = _G.__DEV__ :: boolean local __COMPAT_WARNINGS__ = _G.__COMPAT_WARNINGS__ :: boolean -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Object = LuauPolyfill.Object type Object = LuauPolyfill.Object -- ROBLOX: use patched console from shared -local console = require(Packages.Shared).console +local console = require("@pkg/@jsdotlua/shared").console -local SharedModule = require(Packages.Shared) +local SharedModule = require("@pkg/@jsdotlua/shared") -- ROBLOX deviation START: we do boolean checks and error() like React 18 does to save functional call in hot path -- local invariant = SharedModule.invariant -- ROBLOX deviation END type React_Component = SharedModule.React_Component -local ReactNoopUpdateQueue = require(script.Parent.ReactNoopUpdateQueue) +local ReactNoopUpdateQueue = require("./ReactNoopUpdateQueue") local emptyObject = {} if __DEV__ then @@ -29,7 +28,7 @@ end -- ROBLOX DEVIATION: Initialize state to a singleton that warns on access and -- errors on assignment -local UninitializedState = require(Packages.Shared).UninitializedState +local UninitializedState = require("@pkg/@jsdotlua/shared").UninitializedState --[[* * Base class helpers for the updating state of a component. diff --git a/modules/react/src/ReactBinding.roblox.lua b/modules/react/src/ReactBinding.roblox.lua index 7aaae477..28a14d0c 100644 --- a/modules/react/src/ReactBinding.roblox.lua +++ b/modules/react/src/ReactBinding.roblox.lua @@ -14,17 +14,15 @@ * limitations under the License. ]] -local Packages = script.Parent.Parent +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") +local ReactSymbols = require("@pkg/@jsdotlua/shared").ReactSymbols -local LuauPolyfill = require(Packages.LuauPolyfill) -local ReactSymbols = require(Packages.Shared).ReactSymbols - -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") type Binding = ReactTypes.ReactBinding type BindingUpdater = ReactTypes.ReactBindingUpdater local Symbol = LuauPolyfill.Symbol -local createSignal = require(script.Parent["createSignal.roblox"]) +local createSignal = require("./createSignal.roblox.lua") local BindingImpl = Symbol("BindingImpl") diff --git a/modules/react/src/ReactChildren.lua b/modules/react/src/ReactChildren.lua index b84cfbda..07d39e86 100644 --- a/modules/react/src/ReactChildren.lua +++ b/modules/react/src/ReactChildren.lua @@ -8,27 +8,25 @@ * * @flow ]] - -local Packages = script.Parent.Parent -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") type ReactNodeList = ReactTypes.ReactNodeList type React_Node = ReactTypes.React_Node type ReactElement = ReactTypes.ReactElement -local invariant = require(Packages.Shared).invariant +local invariant = require("@pkg/@jsdotlua/shared").invariant -local ReactSymbols = require(Packages.Shared).ReactSymbols +local ReactSymbols = require("@pkg/@jsdotlua/shared").ReactSymbols local getIteratorFn = ReactSymbols.getIteratorFn local REACT_ELEMENT_TYPE = ReactSymbols.REACT_ELEMENT_TYPE local REACT_PORTAL_TYPE = ReactSymbols.REACT_PORTAL_TYPE -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array -- local console = LuauPolyfill.console type Array = LuauPolyfill.Array type Object = LuauPolyfill.Object -local ReactElement = require(script.Parent.ReactElement) +local ReactElement = require("./ReactElement") local isValidElement = ReactElement.isValidElement local cloneAndReplaceKey = ReactElement.cloneAndReplaceKey diff --git a/modules/react/src/ReactContext.lua b/modules/react/src/ReactContext.lua index 5084f683..ad65a6a4 100644 --- a/modules/react/src/ReactContext.lua +++ b/modules/react/src/ReactContext.lua @@ -8,12 +8,11 @@ * * ]] -local Packages = script.Parent.Parent -- ROBLOX: use patched console from shared -local Shared = require(Packages.Shared) +local Shared = require("@pkg/@jsdotlua/shared") local console = Shared.console -local ReactSymbols = require(Packages.Shared).ReactSymbols +local ReactSymbols = require("@pkg/@jsdotlua/shared").ReactSymbols local REACT_PROVIDER_TYPE = ReactSymbols.REACT_PROVIDER_TYPE local REACT_CONTEXT_TYPE = ReactSymbols.REACT_CONTEXT_TYPE type ReactContext = Shared.ReactContext diff --git a/modules/react/src/ReactCreateRef.lua b/modules/react/src/ReactCreateRef.lua index 12c34d2a..2fac640e 100644 --- a/modules/react/src/ReactCreateRef.lua +++ b/modules/react/src/ReactCreateRef.lua @@ -8,8 +8,7 @@ * @flow *]] -local Packages = script.Parent.Parent -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") type RefObject = ReactTypes.RefObject -- ROBLOX DEVIATION: In Roact, refs are implemented in terms of bindings @@ -17,7 +16,7 @@ type RefObject = ReactTypes.RefObject A ref is nothing more than a binding with a special field 'current' that maps to the getValue method of the binding ]] -local Binding = require(script.Parent["ReactBinding.roblox"]) +local Binding = require("./ReactBinding.roblox.lua") local exports = {} diff --git a/modules/react/src/ReactElement.lua b/modules/react/src/ReactElement.lua index 4d7ee4b1..ae082e37 100644 --- a/modules/react/src/ReactElement.lua +++ b/modules/react/src/ReactElement.lua @@ -7,14 +7,13 @@ * LICENSE file in the root directory of this source tree. ]] local __DEV__ = _G.__DEV__ :: boolean -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Error = LuauPolyfill.Error type Object = LuauPolyfill.Object -- ROBLOX: use patched console from shared -local console = require(Packages.Shared).console -local ReactTypes = require(Packages.Shared) +local console = require("@pkg/@jsdotlua/shared").console +local ReactTypes = require("@pkg/@jsdotlua/shared") type React_StatelessFunctionalComponent

= ReactTypes.React_StatelessFunctionalComponent< P > @@ -27,15 +26,17 @@ type ReactElement

= ReactTypes.ReactElement type ReactContext = ReactTypes.ReactContext type Source = ReactTypes.Source -local ReactLazy = require(script.Parent.ReactLazy) +local ReactLazy = require("./ReactLazy") type LazyComponent = ReactLazy.LazyComponent -local getComponentName = require(Packages.Shared).getComponentName +local getComponentName = require("@pkg/@jsdotlua/shared").getComponentName -- ROBLOX deviation START: we eliminate invariant like in React 18 to avoid string formatting and function call overhead --- local invariant = require(Packages.Shared).invariant +-- local invariant = require("@pkg/@jsdotlua/shared").invariant -- ROBLOX deviation END -local REACT_ELEMENT_TYPE = require(Packages.Shared).ReactSymbols.REACT_ELEMENT_TYPE -local ReactCurrentOwner = require(Packages.Shared).ReactSharedInternals.ReactCurrentOwner +local REACT_ELEMENT_TYPE = + require("@pkg/@jsdotlua/shared").ReactSymbols.REACT_ELEMENT_TYPE +local ReactCurrentOwner = + require("@pkg/@jsdotlua/shared").ReactSharedInternals.ReactCurrentOwner --local hasOwnProperty = Object.prototype.hasOwnProperty -- ROBLOX deviation START: upstream iterates over this table, but we manually unroll those loops for hot path performance -- IF THIS TABLE UPDATES, YOU MUST UPDATE THE UNROLLED LOOPS AS WELL diff --git a/modules/react/src/ReactElementValidator.lua b/modules/react/src/ReactElementValidator.lua index 1ec5df05..31a3050b 100644 --- a/modules/react/src/ReactElementValidator.lua +++ b/modules/react/src/ReactElementValidator.lua @@ -8,19 +8,18 @@ * @flow *]] -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array type Array = LuauPolyfill.Array local Boolean = LuauPolyfill.Boolean local Object = LuauPolyfill.Object type Object = LuauPolyfill.Object -local console = require(Packages.Shared).console +local console = require("@pkg/@jsdotlua/shared").console local inspect = LuauPolyfill.util.inspect type Function = (...any) -> ...any -- ROBLOX deviation START: import extra types -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") type React_StatelessFunctionalComponent

= ReactTypes.React_StatelessFunctionalComponent< P > @@ -32,9 +31,9 @@ type React_Node = ReactTypes.React_Node type Source = ReactTypes.Source -- ROBLOX deviation END -local isValidElementType = require(Packages.Shared).isValidElementType -local getComponentName = require(Packages.Shared).getComponentName -local ReactSymbols = require(Packages.Shared).ReactSymbols +local isValidElementType = require("@pkg/@jsdotlua/shared").isValidElementType +local getComponentName = require("@pkg/@jsdotlua/shared").getComponentName +local ReactSymbols = require("@pkg/@jsdotlua/shared").ReactSymbols local getIteratorFn = ReactSymbols.getIteratorFn local _REACT_FORWARD_REF_TYPE = ReactSymbols.REACT_FORWARD_REF_TYPE local _REACT_MEMO_TYPE = ReactSymbols.REACT_MEMO_TYPE @@ -42,20 +41,21 @@ local REACT_FRAGMENT_TYPE = ReactSymbols.REACT_FRAGMENT_TYPE local REACT_ELEMENT_TYPE = ReactSymbols.REACT_ELEMENT_TYPE local warnAboutSpreadingKeyToJSX = - require(Packages.Shared).ReactFeatureFlags.warnAboutSpreadingKeyToJSX -local checkPropTypes = require(Packages.Shared).checkPropTypes -local ReactCurrentOwner = require(Packages.Shared).ReactSharedInternals.ReactCurrentOwner + require("@pkg/@jsdotlua/shared").ReactFeatureFlags.warnAboutSpreadingKeyToJSX +local checkPropTypes = require("@pkg/@jsdotlua/shared").checkPropTypes +local ReactCurrentOwner = + require("@pkg/@jsdotlua/shared").ReactSharedInternals.ReactCurrentOwner -local ReactElement = require(script.Parent.ReactElement) +local ReactElement = require("./ReactElement") local isValidElement = ReactElement.isValidElement local createElement = ReactElement.createElement local cloneElement = ReactElement.cloneElement local jsxDEV = ReactElement.jsxDEV local setExtraStackFrame = - require(Packages.Shared).ReactSharedInternals.ReactDebugCurrentFrame.setExtraStackFrame + require("@pkg/@jsdotlua/shared").ReactSharedInternals.ReactDebugCurrentFrame.setExtraStackFrame local describeUnknownElementTypeFrameInDEV = - require(Packages.Shared).ReactComponentStackFrame.describeUnknownElementTypeFrameInDEV + require("@pkg/@jsdotlua/shared").ReactComponentStackFrame.describeUnknownElementTypeFrameInDEV local exports = {} diff --git a/modules/react/src/ReactForwardRef.lua b/modules/react/src/ReactForwardRef.lua index aca3f722..b8ec9562 100644 --- a/modules/react/src/ReactForwardRef.lua +++ b/modules/react/src/ReactForwardRef.lua @@ -7,12 +7,11 @@ * LICENSE file in the root directory of this source tree. *]] -local Packages = script.Parent.Parent -- ROBLOX: use patched console from shared -local console = require(Packages.Shared).console +local console = require("@pkg/@jsdotlua/shared").console -local ReactSymbols = require(Packages.Shared).ReactSymbols -local ReactTypes = require(Packages.Shared) +local ReactSymbols = require("@pkg/@jsdotlua/shared").ReactSymbols +local ReactTypes = require("@pkg/@jsdotlua/shared") type React_Node = ReactTypes.React_Node type React_Ref = ReactTypes.React_Ref type React_AbstractComponent = ReactTypes.React_AbstractComponent< diff --git a/modules/react/src/ReactHooks.lua b/modules/react/src/ReactHooks.lua index ebbb650e..af1f840b 100644 --- a/modules/react/src/ReactHooks.lua +++ b/modules/react/src/ReactHooks.lua @@ -9,14 +9,13 @@ * @flow ]] -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array type Array = LuauPolyfill.Array -- ROBLOX: use patched console from shared -local console = require(Packages.Shared).console +local console = require("@pkg/@jsdotlua/shared").console -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") -- ROBLOX TODO: we only pull in Dispatcher here for the typecheck, remove once Luau narrowing improves type Dispatcher = ReactTypes.Dispatcher type MutableSource = ReactTypes.MutableSource @@ -30,13 +29,13 @@ type MutableSourceSubscribeFn = ReactTypes.MutableSourceSubscr > type ReactProviderType = ReactTypes.ReactProviderType type ReactContext = ReactTypes.ReactContext -local ReactFiberHostConfig = require(Packages.Shared) +local ReactFiberHostConfig = require("@pkg/@jsdotlua/shared") type OpaqueIDType = ReactFiberHostConfig.OpaqueIDType --- local invariant = require(Packages.Shared).invariant +-- local invariant = require("@pkg/@jsdotlua/shared").invariant local ReactCurrentDispatcher = - require(Packages.Shared).ReactSharedInternals.ReactCurrentDispatcher + require("@pkg/@jsdotlua/shared").ReactSharedInternals.ReactCurrentDispatcher type BasicStateAction = ((S) -> S) | S type Dispatch = (A) -> () diff --git a/modules/react/src/ReactLazy.lua b/modules/react/src/ReactLazy.lua index 8278416e..fae79d34 100644 --- a/modules/react/src/ReactLazy.lua +++ b/modules/react/src/ReactLazy.lua @@ -9,17 +9,16 @@ * @flow *]] -local Packages = script.Parent.Parent -- ROBLOX: use patched console from shared -local Shared = require(Packages.Shared) +local Shared = require("@pkg/@jsdotlua/shared") local console = Shared.console -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local inspect = LuauPolyfill.util.inspect -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") type Wakeable = ReactTypes.Wakeable type Thenable = ReactTypes.Thenable -local ReactSymbols = require(Packages.Shared).ReactSymbols +local ReactSymbols = require("@pkg/@jsdotlua/shared").ReactSymbols local REACT_LAZY_TYPE = ReactSymbols.REACT_LAZY_TYPE diff --git a/modules/react/src/ReactMemo.lua b/modules/react/src/ReactMemo.lua index f0688faf..700ddec3 100644 --- a/modules/react/src/ReactMemo.lua +++ b/modules/react/src/ReactMemo.lua @@ -7,11 +7,10 @@ * LICENSE file in the root directory of this source tree. ]] -local Packages = script.Parent.Parent -- ROBLOX: use patched console from shared -local Shared = require(Packages.Shared) +local Shared = require("@pkg/@jsdotlua/shared") local console = Shared.console -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array local Object = LuauPolyfill.Object local inspect = LuauPolyfill.util.inspect diff --git a/modules/react/src/ReactMutableSource.lua b/modules/react/src/ReactMutableSource.lua index 81b7d334..5ae8f2d7 100644 --- a/modules/react/src/ReactMutableSource.lua +++ b/modules/react/src/ReactMutableSource.lua @@ -9,8 +9,7 @@ -- * @flow -- ]] -local Packages = script.Parent.Parent -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") type MutableSourceGetVersionFn = ReactTypes.MutableSourceGetVersionFn type MutableSource = ReactTypes.MutableSource diff --git a/modules/react/src/ReactNoopUpdateQueue.lua b/modules/react/src/ReactNoopUpdateQueue.lua index ccffc633..47c25524 100644 --- a/modules/react/src/ReactNoopUpdateQueue.lua +++ b/modules/react/src/ReactNoopUpdateQueue.lua @@ -6,9 +6,8 @@ * LICENSE file in the root directory of this source tree. ]] -local Packages = script.Parent.Parent -- ROBLOX: use patched console from shared -local console = require(Packages.Shared).console +local console = require("@pkg/@jsdotlua/shared").console local didWarnStateUpdateForUnmountedComponent = {} diff --git a/modules/react/src/__tests__/ReactBaseClasses.roblox.spec.lua b/modules/react/src/__tests__/ReactBaseClasses.roblox.spec.lua index 03e31193..31b097dd 100644 --- a/modules/react/src/__tests__/ReactBaseClasses.roblox.spec.lua +++ b/modules/react/src/__tests__/ReactBaseClasses.roblox.spec.lua @@ -1,7 +1,7 @@ --!strict local Packages = script.Parent.Parent.Parent -local ReactBaseClasses = require(script.Parent.Parent.ReactBaseClasses) -local JestGlobals = require(Packages.Dev.JestGlobals) +local ReactBaseClasses = require("./ReactBaseClasses") +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local describe = JestGlobals.describe local it = JestGlobals.it diff --git a/modules/react/src/__tests__/ReactBinding.spec.lua b/modules/react/src/__tests__/ReactBinding.spec.lua index ed8eb3cf..ea52ffa0 100644 --- a/modules/react/src/__tests__/ReactBinding.spec.lua +++ b/modules/react/src/__tests__/ReactBinding.spec.lua @@ -1,16 +1,15 @@ --!strict -local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local jest = JestGlobals.jest local describe = JestGlobals.describe local it = JestGlobals.it -local ReactTypes = require(Packages.Shared) +local ReactTypes = require("@pkg/@jsdotlua/shared") type Binding = ReactTypes.ReactBinding -local Binding = require(script.Parent.Parent["ReactBinding.roblox"]) -local ReactCreateRef = require(script.Parent.Parent.ReactCreateRef) +local Binding = require("../ReactBinding.roblox.lua") +local ReactCreateRef = require("../ReactCreateRef") describe("Binding.create", function() it("should return a Binding object and an update function", function() @@ -193,6 +192,7 @@ describe("Binding.join", function() local binding2 = Binding.create(2) local binding3 = Binding.create(3) + -- selene: allow(mixed_table) local joinedBinding = Binding.join({ binding1, binding2, @@ -212,6 +212,7 @@ describe("Binding.join", function() local binding2, update2 = Binding.create(2) local binding3, update3 = Binding.create(3) + -- selene: allow(mixed_table) local joinedBinding = Binding.join({ binding1, binding2, diff --git a/modules/react/src/__tests__/ReactChildren.spec.lua b/modules/react/src/__tests__/ReactChildren.spec.lua index 9ef69c2b..53af5dc2 100644 --- a/modules/react/src/__tests__/ReactChildren.spec.lua +++ b/modules/react/src/__tests__/ReactChildren.spec.lua @@ -10,7 +10,7 @@ * @emails react-core ]] local Packages = script.Parent.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array type Array = LuauPolyfill.Array type Object = LuauPolyfill.Object @@ -18,7 +18,7 @@ type Object = LuauPolyfill.Object local React local ReactTestUtils local ReactRoblox -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jest = JestGlobals.jest local expect = JestGlobals.expect local describe = JestGlobals.describe @@ -29,8 +29,8 @@ local xit = JestGlobals.xit describe("ReactChildren", function() beforeEach(function() jest.resetModules() - React = require(script.Parent.Parent) - ReactRoblox = require(Packages.Dev.ReactRoblox) + React = require(".") + ReactRoblox = require("@pkg/@jsdotlua/react-roblox") ReactTestUtils = { renderIntoDocument = function(element) local instance = Instance.new("Folder") diff --git a/modules/react/src/__tests__/ReactDeprecationWarnings-internal.spec.lua b/modules/react/src/__tests__/ReactDeprecationWarnings-internal.spec.lua index 99ff7baf..a61fb64e 100644 --- a/modules/react/src/__tests__/ReactDeprecationWarnings-internal.spec.lua +++ b/modules/react/src/__tests__/ReactDeprecationWarnings-internal.spec.lua @@ -5,7 +5,7 @@ local ReactNoop local Scheduler -- local JSXDEVRuntime local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local describe = JestGlobals.describe local jest = JestGlobals.jest @@ -17,10 +17,10 @@ local xit = JestGlobals.xit describe("ReactDeprecationWarnings", function() beforeEach(function() jest.resetModules() - React = require(script.Parent.Parent) - ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags - ReactNoop = require(Packages.Dev.ReactNoopRenderer) - Scheduler = require(Packages.Dev.Scheduler) + React = require(".") + ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags + ReactNoop = require("@pkg/@jsdotlua/react-noop-renderer") + Scheduler = require("@pkg/@jsdotlua/scheduler") -- if Boolean.toJSBoolean(__DEV__) then -- JSXDEVRuntime = require("react/jsx-dev-runtime") -- end diff --git a/modules/react/src/__tests__/ReactElement.roblox.spec.lua b/modules/react/src/__tests__/ReactElement.roblox.spec.lua index a5b2e3c2..6db5f2a5 100644 --- a/modules/react/src/__tests__/ReactElement.roblox.spec.lua +++ b/modules/react/src/__tests__/ReactElement.roblox.spec.lua @@ -2,13 +2,13 @@ -- ROBLOX upstream: https://github.com/facebook/react/blob/702fad4b1b48ac8f626ed3f35e8f86f5ea728084/packages/react/src/__tests__/ReactElement-test.js local Packages = script.Parent.Parent.Parent -local ReactElement = require(script.Parent.Parent.ReactElement) -local JestGlobals = require(Packages.Dev.JestGlobals) +local ReactElement = require("./ReactElement") +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local describe = JestGlobals.describe local it = JestGlobals.it -local isValidElementType = require(Packages.Shared).isValidElementType -local ReactSymbols = require(Packages.Shared).ReactSymbols +local isValidElementType = require("@pkg/@jsdotlua/shared").isValidElementType +local ReactSymbols = require("@pkg/@jsdotlua/shared").ReactSymbols local element describe("creates valid React elements", function() diff --git a/modules/react/src/__tests__/ReactElementValidator-internal.spec.lua b/modules/react/src/__tests__/ReactElementValidator-internal.spec.lua index c3809c88..b5a49653 100644 --- a/modules/react/src/__tests__/ReactElementValidator-internal.spec.lua +++ b/modules/react/src/__tests__/ReactElementValidator-internal.spec.lua @@ -7,7 +7,7 @@ * @emails react-core ]] local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local jest = JestGlobals.jest local describe = JestGlobals.describe @@ -38,10 +38,10 @@ describe("ReactElementValidator", function() jest.resetModules() -- PropTypes = require("prop-types") - ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags + ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags ReactFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback = false - React = require(script.Parent.Parent) - ReactRoblox = require(Packages.Dev.ReactRoblox) + React = require(".") + ReactRoblox = require("@pkg/@jsdotlua/react-roblox") -- ReactTestUtils = require("react-dom/test-utils") ComponentClass = React.Component:extend("ComponentClass") function ComponentClass:render() diff --git a/modules/react/src/__tests__/ReactProfiler-internal.spec.lua b/modules/react/src/__tests__/ReactProfiler-internal.spec.lua index 9505abd5..27897333 100644 --- a/modules/react/src/__tests__/ReactProfiler-internal.spec.lua +++ b/modules/react/src/__tests__/ReactProfiler-internal.spec.lua @@ -18,14 +18,14 @@ local Set local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local jest = JestGlobals.jest local describe = JestGlobals.describe local beforeEach = JestGlobals.beforeEach local it = JestGlobals.it -local Promise = require(Packages.Dev.Promise) +local Promise = require("@pkg/@jsdotlua/promise") local function loadModules(config) local enableProfilerTimer = (function() @@ -58,7 +58,7 @@ local function loadModules(config) end return false end)() - ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags + ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags ReactFeatureFlags.enableProfilerTimer = enableProfilerTimer ReactFeatureFlags.enableProfilerCommitHooks = enableProfilerCommitHooks @@ -66,22 +66,22 @@ local function loadModules(config) ReactFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback = replayFailedUnitOfWorkWithInvokeGuardedCallback - local LuauPolyfill = require(Packages.LuauPolyfill) + local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") setTimeout = LuauPolyfill.setTimeout Set = LuauPolyfill.Set - React = require(script.Parent.Parent) - Scheduler = require(Packages.Dev.Scheduler) + React = require("../init") + Scheduler = require("@pkg/@jsdotlua/scheduler") _SchedulerTracing = Scheduler.tracing - ReactCache = require(Packages.Dev.ReactCache) + ReactCache = require("@pkg/@jsdotlua/react-cache") if useNoopRenderer then - ReactNoop = require(Packages.Dev.ReactNoopRenderer) + ReactNoop = require("@pkg/@jsdotlua/react-noop-renderer") ReactTestRenderer = nil ReactTestRendererAct = nil else ReactNoop = nil - ReactTestRenderer = require(Packages.Dev.ReactTestRenderer) + ReactTestRenderer = require("@pkg/@jsdotlua/react-test-renderer") ReactTestRendererAct = ReactTestRenderer.unstable_concurrentAct end diff --git a/modules/react/src/__tests__/ReactProfilerDevToolsIntegration-internal.spec.lua b/modules/react/src/__tests__/ReactProfilerDevToolsIntegration-internal.spec.lua index 39d8d2d9..c4be1e76 100644 --- a/modules/react/src/__tests__/ReactProfilerDevToolsIntegration-internal.spec.lua +++ b/modules/react/src/__tests__/ReactProfilerDevToolsIntegration-internal.spec.lua @@ -2,9 +2,9 @@ local Packages = script.Parent.Parent.Parent local React local Scheduler -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Set = LuauPolyfill.Set -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local describe = JestGlobals.describe describe("ReactProfiler DevTools integration", function() @@ -32,14 +32,14 @@ describe("ReactProfiler DevTools integration", function() jest.resetModules() - ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags + ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags ReactFeatureFlags.enableProfilerTimer = true ReactFeatureFlags.enableSchedulerTracing = true - Scheduler = require(Packages.Dev.Scheduler) + Scheduler = require("@pkg/@jsdotlua/scheduler") -- ROBLOX deviation: import tracing from top-level Scheduler export to avoid direct file access SchedulerTracing = Scheduler.tracing - React = require(Packages.React) - ReactTestRenderer = require(Packages.Dev.ReactTestRenderer) + React = require("@pkg/@jsdotlua/react") + ReactTestRenderer = require("@pkg/@jsdotlua/react-test-renderer") AdvanceTime = React.Component:extend("AdvanceTime") AdvanceTime.defaultProps = { diff --git a/modules/react/src/__tests__/ReactStrictMode.spec.lua b/modules/react/src/__tests__/ReactStrictMode.spec.lua index 97b43a9f..deb4b894 100644 --- a/modules/react/src/__tests__/ReactStrictMode.spec.lua +++ b/modules/react/src/__tests__/ReactStrictMode.spec.lua @@ -14,7 +14,7 @@ local ReactNoop -- local ReactDOMServer local Scheduler -- local PropTypes -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jest = JestGlobals.jest local describe = JestGlobals.describe local beforeEach = JestGlobals.beforeEach @@ -30,15 +30,15 @@ describe("ReactStrictMode", function() jest.resetModules() -- ROBLOX deviation: workaround because our flag is currently always set to false - local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags + local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags ReactFeatureFlags.debugRenderPhaseSideEffectsForStrictMode = true - React = require(script.Parent.Parent) + React = require(".") -- ROBLOX deviation: using ReactNoop in place of ReactDOM - ReactNoop = require(Packages.Dev.ReactNoopRenderer) + ReactNoop = require("@pkg/@jsdotlua/react-noop-renderer") -- ReactDOM = require('react-dom') -- ReactDOMServer = require('react-dom/server') - Scheduler = require(Packages.Dev.Scheduler) + Scheduler = require("@pkg/@jsdotlua/scheduler") end) -- ROBLOX TODO: Untranslated ReactDOMInvalidARIAHook file throws the error this test checks -- xit('should appear in the client component stack', function() @@ -405,12 +405,12 @@ end) describe("Concurrent Mode", function() beforeEach(function() jest.resetModules() - React = require(script.Parent.Parent) + React = require(".") -- ROBLOX deviation: using ReactNoop in place of ReactDOM - ReactNoop = require(Packages.Dev.ReactNoopRenderer) + ReactNoop = require("@pkg/@jsdotlua/react-noop-renderer") -- ReactDOM = require('react-dom') -- ReactDOMServer = require('react-dom/server') - Scheduler = require(Packages.Dev.Scheduler) + Scheduler = require("@pkg/@jsdotlua/scheduler") end) it( "should warn about unsafe legacy lifecycle methods anywhere in the tree", @@ -663,12 +663,12 @@ end) describe("symbol checks", function() beforeEach(function() jest.resetModules() - React = require(script.Parent.Parent) + React = require(".") -- ROBLOX deviation: using ReactNoop in place of ReactDOM - ReactNoop = require(Packages.Dev.ReactNoopRenderer) + ReactNoop = require("@pkg/@jsdotlua/react-noop-renderer") -- ReactDOM = require('react-dom') -- ReactDOMServer = require('react-dom/server') - Scheduler = require(Packages.Dev.Scheduler) + Scheduler = require("@pkg/@jsdotlua/scheduler") end) it("should switch from StrictMode to a Fragment and reset state", function() local Fragment, StrictMode = React.Fragment, React.StrictMode @@ -821,12 +821,12 @@ end) describe("string refs", function() beforeEach(function() jest.resetModules() - React = require(script.Parent.Parent) + React = require(".") -- ROBLOX deviation: using ReactNoop in place of ReactDOM - ReactNoop = require(Packages.Dev.ReactNoopRenderer) + ReactNoop = require("@pkg/@jsdotlua/react-noop-renderer") -- ReactDOM = require('react-dom') -- ReactDOMServer = require('react-dom/server') - Scheduler = require(Packages.Dev.Scheduler) + Scheduler = require("@pkg/@jsdotlua/scheduler") end) xit("should warn within a strict tree", function() @@ -914,12 +914,12 @@ end) describe("context legacy", function() beforeEach(function() jest.resetModules() - React = require(script.Parent.Parent) + React = require(".") -- ROBLOX deviation: using ReactNoop in place of ReactDOM - ReactNoop = require(Packages.Dev.ReactNoopRenderer) + ReactNoop = require("@pkg/@jsdotlua/react-noop-renderer") -- ReactDOM = require('react-dom') -- ReactDOMServer = require('react-dom/server') - Scheduler = require(Packages.Dev.Scheduler) + Scheduler = require("@pkg/@jsdotlua/scheduler") -- PropTypes = require('prop-types') end) -- ROBLOX TODO: Proptypes diff --git a/modules/react/src/__tests__/ReactUpdates.spec.lua b/modules/react/src/__tests__/ReactUpdates.spec.lua index 2e14782a..70532602 100644 --- a/modules/react/src/__tests__/ReactUpdates.spec.lua +++ b/modules/react/src/__tests__/ReactUpdates.spec.lua @@ -8,7 +8,7 @@ -- * @emails react-core local Packages = script.Parent.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Array = LuauPolyfill.Array local Boolean = LuauPolyfill.Boolean local Error = LuauPolyfill.Error @@ -18,7 +18,7 @@ local ReactTestRenderer -- local ReactDOMServer local Scheduler -- local PropTypes -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jest = JestGlobals.jest local describe = JestGlobals.describe local beforeEach = JestGlobals.beforeEach @@ -36,16 +36,16 @@ describe("ReactUpdates", function() jest.resetModules() -- ROBLOX deviation: workaround because our flag is currently always set to false - local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags + local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags ReactFeatureFlags.debugRenderPhaseSideEffectsForStrictMode = true - React = require(script.Parent.Parent) + React = require(".") -- ROBLOX deviation: using React Test Renderer in place of ReactDOM - ReactTestRenderer = require(Packages.Dev.ReactTestRenderer) + ReactTestRenderer = require("@pkg/@jsdotlua/react-test-renderer") -- ReactDOM = require('react-dom') -- ReactDOMServer = require('react-dom/server') - Scheduler = require(Packages.Dev.Scheduler) + Scheduler = require("@pkg/@jsdotlua/scheduler") end) it("should batch state when updating state twice", function() diff --git a/modules/react/src/__tests__/SetStateInConstructor.roblox.spec.lua b/modules/react/src/__tests__/SetStateInConstructor.roblox.spec.lua index a8c5aecb..04e483ab 100644 --- a/modules/react/src/__tests__/SetStateInConstructor.roblox.spec.lua +++ b/modules/react/src/__tests__/SetStateInConstructor.roblox.spec.lua @@ -2,7 +2,7 @@ local Packages = script.Parent.Parent.Parent local React, Shared, ReactNoop -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jest = JestGlobals.jest local jestExpect = JestGlobals.expect local describe = JestGlobals.describe @@ -11,9 +11,9 @@ local beforeEach = JestGlobals.beforeEach beforeEach(function() jest.resetModules() - ReactNoop = require(Packages.Dev.ReactNoopRenderer) - React = require(script.Parent.Parent) - Shared = require(Packages.Shared) + ReactNoop = require("@pkg/@jsdotlua/react-noop-renderer") + React = require(".") + Shared = require("@pkg/@jsdotlua/shared") end) local function initTests(defineInitMethod: (any, string | number, any) -> (), name) diff --git a/modules/react/src/__tests__/createSignal.spec.lua b/modules/react/src/__tests__/createSignal.spec.lua index 1072a581..6ff03370 100644 --- a/modules/react/src/__tests__/createSignal.spec.lua +++ b/modules/react/src/__tests__/createSignal.spec.lua @@ -1,7 +1,6 @@ -local createSignal = require(script.Parent.Parent["createSignal.roblox"]) +local createSignal = require("../createSignal.roblox.lua") -local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local jest = JestGlobals.jest diff --git a/modules/react/src/__tests__/forwardRef-internal.spec.lua b/modules/react/src/__tests__/forwardRef-internal.spec.lua index ed66ac8b..0cec1762 100644 --- a/modules/react/src/__tests__/forwardRef-internal.spec.lua +++ b/modules/react/src/__tests__/forwardRef-internal.spec.lua @@ -11,13 +11,13 @@ --!nonstrict local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local jest = JestGlobals.jest local it = JestGlobals.it local beforeEach = JestGlobals.beforeEach -local Error = require(Packages.LuauPolyfill).Error -local LuauPolyfill = require(Packages.LuauPolyfill) +local Error = require("@pkg/@jsdotlua/luau-polyfill").Error +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Object = LuauPolyfill.Object local React @@ -27,12 +27,12 @@ local Scheduler beforeEach(function() jest.resetModules() - ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags + ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags ReactFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback = false - React = require(script.Parent.Parent) - ReactNoop = require(Packages.Dev.ReactNoopRenderer) - Scheduler = require(Packages.Dev.Scheduler) + React = require(".") + ReactNoop = require("@pkg/@jsdotlua/react-noop-renderer") + Scheduler = require("@pkg/@jsdotlua/scheduler") end) it("should work without a ref to be forwarded", function() diff --git a/modules/react/src/__tests__/forwardRef.spec.lua b/modules/react/src/__tests__/forwardRef.spec.lua index 3eaff423..c689df00 100644 --- a/modules/react/src/__tests__/forwardRef.spec.lua +++ b/modules/react/src/__tests__/forwardRef.spec.lua @@ -10,8 +10,7 @@ --!strict -- ROBLOX deviation: prompted by selene to add a type -local Packages = script.Parent.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Object = LuauPolyfill.Object type ComparisonTestsProps = { a: number?, @@ -19,7 +18,7 @@ type ComparisonTestsProps = { c: number?, } -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local jest = JestGlobals.jest local beforeEach = JestGlobals.beforeEach @@ -37,9 +36,9 @@ describe("forwardRef", function() jest.resetModules() -- PropTypes = require('prop-types') - React = require(Packages.React) - ReactNoop = require(Packages.Dev.ReactNoopRenderer) - Scheduler = require(Packages.Dev.Scheduler) + React = require("@pkg/@jsdotlua/react") + ReactNoop = require("@pkg/@jsdotlua/react-noop-renderer") + Scheduler = require("@pkg/@jsdotlua/scheduler") end) it("should update refs when switching between children", function() diff --git a/modules/react/src/init.lua b/modules/react/src/init.lua index 664fa82f..37a0f5a1 100644 --- a/modules/react/src/init.lua +++ b/modules/react/src/init.lua @@ -10,20 +10,19 @@ *]] -- ROBLOX deviation: simulates `index.js` and exports React's public interface -local Packages = script.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") type Object = LuauPolyfill.Object -local React = require(script.React) +local React = require("./React") -- ROBLOX deviation START: bindings support export type Binding = React.ReactBinding export type BindingUpdater = React.ReactBindingUpdater -- ROBLOX deviation END -local ReactLazy = require(script.ReactLazy) +local ReactLazy = require("./ReactLazy") export type LazyComponent = ReactLazy.LazyComponent -local SharedModule = require(Packages.Shared) +local SharedModule = require("@pkg/@jsdotlua/shared") export type StatelessFunctionalComponent

= SharedModule.React_StatelessFunctionalComponent

-- ROBLOX deviation START: we use the definitely-typed version of this, which appears to work for flowtype in VirtualizedList, etc diff --git a/modules/roact-compat/.npmignore b/modules/roact-compat/.npmignore new file mode 100644 index 00000000..835df8f5 --- /dev/null +++ b/modules/roact-compat/.npmignore @@ -0,0 +1,26 @@ +**/.robloxrc +rotriever.toml + +/roblox +/build + +.darklua* +.luau-analyze.json +.luaurc +default.project.json + +/globalTypes.d.lua +**/sourcemap.json +**/*.project.json + +**/__tests__ +**/*.test.lua +**/*.spec.lua +**/jest.config.lua + +**/*.rbxl +**/*.rbxlx +**/*.rbxl.lock +**/*.rbxlx.lock +**/*.rbxm +**/*.rbxmx diff --git a/modules/roact-compat/default.project.json b/modules/roact-compat/default.project.json index b3d3ce8d..c535cfc6 100644 --- a/modules/roact-compat/default.project.json +++ b/modules/roact-compat/default.project.json @@ -1,5 +1,5 @@ { - "name": "RoactCompat", + "name": "roact-compat", "tree": { "$path": "src" } diff --git a/modules/roact-compat/package.json b/modules/roact-compat/package.json new file mode 100644 index 00000000..0e00d722 --- /dev/null +++ b/modules/roact-compat/package.json @@ -0,0 +1,23 @@ +{ + "name": "@jsdotlua/roact-compat", + "version": "17.0.2", + "repository": { + "type": "git", + "url": "https://github.com/jsdotlua/react-lua.git", + "directory": "modules/roact-compat" + }, + "license": "MIT", + "main": "src/init.lua", + "scripts": { + "prepare": "npmluau" + }, + "dependencies": { + "@jsdotlua/luau-polyfill": "^1.2.6", + "@jsdotlua/react": "workspace:^", + "@jsdotlua/react-roblox": "workspace:^", + "@jsdotlua/shared": "workspace:^" + }, + "devDependencies": { + "npmluau": "^0.1.0" + } +} diff --git a/modules/roact-compat/src/Portal.lua b/modules/roact-compat/src/Portal.lua index 2fb0f93b..4cc99e2d 100644 --- a/modules/roact-compat/src/Portal.lua +++ b/modules/roact-compat/src/Portal.lua @@ -14,10 +14,9 @@ * limitations under the License. ]] -local Packages = script.Parent.Parent -local ReactRoblox = require(Packages.ReactRoblox) +local ReactRoblox = require("@pkg/@jsdotlua/react-roblox") -local warnOnce = require(script.Parent.warnOnce) +local warnOnce = require("./warnOnce") local function PortalComponent(props) if _G.__DEV__ and _G.__COMPAT_WARNINGS__ then diff --git a/modules/roact-compat/src/RoactTree.lua b/modules/roact-compat/src/RoactTree.lua index 421f880f..d408e1f7 100644 --- a/modules/roact-compat/src/RoactTree.lua +++ b/modules/roact-compat/src/RoactTree.lua @@ -13,13 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. ]] -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local inspect = LuauPolyfill.util.inspect -local ReactRoblox = require(Packages.ReactRoblox) +local ReactRoblox = require("@pkg/@jsdotlua/react-roblox") type RootType = ReactRoblox.RootType -local warnOnce = require(script.Parent.warnOnce) +local warnOnce = require("./warnOnce") type RoactHandle = { root: RootType, diff --git a/modules/roact-compat/src/__tests__/RoactCompatibility.spec.lua b/modules/roact-compat/src/__tests__/RoactCompatibility.spec.lua index 907e5f24..9a2576fa 100644 --- a/modules/roact-compat/src/__tests__/RoactCompatibility.spec.lua +++ b/modules/roact-compat/src/__tests__/RoactCompatibility.spec.lua @@ -15,7 +15,7 @@ local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local beforeEach = JestGlobals.beforeEach local jestExpect = JestGlobals.expect local describe = JestGlobals.describe @@ -34,8 +34,8 @@ local UNSUPPORTED = { } beforeEach(function() jest.resetModules() - Roact = require(Packages.Dev.Roact) - RoactCompat = require(script.Parent.Parent) + Roact = require("@dev-packages/Roact") + RoactCompat = require(".") end) it("has all interface members that old Roact exposes", function() @@ -103,7 +103,7 @@ describe("warns about deprecated Roact API features", function() end) it("warns about Roact.Portal", function() - local ReactRoblox = require(Packages.ReactRoblox) + local ReactRoblox = require("@pkg/@jsdotlua/react-roblox") local target = Instance.new("Folder") local function withPortal(_props) return RoactCompat.createElement(RoactCompat.Portal, { @@ -198,8 +198,8 @@ end) describe("handles uninitialized state", function() it("errors if uninitialized state is assigned", function() - local ReactRoblox = require(Packages.ReactRoblox) - local Scheduler = require(Packages.Dev.Scheduler) + local ReactRoblox = require("@pkg/@jsdotlua/react-roblox") + local Scheduler = require("@pkg/@jsdotlua/scheduler") local parent = Instance.new("Folder") local Component = RoactCompat.Component:extend("Component") @@ -219,9 +219,9 @@ describe("handles uninitialized state", function() end) it("warns if uninitialized state is accessed", function() - local ReactRoblox = require(Packages.ReactRoblox) + local ReactRoblox = require("@pkg/@jsdotlua/react-roblox") local parent = Instance.new("Folder") - local Scheduler = require(Packages.Dev.Scheduler) + local Scheduler = require("@pkg/@jsdotlua/scheduler") local Component = RoactCompat.Component:extend("Component") local capturedBool = false @@ -248,9 +248,9 @@ end) describe("ChildArray Keys", function() it("Shozuld assign keys to children in an array", function() - local ReactRoblox = require(Packages.ReactRoblox) + local ReactRoblox = require("@pkg/@jsdotlua/react-roblox") local parent = Instance.new("Folder") - local Scheduler = require(Packages.Dev.Scheduler) + local Scheduler = require("@pkg/@jsdotlua/scheduler") local Component = RoactCompat.Component:extend("Component") function Component:render() diff --git a/modules/roact-compat/src/__tests__/RoactRecursiveLayoutPcallDepth.spec.lua b/modules/roact-compat/src/__tests__/RoactRecursiveLayoutPcallDepth.spec.lua index 13c9afd8..4491b85f 100644 --- a/modules/roact-compat/src/__tests__/RoactRecursiveLayoutPcallDepth.spec.lua +++ b/modules/roact-compat/src/__tests__/RoactRecursiveLayoutPcallDepth.spec.lua @@ -16,7 +16,7 @@ local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local beforeEach = JestGlobals.beforeEach local jestExpect = JestGlobals.expect local describe = JestGlobals.describe @@ -29,10 +29,10 @@ local Scheduler beforeEach(function() jest.resetModules() - RoactCompat = require(script.Parent.Parent) - ReactRoblox = require(Packages.ReactRoblox) - Scheduler = require(Packages.Dev.Scheduler) - React = require(Packages.React) + RoactCompat = require(".") + ReactRoblox = require("@pkg/@jsdotlua/react-roblox") + Scheduler = require("@pkg/@jsdotlua/scheduler") + React = require("@pkg/@jsdotlua/react") end) describe("pcall depth", function() diff --git a/modules/roact-compat/src/__tests__/RoactTree.spec.lua b/modules/roact-compat/src/__tests__/RoactTree.spec.lua index 37bad6b7..0d8fb8b1 100644 --- a/modules/roact-compat/src/__tests__/RoactTree.spec.lua +++ b/modules/roact-compat/src/__tests__/RoactTree.spec.lua @@ -14,7 +14,7 @@ ]] local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local afterEach = JestGlobals.afterEach local beforeEach = JestGlobals.beforeEach local jestExpect = JestGlobals.expect @@ -43,8 +43,8 @@ describe("Concurrent root (default behavior)", function() _G.__ROACT_17_INLINE_ACT__ = true _G.__ROACT_17_MOCK_SCHEDULER__ = true jest.resetModules() - Roact = require(Packages.Dev.Roact) - RoactCompat = require(script.Parent.Parent) + Roact = require("@dev-packages/Roact") + RoactCompat = require(".") end) afterEach(function() @@ -147,8 +147,8 @@ describe("Legacy root", function() previousGlobalValue = _G.__ROACT_17_COMPAT_LEGACY_ROOT__ _G.__ROACT_17_COMPAT_LEGACY_ROOT__ = true jest.resetModules() - Roact = require(Packages.Dev.Roact) - RoactCompat = require(script.Parent.Parent) + Roact = require("@dev-packages/Roact") + RoactCompat = require(".") end) afterEach(function() diff --git a/modules/roact-compat/src/__tests__/act.spec.lua b/modules/roact-compat/src/__tests__/act.spec.lua index c7b39d94..a00b740a 100644 --- a/modules/roact-compat/src/__tests__/act.spec.lua +++ b/modules/roact-compat/src/__tests__/act.spec.lua @@ -15,7 +15,7 @@ local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local afterEach = JestGlobals.afterEach local beforeEach = JestGlobals.beforeEach local jestExpect = JestGlobals.expect @@ -30,12 +30,12 @@ describe("production mode", function() prevMockScheduler = _G.__ROACT_17_MOCK_SCHEDULER__ _G.__ROACT_17_MOCK_SCHEDULER__ = nil jest.resetModules() - RoactCompat = require(script.Parent.Parent) + RoactCompat = require(".") end) it("disallows use of 'act'", function() jest.resetModules() - RoactCompat = require(script.Parent.Parent) + RoactCompat = require(".") jestExpect(function() RoactCompat.act(function() @@ -59,12 +59,12 @@ describe("test mode", function() prevMockScheduler = _G.__ROACT_17_MOCK_SCHEDULER__ _G.__ROACT_17_MOCK_SCHEDULER__ = true jest.resetModules() - RoactCompat = require(script.Parent.Parent) + RoactCompat = require(".") end) it("allows use of 'act'", function() jest.resetModules() - RoactCompat = require(script.Parent.Parent) + RoactCompat = require(".") local parent = Instance.new("Folder") local tree diff --git a/modules/roact-compat/src/__tests__/warnOnce.spec.lua b/modules/roact-compat/src/__tests__/warnOnce.spec.lua index 8ce6283f..d7650e2c 100644 --- a/modules/roact-compat/src/__tests__/warnOnce.spec.lua +++ b/modules/roact-compat/src/__tests__/warnOnce.spec.lua @@ -16,7 +16,7 @@ local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local beforeEach = JestGlobals.beforeEach local jestExpect = JestGlobals.expect local it = JestGlobals.it @@ -25,7 +25,7 @@ local warnOnce beforeEach(function() jest.resetModules() - warnOnce = require(script.Parent.Parent.warnOnce) + warnOnce = require("./warnOnce") end) it("warns exactly once", function() diff --git a/modules/roact-compat/src/createFragment.lua b/modules/roact-compat/src/createFragment.lua index 9e31cf5e..dc579962 100644 --- a/modules/roact-compat/src/createFragment.lua +++ b/modules/roact-compat/src/createFragment.lua @@ -13,10 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. ]] -local Packages = script.Parent.Parent -local React = require(Packages.React) +local React = require("@pkg/@jsdotlua/react") -local warnOnce = require(script.Parent.warnOnce) +local warnOnce = require("./warnOnce") return function(elements) if _G.__DEV__ and _G.__COMPAT_WARNINGS__ then diff --git a/modules/roact-compat/src/init.lua b/modules/roact-compat/src/init.lua index 283b582f..dd42d5f5 100644 --- a/modules/roact-compat/src/init.lua +++ b/modules/roact-compat/src/init.lua @@ -13,13 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. ]] -local Packages = script.Parent +local React = require("@pkg/@jsdotlua/react") +local ReactRoblox = require("@pkg/@jsdotlua/react-roblox") +local Shared = require("@pkg/@jsdotlua/shared") -local React = require(Packages.React) -local ReactRoblox = require(Packages.ReactRoblox) -local Shared = require(Packages.Shared) - -local RoactTree = require(script.RoactTree) +local RoactTree = require("./RoactTree") return { -- Overlapping contents of public `React` interface @@ -40,10 +38,10 @@ return { unmount = RoactTree.unmount, -- API compatibility layers to accommodate old interfaces - createFragment = require(script.createFragment), - oneChild = require(script.oneChild), - setGlobalConfig = require(script.setGlobalConfig), - Portal = require(script.Portal), + createFragment = require("./createFragment"), + oneChild = require("./oneChild"), + setGlobalConfig = require("./setGlobalConfig"), + Portal = require("./Portal"), -- Compatibility layer for special symbol keys which will be replaced with -- reserved prop names in Roact 17 diff --git a/modules/roact-compat/src/oneChild.lua b/modules/roact-compat/src/oneChild.lua index 6b11a5a9..9943bded 100644 --- a/modules/roact-compat/src/oneChild.lua +++ b/modules/roact-compat/src/oneChild.lua @@ -13,10 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. ]] -local Packages = script.Parent.Parent -local React = require(Packages.React) +local React = require("@pkg/@jsdotlua/react") -local warnOnce = require(script.Parent.warnOnce) +local warnOnce = require("./warnOnce") local function oneChild(children) if _G.__DEV__ and _G.__COMPAT_WARNINGS__ then diff --git a/modules/roact-compat/src/setGlobalConfig.lua b/modules/roact-compat/src/setGlobalConfig.lua index 999af31e..4b2e2824 100644 --- a/modules/roact-compat/src/setGlobalConfig.lua +++ b/modules/roact-compat/src/setGlobalConfig.lua @@ -14,7 +14,7 @@ * limitations under the License. ]] -local warnOnce = require(script.Parent.warnOnce) +local warnOnce = require("./warnOnce") return function(_config) if _G.__DEV__ and _G.__COMPAT_WARNINGS__ then diff --git a/modules/roact-compat/src/warnOnce.lua b/modules/roact-compat/src/warnOnce.lua index f3adf72f..bb0045e2 100644 --- a/modules/roact-compat/src/warnOnce.lua +++ b/modules/roact-compat/src/warnOnce.lua @@ -14,8 +14,7 @@ * limitations under the License. ]] -local Packages = script.Parent.Parent -local console = require(Packages.Shared).console +local console = require("@pkg/@jsdotlua/shared").console local warnedAbout = {} diff --git a/modules/scheduler/.npmignore b/modules/scheduler/.npmignore new file mode 100644 index 00000000..835df8f5 --- /dev/null +++ b/modules/scheduler/.npmignore @@ -0,0 +1,26 @@ +**/.robloxrc +rotriever.toml + +/roblox +/build + +.darklua* +.luau-analyze.json +.luaurc +default.project.json + +/globalTypes.d.lua +**/sourcemap.json +**/*.project.json + +**/__tests__ +**/*.test.lua +**/*.spec.lua +**/jest.config.lua + +**/*.rbxl +**/*.rbxlx +**/*.rbxl.lock +**/*.rbxlx.lock +**/*.rbxm +**/*.rbxmx diff --git a/modules/scheduler/default.project.json b/modules/scheduler/default.project.json index 71de8d76..76cac336 100644 --- a/modules/scheduler/default.project.json +++ b/modules/scheduler/default.project.json @@ -1,5 +1,5 @@ { - "name": "Scheduler", + "name": "scheduler", "tree": { "$path": "src" } diff --git a/modules/scheduler/package.json b/modules/scheduler/package.json new file mode 100644 index 00000000..5dbff9e0 --- /dev/null +++ b/modules/scheduler/package.json @@ -0,0 +1,21 @@ +{ + "name": "@jsdotlua/scheduler", + "version": "17.0.2", + "repository": { + "type": "git", + "url": "https://github.com/jsdotlua/react-lua.git", + "directory": "modules/scheduler" + }, + "license": "MIT", + "main": "src/init.lua", + "scripts": { + "prepare": "npmluau" + }, + "dependencies": { + "@jsdotlua/luau-polyfill": "^1.2.6", + "@jsdotlua/shared": "workspace:^" + }, + "devDependencies": { + "npmluau": "^0.1.0" + } +} diff --git a/modules/scheduler/src/Scheduler.lua b/modules/scheduler/src/Scheduler.lua index 46b31c09..31c2c01f 100644 --- a/modules/scheduler/src/Scheduler.lua +++ b/modules/scheduler/src/Scheduler.lua @@ -10,14 +10,13 @@ -- ROBLOX deviation: return an initializer function instead of the module itself -- for easier dependency injection with unstable_mock return function(hostConfig) - local Packages = script.Parent.Parent - local describeError = require(Packages.Shared).describeError + local describeError = require("@pkg/@jsdotlua/shared").describeError - local SchedulerFeatureFlags = require(script.Parent.SchedulerFeatureFlags) + local SchedulerFeatureFlags = require("./SchedulerFeatureFlags") local enableSchedulerDebugging = SchedulerFeatureFlags.enableSchedulerDebugging local enableProfiling = SchedulerFeatureFlags.enableProfiling - local SchedulerHostConfig = hostConfig or require(script.Parent.SchedulerHostConfig) + local SchedulerHostConfig = hostConfig or require("./SchedulerHostConfig") local requestHostCallback = SchedulerHostConfig.requestHostCallback local requestHostTimeout = SchedulerHostConfig.requestHostTimeout local cancelHostTimeout = SchedulerHostConfig.cancelHostTimeout @@ -27,7 +26,7 @@ return function(hostConfig) local requestPaint = SchedulerHostConfig.requestPaint -- ROBLOX deviation? inline the MinHeap to see if the module-level visibility lets Luau optimize better - -- local SchedulerMinHeap = require(script.Parent.SchedulerMinHeap) + -- local SchedulerMinHeap = require("./SchedulerMinHeap") -- local push = SchedulerMinHeap.push -- local peek = SchedulerMinHeap.peek -- local pop = SchedulerMinHeap.pop @@ -125,14 +124,14 @@ return function(hostConfig) end -- TODO: Use symbols? - local SchedulerPriorities = require(script.Parent.SchedulerPriorities) + local SchedulerPriorities = require("./SchedulerPriorities") local ImmediatePriority = SchedulerPriorities.ImmediatePriority local UserBlockingPriority = SchedulerPriorities.UserBlockingPriority local NormalPriority = SchedulerPriorities.NormalPriority local LowPriority = SchedulerPriorities.LowPriority local IdlePriority = SchedulerPriorities.IdlePriority - local SchedulerProfiling = require(script.Parent.SchedulerProfiling) + local SchedulerProfiling = require("./SchedulerProfiling") local markTaskRun = SchedulerProfiling.markTaskRun local markTaskYield = SchedulerProfiling.markTaskYield local markTaskCompleted = SchedulerProfiling.markTaskCompleted diff --git a/modules/scheduler/src/SchedulerHostConfig.lua b/modules/scheduler/src/SchedulerHostConfig.lua index 518b5204..e7e44000 100644 --- a/modules/scheduler/src/SchedulerHostConfig.lua +++ b/modules/scheduler/src/SchedulerHostConfig.lua @@ -12,4 +12,4 @@ -- deviation: In React, this module throws an error and is expected to be -- replaced via a bundler. In our case, we mock it explicitly when we need to -- mock it, and return the "default" here -return require(script.Parent.forks["SchedulerHostConfig.default"]) +return require("./forks/SchedulerHostConfig.default.lua") diff --git a/modules/scheduler/src/SchedulerProfiling.lua b/modules/scheduler/src/SchedulerProfiling.lua index 5adfaa68..0b4f033e 100644 --- a/modules/scheduler/src/SchedulerProfiling.lua +++ b/modules/scheduler/src/SchedulerProfiling.lua @@ -8,15 +8,14 @@ * ]] -- ROBLOX NOTE: this file is synced against a post-17.0.1 version that doesn't use SharedArrayBuffer -local Packages = script.Parent.Parent -- ROBLOX: use patched console from shared -local console = require(Packages.Shared).console +local console = require("@pkg/@jsdotlua/shared").console local exports = {} -local SchedulerPriorities = require(script.Parent.SchedulerPriorities) +local SchedulerPriorities = require("./SchedulerPriorities") type PriorityLevel = SchedulerPriorities.PriorityLevel -local ScheduleFeatureFlags = require(script.Parent.SchedulerFeatureFlags) +local ScheduleFeatureFlags = require("./SchedulerFeatureFlags") local enableProfiling = ScheduleFeatureFlags.enableProfiling local runIdCounter: number = 0 diff --git a/modules/scheduler/src/Tracing.lua b/modules/scheduler/src/Tracing.lua index eb7315db..8de14e85 100644 --- a/modules/scheduler/src/Tracing.lua +++ b/modules/scheduler/src/Tracing.lua @@ -10,13 +10,12 @@ -- */ type Function = (any) -> any -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") type Set = LuauPolyfill.Set local Set = LuauPolyfill.Set local exports = {} -local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags +local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags local enableSchedulerTracing = ReactFeatureFlags.enableSchedulerTracing export type Interaction = { diff --git a/modules/scheduler/src/TracingSubscriptions.lua b/modules/scheduler/src/TracingSubscriptions.lua index f8c2feb0..cc371c5f 100644 --- a/modules/scheduler/src/TracingSubscriptions.lua +++ b/modules/scheduler/src/TracingSubscriptions.lua @@ -10,14 +10,13 @@ type Set = { [T]: boolean? } type Array = { [number]: T } local exports = {} -local Packages = script.Parent.Parent -local Object = require(Packages.LuauPolyfill).Object +local Object = require("@pkg/@jsdotlua/luau-polyfill").Object -local Tracing = require(script.Parent.Tracing) +local Tracing = require("./Tracing") type Interaction = Tracing.Interaction type Subscriber = Tracing.Subscriber -local ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags +local ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags local enableSchedulerTracing = ReactFeatureFlags.enableSchedulerTracing local __subscriberRef = Tracing.__subscriberRef diff --git a/modules/scheduler/src/__tests__/Scheduler.spec.lua b/modules/scheduler/src/__tests__/Scheduler.spec.lua index 5800414a..af7fc0b7 100644 --- a/modules/scheduler/src/__tests__/Scheduler.spec.lua +++ b/modules/scheduler/src/__tests__/Scheduler.spec.lua @@ -9,9 +9,9 @@ ]] local Packages = script.Parent.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Error = LuauPolyfill.Error -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local beforeEach = JestGlobals.beforeEach local jestExpect = JestGlobals.expect local describe = JestGlobals.describe @@ -53,7 +53,7 @@ beforeEach(function() -- unstable_mock depends on the real Scheduler, and our mock -- functionality isn't smart enough to prevent self-requires, we simply -- require the mock entry point directly for use in tests - Scheduler = require(script.Parent.Parent.unstable_mock) + Scheduler = require("./unstable_mock") runWithPriority = Scheduler.unstable_runWithPriority ImmediatePriority = Scheduler.unstable_ImmediatePriority diff --git a/modules/scheduler/src/__tests__/SchedulerMinHeap.roblox.spec.lua b/modules/scheduler/src/__tests__/SchedulerMinHeap.roblox.spec.lua index 4355e9fc..d7c10aa1 100644 --- a/modules/scheduler/src/__tests__/SchedulerMinHeap.roblox.spec.lua +++ b/modules/scheduler/src/__tests__/SchedulerMinHeap.roblox.spec.lua @@ -1,9 +1,9 @@ local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local describe = JestGlobals.describe local it = JestGlobals.it -local Heap = require(script.Parent.Parent.SchedulerMinHeap) +local Heap = require("./SchedulerMinHeap") local function verifyOrder(heap) for pos = 2, #heap do diff --git a/modules/scheduler/src/__tests__/SchedulerNoDOM.spec.lua b/modules/scheduler/src/__tests__/SchedulerNoDOM.spec.lua index 98d2120a..65a028ec 100644 --- a/modules/scheduler/src/__tests__/SchedulerNoDOM.spec.lua +++ b/modules/scheduler/src/__tests__/SchedulerNoDOM.spec.lua @@ -9,7 +9,7 @@ ]] local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local beforeEach = JestGlobals.beforeEach local jestExpect = JestGlobals.expect local it = JestGlobals.it @@ -23,7 +23,7 @@ local NormalPriority beforeEach(function() jest.resetModules() jest.useFakeTimers() - local Scheduler = require(script.Parent.Parent.Scheduler)() + local Scheduler = require("./Scheduler")() scheduleCallback = Scheduler.unstable_scheduleCallback ImmediatePriority = Scheduler.unstable_ImmediatePriority diff --git a/modules/scheduler/src/__tests__/SchedulerProfiling.spec.lua b/modules/scheduler/src/__tests__/SchedulerProfiling.spec.lua index 7f1a3481..9863d965 100644 --- a/modules/scheduler/src/__tests__/SchedulerProfiling.spec.lua +++ b/modules/scheduler/src/__tests__/SchedulerProfiling.spec.lua @@ -9,7 +9,7 @@ *]] local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local beforeEach = JestGlobals.beforeEach local jestExpect = JestGlobals.expect local describe = JestGlobals.describe @@ -42,24 +42,24 @@ local function priorityLevelToString(priorityLevel) end describe("Scheduler", function() it("profiling APIs are not available", function() - local SchedulerFeatureFlags = require(script.Parent.Parent.SchedulerFeatureFlags) + local SchedulerFeatureFlags = require("./SchedulerFeatureFlags") SchedulerFeatureFlags.enableProfiling = false - Scheduler = require(script.Parent.Parent.Scheduler)() + Scheduler = require("./Scheduler")() jestExpect(Scheduler.unstable_Profiling).toBe(nil) end) beforeEach(function() jest.resetModules() jest.useFakeTimers() - local SchedulerFeatureFlags = require(script.Parent.Parent.SchedulerFeatureFlags) + local SchedulerFeatureFlags = require("./SchedulerFeatureFlags") SchedulerFeatureFlags.enableProfiling = true -- ROBLOX deviation: In react, jest mocks Scheduler -> unstable_mock since -- unstable_mock depends on the real Scheduler, and our mock -- functionality isn't smart enough to prevent self-requires, we simply -- require the mock entry point directly for use in tests - Scheduler = require(script.Parent.Parent.unstable_mock) + Scheduler = require("./unstable_mock") ImmediatePriority = Scheduler.unstable_ImmediatePriority UserBlockingPriority = Scheduler.unstable_UserBlockingPriority NormalPriority = Scheduler.unstable_NormalPriority diff --git a/modules/scheduler/src/__tests__/Tracing-internal.spec.lua b/modules/scheduler/src/__tests__/Tracing-internal.spec.lua index 103fd0ca..6ae71081 100644 --- a/modules/scheduler/src/__tests__/Tracing-internal.spec.lua +++ b/modules/scheduler/src/__tests__/Tracing-internal.spec.lua @@ -9,13 +9,13 @@ -- */ local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local beforeEach = JestGlobals.beforeEach local jestExpect = JestGlobals.expect local describe = JestGlobals.describe local it = JestGlobals.it local jest = JestGlobals.jest -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Set = LuauPolyfill.Set describe("Tracing", function() @@ -34,10 +34,10 @@ describe("Tracing", function() advanceTimeBy = jest.advanceTimersByTime - ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags + ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags ReactFeatureFlags.enableSchedulerTracing = enableSchedulerTracing - SchedulerTracing = require(Packages.Scheduler).tracing + SchedulerTracing = require("@pkg/@jsdotlua/scheduler").tracing end describe("enableSchedulerTracing enabled", function() diff --git a/modules/scheduler/src/__tests__/Tracing.spec.lua b/modules/scheduler/src/__tests__/Tracing.spec.lua index d2997e23..af427c30 100644 --- a/modules/scheduler/src/__tests__/Tracing.spec.lua +++ b/modules/scheduler/src/__tests__/Tracing.spec.lua @@ -9,14 +9,14 @@ -- */ local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local beforeEach = JestGlobals.beforeEach local describe = JestGlobals.describe local it = JestGlobals.it local jest = JestGlobals.jest describe("Tracing", function() - local JestGlobals = require(Packages.Dev.JestGlobals) + local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local SchedulerTracing @@ -24,7 +24,7 @@ describe("Tracing", function() beforeEach(function() jest.resetModules() - SchedulerTracing = require(Packages.Scheduler).tracing + SchedulerTracing = require("@pkg/@jsdotlua/scheduler").tracing end) it("should return the value of a traced function", function() diff --git a/modules/scheduler/src/__tests__/TracingSubscriptions-internal.spec.lua b/modules/scheduler/src/__tests__/TracingSubscriptions-internal.spec.lua index 73476a19..3c1c6b32 100644 --- a/modules/scheduler/src/__tests__/TracingSubscriptions-internal.spec.lua +++ b/modules/scheduler/src/__tests__/TracingSubscriptions-internal.spec.lua @@ -9,13 +9,13 @@ -- */ local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local beforeEach = JestGlobals.beforeEach local jestExpect = JestGlobals.expect local describe = JestGlobals.describe local it = JestGlobals.it local jest = JestGlobals.jest -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Set = LuauPolyfill.Set describe("TracingSubscriptions", function() @@ -53,10 +53,10 @@ describe("TracingSubscriptions", function() currentTime = 0 - ReactFeatureFlags = require(Packages.Shared).ReactFeatureFlags + ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags ReactFeatureFlags.enableSchedulerTracing = enableSchedulerTracing - SchedulerTracing = require(Packages.Scheduler).tracing + SchedulerTracing = require("@pkg/@jsdotlua/scheduler").tracing throwInOnInteractionScheduledWorkCompleted = false throwInOnInteractionTraced = false diff --git a/modules/scheduler/src/forks/SchedulerHostConfig.default.lua b/modules/scheduler/src/forks/SchedulerHostConfig.default.lua index d4da9552..26975b12 100644 --- a/modules/scheduler/src/forks/SchedulerHostConfig.default.lua +++ b/modules/scheduler/src/forks/SchedulerHostConfig.default.lua @@ -7,11 +7,10 @@ * LICENSE file in the root directory of this source tree. ]] -local Packages = script.Parent.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") type Error = LuauPolyfill.Error local Object = LuauPolyfill.Object -local Shared = require(Packages.Shared) +local Shared = require("@pkg/@jsdotlua/shared") local console = Shared.console local errorToString = Shared.errorToString local describeError = Shared.describeError diff --git a/modules/scheduler/src/forks/SchedulerHostConfig.mock.lua b/modules/scheduler/src/forks/SchedulerHostConfig.mock.lua index a90c5c85..5c3d2708 100644 --- a/modules/scheduler/src/forks/SchedulerHostConfig.mock.lua +++ b/modules/scheduler/src/forks/SchedulerHostConfig.mock.lua @@ -20,9 +20,8 @@ local didStop: boolean = false local isFlushing: boolean = false local needsPaint: boolean = false local shouldYieldForPaint: boolean = false -local Packages = script.Parent.Parent.Parent -local console = require(Packages.Shared).console -local ConsolePatchingDev = require(Packages.Shared).ConsolePatchingDev +local console = require("@pkg/@jsdotlua/shared").console +local ConsolePatchingDev = require("@pkg/@jsdotlua/shared").ConsolePatchingDev local disabledLog = ConsolePatchingDev.disabledLog exports.requestHostCallback = function(callback: (boolean) -> ()) diff --git a/modules/scheduler/src/init.lua b/modules/scheduler/src/init.lua index f674bf47..6f0a0be1 100644 --- a/modules/scheduler/src/init.lua +++ b/modules/scheduler/src/init.lua @@ -9,7 +9,7 @@ * @flow ]] -local initializeScheduler = require(script.Scheduler) +local initializeScheduler = require("./Scheduler") local function onlyInTestError(functionName: string) return function() @@ -18,8 +18,8 @@ local function onlyInTestError(functionName: string) end local Scheduler = initializeScheduler(nil --[[ no host config, use default ]]) -local Tracing = require(script.Tracing) -local TracingSubscriptions = require(script.TracingSubscriptions) +local Tracing = require("./Tracing") +local TracingSubscriptions = require("./TracingSubscriptions") -- ROBLOX deviation export Tracing type from the package exports to avoid direct file access export type Interaction = Tracing.Interaction @@ -28,7 +28,7 @@ export type Interaction = Tracing.Interaction -- library _before_ we bootstrap tests, we expose an additional global to toggle -- this explicilty if _G.__ROACT_17_MOCK_SCHEDULER__ then - return require(script.unstable_mock) + return require("./unstable_mock") end local exports = { diff --git a/modules/scheduler/src/unstable_mock.lua b/modules/scheduler/src/unstable_mock.lua index 673e245b..96420dcf 100644 --- a/modules/scheduler/src/unstable_mock.lua +++ b/modules/scheduler/src/unstable_mock.lua @@ -5,13 +5,13 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. *]] -local Tracing = require(script.Parent.Tracing) -local TracingSubscriptions = require(script.Parent.TracingSubscriptions) +local Tracing = require("./Tracing") +local TracingSubscriptions = require("./TracingSubscriptions") -- ROBLOX deviation: export Tracing type from the package exports to avoid direct file access export type Interaction = Tracing.Interaction -local initializeScheduler = require(script.Parent.Scheduler) -local HostConfig = require(script.Parent.forks["SchedulerHostConfig.mock"]) +local initializeScheduler = require("./Scheduler") +local HostConfig = require("./forks/SchedulerHostConfig.mock.lua") local Scheduler = initializeScheduler(HostConfig) diff --git a/modules/shared/.npmignore b/modules/shared/.npmignore new file mode 100644 index 00000000..835df8f5 --- /dev/null +++ b/modules/shared/.npmignore @@ -0,0 +1,26 @@ +**/.robloxrc +rotriever.toml + +/roblox +/build + +.darklua* +.luau-analyze.json +.luaurc +default.project.json + +/globalTypes.d.lua +**/sourcemap.json +**/*.project.json + +**/__tests__ +**/*.test.lua +**/*.spec.lua +**/jest.config.lua + +**/*.rbxl +**/*.rbxlx +**/*.rbxl.lock +**/*.rbxlx.lock +**/*.rbxm +**/*.rbxmx diff --git a/modules/shared/default.project.json b/modules/shared/default.project.json index 92f75eec..749162cf 100644 --- a/modules/shared/default.project.json +++ b/modules/shared/default.project.json @@ -1,5 +1,5 @@ { - "name": "Shared", + "name": "shared", "tree": { "$path": "src" } diff --git a/modules/shared/package.json b/modules/shared/package.json new file mode 100644 index 00000000..33962ff0 --- /dev/null +++ b/modules/shared/package.json @@ -0,0 +1,20 @@ +{ + "name": "@jsdotlua/shared", + "version": "17.0.2", + "repository": { + "type": "git", + "url": "https://github.com/jsdotlua/react-lua.git", + "directory": "modules/shared" + }, + "license": "MIT", + "main": "src/init.lua", + "scripts": { + "prepare": "npmluau" + }, + "dependencies": { + "@jsdotlua/luau-polyfill": "^1.2.6" + }, + "devDependencies": { + "npmluau": "^0.1.0" + } +} diff --git a/modules/shared/src/ConsolePatchingDev.roblox.lua b/modules/shared/src/ConsolePatchingDev.roblox.lua index ab54f089..027d9699 100644 --- a/modules/shared/src/ConsolePatchingDev.roblox.lua +++ b/modules/shared/src/ConsolePatchingDev.roblox.lua @@ -13,7 +13,7 @@ -- `Object.defineProperties` to ensure that properties are modifiable. In Lua, -- these operations are as simple as assigning to functions. -- ROBLOX: use patched console from shared -local console = require(script.Parent.console) +local console = require("./console") -- Helpers to patch console.logs to avoid logging during side-effect free -- replaying on render function. This currently only patches the object diff --git a/modules/shared/src/ErrorHandling.roblox.lua b/modules/shared/src/ErrorHandling.roblox.lua index 21a9f461..4dce05e6 100644 --- a/modules/shared/src/ErrorHandling.roblox.lua +++ b/modules/shared/src/ErrorHandling.roblox.lua @@ -14,8 +14,7 @@ * limitations under the License. ]] -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") type Error = LuauPolyfill.Error type Object = LuauPolyfill.Object type Array = LuauPolyfill.Array diff --git a/modules/shared/src/PropMarkers/Change.lua b/modules/shared/src/PropMarkers/Change.lua index eff7f864..084da588 100644 --- a/modules/shared/src/PropMarkers/Change.lua +++ b/modules/shared/src/PropMarkers/Change.lua @@ -25,7 +25,7 @@ }) ]] -local Type = require(script.Parent.Parent["Type.roblox"]) +local Type = require("../Type.roblox.lua") local Change = {} diff --git a/modules/shared/src/PropMarkers/Event.lua b/modules/shared/src/PropMarkers/Event.lua index 1d171e65..a67f3483 100644 --- a/modules/shared/src/PropMarkers/Event.lua +++ b/modules/shared/src/PropMarkers/Event.lua @@ -27,7 +27,7 @@ }) ]] -local Type = require(script.Parent.Parent["Type.roblox"]) +local Type = require("../Type.roblox.lua") local Event = {} diff --git a/modules/shared/src/PropMarkers/Tag.lua b/modules/shared/src/PropMarkers/Tag.lua index 035e08c5..35daf94d 100644 --- a/modules/shared/src/PropMarkers/Tag.lua +++ b/modules/shared/src/PropMarkers/Tag.lua @@ -15,7 +15,7 @@ --[[ Special value for assigning tags to roblox instances via Roact ]] -local Symbol = require(script.Parent.Parent["Symbol.roblox"]) +local Symbol = require("../Symbol.roblox.lua") local Tag = Symbol.named("RobloxTag") diff --git a/modules/shared/src/PropMarkers/__tests__/Change.spec.lua b/modules/shared/src/PropMarkers/__tests__/Change.spec.lua index a1997b5e..363a3164 100644 --- a/modules/shared/src/PropMarkers/__tests__/Change.spec.lua +++ b/modules/shared/src/PropMarkers/__tests__/Change.spec.lua @@ -13,13 +13,12 @@ * limitations under the License. ]] -local Packages = script.Parent.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local it = JestGlobals.it -local Type = require(script.Parent.Parent.Parent["Type.roblox"]) -local Change = require(script.Parent.Parent.Change) +local Type = require("../../Type.roblox.lua") +local Change = require("../Change") it("should yield change listener objects when indexed", function() jestExpect(Type.of(Change.Text)).toBe(Type.HostChangeEvent) diff --git a/modules/shared/src/PropMarkers/__tests__/Event.spec.lua b/modules/shared/src/PropMarkers/__tests__/Event.spec.lua index 4878bde5..57f79004 100644 --- a/modules/shared/src/PropMarkers/__tests__/Event.spec.lua +++ b/modules/shared/src/PropMarkers/__tests__/Event.spec.lua @@ -13,13 +13,12 @@ * limitations under the License. ]] -local Packages = script.Parent.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local it = JestGlobals.it -local Type = require(script.Parent.Parent.Parent["Type.roblox"]) -local Event = require(script.Parent.Parent.Event) +local Type = require("../../Type.roblox.lua") +local Event = require("../Event") it("should yield event objects when indexed", function() jestExpect(Type.of(Event.MouseButton1Click)).toBe(Type.HostEvent) diff --git a/modules/shared/src/ReactComponentStackFrame.lua b/modules/shared/src/ReactComponentStackFrame.lua index 6d50aef4..366414c9 100644 --- a/modules/shared/src/ReactComponentStackFrame.lua +++ b/modules/shared/src/ReactComponentStackFrame.lua @@ -12,11 +12,11 @@ type Object = { [string]: any } type Function = (...any) -> ...any -local ReactElementType = require(script.Parent.ReactElementType) +local ReactElementType = require("./ReactElementType") type Source = ReactElementType.Source -- ROBLOX deviation: Needed to properly type class components -local flowtypes = require(script.Parent["flowtypes.roblox"]) +local flowtypes = require("./flowtypes.roblox.lua") type React_StatelessFunctionalComponent

= flowtypes.React_StatelessFunctionalComponent< P > @@ -24,10 +24,10 @@ type React_ComponentType

= flowtypes.React_ComponentType

type ReactComponent

= React_StatelessFunctionalComponent

| React_ComponentType

-- ROBLOX DEVIATION: Ignore enableComponentStackLocations --- local ReactFeatureFlags = require(script.Parent.ReactFeatureFlags) +-- local ReactFeatureFlags = require("./ReactFeatureFlags") -- local enableComponentStackLocations = ReactFeatureFlags.enableComponentStackLocations -local ReactSymbols = require(script.Parent.ReactSymbols) +local ReactSymbols = require("./ReactSymbols") local REACT_SUSPENSE_TYPE = ReactSymbols.REACT_SUSPENSE_TYPE local REACT_SUSPENSE_LIST_TYPE = ReactSymbols.REACT_SUSPENSE_LIST_TYPE local REACT_FORWARD_REF_TYPE = ReactSymbols.REACT_FORWARD_REF_TYPE @@ -35,11 +35,11 @@ local REACT_MEMO_TYPE = ReactSymbols.REACT_MEMO_TYPE local REACT_BLOCK_TYPE = ReactSymbols.REACT_BLOCK_TYPE local REACT_LAZY_TYPE = ReactSymbols.REACT_LAZY_TYPE -local ConsolePatchingDev = require(script.Parent["ConsolePatchingDev.roblox"]) +local ConsolePatchingDev = require("./ConsolePatchingDev.roblox.lua") local disableLogs = ConsolePatchingDev.disableLogs local reenableLogs = ConsolePatchingDev.reenableLogs -local ReactSharedInternals = require(script.Parent.ReactSharedInternals) +local ReactSharedInternals = require("./ReactSharedInternals") local ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher -- ROBLOX deviation: the prefix is constant because the console prints the stack diff --git a/modules/shared/src/ReactElementType.lua b/modules/shared/src/ReactElementType.lua index 81a0ba0c..7a4640f3 100644 --- a/modules/shared/src/ReactElementType.lua +++ b/modules/shared/src/ReactElementType.lua @@ -7,11 +7,10 @@ * * @flow ]] -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") type Object = LuauPolyfill.Object -local flowtypes = require(script.Parent["flowtypes.roblox"]) +local flowtypes = require("./flowtypes.roblox.lua") type React_Element = flowtypes.React_Element type React_StatelessFunctionalComponent

= flowtypes.React_StatelessFunctionalComponent< P diff --git a/modules/shared/src/ReactErrorUtils.lua b/modules/shared/src/ReactErrorUtils.lua index 4882b0c6..f14e713c 100644 --- a/modules/shared/src/ReactErrorUtils.lua +++ b/modules/shared/src/ReactErrorUtils.lua @@ -8,8 +8,8 @@ * * @flow ]] -local invariant = require(script.Parent.invariant) -local invokeGuardedCallbackImpl = require(script.Parent.invokeGuardedCallbackImpl) +local invariant = require("./invariant") +local invokeGuardedCallbackImpl = require("./invokeGuardedCallbackImpl") -- deviation: preemptively declare function local clearCaughtError diff --git a/modules/shared/src/ReactFiberHostConfig/WithNoHydration.lua b/modules/shared/src/ReactFiberHostConfig/WithNoHydration.lua index 5329f598..d6e650a7 100644 --- a/modules/shared/src/ReactFiberHostConfig/WithNoHydration.lua +++ b/modules/shared/src/ReactFiberHostConfig/WithNoHydration.lua @@ -8,7 +8,7 @@ * @flow ]] -local invariant = require(script.Parent.Parent.invariant) +local invariant = require("../invariant") -- Renderers that don't support hydration -- can re-export everything from this module. diff --git a/modules/shared/src/ReactFiberHostConfig/WithNoPersistence.lua b/modules/shared/src/ReactFiberHostConfig/WithNoPersistence.lua index 41f052c1..d915322d 100644 --- a/modules/shared/src/ReactFiberHostConfig/WithNoPersistence.lua +++ b/modules/shared/src/ReactFiberHostConfig/WithNoPersistence.lua @@ -8,7 +8,7 @@ * @flow ]] -local invariant = require(script.Parent.Parent.invariant) +local invariant = require("../invariant") -- Renderers that don't support persistence -- can re-export everything from this module. diff --git a/modules/shared/src/ReactFiberHostConfig/WithNoTestSelectors.lua b/modules/shared/src/ReactFiberHostConfig/WithNoTestSelectors.lua index db3d9b3a..a5d1d05a 100644 --- a/modules/shared/src/ReactFiberHostConfig/WithNoTestSelectors.lua +++ b/modules/shared/src/ReactFiberHostConfig/WithNoTestSelectors.lua @@ -8,7 +8,7 @@ * @flow ]] -local invariant = require(script.Parent.Parent.invariant) +local invariant = require("../invariant") -- Renderers that don't support test selectors -- can re-export everything from this module. diff --git a/modules/shared/src/ReactFiberHostConfig/init.lua b/modules/shared/src/ReactFiberHostConfig/init.lua index b0a06ad4..120645ec 100644 --- a/modules/shared/src/ReactFiberHostConfig/init.lua +++ b/modules/shared/src/ReactFiberHostConfig/init.lua @@ -33,7 +33,7 @@ type Object = { [string]: any } export type OpaqueIDType = string | Object return { - WithNoHydration = require(script.WithNoHydration), - WithNoPersistence = require(script.WithNoPersistence), - WithNoTestSelectors = require(script.WithNoTestSelectors), + WithNoHydration = require("./WithNoHydration"), + WithNoPersistence = require("./WithNoPersistence"), + WithNoTestSelectors = require("./WithNoTestSelectors"), } diff --git a/modules/shared/src/ReactInstanceMap.lua b/modules/shared/src/ReactInstanceMap.lua index 801e999b..2ee5b733 100644 --- a/modules/shared/src/ReactInstanceMap.lua +++ b/modules/shared/src/ReactInstanceMap.lua @@ -23,12 +23,10 @@ * supported we can rename it. ]] -local Shared = script.Parent -local Packages = Shared.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Error = LuauPolyfill.Error local inspect = LuauPolyfill.util.inspect -local getComponentName = require(script.Parent.getComponentName) +local getComponentName = require("./getComponentName") local exports = {} diff --git a/modules/shared/src/ReactSharedInternals/ReactCurrentDispatcher.lua b/modules/shared/src/ReactSharedInternals/ReactCurrentDispatcher.lua index a6c4dfb7..0502375b 100644 --- a/modules/shared/src/ReactSharedInternals/ReactCurrentDispatcher.lua +++ b/modules/shared/src/ReactSharedInternals/ReactCurrentDispatcher.lua @@ -12,14 +12,13 @@ --[[* * Keeps track of the current dispatcher. ]] -local Packages = script.Parent.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") type Array = LuauPolyfill.Array -- ROBLOX deviation: we duplicate the Dispatcher type here because upstream has a circular dependency between Shared and Reconciler -local ReactElementType = require(script.Parent.Parent.ReactElementType) +local ReactElementType = require("../ReactElementType") type Source = ReactElementType.Source -local ReactTypes = require(script.Parent.Parent.ReactTypes) +local ReactTypes = require("../ReactTypes") type RefObject = ReactTypes.RefObject type ReactContext = ReactTypes.ReactContext -- ROBLOX deviation START: binding support diff --git a/modules/shared/src/ReactSharedInternals/init.lua b/modules/shared/src/ReactSharedInternals/init.lua index 20602a7d..2477e9a6 100644 --- a/modules/shared/src/ReactSharedInternals/init.lua +++ b/modules/shared/src/ReactSharedInternals/init.lua @@ -22,8 +22,7 @@ * React depends on Shared * Shared has no intra-workspace dependencies (no cycles) ]] -local Packages = script.Parent.Parent -local console = require(Packages.LuauPolyfill).console +local console = require("@pkg/@jsdotlua/luau-polyfill").console local function onlyInTestError(functionName: string) return function() console.error(functionName .. " is only available in tests, not in production") @@ -31,12 +30,12 @@ local function onlyInTestError(functionName: string) end -- import assign from 'object-assign'; -local ReactCurrentDispatcher = require(script.ReactCurrentDispatcher) +local ReactCurrentDispatcher = require("./ReactCurrentDispatcher") export type Dispatcher = ReactCurrentDispatcher.Dispatcher -local ReactCurrentBatchConfig = require(script.ReactCurrentBatchConfig) -local ReactCurrentOwner = require(script.ReactCurrentOwner) -local ReactDebugCurrentFrame = require(script.ReactDebugCurrentFrame) -local IsSomeRendererActing = require(script.IsSomeRendererActing) +local ReactCurrentBatchConfig = require("./ReactCurrentBatchConfig") +local ReactCurrentOwner = require("./ReactCurrentOwner") +local ReactDebugCurrentFrame = require("./ReactDebugCurrentFrame") +local IsSomeRendererActing = require("./IsSomeRendererActing") local ReactSharedInternals = { ReactCurrentDispatcher = ReactCurrentDispatcher, diff --git a/modules/shared/src/ReactSymbols.lua b/modules/shared/src/ReactSymbols.lua index a2a82f3d..0a454347 100644 --- a/modules/shared/src/ReactSymbols.lua +++ b/modules/shared/src/ReactSymbols.lua @@ -13,8 +13,7 @@ -- When adding new symbols to this file, -- Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' --- local Packages = script.Parent.Parent --- local LuauPolyfill = require(Packages.LuauPolyfill) +-- local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") -- local Symbol = LuauPolyfill.Symbol local exports: { [string]: any } = {} diff --git a/modules/shared/src/ReactTypes.lua b/modules/shared/src/ReactTypes.lua index 4019396c..927fd167 100644 --- a/modules/shared/src/ReactTypes.lua +++ b/modules/shared/src/ReactTypes.lua @@ -7,15 +7,13 @@ * * @flow ]] - -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") type Array = LuauPolyfill.Array type Object = LuauPolyfill.Object type void = nil type NonMaybeType = T -local flowtypes = require(script.Parent["flowtypes.roblox"]) +local flowtypes = require("./flowtypes.roblox.lua") type React_Element = flowtypes.React_Element type React_Node = flowtypes.React_Node type SimpleMap = { [K]: V } diff --git a/modules/shared/src/ReactVersion.lua b/modules/shared/src/ReactVersion.lua index 4ac84827..2911732a 100644 --- a/modules/shared/src/ReactVersion.lua +++ b/modules/shared/src/ReactVersion.lua @@ -8,4 +8,4 @@ ]] -- TODO: this is special because it gets imported during build. -return "17.0.1" +return "17.0.2" diff --git a/modules/shared/src/Type.roblox.lua b/modules/shared/src/Type.roblox.lua index aebe2359..415a8d62 100644 --- a/modules/shared/src/Type.roblox.lua +++ b/modules/shared/src/Type.roblox.lua @@ -23,7 +23,7 @@ } ]] -local Symbol = require(script.Parent["Symbol.roblox"]) +local Symbol = require("./Symbol.roblox.lua") local Type = newproxy(true) diff --git a/modules/shared/src/UninitializedState.roblox.lua b/modules/shared/src/UninitializedState.roblox.lua index 8ea72615..6967b3cf 100644 --- a/modules/shared/src/UninitializedState.roblox.lua +++ b/modules/shared/src/UninitializedState.roblox.lua @@ -13,7 +13,7 @@ * limitations under the License. ]] --!strict -local console = require(script.Parent.console) +local console = require("./console") -- ROBLOX DEVIATION: Initialize state to a singleton that warns on access and errors on assignment -- initial state singleton diff --git a/modules/shared/src/__tests__/ErrorHandling.roblox.spec.lua b/modules/shared/src/__tests__/ErrorHandling.roblox.spec.lua index bc0cc5c6..ac1ef744 100644 --- a/modules/shared/src/__tests__/ErrorHandling.roblox.spec.lua +++ b/modules/shared/src/__tests__/ErrorHandling.roblox.spec.lua @@ -1,14 +1,12 @@ -local Packages = script.Parent.Parent.Parent - -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local describe = JestGlobals.describe local it = JestGlobals.it -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Error = LuauPolyfill.Error local inspect = LuauPolyfill.util.inspect -local ErrorHandling = require(script.Parent.Parent["ErrorHandling.roblox"]) +local ErrorHandling = require("../ErrorHandling.roblox.lua") local describeError = ErrorHandling.describeError local errorToString = ErrorHandling.errorToString local parseReactError = ErrorHandling.parseReactError @@ -97,6 +95,7 @@ describe("errorToString", function() jestExpect(errorString).toContain("31337") end) it("prints arrays", function() + -- selene: allow(mixed_table) local errorString = errorToString({ foo = 1, 2, 3 }) jestExpect(errorString).toContain("foo: 1") diff --git a/modules/shared/src/__tests__/ReactComponentStackFrame.roblox.spec.lua b/modules/shared/src/__tests__/ReactComponentStackFrame.roblox.spec.lua index 93640f7d..81c29be7 100644 --- a/modules/shared/src/__tests__/ReactComponentStackFrame.roblox.spec.lua +++ b/modules/shared/src/__tests__/ReactComponentStackFrame.roblox.spec.lua @@ -1,11 +1,11 @@ --!strict local Packages = script.Parent.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Object = LuauPolyfill.Object local String = LuauPolyfill.String -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local beforeEach = JestGlobals.beforeEach local jestExpect = JestGlobals.expect local describe = JestGlobals.describe @@ -26,7 +26,7 @@ describe("describeNativeComponentFrame", function() beforeEach(function() jest.resetModules() - ReactComponentStackFrame = require(script.Parent.Parent.ReactComponentStackFrame) + ReactComponentStackFrame = require("./ReactComponentStackFrame") describeNativeComponentFrame = ReactComponentStackFrame.describeNativeComponentFrame end) @@ -51,7 +51,7 @@ describe("with enableComponentStackLocations to false", function() beforeEach(function() jest.resetModules() - local ReactFeatureFlags = require(script.Parent.Parent.ReactFeatureFlags) + local ReactFeatureFlags = require("./ReactFeatureFlags") -- ROBLOX FIXME: Calling mock after require won't work jest.mock(script.Parent.Parent.ReactFeatureFlags :: any, function() @@ -60,7 +60,7 @@ describe("with enableComponentStackLocations to false", function() }) end) - ReactComponentStackFrame = require(script.Parent.Parent.ReactComponentStackFrame) + ReactComponentStackFrame = require("./ReactComponentStackFrame") end) describe("describeBuiltInComponentFrame", function() @@ -164,7 +164,7 @@ describe("with enableComponentStackLocations to true", function() beforeEach(function() jest.resetModules() - local ReactFeatureFlags = require(script.Parent.Parent.ReactFeatureFlags) + local ReactFeatureFlags = require("./ReactFeatureFlags") -- ROBLOX FIXME: Calling mock after require won't work jest.mock(script.Parent.Parent.ReactFeatureFlags :: any, function() @@ -173,7 +173,7 @@ describe("with enableComponentStackLocations to true", function() }) end) - ReactComponentStackFrame = require(script.Parent.Parent.ReactComponentStackFrame) + ReactComponentStackFrame = require("./ReactComponentStackFrame") describeBuiltInComponentFrame = ReactComponentStackFrame.describeBuiltInComponentFrame end) @@ -197,7 +197,7 @@ describe("DEV warning stack trace", function() beforeEach(function() jest.resetModules() - React = require(Packages.Dev.React) + React = require("@pkg/@jsdotlua/react") describeUnknownElementTypeFrameInDev = require( script.Parent.Parent.ReactComponentStackFrame ).describeUnknownElementTypeFrameInDEV diff --git a/modules/shared/src/__tests__/ReactErrorProd-internal.spec.lua b/modules/shared/src/__tests__/ReactErrorProd-internal.spec.lua index b726221c..1239ecd2 100644 --- a/modules/shared/src/__tests__/ReactErrorProd-internal.spec.lua +++ b/modules/shared/src/__tests__/ReactErrorProd-internal.spec.lua @@ -10,7 +10,7 @@ --!strict local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local beforeEach = JestGlobals.beforeEach local jestExpect = JestGlobals.expect local it = JestGlobals.it @@ -19,7 +19,7 @@ local formatProdErrorMessage beforeEach(function() jest.resetModules() - formatProdErrorMessage = require(script.Parent.Parent.formatProdErrorMessage) + formatProdErrorMessage = require("./formatProdErrorMessage") end) it("should throw with the correct number of `%s`s in the URL", function() diff --git a/modules/shared/src/__tests__/ReactErrorUtils-internal.spec.lua b/modules/shared/src/__tests__/ReactErrorUtils-internal.spec.lua index f4d759b8..d5cfd7c4 100644 --- a/modules/shared/src/__tests__/ReactErrorUtils-internal.spec.lua +++ b/modules/shared/src/__tests__/ReactErrorUtils-internal.spec.lua @@ -9,9 +9,9 @@ ]] local Packages = script.Parent.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Error = LuauPolyfill.Error -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local afterEach = JestGlobals.afterEach local beforeEach = JestGlobals.beforeEach local jestExpect = JestGlobals.expect @@ -22,7 +22,7 @@ local ReactErrorUtils beforeEach(function() -- TODO: can we express this test with only public API? jest.resetModules() - ReactErrorUtils = require(script.Parent.Parent.ReactErrorUtils) + ReactErrorUtils = require("./ReactErrorUtils") end) afterEach(function() @@ -111,9 +111,9 @@ it("handles nested errors", function() end) it("handles nested errors in separate renderers", function() - local ReactErrorUtils1 = require(script.Parent.Parent.ReactErrorUtils) + local ReactErrorUtils1 = require("./ReactErrorUtils") jest.resetModules() - local ReactErrorUtils2 = require(script.Parent.Parent.ReactErrorUtils) + local ReactErrorUtils2 = require("./ReactErrorUtils") jestExpect(ReactErrorUtils1).never.toEqual(ReactErrorUtils2) local ops = {} @@ -159,7 +159,7 @@ it("can be shimmed", function() end end end) - ReactErrorUtils = require(script.Parent.Parent.ReactErrorUtils) + ReactErrorUtils = require("./ReactErrorUtils") -- deviation: no need to wrap in try/finally since we don't need to -- undo the mock like we would with jest diff --git a/modules/shared/src/__tests__/ReactInstanceMap.roblox.spec.lua b/modules/shared/src/__tests__/ReactInstanceMap.roblox.spec.lua index 37433c87..148757a4 100644 --- a/modules/shared/src/__tests__/ReactInstanceMap.roblox.spec.lua +++ b/modules/shared/src/__tests__/ReactInstanceMap.roblox.spec.lua @@ -2,12 +2,12 @@ -- ROBLOX TODO: make this only pass in __DEV__ local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local describe = JestGlobals.describe local it = JestGlobals.it -local ReactInstanceMap = require(Packages.Shared).ReactInstanceMap +local ReactInstanceMap = require("@pkg/@jsdotlua/shared").ReactInstanceMap describe("get", function() it("with invalid fiber", function() diff --git a/modules/shared/src/__tests__/ReactSymbols-internal.spec.lua b/modules/shared/src/__tests__/ReactSymbols-internal.spec.lua index 4704e67d..d712b46b 100644 --- a/modules/shared/src/__tests__/ReactSymbols-internal.spec.lua +++ b/modules/shared/src/__tests__/ReactSymbols-internal.spec.lua @@ -10,7 +10,7 @@ --!strict local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local it = JestGlobals.it -- deviation: This doesn't have any affect for this test @@ -48,7 +48,7 @@ it("numeric values should be unique", function() -- deviation: We don't use symbol anyways, so it's no use to -- override it. We also don't need to filter any values, since -- they're internal-only. - local ReactSymbols = require(script.Parent.Parent.ReactSymbols) + local ReactSymbols = require("./ReactSymbols") expectToBeUnique(ReactSymbols) -- deviation: We comment out this chunk because we're not actually using diff --git a/modules/shared/src/__tests__/checkPropTypes.roblox.spec.lua b/modules/shared/src/__tests__/checkPropTypes.roblox.spec.lua index 6f2d02ae..edf47b5f 100644 --- a/modules/shared/src/__tests__/checkPropTypes.roblox.spec.lua +++ b/modules/shared/src/__tests__/checkPropTypes.roblox.spec.lua @@ -3,22 +3,22 @@ local React local ReactNoop local Scheduler -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local afterEach = JestGlobals.afterEach local beforeEach = JestGlobals.beforeEach local jestExpect = JestGlobals.expect local describe = JestGlobals.describe local it = JestGlobals.it local jest = JestGlobals.jest -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Error = LuauPolyfill.Error describe("tests propTypes and validateProps behavior", function() beforeEach(function() jest.resetModules() - ReactNoop = require(Packages.Dev.ReactNoop) - Scheduler = require(Packages.Dev.Scheduler) - React = require(Packages.Dev.React) + ReactNoop = require("@dev-packages/ReactNoop") + Scheduler = require("@pkg/@jsdotlua/scheduler") + React = require("@pkg/@jsdotlua/react") end) it("propTypes defined, returns error", function() local Foo = React.Component:extend("div") diff --git a/modules/shared/src/__tests__/getComponentName.roblox.spec.lua b/modules/shared/src/__tests__/getComponentName.roblox.spec.lua index 395532ac..2087ef05 100644 --- a/modules/shared/src/__tests__/getComponentName.roblox.spec.lua +++ b/modules/shared/src/__tests__/getComponentName.roblox.spec.lua @@ -1,5 +1,5 @@ local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local beforeEach = JestGlobals.beforeEach local jestExpect = JestGlobals.expect local describe = JestGlobals.describe @@ -11,9 +11,9 @@ local function MyComponent() end local anonymous = function() end beforeEach(function() - React = require(Packages.Dev.React) + React = require("@pkg/@jsdotlua/react") - getComponentName = require(Packages.Shared).getComponentName + getComponentName = require("@pkg/@jsdotlua/shared").getComponentName end) describe("function components", function() diff --git a/modules/shared/src/__tests__/isValidElementType.roblox.spec.lua b/modules/shared/src/__tests__/isValidElementType.roblox.spec.lua index 348f8272..312bf36e 100644 --- a/modules/shared/src/__tests__/isValidElementType.roblox.spec.lua +++ b/modules/shared/src/__tests__/isValidElementType.roblox.spec.lua @@ -1,11 +1,11 @@ local Packages = script.Parent.Parent.Parent -local JestGlobals = require(Packages.Dev.JestGlobals) +local JestGlobals = require("@pkg/@jsdotlua/jest-globals") local jestExpect = JestGlobals.expect local describe = JestGlobals.describe local it = JestGlobals.it -local isValidElementType = require(Packages.Shared).isValidElementType -local ReactSymbols = require(Packages.Shared).ReactSymbols +local isValidElementType = require("@pkg/@jsdotlua/shared").isValidElementType +local ReactSymbols = require("@pkg/@jsdotlua/shared").ReactSymbols local element describe("accept element primitives", function() diff --git a/modules/shared/src/checkPropTypes.lua b/modules/shared/src/checkPropTypes.lua index e235279e..6182e551 100644 --- a/modules/shared/src/checkPropTypes.lua +++ b/modules/shared/src/checkPropTypes.lua @@ -8,24 +8,23 @@ * * @flow ]] -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Error = LuauPolyfill.Error type Object = LuauPolyfill.Object type Function = (...any) -> ...any -- ROBLOX: use patched console from shared -local console = require(script.Parent.console) +local console = require("./console") local loggedTypeFailures = {} -local ReactComponentStackFrame = require(script.Parent.ReactComponentStackFrame) +local ReactComponentStackFrame = require("./ReactComponentStackFrame") local describeUnknownElementTypeFrameInDEV = ReactComponentStackFrame.describeUnknownElementTypeFrameInDEV -local ReactSharedInternals = require(script.Parent.ReactSharedInternals) +local ReactSharedInternals = require("./ReactSharedInternals") -local describeError = require(script.Parent["ErrorHandling.roblox"]).describeError +local describeError = require("./ErrorHandling.roblox.lua").describeError local ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame diff --git a/modules/shared/src/console.lua b/modules/shared/src/console.lua index 9c2ab7ff..b828b4a0 100644 --- a/modules/shared/src/console.lua +++ b/modules/shared/src/console.lua @@ -18,11 +18,9 @@ -- console.warn and console.error into the code -- Instead of using `LuauPolyfill.console`, React internals should use this -- wrapper to be able to use consoleWithStackDev in dev mode -local Shared = script.Parent -local Packages = Shared.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local console = LuauPolyfill.console -local consoleWithStackDev = require(Shared.consoleWithStackDev) +local consoleWithStackDev = require("./consoleWithStackDev") if _G.__DEV__ then local newConsole = setmetatable({ diff --git a/modules/shared/src/consoleWithStackDev.lua b/modules/shared/src/consoleWithStackDev.lua index 41cfadd1..5b6ad2dc 100644 --- a/modules/shared/src/consoleWithStackDev.lua +++ b/modules/shared/src/consoleWithStackDev.lua @@ -5,12 +5,11 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. ]] -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local console = LuauPolyfill.console local Array = LuauPolyfill.Array -local ReactSharedInternals = require(script.Parent.ReactSharedInternals) +local ReactSharedInternals = require("./ReactSharedInternals") -- In DEV, calls to console.warn and console.error get replaced -- by calls to these methods by a Babel plugin. -- diff --git a/modules/shared/src/enqueueTask.roblox.lua b/modules/shared/src/enqueueTask.roblox.lua index ce3c17a6..d112bfc7 100644 --- a/modules/shared/src/enqueueTask.roblox.lua +++ b/modules/shared/src/enqueueTask.roblox.lua @@ -7,8 +7,7 @@ * * ]] -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local setTimeout = LuauPolyfill.setTimeout return function(task) diff --git a/modules/shared/src/flowtypes.roblox.lua b/modules/shared/src/flowtypes.roblox.lua index afec5eb0..a358c06e 100644 --- a/modules/shared/src/flowtypes.roblox.lua +++ b/modules/shared/src/flowtypes.roblox.lua @@ -14,8 +14,7 @@ ]] -- built-in flowtypes reverse engineered based on usage and enabling strict type checking on test suites --!strict -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") type Error = LuauPolyfill.Error type Array = LuauPolyfill.Array type Object = { [string]: any } diff --git a/modules/shared/src/getComponentName.lua b/modules/shared/src/getComponentName.lua index 6922b7b0..dab16c2a 100644 --- a/modules/shared/src/getComponentName.lua +++ b/modules/shared/src/getComponentName.lua @@ -9,7 +9,7 @@ * @flow ]] type Function = (...any) -> ...any -local console = require(script.Parent.console) +local console = require("./console") -- ROBLOX deviation: inline this typedef to avoid upstream's circular dependency type LazyComponent = { @@ -18,7 +18,7 @@ type LazyComponent = { _init: (payload: P) -> T, } -local ReactSymbols = require(script.Parent.ReactSymbols) +local ReactSymbols = require("./ReactSymbols") local REACT_CONTEXT_TYPE = ReactSymbols.REACT_CONTEXT_TYPE local REACT_FORWARD_REF_TYPE = ReactSymbols.REACT_FORWARD_REF_TYPE local REACT_FRAGMENT_TYPE = ReactSymbols.REACT_FRAGMENT_TYPE @@ -31,11 +31,11 @@ local REACT_SUSPENSE_TYPE = ReactSymbols.REACT_SUSPENSE_TYPE local REACT_SUSPENSE_LIST_TYPE = ReactSymbols.REACT_SUSPENSE_LIST_TYPE local REACT_LAZY_TYPE = ReactSymbols.REACT_LAZY_TYPE local REACT_BLOCK_TYPE = ReactSymbols.REACT_BLOCK_TYPE -local ReactTypes = require(script.Parent.ReactTypes) +local ReactTypes = require("./ReactTypes") type ReactContext = ReactTypes.ReactContext type ReactProviderType = ReactTypes.ReactProviderType -local describeError = require(script.Parent["ErrorHandling.roblox"]).describeError +local describeError = require("./ErrorHandling.roblox.lua").describeError local function getWrappedName(outerType: any, innerType: any, wrapperName: string): string -- deviation: Account for indexing into function diff --git a/modules/shared/src/init.lua b/modules/shared/src/init.lua index 6a20d6ab..67475507 100644 --- a/modules/shared/src/init.lua +++ b/modules/shared/src/init.lua @@ -16,16 +16,15 @@ -- ROBLOX deviation: Promote `shared` to an actual unpublished package with a -- real interface instead of just a bag of loose source code -local Packages = script.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") type Object = LuauPolyfill.Object -local ReactTypes = require(script.ReactTypes) -local flowtypes = require(script["flowtypes.roblox"]) -local ReactElementType = require(script.ReactElementType) -local ReactFiberHostConfig = require(script.ReactFiberHostConfig) -local ReactSharedInternals = require(script.ReactSharedInternals) -local ErrorHandling = require(script["ErrorHandling.roblox"]) +local ReactTypes = require("./ReactTypes") +local flowtypes = require("./flowtypes.roblox.lua") +local ReactElementType = require("./ReactElementType") +local ReactFiberHostConfig = require("./ReactFiberHostConfig") +local ReactSharedInternals = require("./ReactSharedInternals") +local ErrorHandling = require("./ErrorHandling.roblox.lua") -- Re-export all top-level public types export type ReactEmpty = ReactTypes.ReactEmpty @@ -90,23 +89,23 @@ export type React_Portal = flowtypes.React_Portal export type React_Key = flowtypes.React_Key return { - checkPropTypes = require(script.checkPropTypes), - console = require(script.console), - ConsolePatchingDev = require(script["ConsolePatchingDev.roblox"]), - consoleWithStackDev = require(script.consoleWithStackDev), - enqueueTask = require(script["enqueueTask.roblox"]), - ExecutionEnvironment = require(script.ExecutionEnvironment), - formatProdErrorMessage = require(script.formatProdErrorMessage), - getComponentName = require(script.getComponentName), - invariant = require(script.invariant), - invokeGuardedCallbackImpl = require(script.invokeGuardedCallbackImpl), - isValidElementType = require(script.isValidElementType), - objectIs = require(script.objectIs), - ReactComponentStackFrame = require(script.ReactComponentStackFrame), - ReactElementType = require(script.ReactElementType), - ReactErrorUtils = require(script.ReactErrorUtils), - ReactFeatureFlags = require(script.ReactFeatureFlags), - ReactInstanceMap = require(script.ReactInstanceMap), + checkPropTypes = require("./checkPropTypes"), + console = require("./console"), + ConsolePatchingDev = require("./ConsolePatchingDev.roblox.lua"), + consoleWithStackDev = require("./consoleWithStackDev"), + enqueueTask = require("./enqueueTask.roblox.lua"), + ExecutionEnvironment = require("./ExecutionEnvironment"), + formatProdErrorMessage = require("./formatProdErrorMessage"), + getComponentName = require("./getComponentName"), + invariant = require("./invariant"), + invokeGuardedCallbackImpl = require("./invokeGuardedCallbackImpl"), + isValidElementType = require("./isValidElementType"), + objectIs = require("./objectIs"), + ReactComponentStackFrame = require("./ReactComponentStackFrame"), + ReactElementType = require("./ReactElementType"), + ReactErrorUtils = require("./ReactErrorUtils"), + ReactFeatureFlags = require("./ReactFeatureFlags"), + ReactInstanceMap = require("./ReactInstanceMap"), -- ROBLOX deviation: Instead of re-exporting from here, Shared actually owns -- these files itself ReactSharedInternals = ReactSharedInternals, @@ -115,10 +114,10 @@ return { -- from shared for easier reuse ReactFiberHostConfig = ReactFiberHostConfig, - ReactSymbols = require(script.ReactSymbols), - ReactVersion = require(script.ReactVersion), - shallowEqual = require(script.shallowEqual), - UninitializedState = require(script["UninitializedState.roblox"]), + ReactSymbols = require("./ReactSymbols"), + ReactVersion = require("./ReactVersion"), + shallowEqual = require("./shallowEqual"), + UninitializedState = require("./UninitializedState.roblox.lua"), ReactTypes = ReactTypes, -- ROBLOX DEVIATION: export error-stack-preserving utilities for use in @@ -128,11 +127,11 @@ return { parseReactError = ErrorHandling.parseReactError, -- ROBLOX DEVIATION: export Symbol and Type from Shared - Symbol = require(script["Symbol.roblox"]), - Type = require(script["Type.roblox"]), + Symbol = require("./Symbol.roblox.lua"), + Type = require("./Type.roblox.lua"), -- ROBLOX DEVIATION: export propmarkers from Shared - Change = require(script.PropMarkers.Change), - Event = require(script.PropMarkers.Event), - Tag = require(script.PropMarkers.Tag), + Change = require("./PropMarkers/Change"), + Event = require("./PropMarkers/Event"), + Tag = require("./PropMarkers/Tag"), } diff --git a/modules/shared/src/invariant.lua b/modules/shared/src/invariant.lua index 08636702..ffbf4837 100644 --- a/modules/shared/src/invariant.lua +++ b/modules/shared/src/invariant.lua @@ -18,8 +18,7 @@ * The invariant message will be stripped in production, but the invariant * will remain to ensure logic does not differ in production. ]] -local Packages = script.Parent.Parent -local LuauPolyfill = require(Packages.LuauPolyfill) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") local Error = LuauPolyfill.Error local function invariant(condition, format, ...) diff --git a/modules/shared/src/invokeGuardedCallbackImpl.lua b/modules/shared/src/invokeGuardedCallbackImpl.lua index 780dafdb..e720e3cd 100644 --- a/modules/shared/src/invokeGuardedCallbackImpl.lua +++ b/modules/shared/src/invokeGuardedCallbackImpl.lua @@ -8,8 +8,8 @@ * * @flow ]] --- local invariant = require(script.Parent.invariant) -local describeError = require(script.Parent["ErrorHandling.roblox"]).describeError +-- local invariant = require("./invariant") +local describeError = require("./ErrorHandling.roblox.lua").describeError -- deviation: with flow types stripped, it's easier to use varargs directly local function invokeGuardedCallbackProd(reporter, name, func, context, ...) diff --git a/modules/shared/src/isValidElementType.lua b/modules/shared/src/isValidElementType.lua index adb25381..b25b3894 100644 --- a/modules/shared/src/isValidElementType.lua +++ b/modules/shared/src/isValidElementType.lua @@ -7,7 +7,7 @@ * * ]] -local ReactSymbols = require(script.Parent.ReactSymbols) +local ReactSymbols = require("./ReactSymbols") local REACT_CONTEXT_TYPE = ReactSymbols.REACT_CONTEXT_TYPE local REACT_FORWARD_REF_TYPE = ReactSymbols.REACT_FORWARD_REF_TYPE local REACT_FRAGMENT_TYPE = ReactSymbols.REACT_FRAGMENT_TYPE @@ -25,7 +25,7 @@ local REACT_BLOCK_TYPE = ReactSymbols.REACT_BLOCK_TYPE local REACT_SERVER_BLOCK_TYPE = ReactSymbols.REACT_SERVER_BLOCK_TYPE local REACT_LEGACY_HIDDEN_TYPE = ReactSymbols.REACT_LEGACY_HIDDEN_TYPE --- local ReactFeatureFlags = require(script.Parent.ReactFeatureFlags) +-- local ReactFeatureFlags = require("./ReactFeatureFlags") -- local enableScopeAPI = ReactFeatureFlags.enableScopeAPI return function(type) diff --git a/modules/shared/src/shallowEqual.lua b/modules/shared/src/shallowEqual.lua index f009ef9c..7068d857 100644 --- a/modules/shared/src/shallowEqual.lua +++ b/modules/shared/src/shallowEqual.lua @@ -8,7 +8,7 @@ * * ]] -local is = require(script.Parent.objectIs) +local is = require("./objectIs") --[[* * Performs equality by iterating through keys on an object and returning false diff --git a/package.json b/package.json new file mode 100644 index 00000000..82f8344e --- /dev/null +++ b/package.json @@ -0,0 +1,19 @@ +{ + "name": "workspace", + "private": true, + "workspaces": [ + "modules/*" + ], + "scripts": { + "prepare": "npmluau", + "build-assets": "sh ./scripts/build-assets.sh", + "lint": "selene modules", + "format": "stylua modules", + "style-check": "stylua modules --check", + "clean": "rm -rf roblox build node_modules" + }, + "devDependencies": { + "commander": "^11.1.0", + "npmluau": "^0.1.1" + } +} diff --git a/roblox-model/React.lua b/roblox-model/React.lua new file mode 100644 index 00000000..80e3c436 --- /dev/null +++ b/roblox-model/React.lua @@ -0,0 +1 @@ +return require("@pkg/@jsdotlua/react") diff --git a/roblox-model/ReactCache.lua b/roblox-model/ReactCache.lua new file mode 100644 index 00000000..961739a4 --- /dev/null +++ b/roblox-model/ReactCache.lua @@ -0,0 +1 @@ +return require("@pkg/@jsdotlua/react-cache") diff --git a/roblox-model/ReactDebugTools.lua b/roblox-model/ReactDebugTools.lua new file mode 100644 index 00000000..3d9297e6 --- /dev/null +++ b/roblox-model/ReactDebugTools.lua @@ -0,0 +1 @@ +return require("@pkg/@jsdotlua/react-debug-tools") diff --git a/roblox-model/ReactDevtoolsExtensions.lua b/roblox-model/ReactDevtoolsExtensions.lua new file mode 100644 index 00000000..a2b99442 --- /dev/null +++ b/roblox-model/ReactDevtoolsExtensions.lua @@ -0,0 +1 @@ +return require("@pkg/@jsdotlua/react-devtools-extensions") diff --git a/roblox-model/ReactDevtoolsShared.lua b/roblox-model/ReactDevtoolsShared.lua new file mode 100644 index 00000000..c4c274d7 --- /dev/null +++ b/roblox-model/ReactDevtoolsShared.lua @@ -0,0 +1 @@ +return require("@pkg/@jsdotlua/react-devtools-shared") diff --git a/roblox-model/ReactIs.lua b/roblox-model/ReactIs.lua new file mode 100644 index 00000000..686fc2f1 --- /dev/null +++ b/roblox-model/ReactIs.lua @@ -0,0 +1 @@ +return require("@pkg/@jsdotlua/react-is") diff --git a/roblox-model/ReactReconciler.lua b/roblox-model/ReactReconciler.lua new file mode 100644 index 00000000..58629da5 --- /dev/null +++ b/roblox-model/ReactReconciler.lua @@ -0,0 +1 @@ +return require("@pkg/@jsdotlua/react-reconciler") diff --git a/roblox-model/ReactRoblox.lua b/roblox-model/ReactRoblox.lua new file mode 100644 index 00000000..2621a262 --- /dev/null +++ b/roblox-model/ReactRoblox.lua @@ -0,0 +1 @@ +return require("@pkg/@jsdotlua/react-roblox") diff --git a/roblox-model/ReactShallowRenderer.lua b/roblox-model/ReactShallowRenderer.lua new file mode 100644 index 00000000..d94f2540 --- /dev/null +++ b/roblox-model/ReactShallowRenderer.lua @@ -0,0 +1 @@ +return require("@pkg/@jsdotlua/react-shallow-renderer") diff --git a/roblox-model/ReactTestRenderer.lua b/roblox-model/ReactTestRenderer.lua new file mode 100644 index 00000000..aa72a10a --- /dev/null +++ b/roblox-model/ReactTestRenderer.lua @@ -0,0 +1 @@ +return require("@pkg/@jsdotlua/react-test-renderer") diff --git a/roblox-model/RoactCompat.lua b/roblox-model/RoactCompat.lua new file mode 100644 index 00000000..b7c33d65 --- /dev/null +++ b/roblox-model/RoactCompat.lua @@ -0,0 +1 @@ +return require("@pkg/@jsdotlua/roact-compat") diff --git a/roblox-model/Scheduler.lua b/roblox-model/Scheduler.lua new file mode 100644 index 00000000..7d0f9d74 --- /dev/null +++ b/roblox-model/Scheduler.lua @@ -0,0 +1 @@ +return require("@pkg/@jsdotlua/scheduler") diff --git a/roblox-model/Shared.lua b/roblox-model/Shared.lua new file mode 100644 index 00000000..0fd60e91 --- /dev/null +++ b/roblox-model/Shared.lua @@ -0,0 +1 @@ +return require("@pkg/@jsdotlua/shared") diff --git a/scripts/build-assets.sh b/scripts/build-assets.sh new file mode 100755 index 00000000..1df8d023 --- /dev/null +++ b/scripts/build-assets.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +set -e + +./scripts/build-roblox-model.sh +./scripts/build-wally-package.sh diff --git a/scripts/build-roblox-model.sh b/scripts/build-roblox-model.sh new file mode 100755 index 00000000..8645f0b2 --- /dev/null +++ b/scripts/build-roblox-model.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +set -e + +build_with_darklua_config () { + DARKLUA_CONFIG=$1 + OUTPUT=build/$2 + + rm -rf roblox + rm -f $OUTPUT + + mkdir -p roblox + + cp -rL node_modules/ roblox/ + cp -r roblox-model/ roblox/ + + for module_path in roblox/roblox-model/*; do + module_name=$(basename $module_path) + + react_module=$(cat $module_path | sed 's/return require(\"\@pkg\/\@jsdotlua\/\(.*\)\")/\1/') + alias_path=roblox/node_modules/.luau-aliases/@jsdotlua/$react_module.luau + + echo "local module = require('@pkg/@jsdotlua/${react_module}')" > $module_path + + tail -n +2 $alias_path >> $module_path + done + + ./scripts/remove-tests.sh roblox + + cp default.project.json roblox + + rojo sourcemap roblox/default.project.json -o roblox/sourcemap.json + + cp $DARKLUA_CONFIG roblox + + darklua process --config roblox/$DARKLUA_CONFIG roblox/node_modules roblox/node_modules + darklua process --config roblox/$DARKLUA_CONFIG roblox/roblox-model roblox/roblox-model + + mkdir -p $(dirname $OUTPUT) + + rojo build roblox/default.project.json -o $OUTPUT +} + +build_with_darklua_config .darklua.json react-lua.rbxm +build_with_darklua_config .darklua-dev.json debug/react-lua.rbxm diff --git a/scripts/build-wally-package.sh b/scripts/build-wally-package.sh new file mode 100755 index 00000000..dd4936d8 --- /dev/null +++ b/scripts/build-wally-package.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +set -e + +rm -rf roblox/node_modules + +mkdir -p roblox + +cp -rL node_modules/ roblox/ + +./scripts/remove-tests.sh roblox/node_modules + +rm -rf build/wally + +for module_path in modules/*; do + module_name=$(basename $module_path) + + original_package=node_modules/@jsdotlua/$module_name + + if [ -f $original_package/package.json ]; then + echo Process package $module_name + + wally_package=build/wally/$module_name + roblox_package=roblox/node_modules/@jsdotlua/$module_name + + mkdir -p $wally_package + mkdir -p $wally_package/src + cp LICENSE $wally_package/LICENSE + cp $original_package/default.project.json $wally_package + node ./scripts/npm-to-wally.js $roblox_package/package.json $wally_package/wally.toml $roblox_package/wally-package.project.json --workspace-path modules + + cp .darklua-wally.json $roblox_package + cp -r roblox/node_modules/.luau-aliases/* $roblox_package + + rojo sourcemap $roblox_package/wally-package.project.json --output $roblox_package/sourcemap.json + + darklua process --config $roblox_package/.darklua-wally.json $roblox_package/src $wally_package/src + + wally package --project-path $wally_package --list + + echo "" + fi +done + diff --git a/scripts/npm-to-wally.js b/scripts/npm-to-wally.js new file mode 100644 index 00000000..232e7429 --- /dev/null +++ b/scripts/npm-to-wally.js @@ -0,0 +1,144 @@ +#!/usr/bin/env node + +const { Command } = require("commander"); + +const fs = require("fs").promises; +const path = require("path"); +const process = require("process"); + +const readPackageConfig = async (packagePath) => { + const packageContent = await fs.readFile(packagePath).catch((err) => { + console.error(`unable to read package.json at '${packagePath}': ${err}`); + return null; + }); + + if (packageContent !== null) { + try { + const packageData = JSON.parse(packageContent); + return packageData; + } catch (error) { + console.error(`unable to parse package.json at '${packagePath}': ${err}`); + } + } + + return null; +}; + +const main = async ( + packageJsonPath, + wallyOutputPath, + rojoConfigPath, + { workspacePath } +) => { + const packageData = await readPackageConfig(packageJsonPath); + + const { name: scopedName, version, license, dependencies = [] } = packageData; + + const tomlLines = [ + "[package]", + `name = "${scopedName.substring(1)}"`, + `version = "${version}"`, + 'registry = "https://github.com/UpliftGames/wally-index"', + 'realm = "shared"', + `license = "${license}"`, + "", + "[dependencies]", + ]; + + const rojoConfig = { + name: "WallyPackage", + tree: { + $className: "Folder", + Package: { + $path: "src", + }, + }, + }; + + for (const [dependencyName, specifiedVersion] of Object.entries( + dependencies + )) { + const name = dependencyName.startsWith("@") + ? dependencyName.substring(dependencyName.indexOf("/") + 1) + : dependencyName; + + rojoConfig.tree[name] = { + $path: dependencyName + ".luau", + }; + + const wallyPackageName = name.indexOf("-") !== -1 ? `"${name}"` : name; + + if (specifiedVersion == "workspace:^") { + const dependentPackage = + workspacePath && + (await readPackageConfig( + path.join(workspacePath, name, "package.json") + )); + + if (dependentPackage) { + tomlLines.push( + `${wallyPackageName} = "jsdotlua/${name}@${dependentPackage.version}"` + ); + } else { + console.error(`unable to find version for package '${name}'`); + } + } else { + tomlLines.push( + `${wallyPackageName} = "jsdotlua/${name}@${specifiedVersion}"` + ); + } + } + + tomlLines.push(""); + + await Promise.all([ + fs.writeFile(wallyOutputPath, tomlLines.join("\n")).catch((err) => { + console.error( + `unable to write wally config at '${wallyOutputPath}': ${err}` + ); + }), + fs + .writeFile(rojoConfigPath, JSON.stringify(rojoConfig, null, 2)) + .catch((err) => { + console.error( + `unable to write rojo config at '${rojoConfigPath}': ${err}` + ); + }), + ]); +}; + +const createCLI = () => { + const program = new Command(); + + program + .name("npm-to-wally") + .description("a utility to convert npm packages to wally packages") + .argument("") + .argument("") + .argument("") + .option( + "--workspace-path ", + "the path containing all workspace members" + ) + .action( + async (packageJson, wallyToml, rojoConfig, { workspacePath = null }) => { + const cwd = process.cwd(); + main( + path.join(cwd, packageJson), + path.join(cwd, wallyToml), + path.join(cwd, rojoConfig), + { + workspacePath: workspacePath && path.join(cwd, workspacePath), + } + ); + } + ); + + return (args) => { + program.parse(args); + }; +}; + +const run = createCLI(); + +run(process.argv); diff --git a/scripts/remove-tests.sh b/scripts/remove-tests.sh new file mode 100755 index 00000000..7d3af7e1 --- /dev/null +++ b/scripts/remove-tests.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +set -e + +FOLDER=$1 + +find $FOLDER -name '__tests__' -type d -exec rm -r {} + +find $FOLDER -name '.robloxrc' -type f -exec rm -r {} + +find $FOLDER -name '*.spec.lua' -type f -exec rm -r {} + +find $FOLDER -name 'jest.config.lua' -type f -exec rm -r {} + diff --git a/selene.toml b/selene.toml index cd8f80ee..e06be2ee 100644 --- a/selene.toml +++ b/selene.toml @@ -1,4 +1,4 @@ -std = "roblox" +std = "selene_definitions" [config] empty_if = { comments_count = true } @@ -8,6 +8,7 @@ shadowing = { ignore_pattern = "result|ok|^_" } global_usage = { ignore_pattern = "^__" } [rules] +global_usage = "allow" unused_variable = "allow" # remove when the Luau type narrowing issues (and the workarounds) are resolved shadowing = "allow" diff --git a/selene_definitions.yml b/selene_definitions.yml new file mode 100644 index 00000000..95cabdf1 --- /dev/null +++ b/selene_definitions.yml @@ -0,0 +1,7 @@ +base: roblox +name: selene_defs +globals: + # override Roblox require style with string requires + require: + args: + - type: string diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 00000000..459549d5 --- /dev/null +++ b/yarn.lock @@ -0,0 +1,300 @@ +# This file is generated by running "yarn install" inside your project. +# Manual changes might be lost - proceed with caution! + +__metadata: + version: 8 + cacheKey: 10c0 + +"@jsdotlua/boolean@npm:^1.2.6": + version: 1.2.6 + resolution: "@jsdotlua/boolean@npm:1.2.6" + dependencies: + "@jsdotlua/number": "npm:^1.2.6" + checksum: 5f567e556bb7c56102327a97468571522ce939be6cdc1b51591afc3dfc1dff4b2c9ec5462e7809bd9a515b3bdfc1c3eaabb4f631892cb5f471b4fc8da188cb84 + languageName: node + linkType: hard + +"@jsdotlua/collections@npm:^1.2.6": + version: 1.2.6 + resolution: "@jsdotlua/collections@npm:1.2.6" + dependencies: + "@jsdotlua/es7-types": "npm:^1.2.6" + "@jsdotlua/instance-of": "npm:^1.2.6" + checksum: a4b3fe826358484528f10e8ca61a80d841a6515a22277a003117449da66ea1fb891c7b4103b952b01bd7d75666f26cb41c8efb852672aa8aaaaebbcd656dca79 + languageName: node + linkType: hard + +"@jsdotlua/console@npm:^1.2.6": + version: 1.2.6 + resolution: "@jsdotlua/console@npm:1.2.6" + dependencies: + "@jsdotlua/collections": "npm:^1.2.6" + checksum: eff658d9e8d23f932893facf18400a29ada54d1a24748b751aac1e4df48e92ff70b3b2ccd1ab6a4f2490dd709f826fe39427fb80f01a7574265fdd4e8af9187a + languageName: node + linkType: hard + +"@jsdotlua/es7-types@npm:^1.2.6": + version: 1.2.6 + resolution: "@jsdotlua/es7-types@npm:1.2.6" + checksum: e5710f5f6de0608aec22744845e3a24acc47e2bda6cfc0b1fe4040935039b73e8467da90c3a6c9d75b08c9f39d2b98e9d72d54f3f630012538a7d53ad828a0d6 + languageName: node + linkType: hard + +"@jsdotlua/instance-of@npm:^1.2.6": + version: 1.2.6 + resolution: "@jsdotlua/instance-of@npm:1.2.6" + checksum: 0958caf214bb0556c1dcf94096410c367f413af4b02ef3adbd733e47435d8734b583217804bed5aec8308d56ccfb39032bb12fd4337e01ec5ae2db690b2ca9ce + languageName: node + linkType: hard + +"@jsdotlua/luau-polyfill@npm:^1.2.6": + version: 1.2.6 + resolution: "@jsdotlua/luau-polyfill@npm:1.2.6" + dependencies: + "@jsdotlua/boolean": "npm:^1.2.6" + "@jsdotlua/collections": "npm:^1.2.6" + "@jsdotlua/console": "npm:^1.2.6" + "@jsdotlua/es7-types": "npm:^1.2.6" + "@jsdotlua/instance-of": "npm:^1.2.6" + "@jsdotlua/math": "npm:^1.2.6" + "@jsdotlua/number": "npm:^1.2.6" + "@jsdotlua/string": "npm:^1.2.6" + "@jsdotlua/timers": "npm:^1.2.6" + symbol-luau: "npm:^1.0.0" + checksum: 63265f9fde3b895400d12802929ddab5daed79efc4e2aa90325b2eea0e2b7addcf351d35ad8bb19955956e913c212408944d73b6f3126223893d17cecd24de61 + languageName: node + linkType: hard + +"@jsdotlua/math@npm:^1.2.6": + version: 1.2.6 + resolution: "@jsdotlua/math@npm:1.2.6" + checksum: 06137df2a6352d4f5c730a7cf9e2902509d36de08415a3c70d470a05669dfeaf48e4aff2d5b6885a92b8f4d19fd0294a40f147a3f39c8558e887a09eb3ccd9e0 + languageName: node + linkType: hard + +"@jsdotlua/number@npm:^1.2.6": + version: 1.2.6 + resolution: "@jsdotlua/number@npm:1.2.6" + checksum: 74541fce86f80c52f05e5d4ca774d94f08ed21619af7b575c2bb7284e24fc2b178626c9888e286459a344d662cafab74d839ec8b95dcdab551fd14754911a292 + languageName: node + linkType: hard + +"@jsdotlua/promise@npm:^3.5.0": + version: 3.5.0 + resolution: "@jsdotlua/promise@npm:3.5.0" + checksum: 8771dac525b8d608ad319040b742cdde8f4cbbd4a075ae02dad4d510c8ab739dabf7de40ae1b15211e3890331cf3e7d9454fdcb3ec9a08471663436c0e9ec977 + languageName: node + linkType: hard + +"@jsdotlua/react-cache@workspace:modules/react-cache": + version: 0.0.0-use.local + resolution: "@jsdotlua/react-cache@workspace:modules/react-cache" + dependencies: + "@jsdotlua/luau-polyfill": "npm:^1.2.6" + "@jsdotlua/react": "workspace:^" + "@jsdotlua/scheduler": "workspace:^" + "@jsdotlua/shared": "workspace:^" + npmluau: "npm:^0.1.0" + languageName: unknown + linkType: soft + +"@jsdotlua/react-debug-tools@workspace:^, @jsdotlua/react-debug-tools@workspace:modules/react-debug-tools": + version: 0.0.0-use.local + resolution: "@jsdotlua/react-debug-tools@workspace:modules/react-debug-tools" + dependencies: + "@jsdotlua/luau-polyfill": "npm:^1.2.6" + "@jsdotlua/react-reconciler": "workspace:^" + "@jsdotlua/shared": "workspace:^" + npmluau: "npm:^0.1.0" + languageName: unknown + linkType: soft + +"@jsdotlua/react-devtools-extensions@workspace:modules/react-devtools-extensions": + version: 0.0.0-use.local + resolution: "@jsdotlua/react-devtools-extensions@workspace:modules/react-devtools-extensions" + dependencies: + "@jsdotlua/luau-polyfill": "npm:^1.2.6" + "@jsdotlua/react": "workspace:^" + "@jsdotlua/react-devtools-shared": "workspace:^" + "@jsdotlua/react-roblox": "workspace:^" + "@jsdotlua/shared": "workspace:^" + npmluau: "npm:^0.1.0" + languageName: unknown + linkType: soft + +"@jsdotlua/react-devtools-shared@workspace:^, @jsdotlua/react-devtools-shared@workspace:modules/react-devtools-shared": + version: 0.0.0-use.local + resolution: "@jsdotlua/react-devtools-shared@workspace:modules/react-devtools-shared" + dependencies: + "@jsdotlua/luau-polyfill": "npm:^1.2.6" + "@jsdotlua/react": "workspace:^" + "@jsdotlua/react-debug-tools": "workspace:^" + "@jsdotlua/react-is": "workspace:^" + "@jsdotlua/react-reconciler": "workspace:^" + "@jsdotlua/react-roblox": "workspace:^" + "@jsdotlua/shared": "workspace:^" + npmluau: "npm:^0.1.0" + languageName: unknown + linkType: soft + +"@jsdotlua/react-is@workspace:^, @jsdotlua/react-is@workspace:modules/react-is": + version: 0.0.0-use.local + resolution: "@jsdotlua/react-is@workspace:modules/react-is" + dependencies: + "@jsdotlua/shared": "workspace:^" + npmluau: "npm:^0.1.0" + languageName: unknown + linkType: soft + +"@jsdotlua/react-reconciler@workspace:^, @jsdotlua/react-reconciler@workspace:modules/react-reconciler": + version: 0.0.0-use.local + resolution: "@jsdotlua/react-reconciler@workspace:modules/react-reconciler" + dependencies: + "@jsdotlua/luau-polyfill": "npm:^1.2.6" + "@jsdotlua/promise": "npm:^3.5.0" + "@jsdotlua/react": "workspace:^" + "@jsdotlua/scheduler": "workspace:^" + "@jsdotlua/shared": "workspace:^" + npmluau: "npm:^0.1.0" + languageName: unknown + linkType: soft + +"@jsdotlua/react-roblox@workspace:^, @jsdotlua/react-roblox@workspace:modules/react-roblox": + version: 0.0.0-use.local + resolution: "@jsdotlua/react-roblox@workspace:modules/react-roblox" + dependencies: + "@jsdotlua/luau-polyfill": "npm:^1.2.6" + "@jsdotlua/react": "workspace:^" + "@jsdotlua/react-reconciler": "workspace:^" + "@jsdotlua/scheduler": "workspace:^" + "@jsdotlua/shared": "workspace:^" + npmluau: "npm:^0.1.0" + languageName: unknown + linkType: soft + +"@jsdotlua/react-shallow-renderer@workspace:modules/react-shallow-renderer": + version: 0.0.0-use.local + resolution: "@jsdotlua/react-shallow-renderer@workspace:modules/react-shallow-renderer" + dependencies: + "@jsdotlua/luau-polyfill": "npm:^1.2.6" + "@jsdotlua/react": "workspace:^" + "@jsdotlua/react-is": "workspace:^" + "@jsdotlua/shared": "workspace:^" + npmluau: "npm:^0.1.0" + languageName: unknown + linkType: soft + +"@jsdotlua/react-test-renderer@workspace:modules/react-test-renderer": + version: 0.0.0-use.local + resolution: "@jsdotlua/react-test-renderer@workspace:modules/react-test-renderer" + dependencies: + "@jsdotlua/luau-polyfill": "npm:^1.2.6" + "@jsdotlua/react": "workspace:^" + "@jsdotlua/react-reconciler": "workspace:^" + "@jsdotlua/scheduler": "workspace:^" + "@jsdotlua/shared": "workspace:^" + npmluau: "npm:^0.1.0" + languageName: unknown + linkType: soft + +"@jsdotlua/react@workspace:^, @jsdotlua/react@workspace:modules/react": + version: 0.0.0-use.local + resolution: "@jsdotlua/react@workspace:modules/react" + dependencies: + "@jsdotlua/luau-polyfill": "npm:^1.2.6" + "@jsdotlua/shared": "workspace:^" + npmluau: "npm:^0.1.0" + languageName: unknown + linkType: soft + +"@jsdotlua/roact-compat@workspace:modules/roact-compat": + version: 0.0.0-use.local + resolution: "@jsdotlua/roact-compat@workspace:modules/roact-compat" + dependencies: + "@jsdotlua/luau-polyfill": "npm:^1.2.6" + "@jsdotlua/react": "workspace:^" + "@jsdotlua/react-roblox": "workspace:^" + "@jsdotlua/shared": "workspace:^" + npmluau: "npm:^0.1.0" + languageName: unknown + linkType: soft + +"@jsdotlua/scheduler@workspace:^, @jsdotlua/scheduler@workspace:modules/scheduler": + version: 0.0.0-use.local + resolution: "@jsdotlua/scheduler@workspace:modules/scheduler" + dependencies: + "@jsdotlua/luau-polyfill": "npm:^1.2.6" + "@jsdotlua/shared": "workspace:^" + npmluau: "npm:^0.1.0" + languageName: unknown + linkType: soft + +"@jsdotlua/shared@workspace:^, @jsdotlua/shared@workspace:modules/shared": + version: 0.0.0-use.local + resolution: "@jsdotlua/shared@workspace:modules/shared" + dependencies: + "@jsdotlua/luau-polyfill": "npm:^1.2.6" + npmluau: "npm:^0.1.0" + languageName: unknown + linkType: soft + +"@jsdotlua/string@npm:^1.2.6": + version: 1.2.6 + resolution: "@jsdotlua/string@npm:1.2.6" + dependencies: + "@jsdotlua/es7-types": "npm:^1.2.6" + "@jsdotlua/number": "npm:^1.2.6" + checksum: de51c662439110642b699e4196240aa45ec4b8814f99bc606acb84dbb3f1c6889099bb722b3370f5873e06bd65c76779b5d94694309c9bdc63d324f40add2b0f + languageName: node + linkType: hard + +"@jsdotlua/timers@npm:^1.2.6": + version: 1.2.6 + resolution: "@jsdotlua/timers@npm:1.2.6" + dependencies: + "@jsdotlua/collections": "npm:^1.2.6" + checksum: f3ec2753894e4939f7dfdf0072517f1e769e4009b4bd882c9c6878526372753ac4b08b531e1a32c96b7bccb5bf10bb8e2f5730cbc70534da7eddc620fbccaaca + languageName: node + linkType: hard + +"commander@npm:^11.0.0, commander@npm:^11.1.0": + version: 11.1.0 + resolution: "commander@npm:11.1.0" + checksum: 13cc6ac875e48780250f723fb81c1c1178d35c5decb1abb1b628b3177af08a8554e76b2c0f29de72d69eef7c864d12613272a71fabef8047922bc622ab75a179 + languageName: node + linkType: hard + +"npmluau@npm:^0.1.0, npmluau@npm:^0.1.1": + version: 0.1.1 + resolution: "npmluau@npm:0.1.1" + dependencies: + commander: "npm:^11.0.0" + walkdir: "npm:^0.4.1" + bin: + npmluau: main.js + checksum: 9ae22c0dcff9e85c90b4da4e8c17bc51e9b567b4a417c9767d355ff68faca4f99a2934b581743ebc8729f6851d1ba5b64597312151747252e040517d1794fbca + languageName: node + linkType: hard + +"symbol-luau@npm:^1.0.0": + version: 1.0.1 + resolution: "symbol-luau@npm:1.0.1" + checksum: ab51a77331b2d5e4666528bada17e67b26aea355257bba9e97351016cd1836bd19f372355a14cf5bef2f4d5bc6b32fe91aeb09698d7bdc079d2c61330bedf251 + languageName: node + linkType: hard + +"walkdir@npm:^0.4.1": + version: 0.4.1 + resolution: "walkdir@npm:0.4.1" + checksum: 88e635aa9303e9196e4dc15013d2bd4afca4c8c8b4bb27722ca042bad213bb882d3b9141b3b0cca6bfb274f7889b30cf58d6374844094abec0016f335c5414dc + languageName: node + linkType: hard + +"workspace@workspace:.": + version: 0.0.0-use.local + resolution: "workspace@workspace:." + dependencies: + commander: "npm:^11.1.0" + npmluau: "npm:^0.1.1" + languageName: unknown + linkType: soft