ziex 0.0.1-dev.0

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/README.md ADDED
@@ -0,0 +1,153 @@
1
+ # ZX
2
+
3
+ A Zig library for building web applications with JSX-like syntax. Write declarative UI components using familiar JSX patterns, transpiled to efficient Zig code.
4
+
5
+ ZX combines the power and performance of Zig with the expressiveness of JSX, enabling you to build fast, type-safe web applications. ZX is significantly faster than frameworks like Next.js at SSR.
6
+
7
+ **[Full Documentation →](https://ziex.dev)**
8
+
9
+ ## Installation
10
+
11
+ ##### Linux/macOS
12
+ ```bash
13
+ curl -fsSL https://ziex.dev/install | bash
14
+ ```
15
+
16
+ ##### Windows
17
+ ```powershell
18
+ powershell -c "irm ziex.dev/install.ps1 | iex"
19
+
20
+ ```
21
+ ##### Installing Zig
22
+ ```bash
23
+ brew install zig # macOS
24
+ winget install -e --id zig.zig # Windows
25
+ ```
26
+ [_See for other platforms →_](https://ziglang.org/learn/getting-started/)
27
+
28
+ ## Quick Example
29
+
30
+ ```tsx site/pages/docs/example/overview.zx
31
+ pub fn QuickExample(allocator: zx.Allocator) zx.Component {
32
+ const is_loading = true;
33
+ const chars = "Hello, ZX Dev!";
34
+
35
+ return (
36
+ <main @allocator={allocator}>
37
+ <section>
38
+ {if (is_loading) (<h1>Loading...</h1>) else (<h1>Loaded</h1>)}
39
+ </section>
40
+
41
+ <section>
42
+ {for (chars) |char| (<span>{[char:c]}</span>)}
43
+ </section>
44
+
45
+ <section>
46
+ {for (users) |user| (
47
+ <Profile name={user.name} age={user.age} role={user.role} />
48
+ )}
49
+ </section>
50
+ </main>
51
+ );
52
+ }
53
+
54
+ fn Profile(allocator: zx.Allocator, user: User) zx.Component {
55
+ return (
56
+ <div @allocator={allocator}>
57
+ <h1>{user.name}</h1>
58
+ <p>{[user.age:d]}</p>
59
+ {switch (user.role) {
60
+ .admin => (<p>Admin</p>),
61
+ .member => (<p>Member</p>),
62
+ }}
63
+ </div>
64
+ );
65
+ }
66
+
67
+ const UserRole = enum { admin, member };
68
+ const User = struct { name: []const u8, age: u32, role: UserRole };
69
+
70
+ const users = [_]User{
71
+ .{ .name = "John", .age = 20, .role = .admin },
72
+ .{ .name = "Jane", .age = 21, .role = .member },
73
+ };
74
+
75
+ const zx = @import("zx");
76
+ ```
77
+ ## Feature Checklist
78
+
79
+ - [x] Server Side Rendering (SSR)
80
+ - [x] Static Site Generation (SSG)
81
+ - [ ] Client Side Rendering (CSR) via WebAssembly (_WIP_)
82
+ - [x] Client Side Rendering (CSR) via React
83
+ - [x] Type Safety
84
+ - [x] Routing
85
+ - [x] File-system Routing
86
+ - [x] Search Parameters
87
+ - [ ] Path Segments
88
+ - [x] Components
89
+ - [x] Control Flow
90
+ - [ ] `if`
91
+ - [ ] `if` nested
92
+ - [x] `if/else`
93
+ - [x] `if/else` nested
94
+ - [x] `for`
95
+ - [x] `for` nested
96
+ - [x] `switch`
97
+ - [x] `switch` nested
98
+ - [ ] `while`
99
+ - [ ] `while` nested
100
+ - [x] Assets
101
+ - [x] Copying
102
+ - [x] Serving
103
+ - [ ] Assets Optimization
104
+ - [ ] Image
105
+ - [ ] CSS
106
+ - [ ] JS
107
+ - [ ] HTML
108
+ - [ ] Middleware
109
+ - [ ] API Endpoints
110
+ - [ ] Server Actions
111
+ - [ ] CLI
112
+ - [x] `init` Project Template
113
+ - [x] `transpile` Transpile .zx files to Zig source code
114
+ - [x] `serve` Serve the project
115
+ - [x] `dev` HMR or Rebuild on Change
116
+ - [x] `fmt` Format the ZX source code (_Alpha_)
117
+ - [x] `export` Generate static site assets
118
+ - [ ] `bundle` Bundle the ZX executable with public/assets and exe
119
+ - [x] `version` Show the version of the ZX CLI
120
+ - [x] `update` Update the version of ZX dependency
121
+ - [x] `upgrade` Upgrade the version of ZX CLI
122
+
123
+ #### Editor Support
124
+
125
+ * [VSCode](https://marketplace.visualstudio.com/items?itemName=nurulhudaapon.zx)/[Cursor](https://marketplace.visualstudio.com/items?itemName=nurulhudaapon.zx) Extension
126
+ - [x] Syntax Highlighting
127
+ - [x] LSP Support
128
+ - [x] Auto Format
129
+
130
+ * Neovim
131
+ - [ ] Syntax Highlighting
132
+ - [ ] LSP Support
133
+ - [ ] Auto Format
134
+
135
+ ## Similar Projects
136
+
137
+ * [Yew](https://github.com/yewstack/yew) - Rust / Wasm framework for creating reliable and efficient web applications
138
+ * [ZTS](https://github.com/zigster64/zts) — Zig Templates made Simple, a templating system for Zig
139
+ * [zmpl](https://github.com/jetzig-framework/zmpl) — Mode-based templating language that compiles to Zig functions at build time, used in Jetzig
140
+ * [mustache-zig](https://github.com/batiati/mustache-zig) — Mustache template engine implementation in Zig
141
+ * [etch](https://github.com/haze/etch) — Compile-time tuned templating engine focusing on speed and simplicity
142
+ * [Zap](https://github.com/zigzap/zap) — High-performance backend framework in Zig
143
+ * [http.zig](https://github.com/karlseguin/http.zig) — Low-level HTTP/1.1 server written entirely in Zig (_ZX_'s backend)
144
+ * [tokamak](https://github.com/cztomsik/tokamak) — Server-side framework for Zig
145
+ * [zig-router](https://github.com/Cloudef/zig-router) — Straightforward HTTP-like request routing library for Zig
146
+ * [zig-webui](https://github.com/webui-dev/zig-webui/) — Zig library that allows using any web browser as a GUI
147
+ * [Zine](https://github.com/kristoff-it/zine) — Fast, scalable, flexible static site generator (SSG) written in Zig
148
+ * [Zinc](https://github.com/zon-dev/zinc/) — Web framework written in pure Zig with focus on high performance, usability, security, and extensibility
149
+ * [zUI](https://github.com/thienpow/zui) — UI kit for Jetzig framework with reusable components and styles
150
+
151
+ ## Contributing
152
+
153
+ Contributions are welcome! Currently trying out ZX and reporting issues for edge cases and providing feedback are greatly appreciated.
package/index.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ export declare const components: ComponentMetadata[];
2
+ type ComponentMetadata = {
3
+ name: string;
4
+ path: string;
5
+ id: string;
6
+ import: () => Promise<(props: unknown) => React.ReactElement>;
7
+ };
8
+ export {};
package/index.js ADDED
@@ -0,0 +1 @@
1
+ var n="{[ZX_COMPONENTS]s}";export{n as components};
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "ziex",
3
+ "description": "ZX is a framework for building web applications with Zig.",
4
+ "main": "index.js",
5
+ "type": "module",
6
+ "version": "0.0.1-dev.0",
7
+ "homepage": "https://github.com/nurulhudaapon/zx",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/nurulhudaapon/zx.git"
11
+ },
12
+ "keywords": [
13
+ "zx",
14
+ "zig",
15
+ "web framework",
16
+ "jsx",
17
+ "react",
18
+ "server components",
19
+ "client components",
20
+ "server actions",
21
+ "client actions",
22
+ "server actions"
23
+ ],
24
+ "author": "Nurul Huda (Apon) <me@nurulhudaapon.com>",
25
+ "license": "MIT",
26
+ "module": "index.js",
27
+ "types": "index.d.ts"
28
+ }