brustjs 0.1.0-alpha.1 → 0.1.1-alpha
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 +9 -8
- package/runtime/cli/templates/minimal/app.css +86 -1
- package/runtime/cli/templates/minimal/components/Counter.tsx +15 -2
- package/runtime/cli/templates/minimal/pages/Home.tsx.tmpl +50 -34
- package/runtime/index.js +52 -52
- package/runtime/index.ts +3 -0
- package/runtime/islands/brust-page.tsx +55 -0
- package/runtime/islands/island.tsx +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brustjs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1-alpha",
|
|
4
4
|
"description": "Bun + Rust SSR framework — React on the server, Rust everywhere else (napi cdylib + per-worker SharedArrayBuffer).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -36,15 +36,16 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@tailwindcss/node": "^4.3.0",
|
|
38
38
|
"@tailwindcss/oxide": "^4.3.0",
|
|
39
|
-
"smol-toml": "^1.6.1"
|
|
39
|
+
"smol-toml": "^1.6.1",
|
|
40
|
+
"typescript": "^6.0.3"
|
|
40
41
|
},
|
|
41
42
|
"optionalDependencies": {
|
|
42
|
-
"brustjs-darwin-x64": "0.1.
|
|
43
|
-
"brustjs-darwin-arm64": "0.1.
|
|
44
|
-
"brustjs-linux-x64-gnu": "0.1.
|
|
45
|
-
"brustjs-linux-arm64-gnu": "0.1.
|
|
46
|
-
"brustjs-linux-x64-musl": "0.1.
|
|
47
|
-
"brustjs-linux-arm64-musl": "0.1.
|
|
43
|
+
"brustjs-darwin-x64": "0.1.1-alpha",
|
|
44
|
+
"brustjs-darwin-arm64": "0.1.1-alpha",
|
|
45
|
+
"brustjs-linux-x64-gnu": "0.1.1-alpha",
|
|
46
|
+
"brustjs-linux-arm64-gnu": "0.1.1-alpha",
|
|
47
|
+
"brustjs-linux-x64-musl": "0.1.1-alpha",
|
|
48
|
+
"brustjs-linux-arm64-musl": "0.1.1-alpha"
|
|
48
49
|
},
|
|
49
50
|
"peerDependencies": {
|
|
50
51
|
"react": "^19.2.6",
|
|
@@ -1,6 +1,91 @@
|
|
|
1
1
|
@import "tailwindcss";
|
|
2
2
|
@source "./**/*.{tsx,ts}";
|
|
3
3
|
|
|
4
|
+
@layer theme, base, components, utilities;
|
|
5
|
+
|
|
4
6
|
@theme {
|
|
5
|
-
--color-
|
|
7
|
+
--color-brust-dark: #09090b; /* Zinc 950 */
|
|
8
|
+
--color-brust-panel: #18181b; /* Zinc 900 */
|
|
9
|
+
--color-brust-teal: #14b8a6; /* Teal 500 */
|
|
10
|
+
--color-brust-purple: #a855f7; /* Purple 500 */
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@layer components {
|
|
14
|
+
.brust-body {
|
|
15
|
+
@apply bg-zinc-950 text-zinc-300 font-sans antialiased selection:bg-purple-900 selection:text-white min-h-screen;
|
|
16
|
+
background-image: radial-gradient(circle at top center, rgba(168, 85, 247, 0.05), transparent 40%),
|
|
17
|
+
radial-gradient(circle at bottom center, rgba(20, 184, 166, 0.05), transparent 40%);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.brust-container {
|
|
21
|
+
@apply max-w-5xl mx-auto px-6 py-12 md:py-24 relative z-10;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.brust-header {
|
|
25
|
+
@apply mb-16 text-center flex flex-col items-center;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.brust-title {
|
|
29
|
+
@apply text-5xl md:text-7xl font-extrabold tracking-tight text-white mb-6;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.brust-title-gradient {
|
|
33
|
+
@apply text-transparent bg-clip-text bg-gradient-to-r from-teal-400 via-blue-500 to-purple-500;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.brust-description {
|
|
37
|
+
@apply text-lg text-zinc-400 max-w-3xl leading-relaxed;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.brust-code-inline {
|
|
41
|
+
@apply bg-zinc-800 text-zinc-200 px-2 py-0.5 rounded-md font-mono text-sm border border-zinc-700 shadow-inner;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.brust-grid {
|
|
45
|
+
@apply grid grid-cols-1 md:grid-cols-2 gap-6 lg:gap-8;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* Card (glassmorphism + glow edge) */
|
|
49
|
+
.island-card {
|
|
50
|
+
@apply relative bg-zinc-900/50 backdrop-blur-xl rounded-2xl p-8 border border-zinc-800 transition-all duration-300 hover:border-zinc-700 hover:shadow-2xl overflow-hidden;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* Glowing border on hover */
|
|
54
|
+
.island-card::before {
|
|
55
|
+
content: '';
|
|
56
|
+
@apply absolute inset-0 rounded-2xl border-2 border-transparent opacity-0 transition-opacity duration-300 pointer-events-none;
|
|
57
|
+
mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
|
|
58
|
+
-webkit-mask-composite: xor;
|
|
59
|
+
mask-composite: exclude;
|
|
60
|
+
}
|
|
61
|
+
.island-card-client:hover::before { @apply border-teal-500/50 opacity-100; }
|
|
62
|
+
.island-card-server:hover::before { @apply border-purple-500/50 opacity-100; }
|
|
63
|
+
|
|
64
|
+
.island-header {
|
|
65
|
+
@apply flex items-center gap-4 mb-4;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.island-badge {
|
|
69
|
+
@apply px-3 py-1 text-xs font-bold rounded-full uppercase tracking-widest shadow-lg;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.island-badge-client {
|
|
73
|
+
@apply bg-teal-500/10 text-teal-400 border border-teal-500/30;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.island-badge-server {
|
|
77
|
+
@apply bg-purple-500/10 text-purple-400 border border-purple-500/30;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.island-title {
|
|
81
|
+
@apply text-2xl font-bold text-zinc-100;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.island-desc {
|
|
85
|
+
@apply text-sm text-zinc-500 mb-8 min-h-[48px] leading-relaxed;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.island-mount-point {
|
|
89
|
+
@apply bg-zinc-950/50 rounded-xl p-8 border border-dashed border-zinc-700/50 flex flex-col items-center justify-center min-h-[140px] shadow-inner;
|
|
90
|
+
}
|
|
6
91
|
}
|
|
@@ -3,13 +3,26 @@ import { useState } from 'react'
|
|
|
3
3
|
|
|
4
4
|
export default function Counter({ start = 0, label = 'count' }: { start?: number; label?: string }) {
|
|
5
5
|
const [count, setCount] = useState(start)
|
|
6
|
+
|
|
6
7
|
return (
|
|
7
8
|
<button
|
|
8
9
|
type="button"
|
|
9
10
|
onClick={() => setCount((c) => c + 1)}
|
|
10
|
-
className="
|
|
11
|
+
className="cursor-pointer inline-flex items-center justify-center gap-3 px-6 py-3 text-sm font-semibold text-zinc-200 bg-zinc-800 border border-zinc-700 rounded-xl shadow-lg hover:bg-zinc-700 hover:border-zinc-600 focus:outline-none focus:ring-2 focus:ring-purple-500/50 active:scale-95 transition-all duration-200"
|
|
11
12
|
>
|
|
12
|
-
|
|
13
|
+
<svg
|
|
14
|
+
className="w-5 h-5 text-zinc-400"
|
|
15
|
+
fill="none"
|
|
16
|
+
viewBox="0 0 24 24"
|
|
17
|
+
stroke="currentColor"
|
|
18
|
+
strokeWidth={2}
|
|
19
|
+
>
|
|
20
|
+
<path strokeLinecap="round" strokeLinejoin="round" d="M12 6v6m0 0v6m0-6h6m-6 0H6" />
|
|
21
|
+
</svg>
|
|
22
|
+
<span className="tracking-wide">{label}</span>
|
|
23
|
+
<span className="ml-2 px-2.5 py-0.5 rounded-lg bg-zinc-900 text-zinc-300 border border-zinc-700/50 font-mono">
|
|
24
|
+
{count}
|
|
25
|
+
</span>
|
|
13
26
|
</button>
|
|
14
27
|
)
|
|
15
28
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { Island } from 'brustjs'
|
|
1
|
+
import { BrustPage, Island } from 'brustjs'
|
|
2
2
|
import Counter from '../components/Counter'
|
|
3
3
|
|
|
4
4
|
// `native: true` page — compiled to a jinja template and rendered in Rust
|
|
5
|
-
// (minijinja), no React on the server.
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
5
|
+
// (minijinja), no React on the server. `<BrustPage>` is the built-in document
|
|
6
|
+
// shell: brust owns <html>/<head>/<body> and auto-injects the framework head
|
|
7
|
+
// tags (charset, viewport, the app.css stylesheet link). Configure the head via
|
|
8
|
+
// props (`title`, `description`, …) — you never write <head> yourself. Each
|
|
9
|
+
// island's `props` is a path into the route loader's return value.
|
|
9
10
|
export default function Home({
|
|
10
11
|
clientProps,
|
|
11
12
|
serverProps,
|
|
@@ -14,41 +15,56 @@ export default function Home({
|
|
|
14
15
|
serverProps: { start: number; label: string }
|
|
15
16
|
}) {
|
|
16
17
|
return (
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<p className="
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<
|
|
31
|
-
<code className="
|
|
32
|
-
|
|
18
|
+
<BrustPage lang="en" className="dark" bodyClassName="brust-body" title="__PROJECT_NAME__">
|
|
19
|
+
{/* Background decorative glows */}
|
|
20
|
+
<div className="fixed top-[-20%] left-[-10%] w-[50%] h-[50%] bg-purple-600/10 rounded-full blur-[120px] pointer-events-none"></div>
|
|
21
|
+
<div className="fixed bottom-[-20%] right-[-10%] w-[50%] h-[50%] bg-teal-600/10 rounded-full blur-[120px] pointer-events-none"></div>
|
|
22
|
+
|
|
23
|
+
<main className="brust-container">
|
|
24
|
+
<header className="brust-header">
|
|
25
|
+
<h1 className="brust-title">
|
|
26
|
+
Built to <span className="brust-title-gradient">Burst.</span>
|
|
27
|
+
</h1>
|
|
28
|
+
<p className="brust-description">
|
|
29
|
+
You are looking at a <strong>Native Route</strong>. This shell is compiled to a Jinja
|
|
30
|
+
template and rendered entirely in Rust. No React runs on the server for this layout.
|
|
31
|
+
<br className="hidden md:block" />
|
|
32
|
+
Edit <code className="brust-code-inline">pages/Home.tsx</code> and save to see HMR in
|
|
33
|
+
action.
|
|
33
34
|
</p>
|
|
35
|
+
</header>
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
<div className="brust-grid">
|
|
38
|
+
{/* Client island — empty on the server, hydrates in the browser. */}
|
|
39
|
+
<section className="island-card island-card-client">
|
|
40
|
+
<div className="island-header">
|
|
41
|
+
<span className="island-badge island-badge-client">CSR</span>
|
|
42
|
+
<h2 className="island-title">Client Island</h2>
|
|
43
|
+
</div>
|
|
44
|
+
<p className="island-desc">
|
|
45
|
+
Empty on the server. Boots and hydrates strictly in the browser.
|
|
39
46
|
</p>
|
|
40
|
-
<
|
|
47
|
+
<div className="island-mount-point">
|
|
48
|
+
<Island component={Counter} props={clientProps} hydrate="load" />
|
|
49
|
+
</div>
|
|
41
50
|
</section>
|
|
42
51
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
<
|
|
46
|
-
|
|
52
|
+
{/* Server island — rendered to string in the worker, then hydrated. */}
|
|
53
|
+
<section className="island-card island-card-server">
|
|
54
|
+
<div className="island-header">
|
|
55
|
+
<span className="island-badge island-badge-server">SSR + CSR</span>
|
|
56
|
+
<h2 className="island-title">Server Island</h2>
|
|
57
|
+
</div>
|
|
58
|
+
<p className="island-desc">
|
|
59
|
+
Rendered to string in the Bun worker during the loader crossing, then hydrated — no
|
|
60
|
+
layout shift.
|
|
47
61
|
</p>
|
|
48
|
-
<
|
|
62
|
+
<div className="island-mount-point">
|
|
63
|
+
<Island component={Counter} props={serverProps} ssr hydrate="load" />
|
|
64
|
+
</div>
|
|
49
65
|
</section>
|
|
50
|
-
</
|
|
51
|
-
</
|
|
52
|
-
</
|
|
66
|
+
</div>
|
|
67
|
+
</main>
|
|
68
|
+
</BrustPage>
|
|
53
69
|
)
|
|
54
70
|
}
|
package/runtime/index.js
CHANGED
|
@@ -77,8 +77,8 @@ function requireNative() {
|
|
|
77
77
|
try {
|
|
78
78
|
const binding = require('brustjs-android-arm64')
|
|
79
79
|
const bindingPackageVersion = require('brustjs-android-arm64/package.json').version
|
|
80
|
-
if (bindingPackageVersion !== '0.1.
|
|
81
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
80
|
+
if (bindingPackageVersion !== '0.1.1-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
81
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.1-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
82
82
|
}
|
|
83
83
|
return binding
|
|
84
84
|
} catch (e) {
|
|
@@ -93,8 +93,8 @@ function requireNative() {
|
|
|
93
93
|
try {
|
|
94
94
|
const binding = require('brustjs-android-arm-eabi')
|
|
95
95
|
const bindingPackageVersion = require('brustjs-android-arm-eabi/package.json').version
|
|
96
|
-
if (bindingPackageVersion !== '0.1.
|
|
97
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
96
|
+
if (bindingPackageVersion !== '0.1.1-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
97
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.1-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
98
98
|
}
|
|
99
99
|
return binding
|
|
100
100
|
} catch (e) {
|
|
@@ -114,8 +114,8 @@ function requireNative() {
|
|
|
114
114
|
try {
|
|
115
115
|
const binding = require('brustjs-win32-x64-gnu')
|
|
116
116
|
const bindingPackageVersion = require('brustjs-win32-x64-gnu/package.json').version
|
|
117
|
-
if (bindingPackageVersion !== '0.1.
|
|
118
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
117
|
+
if (bindingPackageVersion !== '0.1.1-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
118
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.1-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
119
119
|
}
|
|
120
120
|
return binding
|
|
121
121
|
} catch (e) {
|
|
@@ -130,8 +130,8 @@ function requireNative() {
|
|
|
130
130
|
try {
|
|
131
131
|
const binding = require('brustjs-win32-x64-msvc')
|
|
132
132
|
const bindingPackageVersion = require('brustjs-win32-x64-msvc/package.json').version
|
|
133
|
-
if (bindingPackageVersion !== '0.1.
|
|
134
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
133
|
+
if (bindingPackageVersion !== '0.1.1-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
134
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.1-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
135
135
|
}
|
|
136
136
|
return binding
|
|
137
137
|
} catch (e) {
|
|
@@ -147,8 +147,8 @@ function requireNative() {
|
|
|
147
147
|
try {
|
|
148
148
|
const binding = require('brustjs-win32-ia32-msvc')
|
|
149
149
|
const bindingPackageVersion = require('brustjs-win32-ia32-msvc/package.json').version
|
|
150
|
-
if (bindingPackageVersion !== '0.1.
|
|
151
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
150
|
+
if (bindingPackageVersion !== '0.1.1-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
151
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.1-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
152
152
|
}
|
|
153
153
|
return binding
|
|
154
154
|
} catch (e) {
|
|
@@ -163,8 +163,8 @@ function requireNative() {
|
|
|
163
163
|
try {
|
|
164
164
|
const binding = require('brustjs-win32-arm64-msvc')
|
|
165
165
|
const bindingPackageVersion = require('brustjs-win32-arm64-msvc/package.json').version
|
|
166
|
-
if (bindingPackageVersion !== '0.1.
|
|
167
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
166
|
+
if (bindingPackageVersion !== '0.1.1-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
167
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.1-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
168
168
|
}
|
|
169
169
|
return binding
|
|
170
170
|
} catch (e) {
|
|
@@ -182,8 +182,8 @@ function requireNative() {
|
|
|
182
182
|
try {
|
|
183
183
|
const binding = require('brustjs-darwin-universal')
|
|
184
184
|
const bindingPackageVersion = require('brustjs-darwin-universal/package.json').version
|
|
185
|
-
if (bindingPackageVersion !== '0.1.
|
|
186
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
185
|
+
if (bindingPackageVersion !== '0.1.1-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
186
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.1-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
187
187
|
}
|
|
188
188
|
return binding
|
|
189
189
|
} catch (e) {
|
|
@@ -198,8 +198,8 @@ function requireNative() {
|
|
|
198
198
|
try {
|
|
199
199
|
const binding = require('brustjs-darwin-x64')
|
|
200
200
|
const bindingPackageVersion = require('brustjs-darwin-x64/package.json').version
|
|
201
|
-
if (bindingPackageVersion !== '0.1.
|
|
202
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
201
|
+
if (bindingPackageVersion !== '0.1.1-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
202
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.1-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
203
203
|
}
|
|
204
204
|
return binding
|
|
205
205
|
} catch (e) {
|
|
@@ -214,8 +214,8 @@ function requireNative() {
|
|
|
214
214
|
try {
|
|
215
215
|
const binding = require('brustjs-darwin-arm64')
|
|
216
216
|
const bindingPackageVersion = require('brustjs-darwin-arm64/package.json').version
|
|
217
|
-
if (bindingPackageVersion !== '0.1.
|
|
218
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
217
|
+
if (bindingPackageVersion !== '0.1.1-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
218
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.1-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
219
219
|
}
|
|
220
220
|
return binding
|
|
221
221
|
} catch (e) {
|
|
@@ -234,8 +234,8 @@ function requireNative() {
|
|
|
234
234
|
try {
|
|
235
235
|
const binding = require('brustjs-freebsd-x64')
|
|
236
236
|
const bindingPackageVersion = require('brustjs-freebsd-x64/package.json').version
|
|
237
|
-
if (bindingPackageVersion !== '0.1.
|
|
238
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
237
|
+
if (bindingPackageVersion !== '0.1.1-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
238
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.1-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
239
239
|
}
|
|
240
240
|
return binding
|
|
241
241
|
} catch (e) {
|
|
@@ -250,8 +250,8 @@ function requireNative() {
|
|
|
250
250
|
try {
|
|
251
251
|
const binding = require('brustjs-freebsd-arm64')
|
|
252
252
|
const bindingPackageVersion = require('brustjs-freebsd-arm64/package.json').version
|
|
253
|
-
if (bindingPackageVersion !== '0.1.
|
|
254
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
253
|
+
if (bindingPackageVersion !== '0.1.1-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
254
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.1-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
255
255
|
}
|
|
256
256
|
return binding
|
|
257
257
|
} catch (e) {
|
|
@@ -271,8 +271,8 @@ function requireNative() {
|
|
|
271
271
|
try {
|
|
272
272
|
const binding = require('brustjs-linux-x64-musl')
|
|
273
273
|
const bindingPackageVersion = require('brustjs-linux-x64-musl/package.json').version
|
|
274
|
-
if (bindingPackageVersion !== '0.1.
|
|
275
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
274
|
+
if (bindingPackageVersion !== '0.1.1-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
275
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.1-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
276
276
|
}
|
|
277
277
|
return binding
|
|
278
278
|
} catch (e) {
|
|
@@ -287,8 +287,8 @@ function requireNative() {
|
|
|
287
287
|
try {
|
|
288
288
|
const binding = require('brustjs-linux-x64-gnu')
|
|
289
289
|
const bindingPackageVersion = require('brustjs-linux-x64-gnu/package.json').version
|
|
290
|
-
if (bindingPackageVersion !== '0.1.
|
|
291
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
290
|
+
if (bindingPackageVersion !== '0.1.1-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
291
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.1-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
292
292
|
}
|
|
293
293
|
return binding
|
|
294
294
|
} catch (e) {
|
|
@@ -305,8 +305,8 @@ function requireNative() {
|
|
|
305
305
|
try {
|
|
306
306
|
const binding = require('brustjs-linux-arm64-musl')
|
|
307
307
|
const bindingPackageVersion = require('brustjs-linux-arm64-musl/package.json').version
|
|
308
|
-
if (bindingPackageVersion !== '0.1.
|
|
309
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
308
|
+
if (bindingPackageVersion !== '0.1.1-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
309
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.1-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
310
310
|
}
|
|
311
311
|
return binding
|
|
312
312
|
} catch (e) {
|
|
@@ -321,8 +321,8 @@ function requireNative() {
|
|
|
321
321
|
try {
|
|
322
322
|
const binding = require('brustjs-linux-arm64-gnu')
|
|
323
323
|
const bindingPackageVersion = require('brustjs-linux-arm64-gnu/package.json').version
|
|
324
|
-
if (bindingPackageVersion !== '0.1.
|
|
325
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
324
|
+
if (bindingPackageVersion !== '0.1.1-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
325
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.1-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
326
326
|
}
|
|
327
327
|
return binding
|
|
328
328
|
} catch (e) {
|
|
@@ -339,8 +339,8 @@ function requireNative() {
|
|
|
339
339
|
try {
|
|
340
340
|
const binding = require('brustjs-linux-arm-musleabihf')
|
|
341
341
|
const bindingPackageVersion = require('brustjs-linux-arm-musleabihf/package.json').version
|
|
342
|
-
if (bindingPackageVersion !== '0.1.
|
|
343
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
342
|
+
if (bindingPackageVersion !== '0.1.1-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
343
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.1-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
344
344
|
}
|
|
345
345
|
return binding
|
|
346
346
|
} catch (e) {
|
|
@@ -355,8 +355,8 @@ function requireNative() {
|
|
|
355
355
|
try {
|
|
356
356
|
const binding = require('brustjs-linux-arm-gnueabihf')
|
|
357
357
|
const bindingPackageVersion = require('brustjs-linux-arm-gnueabihf/package.json').version
|
|
358
|
-
if (bindingPackageVersion !== '0.1.
|
|
359
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
358
|
+
if (bindingPackageVersion !== '0.1.1-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
359
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.1-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
360
360
|
}
|
|
361
361
|
return binding
|
|
362
362
|
} catch (e) {
|
|
@@ -373,8 +373,8 @@ function requireNative() {
|
|
|
373
373
|
try {
|
|
374
374
|
const binding = require('brustjs-linux-loong64-musl')
|
|
375
375
|
const bindingPackageVersion = require('brustjs-linux-loong64-musl/package.json').version
|
|
376
|
-
if (bindingPackageVersion !== '0.1.
|
|
377
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
376
|
+
if (bindingPackageVersion !== '0.1.1-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
377
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.1-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
378
378
|
}
|
|
379
379
|
return binding
|
|
380
380
|
} catch (e) {
|
|
@@ -389,8 +389,8 @@ function requireNative() {
|
|
|
389
389
|
try {
|
|
390
390
|
const binding = require('brustjs-linux-loong64-gnu')
|
|
391
391
|
const bindingPackageVersion = require('brustjs-linux-loong64-gnu/package.json').version
|
|
392
|
-
if (bindingPackageVersion !== '0.1.
|
|
393
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
392
|
+
if (bindingPackageVersion !== '0.1.1-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
393
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.1-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
394
394
|
}
|
|
395
395
|
return binding
|
|
396
396
|
} catch (e) {
|
|
@@ -407,8 +407,8 @@ function requireNative() {
|
|
|
407
407
|
try {
|
|
408
408
|
const binding = require('brustjs-linux-riscv64-musl')
|
|
409
409
|
const bindingPackageVersion = require('brustjs-linux-riscv64-musl/package.json').version
|
|
410
|
-
if (bindingPackageVersion !== '0.1.
|
|
411
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
410
|
+
if (bindingPackageVersion !== '0.1.1-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
411
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.1-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
412
412
|
}
|
|
413
413
|
return binding
|
|
414
414
|
} catch (e) {
|
|
@@ -423,8 +423,8 @@ function requireNative() {
|
|
|
423
423
|
try {
|
|
424
424
|
const binding = require('brustjs-linux-riscv64-gnu')
|
|
425
425
|
const bindingPackageVersion = require('brustjs-linux-riscv64-gnu/package.json').version
|
|
426
|
-
if (bindingPackageVersion !== '0.1.
|
|
427
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
426
|
+
if (bindingPackageVersion !== '0.1.1-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
427
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.1-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
428
428
|
}
|
|
429
429
|
return binding
|
|
430
430
|
} catch (e) {
|
|
@@ -440,8 +440,8 @@ function requireNative() {
|
|
|
440
440
|
try {
|
|
441
441
|
const binding = require('brustjs-linux-ppc64-gnu')
|
|
442
442
|
const bindingPackageVersion = require('brustjs-linux-ppc64-gnu/package.json').version
|
|
443
|
-
if (bindingPackageVersion !== '0.1.
|
|
444
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
443
|
+
if (bindingPackageVersion !== '0.1.1-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
444
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.1-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
445
445
|
}
|
|
446
446
|
return binding
|
|
447
447
|
} catch (e) {
|
|
@@ -456,8 +456,8 @@ function requireNative() {
|
|
|
456
456
|
try {
|
|
457
457
|
const binding = require('brustjs-linux-s390x-gnu')
|
|
458
458
|
const bindingPackageVersion = require('brustjs-linux-s390x-gnu/package.json').version
|
|
459
|
-
if (bindingPackageVersion !== '0.1.
|
|
460
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
459
|
+
if (bindingPackageVersion !== '0.1.1-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
460
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.1-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
461
461
|
}
|
|
462
462
|
return binding
|
|
463
463
|
} catch (e) {
|
|
@@ -476,8 +476,8 @@ function requireNative() {
|
|
|
476
476
|
try {
|
|
477
477
|
const binding = require('brustjs-openharmony-arm64')
|
|
478
478
|
const bindingPackageVersion = require('brustjs-openharmony-arm64/package.json').version
|
|
479
|
-
if (bindingPackageVersion !== '0.1.
|
|
480
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
479
|
+
if (bindingPackageVersion !== '0.1.1-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
480
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.1-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
481
481
|
}
|
|
482
482
|
return binding
|
|
483
483
|
} catch (e) {
|
|
@@ -492,8 +492,8 @@ function requireNative() {
|
|
|
492
492
|
try {
|
|
493
493
|
const binding = require('brustjs-openharmony-x64')
|
|
494
494
|
const bindingPackageVersion = require('brustjs-openharmony-x64/package.json').version
|
|
495
|
-
if (bindingPackageVersion !== '0.1.
|
|
496
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
495
|
+
if (bindingPackageVersion !== '0.1.1-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
496
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.1-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
497
497
|
}
|
|
498
498
|
return binding
|
|
499
499
|
} catch (e) {
|
|
@@ -508,8 +508,8 @@ function requireNative() {
|
|
|
508
508
|
try {
|
|
509
509
|
const binding = require('brustjs-openharmony-arm')
|
|
510
510
|
const bindingPackageVersion = require('brustjs-openharmony-arm/package.json').version
|
|
511
|
-
if (bindingPackageVersion !== '0.1.
|
|
512
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
511
|
+
if (bindingPackageVersion !== '0.1.1-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
512
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.1-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
513
513
|
}
|
|
514
514
|
return binding
|
|
515
515
|
} catch (e) {
|
package/runtime/index.ts
CHANGED
|
@@ -614,5 +614,8 @@ export type { BrustConfig } from './config.ts'
|
|
|
614
614
|
export { Island } from './islands/island.tsx'
|
|
615
615
|
export type { IslandProps, HydrateTrigger } from './islands/island.tsx'
|
|
616
616
|
|
|
617
|
+
export { BrustPage } from './islands/brust-page.tsx'
|
|
618
|
+
export type { BrustPageProps } from './islands/brust-page.tsx'
|
|
619
|
+
|
|
617
620
|
export { buildIslands } from './islands/build.ts'
|
|
618
621
|
export type { IslandsBuildResult, BuildIslandsOptions } from './islands/build.ts'
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { createElement, type ReactNode } from 'react'
|
|
2
|
+
|
|
3
|
+
/** Props for the built-in `<BrustPage>` document shell.
|
|
4
|
+
*
|
|
5
|
+
* `<BrustPage>` is a NATIVE-route document component: in a `native: true` route
|
|
6
|
+
* the Rust JSX compiler intercepts the `BrustPage` tag and emits the whole
|
|
7
|
+
* `<html>/<head>/<body>` skeleton itself, auto-injecting the framework head tags
|
|
8
|
+
* (charset, viewport, the `/_brust/css/app.css` stylesheet link). The head is
|
|
9
|
+
* configured ENTIRELY through these props — you never write `<head>` markup, so
|
|
10
|
+
* brust keeps full ownership of `<head>` and can add more tags later (importmap,
|
|
11
|
+
* preloads) without colliding with hand-written head elements.
|
|
12
|
+
*
|
|
13
|
+
* All props are compile-time string literals on the native path (the shell is
|
|
14
|
+
* rendered in Rust, so they can't be dynamic expressions there). This React
|
|
15
|
+
* implementation mirrors the compiled output for the rare non-native use. */
|
|
16
|
+
export interface BrustPageProps {
|
|
17
|
+
/** `<html lang>` — defaults to `"en"`. */
|
|
18
|
+
lang?: string
|
|
19
|
+
/** `<html class>` (e.g. `"dark"`). */
|
|
20
|
+
className?: string
|
|
21
|
+
/** `<body class>`. */
|
|
22
|
+
bodyClassName?: string
|
|
23
|
+
/** `<title>…</title>`. Omitted when absent. */
|
|
24
|
+
title?: string
|
|
25
|
+
/** `<meta name="description" content="…">`. Omitted when absent. */
|
|
26
|
+
description?: string
|
|
27
|
+
/** Page body — rendered inside `<body>`. */
|
|
28
|
+
children?: ReactNode
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function BrustPage({
|
|
32
|
+
lang = 'en',
|
|
33
|
+
className,
|
|
34
|
+
bodyClassName,
|
|
35
|
+
title,
|
|
36
|
+
description,
|
|
37
|
+
children,
|
|
38
|
+
}: BrustPageProps): ReactNode {
|
|
39
|
+
return createElement(
|
|
40
|
+
'html',
|
|
41
|
+
{ lang, className },
|
|
42
|
+
createElement(
|
|
43
|
+
'head',
|
|
44
|
+
null,
|
|
45
|
+
createElement('meta', { charSet: 'utf-8' }),
|
|
46
|
+
createElement('meta', { name: 'viewport', content: 'width=device-width, initial-scale=1' }),
|
|
47
|
+
title != null ? createElement('title', null, title) : null,
|
|
48
|
+
description != null
|
|
49
|
+
? createElement('meta', { name: 'description', content: description })
|
|
50
|
+
: null,
|
|
51
|
+
createElement('link', { rel: 'stylesheet', href: '/_brust/css/app.css' }),
|
|
52
|
+
),
|
|
53
|
+
createElement('body', { className: bodyClassName }, children),
|
|
54
|
+
)
|
|
55
|
+
}
|
|
@@ -16,6 +16,10 @@ export interface IslandProps<P> {
|
|
|
16
16
|
props: P
|
|
17
17
|
/** When to hydrate. Default 'load'. */
|
|
18
18
|
hydrate?: HydrateTrigger
|
|
19
|
+
/** Native routes only: render this island server-side (renderToString during
|
|
20
|
+
* the loader crossing) so its markup ships in the HTML, then hydrate. Ignored
|
|
21
|
+
* on the React path (the whole tree already SSRs there). Default false. */
|
|
22
|
+
ssr?: boolean
|
|
19
23
|
}
|
|
20
24
|
|
|
21
25
|
/** Module-scope flag flipped by every `<Island>` render. `makeRenderer`
|