@hubspot/cms-dev-server 0.6.4 → 0.6.6

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/index.js CHANGED
@@ -91,8 +91,12 @@ async function createViteDevServer(webRoot, port, sslEnabled, domainsToProxy = [
91
91
  `${proxyDomain}.localhost`,
92
92
  `${proxyDomain}.hslocal.net`
93
93
  ]).flat();
94
- additionalMkcertHosts.push("*.hslocal.net", "hslocal.net");
95
- const origin = sslEnabled ? `https://hslocal.net:${port}` : `http://hslocal.net:${port}`;
94
+ if (process.env.VITE_ORIGIN) {
95
+ console.log(`
96
+ Custom origin: ${process.env.VITE_ORIGIN}
97
+ `);
98
+ }
99
+ const origin = process.env.VITE_ORIGIN ?? (sslEnabled ? `https://hslocal.net:${port}` : `http://hslocal.net:${port}`);
96
100
  const viteConfig = {
97
101
  appType: "custom",
98
102
  server: {
@@ -145,12 +145,39 @@ function getIslandUrls(roots, viteDevServer) {
145
145
  return tweakedIsland;
146
146
  });
147
147
  }
148
+ function getPerServerRequestUrls(perServerRequestData, viteDevServer) {
149
+ if (!perServerRequestData.has("sharedStateIDs")) {
150
+ return new Map(perServerRequestData);
151
+ }
152
+ const perServerRequestDataWithUrls = new Map(
153
+ perServerRequestData
154
+ );
155
+ perServerRequestData.get("sharedStateIDs").forEach((id) => {
156
+ const reducer = perServerRequestData.get(id);
157
+ const reducerWithUrl = {
158
+ ...reducer,
159
+ reducerFuncModuleUrl: viteDevServer.moduleGraph.getModuleById(
160
+ reducer.reducerFuncModuleId
161
+ ).url
162
+ };
163
+ perServerRequestDataWithUrls.set(id, reducerWithUrl);
164
+ });
165
+ return perServerRequestDataWithUrls;
166
+ }
148
167
  var createIslandsGlobalJsForClientInDev = (roots, perServerRequestData, viteDevServer, indent) => {
149
168
  const islands = getIslandUrls(roots, viteDevServer);
169
+ const perServerRequestDataWithUrls = getPerServerRequestUrls(
170
+ perServerRequestData,
171
+ viteDevServer
172
+ );
150
173
  return `window.__islands = ${serializeIslandDataToJSON(
151
174
  islands,
152
175
  indent
153
- )}${writeSharedStateToJsGlobal(islands, perServerRequestData, indent)}`;
176
+ )}${writeSharedStateToJsGlobal(
177
+ islands,
178
+ perServerRequestDataWithUrls,
179
+ indent
180
+ )}`;
154
181
  };
155
182
  var GATES = [
156
183
  "CMS:JSRenderer:SharedDeps",
@@ -456,6 +483,27 @@ function getServerGlobalsToInject(environmentConfig, hsServerPageUrl, hsBasePath
456
483
  </script>
457
484
  `;
458
485
  }
