diff --git a/.darklua-dev.json b/.darklua-dev.json new file mode 100644 index 0000000..5da9e9a --- /dev/null +++ b/.darklua-dev.json @@ -0,0 +1,31 @@ +{ + "generator": "retain_lines", + "rules": [ + { + "current": { + "name": "path", + "sources": { + "lib": "lib" + } + }, + "rule": "convert_require", + "target": { + "indexing_style": "property", + "name": "roblox", + "rojo_sourcemap": "./sourcemap.json" + } + }, + { + "identifier": "__DEV__", + "rule": "inject_global_value", + "value": false + }, + "compute_expression", + "remove_unused_if_branch", + "remove_unused_while", + "filter_after_early_return", + "remove_nil_declaration", + "remove_empty_do", + "remove_spaces" + ] +} diff --git a/.darklua.json b/.darklua.json new file mode 100644 index 0000000..6f06681 --- /dev/null +++ b/.darklua.json @@ -0,0 +1,34 @@ +{ + "generator": { + "column_span": 9999999999, + "name": "dense" + }, + "rules": [ + { + "current": { + "name": "path", + "sources": { + "lib": "lib" + } + }, + "rule": "convert_require", + "target": { + "indexing_style": "property", + "name": "roblox", + "rojo_sourcemap": "./sourcemap.json" + } + }, + { + "identifier": "__DEV__", + "rule": "inject_global_value", + "value": false + }, + "compute_expression", + "remove_unused_if_branch", + "remove_unused_while", + "filter_after_early_return", + "remove_nil_declaration", + "remove_empty_do", + "remove_spaces" + ] +} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 17c0ece..51aac51 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -19,7 +19,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} - name: Run Selene run: | - selene src/ + selene lib/ formatting: name: Formatting runs-on: ubuntu-latest @@ -35,4 +35,4 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} version: v0.20.0 - args: --check src/ + args: --check lib/ diff --git a/.lune/build/builder.luau b/.lune/build/builder.luau new file mode 100644 index 0000000..d20b206 --- /dev/null +++ b/.lune/build/builder.luau @@ -0,0 +1,89 @@ +local fs = require("@lune/fs") +local path = require("../utils/path") +local pesdeTemplate = require("./templates/pesde") +local process = require("@lune/process") +local rojoProject = require("./templates/rojo") +local serde = require("@lune/serde") +local summon = require("../utils/summon") +local wallyTemplate = require("./templates/wally") + +local PATH_LIB = path(process.cwd, "lib") +local PATH_DIST = path(process.cwd, "dist") +local DARKLUA_DEV = path(process.cwd, ".darklua-dev.json") +local DARKLUA_STD = path(process.cwd, ".darklua.json") +local ROJO_PROJECT = path(process.cwd, "default.project.json") +local ROJO_SOURCEMAP = path(process.cwd, "sourcemap.json") + +local Builder = {} + +local function reset(dir: string) + if not fs.isDir(dir) then + fs.writeDir(dir) + else + for _, file in fs.readDir(dir) do + if fs.isFile(path(dir, file)) then + fs.removeFile(path(dir, file)) + end + end + end +end + +function Builder.build(props: { + createModel: boolean, + createRelease: boolean, + version: string, +}) + -- stylua: ignore + local createModel, createRelease, version = props.createModel, props.createRelease, props.version + assert( + version:match("^(%d+)%.?(%d*)%.?(%d*)(.-)$") ~= nil, + `{version} is not a valid semver version` + ) + + reset(PATH_DIST) + + print("Generating sourcemap") + summon("rojo", "sourcemap", ROJO_PROJECT, "-o", ROJO_SOURCEMAP) + + -- FIXME: Darklua is stinky & cant give good types on bundle + print("Processing library files") + local darkluaConfig = createRelease and DARKLUA_STD or DARKLUA_DEV + summon("darklua", "process", PATH_LIB, path(PATH_DIST, "lib"), "-c", darkluaConfig, "-v") + + fs.copy(path(process.cwd, "README.md"), path(PATH_DIST, "README.md")) + + print("Writing Rojo project") + fs.writeFile(path(PATH_DIST, "default.project.json"), serde.encode("json", rojoProject)) + + if createRelease then + print("Writing Wally config") + local wally = table.clone(wallyTemplate) + wally.package.version = version + fs.writeFile(path(PATH_DIST, "wally.toml"), serde.encode("toml", wally)) + + print("Writing Pesde config") + local pesde = table.clone(pesdeTemplate) + pesde.version = version + fs.writeFile(path(PATH_DIST, "pesde.yaml"), serde.encode("yaml", pesde)) + + print("Publishing") + summon("wally", "publish", "-v", "--project-path", PATH_DIST) + process.spawn("pesde", { "publish" }, { + shell = true, + cwd = PATH_DIST, + }) + end + + if createModel then + print("Creating Roblox model") + summon( + "rojo", + "build", + path(PATH_DIST, "default.project.json"), + "-o", + path(PATH_DIST, "pretty-fusion-utils.rbxm") + ) + end +end + +return Builder diff --git a/.lune/build/init.luau b/.lune/build/init.luau new file mode 100644 index 0000000..35762b3 --- /dev/null +++ b/.lune/build/init.luau @@ -0,0 +1,23 @@ +--!strict +-- (c) Prvd 'M Wrong, dual-licensed under MIT or Apache 2.0 terms. + +local Builder = require("./builder") +local stdio = require("@lune/stdio") + +local createModel = stdio.prompt("confirm", "Create .rbxm models?") +local createRelease = stdio.prompt("confirm", "Release to Wally/Pesde?") +local version = "0.0.0-dev" +if createRelease then + local promptedVersion = stdio.prompt("text", "Semver version to publish as?") + assert( + promptedVersion:match("^(%d+)%.?(%d*)%.?(%d*)(.-)$") ~= nil, + `{version} is not a valid semver version` + ) + version = promptedVersion +end + +Builder.build { + createModel = createModel, + createRelease = createRelease, + version = version, +} diff --git a/.lune/build/templates/pesde.luau b/.lune/build/templates/pesde.luau new file mode 100644 index 0000000..29fafa6 --- /dev/null +++ b/.lune/build/templates/pesde.luau @@ -0,0 +1,16 @@ +return { + name = "znotfireman/pretty_fusion_utils", + description = "An opinionated collection of modern Fusion 0.3 utilities.", + version = (nil :: any) :: string, + license = "MIT", + authors = { "znotfireman " }, + realm = "shared", + repository = "https://github.com/znotfireman/pretty-fusion-utils", + indices = { + default = "https://github.com/daimond113/pesde-index", + }, + exports = { + lib = "./lib/init.luau", + }, + dependencies = {}, +} diff --git a/.lune/build/templates/rojo.luau b/.lune/build/templates/rojo.luau new file mode 100644 index 0000000..5d32a63 --- /dev/null +++ b/.lune/build/templates/rojo.luau @@ -0,0 +1,6 @@ +return { + name = "pretty-fusion-utils", + tree = { + ["$path"] = "lib", + }, +} diff --git a/.lune/build/templates/wally.luau b/.lune/build/templates/wally.luau new file mode 100644 index 0000000..a2d2f0c --- /dev/null +++ b/.lune/build/templates/wally.luau @@ -0,0 +1,14 @@ +return { + package = { + name = "znotfireman/pretty-fusion-utils", + description = "An opinionated collection of modern Fusion 0.3 utilities.", + version = (nil :: any) :: string, + license = "Apache-2.0 OR MIT", + authors = { "znotfireman " }, + realm = "shared", + repository = "https://github.com/znotfireman/pretty-fusion-utils", + registry = "https://github.com/UpliftGames/wally-index", + include = { "./lib", "./default.project.json" }, + exclude = { "node_modules" }, + }, +} diff --git a/.lune/regen/regenerator.luau b/.lune/regen/regenerator.luau index bfb3c28..eab0c5d 100644 --- a/.lune/regen/regenerator.luau +++ b/.lune/regen/regenerator.luau @@ -8,7 +8,7 @@ local serde = require("@lune/serde") local stringer = require("../utils/stringer") local PATH_DOCS = path(process.cwd, "docs") -local PATH_SRC = path(process.cwd, "src") +local PATH_LIB = path(process.cwd, "lib") local TEMPLATE_INDEX = path(process.cwd, ".lune", "regen", "templates", "index.md") local function reset(dir: string) @@ -25,8 +25,8 @@ end local utils = {} -for _, dir in fs.readDir(PATH_SRC) do - local dirPath, configPath = path(PATH_SRC, dir), path(PATH_SRC, dir, "doc.toml") +for _, dir in fs.readDir(PATH_LIB) do + local dirPath, configPath = path(PATH_LIB, dir), path(PATH_LIB, dir, "doc.toml") if not fs.isDir(dirPath) or not fs.isFile(configPath) then continue end @@ -55,10 +55,10 @@ function Regenerator.initFile() for _, util in utils do print("Exporting", util.config.name) - initFile:appendLine(util.config.name, "=", `require("src/{util.dir}"),`) + initFile:appendLine(util.config.name, "=", `require("lib/{util.dir}"),`) end - fs.writeFile(path(PATH_SRC, "init.luau"), initFile:unIndent():appendLine("}"):build()) + fs.writeFile(path(PATH_LIB, "init.luau"), initFile:unIndent():appendLine("}"):build()) end function Regenerator.mkdocsConfig() @@ -212,11 +212,11 @@ function Regenerator.regenerate() :append(codeDocumentation:build()) pages[util] = content:build() - fs.writeFile(path(PATH_SRC, util.dir, "README.md"), content:build()) + fs.writeFile(path(PATH_LIB, util.dir, "README.md"), content:build()) - local srcFilepath = path(PATH_SRC, util.dir, "init.luau") - local srcFile = fs.readFile(srcFilepath) - fs.writeFile(srcFilepath, (srcFile:gsub("%-%-%[=%[.*]=]", function() + local libFilepath = path(PATH_LIB, util.dir, "init.luau") + local libFile = fs.readFile(libFilepath) + fs.writeFile(libFilepath, (libFile:gsub("%-%-%[=%[.*]=]", function() return docComment:append("]=]"):unIndent():build() end))) end diff --git a/.vscode/settings.json b/.vscode/settings.json index 64ddc14..6480a59 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,6 +2,6 @@ "luau-lsp.require.mode": "relativeToFile", "luau-lsp.require.directoryAliases": { "@lune/": "~/.lune/.typedefs/0.8.8/", - "src": "src" + "lib": "lib" } -} \ No newline at end of file +} diff --git a/README.md b/README.md index a1fa93a..6fabe7c 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@

