@jay-framework/production-server 0.24.7 → 0.25.1

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,5 +1,5 @@
1
- import { R as RouteManifest, a as RouteEntry } from './serve-index-C2Tfaz1E.js';
2
- export { A as ActionEntry, b as ArtifactStore, B as BuildMetadata, c as BuildOptions, C as CacheEntry, F as FilesystemArtifactStore, I as InstanceEntry, M as MatchResult, P as PageModule, d as PluginEntry, e as PreImportedPlugin, f as RouteSegment, S as ServerElementModule, g as fetchActionRequest, h as fetchPageRequest, i as fetchStaticFile, j as initializeServices, k as initializeServicesFromModules, l as isActionRequest, m as loadPagePartsFromConfig, n as matchRequest, r as registerActionsFromManifest, o as registerActionsFromModules } from './serve-index-C2Tfaz1E.js';
1
+ import { R as RouteManifest, a as RouteEntry } from './serve-index-CUXzYZBC.js';
2
+ export { A as ActionEntry, b as ArtifactStore, B as BuildMetadata, c as BuildOptions, C as CacheEntry, F as FilesystemArtifactStore, I as InstanceEntry, M as MatchResult, P as PageModule, d as PluginEntry, e as PreImportedPlugin, f as RouteSegment, S as ServerElementModule, g as fetchActionRequest, h as fetchPageRequest, i as fetchStaticFile, j as initializeServices, k as initializeServicesFromModules, l as isActionRequest, m as loadPagePartsFromConfig, n as matchRequest, r as registerActionsFromManifest, o as registerActionsFromModules } from './serve-index-CUXzYZBC.js';
3
3
  import '@jay-framework/ssr-runtime';
4
4
  import '@jay-framework/stack-server-runtime';
5
5
 
package/dist/index.js CHANGED
@@ -3,8 +3,8 @@ import http from "node:http";
3
3
  import { Readable } from "node:stream";
4
4
  import path from "node:path";
5
5
  import { getLogger } from "@jay-framework/logger";
6
- import { F as FilesystemArtifactStore, i as initializeServices, r as registerActionsFromManifest, d as isActionRequest, f as fetchActionRequest, b as fetchStaticFile, m as matchRequest, a as fetchPageRequest, l as loadPagePartsFromConfig } from "./init-services-CVQ-U9iX.js";
7
- import { c, e } from "./init-services-CVQ-U9iX.js";
6
+ import { F as FilesystemArtifactStore, i as initializeServices, r as registerActionsFromManifest, d as isActionRequest, f as fetchActionRequest, b as fetchStaticFile, m as matchRequest, a as fetchPageRequest, l as loadPagePartsFromConfig } from "./init-services-XQt5vxN_.js";
7
+ import { c, e } from "./init-services-XQt5vxN_.js";
8
8
  import { parseCookies, scanPlugins, DevSlowlyChangingPhase, slowRenderInstances } from "@jay-framework/stack-server-runtime";
9
9
  import { isJayWebhook } from "@jay-framework/fullstack-component";
10
10
  import crypto from "node:crypto";
@@ -298,10 +298,11 @@ async function rebuildInstance(route, params, backendDir, rebuildSuffix) {
298
298
  } catch (err) {
299
299
  return { status: "skipped", reason: `Failed to load page-parts.json: ${err.message}` };
300
300
  }
301
+ const pageUrl = buildUrlFromManifest(route.pattern, params);
301
302
  const slowPhase = new DevSlowlyChangingPhase();
