@hubspot/cms-dev-server 0.18.23 → 0.18.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/assets/LexendDeca-Bold-B8uERmr8.woff2 +0 -0
- package/dist/app/assets/LexendDeca-Light-BtcvwT5C.woff2 +0 -0
- package/dist/app/assets/LexendDeca-Medium-CxVPR2j6.woff2 +0 -0
- package/dist/app/assets/LexendDeca-SemiBold-BhzS3XUP.woff2 +0 -0
- package/dist/app/assets/index-BAtasOic.css +1 -0
- package/dist/app/assets/index-BC6R47Vo.js +154 -0
- package/dist/app/index.html +15 -0
- package/dist/app/server/assets/RenderTreeSeparately-T6CL43QJ-D50VfKo0.js +111 -0
- package/dist/app/server/serverEntry.js +3393 -0
- package/dist/index.js +78 -57
- package/dist/run.js +78 -57
- package/package.json +3 -3
- package/types/constants/errors.d.ts +5 -0
- package/types/createAppViteConfig.d.ts +2 -0
- package/types/lib/cli.d.ts +22 -0
- package/types/lib/cliUtils.d.ts +14 -0
- package/types/routes/api.d.ts +2 -0
- package/types/routes/appServerRoutes.d.ts +5 -0
- package/types/storybook-main/preview.d.ts +9 -0
- package/types/routes/meta.d.ts +0 -2
package/dist/run.js
CHANGED
|
@@ -758,7 +758,7 @@ async function buildThemePreviewOptions(webRoot2, isUsingLocalWorkspace = false)
|
|
|
758
758
|
}
|
|
759
759
|
|
|
760
760
|
// src/createDevServer.ts
|
|
761
|
-
import
|
|
761
|
+
import path16 from "path";
|
|
762
762
|
import url2 from "url";
|
|
763
763
|
import express2 from "express";
|
|
764
764
|
import http3 from "http";
|
|
@@ -768,7 +768,11 @@ import { normalizePath as normalizePath9 } from "vite";
|
|
|
768
768
|
import { Transform } from "stream";
|
|
769
769
|
|
|
770
770
|
// src/routes/createDevServerRoutes.ts
|
|
771
|
-
import {
|
|
771
|
+
import {
|
|
772
|
+
Router as Router2,
|
|
773
|
+
urlencoded,
|
|
774
|
+
static as expressStatic
|
|
775
|
+
} from "express";
|
|
772
776
|
import { createProxyMiddleware } from "http-proxy-middleware";
|
|
773
777
|
|
|
774
778
|
// src/routes/partial.ts
|
|
@@ -1401,8 +1405,8 @@ function convertEntryPointIslandPathsToRelative(config, entryPointsCmsModuleMap)
|
|
|
1401
1405
|
);
|
|
1402
1406
|
return Object.fromEntries(relativeEntries);
|
|
1403
1407
|
}
|
|
1404
|
-
function toRelativePath(config,
|
|
1405
|
-
return
|
|
1408
|
+
function toRelativePath(config, path17) {
|
|
1409
|
+
return path17.replace(`${config.root}/`, "");
|
|
1406
1410
|
}
|
|
1407
1411
|
function shouldAnalyzeModule(config, moduleInfo, code) {
|
|
1408
1412
|
const [fileId, __] = moduleInfo.id.split("?");
|
|
@@ -1445,11 +1449,11 @@ function analyzeSourceCodeUsages(ctx, moduleInfo, config, code) {
|
|
|
1445
1449
|
let moduleComponentLocalImportName = CMS_MODULE_COMPONENT_NAME;
|
|
1446
1450
|
let dndAreaComponentLocalImportName = DND_AREA_COMPONENT_NAME;
|
|
1447
1451
|
traverse(sourceAst, {
|
|
1448
|
-
ImportDeclaration(
|
|
1449
|
-
if (t.isStringLiteral(
|
|
1452
|
+
ImportDeclaration(path17) {
|
|
1453
|
+
if (t.isStringLiteral(path17.node.source, {
|
|
1450
1454
|
value: "@hubspot/cms-components"
|
|
1451
1455
|
})) {
|
|
1452
|
-
for (const specifier of
|
|
1456
|
+
for (const specifier of path17.node.specifiers) {
|
|
1453
1457
|
if (t.isImportSpecifier(specifier) && t.isIdentifier(specifier.imported, {
|
|
1454
1458
|
name: CMS_MODULE_COMPONENT_NAME
|
|
1455
1459
|
})) {
|
|
@@ -1463,14 +1467,14 @@ function analyzeSourceCodeUsages(ctx, moduleInfo, config, code) {
|
|
|
1463
1467
|
}
|
|
1464
1468
|
}
|
|
1465
1469
|
},
|
|
1466
|
-
JSXOpeningElement(
|
|
1467
|
-
if (t.isJSXIdentifier(
|
|
1470
|
+
JSXOpeningElement(path17) {
|
|
1471
|
+
if (t.isJSXIdentifier(path17.node.name, {
|
|
1468
1472
|
name: moduleComponentLocalImportName
|
|
1469
1473
|
})) {
|
|
1470
1474
|
let cmsModuleName;
|
|
1471
1475
|
let cmsModulePath;
|
|
1472
1476
|
let cmsModuleLabel;
|
|
1473
|
-
for (const prop of
|
|
1477
|
+
for (const prop of path17.node.attributes) {
|
|
1474
1478
|
if (t.isJSXAttribute(prop) && t.isJSXIdentifier(prop.name, { name: "name" }) && t.isStringLiteral(prop.value)) {
|
|
1475
1479
|
cmsModuleName = prop.value.value;
|
|
1476
1480
|
continue;
|
|
@@ -1505,11 +1509,11 @@ function analyzeSourceCodeUsages(ctx, moduleInfo, config, code) {
|
|
|
1505
1509
|
}
|
|
1506
1510
|
contentDescriptors.modules[cmsModuleProps.name] = cmsModuleProps;
|
|
1507
1511
|
}
|
|
1508
|
-
if (t.isJSXIdentifier(
|
|
1512
|
+
if (t.isJSXIdentifier(path17.node.name, {
|
|
1509
1513
|
name: dndAreaComponentLocalImportName
|
|
1510
1514
|
})) {
|
|
1511
1515
|
let dndAreaName;
|
|
1512
|
-
for (const prop of
|
|
1516
|
+
for (const prop of path17.node.attributes) {
|
|
1513
1517
|
if (t.isJSXAttribute(prop) && t.isJSXIdentifier(prop.name, { name: "name" }) && t.isStringLiteral(prop.value)) {
|
|
1514
1518
|
dndAreaName = prop.value.value;
|
|
1515
1519
|
continue;
|
|
@@ -2093,7 +2097,7 @@ function trackUsage(action) {
|
|
|
2093
2097
|
eventName: EVENT_NAME,
|
|
2094
2098
|
action,
|
|
2095
2099
|
nodeVersion: getNodeVersionData(),
|
|
2096
|
-
version: "0.18.
|
|
2100
|
+
version: "0.18.24",
|
|
2097
2101
|
os: getPlatform()
|
|
2098
2102
|
};
|
|
2099
2103
|
const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
|
|
@@ -2166,12 +2170,12 @@ var findLocalRenderPlaceholders = (body) => {
|
|
|
2166
2170
|
);
|
|
2167
2171
|
offsetSoFar = nearestNewlineOrQuoteAfterBlockOpen;
|
|
2168
2172
|
if (pathEndOffset >= 0 && pathEndOffset < nextNewlineOffset) {
|
|
2169
|
-
const
|
|
2173
|
+
const path17 = body.substring(
|
|
2170
2174
|
startOffset + localJsRenderStartString.length,
|
|
2171
2175
|
pathEndOffset
|
|
2172
2176
|
);
|
|
2173
2177
|
offsetSoFar = pathEndOffset + 1;
|
|
2174
|
-
if (startOffset >= 0 &&
|
|
2178
|
+
if (startOffset >= 0 && path17) {
|
|
2175
2179
|
const nextCommentEndOffset = body.indexOf("-->", pathEndOffset);
|
|
2176
2180
|
const endOffset = body.indexOf(localJsRenderEndString, pathEndOffset);
|
|
2177
2181
|
offsetSoFar = Math.min(nextCommentEndOffset, endOffset);
|
|
@@ -2196,7 +2200,7 @@ var findLocalRenderPlaceholders = (body) => {
|
|
|
2196
2200
|
result.push({
|
|
2197
2201
|
startOffset,
|
|
2198
2202
|
endOffset: endOffset + localJsRenderEndString.length,
|
|
2199
|
-
path:
|
|
2203
|
+
path: path17,
|
|
2200
2204
|
json
|
|
2201
2205
|
});
|
|
2202
2206
|
}
|
|
@@ -2575,9 +2579,9 @@ var customColors = [
|
|
|
2575
2579
|
];
|
|
2576
2580
|
var Converter = new AnsiToHtmlConverter({ colors: customColors });
|
|
2577
2581
|
var darkErrorStyles = `background-color: #222; color: #ccc; padding: 0.5em; font-family: ui-monospace, Menlo, Monaco, 'Cascadia Mono', 'Segoe UI Mono', 'Roboto Mono', 'Oxygen Mono', 'Ubuntu Monospace', 'Source Code Pro', 'Fira Mono', 'Droid Sans Mono', 'Courier New', monospace;`;
|
|
2578
|
-
var renderLocalError_default = (
|
|
2582
|
+
var renderLocalError_default = (path17, error) => {
|
|
2579
2583
|
const stackWithColorClasses = Converter.toHtml(error.stack);
|
|
2580
|
-
return `<div data-js-rendered="error" style="${darkErrorStyles}">Error rendering ${
|
|
2584
|
+
return `<div data-js-rendered="error" style="${darkErrorStyles}">Error rendering ${path17}<br/><br/><code><pre>${stackWithColorClasses}</pre></code></div>`;
|
|
2581
2585
|
};
|
|
2582
2586
|
|
|
2583
2587
|
// src/proxyPage/fetchPreviewInfo.ts
|
|
@@ -4137,18 +4141,18 @@ async function fetchPreviewTemplates(accountId, previewToken) {
|
|
|
4137
4141
|
url: `${DESIGN_MANAGER_API_PATH}/templates/local-preview?previewToken=${previewToken}`
|
|
4138
4142
|
})).data;
|
|
4139
4143
|
}
|
|
4140
|
-
async function fetchModuleByPath(accountId,
|
|
4144
|
+
async function fetchModuleByPath(accountId, path17) {
|
|
4141
4145
|
return (await hsCliHttp8.get(accountId, {
|
|
4142
|
-
url: `${DESIGN_MANAGER_API_PATH}/modules/by-path/${
|
|
4146
|
+
url: `${DESIGN_MANAGER_API_PATH}/modules/by-path/${path17}?portalId=${accountId}`
|
|
4143
4147
|
})).data;
|
|
4144
4148
|
}
|
|
4145
|
-
async function fetchTemplateByPath(accountId,
|
|
4149
|
+
async function fetchTemplateByPath(accountId, path17) {
|
|
4146
4150
|
return (await hsCliHttp8.get(accountId, {
|
|
4147
|
-
url: `${DESIGN_MANAGER_API_PATH}/templates/by-path/${
|
|
4151
|
+
url: `${DESIGN_MANAGER_API_PATH}/templates/by-path/${path17}?portalId=${accountId}`
|
|
4148
4152
|
})).data;
|
|
4149
4153
|
}
|
|
4150
|
-
async function fetchModulePageDependencies(accountId,
|
|
4151
|
-
const url3 = `${DESIGN_MANAGER_API_PATH}/modules/list-pages?modulePath=${
|
|
4154
|
+
async function fetchModulePageDependencies(accountId, path17) {
|
|
4155
|
+
const url3 = `${DESIGN_MANAGER_API_PATH}/modules/list-pages?modulePath=${path17}`;
|
|
4152
4156
|
return (await hsCliHttp8.get(accountId, { url: url3 })).data;
|
|
4153
4157
|
}
|
|
4154
4158
|
|
|
@@ -4739,14 +4743,14 @@ function getOpenCommand() {
|
|
|
4739
4743
|
}
|
|
4740
4744
|
}
|
|
4741
4745
|
async function handleGetModulePages(req, res, next) {
|
|
4742
|
-
const { path:
|
|
4743
|
-
if (!
|
|
4746
|
+
const { path: path17, portalId } = req.query;
|
|
4747
|
+
if (!path17 || !portalId) {
|
|
4744
4748
|
return res.status(400).json({ error: "Missing required parameters" });
|
|
4745
4749
|
}
|
|
4746
4750
|
try {
|
|
4747
4751
|
const data = await fetchModulePageDependencies(
|
|
4748
4752
|
Number(portalId),
|
|
4749
|
-
|
|
4753
|
+
path17
|
|
4750
4754
|
);
|
|
4751
4755
|
res.json(data);
|
|
4752
4756
|
} catch (err) {
|
|
@@ -4754,13 +4758,13 @@ async function handleGetModulePages(req, res, next) {
|
|
|
4754
4758
|
}
|
|
4755
4759
|
}
|
|
4756
4760
|
function handleOpenFile(req, res, next) {
|
|
4757
|
-
const { path:
|
|
4758
|
-
if (!
|
|
4761
|
+
const { path: path17 } = req.query;
|
|
4762
|
+
if (!path17) {
|
|
4759
4763
|
return res.status(400).json({ error: "Missing required parameters" });
|
|
4760
4764
|
}
|
|
4761
4765
|
try {
|
|
4762
4766
|
const command = getOpenCommand();
|
|
4763
|
-
spawn(command, [
|
|
4767
|
+
spawn(command, [path17], { detached: true }).unref();
|
|
4764
4768
|
res.sendStatus(200);
|
|
4765
4769
|
} catch (err) {
|
|
4766
4770
|
next(err);
|
|
@@ -4775,12 +4779,17 @@ function createAppServerRoutes() {
|
|
|
4775
4779
|
var createAppServerRoutes_default = createAppServerRoutes;
|
|
4776
4780
|
|
|
4777
4781
|
// src/routes/createDevServerRoutes.ts
|
|
4782
|
+
import path13 from "path";
|
|
4783
|
+
import { fileURLToPath } from "url";
|
|
4784
|
+
var __filename = fileURLToPath(import.meta.url);
|
|
4785
|
+
var __dirname = path13.dirname(__filename);
|
|
4786
|
+
var isProd = true;
|
|
4778
4787
|
var STORYBOOK_DOMAINS = VALID_PROXY_DOMAIN_SUFFIXES.map(
|
|
4779
4788
|
(domain2) => `storybook.${domain2}`
|
|
4780
4789
|
);
|
|
4781
4790
|
var createDevServerRoutes = async (viteServer, storybookPort, appServerConfig) => {
|
|
4782
4791
|
const devServerApp = Router2();
|
|
4783
|
-
const { appServer, reqLocals
|
|
4792
|
+
const { appServer, reqLocals } = appServerConfig || {};
|
|
4784
4793
|
devServerApp.use((request2, response, next) => {
|
|
4785
4794
|
const { method, url: url3, hostname } = request2;
|
|
4786
4795
|
debug(`${method}:${hostname}${url3}`);
|
|
@@ -4799,24 +4808,36 @@ var createDevServerRoutes = async (viteServer, storybookPort, appServerConfig) =
|
|
|
4799
4808
|
}
|
|
4800
4809
|
devServerApp.use(urlencoded());
|
|
4801
4810
|
if (appServer) {
|
|
4802
|
-
|
|
4811
|
+
const appWebRoot = isProd ? path13.join(__dirname, "app") : appServerConfig == null ? void 0 : appServerConfig.appWebRoot;
|
|
4812
|
+
if (isProd) {
|
|
4813
|
+
const distAssetsPath = path13.join(appWebRoot, "assets");
|
|
4814
|
+
devServerApp.use("/assets", expressStatic(distAssetsPath));
|
|
4815
|
+
} else {
|
|
4816
|
+
devServerApp.use(appServer.middlewares);
|
|
4817
|
+
}
|
|
4803
4818
|
devServerApp.use(viteServer.middlewares);
|
|
4804
4819
|
devServerApp.use("/api", createAppServerRoutes_default());
|
|
4805
4820
|
devServerApp.get("/", async (req, res) => {
|
|
4806
4821
|
try {
|
|
4807
4822
|
const initialProps = await getDevServerUIData_default(reqLocals, viteServer);
|
|
4808
4823
|
const url3 = req.originalUrl.replace("/", "");
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
)
|
|
4824
|
+
const templatePath = path13.join(appWebRoot, "index.html");
|
|
4825
|
+
const serverEntryPath = isProd ? path13.join(appWebRoot, "server/serverEntry.js") : path13.join(appWebRoot, "serverEntry.tsx");
|
|
4826
|
+
let render;
|
|
4827
|
+
let template = await fs4.readFile(path13.join(templatePath), "utf-8");
|
|
4828
|
+
if (isProd) {
|
|
4829
|
+
const { render: ssrRender } = await import(serverEntryPath);
|
|
4830
|
+
render = ssrRender;
|
|
4831
|
+
} else {
|
|
4832
|
+
template = await appServer.transformIndexHtml(url3, template);
|
|
4833
|
+
render = (await appServer.ssrLoadModule(serverEntryPath)).render;
|
|
4834
|
+
}
|
|
4814
4835
|
const rendered = await render(initialProps);
|
|
4815
4836
|
const html = template.replace(`<!--app-head-->`, rendered.head ?? "").replace(`<!--app-html-->`, rendered.html ?? "").replace(
|
|
4816
4837
|
`<!--app-script-->`,
|
|
4817
4838
|
`<script>window.__hsInitialProps = ${JSON.stringify(
|
|
4818
4839
|
initialProps
|
|
4819
|
-
)}
|
|
4840
|
+
)};</script>` ?? ""
|
|
4820
4841
|
);
|
|
4821
4842
|
res.status(200).set({ "Content-Type": "text/html" }).send(html);
|
|
4822
4843
|
} catch (e) {
|
|
@@ -5287,7 +5308,7 @@ async function fetchWebsiteDomainNames(portalId) {
|
|
|
5287
5308
|
}
|
|
5288
5309
|
|
|
5289
5310
|
// src/lib/validateHSPlatform.ts
|
|
5290
|
-
import
|
|
5311
|
+
import path14 from "path";
|
|
5291
5312
|
import fs5 from "fs";
|
|
5292
5313
|
import select from "@inquirer/select";
|
|
5293
5314
|
import { http as hsCliHttp12 } from "@hubspot/local-dev-lib/http";
|
|
@@ -5299,12 +5320,12 @@ function findHSProjectJson(startPath) {
|
|
|
5299
5320
|
let currentDir = startPath;
|
|
5300
5321
|
let dirLevel = 0;
|
|
5301
5322
|
const maxDirLevel = 4;
|
|
5302
|
-
while (
|
|
5303
|
-
const filePath =
|
|
5323
|
+
while (path14.dirname(currentDir) !== currentDir && dirLevel < maxDirLevel) {
|
|
5324
|
+
const filePath = path14.join(currentDir, HSPROJECT_JSON);
|
|
5304
5325
|
if (checkFileExists(filePath)) {
|
|
5305
5326
|
return filePath;
|
|
5306
5327
|
}
|
|
5307
|
-
currentDir =
|
|
5328
|
+
currentDir = path14.dirname(currentDir);
|
|
5308
5329
|
dirLevel++;
|
|
5309
5330
|
}
|
|
5310
5331
|
console.log(
|
|
@@ -5610,7 +5631,7 @@ function writeFieldsType(fields, fileName, typeName) {
|
|
|
5610
5631
|
|
|
5611
5632
|
// src/lib/watchFieldsUpdates.ts
|
|
5612
5633
|
import fs6 from "fs";
|
|
5613
|
-
import
|
|
5634
|
+
import path15 from "path";
|
|
5614
5635
|
import readline from "readline";
|
|
5615
5636
|
var lastSerializedFieldsCache = {};
|
|
5616
5637
|
var formatAsTypeName = (str) => {
|
|
@@ -5622,9 +5643,9 @@ var isInModulesFolder = (filePath, projectRoot) => {
|
|
|
5622
5643
|
const getEntryPathFromId = (id) => {
|
|
5623
5644
|
return id.startsWith(projectRoot) ? id.replace(`${projectRoot}/`, "") : "";
|
|
5624
5645
|
};
|
|
5625
|
-
const currentModuleId =
|
|
5646
|
+
const currentModuleId = path15.normalize(filePath);
|
|
5626
5647
|
const moduleEntryPath = getEntryPathFromId(currentModuleId);
|
|
5627
|
-
const subFolderTokens = moduleEntryPath.split(
|
|
5648
|
+
const subFolderTokens = moduleEntryPath.split(path15.sep);
|
|
5628
5649
|
return {
|
|
5629
5650
|
inModuleFolder: subFolderTokens[0] === "components" && subFolderTokens[1] === "modules",
|
|
5630
5651
|
isRootModuleFile: subFolderTokens.length === 3
|
|
@@ -5651,10 +5672,10 @@ var getIndexFile = (filePath, projectRoot) => {
|
|
|
5651
5672
|
return void 0;
|
|
5652
5673
|
if (isRootModuleFile)
|
|
5653
5674
|
return { indexFilePath: filePath, isRootModuleFile };
|
|
5654
|
-
const dir =
|
|
5675
|
+
const dir = path15.dirname(filePath);
|
|
5655
5676
|
const files = fs6.readdirSync(dir);
|
|
5656
5677
|
const indexFileName = files.find((file) => file.startsWith("index."));
|
|
5657
|
-
return indexFileName ? { indexFilePath:
|
|
5678
|
+
return indexFileName ? { indexFilePath: path15.join(dir, indexFileName), isRootModuleFile } : void 0;
|
|
5658
5679
|
};
|
|
5659
5680
|
var getIndexFileFields = async (indexFilePath, indexFileName, viteServer) => {
|
|
5660
5681
|
let indexFile;
|
|
@@ -5678,7 +5699,7 @@ var maybeUpdateFields = async (filePath, viteServer, projectRoot) => {
|
|
|
5678
5699
|
if (!indexInfo)
|
|
5679
5700
|
return;
|
|
5680
5701
|
const { indexFilePath, isRootModuleFile } = indexInfo;
|
|
5681
|
-
const indexFileName =
|
|
5702
|
+
const indexFileName = path15.parse(indexFilePath).name;
|
|
5682
5703
|
const isTypeFile = filePath.endsWith(".types.ts");
|
|
5683
5704
|
if (isTypeFile)
|
|
5684
5705
|
return;
|
|
@@ -5689,7 +5710,7 @@ var maybeUpdateFields = async (filePath, viteServer, projectRoot) => {
|
|
|
5689
5710
|
);
|
|
5690
5711
|
if (fields) {
|
|
5691
5712
|
const typeFileName = isRootModuleFile ? `${indexFileName}.fields.types.ts` : "fields.type.ts";
|
|
5692
|
-
const typeFilePath =
|
|
5713
|
+
const typeFilePath = path15.join(path15.dirname(filePath), typeFileName);
|
|
5693
5714
|
const lastSerializedFields = lastSerializedFieldsCache[typeFilePath];
|
|
5694
5715
|
const serializedFields = JSON.stringify(fields);
|
|
5695
5716
|
if (lastSerializedFields === serializedFields)
|
|
@@ -5697,7 +5718,7 @@ var maybeUpdateFields = async (filePath, viteServer, projectRoot) => {
|
|
|
5697
5718
|
const hasAutoGenComment = await fileContainsAutoGenComment(typeFilePath);
|
|
5698
5719
|
if (!hasAutoGenComment)
|
|
5699
5720
|
return;
|
|
5700
|
-
const moduleFolderName =
|
|
5721
|
+
const moduleFolderName = path15.basename(path15.dirname(filePath));
|
|
5701
5722
|
const outputTypeName = formatAsTypeName(moduleFolderName);
|
|
5702
5723
|
const didSucceed = writeFieldsType(fields, typeFilePath, outputTypeName);
|
|
5703
5724
|
if (didSucceed) {
|
|
@@ -5713,7 +5734,7 @@ var maybeUpdateFields = async (filePath, viteServer, projectRoot) => {
|
|
|
5713
5734
|
var startFieldsTypeGenWatcher = (viteServer, projectRoot) => {
|
|
5714
5735
|
const { moduleSubpaths } = findAllModulesInRoot(projectRoot);
|
|
5715
5736
|
moduleSubpaths.forEach((modulePath) => {
|
|
5716
|
-
const resolvedPath =
|
|
5737
|
+
const resolvedPath = path15.resolve(projectRoot, modulePath);
|
|
5717
5738
|
maybeUpdateFields(resolvedPath, viteServer, projectRoot);
|
|
5718
5739
|
});
|
|
5719
5740
|
const watchCallback = (filePath) => maybeUpdateFields(filePath, viteServer, projectRoot);
|
|
@@ -5851,7 +5872,7 @@ Local proxy functionality and module preview routes will not work without settin
|
|
|
5851
5872
|
} catch (e) {
|
|
5852
5873
|
authedHublet = "na1";
|
|
5853
5874
|
}
|
|
5854
|
-
const absoluteWebRoot = normalizePath9(
|
|
5875
|
+
const absoluteWebRoot = normalizePath9(path16.resolve(process.cwd(), webRoot2));
|
|
5855
5876
|
const [__webRootProjectFolder, webRootProjectComponentFolder] = absoluteWebRoot.replace(/\/$/, "").split("/").slice(-2);
|
|
5856
5877
|
const projectConfigPath = findHSProjectJson(absoluteWebRoot);
|
|
5857
5878
|
if (authedPortalId) {
|
|
@@ -5905,8 +5926,8 @@ Local proxy functionality and module preview routes will not work without settin
|
|
|
5905
5926
|
expressServer.use(bodyParser.json());
|
|
5906
5927
|
let appServerConfig = null;
|
|
5907
5928
|
if (showUI2) {
|
|
5908
|
-
const appWebRoot =
|
|
5909
|
-
|
|
5929
|
+
const appWebRoot = path16.join(
|
|
5930
|
+
path16.dirname(url2.fileURLToPath(import.meta.url)),
|
|
5910
5931
|
"../app"
|
|
5911
5932
|
);
|
|
5912
5933
|
const reqLocals = {
|
|
@@ -5977,8 +5998,8 @@ HubSpot CMS dev server hosting: ${projectName}/${expressServer.locals.projectCom
|
|
|
5977
5998
|
`
|
|
5978
5999
|
);
|
|
5979
6000
|
if (storybook2) {
|
|
5980
|
-
const packageRoot =
|
|
5981
|
-
const configPath =
|
|
6001
|
+
const packageRoot = path16.dirname(url2.fileURLToPath(import.meta.url));
|
|
6002
|
+
const configPath = path16.resolve(packageRoot, "./storybook-main");
|
|
5982
6003
|
sendTrackingRequest("start-storybook");
|
|
5983
6004
|
const storybookProcess = spawn2(
|
|
5984
6005
|
"sb",
|
|
@@ -5998,7 +6019,7 @@ HubSpot CMS dev server hosting: ${projectName}/${expressServer.locals.projectCom
|
|
|
5998
6019
|
portalId: authedPortalId.toString(),
|
|
5999
6020
|
hsEnv: authedEnv,
|
|
6000
6021
|
hublet: authedHublet,
|
|
6001
|
-
WEB_ROOT:
|
|
6022
|
+
WEB_ROOT: path16.join(webRoot2, "components")
|
|
6002
6023
|
}
|
|
6003
6024
|
}
|
|
6004
6025
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cms-dev-server",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.24",
|
|
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": "^0.18.
|
|
32
|
+
"@hubspot/cms-components": "^0.18.24",
|
|
33
33
|
"@hubspot/local-dev-lib": "2.0.1",
|
|
34
34
|
"@inquirer/select": "^2.0.0",
|
|
35
35
|
"@originjs/vite-plugin-commonjs": "^1.0.3",
|
|
@@ -131,5 +131,5 @@
|
|
|
131
131
|
"publishConfig": {
|
|
132
132
|
"access": "public"
|
|
133
133
|
},
|
|
134
|
-
"gitHead": "
|
|
134
|
+
"gitHead": "29aa57588f20ed6bde2b24615e18dea79178d7ad"
|
|
135
135
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
export declare function getDevServerCommandLineOptions(argv: NodeJS.Process['argv']): {
|
|
3
|
+
hubspotCliConfigPathOption: string;
|
|
4
|
+
hubspotCliAccountNameOption: string;
|
|
5
|
+
sslEnabledOption: boolean;
|
|
6
|
+
storybook: boolean;
|
|
7
|
+
fieldGenEnabledOption: boolean;
|
|
8
|
+
webRoot: string;
|
|
9
|
+
resetSession: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare function buildThemePreviewOptions(webRoot: string): Promise<{
|
|
12
|
+
filePaths: string[];
|
|
13
|
+
startProgressBar: (numFiles: any) => {
|
|
14
|
+
onAttemptCallback: () => void;
|
|
15
|
+
onSuccessCallback: () => void;
|
|
16
|
+
onFirstErrorCallback: () => void;
|
|
17
|
+
onRetryCallback: () => void;
|
|
18
|
+
onFinalErrorCallback: () => any;
|
|
19
|
+
onFinishCallback: (results: any) => void;
|
|
20
|
+
};
|
|
21
|
+
dest: any;
|
|
22
|
+
}>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare function determineSrcAndDest(): Promise<{
|
|
2
|
+
absoluteSrc: any;
|
|
3
|
+
dest: any;
|
|
4
|
+
}>;
|
|
5
|
+
export declare function getUploadableFileList(src: any, convertFields: any): Promise<any[]>;
|
|
6
|
+
export declare function fieldsJsPrompt(filePath: any, projectDir: any, skipFiles?: any[]): Promise<any[]>;
|
|
7
|
+
export declare function logError(error: any, context?: {}): void;
|
|
8
|
+
export declare class ApiErrorContext {
|
|
9
|
+
accountId: any;
|
|
10
|
+
request: any;
|
|
11
|
+
payload: any;
|
|
12
|
+
projectName: any;
|
|
13
|
+
constructor(props?: any);
|
|
14
|
+
}
|
|
@@ -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): Promise<Response<any, Record<string, any>>>;
|
|
4
|
+
export declare function appServerRoutes(): import("express-serve-static-core").Router;
|
|
5
|
+
export default appServerRoutes;
|
package/types/routes/meta.d.ts
DELETED