@hubspot/cms-dev-server 0.10.4 → 0.11.0
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/fsevents-72LCIACT.node +0 -0
- package/dist/index.js +24 -3
- package/dist/internalSsr.js +8 -3
- package/dist/run.js +166 -25
- package/dist/storybook/index.js +4 -2
- package/dist/storybook-main/main.js +8 -3
- package/package.json +3 -3
- package/types/createViteDevServer.d.ts +1 -1
- package/types/generateBpmAliases.d.ts +2 -0
- package/types/noNodeBuiltinsPlugin.d.ts +3 -0
- package/types/plugins/devSecretsPlugin.d.ts +2 -0
- package/types/resolveSharedDeps.d.ts +2 -0
|
Binary file
|
package/dist/index.js
CHANGED
|
@@ -80,7 +80,25 @@ function clientIslandEntryPlugin() {
|
|
|
80
80
|
import mkcert from "vite-plugin-mkcert";
|
|
81
81
|
import { viteCommonjs } from "@originjs/vite-plugin-commonjs";
|
|
82
82
|
import { default as Inspect } from "vite-plugin-inspect";
|
|
83
|
-
|
|
83
|
+
|
|
84
|
+
// src/plugins/devSecretsPlugin.ts
|
|
85
|
+
function devSecretsPlugin(secretNames) {
|
|
86
|
+
return {
|
|
87
|
+
name: "dev-secrets",
|
|
88
|
+
configureServer: {
|
|
89
|
+
order: "post",
|
|
90
|
+
async handler(server) {
|
|
91
|
+
const cmsComponents = await server.ssrLoadModule(
|
|
92
|
+
"@hubspot/cms-components"
|
|
93
|
+
);
|
|
94
|
+
cmsComponents.setSecretsFromEnv(secretNames);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// src/createViteDevServer.ts
|
|
101
|
+
async function createViteDevServer(webRoot, port, sslEnabled, domainsToProxy = [], __jsRenderingGates, secretNames) {
|
|
84
102
|
const additionalMkcertHosts = domainsToProxy.map((proxyDomain) => [
|
|
85
103
|
`${proxyDomain}.localhost`,
|
|
86
104
|
`${proxyDomain}.hslocal.net`
|
|
@@ -129,11 +147,14 @@ Custom origin: ${process.env.VITE_ORIGIN}
|
|
|
129
147
|
clientIslandEntryPlugin(),
|
|
130
148
|
resolveIslandPlugin(),
|
|
131
149
|
viteCommonjs(),
|
|
132
|
-
Inspect()
|
|
150
|
+
Inspect(),
|
|
151
|
+
devSecretsPlugin(secretNames)
|
|
133
152
|
],
|
|
134
153
|
css: {
|
|
135
154
|
postcss: webRoot
|
|
136
|
-
}
|
|
155
|
+
},
|
|
156
|
+
envDir: webRoot,
|
|
157
|
+
envPrefix: "HS_"
|
|
137
158
|
};
|
|
138
159
|
return createViteServer(viteConfig);
|
|
139
160
|
}
|
package/dist/internalSsr.js
CHANGED
|
@@ -402,7 +402,10 @@ function getIslandRuntimeConfigUrl() {
|
|
|
402
402
|
const fileVersion = hsEnv === "prod" ? `island-runtime.mjs` : "island-runtime-qa.mjs";
|
|
403
403
|
return `${ISLAND_RUNTIME_CONFIG_BASE_PATH}/${fileVersion}`;
|
|
404
404
|
}
|
|
405
|
-
var GATES = [
|
|
405
|
+
var GATES = [
|
|
406
|
+
"CMS:JSRenderer:GetServerSideProps",
|
|
407
|
+
"CMS:JSRenderer:ModuleHubl"
|
|
408
|
+
];
|
|
406
409
|
var ENABLED_FEATURES_GATE_MAP = {
|
|
407
410
|
"cms:jsr:getServerSideProps": "CMS:JSRenderer:GetServerSideProps"
|
|
408
411
|
};
|
|
@@ -497,7 +500,8 @@ function namespaceModulePropsShape(props) {
|
|
|
497
500
|
const {
|
|
498
501
|
dataQueryResult,
|
|
499
502
|
hublParameters,
|
|
500
|
-
fieldValues: passedFieldValues
|
|
503
|
+
fieldValues: passedFieldValues,
|
|
504
|
+
hublData
|
|
501
505
|
} = props;
|
|
502
506
|
const oldPropsShape = { ...props };
|
|
503
507
|
if (oldPropsShape.dataQueryResult) {
|
|
@@ -511,7 +515,8 @@ function namespaceModulePropsShape(props) {
|
|
|
511
515
|
...fieldValues,
|
|
512
516
|
dataQueryResult,
|
|
513
517
|
fieldValues,
|
|
514
|
-
hublParameters
|
|
518
|
+
hublParameters,
|
|
519
|
+
hublData
|
|
515
520
|
};
|
|
516
521
|
}
|
|
517
522
|
function setIn(object, nestedKeysArray, value) {
|
package/dist/run.js
CHANGED
|
@@ -77,7 +77,7 @@ function getDevServerCommandLineOptions(argv) {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
// src/createDevServer.ts
|
|
80
|
-
import
|
|
80
|
+
import path7 from "path";
|
|
81
81
|
import url2 from "url";
|
|
82
82
|
import express2 from "express";
|
|
83
83
|
import http3 from "http";
|
|
@@ -526,7 +526,8 @@ function namespaceModulePropsShape(props) {
|
|
|
526
526
|
const {
|
|
527
527
|
dataQueryResult,
|
|
528
528
|
hublParameters,
|
|
529
|
-
fieldValues: passedFieldValues
|
|
529
|
+
fieldValues: passedFieldValues,
|
|
530
|
+
hublData
|
|
530
531
|
} = props;
|
|
531
532
|
const oldPropsShape = { ...props };
|
|
532
533
|
if (oldPropsShape.dataQueryResult) {
|
|
@@ -540,7 +541,8 @@ function namespaceModulePropsShape(props) {
|
|
|
540
541
|
...fieldValues,
|
|
541
542
|
dataQueryResult,
|
|
542
543
|
fieldValues,
|
|
543
|
-
hublParameters
|
|
544
|
+
hublParameters,
|
|
545
|
+
hublData
|
|
544
546
|
};
|
|
545
547
|
}
|
|
546
548
|
function setIn(object, nestedKeysArray, value) {
|
|
@@ -831,7 +833,82 @@ var getIslandRuntimeAndGlobalToInject = async (sortedIslandRoots, perServerReque
|
|
|
831
833
|
|
|
832
834
|
// src/routes/partial.ts
|
|
833
835
|
import { buildStaticEnvConfig } from "@hubspot/cms-components";
|
|
836
|
+
|
|
837
|
+
// src/lib/trackUsage.ts
|
|
838
|
+
import cliHttp from "@hubspot/cli-lib/http.js";
|
|
839
|
+
import { getAccountConfig } from "@hubspot/cli-lib/lib/config.js";
|
|
840
|
+
|
|
841
|
+
// src/lib/debug.ts
|
|
842
|
+
import { default as debugFactory } from "debug";
|
|
843
|
+
var debug = debugFactory("cms-dev-server");
|
|
844
|
+
|
|
845
|
+
// src/lib/trackUsage.ts
|
|
846
|
+
var DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED = "/cms-dev-server-usage/v1/authenticated";
|
|
847
|
+
var DEV_SERVER_USAGE_ENDPOINT = "/cms-dev-server-usage/v1";
|
|
848
|
+
var EVENT_NAME = "dev-server-interaction";
|
|
849
|
+
var trackingAccountId = null;
|
|
850
|
+
var trackingEnv = null;
|
|
851
|
+
var getPlatform = () => {
|
|
852
|
+
switch (process.platform) {
|
|
853
|
+
case "darwin":
|
|
854
|
+
return "macos";
|
|
855
|
+
case "win32":
|
|
856
|
+
return "windows";
|
|
857
|
+
default:
|
|
858
|
+
return process.platform;
|
|
859
|
+
}
|
|
860
|
+
};
|
|
861
|
+
var getNodeVersionData = () => process.version;
|
|
862
|
+
function trackUsage(action) {
|
|
863
|
+
const accountConfig = trackingAccountId && getAccountConfig(trackingAccountId);
|
|
864
|
+
const isAuthedWithPersonalAccessKey = accountConfig && accountConfig.authType === "personalaccesskey";
|
|
865
|
+
const usageEvent = {
|
|
866
|
+
portalId: trackingAccountId,
|
|
867
|
+
eventClass: "INTERACTION" /* INTERACTION */,
|
|
868
|
+
eventName: EVENT_NAME,
|
|
869
|
+
action,
|
|
870
|
+
nodeVersion: getNodeVersionData(),
|
|
871
|
+
version: "0.11.0",
|
|
872
|
+
os: getPlatform()
|
|
873
|
+
};
|
|
874
|
+
const uri = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
|
|
875
|
+
const baseRequestOptions = {
|
|
876
|
+
uri,
|
|
877
|
+
body: usageEvent,
|
|
878
|
+
resolveWithFullResponse: true
|
|
879
|
+
};
|
|
880
|
+
if (isAuthedWithPersonalAccessKey) {
|
|
881
|
+
return cliHttp.post(trackingAccountId, baseRequestOptions);
|
|
882
|
+
}
|
|
883
|
+
const requestOptions = cliHttp.getRequestOptions(
|
|
884
|
+
{ env: trackingEnv },
|
|
885
|
+
baseRequestOptions
|
|
886
|
+
);
|
|
887
|
+
return cliHttp.request.post(requestOptions);
|
|
888
|
+
}
|
|
889
|
+
var setTrackingInfo = (accountId, env) => {
|
|
890
|
+
trackingAccountId = accountId;
|
|
891
|
+
trackingEnv = env;
|
|
892
|
+
};
|
|
893
|
+
function sendTrackingRequest(action) {
|
|
894
|
+
setImmediate(async () => {
|
|
895
|
+
try {
|
|
896
|
+
await trackUsage(action);
|
|
897
|
+
debug(
|
|
898
|
+
wrapMessageInColor(
|
|
899
|
+
"white",
|
|
900
|
+
`Sent usage tracking action event: ${action}`
|
|
901
|
+
)
|
|
902
|
+
);
|
|
903
|
+
} catch (e) {
|
|
904
|
+
debug(wrapMessageInColor("red", `Usage tracking failed: ${e.message}`));
|
|
905
|
+
}
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
// src/routes/partial.ts
|
|
834
910
|
var partialRouteHandler = async (request2, response) => {
|
|
911
|
+
sendTrackingRequest("view-partial-route");
|
|
835
912
|
const {
|
|
836
913
|
authedPortalId,
|
|
837
914
|
authedEnv,
|
|
@@ -992,7 +1069,7 @@ import { join as joinPosix2 } from "path/posix";
|
|
|
992
1069
|
import { traverseFieldsJSON } from "@hubspot/cms-components/fields";
|
|
993
1070
|
|
|
994
1071
|
// src/lib/fetchModuleGraphQLData.ts
|
|
995
|
-
import
|
|
1072
|
+
import cliHttp2 from "@hubspot/cli-lib/http.js";
|
|
996
1073
|
var graphQLCache = /* @__PURE__ */ new Map();
|
|
997
1074
|
async function fetchModuleGraphQLData(accountId, query, requestedModulePath, pageUrl) {
|
|
998
1075
|
const { searchParams } = new URL(pageUrl);
|
|
@@ -1004,7 +1081,7 @@ async function fetchModuleGraphQLData(accountId, query, requestedModulePath, pag
|
|
|
1004
1081
|
return Promise.resolve(graphQLCache.get(compositeQueryKey));
|
|
1005
1082
|
}
|
|
1006
1083
|
try {
|
|
1007
|
-
dataQueryResult = await
|
|
1084
|
+
dataQueryResult = await cliHttp2.post(accountId, {
|
|
1008
1085
|
uri: "/collector/v3/graphql",
|
|
1009
1086
|
body: {
|
|
1010
1087
|
query
|
|
@@ -1133,6 +1210,7 @@ var renderModule_default = renderModule;
|
|
|
1133
1210
|
|
|
1134
1211
|
// src/routes/module.ts
|
|
1135
1212
|
var moduleRouteHandler = async (request2, response) => {
|
|
1213
|
+
sendTrackingRequest("view-module-route");
|
|
1136
1214
|
const {
|
|
1137
1215
|
authedPortalId,
|
|
1138
1216
|
authedEnv,
|
|
@@ -1355,12 +1433,12 @@ var findLocalRenderPlaceholders = (body) => {
|
|
|
1355
1433
|
);
|
|
1356
1434
|
offsetSoFar = nearestNewlineOrQuoteAfterBlockOpen;
|
|
1357
1435
|
if (pathEndOffset >= 0 && pathEndOffset < nextNewlineOffset) {
|
|
1358
|
-
const
|
|
1436
|
+
const path8 = body.substring(
|
|
1359
1437
|
startOffset + localJsRenderStartString.length,
|
|
1360
1438
|
pathEndOffset
|
|
1361
1439
|
);
|
|
1362
1440
|
offsetSoFar = pathEndOffset + 1;
|
|
1363
|
-
if (startOffset >= 0 &&
|
|
1441
|
+
if (startOffset >= 0 && path8) {
|
|
1364
1442
|
const nextCommentEndOffset = body.indexOf("-->", pathEndOffset);
|
|
1365
1443
|
const endOffset = body.indexOf(localJsRenderEndString, pathEndOffset);
|
|
1366
1444
|
offsetSoFar = Math.min(nextCommentEndOffset, endOffset);
|
|
@@ -1371,7 +1449,7 @@ var findLocalRenderPlaceholders = (body) => {
|
|
|
1371
1449
|
result.push({
|
|
1372
1450
|
startOffset,
|
|
1373
1451
|
endOffset: endOffset + localJsRenderEndString.length,
|
|
1374
|
-
path:
|
|
1452
|
+
path: path8,
|
|
1375
1453
|
json
|
|
1376
1454
|
});
|
|
1377
1455
|
offsetSoFar = endOffset + localJsRenderEndString.length;
|
|
@@ -1479,9 +1557,9 @@ var customColors = [
|
|
|
1479
1557
|
];
|
|
1480
1558
|
var Converter = new AnsiToHtmlConverter({ colors: customColors });
|
|
1481
1559
|
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;`;
|
|
1482
|
-
var renderLocalError_default = (
|
|
1560
|
+
var renderLocalError_default = (path8, error) => {
|
|
1483
1561
|
const stackWithColorClasses = Converter.toHtml(error.stack);
|
|
1484
|
-
return `<div data-js-rendered="error" style="${darkErrorStyles}">Error rendering ${
|
|
1562
|
+
return `<div data-js-rendered="error" style="${darkErrorStyles}">Error rendering ${path8}<br/><br/><code><pre>${stackWithColorClasses}</pre></code></div>`;
|
|
1485
1563
|
};
|
|
1486
1564
|
|
|
1487
1565
|
// src/proxyPage/fetchPreviewInfo.ts
|
|
@@ -1811,6 +1889,7 @@ ${error.stack}`
|
|
|
1811
1889
|
|
|
1812
1890
|
// src/routes/proxyPageRouteHandler.ts
|
|
1813
1891
|
async function proxyPageRouteHandler(request2, response, next) {
|
|
1892
|
+
sendTrackingRequest("view-proxy-page-route");
|
|
1814
1893
|
const {
|
|
1815
1894
|
viteServer,
|
|
1816
1895
|
webRoot: webRoot2,
|
|
@@ -1909,6 +1988,7 @@ function proxyPageResourceRedirect(req, res, next) {
|
|
|
1909
1988
|
// src/routes/homeRouteHandler.tsx
|
|
1910
1989
|
import { Fragment, jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1911
1990
|
var homeRouteHandler = async (request2, response) => {
|
|
1991
|
+
sendTrackingRequest("view-home-route");
|
|
1912
1992
|
const { webRoot: webRoot2, storybookEnabled, devServerPort } = request2.app.locals;
|
|
1913
1993
|
const { partialNames } = findAllPartialsInRoot(webRoot2);
|
|
1914
1994
|
const { moduleNames } = findAllModulesInRoot(webRoot2);
|
|
@@ -1928,13 +2008,10 @@ var homeRouteHandler = async (request2, response) => {
|
|
|
1928
2008
|
};
|
|
1929
2009
|
var homeRouteHandler_default = homeRouteHandler;
|
|
1930
2010
|
|
|
1931
|
-
// src/lib/debug.ts
|
|
1932
|
-
import { default as debugFactory } from "debug";
|
|
1933
|
-
var debug = debugFactory("cms-dev-server");
|
|
1934
|
-
|
|
1935
2011
|
// src/routes/proxyPathPageRouteHandler.tsx
|
|
1936
2012
|
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1937
2013
|
async function proxyPathPageRouteHandler(request2, response, next) {
|
|
2014
|
+
sendTrackingRequest("view-proxy-path-route");
|
|
1938
2015
|
const {
|
|
1939
2016
|
viteServer,
|
|
1940
2017
|
webRoot: webRoot2,
|
|
@@ -2209,7 +2286,25 @@ import { default as react } from "@vitejs/plugin-react";
|
|
|
2209
2286
|
import mkcert from "vite-plugin-mkcert";
|
|
2210
2287
|
import { viteCommonjs } from "@originjs/vite-plugin-commonjs";
|
|
2211
2288
|
import { default as Inspect } from "vite-plugin-inspect";
|
|
2212
|
-
|
|
2289
|
+
|
|
2290
|
+
// src/plugins/devSecretsPlugin.ts
|
|
2291
|
+
function devSecretsPlugin(secretNames) {
|
|
2292
|
+
return {
|
|
2293
|
+
name: "dev-secrets",
|
|
2294
|
+
configureServer: {
|
|
2295
|
+
order: "post",
|
|
2296
|
+
async handler(server) {
|
|
2297
|
+
const cmsComponents2 = await server.ssrLoadModule(
|
|
2298
|
+
"@hubspot/cms-components"
|
|
2299
|
+
);
|
|
2300
|
+
cmsComponents2.setSecretsFromEnv(secretNames);
|
|
2301
|
+
}
|
|
2302
|
+
}
|
|
2303
|
+
};
|
|
2304
|
+
}
|
|
2305
|
+
|
|
2306
|
+
// src/createViteDevServer.ts
|
|
2307
|
+
async function createViteDevServer(webRoot2, port, sslEnabled, domainsToProxy = [], __jsRenderingGates, secretNames) {
|
|
2213
2308
|
const additionalMkcertHosts = domainsToProxy.map((proxyDomain) => [
|
|
2214
2309
|
`${proxyDomain}.localhost`,
|
|
2215
2310
|
`${proxyDomain}.hslocal.net`
|
|
@@ -2258,11 +2353,14 @@ Custom origin: ${process.env.VITE_ORIGIN}
|
|
|
2258
2353
|
clientIslandEntryPlugin(),
|
|
2259
2354
|
resolveIslandPlugin(),
|
|
2260
2355
|
viteCommonjs(),
|
|
2261
|
-
Inspect()
|
|
2356
|
+
Inspect(),
|
|
2357
|
+
devSecretsPlugin(secretNames)
|
|
2262
2358
|
],
|
|
2263
2359
|
css: {
|
|
2264
2360
|
postcss: webRoot2
|
|
2265
|
-
}
|
|
2361
|
+
},
|
|
2362
|
+
envDir: webRoot2,
|
|
2363
|
+
envPrefix: "HS_"
|
|
2266
2364
|
};
|
|
2267
2365
|
return createViteServer(viteConfig);
|
|
2268
2366
|
}
|
|
@@ -2341,10 +2439,11 @@ async function getJsRenderingGates(portalId, env, personalAccessKey) {
|
|
|
2341
2439
|
import {
|
|
2342
2440
|
getEnv as getEnv2,
|
|
2343
2441
|
getAccountId as getAccountId4,
|
|
2344
|
-
getAccountConfig,
|
|
2442
|
+
getAccountConfig as getAccountConfig2,
|
|
2345
2443
|
loadConfig,
|
|
2346
2444
|
validateConfig
|
|
2347
2445
|
} from "@hubspot/cli-lib/lib/config.js";
|
|
2446
|
+
import { fetchSecrets } from "@hubspot/cli-lib/api/secrets.js";
|
|
2348
2447
|
|
|
2349
2448
|
// src/proxyPage/fetchDomains.ts
|
|
2350
2449
|
import { get as hsGet4 } from "@hubspot/cli-lib/http.js";
|
|
@@ -2398,6 +2497,14 @@ async function fetchWebsiteDomainNames(portalId) {
|
|
|
2398
2497
|
return domainNames;
|
|
2399
2498
|
}
|
|
2400
2499
|
|
|
2500
|
+
// src/lib/getCMSAssetConfig.ts
|
|
2501
|
+
import fs2 from "fs";
|
|
2502
|
+
import path6 from "path";
|
|
2503
|
+
function getCMSAssetConfig(webRoot2) {
|
|
2504
|
+
const cmsAssetsPath = path6.join(webRoot2, "cms-assets.json");
|
|
2505
|
+
return JSON.parse(fs2.readFileSync(cmsAssetsPath).toString());
|
|
2506
|
+
}
|
|
2507
|
+
|
|
2401
2508
|
// src/createDevServer.ts
|
|
2402
2509
|
var BASE_PATH = "/";
|
|
2403
2510
|
var PORT = process.env.PORT ? parseInt(process.env.PORT, 10) : 3e3;
|
|
@@ -2408,6 +2515,7 @@ async function createDevServer(webRoot2, storybook2, hubspotCliConfigPathOption2
|
|
|
2408
2515
|
let authedEnv = null;
|
|
2409
2516
|
let jsRenderingGates = [];
|
|
2410
2517
|
let personalAccessKey = null;
|
|
2518
|
+
let secretNames = [];
|
|
2411
2519
|
if (hubspotCliConfigPathOption2 && hubspotCliAccountNameOption2) {
|
|
2412
2520
|
console.log(
|
|
2413
2521
|
`Loading HS auth (account = ${hubspotCliAccountNameOption2}) configuration at: ${hubspotCliConfigPathOption2}`
|
|
@@ -2422,10 +2530,19 @@ async function createDevServer(webRoot2, storybook2, hubspotCliConfigPathOption2
|
|
|
2422
2530
|
);
|
|
2423
2531
|
}
|
|
2424
2532
|
loadConfig(hubspotCliConfigPathOption2 || null, { useEnv: false });
|
|
2533
|
+
let cmsAssetConfig;
|
|
2534
|
+
try {
|
|
2535
|
+
cmsAssetConfig = getCMSAssetConfig(webRoot2);
|
|
2536
|
+
} catch (e) {
|
|
2537
|
+
console.error(
|
|
2538
|
+
`Error finding or parsing cms-assets.json when initializing in ${webRoot2}`
|
|
2539
|
+
);
|
|
2540
|
+
process.exit(1);
|
|
2541
|
+
}
|
|
2425
2542
|
if (validateConfig()) {
|
|
2426
2543
|
authedPortalId = getAccountId4(hubspotCliAccountNameOption2);
|
|
2427
2544
|
authedEnv = getEnv2(hubspotCliAccountNameOption2);
|
|
2428
|
-
personalAccessKey =
|
|
2545
|
+
personalAccessKey = getAccountConfig2(authedPortalId) && getAccountConfig2(authedPortalId).personalAccessKey;
|
|
2429
2546
|
if (!authedPortalId && hubspotCliAccountNameOption2) {
|
|
2430
2547
|
console.error(
|
|
2431
2548
|
`Couldn't find ${hubspotCliAccountNameOption2} in your hubspot.config.yaml`
|
|
@@ -2445,6 +2562,26 @@ async function createDevServer(webRoot2, storybook2, hubspotCliConfigPathOption2
|
|
|
2445
2562
|
);
|
|
2446
2563
|
}
|
|
2447
2564
|
}
|
|
2565
|
+
try {
|
|
2566
|
+
const secretsResponse = await fetchSecrets(authedPortalId);
|
|
2567
|
+
if (cmsAssetConfig.secretNames && secretsResponse) {
|
|
2568
|
+
secretNames = secretsResponse.results.filter(
|
|
2569
|
+
(secretName) => cmsAssetConfig.secretNames.includes(secretName)
|
|
2570
|
+
);
|
|
2571
|
+
if (secretNames.length < cmsAssetConfig.secretNames.length) {
|
|
2572
|
+
const missingSecrets = cmsAssetConfig.secretNames.filter(
|
|
2573
|
+
(secretName) => secretsResponse.results.includes(secretName) === false
|
|
2574
|
+
);
|
|
2575
|
+
console.error(
|
|
2576
|
+
`Secrets ${missingSecrets.join(
|
|
2577
|
+
", "
|
|
2578
|
+
)} could not be found as initialized for this account, be sure to use \`hs secrets add\``
|
|
2579
|
+
);
|
|
2580
|
+
}
|
|
2581
|
+
}
|
|
2582
|
+
} catch (e) {
|
|
2583
|
+
console.log(e);
|
|
2584
|
+
}
|
|
2448
2585
|
} else {
|
|
2449
2586
|
console.warn(
|
|
2450
2587
|
`Couldn't find an account to use, make sure there is hubspot.config.yaml in this folder (or a parent).
|
|
@@ -2453,6 +2590,8 @@ If needed you can refer to another config file with --config.
|
|
|
2453
2590
|
Local proxy functionality will not work without setting up authentication.`
|
|
2454
2591
|
);
|
|
2455
2592
|
}
|
|
2593
|
+
setTrackingInfo(authedPortalId, authedEnv);
|
|
2594
|
+
sendTrackingRequest("start-dev-server");
|
|
2456
2595
|
let domainsToProxy = [];
|
|
2457
2596
|
if (sslEnabledOption2 && authedPortalId) {
|
|
2458
2597
|
try {
|
|
@@ -2470,20 +2609,21 @@ Local proxy functionality will not work without setting up authentication.`
|
|
|
2470
2609
|
}
|
|
2471
2610
|
}
|
|
2472
2611
|
const authedHublet = "na1";
|
|
2473
|
-
const absoluteWebRoot = normalizePath5(
|
|
2612
|
+
const absoluteWebRoot = normalizePath5(path7.resolve(process.cwd(), webRoot2));
|
|
2474
2613
|
const [__webRootProjectFolder, webRootProjectComponentFolder] = absoluteWebRoot.replace(/\/$/, "").split("/").slice(-2);
|
|
2475
2614
|
const viteServer = await createViteDevServer_default(
|
|
2476
2615
|
absoluteWebRoot,
|
|
2477
2616
|
PORT,
|
|
2478
2617
|
sslEnabledOption2,
|
|
2479
2618
|
domainsToProxy,
|
|
2480
|
-
jsRenderingGates
|
|
2619
|
+
jsRenderingGates,
|
|
2620
|
+
secretNames
|
|
2481
2621
|
);
|
|
2482
2622
|
const viteHTTPSConfig = viteServer.config.server.https;
|
|
2483
2623
|
const httpsKey = viteHTTPSConfig ? viteHTTPSConfig.key : null;
|
|
2484
2624
|
const httpsCert = viteHTTPSConfig ? viteHTTPSConfig.cert : null;
|
|
2485
2625
|
const projectName = getProjectNameFromHSConfig(
|
|
2486
|
-
|
|
2626
|
+
path7.join(webRoot2, "../hsproject.json")
|
|
2487
2627
|
);
|
|
2488
2628
|
const httpServers = [];
|
|
2489
2629
|
const expressServer = express2();
|
|
@@ -2540,8 +2680,9 @@ HubSpot CMS dev server hosting: ${projectName}/${expressServer.locals.projectCom
|
|
|
2540
2680
|
`
|
|
2541
2681
|
);
|
|
2542
2682
|
if (storybook2) {
|
|
2543
|
-
const packageRoot =
|
|
2544
|
-
const configPath =
|
|
2683
|
+
const packageRoot = path7.dirname(url2.fileURLToPath(import.meta.url));
|
|
2684
|
+
const configPath = path7.resolve(packageRoot, "./storybook-main");
|
|
2685
|
+
sendTrackingRequest("start-storybook");
|
|
2545
2686
|
const storybookProcess = spawn(
|
|
2546
2687
|
"sb",
|
|
2547
2688
|
[
|
|
@@ -2560,7 +2701,7 @@ HubSpot CMS dev server hosting: ${projectName}/${expressServer.locals.projectCom
|
|
|
2560
2701
|
portalId: authedPortalId.toString(),
|
|
2561
2702
|
hsEnv: authedEnv,
|
|
2562
2703
|
hublet: authedHublet,
|
|
2563
|
-
WEB_ROOT:
|
|
2704
|
+
WEB_ROOT: path7.join(webRoot2, "components")
|
|
2564
2705
|
}
|
|
2565
2706
|
}
|
|
2566
2707
|
);
|
package/dist/storybook/index.js
CHANGED
|
@@ -8,7 +8,8 @@ function namespaceModulePropsShape(props) {
|
|
|
8
8
|
const {
|
|
9
9
|
dataQueryResult,
|
|
10
10
|
hublParameters,
|
|
11
|
-
fieldValues: passedFieldValues
|
|
11
|
+
fieldValues: passedFieldValues,
|
|
12
|
+
hublData
|
|
12
13
|
} = props;
|
|
13
14
|
const oldPropsShape = { ...props };
|
|
14
15
|
if (oldPropsShape.dataQueryResult) {
|
|
@@ -22,7 +23,8 @@ function namespaceModulePropsShape(props) {
|
|
|
22
23
|
...fieldValues,
|
|
23
24
|
dataQueryResult,
|
|
24
25
|
fieldValues,
|
|
25
|
-
hublParameters
|
|
26
|
+
hublParameters,
|
|
27
|
+
hublData
|
|
26
28
|
};
|
|
27
29
|
}
|
|
28
30
|
function renderFieldsJSX(fieldsJSX) {
|
|
@@ -294,7 +294,8 @@ function namespaceModulePropsShape(props) {
|
|
|
294
294
|
const {
|
|
295
295
|
dataQueryResult,
|
|
296
296
|
hublParameters,
|
|
297
|
-
fieldValues: passedFieldValues
|
|
297
|
+
fieldValues: passedFieldValues,
|
|
298
|
+
hublData
|
|
298
299
|
} = props;
|
|
299
300
|
const oldPropsShape = { ...props };
|
|
300
301
|
if (oldPropsShape.dataQueryResult) {
|
|
@@ -308,7 +309,8 @@ function namespaceModulePropsShape(props) {
|
|
|
308
309
|
...fieldValues,
|
|
309
310
|
dataQueryResult,
|
|
310
311
|
fieldValues,
|
|
311
|
-
hublParameters
|
|
312
|
+
hublParameters,
|
|
313
|
+
hublData
|
|
312
314
|
};
|
|
313
315
|
}
|
|
314
316
|
function setIn(object, nestedKeysArray, value) {
|
|
@@ -584,7 +586,10 @@ ${groupEnd}</script>
|
|
|
584
586
|
};
|
|
585
587
|
COMBINED_REACT_BASE_PATH = "https://static.hsappstatic.net/cms-js-static/ex/js/react/v18";
|
|
586
588
|
ISLAND_RUNTIME_CONFIG_BASE_PATH = "https://static.hsappstatic.net/cms-js-static/ex/js/island-runtime/v1";
|
|
587
|
-
GATES = [
|
|
589
|
+
GATES = [
|
|
590
|
+
"CMS:JSRenderer:GetServerSideProps",
|
|
591
|
+
"CMS:JSRenderer:ModuleHubl"
|
|
592
|
+
];
|
|
588
593
|
ENABLED_FEATURES_GATE_MAP = {
|
|
589
594
|
"cms:jsr:getServerSideProps": "CMS:JSRenderer:GetServerSideProps"
|
|
590
595
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cms-dev-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@hubspot/cli-lib": "^3.0.12",
|
|
28
|
-
"@hubspot/cms-components": "^0.
|
|
28
|
+
"@hubspot/cms-components": "^0.11.0",
|
|
29
29
|
"@originjs/vite-plugin-commonjs": "^1.0.3",
|
|
30
30
|
"@storybook/addon-actions": "7.0.7",
|
|
31
31
|
"@storybook/addon-essentials": "7.0.7",
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
"publishConfig": {
|
|
102
102
|
"access": "public"
|
|
103
103
|
},
|
|
104
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "58a898a8a65a52b85a56d562289e5ee38becddfb"
|
|
105
105
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function createViteDevServer(webRoot: string, port: any, sslEnabled: boolean, domainsToProxy: any[], __jsRenderingGates: string[]): Promise<import("vite").ViteDevServer>;
|
|
1
|
+
declare function createViteDevServer(webRoot: string, port: any, sslEnabled: boolean, domainsToProxy: any[], __jsRenderingGates: string[], secretNames: string[]): Promise<import("vite").ViteDevServer>;
|
|
2
2
|
export default createViteDevServer;
|