@jay-framework/dev-server 0.20.0 → 0.21.0
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.js +14 -12
- package/package.json +14 -14
package/dist/index.js
CHANGED
|
@@ -16,7 +16,7 @@ import { createRequire as createRequire$1 } from "node:module";
|
|
|
16
16
|
import * as fsSync from "node:fs";
|
|
17
17
|
import fsSync__default from "node:fs";
|
|
18
18
|
import { scanRoutes, createRoute, routeToExpressRoute } from "@jay-framework/stack-route-scanner";
|
|
19
|
-
import { discoverPluginsWithInit, sortPluginsByDependencies, executePluginServerInits, runInitCallbacks, actionRegistry, discoverAndRegisterActions, discoverAllPluginActions, runShutdownCallbacks, clearLifecycleCallbacks, clearServiceRegistry, clearClientInitData, loadPageParts, runLoadParams, DevSlowlyChangingPhase, SlowRenderCache, preparePluginClientInits, registerService, clearServerElementCache, scanPlugins, getServiceRegistry, materializeContracts, parseCookies, renderFastChangingData, mergeHeadTags, generateClientScript, getClientInitData, generateSSRPageHtml, generateFrozenPageHtml, slowRenderInstances } from "@jay-framework/stack-server-runtime";
|
|
19
|
+
import { discoverPluginsWithInit, sortPluginsByDependencies, executePluginServerInits, runInitCallbacks, actionRegistry, discoverAndRegisterActions, discoverAllPluginActions, runShutdownCallbacks, clearLifecycleCallbacks, clearServiceRegistry, clearClientInitData, loadPageParts, runLoadParams, DevSlowlyChangingPhase, SlowRenderCache, preparePluginClientInits, registerService, clearServerElementCache, scanPlugins, getServiceRegistry, materializeContracts, parseCookies, renderFastChangingData, mergeHeadTags, generateClientScript, getClientInitData, generateSSRPageHtml, generateFrozenPageHtml, slowRenderInstances, normalizeAndResolveInstanceProps } from "@jay-framework/stack-server-runtime";
|
|
20
20
|
import * as fs from "node:fs/promises";
|
|
21
21
|
import fs__default from "node:fs/promises";
|
|
22
22
|
import { pathToFileURL } from "node:url";
|
|
@@ -2669,7 +2669,9 @@ async function handlePreRenderRequest(vite, route, options, slowlyPhase, slowRen
|
|
|
2669
2669
|
renderedSlowly.rendered,
|
|
2670
2670
|
initialPartsResult.val.headlessContracts,
|
|
2671
2671
|
initialPartsResult.val.headlessInstanceComponents,
|
|
2672
|
-
partKeys
|
|
2672
|
+
partKeys,
|
|
2673
|
+
pageParams,
|
|
2674
|
+
pageProps
|
|
2673
2675
|
);
|
|
2674
2676
|
timing?.recordSlowRender(Date.now() - slowStart);
|
|
2675
2677
|
if (!preRenderResult) {
|
|
@@ -2938,7 +2940,7 @@ async function handleFrozenRequest(vite, route, options, freezeStore, slowRender
|
|
|
2938
2940
|
}
|
|
2939
2941
|
timing?.end();
|
|
2940
2942
|
}
|
|
2941
|
-
async function preRenderJayHtml(route, slowViewState, headlessContracts, headlessInstanceComponents, partKeys = []) {
|
|
2943
|
+
async function preRenderJayHtml(route, slowViewState, headlessContracts, headlessInstanceComponents, partKeys = [], pageParams = {}, pageProps = { language: "en", url: "" }) {
|
|
2942
2944
|
const jayHtmlContent = await fs__default.readFile(route.jayHtmlPath, "utf-8");
|
|
2943
2945
|
const sourceDir = path__default.dirname(route.jayHtmlPath);
|
|
2944
2946
|
const jayHtmlWithTemplates = injectHeadfullFSTemplates(
|
|
@@ -2989,7 +2991,8 @@ async function preRenderJayHtml(route, slowViewState, headlessContracts, headles
|
|
|
2989
2991
|
if (finalDiscovery.instances.length > 0) {
|
|
2990
2992
|
const slowResult = await slowRenderInstances(
|
|
2991
2993
|
finalDiscovery.instances,
|
|
2992
|
-
headlessInstanceComponents
|
|
2994
|
+
headlessInstanceComponents,
|
|
2995
|
+
{ pageViewState: slowViewState, pageParams, pageProps }
|
|
2993
2996
|
);
|
|
2994
2997
|
if (slowResult) {
|
|
2995
2998
|
instancePhaseData = slowResult.instancePhaseData;
|
|
@@ -3002,14 +3005,13 @@ async function preRenderJayHtml(route, slowViewState, headlessContracts, headles
|
|
|
3002
3005
|
instancePhaseData = {
|
|
3003
3006
|
discovered: finalDiscovery.instances.filter((i) => componentByContractName.has(i.contractName)).map((i) => {
|
|
3004
3007
|
const comp = componentByContractName.get(i.contractName);
|
|
3005
|
-
const
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
}
|
|
3008
|
+
const normalizedProps = normalizeAndResolveInstanceProps(
|
|
3009
|
+
Object.fromEntries(
|
|
3010
|
+
Object.entries(i.props).map(([k, v]) => [k, String(v)])
|
|
3011
|
+
),
|
|
3012
|
+
comp.contract?.props,
|
|
3013
|
+
{ pageViewState: slowViewState, pageParams, pageProps }
|
|
3014
|
+
);
|
|
3013
3015
|
return {
|
|
3014
3016
|
contractName: i.contractName,
|
|
3015
3017
|
props: normalizedProps,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jay-framework/dev-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
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.
|
|
27
|
-
"@jay-framework/compiler-shared": "^0.
|
|
28
|
-
"@jay-framework/component": "^0.
|
|
29
|
-
"@jay-framework/fullstack-component": "^0.
|
|
30
|
-
"@jay-framework/logger": "^0.
|
|
31
|
-
"@jay-framework/runtime": "^0.
|
|
32
|
-
"@jay-framework/stack-client-runtime": "^0.
|
|
33
|
-
"@jay-framework/stack-route-scanner": "^0.
|
|
34
|
-
"@jay-framework/stack-server-runtime": "^0.
|
|
35
|
-
"@jay-framework/view-state-merge": "^0.
|
|
26
|
+
"@jay-framework/compiler-jay-stack": "^0.21.0",
|
|
27
|
+
"@jay-framework/compiler-shared": "^0.21.0",
|
|
28
|
+
"@jay-framework/component": "^0.21.0",
|
|
29
|
+
"@jay-framework/fullstack-component": "^0.21.0",
|
|
30
|
+
"@jay-framework/logger": "^0.21.0",
|
|
31
|
+
"@jay-framework/runtime": "^0.21.0",
|
|
32
|
+
"@jay-framework/stack-client-runtime": "^0.21.0",
|
|
33
|
+
"@jay-framework/stack-route-scanner": "^0.21.0",
|
|
34
|
+
"@jay-framework/stack-server-runtime": "^0.21.0",
|
|
35
|
+
"@jay-framework/view-state-merge": "^0.21.0",
|
|
36
36
|
"busboy": "^1.6.0",
|
|
37
37
|
"vite": "^5.0.11"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@jay-framework/dev-environment": "^0.
|
|
41
|
-
"@jay-framework/jay-cli": "^0.
|
|
42
|
-
"@jay-framework/stack-client-runtime": "^0.
|
|
40
|
+
"@jay-framework/dev-environment": "^0.21.0",
|
|
41
|
+
"@jay-framework/jay-cli": "^0.21.0",
|
|
42
|
+
"@jay-framework/stack-client-runtime": "^0.21.0",
|
|
43
43
|
"@playwright/test": "^1.58.2",
|
|
44
44
|
"@types/busboy": "^1.5.4",
|
|
45
45
|
"@types/express": "^5.0.2",
|