@yannosay/sinth 5.3.3 → 5.3.4

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +4 -2
  3. package/dist/browser/sinth.js +596 -69
  4. package/dist/cli/index.js +35 -3
  5. package/dist/cli/skill.d.ts +10 -0
  6. package/dist/cli/skill.js +106 -0
  7. package/dist/cli/templates.js +1 -1
  8. package/dist/compiler/codegen.js +4 -2
  9. package/dist/compiler/elements.d.ts +6 -0
  10. package/dist/compiler/elements.js +12 -0
  11. package/dist/compiler/html.d.ts +2 -0
  12. package/dist/compiler/html.js +7 -0
  13. package/dist/compiler/prerender.js +5 -3
  14. package/dist/deploy/platforms.js +9 -0
  15. package/dist/deploy/redirects.d.ts +31 -0
  16. package/dist/deploy/redirects.js +102 -0
  17. package/dist/project/build.js +44 -2
  18. package/dist/project/config.d.ts +6 -0
  19. package/dist/project/config.js +15 -2
  20. package/dist/project/env.d.ts +11 -0
  21. package/dist/project/env.js +84 -0
  22. package/dist/project/project.js +13 -0
  23. package/dist/runtime/index.js +21 -3
  24. package/dist/server/dev.d.ts +4 -0
  25. package/dist/server/dev.js +32 -9
  26. package/dist/server/functions.d.ts +2 -1
  27. package/dist/server/functions.js +15 -17
  28. package/dist/server/preview.d.ts +3 -0
  29. package/dist/server/preview.js +8 -1
  30. package/dist/server/static.d.ts +9 -0
  31. package/dist/server/static.js +24 -1
  32. package/lib/ui/index.sinth +533 -24
  33. package/package.json +1 -1
  34. package/schema/sinth.config.schema.json +27 -0
  35. package/skills/agents.md +15 -9
  36. package/skills/sinth/SKILL.md +66 -24
  37. package/skills/sinth/references/language.md +2 -1
  38. package/skills/sinth/references/project-and-deploy.md +18 -2
  39. package/skills/sinth/references/ui.md +95 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,53 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.3.4
4
+
5
+ ### Security
6
+
7
+ - **URL sanitizing can no longer be bypassed.** Browsers ignore tabs, newlines and control characters inside a URL scheme, so a value like `"java<tab>script:alert(1)"` in `href` or `src` got past the check. Both the runtime and prerendered HTML now strip those characters before checking, and prerendered pages also block HTML `data:` URLs, as the runtime already did. Relative links that merely start with "javascript" (`javascript-guide.html`) are no longer blocked.
8
+ - **The dev and preview servers reject requests for unknown host names**, which protects them from DNS rebinding (a website you visit reaching your local server through a domain it controls). `localhost`, `*.localhost`, IP addresses and the `--host` name always work; tunnels and custom local domains go in the new `allowedHosts` option.
9
+ - Request bodies sent to `functions/` in `sinth dev` and `sinth preview` are limited to 64 MB.
10
+ - `--open` on Windows no longer passes the URL through `cmd`, which interpreted characters like `&` in it.
11
+
12
+ ### Environment variables
13
+
14
+ - **`sinth:env`**: `import { PUBLIC_API_URL } from "sinth:env"` reads variables from `.env`, `.env.local`, `.env.development` / `.env.production` and the environment. Only names starting with `PUBLIC_` are available to pages, so secrets cannot reach the browser; a missing or non-public name is compile error E0607 with a suggestion. Values are inlined at build time and work in metadata and prerendered HTML.
15
+ - `functions/` get every variable on `context.env` (`.dev.vars` still wins), and `sinth dev` rebuilds when a `.env` file changes.
16
+
17
+ ### Redirects and headers
18
+
19
+ - **`redirects`** in `sinth.config.json`, with `:params` and `*` splats: `{ "/blog/:slug": "/posts/:slug" }`. They apply in `sinth dev` and `sinth preview` and are written for every platform (`_redirects` on Cloudflare and Netlify, routes in the Vercel output, redirect pages on GitHub Pages).
20
+ - **`headers`** adds response headers by path pattern, on top of the security headers.
21
+ - A `_headers` file in `public/` is now merged with the generated one. Before, it replaced it, which silently dropped the security headers and CSP.
22
+
23
+ ### sinth:ui
24
+
25
+ - **New components:** `Select`, `Tabs`, `Accordion`, `Tooltip`, `Table` (sortable), `Pagination`, `Breadcrumbs`, `ProgressBar`, `Skeleton`, `EmptyState`, `Dropdown`, `Kbd`, and `Toaster` with a `toast()` function you can call from anywhere.
26
+ - **`Modal`** traps focus, returns it to the element that opened it, locks page scrolling, labels itself with its title and takes `dismissible: false`.
27
+ - `Button` has `loading`; `Field` links `hint` and `error` to the control with `aria-describedby` and takes `disabled` and `autocomplete`; `Toggle` takes `disabled`. Dark mode has brighter status colors.
28
+
29
+ ### AI agents
30
+
31
+ - **`sinth skill`** installs the Sinth skill from the installed package (Claude Code, or `.agents/skills/sinth` plus an `AGENTS.md` section for Codex, Cursor, Copilot, Gemini CLI and others), so it always matches your Sinth version.
32
+ - The skill teaches agents to write lean Sinth (`sinth:ui`, `computed`, `model`, `for … else` before custom code), adds a `sinth:ui` reference, covers environment variables and redirects, and has agents report results instead of narrating their steps.
33
+ - Sites with `site` set get an **`llms.txt`** listing every page with its title and description, for AI assistants and answer engines.
34
+
35
+ ### CLI
36
+
37
+ - `sinth check --max-warnings 0` fails on warnings, for CI.
38
+ - `sinth create` mentions `sinth skill`, and new projects ignore `.vercel/`, `.env.local` and `.env.*.local`.
39
+
40
+ ### Fixes
41
+
42
+ - `Select` with `model` shows the bound value when its options come from a loop or arrive later. Before, it showed the first option.
43
+ - A capitalized constant written as text, like `P { API_URL }`, renders its value. Before, it was reported as an unknown component, with the same name as the suggestion.
44
+ - Elements leaving with `transition(...)` are inert while they fade out, so they no longer catch clicks.
45
+ - Editing several files quickly in `sinth dev` reports the last one changed.
46
+
47
+ ### Editors
48
+
49
+ - VS Code and Sinth IDE complete every `sinth:ui` component and the `sinth:env` import; the config schema knows `redirects`, `headers` and `allowedHosts`.
50
+
3
51
  ## 5.3.3