302
303
  const slowResult = await slowPhase.runSlowlyForPage(
303
304
  params,
304
- { params },
305
+ { language: "en", url: pageUrl },
305
306
  pageParts.parts,
306
307
  pageParts.discoveredInstances,
307
308
  pageParts.headlessInstanceComponents
@@ -324,7 +325,7 @@ async function rebuildInstance(route, params, backendDir, rebuildSuffix) {
324
325
  {
325
326
  pageViewState: slowViewState,
326
327
  pageParams: params,
327
- pageProps: { language: "en", url: "" }
328
+ pageProps: { language: "en", url: pageUrl }
328
329
  }
329
330
  );
330
331
  if (instanceSlowResult) {
@@ -3,7 +3,7 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
  import fs from "node:fs/promises";
5
5
  import path from "node:path";
6
- import { makePassthroughInstanceComponent, renderFastChangingData, headMetaToHeadTags, mergeHeadTags, serializeHeadTags, getClientInitData, actionRegistry, setClientInitData } from "@jay-framework/stack-server-runtime";
6
+ import { makePassthroughInstanceComponent, renderFastChangingData, headMetaToHeadTags, mergeHeadTags, serializeHeadTags, serializeScripts, getClientInitData, actionRegistry, setClientInitData } from "@jay-framework/stack-server-runtime";
7
7
  import { deepMergeViewStates } from "@jay-framework/view-state-merge";
8
8
  import { asyncSwapScript } from "@jay-framework/ssr-runtime";
9
9
  import { isJayAction, isJayStreamAction } from "@jay-framework/fullstack-component";
@@ -259,8 +259,7 @@ async function fetchPageRequest(match, manifest, requestUrl, artifacts, staticBa
259
259
  if (slowHeadTags) headTagSources.push(...slowHeadTags);
260
260
  if (fastResult.headTags) headTagSources.push(fastResult.headTags);
261
261
  const templateHeadTags = headMetaToHeadTags(route.headMeta, fullViewState);
262
- if (templateHeadTags.length > 0) headTagSources.push(templateHeadTags);
263
- const headTags = headTagSources.length > 0 ? mergeHeadTags(headTagSources) : [];
262
+ const headTags = headTagSources.length > 0 || templateHeadTags.length > 0 ? mergeHeadTags(headTagSources, templateHeadTags) : [];
264
263
  const hasCustomTitle = headTags.some((t) => t.tag?.toLowerCase() === "title");
265
264
  const titleTag = hasCustomTitle ? "" : " <title>Vite + TS</title>\n";
266
265
  const preconnectTags = headTags.filter(
@@ -271,6 +270,8 @@ async function fetchPageRequest(match, manifest, requestUrl, artifacts, staticBa
271
270
  );
272
271
  const preconnectHtml = preconnectTags.length > 0 ? serializeHeadTags(preconnectTags) + "\n" : "";
273
272
  const headTagsHtml = otherHeadTags.length > 0 ? serializeHeadTags(otherHeadTags) + "\n" : "";
273
+ const headScriptsHtml = serializeScripts(route.scripts, "head");
274
+ const bodyScriptsHtml = serializeScripts(route.scripts, "body");
274
275
  const serverElementPath = route.serverElementPath || instance.serverElementPath;
275
276
  const tLoadStart = Date.now();
276
277
  const serverElement = await artifacts.loadServerElement(serverElementPath);
@@ -292,7 +293,7 @@ async function fetchPageRequest(match, manifest, requestUrl, artifacts, staticBa
292
293
  const stream = new ReadableStream({
293
294
  async start(controller) {
294
295
  const write = (s) => controller.enqueue(encoder.encode(s));
295
- const headParts = [headTagsHtml, modulePreloads, cssLink].filter(Boolean).join("\n");
296
+ const headParts = [headTagsHtml, modulePreloads, cssLink, headScriptsHtml].filter(Boolean).join("\n");
296
297
  write(`<!doctype html>
297
298
  <html lang="en">
298
299
  <head>
@@ -340,7 +341,7 @@ ${headParts}
340
341
  const _t=performance.now();
341
342
  await init(${initArgs});
342
343
  console.log('[jay] hydrate: '+(performance.now()-_t).toFixed(1)+'ms');
343
- <\/script>
344
+ <\/script>${bodyScriptsHtml ? "\n " + bodyScriptsHtml : ""}
344
345
  </body>
345
346
  </html>`);
346
347
  controller.close();
@@ -1,5 +1,5 @@
1
1
  import * as _jay_framework_ssr_runtime from '@jay-framework/ssr-runtime';
2
- import { JayHtmlHeadMeta, DevServerPagePart, HeadlessInstanceComponent, ForEachHeadlessInstance, ActionRegistry } from '@jay-framework/stack-server-runtime';
2
+ import { JayHtmlHeadMeta, JayHtmlScript, DevServerPagePart, HeadlessInstanceComponent, ForEachHeadlessInstance, ActionRegistry } from '@jay-framework/stack-server-runtime';
3
3
 
4
4
  interface RouteManifest {
5
5
  version: string;
@@ -32,6 +32,8 @@ interface RouteEntry {
32
32
  cssImports?: string[];
33
33
  /** Head metadata from jay-html <head> (title, meta tags). */
34
34
  headMeta?: JayHtmlHeadMeta;
35
+ /** Passthrough `<script jay-script="allow">` tags from the jay-html template (DL#149 Phase 2). */
36
+ scripts?: JayHtmlScript[];
35
37
  /** True when page has static <meta name="robots" content="noindex"> */
36
38
  noIndex?: boolean;
37
39
  instances: InstanceEntry[];
@@ -1,3 +1,3 @@
1
- export { b as ArtifactStore, C as CacheEntry, F as FilesystemArtifactStore, I as InstanceEntry, M as MatchResult, e as PreImportedPlugin, a as RouteEntry, R as RouteManifest, S as ServerElementModule, g as fetchActionRequest, h as fetchPageRequest, i as fetchStaticFile, j as initializeServices, k as initializeServicesFromModules, l as isActionRequest, n as matchRequest, r as registerActionsFromManifest, o as registerActionsFromModules } from './serve-index-C2Tfaz1E.js';
1
+ export { b as ArtifactStore, C as CacheEntry, F as FilesystemArtifactStore, I as InstanceEntry, M as MatchResult, e as PreImportedPlugin, a as RouteEntry, R as RouteManifest, S as ServerElementModule, g as fetchActionRequest, h as fetchPageRequest, i as fetchStaticFile, j as initializeServices, k as initializeServicesFromModules, l as isActionRequest, n as matchRequest, r as registerActionsFromManifest, o as registerActionsFromModules } from './serve-index-CUXzYZBC.js';
2
2
  import '@jay-framework/ssr-runtime';
3
3
  import '@jay-framework/stack-server-runtime';
@@ -1,4 +1,4 @@
1
- import { F, f, a, b, i, c, d, m, r, e } from "./init-services-CVQ-U9iX.js";
1
+ import { F, f, a, b, i, c, d, m, r, e } from "./init-services-XQt5vxN_.js";
2
2
  export {
3
3
  F as FilesystemArtifactStore,
4
4
  f as fetchActionRequest,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jay-framework/production-server",
3
- "version": "0.24.7",
3
+ "version": "0.25.1",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -30,14 +30,14 @@
30
30
  "test:watch": "vitest"
31
31
  },
32
32
  "dependencies": {
33
- "@jay-framework/fullstack-component": "^0.24.7",
34
- "@jay-framework/logger": "^0.24.7",
35
- "@jay-framework/ssr-runtime": "^0.24.7",
36
- "@jay-framework/stack-server-runtime": "^0.24.7",
37
- "@jay-framework/view-state-merge": "^0.24.7"
33
+ "@jay-framework/fullstack-component": "^0.25.1",
34
+ "@jay-framework/logger": "^0.25.1",
35
+ "@jay-framework/ssr-runtime": "^0.25.1",
36
+ "@jay-framework/stack-server-runtime": "^0.25.1",
37
+ "@jay-framework/view-state-merge": "^0.25.1"
38
38
  },
39
39
  "devDependencies": {
40
- "@jay-framework/dev-environment": "^0.24.7",
40
+ "@jay-framework/dev-environment": "^0.25.1",
41
41
  "@types/node": "^22.15.21",
42
42
  "rimraf": "^5.0.5",
43
43
  "tsup": "^8.0.1",