{"id":"vynx777/loader","name":"loader","scope":"vynx777","platform":"roblox","description":"A lightweight, strictly-typed bootstrapper for automated deep-requiring, lifecycle execution, and component registration.","version":"1.0.1","latest":"1.0.1","versions":["0.0.1","1.0.0","1.0.1"],"license":"MIT","licenseRating":"safe","licenseCaveats":["The package archive does not include its license text; the license is declared in its manifest metadata."],"licenseVerified":false,"dependencies":{},"integrity":"72e97df193e7a5cee78a74cc0e048b5d9c07c0c063278637585e68126c07ea8e","likes":0,"downloads":0,"install":"forest install vynx777/loader","url":"https://forest.dev/p/roblox/vynx777/loader","files":"https://api.forest.dev/ai/package/roblox/vynx777/loader/files","readme":"# Loader\r\n\r\nA minimal, single-call module bootstrapper for Roblox. Pass it folders or `ModuleScript`s and it will recursively find, require, initialize, and start everything — in that order.\r\n\r\n---\r\n\r\n## How it works\r\n\r\n`Loader.Init(...)` runs four steps in sequence:\r\n\r\n1. **Require** — recursively finds every `ModuleScript` in the provided paths and calls `require()` on it\r\n2. **Init** — calls `:Init()` on every loaded module that exposes one\r\n3. **Start** — calls `:Start()` on every loaded module that exposes one, each in its own `task.spawn`\r\n4. **Components** — if `Loader.AddComponents(...)` was called beforehand, requires all component modules after startup\r\n\r\n---\r\n\r\n## Installation\r\n\r\nPlace `Loader.luau` in `ReplicatedStorage` or `ServerScriptService` alongside your other shared modules and require it from your bootstrapper script.\r\n\r\n```lua\r\nlocal Loader = require(game.ServerScriptService.Loader)\r\n```\r\n\r\n---\r\n\r\n## Usage\r\n\r\n### Basic setup\r\n\r\n```lua\r\nlocal Loader = require(game.ServerScriptService.Loader)\r\n\r\nLoader.Init(\r\n    game.ServerScriptService.Services,\r\n    game.ReplicatedStorage.Shared\r\n)\r\n```\r\n\r\nLoader will walk every descendant of those folders, require all `ModuleScript`s it finds, then call `:Init()` and `:Start()` on each.\r\n\r\n### With components\r\n\r\n```lua\r\nlocal Loader = require(game.ServerScriptService.Loader)\r\n\r\n-- Must be called before Init\r\nLoader.AddComponents(\r\n    game.ReplicatedStorage.Components\r\n)\r\n\r\nLoader.Init(\r\n    game.ServerScriptService.Services\r\n)\r\n```\r\n\r\n`AddComponents` must be called **before** `Init`. The component modules are required after `:Start()` has run on all services.\r\n\r\n### Module shape\r\n\r\nLoader expects modules to return a table. `:Init()` and `:Start()` are both optional — Loader checks for them at runtime and skips any module that doesn't have them.\r\n\r\n```lua\r\n-- Services/MyService.lua\r\nlocal MyService = {}\r\n\r\nfunction MyService:Init()\r\n    -- runs synchronously before any :Start()\r\n    -- safe to set up state, bind events, etc.\r\nend\r\n\r\nfunction MyService:Start()\r\n    -- runs in its own task.spawn after all :Init() calls\r\n    -- safe to reference other services here\r\nend\r\n\r\nreturn MyService\r\n```\r\n\r\n---\r\n\r\n## API Reference\r\n\r\n### `Loader.Init(...: Folder | ModuleScript)`\r\n\r\nBootstraps the loader. Accepts any number of `Folder` or `ModuleScript` instances. Recursively requires all `ModuleScript` descendants, then runs `:Init()` and `:Start()` across all of them.\r\n\r\n> Can only be called **once**. Errors if called again.\r\n\r\n---\r\n\r\n### `Loader.AddComponents(...: Folder | ModuleScript)`\r\n\r\nRegisters folders or modules to be required as components after `Init` completes. Must be called **before** `Loader.Init`.\r\n\r\n> Can only be called once, and only before `Init`. Errors otherwise.\r\n\r\n---\r\n\r\n## Notes\r\n\r\n- `:Init()` calls are **synchronous** and blocking — all modules finish `:Init()` before any `:Start()` runs. This makes it safe to reference other services inside `:Start()`.\r\n- `:Start()` calls are wrapped in `task.spawn`, so a yielding or erroring `:Start()` will not block the rest.\r\n- Module names must be **unique** across all provided paths. Loader stores modules by `module.Name` — duplicate names will silently overwrite each other.\r\n- Components are required with a bare `require()` and are not tracked in the loaded module table, so they will not have `:Init()` or `:Start()` called on them automatically. Use components for self-registering patterns.\r\n- Loader is **not** a service locator. It does not expose a way to retrieve loaded modules by name. If your modules need to communicate, have them require each other directly.\r\n\r\n---\r\n\r\n## License\r\n\r\nMIT — see `LICENSE` for details.\r\n","readmeTruncated":false}