@hubspot/cms-dev-server 1.0.4 → 1.0.5

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.
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>CMS React Dev Server Home</title>
7
7
  <!--app-head-->
8
- <script type="module" crossorigin src="/assets/index-BDlX5eip.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-Ck3-AaKI.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-C0KdU9bk.css">
10
10
  </head>
11
11
  <body>
@@ -1524,6 +1524,21 @@ function useAvailableTranslations() {
1524
1524
  }
1525
1525
  return {};
1526
1526
  }
1527
+ function useLanguageVariants() {
1528
+ var _a;
1529
+ const renderContext = useRenderContext();
1530
+ const languageVariantsResult = (_a = renderContext.resolvedDataDependencies) == null ? void 0 : _a.languageVariants;
1531
+ if ((languageVariantsResult == null ? void 0 : languageVariantsResult.status) === "SUCCESS") {
1532
+ return languageVariantsResult.data;
1533
+ }
1534
+ if ((languageVariantsResult == null ? void 0 : languageVariantsResult.status) === "ERROR") {
1535
+ logError(languageVariantsResult.error);
1536
+ }
1537
+ if (languageVariantsResult.status === "WARNING") {
1538
+ logWarn(languageVariantsResult.warning);
1539
+ }
1540
+ return [];
1541
+ }
1527
1542
  function unstable_useVideos(resolvableIds) {
1528
1543
  var _a;
1529
1544
  const renderContext = useRenderContext();
@@ -1574,8 +1589,8 @@ function unstable_usePodcastShows(resolvableIds) {
1574
1589
  function unstable_usePodcastEpisodes(resolvableIds) {
1575
1590
  var _a;
1576
1591
  const renderContext = useRenderContext();
1577
- const normalizedType = resolvableIds.type.toUpperCase();
1578
- const uniqueId = `${normalizedType}:${resolvableIds.value}`;
1592
+ const resolvedIdType = resolvableIds.type === "id" ? "ID" : "FIELD_PATH";
1593
+ const uniqueId = `${resolvedIdType}:${resolvableIds.value}`;
1579
1594
  if (!((_a = renderContext.resolvedDataDependencies) == null ? void 0 : _a.podcastEpisodes)) {
1580
1595
  return [];
1581
1596
  }
@@ -2310,6 +2325,7 @@ const cmsComponents = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defin
2310
2325
  useIsInsideIsland,
2311
2326
  useIsServerOrFirstClientRender,
2312
2327
  useIsServerRender,
2328
+ useLanguageVariants,
2313
2329
  usePageUrl,
2314
2330
  useRenderContext,
2315
2331
  useServerRenderContext,
@@ -3037,6 +3053,7 @@ const ComponentDetailSheet = ({
3037
3053
  webRootProjectComponentFolder,
3038
3054
  projectData,
3039
3055
  authedEnv,
3056
+ fieldBuilderEnabled,
3040
3057
  children
3041
3058
  }) => {
3042
3059
  var _a;
@@ -3076,7 +3093,7 @@ const ComponentDetailSheet = ({
3076
3093
  authedEnv
3077
3094
  }
3078
3095
  ) }),
3079
- /* @__PURE__ */ jsx("div", { className: "grid gap-6 my-6", children: /* @__PURE__ */ jsx(
3096
+ /* @__PURE__ */ jsx("div", { className: "grid gap-6 my-6", children: fieldBuilderEnabled ? /* @__PURE__ */ jsx("h2", { className: "text-2xl font-semibold leading-8", children: "Field Builder Placeholder" }) : /* @__PURE__ */ jsx(
3080
3097
  FieldsContainer,
3081
3098
  {
3082
3099
  moduleData,
@@ -3131,7 +3148,8 @@ function ComponentTable({
3131
3148
  componentType,
3132
3149
  authedEnv,
3133
3150
  sslEnabled,
3134
- projectData
3151
+ projectData,
3152
+ fieldBuilderEnabled
3135
3153
  }) {
3136
3154
  const handlePreviewClick = (component) => {
3137
3155
  try {
@@ -3188,6 +3206,7 @@ function ComponentTable({
3188
3206
  webRootProjectComponentFolder,
3189
3207
  projectData,
3190
3208
  authedEnv,
3209
+ fieldBuilderEnabled,
3191
3210
  children: /* @__PURE__ */ jsx("span", { className: "underline cursor-pointer", children: component.name })
3192
3211
  }
3193
3212
  ) }) }),
@@ -3229,7 +3248,8 @@ const ComponentTableListItem = ({
3229
3248
  authedPortalId,
3230
3249
  authedEnv,
3231
3250
  sslEnabled,
3232
- projectData
3251
+ projectData,
3252
+ fieldBuilderEnabled
3233
3253
  }) => {
3234
3254
  return /* @__PURE__ */ jsxs("div", { id: id2, className: "mb-16", children: [
3235
3255
  /* @__PURE__ */ jsx("h2", { className: "font-inter text-2xl font-semibold leading-9 tracking-tight text-left mb-6", children: header }),
@@ -3246,7 +3266,8 @@ const ComponentTableListItem = ({
3246
3266
  authedPortalId,
3247
3267
  componentType,
3248
3268
  sslEnabled,
3249
- projectData
3269
+ projectData,
3270
+ fieldBuilderEnabled
3250
3271
  }
3251
3272
  )
3252
3273
  ] });
@@ -3262,7 +3283,8 @@ const ComponentTableList = ({
3262
3283
  authedPortalId,
3263
3284
  authedEnv,
3264
3285
  sslEnabled,
3265
- projectData
3286
+ projectData,
3287
+ fieldBuilderEnabled
3266
3288
  }) => {
3267
3289
  const mapToTableData = (components, type) => components.map((component) => ({
3268
3290
  ...component,
@@ -3295,7 +3317,8 @@ const ComponentTableList = ({
3295
3317
  authedPortalId,
3296
3318
  authedEnv,
3297
3319
  sslEnabled,
3298
- projectData
3320
+ projectData,
3321
+ fieldBuilderEnabled
3299
3322
  }
3300
3323
  ),
3301
3324
  /* @__PURE__ */ jsx(
@@ -3307,7 +3330,8 @@ const ComponentTableList = ({
3307
3330
  headers: ["Name", "Type", "Actions"],
3308
3331
  data: partialData,
3309
3332
  sslEnabled,
3310
- projectData
3333
+ projectData,
3334
+ fieldBuilderEnabled
3311
3335
  }
3312
3336
  ),
3313
3337
  /* @__PURE__ */ jsx(
@@ -3319,7 +3343,8 @@ const ComponentTableList = ({
3319
3343
  headers: ["Name", "Type", "Template Type", "Actions"],
3320
3344
  data: templateData,
3321
3345
  sslEnabled,
3322
- projectData
3346
+ projectData,
3347
+ fieldBuilderEnabled
3323
3348
  }
3324
3349
  )
3325
3350
  ] });
@@ -3477,7 +3502,8 @@ function App({
3477
3502
  themeWebRoot,
3478
3503
  cliCommands,
3479
3504
  sslEnabled,
3480
- projectData
3505
+ projectData,
3506
+ fieldBuilderEnabled
3481
3507
  } = initialProps;
3482
3508
  const [showUnauthed, setShowUnauthed] = useState(!authedPortalId);
3483
3509
  const handleCloseUnauthed = () => {
@@ -3510,7 +3536,8 @@ function App({
3510
3536
  authedPortalId,
3511
3537
  authedEnv,
3512
3538
  sslEnabled,
3513
- projectData
3539
+ projectData,
3540
+ fieldBuilderEnabled
3514
3541
  }
3515
3542
  ),
3516
3543
  /* @__PURE__ */ jsx(Footer, {}),
package/dist/index.js CHANGED
@@ -1041,7 +1041,7 @@ import express2 from "express";
1041
1041
  import http3 from "http";
1042
1042
  import bodyParser from "body-parser";
1043
1043
  import { spawn as spawn2 } from "child_process";
1044
- import { normalizePath as normalizePath9 } from "vite";
1044
+ import { normalizePath as normalizePath10 } from "vite";
1045
1045
  import { Transform } from "stream";
1046
1046
 
1047
1047
  // src/routes/createDevServerRoutes.ts
@@ -1054,7 +1054,7 @@ import { createProxyMiddleware } from "http-proxy-middleware";
1054
1054
 
1055
1055
  // src/routes/partial.ts
1056
1056
  import path7 from "path";
1057
- import { normalizePath as normalizePath4 } from "vite";
1057
+ import { normalizePath as normalizePath5 } from "vite";
1058
1058
 
1059
1059
  // src/lib/fullOriginalUrlFromRequest.ts
1060
1060
  function fullOriginalUrlFromRequest(request2) {
@@ -1465,7 +1465,7 @@ function trackUsage(action) {
1465
1465
  eventName: EVENT_NAME,
1466
1466
  action,
1467
1467
  nodeVersion: getNodeVersionData(),
1468
- version: "1.0.4",
1468
+ version: "1.0.5",
1469
1469
  os: getPlatform()
1470
1470
  };
1471
1471
  const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
@@ -1506,7 +1506,7 @@ function sendTrackingRequest(action) {
1506
1506
  // src/lib/renderModulePreview.ts
1507
1507
  import { buildStaticEnvConfig as buildStaticEnvConfig2 } from "@hubspot/cms-components";
1508
1508
  import path6 from "path";
1509
- import { normalizePath as normalizePath3 } from "vite";
1509
+ import { normalizePath as normalizePath4 } from "vite";
1510
1510
 
1511
1511
  // src/lib/proxyHelpers.ts
1512
1512
  import fs2 from "fs";
@@ -1607,7 +1607,7 @@ var getProjectNameFromHSConfig = (hsProjectConfigPath) => {
1607
1607
 
1608
1608
  // src/proxyPage/proxyPage.ts
1609
1609
  import path5 from "path";
1610
- import { normalizePath as normalizePath2 } from "vite";
1610
+ import { normalizePath as normalizePath3 } from "vite";
1611
1611
  import { getAccountId, getEnv } from "@hubspot/local-dev-lib/config";
1612
1612
  import { http as hsCliHttp6 } from "@hubspot/local-dev-lib/http";
1613
1613
 
@@ -2044,6 +2044,7 @@ import {
2044
2044
  convertToUnixPath,
2045
2045
  isAllowedExtension
2046
2046
  } from "@hubspot/local-dev-lib/path";
2047
+ import { normalizePath as normalizePath2 } from "vite";
2047
2048
  import { getExt, splitLocalPath } from "@hubspot/local-dev-lib/path";
2048
2049
  import { upload, deleteFile } from "@hubspot/local-dev-lib/api/fileMapper";
2049
2050
  import { MODULE_EXTENSION } from "@hubspot/local-dev-lib/constants/extensions";
@@ -2160,8 +2161,10 @@ function buildDeleteFileFromPreviewBufferCallback(accountId, src, dest, type) {
2160
2161
  };
2161
2162
  }
2162
2163
  function getDesignManagerPath(src, dest, file) {
2163
- const regex = new RegExp(`^${escapeRegExp(src)}`);
2164
- const relativePath = file.replace(regex, "");
2164
+ const normalizedSrc = normalizePath2(src);
2165
+ const normalizedFile = normalizePath2(file);
2166
+ const regex = new RegExp(`^${escapeRegExp(normalizedSrc)}`);
2167
+ const relativePath = normalizedFile.replace(regex, "");
2165
2168
  return convertToUnixPath(path3.join(dest, relativePath));
2166
2169
  }
2167
2170
  async function uploadFile(accountId, src, dest) {
@@ -2466,7 +2469,7 @@ var renderComponentForPlaceholder = (indexForThisRender, localRenderPlaceholder,
2466
2469
  `The specified component folder "${projectComponentFolder}" does not match the webroot project component folder "${webRootProjectComponent}/${projectComponentFolder}" specified to the cms-dev-server. Components must be located within the webroot project folder. Check that the specified path is correct: ${placeholderPath}.`
2467
2470
  );
2468
2471
  }
2469
- const resolvedPath = normalizePath2(
2472
+ const resolvedPath = normalizePath3(
2470
2473
  path5.resolve(webRoot, partialPath, componentFileName)
2471
2474
  );
2472
2475
  const entryPointPath = [
@@ -2784,7 +2787,7 @@ async function renderRemoteModulePreview(modulePath, authedPortalId, authedEnv,
2784
2787
  return { html: modulePreviewContent, cssNeeded };
2785
2788
  }
2786
2789
  async function renderLocalProjectModulePreview(moduleName, authedPortalId, authedEnv, authedHublet, webRoot, viteServer, jsRenderingGates, projectName, projectComponentPath, fullOriginalUrl, cookieValue, fieldOverrides = {}) {
2787
- const modulePath = normalizePath3(
2790
+ const modulePath = normalizePath4(
2788
2791
  path6.resolve(webRoot, "components/modules/", moduleName)
2789
2792
  );
2790
2793
  const basePath = `preview/${getEntryPointBasePath(modulePath)}`;
@@ -2903,10 +2906,10 @@ var partialRouteHandler = async (request2, response) => {
2903
2906
  import.meta.url,
2904
2907
  "html/baseTemplate.html"
2905
2908
  );
2906
- const partialPath = normalizePath4(
2909
+ const partialPath = normalizePath5(
2907
2910
  path7.resolve(webRoot, "components/partials/", partialName)
2908
2911
  );
2909
- const entrypointPath = normalizePath4(
2912
+ const entrypointPath = normalizePath5(
2910
2913
  [
2911
2914
  "@projects",
2912
2915
  projectName,
@@ -3129,7 +3132,7 @@ var linksToAllModulesRouteHandler_default = linksToAllModuleRouteHandler;
3129
3132
  // src/routes/module.ts
3130
3133
  import { buildStaticEnvConfig as buildStaticEnvConfig4 } from "@hubspot/cms-components";
3131
3134
  import path8 from "path";
3132
- import { normalizePath as normalizePath5 } from "vite";
3135
+ import { normalizePath as normalizePath6 } from "vite";
3133
3136
  var moduleRouteHandler = async (request2, response) => {
3134
3137
  sendTrackingRequest("view-module-route");
3135
3138
  const {
@@ -3147,10 +3150,10 @@ var moduleRouteHandler = async (request2, response) => {
3147
3150
  import.meta.url,
3148
3151
  "html/baseTemplate.html"
3149
3152
  );
3150
- const modulePath = normalizePath5(
3153
+ const modulePath = normalizePath6(
3151
3154
  path8.resolve(webRoot, "components/modules/", moduleName)
3152
3155
  );
3153
- const entrypointPath = normalizePath5(
3156
+ const entrypointPath = normalizePath6(
3154
3157
  [
3155
3158
  "@projects",
3156
3159
  projectName,
@@ -3230,7 +3233,7 @@ var module_default = moduleRouteHandler;
3230
3233
 
3231
3234
  // src/routes/moduleFieldsJson.ts
3232
3235
  import path9 from "path";
3233
- import { normalizePath as normalizePath6 } from "vite";
3236
+ import { normalizePath as normalizePath7 } from "vite";
3234
3237
 
3235
3238
  // src/lib/renderModuleFieldsJson.ts
3236
3239
  import { join as joinPosix4 } from "path/posix";
@@ -3282,7 +3285,7 @@ var moduleFieldsJsonRouteHandler = async (request2, response) => {
3282
3285
  sendTrackingRequest("fields-json-route");
3283
3286
  const { webRoot, viteServer } = request2.app.locals;
3284
3287
  const { moduleName } = request2.params;
3285
- const modulePath = normalizePath6(
3288
+ const modulePath = normalizePath7(
3286
3289
  path9.resolve(webRoot, "components/modules/", moduleName)
3287
3290
  );
3288
3291
  const fieldsJson = await renderModuleFieldsJson_default(viteServer, modulePath);
@@ -3763,7 +3766,7 @@ function proxyServerlessRequest(req, res, next) {
3763
3766
 
3764
3767
  // src/routes/modulePreviewRouteHandler.ts
3765
3768
  import path10 from "path";
3766
- import { normalizePath as normalizePath7 } from "vite";
3769
+ import { normalizePath as normalizePath8 } from "vite";
3767
3770
  async function modulePreviewRouteHandler(request2, response) {
3768
3771
  sendTrackingRequest("view-module-preview-route");
3769
3772
  const {
@@ -3777,7 +3780,7 @@ async function modulePreviewRouteHandler(request2, response) {
3777
3780
  projectComponentPath
3778
3781
  } = request2.app.locals;
3779
3782
  const moduleName = request2.params.moduleName;
3780
- const modulePath = normalizePath7(
3783
+ const modulePath = normalizePath8(
3781
3784
  path10.resolve(webRoot, "components/modules/", moduleName)
3782
3785
  );
3783
3786
  const PREVIEWER_APP_PARAM = "hsPreviewerApp";
@@ -4015,7 +4018,7 @@ import fs4 from "node:fs/promises";
4015
4018
 
4016
4019
  // src/lib/getDevServerUIData.ts
4017
4020
  import path11 from "path";
4018
- import { normalizePath as normalizePath8 } from "vite";
4021
+ import { normalizePath as normalizePath9 } from "vite";
4019
4022
 
4020
4023
  // src/api/project.ts
4021
4024
  import { http as hsCliHttp11 } from "@hubspot/local-dev-lib/http";
@@ -4052,7 +4055,7 @@ var templateTypeMap = {
4052
4055
  function mapReactModules(modules, themeWebRoot, viteServer) {
4053
4056
  return Promise.all(
4054
4057
  modules.moduleNames.map(async (name, index) => {
4055
- const modulePath = normalizePath8(
4058
+ const modulePath = normalizePath9(
4056
4059
  path11.resolve(themeWebRoot, "components/modules/", name)
4057
4060
  );
4058
4061
  const fieldsJson = await renderModuleFieldsJson_default(viteServer, modulePath);
@@ -4113,7 +4116,8 @@ async function getDevServerUIData(reqLocals, viteServer) {
4113
4116
  projectName,
4114
4117
  localPreviewToken,
4115
4118
  webRootProjectComponentFolder,
4116
- sslEnabled
4119
+ sslEnabled,
4120
+ fieldBuilderEnabled
4117
4121
  } = reqLocals;
4118
4122
  const packageJson = getPackageJson(themeWebRoot);
4119
4123
  const packageManager = detectPackageManager(themeWebRoot);
@@ -4157,7 +4161,8 @@ async function getDevServerUIData(reqLocals, viteServer) {
4157
4161
  webRootProjectComponentFolder,
4158
4162
  cliCommands,
4159
4163
  sslEnabled,
4160
- projectData
4164
+ projectData,
4165
+ fieldBuilderEnabled
4161
4166
  };
4162
4167
  }
4163
4168
  var getDevServerUIData_default = getDevServerUIData;
@@ -4215,7 +4220,7 @@ var createAppServerRoutes_default = createAppServerRoutes;
4215
4220
 
4216
4221
  // src/routes/createDevServerRoutes.ts
4217
4222
  import path12 from "path";
4218
- import { fileURLToPath } from "url";
4223
+ import { fileURLToPath, pathToFileURL } from "url";
4219
4224
  var __filename = fileURLToPath(import.meta.url);
4220
4225
  var __dirname = path12.dirname(__filename);
4221
4226
  var isProd = true;
@@ -4261,7 +4266,7 @@ var createDevServerRoutes = async (viteServer, storybookPort, appServerConfig) =
4261
4266
  let render;
4262
4267
  let template = await fs4.readFile(path12.join(templatePath), "utf-8");
4263
4268
  if (isProd) {
4264
- const { render: ssrRender } = await import(serverEntryPath);
4269
+ const { render: ssrRender } = await import(pathToFileURL(serverEntryPath).href);
4265
4270
  render = ssrRender;
4266
4271
  } else {
4267
4272
  template = await appServer.transformIndexHtml(url3, template);
@@ -5084,7 +5089,7 @@ var BASE_PATH = "/";
5084
5089
  var PORT = process.env.PORT ? parseInt(process.env.PORT, 10) : 3e3;
5085
5090
  var SHADOW_PORT = 1442;
5086
5091
  var STORYBOOK_PORT = process.env.STORYBOOK_PORT ? parseInt(process.env.STORYBOOK_PORT, 10) : 3123;
5087
- async function createDevServer(webRoot, storybook, hubspotCliConfigPathOption, hubspotCliAccountNameOption, sslEnabledOption, fieldGenEnabledOption, themePreviewOptions) {
5092
+ async function createDevServer(webRoot, storybook, hubspotCliConfigPathOption, hubspotCliAccountNameOption, sslEnabledOption, fieldGenEnabledOption, themePreviewOptions, fieldBuilderEnabled) {
5088
5093
  let authedPortalId = null;
5089
5094
  let authedEnv = null;
5090
5095
  let jsRenderingGates = [];
@@ -5198,7 +5203,7 @@ Local proxy functionality and module preview routes will not work without settin
5198
5203
  } catch (e) {
5199
5204
  authedHublet = "na1";
5200
5205
  }
5201
- const absoluteWebRoot = normalizePath9(path15.resolve(process.cwd(), webRoot));
5206
+ const absoluteWebRoot = normalizePath10(path15.resolve(process.cwd(), webRoot));
5202
5207
  const [__webRootProjectFolder, webRootProjectComponentFolder] = absoluteWebRoot.replace(/\/$/, "").split("/").slice(-2);
5203
5208
  const projectConfigPath = findHSProjectJson(absoluteWebRoot);
5204
5209
  if (authedPortalId) {
@@ -5251,7 +5256,7 @@ Local proxy functionality and module preview routes will not work without settin
5251
5256
  expressServer.locals.localPreviewToken = _localPreviewToken;
5252
5257
  expressServer.use(bodyParser.json());
5253
5258
  const __dirname2 = path15.dirname(url2.fileURLToPath(new URL(import.meta.url)));
5254
- const appWebRoot = normalizePath9(path15.resolve(__dirname2, "../app"));
5259
+ const appWebRoot = normalizePath10(path15.resolve(__dirname2, "../app"));
5255
5260
  const reqLocals = {
5256
5261
  themeWebRoot: absoluteWebRoot,
5257
5262
  authedPortalId,
@@ -5260,7 +5265,8 @@ Local proxy functionality and module preview routes will not work without settin
5260
5265
  projectName,
5261
5266
  webRootProjectComponentFolder,
5262
5267
  localPreviewToken: _localPreviewToken,
5263
- sslEnabled: sslEnabledOption
5268
+ sslEnabled: sslEnabledOption,
5269
+ fieldBuilderEnabled
5264
5270
  };
5265
5271
  const appServer = await createAppServer_default(
5266
5272
  appWebRoot,
package/dist/run.js CHANGED
@@ -675,6 +675,7 @@ function getDevServerCommandLineOptions(argv) {
675
675
  const storybook2 = args.findIndex((arg) => arg === "--storybook") > 0;
676
676
  const fieldGenEnabledOption2 = args.includes("--generateFieldsTypes");
677
677
  const resetSession2 = args.includes("--resetSession");
678
+ const fieldBuilderEnabled2 = args.includes("--fieldBuilderEnabled");
678
679
  return {
679
680
  hubspotCliConfigPathOption: hubspotCliConfigPathOption2,
680
681
  hubspotCliAccountNameOption: hubspotCliAccountNameOption2,
@@ -682,7 +683,8 @@ function getDevServerCommandLineOptions(argv) {
682
683
  storybook: storybook2,
683
684
  fieldGenEnabledOption: fieldGenEnabledOption2,
684
685
  webRoot: webRoot2,
685
- resetSession: resetSession2
686
+ resetSession: resetSession2,
687
+ fieldBuilderEnabled: fieldBuilderEnabled2
686
688
  };
687
689
  }
688
690
  async function buildThemePreviewOptions(webRoot2, isUsingLocalWorkspace = false) {
@@ -762,7 +764,7 @@ import express2 from "express";
762
764
  import http3 from "http";
763
765
  import bodyParser from "body-parser";
764
766
  import { spawn as spawn2 } from "child_process";
765
- import { normalizePath as normalizePath9 } from "vite";
767
+ import { normalizePath as normalizePath10 } from "vite";
766
768
  import { Transform } from "stream";
767
769
 
768
770
  // src/routes/createDevServerRoutes.ts
@@ -775,7 +777,7 @@ import { createProxyMiddleware } from "http-proxy-middleware";
775
777
 
776
778
  // src/routes/partial.ts
777
779
  import path8 from "path";
778
- import { normalizePath as normalizePath4 } from "vite";
780
+ import { normalizePath as normalizePath5 } from "vite";
779
781
 
780
782
  // src/lib/fullOriginalUrlFromRequest.ts
781
783
  function fullOriginalUrlFromRequest(request2) {
@@ -2095,7 +2097,7 @@ function trackUsage(action) {
2095
2097
  eventName: EVENT_NAME,
2096
2098
  action,
2097
2099
  nodeVersion: getNodeVersionData(),
2098
- version: "1.0.4",
2100
+ version: "1.0.5",
2099
2101
  os: getPlatform()
2100
2102
  };
2101
2103
  const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
@@ -2136,7 +2138,7 @@ function sendTrackingRequest(action) {
2136
2138
  // src/lib/renderModulePreview.ts
2137
2139
  import { buildStaticEnvConfig as buildStaticEnvConfig2 } from "@hubspot/cms-components";
2138
2140
  import path7 from "path";
2139
- import { normalizePath as normalizePath3 } from "vite";
2141
+ import { normalizePath as normalizePath4 } from "vite";
2140
2142
 
2141
2143
  // src/lib/proxyHelpers.ts
2142
2144
  import fs3 from "fs";
@@ -2237,7 +2239,7 @@ var getProjectNameFromHSConfig = (hsProjectConfigPath) => {
2237
2239
 
2238
2240
  // src/proxyPage/proxyPage.ts
2239
2241
  import path6 from "path";
2240
- import { normalizePath as normalizePath2 } from "vite";
2242
+ import { normalizePath as normalizePath3 } from "vite";
2241
2243
  import { getAccountId, getEnv } from "@hubspot/local-dev-lib/config";
2242
2244
  import { http as hsCliHttp6 } from "@hubspot/local-dev-lib/http";
2243
2245
 
@@ -2674,6 +2676,7 @@ import {
2674
2676
  convertToUnixPath,
2675
2677
  isAllowedExtension as isAllowedExtension2
2676
2678
  } from "@hubspot/local-dev-lib/path";
2679
+ import { normalizePath as normalizePath2 } from "vite";
2677
2680
  import { getExt, splitLocalPath } from "@hubspot/local-dev-lib/path";
2678
2681
  import { upload, deleteFile } from "@hubspot/local-dev-lib/api/fileMapper";
2679
2682
  import { MODULE_EXTENSION } from "@hubspot/local-dev-lib/constants/extensions";
@@ -2790,8 +2793,10 @@ function buildDeleteFileFromPreviewBufferCallback(accountId, src, dest, type) {
2790
2793
  };
2791
2794
  }
2792
2795
  function getDesignManagerPath(src, dest, file) {
2793
- const regex = new RegExp(`^${escapeRegExp2(src)}`);
2794
- const relativePath = file.replace(regex, "");
2796
+ const normalizedSrc = normalizePath2(src);
2797
+ const normalizedFile = normalizePath2(file);
2798
+ const regex = new RegExp(`^${escapeRegExp2(normalizedSrc)}`);
2799
+ const relativePath = normalizedFile.replace(regex, "");
2795
2800
  return convertToUnixPath(path4.join(dest, relativePath));
2796
2801
  }
2797
2802
  async function uploadFile(accountId, src, dest) {
@@ -3096,7 +3101,7 @@ var renderComponentForPlaceholder = (indexForThisRender, localRenderPlaceholder,
3096
3101
  `The specified component folder "${projectComponentFolder}" does not match the webroot project component folder "${webRootProjectComponent}/${projectComponentFolder}" specified to the cms-dev-server. Components must be located within the webroot project folder. Check that the specified path is correct: ${placeholderPath}.`
3097
3102
  );
3098
3103
  }
3099
- const resolvedPath = normalizePath2(
3104
+ const resolvedPath = normalizePath3(
3100
3105
  path6.resolve(webRoot2, partialPath, componentFileName)
3101
3106
  );
3102
3107
  const entryPointPath = [
@@ -3414,7 +3419,7 @@ async function renderRemoteModulePreview(modulePath, authedPortalId, authedEnv,
3414
3419
  return { html: modulePreviewContent, cssNeeded };
3415
3420
  }
3416
3421
  async function renderLocalProjectModulePreview(moduleName, authedPortalId, authedEnv, authedHublet, webRoot2, viteServer, jsRenderingGates, projectName, projectComponentPath, fullOriginalUrl, cookieValue, fieldOverrides = {}) {
3417
- const modulePath = normalizePath3(
3422
+ const modulePath = normalizePath4(
3418
3423
  path7.resolve(webRoot2, "components/modules/", moduleName)
3419
3424
  );
3420
3425
  const basePath = `preview/${getEntryPointBasePath(modulePath)}`;
@@ -3533,10 +3538,10 @@ var partialRouteHandler = async (request2, response) => {
3533
3538
  import.meta.url,
3534
3539
  "html/baseTemplate.html"
3535
3540
  );
3536
- const partialPath = normalizePath4(
3541
+ const partialPath = normalizePath5(
3537
3542
  path8.resolve(webRoot2, "components/partials/", partialName)
3538
3543
  );
3539
- const entrypointPath = normalizePath4(
3544
+ const entrypointPath = normalizePath5(
3540
3545
  [
3541
3546
  "@projects",
3542
3547
  projectName,
@@ -3759,7 +3764,7 @@ var linksToAllModulesRouteHandler_default = linksToAllModuleRouteHandler;
3759
3764
  // src/routes/module.ts
3760
3765
  import { buildStaticEnvConfig as buildStaticEnvConfig4 } from "@hubspot/cms-components";
3761
3766
  import path9 from "path";
3762
- import { normalizePath as normalizePath5 } from "vite";
3767
+ import { normalizePath as normalizePath6 } from "vite";
3763
3768
  var moduleRouteHandler = async (request2, response) => {
3764
3769
  sendTrackingRequest("view-module-route");
3765
3770
  const {
@@ -3777,10 +3782,10 @@ var moduleRouteHandler = async (request2, response) => {
3777
3782
  import.meta.url,
3778
3783
  "html/baseTemplate.html"
3779
3784
  );
3780
- const modulePath = normalizePath5(
3785
+ const modulePath = normalizePath6(
3781
3786
  path9.resolve(webRoot2, "components/modules/", moduleName)
3782
3787
  );
3783
- const entrypointPath = normalizePath5(
3788
+ const entrypointPath = normalizePath6(
3784
3789
  [
3785
3790
  "@projects",
3786
3791
  projectName,
@@ -3860,7 +3865,7 @@ var module_default = moduleRouteHandler;
3860
3865
 
3861
3866
  // src/routes/moduleFieldsJson.ts
3862
3867
  import path10 from "path";
3863
- import { normalizePath as normalizePath6 } from "vite";
3868
+ import { normalizePath as normalizePath7 } from "vite";
3864
3869
 
3865
3870
  // src/lib/renderModuleFieldsJson.ts
3866
3871
  import { join as joinPosix4 } from "path/posix";
@@ -3912,7 +3917,7 @@ var moduleFieldsJsonRouteHandler = async (request2, response) => {
3912
3917
  sendTrackingRequest("fields-json-route");
3913
3918
  const { webRoot: webRoot2, viteServer } = request2.app.locals;
3914
3919
  const { moduleName } = request2.params;
3915
- const modulePath = normalizePath6(
3920
+ const modulePath = normalizePath7(
3916
3921
  path10.resolve(webRoot2, "components/modules/", moduleName)
3917
3922
  );
3918
3923
  const fieldsJson = await renderModuleFieldsJson_default(viteServer, modulePath);
@@ -4393,7 +4398,7 @@ function proxyServerlessRequest(req, res, next) {
4393
4398
 
4394
4399
  // src/routes/modulePreviewRouteHandler.ts
4395
4400
  import path11 from "path";
4396
- import { normalizePath as normalizePath7 } from "vite";
4401
+ import { normalizePath as normalizePath8 } from "vite";
4397
4402
  async function modulePreviewRouteHandler(request2, response) {
4398
4403
  sendTrackingRequest("view-module-preview-route");
4399
4404
  const {
@@ -4407,7 +4412,7 @@ async function modulePreviewRouteHandler(request2, response) {
4407
4412
  projectComponentPath
4408
4413
  } = request2.app.locals;
4409
4414
  const moduleName = request2.params.moduleName;
4410
- const modulePath = normalizePath7(
4415
+ const modulePath = normalizePath8(
4411
4416
  path11.resolve(webRoot2, "components/modules/", moduleName)
4412
4417
  );
4413
4418
  const PREVIEWER_APP_PARAM = "hsPreviewerApp";
@@ -4645,7 +4650,7 @@ import fs5 from "node:fs/promises";
4645
4650
 
4646
4651
  // src/lib/getDevServerUIData.ts
4647
4652
  import path12 from "path";
4648
- import { normalizePath as normalizePath8 } from "vite";
4653
+ import { normalizePath as normalizePath9 } from "vite";
4649
4654
 
4650
4655
  // src/api/project.ts
4651
4656
  import { http as hsCliHttp11 } from "@hubspot/local-dev-lib/http";
@@ -4790,7 +4795,7 @@ var templateTypeMap = {
4790
4795
  function mapReactModules(modules, themeWebRoot, viteServer) {
4791
4796
  return Promise.all(
4792
4797
  modules.moduleNames.map(async (name, index) => {
4793
- const modulePath = normalizePath8(
4798
+ const modulePath = normalizePath9(
4794
4799
  path12.resolve(themeWebRoot, "components/modules/", name)
4795
4800
  );
4796
4801
  const fieldsJson = await renderModuleFieldsJson_default(viteServer, modulePath);
@@ -4851,7 +4856,8 @@ async function getDevServerUIData(reqLocals, viteServer) {
4851
4856
  projectName,
4852
4857
  localPreviewToken,
4853
4858
  webRootProjectComponentFolder,
4854
- sslEnabled
4859
+ sslEnabled,
4860
+ fieldBuilderEnabled: fieldBuilderEnabled2
4855
4861
  } = reqLocals;
4856
4862
  const packageJson = getPackageJson(themeWebRoot);
4857
4863
  const packageManager = detectPackageManager(themeWebRoot);
@@ -4895,7 +4901,8 @@ async function getDevServerUIData(reqLocals, viteServer) {
4895
4901
  webRootProjectComponentFolder,
4896
4902
  cliCommands,
4897
4903
  sslEnabled,
4898
- projectData
4904
+ projectData,
4905
+ fieldBuilderEnabled: fieldBuilderEnabled2
4899
4906
  };
4900
4907
  }
4901
4908
  var getDevServerUIData_default = getDevServerUIData;
@@ -4953,7 +4960,7 @@ var createAppServerRoutes_default = createAppServerRoutes;
4953
4960
 
4954
4961
  // src/routes/createDevServerRoutes.ts
4955
4962
  import path13 from "path";
4956
- import { fileURLToPath } from "url";
4963
+ import { fileURLToPath, pathToFileURL } from "url";
4957
4964
  var __filename = fileURLToPath(import.meta.url);
4958
4965
  var __dirname = path13.dirname(__filename);
4959
4966
  var isProd = true;
@@ -4999,7 +5006,7 @@ var createDevServerRoutes = async (viteServer, storybookPort, appServerConfig) =
4999
5006
  let render;
5000
5007
  let template = await fs5.readFile(path13.join(templatePath), "utf-8");
5001
5008
  if (isProd) {
5002
- const { render: ssrRender } = await import(serverEntryPath);
5009
+ const { render: ssrRender } = await import(pathToFileURL(serverEntryPath).href);
5003
5010
  render = ssrRender;
5004
5011
  } else {
5005
5012
  template = await appServer.transformIndexHtml(url3, template);
@@ -5822,7 +5829,7 @@ var BASE_PATH = "/";
5822
5829
  var PORT = process.env.PORT ? parseInt(process.env.PORT, 10) : 3e3;
5823
5830
  var SHADOW_PORT = 1442;
5824
5831
  var STORYBOOK_PORT = process.env.STORYBOOK_PORT ? parseInt(process.env.STORYBOOK_PORT, 10) : 3123;
5825
- async function createDevServer(webRoot2, storybook2, hubspotCliConfigPathOption2, hubspotCliAccountNameOption2, sslEnabledOption2, fieldGenEnabledOption2, themePreviewOptions2) {
5832
+ async function createDevServer(webRoot2, storybook2, hubspotCliConfigPathOption2, hubspotCliAccountNameOption2, sslEnabledOption2, fieldGenEnabledOption2, themePreviewOptions2, fieldBuilderEnabled2) {
5826
5833
  let authedPortalId = null;
5827
5834
  let authedEnv = null;
5828
5835
  let jsRenderingGates = [];
@@ -5936,7 +5943,7 @@ Local proxy functionality and module preview routes will not work without settin
5936
5943
  } catch (e) {
5937
5944
  authedHublet = "na1";
5938
5945
  }
5939
- const absoluteWebRoot = normalizePath9(path16.resolve(process.cwd(), webRoot2));
5946
+ const absoluteWebRoot = normalizePath10(path16.resolve(process.cwd(), webRoot2));
5940
5947
  const [__webRootProjectFolder, webRootProjectComponentFolder] = absoluteWebRoot.replace(/\/$/, "").split("/").slice(-2);
5941
5948
  const projectConfigPath = findHSProjectJson(absoluteWebRoot);
5942
5949
  if (authedPortalId) {
@@ -5989,7 +5996,7 @@ Local proxy functionality and module preview routes will not work without settin
5989
5996
  expressServer.locals.localPreviewToken = _localPreviewToken;
5990
5997
  expressServer.use(bodyParser.json());
5991
5998
  const __dirname2 = path16.dirname(url2.fileURLToPath(new URL(import.meta.url)));
5992
- const appWebRoot = normalizePath9(path16.resolve(__dirname2, "../app"));
5999
+ const appWebRoot = normalizePath10(path16.resolve(__dirname2, "../app"));
5993
6000
  const reqLocals = {
5994
6001
  themeWebRoot: absoluteWebRoot,
5995
6002
  authedPortalId,
@@ -5998,7 +6005,8 @@ Local proxy functionality and module preview routes will not work without settin
5998
6005
  projectName,
5999
6006
  webRootProjectComponentFolder,
6000
6007
  localPreviewToken: _localPreviewToken,
6001
- sslEnabled: sslEnabledOption2
6008
+ sslEnabled: sslEnabledOption2,
6009
+ fieldBuilderEnabled: fieldBuilderEnabled2
6002
6010
  };
6003
6011
  const appServer = await createAppServer_default(
6004
6012
  appWebRoot,
@@ -6127,7 +6135,8 @@ var {
6127
6135
  sslEnabledOption,
6128
6136
  storybook,
6129
6137
  fieldGenEnabledOption,
6130
- resetSession
6138
+ resetSession,
6139
+ fieldBuilderEnabled
6131
6140
  } = getDevServerCommandLineOptions(process.argv);
6132
6141
  if (!webRoot) {
6133
6142
  throw new Error(`No web root path argument specified`);
@@ -6147,5 +6156,6 @@ createDevServer_default(
6147
6156
  hubspotCliAccountNameOption,
6148
6157
  sslEnabledOption,
6149
6158
  fieldGenEnabledOption,
6150
- themePreviewOptions
6159
+ themePreviewOptions,
6160
+ fieldBuilderEnabled
6151
6161
  );