@hubspot/cms-dev-server 1.2.53 → 1.2.62

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/.DS_Store ADDED
Binary file
@@ -0,0 +1,149 @@
1
+ /* Mirror of web-default-templates/src/styles/main.css */
2
+ /* Normalize */
3
+ /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
4
+
5
+ html {
6
+ -webkit-text-size-adjust: 100%;
7
+ }
8
+
9
+ body {
10
+ margin: 0;
11
+ }
12
+
13
+ sub,
14
+ sup {
15
+ font-size: 75%;
16
+ line-height: 0;
17
+ position: relative;
18
+ vertical-align: baseline;
19
+ }
20
+
21
+ sub {
22
+ bottom: -0.25em;
23
+ }
24
+
25
+ sup {
26
+ top: -0.5em;
27
+ }
28
+
29
+ /* CSS Variables */
30
+
31
+ :root {
32
+ --hs-heading-fontSizeMultiplier: 1;
33
+ }
34
+
35
+ @media (width < 768px) {
36
+ :root {
37
+ --hs-heading-fontSizeMultiplier: 0.8;
38
+ }
39
+ }
40
+
41
+ [data-hs-breakpoint-name="mobile"] {
42
+ --hs-heading-fontSizeMultiplier: 0.8;
43
+ }
44
+
45
+ /* Typography */
46
+
47
+ body {
48
+ font-family: var(--hs-paragraph-fontFamily);
49
+ font-size: var(--hs-paragraph-fontSize);
50
+ font-style: var(--hs-paragraph-fontStyle);
51
+ font-weight: var(--hs-paragraph-fontWeight);
52
+ line-height: var(--hs-paragraph-lineHeight);
53
+ overflow-wrap: break-word;
54
+ }
55
+
56
+ html[lang^='ja'] body,
57
+ html[lang^='zh'] body,
58
+ html[lang^='ko'] body {
59
+ line-break: strict;
60
+ overflow-wrap: normal;
61
+ word-break: break-all;
62
+ }
63
+
64
+ a:not([data-button-variant]) {
65
+ text-decoration: var(--hs-link-textDecoration);
66
+ }
67
+
68
+ a:not([data-button-variant]):hover,
69
+ a:not([data-button-variant]):focus-visible {
70
+ text-decoration: var(--hs-link-textDecoration-hover);
71
+ }
72
+
73
+ a:not([data-button-variant]):focus-visible {
74
+ outline: 2px solid Highlight;
75
+ outline-offset: 2px;
76
+ }
77
+
78
+ a:not(h1 a, h2 a, h3 a, h4 a, h5 a, h6 a, [data-button-variant]) {
79
+ font-weight: var(--hs-link-fontWeight);
80
+ font-style: var(--hs-link-fontStyle);
81
+ }
82
+
83
+ a:not(h1 a, h2 a, h3 a, h4 a, h5 a, h6 a, [data-button-variant]):hover,
84
+ a:not(h1 a, h2 a, h3 a, h4 a, h5 a, h6 a, [data-button-variant]):focus-visible {
85
+ font-weight: var(--hs-link-fontWeight-hover);
86
+ font-style: var(--hs-link-fontStyle-hover);
87
+ }
88
+
89
+ h1,
90
+ h2,
91
+ h3,
92
+ h4,
93
+ h5,
94
+ h6 {
95
+ font-family: var(--hs-headings-fontFamily);
96
+ letter-spacing: var(--hs-headings-letterSpacing);
97
+ line-height: var(--hs-headings-lineHeight);
98
+ text-transform: var(--hs-headings-textTransform);
99
+ }
100
+
101
+ h1 {
102
+ font-size: calc(var(--hs-heading1-fontSize) * var(--hs-heading-fontSizeMultiplier));
103
+ font-style: var(--hs-heading1-fontStyle);
104
+ font-weight: var(--hs-heading1-fontWeight);
105
+ }
106
+
107
+ h2 {
108
+ font-size: calc(var(--hs-heading2-fontSize) * var(--hs-heading-fontSizeMultiplier));
109
+ font-style: var(--hs-heading2-fontStyle);
110
+ font-weight: var(--hs-heading2-fontWeight);
111
+ }
112
+
113
+ h3 {
114
+ font-size: calc(var(--hs-heading3-fontSize) * var(--hs-heading-fontSizeMultiplier));
115
+ font-style: var(--hs-heading3-fontStyle);
116
+ font-weight: var(--hs-heading3-fontWeight);
117
+ }
118
+
119
+ h4 {
120
+ font-size: calc(var(--hs-heading4-fontSize) * var(--hs-heading-fontSizeMultiplier));
121
+ font-style: var(--hs-heading4-fontStyle);
122
+ font-weight: var(--hs-heading4-fontWeight);
123
+ }
124
+
125
+ h5 {
126
+ font-size: calc(var(--hs-heading5-fontSize) * var(--hs-heading-fontSizeMultiplier));
127
+ font-style: var(--hs-heading5-fontStyle);
128
+ font-weight: var(--hs-heading5-fontWeight);
129
+ }
130
+
131
+ h6 {
132
+ font-size: calc(var(--hs-heading6-fontSize) * var(--hs-heading-fontSizeMultiplier));
133
+ font-style: var(--hs-heading6-fontStyle);
134
+ font-weight: var(--hs-heading6-fontWeight);
135
+ }
136
+
137
+ blockquote {
138
+ font-family: var(--hs-blockquote-fontFamily);
139
+ font-size: var(--hs-blockquote-fontSize);
140
+ font-style: var(--hs-blockquote-fontStyle);
141
+ font-weight: var(--hs-blockquote-fontWeight);
142
+ line-height: var(--hs-blockquote-lineHeight);
143
+ }
144
+
145
+ /* Layout */
146
+
147
+ *, *::before, *::after {
148
+ box-sizing: border-box;
149
+ }
package/dist/index.js CHANGED
@@ -1230,7 +1230,7 @@ var createViteDevServer_default = createViteDevServer;
1230
1230
 
1231
1231
  // src/createDevServer.ts
1232
1232
  import path17 from "path";
1233
- import fs8 from "fs";
1233
+ import fs9 from "fs";
1234
1234
  import url2 from "url";
1235
1235
  import express2 from "express";
1236
1236
  import http3 from "http";
@@ -1651,7 +1651,7 @@ function trackUsage(action) {
1651
1651
  eventName: EVENT_NAME,
1652
1652
  action,
1653
1653
  nodeVersion: getNodeVersionData(),
1654
- version: "1.2.53",
1654
+ version: "1.2.62",
1655
1655
  os: getPlatform()
1656
1656
  };
