@seip/bluebird-js 0.1.6 → 0.1.7
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/.vscode/extensions.json +7 -7
- package/.vscode/settings.json +10 -10
- package/AGENTS.md +620 -576
- package/README.md +607 -602
- package/app/routes/web.js +47 -47
- package/app/views/components/Header.jsx +42 -42
- package/app/views/components/LiveCounter.jsx +22 -21
- package/app/views/layouts/main/view.jsx +201 -201
- package/app/views/{dashboard.jsx → pages/dashboard.jsx} +278 -300
- package/app/views/{index.jsx → pages/index.jsx} +123 -123
- package/app/views/{login.jsx → pages/login.jsx} +141 -141
- package/core/actions.d.ts +1 -1
- package/core/actions.js +355 -329
- package/core/ai.d.ts +151 -151
- package/core/ai.js +1051 -1051
- package/core/app.js +10 -10
- package/core/cli/backup.js +167 -167
- package/core/cli/init.js +10 -10
- package/core/cli/view.js +161 -161
- package/core/database.js +460 -460
- package/core/index.d.ts +1470 -1431
- package/core/jsx.d.ts +38 -38
- package/core/jsx.js +1597 -1432
- package/core/render.js +736 -728
- package/core/view-loader.js +613 -529
- package/package.json +1 -1
- package/public/js/bluebird-client.js +3264 -3160
- /package/app/views/{about.jsx → pages/about.jsx} +0 -0
package/core/cli/view.js
CHANGED
|
@@ -1,161 +1,161 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import fs from "node:fs";
|
|
4
|
-
import path from "node:path";
|
|
5
|
-
import colors from "../util/colors.js";
|
|
6
|
-
|
|
7
|
-
const VIEWS_DIR = path.resolve(process.cwd(), "app/views");
|
|
8
|
-
|
|
9
|
-
const rawArgs = process.argv.slice(2);
|
|
10
|
-
const args = rawArgs.filter(
|
|
11
|
-
(a) => a !== "view" && a !== "make:view" && !a.endsWith("view.js")
|
|
12
|
-
);
|
|
13
|
-
const viewName = args.find((a) => !a.startsWith("-"));
|
|
14
|
-
const isHtml = rawArgs.some((a) => a === "--html");
|
|
15
|
-
const isJs = rawArgs.some((a) => a === "--js");
|
|
16
|
-
const isJsx = !isHtml && !isJs;
|
|
17
|
-
|
|
18
|
-
if (!viewName) {
|
|
19
|
-
console.log(colors.red("[ERROR] Missing view name."));
|
|
20
|
-
console.log("Usage: npx bluebird-js make:view <name> [--jsx | --js | --html]");
|
|
21
|
-
process.exit(1);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const cleanName = viewName.toLowerCase().replace(/[^a-z0-9_-]/g, "_");
|
|
25
|
-
const titleCase = cleanName.charAt(0).toUpperCase() + cleanName.slice(1);
|
|
26
|
-
|
|
27
|
-
if (!fs.existsSync(VIEWS_DIR)) {
|
|
28
|
-
fs.mkdirSync(VIEWS_DIR, { recursive: true });
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (isHtml) {
|
|
32
|
-
const filePath = path.join(VIEWS_DIR, `${cleanName}.html`);
|
|
33
|
-
if (fs.existsSync(filePath)) {
|
|
34
|
-
console.log(colors.yellow(`[WARN] View '${cleanName}.html' already exists at app/views/${cleanName}.html`));
|
|
35
|
-
process.exit(0);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const rawHtml = `<!DOCTYPE html>
|
|
39
|
-
<html lang="en" class="dark" data-theme="dark">
|
|
40
|
-
<head>
|
|
41
|
-
<meta charset="UTF-8" />
|
|
42
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
43
|
-
<title>${titleCase}</title>
|
|
44
|
-
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
45
|
-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
46
|
-
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
|
47
|
-
<script src="/js/tailwind.js"></script>
|
|
48
|
-
<style type="text/tailwindcss">
|
|
49
|
-
@custom-variant dark (&:where(.dark, .dark *, [data-theme="dark"], [data-theme="dark"] *));
|
|
50
|
-
@theme {
|
|
51
|
-
--font-sans: 'Inter', system-ui, -apple-system, sans-serif;
|
|
52
|
-
}
|
|
53
|
-
</style>
|
|
54
|
-
</head>
|
|
55
|
-
<body class="min-h-screen bg-slate-950 text-slate-100 font-sans p-8 max-w-4xl mx-auto">
|
|
56
|
-
<h1 class="text-3xl font-extrabold text-sky-400 mb-4">${titleCase}</h1>
|
|
57
|
-
</body>
|
|
58
|
-
</html>
|
|
59
|
-
`;
|
|
60
|
-
fs.writeFileSync(filePath, rawHtml, "utf-8");
|
|
61
|
-
console.log(colors.green(`[OK] Static HTML view created at app/views/${cleanName}.html`));
|
|
62
|
-
console.log(colors.cyan("To render:"));
|
|
63
|
-
console.log(colors.gray(` routerWeb.get("/${cleanName}", (req, res) => Render.html(res, "${cleanName}.html"));`));
|
|
64
|
-
process.exit(0);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (isJsx) {
|
|
68
|
-
const filePath = path.join(VIEWS_DIR, `${cleanName}.jsx`);
|
|
69
|
-
if (fs.existsSync(filePath)) {
|
|
70
|
-
console.log(colors.yellow(`[WARN] View '${cleanName}.jsx' already exists at app/views/${cleanName}.jsx`));
|
|
71
|
-
process.exit(0);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const jsxTemplate = `import { Client } from "@seip/bluebird-js/core/jsx.js";
|
|
75
|
-
|
|
76
|
-
export const layout = "main";
|
|
77
|
-
|
|
78
|
-
export const head = () => ({
|
|
79
|
-
title: "${titleCase} — Blue Bird",
|
|
80
|
-
description: "${titleCase} view rendered with Bluebird React SSR",
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* ${titleCase} React SSR view module.
|
|
85
|
-
* @param {Object} props
|
|
86
|
-
*/
|
|
87
|
-
export default async function ${titleCase}View(props = {}) {
|
|
88
|
-
return (
|
|
89
|
-
<>
|
|
90
|
-
<section className="py-10 md:py-14 border-b border-slate-800/80">
|
|
91
|
-
<h1 className="text-3xl md:text-5xl font-extrabold tracking-tight bg-gradient-to-r from-sky-400 to-indigo-400 bg-clip-text text-transparent">
|
|
92
|
-
${titleCase}
|
|
93
|
-
</h1>
|
|
94
|
-
<p className="mt-4 text-base md:text-lg text-slate-300">
|
|
95
|
-
Welcome to your new Bluebird React SSR view.
|
|
96
|
-
</p>
|
|
97
|
-
</section>
|
|
98
|
-
|
|
99
|
-
<div className="mt-8">
|
|
100
|
-
<article className="rounded-2xl border border-slate-800 bg-slate-900/60 p-6">
|
|
101
|
-
<p className="text-slate-300">
|
|
102
|
-
Rendered on the server with zero-build JSX and instant partial navigation.
|
|
103
|
-
</p>
|
|
104
|
-
</article>
|
|
105
|
-
</div>
|
|
106
|
-
</>
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
`;
|
|
110
|
-
|
|
111
|
-
fs.writeFileSync(filePath, jsxTemplate, "utf-8");
|
|
112
|
-
console.log(colors.green(`[OK] React JSX view created at app/views/${cleanName}.jsx`));
|
|
113
|
-
console.log("");
|
|
114
|
-
console.log(colors.cyan("To render this view in a route:"));
|
|
115
|
-
console.log(colors.gray(` import Render from "@seip/bluebird-js/core/render.js";`));
|
|
116
|
-
console.log(colors.gray(` routerWeb.get("/${cleanName}", Render.view("${cleanName}"));`));
|
|
117
|
-
process.exit(0);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
const filePath = path.join(VIEWS_DIR, `${cleanName}.js`);
|
|
121
|
-
if (fs.existsSync(filePath)) {
|
|
122
|
-
console.log(colors.yellow(`[WARN] View '${cleanName}.js' already exists at app/views/${cleanName}.js`));
|
|
123
|
-
process.exit(0);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
const serverTemplate = `import { html, script } from "@seip/bluebird-js/core/html.js";
|
|
127
|
-
|
|
128
|
-
export const layout = "main";
|
|
129
|
-
|
|
130
|
-
export const head = () => ({
|
|
131
|
-
title: "${titleCase} — Blue Bird",
|
|
132
|
-
description: "${titleCase} view",
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* ${titleCase} view module.
|
|
137
|
-
* @param {Object} props
|
|
138
|
-
* @returns {import('@seip/bluebird-js/core/html.js').SafeHtml}
|
|
139
|
-
*/
|
|
140
|
-
export default function ${titleCase}View(props = {}) {
|
|
141
|
-
return html\`
|
|
142
|
-
<section class="py-10 md:py-14 border-b border-slate-800/80">
|
|
143
|
-
<h1 class="text-3xl md:text-5xl font-extrabold tracking-tight bg-gradient-to-r from-sky-400 to-indigo-400 bg-clip-text text-transparent">${titleCase}</h1>
|
|
144
|
-
<p class="mt-4 text-base md:text-lg text-slate-300">Welcome to your new Bluebird view.</p>
|
|
145
|
-
</section>
|
|
146
|
-
|
|
147
|
-
<div class="mt-8">
|
|
148
|
-
<article class="rounded-2xl border border-slate-800 bg-slate-900/60 p-6">
|
|
149
|
-
<p class="text-slate-300">Rendered with pure JavaScript ESM and zero build tools.</p>
|
|
150
|
-
</article>
|
|
151
|
-
</div>
|
|
152
|
-
\`;
|
|
153
|
-
}
|
|
154
|
-
`;
|
|
155
|
-
|
|
156
|
-
fs.writeFileSync(filePath, serverTemplate, "utf-8");
|
|
157
|
-
console.log(colors.green(`[OK] View created at app/views/${cleanName}.js`));
|
|
158
|
-
console.log("");
|
|
159
|
-
console.log(colors.cyan("To render this view in a route:"));
|
|
160
|
-
console.log(colors.gray(` import Render from "@seip/bluebird-js/core/render.js";`));
|
|
161
|
-
console.log(colors.gray(` routerWeb.get("/${cleanName}", Render.view("${cleanName}"));`));
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import colors from "../util/colors.js";
|
|
6
|
+
|
|
7
|
+
const VIEWS_DIR = path.resolve(process.cwd(), "app/views");
|
|
8
|
+
|
|
9
|
+
const rawArgs = process.argv.slice(2);
|
|
10
|
+
const args = rawArgs.filter(
|
|
11
|
+
(a) => a !== "view" && a !== "make:view" && !a.endsWith("view.js")
|
|
12
|
+
);
|
|
13
|
+
const viewName = args.find((a) => !a.startsWith("-"));
|
|
14
|
+
const isHtml = rawArgs.some((a) => a === "--html");
|
|
15
|
+
const isJs = rawArgs.some((a) => a === "--js");
|
|
16
|
+
const isJsx = !isHtml && !isJs;
|
|
17
|
+
|
|
18
|
+
if (!viewName) {
|
|
19
|
+
console.log(colors.red("[ERROR] Missing view name."));
|
|
20
|
+
console.log("Usage: npx bluebird-js make:view <name> [--jsx | --js | --html]");
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const cleanName = viewName.toLowerCase().replace(/[^a-z0-9_-]/g, "_");
|
|
25
|
+
const titleCase = cleanName.charAt(0).toUpperCase() + cleanName.slice(1);
|
|
26
|
+
|
|
27
|
+
if (!fs.existsSync(VIEWS_DIR)) {
|
|
28
|
+
fs.mkdirSync(VIEWS_DIR, { recursive: true });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (isHtml) {
|
|
32
|
+
const filePath = path.join(VIEWS_DIR, `${cleanName}.html`);
|
|
33
|
+
if (fs.existsSync(filePath)) {
|
|
34
|
+
console.log(colors.yellow(`[WARN] View '${cleanName}.html' already exists at app/views/${cleanName}.html`));
|
|
35
|
+
process.exit(0);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const rawHtml = `<!DOCTYPE html>
|
|
39
|
+
<html lang="en" class="dark" data-theme="dark">
|
|
40
|
+
<head>
|
|
41
|
+
<meta charset="UTF-8" />
|
|
42
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
43
|
+
<title>${titleCase}</title>
|
|
44
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
45
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
46
|
+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
|
47
|
+
<script src="/js/tailwind.js"></script>
|
|
48
|
+
<style type="text/tailwindcss">
|
|
49
|
+
@custom-variant dark (&:where(.dark, .dark *, [data-theme="dark"], [data-theme="dark"] *));
|
|
50
|
+
@theme {
|
|
51
|
+
--font-sans: 'Inter', system-ui, -apple-system, sans-serif;
|
|
52
|
+
}
|
|
53
|
+
</style>
|
|
54
|
+
</head>
|
|
55
|
+
<body class="min-h-screen bg-slate-950 text-slate-100 font-sans p-8 max-w-4xl mx-auto">
|
|
56
|
+
<h1 class="text-3xl font-extrabold text-sky-400 mb-4">${titleCase}</h1>
|
|
57
|
+
</body>
|
|
58
|
+
</html>
|
|
59
|
+
`;
|
|
60
|
+
fs.writeFileSync(filePath, rawHtml, "utf-8");
|
|
61
|
+
console.log(colors.green(`[OK] Static HTML view created at app/views/${cleanName}.html`));
|
|
62
|
+
console.log(colors.cyan("To render:"));
|
|
63
|
+
console.log(colors.gray(` routerWeb.get("/${cleanName}", (req, res) => Render.html(res, "${cleanName}.html"));`));
|
|
64
|
+
process.exit(0);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (isJsx) {
|
|
68
|
+
const filePath = path.join(VIEWS_DIR, `${cleanName}.jsx`);
|
|
69
|
+
if (fs.existsSync(filePath)) {
|
|
70
|
+
console.log(colors.yellow(`[WARN] View '${cleanName}.jsx' already exists at app/views/${cleanName}.jsx`));
|
|
71
|
+
process.exit(0);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const jsxTemplate = `import { Client } from "@seip/bluebird-js/core/jsx.js";
|
|
75
|
+
|
|
76
|
+
export const layout = "main";
|
|
77
|
+
|
|
78
|
+
export const head = () => ({
|
|
79
|
+
title: "${titleCase} — Blue Bird",
|
|
80
|
+
description: "${titleCase} view rendered with Bluebird React SSR",
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* ${titleCase} React SSR view module.
|
|
85
|
+
* @param {Object} props
|
|
86
|
+
*/
|
|
87
|
+
export default async function ${titleCase}View(props = {}) {
|
|
88
|
+
return (
|
|
89
|
+
<>
|
|
90
|
+
<section className="py-10 md:py-14 border-b border-slate-800/80">
|
|
91
|
+
<h1 className="text-3xl md:text-5xl font-extrabold tracking-tight bg-gradient-to-r from-sky-400 to-indigo-400 bg-clip-text text-transparent">
|
|
92
|
+
${titleCase}
|
|
93
|
+
</h1>
|
|
94
|
+
<p className="mt-4 text-base md:text-lg text-slate-300">
|
|
95
|
+
Welcome to your new Bluebird React SSR view.
|
|
96
|
+
</p>
|
|
97
|
+
</section>
|
|
98
|
+
|
|
99
|
+
<div className="mt-8">
|
|
100
|
+
<article className="rounded-2xl border border-slate-800 bg-slate-900/60 p-6">
|
|
101
|
+
<p className="text-slate-300">
|
|
102
|
+
Rendered on the server with zero-build JSX and instant partial navigation.
|
|
103
|
+
</p>
|
|
104
|
+
</article>
|
|
105
|
+
</div>
|
|
106
|
+
</>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
`;
|
|
110
|
+
|
|
111
|
+
fs.writeFileSync(filePath, jsxTemplate, "utf-8");
|
|
112
|
+
console.log(colors.green(`[OK] React JSX view created at app/views/${cleanName}.jsx`));
|
|
113
|
+
console.log("");
|
|
114
|
+
console.log(colors.cyan("To render this view in a route:"));
|
|
115
|
+
console.log(colors.gray(` import Render from "@seip/bluebird-js/core/render.js";`));
|
|
116
|
+
console.log(colors.gray(` routerWeb.get("/${cleanName}", Render.view("${cleanName}"));`));
|
|
117
|
+
process.exit(0);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const filePath = path.join(VIEWS_DIR, `${cleanName}.js`);
|
|
121
|
+
if (fs.existsSync(filePath)) {
|
|
122
|
+
console.log(colors.yellow(`[WARN] View '${cleanName}.js' already exists at app/views/${cleanName}.js`));
|
|
123
|
+
process.exit(0);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const serverTemplate = `import { html, script } from "@seip/bluebird-js/core/html.js";
|
|
127
|
+
|
|
128
|
+
export const layout = "main";
|
|
129
|
+
|
|
130
|
+
export const head = () => ({
|
|
131
|
+
title: "${titleCase} — Blue Bird",
|
|
132
|
+
description: "${titleCase} view",
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* ${titleCase} view module.
|
|
137
|
+
* @param {Object} props
|
|
138
|
+
* @returns {import('@seip/bluebird-js/core/html.js').SafeHtml}
|
|
139
|
+
*/
|
|
140
|
+
export default function ${titleCase}View(props = {}) {
|
|
141
|
+
return html\`
|
|
142
|
+
<section class="py-10 md:py-14 border-b border-slate-800/80">
|
|
143
|
+
<h1 class="text-3xl md:text-5xl font-extrabold tracking-tight bg-gradient-to-r from-sky-400 to-indigo-400 bg-clip-text text-transparent">${titleCase}</h1>
|
|
144
|
+
<p class="mt-4 text-base md:text-lg text-slate-300">Welcome to your new Bluebird view.</p>
|
|
145
|
+
</section>
|
|
146
|
+
|
|
147
|
+
<div class="mt-8">
|
|
148
|
+
<article class="rounded-2xl border border-slate-800 bg-slate-900/60 p-6">
|
|
149
|
+
<p class="text-slate-300">Rendered with pure JavaScript ESM and zero build tools.</p>
|
|
150
|
+
</article>
|
|
151
|
+
</div>
|
|
152
|
+
\`;
|
|
153
|
+
}
|
|
154
|
+
`;
|
|
155
|
+
|
|
156
|
+
fs.writeFileSync(filePath, serverTemplate, "utf-8");
|
|
157
|
+
console.log(colors.green(`[OK] View created at app/views/${cleanName}.js`));
|
|
158
|
+
console.log("");
|
|
159
|
+
console.log(colors.cyan("To render this view in a route:"));
|
|
160
|
+
console.log(colors.gray(` import Render from "@seip/bluebird-js/core/render.js";`));
|
|
161
|
+
console.log(colors.gray(` routerWeb.get("/${cleanName}", Render.view("${cleanName}"));`));
|