@webtypen/webframez-react 0.0.13 → 0.0.14

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/http.cjs CHANGED
@@ -34,6 +34,7 @@ __export(http_exports, {
34
34
  module.exports = __toCommonJS(http_exports);
35
35
  var import_node_fs2 = __toESM(require("node:fs"), 1);
36
36
  var import_node_path3 = __toESM(require("node:path"), 1);
37
+ var import_node_url = require("node:url");
37
38
  var import_node_child_process = require("node:child_process");
38
39
 
39
40
  // src/server.ts
@@ -801,6 +802,38 @@ function parseCookies(rawCookieHeader) {
801
802
  }
802
803
  return output;
803
804
  }
805
+ function normalizeClientManifest(manifest, options) {
806
+ const normalized = { ...manifest };
807
+ const candidateNodeModulesDirs = /* @__PURE__ */ new Set([
808
+ import_node_path3.default.resolve(options.cwd, "node_modules"),
809
+ import_node_path3.default.resolve(options.distRootDir, "..", "..", "node_modules")
810
+ ]);
811
+ for (const [key, value] of Object.entries(manifest)) {
812
+ if (!key.startsWith("file://")) {
813
+ continue;
814
+ }
815
+ let absolutePath = "";
816
+ try {
817
+ absolutePath = (0, import_node_url.fileURLToPath)(key);
818
+ } catch {
819
+ continue;
820
+ }
821
+ const marker = `${import_node_path3.default.sep}node_modules${import_node_path3.default.sep}`;
822
+ const markerIndex = absolutePath.lastIndexOf(marker);
823
+ if (markerIndex < 0) {
824
+ continue;
825
+ }
826
+ const relativeModulePath = absolutePath.slice(markerIndex + marker.length);
827
+ for (const nodeModulesDir of candidateNodeModulesDirs) {
828
+ const aliasPath = import_node_path3.default.join(nodeModulesDir, relativeModulePath);
829
+ const aliasKey = (0, import_node_url.pathToFileURL)(aliasPath).href;
830
+ if (!(aliasKey in normalized)) {
831
+ normalized[aliasKey] = value;
832
+ }
833
+ }
834
+ }
835
+ return normalized;
836
+ }
804
837
  function createNodeRequestHandler(options) {
805
838
  const devServerId = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
806
839
  const distRootDir = import_node_path3.default.resolve(options.distRootDir);
@@ -818,7 +851,13 @@ function createNodeRequestHandler(options) {
818
851
  const liveReloadPath = !liveReloadEnabled ? "" : options.liveReloadPath ?? `${basePath || ""}/__webframez_live_reload`;
819
852
  const liveReloadClients = /* @__PURE__ */ new Set();
820
853
  const router = createFileRouter({ pagesDir });
821
- const moduleMap = JSON.parse(import_node_fs2.default.readFileSync(manifestPath, "utf-8"));
854
+ const moduleMap = normalizeClientManifest(
855
+ JSON.parse(import_node_fs2.default.readFileSync(manifestPath, "utf-8")),
856
+ {
857
+ distRootDir,
858
+ cwd: process.cwd()
859
+ }
860
+ );
822
861
  const initialHtmlWorker = createInitialHtmlWorker(pagesDir);
823
862
  const disposeInitialHtmlWorker = () => {
824
863
  initialHtmlWorker.dispose();
package/dist/http.js CHANGED
@@ -9,6 +9,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
9
9
  // src/http.ts
10
10
  import fs2 from "node:fs";
11
11
  import path3 from "node:path";
12
+ import { fileURLToPath, pathToFileURL } from "node:url";
12
13
  import { spawn } from "node:child_process";
13
14
 
14
15
  // src/server.ts
@@ -776,6 +777,38 @@ function parseCookies(rawCookieHeader) {
776
777
  }
777
778
  return output;
778
779
  }
780
+ function normalizeClientManifest(manifest, options) {
781
+ const normalized = { ...manifest };
782
+ const candidateNodeModulesDirs = /* @__PURE__ */ new Set([
783
+ path3.resolve(options.cwd, "node_modules"),
784
+ path3.resolve(options.distRootDir, "..", "..", "node_modules")
785
+ ]);
786
+ for (const [key, value] of Object.entries(manifest)) {
787
+ if (!key.startsWith("file://")) {
788
+ continue;
789
+ }
790
+ let absolutePath = "";
791
+ try {
792
+ absolutePath = fileURLToPath(key);
793
+ } catch {
794
+ continue;
795
+ }
796
+ const marker = `${path3.sep}node_modules${path3.sep}`;
797
+ const markerIndex = absolutePath.lastIndexOf(marker);
798
+ if (markerIndex < 0) {
799
+ continue;
800
+ }
801
+ const relativeModulePath = absolutePath.slice(markerIndex + marker.length);
802
+ for (const nodeModulesDir of candidateNodeModulesDirs) {
803
+ const aliasPath = path3.join(nodeModulesDir, relativeModulePath);
804
+ const aliasKey = pathToFileURL(aliasPath).href;
805
+ if (!(aliasKey in normalized)) {
806
+ normalized[aliasKey] = value;
807
+ }
808
+ }
809
+ }
810
+ return normalized;
811
+ }
779
812
  function createNodeRequestHandler(options) {
780
813
  const devServerId = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
781
814
  const distRootDir = path3.resolve(options.distRootDir);
@@ -793,7 +826,13 @@ function createNodeRequestHandler(options) {
793
826
  const liveReloadPath = !liveReloadEnabled ? "" : options.liveReloadPath ?? `${basePath || ""}/__webframez_live_reload`;
794
827
  const liveReloadClients = /* @__PURE__ */ new Set();
795
828
  const router = createFileRouter({ pagesDir });
796
- const moduleMap = JSON.parse(fs2.readFileSync(manifestPath, "utf-8"));
829
+ const moduleMap = normalizeClientManifest(
830
+ JSON.parse(fs2.readFileSync(manifestPath, "utf-8")),
831
+ {
832
+ distRootDir,
833
+ cwd: process.cwd()
834
+ }
835
+ );
797
836
  const initialHtmlWorker = createInitialHtmlWorker(pagesDir);
798
837
  const disposeInitialHtmlWorker = () => {
799
838
  initialHtmlWorker.dispose();
package/dist/index.cjs CHANGED
@@ -565,6 +565,7 @@ function parseSearchParams(query) {
565
565
  // src/http.ts
566
566
  var import_node_fs2 = __toESM(require("node:fs"), 1);
567
567
  var import_node_path3 = __toESM(require("node:path"), 1);
568
+ var import_node_url = require("node:url");
568
569
  var import_node_child_process = require("node:child_process");
569
570
  function createInitialHtmlErrorMarkup(message) {
570
571
  return `<main style="font-family:system-ui,sans-serif;padding:24px"><h1 style="margin:0 0 12px">500</h1><p style="margin:0">${message}</p></main>`;
@@ -838,6 +839,38 @@ function parseCookies(rawCookieHeader) {
838
839
  }
839
840
  return output;
840
841
  }
842
+ function normalizeClientManifest(manifest, options) {
843
+ const normalized = { ...manifest };
844
+ const candidateNodeModulesDirs = /* @__PURE__ */ new Set([
845
+ import_node_path3.default.resolve(options.cwd, "node_modules"),
846
+ import_node_path3.default.resolve(options.distRootDir, "..", "..", "node_modules")
847
+ ]);
848
+ for (const [key, value] of Object.entries(manifest)) {
849
+ if (!key.startsWith("file://")) {
850
+ continue;
851
+ }
852
+ let absolutePath = "";
853
+ try {
854
+ absolutePath = (0, import_node_url.fileURLToPath)(key);
855
+ } catch {
856
+ continue;
857
+ }
858
+ const marker = `${import_node_path3.default.sep}node_modules${import_node_path3.default.sep}`;
859
+ const markerIndex = absolutePath.lastIndexOf(marker);
860
+ if (markerIndex < 0) {
861
+ continue;
862
+ }
863
+ const relativeModulePath = absolutePath.slice(markerIndex + marker.length);
864
+ for (const nodeModulesDir of candidateNodeModulesDirs) {
865
+ const aliasPath = import_node_path3.default.join(nodeModulesDir, relativeModulePath);
866
+ const aliasKey = (0, import_node_url.pathToFileURL)(aliasPath).href;
867
+ if (!(aliasKey in normalized)) {
868
+ normalized[aliasKey] = value;
869
+ }
870
+ }
871
+ }
872
+ return normalized;
873
+ }
841
874
  function createNodeRequestHandler(options) {
842
875
  const devServerId = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
843
876
  const distRootDir = import_node_path3.default.resolve(options.distRootDir);
@@ -855,7 +888,13 @@ function createNodeRequestHandler(options) {
855
888
  const liveReloadPath = !liveReloadEnabled ? "" : options.liveReloadPath ?? `${basePath || ""}/__webframez_live_reload`;
856
889
  const liveReloadClients = /* @__PURE__ */ new Set();
857
890
  const router = createFileRouter({ pagesDir });
858
- const moduleMap = JSON.parse(import_node_fs2.default.readFileSync(manifestPath, "utf-8"));
891
+ const moduleMap = normalizeClientManifest(
892
+ JSON.parse(import_node_fs2.default.readFileSync(manifestPath, "utf-8")),
893
+ {
894
+ distRootDir,
895
+ cwd: process.cwd()
896
+ }
897
+ );
859
898
  const initialHtmlWorker = createInitialHtmlWorker(pagesDir);
860
899
  const disposeInitialHtmlWorker = () => {
861
900
  initialHtmlWorker.dispose();
package/dist/index.js CHANGED
@@ -529,6 +529,7 @@ function parseSearchParams(query) {
529
529
  // src/http.ts
530
530
  import fs2 from "node:fs";
531
531
  import path3 from "node:path";
532
+ import { fileURLToPath, pathToFileURL } from "node:url";
532
533
  import { spawn } from "node:child_process";
533
534
  function createInitialHtmlErrorMarkup(message) {
534
535
  return `<main style="font-family:system-ui,sans-serif;padding:24px"><h1 style="margin:0 0 12px">500</h1><p style="margin:0">${message}</p></main>`;
@@ -802,6 +803,38 @@ function parseCookies(rawCookieHeader) {
802
803
  }
803
804
  return output;
804
805
  }
806
+ function normalizeClientManifest(manifest, options) {
807
+ const normalized = { ...manifest };
808
+ const candidateNodeModulesDirs = /* @__PURE__ */ new Set([
809
+ path3.resolve(options.cwd, "node_modules"),
810
+ path3.resolve(options.distRootDir, "..", "..", "node_modules")
811
+ ]);
812
+ for (const [key, value] of Object.entries(manifest)) {
813
+ if (!key.startsWith("file://")) {
814
+ continue;
815
+ }
816
+ let absolutePath = "";
817
+ try {
818
+ absolutePath = fileURLToPath(key);
819
+ } catch {
820
+ continue;
821
+ }
822
+ const marker = `${path3.sep}node_modules${path3.sep}`;
823
+ const markerIndex = absolutePath.lastIndexOf(marker);
824
+ if (markerIndex < 0) {
825
+ continue;
826
+ }
827
+ const relativeModulePath = absolutePath.slice(markerIndex + marker.length);
828
+ for (const nodeModulesDir of candidateNodeModulesDirs) {
829
+ const aliasPath = path3.join(nodeModulesDir, relativeModulePath);
830
+ const aliasKey = pathToFileURL(aliasPath).href;
831
+ if (!(aliasKey in normalized)) {
832
+ normalized[aliasKey] = value;
833
+ }
834
+ }
835
+ }
836
+ return normalized;
837
+ }
805
838
  function createNodeRequestHandler(options) {
806
839
  const devServerId = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
807
840
  const distRootDir = path3.resolve(options.distRootDir);
@@ -819,7 +852,13 @@ function createNodeRequestHandler(options) {
819
852
  const liveReloadPath = !liveReloadEnabled ? "" : options.liveReloadPath ?? `${basePath || ""}/__webframez_live_reload`;
820
853
  const liveReloadClients = /* @__PURE__ */ new Set();
821
854
  const router = createFileRouter({ pagesDir });
822
- const moduleMap = JSON.parse(fs2.readFileSync(manifestPath, "utf-8"));
855
+ const moduleMap = normalizeClientManifest(
856
+ JSON.parse(fs2.readFileSync(manifestPath, "utf-8")),
857
+ {
858
+ distRootDir,
859
+ cwd: process.cwd()
860
+ }
861
+ );
823
862
  const initialHtmlWorker = createInitialHtmlWorker(pagesDir);
824
863
  const disposeInitialHtmlWorker = () => {
825
864
  initialHtmlWorker.dispose();
@@ -37,6 +37,7 @@ module.exports = __toCommonJS(webframez_core_exports);
37
37
  // src/http.ts
38
38
  var import_node_fs2 = __toESM(require("node:fs"), 1);
39
39
  var import_node_path3 = __toESM(require("node:path"), 1);
40
+ var import_node_url = require("node:url");
40
41
  var import_node_child_process = require("node:child_process");
41
42
 
42
43
  // src/server.ts
@@ -804,6 +805,38 @@ function parseCookies(rawCookieHeader) {
804
805
  }
805
806
  return output;
806
807
  }
808
+ function normalizeClientManifest(manifest, options) {
809
+ const normalized = { ...manifest };
810
+ const candidateNodeModulesDirs = /* @__PURE__ */ new Set([
811
+ import_node_path3.default.resolve(options.cwd, "node_modules"),
812
+ import_node_path3.default.resolve(options.distRootDir, "..", "..", "node_modules")
813
+ ]);
814
+ for (const [key, value] of Object.entries(manifest)) {
815
+ if (!key.startsWith("file://")) {
816
+ continue;
817
+ }
818
+ let absolutePath = "";
819
+ try {
820
+ absolutePath = (0, import_node_url.fileURLToPath)(key);
821
+ } catch {
822
+ continue;
823
+ }
824
+ const marker = `${import_node_path3.default.sep}node_modules${import_node_path3.default.sep}`;
825
+ const markerIndex = absolutePath.lastIndexOf(marker);
826
+ if (markerIndex < 0) {
827
+ continue;
828
+ }
829
+ const relativeModulePath = absolutePath.slice(markerIndex + marker.length);
830
+ for (const nodeModulesDir of candidateNodeModulesDirs) {
831
+ const aliasPath = import_node_path3.default.join(nodeModulesDir, relativeModulePath);
832
+ const aliasKey = (0, import_node_url.pathToFileURL)(aliasPath).href;
833
+ if (!(aliasKey in normalized)) {
834
+ normalized[aliasKey] = value;
835
+ }
836
+ }
837
+ }
838
+ return normalized;
839
+ }
807
840
  function createNodeRequestHandler(options) {
808
841
  const devServerId = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
809
842
  const distRootDir = import_node_path3.default.resolve(options.distRootDir);
@@ -821,7 +854,13 @@ function createNodeRequestHandler(options) {
821
854
  const liveReloadPath = !liveReloadEnabled ? "" : options.liveReloadPath ?? `${basePath || ""}/__webframez_live_reload`;
822
855
  const liveReloadClients = /* @__PURE__ */ new Set();
823
856
  const router = createFileRouter({ pagesDir });
824
- const moduleMap = JSON.parse(import_node_fs2.default.readFileSync(manifestPath, "utf-8"));
857
+ const moduleMap = normalizeClientManifest(
858
+ JSON.parse(import_node_fs2.default.readFileSync(manifestPath, "utf-8")),
859
+ {
860
+ distRootDir,
861
+ cwd: process.cwd()
862
+ }
863
+ );
825
864
  const initialHtmlWorker = createInitialHtmlWorker(pagesDir);
826
865
  const disposeInitialHtmlWorker = () => {
827
866
  initialHtmlWorker.dispose();
@@ -9,6 +9,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
9
9
  // src/http.ts
10
10
  import fs2 from "node:fs";
11
11
  import path3 from "node:path";
12
+ import { fileURLToPath, pathToFileURL } from "node:url";
12
13
  import { spawn } from "node:child_process";
13
14
 
14
15
  // src/server.ts
@@ -776,6 +777,38 @@ function parseCookies(rawCookieHeader) {
776
777
  }
777
778
  return output;
778
779
  }
780
+ function normalizeClientManifest(manifest, options) {
781
+ const normalized = { ...manifest };
782
+ const candidateNodeModulesDirs = /* @__PURE__ */ new Set([
783
+ path3.resolve(options.cwd, "node_modules"),
784
+ path3.resolve(options.distRootDir, "..", "..", "node_modules")
785
+ ]);
786
+ for (const [key, value] of Object.entries(manifest)) {
787
+ if (!key.startsWith("file://")) {
788
+ continue;
789
+ }
790
+ let absolutePath = "";
791
+ try {
792
+ absolutePath = fileURLToPath(key);
793
+ } catch {
794
+ continue;
795
+ }
796
+ const marker = `${path3.sep}node_modules${path3.sep}`;
797
+ const markerIndex = absolutePath.lastIndexOf(marker);
798
+ if (markerIndex < 0) {
799
+ continue;
800
+ }
801
+ const relativeModulePath = absolutePath.slice(markerIndex + marker.length);
802
+ for (const nodeModulesDir of candidateNodeModulesDirs) {
803
+ const aliasPath = path3.join(nodeModulesDir, relativeModulePath);
804
+ const aliasKey = pathToFileURL(aliasPath).href;
805
+ if (!(aliasKey in normalized)) {
806
+ normalized[aliasKey] = value;
807
+ }
808
+ }
809
+ }
810
+ return normalized;
811
+ }
779
812
  function createNodeRequestHandler(options) {
780
813
  const devServerId = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
781
814
  const distRootDir = path3.resolve(options.distRootDir);
@@ -793,7 +826,13 @@ function createNodeRequestHandler(options) {
793
826
  const liveReloadPath = !liveReloadEnabled ? "" : options.liveReloadPath ?? `${basePath || ""}/__webframez_live_reload`;
794
827
  const liveReloadClients = /* @__PURE__ */ new Set();
795
828
  const router = createFileRouter({ pagesDir });
796
- const moduleMap = JSON.parse(fs2.readFileSync(manifestPath, "utf-8"));
829
+ const moduleMap = normalizeClientManifest(
830
+ JSON.parse(fs2.readFileSync(manifestPath, "utf-8")),
831
+ {
832
+ distRootDir,
833
+ cwd: process.cwd()
834
+ }
835
+ );
797
836
  const initialHtmlWorker = createInitialHtmlWorker(pagesDir);
798
837
  const disposeInitialHtmlWorker = () => {
799
838
  initialHtmlWorker.dispose();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webtypen/webframez-react",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "description": "TypeScript React RSC addition for @webtypen/webframez-core",
5
5
  "homepage": "https://webtypen.de/",
6
6
  "author": {