@hubspot/cms-dev-server 1.2.35 → 1.2.36

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/.DS_Store ADDED
Binary file
@@ -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-BEz622C8.js
13
+ // ../cms-js-internal/dist/types-CliAmBEj.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-BEz622C8.js
6
+ // ../cms-js-internal/dist/types-CliAmBEj.js
7
7
  import path from "path";
8
8
  import { createHash } from "crypto";
9
9
  import fs, { readFileSync, existsSync, readdirSync, lstatSync } from "fs";
@@ -249,6 +249,7 @@ function getCMSAssetConfigIfExists(webRoot) {
249
249
  }
250
250
  var ENABLED_FEATURES_GATE_MAP = {
251
251
  "cms:jsr:getServerSideProps": "CMS:JSRenderer:GetServerSideProps",
252
+ "cms:jsr:RemoveCjsPlugin": "CMS:JSRenderer:RemoveCjsPlugin",
252
253
  "cms:jsr:analyzeCmsModules": "CMS:JSRenderer:AnalyzeCmsModules",
253
254
  "PortalsAccessIdentity:DesignManager:UrlSigning": "PortalsAccessIdentity:DesignManager:UrlSigning"
254
255
  };
@@ -1642,7 +1643,7 @@ function trackUsage(action) {
1642
1643
  eventName: EVENT_NAME,
1643
1644
  action,
1644
1645
  nodeVersion: getNodeVersionData(),
1645
- version: "1.2.35",
1646
+ version: "1.2.36",
1646
1647
  os: getPlatform()
1647
1648
  };
1648
1649
  const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
@@ -1,4 +1,4 @@
1
- // ../cms-js-internal/dist/types-BEz622C8.js
1
+ // ../cms-js-internal/dist/types-CliAmBEj.js
2
2
  import path from "path";
3
3
  import { createHash } from "crypto";
4
4
  import fs, { readFileSync, existsSync, readdirSync, lstatSync } from "fs";
