@webtypen/webframez-react 0.0.49 → 0.0.50

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/paths.cjs ADDED
@@ -0,0 +1,102 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __export = (target, all) => {
11
+ for (var name in all)
12
+ __defProp(target, name, { get: all[name], enumerable: true });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
+ mod
29
+ ));
30
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
+
32
+ // node_modules/@webtypen/webframez-core/dist/routing.js
33
+ var require_routing = __commonJS({
34
+ "node_modules/@webtypen/webframez-core/dist/routing.js"(exports2) {
35
+ "use strict";
36
+ Object.defineProperty(exports2, "__esModule", { value: true });
37
+ exports2.appRelativePath = exports2.appPath = exports2.getBasename = exports2.normalizeBasename = void 0;
38
+ function normalizeBasename2(value) {
39
+ if (value == null || value === "" || value === "/")
40
+ return "";
41
+ if (typeof value !== "string")
42
+ throw new Error("Router basename must be a string.");
43
+ const base = value.trim().replace(/\/+$/, "");
44
+ if (!base && value.trim().length <= 1)
45
+ return "";
46
+ if (!/^\/(?:[A-Za-z0-9_~-]+(?:\.[A-Za-z0-9_~-]+)*)(?:\/[A-Za-z0-9_~-]+(?:\.[A-Za-z0-9_~-]+)*)*$/.test(base)) {
47
+ throw new Error("Router basename must be empty or an absolute path such as /my-app.");
48
+ }
49
+ return base;
50
+ }
51
+ exports2.normalizeBasename = normalizeBasename2;
52
+ function getBasename2() {
53
+ var _a, _b, _c, _d;
54
+ const runtime = globalThis;
55
+ return (_d = (_c = (_b = (_a = runtime.__WEBFRAMEZ_ROUTING_CONTEXT__) === null || _a === void 0 ? void 0 : _a.getStore()) !== null && _b !== void 0 ? _b : runtime.__RSC_BASENAME) !== null && _c !== void 0 ? _c : runtime.__WEBFRAMEZ_ROUTER_BASENAME__) !== null && _d !== void 0 ? _d : "";
56
+ }
57
+ exports2.getBasename = getBasename2;
58
+ function appPath2(value, basename = getBasename2()) {
59
+ const base = normalizeBasename2(basename);
60
+ if (!base || !value.startsWith("/") || value.startsWith("//") || hasBasename(value, base))
61
+ return value;
62
+ return base + value;
63
+ }
64
+ exports2.appPath = appPath2;
65
+ function appRelativePath2(value, basename = getBasename2()) {
66
+ const base = normalizeBasename2(basename);
67
+ if (!base || !hasBasename(value, base))
68
+ return value;
69
+ const relative = value.slice(base.length);
70
+ return !relative || relative.startsWith("?") || relative.startsWith("#") ? "/" + relative : relative;
71
+ }
72
+ exports2.appRelativePath = appRelativePath2;
73
+ function hasBasename(value, base) {
74
+ return value === base || value.startsWith(base + "/") || value.startsWith(base + "?") || value.startsWith(base + "#");
75
+ }
76
+ }
77
+ });
78
+
79
+ // node_modules/@webtypen/webframez-core/routing.js
80
+ var require_routing2 = __commonJS({
81
+ "node_modules/@webtypen/webframez-core/routing.js"(exports2, module2) {
82
+ module2.exports = require_routing();
83
+ }
84
+ });
85
+
86
+ // src/paths.ts
87
+ var paths_exports = {};
88
+ __export(paths_exports, {
89
+ appPath: () => import_routing.appPath,
90
+ appRelativePath: () => import_routing.appRelativePath,
91
+ getBasename: () => import_routing.getBasename,
92
+ normalizeBasename: () => import_routing.normalizeBasename
93
+ });
94
+ module.exports = __toCommonJS(paths_exports);
95
+ var import_routing = __toESM(require_routing2(), 1);
96
+ // Annotate the CommonJS export names for ESM import in node:
97
+ 0 && (module.exports = {
98
+ appPath,
99
+ appRelativePath,
100
+ getBasename,
101
+ normalizeBasename
102
+ });
@@ -0,0 +1,4 @@
1
+ export function normalizeBasename(value?: string | null): string;
2
+ export function getBasename(): string;
3
+ export function appPath(value: string, basename?: string): string;
4
+ export function appRelativePath(value: string, basename?: string): string;
package/dist/paths.js ADDED
@@ -0,0 +1,92 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
+ // If the importer is in node compatibility mode or this is not an ESM
20
+ // file that has been converted to a CommonJS file using a Babel-
21
+ // compatible transform (i.e. "__esModule" has not been set), then set
22
+ // "default" to the CommonJS "module.exports" for node compatibility.
23
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
+ mod
25
+ ));
26
+
27
+ // node_modules/@webtypen/webframez-core/dist/routing.js
28
+ var require_routing = __commonJS({
29
+ "node_modules/@webtypen/webframez-core/dist/routing.js"(exports) {
30
+ "use strict";
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ exports.appRelativePath = exports.appPath = exports.getBasename = exports.normalizeBasename = void 0;
33
+ function normalizeBasename2(value) {
34
+ if (value == null || value === "" || value === "/")
35
+ return "";
36
+ if (typeof value !== "string")
37
+ throw new Error("Router basename must be a string.");
38
+ const base = value.trim().replace(/\/+$/, "");
39
+ if (!base && value.trim().length <= 1)
40
+ return "";
41
+ if (!/^\/(?:[A-Za-z0-9_~-]+(?:\.[A-Za-z0-9_~-]+)*)(?:\/[A-Za-z0-9_~-]+(?:\.[A-Za-z0-9_~-]+)*)*$/.test(base)) {
42
+ throw new Error("Router basename must be empty or an absolute path such as /my-app.");
43
+ }
44
+ return base;
45
+ }
46
+ exports.normalizeBasename = normalizeBasename2;
47
+ function getBasename2() {
48
+ var _a, _b, _c, _d;
49
+ const runtime = globalThis;
50
+ return (_d = (_c = (_b = (_a = runtime.__WEBFRAMEZ_ROUTING_CONTEXT__) === null || _a === void 0 ? void 0 : _a.getStore()) !== null && _b !== void 0 ? _b : runtime.__RSC_BASENAME) !== null && _c !== void 0 ? _c : runtime.__WEBFRAMEZ_ROUTER_BASENAME__) !== null && _d !== void 0 ? _d : "";
51
+ }
52
+ exports.getBasename = getBasename2;
53
+ function appPath2(value, basename = getBasename2()) {
54
+ const base = normalizeBasename2(basename);
55
+ if (!base || !value.startsWith("/") || value.startsWith("//") || hasBasename(value, base))
56
+ return value;
57
+ return base + value;
58
+ }
59
+ exports.appPath = appPath2;
60
+ function appRelativePath2(value, basename = getBasename2()) {
61
+ const base = normalizeBasename2(basename);
62
+ if (!base || !hasBasename(value, base))
63
+ return value;
64
+ const relative = value.slice(base.length);
65
+ return !relative || relative.startsWith("?") || relative.startsWith("#") ? "/" + relative : relative;
66
+ }
67
+ exports.appRelativePath = appRelativePath2;
68
+ function hasBasename(value, base) {
69
+ return value === base || value.startsWith(base + "/") || value.startsWith(base + "?") || value.startsWith(base + "#");
70
+ }
71
+ }
72
+ });
73
+
74
+ // node_modules/@webtypen/webframez-core/routing.js
75
+ var require_routing2 = __commonJS({
76
+ "node_modules/@webtypen/webframez-core/routing.js"(exports, module) {
77
+ module.exports = require_routing();
78
+ }
79
+ });
80
+
81
+ // src/paths.ts
82
+ var import_routing = __toESM(require_routing2(), 1);
83
+ var export_appPath = import_routing.appPath;
84
+ var export_appRelativePath = import_routing.appRelativePath;
85
+ var export_getBasename = import_routing.getBasename;
86
+ var export_normalizeBasename = import_routing.normalizeBasename;
87
+ export {
88
+ export_appPath as appPath,
89
+ export_appRelativePath as appRelativePath,
90
+ export_getBasename as getBasename,
91
+ export_normalizeBasename as normalizeBasename
92
+ };
package/dist/router.cjs CHANGED
@@ -221,8 +221,7 @@ var FORCED_PACKAGE_REQUESTS = [
221
221
  "react-server-dom-webpack",
222
222
  "react-server-dom-webpack/server",
223
223
  "react-server-dom-webpack/client",
224
- "react-server-dom-webpack/client.node",
225
- "scheduler"
224
+ "react-server-dom-webpack/client.node"
226
225
  ];
