@hubspot/cms-dev-server 0.16.2 → 0.16.4
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 +27 -6
- package/package.json +3 -3
package/dist/run.js
CHANGED
|
@@ -1055,7 +1055,7 @@ function trackUsage(action) {
|
|
|
1055
1055
|
eventName: EVENT_NAME,
|
|
1056
1056
|
action,
|
|
1057
1057
|
nodeVersion: getNodeVersionData(),
|
|
1058
|
-
version: "0.16.
|
|
1058
|
+
version: "0.16.4",
|
|
1059
1059
|
os: getPlatform()
|
|
1060
1060
|
};
|
|
1061
1061
|
const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
|
|
@@ -1584,6 +1584,23 @@ async function requestPage(url3, redirects = 0, originalUrl) {
|
|
|
1584
1584
|
}
|
|
1585
1585
|
},
|
|
1586
1586
|
async (res) => {
|
|
1587
|
+
let portalIdHeader;
|
|
1588
|
+
let contentId;
|
|
1589
|
+
const isContentMembershipRedirect = Boolean(
|
|
1590
|
+
res.headers["x-hs-content-membership-redirect"]
|
|
1591
|
+
);
|
|
1592
|
+
if (isContentMembershipRedirect) {
|
|
1593
|
+
debug("Content Membership Redirect", res.headers);
|
|
1594
|
+
portalIdHeader = res.headers["x-hs-portal-id"];
|
|
1595
|
+
contentId = res.headers["x-hs-content-id"];
|
|
1596
|
+
if (portalIdHeader && contentId) {
|
|
1597
|
+
return resolve3({
|
|
1598
|
+
portalIdHeader,
|
|
1599
|
+
contentId,
|
|
1600
|
+
res
|
|
1601
|
+
});
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1587
1604
|
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
1588
1605
|
console.log(`Redirecting to ${res.headers.location} (from ${url3})`);
|
|
1589
1606
|
return resolve3(
|
|
@@ -1594,7 +1611,13 @@ async function requestPage(url3, redirects = 0, originalUrl) {
|
|
|
1594
1611
|
)
|
|
1595
1612
|
);
|
|
1596
1613
|
}
|
|
1597
|
-
|
|
1614
|
+
portalIdHeader = res.headers["x-hs-hub-id"];
|
|
1615
|
+
contentId = res.headers["x-hs-content-id"];
|
|
1616
|
+
return resolve3({
|
|
1617
|
+
res,
|
|
1618
|
+
portalIdHeader,
|
|
1619
|
+
contentId
|
|
1620
|
+
});
|
|
1598
1621
|
}
|
|
1599
1622
|
).on("error", (err) => {
|
|
1600
1623
|
console.error(err);
|
|
@@ -1603,9 +1626,7 @@ async function requestPage(url3, redirects = 0, originalUrl) {
|
|
|
1603
1626
|
});
|
|
1604
1627
|
}
|
|
1605
1628
|
async function fetchContentMetadata(url3, portalId) {
|
|
1606
|
-
const res = await requestPage(url3);
|
|
1607
|
-
const portalIdHeader = res.headers["x-hs-hub-id"];
|
|
1608
|
-
const contentId = res.headers["x-hs-content-id"];
|
|
1629
|
+
const { portalIdHeader, contentId, res } = await requestPage(url3);
|
|
1609
1630
|
if (Array.isArray(portalIdHeader) || Array.isArray(contentId)) {
|
|
1610
1631
|
throw new Error(
|
|
1611
1632
|
`There were multiple hub ID or content ID headers in the HEAD request to ${url3}`
|
|
@@ -1618,7 +1639,7 @@ async function fetchContentMetadata(url3, portalId) {
|
|
|
1618
1639
|
`No CLI auth for portal ${portalIdFromResponse} found, please run \`hs auth\``
|
|
1619
1640
|
);
|
|
1620
1641
|
}
|
|
1621
|
-
if (res.statusCode !== 200) {
|
|
1642
|
+
if (res.statusCode !== 200 && !(portalIdFromResponse && pageAccount && contentId)) {
|
|
1622
1643
|
throw new Error(
|
|
1623
1644
|
`${res.statusCode} ${res.statusMessage} - Unable to obtain HEAD information from ${url3}. ${res.statusCode === 429 && res.headers["retry-after"] ? `Retry after ${res.headers["retry-after"]} seconds.` : ""}`
|
|
1624
1645
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cms-dev-server",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.4",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"publint": "publint --level warning --prod"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@hubspot/cms-components": "^0.16.
|
|
28
|
+
"@hubspot/cms-components": "^0.16.4",
|
|
29
29
|
"@hubspot/local-dev-lib": "^1.9.0",
|
|
30
30
|
"@inquirer/select": "^2.0.0",
|
|
31
31
|
"@originjs/vite-plugin-commonjs": "^1.0.3",
|
|
@@ -108,5 +108,5 @@
|
|
|
108
108
|
"publishConfig": {
|
|
109
109
|
"access": "public"
|
|
110
110
|
},
|
|
111
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "4d26da29e19775b7d8a63d8c485ae16b11839606"
|
|
112
112
|
}
|