@hubspot/cms-dev-server 0.14.16 → 0.15.1-alpha.0
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 +9 -3
- package/dist/internalSsr.js +38 -17
- package/dist/run.js +201 -95
- package/dist/storybook/index.js +6 -0
- package/dist/storybook-main/main.js +39 -18
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -78,6 +78,7 @@ function clientIslandEntryPlugin() {
|
|
|
78
78
|
|
|
79
79
|
// ../cms-js-internal/dist/index.js
|
|
80
80
|
import * as dotProp from "dot-prop";
|
|
81
|
+
import * as cmsComponents from "@hubspot/cms-components";
|
|
81
82
|
var { setProperty, getProperty, hasProperty } = dotProp;
|
|
82
83
|
function noncePlaceholderPlugin() {
|
|
83
84
|
const HS_DEPLOYED = process.env.AWS_EXECUTION_ENV != null || process.env.HS_DEPLOYED === "true";
|
|
@@ -101,6 +102,11 @@ function noncePlaceholderPlugin() {
|
|
|
101
102
|
}
|
|
102
103
|
};
|
|
103
104
|
}
|
|
105
|
+
var {
|
|
106
|
+
createServerRenderContextV2: createServerRenderContextV22,
|
|
107
|
+
createServerRenderContext: createServerRenderContext2,
|
|
108
|
+
renderServerSidePropsWithAsyncLocalStoreContext
|
|
109
|
+
} = cmsComponents;
|
|
104
110
|
|
|
105
111
|
// src/createViteDevServer.ts
|
|
106
112
|
import { default as mkcert } from "vite-plugin-mkcert";
|
|
@@ -113,11 +119,11 @@ function devSecretsPlugin(secretNames) {
|
|
|
113
119
|
configureServer: {
|
|
114
120
|
order: "post",
|
|
115
121
|
async handler(server) {
|
|
116
|
-
const
|
|
122
|
+
const cmsComponents2 = await server.ssrLoadModule(
|
|
117
123
|
"@hubspot/cms-components"
|
|
118
124
|
);
|
|
119
|
-
if (
|
|
120
|
-
|
|
125
|
+
if (cmsComponents2.setSecretsFromEnv) {
|
|
126
|
+
cmsComponents2.setSecretsFromEnv(secretNames);
|
|
121
127
|
} else if (secretNames.length > 0) {
|
|
122
128
|
console.warn(
|
|
123
129
|
"Not loading secrets into the local environment. Make sure that your @hubspot/cms-components and @hubspot/cms-dev-server package versions match."
|
package/dist/internalSsr.js
CHANGED
|
@@ -431,7 +431,7 @@ function isStylesheetAsset(staticAsset) {
|
|
|
431
431
|
|
|
432
432
|
// ../cms-js-internal/dist/index.js
|
|
433
433
|
import * as dotProp from "dot-prop";
|
|
434
|
-
import
|
|
434
|
+
import { jsx } from "react/jsx-runtime";
|
|
435
435
|
import stream from "stream";
|
|
436
436
|
import { renderToPipeableStream, renderToStaticMarkup } from "react-dom/server";
|
|
437
437
|
import * as cmsComponents from "@hubspot/cms-components";
|
|
@@ -617,7 +617,6 @@ function noncePlaceholderPlugin() {
|
|
|
617
617
|
}
|
|
618
618
|
};
|
|
619
619
|
}
|
|
620
|
-
var jsx2 = jsxRuntime.jsx;
|
|
621
620
|
var promiseForNewWritableStream = () => {
|
|
622
621
|
const chunks = [];
|
|
623
622
|
const writableStream = new stream.Writable();
|
|
@@ -654,29 +653,51 @@ var renderStreamToPromise = async (reactElements, options) => {
|
|
|
654
653
|
});
|
|
655
654
|
return streamDonePromise;
|
|
656
655
|
};
|
|
657
|
-
|
|
656
|
+
var {
|
|
657
|
+
createServerRenderContextV2: createServerRenderContextV22,
|
|
658
|
+
createServerRenderContext: createServerRenderContext2,
|
|
659
|
+
renderServerSidePropsWithAsyncLocalStoreContext
|
|
660
|
+
} = cmsComponents;
|
|
661
|
+
var bootStrapRenderContext = () => {
|
|
662
|
+
const renderContext = createServerRenderContextV22 ? createServerRenderContextV22(null, {
|
|
663
|
+
environmentConfig: null,
|
|
664
|
+
entryPointBasePath: "",
|
|
665
|
+
supplementalFieldValues: {},
|
|
666
|
+
messagesForBrowser: []
|
|
667
|
+
}) : createServerRenderContext2("", null);
|
|
668
|
+
return renderContext;
|
|
669
|
+
};
|
|
670
|
+
async function renderComponentOnServer(Component, propsAndDeps, pageUrl, environmentConfig, entryPointBasePath, contextOptions, renderOptions, getServerSideProps) {
|
|
671
|
+
const { props } = propsAndDeps;
|
|
658
672
|
const componentDebugName = Component.displayName || Component.name;
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
pageUrl,
|
|
662
|
-
environmentConfig,
|
|
663
|
-
entryPointBasePath,
|
|
664
|
-
contextOptions,
|
|
665
|
-
componentDebugName,
|
|
666
|
-
renderOptions
|
|
667
|
-
);
|
|
668
|
-
}
|
|
669
|
-
async function renderOnServer(elements, pageUrl, environmentConfig, entryPointBasePath, contextOptions, debugName, renderOptions) {
|
|
670
|
-
const supplementalFieldValues = contextOptions ? contextOptions.supplementalFieldValues : void 0;
|
|
671
|
-
const messagesForBrowser = contextOptions ? contextOptions.messagesForBrowser : void 0;
|
|
673
|
+
const supplementalFieldValues = contextOptions == null ? void 0 : contextOptions.supplementalFieldValues;
|
|
674
|
+
const messagesForBrowser = contextOptions == null ? void 0 : contextOptions.messagesForBrowser;
|
|
672
675
|
const renderContext = cmsComponents.createServerRenderContextV2 ? cmsComponents.createServerRenderContextV2(pageUrl, {
|
|
673
676
|
environmentConfig,
|
|
674
677
|
entryPointBasePath,
|
|
675
678
|
supplementalFieldValues,
|
|
676
679
|
messagesForBrowser
|
|
677
680
|
}) : cmsComponents.createServerRenderContext(pageUrl, environmentConfig);
|
|
681
|
+
if (getServerSideProps !== void 0 && typeof getServerSideProps === "function") {
|
|
682
|
+
const gSSPResult = await renderServerSidePropsWithAsyncLocalStoreContext(
|
|
683
|
+
getServerSideProps,
|
|
684
|
+
propsAndDeps,
|
|
685
|
+
renderContext
|
|
686
|
+
);
|
|
687
|
+
if (gSSPResult) {
|
|
688
|
+
props.serverSideProps = gSSPResult.serverSideProps;
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
return renderOnServer(
|
|
692
|
+
/* @__PURE__ */ jsx(Component, { ...props }),
|
|
693
|
+
renderContext,
|
|
694
|
+
componentDebugName,
|
|
695
|
+
renderOptions
|
|
696
|
+
);
|
|
697
|
+
}
|
|
698
|
+
async function renderOnServer(elements, renderContext = bootStrapRenderContext(), debugName, renderOptions) {
|
|
678
699
|
let html = await renderStreamToPromise(
|
|
679
|
-
/* @__PURE__ */
|
|
700
|
+
/* @__PURE__ */ jsx(ServerRenderContext.Provider, { value: renderContext, children: elements }),
|
|
680
701
|
renderOptions
|
|
681
702
|
);
|
|
682
703
|
if (renderContext.messagesForBrowser.length > 0) {
|
package/dist/run.js
CHANGED
|
@@ -404,7 +404,7 @@ function setIn(object, nestedKeysArray, value) {
|
|
|
404
404
|
|
|
405
405
|
// ../cms-js-internal/dist/index.js
|
|
406
406
|
import * as dotProp from "dot-prop";
|
|
407
|
-
import
|
|
407
|
+
import { jsx } from "react/jsx-runtime";
|
|
408
408
|
import stream from "stream";
|
|
409
409
|
import { renderToPipeableStream, renderToStaticMarkup } from "react-dom/server";
|
|
410
410
|
import * as cmsComponents from "@hubspot/cms-components";
|
|
@@ -589,7 +589,6 @@ function noncePlaceholderPlugin() {
|
|
|
589
589
|
}
|
|
590
590
|
};
|
|
591
591
|
}
|
|
592
|
-
var jsx2 = jsxRuntime.jsx;
|
|
593
592
|
var promiseForNewWritableStream = () => {
|
|
594
593
|
const chunks = [];
|
|
595
594
|
const writableStream = new stream.Writable();
|
|
@@ -626,17 +625,23 @@ var renderStreamToPromise = async (reactElements, options) => {
|
|
|
626
625
|
});
|
|
627
626
|
return streamDonePromise;
|
|
628
627
|
};
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
628
|
+
var {
|
|
629
|
+
createServerRenderContextV2: createServerRenderContextV22,
|
|
630
|
+
createServerRenderContext: createServerRenderContext2,
|
|
631
|
+
renderServerSidePropsWithAsyncLocalStoreContext
|
|
632
|
+
} = cmsComponents;
|
|
633
|
+
var bootStrapRenderContext = () => {
|
|
634
|
+
const renderContext = createServerRenderContextV22 ? createServerRenderContextV22(null, {
|
|
635
|
+
environmentConfig: null,
|
|
636
|
+
entryPointBasePath: "",
|
|
637
|
+
supplementalFieldValues: {},
|
|
638
|
+
messagesForBrowser: []
|
|
639
|
+
}) : createServerRenderContext2("", null);
|
|
640
|
+
return renderContext;
|
|
641
|
+
};
|
|
642
|
+
async function renderOnServer(elements, renderContext = bootStrapRenderContext(), debugName, renderOptions) {
|
|
638
643
|
let html = await renderStreamToPromise(
|
|
639
|
-
/* @__PURE__ */
|
|
644
|
+
/* @__PURE__ */ jsx(ServerRenderContext.Provider, { value: renderContext, children: elements }),
|
|
640
645
|
renderOptions
|
|
641
646
|
);
|
|
642
647
|
if (renderContext.messagesForBrowser.length > 0) {
|
|
@@ -734,25 +739,33 @@ var getEntryPointBasePath = (componentPath) => {
|
|
|
734
739
|
};
|
|
735
740
|
|
|
736
741
|
// src/lib/renderComponentWithCSS.ts
|
|
737
|
-
async function renderComponentWithCSS(viteServer, componentPath, Component,
|
|
742
|
+
async function renderComponentWithCSS(viteServer, componentPath, Component, propsAndExtraDeps, pageUrl, entryPointBasePath, contextOptions, environmentConfig, renderOptions, getServerSideProps, modifyHtmlCallback) {
|
|
738
743
|
const internalSsrPath = packagePath(import.meta.url, "internalSsr");
|
|
739
744
|
const { renderComponentOnServer, collectCssInDev: collectCssInDev2 } = await viteServer.ssrLoadModule(internalSsrPath);
|
|
740
745
|
const [, componentPathWithExtension] = getComponentPaths(
|
|
741
746
|
viteServer,
|
|
742
747
|
componentPath
|
|
743
748
|
);
|
|
744
|
-
const
|
|
745
|
-
html,
|
|
746
|
-
renderContext
|
|
747
|
-
} = await renderComponentOnServer(
|
|
749
|
+
const renderResult = await renderComponentOnServer(
|
|
748
750
|
Component,
|
|
749
|
-
|
|
751
|
+
propsAndExtraDeps,
|
|
750
752
|
pageUrl,
|
|
751
753
|
environmentConfig,
|
|
752
754
|
entryPointBasePath,
|
|
753
755
|
contextOptions,
|
|
754
|
-
renderOptions
|
|
756
|
+
renderOptions,
|
|
757
|
+
getServerSideProps
|
|
755
758
|
);
|
|
759
|
+
let html = renderResult.html;
|
|
760
|
+
const renderContext = renderResult.renderContext;
|
|
761
|
+
if (modifyHtmlCallback) {
|
|
762
|
+
html = modifyHtmlCallback(
|
|
763
|
+
html,
|
|
764
|
+
renderContext,
|
|
765
|
+
[]
|
|
766
|
+
// Build-time generated static asset arracy is only available when deployed
|
|
767
|
+
);
|
|
768
|
+
}
|
|
756
769
|
const cssNeeded = collectCssInDev2(componentPathWithExtension, viteServer);
|
|
757
770
|
let inlineAssets = [];
|
|
758
771
|
if (renderContext.inlineAssets && Array.isArray(renderContext.inlineAssets)) {
|
|
@@ -851,7 +864,7 @@ async function renderPartial(viteServer, partialPath, props, pageUrl, basePath,
|
|
|
851
864
|
viteServer,
|
|
852
865
|
resolvedPath,
|
|
853
866
|
Component,
|
|
854
|
-
props,
|
|
867
|
+
{ props },
|
|
855
868
|
pageUrl,
|
|
856
869
|
basePath,
|
|
857
870
|
void 0,
|
|
@@ -1031,7 +1044,7 @@ function trackUsage(action) {
|
|
|
1031
1044
|
eventName: EVENT_NAME,
|
|
1032
1045
|
action,
|
|
1033
1046
|
nodeVersion: getNodeVersionData(),
|
|
1034
|
-
version: "0.
|
|
1047
|
+
version: "0.15.1-alpha.0",
|
|
1035
1048
|
os: getPlatform()
|
|
1036
1049
|
};
|
|
1037
1050
|
const uri = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
|
|
@@ -1150,7 +1163,7 @@ ${e.stack}`);
|
|
|
1150
1163
|
var partial_default = partialRouteHandler;
|
|
1151
1164
|
|
|
1152
1165
|
// src/components/PartialsList.tsx
|
|
1153
|
-
import { jsx as
|
|
1166
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
1154
1167
|
function EmptyPartialsList({ webRoot: webRoot2 }) {
|
|
1155
1168
|
return /* @__PURE__ */ jsxs("p", { children: [
|
|
1156
1169
|
"No partials in ",
|
|
@@ -1161,32 +1174,29 @@ function EmptyPartialsList({ webRoot: webRoot2 }) {
|
|
|
1161
1174
|
] });
|
|
1162
1175
|
}
|
|
1163
1176
|
function PartialLinkInLI({ partialName }) {
|
|
1164
|
-
return /* @__PURE__ */
|
|
1177
|
+
return /* @__PURE__ */ jsx2("li", { children: /* @__PURE__ */ jsx2("a", { href: `/partial/${partialName}`, children: partialName }) });
|
|
1165
1178
|
}
|
|
1166
1179
|
function PartialsList({ webRoot: webRoot2, partialNames }) {
|
|
1167
1180
|
if (partialNames.length === 0) {
|
|
1168
|
-
return /* @__PURE__ */
|
|
1181
|
+
return /* @__PURE__ */ jsx2(EmptyPartialsList, { webRoot: webRoot2 });
|
|
1169
1182
|
}
|
|
1170
|
-
return /* @__PURE__ */
|
|
1183
|
+
return /* @__PURE__ */ jsx2("ul", { children: partialNames.map((partialName) => /* @__PURE__ */ jsx2(PartialLinkInLI, { partialName }, partialName)) });
|
|
1171
1184
|
}
|
|
1172
1185
|
|
|
1173
1186
|
// src/routes/linksToAllPartialsRouteHandler.tsx
|
|
1174
|
-
import { jsx as
|
|
1187
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
1175
1188
|
var linksToAllPartialRouteHandler = async (request2, response) => {
|
|
1176
1189
|
const { webRoot: webRoot2 } = request2.app.locals;
|
|
1177
1190
|
const { partialNames } = findAllPartialsInRoot(webRoot2);
|
|
1178
1191
|
const { html: responseHtml } = await renderOnServer(
|
|
1179
|
-
/* @__PURE__ */
|
|
1180
|
-
null,
|
|
1181
|
-
null,
|
|
1182
|
-
""
|
|
1192
|
+
/* @__PURE__ */ jsx3(PartialsList, { webRoot: webRoot2, partialNames })
|
|
1183
1193
|
);
|
|
1184
1194
|
response.status(200).set({ "Content-Type": "text/html" }).end(responseHtml);
|
|
1185
1195
|
};
|
|
1186
1196
|
var linksToAllPartialsRouteHandler_default = linksToAllPartialRouteHandler;
|
|
1187
1197
|
|
|
1188
1198
|
// src/components/ModulesList.tsx
|
|
1189
|
-
import { jsx as
|
|
1199
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1190
1200
|
function EmptyModulesList({ webRoot: webRoot2 }) {
|
|
1191
1201
|
return /* @__PURE__ */ jsxs2("p", { children: [
|
|
1192
1202
|
"No modules in ",
|
|
@@ -1198,29 +1208,26 @@ function EmptyModulesList({ webRoot: webRoot2 }) {
|
|
|
1198
1208
|
}
|
|
1199
1209
|
function ModuleLinkInLI({ moduleName }) {
|
|
1200
1210
|
return /* @__PURE__ */ jsxs2("li", { children: [
|
|
1201
|
-
/* @__PURE__ */
|
|
1211
|
+
/* @__PURE__ */ jsx4("a", { href: `/preview/module/${moduleName}`, children: moduleName }),
|
|
1202
1212
|
" / ",
|
|
1203
|
-
/* @__PURE__ */
|
|
1213
|
+
/* @__PURE__ */ jsx4("a", { href: `/module/${moduleName}`, children: "Local Version" })
|
|
1204
1214
|
] });
|
|
1205
1215
|
}
|
|
1206
1216
|
function ModulesList({ webRoot: webRoot2, moduleNames }) {
|
|
1207
1217
|
if (moduleNames.length === 0) {
|
|
1208
|
-
return /* @__PURE__ */
|
|
1218
|
+
return /* @__PURE__ */ jsx4(EmptyModulesList, { webRoot: webRoot2 });
|
|
1209
1219
|
}
|
|
1210
|
-
return /* @__PURE__ */
|
|
1220
|
+
return /* @__PURE__ */ jsx4("ul", { children: moduleNames.map((moduleName) => /* @__PURE__ */ jsx4(ModuleLinkInLI, { moduleName }, moduleName)) });
|
|
1211
1221
|
}
|
|
1212
1222
|
var ModulesList_default = ModulesList;
|
|
1213
1223
|
|
|
1214
1224
|
// src/routes/linksToAllModulesRouteHandler.tsx
|
|
1215
|
-
import { jsx as
|
|
1225
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1216
1226
|
var linksToAllModuleRouteHandler = async (request2, response) => {
|
|
1217
1227
|
const { webRoot: webRoot2 } = request2.app.locals;
|
|
1218
1228
|
const { moduleNames } = findAllModulesInRoot(webRoot2);
|
|
1219
1229
|
const { html: responseHtml } = await renderOnServer(
|
|
1220
|
-
/* @__PURE__ */
|
|
1221
|
-
null,
|
|
1222
|
-
null,
|
|
1223
|
-
""
|
|
1230
|
+
/* @__PURE__ */ jsx5(ModulesList_default, { webRoot: webRoot2, moduleNames })
|
|
1224
1231
|
);
|
|
1225
1232
|
response.status(200).set({ "Content-Type": "text/html" }).end(responseHtml);
|
|
1226
1233
|
};
|
|
@@ -1234,6 +1241,7 @@ import { normalizePath as normalizePath3 } from "vite";
|
|
|
1234
1241
|
// src/lib/renderModule.ts
|
|
1235
1242
|
import { join as joinPosix2 } from "path/posix";
|
|
1236
1243
|
import { traverseFieldsJSON } from "@hubspot/cms-components/fields";
|
|
1244
|
+
import * as cmsComponents2 from "@hubspot/cms-components";
|
|
1237
1245
|
import cliHttp3 from "@hubspot/cli-lib/http.js";
|
|
1238
1246
|
|
|
1239
1247
|
// src/lib/fetchModuleGraphQLData.ts
|
|
@@ -1263,6 +1271,7 @@ async function fetchModuleGraphQLData(accountId, query, requestedModulePath, pag
|
|
|
1263
1271
|
}
|
|
1264
1272
|
|
|
1265
1273
|
// src/lib/renderModule.ts
|
|
1274
|
+
var { filterToModuleDataDepsIncludedIn, getModuleDataDependecyTypeFrom } = cmsComponents2;
|
|
1266
1275
|
var getApplyFieldsValidationToRenderContext = (portalId, fieldsJSON, requestedModulePath) => {
|
|
1267
1276
|
return async (renderResult) => {
|
|
1268
1277
|
const { renderContext } = renderResult;
|
|
@@ -1323,10 +1332,11 @@ async function renderModule(viteServer, requestedModulePath, moduleProps, pageUr
|
|
|
1323
1332
|
"CMS:JSRenderer:GetServerSideProps"
|
|
1324
1333
|
);
|
|
1325
1334
|
const messagesForBrowser = [];
|
|
1326
|
-
let serverSideProps;
|
|
1327
1335
|
let componentModule;
|
|
1328
1336
|
let dataQueryResult;
|
|
1329
1337
|
let foundPath;
|
|
1338
|
+
let getServerSideProps;
|
|
1339
|
+
let extraDeps;
|
|
1330
1340
|
if (!hasComponentExtension(requestedModulePath)) {
|
|
1331
1341
|
[componentModule, foundPath] = await lookForModuleInFolder2(
|
|
1332
1342
|
requestedModulePath,
|
|
@@ -1405,41 +1415,35 @@ async function renderModule(viteServer, requestedModulePath, moduleProps, pageUr
|
|
|
1405
1415
|
moduleName
|
|
1406
1416
|
});
|
|
1407
1417
|
if (ungatedForServerSideProps && componentModule.getServerSideProps) {
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
new URL(pageUrl)
|
|
1412
|
-
);
|
|
1413
|
-
serverSideProps = serverSidePropsResponse == null ? void 0 : serverSidePropsResponse.serverSideProps;
|
|
1414
|
-
if (!!serverSideProps || serverSideProps.constructor !== {}.constructor) {
|
|
1415
|
-
throw new Error("getServerSideProps must return an object");
|
|
1416
|
-
}
|
|
1417
|
-
} catch (error) {
|
|
1418
|
-
const errorString = `Error resolving server side props ${requestedModulePath}`;
|
|
1419
|
-
console.log(errorString);
|
|
1420
|
-
console.error(error);
|
|
1421
|
-
messagesForBrowser.push(
|
|
1422
|
-
{
|
|
1423
|
-
level: "error",
|
|
1424
|
-
parameters: [errorString]
|
|
1425
|
-
},
|
|
1426
|
-
{
|
|
1427
|
-
level: "error",
|
|
1428
|
-
parameters: [error.message]
|
|
1429
|
-
}
|
|
1418
|
+
if (!getModuleDataDependecyTypeFrom || !filterToModuleDataDepsIncludedIn) {
|
|
1419
|
+
throw new Error(
|
|
1420
|
+
`Need to upgrade to @hubspot/cms-components 0.15.x or higher to use getServerSideProps`
|
|
1430
1421
|
);
|
|
1431
1422
|
}
|
|
1423
|
+
getServerSideProps = componentModule.getServerSideProps;
|
|
1424
|
+
const depType = getModuleDataDependecyTypeFrom(
|
|
1425
|
+
componentModule.getServerSideProps
|
|
1426
|
+
);
|
|
1427
|
+
extraDeps = filterToModuleDataDepsIncludedIn(depType, {
|
|
1428
|
+
url: new URL(pageUrl),
|
|
1429
|
+
contact: void 0,
|
|
1430
|
+
// TODO
|
|
1431
|
+
request: void 0
|
|
1432
|
+
// TODO
|
|
1433
|
+
});
|
|
1432
1434
|
}
|
|
1433
1435
|
return renderComponentWithCSS_default(
|
|
1434
1436
|
viteServer,
|
|
1435
1437
|
foundPath,
|
|
1436
1438
|
Component,
|
|
1437
|
-
{
|
|
1439
|
+
{ props: namespacedModuleProps, extraDeps },
|
|
1438
1440
|
pageUrl,
|
|
1439
1441
|
basePath,
|
|
1440
1442
|
{ supplementalFieldValues, messagesForBrowser },
|
|
1441
1443
|
environmentConfig,
|
|
1442
|
-
renderOptions
|
|
1444
|
+
renderOptions,
|
|
1445
|
+
getServerSideProps,
|
|
1446
|
+
componentModule.unstable_modifyHtml
|
|
1443
1447
|
).then(applyFieldsValidationToRenderContext);
|
|
1444
1448
|
}
|
|
1445
1449
|
function getFieldValuesForModule(fieldsJSON, fieldOverrides = {}) {
|
|
@@ -1485,7 +1489,9 @@ var moduleRouteHandler = async (request2, response) => {
|
|
|
1485
1489
|
if (request2.query.fields) {
|
|
1486
1490
|
try {
|
|
1487
1491
|
if (typeof request2.query.fields === "string") {
|
|
1488
|
-
fieldOverrides = JSON.parse(
|
|
1492
|
+
fieldOverrides = JSON.parse(
|
|
1493
|
+
decodeURIComponent(request2.query.fields.replace(/\+/g, "%20"))
|
|
1494
|
+
);
|
|
1489
1495
|
}
|
|
1490
1496
|
} catch (e) {
|
|
1491
1497
|
console.error(
|
|
@@ -1876,6 +1882,34 @@ import {
|
|
|
1876
1882
|
isDebugUrlString as isDebugUrlString3,
|
|
1877
1883
|
mergeServerRequestData_internal
|
|
1878
1884
|
} from "@hubspot/cms-components";
|
|
1885
|
+
|
|
1886
|
+
// src/lib/cleanCookieHeaders.ts
|
|
1887
|
+
var CookieBlockList = [
|
|
1888
|
+
"__cflb",
|
|
1889
|
+
"__cf_bm",
|
|
1890
|
+
"__cfseq",
|
|
1891
|
+
"__cfwaitingroom",
|
|
1892
|
+
"__cfruid",
|
|
1893
|
+
"_cfuvid",
|
|
1894
|
+
"cf_ob_info",
|
|
1895
|
+
"cf_use_ob",
|
|
1896
|
+
"cf_clearance",
|
|
1897
|
+
"cf_chl_XXXX",
|
|
1898
|
+
"cf_chl_rc_i",
|
|
1899
|
+
"cf_chl_rc_ni",
|
|
1900
|
+
"cf_chl_rc_m"
|
|
1901
|
+
];
|
|
1902
|
+
function cleanCookieHeaders(cookieHeader) {
|
|
1903
|
+
if (cookieHeader === void 0)
|
|
1904
|
+
return "";
|
|
1905
|
+
const cookies = cookieHeader.split(";");
|
|
1906
|
+
const cookieRegex = new RegExp(CookieBlockList.join("|"));
|
|
1907
|
+
return cookies.filter((cookie) => {
|
|
1908
|
+
return !cookie.match(cookieRegex);
|
|
1909
|
+
}).join(";");
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
// src/proxyPage/proxyPage.ts
|
|
1879
1913
|
var getEntryPointBasePathFromProxyRequest = (request2) => {
|
|
1880
1914
|
if (!request2) {
|
|
1881
1915
|
return "";
|
|
@@ -1900,6 +1934,7 @@ function resolvePlaceholderPath(placeholderPath, projectName, projectComponent)
|
|
|
1900
1934
|
}
|
|
1901
1935
|
var makeProxyPreviewRequest = (accountId, urlToProxy, previewKey, contentId, projectName, environmentConfig, __jsRenderingGates, cookieHeader) => {
|
|
1902
1936
|
const url3 = new URL(urlToProxy);
|
|
1937
|
+
const cleanedCookieHeader = cleanCookieHeaders(cookieHeader);
|
|
1903
1938
|
const renderPreviewLocally = url3.searchParams.has("renderPreviewLocally");
|
|
1904
1939
|
let proxiedQueryParams = {};
|
|
1905
1940
|
let baseUrl = url3.origin;
|
|
@@ -1942,7 +1977,7 @@ var makeProxyPreviewRequest = (accountId, urlToProxy, previewKey, contentId, pro
|
|
|
1942
1977
|
json: false,
|
|
1943
1978
|
useQuerystring: true,
|
|
1944
1979
|
headers: {
|
|
1945
|
-
COOKIE:
|
|
1980
|
+
COOKIE: cleanedCookieHeader
|
|
1946
1981
|
}
|
|
1947
1982
|
});
|
|
1948
1983
|
return result.catch((error) => {
|
|
@@ -2335,7 +2370,7 @@ function proxyPageResourceRedirect(req, res, next) {
|
|
|
2335
2370
|
}
|
|
2336
2371
|
|
|
2337
2372
|
// src/routes/homeRouteHandler.tsx
|
|
2338
|
-
import { Fragment, jsx as
|
|
2373
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2339
2374
|
var homeRouteHandler = async (request2, response, next) => {
|
|
2340
2375
|
const domainToProxy = getSubDomainFromValidLocalDomain(request2.hostname);
|
|
2341
2376
|
if (domainToProxy) {
|
|
@@ -2348,22 +2383,19 @@ var homeRouteHandler = async (request2, response, next) => {
|
|
|
2348
2383
|
const { moduleNames } = findAllModulesInRoot(webRoot2);
|
|
2349
2384
|
const { html: responseHtml } = await renderOnServer(
|
|
2350
2385
|
/* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
2351
|
-
storybookEnabled ? /* @__PURE__ */
|
|
2352
|
-
/* @__PURE__ */
|
|
2353
|
-
/* @__PURE__ */
|
|
2354
|
-
/* @__PURE__ */
|
|
2355
|
-
/* @__PURE__ */
|
|
2356
|
-
] })
|
|
2357
|
-
null,
|
|
2358
|
-
null,
|
|
2359
|
-
""
|
|
2386
|
+
storybookEnabled ? /* @__PURE__ */ jsx6("h2", { children: /* @__PURE__ */ jsx6("a", { href: `//storybook.${request2.hostname}:${devServerPort}`, children: "Storybook" }) }) : null,
|
|
2387
|
+
/* @__PURE__ */ jsx6("h2", { children: "Partials" }),
|
|
2388
|
+
/* @__PURE__ */ jsx6(PartialsList, { webRoot: webRoot2, partialNames }),
|
|
2389
|
+
/* @__PURE__ */ jsx6("h2", { children: "Modules" }),
|
|
2390
|
+
/* @__PURE__ */ jsx6(ModulesList_default, { webRoot: webRoot2, moduleNames })
|
|
2391
|
+
] })
|
|
2360
2392
|
);
|
|
2361
2393
|
response.status(200).set({ "Content-Type": "text/html" }).end(responseHtml);
|
|
2362
2394
|
};
|
|
2363
2395
|
var homeRouteHandler_default = homeRouteHandler;
|
|
2364
2396
|
|
|
2365
2397
|
// src/routes/proxyPathPageRouteHandler.tsx
|
|
2366
|
-
import { jsx as
|
|
2398
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2367
2399
|
async function proxyPathPageRouteHandler(request2, response, next) {
|
|
2368
2400
|
sendTrackingRequest("view-proxy-path-route");
|
|
2369
2401
|
const {
|
|
@@ -2379,10 +2411,10 @@ async function proxyPathPageRouteHandler(request2, response, next) {
|
|
|
2379
2411
|
if (!request2.query.page) {
|
|
2380
2412
|
const { html: responseHtml } = await renderOnServer(
|
|
2381
2413
|
/* @__PURE__ */ jsxs4("div", { children: [
|
|
2382
|
-
/* @__PURE__ */
|
|
2414
|
+
/* @__PURE__ */ jsx7("h2", { children: "Local Proxy" }),
|
|
2383
2415
|
/* @__PURE__ */ jsxs4("form", { action: "/proxy", children: [
|
|
2384
|
-
/* @__PURE__ */
|
|
2385
|
-
/* @__PURE__ */
|
|
2416
|
+
/* @__PURE__ */ jsx7("label", { htmlFor: "page", style: { display: "block" }, children: "Page URL" }),
|
|
2417
|
+
/* @__PURE__ */ jsx7(
|
|
2386
2418
|
"input",
|
|
2387
2419
|
{
|
|
2388
2420
|
style: { width: "300px" },
|
|
@@ -2391,12 +2423,9 @@ async function proxyPathPageRouteHandler(request2, response, next) {
|
|
|
2391
2423
|
placeholder: "https://somecmspage.com/path"
|
|
2392
2424
|
}
|
|
2393
2425
|
),
|
|
2394
|
-
/* @__PURE__ */
|
|
2426
|
+
/* @__PURE__ */ jsx7("button", { style: { display: "block" }, children: "Proxy" })
|
|
2395
2427
|
] })
|
|
2396
|
-
] })
|
|
2397
|
-
null,
|
|
2398
|
-
null,
|
|
2399
|
-
""
|
|
2428
|
+
] })
|
|
2400
2429
|
);
|
|
2401
2430
|
response.status(200).set({ "Content-Type": "text/html" }).end(responseHtml);
|
|
2402
2431
|
return;
|
|
@@ -2473,6 +2502,72 @@ function proxyPathPageResourceRedirect(req, res, next) {
|
|
|
2473
2502
|
fetch(urlToProxy).then((response) => response.body.pipe(res)).catch((err) => console.log(err));
|
|
2474
2503
|
}
|
|
2475
2504
|
|
|
2505
|
+
// src/routes/proxyServerlessHandler.ts
|
|
2506
|
+
import fetch2 from "node-fetch";
|
|
2507
|
+
var localDomains = ["localhost", "hslocal.net"];
|
|
2508
|
+
function proxyPathPageResourceRedirect2(req, res, next) {
|
|
2509
|
+
const { method, headers } = req;
|
|
2510
|
+
let refererUrl;
|
|
2511
|
+
let domainToProxy;
|
|
2512
|
+
let body;
|
|
2513
|
+
if (!req.headers.referer) {
|
|
2514
|
+
console.log("unable to proxy serverless request, no referer header found");
|
|
2515
|
+
next();
|
|
2516
|
+
return;
|
|
2517
|
+
}
|
|
2518
|
+
try {
|
|
2519
|
+
refererUrl = new URL(req.headers.referer);
|
|
2520
|
+
const referrerDomain = refererUrl.hostname;
|
|
2521
|
+
if (localDomains.includes(referrerDomain)) {
|
|
2522
|
+
domainToProxy = req.app.locals.domainsToProxy[0];
|
|
2523
|
+
} else {
|
|
2524
|
+
domainToProxy = referrerDomain;
|
|
2525
|
+
}
|
|
2526
|
+
} catch (e) {
|
|
2527
|
+
console.log("Error parsing referer URL:", e);
|
|
2528
|
+
next();
|
|
2529
|
+
}
|
|
2530
|
+
if (!domainToProxy) {
|
|
2531
|
+
console.log("No domain to proxy for serverless request, skipping...");
|
|
2532
|
+
next();
|
|
2533
|
+
return;
|
|
2534
|
+
}
|
|
2535
|
+
const urlToProxy = `${refererUrl.protocol}//${domainToProxy}${req.url}`;
|
|
2536
|
+
const contentType = headers["content-type"];
|
|
2537
|
+
const cookie = headers.cookie;
|
|
2538
|
+
if (req.body) {
|
|
2539
|
+
body = JSON.stringify(req.body);
|
|
2540
|
+
}
|
|
2541
|
+
const headersToPass = {
|
|
2542
|
+
...contentType ? { "Content-Type": contentType } : {},
|
|
2543
|
+
...cookie ? { COOKIE: cookie } : {}
|
|
2544
|
+
};
|
|
2545
|
+
const proxyLogArgs = [
|
|
2546
|
+
`attempting to proxy a ${method} serverless request to domain:`,
|
|
2547
|
+
domainToProxy,
|
|
2548
|
+
"for resource:",
|
|
2549
|
+
req.url
|
|
2550
|
+
];
|
|
2551
|
+
if (body) {
|
|
2552
|
+
proxyLogArgs.push("with body:", body);
|
|
2553
|
+
}
|
|
2554
|
+
switch (method) {
|
|
2555
|
+
case "POST":
|
|
2556
|
+
case "DELETE":
|
|
2557
|
+
case "PUT":
|
|
2558
|
+
fetch2(urlToProxy, {
|
|
2559
|
+
method,
|
|
2560
|
+
body,
|
|
2561
|
+
headers: headersToPass
|
|
2562
|
+
}).then((response) => response.body.pipe(res)).catch((err) => console.log(err));
|
|
2563
|
+
break;
|
|
2564
|
+
default:
|
|
2565
|
+
fetch2(urlToProxy, {
|
|
2566
|
+
headers: headersToPass
|
|
2567
|
+
}).then((response) => response.body.pipe(res)).catch((err) => console.log(err));
|
|
2568
|
+
}
|
|
2569
|
+
}
|
|
2570
|
+
|
|
2476
2571
|
// src/routes/modulePreviewRouteHandler.ts
|
|
2477
2572
|
import { buildStaticEnvConfig as buildStaticEnvConfig4 } from "@hubspot/cms-components";
|
|
2478
2573
|
import path6 from "path";
|
|
@@ -2561,7 +2656,7 @@ async function modulePreviewRouteHandler(request2, response) {
|
|
|
2561
2656
|
["content-type"]: "application/x-www-form-urlencoded",
|
|
2562
2657
|
["Accept"]: "text/html",
|
|
2563
2658
|
referer: `https://app.hubspot${authedEnv === "qa" ? "qa" : ""}.com`,
|
|
2564
|
-
cookie: request2.get("COOKIE")
|
|
2659
|
+
cookie: cleanCookieHeaders(request2.get("COOKIE"))
|
|
2565
2660
|
},
|
|
2566
2661
|
body: `module=${encodeURIComponent(JSON.stringify(localModule))}`
|
|
2567
2662
|
});
|
|
@@ -2617,10 +2712,9 @@ async function modulePreviewRouteHandler(request2, response) {
|
|
|
2617
2712
|
);
|
|
2618
2713
|
const html = htmlShell.replace(
|
|
2619
2714
|
"<!--headend-->",
|
|
2620
|
-
[
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
].join("\n")
|
|
2715
|
+
[cssNeeded, ...inlineAssets.map((inlineAsset) => inlineAsset.html)].join(
|
|
2716
|
+
"\n"
|
|
2717
|
+
)
|
|
2624
2718
|
).replace(`<!--ssr-outlet-->`, renderedHtml);
|
|
2625
2719
|
response.status(200).set({ "Content-Type": "text/html" }).end(html);
|
|
2626
2720
|
} catch (e) {
|
|
@@ -2664,6 +2758,8 @@ var createDevServerRoutes = async (viteServer, storybookPort) => {
|
|
|
2664
2758
|
devServerApp.get("/modules/", linksToAllModulesRouteHandler_default);
|
|
2665
2759
|
devServerApp.get("/module/:moduleName", module_default);
|
|
2666
2760
|
devServerApp.get("/module/:moduleName/*", module_default);
|
|
2761
|
+
devServerApp.all("/hs/serverless/*", proxyPathPageResourceRedirect2);
|
|
2762
|
+
devServerApp.all("/_hcms/api/*", proxyPathPageResourceRedirect2);
|
|
2667
2763
|
devServerApp.get("/", homeRouteHandler_default);
|
|
2668
2764
|
devServerApp.get("/*", proxyPathPageResourceRedirect);
|
|
2669
2765
|
devServerApp.get("/*", proxyPageResourceRedirect);
|
|
@@ -2821,11 +2917,11 @@ function devSecretsPlugin(secretNames) {
|
|
|
2821
2917
|
configureServer: {
|
|
2822
2918
|
order: "post",
|
|
2823
2919
|
async handler(server) {
|
|
2824
|
-
const
|
|
2920
|
+
const cmsComponents3 = await server.ssrLoadModule(
|
|
2825
2921
|
"@hubspot/cms-components"
|
|
2826
2922
|
);
|
|
2827
|
-
if (
|
|
2828
|
-
|
|
2923
|
+
if (cmsComponents3.setSecretsFromEnv) {
|
|
2924
|
+
cmsComponents3.setSecretsFromEnv(secretNames);
|
|
2829
2925
|
} else if (secretNames.length > 0) {
|
|
2830
2926
|
console.warn(
|
|
2831
2927
|
"Not loading secrets into the local environment. Make sure that your @hubspot/cms-components and @hubspot/cms-dev-server package versions match."
|
|
@@ -3109,6 +3205,7 @@ async function validateHSPlatform(webroot, portalId) {
|
|
|
3109
3205
|
}
|
|
3110
3206
|
|
|
3111
3207
|
// src/createDevServer.ts
|
|
3208
|
+
import { get as hsGet6 } from "@hubspot/cli-lib/http.js";
|
|
3112
3209
|
var BASE_PATH = "/";
|
|
3113
3210
|
var PORT = process.env.PORT ? parseInt(process.env.PORT, 10) : 3e3;
|
|
3114
3211
|
var SHADOW_PORT = 1442;
|
|
@@ -3211,7 +3308,15 @@ Local proxy functionality and module preview routes will not work without settin
|
|
|
3211
3308
|
}
|
|
3212
3309
|
}
|
|
3213
3310
|
}
|
|
3214
|
-
|
|
3311
|
+
let authedHublet;
|
|
3312
|
+
try {
|
|
3313
|
+
const accountInformation = await hsGet6(authedPortalId, {
|
|
3314
|
+
uri: "/account-info/v3/details"
|
|
3315
|
+
});
|
|
3316
|
+
authedHublet = accountInformation.dataHostingLocation;
|
|
3317
|
+
} catch (e) {
|
|
3318
|
+
authedHublet = "na1";
|
|
3319
|
+
}
|
|
3215
3320
|
const absoluteWebRoot = normalizePath6(path8.resolve(process.cwd(), webRoot2));
|
|
3216
3321
|
const [__webRootProjectFolder, webRootProjectComponentFolder] = absoluteWebRoot.replace(/\/$/, "").split("/").slice(-2);
|
|
3217
3322
|
if (authedPortalId) {
|
|
@@ -3245,6 +3350,7 @@ Local proxy functionality and module preview routes will not work without settin
|
|
|
3245
3350
|
expressServer.locals.projectName = projectName;
|
|
3246
3351
|
expressServer.locals.projectComponentPath = webRootProjectComponentFolder;
|
|
3247
3352
|
expressServer.locals.jsRenderingGates = jsRenderingGates;
|
|
3353
|
+
expressServer.locals.domainsToProxy = domainsToProxy;
|
|
3248
3354
|
expressServer.use(bodyParser.json());
|
|
3249
3355
|
expressServer.use(
|
|
3250
3356
|
BASE_PATH,
|
package/dist/storybook/index.js
CHANGED
|
@@ -35,8 +35,14 @@ function namespaceModulePropsShape(props) {
|
|
|
35
35
|
// ../cms-js-internal/dist/index.js
|
|
36
36
|
import * as dotProp from "dot-prop";
|
|
37
37
|
import { renderToPipeableStream, renderToStaticMarkup } from "react-dom/server";
|
|
38
|
+
import * as cmsComponents from "@hubspot/cms-components";
|
|
38
39
|
import { isValidElement, cloneElement } from "react";
|
|
39
40
|
var { setProperty, getProperty, hasProperty } = dotProp;
|
|
41
|
+
var {
|
|
42
|
+
createServerRenderContextV2: createServerRenderContextV22,
|
|
43
|
+
createServerRenderContext: createServerRenderContext2,
|
|
44
|
+
renderServerSidePropsWithAsyncLocalStoreContext
|
|
45
|
+
} = cmsComponents;
|
|
40
46
|
function renderFieldsJSX(fieldsJSX) {
|
|
41
47
|
let moduleJson;
|
|
42
48
|
const outputCallback = (callbackJson) => {
|
|
@@ -498,7 +498,7 @@ __export(dist_exports, {
|
|
|
498
498
|
virtualClientRenderIslandModuleId: () => virtualClientRenderIslandModuleId
|
|
499
499
|
});
|
|
500
500
|
import * as dotProp from "dot-prop";
|
|
501
|
-
import
|
|
501
|
+
import { jsx } from "react/jsx-runtime";
|
|
502
502
|
import stream from "stream";
|
|
503
503
|
import { renderToPipeableStream, renderToStaticMarkup } from "react-dom/server";
|
|
504
504
|
import * as cmsComponents from "@hubspot/cms-components";
|
|
@@ -588,29 +588,37 @@ function noncePlaceholderPlugin() {
|
|
|
588
588
|
}
|
|
589
589
|
};
|
|
590
590
|
}
|
|
591
|
-
async function renderComponentOnServer(Component,
|
|
591
|
+
async function renderComponentOnServer(Component, propsAndDeps, pageUrl, environmentConfig, entryPointBasePath, contextOptions, renderOptions, getServerSideProps) {
|
|
592
|
+
const { props } = propsAndDeps;
|
|
592
593
|
const componentDebugName = Component.displayName || Component.name;
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
pageUrl,
|
|
596
|
-
environmentConfig,
|
|
597
|
-
entryPointBasePath,
|
|
598
|
-
contextOptions,
|
|
599
|
-
componentDebugName,
|
|
600
|
-
renderOptions
|
|
601
|
-
);
|
|
602
|
-
}
|
|
603
|
-
async function renderOnServer(elements, pageUrl, environmentConfig, entryPointBasePath, contextOptions, debugName, renderOptions) {
|
|
604
|
-
const supplementalFieldValues = contextOptions ? contextOptions.supplementalFieldValues : void 0;
|
|
605
|
-
const messagesForBrowser = contextOptions ? contextOptions.messagesForBrowser : void 0;
|
|
594
|
+
const supplementalFieldValues = contextOptions == null ? void 0 : contextOptions.supplementalFieldValues;
|
|
595
|
+
const messagesForBrowser = contextOptions == null ? void 0 : contextOptions.messagesForBrowser;
|
|
606
596
|
const renderContext = cmsComponents.createServerRenderContextV2 ? cmsComponents.createServerRenderContextV2(pageUrl, {
|
|
607
597
|
environmentConfig,
|
|
608
598
|
entryPointBasePath,
|
|
609
599
|
supplementalFieldValues,
|
|
610
600
|
messagesForBrowser
|
|
611
601
|
}) : cmsComponents.createServerRenderContext(pageUrl, environmentConfig);
|
|
602
|
+
if (getServerSideProps !== void 0 && typeof getServerSideProps === "function") {
|
|
603
|
+
const gSSPResult = await renderServerSidePropsWithAsyncLocalStoreContext(
|
|
604
|
+
getServerSideProps,
|
|
605
|
+
propsAndDeps,
|
|
606
|
+
renderContext
|
|
607
|
+
);
|
|
608
|
+
if (gSSPResult) {
|
|
609
|
+
props.serverSideProps = gSSPResult.serverSideProps;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
return renderOnServer(
|
|
613
|
+
/* @__PURE__ */ jsx(Component, { ...props }),
|
|
614
|
+
renderContext,
|
|
615
|
+
componentDebugName,
|
|
616
|
+
renderOptions
|
|
617
|
+
);
|
|
618
|
+
}
|
|
619
|
+
async function renderOnServer(elements, renderContext = bootStrapRenderContext(), debugName, renderOptions) {
|
|
612
620
|
let html = await renderStreamToPromise(
|
|
613
|
-
/* @__PURE__ */
|
|
621
|
+
/* @__PURE__ */ jsx(ServerRenderContext.Provider, { value: renderContext, children: elements }),
|
|
614
622
|
renderOptions
|
|
615
623
|
);
|
|
616
624
|
if (renderContext.messagesForBrowser.length > 0) {
|
|
@@ -696,7 +704,7 @@ function renderFieldsToJson(fields, moduleName) {
|
|
|
696
704
|
throw e;
|
|
697
705
|
}
|
|
698
706
|
}
|
|
699
|
-
var setProperty, getProperty, hasProperty, serializeIslandDataForInlineScript, writeSharedStateToJsGlobal, createIslandsGlobalJsForClientInDev,
|
|
707
|
+
var setProperty, getProperty, hasProperty, serializeIslandDataForInlineScript, writeSharedStateToJsGlobal, createIslandsGlobalJsForClientInDev, promiseForNewWritableStream, renderStreamToPromise, createServerRenderContextV22, createServerRenderContext2, renderServerSidePropsWithAsyncLocalStoreContext, bootStrapRenderContext;
|
|
700
708
|
var init_dist = __esm({
|
|
701
709
|
"../cms-js-internal/dist/index.js"() {
|
|
702
710
|
init_basicUtils();
|
|
@@ -797,7 +805,6 @@ ${indentString}`);
|
|
|
797
805
|
prettyPrint
|
|
798
806
|
)}`;
|
|
799
807
|
};
|
|
800
|
-
jsx2 = jsxRuntime.jsx;
|
|
801
808
|
promiseForNewWritableStream = () => {
|
|
802
809
|
const chunks = [];
|
|
803
810
|
const writableStream = new stream.Writable();
|
|
@@ -834,6 +841,20 @@ ${indentString}`);
|
|
|
834
841
|
});
|
|
835
842
|
return streamDonePromise;
|
|
836
843
|
};
|
|
844
|
+
({
|
|
845
|
+
createServerRenderContextV2: createServerRenderContextV22,
|
|
846
|
+
createServerRenderContext: createServerRenderContext2,
|
|
847
|
+
renderServerSidePropsWithAsyncLocalStoreContext
|
|
848
|
+
} = cmsComponents);
|
|
849
|
+
bootStrapRenderContext = () => {
|
|
850
|
+
const renderContext = createServerRenderContextV22 ? createServerRenderContextV22(null, {
|
|
851
|
+
environmentConfig: null,
|
|
852
|
+
entryPointBasePath: "",
|
|
853
|
+
supplementalFieldValues: {},
|
|
854
|
+
messagesForBrowser: []
|
|
855
|
+
}) : createServerRenderContext2("", null);
|
|
856
|
+
return renderContext;
|
|
857
|
+
};
|
|
837
858
|
}
|
|
838
859
|
});
|
|
839
860
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cms-dev-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.1-alpha.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@hubspot/cli-lib": "^3.0.12",
|
|
29
|
-
"@hubspot/cms-components": "^0.
|
|
29
|
+
"@hubspot/cms-components": "^0.15.1-alpha.0",
|
|
30
30
|
"@inquirer/select": "^2.0.0",
|
|
31
31
|
"@originjs/vite-plugin-commonjs": "^1.0.3",
|
|
32
32
|
"@storybook/addon-actions": "7.0.7",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@storybook/react": "7.0.7",
|
|
38
38
|
"@storybook/react-vite": "7.0.7",
|
|
39
39
|
"@storybook/testing-library": "^0.0.13",
|
|
40
|
-
"@vitejs/plugin-react": "^4.
|
|
40
|
+
"@vitejs/plugin-react": "^4.2.1",
|
|
41
41
|
"ansi-to-html": "0.7.x",
|
|
42
42
|
"babel-plugin-macros": "^3.1.0",
|
|
43
43
|
"babel-plugin-styled-components": "^2.1.4",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"request": "^2.88.2",
|
|
53
53
|
"styled-jsx": "5.1.2",
|
|
54
54
|
"typescript": "~4.7.0",
|
|
55
|
-
"vite": "4.5.
|
|
55
|
+
"vite": "4.5.3",
|
|
56
56
|
"vite-plugin-inspect": "^0.4.3",
|
|
57
57
|
"vite-plugin-mkcert": "1.16.0"
|
|
58
58
|
},
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"nodemon": "^2.0.15",
|
|
68
68
|
"publint": "^0.2.7",
|
|
69
69
|
"ts-node": "^10.7.0",
|
|
70
|
-
"vitest": "
|
|
70
|
+
"vitest": "1.4.0"
|
|
71
71
|
},
|
|
72
72
|
"main": "./dist/index.js",
|
|
73
73
|
"exports": {
|
|
@@ -108,5 +108,5 @@
|
|
|
108
108
|
"publishConfig": {
|
|
109
109
|
"access": "public"
|
|
110
110
|
},
|
|
111
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "381183081aa0450bb0f1327df88809ac144dcccf"
|
|
112
112
|
}
|