@hubspot/cms-dev-server 0.6.7 → 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 +8 -1
- package/dist/run.js +43 -2
- package/dist/storybook-main/main.js +8 -1
- package/package.json +4 -4
package/dist/internalSsr.js
CHANGED
|
@@ -326,7 +326,13 @@ var scriptTagToLogServerMessages = (messagesForBrowser, groupLabel) => {
|
|
|
326
326
|
}
|
|
327
327
|
const consoleLines = [];
|
|
328
328
|
for (const message of messagesForBrowser) {
|
|
329
|
-
|
|
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
|
+
}
|
|
330
336
|
const argString = message.parameters.map((arg) => JSON.stringify(arg)).join(", ");
|
|
331
337
|
consoleLines.push(` ${funcString}(${argString});`);
|
|
332
338
|
}
|
|
@@ -571,6 +577,7 @@ export {
|
|
|
571
577
|
renderOnServer,
|
|
572
578
|
renderStreamToPromise,
|
|
573
579
|
resolveIslandPlugin,
|
|
580
|
+
scriptTagToLogServerMessages,
|
|
574
581
|
serializeIslandDataToJSON,
|
|
575
582
|
setIn,
|
|
576
583
|
ungatedAtBuildTimeFor,
|
package/dist/run.js
CHANGED
|
@@ -302,7 +302,13 @@ var scriptTagToLogServerMessages = (messagesForBrowser, groupLabel) => {
|
|
|
302
302
|
}
|
|
303
303
|
const consoleLines = [];
|
|
304
304
|
for (const message of messagesForBrowser) {
|
|
305
|
-
|
|
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
|
+
}
|
|
306
312
|
const argString = message.parameters.map((arg) => JSON.stringify(arg)).join(", ");
|
|
307
313
|
consoleLines.push(` ${funcString}(${argString});`);
|
|
308
314
|
}
|
|
@@ -1747,7 +1753,37 @@ function proxyPageResourceRedirect(req, res, next) {
|
|
|
1747
1753
|
const domainToProxy = getSubDomainFromValidLocalDomain(req.hostname);
|
|
1748
1754
|
const pathToProxy = req.originalUrl;
|
|
1749
1755
|
const urlToProxy = `https://${domainToProxy}${pathToProxy}`;
|
|
1750
|
-
|
|
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
|
+
}
|
|
1751
1787
|
}
|
|
1752
1788
|
|
|
1753
1789
|
// src/routes/homeRouteHandler.tsx
|
|
@@ -1917,6 +1953,11 @@ var createDevServerRoutes = async (viteServer, storybookPort) => {
|
|
|
1917
1953
|
devServerApp.get("/", homeRouteHandler_default);
|
|
1918
1954
|
devServerApp.get("/*", proxyPathPageResourceRedirect);
|
|
1919
1955
|
devServerApp.get("/*", proxyPageResourceRedirect);
|
|
1956
|
+
devServerApp.post("/*", proxyPageResourceRedirect);
|
|
1957
|
+
devServerApp.delete("/*", proxyPageResourceRedirect);
|
|
1958
|
+
devServerApp.head("/*", proxyPageResourceRedirect);
|
|
1959
|
+
devServerApp.put("/*", proxyPageResourceRedirect);
|
|
1960
|
+
devServerApp.options("/*", proxyPageResourceRedirect);
|
|
1920
1961
|
devServerApp.get("/*", proxyPageRouteHandler);
|
|
1921
1962
|
return devServerApp;
|
|
1922
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,
|
|
@@ -514,7 +515,13 @@ ${indentString}`);
|
|
|
514
515
|
}
|
|
515
516
|
const consoleLines = [];
|
|
516
517
|
for (const message of messagesForBrowser) {
|
|
517
|
-
|
|
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
|
+
}
|
|
518
525
|
const argString = message.parameters.map((arg) => JSON.stringify(arg)).join(", ");
|
|
519
526
|
consoleLines.push(` ${funcString}(${argString});`);
|
|
520
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
|
}
|