@hubspot/cms-dev-server 1.2.44 → 1.2.47
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 +151 -48
- package/dist/internalSsr.js +9 -1
- package/dist/run.js +151 -48
- package/dist/storybook/index.js +1 -1
- package/dist/storybook-main/main.js +13 -5
- package/package.json +4 -3
- package/types/lib/fetchSignedModulePreview.d.ts +1 -0
- package/types/lib/previewUtils.d.ts +9 -0
|
@@ -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.47",
|
|
1646
1653
|
os: getPlatform()
|
|
1647
1654
|
};
|
|
1648
1655
|
const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
|
|
@@ -2405,11 +2412,81 @@ var buildHTMLResponse = (content) => {
|
|
|
2405
2412
|
`;
|
|
2406
2413
|
};
|
|
2407
2414
|
var insertAtEndOfBody = (html, script) => {
|
|
2408
|
-
const insertAt = (baseStr, index, insertStr) => {
|
|
2409
|
-
return `${baseStr.slice(0, index)}${insertStr}${baseStr.slice(index)}`;
|
|
2410
|
-
};
|
|
2411
2415
|
const endOfBodyIndex = html.lastIndexOf("</body>");
|
|
2412
|
-
|
|
2416
|
+
if (endOfBodyIndex === -1) {
|
|
2417
|
+
return html + script;
|
|
2418
|
+
}
|
|
2419
|
+
return html.slice(0, endOfBodyIndex) + script + html.slice(endOfBodyIndex);
|
|
2420
|
+
};
|
|
2421
|
+
var SAFE_URL_PARAM_RE = /^[a-zA-Z0-9@/\-_.]+$/;
|
|
2422
|
+
function escapeHtml(s) {
|
|
2423
|
+
return s.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
2424
|
+
}
|
|
2425
|
+
function isSafeUrlParam(value) {
|
|
2426
|
+
return typeof value === "string" && value.length > 0 && SAFE_URL_PARAM_RE.test(value);
|
|
2427
|
+
}
|
|
2428
|
+
function resolveDomain(isLocal, branch) {
|
|
2429
|
+
if (isLocal)
|
|
2430
|
+
return "local.hubspotqa.com";
|
|
2431
|
+
if (branch)
|
|
2432
|
+
return `b-${branch}.dynamic.hsappstatic.net`;
|
|
2433
|
+
return "static.hsappstatic.net";
|
|
2434
|
+
}
|
|
2435
|
+
function resolveProtocol(isLocal) {
|
|
2436
|
+
return isLocal ? "//" : "https://";
|
|
2437
|
+
}
|
|
2438
|
+
function resolveVersion(isLocal, version) {
|
|
2439
|
+
return isLocal ? "static" : version;
|
|
2440
|
+
}
|
|
2441
|
+
function buildStaticAssetUrl(pkg, filePath, isLocal, version, branch) {
|
|
2442
|
+
const protocol = resolveProtocol(isLocal);
|
|
2443
|
+
const resolvedVersion = resolveVersion(isLocal, version);
|
|
2444
|
+
const domain = resolveDomain(isLocal, branch);
|
|
2445
|
+
return `${protocol}${domain}/${pkg}/${resolvedVersion}/${filePath}`;
|
|
2446
|
+
}
|
|
2447
|
+
function normalizeToArray(value) {
|
|
2448
|
+
if (Array.isArray(value))
|
|
2449
|
+
return value;
|
|
2450
|
+
if (value)
|
|
2451
|
+
return [value];
|
|
2452
|
+
return [];
|
|
2453
|
+
}
|
|
2454
|
+
function parseCsvToScriptProperties(csv, branch) {
|
|
2455
|
+
const fields = csv.split(",");
|
|
2456
|
+
if (fields.length !== 4)
|
|
2457
|
+
return null;
|
|
2458
|
+
const [pkg, scriptPath, isLocalStr, version] = fields;
|
|
2459
|
+
return { pkg, scriptPath, version: version || null, isLocal: isLocalStr === "true", branch };
|
|
2460
|
+
}
|
|
2461
|
+
function buildValidatedScriptUrl(props) {
|
|
2462
|
+
const { pkg, scriptPath, version, isLocal, branch } = props;
|
|
2463
|
+
const hasSafePkg = isSafeUrlParam(pkg);
|
|
2464
|
+
const hasSafeScriptPath = isSafeUrlParam(scriptPath);
|
|
2465
|
+
const hasVersionOrIsLocal = isLocal || isSafeUrlParam(version);
|
|
2466
|
+
const hasSafeBranch = branch === null || isSafeUrlParam(branch);
|
|
2467
|
+
if (!hasSafePkg || !hasSafeScriptPath || !hasVersionOrIsLocal || !hasSafeBranch) {
|
|
2468
|
+
return null;
|
|
2469
|
+
}
|
|
2470
|
+
return buildStaticAssetUrl(pkg, scriptPath, isLocal, version, branch);
|
|
2471
|
+
}
|
|
2472
|
+
var addScriptInjectionBootstrapper = (html, query) => {
|
|
2473
|
+
const branchPreviewBuild = query.branchPreviewBuild || null;
|
|
2474
|
+
const topLevelProps = {
|
|
2475
|
+
pkg: query.benderPackage,
|
|
2476
|
+
scriptPath: query.scriptPath,
|
|
2477
|
+
version: query.staticVersion || null,
|
|
2478
|
+
isLocal: query.localAssets === "true",
|
|
2479
|
+
branch: branchPreviewBuild
|
|
2480
|
+
};
|
|
2481
|
+
const injectedProps = normalizeToArray(query.injectedScripts).map((csv) => parseCsvToScriptProperties(csv, branchPreviewBuild)).filter((props) => props !== null);
|
|
2482
|
+
const scriptUrls = [topLevelProps, ...injectedProps].map(buildValidatedScriptUrl).filter((url3) => url3 !== null);
|
|
2483
|
+
if (scriptUrls.length === 0) {
|
|
2484
|
+
return html;
|
|
2485
|
+
}
|
|
2486
|
+
const scriptTags = scriptUrls.map((url3) => `<script data-hs-injected-script src="${escapeHtml(url3)}"></script>`).join("\n ");
|
|
2487
|
+
return insertAtEndOfBody(html, `
|
|
2488
|
+
${scriptTags}
|
|
2489
|
+
`);
|
|
2413
2490
|
};
|
|
2414
2491
|
var addRefreshScript = (html) => {
|
|
2415
2492
|
const refreshScript = `
|
|
@@ -2920,8 +2997,35 @@ ${result}`;
|
|
|
2920
2997
|
|
|
2921
2998
|
// src/lib/renderModulePreview.ts
|
|
2922
2999
|
import { http as hsCliHttp7 } from "@hubspot/local-dev-lib/http";
|
|
3000
|
+
import { getConfigAccountIfExists as getConfigAccountIfExists4 } from "@hubspot/local-dev-lib/config";
|
|
3001
|
+
import { accessTokenForPersonalAccessKey as accessTokenForPersonalAccessKey2 } from "@hubspot/local-dev-lib/personalAccessKey";
|
|
3002
|
+
|
|
3003
|
+
// src/lib/fetchSignedModulePreview.ts
|
|
2923
3004
|
import { getConfigAccountIfExists as getConfigAccountIfExists3 } from "@hubspot/local-dev-lib/config";
|
|
2924
3005
|
import { accessTokenForPersonalAccessKey } from "@hubspot/local-dev-lib/personalAccessKey";
|
|
3006
|
+
async function fetchSignedModulePreview(signedUrl, authedEnv, cookieValue, postBody, authedPortalId) {
|
|
3007
|
+
const authHeaders = {};
|
|
3008
|
+
const accountConfig = getConfigAccountIfExists3(authedPortalId);
|
|
3009
|
+
if (accountConfig && accountConfig.authType === "personalaccesskey") {
|
|
3010
|
+
const accessToken = await accessTokenForPersonalAccessKey(authedPortalId);
|
|
3011
|
+
authHeaders["Authorization"] = `Bearer ${accessToken}`;
|
|
3012
|
+
}
|
|
3013
|
+
const response = await fetch(signedUrl, {
|
|
3014
|
+
method: "POST",
|
|
3015
|
+
headers: {
|
|
3016
|
+
"content-type": "application/x-www-form-urlencoded",
|
|
3017
|
+
Accept: "text/html",
|
|
3018
|
+
referer: `https://api.hubspot${authedEnv === "qa" ? "qa" : ""}.com`,
|
|
3019
|
+
cookie: cookieValue,
|
|
3020
|
+
"User-Agent": "HubSpot CMS Dev Server",
|
|
3021
|
+
...authHeaders
|
|
3022
|
+
},
|
|
3023
|
+
body: postBody
|
|
3024
|
+
});
|
|
3025
|
+
return response.text();
|
|
3026
|
+
}
|
|
3027
|
+
|
|
3028
|
+
// src/lib/renderModulePreview.ts
|
|
2925
3029
|
import jsdom from "jsdom";
|
|
2926
3030
|
var URL_SIGNING_GATE = "PortalsAccessIdentity:DesignManager:UrlSigning";
|
|
2927
3031
|
async function signGetUrl(authedPortalId, unsignedUrl) {
|
|
@@ -2950,9 +3054,9 @@ async function signedGet(authedPortalId, unsignedUrl, headers, gates) {
|
|
|
2950
3054
|
}
|
|
2951
3055
|
const signedUrl = await signGetUrl(authedPortalId, unsignedUrl);
|
|
2952
3056
|
const authHeaders = {};
|
|
2953
|
-
const accountConfig =
|
|
3057
|
+
const accountConfig = getConfigAccountIfExists4(authedPortalId);
|
|
2954
3058
|
if (accountConfig && accountConfig.authType === "personalaccesskey") {
|
|
2955
|
-
const accessToken = await
|
|
3059
|
+
const accessToken = await accessTokenForPersonalAccessKey2(authedPortalId);
|
|
2956
3060
|
authHeaders["Authorization"] = `Bearer ${accessToken}`;
|
|
2957
3061
|
}
|
|
2958
3062
|
const response = await fetch(signedUrl, {
|
|
@@ -3118,25 +3222,13 @@ async function renderLocalProjectModulePreview(moduleName, authedPortalId, authe
|
|
|
3118
3222
|
const postBody = `module=${encodeURIComponent(JSON.stringify(localModule))}`;
|
|
3119
3223
|
let templatePreview;
|
|
3120
3224
|
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();
|
|
3225
|
+
templatePreview = await fetchSignedModulePreview(
|
|
3226
|
+
signedUrl,
|
|
3227
|
+
authedEnv,
|
|
3228
|
+
cookieValue,
|
|
3229
|
+
postBody,
|
|
3230
|
+
authedPortalId
|
|
3231
|
+
);
|
|
3140
3232
|
} catch (error) {
|
|
3141
3233
|
console.error("Preview request failed:", error);
|
|
3142
3234
|
throw error;
|
|
@@ -3495,13 +3587,16 @@ var moduleRouteHandler = async (request, response) => {
|
|
|
3495
3587
|
viteServer,
|
|
3496
3588
|
jsRenderingGates
|
|
3497
3589
|
);
|
|
3498
|
-
const html =
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3590
|
+
const html = addScriptInjectionBootstrapper(
|
|
3591
|
+
htmlShell.replace(
|
|
3592
|
+
"<!--headend-->",
|
|
3593
|
+
[
|
|
3594
|
+
cssNeeded,
|
|
3595
|
+
...inlineAssets.map((inlineAsset) => inlineAsset.html)
|
|
3596
|
+
].join("\n")
|
|
3597
|
+
).replace(`<!--ssr-outlet-->`, renderedHtml),
|
|
3598
|
+
request.query
|
|
3599
|
+
);
|
|
3505
3600
|
response.status(200).set({ "Content-Type": "text/html" }).end(html);
|
|
3506
3601
|
} catch (e) {
|
|
3507
3602
|
console.error(e);
|
|
@@ -3584,7 +3679,7 @@ var moduleFieldsJson_default = moduleFieldsJsonRouteHandler;
|
|
|
3584
3679
|
// src/proxyPage/fetchContentMetadata.ts
|
|
3585
3680
|
import http from "http";
|
|
3586
3681
|
import https from "https";
|
|
3587
|
-
import { getConfigAccountIfExists as
|
|
3682
|
+
import { getConfigAccountIfExists as getConfigAccountIfExists5 } from "@hubspot/local-dev-lib/config";
|
|
3588
3683
|
async function requestPage(url3, redirects = 0, originalUrl) {
|
|
3589
3684
|
if (redirects > 5) {
|
|
3590
3685
|
throw new Error(
|
|
@@ -3652,7 +3747,7 @@ async function fetchContentMetadata(url3, portalId) {
|
|
|
3652
3747
|
);
|
|
3653
3748
|
} else {
|
|
3654
3749
|
const portalIdFromResponse = parseInt(portalIdHeader, 10);
|
|
3655
|
-
const pageAccount = await
|
|
3750
|
+
const pageAccount = await getConfigAccountIfExists5(portalIdFromResponse);
|
|
3656
3751
|
if (!pageAccount) {
|
|
3657
3752
|
throw new Error(
|
|
3658
3753
|
`No CLI auth for portal ${portalIdFromResponse} found, please run \`hs auth\``
|
|
@@ -4053,7 +4148,8 @@ async function modulePreviewRouteHandler(request, response) {
|
|
|
4053
4148
|
viteServer,
|
|
4054
4149
|
jsRenderingGates,
|
|
4055
4150
|
projectName,
|
|
4056
|
-
projectComponentPath
|
|
4151
|
+
projectComponentPath,
|
|
4152
|
+
fullHeightPreview
|
|
4057
4153
|
} = request.app.locals;
|
|
4058
4154
|
const moduleName = request.params.moduleName;
|
|
4059
4155
|
const modulePath = normalizePath8(
|
|
@@ -4128,13 +4224,18 @@ async function modulePreviewRouteHandler(request, response) {
|
|
|
4128
4224
|
viteServer,
|
|
4129
4225
|
jsRenderingGates
|
|
4130
4226
|
);
|
|
4131
|
-
const
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4227
|
+
const fullHeightCss = fullHeightPreview ? `<style>html,body{height:100%;width:100%;margin:0}#root{height:100%;width:100%}</style>` : "";
|
|
4228
|
+
const html = addScriptInjectionBootstrapper(
|
|
4229
|
+
htmlShell.replace(
|
|
4230
|
+
"<!--headend-->",
|
|
4231
|
+
[
|
|
4232
|
+
fullHeightCss,
|
|
4233
|
+
cssNeeded,
|
|
4234
|
+
...inlineAssets.map((inlineAsset) => inlineAsset.html)
|
|
4235
|
+
].join("\n")
|
|
4236
|
+
).replace(`<!--ssr-outlet-->`, renderedHtml),
|
|
4237
|
+
request.query
|
|
4238
|
+
);
|
|
4138
4239
|
response.status(200).set({ "Content-Type": "text/html" }).end(html);
|
|
4139
4240
|
} catch (e) {
|
|
4140
4241
|
console.error(e);
|
|
@@ -4626,7 +4727,7 @@ import express from "express";
|
|
|
4626
4727
|
|
|
4627
4728
|
// src/shadowDevServer/createShadowDevServerRoutes.ts
|
|
4628
4729
|
import { Router as Router3 } from "express";
|
|
4629
|
-
import { getConfigAccountIfExists as
|
|
4730
|
+
import { getConfigAccountIfExists as getConfigAccountIfExists6 } from "@hubspot/local-dev-lib/config";
|
|
4630
4731
|
import cors2 from "cors";
|
|
4631
4732
|
function getShadowDevServerCheckHandler(devServerPort, themePath) {
|
|
4632
4733
|
return async function shadowDevServerCheckHandler(request, response) {
|
|
@@ -4643,7 +4744,7 @@ function getShadowDevServerCheckHandler(devServerPort, themePath) {
|
|
|
4643
4744
|
let isTemplateFromDevTheme = false;
|
|
4644
4745
|
let localProxyUrl;
|
|
4645
4746
|
try {
|
|
4646
|
-
account =
|
|
4747
|
+
account = getConfigAccountIfExists6(portalId);
|
|
4647
4748
|
if (!account) {
|
|
4648
4749
|
throw new Error();
|
|
4649
4750
|
}
|
|
@@ -5011,7 +5112,7 @@ function hasFlag(flag, argv = process2.argv) {
|
|
|
5011
5112
|
|
|
5012
5113
|
// src/createDevServer.ts
|
|
5013
5114
|
import {
|
|
5014
|
-
getConfigAccountIfExists as
|
|
5115
|
+
getConfigAccountIfExists as getConfigAccountIfExists7,
|
|
5015
5116
|
getConfigDefaultAccountIfExists,
|
|
5016
5117
|
validateConfig
|
|
5017
5118
|
} from "@hubspot/local-dev-lib/config";
|
|
@@ -5598,9 +5699,10 @@ async function createDevServer(webRoot, storybook, hubspotCliConfigPathOption, h
|
|
|
5598
5699
|
}
|
|
5599
5700
|
const cmsAssetConfig = getCMSAssetConfigIfExists(webRoot);
|
|
5600
5701
|
secretNamesFromConfig = getSecretNamesFromConfig(cmsAssetConfig);
|
|
5702
|
+
const fullHeightPreview = isFullHeightPreviewEnabled(cmsAssetConfig);
|
|
5601
5703
|
const { isValid } = validateConfig();
|
|
5602
5704
|
if (isValid) {
|
|
5603
|
-
const account = hubspotCliAccountNameOption ?
|
|
5705
|
+
const account = hubspotCliAccountNameOption ? getConfigAccountIfExists7(hubspotCliAccountNameOption) : getConfigDefaultAccountIfExists();
|
|
5604
5706
|
if (!account) {
|
|
5605
5707
|
console.error(
|
|
5606
5708
|
hubspotCliAccountNameOption ? `Couldn't find ${hubspotCliAccountNameOption} in your hubspot.config.yaml` : `No default account found. Run 'hs auth' first.`
|
|
@@ -5744,6 +5846,7 @@ Local proxy functionality and module preview routes will not work without settin
|
|
|
5744
5846
|
expressServer.locals.domainsToProxy = domainsToProxy;
|
|
5745
5847
|
expressServer.locals.localPreviewToken = _localPreviewToken;
|
|
5746
5848
|
expressServer.locals.sslEnabled = sslEnabledOption;
|
|
5849
|
+
expressServer.locals.fullHeightPreview = fullHeightPreview;
|
|
5747
5850
|
expressServer.use(bodyParser.json());
|
|
5748
5851
|
const __dirname = path17.dirname(url2.fileURLToPath(new URL(import.meta.url)));
|
|
5749
5852
|
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.47",
|
|
2253
2260
|
os: getPlatform()
|
|
2254
2261
|
};
|
|
2255
2262
|
const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
|
|
@@ -3012,11 +3019,81 @@ var buildHTMLResponse = (content) => {
|
|
|
3012
3019
|
`;
|
|
3013
3020
|
};
|
|
3014
3021
|
var insertAtEndOfBody = (html, script) => {
|
|
3015
|
-
const insertAt = (baseStr, index, insertStr) => {
|
|
3016
|
-
return `${baseStr.slice(0, index)}${insertStr}${baseStr.slice(index)}`;
|
|
3017
|
-
};
|
|
3018
3022
|
const endOfBodyIndex = html.lastIndexOf("</body>");
|
|
3019
|
-
|
|
3023
|
+
if (endOfBodyIndex === -1) {
|
|
3024
|
+
return html + script;
|
|
3025
|
+
}
|
|
3026
|
+
return html.slice(0, endOfBodyIndex) + script + html.slice(endOfBodyIndex);
|
|
3027
|
+
};
|
|
3028
|
+
var SAFE_URL_PARAM_RE = /^[a-zA-Z0-9@/\-_.]+$/;
|
|
3029
|
+
function escapeHtml(s) {
|
|
3030
|
+
return s.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
3031
|
+
}
|
|
3032
|
+
function isSafeUrlParam(value) {
|
|
3033
|
+
return typeof value === "string" && value.length > 0 && SAFE_URL_PARAM_RE.test(value);
|
|
3034
|
+
}
|
|
3035
|
+
function resolveDomain(isLocal, branch) {
|
|
3036
|
+
if (isLocal)
|
|
3037
|
+
return "local.hubspotqa.com";
|
|
3038
|
+
if (branch)
|
|
3039
|
+
return `b-${branch}.dynamic.hsappstatic.net`;
|
|
3040
|
+
return "static.hsappstatic.net";
|
|
3041
|
+
}
|
|
3042
|
+
function resolveProtocol(isLocal) {
|
|
3043
|
+
return isLocal ? "//" : "https://";
|
|
3044
|
+
}
|
|
3045
|
+
function resolveVersion(isLocal, version) {
|
|
3046
|
+
return isLocal ? "static" : version;
|
|
3047
|
+
}
|
|
3048
|
+
function buildStaticAssetUrl(pkg, filePath, isLocal, version, branch) {
|
|
3049
|
+
const protocol = resolveProtocol(isLocal);
|
|
3050
|
+
const resolvedVersion = resolveVersion(isLocal, version);
|
|
3051
|
+
const domain2 = resolveDomain(isLocal, branch);
|
|
3052
|
+
return `${protocol}${domain2}/${pkg}/${resolvedVersion}/${filePath}`;
|
|
3053
|
+
}
|
|
3054
|
+
function normalizeToArray(value) {
|
|
3055
|
+
if (Array.isArray(value))
|
|
3056
|
+
return value;
|
|
3057
|
+
if (value)
|
|
3058
|
+
return [value];
|
|
3059
|
+
return [];
|
|
3060
|
+
}
|
|
3061
|
+
function parseCsvToScriptProperties(csv, branch) {
|
|
3062
|
+
const fields = csv.split(",");
|
|
3063
|
+
if (fields.length !== 4)
|
|
3064
|
+
return null;
|
|
3065
|
+
const [pkg, scriptPath, isLocalStr, version] = fields;
|
|
3066
|
+
return { pkg, scriptPath, version: version || null, isLocal: isLocalStr === "true", branch };
|
|
3067
|
+
}
|
|
3068
|
+
function buildValidatedScriptUrl(props) {
|
|
3069
|
+
const { pkg, scriptPath, version, isLocal, branch } = props;
|
|
3070
|
+
const hasSafePkg = isSafeUrlParam(pkg);
|
|
3071
|
+
const hasSafeScriptPath = isSafeUrlParam(scriptPath);
|
|
3072
|
+
const hasVersionOrIsLocal = isLocal || isSafeUrlParam(version);
|
|
3073
|
+
const hasSafeBranch = branch === null || isSafeUrlParam(branch);
|
|
3074
|
+
if (!hasSafePkg || !hasSafeScriptPath || !hasVersionOrIsLocal || !hasSafeBranch) {
|
|
3075
|
+
return null;
|
|
3076
|
+
}
|
|
3077
|
+
return buildStaticAssetUrl(pkg, scriptPath, isLocal, version, branch);
|
|
3078
|
+
}
|
|
3079
|
+
var addScriptInjectionBootstrapper = (html, query) => {
|
|
3080
|
+
const branchPreviewBuild = query.branchPreviewBuild || null;
|
|
3081
|
+
const topLevelProps = {
|
|
3082
|
+
pkg: query.benderPackage,
|
|
3083
|
+
scriptPath: query.scriptPath,
|
|
3084
|
+
version: query.staticVersion || null,
|
|
3085
|
+
isLocal: query.localAssets === "true",
|
|
3086
|
+
branch: branchPreviewBuild
|
|
3087
|
+
};
|
|
3088
|
+
const injectedProps = normalizeToArray(query.injectedScripts).map((csv) => parseCsvToScriptProperties(csv, branchPreviewBuild)).filter((props) => props !== null);
|
|
3089
|
+
const scriptUrls = [topLevelProps, ...injectedProps].map(buildValidatedScriptUrl).filter((url3) => url3 !== null);
|
|
3090
|
+
if (scriptUrls.length === 0) {
|
|
3091
|
+
return html;
|
|
3092
|
+
}
|
|
3093
|
+
const scriptTags = scriptUrls.map((url3) => `<script data-hs-injected-script src="${escapeHtml(url3)}"></script>`).join("\n ");
|
|
3094
|
+
return insertAtEndOfBody(html, `
|
|
3095
|
+
${scriptTags}
|
|
3096
|
+
`);
|
|
3020
3097
|
};
|
|
3021
3098
|
var addRefreshScript = (html) => {
|
|
3022
3099
|
const refreshScript = `
|
|
@@ -3527,8 +3604,35 @@ ${result}`;
|
|
|
3527
3604
|
|
|
3528
3605
|
// src/lib/renderModulePreview.ts
|
|
3529
3606
|
import { http as hsCliHttp7 } from "@hubspot/local-dev-lib/http";
|
|
3607
|
+
import { getConfigAccountIfExists as getConfigAccountIfExists5 } from "@hubspot/local-dev-lib/config";
|
|
3608
|
+
import { accessTokenForPersonalAccessKey as accessTokenForPersonalAccessKey2 } from "@hubspot/local-dev-lib/personalAccessKey";
|
|
3609
|
+
|
|
3610
|
+
// src/lib/fetchSignedModulePreview.ts
|
|
3530
3611
|
import { getConfigAccountIfExists as getConfigAccountIfExists4 } from "@hubspot/local-dev-lib/config";
|
|
3531
3612
|
import { accessTokenForPersonalAccessKey } from "@hubspot/local-dev-lib/personalAccessKey";
|
|
3613
|
+
async function fetchSignedModulePreview(signedUrl, authedEnv, cookieValue, postBody, authedPortalId) {
|
|
3614
|
+
const authHeaders = {};
|
|
3615
|
+
const accountConfig = getConfigAccountIfExists4(authedPortalId);
|
|
3616
|
+
if (accountConfig && accountConfig.authType === "personalaccesskey") {
|
|
3617
|
+
const accessToken = await accessTokenForPersonalAccessKey(authedPortalId);
|
|
3618
|
+
authHeaders["Authorization"] = `Bearer ${accessToken}`;
|
|
3619
|
+
}
|
|
3620
|
+
const response = await fetch(signedUrl, {
|
|
3621
|
+
method: "POST",
|
|
3622
|
+
headers: {
|
|
3623
|
+
"content-type": "application/x-www-form-urlencoded",
|
|
3624
|
+
Accept: "text/html",
|
|
3625
|
+
referer: `https://api.hubspot${authedEnv === "qa" ? "qa" : ""}.com`,
|
|
3626
|
+
cookie: cookieValue,
|
|
3627
|
+
"User-Agent": "HubSpot CMS Dev Server",
|
|
3628
|
+
...authHeaders
|
|
3629
|
+
},
|
|
3630
|
+
body: postBody
|
|
3631
|
+
});
|
|
3632
|
+
return response.text();
|
|
3633
|
+
}
|
|
3634
|
+
|
|
3635
|
+
// src/lib/renderModulePreview.ts
|
|
3532
3636
|
import jsdom from "jsdom";
|
|
3533
3637
|
var URL_SIGNING_GATE = "PortalsAccessIdentity:DesignManager:UrlSigning";
|
|
3534
3638
|
async function signGetUrl(authedPortalId, unsignedUrl) {
|
|
@@ -3557,9 +3661,9 @@ async function signedGet(authedPortalId, unsignedUrl, headers, gates) {
|
|
|
3557
3661
|
}
|
|
3558
3662
|
const signedUrl = await signGetUrl(authedPortalId, unsignedUrl);
|
|
3559
3663
|
const authHeaders = {};
|
|
3560
|
-
const accountConfig =
|
|
3664
|
+
const accountConfig = getConfigAccountIfExists5(authedPortalId);
|
|
3561
3665
|
if (accountConfig && accountConfig.authType === "personalaccesskey") {
|
|
3562
|
-
const accessToken = await
|
|
3666
|
+
const accessToken = await accessTokenForPersonalAccessKey2(authedPortalId);
|
|
3563
3667
|
authHeaders["Authorization"] = `Bearer ${accessToken}`;
|
|
3564
3668
|
}
|
|
3565
3669
|
const response = await fetch(signedUrl, {
|
|
@@ -3725,25 +3829,13 @@ async function renderLocalProjectModulePreview(moduleName, authedPortalId, authe
|
|
|
3725
3829
|
const postBody = `module=${encodeURIComponent(JSON.stringify(localModule))}`;
|
|
3726
3830
|
let templatePreview;
|
|
3727
3831
|
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();
|
|
3832
|
+
templatePreview = await fetchSignedModulePreview(
|
|
3833
|
+
signedUrl,
|
|
3834
|
+
authedEnv,
|
|
3835
|
+
cookieValue,
|
|
3836
|
+
postBody,
|
|
3837
|
+
authedPortalId
|
|
3838
|
+
);
|
|
3747
3839
|
} catch (error) {
|
|
3748
3840
|
console.error("Preview request failed:", error);
|
|
3749
3841
|
throw error;
|
|
@@ -4102,13 +4194,16 @@ var moduleRouteHandler = async (request, response) => {
|
|
|
4102
4194
|
viteServer,
|
|
4103
4195
|
jsRenderingGates
|
|
4104
4196
|
);
|
|
4105
|
-
const html =
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4197
|
+
const html = addScriptInjectionBootstrapper(
|
|
4198
|
+
htmlShell.replace(
|
|
4199
|
+
"<!--headend-->",
|
|
4200
|
+
[
|
|
4201
|
+
cssNeeded,
|
|
4202
|
+
...inlineAssets.map((inlineAsset) => inlineAsset.html)
|
|
4203
|
+
].join("\n")
|
|
4204
|
+
).replace(`<!--ssr-outlet-->`, renderedHtml),
|
|
4205
|
+
request.query
|
|
4206
|
+
);
|
|
4112
4207
|
response.status(200).set({ "Content-Type": "text/html" }).end(html);
|
|
4113
4208
|
} catch (e) {
|
|
4114
4209
|
console.error(e);
|
|
@@ -4191,7 +4286,7 @@ var moduleFieldsJson_default = moduleFieldsJsonRouteHandler;
|
|
|
4191
4286
|
// src/proxyPage/fetchContentMetadata.ts
|
|
4192
4287
|
import http from "http";
|
|
4193
4288
|
import https from "https";
|
|
4194
|
-
import { getConfigAccountIfExists as
|
|
4289
|
+
import { getConfigAccountIfExists as getConfigAccountIfExists6 } from "@hubspot/local-dev-lib/config";
|
|
4195
4290
|
async function requestPage(url3, redirects = 0, originalUrl) {
|
|
4196
4291
|
if (redirects > 5) {
|
|
4197
4292
|
throw new Error(
|
|
@@ -4259,7 +4354,7 @@ async function fetchContentMetadata(url3, portalId) {
|
|
|
4259
4354
|
);
|
|
4260
4355
|
} else {
|
|
4261
4356
|
const portalIdFromResponse = parseInt(portalIdHeader, 10);
|
|
4262
|
-
const pageAccount = await
|
|
4357
|
+
const pageAccount = await getConfigAccountIfExists6(portalIdFromResponse);
|
|
4263
4358
|
if (!pageAccount) {
|
|
4264
4359
|
throw new Error(
|
|
4265
4360
|
`No CLI auth for portal ${portalIdFromResponse} found, please run \`hs auth\``
|
|
@@ -4660,7 +4755,8 @@ async function modulePreviewRouteHandler(request, response) {
|
|
|
4660
4755
|
viteServer,
|
|
4661
4756
|
jsRenderingGates,
|
|
4662
4757
|
projectName,
|
|
4663
|
-
projectComponentPath
|
|
4758
|
+
projectComponentPath,
|
|
4759
|
+
fullHeightPreview
|
|
4664
4760
|
} = request.app.locals;
|
|
4665
4761
|
const moduleName = request.params.moduleName;
|
|
4666
4762
|
const modulePath = normalizePath8(
|
|
@@ -4735,13 +4831,18 @@ async function modulePreviewRouteHandler(request, response) {
|
|
|
4735
4831
|
viteServer,
|
|
4736
4832
|
jsRenderingGates
|
|
4737
4833
|
);
|
|
4738
|
-
const
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4834
|
+
const fullHeightCss = fullHeightPreview ? `<style>html,body{height:100%;width:100%;margin:0}#root{height:100%;width:100%}</style>` : "";
|
|
4835
|
+
const html = addScriptInjectionBootstrapper(
|
|
4836
|
+
htmlShell.replace(
|
|
4837
|
+
"<!--headend-->",
|
|
4838
|
+
[
|
|
4839
|
+
fullHeightCss,
|
|
4840
|
+
cssNeeded,
|
|
4841
|
+
...inlineAssets.map((inlineAsset) => inlineAsset.html)
|
|
4842
|
+
].join("\n")
|
|
4843
|
+
).replace(`<!--ssr-outlet-->`, renderedHtml),
|
|
4844
|
+
request.query
|
|
4845
|
+
);
|
|
4745
4846
|
response.status(200).set({ "Content-Type": "text/html" }).end(html);
|
|
4746
4847
|
} catch (e) {
|
|
4747
4848
|
console.error(e);
|
|
@@ -5450,7 +5551,7 @@ import express from "express";
|
|
|
5450
5551
|
|
|
5451
5552
|
// src/shadowDevServer/createShadowDevServerRoutes.ts
|
|
5452
5553
|
import { Router as Router3 } from "express";
|
|
5453
|
-
import { getConfigAccountIfExists as
|
|
5554
|
+
import { getConfigAccountIfExists as getConfigAccountIfExists7 } from "@hubspot/local-dev-lib/config";
|
|
5454
5555
|
import cors2 from "cors";
|
|
5455
5556
|
function getShadowDevServerCheckHandler(devServerPort, themePath) {
|
|
5456
5557
|
return async function shadowDevServerCheckHandler(request, response) {
|
|
@@ -5467,7 +5568,7 @@ function getShadowDevServerCheckHandler(devServerPort, themePath) {
|
|
|
5467
5568
|
let isTemplateFromDevTheme = false;
|
|
5468
5569
|
let localProxyUrl;
|
|
5469
5570
|
try {
|
|
5470
|
-
account =
|
|
5571
|
+
account = getConfigAccountIfExists7(portalId);
|
|
5471
5572
|
if (!account) {
|
|
5472
5573
|
throw new Error();
|
|
5473
5574
|
}
|
|
@@ -5680,7 +5781,7 @@ async function getJsRenderingGates(portalId, env2, personalAccessKey) {
|
|
|
5680
5781
|
|
|
5681
5782
|
// src/createDevServer.ts
|
|
5682
5783
|
import {
|
|
5683
|
-
getConfigAccountIfExists as
|
|
5784
|
+
getConfigAccountIfExists as getConfigAccountIfExists8,
|
|
5684
5785
|
getConfigDefaultAccountIfExists,
|
|
5685
5786
|
validateConfig
|
|
5686
5787
|
} from "@hubspot/local-dev-lib/config";
|
|
@@ -6267,9 +6368,10 @@ async function createDevServer(webRoot2, storybook2, hubspotCliConfigPathOption2
|
|
|
6267
6368
|
}
|
|
6268
6369
|
const cmsAssetConfig = getCMSAssetConfigIfExists(webRoot2);
|
|
6269
6370
|
secretNamesFromConfig = getSecretNamesFromConfig(cmsAssetConfig);
|
|
6371
|
+
const fullHeightPreview = isFullHeightPreviewEnabled(cmsAssetConfig);
|
|
6270
6372
|
const { isValid } = validateConfig();
|
|
6271
6373
|
if (isValid) {
|
|
6272
|
-
const account = hubspotCliAccountNameOption2 ?
|
|
6374
|
+
const account = hubspotCliAccountNameOption2 ? getConfigAccountIfExists8(hubspotCliAccountNameOption2) : getConfigDefaultAccountIfExists();
|
|
6273
6375
|
if (!account) {
|
|
6274
6376
|
console.error(
|
|
6275
6377
|
hubspotCliAccountNameOption2 ? `Couldn't find ${hubspotCliAccountNameOption2} in your hubspot.config.yaml` : `No default account found. Run 'hs auth' first.`
|
|
@@ -6413,6 +6515,7 @@ Local proxy functionality and module preview routes will not work without settin
|
|
|
6413
6515
|
expressServer.locals.domainsToProxy = domainsToProxy;
|
|
6414
6516
|
expressServer.locals.localPreviewToken = _localPreviewToken;
|
|
6415
6517
|
expressServer.locals.sslEnabled = sslEnabledOption2;
|
|
6518
|
+
expressServer.locals.fullHeightPreview = fullHeightPreview;
|
|
6416
6519
|
expressServer.use(bodyParser.json());
|
|
6417
6520
|
const __dirname = path18.dirname(url2.fileURLToPath(new URL(import.meta.url)));
|
|
6418
6521
|
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.47",
|
|
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.47",
|
|
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",
|
|
@@ -86,6 +86,7 @@
|
|
|
86
86
|
"copyfiles": "^2.4.1",
|
|
87
87
|
"esbuild": "^0.16.17",
|
|
88
88
|
"fs-extra": "^11.2.0",
|
|
89
|
+
"msw": "2.13.3",
|
|
89
90
|
"nodemon": "^2.0.15",
|
|
90
91
|
"postcss": "^8.4.47",
|
|
91
92
|
"publint": "^0.2.7",
|
|
@@ -133,5 +134,5 @@
|
|
|
133
134
|
"publishConfig": {
|
|
134
135
|
"access": "public"
|
|
135
136
|
},
|
|
136
|
-
"gitHead": "
|
|
137
|
+
"gitHead": "da7fa942c738e49e04bca8dd01b96691eb1c70a3"
|
|
137
138
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function fetchSignedModulePreview(signedUrl: string, authedEnv: string, cookieValue: string | undefined, postBody: string, authedPortalId: number): Promise<string>;
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
export declare const removePreviewPrefix: (t: string) => string;
|
|
2
2
|
export declare const getPreviewUrl: (request: any, queryParams: any) => string;
|
|
3
3
|
export declare const buildHTMLResponse: (content: any) => string;
|
|
4
|
+
/**
|
|
5
|
+
* HTML-encodes characters that could allow a URL to break out of an attribute value and inject
|
|
6
|
+
* markup into the response. Applied to every URL placed in a `src` attribute so that even if
|
|
7
|
+
* `isSafeUrlParam` validation is bypassed or a URL is constructed from a future code path that
|
|
8
|
+
* skips it, the injected script tag cannot introduce XSS.
|
|
9
|
+
*/
|
|
10
|
+
export declare function escapeHtml(s: string): string;
|
|
11
|
+
export declare function buildStaticAssetUrl(pkg: string, filePath: string, isLocal: boolean, version: string | null, branch: string | null): string;
|
|
12
|
+
export declare const addScriptInjectionBootstrapper: (html: string, query: Record<string, any>) => string;
|
|
4
13
|
export declare const addRefreshScript: (html: string) => string;
|
|
5
14
|
export declare function buildDevFileHashTable(src: string, dest: string, filePaths: string[]): {};
|
|
6
15
|
export declare type ThemePreviewOptions = {
|