@jay-framework/dev-server 0.19.6 → 0.19.7

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.
Files changed (2) hide show
  1. package/dist/index.js +28 -12
  2. package/package.json +14 -14
package/dist/index.js CHANGED
@@ -1481,7 +1481,17 @@ async function createViteServer(options) {
1481
1481
  watch: { ignored: ["**/build/**"] }
1482
1482
  },
1483
1483
  // Use Jay Stack compiler for .jay-html and other custom transforms
1484
- plugins: [...jayStackCompiler(jayRollupConfig)],
1484
+ plugins: [
1485
+ ...jayStackCompiler(jayRollupConfig),
1486
+ {
1487
+ name: "jay-stack-hmr",
1488
+ handleHotUpdate({ file }) {
1489
+ if (file.endsWith(".jay-html") || file.endsWith(".jay-contract") || file.endsWith("page.ts")) {
1490
+ return [];
1491
+ }
1492
+ }
1493
+ }
1494
+ ],
1485
1495
  // Custom app type (no default middleware)
1486
1496
  appType: "custom",
1487
1497
  // Base URL path
@@ -2550,7 +2560,8 @@ async function handleCachedRequest(vite, route, options, cachedEntry, pageParams
2550
2560
  clientTrackByMap,
2551
2561
  usedPackages,
2552
2562
  linkedCssFiles,
2553
- linkedComponentFiles
2563
+ linkedComponentFiles,
2564
+ scripts: pageScripts
2554
2565
  } = pagePartsResult.val;
2555
2566
  _watchLinkedFiles([...linkedCssFiles || [], ...linkedComponentFiles || []], route);
