@jay-framework/stack-server-build 0.24.3 → 0.24.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
@@ -58,6 +58,17 @@ interface LoadedPageParts {
58
58
  /** Script tags with jay-script="allow" to include in SSR output */
59
59
  scripts?: JayHtmlScript[];
60
60
  }
61
+ /**
62
+ * Resolve the browser hydration import path for a route (DL#182).
63
+ *
64
+ * SSR loads `route.compPath` (which is `./tools` for devOnly plugin routes, `.` otherwise); the
65
+ * browser must never load those server bundles. Prefer the explicit `clientCompPath` resolved from
66
+ * the plugin's `./client` export. Fall back to the legacy `index.js`→`index.client.js` rewrite only
67
+ * for NPM plugin routes (`componentExport` set) that carry no `clientCompPath` — note this rewrite
68
+ * silently no-ops for a devOnly `compPath` ending in `tools.js`, which is the bug DL#182 fixes.
69
+ * Local (project) components hydrate directly from `compPath`.
70
+ */
71
+ declare function resolveClientImportPath(route: JayRoute): string;
61
72
  interface LoadPagePartsOptions {
62
73
  /**
63
74
  * Path to pre-rendered jay-html file to use instead of the original.
@@ -669,4 +680,4 @@ declare class SlowRenderCache {
669
680
  private scanAndDeleteCacheFiles;
670
681
  }
671
682
 
672
- export { type ActionDiscoveryOptions, type ActionDiscoveryResult, type ActionIndexEntry, type ActionMetadata, type ActionSchema, type CommandFlag, type CommandIndexEntry, type CommandMetadata, type ContextIndexEntry, type DevServerPagePart, type DiscoveredCommand, type GenerateClientScriptOptions, type HeadlessInstanceComponent, type LoadPagePartsOptions, type LoadedPageParts, type MaterializeContractsOptions, type MaterializeResult, type PluginActionDiscoveryOptions, type PluginContractEntry, type PluginWithAgentKit, type PluginWithSetup, type PluginsIndex, type PluginsIndexEntry, type ProjectClientInitInfo, type RouteIndexEntry, type ScriptFragments, type ServiceIndexEntry, SetupNeedsAnswerError, SlowRenderCache, type SlowRenderCacheEntry, type ViteSSRLoader, buildAutomationWrap, buildPageReloadHmrScript, buildScriptFragments, clearServerElementCache, commandSchemaToFlags, discoverAllPluginActions, discoverAndRegisterActions, discoverPluginActions, discoverPluginCommands, discoverPluginsWithAgentKit, discoverPluginsWithSetup, executePluginAgentKit, executePluginCommand, executePluginSetup, generateClientScript, generateFrozenPageHtml, generatePromiseReconstruction, generateSSRPageHtml, headMetaToHeadTags, invalidateServerElementCache, listContracts, loadActionMetadata, loadPageParts, materializeContracts, parseActionMetadata, parseInputFromFlags, resolveActionMetadataPath, resolveViewStatePromises };
683
+ export { type ActionDiscoveryOptions, type ActionDiscoveryResult, type ActionIndexEntry, type ActionMetadata, type ActionSchema, type CommandFlag, type CommandIndexEntry, type CommandMetadata, type ContextIndexEntry, type DevServerPagePart, type DiscoveredCommand, type GenerateClientScriptOptions, type HeadlessInstanceComponent, type LoadPagePartsOptions, type LoadedPageParts, type MaterializeContractsOptions, type MaterializeResult, type PluginActionDiscoveryOptions, type PluginContractEntry, type PluginWithAgentKit, type PluginWithSetup, type PluginsIndex, type PluginsIndexEntry, type ProjectClientInitInfo, type RouteIndexEntry, type ScriptFragments, type ServiceIndexEntry, SetupNeedsAnswerError, SlowRenderCache, type SlowRenderCacheEntry, type ViteSSRLoader, buildAutomationWrap, buildPageReloadHmrScript, buildScriptFragments, clearServerElementCache, commandSchemaToFlags, discoverAllPluginActions, discoverAndRegisterActions, discoverPluginActions, discoverPluginCommands, discoverPluginsWithAgentKit, discoverPluginsWithSetup, executePluginAgentKit, executePluginCommand, executePluginSetup, generateClientScript, generateFrozenPageHtml, generatePromiseReconstruction, generateSSRPageHtml, headMetaToHeadTags, invalidateServerElementCache, listContracts, loadActionMetadata, loadPageParts, materializeContracts, parseActionMetadata, parseInputFromFlags, resolveActionMetadataPath, resolveClientImportPath, resolveViewStatePromises };
package/dist/index.js CHANGED
@@ -18,6 +18,11 @@ import * as fs from "node:fs";
18
18
  import { createRequire as createRequire$1 } from "node:module";
19
19
  import { isJayAction, isJayStreamAction, isJayCliCommand } from "@jay-framework/fullstack-component";
20
20
  const require$3 = createRequire(import.meta.url);
21
+ function resolveClientImportPath(route) {
22
+ if (route.clientCompPath) return route.clientCompPath;
23
+ if (route.componentExport) return route.compPath.replace(/index\.js$/, "index.client.js");
24
+ return route.compPath;
25
+ }
21
26
  async function loadPageParts(vite, route, pagesBase, projectBase, jayRollupConfig, options) {
22
27
  const exists = await fs$1.access(route.compPath, fs$1.constants.F_OK).then(() => true).catch(() => false);
23
28
  const parts = [];
@@ -30,7 +35,7 @@ async function loadPageParts(vite, route, pagesBase, projectBase, jayRollupConfi
30
35
  `${route.compPath} does not export "${exportName}". The file exists but the expected export is missing — remove the file or add the export.`
31
36
  );
32
37
  } else {
33
- const clientImportPath = route.componentExport ? route.compPath.replace(/index\.js$/, "index.client.js") : route.compPath;
38
+ const clientImportPath = resolveClientImportPath(route);
34
39
  parts.push({
35
40
  compDefinition: pageComponent,
36
41
  clientImport: `import {${exportName}} from '${clientImportPath}'`,
@@ -2329,5 +2334,6 @@ export {
2329
2334
  parseActionMetadata,
2330
2335
  parseInputFromFlags,
2331
2336
  resolveActionMetadataPath,
2337
+ resolveClientImportPath,
2332
2338
  resolveViewStatePromises
2333
2339
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jay-framework/stack-server-build",
3
- "version": "0.24.3",
3
+ "version": "0.24.4",
4
4
  "license": "Apache-2.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.mts",
@@ -24,21 +24,21 @@
24
24
  "test:watch": "vitest"
25
25
  },
26
26
  "dependencies": {
27
- "@jay-framework/compiler-jay-html": "^0.24.3",
28
- "@jay-framework/compiler-shared": "^0.24.3",
29
- "@jay-framework/component": "^0.24.3",
30
- "@jay-framework/fullstack-component": "^0.24.3",
31
- "@jay-framework/logger": "^0.24.3",
32
- "@jay-framework/runtime": "^0.24.3",
33
- "@jay-framework/ssr-runtime": "^0.24.3",
34
- "@jay-framework/stack-route-scanner": "^0.24.3",
35
- "@jay-framework/stack-server-runtime": "^0.24.3",
36
- "@jay-framework/view-state-merge": "^0.24.3",
27
+ "@jay-framework/compiler-jay-html": "^0.24.4",
28
+ "@jay-framework/compiler-shared": "^0.24.4",
29
+ "@jay-framework/component": "^0.24.4",
30
+ "@jay-framework/fullstack-component": "^0.24.4",
31
+ "@jay-framework/logger": "^0.24.4",
32
+ "@jay-framework/runtime": "^0.24.4",
33
+ "@jay-framework/ssr-runtime": "^0.24.4",
34
+ "@jay-framework/stack-route-scanner": "^0.24.4",
35
+ "@jay-framework/stack-server-runtime": "^0.24.4",
36
+ "@jay-framework/view-state-merge": "^0.24.4",
37
37
  "yaml": "^2.3.4"
38
38
  },
39
39
  "devDependencies": {
40
- "@jay-framework/dev-environment": "^0.24.3",
41
- "@jay-framework/rollup-plugin": "^0.24.3",
40
+ "@jay-framework/dev-environment": "^0.24.4",
41
+ "@jay-framework/rollup-plugin": "^0.24.4",
42
42
  "@types/node": "^22.15.21",
43
43
  "rimraf": "^5.0.5",
44
44
  "tsup": "^8.0.1",