@yannosay/sinth 5.3.2 → 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.
- package/CHANGELOG.md +83 -0
- package/README.md +16 -4
- package/dist/browser/sinth.js +630 -81
- package/dist/cli/index.js +52 -10
- package/dist/cli/skill.d.ts +10 -0
- package/dist/cli/skill.js +106 -0
- package/dist/cli/templates.js +1 -1
- package/dist/compiler/codegen.js +42 -5
- package/dist/compiler/elements.d.ts +6 -0
- package/dist/compiler/elements.js +12 -0
- package/dist/compiler/html.d.ts +2 -0
- package/dist/compiler/html.js +7 -0
- package/dist/compiler/prerender.js +5 -3
- package/dist/deploy/cloudflare.d.ts +2 -0
- package/dist/deploy/cloudflare.js +103 -18
- package/dist/deploy/platforms.d.ts +20 -0
- package/dist/deploy/platforms.js +212 -0
- package/dist/deploy/redirects.d.ts +31 -0
- package/dist/deploy/redirects.js +102 -0
- package/dist/project/build.js +104 -18
- package/dist/project/config.d.ts +19 -0
- package/dist/project/config.js +66 -8
- package/dist/project/env.d.ts +11 -0
- package/dist/project/env.js +84 -0
- package/dist/project/project.d.ts +7 -1
- package/dist/project/project.js +37 -10
- package/dist/runtime/index.js +48 -8
- package/dist/runtime/router.js +17 -1
- package/dist/server/dev.d.ts +4 -0
- package/dist/server/dev.js +35 -11
- package/dist/server/functions-router.d.ts +60 -0
- package/dist/server/functions-router.js +161 -0
- package/dist/server/functions.d.ts +8 -12
- package/dist/server/functions.js +43 -133
- package/dist/server/preview.d.ts +3 -0
- package/dist/server/preview.js +8 -1
- package/dist/server/static.d.ts +9 -0
- package/dist/server/static.js +24 -1
- package/lib/ui/index.sinth +533 -24
- package/package.json +2 -1
- package/schema/sinth.config.schema.json +30 -1
- package/skills/agents.md +62 -0
- package/skills/sinth/SKILL.md +125 -0
- package/skills/sinth/references/language.md +175 -0
- package/skills/sinth/references/project-and-deploy.md +87 -0
- package/skills/sinth/references/ui.md +95 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,88 @@
|
|
|
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
|
+
|
|
51
|
+
## 5.3.3
|
|
52
|
+
|
|
53
|
+
### Hosting
|
|
54
|
+
|
|
55
|
+
- **`platform` option** (`sinth.config.json`, or `--platform` on `sinth build` and `sinth deploy`): `cloudflare` (default), `cloudflare-workers`, `vercel`, `netlify`, `github-pages` or `static`. The build writes what the host needs and `sinth deploy` uploads to it.
|
|
56
|
+
- **Cloudflare Workers.** The site is served with Workers Static Assets. Routes in `functions/` are bundled into a Worker that keeps the Pages Functions conventions (`onRequestGet`, `[id]`, `[[path]]`, `_middleware`, `next()`, `env.ASSETS`) and only runs for URLs a function can answer. `sinth deploy` runs `wrangler deploy`, `--preview` uploads a preview version, and your own `wrangler.jsonc` is used when present (for KV, D1, R2 and other bindings).
|
|
57
|
+
- **Vercel.** The build writes `.vercel/output/` (Build Output API) with clean URLs, the security headers and the 404 page; `sinth deploy` runs `vercel deploy --prebuilt`.
|
|
58
|
+
- **Netlify** (`netlify deploy`) and **GitHub Pages** (adds `.nojekyll`, without which GitHub drops the `_sinth/` folder).
|
|
59
|
+
- A `functions/` folder on a platform that cannot run it produces warning W0810.
|
|
60
|
+
|
|
61
|
+
### Project layout
|
|
62
|
+
|
|
63
|
+
- **Optional `app/` folder**, like Nuxt: when `app/` exists and the root has no `pages/` folder or `.sinth` files, pages, components, libraries and assets are read from `app/`. `public/` and `functions/` stay in the root (`app/public/` also works). The new `srcDir` option sets the folder explicitly. Imports starting with `/` resolve inside it. `sinth new`, `sinth info` and the VS Code extension follow it.
|
|
64
|
+
|
|
65
|
+
### AI agents
|
|
66
|
+
|
|
67
|
+
- **The Sinth skill** teaches coding agents (Claude Code, Codex, Cursor, Copilot, ...) the syntax, common mistakes and a check-after-every-change workflow. Install it by pasting this prompt into your agent: `Install the Sinth skill: fetch https://sinth.yannosay.com/agents.md and follow its instructions exactly.` The skill also ships in the npm package under `skills/sinth/`.
|
|
68
|
+
|
|
69
|
+
### Fixes
|
|
70
|
+
|
|
71
|
+
- **Cleanups returned from `onMount`** now run when the component is removed. Before, they were attached to the wrong owner, so intervals and listeners started in a component's `onMount` kept running after it disappeared.
|
|
72
|
+
- **`Select` with `model`** shows the bound value on the first render. Before, it showed the first option until the user changed it, because the value was set before the options existed.
|
|
73
|
+
- **Number fields bound with `model`** can be cleared while typing. Before, the old number came back as soon as the field was empty. Text inputs no longer have their value rewritten while the user types.
|
|
74
|
+
- **Build output no longer contains absolute paths** of the build machine. Unminified CSS and JS had comments like `/* sinth-css:C:\Users\...\pages\index.sinth */`; module names are now relative to the project.
|
|
75
|
+
- **Client navigation** follows server redirects (the address bar shows the final URL), and a malformed `#hash` no longer stops the next page from starting.
|
|
76
|
+
- `range()` with an infinite bound throws instead of hanging, and memoized calls (`$fn(x)`) keep at most 500 results per function.
|
|
77
|
+
- **Clearer errors:** event handlers that are literals (`onClick: 1`) report E0352 instead of "handlers cannot be strings", likely typos in event names (`onClik`) get a suggestion (W0302), and children of void elements such as `Input { "x" }` in static markup are reported (W0331) instead of being dropped silently.
|
|
78
|
+
- `functions/`: a malformed URL escape falls through to the static site instead of failing the request.
|
|
79
|
+
|
|
80
|
+
### Documentation and website
|
|
81
|
+
|
|
82
|
+
- New pages: [AI agents](https://sinth.yannosay.com/docs/tooling/ai-agents), and a rewritten [Deploying](https://sinth.yannosay.com/docs/production/deploy) covering every platform. Project structure, configuration, CLI and server functions pages describe `app/`, `srcDir` and `platform`.
|
|
83
|
+
- The SEO example for `jsonLd` used the `title` metadata as a variable, which does not compile; it now uses a constant.
|
|
84
|
+
- The home page has a copyable agent prompt; `llms.txt` points agents to the skill.
|
|
85
|
+
|
|
3
86
|
## 5.3.2
|
|
4
87
|
|
|
5
88
|
- **`for … else` empty state.** The `else` content of a loop is removed once the list gets items. Before, it stayed on the page after the first item was added to an empty list.
|
package/README.md
CHANGED
|
@@ -36,9 +36,10 @@ Requires Node.js 18.17 or newer.
|
|
|
36
36
|
- **Compile-time checks.** Unknown names, wrong argument counts, missing component parameters and type mismatches the compiler can detect are errors with a code frame and a suggestion.
|
|
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
|
-
- **API routes.** Files in `functions/` handle requests with the standard Fetch API in `sinth dev` and `sinth preview`, and deploy to Cloudflare Pages
|
|
40
|
-
- **Components.** Parameters, two-way bindings, slots and scoped styles, plus a built-in
|
|
41
|
-
- **
|
|
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 `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.
|
|
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
|
|
44
45
|
|
|
@@ -89,15 +90,26 @@ component TodoList(str title = "Todos") {
|
|
|
89
90
|
| `sinth dev` | Dev server with hot reload |
|
|
90
91
|
| `sinth build` | Production build in `dist/` |
|
|
91
92
|
| `sinth preview` | Serve the build and `functions/` locally |
|
|
92
|
-
| `sinth deploy` | Deploy
|
|
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
|
|
|
98
100
|
- VS Code: download `sinth-vscode-*.vsix` from the [latest release](https://github.com/Yannosay/sinth/releases/latest) and run **Extensions: Install from VSIX**.
|
|
99
101
|
- [Sinth IDE](https://github.com/Yannosay/sinth-ide/releases/latest): a desktop editor for Sinth (Windows, macOS, Linux). Early development.
|
|
100
102
|
|
|
103
|
+
## AI agents
|
|
104
|
+
|
|
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:
|
|
106
|
+
|
|
107
|
+
```text
|
|
108
|
+
Install the Sinth skill: fetch https://sinth.yannosay.com/agents.md and follow its instructions exactly.
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
The skill is also in this package under [`skills/sinth/`](./skills/sinth). See [AI agents](https://sinth.yannosay.com/docs/tooling/ai-agents).
|
|
112
|
+
|
|
101
113
|
## Links
|
|
102
114
|
|
|
103
115
|
Documentation source: [docs/](./docs) · [Changelog](./CHANGELOG.md) · [Discord](https://discord.gg/SUvcrafTQm) · [Issues](https://github.com/Yannosay/sinth/issues) · [Security](./SECURITY.md) · [Contributing](./CONTRIBUTING.md)
|