Flower bouquet with Fusion accent colorsFlower bouquet with Fusion accent colors

@@ -49,11 +49,11 @@ specific Fusion utilities. - [X] `useTasks` - [X] `useThread` - [X] `useAsync` (analogous to [Fusion Eventuals]) -- [X] `useEffect` (somewhat broken, see `src/use-effect/init.luau`) +- [X] `useEffect` (somewhat broken, see `lib/use-effect/init.luau`) ### Misc -- [ ] Darklua setup & build system +- [X] Darklua setup & build system - [ ] TypeScript support (waiting for `@rbxts/fusion@0.3`, may defer to using `@znotfireman/fusion`) - [ ] Memoize utility for some utilities e.g. `usePx` really should be cached diff --git a/default.project.json b/default.project.json index bca2577..a162420 100644 --- a/default.project.json +++ b/default.project.json @@ -1,6 +1,6 @@ { "name": "pretty-fusion-utils", "tree": { - "$path": "src" + "$path": "lib" } -} \ No newline at end of file +} diff --git a/lib/init.luau b/lib/init.luau new file mode 100644 index 0000000..dcafae7 --- /dev/null +++ b/lib/init.luau @@ -0,0 +1,19 @@ +-- This file was @generated and is not intended for manual editing. +-- Run `lune run regen` to generate a fresh init file. + +return table.freeze { + useAsync = require("lib/use-async"), + useCamera = require("lib/use-camera"), + useCoroutine = require("lib/use-coroutine"), + useEffect = require("lib/use-effect"), + useEventListener = require("lib/use-event-listener"), + useInterval = require("lib/use-interval"), + useMouse = require("lib/use-mouse"), + usePrevious = require("lib/use-previous"), + usePx = require("lib/use-px"), + useTagged = require("lib/use-tagged"), + useTasks = require("lib/use-tasks"), + useThread = require("lib/use-thread"), + useTimer = require("lib/use-timer"), + useViewport = require("lib/use-viewport"), +} diff --git a/src/types.luau b/lib/types.luau similarity index 100% rename from src/types.luau rename to lib/types.luau diff --git a/src/use-async/README.md b/lib/use-async/README.md similarity index 100% rename from src/use-async/README.md rename to lib/use-async/README.md diff --git a/src/use-async/doc.toml b/lib/use-async/doc.toml similarity index 100% rename from src/use-async/doc.toml rename to lib/use-async/doc.toml diff --git a/src/use-async/init.luau b/lib/use-async/init.luau similarity index 94% rename from src/use-async/init.luau rename to lib/use-async/init.luau index 4c25104..4b36f46 100644 --- a/src/use-async/init.luau +++ b/lib/use-async/init.luau @@ -1,6 +1,6 @@ -local Types = require("src/types") -local castToState = require("src/utils/cast-to-state") -local lockValue = require("src/utils/lock-value") +local Types = require("lib/types") +local castToState = require("lib/utils/cast-to-state") +local lockValue = require("lib/utils/lock-value") type Become = (value: T) -> T diff --git a/src/use-camera/README.md b/lib/use-camera/README.md similarity index 100% rename from src/use-camera/README.md rename to lib/use-camera/README.md diff --git a/src/use-camera/doc.toml b/lib/use-camera/doc.toml similarity index 100% rename from src/use-camera/doc.toml rename to lib/use-camera/doc.toml diff --git a/src/use-camera/init.luau b/lib/use-camera/init.luau similarity index 81% rename from src/use-camera/init.luau rename to lib/use-camera/init.luau index 6472498..8dc2014 100644 --- a/src/use-camera/init.luau +++ b/lib/use-camera/init.luau @@ -1,8 +1,8 @@ local Workspace = game:GetService("Workspace") -local Types = require("src/types") -local lockValue = require("src/utils/lock-value") -local useEventListener = require("src/use-event-listener") +local Types = require("lib/types") +local lockValue = require("lib/utils/lock-value") +local useEventListener = require("lib/use-event-listener") local onCameraChanged = Workspace:GetPropertyChangedSignal("CurrentCamera") diff --git a/src/use-coroutine/README.md b/lib/use-coroutine/README.md similarity index 100% rename from src/use-coroutine/README.md rename to lib/use-coroutine/README.md diff --git a/src/use-coroutine/doc.toml b/lib/use-coroutine/doc.toml similarity index 100% rename from src/use-coroutine/doc.toml rename to lib/use-coroutine/doc.toml diff --git a/src/use-coroutine/init.luau b/lib/use-coroutine/init.luau similarity index 95% rename from src/use-coroutine/init.luau rename to lib/use-coroutine/init.luau index 153aea0..ae36093 100644 --- a/src/use-coroutine/init.luau +++ b/lib/use-coroutine/init.luau @@ -1,4 +1,4 @@ -local Types = require("src/types") +local Types = require("lib/types") --[=[ Spawns a new coroutine that is closed once the scope is cleaned up. diff --git a/src/use-effect/README.md b/lib/use-effect/README.md similarity index 100% rename from src/use-effect/README.md rename to lib/use-effect/README.md diff --git a/src/use-effect/doc.toml b/lib/use-effect/doc.toml similarity index 100% rename from src/use-effect/doc.toml rename to lib/use-effect/doc.toml diff --git a/src/use-effect/init.luau b/lib/use-effect/init.luau similarity index 94% rename from src/use-effect/init.luau rename to lib/use-effect/init.luau index 518db41..39b6fdd 100644 --- a/src/use-effect/init.luau +++ b/lib/use-effect/init.luau @@ -1,4 +1,4 @@ -local Types = require("src/types") +local Types = require("lib/types") local function doNothing() end diff --git a/src/use-event-listener/README.md b/lib/use-event-listener/README.md similarity index 100% rename from src/use-event-listener/README.md rename to lib/use-event-listener/README.md diff --git a/src/use-event-listener/doc.toml b/lib/use-event-listener/doc.toml similarity index 100% rename from src/use-event-listener/doc.toml rename to lib/use-event-listener/doc.toml diff --git a/src/use-event-listener/init.luau b/lib/use-event-listener/init.luau similarity index 98% rename from src/use-event-listener/init.luau rename to lib/use-event-listener/init.luau index 2de8392..661c3c3 100644 --- a/src/use-event-listener/init.luau +++ b/lib/use-event-listener/init.luau @@ -1,4 +1,4 @@ -local Types = require("src/types") +local Types = require("lib/types") type EventLike = RBXScriptConnection diff --git a/src/use-interval/README.md b/lib/use-interval/README.md similarity index 100% rename from src/use-interval/README.md rename to lib/use-interval/README.md diff --git a/src/use-interval/doc.toml b/lib/use-interval/doc.toml similarity index 100% rename from src/use-interval/doc.toml rename to lib/use-interval/doc.toml diff --git a/src/use-interval/init.luau b/lib/use-interval/init.luau similarity index 91% rename from src/use-interval/init.luau rename to lib/use-interval/init.luau index 39f2394..2fba2c7 100644 --- a/src/use-interval/init.luau +++ b/lib/use-interval/init.luau @@ -1,8 +1,8 @@ local RunService = game:GetService("RunService") -local Types = require("src/types") -local useEventListener = require("src/use-event-listener") -local useThread = require("src/use-thread") +local Types = require("lib/types") +local useEventListener = require("lib/use-event-listener") +local useThread = require("lib/use-thread") --[=[ Sets an interval that runs the callback function every `delay` seconds. If `delay` is `undefined`, the interval is cleared. If the delay changes, the the interval is cleared. If the delay changes, the interval is reset. diff --git a/src/use-mouse/README.md b/lib/use-mouse/README.md similarity index 100% rename from src/use-mouse/README.md rename to lib/use-mouse/README.md diff --git a/src/use-mouse/doc.toml b/lib/use-mouse/doc.toml similarity index 100% rename from src/use-mouse/doc.toml rename to lib/use-mouse/doc.toml diff --git a/src/use-mouse/init.luau b/lib/use-mouse/init.luau similarity index 92% rename from src/use-mouse/init.luau rename to lib/use-mouse/init.luau index acb643a..a14f66c 100644 --- a/src/use-mouse/init.luau +++ b/lib/use-mouse/init.luau @@ -1,7 +1,7 @@ local UserInputService = game:GetService("UserInputService") -local Types = require("src/types") -local lockValue = require("src/utils/lock-value") +local Types = require("lib/types") +local lockValue = require("lib/utils/lock-value") --[=[ Returns a state object with the mouse position. Updates when the mouse position changes. diff --git a/src/use-previous/README.md b/lib/use-previous/README.md similarity index 100% rename from src/use-previous/README.md rename to lib/use-previous/README.md diff --git a/src/use-previous/doc.toml b/lib/use-previous/doc.toml similarity index 100% rename from src/use-previous/doc.toml rename to lib/use-previous/doc.toml diff --git a/src/use-previous/init.luau b/lib/use-previous/init.luau similarity index 93% rename from src/use-previous/init.luau rename to lib/use-previous/init.luau index 461c6c0..6930469 100644 --- a/src/use-previous/init.luau +++ b/lib/use-previous/init.luau @@ -1,5 +1,5 @@ -local Types = require("src/types") -local lockValue = require("src/utils/lock-value") +local Types = require("lib/types") +local lockValue = require("lib/utils/lock-value") local function isSimilar(a: unknown, b: unknown): boolean local typeA = typeof(a) diff --git a/src/use-px/README.md b/lib/use-px/README.md similarity index 100% rename from src/use-px/README.md rename to lib/use-px/README.md diff --git a/src/use-px/doc.toml b/lib/use-px/doc.toml similarity index 100% rename from src/use-px/doc.toml rename to lib/use-px/doc.toml diff --git a/src/use-px/init.luau b/lib/use-px/init.luau similarity index 96% rename from src/use-px/init.luau rename to lib/use-px/init.luau index a2adf5a..06315bb 100644 --- a/src/use-px/init.luau +++ b/lib/use-px/init.luau @@ -1,5 +1,5 @@ -local Types = require("src/types") -local useViewport = require("src/use-viewport") +local Types = require("lib/types") +local useViewport = require("lib/use-viewport") type Px = typeof(setmetatable( {} :: { diff --git a/src/use-tagged/README.md b/lib/use-tagged/README.md similarity index 100% rename from src/use-tagged/README.md rename to lib/use-tagged/README.md diff --git a/src/use-tagged/doc.toml b/lib/use-tagged/doc.toml similarity index 100% rename from src/use-tagged/doc.toml rename to lib/use-tagged/doc.toml diff --git a/src/use-tagged/init.luau b/lib/use-tagged/init.luau similarity index 88% rename from src/use-tagged/init.luau rename to lib/use-tagged/init.luau index 78678a3..9a58ecf 100644 --- a/src/use-tagged/init.luau +++ b/lib/use-tagged/init.luau @@ -1,8 +1,8 @@ local CollectionService = game:GetService("CollectionService") -local Types = require("src/types") -local lockValue = require("src/utils/lock-value") -local useEventListener = require("src/use-event-listener") +local Types = require("lib/types") +local lockValue = require("lib/utils/lock-value") +local useEventListener = require("lib/use-event-listener") --[=[ Returns a state object with every instance of a given tag. Updates when new instances get tagged or old instances get untagged. diff --git a/src/use-tasks/README.md b/lib/use-tasks/README.md similarity index 100% rename from src/use-tasks/README.md rename to lib/use-tasks/README.md diff --git a/src/use-tasks/doc.toml b/lib/use-tasks/doc.toml similarity index 100% rename from src/use-tasks/doc.toml rename to lib/use-tasks/doc.toml diff --git a/src/use-tasks/init.luau b/lib/use-tasks/init.luau similarity index 92% rename from src/use-tasks/init.luau rename to lib/use-tasks/init.luau index 3e56d3a..c779bfc 100644 --- a/src/use-tasks/init.luau +++ b/lib/use-tasks/init.luau @@ -1,4 +1,4 @@ -local Types = require("src/types") +local Types = require("lib/types") --[=[ Add clean up tasks to the scope. Returns the clean up tasks, allowing it to be used in declarations. diff --git a/src/use-thread/README.md b/lib/use-thread/README.md similarity index 100% rename from src/use-thread/README.md rename to lib/use-thread/README.md diff --git a/src/use-thread/doc.toml b/lib/use-thread/doc.toml similarity index 100% rename from src/use-thread/doc.toml rename to lib/use-thread/doc.toml diff --git a/src/use-thread/init.luau b/lib/use-thread/init.luau similarity index 94% rename from src/use-thread/init.luau rename to lib/use-thread/init.luau index a32bccc..f5970b0 100644 --- a/src/use-thread/init.luau +++ b/lib/use-thread/init.luau @@ -1,4 +1,4 @@ -local Types = require("src/types") +local Types = require("lib/types") --[=[ Spawns a new thread that is cancelled once the scope is cleaned up. diff --git a/src/use-timer/README.md b/lib/use-timer/README.md similarity index 100% rename from src/use-timer/README.md rename to lib/use-timer/README.md diff --git a/src/use-timer/doc.toml b/lib/use-timer/doc.toml similarity index 100% rename from src/use-timer/doc.toml rename to lib/use-timer/doc.toml diff --git a/src/use-timer/init.luau b/lib/use-timer/init.luau similarity index 91% rename from src/use-timer/init.luau rename to lib/use-timer/init.luau index 4445551..9e324df 100644 --- a/src/use-timer/init.luau +++ b/lib/use-timer/init.luau @@ -1,7 +1,7 @@ local RunService = game:GetService("RunService") -local Types = require("src/types") -local useEventListener = require("src/use-event-listener") +local Types = require("lib/types") +local useEventListener = require("lib/use-event-listener") type Timer = Types.Value & { start: (self: Timer) -> (), diff --git a/src/use-viewport/README.md b/lib/use-viewport/README.md similarity index 100% rename from src/use-viewport/README.md rename to lib/use-viewport/README.md diff --git a/src/use-viewport/doc.toml b/lib/use-viewport/doc.toml similarity index 100% rename from src/use-viewport/doc.toml rename to lib/use-viewport/doc.toml diff --git a/src/use-viewport/init.luau b/lib/use-viewport/init.luau similarity index 88% rename from src/use-viewport/init.luau rename to lib/use-viewport/init.luau index 872d984..1a54623 100644 --- a/src/use-viewport/init.luau +++ b/lib/use-viewport/init.luau @@ -1,6 +1,6 @@ -local Types = require("src/types") -local lockValue = require("src/utils/lock-value") -local useCamera = require("src/use-camera") +local Types = require("lib/types") +local lockValue = require("lib/utils/lock-value") +local useCamera = require("lib/use-camera") --[=[ Returns the current viewport size. Updates when the current camera changes or when the viewport size is changed. diff --git a/src/utils/cast-to-state.luau b/lib/utils/cast-to-state.luau similarity index 91% rename from src/utils/cast-to-state.luau rename to lib/utils/cast-to-state.luau index 8052f8e..ed6987b 100644 --- a/src/utils/cast-to-state.luau +++ b/lib/utils/cast-to-state.luau @@ -1,4 +1,4 @@ -local Types = require("src/types") +local Types = require("lib/types") --[=[ Only returns the value if it can be assumed to be a state object. diff --git a/src/utils/lock-value.luau b/lib/utils/lock-value.luau similarity index 90% rename from src/utils/lock-value.luau rename to lib/utils/lock-value.luau index 4d38391..75201fa 100644 --- a/src/utils/lock-value.luau +++ b/lib/utils/lock-value.luau @@ -1,4 +1,4 @@ -local Types = require("src/types") +local Types = require("lib/types") --[=[ Widens the type of a value object so setting it returns a type error. diff --git a/rokit.toml b/rokit.toml index d64db83..27bb488 100644 --- a/rokit.toml +++ b/rokit.toml @@ -4,6 +4,8 @@ # New tools can be added by running `rokit add ` in a terminal. [tools] -rojo = "rojo-rbx/rojo@7.4.4" -lune = "lune-org/lune@0.8.8" -selene = "Kampfkarren/selene@0.27.1" + darklua = "seaofvoices/darklua@0.13.1" + lune = "lune-org/lune@0.8.8" + pesde = "daimond113/pesde@0.4.7" + rojo = "rojo-rbx/rojo@7.4.4" + selene = "Kampfkarren/selene@0.27.1" diff --git a/src/init.luau b/src/init.luau deleted file mode 100644 index 0ee30a2..0000000 --- a/src/init.luau +++ /dev/null @@ -1,19 +0,0 @@ --- This file was @generated and is not intended for manual editing. --- Run `lune run regen` to generate a fresh init file. - -return table.freeze { - useAsync = require("src/use-async"), - useCamera = require("src/use-camera"), - useCoroutine = require("src/use-coroutine"), - useEffect = require("src/use-effect"), - useEventListener = require("src/use-event-listener"), - useInterval = require("src/use-interval"), - useMouse = require("src/use-mouse"), - usePrevious = require("src/use-previous"), - usePx = require("src/use-px"), - useTagged = require("src/use-tagged"), - useTasks = require("src/use-tasks"), - useThread = require("src/use-thread"), - useTimer = require("src/use-timer"), - useViewport = require("src/use-viewport"), -}