@ecopages/core 0.2.0-beta.2 → 0.2.0-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +163 -3
- package/src/adapters/abstract/application-adapter.d.ts +104 -5
- package/src/adapters/abstract/application-adapter.js +125 -1
- package/src/adapters/abstract/server-adapter.d.ts +6 -2
- package/src/adapters/abstract/ws-pattern-matcher.d.ts +60 -0
- package/src/adapters/abstract/ws-pattern-matcher.js +61 -0
- package/src/adapters/bun/client-bridge.d.ts +1 -0
- package/src/adapters/bun/client-bridge.js +3 -0
- package/src/adapters/bun/create-app.d.ts +6 -4
- package/src/adapters/bun/create-app.js +65 -43
- package/src/adapters/bun/server-adapter.d.ts +90 -22
- package/src/adapters/bun/server-adapter.js +266 -84
- package/src/adapters/bun/static-preview-host.js +25 -20
- package/src/adapters/create-app.d.ts +13 -11
- package/src/adapters/create-app.js +2 -51
- package/src/adapters/index.d.ts +1 -1
- package/src/adapters/index.js +1 -2
- package/src/adapters/node/create-app.d.ts +5 -1
- package/src/adapters/node/create-app.js +51 -12
- package/src/adapters/node/node-client-bridge.d.ts +1 -0
- package/src/adapters/node/node-client-bridge.js +3 -0
- package/src/adapters/node/server-adapter-dependencies.js +4 -0
- package/src/adapters/node/server-adapter.d.ts +62 -20
- package/src/adapters/node/server-adapter.js +160 -131
- package/src/adapters/node/static-content-server.d.ts +1 -0
- package/src/adapters/node/static-content-server.js +10 -2
- package/src/adapters/node/static-preview-host.js +27 -12
- package/src/adapters/shared/bun-user-websocket-lifecycle.d.ts +22 -0
- package/src/adapters/shared/bun-user-websocket-lifecycle.js +96 -0
- package/src/adapters/shared/copy-runtime-public-dir.d.ts +6 -0
- package/src/adapters/shared/copy-runtime-public-dir.js +24 -0
- package/src/adapters/shared/fs-server-response-matcher.d.ts +2 -0
- package/src/adapters/shared/fs-server-response-matcher.js +40 -18
- package/src/adapters/shared/hmr-entrypoint-registrar.d.ts +21 -30
- package/src/adapters/shared/hmr-entrypoint-registrar.js +49 -54
- package/src/adapters/shared/hmr-html-response.d.ts +1 -1
- package/src/adapters/shared/hmr-html-response.js +4 -1
- package/src/adapters/shared/node-http-websocket-upgrades.d.ts +21 -0
- package/src/adapters/shared/node-http-websocket-upgrades.js +100 -0
- package/src/adapters/shared/port-manager.d.ts +116 -0
- package/src/adapters/shared/port-manager.js +196 -0
- package/src/adapters/shared/runtime-app-bootstrap.d.ts +2 -1
- package/src/adapters/shared/runtime-app-bootstrap.js +3 -6
- package/src/adapters/shared/runtime-server-lifecycle.d.ts +46 -0
- package/src/adapters/shared/runtime-server-lifecycle.js +50 -0
- package/src/adapters/shared/server-adapter.d.ts +2 -1
- package/src/adapters/shared/server-adapter.js +13 -6
- package/src/adapters/shared/server-route-handler.d.ts +4 -1
- package/src/adapters/shared/server-route-handler.js +5 -2
- package/src/adapters/shared/server-static-builder.d.ts +23 -32
- package/src/adapters/shared/server-static-builder.js +100 -73
- package/src/adapters/shared/shared-hmr-manager.d.ts +45 -11
- package/src/adapters/shared/shared-hmr-manager.js +204 -58
- package/src/adapters/shared/static-preview-host.d.ts +5 -0
- package/src/adapters/shared/websocket-lifecycle.d.ts +24 -0
- package/src/adapters/shared/websocket-lifecycle.js +55 -0
- package/src/build/README.md +77 -14
- package/src/build/app-build-manifest-runtime.d.ts +9 -0
- package/src/build/app-build-manifest-runtime.js +87 -0
- package/src/build/build-adapter.d.ts +17 -319
- package/src/build/build-adapter.js +28 -94
- package/src/build/build-contracts.d.ts +97 -0
- package/src/build/build-contracts.js +0 -0
- package/src/build/build-input-fingerprint.d.ts +28 -0
- package/src/build/build-input-fingerprint.js +31 -0
- package/src/build/build-profile-options.d.ts +7 -0
- package/src/build/build-profile-options.js +37 -0
- package/src/build/build-runtime.d.ts +24 -0
- package/src/build/build-runtime.js +65 -0
- package/src/build/deduping-build-executor.d.ts +28 -0
- package/src/build/deduping-build-executor.js +56 -0
- package/src/build/jsx-ownership-plugins.d.ts +24 -0
- package/src/build/jsx-ownership-plugins.js +41 -0
- package/src/build/pages-unified-graph-build.d.ts +31 -0
- package/src/build/pages-unified-graph-build.js +206 -0
- package/src/build/parallel-build-executor.d.ts +21 -0
- package/src/build/parallel-build-executor.js +52 -0
- package/src/build/production-build-cache.d.ts +20 -0
- package/src/build/production-build-cache.js +63 -0
- package/src/build/rolldown-adapter-helpers.d.ts +3 -6
- package/src/build/rolldown-adapter-helpers.js +71 -6
- package/src/build/rolldown-build-adapter.d.ts +2 -6
- package/src/build/rolldown-build-adapter.js +3 -3
- package/src/build/rolldown-build-invocation-metrics.d.ts +12 -0
- package/src/build/rolldown-build-invocation-metrics.js +43 -0
- package/src/build/rolldown-plugin-bridge.d.ts +15 -1
- package/src/build/rolldown-plugin-bridge.js +20 -5
- package/src/build/rolldown-source-transform-pass.d.ts +15 -0
- package/src/build/rolldown-source-transform-pass.js +58 -0
- package/src/build/runtime-build-executor.d.ts +8 -15
- package/src/build/runtime-build-executor.js +12 -15
- package/src/build/runtime-build-output-normalizer.d.ts +7 -0
- package/src/build/runtime-build-output-normalizer.js +94 -2
- package/src/build/server-entry-build-cache.d.ts +44 -0
- package/src/build/server-entry-build-cache.js +161 -0
- package/src/client/navigation-scripts/classification.d.ts +16 -0
- package/src/client/navigation-scripts/classification.js +41 -0
- package/src/client/navigation-scripts/index.d.ts +3 -0
- package/src/client/navigation-scripts/index.js +23 -0
- package/src/client/navigation-scripts/navigation-scripts.test.browser.js +65 -0
- package/src/client/navigation-scripts/registry.d.ts +11 -0
- package/src/client/navigation-scripts/registry.js +12 -0
- package/src/client/navigation-scripts/rerun-queue.d.ts +37 -0
- package/src/client/navigation-scripts/rerun-queue.js +73 -0
- package/src/client/scroll.d.ts +17 -0
- package/src/client/scroll.js +25 -0
- package/src/client/scroll.test.browser.js +37 -0
- package/src/client/view-transitions.d.ts +16 -0
- package/src/client/view-transitions.js +63 -0
- package/src/config/config-builder.d.ts +12 -7
- package/src/config/config-builder.js +12 -9
- package/src/dev/client-bridge-registry.d.ts +5 -0
- package/src/dev/client-bridge-registry.js +15 -0
- package/src/dev/dev-client-ownership.d.ts +7 -0
- package/src/dev/dev-client-ownership.js +6 -0
- package/src/dev/hmr-manager-registry.d.ts +8 -0
- package/src/dev/hmr-manager-registry.js +15 -0
- package/src/dev/host-runtime.d.ts +3 -0
- package/src/dev/host-runtime.js +7 -0
- package/src/dev/runtime-server-started-message.d.ts +2 -0
- package/src/dev/runtime-server-started-message.js +6 -0
- package/src/eco/README.md +11 -0
- package/src/eco/eco-declared-component.d.ts +14 -0
- package/src/eco/eco-declared-component.js +16 -0
- package/src/eco/eco.browser.js +5 -6
- package/src/eco/eco.js +5 -6
- package/src/eco/eco.types.d.ts +2 -2
- package/src/eco/page-layout-normalization.d.ts +21 -0
- package/src/eco/page-layout-normalization.js +59 -0
- package/src/errors/index.d.ts +1 -0
- package/src/errors/index.js +7 -1
- package/src/errors/undeclared-component-dependency-error.d.ts +11 -0
- package/src/errors/undeclared-component-dependency-error.js +17 -0
- package/src/hmr/client/hmr-runtime.js +5 -2
- package/src/hmr/hmr-entrypoint-output.d.ts +43 -0
- package/src/hmr/hmr-entrypoint-output.js +53 -0
- package/src/hmr/hmr-strategy.d.ts +15 -0
- package/src/hmr/hmr-strategy.js +19 -0
- package/src/hmr/strategies/js-hmr-strategy.d.ts +3 -5
- package/src/hmr/strategies/js-hmr-strategy.js +67 -19
- package/src/hmr/strategies/server-rendered-template-hmr-strategy.d.ts +17 -0
- package/src/hmr/strategies/server-rendered-template-hmr-strategy.js +29 -0
- package/src/integrations/ghtml/ghtml-renderer.d.ts +2 -6
- package/src/integrations/ghtml/ghtml-renderer.js +2 -51
- package/src/integrations/ghtml/ghtml.plugin.d.ts +3 -16
- package/src/integrations/ghtml/ghtml.plugin.js +7 -14
- package/src/plugins/define-integration.d.ts +26 -0
- package/src/plugins/define-integration.js +19 -0
- package/src/plugins/eco-component-meta-plugin.js +5 -8
- package/src/plugins/foreign-jsx-override-plugin.js +4 -6
- package/src/plugins/integration-plugin.d.ts +19 -9
- package/src/plugins/integration-plugin.js +7 -4
- package/src/plugins/jsx-import-source.utils.d.ts +8 -0
- package/src/plugins/jsx-import-source.utils.js +26 -0
- package/src/plugins/processor.d.ts +19 -4
- package/src/plugins/processor.js +22 -4
- package/src/plugins/source-transform.d.ts +31 -0
- package/src/plugins/source-transform.js +23 -1
- package/src/route-renderer/GRAPH.md +8 -8
- package/src/route-renderer/README.md +30 -28
- package/src/route-renderer/orchestration/component-graph-collectors.d.ts +10 -0
- package/src/route-renderer/orchestration/component-graph-collectors.js +143 -0
- package/src/route-renderer/orchestration/component-graph.d.ts +36 -0
- package/src/route-renderer/orchestration/component-graph.js +98 -0
- package/src/route-renderer/orchestration/component-render-context.d.ts +3 -10
- package/src/route-renderer/orchestration/component-render-context.js +3 -1
- package/src/route-renderer/orchestration/declared-ownership-graph.d.ts +1 -18
- package/src/route-renderer/orchestration/declared-ownership-graph.js +5 -31
- package/src/route-renderer/orchestration/document-shell-render.service.d.ts +90 -0
- package/src/route-renderer/orchestration/document-shell-render.service.js +120 -0
- package/src/route-renderer/orchestration/foreign-subtree-execution.service.d.ts +59 -29
- package/src/route-renderer/orchestration/foreign-subtree-execution.service.js +164 -35
- package/src/route-renderer/orchestration/global-injector-assets.service.d.ts +7 -0
- package/src/route-renderer/orchestration/global-injector-assets.service.js +32 -0
- package/src/route-renderer/orchestration/integration-renderer.d.ts +18 -54
- package/src/route-renderer/orchestration/integration-renderer.js +113 -195
- package/src/route-renderer/orchestration/integration-route-render-adapter.d.ts +38 -0
- package/src/route-renderer/orchestration/integration-route-render-adapter.js +27 -0
- package/src/route-renderer/orchestration/layout-shell-props.service.d.ts +20 -0
- package/src/route-renderer/orchestration/layout-shell-props.service.js +31 -0
- package/src/route-renderer/orchestration/ownership-validation.service.d.ts +5 -0
- package/src/route-renderer/orchestration/ownership-validation.service.js +29 -1
- package/src/route-renderer/orchestration/page-browser-graph-contribution.loader.d.ts +9 -0
- package/src/route-renderer/orchestration/page-browser-graph-contribution.loader.js +7 -0
- package/src/route-renderer/orchestration/page-browser-graph.service.d.ts +25 -0
- package/src/route-renderer/orchestration/page-browser-graph.service.js +174 -0
- package/src/route-renderer/orchestration/render-output.utils.d.ts +2 -0
- package/src/route-renderer/orchestration/render-output.utils.js +4 -0
- package/src/route-renderer/orchestration/route-html-finalization.service.d.ts +17 -0
- package/src/route-renderer/orchestration/route-html-finalization.service.js +26 -0
- package/src/route-renderer/orchestration/route-prepared-options.builder.d.ts +26 -0
- package/src/route-renderer/orchestration/route-prepared-options.builder.js +54 -0
- package/src/route-renderer/orchestration/route-prepared-options.utils.d.ts +4 -0
- package/src/route-renderer/orchestration/route-prepared-options.utils.js +33 -0
- package/src/route-renderer/orchestration/route-render-orchestrator.d.ts +8 -39
- package/src/route-renderer/orchestration/route-render-orchestrator.js +53 -461
- package/src/route-renderer/orchestration/string-markup-renderer.d.ts +14 -0
- package/src/route-renderer/orchestration/string-markup-renderer.js +55 -0
- package/src/route-renderer/page-loading/component-dependency-collection.js +5 -2
- package/src/router/client/link-intent.d.ts +11 -21
- package/src/router/client/link-intent.js +10 -0
- package/src/router/client/link-intent.test.browser.js +12 -1
- package/src/router/client/link-navigation-policy.d.ts +45 -0
- package/src/router/client/link-navigation-policy.js +101 -0
- package/src/router/client/link-navigation-policy.test.browser.d.ts +1 -0
- package/src/router/client/link-navigation-policy.test.browser.js +92 -0
- package/src/router/client/navigation-coordinator.d.ts +1 -1
- package/src/router/client/navigation-coordinator.js +12 -2
- package/src/services/assets/asset-processing-service/browser-runtime-asset.factory.d.ts +1 -0
- package/src/services/assets/asset-processing-service/browser-runtime-asset.factory.js +1 -0
- package/src/services/assets/asset-processing-service/browser-runtime-entry.factory.d.ts +4 -2
- package/src/services/assets/asset-processing-service/browser-runtime-entry.factory.js +27 -7
- package/src/services/assets/asset-processing-service/processors/script/file-script.processor.d.ts +0 -1
- package/src/services/assets/asset-processing-service/processors/script/file-script.processor.js +18 -15
- package/src/services/assets/asset-processing-service/processors/script/node-module-script.processor.js +17 -3
- package/src/services/assets/asset-processing-service/processors/stylesheet/content-stylesheet.processor.d.ts +0 -3
- package/src/services/assets/asset-processing-service/processors/stylesheet/content-stylesheet.processor.js +2 -31
- package/src/services/assets/asset-processing-service/processors/stylesheet/file-stylesheet.processor.d.ts +0 -3
- package/src/services/assets/asset-processing-service/processors/stylesheet/file-stylesheet.processor.js +2 -30
- package/src/services/assets/asset-processing-service/processors/stylesheet/stylesheet-processor-pipeline.d.ts +2 -0
- package/src/services/assets/asset-processing-service/processors/stylesheet/stylesheet-processor-pipeline.js +43 -0
- package/src/services/assets/browser-bundle.service.d.ts +3 -1
- package/src/services/assets/browser-bundle.service.js +17 -5
- package/src/services/html/html-transformer.service.d.ts +1 -1
- package/src/services/html/html-transformer.service.js +4 -4
- package/src/services/invalidation/development-invalidation.service.d.ts +20 -2
- package/src/services/invalidation/development-invalidation.service.js +56 -2
- package/src/services/module-loading/README.md +49 -0
- package/src/services/module-loading/app-server-module-transpiler.service.js +5 -17
- package/src/services/module-loading/page-module-import.service.d.ts +5 -1
- package/src/services/module-loading/page-module-import.service.js +96 -45
- package/src/services/module-loading/route-module-build-cache-registry.d.ts +24 -0
- package/src/services/module-loading/route-module-build-cache-registry.js +37 -0
- package/src/services/module-loading/route-module-build-cache.d.ts +4 -0
- package/src/services/module-loading/route-module-build-cache.js +38 -0
- package/src/services/module-loading/route-module-build-cache.store.d.ts +57 -0
- package/src/services/module-loading/route-module-build-cache.store.js +207 -0
- package/src/services/module-loading/route-module-build-manifest.d.ts +61 -0
- package/src/services/module-loading/route-module-build-manifest.js +116 -0
- package/src/services/module-loading/route-module-dependency-hasher.d.ts +81 -0
- package/src/services/module-loading/route-module-dependency-hasher.js +122 -0
- package/src/services/module-loading/server-module-transpiler.service.js +1 -1
- package/src/static-site-generator/README.md +33 -0
- package/src/static-site-generator/static-build-invalidation.d.ts +10 -0
- package/src/static-site-generator/static-build-invalidation.js +59 -0
- package/src/static-site-generator/static-export-context.d.ts +22 -0
- package/src/static-site-generator/static-export-context.js +0 -0
- package/src/static-site-generator/static-site-generator.d.ts +17 -20
- package/src/static-site-generator/static-site-generator.js +188 -85
- package/src/types/internal-types.d.ts +16 -9
- package/src/types/public-types.d.ts +144 -40
- package/src/utils/parse-cli-args.d.ts +2 -0
- package/src/utils/parse-cli-args.js +6 -0
- package/src/utils/server-utils.module.d.ts +3 -2
- package/src/utils/server-utils.module.js +5 -6
- package/src/utils/static-file-extensions.d.ts +12 -0
- package/src/utils/static-file-extensions.js +48 -0
- package/src/watchers/project-watcher-ignore.d.ts +11 -0
- package/src/watchers/project-watcher-ignore.js +16 -0
- package/src/watchers/project-watcher.d.ts +26 -3
- package/src/watchers/project-watcher.js +132 -30
- package/src/watchers/project-watcher.test-helpers.js +5 -5
- package/src/build/rolldown-dev-build-adapter.d.ts +0 -82
- package/src/build/rolldown-dev-build-adapter.js +0 -166
- package/src/hmr/hmr.postcss.test.e2e.js +0 -31
- package/src/hmr/hmr.test.e2e.js +0 -43
- package/src/route-renderer/orchestration/ownership-planning.service.d.ts +0 -24
- package/src/route-renderer/orchestration/ownership-planning.service.js +0 -63
- package/src/route-renderer/orchestration/queued-foreign-subtree-resolution.service.d.ts +0 -91
- package/src/route-renderer/orchestration/queued-foreign-subtree-resolution.service.js +0 -170
- /package/src/{hmr/hmr.postcss.test.e2e.d.ts → client/navigation-scripts/navigation-scripts.test.browser.d.ts} +0 -0
- /package/src/{hmr/hmr.test.e2e.d.ts → client/scroll.test.browser.d.ts} +0 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { EcopagesWebSocketHandler } from '../../types/public-types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Pattern matcher for WebSocket route paths.
|
|
4
|
+
*
|
|
5
|
+
* Supports dynamic segments via `:param` syntax. Matches are exact on literal
|
|
6
|
+
* segments and capture dynamic segments into a params object.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* matchWebSocketPath('/ws/chat/:id', '/ws/chat/abc123')
|
|
11
|
+
* // Returns: { id: 'abc123' }
|
|
12
|
+
*
|
|
13
|
+
* matchWebSocketPath('/ws/chat/:id', '/ws/chat/abc123/messages')
|
|
14
|
+
* // Returns: null (length mismatch)
|
|
15
|
+
*
|
|
16
|
+
* matchWebSocketPath('/ws/chat', '/ws/chat')
|
|
17
|
+
* // Returns: {} (no params)
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* This is a minimal segment-based matcher. It does not support wildcards,
|
|
22
|
+
* optional segments, or catch-all patterns. Those are future concerns.
|
|
23
|
+
*
|
|
24
|
+
* @param pattern - The registered route pattern (e.g. '/ws/chat/:id')
|
|
25
|
+
* @param pathname - The actual request pathname (e.g. '/ws/chat/abc123')
|
|
26
|
+
* @returns A params object if the pattern matches, or null if it does not
|
|
27
|
+
*/
|
|
28
|
+
export declare function matchWebSocketPath(pattern: string, pathname: string): Record<string, string> | null;
|
|
29
|
+
/**
|
|
30
|
+
* Represents a matched WebSocket route.
|
|
31
|
+
*/
|
|
32
|
+
export type WebSocketRouteMatch = {
|
|
33
|
+
handler: EcopagesWebSocketHandler<any, any>;
|
|
34
|
+
params: Record<string, string>;
|
|
35
|
+
kind: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Scores a pattern for specificity ordering.
|
|
39
|
+
*
|
|
40
|
+
* Higher scores win. Rules, in order:
|
|
41
|
+
* 1. More literal segments beats more dynamic segments.
|
|
42
|
+
* 2. Fewer dynamic segments beats more dynamic segments.
|
|
43
|
+
* 3. Longer route (more segments) beats shorter route.
|
|
44
|
+
*
|
|
45
|
+
* @param pattern - The registered route pattern
|
|
46
|
+
* @returns A numeric specificity score
|
|
47
|
+
*/
|
|
48
|
+
export declare function scoreWebSocketPattern(pattern: string): number;
|
|
49
|
+
/**
|
|
50
|
+
* Find the registered WebSocket handler that best matches a pathname.
|
|
51
|
+
*
|
|
52
|
+
* Iterates through the provided handlers map, computes each pattern's
|
|
53
|
+
* specificity score, and returns the highest-scoring match. Ties resolve
|
|
54
|
+
* to the earliest-registered pattern.
|
|
55
|
+
*
|
|
56
|
+
* @param handlers - The map of registered WebSocket handlers
|
|
57
|
+
* @param pathname - The actual request pathname
|
|
58
|
+
* @returns The best match, or null if no pattern matches
|
|
59
|
+
*/
|
|
60
|
+
export declare function findWebSocketRoute(handlers: Map<string, EcopagesWebSocketHandler<any, any>>, pathname: string): WebSocketRouteMatch | null;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
function matchWebSocketPath(pattern, pathname) {
|
|
2
|
+
const patternSegments = pattern.split("/").filter(Boolean);
|
|
3
|
+
const pathSegments = pathname.split("/").filter(Boolean);
|
|
4
|
+
if (patternSegments.length !== pathSegments.length) {
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
const params = {};
|
|
8
|
+
for (let i = 0; i < patternSegments.length; i++) {
|
|
9
|
+
const patternSegment = patternSegments[i];
|
|
10
|
+
const pathSegment = pathSegments[i];
|
|
11
|
+
if (!patternSegment || !pathSegment) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
if (patternSegment.startsWith(":")) {
|
|
15
|
+
const paramName = patternSegment.slice(1);
|
|
16
|
+
if (!paramName) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
params[paramName] = pathSegment;
|
|
20
|
+
} else if (patternSegment !== pathSegment) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return params;
|
|
25
|
+
}
|
|
26
|
+
function scoreWebSocketPattern(pattern) {
|
|
27
|
+
const segments = pattern.split("/").filter(Boolean);
|
|
28
|
+
let literals = 0;
|
|
29
|
+
let dynamics = 0;
|
|
30
|
+
for (const segment of segments) {
|
|
31
|
+
if (segment.startsWith(":")) {
|
|
32
|
+
dynamics += 1;
|
|
33
|
+
} else {
|
|
34
|
+
literals += 1;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return literals * 100 - dynamics * 10 + segments.length;
|
|
38
|
+
}
|
|
39
|
+
function findWebSocketRoute(handlers, pathname) {
|
|
40
|
+
let best = null;
|
|
41
|
+
let index = 0;
|
|
42
|
+
for (const [pattern, handler] of handlers) {
|
|
43
|
+
const params = matchWebSocketPath(pattern, pathname);
|
|
44
|
+
if (params === null) {
|
|
45
|
+
index += 1;
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
const score = scoreWebSocketPattern(pattern);
|
|
49
|
+
const match = { handler, params, kind: pattern };
|
|
50
|
+
if (best === null || score > best.score || score === best.score && index < best.index) {
|
|
51
|
+
best = { score, match, index };
|
|
52
|
+
}
|
|
53
|
+
index += 1;
|
|
54
|
+
}
|
|
55
|
+
return best?.match ?? null;
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
findWebSocketRoute,
|
|
59
|
+
matchWebSocketPath,
|
|
60
|
+
scoreWebSocketPattern
|
|
61
|
+
};
|
|
@@ -11,7 +11,6 @@ import type { Server } from 'bun';
|
|
|
11
11
|
import type { ApiHandlerContext, RouteGroupBuilder } from '../../types/public-types.js';
|
|
12
12
|
import { SharedApplicationAdapter } from '../shared/application-adapter.js';
|
|
13
13
|
import type { RuntimeHost } from '../shared/runtime-host.js';
|
|
14
|
-
import type { StaticPreviewHost } from '../shared/static-preview-host.js';
|
|
15
14
|
import type { EcopagesAppOptions } from '../create-app.js';
|
|
16
15
|
import { type BunServerAdapterResult } from './server-adapter.js';
|
|
17
16
|
/**
|
|
@@ -31,13 +30,15 @@ export type BunRouteGroupBuilder<WebSocketData = undefined, TContext extends Api
|
|
|
31
30
|
export declare class BunEcopagesApp<WebSocketData = undefined> extends SharedApplicationAdapter<EcopagesAppOptions, Server<WebSocketData>, Request> {
|
|
32
31
|
serverAdapter: BunServerAdapterResult | undefined;
|
|
33
32
|
private server;
|
|
33
|
+
private stopped;
|
|
34
34
|
private readonly runtimeHost;
|
|
35
|
-
private readonly previewHost;
|
|
36
35
|
constructor(options: EcopagesAppOptions, dependencies: {
|
|
37
36
|
runtimeHost: RuntimeHost<Server<WebSocketData>, Bun.Serve.Options<WebSocketData>>;
|
|
38
|
-
previewHost: StaticPreviewHost;
|
|
39
37
|
});
|
|
40
38
|
fetch(request: Request): Promise<Response>;
|
|
39
|
+
attachWebSocketUpgrades(httpServer: import('node:http').Server, options?: {
|
|
40
|
+
passthroughUnmatched?: boolean;
|
|
41
|
+
}): Promise<void>;
|
|
41
42
|
/**
|
|
42
43
|
* Complete the initialization of the server adapter by processing dynamic routes
|
|
43
44
|
* @param server The Bun server instance
|
|
@@ -52,7 +53,8 @@ export declare class BunEcopagesApp<WebSocketData = undefined> extends SharedApp
|
|
|
52
53
|
* @param options Optional settings
|
|
53
54
|
* @param options.autoCompleteInitialization Whether to automatically complete initialization with dynamic routes after server start (defaults to true)
|
|
54
55
|
*/
|
|
55
|
-
|
|
56
|
+
protected bootServer(): Promise<Server<WebSocketData> | void>;
|
|
57
|
+
stop(force?: boolean): Promise<void>;
|
|
56
58
|
}
|
|
57
59
|
/**
|
|
58
60
|
* Factory function to create a Bun application
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import { DEFAULT_ECOPAGES_HOSTNAME, DEFAULT_ECOPAGES_PORT } from "../../config/constants.js";
|
|
2
1
|
import { appLogger } from "../../global/app-logger.js";
|
|
3
2
|
import { SharedApplicationAdapter } from "../shared/application-adapter.js";
|
|
4
3
|
import { resolveRuntimeBinding, resolveStaticRuntimeMode } from "../shared/runtime-app-bootstrap.js";
|
|
5
4
|
import { createBunServerAdapter } from "./server-adapter.js";
|
|
6
|
-
import { BunStaticPreviewHost } from "./static-preview-host.js";
|
|
7
5
|
import { BunRuntimeHost } from "./runtime-host.js";
|
|
6
|
+
import { hostOwnsDevClient } from "../../dev/dev-client-ownership.js";
|
|
8
7
|
class BunEcopagesApp extends SharedApplicationAdapter {
|
|
9
8
|
serverAdapter;
|
|
10
9
|
server = null;
|
|
10
|
+
stopped = false;
|
|
11
11
|
runtimeHost;
|
|
12
|
-
previewHost;
|
|
13
12
|
constructor(options, dependencies) {
|
|
14
|
-
super(options);
|
|
13
|
+
super(options, "Bun");
|
|
15
14
|
this.runtimeHost = dependencies.runtimeHost;
|
|
16
|
-
this.previewHost = dependencies.previewHost;
|
|
17
15
|
}
|
|
18
16
|
async fetch(request) {
|
|
19
17
|
if (!this.serverAdapter) {
|
|
@@ -22,6 +20,12 @@ class BunEcopagesApp extends SharedApplicationAdapter {
|
|
|
22
20
|
await this.serverAdapter.completeInitialization(this.server);
|
|
23
21
|
return this.serverAdapter.handleRequest(request);
|
|
24
22
|
}
|
|
23
|
+
async attachWebSocketUpgrades(httpServer, options) {
|
|
24
|
+
if (!this.serverAdapter) {
|
|
25
|
+
this.serverAdapter = await this.initializeServerAdapter();
|
|
26
|
+
}
|
|
27
|
+
this.serverAdapter.attachUserWebSocketUpgrades(httpServer, options);
|
|
28
|
+
}
|
|
25
29
|
/**
|
|
26
30
|
* Complete the initialization of the server adapter by processing dynamic routes
|
|
27
31
|
* @param server The Bun server instance
|
|
@@ -40,24 +44,21 @@ class BunEcopagesApp extends SharedApplicationAdapter {
|
|
|
40
44
|
cliArgs: this.cliArgs,
|
|
41
45
|
serverOptions: this.serverOptions
|
|
42
46
|
});
|
|
43
|
-
|
|
44
|
-
dev: this.cliArgs.dev,
|
|
45
|
-
cliPort: this.cliArgs.port,
|
|
46
|
-
cliHostname: this.cliArgs.hostname,
|
|
47
|
-
envPort: process.env.ECOPAGES_PORT,
|
|
48
|
-
envHostname: process.env.ECOPAGES_HOSTNAME,
|
|
49
|
-
preferredPort: binding.preferredPort,
|
|
50
|
-
preferredHostname: binding.preferredHostname,
|
|
51
|
-
composedUrl: binding.runtimeOrigin
|
|
52
|
-
});
|
|
53
|
-
return await createBunServerAdapter({
|
|
47
|
+
return createBunServerAdapter({
|
|
54
48
|
runtimeOrigin: binding.runtimeOrigin,
|
|
55
49
|
appConfig: this.appConfig,
|
|
56
50
|
apiHandlers: this.apiHandlers,
|
|
57
51
|
staticRoutes: this.staticRoutes,
|
|
58
52
|
errorHandler: this.errorHandler,
|
|
53
|
+
websocketHandlers: this.websocketHandlers.size > 0 ? this.websocketHandlers : void 0,
|
|
59
54
|
options: { watch: binding.watch },
|
|
60
|
-
serveOptions: binding.serveOptions
|
|
55
|
+
serveOptions: binding.serveOptions,
|
|
56
|
+
hostOwnsDevClient: hostOwnsDevClient(this.runtimeOptions),
|
|
57
|
+
deferRuntimeAssetSetup: resolveStaticRuntimeMode({
|
|
58
|
+
appConfig: this.appConfig,
|
|
59
|
+
cliArgs: this.cliArgs
|
|
60
|
+
}).canBuildWithoutRuntimeServer,
|
|
61
|
+
allowPortFallback: binding.allowPortFallback
|
|
61
62
|
});
|
|
62
63
|
}
|
|
63
64
|
/**
|
|
@@ -65,19 +66,33 @@ class BunEcopagesApp extends SharedApplicationAdapter {
|
|
|
65
66
|
* @param options Optional settings
|
|
66
67
|
* @param options.autoCompleteInitialization Whether to automatically complete initialization with dynamic routes after server start (defaults to true)
|
|
67
68
|
*/
|
|
68
|
-
async
|
|
69
|
+
async bootServer() {
|
|
70
|
+
if (this.stopped) {
|
|
71
|
+
this.serverAdapter = void 0;
|
|
72
|
+
this.stopped = false;
|
|
73
|
+
}
|
|
69
74
|
if (!this.serverAdapter) {
|
|
70
75
|
this.serverAdapter = await this.initializeServerAdapter();
|
|
71
76
|
}
|
|
72
|
-
const { dev, preview, build } = this.cliArgs;
|
|
77
|
+
const { dev, preview, build, force, serveOnly } = this.cliArgs;
|
|
73
78
|
const staticRuntimeMode = resolveStaticRuntimeMode({
|
|
74
79
|
appConfig: this.appConfig,
|
|
75
80
|
cliArgs: this.cliArgs
|
|
76
81
|
});
|
|
82
|
+
if (preview && serveOnly) {
|
|
83
|
+
const previewOrigin2 = await this.serverAdapter.servePreviewOnly();
|
|
84
|
+
if (previewOrigin2) {
|
|
85
|
+
this.notifyListening(previewOrigin2);
|
|
86
|
+
}
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
77
89
|
if (staticRuntimeMode.canBuildWithoutRuntimeServer) {
|
|
78
90
|
appLogger.debugTime("Building static pages");
|
|
79
|
-
await this.serverAdapter.buildStatic({ preview });
|
|
91
|
+
const previewOrigin2 = await this.serverAdapter.buildStatic({ preview, force });
|
|
80
92
|
appLogger.debugTimeEnd("Building static pages");
|
|
93
|
+
if (preview && previewOrigin2) {
|
|
94
|
+
this.notifyListening(previewOrigin2);
|
|
95
|
+
}
|
|
81
96
|
if (build) {
|
|
82
97
|
process.exit(0);
|
|
83
98
|
}
|
|
@@ -85,12 +100,7 @@ class BunEcopagesApp extends SharedApplicationAdapter {
|
|
|
85
100
|
}
|
|
86
101
|
const enableHmr = dev || !preview && !build;
|
|
87
102
|
const serverOptions = this.serverAdapter.getServerOptions({ enableHmr });
|
|
88
|
-
const
|
|
89
|
-
const configuredPort = Number(serverOptions.port ?? DEFAULT_ECOPAGES_PORT);
|
|
90
|
-
const runtimeServerOptions = (preview || build) && staticRuntimeMode.requiresFetchRuntime ? {
|
|
91
|
-
...serverOptions,
|
|
92
|
-
port: 0
|
|
93
|
-
} : serverOptions;
|
|
103
|
+
const runtimeServerOptions = serverOptions;
|
|
94
104
|
this.server = await this.runtimeHost.start({
|
|
95
105
|
serveOptions: runtimeServerOptions,
|
|
96
106
|
handleRequest: async () => new Response(null, { status: 500 }),
|
|
@@ -103,35 +113,47 @@ class BunEcopagesApp extends SharedApplicationAdapter {
|
|
|
103
113
|
if (!this.server) {
|
|
104
114
|
throw new Error("Server failed to start");
|
|
105
115
|
}
|
|
106
|
-
|
|
107
|
-
|
|
116
|
+
const runtimeOrigin = this.runtimeHost.getOrigin(
|
|
117
|
+
this.server,
|
|
118
|
+
runtimeServerOptions
|
|
108
119
|
);
|
|
120
|
+
let previewOrigin;
|
|
109
121
|
if (build || preview) {
|
|
110
122
|
appLogger.debugTime("Building static pages");
|
|
111
|
-
await this.serverAdapter.buildStatic({ preview
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
appConfig: this.appConfig,
|
|
116
|
-
hostname: configuredHostname,
|
|
117
|
-
port: configuredPort
|
|
118
|
-
});
|
|
119
|
-
if (previewPort) {
|
|
120
|
-
appLogger.info(`Preview running at http://${configuredHostname}:${previewPort}`);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
+
previewOrigin = await this.serverAdapter.buildStatic({ preview, force });
|
|
124
|
+
const buildRuntimeServer = this.server;
|
|
125
|
+
this.server = null;
|
|
126
|
+
await this.runtimeHost.stop(buildRuntimeServer, { force: true });
|
|
123
127
|
appLogger.debugTimeEnd("Building static pages");
|
|
124
128
|
if (build) {
|
|
125
129
|
process.exit(0);
|
|
126
130
|
}
|
|
131
|
+
} else {
|
|
132
|
+
this.notifyListening(runtimeOrigin);
|
|
133
|
+
}
|
|
134
|
+
if (preview && previewOrigin) {
|
|
135
|
+
this.notifyListening(previewOrigin);
|
|
136
|
+
}
|
|
137
|
+
return this.server ?? void 0;
|
|
138
|
+
}
|
|
139
|
+
async stop(force = true) {
|
|
140
|
+
if (this.stopped) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
if (this.server) {
|
|
144
|
+
const activeServer = this.server;
|
|
145
|
+
this.server = null;
|
|
146
|
+
await this.runtimeHost.stop(activeServer, { force });
|
|
147
|
+
}
|
|
148
|
+
if (this.serverAdapter) {
|
|
149
|
+
await this.serverAdapter.dispose();
|
|
127
150
|
}
|
|
128
|
-
|
|
151
|
+
this.stopped = true;
|
|
129
152
|
}
|
|
130
153
|
}
|
|
131
154
|
async function createApp(options) {
|
|
132
155
|
return new BunEcopagesApp(options, {
|
|
133
|
-
runtimeHost: new BunRuntimeHost()
|
|
134
|
-
previewHost: new BunStaticPreviewHost()
|
|
156
|
+
runtimeHost: new BunRuntimeHost()
|
|
135
157
|
});
|
|
136
158
|
}
|
|
137
159
|
export {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { Server as NodeHttpServer } from 'node:http';
|
|
1
2
|
import type { Server, WebSocketHandler } from 'bun';
|
|
2
3
|
import type { EcoPagesAppConfig } from '../../types/internal-types.js';
|
|
3
|
-
import type { ApiHandler, ErrorHandler, StaticRoute } from '../../types/public-types.js';
|
|
4
|
+
import type { ApiHandler, ErrorHandler, StaticRoute, EcopagesWebSocketHandler } from '../../types/public-types.js';
|
|
4
5
|
import { SharedServerAdapter } from '../shared/server-adapter.js';
|
|
5
6
|
import type { ServerAdapterResult } from '../abstract/server-adapter.js';
|
|
6
7
|
import type { StaticPreviewHost } from '../shared/static-preview-host.js';
|
|
@@ -32,9 +33,14 @@ export interface BunServerAdapterParams {
|
|
|
32
33
|
apiHandlers?: ApiHandler<string, Request, BunServerInstance>[];
|
|
33
34
|
staticRoutes?: StaticRoute[];
|
|
34
35
|
errorHandler?: ErrorHandler;
|
|
36
|
+
websocketHandlers?: Map<string, EcopagesWebSocketHandler<any, any>>;
|
|
35
37
|
options?: {
|
|
36
38
|
watch?: boolean;
|
|
37
39
|
};
|
|
40
|
+
delegateBrowserReloadToHost?: boolean;
|
|
41
|
+
hostOwnsDevClient?: boolean;
|
|
42
|
+
deferRuntimeAssetSetup?: boolean;
|
|
43
|
+
allowPortFallback?: boolean;
|
|
38
44
|
hmrManager?: HmrManager;
|
|
39
45
|
bridge?: ClientBridge;
|
|
40
46
|
previewHost?: StaticPreviewHost;
|
|
@@ -45,9 +51,15 @@ export interface BunServerAdapterResult extends ServerAdapterResult {
|
|
|
45
51
|
}) => BunServeOptions;
|
|
46
52
|
buildStatic: (options?: {
|
|
47
53
|
preview?: boolean;
|
|
48
|
-
|
|
54
|
+
force?: boolean;
|
|
55
|
+
}) => Promise<string | undefined>;
|
|
56
|
+
servePreviewOnly: () => Promise<string | undefined>;
|
|
49
57
|
completeInitialization: (server?: BunServerInstance | null) => Promise<void>;
|
|
50
58
|
handleRequest: (request: Request) => Promise<Response>;
|
|
59
|
+
attachUserWebSocketUpgrades: (server: NodeHttpServer, options?: {
|
|
60
|
+
passthroughUnmatched?: boolean;
|
|
61
|
+
}) => void;
|
|
62
|
+
dispose: () => Promise<void>;
|
|
51
63
|
}
|
|
52
64
|
/**
|
|
53
65
|
* Bun transport adapter that wires shared Ecopages request handling onto a live
|
|
@@ -71,7 +83,39 @@ export declare class BunServerAdapter extends SharedServerAdapter<BunServerAdapt
|
|
|
71
83
|
private initializationPromise;
|
|
72
84
|
private fullyInitialized;
|
|
73
85
|
serverInstance: BunServerInstance | null;
|
|
86
|
+
private projectWatcher;
|
|
87
|
+
private adapterDisposed;
|
|
88
|
+
private readonly deferRuntimeAssetSetup;
|
|
89
|
+
private readonly allowPortFallback;
|
|
74
90
|
private readonly previewHost;
|
|
91
|
+
/**
|
|
92
|
+
* Reference to the application-level WebSocket handlers map.
|
|
93
|
+
*
|
|
94
|
+
* @remarks
|
|
95
|
+
* This is a reference to the map owned by `AbstractApplicationAdapter`,
|
|
96
|
+
* passed in via the constructor. The Bun adapter reads from it to wire
|
|
97
|
+
* WebSocket upgrades for user-registered patterns.
|
|
98
|
+
*/
|
|
99
|
+
protected websocketHandlers: Map<string, EcopagesWebSocketHandler<any, any>>;
|
|
100
|
+
private registerBunRuntimePlugin;
|
|
101
|
+
private adaptBunWebSocket;
|
|
102
|
+
/**
|
|
103
|
+
* Resolves the per-connection context for a Bun user connection.
|
|
104
|
+
*
|
|
105
|
+
* @remarks
|
|
106
|
+
* `context()` is invoked exactly once per accepted connection. Its
|
|
107
|
+
* resolved value is shared by all subsequent lifecycle hooks. If
|
|
108
|
+
* `context()` throws, the connection is closed immediately with code
|
|
109
|
+
* 1011 (server error) and the error is logged.
|
|
110
|
+
*
|
|
111
|
+
* @param request - The original upgrade request (best-effort reconstructed)
|
|
112
|
+
* @param handler - The registered handler
|
|
113
|
+
* @param kind - The registered route pattern
|
|
114
|
+
* @param params - Dynamic path parameters
|
|
115
|
+
* @param search - Query string parameters
|
|
116
|
+
* @returns The resolved per-connection context
|
|
117
|
+
*/
|
|
118
|
+
private resolveBunContext;
|
|
75
119
|
/**
|
|
76
120
|
* Creates a Bun server adapter with already-resolved runtime collaborators.
|
|
77
121
|
*
|
|
@@ -81,11 +125,17 @@ export declare class BunServerAdapter extends SharedServerAdapter<BunServerAdapt
|
|
|
81
125
|
* is constructed, those collaborators are mandatory because the adapter cannot
|
|
82
126
|
* initialize Bun HMR or preview flows without them.
|
|
83
127
|
*/
|
|
84
|
-
constructor({ appConfig, runtimeOrigin, serveOptions, apiHandlers, staticRoutes, errorHandler, options, hmrManager, bridge, previewHost, }: BunServerAdapterParams & {
|
|
128
|
+
constructor({ appConfig, runtimeOrigin, serveOptions, apiHandlers, staticRoutes, errorHandler, websocketHandlers, options, hostOwnsDevClient, deferRuntimeAssetSetup, allowPortFallback, hmrManager, bridge, previewHost, }: BunServerAdapterParams & {
|
|
85
129
|
hmrManager: HmrManager;
|
|
86
130
|
bridge: ClientBridge;
|
|
87
131
|
previewHost: StaticPreviewHost;
|
|
88
132
|
});
|
|
133
|
+
/**
|
|
134
|
+
* Wires user WebSocket routes onto a Node HTTP server used by host integrations.
|
|
135
|
+
*/
|
|
136
|
+
attachUserWebSocketUpgrades(server: NodeHttpServer, options?: {
|
|
137
|
+
passthroughUnmatched?: boolean;
|
|
138
|
+
}): void;
|
|
89
139
|
/**
|
|
90
140
|
* Returns whether adapter-level HTML responses still need HMR runtime injection.
|
|
91
141
|
*
|
|
@@ -94,26 +144,11 @@ export declare class BunServerAdapter extends SharedServerAdapter<BunServerAdapt
|
|
|
94
144
|
* adapter-level check exists for explicit API handlers that return HTML and
|
|
95
145
|
* would otherwise bypass the route wrapper entirely.
|
|
96
146
|
*/
|
|
97
|
-
private shouldInjectHmrScript;
|
|
98
|
-
/**
|
|
99
|
-
* Delegates the HTML-response test to the shared response helper used by both
|
|
100
|
-
* adapters.
|
|
101
|
-
*/
|
|
102
|
-
private isHtmlResponse;
|
|
103
|
-
/**
|
|
104
|
-
* Injects HMR script into HTML responses in development mode.
|
|
105
|
-
* Ensures explicit API handlers that return HTML get auto-reload capability.
|
|
106
|
-
*/
|
|
107
147
|
private maybeInjectHmrScript;
|
|
108
148
|
/**
|
|
109
149
|
* Initializes the server adapter's core runtime components.
|
|
110
150
|
*/
|
|
111
151
|
initialize(): Promise<void>;
|
|
112
|
-
/**
|
|
113
|
-
* Copies the source `public` directory into the runtime output and ensures the
|
|
114
|
-
* HMR assets directory exists before any runtime bundles are emitted.
|
|
115
|
-
*/
|
|
116
|
-
private prepareRuntimePublicDir;
|
|
117
152
|
/**
|
|
118
153
|
* Registers runtime plugins and propagates the final HMR manager into each
|
|
119
154
|
* integration.
|
|
@@ -134,13 +169,31 @@ export declare class BunServerAdapter extends SharedServerAdapter<BunServerAdapt
|
|
|
134
169
|
* Builds the `Bun.serve()` options for the current adapter state.
|
|
135
170
|
*
|
|
136
171
|
* @remarks
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
172
|
+
* When HMR is enabled the websocket dispatcher merges HMR and user handlers,
|
|
173
|
+
* routing by the `kind` field embedded in socket data at upgrade time.
|
|
174
|
+
* This prevents user-registered websocket handlers from being silently overwritten
|
|
175
|
+
* by the HMR handler in development mode.
|
|
176
|
+
*
|
|
177
|
+
* User WebSocket paths are intercepted in the fetch handler via the pattern matcher.
|
|
178
|
+
* The upgrade happens implicitly — no manual GET route registration needed.
|
|
140
179
|
*/
|
|
141
180
|
getServerOptions({ enableHmr }?: {
|
|
142
181
|
enableHmr?: boolean | undefined;
|
|
143
182
|
}): BunServeOptions;
|
|
183
|
+
private createBunUserLifecycle;
|
|
184
|
+
/**
|
|
185
|
+
* @remarks
|
|
186
|
+
* HMR and user sockets share one Bun `websocket` handler. Upgrade tags HMR
|
|
187
|
+
* connections with `kind: '__hmr__'`; everything else routes to the user lifecycle.
|
|
188
|
+
*/
|
|
189
|
+
private createHmrAwareWebSocketHandler;
|
|
190
|
+
/**
|
|
191
|
+
* @remarks
|
|
192
|
+
* When `serveHmrEndpoints` is set, `/_hmr` and `/_hmr_runtime.js` are checked
|
|
193
|
+
* before user websocket patterns so HMR upgrades are never captured by app routes.
|
|
194
|
+
* Production mode with only user handlers skips the HMR branch entirely.
|
|
195
|
+
*/
|
|
196
|
+
private wrapFetchWithWebSocketUpgrades;
|
|
144
197
|
/**
|
|
145
198
|
* Helper method to retrieve and parse the request body.
|
|
146
199
|
* Handles JSON and plain text content types.
|
|
@@ -163,7 +216,14 @@ export declare class BunServerAdapter extends SharedServerAdapter<BunServerAdapt
|
|
|
163
216
|
*/
|
|
164
217
|
buildStatic(options?: {
|
|
165
218
|
preview?: boolean;
|
|
166
|
-
|
|
219
|
+
force?: boolean;
|
|
220
|
+
}): Promise<string | undefined>;
|
|
221
|
+
/**
|
|
222
|
+
* Serves an existing static export without running SSG. Used by e2e preview
|
|
223
|
+
* launchers after a shared prewarm build.
|
|
224
|
+
*/
|
|
225
|
+
servePreviewOnly(): Promise<string | undefined>;
|
|
226
|
+
private startPreviewServer;
|
|
167
227
|
/**
|
|
168
228
|
* Initializes the server with dynamic routes after server creation.
|
|
169
229
|
* Must be called before handling any requests.
|
|
@@ -184,6 +244,14 @@ export declare class BunServerAdapter extends SharedServerAdapter<BunServerAdapt
|
|
|
184
244
|
* @returns Configured adapter with server methods
|
|
185
245
|
*/
|
|
186
246
|
createAdapter(): Promise<BunServerAdapterResult>;
|
|
247
|
+
/**
|
|
248
|
+
* Releases dev-time resources owned by the adapter.
|
|
249
|
+
*
|
|
250
|
+
* @remarks
|
|
251
|
+
* Safe to call multiple times. Does not stop the bound Bun server — callers
|
|
252
|
+
* should shut down transport through the runtime host before disposing.
|
|
253
|
+
*/
|
|
254
|
+
dispose(): Promise<void>;
|
|
187
255
|
/**
|
|
188
256
|
* Handles HTTP requests by passing them securely to the shared core router adapter.
|
|
189
257
|
*
|