@hubspot/cms-dev-server 0.15.20 → 0.16.1
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/index.js +3 -0
- package/dist/run.js +89 -99
- package/package.json +4 -4
- package/types/island-runtime.d.ts +0 -2
package/dist/index.js
CHANGED
|
@@ -123,6 +123,9 @@ function devSecretsPlugin(secretNames) {
|
|
|
123
123
|
"@hubspot/cms-components"
|
|
124
124
|
);
|
|
125
125
|
if (cmsComponents2.setSecretsFromEnv) {
|
|
126
|
+
console.log(
|
|
127
|
+
`Attempting to load HS_* secrets from .env: ${secretNames}`
|
|
128
|
+
);
|
|
126
129
|
cmsComponents2.setSecretsFromEnv(secretNames);
|
|
127
130
|
} else if (secretNames.length > 0) {
|
|
128
131
|
console.warn(
|
package/dist/run.js
CHANGED
|
@@ -1014,14 +1014,17 @@ var getIslandRuntimeAndGlobalToInject = async (sortedIslandRoots, perServerReque
|
|
|
1014
1014
|
import { buildStaticEnvConfig } from "@hubspot/cms-components";
|
|
1015
1015
|
|
|
1016
1016
|
// src/lib/trackUsage.ts
|
|
1017
|
-
import
|
|
1018
|
-
import { getAccountConfig } from "@hubspot/
|
|
1017
|
+
import localDevHttpImport from "@hubspot/local-dev-lib/http";
|
|
1018
|
+
import { getAccountConfig } from "@hubspot/local-dev-lib/config";
|
|
1019
|
+
import axios from "axios";
|
|
1020
|
+
import { getAxiosConfig } from "@hubspot/local-dev-lib/http/getAxiosConfig";
|
|
1019
1021
|
|
|
1020
1022
|
// src/lib/debug.ts
|
|
1021
1023
|
import { default as debugFactory } from "debug";
|
|
1022
1024
|
var debug = debugFactory("cms-dev-server");
|
|
1023
1025
|
|
|
1024
1026
|
// src/lib/trackUsage.ts
|
|
1027
|
+
var { default: hsCliHttp } = localDevHttpImport;
|
|
1025
1028
|
var DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED = "/cms-dev-server-usage/v1/authenticated";
|
|
1026
1029
|
var DEV_SERVER_USAGE_ENDPOINT = "/cms-dev-server-usage/v1";
|
|
1027
1030
|
var EVENT_NAME = "dev-server-interaction";
|
|
@@ -1047,23 +1050,23 @@ function trackUsage(action) {
|
|
|
1047
1050
|
eventName: EVENT_NAME,
|
|
1048
1051
|
action,
|
|
1049
1052
|
nodeVersion: getNodeVersionData(),
|
|
1050
|
-
version: "0.
|
|
1053
|
+
version: "0.16.1",
|
|
1051
1054
|
os: getPlatform()
|
|
1052
1055
|
};
|
|
1053
|
-
const
|
|
1056
|
+
const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
|
|
1054
1057
|
const baseRequestOptions = {
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
resolveWithFullResponse: true
|
|
1058
|
+
url: url3,
|
|
1059
|
+
data: usageEvent
|
|
1058
1060
|
};
|
|
1059
1061
|
if (isAuthedWithPersonalAccessKey) {
|
|
1060
|
-
return
|
|
1062
|
+
return hsCliHttp.post(trackingAccountId, baseRequestOptions);
|
|
1061
1063
|
}
|
|
1062
|
-
const
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1064
|
+
const config = getAxiosConfig({
|
|
1065
|
+
...baseRequestOptions,
|
|
1066
|
+
env: trackingEnv,
|
|
1067
|
+
method: "POST"
|
|
1068
|
+
});
|
|
1069
|
+
return axios(config);
|
|
1067
1070
|
}
|
|
1068
1071
|
var setTrackingInfo = (accountId, env) => {
|
|
1069
1072
|
trackingAccountId = accountId;
|
|
@@ -1246,10 +1249,11 @@ import { normalizePath as normalizePath3 } from "vite";
|
|
|
1246
1249
|
import { join as joinPosix2 } from "path/posix";
|
|
1247
1250
|
import { traverseFieldsJSON } from "@hubspot/cms-components/fields";
|
|
1248
1251
|
import * as cmsComponents2 from "@hubspot/cms-components";
|
|
1249
|
-
import
|
|
1252
|
+
import localDevHttpImport3 from "@hubspot/local-dev-lib/http";
|
|
1250
1253
|
|
|
1251
1254
|
// src/lib/fetchModuleGraphQLData.ts
|
|
1252
|
-
import
|
|
1255
|
+
import localDevHttpImport2 from "@hubspot/local-dev-lib/http";
|
|
1256
|
+
var { default: hsCliHttp2 } = localDevHttpImport2;
|
|
1253
1257
|
var graphQLCache = /* @__PURE__ */ new Map();
|
|
1254
1258
|
async function fetchModuleGraphQLData(accountId, query, requestedModulePath, pageUrl) {
|
|
1255
1259
|
const { searchParams } = new URL(pageUrl);
|
|
@@ -1261,9 +1265,9 @@ async function fetchModuleGraphQLData(accountId, query, requestedModulePath, pag
|
|
|
1261
1265
|
return Promise.resolve(graphQLCache.get(compositeQueryKey));
|
|
1262
1266
|
}
|
|
1263
1267
|
try {
|
|
1264
|
-
dataQueryResult = await
|
|
1265
|
-
|
|
1266
|
-
|
|
1268
|
+
dataQueryResult = await hsCliHttp2.post(accountId, {
|
|
1269
|
+
url: "/collector/v3/graphql",
|
|
1270
|
+
data: {
|
|
1267
1271
|
query
|
|
1268
1272
|
}
|
|
1269
1273
|
});
|
|
@@ -1275,6 +1279,7 @@ async function fetchModuleGraphQLData(accountId, query, requestedModulePath, pag
|
|
|
1275
1279
|
}
|
|
1276
1280
|
|
|
1277
1281
|
// src/lib/renderModule.ts
|
|
1282
|
+
var { default: hsCliHttp3 } = localDevHttpImport3;
|
|
1278
1283
|
var { filterToModuleDataDepsIncludedIn, getModuleDataDependecyTypeFrom } = cmsComponents2;
|
|
1279
1284
|
var getApplyFieldsValidationToRenderContext = (portalId, fieldsJSON, requestedModulePath) => {
|
|
1280
1285
|
return async (renderResult) => {
|
|
@@ -1284,21 +1289,17 @@ var getApplyFieldsValidationToRenderContext = (portalId, fieldsJSON, requestedMo
|
|
|
1284
1289
|
WARNING: "warn"
|
|
1285
1290
|
};
|
|
1286
1291
|
let validationRequest;
|
|
1287
|
-
let fieldValidationErrors = [];
|
|
1288
1292
|
try {
|
|
1289
|
-
validationRequest = await
|
|
1290
|
-
|
|
1291
|
-
|
|
1293
|
+
validationRequest = await hsCliHttp3.post(portalId, {
|
|
1294
|
+
url: "/designmanager/v1/modules/validate-fields",
|
|
1295
|
+
data: fieldsJSON,
|
|
1292
1296
|
resolveWithFullResponse: true
|
|
1293
1297
|
});
|
|
1294
1298
|
} catch {
|
|
1295
1299
|
console.log("Failed to validate module fields for", requestedModulePath);
|
|
1296
1300
|
}
|
|
1297
|
-
if (validationRequest) {
|
|
1298
|
-
|
|
1299
|
-
}
|
|
1300
|
-
if (fieldValidationErrors.length) {
|
|
1301
|
-
fieldValidationErrors.forEach((fieldValidationError) => {
|
|
1301
|
+
if (validationRequest.length) {
|
|
1302
|
+
validationRequest.forEach((fieldValidationError) => {
|
|
1302
1303
|
renderContext.criticalDevErrors.push({
|
|
1303
1304
|
message: `Field Validation Error in ${requestedModulePath}: ${fieldValidationError.message}`,
|
|
1304
1305
|
error: new Error(fieldValidationError.message),
|
|
@@ -1559,29 +1560,7 @@ var module_default = moduleRouteHandler;
|
|
|
1559
1560
|
// src/proxyPage/fetchContentMetadata.ts
|
|
1560
1561
|
import http from "http";
|
|
1561
1562
|
import https from "https";
|
|
1562
|
-
import {
|
|
1563
|
-
import { getAccountId } from "@hubspot/cli-lib/lib/config.js";
|
|
1564
|
-
async function requestContentPreview(url3, portalId) {
|
|
1565
|
-
const urlObject = new URL(url3);
|
|
1566
|
-
const proxiedQueryParams = {};
|
|
1567
|
-
for (const queryKey of urlObject.searchParams.keys()) {
|
|
1568
|
-
const values = urlObject.searchParams.getAll(queryKey);
|
|
1569
|
-
if (values.length > 1) {
|
|
1570
|
-
proxiedQueryParams[queryKey] = values;
|
|
1571
|
-
} else {
|
|
1572
|
-
proxiedQueryParams[queryKey] = values[0];
|
|
1573
|
-
}
|
|
1574
|
-
}
|
|
1575
|
-
const accountId = getAccountId(portalId);
|
|
1576
|
-
const response = await hsGet(accountId, {
|
|
1577
|
-
baseUrl: urlObject.origin,
|
|
1578
|
-
uri: urlObject.pathname,
|
|
1579
|
-
query: proxiedQueryParams,
|
|
1580
|
-
json: false,
|
|
1581
|
-
resolveWithFullResponse: true
|
|
1582
|
-
});
|
|
1583
|
-
return response;
|
|
1584
|
-
}
|
|
1563
|
+
import { getAccountId } from "@hubspot/local-dev-lib/config";
|
|
1585
1564
|
async function requestPage(url3, redirects = 0, originalUrl) {
|
|
1586
1565
|
if (redirects > 5) {
|
|
1587
1566
|
throw new Error(
|
|
@@ -1619,12 +1598,7 @@ async function requestPage(url3, redirects = 0, originalUrl) {
|
|
|
1619
1598
|
});
|
|
1620
1599
|
}
|
|
1621
1600
|
async function fetchContentMetadata(url3, portalId) {
|
|
1622
|
-
|
|
1623
|
-
if (url3.includes("hs_preview")) {
|
|
1624
|
-
res = await requestContentPreview(url3, portalId);
|
|
1625
|
-
} else {
|
|
1626
|
-
res = await requestPage(url3);
|
|
1627
|
-
}
|
|
1601
|
+
const res = await requestPage(url3);
|
|
1628
1602
|
const portalIdHeader = res.headers["x-hs-hub-id"];
|
|
1629
1603
|
const contentId = res.headers["x-hs-content-id"];
|
|
1630
1604
|
if (Array.isArray(portalIdHeader) || Array.isArray(contentId)) {
|
|
@@ -1660,8 +1634,8 @@ async function fetchContentMetadata(url3, portalId) {
|
|
|
1660
1634
|
// src/proxyPage/proxyPage.ts
|
|
1661
1635
|
import path5 from "path";
|
|
1662
1636
|
import { normalizePath as normalizePath4 } from "vite";
|
|
1663
|
-
import { getAccountId as getAccountId2, getEnv } from "@hubspot/
|
|
1664
|
-
import
|
|
1637
|
+
import { getAccountId as getAccountId2, getEnv } from "@hubspot/local-dev-lib/config";
|
|
1638
|
+
import localDevHttpImport5 from "@hubspot/local-dev-lib/http";
|
|
1665
1639
|
|
|
1666
1640
|
// src/lib/proxyHelpers.ts
|
|
1667
1641
|
import fs2 from "fs";
|
|
@@ -1843,7 +1817,8 @@ var renderLocalError_default = (path10, error) => {
|
|
|
1843
1817
|
};
|
|
1844
1818
|
|
|
1845
1819
|
// src/proxyPage/fetchPreviewInfo.ts
|
|
1846
|
-
import
|
|
1820
|
+
import localDevHttpImport4 from "@hubspot/local-dev-lib/http";
|
|
1821
|
+
var { default: hsCliHttp4 } = localDevHttpImport4;
|
|
1847
1822
|
var fetchPreviewInfo_default = async (accountId, portalId, contentId) => {
|
|
1848
1823
|
if (!contentId) {
|
|
1849
1824
|
throw new Error(
|
|
@@ -1851,10 +1826,10 @@ var fetchPreviewInfo_default = async (accountId, portalId, contentId) => {
|
|
|
1851
1826
|
);
|
|
1852
1827
|
}
|
|
1853
1828
|
try {
|
|
1854
|
-
const content = await
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1829
|
+
const content = await hsCliHttp4.get(accountId, {
|
|
1830
|
+
url: `/content/api/v4/contents/${contentId}`,
|
|
1831
|
+
params: { portalId },
|
|
1832
|
+
responseType: "json"
|
|
1858
1833
|
});
|
|
1859
1834
|
return {
|
|
1860
1835
|
previewDomain: content.previewDomain ?? content.resolvedDomain,
|
|
@@ -1890,6 +1865,7 @@ import {
|
|
|
1890
1865
|
isDebugUrlString as isDebugUrlString3,
|
|
1891
1866
|
mergeServerRequestData_internal
|
|
1892
1867
|
} from "@hubspot/cms-components";
|
|
1868
|
+
var { default: hsCliHttp5 } = localDevHttpImport5;
|
|
1893
1869
|
var getEntryPointBasePathFromProxyRequest = (request2) => {
|
|
1894
1870
|
if (!request2) {
|
|
1895
1871
|
return "";
|
|
@@ -1916,7 +1892,7 @@ var makeProxyPreviewRequest = (accountId, urlToProxy, previewKey, contentId, pro
|
|
|
1916
1892
|
const url3 = new URL(urlToProxy);
|
|
1917
1893
|
const renderPreviewLocally = url3.searchParams.has("renderPreviewLocally");
|
|
1918
1894
|
let proxiedQueryParams = {};
|
|
1919
|
-
let
|
|
1895
|
+
let baseURL = url3.origin;
|
|
1920
1896
|
let pathname = url3.pathname;
|
|
1921
1897
|
const PARAMS_TO_IGNORE = ["renderPreviewLocally"];
|
|
1922
1898
|
const queryKeys = Array.from(url3.searchParams.keys()).filter(
|
|
@@ -1940,30 +1916,28 @@ var makeProxyPreviewRequest = (accountId, urlToProxy, previewKey, contentId, pro
|
|
|
1940
1916
|
};
|
|
1941
1917
|
if (renderPreviewLocally) {
|
|
1942
1918
|
proxiedQueryParams.hsDebugOverridePublicHost = url3.host;
|
|
1943
|
-
|
|
1919
|
+
baseURL = `http://local.hubspot${environmentConfig.getInternalHSEnv() === "qa" ? "qa" : ""}.com`;
|
|
1944
1920
|
pathname = `/cos-rendering/v1/public${url3.pathname}`;
|
|
1945
1921
|
}
|
|
1946
1922
|
console.log(
|
|
1947
|
-
`Proxying request to ${
|
|
1923
|
+
`Proxying request to ${baseURL}${pathname}?${new URLSearchParams({
|
|
1948
1924
|
...proxiedQueryParams,
|
|
1949
1925
|
previewKey,
|
|
1950
1926
|
contentId
|
|
1951
1927
|
}).toString()}`
|
|
1952
1928
|
);
|
|
1953
|
-
const result =
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
useQuerystring: true,
|
|
1929
|
+
const result = hsCliHttp5.get(accountId, {
|
|
1930
|
+
baseURL,
|
|
1931
|
+
url: pathname,
|
|
1932
|
+
params: proxiedQueryParams,
|
|
1933
|
+
responseType: "text",
|
|
1959
1934
|
headers: {
|
|
1960
|
-
COOKIE: cookieHeader
|
|
1961
|
-
"User-Agent": "HubSpot CMS Dev Server"
|
|
1935
|
+
COOKIE: cookieHeader
|
|
1962
1936
|
}
|
|
1963
1937
|
});
|
|
1964
1938
|
return result.catch((error) => {
|
|
1965
|
-
if (error.
|
|
1966
|
-
return error.response.
|
|
1939
|
+
if (error.status >= 400 && error.status < 500 && !!error.response.data) {
|
|
1940
|
+
return error.response.data;
|
|
1967
1941
|
} else {
|
|
1968
1942
|
throw error;
|
|
1969
1943
|
}
|
|
@@ -2554,8 +2528,8 @@ function proxyServerlessRequest(req, res, next) {
|
|
|
2554
2528
|
import { buildStaticEnvConfig as buildStaticEnvConfig4 } from "@hubspot/cms-components";
|
|
2555
2529
|
import path6 from "path";
|
|
2556
2530
|
import { normalizePath as normalizePath5 } from "vite";
|
|
2557
|
-
import
|
|
2558
|
-
var {
|
|
2531
|
+
import localDevHttpImport6 from "@hubspot/local-dev-lib/http";
|
|
2532
|
+
var { default: hsCliHttp6 } = localDevHttpImport6;
|
|
2559
2533
|
async function modulePreviewRouteHandler(request2, response) {
|
|
2560
2534
|
sendTrackingRequest("view-module-preview-route");
|
|
2561
2535
|
const {
|
|
@@ -2631,8 +2605,8 @@ async function modulePreviewRouteHandler(request2, response) {
|
|
|
2631
2605
|
});
|
|
2632
2606
|
const currentHubApiDomainOverride = process.env.HUBAPI_DOMAIN_OVERRIDE;
|
|
2633
2607
|
process.env.HUBAPI_DOMAIN_OVERRIDE = `api.hubspot${authedEnv === "qa" ? "qa" : ""}`;
|
|
2634
|
-
const templatePreviewPromise =
|
|
2635
|
-
|
|
2608
|
+
const templatePreviewPromise = hsCliHttp6.post(authedPortalId, {
|
|
2609
|
+
url: `/api/cos-rendering/v1/public/_hcms/preview/template/multiform?${queryParams}`,
|
|
2636
2610
|
headers: {
|
|
2637
2611
|
["content-type"]: "application/x-www-form-urlencoded",
|
|
2638
2612
|
["Accept"]: "text/html",
|
|
@@ -2640,7 +2614,7 @@ async function modulePreviewRouteHandler(request2, response) {
|
|
|
2640
2614
|
cookie: request2.get("COOKIE"),
|
|
2641
2615
|
"User-Agent": "HubSpot CMS Dev Server"
|
|
2642
2616
|
},
|
|
2643
|
-
|
|
2617
|
+
data: `module=${encodeURIComponent(JSON.stringify(localModule))}`
|
|
2644
2618
|
});
|
|
2645
2619
|
if (currentHubApiDomainOverride) {
|
|
2646
2620
|
process.env.HUBAPI_DOMAIN_OVERRIDE = currentHubApiDomainOverride;
|
|
@@ -2762,7 +2736,7 @@ import express from "express";
|
|
|
2762
2736
|
|
|
2763
2737
|
// src/shadowDevServer/createShadowDevServerRoutes.ts
|
|
2764
2738
|
import { Router as Router2 } from "express";
|
|
2765
|
-
import { getAccountId as getAccountId3, getEnv as getEnv2 } from "@hubspot/
|
|
2739
|
+
import { getAccountId as getAccountId3, getEnv as getEnv2 } from "@hubspot/local-dev-lib/config";
|
|
2766
2740
|
import cors from "cors";
|
|
2767
2741
|
import { buildStaticEnvConfig as buildStaticEnvConfig5 } from "@hubspot/cms-components";
|
|
2768
2742
|
function getShadowDevServerCheckHandler(devServerPort, projectName, gates) {
|
|
@@ -2904,6 +2878,9 @@ function devSecretsPlugin(secretNames) {
|
|
|
2904
2878
|
"@hubspot/cms-components"
|
|
2905
2879
|
);
|
|
2906
2880
|
if (cmsComponents3.setSecretsFromEnv) {
|
|
2881
|
+
console.log(
|
|
2882
|
+
`Attempting to load HS_* secrets from .env: ${secretNames}`
|
|
2883
|
+
);
|
|
2907
2884
|
cmsComponents3.setSecretsFromEnv(secretNames);
|
|
2908
2885
|
} else if (secretNames.length > 0) {
|
|
2909
2886
|
console.warn(
|
|
@@ -3017,7 +2994,7 @@ function createHttpsRedirectingServer(opts, handler) {
|
|
|
3017
2994
|
}
|
|
3018
2995
|
|
|
3019
2996
|
// src/lib/getJSRenderingGates.ts
|
|
3020
|
-
import
|
|
2997
|
+
import { fetchAccessToken } from "@hubspot/local-dev-lib/api/localDevAuth";
|
|
3021
2998
|
|
|
3022
2999
|
// src/lib/gates.ts
|
|
3023
3000
|
function getGatesFromEnv() {
|
|
@@ -3035,7 +3012,7 @@ var mapEnabledFeaturesToGates = (enabledFeatures) => {
|
|
|
3035
3012
|
}, []);
|
|
3036
3013
|
};
|
|
3037
3014
|
async function getJsRenderingGates(portalId, env, personalAccessKey) {
|
|
3038
|
-
const { enabledFeatures = {} } = await
|
|
3015
|
+
const { enabledFeatures = {} } = await fetchAccessToken(
|
|
3039
3016
|
personalAccessKey,
|
|
3040
3017
|
env,
|
|
3041
3018
|
portalId
|
|
@@ -3054,11 +3031,11 @@ import {
|
|
|
3054
3031
|
getAccountConfig as getAccountConfig2,
|
|
3055
3032
|
loadConfig,
|
|
3056
3033
|
validateConfig
|
|
3057
|
-
} from "@hubspot/
|
|
3058
|
-
import { fetchSecrets } from "@hubspot/
|
|
3034
|
+
} from "@hubspot/local-dev-lib/config";
|
|
3035
|
+
import { fetchSecrets } from "@hubspot/local-dev-lib/api/secrets";
|
|
3059
3036
|
|
|
3060
3037
|
// src/proxyPage/fetchDomains.ts
|
|
3061
|
-
import
|
|
3038
|
+
import localDevHttpImport7 from "@hubspot/local-dev-lib/http";
|
|
3062
3039
|
|
|
3063
3040
|
// src/lib/errors.ts
|
|
3064
3041
|
var MISSING_SCOPE_ERROR_PREFIX = `Your personal access key is missing required scopes fetch domains.
|
|
@@ -3114,12 +3091,13 @@ function handleSecretsError(error) {
|
|
|
3114
3091
|
}
|
|
3115
3092
|
|
|
3116
3093
|
// src/proxyPage/fetchDomains.ts
|
|
3094
|
+
var { default: hsCliHttp7 } = localDevHttpImport7;
|
|
3117
3095
|
async function fetchDomains(portalId) {
|
|
3118
3096
|
try {
|
|
3119
|
-
const result = await
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3097
|
+
const result = await hsCliHttp7.get(portalId, {
|
|
3098
|
+
url: `/cms/v3/domains`,
|
|
3099
|
+
params: { portalId },
|
|
3100
|
+
responseType: "json"
|
|
3123
3101
|
});
|
|
3124
3102
|
return result.results;
|
|
3125
3103
|
} catch (error) {
|
|
@@ -3142,7 +3120,8 @@ async function fetchWebsiteDomainNames(portalId) {
|
|
|
3142
3120
|
import path7 from "path";
|
|
3143
3121
|
import fs3 from "fs";
|
|
3144
3122
|
import select from "@inquirer/select";
|
|
3145
|
-
import
|
|
3123
|
+
import localDevHttpImport8 from "@hubspot/local-dev-lib/http";
|
|
3124
|
+
var { default: hsCliHttp8 } = localDevHttpImport8;
|
|
3146
3125
|
var HSPROJECT_JSON = "hsproject.json";
|
|
3147
3126
|
function checkFileExists(filePath) {
|
|
3148
3127
|
return fs3.existsSync(filePath) && fs3.statSync(filePath).isFile();
|
|
@@ -3176,9 +3155,9 @@ async function validateHSPlatform(projectConfigPath, portalId) {
|
|
|
3176
3155
|
const { platformVersion } = hsProjectJSONData;
|
|
3177
3156
|
let platformVersionResult;
|
|
3178
3157
|
try {
|
|
3179
|
-
platformVersionResult = await
|
|
3180
|
-
|
|
3181
|
-
|
|
3158
|
+
platformVersionResult = await hsCliHttp8.get(portalId, {
|
|
3159
|
+
url: `developer/projects/v1/platformVersion`,
|
|
3160
|
+
responseType: "json"
|
|
3182
3161
|
});
|
|
3183
3162
|
} catch (e) {
|
|
3184
3163
|
console.error(e.message);
|
|
@@ -3216,7 +3195,7 @@ async function validateHSPlatform(projectConfigPath, portalId) {
|
|
|
3216
3195
|
}
|
|
3217
3196
|
|
|
3218
3197
|
// src/createDevServer.ts
|
|
3219
|
-
import
|
|
3198
|
+
import localDevHttpImport9 from "@hubspot/local-dev-lib/http";
|
|
3220
3199
|
|
|
3221
3200
|
// ../cms-js-internal/dist/buildFieldsTypes.js
|
|
3222
3201
|
import { writeFileSync } from "fs";
|
|
@@ -3573,11 +3552,13 @@ var startFieldsTypeGenWatcher = (viteServer, projectRoot) => {
|
|
|
3573
3552
|
};
|
|
3574
3553
|
|
|
3575
3554
|
// src/createDevServer.ts
|
|
3555
|
+
var { default: hsCliHttp9 } = localDevHttpImport9;
|
|
3576
3556
|
var BASE_PATH = "/";
|
|
3577
3557
|
var PORT = process.env.PORT ? parseInt(process.env.PORT, 10) : 3e3;
|
|
3578
3558
|
var SHADOW_PORT = 1442;
|
|
3579
3559
|
var STORYBOOK_PORT = process.env.STORYBOOK_PORT ? parseInt(process.env.STORYBOOK_PORT, 10) : 3123;
|
|
3580
3560
|
async function createDevServer(webRoot2, storybook2, hubspotCliConfigPathOption2, hubspotCliAccountNameOption2, sslEnabledOption2, fieldGenEnabledOption2) {
|
|
3561
|
+
var _a;
|
|
3581
3562
|
let authedPortalId = null;
|
|
3582
3563
|
let authedEnv = null;
|
|
3583
3564
|
let jsRenderingGates = [];
|
|
@@ -3608,7 +3589,13 @@ async function createDevServer(webRoot2, storybook2, hubspotCliConfigPathOption2
|
|
|
3608
3589
|
}
|
|
3609
3590
|
if (validateConfig()) {
|
|
3610
3591
|
authedPortalId = getAccountId4(hubspotCliAccountNameOption2);
|
|
3611
|
-
|
|
3592
|
+
const env = getEnv3(hubspotCliAccountNameOption2);
|
|
3593
|
+
if (!env) {
|
|
3594
|
+
throw new Error(
|
|
3595
|
+
`No environment found for account ${hubspotCliAccountNameOption2} from hubspot.config.yaml`
|
|
3596
|
+
);
|
|
3597
|
+
}
|
|
3598
|
+
authedEnv = env;
|
|
3612
3599
|
personalAccessKey = getAccountConfig2(authedPortalId) && getAccountConfig2(authedPortalId).personalAccessKey;
|
|
3613
3600
|
if (!authedPortalId && hubspotCliAccountNameOption2) {
|
|
3614
3601
|
console.error(
|
|
@@ -3656,6 +3643,9 @@ If needed you can refer to another config file with --config.
|
|
|
3656
3643
|
|
|
3657
3644
|
Local proxy functionality and module preview routes will not work without setting up authentication. You can work purely on modules locally at "/module/[module_name]", however the experience may be degraded do to missing account data.`
|
|
3658
3645
|
);
|
|
3646
|
+
if (((_a = cmsAssetConfig.secretNames) == null ? void 0 : _a.length) > 0) {
|
|
3647
|
+
secretNames = cmsAssetConfig.secretNames;
|
|
3648
|
+
}
|
|
3659
3649
|
}
|
|
3660
3650
|
setTrackingInfo(authedPortalId, authedEnv);
|
|
3661
3651
|
sendTrackingRequest("start-dev-server");
|
|
@@ -3680,8 +3670,8 @@ Local proxy functionality and module preview routes will not work without settin
|
|
|
3680
3670
|
}
|
|
3681
3671
|
let authedHublet;
|
|
3682
3672
|
try {
|
|
3683
|
-
const accountInformation = await
|
|
3684
|
-
|
|
3673
|
+
const accountInformation = await hsCliHttp9.get(authedPortalId, {
|
|
3674
|
+
url: "/account-info/v3/details"
|
|
3685
3675
|
});
|
|
3686
3676
|
authedHublet = accountInformation.dataHostingLocation;
|
|
3687
3677
|
} catch (e) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cms-dev-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"publint": "publint --level warning --prod"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@hubspot/
|
|
29
|
-
"@hubspot/
|
|
28
|
+
"@hubspot/cms-components": "^0.16.1",
|
|
29
|
+
"@hubspot/local-dev-lib": "^1.9.0",
|
|
30
30
|
"@inquirer/select": "^2.0.0",
|
|
31
31
|
"@originjs/vite-plugin-commonjs": "^1.0.3",
|
|
32
32
|
"@storybook/addon-actions": "7.1.1",
|
|
@@ -108,5 +108,5 @@
|
|
|
108
108
|
"publishConfig": {
|
|
109
109
|
"access": "public"
|
|
110
110
|
},
|
|
111
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "3814459ca47526e6e103e27fd478b59b2b2805ab"
|
|
112
112
|
}
|