@webtypen/webframez-react 0.0.19 → 0.0.21
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 +36 -7
- package/dist/http.js +36 -7
- package/dist/index.cjs +36 -7
- package/dist/index.js +36 -7
- package/dist/webframez-core.cjs +36 -7
- package/dist/webframez-core.js +36 -7
- package/package.json +1 -1
package/dist/http.cjs
CHANGED
|
@@ -941,6 +941,11 @@ function normalizeClientManifest(manifest, options) {
|
|
|
941
941
|
import_node_path3.default.resolve(options.cwd, "node_modules"),
|
|
942
942
|
import_node_path3.default.resolve(options.distRootDir, "..", "..", "node_modules")
|
|
943
943
|
]);
|
|
944
|
+
const addAlias = (aliasKey, value) => {
|
|
945
|
+
if (!(aliasKey in normalized)) {
|
|
946
|
+
normalized[aliasKey] = value;
|
|
947
|
+
}
|
|
948
|
+
};
|
|
944
949
|
for (const [key, value] of Object.entries(manifest)) {
|
|
945
950
|
if (!key.startsWith("file://")) {
|
|
946
951
|
continue;
|
|
@@ -957,16 +962,39 @@ function normalizeClientManifest(manifest, options) {
|
|
|
957
962
|
continue;
|
|
958
963
|
}
|
|
959
964
|
const relativeModulePath = absolutePath.slice(markerIndex + marker.length);
|
|
965
|
+
const relativeModulePathPosix = relativeModulePath.split(import_node_path3.default.sep).join("/");
|
|
966
|
+
addAlias(`./node_modules/${relativeModulePathPosix}`, value);
|
|
967
|
+
addAlias(`node_modules/${relativeModulePathPosix}`, value);
|
|
968
|
+
addAlias(absolutePath, value);
|
|
960
969
|
for (const nodeModulesDir of candidateNodeModulesDirs) {
|
|
961
970
|
const aliasPath = import_node_path3.default.join(nodeModulesDir, relativeModulePath);
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
normalized[aliasKey] = value;
|
|
965
|
-
}
|
|
971
|
+
addAlias(aliasPath, value);
|
|
972
|
+
addAlias((0, import_node_url.pathToFileURL)(aliasPath).href, value);
|
|
966
973
|
}
|
|
967
974
|
}
|
|
968
975
|
return normalized;
|
|
969
976
|
}
|
|
977
|
+
function createServerConsumerManifest(manifest) {
|
|
978
|
+
const consumerManifest = {};
|
|
979
|
+
for (const [key, value] of Object.entries(manifest)) {
|
|
980
|
+
if (!value || typeof value !== "object") {
|
|
981
|
+
continue;
|
|
982
|
+
}
|
|
983
|
+
const entry = value;
|
|
984
|
+
if (typeof entry.id !== "string" || entry.id.trim() === "") {
|
|
985
|
+
continue;
|
|
986
|
+
}
|
|
987
|
+
consumerManifest[key] = {
|
|
988
|
+
"*": {
|
|
989
|
+
id: entry.id,
|
|
990
|
+
chunks: Array.isArray(entry.chunks) ? entry.chunks : [],
|
|
991
|
+
name: entry.name ?? "*",
|
|
992
|
+
...entry.async ? { async: entry.async } : {}
|
|
993
|
+
}
|
|
994
|
+
};
|
|
995
|
+
}
|
|
996
|
+
return consumerManifest;
|
|
997
|
+
}
|
|
970
998
|
function createNodeRequestHandler(options) {
|
|
971
999
|
const devServerId = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
972
1000
|
const distRootDir = import_node_path3.default.resolve(options.distRootDir);
|
|
@@ -991,6 +1019,7 @@ function createNodeRequestHandler(options) {
|
|
|
991
1019
|
cwd: process.cwd()
|
|
992
1020
|
}
|
|
993
1021
|
);
|
|
1022
|
+
const serverConsumerModuleMap = createServerConsumerManifest(moduleMap);
|
|
994
1023
|
const initialHtmlWorker = createInitialHtmlWorker(pagesDir);
|
|
995
1024
|
const disposeInitialHtmlWorker = () => {
|
|
996
1025
|
initialHtmlWorker.dispose();
|
|
@@ -1106,7 +1135,7 @@ function createNodeRequestHandler(options) {
|
|
|
1106
1135
|
try {
|
|
1107
1136
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1108
1137
|
flightData: initialFlightData,
|
|
1109
|
-
moduleMap
|
|
1138
|
+
moduleMap: serverConsumerModuleMap
|
|
1110
1139
|
});
|
|
1111
1140
|
} catch (error) {
|
|
1112
1141
|
console.error("[webframez-react] Failed to render initial HTML", error);
|
|
@@ -1114,7 +1143,7 @@ function createNodeRequestHandler(options) {
|
|
|
1114
1143
|
initialHtmlWorker.dispose();
|
|
1115
1144
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1116
1145
|
flightData: initialFlightData,
|
|
1117
|
-
moduleMap
|
|
1146
|
+
moduleMap: serverConsumerModuleMap
|
|
1118
1147
|
});
|
|
1119
1148
|
} catch (retryError) {
|
|
1120
1149
|
console.error("[webframez-react] Retry for initial HTML failed", retryError);
|
|
@@ -1122,7 +1151,7 @@ function createNodeRequestHandler(options) {
|
|
|
1122
1151
|
initialHtmlWorker.dispose();
|
|
1123
1152
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1124
1153
|
flightData: initialFlightData,
|
|
1125
|
-
moduleMap
|
|
1154
|
+
moduleMap: serverConsumerModuleMap
|
|
1126
1155
|
});
|
|
1127
1156
|
} catch (flightRenderError) {
|
|
1128
1157
|
console.error("[webframez-react] Flight-to-HTML render failed", flightRenderError);
|
package/dist/http.js
CHANGED
|
@@ -916,6 +916,11 @@ function normalizeClientManifest(manifest, options) {
|
|
|
916
916
|
path3.resolve(options.cwd, "node_modules"),
|
|
917
917
|
path3.resolve(options.distRootDir, "..", "..", "node_modules")
|
|
918
918
|
]);
|
|
919
|
+
const addAlias = (aliasKey, value) => {
|
|
920
|
+
if (!(aliasKey in normalized)) {
|
|
921
|
+
normalized[aliasKey] = value;
|
|
922
|
+
}
|
|
923
|
+
};
|
|
919
924
|
for (const [key, value] of Object.entries(manifest)) {
|
|
920
925
|
if (!key.startsWith("file://")) {
|
|
921
926
|
continue;
|
|
@@ -932,16 +937,39 @@ function normalizeClientManifest(manifest, options) {
|
|
|
932
937
|
continue;
|
|
933
938
|
}
|
|
934
939
|
const relativeModulePath = absolutePath.slice(markerIndex + marker.length);
|
|
940
|
+
const relativeModulePathPosix = relativeModulePath.split(path3.sep).join("/");
|
|
941
|
+
addAlias(`./node_modules/${relativeModulePathPosix}`, value);
|
|
942
|
+
addAlias(`node_modules/${relativeModulePathPosix}`, value);
|
|
943
|
+
addAlias(absolutePath, value);
|
|
935
944
|
for (const nodeModulesDir of candidateNodeModulesDirs) {
|
|
936
945
|
const aliasPath = path3.join(nodeModulesDir, relativeModulePath);
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
normalized[aliasKey] = value;
|
|
940
|
-
}
|
|
946
|
+
addAlias(aliasPath, value);
|
|
947
|
+
addAlias(pathToFileURL(aliasPath).href, value);
|
|
941
948
|
}
|
|
942
949
|
}
|
|
943
950
|
return normalized;
|
|
944
951
|
}
|
|
952
|
+
function createServerConsumerManifest(manifest) {
|
|
953
|
+
const consumerManifest = {};
|
|
954
|
+
for (const [key, value] of Object.entries(manifest)) {
|
|
955
|
+
if (!value || typeof value !== "object") {
|
|
956
|
+
continue;
|
|
957
|
+
}
|
|
958
|
+
const entry = value;
|
|
959
|
+
if (typeof entry.id !== "string" || entry.id.trim() === "") {
|
|
960
|
+
continue;
|
|
961
|
+
}
|
|
962
|
+
consumerManifest[key] = {
|
|
963
|
+
"*": {
|
|
964
|
+
id: entry.id,
|
|
965
|
+
chunks: Array.isArray(entry.chunks) ? entry.chunks : [],
|
|
966
|
+
name: entry.name ?? "*",
|
|
967
|
+
...entry.async ? { async: entry.async } : {}
|
|
968
|
+
}
|
|
969
|
+
};
|
|
970
|
+
}
|
|
971
|
+
return consumerManifest;
|
|
972
|
+
}
|
|
945
973
|
function createNodeRequestHandler(options) {
|
|
946
974
|
const devServerId = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
947
975
|
const distRootDir = path3.resolve(options.distRootDir);
|
|
@@ -966,6 +994,7 @@ function createNodeRequestHandler(options) {
|
|
|
966
994
|
cwd: process.cwd()
|
|
967
995
|
}
|
|
968
996
|
);
|
|
997
|
+
const serverConsumerModuleMap = createServerConsumerManifest(moduleMap);
|
|
969
998
|
const initialHtmlWorker = createInitialHtmlWorker(pagesDir);
|
|
970
999
|
const disposeInitialHtmlWorker = () => {
|
|
971
1000
|
initialHtmlWorker.dispose();
|
|
@@ -1081,7 +1110,7 @@ function createNodeRequestHandler(options) {
|
|
|
1081
1110
|
try {
|
|
1082
1111
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1083
1112
|
flightData: initialFlightData,
|
|
1084
|
-
moduleMap
|
|
1113
|
+
moduleMap: serverConsumerModuleMap
|
|
1085
1114
|
});
|
|
1086
1115
|
} catch (error) {
|
|
1087
1116
|
console.error("[webframez-react] Failed to render initial HTML", error);
|
|
@@ -1089,7 +1118,7 @@ function createNodeRequestHandler(options) {
|
|
|
1089
1118
|
initialHtmlWorker.dispose();
|
|
1090
1119
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1091
1120
|
flightData: initialFlightData,
|
|
1092
|
-
moduleMap
|
|
1121
|
+
moduleMap: serverConsumerModuleMap
|
|
1093
1122
|
});
|
|
1094
1123
|
} catch (retryError) {
|
|
1095
1124
|
console.error("[webframez-react] Retry for initial HTML failed", retryError);
|
|
@@ -1097,7 +1126,7 @@ function createNodeRequestHandler(options) {
|
|
|
1097
1126
|
initialHtmlWorker.dispose();
|
|
1098
1127
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1099
1128
|
flightData: initialFlightData,
|
|
1100
|
-
moduleMap
|
|
1129
|
+
moduleMap: serverConsumerModuleMap
|
|
1101
1130
|
});
|
|
1102
1131
|
} catch (flightRenderError) {
|
|
1103
1132
|
console.error("[webframez-react] Flight-to-HTML render failed", flightRenderError);
|
package/dist/index.cjs
CHANGED
|
@@ -978,6 +978,11 @@ function normalizeClientManifest(manifest, options) {
|
|
|
978
978
|
import_node_path3.default.resolve(options.cwd, "node_modules"),
|
|
979
979
|
import_node_path3.default.resolve(options.distRootDir, "..", "..", "node_modules")
|
|
980
980
|
]);
|
|
981
|
+
const addAlias = (aliasKey, value) => {
|
|
982
|
+
if (!(aliasKey in normalized)) {
|
|
983
|
+
normalized[aliasKey] = value;
|
|
984
|
+
}
|
|
985
|
+
};
|
|
981
986
|
for (const [key, value] of Object.entries(manifest)) {
|
|
982
987
|
if (!key.startsWith("file://")) {
|
|
983
988
|
continue;
|
|
@@ -994,16 +999,39 @@ function normalizeClientManifest(manifest, options) {
|
|
|
994
999
|
continue;
|
|
995
1000
|
}
|
|
996
1001
|
const relativeModulePath = absolutePath.slice(markerIndex + marker.length);
|
|
1002
|
+
const relativeModulePathPosix = relativeModulePath.split(import_node_path3.default.sep).join("/");
|
|
1003
|
+
addAlias(`./node_modules/${relativeModulePathPosix}`, value);
|
|
1004
|
+
addAlias(`node_modules/${relativeModulePathPosix}`, value);
|
|
1005
|
+
addAlias(absolutePath, value);
|
|
997
1006
|
for (const nodeModulesDir of candidateNodeModulesDirs) {
|
|
998
1007
|
const aliasPath = import_node_path3.default.join(nodeModulesDir, relativeModulePath);
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
normalized[aliasKey] = value;
|
|
1002
|
-
}
|
|
1008
|
+
addAlias(aliasPath, value);
|
|
1009
|
+
addAlias((0, import_node_url.pathToFileURL)(aliasPath).href, value);
|
|
1003
1010
|
}
|
|
1004
1011
|
}
|
|
1005
1012
|
return normalized;
|
|
1006
1013
|
}
|
|
1014
|
+
function createServerConsumerManifest(manifest) {
|
|
1015
|
+
const consumerManifest = {};
|
|
1016
|
+
for (const [key, value] of Object.entries(manifest)) {
|
|
1017
|
+
if (!value || typeof value !== "object") {
|
|
1018
|
+
continue;
|
|
1019
|
+
}
|
|
1020
|
+
const entry = value;
|
|
1021
|
+
if (typeof entry.id !== "string" || entry.id.trim() === "") {
|
|
1022
|
+
continue;
|
|
1023
|
+
}
|
|
1024
|
+
consumerManifest[key] = {
|
|
1025
|
+
"*": {
|
|
1026
|
+
id: entry.id,
|
|
1027
|
+
chunks: Array.isArray(entry.chunks) ? entry.chunks : [],
|
|
1028
|
+
name: entry.name ?? "*",
|
|
1029
|
+
...entry.async ? { async: entry.async } : {}
|
|
1030
|
+
}
|
|
1031
|
+
};
|
|
1032
|
+
}
|
|
1033
|
+
return consumerManifest;
|
|
1034
|
+
}
|
|
1007
1035
|
function createNodeRequestHandler(options) {
|
|
1008
1036
|
const devServerId = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
1009
1037
|
const distRootDir = import_node_path3.default.resolve(options.distRootDir);
|
|
@@ -1028,6 +1056,7 @@ function createNodeRequestHandler(options) {
|
|
|
1028
1056
|
cwd: process.cwd()
|
|
1029
1057
|
}
|
|
1030
1058
|
);
|
|
1059
|
+
const serverConsumerModuleMap = createServerConsumerManifest(moduleMap);
|
|
1031
1060
|
const initialHtmlWorker = createInitialHtmlWorker(pagesDir);
|
|
1032
1061
|
const disposeInitialHtmlWorker = () => {
|
|
1033
1062
|
initialHtmlWorker.dispose();
|
|
@@ -1143,7 +1172,7 @@ function createNodeRequestHandler(options) {
|
|
|
1143
1172
|
try {
|
|
1144
1173
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1145
1174
|
flightData: initialFlightData,
|
|
1146
|
-
moduleMap
|
|
1175
|
+
moduleMap: serverConsumerModuleMap
|
|
1147
1176
|
});
|
|
1148
1177
|
} catch (error) {
|
|
1149
1178
|
console.error("[webframez-react] Failed to render initial HTML", error);
|
|
@@ -1151,7 +1180,7 @@ function createNodeRequestHandler(options) {
|
|
|
1151
1180
|
initialHtmlWorker.dispose();
|
|
1152
1181
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1153
1182
|
flightData: initialFlightData,
|
|
1154
|
-
moduleMap
|
|
1183
|
+
moduleMap: serverConsumerModuleMap
|
|
1155
1184
|
});
|
|
1156
1185
|
} catch (retryError) {
|
|
1157
1186
|
console.error("[webframez-react] Retry for initial HTML failed", retryError);
|
|
@@ -1159,7 +1188,7 @@ function createNodeRequestHandler(options) {
|
|
|
1159
1188
|
initialHtmlWorker.dispose();
|
|
1160
1189
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1161
1190
|
flightData: initialFlightData,
|
|
1162
|
-
moduleMap
|
|
1191
|
+
moduleMap: serverConsumerModuleMap
|
|
1163
1192
|
});
|
|
1164
1193
|
} catch (flightRenderError) {
|
|
1165
1194
|
console.error("[webframez-react] Flight-to-HTML render failed", flightRenderError);
|
package/dist/index.js
CHANGED
|
@@ -942,6 +942,11 @@ function normalizeClientManifest(manifest, options) {
|
|
|
942
942
|
path3.resolve(options.cwd, "node_modules"),
|
|
943
943
|
path3.resolve(options.distRootDir, "..", "..", "node_modules")
|
|
944
944
|
]);
|
|
945
|
+
const addAlias = (aliasKey, value) => {
|
|
946
|
+
if (!(aliasKey in normalized)) {
|
|
947
|
+
normalized[aliasKey] = value;
|
|
948
|
+
}
|
|
949
|
+
};
|
|
945
950
|
for (const [key, value] of Object.entries(manifest)) {
|
|
946
951
|
if (!key.startsWith("file://")) {
|
|
947
952
|
continue;
|
|
@@ -958,16 +963,39 @@ function normalizeClientManifest(manifest, options) {
|
|
|
958
963
|
continue;
|
|
959
964
|
}
|
|
960
965
|
const relativeModulePath = absolutePath.slice(markerIndex + marker.length);
|
|
966
|
+
const relativeModulePathPosix = relativeModulePath.split(path3.sep).join("/");
|
|
967
|
+
addAlias(`./node_modules/${relativeModulePathPosix}`, value);
|
|
968
|
+
addAlias(`node_modules/${relativeModulePathPosix}`, value);
|
|
969
|
+
addAlias(absolutePath, value);
|
|
961
970
|
for (const nodeModulesDir of candidateNodeModulesDirs) {
|
|
962
971
|
const aliasPath = path3.join(nodeModulesDir, relativeModulePath);
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
normalized[aliasKey] = value;
|
|
966
|
-
}
|
|
972
|
+
addAlias(aliasPath, value);
|
|
973
|
+
addAlias(pathToFileURL(aliasPath).href, value);
|
|
967
974
|
}
|
|
968
975
|
}
|
|
969
976
|
return normalized;
|
|
970
977
|
}
|
|
978
|
+
function createServerConsumerManifest(manifest) {
|
|
979
|
+
const consumerManifest = {};
|
|
980
|
+
for (const [key, value] of Object.entries(manifest)) {
|
|
981
|
+
if (!value || typeof value !== "object") {
|
|
982
|
+
continue;
|
|
983
|
+
}
|
|
984
|
+
const entry = value;
|
|
985
|
+
if (typeof entry.id !== "string" || entry.id.trim() === "") {
|
|
986
|
+
continue;
|
|
987
|
+
}
|
|
988
|
+
consumerManifest[key] = {
|
|
989
|
+
"*": {
|
|
990
|
+
id: entry.id,
|
|
991
|
+
chunks: Array.isArray(entry.chunks) ? entry.chunks : [],
|
|
992
|
+
name: entry.name ?? "*",
|
|
993
|
+
...entry.async ? { async: entry.async } : {}
|
|
994
|
+
}
|
|
995
|
+
};
|
|
996
|
+
}
|
|
997
|
+
return consumerManifest;
|
|
998
|
+
}
|
|
971
999
|
function createNodeRequestHandler(options) {
|
|
972
1000
|
const devServerId = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
973
1001
|
const distRootDir = path3.resolve(options.distRootDir);
|
|
@@ -992,6 +1020,7 @@ function createNodeRequestHandler(options) {
|
|
|
992
1020
|
cwd: process.cwd()
|
|
993
1021
|
}
|
|
994
1022
|
);
|
|
1023
|
+
const serverConsumerModuleMap = createServerConsumerManifest(moduleMap);
|
|
995
1024
|
const initialHtmlWorker = createInitialHtmlWorker(pagesDir);
|
|
996
1025
|
const disposeInitialHtmlWorker = () => {
|
|
997
1026
|
initialHtmlWorker.dispose();
|
|
@@ -1107,7 +1136,7 @@ function createNodeRequestHandler(options) {
|
|
|
1107
1136
|
try {
|
|
1108
1137
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1109
1138
|
flightData: initialFlightData,
|
|
1110
|
-
moduleMap
|
|
1139
|
+
moduleMap: serverConsumerModuleMap
|
|
1111
1140
|
});
|
|
1112
1141
|
} catch (error) {
|
|
1113
1142
|
console.error("[webframez-react] Failed to render initial HTML", error);
|
|
@@ -1115,7 +1144,7 @@ function createNodeRequestHandler(options) {
|
|
|
1115
1144
|
initialHtmlWorker.dispose();
|
|
1116
1145
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1117
1146
|
flightData: initialFlightData,
|
|
1118
|
-
moduleMap
|
|
1147
|
+
moduleMap: serverConsumerModuleMap
|
|
1119
1148
|
});
|
|
1120
1149
|
} catch (retryError) {
|
|
1121
1150
|
console.error("[webframez-react] Retry for initial HTML failed", retryError);
|
|
@@ -1123,7 +1152,7 @@ function createNodeRequestHandler(options) {
|
|
|
1123
1152
|
initialHtmlWorker.dispose();
|
|
1124
1153
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1125
1154
|
flightData: initialFlightData,
|
|
1126
|
-
moduleMap
|
|
1155
|
+
moduleMap: serverConsumerModuleMap
|
|
1127
1156
|
});
|
|
1128
1157
|
} catch (flightRenderError) {
|
|
1129
1158
|
console.error("[webframez-react] Flight-to-HTML render failed", flightRenderError);
|
package/dist/webframez-core.cjs
CHANGED
|
@@ -944,6 +944,11 @@ function normalizeClientManifest(manifest, options) {
|
|
|
944
944
|
import_node_path3.default.resolve(options.cwd, "node_modules"),
|
|
945
945
|
import_node_path3.default.resolve(options.distRootDir, "..", "..", "node_modules")
|
|
946
946
|
]);
|
|
947
|
+
const addAlias = (aliasKey, value) => {
|
|
948
|
+
if (!(aliasKey in normalized)) {
|
|
949
|
+
normalized[aliasKey] = value;
|
|
950
|
+
}
|
|
951
|
+
};
|
|
947
952
|
for (const [key, value] of Object.entries(manifest)) {
|
|
948
953
|
if (!key.startsWith("file://")) {
|
|
949
954
|
continue;
|
|
@@ -960,16 +965,39 @@ function normalizeClientManifest(manifest, options) {
|
|
|
960
965
|
continue;
|
|
961
966
|
}
|
|
962
967
|
const relativeModulePath = absolutePath.slice(markerIndex + marker.length);
|
|
968
|
+
const relativeModulePathPosix = relativeModulePath.split(import_node_path3.default.sep).join("/");
|
|
969
|
+
addAlias(`./node_modules/${relativeModulePathPosix}`, value);
|
|
970
|
+
addAlias(`node_modules/${relativeModulePathPosix}`, value);
|
|
971
|
+
addAlias(absolutePath, value);
|
|
963
972
|
for (const nodeModulesDir of candidateNodeModulesDirs) {
|
|
964
973
|
const aliasPath = import_node_path3.default.join(nodeModulesDir, relativeModulePath);
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
normalized[aliasKey] = value;
|
|
968
|
-
}
|
|
974
|
+
addAlias(aliasPath, value);
|
|
975
|
+
addAlias((0, import_node_url.pathToFileURL)(aliasPath).href, value);
|
|
969
976
|
}
|
|
970
977
|
}
|
|
971
978
|
return normalized;
|
|
972
979
|
}
|
|
980
|
+
function createServerConsumerManifest(manifest) {
|
|
981
|
+
const consumerManifest = {};
|
|
982
|
+
for (const [key, value] of Object.entries(manifest)) {
|
|
983
|
+
if (!value || typeof value !== "object") {
|
|
984
|
+
continue;
|
|
985
|
+
}
|
|
986
|
+
const entry = value;
|
|
987
|
+
if (typeof entry.id !== "string" || entry.id.trim() === "") {
|
|
988
|
+
continue;
|
|
989
|
+
}
|
|
990
|
+
consumerManifest[key] = {
|
|
991
|
+
"*": {
|
|
992
|
+
id: entry.id,
|
|
993
|
+
chunks: Array.isArray(entry.chunks) ? entry.chunks : [],
|
|
994
|
+
name: entry.name ?? "*",
|
|
995
|
+
...entry.async ? { async: entry.async } : {}
|
|
996
|
+
}
|
|
997
|
+
};
|
|
998
|
+
}
|
|
999
|
+
return consumerManifest;
|
|
1000
|
+
}
|
|
973
1001
|
function createNodeRequestHandler(options) {
|
|
974
1002
|
const devServerId = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
975
1003
|
const distRootDir = import_node_path3.default.resolve(options.distRootDir);
|
|
@@ -994,6 +1022,7 @@ function createNodeRequestHandler(options) {
|
|
|
994
1022
|
cwd: process.cwd()
|
|
995
1023
|
}
|
|
996
1024
|
);
|
|
1025
|
+
const serverConsumerModuleMap = createServerConsumerManifest(moduleMap);
|
|
997
1026
|
const initialHtmlWorker = createInitialHtmlWorker(pagesDir);
|
|
998
1027
|
const disposeInitialHtmlWorker = () => {
|
|
999
1028
|
initialHtmlWorker.dispose();
|
|
@@ -1109,7 +1138,7 @@ function createNodeRequestHandler(options) {
|
|
|
1109
1138
|
try {
|
|
1110
1139
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1111
1140
|
flightData: initialFlightData,
|
|
1112
|
-
moduleMap
|
|
1141
|
+
moduleMap: serverConsumerModuleMap
|
|
1113
1142
|
});
|
|
1114
1143
|
} catch (error) {
|
|
1115
1144
|
console.error("[webframez-react] Failed to render initial HTML", error);
|
|
@@ -1117,7 +1146,7 @@ function createNodeRequestHandler(options) {
|
|
|
1117
1146
|
initialHtmlWorker.dispose();
|
|
1118
1147
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1119
1148
|
flightData: initialFlightData,
|
|
1120
|
-
moduleMap
|
|
1149
|
+
moduleMap: serverConsumerModuleMap
|
|
1121
1150
|
});
|
|
1122
1151
|
} catch (retryError) {
|
|
1123
1152
|
console.error("[webframez-react] Retry for initial HTML failed", retryError);
|
|
@@ -1125,7 +1154,7 @@ function createNodeRequestHandler(options) {
|
|
|
1125
1154
|
initialHtmlWorker.dispose();
|
|
1126
1155
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1127
1156
|
flightData: initialFlightData,
|
|
1128
|
-
moduleMap
|
|
1157
|
+
moduleMap: serverConsumerModuleMap
|
|
1129
1158
|
});
|
|
1130
1159
|
} catch (flightRenderError) {
|
|
1131
1160
|
console.error("[webframez-react] Flight-to-HTML render failed", flightRenderError);
|
package/dist/webframez-core.js
CHANGED
|
@@ -916,6 +916,11 @@ function normalizeClientManifest(manifest, options) {
|
|
|
916
916
|
path3.resolve(options.cwd, "node_modules"),
|
|
917
917
|
path3.resolve(options.distRootDir, "..", "..", "node_modules")
|
|
918
918
|
]);
|
|
919
|
+
const addAlias = (aliasKey, value) => {
|
|
920
|
+
if (!(aliasKey in normalized)) {
|
|
921
|
+
normalized[aliasKey] = value;
|
|
922
|
+
}
|
|
923
|
+
};
|
|
919
924
|
for (const [key, value] of Object.entries(manifest)) {
|
|
920
925
|
if (!key.startsWith("file://")) {
|
|
921
926
|
continue;
|
|
@@ -932,16 +937,39 @@ function normalizeClientManifest(manifest, options) {
|
|
|
932
937
|
continue;
|
|
933
938
|
}
|
|
934
939
|
const relativeModulePath = absolutePath.slice(markerIndex + marker.length);
|
|
940
|
+
const relativeModulePathPosix = relativeModulePath.split(path3.sep).join("/");
|
|
941
|
+
addAlias(`./node_modules/${relativeModulePathPosix}`, value);
|
|
942
|
+
addAlias(`node_modules/${relativeModulePathPosix}`, value);
|
|
943
|
+
addAlias(absolutePath, value);
|
|
935
944
|
for (const nodeModulesDir of candidateNodeModulesDirs) {
|
|
936
945
|
const aliasPath = path3.join(nodeModulesDir, relativeModulePath);
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
normalized[aliasKey] = value;
|
|
940
|
-
}
|
|
946
|
+
addAlias(aliasPath, value);
|
|
947
|
+
addAlias(pathToFileURL(aliasPath).href, value);
|
|
941
948
|
}
|
|
942
949
|
}
|
|
943
950
|
return normalized;
|
|
944
951
|
}
|
|
952
|
+
function createServerConsumerManifest(manifest) {
|
|
953
|
+
const consumerManifest = {};
|
|
954
|
+
for (const [key, value] of Object.entries(manifest)) {
|
|
955
|
+
if (!value || typeof value !== "object") {
|
|
956
|
+
continue;
|
|
957
|
+
}
|
|
958
|
+
const entry = value;
|
|
959
|
+
if (typeof entry.id !== "string" || entry.id.trim() === "") {
|
|
960
|
+
continue;
|
|
961
|
+
}
|
|
962
|
+
consumerManifest[key] = {
|
|
963
|
+
"*": {
|
|
964
|
+
id: entry.id,
|
|
965
|
+
chunks: Array.isArray(entry.chunks) ? entry.chunks : [],
|
|
966
|
+
name: entry.name ?? "*",
|
|
967
|
+
...entry.async ? { async: entry.async } : {}
|
|
968
|
+
}
|
|
969
|
+
};
|
|
970
|
+
}
|
|
971
|
+
return consumerManifest;
|
|
972
|
+
}
|
|
945
973
|
function createNodeRequestHandler(options) {
|
|
946
974
|
const devServerId = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
947
975
|
const distRootDir = path3.resolve(options.distRootDir);
|
|
@@ -966,6 +994,7 @@ function createNodeRequestHandler(options) {
|
|
|
966
994
|
cwd: process.cwd()
|
|
967
995
|
}
|
|
968
996
|
);
|
|
997
|
+
const serverConsumerModuleMap = createServerConsumerManifest(moduleMap);
|
|
969
998
|
const initialHtmlWorker = createInitialHtmlWorker(pagesDir);
|
|
970
999
|
const disposeInitialHtmlWorker = () => {
|
|
971
1000
|
initialHtmlWorker.dispose();
|
|
@@ -1081,7 +1110,7 @@ function createNodeRequestHandler(options) {
|
|
|
1081
1110
|
try {
|
|
1082
1111
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1083
1112
|
flightData: initialFlightData,
|
|
1084
|
-
moduleMap
|
|
1113
|
+
moduleMap: serverConsumerModuleMap
|
|
1085
1114
|
});
|
|
1086
1115
|
} catch (error) {
|
|
1087
1116
|
console.error("[webframez-react] Failed to render initial HTML", error);
|
|
@@ -1089,7 +1118,7 @@ function createNodeRequestHandler(options) {
|
|
|
1089
1118
|
initialHtmlWorker.dispose();
|
|
1090
1119
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1091
1120
|
flightData: initialFlightData,
|
|
1092
|
-
moduleMap
|
|
1121
|
+
moduleMap: serverConsumerModuleMap
|
|
1093
1122
|
});
|
|
1094
1123
|
} catch (retryError) {
|
|
1095
1124
|
console.error("[webframez-react] Retry for initial HTML failed", retryError);
|
|
@@ -1097,7 +1126,7 @@ function createNodeRequestHandler(options) {
|
|
|
1097
1126
|
initialHtmlWorker.dispose();
|
|
1098
1127
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1099
1128
|
flightData: initialFlightData,
|
|
1100
|
-
moduleMap
|
|
1129
|
+
moduleMap: serverConsumerModuleMap
|
|
1101
1130
|
});
|
|
1102
1131
|
} catch (flightRenderError) {
|
|
1103
1132
|
console.error("[webframez-react] Flight-to-HTML render failed", flightRenderError);
|