@hubspot/cms-dev-server 0.18.22 → 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/index-BAtasOic.css +1 -0
- package/dist/app/assets/index-BC6R47Vo.js +154 -0
- package/dist/{index.html → app/index.html} +2 -1
- package/dist/app/server/assets/RenderTreeSeparately-T6CL43QJ-D50VfKo0.js +111 -0
- package/dist/app/server/serverEntry.js +3393 -0
- package/dist/index.js +83 -62
- package/dist/run.js +83 -64
- package/package.json +4 -5
- package/dist/.DS_Store +0 -0
- package/dist/App.js +0 -168
- package/dist/App.js.map +0 -7
- package/dist/_.._/.DS_Store +0 -0
- package/dist/_.._/app/serverEntry.js +0 -8
- package/dist/_.._/app/serverEntry.js.map +0 -7
- package/dist/clientEntry.css +0 -2
- package/dist/clientEntry.css.map +0 -7
- package/dist/clientEntry.js +0 -168
- package/dist/clientEntry.js.map +0 -7
- package/dist/components.json +0 -20
- package/dist/fonts/LexendDeca-Bold.woff2 +0 -0
- package/dist/fonts/LexendDeca-Light.woff2 +0 -0
- package/dist/fonts/LexendDeca-Medium.woff2 +0 -0
- package/dist/fonts/LexendDeca-SemiBold.woff2 +0 -0
- package/dist/generateJsonFromJsx.js.map +0 -7
- package/dist/index.css +0 -2
- package/dist/index.css.map +0 -7
- package/dist/index.js.map +0 -7
- package/dist/internalSsr.js.map +0 -7
- package/dist/island-runtime.js.map +0 -7
- package/dist/postcss.config.js +0 -6
- package/dist/run.js.map +0 -7
- package/dist/storybook/index.js.map +0 -7
- package/dist/storybook-main/main.js.map +0 -7
- package/dist/storybook-main/preview.js.map +0 -7
- package/dist/tailwind.config.js +0 -67
- /package/dist/{fonts/LexendDeca-Bold-PSGSBIWW.woff2 → app/assets/LexendDeca-Bold-B8uERmr8.woff2} +0 -0
- /package/dist/{fonts/LexendDeca-Light-IDG5XLZG.woff2 → app/assets/LexendDeca-Light-BtcvwT5C.woff2} +0 -0
- /package/dist/{fonts/LexendDeca-Medium-ZCTJP7FU.woff2 → app/assets/LexendDeca-Medium-CxVPR2j6.woff2} +0 -0
- /package/dist/{fonts/LexendDeca-SemiBold-LCAJGQDV.woff2 → app/assets/LexendDeca-SemiBold-BhzS3XUP.woff2} +0 -0
package/dist/run.js
CHANGED
|
@@ -2,14 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
// src/lib/instrument.ts
|
|
4
4
|
import * as Sentry from "@sentry/node";
|
|
5
|
-
import { nodeProfilingIntegration } from "@sentry/profiling-node";
|
|
6
5
|
var isDev = process.env.NODE_ENV === "development";
|
|
7
6
|
var DSN_KEY = "f50d34a51498b37c8da9e9cba13be20a";
|
|
8
7
|
var domain = isDev ? "exceptions-na1.hubspotqa.com" : "exceptions-na1.hubspot.com";
|
|
9
8
|
var SENTRY_DSN = `https://${DSN_KEY}@${domain}/v2/1`;
|
|
10
9
|
Sentry.init({
|
|
11
10
|
dsn: SENTRY_DSN,
|
|
12
|
-
integrations: [nodeProfilingIntegration()],
|
|
13
11
|
tracesSampleRate: 1
|
|
14
12
|
// profilesSampleRate: 1.0,
|
|
15
13
|
});
|
|
@@ -760,7 +758,7 @@ async function buildThemePreviewOptions(webRoot2, isUsingLocalWorkspace = false)
|
|
|
760
758
|
}
|
|
761
759
|
|
|
762
760
|
// src/createDevServer.ts
|
|
763
|
-
import
|
|
761
|
+
import path16 from "path";
|
|
764
762
|
import url2 from "url";
|
|
765
763
|
import express2 from "express";
|
|
766
764
|
import http3 from "http";
|
|
@@ -770,7 +768,11 @@ import { normalizePath as normalizePath9 } from "vite";
|
|
|
770
768
|
import { Transform } from "stream";
|
|
771
769
|
|
|
772
770
|
// src/routes/createDevServerRoutes.ts
|
|
773
|
-
import {
|
|
771
|
+
import {
|
|
772
|
+
Router as Router2,
|
|
773
|
+
urlencoded,
|
|
774
|
+
static as expressStatic
|
|
775
|
+
} from "express";
|
|
774
776
|
import { createProxyMiddleware } from "http-proxy-middleware";
|
|
775
777
|
|
|
776
778
|
// src/routes/partial.ts
|
|
@@ -1403,8 +1405,8 @@ function convertEntryPointIslandPathsToRelative(config, entryPointsCmsModuleMap)
|
|
|
1403
1405
|
);
|
|
1404
1406
|
return Object.fromEntries(relativeEntries);
|
|
1405
1407
|
}
|
|
1406
|
-
function toRelativePath(config,
|
|
1407
|
-
return
|
|
1408
|
+
function toRelativePath(config, path17) {
|
|
1409
|
+
return path17.replace(`${config.root}/`, "");
|
|
1408
1410
|
}
|
|
1409
1411
|
function shouldAnalyzeModule(config, moduleInfo, code) {
|
|
1410
1412
|
const [fileId, __] = moduleInfo.id.split("?");
|
|
@@ -1447,11 +1449,11 @@ function analyzeSourceCodeUsages(ctx, moduleInfo, config, code) {
|
|
|
1447
1449
|
let moduleComponentLocalImportName = CMS_MODULE_COMPONENT_NAME;
|
|
1448
1450
|
let dndAreaComponentLocalImportName = DND_AREA_COMPONENT_NAME;
|
|
1449
1451
|
traverse(sourceAst, {
|
|
1450
|
-
ImportDeclaration(
|
|
1451
|
-
if (t.isStringLiteral(
|
|
1452
|
+
ImportDeclaration(path17) {
|
|
1453
|
+
if (t.isStringLiteral(path17.node.source, {
|
|
1452
1454
|
value: "@hubspot/cms-components"
|
|
1453
1455
|
})) {
|
|
1454
|
-
for (const specifier of
|
|
1456
|
+
for (const specifier of path17.node.specifiers) {
|
|
1455
1457
|
if (t.isImportSpecifier(specifier) && t.isIdentifier(specifier.imported, {
|
|
1456
1458
|
name: CMS_MODULE_COMPONENT_NAME
|
|
1457
1459
|
})) {
|
|
@@ -1465,14 +1467,14 @@ function analyzeSourceCodeUsages(ctx, moduleInfo, config, code) {
|
|
|
1465
1467
|
}
|
|
1466
1468
|
}
|
|
1467
1469
|
},
|
|
1468
|
-
JSXOpeningElement(
|
|
1469
|
-
if (t.isJSXIdentifier(
|
|
1470
|
+
JSXOpeningElement(path17) {
|
|
1471
|
+
if (t.isJSXIdentifier(path17.node.name, {
|
|
1470
1472
|
name: moduleComponentLocalImportName
|
|
1471
1473
|
})) {
|
|
1472
1474
|
let cmsModuleName;
|
|
1473
1475
|
let cmsModulePath;
|
|
1474
1476
|
let cmsModuleLabel;
|
|
1475
|
-
for (const prop of
|
|
1477
|
+
for (const prop of path17.node.attributes) {
|
|
1476
1478
|
if (t.isJSXAttribute(prop) && t.isJSXIdentifier(prop.name, { name: "name" }) && t.isStringLiteral(prop.value)) {
|
|
1477
1479
|
cmsModuleName = prop.value.value;
|
|
1478
1480
|
continue;
|
|
@@ -1507,11 +1509,11 @@ function analyzeSourceCodeUsages(ctx, moduleInfo, config, code) {
|
|
|
1507
1509
|
}
|
|
1508
1510
|
contentDescriptors.modules[cmsModuleProps.name] = cmsModuleProps;
|
|
1509
1511
|
}
|
|
1510
|
-
if (t.isJSXIdentifier(
|
|
1512
|
+
if (t.isJSXIdentifier(path17.node.name, {
|
|
1511
1513
|
name: dndAreaComponentLocalImportName
|
|
1512
1514
|
})) {
|
|
1513
1515
|
let dndAreaName;
|
|
1514
|
-
for (const prop of
|
|
1516
|
+
for (const prop of path17.node.attributes) {
|
|
1515
1517
|
if (t.isJSXAttribute(prop) && t.isJSXIdentifier(prop.name, { name: "name" }) && t.isStringLiteral(prop.value)) {
|
|
1516
1518
|
dndAreaName = prop.value.value;
|
|
1517
1519
|
continue;
|
|
@@ -2095,7 +2097,7 @@ function trackUsage(action) {
|
|
|
2095
2097
|
eventName: EVENT_NAME,
|
|
2096
2098
|
action,
|
|
2097
2099
|
nodeVersion: getNodeVersionData(),
|
|
2098
|
-
version: "0.18.
|
|
2100
|
+
version: "0.18.24",
|
|
2099
2101
|
os: getPlatform()
|
|
2100
2102
|
};
|
|
2101
2103
|
const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
|
|
@@ -2168,12 +2170,12 @@ var findLocalRenderPlaceholders = (body) => {
|
|
|
2168
2170
|
);
|
|
2169
2171
|
offsetSoFar = nearestNewlineOrQuoteAfterBlockOpen;
|
|
2170
2172
|
if (pathEndOffset >= 0 && pathEndOffset < nextNewlineOffset) {
|
|
2171
|
-
const
|
|
2173
|
+
const path17 = body.substring(
|
|
2172
2174
|
startOffset + localJsRenderStartString.length,
|
|
2173
2175
|
pathEndOffset
|
|
2174
2176
|
);
|
|
2175
2177
|
offsetSoFar = pathEndOffset + 1;
|
|
2176
|
-
if (startOffset >= 0 &&
|
|
2178
|
+
if (startOffset >= 0 && path17) {
|
|
2177
2179
|
const nextCommentEndOffset = body.indexOf("-->", pathEndOffset);
|
|
2178
2180
|
const endOffset = body.indexOf(localJsRenderEndString, pathEndOffset);
|
|
2179
2181
|
offsetSoFar = Math.min(nextCommentEndOffset, endOffset);
|
|
@@ -2198,7 +2200,7 @@ var findLocalRenderPlaceholders = (body) => {
|
|
|
2198
2200
|
result.push({
|
|
2199
2201
|
startOffset,
|
|
2200
2202
|
endOffset: endOffset + localJsRenderEndString.length,
|
|
2201
|
-
path:
|
|
2203
|
+
path: path17,
|
|
2202
2204
|
json
|
|
2203
2205
|
});
|
|
2204
2206
|
}
|
|
@@ -2577,9 +2579,9 @@ var customColors = [
|
|
|
2577
2579
|
];
|
|
2578
2580
|
var Converter = new AnsiToHtmlConverter({ colors: customColors });
|
|
2579
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;`;
|
|
2580
|
-
var renderLocalError_default = (
|
|
2582
|
+
var renderLocalError_default = (path17, error) => {
|
|
2581
2583
|
const stackWithColorClasses = Converter.toHtml(error.stack);
|
|
2582
|
-
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>`;
|
|
2583
2585
|
};
|
|
2584
2586
|
|
|
2585
2587
|
// src/proxyPage/fetchPreviewInfo.ts
|
|
@@ -4139,18 +4141,18 @@ async function fetchPreviewTemplates(accountId, previewToken) {
|
|
|
4139
4141
|
url: `${DESIGN_MANAGER_API_PATH}/templates/local-preview?previewToken=${previewToken}`
|
|
4140
4142
|
})).data;
|
|
4141
4143
|
}
|
|
4142
|
-
async function fetchModuleByPath(accountId,
|
|
4144
|
+
async function fetchModuleByPath(accountId, path17) {
|
|
4143
4145
|
return (await hsCliHttp8.get(accountId, {
|
|
4144
|
-
url: `${DESIGN_MANAGER_API_PATH}/modules/by-path/${
|
|
4146
|
+
url: `${DESIGN_MANAGER_API_PATH}/modules/by-path/${path17}?portalId=${accountId}`
|
|
4145
4147
|
})).data;
|
|
4146
4148
|
}
|
|
4147
|
-
async function fetchTemplateByPath(accountId,
|
|
4149
|
+
async function fetchTemplateByPath(accountId, path17) {
|
|
4148
4150
|
return (await hsCliHttp8.get(accountId, {
|
|
4149
|
-
url: `${DESIGN_MANAGER_API_PATH}/templates/by-path/${
|
|
4151
|
+
url: `${DESIGN_MANAGER_API_PATH}/templates/by-path/${path17}?portalId=${accountId}`
|
|
4150
4152
|
})).data;
|
|
4151
4153
|
}
|
|
4152
|
-
async function fetchModulePageDependencies(accountId,
|
|
4153
|
-
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}`;
|
|
4154
4156
|
return (await hsCliHttp8.get(accountId, { url: url3 })).data;
|
|
4155
4157
|
}
|
|
4156
4158
|
|
|
@@ -4595,6 +4597,7 @@ var templateRouteHandler = async (request2, response) => {
|
|
|
4595
4597
|
hsLocalProxyProject: localProxyProject,
|
|
4596
4598
|
localProxySchemaVersion: "2",
|
|
4597
4599
|
hsLoginVerifyDisabled: `${true}`,
|
|
4600
|
+
hsCacheBuster: Date.now().toString(),
|
|
4598
4601
|
...request2.query
|
|
4599
4602
|
};
|
|
4600
4603
|
const previewUrl = new URL(getPreviewUrl(request2, params));
|
|
@@ -4703,11 +4706,10 @@ async function getDevServerUIData(reqLocals, viteServer) {
|
|
|
4703
4706
|
let hubLModuleData = { objects: [] };
|
|
4704
4707
|
let hubLTemplateData = { objects: [] };
|
|
4705
4708
|
if (authedPortalId) {
|
|
4706
|
-
hubLModuleData = await
|
|
4707
|
-
|
|
4708
|
-
authedPortalId,
|
|
4709
|
-
|
|
4710
|
-
);
|
|
4709
|
+
[hubLModuleData, hubLTemplateData] = await Promise.all([
|
|
4710
|
+
fetchHubLModules(authedPortalId, localPreviewToken),
|
|
4711
|
+
fetchPreviewTemplates(authedPortalId, localPreviewToken)
|
|
4712
|
+
]);
|
|
4711
4713
|
}
|
|
4712
4714
|
const hubLTemplates = (hubLTemplateData == null ? void 0 : hubLTemplateData.objects.filter(
|
|
4713
4715
|
(template) => isCodedFile(template.filename)
|
|
@@ -4741,14 +4743,14 @@ function getOpenCommand() {
|
|
|
4741
4743
|
}
|
|
4742
4744
|
}
|
|
4743
4745
|
async function handleGetModulePages(req, res, next) {
|
|
4744
|
-
const { path:
|
|
4745
|
-
if (!
|
|
4746
|
+
const { path: path17, portalId } = req.query;
|
|
4747
|
+
if (!path17 || !portalId) {
|
|
4746
4748
|
return res.status(400).json({ error: "Missing required parameters" });
|
|
4747
4749
|
}
|
|
4748
4750
|
try {
|
|
4749
4751
|
const data = await fetchModulePageDependencies(
|
|
4750
4752
|
Number(portalId),
|
|
4751
|
-
|
|
4753
|
+
path17
|
|
4752
4754
|
);
|
|
4753
4755
|
res.json(data);
|
|
4754
4756
|
} catch (err) {
|
|
@@ -4756,13 +4758,13 @@ async function handleGetModulePages(req, res, next) {
|
|
|
4756
4758
|
}
|
|
4757
4759
|
}
|
|
4758
4760
|
function handleOpenFile(req, res, next) {
|
|
4759
|
-
const { path:
|
|
4760
|
-
if (!
|
|
4761
|
+
const { path: path17 } = req.query;
|
|
4762
|
+
if (!path17) {
|
|
4761
4763
|
return res.status(400).json({ error: "Missing required parameters" });
|
|
4762
4764
|
}
|
|
4763
4765
|
try {
|
|
4764
4766
|
const command = getOpenCommand();
|
|
4765
|
-
spawn(command, [
|
|
4767
|
+
spawn(command, [path17], { detached: true }).unref();
|
|
4766
4768
|
res.sendStatus(200);
|
|
4767
4769
|
} catch (err) {
|
|
4768
4770
|
next(err);
|
|
@@ -4777,12 +4779,17 @@ function createAppServerRoutes() {
|
|
|
4777
4779
|
var createAppServerRoutes_default = createAppServerRoutes;
|
|
4778
4780
|
|
|
4779
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;
|
|
4780
4787
|
var STORYBOOK_DOMAINS = VALID_PROXY_DOMAIN_SUFFIXES.map(
|
|
4781
4788
|
(domain2) => `storybook.${domain2}`
|
|
4782
4789
|
);
|
|
4783
4790
|
var createDevServerRoutes = async (viteServer, storybookPort, appServerConfig) => {
|
|
4784
4791
|
const devServerApp = Router2();
|
|
4785
|
-
const { appServer, reqLocals
|
|
4792
|
+
const { appServer, reqLocals } = appServerConfig || {};
|
|
4786
4793
|
devServerApp.use((request2, response, next) => {
|
|
4787
4794
|
const { method, url: url3, hostname } = request2;
|
|
4788
4795
|
debug(`${method}:${hostname}${url3}`);
|
|
@@ -4801,24 +4808,36 @@ var createDevServerRoutes = async (viteServer, storybookPort, appServerConfig) =
|
|
|
4801
4808
|
}
|
|
4802
4809
|
devServerApp.use(urlencoded());
|
|
4803
4810
|
if (appServer) {
|
|
4804
|
-
|
|
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
|
+
}
|
|
4805
4818
|
devServerApp.use(viteServer.middlewares);
|
|
4806
4819
|
devServerApp.use("/api", createAppServerRoutes_default());
|
|
4807
4820
|
devServerApp.get("/", async (req, res) => {
|
|
4808
4821
|
try {
|
|
4809
4822
|
const initialProps = await getDevServerUIData_default(reqLocals, viteServer);
|
|
4810
4823
|
const url3 = req.originalUrl.replace("/", "");
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
)
|
|
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
|
+
}
|
|
4816
4835
|
const rendered = await render(initialProps);
|
|
4817
4836
|
const html = template.replace(`<!--app-head-->`, rendered.head ?? "").replace(`<!--app-html-->`, rendered.html ?? "").replace(
|
|
4818
4837
|
`<!--app-script-->`,
|
|
4819
4838
|
`<script>window.__hsInitialProps = ${JSON.stringify(
|
|
4820
4839
|
initialProps
|
|
4821
|
-
)}
|
|
4840
|
+
)};</script>` ?? ""
|
|
4822
4841
|
);
|
|
4823
4842
|
res.status(200).set({ "Content-Type": "text/html" }).send(html);
|
|
4824
4843
|
} catch (e) {
|
|
@@ -5289,7 +5308,7 @@ async function fetchWebsiteDomainNames(portalId) {
|
|
|
5289
5308
|
}
|
|
5290
5309
|
|
|
5291
5310
|
// src/lib/validateHSPlatform.ts
|
|
5292
|
-
import
|
|
5311
|
+
import path14 from "path";
|
|
5293
5312
|
import fs5 from "fs";
|
|
5294
5313
|
import select from "@inquirer/select";
|
|
5295
5314
|
import { http as hsCliHttp12 } from "@hubspot/local-dev-lib/http";
|
|
@@ -5301,12 +5320,12 @@ function findHSProjectJson(startPath) {
|
|
|
5301
5320
|
let currentDir = startPath;
|
|
5302
5321
|
let dirLevel = 0;
|
|
5303
5322
|
const maxDirLevel = 4;
|
|
5304
|
-
while (
|
|
5305
|
-
const filePath =
|
|
5323
|
+
while (path14.dirname(currentDir) !== currentDir && dirLevel < maxDirLevel) {
|
|
5324
|
+
const filePath = path14.join(currentDir, HSPROJECT_JSON);
|
|
5306
5325
|
if (checkFileExists(filePath)) {
|
|
5307
5326
|
return filePath;
|
|
5308
5327
|
}
|
|
5309
|
-
currentDir =
|
|
5328
|
+
currentDir = path14.dirname(currentDir);
|
|
5310
5329
|
dirLevel++;
|
|
5311
5330
|
}
|
|
5312
5331
|
console.log(
|
|
@@ -5612,7 +5631,7 @@ function writeFieldsType(fields, fileName, typeName) {
|
|
|
5612
5631
|
|
|
5613
5632
|
// src/lib/watchFieldsUpdates.ts
|
|
5614
5633
|
import fs6 from "fs";
|
|
5615
|
-
import
|
|
5634
|
+
import path15 from "path";
|
|
5616
5635
|
import readline from "readline";
|
|
5617
5636
|
var lastSerializedFieldsCache = {};
|
|
5618
5637
|
var formatAsTypeName = (str) => {
|
|
@@ -5624,9 +5643,9 @@ var isInModulesFolder = (filePath, projectRoot) => {
|
|
|
5624
5643
|
const getEntryPathFromId = (id) => {
|
|
5625
5644
|
return id.startsWith(projectRoot) ? id.replace(`${projectRoot}/`, "") : "";
|
|
5626
5645
|
};
|
|
5627
|
-
const currentModuleId =
|
|
5646
|
+
const currentModuleId = path15.normalize(filePath);
|
|
5628
5647
|
const moduleEntryPath = getEntryPathFromId(currentModuleId);
|
|
5629
|
-
const subFolderTokens = moduleEntryPath.split(
|
|
5648
|
+
const subFolderTokens = moduleEntryPath.split(path15.sep);
|
|
5630
5649
|
return {
|
|
5631
5650
|
inModuleFolder: subFolderTokens[0] === "components" && subFolderTokens[1] === "modules",
|
|
5632
5651
|
isRootModuleFile: subFolderTokens.length === 3
|
|
@@ -5653,10 +5672,10 @@ var getIndexFile = (filePath, projectRoot) => {
|
|
|
5653
5672
|
return void 0;
|
|
5654
5673
|
if (isRootModuleFile)
|
|
5655
5674
|
return { indexFilePath: filePath, isRootModuleFile };
|
|
5656
|
-
const dir =
|
|
5675
|
+
const dir = path15.dirname(filePath);
|
|
5657
5676
|
const files = fs6.readdirSync(dir);
|
|
5658
5677
|
const indexFileName = files.find((file) => file.startsWith("index."));
|
|
5659
|
-
return indexFileName ? { indexFilePath:
|
|
5678
|
+
return indexFileName ? { indexFilePath: path15.join(dir, indexFileName), isRootModuleFile } : void 0;
|
|
5660
5679
|
};
|
|
5661
5680
|
var getIndexFileFields = async (indexFilePath, indexFileName, viteServer) => {
|
|
5662
5681
|
let indexFile;
|
|
@@ -5680,7 +5699,7 @@ var maybeUpdateFields = async (filePath, viteServer, projectRoot) => {
|
|
|
5680
5699
|
if (!indexInfo)
|
|
5681
5700
|
return;
|
|
5682
5701
|
const { indexFilePath, isRootModuleFile } = indexInfo;
|
|
5683
|
-
const indexFileName =
|
|
5702
|
+
const indexFileName = path15.parse(indexFilePath).name;
|
|
5684
5703
|
const isTypeFile = filePath.endsWith(".types.ts");
|
|
5685
5704
|
if (isTypeFile)
|
|
5686
5705
|
return;
|
|
@@ -5691,7 +5710,7 @@ var maybeUpdateFields = async (filePath, viteServer, projectRoot) => {
|
|
|
5691
5710
|
);
|
|
5692
5711
|
if (fields) {
|
|
5693
5712
|
const typeFileName = isRootModuleFile ? `${indexFileName}.fields.types.ts` : "fields.type.ts";
|
|
5694
|
-
const typeFilePath =
|
|
5713
|
+
const typeFilePath = path15.join(path15.dirname(filePath), typeFileName);
|
|
5695
5714
|
const lastSerializedFields = lastSerializedFieldsCache[typeFilePath];
|
|
5696
5715
|
const serializedFields = JSON.stringify(fields);
|
|
5697
5716
|
if (lastSerializedFields === serializedFields)
|
|
@@ -5699,7 +5718,7 @@ var maybeUpdateFields = async (filePath, viteServer, projectRoot) => {
|
|
|
5699
5718
|
const hasAutoGenComment = await fileContainsAutoGenComment(typeFilePath);
|
|
5700
5719
|
if (!hasAutoGenComment)
|
|
5701
5720
|
return;
|
|
5702
|
-
const moduleFolderName =
|
|
5721
|
+
const moduleFolderName = path15.basename(path15.dirname(filePath));
|
|
5703
5722
|
const outputTypeName = formatAsTypeName(moduleFolderName);
|
|
5704
5723
|
const didSucceed = writeFieldsType(fields, typeFilePath, outputTypeName);
|
|
5705
5724
|
if (didSucceed) {
|
|
@@ -5715,7 +5734,7 @@ var maybeUpdateFields = async (filePath, viteServer, projectRoot) => {
|
|
|
5715
5734
|
var startFieldsTypeGenWatcher = (viteServer, projectRoot) => {
|
|
5716
5735
|
const { moduleSubpaths } = findAllModulesInRoot(projectRoot);
|
|
5717
5736
|
moduleSubpaths.forEach((modulePath) => {
|
|
5718
|
-
const resolvedPath =
|
|
5737
|
+
const resolvedPath = path15.resolve(projectRoot, modulePath);
|
|
5719
5738
|
maybeUpdateFields(resolvedPath, viteServer, projectRoot);
|
|
5720
5739
|
});
|
|
5721
5740
|
const watchCallback = (filePath) => maybeUpdateFields(filePath, viteServer, projectRoot);
|
|
@@ -5853,7 +5872,7 @@ Local proxy functionality and module preview routes will not work without settin
|
|
|
5853
5872
|
} catch (e) {
|
|
5854
5873
|
authedHublet = "na1";
|
|
5855
5874
|
}
|
|
5856
|
-
const absoluteWebRoot = normalizePath9(
|
|
5875
|
+
const absoluteWebRoot = normalizePath9(path16.resolve(process.cwd(), webRoot2));
|
|
5857
5876
|
const [__webRootProjectFolder, webRootProjectComponentFolder] = absoluteWebRoot.replace(/\/$/, "").split("/").slice(-2);
|
|
5858
5877
|
const projectConfigPath = findHSProjectJson(absoluteWebRoot);
|
|
5859
5878
|
if (authedPortalId) {
|
|
@@ -5907,8 +5926,8 @@ Local proxy functionality and module preview routes will not work without settin
|
|
|
5907
5926
|
expressServer.use(bodyParser.json());
|
|
5908
5927
|
let appServerConfig = null;
|
|
5909
5928
|
if (showUI2) {
|
|
5910
|
-
const appWebRoot =
|
|
5911
|
-
|
|
5929
|
+
const appWebRoot = path16.join(
|
|
5930
|
+
path16.dirname(url2.fileURLToPath(import.meta.url)),
|
|
5912
5931
|
"../app"
|
|
5913
5932
|
);
|
|
5914
5933
|
const reqLocals = {
|
|
@@ -5979,8 +5998,8 @@ HubSpot CMS dev server hosting: ${projectName}/${expressServer.locals.projectCom
|
|
|
5979
5998
|
`
|
|
5980
5999
|
);
|
|
5981
6000
|
if (storybook2) {
|
|
5982
|
-
const packageRoot =
|
|
5983
|
-
const configPath =
|
|
6001
|
+
const packageRoot = path16.dirname(url2.fileURLToPath(import.meta.url));
|
|
6002
|
+
const configPath = path16.resolve(packageRoot, "./storybook-main");
|
|
5984
6003
|
sendTrackingRequest("start-storybook");
|
|
5985
6004
|
const storybookProcess = spawn2(
|
|
5986
6005
|
"sb",
|
|
@@ -6000,7 +6019,7 @@ HubSpot CMS dev server hosting: ${projectName}/${expressServer.locals.projectCom
|
|
|
6000
6019
|
portalId: authedPortalId.toString(),
|
|
6001
6020
|
hsEnv: authedEnv,
|
|
6002
6021
|
hublet: authedHublet,
|
|
6003
|
-
WEB_ROOT:
|
|
6022
|
+
WEB_ROOT: path16.join(webRoot2, "components")
|
|
6004
6023
|
}
|
|
6005
6024
|
}
|
|
6006
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",
|
|
@@ -37,8 +37,7 @@
|
|
|
37
37
|
"@radix-ui/react-separator": "^1.1.0",
|
|
38
38
|
"@radix-ui/react-slot": "^1.1.0",
|
|
39
39
|
"@radix-ui/react-tooltip": "^1.1.4",
|
|
40
|
-
"@sentry/node": "^
|
|
41
|
-
"@sentry/profiling-node": "^8.37.1",
|
|
40
|
+
"@sentry/node": "^6.2.0",
|
|
42
41
|
"@storybook/addon-actions": "7.1.1",
|
|
43
42
|
"@storybook/addon-essentials": "7.1.1",
|
|
44
43
|
"@storybook/addon-interactions": "7.1.1",
|
|
@@ -132,5 +131,5 @@
|
|
|
132
131
|
"publishConfig": {
|
|
133
132
|
"access": "public"
|
|
134
133
|
},
|
|
135
|
-
"gitHead": "
|
|
134
|
+
"gitHead": "29aa57588f20ed6bde2b24615e18dea79178d7ad"
|
|
136
135
|
}
|
package/dist/.DS_Store
DELETED
|
Binary file
|