486
+ function namespaceModulePropsShape(props) {
487
+ const {
488
+ dataQueryResult,
489
+ hublParameters,
490
+ fieldValues: passedFieldValues
491
+ } = props;
492
+ const oldPropsShape = { ...props };
493
+ if (oldPropsShape.dataQueryResult) {
494
+ delete oldPropsShape.dataQueryResult;
495
+ }
496
+ if (oldPropsShape.hublParameters) {
497
+ delete oldPropsShape.hublParameters;
498
+ }
499
+ const fieldValues = passedFieldValues || oldPropsShape;
500
+ return {
501
+ ...fieldValues,
502
+ dataQueryResult,
503
+ fieldValues,
504
+ hublParameters
505
+ };
506
+ }
459
507
  function setIn(object, nestedKeysArray, value) {
460
508
  let curr = object;
461
509
  const finalKey = nestedKeysArray.pop();
@@ -514,6 +562,7 @@ export {
514
562
  hasComponentExtension,
515
563
  isStorybookStory,
516
564
  isUngatedFor,
565
+ namespaceModulePropsShape,
517
566
  removeComponentExtension,
518
567
  renderComponentOnServer,
519
568
  renderFieldsToJson,
@@ -0,0 +1,171 @@
1
+ // ../cms-js-internal/dist/island-runtime/island-runtime.js
2
+ var HYDRATION_WAITING = "HYDRATION_WAITING";
3
+ var HYDRATION_PREPARING = "HYDRATION_PREPARING";
4
+ var HYDRATION_QUEUED = "HYDRATION_QUEUED";
5
+ var HYDRATED = "HYDRATED";
6
+ var rootsToProcess;
7
+ var hydrationQueue = [];
8
+ var hydrationTypesToAccept = /* @__PURE__ */ new Set(["load", "visible"]);
9
+ var startHydratingIdleRootsTimeout;
10
+ var shouldForceSeparateJsForAllIslands = /(&|\?)forceSeparateIslandJs=true/.test(window.location.search);
11
+ var scheduledHydrationIndexCtr = 1;
12
+ var rootsById = /* @__PURE__ */ new Map();
13
+ var typedWindow = window;
14
+ var startHydratingIdleRoots = () => {
15
+ hydrationTypesToAccept.add("idle");
16
+ for (const root of rootsToProcess) {
17
+ if (root.hydrationStatus === HYDRATION_WAITING && hydrationTypesToAccept.has(root.hydrateOn)) {
18
+ root.hydrationStatus = HYDRATION_PREPARING;
19
+ waitThenLoadAndHydrateIfNeeded(root, getLoadableModuleFor(root));
20
+ }
21
+ }
22
+ };
23
+ function setupIdleCallbackIfNeeded() {
24
+ if (!startHydratingIdleRootsTimeout) {
25
+ if (!window.requestIdleCallback) {
26
+ setTimeout(() => {
27
+ startHydratingIdleRoots();
28
+ }, 1);
29
+ return;
30
+ }
31
+ startHydratingIdleRootsTimeout = requestIdleCallback(
32
+ startHydratingIdleRoots,
33
+ { timeout: 5e3 }
34
+ );
35
+ }
36
+ }
37
+ function finishHydratingRootAndScheduleNext(rootAndExtraInfo) {
38
+ rootAndExtraInfo.root.hydrationStatus = HYDRATED;
39
+ hydrationQueue = hydrationQueue.filter(
40
+ (x) => x.root.id !== rootAndExtraInfo.root.id
41
+ );
42
+ const hasOtherRootsToHydrate = hydrationQueue.length > 0;
43
+ if (hasOtherRootsToHydrate) {
44
+ setTimeout(() => hydrateRoot(hydrationQueue[0]), 0);
45
+ } else if (!hasOtherRootsToHydrate && !hydrationTypesToAccept.has("idle")) {
46
+ setupIdleCallbackIfNeeded();
47
+ }
48
+ }
49
+ function hydrateRoot(rootAndExtraInfo) {
50
+ const { rootEl, root, IslandModule } = rootAndExtraInfo;
51
+ console.log("Hydrating root", root.id, root.hydrateOn);
52
+ const postHydration = () => {
53
+ finishHydratingRootAndScheduleNext(rootAndExtraInfo);
54
+ };
55
+ const renderableIsland = {
56
+ rootElement: rootEl,
57
+ pageUrl: typedWindow.__hsServerPageUrl,
58
+ basePath: typedWindow.__hsBasePath,
59
+ islands: typedWindow.__islands,
60
+ postHydration,
61
+ island: root,
62
+ index: rootAndExtraInfo.islandScheduledIndex
63
+ };
64
+ const reactRoot = IslandModule.render(renderableIsland);
65
+ rootsById[root.id] = reactRoot;
66
+ }
67
+ function pushToHydrationQueue(rootAndExtraInfo) {
68
+ rootAndExtraInfo.root.hydrationStatus = HYDRATION_QUEUED;
69
+ hydrationQueue.push(rootAndExtraInfo);
70
+ if (hydrationQueue.length === 1) {
71
+ hydrateRoot(rootAndExtraInfo);
72
+ }
73
+ }
74
+ function loadThenHydrate(root, LoadableIslandModule, rootEl, islandScheduledIndex) {
75
+ LoadableIslandModule().then((IslandModule) => {
76
+ pushToHydrationQueue({
77
+ rootEl,
78
+ root,
79
+ IslandModule,
80
+ islandScheduledIndex
81
+ });
82
+ }).catch((error) => {
83
+ console.error(`Failed to load module for island: ${root.id}`);
84
+ console.error(error);
85
+ });
86
+ }
87
+ function waitThenLoadAndHydrateIfNeeded(root, LoadableIslandModule) {
88
+ const rootEl = document.getElementById(root.id);
89
+ const islandScheduledIndex = scheduledHydrationIndexCtr;
90
+ scheduledHydrationIndexCtr += 1;
91
+ if (root.hydrateOn === "visible") {
92
+ onVisible(rootEl, () => {
93
+ loadThenHydrate(root, LoadableIslandModule, rootEl, islandScheduledIndex);
94
+ });
95
+ } else {
96
+ loadThenHydrate(root, LoadableIslandModule, rootEl, islandScheduledIndex);
97
+ }
98
+ }
99
+ function getLoadableModuleFor(root) {
100
+ let url = `${window.location.origin}${root.url}`;
101
+ if (shouldForceSeparateJsForAllIslands) {
102
+ url = `${root.url}?cacheBust=${Date.now()}-${root.id}`;
103
+ }
104
+ const LoadableIslandModule = () => import(
105
+ /* @vite-ignore */
106
+ url
107
+ );
108
+ if (!LoadableIslandModule) {
109
+ throw new Error(`Missing island component for ${root.moduleName}`);
110
+ }
111
+ return LoadableIslandModule;
112
+ }
113
+ function hydrateIslandRoots() {
114
+ if (rootsToProcess === void 0) {
115
+ rootsToProcess = typedWindow.__islands;
116
+ console.log("Starting to hydrate", rootsToProcess);
117
+ if (shouldForceSeparateJsForAllIslands) {
118
+ console.log(" ... forcibly making every island refetch JS");
119
+ }
120
+ }
121
+ let encounteredAnyNonIdleIslands = false;
122
+ for (const root of rootsToProcess) {
123
+ if (!root.hydrationStatus) {
124
+ root.hydrationStatus = root.hydrationStatus || HYDRATION_WAITING;
125
+ if (hydrationTypesToAccept.has(root.hydrateOn)) {
126
+ encounteredAnyNonIdleIslands = true;
127
+ root.hydrationStatus = HYDRATION_PREPARING;
128
+ waitThenLoadAndHydrateIfNeeded(root, getLoadableModuleFor(root));
129
+ }
130
+ }
131
+ }
132
+ if (rootsToProcess.length > 0 && !encounteredAnyNonIdleIslands) {
133
+ setupIdleCallbackIfNeeded();
134
+ }
135
+ }
136
+ function setupIslandHydration() {
137
+ if (document.readyState === "interactive" || document.readyState === "complete") {
138
+ hydrateIslandRoots();
139
+ } else {
140
+ window.addEventListener("DOMContentLoaded", hydrateIslandRoots);
141
+ }
142
+ }
143
+ function unmountIsland(islandId) {
144
+ const islandToUnmount = rootsToProcess.find((island) => island.id === islandId);
145
+ if (!islandToUnmount || !rootsById[islandId]) {
146
+ throw new Error(`No known island: ${islandId}`);
147
+ }
148
+ const islandIndex = rootsToProcess.indexOf(islandToUnmount);
149
+ const reactRoot = rootsById[islandId];
150
+ rootsToProcess.splice(islandIndex, 1);
151
+ delete rootsById[islandId];
152
+ console.log("Unmounting island:", islandId);
153
+ reactRoot.unmount();
154
+ }
155
+ var onVisible = (islandEl, callback) => {
156
+ const observer = new IntersectionObserver((entries) => {
157
+ if (entries.some((entry) => entry.isIntersecting)) {
158
+ observer.disconnect();
159
+ callback();
160
+ }
161
+ return;
162
+ });
163
+ for (let i = 0; i < islandEl.children.length; i++) {
164
+ const child = islandEl.children[i];
165
+ observer.observe(child);
166
+ }
167
+ };
168
+ export {
169
+ setupIslandHydration,
170
+ unmountIsland
171
+ };
package/dist/run.js CHANGED
@@ -141,12 +141,39 @@ function getIslandUrls(roots, viteDevServer) {
141
141
  return tweakedIsland;
142
142
  });
143
143
  }
