@frontman-ai/astro 0.1.5 → 0.1.6
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/index.js +22 -14
- package/dist/integration.js +22 -14
- package/index.d.ts +7 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -24,11 +24,6 @@ var require_lib = __commonJS({
|
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
// ../../node_modules/@rescript/runtime/lib/es6/Stdlib_JsError.js
|
|
28
|
-
function throwWithMessage(str) {
|
|
29
|
-
throw new Error(str);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
27
|
// ../../node_modules/@rescript/runtime/lib/es6/Primitive_option.js
|
|
33
28
|
function some(x) {
|
|
34
29
|
if (x === void 0) {
|
|
@@ -95,29 +90,39 @@ function orElse(opt, other) {
|
|
|
95
90
|
}
|
|
96
91
|
}
|
|
97
92
|
|
|
93
|
+
// ../frontman-core/src/FrontmanCore__Hosts.res.mjs
|
|
94
|
+
var apiHost = "api.frontman.sh";
|
|
95
|
+
var clientJs = "https://app.frontman.sh/frontman.es.js";
|
|
96
|
+
var clientCss = "https://app.frontman.sh/frontman.css";
|
|
97
|
+
var devClientJs = "http://localhost:5173/src/Main.res.mjs";
|
|
98
|
+
|
|
98
99
|
// src/FrontmanAstro__Config.res.mjs
|
|
99
100
|
var host = process.env["FRONTMAN_HOST"];
|
|
100
|
-
var defaultHost = host !== void 0 ? host :
|
|
101
|
+
var defaultHost = host !== void 0 ? host : apiHost;
|
|
101
102
|
var ensureConfig = (function(c2) {
|
|
102
103
|
return c2 || {};
|
|
103
104
|
});
|
|
104
105
|
function makeFromObject(rawConfig) {
|
|
105
106
|
let config = ensureConfig(rawConfig);
|
|
107
|
+
let host2 = getOr(config.host, defaultHost);
|
|
108
|
+
let isDev = host2 !== apiHost;
|
|
106
109
|
let projectRoot = getOr(orElse(config.projectRoot, orElse(process.env["PROJECT_ROOT"], process.env["PWD"])), ".");
|
|
107
110
|
let sourceRoot = getOr(config.sourceRoot, projectRoot);
|
|
108
111
|
let basePath = getOr(config.basePath, "frontman");
|
|
109
112
|
let serverName = getOr(config.serverName, "frontman-astro");
|
|
110
113
|
let serverVersion = getOr(config.serverVersion, "1.0.0");
|
|
111
114
|
let isLightTheme = getOr(config.isLightTheme, false);
|
|
112
|
-
let
|
|
113
|
-
let baseUrl = getOr(process.env["FRONTMAN_CLIENT_URL"], "http://localhost:5173/src/Main.res.mjs");
|
|
115
|
+
let baseUrl = getOr(config.clientUrl, getOr(process.env["FRONTMAN_CLIENT_URL"], isDev ? devClientJs : clientJs));
|
|
114
116
|
let url2 = new URL(baseUrl);
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
if (url2.searchParams.has("clientName")) ; else {
|
|
118
|
+
url2.searchParams.set("clientName", "astro");
|
|
119
|
+
}
|
|
120
|
+
if (url2.searchParams.has("host")) ; else {
|
|
121
|
+
url2.searchParams.set("host", host2);
|
|
119
122
|
}
|
|
123
|
+
let clientUrl = url2.href;
|
|
120
124
|
return {
|
|
125
|
+
isDev,
|
|
121
126
|
projectRoot,
|
|
122
127
|
sourceRoot,
|
|
123
128
|
basePath,
|
|
@@ -125,6 +130,7 @@ function makeFromObject(rawConfig) {
|
|
|
125
130
|
serverVersion,
|
|
126
131
|
host: host2,
|
|
127
132
|
clientUrl,
|
|
133
|
+
clientCssUrl: orElse(config.clientCssUrl, isDev ? void 0 : clientCss),
|
|
128
134
|
isLightTheme
|
|
129
135
|
};
|
|
130
136
|
}
|
|
@@ -5581,7 +5587,7 @@ function make2() {
|
|
|
5581
5587
|
}
|
|
5582
5588
|
|
|
5583
5589
|
// src/FrontmanAstro__Middleware.res.mjs
|
|
5584
|
-
function uiHtml(clientUrl, isLightTheme) {
|
|
5590
|
+
function uiHtml(clientUrl, clientCssUrl, isLightTheme) {
|
|
5585
5591
|
let openrouterKey = flatMap(process.env["OPENROUTER_API_KEY"], (key) => {
|
|
5586
5592
|
if (key !== "") {
|
|
5587
5593
|
return key;
|
|
@@ -5596,12 +5602,14 @@ function uiHtml(clientUrl, isLightTheme) {
|
|
|
5596
5602
|
});
|
|
5597
5603
|
let runtimeConfig = JSON.stringify(configObj);
|
|
5598
5604
|
let themeClass = isLightTheme ? "" : "dark";
|
|
5605
|
+
let cssLink = clientCssUrl !== void 0 ? `<link rel="stylesheet" href="` + clientCssUrl + `">` : "";
|
|
5599
5606
|
return `<!DOCTYPE html>
|
|
5600
5607
|
<html lang="en" class="` + themeClass + `">
|
|
5601
5608
|
<head>
|
|
5602
5609
|
<meta charset="UTF-8">
|
|
5603
5610
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
5604
5611
|
<title>Frontman</title>
|
|
5612
|
+
` + cssLink + `
|
|
5605
5613
|
<style>
|
|
5606
5614
|
html, body, #root {
|
|
5607
5615
|
margin: 0;
|
|
@@ -5619,7 +5627,7 @@ function uiHtml(clientUrl, isLightTheme) {
|
|
|
5619
5627
|
</html>`;
|
|
5620
5628
|
}
|
|
5621
5629
|
function serveUI(config) {
|
|
5622
|
-
let html = uiHtml(config.clientUrl, config.isLightTheme);
|
|
5630
|
+
let html = uiHtml(config.clientUrl, config.clientCssUrl, config.isLightTheme);
|
|
5623
5631
|
let headers2 = Object.fromEntries([[
|
|
5624
5632
|
"Content-Type",
|
|
5625
5633
|
"text/html"
|
package/dist/integration.js
CHANGED
|
@@ -24,11 +24,6 @@ var require_lib = __commonJS({
|
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
// ../../node_modules/@rescript/runtime/lib/es6/Stdlib_JsError.js
|
|
28
|
-
function throwWithMessage(str) {
|
|
29
|
-
throw new Error(str);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
27
|
// ../../node_modules/@rescript/runtime/lib/es6/Primitive_option.js
|
|
33
28
|
function some(x) {
|
|
34
29
|
if (x === void 0) {
|
|
@@ -95,29 +90,39 @@ function orElse(opt, other) {
|
|
|
95
90
|
}
|
|
96
91
|
}
|
|
97
92
|
|
|
93
|
+
// ../frontman-core/src/FrontmanCore__Hosts.res.mjs
|
|
94
|
+
var apiHost = "api.frontman.sh";
|
|
95
|
+
var clientJs = "https://app.frontman.sh/frontman.es.js";
|
|
96
|
+
var clientCss = "https://app.frontman.sh/frontman.css";
|
|
97
|
+
var devClientJs = "http://localhost:5173/src/Main.res.mjs";
|
|
98
|
+
|
|
98
99
|
// src/FrontmanAstro__Config.res.mjs
|
|
99
100
|
var host = process.env["FRONTMAN_HOST"];
|
|
100
|
-
var defaultHost = host !== void 0 ? host :
|
|
101
|
+
var defaultHost = host !== void 0 ? host : apiHost;
|
|
101
102
|
var ensureConfig = (function(c2) {
|
|
102
103
|
return c2 || {};
|
|
103
104
|
});
|
|
104
105
|
function makeFromObject(rawConfig) {
|
|
105
106
|
let config = ensureConfig(rawConfig);
|
|
107
|
+
let host2 = getOr(config.host, defaultHost);
|
|
108
|
+
let isDev = host2 !== apiHost;
|
|
106
109
|
let projectRoot = getOr(orElse(config.projectRoot, orElse(process.env["PROJECT_ROOT"], process.env["PWD"])), ".");
|
|
107
110
|
let sourceRoot = getOr(config.sourceRoot, projectRoot);
|
|
108
111
|
let basePath = getOr(config.basePath, "frontman");
|
|
109
112
|
let serverName = getOr(config.serverName, "frontman-astro");
|
|
110
113
|
let serverVersion = getOr(config.serverVersion, "1.0.0");
|
|
111
114
|
let isLightTheme = getOr(config.isLightTheme, false);
|
|
112
|
-
let
|
|
113
|
-
let baseUrl = getOr(process.env["FRONTMAN_CLIENT_URL"], "http://localhost:5173/src/Main.res.mjs");
|
|
115
|
+
let baseUrl = getOr(config.clientUrl, getOr(process.env["FRONTMAN_CLIENT_URL"], isDev ? devClientJs : clientJs));
|
|
114
116
|
let url2 = new URL(baseUrl);
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
if (url2.searchParams.has("clientName")) ; else {
|
|
118
|
+
url2.searchParams.set("clientName", "astro");
|
|
119
|
+
}
|
|
120
|
+
if (url2.searchParams.has("host")) ; else {
|
|
121
|
+
url2.searchParams.set("host", host2);
|
|
119
122
|
}
|
|
123
|
+
let clientUrl = url2.href;
|
|
120
124
|
return {
|
|
125
|
+
isDev,
|
|
121
126
|
projectRoot,
|
|
122
127
|
sourceRoot,
|
|
123
128
|
basePath,
|
|
@@ -125,6 +130,7 @@ function makeFromObject(rawConfig) {
|
|
|
125
130
|
serverVersion,
|
|
126
131
|
host: host2,
|
|
127
132
|
clientUrl,
|
|
133
|
+
clientCssUrl: orElse(config.clientCssUrl, isDev ? void 0 : clientCss),
|
|
128
134
|
isLightTheme
|
|
129
135
|
};
|
|
130
136
|
}
|
|
@@ -5581,7 +5587,7 @@ function make2() {
|
|
|
5581
5587
|
}
|
|
5582
5588
|
|
|
5583
5589
|
// src/FrontmanAstro__Middleware.res.mjs
|
|
5584
|
-
function uiHtml(clientUrl, isLightTheme) {
|
|
5590
|
+
function uiHtml(clientUrl, clientCssUrl, isLightTheme) {
|
|
5585
5591
|
let openrouterKey = flatMap(process.env["OPENROUTER_API_KEY"], (key) => {
|
|
5586
5592
|
if (key !== "") {
|
|
5587
5593
|
return key;
|
|
@@ -5596,12 +5602,14 @@ function uiHtml(clientUrl, isLightTheme) {
|
|
|
5596
5602
|
});
|
|
5597
5603
|
let runtimeConfig = JSON.stringify(configObj);
|
|
5598
5604
|
let themeClass = isLightTheme ? "" : "dark";
|
|
5605
|
+
let cssLink = clientCssUrl !== void 0 ? `<link rel="stylesheet" href="` + clientCssUrl + `">` : "";
|
|
5599
5606
|
return `<!DOCTYPE html>
|
|
5600
5607
|
<html lang="en" class="` + themeClass + `">
|
|
5601
5608
|
<head>
|
|
5602
5609
|
<meta charset="UTF-8">
|
|
5603
5610
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
5604
5611
|
<title>Frontman</title>
|
|
5612
|
+
` + cssLink + `
|
|
5605
5613
|
<style>
|
|
5606
5614
|
html, body, #root {
|
|
5607
5615
|
margin: 0;
|
|
@@ -5619,7 +5627,7 @@ function uiHtml(clientUrl, isLightTheme) {
|
|
|
5619
5627
|
</html>`;
|
|
5620
5628
|
}
|
|
5621
5629
|
function serveUI(config) {
|
|
5622
|
-
let html = uiHtml(config.clientUrl, config.isLightTheme);
|
|
5630
|
+
let html = uiHtml(config.clientUrl, config.clientCssUrl, config.isLightTheme);
|
|
5623
5631
|
let headers2 = Object.fromEntries([[
|
|
5624
5632
|
"Content-Type",
|
|
5625
5633
|
"text/html"
|
package/index.d.ts
CHANGED
|
@@ -42,10 +42,16 @@ export interface FrontmanConfig {
|
|
|
42
42
|
/**
|
|
43
43
|
* URL to the Frontman client bundle. Override for custom client builds.
|
|
44
44
|
* Must include a `host` query parameter.
|
|
45
|
-
* @default
|
|
45
|
+
* @default "https://app.frontman.sh/frontman.es.js" in production, dev server URL in development
|
|
46
46
|
*/
|
|
47
47
|
clientUrl?: string;
|
|
48
48
|
|
|
49
|
+
/**
|
|
50
|
+
* URL to the Frontman client CSS stylesheet.
|
|
51
|
+
* @default "https://app.frontman.sh/frontman.css" in production, omitted in development
|
|
52
|
+
*/
|
|
53
|
+
clientCssUrl?: string;
|
|
54
|
+
|
|
49
55
|
/**
|
|
50
56
|
* Use a light theme for the Frontman UI.
|
|
51
57
|
* @default false
|