elegance-js 2.1.21 → 2.1.23

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.
@@ -5,6 +5,7 @@ const __dirname = path.dirname(__filename);
5
5
  import esbuild from "esbuild";
6
6
  import { fileURLToPath } from "url";
7
7
  import { generateHTMLTemplate } from "../server/generateHTMLTemplate";
8
+ import crypto from "crypto";
8
9
  import { ObjectAttributeType } from "../helpers/ObjectAttributeType";
9
10
  import { serverSideRenderPage } from "../server/render";
10
11
  import { getState, initializeState, initializeObjectAttributes, getObjectAttributes } from "../server/state";
@@ -497,8 +498,11 @@ async function buildLayouts() {
497
498
  }
498
499
  return { shouldClientHardReload };
499
500
  }
501
+ function hashDirectory(directory) {
502
+ return crypto.createHash("md5").update(directory).digest("hex");
503
+ }
500
504
  async function buildLayout(filePath, directory, generateDynamic = false) {
501
- const id = globalThis.__SERVER_CURRENT_STATE_ID__ += 1;
505
+ const id = hashDirectory(directory);
502
506
  const childIndicator = `<template layout-id="${id}"></template>`;
503
507
  const result = await generateLayout(
504
508
  DIST_DIR,
@@ -558,6 +562,7 @@ async function fetchPageLayoutHTML(dirname) {
558
562
  if (!builtLayouts.has(filePath)) {
559
563
  const builtLayout = await buildLayout(layout.filePath, dir, true);
560
564
  if (!builtLayout) continue;
565
+ builtLayouts.set(filePath, builtLayout);
561
566
  layouts.push(builtLayout);
562
567
  } else {
563
568
  layouts.push(builtLayouts.get(filePath));
@@ -3,7 +3,7 @@ export declare const observe: <T extends {
3
3
  type: ObjectAttributeType;
4
4
  value: unknown;
5
5
  id: string | number;
6
- bind?: string;
6
+ bind?: string | undefined;
7
7
  }[]>(refs: [...T], update: (...values: { [K in keyof T]: T[K] extends {
8
8
  value: infer V;
9
9
  } ? V : never; }) => (string | number)) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elegance-js",
3
- "version": "2.1.21",
3
+ "version": "2.1.23",
4
4
  "description": "Web-Framework",
5
5
  "type": "module",
6
6
  "bin": {