zylaris 1.0.4 β†’ 1.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.
Files changed (2) hide show
  1. package/README.md +558 -0
  2. package/package.json +2 -2
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
+ [![Version](https://img.shields.io/badge/version-1.0.0-blue.svg)](https://github.com/zylaris/zylaris)
6
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
7
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.3-blue.svg)](https://www.typescriptlang.org/)
8
+ [![Node](https://img.shields.io/badge/Node-%3E=18.0.0-brightgreen.svg)](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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zylaris",
3
- "version": "1.0.4",
4
- "description": "Zylaris - The Universal Web Framework",
3
+ "version": "1.0.5",
4
+ "description": "The compiler-driven web framework for the next generation. Zero Virtual DOM, fine-grained reactivity, and stellar performance.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",