4
52
 
5
53
  ### Hosting
package/README.md CHANGED
@@ -37,7 +37,8 @@ Requires Node.js 18.17 or newer.
37
37
  - **Prerendered pages.** Every page is rendered to HTML at build time. Interactive pages then load their code: the runtime is 5.4 kB gzipped at most and only the parts a page uses are bundled.
38
38
  - **Routing.** Files in `pages/` are routes, `pages/blog/[slug].sinth` generates one page per item, and links between pages load without a full reload (2 kB gzipped; `"router": false` turns it off).
39
39
  - **API routes.** Files in `functions/` handle requests with the standard Fetch API in `sinth dev` and `sinth preview`, and deploy to Cloudflare Pages or Workers.
40
- - **Components.** Parameters, two-way bindings, slots and scoped styles, plus a built-in component library (`sinth:ui`). Components can be exported as web components for use on other sites.
40
+ - **Components.** Parameters, two-way bindings, slots and scoped styles, plus `sinth:ui`, a built-in library of 28 accessible components (forms, modals, tabs, sortable tables, toasts, menus). Components can be exported as web components for use on other sites.
41
+ - **Production config.** Environment variables through `sinth:env` (only `PUBLIC_` names reach the browser), and redirects and headers written once for every host.
41
42
  - **Tooling.** Hot reload that keeps state, npm packages, TypeScript and SCSS imports, security headers and a Content Security Policy without inline scripts, and `sinth deploy` for Cloudflare Pages or Workers, Vercel and Netlify. GitHub Pages and any static host work too. Sources can live in the project root or in an `app/` folder.
42
43
 
43
44
  ## A component
@@ -92,6 +93,7 @@ component TodoList(str title = "Todos") {
92
93
  | `sinth deploy` | Deploy (Cloudflare Pages or Workers, Vercel, Netlify) |
93
94
  | `sinth check` | Check the project without building (`--json` for tools) |
94
95
  | `sinth new page/component` | Add files |
96
+ | `sinth skill` | Teach your AI coding agent Sinth |
95
97
 
96
98
  ## Editors
97
99
 
@@ -100,7 +102,7 @@ component TodoList(str title = "Todos") {
100
102
 
101
103
  ## AI agents
102
104
 
103
- Paste this into Claude Code, Codex, Cursor or another coding agent to teach it Sinth:
105
+ In a Sinth project, run `npx sinth skill` to install the Sinth skill for Claude Code, Codex, Cursor, Copilot and other coding agents. Or paste this into your agent:
104
106
 
105
107
  ```text
106
108
  Install the Sinth skill: fetch https://sinth.yannosay.com/agents.md and follow its instructions exactly.