@hubspot/cms-dev-server 1.0.38 → 1.0.43

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.
@@ -1,4 +1,4 @@
1
- // ../cms-js-internal/dist/types-BxnmA6nH.js
1
+ // ../cms-js-internal/dist/types-Bqf9htWu.js
2
2
  import path from "path";
3
3
  import { createHash } from "crypto";
4
4
  import fs, { readFileSync, existsSync, readdirSync, lstatSync } from "fs";
@@ -386,16 +386,12 @@ var GATES = [
386
386
  "CMS:JSRenderer:RemoveCjsPlugin",
387
387
  "CMS:JSRenderer:RemoveMockClientEntryPlugin",
388
388
  "CMS:JSRenderer:AnalyzeCmsModules",
389
- "CMS:JSRenderer:ClientOnlySupplementalFieldSerialization",
390
- "CMS:React:UnifiedThemePreview",
391
389
  "CMS:JSRenderer:CompressResponse"
392
390
  ];
393
391
  var ENABLED_FEATURES_GATE_MAP = {
394
392
  "cms:jsr:getServerSideProps": "CMS:JSRenderer:GetServerSideProps",
395
393
  "cms:jsr:RemoveCjsPlugin": "CMS:JSRenderer:RemoveCjsPlugin",
396
- "cms:jsr:analyzeCmsModules": "CMS:JSRenderer:AnalyzeCmsModules",
397
- "cms:jsr:clientOnlySupplementalFieldSerialization": "CMS:JSRenderer:ClientOnlySupplementalFieldSerialization",
398
- "cms:react:unifiedThemePreview": "CMS:React:UnifiedThemePreview"
394
+ "cms:jsr:analyzeCmsModules": "CMS:JSRenderer:AnalyzeCmsModules"
399
395
  };
