@jay-framework/production-server 0.19.3 → 0.19.5

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/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- import { B as BuildOptions, R as RouteManifest, a as RouteEntry } from './serve-index-GLq2Yw4z.js';
2
- export { A as ActionEntry, e as ArtifactStore, c as BuildMetadata, C as CacheEntry, F as FilesystemArtifactStore, I as InstanceEntry, M as MatchResult, d as PageModule, P as PluginEntry, n as PreImportedPlugin, b as RouteSegment, S as ServerElementModule, g as fetchActionRequest, f as fetchPageRequest, j as fetchStaticFile, k as initializeServices, l as initializeServicesFromModules, i as isActionRequest, m as matchRequest, r as registerActionsFromManifest, h as registerActionsFromModules } from './serve-index-GLq2Yw4z.js';
1
+ import { B as BuildOptions, R as RouteManifest, a as RouteEntry } from './serve-index-HC05uvRi.js';
2
+ export { A as ActionEntry, e as ArtifactStore, c as BuildMetadata, C as CacheEntry, F as FilesystemArtifactStore, I as InstanceEntry, M as MatchResult, d as PageModule, P as PluginEntry, n as PreImportedPlugin, b as RouteSegment, S as ServerElementModule, g as fetchActionRequest, f as fetchPageRequest, j as fetchStaticFile, k as initializeServices, l as initializeServicesFromModules, i as isActionRequest, m as matchRequest, r as registerActionsFromManifest, h as registerActionsFromModules } from './serve-index-HC05uvRi.js';
3
3
  import '@jay-framework/ssr-runtime';
4
+ import '@jay-framework/compiler-shared';
4
5
  import '@jay-framework/stack-server-runtime';
5
6
 
6
7
  declare function buildVersion(options: BuildOptions): Promise<RouteManifest>;
package/dist/index.js CHANGED
@@ -6,8 +6,8 @@ import path from "node:path";
6
6
  import fs from "node:fs/promises";
7
7
  import { createRequire } from "node:module";
8
8
  import { DevSlowlyChangingPhase, slowRenderInstances, scanPlugins, runLoadParams, parseCookies } from "@jay-framework/stack-server-runtime";
9
- import { l as loadProductionPageParts, g as buildPagePartsConfig, d as initializeServices, r as registerActionsFromManifest, i as isActionRequest, a as fetchActionRequest, c as fetchStaticFile, m as matchRequest, f as fetchPageRequest, F as FilesystemArtifactStore } from "./init-services-F6Svgfm9.js";
10
- import { e, b } from "./init-services-F6Svgfm9.js";
9
+ import { l as loadProductionPageParts, g as buildPagePartsConfig, d as initializeServices, r as registerActionsFromManifest, i as isActionRequest, a as fetchActionRequest, c as fetchStaticFile, m as matchRequest, f as fetchPageRequest, F as FilesystemArtifactStore } from "./init-services-z79V7RtD.js";
10
+ import { e, b } from "./init-services-z79V7RtD.js";
11
11
  import crypto from "node:crypto";
12
12
  import fs$1 from "node:fs";
13
13
  import { jayRuntime } from "@jay-framework/vite-plugin";
@@ -561,7 +561,7 @@ async function compileServerElement(jayHtmlContent, jayHtmlFilename, jayHtmlDir,
561
561
  cssFile = cssFilename;
562
562
  }
563
563
  getLogger().info(`[Build] Compiled server element: ${path.basename(outputPath)}`);
564
- return { cssFile, cssImports };
564
+ return { cssFile, cssImports, headMeta: parsedJayFile.headMeta };
565
565
  }
