@hubspot/cms-dev-server 0.18.15 → 0.18.18

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 CHANGED
@@ -795,7 +795,7 @@ function packagePath(metaUrl, projectPath) {
795
795
  );
796
796
  }
797
797
 
798
- // ../cms-js-internal/dist/types-DGdcEHv3.js
798
+ // ../cms-js-internal/dist/types-CsJ4tzsl.js
799
799
  import path3 from "path";
800
800
  import { createHash } from "crypto";
801
801
  import fs2, { readFileSync, existsSync as existsSync2, readdirSync, lstatSync } from "fs";
@@ -1017,11 +1017,15 @@ function findAllModulesInRoot(webRoot2) {
1017
1017
  );
1018
1018
  const moduleSubpaths = Object.keys(allModuleComponents);
1019
1019
  const moduleExtensions = Object.values(allModuleComponents).map((path22) => {
1020
- const extension = (path22 == null ? void 0 : path22.split(".").pop()) || "";
1020
+ if (!path22)
1021
+ return "";
1022
+ const extension = path22.split(".").pop() || "";
1021
1023
  return extension;
1022
1024
  });
1023
1025
  const moduleNamesWithExtension = Object.values(allModuleComponents).map(
1024
1026
  (path22) => {
1027
+ if (!path22)
1028
+ return "";
1025
1029
  const file = path22.replace("components/modules/", "");
1026
1030
  return file.includes("/index.") ? file.split("/index.")[0] : file;
1027
1031
  }
@@ -1150,6 +1154,14 @@ var serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestD
1150
1154
  if (isUngatedForClientOnlySupplementalFieldSerialization && output.clientOnly) {
1151
1155
  output.supplementalFieldValues = supplementalFieldValues;
1152
1156
  }
1157
+ if (output.supplementalFieldValues) {
1158
+ output.supplementalFieldValues = Object.keys(
1159
+ output.supplementalFieldValues
1160
+ ).sort().reduce((acc, key) => {
1161
+ acc[key] = output.supplementalFieldValues[key];
1162
+ return acc;
1163
+ }, {});
1164
+ }
1153
1165
  return output;
1154
1166
  }
1155
1167
  );
@@ -1302,7 +1314,7 @@ function findCmsModules(buildContentDescriptors = {}) {
1302
1314
  },
1303
1315
  transform(code, id) {
1304
1316
  const moduleInfo = this.getModuleInfo(id);
1305
- if (shouldSkipModule(config, moduleInfo, code))
1317
+ if (!shouldAnalyzeModule(config, moduleInfo, code))
1306
1318
  return null;
1307
1319
  const contentDescriptors = analyzeSourceCodeUsages(
1308
1320
  this,
@@ -1317,7 +1329,6 @@ function findCmsModules(buildContentDescriptors = {}) {
1317
1329
  }
1318
1330
  };
1319
1331
  }
1320
- return null;
1321
1332
  },
