@coherent.js/runtime 1.0.0-beta.2

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.
@@ -0,0 +1,331 @@
1
+ // src/runtimes/static.js
2
+ import { render } from "@coherent.js/core";
3
+ var StaticRuntime = class _StaticRuntime {
4
+ constructor(options = {}) {
5
+ this.options = {
6
+ outputDir: "dist",
7
+ baseUrl: "",
8
+ generateSitemap: true,
9
+ generateManifest: true,
10
+ minifyHtml: true,
11
+ inlineCSS: false,
12
+ ...options
13
+ };
14
+ this.componentRegistry = /* @__PURE__ */ new Map();
15
+ this.pageRegistry = /* @__PURE__ */ new Map();
16
+ this.staticAssets = /* @__PURE__ */ new Map();
17
+ this.generatedPages = /* @__PURE__ */ new Map();
18
+ this.buildStats = {
19
+ startTime: Date.now(),
20
+ pagesGenerated: 0,
21
+ assetsProcessed: 0,
22
+ totalSize: 0,
23
+ errors: []
24
+ };
25
+ }
26
+ // Component management
27
+ registerComponent(name, component, options = {}) {
28
+ this.componentRegistry.set(name, {
29
+ component,
30
+ options
31
+ });
32
+ return component;
33
+ }
34
+ getComponent(name) {
35
+ const registration = this.componentRegistry.get(name);
36
+ return registration ? registration.component : null;
37
+ }
38
+ // Page registration
39
+ addPage(route, component, options = {}) {
40
+ this.pageRegistry.set(route, {
41
+ component: typeof component === "string" ? this.getComponent(component) : component,
42
+ options: {
43
+ title: options.title || "Page",
44
+ description: options.description || "",
45
+ keywords: options.keywords || "",
46
+ generatePath: options.generatePath || this.routeToPath(route),
47
+ props: options.props || {},
48
+ ...options
49
+ }
50
+ });
51
+ }
52
+ routeToPath(route) {
53
+ if (route === "/") return "/index.html";
54
+ if (route.includes(":")) {
55
+ console.warn(`Dynamic route ${route} requires explicit generatePath`);
56
+ return null;
57
+ }
58
+ return route.endsWith("/") ? `${route}index.html` : `${route}.html`;
59
+ }
60
+ // Static asset management
61
+ addAsset(path, content, options = {}) {
62
+ this.staticAssets.set(path, {
63
+ content,
64
+ type: options.type || this.inferContentType(path),
65
+ minify: options.minify !== false,
66
+ ...options
67
+ });
68
+ }
69
+ inferContentType(path) {
70
+ const ext = path.split(".").pop().toLowerCase();
71
+ const contentTypes = {
72
+ "html": "text/html",
73
+ "css": "text/css",
74
+ "js": "application/javascript",
75
+ "json": "application/json",
76
+ "png": "image/png",
77
+ "jpg": "image/jpeg",
78
+ "jpeg": "image/jpeg",
79
+ "gif": "image/gif",
80
+ "svg": "image/svg+xml",
81
+ "ico": "image/x-icon"
82
+ };
83
+ return contentTypes[ext] || "text/plain";
84
+ }
85
+ // HTML template generation
86
+ generateHtmlDocument(content, options = {}) {
87
+ const {
88
+ title = "Coherent.js App",
89
+ description = "",
90
+ keywords = "",
91
+ lang = "en",
92
+ charset = "utf-8",
93
+ viewport = "width=device-width, initial-scale=1",
94
+ favicon = "/favicon.ico",
95
+ styles = [],
96
+ scripts = [],
97
+ meta = [],
98
+ bodyClass = "",
99
+ hydrate = false,
100
+ componentName = null,
101
+ componentProps = {}
102
+ } = options;
103
+ const metaTags = [
104
+ `<meta charset="${charset}">`,
105
+ `<meta name="viewport" content="${viewport}">`,
106
+ description && `<meta name="description" content="${description}">`,
107
+ keywords && `<meta name="keywords" content="${keywords}">`,
108
+ ...meta.map((m) => typeof m === "string" ? m : `<meta ${Object.entries(m).map(([k, v]) => `${k}="${v}"`).join(" ")}>`)
109
+ ].filter(Boolean).join("\n ");
110
+ const styleTags = styles.map(
111
+ (style) => typeof style === "string" ? style.startsWith("<") ? style : `<link rel="stylesheet" href="${style}">` : `<style>${style.content}</style>`
112
+ ).join("\n ");
113
+ const scriptTags = [
114
+ ...scripts.map(
115
+ (script) => typeof script === "string" ? script.startsWith("<") ? script : `<script src="${script}"></script>` : `<script>${script.content}</script>`
116
+ ),
117
+ // Add hydration script if enabled
118
+ hydrate && this.generateHydrationScript(componentName, componentProps)
119
+ ].filter(Boolean).join("\n ");
120
+ return `<!DOCTYPE html>
121
+ <html lang="${lang}">
122
+ <head>
123
+ ${metaTags}
124
+ <title>${this.escapeHtml(title)}</title>
125
+ <link rel="icon" href="${favicon}">
126
+ ${styleTags}
127
+ </head>
128
+ <body${bodyClass ? ` class="${bodyClass}"` : ""}>
129
+ ${content}
130
+ ${scriptTags}
131
+ </body>
132
+ </html>`;
133
+ }
134
+ generateHydrationScript(componentName) {
135
+ if (!componentName) return "";
136
+ return `
137
+ <script type="module">
138
+ import { autoHydrate } from '/coherent-client.js';
139
+
140
+ // Auto-hydrate on page load
141
+ document.addEventListener('DOMContentLoaded', () => {
142
+ autoHydrate({
143
+ '${componentName}': window.components?.['${componentName}']
144
+ });
145
+ });
146
+ </script>`;
147
+ }
148
+ escapeHtml(text) {
149
+ if (typeof text !== "string") return text;
150
+ return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#x27;");
151
+ }
152
+ // Build process
153
+ async build() {
154
+ this.buildStats.startTime = Date.now();
155
+ console.log("\u{1F3D7}\uFE0F Starting static site generation...");
156
+ try {
157
+ await this.generatePages();
158
+ await this.processAssets();
159
+ if (this.options.generateSitemap) {
160
+ await this.generateSitemap();
161
+ }
162
+ if (this.options.generateManifest) {
163
+ await this.generateManifest();
164
+ }
165
+ const buildTime = Date.now() - this.buildStats.startTime;
166
+ console.log(`\u2705 Build completed in ${buildTime}ms`);
167
+ console.log(`\u{1F4C4} Generated ${this.buildStats.pagesGenerated} pages`);
168
+ console.log(`\u{1F4E6} Processed ${this.buildStats.assetsProcessed} assets`);
169
+ return this.getBuildResult();
170
+ } catch (error) {
171
+ this.buildStats.errors.push(error);
172
+ console.error("\u274C Build failed:", error);
173
+ throw error;
174
+ }
175
+ }
176
+ async generatePages() {
177
+ for (const [route, pageConfig] of this.pageRegistry) {
178
+ try {
179
+ await this.generatePage(route, pageConfig);
180
+ this.buildStats.pagesGenerated++;
181
+ } catch (error) {
182
+ console.error(`Failed to generate page ${route}:`, error);
183
+ this.buildStats.errors.push({ route, error });
184
+ }
185
+ }
186
+ }
187
+ async generatePage(route, pageConfig) {
188
+ const { component, options } = pageConfig;
189
+ if (!component) {
190
+ throw new Error(`No component found for route: ${route}`);
191
+ }
192
+ const vdom = component(options.props || {});
193
+ const content = render(vdom);
194
+ const html = this.generateHtmlDocument(content, {
195
+ title: options.title,
196
+ description: options.description,
197
+ keywords: options.keywords,
198
+ styles: options.styles || [],
199
+ scripts: options.scripts || [],
200
+ meta: options.meta || [],
201
+ hydrate: options.hydrate,
202
+ componentName: options.componentName,
203
+ componentProps: options.props || {},
204
+ ...options.htmlOptions
205
+ });
206
+ const finalHtml = this.options.minifyHtml ? this.minifyHtml(html) : html;
207
+ const outputPath = options.generatePath || this.routeToPath(route);
208
+ if (outputPath) {
209
+ this.generatedPages.set(outputPath, {
210
+ html: finalHtml,
211
+ size: finalHtml.length,
212
+ route,
213
+ options
214
+ });
215
+ this.buildStats.totalSize += finalHtml.length;
216
+ }
217
+ }
218
+ minifyHtml(html) {
219
+ return html.replace(/\s+/g, " ").replace(/>\s+</g, "><").replace(/\s+>/g, ">").replace(/<\s+/g, "<").trim();
220
+ }
221
+ async processAssets() {
222
+ for (const [path, asset] of this.staticAssets) {
223
+ try {
224
+ let content = asset.content;
225
+ if (asset.minify) {
226
+ content = this.minifyAsset(content, asset.type);
227
+ }
228
+ this.generatedPages.set(path, {
229
+ content,
230
+ type: asset.type,
231
+ size: content.length
232
+ });
233
+ this.buildStats.assetsProcessed++;
234
+ this.buildStats.totalSize += content.length;
235
+ } catch (error) {
236
+ console.error(`Failed to process asset ${path}:`, error);
237
+ this.buildStats.errors.push({ path, error });
238
+ }
239
+ }
240
+ }
241
+ minifyAsset(content, type) {
242
+ switch (type) {
243
+ case "text/css":
244
+ return content.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\s+/g, " ").replace(/;\s*}/g, "}").replace(/\s*{\s*/g, "{").replace(/;\s*/g, ";").trim();
245
+ case "application/javascript":
246
+ return content.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\/\/.*$/gm, "").replace(/\s+/g, " ").replace(/\s*([{}();,])\s*/g, "$1").trim();
247
+ default:
248
+ return content;
249
+ }
250
+ }
251
+ async generateSitemap() {
252
+ const pages = Array.from(this.generatedPages.keys()).filter((path) => path.endsWith(".html"));
253
+ const sitemap = `<?xml version="1.0" encoding="UTF-8"?>
254
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
255
+ ${pages.map((path) => ` <url>
256
+ <loc>${this.options.baseUrl}${path.replace("/index.html", "/")}</loc>
257
+ <lastmod>${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}</lastmod>
258
+ </url>`).join("\n")}
259
+ </urlset>`;
260
+ this.generatedPages.set("/sitemap.xml", {
261
+ content: sitemap,
262
+ type: "application/xml",
263
+ size: sitemap.length
264
+ });
265
+ }
266
+ async generateManifest() {
267
+ const manifest = {
268
+ name: this.options.name || "Coherent.js App",
269
+ short_name: this.options.shortName || "App",
270
+ description: this.options.description || "",
271
+ start_url: "/",
272
+ display: "standalone",
273
+ theme_color: this.options.themeColor || "#000000",
274
+ background_color: this.options.backgroundColor || "#ffffff",
275
+ icons: this.options.icons || []
276
+ };
277
+ const manifestJson = JSON.stringify(manifest, null, 2);
278
+ this.generatedPages.set("/manifest.json", {
279
+ content: manifestJson,
280
+ type: "application/json",
281
+ size: manifestJson.length
282
+ });
283
+ }
284
+ getBuildResult() {
285
+ return {
286
+ pages: this.generatedPages,
287
+ stats: {
288
+ ...this.buildStats,
289
+ buildTime: Date.now() - this.buildStats.startTime
290
+ },
291
+ success: this.buildStats.errors.length === 0
292
+ };
293
+ }
294
+ // Create static app factory
295
+ createApp() {
296
+ return {
297
+ // Component registration
298
+ component: (name, component, opts) => this.registerComponent(name, component, opts),
299
+ // Page registration
300
+ page: (route, component, opts) => this.addPage(route, component, opts),
301
+ // Asset management
302
+ asset: (path, content, opts) => this.addAsset(path, content, opts),
303
+ // Build process
304
+ build: () => this.build(),
305
+ // Utilities
306
+ getRuntime: () => this,
307
+ getStats: () => this.buildStats,
308
+ getPages: () => Array.from(this.pageRegistry.keys()),
309
+ getAssets: () => Array.from(this.staticAssets.keys())
310
+ };
311
+ }
312
+ // Static factory methods
313
+ static createApp(options = {}) {
314
+ const runtime = new _StaticRuntime(options);
315
+ return runtime.createApp(options);
316
+ }
317
+ static async buildSite(pages = {}, components = {}, options = {}) {
318
+ const runtime = new _StaticRuntime(options);
319
+ Object.entries(components).forEach(([name, component]) => {
320
+ runtime.registerComponent(name, component);
321
+ });
322
+ Object.entries(pages).forEach(([route, config]) => {
323
+ runtime.addPage(route, config.component, config.options);
324
+ });
325
+ return await runtime.build();
326
+ }
327
+ };
328
+ export {
329
+ StaticRuntime
330
+ };
331
+ //# sourceMappingURL=coherent-static.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/runtimes/static.js"],
4
+ "sourcesContent": ["/**\n * Static Runtime - For static site generation\n * Pre-renders components to static HTML files\n */\n\nimport { render } from '@coherent.js/core';\n\nexport class StaticRuntime {\n constructor(options = {}) {\n this.options = {\n outputDir: 'dist',\n baseUrl: '',\n generateSitemap: true,\n generateManifest: true,\n minifyHtml: true,\n inlineCSS: false,\n ...options\n };\n \n this.componentRegistry = new Map();\n this.pageRegistry = new Map();\n this.staticAssets = new Map();\n this.generatedPages = new Map();\n \n // Track build statistics\n this.buildStats = {\n startTime: Date.now(),\n pagesGenerated: 0,\n assetsProcessed: 0,\n totalSize: 0,\n errors: []\n };\n }\n\n // Component management\n registerComponent(name, component, options = {}) {\n this.componentRegistry.set(name, {\n component,\n options\n });\n return component;\n }\n\n getComponent(name) {\n const registration = this.componentRegistry.get(name);\n return registration ? registration.component : null;\n }\n\n // Page registration\n addPage(route, component, options = {}) {\n this.pageRegistry.set(route, {\n component: typeof component === 'string' ? this.getComponent(component) : component,\n options: {\n title: options.title || 'Page',\n description: options.description || '',\n keywords: options.keywords || '',\n generatePath: options.generatePath || this.routeToPath(route),\n props: options.props || {},\n ...options\n }\n });\n }\n\n routeToPath(route) {\n // Convert route pattern to static path\n // /users/:id -> /users/[id] (or similar static pattern)\n if (route === '/') return '/index.html';\n \n // Handle dynamic routes\n if (route.includes(':')) {\n // For static generation, dynamic routes need explicit paths\n console.warn(`Dynamic route ${route} requires explicit generatePath`);\n return null;\n }\n \n return route.endsWith('/') ? `${route}index.html` : `${route}.html`;\n }\n\n // Static asset management\n addAsset(path, content, options = {}) {\n this.staticAssets.set(path, {\n content,\n type: options.type || this.inferContentType(path),\n minify: options.minify !== false,\n ...options\n });\n }\n\n inferContentType(path) {\n const ext = path.split('.').pop().toLowerCase();\n const contentTypes = {\n 'html': 'text/html',\n 'css': 'text/css',\n 'js': 'application/javascript',\n 'json': 'application/json',\n 'png': 'image/png',\n 'jpg': 'image/jpeg',\n 'jpeg': 'image/jpeg',\n 'gif': 'image/gif',\n 'svg': 'image/svg+xml',\n 'ico': 'image/x-icon'\n };\n return contentTypes[ext] || 'text/plain';\n }\n\n // HTML template generation\n generateHtmlDocument(content, options = {}) {\n const {\n title = 'Coherent.js App',\n description = '',\n keywords = '',\n lang = 'en',\n charset = 'utf-8',\n viewport = 'width=device-width, initial-scale=1',\n favicon = '/favicon.ico',\n styles = [],\n scripts = [],\n meta = [],\n bodyClass = '',\n hydrate = false,\n componentName = null,\n componentProps = {}\n } = options;\n\n const metaTags = [\n `<meta charset=\"${charset}\">`,\n `<meta name=\"viewport\" content=\"${viewport}\">`,\n description && `<meta name=\"description\" content=\"${description}\">`,\n keywords && `<meta name=\"keywords\" content=\"${keywords}\">`,\n ...meta.map(m => typeof m === 'string' ? m : `<meta ${Object.entries(m).map(([k, v]) => `${k}=\"${v}\"`).join(' ')}>`)\n ].filter(Boolean).join('\\n ');\n\n const styleTags = styles.map(style => \n typeof style === 'string' \n ? style.startsWith('<') ? style : `<link rel=\"stylesheet\" href=\"${style}\">`\n : `<style>${style.content}</style>`\n ).join('\\n ');\n\n const scriptTags = [\n ...scripts.map(script => \n typeof script === 'string' \n ? script.startsWith('<') ? script : `<script src=\"${script}\"></script>`\n : `<script>${script.content}</script>`\n ),\n // Add hydration script if enabled\n hydrate && this.generateHydrationScript(componentName, componentProps)\n ].filter(Boolean).join('\\n ');\n\n return `<!DOCTYPE html>\n<html lang=\"${lang}\">\n<head>\n ${metaTags}\n <title>${this.escapeHtml(title)}</title>\n <link rel=\"icon\" href=\"${favicon}\">\n ${styleTags}\n</head>\n<body${bodyClass ? ` class=\"${bodyClass}\"` : ''}>\n ${content}\n ${scriptTags}\n</body>\n</html>`;\n }\n\n generateHydrationScript(componentName) {\n if (!componentName) return '';\n \n return `\n <script type=\"module\">\n import { autoHydrate } from '/coherent-client.js';\n \n // Auto-hydrate on page load\n document.addEventListener('DOMContentLoaded', () => {\n autoHydrate({\n '${componentName}': window.components?.['${componentName}']\n });\n });\n </script>`;\n }\n\n escapeHtml(text) {\n if (typeof text !== 'string') return text;\n return text\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;')\n .replace(/'/g, '&#x27;');\n }\n\n // Build process\n async build() {\n this.buildStats.startTime = Date.now();\n console.log('\uD83C\uDFD7\uFE0F Starting static site generation...');\n\n try {\n // Generate all pages\n await this.generatePages();\n \n // Process static assets\n await this.processAssets();\n \n // Generate additional files\n if (this.options.generateSitemap) {\n await this.generateSitemap();\n }\n \n if (this.options.generateManifest) {\n await this.generateManifest();\n }\n \n // Generate build report\n const buildTime = Date.now() - this.buildStats.startTime;\n console.log(`\u2705 Build completed in ${buildTime}ms`);\n console.log(`\uD83D\uDCC4 Generated ${this.buildStats.pagesGenerated} pages`);\n console.log(`\uD83D\uDCE6 Processed ${this.buildStats.assetsProcessed} assets`);\n \n return this.getBuildResult();\n \n } catch (error) {\n this.buildStats.errors.push(error);\n console.error('\u274C Build failed:', error);\n throw error;\n }\n }\n\n async generatePages() {\n for (const [route, pageConfig] of this.pageRegistry) {\n try {\n await this.generatePage(route, pageConfig);\n this.buildStats.pagesGenerated++;\n } catch (error) {\n console.error(`Failed to generate page ${route}:`, error);\n this.buildStats.errors.push({ route, error });\n }\n }\n }\n\n async generatePage(route, pageConfig) {\n const { component, options } = pageConfig;\n \n if (!component) {\n throw new Error(`No component found for route: ${route}`);\n }\n\n // Render component to HTML\n const vdom = component(options.props || {});\n const content = render(vdom);\n \n // Wrap in HTML document\n const html = this.generateHtmlDocument(content, {\n title: options.title,\n description: options.description,\n keywords: options.keywords,\n styles: options.styles || [],\n scripts: options.scripts || [],\n meta: options.meta || [],\n hydrate: options.hydrate,\n componentName: options.componentName,\n componentProps: options.props || {},\n ...options.htmlOptions\n });\n\n // Minify if enabled\n const finalHtml = this.options.minifyHtml ? this.minifyHtml(html) : html;\n \n // Store generated page\n const outputPath = options.generatePath || this.routeToPath(route);\n if (outputPath) {\n this.generatedPages.set(outputPath, {\n html: finalHtml,\n size: finalHtml.length,\n route,\n options\n });\n \n this.buildStats.totalSize += finalHtml.length;\n }\n }\n\n minifyHtml(html) {\n // Basic HTML minification\n return html\n .replace(/\\s+/g, ' ')\n .replace(/>\\s+</g, '><')\n .replace(/\\s+>/g, '>')\n .replace(/<\\s+/g, '<')\n .trim();\n }\n\n async processAssets() {\n for (const [path, asset] of this.staticAssets) {\n try {\n let content = asset.content;\n \n // Process asset based on type\n if (asset.minify) {\n content = this.minifyAsset(content, asset.type);\n }\n \n // Store processed asset\n this.generatedPages.set(path, {\n content,\n type: asset.type,\n size: content.length\n });\n \n this.buildStats.assetsProcessed++;\n this.buildStats.totalSize += content.length;\n \n } catch (error) {\n console.error(`Failed to process asset ${path}:`, error);\n this.buildStats.errors.push({ path, error });\n }\n }\n }\n\n minifyAsset(content, type) {\n switch (type) {\n case 'text/css':\n return content\n .replace(/\\/\\*[\\s\\S]*?\\*\\//g, '')\n .replace(/\\s+/g, ' ')\n .replace(/;\\s*}/g, '}')\n .replace(/\\s*{\\s*/g, '{')\n .replace(/;\\s*/g, ';')\n .trim();\n \n case 'application/javascript':\n // Basic JS minification (in production, use a proper minifier)\n return content\n .replace(/\\/\\*[\\s\\S]*?\\*\\//g, '')\n .replace(/\\/\\/.*$/gm, '')\n .replace(/\\s+/g, ' ')\n .replace(/\\s*([{}();,])\\s*/g, '$1')\n .trim();\n \n default:\n return content;\n }\n }\n\n async generateSitemap() {\n const pages = Array.from(this.generatedPages.keys())\n .filter(path => path.endsWith('.html'));\n \n const sitemap = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n${pages.map(path => ` <url>\n <loc>${this.options.baseUrl}${path.replace('/index.html', '/')}</loc>\n <lastmod>${new Date().toISOString().split('T')[0]}</lastmod>\n </url>`).join('\\n')}\n</urlset>`;\n\n this.generatedPages.set('/sitemap.xml', {\n content: sitemap,\n type: 'application/xml',\n size: sitemap.length\n });\n }\n\n async generateManifest() {\n const manifest = {\n name: this.options.name || 'Coherent.js App',\n short_name: this.options.shortName || 'App',\n description: this.options.description || '',\n start_url: '/',\n display: 'standalone',\n theme_color: this.options.themeColor || '#000000',\n background_color: this.options.backgroundColor || '#ffffff',\n icons: this.options.icons || []\n };\n\n const manifestJson = JSON.stringify(manifest, null, 2);\n \n this.generatedPages.set('/manifest.json', {\n content: manifestJson,\n type: 'application/json',\n size: manifestJson.length\n });\n }\n\n getBuildResult() {\n return {\n pages: this.generatedPages,\n stats: {\n ...this.buildStats,\n buildTime: Date.now() - this.buildStats.startTime\n },\n success: this.buildStats.errors.length === 0\n };\n }\n\n // Create static app factory\n createApp() {\n return {\n // Component registration\n component: (name, component, opts) => this.registerComponent(name, component, opts),\n \n // Page registration\n page: (route, component, opts) => this.addPage(route, component, opts),\n \n // Asset management\n asset: (path, content, opts) => this.addAsset(path, content, opts),\n \n // Build process\n build: () => this.build(),\n \n // Utilities\n getRuntime: () => this,\n getStats: () => this.buildStats,\n getPages: () => Array.from(this.pageRegistry.keys()),\n getAssets: () => Array.from(this.staticAssets.keys())\n };\n }\n\n // Static factory methods\n static createApp(options = {}) {\n const runtime = new StaticRuntime(options);\n return runtime.createApp(options);\n }\n\n static async buildSite(pages = {}, components = {}, options = {}) {\n const runtime = new StaticRuntime(options);\n \n // Register components\n Object.entries(components).forEach(([name, component]) => {\n runtime.registerComponent(name, component);\n });\n \n // Register pages\n Object.entries(pages).forEach(([route, config]) => {\n runtime.addPage(route, config.component, config.options);\n });\n \n return await runtime.build();\n }\n}\n"],
5
+ "mappings": ";AAKA,SAAS,cAAc;AAEhB,IAAM,gBAAN,MAAM,eAAc;AAAA,EACzB,YAAY,UAAU,CAAC,GAAG;AACxB,SAAK,UAAU;AAAA,MACb,WAAW;AAAA,MACX,SAAS;AAAA,MACT,iBAAiB;AAAA,MACjB,kBAAkB;AAAA,MAClB,YAAY;AAAA,MACZ,WAAW;AAAA,MACX,GAAG;AAAA,IACL;AAEA,SAAK,oBAAoB,oBAAI,IAAI;AACjC,SAAK,eAAe,oBAAI,IAAI;AAC5B,SAAK,eAAe,oBAAI,IAAI;AAC5B,SAAK,iBAAiB,oBAAI,IAAI;AAG9B,SAAK,aAAa;AAAA,MAChB,WAAW,KAAK,IAAI;AAAA,MACpB,gBAAgB;AAAA,MAChB,iBAAiB;AAAA,MACjB,WAAW;AAAA,MACX,QAAQ,CAAC;AAAA,IACX;AAAA,EACF;AAAA;AAAA,EAGA,kBAAkB,MAAM,WAAW,UAAU,CAAC,GAAG;AAC/C,SAAK,kBAAkB,IAAI,MAAM;AAAA,MAC/B;AAAA,MACA;AAAA,IACF,CAAC;AACD,WAAO;AAAA,EACT;AAAA,EAEA,aAAa,MAAM;AACjB,UAAM,eAAe,KAAK,kBAAkB,IAAI,IAAI;AACpD,WAAO,eAAe,aAAa,YAAY;AAAA,EACjD;AAAA;AAAA,EAGA,QAAQ,OAAO,WAAW,UAAU,CAAC,GAAG;AACtC,SAAK,aAAa,IAAI,OAAO;AAAA,MAC3B,WAAW,OAAO,cAAc,WAAW,KAAK,aAAa,SAAS,IAAI;AAAA,M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