@aerobuilt/core 0.2.9 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/build-script-analysis-Bd9EyItC.mjs +193 -0
  2. package/dist/{entry-dev.d.ts → entry-dev.d.mts} +6 -16
  3. package/dist/entry-dev.mjs +127 -0
  4. package/dist/{entry-editor.d.ts → entry-editor.d.mts} +24 -22
  5. package/dist/entry-editor.mjs +3 -0
  6. package/dist/entry-prod.d.mts +10 -0
  7. package/dist/entry-prod.mjs +15 -0
  8. package/dist/routing-Bai79LCq.mjs +198 -0
  9. package/dist/runtime/index.d.mts +65 -0
  10. package/dist/runtime/index.mjs +207 -0
  11. package/dist/runtime/instance.d.mts +19 -0
  12. package/dist/runtime/instance.mjs +45 -0
  13. package/dist/types-CLHGhnGA.d.mts +209 -0
  14. package/dist/types.d.mts +2 -0
  15. package/dist/types.mjs +1 -0
  16. package/dist/utils/aliases.d.mts +38 -0
  17. package/dist/utils/aliases.mjs +117 -0
  18. package/dist/utils/{redirects.d.ts → redirects.d.mts} +7 -12
  19. package/dist/utils/redirects.mjs +21 -0
  20. package/dist/vite/{index.d.ts → index.d.mts} +5 -12
  21. package/dist/vite/index.mjs +1890 -0
  22. package/package.json +25 -20
  23. package/dist/chunk-4DAK56WB.js +0 -36
  24. package/dist/chunk-5ZNUGZOW.js +0 -238
  25. package/dist/chunk-F7MXQXLM.js +0 -15
  26. package/dist/chunk-JAMYN2VX.js +0 -133
  27. package/dist/chunk-VTEG2UU3.js +0 -184
  28. package/dist/entry-dev.js +0 -101
  29. package/dist/entry-editor.js +0 -14
  30. package/dist/entry-prod.d.ts +0 -19
  31. package/dist/entry-prod.js +0 -19
  32. package/dist/runtime/index.d.ts +0 -74
  33. package/dist/runtime/index.js +0 -7
  34. package/dist/runtime/instance.d.ts +0 -31
  35. package/dist/runtime/instance.js +0 -10
  36. package/dist/types.d.ts +0 -202
  37. package/dist/types.js +0 -0
  38. package/dist/utils/redirects.js +0 -6
  39. package/dist/vite/index.js +0 -1991
