vaderjs 1.4.1-lv56aadeg5 → 1.4.2-bml56
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/.editorconfig +11 -0
- package/.vscode/c_cpp_properties.json +21 -0
- package/.vscode/settings.json +12 -0
- package/README.md +35 -198
- package/binaries/Kalix/index.js +668 -0
- package/binaries/compiler/main.js +461 -0
- package/binaries/vader.js +74 -0
- package/binaries/watcher/hmr.js +40 -0
- package/client/index.d.ts +226 -0
- package/client/runtime/index.js +417 -0
- package/client/runtime/router.js +235 -0
- package/config/index.ts +68 -0
- package/index.ts +344 -0
- package/package.json +14 -25
- package/plugins/cloudflare/functions/index.js +98 -0
- package/plugins/cloudflare/toCopy/@server/Kalix/index.js +625 -0
- package/plugins/cloudflare/toCopy/@server/cloudflare_ssr/index.js +85 -0
- package/plugins/cloudflare/toCopy/node_modules/vaderjs/server/index.js +99 -0
- package/plugins/cloudflare/toCopy/src/client.js +432 -0
- package/plugins/cloudflare/toCopy/src/router.js +235 -0
- package/plugins/ssg/index.js +127 -0
- package/plugins/vercel/functions/index.ts +8 -0
- package/router/index.ts +181 -0
- package/server/index.js +129 -0
- package/vader_dev.js +177 -0
- package/@integrations/ssg.js +0 -163
- package/LICENSE +0 -21
- package/binaries/IPC/index.js +0 -277
- package/binaries/main.js +0 -1328
- package/binaries/readme.md +0 -4
- package/binaries/watcher.js +0 -74
- package/binaries/win32/check.ps1 +0 -7
- package/client/index.js +0 -441
- package/config/index.js +0 -36
- package/logo.png +0 -0
- package/runtime/router.js +0 -1
- package/runtime/vader.js +0 -1
- package/vader.js +0 -230
package/vader.js
DELETED
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { exec } from "child_process";
|
|
3
|
-
import fs from "fs";
|
|
4
|
-
globalThis.currentCommand = null;
|
|
5
|
-
globalThis.isRunning = false;
|
|
6
|
-
let vaderisInstalled = process.cwd() + "/node_modules/vaderjs/binaries/main.js";
|
|
7
|
-
if (!fs.existsSync(process.cwd() + "/_dev")) {
|
|
8
|
-
fs.mkdirSync(process.cwd() + "/_dev");
|
|
9
|
-
!fs.existsSync(process.cwd() + "/_dev/readme.md") && fs.writeFileSync(process.cwd() + "/_dev/readme.md", `This folder is used by vader.js to store important files, deletables include: Bun, Chrome - These should only be uninstalled if you need to reinstall them.`);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
if (!fs.existsSync(process.cwd() + "/_dev/vader.js")) {
|
|
13
|
-
console.log("Copying vader to dev folder....");
|
|
14
|
-
fs.copyFileSync(vaderisInstalled, process.cwd() + "/_dev/vader.js");
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function checkIFBundleIsInstalled() {
|
|
18
|
-
if (fs.existsSync(process.cwd() + "/_dev/bun")) {
|
|
19
|
-
return new Promise((resolve, reject) => {
|
|
20
|
-
resolve(true);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
return new Promise((resolve, reject) => {
|
|
24
|
-
exec("bun -v", (err, stdout, stderr) => {
|
|
25
|
-
if (err) {
|
|
26
|
-
reject(err);
|
|
27
|
-
}
|
|
28
|
-
if (stdout) {
|
|
29
|
-
resolve(`Bun.js is installed: ${stdout}`);
|
|
30
|
-
}
|
|
31
|
-
if (stderr) {
|
|
32
|
-
reject(`Bun.js is not installed: ${stderr}`);
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function run() {
|
|
39
|
-
if (!fs.existsSync(process.cwd() + "/package.json")) {
|
|
40
|
-
fs.writeFileSync(process.cwd() + "/package.json", JSON.stringify({ name: "my_app", version: "1.0.0" }, null, 2));
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
let packageJson = JSON.parse(fs.readFileSync(process.cwd() + "/package.json").toString());
|
|
44
|
-
if (!packageJson.scripts) {
|
|
45
|
-
packageJson.scripts = {};
|
|
46
|
-
}
|
|
47
|
-
packageJson.scripts["dev"] = "bun run ./_dev/vader.js dev";
|
|
48
|
-
packageJson.scripts["build"] = "bun run ./_dev/vader.js build";
|
|
49
|
-
packageJson.scripts["start"] = "bun run ./_dev/vader.js start";
|
|
50
|
-
if (!packageJson.dependencies) {
|
|
51
|
-
packageJson.dependencies = {};
|
|
52
|
-
}
|
|
53
|
-
fs.writeFileSync(process.cwd() + "/package.json", JSON.stringify(packageJson, null, 2));
|
|
54
|
-
|
|
55
|
-
if (currentCommand) {
|
|
56
|
-
let child = exec(currentCommand);
|
|
57
|
-
child.stdout.pipe(process.stdout);
|
|
58
|
-
child.stderr.pipe(process.stderr);
|
|
59
|
-
child.on("exit", (code) => {
|
|
60
|
-
process.exit(code);
|
|
61
|
-
});
|
|
62
|
-
child.on("message", (message) => {
|
|
63
|
-
console.log(message.toString());
|
|
64
|
-
});
|
|
65
|
-
child.on("error", (err) => {
|
|
66
|
-
console.error(err);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
console.log(`
|
|
73
|
-
Vader.js is a reactive framework for building interactive applications for the web built ontop of bun.js!
|
|
74
|
-
|
|
75
|
-
Usage: npx vaderjs <command>
|
|
76
|
-
|
|
77
|
-
Commands:
|
|
78
|
-
|
|
79
|
-
vaderjs run dev -p <number> Start the development server
|
|
80
|
-
|
|
81
|
-
vaderjs run build Build the project to ./dist
|
|
82
|
-
|
|
83
|
-
vaderjs run start -p <number> Production Mode (default 3000 or process.env.PORT)
|
|
84
|
-
|
|
85
|
-
Learn more about vader: https://vader-js.pages.dev/
|
|
86
|
-
|
|
87
|
-
`);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function checkIFChromeIumIsInstalled() {
|
|
91
|
-
let platform = process.platform;
|
|
92
|
-
let findChrome = {
|
|
93
|
-
windows: `powershell -c "${process.cwd() + "\\node_modules\\vaderjs\\binaries\\win32\\check.ps1"}"`,
|
|
94
|
-
others: "/usr/bin/chromium-browser --version",
|
|
95
|
-
};
|
|
96
|
-
let installCommands = {
|
|
97
|
-
windows: `winget install Google.Chrome`,
|
|
98
|
-
others: "sudo apt-get install chromium-browser -y",
|
|
99
|
-
};
|
|
100
|
-
findChrome.windows = findChrome.windows.replace(/\n/g, " ");
|
|
101
|
-
let commandToRun = platform === "win32" ? findChrome.windows : findChrome.others;
|
|
102
|
-
|
|
103
|
-
return new Promise((resolve, reject) => {
|
|
104
|
-
if (fs.existsSync(process.cwd() + "/_dev/chrome")) {
|
|
105
|
-
resolve(true);
|
|
106
|
-
} else {
|
|
107
|
-
exec(commandToRun, (err, stdout, stderr) => {
|
|
108
|
-
let hasError = false;
|
|
109
|
-
if (err) {
|
|
110
|
-
console.log(err);
|
|
111
|
-
hasError = true;
|
|
112
|
-
console.log(`Attempting to install DEPENDENCY: ${platform === "win32" ? "Google Chrome" : "Chromium"}`);
|
|
113
|
-
}
|
|
114
|
-
if (stdout && !hasError) {
|
|
115
|
-
resolve(`${platform === "win32" ? "Google Chrome" : "Chromium"} is installed: ${stdout}`);
|
|
116
|
-
fs.writeFileSync(process.cwd() + "/_dev/chrome", `Installed: ${stdout}`);
|
|
117
|
-
}
|
|
118
|
-
if (stderr) {
|
|
119
|
-
console.log(stderr);
|
|
120
|
-
console.log(`Installing DEPENDENCY: ${platform === "win32" ? "Google Chrome" : "Chromium"}`);
|
|
121
|
-
let installCommand = platform === "win32" ? installCommands.windows : installCommands.others;
|
|
122
|
-
return new Promise((resolve, reject) => {
|
|
123
|
-
exec(installCommand, (err, stdout, stderr) => {
|
|
124
|
-
if (err) {
|
|
125
|
-
reject(err);
|
|
126
|
-
}
|
|
127
|
-
if (stdout) {
|
|
128
|
-
resolve(`${platform === "win32" ? "Google Chrome" : "Chromium"} installed successfully: ${stdout}`);
|
|
129
|
-
fs.writeFileSync(process.cwd() + "/_dev/chrome", `Installed: ${stdout}`);
|
|
130
|
-
run();
|
|
131
|
-
}
|
|
132
|
-
if (stderr) {
|
|
133
|
-
reject(`${platform === "win32" ? "Google Chrome" : "Chromium"} failed to install: ${stderr}`);
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
let Commands = {
|
|
143
|
-
dev: `bun run dev`,
|
|
144
|
-
build: `bun run build`,
|
|
145
|
-
start: `bun run start`,
|
|
146
|
-
};
|
|
147
|
-
let port = process.argv.includes("-p") || process.argv.includes("--port") ? process.argv[process.argv.indexOf("-p") + 1] || process.argv[process.argv.indexOf("--port") + 1] || process.env.PORT || 3000 : process.env.PORT || 3000;
|
|
148
|
-
switch (true) {
|
|
149
|
-
case process.argv.includes("dev") && !process.argv.includes("build") && !process.argv.includes("start"):
|
|
150
|
-
currentCommand = Commands.dev + (port ? ` -p ${port}` : "");
|
|
151
|
-
break;
|
|
152
|
-
case process.argv.includes("build") && !process.argv.includes("dev") && !process.argv.includes("start"):
|
|
153
|
-
currentCommand = Commands.build + (port ? ` -p ${port}` : "");
|
|
154
|
-
break;
|
|
155
|
-
case process.argv.includes("start") && !process.argv.includes("dev") && !process.argv.includes("build"):
|
|
156
|
-
currentCommand = Commands.start + (port ? ` -p ${port}` : "");
|
|
157
|
-
break;
|
|
158
|
-
default:
|
|
159
|
-
currentCommand = null;
|
|
160
|
-
break;
|
|
161
|
-
}
|
|
162
|
-
checkIFChromeIumIsInstalled()
|
|
163
|
-
.then((stdout) => {
|
|
164
|
-
if (stdout) {
|
|
165
|
-
checkIFBundleIsInstalled()
|
|
166
|
-
.then((stdout) => {
|
|
167
|
-
if (stdout && !isRunning) {
|
|
168
|
-
if (!fs.existsSync(process.cwd() + "/_dev/bun")) {
|
|
169
|
-
fs.writeFileSync(process.cwd() + "/_dev/bun", `Installed: ${stdout}`);
|
|
170
|
-
}
|
|
171
|
-
run();
|
|
172
|
-
globalThis.isRunning = true;
|
|
173
|
-
}
|
|
174
|
-
})
|
|
175
|
-
.catch(async (err) => {
|
|
176
|
-
console.log("Bun.js is not installed. Installing....");
|
|
177
|
-
let installScipt = {
|
|
178
|
-
windows: 'powershell -c "irm bun.sh/install.ps1|iex',
|
|
179
|
-
others: "curl -fsSL https://bun.sh/install.sh | bash",
|
|
180
|
-
};
|
|
181
|
-
let scriptotRun = process.platform === "win32" ? installScipt.windows : installScipt.others;
|
|
182
|
-
exec(scriptotRun, async (err, stdout, stderr) => {
|
|
183
|
-
if (err) {
|
|
184
|
-
console.log("Error installing bun.js");
|
|
185
|
-
process.exit(1);
|
|
186
|
-
}
|
|
187
|
-
if (stdout) {
|
|
188
|
-
if (!process.platform === "win32") {
|
|
189
|
-
await new Promise((resolve, reject) => {
|
|
190
|
-
console.log(`Adding bun.js to path...`);
|
|
191
|
-
let shell = null;
|
|
192
|
-
exec("source ~/.bashrc", (err, stdout, stderr) => {
|
|
193
|
-
if (err) {
|
|
194
|
-
console.log("Error installing bun.js");
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
if (stdout) {
|
|
198
|
-
run();
|
|
199
|
-
}
|
|
200
|
-
if (stderr) {
|
|
201
|
-
console.log("Error installing bun.js");
|
|
202
|
-
process.exit(1);
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
});
|
|
206
|
-
exec("chmod +x bun.sh/install.sh", (err, stdout, stderr) => {
|
|
207
|
-
if (err) {
|
|
208
|
-
console.log("Error installing bun.js");
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
if (stdout) {
|
|
212
|
-
console.log("Bun.js installed successfully");
|
|
213
|
-
run();
|
|
214
|
-
}
|
|
215
|
-
if (stderr) {
|
|
216
|
-
console.log("Error installing bun.js");
|
|
217
|
-
process.exit(1);
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
run();
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
})
|
|
227
|
-
.catch(async (err) => {
|
|
228
|
-
console.error(err);
|
|
229
|
-
process.exit(1);
|
|
230
|
-
});
|