@yannosay/sinth 5.3.0 → 5.3.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/CHANGELOG.md +10 -0
- package/README.md +21 -39
- package/RUNTIME-EXCEPTION.md +25 -0
- package/dist/browser/sinth.js +39 -43
- package/dist/compiler/codegen.js +9 -8
- package/dist/compiler/prerender.d.ts +1 -0
- package/dist/compiler/prerender.js +12 -5
- package/dist/runtime/index.js +14 -18
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.3.2
|
|
4
|
+
|
|
5
|
+
- **`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.
|
|
6
|
+
- **Reactive page styles.** Expressions in a page's `style` block (for example `background: "hsl(" + hue + ", 80%, 60%)"`) now update when the variables change. Prerendered pages also include their initial values, so the page is styled before its script runs. Component styles were not affected.
|
|
7
|
+
|
|
8
|
+
## 5.3.1
|
|
9
|
+
|
|
10
|
+
- **Runtime exception.** Sinth is now licensed under the AGPL-3.0 with an additional permission ([RUNTIME-EXCEPTION.md](./RUNTIME-EXCEPTION.md)): sites built with Sinth, including the runtime code bundled into them, can be licensed however you like. Sinth itself stays under the AGPL. The exception covers all versions of Sinth.
|
|
11
|
+
- README and docs state measured output sizes instead of approximations.
|
|
12
|
+
|
|
3
13
|
## 5.3.0
|
|
4
14
|
|
|
5
15
|
### Instant navigation
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@yannosay/sinth) [](https://www.npmjs.com/package/@yannosay/sinth) [](https://github.com/Yannosay/sinth/actions) [](./LICENSE)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Sinth is a language for building websites. A `.sinth` file holds a page's markup, state, functions and styles. The compiler checks the project, prerenders every page to HTML and bundles the interactive parts into plain JavaScript.
|
|
6
6
|
|
|
7
7
|
```sinth
|
|
8
8
|
title = "Counter"
|
|
@@ -15,7 +15,9 @@ Main {
|
|
|
15
15
|
}
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
This page builds to a 0.5 kB HTML file and 3.5 kB of gzipped JavaScript (runtime and router included).
|
|
19
|
+
|
|
20
|
+
[Playground](https://sinth.yannosay.com/playground) · [Documentation](https://sinth.yannosay.com/docs) · [Tutorial](https://sinth.yannosay.com/docs/getting-started/tutorial)
|
|
19
21
|
|
|
20
22
|
## Get started
|
|
21
23
|
|
|
@@ -28,17 +30,15 @@ npm run dev
|
|
|
28
30
|
|
|
29
31
|
Requires Node.js 18.17 or newer.
|
|
30
32
|
|
|
31
|
-
##
|
|
33
|
+
## Features
|
|
32
34
|
|
|
33
|
-
- **
|
|
34
|
-
- **
|
|
35
|
-
- **
|
|
36
|
-
- **
|
|
37
|
-
- **
|
|
38
|
-
- **
|
|
39
|
-
- **
|
|
40
|
-
- **Works with everything else.** npm packages, TypeScript files, CSS and SCSS, JSON, Google Fonts, and components exported as standard web components for any HTML page.
|
|
41
|
-
- **Secure by default.** No `eval`, escaped output, no inline handlers, a strict Content Security Policy and security headers.
|
|
35
|
+
- **Reactive state.** Assigning to a `var`, or changing an array or object in place, updates the parts of the page that use it.
|
|
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
|
+
- **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
|
+
- **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 Functions.
|
|
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.
|
|
41
|
+
- **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. The output is static files, so other hosts work too.
|
|
42
42
|
|
|
43
43
|
## A component
|
|
44
44
|
|
|
@@ -57,7 +57,7 @@ component TodoList(str title = "Todos") {
|
|
|
57
57
|
draft = ""
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
Section
|
|
60
|
+
Section {
|
|
61
61
|
Heading(level: 2) { title + " (" + left + " left)" }
|
|
62
62
|
Form(onSubmit.prevent: add()) {
|
|
63
63
|
Field(label: "New todo", value: draft)
|
|
@@ -81,45 +81,27 @@ component TodoList(str title = "Todos") {
|
|
|
81
81
|
}
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
-
## An API route
|
|
85
|
-
|
|
86
|
-
```ts
|
|
87
|
-
// functions/api/hello.ts
|
|
88
|
-
export const onRequestGet = () => Response.json({ message: "Hello from the server" });
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
```sinth
|
|
92
|
-
var str message = ""
|
|
93
|
-
onMount { message = (await (await fetch("/api/hello")).json()).message }
|
|
94
|
-
Main { Paragraph { message } }
|
|
95
|
-
```
|
|
96
|
-
|
|
97
84
|
## Commands
|
|
98
85
|
|
|
99
86
|
| Command | |
|
|
100
87
|
|---|---|
|
|
101
88
|
| `sinth create [name]` | Scaffold a project |
|
|
102
|
-
| `sinth dev` | Dev server with hot reload
|
|
89
|
+
| `sinth dev` | Dev server with hot reload |
|
|
103
90
|
| `sinth build` | Production build in `dist/` |
|
|
104
91
|
| `sinth preview` | Serve the build and `functions/` locally |
|
|
105
92
|
| `sinth deploy` | Deploy to Cloudflare Pages |
|
|
106
|
-
| `sinth check` |
|
|
93
|
+
| `sinth check` | Check the project without building (`--json` for tools) |
|
|
107
94
|
| `sinth new page/component` | Add files |
|
|
108
95
|
|
|
109
|
-
##
|
|
110
|
-
|
|
111
|
-
- [VS Code extension](https://github.com/Yannosay/sinth/releases/latest): download `sinth-vscode-*.vsix` from the latest release and run **Extensions: Install from VSIX**
|
|
112
|
-
- [Sinth IDE](https://github.com/Yannosay/sinth-ide/releases/latest): a desktop editor for Sinth (Windows, macOS, Linux)
|
|
113
|
-
- [Playground](https://sinth.yannosay.com/playground): the real compiler, in your browser
|
|
114
|
-
|
|
115
|
-
## Documentation
|
|
96
|
+
## Editors
|
|
116
97
|
|
|
117
|
-
|
|
98
|
+
- VS Code: download `sinth-vscode-*.vsix` from the [latest release](https://github.com/Yannosay/sinth/releases/latest) and run **Extensions: Install from VSIX**.
|
|
99
|
+
- [Sinth IDE](https://github.com/Yannosay/sinth-ide/releases/latest): a desktop editor for Sinth (Windows, macOS, Linux). Early development.
|
|
118
100
|
|
|
119
|
-
##
|
|
101
|
+
## Links
|
|
120
102
|
|
|
121
|
-
|
|
103
|
+
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)
|
|
122
104
|
|
|
123
105
|
## License
|
|
124
106
|
|
|
125
|
-
[AGPL-3.0](./LICENSE).
|
|
107
|
+
Sinth is licensed under the [AGPL-3.0](./LICENSE) with a [runtime exception](./RUNTIME-EXCEPTION.md): the sites you build with it, including the Sinth runtime code they contain, are yours to license however you like. The AGPL applies to Sinth itself.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Sinth Runtime Exception
|
|
2
|
+
|
|
3
|
+
Copyright (c) Yannosay Productions
|
|
4
|
+
|
|
5
|
+
This is an additional permission under section 7 of the GNU Affero General Public License, version 3 (the "AGPL"), which covers Sinth. It applies to every version of Sinth published by Yannosay Productions.
|
|
6
|
+
|
|
7
|
+
## Definitions
|
|
8
|
+
|
|
9
|
+
- **"Runtime Code"** means the files in `src/runtime/` and `lib/` of Sinth, in source or compiled form, including copies that the Sinth compiler places in its output, and any code that the Sinth compiler generates from your input.
|
|
10
|
+
- **"Output"** means the files written by the Sinth compiler and its commands (for example `sinth build`, `sinth dev`, `sinth preview` and `sinth deploy`, or the `compileFiles` API): HTML, CSS, JavaScript and other assets, together with any Runtime Code they contain.
|
|
11
|
+
- **"Your Input"** means the `.sinth` files, components, styles, scripts and other files that the compiler processes, other than Sinth itself.
|
|
12
|
+
|
|
13
|
+
## Permission
|
|
14
|
+
|
|
15
|
+
You may use, copy, modify, distribute, sublicense and sell Output produced from Your Input, including the Runtime Code it contains, under terms of your choice. You are not required to apply the AGPL to the Output, to provide its source code, or to include the AGPL with it.
|
|
16
|
+
|
|
17
|
+
This holds whether the Output was produced by an unmodified or a modified version of the Sinth compiler, provided the Runtime Code in the Output has not been modified in a way that turns the Output into a copy or substantial portion of the Sinth compiler, command-line tools, dev server or editor tooling.
|
|
18
|
+
|
|
19
|
+
## Scope
|
|
20
|
+
|
|
21
|
+
This exception does not change the license of Sinth itself. The compiler, command-line tools, dev server, browser build of the compiler, editor extensions and all other parts of Sinth remain under the AGPL when you use, modify or distribute them.
|
|
22
|
+
|
|
23
|
+
Your Input remains yours, under whatever license you choose.
|
|
24
|
+
|
|
25
|
+
If you modify Sinth, you may extend this exception to your modified version, or remove it.
|