@hubspot/cms-dev-server 1.2.0 → 1.2.1
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/.DS_Store +0 -0
- package/dist/generateJsonFromJsx.js +1 -1
- package/dist/index.js +45 -38
- package/dist/internalSsr.js +3 -2
- package/dist/run.js +48 -41
- package/dist/storybook/index.js +1 -1
- package/dist/storybook-main/main.js +7 -6
- package/package.json +4 -4
- package/types/constants/errors.d.ts +5 -0
- package/types/createAppViteConfig.d.ts +2 -0
- package/types/lib/cli.d.ts +22 -0
- package/types/lib/constants.d.ts +1 -0
- package/types/routes/api.d.ts +2 -0
- package/types/routes/appServerApiRouteHandler.d.ts +5 -0
- package/types/routes/appServerRoutes.d.ts +5 -0
- package/types/routes/createAppServerRoutes.d.ts +5 -0
- package/types/routes/homeRouteHandler.d.ts +3 -0
- package/types/storybook-main/preview.d.ts +9 -0
package/dist/.DS_Store
ADDED
|
Binary file
|
|
@@ -10,7 +10,7 @@ import { createServer as createViteServer } from "vite";
|
|
|
10
10
|
import { createRequire } from "module";
|
|
11
11
|
import { default as react } from "@vitejs/plugin-react";
|
|
12
12
|
|
|
13
|
-
// ../cms-js-internal/dist/types-
|
|
13
|
+
// ../cms-js-internal/dist/types-Bqf9htWu.js
|
|
14
14
|
import path from "path";
|
|
15
15
|
var viteRoot;
|
|
16
16
|
var viteCommand;
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { createServer as createViteServer } from "vite";
|
|
|
3
3
|
import { createRequire } from "module";
|
|
4
4
|
import { default as react } from "@vitejs/plugin-react";
|
|
5
5
|
|
|
6
|
-
// ../cms-js-internal/dist/types-
|
|
6
|
+
// ../cms-js-internal/dist/types-Bqf9htWu.js
|
|
7
7
|
import path from "path";
|
|
8
8
|
import { createHash } from "crypto";
|
|
9
9
|
import fs, { readFileSync, existsSync, readdirSync, lstatSync } from "fs";
|
|
@@ -1580,7 +1580,7 @@ import { buildStaticEnvConfig as buildStaticEnvConfig3 } from "@hubspot/cms-comp
|
|
|
1580
1580
|
|
|
1581
1581
|
// src/lib/trackUsage.ts
|
|
1582
1582
|
import { http as hsCliHttp } from "@hubspot/local-dev-lib/http";
|
|
1583
|
-
import {
|
|
1583
|
+
import { getConfigAccountIfExists } from "@hubspot/local-dev-lib/config";
|
|
1584
1584
|
import axios from "axios";
|
|
1585
1585
|
import { getAxiosConfig } from "@hubspot/local-dev-lib/http/getAxiosConfig";
|
|
1586
1586
|
|
|
@@ -1623,7 +1623,7 @@ var getPlatform = () => {
|
|
|
1623
1623
|
};
|
|
1624
1624
|
var getNodeVersionData = () => process.version;
|
|
1625
1625
|
function trackUsage(action) {
|
|
1626
|
-
const accountConfig = trackingAccountId &&
|
|
1626
|
+
const accountConfig = trackingAccountId && getConfigAccountIfExists(trackingAccountId);
|
|
1627
1627
|
const isAuthedWithPersonalAccessKey = accountConfig && accountConfig.authType === "personalaccesskey";
|
|
1628
1628
|
const usageEvent = {
|
|
1629
1629
|
portalId: trackingAccountId,
|
|
@@ -1631,7 +1631,7 @@ function trackUsage(action) {
|
|
|
1631
1631
|
eventName: EVENT_NAME,
|
|
1632
1632
|
action,
|
|
1633
1633
|
nodeVersion: getNodeVersionData(),
|
|
1634
|
-
version: "1.2.
|
|
1634
|
+
version: "1.2.1",
|
|
1635
1635
|
os: getPlatform()
|
|
1636
1636
|
};
|
|
1637
1637
|
const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
|
|
@@ -1774,7 +1774,7 @@ var getProjectNameFromHSConfig = (hsProjectConfigPath) => {
|
|
|
1774
1774
|
// src/proxyPage/proxyPage.ts
|
|
1775
1775
|
import path5 from "path";
|
|
1776
1776
|
import { normalizePath as normalizePath3 } from "vite";
|
|
1777
|
-
import {
|
|
1777
|
+
import { getConfigAccountIfExists as getConfigAccountIfExists2 } from "@hubspot/local-dev-lib/config";
|
|
1778
1778
|
import { http as hsCliHttp6 } from "@hubspot/local-dev-lib/http";
|
|
1779
1779
|
|
|
1780
1780
|
// src/lib/renderModule.ts
|
|
@@ -2716,29 +2716,33 @@ function renderComponentForPlaceholderModule(viteServer, resolvedPath, localModu
|
|
|
2716
2716
|
);
|
|
2717
2717
|
}
|
|
2718
2718
|
async function proxySpecificPage(request, response, portalId, hublet, contentId, webRoot, viteServer, projectName, projectComponentPath, jsRenderingGates, urlToProxy, fullOriginalUrl) {
|
|
2719
|
-
let
|
|
2719
|
+
let account;
|
|
2720
2720
|
let proxyEnv;
|
|
2721
2721
|
const prettyPrint = isDebugUrlString3(urlToProxy);
|
|
2722
2722
|
try {
|
|
2723
|
-
|
|
2724
|
-
if (
|
|
2723
|
+
account = getConfigAccountIfExists2(portalId);
|
|
2724
|
+
if (!account) {
|
|
2725
2725
|
throw new Error();
|
|
2726
2726
|
}
|
|
2727
|
-
proxyEnv =
|
|
2727
|
+
proxyEnv = account == null ? void 0 : account.env;
|
|
2728
2728
|
} catch (e) {
|
|
2729
2729
|
response.status(500).end(
|
|
2730
2730
|
`Unable to find account for hubid = ${portalId}. Please check your hubspot.config.yaml`
|
|
2731
2731
|
);
|
|
2732
2732
|
return;
|
|
2733
2733
|
}
|
|
2734
|
-
if (!
|
|
2734
|
+
if (!account) {
|
|
2735
2735
|
response.status(500).end(
|
|
2736
2736
|
`Unable to find account for hubid = ${portalId}. Please check your hubspot.config.yaml`
|
|
2737
2737
|
);
|
|
2738
2738
|
return;
|
|
2739
2739
|
}
|
|
2740
2740
|
try {
|
|
2741
|
-
const previewInfo = await fetchPreviewInfo_default(
|
|
2741
|
+
const previewInfo = await fetchPreviewInfo_default(
|
|
2742
|
+
account.accountId,
|
|
2743
|
+
portalId,
|
|
2744
|
+
contentId
|
|
2745
|
+
);
|
|
2742
2746
|
const { previewKey } = previewInfo;
|
|
2743
2747
|
const environmentConfig = buildStaticEnvConfig(
|
|
2744
2748
|
portalId,
|
|
@@ -2748,7 +2752,7 @@ async function proxySpecificPage(request, response, portalId, hublet, contentId,
|
|
|
2748
2752
|
jsRenderingGates
|
|
2749
2753
|
);
|
|
2750
2754
|
let pageHtml = (await makeProxyPreviewRequest(
|
|
2751
|
-
accountId,
|
|
2755
|
+
account.accountId,
|
|
2752
2756
|
urlToProxy,
|
|
2753
2757
|
previewKey,
|
|
2754
2758
|
contentId,
|
|
@@ -2905,7 +2909,7 @@ ${result}`;
|
|
|
2905
2909
|
|
|
2906
2910
|
// src/lib/renderModulePreview.ts
|
|
2907
2911
|
import { http as hsCliHttp7 } from "@hubspot/local-dev-lib/http";
|
|
2908
|
-
import {
|
|
2912
|
+
import { getConfigAccountIfExists as getConfigAccountIfExists3 } from "@hubspot/local-dev-lib/config";
|
|
2909
2913
|
import { accessTokenForPersonalAccessKey } from "@hubspot/local-dev-lib/personalAccessKey";
|
|
2910
2914
|
import jsdom from "jsdom";
|
|
2911
2915
|
var { JSDOM } = jsdom;
|
|
@@ -3049,7 +3053,7 @@ async function renderLocalProjectModulePreview(moduleName, authedPortalId, authe
|
|
|
3049
3053
|
let templatePreview;
|
|
3050
3054
|
try {
|
|
3051
3055
|
const authHeaders = {};
|
|
3052
|
-
const accountConfig =
|
|
3056
|
+
const accountConfig = getConfigAccountIfExists3(authedPortalId);
|
|
3053
3057
|
if (accountConfig && accountConfig.authType === "personalaccesskey") {
|
|
3054
3058
|
const accessToken = await accessTokenForPersonalAccessKey(authedPortalId);
|
|
3055
3059
|
authHeaders["Authorization"] = `Bearer ${accessToken}`;
|
|
@@ -3513,7 +3517,7 @@ var moduleFieldsJson_default = moduleFieldsJsonRouteHandler;
|
|
|
3513
3517
|
// src/proxyPage/fetchContentMetadata.ts
|
|
3514
3518
|
import http from "http";
|
|
3515
3519
|
import https from "https";
|
|
3516
|
-
import {
|
|
3520
|
+
import { getConfigAccountIfExists as getConfigAccountIfExists4 } from "@hubspot/local-dev-lib/config";
|
|
3517
3521
|
async function requestPage(url3, redirects = 0, originalUrl) {
|
|
3518
3522
|
if (redirects > 5) {
|
|
3519
3523
|
throw new Error(
|
|
@@ -3581,7 +3585,7 @@ async function fetchContentMetadata(url3, portalId) {
|
|
|
3581
3585
|
);
|
|
3582
3586
|
} else {
|
|
3583
3587
|
const portalIdFromResponse = parseInt(portalIdHeader, 10);
|
|
3584
|
-
const pageAccount = await
|
|
3588
|
+
const pageAccount = await getConfigAccountIfExists4(portalIdFromResponse);
|
|
3585
3589
|
if (!pageAccount) {
|
|
3586
3590
|
throw new Error(
|
|
3587
3591
|
`No CLI auth for portal ${portalIdFromResponse} found, please run \`hs auth\``
|
|
@@ -4128,7 +4132,7 @@ var buildModuleIndex = () => buildHTMLResponse(`
|
|
|
4128
4132
|
// src/routes/hublTemplateRouteHandler.ts
|
|
4129
4133
|
import { http as hsCliHttp10 } from "@hubspot/local-dev-lib/http";
|
|
4130
4134
|
import { buildStaticEnvConfig as buildStaticEnvConfig5 } from "@hubspot/cms-components";
|
|
4131
|
-
import {
|
|
4135
|
+
import { getConfigAccountEnvironment } from "@hubspot/local-dev-lib/config";
|
|
4132
4136
|
var HUBSPOT_PREVIEW_BASE_TAG_REGEX = /<base\s+[^>]*href=["'][^"']*(?:hubspotpreview(?:qa)?)[^"']*["'][^>]*>/i;
|
|
4133
4137
|
var templateRouteHandler = async (request, response) => {
|
|
4134
4138
|
sendTrackingRequest("view-template-route");
|
|
@@ -4144,7 +4148,7 @@ var templateRouteHandler = async (request, response) => {
|
|
|
4144
4148
|
const environmentConfig = buildStaticEnvConfig5(
|
|
4145
4149
|
authedPortalId,
|
|
4146
4150
|
"na1",
|
|
4147
|
-
|
|
4151
|
+
getConfigAccountEnvironment(authedPortalId),
|
|
4148
4152
|
false,
|
|
4149
4153
|
jsRenderingGates
|
|
4150
4154
|
);
|
|
@@ -4551,7 +4555,7 @@ import express from "express";
|
|
|
4551
4555
|
|
|
4552
4556
|
// src/shadowDevServer/createShadowDevServerRoutes.ts
|
|
4553
4557
|
import { Router as Router3 } from "express";
|
|
4554
|
-
import {
|
|
4558
|
+
import { getConfigAccountIfExists as getConfigAccountIfExists5 } from "@hubspot/local-dev-lib/config";
|
|
4555
4559
|
import cors from "cors";
|
|
4556
4560
|
function getShadowDevServerCheckHandler(devServerPort, themePath) {
|
|
4557
4561
|
return async function shadowDevServerCheckHandler(request, response) {
|
|
@@ -4564,12 +4568,12 @@ function getShadowDevServerCheckHandler(devServerPort, themePath) {
|
|
|
4564
4568
|
portalId: portalIdString
|
|
4565
4569
|
} = query;
|
|
4566
4570
|
const portalId = parseInt(portalIdString, 10);
|
|
4567
|
-
let
|
|
4571
|
+
let account;
|
|
4568
4572
|
let isTemplateFromDevTheme = false;
|
|
4569
4573
|
let localProxyUrl;
|
|
4570
4574
|
try {
|
|
4571
|
-
|
|
4572
|
-
if (
|
|
4575
|
+
account = getConfigAccountIfExists5(portalId);
|
|
4576
|
+
if (!account) {
|
|
4573
4577
|
throw new Error();
|
|
4574
4578
|
}
|
|
4575
4579
|
} catch (e) {
|
|
@@ -4580,7 +4584,7 @@ function getShadowDevServerCheckHandler(devServerPort, themePath) {
|
|
|
4580
4584
|
}
|
|
4581
4585
|
try {
|
|
4582
4586
|
const { templatePath } = await fetchPreviewInfo_default(
|
|
4583
|
-
accountId,
|
|
4587
|
+
account.accountId,
|
|
4584
4588
|
portalId,
|
|
4585
4589
|
contentId
|
|
4586
4590
|
);
|
|
@@ -4897,13 +4901,12 @@ function hasFlag(flag, argv = process2.argv) {
|
|
|
4897
4901
|
|
|
4898
4902
|
// src/createDevServer.ts
|
|
4899
4903
|
import {
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
getAccountConfig as getAccountConfig3,
|
|
4903
|
-
loadConfig,
|
|
4904
|
+
getConfigAccountIfExists as getConfigAccountIfExists6,
|
|
4905
|
+
getConfigDefaultAccountIfExists,
|
|
4904
4906
|
validateConfig
|
|
4905
4907
|
} from "@hubspot/local-dev-lib/config";
|
|
4906
4908
|
import { fetchSecrets } from "@hubspot/local-dev-lib/api/secrets";
|
|
4909
|
+
import { PERSONAL_ACCESS_KEY_AUTH_METHOD } from "@hubspot/local-dev-lib/constants/auth";
|
|
4907
4910
|
|
|
4908
4911
|
// src/proxyPage/fetchDomains.ts
|
|
4909
4912
|
import { http as hsCliHttp12 } from "@hubspot/local-dev-lib/http";
|
|
@@ -5481,6 +5484,9 @@ async function createDevServer(webRoot, storybook, hubspotCliConfigPathOption, h
|
|
|
5481
5484
|
let personalAccessKey = null;
|
|
5482
5485
|
let secretNames = [];
|
|
5483
5486
|
let secretNamesFromConfig = [];
|
|
5487
|
+
if (hubspotCliConfigPathOption) {
|
|
5488
|
+
process.env.HUBSPOT_CONFIG_PATH = hubspotCliConfigPathOption;
|
|
5489
|
+
}
|
|
5484
5490
|
if (hubspotCliConfigPathOption && hubspotCliAccountNameOption) {
|
|
5485
5491
|
console.log(
|
|
5486
5492
|
`Loading HS auth (account = ${hubspotCliAccountNameOption}) configuration at: ${hubspotCliConfigPathOption}`
|
|
@@ -5494,25 +5500,26 @@ async function createDevServer(webRoot, storybook, hubspotCliConfigPathOption, h
|
|
|
5494
5500
|
`Loading HS auth (account = ${hubspotCliAccountNameOption}) configuration.`
|
|
5495
5501
|
);
|
|
5496
5502
|
}
|
|
5497
|
-
loadConfig(hubspotCliConfigPathOption || null, { useEnv: false });
|
|
5498
5503
|
const cmsAssetConfig = getCMSAssetConfig(webRoot);
|
|
5499
5504
|
secretNamesFromConfig = getSecretNamesFromConfig(cmsAssetConfig);
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
const
|
|
5505
|
+
const { isValid } = validateConfig();
|
|
5506
|
+
if (isValid) {
|
|
5507
|
+
const account = hubspotCliAccountNameOption ? getConfigAccountIfExists6(hubspotCliAccountNameOption) : getConfigDefaultAccountIfExists();
|
|
5508
|
+
if (!account) {
|
|
5509
|
+
console.error(
|
|
5510
|
+
hubspotCliAccountNameOption ? `Couldn't find ${hubspotCliAccountNameOption} in your hubspot.config.yaml` : `No default account found. Run 'hs auth' first.`
|
|
5511
|
+
);
|
|
5512
|
+
process.exit(1);
|
|
5513
|
+
}
|
|
5514
|
+
authedPortalId = account == null ? void 0 : account.accountId;
|
|
5515
|
+
const env2 = account == null ? void 0 : account.env;
|
|
5503
5516
|
if (!env2) {
|
|
5504
5517
|
throw new Error(
|
|
5505
5518
|
`No environment found for account ${hubspotCliAccountNameOption} from hubspot.config.yaml`
|
|
5506
5519
|
);
|
|
5507
5520
|
}
|
|
5508
5521
|
authedEnv = env2;
|
|
5509
|
-
personalAccessKey =
|
|
5510
|
-
if (!authedPortalId && hubspotCliAccountNameOption) {
|
|
5511
|
-
console.error(
|
|
5512
|
-
`Couldn't find ${hubspotCliAccountNameOption} in your hubspot.config.yaml`
|
|
5513
|
-
);
|
|
5514
|
-
process.exit(1);
|
|
5515
|
-
}
|
|
5522
|
+
personalAccessKey = (account == null ? void 0 : account.authType) === PERSONAL_ACCESS_KEY_AUTH_METHOD.value ? account == null ? void 0 : account.personalAccessKey : null;
|
|
5516
5523
|
if (personalAccessKey) {
|
|
5517
5524
|
try {
|
|
5518
5525
|
jsRenderingGates = await getJsRenderingGates(
|
package/dist/internalSsr.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// ../cms-js-internal/dist/types-
|
|
1
|
+
// ../cms-js-internal/dist/types-Bqf9htWu.js
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { createHash } from "crypto";
|
|
4
4
|
import fs, { readFileSync, existsSync, readdirSync, lstatSync } from "fs";
|
|
@@ -385,7 +385,8 @@ var GATES = [
|
|
|
385
385
|
"CMS:JSRenderer:ModuleHubl",
|
|
386
386
|
"CMS:JSRenderer:RemoveCjsPlugin",
|
|
387
387
|
"CMS:JSRenderer:RemoveMockClientEntryPlugin",
|
|
388
|
-
"CMS:JSRenderer:AnalyzeCmsModules"
|
|
388
|
+
"CMS:JSRenderer:AnalyzeCmsModules",
|
|
389
|
+
"CMS:JSRenderer:CompressResponse"
|
|
389
390
|
];
|
|
390
391
|
var ENABLED_FEATURES_GATE_MAP = {
|
|
391
392
|
"cms:jsr:getServerSideProps": "CMS:JSRenderer:GetServerSideProps",
|
package/dist/run.js
CHANGED
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
isMissingScopeError,
|
|
59
59
|
isSpecifiedError
|
|
60
60
|
} from "@hubspot/local-dev-lib/errors/index";
|
|
61
|
-
import {
|
|
61
|
+
import { getConfigAccountIfExists } from "@hubspot/local-dev-lib/config";
|
|
62
62
|
import { HUBSPOT_ACCOUNT_TYPE_STRINGS } from "@hubspot/local-dev-lib/constants/config";
|
|
63
63
|
import util from "util";
|
|
64
64
|
import { isAxiosError } from "axios";
|
|
@@ -482,8 +482,8 @@ function shouldSuppressError(err, context = {}) {
|
|
|
482
482
|
return false;
|
|
483
483
|
}
|
|
484
484
|
function uiAccountDescription(accountId, bold = true) {
|
|
485
|
-
const account =
|
|
486
|
-
const message = `${account.name} [${HUBSPOT_ACCOUNT_TYPE_STRINGS[account.accountType]}] (${account.
|
|
485
|
+
const account = getConfigAccountIfExists(accountId);
|
|
486
|
+
const message = `${account.name} [${HUBSPOT_ACCOUNT_TYPE_STRINGS[account.accountType]}] (${account.accountId})`;
|
|
487
487
|
return bold ? chalk.bold(message) : message;
|
|
488
488
|
}
|
|
489
489
|
var { env } = process2;
|
|
@@ -854,7 +854,7 @@ function packagePath(metaUrl, projectPath) {
|
|
|
854
854
|
);
|
|
855
855
|
}
|
|
856
856
|
|
|
857
|
-
// ../cms-js-internal/dist/types-
|
|
857
|
+
// ../cms-js-internal/dist/types-Bqf9htWu.js
|
|
858
858
|
import path3 from "path";
|
|
859
859
|
import { createHash } from "crypto";
|
|
860
860
|
import fs2, { readFileSync, existsSync as existsSync2, readdirSync, lstatSync } from "fs";
|
|
@@ -2163,7 +2163,7 @@ import { buildStaticEnvConfig as buildStaticEnvConfig3 } from "@hubspot/cms-comp
|
|
|
2163
2163
|
|
|
2164
2164
|
// src/lib/trackUsage.ts
|
|
2165
2165
|
import { http as hsCliHttp } from "@hubspot/local-dev-lib/http";
|
|
2166
|
-
import {
|
|
2166
|
+
import { getConfigAccountIfExists as getConfigAccountIfExists2 } from "@hubspot/local-dev-lib/config";
|
|
2167
2167
|
import axios from "axios";
|
|
2168
2168
|
import { getAxiosConfig } from "@hubspot/local-dev-lib/http/getAxiosConfig";
|
|
2169
2169
|
|
|
@@ -2189,7 +2189,7 @@ var getPlatform = () => {
|
|
|
2189
2189
|
};
|
|
2190
2190
|
var getNodeVersionData = () => process.version;
|
|
2191
2191
|
function trackUsage(action) {
|
|
2192
|
-
const accountConfig = trackingAccountId &&
|
|
2192
|
+
const accountConfig = trackingAccountId && getConfigAccountIfExists2(trackingAccountId);
|
|
2193
2193
|
const isAuthedWithPersonalAccessKey = accountConfig && accountConfig.authType === "personalaccesskey";
|
|
2194
2194
|
const usageEvent = {
|
|
2195
2195
|
portalId: trackingAccountId,
|
|
@@ -2197,7 +2197,7 @@ function trackUsage(action) {
|
|
|
2197
2197
|
eventName: EVENT_NAME,
|
|
2198
2198
|
action,
|
|
2199
2199
|
nodeVersion: getNodeVersionData(),
|
|
2200
|
-
version: "1.2.
|
|
2200
|
+
version: "1.2.1",
|
|
2201
2201
|
os: getPlatform()
|
|
2202
2202
|
};
|
|
2203
2203
|
const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
|
|
@@ -2340,7 +2340,7 @@ var getProjectNameFromHSConfig = (hsProjectConfigPath) => {
|
|
|
2340
2340
|
// src/proxyPage/proxyPage.ts
|
|
2341
2341
|
import path6 from "path";
|
|
2342
2342
|
import { normalizePath as normalizePath3 } from "vite";
|
|
2343
|
-
import {
|
|
2343
|
+
import { getConfigAccountIfExists as getConfigAccountIfExists3 } from "@hubspot/local-dev-lib/config";
|
|
2344
2344
|
import { http as hsCliHttp6 } from "@hubspot/local-dev-lib/http";
|
|
2345
2345
|
|
|
2346
2346
|
// src/lib/renderModule.ts
|
|
@@ -3282,29 +3282,33 @@ function renderComponentForPlaceholderModule(viteServer, resolvedPath, localModu
|
|
|
3282
3282
|
);
|
|
3283
3283
|
}
|
|
3284
3284
|
async function proxySpecificPage(request, response, portalId, hublet, contentId, webRoot2, viteServer, projectName, projectComponentPath, jsRenderingGates, urlToProxy, fullOriginalUrl) {
|
|
3285
|
-
let
|
|
3285
|
+
let account;
|
|
3286
3286
|
let proxyEnv;
|
|
3287
3287
|
const prettyPrint = isDebugUrlString3(urlToProxy);
|
|
3288
3288
|
try {
|
|
3289
|
-
|
|
3290
|
-
if (
|
|
3289
|
+
account = getConfigAccountIfExists3(portalId);
|
|
3290
|
+
if (!account) {
|
|
3291
3291
|
throw new Error();
|
|
3292
3292
|
}
|
|
3293
|
-
proxyEnv =
|
|
3293
|
+
proxyEnv = account == null ? void 0 : account.env;
|
|
3294
3294
|
} catch (e) {
|
|
3295
3295
|
response.status(500).end(
|
|
3296
3296
|
`Unable to find account for hubid = ${portalId}. Please check your hubspot.config.yaml`
|
|
3297
3297
|
);
|
|
3298
3298
|
return;
|
|
3299
3299
|
}
|
|
3300
|
-
if (!
|
|
3300
|
+
if (!account) {
|
|
3301
3301
|
response.status(500).end(
|
|
3302
3302
|
`Unable to find account for hubid = ${portalId}. Please check your hubspot.config.yaml`
|
|
3303
3303
|
);
|
|
3304
3304
|
return;
|
|
3305
3305
|
}
|
|
3306
3306
|
try {
|
|
3307
|
-
const previewInfo = await fetchPreviewInfo_default(
|
|
3307
|
+
const previewInfo = await fetchPreviewInfo_default(
|
|
3308
|
+
account.accountId,
|
|
3309
|
+
portalId,
|
|
3310
|
+
contentId
|
|
3311
|
+
);
|
|
3308
3312
|
const { previewKey } = previewInfo;
|
|
3309
3313
|
const environmentConfig = buildStaticEnvConfig(
|
|
3310
3314
|
portalId,
|
|
@@ -3314,7 +3318,7 @@ async function proxySpecificPage(request, response, portalId, hublet, contentId,
|
|
|
3314
3318
|
jsRenderingGates
|
|
3315
3319
|
);
|
|
3316
3320
|
let pageHtml = (await makeProxyPreviewRequest(
|
|
3317
|
-
accountId,
|
|
3321
|
+
account.accountId,
|
|
3318
3322
|
urlToProxy,
|
|
3319
3323
|
previewKey,
|
|
3320
3324
|
contentId,
|
|
@@ -3471,7 +3475,7 @@ ${result}`;
|
|
|
3471
3475
|
|
|
3472
3476
|
// src/lib/renderModulePreview.ts
|
|
3473
3477
|
import { http as hsCliHttp7 } from "@hubspot/local-dev-lib/http";
|
|
3474
|
-
import {
|
|
3478
|
+
import { getConfigAccountIfExists as getConfigAccountIfExists4 } from "@hubspot/local-dev-lib/config";
|
|
3475
3479
|
import { accessTokenForPersonalAccessKey } from "@hubspot/local-dev-lib/personalAccessKey";
|
|
3476
3480
|
import jsdom from "jsdom";
|
|
3477
3481
|
var { JSDOM } = jsdom;
|
|
@@ -3615,7 +3619,7 @@ async function renderLocalProjectModulePreview(moduleName, authedPortalId, authe
|
|
|
3615
3619
|
let templatePreview;
|
|
3616
3620
|
try {
|
|
3617
3621
|
const authHeaders = {};
|
|
3618
|
-
const accountConfig =
|
|
3622
|
+
const accountConfig = getConfigAccountIfExists4(authedPortalId);
|
|
3619
3623
|
if (accountConfig && accountConfig.authType === "personalaccesskey") {
|
|
3620
3624
|
const accessToken = await accessTokenForPersonalAccessKey(authedPortalId);
|
|
3621
3625
|
authHeaders["Authorization"] = `Bearer ${accessToken}`;
|
|
@@ -4079,7 +4083,7 @@ var moduleFieldsJson_default = moduleFieldsJsonRouteHandler;
|
|
|
4079
4083
|
// src/proxyPage/fetchContentMetadata.ts
|
|
4080
4084
|
import http from "http";
|
|
4081
4085
|
import https from "https";
|
|
4082
|
-
import {
|
|
4086
|
+
import { getConfigAccountIfExists as getConfigAccountIfExists5 } from "@hubspot/local-dev-lib/config";
|
|
4083
4087
|
async function requestPage(url3, redirects = 0, originalUrl) {
|
|
4084
4088
|
if (redirects > 5) {
|
|
4085
4089
|
throw new Error(
|
|
@@ -4147,7 +4151,7 @@ async function fetchContentMetadata(url3, portalId) {
|
|
|
4147
4151
|
);
|
|
4148
4152
|
} else {
|
|
4149
4153
|
const portalIdFromResponse = parseInt(portalIdHeader, 10);
|
|
4150
|
-
const pageAccount = await
|
|
4154
|
+
const pageAccount = await getConfigAccountIfExists5(portalIdFromResponse);
|
|
4151
4155
|
if (!pageAccount) {
|
|
4152
4156
|
throw new Error(
|
|
4153
4157
|
`No CLI auth for portal ${portalIdFromResponse} found, please run \`hs auth\``
|
|
@@ -4694,7 +4698,7 @@ var buildModuleIndex = () => buildHTMLResponse(`
|
|
|
4694
4698
|
// src/routes/hublTemplateRouteHandler.ts
|
|
4695
4699
|
import { http as hsCliHttp10 } from "@hubspot/local-dev-lib/http";
|
|
4696
4700
|
import { buildStaticEnvConfig as buildStaticEnvConfig5 } from "@hubspot/cms-components";
|
|
4697
|
-
import {
|
|
4701
|
+
import { getConfigAccountEnvironment } from "@hubspot/local-dev-lib/config";
|
|
4698
4702
|
var HUBSPOT_PREVIEW_BASE_TAG_REGEX = /<base\s+[^>]*href=["'][^"']*(?:hubspotpreview(?:qa)?)[^"']*["'][^>]*>/i;
|
|
4699
4703
|
var templateRouteHandler = async (request, response) => {
|
|
4700
4704
|
sendTrackingRequest("view-template-route");
|
|
@@ -4710,7 +4714,7 @@ var templateRouteHandler = async (request, response) => {
|
|
|
4710
4714
|
const environmentConfig = buildStaticEnvConfig5(
|
|
4711
4715
|
authedPortalId,
|
|
4712
4716
|
"na1",
|
|
4713
|
-
|
|
4717
|
+
getConfigAccountEnvironment(authedPortalId),
|
|
4714
4718
|
false,
|
|
4715
4719
|
jsRenderingGates
|
|
4716
4720
|
);
|
|
@@ -5334,7 +5338,7 @@ import express from "express";
|
|
|
5334
5338
|
|
|
5335
5339
|
// src/shadowDevServer/createShadowDevServerRoutes.ts
|
|
5336
5340
|
import { Router as Router3 } from "express";
|
|
5337
|
-
import {
|
|
5341
|
+
import { getConfigAccountIfExists as getConfigAccountIfExists6 } from "@hubspot/local-dev-lib/config";
|
|
5338
5342
|
import cors from "cors";
|
|
5339
5343
|
function getShadowDevServerCheckHandler(devServerPort, themePath) {
|
|
5340
5344
|
return async function shadowDevServerCheckHandler(request, response) {
|
|
@@ -5347,12 +5351,12 @@ function getShadowDevServerCheckHandler(devServerPort, themePath) {
|
|
|
5347
5351
|
portalId: portalIdString
|
|
5348
5352
|
} = query;
|
|
5349
5353
|
const portalId = parseInt(portalIdString, 10);
|
|
5350
|
-
let
|
|
5354
|
+
let account;
|
|
5351
5355
|
let isTemplateFromDevTheme = false;
|
|
5352
5356
|
let localProxyUrl;
|
|
5353
5357
|
try {
|
|
5354
|
-
|
|
5355
|
-
if (
|
|
5358
|
+
account = getConfigAccountIfExists6(portalId);
|
|
5359
|
+
if (!account) {
|
|
5356
5360
|
throw new Error();
|
|
5357
5361
|
}
|
|
5358
5362
|
} catch (e) {
|
|
@@ -5363,7 +5367,7 @@ function getShadowDevServerCheckHandler(devServerPort, themePath) {
|
|
|
5363
5367
|
}
|
|
5364
5368
|
try {
|
|
5365
5369
|
const { templatePath } = await fetchPreviewInfo_default(
|
|
5366
|
-
accountId,
|
|
5370
|
+
account.accountId,
|
|
5367
5371
|
portalId,
|
|
5368
5372
|
contentId
|
|
5369
5373
|
);
|
|
@@ -5566,13 +5570,12 @@ async function getJsRenderingGates(portalId, env2, personalAccessKey) {
|
|
|
5566
5570
|
|
|
5567
5571
|
// src/createDevServer.ts
|
|
5568
5572
|
import {
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
getAccountConfig as getAccountConfig4,
|
|
5572
|
-
loadConfig,
|
|
5573
|
+
getConfigAccountIfExists as getConfigAccountIfExists7,
|
|
5574
|
+
getConfigDefaultAccountIfExists,
|
|
5573
5575
|
validateConfig
|
|
5574
5576
|
} from "@hubspot/local-dev-lib/config";
|
|
5575
5577
|
import { fetchSecrets } from "@hubspot/local-dev-lib/api/secrets";
|
|
5578
|
+
import { PERSONAL_ACCESS_KEY_AUTH_METHOD } from "@hubspot/local-dev-lib/constants/auth";
|
|
5576
5579
|
|
|
5577
5580
|
// src/proxyPage/fetchDomains.ts
|
|
5578
5581
|
import { http as hsCliHttp12 } from "@hubspot/local-dev-lib/http";
|
|
@@ -6150,6 +6153,9 @@ async function createDevServer(webRoot2, storybook2, hubspotCliConfigPathOption2
|
|
|
6150
6153
|
let personalAccessKey = null;
|
|
6151
6154
|
let secretNames = [];
|
|
6152
6155
|
let secretNamesFromConfig = [];
|
|
6156
|
+
if (hubspotCliConfigPathOption2) {
|
|
6157
|
+
process.env.HUBSPOT_CONFIG_PATH = hubspotCliConfigPathOption2;
|
|
6158
|
+
}
|
|
6153
6159
|
if (hubspotCliConfigPathOption2 && hubspotCliAccountNameOption2) {
|
|
6154
6160
|
console.log(
|
|
6155
6161
|
`Loading HS auth (account = ${hubspotCliAccountNameOption2}) configuration at: ${hubspotCliConfigPathOption2}`
|
|
@@ -6163,25 +6169,26 @@ async function createDevServer(webRoot2, storybook2, hubspotCliConfigPathOption2
|
|
|
6163
6169
|
`Loading HS auth (account = ${hubspotCliAccountNameOption2}) configuration.`
|
|
6164
6170
|
);
|
|
6165
6171
|
}
|
|
6166
|
-
loadConfig(hubspotCliConfigPathOption2 || null, { useEnv: false });
|
|
6167
6172
|
const cmsAssetConfig = getCMSAssetConfig(webRoot2);
|
|
6168
6173
|
secretNamesFromConfig = getSecretNamesFromConfig(cmsAssetConfig);
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
const
|
|
6174
|
+
const { isValid } = validateConfig();
|
|
6175
|
+
if (isValid) {
|
|
6176
|
+
const account = hubspotCliAccountNameOption2 ? getConfigAccountIfExists7(hubspotCliAccountNameOption2) : getConfigDefaultAccountIfExists();
|
|
6177
|
+
if (!account) {
|
|
6178
|
+
console.error(
|
|
6179
|
+
hubspotCliAccountNameOption2 ? `Couldn't find ${hubspotCliAccountNameOption2} in your hubspot.config.yaml` : `No default account found. Run 'hs auth' first.`
|
|
6180
|
+
);
|
|
6181
|
+
process.exit(1);
|
|
6182
|
+
}
|
|
6183
|
+
authedPortalId = account == null ? void 0 : account.accountId;
|
|
6184
|
+
const env2 = account == null ? void 0 : account.env;
|
|
6172
6185
|
if (!env2) {
|
|
6173
6186
|
throw new Error(
|
|
6174
6187
|
`No environment found for account ${hubspotCliAccountNameOption2} from hubspot.config.yaml`
|
|
6175
6188
|
);
|
|
6176
6189
|
}
|
|
6177
6190
|
authedEnv = env2;
|
|
6178
|
-
personalAccessKey =
|
|
6179
|
-
if (!authedPortalId && hubspotCliAccountNameOption2) {
|
|
6180
|
-
console.error(
|
|
6181
|
-
`Couldn't find ${hubspotCliAccountNameOption2} in your hubspot.config.yaml`
|
|
6182
|
-
);
|
|
6183
|
-
process.exit(1);
|
|
6184
|
-
}
|
|
6191
|
+
personalAccessKey = (account == null ? void 0 : account.authType) === PERSONAL_ACCESS_KEY_AUTH_METHOD.value ? account == null ? void 0 : account.personalAccessKey : null;
|
|
6185
6192
|
if (personalAccessKey) {
|
|
6186
6193
|
try {
|
|
6187
6194
|
jsRenderingGates = await getJsRenderingGates(
|
package/dist/storybook/index.js
CHANGED
|
@@ -8,7 +8,7 @@ var __export = (target, all) => {
|
|
|
8
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
// ../cms-js-internal/dist/types-
|
|
11
|
+
// ../cms-js-internal/dist/types-Bqf9htWu.js
|
|
12
12
|
import path from "path";
|
|
13
13
|
import { createHash } from "crypto";
|
|
14
14
|
import fs, { readFileSync, existsSync, readdirSync, lstatSync } from "fs";
|
|
@@ -378,8 +378,8 @@ function isStylesheetAsset(staticAsset) {
|
|
|
378
378
|
return staticAsset.type === "stylesheet";
|
|
379
379
|
}
|
|
380
380
|
var COMPONENT_EXTENSIONS, ENTRY_POINTS_PATH, MODULE_FOLDER_PATH, TEMPLATE_FOLDER_PATH, VIRTUAL_ISLAND_RUNTIME, VIRTUAL_CONFIG_SETUP, CSS_LANGS_RE, collectCssModules, collectCssInDev, badInlineJsChars, inlineJsEscapeChars, viteRoot, viteCommand, clientRenderIsland, virtualClientRenderIslandModuleId, scriptTagToLogServerMessages, getComponentExtension, hasComponentExtension, isStorybookStory, removeComponentExtension, COMBINED_REACT_BASE_PATH, ISLAND_RUNTIME_CONFIG_BASE_PATH, removeIndexFromPath, removeIndexOrTrailingJsFromPath, HEALTHCHECKS_ENABLED_DEFAULT, HEALTHCHECKS_STRICT_DEFAULT, BUILD_INFO_PATH, GATES, ENABLED_FEATURES_GATE_MAP, findAllComponentsIn;
|
|
381
|
-
var
|
|
382
|
-
"../cms-js-internal/dist/types-
|
|
381
|
+
var init_types_Bqf9htWu = __esm({
|
|
382
|
+
"../cms-js-internal/dist/types-Bqf9htWu.js"() {
|
|
383
383
|
COMPONENT_EXTENSIONS = [".jsx", ".tsx", ".js", ".ts"];
|
|
384
384
|
ENTRY_POINTS_PATH = "components/partials/";
|
|
385
385
|
MODULE_FOLDER_PATH = "components/modules/";
|
|
@@ -500,7 +500,8 @@ ${groupEnd}</script>
|
|
|
500
500
|
"CMS:JSRenderer:ModuleHubl",
|
|
501
501
|
"CMS:JSRenderer:RemoveCjsPlugin",
|
|
502
502
|
"CMS:JSRenderer:RemoveMockClientEntryPlugin",
|
|
503
|
-
"CMS:JSRenderer:AnalyzeCmsModules"
|
|
503
|
+
"CMS:JSRenderer:AnalyzeCmsModules",
|
|
504
|
+
"CMS:JSRenderer:CompressResponse"
|
|
504
505
|
];
|
|
505
506
|
ENABLED_FEATURES_GATE_MAP = {
|
|
506
507
|
"cms:jsr:getServerSideProps": "CMS:JSRenderer:GetServerSideProps",
|
|
@@ -1170,8 +1171,8 @@ function GlobalPartialSlot(props) {
|
|
|
1170
1171
|
var setProperty, getProperty, hasProperty, serializeIslandDataForInlineScript, writeSharedStateToJsGlobal, createIslandsGlobalJsForClientInDev, traverse, CMS_MODULE_COMPONENT_NAME, DND_AREA_COMPONENT_NAME, PLUGIN_NAME, promiseForNewWritableStream, renderStreamToPromise, createServerRenderContextV22, createServerRenderContext2, renderServerSidePropsWithAsyncLocalStoreContext, bootStrapRenderContext;
|
|
1171
1172
|
var init_dist = __esm({
|
|
1172
1173
|
"../cms-js-internal/dist/index.js"() {
|
|
1173
|
-
|
|
1174
|
-
|
|
1174
|
+
init_types_Bqf9htWu();
|
|
1175
|
+
init_types_Bqf9htWu();
|
|
1175
1176
|
({ setProperty, getProperty, hasProperty } = dotProp);
|
|
1176
1177
|
serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestData, baseIndent = 0, prettyPrint) => {
|
|
1177
1178
|
const islandsArrayToSerialize = tweakedIslandsArray.map(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cms-dev-server",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -29,8 +29,8 @@
|
|
|
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": "^1.2.
|
|
33
|
-
"@hubspot/local-dev-lib": "
|
|
32
|
+
"@hubspot/cms-components": "^1.2.1",
|
|
33
|
+
"@hubspot/local-dev-lib": "4.0.0",
|
|
34
34
|
"@inquirer/select": "^2.0.0",
|
|
35
35
|
"@originjs/vite-plugin-commonjs": "^1.0.3",
|
|
36
36
|
"@radix-ui/react-dialog": "^1.1.2",
|
|
@@ -133,5 +133,5 @@
|
|
|
133
133
|
"publishConfig": {
|
|
134
134
|
"access": "public"
|
|
135
135
|
},
|
|
136
|
-
"gitHead": "
|
|
136
|
+
"gitHead": "9b75ac5975c1712655c93be4b1f9c8cc41a547b0"
|
|
137
137
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
export declare function getDevServerCommandLineOptions(argv: NodeJS.Process['argv']): {
|
|
3
|
+
hubspotCliConfigPathOption: string;
|
|
4
|
+
hubspotCliAccountNameOption: string;
|
|
5
|
+
sslEnabledOption: boolean;
|
|
6
|
+
storybook: boolean;
|
|
7
|
+
fieldGenEnabledOption: boolean;
|
|
8
|
+
webRoot: string;
|
|
9
|
+
resetSession: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare function buildThemePreviewOptions(webRoot: string): Promise<{
|
|
12
|
+
filePaths: string[];
|
|
13
|
+
startProgressBar: (numFiles: any) => {
|
|
14
|
+
onAttemptCallback: () => void;
|
|
15
|
+
onSuccessCallback: () => void;
|
|
16
|
+
onFirstErrorCallback: () => void;
|
|
17
|
+
onRetryCallback: () => void;
|
|
18
|
+
onFinalErrorCallback: () => any;
|
|
19
|
+
onFinishCallback: (results: any) => void;
|
|
20
|
+
};
|
|
21
|
+
dest: any;
|
|
22
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const templateTypeMap: Record<number, string>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Request, Response, NextFunction } from 'express';
|
|
2
|
+
export declare function handleGetModulePages(req: Request, res: Response, next: NextFunction): Promise<Response<any, Record<string, any>>>;
|
|
3
|
+
export declare function handleOpenFile(req: Request, res: Response, next: NextFunction): Response<any, Record<string, any>>;
|
|
4
|
+
export declare function appServerApiRouteHandler(): import("express-serve-static-core").Router;
|
|
5
|
+
export default appServerApiRouteHandler;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Request, Response, NextFunction } from 'express';
|
|
2
|
+
export declare function handleGetModulePages(req: Request, res: Response, next: NextFunction): Promise<Response<any, Record<string, any>>>;
|
|
3
|
+
export declare function handleOpenFile(req: Request, res: Response, next: NextFunction): Promise<Response<any, Record<string, any>>>;
|
|
4
|
+
export declare function appServerRoutes(): import("express-serve-static-core").Router;
|
|
5
|
+
export default appServerRoutes;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Request, Response, NextFunction } from 'express';
|
|
2
|
+
export declare function handleGetModulePages(req: Request, res: Response, next: NextFunction): Promise<Response<any, Record<string, any>>>;
|
|
3
|
+
export declare function handleOpenFile(req: Request, res: Response, next: NextFunction): Response<any, Record<string, any>>;
|
|
4
|
+
export declare function createAppServerRoutes(): import("express-serve-static-core").Router;
|
|
5
|
+
export default createAppServerRoutes;
|