@jay-framework/production-server 0.19.2 → 0.19.4

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-CbovuXct.js";
10
+ import { e, b } from "./init-services-CbovuXct.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");
@@ -911,11 +911,7 @@ async function discoverPluginClientPackages(projectRoot) {
911
911
  const projectPkg = JSON.parse(
912
912
  await fs.readFile(path.join(projectRoot, "package.json"), "utf-8")
913
913
  );
914
- const allDeps = {
915
- ...projectPkg.dependencies,
916
- ...projectPkg.devDependencies
917
- };
918
- for (const dep of Object.keys(allDeps)) {
914
+ for (const dep of Object.keys(projectPkg.dependencies || {})) {
919
915
  if (dep.startsWith("@jay-framework/")) {
920
916
  await walk(dep);
921
917
  }
@@ -1169,6 +1165,9 @@ async function buildVersion(options) {
1169
1165
  if (seResult.cssImports?.length) {
1170
1166
  entry.cssImports = seResult.cssImports;
1171
1167
  }
1168
+ if (seResult.headMeta) {
1169
+ entry.headMeta = seResult.headMeta;
1170
+ }
1172
1171
  logger.important(`[Build] Route server element: ${routeDir}`);
1173
1172
  } catch (err) {
1174
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,25 @@ 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(' <link rel="preconnect" href="https://fonts.googleapis.com" />');
452
+ cssImportHints.push(
453
+ ' <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />'
454
+ );
455
+ cssImportHints.push(` <link rel="stylesheet" href="${url}" />`);
456
+ } else {
457
+ cssImportHints.push(` <link rel="preload" href="${url}" as="style" />`);
458
+ }
459
+ }
460
+ const cssImportPreloads = cssImportHints.join("\n");
443
461
  const encoder = new TextEncoder();
444
462
  const stream = new ReadableStream({
445
463
  async start(controller) {
@@ -450,7 +468,7 @@ async function fetchPageRequest(match, manifest, requestUrl, artifacts, staticBa
450
468
  <head>
451
469
  <meta charset="UTF-8" />
452
470
  <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>
471
+ ${titleTag}${[cssPreload, cssImportPreloads].filter(Boolean).map((l) => l + "\n").join("")} <script type="importmap">${JSON.stringify({ imports: importMap })}<\/script>
454
472
  ${headParts}
455
473
  </head>
456
474
  <body>
@@ -473,7 +491,6 @@ ${headParts}
473
491
  if (asyncScripts)
474
492
  write(asyncScripts);
475
493
  const clientInitData = getClientInitData();
476
- const clientBundleUrl = route.routeClientBundlePath ? `${staticBaseUrl}${route.routeClientBundlePath}` : `${staticBaseUrl}${instance.clientBundlePath}`;
477
494
  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
495
  const tTotal = Date.now() - t0;
479
496
  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-CbovuXct.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.2",
3
+ "version": "0.19.4",
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.2",
34
- "@jay-framework/compiler-jay-stack": "^0.19.2",
35
- "@jay-framework/compiler-shared": "^0.19.2",
36
- "@jay-framework/fullstack-component": "^0.19.2",
37
- "@jay-framework/logger": "^0.19.2",
38
- "@jay-framework/ssr-runtime": "^0.19.2",
39
- "@jay-framework/stack-route-scanner": "^0.19.2",
40
- "@jay-framework/stack-server-runtime": "^0.19.2",
41
- "@jay-framework/view-state-merge": "^0.19.2",
42
- "@jay-framework/vite-plugin": "^0.19.2",
33
+ "@jay-framework/compiler-jay-html": "^0.19.4",
34
+ "@jay-framework/compiler-jay-stack": "^0.19.4",
35
+ "@jay-framework/compiler-shared": "^0.19.4",
36
+ "@jay-framework/fullstack-component": "^0.19.4",
37
+ "@jay-framework/logger": "^0.19.4",
38
+ "@jay-framework/ssr-runtime": "^0.19.4",
39
+ "@jay-framework/stack-route-scanner": "^0.19.4",
40
+ "@jay-framework/stack-server-runtime": "^0.19.4",
41
+ "@jay-framework/view-state-merge": "^0.19.4",
42
+ "@jay-framework/vite-plugin": "^0.19.4",
43
43
  "vite": "^5.0.11"
44
44
  },
45
45
  "devDependencies": {
46
- "@jay-framework/dev-environment": "^0.19.2",
46
+ "@jay-framework/dev-environment": "^0.19.4",
47
47
  "@types/node": "^22.15.21",
48
48
  "rimraf": "^5.0.5",
49
49
  "tsup": "^8.0.1",