@statorjs/stator 2.0.1 → 2.0.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/package.json +2 -2
- package/src/compiler/compile.ts +13 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@statorjs/stator",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Server-canonical web framework: business logic in composable state machines, UI as a thin renderer binding machine outputs to DOM positions. Ships TypeScript source (Vite/tsx-native by design).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"pino-pretty": "^13.1.3",
|
|
89
89
|
"vite": "^6.0.0",
|
|
90
90
|
"vitest": "^2.1.0",
|
|
91
|
-
"@statorjs/stator": "2.0.
|
|
91
|
+
"@statorjs/stator": "2.0.2"
|
|
92
92
|
},
|
|
93
93
|
"scripts": {
|
|
94
94
|
"typecheck": "tsc --noEmit",
|
package/src/compiler/compile.ts
CHANGED
|
@@ -81,6 +81,19 @@ export function compile(source: string, opts: CompileOptions = {}): CompileResul
|
|
|
81
81
|
const script = scripts.join('\n')
|
|
82
82
|
if (script.trim()) {
|
|
83
83
|
if (analyzeScriptClasses(script).length > 0) {
|
|
84
|
+
// An island's shell renders from props — there is no frontmatter
|
|
85
|
+
// execution on this path, and silently discarding the fence produced
|
|
86
|
+
// either a dangling-identifier crash at render or dead code that
|
|
87
|
+
// looked alive. Surface it instead.
|
|
88
|
+
if (frontmatter.trim()) {
|
|
89
|
+
throw new CompileError(
|
|
90
|
+
`stator: an island file (a template with a StatorElement <script>) can't have ` +
|
|
91
|
+
`frontmatter — the fence would never run: the island's shell renders from props. ` +
|
|
92
|
+
`Move the server work into the route or component that renders this island and ` +
|
|
93
|
+
`pass the results as props.`,
|
|
94
|
+
locAt(source, 0, opts.id),
|
|
95
|
+
)
|
|
96
|
+
}
|
|
84
97
|
return compileClient(template, script, {
|
|
85
98
|
hash,
|
|
86
99
|
scopeAttr,
|