@hubspot/cms-dev-server 0.18.3 → 0.18.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generateJsonFromJsx.js +99 -69
- package/dist/index.js +139 -84
- package/dist/internalSsr.js +103 -73
- package/dist/run.js +139 -84
- package/dist/storybook/index.js +4 -4
- package/dist/storybook-main/main.js +108 -78
- package/package.json +3 -3
- package/types/createAppServer.d.ts +1 -1
- package/types/transformJsxToJson.d.ts +4 -0
- package/dist/generateJsonFromJsx.js.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/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/types/island-runtime.d.ts +0 -2
package/dist/run.js
CHANGED
|
@@ -743,7 +743,7 @@ async function buildThemePreviewOptions(webRoot2) {
|
|
|
743
743
|
// src/createDevServer.ts
|
|
744
744
|
import path14 from "path";
|
|
745
745
|
import url3 from "url";
|
|
746
|
-
import
|
|
746
|
+
import express3 from "express";
|
|
747
747
|
import http3 from "http";
|
|
748
748
|
import bodyParser from "body-parser";
|
|
749
749
|
import { spawn } from "child_process";
|
|
@@ -790,7 +790,7 @@ function packagePath(metaUrl, projectPath) {
|
|
|
790
790
|
);
|
|
791
791
|
}
|
|
792
792
|
|
|
793
|
-
// ../cms-js-internal/dist/
|
|
793
|
+
// ../cms-js-internal/dist/types-BXr0V0Zd.js
|
|
794
794
|
import path3 from "path";
|
|
795
795
|
import { createHash } from "crypto";
|
|
796
796
|
import fs2, { readFileSync, existsSync as existsSync2, readdirSync, lstatSync } from "fs";
|
|
@@ -1159,7 +1159,7 @@ function filterOutUnreadSupplementalFieldValues(supplementalFieldValues, supplem
|
|
|
1159
1159
|
return result;
|
|
1160
1160
|
}
|
|
1161
1161
|
var writeSharedStateToJsGlobal = (islands, perServerRequestData, indent = 0, prettyPrint) => {
|
|
1162
|
-
const sharedStateIDs = islands.map((island) => island.sharedStateID).filter((
|
|
1162
|
+
const sharedStateIDs = islands.map((island) => island.sharedStateID).filter((x2) => !!x2);
|
|
1163
1163
|
if (sharedStateIDs.length > 0) {
|
|
1164
1164
|
const indentString = " ".repeat(indent);
|
|
1165
1165
|
const stateByID = {};
|
|
@@ -1270,8 +1270,9 @@ function noncePlaceholderPlugin() {
|
|
|
1270
1270
|
}
|
|
1271
1271
|
var traverse = _traverse.default;
|
|
1272
1272
|
var CMS_MODULE_COMPONENT_NAME = "Module";
|
|
1273
|
+
var DND_AREA_COMPONENT_NAME = "DndArea";
|
|
1273
1274
|
var PLUGIN_NAME = "findCmsModules";
|
|
1274
|
-
function findCmsModules(
|
|
1275
|
+
function findCmsModules(buildContentDescriptors = {}) {
|
|
1275
1276
|
let config;
|
|
1276
1277
|
return {
|
|
1277
1278
|
enforce: "pre",
|
|
@@ -1283,20 +1284,20 @@ function findCmsModules(cmsModules = {}) {
|
|
|
1283
1284
|
const moduleInfo = this.getModuleInfo(id);
|
|
1284
1285
|
if (shouldSkipModule(config, moduleInfo, code))
|
|
1285
1286
|
return null;
|
|
1286
|
-
const
|
|
1287
|
+
const contentDescriptors = analyzeSourceCodeUsages(
|
|
1287
1288
|
this,
|
|
1288
1289
|
moduleInfo,
|
|
1289
1290
|
config,
|
|
1290
1291
|
code
|
|
1291
1292
|
);
|
|
1292
|
-
if (
|
|
1293
|
-
return
|
|
1293
|
+
if (Object.keys(contentDescriptors.dndAreas).length > 0 || Object.keys(contentDescriptors.modules).length > 0) {
|
|
1294
|
+
return {
|
|
1295
|
+
meta: {
|
|
1296
|
+
findCmsModules: contentDescriptors
|
|
1297
|
+
}
|
|
1298
|
+
};
|
|
1294
1299
|
}
|
|
1295
|
-
return
|
|
1296
|
-
meta: {
|
|
1297
|
-
findCmsModules: localCmsModules
|
|
1298
|
-
}
|
|
1299
|
-
};
|
|
1300
|
+
return null;
|
|
1300
1301
|
},
|
|
1301
1302
|
buildEnd(error) {
|
|
1302
1303
|
if (error)
|
|
@@ -1335,7 +1336,7 @@ function findCmsModules(cmsModules = {}) {
|
|
|
1335
1336
|
${JSON.stringify(modulesWithinModules, null, 2)}
|
|
1336
1337
|
`);
|
|
1337
1338
|
}
|
|
1338
|
-
Object.assign(
|
|
1339
|
+
Object.assign(buildContentDescriptors, relativeEntryPointCmsModuleMap);
|
|
1339
1340
|
}
|
|
1340
1341
|
};
|
|
1341
1342
|
}
|
|
@@ -1349,14 +1350,16 @@ function convertEntryPointPathsToRelative(config, entryPointsCmsModuleMap) {
|
|
|
1349
1350
|
}
|
|
1350
1351
|
function convertEntryPointIslandPathsToRelative(config, entryPointsCmsModuleMap) {
|
|
1351
1352
|
const relativeEntries = Object.entries(entryPointsCmsModuleMap).map(
|
|
1352
|
-
([entryPointPath,
|
|
1353
|
+
([entryPointPath, islandContentDescriptors]) => {
|
|
1353
1354
|
const islandCmsModuleUsage = Object.fromEntries(
|
|
1354
|
-
Object.entries(
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1355
|
+
Object.entries(islandContentDescriptors).map(
|
|
1356
|
+
([islandPath, contentDescriptors]) => {
|
|
1357
|
+
return [
|
|
1358
|
+
toRelativePath(config, islandPath).replace("?client-entry", ""),
|
|
1359
|
+
contentDescriptors
|
|
1360
|
+
];
|
|
1361
|
+
}
|
|
1362
|
+
)
|
|
1360
1363
|
);
|
|
1361
1364
|
return [toRelativePath(config, entryPointPath), islandCmsModuleUsage];
|
|
1362
1365
|
}
|
|
@@ -1368,7 +1371,7 @@ function toRelativePath(config, path15) {
|
|
|
1368
1371
|
}
|
|
1369
1372
|
function shouldSkipModule(config, moduleInfo, code) {
|
|
1370
1373
|
const isExternal = config.command !== "serve" && moduleInfo.isExternal;
|
|
1371
|
-
return isExternal || !moduleInfo.id.startsWith(config.root) || !code.includes(CMS_MODULE_COMPONENT_NAME);
|
|
1374
|
+
return isExternal || !moduleInfo.id.startsWith(config.root) || !(code.includes(CMS_MODULE_COMPONENT_NAME) || code.includes(DND_AREA_COMPONENT_NAME));
|
|
1372
1375
|
}
|
|
1373
1376
|
function getEntryPoints(ctx, config) {
|
|
1374
1377
|
return Array.from(ctx.getModuleIds()).filter((moduleId) => moduleId.startsWith(config.root)).map((moduleId) => ctx.getModuleInfo(moduleId)).filter((moduleInfo) => moduleInfo.isEntry);
|
|
@@ -1398,9 +1401,9 @@ function analyzeSourceCodeUsages(ctx, moduleInfo, config, code) {
|
|
|
1398
1401
|
sourceType: "module",
|
|
1399
1402
|
plugins: ["jsx", "typescript"]
|
|
1400
1403
|
});
|
|
1401
|
-
const
|
|
1402
|
-
let moduleUsed = false;
|
|
1404
|
+
const contentDescriptors = { modules: {}, dndAreas: {} };
|
|
1403
1405
|
let moduleComponentLocalImportName = CMS_MODULE_COMPONENT_NAME;
|
|
1406
|
+
let dndAreaComponentLocalImportName = DND_AREA_COMPONENT_NAME;
|
|
1404
1407
|
traverse(sourceAst, {
|
|
1405
1408
|
ImportDeclaration(path15) {
|
|
1406
1409
|
if (t.isStringLiteral(path15.node.source, {
|
|
@@ -1412,69 +1415,96 @@ function analyzeSourceCodeUsages(ctx, moduleInfo, config, code) {
|
|
|
1412
1415
|
})) {
|
|
1413
1416
|
moduleComponentLocalImportName = specifier.local.name;
|
|
1414
1417
|
}
|
|
1418
|
+
if (t.isImportSpecifier(specifier) && t.isIdentifier(specifier.imported, {
|
|
1419
|
+
name: DND_AREA_COMPONENT_NAME
|
|
1420
|
+
})) {
|
|
1421
|
+
dndAreaComponentLocalImportName = specifier.local.name;
|
|
1422
|
+
}
|
|
1415
1423
|
}
|
|
1416
1424
|
}
|
|
1417
1425
|
},
|
|
1418
1426
|
JSXOpeningElement(path15) {
|
|
1419
|
-
if (
|
|
1427
|
+
if (t.isJSXIdentifier(path15.node.name, {
|
|
1420
1428
|
name: moduleComponentLocalImportName
|
|
1421
1429
|
})) {
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1430
|
+
let cmsModuleName;
|
|
1431
|
+
let cmsModulePath;
|
|
1432
|
+
let cmsModuleLabel;
|
|
1433
|
+
for (const prop of path15.node.attributes) {
|
|
1434
|
+
if (t.isJSXAttribute(prop) && t.isJSXIdentifier(prop.name, { name: "name" }) && t.isStringLiteral(prop.value)) {
|
|
1435
|
+
cmsModuleName = prop.value.value;
|
|
1436
|
+
continue;
|
|
1437
|
+
}
|
|
1438
|
+
if (t.isJSXAttribute(prop) && t.isJSXIdentifier(prop.name, { name: "path" }) && t.isStringLiteral(prop.value)) {
|
|
1439
|
+
cmsModulePath = prop.value.value;
|
|
1440
|
+
continue;
|
|
1441
|
+
}
|
|
1442
|
+
if (t.isJSXAttribute(prop) && t.isJSXIdentifier(prop.name, { name: "label" }) && t.isStringLiteral(prop.value)) {
|
|
1443
|
+
cmsModuleLabel = prop.value.value;
|
|
1444
|
+
continue;
|
|
1445
|
+
}
|
|
1446
|
+
ctx.error(
|
|
1447
|
+
new Error(
|
|
1448
|
+
`Error: ${moduleInfo.id.replace(config.root, "")}:${prop.loc.start.line} "name" and "path" must be primitive strings`
|
|
1449
|
+
)
|
|
1450
|
+
);
|
|
1432
1451
|
}
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1452
|
+
const cmsModuleProps = {
|
|
1453
|
+
name: cmsModuleName,
|
|
1454
|
+
path: cmsModulePath
|
|
1455
|
+
};
|
|
1456
|
+
if (cmsModuleLabel) {
|
|
1457
|
+
cmsModuleProps.label = cmsModuleLabel;
|
|
1436
1458
|
}
|
|
1437
|
-
if (
|
|
1438
|
-
|
|
1439
|
-
|
|
1459
|
+
if (Object.hasOwn(contentDescriptors.modules, cmsModuleProps.name)) {
|
|
1460
|
+
ctx.error(
|
|
1461
|
+
new Error(
|
|
1462
|
+
`Error: multiple <${CMS_MODULE_COMPONENT_NAME} /> with duplicate name: ${cmsModuleProps.name}`
|
|
1463
|
+
)
|
|
1464
|
+
);
|
|
1440
1465
|
}
|
|
1441
|
-
|
|
1442
|
-
new Error(
|
|
1443
|
-
`Error: ${moduleInfo.id.replace(config.root, "")}:${prop.loc.start.line} "name" and "path" must be primitive strings`
|
|
1444
|
-
)
|
|
1445
|
-
);
|
|
1446
|
-
}
|
|
1447
|
-
const cmsModuleProps = {
|
|
1448
|
-
name: cmsModuleName,
|
|
1449
|
-
path: cmsModulePath
|
|
1450
|
-
};
|
|
1451
|
-
if (cmsModuleLabel) {
|
|
1452
|
-
cmsModuleProps.label = cmsModuleLabel;
|
|
1466
|
+
contentDescriptors.modules[cmsModuleProps.name] = cmsModuleProps;
|
|
1453
1467
|
}
|
|
1454
|
-
if (
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1468
|
+
if (t.isJSXIdentifier(path15.node.name, {
|
|
1469
|
+
name: dndAreaComponentLocalImportName
|
|
1470
|
+
})) {
|
|
1471
|
+
let dndAreaName;
|
|
1472
|
+
for (const prop of path15.node.attributes) {
|
|
1473
|
+
if (t.isJSXAttribute(prop) && t.isJSXIdentifier(prop.name, { name: "name" }) && t.isStringLiteral(prop.value)) {
|
|
1474
|
+
dndAreaName = prop.value.value;
|
|
1475
|
+
continue;
|
|
1476
|
+
}
|
|
1477
|
+
ctx.error(
|
|
1478
|
+
new Error(
|
|
1479
|
+
`Error: ${moduleInfo.id.replace(config.root, "")}:${prop.loc.start.line} "name" must a primitive string`
|
|
1480
|
+
)
|
|
1481
|
+
);
|
|
1482
|
+
}
|
|
1483
|
+
const dndArea = {
|
|
1484
|
+
name: dndAreaName
|
|
1485
|
+
};
|
|
1486
|
+
if (Object.hasOwn(contentDescriptors.dndAreas, dndArea.name)) {
|
|
1487
|
+
ctx.error(
|
|
1488
|
+
new Error(
|
|
1489
|
+
`Error: multiple <${DND_AREA_COMPONENT_NAME} /> with duplicate name: ${dndArea.name}`
|
|
1490
|
+
)
|
|
1491
|
+
);
|
|
1492
|
+
}
|
|
1493
|
+
contentDescriptors.dndAreas[dndArea.name] = dndArea;
|
|
1460
1494
|
}
|
|
1461
|
-
localCmsModules[cmsModuleProps.name] = cmsModuleProps;
|
|
1462
1495
|
}
|
|
1463
1496
|
});
|
|
1464
|
-
return
|
|
1465
|
-
moduleUsed,
|
|
1466
|
-
localCmsModules
|
|
1467
|
-
};
|
|
1497
|
+
return contentDescriptors;
|
|
1468
1498
|
}
|
|
1469
1499
|
function findCmsModuleUsages(ctx, moduleId, processed = /* @__PURE__ */ new Set(), result = {}) {
|
|
1470
1500
|
if (Object.hasOwn(result, moduleId)) {
|
|
1471
1501
|
return result[moduleId];
|
|
1472
1502
|
}
|
|
1473
1503
|
const moduleInfo = ctx.getModuleInfo(moduleId);
|
|
1474
|
-
let
|
|
1504
|
+
let entryPointContentDescriptors = null;
|
|
1475
1505
|
if (Object.hasOwn(moduleInfo.meta, PLUGIN_NAME)) {
|
|
1476
|
-
|
|
1477
|
-
...
|
|
1506
|
+
entryPointContentDescriptors = {
|
|
1507
|
+
...entryPointContentDescriptors,
|
|
1478
1508
|
...moduleInfo.meta[PLUGIN_NAME]
|
|
1479
1509
|
};
|
|
1480
1510
|
}
|
|
@@ -1492,17 +1522,17 @@ function findCmsModuleUsages(ctx, moduleId, processed = /* @__PURE__ */ new Set(
|
|
|
1492
1522
|
result
|
|
1493
1523
|
);
|
|
1494
1524
|
if (importedResult) {
|
|
1495
|
-
|
|
1496
|
-
...
|
|
1525
|
+
entryPointContentDescriptors = {
|
|
1526
|
+
...entryPointContentDescriptors,
|
|
1497
1527
|
...importedResult
|
|
1498
1528
|
};
|
|
1499
1529
|
}
|
|
1500
1530
|
}
|
|
1501
|
-
if (
|
|
1502
|
-
result[moduleId] =
|
|
1531
|
+
if (entryPointContentDescriptors) {
|
|
1532
|
+
result[moduleId] = entryPointContentDescriptors;
|
|
1503
1533
|
}
|
|
1504
1534
|
processed.add(moduleId);
|
|
1505
|
-
return
|
|
1535
|
+
return entryPointContentDescriptors;
|
|
1506
1536
|
}
|
|
1507
1537
|
function findIslandCmsModuleUsage(ctx, moduleId, processedIslands = /* @__PURE__ */ new Set(), islandModuleResults = {}, processed = /* @__PURE__ */ new Set(), results = {}) {
|
|
1508
1538
|
processedIslands.add(moduleId);
|
|
@@ -2023,7 +2053,7 @@ function trackUsage(action) {
|
|
|
2023
2053
|
eventName: EVENT_NAME,
|
|
2024
2054
|
action,
|
|
2025
2055
|
nodeVersion: getNodeVersionData(),
|
|
2026
|
-
version: "0.18.
|
|
2056
|
+
version: "0.18.5",
|
|
2027
2057
|
os: getPlatform()
|
|
2028
2058
|
};
|
|
2029
2059
|
const url4 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
|
|
@@ -4775,16 +4805,20 @@ Custom origin: ${process.env.VITE_ORIGIN}
|
|
|
4775
4805
|
var createViteDevServer_default = createViteDevServer;
|
|
4776
4806
|
|
|
4777
4807
|
// src/createAppServer.ts
|
|
4808
|
+
import fs4 from "node:fs/promises";
|
|
4809
|
+
import express2 from "express";
|
|
4778
4810
|
import { createServer as createViteServer2 } from "vite";
|
|
4779
4811
|
import { default as react2 } from "@vitejs/plugin-react";
|
|
4780
4812
|
async function createAppServer(webRoot2, port) {
|
|
4813
|
+
const app = express2();
|
|
4781
4814
|
const origin = `http://hslocal.net:${port}`;
|
|
4782
4815
|
const viteConfig = {
|
|
4783
4816
|
server: {
|
|
4784
|
-
middlewareMode:
|
|
4817
|
+
middlewareMode: true,
|
|
4785
4818
|
host: "hslocal.net",
|
|
4786
4819
|
origin
|
|
4787
4820
|
},
|
|
4821
|
+
appType: "custom",
|
|
4788
4822
|
root: webRoot2,
|
|
4789
4823
|
ssr: {
|
|
4790
4824
|
noExternal: "@hubspot/cms-components"
|
|
@@ -4818,7 +4852,29 @@ async function createAppServer(webRoot2, port) {
|
|
|
4818
4852
|
envDir: webRoot2,
|
|
4819
4853
|
envPrefix: "HS_"
|
|
4820
4854
|
};
|
|
4821
|
-
|
|
4855
|
+
const viteServer = await createViteServer2(viteConfig);
|
|
4856
|
+
app.use(viteServer.middlewares);
|
|
4857
|
+
app.use("*", async (req, res) => {
|
|
4858
|
+
try {
|
|
4859
|
+
const url4 = req.originalUrl.replace("/", "");
|
|
4860
|
+
let template = await fs4.readFile("./app/index.html", "utf-8");
|
|
4861
|
+
template = await viteServer.transformIndexHtml(url4, template);
|
|
4862
|
+
const { render } = await viteServer.ssrLoadModule(
|
|
4863
|
+
"./app/serverEntry.tsx"
|
|
4864
|
+
);
|
|
4865
|
+
const rendered = await render(url4);
|
|
4866
|
+
const html = template.replace(`<!--app-head-->`, rendered.head ?? "").replace(`<!--app-html-->`, rendered.html ?? "");
|
|
4867
|
+
res.status(200).set({ "Content-Type": "text/html" }).send(html);
|
|
4868
|
+
} catch (e) {
|
|
4869
|
+
viteServer == null ? void 0 : viteServer.ssrFixStacktrace(e);
|
|
4870
|
+
console.log(e.stack);
|
|
4871
|
+
res.status(500).end(e.stack);
|
|
4872
|
+
}
|
|
4873
|
+
});
|
|
4874
|
+
app.listen(port, () => {
|
|
4875
|
+
console.log(`Server started at http://localhost:${port}`);
|
|
4876
|
+
});
|
|
4877
|
+
return app;
|
|
4822
4878
|
}
|
|
4823
4879
|
var createAppServer_default = createAppServer;
|
|
4824
4880
|
|
|
@@ -4982,12 +5038,12 @@ async function fetchWebsiteDomainNames(portalId) {
|
|
|
4982
5038
|
|
|
4983
5039
|
// src/lib/validateHSPlatform.ts
|
|
4984
5040
|
import path12 from "path";
|
|
4985
|
-
import
|
|
5041
|
+
import fs5 from "fs";
|
|
4986
5042
|
import select from "@inquirer/select";
|
|
4987
5043
|
import { http as hsCliHttp12 } from "@hubspot/local-dev-lib/http";
|
|
4988
5044
|
var HSPROJECT_JSON = "hsproject.json";
|
|
4989
5045
|
function checkFileExists(filePath) {
|
|
4990
|
-
return
|
|
5046
|
+
return fs5.existsSync(filePath) && fs5.statSync(filePath).isFile();
|
|
4991
5047
|
}
|
|
4992
5048
|
function findHSProjectJson(startPath) {
|
|
4993
5049
|
let currentDir = startPath;
|
|
@@ -5013,7 +5069,7 @@ async function validateHSPlatform(projectConfigPath, portalId) {
|
|
|
5013
5069
|
);
|
|
5014
5070
|
return false;
|
|
5015
5071
|
}
|
|
5016
|
-
const hsProjectJSONContents =
|
|
5072
|
+
const hsProjectJSONContents = fs5.readFileSync(projectConfigPath, "utf8");
|
|
5017
5073
|
const hsProjectJSONData = JSON.parse(hsProjectJSONContents);
|
|
5018
5074
|
const { platformVersion } = hsProjectJSONData;
|
|
5019
5075
|
let platformVersionResult;
|
|
@@ -5041,7 +5097,7 @@ async function validateHSPlatform(projectConfigPath, portalId) {
|
|
|
5041
5097
|
});
|
|
5042
5098
|
hsProjectJSONData.platformVersion = answer;
|
|
5043
5099
|
try {
|
|
5044
|
-
|
|
5100
|
+
fs5.writeFileSync(
|
|
5045
5101
|
projectConfigPath,
|
|
5046
5102
|
JSON.stringify(hsProjectJSONData, void 0, 2),
|
|
5047
5103
|
"utf8"
|
|
@@ -5303,7 +5359,7 @@ function writeFieldsType(fields, fileName, typeName) {
|
|
|
5303
5359
|
}
|
|
5304
5360
|
|
|
5305
5361
|
// src/lib/watchFieldsUpdates.ts
|
|
5306
|
-
import
|
|
5362
|
+
import fs6 from "fs";
|
|
5307
5363
|
import path13 from "path";
|
|
5308
5364
|
import readline from "readline";
|
|
5309
5365
|
var lastSerializedFieldsCache = {};
|
|
@@ -5325,9 +5381,9 @@ var isInModulesFolder = (filePath, projectRoot) => {
|
|
|
5325
5381
|
};
|
|
5326
5382
|
};
|
|
5327
5383
|
var fileContainsAutoGenComment = async (filePath) => {
|
|
5328
|
-
if (!
|
|
5384
|
+
if (!fs6.existsSync(filePath))
|
|
5329
5385
|
return true;
|
|
5330
|
-
const stream2 =
|
|
5386
|
+
const stream2 = fs6.createReadStream(filePath);
|
|
5331
5387
|
const reader = readline.createInterface({ input: stream2 });
|
|
5332
5388
|
const firstLine = await new Promise(
|
|
5333
5389
|
(resolve3) => reader.once("line", (line) => resolve3(line.trim()))
|
|
@@ -5346,7 +5402,7 @@ var getIndexFile = (filePath, projectRoot) => {
|
|
|
5346
5402
|
if (isRootModuleFile)
|
|
5347
5403
|
return { indexFilePath: filePath, isRootModuleFile };
|
|
5348
5404
|
const dir = path13.dirname(filePath);
|
|
5349
|
-
const files =
|
|
5405
|
+
const files = fs6.readdirSync(dir);
|
|
5350
5406
|
const indexFileName = files.find((file) => file.startsWith("index."));
|
|
5351
5407
|
return indexFileName ? { indexFilePath: path13.join(dir, indexFileName), isRootModuleFile } : void 0;
|
|
5352
5408
|
};
|
|
@@ -5581,7 +5637,7 @@ Local proxy functionality and module preview routes will not work without settin
|
|
|
5581
5637
|
const httpsCert = viteHTTPSConfig ? viteHTTPSConfig.cert : null;
|
|
5582
5638
|
const projectName = projectConfigPath ? getProjectNameFromHSConfig(projectConfigPath) : "";
|
|
5583
5639
|
const httpServers = [];
|
|
5584
|
-
const expressServer =
|
|
5640
|
+
const expressServer = express3();
|
|
5585
5641
|
expressServer.locals.devServerHost = "hslocal.net";
|
|
5586
5642
|
expressServer.locals.devServerPort = PORT;
|
|
5587
5643
|
expressServer.locals.webRoot = webRoot2;
|
|
@@ -5642,7 +5698,6 @@ HubSpot CMS dev server hosting: ${projectName}/${expressServer.locals.projectCom
|
|
|
5642
5698
|
"../app"
|
|
5643
5699
|
);
|
|
5644
5700
|
const appServer = await createAppServer_default(appWebRoot, PORT + 1);
|
|
5645
|
-
await appServer.listen(PORT + 1);
|
|
5646
5701
|
httpServers.push(appServer);
|
|
5647
5702
|
}
|
|
5648
5703
|
if (storybook2) {
|
package/dist/storybook/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/storybook/moduleStory.tsx
|
|
2
2
|
import { useEffect } from "react";
|
|
3
3
|
|
|
4
|
-
// ../cms-js-internal/dist/
|
|
4
|
+
// ../cms-js-internal/dist/types-BXr0V0Zd.js
|
|
5
5
|
function namespaceModulePropsShape(props) {
|
|
6
6
|
const {
|
|
7
7
|
dataQueryResult,
|
|
@@ -73,9 +73,9 @@ function renderFieldsToJson(fields, moduleName) {
|
|
|
73
73
|
);
|
|
74
74
|
}
|
|
75
75
|
return fieldsJSON;
|
|
76
|
-
} catch (
|
|
77
|
-
|
|
78
|
-
throw
|
|
76
|
+
} catch (e2) {
|
|
77
|
+
e2.message = `Error when rendering fields for ${moduleName}: ${e2.message}`;
|
|
78
|
+
throw e2;
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
|