@hubspot/cms-dev-server 0.18.15 → 0.18.17

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.
@@ -9,7 +9,7 @@ import { normalizePath as normalizePath2 } from "vite";
9
9
  import { createServer as createViteServer } from "vite";
10
10
  import { default as react } from "@vitejs/plugin-react";
11
11
 
12
- // ../cms-js-internal/dist/types-DGdcEHv3.js
12
+ // ../cms-js-internal/dist/types-CsJ4tzsl.js
13
13
  import path from "path";
14
14
  var viteRoot;
15
15
  var viteCommand;
@@ -126,7 +126,7 @@ function findCmsModules(buildContentDescriptors = {}) {
126
126
  },
127
127
  transform(code, id) {
128
128
  const moduleInfo = this.getModuleInfo(id);
129
- if (shouldSkipModule(config, moduleInfo, code))
129
+ if (!shouldAnalyzeModule(config, moduleInfo, code))
130
130
  return null;
131
131
  const contentDescriptors = analyzeSourceCodeUsages(
132
132
  this,
@@ -141,7 +141,6 @@ function findCmsModules(buildContentDescriptors = {}) {
141
141
  }
142
142
  };
143
143
  }
144
- return null;
145
144
  },
146
145
  buildEnd(error) {
147
146
  if (error)
@@ -213,9 +212,14 @@ function convertEntryPointIslandPathsToRelative(config, entryPointsCmsModuleMap)
213
212
  function toRelativePath(config, path4) {
214
213
  return path4.replace(`${config.root}/`, "");
215
214
  }
216
- function shouldSkipModule(config, moduleInfo, code) {
215
+ function shouldAnalyzeModule(config, moduleInfo, code) {
216
+ const [fileId, __] = moduleInfo.id.split("?");
217
217
  const isExternal = config.command !== "serve" && moduleInfo.isExternal;
218
- return isExternal || !moduleInfo.id.startsWith(config.root) || !(code.includes(CMS_MODULE_COMPONENT_NAME) || code.includes(DND_AREA_COMPONENT_NAME));
218
+ return (
219
+ // analyze customer code only
220
+ !isExternal && moduleInfo.id.startsWith(config.root) && // jsx files that contain "Module" / "DndArea"
221
+ (fileId.endsWith(".tsx") || fileId.endsWith(".jsx")) && (code.includes(CMS_MODULE_COMPONENT_NAME) || code.includes(DND_AREA_COMPONENT_NAME))
222
+ );
219
223
  }
220
224
  function getEntryPoints(ctx, config) {
221
225
  return Array.from(ctx.getModuleIds()).filter((moduleId) => moduleId.startsWith(config.root)).map((moduleId) => ctx.getModuleInfo(moduleId)).filter((moduleInfo) => moduleInfo.isEntry);
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { createServer as createViteServer } from "vite";
3
3
  import { default as react } from "@vitejs/plugin-react";
4
4
 
5
- // ../cms-js-internal/dist/types-DGdcEHv3.js
5
+ // ../cms-js-internal/dist/types-CsJ4tzsl.js
6
6
  import path from "path";
7
7
  import { createHash } from "crypto";
8
8
  import fs, { readFileSync, existsSync, readdirSync, lstatSync } from "fs";
@@ -224,11 +224,15 @@ function findAllModulesInRoot(webRoot) {
224
224
  );
225
225
  const moduleSubpaths = Object.keys(allModuleComponents);
226
226
  const moduleExtensions = Object.values(allModuleComponents).map((path22) => {
227
- const extension = (path22 == null ? void 0 : path22.split(".").pop()) || "";
227
+ if (!path22)
228
+ return "";
229
+ const extension = path22.split(".").pop() || "";
228
230
  return extension;
229
231
  });
230
232
  const moduleNamesWithExtension = Object.values(allModuleComponents).map(
231
233
  (path22) => {
234
+ if (!path22)
235
+ return "";
232
236
  const file = path22.replace("components/modules/", "");
233
237
  return file.includes("/index.") ? file.split("/index.")[0] : file;
234
238
  }
@@ -509,7 +513,7 @@ function findCmsModules(buildContentDescriptors = {}) {
509
513
  },
510
514
  transform(code, id) {
511
515
  const moduleInfo = this.getModuleInfo(id);
512
- if (shouldSkipModule(config, moduleInfo, code))
516
+ if (!shouldAnalyzeModule(config, moduleInfo, code))
513
517
  return null;
514
518
  const contentDescriptors = analyzeSourceCodeUsages(
515
519
  this,
@@ -524,7 +528,6 @@ function findCmsModules(buildContentDescriptors = {}) {
524
528
  }
525
529
  };
526
530
  }
527
- return null;
528
531
  },
529
532
  buildEnd(error) {
530
533
  if (error)
@@ -596,9 +599,14 @@ function convertEntryPointIslandPathsToRelative(config, entryPointsCmsModuleMap)
596
599
  function toRelativePath(config, path15) {
597
600
  return path15.replace(`${config.root}/`, "");
598
601
  }
599
- function shouldSkipModule(config, moduleInfo, code) {
602
+ function shouldAnalyzeModule(config, moduleInfo, code) {
603
+ const [fileId, __] = moduleInfo.id.split("?");
600
604
  const isExternal = config.command !== "serve" && moduleInfo.isExternal;
601
- return isExternal || !moduleInfo.id.startsWith(config.root) || !(code.includes(CMS_MODULE_COMPONENT_NAME) || code.includes(DND_AREA_COMPONENT_NAME));
605
+ return (
606
+ // analyze customer code only
607
+ !isExternal && moduleInfo.id.startsWith(config.root) && // jsx files that contain "Module" / "DndArea"
608
+ (fileId.endsWith(".tsx") || fileId.endsWith(".jsx")) && (code.includes(CMS_MODULE_COMPONENT_NAME) || code.includes(DND_AREA_COMPONENT_NAME))
609
+ );
602
610
  }
603
611
  function getEntryPoints(ctx, config) {
604
612
  return Array.from(ctx.getModuleIds()).filter((moduleId) => moduleId.startsWith(config.root)).map((moduleId) => ctx.getModuleInfo(moduleId)).filter((moduleInfo) => moduleInfo.isEntry);
@@ -1464,7 +1472,7 @@ function trackUsage(action) {
1464
1472
  eventName: EVENT_NAME,
1465
1473
  action,
1466
1474
  nodeVersion: getNodeVersionData(),
1467
- version: "0.18.15",
1475
+ version: "0.18.17",
1468
1476
  os: getPlatform()
1469
1477
  };
1470
1478
  const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
@@ -4203,7 +4211,7 @@ import { default as react2 } from "@vitejs/plugin-react";
4203
4211
  // src/lib/getDevServerUIData.ts
4204
4212
  import path11 from "path";
4205
4213
  import { normalizePath as normalizePath8 } from "vite";
4206
- function mapModulesData(modules, themeWebRoot, viteServer) {
4214
+ function mapReactModules(modules, themeWebRoot, viteServer) {
4207
4215
  return Promise.all(
4208
4216
  modules.moduleNames.map(async (name, index) => {
4209
4217
  const modulePath = normalizePath8(
@@ -4212,6 +4220,7 @@ function mapModulesData(modules, themeWebRoot, viteServer) {
4212
4220
  const fieldsJson = await renderModuleFieldsJson_default(viteServer, modulePath);
4213
4221
  return {
4214
4222
  name,
4223
+ type: "react" /* REACT */,
4215
4224
  subPath: modules.moduleSubpaths[index],
4216
4225
  nameWithExtension: modules.moduleNamesWithExtension[index],
4217
4226
  extension: modules.moduleExtensions[index],
@@ -4220,10 +4229,25 @@ function mapModulesData(modules, themeWebRoot, viteServer) {
4220
4229
  })
4221
4230
  );
4222
4231
  }
4223
- function mapPartialsData(modules) {
4224
- return modules.partialNames.map((name, index) => ({
4232
+ function normalizeHubLModules(modules) {
4233
+ return modules.map((module) => ({
4234
+ name: module.name,
4235
+ type: "hubl" /* HUBL */,
4236
+ subPath: `@projects/${module.path.split("/@projects/")[1] || module.path}`,
4237
+ nameWithExtension: module.filename,
4238
+ fieldsJson: module.fields
4239
+ }));
4240
+ }
4241
+ function normalizePartialsData(partialData) {
4242
+ return partialData.partialNames.map((name, index) => ({
4225
4243
  name,
4226
- subPath: modules.partialSubpaths[index]
4244
+ subPath: partialData.partialSubpaths[index]
4245
+ }));
4246
+ }
4247
+ function normalizeTemplatesData(templates) {
4248
+ return templates.map((template) => ({
4249
+ name: template.displayName || template.label,
4250
+ subPath: `@projects/${template.path.split("/@projects/")[1] || template.path}`
4227
4251
  }));
4228
4252
  }
4229
4253
  async function getDevServerUIData(reqLocals) {
@@ -4238,7 +4262,7 @@ async function getDevServerUIData(reqLocals) {
4238
4262
  } = reqLocals;
4239
4263
  const modulesData = findAllModulesInRoot(themeWebRoot);
4240
4264
  const partialsData = findAllPartialsInRoot(themeWebRoot);
4241
- const mappedModulesData = await mapModulesData(
4265
+ const reactModules = await mapReactModules(
4242
4266
  modulesData,
4243
4267
  themeWebRoot,
4244
4268
  viteServer
@@ -4255,14 +4279,15 @@ async function getDevServerUIData(reqLocals) {
4255
4279
  const hubLTemplates = (hubLTemplateData == null ? void 0 : hubLTemplateData.objects.filter(
4256
4280
  (template) => isCodedFile(template.filename)
4257
4281
  )) || [];
4282
+ const mappedHubLModules = normalizeHubLModules((hubLModuleData == null ? void 0 : hubLModuleData.objects) || []);
4258
4283
  return {
4259
4284
  authedPortalId,
4260
4285
  authedEnv,
4261
4286
  projectName,
4262
- modulesData: mappedModulesData,
4263
- partialsData: mapPartialsData(partialsData),
4264
- hubLModules: (hubLModuleData == null ? void 0 : hubLModuleData.objects) || [],
4265
- hubLTemplates,
4287
+ modulesData: reactModules,
4288
+ partialsData: normalizePartialsData(partialsData),
4289
+ hubLModules: mappedHubLModules || [],
4290
+ hubLTemplates: normalizeTemplatesData(hubLTemplates),
4266
4291
  themeWebRoot,
4267
4292
  webRootProjectComponentFolder
4268
4293
  };
@@ -1,4 +1,4 @@
1
- // ../cms-js-internal/dist/types-DGdcEHv3.js
1
+ // ../cms-js-internal/dist/types-CsJ4tzsl.js
2
2
  import path from "path";
3
3
  import { createHash } from "crypto";
4
4
  import fs, { readFileSync, existsSync, readdirSync, lstatSync } from "fs";
@@ -384,11 +384,15 @@ function findAllModulesInRoot(webRoot) {
384
384
  );
385
385
  const moduleSubpaths = Object.keys(allModuleComponents);
386
386
  const moduleExtensions = Object.values(allModuleComponents).map((path2) => {
387
- const extension = (path2 == null ? void 0 : path2.split(".").pop()) || "";
387
+ if (!path2)
388
+ return "";
389
+ const extension = path2.split(".").pop() || "";
388
390
  return extension;
389
391
  });
390
392
  const moduleNamesWithExtension = Object.values(allModuleComponents).map(
391
393
  (path2) => {
394
+ if (!path2)
395
+ return "";
392
396
  const file = path2.replace("components/modules/", "");
393
397
  return file.includes("/index.") ? file.split("/index.")[0] : file;
394
398
  }
@@ -673,7 +677,7 @@ function findCmsModules(buildContentDescriptors = {}) {
673
677
  },
674
678
  transform(code, id) {
675
679
  const moduleInfo = this.getModuleInfo(id);
676
- if (shouldSkipModule(config, moduleInfo, code))
680
+ if (!shouldAnalyzeModule(config, moduleInfo, code))
677
681
  return null;
678
682
  const contentDescriptors = analyzeSourceCodeUsages(
679
683
  this,
@@ -688,7 +692,6 @@ function findCmsModules(buildContentDescriptors = {}) {
688
692
  }
689
693
  };
690
694
  }
691
- return null;
692
695
  },
693
696
  buildEnd(error) {
694
697
  if (error)
@@ -760,9 +763,14 @@ function convertEntryPointIslandPathsToRelative(config, entryPointsCmsModuleMap)
760
763
  function toRelativePath(config, path2) {
761
764
  return path2.replace(`${config.root}/`, "");
762
765
  }
763
- function shouldSkipModule(config, moduleInfo, code) {
766
+ function shouldAnalyzeModule(config, moduleInfo, code) {
767
+ const [fileId, __] = moduleInfo.id.split("?");
764
768
  const isExternal = config.command !== "serve" && moduleInfo.isExternal;
765
- return isExternal || !moduleInfo.id.startsWith(config.root) || !(code.includes(CMS_MODULE_COMPONENT_NAME) || code.includes(DND_AREA_COMPONENT_NAME));
769
+ return (
770
+ // analyze customer code only
771
+ !isExternal && moduleInfo.id.startsWith(config.root) && // jsx files that contain "Module" / "DndArea"
772
+ (fileId.endsWith(".tsx") || fileId.endsWith(".jsx")) && (code.includes(CMS_MODULE_COMPONENT_NAME) || code.includes(DND_AREA_COMPONENT_NAME))
773
+ );
766
774
  }
767
775
  function getEntryPoints(ctx, config) {
768
776
  return Array.from(ctx.getModuleIds()).filter((moduleId) => moduleId.startsWith(config.root)).map((moduleId) => ctx.getModuleInfo(moduleId)).filter((moduleInfo) => moduleInfo.isEntry);
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
  }
@@ -1302,7 +1306,7 @@ function findCmsModules(buildContentDescriptors = {}) {
1302
1306
  },
1303
1307
  transform(code, id) {
1304
1308
  const moduleInfo = this.getModuleInfo(id);
1305
- if (shouldSkipModule(config, moduleInfo, code))
1309
+ if (!shouldAnalyzeModule(config, moduleInfo, code))
1306
1310
  return null;
1307
1311
  const contentDescriptors = analyzeSourceCodeUsages(
1308
1312
  this,
@@ -1317,7 +1321,6 @@ function findCmsModules(buildContentDescriptors = {}) {
1317
1321
  }
1318
1322
  };
1319
1323
  }
1320
- return null;
1321
1324
  },
1322
1325
  buildEnd(error) {
1323
1326
  if (error)
@@ -1389,9 +1392,14 @@ function convertEntryPointIslandPathsToRelative(config, entryPointsCmsModuleMap)
1389
1392
  function toRelativePath(config, path16) {
1390
1393
  return path16.replace(`${config.root}/`, "");
1391
1394
  }
1392
- function shouldSkipModule(config, moduleInfo, code) {
1395
+ function shouldAnalyzeModule(config, moduleInfo, code) {
1396
+ const [fileId, __] = moduleInfo.id.split("?");
1393
1397
  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));
1398
+ return (
1399
+ // analyze customer code only
1400
+ !isExternal && moduleInfo.id.startsWith(config.root) && // jsx files that contain "Module" / "DndArea"
1401
+ (fileId.endsWith(".tsx") || fileId.endsWith(".jsx")) && (code.includes(CMS_MODULE_COMPONENT_NAME) || code.includes(DND_AREA_COMPONENT_NAME))
1402
+ );
1395
1403
  }
1396
1404
  function getEntryPoints(ctx, config) {
1397
1405
  return Array.from(ctx.getModuleIds()).filter((moduleId) => moduleId.startsWith(config.root)).map((moduleId) => ctx.getModuleInfo(moduleId)).filter((moduleInfo) => moduleInfo.isEntry);
@@ -2073,7 +2081,7 @@ function trackUsage(action) {
2073
2081
  eventName: EVENT_NAME,
2074
2082
  action,
2075
2083
  nodeVersion: getNodeVersionData(),
2076
- version: "0.18.15",
2084
+ version: "0.18.17",
2077
2085
  os: getPlatform()
2078
2086
  };
2079
2087
  const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
@@ -4931,7 +4939,7 @@ import { default as react2 } from "@vitejs/plugin-react";
4931
4939
  // src/lib/getDevServerUIData.ts
4932
4940
  import path12 from "path";
4933
4941
  import { normalizePath as normalizePath8 } from "vite";
4934
- function mapModulesData(modules, themeWebRoot, viteServer) {
4942
+ function mapReactModules(modules, themeWebRoot, viteServer) {
4935
4943
  return Promise.all(
4936
4944
  modules.moduleNames.map(async (name, index) => {
4937
4945
  const modulePath = normalizePath8(
@@ -4940,6 +4948,7 @@ function mapModulesData(modules, themeWebRoot, viteServer) {
4940
4948
  const fieldsJson = await renderModuleFieldsJson_default(viteServer, modulePath);
4941
4949
  return {
4942
4950
  name,
4951
+ type: "react" /* REACT */,
4943
4952
  subPath: modules.moduleSubpaths[index],
4944
4953
  nameWithExtension: modules.moduleNamesWithExtension[index],
4945
4954
  extension: modules.moduleExtensions[index],
@@ -4948,10 +4957,25 @@ function mapModulesData(modules, themeWebRoot, viteServer) {
4948
4957
  })
4949
4958
  );
4950
4959
  }
4951
- function mapPartialsData(modules) {
4952
- return modules.partialNames.map((name, index) => ({
4960
+ function normalizeHubLModules(modules) {
4961
+ return modules.map((module) => ({
4962
+ name: module.name,
4963
+ type: "hubl" /* HUBL */,
4964
+ subPath: `@projects/${module.path.split("/@projects/")[1] || module.path}`,
4965
+ nameWithExtension: module.filename,
4966
+ fieldsJson: module.fields
4967
+ }));
4968
+ }
4969
+ function normalizePartialsData(partialData) {
4970
+ return partialData.partialNames.map((name, index) => ({
4953
4971
  name,
4954
- subPath: modules.partialSubpaths[index]
4972
+ subPath: partialData.partialSubpaths[index]
4973
+ }));
4974
+ }
4975
+ function normalizeTemplatesData(templates) {
4976
+ return templates.map((template) => ({
4977
+ name: template.displayName || template.label,
4978
+ subPath: `@projects/${template.path.split("/@projects/")[1] || template.path}`
4955
4979
  }));
4956
4980
  }
4957
4981
  async function getDevServerUIData(reqLocals) {
@@ -4966,7 +4990,7 @@ async function getDevServerUIData(reqLocals) {
4966
4990
  } = reqLocals;
4967
4991
  const modulesData = findAllModulesInRoot(themeWebRoot);
4968
4992
  const partialsData = findAllPartialsInRoot(themeWebRoot);
4969
- const mappedModulesData = await mapModulesData(
4993
+ const reactModules = await mapReactModules(
4970
4994
  modulesData,
4971
4995
  themeWebRoot,
4972
4996
  viteServer
@@ -4983,14 +5007,15 @@ async function getDevServerUIData(reqLocals) {
4983
5007
  const hubLTemplates = (hubLTemplateData == null ? void 0 : hubLTemplateData.objects.filter(
4984
5008
  (template) => isCodedFile(template.filename)
4985
5009
  )) || [];
5010
+ const mappedHubLModules = normalizeHubLModules((hubLModuleData == null ? void 0 : hubLModuleData.objects) || []);
4986
5011
  return {
4987
5012
  authedPortalId,
4988
5013
  authedEnv,
4989
5014
  projectName,
4990
- modulesData: mappedModulesData,
4991
- partialsData: mapPartialsData(partialsData),
4992
- hubLModules: (hubLModuleData == null ? void 0 : hubLModuleData.objects) || [],
4993
- hubLTemplates,
5015
+ modulesData: reactModules,
5016
+ partialsData: normalizePartialsData(partialsData),
5017
+ hubLModules: mappedHubLModules || [],
5018
+ hubLTemplates: normalizeTemplatesData(hubLTemplates),
4994
5019
  themeWebRoot,
4995
5020
  webRootProjectComponentFolder
4996
5021
  };
@@ -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(
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.17",
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.17",
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": "e30acbdcb26b0ad15ad050ba79669828d6819f39"
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
  }
@@ -0,0 +1,4 @@
1
+ import { ViteDevServer } from 'vite';
2
+ export declare const lookForModuleInFolder: (modulePath: string, viteServer: ViteDevServer) => Promise<[any, string]>;
3
+ declare function renderModuleJson(viteServer: ViteDevServer, requestedModulePath: string): Promise<any>;
4
+ export default renderModuleJson;