566
566
  async function compileRouteServerElement(jayHtmlPath, outputPath, projectRoot, tsConfigFilePath, minifyCss = true) {
567
567
  const jayHtmlContent = await fs.readFile(jayHtmlPath, "utf-8");
@@ -1165,6 +1165,9 @@ async function buildVersion(options) {
1165
1165
  if (seResult.cssImports?.length) {
1166
1166
  entry.cssImports = seResult.cssImports;
1167
1167
  }
1168
+ if (seResult.headMeta) {
1169
+ entry.headMeta = seResult.headMeta;
1170
+ }
1168
1171
  logger.important(`[Build] Route server element: ${routeDir}`);
1169
1172
  } catch (err) {
1170
1173
  logger.error(`[Build] Route server element FAILED ${route.rawRoute}: ${err.message}`);
@@ -6,7 +6,7 @@ var __publicField = (obj, key, value) => {
6
6
  };
7
7
  import fs from "node:fs/promises";
8
8
  import path from "node:path";
9
- import { renderFastChangingData, mergeHeadTags, serializeHeadTags, getClientInitData, actionRegistry, setClientInitData } from "@jay-framework/stack-server-runtime";
9
+ import { renderFastChangingData, headMetaToHeadTags, mergeHeadTags, serializeHeadTags, getClientInitData, actionRegistry, setClientInitData } from "@jay-framework/stack-server-runtime";
10
10
  import { deepMergeViewStates } from "@jay-framework/view-state-merge";
11
11
  import { asyncSwapScript } from "@jay-framework/ssr-runtime";
12
12
  import { createRequire } from "node:module";
@@ -413,6 +413,8 @@ async function fetchPageRequest(match, manifest, requestUrl, artifacts, staticBa
413
413
  const fastViewState = fastResult.rendered || {};
414
414
  const fastCarryForward = fastResult.carryForward || {};
415
415
  const headTagSources = [];
416
+ if (route.headMeta)
417
+ headTagSources.push(headMetaToHeadTags(route.headMeta));
416
418
  const slowHeadTags = cached.carryForward.__slowHeadTags;
417
419
  if (slowHeadTags)
418
420
  headTagSources.push(...slowHeadTags);
@@ -420,6 +422,8 @@ async function fetchPageRequest(match, manifest, requestUrl, artifacts, staticBa
420
422
  if (fastHeadTags)
421
423
  headTagSources.push(fastHeadTags);
422
424
  const headTags = headTagSources.length > 0 ? mergeHeadTags(headTagSources) : [];
425
+ const hasCustomTitle = headTags.some((t) => t.tag?.toLowerCase() === "title");
426
+ const titleTag = hasCustomTitle ? "" : " <title>Vite + TS</title>\n";
423
427
  const headTagsHtml = headTags.length > 0 ? serializeHeadTags(headTags) + "\n" : "";
424
428
  const fullViewState = deepMergeViewStates(
425
429
  cached.slowViewState,
@@ -435,11 +439,27 @@ async function fetchPageRequest(match, manifest, requestUrl, artifacts, staticBa
435
439
  if (route.routeHydratePath) {
436
440
  importMap["jay-route-hydrate"] = `${staticBaseUrl}${route.routeHydratePath}`;
437
441
  }
438
- const modulePreloads = Object.values(importMap).map((url) => ` <link rel="modulepreload" href="${url}" />`).join("\n");
442
+ const clientBundleUrl = route.routeClientBundlePath ? `${staticBaseUrl}${route.routeClientBundlePath}` : `${staticBaseUrl}${instance.clientBundlePath}`;
443
+ const preloadUrls = [...Object.values(importMap), clientBundleUrl];
444
+ const modulePreloads = preloadUrls.map((url) => ` <link rel="modulepreload" href="${url}" />`).join("\n");
439
445
  const cssUrl = instance.clientCssPath ? `${staticBaseUrl}${instance.clientCssPath}` : "";
440
446
  const cssPreload = cssUrl ? ` <link rel="preload" href="${cssUrl}" as="style" />` : "";
441
447
  const cssLink = cssUrl ? ` <link rel="stylesheet" href="${cssUrl}" />` : "";
442
- const cssImportPreloads = (route.cssImports ?? []).map((url) => ` <link rel="preload" href="${url}" as="style" />`).join("\n");
448
+ const cssImportHints = [];
449
+ for (const url of route.cssImports ?? []) {
450
+ if (url.includes("fonts.googleapis.com")) {
451
+ cssImportHints.push(
452
+ ' <link rel="preconnect" href="https://fonts.googleapis.com" />'
453
+ );
454
+ cssImportHints.push(
455
+ ' <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />'
456
+ );
457
+ cssImportHints.push(` <link rel="stylesheet" href="${url}" />`);
458
+ } else {
459
+ cssImportHints.push(` <link rel="preload" href="${url}" as="style" />`);
460
+ }
461
+ }
462
+ const cssImportPreloads = cssImportHints.join("\n");
443
463
  const encoder = new TextEncoder();
444
464
  const stream = new ReadableStream({
445
465
  async start(controller) {
@@ -450,7 +470,9 @@ async function fetchPageRequest(match, manifest, requestUrl, artifacts, staticBa
450
470
  <head>
451
471
  <meta charset="UTF-8" />
452
472
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
453
- ${[cssPreload, cssImportPreloads].filter(Boolean).map((l) => l + "\n").join("")} <script type="importmap">${JSON.stringify({ imports: importMap })}<\/script>
473
+ ${titleTag}${[cssPreload, cssImportPreloads].filter(Boolean).map((l) => l + "\n").join(
474
+ ""
475
+ )} <script type="importmap">${JSON.stringify({ imports: importMap })}<\/script>
454
476
  ${headParts}
455
477
  </head>
456
478
  <body>
@@ -473,7 +495,6 @@ ${headParts}
473
495
  if (asyncScripts)
474
496
  write(asyncScripts);
475
497
  const clientInitData = getClientInitData();
476
- const clientBundleUrl = route.routeClientBundlePath ? `${staticBaseUrl}${route.routeClientBundlePath}` : `${staticBaseUrl}${instance.clientBundlePath}`;
477
498
  const initArgs = route.routeClientBundlePath ? `${JSON.stringify(cached.slowViewState)}, ${JSON.stringify(fastViewState)}, ${JSON.stringify(fastCarryForward)}, ${JSON.stringify(clientInitData)}` : `${JSON.stringify(fastViewState)}, ${JSON.stringify(fastCarryForward)}, ${JSON.stringify(clientInitData)}`;
478
499
  const tTotal = Date.now() - t0;
479
500
  const tLoadMs = tLoad - tLoadStart;
@@ -1,4 +1,5 @@
1
1
  import * as _jay_framework_ssr_runtime from '@jay-framework/ssr-runtime';
2
+ import { JayHtmlHeadMeta } from '@jay-framework/compiler-shared';
2
3
  import { ActionRegistry } from '@jay-framework/stack-server-runtime';
3
4
 
4
5
  interface RouteManifest {
@@ -32,6 +33,8 @@ interface RouteEntry {
32
33
  routeClientBundlePath?: string;
33
34
  /** External @import URLs extracted from CSS at build time (DL#146). Used for preload hints. */
34
35
  cssImports?: string[];
36
+ /** Head metadata from jay-html <head> (title, meta tags). */
37
+ headMeta?: JayHtmlHeadMeta;
35
38
  instances: InstanceEntry[];
36
39
  isPlugin?: boolean;
37
40
  pluginName?: string;
@@ -1,3 +1,4 @@
1
- export { e as ArtifactStore, C as CacheEntry, F as FilesystemArtifactStore, I as InstanceEntry, M as MatchResult, n as PreImportedPlugin, a as RouteEntry, R as RouteManifest, S as ServerElementModule, g as fetchActionRequest, f as fetchPageRequest, j as fetchStaticFile, k as initializeServices, l as initializeServicesFromModules, i as isActionRequest, m as matchRequest, r as registerActionsFromManifest, h as registerActionsFromModules } from './serve-index-GLq2Yw4z.js';
1
+ export { e as ArtifactStore, C as CacheEntry, F as FilesystemArtifactStore, I as InstanceEntry, M as MatchResult, n as PreImportedPlugin, a as RouteEntry, R as RouteManifest, S as ServerElementModule, g as fetchActionRequest, f as fetchPageRequest, j as fetchStaticFile, k as initializeServices, l as initializeServicesFromModules, i as isActionRequest, m as matchRequest, r as registerActionsFromManifest, h as registerActionsFromModules } from './serve-index-HC05uvRi.js';
2
2
  import '@jay-framework/ssr-runtime';
3
+ import '@jay-framework/compiler-shared';
3
4
  import '@jay-framework/stack-server-runtime';
@@ -1,4 +1,4 @@
1
- import { F, a, f, c, d, e, i, m, r, b } from "./init-services-F6Svgfm9.js";
1
+ import { F, a, f, c, d, e, i, m, r, b } from "./init-services-z79V7RtD.js";
2
2
  import "node:fs/promises";
3
3
  import "node:path";
4
4
  import "@jay-framework/stack-server-runtime";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jay-framework/production-server",
3
- "version": "0.19.3",
3
+ "version": "0.19.5",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -30,20 +30,20 @@
30
30
  "test:watch": "vitest"
31
31
  },
32
32
  "dependencies": {
33
- "@jay-framework/compiler-jay-html": "^0.19.3",
34
- "@jay-framework/compiler-jay-stack": "^0.19.3",
35
- "@jay-framework/compiler-shared": "^0.19.3",
36
- "@jay-framework/fullstack-component": "^0.19.3",
37
- "@jay-framework/logger": "^0.19.3",
38
- "@jay-framework/ssr-runtime": "^0.19.3",
39
- "@jay-framework/stack-route-scanner": "^0.19.3",
40
- "@jay-framework/stack-server-runtime": "^0.19.3",
41
- "@jay-framework/view-state-merge": "^0.19.3",
42
- "@jay-framework/vite-plugin": "^0.19.3",
33
+ "@jay-framework/compiler-jay-html": "^0.19.5",
34
+ "@jay-framework/compiler-jay-stack": "^0.19.5",
35
+ "@jay-framework/compiler-shared": "^0.19.5",
36
+ "@jay-framework/fullstack-component": "^0.19.5",
37
+ "@jay-framework/logger": "^0.19.5",
38
+ "@jay-framework/ssr-runtime": "^0.19.5",
39
+ "@jay-framework/stack-route-scanner": "^0.19.5",
40
+ "@jay-framework/stack-server-runtime": "^0.19.5",
41
+ "@jay-framework/view-state-merge": "^0.19.5",
42
+ "@jay-framework/vite-plugin": "^0.19.5",
43
43
  "vite": "^5.0.11"
44
44
  },
45
45
  "devDependencies": {
46
- "@jay-framework/dev-environment": "^0.19.3",
46
+ "@jay-framework/dev-environment": "^0.19.5",
47
47
  "@types/node": "^22.15.21",
48
48
  "rimraf": "^5.0.5",
49
49
  "tsup": "^8.0.1",