tw-framework 2.0.3 → 2.0.5
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 +108 -0
- package/dist/testing.cjs +560 -189
- package/dist/tw-server.mjs +529 -157
- package/dist/tw.mjs +1017 -478
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,114 @@ Notable changes to TW Framework. The format follows
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/), and the project uses
|
|
5
5
|
[Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [2.0.5]
|
|
8
|
+
|
|
9
|
+
A patch release on top of 2.0.4. Two features that were blocked by bugs, and a
|
|
10
|
+
run of stylesheet fixes.
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **Page-level imports reach `server { }` blocks.** A page may now import from
|
|
15
|
+
`lib/` and use the binding inside a server block:
|
|
16
|
+
|
|
17
|
+
```tw
|
|
18
|
+
import { getApps } from "lib/data"
|
|
19
|
+
server { const apps = await getApps() }
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The import is resolved only when a block actually references it, and
|
|
23
|
+
block-local imports keep precedence. Use the same name in markup and it is
|
|
24
|
+
still `TW1007`, because that would have to reach the browser.
|
|
25
|
+
- **`@tw/client-safe`.** A module inside `lib/` opts out of the server-only
|
|
26
|
+
default with `import "@tw/client-safe"`. `@tw/server-only` marks a module
|
|
27
|
+
anywhere. A client-safe module that pulls in a server-only dependency still
|
|
28
|
+
fails, with the whole import chain in the message.
|
|
29
|
+
- **`TW125`** reports an import whose local name is also a server-block
|
|
30
|
+
built-in (`query`, `params`, `fetch`, …). Those bindings were silently
|
|
31
|
+
replaced by the built-in, so the block ran against the wrong value.
|
|
32
|
+
- **`notFound()` in a static block.** The build skips that page and the host
|
|
33
|
+
serves a real 404, instead of a 200 with a "not found" body that crawlers
|
|
34
|
+
index.
|
|
35
|
+
|
|
36
|
+
### Fixed
|
|
37
|
+
|
|
38
|
+
- **TSS multi-line blocks.** A nested `@media`, `@container`, `@keyframes` or
|
|
39
|
+
`@layer` produced invalid CSS — a selector-less rule, or one copy of the
|
|
40
|
+
at-rule per inner rule so `@keyframes` lost frames. Custom properties
|
|
41
|
+
(`--main`) and vendor prefixes (`-webkit-transform`) written on their own
|
|
42
|
+
line were pasted into the previous declaration's value.
|
|
43
|
+
- **TSS strings.** A `;` or `}` inside a quoted string split the declaration and
|
|
44
|
+
broke the block.
|
|
45
|
+
- **TSS statement at-rules.** `@import`, `@charset` and `@layer a, b;` came out
|
|
46
|
+
as `* { @import: url(...) }` — the stylesheet imported nothing.
|
|
47
|
+
- **TSS shorthands.** Nine documented shorthands (`br-tl`, `br-tr`, `br-bl`,
|
|
48
|
+
`br-br`, `fl`, `cl`, `dir`, `ww`, `va`) were never implemented, so
|
|
49
|
+
`br-tl 4px` emitted the literal property `br-tl` and the corner stayed square.
|
|
50
|
+
- **TSS output shape.** A multi-line value printed across several lines; a
|
|
51
|
+
property with no value swallowed the next declaration; empty blocks emitted
|
|
52
|
+
empty rules.
|
|
53
|
+
- **Documentation.** `TW108` and `docs/client-modules.md` still described the
|
|
54
|
+
old rules for `notFound()` and for importing `lib/` into a page.
|
|
55
|
+
|
|
56
|
+
### Notes
|
|
57
|
+
|
|
58
|
+
- `TW124` was already documented for a private-folder check, so the new
|
|
59
|
+
collision diagnostic is `TW125`.
|
|
60
|
+
- Applying this needs `bun install`: `packages/client-safe` is a new workspace
|
|
61
|
+
package.
|
|
62
|
+
|
|
63
|
+
## [2.0.4]
|
|
64
|
+
|
|
65
|
+
A patch release on top of 2.0.3. Bug fixes plus one deliberate behaviour change
|
|
66
|
+
(raw HTML in a `.tw` file is now an error, see below).
|
|
67
|
+
|
|
68
|
+
### Fixed
|
|
69
|
+
|
|
70
|
+
- **`tw dev` runs `server { }` blocks.** It called the compiler without
|
|
71
|
+
`experimental.serverBlocks`, so `collectServerBlocks()` always came back empty
|
|
72
|
+
and the block never executed: a page whose content came from `server { }`
|
|
73
|
+
rendered with empty lists. The values are also merged the way the serve path
|
|
74
|
+
does (`params` as a key, through `encodeServerValues`), which is what actually
|
|
75
|
+
gets them into the markup.
|
|
76
|
+
- **`tw dev` sets `Content-Type` for `public/` files.** `new Response(Bun.file())`
|
|
77
|
+
does not carry the file's type, so every `.svg`, `.css` and `.json` arrived
|
|
78
|
+
without one and images showed as broken icons.
|
|
79
|
+
- **`state { }` in `layout.tw`.** Only the page's state was seeded into the vars
|
|
80
|
+
the layout's markup is generated from, so a layout holding state for its own
|
|
81
|
+
chrome rendered empty. Layouts are seeded first, so the page still wins a name
|
|
82
|
+
clash.
|
|
83
|
+
- **`TW003` on valid inline tags.** `HTML_ELEMENTS` was missing `b`, `i`, `em`,
|
|
84
|
+
`strong`, `small`, `u`, `s`, `ins`, `del`, `sub`, `sup`, `nobr`, `big`, `tt`
|
|
85
|
+
and the SVG children (`circle`, `path`, `rect`, `g`, `defs`, `use`, …), which
|
|
86
|
+
produced a warning per tag on markup that renders fine and buried the real
|
|
87
|
+
findings.
|
|
88
|
+
- **`tw serve` answered 200 for an unknown dynamic param.** A route with a
|
|
89
|
+
`params.twm` enumerates its slugs, and the static build only writes those — but
|
|
90
|
+
the server matched `[slug]` for anything and rendered the fallback branch with
|
|
91
|
+
200, so search engines indexed those as real pages. An unenumerated param is a
|
|
92
|
+
404 now, through the normal not-found path.
|
|
93
|
+
- **`headers` config ignored an unknown key.** `{ path, headers }` — the natural
|
|
94
|
+
guess, docs say `{ source, headers }` — was accepted silently and did nothing,
|
|
95
|
+
so a CSP or X-Frame-Options set there never reached the response. The server
|
|
96
|
+
names the unknown key at startup.
|
|
97
|
+
- **`tw adapter` notice counts SSR pages too.** It reported only `.twm` API
|
|
98
|
+
routes; pages with `render ssr`, `stream`, `csr` or `ppr` cannot be served by a
|
|
99
|
+
static adapter either and are counted now.
|
|
100
|
+
|
|
101
|
+
### Changed
|
|
102
|
+
|
|
103
|
+
- **Raw HTML in a `.tw` file is a build error (`TW123`).** It was never a
|
|
104
|
+
supported form, but it parsed and then had its text rewritten by the class
|
|
105
|
+
shorthand — `one two.` became `<two>`, `mid. sentence` became
|
|
106
|
+
`<mid class="sentence">` — with no diagnostic. Write the element in TW syntax
|
|
107
|
+
(`p { ... }`) instead. `<if>`, `<for>`, `<while>`, `<switch>` and components are
|
|
108
|
+
unaffected.
|
|
109
|
+
|
|
110
|
+
### Docs
|
|
111
|
+
|
|
112
|
+
- `docs/syntax-interpolation.md` documents printing a literal brace (`\{` and
|
|
113
|
+
`\}`), which already worked but was not written down.
|
|
114
|
+
|
|
7
115
|
## [2.0.3]
|
|
8
116
|
|
|
9
117
|
A patch release: bug fixes only, no breaking changes, no public API changes.
|