400
396
  function isUngatedFor(gates, gate) {
401
397
  return gates.includes(gate);
@@ -546,180 +542,8 @@ import { renderToPipeableStream, renderToStaticMarkup } from "react-dom/server";
546
542
  import * as cmsComponents from "@hubspot/cms-components";
547
543
  import { ServerRenderContext } from "@hubspot/cms-components";
548
544
  import { isValidElement, cloneElement } from "react";
549
-
550
- // ../cms-js-internal/dist/decodeHtmlEntities-Byb4Xs5S.js
551
- var namedEntities = {
552
- "&": "&",
553
- "&lt;": "<",
554
- "&gt;": ">",
555
- "&quot;": '"',
556
- "&#39;": "'",
557
- "&apos;": "'",
558
- "&nbsp;": "\xA0",
559
- // non-breaking space
560
- "&copy;": "\xA9",
561
- "&reg;": "\xAE",
562
- "&trade;": "\u2122",
563
- "&hellip;": "\u2026",
564
- "&mdash;": "\u2014",
565
- "&ndash;": "\u2013",
566
- "&lsquo;": "\u2018",
567
- "&rsquo;": "\u2019",
568
- "&ldquo;": "\u201C",
569
- "&rdquo;": "\u201D",
570
- "&bull;": "\u2022",
571
- "&middot;": "\xB7",
572
- "&euro;": "\u20AC",
573
- "&pound;": "\xA3",
574
- "&yen;": "\xA5",
575
- "&cent;": "\xA2",
576
- // Common accented characters
577
- "&aacute;": "\xE1",
578
- // á
579
- "&agrave;": "\xE0",
580
- // à
581
- "&acirc;": "\xE2",
582
- // â
583
- "&auml;": "\xE4",
584
- // ä
585
- "&atilde;": "\xE3",
586
- // ã
587
- "&aring;": "\xE5",
588
- // å
589
- "&eacute;": "\xE9",
590
- // é
591
- "&egrave;": "\xE8",
592
- // è
593
- "&ecirc;": "\xEA",
594
- // ê
595
- "&euml;": "\xEB",
596
- // ë
597
- "&iacute;": "\xED",
598
- // í
599
- "&igrave;": "\xEC",
600
- // ì
601
- "&icirc;": "\xEE",
602
- // î
603
- "&iuml;": "\xEF",
604
- // ï
605
- "&oacute;": "\xF3",
606
- // ó
607
- "&ograve;": "\xF2",
608
- // ò
609
- "&ocirc;": "\xF4",
610
- // ô
611
- "&ouml;": "\xF6",
612
- // ö
613
- "&otilde;": "\xF5",
614
- // õ
615
- "&uacute;": "\xFA",
616
- // ú
617
- "&ugrave;": "\xF9",
618
- // ù
619
- "&ucirc;": "\xFB",
620
- // û
621
- "&uuml;": "\xFC",
622
- // ü
623
- "&ntilde;": "\xF1",
624
- // ñ
625
- "&ccedil;": "\xE7",
626
- // ç
627
- // Uppercase versions
628
- "&Aacute;": "\xC1",
629
- // Á
630
- "&Agrave;": "\xC0",
631
- // À
632
- "&Acirc;": "\xC2",
633
- // Â
634
- "&Auml;": "\xC4",
635
- // Ä
636
- "&Atilde;": "\xC3",
637
- // Ã
638
- "&Aring;": "\xC5",
639
- // Å
640
- "&Eacute;": "\xC9",
641
- // É
642
- "&Egrave;": "\xC8",
643
- // È
644
- "&Ecirc;": "\xCA",
645
- // Ê
646
- "&Euml;": "\xCB",
647
- // Ë
648
- "&Iacute;": "\xCD",
649
- // Í
650
- "&Igrave;": "\xCC",
651
- // Ì
652
- "&Icirc;": "\xCE",
653
- // Î
654
- "&Iuml;": "\xCF",
655
- // Ï
656
- "&Oacute;": "\xD3",
657
- // Ó
658
- "&Ograve;": "\xD2",
659
- // Ò
660
- "&Ocirc;": "\xD4",
661
- // Ô
662
- "&Ouml;": "\xD6",
663
- // Ö
664
- "&Otilde;": "\xD5",
665
- // Õ
666
- "&Uacute;": "\xDA",
667
- // Ú
668
- "&Ugrave;": "\xD9",
669
- // Ù
670
- "&Ucirc;": "\xDB",
671
- // Û
672
- "&Uuml;": "\xDC",
673
- // Ü
674
- "&Ntilde;": "\xD1",
675
- // Ñ
676
- "&Ccedil;": "\xC7"
677
- // Ç
678
- };
679
- function decodeHtmlEntities(text) {
680
- if (typeof text !== "string") {
681
- return text;
682
- }
683
- return text.replace(/&#(\d+);/g, (_, dec) => {
684
- const num = parseInt(dec, 10);
685
- if (num >= 0 && num <= 1114111) {
686
- return String.fromCharCode(num);
687
- }
688
- return _;
689
- }).replace(/&#x([0-9a-fA-F]+);/g, (_, hex) => {
690
- const num = parseInt(hex, 16);
691
- if (num >= 0 && num <= 1114111) {
692
- return String.fromCharCode(num);
693
- }
694
- return _;
695
- }).replace(
696
- /&[a-zA-Z][a-zA-Z0-9]*;/g,
697
- (entity) => namedEntities[entity] || entity
698
- );
699
- }
700
- function decodeHtmlEntitiesInObject(obj) {
701
- if (obj === null || obj === void 0) {
702
- return obj;
703
- }
704
- if (typeof obj === "string") {
705
- return decodeHtmlEntities(obj);
706
- }
707
- if (Array.isArray(obj)) {
708
- return obj.map(decodeHtmlEntitiesInObject);
709
- }
710
- if (typeof obj === "object") {
711
- const decoded = {};
712
- for (const [key, value] of Object.entries(obj)) {
713
- decoded[key] = decodeHtmlEntitiesInObject(value);
714
- }
715
- return decoded;
716
- }
717
- return obj;
718
- }
719
-
720
- // ../cms-js-internal/dist/index.js
721
545
  var { setProperty, getProperty, hasProperty } = dotProp;
