@hubspot/cms-dev-server 1.0.37 → 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.
- package/dist/app/assets/index-PcyCbkys.css +1 -0
- package/dist/app/assets/{index-C-xmsAMz.js → index-tvg7JxpD.js} +1 -1
- package/dist/app/index.html +2 -2
- package/dist/app/server/serverEntry.js +1 -1
- package/dist/generateJsonFromJsx.js +5 -2
- package/dist/index.js +117 -135
- package/dist/internalSsr.js +6 -11
- package/dist/run.js +117 -135
- package/dist/storybook/index.js +1 -1
- package/dist/storybook-main/main.js +10 -15
- package/package.json +3 -4
- package/dist/.DS_Store +0 -0
- package/dist/app/assets/index-yaZ-s2DZ.css +0 -1
- package/types/lib/debugAuth.d.ts +0 -2
- package/types/lib/localComponentsLoader.d.ts +0 -2
- package/types/lib/viteAssetHandler.d.ts +0 -15
- package/types/plugins/hubspotStaticAssetPlugin.d.ts +0 -2
- package/types/plugins/remoteAssetsPlugin.d.ts +0 -7
- package/types/plugins/requestSigningPlugin.d.ts +0 -6
- package/types/routes/createAppServerRoutes.d.ts +0 -5
- package/types/routes/homeRouteHandler.d.ts +0 -3
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { createServer as createViteServer } from "vite";
|
|
|
3
3
|
import { createRequire } from "module";
|
|
4
4
|
import { default as react } from "@vitejs/plugin-react";
|
|
5
5
|
|
|
6
|
-
// ../cms-js-internal/dist/types-
|
|
6
|
+
// ../cms-js-internal/dist/types-Bqf9htWu.js
|
|
7
7
|
import path from "path";
|
|
8
8
|
import { createHash } from "crypto";
|
|
9
9
|
import fs, { readFileSync, existsSync, readdirSync, lstatSync } from "fs";
|
|
@@ -240,9 +240,7 @@ function getCMSAssetConfig(webRoot) {
|
|
|
240
240
|
var ENABLED_FEATURES_GATE_MAP = {
|
|
241
241
|
"cms:jsr:getServerSideProps": "CMS:JSRenderer:GetServerSideProps",
|
|
242
242
|
"cms:jsr:RemoveCjsPlugin": "CMS:JSRenderer:RemoveCjsPlugin",
|
|
243
|
-
"cms:jsr:analyzeCmsModules": "CMS:JSRenderer:AnalyzeCmsModules"
|
|
244
|
-
"cms:jsr:clientOnlySupplementalFieldSerialization": "CMS:JSRenderer:ClientOnlySupplementalFieldSerialization",
|
|
245
|
-
"cms:react:unifiedThemePreview": "CMS:React:UnifiedThemePreview"
|
|
243
|
+
"cms:jsr:analyzeCmsModules": "CMS:JSRenderer:AnalyzeCmsModules"
|
|
246
244
|
};
|
|
247
245
|
function isUngatedFor(gates, gate) {
|
|
248
246
|
return gates.includes(gate);
|
|
@@ -382,7 +380,7 @@ import { renderToPipeableStream, renderToStaticMarkup } from "react-dom/server";
|
|
|
382
380
|
import * as cmsComponents from "@hubspot/cms-components";
|
|
383
381
|
import { ServerRenderContext } from "@hubspot/cms-components";
|
|
384
382
|
var { setProperty, getProperty, hasProperty } = dotProp;
|
|
385
|
-
var serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestData, baseIndent = 0, prettyPrint
|
|
383
|
+
var serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestData, baseIndent = 0, prettyPrint) => {
|
|
386
384
|
const islandsArrayToSerialize = tweakedIslandsArray.map(
|
|
387
385
|
({
|
|
388
386
|
id,
|
|
@@ -428,7 +426,7 @@ var serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestD
|
|
|
428
426
|
if (filteredSupplementalFieldValues) {
|
|
429
427
|
output.supplementalFieldValues = filteredSupplementalFieldValues;
|
|
430
428
|
}
|
|
431
|
-
if (
|
|
429
|
+
if (output.clientOnly) {
|
|
432
430
|
output.supplementalFieldValues = supplementalFieldValues;
|
|
433
431
|
}
|
|
434
432
|
return output;
|
|
@@ -526,7 +524,7 @@ function getPerServerRequestUrls(perServerRequestData, viteDevServer) {
|
|
|
526
524
|
});
|
|
527
525
|
return perServerRequestDataWithUrls;
|
|
528
526
|
}
|
|
529
|
-
var createIslandsGlobalJsForClientInDev = (roots, perServerRequestData, viteDevServer, indent, prettyPrint
|
|
527
|
+
var createIslandsGlobalJsForClientInDev = (roots, perServerRequestData, viteDevServer, indent, prettyPrint) => {
|
|
530
528
|
const islands = getIslandUrls(roots, viteDevServer);
|
|
531
529
|
const perServerRequestDataWithUrls = getPerServerRequestUrls(
|
|
532
530
|
perServerRequestData,
|
|
@@ -538,8 +536,7 @@ var createIslandsGlobalJsForClientInDev = (roots, perServerRequestData, viteDevS
|
|
|
538
536
|
islands,
|
|
539
537
|
perServerRequestData,
|
|
540
538
|
indent,
|
|
541
|
-
prettyPrint
|
|
542
|
-
isUngatedForClientOnlySupplementalFieldSerialization
|
|
539
|
+
prettyPrint
|
|
543
540
|
)}${writeSharedStateToJsGlobal(
|
|
544
541
|
islands,
|
|
545
542
|
perServerRequestDataWithUrls,
|
|
@@ -1203,7 +1200,10 @@ Custom origin: ${process.env.VITE_ORIGIN}
|
|
|
1203
1200
|
postcss: webRoot
|
|
1204
1201
|
},
|
|
1205
1202
|
envDir: webRoot,
|
|
1206
|
-
envPrefix: "HS_"
|
|
1203
|
+
envPrefix: "HS_",
|
|
1204
|
+
define: {
|
|
1205
|
+
"process.env": {}
|
|
1206
|
+
}
|
|
1207
1207
|
};
|
|
1208
1208
|
return createViteServer(viteConfig);
|
|
1209
1209
|
}
|
|
@@ -1232,8 +1232,8 @@ import path7 from "path";
|
|
|
1232
1232
|
import { normalizePath as normalizePath5 } from "vite";
|
|
1233
1233
|
|
|
1234
1234
|
// src/lib/fullOriginalUrlFromRequest.ts
|
|
1235
|
-
function fullOriginalUrlFromRequest(
|
|
1236
|
-
return `${
|
|
1235
|
+
function fullOriginalUrlFromRequest(request) {
|
|
1236
|
+
return `${request.protocol}://${request.get("host")}${request.originalUrl}`;
|
|
1237
1237
|
}
|
|
1238
1238
|
|
|
1239
1239
|
// src/lib/renderPartial.ts
|
|
@@ -1465,11 +1465,6 @@ var criticalDevErrorsToServerMessages_default = criticalDevErrorsToServerMessage
|
|
|
1465
1465
|
|
|
1466
1466
|
// src/lib/templates.ts
|
|
1467
1467
|
var { readFile } = fsPromises;
|
|
1468
|
-
var getIsUngatedForClientOnlySupplementalFieldSerialization = (gates) => {
|
|
1469
|
-
return gates.includes(
|
|
1470
|
-
"CMS:JSRenderer:ClientOnlySupplementalFieldSerialization"
|
|
1471
|
-
);
|
|
1472
|
-
};
|
|
1473
1468
|
var generateIslandSetupScriptBlock = () => {
|
|
1474
1469
|
return `
|
|
1475
1470
|
<script type="module">
|
|
@@ -1533,7 +1528,6 @@ var createHtmlShellDependingOnRenderContext = async (baseTemplatePath, url3, tit
|
|
|
1533
1528
|
title,
|
|
1534
1529
|
`${globalScriptBlock}${serverLogScript}`
|
|
1535
1530
|
);
|
|
1536
|
-
const isUngatedForClientOnlySupplementalFieldSerialization = getIsUngatedForClientOnlySupplementalFieldSerialization(jsRenderingGates);
|
|
1537
1531
|
htmlTemplate = htmlTemplate.replace(
|
|
1538
1532
|
"<!--islandsglobal-->",
|
|
1539
1533
|
`<script>
|
|
@@ -1542,8 +1536,7 @@ var createHtmlShellDependingOnRenderContext = async (baseTemplatePath, url3, tit
|
|
|
1542
1536
|
renderContext.perServerRequestData,
|
|
1543
1537
|
viteServer,
|
|
1544
1538
|
6,
|
|
1545
|
-
prettyPrint
|
|
1546
|
-
isUngatedForClientOnlySupplementalFieldSerialization
|
|
1539
|
+
prettyPrint
|
|
1547
1540
|
)}
|
|
1548
1541
|
</script>
|
|
1549
1542
|
`
|
|
@@ -1571,15 +1564,13 @@ var getIslandRuntimeAndGlobalToInject = async (sortedIslandRoots, perServerReque
|
|
|
1571
1564
|
"/",
|
|
1572
1565
|
generateIslandSetupScriptBlock()
|
|
1573
1566
|
);
|
|
1574
|
-
const isUngatedForClientOnlySupplementalFieldSerialization = getIsUngatedForClientOnlySupplementalFieldSerialization(gates);
|
|
1575
1567
|
return `${islandRuntimeScript}
|
|
1576
1568
|
<script>${createIslandsGlobalJsForClientInDev2(
|
|
1577
1569
|
sortedIslandRoots,
|
|
1578
1570
|
perServerRequestData,
|
|
1579
1571
|
viteServer,
|
|
1580
1572
|
4,
|
|
1581
|
-
prettyPrint
|
|
1582
|
-
isUngatedForClientOnlySupplementalFieldSerialization
|
|
1573
|
+
prettyPrint
|
|
1583
1574
|
)}</script>
|
|
1584
1575
|
`;
|
|
1585
1576
|
};
|
|
@@ -1640,7 +1631,7 @@ function trackUsage(action) {
|
|
|
1640
1631
|
eventName: EVENT_NAME,
|
|
1641
1632
|
action,
|
|
1642
1633
|
nodeVersion: getNodeVersionData(),
|
|
1643
|
-
version: "1.0.
|
|
1634
|
+
version: "1.0.43",
|
|
1644
1635
|
os: getPlatform()
|
|
1645
1636
|
};
|
|
1646
1637
|
const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
|
|
@@ -2387,8 +2378,8 @@ function isModuleFolderChild(filePath) {
|
|
|
2387
2378
|
// src/lib/previewUtils.ts
|
|
2388
2379
|
import path4 from "path";
|
|
2389
2380
|
var removePreviewPrefix = (t2) => t2.split("/").slice(2).join("/");
|
|
2390
|
-
var getPreviewUrl = (
|
|
2391
|
-
const { authedPortalId, authedEnv, authedHublet, sslEnabled } =
|
|
2381
|
+
var getPreviewUrl = (request, queryParams) => {
|
|
2382
|
+
const { authedPortalId, authedEnv, authedHublet, sslEnabled } = request.app.locals;
|
|
2392
2383
|
const protocol = sslEnabled ? "https" : "http";
|
|
2393
2384
|
return `${protocol}://${authedPortalId}.hubspotpreview${authedEnv === "qa" ? "qa" : ""}-${authedHublet}.com/_hcms/preview/template/multi?${stringify(queryParams)}`;
|
|
2394
2385
|
};
|
|
@@ -2527,11 +2518,11 @@ async function initiatePreviewSession(authedPortalId, absoluteWebRoot, themePrev
|
|
|
2527
2518
|
}
|
|
2528
2519
|
|
|
2529
2520
|
// src/proxyPage/proxyPage.ts
|
|
2530
|
-
var getEntryPointBasePathFromProxyRequest = (
|
|
2531
|
-
if (!
|
|
2521
|
+
var getEntryPointBasePathFromProxyRequest = (request) => {
|
|
2522
|
+
if (!request) {
|
|
2532
2523
|
return "";
|
|
2533
2524
|
}
|
|
2534
|
-
const { path: requestPath, pathParamDict } =
|
|
2525
|
+
const { path: requestPath, pathParamDict } = request;
|
|
2535
2526
|
if (!pathParamDict || !pathParamDict.dynamic_slug) {
|
|
2536
2527
|
return requestPath;
|
|
2537
2528
|
}
|
|
@@ -2724,7 +2715,7 @@ function renderComponentForPlaceholderModule(viteServer, resolvedPath, localModu
|
|
|
2724
2715
|
}
|
|
2725
2716
|
);
|
|
2726
2717
|
}
|
|
2727
|
-
async function proxySpecificPage(
|
|
2718
|
+
async function proxySpecificPage(request, response, portalId, hublet, contentId, webRoot, viteServer, projectName, projectComponentPath, jsRenderingGates, urlToProxy, fullOriginalUrl) {
|
|
2728
2719
|
let accountId;
|
|
2729
2720
|
let proxyEnv;
|
|
2730
2721
|
const prettyPrint = isDebugUrlString3(urlToProxy);
|
|
@@ -2764,8 +2755,8 @@ async function proxySpecificPage(request2, response, portalId, hublet, contentId
|
|
|
2764
2755
|
projectName,
|
|
2765
2756
|
environmentConfig,
|
|
2766
2757
|
jsRenderingGates,
|
|
2767
|
-
|
|
2768
|
-
|
|
2758
|
+
request.get("COOKIE"),
|
|
2759
|
+
request.app.locals.localPreviewToken
|
|
2769
2760
|
)).data;
|
|
2770
2761
|
pageHtml = addRefreshScript(pageHtml);
|
|
2771
2762
|
await infillReactModulesAndWriteResponse(
|
|
@@ -2968,7 +2959,7 @@ async function signUrl(authedPortalId, unsignedUrl, requestBody) {
|
|
|
2968
2959
|
const formData = {
|
|
2969
2960
|
module: [JSON.stringify(requestBody)]
|
|
2970
2961
|
};
|
|
2971
|
-
const
|
|
2962
|
+
const request = {
|
|
2972
2963
|
unsignedUrl,
|
|
2973
2964
|
httpMethod: "POST",
|
|
2974
2965
|
formData
|
|
@@ -2980,7 +2971,7 @@ async function signUrl(authedPortalId, unsignedUrl, requestBody) {
|
|
|
2980
2971
|
"Content-Type": "application/json",
|
|
2981
2972
|
Accept: "application/json"
|
|
2982
2973
|
},
|
|
2983
|
-
data: JSON.stringify(
|
|
2974
|
+
data: JSON.stringify(request)
|
|
2984
2975
|
});
|
|
2985
2976
|
return response.data.signedUrl;
|
|
2986
2977
|
} catch (error) {
|
|
@@ -3109,7 +3100,7 @@ async function renderLocalProjectModulePreview(moduleName, authedPortalId, authe
|
|
|
3109
3100
|
|
|
3110
3101
|
// src/routes/partial.ts
|
|
3111
3102
|
import { join as joinPosix3 } from "path/posix";
|
|
3112
|
-
var partialRouteHandler = async (
|
|
3103
|
+
var partialRouteHandler = async (request, response) => {
|
|
3113
3104
|
sendTrackingRequest("view-partial-route");
|
|
3114
3105
|
const {
|
|
3115
3106
|
authedPortalId,
|
|
@@ -3120,8 +3111,8 @@ var partialRouteHandler = async (request2, response) => {
|
|
|
3120
3111
|
jsRenderingGates,
|
|
3121
3112
|
projectName,
|
|
3122
3113
|
projectComponentPath
|
|
3123
|
-
} =
|
|
3124
|
-
const partialName =
|
|
3114
|
+
} = request.app.locals;
|
|
3115
|
+
const partialName = request.params.partial;
|
|
3125
3116
|
const baseTemplatePath = packagePath(
|
|
3126
3117
|
import.meta.url,
|
|
3127
3118
|
"html/baseTemplate.html"
|
|
@@ -3156,7 +3147,7 @@ var partialRouteHandler = async (request2, response) => {
|
|
|
3156
3147
|
viteServer,
|
|
3157
3148
|
partialPath,
|
|
3158
3149
|
{},
|
|
3159
|
-
fullOriginalUrlFromRequest(
|
|
3150
|
+
fullOriginalUrlFromRequest(request),
|
|
3160
3151
|
basePath,
|
|
3161
3152
|
environmentConfig,
|
|
3162
3153
|
{
|
|
@@ -3198,7 +3189,7 @@ var partialRouteHandler = async (request2, response) => {
|
|
|
3198
3189
|
remoteModule.path,
|
|
3199
3190
|
authedPortalId,
|
|
3200
3191
|
authedEnv,
|
|
3201
|
-
|
|
3192
|
+
request.get("COOKIE")
|
|
3202
3193
|
).then((result) => ({
|
|
3203
3194
|
remoteModule,
|
|
3204
3195
|
result
|
|
@@ -3222,8 +3213,8 @@ var partialRouteHandler = async (request2, response) => {
|
|
|
3222
3213
|
jsRenderingGates,
|
|
3223
3214
|
projectName,
|
|
3224
3215
|
projectComponentPath,
|
|
3225
|
-
fullOriginalUrlFromRequest(
|
|
3226
|
-
|
|
3216
|
+
fullOriginalUrlFromRequest(request),
|
|
3217
|
+
request.get("COOKIE")
|
|
3227
3218
|
).then((result) => ({
|
|
3228
3219
|
localProjectModule,
|
|
3229
3220
|
result
|
|
@@ -3251,7 +3242,7 @@ var partialRouteHandler = async (request2, response) => {
|
|
|
3251
3242
|
}
|
|
3252
3243
|
const htmlShell = await createHtmlShellDependingOnRenderContext(
|
|
3253
3244
|
baseTemplatePath,
|
|
3254
|
-
|
|
3245
|
+
request.originalUrl,
|
|
3255
3246
|
`Partial: ${partialPath}`,
|
|
3256
3247
|
renderContext,
|
|
3257
3248
|
viteServer,
|
|
@@ -3301,8 +3292,8 @@ function PartialsList({ webRoot, partialNames }) {
|
|
|
3301
3292
|
|
|
3302
3293
|
// src/routes/linksToAllPartialsRouteHandler.tsx
|
|
3303
3294
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
3304
|
-
var linksToAllPartialRouteHandler = async (
|
|
3305
|
-
const { webRoot } =
|
|
3295
|
+
var linksToAllPartialRouteHandler = async (request, response) => {
|
|
3296
|
+
const { webRoot } = request.app.locals;
|
|
3306
3297
|
const { partialNames } = findAllPartialsInRoot(webRoot);
|
|
3307
3298
|
const { html: responseHtml } = await renderOnServer(
|
|
3308
3299
|
/* @__PURE__ */ jsx3(PartialsList, { webRoot, partialNames })
|
|
@@ -3339,8 +3330,8 @@ var ModulesList_default = ModulesList;
|
|
|
3339
3330
|
|
|
3340
3331
|
// src/routes/linksToAllModulesRouteHandler.tsx
|
|
3341
3332
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
3342
|
-
var linksToAllModuleRouteHandler = async (
|
|
3343
|
-
const { webRoot } =
|
|
3333
|
+
var linksToAllModuleRouteHandler = async (request, response) => {
|
|
3334
|
+
const { webRoot } = request.app.locals;
|
|
3344
3335
|
const { moduleNames } = findAllModulesInRoot(webRoot);
|
|
3345
3336
|
const { html: responseHtml } = await renderOnServer(
|
|
3346
3337
|
/* @__PURE__ */ jsx5(ModulesList_default, { webRoot, moduleNames })
|
|
@@ -3353,7 +3344,7 @@ var linksToAllModulesRouteHandler_default = linksToAllModuleRouteHandler;
|
|
|
3353
3344
|
import { buildStaticEnvConfig as buildStaticEnvConfig4 } from "@hubspot/cms-components";
|
|
3354
3345
|
import path8 from "path";
|
|
3355
3346
|
import { normalizePath as normalizePath6 } from "vite";
|
|
3356
|
-
var moduleRouteHandler = async (
|
|
3347
|
+
var moduleRouteHandler = async (request, response) => {
|
|
3357
3348
|
sendTrackingRequest("view-module-route");
|
|
3358
3349
|
const {
|
|
3359
3350
|
authedPortalId,
|
|
@@ -3364,8 +3355,8 @@ var moduleRouteHandler = async (request2, response) => {
|
|
|
3364
3355
|
jsRenderingGates,
|
|
3365
3356
|
projectName,
|
|
3366
3357
|
projectComponentPath
|
|
3367
|
-
} =
|
|
3368
|
-
const moduleName =
|
|
3358
|
+
} = request.app.locals;
|
|
3359
|
+
const moduleName = request.params.moduleName;
|
|
3369
3360
|
const baseTemplatePath = packagePath(
|
|
3370
3361
|
import.meta.url,
|
|
3371
3362
|
"html/baseTemplate.html"
|
|
@@ -3383,16 +3374,16 @@ var moduleRouteHandler = async (request2, response) => {
|
|
|
3383
3374
|
].join("/")
|
|
3384
3375
|
);
|
|
3385
3376
|
let fieldOverrides = null;
|
|
3386
|
-
if (
|
|
3377
|
+
if (request.query.fields) {
|
|
3387
3378
|
try {
|
|
3388
|
-
if (typeof
|
|
3379
|
+
if (typeof request.query.fields === "string") {
|
|
3389
3380
|
fieldOverrides = JSON.parse(
|
|
3390
|
-
decodeURIComponent(
|
|
3381
|
+
decodeURIComponent(request.query.fields.replace(/\+/g, "%20"))
|
|
3391
3382
|
);
|
|
3392
3383
|
}
|
|
3393
3384
|
} catch (e) {
|
|
3394
3385
|
console.error(
|
|
3395
|
-
`Error parsing field param for module ${moduleName}: ${
|
|
3386
|
+
`Error parsing field param for module ${moduleName}: ${request.query.fields}`
|
|
3396
3387
|
);
|
|
3397
3388
|
}
|
|
3398
3389
|
}
|
|
@@ -3418,7 +3409,7 @@ var moduleRouteHandler = async (request2, response) => {
|
|
|
3418
3409
|
hublParameters: {},
|
|
3419
3410
|
moduleName: `local-${moduleName}`
|
|
3420
3411
|
},
|
|
3421
|
-
fullOriginalUrlFromRequest(
|
|
3412
|
+
fullOriginalUrlFromRequest(request),
|
|
3422
3413
|
basePath,
|
|
3423
3414
|
environmentConfig,
|
|
3424
3415
|
{
|
|
@@ -3427,7 +3418,7 @@ var moduleRouteHandler = async (request2, response) => {
|
|
|
3427
3418
|
);
|
|
3428
3419
|
const htmlShell = await createHtmlShellDependingOnRenderContext(
|
|
3429
3420
|
baseTemplatePath,
|
|
3430
|
-
|
|
3421
|
+
request.originalUrl,
|
|
3431
3422
|
`Module: ${modulePath}`,
|
|
3432
3423
|
renderContext,
|
|
3433
3424
|
viteServer,
|
|
@@ -3500,11 +3491,11 @@ async function renderModuleFieldsJson(viteServer, requestedModulePath) {
|
|
|
3500
3491
|
var renderModuleFieldsJson_default = renderModuleFieldsJson;
|
|
3501
3492
|
|
|
3502
3493
|
// src/routes/moduleFieldsJson.ts
|
|
3503
|
-
var moduleFieldsJsonRouteHandler = async (
|
|
3494
|
+
var moduleFieldsJsonRouteHandler = async (request, response) => {
|
|
3504
3495
|
try {
|
|
3505
3496
|
sendTrackingRequest("fields-json-route");
|
|
3506
|
-
const { webRoot, viteServer } =
|
|
3507
|
-
const { moduleName } =
|
|
3497
|
+
const { webRoot, viteServer } = request.app.locals;
|
|
3498
|
+
const { moduleName } = request.params;
|
|
3508
3499
|
const modulePath = normalizePath7(
|
|
3509
3500
|
path9.resolve(webRoot, "components/modules/", moduleName)
|
|
3510
3501
|
);
|
|
@@ -3615,7 +3606,7 @@ async function fetchContentMetadata(url3, portalId) {
|
|
|
3615
3606
|
}
|
|
3616
3607
|
|
|
3617
3608
|
// src/routes/proxyPageRouteHandler.ts
|
|
3618
|
-
async function proxyPageRouteHandler(
|
|
3609
|
+
async function proxyPageRouteHandler(request, response, next) {
|
|
3619
3610
|
sendTrackingRequest("view-proxy-page-route");
|
|
3620
3611
|
const {
|
|
3621
3612
|
viteServer,
|
|
@@ -3623,20 +3614,20 @@ async function proxyPageRouteHandler(request2, response, next) {
|
|
|
3623
3614
|
projectName,
|
|
3624
3615
|
projectComponentPath,
|
|
3625
3616
|
jsRenderingGates
|
|
3626
|
-
} =
|
|
3627
|
-
if (!
|
|
3617
|
+
} = request.app.locals;
|
|
3618
|
+
if (!request.accepts().includes("text/html")) {
|
|
3628
3619
|
return response.sendStatus(404);
|
|
3629
3620
|
}
|
|
3630
|
-
const fullOriginalUrl = fullOriginalUrlFromRequest(
|
|
3631
|
-
const domainToProxy = getSubDomainFromValidLocalDomain(
|
|
3632
|
-
const urlToProxy = `http://${domainToProxy}${
|
|
3621
|
+
const fullOriginalUrl = fullOriginalUrlFromRequest(request);
|
|
3622
|
+
const domainToProxy = getSubDomainFromValidLocalDomain(request.hostname);
|
|
3623
|
+
const urlToProxy = `http://${domainToProxy}${request.originalUrl}`;
|
|
3633
3624
|
if (!domainToProxy) {
|
|
3634
|
-
if (VALID_PROXY_DOMAIN_SUFFIXES.includes(
|
|
3635
|
-
const message = `Can't make a proxy request, you need to prepend the real page's domain to '${
|
|
3625
|
+
if (VALID_PROXY_DOMAIN_SUFFIXES.includes(request.hostname)) {
|
|
3626
|
+
const message = `Can't make a proxy request, you need to prepend the real page's domain to '${request.hostname}' (i.e. your.page.com.${request.hostname})`;
|
|
3636
3627
|
consoleWarn(message);
|
|
3637
3628
|
return response.status(400).send(message);
|
|
3638
3629
|
} else {
|
|
3639
|
-
const message = `Can't make a proxy request, the domain '${
|
|
3630
|
+
const message = `Can't make a proxy request, the domain '${request.hostname}' is not a valid proxy-able domain`;
|
|
3640
3631
|
consoleWarn(message);
|
|
3641
3632
|
return response.status(400).send(message);
|
|
3642
3633
|
}
|
|
@@ -3644,10 +3635,10 @@ async function proxyPageRouteHandler(request2, response, next) {
|
|
|
3644
3635
|
try {
|
|
3645
3636
|
const { portalId, contentId, hublet } = await fetchContentMetadata(
|
|
3646
3637
|
urlToProxy,
|
|
3647
|
-
|
|
3638
|
+
request.app.locals.authedPortalId
|
|
3648
3639
|
);
|
|
3649
3640
|
await proxySpecificPage(
|
|
3650
|
-
|
|
3641
|
+
request,
|
|
3651
3642
|
response,
|
|
3652
3643
|
portalId,
|
|
3653
3644
|
hublet,
|
|
@@ -3666,7 +3657,7 @@ async function proxyPageRouteHandler(request2, response, next) {
|
|
|
3666
3657
|
}
|
|
3667
3658
|
|
|
3668
3659
|
// src/routes/proxyPageResourceRedirect.ts
|
|
3669
|
-
import
|
|
3660
|
+
import fetch2 from "node-fetch";
|
|
3670
3661
|
var HCMS_PATH = "/_hcms/";
|
|
3671
3662
|
var HS_FS_PATH = "/hs-fs/";
|
|
3672
3663
|
var HUB_FS_PATH = "/hubfs/";
|
|
@@ -3681,7 +3672,7 @@ function proxyPageResourceRedirect(req, res, next) {
|
|
|
3681
3672
|
const pathToProxy = req.originalUrl;
|
|
3682
3673
|
const urlToProxy = `https://${domainToProxy}${pathToProxy}`;
|
|
3683
3674
|
if (req.method === "GET") {
|
|
3684
|
-
|
|
3675
|
+
fetch2(urlToProxy).then((response) => response.body.pipe(res)).catch((err) => console.log(err));
|
|
3685
3676
|
} else {
|
|
3686
3677
|
const contentType = req.headers["content-type"];
|
|
3687
3678
|
const isSendingJSON = contentType && /\bjson\b/.test(req.headers["content-type"].toString());
|
|
@@ -3696,6 +3687,7 @@ function proxyPageResourceRedirect(req, res, next) {
|
|
|
3696
3687
|
}
|
|
3697
3688
|
return true;
|
|
3698
3689
|
});
|
|
3690
|
+
const headersToPass = Object.fromEntries(headerEntries);
|
|
3699
3691
|
let body = void 0;
|
|
3700
3692
|
if (req.body) {
|
|
3701
3693
|
if (isSendingJSON) {
|
|
@@ -3704,12 +3696,11 @@ function proxyPageResourceRedirect(req, res, next) {
|
|
|
3704
3696
|
body = req.body.toString();
|
|
3705
3697
|
}
|
|
3706
3698
|
}
|
|
3707
|
-
|
|
3708
|
-
url: urlToProxy,
|
|
3699
|
+
fetch2(urlToProxy, {
|
|
3709
3700
|
method: req.method,
|
|
3710
|
-
headers:
|
|
3701
|
+
headers: headersToPass,
|
|
3711
3702
|
body
|
|
3712
|
-
}).pipe(res);
|
|
3703
|
+
}).then((response) => response.body.pipe(res)).catch((err) => console.log(err));
|
|
3713
3704
|
}
|
|
3714
3705
|
}
|
|
3715
3706
|
|
|
@@ -3762,8 +3753,8 @@ function isCodedFile(filePath) {
|
|
|
3762
3753
|
|
|
3763
3754
|
// src/routes/legacyRouteHandler.tsx
|
|
3764
3755
|
import { Fragment, jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
3765
|
-
var legacyRouteHandler = async (
|
|
3766
|
-
const domainToProxy = getSubDomainFromValidLocalDomain(
|
|
3756
|
+
var legacyRouteHandler = async (request, response, next) => {
|
|
3757
|
+
const domainToProxy = getSubDomainFromValidLocalDomain(request.hostname);
|
|
3767
3758
|
if (domainToProxy) {
|
|
3768
3759
|
next();
|
|
3769
3760
|
return;
|
|
@@ -3774,12 +3765,8 @@ var legacyRouteHandler = async (request2, response, next) => {
|
|
|
3774
3765
|
webRoot,
|
|
3775
3766
|
storybookEnabled,
|
|
3776
3767
|
devServerPort,
|
|
3777
|
-
localPreviewToken
|
|
3778
|
-
|
|
3779
|
-
} = request2.app.locals;
|
|
3780
|
-
const isUngatedForUnifiedThemePreview = jsRenderingGates.includes(
|
|
3781
|
-
"CMS:React:UnifiedThemePreview"
|
|
3782
|
-
);
|
|
3768
|
+
localPreviewToken
|
|
3769
|
+
} = request.app.locals;
|
|
3783
3770
|
const { partialNames } = findAllPartialsInRoot(webRoot);
|
|
3784
3771
|
const { moduleNames } = findAllModulesInRoot(webRoot);
|
|
3785
3772
|
const hublModuleData = await fetchHubLModules(
|
|
@@ -3792,17 +3779,15 @@ var legacyRouteHandler = async (request2, response, next) => {
|
|
|
3792
3779
|
);
|
|
3793
3780
|
const { html: responseHtml } = await renderOnServer(
|
|
3794
3781
|
/* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
3795
|
-
storybookEnabled ? /* @__PURE__ */ jsx8("h2", { children: /* @__PURE__ */ jsx8("a", { href: `//storybook.${
|
|
3782
|
+
storybookEnabled ? /* @__PURE__ */ jsx8("h2", { children: /* @__PURE__ */ jsx8("a", { href: `//storybook.${request.hostname}:${devServerPort}`, children: "Storybook" }) }) : null,
|
|
3796
3783
|
/* @__PURE__ */ jsx8("h2", { children: "Partials" }),
|
|
3797
3784
|
/* @__PURE__ */ jsx8(PartialsList, { webRoot, partialNames }),
|
|
3798
3785
|
/* @__PURE__ */ jsx8("h2", { children: "React modules" }),
|
|
3799
3786
|
/* @__PURE__ */ jsx8(ModulesList_default, { webRoot, moduleNames }),
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
/* @__PURE__ */ jsx8(HubLTemplatesList, { templates: hublTemplateData.objects })
|
|
3805
|
-
] })
|
|
3787
|
+
/* @__PURE__ */ jsx8("h2", { children: "HubL modules" }),
|
|
3788
|
+
/* @__PURE__ */ jsx8(HubLModulesList, { modules: hublModuleData.objects }),
|
|
3789
|
+
/* @__PURE__ */ jsx8("h2", { children: "HubL templates" }),
|
|
3790
|
+
/* @__PURE__ */ jsx8(HubLTemplatesList, { templates: hublTemplateData.objects })
|
|
3806
3791
|
] })
|
|
3807
3792
|
);
|
|
3808
3793
|
response.status(200).set({ "Content-Type": "text/html" }).end(responseHtml);
|
|
@@ -3811,7 +3796,7 @@ var legacyRouteHandler_default = legacyRouteHandler;
|
|
|
3811
3796
|
|
|
3812
3797
|
// src/routes/proxyPathPageRouteHandler.tsx
|
|
3813
3798
|
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
3814
|
-
async function proxyPathPageRouteHandler(
|
|
3799
|
+
async function proxyPathPageRouteHandler(request, response, next) {
|
|
3815
3800
|
sendTrackingRequest("view-proxy-path-route");
|
|
3816
3801
|
const {
|
|
3817
3802
|
viteServer,
|
|
@@ -3819,11 +3804,11 @@ async function proxyPathPageRouteHandler(request2, response, next) {
|
|
|
3819
3804
|
projectName,
|
|
3820
3805
|
projectComponentPath,
|
|
3821
3806
|
jsRenderingGates
|
|
3822
|
-
} =
|
|
3823
|
-
if (!
|
|
3807
|
+
} = request.app.locals;
|
|
3808
|
+
if (!request.accepts().includes("text/html")) {
|
|
3824
3809
|
return response.sendStatus(404);
|
|
3825
3810
|
}
|
|
3826
|
-
if (!
|
|
3811
|
+
if (!request.query.page) {
|
|
3827
3812
|
const { html: responseHtml } = await renderOnServer(
|
|
3828
3813
|
/* @__PURE__ */ jsxs5("div", { children: [
|
|
3829
3814
|
/* @__PURE__ */ jsx9("h2", { children: "Local Proxy" }),
|
|
@@ -3847,7 +3832,7 @@ async function proxyPathPageRouteHandler(request2, response, next) {
|
|
|
3847
3832
|
}
|
|
3848
3833
|
let proxyPageUrl;
|
|
3849
3834
|
try {
|
|
3850
|
-
proxyPageUrl = new URL(
|
|
3835
|
+
proxyPageUrl = new URL(request.query.page);
|
|
3851
3836
|
} catch (e) {
|
|
3852
3837
|
const message = "Please provide a valid page query parameter, e.g., http://localhost:3000/proxy?page=https://yourdomain.com/path";
|
|
3853
3838
|
consoleWarn(message);
|
|
@@ -3862,10 +3847,10 @@ async function proxyPathPageRouteHandler(request2, response, next) {
|
|
|
3862
3847
|
try {
|
|
3863
3848
|
const { portalId, contentId, hublet } = await fetchContentMetadata(
|
|
3864
3849
|
proxyPageUrl.href,
|
|
3865
|
-
|
|
3850
|
+
request.app.locals.authedPortalId
|
|
3866
3851
|
);
|
|
3867
3852
|
await proxySpecificPage(
|
|
3868
|
-
|
|
3853
|
+
request,
|
|
3869
3854
|
response,
|
|
3870
3855
|
portalId,
|
|
3871
3856
|
hublet,
|
|
@@ -3884,7 +3869,7 @@ async function proxyPathPageRouteHandler(request2, response, next) {
|
|
|
3884
3869
|
}
|
|
3885
3870
|
|
|
3886
3871
|
// src/routes/proxyPathPageResourceRedirect.ts
|
|
3887
|
-
import
|
|
3872
|
+
import fetch3 from "node-fetch";
|
|
3888
3873
|
var HCMS_PATH2 = "/_hcms/";
|
|
3889
3874
|
var HS_FS_PATH2 = "/hs-fs/";
|
|
3890
3875
|
var HUB_FS_PATH2 = "/hubfs/";
|
|
@@ -3914,11 +3899,11 @@ function proxyPathPageResourceRedirect(req, res, next) {
|
|
|
3914
3899
|
return;
|
|
3915
3900
|
}
|
|
3916
3901
|
const urlToProxy = `https://${proxyPageUrl.host}${req.url}`;
|
|
3917
|
-
|
|
3902
|
+
fetch3(urlToProxy).then((response) => response.body.pipe(res)).catch((err) => console.log(err));
|
|
3918
3903
|
}
|
|
3919
3904
|
|
|
3920
3905
|
// src/routes/proxyServerlessHandler.ts
|
|
3921
|
-
import
|
|
3906
|
+
import fetch4 from "node-fetch";
|
|
3922
3907
|
var localDomains = ["localhost", "hslocal.net"];
|
|
3923
3908
|
function proxyServerlessRequest(req, res, next) {
|
|
3924
3909
|
const { method, headers } = req;
|
|
@@ -3971,14 +3956,14 @@ function proxyServerlessRequest(req, res, next) {
|
|
|
3971
3956
|
case "POST":
|
|
3972
3957
|
case "DELETE":
|
|
3973
3958
|
case "PUT":
|
|
3974
|
-
|
|
3959
|
+
fetch4(urlToProxy, {
|
|
3975
3960
|
method,
|
|
3976
3961
|
body,
|
|
3977
3962
|
headers: headersToPass
|
|
3978
3963
|
}).then((response) => response.body.pipe(res)).catch((err) => console.log(err));
|
|
3979
3964
|
break;
|
|
3980
3965
|
default:
|
|
3981
|
-
|
|
3966
|
+
fetch4(urlToProxy, {
|
|
3982
3967
|
headers: headersToPass
|
|
3983
3968
|
}).then((response) => response.body.pipe(res)).catch((err) => console.log(err));
|
|
3984
3969
|
}
|
|
@@ -3987,7 +3972,7 @@ function proxyServerlessRequest(req, res, next) {
|
|
|
3987
3972
|
// src/routes/modulePreviewRouteHandler.ts
|
|
3988
3973
|
import path10 from "path";
|
|
3989
3974
|
import { normalizePath as normalizePath8 } from "vite";
|
|
3990
|
-
async function modulePreviewRouteHandler(
|
|
3975
|
+
async function modulePreviewRouteHandler(request, response) {
|
|
3991
3976
|
sendTrackingRequest("view-module-preview-route");
|
|
3992
3977
|
const {
|
|
3993
3978
|
authedPortalId,
|
|
@@ -3998,18 +3983,18 @@ async function modulePreviewRouteHandler(request2, response) {
|
|
|
3998
3983
|
jsRenderingGates,
|
|
3999
3984
|
projectName,
|
|
4000
3985
|
projectComponentPath
|
|
4001
|
-
} =
|
|
4002
|
-
const moduleName =
|
|
3986
|
+
} = request.app.locals;
|
|
3987
|
+
const moduleName = request.params.moduleName;
|
|
4003
3988
|
const modulePath = normalizePath8(
|
|
4004
3989
|
path10.resolve(webRoot, "components/modules/", moduleName)
|
|
4005
3990
|
);
|
|
4006
3991
|
const PREVIEWER_APP_PARAM = "hsPreviewerApp";
|
|
4007
3992
|
let fieldOverrides = {};
|
|
4008
|
-
if (
|
|
4009
|
-
if (
|
|
4010
|
-
fieldOverrides =
|
|
3993
|
+
if (request.method === "POST" && request.body) {
|
|
3994
|
+
if (request.query[PREVIEWER_APP_PARAM] === "module" && request.body.module_data) {
|
|
3995
|
+
fieldOverrides = request.body.module_data;
|
|
4011
3996
|
} else {
|
|
4012
|
-
fieldOverrides =
|
|
3997
|
+
fieldOverrides = request.body;
|
|
4013
3998
|
}
|
|
4014
3999
|
try {
|
|
4015
4000
|
if (typeof fieldOverrides === "string") {
|
|
@@ -4027,16 +4012,16 @@ async function modulePreviewRouteHandler(request2, response) {
|
|
|
4027
4012
|
fieldOverrides
|
|
4028
4013
|
);
|
|
4029
4014
|
}
|
|
4030
|
-
} else if (
|
|
4015
|
+
} else if (request.query.fields) {
|
|
4031
4016
|
try {
|
|
4032
|
-
if (typeof
|
|
4017
|
+
if (typeof request.query.fields === "string") {
|
|
4033
4018
|
fieldOverrides = JSON.parse(
|
|
4034
|
-
decodeURIComponent(
|
|
4019
|
+
decodeURIComponent(request.query.fields.replace(/\+/g, "%20"))
|
|
4035
4020
|
);
|
|
4036
4021
|
}
|
|
4037
4022
|
} catch (e) {
|
|
4038
4023
|
console.error(
|
|
4039
|
-
`Error parsing field param for module ${moduleName}: ${
|
|
4024
|
+
`Error parsing field param for module ${moduleName}: ${request.query.fields}`
|
|
4040
4025
|
);
|
|
4041
4026
|
}
|
|
4042
4027
|
}
|
|
@@ -4056,8 +4041,8 @@ async function modulePreviewRouteHandler(request2, response) {
|
|
|
4056
4041
|
jsRenderingGates,
|
|
4057
4042
|
projectName,
|
|
4058
4043
|
projectComponentPath,
|
|
4059
|
-
fullOriginalUrlFromRequest(
|
|
4060
|
-
|
|
4044
|
+
fullOriginalUrlFromRequest(request),
|
|
4045
|
+
request.get("COOKIE"),
|
|
4061
4046
|
fieldOverrides
|
|
4062
4047
|
);
|
|
4063
4048
|
const baseTemplatePath = packagePath(
|
|
@@ -4066,7 +4051,7 @@ async function modulePreviewRouteHandler(request2, response) {
|
|
|
4066
4051
|
);
|
|
4067
4052
|
const htmlShell = await createHtmlShellDependingOnRenderContext(
|
|
4068
4053
|
baseTemplatePath,
|
|
4069
|
-
|
|
4054
|
+
request.originalUrl,
|
|
4070
4055
|
`Module: ${modulePath}`,
|
|
4071
4056
|
renderContext,
|
|
4072
4057
|
viteServer,
|
|
@@ -4092,10 +4077,10 @@ var modulePreviewRouteHandler_default = modulePreviewRouteHandler;
|
|
|
4092
4077
|
|
|
4093
4078
|
// src/routes/hublModuleRouteHandler.ts
|
|
4094
4079
|
import { http as hsCliHttp9 } from "@hubspot/local-dev-lib/http";
|
|
4095
|
-
var hublModuleRouteHandler = async (
|
|
4080
|
+
var hublModuleRouteHandler = async (request, response) => {
|
|
4096
4081
|
sendTrackingRequest("view-hubl-module-route");
|
|
4097
|
-
const { authedPortalId, localPreviewToken } =
|
|
4098
|
-
const { modulePath } =
|
|
4082
|
+
const { authedPortalId, localPreviewToken } = request.app.locals;
|
|
4083
|
+
const { modulePath } = request.params;
|
|
4099
4084
|
if (!modulePath) {
|
|
4100
4085
|
response.status(200).set({ "Content-Type": "text/html" }).end(buildModuleIndex());
|
|
4101
4086
|
return;
|
|
@@ -4111,9 +4096,9 @@ var hublModuleRouteHandler = async (request2, response) => {
|
|
|
4111
4096
|
module_id: customWidgetInfo.moduleId,
|
|
4112
4097
|
hs_preview_key: customWidgetInfo.previewKey,
|
|
4113
4098
|
updated: Date.now(),
|
|
4114
|
-
...
|
|
4099
|
+
...request.query
|
|
4115
4100
|
};
|
|
4116
|
-
const previewUrl = new URL(getPreviewUrl(
|
|
4101
|
+
const previewUrl = new URL(getPreviewUrl(request, params));
|
|
4117
4102
|
try {
|
|
4118
4103
|
const result = (await hsCliHttp9.get(authedPortalId, {
|
|
4119
4104
|
baseURL: previewUrl.origin,
|
|
@@ -4145,7 +4130,7 @@ import { http as hsCliHttp10 } from "@hubspot/local-dev-lib/http";
|
|
|
4145
4130
|
import { buildStaticEnvConfig as buildStaticEnvConfig5 } from "@hubspot/cms-components";
|
|
4146
4131
|
import { getEnv as getEnv2 } from "@hubspot/local-dev-lib/config";
|
|
4147
4132
|
var HUBSPOT_PREVIEW_BASE_TAG_REGEX = /<base\s+[^>]*href=["'][^"']*(?:hubspotpreview(?:qa)?)[^"']*["'][^>]*>/i;
|
|
4148
|
-
var templateRouteHandler = async (
|
|
4133
|
+
var templateRouteHandler = async (request, response) => {
|
|
4149
4134
|
sendTrackingRequest("view-template-route");
|
|
4150
4135
|
const {
|
|
4151
4136
|
authedPortalId,
|
|
@@ -4155,7 +4140,7 @@ var templateRouteHandler = async (request2, response) => {
|
|
|
4155
4140
|
webRoot,
|
|
4156
4141
|
projectComponentPath,
|
|
4157
4142
|
jsRenderingGates
|
|
4158
|
-
} =
|
|
4143
|
+
} = request.app.locals;
|
|
4159
4144
|
const environmentConfig = buildStaticEnvConfig5(
|
|
4160
4145
|
authedPortalId,
|
|
4161
4146
|
"na1",
|
|
@@ -4163,7 +4148,7 @@ var templateRouteHandler = async (request2, response) => {
|
|
|
4163
4148
|
false,
|
|
4164
4149
|
jsRenderingGates
|
|
4165
4150
|
);
|
|
4166
|
-
const { templatePath } =
|
|
4151
|
+
const { templatePath } = request.params;
|
|
4167
4152
|
if (!templatePath) {
|
|
4168
4153
|
response.status(200).set({ "Content-Type": "text/html" }).end(buildTemplateIndex());
|
|
4169
4154
|
return;
|
|
@@ -4190,10 +4175,10 @@ var templateRouteHandler = async (request2, response) => {
|
|
|
4190
4175
|
localProxySchemaVersion: "2",
|
|
4191
4176
|
hsLoginVerifyDisabled: `${true}`,
|
|
4192
4177
|
hsCacheBuster: Date.now().toString(),
|
|
4193
|
-
...
|
|
4178
|
+
...request.query
|
|
4194
4179
|
};
|
|
4195
|
-
const previewUrl = new URL(getPreviewUrl(
|
|
4196
|
-
const fullOriginalUrl = `${
|
|
4180
|
+
const previewUrl = new URL(getPreviewUrl(request, params));
|
|
4181
|
+
const fullOriginalUrl = `${request.protocol}://${request.get("host")}${request.originalUrl}`;
|
|
4197
4182
|
try {
|
|
4198
4183
|
const result = (await hsCliHttp10.get(authedPortalId, {
|
|
4199
4184
|
baseURL: previewUrl.origin,
|
|
@@ -4503,8 +4488,8 @@ var STORYBOOK_DOMAINS = VALID_PROXY_DOMAIN_SUFFIXES.map(
|
|
|
4503
4488
|
var createDevServerRoutes = async (viteServer, appLocals, storybookPort) => {
|
|
4504
4489
|
const devServerApp = Router2();
|
|
4505
4490
|
const { appViteServer, appWebRoot } = appLocals || {};
|
|
4506
|
-
devServerApp.use((
|
|
4507
|
-
const { method, url: url3, hostname } =
|
|
4491
|
+
devServerApp.use((request, response, next) => {
|
|
4492
|
+
const { method, url: url3, hostname } = request;
|
|
4508
4493
|
debug(`${method}:${hostname}${url3}`);
|
|
4509
4494
|
next();
|
|
4510
4495
|
});
|
|
@@ -4569,8 +4554,8 @@ import { Router as Router3 } from "express";
|
|
|
4569
4554
|
import { getAccountId as getAccountId3 } from "@hubspot/local-dev-lib/config";
|
|
4570
4555
|
import cors from "cors";
|
|
4571
4556
|
function getShadowDevServerCheckHandler(devServerPort, themePath) {
|
|
4572
|
-
return async function shadowDevServerCheckHandler(
|
|
4573
|
-
const { query } =
|
|
4557
|
+
return async function shadowDevServerCheckHandler(request, response) {
|
|
4558
|
+
const { query } = request;
|
|
4574
4559
|
if (query) {
|
|
4575
4560
|
const {
|
|
4576
4561
|
hostName,
|
|
@@ -5458,12 +5443,9 @@ Local proxy functionality and module preview routes will not work without settin
|
|
|
5458
5443
|
if (authedPortalId) {
|
|
5459
5444
|
await validateHSPlatform(projectConfigPath, authedPortalId);
|
|
5460
5445
|
}
|
|
5461
|
-
const isUngatedForUnifiedThemePreview = jsRenderingGates.includes(
|
|
5462
|
-
"CMS:React:UnifiedThemePreview"
|
|
5463
|
-
);
|
|
5464
5446
|
let _localPreviewToken = null;
|
|
5465
5447
|
let _tokenStatus;
|
|
5466
|
-
if (themePreviewOptions
|
|
5448
|
+
if (themePreviewOptions) {
|
|
5467
5449
|
const { localPreviewToken, tokenStatus } = await initiatePreviewSession(
|
|
5468
5450
|
authedPortalId,
|
|
5469
5451
|
absoluteWebRoot,
|