@ecopages/core 0.2.0-rc.8 → 0.2.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 (216) hide show
  1. package/README.md +39 -38
  2. package/package.json +22 -152
  3. package/src/adapters/README.md +11 -3
  4. package/src/adapters/abstract/application-adapter.d.ts +32 -36
  5. package/src/adapters/abstract/application-adapter.js +61 -47
  6. package/src/adapters/abstract/server-adapter.d.ts +14 -0
  7. package/src/adapters/abstract/server-adapter.js +10 -0
  8. package/src/adapters/abstract/ws-pattern-matcher.d.ts +0 -5
  9. package/src/adapters/abstract/ws-pattern-matcher.js +0 -9
  10. package/src/adapters/bun/create-app.d.ts +12 -16
  11. package/src/adapters/bun/create-app.js +25 -55
  12. package/src/adapters/bun/hmr-manager.d.ts +0 -1
  13. package/src/adapters/bun/hmr-manager.js +2 -4
  14. package/src/adapters/bun/server-adapter.d.ts +15 -21
  15. package/src/adapters/bun/server-adapter.js +33 -67
  16. package/src/adapters/bun/static-preview-host.d.ts +1 -0
  17. package/src/adapters/bun/static-preview-host.js +1 -1
  18. package/src/adapters/create-app.d.ts +63 -8
  19. package/src/adapters/create-app.js +62 -5
  20. package/src/adapters/node/create-app.d.ts +8 -12
  21. package/src/adapters/node/create-app.js +22 -14
  22. package/src/adapters/node/runtime-host.d.ts +10 -10
  23. package/src/adapters/node/runtime-host.js +13 -8
  24. package/src/adapters/node/server-adapter-dependencies.d.ts +2 -10
  25. package/src/adapters/node/server-adapter-dependencies.js +8 -13
  26. package/src/adapters/node/server-adapter.d.ts +30 -32
  27. package/src/adapters/node/server-adapter.js +59 -65
  28. package/src/adapters/shared/hmr/shared-hmr-manager.d.ts +0 -4
  29. package/src/adapters/shared/hmr/shared-hmr-manager.js +0 -12
  30. package/src/adapters/shared/http/api-request-pipeline.d.ts +27 -1
  31. package/src/adapters/shared/http/api-request-pipeline.js +31 -16
  32. package/src/adapters/shared/http/explicit-static-route-matcher.js +5 -2
  33. package/src/adapters/shared/http/fs-server-response-factory.d.ts +2 -9
  34. package/src/adapters/shared/http/fs-server-response-factory.js +5 -33
  35. package/src/adapters/shared/http/fs-server-response-matcher.d.ts +24 -24
  36. package/src/adapters/shared/http/fs-server-response-matcher.js +59 -83
  37. package/src/adapters/shared/runtime/application-adapter.d.ts +1 -0
  38. package/src/adapters/shared/runtime/application-adapter.js +12 -0
  39. package/src/adapters/shared/runtime/bind-runtime-server.d.ts +17 -0
  40. package/src/adapters/shared/runtime/bind-runtime-server.js +50 -0
  41. package/src/adapters/shared/runtime/collect-dev-prewarm-plan.d.ts +1 -3
  42. package/src/adapters/shared/runtime/collect-dev-prewarm-plan.js +1 -4
  43. package/src/adapters/shared/runtime/port-manager-default-prompt.d.ts +6 -0
  44. package/src/adapters/shared/runtime/port-manager-default-prompt.js +41 -0
  45. package/src/adapters/shared/runtime/port-manager.d.ts +3 -3
  46. package/src/adapters/shared/runtime/port-manager.js +14 -45
  47. package/src/adapters/shared/runtime/runtime-app-bootstrap.d.ts +0 -10
  48. package/src/adapters/shared/runtime/runtime-app-bootstrap.js +0 -7
  49. package/src/adapters/shared/runtime/runtime-host.d.ts +5 -2
  50. package/src/adapters/shared/runtime/runtime-server-lifecycle.d.ts +1 -1
  51. package/src/adapters/shared/runtime/runtime-server-lifecycle.js +1 -1
  52. package/src/adapters/shared/runtime/server-adapter.d.ts +26 -5
  53. package/src/adapters/shared/runtime/server-adapter.js +35 -8
  54. package/src/adapters/shared/runtime/server-route-handler.js +11 -3
  55. package/src/adapters/shared/runtime/server-static-builder.d.ts +9 -3
  56. package/src/adapters/shared/runtime/server-static-builder.js +59 -37
  57. package/src/adapters/shared/ws/node-http-websocket-upgrades.d.ts +9 -1
  58. package/src/adapters/shared/ws/node-http-websocket-upgrades.js +8 -2
  59. package/src/build/README.md +12 -8
  60. package/src/build/cache/cache-constants.d.ts +0 -2
  61. package/src/build/cache/cache-constants.js +0 -2
  62. package/src/build/cache/cache-keys.d.ts +0 -2
  63. package/src/build/cache/cache-keys.js +0 -2
  64. package/src/build/cache/output-imports.d.ts +35 -0
  65. package/src/build/cache/output-imports.js +87 -0
  66. package/src/build/cache/pages-unified-graph-build.d.ts +15 -1
  67. package/src/build/cache/pages-unified-graph-build.js +73 -22
  68. package/src/build/cache/production-build-cache.d.ts +2 -2
  69. package/src/build/cache/production-build-cache.js +2 -2
  70. package/src/build/cache/server-entry-build-cache.d.ts +25 -3
  71. package/src/build/cache/server-entry-build-cache.js +129 -13
  72. package/src/build/contracts/build-contracts.d.ts +1 -13
  73. package/src/build/rolldown/runtime-build-output-normalizer.js +3 -6
  74. package/src/build/runtime/build-request-identity.d.ts +2 -6
  75. package/src/build/runtime/build-request-identity.js +2 -8
  76. package/src/build/runtime/build-request-policy.js +1 -1
  77. package/src/build/runtime/deduping-build-executor.d.ts +0 -1
  78. package/src/build/runtime/deduping-build-executor.js +0 -1
  79. package/src/build/server-bundle-publication.d.ts +14 -0
  80. package/src/build/server-bundle-publication.js +49 -0
  81. package/src/cache/index.d.ts +1 -1
  82. package/src/cache/index.js +1 -1
  83. package/src/cache/module-parse-cache.d.ts +2 -29
  84. package/src/cache/module-parse-cache.js +6 -39
  85. package/src/config/README.md +17 -2
  86. package/src/config/apply-user-config.d.ts +8 -0
  87. package/src/config/apply-user-config.js +68 -0
  88. package/src/config/config-builder.d.ts +11 -1
  89. package/src/config/config-builder.js +53 -12
  90. package/src/config/constants.d.ts +4 -4
  91. package/src/config/constants.js +4 -4
  92. package/src/config/define-config.d.ts +9 -0
  93. package/src/config/define-config.js +10 -0
  94. package/src/config/index.d.ts +5 -0
  95. package/src/config/index.js +4 -0
  96. package/src/config/is-finalized-app-config.d.ts +6 -0
  97. package/src/config/is-finalized-app-config.js +11 -0
  98. package/src/config/load-eco-config.d.ts +21 -0
  99. package/src/config/load-eco-config.js +107 -0
  100. package/src/config/resolve-eco-config-path.d.ts +32 -0
  101. package/src/config/resolve-eco-config-path.js +58 -0
  102. package/src/config/server-config-bundle.d.ts +25 -0
  103. package/src/config/server-config-bundle.js +148 -0
  104. package/src/config/user-config-types.d.ts +170 -0
  105. package/src/config/user-config-types.js +1 -0
  106. package/src/dev/README.md +4 -0
  107. package/src/dev/development-restart-watch-paths.d.ts +13 -0
  108. package/src/dev/development-restart-watch-paths.js +37 -0
  109. package/src/dev/development-restart.d.ts +13 -0
  110. package/src/dev/development-restart.js +21 -0
  111. package/src/dev/host-runtime.d.ts +0 -1
  112. package/src/dev/host-runtime.js +0 -3
  113. package/src/dev/sc-server.d.ts +4 -1
  114. package/src/dev/sc-server.js +11 -20
  115. package/src/dev/transform-server/dev-transform-import-rewriter.js +2 -2
  116. package/src/eco/eco.js +4 -0
  117. package/src/errors/http-error-page-contract.d.ts +77 -0
  118. package/src/errors/http-error-page-contract.js +106 -0
  119. package/src/hmr/hmr-file-change-prep.d.ts +0 -1
  120. package/src/hmr/hmr-file-change-prep.js +2 -5
  121. package/src/hmr/hmr-strategy.d.ts +3 -8
  122. package/src/hmr/hmr-strategy.js +3 -8
  123. package/src/index.browser.d.ts +1 -2
  124. package/src/index.browser.js +1 -2
  125. package/src/index.d.ts +5 -6
  126. package/src/index.js +5 -6
  127. package/src/islands/island-host.d.ts +0 -9
  128. package/src/islands/island-host.js +1 -13
  129. package/src/plugins/component-import-discovery.js +2 -2
  130. package/src/plugins/eco-component-meta-plugin.js +5 -5
  131. package/src/plugins/integration-plugin.d.ts +0 -1
  132. package/src/plugins/integration-plugin.js +0 -4
  133. package/src/plugins/processor.d.ts +6 -2
  134. package/src/route-renderer/README.md +4 -0
  135. package/src/{adapters/shared/http/explicit-static-render-preparation.d.ts → route-renderer/explicit-view-render-preparation.d.ts} +3 -3
  136. package/src/route-renderer/orchestration/custom-element-scripts/README.md +2 -2
  137. package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preloader.d.ts +14 -2
  138. package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preloader.js +12 -5
  139. package/src/route-renderer/orchestration/custom-element-scripts/custom-element-server-module-importer.d.ts +8 -0
  140. package/src/route-renderer/orchestration/custom-element-scripts/custom-element-server-module-importer.js +19 -0
  141. package/src/route-renderer/orchestration/document-shell/document-shell-render.service.js +1 -4
  142. package/src/route-renderer/orchestration/foreign-child/foreign-subtree-execution.service.d.ts +25 -24
  143. package/src/route-renderer/orchestration/foreign-child/foreign-subtree-execution.service.js +18 -20
  144. package/src/route-renderer/orchestration/integration-renderer.d.ts +24 -7
  145. package/src/route-renderer/orchestration/integration-renderer.js +44 -33
  146. package/src/route-renderer/orchestration/integration-renderer.test-fixtures.js +1 -1
  147. package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-session.d.ts +1 -1
  148. package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-session.js +1 -1
  149. package/src/route-renderer/route-renderer.d.ts +9 -0
  150. package/src/route-renderer/route-renderer.js +18 -0
  151. package/src/services/README.md +2 -1
  152. package/src/services/assets/browser-bundle.service.d.ts +1 -6
  153. package/src/services/error-pages/README.md +9 -0
  154. package/src/services/error-pages/default-error-pages.d.ts +39 -0
  155. package/src/services/error-pages/default-error-pages.js +199 -0
  156. package/src/services/error-pages/error-page-renderer.d.ts +58 -0
  157. package/src/services/error-pages/error-page-renderer.js +146 -0
  158. package/src/services/error-pages/semantic-error-page-exporter.d.ts +23 -0
  159. package/src/services/error-pages/semantic-error-page-exporter.js +35 -0
  160. package/src/services/html/html-rewriter.d.ts +77 -0
  161. package/src/services/html/html-rewriter.js +751 -0
  162. package/src/services/html/html-rewriter.parity.test.bun.d.ts +1 -0
  163. package/src/services/html/html-rewriter.parity.test.bun.js +74 -0
  164. package/src/services/html/html-transformer.service.d.ts +29 -42
  165. package/src/services/html/html-transformer.service.js +85 -157
  166. package/src/services/invalidation/development-invalidation.service.d.ts +9 -20
  167. package/src/services/invalidation/development-invalidation.service.js +26 -39
  168. package/src/services/module-loading/README.md +20 -15
  169. package/src/services/module-loading/app-module-loader.service.d.ts +0 -2
  170. package/src/services/module-loading/app-server-module-transpiler.service.d.ts +1 -1
  171. package/src/services/module-loading/app-server-module-transpiler.service.js +2 -10
  172. package/src/services/module-loading/collection-server-module-build.service.d.ts +0 -1
  173. package/src/services/module-loading/collection-server-module-build.service.js +0 -3
  174. package/src/services/module-loading/host-module-loader-registry.d.ts +0 -1
  175. package/src/services/module-loading/host-module-loader-registry.js +0 -3
  176. package/src/services/module-loading/route-module-build-cache-registry.d.ts +0 -4
  177. package/src/services/module-loading/route-module-build-cache-registry.js +0 -4
  178. package/src/services/module-loading/route-module-build-cache.store.d.ts +8 -0
  179. package/src/services/module-loading/route-module-build-cache.store.js +25 -7
  180. package/src/services/module-loading/route-module-build-manifest.d.ts +12 -1
  181. package/src/services/module-loading/route-module-build-manifest.js +7 -3
  182. package/src/services/module-loading/route-module-dependency-hasher.d.ts +3 -2
  183. package/src/services/module-loading/route-module-dependency-hasher.js +13 -1
  184. package/src/services/module-loading/server-module-transpiler.service.d.ts +1 -15
  185. package/src/services/module-loading/server-module-transpiler.service.js +0 -24
  186. package/src/services/module-loading/view-module-loader.d.ts +10 -0
  187. package/src/services/module-loading/view-module-loader.js +46 -0
  188. package/src/services/runtime-state/entrypoint-dependency-graph.service.js +0 -12
  189. package/src/services/runtime-state/server-invalidation-state.service.d.ts +4 -2
  190. package/src/services/runtime-state/server-invalidation-state.service.js +7 -14
  191. package/src/static-site-generator/README.md +12 -8
  192. package/src/static-site-generator/static-site-generator.d.ts +3 -2
  193. package/src/static-site-generator/static-site-generator.js +17 -3
  194. package/src/types/internal-types.d.ts +1 -38
  195. package/src/types/public-types.d.ts +28 -130
  196. package/src/watchers/project-watcher.d.ts +9 -16
  197. package/src/watchers/project-watcher.js +35 -28
  198. package/src/watchers/project-watcher.test-helpers.d.ts +10 -1
  199. package/src/watchers/project-watcher.test-helpers.js +12 -0
  200. package/src/adapters/abstract/router-adapter.d.ts +0 -26
  201. package/src/adapters/abstract/router-adapter.js +0 -13
  202. package/src/adapters/bun/index.d.ts +0 -2
  203. package/src/adapters/bun/index.js +0 -2
  204. package/src/adapters/index.d.ts +0 -2
  205. package/src/adapters/index.js +0 -2
  206. package/src/eco/eco.utils.d.ts +0 -1
  207. package/src/eco/eco.utils.js +0 -1
  208. package/src/services/cache/index.d.ts +0 -9
  209. package/src/services/cache/index.js +0 -8
  210. package/src/services/html/html-rewriter-provider.service.d.ts +0 -40
  211. package/src/services/html/html-rewriter-provider.service.js +0 -68
  212. package/src/services/module-loading/route-module-build-cache.d.ts +0 -4
  213. package/src/services/module-loading/route-module-build-cache.js +0 -3
  214. package/src/services/runtime-state/dev-graph.service.d.ts +0 -118
  215. package/src/services/runtime-state/dev-graph.service.js +0 -170
  216. /package/src/{adapters/shared/http/explicit-static-render-preparation.js → route-renderer/explicit-view-render-preparation.js} +0 -0
