@absolutejs/absolute 0.19.0-beta.676 → 0.19.0-beta.678

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/dist/cli/index.js CHANGED
@@ -1285,8 +1285,12 @@ Found ${errorCount} error${suffix}.`;
1285
1285
  const hasAngular = targets.some((config) => Boolean(config.angularDirectory));
1286
1286
  const hasSvelte = targets.some((config) => Boolean(config.svelteDirectory));
1287
1287
  const hasVue = targets.some((config) => Boolean(config.vueDirectory));
1288
- const svelteDirs = [...new Set(targets.map((config) => config.svelteDirectory).filter((dir) => typeof dir === "string" && dir.length > 0))];
1289
- const angularDirs = [...new Set(targets.map((config) => config.angularDirectory).filter((dir) => typeof dir === "string" && dir.length > 0))];
1288
+ const svelteDirs = [
1289
+ ...new Set(targets.map((config) => config.svelteDirectory).filter((dir) => typeof dir === "string" && dir.length > 0))
1290
+ ];
1291
+ const angularDirs = [
1292
+ ...new Set(targets.map((config) => config.angularDirectory).filter((dir) => typeof dir === "string" && dir.length > 0))
1293
+ ];
1290
1294
  const cacheDir = ".absolutejs";
1291
1295
  await mkdir2(cacheDir, { recursive: true });
1292
1296
  const checks = [];
@@ -2846,6 +2850,14 @@ var createWorkspaceTui = ({
2846
2850
  logEntries.length = 0;
2847
2851
  scheduleRender();
2848
2852
  };
2853
+ const getRecentLogs = (limit = 40) => logEntries.slice(Math.max(0, logEntries.length - limit));
2854
+ const getServiceSnapshot = () => [...serviceStates.values()].map((service) => ({
2855
+ detail: service.detail,
2856
+ name: service.name,
2857
+ status: service.status,
2858
+ target: getTargetLabel(service),
2859
+ visibility: service.visibility
2860
+ }));
2849
2861
  const navigateShellHistory = (direction) => {
2850
2862
  if (!shellMode || shellHistory.length === 0) {
2851
2863
  return;
@@ -3010,6 +3022,8 @@ var createWorkspaceTui = ({
3010
3022
  addLog,
3011
3023
  clearLogs,
3012
3024
  dispose,
3025
+ getRecentLogs,
3026
+ getServiceSnapshot,
3013
3027
  setReadyDuration,
3014
3028
  setServiceStatus,
3015
3029
  start: start2
@@ -3388,6 +3402,33 @@ var workspace = async (subcommand, options) => {
3388
3402
  }
3389
3403
  await Promise.all(snapshot.map((service) => service.process.exited));
3390
3404
  };
3405
+ const printFailureSummary = (exitCode) => {
3406
+ const servicesSnapshot = tui.getServiceSnapshot();
3407
+ const recentLogs = tui.getRecentLogs(60);
3408
+ const failedServices = servicesSnapshot.filter((service) => service.status === "error");
3409
+ const relevantLogs = recentLogs.filter((entry) => entry.level === "error" || entry.level === "warn" || entry.source === "workspace" || failedServices.some((service) => service.name === entry.source));
3410
+ const logsToPrint = (relevantLogs.length > 0 ? relevantLogs : recentLogs).slice(-30);
3411
+ const lines = [
3412
+ "",
3413
+ `\x1B[31mABSOLUTEJS WORKSPACE exited with code ${exitCode}\x1B[0m`,
3414
+ "",
3415
+ "Services:",
3416
+ ...servicesSnapshot.map((service) => {
3417
+ const detail = service.detail ? ` \xB7 ${service.detail}` : "";
3418
+ return ` - ${service.name}: ${service.status} \xB7 ${service.target}${detail}`;
3419
+ })
3420
+ ];
3421
+ if (logsToPrint.length > 0) {
3422
+ lines.push("", "Recent logs:");
3423
+ for (const entry of logsToPrint) {
3424
+ lines.push(` ${entry.timestamp} [${entry.source}] ${entry.message}`);
3425
+ }
3426
+ }
3427
+ lines.push("");
3428
+ process.stderr.write(`${lines.join(`
3429
+ `)}
3430
+ `);
3431
+ };
3391
3432
  const sendSignalToService = (processHandle, signal) => {
3392
3433
  try {
3393
3434
  process.kill(-processHandle.pid, signal);
@@ -3402,7 +3443,11 @@ var workspace = async (subcommand, options) => {
3402
3443
  return;
3403
3444
  }
3404
3445
  shuttingDown = true;
3446
+ const shouldPrintFailureSummary = exitCode !== 0;
3405
3447
  tui.dispose();
3448
+ if (shouldPrintFailureSummary) {
3449
+ printFailureSummary(exitCode);
3450
+ }
3406
3451
  if (paused) {
3407
3452
  for (const service of running) {
3408
3453
  sendSignalToService(service.process, "SIGCONT");
package/dist/index.js CHANGED
@@ -172153,6 +172153,26 @@ var init_pageMetadata = __esm(() => {
172153
172153
  };
172154
172154
  });
172155
172155
 
172156
+ // src/utils/startupTimings.ts
172157
+ var startupTimingsEnabled, formatStartupTimingBlock = (title, steps) => {
172158
+ const totalDuration = steps.reduce((sum, step) => sum + step.durationMs, 0);
172159
+ return [
172160
+ title,
172161
+ ...steps.map((step) => ` - ${step.label}: ${getDurationString(step.durationMs)}`),
172162
+ ` Total: ${getDurationString(totalDuration)}`
172163
+ ].join(`
172164
+ `);
172165
+ }, logStartupTimingBlock = (title, steps) => {
172166
+ if (!startupTimingsEnabled || steps.length === 0) {
172167
+ return;
172168
+ }
172169
+ console.log(formatStartupTimingBlock(title, steps));
172170
+ };
172171
+ var init_startupTimings = __esm(() => {
172172
+ init_getDurationString();
172173
+ startupTimingsEnabled = process.env.ABSOLUTE_STARTUP_TIMINGS === "1" || process.env.ABSOLUTE_STARTUP_TIMINGS === "true";
172174
+ });
172175
+
172156
172176
  // src/utils/normalizePath.ts
172157
172177
  var normalizePath = (path) => path.replace(/\\/g, "/");
172158
172178
 
@@ -180967,9 +180987,21 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
180967
180987
  await handleCachedReload();
180968
180988
  return cached;
180969
180989
  }
180990
+ const startupSteps = [];
180991
+ const recordStep = (label, startedAt) => {
180992
+ startupSteps.push({
180993
+ label,
180994
+ durationMs: performance.now() - startedAt
180995
+ });
180996
+ };
180997
+ let stepStartedAt = performance.now();
180970
180998
  const state = createHMRState(config);
180999
+ recordStep("create HMR state", stepStartedAt);
181000
+ stepStartedAt = performance.now();
180971
181001
  const watchPaths = getWatchPaths(config, state.resolvedPaths);
180972
181002
  buildInitialDependencyGraph(state.dependencyGraph, watchPaths);
181003
+ recordStep("initialize dependency graph", stepStartedAt);
181004
+ stepStartedAt = performance.now();
180973
181005
  if (config.reactDirectory) {
180974
181006
  setDevVendorPaths(computeVendorPaths());
180975
181007
  }
@@ -180985,7 +181017,10 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
180985
181017
  const sourceDirs = collectDepVendorSourceDirs(config);
180986
181018
  const { computeDepVendorPaths: computeDepVendorPaths2 } = await Promise.resolve().then(() => (init_buildDepVendor(), exports_buildDepVendor));
180987
181019
  globalThis.__depVendorPaths = await computeDepVendorPaths2(sourceDirs);
181020
+ recordStep("prepare vendor paths", stepStartedAt);
181021
+ stepStartedAt = performance.now();
180988
181022
  await resolveAbsoluteVersion2();
181023
+ recordStep("resolve version", stepStartedAt);
180989
181024
  const buildStart = performance.now();
180990
181025
  const buildResult = await build2({
180991
181026
  ...config,
@@ -180997,11 +181032,15 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
180997
181032
  });
180998
181033
  const manifest = buildResult.manifest ?? {};
180999
181034
  const conventions2 = buildResult.conventions ?? {};
181035
+ recordStep("initial build", buildStart);
181000
181036
  if (Object.keys(manifest).length === 0) {
181001
181037
  console.log("\u26A0\uFE0F Manifest is empty - this is OK for HTML/HTMX-only projects");
181002
181038
  }
181039
+ stepStartedAt = performance.now();
181003
181040
  await populateAssetStore(state.assetStore, manifest, state.resolvedPaths.buildDir);
181004
181041
  cleanStaleAssets(state.assetStore, manifest, state.resolvedPaths.buildDir);
181042
+ recordStep("populate asset store", stepStartedAt);
181043
+ stepStartedAt = performance.now();
181005
181044
  const buildReactVendorTask = config.reactDirectory ? buildReactVendor(state.resolvedPaths.buildDir).then(async () => {
181006
181045
  const vendorDir = resolve32(state.resolvedPaths.buildDir, "react", "vendor");
181007
181046
  await loadVendorFiles(state.assetStore, vendorDir, "react");
@@ -181039,19 +181078,25 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
181039
181078
  buildVueVendorTask,
181040
181079
  buildDepVendorTask
181041
181080
  ]);
181081
+ recordStep("build vendor bundles", stepStartedAt);
181082
+ stepStartedAt = performance.now();
181042
181083
  const { warmCompilers: warmCompilers2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
181043
181084
  await warmCompilers2({
181044
181085
  svelte: Boolean(config.svelteDirectory),
181045
181086
  vue: Boolean(config.vueDirectory)
181046
181087
  });
181088
+ recordStep("warm compilers", stepStartedAt);
181047
181089
  state.manifest = manifest;
181090
+ stepStartedAt = performance.now();
181048
181091
  startFileWatching(state, config, (filePath) => {
181049
181092
  queueFileChange(state, filePath, config, (newBuildResult) => {
181050
181093
  Object.assign(manifest, newBuildResult.manifest);
181051
181094
  state.manifest = manifest;
181052
181095
  });
181053
181096
  });
181097
+ recordStep("start file watching", stepStartedAt);
181054
181098
  globalThis.__hmrBuildDuration = performance.now() - buildStart;
181099
+ logStartupTimingBlock("AbsoluteJS devBuild timing", startupSteps);
181055
181100
  const result = {
181056
181101
  conventions: conventions2,
181057
181102
  hmrState: state,
@@ -181075,6 +181120,7 @@ var init_devBuild = __esm(() => {
181075
181120
  init_assetStore();
181076
181121
  init_rebuildTrigger();
181077
181122
  init_logger();
181123
+ init_startupTimings();
181078
181124
  FRAMEWORK_DIR_KEYS = [
181079
181125
  "reactDirectory",
181080
181126
  "svelteDirectory",
@@ -182057,6 +182103,7 @@ var loadIslandRegistry = async (registryPath) => {
182057
182103
  // src/core/prepare.ts
182058
182104
  init_pageMetadata();
182059
182105
  init_resolveConvention();
182106
+ init_startupTimings();
182060
182107
  var MS_PER_SECOND2 = 1000;
182061
182108
  var DEFAULT_PORT2 = 3000;
182062
182109
  var MAX_STATIC_ROUTE_COUNT = Number.MAX_SAFE_INTEGER;
@@ -182129,10 +182176,22 @@ var patchManifestIndexes = (manifest, devIndexDir, SRC_URL_PREFIX2) => {
182129
182176
  }
182130
182177
  };
182131
182178
  var prepareDev = async (config, buildDir) => {
182179
+ const startupSteps = [];
182180
+ const recordStep = (label, startedAt) => {
182181
+ startupSteps.push({
182182
+ label,
182183
+ durationMs: performance.now() - startedAt
182184
+ });
182185
+ };
182186
+ let stepStartedAt = performance.now();
182132
182187
  const { patchElysiaRouteRegistrationCallsites: patchElysiaRouteRegistrationCallsites2 } = await Promise.resolve().then(() => (init_devRouteRegistrationCallsite(), exports_devRouteRegistrationCallsite));
182133
182188
  patchElysiaRouteRegistrationCallsites2();
182189
+ recordStep("patch route registration", stepStartedAt);
182190
+ stepStartedAt = performance.now();
182134
182191
  const { devBuild: devBuild2 } = await Promise.resolve().then(() => (init_devBuild(), exports_devBuild));
182135
182192
  const result = await devBuild2(config);
182193
+ recordStep("devBuild", stepStartedAt);
182194
+ stepStartedAt = performance.now();
182136
182195
  const { hmr: hmr2 } = await Promise.resolve().then(() => (init_hmr(), exports_hmr));
182137
182196
  const { staticPlugin } = await import("@elysiajs/static");
182138
182197
  const { createModuleServer: createModuleServer2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
@@ -182142,6 +182201,8 @@ var prepareDev = async (config, buildDir) => {
182142
182201
  getSvelteVendorPaths: getSvelteVendorPaths2,
182143
182202
  getVueVendorPaths: getVueVendorPaths2
182144
182203
  } = await Promise.resolve().then(() => exports_devVendorPaths);
182204
+ recordStep("load dev runtime modules", stepStartedAt);
182205
+ stepStartedAt = performance.now();
182145
182206
  const depVendorPaths = globalThis.__depVendorPaths ?? {};
182146
182207
  const allVendorPaths = {
182147
182208
  ...getDevVendorPaths2() ?? {},
@@ -182162,19 +182223,25 @@ var prepareDev = async (config, buildDir) => {
182162
182223
  vendorPaths: allVendorPaths
182163
182224
  });
182164
182225
  setGlobalModuleServer2(moduleHandler);
182226
+ recordStep("create module server", stepStartedAt);
182165
182227
  const { warmCache: warmCache2, SRC_URL_PREFIX: SRC_URL_PREFIX2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
182166
182228
  const prewarmDirs = buildPrewarmDirs(config);
182229
+ stepStartedAt = performance.now();
182167
182230
  await warmPrewarmDirs(prewarmDirs, warmCache2, SRC_URL_PREFIX2);
182231
+ recordStep("prewarm source modules", stepStartedAt);
182168
182232
  if (config.dev?.https) {
182169
182233
  globalThis.__http2Config = {
182170
182234
  hmrState: result.hmrState,
182171
182235
  manifest: result.manifest
182172
182236
  };
182173
182237
  }
182238
+ stepStartedAt = performance.now();
182174
182239
  const hmrPlugin = hmr2(result.hmrState, result.manifest, moduleHandler);
182175
182240
  const { devtoolsJson: devtoolsJson2 } = await Promise.resolve().then(() => (init_devtoolsJson(), exports_devtoolsJson));
182176
182241
  const devIndexDir = resolve35(buildDir, "_src_indexes");
182177
182242
  patchManifestIndexes(result.manifest, devIndexDir, SRC_URL_PREFIX2);
182243
+ recordStep("configure dev plugins", stepStartedAt);
182244
+ stepStartedAt = performance.now();
182178
182245
  if (result.conventions)
182179
182246
  setConventions(result.conventions);
182180
182247
  setCurrentIslandManifest(result.manifest);
@@ -182182,6 +182249,8 @@ var prepareDev = async (config, buildDir) => {
182182
182249
  setCurrentIslandRegistry(await loadIslandRegistry(config.islands.registry));
182183
182250
  }
182184
182251
  setCurrentPageIslandMetadata(await loadPageIslandMetadata(config));
182252
+ recordStep("load runtime metadata", stepStartedAt);
182253
+ stepStartedAt = performance.now();
182185
182254
  const { imageOptimizer: imageOptimizer2 } = await Promise.resolve().then(() => (init_imageOptimizer(), exports_imageOptimizer));
182186
182255
  const absolutejs = new Elysia5({ name: "absolutejs-runtime" }).use(devtoolsJson2(buildDir, {
182187
182256
  normalizeForWindowsContainer: config.dev?.devtools?.normalizeForWindowsContainer,
@@ -182196,6 +182265,8 @@ var prepareDev = async (config, buildDir) => {
182196
182265
  prefix: "",
182197
182266
  staticLimit: MAX_STATIC_ROUTE_COUNT
182198
182267
  })).use(hmrPlugin).use(createSitemapPlugin(buildDir, config.sitemap)).use(createNotFoundPlugin());
182268
+ recordStep("assemble dev runtime", stepStartedAt);
182269
+ logStartupTimingBlock("AbsoluteJS prepareDev timing", startupSteps);
182199
182270
  return {
182200
182271
  absolutejs,
182201
182272
  manifest: result.manifest
@@ -182235,23 +182306,42 @@ var createNotFoundPlugin = () => new Elysia5({ name: "absolutejs-not-found" }).o
182235
182306
  return;
182236
182307
  });
182237
182308
  var prepare = async (configOrPath) => {
182309
+ const startupSteps = [];
182310
+ const recordStep = (label, startedAt) => {
182311
+ startupSteps.push({
182312
+ label,
182313
+ durationMs: performance.now() - startedAt
182314
+ });
182315
+ };
182316
+ let stepStartedAt = performance.now();
182238
182317
  const config = await loadConfig(configOrPath);
182318
+ recordStep("load config", stepStartedAt);
182239
182319
  const nodeEnv = process.env["NODE_ENV"];
182240
182320
  const isDev3 = nodeEnv === "development";
182241
182321
  const buildDir = resolve35(process.env.ABSOLUTE_BUILD_DIR ?? config.buildDirectory ?? "build");
182242
- if (isDev3)
182243
- return prepareDev(config, buildDir);
182322
+ if (isDev3) {
182323
+ stepStartedAt = performance.now();
182324
+ const result = await prepareDev(config, buildDir);
182325
+ recordStep("prepare dev runtime", stepStartedAt);
182326
+ logStartupTimingBlock("AbsoluteJS prepare timing", startupSteps);
182327
+ return result;
182328
+ }
182329
+ stepStartedAt = performance.now();
182244
182330
  const manifest = JSON.parse(readFileSync16(`${buildDir}/manifest.json`, "utf-8"));
182245
182331
  setCurrentIslandManifest(manifest);
182246
182332
  if (config.islands?.registry) {
182247
182333
  setCurrentIslandRegistry(await loadIslandRegistry(config.islands.registry));
182248
182334
  }
182249
182335
  setCurrentPageIslandMetadata(await loadPageIslandMetadata(config));
182336
+ recordStep("load production manifest and island metadata", stepStartedAt);
182337
+ stepStartedAt = performance.now();
182250
182338
  const conventionsPath = join24(buildDir, "conventions.json");
182251
182339
  if (existsSync24(conventionsPath)) {
182252
182340
  const conventions2 = JSON.parse(readFileSync16(conventionsPath, "utf-8"));
182253
182341
  setConventions(conventions2);
182254
182342
  }
182343
+ recordStep("load production conventions", stepStartedAt);
182344
+ stepStartedAt = performance.now();
182255
182345
  const { staticPlugin } = await import("@elysiajs/static");
182256
182346
  const staticFiles = staticPlugin({
182257
182347
  assets: buildDir,
@@ -182259,8 +182349,11 @@ var prepare = async (configOrPath) => {
182259
182349
  prefix: "",
182260
182350
  staticLimit: MAX_STATIC_ROUTE_COUNT
182261
182351
  });
182352
+ recordStep("create static plugin", stepStartedAt);
182353
+ stepStartedAt = performance.now();
182262
182354
  const prerenderDir = join24(buildDir, "_prerendered");
182263
182355
  const prerenderMap = loadPrerenderMap(prerenderDir);
182356
+ recordStep("load prerender map", stepStartedAt);
182264
182357
  if (prerenderMap.size > 0) {
182265
182358
  const { PRERENDER_BYPASS_HEADER: PRERENDER_BYPASS_HEADER2, readTimestamp: readTimestamp2, rerenderRoute: rerenderRoute2 } = await Promise.resolve().then(() => (init_prerender(), exports_prerender));
182266
182359
  const revalidateMs = config.static?.revalidate ? config.static.revalidate * MS_PER_SECOND2 : 0;
@@ -182285,12 +182378,18 @@ var prepare = async (configOrPath) => {
182285
182378
  headers: { "content-type": "text/html; charset=utf-8" }
182286
182379
  });
182287
182380
  });
182381
+ stepStartedAt = performance.now();
182288
182382
  const { imageOptimizer: imageOptimizer3 } = await Promise.resolve().then(() => (init_imageOptimizer(), exports_imageOptimizer));
182289
182383
  const absolutejs2 = new Elysia5({ name: "absolutejs-runtime" }).use(imageOptimizer3(config.images, buildDir)).use(prerenderPlugin).use(staticFiles).use(createSitemapPlugin(buildDir, config.sitemap)).use(createNotFoundPlugin());
182384
+ recordStep("assemble production runtime", stepStartedAt);
182385
+ logStartupTimingBlock("AbsoluteJS prepare timing", startupSteps);
182290
182386
  return { absolutejs: absolutejs2, manifest };
182291
182387
  }
182388
+ stepStartedAt = performance.now();
182292
182389
  const { imageOptimizer: imageOptimizer2 } = await Promise.resolve().then(() => (init_imageOptimizer(), exports_imageOptimizer));
182293
182390
  const absolutejs = new Elysia5({ name: "absolutejs-runtime" }).use(imageOptimizer2(config.images, buildDir)).use(staticFiles).use(createSitemapPlugin(buildDir, config.sitemap)).use(createNotFoundPlugin());
182391
+ recordStep("assemble production runtime", stepStartedAt);
182392
+ logStartupTimingBlock("AbsoluteJS prepare timing", startupSteps);
182294
182393
  return { absolutejs, manifest };
182295
182394
  };
182296
182395
 
@@ -188898,5 +188997,5 @@ export {
188898
188997
  ANGULAR_INIT_TIMEOUT_MS
188899
188998
  };
188900
188999
 
188901
- //# debugId=97D769D373BB628F64756E2164756E21
189000
+ //# debugId=34F91B1BAA5BDB1464756E2164756E21
188902
189001
  //# sourceMappingURL=index.js.map