@hubspot/cms-dev-server 1.2.70 → 1.2.76

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.
@@ -10,7 +10,7 @@ import { createServer as createViteServer } from "vite";
10
10
  import { createRequire } from "module";
11
11
  import { default as react } from "@vitejs/plugin-react";
12
12
 
13
- // ../cms-js-internal/dist/types-CBGC9bBc.js
13
+ // ../cms-js-internal/dist/types-B-d4FeeE.js
14
14
  import path from "path";
15
15
  var viteRoot;
16
16
  var viteCommand;
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import { createServer as createViteServer } from "vite";
3
3
  import { createRequire } from "module";
4
4
  import { default as react } from "@vitejs/plugin-react";
5
5
 
6
- // ../cms-js-internal/dist/types-CBGC9bBc.js
6
+ // ../cms-js-internal/dist/types-B-d4FeeE.js
7
7
  import path from "path";
8
8
  import { createHash } from "crypto";
9
9
  import fs, { readFileSync, existsSync, readdirSync, lstatSync } from "fs";
@@ -255,7 +255,6 @@ function isFullHeightPreviewEnabled(config) {
255
255
  return false;
256
256
  }
257
257
  var ENABLED_FEATURES_GATE_MAP = {
258
- "cms:jsr:getServerSideProps": "CMS:JSRenderer:GetServerSideProps",
259
258
  "cms:jsr:analyzeCmsModules": "CMS:JSRenderer:AnalyzeCmsModules",
260
259
  "PortalsAccessIdentity:DesignManager:UrlSigning": "PortalsAccessIdentity:DesignManager:UrlSigning"
261
260
  };
@@ -1651,7 +1650,7 @@ function trackUsage(action) {
1651
1650
  eventName: EVENT_NAME,
1652
1651
  action,
1653
1652
  nodeVersion: getNodeVersionData(),
1654
- version: "1.2.70",
1653
+ version: "1.2.76",
1655
1654
  os: getPlatform()
1656
1655
  };
1657
1656
  const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
@@ -1915,17 +1914,41 @@ var getApplyValidationToRenderContext = (portalId, fieldsJSON, metaJSON, request
1915
1914
  return renderResult;
1916
1915
  };
1917
1916
  };
