feat: Luau and Lua config support with hooks and documentation#25
Open
siriuslatte wants to merge 10 commits into
Open
feat: Luau and Lua config support with hooks and documentation#25siriuslatte wants to merge 10 commits into
siriuslatte wants to merge 10 commits into
Conversation
Lithos can now load Luau and Lua project configs through the Lune runtime. Discovery checks lithos.yml, lithos.yaml, lithos.json, lithos.luau, lithos.lua, then legacy mantle.* files; explicit .luau and .lua paths are honored. Evaluation runs in a Lune subprocess via a self-cleaning wrapper script, decodes the returned table from JSON, and surfaces runtime, shape, and schema errors with the offending config path.
Luau project tables may now expose an onConfigLoaded function alongside config, which the Lune wrapper invokes synchronously and whose return value (when a table) replaces the decoded config. Other on*-prefixed callbacks are reported back to Lithos as registered hooks so future deploy lifecycle steps can route into them.
Adds a Luau-and-Lua section to the configuration page covering Lune installation, the return-table contract, repetition-reducing helpers, and the onConfigLoaded hook. Adds an examples/projects/luau-config sample that exercises the same ideas end-to-end.
Extends the YAML-to-tabs remark plugin (in both docs/site and docs/packages/lib) to emit a third Luau tab alongside YAML and JSON, generated from the parsed YAML value as a Luau return-table literal with idiomatic key formatting. Switches the existing inline luau fences to lang=lua so shiki highlights them.
Pass storageKey to nextra Tabs so picking the Luau (or JSON) tab on any Lithos config example carries across pages, since SSR only renders the active tab panel. Adds a 'What about Luau and Lua?' subsection explaining that the JSON schema validates the runtime-evaluated Luau table and recommending luau-lsp for in-file authoring support.
Walks the YAML AST to map every input line to a key path, then re-emits JSON and Luau with per-path line tracking so a YAML `{4,6-7,10}` highlight becomes the equivalent `{5,7-8,13}` in the JSON and Luau tabs. Previously the meta was copied verbatim, which placed the highlight bar on the wrong rows.
Drops the content-based fallback in shouldTransform so partial YAML snippets (without a `filename=` meta) stay plain YAML instead of being converted into JSON/Luau tabs. Fixes the environments page where small illustrative snippets were rendering as full config tabs out of step with the surrounding prose.
The `layout: 'full'` setting in the reference page meta also strips the Nextra breadcrumb, leaving its top area visibly inconsistent with the rest of the docs. Switch to the default layout while keeping the TOC hidden so the breadcrumb returns and the page header matches every other docs page.
Contributor
|
Docs preview: https://siriuslatte.github.io/lithos/previews/pr-25 This preview is rebuilt from the current full PR diff against |
Owner
Author
|
I have yet to test this even further. |
Bumps the lithos crate, foreman example, and README install snippet from 0.4.0 to 0.4.0-beta.2, and records a changelog entry covering Luau project configs (Lune-based evaluator + on* hooks) and the new YAML/JSON/Luau docs tabs.
… templates Updates the migrating-from-mantle Foreman snippet, the home page version badge, and the bug-report issue template placeholder to match the bumped crate version.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds first-class support for using Luau or Lua scripts as project configuration files in Lithos, alongside the existing YAML and JSON formats. It updates the documentation, discovery logic, and configuration loading to recognize and execute
.luauand.luafiles using the Lune runtime, enabling dynamic configs and lifecycle hooks. The documentation is expanded with usage instructions, examples, and caveats for editor support, and a new example project demonstrates the feature.Luau/Lua Configuration Support:
.luauand.luafiles as valid Lithos config formats, updating config discovery to prefer YAML/JSON over Luau/Lua, and Luau over Lua. The loader now invokes the Lune runtime to evaluate these files and extract the config table, including support for synchronous and future hook functions. [1] [2] [3] [4] [5] [6]Documentation Updates:
Examples:
examples/projects/luau-config) showcasing a Luau-based config with helpers, loops, and a hook, and updated the examples index. [1] [2] [3]UI/Docs Minor Improvements:
Other: