elegance-js 3.0.0 → 3.0.1

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 +90 -0
  2. package/package.json +5 -3
package/README.md ADDED
@@ -0,0 +1,90 @@
1
+ # Elegance
2
+
3
+ Elegance is a TypeScript framework for web applications. It provides file‑system routing, reactive state, server‑side rendering, and client‑side interactivity in a single codebase.
4
+
5
+ ## Features
6
+
7
+ - Ridiculous speed: Up to ~24x faster build times compared to Next.JS, and up to ~1400x raw RPS on API Routes.
8
+ - Optimized: 4KB client runtime
9
+ - File‑system routing: pages and API endpoints are defined by the directory structure.
10
+ - TSX support: use TSX with no runtime overhead.
11
+ - Server & Client hybrid: You can write server & client-code in 1 file with no issues.
12
+ - Reactive: atoms and components with automatic dependency tracking.
13
+ - Dynamic rendering: opt into per‑request rendering or statically enumerate paths.
14
+ - Server Actions: Inline API routes into your page files for faster development times.
15
+ - Middleware: scoped request processing with the ability to pass data to downstream handlers.
16
+ - Built‑in bundling: code splitting and advanced dead‑code elimination (DCE).
17
+ - API routes: define `GET`, `POST`, `PUT`, `DELETE`, and `OPTIONS` handlers.
18
+
19
+ ## Quick Start
20
+
21
+ ```bash
22
+ npx create-elegance-app my-app
23
+ cd my-app
24
+ npx elegance
25
+ ```
26
+
27
+ Visit `http://localhost:3000` to see the default page.
28
+
29
+ ## Example
30
+
31
+ A simple counter:
32
+
33
+ ```tsx
34
+ const counter = state(0);
35
+
36
+ export default function CounterPage() {
37
+ return div(
38
+ button({
39
+ onClick: () => counter.value++,
40
+ },
41
+ `Counter: ${counter.value}`
42
+ )
43
+ );
44
+ }
45
+ ```
46
+
47
+ A reusable component version:
48
+
49
+ ```tsx
50
+ const Counter = component({
51
+ atoms: {
52
+ counter: 0,
53
+ },
54
+ view(_, { counter }) {
55
+ return button({
56
+ onClick: () => counter.value++,
57
+ },
58
+ `Counter: ${counter.value}`
59
+ );
60
+ }
61
+ });
62
+
63
+ export default function Page() {
64
+ return Counter();
65
+ }
66
+ ```
67
+
68
+ ## Project Structure
69
+
70
+ ```
71
+ my-app/
72
+ ├── pages/
73
+ │ ├── page.tsx # / (home)
74
+ │ ├── about/
75
+ │ │ └── page.tsx # /about
76
+ │ ├── api/
77
+ │ │ └── route.ts # /api/*
78
+ │ ├── [slug]/
79
+ │ │ └── page.tsx # dynamic routes
80
+ │ └── middleware.ts # global middleware
81
+ └── ...
82
+ ```
83
+
84
+ ## Documentation
85
+
86
+ Full documentation is available via [Our Website](https://elegance.js.org/)
87
+
88
+ ## License
89
+
90
+ MIT
package/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "elegance-js",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "type": "module",
5
5
  "main": "dist/user-utils.js",
6
6
  "bin": {
7
7
  "bootstrap": "./bin/bootstrap.js",
8
8
  "elegance": "./bin/run.js"
9
9
  },
10
- "files": ["dist"],
10
+ "files": [
11
+ "dist"
12
+ ],
11
13
  "scripts": {
12
14
  "lint": "oxlint ./src --fix -D unused-variable -D unused-import",
13
15
  "build": "esbuild './src/*.ts' './src/**/*.ts' --outdir=./dist --outbase=./src --format=esm --platform=node --bundle=false && tsc --emitDeclarationOnly && node scripts/fix-imports.js"
@@ -62,4 +64,4 @@
62
64
  "oxlint": "^1.68.0",
63
65
  "typescript": "^5.0.0"
64
66
  }
65
- }
67
+ }