144
+ function getPerServerRequestUrls(perServerRequestData, viteDevServer) {
145
+ if (!perServerRequestData.has("sharedStateIDs")) {
146
+ return new Map(perServerRequestData);
147
+ }
148
+ const perServerRequestDataWithUrls = new Map(
149
+ perServerRequestData
150
+ );
151
+ perServerRequestData.get("sharedStateIDs").forEach((id) => {
152
+ const reducer = perServerRequestData.get(id);
153
+ const reducerWithUrl = {
154
+ ...reducer,
155
+ reducerFuncModuleUrl: viteDevServer.moduleGraph.getModuleById(
156
+ reducer.reducerFuncModuleId
157
+ ).url
158
+ };
159
+ perServerRequestDataWithUrls.set(id, reducerWithUrl);
160
+ });
161
+ return perServerRequestDataWithUrls;
162
+ }
144
163
  var createIslandsGlobalJsForClientInDev = (roots, perServerRequestData, viteDevServer, indent) => {
145
164
  const islands = getIslandUrls(roots, viteDevServer);
165
+ const perServerRequestDataWithUrls = getPerServerRequestUrls(
166
+ perServerRequestData,
167
+ viteDevServer
168
+ );
146
169
  return `window.__islands = ${serializeIslandDataToJSON(
147
170
  islands,
148
171
  indent
149
- )}${writeSharedStateToJsGlobal(islands, perServerRequestData, indent)}`;
172
+ )}${writeSharedStateToJsGlobal(
173
+ islands,
174
+ perServerRequestDataWithUrls,
175
+ indent
176
+ )}`;
150
177
  };
151
178
  var ENABLED_FEATURES_GATE_MAP = {
152
179
  "cms:jsr:sharedDeps": "CMS:JSRenderer:SharedDeps",
@@ -409,6 +436,27 @@ function getServerGlobalsToInject(environmentConfig, hsServerPageUrl, hsBasePath
409
436
  </script>
410
437
  `;