1917
+ var REQUIRED_MODULE_EXPORTS = ["Component", "fields", "meta"];
1918
+ var MAX_MODULE_LOAD_ATTEMPTS = 3;
1919
+ var MODULE_RELOAD_BACKOFF_MS = 50;
1920
+ var MODULE_NOT_FOUND_ERROR = "Failed to load url";
1921
+ var isUnpopulatedModuleNamespace = (mod) => !!mod && REQUIRED_MODULE_EXPORTS.every((name) => mod[name] === void 0);
1922
+ var invalidateSsrModule = async (viteServer, moduleUrl) => {
1923
+ try {
1924
+ const mod = await viteServer.moduleGraph.getModuleByUrl(moduleUrl, true);
1925
+ if (mod)
1926
+ viteServer.moduleGraph.invalidateModule(mod);
1927
+ } catch {
1928
+ }
1929
+ };
1930
+ var delay = (ms) => new Promise((resolve2) => setTimeout(resolve2, ms));
1918
1931
  var lookForModuleInFolder2 = async (modulePath, viteServer) => {
1919
- let componentModule;
1920
1932
  const insideFolderPath = joinPosix2(modulePath, "index");
1921
- try {
1922
- componentModule = await viteServer.ssrLoadModule(insideFolderPath);
1923
- } catch (e) {
1924
- if (!e.message.includes("Failed to load url")) {
1925
- throw e;
1933
+ for (let attempt = 1; attempt <= MAX_MODULE_LOAD_ATTEMPTS; attempt++) {
1934
+ let componentModule;
1935
+ try {
1936
+ componentModule = await viteServer.ssrLoadModule(insideFolderPath);
1937
+ } catch (e) {
1938
+ if (!e.message.includes(MODULE_NOT_FOUND_ERROR)) {
1939
+ throw e;
1940
+ }
1941
+ return [void 0, insideFolderPath];
1942
+ }
1943
+ const racedMidInstantiate = isUnpopulatedModuleNamespace(componentModule);
1944
+ const hasAttemptsLeft = attempt < MAX_MODULE_LOAD_ATTEMPTS;
1945
+ if (!racedMidInstantiate || !hasAttemptsLeft) {
1946
+ return [componentModule, insideFolderPath];
1926
1947
  }
1948
+ await invalidateSsrModule(viteServer, insideFolderPath);
1949
+ await delay(MODULE_RELOAD_BACKOFF_MS);
1927
1950
  }
1928
- return [componentModule, insideFolderPath];
1951
+ return [void 0, insideFolderPath];
1929
1952
  };
1930
1953
  async function renderModule(viteServer, requestedModulePath, moduleProps, pageUrl, basePath, environmentConfig, renderOptions) {
1931
1954
  console.log("Rendering module", requestedModulePath);
@@ -3069,6 +3092,7 @@ function extractRelevantCss(cssText) {
3069
3092
 
3070
3093
  // src/lib/renderModulePreview.ts
3071
3094
  import jsdom from "jsdom";
3095
+ var DEFAULT_SECTION_VARIANT = "section1";
3072
3096
  var _webDefaultStylesCss = null;
3073
3097
  function getWebDefaultStylesCss(metaUrl) {
3074
3098
  if (_webDefaultStylesCss === null) {
@@ -3321,6 +3345,7 @@ async function renderLocalProjectModulePreview(moduleName, authedPortalId, authe
3321
3345
  const themeVariablesCss = filteredCss ? `<style data-hs-styles="theme-variables">${filteredCss}</style>` : "";
3322
3346
  const webDefaultStylesCss = meta.editor_version === "2.0" ? getWebDefaultStylesCss(import.meta.url) : "";
3323
3347
  const globalStylesCss = [themeVariablesCss, webDefaultStylesCss].filter(Boolean).join("\n");
3348
+ const sectionVariant = filteredCss ? DEFAULT_SECTION_VARIANT : void 0;
3324
3349
  const renderResult = await renderComponentForPlaceholder(
3325
3350
  0,
3326
3351
  localRenderPlaceholders[0],
@@ -3332,7 +3357,7 @@ async function renderLocalProjectModulePreview(moduleName, authedPortalId, authe
3332
3357
  projectName,
3333
3358
  projectComponentPath
3334
3359
  );
3335
- return { ...renderResult, globalStylesCss };
3360
+ return { ...renderResult, globalStylesCss, sectionVariant };
3336
3361
  }
3337
3362
 
3338
3363
  // src/routes/partial.ts
@@ -4273,7 +4298,8 @@ async function modulePreviewRouteHandler(request, response) {
4273
4298
  cssNeeded,
4274
4299
  renderContext,
4275
4300
  inlineAssets,
4276
- globalStylesCss
4301
+ globalStylesCss,
4302
+ sectionVariant
4277
4303
  } = await renderLocalProjectModulePreview(
4278
4304
  moduleName,
4279
4305
  authedPortalId,
@@ -4301,6 +4327,7 @@ async function modulePreviewRouteHandler(request, response) {
4301
4327
  jsRenderingGates
4302
4328
  );
4303
4329
  const fullHeightCss = fullHeightPreview ? `<style>html,body{height:100%;width:100%;margin:0}#root{height:100%;width:100%}</style>` : "";
4330
+ const bodyHtml = sectionVariant ? `<div data-section-variant="${sectionVariant}">${renderedHtml}</div>` : renderedHtml;
4304
4331
  const html = addScriptInjectionBootstrapper(
4305
4332
  htmlShell.replace(
4306
4333
  "<!--headend-->",
@@ -4310,7 +4337,7 @@ async function modulePreviewRouteHandler(request, response) {
4310
4337
  cssNeeded,
4311
4338
  ...inlineAssets.map((inlineAsset) => inlineAsset.html)
4312
4339
  ].join("\n")
4313
- ).replace(`<!--ssr-outlet-->`, renderedHtml),
4340
+ ).replace(`<!--ssr-outlet-->`, bodyHtml),
4314
4341
  request.query
4315
4342
  );
4316
4343
  response.status(200).set({ "Content-Type": "text/html" }).end(html);
@@ -1,4 +1,4 @@
1
- // ../cms-js-internal/dist/types-CBGC9bBc.js
1
+ // ../cms-js-internal/dist/types-B-d4FeeE.js
2
2
  import path from "path";
3
3
  import { createHash } from "crypto";
4
4
  import fs, { readFileSync, existsSync, readdirSync, lstatSync } from "fs";
@@ -388,15 +388,12 @@ function getBaseAssetUrlFromBuild(buildDir) {
388
388
  return getBuildInfo(buildDir).baseAssetUrl;
389
389
  }
390
390
  var GATES = [
391
- "CMS:JSRenderer:GetServerSideProps",
392
- "CMS:JSRenderer:ModuleHubl",
393
391
  "CMS:JSRenderer:RemoveMockClientEntryPlugin",
394
392
  "CMS:JSRenderer:AnalyzeCmsModules",
395
393
  "CMS:JSRenderer:StripNullBytes",
396
394
  "PortalsAccessIdentity:DesignManager:UrlSigning"
397
395
  ];
398
396
  var ENABLED_FEATURES_GATE_MAP = {
399
- "cms:jsr:getServerSideProps": "CMS:JSRenderer:GetServerSideProps",
400
397
  "cms:jsr:analyzeCmsModules": "CMS:JSRenderer:AnalyzeCmsModules",
401
398
  "PortalsAccessIdentity:DesignManager:UrlSigning": "PortalsAccessIdentity:DesignManager:UrlSigning"
402
399
  };
@@ -73,7 +73,9 @@ var startHydratingIdleRootsTimeout;
73
73
  var shouldForceSeparateJsForAllIslands = /(&|\?)forceSeparateIslandJs=true/.test(window.location.search);
74
74
  var scheduledHydrationIndexCtr = 1;
75
75
  var rootsById = /* @__PURE__ */ new Map();
76
+ var rootsByElement = /* @__PURE__ */ new WeakMap();
76
77
  var scheduledElements = /* @__PURE__ */ new WeakSet();
78
+ var unmountedElements = /* @__PURE__ */ new WeakSet();
77
79
  var typedWindow = window;
78
80
  function findIslandElements(islandId) {
79
81
  if (typeof CSS !== "undefined" && CSS.escape) {
@@ -87,6 +89,18 @@ function findIslandElements(islandId) {
87
89
  document.querySelectorAll("[data-hs-island]")
88
90
  ).filter((el) => el.id === islandId);
89
91
  }
92
+ function findModuleWrapperElements(moduleId) {
93
+ if (typeof CSS !== "undefined" && CSS.escape) {
94
+ return Array.from(
95
+ document.querySelectorAll(
96
+ `[data-hs-module-id="${CSS.escape(moduleId)}"]`
97
+ )
98
+ );
99
+ }
100
+ return Array.from(
101
+ document.querySelectorAll("[data-hs-module-id]")
102
+ ).filter((el) => el.getAttribute("data-hs-module-id") === moduleId);
103
+ }
90
104
  function prepareAndScheduleRoot(root) {
91
105
  root.hydrationStatus = "HYDRATION_PREPARING";
92
106
  waitThenLoadAndHydrateIfNeeded(
@@ -150,8 +164,15 @@ function hydrateRoot(entry) {
150
164
  index: entry.islandScheduledIndex
151
165
  };
152
166
  const reactRoot = IslandModule.render(renderableIsland);
167
+ if (unmountedElements.has(rootEl)) {
168
+ unmountedElements.delete(rootEl);
169
+ reactRoot == null ? void 0 : reactRoot.unmount();
170
+ finishHydratingRootAndScheduleNext(entry);
171
+ return;
172
+ }
153
173
  const existingRoots = rootsById.get(root.id) || [];
154
174
  rootsById.set(root.id, [...existingRoots, reactRoot]);
175
+ rootsByElement.set(rootEl, reactRoot);
155
176
  }
156
177
  function pushToHydrationQueue(entry) {
157
178
  entry.root.hydrationStatus = "HYDRATION_QUEUED";
@@ -276,7 +297,41 @@ function unmountIsland(islandId) {
276
297
  reactRoot.unmount();
277
298
  }
278
299
  }
300
+ function unmountIslandsForModule(moduleId) {
301
+ const moduleEls = findModuleWrapperElements(moduleId);
302
+ if (moduleEls.length === 0) {
303
+ console.warn(`unmountIslandsForModule: No known module: ${moduleId}`);
304
+ return;
305
+ }
306
+ const islandEls = moduleEls.flatMap(
307
+ (moduleEl) => Array.from(moduleEl.querySelectorAll("[data-hs-island]"))
308
+ );
309
+ if (islandEls.length === 0) {
310
+ return;
311
+ }
312
+ console.log("Unmounting islands for module:", moduleId);
313
+ for (const el of islandEls) {
314
+ hydrationQueue = hydrationQueue.filter((entry) => entry.rootEl !== el);
315
+ scheduledElements.add(el);
316
+ unmountedElements.add(el);
317
+ const reactRoot = rootsByElement.get(el);
318
+ if (!reactRoot) {
319
+ continue;
320
+ }
321
+ rootsByElement.delete(el);
322
+ const remainingRoots = (rootsById.get(el.id) || []).filter(
323
+ (root) => root !== reactRoot
324
+ );
325
+ if (remainingRoots.length > 0) {
326
+ rootsById.set(el.id, remainingRoots);
327
+ } else {
328
+ rootsById.delete(el.id);
329
+ }
330
+ reactRoot.unmount();
331
+ }
332
+ }
279
333
  export {
280
334
  setupIslandHydration,
281
- unmountIsland
335
+ unmountIsland,
336
+ unmountIslandsForModule
282
337
  };
package/dist/run.js CHANGED
@@ -896,7 +896,7 @@ function packagePath(metaUrl, projectPath) {
896
896
  );
897
897
  }
898
898
 
899
- // ../cms-js-internal/dist/types-CBGC9bBc.js
899
+ // ../cms-js-internal/dist/types-B-d4FeeE.js
900
900
  import path4 from "path";
901
901
  import { createHash } from "crypto";
902
902
  import fs3, { readFileSync, existsSync as existsSync2, readdirSync, lstatSync } from "fs";
@@ -1148,7 +1148,6 @@ function isFullHeightPreviewEnabled(config) {
1148
1148
  return false;
1149
1149
  }
1150
1150
  var ENABLED_FEATURES_GATE_MAP = {
1151
- "cms:jsr:getServerSideProps": "CMS:JSRenderer:GetServerSideProps",
1152
1151
  "cms:jsr:analyzeCmsModules": "CMS:JSRenderer:AnalyzeCmsModules",
1153
1152
  "PortalsAccessIdentity:DesignManager:UrlSigning": "PortalsAccessIdentity:DesignManager:UrlSigning"
1154
1153
  };
@@ -2256,7 +2255,7 @@ function trackUsage(action) {
2256
2255
  eventName: EVENT_NAME,
2257
2256
  action,
2258
2257
  nodeVersion: getNodeVersionData(),
2259
- version: "1.2.70",
2258
+ version: "1.2.76",
2260
2259
  os: getPlatform()
2261
2260
  };
2262
2261
  const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
@@ -2520,17 +2519,41 @@ var getApplyValidationToRenderContext = (portalId, fieldsJSON, metaJSON, request
2520
2519
  return renderResult;
2521
2520
  };
2522
2521
  };
2522
+ var REQUIRED_MODULE_EXPORTS = ["Component", "fields", "meta"];
2523
+ var MAX_MODULE_LOAD_ATTEMPTS = 3;
2524
+ var MODULE_RELOAD_BACKOFF_MS = 50;
2525
+ var MODULE_NOT_FOUND_ERROR = "Failed to load url";
2526
+ var isUnpopulatedModuleNamespace = (mod) => !!mod && REQUIRED_MODULE_EXPORTS.every((name) => mod[name] === void 0);
2527
+ var invalidateSsrModule = async (viteServer, moduleUrl) => {
2528
+ try {
2529
+ const mod = await viteServer.moduleGraph.getModuleByUrl(moduleUrl, true);
2530
+ if (mod)
2531
+ viteServer.moduleGraph.invalidateModule(mod);
2532
+ } catch {
2533
+ }
2534
+ };
2535
+ var delay = (ms) => new Promise((resolve3) => setTimeout(resolve3, ms));
2523
2536
  var lookForModuleInFolder2 = async (modulePath, viteServer) => {
2524
- let componentModule;
2525
2537
  const insideFolderPath = joinPosix2(modulePath, "index");
2526
- try {
2527
- componentModule = await viteServer.ssrLoadModule(insideFolderPath);
2528
- } catch (e) {
2529
- if (!e.message.includes("Failed to load url")) {
2530
- throw e;
2538
+ for (let attempt = 1; attempt <= MAX_MODULE_LOAD_ATTEMPTS; attempt++) {
2539
+ let componentModule;
2540
+ try {
2541
+ componentModule = await viteServer.ssrLoadModule(insideFolderPath);
2542
+ } catch (e) {
2543
+ if (!e.message.includes(MODULE_NOT_FOUND_ERROR)) {
2544
+ throw e;
2545
+ }
2546
+ return [void 0, insideFolderPath];
2547
+ }
2548
+ const racedMidInstantiate = isUnpopulatedModuleNamespace(componentModule);
2549
+ const hasAttemptsLeft = attempt < MAX_MODULE_LOAD_ATTEMPTS;
2550
+ if (!racedMidInstantiate || !hasAttemptsLeft) {
2551
+ return [componentModule, insideFolderPath];
2531
2552
  }
2553
+ await invalidateSsrModule(viteServer, insideFolderPath);
2554
+ await delay(MODULE_RELOAD_BACKOFF_MS);
2532
2555
  }
2533
- return [componentModule, insideFolderPath];
2556
+ return [void 0, insideFolderPath];
2534
2557
  };
2535
2558
  async function renderModule(viteServer, requestedModulePath, moduleProps, pageUrl, basePath, environmentConfig, renderOptions) {
2536
2559
  console.log("Rendering module", requestedModulePath);
@@ -3674,6 +3697,7 @@ function extractRelevantCss(cssText) {
3674
3697
 
3675
3698
  // src/lib/renderModulePreview.ts
3676
3699
  import jsdom from "jsdom";
3700
+ var DEFAULT_SECTION_VARIANT = "section1";
3677
3701
  var _webDefaultStylesCss = null;
3678
3702
  function getWebDefaultStylesCss(metaUrl) {
3679
3703
  if (_webDefaultStylesCss === null) {
@@ -3926,6 +3950,7 @@ async function renderLocalProjectModulePreview(moduleName, authedPortalId, authe
3926
3950
  const themeVariablesCss = filteredCss ? `<style data-hs-styles="theme-variables">${filteredCss}</style>` : "";
3927
3951
  const webDefaultStylesCss = meta.editor_version === "2.0" ? getWebDefaultStylesCss(import.meta.url) : "";
3928
3952
  const globalStylesCss = [themeVariablesCss, webDefaultStylesCss].filter(Boolean).join("\n");
3953
+ const sectionVariant = filteredCss ? DEFAULT_SECTION_VARIANT : void 0;
3929
3954
  const renderResult = await renderComponentForPlaceholder(
3930
3955
  0,
3931
3956
  localRenderPlaceholders[0],
@@ -3937,7 +3962,7 @@ async function renderLocalProjectModulePreview(moduleName, authedPortalId, authe
3937
3962
  projectName,
3938
3963
  projectComponentPath
3939
3964
  );
3940
- return { ...renderResult, globalStylesCss };
3965
+ return { ...renderResult, globalStylesCss, sectionVariant };
3941
3966
  }
3942
3967
 
3943
3968
  // src/routes/partial.ts
@@ -4878,7 +4903,8 @@ async function modulePreviewRouteHandler(request, response) {
4878
4903
  cssNeeded,
4879
4904
  renderContext,
4880
4905
  inlineAssets,
4881
- globalStylesCss
4906
+ globalStylesCss,
4907
+ sectionVariant
4882
4908
  } = await renderLocalProjectModulePreview(
4883
4909
  moduleName,
4884
4910
  authedPortalId,
@@ -4906,6 +4932,7 @@ async function modulePreviewRouteHandler(request, response) {
4906
4932
  jsRenderingGates
4907
4933
  );
4908
4934
  const fullHeightCss = fullHeightPreview ? `<style>html,body{height:100%;width:100%;margin:0}#root{height:100%;width:100%}</style>` : "";
4935
+ const bodyHtml = sectionVariant ? `<div data-section-variant="${sectionVariant}">${renderedHtml}</div>` : renderedHtml;
4909
4936
  const html = addScriptInjectionBootstrapper(
4910
4937
  htmlShell.replace(
4911
4938
  "<!--headend-->",
@@ -4915,7 +4942,7 @@ async function modulePreviewRouteHandler(request, response) {
4915
4942
  cssNeeded,
4916
4943
  ...inlineAssets.map((inlineAsset) => inlineAsset.html)
4917
4944
  ].join("\n")
4918
- ).replace(`<!--ssr-outlet-->`, renderedHtml),
4945
+ ).replace(`<!--ssr-outlet-->`, bodyHtml),
4919
4946
  request.query
4920
4947
  );
4921
4948
  response.status(200).set({ "Content-Type": "text/html" }).end(html);
@@ -1,7 +1,7 @@
1
1
  // src/storybook/moduleStory.tsx
2
2
  import { useEffect } from "react";
3
3
 
4
- // ../cms-js-internal/dist/types-CBGC9bBc.js
4
+ // ../cms-js-internal/dist/types-B-d4FeeE.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-CBGC9bBc.js
11
+ // ../cms-js-internal/dist/types-B-d4FeeE.js
12
12
  import path from "path";
13
13
  import { createHash } from "crypto";
14
14
  import fs, { readFileSync, existsSync, readdirSync, lstatSync } from "fs";
@@ -385,8 +385,8 @@ function isStylesheetAsset(staticAsset) {
385
385
  return staticAsset.type === "stylesheet";
386
386
  }
387
387
  var COMPONENT_EXTENSIONS, ENTRY_POINTS_PATH, MODULE_FOLDER_PATH, TEMPLATE_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;
388
- var init_types_CBGC9bBc = __esm({
389
- "../cms-js-internal/dist/types-CBGC9bBc.js"() {
388
+ var init_types_B_d4FeeE = __esm({
389
+ "../cms-js-internal/dist/types-B-d4FeeE.js"() {
390
390
  COMPONENT_EXTENSIONS = [".jsx", ".tsx", ".js", ".ts"];
391
391
  ENTRY_POINTS_PATH = "components/partials/";
392
392
  MODULE_FOLDER_PATH = "components/modules/";
@@ -503,15 +503,12 @@ ${groupEnd}</script>
503
503
  HEALTHCHECKS_STRICT_DEFAULT = false;
504
504
  BUILD_INFO_PATH = "/build-info.json";
505
505
  GATES = [
506
- "CMS:JSRenderer:GetServerSideProps",
507
- "CMS:JSRenderer:ModuleHubl",
508
506
  "CMS:JSRenderer:RemoveMockClientEntryPlugin",
509
507
  "CMS:JSRenderer:AnalyzeCmsModules",
510
508
  "CMS:JSRenderer:StripNullBytes",
511
509
  "PortalsAccessIdentity:DesignManager:UrlSigning"
512
510
  ];
513
511
  ENABLED_FEATURES_GATE_MAP = {
514
- "cms:jsr:getServerSideProps": "CMS:JSRenderer:GetServerSideProps",
515
512
  "cms:jsr:analyzeCmsModules": "CMS:JSRenderer:AnalyzeCmsModules",
516
513
  "PortalsAccessIdentity:DesignManager:UrlSigning": "PortalsAccessIdentity:DesignManager:UrlSigning"
517
514
  };
@@ -1179,8 +1176,8 @@ function GlobalPartialSlot(props) {
1179
1176
  var setProperty, getProperty, hasProperty, serializeIslandDataForInlineScript, writeSharedStateToJsGlobal, createIslandsGlobalJsForClientInDev, traverse, CMS_MODULE_COMPONENT_NAME, DND_AREA_COMPONENT_NAME, PLUGIN_NAME, promiseForNewWritableStream, renderStreamToPromise, createServerRenderContextV22, createServerRenderContext2, renderServerSidePropsWithAsyncLocalStoreContext, bootStrapRenderContext;
1180
1177
  var init_dist = __esm({
1181
1178
  "../cms-js-internal/dist/index.js"() {
1182
- init_types_CBGC9bBc();
1183
- init_types_CBGC9bBc();
1179
+ init_types_B_d4FeeE();
1180
+ init_types_B_d4FeeE();
1184
1181
  ({ setProperty, getProperty, hasProperty } = dotProp);
1185
1182
  serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestData, baseIndent = 0, prettyPrint) => {
1186
1183
  const islandsArrayToSerialize = tweakedIslandsArray.map(
@@ -7,7 +7,7 @@ import { createServer as createViteServer, normalizePath as normalizePath2 } fro
7
7
  import { createRequire } from "module";
8
8
  import { default as react } from "@vitejs/plugin-react";
9
9
 
10
- // ../cms-js-internal/dist/types-CBGC9bBc.js
10
+ // ../cms-js-internal/dist/types-B-d4FeeE.js
11
11
  import path from "path";
12
12
  import fs, { readFileSync, existsSync, readdirSync, lstatSync } from "fs";
13
13
  import { join } from "path/posix";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cms-dev-server",
3
- "version": "1.2.70",
3
+ "version": "1.2.76",
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.70",
32
+ "@hubspot/cms-components": "^1.2.76",
33
33
  "@hubspot/local-dev-lib": "5.10.1",
34
34
  "@inquirer/select": "^2.0.0",
35
35
  "@originjs/vite-plugin-commonjs": "^1.0.3",
@@ -0,0 +1,8 @@
1
+ export declare function debugAuthContext(
2
+ authedPortalId: number,
3
+ cookieValue: string
4
+ ): Promise<void>;
5
+ export declare function compareUrls(
6
+ originalUrl: string,
7
+ signedUrl: string
8
+ ): void;
@@ -0,0 +1,2 @@
1
+ export declare function getLocalComponentsPath(): string;
2
+ export declare function shouldUseLocalComponents(): boolean;
@@ -1,4 +1,5 @@
1
1
  import { Gate } from '@hubspot/cms-js-internal';
2
+ export declare const DEFAULT_SECTION_VARIANT = "section1";
2
3
  export declare function signGetUrl(authedPortalId: number, unsignedUrl: string): Promise<string>;
3
4
  export declare function signedGet(authedPortalId: number, unsignedUrl: string, headers: Record<string, string>, gates: Gate[]): Promise<string>;
4
5
  export declare function renderRemoteModulePreview(modulePath: string, authedPortalId: any, authedEnv: any, cookieValue: any, gates: Gate[]): Promise<{
@@ -8,6 +9,7 @@ export declare function renderRemoteModulePreview(modulePath: string, authedPort
8
9
  export declare function signUrl(authedPortalId: number, unsignedUrl: string, requestBody: any): Promise<string>;
9
10
  export declare function renderLocalProjectModulePreview(moduleName: string, authedPortalId: any, authedEnv: any, authedHublet: any, webRoot: any, viteServer: any, jsRenderingGates: any, projectName: any, projectComponentPath: any, fullOriginalUrl: any, cookieValue: any, fieldOverrides?: {}): Promise<{
10
11
  globalStylesCss: string;
12
+ sectionVariant: string;
11
13
  html: string;
12
14
  inlineAssets?: import("@hubspot/cms-js-internal").InlineAsset[];
13
15
  cssNeeded: string;
@@ -0,0 +1,18 @@
1
+ import { ViteDevServer } from 'vite';
2
+ /**
3
+ * Processes HTML to find remote assets and replace with Vite-managed URLs
4
+ */
5
+ export declare function processRemoteAssets(
6
+ html: string,
7
+ viteServer: ViteDevServer
8
+ ): Promise<string>;
9
+ /**
10
+ * Vite plugin to handle remote assets
11
+ */
12
+ export declare function remoteAssetsPlugin(): {
13
+ name: string;
14
+ apply: 'serve';
15
+ configResolved(config: any): void;
16
+ resolveId(id: string): string;
17
+ load(id: string): Promise<string>;
18
+ };
@@ -0,0 +1,2 @@
1
+ import type { Plugin } from 'vite';
2
+ export declare function hubspotStaticAssetsPlugin(): Plugin;
@@ -0,0 +1,10 @@
1
+ import { ViteDevServer, Plugin } from 'vite';
2
+ /**
3
+ * Create a self-contained plugin with proper caching
4
+ */
5
+ export declare function remoteAssetsPlugin(): Plugin & {
6
+ processRemoteAssets: (
7
+ html: string,
8
+ viteServer: ViteDevServer
9
+ ) => Promise<string>;
10
+ };
@@ -0,0 +1,6 @@
1
+ import type { Plugin } from 'vite';
2
+ /**
3
+ * Plugin that provides URL signing capabilities
4
+ * Uses internal signing mechanisms when available, with fallback for public environments
5
+ */
6
+ export default function requestSigningPlugin(): Plugin;
@@ -1,5 +1,13 @@
1
1
  import { Request, Response, NextFunction } from 'express';
2
- export declare function handleGetModulePages(req: Request, res: Response, next: NextFunction): Promise<Response<any, Record<string, any>>>;
3
- export declare function handleOpenFile(req: Request, res: Response, next: NextFunction): Response<any, Record<string, any>>;
4
- export declare function createAppServerRoutes(): import("express-serve-static-core").Router;
2
+ export declare function handleGetModulePages(
3
+ req: Request,
4
+ res: Response,
5
+ next: NextFunction
6
+ ): Promise<Response<any, Record<string, any>>>;
7
+ export declare function handleOpenFile(
8
+ req: Request,
9
+ res: Response,
10
+ next: NextFunction
11
+ ): Response<any, Record<string, any>>;
12
+ export declare function createAppServerRoutes(): import('express-serve-static-core').Router;
5
13
  export default createAppServerRoutes;
@@ -1,3 +1,7 @@
1
1
  import { Request, Response } from 'express';
2
- declare const homeRouteHandler: (request: Request, response: Response, next: Function) => Promise<void>;
2
+ declare const homeRouteHandler: (
3
+ request: Request,
4
+ response: Response,
5
+ next: Function
6
+ ) => Promise<void>;
3
7
  export default homeRouteHandler;