@webtypen/webframez-react 0.0.20 → 0.0.22
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 +39 -3
- package/dist/http.js +39 -3
- package/dist/index.cjs +39 -3
- package/dist/index.js +39 -3
- package/dist/webframez-core.cjs +39 -3
- package/dist/webframez-core.js +39 -3
- package/package.json +1 -1
package/dist/http.cjs
CHANGED
|
@@ -677,6 +677,20 @@ const reactDomPkg = require.resolve("react-dom/package.json", {
|
|
|
677
677
|
paths: [process.cwd()]
|
|
678
678
|
});
|
|
679
679
|
const reactDomServer = require(path.join(path.dirname(reactDomPkg), "server.node.js"));
|
|
680
|
+
globalThis.__webpack_chunk_load__ = function __webframezNoopChunkLoad() {
|
|
681
|
+
return Promise.resolve();
|
|
682
|
+
};
|
|
683
|
+
globalThis.__webpack_require__ = function __webframezNodeRequire(id) {
|
|
684
|
+
if (typeof id !== "string") {
|
|
685
|
+
return require(id);
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
if (id.startsWith("./")) {
|
|
689
|
+
return require(path.resolve(process.cwd(), id.slice(2)));
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
return require(id);
|
|
693
|
+
};
|
|
680
694
|
|
|
681
695
|
function renderHtml(model) {
|
|
682
696
|
return new Promise((resolve, reject) => {
|
|
@@ -974,6 +988,27 @@ function normalizeClientManifest(manifest, options) {
|
|
|
974
988
|
}
|
|
975
989
|
return normalized;
|
|
976
990
|
}
|
|
991
|
+
function createServerConsumerManifest(manifest) {
|
|
992
|
+
const consumerManifest = {};
|
|
993
|
+
for (const [key, value] of Object.entries(manifest)) {
|
|
994
|
+
if (!value || typeof value !== "object") {
|
|
995
|
+
continue;
|
|
996
|
+
}
|
|
997
|
+
const entry = value;
|
|
998
|
+
if (typeof entry.id !== "string" || entry.id.trim() === "") {
|
|
999
|
+
continue;
|
|
1000
|
+
}
|
|
1001
|
+
consumerManifest[key] = {
|
|
1002
|
+
"*": {
|
|
1003
|
+
id: entry.id,
|
|
1004
|
+
chunks: [],
|
|
1005
|
+
name: entry.name ?? "*",
|
|
1006
|
+
...entry.async ? { async: entry.async } : {}
|
|
1007
|
+
}
|
|
1008
|
+
};
|
|
1009
|
+
}
|
|
1010
|
+
return consumerManifest;
|
|
1011
|
+
}
|
|
977
1012
|
function createNodeRequestHandler(options) {
|
|
978
1013
|
const devServerId = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
979
1014
|
const distRootDir = import_node_path3.default.resolve(options.distRootDir);
|
|
@@ -998,6 +1033,7 @@ function createNodeRequestHandler(options) {
|
|
|
998
1033
|
cwd: process.cwd()
|
|
999
1034
|
}
|
|
1000
1035
|
);
|
|
1036
|
+
const serverConsumerModuleMap = createServerConsumerManifest(moduleMap);
|
|
1001
1037
|
const initialHtmlWorker = createInitialHtmlWorker(pagesDir);
|
|
1002
1038
|
const disposeInitialHtmlWorker = () => {
|
|
1003
1039
|
initialHtmlWorker.dispose();
|
|
@@ -1113,7 +1149,7 @@ function createNodeRequestHandler(options) {
|
|
|
1113
1149
|
try {
|
|
1114
1150
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1115
1151
|
flightData: initialFlightData,
|
|
1116
|
-
moduleMap
|
|
1152
|
+
moduleMap: serverConsumerModuleMap
|
|
1117
1153
|
});
|
|
1118
1154
|
} catch (error) {
|
|
1119
1155
|
console.error("[webframez-react] Failed to render initial HTML", error);
|
|
@@ -1121,7 +1157,7 @@ function createNodeRequestHandler(options) {
|
|
|
1121
1157
|
initialHtmlWorker.dispose();
|
|
1122
1158
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1123
1159
|
flightData: initialFlightData,
|
|
1124
|
-
moduleMap
|
|
1160
|
+
moduleMap: serverConsumerModuleMap
|
|
1125
1161
|
});
|
|
1126
1162
|
} catch (retryError) {
|
|
1127
1163
|
console.error("[webframez-react] Retry for initial HTML failed", retryError);
|
|
@@ -1129,7 +1165,7 @@ function createNodeRequestHandler(options) {
|
|
|
1129
1165
|
initialHtmlWorker.dispose();
|
|
1130
1166
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1131
1167
|
flightData: initialFlightData,
|
|
1132
|
-
moduleMap
|
|
1168
|
+
moduleMap: serverConsumerModuleMap
|
|
1133
1169
|
});
|
|
1134
1170
|
} catch (flightRenderError) {
|
|
1135
1171
|
console.error("[webframez-react] Flight-to-HTML render failed", flightRenderError);
|
package/dist/http.js
CHANGED
|
@@ -652,6 +652,20 @@ const reactDomPkg = require.resolve("react-dom/package.json", {
|
|
|
652
652
|
paths: [process.cwd()]
|
|
653
653
|
});
|
|
654
654
|
const reactDomServer = require(path.join(path.dirname(reactDomPkg), "server.node.js"));
|
|
655
|
+
globalThis.__webpack_chunk_load__ = function __webframezNoopChunkLoad() {
|
|
656
|
+
return Promise.resolve();
|
|
657
|
+
};
|
|
658
|
+
globalThis.__webpack_require__ = function __webframezNodeRequire(id) {
|
|
659
|
+
if (typeof id !== "string") {
|
|
660
|
+
return require(id);
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
if (id.startsWith("./")) {
|
|
664
|
+
return require(path.resolve(process.cwd(), id.slice(2)));
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
return require(id);
|
|
668
|
+
};
|
|
655
669
|
|
|
656
670
|
function renderHtml(model) {
|
|
657
671
|
return new Promise((resolve, reject) => {
|
|
@@ -949,6 +963,27 @@ function normalizeClientManifest(manifest, options) {
|
|
|
949
963
|
}
|
|
950
964
|
return normalized;
|
|
951
965
|
}
|
|
966
|
+
function createServerConsumerManifest(manifest) {
|
|
967
|
+
const consumerManifest = {};
|
|
968
|
+
for (const [key, value] of Object.entries(manifest)) {
|
|
969
|
+
if (!value || typeof value !== "object") {
|
|
970
|
+
continue;
|
|
971
|
+
}
|
|
972
|
+
const entry = value;
|
|
973
|
+
if (typeof entry.id !== "string" || entry.id.trim() === "") {
|
|
974
|
+
continue;
|
|
975
|
+
}
|
|
976
|
+
consumerManifest[key] = {
|
|
977
|
+
"*": {
|
|
978
|
+
id: entry.id,
|
|
979
|
+
chunks: [],
|
|
980
|
+
name: entry.name ?? "*",
|
|
981
|
+
...entry.async ? { async: entry.async } : {}
|
|
982
|
+
}
|
|
983
|
+
};
|
|
984
|
+
}
|
|
985
|
+
return consumerManifest;
|
|
986
|
+
}
|
|
952
987
|
function createNodeRequestHandler(options) {
|
|
953
988
|
const devServerId = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
954
989
|
const distRootDir = path3.resolve(options.distRootDir);
|
|
@@ -973,6 +1008,7 @@ function createNodeRequestHandler(options) {
|
|
|
973
1008
|
cwd: process.cwd()
|
|
974
1009
|
}
|
|
975
1010
|
);
|
|
1011
|
+
const serverConsumerModuleMap = createServerConsumerManifest(moduleMap);
|
|
976
1012
|
const initialHtmlWorker = createInitialHtmlWorker(pagesDir);
|
|
977
1013
|
const disposeInitialHtmlWorker = () => {
|
|
978
1014
|
initialHtmlWorker.dispose();
|
|
@@ -1088,7 +1124,7 @@ function createNodeRequestHandler(options) {
|
|
|
1088
1124
|
try {
|
|
1089
1125
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1090
1126
|
flightData: initialFlightData,
|
|
1091
|
-
moduleMap
|
|
1127
|
+
moduleMap: serverConsumerModuleMap
|
|
1092
1128
|
});
|
|
1093
1129
|
} catch (error) {
|
|
1094
1130
|
console.error("[webframez-react] Failed to render initial HTML", error);
|
|
@@ -1096,7 +1132,7 @@ function createNodeRequestHandler(options) {
|
|
|
1096
1132
|
initialHtmlWorker.dispose();
|
|
1097
1133
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1098
1134
|
flightData: initialFlightData,
|
|
1099
|
-
moduleMap
|
|
1135
|
+
moduleMap: serverConsumerModuleMap
|
|
1100
1136
|
});
|
|
1101
1137
|
} catch (retryError) {
|
|
1102
1138
|
console.error("[webframez-react] Retry for initial HTML failed", retryError);
|
|
@@ -1104,7 +1140,7 @@ function createNodeRequestHandler(options) {
|
|
|
1104
1140
|
initialHtmlWorker.dispose();
|
|
1105
1141
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1106
1142
|
flightData: initialFlightData,
|
|
1107
|
-
moduleMap
|
|
1143
|
+
moduleMap: serverConsumerModuleMap
|
|
1108
1144
|
});
|
|
1109
1145
|
} catch (flightRenderError) {
|
|
1110
1146
|
console.error("[webframez-react] Flight-to-HTML render failed", flightRenderError);
|
package/dist/index.cjs
CHANGED
|
@@ -714,6 +714,20 @@ const reactDomPkg = require.resolve("react-dom/package.json", {
|
|
|
714
714
|
paths: [process.cwd()]
|
|
715
715
|
});
|
|
716
716
|
const reactDomServer = require(path.join(path.dirname(reactDomPkg), "server.node.js"));
|
|
717
|
+
globalThis.__webpack_chunk_load__ = function __webframezNoopChunkLoad() {
|
|
718
|
+
return Promise.resolve();
|
|
719
|
+
};
|
|
720
|
+
globalThis.__webpack_require__ = function __webframezNodeRequire(id) {
|
|
721
|
+
if (typeof id !== "string") {
|
|
722
|
+
return require(id);
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
if (id.startsWith("./")) {
|
|
726
|
+
return require(path.resolve(process.cwd(), id.slice(2)));
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
return require(id);
|
|
730
|
+
};
|
|
717
731
|
|
|
718
732
|
function renderHtml(model) {
|
|
719
733
|
return new Promise((resolve, reject) => {
|
|
@@ -1011,6 +1025,27 @@ function normalizeClientManifest(manifest, options) {
|
|
|
1011
1025
|
}
|
|
1012
1026
|
return normalized;
|
|
1013
1027
|
}
|
|
1028
|
+
function createServerConsumerManifest(manifest) {
|
|
1029
|
+
const consumerManifest = {};
|
|
1030
|
+
for (const [key, value] of Object.entries(manifest)) {
|
|
1031
|
+
if (!value || typeof value !== "object") {
|
|
1032
|
+
continue;
|
|
1033
|
+
}
|
|
1034
|
+
const entry = value;
|
|
1035
|
+
if (typeof entry.id !== "string" || entry.id.trim() === "") {
|
|
1036
|
+
continue;
|
|
1037
|
+
}
|
|
1038
|
+
consumerManifest[key] = {
|
|
1039
|
+
"*": {
|
|
1040
|
+
id: entry.id,
|
|
1041
|
+
chunks: [],
|
|
1042
|
+
name: entry.name ?? "*",
|
|
1043
|
+
...entry.async ? { async: entry.async } : {}
|
|
1044
|
+
}
|
|
1045
|
+
};
|
|
1046
|
+
}
|
|
1047
|
+
return consumerManifest;
|
|
1048
|
+
}
|
|
1014
1049
|
function createNodeRequestHandler(options) {
|
|
1015
1050
|
const devServerId = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
1016
1051
|
const distRootDir = import_node_path3.default.resolve(options.distRootDir);
|
|
@@ -1035,6 +1070,7 @@ function createNodeRequestHandler(options) {
|
|
|
1035
1070
|
cwd: process.cwd()
|
|
1036
1071
|
}
|
|
1037
1072
|
);
|
|
1073
|
+
const serverConsumerModuleMap = createServerConsumerManifest(moduleMap);
|
|
1038
1074
|
const initialHtmlWorker = createInitialHtmlWorker(pagesDir);
|
|
1039
1075
|
const disposeInitialHtmlWorker = () => {
|
|
1040
1076
|
initialHtmlWorker.dispose();
|
|
@@ -1150,7 +1186,7 @@ function createNodeRequestHandler(options) {
|
|
|
1150
1186
|
try {
|
|
1151
1187
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1152
1188
|
flightData: initialFlightData,
|
|
1153
|
-
moduleMap
|
|
1189
|
+
moduleMap: serverConsumerModuleMap
|
|
1154
1190
|
});
|
|
1155
1191
|
} catch (error) {
|
|
1156
1192
|
console.error("[webframez-react] Failed to render initial HTML", error);
|
|
@@ -1158,7 +1194,7 @@ function createNodeRequestHandler(options) {
|
|
|
1158
1194
|
initialHtmlWorker.dispose();
|
|
1159
1195
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1160
1196
|
flightData: initialFlightData,
|
|
1161
|
-
moduleMap
|
|
1197
|
+
moduleMap: serverConsumerModuleMap
|
|
1162
1198
|
});
|
|
1163
1199
|
} catch (retryError) {
|
|
1164
1200
|
console.error("[webframez-react] Retry for initial HTML failed", retryError);
|
|
@@ -1166,7 +1202,7 @@ function createNodeRequestHandler(options) {
|
|
|
1166
1202
|
initialHtmlWorker.dispose();
|
|
1167
1203
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1168
1204
|
flightData: initialFlightData,
|
|
1169
|
-
moduleMap
|
|
1205
|
+
moduleMap: serverConsumerModuleMap
|
|
1170
1206
|
});
|
|
1171
1207
|
} catch (flightRenderError) {
|
|
1172
1208
|
console.error("[webframez-react] Flight-to-HTML render failed", flightRenderError);
|
package/dist/index.js
CHANGED
|
@@ -678,6 +678,20 @@ const reactDomPkg = require.resolve("react-dom/package.json", {
|
|
|
678
678
|
paths: [process.cwd()]
|
|
679
679
|
});
|
|
680
680
|
const reactDomServer = require(path.join(path.dirname(reactDomPkg), "server.node.js"));
|
|
681
|
+
globalThis.__webpack_chunk_load__ = function __webframezNoopChunkLoad() {
|
|
682
|
+
return Promise.resolve();
|
|
683
|
+
};
|
|
684
|
+
globalThis.__webpack_require__ = function __webframezNodeRequire(id) {
|
|
685
|
+
if (typeof id !== "string") {
|
|
686
|
+
return require(id);
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
if (id.startsWith("./")) {
|
|
690
|
+
return require(path.resolve(process.cwd(), id.slice(2)));
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
return require(id);
|
|
694
|
+
};
|
|
681
695
|
|
|
682
696
|
function renderHtml(model) {
|
|
683
697
|
return new Promise((resolve, reject) => {
|
|
@@ -975,6 +989,27 @@ function normalizeClientManifest(manifest, options) {
|
|
|
975
989
|
}
|
|
976
990
|
return normalized;
|
|
977
991
|
}
|
|
992
|
+
function createServerConsumerManifest(manifest) {
|
|
993
|
+
const consumerManifest = {};
|
|
994
|
+
for (const [key, value] of Object.entries(manifest)) {
|
|
995
|
+
if (!value || typeof value !== "object") {
|
|
996
|
+
continue;
|
|
997
|
+
}
|
|
998
|
+
const entry = value;
|
|
999
|
+
if (typeof entry.id !== "string" || entry.id.trim() === "") {
|
|
1000
|
+
continue;
|
|
1001
|
+
}
|
|
1002
|
+
consumerManifest[key] = {
|
|
1003
|
+
"*": {
|
|
1004
|
+
id: entry.id,
|
|
1005
|
+
chunks: [],
|
|
1006
|
+
name: entry.name ?? "*",
|
|
1007
|
+
...entry.async ? { async: entry.async } : {}
|
|
1008
|
+
}
|
|
1009
|
+
};
|
|
1010
|
+
}
|
|
1011
|
+
return consumerManifest;
|
|
1012
|
+
}
|
|
978
1013
|
function createNodeRequestHandler(options) {
|
|
979
1014
|
const devServerId = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
980
1015
|
const distRootDir = path3.resolve(options.distRootDir);
|
|
@@ -999,6 +1034,7 @@ function createNodeRequestHandler(options) {
|
|
|
999
1034
|
cwd: process.cwd()
|
|
1000
1035
|
}
|
|
1001
1036
|
);
|
|
1037
|
+
const serverConsumerModuleMap = createServerConsumerManifest(moduleMap);
|
|
1002
1038
|
const initialHtmlWorker = createInitialHtmlWorker(pagesDir);
|
|
1003
1039
|
const disposeInitialHtmlWorker = () => {
|
|
1004
1040
|
initialHtmlWorker.dispose();
|
|
@@ -1114,7 +1150,7 @@ function createNodeRequestHandler(options) {
|
|
|
1114
1150
|
try {
|
|
1115
1151
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1116
1152
|
flightData: initialFlightData,
|
|
1117
|
-
moduleMap
|
|
1153
|
+
moduleMap: serverConsumerModuleMap
|
|
1118
1154
|
});
|
|
1119
1155
|
} catch (error) {
|
|
1120
1156
|
console.error("[webframez-react] Failed to render initial HTML", error);
|
|
@@ -1122,7 +1158,7 @@ function createNodeRequestHandler(options) {
|
|
|
1122
1158
|
initialHtmlWorker.dispose();
|
|
1123
1159
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1124
1160
|
flightData: initialFlightData,
|
|
1125
|
-
moduleMap
|
|
1161
|
+
moduleMap: serverConsumerModuleMap
|
|
1126
1162
|
});
|
|
1127
1163
|
} catch (retryError) {
|
|
1128
1164
|
console.error("[webframez-react] Retry for initial HTML failed", retryError);
|
|
@@ -1130,7 +1166,7 @@ function createNodeRequestHandler(options) {
|
|
|
1130
1166
|
initialHtmlWorker.dispose();
|
|
1131
1167
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1132
1168
|
flightData: initialFlightData,
|
|
1133
|
-
moduleMap
|
|
1169
|
+
moduleMap: serverConsumerModuleMap
|
|
1134
1170
|
});
|
|
1135
1171
|
} catch (flightRenderError) {
|
|
1136
1172
|
console.error("[webframez-react] Flight-to-HTML render failed", flightRenderError);
|
package/dist/webframez-core.cjs
CHANGED
|
@@ -680,6 +680,20 @@ const reactDomPkg = require.resolve("react-dom/package.json", {
|
|
|
680
680
|
paths: [process.cwd()]
|
|
681
681
|
});
|
|
682
682
|
const reactDomServer = require(path.join(path.dirname(reactDomPkg), "server.node.js"));
|
|
683
|
+
globalThis.__webpack_chunk_load__ = function __webframezNoopChunkLoad() {
|
|
684
|
+
return Promise.resolve();
|
|
685
|
+
};
|
|
686
|
+
globalThis.__webpack_require__ = function __webframezNodeRequire(id) {
|
|
687
|
+
if (typeof id !== "string") {
|
|
688
|
+
return require(id);
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
if (id.startsWith("./")) {
|
|
692
|
+
return require(path.resolve(process.cwd(), id.slice(2)));
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
return require(id);
|
|
696
|
+
};
|
|
683
697
|
|
|
684
698
|
function renderHtml(model) {
|
|
685
699
|
return new Promise((resolve, reject) => {
|
|
@@ -977,6 +991,27 @@ function normalizeClientManifest(manifest, options) {
|
|
|
977
991
|
}
|
|
978
992
|
return normalized;
|
|
979
993
|
}
|
|
994
|
+
function createServerConsumerManifest(manifest) {
|
|
995
|
+
const consumerManifest = {};
|
|
996
|
+
for (const [key, value] of Object.entries(manifest)) {
|
|
997
|
+
if (!value || typeof value !== "object") {
|
|
998
|
+
continue;
|
|
999
|
+
}
|
|
1000
|
+
const entry = value;
|
|
1001
|
+
if (typeof entry.id !== "string" || entry.id.trim() === "") {
|
|
1002
|
+
continue;
|
|
1003
|
+
}
|
|
1004
|
+
consumerManifest[key] = {
|
|
1005
|
+
"*": {
|
|
1006
|
+
id: entry.id,
|
|
1007
|
+
chunks: [],
|
|
1008
|
+
name: entry.name ?? "*",
|
|
1009
|
+
...entry.async ? { async: entry.async } : {}
|
|
1010
|
+
}
|
|
1011
|
+
};
|
|
1012
|
+
}
|
|
1013
|
+
return consumerManifest;
|
|
1014
|
+
}
|
|
980
1015
|
function createNodeRequestHandler(options) {
|
|
981
1016
|
const devServerId = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
982
1017
|
const distRootDir = import_node_path3.default.resolve(options.distRootDir);
|
|
@@ -1001,6 +1036,7 @@ function createNodeRequestHandler(options) {
|
|
|
1001
1036
|
cwd: process.cwd()
|
|
1002
1037
|
}
|
|
1003
1038
|
);
|
|
1039
|
+
const serverConsumerModuleMap = createServerConsumerManifest(moduleMap);
|
|
1004
1040
|
const initialHtmlWorker = createInitialHtmlWorker(pagesDir);
|
|
1005
1041
|
const disposeInitialHtmlWorker = () => {
|
|
1006
1042
|
initialHtmlWorker.dispose();
|
|
@@ -1116,7 +1152,7 @@ function createNodeRequestHandler(options) {
|
|
|
1116
1152
|
try {
|
|
1117
1153
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1118
1154
|
flightData: initialFlightData,
|
|
1119
|
-
moduleMap
|
|
1155
|
+
moduleMap: serverConsumerModuleMap
|
|
1120
1156
|
});
|
|
1121
1157
|
} catch (error) {
|
|
1122
1158
|
console.error("[webframez-react] Failed to render initial HTML", error);
|
|
@@ -1124,7 +1160,7 @@ function createNodeRequestHandler(options) {
|
|
|
1124
1160
|
initialHtmlWorker.dispose();
|
|
1125
1161
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1126
1162
|
flightData: initialFlightData,
|
|
1127
|
-
moduleMap
|
|
1163
|
+
moduleMap: serverConsumerModuleMap
|
|
1128
1164
|
});
|
|
1129
1165
|
} catch (retryError) {
|
|
1130
1166
|
console.error("[webframez-react] Retry for initial HTML failed", retryError);
|
|
@@ -1132,7 +1168,7 @@ function createNodeRequestHandler(options) {
|
|
|
1132
1168
|
initialHtmlWorker.dispose();
|
|
1133
1169
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1134
1170
|
flightData: initialFlightData,
|
|
1135
|
-
moduleMap
|
|
1171
|
+
moduleMap: serverConsumerModuleMap
|
|
1136
1172
|
});
|
|
1137
1173
|
} catch (flightRenderError) {
|
|
1138
1174
|
console.error("[webframez-react] Flight-to-HTML render failed", flightRenderError);
|
package/dist/webframez-core.js
CHANGED
|
@@ -652,6 +652,20 @@ const reactDomPkg = require.resolve("react-dom/package.json", {
|
|
|
652
652
|
paths: [process.cwd()]
|
|
653
653
|
});
|
|
654
654
|
const reactDomServer = require(path.join(path.dirname(reactDomPkg), "server.node.js"));
|
|
655
|
+
globalThis.__webpack_chunk_load__ = function __webframezNoopChunkLoad() {
|
|
656
|
+
return Promise.resolve();
|
|
657
|
+
};
|
|
658
|
+
globalThis.__webpack_require__ = function __webframezNodeRequire(id) {
|
|
659
|
+
if (typeof id !== "string") {
|
|
660
|
+
return require(id);
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
if (id.startsWith("./")) {
|
|
664
|
+
return require(path.resolve(process.cwd(), id.slice(2)));
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
return require(id);
|
|
668
|
+
};
|
|
655
669
|
|
|
656
670
|
function renderHtml(model) {
|
|
657
671
|
return new Promise((resolve, reject) => {
|
|
@@ -949,6 +963,27 @@ function normalizeClientManifest(manifest, options) {
|
|
|
949
963
|
}
|
|
950
964
|
return normalized;
|
|
951
965
|
}
|
|
966
|
+
function createServerConsumerManifest(manifest) {
|
|
967
|
+
const consumerManifest = {};
|
|
968
|
+
for (const [key, value] of Object.entries(manifest)) {
|
|
969
|
+
if (!value || typeof value !== "object") {
|
|
970
|
+
continue;
|
|
971
|
+
}
|
|
972
|
+
const entry = value;
|
|
973
|
+
if (typeof entry.id !== "string" || entry.id.trim() === "") {
|
|
974
|
+
continue;
|
|
975
|
+
}
|
|
976
|
+
consumerManifest[key] = {
|
|
977
|
+
"*": {
|
|
978
|
+
id: entry.id,
|
|
979
|
+
chunks: [],
|
|
980
|
+
name: entry.name ?? "*",
|
|
981
|
+
...entry.async ? { async: entry.async } : {}
|
|
982
|
+
}
|
|
983
|
+
};
|
|
984
|
+
}
|
|
985
|
+
return consumerManifest;
|
|
986
|
+
}
|
|
952
987
|
function createNodeRequestHandler(options) {
|
|
953
988
|
const devServerId = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
954
989
|
const distRootDir = path3.resolve(options.distRootDir);
|
|
@@ -973,6 +1008,7 @@ function createNodeRequestHandler(options) {
|
|
|
973
1008
|
cwd: process.cwd()
|
|
974
1009
|
}
|
|
975
1010
|
);
|
|
1011
|
+
const serverConsumerModuleMap = createServerConsumerManifest(moduleMap);
|
|
976
1012
|
const initialHtmlWorker = createInitialHtmlWorker(pagesDir);
|
|
977
1013
|
const disposeInitialHtmlWorker = () => {
|
|
978
1014
|
initialHtmlWorker.dispose();
|
|
@@ -1088,7 +1124,7 @@ function createNodeRequestHandler(options) {
|
|
|
1088
1124
|
try {
|
|
1089
1125
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1090
1126
|
flightData: initialFlightData,
|
|
1091
|
-
moduleMap
|
|
1127
|
+
moduleMap: serverConsumerModuleMap
|
|
1092
1128
|
});
|
|
1093
1129
|
} catch (error) {
|
|
1094
1130
|
console.error("[webframez-react] Failed to render initial HTML", error);
|
|
@@ -1096,7 +1132,7 @@ function createNodeRequestHandler(options) {
|
|
|
1096
1132
|
initialHtmlWorker.dispose();
|
|
1097
1133
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1098
1134
|
flightData: initialFlightData,
|
|
1099
|
-
moduleMap
|
|
1135
|
+
moduleMap: serverConsumerModuleMap
|
|
1100
1136
|
});
|
|
1101
1137
|
} catch (retryError) {
|
|
1102
1138
|
console.error("[webframez-react] Retry for initial HTML failed", retryError);
|
|
@@ -1104,7 +1140,7 @@ function createNodeRequestHandler(options) {
|
|
|
1104
1140
|
initialHtmlWorker.dispose();
|
|
1105
1141
|
rootHtml = await initialHtmlWorker.renderFromFlightData({
|
|
1106
1142
|
flightData: initialFlightData,
|
|
1107
|
-
moduleMap
|
|
1143
|
+
moduleMap: serverConsumerModuleMap
|
|
1108
1144
|
});
|
|
1109
1145
|
} catch (flightRenderError) {
|
|
1110
1146
|
console.error("[webframez-react] Flight-to-HTML render failed", flightRenderError);
|