1657
1657
  const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
@@ -1691,6 +1691,7 @@ function sendTrackingRequest(action) {
1691
1691
 
1692
1692
  // src/lib/renderModulePreview.ts
1693
1693
  import { buildStaticEnvConfig as buildStaticEnvConfig2 } from "@hubspot/cms-components";
1694
+ import fs3 from "fs";
1694
1695
  import path6 from "path";
1695
1696
  import { normalizePath as normalizePath4 } from "vite";
1696
1697
 
@@ -1936,10 +1937,6 @@ async function renderModule(viteServer, requestedModulePath, moduleProps, pageUr
1936
1937
  hublData,
1937
1938
  moduleName
1938
1939
  } = moduleProps;
1939
- const ungatedForServerSideProps = isUngatedFor(
1940
- environmentConfig.getGates(),
1941
- "CMS:JSRenderer:GetServerSideProps"
1942
- );
1943
1940
  const messagesForBrowser = [];
1944
1941
  let componentModule;
1945
1942
  let dataQueryResult;
@@ -2022,7 +2019,7 @@ async function renderModule(viteServer, requestedModulePath, moduleProps, pageUr
2022
2019
  hublData,
2023
2020
  moduleName
2024
2021
  });
2025
- if (ungatedForServerSideProps && componentModule.getServerSideProps) {
2022
+ if (componentModule.getServerSideProps) {
2026
2023
  if (!getModuleDataDependecyTypeFrom || !filterToModuleDataDepsIncludedIn) {
2027
2024
  throw new Error(
2028
2025
  `Need to upgrade to @hubspot/cms-components 0.15.x or higher to use getServerSideProps`
@@ -2399,9 +2396,8 @@ function isModuleFolderChild(filePath) {
2399
2396
  import path4 from "path";
2400
2397
  var removePreviewPrefix = (t2) => t2.split("/").slice(2).join("/");
2401
2398
  var getPreviewUrl = (request, queryParams) => {
2402
- const { authedPortalId, authedEnv, authedHublet, sslEnabled } = request.app.locals;
2403
- const protocol = sslEnabled ? "https" : "http";
2404
- return `${protocol}://${authedPortalId}.hubspotpreview${authedEnv === "qa" ? "qa" : ""}-${authedHublet}.com/_hcms/preview/template/multi?${stringify(queryParams)}`;
2399
+ const { authedPortalId, authedEnv, authedHublet } = request.app.locals;
2400
+ return `https://${authedPortalId}.hubspotpreview${authedEnv === "qa" ? "qa" : ""}-${authedHublet}.com/_hcms/preview/template/multi?${stringify(queryParams)}`;
2405
2401
  };
2406
2402
  var buildHTMLResponse = (content) => {
2407
2403
  return `
@@ -3027,8 +3023,61 @@ async function fetchSignedModulePreview(signedUrl, authedEnv, cookieValue, postB
3027
3023
  return response.text();
3028
3024
  }
3029
3025
 
3026
+ // src/lib/extractRelevantCss.ts
3027
+ import postcss from "postcss";
3028
+ function isRelevantSelector(selector) {
3029
+ return selector.split(",").some(
3030
+ (part) => part.trim() === ":root" || /\[data-\w+-variant=/.test(part)
3031
+ );
3032
+ }
3033
+ function filterNodes(container) {
3034
+ const kept = [];
3035
+ container.each((node) => {
3036
+ if (node.type === "rule" && isRelevantSelector(node.selector)) {
3037
+ kept.push(node.clone());
3038
+ } else if (node.type === "atrule") {
3039
+ const children = filterNodes(node);
3040
+ if (children.length > 0) {
3041
+ const cloned = node.clone({ nodes: [] });
3042
+ for (const child of children) {
3043
+ cloned.append(child);
3044
+ }
3045
+ kept.push(cloned);
3046
+ }
3047
+ }
3048
+ });
3049
+ return kept;
3050
+ }
3051
+ function extractRelevantCss(cssText) {
3052
+ if (!cssText.trim()) {
3053
+ return "";
3054
+ }
3055
+ let root;
3056
+ try {
3057
+ root = postcss.parse(cssText);
3058
+ } catch (e) {
3059
+ console.warn("Failed to parse CSS for filtering, using unfiltered CSS:", e);
3060
+ return cssText;
3061
+ }
3062
+ const result = postcss.root();
3063
+ for (const node of filterNodes(root)) {
3064
+ result.append(node);
3065
+ }
3066
+ const output = result.toString();
3067
+ return output;
3068
+ }
3069
+
3030
3070
  // src/lib/renderModulePreview.ts
3031
3071
  import jsdom from "jsdom";
3072
+ var _webDefaultStylesCss = null;
3073
+ function getWebDefaultStylesCss(metaUrl) {
3074
+ if (_webDefaultStylesCss === null) {
3075
+ const cssPath = packagePath(metaUrl, "css/webDefaultStyles.css");
3076
+ const css = fs3.readFileSync(cssPath, "utf-8");
3077
+ _webDefaultStylesCss = `<style data-hs-styles="web-defaults">${css}</style>`;
3078
+ }
3079
+ return _webDefaultStylesCss;
3080
+ }
3032
3081
  var URL_SIGNING_GATE = "PortalsAccessIdentity:DesignManager:UrlSigning";
3033
3082
  async function signGetUrl(authedPortalId, unsignedUrl) {
3034
3083
  const urlWithPortalId = new URL(unsignedUrl);
@@ -3055,15 +3104,23 @@ async function signedGet(authedPortalId, unsignedUrl, headers, gates) {
3055
3104
  return data;
3056
3105
  }
3057
3106
  const signedUrl = await signGetUrl(authedPortalId, unsignedUrl);
3058
- const authHeaders = {};
3059
3107
  const accountConfig = getConfigAccountIfExists4(authedPortalId);
3108
+ const authHeaders = {};
3060
3109
  if (accountConfig && accountConfig.authType === "personalaccesskey") {
3061
3110
  const accessToken = await accessTokenForPersonalAccessKey2(authedPortalId);
3062
3111
  authHeaders["Authorization"] = `Bearer ${accessToken}`;
3063
3112
  }
3113
+ const env2 = accountConfig == null ? void 0 : accountConfig.env;
3114
+ const referer = `https://api.hubspot${env2 === "qa" ? "qa" : ""}.com`;
3064
3115
  const response = await fetch(signedUrl, {
3065
3116
  method: "GET",
3066
- headers: { ...headers, ...authHeaders }
3117
+ headers: {
3118
+ ["Accept"]: "text/html",
3119
+ "User-Agent": "HubSpot CMS Dev Server",
3120
+ referer,
3121
+ ...headers,
3122
+ ...authHeaders
3123
+ }
3067
3124
  });
3068
3125
  if (!response.ok) {
3069
3126
  throw new Error(
@@ -3093,7 +3150,8 @@ async function renderRemoteModulePreview(modulePath, authedPortalId, authedEnv,
3093
3150
  hsLocalProxy: `${true}`,
3094
3151
  localProxySchemaVersion: "2",
3095
3152
  hsLoginVerifyDisabled: `${true}`,
3096
- module_id: moduleInfo.moduleId
3153
+ module_id: moduleInfo.moduleId,
3154
+ buffer_theme: `${true}`
3097
3155
  });
3098
3156
  const cosRenderingUrl = `https://api.hubspot${authedEnv === "qa" ? "qa" : ""}.com/api/cos-rendering/v1/public/_hcms/preview/template/multi?${queryParams}`;
3099
3157
  const previousHubApiDomainOverride = process.env.HUBAPI_DOMAIN_OVERRIDE;
@@ -3128,7 +3186,11 @@ async function renderRemoteModulePreview(modulePath, authedPortalId, authedEnv,
3128
3186
  const modulePreviewContent = dom.window.document.querySelector(
3129
3187
  'div[data-hs-cos-type="module"]'
3130
3188
  ).outerHTML;
3131
- const cssNeeded = Array.from(dom.window.document.querySelectorAll("style")).map((element) => element.outerHTML).join("");
3189
+ const allStyleContent = Array.from(
3190
+ dom.window.document.querySelectorAll("style")
3191
+ ).map((element) => element.textContent || "").join("\n");
3192
+ const filteredCss = extractRelevantCss(allStyleContent);
3193
+ const cssNeeded = filteredCss ? `<style>${filteredCss}</style>` : "";
3132
3194
  return { html: modulePreviewContent, cssNeeded };
3133
3195
  }
3134
3196
  async function signUrl(authedPortalId, unsignedUrl, requestBody) {
@@ -3213,7 +3275,9 @@ async function renderLocalProjectModulePreview(moduleName, authedPortalId, authe
3213
3275
  const queryParams = new URLSearchParams({
3214
3276
  hsLocalProxy: `${true}`,
3215
3277
  localProxySchemaVersion: "2",
3216
- portalId: `${authedPortalId}`
3278
+ portalId: `${authedPortalId}`,
3279
+ buffer_theme: `${true}`,
3280
+ ...meta.editor_version === "2.0" ? { editor_version: "2.0" } : {}
3217
3281
  });
3218
3282
  const currentHubApiDomainOverride = process.env.HUBAPI_DOMAIN_OVERRIDE;
3219
3283
  process.env.HUBAPI_DOMAIN_OVERRIDE = `api.hubspot`;
@@ -3249,7 +3313,15 @@ async function renderLocalProjectModulePreview(moduleName, authedPortalId, authe
3249
3313
  );
3250
3314
  }
3251
3315
  localRenderPlaceholders[0].json.props.fieldValues = localFieldValues;
3252
- return await renderComponentForPlaceholder(
3316
+ const previewDom = new JSDOM(templatePreview);
3317
+ const allStyleContent = Array.from(
3318
+ previewDom.window.document.querySelectorAll("head style")
3319
+ ).map((element) => element.textContent || "").join("\n");
3320
+ const filteredCss = extractRelevantCss(allStyleContent);
3321
+ const themeVariablesCss = filteredCss ? `<style data-hs-styles="theme-variables">${filteredCss}</style>` : "";
3322
+ const webDefaultStylesCss = meta.editor_version === "2.0" ? getWebDefaultStylesCss(import.meta.url) : "";
3323
+ const globalStylesCss = [themeVariablesCss, webDefaultStylesCss].filter(Boolean).join("\n");
3324
+ const renderResult = await renderComponentForPlaceholder(
3253
3325
  0,
3254
3326
  localRenderPlaceholders[0],
3255
3327
  webRoot,
@@ -3260,6 +3332,7 @@ async function renderLocalProjectModulePreview(moduleName, authedPortalId, authe
3260
3332
  projectName,
3261
3333
  projectComponentPath
3262
3334
  );
3335
+ return { ...renderResult, globalStylesCss };
3263
3336
  }
3264
3337
 
3265
3338
  // src/routes/partial.ts
@@ -4199,7 +4272,8 @@ async function modulePreviewRouteHandler(request, response) {
4199
4272
  html: renderedHtml,
4200
4273
  cssNeeded,
4201
4274
  renderContext,
4202
- inlineAssets
4275
+ inlineAssets,
4276
+ globalStylesCss
4203
4277
  } = await renderLocalProjectModulePreview(
4204
4278
  moduleName,
4205
4279
  authedPortalId,
@@ -4231,6 +4305,7 @@ async function modulePreviewRouteHandler(request, response) {
4231
4305
  htmlShell.replace(
4232
4306
  "<!--headend-->",
4233
4307
  [
4308
+ globalStylesCss,
4234
4309
  fullHeightCss,
4235
4310
  cssNeeded,
4236
4311
  ...inlineAssets.map((inlineAsset) => inlineAsset.html)
@@ -4452,7 +4527,7 @@ function createAppServerAPIRoutes() {
4452
4527
  var createAppServerAPIRoutes_default = createAppServerAPIRoutes;
4453
4528
 
4454
4529
  // src/routes/appServerRouteHandler.ts
4455
- import fs4 from "node:fs/promises";
4530
+ import fs5 from "node:fs/promises";
4456
4531
  import path12 from "path";
4457
4532
  import { pathToFileURL } from "url";
4458
4533
 
@@ -4470,7 +4545,7 @@ async function fetchProjectByName(accountId, projectName) {
4470
4545
  }
4471
4546
 
4472
4547
  // src/lib/getDevServerUIData.ts
4473
- import fs3 from "node:fs";
4548
+ import fs4 from "node:fs";
4474
4549
  var templateTypeMap = {
4475
4550
  // Standard templates
4476
4551
  4: "Page",
@@ -4542,9 +4617,9 @@ function normalizeTemplatesData(templates, projectName) {
4542
4617
  });
4543
4618
  }
4544
4619
  function detectPackageManager(projectRoot) {
4545
- if (fs3.existsSync(path11.join(projectRoot, "yarn.lock")))
4620
+ if (fs4.existsSync(path11.join(projectRoot, "yarn.lock")))
4546
4621
  return "yarn";
4547
- if (fs3.existsSync(path11.join(projectRoot, "pnpm-lock.yaml")))
4622
+ if (fs4.existsSync(path11.join(projectRoot, "pnpm-lock.yaml")))
4548
4623
  return "pnpm";
4549
4624
  return "npm";
4550
4625
  }
@@ -4631,7 +4706,7 @@ var appServerRouteHandler = async (req, res, __next) => {
4631
4706
  const templatePath = path12.join(appWebRoot, "index.html");
4632
4707
  const serverEntryPath = isProd ? path12.join(appWebRoot, "server/serverEntry.js") : path12.join(appWebRoot, "serverEntry.tsx");
4633
4708
  let render;
4634
- let template = await fs4.readFile(path12.join(templatePath), "utf-8");
4709
+ let template = await fs5.readFile(path12.join(templatePath), "utf-8");
4635
4710
  if (isProd) {
4636
4711
  const { render: ssrRender } = await import(pathToFileURL(serverEntryPath).href);
4637
4712
  render = ssrRender;
@@ -4959,14 +5034,14 @@ async function getJsRenderingGates(portalId, env2, personalAccessKey) {
4959
5034
 
4960
5035
  // src/lib/hsmetaUtils.ts
4961
5036
  import path14 from "path";
4962
- import fs5 from "fs";
5037
+ import fs6 from "fs";
4963
5038
  var HSMETA_FILENAMES = [
4964
5039
  "theme-hsmeta.json",
4965
5040
  "cms-assets-hsmeta.json"
4966
5041
  ];
4967
5042
  function getSubdirectories(dirPath) {
4968
5043
  try {
4969
- return fs5.readdirSync(dirPath, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
5044
+ return fs6.readdirSync(dirPath, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
4970
5045
  } catch {
4971
5046
  return [];
4972
5047
  }
@@ -4979,7 +5054,7 @@ function hsmetaCandidatePaths(srcPath) {
4979
5054
  }
4980
5055
  function tryParseUid(hsmetaPath) {
4981
5056
  try {
4982
- const hsmeta = JSON.parse(fs5.readFileSync(hsmetaPath, "utf8"));
5057
+ const hsmeta = JSON.parse(fs6.readFileSync(hsmetaPath, "utf8"));
4983
5058
  return hsmeta.uid ?? null;
4984
5059
  } catch (parseErr) {
4985
5060
  console.warn(`Could not parse ${hsmetaPath}:`, parseErr.message);
@@ -4989,7 +5064,7 @@ function tryParseUid(hsmetaPath) {
4989
5064
  function findHsmetaUid(projectDir, srcDir) {
4990
5065
  const srcPath = path14.join(projectDir, srcDir);
4991
5066
  for (const candidatePath of hsmetaCandidatePaths(srcPath)) {
4992
- if (!fs5.existsSync(candidatePath))
5067
+ if (!fs6.existsSync(candidatePath))
4993
5068
  continue;
4994
5069
  const uid = tryParseUid(candidatePath);
4995
5070
  if (uid)
@@ -5204,12 +5279,12 @@ async function fetchWebsiteDomainNames(portalId) {
5204
5279
 
5205
5280
  // src/lib/validateHSPlatform.ts
5206
5281
  import path15 from "path";
5207
- import fs6 from "fs";
5282
+ import fs7 from "fs";
5208
5283
  import select from "@inquirer/select";
5209
5284
  import { http as hsCliHttp11 } from "@hubspot/local-dev-lib/http";
5210
5285
  var HSPROJECT_JSON = "hsproject.json";
5211
5286
  function checkFileExists(filePath) {
5212
- return fs6.existsSync(filePath) && fs6.statSync(filePath).isFile();
5287
+ return fs7.existsSync(filePath) && fs7.statSync(filePath).isFile();
5213
5288
  }
5214
5289
  function findHSProjectJson(startPath) {
5215
5290
  let currentDir = startPath;
@@ -5235,7 +5310,7 @@ async function validateHSPlatform(projectConfigPath, portalId) {
5235
5310
  );
5236
5311
  return false;
5237
5312
  }
5238
- const hsProjectJSONContents = fs6.readFileSync(projectConfigPath, "utf8");
5313
+ const hsProjectJSONContents = fs7.readFileSync(projectConfigPath, "utf8");
5239
5314
  const hsProjectJSONData = JSON.parse(hsProjectJSONContents);
5240
5315
  const { platformVersion } = hsProjectJSONData;
5241
5316
  let platformVersionResult;
@@ -5263,7 +5338,7 @@ async function validateHSPlatform(projectConfigPath, portalId) {
5263
5338
  });
5264
5339
  hsProjectJSONData.platformVersion = answer;
5265
5340
  try {
5266
- fs6.writeFileSync(
5341
+ fs7.writeFileSync(
5267
5342
  projectConfigPath,
5268
5343
  JSON.stringify(hsProjectJSONData, void 0, 2),
5269
5344
  "utf8"
@@ -5525,7 +5600,7 @@ function writeFieldsType(fields, fileName, typeName) {
5525
5600
  }
5526
5601
 
5527
5602
  // src/lib/watchFieldsUpdates.ts
5528
- import fs7 from "fs";
5603
+ import fs8 from "fs";
5529
5604
  import path16 from "path";
5530
5605
  import readline from "readline";
5531
5606
  var lastSerializedFieldsCache = {};
@@ -5547,9 +5622,9 @@ var isInModulesFolder = (filePath, projectRoot) => {
5547
5622
  };
5548
5623
  };
5549
5624
  var fileContainsAutoGenComment = async (filePath) => {
5550
- if (!fs7.existsSync(filePath))
5625
+ if (!fs8.existsSync(filePath))
5551
5626
  return true;
5552
- const stream2 = fs7.createReadStream(filePath);
5627
+ const stream2 = fs8.createReadStream(filePath);
5553
5628
  const reader = readline.createInterface({ input: stream2 });
5554
5629
  const firstLine = await new Promise(
5555
5630
  (resolve2) => reader.once("line", (line) => resolve2(line.trim()))
@@ -5568,7 +5643,7 @@ var getIndexFile = (filePath, projectRoot) => {
5568
5643
  if (isRootModuleFile)
5569
5644
  return { indexFilePath: filePath, isRootModuleFile };
5570
5645
  const dir = path16.dirname(filePath);
5571
- const files = fs7.readdirSync(dir);
5646
+ const files = fs8.readdirSync(dir);
5572
5647
  const indexFileName = files.find((file) => file.startsWith("index."));
5573
5648
  return indexFileName ? { indexFilePath: path16.join(dir, indexFileName), isRootModuleFile } : void 0;
5574
5649
  };
@@ -5661,7 +5736,7 @@ function getWebRootProjectComponentFolder(absoluteWebRoot, projectConfigPath) {
5661
5736
  }
5662
5737
  try {
5663
5738
  const projectDir = path17.dirname(projectConfigPath);
5664
- const configContent = fs8.readFileSync(projectConfigPath, "utf8");
5739
+ const configContent = fs9.readFileSync(projectConfigPath, "utf8");
5665
5740
  const projectConfig = JSON.parse(configContent);
5666
5741
  if (hasNewDirectoryStructure(projectConfig.platformVersion)) {
5667
5742
  const srcDir = projectConfig.srcDir || "src";
@@ -5931,7 +6006,7 @@ HubSpot CMS dev server running at ${protocol}://hslocal.net:${PORT}${extraServer
5931
6006
  const sbPackagePath = await import.meta.resolve("storybook/package.json");
5932
6007
  const sbPackageDir = path17.dirname(url2.fileURLToPath(sbPackagePath));
5933
6008
  const packageJson = JSON.parse(
5934
- fs8.readFileSync(path17.join(sbPackageDir, "package.json"), "utf-8")
6009
+ fs9.readFileSync(path17.join(sbPackageDir, "package.json"), "utf-8")
5935
6010
  );
5936
6011
  storybookBin = path17.join(
5937
6012
  sbPackageDir,
package/dist/run.js CHANGED
@@ -843,7 +843,7 @@ async function buildThemePreviewOptions(webRoot2, isUsingLocalWorkspace = false)
843
843
 
844
844
  // src/createDevServer.ts
845
845
  import path18 from "path";
846
- import fs9 from "fs";
846
+ import fs10 from "fs";
847
847
  import url2 from "url";
848
848
  import express2 from "express";
849
849
  import http3 from "http";
@@ -2256,7 +2256,7 @@ function trackUsage(action) {
2256
2256
  eventName: EVENT_NAME,
2257
2257
  action,
2258
2258
  nodeVersion: getNodeVersionData(),
2259
- version: "1.2.53",
2259
+ version: "1.2.62",
2260
2260
  os: getPlatform()
2261
2261
  };
2262
2262
  const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
@@ -2296,6 +2296,7 @@ function sendTrackingRequest(action) {
2296
2296
 
2297
2297
  // src/lib/renderModulePreview.ts
2298
2298
  import { buildStaticEnvConfig as buildStaticEnvConfig2 } from "@hubspot/cms-components";
2299
+ import fs5 from "fs";
2299
2300
  import path8 from "path";
2300
2301
  import { normalizePath as normalizePath4 } from "vite";
2301
2302
 
@@ -2541,10 +2542,6 @@ async function renderModule(viteServer, requestedModulePath, moduleProps, pageUr
2541
2542
  hublData,
2542
2543
  moduleName
2543
2544
  } = moduleProps;
2544
- const ungatedForServerSideProps = isUngatedFor(
2545
- environmentConfig.getGates(),
2546
- "CMS:JSRenderer:GetServerSideProps"
2547
- );
2548
2545
  const messagesForBrowser = [];
2549
2546
  let componentModule;
2550
2547
  let dataQueryResult;
@@ -2627,7 +2624,7 @@ async function renderModule(viteServer, requestedModulePath, moduleProps, pageUr
2627
2624
  hublData,
2628
2625
  moduleName
2629
2626
  });
2630
- if (ungatedForServerSideProps && componentModule.getServerSideProps) {
2627
+ if (componentModule.getServerSideProps) {
2631
2628
  if (!getModuleDataDependecyTypeFrom || !filterToModuleDataDepsIncludedIn) {
2632
2629
  throw new Error(
2633
2630
  `Need to upgrade to @hubspot/cms-components 0.15.x or higher to use getServerSideProps`
@@ -3004,9 +3001,8 @@ function isModuleFolderChild(filePath) {
3004
3001
  import path6 from "path";
3005
3002
  var removePreviewPrefix = (t2) => t2.split("/").slice(2).join("/");
3006
3003
  var getPreviewUrl = (request, queryParams) => {
3007
- const { authedPortalId, authedEnv, authedHublet, sslEnabled } = request.app.locals;
3008
- const protocol = sslEnabled ? "https" : "http";
3009
- return `${protocol}://${authedPortalId}.hubspotpreview${authedEnv === "qa" ? "qa" : ""}-${authedHublet}.com/_hcms/preview/template/multi?${stringify(queryParams)}`;
3004
+ const { authedPortalId, authedEnv, authedHublet } = request.app.locals;
3005
+ return `https://${authedPortalId}.hubspotpreview${authedEnv === "qa" ? "qa" : ""}-${authedHublet}.com/_hcms/preview/template/multi?${stringify(queryParams)}`;
3010
3006
  };
3011
3007
  var buildHTMLResponse = (content) => {
3012
3008
  return `
@@ -3632,8 +3628,61 @@ async function fetchSignedModulePreview(signedUrl, authedEnv, cookieValue, postB
3632
3628
  return response.text();
3633
3629
  }
3634
3630
 
3631
+ // src/lib/extractRelevantCss.ts
3632
+ import postcss from "postcss";
3633
+ function isRelevantSelector(selector) {
3634
+ return selector.split(",").some(
3635
+ (part) => part.trim() === ":root" || /\[data-\w+-variant=/.test(part)
3636
+ );
3637
+ }
3638
+ function filterNodes(container) {
3639
+ const kept = [];
3640
+ container.each((node) => {
3641
+ if (node.type === "rule" && isRelevantSelector(node.selector)) {
3642
+ kept.push(node.clone());
3643
+ } else if (node.type === "atrule") {
3644
+ const children = filterNodes(node);
3645
+ if (children.length > 0) {
3646
+ const cloned = node.clone({ nodes: [] });
3647
+ for (const child of children) {
3648
+ cloned.append(child);
3649
+ }
3650
+ kept.push(cloned);
3651
+ }
3652
+ }
3653
+ });
3654
+ return kept;
3655
+ }
3656
+ function extractRelevantCss(cssText) {
3657
+ if (!cssText.trim()) {
3658
+ return "";
3659
+ }
3660
+ let root;
3661
+ try {
3662
+ root = postcss.parse(cssText);
3663
+ } catch (e) {
3664
+ console.warn("Failed to parse CSS for filtering, using unfiltered CSS:", e);
3665
+ return cssText;
3666
+ }
3667
+ const result = postcss.root();
3668
+ for (const node of filterNodes(root)) {
3669
+ result.append(node);
3670
+ }
3671
+ const output = result.toString();
3672
+ return output;
3673
+ }
3674
+
3635
3675
  // src/lib/renderModulePreview.ts
3636
3676
  import jsdom from "jsdom";
3677
+ var _webDefaultStylesCss = null;
3678
+ function getWebDefaultStylesCss(metaUrl) {
3679
+ if (_webDefaultStylesCss === null) {
3680
+ const cssPath = packagePath(metaUrl, "css/webDefaultStyles.css");
3681
+ const css = fs5.readFileSync(cssPath, "utf-8");
3682
+ _webDefaultStylesCss = `<style data-hs-styles="web-defaults">${css}</style>`;
3683
+ }
3684
+ return _webDefaultStylesCss;
3685
+ }
3637
3686
  var URL_SIGNING_GATE = "PortalsAccessIdentity:DesignManager:UrlSigning";
3638
3687
  async function signGetUrl(authedPortalId, unsignedUrl) {
3639
3688
  const urlWithPortalId = new URL(unsignedUrl);
@@ -3660,15 +3709,23 @@ async function signedGet(authedPortalId, unsignedUrl, headers, gates) {
3660
3709
  return data;
3661
3710
  }
3662
3711
  const signedUrl = await signGetUrl(authedPortalId, unsignedUrl);
3663
- const authHeaders = {};
3664
3712
  const accountConfig = getConfigAccountIfExists5(authedPortalId);
3713
+ const authHeaders = {};
3665
3714
  if (accountConfig && accountConfig.authType === "personalaccesskey") {
3666
3715
  const accessToken = await accessTokenForPersonalAccessKey2(authedPortalId);
3667
3716
  authHeaders["Authorization"] = `Bearer ${accessToken}`;
3668
3717
  }
3718
+ const env2 = accountConfig == null ? void 0 : accountConfig.env;
3719
+ const referer = `https://api.hubspot${env2 === "qa" ? "qa" : ""}.com`;
3669
3720
  const response = await fetch(signedUrl, {
3670
3721
  method: "GET",
3671
- headers: { ...headers, ...authHeaders }
3722
+ headers: {
3723
+ ["Accept"]: "text/html",
3724
+ "User-Agent": "HubSpot CMS Dev Server",
3725
+ referer,
3726
+ ...headers,
3727
+ ...authHeaders
3728
+ }
3672
3729
  });
3673
3730
  if (!response.ok) {
3674
3731
  throw new Error(
@@ -3698,7 +3755,8 @@ async function renderRemoteModulePreview(modulePath, authedPortalId, authedEnv,
3698
3755
  hsLocalProxy: `${true}`,
3699
3756
  localProxySchemaVersion: "2",
3700
3757
  hsLoginVerifyDisabled: `${true}`,
3701
- module_id: moduleInfo.moduleId
3758
+ module_id: moduleInfo.moduleId,
3759
+ buffer_theme: `${true}`
3702
3760
  });
3703
3761
  const cosRenderingUrl = `https://api.hubspot${authedEnv === "qa" ? "qa" : ""}.com/api/cos-rendering/v1/public/_hcms/preview/template/multi?${queryParams}`;
3704
3762
  const previousHubApiDomainOverride = process.env.HUBAPI_DOMAIN_OVERRIDE;
@@ -3733,7 +3791,11 @@ async function renderRemoteModulePreview(modulePath, authedPortalId, authedEnv,
3733
3791
  const modulePreviewContent = dom.window.document.querySelector(
3734
3792
  'div[data-hs-cos-type="module"]'
3735
3793
  ).outerHTML;
3736
- const cssNeeded = Array.from(dom.window.document.querySelectorAll("style")).map((element) => element.outerHTML).join("");
3794
+ const allStyleContent = Array.from(
3795
+ dom.window.document.querySelectorAll("style")
3796
+ ).map((element) => element.textContent || "").join("\n");
3797
+ const filteredCss = extractRelevantCss(allStyleContent);
3798
+ const cssNeeded = filteredCss ? `<style>${filteredCss}</style>` : "";
3737
3799
  return { html: modulePreviewContent, cssNeeded };
3738
3800
  }
3739
3801
  async function signUrl(authedPortalId, unsignedUrl, requestBody) {
@@ -3818,7 +3880,9 @@ async function renderLocalProjectModulePreview(moduleName, authedPortalId, authe
3818
3880
  const queryParams = new URLSearchParams({
3819
3881
  hsLocalProxy: `${true}`,
3820
3882
  localProxySchemaVersion: "2",
3821
- portalId: `${authedPortalId}`
3883
+ portalId: `${authedPortalId}`,
3884
+ buffer_theme: `${true}`,
3885
+ ...meta.editor_version === "2.0" ? { editor_version: "2.0" } : {}
3822
3886
  });
3823
3887
  const currentHubApiDomainOverride = process.env.HUBAPI_DOMAIN_OVERRIDE;
3824
3888
  process.env.HUBAPI_DOMAIN_OVERRIDE = `api.hubspot`;
@@ -3854,7 +3918,15 @@ async function renderLocalProjectModulePreview(moduleName, authedPortalId, authe
3854
3918
  );
3855
3919
  }
3856
3920
  localRenderPlaceholders[0].json.props.fieldValues = localFieldValues;
3857
- return await renderComponentForPlaceholder(
3921
+ const previewDom = new JSDOM(templatePreview);
3922
+ const allStyleContent = Array.from(
3923
+ previewDom.window.document.querySelectorAll("head style")
3924
+ ).map((element) => element.textContent || "").join("\n");
3925
+ const filteredCss = extractRelevantCss(allStyleContent);
3926
+ const themeVariablesCss = filteredCss ? `<style data-hs-styles="theme-variables">${filteredCss}</style>` : "";
3927
+ const webDefaultStylesCss = meta.editor_version === "2.0" ? getWebDefaultStylesCss(import.meta.url) : "";
3928
+ const globalStylesCss = [themeVariablesCss, webDefaultStylesCss].filter(Boolean).join("\n");
3929
+ const renderResult = await renderComponentForPlaceholder(
3858
3930
  0,
3859
3931
  localRenderPlaceholders[0],
3860
3932
  webRoot2,
@@ -3865,6 +3937,7 @@ async function renderLocalProjectModulePreview(moduleName, authedPortalId, authe
3865
3937
  projectName,
3866
3938
  projectComponentPath
3867
3939
  );
3940
+ return { ...renderResult, globalStylesCss };
3868
3941
  }
3869
3942
 
3870
3943
  // src/routes/partial.ts
@@ -4804,7 +4877,8 @@ async function modulePreviewRouteHandler(request, response) {
4804
4877
  html: renderedHtml,
4805
4878
  cssNeeded,
4806
4879
  renderContext,
4807
- inlineAssets
4880
+ inlineAssets,
4881
+ globalStylesCss
4808
4882
  } = await renderLocalProjectModulePreview(
4809
4883
  moduleName,
4810
4884
  authedPortalId,
@@ -4836,6 +4910,7 @@ async function modulePreviewRouteHandler(request, response) {
4836
4910
  htmlShell.replace(
4837
4911
  "<!--headend-->",
4838
4912
  [
4913
+ globalStylesCss,
4839
4914
  fullHeightCss,
4840
4915
  cssNeeded,
4841
4916
  ...inlineAssets.map((inlineAsset) => inlineAsset.html)
@@ -5057,7 +5132,7 @@ function createAppServerAPIRoutes() {
5057
5132
  var createAppServerAPIRoutes_default = createAppServerAPIRoutes;
5058
5133
 
5059
5134
  // src/routes/appServerRouteHandler.ts
5060
- import fs6 from "node:fs/promises";
5135
+ import fs7 from "node:fs/promises";
5061
5136
  import path14 from "path";
5062
5137
  import { pathToFileURL } from "url";
5063
5138
 
@@ -5294,7 +5369,7 @@ Custom origin: ${process.env.VITE_ORIGIN}
5294
5369
  var createViteDevServer_default = createViteDevServer;
5295
5370
 
5296
5371
  // src/lib/getDevServerUIData.ts
5297
- import fs5 from "node:fs";
5372
+ import fs6 from "node:fs";
5298
5373
  var templateTypeMap = {
5299
5374
  // Standard templates
5300
5375
  4: "Page",
@@ -5366,9 +5441,9 @@ function normalizeTemplatesData(templates, projectName) {
5366
5441
  });
5367
5442
  }
5368
5443
  function detectPackageManager(projectRoot) {
5369
- if (fs5.existsSync(path13.join(projectRoot, "yarn.lock")))
5444
+ if (fs6.existsSync(path13.join(projectRoot, "yarn.lock")))
5370
5445
  return "yarn";
5371
- if (fs5.existsSync(path13.join(projectRoot, "pnpm-lock.yaml")))
5446
+ if (fs6.existsSync(path13.join(projectRoot, "pnpm-lock.yaml")))
5372
5447
  return "pnpm";
5373
5448
  return "npm";
5374
5449
  }
@@ -5455,7 +5530,7 @@ var appServerRouteHandler = async (req, res, __next) => {
5455
5530
  const templatePath = path14.join(appWebRoot, "index.html");
5456
5531
  const serverEntryPath = isProd ? path14.join(appWebRoot, "server/serverEntry.js") : path14.join(appWebRoot, "serverEntry.tsx");
5457
5532
  let render;
5458
- let template = await fs6.readFile(path14.join(templatePath), "utf-8");
5533
+ let template = await fs7.readFile(path14.join(templatePath), "utf-8");
5459
5534
  if (isProd) {
5460
5535
  const { render: ssrRender } = await import(pathToFileURL(serverEntryPath).href);
5461
5536
  render = ssrRender;
@@ -5873,12 +5948,12 @@ async function fetchWebsiteDomainNames(portalId) {
5873
5948
 
5874
5949
  // src/lib/validateHSPlatform.ts
5875
5950
  import path16 from "path";
5876
- import fs7 from "fs";
5951
+ import fs8 from "fs";
5877
5952
  import select from "@inquirer/select";
5878
5953
  import { http as hsCliHttp11 } from "@hubspot/local-dev-lib/http";
5879
5954
  var HSPROJECT_JSON = "hsproject.json";
5880
5955
  function checkFileExists(filePath) {
5881
- return fs7.existsSync(filePath) && fs7.statSync(filePath).isFile();
5956
+ return fs8.existsSync(filePath) && fs8.statSync(filePath).isFile();
5882
5957
  }
5883
5958
  function findHSProjectJson(startPath) {
5884
5959
  let currentDir = startPath;
@@ -5904,7 +5979,7 @@ async function validateHSPlatform(projectConfigPath, portalId) {
5904
5979
  );
5905
5980
  return false;
5906
5981
  }
5907
- const hsProjectJSONContents = fs7.readFileSync(projectConfigPath, "utf8");
5982
+ const hsProjectJSONContents = fs8.readFileSync(projectConfigPath, "utf8");
5908
5983
  const hsProjectJSONData = JSON.parse(hsProjectJSONContents);
5909
5984
  const { platformVersion } = hsProjectJSONData;
5910
5985
  let platformVersionResult;
@@ -5932,7 +6007,7 @@ async function validateHSPlatform(projectConfigPath, portalId) {
5932
6007
  });
5933
6008
  hsProjectJSONData.platformVersion = answer;
5934
6009
  try {
5935
- fs7.writeFileSync(
6010
+ fs8.writeFileSync(
5936
6011
  projectConfigPath,
5937
6012
  JSON.stringify(hsProjectJSONData, void 0, 2),
5938
6013
  "utf8"
@@ -6194,7 +6269,7 @@ function writeFieldsType(fields, fileName, typeName) {
6194
6269
  }
6195
6270
 
6196
6271
  // src/lib/watchFieldsUpdates.ts
6197
- import fs8 from "fs";
6272
+ import fs9 from "fs";
6198
6273
  import path17 from "path";
6199
6274
  import readline from "readline";
6200
6275
  var lastSerializedFieldsCache = {};
@@ -6216,9 +6291,9 @@ var isInModulesFolder = (filePath, projectRoot) => {
6216
6291
  };
6217
6292
  };
6218
6293
  var fileContainsAutoGenComment = async (filePath) => {
6219
- if (!fs8.existsSync(filePath))
6294
+ if (!fs9.existsSync(filePath))
6220
6295
  return true;
6221
- const stream2 = fs8.createReadStream(filePath);
6296
+ const stream2 = fs9.createReadStream(filePath);
6222
6297
  const reader = readline.createInterface({ input: stream2 });
6223
6298
  const firstLine = await new Promise(
6224
6299
  (resolve3) => reader.once("line", (line) => resolve3(line.trim()))
@@ -6237,7 +6312,7 @@ var getIndexFile = (filePath, projectRoot) => {
6237
6312
  if (isRootModuleFile)
6238
6313
  return { indexFilePath: filePath, isRootModuleFile };
6239
6314
  const dir = path17.dirname(filePath);
6240
- const files = fs8.readdirSync(dir);
6315
+ const files = fs9.readdirSync(dir);
6241
6316
  const indexFileName = files.find((file) => file.startsWith("index."));
6242
6317
  return indexFileName ? { indexFilePath: path17.join(dir, indexFileName), isRootModuleFile } : void 0;
6243
6318
  };
@@ -6330,7 +6405,7 @@ function getWebRootProjectComponentFolder(absoluteWebRoot, projectConfigPath) {
6330
6405
  }
6331
6406
  try {
6332
6407
  const projectDir = path18.dirname(projectConfigPath);
6333
- const configContent = fs9.readFileSync(projectConfigPath, "utf8");
6408
+ const configContent = fs10.readFileSync(projectConfigPath, "utf8");
6334
6409
  const projectConfig = JSON.parse(configContent);
6335
6410
  if (hasNewDirectoryStructure(projectConfig.platformVersion)) {
6336
6411
  const srcDir = projectConfig.srcDir || "src";
@@ -6600,7 +6675,7 @@ HubSpot CMS dev server running at ${protocol}://hslocal.net:${PORT}${extraServer
6600
6675
  const sbPackagePath = await import.meta.resolve("storybook/package.json");
6601
6676
  const sbPackageDir = path18.dirname(url2.fileURLToPath(sbPackagePath));
6602
6677
  const packageJson = JSON.parse(
6603
- fs9.readFileSync(path18.join(sbPackageDir, "package.json"), "utf-8")
6678
+ fs10.readFileSync(path18.join(sbPackageDir, "package.json"), "utf-8")
6604
6679
  );
6605
6680
  storybookBin = path18.join(
6606
6681
  sbPackageDir,
@@ -730,6 +730,7 @@ async function validateModuleFields(projectRoot, moduleName) {
730
730
  logLevel: "silent",
731
731
  appType: "custom",
732
732
  root: absoluteRoot,
733
+ cacheDir: path3.join(absoluteRoot, "node_modules/.vite-validate-fields"),
733
734
  server: { middlewareMode: true, hmr: false },
734
735
  optimizeDeps: { noDiscovery: true, include: [] },
735
736
  ssr: { noExternal: "@hubspot/cms-components" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cms-dev-server",
3
- "version": "1.2.53",
3
+ "version": "1.2.62",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "engines": {
@@ -9,7 +9,7 @@
9
9
  "scripts": {
10
10
  "build": "tsc -noEmit && yarn run copy-html && yarn build-types && node scripts/build.mjs && npm run publint",
11
11
  "build:watch": "nodemon --exec 'yarn build'",
12
- "copy-html": "copyfiles -u 1 'src/html/**' 'dist'",
12
+ "copy-html": "copyfiles -u 1 'src/html/**' 'src/css/**' 'dist'",
13
13
  "build-types": "tsc --project tsconfig.types.json",
14
14
  "clean": "tsc --build --clean",
15
15
  "dev": "nodemon --no-stdin --exec 'yarn start'",
@@ -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.53",
32
+ "@hubspot/cms-components": "^1.2.62",
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",
@@ -135,5 +135,5 @@
135
135
  "publishConfig": {
136
136
  "access": "public"
137
137
  },
138
- "gitHead": "969ccc853c57cf798cc99cd581580145a196947a"
138
+ "gitHead": "09647aaa9bc9c976ab73dd86ab7bd30e3b57ed4d"
139
139
  }
@@ -0,0 +1,2 @@
1
+ export declare function debugAuthContext(authedPortalId: number, cookieValue: string): Promise<void>;
2
+ export declare function compareUrls(originalUrl: string, signedUrl: string): void;
@@ -0,0 +1 @@
1
+ export declare function extractRelevantCss(cssText: string): string;
@@ -0,0 +1,2 @@
1
+ export declare function getLocalComponentsPath(): string;
2
+ export declare function shouldUseLocalComponents(): boolean;
@@ -6,4 +6,10 @@ export declare function renderRemoteModulePreview(modulePath: string, authedPort
6
6
  cssNeeded: string;
7
7
  }>;
8
8
  export declare function signUrl(authedPortalId: number, unsignedUrl: string, requestBody: any): Promise<string>;
9
- export declare function renderLocalProjectModulePreview(moduleName: string, authedPortalId: any, authedEnv: any, authedHublet: any, webRoot: any, viteServer: any, jsRenderingGates: any, projectName: any, projectComponentPath: any, fullOriginalUrl: any, cookieValue: any, fieldOverrides?: {}): Promise<import("./renderComponentWithCSS.js").RenderResult>;
9
+ export declare function renderLocalProjectModulePreview(moduleName: string, authedPortalId: any, authedEnv: any, authedHublet: any, webRoot: any, viteServer: any, jsRenderingGates: any, projectName: any, projectComponentPath: any, fullOriginalUrl: any, cookieValue: any, fieldOverrides?: {}): Promise<{
10
+ globalStylesCss: string;
11
+ html: string;
12
+ inlineAssets?: import("@hubspot/cms-js-internal").InlineAsset[];
13
+ cssNeeded: string;
14
+ renderContext: import("@hubspot/cms-components").ServerRenderContextValue;
15
+ }>;
@@ -0,0 +1,15 @@
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
+ };
@@ -0,0 +1,2 @@
1
+ import type { Plugin } from 'vite';
2
+ export declare function hubspotStaticAssetsPlugin(): Plugin;
@@ -0,0 +1,7 @@
1
+ import { ViteDevServer, Plugin } from 'vite';
2
+ /**
3
+ * Create a self-contained plugin with proper caching
4
+ */
5
+ export declare function remoteAssetsPlugin(): Plugin & {
6
+ processRemoteAssets: (html: string, viteServer: ViteDevServer) => Promise<string>;
7
+ };
@@ -0,0 +1,6 @@
1
+ import type { Plugin } from 'vite';
2
+ /**
3
+ * Plugin that provides URL signing capabilities
4
+ * Uses internal signing mechanisms when available, with fallback for public environments
5
+ */
6
+ export default function requestSigningPlugin(): Plugin;
@@ -0,0 +1,5 @@
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;
@@ -0,0 +1,3 @@
1
+ import { Request, Response } from 'express';
2
+ declare const homeRouteHandler: (request: Request, response: Response, next: Function) => Promise<void>;
3
+ export default homeRouteHandler;