@stacksjs/stx 0.2.10 → 0.2.12

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 (129) hide show
  1. package/README.md +16 -11
  2. package/dist/a11y.d.ts +2 -1
  3. package/dist/analyzer.d.ts +4 -0
  4. package/dist/app-shell.d.ts +72 -0
  5. package/dist/app.d.ts +1 -0
  6. package/dist/broadcasting.d.ts +77 -0
  7. package/dist/build-assets.d.ts +32 -0
  8. package/dist/build-mode-detector.d.ts +26 -0
  9. package/dist/build.d.ts +31 -0
  10. package/dist/builtins/icon.d.ts +7 -0
  11. package/dist/builtins/index.d.ts +21 -0
  12. package/dist/builtins/stx-image.d.ts +2 -0
  13. package/dist/builtins/stx-link.d.ts +2 -0
  14. package/dist/builtins/stx-loading-indicator.d.ts +2 -0
  15. package/dist/bundle-analyzer/index.d.ts +2 -0
  16. package/dist/bundle-analyzer.js +20 -20
  17. package/dist/caching.d.ts +27 -0
  18. package/dist/cli.js +3942 -2608
  19. package/dist/client-helpers.d.ts +7 -3
  20. package/dist/client-script-bundler.d.ts +27 -0
  21. package/dist/client-script.d.ts +5 -1
  22. package/dist/client.d.ts +1 -0
  23. package/dist/component-hmr.d.ts +1 -0
  24. package/dist/component-processing.d.ts +107 -0
  25. package/dist/component-registry.d.ts +54 -0
  26. package/dist/component-renderer.d.ts +18 -0
  27. package/dist/components/StxImage.stx +12 -0
  28. package/dist/components/StxLink.stx +18 -8
  29. package/dist/composables/index.d.ts +7 -0
  30. package/dist/composables/use-broadcast-channel.d.ts +1 -0
  31. package/dist/composables/use-channel.d.ts +67 -0
  32. package/dist/composables/use-intersection-observer.d.ts +2 -0
  33. package/dist/composables/use-keyboard.d.ts +1 -0
  34. package/dist/composables/use-mouse.d.ts +1 -0
  35. package/dist/composables/use-router.d.ts +4 -0
  36. package/dist/composables/use-websocket.d.ts +1 -0
  37. package/dist/composables.d.ts +2 -0
  38. package/dist/composition-api.d.ts +1 -0
  39. package/dist/computed.d.ts +1 -0
  40. package/dist/config.d.ts +12 -1
  41. package/dist/craft-bridge.d.ts +6 -3
  42. package/dist/craft-components.d.ts +1 -0
  43. package/dist/craft.js +39 -33
  44. package/dist/deploy/index.d.ts +1 -0
  45. package/dist/dev-server/crosswind.d.ts +2 -5
  46. package/dist/dev-server/native-window.d.ts +19 -1
  47. package/dist/dev-server/serve-app.d.ts +15 -0
  48. package/dist/dev-server/serve-file.d.ts +3 -0
  49. package/dist/dev-server/serve-markdown.d.ts +3 -0
  50. package/dist/dev-server/serve-multi.d.ts +5 -0
  51. package/dist/dev-server/types.d.ts +2 -0
  52. package/dist/dev-server.d.ts +6 -40
  53. package/dist/devtools.d.ts +1 -0
  54. package/dist/directive-api.d.ts +1 -1
  55. package/dist/document-shell.d.ts +33 -0
  56. package/dist/error-boundaries.d.ts +1 -0
  57. package/dist/events.d.ts +1 -0
  58. package/dist/expressions.d.ts +38 -0
  59. package/dist/forms-validation.d.ts +2 -0
  60. package/dist/head.d.ts +1 -0
  61. package/dist/hot-reload.d.ts +1 -0
  62. package/dist/hydration-runtime.d.ts +1 -0
  63. package/dist/hydration.d.ts +1 -0
  64. package/dist/i18n.d.ts +3 -1
  65. package/dist/image-optimization/build-plugin.d.ts +1 -0
  66. package/dist/index.d.ts +22 -1
  67. package/dist/index.js +5571 -4182
  68. package/dist/inline-assets.d.ts +28 -0
  69. package/dist/internal-markdown.d.ts +0 -4
  70. package/dist/jsx-runtime.d.ts +1 -0
  71. package/dist/keep-alive.d.ts +1 -0
  72. package/dist/manifest.d.ts +41 -0
  73. package/dist/markdown.d.ts +1 -0
  74. package/dist/media/client/blur-up.d.ts +1 -0
  75. package/dist/media/client/lazy-load.d.ts +1 -0
  76. package/dist/media/client/upload-handler.d.ts +1 -0
  77. package/dist/media/shared/cache.d.ts +2 -0
  78. package/dist/media/video/index.d.ts +1 -0
  79. package/dist/media/video/processor/thumbnail.d.ts +1 -0
  80. package/dist/misc-directives.d.ts +49 -0
  81. package/dist/parser/directive-parser.d.ts +13 -0
  82. package/dist/performance-utils.d.ts +2 -0
  83. package/dist/placeholder.d.ts +45 -0
  84. package/dist/plugin-system.d.ts +32 -2
  85. package/dist/process.d.ts +11 -1
  86. package/dist/production-builder.d.ts +42 -0
  87. package/dist/production-server.d.ts +19 -0
  88. package/dist/props.d.ts +1 -0
  89. package/dist/pwa.js +3883 -2679
  90. package/dist/reactive.d.ts +2 -16
  91. package/dist/reactivity.d.ts +1 -0
  92. package/dist/render.d.ts +2 -1
  93. package/dist/router.d.ts +1 -1
  94. package/dist/runtime-injection.d.ts +20 -0
  95. package/dist/runtime.d.ts +2 -2
  96. package/dist/script-classifier.d.ts +35 -0
  97. package/dist/script-validation.d.ts +16 -0
  98. package/dist/server-bindings.d.ts +7 -0
  99. package/dist/server-components.d.ts +4 -0
  100. package/dist/signal-processing.d.ts +109 -0
  101. package/dist/signals-api.d.ts +309 -0
  102. package/dist/signals.d.ts +2 -309
  103. package/dist/spa-shell.d.ts +1 -0
  104. package/dist/ssg.js +3862 -2655
  105. package/dist/ssr.d.ts +1 -0
  106. package/dist/state-management.d.ts +27 -0
  107. package/dist/store-imports.d.ts +24 -0
  108. package/dist/store-loader.d.ts +16 -0
  109. package/dist/story/bun-test.d.ts +1 -0
  110. package/dist/story/compiled-output.d.ts +1 -0
  111. package/dist/story/interactions.d.ts +1 -0
  112. package/dist/story/renderer.d.ts +2 -0
  113. package/dist/story/setup.d.ts +1 -0
  114. package/dist/story/ui/code-panel.d.ts +1 -0
  115. package/dist/stx.d.ts +437 -0
  116. package/dist/style-scoping.d.ts +23 -0
  117. package/dist/template-compiler.d.ts +31 -0
  118. package/dist/template-hydrator.d.ts +18 -0
  119. package/dist/transitions.d.ts +1 -0
  120. package/dist/types/config-types.d.ts +62 -0
  121. package/dist/validator.d.ts +1 -0
  122. package/dist/variable-extractor.d.ts +1 -1
  123. package/dist/view-composers.d.ts +1 -0
  124. package/dist/virtual-scrolling.d.ts +1 -0
  125. package/dist/visual-testing.js +2 -2
  126. package/dist/web-components.d.ts +1 -0
  127. package/dist/x-element.d.ts +1 -0
  128. package/package.json +19 -7
  129. package/stx.d.ts +437 -0
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Check if a URL is external (http, https, or protocol-relative)
3
+ */
4
+ export declare function isExternalUrl(url: string): boolean;
5
+ /**
6
+ * Resolve an inline asset path relative to the template file.
7
+ *
8
+ * @param assetPath - The path from the src/href attribute
9
+ * @param templateDir - Directory containing the template
10
+ * @param filePath - Full path to the template file
11
+ * @returns Resolved absolute path, or null if not found
12
+ */
13
+ export declare function resolveInlinePath(assetPath: string, templateDir: string, _filePath: string): string | null;
14
+ /**
15
+ * Automatically inline local JS/CSS files.
16
+ *
17
+ * This function handles:
18
+ * - `<script src="./file.js"></script>` → `<script>...file contents...</script>`
19
+ * - `<link href="./file.css" rel="stylesheet">` → `<style>...file contents...</style>`
20
+ *
21
+ * Only local/relative paths are inlined. External URLs (http://, https://, //) are left as-is.
22
+ *
23
+ * @param template - The template string to process
24
+ * @param filePath - Path to the current template file (for resolving relative paths)
25
+ * @param dependencies - Set to track included file dependencies
26
+ * @returns Template with local assets inlined
27
+ */
28
+ export declare function processInlineAssets(template: string, filePath: string, dependencies: Set<string>): Promise<string>;
@@ -8,10 +8,6 @@ export declare function parseFrontmatter(content: string): FrontmatterResult;
8
8
  * Simple implementation that handles common markdown patterns
