@olwiba/dx 0.0.21 → 0.0.23
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 +30 -0
- package/dist/cli.js +84 -17
- package/dist/generate-assets.d.ts +6 -0
- package/dist/generate-assets.js +79 -13
- package/dist/generate-assets.js.map +1 -1
- package/dist/index.d.ts +11 -9
- package/dist/index.js +13 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -81,6 +81,36 @@ bunx @olwiba/dx ascii-gif \
|
|
|
81
81
|
--out ./public/olwibaDX.gif
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
+
### Asset Generator
|
|
85
|
+
|
|
86
|
+
Generate favicons, app icons, manifest files, robots.txt, and an `og-image.png` from a Lucide icon or SVG mark.
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
bunx @olwiba/dx generate-assets \
|
|
90
|
+
--name "myApp" \
|
|
91
|
+
--icon ./public/logo.svg \
|
|
92
|
+
--color "#0d9488" \
|
|
93
|
+
--og-component ./public/search-bar.svg \
|
|
94
|
+
--out ./public
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
`--og-component` is optional and only affects the social image: it renders the given SVG/PNG/JPG/WebP
|
|
98
|
+
component bottom-middle on a solid `--color` background, with a small `--icon` + `--name` wordmark
|
|
99
|
+
grouped above it. Without it, `og-image.png` uses the default large-logo layout. Favicons and app
|
|
100
|
+
icons always use `--icon`.
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
import { generateAssets } from "@olwiba/dx/generate-assets";
|
|
104
|
+
|
|
105
|
+
await generateAssets({
|
|
106
|
+
name: "myApp",
|
|
107
|
+
icon: "./public/logo.svg",
|
|
108
|
+
color: "#0d9488",
|
|
109
|
+
outputDir: "./public",
|
|
110
|
+
ogComponent: "./public/search-bar.svg",
|
|
111
|
+
});
|
|
112
|
+
```
|
|
113
|
+
|
|
84
114
|
### Preview Generator
|
|
85
115
|
|
|
86
116
|
Puppeteer-based screenshot tool used to pre-render the isometric preview tiles on docs sites.
|
package/dist/cli.js
CHANGED
|
@@ -1740,6 +1740,14 @@ function getSvgInner(svgPath) {
|
|
|
1740
1740
|
const inner = svg.replace(/<svg[^>]*>/, "").replace(/<\/svg>/, "").trim();
|
|
1741
1741
|
return { inner, viewBox };
|
|
1742
1742
|
}
|
|
1743
|
+
function resolveIcon(icon) {
|
|
1744
|
+
const mode = detectIconMode(icon);
|
|
1745
|
+
if (mode === "svg") {
|
|
1746
|
+
const { inner, viewBox } = getSvgInner(icon);
|
|
1747
|
+
return { mode, inner, viewBox };
|
|
1748
|
+
}
|
|
1749
|
+
return { mode, inner: getLucideInner(icon), viewBox: 24 };
|
|
1750
|
+
}
|
|
1743
1751
|
function buildIconSvgLucide(inner, color, size) {
|
|
1744
1752
|
const pad = Math.round(size * 0.18);
|
|
1745
1753
|
const area = size - pad * 2;
|
|
@@ -1798,8 +1806,44 @@ function buildOgSvgCustom(inner, viewBox, color) {
|
|
|
1798
1806
|
</g>
|
|
1799
1807
|
</svg>`;
|
|
1800
1808
|
}
|
|
1809
|
+
function buildOgGlowSvg(box) {
|
|
1810
|
+
const spread = 40;
|
|
1811
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${OG_WIDTH}" height="${OG_HEIGHT}">
|
|
1812
|
+
<defs>
|
|
1813
|
+
<filter id="glow" x="-40%" y="-40%" width="180%" height="180%">
|
|
1814
|
+
<feGaussianBlur stdDeviation="46"/>
|
|
1815
|
+
</filter>
|
|
1816
|
+
</defs>
|
|
1817
|
+
<rect x="${box.left - spread}" y="${box.top - spread}" width="${box.width + spread * 2}" height="${box.height + spread * 2}" rx="48" fill="#ffffff" opacity="0.22" filter="url(#glow)"/>
|
|
1818
|
+
</svg>`;
|
|
1819
|
+
}
|
|
1820
|
+
function buildOgSvgWithSmallLogo(mode, inner, viewBox, color, name) {
|
|
1821
|
+
const markSize = OG_HEADER.markSize;
|
|
1822
|
+
const gap = 28;
|
|
1823
|
+
const fontSize = 56;
|
|
1824
|
+
const groupY = OG_HEADER.top;
|
|
1825
|
+
const scale = markSize / viewBox;
|
|
1826
|
+
const textWidth = Math.round(name.length * fontSize * 0.58);
|
|
1827
|
+
const totalWidth = markSize + gap + textWidth;
|
|
1828
|
+
const groupX = Math.round((1200 - totalWidth) / 2);
|
|
1829
|
+
const logoMarkup = mode === "lucide" ? (() => {
|
|
1830
|
+
const sw = (2.5 / scale).toFixed(4);
|
|
1831
|
+
return `<g transform="translate(${groupX} ${groupY}) scale(${scale})" stroke="white" fill="none" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round">
|
|
1832
|
+
${inner}
|
|
1833
|
+
</g>`;
|
|
1834
|
+
})() : `<g transform="translate(${groupX} ${groupY}) scale(${scale})">
|
|
1835
|
+
${inner}
|
|
1836
|
+
</g>`;
|
|
1837
|
+
const textX = groupX + markSize + gap;
|
|
1838
|
+
const textY = groupY + markSize / 2;
|
|
1839
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${OG_WIDTH}" height="${OG_HEIGHT}">
|
|
1840
|
+
<rect width="${OG_WIDTH}" height="${OG_HEIGHT}" fill="${color}"/>
|
|
1841
|
+
${logoMarkup}
|
|
1842
|
+
<text x="${textX}" y="${textY}" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif" font-size="${fontSize}" font-weight="700" fill="white" dominant-baseline="middle" letter-spacing="-1">${escapeXml(name)}</text>
|
|
1843
|
+
</svg>`;
|
|
1844
|
+
}
|
|
1801
1845
|
async function generateAssets(config) {
|
|
1802
|
-
const { name, icon, color, outputDir } = config;
|
|
1846
|
+
const { name, icon, color, outputDir, ogComponent } = config;
|
|
1803
1847
|
let sharpFn;
|
|
1804
1848
|
try {
|
|
1805
1849
|
sharpFn = (await import('sharp')).default;
|
|
@@ -1811,17 +1855,8 @@ async function generateAssets(config) {
|
|
|
1811
1855
|
mkdirSync(outputDir, { recursive: true });
|
|
1812
1856
|
const faviconDir = join(outputDir, "favicon");
|
|
1813
1857
|
mkdirSync(faviconDir, { recursive: true });
|
|
1814
|
-
const mode = detectIconMode(icon);
|
|
1815
1858
|
const written = [];
|
|
1816
|
-
|
|
1817
|
-
let viewBox = 24;
|
|
1818
|
-
if (mode === "svg") {
|
|
1819
|
-
const parsed = getSvgInner(icon);
|
|
1820
|
-
inner = parsed.inner;
|
|
1821
|
-
viewBox = parsed.viewBox;
|
|
1822
|
-
} else {
|
|
1823
|
-
inner = getLucideInner(icon);
|
|
1824
|
-
}
|
|
1859
|
+
const { mode, inner, viewBox } = resolveIcon(icon);
|
|
1825
1860
|
const buildIcon = (size) => mode === "svg" ? buildIconSvgCustom(inner, viewBox, color, size) : buildIconSvgLucide(inner, color, size);
|
|
1826
1861
|
for (const size of FAVICON_SIZES) {
|
|
1827
1862
|
const png = await sharpFn(Buffer.from(buildIcon(size))).png().toBuffer();
|
|
@@ -1835,8 +1870,31 @@ async function generateAssets(config) {
|
|
|
1835
1870
|
writeFileSync(dest, png);
|
|
1836
1871
|
written.push(dest);
|
|
1837
1872
|
}
|
|
1838
|
-
const ogSvg = mode === "svg" ? buildOgSvgCustom(inner, viewBox, color) : buildOgSvgLucide(inner, name, color);
|
|
1839
|
-
|
|
1873
|
+
const ogSvg = ogComponent ? buildOgSvgWithSmallLogo(mode, inner, viewBox, color, name) : mode === "svg" ? buildOgSvgCustom(inner, viewBox, color) : buildOgSvgLucide(inner, name, color);
|
|
1874
|
+
let ogPng = await sharpFn(Buffer.from(ogSvg)).png().toBuffer();
|
|
1875
|
+
if (ogComponent) {
|
|
1876
|
+
const sideMargin = 72;
|
|
1877
|
+
const maxWidth = OG_WIDTH - sideMargin * 2;
|
|
1878
|
+
const headerBottom = OG_HEADER.top + OG_HEADER.markSize + OG_HEADER.gapBelow;
|
|
1879
|
+
const componentBuf = readFileSync(resolve(process.cwd(), ogComponent));
|
|
1880
|
+
const resized = await sharpFn(componentBuf, { density: 300 }).resize({ width: maxWidth, withoutEnlargement: true }).png().toBuffer();
|
|
1881
|
+
const { width: compWidth = maxWidth, height: compHeight = 0 } = await sharpFn(resized).metadata();
|
|
1882
|
+
const left = Math.round((OG_WIDTH - compWidth) / 2);
|
|
1883
|
+
const fits = headerBottom + compHeight <= OG_HEIGHT;
|
|
1884
|
+
const top = fits ? Math.round(headerBottom + (OG_HEIGHT - headerBottom - compHeight) / 2) : headerBottom;
|
|
1885
|
+
ogPng = await sharpFn(ogPng).composite([
|
|
1886
|
+
// Glow first: it has to sit under the component, and sharp applies
|
|
1887
|
+
// composites in array order.
|
|
1888
|
+
{
|
|
1889
|
+
input: Buffer.from(
|
|
1890
|
+
buildOgGlowSvg({ left, top, width: compWidth, height: compHeight })
|
|
1891
|
+
),
|
|
1892
|
+
left: 0,
|
|
1893
|
+
top: 0
|
|
1894
|
+
},
|
|
1895
|
+
{ input: resized, left, top }
|
|
1896
|
+
]).png().toBuffer();
|
|
1897
|
+
}
|
|
1840
1898
|
const ogDest = join(outputDir, "og-image.png");
|
|
1841
1899
|
writeFileSync(ogDest, ogPng);
|
|
1842
1900
|
written.push(ogDest);
|
|
@@ -1859,9 +1917,17 @@ async function generateAssets(config) {
|
|
|
1859
1917
|
written.push(robotsDest);
|
|
1860
1918
|
return { files: written };
|
|
1861
1919
|
}
|
|
1862
|
-
var FAVICON_SIZES, NAMED_ICONS;
|
|
1920
|
+
var OG_WIDTH, OG_HEIGHT, OG_HEADER, FAVICON_SIZES, NAMED_ICONS;
|
|
1863
1921
|
var init_generate_assets = __esm({
|
|
1864
1922
|
"src/generate-assets.ts"() {
|
|
1923
|
+
OG_WIDTH = 1200;
|
|
1924
|
+
OG_HEIGHT = 630;
|
|
1925
|
+
OG_HEADER = {
|
|
1926
|
+
top: 54,
|
|
1927
|
+
markSize: 96,
|
|
1928
|
+
/** Clear space between the wordmark's baseline and the component. */
|
|
1929
|
+
gapBelow: 30
|
|
1930
|
+
};
|
|
1865
1931
|
FAVICON_SIZES = [16, 32, 48, 64, 192, 512];
|
|
1866
1932
|
NAMED_ICONS = [
|
|
1867
1933
|
["apple-touch-icon.png", 180],
|
|
@@ -1880,7 +1946,7 @@ if (command === "skills" && subcommand === "install") {
|
|
|
1880
1946
|
await runGenerateAssets();
|
|
1881
1947
|
} else {
|
|
1882
1948
|
process.stdout.write(
|
|
1883
|
-
"Usage:\n dx skills install [--source <url>] [--target claude|amp] [--all] [--name a,b,c]\n dx ascii-gif --text <text> --out <file.gif>\n dx generate-assets --name <app> --icon <lucide-icon> --color <#hex> [--out <dir>]\n"
|
|
1949
|
+
"Usage:\n dx skills install [--source <url>] [--target claude|amp] [--all] [--name a,b,c]\n dx ascii-gif --text <text> --out <file.gif>\n dx generate-assets --name <app> --icon <lucide-icon> --color <#hex> [--out <dir>] [--og-component <svg-or-image-path>]\n"
|
|
1884
1950
|
);
|
|
1885
1951
|
}
|
|
1886
1952
|
async function runSkillsInstall() {
|
|
@@ -2044,9 +2110,10 @@ async function runGenerateAssets() {
|
|
|
2044
2110
|
const icon = flags.icon;
|
|
2045
2111
|
const color = flags.color;
|
|
2046
2112
|
const outputDir = flags.out ?? flags.output ?? "public";
|
|
2113
|
+
const ogComponent = flags["og-component"];
|
|
2047
2114
|
if (!name || !icon || !color) {
|
|
2048
2115
|
process.stderr.write(
|
|
2049
|
-
"Usage: dx generate-assets --name <app> --icon <lucide-icon> --color <#hex> [--out <dir>]\n"
|
|
2116
|
+
"Usage: dx generate-assets --name <app> --icon <lucide-icon> --color <#hex> [--out <dir>] [--og-component <svg-or-image-path>]\n"
|
|
2050
2117
|
);
|
|
2051
2118
|
process.exitCode = 1;
|
|
2052
2119
|
return;
|
|
@@ -2054,7 +2121,7 @@ async function runGenerateAssets() {
|
|
|
2054
2121
|
process.stdout.write(`Generating assets for "${name}"\u2026
|
|
2055
2122
|
`);
|
|
2056
2123
|
try {
|
|
2057
|
-
const result = await generateAssets2({ name, icon, color, outputDir });
|
|
2124
|
+
const result = await generateAssets2({ name, icon, color, outputDir, ogComponent });
|
|
2058
2125
|
process.stdout.write(`Generated ${result.files.length} files in ${outputDir}/
|
|
2059
2126
|
`);
|
|
2060
2127
|
for (const f of result.files) process.stdout.write(` ${f}
|
|
@@ -4,6 +4,12 @@ interface GenerateAssetsConfig {
|
|
|
4
4
|
icon: string;
|
|
5
5
|
color: string;
|
|
6
6
|
outputDir: string;
|
|
7
|
+
/**
|
|
8
|
+
* Optional path to a rendered component (SVG, PNG, JPG, or WebP) placed bottom-middle
|
|
9
|
+
* in og-image.png. When set, the OG image uses a solid `color` background with a smaller
|
|
10
|
+
* `icon` above the component instead of the default large-logo layout.
|
|
11
|
+
*/
|
|
12
|
+
ogComponent?: string;
|
|
7
13
|
}
|
|
8
14
|
interface GenerateAssetsResult {
|
|
9
15
|
files: string[];
|
package/dist/generate-assets.js
CHANGED
|
@@ -34,6 +34,14 @@ function getSvgInner(svgPath) {
|
|
|
34
34
|
const inner = svg.replace(/<svg[^>]*>/, "").replace(/<\/svg>/, "").trim();
|
|
35
35
|
return { inner, viewBox };
|
|
36
36
|
}
|
|
37
|
+
function resolveIcon(icon) {
|
|
38
|
+
const mode = detectIconMode(icon);
|
|
39
|
+
if (mode === "svg") {
|
|
40
|
+
const { inner, viewBox } = getSvgInner(icon);
|
|
41
|
+
return { mode, inner, viewBox };
|
|
42
|
+
}
|
|
43
|
+
return { mode, inner: getLucideInner(icon), viewBox: 24 };
|
|
44
|
+
}
|
|
37
45
|
function buildIconSvgLucide(inner, color, size) {
|
|
38
46
|
const pad = Math.round(size * 0.18);
|
|
39
47
|
const area = size - pad * 2;
|
|
@@ -92,6 +100,50 @@ function buildOgSvgCustom(inner, viewBox, color) {
|
|
|
92
100
|
</g>
|
|
93
101
|
</svg>`;
|
|
94
102
|
}
|
|
103
|
+
var OG_WIDTH = 1200;
|
|
104
|
+
var OG_HEIGHT = 630;
|
|
105
|
+
var OG_HEADER = {
|
|
106
|
+
top: 54,
|
|
107
|
+
markSize: 96,
|
|
108
|
+
/** Clear space between the wordmark's baseline and the component. */
|
|
109
|
+
gapBelow: 30
|
|
110
|
+
};
|
|
111
|
+
function buildOgGlowSvg(box) {
|
|
112
|
+
const spread = 40;
|
|
113
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${OG_WIDTH}" height="${OG_HEIGHT}">
|
|
114
|
+
<defs>
|
|
115
|
+
<filter id="glow" x="-40%" y="-40%" width="180%" height="180%">
|
|
116
|
+
<feGaussianBlur stdDeviation="46"/>
|
|
117
|
+
</filter>
|
|
118
|
+
</defs>
|
|
119
|
+
<rect x="${box.left - spread}" y="${box.top - spread}" width="${box.width + spread * 2}" height="${box.height + spread * 2}" rx="48" fill="#ffffff" opacity="0.22" filter="url(#glow)"/>
|
|
120
|
+
</svg>`;
|
|
121
|
+
}
|
|
122
|
+
function buildOgSvgWithSmallLogo(mode, inner, viewBox, color, name) {
|
|
123
|
+
const markSize = OG_HEADER.markSize;
|
|
124
|
+
const gap = 28;
|
|
125
|
+
const fontSize = 56;
|
|
126
|
+
const groupY = OG_HEADER.top;
|
|
127
|
+
const scale = markSize / viewBox;
|
|
128
|
+
const textWidth = Math.round(name.length * fontSize * 0.58);
|
|
129
|
+
const totalWidth = markSize + gap + textWidth;
|
|
130
|
+
const groupX = Math.round((1200 - totalWidth) / 2);
|
|
131
|
+
const logoMarkup = mode === "lucide" ? (() => {
|
|
132
|
+
const sw = (2.5 / scale).toFixed(4);
|
|
133
|
+
return `<g transform="translate(${groupX} ${groupY}) scale(${scale})" stroke="white" fill="none" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round">
|
|
134
|
+
${inner}
|
|
135
|
+
</g>`;
|
|
136
|
+
})() : `<g transform="translate(${groupX} ${groupY}) scale(${scale})">
|
|
137
|
+
${inner}
|
|
138
|
+
</g>`;
|
|
139
|
+
const textX = groupX + markSize + gap;
|
|
140
|
+
const textY = groupY + markSize / 2;
|
|
141
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${OG_WIDTH}" height="${OG_HEIGHT}">
|
|
142
|
+
<rect width="${OG_WIDTH}" height="${OG_HEIGHT}" fill="${color}"/>
|
|
143
|
+
${logoMarkup}
|
|
144
|
+
<text x="${textX}" y="${textY}" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif" font-size="${fontSize}" font-weight="700" fill="white" dominant-baseline="middle" letter-spacing="-1">${escapeXml(name)}</text>
|
|
145
|
+
</svg>`;
|
|
146
|
+
}
|
|
95
147
|
var FAVICON_SIZES = [16, 32, 48, 64, 192, 512];
|
|
96
148
|
var NAMED_ICONS = [
|
|
97
149
|
["apple-touch-icon.png", 180],
|
|
@@ -99,7 +151,7 @@ var NAMED_ICONS = [
|
|
|
99
151
|
["android-chrome-512x512.png", 512]
|
|
100
152
|
];
|
|
101
153
|
async function generateAssets(config) {
|
|
102
|
-
const { name, icon, color, outputDir } = config;
|
|
154
|
+
const { name, icon, color, outputDir, ogComponent } = config;
|
|
103
155
|
let sharpFn;
|
|
104
156
|
try {
|
|
105
157
|
sharpFn = (await import('sharp')).default;
|
|
@@ -111,17 +163,8 @@ async function generateAssets(config) {
|
|
|
111
163
|
mkdirSync(outputDir, { recursive: true });
|
|
112
164
|
const faviconDir = join(outputDir, "favicon");
|
|
113
165
|
mkdirSync(faviconDir, { recursive: true });
|
|
114
|
-
const mode = detectIconMode(icon);
|
|
115
166
|
const written = [];
|
|
116
|
-
|
|
117
|
-
let viewBox = 24;
|
|
118
|
-
if (mode === "svg") {
|
|
119
|
-
const parsed = getSvgInner(icon);
|
|
120
|
-
inner = parsed.inner;
|
|
121
|
-
viewBox = parsed.viewBox;
|
|
122
|
-
} else {
|
|
123
|
-
inner = getLucideInner(icon);
|
|
124
|
-
}
|
|
167
|
+
const { mode, inner, viewBox } = resolveIcon(icon);
|
|
125
168
|
const buildIcon = (size) => mode === "svg" ? buildIconSvgCustom(inner, viewBox, color, size) : buildIconSvgLucide(inner, color, size);
|
|
126
169
|
for (const size of FAVICON_SIZES) {
|
|
127
170
|
const png = await sharpFn(Buffer.from(buildIcon(size))).png().toBuffer();
|
|
@@ -135,8 +178,31 @@ async function generateAssets(config) {
|
|
|
135
178
|
writeFileSync(dest, png);
|
|
136
179
|
written.push(dest);
|
|
137
180
|
}
|
|
138
|
-
const ogSvg = mode === "svg" ? buildOgSvgCustom(inner, viewBox, color) : buildOgSvgLucide(inner, name, color);
|
|
139
|
-
|
|
181
|
+
const ogSvg = ogComponent ? buildOgSvgWithSmallLogo(mode, inner, viewBox, color, name) : mode === "svg" ? buildOgSvgCustom(inner, viewBox, color) : buildOgSvgLucide(inner, name, color);
|
|
182
|
+
let ogPng = await sharpFn(Buffer.from(ogSvg)).png().toBuffer();
|
|
183
|
+
if (ogComponent) {
|
|
184
|
+
const sideMargin = 72;
|
|
185
|
+
const maxWidth = OG_WIDTH - sideMargin * 2;
|
|
186
|
+
const headerBottom = OG_HEADER.top + OG_HEADER.markSize + OG_HEADER.gapBelow;
|
|
187
|
+
const componentBuf = readFileSync(resolve(process.cwd(), ogComponent));
|
|
188
|
+
const resized = await sharpFn(componentBuf, { density: 300 }).resize({ width: maxWidth, withoutEnlargement: true }).png().toBuffer();
|
|
189
|
+
const { width: compWidth = maxWidth, height: compHeight = 0 } = await sharpFn(resized).metadata();
|
|
190
|
+
const left = Math.round((OG_WIDTH - compWidth) / 2);
|
|
191
|
+
const fits = headerBottom + compHeight <= OG_HEIGHT;
|
|
192
|
+
const top = fits ? Math.round(headerBottom + (OG_HEIGHT - headerBottom - compHeight) / 2) : headerBottom;
|
|
193
|
+
ogPng = await sharpFn(ogPng).composite([
|
|
194
|
+
// Glow first: it has to sit under the component, and sharp applies
|
|
195
|
+
// composites in array order.
|
|
196
|
+
{
|
|
197
|
+
input: Buffer.from(
|
|
198
|
+
buildOgGlowSvg({ left, top, width: compWidth, height: compHeight })
|
|
199
|
+
),
|
|
200
|
+
left: 0,
|
|
201
|
+
top: 0
|
|
202
|
+
},
|
|
203
|
+
{ input: resized, left, top }
|
|
204
|
+
]).png().toBuffer();
|
|
205
|
+
}
|
|
140
206
|
const ogDest = join(outputDir, "og-image.png");
|
|
141
207
|
writeFileSync(ogDest, ogPng);
|
|
142
208
|
written.push(ogDest);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/generate-assets.ts"],"names":[],"mappings":";;;;;AAkBA,SAAS,eAAe,IAAA,EAAwB;AAC9C,EAAA,OAAO,IAAA,CAAK,QAAA,CAAS,MAAM,CAAA,IAAK,IAAA,CAAK,QAAA,CAAS,GAAG,CAAA,IAAK,IAAA,CAAK,QAAA,CAAS,IAAI,CAAA,GAAI,KAAA,GAAQ,QAAA;AACtF;AAEA,SAAS,YAAY,IAAA,EAAsB;AACzC,EAAA,OAAO,KACJ,OAAA,CAAQ,UAAA,EAAY,CAAC,CAAA,EAAG,OAAe,CAAA,CAAA,EAAI,EAAA,CAAG,WAAA,EAAa,EAAE,CAAA,CAC7D,OAAA,CAAQ,IAAA,EAAM,EAAE,EAChB,WAAA,EAAY;AACjB;AAEA,SAAS,UAAU,GAAA,EAAqB;AACtC,EAAA,OAAO,IACJ,OAAA,CAAQ,IAAA,EAAM,OAAO,CAAA,CACrB,OAAA,CAAQ,MAAM,MAAM,CAAA,CACpB,QAAQ,IAAA,EAAM,MAAM,EACpB,OAAA,CAAQ,IAAA,EAAM,QAAQ,CAAA,CACtB,OAAA,CAAQ,MAAM,QAAQ,CAAA;AAC3B;AAEA,SAAS,eAAe,QAAA,EAA0B;AAChD,EAAA,MAAM,KAAA,GAAQ,YAAY,QAAQ,CAAA;AAClC,EAAA,MAAM,GAAA,GAAM,aAAA,CAAc,MAAA,CAAA,IAAA,CAAY,GAAG,CAAA;AACzC,EAAA,IAAI,QAAA;AACJ,EAAA,IAAI;AACF,IAAA,QAAA,GAAW,GAAA,CAAI,OAAA,CAAQ,CAAA,oBAAA,EAAuB,KAAK,CAAA,IAAA,CAAM,CAAA;AAAA,EAC3D,CAAA,CAAA,MAAQ;AACN,IAAA,MAAM,IAAI,KAAA;AAAA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AA,EAAS,YAAA;AAAA,IACT,KAAA,EAAO;AAAA,MACL,EAAE,GAAA,EAAK,6BAAA,EAA+B,KAAA,EAAO,SAAA,EAAW,MAAM,WAAA,EAAY;AAAA,MAC1E,EAAE,KAAK,6BAAA,EAA+B,KAAA,EAAO,WAAW,IAAA,EAAM,WAAA,EAAa,SAAS,UAAA;AAAW;AACjG,GACF;AACA,EAAA,MAAM,YAAA,GAAe,IAAA,CAAK,SAAA,EAAW,eAAe,CAAA;AACpD,EAAA,aAAA,CAAc,cAAc,IAAA,CAAK,SAAA,CAAU,UAAU,IAAA,EAAM,CAAC,IAAI,IAAI,CAAA;AACpE,EAAA,OAAA,CAAQ,KAAK,YAAY,CAAA;AAEzB,EAAA,MAAM,UAAA,GAAa,IAAA,CAAK,SAAA,EAAW,YAAY,CAAA;AAC/C,EAAA,aAAA,CAAc,YAAY,2BAA2B,CAAA;AACrD,EAAA,OAAA,CAAQ,KAAK,UAAU,CAAA;AAEvB,EAAA,OAAO,EAAE,OAAO,OAAA,EAAQ;AAC1B","file":"generate-assets.js","sourcesContent":["import { mkdirSync, readFileSync, writeFileSync } from \"node:fs\"\nimport { createRequire } from \"node:module\"\nimport { join, resolve } from \"node:path\"\n\nexport interface GenerateAssetsConfig {\n name: string\n /** Lucide icon name (e.g. \"Zap\") OR path to an SVG file (e.g. \"./logo.svg\") */\n icon: string\n color: string\n outputDir: string\n}\n\nexport interface GenerateAssetsResult {\n files: string[]\n}\n\ntype IconMode = \"lucide\" | \"svg\"\n\nfunction detectIconMode(icon: string): IconMode {\n return icon.endsWith(\".svg\") || icon.includes(\"/\") || icon.includes(\"\\\\\") ? \"svg\" : \"lucide\"\n}\n\nfunction toKebabCase(name: string): string {\n return name\n .replace(/([A-Z])/g, (_, ch: string) => `-${ch.toLowerCase()}`)\n .replace(/^-/, \"\")\n .toLowerCase()\n}\n\nfunction escapeXml(str: string): string {\n return str\n .replace(/&/g, \"&\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\")\n .replace(/\"/g, \""\")\n .replace(/'/g, \"'\")\n}\n\nfunction getLucideInner(iconName: string): string {\n const kebab = toKebabCase(iconName)\n const req = createRequire(import.meta.url)\n let iconPath: string\n try {\n iconPath = req.resolve(`lucide-static/icons/${kebab}.svg`)\n } catch {\n throw new Error(\n `Unknown Lucide icon: \"${iconName}\" (tried \"${kebab}.svg\"). ` +\n `Browse icons at https://lucide.dev/icons`,\n )\n }\n const svg = readFileSync(iconPath, \"utf-8\")\n return svg\n .replace(/<svg[^>]*>/, \"\")\n .replace(/<\\/svg>/, \"\")\n .replace(/\\sstroke=\"currentColor\"/g, \"\")\n .replace(/\\sfill=\"none\"/g, \"\")\n .trim()\n}\n\nfunction getSvgInner(svgPath: string): { inner: string; viewBox: number } {\n const abs = resolve(process.cwd(), svgPath)\n const svg = readFileSync(abs, \"utf-8\")\n const vbMatch = svg.match(/viewBox=\"0 0 (\\d+\\.?\\d*) \\d/)\n const viewBox = vbMatch ? parseFloat(vbMatch[1]) : 24\n const inner = svg\n .replace(/<svg[^>]*>/, \"\")\n .replace(/<\\/svg>/, \"\")\n .trim()\n return { inner, viewBox }\n}\n\nfunction buildIconSvgLucide(inner: string, color: string, size: number): string {\n const pad = Math.round(size * 0.18)\n const area = size - pad * 2\n const scale = area / 24\n const rx = Math.round(size * 0.16)\n const sw = (2 / scale).toFixed(4)\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${size}\" height=\"${size}\">\n <rect width=\"${size}\" height=\"${size}\" rx=\"${rx}\" fill=\"${color}\"/>\n <g transform=\"translate(${pad} ${pad}) scale(${scale})\" stroke=\"white\" fill=\"none\" stroke-width=\"${sw}\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n ${inner}\n </g>\n</svg>`\n}\n\nfunction buildIconSvgCustom(inner: string, viewBox: number, color: string, size: number): string {\n const pad = Math.round(size * 0.08)\n const area = size - pad * 2\n const scale = area / viewBox\n const rx = Math.round(size * 0.16)\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${size}\" height=\"${size}\">\n <rect width=\"${size}\" height=\"${size}\" rx=\"${rx}\" fill=\"${color}\"/>\n <g transform=\"translate(${pad} ${pad}) scale(${scale})\">\n ${inner}\n </g>\n</svg>`\n}\n\nfunction buildOgSvgLucide(inner: string, name: string, color: string): string {\n const iconPx = 180\n const iconX = Math.round((1200 - iconPx) / 2)\n const iconY = 160\n const scale = iconPx / 24\n const sw = (2.5 / scale).toFixed(4)\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1200\" height=\"630\">\n <defs>\n <radialGradient id=\"rg\" cx=\"50%\" cy=\"40%\" r=\"65%\">\n <stop offset=\"0%\" stop-color=\"${color}\" stop-opacity=\"0.22\"/>\n <stop offset=\"100%\" stop-color=\"#000000\" stop-opacity=\"0\"/>\n </radialGradient>\n </defs>\n <rect width=\"1200\" height=\"630\" fill=\"#09090b\"/>\n <rect width=\"1200\" height=\"630\" fill=\"url(#rg)\"/>\n <g transform=\"translate(${iconX} ${iconY}) scale(${scale})\" stroke=\"${color}\" fill=\"none\" stroke-width=\"${sw}\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n ${inner}\n </g>\n <text x=\"600\" y=\"470\" font-family=\"-apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif\" font-size=\"72\" font-weight=\"700\" fill=\"white\" text-anchor=\"middle\" letter-spacing=\"-1\">${escapeXml(name)}</text>\n</svg>`\n}\n\nfunction buildOgSvgCustom(inner: string, viewBox: number, color: string): string {\n const s = 470\n const x = Math.round((1200 - s) / 2)\n const y = Math.round((630 - s) / 2)\n const scale = s / viewBox\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1200\" height=\"630\">\n <rect width=\"1200\" height=\"630\" fill=\"${color}\"/>\n <g transform=\"translate(${x} ${y}) scale(${scale})\">\n ${inner}\n </g>\n</svg>`\n}\n\nconst FAVICON_SIZES = [16, 32, 48, 64, 192, 512] as const\n\nconst NAMED_ICONS: Array<[string, number]> = [\n [\"apple-touch-icon.png\", 180],\n [\"android-chrome-192x192.png\", 192],\n [\"android-chrome-512x512.png\", 512],\n]\n\nexport async function generateAssets(\n config: GenerateAssetsConfig,\n): Promise<GenerateAssetsResult> {\n const { name, icon, color, outputDir } = config\n\n let sharpFn: typeof import(\"sharp\")\n try {\n sharpFn = (await import(\"sharp\")).default\n } catch {\n throw new Error(\n \"sharp is required for asset generation.\\n\" +\n \"Install it in your project: bun add sharp lucide-static\",\n )\n }\n\n mkdirSync(outputDir, { recursive: true })\n const faviconDir = join(outputDir, \"favicon\")\n mkdirSync(faviconDir, { recursive: true })\n\n const mode = detectIconMode(icon)\n const written: string[] = []\n\n let inner: string\n let viewBox = 24\n\n if (mode === \"svg\") {\n const parsed = getSvgInner(icon)\n inner = parsed.inner\n viewBox = parsed.viewBox\n } else {\n inner = getLucideInner(icon)\n }\n\n const buildIcon = (size: number) =>\n mode === \"svg\"\n ? buildIconSvgCustom(inner, viewBox, color, size)\n : buildIconSvgLucide(inner, color, size)\n\n for (const size of FAVICON_SIZES) {\n const png = await sharpFn(Buffer.from(buildIcon(size))).png().toBuffer()\n const dest = join(faviconDir, `favicon-${size}.png`)\n writeFileSync(dest, png)\n written.push(dest)\n }\n\n for (const [filename, size] of NAMED_ICONS) {\n const png = await sharpFn(Buffer.from(buildIcon(size))).png().toBuffer()\n const dest = join(outputDir, filename)\n writeFileSync(dest, png)\n written.push(dest)\n }\n\n const ogSvg =\n mode === \"svg\"\n ? buildOgSvgCustom(inner, viewBox, color)\n : buildOgSvgLucide(inner, name, color)\n\n const ogPng = await sharpFn(Buffer.from(ogSvg)).png().toBuffer()\n const ogDest = join(outputDir, \"og-image.png\")\n writeFileSync(ogDest, ogPng)\n written.push(ogDest)\n\n const manifest = {\n name,\n short_name: name,\n theme_color: color,\n background_color: mode === \"svg\" ? color : \"#09090b\",\n display: \"standalone\",\n icons: [\n { src: \"/android-chrome-192x192.png\", sizes: \"192x192\", type: \"image/png\" },\n { src: \"/android-chrome-512x512.png\", sizes: \"512x512\", type: \"image/png\", purpose: \"maskable\" },\n ],\n }\n const manifestDest = join(outputDir, \"manifest.json\")\n writeFileSync(manifestDest, JSON.stringify(manifest, null, 2) + \"\\n\")\n written.push(manifestDest)\n\n const robotsDest = join(outputDir, \"robots.txt\")\n writeFileSync(robotsDest, \"User-agent: *\\nAllow: /\\n\")\n written.push(robotsDest)\n\n return { files: written }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/generate-assets.ts"],"names":[],"mappings":";;;;;AAwBA,SAAS,eAAe,IAAA,EAAwB;AAC9C,EAAA,OAAO,IAAA,CAAK,QAAA,CAAS,MAAM,CAAA,IAAK,IAAA,CAAK,QAAA,CAAS,GAAG,CAAA,IAAK,IAAA,CAAK,QAAA,CAAS,IAAI,CAAA,GAAI,KAAA,GAAQ,QAAA;AACtF;AAEA,SAAS,YAAY,IAAA,EAAsB;AACzC,EAAA,OAAO,KACJ,OAAA,CAAQ,UAAA,EAAY,CAAC,CAAA,EAAG,OAAe,CAAA,CAAA,EAAI,EAAA,CAAG,WAAA,EAAa,EAAE,CAAA,CAC7D,OAAA,CAAQ,IAAA,EAAM,EAAE,EAChB,WAAA,EAAY;AACjB;AAEA,SAAS,UAAU,GAAA,EAAqB;AACtC,EAAA,OAAO,IACJ,OAAA,CAAQ,IAAA,EAAM,OAAO,CAAA,CACrB,OAAA,CAAQ,MAAM,MAAM,CAAA,CACpB,QAAQ,IAAA,EAAM,MAAM,EACpB,OAAA,CAAQ,IAAA,EAAM,QAAQ,CAAA,CACtB,OAAA,CAAQ,MAAM,QAAQ,CAAA;AAC3B;AAEA,SAAS,eAAe,QAAA,EAA0B;AAChD,EAAA,MAAM,KAAA,GAAQ,YAAY,QAAQ,CAAA;AAClC,EAAA,MAAM,GAAA,GAAM,aAAA,CAAc,MAAA,CAAA,IAAA,CAAY,GAAG,CAAA;AACzC,EAAA,IAAI,QAAA;AACJ,EAAA,IAAI;AACF,IAAA,QAAA,GAAW,GAAA,C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AY;AAAA,MAC1E,EAAE,KAAK,6BAAA,EAA+B,KAAA,EAAO,WAAW,IAAA,EAAM,WAAA,EAAa,SAAS,UAAA;AAAW;AACjG,GACF;AACA,EAAA,MAAM,YAAA,GAAe,IAAA,CAAK,SAAA,EAAW,eAAe,CAAA;AACpD,EAAA,aAAA,CAAc,cAAc,IAAA,CAAK,SAAA,CAAU,UAAU,IAAA,EAAM,CAAC,IAAI,IAAI,CAAA;AACpE,EAAA,OAAA,CAAQ,KAAK,YAAY,CAAA;AAEzB,EAAA,MAAM,UAAA,GAAa,IAAA,CAAK,SAAA,EAAW,YAAY,CAAA;AAC/C,EAAA,aAAA,CAAc,YAAY,2BAA2B,CAAA;AACrD,EAAA,OAAA,CAAQ,KAAK,UAAU,CAAA;AAEvB,EAAA,OAAO,EAAE,OAAO,OAAA,EAAQ;AAC1B","file":"generate-assets.js","sourcesContent":["import { mkdirSync, readFileSync, writeFileSync } from \"node:fs\"\nimport { createRequire } from \"node:module\"\nimport { join, resolve } from \"node:path\"\n\nexport interface GenerateAssetsConfig {\n name: string\n /** Lucide icon name (e.g. \"Zap\") OR path to an SVG file (e.g. \"./logo.svg\") */\n icon: string\n color: string\n outputDir: string\n /**\n * Optional path to a rendered component (SVG, PNG, JPG, or WebP) placed bottom-middle\n * in og-image.png. When set, the OG image uses a solid `color` background with a smaller\n * `icon` above the component instead of the default large-logo layout.\n */\n ogComponent?: string\n}\n\nexport interface GenerateAssetsResult {\n files: string[]\n}\n\ntype IconMode = \"lucide\" | \"svg\"\n\nfunction detectIconMode(icon: string): IconMode {\n return icon.endsWith(\".svg\") || icon.includes(\"/\") || icon.includes(\"\\\\\") ? \"svg\" : \"lucide\"\n}\n\nfunction toKebabCase(name: string): string {\n return name\n .replace(/([A-Z])/g, (_, ch: string) => `-${ch.toLowerCase()}`)\n .replace(/^-/, \"\")\n .toLowerCase()\n}\n\nfunction escapeXml(str: string): string {\n return str\n .replace(/&/g, \"&\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\")\n .replace(/\"/g, \""\")\n .replace(/'/g, \"'\")\n}\n\nfunction getLucideInner(iconName: string): string {\n const kebab = toKebabCase(iconName)\n const req = createRequire(import.meta.url)\n let iconPath: string\n try {\n iconPath = req.resolve(`lucide-static/icons/${kebab}.svg`)\n } catch {\n throw new Error(\n `Unknown Lucide icon: \"${iconName}\" (tried \"${kebab}.svg\"). ` +\n `Browse icons at https://lucide.dev/icons`,\n )\n }\n const svg = readFileSync(iconPath, \"utf-8\")\n return svg\n .replace(/<svg[^>]*>/, \"\")\n .replace(/<\\/svg>/, \"\")\n .replace(/\\sstroke=\"currentColor\"/g, \"\")\n .replace(/\\sfill=\"none\"/g, \"\")\n .trim()\n}\n\nfunction getSvgInner(svgPath: string): { inner: string; viewBox: number } {\n const abs = resolve(process.cwd(), svgPath)\n const svg = readFileSync(abs, \"utf-8\")\n const vbMatch = svg.match(/viewBox=\"0 0 (\\d+\\.?\\d*) \\d/)\n const viewBox = vbMatch ? parseFloat(vbMatch[1]) : 24\n const inner = svg\n .replace(/<svg[^>]*>/, \"\")\n .replace(/<\\/svg>/, \"\")\n .trim()\n return { inner, viewBox }\n}\n\nfunction resolveIcon(icon: string): { mode: IconMode; inner: string; viewBox: number } {\n const mode = detectIconMode(icon)\n if (mode === \"svg\") {\n const { inner, viewBox } = getSvgInner(icon)\n return { mode, inner, viewBox }\n }\n return { mode, inner: getLucideInner(icon), viewBox: 24 }\n}\n\nfunction buildIconSvgLucide(inner: string, color: string, size: number): string {\n const pad = Math.round(size * 0.18)\n const area = size - pad * 2\n const scale = area / 24\n const rx = Math.round(size * 0.16)\n const sw = (2 / scale).toFixed(4)\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${size}\" height=\"${size}\">\n <rect width=\"${size}\" height=\"${size}\" rx=\"${rx}\" fill=\"${color}\"/>\n <g transform=\"translate(${pad} ${pad}) scale(${scale})\" stroke=\"white\" fill=\"none\" stroke-width=\"${sw}\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n ${inner}\n </g>\n</svg>`\n}\n\nfunction buildIconSvgCustom(inner: string, viewBox: number, color: string, size: number): string {\n const pad = Math.round(size * 0.08)\n const area = size - pad * 2\n const scale = area / viewBox\n const rx = Math.round(size * 0.16)\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${size}\" height=\"${size}\">\n <rect width=\"${size}\" height=\"${size}\" rx=\"${rx}\" fill=\"${color}\"/>\n <g transform=\"translate(${pad} ${pad}) scale(${scale})\">\n ${inner}\n </g>\n</svg>`\n}\n\nfunction buildOgSvgLucide(inner: string, name: string, color: string): string {\n const iconPx = 180\n const iconX = Math.round((1200 - iconPx) / 2)\n const iconY = 160\n const scale = iconPx / 24\n const sw = (2.5 / scale).toFixed(4)\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1200\" height=\"630\">\n <defs>\n <radialGradient id=\"rg\" cx=\"50%\" cy=\"40%\" r=\"65%\">\n <stop offset=\"0%\" stop-color=\"${color}\" stop-opacity=\"0.22\"/>\n <stop offset=\"100%\" stop-color=\"#000000\" stop-opacity=\"0\"/>\n </radialGradient>\n </defs>\n <rect width=\"1200\" height=\"630\" fill=\"#09090b\"/>\n <rect width=\"1200\" height=\"630\" fill=\"url(#rg)\"/>\n <g transform=\"translate(${iconX} ${iconY}) scale(${scale})\" stroke=\"${color}\" fill=\"none\" stroke-width=\"${sw}\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n ${inner}\n </g>\n <text x=\"600\" y=\"470\" font-family=\"-apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif\" font-size=\"72\" font-weight=\"700\" fill=\"white\" text-anchor=\"middle\" letter-spacing=\"-1\">${escapeXml(name)}</text>\n</svg>`\n}\n\nfunction buildOgSvgCustom(inner: string, viewBox: number, color: string): string {\n const s = 470\n const x = Math.round((1200 - s) / 2)\n const y = Math.round((630 - s) / 2)\n const scale = s / viewBox\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1200\" height=\"630\">\n <rect width=\"1200\" height=\"630\" fill=\"${color}\"/>\n <g transform=\"translate(${x} ${y}) scale(${scale})\">\n ${inner}\n </g>\n</svg>`\n}\n\nconst OG_WIDTH = 1200\nconst OG_HEIGHT = 630\n\n/**\n * The wordmark band at the top, and the space left under it for the component.\n *\n * Shared by the SVG that draws the header and the compositing that places the\n * component, so the two cannot disagree about where one ends and the other\n * begins — the failure mode being a component that creeps up under the logo.\n */\nconst OG_HEADER = {\n top: 54,\n markSize: 96,\n /** Clear space between the wordmark's baseline and the component. */\n gapBelow: 30,\n} as const\n\n/**\n * A soft bloom behind the component, so it sits on the brand field rather than\n * on top of it. White at low opacity rather than a tint, so it reads as light\n * on any brand colour instead of as a second colour competing with it.\n */\nfunction buildOgGlowSvg(box: { left: number; top: number; width: number; height: number }): string {\n const spread = 40\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${OG_WIDTH}\" height=\"${OG_HEIGHT}\">\n <defs>\n <filter id=\"glow\" x=\"-40%\" y=\"-40%\" width=\"180%\" height=\"180%\">\n <feGaussianBlur stdDeviation=\"46\"/>\n </filter>\n </defs>\n <rect x=\"${box.left - spread}\" y=\"${box.top - spread}\" width=\"${box.width + spread * 2}\" height=\"${box.height + spread * 2}\" rx=\"48\" fill=\"#ffffff\" opacity=\"0.22\" filter=\"url(#glow)\"/>\n</svg>`\n}\n\n/**\n * OG base image used when `ogComponent` is set: solid brand-`color` background with a\n * small logo mark + name wordmark centered as a group near the top. The component itself\n * is composited on top afterward, filling the space beneath.\n */\nfunction buildOgSvgWithSmallLogo(\n mode: IconMode,\n inner: string,\n viewBox: number,\n color: string,\n name: string,\n): string {\n const markSize = OG_HEADER.markSize\n const gap = 28\n const fontSize = 56\n const groupY = OG_HEADER.top\n const scale = markSize / viewBox\n\n // No text-measurement API in raw SVG generation, so estimate wordmark width from\n // character count to center the mark+text group as a whole.\n const textWidth = Math.round(name.length * fontSize * 0.58)\n const totalWidth = markSize + gap + textWidth\n const groupX = Math.round((1200 - totalWidth) / 2)\n\n const logoMarkup =\n mode === \"lucide\"\n ? (() => {\n const sw = (2.5 / scale).toFixed(4)\n return `<g transform=\"translate(${groupX} ${groupY}) scale(${scale})\" stroke=\"white\" fill=\"none\" stroke-width=\"${sw}\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n ${inner}\n </g>`\n })()\n : `<g transform=\"translate(${groupX} ${groupY}) scale(${scale})\">\n ${inner}\n </g>`\n\n const textX = groupX + markSize + gap\n const textY = groupY + markSize / 2\n\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${OG_WIDTH}\" height=\"${OG_HEIGHT}\">\n <rect width=\"${OG_WIDTH}\" height=\"${OG_HEIGHT}\" fill=\"${color}\"/>\n ${logoMarkup}\n <text x=\"${textX}\" y=\"${textY}\" font-family=\"-apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif\" font-size=\"${fontSize}\" font-weight=\"700\" fill=\"white\" dominant-baseline=\"middle\" letter-spacing=\"-1\">${escapeXml(name)}</text>\n</svg>`\n}\n\nconst FAVICON_SIZES = [16, 32, 48, 64, 192, 512] as const\n\nconst NAMED_ICONS: Array<[string, number]> = [\n [\"apple-touch-icon.png\", 180],\n [\"android-chrome-192x192.png\", 192],\n [\"android-chrome-512x512.png\", 512],\n]\n\nexport async function generateAssets(\n config: GenerateAssetsConfig,\n): Promise<GenerateAssetsResult> {\n const { name, icon, color, outputDir, ogComponent } = config\n\n let sharpFn: typeof import(\"sharp\")\n try {\n sharpFn = (await import(\"sharp\")).default\n } catch {\n throw new Error(\n \"sharp is required for asset generation.\\n\" +\n \"Install it in your project: bun add sharp lucide-static\",\n )\n }\n\n mkdirSync(outputDir, { recursive: true })\n const faviconDir = join(outputDir, \"favicon\")\n mkdirSync(faviconDir, { recursive: true })\n\n const written: string[] = []\n\n const { mode, inner, viewBox } = resolveIcon(icon)\n\n const buildIcon = (size: number) =>\n mode === \"svg\"\n ? buildIconSvgCustom(inner, viewBox, color, size)\n : buildIconSvgLucide(inner, color, size)\n\n for (const size of FAVICON_SIZES) {\n const png = await sharpFn(Buffer.from(buildIcon(size))).png().toBuffer()\n const dest = join(faviconDir, `favicon-${size}.png`)\n writeFileSync(dest, png)\n written.push(dest)\n }\n\n for (const [filename, size] of NAMED_ICONS) {\n const png = await sharpFn(Buffer.from(buildIcon(size))).png().toBuffer()\n const dest = join(outputDir, filename)\n writeFileSync(dest, png)\n written.push(dest)\n }\n\n const ogSvg = ogComponent\n ? buildOgSvgWithSmallLogo(mode, inner, viewBox, color, name)\n : mode === \"svg\"\n ? buildOgSvgCustom(inner, viewBox, color)\n : buildOgSvgLucide(inner, name, color)\n\n let ogPng = await sharpFn(Buffer.from(ogSvg)).png().toBuffer()\n\n if (ogComponent) {\n // Scaled to width and allowed to run off the bottom edge, rather than\n // shrunk to fit a box. A screenshot that fits entirely inside the frame\n // reads as a picture of an app; one that continues past the edge reads as\n // the app itself, and the detail stays legible at the size a link preview\n // is actually seen.\n //\n // The previous fixed 880x300 box assumed a wide strip — a composer, a\n // toolbar — and shrank anything squarer to fit its height: a 1.87:1\n // dashboard landed at 561x300, adrift in the middle of a 1200px canvas.\n const sideMargin = 72\n const maxWidth = OG_WIDTH - sideMargin * 2\n const headerBottom = OG_HEADER.top + OG_HEADER.markSize + OG_HEADER.gapBelow\n\n const componentBuf = readFileSync(resolve(process.cwd(), ogComponent))\n const resized = await sharpFn(componentBuf, { density: 300 })\n .resize({ width: maxWidth, withoutEnlargement: true })\n .png()\n .toBuffer()\n const { width: compWidth = maxWidth, height: compHeight = 0 } =\n await sharpFn(resized).metadata()\n\n const left = Math.round((OG_WIDTH - compWidth) / 2)\n // A component short enough to fit sits centred in the space under the\n // header; a tall one starts there and bleeds off the bottom. Without this\n // branch a wide strip would cling to the header with a gulf beneath it.\n const fits = headerBottom + compHeight <= OG_HEIGHT\n const top = fits\n ? Math.round(headerBottom + (OG_HEIGHT - headerBottom - compHeight) / 2)\n : headerBottom\n\n ogPng = await sharpFn(ogPng)\n .composite([\n // Glow first: it has to sit under the component, and sharp applies\n // composites in array order.\n {\n input: Buffer.from(\n buildOgGlowSvg({ left, top, width: compWidth, height: compHeight }),\n ),\n left: 0,\n top: 0,\n },\n { input: resized, left, top },\n ])\n .png()\n .toBuffer()\n }\n\n const ogDest = join(outputDir, \"og-image.png\")\n writeFileSync(ogDest, ogPng)\n written.push(ogDest)\n\n const manifest = {\n name,\n short_name: name,\n theme_color: color,\n background_color: mode === \"svg\" ? color : \"#09090b\",\n display: \"standalone\",\n icons: [\n { src: \"/android-chrome-192x192.png\", sizes: \"192x192\", type: \"image/png\" },\n { src: \"/android-chrome-512x512.png\", sizes: \"512x512\", type: \"image/png\", purpose: \"maskable\" },\n ],\n }\n const manifestDest = join(outputDir, \"manifest.json\")\n writeFileSync(manifestDest, JSON.stringify(manifest, null, 2) + \"\\n\")\n written.push(manifestDest)\n\n const robotsDest = join(outputDir, \"robots.txt\")\n writeFileSync(robotsDest, \"User-agent: *\\nAllow: /\\n\")\n written.push(robotsDest)\n\n return { files: written }\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -26,18 +26,20 @@ declare function createDevBannerPlugin(project: string | BannerOptions | LegacyB
|
|
|
26
26
|
|
|
27
27
|
declare function findFreePort(start: number, attempts?: number): Promise<number>;
|
|
28
28
|
/**
|
|
29
|
-
* Resolve the dev server port,
|
|
29
|
+
* Resolve the dev server port for a preferred base port, falling back to the
|
|
30
|
+
* next free one and saying so loudly.
|
|
30
31
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
32
|
+
* Falling back is the right default — a second app should start rather than
|
|
33
|
+
* refuse — but the move used to be near-silent, and the port is not the thing
|
|
34
|
+
* that breaks. What breaks is anything holding an absolute localhost URL:
|
|
35
|
+
* sign-in fails "Invalid origin" if the origin is pinned, and magic links point
|
|
36
|
+
* at the port you are no longer on.
|
|
36
37
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
38
|
+
* So callers are expected to do two things, and the log says so:
|
|
39
|
+
* - trust localhost on any port in dev (`http://localhost:*`)
|
|
40
|
+
* - derive `BETTER_AUTH_URL` from the port this returns, not from `.env`
|
|
39
41
|
*/
|
|
40
|
-
declare function resolveDevPort(preferred: number): Promise<number>;
|
|
42
|
+
declare function resolveDevPort(preferred: number, attempts?: number): Promise<number>;
|
|
41
43
|
|
|
42
44
|
type ProjectBrandAccent = {
|
|
43
45
|
hex: string;
|
package/dist/index.js
CHANGED
|
@@ -1446,17 +1446,19 @@ async function findFreePort(start, attempts = 20) {
|
|
|
1446
1446
|
}
|
|
1447
1447
|
throw new Error(`No free port found in range ${start}-${start + attempts - 1}`);
|
|
1448
1448
|
}
|
|
1449
|
-
async function resolveDevPort(preferred) {
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1449
|
+
async function resolveDevPort(preferred, attempts = 20) {
|
|
1450
|
+
const port = await findFreePort(preferred, attempts);
|
|
1451
|
+
if (port !== preferred) {
|
|
1452
|
+
console.warn(
|
|
1453
|
+
`
|
|
1454
|
+
\u26A0 Port ${preferred} is in use \u2014 this dev server is on ${port} instead.
|
|
1455
|
+
Absolute URLs built from .env still say ${preferred}. Anything that
|
|
1456
|
+
emails you a link (magic link, email verification) will point at the
|
|
1457
|
+
wrong port unless BETTER_AUTH_URL is derived from ${port}.
|
|
1458
|
+
`
|
|
1459
|
+
);
|
|
1460
|
+
}
|
|
1461
|
+
return port;
|
|
1460
1462
|
}
|
|
1461
1463
|
|
|
1462
1464
|
// src/project-brand.ts
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ascii/compose.ts","../src/ascii/fonts/dosrebel-data.ts","../src/ascii/fonts.ts","../src/ascii/figlet.ts","../src/dos-rebel-font.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sB,eAAe,SAAA,EAAoC;AACvE,EAAA,IAAI,MAAM,MAAA,CAAO,SAAS,CAAA,EAAG,OAAO,SAAA;AAEpC,EAAA,MAAM,IAAI,KAAA;AAAA,IACR,QAAQ,SAAS,CAAA;;AAAA;AAAA,SAAA,EAEH,YAAY,CAAC,CAAA;;AAAA;AAAA,6CAAA;AAAA,GAG7B;AACF;;;AClBA,SAAS,4BAAA,CACP,UACA,SAAA,EACiB;AACjB,EAAA,OAAO,QAAA,CAAS,GAAA,CAAI,CAAC,OAAA,MAAa;AAAA,IAChC,MAAM,OAAA,CAAQ,IAAA;AAAA,IACd,QAAA,EAAU,OAAA,CAAQ,MAAA,GAAS,SAAA,GAAY,OAAA,CAAQ;AAAA,GACjD,CAAE,CAAA;AACJ;AAEA,SAAS,iBAAiB,OAAA,EAAwB;AAChD,EAAA,OAAO;AAAA,IACL,UAAU,4BAAA,CAA6B,OAAA,CAAQ,OAAO,QAAA,EAAU,OAAA,CAAQ,YAAY,GAAG,CAAA;AAAA,IACvF,eAAA,EAAiB,OAAA,CAAQ,MAAA,CAAO,eAAA,GAC5B,4BAAA,CAA6B,OAAA,CAAQ,MAAA,CAAO,eAAA,EAAiB,OAAA,CAAQ,WAAA,CAAY,GAAG,CAAA,GACpF;AAAA,GACN;AACF;AAEO,SAAS,6BAA6B,OAAA,EAAwB;AACnE,EAAA,OAAO,qBAAA,CAAsB,gBAAA,CAAiB,OAAO,CAAC,CAAA;AACxD;AAEO,SAAS,4BAA4B,OAAA,EAAwB;AAClE,EAAA,OAAO,oBAAA,CAAqB,gBAAA,CAAiB,OAAO,CAAC,CAAA;AACvD","file":"index.js","sourcesContent":["import type { FigletFont } from \"./figlet\"\n\nexport interface AsciiCell {\n ch: \"█\" | \"░\"\n col: number\n row: number\n}\n\nexport interface AsciiTextLayout {\n cells: AsciiCell[]\n cols: number\n rows: number\n}\n\nexport function composeAsciiText(font: FigletFont, text: string): AsciiTextLayout {\n const charBlocks: Array<{ lines: string[]; width: number }> = []\n\n for (const ch of text) {\n const code = ch.charCodeAt(0)\n const glyph = font.chars.get(code) ?? font.chars.get(32)\n if (!glyph) continue\n\n const width = Math.max(...glyph.map((line) => line.length))\n charBlocks.push({\n lines: glyph.map((line) => line.padEnd(width)),\n width,\n })\n }\n\n const cols = charBlocks.reduce((sum, block) => sum + block.width, 0)\n const rows = font.height\n const cells: AsciiCell[] = []\n let offsetX = 0\n\n for (const block of charBlocks) {\n for (let row = 0; row < rows; row++) {\n const line = block.lines[row] ?? \"\"\n for (let col = 0; col < line.length; col++) {\n const ch = line[col]\n if (ch === \"█\" || ch === \"░\") {\n cells.push({ ch, col: offsetX + col, row })\n }\n }\n }\n offsetX += block.width\n }\n\n return { cells, cols, rows }\n}\n\nexport function getAsciiAccentColumns(\n font: FigletFont,\n text: string,\n accent: string,\n): Set<number> {\n if (!accent) return new Set<number>()\n\n const columns = new Set<number>()\n const accentRanges: Array<{ start: number; end: number }> = []\n let searchFrom = 0\n while (true) {\n const idx = text.indexOf(accent, searchFrom)\n if (idx === -1) break\n accentRanges.push({ start: idx, end: idx + accent.length })\n searchFrom = idx + 1\n }\n if (accentRanges.length === 0) return columns\n\n let offsetX = 0\n let charIndex = 0\n\n for (const ch of text) {\n const code = ch.charCodeAt(0)\n const glyph = font.chars.get(code) ?? font.chars.get(32)\n if (!glyph) { charIndex++; continue }\n\n const width = Math.max(...glyph.map((line) => line.length))\n if (accentRanges.some((r) => charIndex >= r.start && charIndex < r.end)) {\n for (let col = 0; col < width; col++) columns.add(offsetX + col)\n }\n offsetX += width\n charIndex++\n }\n\n return columns\n}\n","// @generated from dosrebel.flf. Do not edit by hand.\nexport const dosrebelFont: string = \"flf2a$ 11 8 35 -1 15\\nRebel by Valerie Mates (popcorn@cyberspace.org), based on a font by Ron Bliss\\n(who sometimes goes by the name \\\"rebel\\\" because his initials are REB).\\nNOTE: THIS FONT ONLY WORKS IN MS-DOS.\\nMay 27, 1994\\n\\nExplanation of first line:\\nflf2 - \\\"magic number\\\" for file identification\\na - should always be `a', for now\\n$ - the \\\"hardblank\\\" -- prints as a blank, but can't be smushed\\n11 - height of a character\\n8 - height of a character, not including descenders\\n35 - max line length (excluding comment lines) + a fudge factor\\n-1 - default smushmode for this font (like \\\"-m 15\\\" on command line)\\n15 - number of comment lines\\n\\n$$$@\\n$$$@\\n$$$@\\n$$$@\\n$$$@\\n$$$@\\n$$$@\\n$$$@\\n$$$@\\n$$$@\\n$$$@@\\n ███@\\n░███@\\n░███@\\n░███@\\n░███@\\n░░░ @\\n ███@\\n░░░ @\\n @\\n @\\n @@\\n ██ ██@\\n░██░██@\\n░░ ░░ @\\n @\\n @\\n @\\n @\\n @\\n @\\n @\\n @@\\n ███ ███ @\\n ████████████@\\n░░░███░░███░ @\\n ████████████@\\n░░░███░░███░ @\\n ░░░ ░░░ @\\n @\\n @\\n @\\n @\\n @@\\n ███ @\\n ██████ @\\n ███░░░ @\\n ░░█████ @\\n ░░░░███ @\\n ██████ @\\n ░░░███ @\\n ░░░ @\\n @\\n @\\n @@\\n ███ ███@\\n ░░░ ███░ @\\n ███░ @\\n ███░ @\\n ███░ @\\n ███░ @\\n ███░ ███ @\\n░░░ ░░░ @\\n @\\n @\\n @@\\n ██████ @\\n ███░░███ @\\n ░░██████ @\\n ██████ @\\n░███░░███ @\\n░███ ░░███ @\\n░░█████░███@\\n ░░░░░ ░░░ @\\n @\\n @\\n @@\\n ██@\\n ███@\\n░░░ @\\n @\\n @\\n @\\n @\\n @\\n @\\n @\\n @@\\n ███@\\n ███ @\\n ███ @\\n░███ @\\n░███ @\\n░░███ @\\n ░░███@\\n ░░░ @\\n @\\n @\\n @@\\n ███ @\\n░░███ @\\n ░░███@\\n ░███@\\n ░███@\\n ███ @\\n ██░ @\\n░░░ @\\n @\\n @\\n @@\\n ███ @\\n ███ ░███ ███@\\n░░░█████████░ @\\n ░░░█████░ @\\n █████████ @\\n ███░░███░░███@\\n░░░ ░███ ░░░ @\\n ░░░ @\\n @\\n @\\n @@\\n @\\n ███ @\\n ░███ @\\n ███████████@\\n░░░░░███░░░ @\\n ░███ @\\n ░░░ @\\n @\\n @\\n @\\n @@\\n @\\n @\\n @\\n @\\n @\\n @\\n ██@\\n ██ @\\n░░ @\\n @\\n @@\\n @\\n @\\n @\\n ██████████@\\n░░░░░░░░░░ @\\n @\\n @\\n @\\n @\\n @\\n @@\\n @\\n @\\n @\\n @\\n @\\n @\\n ██@\\n░░ @\\n @\\n @\\n @@\\n ███@\\n ███░ @\\n ███░ @\\n ███░ @\\n ███░ @\\n ███░ @\\n ███░ @\\n░░░ @\\n @\\n @\\n @@\\n █████ @\\n ███░░░███ @\\n ███ ░░███@\\n░███ ░███@\\n░███ ░███@\\n░░███ ███ @\\n ░░░█████░ @\\n ░░░░░░ @\\n @\\n @\\n @@\\n ████ @\\n░░███ @\\n ░███ @\\n ░███ @\\n ░███ @\\n ░███ @\\n █████@\\n░░░░░ @\\n @\\n @\\n @@\\n ████████ @\\n ███░░░░███@\\n░░░ ░███@\\n ███████ @\\n ███░░░░ @\\n ███ █@\\n░██████████@\\n░░░░░░░░░░ @\\n @\\n @\\n @@\\n ████████ @\\n ███░░░░███@\\n░░░ ░███@\\n ██████░ @\\n ░░░░░░███@\\n ███ ░███@\\n░░████████ @\\n ░░░░░░░░ @\\n @\\n @\\n @@\\n █████ █████ @\\n░░███ ░░███ @\\n ░███ ░███ █@\\n ░███████████@\\n ░░░░░░░███░█@\\n ░███░ @\\n █████ @\\n ░░░░░ @\\n @\\n @\\n @@\\n ██████████@\\n░███░░░░░░█@\\n░███ ░ @\\n░█████████ @\\n░░░░░░░░███@\\n ███ ░███@\\n░░████████ @\\n ░░░░░░░░ @\\n @\\n @\\n @@\\n ████████ @\\n ███░░░░███@\\n░███ ░░░ @\\n░█████████ @\\n░███░░░░███@\\n░███ ░███@\\n░░████████ @\\n ░░░░░░░░ @\\n @\\n @\\n @@\\n ██████████@\\n░███░░░░███@\\n░░░ ███ @\\n ███ @\\n ███ @\\n ███ @\\n ███ @\\n ░░░ @\\n @\\n @\\n @@\\n ████████ @\\n ███░░░░███ @\\n░███ ░███ @\\n░░████████ @\\n ███░░░░███ @\\n░███ ░███ @\\n░░████████ @\\n ░░░░░░░░ @\\n @\\n @\\n @@\\n ████████ @\\n ███░░░░███@\\n░███ ░███@\\n░░█████████@\\n ░░░░░░░███@\\n ███ ░███@\\n░░████████ @\\n ░░░░░░░░ @\\n @\\n @\\n @@\\n @\\n @\\n ██@\\n░░ @\\n @\\n @\\n ██@\\n░░ @\\n @\\n @\\n @@\\n @\\n @\\n @\\n @\\n ██@\\n ░░ @\\n ██@\\n ██ @\\n░░ @\\n @\\n @@\\n ███@\\n ███░ @\\n ███░ @\\n ███░ @\\n░░░███ @\\n ░░░███ @\\n ░░░███@\\n ░░░ @\\n @\\n @\\n @@\\n @\\n @\\n █████████@\\n░░░░░░░░░ @\\n █████████@\\n░░░░░░░░░ @\\n @\\n @\\n @\\n @\\n @@\\n ███ @\\n░░░███ @\\n ░░░███ @\\n ░░░███@\\n ███░ @\\n ███░ @\\n ███░ @\\n░░░ @\\n @\\n @\\n @@\\n ███████ @\\n ███░░░███@\\n░░░ ░███@\\n ███████ @\\n ░███░░░ @\\n ░░░ @\\n ███ @\\n ░░░ @\\n @\\n @\\n @@\\n █████████ @\\n ███░░░░░░ @\\n░███ ██████ @\\n░███░███░███@\\n░███░███░███@\\n░███░░░ ░███@\\n░░█████████ @\\n ░░░░░░░░░ @\\n @\\n @\\n @@\\n █████████ @\\n ███░░░░░███ @\\n ░███ ░███ @\\n ░███████████ @\\n ░███░░░░░███ @\\n ░███ ░███ @\\n █████ █████@\\n░░░░░ ░░░░░ @\\n @\\n @\\n @@\\n ███████████ @\\n░░███░░░░░███@\\n ░███ ░███@\\n ░██████████ @\\n ░███░░░░░███@\\n ░███ ░███@\\n ███████████ @\\n░░░░░░░░░░░ @\\n @\\n @\\n @@\\n █████████ @\\n ███░░░░░███@\\n ███ ░░░ @\\n░███ @\\n░███ @\\n░░███ ███@\\n ░░█████████ @\\n ░░░░░░░░░ @\\n @\\n @\\n @@\\n ██████████ @\\n░░███░░░░███ @\\n ░███ ░░███@\\n ░███ ░███@\\n ░███ ░███@\\n ░███ ███ @\\n ██████████ @\\n░░░░░░░░░░ @\\n @\\n @\\n @@\\n ██████████@\\n░░███░░░░░█@\\n ░███ █ ░ @\\n ░██████ @\\n ░███░░█ @\\n ░███ ░ █@\\n ██████████@\\n░░░░░░░░░░ @\\n @\\n @\\n @@\\n ███████████@\\n░░███░░░░░░█@\\n ░███ █ ░ @\\n ░███████ @\\n ░███░░░█ @\\n ░███ ░ @\\n █████ @\\n░░░░░ @\\n @\\n @\\n @@\\n █████████ @\\n ███░░░░░███@\\n ███ ░░░ @\\n░███ @\\n░███ █████@\\n░░███ ░░███ @\\n ░░█████████ @\\n ░░░░░░░░░ @\\n @\\n @\\n @@\\n █████ █████@\\n░░███ ░░███ @\\n ░███ ░███ @\\n ░███████████ @\\n ░███░░░░░███ @\\n ░███ ░███ @\\n █████ █████@\\n░░░░░ ░░░░░ @\\n @\\n @\\n @@\\n █████@\\n░░███ @\\n ░███ @\\n ░███ @\\n ░███ @\\n ░███ @\\n █████@\\n░░░░░ @\\n @\\n @\\n @@\\n █████@\\n ░░███ @\\n ░███ @\\n ░███ @\\n ░███ @\\n ███ ░███ @\\n░░████████ @\\n ░░░░░░░░ @\\n @\\n @\\n @@\\n █████ ████@\\n░░███ ███░ @\\n ░███ ███ @\\n ░███████ @\\n ░███░░███ @\\n ░███ ░░███ @\\n █████ ░░████@\\n░░░░░ ░░░░ @\\n @\\n @\\n @@\\n █████ @\\n░░███ @\\n ░███ @\\n ░███ @\\n ░███ @\\n ░███ █@\\n ███████████@\\n░░░░░░░░░░░ @\\n @\\n @\\n @@\\n ██████ ██████@\\n░░██████ ██████ @\\n ░███░█████░███ @\\n ░███░░███ ░███ @\\n ░███ ░░░ ░███ @\\n ░███ ░███ @\\n █████ █████@\\n░░░░░ ░░░░░ @\\n @\\n @\\n @@\\n ██████ █████@\\n░░██████ ░░███ @\\n ░███░███ ░███ @\\n ░███░░███░███ @\\n ░███ ░░██████ @\\n ░███ ░░█████ @\\n █████ ░░█████@\\n░░░░░ ░░░░░ @\\n @\\n @\\n @@\\n ███████ @\\n ███░░░░░███ @\\n ███ ░░███@\\n░███ ░███@\\n░███ ░███@\\n░░███ ███ @\\n ░░░███████░ @\\n ░░░░░░░ @\\n @\\n @\\n @@\\n ███████████ @\\n░░███░░░░░███@\\n ░███ ░███@\\n ░██████████ @\\n ░███░░░░░░ @\\n ░███ @\\n █████ @\\n░░░░░ @\\n @\\n @\\n @@\\n ██████ @\\n ███░░░░███ @\\n ███ ░░███@\\n░███ ░███@\\n░███ ██░███@\\n░░███ ░░████ @\\n ░░░██████░██@\\n ░░░░░░ ░░ @\\n @\\n @\\n @@\\n ███████████ @\\n░░███░░░░░███ @\\n ░███ ░███ @\\n ░██████████ @\\n ░███░░░░░███ @\\n ░███ ░███ @\\n █████ █████@\\n░░░░░ ░░░░░ @\\n @\\n @\\n @@\\n █████████ @\\n ███░░░░░███@\\n░███ ░░░ @\\n░░█████████ @\\n ░░░░░░░░███@\\n ███ ░███@\\n░░█████████ @\\n ░░░░░░░░░ @\\n @\\n @\\n @@\\n ███████████@\\n░█░░░███░░░█@\\n░ ░███ ░ @\\n ░███ @\\n ░███ @\\n ░███ @\\n █████ @\\n ░░░░░ @\\n @\\n @\\n @@\\n █████ █████@\\n░░███ ░░███ @\\n ░███ ░███ @\\n ░███ ░███ @\\n ░███ ░███ @\\n ░███ ░███ @\\n ░░████████ @\\n ░░░░░░░░ @\\n @\\n @\\n @@\\n █████ █████@\\n░░███ ░░███ @\\n ░███ ░███ @\\n ░███ ░███ @\\n ░░███ ███ @\\n ░░░█████░ @\\n ░░███ @\\n ░░░ @\\n @\\n @\\n @@\\n █████ ███ █████@\\n░░███ ░███ ░░███ @\\n ░███ ░███ ░███ @\\n ░███ ░███ ░███ @\\n ░░███ █████ ███ @\\n ░░░█████░█████░ @\\n ░░███ ░░███ @\\n ░░░ ░░░ @\\n @\\n @\\n @@\\n █████ █████@\\n░░███ ░░███ @\\n ░░███ ███ @\\n ░░█████ @\\n ███░███ @\\n ███ ░░███ @\\n █████ █████@\\n░░░░░ ░░░░░ @\\n @\\n @\\n @@\\n █████ █████@\\n░░███ ░░███ @\\n ░░███ ███ @\\n ░░█████ @\\n ░░███ @\\n ░███ @\\n █████ @\\n ░░░░░ @\\n @\\n @\\n @@\\n ███████████@\\n░█░░░░░░███ @\\n░ ███░ @\\n ███ @\\n ███ @\\n ████ █@\\n ███████████@\\n░░░░░░░░░░░ @\\n @\\n @\\n @@\\n █████@\\n░███░ @\\n░███ @\\n░███ @\\n░███ @\\n░███ @\\n░█████@\\n░░░░░ @\\n @\\n @\\n @@\\n ███ @\\n░░███ @\\n ░░███ @\\n ░░███ @\\n ░░███ @\\n ░░███ @\\n ░░███@\\n ░░░ @\\n @\\n @\\n @@\\n █████@\\n░░░███@\\n ░███@\\n ░███@\\n ░███@\\n ░███@\\n █████@\\n░░░░░ @\\n @\\n @\\n @@\\n ██ @\\n ████ @\\n ██░░██@\\n░░ ░░ @\\n @\\n @\\n @\\n @\\n @\\n @\\n @@\\n @\\n @\\n @\\n @\\n @\\n @\\n █████████@\\n░░░░░░░░░ @\\n @\\n @\\n @@\\n ██ @\\n░███@\\n░░░ @\\n @\\n @\\n @\\n @\\n @\\n @\\n @\\n @@\\n @\\n @\\n ██████ @\\n ░░░░░███ @\\n ███████ @\\n ███░░███ @\\n░░████████@\\n ░░░░░░░░ @\\n @\\n @\\n @@\\n █████ @\\n░░███ @\\n ░███████ @\\n ░███░░███@\\n ░███ ░███@\\n ░███ ░███@\\n ████████ @\\n░░░░░░░░ @\\n @\\n @\\n @@\\n @\\n @\\n ██████ @\\n ███░░███@\\n░███ ░░░ @\\n░███ ███@\\n░░██████ @\\n ░░░░░░ @\\n @\\n @\\n @@\\n █████@\\n ░░███ @\\n ███████ @\\n ███░░███ @\\n░███ ░███ @\\n░███ ░███ @\\n░░████████@\\n ░░░░░░░░ @\\n @\\n @\\n @@\\n @\\n @\\n ██████ @\\n ███░░███@\\n░███████ @\\n░███░░░ @\\n░░██████ @\\n ░░░░░░ @\\n @\\n @\\n @@\\n ██████ @\\n ███░░███@\\n ░███ ░░░ @\\n ███████ @\\n░░░███░ @\\n ░███ @\\n █████ @\\n ░░░░░ @\\n @\\n @\\n @@\\n @\\n @\\n ███████@\\n ███░░███@\\n░███ ░███@\\n░███ ░███@\\n░░███████@\\n ░░░░░███@\\n ███ ░███@\\n░░██████ @\\n ░░░░░░ @@\\n █████ @\\n░░███ @\\n ░███████ @\\n ░███░░███ @\\n ░███ ░███ @\\n ░███ ░███ @\\n ████ █████@\\n░░░░ ░░░░░ @\\n @\\n @\\n @@\\n ███ @\\n ░░░ @\\n ████ @\\n░░███ @\\n ░███ @\\n ░███ @\\n █████@\\n░░░░░ @\\n @\\n @\\n @@\\n ███ @\\n ░░░ @\\n █████@\\n ░░███ @\\n ░███ @\\n ░███ @\\n ░███ @\\n ░███ @\\n ███ ░███ @\\n░░██████ @\\n ░░░░░░ @@\\n █████ @\\n░░███ @\\n ░███ █████@\\n ░███░░███ @\\n ░██████░ @\\n ░███░░███ @\\n ████ █████@\\n░░░░ ░░░░░ @\\n @\\n @\\n @@\\n ████ @\\n░░███ @\\n ░███ @\\n ░███ @\\n ░███ @\\n ░███ @\\n █████@\\n░░░░░ @\\n @\\n @\\n @@\\n @\\n @\\n █████████████ @\\n░░███░░███░░███ @\\n ░███ ░███ ░███ @\\n ░███ ░███ ░███ @\\n █████░███ █████@\\n░░░░░ ░░░ ░░░░░ @\\n @\\n @\\n @@\\n @\\n @\\n ████████ @\\n░░███░░███ @\\n ░███ ░███ @\\n ░███ ░███ @\\n ████ █████@\\n░░░░ ░░░░░ @\\n @\\n @\\n @@\\n @\\n @\\n ██████ @\\n ███░░███@\\n░███ ░███@\\n░███ ░███@\\n░░██████ @\\n ░░░░░░ @\\n @\\n @\\n @@\\n @\\n @\\n ████████ @\\n░░███░░███@\\n ░███ ░███@\\n ░███ ░███@\\n ░███████ @\\n ░███░░░ @\\n ░███ @\\n █████ @\\n░░░░░ @@\\n @\\n @\\n ████████@\\n ███░░███ @\\n░███ ░███ @\\n░███ ░███ @\\n░░███████ @\\n ░░░░░███ @\\n ░███ @\\n █████@\\n ░░░░░ @@\\n @\\n @\\n ████████ @\\n░░███░░███@\\n ░███ ░░░ @\\n ░███ @\\n █████ @\\n░░░░░ @\\n @\\n @\\n @@\\n @\\n @\\n █████ @\\n ███░░ @\\n░░█████ @\\n ░░░░███@\\n ██████ @\\n░░░░░░ @\\n @\\n @\\n @@\\n █████ @\\n ░░███ @\\n ███████ @\\n░░░███░ @\\n ░███ @\\n ░███ ███@\\n ░░█████ @\\n ░░░░░ @\\n @\\n @\\n @@\\n @\\n @\\n █████ ████@\\n░░███ ░███ @\\n ░███ ░███ @\\n ░███ ░███ @\\n ░░████████@\\n ░░░░░░░░ @\\n @\\n @\\n @@\\n @\\n @\\n █████ █████@\\n░░███ ░░███ @\\n ░███ ░███ @\\n ░░███ ███ @\\n ░░█████ @\\n ░░░░░ @\\n @\\n @\\n @@\\n @\\n @\\n █████ ███ █████@\\n░░███ ░███░░███ @\\n ░███ ░███ ░███ @\\n ░░███████████ @\\n ░░████░████ @\\n ░░░░ ░░░░ @\\n @\\n @\\n @@\\n @\\n @\\n █████ █████@\\n░░███ ░░███ @\\n ░░░█████░ @\\n ███░░░███ @\\n █████ █████@\\n░░░░░ ░░░░░ @\\n @\\n @\\n @@\\n @\\n @\\n █████ ████@\\n░░███ ░███ @\\n ░███ ░███ @\\n ░███ ░███ @\\n ░░███████ @\\n ░░░░░███ @\\n ███ ░███ @\\n ░░██████ @\\n ░░░░░░ @@\\n @\\n @\\n █████████@\\n ░█░░░░███ @\\n ░ ███░ @\\n ███░ █@\\n █████████@\\n ░░░░░░░░░ @\\n @\\n @\\n @@\\n ███@\\n ██░ @\\n ██ @\\n ███ @\\n░░░██ @\\n ░░██ @\\n ░░███@\\n ░░░ @\\n @\\n @\\n @@\\n ███@\\n░███@\\n░███@\\n░███@\\n░███@\\n░███@\\n░███@\\n░░░ @\\n @\\n @\\n @@\\n ███ @\\n░░░██ @\\n ░░██ @\\n ░░███@\\n ██░ @\\n ██ @\\n ███ @\\n░░░ @\\n @\\n @\\n @@\\n @\\n ███ ███@\\n ███░███░ @\\n░░░ ░░░ @\\n @\\n @\\n @\\n @\\n @\\n @\\n @@\\n ███ ███ @\\n ░░░ ░░░ @\\n ███████ @\\n ███░░░███ @\\n ░█████████ @\\n ░███░░░███ @\\n █████ █████@\\n░░░░░ ░░░░░ @\\n @\\n @\\n @@\\n ███ ███ @\\n░░░ ░░░ @\\n ███████ @\\n ███░░░███@\\n░███ ░███@\\n░███ ░███@\\n░░███████ @\\n ░░░░░░░ @\\n @\\n @\\n @@\\n ███ ███ @\\n ░░░ ░░░ @\\n █████ █████@\\n░░███ ░░███ @\\n ░███ ░███ @\\n ░███ ░███ @\\n ░░███████ @\\n ░░░░░░░ @\\n @\\n @\\n @@\\n ███ ███ @\\n░░░ ░░░ @\\n ██████ @\\n ░░░░░███ @\\n ███████ @\\n ███░░███ @\\n░░████████@\\n ░░░░░░░░ @\\n @\\n @\\n @@\\n ███ ███ @\\n░░░ ░░░ @\\n ███████ @\\n ███░░░███@\\n░███ ░███@\\n░███ ░███@\\n░░███████ @\\n ░░░░░░░ @\\n @\\n @\\n @@\\n ███ ███ @\\n ░░░ ░░░ @\\n █████ █████@\\n░░███ ░░███ @\\n ░███ ░███ @\\n ░███ ░███ @\\n ░░█████████@\\n ░░░░░░░░░ @\\n @\\n @\\n @@\\n █████████ @\\n ███░░░░░███@\\n ░███ ░███@\\n ░██████████ @\\n ░███░░░░░███@\\n ░███ ░███@\\n ████ ██████ @\\n░░░░ ░░░░░░ @\\n @\\n @\\n @@\\n\"\n\n","import { dosrebelFont } from \"./fonts/dosrebel-data\"\n\nexport { dosrebelFont }\n\nexport const asciiFonts = {\n dosrebel: dosrebelFont,\n} as const\n\nexport type AsciiFontName = keyof typeof asciiFonts\n\nexport function getAsciiFont(name: AsciiFontName): string {\n return asciiFonts[name]\n}\n","export interface FigletFont {\n height: number\n baseline: number\n hardblank: string\n chars: Map<number, string[]>\n}\n\nexport function parseFigletFont(raw: string): FigletFont {\n const lines = raw.split(\"\\n\")\n\n if (lines[0]?.charCodeAt(0) === 0xfeff) {\n lines[0] = lines[0].slice(1)\n }\n\n const header = lines[0]\n if (!header?.startsWith(\"flf2a\")) {\n throw new Error(\"Invalid FIGlet font: missing flf2a header\")\n }\n\n const hardblank = header[5] ?? \"$\"\n const parts = header.slice(6).trim().split(/\\s+/)\n const height = Number.parseInt(parts[0] ?? \"\", 10)\n const baseline = Number.parseInt(parts[1] ?? \"\", 10)\n const commentLines = Number.parseInt(parts[4] ?? \"\", 10)\n\n if (!Number.isFinite(height) || height <= 0) {\n throw new Error(\"Invalid FIGlet font: missing character height\")\n }\n\n const dataStart = 1 + (Number.isFinite(commentLines) ? commentLines : 0)\n const chars = new Map<number, string[]>()\n let lineIndex = dataStart\n let ascii = 32\n\n while (lineIndex + height <= lines.length && ascii <= 126) {\n const charLines: string[] = []\n for (let row = 0; row < height; row++) {\n const line = (lines[lineIndex + row] ?? \"\")\n .replace(/@+$/, \"\")\n .replaceAll(hardblank, \" \")\n charLines.push(line)\n }\n\n chars.set(ascii, charLines)\n lineIndex += height\n ascii++\n }\n\n return { height, baseline, hardblank, chars }\n}\n","import { composeAsciiText } from \"./ascii/compose\"\nimport { dosrebelFont } from \"./ascii/fonts\"\nimport { parseFigletFont } from \"./ascii/figlet\"\n\nlet renderCache = new Map<string, string[]>()\n\nexport async function renderDosRebel(text: string): Promise<string[]> {\n const cached = renderCache.get(text)\n if (cached) return cached\n\n const font = parseFigletFont(dosrebelFont)\n const layout = composeAsciiText(font, text)\n const output = Array.from({ length: layout.rows }, () => \"\")\n const cellByPosition = new Map(layout.cells.map((cell) => [`${cell.row}:${cell.col}`, cell.ch]))\n\n for (let row = 0; row < layout.rows; row++) {\n let line = \"\"\n for (let col = 0; col < layout.cols; col++) {\n line += cellByPosition.get(`${row}:${col}`) ?? \" \"\n }\n output[row] = line.replace(/\\s+$/g, \"\")\n }\n\n renderCache.set(text, output)\n return output\n}\n","const RESET = \"\\x1b[0m\"\nconst DEFAULT_HEX = \"#22D3EE\"\nconst WHITE_HEX = \"#ffffff\"\nconst shownBannerKeys = new Set<string>()\n\nexport type BannerSegment = {\n text: string\n colorHex?: string\n}\n\ntype BannerOptions = {\n segments: BannerSegment[]\n compactSegments?: BannerSegment[]\n rowColors?: string[]\n rowShadeColor?: string\n}\n\ntype LegacyBannerOptions = {\n baseText: string\n suffix?: string\n colorHex?: string\n baseColorHex?: string\n}\n\ntype DevPlugin = {\n name: string\n apply: \"serve\"\n configureServer: (server: unknown) => void\n}\n\n\nexport function hexToAnsi24(hex: string) {\n const normalized = hex.trim().replace(/^#/, \"\")\n if (!/^[0-9a-fA-F]{6}$/.test(normalized)) {\n return null\n }\n const r = parseInt(normalized.slice(0, 2), 16)\n const g = parseInt(normalized.slice(2, 4), 16)\n const b = parseInt(normalized.slice(4, 6), 16)\n return `\\x1b[38;2;${r};${g};${b}m`\n}\n\nfunction visibleLen(value: string) {\n return value.length\n}\n\nfunction normalizeSegments(\n input: string | BannerOptions | LegacyBannerOptions\n): { segments: BannerSegment[]; compactSegments?: BannerSegment[]; rowColors?: string[]; rowShadeColor?: string } {\n if (typeof input === \"string\") {\n return { segments: [{ text: input, colorHex: WHITE_HEX }] }\n }\n\n if (\"segments\" in input) {\n const normalize = (segments: BannerSegment[]) =>\n segments\n .filter((segment) => segment.text.trim().length > 0)\n .map((segment) => ({\n text: segment.text,\n colorHex: segment.colorHex ?? WHITE_HEX,\n }))\n const segments = normalize(input.segments)\n const compactSegments =\n input.compactSegments && input.compactSegments.length > 0\n ? normalize(input.compactSegments)\n : undefined\n return { segments, compactSegments, rowColors: input.rowColors, rowShadeColor: input.rowShadeColor }\n }\n\n const suffix = input.suffix ?? \"\"\n if (!suffix) {\n return {\n segments: [{ text: input.baseText, colorHex: input.colorHex ?? DEFAULT_HEX }],\n }\n }\n\n return {\n segments: [\n { text: input.baseText, colorHex: input.baseColorHex ?? WHITE_HEX },\n { text: suffix, colorHex: input.colorHex ?? DEFAULT_HEX },\n ],\n }\n}\n\nasync function renderSegmentedFiglet(segments: BannerSegment[]) {\n const { renderDosRebel } = await import(\"./dos-rebel-font\")\n const cumulativeTexts: string[] = []\n let textSoFar = \"\"\n for (const segment of segments) {\n textSoFar += segment.text\n cumulativeTexts.push(textSoFar)\n }\n\n const renderedByBoundary = await Promise.all(\n cumulativeTexts.map((text) => renderDosRebel(text))\n )\n const lines = renderedByBoundary[renderedByBoundary.length - 1] ?? []\n const boundaryLines = renderedByBoundary.slice(0, -1)\n const ansiBySegment = segments.map(\n (segment) => hexToAnsi24(segment.colorHex ?? WHITE_HEX) ?? \"\\x1b[97m\"\n )\n const widestLine = lines.reduce((max, line) => Math.max(max, visibleLen(line)), 0)\n\n return { lines, boundaryLines, ansiBySegment, widestLine }\n}\n\nfunction printRowColoredFiglet(lines: string[], rowColors: string[], rowShadeColor?: string) {\n for (let i = 0; i < lines.length; i++) {\n const hex = rowColors[i % rowColors.length] ?? WHITE_HEX\n const fgAnsi = hexToAnsi24(hex) ?? \"\\x1b[97m\"\n const shadeAnsi = rowShadeColor ? (hexToAnsi24(rowShadeColor) ?? fgAnsi) : fgAnsi\n const line = lines[i] ?? \"\"\n let out = \"\"\n for (const char of line) {\n if (char === \" \") {\n out += `${RESET} `\n } else if (char === \"░\") {\n out += `${shadeAnsi}${char}`\n } else {\n out += `${fgAnsi}${char}`\n }\n }\n process.stdout.write(`${out}${RESET}\\n`)\n }\n}\n\nfunction printColoredFiglet(\n lines: string[],\n boundaryLines: string[][],\n ansiBySegment: string[]\n) {\n for (let i = 0; i < lines.length; i++) {\n const full = lines[i] ?? \"\"\n let cursor = 0\n let out = \"\"\n\n for (let segmentIndex = 0; segmentIndex < ansiBySegment.length; segmentIndex += 1) {\n const boundaryLine =\n segmentIndex < boundaryLines.length ? boundaryLines[segmentIndex]?.[i] ?? \"\" : full\n const end = Math.min(boundaryLine.length, full.length)\n const chunk = full.slice(cursor, end)\n out += `${ansiBySegment[segmentIndex]}${chunk}`\n cursor = end\n }\n\n process.stdout.write(`${out}${RESET}\\n`)\n }\n}\n\nexport async function printBanner(input: string | BannerSegment[] | BannerOptions) {\n const normalized = Array.isArray(input)\n ? { segments: input, compactSegments: undefined, rowColors: undefined }\n : normalizeSegments(input)\n const segments = normalized.segments\n const compactSegments = normalized.compactSegments\n const rowColors = normalized.rowColors\n const rowShadeColor = normalized.rowShadeColor\n if (!segments.length) return\n\n process.stdout.write(`${RESET}\\n`)\n const terminalColumns = process.stdout.columns ?? 0\n const primary = await renderSegmentedFiglet(segments)\n\n if (terminalColumns === 0 || primary.widestLine <= terminalColumns) {\n if (rowColors && rowColors.length > 0) {\n printRowColoredFiglet(primary.lines, rowColors, rowShadeColor)\n } else {\n printColoredFiglet(primary.lines, primary.boundaryLines, primary.ansiBySegment)\n }\n return\n }\n\n if (compactSegments && compactSegments.length > 0) {\n const compactFiglet = await renderSegmentedFiglet(compactSegments)\n if (compactFiglet.widestLine <= terminalColumns) {\n printColoredFiglet(\n compactFiglet.lines,\n compactFiglet.boundaryLines,\n compactFiglet.ansiBySegment\n )\n return\n }\n }\n\n let plain = \"\"\n for (let i = 0; i < segments.length; i++) {\n const text = segments[i]?.text ?? \"\"\n if (!text) continue\n plain += `${primary.ansiBySegment[i]}${text}`\n }\n process.stdout.write(`${plain}${RESET}\\n`)\n}\n\nexport function createTsupBannerHook(\n project: string | BannerOptions | LegacyBannerOptions\n): () => Promise<void> {\n let shown = false\n const normalized = normalizeSegments(project)\n const bannerKey = JSON.stringify(normalized)\n return async () => {\n if (shown) return\n if (shownBannerKeys.has(bannerKey)) return\n shown = true\n shownBannerKeys.add(bannerKey)\n await printBanner(normalized)\n }\n}\n\nexport function createDevBannerPlugin(\n project: string | BannerOptions | LegacyBannerOptions\n): DevPlugin {\n let shown = false\n const { segments, compactSegments, rowColors, rowShadeColor } = normalizeSegments(project)\n const bannerText = segments.map((segment) => segment.text).join(\"\")\n return {\n name: `olwiba-dev-banner-${bannerText.toLowerCase()}`,\n apply: \"serve\",\n configureServer(_server: unknown) {\n if (shown) return\n shown = true\n void printBanner({ segments, compactSegments, rowColors, rowShadeColor })\n },\n }\n}\n","import { createServer } from \"node:net\"\n\n/**\n * Probe for the first free port from `start` up. Vite's own auto-increment\n * doesn't kick in reliably under the TanStack Start plugin, so dev servers\n * resolve the port themselves before passing it to `server.port`.\n */\n/** True when `port` can be bound right now. */\nasync function isFree(port: number): Promise<boolean> {\n return new Promise<boolean>((resolve) => {\n const probe = createServer()\n .once(\"error\", () => resolve(false))\n .once(\"listening\", () => probe.close(() => resolve(true)))\n probe.listen(port)\n })\n}\n\nexport async function findFreePort(start: number, attempts = 20): Promise<number> {\n for (let port = start; port < start + attempts; port++) {\n if (await isFree(port)) return port\n }\n throw new Error(`No free port found in range ${start}-${start + attempts - 1}`)\n}\n\n/**\n * Resolve the dev server port, or fail.\n *\n * Deliberately does **not** fall back to the next free port. Silently moving to\n * 3001 looks like it worked and then breaks something unrelated several minutes\n * later: `BETTER_AUTH_TRUSTED_ORIGINS` pins an origin, so the app boots fine and\n * every sign-in fails with \"Invalid origin\" — a message that points at auth\n * config rather than at the port that actually moved.\n *\n * Running a second app at the same time is still supported, but has to be said\n * out loud: `PORT=3001 bun run dev`.\n */\nexport async function resolveDevPort(preferred: number): Promise<number> {\n if (await isFree(preferred)) return preferred\n\n throw new Error(\n `Port ${preferred} is already in use.\\n\\n` +\n ` Free it, or start this app on another port explicitly:\\n` +\n ` PORT=${preferred + 1} bun run dev\\n\\n` +\n ` If you pick another port, add its origin to BETTER_AUTH_TRUSTED_ORIGINS\\n` +\n ` or sign-in will fail with \"Invalid origin\".`,\n )\n}\n","import {\n createDevBannerPlugin,\n createTsupBannerHook,\n type BannerSegment,\n} from \"./dev-banner\"\n\nexport type ProjectBrandAccent = {\n hex: string\n lightOklch?: string\n darkOklch?: string\n}\n\nexport type ProjectBannerSegment = {\n text: string\n accent?: boolean\n colorHex?: string\n}\n\nexport type ProjectConfig = {\n id: string\n label: string\n brandAccent: ProjectBrandAccent\n banner: {\n segments: readonly ProjectBannerSegment[]\n compactSegments?: readonly ProjectBannerSegment[]\n }\n}\n\nfunction resolveProjectBannerSegments(\n segments: readonly ProjectBannerSegment[],\n accentHex: string\n): BannerSegment[] {\n return segments.map((segment) => ({\n text: segment.text,\n colorHex: segment.accent ? accentHex : segment.colorHex,\n }))\n}\n\nfunction getProjectBanner(project: ProjectConfig) {\n return {\n segments: resolveProjectBannerSegments(project.banner.segments, project.brandAccent.hex),\n compactSegments: project.banner.compactSegments\n ? resolveProjectBannerSegments(project.banner.compactSegments, project.brandAccent.hex)\n : undefined,\n }\n}\n\nexport function createProjectDevBannerPlugin(project: ProjectConfig) {\n return createDevBannerPlugin(getProjectBanner(project))\n}\n\nexport function createProjectTsupBannerHook(project: ProjectConfig) {\n return createTsupBannerHook(getProjectBanner(project))\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/ascii/compose.ts","../src/ascii/fonts/dosrebel-data.ts","../src/ascii/fonts.ts","../src/ascii/figlet.ts","../src/dos-rebel-font.ts","../src/dev-banner.ts","../src/find-free-port.ts","../src/project-brand.ts"],"names":["segments","renderDosRebel"],"mappings":";;;;;;;;;;;;;AAcO,SAAS,gBAAA,CAAiB,MAAkB,IAAA,EAA+B;AAChF,EAAA,MAAM,aAAwD,EAAC;AAE/D,EAAA,KAAA,MAAW,MAAM,IAAA,EAAM;AACrB,IAAA,MAAM,IAAA,GAAO,EAAA,CAAG,UAAA,CAAW,CAAC,CAAA;AAC5B,IAAA,MAAM,KAAA,GAAQ,KAAK,KAAA,CAAM,GAAA,CAAI,IAAI,CAAA,IAAK,IAAA,CAAK,KAAA,CAAM,GAAA,CAAI,EAAE,CAAA;AACvD,I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AA,EACiB;AACjB,EAAA,OAAO,QAAA,CAAS,GAAA,CAAI,CAAC,OAAA,MAAa;AAAA,IAChC,MAAM,OAAA,CAAQ,IAAA;AAAA,IACd,QAAA,EAAU,OAAA,CAAQ,MAAA,GAAS,SAAA,GAAY,OAAA,CAAQ;AAAA,GACjD,CAAE,CAAA;AACJ;AAEA,SAAS,iBAAiB,OAAA,EAAwB;AAChD,EAAA,OAAO;AAAA,IACL,UAAU,4BAAA,CAA6B,OAAA,CAAQ,OAAO,QAAA,EAAU,OAAA,CAAQ,YAAY,GAAG,CAAA;AAAA,IACvF,eAAA,EAAiB,OAAA,CAAQ,MAAA,CAAO,eAAA,GAC5B,4BAAA,CAA6B,OAAA,CAAQ,MAAA,CAAO,eAAA,EAAiB,OAAA,CAAQ,WAAA,CAAY,GAAG,CAAA,GACpF;AAAA,GACN;AACF;AAEO,SAAS,6BAA6B,OAAA,EAAwB;AACnE,EAAA,OAAO,qBAAA,CAAsB,gBAAA,CAAiB,OAAO,CAAC,CAAA;AACxD;AAEO,SAAS,4BAA4B,OAAA,EAAwB;AAClE,EAAA,OAAO,oBAAA,CAAqB,gBAAA,CAAiB,OAAO,CAAC,CAAA;AACvD","file":"index.js","sourcesContent":["import type { FigletFont } from \"./figlet\"\n\nexport interface AsciiCell {\n ch: \"█\" | \"░\"\n col: number\n row: number\n}\n\nexport interface AsciiTextLayout {\n cells: AsciiCell[]\n cols: number\n rows: number\n}\n\nexport function composeAsciiText(font: FigletFont, text: string): AsciiTextLayout {\n const charBlocks: Array<{ lines: string[]; width: number }> = []\n\n for (const ch of text) {\n const code = ch.charCodeAt(0)\n const glyph = font.chars.get(code) ?? font.chars.get(32)\n if (!glyph) continue\n\n const width = Math.max(...glyph.map((line) => line.length))\n charBlocks.push({\n lines: glyph.map((line) => line.padEnd(width)),\n width,\n })\n }\n\n const cols = charBlocks.reduce((sum, block) => sum + block.width, 0)\n const rows = font.height\n const cells: AsciiCell[] = []\n let offsetX = 0\n\n for (const block of charBlocks) {\n for (let row = 0; row < rows; row++) {\n const line = block.lines[row] ?? \"\"\n for (let col = 0; col < line.length; col++) {\n const ch = line[col]\n if (ch === \"█\" || ch === \"░\") {\n cells.push({ ch, col: offsetX + col, row })\n }\n }\n }\n offsetX += block.width\n }\n\n return { cells, cols, rows }\n}\n\nexport function getAsciiAccentColumns(\n font: FigletFont,\n text: string,\n accent: string,\n): Set<number> {\n if (!accent) return new Set<number>()\n\n const columns = new Set<number>()\n const accentRanges: Array<{ start: number; end: number }> = []\n let searchFrom = 0\n while (true) {\n const idx = text.indexOf(accent, searchFrom)\n if (idx === -1) break\n accentRanges.push({ start: idx, end: idx + accent.length })\n searchFrom = idx + 1\n }\n if (accentRanges.length === 0) return columns\n\n let offsetX = 0\n let charIndex = 0\n\n for (const ch of text) {\n const code = ch.charCodeAt(0)\n const glyph = font.chars.get(code) ?? font.chars.get(32)\n if (!glyph) { charIndex++; continue }\n\n const width = Math.max(...glyph.map((line) => line.length))\n if (accentRanges.some((r) => charIndex >= r.start && charIndex < r.end)) {\n for (let col = 0; col < width; col++) columns.add(offsetX + col)\n }\n offsetX += width\n charIndex++\n }\n\n return columns\n}\n","// @generated from dosrebel.flf. Do not edit by hand.\nexport const dosrebelFont: string = \"flf2a$ 11 8 35 -1 15\\nRebel by Valerie Mates (popcorn@cyberspace.org), based on a font by Ron Bliss\\n(who sometimes goes by the name \\\"rebel\\\" because his initials are REB).\\nNOTE: THIS FONT ONLY WORKS IN MS-DOS.\\nMay 27, 1994\\n\\nExplanation of first line:\\nflf2 - \\\"magic number\\\" for file identification\\na - should always be `a', for now\\n$ - the \\\"hardblank\\\" -- prints as a blank, but can't be smushed\\n11 - height of a character\\n8 - height of a character, not including descenders\\n35 - max line length (excluding comment lines) + a fudge factor\\n-1 - default smushmode for this font (like \\\"-m 15\\\" on command line)\\n15 - number of comment lines\\n\\n$$$@\\n$$$@\\n$$$@\\n$$$@\\n$$$@\\n$$$@\\n$$$@\\n$$$@\\n$$$@\\n$$$@\\n$$$@@\\n ███@\\n░███@\\n░███@\\n░███@\\n░███@\\n░░░ @\\n ███@\\n░░░ @\\n @\\n @\\n @@\\n ██ ██@\\n░██░██@\\n░░ ░░ @\\n @\\n @\\n @\\n @\\n @\\n @\\n @\\n @@\\n ███ ███ @\\n ████████████@\\n░░░███░░███░ @\\n ████████████@\\n░░░███░░███░ @\\n ░░░ ░░░ @\\n @\\n @\\n @\\n @\\n @@\\n ███ @\\n ██████ @\\n ███░░░ @\\n ░░█████ @\\n ░░░░███ @\\n ██████ @\\n ░░░███ @\\n ░░░ @\\n @\\n @\\n @@\\n ███ ███@\\n ░░░ ███░ @\\n ███░ @\\n ███░ @\\n ███░ @\\n ███░ @\\n ███░ ███ @\\n░░░ ░░░ @\\n @\\n @\\n @@\\n ██████ @\\n ███░░███ @\\n ░░██████ @\\n ██████ @\\n░███░░███ @\\n░███ ░░███ @\\n░░█████░███@\\n ░░░░░ ░░░ @\\n @\\n @\\n @@\\n ██@\\n ███@\\n░░░ @\\n @\\n @\\n @\\n @\\n @\\n @\\n @\\n @@\\n ███@\\n ███ @\\n ███ @\\n░███ @\\n░███ @\\n░░███ @\\n ░░███@\\n ░░░ @\\n @\\n @\\n @@\\n ███ @\\n░░███ @\\n ░░███@\\n ░███@\\n ░███@\\n ███ @\\n ██░ @\\n░░░ @\\n @\\n @\\n @@\\n ███ @\\n ███ ░███ ███@\\n░░░█████████░ @\\n ░░░█████░ @\\n █████████ @\\n ███░░███░░███@\\n░░░ ░███ ░░░ @\\n ░░░ @\\n @\\n @\\n @@\\n @\\n ███ @\\n ░███ @\\n ███████████@\\n░░░░░███░░░ @\\n ░███ @\\n ░░░ @\\n @\\n @\\n @\\n @@\\n @\\n @\\n @\\n @\\n @\\n @\\n ██@\\n ██ @\\n░░ @\\n @\\n @@\\n @\\n @\\n @\\n ██████████@\\n░░░░░░░░░░ @\\n @\\n @\\n @\\n @\\n @\\n @@\\n @\\n @\\n @\\n @\\n @\\n @\\n ██@\\n░░ @\\n @\\n @\\n @@\\n ███@\\n ███░ @\\n ███░ @\\n ███░ @\\n ███░ @\\n ███░ @\\n ███░ @\\n░░░ @\\n @\\n @\\n @@\\n █████ @\\n ███░░░███ @\\n ███ ░░███@\\n░███ ░███@\\n░███ ░███@\\n░░███ ███ @\\n ░░░█████░ @\\n ░░░░░░ @\\n @\\n @\\n @@\\n ████ @\\n░░███ @\\n ░███ @\\n ░███ @\\n ░███ @\\n ░███ @\\n █████@\\n░░░░░ @\\n @\\n @\\n @@\\n ████████ @\\n ███░░░░███@\\n░░░ ░███@\\n ███████ @\\n ███░░░░ @\\n ███ █@\\n░██████████@\\n░░░░░░░░░░ @\\n @\\n @\\n @@\\n ████████ @\\n ███░░░░███@\\n░░░ ░███@\\n ██████░ @\\n ░░░░░░███@\\n ███ ░███@\\n░░████████ @\\n ░░░░░░░░ @\\n @\\n @\\n @@\\n █████ █████ @\\n░░███ ░░███ @\\n ░███ ░███ █@\\n ░███████████@\\n ░░░░░░░███░█@\\n ░███░ @\\n █████ @\\n ░░░░░ @\\n @\\n @\\n @@\\n ██████████@\\n░███░░░░░░█@\\n░███ ░ @\\n░█████████ @\\n░░░░░░░░███@\\n ███ ░███@\\n░░████████ @\\n ░░░░░░░░ @\\n @\\n @\\n @@\\n ████████ @\\n ███░░░░███@\\n░███ ░░░ @\\n░█████████ @\\n░███░░░░███@\\n░███ ░███@\\n░░████████ @\\n ░░░░░░░░ @\\n @\\n @\\n @@\\n ██████████@\\n░███░░░░███@\\n░░░ ███ @\\n ███ @\\n ███ @\\n ███ @\\n ███ @\\n ░░░ @\\n @\\n @\\n @@\\n ████████ @\\n ███░░░░███ @\\n░███ ░███ @\\n░░████████ @\\n ███░░░░███ @\\n░███ ░███ @\\n░░████████ @\\n ░░░░░░░░ @\\n @\\n @\\n @@\\n ████████ @\\n ███░░░░███@\\n░███ ░███@\\n░░█████████@\\n ░░░░░░░███@\\n ███ ░███@\\n░░████████ @\\n ░░░░░░░░ @\\n @\\n @\\n @@\\n @\\n @\\n ██@\\n░░ @\\n @\\n @\\n ██@\\n░░ @\\n @\\n @\\n @@\\n @\\n @\\n @\\n @\\n ██@\\n ░░ @\\n ██@\\n ██ @\\n░░ @\\n @\\n @@\\n ███@\\n ███░ @\\n ███░ @\\n ███░ @\\n░░░███ @\\n ░░░███ @\\n ░░░███@\\n ░░░ @\\n @\\n @\\n @@\\n @\\n @\\n █████████@\\n░░░░░░░░░ @\\n █████████@\\n░░░░░░░░░ @\\n @\\n @\\n @\\n @\\n @@\\n ███ @\\n░░░███ @\\n ░░░███ @\\n ░░░███@\\n ███░ @\\n ███░ @\\n ███░ @\\n░░░ @\\n @\\n @\\n @@\\n ███████ @\\n ███░░░███@\\n░░░ ░███@\\n ███████ @\\n ░███░░░ @\\n ░░░ @\\n ███ @\\n ░░░ @\\n @\\n @\\n @@\\n █████████ @\\n ███░░░░░░ @\\n░███ ██████ @\\n░███░███░███@\\n░███░███░███@\\n░███░░░ ░███@\\n░░█████████ @\\n ░░░░░░░░░ @\\n @\\n @\\n @@\\n █████████ @\\n ███░░░░░███ @\\n ░███ ░███ @\\n ░███████████ @\\n ░███░░░░░███ @\\n ░███ ░███ @\\n █████ █████@\\n░░░░░ ░░░░░ @\\n @\\n @\\n @@\\n ███████████ @\\n░░███░░░░░███@\\n ░███ ░███@\\n ░██████████ @\\n ░███░░░░░███@\\n ░███ ░███@\\n ███████████ @\\n░░░░░░░░░░░ @\\n @\\n @\\n @@\\n █████████ @\\n ███░░░░░███@\\n ███ ░░░ @\\n░███ @\\n░███ @\\n░░███ ███@\\n ░░█████████ @\\n ░░░░░░░░░ @\\n @\\n @\\n @@\\n ██████████ @\\n░░███░░░░███ @\\n ░███ ░░███@\\n ░███ ░███@\\n ░███ ░███@\\n ░███ ███ @\\n ██████████ @\\n░░░░░░░░░░ @\\n @\\n @\\n @@\\n ██████████@\\n░░███░░░░░█@\\n ░███ █ ░ @\\n ░██████ @\\n ░███░░█ @\\n ░███ ░ █@\\n ██████████@\\n░░░░░░░░░░ @\\n @\\n @\\n @@\\n ███████████@\\n░░███░░░░░░█@\\n ░███ █ ░ @\\n ░███████ @\\n ░███░░░█ @\\n ░███ ░ @\\n █████ @\\n░░░░░ @\\n @\\n @\\n @@\\n █████████ @\\n ███░░░░░███@\\n ███ ░░░ @\\n░███ @\\n░███ █████@\\n░░███ ░░███ @\\n ░░█████████ @\\n ░░░░░░░░░ @\\n @\\n @\\n @@\\n █████ █████@\\n░░███ ░░███ @\\n ░███ ░███ @\\n ░███████████ @\\n ░███░░░░░███ @\\n ░███ ░███ @\\n █████ █████@\\n░░░░░ ░░░░░ @\\n @\\n @\\n @@\\n █████@\\n░░███ @\\n ░███ @\\n ░███ @\\n ░███ @\\n ░███ @\\n █████@\\n░░░░░ @\\n @\\n @\\n @@\\n █████@\\n ░░███ @\\n ░███ @\\n ░███ @\\n ░███ @\\n ███ ░███ @\\n░░████████ @\\n ░░░░░░░░ @\\n @\\n @\\n @@\\n █████ ████@\\n░░███ ███░ @\\n ░███ ███ @\\n ░███████ @\\n ░███░░███ @\\n ░███ ░░███ @\\n █████ ░░████@\\n░░░░░ ░░░░ @\\n @\\n @\\n @@\\n █████ @\\n░░███ @\\n ░███ @\\n ░███ @\\n ░███ @\\n ░███ █@\\n ███████████@\\n░░░░░░░░░░░ @\\n @\\n @\\n @@\\n ██████ ██████@\\n░░██████ ██████ @\\n ░███░█████░███ @\\n ░███░░███ ░███ @\\n ░███ ░░░ ░███ @\\n ░███ ░███ @\\n █████ █████@\\n░░░░░ ░░░░░ @\\n @\\n @\\n @@\\n ██████ █████@\\n░░██████ ░░███ @\\n ░███░███ ░███ @\\n ░███░░███░███ @\\n ░███ ░░██████ @\\n ░███ ░░█████ @\\n █████ ░░█████@\\n░░░░░ ░░░░░ @\\n @\\n @\\n @@\\n ███████ @\\n ███░░░░░███ @\\n ███ ░░███@\\n░███ ░███@\\n░███ ░███@\\n░░███ ███ @\\n ░░░███████░ @\\n ░░░░░░░ @\\n @\\n @\\n @@\\n ███████████ @\\n░░███░░░░░███@\\n ░███ ░███@\\n ░██████████ @\\n ░███░░░░░░ @\\n ░███ @\\n █████ @\\n░░░░░ @\\n @\\n @\\n @@\\n ██████ @\\n ███░░░░███ @\\n ███ ░░███@\\n░███ ░███@\\n░███ ██░███@\\n░░███ ░░████ @\\n ░░░██████░██@\\n ░░░░░░ ░░ @\\n @\\n @\\n @@\\n ███████████ @\\n░░███░░░░░███ @\\n ░███ ░███ @\\n ░██████████ @\\n ░███░░░░░███ @\\n ░███ ░███ @\\n █████ █████@\\n░░░░░ ░░░░░ @\\n @\\n @\\n @@\\n █████████ @\\n ███░░░░░███@\\n░███ ░░░ @\\n░░█████████ @\\n ░░░░░░░░███@\\n ███ ░███@\\n░░█████████ @\\n ░░░░░░░░░ @\\n @\\n @\\n @@\\n ███████████@\\n░█░░░███░░░█@\\n░ ░███ ░ @\\n ░███ @\\n ░███ @\\n ░███ @\\n █████ @\\n ░░░░░ @\\n @\\n @\\n @@\\n █████ █████@\\n░░███ ░░███ @\\n ░███ ░███ @\\n ░███ ░███ @\\n ░███ ░███ @\\n ░███ ░███ @\\n ░░████████ @\\n ░░░░░░░░ @\\n @\\n @\\n @@\\n █████ █████@\\n░░███ ░░███ @\\n ░███ ░███ @\\n ░███ ░███ @\\n ░░███ ███ @\\n ░░░█████░ @\\n ░░███ @\\n ░░░ @\\n @\\n @\\n @@\\n █████ ███ █████@\\n░░███ ░███ ░░███ @\\n ░███ ░███ ░███ @\\n ░███ ░███ ░███ @\\n ░░███ █████ ███ @\\n ░░░█████░█████░ @\\n ░░███ ░░███ @\\n ░░░ ░░░ @\\n @\\n @\\n @@\\n █████ █████@\\n░░███ ░░███ @\\n ░░███ ███ @\\n ░░█████ @\\n ███░███ @\\n ███ ░░███ @\\n █████ █████@\\n░░░░░ ░░░░░ @\\n @\\n @\\n @@\\n █████ █████@\\n░░███ ░░███ @\\n ░░███ ███ @\\n ░░█████ @\\n ░░███ @\\n ░███ @\\n █████ @\\n ░░░░░ @\\n @\\n @\\n @@\\n ███████████@\\n░█░░░░░░███ @\\n░ ███░ @\\n ███ @\\n ███ @\\n ████ █@\\n ███████████@\\n░░░░░░░░░░░ @\\n @\\n @\\n @@\\n █████@\\n░███░ @\\n░███ @\\n░███ @\\n░███ @\\n░███ @\\n░█████@\\n░░░░░ @\\n @\\n @\\n @@\\n ███ @\\n░░███ @\\n ░░███ @\\n ░░███ @\\n ░░███ @\\n ░░███ @\\n ░░███@\\n ░░░ @\\n @\\n @\\n @@\\n █████@\\n░░░███@\\n ░███@\\n ░███@\\n ░███@\\n ░███@\\n █████@\\n░░░░░ @\\n @\\n @\\n @@\\n ██ @\\n ████ @\\n ██░░██@\\n░░ ░░ @\\n @\\n @\\n @\\n @\\n @\\n @\\n @@\\n @\\n @\\n @\\n @\\n @\\n @\\n █████████@\\n░░░░░░░░░ @\\n @\\n @\\n @@\\n ██ @\\n░███@\\n░░░ @\\n @\\n @\\n @\\n @\\n @\\n @\\n @\\n @@\\n @\\n @\\n ██████ @\\n ░░░░░███ @\\n ███████ @\\n ███░░███ @\\n░░████████@\\n ░░░░░░░░ @\\n @\\n @\\n @@\\n █████ @\\n░░███ @\\n ░███████ @\\n ░███░░███@\\n ░███ ░███@\\n ░███ ░███@\\n ████████ @\\n░░░░░░░░ @\\n @\\n @\\n @@\\n @\\n @\\n ██████ @\\n ███░░███@\\n░███ ░░░ @\\n░███ ███@\\n░░██████ @\\n ░░░░░░ @\\n @\\n @\\n @@\\n █████@\\n ░░███ @\\n ███████ @\\n ███░░███ @\\n░███ ░███ @\\n░███ ░███ @\\n░░████████@\\n ░░░░░░░░ @\\n @\\n @\\n @@\\n @\\n @\\n ██████ @\\n ███░░███@\\n░███████ @\\n░███░░░ @\\n░░██████ @\\n ░░░░░░ @\\n @\\n @\\n @@\\n ██████ @\\n ███░░███@\\n ░███ ░░░ @\\n ███████ @\\n░░░███░ @\\n ░███ @\\n █████ @\\n ░░░░░ @\\n @\\n @\\n @@\\n @\\n @\\n ███████@\\n ███░░███@\\n░███ ░███@\\n░███ ░███@\\n░░███████@\\n ░░░░░███@\\n ███ ░███@\\n░░██████ @\\n ░░░░░░ @@\\n █████ @\\n░░███ @\\n ░███████ @\\n ░███░░███ @\\n ░███ ░███ @\\n ░███ ░███ @\\n ████ █████@\\n░░░░ ░░░░░ @\\n @\\n @\\n @@\\n ███ @\\n ░░░ @\\n ████ @\\n░░███ @\\n ░███ @\\n ░███ @\\n █████@\\n░░░░░ @\\n @\\n @\\n @@\\n ███ @\\n ░░░ @\\n █████@\\n ░░███ @\\n ░███ @\\n ░███ @\\n ░███ @\\n ░███ @\\n ███ ░███ @\\n░░██████ @\\n ░░░░░░ @@\\n █████ @\\n░░███ @\\n ░███ █████@\\n ░███░░███ @\\n ░██████░ @\\n ░███░░███ @\\n ████ █████@\\n░░░░ ░░░░░ @\\n @\\n @\\n @@\\n ████ @\\n░░███ @\\n ░███ @\\n ░███ @\\n ░███ @\\n ░███ @\\n █████@\\n░░░░░ @\\n @\\n @\\n @@\\n @\\n @\\n █████████████ @\\n░░███░░███░░███ @\\n ░███ ░███ ░███ @\\n ░███ ░███ ░███ @\\n █████░███ █████@\\n░░░░░ ░░░ ░░░░░ @\\n @\\n @\\n @@\\n @\\n @\\n ████████ @\\n░░███░░███ @\\n ░███ ░███ @\\n ░███ ░███ @\\n ████ █████@\\n░░░░ ░░░░░ @\\n @\\n @\\n @@\\n @\\n @\\n ██████ @\\n ███░░███@\\n░███ ░███@\\n░███ ░███@\\n░░██████ @\\n ░░░░░░ @\\n @\\n @\\n @@\\n @\\n @\\n ████████ @\\n░░███░░███@\\n ░███ ░███@\\n ░███ ░███@\\n ░███████ @\\n ░███░░░ @\\n ░███ @\\n █████ @\\n░░░░░ @@\\n @\\n @\\n ████████@\\n ███░░███ @\\n░███ ░███ @\\n░███ ░███ @\\n░░███████ @\\n ░░░░░███ @\\n ░███ @\\n █████@\\n ░░░░░ @@\\n @\\n @\\n ████████ @\\n░░███░░███@\\n ░███ ░░░ @\\n ░███ @\\n █████ @\\n░░░░░ @\\n @\\n @\\n @@\\n @\\n @\\n █████ @\\n ███░░ @\\n░░█████ @\\n ░░░░███@\\n ██████ @\\n░░░░░░ @\\n @\\n @\\n @@\\n █████ @\\n ░░███ @\\n ███████ @\\n░░░███░ @\\n ░███ @\\n ░███ ███@\\n ░░█████ @\\n ░░░░░ @\\n @\\n @\\n @@\\n @\\n @\\n █████ ████@\\n░░███ ░███ @\\n ░███ ░███ @\\n ░███ ░███ @\\n ░░████████@\\n ░░░░░░░░ @\\n @\\n @\\n @@\\n @\\n @\\n █████ █████@\\n░░███ ░░███ @\\n ░███ ░███ @\\n ░░███ ███ @\\n ░░█████ @\\n ░░░░░ @\\n @\\n @\\n @@\\n @\\n @\\n █████ ███ █████@\\n░░███ ░███░░███ @\\n ░███ ░███ ░███ @\\n ░░███████████ @\\n ░░████░████ @\\n ░░░░ ░░░░ @\\n @\\n @\\n @@\\n @\\n @\\n █████ █████@\\n░░███ ░░███ @\\n ░░░█████░ @\\n ███░░░███ @\\n █████ █████@\\n░░░░░ ░░░░░ @\\n @\\n @\\n @@\\n @\\n @\\n █████ ████@\\n░░███ ░███ @\\n ░███ ░███ @\\n ░███ ░███ @\\n ░░███████ @\\n ░░░░░███ @\\n ███ ░███ @\\n ░░██████ @\\n ░░░░░░ @@\\n @\\n @\\n █████████@\\n ░█░░░░███ @\\n ░ ███░ @\\n ███░ █@\\n █████████@\\n ░░░░░░░░░ @\\n @\\n @\\n @@\\n ███@\\n ██░ @\\n ██ @\\n ███ @\\n░░░██ @\\n ░░██ @\\n ░░███@\\n ░░░ @\\n @\\n @\\n @@\\n ███@\\n░███@\\n░███@\\n░███@\\n░███@\\n░███@\\n░███@\\n░░░ @\\n @\\n @\\n @@\\n ███ @\\n░░░██ @\\n ░░██ @\\n ░░███@\\n ██░ @\\n ██ @\\n ███ @\\n░░░ @\\n @\\n @\\n @@\\n @\\n ███ ███@\\n ███░███░ @\\n░░░ ░░░ @\\n @\\n @\\n @\\n @\\n @\\n @\\n @@\\n ███ ███ @\\n ░░░ ░░░ @\\n ███████ @\\n ███░░░███ @\\n ░█████████ @\\n ░███░░░███ @\\n █████ █████@\\n░░░░░ ░░░░░ @\\n @\\n @\\n @@\\n ███ ███ @\\n░░░ ░░░ @\\n ███████ @\\n ███░░░███@\\n░███ ░███@\\n░███ ░███@\\n░░███████ @\\n ░░░░░░░ @\\n @\\n @\\n @@\\n ███ ███ @\\n ░░░ ░░░ @\\n █████ █████@\\n░░███ ░░███ @\\n ░███ ░███ @\\n ░███ ░███ @\\n ░░███████ @\\n ░░░░░░░ @\\n @\\n @\\n @@\\n ███ ███ @\\n░░░ ░░░ @\\n ██████ @\\n ░░░░░███ @\\n ███████ @\\n ███░░███ @\\n░░████████@\\n ░░░░░░░░ @\\n @\\n @\\n @@\\n ███ ███ @\\n░░░ ░░░ @\\n ███████ @\\n ███░░░███@\\n░███ ░███@\\n░███ ░███@\\n░░███████ @\\n ░░░░░░░ @\\n @\\n @\\n @@\\n ███ ███ @\\n ░░░ ░░░ @\\n █████ █████@\\n░░███ ░░███ @\\n ░███ ░███ @\\n ░███ ░███ @\\n ░░█████████@\\n ░░░░░░░░░ @\\n @\\n @\\n @@\\n █████████ @\\n ███░░░░░███@\\n ░███ ░███@\\n ░██████████ @\\n ░███░░░░░███@\\n ░███ ░███@\\n ████ ██████ @\\n░░░░ ░░░░░░ @\\n @\\n @\\n @@\\n\"\n\n","import { dosrebelFont } from \"./fonts/dosrebel-data\"\n\nexport { dosrebelFont }\n\nexport const asciiFonts = {\n dosrebel: dosrebelFont,\n} as const\n\nexport type AsciiFontName = keyof typeof asciiFonts\n\nexport function getAsciiFont(name: AsciiFontName): string {\n return asciiFonts[name]\n}\n","export interface FigletFont {\n height: number\n baseline: number\n hardblank: string\n chars: Map<number, string[]>\n}\n\nexport function parseFigletFont(raw: string): FigletFont {\n const lines = raw.split(\"\\n\")\n\n if (lines[0]?.charCodeAt(0) === 0xfeff) {\n lines[0] = lines[0].slice(1)\n }\n\n const header = lines[0]\n if (!header?.startsWith(\"flf2a\")) {\n throw new Error(\"Invalid FIGlet font: missing flf2a header\")\n }\n\n const hardblank = header[5] ?? \"$\"\n const parts = header.slice(6).trim().split(/\\s+/)\n const height = Number.parseInt(parts[0] ?? \"\", 10)\n const baseline = Number.parseInt(parts[1] ?? \"\", 10)\n const commentLines = Number.parseInt(parts[4] ?? \"\", 10)\n\n if (!Number.isFinite(height) || height <= 0) {\n throw new Error(\"Invalid FIGlet font: missing character height\")\n }\n\n const dataStart = 1 + (Number.isFinite(commentLines) ? commentLines : 0)\n const chars = new Map<number, string[]>()\n let lineIndex = dataStart\n let ascii = 32\n\n while (lineIndex + height <= lines.length && ascii <= 126) {\n const charLines: string[] = []\n for (let row = 0; row < height; row++) {\n const line = (lines[lineIndex + row] ?? \"\")\n .replace(/@+$/, \"\")\n .replaceAll(hardblank, \" \")\n charLines.push(line)\n }\n\n chars.set(ascii, charLines)\n lineIndex += height\n ascii++\n }\n\n return { height, baseline, hardblank, chars }\n}\n","import { composeAsciiText } from \"./ascii/compose\"\nimport { dosrebelFont } from \"./ascii/fonts\"\nimport { parseFigletFont } from \"./ascii/figlet\"\n\nlet renderCache = new Map<string, string[]>()\n\nexport async function renderDosRebel(text: string): Promise<string[]> {\n const cached = renderCache.get(text)\n if (cached) return cached\n\n const font = parseFigletFont(dosrebelFont)\n const layout = composeAsciiText(font, text)\n const output = Array.from({ length: layout.rows }, () => \"\")\n const cellByPosition = new Map(layout.cells.map((cell) => [`${cell.row}:${cell.col}`, cell.ch]))\n\n for (let row = 0; row < layout.rows; row++) {\n let line = \"\"\n for (let col = 0; col < layout.cols; col++) {\n line += cellByPosition.get(`${row}:${col}`) ?? \" \"\n }\n output[row] = line.replace(/\\s+$/g, \"\")\n }\n\n renderCache.set(text, output)\n return output\n}\n","const RESET = \"\\x1b[0m\"\nconst DEFAULT_HEX = \"#22D3EE\"\nconst WHITE_HEX = \"#ffffff\"\nconst shownBannerKeys = new Set<string>()\n\nexport type BannerSegment = {\n text: string\n colorHex?: string\n}\n\ntype BannerOptions = {\n segments: BannerSegment[]\n compactSegments?: BannerSegment[]\n rowColors?: string[]\n rowShadeColor?: string\n}\n\ntype LegacyBannerOptions = {\n baseText: string\n suffix?: string\n colorHex?: string\n baseColorHex?: string\n}\n\ntype DevPlugin = {\n name: string\n apply: \"serve\"\n configureServer: (server: unknown) => void\n}\n\n\nexport function hexToAnsi24(hex: string) {\n const normalized = hex.trim().replace(/^#/, \"\")\n if (!/^[0-9a-fA-F]{6}$/.test(normalized)) {\n return null\n }\n const r = parseInt(normalized.slice(0, 2), 16)\n const g = parseInt(normalized.slice(2, 4), 16)\n const b = parseInt(normalized.slice(4, 6), 16)\n return `\\x1b[38;2;${r};${g};${b}m`\n}\n\nfunction visibleLen(value: string) {\n return value.length\n}\n\nfunction normalizeSegments(\n input: string | BannerOptions | LegacyBannerOptions\n): { segments: BannerSegment[]; compactSegments?: BannerSegment[]; rowColors?: string[]; rowShadeColor?: string } {\n if (typeof input === \"string\") {\n return { segments: [{ text: input, colorHex: WHITE_HEX }] }\n }\n\n if (\"segments\" in input) {\n const normalize = (segments: BannerSegment[]) =>\n segments\n .filter((segment) => segment.text.trim().length > 0)\n .map((segment) => ({\n text: segment.text,\n colorHex: segment.colorHex ?? WHITE_HEX,\n }))\n const segments = normalize(input.segments)\n const compactSegments =\n input.compactSegments && input.compactSegments.length > 0\n ? normalize(input.compactSegments)\n : undefined\n return { segments, compactSegments, rowColors: input.rowColors, rowShadeColor: input.rowShadeColor }\n }\n\n const suffix = input.suffix ?? \"\"\n if (!suffix) {\n return {\n segments: [{ text: input.baseText, colorHex: input.colorHex ?? DEFAULT_HEX }],\n }\n }\n\n return {\n segments: [\n { text: input.baseText, colorHex: input.baseColorHex ?? WHITE_HEX },\n { text: suffix, colorHex: input.colorHex ?? DEFAULT_HEX },\n ],\n }\n}\n\nasync function renderSegmentedFiglet(segments: BannerSegment[]) {\n const { renderDosRebel } = await import(\"./dos-rebel-font\")\n const cumulativeTexts: string[] = []\n let textSoFar = \"\"\n for (const segment of segments) {\n textSoFar += segment.text\n cumulativeTexts.push(textSoFar)\n }\n\n const renderedByBoundary = await Promise.all(\n cumulativeTexts.map((text) => renderDosRebel(text))\n )\n const lines = renderedByBoundary[renderedByBoundary.length - 1] ?? []\n const boundaryLines = renderedByBoundary.slice(0, -1)\n const ansiBySegment = segments.map(\n (segment) => hexToAnsi24(segment.colorHex ?? WHITE_HEX) ?? \"\\x1b[97m\"\n )\n const widestLine = lines.reduce((max, line) => Math.max(max, visibleLen(line)), 0)\n\n return { lines, boundaryLines, ansiBySegment, widestLine }\n}\n\nfunction printRowColoredFiglet(lines: string[], rowColors: string[], rowShadeColor?: string) {\n for (let i = 0; i < lines.length; i++) {\n const hex = rowColors[i % rowColors.length] ?? WHITE_HEX\n const fgAnsi = hexToAnsi24(hex) ?? \"\\x1b[97m\"\n const shadeAnsi = rowShadeColor ? (hexToAnsi24(rowShadeColor) ?? fgAnsi) : fgAnsi\n const line = lines[i] ?? \"\"\n let out = \"\"\n for (const char of line) {\n if (char === \" \") {\n out += `${RESET} `\n } else if (char === \"░\") {\n out += `${shadeAnsi}${char}`\n } else {\n out += `${fgAnsi}${char}`\n }\n }\n process.stdout.write(`${out}${RESET}\\n`)\n }\n}\n\nfunction printColoredFiglet(\n lines: string[],\n boundaryLines: string[][],\n ansiBySegment: string[]\n) {\n for (let i = 0; i < lines.length; i++) {\n const full = lines[i] ?? \"\"\n let cursor = 0\n let out = \"\"\n\n for (let segmentIndex = 0; segmentIndex < ansiBySegment.length; segmentIndex += 1) {\n const boundaryLine =\n segmentIndex < boundaryLines.length ? boundaryLines[segmentIndex]?.[i] ?? \"\" : full\n const end = Math.min(boundaryLine.length, full.length)\n const chunk = full.slice(cursor, end)\n out += `${ansiBySegment[segmentIndex]}${chunk}`\n cursor = end\n }\n\n process.stdout.write(`${out}${RESET}\\n`)\n }\n}\n\nexport async function printBanner(input: string | BannerSegment[] | BannerOptions) {\n const normalized = Array.isArray(input)\n ? { segments: input, compactSegments: undefined, rowColors: undefined }\n : normalizeSegments(input)\n const segments = normalized.segments\n const compactSegments = normalized.compactSegments\n const rowColors = normalized.rowColors\n const rowShadeColor = normalized.rowShadeColor\n if (!segments.length) return\n\n process.stdout.write(`${RESET}\\n`)\n const terminalColumns = process.stdout.columns ?? 0\n const primary = await renderSegmentedFiglet(segments)\n\n if (terminalColumns === 0 || primary.widestLine <= terminalColumns) {\n if (rowColors && rowColors.length > 0) {\n printRowColoredFiglet(primary.lines, rowColors, rowShadeColor)\n } else {\n printColoredFiglet(primary.lines, primary.boundaryLines, primary.ansiBySegment)\n }\n return\n }\n\n if (compactSegments && compactSegments.length > 0) {\n const compactFiglet = await renderSegmentedFiglet(compactSegments)\n if (compactFiglet.widestLine <= terminalColumns) {\n printColoredFiglet(\n compactFiglet.lines,\n compactFiglet.boundaryLines,\n compactFiglet.ansiBySegment\n )\n return\n }\n }\n\n let plain = \"\"\n for (let i = 0; i < segments.length; i++) {\n const text = segments[i]?.text ?? \"\"\n if (!text) continue\n plain += `${primary.ansiBySegment[i]}${text}`\n }\n process.stdout.write(`${plain}${RESET}\\n`)\n}\n\nexport function createTsupBannerHook(\n project: string | BannerOptions | LegacyBannerOptions\n): () => Promise<void> {\n let shown = false\n const normalized = normalizeSegments(project)\n const bannerKey = JSON.stringify(normalized)\n return async () => {\n if (shown) return\n if (shownBannerKeys.has(bannerKey)) return\n shown = true\n shownBannerKeys.add(bannerKey)\n await printBanner(normalized)\n }\n}\n\nexport function createDevBannerPlugin(\n project: string | BannerOptions | LegacyBannerOptions\n): DevPlugin {\n let shown = false\n const { segments, compactSegments, rowColors, rowShadeColor } = normalizeSegments(project)\n const bannerText = segments.map((segment) => segment.text).join(\"\")\n return {\n name: `olwiba-dev-banner-${bannerText.toLowerCase()}`,\n apply: \"serve\",\n configureServer(_server: unknown) {\n if (shown) return\n shown = true\n void printBanner({ segments, compactSegments, rowColors, rowShadeColor })\n },\n }\n}\n","import { createServer } from \"node:net\"\n\n/**\n * Probe for the first free port from `start` up. Vite's own auto-increment\n * doesn't kick in reliably under the TanStack Start plugin, so dev servers\n * resolve the port themselves before passing it to `server.port`.\n */\n/** True when `port` can be bound right now. */\nasync function isFree(port: number): Promise<boolean> {\n return new Promise<boolean>((resolve) => {\n const probe = createServer()\n .once(\"error\", () => resolve(false))\n .once(\"listening\", () => probe.close(() => resolve(true)))\n probe.listen(port)\n })\n}\n\nexport async function findFreePort(start: number, attempts = 20): Promise<number> {\n for (let port = start; port < start + attempts; port++) {\n if (await isFree(port)) return port\n }\n throw new Error(`No free port found in range ${start}-${start + attempts - 1}`)\n}\n\n/**\n * Resolve the dev server port for a preferred base port, falling back to the\n * next free one and saying so loudly.\n *\n * Falling back is the right default — a second app should start rather than\n * refuse — but the move used to be near-silent, and the port is not the thing\n * that breaks. What breaks is anything holding an absolute localhost URL:\n * sign-in fails \"Invalid origin\" if the origin is pinned, and magic links point\n * at the port you are no longer on.\n *\n * So callers are expected to do two things, and the log says so:\n * - trust localhost on any port in dev (`http://localhost:*`)\n * - derive `BETTER_AUTH_URL` from the port this returns, not from `.env`\n */\nexport async function resolveDevPort(preferred: number, attempts = 20): Promise<number> {\n const port = await findFreePort(preferred, attempts)\n if (port !== preferred) {\n console.warn(\n `\\n ⚠ Port ${preferred} is in use — this dev server is on ${port} instead.\\n` +\n ` Absolute URLs built from .env still say ${preferred}. Anything that\\n` +\n ` emails you a link (magic link, email verification) will point at the\\n` +\n ` wrong port unless BETTER_AUTH_URL is derived from ${port}.\\n`,\n )\n }\n return port\n}\n","import {\n createDevBannerPlugin,\n createTsupBannerHook,\n type BannerSegment,\n} from \"./dev-banner\"\n\nexport type ProjectBrandAccent = {\n hex: string\n lightOklch?: string\n darkOklch?: string\n}\n\nexport type ProjectBannerSegment = {\n text: string\n accent?: boolean\n colorHex?: string\n}\n\nexport type ProjectConfig = {\n id: string\n label: string\n brandAccent: ProjectBrandAccent\n banner: {\n segments: readonly ProjectBannerSegment[]\n compactSegments?: readonly ProjectBannerSegment[]\n }\n}\n\nfunction resolveProjectBannerSegments(\n segments: readonly ProjectBannerSegment[],\n accentHex: string\n): BannerSegment[] {\n return segments.map((segment) => ({\n text: segment.text,\n colorHex: segment.accent ? accentHex : segment.colorHex,\n }))\n}\n\nfunction getProjectBanner(project: ProjectConfig) {\n return {\n segments: resolveProjectBannerSegments(project.banner.segments, project.brandAccent.hex),\n compactSegments: project.banner.compactSegments\n ? resolveProjectBannerSegments(project.banner.compactSegments, project.brandAccent.hex)\n : undefined,\n }\n}\n\nexport function createProjectDevBannerPlugin(project: ProjectConfig) {\n return createDevBannerPlugin(getProjectBanner(project))\n}\n\nexport function createProjectTsupBannerHook(project: ProjectConfig) {\n return createTsupBannerHook(getProjectBanner(project))\n}\n"]}
|