@jay-framework/stack-server-runtime 0.6.7 → 0.6.8

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 CHANGED
@@ -1,31 +1,8 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (let key of __getOwnPropNames(from))
11
- if (!__hasOwnProp.call(to, key) && key !== except)
12
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- }
14
- return to;
15
- };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- // If the importer is in node compatibility mode or this is not an ESM
18
- // file that has been converted to a CommonJS file using a Babel-
19
- // compatible transform (i.e. "__esModule" has not been set), then set
20
- // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
25
- const fullstackComponent = require("@jay-framework/fullstack-component");
26
- const fs = require("node:fs/promises");
27
- const path = require("node:path");
28
- const compilerJayHtml = require("@jay-framework/compiler-jay-html");
1
+ import { notFound, partialRender } from "@jay-framework/fullstack-component";
2
+ import fs from "node:fs/promises";
3
+ import path from "node:path";
4
+ import { parseJayFile } from "@jay-framework/compiler-jay-html";
5
+ import { createRequire } from "module";
29
6
  function isLeftSideParamsSubsetOfRightSideParams(left, right) {
30
7
  return Object.keys(left).reduce((prev, curr) => prev && left[curr] === right[curr], true);
31
8
  }
@@ -46,7 +23,7 @@ class DevSlowlyChangingPhase {
46
23
  if (compDefinition.loadParams) {
47
24
  const compParams = compDefinition.loadParams([]);
48
25
  if (!await findMatchingParams(pageParams, compParams))
49
- return fullstackComponent.notFound();
26
+ return notFound();
50
27
  }
51
28
  }
52
29
  let slowlyViewState = {};
@@ -70,7 +47,7 @@ class DevSlowlyChangingPhase {
70
47
  return slowlyRenderedPart;
71
48
  }
72
49
  }
73
- return fullstackComponent.partialRender(slowlyViewState, carryForward);
50
+ return partialRender(slowlyViewState, carryForward);
74
51
  }
75
52
  }
76
53
  async function runLoadParams(compDefinition, serverContexts) {
@@ -101,11 +78,11 @@ async function renderFastChangingData(pageParams, pageProps, carryForward, parts
101
78
  return fastRenderedPart;
102
79
  }
103
80
  }
104
- return Promise.resolve(fullstackComponent.partialRender(fastViewState, fastCarryForward));
81
+ return Promise.resolve(partialRender(fastViewState, fastCarryForward));
105
82
  }
