@hubspot/cms-dev-server 0.15.2 → 0.15.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.
@@ -295,6 +295,20 @@ function getServerIncludePrebundleDepPatterns(config) {
295
295
  var _a, _b;
296
296
  return ((_b = (_a = config.buildConfig) == null ? void 0 : _a.serverPrebundling) == null ? void 0 : _b.include) ?? [];
297
297
  }
298
+ var BUILD_INFO_PATH = "/build-info.json";
299
+ function getBuildInfo(buildDir) {
300
+ try {
301
+ const buildInfo = JSON.parse(
302
+ readFileSync(path.join(buildDir, BUILD_INFO_PATH)).toString()
303
+ );
304
+ return buildInfo;
305
+ } catch (e) {
306
+ throw new Error(`Error loading build-info.json, path: ${BUILD_INFO_PATH}`);
307
+ }
308
+ }
309
+ function getBaseAssetUrlFromBuild(buildDir) {
310
+ return getBuildInfo(buildDir).baseAssetUrl;
311
+ }
298
312
  var GATES = [
299
313
  "CMS:JSRenderer:GetServerSideProps",
300
314
  "CMS:JSRenderer:ModuleHubl",
@@ -308,16 +322,11 @@ var ENABLED_FEATURES_GATE_MAP = {
308
322
  function isUngatedFor(gates, gate) {
309
323
  return gates.includes(gate);
310
324
  }
311
- var BUILD_INFO_PATH = "/build-info.json";
312
325
  function ungatedAtBuildTimeFor(buildDir, gate) {
313
326
  try {
314
- console.log("loading path", path.join(buildDir, BUILD_INFO_PATH));
315
- const buildInfo = JSON.parse(
316
- readFileSync(path.join(buildDir, BUILD_INFO_PATH)).toString()
317
- );
327
+ const buildInfo = getBuildInfo(buildDir);
318
328
  return isUngatedFor(buildInfo.gates, gate);
319
329
  } catch (e) {
320
- console.error(`error loading build-info.json, path: ${BUILD_INFO_PATH}`);
321
330
  return false;
322
331
  }
323
332
  }
@@ -802,6 +811,8 @@ export {
802
811
  findAllComponentsIn,
803
812
  findAllModulesInRoot,
804
813
  findAllPartialsInRoot,
814
+ getBaseAssetUrlFromBuild,
815
+ getBuildInfo,
805
816
  getCMSAssetConfig,
806
817
  getCMSAssetConfigIfExists,
807
818
  getCombinedReactUrl,
package/dist/run.js CHANGED
@@ -1044,7 +1044,7 @@ function trackUsage(action) {
1044
1044
  eventName: EVENT_NAME,
1045
1045
  action,
1046
1046
  nodeVersion: getNodeVersionData(),
1047
- version: "0.15.2",
1047
+ version: "0.15.4",
1048
1048
  os: getPlatform()
1049
1049
  };
1050
1050
  const uri = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
@@ -1961,7 +1961,8 @@ var makeProxyPreviewRequest = (accountId, urlToProxy, previewKey, contentId, pro
1961
1961
  ...proxiedQueryParams,
1962
1962
  hs_preview: `${previewKey}-${contentId}`,
1963
1963
  hsLocalProxyProject: localProxyProject,
1964
- localProxySchemaVersion: "2"
1964
+ localProxySchemaVersion: "2",
1965
+ hsLoginVerifyDisabled: `${true}`
1965
1966
  };
1966
1967
  if (renderPreviewLocally) {
1967
1968
  proxiedQueryParams.hsDebugOverridePublicHost = url3.host;
@@ -2526,7 +2527,7 @@ function proxyPathPageResourceRedirect2(req, res, next) {
2526
2527
  if (localDomains.includes(referrerDomain)) {
2527
2528
  domainToProxy = req.app.locals.domainsToProxy[0];
2528
2529
  } else {
2529
- domainToProxy = referrerDomain;
2530
+ domainToProxy = referrerDomain.replace(/\.localhost|\.hslocal\.net/, "");
2530
2531
  }
2531
2532
  } catch (e) {
2532
2533
  console.log("Error parsing referer URL:", e);
@@ -2556,6 +2557,7 @@ function proxyPathPageResourceRedirect2(req, res, next) {
2556
2557
  if (body) {
2557
2558
  proxyLogArgs.push("with body:", body);
2558
2559
  }
2560
+ console.log(...proxyLogArgs);
2559
2561
  switch (method) {
2560
2562
  case "POST":
2561
2563
  case "DELETE":
@@ -2651,7 +2653,8 @@ async function modulePreviewRouteHandler(request2, response) {
2651
2653
  const queryParams = new URLSearchParams({
2652
2654
  portalId: `${authedPortalId}`,
2653
2655
  hsLocalProxy: `${true}`,
2654
- localProxySchemaVersion: "2"
2656
+ localProxySchemaVersion: "2",
2657
+ hsLoginVerifyDisabled: `${true}`
2655
2658
  });
2656
2659
  const currentHubApiDomainOverride = process.env.HUBAPI_DOMAIN_OVERRIDE;
2657
2660
  process.env.HUBAPI_DOMAIN_OVERRIDE = `api.hubspot${authedEnv === "qa" ? "qa" : ""}`;
@@ -190,18 +190,27 @@ function getServerIncludePrebundleDepPatterns(config) {
190
190
  var _a, _b;
191
191
  return ((_b = (_a = config.buildConfig) == null ? void 0 : _a.serverPrebundling) == null ? void 0 : _b.include) ?? [];
192
192
  }
193
+ function getBuildInfo(buildDir) {
194
+ try {
195
+ const buildInfo = JSON.parse(
196
+ readFileSync(path.join(buildDir, BUILD_INFO_PATH)).toString()
197
+ );
198
+ return buildInfo;
199
+ } catch (e) {
200
+ throw new Error(`Error loading build-info.json, path: ${BUILD_INFO_PATH}`);
201
+ }
202
+ }
203
+ function getBaseAssetUrlFromBuild(buildDir) {
204
+ return getBuildInfo(buildDir).baseAssetUrl;
205
+ }
193
206
  function isUngatedFor(gates, gate) {
194
207
  return gates.includes(gate);
195
208
  }
196
209
  function ungatedAtBuildTimeFor(buildDir, gate) {
197
210
  try {
198
- console.log("loading path", path.join(buildDir, BUILD_INFO_PATH));
199
- const buildInfo = JSON.parse(
200
- readFileSync(path.join(buildDir, BUILD_INFO_PATH)).toString()
201
- );
211
+ const buildInfo = getBuildInfo(buildDir);
202
212
  return isUngatedFor(buildInfo.gates, gate);
203
213
  } catch (e) {
204
- console.error(`error loading build-info.json, path: ${BUILD_INFO_PATH}`);
205
214
  return false;
206
215
  }
207
216
  }
@@ -279,7 +288,7 @@ function setIn(object, nestedKeysArray, value) {
279
288
  function isStylesheetAsset(staticAsset) {
280
289
  return staticAsset.type === "stylesheet";
281
290
  }
282
- var COMPONENT_EXTENSIONS, ENTRY_POINTS_PATH, MODULE_FOLDER_PATH, VIRTUAL_ISLAND_RUNTIME, VIRTUAL_CONFIG_SETUP, CSS_LANGS_RE, collectCssModules, collectCssInDev, badInlineJsChars, inlineJsEscapeChars, viteRoot, viteCommand, clientRenderIsland, virtualClientRenderIslandModuleId, scriptTagToLogServerMessages, getComponentExtension, hasComponentExtension, isStorybookStory, removeComponentExtension, COMBINED_REACT_BASE_PATH, ISLAND_RUNTIME_CONFIG_BASE_PATH, removeIndexFromPath, removeIndexOrTrailingJsFromPath, HEALTHCHECKS_ENABLED_DEFAULT, HEALTHCHECKS_STRICT_DEFAULT, GATES, ENABLED_FEATURES_GATE_MAP, BUILD_INFO_PATH, findAllComponentsIn;
291
+ var COMPONENT_EXTENSIONS, ENTRY_POINTS_PATH, MODULE_FOLDER_PATH, VIRTUAL_ISLAND_RUNTIME, VIRTUAL_CONFIG_SETUP, CSS_LANGS_RE, collectCssModules, collectCssInDev, badInlineJsChars, inlineJsEscapeChars, viteRoot, viteCommand, clientRenderIsland, virtualClientRenderIslandModuleId, scriptTagToLogServerMessages, getComponentExtension, hasComponentExtension, isStorybookStory, removeComponentExtension, COMBINED_REACT_BASE_PATH, ISLAND_RUNTIME_CONFIG_BASE_PATH, removeIndexFromPath, removeIndexOrTrailingJsFromPath, HEALTHCHECKS_ENABLED_DEFAULT, HEALTHCHECKS_STRICT_DEFAULT, BUILD_INFO_PATH, GATES, ENABLED_FEATURES_GATE_MAP, findAllComponentsIn;
283
292
  var init_basicUtils = __esm({
284
293
  "../cms-js-internal/dist/basicUtils.js"() {
285
294
  COMPONENT_EXTENSIONS = [".jsx", ".tsx", ".js", ".ts"];
@@ -395,6 +404,7 @@ ${groupEnd}</script>
395
404
  };
396
405
  HEALTHCHECKS_ENABLED_DEFAULT = true;
397
406
  HEALTHCHECKS_STRICT_DEFAULT = false;
407
+ BUILD_INFO_PATH = "/build-info.json";
398
408
  GATES = [
399
409
  "CMS:JSRenderer:GetServerSideProps",
400
410
  "CMS:JSRenderer:ModuleHubl",
@@ -405,7 +415,6 @@ ${groupEnd}</script>
405
415
  "cms:jsr:getServerSideProps": "CMS:JSRenderer:GetServerSideProps",
406
416
  "cms:jsr:RemoveCjsPlugin": "CMS:JSRenderer:RemoveCjsPlugin"
407
417
  };
408
- BUILD_INFO_PATH = "/build-info.json";
409
418
  findAllComponentsIn = (webRoot2, componentsFolder) => {
410
419
  const fullComponentsFolderPath = join(webRoot2, componentsFolder);
411
420
  const componentsByName = {};
@@ -463,6 +472,8 @@ __export(dist_exports, {
463
472
  findAllComponentsIn: () => findAllComponentsIn,
464
473
  findAllModulesInRoot: () => findAllModulesInRoot,
465
474
  findAllPartialsInRoot: () => findAllPartialsInRoot,
475
+ getBaseAssetUrlFromBuild: () => getBaseAssetUrlFromBuild,
476
+ getBuildInfo: () => getBuildInfo,
466
477
  getCMSAssetConfig: () => getCMSAssetConfig,
467
478
  getCMSAssetConfigIfExists: () => getCMSAssetConfigIfExists,
468
479
  getCombinedReactUrl: () => getCombinedReactUrl,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cms-dev-server",
3
- "version": "0.15.2",
3
+ "version": "0.15.4",
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.15.2",
29
+ "@hubspot/cms-components": "^0.15.4",
30
30
  "@inquirer/select": "^2.0.0",
31
31
  "@originjs/vite-plugin-commonjs": "^1.0.3",
32
32
  "@storybook/addon-actions": "7.0.7",
@@ -108,5 +108,5 @@
108
108
  "publishConfig": {
109
109
  "access": "public"
110
110
  },
111
- "gitHead": "d2bf117492d5e76eba9a6dd1addf726b77c7d7ec"
111
+ "gitHead": "8ce65fb54ad49fb85981578c66878bcce383d39d"
112
112
  }