9
9
  */
10
10
  export declare function parseMarkdown(content: string, options?: MarkdownOptions): string;
11
- /**
12
- * Internal markdown utilities to replace ts-md dependency
13
- * Provides frontmatter parsing and markdown to HTML conversion
14
- */
15
11
  export declare interface FrontmatterResult {
16
12
  data: Record<string, unknown>
17
13
  content: string
@@ -88,4 +88,5 @@ export declare interface VNode {
88
88
  ref?: string | ((el: any) => void) | null
89
89
  }
90
90
  /** Function component type */
91
+ // eslint-disable-next-line pickier/no-unused-vars
91
92
  export type ComponentFunction = (props: Record<string, any>) => VNode | string | null;
@@ -36,6 +36,7 @@ export declare function onActivated(callback: (detail: { key: string; keepAliveI
36
36
  * Use in client-side scripts.
37
37
  */
38
38
  export declare function onDeactivated(callback: (detail: { key: string; keepAliveId: string }) => void): void;
39
+ /* eslint-disable prefer-const, style/max-statements-per-line, no-super-linear-backtracking, regexp/no-unused-capturing-group */
39
40
  /**
40
41
  * STX Keep-Alive
41
42
  *
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Generate a build manifest from compiled pages and assets.
3
+ */
4
+ export declare function generateManifest(routes: ManifestRoute[], assets: ManifestAssets, outputDir: string): BuildManifest;
5
+ /**
6
+ * Write the manifest to disk.
7
+ */
8
+ export declare function writeManifest(manifest: BuildManifest, outputDir: string): void;
9
+ /**
10
+ * Load and validate a build manifest from disk.
11
+ * Returns null if the manifest doesn't exist or is invalid.
12
+ */
13
+ export declare function loadManifest(outputDir: string): BuildManifest | null;
14
+ /**
15
+ * A route entry in the build manifest.
16
+ */
17
+ export declare interface ManifestRoute {
18
+ pattern: string
19
+ compiledPath: string
20
+ fragmentPath: string
21
+ isDynamic: boolean
22
+ hasParams: boolean
23
+ }
24
+ /**
25
+ * Asset entries in the build manifest.
26
+ */
27
+ export declare interface ManifestAssets {
28
+ runtime: string
29
+ router: string
30
+ css?: string
31
+ }
32
+ /**
33
+ * The complete build manifest.
34
+ */
35
+ export declare interface BuildManifest {
36
+ version: 1
37
+ buildTime: string
38
+ routes: ManifestRoute[]
39
+ assets: ManifestAssets
40
+ outputDir: string
41
+ }
@@ -2,6 +2,7 @@
2
2
  * Process markdown directives in templates
3
3
  * Converts markdown content to HTML
4
4
  */
5
+ // eslint-disable-next-line pickier/no-unused-vars
5
6
  export declare function processMarkdownDirectives(template: string, context: Record<string, any>, filePath?: string): Promise<string>;
6
7
  /**
7
8
  * Custom directive handler for markdown
@@ -45,6 +45,7 @@ export declare function generateBlurUpRuntime(): string;
45
45
  * Generate CSS for blur-up effect
46
46
  */
47
47
  export declare function generateBlurUpCSS(): string;
48
+ /* eslint-disable prefer-const, style/max-statements-per-line, no-super-linear-backtracking, regexp/no-unused-capturing-group */
48
49
  /**
49
50
  * STX Media - Client-Side Blur-Up Animation
50
51
  *
@@ -50,6 +50,7 @@ export declare function disconnectObserver(observer: IntersectionObserver): void
50
50
  * Generate the client-side lazy loading runtime script
51
51
  */
52
52
  export declare function generateLazyLoadRuntime(): string;
53
+ /* eslint-disable prefer-const, style/max-statements-per-line, no-super-linear-backtracking, regexp/no-unused-capturing-group */
53
54
  /**
54
55
  * STX Media - Client-Side Lazy Loading
55
56
  *
@@ -30,6 +30,7 @@ export declare function generateVideoPreview(file: File): Promise<string>;
30
30
  * Generate client-side upload handler runtime
31
31
  */
32
32
  export declare function generateUploadRuntime(): string;
33
+ /* eslint-disable prefer-const, style/max-statements-per-line, no-super-linear-backtracking, regexp/no-unused-capturing-group */
33
34
  /**
34
35
  * STX Media - Client-Side Upload Handler
35
36
  *
@@ -9,6 +9,7 @@ export declare function setCached<T>(src: string, options: Record<string, unknow
9
9
  /**
10
10
  * Clear cache for a specific source
11
11
  */
12
+ // eslint-disable-next-line pickier/no-unused-vars
12
13
  export declare function clearCacheForSource(src: string, type: 'image' | 'video', config?: CacheConfig): Promise<void>;
13
14
  /**
14
15
  * Clear entire cache
@@ -17,6 +18,7 @@ export declare function clearCache(type: 'image' | 'video' | 'all', config?: Cac
17
18
  /**
18
19
  * Get cache statistics
19
20
  */
21
+ // eslint-disable-next-line pickier/no-unused-vars
20
22
  export declare function getCacheStats(config?: CacheConfig): Promise<{
21
23
  memoryEntries: number
22
24
  diskEntries: { image: number; video: number }
@@ -35,6 +35,7 @@ export declare function renderVideoComponent(props: VideoProps | EnhancedVideoPr
35
35
  /**
36
36
  * Parse @video directive options (legacy - use videoDirective instead)
37
37
  */
38
+ // eslint-disable-next-line pickier/no-unused-vars
38
39
  export declare function parseVideoDirectiveOptions(content: string, params: Record<string, unknown>, context: Record<string, unknown>): VideoProps;
39
40
  /**
40
41
  * Extended video render context with ts-videos config
@@ -16,6 +16,7 @@ export declare function generateThumbnails(src: string, options: {
16
16
  /**
17
17
  * Generate sprite sheet for video scrubbing preview
18
18
  */
19
+ // eslint-disable-next-line pickier/no-unused-vars
19
20
  export declare function generateSpriteSheet(src: string, options: SpriteSheetConfig, outputDir: string, baseUrl: string): Promise<{
20
21
  url: string
21
22
  path: string
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Process @json directive to output JSON
3
+ */
4
+ export declare function processJsonDirective(template: string, context: Record<string, any>): string;
5
+ /**
6
+ * Process @once directive blocks.
7
+ * Primary deduplication is handled by processIncludes (context.__onceStore).
8
+ * This function only strips remaining @once/@endonce tags, keeping content.
9
+ */
10
+ export declare function processOnceDirective(template: string): string;
11
+ /**
12
+ * Process @memo directive — memoize template subtrees.
13
+ *
14
+ * Two shapes are supported:
15
+ *
16
+ * 1. Attribute form on an element:
17
+ * <div @memo="[count(), name()]">Expensive content</div>
18
+ * Transforms to `data-stx-memo="[count(), name()]"`. The signals runtime
19
+ * skips re-processing elements whose deps haven't changed.
20
+ *
21
+ * 2. Blade-style block form wrapping arbitrary markup:
22
+ * @memo([])
23
+ * <section>...marketing content...</section>
24
+ * @endmemo
25
+ * The block is transformed by injecting `data-stx-memo` onto the first
26
+ * opening tag inside the block (or wrapping in a <div> if the contents
27
+ * don't start with a single element). Both `@memo(...)` and `@endmemo`
28
+ * are stripped from the output.
29
+ */
30
+ export declare function processMemoDirective(template: string): string;
31
+ /**
32
+ * Process ref attributes for DOM element references (Vue-style).
33
+ *
34
+ * Transforms:
35
+ * <input ref="inputRef" />
36
+ * <input @ref="inputRef" />
37
+ *
38
+ * Into:
39
+ * <input data-stx-ref="inputRef" />
40
+ *
41
+ * The client-side runtime will automatically bind these to ref objects.
42
+ */
43
+ export declare function processRefAttributes(template: string): string;
44
+ /**
45
+ * Add x-cloak to HTML elements that contain unresolved {{ }} expressions.
46
+ * These expressions were preserved for client-side evaluation (signals, loop vars, etc.).
47
+ * x-cloak hides them until the JS runtime processes and reveals them — prevents FOUC.
48
+ */
49
+ export declare function addCloakToUnresolvedExpressions(html: string): string;
@@ -1,11 +1,16 @@
1
1
  /**
2
2
  * Extract a parenthesized expression from a string, handling nested parens
3
3
  * e.g., "func(a, fn(b, c))" -> { expression: "func(a, fn(b, c))", endPos: 17 }
4
+ *
5
+ * Returns `null` for the legacy callers; use `extractParenthesizedExpressionDetailed`
6
+ * when you need to know WHY extraction failed (helpful for directive error
7
+ * messages pointing at the source location of a malformed `@if(`).
4
8
  */
5
9
  export declare function extractParenthesizedExpression(source: string, startPos: number): {
6
10
  expression: string
7
11
  endPos: number
8
12
  } | null;
13
+ export declare function extractParenthesizedExpressionDetailed(source: string, startPos: number): ExtractParenResult;
9
14
  /**
10
15
  * Find the matching end tag for a directive, handling nested instances
11
16
  *
@@ -77,3 +82,11 @@ export declare interface ParsedSwitch {
77
82
  start: number
78
83
  end: number
79
84
  }
85
+ /**
86
+ * Structured variant of `extractParenthesizedExpression` — returns either a
87
+ * successful parse or a `{ ok: false, reason, pos }` record explaining the
88
+ * failure. Use this when emitting user-facing errors ("missing opening
89
+ * paren", "unclosed paren at column N", etc.).
90
+ */
91
+ export type ExtractParenResult = | { ok: true, expression: string, endPos: number }
92
+ | { ok: false, reason: 'missing-open-paren' | 'unclosed-paren', pos: number }
@@ -126,7 +126,9 @@ export declare interface BudgetViolation {
126
126
  /**
127
127
  * Performance budget violation handler type
128
128
  */
129
+ // eslint-disable-next-line pickier/no-unused-vars
129
130
  export type BudgetViolationHandler = (violation: BudgetViolation) => void;
131
+ /* eslint-disable prefer-const, style/max-statements-per-line, no-super-linear-backtracking, regexp/no-unused-capturing-group, pickier/no-unused-vars */
130
132
  /**
131
133
  * Performance optimization utilities for stx
132
134
  */
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Reset the placeholder counter and registry (for testing / between builds).
3
+ */
4
+ export declare function resetPlaceholders(): void;
5
+ /**
6
+ * Create a unique placeholder token and register the expression.
7
+ *
8
+ * @param type - The type of placeholder ('expr' for expressions, 'cond' for conditionals)
9
+ * @param expr - The original expression (stored in the registry for serve-time hydration)
10
+ * @returns A unique placeholder token string
11
+ */
12
+ export declare function createPlaceholder(type: 'expr' | 'cond' | 'raw', expr: string): string;
13
+ /**
14
+ * Get the registered placeholder map (all tokens created since last reset).
15
+ * Used by the template compiler to build the CompiledTemplate.placeholders field.
16
+ */
17
+ export declare function getPlaceholderRegistry(): PlaceholderMap;
18
+ /**
19
+ * Extract all placeholder tokens from compiled HTML.
20
+ *
21
+ * @returns A map of token → expression info
22
+ */
23
+ export declare function extractPlaceholders(html: string): PlaceholderMap;
24
+ /**
25
+ * Replace placeholder tokens with evaluated values.
26
+ * Uses simple string replacement for maximum performance.
27
+ *
28
+ * @param html - The compiled HTML with placeholder tokens
29
+ * @param values - Map of placeholder token → resolved value
30
+ * @returns HTML with all placeholders replaced
31
+ */
32
+ export declare function replacePlaceholders(html: string, values: Map<string, string>): string;
33
+ /**
34
+ * Check if HTML contains any placeholder tokens.
35
+ */
36
+ export declare function hasPlaceholders(html: string): boolean;
37
+ /**
38
+ * A map of placeholder tokens to their original expressions.
39
+ */
40
+ export declare interface PlaceholderMap {
41
+ [token: string]: {
42
+ type: 'expr' | 'cond' | 'raw'
43
+ expression: string
44
+ }
45
+ }
@@ -1,8 +1,22 @@
1
1
  import type { CustomDirective, StxOptions } from './types';
2
2
  /**
3
- * Create a plugin with type safety
3
+ * Define an stx plugin with type safety.
4
+ *
5
+ * Usage:
6
+ * ```typescript
7
+ * import { definePlugin } from 'stx'
8
+ *
9
+ * export default definePlugin({
10
+ * name: 'my-plugin',
11
+ * components: './components',
12
+ * functions: './functions',
13
+ * setup(options, stx) {
14
+ * stx.addRoute('/api/custom', handler)
15
+ * },
16
+ * })
17
+ * ```
4
18
  */
5
- export declare function definePlugin(plugin: StxPlugin): StxPlugin;
19
+ export declare function definePlugin(config: StxPlugin): StxPlugin;
6
20
  /**
7
21
  * Create a simple directive plugin
8
22
  */
@@ -75,6 +89,22 @@ export declare interface StxPlugin {
75
89
  registerFilters?: () => Record<string, (value: unknown, ...args: unknown[]) => unknown>
76
90
  onRegister?: (options: StxOptions) => void | Promise<void>
77
91
  onUnregister?: () => void | Promise<void>
92
+ components?: string
93
+ functions?: string
94
+ stores?: string
95
+ pages?: string
96
+ middleware?: string
97
+ setup?: (options: Record<string, any>, stx: PluginSetupContext) => void | Promise<void>
98
+ }
99
+ /**
100
+ * Context passed to plugin setup() function
101
+ */
102
+ export declare interface PluginSetupContext {
103
+ addDirective: (directive: CustomDirective) => void
104
+ addRoute: (path: string, handler: (req: Request) => Response | Promise<Response>) => void
105
+ addMiddleware: (middleware: any) => void
106
+ pluginDir: string
107
+ config: StxOptions
78
108
  }
79
109
  /**
80
110
  * Directive type identifier for beforeDirective/afterDirective hooks
package/dist/process.d.ts CHANGED
@@ -1 +1,11 @@
1
-
1
+ import { processJsonDirective, processOnceDirective } from './misc-directives';
2
+ import { validateClientScript } from './script-validation';
3
+ import type { StxOptions } from './types';
4
+ /**
5
+ * Process all template directives with enhanced error handling and performance monitoring
6
+ */
7
+ export declare function processDirectives(template: string, context: Record<string, any>, filePath: string, options: StxOptions, dependencies: Set<string>): Promise<string>;
8
+ // Re-export public API from extracted modules (preserves backwards compatibility)
9
+ export { injectRouterScript } from './runtime-injection';
10
+ export { processJsonDirective, processOnceDirective } from './misc-directives';
11
+ export { validateClientScript } from './script-validation';
@@ -0,0 +1,42 @@
1
+ import { type ManifestAssets } from './manifest';
2
+ /**
3
+ * Build the stx application for production.
4
+ *
5
+ * Produces a `.output/` directory with:
6
+ * - `public/__stx/` — fingerprinted runtime and router JS
7
+ * - `public/assets/` — bundled CSS
8
+ * - `public/<user files>` — copied verbatim from the project's `publicDir`
9
+ * (default: `public/`). Source images, fonts, robots.txt, sitemap.xml, etc.
10
+ * - `server/pages/` — compiled template JSON files
11
+ * - `server/fragments/` — SPA navigation fragments
12
+ * - `manifest.json` — route map and asset hashes
13
+ *
14
+ * Reads `stx.config.ts` once at the start for `publicDir`, `componentsDir`,
15
+ * `layoutsDir`, `partialsDir`, and `app.head`. Direct option overrides take
16
+ * precedence over the config file.
17
+ */
18
+ export declare function buildForProduction(options?: ProductionBuildOptions): Promise<ProductionBuildResult>;
19
+ /**
20
+ * Production build configuration.
21
+ *
22
+ * Most fields are optional and fall back to `stx.config.ts` if not provided.
23
+ * Resolution order for each field: explicit option → config file → default.
24
+ */
25
+ export declare interface ProductionBuildOptions {
26
+ root?: string
27
+ outputDir?: string
28
+ debug?: boolean
29
+ componentsDir?: string
30
+ partialsDir?: string
31
+ layoutsDir?: string
32
+ publicDir?: string
33
+ }
34
+ /**
35
+ * Result of a production build.
36
+ */
37
+ export declare interface ProductionBuildResult {
38
+ pageCount: number
39
+ assets: ManifestAssets
40
+ outputDir: string
41
+ duration: number
42
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Start the production server.
3
+ *
4
+ * Serves pre-built pages from .output/ with minimal per-request work:
5
+ * - Static assets: served from disk with immutable cache headers
6
+ * - SPA fragments: served from pre-extracted HTML files
7
+ * - Static pages: served directly (zero processing)
8
+ * - Dynamic pages: hydrated with request-time data
9
+ */
10
+ export declare function startProductionServer(options?: ProductionServerOptions): Promise<{ port: number, stop: () => void }>;
11
+ /**
12
+ * Production server configuration.
13
+ */
14
+ export declare interface ProductionServerOptions {
15
+ outputDir?: string
16
+ port?: number
17
+ onRequest?: (req: Request) => Response | Promise<Response> | null | Promise<null>
18
+ apiRoutes?: Record<string, (req: Request) => Response | Promise<Response>>
19
+ }
package/dist/props.d.ts CHANGED
@@ -164,6 +164,7 @@ export type ExtractPropTypes<T extends PropsDefinition<unknown>> = {
164
164
  : unknown
165
165
  }
166
166
  /** Event handler type */
167
+ // eslint-disable-next-line pickier/no-unused-vars
167
168
  export type EventHandler<T = unknown> = (payload: T) => void;
168
169
  /** Emit function type */
169
170
  export type EmitFn<E extends Record<string, unknown>> = <K extends keyof E>(