@hubspot/cms-dev-server 0.18.17 → 0.18.18
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 +6 -17
- package/dist/index.js +38 -63
- package/dist/internalSsr.js +8 -0
- package/dist/run.js +38 -63
- package/dist/storybook-main/main.js +8 -0
- package/package.json +3 -3
- package/types/plugins/devSecretsPlugin.d.ts +1 -1
- package/types/proxyPage/fetchPreviewInfo.d.ts +1 -0
- package/types/routes/meta.d.ts +2 -0
- package/types/shadowDevServer/createShadowDevServerRoutes.d.ts +1 -2
- package/types/shadowDevServer/startShadowDevServer.d.ts +1 -2
- package/types/lib/renderModuleJson.d.ts +0 -4
|
@@ -446,26 +446,15 @@ import { default as mkcert } from "vite-plugin-mkcert";
|
|
|
446
446
|
import { viteCommonjs } from "@originjs/vite-plugin-commonjs";
|
|
447
447
|
|
|
448
448
|
// src/plugins/devSecretsPlugin.ts
|
|
449
|
-
function devSecretsPlugin(secretNames) {
|
|
449
|
+
function devSecretsPlugin(secretNames = []) {
|
|
450
450
|
return {
|
|
451
451
|
name: "dev-secrets",
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
"@hubspot/cms-components"
|
|
457
|
-
);
|
|
458
|
-
if (cmsComponents2.setSecretsFromEnv) {
|
|
459
|
-
console.log(
|
|
460
|
-
`Attempting to load HS_* secrets from .env: ${secretNames}`
|
|
461
|
-
);
|
|
462
|
-
cmsComponents2.setSecretsFromEnv(secretNames);
|
|
463
|
-
} else if (secretNames.length > 0) {
|
|
464
|
-
console.warn(
|
|
465
|
-
"Not loading secrets into the local environment. Make sure that your @hubspot/cms-components and @hubspot/cms-dev-server package versions match."
|
|
466
|
-
);
|
|
452
|
+
config: () => {
|
|
453
|
+
return {
|
|
454
|
+
define: {
|
|
455
|
+
"import.meta.env.secretNames": secretNames
|
|
467
456
|
}
|
|
468
|
-
}
|
|
457
|
+
};
|
|
469
458
|
}
|
|
470
459
|
};
|
|
471
460
|
}
|
package/dist/index.js
CHANGED
|
@@ -361,6 +361,14 @@ var serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestD
|
|
|
361
361
|
if (isUngatedForClientOnlySupplementalFieldSerialization && output.clientOnly) {
|
|
362
362
|
output.supplementalFieldValues = supplementalFieldValues;
|
|
363
363
|
}
|
|
364
|
+
if (output.supplementalFieldValues) {
|
|
365
|
+
output.supplementalFieldValues = Object.keys(
|
|
366
|
+
output.supplementalFieldValues
|
|
367
|
+
).sort().reduce((acc, key) => {
|
|
368
|
+
acc[key] = output.supplementalFieldValues[key];
|
|
369
|
+
return acc;
|
|
370
|
+
}, {});
|
|
371
|
+
}
|
|
364
372
|
return output;
|
|
365
373
|
}
|
|
366
374
|
);
|
|
@@ -933,26 +941,15 @@ import { default as mkcert } from "vite-plugin-mkcert";
|
|
|
933
941
|
import { viteCommonjs } from "@originjs/vite-plugin-commonjs";
|
|
934
942
|
|
|
935
943
|
// src/plugins/devSecretsPlugin.ts
|
|
936
|
-
function devSecretsPlugin(secretNames) {
|
|
944
|
+
function devSecretsPlugin(secretNames = []) {
|
|
937
945
|
return {
|
|
938
946
|
name: "dev-secrets",
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
"@hubspot/cms-components"
|
|
944
|
-
);
|
|
945
|
-
if (cmsComponents3.setSecretsFromEnv) {
|
|
946
|
-
console.log(
|
|
947
|
-
`Attempting to load HS_* secrets from .env: ${secretNames}`
|
|
948
|
-
);
|
|
949
|
-
cmsComponents3.setSecretsFromEnv(secretNames);
|
|
950
|
-
} else if (secretNames.length > 0) {
|
|
951
|
-
console.warn(
|
|
952
|
-
"Not loading secrets into the local environment. Make sure that your @hubspot/cms-components and @hubspot/cms-dev-server package versions match."
|
|
953
|
-
);
|
|
947
|
+
config: () => {
|
|
948
|
+
return {
|
|
949
|
+
define: {
|
|
950
|
+
"import.meta.env.secretNames": secretNames
|
|
954
951
|
}
|
|
955
|
-
}
|
|
952
|
+
};
|
|
956
953
|
}
|
|
957
954
|
};
|
|
958
955
|
}
|
|
@@ -1472,7 +1469,7 @@ function trackUsage(action) {
|
|
|
1472
1469
|
eventName: EVENT_NAME,
|
|
1473
1470
|
action,
|
|
1474
1471
|
nodeVersion: getNodeVersionData(),
|
|
1475
|
-
version: "0.18.
|
|
1472
|
+
version: "0.18.18",
|
|
1476
1473
|
os: getPlatform()
|
|
1477
1474
|
};
|
|
1478
1475
|
const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
|
|
@@ -1975,7 +1972,8 @@ var fetchPreviewInfo_default = async (accountId, portalId, contentId) => {
|
|
|
1975
1972
|
})).data;
|
|
1976
1973
|
return {
|
|
1977
1974
|
previewDomain: content.previewDomain ?? content.resolvedDomain,
|
|
1978
|
-
previewKey: content.previewKey
|
|
1975
|
+
previewKey: content.previewKey,
|
|
1976
|
+
templatePath: content.templatePath
|
|
1979
1977
|
};
|
|
1980
1978
|
} catch (error) {
|
|
1981
1979
|
if (error.statusCode === 403 && error.error.message.match(
|
|
@@ -4075,32 +4073,27 @@ import express from "express";
|
|
|
4075
4073
|
|
|
4076
4074
|
// src/shadowDevServer/createShadowDevServerRoutes.ts
|
|
4077
4075
|
import { Router as Router2 } from "express";
|
|
4078
|
-
import { getAccountId as getAccountId3
|
|
4076
|
+
import { getAccountId as getAccountId3 } from "@hubspot/local-dev-lib/config";
|
|
4079
4077
|
import cors from "cors";
|
|
4080
|
-
|
|
4081
|
-
function getShadowDevServerCheckHandler(devServerPort, projectName, gates) {
|
|
4078
|
+
function getShadowDevServerCheckHandler(devServerPort, themePath) {
|
|
4082
4079
|
return async function shadowDevServerCheckHandler(request2, response) {
|
|
4083
4080
|
const { query } = request2;
|
|
4084
4081
|
if (query) {
|
|
4085
4082
|
const {
|
|
4086
4083
|
hostName,
|
|
4087
4084
|
pathName,
|
|
4088
|
-
protocol,
|
|
4089
4085
|
contentId,
|
|
4090
4086
|
portalId: portalIdString
|
|
4091
4087
|
} = query;
|
|
4092
|
-
const pageUrl = `${protocol}//${hostName}${pathName}`;
|
|
4093
4088
|
const portalId = parseInt(portalIdString, 10);
|
|
4094
|
-
let proxyEnv;
|
|
4095
4089
|
let accountId;
|
|
4096
|
-
let
|
|
4090
|
+
let isTemplateFromDevTheme = false;
|
|
4097
4091
|
let localProxyUrl;
|
|
4098
4092
|
try {
|
|
4099
4093
|
accountId = getAccountId3(portalId);
|
|
4100
4094
|
if (accountId === null) {
|
|
4101
4095
|
throw new Error();
|
|
4102
4096
|
}
|
|
4103
|
-
proxyEnv = getEnv3(accountId);
|
|
4104
4097
|
} catch (e) {
|
|
4105
4098
|
response.status(500).end(
|
|
4106
4099
|
`Unable to find account for hubid = ${portalId}. Please check your hubspot.config.yaml`
|
|
@@ -4108,37 +4101,19 @@ function getShadowDevServerCheckHandler(devServerPort, projectName, gates) {
|
|
|
4108
4101
|
return;
|
|
4109
4102
|
}
|
|
4110
4103
|
try {
|
|
4111
|
-
const
|
|
4104
|
+
const { templatePath } = await fetchPreviewInfo_default(
|
|
4112
4105
|
accountId,
|
|
4113
4106
|
portalId,
|
|
4114
4107
|
contentId
|
|
4115
4108
|
);
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
portalId,
|
|
4119
|
-
"na1",
|
|
4120
|
-
// bad lazy TF (but does it really matter for this check)
|
|
4121
|
-
proxyEnv,
|
|
4122
|
-
false,
|
|
4123
|
-
gates
|
|
4124
|
-
);
|
|
4125
|
-
const pageHtml = await makeProxyPreviewRequest(
|
|
4126
|
-
accountId,
|
|
4127
|
-
pageUrl,
|
|
4128
|
-
previewKey,
|
|
4129
|
-
contentId,
|
|
4130
|
-
projectName,
|
|
4131
|
-
environmentConfig,
|
|
4132
|
-
gates
|
|
4133
|
-
);
|
|
4134
|
-
const localRenderPlaceholders = findLocalRenderPlaceholders(
|
|
4135
|
-
pageHtml.data
|
|
4136
|
-
);
|
|
4137
|
-
if (localRenderPlaceholders.length) {
|
|
4138
|
-
hasJSBuildingBlocks = true;
|
|
4109
|
+
if (templatePath.startsWith(themePath)) {
|
|
4110
|
+
isTemplateFromDevTheme = true;
|
|
4139
4111
|
localProxyUrl = `http://${hostName}.hslocal.net:${devServerPort}${pathName}`;
|
|
4140
4112
|
}
|
|
4141
|
-
response.status(200).set({ "Content-Type": "application/json" }).json({
|
|
4113
|
+
response.status(200).set({ "Content-Type": "application/json" }).json({
|
|
4114
|
+
isTemplateFromDevTheme,
|
|
4115
|
+
localProxyUrl
|
|
4116
|
+
});
|
|
4142
4117
|
} catch (error) {
|
|
4143
4118
|
response.status(500).end(
|
|
4144
4119
|
`Failed proxy render of page id = ${contentId} hub id = ${portalId}
|
|
@@ -4154,19 +4129,19 @@ ${error.stack}`
|
|
|
4154
4129
|
}
|
|
4155
4130
|
};
|
|
4156
4131
|
}
|
|
4157
|
-
async function createShadowDevServerRoutes(devServerPort,
|
|
4132
|
+
async function createShadowDevServerRoutes(devServerPort, themePath) {
|
|
4158
4133
|
const shadowDevServerRoutes = Router2();
|
|
4159
4134
|
shadowDevServerRoutes.get(
|
|
4160
4135
|
"/check-if-local-dev-server",
|
|
4161
4136
|
cors(),
|
|
4162
|
-
getShadowDevServerCheckHandler(devServerPort,
|
|
4137
|
+
getShadowDevServerCheckHandler(devServerPort, themePath)
|
|
4163
4138
|
);
|
|
4164
4139
|
return shadowDevServerRoutes;
|
|
4165
4140
|
}
|
|
4166
4141
|
|
|
4167
4142
|
// src/shadowDevServer/startShadowDevServer.ts
|
|
4168
4143
|
var testNetServer = net.createServer();
|
|
4169
|
-
async function startShadowDevServer(devServerPort, shadowPort,
|
|
4144
|
+
async function startShadowDevServer(devServerPort, shadowPort, themePath) {
|
|
4170
4145
|
const portIsTaken = await new Promise((res, rej) => {
|
|
4171
4146
|
console.log(`Starting proxy link server on port ${shadowPort}`);
|
|
4172
4147
|
testNetServer.once("error", (err) => {
|
|
@@ -4194,11 +4169,7 @@ async function startShadowDevServer(devServerPort, shadowPort, projectName, jsRe
|
|
|
4194
4169
|
shadowDevServer.listen(shadowPort);
|
|
4195
4170
|
shadowDevServer.use(
|
|
4196
4171
|
"/",
|
|
4197
|
-
await createShadowDevServerRoutes(
|
|
4198
|
-
devServerPort,
|
|
4199
|
-
projectName,
|
|
4200
|
-
jsRenderingGates
|
|
4201
|
-
)
|
|
4172
|
+
await createShadowDevServerRoutes(devServerPort, themePath)
|
|
4202
4173
|
);
|
|
4203
4174
|
}
|
|
4204
4175
|
|
|
@@ -4499,7 +4470,7 @@ async function getJsRenderingGates(portalId, env, personalAccessKey) {
|
|
|
4499
4470
|
|
|
4500
4471
|
// src/createDevServer.ts
|
|
4501
4472
|
import {
|
|
4502
|
-
getEnv as
|
|
4473
|
+
getEnv as getEnv3,
|
|
4503
4474
|
getAccountId as getAccountId4,
|
|
4504
4475
|
getAccountConfig as getAccountConfig2,
|
|
4505
4476
|
loadConfig,
|
|
@@ -5064,7 +5035,7 @@ async function createDevServer(webRoot, storybook, hubspotCliConfigPathOption, h
|
|
|
5064
5035
|
secretNamesFromConfig = getSecretNamesFromConfig(cmsAssetConfig);
|
|
5065
5036
|
if (validateConfig()) {
|
|
5066
5037
|
authedPortalId = getAccountId4(hubspotCliAccountNameOption);
|
|
5067
|
-
const env =
|
|
5038
|
+
const env = getEnv3(hubspotCliAccountNameOption);
|
|
5068
5039
|
if (!env) {
|
|
5069
5040
|
throw new Error(
|
|
5070
5041
|
`No environment found for account ${hubspotCliAccountNameOption} from hubspot.config.yaml`
|
|
@@ -5229,7 +5200,11 @@ Local proxy functionality and module preview routes will not work without settin
|
|
|
5229
5200
|
httpServers.push(httpServer);
|
|
5230
5201
|
}
|
|
5231
5202
|
if (!process.env.IN_CODESANDBOX && !process.env.CODESANDBOX_HOST) {
|
|
5232
|
-
startShadowDevServer(
|
|
5203
|
+
startShadowDevServer(
|
|
5204
|
+
PORT,
|
|
5205
|
+
SHADOW_PORT,
|
|
5206
|
+
themePreviewOptions ? themePreviewOptions.dest : ""
|
|
5207
|
+
);
|
|
5233
5208
|
}
|
|
5234
5209
|
let extraServerInfo = "";
|
|
5235
5210
|
const protocol = sslEnabledOption ? "https" : "http";
|
package/dist/internalSsr.js
CHANGED
|
@@ -525,6 +525,14 @@ var serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestD
|
|
|
525
525
|
if (isUngatedForClientOnlySupplementalFieldSerialization && output.clientOnly) {
|
|
526
526
|
output.supplementalFieldValues = supplementalFieldValues;
|
|
527
527
|
}
|
|
528
|
+
if (output.supplementalFieldValues) {
|
|
529
|
+
output.supplementalFieldValues = Object.keys(
|
|
530
|
+
output.supplementalFieldValues
|
|
531
|
+
).sort().reduce((acc, key) => {
|
|
532
|
+
acc[key] = output.supplementalFieldValues[key];
|
|
533
|
+
return acc;
|
|
534
|
+
}, {});
|
|
535
|
+
}
|
|
528
536
|
return output;
|
|
529
537
|
}
|
|
530
538
|
);
|
package/dist/run.js
CHANGED
|
@@ -1154,6 +1154,14 @@ var serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestD
|
|
|
1154
1154
|
if (isUngatedForClientOnlySupplementalFieldSerialization && output.clientOnly) {
|
|
1155
1155
|
output.supplementalFieldValues = supplementalFieldValues;
|
|
1156
1156
|
}
|
|
1157
|
+
if (output.supplementalFieldValues) {
|
|
1158
|
+
output.supplementalFieldValues = Object.keys(
|
|
1159
|
+
output.supplementalFieldValues
|
|
1160
|
+
).sort().reduce((acc, key) => {
|
|
1161
|
+
acc[key] = output.supplementalFieldValues[key];
|
|
1162
|
+
return acc;
|
|
1163
|
+
}, {});
|
|
1164
|
+
}
|
|
1157
1165
|
return output;
|
|
1158
1166
|
}
|
|
1159
1167
|
);
|
|
@@ -2081,7 +2089,7 @@ function trackUsage(action) {
|
|
|
2081
2089
|
eventName: EVENT_NAME,
|
|
2082
2090
|
action,
|
|
2083
2091
|
nodeVersion: getNodeVersionData(),
|
|
2084
|
-
version: "0.18.
|
|
2092
|
+
version: "0.18.18",
|
|
2085
2093
|
os: getPlatform()
|
|
2086
2094
|
};
|
|
2087
2095
|
const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
|
|
@@ -2584,7 +2592,8 @@ var fetchPreviewInfo_default = async (accountId, portalId, contentId) => {
|
|
|
2584
2592
|
})).data;
|
|
2585
2593
|
return {
|
|
2586
2594
|
previewDomain: content.previewDomain ?? content.resolvedDomain,
|
|
2587
|
-
previewKey: content.previewKey
|
|
2595
|
+
previewKey: content.previewKey,
|
|
2596
|
+
templatePath: content.templatePath
|
|
2588
2597
|
};
|
|
2589
2598
|
} catch (error) {
|
|
2590
2599
|
if (error.statusCode === 403 && error.error.message.match(
|
|
@@ -4684,32 +4693,27 @@ import express from "express";
|
|
|
4684
4693
|
|
|
4685
4694
|
// src/shadowDevServer/createShadowDevServerRoutes.ts
|
|
4686
4695
|
import { Router as Router2 } from "express";
|
|
4687
|
-
import { getAccountId as getAccountId3
|
|
4696
|
+
import { getAccountId as getAccountId3 } from "@hubspot/local-dev-lib/config";
|
|
4688
4697
|
import cors from "cors";
|
|
4689
|
-
|
|
4690
|
-
function getShadowDevServerCheckHandler(devServerPort, projectName, gates) {
|
|
4698
|
+
function getShadowDevServerCheckHandler(devServerPort, themePath) {
|
|
4691
4699
|
return async function shadowDevServerCheckHandler(request2, response) {
|
|
4692
4700
|
const { query } = request2;
|
|
4693
4701
|
if (query) {
|
|
4694
4702
|
const {
|
|
4695
4703
|
hostName,
|
|
4696
4704
|
pathName,
|
|
4697
|
-
protocol,
|
|
4698
4705
|
contentId,
|
|
4699
4706
|
portalId: portalIdString
|
|
4700
4707
|
} = query;
|
|
4701
|
-
const pageUrl = `${protocol}//${hostName}${pathName}`;
|
|
4702
4708
|
const portalId = parseInt(portalIdString, 10);
|
|
4703
|
-
let proxyEnv;
|
|
4704
4709
|
let accountId;
|
|
4705
|
-
let
|
|
4710
|
+
let isTemplateFromDevTheme = false;
|
|
4706
4711
|
let localProxyUrl;
|
|
4707
4712
|
try {
|
|
4708
4713
|
accountId = getAccountId3(portalId);
|
|
4709
4714
|
if (accountId === null) {
|
|
4710
4715
|
throw new Error();
|
|
4711
4716
|
}
|
|
4712
|
-
proxyEnv = getEnv3(accountId);
|
|
4713
4717
|
} catch (e) {
|
|
4714
4718
|
response.status(500).end(
|
|
4715
4719
|
`Unable to find account for hubid = ${portalId}. Please check your hubspot.config.yaml`
|
|
@@ -4717,37 +4721,19 @@ function getShadowDevServerCheckHandler(devServerPort, projectName, gates) {
|
|
|
4717
4721
|
return;
|
|
4718
4722
|
}
|
|
4719
4723
|
try {
|
|
4720
|
-
const
|
|
4724
|
+
const { templatePath } = await fetchPreviewInfo_default(
|
|
4721
4725
|
accountId,
|
|
4722
4726
|
portalId,
|
|
4723
4727
|
contentId
|
|
4724
4728
|
);
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
portalId,
|
|
4728
|
-
"na1",
|
|
4729
|
-
// bad lazy TF (but does it really matter for this check)
|
|
4730
|
-
proxyEnv,
|
|
4731
|
-
false,
|
|
4732
|
-
gates
|
|
4733
|
-
);
|
|
4734
|
-
const pageHtml = await makeProxyPreviewRequest(
|
|
4735
|
-
accountId,
|
|
4736
|
-
pageUrl,
|
|
4737
|
-
previewKey,
|
|
4738
|
-
contentId,
|
|
4739
|
-
projectName,
|
|
4740
|
-
environmentConfig,
|
|
4741
|
-
gates
|
|
4742
|
-
);
|
|
4743
|
-
const localRenderPlaceholders = findLocalRenderPlaceholders(
|
|
4744
|
-
pageHtml.data
|
|
4745
|
-
);
|
|
4746
|
-
if (localRenderPlaceholders.length) {
|
|
4747
|
-
hasJSBuildingBlocks = true;
|
|
4729
|
+
if (templatePath.startsWith(themePath)) {
|
|
4730
|
+
isTemplateFromDevTheme = true;
|
|
4748
4731
|
localProxyUrl = `http://${hostName}.hslocal.net:${devServerPort}${pathName}`;
|
|
4749
4732
|
}
|
|
4750
|
-
response.status(200).set({ "Content-Type": "application/json" }).json({
|
|
4733
|
+
response.status(200).set({ "Content-Type": "application/json" }).json({
|
|
4734
|
+
isTemplateFromDevTheme,
|
|
4735
|
+
localProxyUrl
|
|
4736
|
+
});
|
|
4751
4737
|
} catch (error) {
|
|
4752
4738
|
response.status(500).end(
|
|
4753
4739
|
`Failed proxy render of page id = ${contentId} hub id = ${portalId}
|
|
@@ -4763,19 +4749,19 @@ ${error.stack}`
|
|
|
4763
4749
|
}
|
|
4764
4750
|
};
|
|
4765
4751
|
}
|
|
4766
|
-
async function createShadowDevServerRoutes(devServerPort,
|
|
4752
|
+
async function createShadowDevServerRoutes(devServerPort, themePath) {
|
|
4767
4753
|
const shadowDevServerRoutes = Router2();
|
|
4768
4754
|
shadowDevServerRoutes.get(
|
|
4769
4755
|
"/check-if-local-dev-server",
|
|
4770
4756
|
cors(),
|
|
4771
|
-
getShadowDevServerCheckHandler(devServerPort,
|
|
4757
|
+
getShadowDevServerCheckHandler(devServerPort, themePath)
|
|
4772
4758
|
);
|
|
4773
4759
|
return shadowDevServerRoutes;
|
|
4774
4760
|
}
|
|
4775
4761
|
|
|
4776
4762
|
// src/shadowDevServer/startShadowDevServer.ts
|
|
4777
4763
|
var testNetServer = net.createServer();
|
|
4778
|
-
async function startShadowDevServer(devServerPort, shadowPort,
|
|
4764
|
+
async function startShadowDevServer(devServerPort, shadowPort, themePath) {
|
|
4779
4765
|
const portIsTaken = await new Promise((res, rej) => {
|
|
4780
4766
|
console.log(`Starting proxy link server on port ${shadowPort}`);
|
|
4781
4767
|
testNetServer.once("error", (err) => {
|
|
@@ -4803,11 +4789,7 @@ async function startShadowDevServer(devServerPort, shadowPort, projectName, jsRe
|
|
|
4803
4789
|
shadowDevServer.listen(shadowPort);
|
|
4804
4790
|
shadowDevServer.use(
|
|
4805
4791
|
"/",
|
|
4806
|
-
await createShadowDevServerRoutes(
|
|
4807
|
-
devServerPort,
|
|
4808
|
-
projectName,
|
|
4809
|
-
jsRenderingGates
|
|
4810
|
-
)
|
|
4792
|
+
await createShadowDevServerRoutes(devServerPort, themePath)
|
|
4811
4793
|
);
|
|
4812
4794
|
}
|
|
4813
4795
|
|
|
@@ -4818,26 +4800,15 @@ import { default as mkcert } from "vite-plugin-mkcert";
|
|
|
4818
4800
|
import { viteCommonjs } from "@originjs/vite-plugin-commonjs";
|
|
4819
4801
|
|
|
4820
4802
|
// src/plugins/devSecretsPlugin.ts
|
|
4821
|
-
function devSecretsPlugin(secretNames) {
|
|
4803
|
+
function devSecretsPlugin(secretNames = []) {
|
|
4822
4804
|
return {
|
|
4823
4805
|
name: "dev-secrets",
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
"@hubspot/cms-components"
|
|
4829
|
-
);
|
|
4830
|
-
if (cmsComponents3.setSecretsFromEnv) {
|
|
4831
|
-
console.log(
|
|
4832
|
-
`Attempting to load HS_* secrets from .env: ${secretNames}`
|
|
4833
|
-
);
|
|
4834
|
-
cmsComponents3.setSecretsFromEnv(secretNames);
|
|
4835
|
-
} else if (secretNames.length > 0) {
|
|
4836
|
-
console.warn(
|
|
4837
|
-
"Not loading secrets into the local environment. Make sure that your @hubspot/cms-components and @hubspot/cms-dev-server package versions match."
|
|
4838
|
-
);
|
|
4806
|
+
config: () => {
|
|
4807
|
+
return {
|
|
4808
|
+
define: {
|
|
4809
|
+
"import.meta.env.secretNames": secretNames
|
|
4839
4810
|
}
|
|
4840
|
-
}
|
|
4811
|
+
};
|
|
4841
4812
|
}
|
|
4842
4813
|
};
|
|
4843
4814
|
}
|
|
@@ -5227,7 +5198,7 @@ async function getJsRenderingGates(portalId, env2, personalAccessKey) {
|
|
|
5227
5198
|
|
|
5228
5199
|
// src/createDevServer.ts
|
|
5229
5200
|
import {
|
|
5230
|
-
getEnv as
|
|
5201
|
+
getEnv as getEnv3,
|
|
5231
5202
|
getAccountId as getAccountId4,
|
|
5232
5203
|
getAccountConfig as getAccountConfig3,
|
|
5233
5204
|
loadConfig,
|
|
@@ -5792,7 +5763,7 @@ async function createDevServer(webRoot2, storybook2, hubspotCliConfigPathOption2
|
|
|
5792
5763
|
secretNamesFromConfig = getSecretNamesFromConfig(cmsAssetConfig);
|
|
5793
5764
|
if (validateConfig()) {
|
|
5794
5765
|
authedPortalId = getAccountId4(hubspotCliAccountNameOption2);
|
|
5795
|
-
const env2 =
|
|
5766
|
+
const env2 = getEnv3(hubspotCliAccountNameOption2);
|
|
5796
5767
|
if (!env2) {
|
|
5797
5768
|
throw new Error(
|
|
5798
5769
|
`No environment found for account ${hubspotCliAccountNameOption2} from hubspot.config.yaml`
|
|
@@ -5957,7 +5928,11 @@ Local proxy functionality and module preview routes will not work without settin
|
|
|
5957
5928
|
httpServers.push(httpServer);
|
|
5958
5929
|
}
|
|
5959
5930
|
if (!process.env.IN_CODESANDBOX && !process.env.CODESANDBOX_HOST) {
|
|
5960
|
-
startShadowDevServer(
|
|
5931
|
+
startShadowDevServer(
|
|
5932
|
+
PORT,
|
|
5933
|
+
SHADOW_PORT,
|
|
5934
|
+
themePreviewOptions2 ? themePreviewOptions2.dest : ""
|
|
5935
|
+
);
|
|
5961
5936
|
}
|
|
5962
5937
|
let extraServerInfo = "";
|
|
5963
5938
|
const protocol = sslEnabledOption2 ? "https" : "http";
|
|
@@ -1119,6 +1119,14 @@ var init_dist = __esm({
|
|
|
1119
1119
|
if (isUngatedForClientOnlySupplementalFieldSerialization && output.clientOnly) {
|
|
1120
1120
|
output.supplementalFieldValues = supplementalFieldValues;
|
|
1121
1121
|
}
|
|
1122
|
+
if (output.supplementalFieldValues) {
|
|
1123
|
+
output.supplementalFieldValues = Object.keys(
|
|
1124
|
+
output.supplementalFieldValues
|
|
1125
|
+
).sort().reduce((acc, key) => {
|
|
1126
|
+
acc[key] = output.supplementalFieldValues[key];
|
|
1127
|
+
return acc;
|
|
1128
|
+
}, {});
|
|
1129
|
+
}
|
|
1122
1130
|
return output;
|
|
1123
1131
|
}
|
|
1124
1132
|
);
|
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.18",
|
|
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.18",
|
|
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",
|
|
@@ -130,5 +130,5 @@
|
|
|
130
130
|
"publishConfig": {
|
|
131
131
|
"access": "public"
|
|
132
132
|
},
|
|
133
|
-
"gitHead": "
|
|
133
|
+
"gitHead": "49628d53d7bcdfbd68471aac97d8c1b97e7603af"
|
|
134
134
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
|
-
export default function devSecretsPlugin(secretNames
|
|
2
|
+
export default function devSecretsPlugin(secretNames?: Array<string>): Plugin;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function createShadowDevServerRoutes(devServerPort: number, projectName: string, gates: Gate[]): Promise<import("express-serve-static-core").Router>;
|
|
1
|
+
export default function createShadowDevServerRoutes(devServerPort: number, themePath: string): Promise<import("express-serve-static-core").Router>;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function startShadowDevServer(devServerPort: number, shadowPort: number, projectName: string, jsRenderingGates: Gate[]): Promise<void>;
|
|
1
|
+
export default function startShadowDevServer(devServerPort: number, shadowPort: number, themePath: string): Promise<void>;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ViteDevServer } from 'vite';
|
|
2
|
-
export declare const lookForModuleInFolder: (modulePath: string, viteServer: ViteDevServer) => Promise<[any, string]>;
|
|
3
|
-
declare function renderModuleJson(viteServer: ViteDevServer, requestedModulePath: string): Promise<any>;
|
|
4
|
-
export default renderModuleJson;
|