@hubspot/cms-dev-server 1.2.44 → 1.2.46
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/generateJsonFromJsx.js +1 -1
- package/dist/index.js +57 -30
- package/dist/internalSsr.js +9 -1
- package/dist/run.js +57 -30
- package/dist/storybook/index.js +1 -1
- package/dist/storybook-main/main.js +13 -5
- package/package.json +3 -3
- package/types/lib/fetchSignedModulePreview.d.ts +1 -0
- package/types/routes/meta.d.ts +2 -0
- package/dist/.DS_Store +0 -0
- 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
|
@@ -10,7 +10,7 @@ import { createServer as createViteServer } from "vite";
|
|
|
10
10
|
import { createRequire } from "module";
|
|
11
11
|
import { default as react } from "@vitejs/plugin-react";
|
|
12
12
|
|
|
13
|
-
// ../cms-js-internal/dist/types-
|
|
13
|
+
// ../cms-js-internal/dist/types-CBGC9bBc.js
|
|
14
14
|
import path from "path";
|
|
15
15
|
var viteRoot;
|
|
16
16
|
var viteCommand;
|
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-CBGC9bBc.js
|
|
7
7
|
import path from "path";
|
|
8
8
|
import { createHash } from "crypto";
|
|
9
9
|
import fs, { readFileSync, existsSync, readdirSync, lstatSync } from "fs";
|
|
@@ -247,6 +247,13 @@ function getCMSAssetConfigIfExists(webRoot) {
|
|
|
247
247
|
return {};
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
|
+
function isFullHeightPreviewEnabled(config) {
|
|
251
|
+
var _a;
|
|
252
|
+
if ("devServer" in config) {
|
|
253
|
+
return ((_a = config.devServer) == null ? void 0 : _a.fullHeightPreview) ?? false;
|
|
254
|
+
}
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
250
257
|
var ENABLED_FEATURES_GATE_MAP = {
|
|
251
258
|
"cms:jsr:getServerSideProps": "CMS:JSRenderer:GetServerSideProps",
|
|
252
259
|
"cms:jsr:analyzeCmsModules": "CMS:JSRenderer:AnalyzeCmsModules",
|
|
@@ -1642,7 +1649,7 @@ function trackUsage(action) {
|
|
|
1642
1649
|
eventName: EVENT_NAME,
|
|
1643
1650
|
action,
|
|
1644
1651
|
nodeVersion: getNodeVersionData(),
|
|
1645
|
-
version: "1.2.
|
|
1652
|
+
version: "1.2.46",
|
|
1646
1653
|
os: getPlatform()
|
|
1647
1654
|
};
|
|
1648
1655
|
const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
|
|
@@ -2920,8 +2927,35 @@ ${result}`;
|
|
|
2920
2927
|
|
|
2921
2928
|
// src/lib/renderModulePreview.ts
|
|
2922
2929
|
import { http as hsCliHttp7 } from "@hubspot/local-dev-lib/http";
|
|
2930
|
+
import { getConfigAccountIfExists as getConfigAccountIfExists4 } from "@hubspot/local-dev-lib/config";
|
|
2931
|
+
import { accessTokenForPersonalAccessKey as accessTokenForPersonalAccessKey2 } from "@hubspot/local-dev-lib/personalAccessKey";
|
|
2932
|
+
|
|
2933
|
+
// src/lib/fetchSignedModulePreview.ts
|
|
2923
2934
|
import { getConfigAccountIfExists as getConfigAccountIfExists3 } from "@hubspot/local-dev-lib/config";
|
|
2924
2935
|
import { accessTokenForPersonalAccessKey } from "@hubspot/local-dev-lib/personalAccessKey";
|
|
2936
|
+
async function fetchSignedModulePreview(signedUrl, authedEnv, cookieValue, postBody, authedPortalId) {
|
|
2937
|
+
const authHeaders = {};
|
|
2938
|
+
const accountConfig = getConfigAccountIfExists3(authedPortalId);
|
|
2939
|
+
if (accountConfig && accountConfig.authType === "personalaccesskey") {
|
|
2940
|
+
const accessToken = await accessTokenForPersonalAccessKey(authedPortalId);
|
|
2941
|
+
authHeaders["Authorization"] = `Bearer ${accessToken}`;
|
|
2942
|
+
}
|
|
2943
|
+
const response = await fetch(signedUrl, {
|
|
2944
|
+
method: "POST",
|
|
2945
|
+
headers: {
|
|
2946
|
+
"content-type": "application/x-www-form-urlencoded",
|
|
2947
|
+
Accept: "text/html",
|
|
2948
|
+
referer: `https://api.hubspot${authedEnv === "qa" ? "qa" : ""}.com`,
|
|
2949
|
+
cookie: cookieValue,
|
|
2950
|
+
"User-Agent": "HubSpot CMS Dev Server",
|
|
2951
|
+
...authHeaders
|
|
2952
|
+
},
|
|
2953
|
+
body: postBody
|
|
2954
|
+
});
|
|
2955
|
+
return response.text();
|
|
2956
|
+
}
|
|
2957
|
+
|
|
2958
|
+
// src/lib/renderModulePreview.ts
|
|
2925
2959
|
import jsdom from "jsdom";
|
|
2926
2960
|
var URL_SIGNING_GATE = "PortalsAccessIdentity:DesignManager:UrlSigning";
|
|
2927
2961
|
async function signGetUrl(authedPortalId, unsignedUrl) {
|
|
@@ -2950,9 +2984,9 @@ async function signedGet(authedPortalId, unsignedUrl, headers, gates) {
|
|
|
2950
2984
|
}
|
|
2951
2985
|
const signedUrl = await signGetUrl(authedPortalId, unsignedUrl);
|
|
2952
2986
|
const authHeaders = {};
|
|
2953
|
-
const accountConfig =
|
|
2987
|
+
const accountConfig = getConfigAccountIfExists4(authedPortalId);
|
|
2954
2988
|
if (accountConfig && accountConfig.authType === "personalaccesskey") {
|
|
2955
|
-
const accessToken = await
|
|
2989
|
+
const accessToken = await accessTokenForPersonalAccessKey2(authedPortalId);
|
|
2956
2990
|
authHeaders["Authorization"] = `Bearer ${accessToken}`;
|
|
2957
2991
|
}
|
|
2958
2992
|
const response = await fetch(signedUrl, {
|
|
@@ -3118,25 +3152,13 @@ async function renderLocalProjectModulePreview(moduleName, authedPortalId, authe
|
|
|
3118
3152
|
const postBody = `module=${encodeURIComponent(JSON.stringify(localModule))}`;
|
|
3119
3153
|
let templatePreview;
|
|
3120
3154
|
try {
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
method: "POST",
|
|
3129
|
-
headers: {
|
|
3130
|
-
"content-type": "application/x-www-form-urlencoded",
|
|
3131
|
-
Accept: "text/html",
|
|
3132
|
-
referer: `https://api.hubspot${authedEnv === "qa" ? "qa" : ""}.com`,
|
|
3133
|
-
cookie: cookieValue,
|
|
3134
|
-
"User-Agent": "HubSpot CMS Dev Server",
|
|
3135
|
-
...authHeaders
|
|
3136
|
-
},
|
|
3137
|
-
body: postBody
|
|
3138
|
-
});
|
|
3139
|
-
templatePreview = await response.text();
|
|
3155
|
+
templatePreview = await fetchSignedModulePreview(
|
|
3156
|
+
signedUrl,
|
|
3157
|
+
authedEnv,
|
|
3158
|
+
cookieValue,
|
|
3159
|
+
postBody,
|
|
3160
|
+
authedPortalId
|
|
3161
|
+
);
|
|
3140
3162
|
} catch (error) {
|
|
3141
3163
|
console.error("Preview request failed:", error);
|
|
3142
3164
|
throw error;
|
|
@@ -3584,7 +3606,7 @@ var moduleFieldsJson_default = moduleFieldsJsonRouteHandler;
|
|
|
3584
3606
|
// src/proxyPage/fetchContentMetadata.ts
|
|
3585
3607
|
import http from "http";
|
|
3586
3608
|
import https from "https";
|
|
3587
|
-
import { getConfigAccountIfExists as
|
|
3609
|
+
import { getConfigAccountIfExists as getConfigAccountIfExists5 } from "@hubspot/local-dev-lib/config";
|
|
3588
3610
|
async function requestPage(url3, redirects = 0, originalUrl) {
|
|
3589
3611
|
if (redirects > 5) {
|
|
3590
3612
|
throw new Error(
|
|
@@ -3652,7 +3674,7 @@ async function fetchContentMetadata(url3, portalId) {
|
|
|
3652
3674
|
);
|
|
3653
3675
|
} else {
|
|
3654
3676
|
const portalIdFromResponse = parseInt(portalIdHeader, 10);
|
|
3655
|
-
const pageAccount = await
|
|
3677
|
+
const pageAccount = await getConfigAccountIfExists5(portalIdFromResponse);
|
|
3656
3678
|
if (!pageAccount) {
|
|
3657
3679
|
throw new Error(
|
|
3658
3680
|
`No CLI auth for portal ${portalIdFromResponse} found, please run \`hs auth\``
|
|
@@ -4053,7 +4075,8 @@ async function modulePreviewRouteHandler(request, response) {
|
|
|
4053
4075
|
viteServer,
|
|
4054
4076
|
jsRenderingGates,
|
|
4055
4077
|
projectName,
|
|
4056
|
-
projectComponentPath
|
|
4078
|
+
projectComponentPath,
|
|
4079
|
+
fullHeightPreview
|
|
4057
4080
|
} = request.app.locals;
|
|
4058
4081
|
const moduleName = request.params.moduleName;
|
|
4059
4082
|
const modulePath = normalizePath8(
|
|
@@ -4128,9 +4151,11 @@ async function modulePreviewRouteHandler(request, response) {
|
|
|
4128
4151
|
viteServer,
|
|
4129
4152
|
jsRenderingGates
|
|
4130
4153
|
);
|
|
4154
|
+
const fullHeightCss = fullHeightPreview ? `<style>html,body{height:100%;width:100%;margin:0}#root{height:100%;width:100%}</style>` : "";
|
|
4131
4155
|
const html = htmlShell.replace(
|
|
4132
4156
|
"<!--headend-->",
|
|
4133
4157
|
[
|
|
4158
|
+
fullHeightCss,
|
|
4134
4159
|
cssNeeded,
|
|
4135
4160
|
...inlineAssets.map((inlineAsset) => inlineAsset.html)
|
|
4136
4161
|
].join("\n")
|
|
@@ -4626,7 +4651,7 @@ import express from "express";
|
|
|
4626
4651
|
|
|
4627
4652
|
// src/shadowDevServer/createShadowDevServerRoutes.ts
|
|
4628
4653
|
import { Router as Router3 } from "express";
|
|
4629
|
-
import { getConfigAccountIfExists as
|
|
4654
|
+
import { getConfigAccountIfExists as getConfigAccountIfExists6 } from "@hubspot/local-dev-lib/config";
|
|
4630
4655
|
import cors2 from "cors";
|
|
4631
4656
|
function getShadowDevServerCheckHandler(devServerPort, themePath) {
|
|
4632
4657
|
return async function shadowDevServerCheckHandler(request, response) {
|
|
@@ -4643,7 +4668,7 @@ function getShadowDevServerCheckHandler(devServerPort, themePath) {
|
|
|
4643
4668
|
let isTemplateFromDevTheme = false;
|
|
4644
4669
|
let localProxyUrl;
|
|
4645
4670
|
try {
|
|
4646
|
-
account =
|
|
4671
|
+
account = getConfigAccountIfExists6(portalId);
|
|
4647
4672
|
if (!account) {
|
|
4648
4673
|
throw new Error();
|
|
4649
4674
|
}
|
|
@@ -5011,7 +5036,7 @@ function hasFlag(flag, argv = process2.argv) {
|
|
|
5011
5036
|
|
|
5012
5037
|
// src/createDevServer.ts
|
|
5013
5038
|
import {
|
|
5014
|
-
getConfigAccountIfExists as
|
|
5039
|
+
getConfigAccountIfExists as getConfigAccountIfExists7,
|
|
5015
5040
|
getConfigDefaultAccountIfExists,
|
|
5016
5041
|
validateConfig
|
|
5017
5042
|
} from "@hubspot/local-dev-lib/config";
|
|
@@ -5598,9 +5623,10 @@ async function createDevServer(webRoot, storybook, hubspotCliConfigPathOption, h
|
|
|
5598
5623
|
}
|
|
5599
5624
|
const cmsAssetConfig = getCMSAssetConfigIfExists(webRoot);
|
|
5600
5625
|
secretNamesFromConfig = getSecretNamesFromConfig(cmsAssetConfig);
|
|
5626
|
+
const fullHeightPreview = isFullHeightPreviewEnabled(cmsAssetConfig);
|
|
5601
5627
|
const { isValid } = validateConfig();
|
|
5602
5628
|
if (isValid) {
|
|
5603
|
-
const account = hubspotCliAccountNameOption ?
|
|
5629
|
+
const account = hubspotCliAccountNameOption ? getConfigAccountIfExists7(hubspotCliAccountNameOption) : getConfigDefaultAccountIfExists();
|
|
5604
5630
|
if (!account) {
|
|
5605
5631
|
console.error(
|
|
5606
5632
|
hubspotCliAccountNameOption ? `Couldn't find ${hubspotCliAccountNameOption} in your hubspot.config.yaml` : `No default account found. Run 'hs auth' first.`
|
|
@@ -5744,6 +5770,7 @@ Local proxy functionality and module preview routes will not work without settin
|
|
|
5744
5770
|
expressServer.locals.domainsToProxy = domainsToProxy;
|
|
5745
5771
|
expressServer.locals.localPreviewToken = _localPreviewToken;
|
|
5746
5772
|
expressServer.locals.sslEnabled = sslEnabledOption;
|
|
5773
|
+
expressServer.locals.fullHeightPreview = fullHeightPreview;
|
|
5747
5774
|
expressServer.use(bodyParser.json());
|
|
5748
5775
|
const __dirname = path17.dirname(url2.fileURLToPath(new URL(import.meta.url)));
|
|
5749
5776
|
let appWebRoot = normalizePath10(path17.resolve(__dirname, "../app"));
|
package/dist/internalSsr.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// ../cms-js-internal/dist/types-
|
|
1
|
+
// ../cms-js-internal/dist/types-CBGC9bBc.js
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { createHash } from "crypto";
|
|
4
4
|
import fs, { readFileSync, existsSync, readdirSync, lstatSync } from "fs";
|
|
@@ -366,6 +366,13 @@ function getServerIncludePrebundleDepPatterns(config) {
|
|
|
366
366
|
var _a, _b;
|
|
367
367
|
return ((_b = (_a = config.buildConfig) == null ? void 0 : _a.serverPrebundling) == null ? void 0 : _b.include) ?? [];
|
|
368
368
|
}
|
|
369
|
+
function isFullHeightPreviewEnabled(config) {
|
|
370
|
+
var _a;
|
|
371
|
+
if ("devServer" in config) {
|
|
372
|
+
return ((_a = config.devServer) == null ? void 0 : _a.fullHeightPreview) ?? false;
|
|
373
|
+
}
|
|
374
|
+
return false;
|
|
375
|
+
}
|
|
369
376
|
var BUILD_INFO_PATH = "/build-info.json";
|
|
370
377
|
function getBuildInfo(buildDir) {
|
|
371
378
|
try {
|
|
@@ -1289,6 +1296,7 @@ export {
|
|
|
1289
1296
|
getServerIncludePrebundleDepPatterns,
|
|
1290
1297
|
hasComponentExtension,
|
|
1291
1298
|
includesHublDataReference,
|
|
1299
|
+
isFullHeightPreviewEnabled,
|
|
1292
1300
|
isStorybookStory,
|
|
1293
1301
|
isStylesheetAsset,
|
|
1294
1302
|
isUngatedFor,
|
package/dist/run.js
CHANGED
|
@@ -896,7 +896,7 @@ function packagePath(metaUrl, projectPath) {
|
|
|
896
896
|
);
|
|
897
897
|
}
|
|
898
898
|
|
|
899
|
-
// ../cms-js-internal/dist/types-
|
|
899
|
+
// ../cms-js-internal/dist/types-CBGC9bBc.js
|
|
900
900
|
import path4 from "path";
|
|
901
901
|
import { createHash } from "crypto";
|
|
902
902
|
import fs3, { readFileSync, existsSync as existsSync2, readdirSync, lstatSync } from "fs";
|
|
@@ -1140,6 +1140,13 @@ function getCMSAssetConfigIfExists(webRoot2) {
|
|
|
1140
1140
|
return {};
|
|
1141
1141
|
}
|
|
1142
1142
|
}
|
|
1143
|
+
function isFullHeightPreviewEnabled(config) {
|
|
1144
|
+
var _a;
|
|
1145
|
+
if ("devServer" in config) {
|
|
1146
|
+
return ((_a = config.devServer) == null ? void 0 : _a.fullHeightPreview) ?? false;
|
|
1147
|
+
}
|
|
1148
|
+
return false;
|
|
1149
|
+
}
|
|
1143
1150
|
var ENABLED_FEATURES_GATE_MAP = {
|
|
1144
1151
|
"cms:jsr:getServerSideProps": "CMS:JSRenderer:GetServerSideProps",
|
|
1145
1152
|
"cms:jsr:analyzeCmsModules": "CMS:JSRenderer:AnalyzeCmsModules",
|
|
@@ -2249,7 +2256,7 @@ function trackUsage(action) {
|
|
|
2249
2256
|
eventName: EVENT_NAME,
|
|
2250
2257
|
action,
|
|
2251
2258
|
nodeVersion: getNodeVersionData(),
|
|
2252
|
-
version: "1.2.
|
|
2259
|
+
version: "1.2.46",
|
|
2253
2260
|
os: getPlatform()
|
|
2254
2261
|
};
|
|
2255
2262
|
const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
|
|
@@ -3527,8 +3534,35 @@ ${result}`;
|
|
|
3527
3534
|
|
|
3528
3535
|
// src/lib/renderModulePreview.ts
|
|
3529
3536
|
import { http as hsCliHttp7 } from "@hubspot/local-dev-lib/http";
|
|
3537
|
+
import { getConfigAccountIfExists as getConfigAccountIfExists5 } from "@hubspot/local-dev-lib/config";
|
|
3538
|
+
import { accessTokenForPersonalAccessKey as accessTokenForPersonalAccessKey2 } from "@hubspot/local-dev-lib/personalAccessKey";
|
|
3539
|
+
|
|
3540
|
+
// src/lib/fetchSignedModulePreview.ts
|
|
3530
3541
|
import { getConfigAccountIfExists as getConfigAccountIfExists4 } from "@hubspot/local-dev-lib/config";
|
|
3531
3542
|
import { accessTokenForPersonalAccessKey } from "@hubspot/local-dev-lib/personalAccessKey";
|
|
3543
|
+
async function fetchSignedModulePreview(signedUrl, authedEnv, cookieValue, postBody, authedPortalId) {
|
|
3544
|
+
const authHeaders = {};
|
|
3545
|
+
const accountConfig = getConfigAccountIfExists4(authedPortalId);
|
|
3546
|
+
if (accountConfig && accountConfig.authType === "personalaccesskey") {
|
|
3547
|
+
const accessToken = await accessTokenForPersonalAccessKey(authedPortalId);
|
|
3548
|
+
authHeaders["Authorization"] = `Bearer ${accessToken}`;
|
|
3549
|
+
}
|
|
3550
|
+
const response = await fetch(signedUrl, {
|
|
3551
|
+
method: "POST",
|
|
3552
|
+
headers: {
|
|
3553
|
+
"content-type": "application/x-www-form-urlencoded",
|
|
3554
|
+
Accept: "text/html",
|
|
3555
|
+
referer: `https://api.hubspot${authedEnv === "qa" ? "qa" : ""}.com`,
|
|
3556
|
+
cookie: cookieValue,
|
|
3557
|
+
"User-Agent": "HubSpot CMS Dev Server",
|
|
3558
|
+
...authHeaders
|
|
3559
|
+
},
|
|
3560
|
+
body: postBody
|
|
3561
|
+
});
|
|
3562
|
+
return response.text();
|
|
3563
|
+
}
|
|
3564
|
+
|
|
3565
|
+
// src/lib/renderModulePreview.ts
|
|
3532
3566
|
import jsdom from "jsdom";
|
|
3533
3567
|
var URL_SIGNING_GATE = "PortalsAccessIdentity:DesignManager:UrlSigning";
|
|
3534
3568
|
async function signGetUrl(authedPortalId, unsignedUrl) {
|
|
@@ -3557,9 +3591,9 @@ async function signedGet(authedPortalId, unsignedUrl, headers, gates) {
|
|
|
3557
3591
|
}
|
|
3558
3592
|
const signedUrl = await signGetUrl(authedPortalId, unsignedUrl);
|
|
3559
3593
|
const authHeaders = {};
|
|
3560
|
-
const accountConfig =
|
|
3594
|
+
const accountConfig = getConfigAccountIfExists5(authedPortalId);
|
|
3561
3595
|
if (accountConfig && accountConfig.authType === "personalaccesskey") {
|
|
3562
|
-
const accessToken = await
|
|
3596
|
+
const accessToken = await accessTokenForPersonalAccessKey2(authedPortalId);
|
|
3563
3597
|
authHeaders["Authorization"] = `Bearer ${accessToken}`;
|
|
3564
3598
|
}
|
|
3565
3599
|
const response = await fetch(signedUrl, {
|
|
@@ -3725,25 +3759,13 @@ async function renderLocalProjectModulePreview(moduleName, authedPortalId, authe
|
|
|
3725
3759
|
const postBody = `module=${encodeURIComponent(JSON.stringify(localModule))}`;
|
|
3726
3760
|
let templatePreview;
|
|
3727
3761
|
try {
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
method: "POST",
|
|
3736
|
-
headers: {
|
|
3737
|
-
"content-type": "application/x-www-form-urlencoded",
|
|
3738
|
-
Accept: "text/html",
|
|
3739
|
-
referer: `https://api.hubspot${authedEnv === "qa" ? "qa" : ""}.com`,
|
|
3740
|
-
cookie: cookieValue,
|
|
3741
|
-
"User-Agent": "HubSpot CMS Dev Server",
|
|
3742
|
-
...authHeaders
|
|
3743
|
-
},
|
|
3744
|
-
body: postBody
|
|
3745
|
-
});
|
|
3746
|
-
templatePreview = await response.text();
|
|
3762
|
+
templatePreview = await fetchSignedModulePreview(
|
|
3763
|
+
signedUrl,
|
|
3764
|
+
authedEnv,
|
|
3765
|
+
cookieValue,
|
|
3766
|
+
postBody,
|
|
3767
|
+
authedPortalId
|
|
3768
|
+
);
|
|
3747
3769
|
} catch (error) {
|
|
3748
3770
|
console.error("Preview request failed:", error);
|
|
3749
3771
|
throw error;
|
|
@@ -4191,7 +4213,7 @@ var moduleFieldsJson_default = moduleFieldsJsonRouteHandler;
|
|
|
4191
4213
|
// src/proxyPage/fetchContentMetadata.ts
|
|
4192
4214
|
import http from "http";
|
|
4193
4215
|
import https from "https";
|
|
4194
|
-
import { getConfigAccountIfExists as
|
|
4216
|
+
import { getConfigAccountIfExists as getConfigAccountIfExists6 } from "@hubspot/local-dev-lib/config";
|
|
4195
4217
|
async function requestPage(url3, redirects = 0, originalUrl) {
|
|
4196
4218
|
if (redirects > 5) {
|
|
4197
4219
|
throw new Error(
|
|
@@ -4259,7 +4281,7 @@ async function fetchContentMetadata(url3, portalId) {
|
|
|
4259
4281
|
);
|
|
4260
4282
|
} else {
|
|
4261
4283
|
const portalIdFromResponse = parseInt(portalIdHeader, 10);
|
|
4262
|
-
const pageAccount = await
|
|
4284
|
+
const pageAccount = await getConfigAccountIfExists6(portalIdFromResponse);
|
|
4263
4285
|
if (!pageAccount) {
|
|
4264
4286
|
throw new Error(
|
|
4265
4287
|
`No CLI auth for portal ${portalIdFromResponse} found, please run \`hs auth\``
|
|
@@ -4660,7 +4682,8 @@ async function modulePreviewRouteHandler(request, response) {
|
|
|
4660
4682
|
viteServer,
|
|
4661
4683
|
jsRenderingGates,
|
|
4662
4684
|
projectName,
|
|
4663
|
-
projectComponentPath
|
|
4685
|
+
projectComponentPath,
|
|
4686
|
+
fullHeightPreview
|
|
4664
4687
|
} = request.app.locals;
|
|
4665
4688
|
const moduleName = request.params.moduleName;
|
|
4666
4689
|
const modulePath = normalizePath8(
|
|
@@ -4735,9 +4758,11 @@ async function modulePreviewRouteHandler(request, response) {
|
|
|
4735
4758
|
viteServer,
|
|
4736
4759
|
jsRenderingGates
|
|
4737
4760
|
);
|
|
4761
|
+
const fullHeightCss = fullHeightPreview ? `<style>html,body{height:100%;width:100%;margin:0}#root{height:100%;width:100%}</style>` : "";
|
|
4738
4762
|
const html = htmlShell.replace(
|
|
4739
4763
|
"<!--headend-->",
|
|
4740
4764
|
[
|
|
4765
|
+
fullHeightCss,
|
|
4741
4766
|
cssNeeded,
|
|
4742
4767
|
...inlineAssets.map((inlineAsset) => inlineAsset.html)
|
|
4743
4768
|
].join("\n")
|
|
@@ -5450,7 +5475,7 @@ import express from "express";
|
|
|
5450
5475
|
|
|
5451
5476
|
// src/shadowDevServer/createShadowDevServerRoutes.ts
|
|
5452
5477
|
import { Router as Router3 } from "express";
|
|
5453
|
-
import { getConfigAccountIfExists as
|
|
5478
|
+
import { getConfigAccountIfExists as getConfigAccountIfExists7 } from "@hubspot/local-dev-lib/config";
|
|
5454
5479
|
import cors2 from "cors";
|
|
5455
5480
|
function getShadowDevServerCheckHandler(devServerPort, themePath) {
|
|
5456
5481
|
return async function shadowDevServerCheckHandler(request, response) {
|
|
@@ -5467,7 +5492,7 @@ function getShadowDevServerCheckHandler(devServerPort, themePath) {
|
|
|
5467
5492
|
let isTemplateFromDevTheme = false;
|
|
5468
5493
|
let localProxyUrl;
|
|
5469
5494
|
try {
|
|
5470
|
-
account =
|
|
5495
|
+
account = getConfigAccountIfExists7(portalId);
|
|
5471
5496
|
if (!account) {
|
|
5472
5497
|
throw new Error();
|
|
5473
5498
|
}
|
|
@@ -5680,7 +5705,7 @@ async function getJsRenderingGates(portalId, env2, personalAccessKey) {
|
|
|
5680
5705
|
|
|
5681
5706
|
// src/createDevServer.ts
|
|
5682
5707
|
import {
|
|
5683
|
-
getConfigAccountIfExists as
|
|
5708
|
+
getConfigAccountIfExists as getConfigAccountIfExists8,
|
|
5684
5709
|
getConfigDefaultAccountIfExists,
|
|
5685
5710
|
validateConfig
|
|
5686
5711
|
} from "@hubspot/local-dev-lib/config";
|
|
@@ -6267,9 +6292,10 @@ async function createDevServer(webRoot2, storybook2, hubspotCliConfigPathOption2
|
|
|
6267
6292
|
}
|
|
6268
6293
|
const cmsAssetConfig = getCMSAssetConfigIfExists(webRoot2);
|
|
6269
6294
|
secretNamesFromConfig = getSecretNamesFromConfig(cmsAssetConfig);
|
|
6295
|
+
const fullHeightPreview = isFullHeightPreviewEnabled(cmsAssetConfig);
|
|
6270
6296
|
const { isValid } = validateConfig();
|
|
6271
6297
|
if (isValid) {
|
|
6272
|
-
const account = hubspotCliAccountNameOption2 ?
|
|
6298
|
+
const account = hubspotCliAccountNameOption2 ? getConfigAccountIfExists8(hubspotCliAccountNameOption2) : getConfigDefaultAccountIfExists();
|
|
6273
6299
|
if (!account) {
|
|
6274
6300
|
console.error(
|
|
6275
6301
|
hubspotCliAccountNameOption2 ? `Couldn't find ${hubspotCliAccountNameOption2} in your hubspot.config.yaml` : `No default account found. Run 'hs auth' first.`
|
|
@@ -6413,6 +6439,7 @@ Local proxy functionality and module preview routes will not work without settin
|
|
|
6413
6439
|
expressServer.locals.domainsToProxy = domainsToProxy;
|
|
6414
6440
|
expressServer.locals.localPreviewToken = _localPreviewToken;
|
|
6415
6441
|
expressServer.locals.sslEnabled = sslEnabledOption2;
|
|
6442
|
+
expressServer.locals.fullHeightPreview = fullHeightPreview;
|
|
6416
6443
|
expressServer.use(bodyParser.json());
|
|
6417
6444
|
const __dirname = path18.dirname(url2.fileURLToPath(new URL(import.meta.url)));
|
|
6418
6445
|
let appWebRoot = normalizePath10(path18.resolve(__dirname, "../app"));
|
package/dist/storybook/index.js
CHANGED
|
@@ -8,7 +8,7 @@ var __export = (target, all) => {
|
|
|
8
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
// ../cms-js-internal/dist/types-
|
|
11
|
+
// ../cms-js-internal/dist/types-CBGC9bBc.js
|
|
12
12
|
import path from "path";
|
|
13
13
|
import { createHash } from "crypto";
|
|
14
14
|
import fs, { readFileSync, existsSync, readdirSync, lstatSync } from "fs";
|
|
@@ -260,6 +260,13 @@ function getServerIncludePrebundleDepPatterns(config) {
|
|
|
260
260
|
var _a, _b;
|
|
261
261
|
return ((_b = (_a = config.buildConfig) == null ? void 0 : _a.serverPrebundling) == null ? void 0 : _b.include) ?? [];
|
|
262
262
|
}
|
|
263
|
+
function isFullHeightPreviewEnabled(config) {
|
|
264
|
+
var _a;
|
|
265
|
+
if ("devServer" in config) {
|
|
266
|
+
return ((_a = config.devServer) == null ? void 0 : _a.fullHeightPreview) ?? false;
|
|
267
|
+
}
|
|
268
|
+
return false;
|
|
269
|
+
}
|
|
263
270
|
function getBuildInfo(buildDir) {
|
|
264
271
|
try {
|
|
265
272
|
const buildInfo = JSON.parse(
|
|
@@ -378,8 +385,8 @@ function isStylesheetAsset(staticAsset) {
|
|
|
378
385
|
return staticAsset.type === "stylesheet";
|
|
379
386
|
}
|
|
380
387
|
var COMPONENT_EXTENSIONS, ENTRY_POINTS_PATH, MODULE_FOLDER_PATH, TEMPLATE_FOLDER_PATH, VIRTUAL_ISLAND_RUNTIME, VIRTUAL_CONFIG_SETUP, CSS_LANGS_RE, collectCssModules, collectCssInDev, badInlineJsChars, inlineJsEscapeChars, viteRoot, viteCommand, clientRenderIsland, virtualClientRenderIslandModuleId, scriptTagToLogServerMessages, getComponentExtension, hasComponentExtension, isStorybookStory, removeComponentExtension, COMBINED_REACT_BASE_PATH, ISLAND_RUNTIME_CONFIG_BASE_PATH, removeIndexFromPath, removeIndexOrTrailingJsFromPath, HEALTHCHECKS_ENABLED_DEFAULT, HEALTHCHECKS_STRICT_DEFAULT, BUILD_INFO_PATH, GATES, ENABLED_FEATURES_GATE_MAP, findAllComponentsIn;
|
|
381
|
-
var
|
|
382
|
-
"../cms-js-internal/dist/types-
|
|
388
|
+
var init_types_CBGC9bBc = __esm({
|
|
389
|
+
"../cms-js-internal/dist/types-CBGC9bBc.js"() {
|
|
383
390
|
COMPONENT_EXTENSIONS = [".jsx", ".tsx", ".js", ".ts"];
|
|
384
391
|
ENTRY_POINTS_PATH = "components/partials/";
|
|
385
392
|
MODULE_FOLDER_PATH = "components/modules/";
|
|
@@ -584,6 +591,7 @@ __export(dist_exports, {
|
|
|
584
591
|
getServerIncludePrebundleDepPatterns: () => getServerIncludePrebundleDepPatterns,
|
|
585
592
|
hasComponentExtension: () => hasComponentExtension,
|
|
586
593
|
includesHublDataReference: () => includesHublDataReference,
|
|
594
|
+
isFullHeightPreviewEnabled: () => isFullHeightPreviewEnabled,
|
|
587
595
|
isStorybookStory: () => isStorybookStory,
|
|
588
596
|
isStylesheetAsset: () => isStylesheetAsset,
|
|
589
597
|
isUngatedFor: () => isUngatedFor,
|
|
@@ -1171,8 +1179,8 @@ function GlobalPartialSlot(props) {
|
|
|
1171
1179
|
var setProperty, getProperty, hasProperty, serializeIslandDataForInlineScript, writeSharedStateToJsGlobal, createIslandsGlobalJsForClientInDev, traverse, CMS_MODULE_COMPONENT_NAME, DND_AREA_COMPONENT_NAME, PLUGIN_NAME, promiseForNewWritableStream, renderStreamToPromise, createServerRenderContextV22, createServerRenderContext2, renderServerSidePropsWithAsyncLocalStoreContext, bootStrapRenderContext;
|
|
1172
1180
|
var init_dist = __esm({
|
|
1173
1181
|
"../cms-js-internal/dist/index.js"() {
|
|
1174
|
-
|
|
1175
|
-
|
|
1182
|
+
init_types_CBGC9bBc();
|
|
1183
|
+
init_types_CBGC9bBc();
|
|
1176
1184
|
({ setProperty, getProperty, hasProperty } = dotProp);
|
|
1177
1185
|
serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestData, baseIndent = 0, prettyPrint) => {
|
|
1178
1186
|
const islandsArrayToSerialize = tweakedIslandsArray.map(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cms-dev-server",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.46",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@babel/parser": "^7.25.3",
|
|
30
30
|
"@babel/traverse": "^7.25.3",
|
|
31
31
|
"@babel/types": "^7.25.2",
|
|
32
|
-
"@hubspot/cms-components": "^1.2.
|
|
32
|
+
"@hubspot/cms-components": "^1.2.46",
|
|
33
33
|
"@hubspot/local-dev-lib": "5.8.2",
|
|
34
34
|
"@inquirer/select": "^2.0.0",
|
|
35
35
|
"@originjs/vite-plugin-commonjs": "^1.0.3",
|
|
@@ -133,5 +133,5 @@
|
|
|
133
133
|
"publishConfig": {
|
|
134
134
|
"access": "public"
|
|
135
135
|
},
|
|
136
|
-
"gitHead": "
|
|
136
|
+
"gitHead": "5d1f0a93de7baa5df065f5bc35bbb7f40e4d9b4b"
|
|
137
137
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function fetchSignedModulePreview(signedUrl: string, authedEnv: string, cookieValue: string | undefined, postBody: string, authedPortalId: number): Promise<string>;
|
package/dist/.DS_Store
DELETED
|
Binary file
|
package/types/lib/debugAuth.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ViteDevServer } from 'vite';
|
|
2
|
-
/**
|
|
3
|
-
* Processes HTML to find remote assets and replace with Vite-managed URLs
|
|
4
|
-
*/
|
|
5
|
-
export declare function processRemoteAssets(html: string, viteServer: ViteDevServer): Promise<string>;
|
|
6
|
-
/**
|
|
7
|
-
* Vite plugin to handle remote assets
|
|
8
|
-
*/
|
|
9
|
-
export declare function remoteAssetsPlugin(): {
|
|
10
|
-
name: string;
|
|
11
|
-
apply: "serve";
|
|
12
|
-
configResolved(config: any): void;
|
|
13
|
-
resolveId(id: string): string;
|
|
14
|
-
load(id: string): Promise<string>;
|
|
15
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Request, Response, NextFunction } from 'express';
|
|
2
|
-
export declare function handleGetModulePages(req: Request, res: Response, next: NextFunction): Promise<Response<any, Record<string, any>>>;
|
|
3
|
-
export declare function handleOpenFile(req: Request, res: Response, next: NextFunction): Response<any, Record<string, any>>;
|
|
4
|
-
export declare function createAppServerRoutes(): import("express-serve-static-core").Router;
|
|
5
|
-
export default createAppServerRoutes;
|