2556
2567
  const pluginsForPage = filterPluginsForPage(
@@ -2588,8 +2599,10 @@ async function handleCachedRequest(vite, route, options, cachedEntry, pageParams
2588
2599
  const fastViewState = renderedFast.rendered;
2589
2600
  const fastCarryForward = renderedFast.carryForward;
2590
2601
  const headTags = renderedFast.headTags ?? mergeHeadTags(cachedEntry.carryForward?.__slowHeadTags ?? []);
2602
+ const instanceSlowViewStates = instancePhaseData?.slowViewStates;
2603
+ const fullSlowViewState = instanceSlowViewStates && Object.keys(instanceSlowViewStates).length > 0 ? { ...cachedEntry.slowViewState, __headlessInstances: instanceSlowViewStates } : cachedEntry.slowViewState;
2591
2604
  const fullViewState = deepMergeViewStates(
2592
- cachedEntry.slowViewState,
2605
+ fullSlowViewState,
2593
2606
  fastViewState,
2594
2607
  clientTrackByMap || {}
2595
2608
  );
@@ -2611,7 +2624,8 @@ async function handleCachedRequest(vite, route, options, cachedEntry, pageParams
2611
2624
  cachedEntry.slowViewState,
2612
2625
  timing,
2613
2626
  void 0,
2614
- headTags
2627
+ headTags,
2628
+ pageScripts
2615
2629
  );
2616
2630
  }
2617
2631
  async function handlePreRenderRequest(vite, route, options, slowlyPhase, slowRenderCache, pageParams, pageProps, allPluginClientInits, allPluginsWithInit, projectInit, res, url, timing, query = {}, cookies = {}) {
@@ -2728,7 +2742,8 @@ async function handleClientOnlyRequest(vite, route, options, slowlyPhase, pagePa
2728
2742
  discoveredInstances,
2729
2743
  forEachInstances,
2730
2744
  linkedCssFiles,
2731
- linkedComponentFiles
2745
+ linkedComponentFiles,
2746
+ scripts: initialPageScripts
2732
2747
  } = pagePartsResult.val;
2733
2748
  _watchLinkedFiles([...linkedCssFiles || [], ...linkedComponentFiles || []], route);
2734
2749
  const pluginsForPage = filterPluginsForPage(
@@ -2779,8 +2794,10 @@ async function handleClientOnlyRequest(vite, route, options, slowlyPhase, pagePa
2779
2794
  res.setHeader(key, value);
2780
2795
  }
2781
2796
  }
2797
+ const nonCachedInstanceSlowVS = instancePhaseData?.slowViewStates;
2798
+ const fullSlowVS = nonCachedInstanceSlowVS && Object.keys(nonCachedInstanceSlowVS).length > 0 ? { ...renderedSlowly.rendered, __headlessInstances: nonCachedInstanceSlowVS } : renderedSlowly.rendered;
2782
2799
  const viewState = deepMergeViewStates(
2783
- renderedSlowly.rendered,
2800
+ fullSlowVS,
2784
2801
  renderedFast.rendered,
2785
2802
  serverTrackByMap || {}
2786
2803
  );
@@ -2811,7 +2828,7 @@ async function handleClientOnlyRequest(vite, route, options, slowlyPhase, pagePa
2811
2828
  res.status(200).set({ "Content-Type": "text/html" }).send(compiledPageHtml);
2812
2829
  timing?.end();
2813
2830
  }
2814
- async function sendResponse(vite, res, url, jayHtmlPath, sourceJayHtmlPath, pageParts, viewState, carryForward, clientTrackByMap, projectInit, pluginsForPage, options, routePattern, routeDir, slowViewState, timing, preLoadedContent, headTags) {
2831
+ async function sendResponse(vite, res, url, jayHtmlPath, sourceJayHtmlPath, pageParts, viewState, carryForward, clientTrackByMap, projectInit, pluginsForPage, options, routePattern, routeDir, slowViewState, timing, preLoadedContent, headTags, scripts) {
2815
2832
  let pageHtml;
2816
2833
  try {
2817
2834
  const jayHtmlDir = path__default.dirname(jayHtmlPath);
@@ -2840,7 +2857,8 @@ async function sendResponse(vite, res, url, jayHtmlPath, sourceJayHtmlPath, page
2840
2857
  routePattern
2841
2858
  },
2842
2859
  void 0,
2843
- headTags
2860
+ headTags,
2861
+ scripts
2844
2862
  );
2845
2863
  } catch (err) {
2846
2864
  getLogger().warn(`[SSR] Failed, falling back to client rendering: ${err.message}`);
@@ -2890,12 +2908,10 @@ async function handleFrozenRequest(vite, route, options, freezeStore, slowRender
2890
2908
  const jayHtmlFilename = path__default.basename(jayHtmlPath);
2891
2909
  const jayHtmlDir = path__default.dirname(jayHtmlPath);
2892
2910
  const sourceDir = path__default.dirname(route.jayHtmlPath);
2893
- const { injectHeadfullFSTemplates: injectHeadfullFSTemplates2 } = await import("@jay-framework/compiler-jay-html");
2894
- const { JAY_IMPORT_RESOLVER: JAY_IMPORT_RESOLVER2 } = await import("@jay-framework/compiler-jay-html");
2895
- const fullJayHtml = injectHeadfullFSTemplates2(
2911
+ const fullJayHtml = injectHeadfullFSTemplates(
2896
2912
  jayHtmlContent,
2897
2913
  sourceDir,
2898
- JAY_IMPORT_RESOLVER2
2914
+ JAY_IMPORT_RESOLVER
2899
2915
  );
2900
2916
  const html = await generateFrozenPageHtml(
2901
2917
  vite,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jay-framework/dev-server",
3
- "version": "0.19.6",
3
+ "version": "0.19.7",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/index.js",
@@ -23,23 +23,23 @@
23
23
  "test:watch": "vitest"
24
24
  },
25
25
  "dependencies": {
26
- "@jay-framework/compiler-jay-stack": "^0.19.6",
27
- "@jay-framework/compiler-shared": "^0.19.6",
28
- "@jay-framework/component": "^0.19.6",
29
- "@jay-framework/fullstack-component": "^0.19.6",
30
- "@jay-framework/logger": "^0.19.6",
31
- "@jay-framework/runtime": "^0.19.6",
32
- "@jay-framework/stack-client-runtime": "^0.19.6",
33
- "@jay-framework/stack-route-scanner": "^0.19.6",
34
- "@jay-framework/stack-server-runtime": "^0.19.6",
35
- "@jay-framework/view-state-merge": "^0.19.6",
26
+ "@jay-framework/compiler-jay-stack": "^0.19.7",
27
+ "@jay-framework/compiler-shared": "^0.19.7",
28
+ "@jay-framework/component": "^0.19.7",
29
+ "@jay-framework/fullstack-component": "^0.19.7",
30
+ "@jay-framework/logger": "^0.19.7",
31
+ "@jay-framework/runtime": "^0.19.7",
32
+ "@jay-framework/stack-client-runtime": "^0.19.7",
33
+ "@jay-framework/stack-route-scanner": "^0.19.7",
34
+ "@jay-framework/stack-server-runtime": "^0.19.7",
35
+ "@jay-framework/view-state-merge": "^0.19.7",
36
36
  "busboy": "^1.6.0",
37
37
  "vite": "^5.0.11"
38
38
  },
39
39
  "devDependencies": {
40
- "@jay-framework/dev-environment": "^0.19.6",
41
- "@jay-framework/jay-cli": "^0.19.6",
42
- "@jay-framework/stack-client-runtime": "^0.19.6",
40
+ "@jay-framework/dev-environment": "^0.19.7",
41
+ "@jay-framework/jay-cli": "^0.19.7",
42
+ "@jay-framework/stack-client-runtime": "^0.19.7",
43
43
  "@playwright/test": "^1.58.2",
44
44
  "@types/busboy": "^1.5.4",
45
45
  "@types/express": "^5.0.2",