vaderjs 1.4.2-yml56 → 1.4.3
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 → README.MD} +9 -19
- package/config/index.ts +12 -66
- package/document/index.ts +49 -0
- package/index.ts +283 -322
- package/main.js +314 -0
- package/package.json +8 -23
- package/.editorconfig +0 -11
- package/.vscode/c_cpp_properties.json +0 -21
- package/.vscode/settings.json +0 -12
- package/binaries/Kalix/index.js +0 -668
- package/binaries/compiler/main.js +0 -461
- package/binaries/vader.js +0 -74
- package/binaries/watcher/hmr.js +0 -40
- package/client/index.d.ts +0 -226
- package/client/runtime/index.js +0 -417
- package/client/runtime/router.js +0 -235
- package/plugins/cloudflare/functions/index.js +0 -98
- package/plugins/cloudflare/toCopy/@server/Kalix/index.js +0 -625
- package/plugins/cloudflare/toCopy/@server/cloudflare_ssr/index.js +0 -85
- package/plugins/cloudflare/toCopy/node_modules/vaderjs/server/index.js +0 -99
- package/plugins/cloudflare/toCopy/src/client.js +0 -432
- package/plugins/cloudflare/toCopy/src/router.js +0 -235
- package/plugins/ssg/index.js +0 -152
- package/plugins/vercel/functions/index.ts +0 -8
- package/router/index.ts +0 -181
- package/server/index.js +0 -129
- package/vader_dev.js +0 -177
package/vader_dev.js
DELETED
|
@@ -1,177 +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/vader.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() + "/pages")) {
|
|
40
|
-
fs.mkdirSync(process.cwd() + "/pages");
|
|
41
|
-
}
|
|
42
|
-
if(!fs.existsSync(process.cwd() + "/public")) {
|
|
43
|
-
fs.mkdirSync(process.cwd() + "/public");
|
|
44
|
-
}
|
|
45
|
-
if(!fs.existsSync(process.cwd() + "/src")) {
|
|
46
|
-
fs.mkdirSync(process.cwd() + "/src");
|
|
47
|
-
}
|
|
48
|
-
if (!fs.existsSync(process.cwd() + "/package.json")) {
|
|
49
|
-
fs.writeFileSync(process.cwd() + "/package.json", JSON.stringify({ name: "my_app", version: "1.0.0" }, null, 2));
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
let packageJson = JSON.parse(fs.readFileSync(process.cwd() + "/package.json").toString());
|
|
53
|
-
if (!packageJson.scripts) {
|
|
54
|
-
packageJson.scripts = {};
|
|
55
|
-
}
|
|
56
|
-
packageJson.scripts["dev"] = "bun run ./_dev/vader.js dev";
|
|
57
|
-
packageJson.scripts["build"] = "bun run ./_dev/vader.js build";
|
|
58
|
-
packageJson.scripts["start"] = "bun run ./_dev/vader.js start";
|
|
59
|
-
if (!packageJson.dependencies) {
|
|
60
|
-
packageJson.dependencies = {};
|
|
61
|
-
}
|
|
62
|
-
fs.writeFileSync(process.cwd() + "/package.json", JSON.stringify(packageJson, null, 2));
|
|
63
|
-
|
|
64
|
-
if (currentCommand) {
|
|
65
|
-
let child = exec(currentCommand);
|
|
66
|
-
child.stdout.pipe(process.stdout);
|
|
67
|
-
child.stderr.pipe(process.stderr);
|
|
68
|
-
child.on("exit", (code) => {
|
|
69
|
-
process.exit(code);
|
|
70
|
-
});
|
|
71
|
-
child.on("message", (message) => {
|
|
72
|
-
console.log(message.toString());
|
|
73
|
-
});
|
|
74
|
-
child.on("error", (err) => {
|
|
75
|
-
console.error(err);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
console.log(`
|
|
82
|
-
Vader.js is a reactive framework for building interactive applications for the web built ontop of bun.js!
|
|
83
|
-
|
|
84
|
-
Usage: npx vaderjs <command>
|
|
85
|
-
|
|
86
|
-
Commands:
|
|
87
|
-
|
|
88
|
-
vaderjs run dev -p <number> Start the development server
|
|
89
|
-
|
|
90
|
-
vaderjs run build Build the project to ./dist
|
|
91
|
-
|
|
92
|
-
vaderjs run start -p <number> Production Mode (default 3000 or process.env.PORT)
|
|
93
|
-
|
|
94
|
-
Learn more about vader: https://vader-js.pages.dev/
|
|
95
|
-
|
|
96
|
-
`);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
let Commands = {
|
|
100
|
-
dev: `bun run dev`,
|
|
101
|
-
build: `bun run build`,
|
|
102
|
-
start: `bun run start`,
|
|
103
|
-
};
|
|
104
|
-
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;
|
|
105
|
-
switch (true) {
|
|
106
|
-
case process.argv.includes("dev") && !process.argv.includes("build") && !process.argv.includes("start"):
|
|
107
|
-
currentCommand = Commands.dev + (port ? ` -p ${port}` : "");
|
|
108
|
-
break;
|
|
109
|
-
case process.argv.includes("build") && !process.argv.includes("dev") && !process.argv.includes("start"):
|
|
110
|
-
currentCommand = Commands.build + (port ? ` -p ${port}` : "");
|
|
111
|
-
break;
|
|
112
|
-
case process.argv.includes("start") && !process.argv.includes("dev") && !process.argv.includes("build"):
|
|
113
|
-
currentCommand = Commands.start + (port ? ` -p ${port}` : "");
|
|
114
|
-
break;
|
|
115
|
-
default:
|
|
116
|
-
currentCommand = null;
|
|
117
|
-
break;
|
|
118
|
-
}
|
|
119
|
-
checkIFBundleIsInstalled()
|
|
120
|
-
.then((stdout) => {
|
|
121
|
-
if (stdout && !isRunning) {
|
|
122
|
-
if (!fs.existsSync(process.cwd() + "/_dev/bun")) {
|
|
123
|
-
fs.writeFileSync(process.cwd() + "/_dev/bun", `Installed: ${stdout}`);
|
|
124
|
-
}
|
|
125
|
-
run();
|
|
126
|
-
globalThis.isRunning = true;
|
|
127
|
-
}
|
|
128
|
-
})
|
|
129
|
-
.catch(async (err) => {
|
|
130
|
-
console.log("Bun.js is not installed. Installing....");
|
|
131
|
-
let installScipt = {
|
|
132
|
-
windows: 'powershell -c "irm bun.sh/install.ps1|iex',
|
|
133
|
-
others: "curl -fsSL https://bun.sh/install.sh | bash",
|
|
134
|
-
};
|
|
135
|
-
let scriptotRun = process.platform === "win32" ? installScipt.windows : installScipt.others;
|
|
136
|
-
exec(scriptotRun, async (err, stdout, stderr) => {
|
|
137
|
-
if (err) {
|
|
138
|
-
console.log("Error installing bun.js, may want to install manually");
|
|
139
|
-
process.exit(1);
|
|
140
|
-
}
|
|
141
|
-
if (stdout) {
|
|
142
|
-
if (!process.platform === "win32") {
|
|
143
|
-
await new Promise((resolve, reject) => {
|
|
144
|
-
console.log(`Adding bun.js to path...`);
|
|
145
|
-
exec("source ~/.bashrc", (err, stdout, stderr) => {
|
|
146
|
-
if (err) {
|
|
147
|
-
console.log("Error installing bun.js");
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
if (stdout) {
|
|
151
|
-
run();
|
|
152
|
-
}
|
|
153
|
-
if (stderr) {
|
|
154
|
-
console.log("Error installing bun.js");
|
|
155
|
-
process.exit(1);
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
exec("chmod +x bun.sh/install.sh", (err, stdout, stderr) => {
|
|
160
|
-
if (err) {
|
|
161
|
-
console.log("Error installing bun.js");
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
if (stdout) {
|
|
165
|
-
console.log("Bun.js installed successfully");
|
|
166
|
-
run();
|
|
167
|
-
}
|
|
168
|
-
if (stderr) {
|
|
169
|
-
console.log("Error installing bun.js");
|
|
170
|
-
process.exit(1);
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
run();
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
});
|