106
83
  function generateClientScript(defaultViewState, fastCarryForward, parts, jayHtmlPath) {
107
- const imports = parts.length > 1 ? parts.map((part) => part.clientImport).join("\n") + "\n" : "";
108
- const compositeParts = parts.length > 1 ? `[
84
+ const imports = parts.length > 0 ? parts.map((part) => part.clientImport).join("\n") + "\n" : "";
85
+ const compositeParts = parts.length > 0 ? `[
109
86
  ${parts.map((part) => " " + part.clientPart).join(",\n")}
110
87
  ]` : "[]";
111
88
  return `<!doctype html>
@@ -133,6 +110,7 @@ ${parts.map((part) => " " + part.clientPart).join(",\n")}
133
110
  </body>
134
111
  </html>`;
135
112
  }
113
+ const require2 = createRequire(import.meta.url);
136
114
  async function loadPageParts(vite, route, pagesBase, jayRollupConfig) {
137
115
  const exists = await fs.access(route.compPath, fs.constants.F_OK).then(() => true).catch(() => false);
138
116
  const parts = [];
@@ -148,9 +126,9 @@ async function loadPageParts(vite, route, pagesBase, jayRollupConfig) {
148
126
  const jayHtmlSource = (await fs.readFile(route.jayHtmlPath)).toString();
149
127
  const fileName = path.basename(route.jayHtmlPath);
150
128
  const dirName = path.dirname(route.jayHtmlPath);
151
- const module2 = await import("@jay-framework/compiler-jay-html");
152
- const JAY_IMPORT_RESOLVER = module2.JAY_IMPORT_RESOLVER;
153
- const jayHtmlWithValidations = await compilerJayHtml.parseJayFile(
129
+ const module = await import("@jay-framework/compiler-jay-html");
130
+ const JAY_IMPORT_RESOLVER = module.JAY_IMPORT_RESOLVER;
131
+ const jayHtmlWithValidations = await parseJayFile(
154
132
  jayHtmlSource,
155
133
  fileName,
156
134
  dirName,
@@ -161,11 +139,11 @@ async function loadPageParts(vite, route, pagesBase, jayRollupConfig) {
161
139
  );
162
140
  return jayHtmlWithValidations.mapAsync(async (jayHtml) => {
163
141
  for await (const headlessImport of jayHtml.headlessImports) {
164
- const module22 = headlessImport.codeLink.module;
142
+ const module2 = headlessImport.codeLink.module;
165
143
  const name = headlessImport.codeLink.names[0].name;
166
- const modulePath = module22[0] === "." ? path.resolve(dirName, module22) : require.resolve(module22, { paths: require.resolve.paths(dirName) });
144
+ const modulePath = module2[0] === "." ? path.resolve(dirName, module2) : require2.resolve(module2, { paths: require2.resolve.paths(dirName) });
167
145
  const compDefinition = (await vite.ssrLoadModule(modulePath))[name];
168
- const moduleImport = module22.startsWith("./") ? path.resolve(pagesBase, module22) : module22;
146
+ const moduleImport = module2.startsWith("./") ? path.resolve(pagesBase, module2) : module2;
169
147
  const key = headlessImport.key;
170
148
  const part = {
171
149
  key,
@@ -178,9 +156,11 @@ async function loadPageParts(vite, route, pagesBase, jayRollupConfig) {
178
156
  return parts;
179
157
  });
180
158
  }
181
- exports.DevSlowlyChangingPhase = DevSlowlyChangingPhase;
182
- exports.generateClientScript = generateClientScript;
183
- exports.loadPageParts = loadPageParts;
184
- exports.renderFastChangingData = renderFastChangingData;
185
- exports.runLoadParams = runLoadParams;
186
- exports.runSlowlyChangingRender = runSlowlyChangingRender;
159
+ export {
160
+ DevSlowlyChangingPhase,
161
+ generateClientScript,
162
+ loadPageParts,
163
+ renderFastChangingData,
164
+ runLoadParams,
165
+ runSlowlyChangingRender
166
+ };
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@jay-framework/stack-server-runtime",
3
- "version": "0.6.7",
3
+ "version": "0.6.8",
4
4
  "license": "Apache-2.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.mts",
7
+ "type": "module",
7
8
  "directories": {
8
9
  "lib": "lib"
9
10
  },
@@ -25,16 +26,16 @@
25
26
  "test:watch": "vitest"
26
27
  },
27
28
  "dependencies": {
28
- "@jay-framework/compiler-jay-html": "^0.6.7",
29
- "@jay-framework/component": "^0.6.7",
30
- "@jay-framework/fullstack-component": "^0.6.7",
31
- "@jay-framework/runtime": "^0.6.7",
32
- "@jay-framework/stack-route-scanner": "^0.6.7"
29
+ "@jay-framework/compiler-jay-html": "^0.6.8",
30
+ "@jay-framework/component": "^0.6.8",
31
+ "@jay-framework/fullstack-component": "^0.6.8",
32
+ "@jay-framework/runtime": "^0.6.8",
33
+ "@jay-framework/stack-route-scanner": "^0.6.8"
33
34
  },
34
35
  "devDependencies": {
35
- "@jay-framework/dev-environment": "^0.6.7",
36
- "@jay-framework/jay-cli": "^0.6.7",
37
- "@jay-framework/stack-client-runtime": "^0.6.7",
36
+ "@jay-framework/dev-environment": "^0.6.8",
37
+ "@jay-framework/jay-cli": "^0.6.8",
38
+ "@jay-framework/stack-client-runtime": "^0.6.8",
38
39
  "@types/express": "^5.0.2",
39
40
  "@types/node": "^22.15.21",
40
41
  "nodemon": "^3.0.3",
File without changes