@@ -383,6 +383,7 @@ function getBaseAssetUrlFromBuild(buildDir) {
383
383
  var GATES = [
384
384
  "CMS:JSRenderer:GetServerSideProps",
385
385
  "CMS:JSRenderer:ModuleHubl",
386
+ "CMS:JSRenderer:RemoveCjsPlugin",
386
387
  "CMS:JSRenderer:RemoveMockClientEntryPlugin",
387
388
  "CMS:JSRenderer:AnalyzeCmsModules",
388
389
  "CMS:JSRenderer:StripNullBytes",
@@ -390,13 +391,14 @@ var GATES = [
390
391
  ];
391
392
  var ENABLED_FEATURES_GATE_MAP = {
392
393
  "cms:jsr:getServerSideProps": "CMS:JSRenderer:GetServerSideProps",
394
+ "cms:jsr:RemoveCjsPlugin": "CMS:JSRenderer:RemoveCjsPlugin",
393
395
  "cms:jsr:analyzeCmsModules": "CMS:JSRenderer:AnalyzeCmsModules",
394
396
  "PortalsAccessIdentity:DesignManager:UrlSigning": "PortalsAccessIdentity:DesignManager:UrlSigning"
395
397
  };
396
398
  function isUngatedFor(gates, gate) {
397
399
  return gates.includes(gate);
398
400
  }
399
- function ungatedAtBuildTimeFor(buildDir, gate) {
401
+ function ungatedIAtBuildTimeFor(buildDir, gate) {
400
402
  try {
401
403
  const buildInfo = getBuildInfo(buildDir);
402
404
  return isUngatedFor(buildInfo.gates, gate);
@@ -1308,6 +1310,6 @@ export {
1308
1310
  scriptTagToLogServerMessages,
1309
1311
  serializeIslandDataForInlineScript,
1310
1312
  setIn,
1311
- ungatedAtBuildTimeFor,
1313
+ ungatedIAtBuildTimeFor,
1312
1314
  virtualClientRenderIslandModuleId
1313
1315
  };
@@ -107,7 +107,9 @@ function setupIdleCallbackIfNeeded() {
107
107
  }
108
108
  function finishHydratingRootAndScheduleNext(rootAndExtraInfo) {
109
109
  rootAndExtraInfo.root.hydrationStatus = "HYDRATED";
110
- hydrationQueue = hydrationQueue.filter((x) => x !== rootAndExtraInfo);
110
+ hydrationQueue = hydrationQueue.filter(
111
+ (x) => x.root.id !== rootAndExtraInfo.root.id
112
+ );
111
113
  const hasOtherRootsToHydrate = hydrationQueue.length > 0;
112
114
  if (hasOtherRootsToHydrate) {
113
115
  setTimeout(() => hydrateRoot(hydrationQueue[0]), 0);
@@ -134,8 +136,7 @@ function hydrateRoot(rootAndExtraInfo) {
134
136
  index: rootAndExtraInfo.islandScheduledIndex
135
137
  };
136
138
  const reactRoot = IslandModule.render(renderableIsland);
137
- const existingRoots = rootsById.get(root.id) || [];
138
- rootsById.set(root.id, [...existingRoots, reactRoot]);
139
+ rootsById.set(root.id, reactRoot);
139
140
  }
140
141
  function pushToHydrationQueue(rootAndExtraInfo) {
141
142
  rootAndExtraInfo.root.hydrationStatus = "HYDRATION_QUEUED";
@@ -164,42 +165,28 @@ function loadThenHydrate(root, LoadableIslandModule, LoadableWrapperModule, root
164
165
  });
165
166
  }
166
167
  function waitThenLoadAndHydrateIfNeeded(root, LoadableIslandModule, LoadableWrapperModule) {
167
- let rootEls;
168
- if (typeof CSS !== "undefined" && CSS.escape) {
169
- rootEls = Array.from(
170
- document.querySelectorAll(
171
- `[data-hs-island][id="${CSS.escape(root.id)}"]`
172
- )
173
- );
174
- } else {
175
- rootEls = Array.from(
176
- document.querySelectorAll("[data-hs-island]")
177
- ).filter((el) => el.id === root.id);
178
- }
179
- rootEls.forEach((rootEl) => {
180
- const rootClone = { ...root };
181
- const islandScheduledIndex = scheduledHydrationIndexCtr;
182
- scheduledHydrationIndexCtr += 1;
183
- if (rootClone.hydrateOn === "visible") {
184
- onVisible(rootEl, () => {
185
- loadThenHydrate(
186
- rootClone,
187
- LoadableIslandModule,
188
- LoadableWrapperModule,
189
- rootEl,
190
- islandScheduledIndex
191
- );
192
- });
193
- } else {
168
+ const rootEl = document.getElementById(root.id);
169
+ const islandScheduledIndex = scheduledHydrationIndexCtr;
170
+ scheduledHydrationIndexCtr += 1;
171
+ if (root.hydrateOn === "visible") {
172
+ onVisible(rootEl, () => {
194
173
  loadThenHydrate(
195
- rootClone,
174
+ root,
196
175
  LoadableIslandModule,
197
176
  LoadableWrapperModule,
198
177
  rootEl,
199
178
  islandScheduledIndex
200
179
  );
201
- }
202
- });
180
+ });
181
+ } else {
182
+ loadThenHydrate(
183
+ root,
184
+ LoadableIslandModule,
185
+ LoadableWrapperModule,
186
+ rootEl,
187
+ islandScheduledIndex
188
+ );
189
+ }
203
190
  }
204
191
  function getLoadableModuleFor(root) {
205
192
  let url = root.url;
@@ -264,17 +251,15 @@ function unmountIsland(islandId) {
264
251
  const islandToUnmount = rootsToProcess.find(
265
252
  (island) => island.id === islandId
266
253
  );
267
- const reactRoots = rootsById.get(islandId);
268
- if (!islandToUnmount || !reactRoots || reactRoots.length === 0) {
254
+ if (!islandToUnmount || !rootsById.get(islandId)) {
269
255
  throw new Error(`No known island: ${islandId}`);
270
256
  }
271
257
  const islandIndex = rootsToProcess.indexOf(islandToUnmount);
258
+ const reactRoot = rootsById.get(islandId);
272
259
  rootsToProcess.splice(islandIndex, 1);
273
260
  rootsById.delete(islandId);
274
261
  console.log("Unmounting island:", islandId);
275
- for (const reactRoot of reactRoots) {
276
- reactRoot.unmount();
277
- }
262
+ reactRoot.unmount();
278
263
  }
279
264
  export {
280
265
  setupIslandHydration,
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-BEz622C8.js
899
+ // ../cms-js-internal/dist/types-CliAmBEj.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";
@@ -1142,6 +1142,7 @@ function getCMSAssetConfigIfExists(webRoot2) {
1142
1142
  }
1143
1143
  var ENABLED_FEATURES_GATE_MAP = {
1144
1144
  "cms:jsr:getServerSideProps": "CMS:JSRenderer:GetServerSideProps",
1145
+ "cms:jsr:RemoveCjsPlugin": "CMS:JSRenderer:RemoveCjsPlugin",
1145
1146
  "cms:jsr:analyzeCmsModules": "CMS:JSRenderer:AnalyzeCmsModules",
1146
1147
  "PortalsAccessIdentity:DesignManager:UrlSigning": "PortalsAccessIdentity:DesignManager:UrlSigning"
1147
1148
  };
@@ -2249,7 +2250,7 @@ function trackUsage(action) {
2249
2250
  eventName: EVENT_NAME,
2250
2251
  action,
2251
2252
  nodeVersion: getNodeVersionData(),
2252
- version: "1.2.35",
2253
+ version: "1.2.36",
2253
2254
  os: getPlatform()
2254
2255
  };
2255
2256
  const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
@@ -1,7 +1,7 @@
1
1
  // src/storybook/moduleStory.tsx
2
2
  import { useEffect } from "react";
3
3
 
4
- // ../cms-js-internal/dist/types-BEz622C8.js
4
+ // ../cms-js-internal/dist/types-CliAmBEj.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-BEz622C8.js
11
+ // ../cms-js-internal/dist/types-CliAmBEj.js
12
12
  import path from "path";
13
13
  import { createHash } from "crypto";
14
14
  import fs, { readFileSync, existsSync, readdirSync, lstatSync } from "fs";
@@ -276,7 +276,7 @@ function getBaseAssetUrlFromBuild(buildDir) {
276
276
  function isUngatedFor(gates, gate) {
277
277
  return gates.includes(gate);
278
278
  }
279
- function ungatedAtBuildTimeFor(buildDir, gate) {
279
+ function ungatedIAtBuildTimeFor(buildDir, gate) {
280
280
  try {
281
281
  const buildInfo = getBuildInfo(buildDir);
282
282
  return isUngatedFor(buildInfo.gates, gate);
@@ -378,8 +378,8 @@ function isStylesheetAsset(staticAsset) {
378
378
  return staticAsset.type === "stylesheet";
379
379
  }
380
380
  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;
381
- var init_types_BEz622C8 = __esm({
382
- "../cms-js-internal/dist/types-BEz622C8.js"() {
381
+ var init_types_CliAmBEj = __esm({
382
+ "../cms-js-internal/dist/types-CliAmBEj.js"() {
383
383
  COMPONENT_EXTENSIONS = [".jsx", ".tsx", ".js", ".ts"];
384
384
  ENTRY_POINTS_PATH = "components/partials/";
385
385
  MODULE_FOLDER_PATH = "components/modules/";
@@ -498,6 +498,7 @@ ${groupEnd}</script>
498
498
  GATES = [
499
499
  "CMS:JSRenderer:GetServerSideProps",
500
500
  "CMS:JSRenderer:ModuleHubl",
501
+ "CMS:JSRenderer:RemoveCjsPlugin",
501
502
  "CMS:JSRenderer:RemoveMockClientEntryPlugin",
502
503
  "CMS:JSRenderer:AnalyzeCmsModules",
503
504
  "CMS:JSRenderer:StripNullBytes",
@@ -505,6 +506,7 @@ ${groupEnd}</script>
505
506
  ];
506
507
  ENABLED_FEATURES_GATE_MAP = {
507
508
  "cms:jsr:getServerSideProps": "CMS:JSRenderer:GetServerSideProps",
509
+ "cms:jsr:RemoveCjsPlugin": "CMS:JSRenderer:RemoveCjsPlugin",
508
510
  "cms:jsr:analyzeCmsModules": "CMS:JSRenderer:AnalyzeCmsModules",
509
511
  "PortalsAccessIdentity:DesignManager:UrlSigning": "PortalsAccessIdentity:DesignManager:UrlSigning"
510
512
  };
@@ -603,7 +605,7 @@ __export(dist_exports, {
603
605
  scriptTagToLogServerMessages: () => scriptTagToLogServerMessages,
604
606
  serializeIslandDataForInlineScript: () => serializeIslandDataForInlineScript,
605
607
  setIn: () => setIn,
606
- ungatedAtBuildTimeFor: () => ungatedAtBuildTimeFor,
608
+ ungatedIAtBuildTimeFor: () => ungatedIAtBuildTimeFor,
607
609
  virtualClientRenderIslandModuleId: () => virtualClientRenderIslandModuleId
608
610
  });
609
611
  import * as dotProp from "dot-prop";
@@ -1171,8 +1173,8 @@ function GlobalPartialSlot(props) {
1171
1173
  var setProperty, getProperty, hasProperty, serializeIslandDataForInlineScript, writeSharedStateToJsGlobal, createIslandsGlobalJsForClientInDev, traverse, CMS_MODULE_COMPONENT_NAME, DND_AREA_COMPONENT_NAME, PLUGIN_NAME, promiseForNewWritableStream, renderStreamToPromise, createServerRenderContextV22, createServerRenderContext2, renderServerSidePropsWithAsyncLocalStoreContext, bootStrapRenderContext;
1172
1174
  var init_dist = __esm({
1173
1175
  "../cms-js-internal/dist/index.js"() {
1174
- init_types_BEz622C8();
1175
- init_types_BEz622C8();
1176
+ init_types_CliAmBEj();
1177
+ init_types_CliAmBEj();
1176
1178
  ({ setProperty, getProperty, hasProperty } = dotProp);
1177
1179
  serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestData, baseIndent = 0, prettyPrint) => {
1178
1180
  const islandsArrayToSerialize = tweakedIslandsArray.map(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cms-dev-server",
3
- "version": "1.2.35",
3
+ "version": "1.2.36",
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.35",
32
+ "@hubspot/cms-components": "^1.2.36",
33
33
  "@hubspot/local-dev-lib": "4.0.2",
34
34
  "@inquirer/select": "^2.0.0",
35
35
  "@originjs/vite-plugin-commonjs": "^1.0.3",
@@ -133,5 +133,5 @@
133
133
  "publishConfig": {
134
134
  "access": "public"
135
135
  },
136
- "gitHead": "a5fafbd967b2372ebc45952a0e62c0228c0b490e"
136
+ "gitHead": "84ee77b1dfdfd7fd5421260de5b91edaf48157ff"
137
137
  }
@@ -0,0 +1,2 @@
1
+ export declare function debugAuthContext(authedPortalId: number, cookieValue: string): Promise<void>;
2
+ export declare function compareUrls(originalUrl: string, signedUrl: string): void;
@@ -0,0 +1,2 @@
1
+ export declare function getLocalComponentsPath(): string;
2
+ export declare function shouldUseLocalComponents(): boolean;
@@ -0,0 +1,15 @@
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(html: string, viteServer: ViteDevServer): Promise<string>;
6
+ /**
7
+ * Vite plugin to handle remote assets
8
+ */
9
+ export declare function remoteAssetsPlugin(): {
10
+ name: string;
11
+ apply: "serve";
12
+ configResolved(config: any): void;
13
+ resolveId(id: string): string;
14
+ load(id: string): Promise<string>;
15
+ };
@@ -0,0 +1,2 @@
1
+ import type { Plugin } from 'vite';
2
+ export declare function hubspotStaticAssetsPlugin(): Plugin;
@@ -0,0 +1,7 @@
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: (html: string, viteServer: ViteDevServer) => Promise<string>;
7
+ };
@@ -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;
@@ -0,0 +1,5 @@
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;
5
+ export default createAppServerRoutes;
@@ -0,0 +1,3 @@
1
+ import { Request, Response } from 'express';
2
+ declare const homeRouteHandler: (request: Request, response: Response, next: Function) => Promise<void>;
3
+ export default homeRouteHandler;