411
438
  }
439
+ function namespaceModulePropsShape(props) {
440
+ const {
441
+ dataQueryResult,
442
+ hublParameters,
443
+ fieldValues: passedFieldValues
444
+ } = props;
445
+ const oldPropsShape = { ...props };
446
+ if (oldPropsShape.dataQueryResult) {
447
+ delete oldPropsShape.dataQueryResult;
448
+ }
449
+ if (oldPropsShape.hublParameters) {
450
+ delete oldPropsShape.hublParameters;
451
+ }
452
+ const fieldValues = passedFieldValues || oldPropsShape;
453
+ return {
454
+ ...fieldValues,
455
+ dataQueryResult,
456
+ fieldValues,
457
+ hublParameters
458
+ };
459
+ }
412
460
  function setIn(object, nestedKeysArray, value) {
413
461
  let curr = object;
414
462
  const finalKey = nestedKeysArray.pop();
@@ -614,7 +662,10 @@ var generateIslandSetupScriptBlock = (gates) => {
614
662
  initConfigSingletonFromJSON(window.__hsEnvConfig);
615
663
  </script>
616
664
  <script type="module">
617
- import { setupIslandHydration } from '@hubspot/cms-components/island-runtime-shared';
665
+ import { setupIslandHydration } from '${packagePath(
666
+ import.meta.url,
667
+ "island-runtime"
668
+ )}';
618
669
  setupIslandHydration();
