@ecopages/core 0.2.0-beta.14 → 0.2.0-beta.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecopages/core",
3
- "version": "0.2.0-beta.14",
3
+ "version": "0.2.0-beta.15",
4
4
  "description": "Core package for Ecopages",
5
5
  "keywords": [
6
6
  "ecopages",
@@ -17,7 +17,7 @@
17
17
  "directory": "packages/core"
18
18
  },
19
19
  "dependencies": {
20
- "@ecopages/file-system": "0.2.0-beta.14",
20
+ "@ecopages/file-system": "0.2.0-beta.15",
21
21
  "@ecopages/logger": "^0.2.3",
22
22
  "@ecopages/scripts-injector": "^0.1.5",
23
23
  "@oxc-project/runtime": "0.134.0",
@@ -121,10 +121,6 @@
121
121
  "types": "./src/dev/dev-client-ownership.d.ts",
122
122
  "default": "./src/dev/dev-client-ownership.js"
123
123
  },
124
- "./dev/server-ready-message": {
125
- "types": "./src/dev/server-ready-message.d.ts",
126
- "default": "./src/dev/server-ready-message.js"
127
- },
128
124
  "./services/asset-processing-service": {
129
125
  "types": "./src/services/assets/asset-processing-service/index.d.ts",
130
126
  "default": "./src/services/assets/asset-processing-service/index.js"
@@ -314,10 +310,6 @@
314
310
  "types": "./src/dev/dev-client-ownership.d.ts",
315
311
  "default": "./src/dev/dev-client-ownership.js"
316
312
  },
