@hubspot/cms-dev-server 0.14.14 → 0.14.16
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/run.js +22 -7
- package/package.json +4 -3
package/dist/run.js
CHANGED
|
@@ -1031,7 +1031,7 @@ function trackUsage(action) {
|
|
|
1031
1031
|
eventName: EVENT_NAME,
|
|
1032
1032
|
action,
|
|
1033
1033
|
nodeVersion: getNodeVersionData(),
|
|
1034
|
-
version: "0.14.
|
|
1034
|
+
version: "0.14.16",
|
|
1035
1035
|
os: getPlatform()
|
|
1036
1036
|
};
|
|
1037
1037
|
const uri = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
|
|
@@ -1406,11 +1406,12 @@ async function renderModule(viteServer, requestedModulePath, moduleProps, pageUr
|
|
|
1406
1406
|
});
|
|
1407
1407
|
if (ungatedForServerSideProps && componentModule.getServerSideProps) {
|
|
1408
1408
|
try {
|
|
1409
|
-
|
|
1409
|
+
const serverSidePropsResponse = await componentModule.getServerSideProps(
|
|
1410
1410
|
namespacedModuleProps,
|
|
1411
1411
|
new URL(pageUrl)
|
|
1412
1412
|
);
|
|
1413
|
-
|
|
1413
|
+
serverSideProps = serverSidePropsResponse == null ? void 0 : serverSidePropsResponse.serverSideProps;
|
|
1414
|
+
if (!!serverSideProps || serverSideProps.constructor !== {}.constructor) {
|
|
1414
1415
|
throw new Error("getServerSideProps must return an object");
|
|
1415
1416
|
}
|
|
1416
1417
|
} catch (error) {
|
|
@@ -1656,6 +1657,7 @@ import { get as hsGet3 } from "@hubspot/cli-lib/http.js";
|
|
|
1656
1657
|
// src/lib/proxyHelpers.ts
|
|
1657
1658
|
import fs2 from "fs";
|
|
1658
1659
|
import { resolve as resolve2 } from "path";
|
|
1660
|
+
import { unescape } from "html-escaper";
|
|
1659
1661
|
var localJsRenderStartString = '<!-- proxy local render of "';
|
|
1660
1662
|
var localJsRenderEndString = "end proxy local render -->";
|
|
1661
1663
|
function isRecord(value) {
|
|
@@ -1694,7 +1696,12 @@ var findLocalRenderPlaceholders = (body) => {
|
|
|
1694
1696
|
if (endOffset >= startOffset && endOffset < nextCommentEndOffset) {
|
|
1695
1697
|
const jsonString = body.substring(pathEndOffset + 1, endOffset).trim();
|
|
1696
1698
|
try {
|
|
1697
|
-
|
|
1699
|
+
let json;
|
|
1700
|
+
try {
|
|
1701
|
+
json = JSON.parse(unescape(jsonString));
|
|
1702
|
+
} catch (e) {
|
|
1703
|
+
json = JSON.parse(jsonString);
|
|
1704
|
+
}
|
|
1698
1705
|
if (!isRecord(json.request)) {
|
|
1699
1706
|
console.error(
|
|
1700
1707
|
`Invalid JSON inside <!-- proxy local render .. --> string (missing request key)`
|
|
@@ -1914,7 +1921,7 @@ var makeProxyPreviewRequest = (accountId, urlToProxy, previewKey, contentId, pro
|
|
|
1914
1921
|
...proxiedQueryParams,
|
|
1915
1922
|
hs_preview: `${previewKey}-${contentId}`,
|
|
1916
1923
|
hsLocalProxyProject: localProxyProject,
|
|
1917
|
-
localProxySchemaVersion: "
|
|
1924
|
+
localProxySchemaVersion: "2"
|
|
1918
1925
|
};
|
|
1919
1926
|
if (renderPreviewLocally) {
|
|
1920
1927
|
proxiedQueryParams.hsDebugOverridePublicHost = url3.host;
|
|
@@ -2544,9 +2551,11 @@ async function modulePreviewRouteHandler(request2, response) {
|
|
|
2544
2551
|
const queryParams = new URLSearchParams({
|
|
2545
2552
|
portalId: `${authedPortalId}`,
|
|
2546
2553
|
hsLocalProxy: `${true}`,
|
|
2547
|
-
localProxySchemaVersion: "
|
|
2554
|
+
localProxySchemaVersion: "2"
|
|
2548
2555
|
});
|
|
2549
|
-
|
|
2556
|
+
const currentHubApiDomainOverride = process.env.HUBAPI_DOMAIN_OVERRIDE;
|
|
2557
|
+
process.env.HUBAPI_DOMAIN_OVERRIDE = `api.hubspot${authedEnv === "qa" ? "qa" : ""}`;
|
|
2558
|
+
const templatePreviewPromise = hsPost(authedPortalId, {
|
|
2550
2559
|
uri: `/api/cos-rendering/v1/public/_hcms/preview/template/multiform?${queryParams}`,
|
|
2551
2560
|
headers: {
|
|
2552
2561
|
["content-type"]: "application/x-www-form-urlencoded",
|
|
@@ -2556,6 +2565,12 @@ async function modulePreviewRouteHandler(request2, response) {
|
|
|
2556
2565
|
},
|
|
2557
2566
|
body: `module=${encodeURIComponent(JSON.stringify(localModule))}`
|
|
2558
2567
|
});
|
|
2568
|
+
if (currentHubApiDomainOverride) {
|
|
2569
|
+
process.env.HUBAPI_DOMAIN_OVERRIDE = currentHubApiDomainOverride;
|
|
2570
|
+
} else {
|
|
2571
|
+
delete process.env.HUBAPI_DOMAIN_OVERRIDE;
|
|
2572
|
+
}
|
|
2573
|
+
templatePreview = await templatePreviewPromise;
|
|
2559
2574
|
} catch (e) {
|
|
2560
2575
|
return response.status(500).end(`Error fetching module preview for (${moduleName}).
|
|
2561
2576
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cms-dev-server",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.16",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@hubspot/cli-lib": "^3.0.12",
|
|
29
|
-
"@hubspot/cms-components": "^0.14.
|
|
29
|
+
"@hubspot/cms-components": "^0.14.16",
|
|
30
30
|
"@inquirer/select": "^2.0.0",
|
|
31
31
|
"@originjs/vite-plugin-commonjs": "^1.0.3",
|
|
32
32
|
"@storybook/addon-actions": "7.0.7",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"cors": "^2.8.5",
|
|
45
45
|
"debug": "^4.3.4",
|
|
46
46
|
"express": "^4.17.3",
|
|
47
|
+
"html-escaper": "^3.0.3",
|
|
47
48
|
"http-proxy-middleware": "^2.0.6",
|
|
48
49
|
"node-fetch": "^3.3.0",
|
|
49
50
|
"react": "^18.1.0",
|
|
@@ -107,5 +108,5 @@
|
|
|
107
108
|
"publishConfig": {
|
|
108
109
|
"access": "public"
|
|
109
110
|
},
|
|
110
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "789738a8f8247eb4584f991618a46e036841f66c"
|
|
111
112
|
}
|