1322
1333
  buildEnd(error) {
1323
1334
  if (error)
@@ -1389,9 +1400,14 @@ function convertEntryPointIslandPathsToRelative(config, entryPointsCmsModuleMap)
1389
1400
  function toRelativePath(config, path16) {
1390
1401
  return path16.replace(`${config.root}/`, "");
1391
1402
  }
1392
- function shouldSkipModule(config, moduleInfo, code) {
1403
+ function shouldAnalyzeModule(config, moduleInfo, code) {
1404
+ const [fileId, __] = moduleInfo.id.split("?");
1393
1405
  const isExternal = config.command !== "serve" && moduleInfo.isExternal;
1394
- return isExternal || !moduleInfo.id.startsWith(config.root) || !(code.includes(CMS_MODULE_COMPONENT_NAME) || code.includes(DND_AREA_COMPONENT_NAME));
1406
+ return (
1407
+ // analyze customer code only
1408
+ !isExternal && moduleInfo.id.startsWith(config.root) && // jsx files that contain "Module" / "DndArea"
1409
+ (fileId.endsWith(".tsx") || fileId.endsWith(".jsx")) && (code.includes(CMS_MODULE_COMPONENT_NAME) || code.includes(DND_AREA_COMPONENT_NAME))
1410
+ );
1395
1411
  }
1396
1412
  function getEntryPoints(ctx, config) {
1397
1413
  return Array.from(ctx.getModuleIds()).filter((moduleId) => moduleId.startsWith(config.root)).map((moduleId) => ctx.getModuleInfo(moduleId)).filter((moduleInfo) => moduleInfo.isEntry);
@@ -2073,7 +2089,7 @@ function trackUsage(action) {
2073
2089
  eventName: EVENT_NAME,
2074
2090
  action,
2075
2091
  nodeVersion: getNodeVersionData(),
2076
- version: "0.18.15",
2092
+ version: "0.18.18",
2077
2093
  os: getPlatform()
2078
2094
  };
2079
2095
  const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
@@ -2576,7 +2592,8 @@ var fetchPreviewInfo_default = async (accountId, portalId, contentId) => {
2576
2592
  })).data;
2577
2593
  return {
2578
2594
  previewDomain: content.previewDomain ?? content.resolvedDomain,
2579
- previewKey: content.previewKey
2595
+ previewKey: content.previewKey,
2596
+ templatePath: content.templatePath
2580
2597
  };
2581
2598
  } catch (error) {
2582
2599
  if (error.statusCode === 403 && error.error.message.match(
@@ -4676,32 +4693,27 @@ import express from "express";
4676
4693
 
4677
4694
  // src/shadowDevServer/createShadowDevServerRoutes.ts
4678
4695
  import { Router as Router2 } from "express";
4679
- import { getAccountId as getAccountId3, getEnv as getEnv3 } from "@hubspot/local-dev-lib/config";
4696
+ import { getAccountId as getAccountId3 } from "@hubspot/local-dev-lib/config";
4680
4697
  import cors from "cors";
4681
- import { buildStaticEnvConfig as buildStaticEnvConfig6 } from "@hubspot/cms-components";
4682
- function getShadowDevServerCheckHandler(devServerPort, projectName, gates) {
4698
+ function getShadowDevServerCheckHandler(devServerPort, themePath) {
4683
4699
  return async function shadowDevServerCheckHandler(request2, response) {
4684
4700
  const { query } = request2;
4685
4701
  if (query) {
4686
4702
  const {
4687
4703
  hostName,
4688
4704
  pathName,
4689
- protocol,
4690
4705
  contentId,
4691
4706
  portalId: portalIdString
4692
4707
  } = query;
4693
- const pageUrl = `${protocol}//${hostName}${pathName}`;
4694
4708
  const portalId = parseInt(portalIdString, 10);
4695
- let proxyEnv;
4696
4709
  let accountId;
4697
- let hasJSBuildingBlocks = false;
4710
+ let isTemplateFromDevTheme = false;
4698
4711
  let localProxyUrl;
4699
4712
  try {
4700
4713
  accountId = getAccountId3(portalId);
4701
4714
  if (accountId === null) {
4702
4715
  throw new Error();
4703
4716
  }
4704
- proxyEnv = getEnv3(accountId);
4705
4717
  } catch (e) {
4706
4718
  response.status(500).end(
4707
4719
  `Unable to find account for hubid = ${portalId}. Please check your hubspot.config.yaml`
@@ -4709,37 +4721,19 @@ function getShadowDevServerCheckHandler(devServerPort, projectName, gates) {
4709
4721
  return;
4710
4722
  }
4711
4723
  try {
4712
- const previewInfo = await fetchPreviewInfo_default(
4724
+ const { templatePath } = await fetchPreviewInfo_default(
4713
4725
  accountId,
4714
4726
  portalId,
4715
4727
  contentId
4716
4728
  );
4717
- const { previewKey } = previewInfo;
4718
- const environmentConfig = buildStaticEnvConfig6(
4719
- portalId,
4720
- "na1",
4721
- // bad lazy TF (but does it really matter for this check)
4722
- proxyEnv,
4723
- false,
4724
- gates
4725
- );
4726
- const pageHtml = await makeProxyPreviewRequest(
4727
- accountId,
4728
- pageUrl,
4729
- previewKey,
4730
- contentId,
4731
- projectName,
4732
- environmentConfig,
4733
- gates
4734
- );
4735
- const localRenderPlaceholders = findLocalRenderPlaceholders(
4736
- pageHtml.data
4737
- );
4738
- if (localRenderPlaceholders.length) {
4739
- hasJSBuildingBlocks = true;
4729
+ if (templatePath.startsWith(themePath)) {
4730
+ isTemplateFromDevTheme = true;
4740
4731
  localProxyUrl = `http://${hostName}.hslocal.net:${devServerPort}${pathName}`;
4741
4732
  }
4742
- response.status(200).set({ "Content-Type": "application/json" }).json({ hasJSBuildingBlocks, localProxyUrl });
4733
+ response.status(200).set({ "Content-Type": "application/json" }).json({
4734
+ isTemplateFromDevTheme,
4735
+ localProxyUrl
4736
+ });
4743
4737
  } catch (error) {
4744
4738
  response.status(500).end(
4745
4739
  `Failed proxy render of page id = ${contentId} hub id = ${portalId}
@@ -4755,19 +4749,19 @@ ${error.stack}`
4755
4749
  }
4756
4750
  };
4757
4751
  }
4758
- async function createShadowDevServerRoutes(devServerPort, projectName, gates) {
4752
+ async function createShadowDevServerRoutes(devServerPort, themePath) {
4759
4753
  const shadowDevServerRoutes = Router2();
4760
4754
  shadowDevServerRoutes.get(
4761
4755
  "/check-if-local-dev-server",
4762
4756
  cors(),
4763
- getShadowDevServerCheckHandler(devServerPort, projectName, gates)
4757
+ getShadowDevServerCheckHandler(devServerPort, themePath)
4764
4758
  );
4765
4759
  return shadowDevServerRoutes;
4766
4760
  }
4767
4761
 
4768
4762
  // src/shadowDevServer/startShadowDevServer.ts
4769
4763
  var testNetServer = net.createServer();
4770
- async function startShadowDevServer(devServerPort, shadowPort, projectName, jsRenderingGates) {
4764
+ async function startShadowDevServer(devServerPort, shadowPort, themePath) {
4771
4765
  const portIsTaken = await new Promise((res, rej) => {
4772
4766
  console.log(`Starting proxy link server on port ${shadowPort}`);
4773
4767
  testNetServer.once("error", (err) => {
@@ -4795,11 +4789,7 @@ async function startShadowDevServer(devServerPort, shadowPort, projectName, jsRe
4795
4789
  shadowDevServer.listen(shadowPort);
4796
4790
  shadowDevServer.use(
4797
4791
  "/",
4798
- await createShadowDevServerRoutes(
4799
- devServerPort,
4800
- projectName,
4801
- jsRenderingGates
4802
- )
4792
+ await createShadowDevServerRoutes(devServerPort, themePath)
4803
4793
  );
4804
4794
  }
4805
4795
 
@@ -4810,26 +4800,15 @@ import { default as mkcert } from "vite-plugin-mkcert";
4810
4800
  import { viteCommonjs } from "@originjs/vite-plugin-commonjs";
4811
4801
 
4812
4802
  // src/plugins/devSecretsPlugin.ts
4813
- function devSecretsPlugin(secretNames) {
4803
+ function devSecretsPlugin(secretNames = []) {
4814
4804
  return {
4815
4805
  name: "dev-secrets",
4816
- configureServer: {
4817
- order: "post",
4818
- async handler(server) {
4819
- const cmsComponents3 = await server.ssrLoadModule(
4820
- "@hubspot/cms-components"
4821
- );
4822
- if (cmsComponents3.setSecretsFromEnv) {
4823
- console.log(
4824
- `Attempting to load HS_* secrets from .env: ${secretNames}`
4825
- );
4826
- cmsComponents3.setSecretsFromEnv(secretNames);
4827
- } else if (secretNames.length > 0) {
4828
- console.warn(
4829
- "Not loading secrets into the local environment. Make sure that your @hubspot/cms-components and @hubspot/cms-dev-server package versions match."
4830
- );
4806
+ config: () => {
4807
+ return {
4808
+ define: {
4809
+ "import.meta.env.secretNames": secretNames
4831
4810
  }
4832
- }
4811
+ };
4833
4812
  }
4834
4813
  };
4835
4814
  }
@@ -4931,7 +4910,7 @@ import { default as react2 } from "@vitejs/plugin-react";
4931
4910
  // src/lib/getDevServerUIData.ts
4932
4911
  import path12 from "path";
4933
4912
  import { normalizePath as normalizePath8 } from "vite";
4934
- function mapModulesData(modules, themeWebRoot, viteServer) {
4913
+ function mapReactModules(modules, themeWebRoot, viteServer) {
4935
4914
  return Promise.all(
4936
4915
  modules.moduleNames.map(async (name, index) => {
4937
4916
  const modulePath = normalizePath8(
@@ -4940,6 +4919,7 @@ function mapModulesData(modules, themeWebRoot, viteServer) {
4940
4919
  const fieldsJson = await renderModuleFieldsJson_default(viteServer, modulePath);
4941
4920
  return {
4942
4921
  name,
4922
+ type: "react" /* REACT */,
4943
4923
  subPath: modules.moduleSubpaths[index],
4944
4924
  nameWithExtension: modules.moduleNamesWithExtension[index],
4945
4925
  extension: modules.moduleExtensions[index],
@@ -4948,10 +4928,25 @@ function mapModulesData(modules, themeWebRoot, viteServer) {
4948
4928
  })
4949
4929
  );
4950
4930
  }
4951
- function mapPartialsData(modules) {
4952
- return modules.partialNames.map((name, index) => ({
4931
+ function normalizeHubLModules(modules) {
4932
+ return modules.map((module) => ({
4933
+ name: module.name,
4934
+ type: "hubl" /* HUBL */,
4935
+ subPath: `@projects/${module.path.split("/@projects/")[1] || module.path}`,
4936
+ nameWithExtension: module.filename,
4937
+ fieldsJson: module.fields
4938
+ }));
4939
+ }
4940
+ function normalizePartialsData(partialData) {
4941
+ return partialData.partialNames.map((name, index) => ({
4953
4942
  name,
4954
- subPath: modules.partialSubpaths[index]
4943
+ subPath: partialData.partialSubpaths[index]
4944
+ }));
4945
+ }
4946
+ function normalizeTemplatesData(templates) {
4947
+ return templates.map((template) => ({
4948
+ name: template.displayName || template.label,
4949
+ subPath: `@projects/${template.path.split("/@projects/")[1] || template.path}`
4955
4950
  }));
4956
4951
  }
4957
4952
  async function getDevServerUIData(reqLocals) {
@@ -4966,7 +4961,7 @@ async function getDevServerUIData(reqLocals) {
4966
4961
  } = reqLocals;
4967
4962
  const modulesData = findAllModulesInRoot(themeWebRoot);
4968
4963
  const partialsData = findAllPartialsInRoot(themeWebRoot);
4969
- const mappedModulesData = await mapModulesData(
4964
+ const reactModules = await mapReactModules(
4970
4965
  modulesData,
4971
4966
  themeWebRoot,
4972
4967
  viteServer
@@ -4983,14 +4978,15 @@ async function getDevServerUIData(reqLocals) {
4983
4978
  const hubLTemplates = (hubLTemplateData == null ? void 0 : hubLTemplateData.objects.filter(
4984
4979
  (template) => isCodedFile(template.filename)
4985
4980
  )) || [];
4981
+ const mappedHubLModules = normalizeHubLModules((hubLModuleData == null ? void 0 : hubLModuleData.objects) || []);
4986
4982
  return {
4987
4983
  authedPortalId,
4988
4984
  authedEnv,
4989
4985
  projectName,
4990
- modulesData: mappedModulesData,
4991
- partialsData: mapPartialsData(partialsData),
4992
- hubLModules: (hubLModuleData == null ? void 0 : hubLModuleData.objects) || [],
4993
- hubLTemplates,
4986
+ modulesData: reactModules,
4987
+ partialsData: normalizePartialsData(partialsData),
4988
+ hubLModules: mappedHubLModules || [],
4989
+ hubLTemplates: normalizeTemplatesData(hubLTemplates),
4994
4990
  themeWebRoot,
4995
4991
  webRootProjectComponentFolder
4996
4992
  };
@@ -5202,7 +5198,7 @@ async function getJsRenderingGates(portalId, env2, personalAccessKey) {
5202
5198
 
5203
5199
  // src/createDevServer.ts
5204
5200
  import {
5205
- getEnv as getEnv4,
5201
+ getEnv as getEnv3,
5206
5202
  getAccountId as getAccountId4,
5207
5203
  getAccountConfig as getAccountConfig3,
5208
5204
  loadConfig,
@@ -5767,7 +5763,7 @@ async function createDevServer(webRoot2, storybook2, hubspotCliConfigPathOption2
5767
5763
  secretNamesFromConfig = getSecretNamesFromConfig(cmsAssetConfig);
5768
5764
  if (validateConfig()) {
5769
5765
  authedPortalId = getAccountId4(hubspotCliAccountNameOption2);
5770
- const env2 = getEnv4(hubspotCliAccountNameOption2);
5766
+ const env2 = getEnv3(hubspotCliAccountNameOption2);
5771
5767
  if (!env2) {
5772
5768
  throw new Error(
5773
5769
  `No environment found for account ${hubspotCliAccountNameOption2} from hubspot.config.yaml`
@@ -5932,7 +5928,11 @@ Local proxy functionality and module preview routes will not work without settin
5932
5928
  httpServers.push(httpServer);
5933
5929
  }
5934
5930
  if (!process.env.IN_CODESANDBOX && !process.env.CODESANDBOX_HOST) {
5935
- startShadowDevServer(PORT, SHADOW_PORT, projectName, jsRenderingGates);
5931
+ startShadowDevServer(
5932
+ PORT,
5933
+ SHADOW_PORT,
5934
+ themePreviewOptions2 ? themePreviewOptions2.dest : ""
5935
+ );
5936
5936
  }
5937
5937
  let extraServerInfo = "";
5938
5938
  const protocol = sslEnabledOption2 ? "https" : "http";
@@ -1,7 +1,7 @@
1
1
  // src/storybook/moduleStory.tsx
2
2
  import { useEffect } from "react";
3
3
 
4
- // ../cms-js-internal/dist/types-DGdcEHv3.js
4
+ // ../cms-js-internal/dist/types-CsJ4tzsl.js
5
5
  function namespaceModulePropsShape(props) {
6
6
  const {
7
7
  dataQueryResult,
@@ -8,7 +8,7 @@ var __export = (target, all) => {
8
8
  __defProp(target, name, { get: all[name], enumerable: true });
9
9
  };
10
10
 
11
- // ../cms-js-internal/dist/types-DGdcEHv3.js
11
+ // ../cms-js-internal/dist/types-CsJ4tzsl.js
12
12
  import path from "path";
13
13
  import { createHash } from "crypto";
14
14
  import fs, { readFileSync, existsSync, readdirSync, lstatSync } from "fs";
@@ -229,11 +229,15 @@ function findAllModulesInRoot(webRoot2) {
229
229
  );
230
230
  const moduleSubpaths = Object.keys(allModuleComponents);
231
231
  const moduleExtensions = Object.values(allModuleComponents).map((path22) => {
232
- const extension = (path22 == null ? void 0 : path22.split(".").pop()) || "";
232
+ if (!path22)
233
+ return "";
234
+ const extension = path22.split(".").pop() || "";
233
235
  return extension;
234
236
  });
235
237
  const moduleNamesWithExtension = Object.values(allModuleComponents).map(
236
238
  (path22) => {
239
+ if (!path22)
240
+ return "";
237
241
  const file = path22.replace("components/modules/", "");
238
242
  return file.includes("/index.") ? file.split("/index.")[0] : file;
239
243
  }
@@ -309,8 +313,8 @@ function isStylesheetAsset(staticAsset) {
309
313
  return staticAsset.type === "stylesheet";
310
314
  }
311
315
  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;
312
- var init_types_DGdcEHv3 = __esm({
313
- "../cms-js-internal/dist/types-DGdcEHv3.js"() {
316
+ var init_types_CsJ4tzsl = __esm({
317
+ "../cms-js-internal/dist/types-CsJ4tzsl.js"() {
314
318
  COMPONENT_EXTENSIONS = [".jsx", ".tsx", ".js", ".ts"];
315
319
  ENTRY_POINTS_PATH = "components/partials/";
316
320
  MODULE_FOLDER_PATH = "components/modules/";
@@ -639,7 +643,7 @@ function findCmsModules(buildContentDescriptors = {}) {
639
643
  },
640
644
  transform(code, id) {
641
645
  const moduleInfo = this.getModuleInfo(id);
642
- if (shouldSkipModule(config, moduleInfo, code))
646
+ if (!shouldAnalyzeModule(config, moduleInfo, code))
643
647
  return null;
644
648
  const contentDescriptors = analyzeSourceCodeUsages(
645
649
  this,
@@ -654,7 +658,6 @@ function findCmsModules(buildContentDescriptors = {}) {
654
658
  }
655
659
  };
656
660
  }
657
- return null;
658
661
  },
659
662
  buildEnd(error) {
660
663
  if (error)
@@ -726,9 +729,14 @@ function convertEntryPointIslandPathsToRelative(config, entryPointsCmsModuleMap)
726
729
  function toRelativePath(config, path3) {
727
730
  return path3.replace(`${config.root}/`, "");
728
731
  }
729
- function shouldSkipModule(config, moduleInfo, code) {
732
+ function shouldAnalyzeModule(config, moduleInfo, code) {
733
+ const [fileId, __] = moduleInfo.id.split("?");
730
734
  const isExternal = config.command !== "serve" && moduleInfo.isExternal;
731
- return isExternal || !moduleInfo.id.startsWith(config.root) || !(code.includes(CMS_MODULE_COMPONENT_NAME) || code.includes(DND_AREA_COMPONENT_NAME));
735
+ return (
736
+ // analyze customer code only
737
+ !isExternal && moduleInfo.id.startsWith(config.root) && // jsx files that contain "Module" / "DndArea"
738
+ (fileId.endsWith(".tsx") || fileId.endsWith(".jsx")) && (code.includes(CMS_MODULE_COMPONENT_NAME) || code.includes(DND_AREA_COMPONENT_NAME))
739
+ );
732
740
  }
733
741
  function getEntryPoints(ctx, config) {
734
742
  return Array.from(ctx.getModuleIds()).filter((moduleId) => moduleId.startsWith(config.root)).map((moduleId) => ctx.getModuleInfo(moduleId)).filter((moduleInfo) => moduleInfo.isEntry);
@@ -1063,8 +1071,8 @@ function renderFieldsToJson(fields, moduleName) {
1063
1071
  var setProperty, getProperty, hasProperty, serializeIslandDataForInlineScript, writeSharedStateToJsGlobal, createIslandsGlobalJsForClientInDev, traverse, CMS_MODULE_COMPONENT_NAME, DND_AREA_COMPONENT_NAME, PLUGIN_NAME, promiseForNewWritableStream, renderStreamToPromise, createServerRenderContextV22, createServerRenderContext2, renderServerSidePropsWithAsyncLocalStoreContext, bootStrapRenderContext;
1064
1072
  var init_dist = __esm({
1065
1073
  "../cms-js-internal/dist/index.js"() {
1066
- init_types_DGdcEHv3();
1067
- init_types_DGdcEHv3();
1074
+ init_types_CsJ4tzsl();
1075
+ init_types_CsJ4tzsl();
1068
1076
  ({ setProperty, getProperty, hasProperty } = dotProp);
1069
1077
  serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestData, baseIndent = 0, prettyPrint, isUngatedForClientOnlySupplementalFieldSerialization = false) => {
1070
1078
  const islandsArrayToSerialize = tweakedIslandsArray.map(
@@ -1111,6 +1119,14 @@ var init_dist = __esm({
1111
1119
  if (isUngatedForClientOnlySupplementalFieldSerialization && output.clientOnly) {
1112
1120
  output.supplementalFieldValues = supplementalFieldValues;
1113
1121
  }
1122
+ if (output.supplementalFieldValues) {
1123
+ output.supplementalFieldValues = Object.keys(
1124
+ output.supplementalFieldValues
1125
+ ).sort().reduce((acc, key) => {
1126
+ acc[key] = output.supplementalFieldValues[key];
1127
+ return acc;
1128
+ }, {});
1129
+ }
1114
1130
  return output;
1115
1131
  }
1116
1132
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cms-dev-server",
3
- "version": "0.18.15",
3
+ "version": "0.18.18",
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": "^0.18.15",
32
+ "@hubspot/cms-components": "^0.18.18",
33
33
  "@hubspot/local-dev-lib": "2.0.1",
34
34
  "@inquirer/select": "^2.0.0",
35
35
  "@originjs/vite-plugin-commonjs": "^1.0.3",
@@ -130,5 +130,5 @@
130
130
  "publishConfig": {
131
131
  "access": "public"
132
132
  },
133
- "gitHead": "c7606b055fa33813e2b374d6699cc1ef06aede4f"
133
+ "gitHead": "49628d53d7bcdfbd68471aac97d8c1b97e7603af"
134
134
  }
@@ -10,12 +10,16 @@ export interface HubLModule {
10
10
  name: string;
11
11
  path: string;
12
12
  previewKey: string;
13
+ filename: string;
14
+ fields: any[];
15
+ folderPath: string;
13
16
  }
14
17
  export interface HubLTemplate {
15
18
  path: string;
16
19
  label: string;
17
20
  previewKey: string;
18
21
  filename: string;
22
+ displayName: string;
19
23
  }
20
24
  export interface HubLTemplateData {
21
25
  previewKey: string;
@@ -1,22 +1,30 @@
1
- import { HubLModule, HubLTemplate } from '../api/designmanager.js';
1
+ export declare enum ModuleType {
2
+ REACT = "react",
3
+ HUBL = "hubl"
4
+ }
2
5
  export interface ModuleData {
3
6
  name: string;
4
- nameWithExtension: string;
7
+ type: ModuleType;
8
+ nameWithExtension?: string;
5
9
  subPath?: string;
6
- extension: string;
7
- fieldsJson: any;
10
+ extension?: string;
11
+ fieldsJson?: any;
8
12
  }
9
13
  export interface PartialData {
10
14
  name: string;
11
15
  subPath: string;
12
16
  }
17
+ export interface TemplateData {
18
+ name: string;
19
+ subPath: string;
20
+ }
13
21
  export interface DevServerUIData {
14
22
  authedPortalId: number;
15
23
  projectName: string;
16
24
  modulesData: ModuleData[];
25
+ hubLModules: ModuleData[];
17
26
  partialsData: PartialData[];
18
- hubLModules: HubLModule[];
19
- hubLTemplates: HubLTemplate[];
27
+ hubLTemplates: TemplateData[];
20
28
  themeWebRoot: string;
21
29
  [key: string]: any;
22
30
  }
@@ -1,2 +1,2 @@
1
1
  import { Plugin } from 'vite';
2
- export default function devSecretsPlugin(secretNames: Array<string>): Plugin;
2
+ export default function devSecretsPlugin(secretNames?: Array<string>): Plugin;
@@ -1,6 +1,7 @@
1
1
  export interface PreviewInfoResponse {
2
2
  previewDomain: string;
3
3
  previewKey: string;
4
+ templatePath: string;
4
5
  }
5
6
  declare const _default: (accountId: number, portalId: number, contentId: string) => Promise<PreviewInfoResponse>;
6
7
  export default _default;
@@ -0,0 +1,2 @@
1
+ export declare const metaRouteHandler: (req: any, res: any) => void;
2
+ export declare const markRemoteFsDirty: () => void;
@@ -1,2 +1 @@
1
- import { Gate } from '@hubspot/cms-js-internal';
2
- export default function createShadowDevServerRoutes(devServerPort: number, projectName: string, gates: Gate[]): Promise<import("express-serve-static-core").Router>;
1
+ export default function createShadowDevServerRoutes(devServerPort: number, themePath: string): Promise<import("express-serve-static-core").Router>;
@@ -1,2 +1 @@
1
- import { Gate } from '@hubspot/cms-js-internal';
2
- export default function startShadowDevServer(devServerPort: number, shadowPort: number, projectName: string, jsRenderingGates: Gate[]): Promise<void>;
1
+ export default function startShadowDevServer(devServerPort: number, shadowPort: number, themePath: string): Promise<void>;