@hubspot/cms-dev-server 1.2.25 → 1.2.27

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
@@ -1631,7 +1631,7 @@ function trackUsage(action) {
1631
1631
  eventName: EVENT_NAME,
1632
1632
  action,
1633
1633
  nodeVersion: getNodeVersionData(),
1634
- version: "1.2.25",
1634
+ version: "1.2.27",
1635
1635
  os: getPlatform()
1636
1636
  };
1637
1637
  const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
@@ -4083,18 +4083,25 @@ var modulePreviewRouteHandler_default = modulePreviewRouteHandler;
4083
4083
  import { http as hsCliHttp9 } from "@hubspot/local-dev-lib/http";
4084
4084
  var hublModuleRouteHandler = async (request, response) => {
4085
4085
  sendTrackingRequest("view-hubl-module-route");
4086
- const { authedPortalId, localPreviewToken } = request.app.locals;
4086
+ const { authedPortalId, localPreviewToken, projectName } = request.app.locals;
4087
4087
  const { modulePath } = request.params;
4088
4088
  if (!modulePath) {
4089
4089
  response.status(200).set({ "Content-Type": "text/html" }).end(buildModuleIndex());
4090
4090
  return;
4091
4091
  }
4092
- const calculatedPath = `@preview/${localPreviewToken}/@projects/${modulePath}.module`;
4092
+ const projectPrefix = projectName ? "@projects/" : "";
4093
+ const calculatedPath = `@preview/${localPreviewToken}/${projectPrefix}${modulePath}.module`;
4093
4094
  let customWidgetInfo;
4094
4095
  try {
4095
4096
  customWidgetInfo = await fetchModuleByPath(authedPortalId, calculatedPath);
4096
4097
  } catch (err) {
4097
- console.log(`Failed to fetch module data for ${calculatedPath}`);
4098
+ console.error(`Failed to fetch module data for ${calculatedPath}: ${err}`);
4099
+ response.status(500).set({ "Content-Type": "text/html" }).end(buildErrorIndex(err));
4100
+ return;
4101
+ }
4102
+ if (!customWidgetInfo || !("moduleId" in customWidgetInfo)) {
4103
+ response.status(500).set({ "Content-Type": "text/html" }).end(buildErrorIndex(null));
4104
+ return;
4098
4105
  }
4099
4106
  const params = {
4100
4107
  module_id: customWidgetInfo.moduleId,
package/dist/run.js CHANGED
@@ -2197,7 +2197,7 @@ function trackUsage(action) {
2197
2197
  eventName: EVENT_NAME,
2198
2198
  action,
2199
2199
  nodeVersion: getNodeVersionData(),
2200
- version: "1.2.25",
2200
+ version: "1.2.27",
2201
2201
  os: getPlatform()
2202
2202
  };
2203
2203
  const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
@@ -4649,18 +4649,25 @@ var modulePreviewRouteHandler_default = modulePreviewRouteHandler;
4649
4649
  import { http as hsCliHttp9 } from "@hubspot/local-dev-lib/http";
4650
4650
  var hublModuleRouteHandler = async (request, response) => {
4651
4651
  sendTrackingRequest("view-hubl-module-route");
4652
- const { authedPortalId, localPreviewToken } = request.app.locals;
4652
+ const { authedPortalId, localPreviewToken, projectName } = request.app.locals;
4653
4653
  const { modulePath } = request.params;
4654
4654
  if (!modulePath) {
4655
4655
  response.status(200).set({ "Content-Type": "text/html" }).end(buildModuleIndex());
4656
4656
  return;
4657
4657
  }
4658
- const calculatedPath = `@preview/${localPreviewToken}/@projects/${modulePath}.module`;
4658
+ const projectPrefix = projectName ? "@projects/" : "";
4659
+ const calculatedPath = `@preview/${localPreviewToken}/${projectPrefix}${modulePath}.module`;
4659
4660
  let customWidgetInfo;
4660
4661
  try {
4661
4662
  customWidgetInfo = await fetchModuleByPath(authedPortalId, calculatedPath);
4662
4663
  } catch (err) {
4663
- console.log(`Failed to fetch module data for ${calculatedPath}`);
4664
+ console.error(`Failed to fetch module data for ${calculatedPath}: ${err}`);
4665
+ response.status(500).set({ "Content-Type": "text/html" }).end(buildErrorIndex(err));
4666
+ return;
4667
+ }
4668
+ if (!customWidgetInfo || !("moduleId" in customWidgetInfo)) {
4669
+ response.status(500).set({ "Content-Type": "text/html" }).end(buildErrorIndex(null));
4670
+ return;
4664
4671
  }
4665
4672
  const params = {
4666
4673
  module_id: customWidgetInfo.moduleId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cms-dev-server",
3
- "version": "1.2.25",
3
+ "version": "1.2.27",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "engines": {
@@ -29,7 +29,7 @@
29
29
  "@babel/parser": "^7.25.3",
30
30
  "@babel/traverse": "^7.25.3",
31
31
  "@babel/types": "^7.25.2",
32
- "@hubspot/cms-components": "^1.2.25",
32
+ "@hubspot/cms-components": "^1.2.27",
33
33
  "@hubspot/local-dev-lib": "4.0.2",
34
34
  "@inquirer/select": "^2.0.0",
35
35
  "@originjs/vite-plugin-commonjs": "^1.0.3",
@@ -133,5 +133,5 @@
133
133
  "publishConfig": {
134
134
  "access": "public"
135
135
  },
136
- "gitHead": "ed0de8e7c0bb6e6228f4482774333c178f84a6bc"
136
+ "gitHead": "1df03a88ffface32bfd8bd56fae3bfb2aac691b3"
137
137
  }