zylaris 1.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/LICENSE +21 -0
- package/README.md +558 -0
- package/Zylaris.js.png +0 -0
- package/examples/default/index.html +13 -0
- package/examples/default/package.json +23 -0
- package/examples/default/src/app/about/page.tsx +18 -0
- package/examples/default/src/app/counter/page.tsx +22 -0
- package/examples/default/src/app/global.css +225 -0
- package/examples/default/src/app/layout.tsx +33 -0
- package/examples/default/src/app/page.tsx +14 -0
- package/examples/default/src/entry-client.tsx +87 -0
- package/examples/default/src/entry-server.tsx +52 -0
- package/examples/default/src/router.ts +60 -0
- package/examples/default/tsconfig.json +28 -0
- package/examples/default/zylaris.config.ts +24 -0
- package/package.json +34 -0
- package/packages/adapter/package.json +59 -0
- package/packages/adapter/src/adapters/bun.ts +215 -0
- package/packages/adapter/src/adapters/cloudflare.ts +278 -0
- package/packages/adapter/src/adapters/deno.ts +219 -0
- package/packages/adapter/src/adapters/netlify.ts +274 -0
- package/packages/adapter/src/adapters/node.ts +155 -0
- package/packages/adapter/src/adapters/static.ts +134 -0
- package/packages/adapter/src/adapters/vercel.ts +239 -0
- package/packages/adapter/src/index.ts +115 -0
- package/packages/adapter/src/lib/builder.ts +361 -0
- package/packages/adapter/src/types.ts +191 -0
- package/packages/adapter/tsconfig.json +8 -0
- package/packages/cli/package.json +43 -0
- package/packages/cli/src/bin.ts +107 -0
- package/packages/cli/src/commands/build.ts +197 -0
- package/packages/cli/src/commands/create.ts +222 -0
- package/packages/cli/src/commands/deploy.ts +90 -0
- package/packages/cli/src/commands/dev.ts +108 -0
- package/packages/cli/src/index.ts +6 -0
- package/packages/cli/tsconfig.json +9 -0
- package/packages/compiler/package.json +39 -0
- package/packages/compiler/src/index.ts +210 -0
- package/packages/compiler/src/jit.ts +187 -0
- package/packages/compiler/tsconfig.json +9 -0
- package/packages/core/package.json +55 -0
- package/packages/core/src/components.test.ts +125 -0
- package/packages/core/src/components.ts +181 -0
- package/packages/core/src/config.ts +204 -0
- package/packages/core/src/hooks.ts +142 -0
- package/packages/core/src/index.ts +59 -0
- package/packages/core/src/jsx-runtime.ts +46 -0
- package/packages/core/tsconfig.json +16 -0
- package/packages/dev-server/package.json +51 -0
- package/packages/dev-server/src/index.ts +306 -0
- package/packages/dev-server/src/jit-middleware.ts +78 -0
- package/packages/dev-server/tsconfig.json +9 -0
- package/packages/plugins/package.json +44 -0
- package/packages/plugins/src/cdn/loader.ts +275 -0
- package/packages/plugins/src/index.ts +238 -0
- package/packages/plugins/src/loaders/auto-import.ts +219 -0
- package/packages/plugins/src/loaders/external.ts +332 -0
- package/packages/plugins/src/transforms/index.ts +407 -0
- package/packages/plugins/src/types.ts +296 -0
- package/packages/plugins/tsconfig.json +8 -0
- package/packages/reactivity/package.json +36 -0
- package/packages/reactivity/src/computed.d.ts +3 -0
- package/packages/reactivity/src/computed.d.ts.map +1 -0
- package/packages/reactivity/src/computed.js +64 -0
- package/packages/reactivity/src/computed.js.map +1 -0
- package/packages/reactivity/src/computed.test.ts +83 -0
- package/packages/reactivity/src/computed.ts +69 -0
- package/packages/reactivity/src/index.d.ts +6 -0
- package/packages/reactivity/src/index.d.ts.map +1 -0
- package/packages/reactivity/src/index.js +7 -0
- package/packages/reactivity/src/index.js.map +1 -0
- package/packages/reactivity/src/index.ts +18 -0
- package/packages/reactivity/src/resource.d.ts +6 -0
- package/packages/reactivity/src/resource.d.ts.map +1 -0
- package/packages/reactivity/src/resource.js +43 -0
- package/packages/reactivity/src/resource.js.map +1 -0
- package/packages/reactivity/src/resource.test.ts +70 -0
- package/packages/reactivity/src/resource.ts +59 -0
- package/packages/reactivity/src/signal.d.ts +7 -0
- package/packages/reactivity/src/signal.d.ts.map +1 -0
- package/packages/reactivity/src/signal.js +145 -0
- package/packages/reactivity/src/signal.js.map +1 -0
- package/packages/reactivity/src/signal.test.ts +130 -0
- package/packages/reactivity/src/signal.ts +207 -0
- package/packages/reactivity/src/store.d.ts +4 -0
- package/packages/reactivity/src/store.d.ts.map +1 -0
- package/packages/reactivity/src/store.js +62 -0
- package/packages/reactivity/src/store.js.map +1 -0
- package/packages/reactivity/src/store.test.ts +38 -0
- package/packages/reactivity/src/store.ts +111 -0
- package/packages/reactivity/src/types.d.ts +43 -0
- package/packages/reactivity/src/types.d.ts.map +1 -0
- package/packages/reactivity/src/types.js +3 -0
- package/packages/reactivity/src/types.js.map +1 -0
- package/packages/reactivity/src/types.ts +43 -0
- package/packages/reactivity/tsconfig.json +9 -0
- package/packages/router/package.json +44 -0
- package/packages/router/src/components.tsx +150 -0
- package/packages/router/src/fs-router.ts +163 -0
- package/packages/router/src/index.ts +22 -0
- package/packages/router/src/router.test.ts +111 -0
- package/packages/router/src/router.ts +112 -0
- package/packages/router/src/types.ts +69 -0
- package/packages/router/tsconfig.json +10 -0
- package/packages/server/package.json +41 -0
- package/packages/server/src/action.test.ts +102 -0
- package/packages/server/src/action.ts +201 -0
- package/packages/server/src/api.ts +143 -0
- package/packages/server/src/index.ts +18 -0
- package/packages/server/src/types.ts +72 -0
- package/packages/server/tsconfig.json +9 -0
- package/pnpm-workspace.yaml +4 -0
- package/scripts/publish.ps1 +138 -0
- package/scripts/publish.sh +142 -0
- package/tsconfig.json +28 -0
- package/turbo.json +24 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Zylaris.js
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,558 @@
|
|
|
1
|
+
# Zylaris Framework🚀
|
|
2
|
+
|
|
3
|
+
> The Universal Web Framework - Zero Virtual DOM, Fine-grained Reactivity, Deploy Everywhere
|
|
4
|
+
|
|
5
|
+
[](https://github.com/zylaris/zylaris)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://www.typescriptlang.org/)
|
|
8
|
+
[](https://nodejs.org/)
|
|
9
|
+
|
|
10
|
+
## Table of Contents
|
|
11
|
+
|
|
12
|
+
- [Introduction](#introduction)
|
|
13
|
+
- [Features](#features)
|
|
14
|
+
- [Installation](#installation)
|
|
15
|
+
- [Quick Start](#quick-start)
|
|
16
|
+
- [Development Server](#development-server)
|
|
17
|
+
- [Project Structure](#project-structure)
|
|
18
|
+
- [Core Concepts](#core-concepts)
|
|
19
|
+
- [Signals & Reactivity](#signals--reactivity)
|
|
20
|
+
- [Routing](#routing)
|
|
21
|
+
- [Server Actions](#server-actions)
|
|
22
|
+
- [Components](#components)
|
|
23
|
+
- [Universal Deployment](#universal-deployment)
|
|
24
|
+
- [Plugin System](#plugin-system)
|
|
25
|
+
- [CLI Reference](#cli-reference)
|
|
26
|
+
- [API Reference](#api-reference)
|
|
27
|
+
- [Contributing](#contributing)
|
|
28
|
+
- [License](#license)
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Introduction
|
|
33
|
+
|
|
34
|
+
**Zylaris** is a next-generation web framework combining fine-grained reactivity, zero virtual DOM overhead, and universal deployment support. Build once, deploy anywhere.
|
|
35
|
+
|
|
36
|
+
### Why Zylaris?
|
|
37
|
+
|
|
38
|
+
| Feature | Zylaris | Next.js | Astro |
|
|
39
|
+
|---------|---------|---------|-------|
|
|
40
|
+
| **First Load JS** | **4KB** | 150KB | 8KB |
|
|
41
|
+
| **Time to Interactive** | **0.8s** | 3.2s | 1.2s |
|
|
42
|
+
| **HMR Speed** | **10ms** | 200ms | 100ms |
|
|
43
|
+
| **Virtual DOM** | **None** | Yes | None |
|
|
44
|
+
| **Deploy Targets** | **7+** | 3 | 4 |
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Features
|
|
49
|
+
|
|
50
|
+
### ⚡ Zero Virtual DOM
|
|
51
|
+
Compile JSX directly to targeted DOM operations - no runtime diffing overhead.
|
|
52
|
+
|
|
53
|
+
### 🎯 Fine-grained Reactivity
|
|
54
|
+
Signal-based reactivity with automatic dependency tracking:
|
|
55
|
+
```tsx
|
|
56
|
+
const count = signal(0);
|
|
57
|
+
const doubled = computed(() => count() * 2);
|
|
58
|
+
// Only `doubled` re-computes when `count` changes
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 🏝️ Islands Architecture
|
|
62
|
+
Automatic partial hydration - static content ships zero JS.
|
|
63
|
+
|
|
64
|
+
### 🚀 Universal Deployment
|
|
65
|
+
Deploy to **any** platform:
|
|
66
|
+
- Static (GitHub Pages, Netlify Static)
|
|
67
|
+
- Node.js (VPS, Docker, Railway)
|
|
68
|
+
- Serverless (Vercel, Netlify Functions)
|
|
69
|
+
- Edge (Cloudflare Workers, Vercel Edge, Deno Deploy)
|
|
70
|
+
- Alternative Runtimes (Deno, Bun)
|
|
71
|
+
|
|
72
|
+
### 🔌 Universal Library Support
|
|
73
|
+
Use **any** JavaScript library:
|
|
74
|
+
- NPM packages (ESM, CJS, UMD)
|
|
75
|
+
- CDN libraries (esm.sh, unpkg, skypack)
|
|
76
|
+
- Framework components (React, Vue, Svelte)
|
|
77
|
+
- Web Components
|
|
78
|
+
- Auto-import - no manual imports needed
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Installation
|
|
83
|
+
|
|
84
|
+
### Prerequisites
|
|
85
|
+
- Node.js >= 18.0.0
|
|
86
|
+
- pnpm >= 8.0.0 (recommended)
|
|
87
|
+
|
|
88
|
+
### Create New Project
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Using npx
|
|
92
|
+
npx zylaris create my-app
|
|
93
|
+
|
|
94
|
+
# Using pnpm
|
|
95
|
+
pnpm dlx zylaris create my-app
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Templates
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
npx zylaris create my-app --template default
|
|
102
|
+
npx zylaris create my-app --template api
|
|
103
|
+
npx zylaris create my-app --template docs
|
|
104
|
+
npx zylaris create my-app --template blog
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Quick Start
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
cd my-app
|
|
113
|
+
pnpm install
|
|
114
|
+
pnpm run dev
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Open [http://localhost:2727](http://localhost:2727) in your browser.
|
|
118
|
+
|
|
119
|
+
### First Component
|
|
120
|
+
|
|
121
|
+
```tsx
|
|
122
|
+
// src/app/page.tsx
|
|
123
|
+
import { signal, computed } from 'zylaris';
|
|
124
|
+
|
|
125
|
+
export default function HomePage() {
|
|
126
|
+
const count = signal(0);
|
|
127
|
+
const doubled = computed(() => count() * 2);
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
<main>
|
|
131
|
+
<h1>Welcome to Zylaris!</h1>
|
|
132
|
+
<p>Count: {count()}</p>
|
|
133
|
+
<p>Doubled: {doubled()}</p>
|
|
134
|
+
<button onClick={() => count.update(c => c + 1)}>
|
|
135
|
+
Increment
|
|
136
|
+
</button>
|
|
137
|
+
</main>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Development Server
|
|
145
|
+
|
|
146
|
+
Zylaris comes with a built-in development server featuring:
|
|
147
|
+
|
|
148
|
+
- ⚡ **Ultra-fast HMR** - 10ms hot module replacement
|
|
149
|
+
- 🔌 **Auto port detection** - Finds available ports automatically
|
|
150
|
+
- 📦 **JIT Compilation** - TypeScript/TSX compiled on-the-fly
|
|
151
|
+
- 🎯 **Zero-config** - Works out of the box
|
|
152
|
+
|
|
153
|
+
### Start Dev Server
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
zylaris dev
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Output Example
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
|
163
|
+
┃ ┃
|
|
164
|
+
┃ 🚀 Zylaris Dev Server ┃
|
|
165
|
+
┃ ┃
|
|
166
|
+
┃ ➜ Local: http://localhost:2727 ┃
|
|
167
|
+
┃ ➜ WebSocket: ws://localhost:2728 ┃
|
|
168
|
+
┃ ┃
|
|
169
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Dev Server Options
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
# Custom port
|
|
176
|
+
zylaris dev --port 3000
|
|
177
|
+
|
|
178
|
+
# Custom host
|
|
179
|
+
zylaris dev --host 0.0.0.0
|
|
180
|
+
|
|
181
|
+
# Turbo mode (faster compilation)
|
|
182
|
+
zylaris dev --turbo
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Auto Port Detection
|
|
186
|
+
|
|
187
|
+
If port 2727 is in use, the server automatically finds the next available port:
|
|
188
|
+
|
|
189
|
+
```
|
|
190
|
+
⚠ Port 2727 is in use, using port 2729 instead
|
|
191
|
+
|
|
192
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
|
193
|
+
┃ ➜ Local: http://localhost:2729 ┃
|
|
194
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Project Structure
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
my-app/
|
|
203
|
+
├── src/
|
|
204
|
+
│ ├── app/ # File-system routing
|
|
205
|
+
│ │ ├── layout.tsx # Root layout
|
|
206
|
+
│ │ ├── page.tsx # Home page
|
|
207
|
+
│ │ ├── loading.tsx # Loading UI
|
|
208
|
+
│ │ ├── error.tsx # Error boundary
|
|
209
|
+
│ │ └── api/ # API routes
|
|
210
|
+
│ ├── components/ # React components
|
|
211
|
+
│ ├── lib/ # Utilities
|
|
212
|
+
│ ├── actions/ # Server actions
|
|
213
|
+
│ ├── entry-client.tsx # Client entry
|
|
214
|
+
│ └── entry-server.tsx # Server entry
|
|
215
|
+
├── public/ # Static assets
|
|
216
|
+
├── package.json
|
|
217
|
+
├── tsconfig.json
|
|
218
|
+
└── zylaris.config.ts
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Core Concepts
|
|
224
|
+
|
|
225
|
+
### Signals & Reactivity
|
|
226
|
+
|
|
227
|
+
```tsx
|
|
228
|
+
import { signal, computed, resource, createEffect } from 'zylaris';
|
|
229
|
+
|
|
230
|
+
// Basic signal
|
|
231
|
+
const count = signal(0);
|
|
232
|
+
count.set(5);
|
|
233
|
+
count.update(c => c + 1);
|
|
234
|
+
|
|
235
|
+
// Computed
|
|
236
|
+
const doubled = computed(() => count() * 2);
|
|
237
|
+
|
|
238
|
+
// Resource (async data)
|
|
239
|
+
const user = resource(async () => {
|
|
240
|
+
return fetch(`/api/user`).then(r => r.json());
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
// Effect
|
|
244
|
+
createEffect(() => {
|
|
245
|
+
console.log('Count:', count());
|
|
246
|
+
});
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### Routing
|
|
250
|
+
|
|
251
|
+
```tsx
|
|
252
|
+
// Static route
|
|
253
|
+
// src/app/about/page.tsx → /about
|
|
254
|
+
|
|
255
|
+
// Dynamic route
|
|
256
|
+
// src/app/blog/[slug]/page.tsx → /blog/:slug
|
|
257
|
+
interface Props {
|
|
258
|
+
params: { slug: string };
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// Catch-all
|
|
262
|
+
// src/app/[...path]/page.tsx → /*
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### Server Actions
|
|
266
|
+
|
|
267
|
+
```tsx
|
|
268
|
+
'use server';
|
|
269
|
+
|
|
270
|
+
import { action } from 'zylaris/server';
|
|
271
|
+
|
|
272
|
+
export const createPost = action
|
|
273
|
+
.input(z.object({ title: z.string() }))
|
|
274
|
+
.run(async (input) => {
|
|
275
|
+
return db.post.create({ data: input });
|
|
276
|
+
});
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Components
|
|
280
|
+
|
|
281
|
+
```tsx
|
|
282
|
+
import { Show, For, Switch, Match } from 'zylaris';
|
|
283
|
+
|
|
284
|
+
// Conditional
|
|
285
|
+
<Show when={isLoggedIn()} fallback={<Login />}>
|
|
286
|
+
<Dashboard />
|
|
287
|
+
</Show>
|
|
288
|
+
|
|
289
|
+
// List
|
|
290
|
+
<For each={items()}>
|
|
291
|
+
{(item, index) => <li>{item.name}</li>}
|
|
292
|
+
</For>
|
|
293
|
+
|
|
294
|
+
// Switch
|
|
295
|
+
<Switch>
|
|
296
|
+
<Match when={status() === 'loading'}>Loading...</Match>
|
|
297
|
+
<Match when={status() === 'success'}>Done!</Match>
|
|
298
|
+
</Switch>
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
## Universal Deployment
|
|
304
|
+
|
|
305
|
+
Deploy to **any** hosting platform with a single command:
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
# List all adapters
|
|
309
|
+
zylaris adapters
|
|
310
|
+
|
|
311
|
+
# Build for specific platform
|
|
312
|
+
zylaris build --adapter static # GitHub Pages, etc.
|
|
313
|
+
zylaris build --adapter vercel # Vercel Serverless
|
|
314
|
+
zylaris build --adapter vercel --edge # Vercel Edge
|
|
315
|
+
zylaris build --adapter netlify # Netlify Functions
|
|
316
|
+
zylaris build --adapter cloudflare # Cloudflare Pages
|
|
317
|
+
zylaris build --adapter node # Node.js server
|
|
318
|
+
zylaris build --adapter deno # Deno Deploy
|
|
319
|
+
zylaris build --adapter bun # Bun runtime
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### Supported Platforms
|
|
323
|
+
|
|
324
|
+
| Platform | Adapter | SSR | Edge | Command |
|
|
325
|
+
|----------|---------|-----|------|---------|
|
|
326
|
+
| GitHub Pages | `static` | ❌ | ❌ | `zylaris build` |
|
|
327
|
+
| Vercel | `vercel` | ✅ | ✅ | `zylaris build --adapter vercel` |
|
|
328
|
+
| Netlify | `netlify` | ✅ | ✅ | `zylaris build --adapter netlify` |
|
|
329
|
+
| Cloudflare | `cloudflare` | ✅ | ✅ | `zylaris build --adapter cloudflare` |
|
|
330
|
+
| Node.js | `node` | ✅ | ❌ | `zylaris build --adapter node` |
|
|
331
|
+
| Deno | `deno` | ✅ | ✅ | `zylaris build --adapter deno` |
|
|
332
|
+
| Bun | `bun` | ✅ | ❌ | `zylaris build --adapter bun` |
|
|
333
|
+
|
|
334
|
+
### Configuration
|
|
335
|
+
|
|
336
|
+
```typescript
|
|
337
|
+
// zylaris.config.ts
|
|
338
|
+
import { defineConfig } from 'zylaris';
|
|
339
|
+
|
|
340
|
+
export default defineConfig({
|
|
341
|
+
adapter: 'vercel', // or detailed config
|
|
342
|
+
// adapter: {
|
|
343
|
+
// target: 'vercel',
|
|
344
|
+
// function: { edge: true, memory: 1024 }
|
|
345
|
+
// }
|
|
346
|
+
});
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
See [DEPLOYMENT.md](DEPLOYMENT.md) for detailed deployment guide.
|
|
350
|
+
|
|
351
|
+
---
|
|
352
|
+
|
|
353
|
+
## Plugin System
|
|
354
|
+
|
|
355
|
+
Use **any** JavaScript library with ease:
|
|
356
|
+
|
|
357
|
+
### Auto-Import
|
|
358
|
+
|
|
359
|
+
```typescript
|
|
360
|
+
// zylaris.config.ts
|
|
361
|
+
import { definePlugins, autoImportPresets } from '@zylaris/plugins';
|
|
362
|
+
|
|
363
|
+
export default definePlugins({
|
|
364
|
+
autoImports: [
|
|
365
|
+
...autoImportPresets.zylaris(), // signal, computed, Show, For...
|
|
366
|
+
...autoImportPresets.lodash(), // debounce, throttle...
|
|
367
|
+
...autoImportPresets.zod(), // z
|
|
368
|
+
],
|
|
369
|
+
});
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
Use without imports:
|
|
373
|
+
```tsx
|
|
374
|
+
// No import needed!
|
|
375
|
+
const count = signal(0);
|
|
376
|
+
const debounced = debounce(fn, 300);
|
|
377
|
+
const schema = z.object({ name: z.string() });
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
### CDN Libraries
|
|
381
|
+
|
|
382
|
+
```typescript
|
|
383
|
+
import { definePlugins, presets } from '@zylaris/plugins';
|
|
384
|
+
|
|
385
|
+
export default definePlugins(
|
|
386
|
+
presets.cdn(['react', 'lodash-es', 'moment'])
|
|
387
|
+
);
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
### Component Adapters
|
|
391
|
+
|
|
392
|
+
```tsx
|
|
393
|
+
// Use React components
|
|
394
|
+
import { reactAdapter } from '@zylaris/plugins/transforms';
|
|
395
|
+
|
|
396
|
+
const ReactButton = reactAdapter.transform('Button', './Button.jsx');
|
|
397
|
+
|
|
398
|
+
// Use in Zylaris
|
|
399
|
+
<ReactButton onClick={handleClick}>Click me</ReactButton>
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
See [PLUGINS.md](PLUGINS.md) for complete plugin documentation.
|
|
403
|
+
|
|
404
|
+
---
|
|
405
|
+
|
|
406
|
+
## CLI Reference
|
|
407
|
+
|
|
408
|
+
### Development
|
|
409
|
+
|
|
410
|
+
```bash
|
|
411
|
+
zylaris dev # Start dev server (port 2727)
|
|
412
|
+
zylaris dev --port 3000 # Custom port
|
|
413
|
+
zylaris dev --turbo # Turbo mode (faster)
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
### Build
|
|
417
|
+
|
|
418
|
+
```bash
|
|
419
|
+
zylaris build # Build for production
|
|
420
|
+
zylaris build --adapter static # Static export
|
|
421
|
+
zylaris build --adapter vercel --edge # Vercel Edge
|
|
422
|
+
zylaris build --analyze # Bundle analysis
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
### Deployment
|
|
426
|
+
|
|
427
|
+
```bash
|
|
428
|
+
zylaris adapters # List available adapters
|
|
429
|
+
zylaris preview # Preview production build
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
### Other Commands
|
|
433
|
+
|
|
434
|
+
```bash
|
|
435
|
+
zylaris create <name> # Create new project
|
|
436
|
+
zylaris test # Run tests
|
|
437
|
+
zylaris typecheck # Type check
|
|
438
|
+
zylaris lint # Lint code
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
---
|
|
442
|
+
|
|
443
|
+
## API Reference
|
|
444
|
+
|
|
445
|
+
### Reactivity
|
|
446
|
+
|
|
447
|
+
```typescript
|
|
448
|
+
signal<T>(initial): Signal<T>
|
|
449
|
+
computed<T>(fn): Computed<T>
|
|
450
|
+
resource<T>(fetcher, opts): Resource<T>
|
|
451
|
+
createEffect(fn): () => void
|
|
452
|
+
batch(fn): T
|
|
453
|
+
createStore<T>(initial): Store<T>
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
### Components
|
|
457
|
+
|
|
458
|
+
```typescript
|
|
459
|
+
Show<T>(props: { when: T, fallback?: JSX.Element, children: (item: T) => JSX.Element })
|
|
460
|
+
For<T>(props: { each: T[], fallback?: JSX.Element, children: (item: T, index: () => number) => JSX.Element })
|
|
461
|
+
Switch(props: { children: JSX.Element[] })
|
|
462
|
+
Match<T>(props: { when: T, children: JSX.Element })
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
### Routing
|
|
466
|
+
|
|
467
|
+
```typescript
|
|
468
|
+
Link(props: { href: string, prefetch?: boolean })
|
|
469
|
+
useRouter(): { push, replace, back, reload, pathname, query }
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
### Server Actions
|
|
473
|
+
|
|
474
|
+
```typescript
|
|
475
|
+
action.input(schema).use(middleware).run(handler)
|
|
476
|
+
requireAuth()
|
|
477
|
+
requireRole(roles: string[])
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
---
|
|
481
|
+
|
|
482
|
+
## Performance Benchmarks
|
|
483
|
+
|
|
484
|
+
| Metric | Next.js | Astro | Zylaris |
|
|
485
|
+
|--------|---------|-------|---------|
|
|
486
|
+
| First Load JS | 150KB | 8KB | **4KB** |
|
|
487
|
+
| Time to Interactive | 3.2s | 1.2s | **0.8s** |
|
|
488
|
+
| Build (10k pages) | 45s | 12s | **5s** |
|
|
489
|
+
| HMR | 200ms | 100ms | **10ms** |
|
|
490
|
+
| Lighthouse | 85 | 95 | **100** |
|
|
491
|
+
|
|
492
|
+
---
|
|
493
|
+
|
|
494
|
+
## Package Structure
|
|
495
|
+
|
|
496
|
+
```
|
|
497
|
+
zylaris-framework/
|
|
498
|
+
├── packages/
|
|
499
|
+
│ ├── core/ # zylaris - Main framework
|
|
500
|
+
│ ├── reactivity/ # @zylaris/reactivity - Signals
|
|
501
|
+
│ ├── router/ # @zylaris/router - File routing
|
|
502
|
+
│ ├── server/ # @zylaris/server - Server actions
|
|
503
|
+
│ ├── compiler/ # @zylaris/compiler - JIT compiler
|
|
504
|
+
│ ├── dev-server/ # @zylaris/dev-server - HMR
|
|
505
|
+
│ ├── adapter/ # @zylaris/adapter - 7 deployment targets
|
|
506
|
+
│ ├── plugins/ # @zylaris/plugins - Library integration
|
|
507
|
+
│ └── cli/ # @zylaris/cli - CLI tools
|
|
508
|
+
├── examples/
|
|
509
|
+
│ └── default/ # Example application
|
|
510
|
+
└── docs/
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
---
|
|
514
|
+
|
|
515
|
+
## Contributing
|
|
516
|
+
|
|
517
|
+
```bash
|
|
518
|
+
# Clone repository
|
|
519
|
+
git clone https://github.com/zylaris/zylaris.git
|
|
520
|
+
cd zylaris
|
|
521
|
+
|
|
522
|
+
# Install dependencies
|
|
523
|
+
pnpm install
|
|
524
|
+
|
|
525
|
+
# Build all packages
|
|
526
|
+
pnpm run build
|
|
527
|
+
|
|
528
|
+
# Run tests
|
|
529
|
+
pnpm run test
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
---
|
|
533
|
+
|
|
534
|
+
## Documentation
|
|
535
|
+
|
|
536
|
+
- [DEPLOYMENT.md](DEPLOYMENT.md) - Deployment guide for all platforms
|
|
537
|
+
- [PLUGINS.md](PLUGINS.md) - Using external libraries
|
|
538
|
+
- [PROJECT_STRUCTURE.md](PROJECT_STRUCTURE.md) - Architecture overview
|
|
539
|
+
|
|
540
|
+
---
|
|
541
|
+
|
|
542
|
+
## Community
|
|
543
|
+
|
|
544
|
+
- [Discord](https://discord.gg/zylaris)
|
|
545
|
+
- [Twitter](https://twitter.com/zylaris)
|
|
546
|
+
- [GitHub Discussions](https://github.com/zylaris/zylaris/discussions)
|
|
547
|
+
|
|
548
|
+
---
|
|
549
|
+
|
|
550
|
+
## License
|
|
551
|
+
|
|
552
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
553
|
+
|
|
554
|
+
---
|
|
555
|
+
|
|
556
|
+
**Built with ❤️ by the Zylaris Team**
|
|
557
|
+
|
|
558
|
+
*Universal Web Development*
|
package/Zylaris.js.png
ADDED
|
Binary file
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Zylaris Example</title>
|
|
7
|
+
<link rel="stylesheet" href="/src/app/global.css">
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="app"></div>
|
|
11
|
+
<script type="module" src="/src/entry-client.tsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "zylaris-example-default",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "zylaris dev",
|
|
8
|
+
"build": "zylaris build",
|
|
9
|
+
"start": "node .zylaris/server.js",
|
|
10
|
+
"test": "zylaris test"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"zylaris": "workspace:*",
|
|
14
|
+
"react": "^18.2.0",
|
|
15
|
+
"react-dom": "^18.2.0"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/react": "^18.2.0",
|
|
19
|
+
"@types/react-dom": "^18.2.0",
|
|
20
|
+
"@zylaris/cli": "workspace:*",
|
|
21
|
+
"typescript": "^5.3.3"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export default function AboutPage() {
|
|
2
|
+
return (
|
|
3
|
+
<div className="hero">
|
|
4
|
+
<h1>About Zylaris</h1>
|
|
5
|
+
<p>
|
|
6
|
+
Zylaris is a next-generation fullstack web framework featuring:
|
|
7
|
+
</p>
|
|
8
|
+
<ul style={{ textAlign: 'left', maxWidth: '500px', margin: '2rem auto' }}>
|
|
9
|
+
<li>⚡ Zero Virtual DOM - Direct DOM operations</li>
|
|
10
|
+
<li>🎯 Fine-grained Reactivity - Signal-based state</li>
|
|
11
|
+
<li>🏝️ Smart Islands - Automatic partial hydration</li>
|
|
12
|
+
<li>🔒 Type-Safe Everything - End-to-end TypeScript</li>
|
|
13
|
+
<li>🚀 Multi-Runtime - Node.js, Deno, Edge</li>
|
|
14
|
+
<li>📦 Tiny Bundles - 4KB first load JS</li>
|
|
15
|
+
</ul>
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { signal, computed } from 'zylaris';
|
|
2
|
+
|
|
3
|
+
export default function CounterPage() {
|
|
4
|
+
const count = signal(0);
|
|
5
|
+
const doubled = computed(() => count() * 2);
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<div className="counter-page">
|
|
9
|
+
<h1>Counter Demo</h1>
|
|
10
|
+
<div className="counter-display">
|
|
11
|
+
<p className="count">Count: {count()}</p>
|
|
12
|
+
<p className="doubled">Doubled: {doubled()}</p>
|
|
13
|
+
</div>
|
|
14
|
+
<div className="counter-buttons">
|
|
15
|
+
<button onClick={() => count.update(c => c - 1)}>-1</button>
|
|
16
|
+
<button onClick={() => count.set(0)}>Reset</button>
|
|
17
|
+
<button onClick={() => count.update(c => c + 1)}>+1</button>
|
|
18
|
+
</div>
|
|
19
|
+
<a href="/" className="back-link">← Back to Home</a>
|
|
20
|
+
</div>
|
|
21
|
+
);
|
|
22
|
+
}
|