@hubspot/cms-dev-server 0.6.6 → 0.6.8
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/internalSsr.js +17 -8
- package/dist/run.js +52 -9
- package/dist/storybook-main/main.js +17 -8
- package/package.json +4 -4
package/dist/internalSsr.js
CHANGED
|
@@ -154,13 +154,15 @@ function getPerServerRequestUrls(perServerRequestData, viteDevServer) {
|
|
|
154
154
|
);
|
|
155
155
|
perServerRequestData.get("sharedStateIDs").forEach((id) => {
|
|
156
156
|
const reducer = perServerRequestData.get(id);
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
157
|
+
if (reducer.reducerFuncModuleId) {
|
|
158
|
+
const reducerWithUrl = {
|
|
159
|
+
...reducer,
|
|
160
|
+
reducerFuncModuleUrl: viteDevServer.moduleGraph.getModuleById(
|
|
161
|
+
reducer.reducerFuncModuleId
|
|
162
|
+
).url
|
|
163
|
+
};
|
|
164
|
+
perServerRequestDataWithUrls.set(id, reducerWithUrl);
|
|
165
|
+
}
|
|
164
166
|
});
|
|
165
167
|
return perServerRequestDataWithUrls;
|
|
166
168
|
}
|
|
@@ -324,7 +326,13 @@ var scriptTagToLogServerMessages = (messagesForBrowser, groupLabel) => {
|
|
|
324
326
|
}
|
|
325
327
|
const consoleLines = [];
|
|
326
328
|
for (const message of messagesForBrowser) {
|
|
327
|
-
|
|
329
|
+
let funcString = "console.log";
|
|
330
|
+
if (message.level === "error") {
|
|
331
|
+
funcString = "console.error";
|
|
332
|
+
}
|
|
333
|
+
if (message.level === "warn") {
|
|
334
|
+
funcString = "console.warn";
|
|
335
|
+
}
|
|
328
336
|
const argString = message.parameters.map((arg) => JSON.stringify(arg)).join(", ");
|
|
329
337
|
consoleLines.push(` ${funcString}(${argString});`);
|
|
330
338
|
}
|
|
@@ -569,6 +577,7 @@ export {
|
|
|
569
577
|
renderOnServer,
|
|
570
578
|
renderStreamToPromise,
|
|
571
579
|
resolveIslandPlugin,
|
|
580
|
+
scriptTagToLogServerMessages,
|
|
572
581
|
serializeIslandDataToJSON,
|
|
573
582
|
setIn,
|
|
574
583
|
ungatedAtBuildTimeFor,
|
package/dist/run.js
CHANGED
|
@@ -150,13 +150,15 @@ function getPerServerRequestUrls(perServerRequestData, viteDevServer) {
|
|
|
150
150
|
);
|
|
151
151
|
perServerRequestData.get("sharedStateIDs").forEach((id) => {
|
|
152
152
|
const reducer = perServerRequestData.get(id);
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
153
|
+
if (reducer.reducerFuncModuleId) {
|
|
154
|
+
const reducerWithUrl = {
|
|
155
|
+
...reducer,
|
|
156
|
+
reducerFuncModuleUrl: viteDevServer.moduleGraph.getModuleById(
|
|
157
|
+
reducer.reducerFuncModuleId
|
|
158
|
+
).url
|
|
159
|
+
};
|
|
160
|
+
perServerRequestDataWithUrls.set(id, reducerWithUrl);
|
|
161
|
+
}
|
|
160
162
|
});
|
|
161
163
|
return perServerRequestDataWithUrls;
|
|
162
164
|
}
|
|
@@ -300,7 +302,13 @@ var scriptTagToLogServerMessages = (messagesForBrowser, groupLabel) => {
|
|
|
300
302
|
}
|
|
301
303
|
const consoleLines = [];
|
|
302
304
|
for (const message of messagesForBrowser) {
|
|
303
|
-
|
|
305
|
+
let funcString = "console.log";
|
|
306
|
+
if (message.level === "error") {
|
|
307
|
+
funcString = "console.error";
|
|
308
|
+
}
|
|
309
|
+
if (message.level === "warn") {
|
|
310
|
+
funcString = "console.warn";
|
|
311
|
+
}
|
|
304
312
|
const argString = message.parameters.map((arg) => JSON.stringify(arg)).join(", ");
|
|
305
313
|
consoleLines.push(` ${funcString}(${argString});`);
|
|
306
314
|
}
|
|
@@ -1745,7 +1753,37 @@ function proxyPageResourceRedirect(req, res, next) {
|
|
|
1745
1753
|
const domainToProxy = getSubDomainFromValidLocalDomain(req.hostname);
|
|
1746
1754
|
const pathToProxy = req.originalUrl;
|
|
1747
1755
|
const urlToProxy = `https://${domainToProxy}${pathToProxy}`;
|
|
1748
|
-
|
|
1756
|
+
if (req.method === "GET") {
|
|
1757
|
+
request(urlToProxy).pipe(res);
|
|
1758
|
+
} else {
|
|
1759
|
+
const contentType = req.headers["content-type"];
|
|
1760
|
+
const isSendingJSON = contentType && /\bjson\b/.test(req.headers["content-type"].toString());
|
|
1761
|
+
const headerEntries = Object.entries(req.headers).filter(([header]) => {
|
|
1762
|
+
if (
|
|
1763
|
+
// Need to reset these headers for https (and recompression/encoding?) to work properly
|
|
1764
|
+
["host", "origin", "connection", "content-length"].includes(
|
|
1765
|
+
header.toLowerCase()
|
|
1766
|
+
) || header.startsWith("sec-")
|
|
1767
|
+
) {
|
|
1768
|
+
return false;
|
|
1769
|
+
}
|
|
1770
|
+
return true;
|
|
1771
|
+
});
|
|
1772
|
+
let body = void 0;
|
|
1773
|
+
if (req.body) {
|
|
1774
|
+
if (isSendingJSON) {
|
|
1775
|
+
body = JSON.stringify(req.body);
|
|
1776
|
+
} else {
|
|
1777
|
+
body = req.body.toString();
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
request({
|
|
1781
|
+
url: urlToProxy,
|
|
1782
|
+
method: req.method,
|
|
1783
|
+
headers: Object.fromEntries(headerEntries),
|
|
1784
|
+
body
|
|
1785
|
+
}).pipe(res);
|
|
1786
|
+
}
|
|
1749
1787
|
}
|
|
1750
1788
|
|
|
1751
1789
|
// src/routes/homeRouteHandler.tsx
|
|
@@ -1915,6 +1953,11 @@ var createDevServerRoutes = async (viteServer, storybookPort) => {
|
|
|
1915
1953
|
devServerApp.get("/", homeRouteHandler_default);
|
|
1916
1954
|
devServerApp.get("/*", proxyPathPageResourceRedirect);
|
|
1917
1955
|
devServerApp.get("/*", proxyPageResourceRedirect);
|
|
1956
|
+
devServerApp.post("/*", proxyPageResourceRedirect);
|
|
1957
|
+
devServerApp.delete("/*", proxyPageResourceRedirect);
|
|
1958
|
+
devServerApp.head("/*", proxyPageResourceRedirect);
|
|
1959
|
+
devServerApp.put("/*", proxyPageResourceRedirect);
|
|
1960
|
+
devServerApp.options("/*", proxyPageResourceRedirect);
|
|
1918
1961
|
devServerApp.get("/*", proxyPageRouteHandler);
|
|
1919
1962
|
return devServerApp;
|
|
1920
1963
|
};
|
|
@@ -43,6 +43,7 @@ __export(dist_exports, {
|
|
|
43
43
|
renderOnServer: () => renderOnServer,
|
|
44
44
|
renderStreamToPromise: () => renderStreamToPromise,
|
|
45
45
|
resolveIslandPlugin: () => resolveIslandPlugin,
|
|
46
|
+
scriptTagToLogServerMessages: () => scriptTagToLogServerMessages,
|
|
46
47
|
serializeIslandDataToJSON: () => serializeIslandDataToJSON,
|
|
47
48
|
setIn: () => setIn,
|
|
48
49
|
ungatedAtBuildTimeFor: () => ungatedAtBuildTimeFor,
|
|
@@ -104,13 +105,15 @@ function getPerServerRequestUrls(perServerRequestData, viteDevServer) {
|
|
|
104
105
|
);
|
|
105
106
|
perServerRequestData.get("sharedStateIDs").forEach((id) => {
|
|
106
107
|
const reducer = perServerRequestData.get(id);
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
108
|
+
if (reducer.reducerFuncModuleId) {
|
|
109
|
+
const reducerWithUrl = {
|
|
110
|
+
...reducer,
|
|
111
|
+
reducerFuncModuleUrl: viteDevServer.moduleGraph.getModuleById(
|
|
112
|
+
reducer.reducerFuncModuleId
|
|
113
|
+
).url
|
|
114
|
+
};
|
|
115
|
+
perServerRequestDataWithUrls.set(id, reducerWithUrl);
|
|
116
|
+
}
|
|
114
117
|
});
|
|
115
118
|
return perServerRequestDataWithUrls;
|
|
116
119
|
}
|
|
@@ -512,7 +515,13 @@ ${indentString}`);
|
|
|
512
515
|
}
|
|
513
516
|
const consoleLines = [];
|
|
514
517
|
for (const message of messagesForBrowser) {
|
|
515
|
-
|
|
518
|
+
let funcString = "console.log";
|
|
519
|
+
if (message.level === "error") {
|
|
520
|
+
funcString = "console.error";
|
|
521
|
+
}
|
|
522
|
+
if (message.level === "warn") {
|
|
523
|
+
funcString = "console.warn";
|
|
524
|
+
}
|
|
516
525
|
const argString = message.parameters.map((arg) => JSON.stringify(arg)).join(", ");
|
|
517
526
|
consoleLines.push(` ${funcString}(${argString});`);
|
|
518
527
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cms-dev-server",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.8",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@hubspot/cli-lib": "^3.0.12",
|
|
28
|
-
"@hubspot/cms-components": "^0.6.
|
|
28
|
+
"@hubspot/cms-components": "^0.6.8",
|
|
29
29
|
"@storybook/addon-actions": "7.0.7",
|
|
30
30
|
"@storybook/addon-essentials": "7.0.7",
|
|
31
31
|
"@storybook/addon-interactions": "7.0.7",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"debug": "^4.3.4",
|
|
41
41
|
"express": "^4.17.3",
|
|
42
42
|
"http-proxy-middleware": "^2.0.6",
|
|
43
|
+
"node-fetch": "^3.3.0",
|
|
43
44
|
"react": "^18.1.0",
|
|
44
45
|
"react-dom": "^18.1.0",
|
|
45
46
|
"request": "^2.88.2",
|
|
@@ -56,7 +57,6 @@
|
|
|
56
57
|
"@types/react-dom": "^18.0.0",
|
|
57
58
|
"copyfiles": "^2.4.1",
|
|
58
59
|
"esbuild": "^0.16.17",
|
|
59
|
-
"node-fetch": "^3.3.0",
|
|
60
60
|
"nodemon": "^2.0.15",
|
|
61
61
|
"ts-node": "^10.7.0",
|
|
62
62
|
"vitest": "0.30.1"
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"publishConfig": {
|
|
98
98
|
"access": "public"
|
|
99
99
|
},
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "9ca0f79fc066dc1663f94ead2987e1e51b799351"
|
|
101
101
|
}
|