@spirobel/mininext 0.5.1 → 0.6.0
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/dist/mininext.d.ts +2 -2
- package/dist/mininext.js +14 -3
- package/package.json +1 -1
package/dist/mininext.d.ts
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
/// <reference types="bun-types" />
|
|
3
3
|
import { url, Mini, has, type HtmlHandler } from "./url";
|
|
4
4
|
import { isError, HtmlString, BasedHtml, head, commonHead, cssReset, basedHtml as html } from "./html";
|
|
5
|
-
import type
|
|
5
|
+
import { type Server, type WebSocketHandler } from "bun";
|
|
6
6
|
declare global {
|
|
7
7
|
var PROJECT_ROOT: string | undefined;
|
|
8
8
|
}
|
|
9
|
-
declare function build(backendPath?: string): Promise<
|
|
9
|
+
declare function build(backendPath?: string): Promise<0 | undefined>;
|
|
10
10
|
declare const standardDevReloader: BasedHtml;
|
|
11
11
|
declare function makeEntrypoint(): Promise<{
|
|
12
12
|
fetch: (req: Request, server: Server) => Promise<Response>;
|
package/dist/mininext.js
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { url, Mini, has } from "./url";
|
|
2
2
|
import { isError, HtmlString, BasedHtml, head, commonHead, cssReset, basedHtml as html, } from "./html";
|
|
3
|
+
import { $ } from "bun";
|
|
3
4
|
import { watch } from "fs/promises";
|
|
4
5
|
import * as path from "path";
|
|
5
6
|
function projectRoot() {
|
|
6
7
|
return global.PROJECT_ROOT || import.meta.dir + "/../../../../";
|
|
7
8
|
}
|
|
8
9
|
async function build(backendPath = "backend/backend.ts") {
|
|
10
|
+
if (Bun.argv[2] === "frontend") {
|
|
11
|
+
const newFrontend = await buildFrontend(Bun.argv[3]);
|
|
12
|
+
process.stdout.write(JSON.stringify(newFrontend));
|
|
13
|
+
return 0;
|
|
14
|
+
}
|
|
9
15
|
await buildBackend(backendPath);
|
|
10
16
|
if (Bun.argv[2] === "dev") {
|
|
11
17
|
await devServer();
|
|
@@ -70,9 +76,14 @@ async function buildBackend(backendPath = "backend/backend.ts") {
|
|
|
70
76
|
const frontEndPath = (await Bun.file(firstPlaceToLook).exists())
|
|
71
77
|
? firstPlaceToLook
|
|
72
78
|
: secondPlaceToLook;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
79
|
+
try {
|
|
80
|
+
const f = await $ `bun run build.ts frontend ${frontEndPath}`.json();
|
|
81
|
+
FrontendScriptUrls.push("/" + f.url);
|
|
82
|
+
FrontendScripts.push(f.script);
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
console.log(await $ `bun run build.ts frontend ${frontEndPath}`.text());
|
|
86
|
+
}
|
|
76
87
|
}
|
|
77
88
|
for (const svgPath of url.getSvgPaths()) {
|
|
78
89
|
const parsedSvgPath = path.parse(svgPath);
|