722
- var serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestData, baseIndent = 0, prettyPrint, isUngatedForClientOnlySupplementalFieldSerialization = false) => {
546
+ var serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestData, baseIndent = 0, prettyPrint) => {
723
547
  const islandsArrayToSerialize = tweakedIslandsArray.map(
724
548
  ({
725
549
  id,
@@ -765,7 +589,7 @@ var serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestD
765
589
  if (filteredSupplementalFieldValues) {
766
590
  output.supplementalFieldValues = filteredSupplementalFieldValues;
767
591
  }
768
- if (isUngatedForClientOnlySupplementalFieldSerialization && output.clientOnly) {
592
+ if (output.clientOnly) {
769
593
  output.supplementalFieldValues = supplementalFieldValues;
770
594
  }
771
595
  return output;
@@ -863,7 +687,7 @@ function getPerServerRequestUrls(perServerRequestData, viteDevServer) {
863
687
  });
864
688
  return perServerRequestDataWithUrls;
865
689
  }
866
- var createIslandsGlobalJsForClientInDev = (roots, perServerRequestData, viteDevServer, indent, prettyPrint, isUngatedForClientOnlySupplementalFieldSerialization = false) => {
690
+ var createIslandsGlobalJsForClientInDev = (roots, perServerRequestData, viteDevServer, indent, prettyPrint) => {
867
691
  const islands = getIslandUrls(roots, viteDevServer);
868
692
  const perServerRequestDataWithUrls = getPerServerRequestUrls(
869
693
  perServerRequestData,
@@ -875,8 +699,7 @@ var createIslandsGlobalJsForClientInDev = (roots, perServerRequestData, viteDevS
875
699
  islands,
876
700
  perServerRequestData,
877
701
  indent,
878
- prettyPrint,
879
- isUngatedForClientOnlySupplementalFieldSerialization
702
+ prettyPrint
880
703
  )}${writeSharedStateToJsGlobal(
881
704
  islands,
882
705
  perServerRequestDataWithUrls,
@@ -1446,8 +1269,6 @@ export {
1446
1269
  collectCssInDev,
1447
1270
  collectCssModules,
1448
1271
  createIslandsGlobalJsForClientInDev,
1449
- decodeHtmlEntities,
1450
- decodeHtmlEntitiesInObject,
1451
1272
  doHealthChecksFailTheBuild,
1452
1273
  escapeForInlineJS,
1453
1274
  findAllComponentsIn,
@@ -1,173 +1,3 @@
1
- // ../cms-js-internal/dist/decodeHtmlEntities-Byb4Xs5S.js
2
- var namedEntities = {
3
- "&amp;": "&",
4
- "&lt;": "<",
5
- "&gt;": ">",
6
- "&quot;": '"',
7
- "&#39;": "'",
8
- "&apos;": "'",
9
- "&nbsp;": "\xA0",
10
- // non-breaking space
11
- "&copy;": "\xA9",
12
- "&reg;": "\xAE",
13
- "&trade;": "\u2122",
14
- "&hellip;": "\u2026",
15
- "&mdash;": "\u2014",
16
- "&ndash;": "\u2013",
17
- "&lsquo;": "\u2018",
18
- "&rsquo;": "\u2019",
19
- "&ldquo;": "\u201C",
20
- "&rdquo;": "\u201D",
21
- "&bull;": "\u2022",
22
- "&middot;": "\xB7",
23
- "&euro;": "\u20AC",
24
- "&pound;": "\xA3",
25
- "&yen;": "\xA5",
26
- "&cent;": "\xA2",
27
- // Common accented characters
28
- "&aacute;": "\xE1",
29
- // á
30
- "&agrave;": "\xE0",
31
- // à
32
- "&acirc;": "\xE2",
33
- // â
34
- "&auml;": "\xE4",
35
- // ä
36
- "&atilde;": "\xE3",
37
- // ã
38
- "&aring;": "\xE5",
39
- // å
40
- "&eacute;": "\xE9",
41
- // é
42
- "&egrave;": "\xE8",
43
- // è
44
- "&ecirc;": "\xEA",
45
- // ê
46
- "&euml;": "\xEB",
47
- // ë
48
- "&iacute;": "\xED",
49
- // í
50
- "&igrave;": "\xEC",
51
- // ì
52
- "&icirc;": "\xEE",
53
- // î
54
- "&iuml;": "\xEF",
55
- // ï
56
- "&oacute;": "\xF3",
57
- // ó
58
- "&ograve;": "\xF2",
59
- // ò
60
- "&ocirc;": "\xF4",
61
- // ô
62
- "&ouml;": "\xF6",
63
- // ö
64
- "&otilde;": "\xF5",
65
- // õ
66
- "&uacute;": "\xFA",
67
- // ú
68
- "&ugrave;": "\xF9",
69
- // ù
70
- "&ucirc;": "\xFB",
71
- // û
72
- "&uuml;": "\xFC",
73
- // ü
74
- "&ntilde;": "\xF1",
75
- // ñ
76
- "&ccedil;": "\xE7",
77
- // ç
78
- // Uppercase versions
79
- "&Aacute;": "\xC1",
80
- // Á
81
- "&Agrave;": "\xC0",
82
- // À
83
- "&Acirc;": "\xC2",
84
- // Â
85
- "&Auml;": "\xC4",
86
- // Ä
87
- "&Atilde;": "\xC3",
88
- // Ã
89
- "&Aring;": "\xC5",
90
- // Å
91
- "&Eacute;": "\xC9",
92
- // É
93
- "&Egrave;": "\xC8",
94
- // È
95
- "&Ecirc;": "\xCA",
96
- // Ê
97
- "&Euml;": "\xCB",
98
- // Ë
99
- "&Iacute;": "\xCD",
100
- // Í
101
- "&Igrave;": "\xCC",
102
- // Ì
103
- "&Icirc;": "\xCE",
104
- // Î
105
- "&Iuml;": "\xCF",
106
- // Ï
107
- "&Oacute;": "\xD3",
108
- // Ó
109
- "&Ograve;": "\xD2",
110
- // Ò
111
- "&Ocirc;": "\xD4",
112
- // Ô
113
- "&Ouml;": "\xD6",
114
- // Ö
115
- "&Otilde;": "\xD5",
116
- // Õ
117
- "&Uacute;": "\xDA",
118
- // Ú
119
- "&Ugrave;": "\xD9",
120
- // Ù
121
- "&Ucirc;": "\xDB",
122
- // Û
123
- "&Uuml;": "\xDC",
124
- // Ü
125
- "&Ntilde;": "\xD1",
126
- // Ñ
127
- "&Ccedil;": "\xC7"
128
- // Ç
129
- };
130
- function decodeHtmlEntities(text) {
131
- if (typeof text !== "string") {
132
- return text;
133
- }
134
- return text.replace(/&#(\d+);/g, (_, dec) => {
135
- const num = parseInt(dec, 10);
136
- if (num >= 0 && num <= 1114111) {
137
- return String.fromCharCode(num);
138
- }
139
- return _;
140
- }).replace(/&#x([0-9a-fA-F]+);/g, (_, hex) => {
141
- const num = parseInt(hex, 16);
142
- if (num >= 0 && num <= 1114111) {
143
- return String.fromCharCode(num);
144
- }
145
- return _;
146
- }).replace(
147
- /&[a-zA-Z][a-zA-Z0-9]*;/g,
148
- (entity) => namedEntities[entity] || entity
149
- );
150
- }
151
- function decodeHtmlEntitiesInObject(obj) {
152
- if (obj === null || obj === void 0) {
153
- return obj;
154
- }
155
- if (typeof obj === "string") {
156
- return decodeHtmlEntities(obj);
157
- }
158
- if (Array.isArray(obj)) {
159
- return obj.map(decodeHtmlEntitiesInObject);
160
- }
161
- if (typeof obj === "object") {
162
- const decoded = {};
163
- for (const [key, value] of Object.entries(obj)) {
164
- decoded[key] = decodeHtmlEntitiesInObject(value);
165
- }
166
- return decoded;
167
- }
168
- return obj;
169
- }
170
-
171
1
  // ../cms-js-internal/dist/island-runtime/island-runtime.js
172
2
  var onVisible = (islandEl, callback) => {
173
3
  const observer = new IntersectionObserver((entries) => {
@@ -243,22 +73,6 @@ var startHydratingIdleRootsTimeout;
243
73
  var shouldForceSeparateJsForAllIslands = /(&|\?)forceSeparateIslandJs=true/.test(window.location.search);
244
74
  var scheduledHydrationIndexCtr = 1;
245
75
  var rootsById = /* @__PURE__ */ new Map();
246
- function createDecodedIslandCopy(island) {
247
- const islandCopy = {
248
- ...island,
249
- // Deep copy and decode HTML entities in props
250
- props: decodeHtmlEntitiesInObject(island.props),
251
- // Deep copy supplementalFieldValues if it exists
252
- ...island.supplementalFieldValues && {
253
- supplementalFieldValues: decodeHtmlEntitiesInObject(island.supplementalFieldValues)
254
- },
255
- // Deep copy resolvedDataDependencies if it exists
256
- ...island.resolvedDataDependencies && {
257
- resolvedDataDependencies: { ...island.resolvedDataDependencies }
258
- }
259
- };
260
- return islandCopy;
261
- }
262
76
  var typedWindow = window;
263
77
  var startHydratingIdleRoots = () => {
264
78
  hydrationTypesToAccept.add("idle");
@@ -395,7 +209,7 @@ function getLoadableModuleFor(root) {
395
209
  }
396
210
  function hydrateIslandRoots() {
397
211
  if (rootsToProcess === void 0) {
398
- rootsToProcess = typedWindow.__islands.map(createDecodedIslandCopy);
212
+ rootsToProcess = typedWindow.__islands;
399
213
  if (window.location.search.includes("hsDebug=")) {
400
214
  console.log("Starting to hydrate", rootsToProcess);
401
215
  }