@hubspot/cms-dev-server 0.4.4 → 0.4.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.
- package/dist/index.js +11 -5
- package/dist/internalSsr.js +11 -3
- package/dist/run.js +68 -33
- package/package.json +3 -3
- package/types/createViteDevServer.d.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -17,11 +17,13 @@ import { join as joinPosix } from "path/posix";
|
|
|
17
17
|
import { basename } from "path";
|
|
18
18
|
import { cloneElement } from "react";
|
|
19
19
|
import { renderToStaticMarkup } from "react-dom/server";
|
|
20
|
+
function isUngatedFor(gates, gate) {
|
|
21
|
+
return gates.includes(gate);
|
|
22
|
+
}
|
|
20
23
|
var viteRoot;
|
|
21
24
|
var viteCommand;
|
|
22
|
-
function resolveIslandPlugin({
|
|
23
|
-
sharedDepsEnabled
|
|
24
|
-
}) {
|
|
25
|
+
function resolveIslandPlugin(gates) {
|
|
26
|
+
const sharedDepsEnabled = isUngatedFor(gates, "CMS:JSRenderer:SharedDeps");
|
|
25
27
|
return {
|
|
26
28
|
enforce: "pre",
|
|
27
29
|
name: "resolve-islands",
|
|
@@ -82,7 +84,11 @@ function clientIslandEntryPlugin() {
|
|
|
82
84
|
|
|
83
85
|
// src/createViteDevServer.ts
|
|
84
86
|
import mkcert from "vite-plugin-mkcert";
|
|
85
|
-
async function createViteDevServer(webRoot, port, sslEnabled, domainsToProxy = [],
|
|
87
|
+
async function createViteDevServer(webRoot, port, sslEnabled, domainsToProxy = [], jsRenderingGates) {
|
|
88
|
+
const sharedDepsEnabled = isUngatedFor(
|
|
89
|
+
jsRenderingGates,
|
|
90
|
+
"CMS:JSRenderer:SharedDeps"
|
|
91
|
+
);
|
|
86
92
|
const additionalMkcertHosts = domainsToProxy.map((proxyDomain) => [
|
|
87
93
|
`${proxyDomain}.localhost`,
|
|
88
94
|
`${proxyDomain}.hslocal.net`
|
|
@@ -115,7 +121,7 @@ async function createViteDevServer(webRoot, port, sslEnabled, domainsToProxy = [
|
|
|
115
121
|
sslEnabled ? mkcert({ hosts: additionalMkcertHosts }) : null,
|
|
116
122
|
react(),
|
|
117
123
|
sharedDepsEnabled && clientIslandEntryPlugin(),
|
|
118
|
-
resolveIslandPlugin(
|
|
124
|
+
resolveIslandPlugin(jsRenderingGates)
|
|
119
125
|
],
|
|
120
126
|
css: {
|
|
121
127
|
postcss: webRoot
|
package/dist/internalSsr.js
CHANGED
|
@@ -150,11 +150,17 @@ var createIslandsGlobalJsForClientInDev = (roots, perServerRequestData, viteDevS
|
|
|
150
150
|
indent
|
|
151
151
|
)}${writeSharedStateToJsGlobal(islands, perServerRequestData, indent)}`;
|
|
152
152
|
};
|
|
153
|
+
var GATES = [
|
|
154
|
+
"CMS:JSRenderer:SharedDeps",
|
|
155
|
+
"CMS:JSRenderer:GetServerSideProps"
|
|
156
|
+
];
|
|
157
|
+
function isUngatedFor(gates, gate) {
|
|
158
|
+
return gates.includes(gate);
|
|
159
|
+
}
|
|
153
160
|
var viteRoot;
|
|
154
161
|
var viteCommand;
|
|
155
|
-
function resolveIslandPlugin({
|
|
156
|
-
sharedDepsEnabled
|
|
157
|
-
}) {
|
|
162
|
+
function resolveIslandPlugin(gates) {
|
|
163
|
+
const sharedDepsEnabled = isUngatedFor(gates, "CMS:JSRenderer:SharedDeps");
|
|
158
164
|
return {
|
|
159
165
|
enforce: "pre",
|
|
160
166
|
name: "resolve-islands",
|
|
@@ -437,6 +443,7 @@ function renderFieldsToJson(fields) {
|
|
|
437
443
|
export {
|
|
438
444
|
COMPONENT_EXTENSIONS,
|
|
439
445
|
ENTRY_POINTS_PATH,
|
|
446
|
+
GATES,
|
|
440
447
|
MODULE_FOLDER_PATH,
|
|
441
448
|
VIRTUAL_CONFIG_SETUP,
|
|
442
449
|
VIRTUAL_ISLAND_RUNTIME,
|
|
@@ -454,6 +461,7 @@ export {
|
|
|
454
461
|
getServerGlobalsToInject,
|
|
455
462
|
hasComponentExtension,
|
|
456
463
|
isStorybookStory,
|
|
464
|
+
isUngatedFor,
|
|
457
465
|
removeComponentExtension,
|
|
458
466
|
renderComponentOnServer,
|
|
459
467
|
renderFieldsToJson,
|
package/dist/run.js
CHANGED
|
@@ -148,11 +148,13 @@ var createIslandsGlobalJsForClientInDev = (roots, perServerRequestData, viteDevS
|
|
|
148
148
|
indent
|
|
149
149
|
)}${writeSharedStateToJsGlobal(islands, perServerRequestData, indent)}`;
|
|
150
150
|
};
|
|
151
|
+
function isUngatedFor(gates, gate) {
|
|
152
|
+
return gates.includes(gate);
|
|
153
|
+
}
|
|
151
154
|
var viteRoot;
|
|
152
155
|
var viteCommand;
|
|
153
|
-
function resolveIslandPlugin({
|
|
154
|
-
sharedDepsEnabled
|
|
155
|
-
}) {
|
|
156
|
+
function resolveIslandPlugin(gates) {
|
|
157
|
+
const sharedDepsEnabled = isUngatedFor(gates, "CMS:JSRenderer:SharedDeps");
|
|
156
158
|
return {
|
|
157
159
|
enforce: "pre",
|
|
158
160
|
name: "resolve-islands",
|
|
@@ -512,10 +514,17 @@ var logPartialInfo = (partialPath, props) => {
|
|
|
512
514
|
console.groupEnd();
|
|
513
515
|
};
|
|
514
516
|
|
|
517
|
+
// src/lib/constants.ts
|
|
518
|
+
var Gates = {
|
|
519
|
+
GET_SERVER_SIDE_PROPS: "CMS:JSRenderer:GetServerSideProps"
|
|
520
|
+
};
|
|
521
|
+
|
|
515
522
|
// src/lib/renderPartial.ts
|
|
516
523
|
async function renderPartial(viteServer, partialPath, props, pageUrl, environmentConfig) {
|
|
517
524
|
logPartialInfo(partialPath, props);
|
|
525
|
+
let serverSideProps;
|
|
518
526
|
const componentModule = await viteServer.ssrLoadModule(partialPath);
|
|
527
|
+
const ungatedForServerSideProps = environmentConfig.getGates().includes(Gates.GET_SERVER_SIDE_PROPS);
|
|
519
528
|
if (!componentModule) {
|
|
520
529
|
throw new Error(`Couldn't find partial: ${partialPath}`);
|
|
521
530
|
}
|
|
@@ -523,11 +532,22 @@ async function renderPartial(viteServer, partialPath, props, pageUrl, environmen
|
|
|
523
532
|
if (!Component) {
|
|
524
533
|
throw new Error(`Couldn't find default export on partial: ${partialPath}`);
|
|
525
534
|
}
|
|
535
|
+
if (ungatedForServerSideProps && componentModule.getServerSidePropsUnstable) {
|
|
536
|
+
try {
|
|
537
|
+
serverSideProps = await componentModule.getServerSidePropsUnstable(props);
|
|
538
|
+
if (serverSideProps.constructor !== Object.constructor) {
|
|
539
|
+
throw new Error("getServerSidePropsUnstable must return an object");
|
|
540
|
+
}
|
|
541
|
+
} catch (e) {
|
|
542
|
+
console.log("Error resolving server side props");
|
|
543
|
+
console.error(e);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
526
546
|
return renderComponentWithCSS_default(
|
|
527
547
|
viteServer,
|
|
528
548
|
partialPath,
|
|
529
549
|
Component,
|
|
530
|
-
props,
|
|
550
|
+
{ ...props, ...serverSideProps },
|
|
531
551
|
pageUrl,
|
|
532
552
|
environmentConfig
|
|
533
553
|
);
|
|
@@ -537,8 +557,8 @@ var renderPartial_default = renderPartial;
|
|
|
537
557
|
// src/lib/templates.ts
|
|
538
558
|
import { promises as fsPromises } from "fs";
|
|
539
559
|
var { readFile } = fsPromises;
|
|
540
|
-
var generateIslandSetupScriptBlock = (
|
|
541
|
-
if (
|
|
560
|
+
var generateIslandSetupScriptBlock = (gates) => {
|
|
561
|
+
if (isUngatedFor(gates, "CMS:JSRenderer:SharedDeps")) {
|
|
542
562
|
return `<script type="module">
|
|
543
563
|
import { initConfigSingletonFromJSON } from '@hubspot/cms-components/config';
|
|
544
564
|
initConfigSingletonFromJSON(window.__hsEnvConfig);
|
|
@@ -568,7 +588,7 @@ var createdPlainHtmlTemplate = async (baseTemplatePath, title, globalScriptBlock
|
|
|
568
588
|
<!--bodyend-->`
|
|
569
589
|
);
|
|
570
590
|
};
|
|
571
|
-
var createIslandHtmlTemplate = async (baseTemplatePath, title, globalScriptBlock,
|
|
591
|
+
var createIslandHtmlTemplate = async (baseTemplatePath, title, globalScriptBlock, gates) => {
|
|
572
592
|
let htmlTemplate = await createdPlainHtmlTemplate(
|
|
573
593
|
baseTemplatePath,
|
|
574
594
|
title,
|
|
@@ -577,14 +597,14 @@ var createIslandHtmlTemplate = async (baseTemplatePath, title, globalScriptBlock
|
|
|
577
597
|
htmlTemplate = htmlTemplate.replace(
|
|
578
598
|
"<!--bodyend-->",
|
|
579
599
|
`
|
|
580
|
-
${generateIslandSetupScriptBlock(
|
|
600
|
+
${generateIslandSetupScriptBlock(gates)}
|
|
581
601
|
<!-- ISLAND_RUNTIME_AND_SETUP_SCRIPT_BLOCK -->
|
|
582
602
|
<!--islandsglobal-->
|
|
583
603
|
`
|
|
584
604
|
);
|
|
585
605
|
return htmlTemplate;
|
|
586
606
|
};
|
|
587
|
-
var createHtmlShellDependingOnRenderContext = async (baseTemplatePath, url3, title, renderContext, viteServer,
|
|
607
|
+
var createHtmlShellDependingOnRenderContext = async (baseTemplatePath, url3, title, renderContext, viteServer, jsRenderingGates) => {
|
|
588
608
|
let htmlTemplate;
|
|
589
609
|
if (renderContext.islands.length) {
|
|
590
610
|
const globalScriptBlock = getServerGlobalsToInject(
|
|
@@ -595,7 +615,7 @@ var createHtmlShellDependingOnRenderContext = async (baseTemplatePath, url3, tit
|
|
|
595
615
|
baseTemplatePath,
|
|
596
616
|
title,
|
|
597
617
|
globalScriptBlock,
|
|
598
|
-
|
|
618
|
+
jsRenderingGates
|
|
599
619
|
);
|
|
600
620
|
htmlTemplate = htmlTemplate.replace(
|
|
601
621
|
"<!--islandsglobal-->",
|
|
@@ -621,12 +641,12 @@ var createHtmlShellDependingOnRenderContext = async (baseTemplatePath, url3, tit
|
|
|
621
641
|
}
|
|
622
642
|
return viteServer.transformIndexHtml(url3, htmlTemplate);
|
|
623
643
|
};
|
|
624
|
-
var getIslandRuntimeAndGlobalToInject = async (sortedIslandRoots, perServerRequestData, viteServer,
|
|
644
|
+
var getIslandRuntimeAndGlobalToInject = async (sortedIslandRoots, perServerRequestData, viteServer, gates) => {
|
|
625
645
|
const internalSsrPath = packagePath(import.meta.url, "internalSsr");
|
|
626
646
|
const { createIslandsGlobalJsForClientInDev: createIslandsGlobalJsForClientInDev2 } = await viteServer.ssrLoadModule(internalSsrPath);
|
|
627
647
|
const islandRuntimeScript = await viteServer.transformIndexHtml(
|
|
628
648
|
"/",
|
|
629
|
-
generateIslandSetupScriptBlock(
|
|
649
|
+
generateIslandSetupScriptBlock(gates)
|
|
630
650
|
);
|
|
631
651
|
return `${islandRuntimeScript}
|
|
632
652
|
<script>${createIslandsGlobalJsForClientInDev2(
|
|
@@ -647,7 +667,7 @@ var partialRouteHandler = async (request2, response) => {
|
|
|
647
667
|
authedHublet,
|
|
648
668
|
webRoot: webRoot2,
|
|
649
669
|
viteServer,
|
|
650
|
-
|
|
670
|
+
jsRenderingGates
|
|
651
671
|
} = request2.app.locals;
|
|
652
672
|
const partialName = request2.params.partial;
|
|
653
673
|
const baseTemplatePath = packagePath(
|
|
@@ -661,7 +681,8 @@ var partialRouteHandler = async (request2, response) => {
|
|
|
661
681
|
authedPortalId,
|
|
662
682
|
authedHublet,
|
|
663
683
|
authedEnv,
|
|
664
|
-
false
|
|
684
|
+
false,
|
|
685
|
+
jsRenderingGates
|
|
665
686
|
);
|
|
666
687
|
try {
|
|
667
688
|
const {
|
|
@@ -681,7 +702,7 @@ var partialRouteHandler = async (request2, response) => {
|
|
|
681
702
|
`Partial: ${partialPath}`,
|
|
682
703
|
renderContext,
|
|
683
704
|
viteServer,
|
|
684
|
-
|
|
705
|
+
jsRenderingGates
|
|
685
706
|
);
|
|
686
707
|
const html = htmlShell.replace("<!--headend-->", cssNeeded).replace(`<!--ssr-outlet-->`, renderedHtml);
|
|
687
708
|
response.status(200).set({ "Content-Type": "text/html" }).end(html);
|
|
@@ -788,6 +809,8 @@ var lookForModuleInFolder = async (modulePath, viteServer) => {
|
|
|
788
809
|
};
|
|
789
810
|
async function renderModule(viteServer, requestedModulePath, fieldOverrides = {}, pageUrl, environmentConfig) {
|
|
790
811
|
console.log("Rendering module", requestedModulePath);
|
|
812
|
+
const ungatedForServerSideProps = environmentConfig.getGates().includes(Gates.GET_SERVER_SIDE_PROPS);
|
|
813
|
+
let serverSideProps;
|
|
791
814
|
let componentModule;
|
|
792
815
|
let foundPath;
|
|
793
816
|
if (!hasComponentExtension(requestedModulePath)) {
|
|
@@ -817,11 +840,19 @@ async function renderModule(viteServer, requestedModulePath, fieldOverrides = {}
|
|
|
817
840
|
}
|
|
818
841
|
const fieldsJSON = renderFieldsToJson(fields);
|
|
819
842
|
const props = getPropsForModule(fieldsJSON, fieldOverrides);
|
|
843
|
+
if (ungatedForServerSideProps && componentModule.getServerSidePropsUnstable) {
|
|
844
|
+
try {
|
|
845
|
+
serverSideProps = await componentModule.getServerSidePropsUnstable(props);
|
|
846
|
+
} catch (e) {
|
|
847
|
+
console.log("Error resolving server side props");
|
|
848
|
+
console.error(e);
|
|
849
|
+
}
|
|
850
|
+
}
|
|
820
851
|
return renderComponentWithCSS_default(
|
|
821
852
|
viteServer,
|
|
822
853
|
foundPath,
|
|
823
854
|
Component,
|
|
824
|
-
props,
|
|
855
|
+
{ ...props, ...serverSideProps },
|
|
825
856
|
pageUrl,
|
|
826
857
|
environmentConfig
|
|
827
858
|
);
|
|
@@ -843,7 +874,7 @@ var moduleRouteHandler = async (request2, response) => {
|
|
|
843
874
|
authedHublet,
|
|
844
875
|
webRoot: webRoot2,
|
|
845
876
|
viteServer,
|
|
846
|
-
|
|
877
|
+
jsRenderingGates
|
|
847
878
|
} = request2.app.locals;
|
|
848
879
|
const moduleName = request2.params.moduleName;
|
|
849
880
|
const baseTemplatePath = packagePath(
|
|
@@ -869,7 +900,8 @@ var moduleRouteHandler = async (request2, response) => {
|
|
|
869
900
|
authedPortalId,
|
|
870
901
|
authedHublet,
|
|
871
902
|
authedEnv,
|
|
872
|
-
false
|
|
903
|
+
false,
|
|
904
|
+
jsRenderingGates
|
|
873
905
|
);
|
|
874
906
|
try {
|
|
875
907
|
const {
|
|
@@ -889,7 +921,7 @@ var moduleRouteHandler = async (request2, response) => {
|
|
|
889
921
|
`Module: ${modulePath}`,
|
|
890
922
|
renderContext,
|
|
891
923
|
viteServer,
|
|
892
|
-
|
|
924
|
+
jsRenderingGates
|
|
893
925
|
);
|
|
894
926
|
const html = htmlShell.replace("<!--headend-->", cssNeeded).replace(`<!--ssr-outlet-->`, renderedHtml);
|
|
895
927
|
response.status(200).set({ "Content-Type": "text/html" }).end(html);
|
|
@@ -1261,7 +1293,7 @@ var renderComponentForPlaceholder = (indexForThisRender, localRenderPlaceholder,
|
|
|
1261
1293
|
throw new Error(`Unimplemented render of ${placeholderPath}.`);
|
|
1262
1294
|
}
|
|
1263
1295
|
};
|
|
1264
|
-
async function proxySpecificPage(response, portalId, hublet, contentId, webRoot2, viteServer, projectName, projectComponentPath,
|
|
1296
|
+
async function proxySpecificPage(response, portalId, hublet, contentId, webRoot2, viteServer, projectName, projectComponentPath, jsRenderingGates, urlToProxy, fullOriginalUrl) {
|
|
1265
1297
|
let accountId;
|
|
1266
1298
|
let proxyEnv;
|
|
1267
1299
|
try {
|
|
@@ -1296,7 +1328,8 @@ async function proxySpecificPage(response, portalId, hublet, contentId, webRoot2
|
|
|
1296
1328
|
portalId,
|
|
1297
1329
|
hublet,
|
|
1298
1330
|
proxyEnv,
|
|
1299
|
-
false
|
|
1331
|
+
false,
|
|
1332
|
+
jsRenderingGates
|
|
1300
1333
|
);
|
|
1301
1334
|
const { sortIslandRootsByPriority } = await viteServer.ssrLoadModule(
|
|
1302
1335
|
"@hubspot/cms-components"
|
|
@@ -1375,7 +1408,7 @@ ${html}`;
|
|
|
1375
1408
|
sortedIslandRoots,
|
|
1376
1409
|
mergedPerRequestState,
|
|
1377
1410
|
viteServer,
|
|
1378
|
-
|
|
1411
|
+
jsRenderingGates
|
|
1379
1412
|
);
|
|
1380
1413
|
response.write(islandRuntimeAndGlobalScriptHtml);
|
|
1381
1414
|
}
|
|
@@ -1403,7 +1436,7 @@ async function proxyPageRouteHandler(request2, response, next) {
|
|
|
1403
1436
|
webRoot: webRoot2,
|
|
1404
1437
|
projectName,
|
|
1405
1438
|
projectComponentPath,
|
|
1406
|
-
|
|
1439
|
+
jsRenderingGates
|
|
1407
1440
|
} = request2.app.locals;
|
|
1408
1441
|
if (!request2.accepts().includes("text/html")) {
|
|
1409
1442
|
return response.sendStatus(404);
|
|
@@ -1440,7 +1473,7 @@ async function proxyPageRouteHandler(request2, response, next) {
|
|
|
1440
1473
|
viteServer,
|
|
1441
1474
|
projectName,
|
|
1442
1475
|
projectComponentPath,
|
|
1443
|
-
|
|
1476
|
+
jsRenderingGates,
|
|
1444
1477
|
urlToProxy,
|
|
1445
1478
|
fullOriginalUrl
|
|
1446
1479
|
);
|
|
@@ -1498,11 +1531,9 @@ async function proxyPathPageRouteHandler(request2, response, next) {
|
|
|
1498
1531
|
const {
|
|
1499
1532
|
viteServer,
|
|
1500
1533
|
webRoot: webRoot2,
|
|
1501
|
-
devServerHost,
|
|
1502
|
-
devServerPort,
|
|
1503
1534
|
projectName,
|
|
1504
1535
|
projectComponentPath,
|
|
1505
|
-
|
|
1536
|
+
jsRenderingGates
|
|
1506
1537
|
} = request2.app.locals;
|
|
1507
1538
|
if (!request2.accepts().includes("text/html")) {
|
|
1508
1539
|
return response.sendStatus(404);
|
|
@@ -1558,7 +1589,7 @@ async function proxyPathPageRouteHandler(request2, response, next) {
|
|
|
1558
1589
|
viteServer,
|
|
1559
1590
|
projectName,
|
|
1560
1591
|
projectComponentPath,
|
|
1561
|
-
|
|
1592
|
+
jsRenderingGates,
|
|
1562
1593
|
proxyPageUrl.href,
|
|
1563
1594
|
proxyPageUrl.href
|
|
1564
1595
|
);
|
|
@@ -1755,7 +1786,11 @@ async function startShadowDevServer(devServerPort, shadowPort, projectName) {
|
|
|
1755
1786
|
import { createServer as createViteServer } from "vite";
|
|
1756
1787
|
import { default as react } from "@vitejs/plugin-react";
|
|
1757
1788
|
import mkcert from "vite-plugin-mkcert";
|
|
1758
|
-
async function createViteDevServer(webRoot2, port, sslEnabled, domainsToProxy = [],
|
|
1789
|
+
async function createViteDevServer(webRoot2, port, sslEnabled, domainsToProxy = [], jsRenderingGates) {
|
|
1790
|
+
const sharedDepsEnabled = isUngatedFor(
|
|
1791
|
+
jsRenderingGates,
|
|
1792
|
+
"CMS:JSRenderer:SharedDeps"
|
|
1793
|
+
);
|
|
1759
1794
|
const additionalMkcertHosts = domainsToProxy.map((proxyDomain) => [
|
|
1760
1795
|
`${proxyDomain}.localhost`,
|
|
1761
1796
|
`${proxyDomain}.hslocal.net`
|
|
@@ -1788,7 +1823,7 @@ async function createViteDevServer(webRoot2, port, sslEnabled, domainsToProxy =
|
|
|
1788
1823
|
sslEnabled ? mkcert({ hosts: additionalMkcertHosts }) : null,
|
|
1789
1824
|
react(),
|
|
1790
1825
|
sharedDepsEnabled && clientIslandEntryPlugin(),
|
|
1791
|
-
resolveIslandPlugin(
|
|
1826
|
+
resolveIslandPlugin(jsRenderingGates)
|
|
1792
1827
|
],
|
|
1793
1828
|
css: {
|
|
1794
1829
|
postcss: webRoot2
|
|
@@ -1901,7 +1936,6 @@ var BASE_PATH = "/";
|
|
|
1901
1936
|
var PORT = process.env.PORT ? parseInt(process.env.PORT, 10) : 3e3;
|
|
1902
1937
|
var SHADOW_PORT = 1442;
|
|
1903
1938
|
var STORYBOOK_PORT = process.env.STORYBOOK_PORT ? parseInt(process.env.STORYBOOK_PORT, 10) : 3123;
|
|
1904
|
-
var SHARED_DEPS_ENABLED = Boolean(process.env.SHARED_DEPS_ENABLED);
|
|
1905
1939
|
async function createDevServer(webRoot2, storybook2, hubspotCliConfigPathOption2, hubspotCliAccountNameOption2, sslEnabledOption2) {
|
|
1906
1940
|
console.log(
|
|
1907
1941
|
"Warning: this is a prerelease and requires specific HubSpot account configuration to work"
|
|
@@ -1939,6 +1973,7 @@ If needed you can refer to another config file with --config.
|
|
|
1939
1973
|
Local proxy functionality will not work without setting up authentication.`
|
|
1940
1974
|
);
|
|
1941
1975
|
}
|
|
1976
|
+
const jsRenderingGates = process.env.GATES ? process.env.GATES.split(",") : [];
|
|
1942
1977
|
let domainsToProxy = [];
|
|
1943
1978
|
if (sslEnabledOption2 && authedPortalId) {
|
|
1944
1979
|
try {
|
|
@@ -1963,7 +1998,7 @@ Local proxy functionality will not work without setting up authentication.`
|
|
|
1963
1998
|
PORT,
|
|
1964
1999
|
sslEnabledOption2,
|
|
1965
2000
|
domainsToProxy,
|
|
1966
|
-
|
|
2001
|
+
jsRenderingGates
|
|
1967
2002
|
);
|
|
1968
2003
|
const viteHTTPSConfig = viteServer.config.server.https;
|
|
1969
2004
|
const httpsKey = viteHTTPSConfig ? viteHTTPSConfig.key : null;
|
|
@@ -1983,8 +2018,8 @@ Local proxy functionality will not work without setting up authentication.`
|
|
|
1983
2018
|
expressServer.locals.storybookEnabled = storybook2;
|
|
1984
2019
|
expressServer.locals.storybookPort = STORYBOOK_PORT;
|
|
1985
2020
|
expressServer.locals.projectName = projectName;
|
|
1986
|
-
expressServer.locals.sharedDepsEnabled = SHARED_DEPS_ENABLED;
|
|
1987
2021
|
expressServer.locals.projectComponentPath = webRootProjectComponentFolder;
|
|
2022
|
+
expressServer.locals.jsRenderingGates = jsRenderingGates;
|
|
1988
2023
|
expressServer.use(bodyParser.json());
|
|
1989
2024
|
expressServer.use(
|
|
1990
2025
|
BASE_PATH,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cms-dev-server",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@hubspot/cli-lib": "^3.0.12",
|
|
27
|
-
"@hubspot/cms-components": "^0.4.
|
|
27
|
+
"@hubspot/cms-components": "^0.4.5",
|
|
28
28
|
"@storybook/addon-actions": "^7.0.0-beta.19",
|
|
29
29
|
"@storybook/addon-essentials": "^7.0.0-beta.19",
|
|
30
30
|
"@storybook/addon-interactions": "^7.0.0-beta.19",
|
|
@@ -95,5 +95,5 @@
|
|
|
95
95
|
"publishConfig": {
|
|
96
96
|
"access": "public"
|
|
97
97
|
},
|
|
98
|
-
"gitHead": "
|
|
98
|
+
"gitHead": "9848f59886135ea97fc01ada9b04b204fdcad8ca"
|
|
99
99
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function createViteDevServer(webRoot: string, port: any, sslEnabled: boolean, domainsToProxy: any[],
|
|
1
|
+
declare function createViteDevServer(webRoot: string, port: any, sslEnabled: boolean, domainsToProxy: any[], jsRenderingGates: string[]): Promise<import("vite").ViteDevServer>;
|
|
2
2
|
export default createViteDevServer;
|