@hubspot/cms-dev-server 0.16.0 → 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 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
@@ -1050,7 +1050,7 @@ function trackUsage(action) {
1050
1050
  eventName: EVENT_NAME,
1051
1051
  action,
1052
1052
  nodeVersion: getNodeVersionData(),
1053
- version: "0.16.0",
1053
+ version: "0.16.1",
1054
1054
  os: getPlatform()
1055
1055
  };
1056
1056
  const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
@@ -1560,29 +1560,7 @@ var module_default = moduleRouteHandler;
1560
1560
  // src/proxyPage/fetchContentMetadata.ts
1561
1561
  import http from "http";
1562
1562
  import https from "https";
1563
- import localDevHttpImport4 from "@hubspot/local-dev-lib/http";
1564
1563
  import { getAccountId } from "@hubspot/local-dev-lib/config";
1565
- var { default: hsCliHttp4 } = localDevHttpImport4;
1566
- async function requestContentPreview(url3, portalId) {
1567
- const urlObject = new URL(url3);
1568
- const proxiedQueryParams = {};
1569
- for (const queryKey of urlObject.searchParams.keys()) {
1570
- const values = urlObject.searchParams.getAll(queryKey);
1571
- if (values.length > 1) {
1572
- proxiedQueryParams[queryKey] = values;
1573
- } else {
1574
- proxiedQueryParams[queryKey] = values[0];
1575
- }
1576
- }
1577
- const accountId = getAccountId(portalId);
1578
- const response = await hsCliHttp4.get(accountId, {
1579
- baseURL: urlObject.origin,
1580
- url: urlObject.pathname,
1581
- params: proxiedQueryParams,
1582
- responseType: "text"
1583
- });
1584
- return response;
1585
- }
1586
1564
  async function requestPage(url3, redirects = 0, originalUrl) {
1587
1565
  if (redirects > 5) {
1588
1566
  throw new Error(
@@ -1620,12 +1598,7 @@ async function requestPage(url3, redirects = 0, originalUrl) {
1620
1598
  });
1621
1599
  }
1622
1600
  async function fetchContentMetadata(url3, portalId) {
1623
- let res;
1624
- if (url3.includes("hs_preview")) {
1625
- res = await requestContentPreview(url3, portalId);
1626
- } else {
1627
- res = await requestPage(url3);
1628
- }
1601
+ const res = await requestPage(url3);
1629
1602
  const portalIdHeader = res.headers["x-hs-hub-id"];
1630
1603
  const contentId = res.headers["x-hs-content-id"];
1631
1604
  if (Array.isArray(portalIdHeader) || Array.isArray(contentId)) {
@@ -1662,7 +1635,7 @@ async function fetchContentMetadata(url3, portalId) {
1662
1635
  import path5 from "path";
1663
1636
  import { normalizePath as normalizePath4 } from "vite";
1664
1637
  import { getAccountId as getAccountId2, getEnv } from "@hubspot/local-dev-lib/config";
1665
- import localDevHttpImport6 from "@hubspot/local-dev-lib/http";
1638
+ import localDevHttpImport5 from "@hubspot/local-dev-lib/http";
1666
1639
 
1667
1640
  // src/lib/proxyHelpers.ts
1668
1641
  import fs2 from "fs";
@@ -1844,8 +1817,8 @@ var renderLocalError_default = (path10, error) => {
1844
1817
  };
1845
1818
 
1846
1819
  // src/proxyPage/fetchPreviewInfo.ts
1847
- import localDevHttpImport5 from "@hubspot/local-dev-lib/http";
1848
- var { default: hsCliHttp5 } = localDevHttpImport5;
1820
+ import localDevHttpImport4 from "@hubspot/local-dev-lib/http";
1821
+ var { default: hsCliHttp4 } = localDevHttpImport4;
1849
1822
  var fetchPreviewInfo_default = async (accountId, portalId, contentId) => {
1850
1823
  if (!contentId) {
1851
1824
  throw new Error(
@@ -1853,7 +1826,7 @@ var fetchPreviewInfo_default = async (accountId, portalId, contentId) => {
1853
1826
  );
1854
1827
  }
1855
1828
  try {
1856
- const content = await hsCliHttp5.get(accountId, {
1829
+ const content = await hsCliHttp4.get(accountId, {
1857
1830
  url: `/content/api/v4/contents/${contentId}`,
1858
1831
  params: { portalId },
1859
1832
  responseType: "json"
@@ -1892,7 +1865,7 @@ import {
1892
1865
  isDebugUrlString as isDebugUrlString3,
1893
1866
  mergeServerRequestData_internal
1894
1867
  } from "@hubspot/cms-components";
1895
- var { default: hsCliHttp6 } = localDevHttpImport6;
1868
+ var { default: hsCliHttp5 } = localDevHttpImport5;
1896
1869
  var getEntryPointBasePathFromProxyRequest = (request2) => {
1897
1870
  if (!request2) {
1898
1871
  return "";
@@ -1953,15 +1926,13 @@ var makeProxyPreviewRequest = (accountId, urlToProxy, previewKey, contentId, pro
1953
1926
  contentId
1954
1927
  }).toString()}`
1955
1928
  );
1956
- const result = hsCliHttp6.get(accountId, {
1929
+ const result = hsCliHttp5.get(accountId, {
1957
1930
  baseURL,
1958
1931
  url: pathname,
1959
1932
  params: proxiedQueryParams,
1960
1933
  responseType: "text",
1961
- // Maybe we can remove the user agent?
1962
1934
  headers: {
1963
- COOKIE: cookieHeader,
1964
- "User-Agent": "HubSpot CMS Dev Server"
1935
+ COOKIE: cookieHeader
1965
1936
  }
1966
1937
  });
1967
1938
  return result.catch((error) => {
@@ -2557,8 +2528,8 @@ function proxyServerlessRequest(req, res, next) {
2557
2528
  import { buildStaticEnvConfig as buildStaticEnvConfig4 } from "@hubspot/cms-components";
2558
2529
  import path6 from "path";
2559
2530
  import { normalizePath as normalizePath5 } from "vite";
2560
- import localDevHttpImport7 from "@hubspot/local-dev-lib/http";
2561
- var { default: hsCliHttp7 } = localDevHttpImport7;
2531
+ import localDevHttpImport6 from "@hubspot/local-dev-lib/http";
2532
+ var { default: hsCliHttp6 } = localDevHttpImport6;
2562
2533
  async function modulePreviewRouteHandler(request2, response) {
2563
2534
  sendTrackingRequest("view-module-preview-route");
2564
2535
  const {
@@ -2634,7 +2605,7 @@ async function modulePreviewRouteHandler(request2, response) {
2634
2605
  });
2635
2606
  const currentHubApiDomainOverride = process.env.HUBAPI_DOMAIN_OVERRIDE;
2636
2607
  process.env.HUBAPI_DOMAIN_OVERRIDE = `api.hubspot${authedEnv === "qa" ? "qa" : ""}`;
2637
- const templatePreviewPromise = hsCliHttp7.post(authedPortalId, {
2608
+ const templatePreviewPromise = hsCliHttp6.post(authedPortalId, {
2638
2609
  url: `/api/cos-rendering/v1/public/_hcms/preview/template/multiform?${queryParams}`,
2639
2610
  headers: {
2640
2611
  ["content-type"]: "application/x-www-form-urlencoded",
@@ -2907,6 +2878,9 @@ function devSecretsPlugin(secretNames) {
2907
2878
  "@hubspot/cms-components"
2908
2879
  );
2909
2880
  if (cmsComponents3.setSecretsFromEnv) {
2881
+ console.log(
2882
+ `Attempting to load HS_* secrets from .env: ${secretNames}`
2883
+ );
2910
2884
  cmsComponents3.setSecretsFromEnv(secretNames);
2911
2885
  } else if (secretNames.length > 0) {
2912
2886
  console.warn(
@@ -3061,7 +3035,7 @@ import {
3061
3035
  import { fetchSecrets } from "@hubspot/local-dev-lib/api/secrets";
3062
3036
 
3063
3037
  // src/proxyPage/fetchDomains.ts
3064
- import localDevHttpImport8 from "@hubspot/local-dev-lib/http";
3038
+ import localDevHttpImport7 from "@hubspot/local-dev-lib/http";
3065
3039
 
3066
3040
  // src/lib/errors.ts
3067
3041
  var MISSING_SCOPE_ERROR_PREFIX = `Your personal access key is missing required scopes fetch domains.
@@ -3117,10 +3091,10 @@ function handleSecretsError(error) {
3117
3091
  }
3118
3092
 
3119
3093
  // src/proxyPage/fetchDomains.ts
3120
- var { default: hsCliHttp8 } = localDevHttpImport8;
3094
+ var { default: hsCliHttp7 } = localDevHttpImport7;
3121
3095
  async function fetchDomains(portalId) {
3122
3096
  try {
3123
- const result = await hsCliHttp8.get(portalId, {
3097
+ const result = await hsCliHttp7.get(portalId, {
3124
3098
  url: `/cms/v3/domains`,
3125
3099
  params: { portalId },
3126
3100
  responseType: "json"
@@ -3146,8 +3120,8 @@ async function fetchWebsiteDomainNames(portalId) {
3146
3120
  import path7 from "path";
3147
3121
  import fs3 from "fs";
3148
3122
  import select from "@inquirer/select";
3149
- import localDevHttpImport9 from "@hubspot/local-dev-lib/http";
3150
- var { default: hsCliHttp9 } = localDevHttpImport9;
3123
+ import localDevHttpImport8 from "@hubspot/local-dev-lib/http";
3124
+ var { default: hsCliHttp8 } = localDevHttpImport8;
3151
3125
  var HSPROJECT_JSON = "hsproject.json";
3152
3126
  function checkFileExists(filePath) {
3153
3127
  return fs3.existsSync(filePath) && fs3.statSync(filePath).isFile();
@@ -3181,7 +3155,7 @@ async function validateHSPlatform(projectConfigPath, portalId) {
3181
3155
  const { platformVersion } = hsProjectJSONData;
3182
3156
  let platformVersionResult;
3183
3157
  try {
3184
- platformVersionResult = await hsCliHttp9.get(portalId, {
3158
+ platformVersionResult = await hsCliHttp8.get(portalId, {
3185
3159
  url: `developer/projects/v1/platformVersion`,
3186
3160
  responseType: "json"
3187
3161
  });
@@ -3221,7 +3195,7 @@ async function validateHSPlatform(projectConfigPath, portalId) {
3221
3195
  }
3222
3196
 
3223
3197
  // src/createDevServer.ts
3224
- import localDevHttpImport10 from "@hubspot/local-dev-lib/http";
3198
+ import localDevHttpImport9 from "@hubspot/local-dev-lib/http";
3225
3199
 
3226
3200
  // ../cms-js-internal/dist/buildFieldsTypes.js
3227
3201
  import { writeFileSync } from "fs";
@@ -3578,12 +3552,13 @@ var startFieldsTypeGenWatcher = (viteServer, projectRoot) => {
3578
3552
  };
3579
3553
 
3580
3554
  // src/createDevServer.ts
3581
- var { default: hsCliHttp10 } = localDevHttpImport10;
3555
+ var { default: hsCliHttp9 } = localDevHttpImport9;
3582
3556
  var BASE_PATH = "/";
3583
3557
  var PORT = process.env.PORT ? parseInt(process.env.PORT, 10) : 3e3;
3584
3558
  var SHADOW_PORT = 1442;
3585
3559
  var STORYBOOK_PORT = process.env.STORYBOOK_PORT ? parseInt(process.env.STORYBOOK_PORT, 10) : 3123;
3586
3560
  async function createDevServer(webRoot2, storybook2, hubspotCliConfigPathOption2, hubspotCliAccountNameOption2, sslEnabledOption2, fieldGenEnabledOption2) {
3561
+ var _a;
3587
3562
  let authedPortalId = null;
3588
3563
  let authedEnv = null;
3589
3564
  let jsRenderingGates = [];
@@ -3668,6 +3643,9 @@ If needed you can refer to another config file with --config.
3668
3643
 
3669
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.`
3670
3645
  );
3646
+ if (((_a = cmsAssetConfig.secretNames) == null ? void 0 : _a.length) > 0) {
3647
+ secretNames = cmsAssetConfig.secretNames;
3648
+ }
3671
3649
  }
3672
3650
  setTrackingInfo(authedPortalId, authedEnv);
3673
3651
  sendTrackingRequest("start-dev-server");
@@ -3692,7 +3670,7 @@ Local proxy functionality and module preview routes will not work without settin
3692
3670
  }
3693
3671
  let authedHublet;
3694
3672
  try {
3695
- const accountInformation = await hsCliHttp10.get(authedPortalId, {
3673
+ const accountInformation = await hsCliHttp9.get(authedPortalId, {
3696
3674
  url: "/account-info/v3/details"
3697
3675
  });
3698
3676
  authedHublet = accountInformation.dataHostingLocation;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cms-dev-server",
3
- "version": "0.16.0",
3
+ "version": "0.16.1",
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.0",
28
+ "@hubspot/cms-components": "^0.16.1",
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": "94e33a0713c66a56bb8f9e7b7b83eb119a2bcd70"
111
+ "gitHead": "3814459ca47526e6e103e27fd478b59b2b2805ab"
112
112
  }