@@ -1,10 +1,11 @@
1
1
  import type { Server as NodeHttpServer } from 'node:http';
2
2
  import type { Server, WebSocketHandler } from 'bun';
3
3
  import type { EcoPagesAppConfig } from '../../types/internal-types.js';
4
- import type { ApiHandler, ErrorHandler, StaticRoute, EcopagesWebSocketHandler } from '../../types/public-types.js';
4
+ import type { ApiHandler, ErrorHandler, StaticRoute, ErrorPageLoaders, EcopagesWebSocketHandler } from '../../types/public-types.js';
5
5
  import { SharedServerAdapter } from '../shared/runtime/server-adapter.js';
6
6
  import type { ServerAdapterResult } from '../abstract/server-adapter.js';
7
7
  import type { StaticPreviewHost } from '../shared/runtime/static-preview-host.js';
8
+ import { type WebSocketUpgradeOptions } from '../shared/ws/node-http-websocket-upgrades.js';
8
9
  import { ClientBridge } from './client-bridge.js';
9
10
  import { HmrManager } from './hmr-manager.js';
10
11
  type BunServerInstance = Server<unknown>;
@@ -32,6 +33,7 @@ export interface BunServerAdapterParams {
32
33
  serveOptions: BunServeAdapterServerOptions;
33
34
  apiHandlers?: ApiHandler<string, Request, BunServerInstance>[];
34
35
  staticRoutes?: StaticRoute[];
36
+ errorPageLoaders?: ErrorPageLoaders;
35
37
  errorHandler?: ErrorHandler;
36
38
  websocketHandlers?: Map<string, EcopagesWebSocketHandler<any, any>>;
37
39
  options?: {
@@ -40,6 +42,7 @@ export interface BunServerAdapterParams {
40
42
  hostOwnsDevClient?: boolean;
41
43
  deferRuntimeAssetSetup?: boolean;
42
44
  allowPortFallback?: boolean;
45
+ onDevelopmentRestart?: (changedFile: string) => Promise<void>;
43
46
  hmrManager?: HmrManager;
44
47
  bridge?: ClientBridge;
45
48
  previewHost?: StaticPreviewHost;
@@ -55,9 +58,7 @@ export interface BunServerAdapterResult extends ServerAdapterResult {
55
58
  servePreviewOnly: () => Promise<string | undefined>;
56
59
  completeInitialization: (server?: BunServerInstance | null) => Promise<void>;
57
60
  handleRequest: (request: Request) => Promise<Response>;
58
- attachUserWebSocketUpgrades: (server: NodeHttpServer, options?: {
59
- passthroughUnmatched?: boolean;
60
- }) => void;
61
+ attachUserWebSocketUpgrades: (server: NodeHttpServer, options?: WebSocketUpgradeOptions) => void;
61
62
  dispose: () => Promise<void>;
62
63
  }
63
64
  /**
@@ -76,6 +77,7 @@ export declare class BunServerAdapter extends SharedServerAdapter<BunServerAdapt
76
77
  serveOptions: BunServeAdapterServerOptions;
77
78
  protected apiHandlers: ApiHandler<string, Request, BunServerInstance>[];
78
79
  protected staticRoutes: StaticRoute[];
80
+ protected errorPageLoaders: ErrorPageLoaders;
79
81
  protected errorHandler?: ErrorHandler;
80
82
  private bridge;
81
83
  hmrManager: HmrManager;
@@ -86,6 +88,7 @@ export declare class BunServerAdapter extends SharedServerAdapter<BunServerAdapt
86
88
  private adapterDisposed;
87
89
  private readonly deferRuntimeAssetSetup;
88
90
  private readonly allowPortFallback;
91
+ private readonly onDevelopmentRestart?;
89
92
  private readonly previewHost;
90
93
  /**
91
94
  * Reference to the application-level WebSocket handlers map.
@@ -124,7 +127,7 @@ export declare class BunServerAdapter extends SharedServerAdapter<BunServerAdapt
124
127
  * is constructed, those collaborators are mandatory because the adapter cannot
125
128
  * initialize Bun HMR or preview flows without them.
126
129
  */
127
- constructor({ appConfig, runtimeOrigin, serveOptions, apiHandlers, staticRoutes, errorHandler, websocketHandlers, options, hostOwnsDevClient, deferRuntimeAssetSetup, allowPortFallback, hmrManager, bridge, previewHost, }: BunServerAdapterParams & {
130
+ constructor({ appConfig, runtimeOrigin, serveOptions, apiHandlers, staticRoutes, errorPageLoaders, errorHandler, websocketHandlers, options, hostOwnsDevClient, deferRuntimeAssetSetup, allowPortFallback, onDevelopmentRestart, hmrManager, bridge, previewHost, }: BunServerAdapterParams & {
128
131
  hmrManager: HmrManager;
129
132
  bridge: ClientBridge;
130
133
  previewHost: StaticPreviewHost;
@@ -132,9 +135,7 @@ export declare class BunServerAdapter extends SharedServerAdapter<BunServerAdapt
132
135
  /**
133
136
  * Wires user WebSocket routes onto a Node HTTP server used by host integrations.
134
137
  */
135
- attachUserWebSocketUpgrades(server: NodeHttpServer, options?: {
136
- passthroughUnmatched?: boolean;
137
- }): void;
138
+ attachUserWebSocketUpgrades(server: NodeHttpServer, options?: WebSocketUpgradeOptions): void;
138
139
  /**
139
140
  * Initializes the server adapter's core runtime components.
140
141
  */
@@ -189,9 +190,9 @@ export declare class BunServerAdapter extends SharedServerAdapter<BunServerAdapt
189
190
  * Composes the base Bun server settings that all runtime modes build from.
190
191
  *
191
192
  * @remarks
192
- * This method centralizes the Bun-specific error boundary. It preserves the
193
- * shared route pipeline while still allowing adapter-level custom error-handler
194
- * execution and `HttpError` passthrough.
193
+ * The `app.onError` boundary lives in {@link handleRequest}. Bun's `error`
194
+ * hook only fires if that boundary itself throws, so it answers with a plain
195
+ * 500 rather than rendering anything that could fail again.
195
196
  */
196
197
  private buildServerSettings;
197
198
  /**
@@ -241,8 +242,9 @@ export declare class BunServerAdapter extends SharedServerAdapter<BunServerAdapt
241
242
  *
242
243
  * @remarks
243
244
  * HMR HTML injection for API and page responses is owned by
244
- * `SharedServerAdapter.handleSharedRequest`. This method only maps the
245
- * request into the shared pipeline.
245
+ * `SharedServerAdapter.handleSharedRequest`. This method waits for
246
+ * initialization, maps the request into the shared pipeline, and sends any
247
+ * escaped error through the shared `app.onError` boundary.
246
248
  */
247
249
  handleRequest(request: Request): Promise<Response>;
248
250
  /**
@@ -250,14 +252,6 @@ export declare class BunServerAdapter extends SharedServerAdapter<BunServerAdapt
250
252
  * Prevents race conditions during startup.
251
253
  */
252
254
  private waitForInitialization;
253
- /**
254
- * Handles HTTP requests from the router adapter.
255
- */
256
- handleResponse(request: Request): Promise<Response>;
257
- /**
258
- * Handles requests that do not match any routes.
259
- */
260
- private handleNoMatch;
261
255
  }
262
256
  /**
263
257
  * Creates the Bun server adapter and fills in the runtime-specific collaborators
@@ -1,8 +1,7 @@
1
1
  import path from 'node:path';
2
2
  import { DEFAULT_ECOPAGES_HOSTNAME, DEFAULT_ECOPAGES_PORT } from '../../config/constants.js';
3
3
  import { appLogger } from '../../global/app-logger.js';
4
- import { HttpError } from '../../errors/http-error.js';
5
- import { createRequire } from '../../utils/locals-utils.js';
4
+ import { entryWatcherOwnsConfig } from '../../dev/development-restart.js';
6
5
  import { findWebSocketRoute } from '../abstract/ws-pattern-matcher.js';
7
6
  import { fileSystem } from '@ecopages/file-system';
8
7
  import { setupAppRuntimePlugins } from '../../build/build-adapter.js';
@@ -10,9 +9,8 @@ import { installBuildRuntime } from '../../build/runtime/build-runtime.js';
10
9
  import { StaticSiteGenerator } from '../../static-site-generator/static-site-generator.js';
11
10
  import { ProjectWatcher } from '../../watchers/project-watcher.js';
12
11
  import { SharedServerAdapter } from '../shared/runtime/server-adapter.js';
13
- import { ApiResponseBuilder } from '../shared/http/api-response.js';
14
12
  import { ServerStaticBuilder } from '../shared/runtime/server-static-builder.js';
15
- import { attachNodeHttpWebSocketUpgrades } from '../shared/ws/node-http-websocket-upgrades.js';
13
+ import { attachNodeHttpWebSocketUpgrades, } from '../shared/ws/node-http-websocket-upgrades.js';
16
14
  import { createBunUserWebSocketLifecycle } from './bun-user-websocket-lifecycle.js';
17
15
  import { createEcopagesSocket } from '../shared/ws/websocket-lifecycle.js';
18
16
  import { resolveServeRuntimeOrigin } from '../shared/runtime/runtime-app-bootstrap.js';
@@ -35,6 +33,7 @@ import { BunStaticPreviewHost } from './static-preview-host.js';
35
33
  export class BunServerAdapter extends SharedServerAdapter {
36
34
  apiHandlers;
37
35
  staticRoutes;
36
+ errorPageLoaders;
38
37
  errorHandler;
39
38
  bridge;
40
39
  hmrManager;
@@ -44,6 +43,7 @@ export class BunServerAdapter extends SharedServerAdapter {
44
43
  adapterDisposed = false;
45
44
  deferRuntimeAssetSetup;
46
45
  allowPortFallback;
46
+ onDevelopmentRestart;
47
47
  previewHost;
48
48
  /**
49
49
  * Reference to the application-level WebSocket handlers map.
@@ -100,12 +100,14 @@ export class BunServerAdapter extends SharedServerAdapter {
100
100
  * is constructed, those collaborators are mandatory because the adapter cannot
101
101
  * initialize Bun HMR or preview flows without them.
102
102
  */
103
- constructor({ appConfig, runtimeOrigin, serveOptions, apiHandlers, staticRoutes, errorHandler, websocketHandlers, options, hostOwnsDevClient, deferRuntimeAssetSetup, allowPortFallback, hmrManager, bridge, previewHost, }) {
103
+ constructor({ appConfig, runtimeOrigin, serveOptions, apiHandlers, staticRoutes, errorPageLoaders, errorHandler, websocketHandlers, options, hostOwnsDevClient, deferRuntimeAssetSetup, allowPortFallback, onDevelopmentRestart, hmrManager, bridge, previewHost, }) {
104
104
  super({ appConfig, runtimeOrigin, serveOptions, options });
105
105
  this.deferRuntimeAssetSetup = deferRuntimeAssetSetup === true;
106
106
  this.allowPortFallback = allowPortFallback !== false;
107
+ this.onDevelopmentRestart = onDevelopmentRestart;
107
108
  this.apiHandlers = apiHandlers || [];
108
109
  this.staticRoutes = staticRoutes || [];
110
+ this.errorPageLoaders = errorPageLoaders ?? {};
109
111
  this.errorHandler = errorHandler;
110
112
  this.bridge = bridge;
111
113
  this.hmrManager = hmrManager;
@@ -190,6 +192,7 @@ export class BunServerAdapter extends SharedServerAdapter {
190
192
  }
191
193
  await this.createSharedWatchRefreshCallback({
192
194
  staticRoutes: this.staticRoutes,
195
+ errorPageLoaders: this.errorPageLoaders,
193
196
  hmrManager: this.hmrManager,
194
197
  onRoutesReady: () => {
195
198
  const options = this.getServerOptions({ enableHmr: true });
@@ -209,6 +212,8 @@ export class BunServerAdapter extends SharedServerAdapter {
209
212
  hmrManager: this.hmrManager,
210
213
  bridge: this.bridge,
211
214
  hostOwnsDevClient: this.hostOwnsDevClient,
215
+ onRestartRequest: this.onDevelopmentRestart,
216
+ entryWatcherOwnsConfig: entryWatcherOwnsConfig(),
212
217
  });
213
218
  this.projectWatcher = watcher;
214
219
  await watcher.createWatcherSubscription();
@@ -320,59 +325,22 @@ export class BunServerAdapter extends SharedServerAdapter {
320
325
  * Composes the base Bun server settings that all runtime modes build from.
321
326
  *
322
327
  * @remarks
323
- * This method centralizes the Bun-specific error boundary. It preserves the
324
- * shared route pipeline while still allowing adapter-level custom error-handler
325
- * execution and `HttpError` passthrough.
328
+ * The `app.onError` boundary lives in {@link handleRequest}. Bun's `error`
329
+ * hook only fires if that boundary itself throws, so it answers with a plain
330
+ * 500 rather than rendering anything that could fail again.
326
331
  */
327
332
  buildServerSettings() {
328
333
  const serverOptions = { ...this.serveOptions };
329
- const handleNoMatch = this.handleNoMatch.bind(this);
330
- const waitForInit = this.waitForInitialization.bind(this);
331
334
  const handleReq = this.handleRequest.bind(this);
332
- const errorHandler = this.errorHandler;
333
- const getCacheService = () => this.getCacheService();
334
- const getRenderContext = () => this.getRenderContext();
335
335
  appLogger.debug(`[BunServerAdapter] Building server settings`);
336
336
  const finalOptions = {
337
337
  ...serverOptions,
338
- async fetch(request, _server) {
339
- try {
340
- await waitForInit();
341
- return await handleReq(request);
342
- }
343
- catch (error) {
344
- if (error instanceof Response)
345
- return error;
346
- if (errorHandler) {
347
- try {
348
- const locals = {};
349
- const context = {
350
- request,
351
- params: {},
352
- response: new ApiResponseBuilder(),
353
- server: _server,
354
- locals,
355
- require: createRequire(() => locals),
356
- services: {
357
- cache: getCacheService(),
358
- },
359
- ...getRenderContext(),
360
- };
361
- return await errorHandler(error, context);
362
- }
363
- catch (handlerError) {
364
- appLogger.error(`[ecopages] Error in custom error handler: ${handlerError}`);
365
- }
366
- }
367
- if (error instanceof HttpError)
368
- return error.toResponse();
369
- appLogger.error(`[ecopages] Error handling request: ${error}`);
370
- return new Response('Internal Server Error', { status: 500 });
371
- }
338
+ async fetch(request) {
339
+ return await handleReq(request);
372
340
  },
373
341
  error(error) {
374
342
  appLogger.error(`[ecopages] Error handling request: ${error}`);
375
- return handleNoMatch(new Request('http://localhost'));
343
+ return new Response('Internal Server Error', { status: 500 });
376
344
  },
377
345
  };
378
346
  return finalOptions;
@@ -385,6 +353,7 @@ export class BunServerAdapter extends SharedServerAdapter {
385
353
  if (!this.fullyInitialized) {
386
354
  await this.initializeSharedRouteHandling({
387
355
  staticRoutes: this.staticRoutes,
356
+ errorPageLoaders: this.errorPageLoaders,
388
357
  hmrManager: this.hmrManager,
389
358
  });
390
359
  }
@@ -393,6 +362,7 @@ export class BunServerAdapter extends SharedServerAdapter {
393
362
  router: this.router,
394
363
  routeRendererFactory: this.routeRendererFactory,
395
364
  staticRoutes: this.staticRoutes,
365
+ errorPageLoaders: this.errorPageLoaders,
396
366
  });
397
367
  if (!options?.preview) {
398
368
  return undefined;
@@ -407,6 +377,7 @@ export class BunServerAdapter extends SharedServerAdapter {
407
377
  if (!this.fullyInitialized) {
408
378
  await this.initializeSharedRouteHandling({
409
379
  staticRoutes: this.staticRoutes,
380
+ errorPageLoaders: this.errorPageLoaders,
410
381
  hmrManager: this.hmrManager,
411
382
  });
412
383
  }
@@ -460,6 +431,7 @@ export class BunServerAdapter extends SharedServerAdapter {
460
431
  appLogger.debug('Completing server initialization with dynamic routes');
461
432
  await this.initializeSharedRouteHandling({
462
433
  staticRoutes: this.staticRoutes,
434
+ errorPageLoaders: this.errorPageLoaders,
463
435
  hmrManager: this.hmrManager,
464
436
  });
465
437
  if (this.options?.watch) {
@@ -492,6 +464,7 @@ export class BunServerAdapter extends SharedServerAdapter {
492
464
  completeInitialization: this.completeInitialization.bind(this),
493
465
  handleRequest: this.handleRequest.bind(this),
494
466
  attachUserWebSocketUpgrades: this.attachUserWebSocketUpgrades.bind(this),
467
+ applyBoundPort: this.applyBoundPort.bind(this),
495
468
  listStaticGenerationRoutes: (input) => this.router.listStaticGenerationRoutes(input),
496
469
  dispose: this.dispose.bind(this),
497
470
  };
@@ -522,17 +495,24 @@ export class BunServerAdapter extends SharedServerAdapter {
522
495
  *
523
496
  * @remarks
524
497
  * HMR HTML injection for API and page responses is owned by
525
- * `SharedServerAdapter.handleSharedRequest`. This method only maps the
526
- * request into the shared pipeline.
498
+ * `SharedServerAdapter.handleSharedRequest`. This method waits for
499
+ * initialization, maps the request into the shared pipeline, and sends any
500
+ * escaped error through the shared `app.onError` boundary.
527
501
  */
528
502
  async handleRequest(request) {
529
- const response = await this.handleSharedRequest(request, {
503
+ const context = {
530
504
  apiHandlers: this.apiHandlers,
531
505
  errorHandler: this.errorHandler,
532
506
  serverInstance: this.serverInstance,
533
507
  hmrManager: this.hmrManager,
534
- });
535
- return response;
508
+ };
509
+ try {
510
+ await this.waitForInitialization();
511
+ return await this.handleSharedRequest(request, context);
512
+ }
513
+ catch (error) {
514
+ return await this.handleUnexpectedRequestError(error, request, context);
515
+ }
536
516
  }
537
517
  /**
538
518
  * Ensures server initialization completes before request handling.
@@ -547,20 +527,6 @@ export class BunServerAdapter extends SharedServerAdapter {
547
527
  }
548
528
  throw new Error('Server not initialized. Call completeInitialization() first.');
549
529
  }
550
- /**
551
- * Handles HTTP requests from the router adapter.
552
- */
553
- async handleResponse(request) {
554
- await this.waitForInitialization();
555
- return this.routeHandler.handleResponse(request);
556
- }
557
- /**
558
- * Handles requests that do not match any routes.
559
- */
560
- async handleNoMatch(request) {
561
- await this.waitForInitialization();
562
- return this.routeHandler.handleNoMatch(request);
563
- }
564
530
  }
565
531
  /**
566
532
  * Creates the Bun server adapter and fills in the runtime-specific collaborators
@@ -11,6 +11,7 @@ type BunStaticPreviewServerFactory = {
11
11
  appConfig: EcoPagesAppConfig;
12
12
  options: {
13
13
  port: number;
14
+ hostname: string;
14
15
  };
15
16
  }): BunStaticPreviewServer;
16
17
  };
@@ -16,7 +16,7 @@ export class BunStaticPreviewHost {
16
16
  startOnPort: async (port) => {
17
17
  const candidate = this.previewServerFactory.createServer({
18
18
  appConfig: options.appConfig,
19
- options: { port },
19
+ options: { port, hostname: options.hostname },
20
20
  });
21
21
  const boundPort = candidate.server?.port ?? null;
22
22
  if (!boundPort) {
@@ -1,22 +1,77 @@
1
+ import type { EcoPagesUserConfig } from '../config/user-config-types.js';
1
2
  import type { EcoPagesAppConfig } from '../types/internal-types.js';
2
3
  import { AbstractApplicationAdapter } from './abstract/application-adapter.js';
3
4
  import type { ApplicationAdapterOptions } from './abstract/application-adapter.js';
4
- export type { OnAppStartCallback, AppStartInfo, StartCallback, ListenCallback, ApplicationListeningCallback, ApplicationListeningInfo, } from './abstract/application-adapter.js';
5
+ export type { OnAppStartCallback, AppStartInfo } from './abstract/application-adapter.js';
5
6
  export type EcopagesRuntimeAdapter = 'auto' | 'node' | 'bun';
6
- export interface EcopagesAppOptions extends ApplicationAdapterOptions {
7
+ type EcopagesAppConfigSource = {
7
8
  appConfig: EcoPagesAppConfig;
9
+ userConfig?: never;
10
+ configFile?: never;
11
+ } | {
12
+ appConfig?: never;
13
+ userConfig: EcoPagesUserConfig;
14
+ configFile?: never;
15
+ } | {
16
+ appConfig?: never;
17
+ userConfig?: never;
18
+ configFile?: string;
19
+ };
20
+ export type EcopagesAppOptions = Omit<ApplicationAdapterOptions, 'appConfig'> & EcopagesAppConfigSource & {
8
21
  /**
9
22
  * Selects the runtime adapter used by the universal `createApp()` entrypoint.
10
23
  *
11
24
  * @default 'auto'
12
25
  *
13
26
  * @remarks
14
- * This is separate from `runtime`, which configures embedded host behavior.
15
- * Use `auto` to select Bun when the current process exposes `globalThis.Bun`
27
+ * Use `'auto'` to select Bun when the current process exposes `globalThis.Bun`
16
28
  * and Node otherwise.
17
29
  */
18
30
  adapter?: EcopagesRuntimeAdapter;
19
- serverOptions?: Record<string, any>;
20
- }
21
- export type UniversalEcopagesApp = AbstractApplicationAdapter<EcopagesAppOptions, unknown, Request>;
22
- export declare function createApp<WebSocketData = undefined>(options: EcopagesAppOptions): Promise<UniversalEcopagesApp>;
31
+ /**
32
+ * Low-level server options passed to the underlying HTTP engine
33
+ * (e.g. Node `http.createServer` or Bun `Bun.serve`).
34
+ */
35
+ serverOptions?: Record<string, unknown>;
36
+ };
37
+ export type ResolvedEcopagesAppOptions = ApplicationAdapterOptions & {
38
+ adapter?: EcopagesRuntimeAdapter;
39
+ };
40
+ export type UniversalEcopagesApp = AbstractApplicationAdapter<ResolvedEcopagesAppOptions, unknown, Request>;
41
+ /**
42
+ * Creates and initializes an EcoPages universal application instance.
43
+ *
44
+ * @remarks
45
+ * In standard applications, `createApp()` is called with zero arguments. It automatically
46
+ * resolves and loads `eco.config.ts` from the project root (or via the `ECOPAGES_CONFIG_FILE`
47
+ * environment variable or explicit `configFile` option).
48
+ *
49
+ * In tests or fixture harness environments, you may pass `userConfig` (an unfinalized
50
+ * `EcoPagesUserConfig` object authored via `defineConfig()`) or `appConfig` (a pre-finalized
51
+ * `EcoPagesAppConfig`) to bypass file loading.
52
+ *
53
+ * @example Default usage in `app.ts`
54
+ * ```typescript
55
+ * import { createApp } from '@ecopages/core/create-app';
56
+ *
57
+ * const app = await createApp();
58
+ * app.get('/api/health', (req, res) => res.json({ status: 'ok' }));
59
+ * await app.start();
60
+ * ```
61
+ *
62
+ * @example With a custom config file path
63
+ * ```typescript
64
+ * const app = await createApp({ configFile: 'eco.custom.config.ts' });
65
+ * ```
66
+ *
67
+ * @example In tests with inline user config
68
+ * ```typescript
69
+ * const app = await createApp({
70
+ * userConfig: {
71
+ * rootDir: import.meta.dirname,
72
+ * integrations: [ecopagesJsxPlugin()],
73
+ * },
74
+ * });
75
+ * ```
76
+ */
77
+ export declare function createApp<WebSocketData = undefined>(options?: EcopagesAppOptions): Promise<UniversalEcopagesApp>;
@@ -1,14 +1,71 @@
1
+ import path from 'node:path';
2
+ import { finalizeEcoPagesConfig, loadEcoPagesConfig } from '../config/load-eco-config.js';
3
+ import { DEFAULT_ECO_CONFIG_FILENAME, resolveUserConfigRootDir } from '../config/resolve-eco-config-path.js';
1
4
  import { AbstractApplicationAdapter } from './abstract/application-adapter.js';
2
5
  import { createApp as createBunApp } from './bun/create-app.js';
3
6
  import { createNodeApp } from './node/create-app.js';
4
- async function createRuntimeApp(options) {
7
+ async function resolveAppConfig(options) {
8
+ if (options.appConfig) {
9
+ return options.appConfig;
10
+ }
11
+ if (options.userConfig) {
12
+ return await finalizeEcoPagesConfig({
13
+ config: options.userConfig,
14
+ configFilePath: path.join(resolveUserConfigRootDir(options.userConfig.rootDir), DEFAULT_ECO_CONFIG_FILENAME),
15
+ });
16
+ }
17
+ return await loadEcoPagesConfig({ configFile: options.configFile });
18
+ }
19
+ async function createRuntimeApp(options, appConfig) {
5
20
  const adapter = options.adapter ?? 'auto';
6
21
  const bun = globalThis.Bun;
22
+ const { userConfig: _uc, configFile: _cf, ...baseOptions } = options;
23
+ const runtimeOptions = {
24
+ ...baseOptions,
25
+ appConfig,
26
+ };
7
27
  if (adapter === 'bun' || (adapter === 'auto' && bun)) {
8
- return (await createBunApp(options));
28
+ return (await createBunApp(runtimeOptions));
9
29
  }
10
- return (await createNodeApp(options));
30
+ return (await createNodeApp(runtimeOptions));
11
31
  }
12
- export async function createApp(options) {
13
- return createRuntimeApp(options);
32
+ /**
33
+ * Creates and initializes an EcoPages universal application instance.
34
+ *
35
+ * @remarks
36
+ * In standard applications, `createApp()` is called with zero arguments. It automatically
37
+ * resolves and loads `eco.config.ts` from the project root (or via the `ECOPAGES_CONFIG_FILE`
38
+ * environment variable or explicit `configFile` option).
39
+ *
40
+ * In tests or fixture harness environments, you may pass `userConfig` (an unfinalized
41
+ * `EcoPagesUserConfig` object authored via `defineConfig()`) or `appConfig` (a pre-finalized
42
+ * `EcoPagesAppConfig`) to bypass file loading.
43
+ *
44
+ * @example Default usage in `app.ts`
45
+ * ```typescript
46
+ * import { createApp } from '@ecopages/core/create-app';
47
+ *
48
+ * const app = await createApp();
49
+ * app.get('/api/health', (req, res) => res.json({ status: 'ok' }));
50
+ * await app.start();
51
+ * ```
52
+ *
53
+ * @example With a custom config file path
54
+ * ```typescript
55
+ * const app = await createApp({ configFile: 'eco.custom.config.ts' });
56
+ * ```
57
+ *
58
+ * @example In tests with inline user config
59
+ * ```typescript
60
+ * const app = await createApp({
61
+ * userConfig: {
62
+ * rootDir: import.meta.dirname,
63
+ * integrations: [ecopagesJsxPlugin()],
64
+ * },
65
+ * });
66
+ * ```
67
+ */
68
+ export async function createApp(options = {}) {
69
+ const appConfig = await resolveAppConfig(options);
70
+ return createRuntimeApp(options, appConfig);
14
71
  }
@@ -1,19 +1,18 @@
1
1
  import { SharedApplicationAdapter } from '../shared/runtime/application-adapter.js';
2
+ import type { WebSocketUpgradeOptions } from '../shared/ws/node-http-websocket-upgrades.js';
2
3
  import type { RuntimeHost } from '../shared/runtime/runtime-host.js';
3
- import type { EcopagesAppOptions } from '../create-app.js';
4
+ import type { ResolvedEcopagesAppOptions } from '../create-app.js';
4
5
  import { type NodeServerAdapterResult, createNodeServerAdapter } from './server-adapter.js';
5
6
  import type { NodeServerInstance } from './server-adapter.js';
6
- export declare class NodeEcopagesApp extends SharedApplicationAdapter<EcopagesAppOptions, NodeServerInstance, Request> {
7
+ import { type NodeRuntimeServeOptions } from './runtime-host.js';
8
+ export declare class NodeEcopagesApp extends SharedApplicationAdapter<ResolvedEcopagesAppOptions, NodeServerInstance, Request> {
7
9
  serverAdapter: NodeServerAdapterResult | undefined;
8
10
  private server;
9
11
  private runtimeOrigin;
10
12
  private stopped;
11
13
  private readonly runtimeHost;
12
- constructor(options: EcopagesAppOptions, dependencies: {
13
- runtimeHost: RuntimeHost<NodeServerInstance, {
14
- port?: number;
15
- hostname?: string;
16
- }>;
14
+ constructor(options: ResolvedEcopagesAppOptions, dependencies: {
15
+ runtimeHost: RuntimeHost<NodeServerInstance, NodeRuntimeServeOptions>;
17
16
  });
18
17
  protected createServerAdapter(params: Parameters<typeof createNodeServerAdapter>[0]): Promise<NodeServerAdapterResult>;
19
18
  stop(force?: boolean): Promise<void>;
@@ -21,9 +20,6 @@ export declare class NodeEcopagesApp extends SharedApplicationAdapter<EcopagesAp
21
20
  protected initializeServerAdapter(): Promise<NodeServerAdapterResult>;
22
21
  protected bootServer(): Promise<NodeServerInstance | void>;
23
22
  fetch(request: Request): Promise<Response>;
24
- attachWebSocketUpgrades(httpServer: import('node:http').Server, options?: {
25
- passthroughUnmatched?: boolean;
26
- }): Promise<void>;
23
+ attachWebSocketUpgrades(httpServer: import('node:http').Server, options?: WebSocketUpgradeOptions): Promise<void>;
27
24
  }
28
- export declare function createNodeApp(options: EcopagesAppOptions): Promise<NodeEcopagesApp>;
29
- export declare function createApp(options: EcopagesAppOptions): Promise<NodeEcopagesApp>;
25
+ export declare function createNodeApp(options: ResolvedEcopagesAppOptions): Promise<NodeEcopagesApp>;
@@ -1,6 +1,7 @@
1
1
  import { appLogger } from '../../global/app-logger.js';
2
2
  import { SharedApplicationAdapter } from '../shared/runtime/application-adapter.js';
3
- import { resolveRuntimeBinding, resolveStaticRuntimeMode } from '../shared/runtime/runtime-app-bootstrap.js';
3
+ import { resolveRuntimeBinding } from '../shared/runtime/runtime-app-bootstrap.js';
4
+ import { bindRuntimeServer } from '../shared/runtime/bind-runtime-server.js';
4
5
  import { createNodeServerAdapter } from './server-adapter.js';
5
6
  import { NodeHttpRequestBridge } from './http-request-bridge.js';
6
7
  import { NodeRuntimeHost } from './runtime-host.js';
@@ -51,16 +52,15 @@ export class NodeEcopagesApp extends SharedApplicationAdapter {
51
52
  appConfig: this.appConfig,
52
53
  apiHandlers: this.apiHandlers,
53
54
  staticRoutes: this.staticRoutes,
55
+ errorPageLoaders: this.getErrorPageLoaders(),
54
56
  errorHandler: this.errorHandler,
55
57
  websocketHandlers: this.websocketHandlers.size > 0 ? this.websocketHandlers : undefined,
56
58
  options: { watch: binding.watch },
57
59
  serveOptions: binding.serveOptions,
58
60
  hostOwnsDevClient: hostOwnsDevClient(this.runtimeOptions),
59
- deferRuntimeAssetSetup: resolveStaticRuntimeMode({
60
- appConfig: this.appConfig,
61
- cliArgs: this.cliArgs,
62
- }).canBuildWithoutRuntimeServer,
61
+ deferRuntimeAssetSetup: this.cliArgs.build || this.cliArgs.preview,
63
62
  allowPortFallback: binding.allowPortFallback,
63
+ onDevelopmentRestart: this.createDevelopmentRestartHandler(),
64
64
  });
65
65
  }
66
66
  async bootServer() {
@@ -95,13 +95,24 @@ export class NodeEcopagesApp extends SharedApplicationAdapter {
95
95
  return;
96
96
  }
97
97
  const serveOptions = this.serverAdapter.getServerOptions();
98
+ const binding = resolveRuntimeBinding({
99
+ cliArgs: this.cliArgs,
100
+ serverOptions: this.serverOptions,
101
+ });
98
102
  startupTrace.beginServerListen();
99
- this.server = await this.runtimeHost.start({
100
- serveOptions,
101
- handleRequest: async (request) => await this.serverAdapter.handleRequest(request),
102
- onError: async () => { },
103
+ const bindingResult = await bindRuntimeServer(this.runtimeHost, {
104
+ startOptions: {
105
+ serveOptions: {
106
+ ...serveOptions,
107
+ handleRequest: async (request) => await this.serverAdapter.handleRequest(request),
108
+ },
109
+ },
110
+ allowPortFallback: binding.allowPortFallback,
111
+ usePortManager: this.cliArgs.dev,
103
112
  });
104
- this.runtimeOrigin = this.runtimeHost.getOrigin(this.server, serveOptions);
113
+ this.server = bindingResult.server;
114
+ this.runtimeOrigin = bindingResult.runtimeOrigin;
115
+ this.serverAdapter.applyBoundPort(bindingResult);
105
116
  await this.serverAdapter.completeInitialization(this.server);
106
117
  await this.notifyListening(this.runtimeOrigin);
107
118
  return this.server;
@@ -118,7 +129,7 @@ export class NodeEcopagesApp extends SharedApplicationAdapter {
118
129
  }
119
130
  if (!this.server) {
120
131
  this.server = httpServer;
121
- await this.serverAdapter.completeInitialization(httpServer);
132
+ await this.serverAdapter.completeInitialization(httpServer, options);
122
133
  return;
123
134
  }
124
135
  this.serverAdapter.attachUserWebSocketUpgrades(httpServer, options);
@@ -129,6 +140,3 @@ export async function createNodeApp(options) {
129
140
  runtimeHost: new NodeRuntimeHost(new NodeHttpRequestBridge()),
130
141
  });
131
142
  }
132
- export async function createApp(options) {
133
- return createNodeApp(options);
134
- }