@neuralfog/elemix-template-formatter 0.9.0-dev.17
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 +148 -0
- package/README.md +27 -0
- package/bin/elemix-template-formatter.mjs +39 -0
- package/package.json +29 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to elemix and its companion packages are documented here. They
|
|
4
|
+
share one version and release together, so they share one changelog. The format
|
|
5
|
+
follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/) when it suits me 😂😂😂.
|
|
7
|
+
|
|
8
|
+
> The [Roadmap](https://github.com/neuralfog/elemix/blob/main/ROADMAP.md) is the full
|
|
9
|
+
> log of development.
|
|
10
|
+
|
|
11
|
+
## [0.9.0-dev.17] - 2026-07-10
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- Formatter: new `@neuralfog/elemix-template-formatter` (`etf`) - a native formatter for the HTML inside `tpl`` templates
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Compiler: the emitted registration call is now `$__defineComponent`, completing the `$__` prefixing of runtime imports
|
|
20
|
+
|
|
21
|
+
## [0.9.0-dev.16] - 2026-07-09
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
|
|
25
|
+
- Analyzer: `#`/aliased imports from tsconfig `paths` now resolve, so an aliased component import no longer reads as a missing module
|
|
26
|
+
|
|
27
|
+
## [0.9.0-dev.15] - 2026-07-09
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
|
|
31
|
+
- Compiler/Runtime: every runtime function the compiled output imports is now `$__` prefixed (`$__template`, `$__setText`, `$__state` etc) so it can't clash with a user's own module-scope names
|
|
32
|
+
|
|
33
|
+
## [0.9.0-dev.14] - 2026-07-08
|
|
34
|
+
|
|
35
|
+
### Added
|
|
36
|
+
|
|
37
|
+
- Runtime: new `match` directive - exhaustive pattern matching for templates. Works on string unions, enums, and tagged object unions (each branch gets the narrowed value)
|
|
38
|
+
- Analyzer: flags a missing case, a wrong case, or a non-finite value (like a plain `string`). Use `choose` for open conditions
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
|
|
42
|
+
- Compiler: primitive `#state` backing fields are now prefixed (`#__count`) so they can't clash with your own private properties
|
|
43
|
+
|
|
44
|
+
## [0.9.0-dev.13] - 2026-07-07
|
|
45
|
+
|
|
46
|
+
### Added
|
|
47
|
+
|
|
48
|
+
- Runtime: `createApp(root?)` bootstrap with chainable `.config({ … })` / `.mount(target?)`; app-wide config lives on `window.__elemix__` (the root and both calls are optional, so `createApp().config({ … })` is valid)
|
|
49
|
+
- Runtime: automatic cloaking - elemix adopts a `[data-cloak], :not(:defined) { visibility: hidden }` stylesheet so elements don't flash before they upgrade and mount, with no per-app CSS; `config({ cloak: '…' })` replaces the rule with a custom CSS string
|
|
50
|
+
- Runtime: `config({ shadow: false })` makes components render to light DOM by default (shadow DOM stays the default otherwise)
|
|
51
|
+
- Compiler: new `#shadow` hint forces a shadow root even under a light-DOM default; it is mutually exclusive with `#no-shadow`, and using both on one component is a compile error
|
|
52
|
+
- Analyzer: reports `#shadow` and `#no-shadow` on the same component as an error
|
|
53
|
+
|
|
54
|
+
### Changed
|
|
55
|
+
|
|
56
|
+
- Storybook: ditched lit - `@neuralfog/elemix-storybook` and the storybook config now run on `@storybook/html-vite` instead of `@storybook/web-components-vite`, dropping lit-html from the dependency tree entirely (elemix always rendered plain string/Node, so lit was never used)
|
|
57
|
+
|
|
58
|
+
## [0.9.0-dev.12] - 2026-06-30
|
|
59
|
+
|
|
60
|
+
### Fixed
|
|
61
|
+
|
|
62
|
+
- Runtime: custom events (`@my-event`) now work; `_event` falls back to `addEventListener` when there is no `on*` property
|
|
63
|
+
|
|
64
|
+
## [0.9.0-dev.11] - 2026-06-30
|
|
65
|
+
|
|
66
|
+
### Fixed
|
|
67
|
+
|
|
68
|
+
- Compiler: multi-root conditional branches now render every root (only the first was kept before)
|
|
69
|
+
|
|
70
|
+
## [0.9.0-dev.10] - 2026-06-30
|
|
71
|
+
|
|
72
|
+
### Fixed
|
|
73
|
+
|
|
74
|
+
- Compiler: helper templates are now inlined inside a method-form `template()` (the splice pre-pass previously only saw the `template = () =>` arrow field, so helpers in a method template were left as runtime calls returning uncompiled `tpl` and threw)
|
|
75
|
+
- Compiler: a helper call nested inside another template (e.g. a `${cond ? tpl\`…${this.row(x)}…\` : tpl\`\`}` branch) is now inlined; the splice recurses into nested template holes instead of copying them verbatim
|
|
76
|
+
|
|
77
|
+
## [0.9.0-dev.9] - 2026-06-30
|
|
78
|
+
|
|
79
|
+
### Fixed
|
|
80
|
+
|
|
81
|
+
- Compiler: a `template()` method now lowers to `view()` like the `template = () =>` arrow field; previously only the arrow field was compiled, so the method form was left uncompiled and threw at runtime
|
|
82
|
+
|
|
83
|
+
## [0.9.0-dev.8] - 2026-06-24
|
|
84
|
+
|
|
85
|
+
### Added
|
|
86
|
+
|
|
87
|
+
- `@neuralfog/elemix-analyzer` - static analysis tool for elemix
|
|
88
|
+
|
|
89
|
+
## [0.9.0-dev.7] - 2026-06-22
|
|
90
|
+
|
|
91
|
+
### Changed
|
|
92
|
+
|
|
93
|
+
- WASM package ships its own README
|
|
94
|
+
|
|
95
|
+
## [0.9.0-dev.6] - 2026-06-22
|
|
96
|
+
|
|
97
|
+
### Added
|
|
98
|
+
|
|
99
|
+
- Prebuilt binaries attached to every GitHub release
|
|
100
|
+
|
|
101
|
+
## [0.9.0-dev.5] - 2026-06-22
|
|
102
|
+
|
|
103
|
+
### Fixed
|
|
104
|
+
|
|
105
|
+
- Compiler hint detection in the Vite plugin
|
|
106
|
+
|
|
107
|
+
## [0.9.0-dev.4] - 2026-06-22
|
|
108
|
+
|
|
109
|
+
### Added
|
|
110
|
+
|
|
111
|
+
- Compiler hints: `#component`/`#tag`/`#form`/`#no-shadow`/`#styles`/`#state`/`#effect` + lifecycle `#before-mount`/`#mount`/`#dispose`
|
|
112
|
+
- Reactive primitives in component `#state` (`count = 0` stays reactive)
|
|
113
|
+
- Component inheritance - hooks/effects chain through `super`, stylesheets merge
|
|
114
|
+
- Collections in reactive state (`Set`/`Map`/`WeakSet`/`WeakMap`), classes in state, `raw()` helper
|
|
115
|
+
- Source maps back to the original source
|
|
116
|
+
- Inlined compiler diagnostics with `--strict`; CLI version banner
|
|
117
|
+
|
|
118
|
+
### Changed
|
|
119
|
+
|
|
120
|
+
- Performance optimisations
|
|
121
|
+
|
|
122
|
+
### Fixed
|
|
123
|
+
|
|
124
|
+
- Nested arrays in deep state, template-less pragma components, statements before `return`, dangling `Cargo.lock`
|
|
125
|
+
|
|
126
|
+
## [0.9.0-dev.3] - 2026-06-16
|
|
127
|
+
|
|
128
|
+
### Added
|
|
129
|
+
|
|
130
|
+
- Comment pragmas, effects, source maps
|
|
131
|
+
|
|
132
|
+
## [0.9.0-dev.2] - 2026-06-15
|
|
133
|
+
|
|
134
|
+
### Added
|
|
135
|
+
|
|
136
|
+
- Compiler hints
|
|
137
|
+
|
|
138
|
+
## [0.9.0-dev.1] - 2026-06-14
|
|
139
|
+
|
|
140
|
+
### Added
|
|
141
|
+
|
|
142
|
+
- Optimisations
|
|
143
|
+
|
|
144
|
+
## [0.9.0-dev.0] - 2026-06-14
|
|
145
|
+
|
|
146
|
+
### Added
|
|
147
|
+
|
|
148
|
+
- Initial release: compiled renderer
|
package/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# 🎀 Elemix Template Formatter ⚠️ **Experimental**
|
|
2
|
+
|
|
3
|
+
A native formatter for the HTML inside ``tpl`...` `` tagged template literals in [Elemix](https://www.npmjs.com/package/@neuralfog/elemix) components. It reformats just the template markup and leaves every `${…}` hole and all surrounding TypeScript byte-for-byte untouched.
|
|
4
|
+
|
|
5
|
+
This package ships a **prebuilt static binary** — no Rust toolchain required. Installing pulls in exactly one platform binary via `optionalDependencies`:
|
|
6
|
+
|
|
7
|
+
| Platform | Package |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| linux x64 | `@neuralfog/elemix-template-formatter-linux-x64` |
|
|
10
|
+
| linux arm64 | `@neuralfog/elemix-template-formatter-linux-arm64` |
|
|
11
|
+
| macOS x64 | `@neuralfog/elemix-template-formatter-darwin-x64` |
|
|
12
|
+
| macOS arm64 | `@neuralfog/elemix-template-formatter-darwin-arm64` |
|
|
13
|
+
| Windows x64 | `@neuralfog/elemix-template-formatter-win32-x64` |
|
|
14
|
+
| Windows arm64 | `@neuralfog/elemix-template-formatter-win32-arm64` |
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
Installs two equivalent commands — `etf` (short) and `elemix-template-formatter`:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
etf --dirs src # lint: print a diff, exit 1 if anything is unformatted
|
|
22
|
+
etf --dirs src --write # fix: rewrite files in place
|
|
23
|
+
etf --stdin # format stdin to stdout, silently (editor format-on-save)
|
|
24
|
+
etf --lsp # emit formatting diagnostics as JSON (editor squiggles)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Exits non-zero when a file needs formatting, so it drops straight into CI.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Launcher: resolve the prebuilt binary for this host from the matching platform
|
|
3
|
+
// package (installed via optionalDependencies) and exec it, forwarding argv and
|
|
4
|
+
// the exit code untouched.
|
|
5
|
+
import { spawnSync } from 'node:child_process';
|
|
6
|
+
import { createRequire } from 'node:module';
|
|
7
|
+
import { dirname, join } from 'node:path';
|
|
8
|
+
|
|
9
|
+
const require = createRequire(import.meta.url);
|
|
10
|
+
const ext = process.platform === 'win32' ? '.exe' : '';
|
|
11
|
+
const pkg = `@neuralfog/elemix-template-formatter-${process.platform}-${process.arch}`;
|
|
12
|
+
|
|
13
|
+
let bin;
|
|
14
|
+
try {
|
|
15
|
+
// Resolve the package.json (always present, no exports gate) and sit the
|
|
16
|
+
// binary next to it - the binary itself has no extension, so it cannot be
|
|
17
|
+
// require.resolve'd directly.
|
|
18
|
+
bin = join(
|
|
19
|
+
dirname(require.resolve(`${pkg}/package.json`)),
|
|
20
|
+
`elemix-template-formatter${ext}`,
|
|
21
|
+
);
|
|
22
|
+
} catch {
|
|
23
|
+
console.error(
|
|
24
|
+
`elemix-template-formatter: no prebuilt binary for ${process.platform}-${process.arch} ` +
|
|
25
|
+
`(missing optional dependency ${pkg}).`,
|
|
26
|
+
);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const { status, error } = spawnSync(bin, process.argv.slice(2), {
|
|
31
|
+
stdio: 'inherit',
|
|
32
|
+
});
|
|
33
|
+
if (error) {
|
|
34
|
+
console.error(
|
|
35
|
+
`elemix-template-formatter: failed to launch ${bin}: ${error.message}`,
|
|
36
|
+
);
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
process.exit(status ?? 1);
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@neuralfog/elemix-template-formatter",
|
|
3
|
+
"version": "0.9.0-dev.17",
|
|
4
|
+
"description": "HTML template formatter for Elemix tpl`` literals (etf)",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "brownhounds",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/neuralfog/elemix.git"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"bin": {
|
|
13
|
+
"etf": "bin/elemix-template-formatter.mjs",
|
|
14
|
+
"elemix-template-formatter": "bin/elemix-template-formatter.mjs"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"bin/elemix-template-formatter.mjs",
|
|
18
|
+
"README.md",
|
|
19
|
+
"CHANGELOG.md"
|
|
20
|
+
],
|
|
21
|
+
"optionalDependencies": {
|
|
22
|
+
"@neuralfog/elemix-template-formatter-linux-x64": "0.9.0-dev.17",
|
|
23
|
+
"@neuralfog/elemix-template-formatter-linux-arm64": "0.9.0-dev.17",
|
|
24
|
+
"@neuralfog/elemix-template-formatter-darwin-x64": "0.9.0-dev.17",
|
|
25
|
+
"@neuralfog/elemix-template-formatter-darwin-arm64": "0.9.0-dev.17",
|
|
26
|
+
"@neuralfog/elemix-template-formatter-win32-x64": "0.9.0-dev.17",
|
|
27
|
+
"@neuralfog/elemix-template-formatter-win32-arm64": "0.9.0-dev.17"
|
|
28
|
+
}
|
|
29
|
+
}
|