227
226
  var forcedPackageResolutionInstalled = false;
228
227
  function normalizePathname(pathname) {
package/dist/router.js CHANGED
@@ -191,8 +191,7 @@ var FORCED_PACKAGE_REQUESTS = [
191
191
  "react-server-dom-webpack",
192
192
  "react-server-dom-webpack/server",
193
193
  "react-server-dom-webpack/client",
194
- "react-server-dom-webpack/client.node",
195
- "scheduler"
194
+ "react-server-dom-webpack/client.node"
196
195
  ];
197
196
  var forcedPackageResolutionInstalled = false;
198
197
  function normalizePathname(pathname) {
@@ -4,6 +4,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
7
10
  var __export = (target, all) => {
8
11
  for (var name in all)
9
12
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -26,6 +29,60 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
29
  ));
27
30
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
31
 
32
+ // node_modules/@webtypen/webframez-core/dist/routing.js
33
+ var require_routing = __commonJS({
34
+ "node_modules/@webtypen/webframez-core/dist/routing.js"(exports2) {
35
+ "use strict";
36
+ Object.defineProperty(exports2, "__esModule", { value: true });
37
+ exports2.appRelativePath = exports2.appPath = exports2.getBasename = exports2.normalizeBasename = void 0;
38
+ function normalizeBasename2(value) {
39
+ if (value == null || value === "" || value === "/")
40
+ return "";
41
+ if (typeof value !== "string")
42
+ throw new Error("Router basename must be a string.");
43
+ const base = value.trim().replace(/\/+$/, "");
44
+ if (!base && value.trim().length <= 1)
45
+ return "";
46
+ if (!/^\/(?:[A-Za-z0-9_~-]+(?:\.[A-Za-z0-9_~-]+)*)(?:\/[A-Za-z0-9_~-]+(?:\.[A-Za-z0-9_~-]+)*)*$/.test(base)) {
47
+ throw new Error("Router basename must be empty or an absolute path such as /my-app.");
48
+ }
49
+ return base;
50
+ }
51
+ exports2.normalizeBasename = normalizeBasename2;
52
+ function getBasename2() {
53
+ var _a, _b, _c, _d;
54
+ const runtime = globalThis;
55
+ return (_d = (_c = (_b = (_a = runtime.__WEBFRAMEZ_ROUTING_CONTEXT__) === null || _a === void 0 ? void 0 : _a.getStore()) !== null && _b !== void 0 ? _b : runtime.__RSC_BASENAME) !== null && _c !== void 0 ? _c : runtime.__WEBFRAMEZ_ROUTER_BASENAME__) !== null && _d !== void 0 ? _d : "";
56
+ }
57
+ exports2.getBasename = getBasename2;
58
+ function appPath2(value, basename = getBasename2()) {
59
+ const base = normalizeBasename2(basename);
60
+ if (!base || !value.startsWith("/") || value.startsWith("//") || hasBasename(value, base))
61
+ return value;
62
+ return base + value;
63
+ }
64
+ exports2.appPath = appPath2;
65
+ function appRelativePath2(value, basename = getBasename2()) {
66
+ const base = normalizeBasename2(basename);
67
+ if (!base || !hasBasename(value, base))
68
+ return value;
69
+ const relative = value.slice(base.length);
70
+ return !relative || relative.startsWith("?") || relative.startsWith("#") ? "/" + relative : relative;
71
+ }
72
+ exports2.appRelativePath = appRelativePath2;
73
+ function hasBasename(value, base) {
74
+ return value === base || value.startsWith(base + "/") || value.startsWith(base + "?") || value.startsWith(base + "#");
75
+ }
76
+ }
77
+ });
78
+
79
+ // node_modules/@webtypen/webframez-core/routing.js
80
+ var require_routing2 = __commonJS({
81
+ "node_modules/@webtypen/webframez-core/routing.js"(exports2, module2) {
82
+ module2.exports = require_routing();
83
+ }
84
+ });
85
+
29
86
  // src/webframez-core.ts
30
87
  var webframez_core_exports = {};
31
88
  __export(webframez_core_exports, {
@@ -36,9 +93,15 @@ __export(webframez_core_exports, {
36
93
  setupWebframezCoreReactRoute: () => setupWebframezCoreReactRoute
37
94
  });
38
95
  module.exports = __toCommonJS(webframez_core_exports);
96
+
97
+ // src/paths.ts
98
+ var import_routing = __toESM(require_routing2(), 1);
99
+
100
+ // src/webframez-core.ts
39
101
  var import_node_path4 = __toESM(require("node:path"), 1);
40
102
 
41
103
  // src/http.ts
104
+ var import_node_async_hooks = require("node:async_hooks");
42
105
  var import_node_fs2 = __toESM(require("node:fs"), 1);
43
106
  var import_node_path3 = __toESM(require("node:path"), 1);
44
107
  var import_node_url = require("node:url");
@@ -348,8 +411,7 @@ var FORCED_PACKAGE_REQUESTS = [
348
411
  "react-server-dom-webpack",
349
412
  "react-server-dom-webpack/server",
350
413
  "react-server-dom-webpack/client",
351
- "react-server-dom-webpack/client.node",
352
- "scheduler"
414
+ "react-server-dom-webpack/client.node"
353
415
  ];
354
416
  var forcedPackageResolutionInstalled = false;
355
417
  function normalizePathname(pathname) {
@@ -1000,6 +1062,7 @@ const rootParent = {
1000
1062
  path: process.cwd(),
1001
1063
  paths: Module._nodeModulePaths(process.cwd()),
1002
1064
  };
1065
+ // Transitive dependencies (e.g. scheduler) must resolve from their importer.
1003
1066
  const forcedPackageRequests = [
1004
1067
  "@webtypen/webframez-core",
1005
1068
  "@webtypen/webframez-react",
@@ -1014,7 +1077,6 @@ const forcedPackageRequests = [
1014
1077
  "react-server-dom-webpack/server",
1015
1078
  "react-server-dom-webpack/client",
1016
1079
  "react-server-dom-webpack/client.node",
1017
- "scheduler"
1018
1080
  ];
1019
1081
 
1020
1082
  function shouldForcePackageResolution(request) {
@@ -1206,13 +1268,17 @@ async function renderHtmlFromFlightData(flightData, moduleMap) {
1206
1268
  ? payload.head.basename
1207
1269
  : "";
1208
1270
 
1209
- const previousBasename = globalThis.__RSC_BASENAME;
1210
- globalThis.__RSC_BASENAME = basename;
1211
- try {
1212
- return await renderHtml(model);
1213
- } finally {
1214
- globalThis.__RSC_BASENAME = previousBasename;
1215
- }
1271
+ const routingContext = globalThis.__WEBFRAMEZ_ROUTING_CONTEXT__ ??=
1272
+ new (require("node:async_hooks").AsyncLocalStorage)();
1273
+ return routingContext.run(basename, async () => {
1274
+ const previousBasename = globalThis.__RSC_BASENAME;
1275
+ globalThis.__RSC_BASENAME = basename;
1276
+ try {
1277
+ return await renderHtml(model);
1278
+ } finally {
1279
+ globalThis.__RSC_BASENAME = previousBasename;
1280
+ }
1281
+ });
1216
1282
  }
1217
1283
 
1218
1284
  process.on("message", async (message) => {
@@ -1448,24 +1514,10 @@ ${stderrBuffer.trim()}` : "";
1448
1514
  }
1449
1515
  };
1450
1516
  }
1517
+ var routingRuntime = globalThis;
1518
+ var basenameContext = routingRuntime.__WEBFRAMEZ_ROUTING_CONTEXT__ ??= new import_node_async_hooks.AsyncLocalStorage();
1451
1519
  function withRequestBasename(basename, fn) {
1452
- const target = globalThis;
1453
- const previous = target.__RSC_BASENAME;
1454
- target.__RSC_BASENAME = basename;
1455
- const finish = () => {
1456
- target.__RSC_BASENAME = previous;
1457
- };
1458
- try {
1459
- const result = fn();
1460
- if (result && typeof result.then === "function") {
1461
- return result.finally(finish);
1462
- }
1463
- finish();
1464
- return result;
1465
- } catch (error) {
1466
- finish();
1467
- throw error;
1468
- }
1520
+ return basenameContext.run(basename, fn);
1469
1521
  }
1470
1522
  function parseCookies(rawCookieHeader) {
1471
1523
  const raw = Array.isArray(rawCookieHeader) ? rawCookieHeader.join("; ") : rawCookieHeader ?? "";
@@ -1500,12 +1552,27 @@ function normalizeClientManifest(manifest, options) {
1500
1552
  }
1501
1553
  };
1502
1554
  for (const [key, value] of Object.entries(manifest)) {
1555
+ const hashIndex = key.indexOf("#");
1556
+ const moduleKey = hashIndex < 0 ? key : key.slice(0, hashIndex);
1557
+ const exportSuffix = hashIndex < 0 ? "" : key.slice(hashIndex);
1558
+ if (!import_node_path3.default.isAbsolute(moduleKey) && !moduleKey.includes(":") && !moduleKey.startsWith("file://")) {
1559
+ const runtimePath = import_node_path3.default.resolve(options.cwd, moduleKey);
1560
+ const allowedRoots = [options.distRootDir, ...candidateNodeModulesDirs];
1561
+ const insideArtifact = allowedRoots.some((root) => {
1562
+ const relative = import_node_path3.default.relative(import_node_path3.default.resolve(root), runtimePath);
1563
+ return relative !== "" && relative !== ".." && !relative.startsWith(`..${import_node_path3.default.sep}`) && !import_node_path3.default.isAbsolute(relative);
1564
+ });
1565
+ if (insideArtifact) {
1566
+ addAlias(`${runtimePath}${exportSuffix}`, value);
1567
+ addAlias(`${(0, import_node_url.pathToFileURL)(runtimePath).href}${exportSuffix}`, value);
1568
+ }
1569
+ }
1503
1570
  if (!key.startsWith("file://")) {
1504
1571
  continue;
1505
1572
  }
1506
1573
  let absolutePath = "";
1507
1574
  try {
1508
- absolutePath = (0, import_node_url.fileURLToPath)(key);
1575
+ absolutePath = (0, import_node_url.fileURLToPath)(moduleKey);
1509
1576
  } catch {
1510
1577
  continue;
1511
1578
  }
@@ -1516,13 +1583,13 @@ function normalizeClientManifest(manifest, options) {
1516
1583
  }
1517
1584
  const relativeModulePath = absolutePath.slice(markerIndex + marker.length);
1518
1585
  const relativeModulePathPosix = relativeModulePath.split(import_node_path3.default.sep).join("/");
1519
- addAlias(`./node_modules/${relativeModulePathPosix}`, value);
1520
- addAlias(`node_modules/${relativeModulePathPosix}`, value);
1521
- addAlias(absolutePath, value);
1586
+ addAlias(`./node_modules/${relativeModulePathPosix}${exportSuffix}`, value);
1587
+ addAlias(`node_modules/${relativeModulePathPosix}${exportSuffix}`, value);
1588
+ addAlias(`${absolutePath}${exportSuffix}`, value);
1522
1589
  for (const nodeModulesDir of candidateNodeModulesDirs) {
1523
1590
  const aliasPath = import_node_path3.default.join(nodeModulesDir, relativeModulePath);
1524
- addAlias(aliasPath, value);
1525
- addAlias((0, import_node_url.pathToFileURL)(aliasPath).href, value);
1591
+ addAlias(`${aliasPath}${exportSuffix}`, value);
1592
+ addAlias(`${(0, import_node_url.pathToFileURL)(aliasPath).href}${exportSuffix}`, value);
1526
1593
  }
1527
1594
  }
1528
1595
  return normalized;
@@ -1667,10 +1734,10 @@ function createNodeRequestHandler(options) {
1667
1734
  const manifestPath = import_node_path3.default.resolve(
1668
1735
  options.manifestPath ?? import_node_path3.default.join(distRootDir, "react-client-manifest.json")
1669
1736
  );
1670
- const assetsPrefix = options.assetsPrefix ?? "/assets/";
1671
- const rscPath = options.rscPath ?? "/rsc";
1672
- const clientScriptUrl = options.clientScriptUrl ?? "/assets/client.js";
1673
1737
  const basePath = normalizeBasePath(options.basePath);
1738
+ const assetsPrefix = options.assetsPrefix ?? `${basePath}/assets/`;
1739
+ const rscPath = options.rscPath ?? `${basePath}/rsc`;
1740
+ const clientScriptUrl = options.clientScriptUrl ?? `${basePath}/assets/client.js`;
1674
1741
  const nodeEnv = process.env.NODE_ENV || "";
1675
1742
  const runningInWatchMode = Array.isArray(process.execArgv) && process.execArgv.includes("--watch");
1676
1743
  const liveReloadEnabled = options.liveReloadPath !== false && (nodeEnv === "development" || runningInWatchMode);
@@ -1689,7 +1756,7 @@ function createNodeRequestHandler(options) {
1689
1756
  process.once("exit", disposeInitialHtmlWorker);
1690
1757
  process.once("SIGINT", disposeInitialHtmlWorker);
1691
1758
  process.once("SIGTERM", disposeInitialHtmlWorker);
1692
- return async function handleRequest(req, res) {
1759
+ const handleRequest = async (req, res) => {
1693
1760
  if (!req.url) {
1694
1761
  res.statusCode = 400;
1695
1762
  res.end("Bad request");
@@ -1753,6 +1820,7 @@ function createNodeRequestHandler(options) {
1753
1820
  request: requestContext
1754
1821
  })
1755
1822
  );
1823
+ resolved2.head = { ...resolved2.head, basename: resolved2.head.basename ?? basePath };
1756
1824
  attachResolvedContextToCoreRequest(req, resolved2.context);
1757
1825
  const payload = {
1758
1826
  model: resolved2.model,
@@ -1828,6 +1896,7 @@ function createNodeRequestHandler(options) {
1828
1896
  )
1829
1897
  })
1830
1898
  );
1899
+ resolved.head = { ...resolved.head, basename: resolved.head.basename ?? basePath };
1831
1900
  attachResolvedContextToCoreRequest(req, resolved.context);
1832
1901
  const initialPayload = {
1833
1902
  model: resolved.model,
@@ -1913,6 +1982,7 @@ function createNodeRequestHandler(options) {
1913
1982
  }
1914
1983
  );
1915
1984
  };
1985
+ return (req, res) => withRequestBasename(basePath, () => handleRequest(req, res));
1916
1986
  }
1917
1987
 
1918
1988
  // src/webframez-core.ts
@@ -2001,6 +2071,17 @@ function buildRenderDefaults(routePathValue) {
2001
2071
  clientScriptUrl: `${mountPath}/assets/client.js`
2002
2072
  };
2003
2073
  }
2074
+ function runtimeRoutePaths(routePath, options, basename = (0, import_routing.getBasename)(), groupPrefix = "") {
2075
+ const localMount = normalizeMountPath(options.basePath ?? `${groupPrefix}${normalizeMountPath(routePath)}`);
2076
+ const basePath = normalizeMountPath((0, import_routing.appPath)(localMount, basename)).replace(/\/$/, "");
2077
+ return {
2078
+ basePath,
2079
+ assetsPrefix: options.assetsPrefix !== void 0 ? (0, import_routing.appPath)(options.assetsPrefix, basename) : `${basePath}/assets/`,
2080
+ rscPath: options.rscPath !== void 0 ? (0, import_routing.appPath)(options.rscPath, basename) : `${basePath}/rsc`,
2081
+ clientScriptUrl: options.clientScriptUrl !== void 0 ? (0, import_routing.appPath)(options.clientScriptUrl, basename) : `${basePath}/assets/client.js`,
2082
+ ...typeof options.liveReloadPath === "string" ? { liveReloadPath: (0, import_routing.appPath)(options.liveReloadPath, basename) } : {}
2083
+ };
2084
+ }
2004
2085
  async function waitForResponseFinish(res) {
2005
2086
  if (res.writableEnded || res.destroyed) {
2006
2087
  return;
@@ -2094,10 +2175,7 @@ function registerRouteRenderer(route, methodName) {
2094
2175
  distRootDir: resolvedTarget.distRootDir,
2095
2176
  pagesDir: resolvedTarget.pagesDir,
2096
2177
  manifestPath: resolvedTarget.manifestPath,
2097
- basePath: basePath ?? defaults.basePath,
2098
- assetsPrefix: assetsPrefix ?? defaults.assetsPrefix,
2099
- rscPath: rscPath ?? defaults.rscPath,
2100
- clientScriptUrl: clientScriptUrl ?? defaults.clientScriptUrl
2178
+ ...runtimeRoutePaths(routePathValue, options, route.basename ?? (0, import_routing.getBasename)(), route.tempGroupPrefix ?? "")
2101
2179
  });
2102
2180
  const methods = normalizeMethods(method);
2103
2181
  for (const currentMethod of methods) {
@@ -2139,13 +2217,10 @@ function resolveWebframezReactRouteOptions(routePathValue, options = {}) {
2139
2217
  distRootDir,
2140
2218
  pagesDir,
2141
2219
  manifestPath,
2142
- assetsPrefix: options.assetsPrefix ?? defaults.assetsPrefix,
2143
- rscPath: options.rscPath ?? defaults.rscPath,
2144
- clientScriptUrl: options.clientScriptUrl ?? defaults.clientScriptUrl,
2220
+ ...runtimeRoutePaths(routePathValue, options),
2145
2221
  clientEntryPath: options.clientEntryPath ? resolveFromProjectRoot(options.clientEntryPath) : void 0,
2146
2222
  styleSrcPath: options.styleSrcPath ? resolveFromProjectRoot(options.styleSrcPath) : defaults.styleSrcPath,
2147
- basePath: options.basePath ?? defaults.basePath,
2148
- liveReloadPath: options.liveReloadPath,
2223
+ liveReloadPath: typeof options.liveReloadPath === "string" ? (0, import_routing.appPath)(options.liveReloadPath) : options.liveReloadPath,
2149
2224
  onData: options.onData
2150
2225
  };
2151
2226
  }
@@ -39,14 +39,8 @@ export interface WebframezCoreRouteFacadeExtensions {
39
39
  reactRender(path: string, options?: WebframezCoreReactRenderRouteOptions): void;
40
40
  }
41
41
 
42
- declare module "@webtypen/webframez-core" {
43
- interface RouteFacade extends WebframezCoreRouteFacadeExtensions {}
44
- }
45
-
46
- declare module "webframez-core" {
47
- interface RouteFacade extends WebframezCoreRouteFacadeExtensions {}
48
- }
49
-
42
+ // Augment the defining module; the package root re-exports this same class.
43
+ // Also augmenting the root creates conflicting polymorphic `this` types.
50
44
  declare module "@webtypen/webframez-core/dist/Router/Route" {
51
45
  interface RouteFacade extends WebframezCoreRouteFacadeExtensions {}
52
46
  }