@@ -0,0 +1,65 @@
1
+ import { a as AeroRenderInput, d as MountOptions } from "../types-CLHGhnGA.mjs";
2
+
3
+ //#region src/runtime/index.d.ts
4
+ declare class Aero {
5
+ /** Global values merged into template context (e.g. from content modules). */
6
+ private globals;
7
+ /** Map from page name (or path) to module. Keys include both canonical name and full path for lookup. */
8
+ private pagesMap;
9
+ /** Set by client entry when running in the browser; used to attach the app to a DOM root. */
10
+ mount?: (options?: MountOptions) => Promise<void>;
11
+ /**
12
+ * Register a global value available in all templates as `name`.
13
+ *
14
+ * @param name - Key used in templates (e.g. `site`).
15
+ * @param value - Any value (object, string, etc.).
16
+ */
17
+ global(name: string, value: any): void;
18
+ /**
19
+ * Register page/layout modules from a Vite glob (e.g. `import.meta.glob('@pages/**\/*.html')`).
20
+ * Derives a lookup key from each path via pagePathToKey; also stores by full path for resolution.
21
+ *
22
+ * @param pages - Record of resolved path → module (default export is the render function).
23
+ */
24
+ registerPages(pages: Record<string, any>): void;
25
+ /** Type guard: true if value looks like an `AeroRenderInput` (has at least one of props, slots, request, url, params, routePath). */
26
+ private isRenderInput;
27
+ /** Coerce various call signatures into a single `AeroRenderInput` (e.g. plain object → `{ props }`). */
28
+ private normalizeRenderInput;
29
+ /** Convert a page name to a route path (e.g. `index` → `'/'`, `about` → `'/about'`). */
30
+ private toRoutePath;
31
+ /** Build a URL from route path and optional raw URL. Uses `http://localhost` as base when only a path is given. */
32
+ private toURL;
33
+ /** Build template context: globals, props, slots, request, url, params, site, and `renderComponent` / `nextPassDataId`. */
34
+ private createContext;
35
+ /** True if entry params and request params have the same keys and stringified values. */
36
+ private paramsMatch;
37
+ /**
38
+ * Render a page or layout to HTML.
39
+ *
40
+ * @remarks
41
+ * Resolves `component` (page name string or module) via `pagesMap`, with fallbacks: directory index
42
+ * (`foo` → `foo/index`), `index` → `home`, dynamic routes, and trailing-slash stripping. If the module
43
+ * exports `getStaticPaths` and no props are provided, finds the matching static path and uses its props.
44
+ * For root-level renders, injects accumulated styles and scripts into the document and fixes content
45
+ * that ends up after `</html>` when using layouts (moves it into `</body>`).
46
+ *
47
+ * @param component - Page name (e.g. `'index'`, `'about'`) or the module object.
48
+ * @param input - Render input (props, request, url, params, etc.). Can be a plain object (treated as props).
49
+ * @returns HTML string, or `null` if the page is not found or no static path match.
50
+ */
51
+ render(component: any, input?: any): Promise<any>;
52
+ /**
53
+ * Render a child component (layout or component) with the given props and slots.
54
+ * Used by compiled templates via context.renderComponent.
55
+ *
56
+ * @param component - Render function or module with `default` render function.
57
+ * @param props - Props object for the component.
58
+ * @param slots - Named slot content (key → HTML string).
59
+ * @param input - Optional request/url/params for context; `headScripts` is not passed through.
60
+ * @returns HTML string from the component's render function, or empty string if not invokable.
61
+ */
62
+ renderComponent(component: any, props?: any, slots?: Record<string, string>, input?: AeroRenderInput): Promise<any>;
63
+ }
64
+ //#endregion
65
+ export { Aero };
@@ -0,0 +1,207 @@
1
+ import { r as resolvePageTarget, t as pagePathToKey } from "../routing-Bai79LCq.mjs";
2
+
3
+ //#region src/runtime/index.ts
4
+ var Aero = class {
5
+ /** Global values merged into template context (e.g. from content modules). */
6
+ globals = {};
7
+ /** Map from page name (or path) to module. Keys include both canonical name and full path for lookup. */
8
+ pagesMap = {};
9
+ /** Set by client entry when running in the browser; used to attach the app to a DOM root. */
10
+ mount;
11
+ /**
12
+ * Register a global value available in all templates as `name`.
13
+ *
14
+ * @param name - Key used in templates (e.g. `site`).
15
+ * @param value - Any value (object, string, etc.).
16
+ */
17
+ global(name, value) {
18
+ this.globals[name] = value;
19
+ }
20
+ /**
21
+ * Register page/layout modules from a Vite glob (e.g. `import.meta.glob('@pages/**\/*.html')`).
22
+ * Derives a lookup key from each path via pagePathToKey; also stores by full path for resolution.
23
+ *
24
+ * @param pages - Record of resolved path → module (default export is the render function).
25
+ */
26
+ registerPages(pages) {
27
+ for (const [path, mod] of Object.entries(pages)) {
28
+ const key = pagePathToKey(path);
29
+ this.pagesMap[key] = mod;
30
+ this.pagesMap[path] = mod;
31
+ }
32
+ }
33
+ /** Type guard: true if value looks like an `AeroRenderInput` (has at least one of props, slots, request, url, params, routePath). */
34
+ isRenderInput(value) {
35
+ if (!value || typeof value !== "object") return false;
36
+ return [
37
+ "props",
38
+ "slots",
39
+ "request",
40
+ "url",
41
+ "params",
42
+ "routePath"
43
+ ].some((key) => key in value);
44
+ }
45
+ /** Coerce various call signatures into a single `AeroRenderInput` (e.g. plain object → `{ props }`). */
46
+ normalizeRenderInput(input) {
47
+ if (!input) return {};
48
+ if (this.isRenderInput(input)) return input;
49
+ if (typeof input === "object") return { props: input };
50
+ return { props: {} };
51
+ }
52
+ /** Convert a page name to a route path (e.g. `index` → `'/'`, `about` → `'/about'`). */
53
+ toRoutePath(pageName = "index") {
54
+ if (!pageName || pageName === "index" || pageName === "home") return "/";
55
+ if (pageName.endsWith("/index")) return "/" + pageName.slice(0, -6);
56
+ return pageName.startsWith("/") ? pageName : "/" + pageName;
57
+ }
58
+ /** Build a URL from route path and optional raw URL. Uses `http://localhost` as base when only a path is given. */
59
+ toURL(routePath, rawUrl) {
60
+ if (rawUrl instanceof URL) return rawUrl;
61
+ if (typeof rawUrl === "string" && rawUrl.length > 0) return new URL(rawUrl, "http://localhost");
62
+ return new URL(routePath, "http://localhost");
63
+ }
64
+ /** Build template context: globals, props, slots, request, url, params, site, and `renderComponent` / `nextPassDataId`. */
65
+ createContext(input) {
66
+ const routePath = input.routePath || "/";
67
+ const url = this.toURL(routePath, input.url);
68
+ const request = input.request || new Request(url.toString(), { method: "GET" });
69
+ let _passDataId = 0;
70
+ return {
71
+ ...this.globals,
72
+ props: input.props || {},
73
+ slots: input.slots || {},
74
+ request,
75
+ url,
76
+ params: input.params || {},
77
+ site: input.site ?? "",
78
+ styles: input.styles,
79
+ scripts: input.scripts,
80
+ headScripts: input.headScripts,
81
+ nextPassDataId: () => `__aero_${_passDataId++}`,
82
+ renderComponent: this.renderComponent.bind(this)
83
+ };
84
+ }
85
+ /** True if entry params and request params have the same keys and stringified values. */
86
+ paramsMatch(entryParams, requestParams) {
87
+ const entryKeys = Object.keys(entryParams);
88
+ if (entryKeys.length !== Object.keys(requestParams).length) return false;
89
+ for (const key of entryKeys) if (String(entryParams[key]) !== String(requestParams[key])) return false;
90
+ return true;
91
+ }
92
+ /**
93
+ * Render a page or layout to HTML.
94
+ *
95
+ * @remarks
96
+ * Resolves `component` (page name string or module) via `pagesMap`, with fallbacks: directory index
97
+ * (`foo` → `foo/index`), `index` → `home`, dynamic routes, and trailing-slash stripping. If the module
98
+ * exports `getStaticPaths` and no props are provided, finds the matching static path and uses its props.
99
+ * For root-level renders, injects accumulated styles and scripts into the document and fixes content
100
+ * that ends up after `</html>` when using layouts (moves it into `</body>`).
101
+ *
102
+ * @param component - Page name (e.g. `'index'`, `'about'`) or the module object.
103
+ * @param input - Render input (props, request, url, params, etc.). Can be a plain object (treated as props).
104
+ * @returns HTML string, or `null` if the page is not found or no static path match.
105
+ */
106
+ async render(component, input = {}) {
107
+ const renderInput = this.normalizeRenderInput(input);
108
+ const isRootRender = !renderInput.styles;
109
+ if (isRootRender) {
110
+ renderInput.styles = /* @__PURE__ */ new Set();
111
+ renderInput.scripts = /* @__PURE__ */ new Set();
112
+ renderInput.headScripts = /* @__PURE__ */ new Set();
113
+ }
114
+ const resolved = resolvePageTarget(component, this.pagesMap);
115
+ if (!resolved) return null;
116
+ let target = resolved.module;
117
+ const matchedPageName = resolved.pageName;
118
+ const dynamicParams = resolved.params;
119
+ if (typeof target === "function" && target.length === 0) target = await target();
120
+ if (typeof target.getStaticPaths === "function" && Object.keys(renderInput.props || {}).length === 0) {
121
+ const staticPaths = await target.getStaticPaths();
122
+ const combinedParams = {
123
+ ...dynamicParams,
124
+ ...renderInput.params || {}
125
+ };
126
+ const match = staticPaths.find((entry) => this.paramsMatch(entry.params, combinedParams));
127
+ if (!match) {
128
+ console.warn(`[aero] 404: Route params ${JSON.stringify(combinedParams)} not found in getStaticPaths for ${matchedPageName}`);
129
+ return null;
130
+ }
131
+ if (match.props) renderInput.props = match.props;
132
+ }
133
+ const routePath = renderInput.routePath || this.toRoutePath(matchedPageName);
134
+ const context = this.createContext({
135
+ props: renderInput.props || {},
136
+ slots: renderInput.slots || {},
137
+ request: renderInput.request,
138
+ url: renderInput.url,
139
+ params: {
140
+ ...dynamicParams,
141
+ ...renderInput.params || {}
142
+ },
143
+ routePath,
144
+ site: renderInput.site,
145
+ styles: renderInput.styles,
146
+ scripts: renderInput.scripts,
147
+ headScripts: renderInput.headScripts
148
+ });
149
+ let renderFn = target;
150
+ if (target.default) renderFn = target.default;
151
+ if (typeof renderFn === "function") {
152
+ let html = await renderFn(context);
153
+ if (isRootRender) {
154
+ if (html.includes("</html>")) {
155
+ const afterHtml = html.split("</html>")[1]?.trim();
156
+ if (afterHtml && html.includes("</body>")) {
157
+ html = html.split("</html>")[0] + "</html>";
158
+ html = html.replace("</body>", `\n${afterHtml}\n</body>`);
159
+ }
160
+ }
161
+ let headInjections = "";
162
+ if (context.styles && context.styles.size > 0) headInjections += Array.from(context.styles).join("\n") + "\n";
163
+ if (context.headScripts && context.headScripts.size > 0) headInjections += Array.from(context.headScripts).join("\n") + "\n";
164
+ if (headInjections) if (html.includes("</head>")) html = html.replace("</head>", `\n${headInjections}</head>`);
165
+ else if (html.includes("<body")) html = html.replace(/(<body[^>]*>)/i, `<head>\n${headInjections}</head>\n$1`);
166
+ else html = `${headInjections}${html}`;
167
+ if (context.scripts && context.scripts.size > 0) {
168
+ const scriptsHtml = Array.from(context.scripts).join("\n");
169
+ if (html.includes("</body>")) html = html.replace("</body>", `\n${scriptsHtml}\n</body>`);
170
+ else html = `${html}\n${scriptsHtml}`;
171
+ }
172
+ }
173
+ return html;
174
+ }
175
+ return "";
176
+ }
177
+ /**
178
+ * Render a child component (layout or component) with the given props and slots.
179
+ * Used by compiled templates via context.renderComponent.
180
+ *
181
+ * @param component - Render function or module with `default` render function.
182
+ * @param props - Props object for the component.
183
+ * @param slots - Named slot content (key → HTML string).
184
+ * @param input - Optional request/url/params for context; `headScripts` is not passed through.
185
+ * @returns HTML string from the component's render function, or empty string if not invokable.
186
+ */
187
+ async renderComponent(component, props = {}, slots = {}, input = {}) {
188
+ const context = this.createContext({
189
+ props,
190
+ slots,
191
+ request: input.request,
192
+ url: input.url,
193
+ params: input.params,
194
+ routePath: input.routePath || "/",
195
+ site: input.site,
196
+ styles: input.styles,
197
+ scripts: input.scripts,
198
+ headScripts: input.headScripts
199
+ });
200
+ if (typeof component === "function") return await component(context);
201
+ if (component && typeof component.default === "function") return await component.default(context);
202
+ return "";
203
+ }
204
+ };
205
+
206
+ //#endregion
207
+ export { Aero };
@@ -0,0 +1,19 @@
1
+ import { Aero } from "./index.mjs";
2
+
3
+ //#region src/runtime/instance.d.ts
4
+ /** Global slot for the singleton Aero instance; used so HMR re-execution reuses the same instance. */
5
+ declare global {
6
+ var __AERO_INSTANCE__: Aero | undefined;
7
+ var __AERO_LISTENERS__: Set<() => void> | undefined;
8
+ }
9
+ declare const aero: Aero;
10
+ /**
11
+ * Subscribe to update notifications (e.g. after globs or templates change).
12
+ * Used by the client entry to re-render on HMR.
13
+ *
14
+ * @param cb - Callback invoked when `notify()` runs (e.g. after this module re-executes).
15
+ * @returns Unsubscribe function that removes `cb` from the listener set.
16
+ */
17
+ declare const onUpdate: (cb: () => void) => () => boolean;
18
+ //#endregion
19
+ export { aero, onUpdate };
@@ -0,0 +1,45 @@
1
+ import { Aero } from "./index.mjs";
2
+
3
+ //#region src/runtime/instance.ts
4
+ /**
5
+ * Singleton Aero instance and HMR update subscription.
6
+ *
7
+ * @remarks
8
+ * Provides a single shared `Aero` instance and a listener set so the client entry can subscribe to
9
+ * "something changed" (e.g. template or glob updates). Uses `globalThis` so the instance survives
10
+ * Vite HMR re-execution. On load, runs Vite-specific `import.meta.glob` for pages, components, and
11
+ * layouts, registers them with the instance, then calls `notify()` so any existing subscribers
12
+ * (e.g. the client `mount()` HMR callback) can re-render. Only used in a Vite app context.
13
+ */
14
+ const instance = globalThis.__AERO_INSTANCE__ || new Aero();
15
+ const listeners = globalThis.__AERO_LISTENERS__ || /* @__PURE__ */ new Set();
16
+ const aero = instance;
17
+ /**
18
+ * Subscribe to update notifications (e.g. after globs or templates change).
19
+ * Used by the client entry to re-render on HMR.
20
+ *
21
+ * @param cb - Callback invoked when `notify()` runs (e.g. after this module re-executes).
22
+ * @returns Unsubscribe function that removes `cb` from the listener set.
23
+ */
24
+ const onUpdate = (cb) => {
25
+ listeners.add(cb);
26
+ return () => listeners.delete(cb);
27
+ };
28
+ /** Invoke all registered listeners. Called once after `registerPages` on load and after HMR re-run. */
29
+ const notify = () => {
30
+ listeners.forEach((cb) => cb());
31
+ };
32
+ if (!globalThis.__AERO_INSTANCE__) globalThis.__AERO_INSTANCE__ = instance;
33
+ if (!globalThis.__AERO_LISTENERS__) globalThis.__AERO_LISTENERS__ = listeners;
34
+ /** Eager globs so pages, layouts, and components are available synchronously for SSR/build. */
35
+ const components = import.meta.glob("@components/**/*.html", { eager: true });
36
+ const layouts = import.meta.glob("@layouts/*.html", { eager: true });
37
+ const pages = import.meta.glob("@pages/**/*.html", { eager: true });
38
+ aero.registerPages(components);
39
+ aero.registerPages(layouts);
40
+ aero.registerPages(pages);
41
+ notify();
42
+ if (import.meta.hot) import.meta.hot.accept();
43
+
44
+ //#endregion
45
+ export { aero, onUpdate };
@@ -0,0 +1,209 @@
1
+ import * as vite from "vite";
2
+
3
+ //#region src/types.d.ts
4
+ /**
5
+ * Shared type definitions for the Aero framework (compiler, runtime, Vite plugin).
6
+ *
7
+ * @remarks
8
+ * Grouped roughly by: config/dirs, compile/parse, resolver/aliases, routing, render context.
9
+ */
10
+ interface AeroDirs {
11
+ /** Site source directory; pages live at `client/pages` (default: `'client'`). */
12
+ client?: string;
13
+ /** Nitro server directory (default: `'server'`). */
14
+ server?: string;
15
+ /** Build output directory (default: `'dist'`). */
16
+ dist?: string;
17
+ }
18
+ /** One redirect rule: from path to URL, optional status (default 302). */
19
+ interface RedirectRule {
20
+ from: string;
21
+ to: string;
22
+ status?: number;
23
+ }
24
+ interface AeroOptions {
25
+ /** Enable Nitro server integration (default: `false`). */
26
+ server?: boolean;
27
+ /** API route prefix (default: `'/api'`). */
28
+ apiPrefix?: string;
29
+ /** Directory overrides. */
30
+ dirs?: AeroDirs;
31
+ /**
32
+ * Canonical site URL (e.g. `'https://example.com'`). Exposed as `import.meta.env.SITE` and
33
+ * as `Aero.site` in templates. Used for sitemap, RSS, and canonical links.
34
+ */
35
+ site?: string;
36
+ /**
37
+ * Redirect rules applied in dev (Vite) and when using the Nitro server (preview:api / production).
38
+ * For static-only deploys use host redirect config (_redirects, vercel.json, etc.).
39
+ */
40
+ redirects?: RedirectRule[];
41
+ /**
42
+ * Optional request-time middleware (redirects, rewrites, custom responses).
43
+ * Runs in dev before rendering; for production redirects use Nitro server middleware or `redirects` config.
44
+ */
45
+ middleware?: AeroMiddleware[];
46
+ /**
47
+ * Optional plugins to add to the static render server (e.g. content plugin when using aero:content).
48
+ * Merged after the core Aero plugins so pages that import aero:content resolve during static build.
49
+ */
50
+ staticServerPlugins?: vite.Plugin[];
51
+ }
52
+ /** Request context passed to middleware (url, request, route path, resolved page name, site). */
53
+ interface AeroRequestContext {
54
+ url: URL;
55
+ request: Request;
56
+ routePath: string;
57
+ pageName: string;
58
+ site?: string;
59
+ }
60
+ /** Result of middleware: redirect, rewrite render input, or send a custom response. */
61
+ type AeroMiddlewareResult = {
62
+ redirect: {
63
+ url: string;
64
+ status?: number;
65
+ };
66
+ } | {
67
+ rewrite: Partial<AeroRenderInput> & {
68
+ pageName?: string;
69
+ };
70
+ } | {
71
+ response: Response;
72
+ } | void;
73
+ /** Middleware handler: receives request context; returns redirect/rewrite/response or nothing to continue. */
74
+ type AeroMiddleware = (ctx: AeroRequestContext) => AeroMiddlewareResult | Promise<AeroMiddlewareResult>;
75
+ /** Options for the client-side `mount()` entry (see `core/src/entry-dev.ts`). */
76
+ interface MountOptions {
77
+ /** Root element: CSS selector or `HTMLElement`. Defaults to `#app`. */
78
+ target?: string | HTMLElement;
79
+ /** Called with the root element after mount and after each HMR re-render. */
80
+ onRender?: (root: HTMLElement) => void;
81
+ }
82
+ /**
83
+ * Single script entry: attrs (optional), content (body or virtual URL), optional pass:data expression.
84
+ * Used by parser, codegen, Vite plugin, and static build for client/inline/blocking script arrays.
85
+ */
86
+ interface ScriptEntry {
87
+ attrs?: string;
88
+ content: string;
89
+ passDataExpr?: string;
90
+ /** If true, client script is injected in <head> instead of before </body>. */
91
+ injectInHead?: boolean;
92
+ }
93
+ /**
94
+ * Input to the codegen compiler for a single template.
95
+ *
96
+ * @remarks
97
+ * Script arrays come from the parser; `root` and `resolvePath` from the build.
98
+ */
99
+ interface CompileOptions {
100
+ root: string;
101
+ /** Client script entries (plain `<script>`): after transform, `content` may be virtual URL. */
102
+ clientScripts?: ScriptEntry[];
103
+ /** Inline scripts (`is:inline`) to be emitted in the page. */
104
+ inlineScripts?: ScriptEntry[];
105
+ /** Blocking scripts (`is:blocking`) to be emitted in the page. */
106
+ blockingScripts?: ScriptEntry[];
107
+ /** Resolve import specifiers (e.g. `@components/foo`) from importer file path. */
108
+ resolvePath?: (specifier: string, importer: string) => string;
109
+ /** Importer file path (template) for resolution; required when resolvePath is used. */
110
+ importer?: string;
111
+ }
112
+ /** Options for the path resolver (e.g. resolving `@components/foo` to a file path). */
113
+ interface ResolverOptions {
114
+ root: string;
115
+ resolvePath?: (specifier: string, importer: string) => string;
116
+ importer?: string;
117
+ }
118
+ /**
119
+ * Result of parsing one HTML template.
120
+ *
121
+ * @remarks
122
+ * Produced by `parser.ts`. Extracted script blocks and the remaining template string for codegen.
123
+ */
124
+ interface ParseResult {
125
+ /** Single `<script is:build>` block, or `null` if none. */
126
+ buildScript: {
127
+ content: string;
128
+ } | null;
129
+ clientScripts: ScriptEntry[];
130
+ inlineScripts: ScriptEntry[];
131
+ blockingScripts: ScriptEntry[];
132
+ /** HTML after script blocks are stripped; used as input to codegen. */
133
+ template: string;
134
+ }
135
+ /** One path alias from tsconfig (e.g. find: `@components`, replacement: `.../src/components`). */
136
+ interface UserAlias {
137
+ find: string;
138
+ replacement: string;
139
+ }
140
+ /** Result of loading project path aliases (`utils/aliases.ts`). */
141
+ interface AliasResult {
142
+ aliases: UserAlias[];
143
+ /** Resolve specifier from importer file path using oxc-resolver. */
144
+ resolve: (specifier: string, importer: string) => string;
145
+ /** Project root (directory containing tsconfig.json) when a tsconfig was found. */
146
+ projectRoot?: string;
147
+ }
148
+ /** Head and body HTML fragments (e.g. from `runtime/client` `extractDocumentParts`). */
149
+ interface PageFragments {
150
+ head: string;
151
+ body: string;
152
+ }
153
+ /** Dynamic route segment key → value (e.g. `{ id: '42' }` for `/posts/42`). */
154
+ interface AeroRouteParams {
155
+ [key: string]: string;
156
+ }
157
+ /** One static path for pre-rendering (e.g. from static path discovery). */
158
+ interface StaticPathEntry {
159
+ params: AeroRouteParams;
160
+ props?: Record<string, any>;
161
+ }
162
+ /**
163
+ * Input passed into a page or layout render (request, url, params, etc.).
164
+ *
165
+ * @remarks
166
+ * Used by the runtime when calling the compiled render function and when rendering child components.
167
+ */
168
+ interface AeroRenderInput {
169
+ props?: Record<string, any>;
170
+ /** Named slot content (key → HTML string) for layout/page render. */
171
+ slots?: Record<string, string>;
172
+ request?: Request;
173
+ url?: URL | string;
174
+ params?: AeroRouteParams;
175
+ /** Resolved route path pattern (e.g. `'/posts/[id]'`) for the current request. */
176
+ routePath?: string;
177
+ /** Accumulated style URLs/labels for this request. */
178
+ styles?: Set<string>;
179
+ /** Accumulated script URLs/labels for this request. */
180
+ scripts?: Set<string>;
181
+ /** Scripts to inject in <head>. */
182
+ headScripts?: Set<string>;
183
+ /** Canonical site URL from config (e.g. `'https://example.com'`). Exposed as Aero.site in templates. */
184
+ site?: string;
185
+ }
186
+ /**
187
+ * Context object available inside compiled templates (`is:build`) and when rendering components.
188
+ *
189
+ * @remarks
190
+ * Includes `props`, `slots`, `renderComponent`, `request`, `url`, `params`, and optional style/script sets.
191
+ * The index signature allows extra keys (e.g. from content or page data).
192
+ */
193
+ interface AeroTemplateContext {
194
+ [key: string]: any;
195
+ props: Record<string, any>;
196
+ slots: Record<string, string>;
197
+ /** Used by codegen to emit calls that render a child component and return its HTML. */
198
+ renderComponent: (component: any, props?: Record<string, any>, slots?: Record<string, string>, context?: AeroRenderInput) => Promise<string>;
199
+ request: Request;
200
+ url: URL;
201
+ params: AeroRouteParams;
202
+ /** Canonical site URL from config (e.g. `'https://example.com'`). */
203
+ site?: string;
204
+ styles?: Set<string>;
205
+ scripts?: Set<string>;
206
+ headScripts?: Set<string>;
207
+ }
208
+ //#endregion
209
+ export { StaticPathEntry as _, AeroRenderInput as a, AeroTemplateContext as c, MountOptions as d, PageFragments as f, ScriptEntry as g, ResolverOptions as h, AeroOptions as i, AliasResult as l, RedirectRule as m, AeroMiddleware as n, AeroRequestContext as o, ParseResult as p, AeroMiddlewareResult as r, AeroRouteParams as s, AeroDirs as t, CompileOptions as u, UserAlias as v };
@@ -0,0 +1,2 @@
1
+ import { _ as StaticPathEntry, a as AeroRenderInput, c as AeroTemplateContext, d as MountOptions, f as PageFragments, g as ScriptEntry, h as ResolverOptions, i as AeroOptions, l as AliasResult, m as RedirectRule, n as AeroMiddleware, o as AeroRequestContext, p as ParseResult, r as AeroMiddlewareResult, s as AeroRouteParams, t as AeroDirs, u as CompileOptions, v as UserAlias } from "./types-CLHGhnGA.mjs";
2
+ export { AeroDirs, AeroMiddleware, AeroMiddlewareResult, AeroOptions, AeroRenderInput, AeroRequestContext, AeroRouteParams, AeroTemplateContext, AliasResult, CompileOptions, MountOptions, PageFragments, ParseResult, RedirectRule, ResolverOptions, ScriptEntry, StaticPathEntry, UserAlias };
package/dist/types.mjs ADDED
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,38 @@
1
+ import { l as AliasResult, v as UserAlias } from "../types-CLHGhnGA.mjs";
2
+
3
+ //#region src/vite/defaults.d.ts
4
+ /** Resolved directory paths (client, server, dist) after applying defaults. */
5
+ interface ResolvedAeroDirs {
6
+ client: string;
7
+ server: string;
8
+ dist: string;
9
+ }
10
+ //#endregion
11
+ //#region src/utils/aliases.d.ts
12
+ /**
13
+ * Build default path aliases for @pages, @layouts, @components from project root and dirs.
14
+ * Used when tsconfig is missing or does not define these keys so the runtime globs resolve.
15
+ */
16
+ declare function getDefaultAliases(root: string, dirs: ResolvedAeroDirs): UserAlias[];
17
+ /**
18
+ * Load path aliases from tsconfig.json at or above the given root.
19
+ *
20
+ * @param root - Project root directory (e.g. `process.cwd()` or Vite config root).
21
+ * @returns AliasResult with `aliases` for Vite resolve.alias and `resolve(specifier, importer)` for compiler/build.
22
+ */
23
+ declare function loadTsconfigAliases(root: string): AliasResult;
24
+ /**
25
+ * Merge framework default aliases (from dirs) with tsconfig-derived aliases.
26
+ * Defaults are applied first; any alias from aliasResult with the same `find` overwrites.
27
+ * Produces a resolve that tries merged aliases first, then falls back to the original resolver.
28
+ *
29
+ * Ensures @pages, @layouts, @components always exist so the runtime import.meta.glob patterns resolve.
30
+ *
31
+ * @param aliasResult - Result from loadTsconfigAliases (may have empty aliases when no tsconfig).
32
+ * @param root - Project root.
33
+ * @param dirs - Resolved client/layouts/components dirs.
34
+ * @returns AliasResult with merged aliases and a resolve that uses them.
35
+ */
36
+ declare function mergeWithDefaultAliases(aliasResult: AliasResult, root: string, dirs: ResolvedAeroDirs): AliasResult;
37
+ //#endregion
38
+ export { getDefaultAliases, loadTsconfigAliases, mergeWithDefaultAliases };