vaderjs 2.3.14 → 2.3.16
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 -21
- package/README.md +89 -0
- package/cli.ts +227 -227
- package/config/index.ts +3 -0
- package/jsconfig.json +7 -7
- package/main.ts +744 -0
- package/package.json +16 -16
- package/plugins/index.ts +72 -72
- package/README.MD +0 -99
- package/main.js +0 -750
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "vaderjs",
|
|
3
|
-
"version": "2.3.
|
|
4
|
-
"description": "A simple and powerful JavaScript library for building modern web applications.",
|
|
5
|
-
"bin": {
|
|
6
|
-
"vaderjs": "./main.
|
|
7
|
-
},
|
|
8
|
-
"repository": {
|
|
9
|
-
"type": "git",
|
|
10
|
-
"url": "https://github.com/Postr-Inc/Vader.js"
|
|
11
|
-
},
|
|
12
|
-
"license": "MIT",
|
|
13
|
-
"dependencies": {
|
|
14
|
-
"ansi-colors": "latest"
|
|
15
|
-
}
|
|
16
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "vaderjs",
|
|
3
|
+
"version": "2.3.16",
|
|
4
|
+
"description": "A simple and powerful JavaScript library for building modern web applications.",
|
|
5
|
+
"bin": {
|
|
6
|
+
"vaderjs": "./main.ts"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/Postr-Inc/Vader.js"
|
|
11
|
+
},
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"ansi-colors": "latest"
|
|
15
|
+
}
|
|
16
|
+
}
|
package/plugins/index.ts
CHANGED
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
// vaderPlugin.d.ts
|
|
2
|
-
|
|
3
|
-
/** The API object passed to plugin hooks */
|
|
4
|
-
export interface VaderAPI {
|
|
5
|
-
/** Run a shell command (string or string[]) and wait for it to finish */
|
|
6
|
-
runCommand(cmd: string | string[]): Promise<void>;
|
|
7
|
-
|
|
8
|
-
/** Inject arbitrary HTML into the <head> of generated index.html files */
|
|
9
|
-
injectHTML(content: string): void;
|
|
10
|
-
|
|
11
|
-
/** Log a message prefixed with [Vader Plugin] */
|
|
12
|
-
log : {
|
|
13
|
-
warn: (msg: any) => void,
|
|
14
|
-
info: (msg: any) => void,
|
|
15
|
-
error: (msg: any) => void,
|
|
16
|
-
success: (msg: any) => void,
|
|
17
|
-
step: (msg: any) => void
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/** Get absolute path to the project root */
|
|
21
|
-
getProjectRoot(): string;
|
|
22
|
-
|
|
23
|
-
/** Get absolute path to the dist output directory */
|
|
24
|
-
getDistDir(): string;
|
|
25
|
-
|
|
26
|
-
/** Get absolute path to the public assets directory */
|
|
27
|
-
getPublicDir(): string;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/** Supported plugin hook names */
|
|
31
|
-
export type PluginHookName =
|
|
32
|
-
| "onBuildStart"
|
|
33
|
-
| "onBuildFinish"
|
|
34
|
-
| "onWatchStart"
|
|
35
|
-
| "onWatchStop"
|
|
36
|
-
| "onServeStart"
|
|
37
|
-
| "onServeStop"
|
|
38
|
-
| "onFileChange";
|
|
39
|
-
|
|
40
|
-
/** Interface for a single plugin */
|
|
41
|
-
export interface VaderPlugin {
|
|
42
|
-
name: string;
|
|
43
|
-
description: string;
|
|
44
|
-
version: string;
|
|
45
|
-
/** Called before build starts */
|
|
46
|
-
onBuildStart?(api: VaderAPI): Promise<void> | void;
|
|
47
|
-
|
|
48
|
-
/** Called after build finishes */
|
|
49
|
-
onBuildFinish?(api: VaderAPI): Promise<void> | void;
|
|
50
|
-
|
|
51
|
-
/** Called when watcher starts (dev mode) */
|
|
52
|
-
onWatchStart?(api: VaderAPI): Promise<void> | void;
|
|
53
|
-
|
|
54
|
-
/** Called when watcher stops (dev mode) */
|
|
55
|
-
onWatchStop?(api: VaderAPI): Promise<void> | void;
|
|
56
|
-
|
|
57
|
-
/** Called when dev server starts */
|
|
58
|
-
onServeStart?(api: VaderAPI): Promise<void> | void;
|
|
59
|
-
|
|
60
|
-
/** Called when dev server stops */
|
|
61
|
-
onServeStop?(api: VaderAPI): Promise<void> | void;
|
|
62
|
-
|
|
63
|
-
/** Called on file change during watch, with changed file path */
|
|
64
|
-
onFileChange?(api: VaderAPI, filePath: string): Promise<void> | void;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/** User config type */
|
|
68
|
-
export interface VaderConfig {
|
|
69
|
-
port?: number;
|
|
70
|
-
host_provider?: string;
|
|
71
|
-
plugins?: VaderPlugin[];
|
|
72
|
-
}
|
|
1
|
+
// vaderPlugin.d.ts
|
|
2
|
+
|
|
3
|
+
/** The API object passed to plugin hooks */
|
|
4
|
+
export interface VaderAPI {
|
|
5
|
+
/** Run a shell command (string or string[]) and wait for it to finish */
|
|
6
|
+
runCommand(cmd: string | string[]): Promise<void>;
|
|
7
|
+
|
|
8
|
+
/** Inject arbitrary HTML into the <head> of generated index.html files */
|
|
9
|
+
injectHTML(content: string): void;
|
|
10
|
+
|
|
11
|
+
/** Log a message prefixed with [Vader Plugin] */
|
|
12
|
+
log : {
|
|
13
|
+
warn: (msg: any) => void,
|
|
14
|
+
info: (msg: any) => void,
|
|
15
|
+
error: (msg: any) => void,
|
|
16
|
+
success: (msg: any) => void,
|
|
17
|
+
step: (msg: any) => void
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Get absolute path to the project root */
|
|
21
|
+
getProjectRoot(): string;
|
|
22
|
+
|
|
23
|
+
/** Get absolute path to the dist output directory */
|
|
24
|
+
getDistDir(): string;
|
|
25
|
+
|
|
26
|
+
/** Get absolute path to the public assets directory */
|
|
27
|
+
getPublicDir(): string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Supported plugin hook names */
|
|
31
|
+
export type PluginHookName =
|
|
32
|
+
| "onBuildStart"
|
|
33
|
+
| "onBuildFinish"
|
|
34
|
+
| "onWatchStart"
|
|
35
|
+
| "onWatchStop"
|
|
36
|
+
| "onServeStart"
|
|
37
|
+
| "onServeStop"
|
|
38
|
+
| "onFileChange";
|
|
39
|
+
|
|
40
|
+
/** Interface for a single plugin */
|
|
41
|
+
export interface VaderPlugin {
|
|
42
|
+
name: string;
|
|
43
|
+
description: string;
|
|
44
|
+
version: string;
|
|
45
|
+
/** Called before build starts */
|
|
46
|
+
onBuildStart?(api: VaderAPI): Promise<void> | void;
|
|
47
|
+
|
|
48
|
+
/** Called after build finishes */
|
|
49
|
+
onBuildFinish?(api: VaderAPI): Promise<void> | void;
|
|
50
|
+
|
|
51
|
+
/** Called when watcher starts (dev mode) */
|
|
52
|
+
onWatchStart?(api: VaderAPI): Promise<void> | void;
|
|
53
|
+
|
|
54
|
+
/** Called when watcher stops (dev mode) */
|
|
55
|
+
onWatchStop?(api: VaderAPI): Promise<void> | void;
|
|
56
|
+
|
|
57
|
+
/** Called when dev server starts */
|
|
58
|
+
onServeStart?(api: VaderAPI): Promise<void> | void;
|
|
59
|
+
|
|
60
|
+
/** Called when dev server stops */
|
|
61
|
+
onServeStop?(api: VaderAPI): Promise<void> | void;
|
|
62
|
+
|
|
63
|
+
/** Called on file change during watch, with changed file path */
|
|
64
|
+
onFileChange?(api: VaderAPI, filePath: string): Promise<void> | void;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** User config type */
|
|
68
|
+
export interface VaderConfig {
|
|
69
|
+
port?: number;
|
|
70
|
+
host_provider?: string;
|
|
71
|
+
plugins?: VaderPlugin[];
|
|
72
|
+
}
|
package/README.MD
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<a href="https://vader-js.pages.dev">
|
|
3
|
-
<picture>
|
|
4
|
-
<source media="(prefers-color-scheme: dark)" srcset="/icon.jpeg">
|
|
5
|
-
<img src="https://github.com/Postr-Inc/Vader.js/blob/main/logo.png" height="128">
|
|
6
|
-
</picture>
|
|
7
|
-
<h1 align="center">Vader.js</h1>
|
|
8
|
-
</a>
|
|
9
|
-
</p>
|
|
10
|
-
|
|
11
|
-
# Vader.js
|
|
12
|
-
A modern, reactive framework for building ultra-fast web applications — built on simplicity and speed.
|
|
13
|
-
|
|
14
|
-
[](https://github.com/Postr-Inc/Vader.js/blob/main/LICENSE) [](https://www.npmjs.com/package/vaderjs)
|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
## 🚀 Quick Example
|
|
19
|
-
|
|
20
|
-
```tsx
|
|
21
|
-
import { useState, Switch, Match } from "vaderjs"
|
|
22
|
-
|
|
23
|
-
export default function() {
|
|
24
|
-
const [count, setCount] = useState(0)
|
|
25
|
-
return (
|
|
26
|
-
<div>
|
|
27
|
-
<Switch>
|
|
28
|
-
<Match when={count > 10}>
|
|
29
|
-
<h1>Count is greater than 10</h1>
|
|
30
|
-
</Match>
|
|
31
|
-
<Match when={count <= 10}>
|
|
32
|
-
<h1>Count is less than or equal to 10</h1>
|
|
33
|
-
</Match>
|
|
34
|
-
</Switch>
|
|
35
|
-
</div>
|
|
36
|
-
)
|
|
37
|
-
}
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
## 📦 Installation
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
bun install vaderjs@latest
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## ⚙️ Project Structure
|
|
49
|
-
|
|
50
|
-
Vader.js supports file-based routing out of the box. Just create a `pages` folder like in Next.js:
|
|
51
|
-
|
|
52
|
-
> ⚠️ Note: This routing system is designed for **production servers** only. It will not work with Cloudflare Pages, GitHub Pages, or Vercel.
|
|
53
|
-
|
|
54
|
-
You can nest up to 4 levels deep.
|
|
55
|
-
|
|
56
|
-
```
|
|
57
|
-
/pages/index.jsx -> /
|
|
58
|
-
/pages/home/[page].jsx -> /home/:page
|
|
59
|
-
/pages/path/index.jsx -> /path/
|
|
60
|
-
/pages/test/[[...catchall]]/index.jsx -> /test/*
|
|
61
|
-
/pages/route/[param1]/[param2].jsx -> /route/:param1/:param2
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
---
|
|
65
|
-
|
|
66
|
-
## 🗂 Keyword Folders
|
|
67
|
-
|
|
68
|
-
Certain folders are special and automatically picked up by the bundler:
|
|
69
|
-
|
|
70
|
-
| Folder | Purpose |
|
|
71
|
-
| --------- | ----------------------------------- |
|
|
72
|
-
| `app/` | Contains all route `.jsx` files |
|
|
73
|
-
| `src/` | Your components, utilities, etc. |
|
|
74
|
-
| `public/` | Static files like CSS, JSON, images |
|
|
75
|
-
|
|
76
|
-
---
|
|
77
|
-
|
|
78
|
-
## 🛠 Define Config
|
|
79
|
-
|
|
80
|
-
Create a `config.ts` file at the root of your project:
|
|
81
|
-
|
|
82
|
-
```ts
|
|
83
|
-
import defineConfig from "vaderjs/config";
|
|
84
|
-
|
|
85
|
-
export default defineConfig({
|
|
86
|
-
port: 3000,
|
|
87
|
-
host: "localhost",
|
|
88
|
-
hot_reload: true,
|
|
89
|
-
});
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
## 🤔 Why Vader.js?
|
|
94
|
-
|
|
95
|
-
* Minimal reactivity model with zero VDOM
|
|
96
|
-
* File-based routing system built into Bun
|
|
97
|
-
* Tiny runtime, blazing fast updates
|
|
98
|
-
* Familiar API inspired by React, but simpler
|
|
99
|
-
* Perfect for Bun-first, fullstack apps
|