317
- "./dev/server-ready-message.ts": {
318
- "types": "./src/dev/server-ready-message.d.ts",
319
- "default": "./src/dev/server-ready-message.js"
320
- },
321
313
  "./services/asset-processing-service.ts": {
322
314
  "types": "./src/services/assets/asset-processing-service/index.d.ts",
323
315
  "default": "./src/services/assets/asset-processing-service/index.js"
@@ -10,6 +10,7 @@ import type { SourceModuleLoader } from '../../services/module-loading/module-lo
10
10
  import type { EcoPagesAppConfig } from '../../types/internal-types.js';
11
11
  import type { ApiHandler, ApiHandlerContext, ErrorHandler, Middleware, RouteOptions, StaticRoute, ViewLoader } from '../../types/public-types.js';
12
12
  import type { EcopagesWebSocketHandler } from '../../types/public-types.js';
13
+ import { type EcopagesRuntimeLabel } from '../../dev/runtime-server-started-message.js';
13
14
  import { type ReturnParseCliArgs } from '../../utils/parse-cli-args.js';
14
15
  /**
15
16
  * Runtime bootstrap options layered on top of the app config.
@@ -110,7 +111,8 @@ export declare abstract class AbstractApplicationAdapter<TOptions extends Applic
110
111
  */
111
112
  protected websocketHandlers: Map<string, EcopagesWebSocketHandler<any, any>>;
112
113
  private onAppStartCallback?;
113
- constructor(options: TOptions);
114
+ protected readonly runtimeLabel: EcopagesRuntimeLabel;
115
+ constructor(options: TOptions, runtimeLabel: EcopagesRuntimeLabel);
114
116
  private clearDistFolder;
115
117
  /**
116
118
  * Register a GET route handler.
@@ -266,6 +268,7 @@ export declare abstract class AbstractApplicationAdapter<TOptions extends Applic
266
268
  start(onAppStart?: OnAppStartCallback): Promise<TServer | void>;
267
269
  /** Runtime-specific server boot (dev, preview, build). */
268
270
  protected abstract bootServer(): Promise<TServer | void>;
271
+ protected logServerStarted(origin: string): void;
269
272
  /**
270
273
  * Invoked by embedded hosts (for example Vite) once the app can take traffic.
271
274
  */
@@ -6,7 +6,9 @@ import {
6
6
  import { getHostModuleLoader } from "../../services/module-loading/host-module-loader-registry.js";
7
7
  import { invariant } from "../../utils/invariant.js";
8
8
  import { fileSystem } from "@ecopages/file-system";
9
- import { formatServerReadyMessage } from "../../dev/server-ready-message.js";
9
+ import {
10
+ formatRuntimeServerStartedMessage
11
+ } from "../../dev/runtime-server-started-message.js";
10
12
  import { parseCliArgs } from "../../utils/parse-cli-args.js";
11
13
  class AbstractApplicationAdapter {
12
14
  appConfig;
@@ -22,7 +24,9 @@ class AbstractApplicationAdapter {
22
24
  */
23
25
  websocketHandlers = /* @__PURE__ */ new Map();
24
26
  onAppStartCallback;
25
- constructor(options) {
27
+ runtimeLabel;
28
+ constructor(options, runtimeLabel) {
29
+ this.runtimeLabel = runtimeLabel;
26
30
  this.appConfig = options.appConfig;
27
31
  this.serverOptions = options.serverOptions || {};
28
32
  this.runtimeOptions = options.runtime ?? {};
@@ -206,6 +210,9 @@ class AbstractApplicationAdapter {
206
210
  }
207
211
  return this.bootServer();
208
212
  }
213
+ logServerStarted(origin) {
214
+ appLogger.info(formatRuntimeServerStartedMessage(this.runtimeLabel, origin));
215
+ }
209
216
  /**
210
217
  * Invoked by embedded hosts (for example Vite) once the app can take traffic.
211
218
  */
@@ -215,7 +222,7 @@ class AbstractApplicationAdapter {
215
222
  notifyListening(origin) {
216
223
  const normalizedOrigin = origin.replace(/\/$/, "");
217
224
  if (!this.onAppStartCallback) {
218
- console.log(formatServerReadyMessage(normalizedOrigin));
225
+ this.logServerStarted(normalizedOrigin);
219
226
  }
220
227
  this.onAppStartCallback?.({ origin: normalizedOrigin });
221
228
  }
@@ -10,7 +10,7 @@ class BunEcopagesApp extends SharedApplicationAdapter {
10
10
  stopped = false;
11
11
  runtimeHost;
12
12
  constructor(options, dependencies) {
13
- super(options);
13
+ super(options, "Bun");
14
14
  this.runtimeHost = dependencies.runtimeHost;
15
15
  }
16
16
  async fetch(request) {
@@ -12,7 +12,7 @@ class NodeEcopagesApp extends SharedApplicationAdapter {
12
12
  stopped = false;
13
13
  runtimeHost;
14
14
  constructor(options, dependencies) {
15
- super(options);
15
+ super(options, "Node");
16
16
  this.runtimeHost = dependencies.runtimeHost;
17
17
  }
18
18
  createServerAdapter(params) {
@@ -0,0 +1,2 @@
1
+ export type EcopagesRuntimeLabel = 'Bun' | 'Node';
2
+ export declare function formatRuntimeServerStartedMessage(runtime: EcopagesRuntimeLabel, origin: string): string;
@@ -0,0 +1,6 @@
1
+ function formatRuntimeServerStartedMessage(runtime, origin) {
2
+ return `${runtime} server running at ${origin.replace(/\/$/, "")}`;
3
+ }
4
+ export {
5
+ formatRuntimeServerStartedMessage
6
+ };
@@ -1,6 +0,0 @@
1
- /**
2
- * Optional helpers for apps that want a machine-readable "ready" log line
3
- * (for example Playwright `webServer` stdout matching). Pass to `app.start(onAppStart)`.
4
- */
5
- export declare const ECOPAGES_SERVER_READY_MARKER = "[@ecopages/ready]";
6
- export declare function formatServerReadyMessage(origin: string): string;
@@ -1,8 +0,0 @@
1
- const ECOPAGES_SERVER_READY_MARKER = "[@ecopages/ready]";
2
- function formatServerReadyMessage(origin) {
3
- return `${ECOPAGES_SERVER_READY_MARKER} ${origin.replace(/\/$/, "")}`;
4
- }
5
- export {
6
- ECOPAGES_SERVER_READY_MARKER,
7
- formatServerReadyMessage
8
- };