@jay-framework/dev-server 0.16.4 → 0.16.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.
Files changed (2) hide show
  1. package/dist/index.js +28 -10
  2. package/package.json +14 -14
package/dist/index.js CHANGED
@@ -2474,7 +2474,7 @@ async function handleCachedRequest(vite, route, options, cachedEntry, pageParams
2474
2474
  linkedCssFiles,
2475
2475
  linkedComponentFiles
2476
2476
  } = pagePartsResult.val;
2477
- _watchLinkedFiles([...linkedCssFiles || [], ...linkedComponentFiles || []]);
2477
+ _watchLinkedFiles([...linkedCssFiles || [], ...linkedComponentFiles || []], route);
2478
2478
  const pluginsForPage = filterPluginsForPage(
2479
2479
  allPluginClientInits,
2480
2480
  allPluginsWithInit,
@@ -2542,7 +2542,7 @@ async function handlePreRenderRequest(vite, route, options, slowlyPhase, slowRen
2542
2542
  return;
2543
2543
  }
2544
2544
  const { linkedCssFiles: initCss, linkedComponentFiles: initComps } = initialPartsResult.val;
2545
- _watchLinkedFiles([...initCss || [], ...initComps || []]);
2545
+ _watchLinkedFiles([...initCss || [], ...initComps || []], route);
2546
2546
  const slowStart = Date.now();
2547
2547
  const renderedSlowly = await slowlyPhase.runSlowlyForPage(
2548
2548
  pageParams,
@@ -2640,7 +2640,7 @@ async function handleClientOnlyRequest(vite, route, options, slowlyPhase, pagePa
2640
2640
  linkedCssFiles,
2641
2641
  linkedComponentFiles
2642
2642
  } = pagePartsResult.val;
2643
- _watchLinkedFiles([...linkedCssFiles || [], ...linkedComponentFiles || []]);
2643
+ _watchLinkedFiles([...linkedCssFiles || [], ...linkedComponentFiles || []], route);
2644
2644
  const pluginsForPage = filterPluginsForPage(
2645
2645
  allPluginClientInits,
2646
2646
  allPluginsWithInit,
@@ -3141,13 +3141,20 @@ function sendPageReload(vite, jayHtmlPath, pagesRootFolder) {
3141
3141
  }
3142
3142
  function setupSlowRenderCacheInvalidation(vite, cache, pagesRootFolder, projectRootFolder) {
3143
3143
  const watchedFiles = /* @__PURE__ */ new Set();
3144
- const watchLinkedFiles = (files) => {
3144
+ const fileToRoutes = /* @__PURE__ */ new Map();
3145
+ const watchLinkedFiles = (files, route) => {
3146
+ const routePrefix = route ? getRoutePrefix(route.jayHtmlPath, pagesRootFolder) : void 0;
3145
3147
  for (const file of files) {
3146
- if (watchedFiles.has(file))
3147
- continue;
3148
- watchedFiles.add(file);
3149
- vite.watcher.add(file);
3150
- getLogger().info(`[SlowRender] Watching: ${file}`);
3148
+ if (!watchedFiles.has(file)) {
3149
+ watchedFiles.add(file);
3150
+ vite.watcher.add(file);
3151
+ getLogger().info(`[SlowRender] Watching: ${file}`);
3152
+ }
3153
+ if (routePrefix) {
3154
+ if (!fileToRoutes.has(file))
3155
+ fileToRoutes.set(file, /* @__PURE__ */ new Set());
3156
+ fileToRoutes.get(file).add(routePrefix);
3157
+ }
3151
3158
  }
3152
3159
  };
3153
3160
  vite.watcher.on("change", (changedPath) => {
@@ -3157,7 +3164,18 @@ function setupSlowRenderCacheInvalidation(vite, cache, pagesRootFolder, projectR
3157
3164
  getLogger().info(
3158
3165
  `[SlowRender] Cache cleared (linked file changed: ${changedPath})`
3159
3166
  );
3160
- vite.ws.send({ type: "full-reload" });
3167
+ const routes = fileToRoutes.get(changedPath);
3168
+ if (routes && routes.size > 0) {
3169
+ for (const routePrefix of routes) {
3170
+ vite.ws.send({
3171
+ type: "custom",
3172
+ event: "jay:page-reload",
3173
+ data: { routePrefix }
3174
+ });
3175
+ }
3176
+ } else {
3177
+ vite.ws.send({ type: "full-reload" });
3178
+ }
3161
3179
  });
3162
3180
  return;
3163
3181
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jay-framework/dev-server",
3
- "version": "0.16.4",
3
+ "version": "0.16.5",
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.16.4",
27
- "@jay-framework/compiler-shared": "^0.16.4",
28
- "@jay-framework/component": "^0.16.4",
29
- "@jay-framework/fullstack-component": "^0.16.4",
30
- "@jay-framework/logger": "^0.16.4",
31
- "@jay-framework/runtime": "^0.16.4",
32
- "@jay-framework/stack-client-runtime": "^0.16.4",
33
- "@jay-framework/stack-route-scanner": "^0.16.4",
34
- "@jay-framework/stack-server-runtime": "^0.16.4",
35
- "@jay-framework/view-state-merge": "^0.16.4",
26
+ "@jay-framework/compiler-jay-stack": "^0.16.5",
27
+ "@jay-framework/compiler-shared": "^0.16.5",
28
+ "@jay-framework/component": "^0.16.5",
29
+ "@jay-framework/fullstack-component": "^0.16.5",
30
+ "@jay-framework/logger": "^0.16.5",
31
+ "@jay-framework/runtime": "^0.16.5",
32
+ "@jay-framework/stack-client-runtime": "^0.16.5",
33
+ "@jay-framework/stack-route-scanner": "^0.16.5",
34
+ "@jay-framework/stack-server-runtime": "^0.16.5",
35
+ "@jay-framework/view-state-merge": "^0.16.5",
36
36
  "busboy": "^1.6.0",
37
37
  "vite": "^5.0.11"
38
38
  },
39
39
  "devDependencies": {
40
- "@jay-framework/dev-environment": "^0.16.4",
41
- "@jay-framework/jay-cli": "^0.16.4",
42
- "@jay-framework/stack-client-runtime": "^0.16.4",
40
+ "@jay-framework/dev-environment": "^0.16.5",
41
+ "@jay-framework/jay-cli": "^0.16.5",
42
+ "@jay-framework/stack-client-runtime": "^0.16.5",
43
43
  "@playwright/test": "^1.58.2",
44
44
  "@types/busboy": "^1.5.4",
45
45
  "@types/express": "^5.0.2",