619
670
  </script>
620
671
  `;
@@ -864,6 +915,34 @@ import { normalizePath as normalizePath3 } from "vite";
864
915
  // src/lib/renderModule.ts
865
916
  import { join as joinPosix } from "path/posix";
866
917
  import { traverseFieldsJSON } from "@hubspot/cms-components/fields";
918
+
919
+ // src/lib/fetchModuleGraphQLData.ts
920
+ import cliHttp from "@hubspot/cli-lib/http.js";
921
+ var graphQLCache = /* @__PURE__ */ new Map();
922
+ async function fetchModuleGraphQLData(accountId, query, requestedModulePath, pageUrl) {
923
+ const { searchParams } = new URL(pageUrl);
924
+ const hsLocalQueryKey = searchParams.get("hsLocalQueryKey");
925
+ const compositeQueryKey = `${hsLocalQueryKey}:${query}`;
926
+ let dataQueryResult;
927
+ if (graphQLCache.has(compositeQueryKey)) {
928
+ console.log(`Using cached GraphQL Query for ${requestedModulePath}`);
929
+ return Promise.resolve(graphQLCache.get(compositeQueryKey));
930
+ }
931
+ try {
932
+ dataQueryResult = await cliHttp.post(accountId, {
933
+ uri: "/collector/v3/graphql",
934
+ body: {
935
+ query
936
+ }
937
+ });
938
+ } catch (e) {
939
+ throw new Error(e);
940
+ }
941
+ graphQLCache.set(compositeQueryKey, dataQueryResult);
942
+ return dataQueryResult;
943
+ }
944
+
945
+ // src/lib/renderModule.ts
867
946
  var lookForModuleInFolder = async (modulePath, viteServer) => {
868
947
  let componentModule;
869
948
  const insideFolderPath = joinPosix(modulePath, "index");
@@ -884,6 +963,7 @@ async function renderModule(viteServer, requestedModulePath, fieldOverrides = {}
884
963
  );
885
964
  let serverSideProps;
886
965
  let componentModule;
966
+ let dataQueryResult;
887
967
  let foundPath;
888
968
  if (!hasComponentExtension(requestedModulePath)) {
889
969
  [componentModule, foundPath] = await lookForModuleInFolder(
@@ -923,11 +1003,36 @@ async function renderModule(viteServer, requestedModulePath, fieldOverrides = {}
923
1003
  console.error(e);
924
1004
  }
925
1005
  }
1006
+ if (componentModule.query && typeof componentModule.query === "string") {
1007
+ try {
1008
+ dataQueryResult = await fetchModuleGraphQLData(
1009
+ environmentConfig.getHubID(),
1010
+ componentModule.query,
1011
+ requestedModulePath,
1012
+ pageUrl
1013
+ );
1014
+ if (dataQueryResult.errors && dataQueryResult.errors.length) {
1015
+ dataQueryResult.errors.forEach((graphQLError) => {
1016
+ console.error(graphQLError);
1017
+ });
1018
+ console.error("Your GraphQL query resulted in the above errors");
1019
+ }
1020
+ } catch (error) {
1021
+ console.error(error.message);
1022
+ console.error(
1023
+ `Failed to execute query for ${requestedModulePath}. Check the above error message for more information.`
1024
+ );
1025
+ }
1026
+ }
1027
+ const namespacedModuleProps = namespaceModulePropsShape({
1028
+ ...props,
1029
+ dataQueryResult
1030
+ });
926
1031
  return renderComponentWithCSS_default(
927
1032
  viteServer,
928
1033
  foundPath,
929
1034
  Component,
930
- { ...props, ...serverSideProps },
1035
+ { ...namespacedModuleProps, serverSideProps },
931
1036
  pageUrl,
932
1037
  basePath,
933
1038
  environmentConfig,
@@ -1947,8 +2052,12 @@ async function createViteDevServer(webRoot2, port, sslEnabled, domainsToProxy =
1947
2052
  `${proxyDomain}.localhost`,
1948
2053
  `${proxyDomain}.hslocal.net`
1949
2054
  ]).flat();
1950
- additionalMkcertHosts.push("*.hslocal.net", "hslocal.net");
1951
- const origin = sslEnabled ? `https://hslocal.net:${port}` : `http://hslocal.net:${port}`;
2055
+ if (process.env.VITE_ORIGIN) {
2056
+ console.log(`
2057
+ Custom origin: ${process.env.VITE_ORIGIN}
2058
+ `);
2059
+ }
2060
+ const origin = process.env.VITE_ORIGIN ?? (sslEnabled ? `https://hslocal.net:${port}` : `http://hslocal.net:${port}`);
1952
2061
  const viteConfig = {
1953
2062
  appType: "custom",
1954
2063
  server: {
@@ -2144,7 +2253,7 @@ async function createDevServer(webRoot2, storybook2, hubspotCliConfigPathOption2
2144
2253
  );
2145
2254
  let authedPortalId = null;
2146
2255
  let authedEnv = null;
2147
- let jsRenderingGates = [];
2256
+ let jsRenderingGates = ["CMS:JSRenderer:SharedDeps"];
2148
2257
  let personalAccessKey = null;
2149
2258
  if (hubspotCliConfigPathOption2 && hubspotCliAccountNameOption2) {
2150
2259
  console.log(
@@ -2261,7 +2370,7 @@ Local proxy functionality will not work without setting up authentication.`
2261
2370
  httpServer.listen(PORT);
2262
2371
  httpServers.push(httpServer);
2263
2372
  }
2264
- if (!process.env.IN_CODESANDBOX) {
2373
+ if (!process.env.IN_CODESANDBOX && !process.env.CODESANDBOX_HOST) {
2265
2374
  startShadowDevServer(PORT, SHADOW_PORT, projectName, jsRenderingGates);
2266
2375
  }
2267
2376
  let extraServerInfo = "";
@@ -60,10 +60,11 @@ function getFieldsArgTypes(fieldsJson, currentPathSegments = []) {
60
60
  break;
61
61
  }
62
62
  case "choice": {
63
+ const options = field.choices ? field.choices.map((choice) => choice[1]) : [];
63
64
  resultArgTypes[fullFieldName] = {
64
65
  control: "select",
65
66
  defaultValue: field.default,
66
- options: field.choices || []
67
+ options
67
68
  };
68
69
  break;
69
70
  }
@@ -36,6 +36,7 @@ __export(dist_exports, {
36
36
  hasComponentExtension: () => hasComponentExtension,
37
37
  isStorybookStory: () => isStorybookStory,
38
38
  isUngatedFor: () => isUngatedFor,
39
+ namespaceModulePropsShape: () => namespaceModulePropsShape,
39
40
  removeComponentExtension: () => removeComponentExtension,
40
41
  renderComponentOnServer: () => renderComponentOnServer,
41
42
  renderFieldsToJson: () => renderFieldsToJson,
@@ -94,6 +95,25 @@ function getIslandUrls(roots, viteDevServer) {
94
95
  return tweakedIsland;
95
96
  });
96
97
  }
98
+ function getPerServerRequestUrls(perServerRequestData, viteDevServer) {
99
+ if (!perServerRequestData.has("sharedStateIDs")) {
100
+ return new Map(perServerRequestData);
101
+ }
102
+ const perServerRequestDataWithUrls = new Map(
103
+ perServerRequestData
104
+ );
105
+ perServerRequestData.get("sharedStateIDs").forEach((id) => {
106
+ const reducer = perServerRequestData.get(id);
107
+ const reducerWithUrl = {
108
+ ...reducer,
109
+ reducerFuncModuleUrl: viteDevServer.moduleGraph.getModuleById(
110
+ reducer.reducerFuncModuleId
111
+ ).url
112
+ };
113
+ perServerRequestDataWithUrls.set(id, reducerWithUrl);
114
+ });
115
+ return perServerRequestDataWithUrls;
116
+ }
97
117
  function isUngatedFor(gates, gate) {
98
118
  return gates.includes(gate);
99
119
  }
@@ -262,6 +282,27 @@ function getServerGlobalsToInject(environmentConfig, hsServerPageUrl, hsBasePath
262
282
  </script>
263
283
  `;
264
284
  }
285
+ function namespaceModulePropsShape(props) {
286
+ const {
287
+ dataQueryResult,
288
+ hublParameters,
289
+ fieldValues: passedFieldValues
290
+ } = props;
291
+ const oldPropsShape = { ...props };
292
+ if (oldPropsShape.dataQueryResult) {
293
+ delete oldPropsShape.dataQueryResult;
294
+ }
295
+ if (oldPropsShape.hublParameters) {
296
+ delete oldPropsShape.hublParameters;
297
+ }
298
+ const fieldValues = passedFieldValues || oldPropsShape;
299
+ return {
300
+ ...fieldValues,
301
+ dataQueryResult,
302
+ fieldValues,
303
+ hublParameters
304
+ };
305
+ }
265
306
  function setIn(object, nestedKeysArray, value) {
266
307
  let curr = object;
267
308
  const finalKey = nestedKeysArray.pop();
@@ -398,10 +439,18 @@ ${indentString}`);
398
439
  };
399
440
  createIslandsGlobalJsForClientInDev = (roots, perServerRequestData, viteDevServer, indent) => {
400
441
  const islands = getIslandUrls(roots, viteDevServer);
442
+ const perServerRequestDataWithUrls = getPerServerRequestUrls(
443
+ perServerRequestData,
444
+ viteDevServer
445
+ );
401
446
  return `window.__islands = ${serializeIslandDataToJSON(
402
447
  islands,
403
448
  indent
404
- )}${writeSharedStateToJsGlobal(islands, perServerRequestData, indent)}`;
449
+ )}${writeSharedStateToJsGlobal(
450
+ islands,
451
+ perServerRequestDataWithUrls,
452
+ indent
453
+ )}`;
405
454
  };
406
455
  GATES = [
407
456
  "CMS:JSRenderer:SharedDeps",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cms-dev-server",
3
- "version": "0.6.4",
3
+ "version": "0.6.6",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "engines": {
@@ -20,11 +20,12 @@
20
20
  "runBuild": "node dist/run.js",
21
21
  "start": "ts-node-esm --transpileOnly runWhenDeveloping.ts",
22
22
  "start-inspect": "node --loader ts-node/esm --inspect runWhenDeveloping.ts",
23
- "test": "NODE_ENV=test vitest run"
23
+ "test": "NODE_ENV=test vitest run",
24
+ "test:watch": "NODE_ENV=test vitest watch"
24
25
  },
25
26
  "dependencies": {
26
27
  "@hubspot/cli-lib": "^3.0.12",
27
- "@hubspot/cms-components": "^0.6.4",
28
+ "@hubspot/cms-components": "^0.6.6",
28
29
  "@storybook/addon-actions": "7.0.7",
29
30
  "@storybook/addon-essentials": "7.0.7",
30
31
  "@storybook/addon-interactions": "7.0.7",
@@ -96,5 +97,5 @@
96
97
  "publishConfig": {
97
98
  "access": "public"
98
99
  },
99
- "gitHead": "c387ebeb59efa3384a864ce20a19b7c8c52ac7a5"
100
+ "gitHead": "73cbefadba8b8eeb524bc38505917f4f5b04b4a5"
100
101
  }
Binary file