@lariocpt/crust-site 0.0.0-stage → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Lario Borges
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,100 @@
1
- # Temporary Holding Version
1
+ # @lariocpt/crust-site
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The crust site generator: a static-site compiler with a **fenced template
4
+ API** (interpolated values are escaped and range-tracked; a post-render
5
+ fence fails the build when a value crosses a script/comment/attribute
6
+ boundary), strict content validation that never reports a false pass,
7
+ content-hashed assets, and a publish swap that never corrupts your last
8
+ good build.
9
+
10
+ It runs under **plain Bun (>= 1.4)** — `bunx @lariocpt/crust-site build` — or through
11
+ `crust site build|dev` in Bun-native and loaded crust. Compiled core/mongo
12
+ crust retain a nonzero redirect; loaded is a directory with private Bun,
13
+ not another compiled binary. **Windows is supported for this package**
14
+ under `bun`/`bunx`; crust editions stay linux/darwin-only.
15
+
16
+ Native/loaded select the compatible installed site relative to the config's
17
+ project/workspace (including hoisted workspaces), never just shell cwd.
18
+ Declared but missing, broken or incompatible project packages fail without
19
+ fallback. Only loaded uses its bundled site when no project site is selected.
20
+ Runtime commands never install packages. Pin a local `@lariocpt/crust-site` for editor
21
+ types and reproducible CI; loaded fallback supplies execution, not local types.
22
+
23
+ Full reference: **[docs/USAGE.md](./docs/USAGE.md)**.
24
+
25
+ ## Quickstart
26
+
27
+ ```ts
28
+ // site.config.ts
29
+ import { defineSite, html } from "@lariocpt/crust-site";
30
+ import type { LayoutContext } from "@lariocpt/crust-site";
31
+
32
+ export default defineSite({
33
+ site: "https://example.dev",
34
+ content: {
35
+ directory: "content",
36
+ defaultLayout: "base",
37
+ route: ({ relativePath }) => (relativePath === "index" ? "/" : `/${relativePath}`),
38
+ },
39
+ layouts: {
40
+ base: (ctx: LayoutContext) => html`<!doctype html>
41
+ <html lang="en"><head><meta charset="utf-8">${ctx.head()}${ctx.stylesheet("site")}</head>
42
+ <body>${ctx.content}</body></html>`,
43
+ },
44
+ assets: { styles: { site: "assets/site.css" } },
45
+ output: { directory: "dist" },
46
+ });
47
+ ```
48
+
49
+ Add a `content/index.md` whose first line is a `---` frontmatter block with
50
+ a `title`, then:
51
+
52
+ ```sh
53
+ bun add -d @lariocpt/crust-site
54
+ bunx @lariocpt/crust-site build # → dist/index.html, 404.html, sitemap.xml, assets/site-<hash>.css
55
+ bunx @lariocpt/crust-site dev # dev server: drafts + banner, rebuilds on change
56
+ ```
57
+
58
+ ## What you get
59
+
60
+ ```ts
61
+ const result = await build({ configFile: "./site.config.ts" });
62
+ // result.pages — every route with its source file and emitted file
63
+ // result.assets — manifest name → assets/<name>-<sha256-16>.<ext>
64
+ // result.warnings — every warning-severity diagnostic, sorted
65
+ ```
66
+
67
+ - **No false passes.** Broken internal links, dead fragments, missing
68
+ metadata, fence violations — every problem is a located diagnostic, and a
69
+ failed build rejects with all of them while the previous output stays
70
+ untouched.
71
+ - **Deterministic.** Byte-identical rebuilds: lexicographic ordering, no
72
+ timestamps, LF-only output.
73
+ - **Strict by design.** Unknown config keys and unknown frontmatter keys
74
+ are errors; routes are never silently normalized.
75
+
76
+ ```ts
77
+ try {
78
+ await build({ configFile: "./site.config.ts" });
79
+ } catch (e) {
80
+ if (e instanceof BuildError) {
81
+ for (const d of e.diagnostics) console.error(`${d.severity}[${d.code}] ${d.message}`);
82
+ } else throw e;
83
+ }
84
+ ```
85
+
86
+ ## Docs
87
+
88
+ Markdown links rewritten from relative `.md` destinations preserve the site's
89
+ deployment prefix. `ctx.publicAsset(path)` takes a literal filesystem path and
90
+ percent-encodes its URL segments. Generated output collisions (including `/`
91
+ versus `/index`, or authored `/404`) fail the build rather than overwriting a
92
+ page; the previous published output is preserved.
93
+
94
+ - Reference (config, frontmatter, safety model, diagnostics table, dev
95
+ server, Windows support): [docs/USAGE.md](./docs/USAGE.md)
96
+ - The crust test-stack tooling: <https://lariocpt.github.io/crust-website/>
97
+
98
+ ## License
99
+
100
+ MIT — © Lario Borges