@hubspot/cms-dev-server 1.0.20 → 1.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/assets/{index-CcBj6IXI.js → index-C-xmsAMz.js} +30 -30
- package/dist/app/index.html +1 -1
- package/dist/app/server/serverEntry.js +2 -0
- package/dist/generateJsonFromJsx.js +1 -1
- package/dist/index.js +100 -8
- package/dist/internalSsr.js +83 -6
- package/dist/run.js +100 -8
- package/dist/storybook/index.js +1 -1
- package/dist/storybook-main/main.js +87 -10
- package/package.json +3 -3
- package/types/lib/localComponentsLoader.d.ts +2 -0
- package/types/lib/renderModulePreview.d.ts +1 -0
- package/types/lib/viteAssetHandler.d.ts +15 -0
- package/types/plugins/hubspotStaticAssetPlugin.d.ts +2 -0
- package/types/plugins/remoteAssetsPlugin.d.ts +7 -0
- package/types/plugins/requestSigningPlugin.d.ts +6 -0
- package/types/constants/errors.d.ts +0 -5
- package/types/createAppViteConfig.d.ts +0 -2
- package/types/lib/cli.d.ts +0 -22
- package/types/lib/cliUtils.d.ts +0 -14
- package/types/lib/constants.d.ts +0 -1
- package/types/routes/api.d.ts +0 -2
- package/types/routes/appServerApiRouteHandler.d.ts +0 -5
- package/types/routes/appServerRoutes.d.ts +0 -5
- package/types/storybook-main/preview.d.ts +0 -9
package/dist/app/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>CMS React Dev Server Home</title>
|
|
7
7
|
<!--app-head-->
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-C-xmsAMz.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-yaZ-s2DZ.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
@@ -2238,6 +2238,7 @@ function useAddModule(name, path, label) {
|
|
|
2238
2238
|
}
|
|
2239
2239
|
};
|
|
2240
2240
|
}
|
|
2241
|
+
var supportedTemplateTypeMap = { page: 4 };
|
|
2241
2242
|
async function renderServerSidePropsWithAsyncLocalStoreContext$1(getServerSideProps, propsAndDeps, renderContext) {
|
|
2242
2243
|
var _a;
|
|
2243
2244
|
if (propsAndDeps.extraDeps.url && ((_a = propsAndDeps.extraDeps) == null ? void 0 : _a.url.toString()) !== renderContext.pageUrl) {
|
|
@@ -2309,6 +2310,7 @@ const cmsComponents = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defin
|
|
|
2309
2310
|
setSecrets,
|
|
2310
2311
|
setSecretsFromEnv,
|
|
2311
2312
|
sortIslandRootsByPriority,
|
|
2313
|
+
supportedTemplateTypeMap,
|
|
2312
2314
|
unstable_usePodcastEpisodes,
|
|
2313
2315
|
unstable_usePodcastShows,
|
|
2314
2316
|
unstable_useVideos,
|
|
@@ -9,7 +9,7 @@ import { normalizePath as normalizePath2 } from "vite";
|
|
|
9
9
|
import { createServer as createViteServer } from "vite";
|
|
10
10
|
import { default as react } from "@vitejs/plugin-react";
|
|
11
11
|
|
|
12
|
-
// ../cms-js-internal/dist/types-
|
|
12
|
+
// ../cms-js-internal/dist/types-BxnmA6nH.js
|
|
13
13
|
import path from "path";
|
|
14
14
|
var viteRoot;
|
|
15
15
|
var viteCommand;
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { createServer as createViteServer } from "vite";
|
|
3
3
|
import { default as react } from "@vitejs/plugin-react";
|
|
4
4
|
|
|
5
|
-
// ../cms-js-internal/dist/types-
|
|
5
|
+
// ../cms-js-internal/dist/types-BxnmA6nH.js
|
|
6
6
|
import path from "path";
|
|
7
7
|
import { createHash } from "crypto";
|
|
8
8
|
import fs, { readFileSync, existsSync, readdirSync, lstatSync } from "fs";
|
|
@@ -10,6 +10,64 @@ import { join } from "path/posix";
|
|
|
10
10
|
var COMPONENT_EXTENSIONS = [".jsx", ".tsx", ".js", ".ts"];
|
|
11
11
|
var ENTRY_POINTS_PATH = "components/partials/";
|
|
12
12
|
var MODULE_FOLDER_PATH = "components/modules/";
|
|
13
|
+
function sortKeys(input, options = {}) {
|
|
14
|
+
const { deep, compare } = options;
|
|
15
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
16
|
+
function deepSortArray(array) {
|
|
17
|
+
const resultFromCache = cache.get(array);
|
|
18
|
+
if (resultFromCache !== void 0) {
|
|
19
|
+
return resultFromCache;
|
|
20
|
+
}
|
|
21
|
+
const result = [];
|
|
22
|
+
cache.set(array, result);
|
|
23
|
+
result.push(
|
|
24
|
+
...array.map((item) => {
|
|
25
|
+
if (Array.isArray(item)) {
|
|
26
|
+
return deepSortArray(item);
|
|
27
|
+
}
|
|
28
|
+
if (isPlainObject(item)) {
|
|
29
|
+
return _sortKeys(item);
|
|
30
|
+
}
|
|
31
|
+
return item;
|
|
32
|
+
})
|
|
33
|
+
);
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
function _sortKeys(object) {
|
|
37
|
+
const resultFromCache = cache.get(object);
|
|
38
|
+
if (resultFromCache !== void 0) {
|
|
39
|
+
return resultFromCache;
|
|
40
|
+
}
|
|
41
|
+
const result = {};
|
|
42
|
+
const keys = Object.keys(object).sort(compare);
|
|
43
|
+
cache.set(object, result);
|
|
44
|
+
for (const key of keys) {
|
|
45
|
+
const value = object[key];
|
|
46
|
+
let newValue;
|
|
47
|
+
if (deep && Array.isArray(value)) {
|
|
48
|
+
newValue = deepSortArray(value);
|
|
49
|
+
} else {
|
|
50
|
+
newValue = deep && isPlainObject(value) ? _sortKeys(value) : value;
|
|
51
|
+
}
|
|
52
|
+
Object.defineProperty(result, key, {
|
|
53
|
+
...Object.getOwnPropertyDescriptor(object, key),
|
|
54
|
+
value: newValue
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
59
|
+
if (Array.isArray(input)) {
|
|
60
|
+
return deep ? deepSortArray(input) : [...input];
|
|
61
|
+
}
|
|
62
|
+
return _sortKeys(input);
|
|
63
|
+
}
|
|
64
|
+
function isPlainObject(value) {
|
|
65
|
+
if (typeof value !== "object" || value === null) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
const prototype = Object.getPrototypeOf(value);
|
|
69
|
+
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
|
|
70
|
+
}
|
|
13
71
|
var badInlineJsChars = /[\u2028\u2029<>/]/g;
|
|
14
72
|
var inlineJsEscapeChars = {
|
|
15
73
|
"\u2028": "\\u2028",
|
|
@@ -27,11 +85,18 @@ function escapeForInlineJS(input) {
|
|
|
27
85
|
function jsonStringifyAndEscapeForInlineJS(input, { baseIndent = 0, jsonIndent = 2, prettyPrint = true } = {}) {
|
|
28
86
|
const indentString = " ".repeat(baseIndent);
|
|
29
87
|
jsonIndent = prettyPrint ? jsonIndent : void 0;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
88
|
+
let sorted;
|
|
89
|
+
try {
|
|
90
|
+
if (isPlainObject(input) || Array.isArray(input)) {
|
|
91
|
+
sorted = sortKeys(input, { deep: true });
|
|
92
|
+
}
|
|
93
|
+
} catch (e) {
|
|
94
|
+
console.error("Error sorting Island keys", e);
|
|
95
|
+
}
|
|
96
|
+
return escapeForInlineJS(
|
|
97
|
+
JSON.stringify(sorted ?? input, null, jsonIndent)
|
|
98
|
+
).replace(/\n/gm, `
|
|
99
|
+
${indentString}`);
|
|
35
100
|
}
|
|
36
101
|
var viteRoot;
|
|
37
102
|
var viteCommand;
|
|
@@ -1573,7 +1638,7 @@ function trackUsage(action) {
|
|
|
1573
1638
|
eventName: EVENT_NAME,
|
|
1574
1639
|
action,
|
|
1575
1640
|
nodeVersion: getNodeVersionData(),
|
|
1576
|
-
version: "1.0.
|
|
1641
|
+
version: "1.0.30",
|
|
1577
1642
|
os: getPlatform()
|
|
1578
1643
|
};
|
|
1579
1644
|
const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
|
|
@@ -2895,6 +2960,26 @@ async function renderRemoteModulePreview(modulePath, authedPortalId, authedEnv,
|
|
|
2895
2960
|
const cssNeeded = Array.from(dom.window.document.querySelectorAll("style")).map((element) => element.outerHTML).join("");
|
|
2896
2961
|
return { html: modulePreviewContent, cssNeeded };
|
|
2897
2962
|
}
|
|
2963
|
+
async function signUrl(authedPortalId, unsignedUrl) {
|
|
2964
|
+
const request2 = {
|
|
2965
|
+
unsignedUrl,
|
|
2966
|
+
httpMethod: "POST"
|
|
2967
|
+
};
|
|
2968
|
+
try {
|
|
2969
|
+
const response = await hsCliHttp7.post(authedPortalId, {
|
|
2970
|
+
url: "/url-signer-rest/v1/signing",
|
|
2971
|
+
headers: {
|
|
2972
|
+
"Content-Type": "application/json",
|
|
2973
|
+
Accept: "application/json"
|
|
2974
|
+
},
|
|
2975
|
+
data: JSON.stringify(request2)
|
|
2976
|
+
});
|
|
2977
|
+
return response.data.signedUrl;
|
|
2978
|
+
} catch (error) {
|
|
2979
|
+
console.error("Error signing URL:", error);
|
|
2980
|
+
throw error;
|
|
2981
|
+
}
|
|
2982
|
+
}
|
|
2898
2983
|
async function renderLocalProjectModulePreview(moduleName, authedPortalId, authedEnv, authedHublet, webRoot, viteServer, jsRenderingGates, projectName, projectComponentPath, fullOriginalUrl, cookieValue, fieldOverrides = {}) {
|
|
2899
2984
|
const modulePath = normalizePath4(
|
|
2900
2985
|
path6.resolve(webRoot, "components/modules/", moduleName)
|
|
@@ -2958,8 +3043,15 @@ async function renderLocalProjectModulePreview(moduleName, authedPortalId, authe
|
|
|
2958
3043
|
});
|
|
2959
3044
|
const currentHubApiDomainOverride = process.env.HUBAPI_DOMAIN_OVERRIDE;
|
|
2960
3045
|
process.env.HUBAPI_DOMAIN_OVERRIDE = `api.hubspot`;
|
|
3046
|
+
const unsignedUrl = `https://app.hubspot${authedEnv === "qa" ? "qa" : ""}.com/api/cos-rendering/v1/public/_hcms/preview/template/multiform`;
|
|
3047
|
+
const signedUrl = await signUrl(authedPortalId, unsignedUrl);
|
|
3048
|
+
const signedUrlObj = new URL(signedUrl);
|
|
3049
|
+
queryParams.forEach((value, key) => {
|
|
3050
|
+
signedUrlObj.searchParams.append(key, value);
|
|
3051
|
+
});
|
|
3052
|
+
const signedUrlWithQueryParams = signedUrlObj.toString();
|
|
2961
3053
|
const templatePreview = (await hsCliHttp7.post(authedPortalId, {
|
|
2962
|
-
url:
|
|
3054
|
+
url: signedUrlWithQueryParams,
|
|
2963
3055
|
headers: {
|
|
2964
3056
|
["content-type"]: "application/x-www-form-urlencoded",
|
|
2965
3057
|
["Accept"]: "text/html",
|
package/dist/internalSsr.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// ../cms-js-internal/dist/types-
|
|
1
|
+
// ../cms-js-internal/dist/types-BxnmA6nH.js
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { createHash } from "crypto";
|
|
4
4
|
import fs, { readFileSync, existsSync, readdirSync, lstatSync } from "fs";
|
|
@@ -68,6 +68,64 @@ var collectCssInDev = (modulePathToStartWith, viteServer, cssModulesImported = /
|
|
|
68
68
|
).map((cssModule) => createPreloadLink(cssModule.url)).join("\n")}
|
|
69
69
|
`;
|
|
70
70
|
};
|
|
71
|
+
function sortKeys(input, options = {}) {
|
|
72
|
+
const { deep, compare } = options;
|
|
73
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
74
|
+
function deepSortArray(array) {
|
|
75
|
+
const resultFromCache = cache.get(array);
|
|
76
|
+
if (resultFromCache !== void 0) {
|
|
77
|
+
return resultFromCache;
|
|
78
|
+
}
|
|
79
|
+
const result = [];
|
|
80
|
+
cache.set(array, result);
|
|
81
|
+
result.push(
|
|
82
|
+
...array.map((item) => {
|
|
83
|
+
if (Array.isArray(item)) {
|
|
84
|
+
return deepSortArray(item);
|
|
85
|
+
}
|
|
86
|
+
if (isPlainObject(item)) {
|
|
87
|
+
return _sortKeys(item);
|
|
88
|
+
}
|
|
89
|
+
return item;
|
|
90
|
+
})
|
|
91
|
+
);
|
|
92
|
+
return result;
|
|
93
|
+
}
|
|
94
|
+
function _sortKeys(object) {
|
|
95
|
+
const resultFromCache = cache.get(object);
|
|
96
|
+
if (resultFromCache !== void 0) {
|
|
97
|
+
return resultFromCache;
|
|
98
|
+
}
|
|
99
|
+
const result = {};
|
|
100
|
+
const keys = Object.keys(object).sort(compare);
|
|
101
|
+
cache.set(object, result);
|
|
102
|
+
for (const key of keys) {
|
|
103
|
+
const value = object[key];
|
|
104
|
+
let newValue;
|
|
105
|
+
if (deep && Array.isArray(value)) {
|
|
106
|
+
newValue = deepSortArray(value);
|
|
107
|
+
} else {
|
|
108
|
+
newValue = deep && isPlainObject(value) ? _sortKeys(value) : value;
|
|
109
|
+
}
|
|
110
|
+
Object.defineProperty(result, key, {
|
|
111
|
+
...Object.getOwnPropertyDescriptor(object, key),
|
|
112
|
+
value: newValue
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
return result;
|
|
116
|
+
}
|
|
117
|
+
if (Array.isArray(input)) {
|
|
118
|
+
return deep ? deepSortArray(input) : [...input];
|
|
119
|
+
}
|
|
120
|
+
return _sortKeys(input);
|
|
121
|
+
}
|
|
122
|
+
function isPlainObject(value) {
|
|
123
|
+
if (typeof value !== "object" || value === null) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
const prototype = Object.getPrototypeOf(value);
|
|
127
|
+
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
|
|
128
|
+
}
|
|
71
129
|
var badInlineJsChars = /[\u2028\u2029<>/]/g;
|
|
72
130
|
var inlineJsEscapeChars = {
|
|
73
131
|
"\u2028": "\\u2028",
|
|
@@ -85,11 +143,18 @@ function escapeForInlineJS(input) {
|
|
|
85
143
|
function jsonStringifyAndEscapeForInlineJS(input, { baseIndent = 0, jsonIndent = 2, prettyPrint = true } = {}) {
|
|
86
144
|
const indentString = " ".repeat(baseIndent);
|
|
87
145
|
jsonIndent = prettyPrint ? jsonIndent : void 0;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
146
|
+
let sorted;
|
|
147
|
+
try {
|
|
148
|
+
if (isPlainObject(input) || Array.isArray(input)) {
|
|
149
|
+
sorted = sortKeys(input, { deep: true });
|
|
150
|
+
}
|
|
151
|
+
} catch (e) {
|
|
152
|
+
console.error("Error sorting Island keys", e);
|
|
153
|
+
}
|
|
154
|
+
return escapeForInlineJS(
|
|
155
|
+
JSON.stringify(sorted ?? input, null, jsonIndent)
|
|
156
|
+
).replace(/\n/gm, `
|
|
157
|
+
${indentString}`);
|
|
93
158
|
}
|
|
94
159
|
var viteRoot;
|
|
95
160
|
var viteCommand;
|
|
@@ -1180,6 +1245,17 @@ function ModuleSlot(props) {
|
|
|
1180
1245
|
}
|
|
1181
1246
|
);
|
|
1182
1247
|
}
|
|
1248
|
+
function GlobalPartialSlot(props) {
|
|
1249
|
+
return /* @__PURE__ */ jsx(
|
|
1250
|
+
"div",
|
|
1251
|
+
{
|
|
1252
|
+
suppressHydrationWarning: true,
|
|
1253
|
+
dangerouslySetInnerHTML: {
|
|
1254
|
+
__html: `<!-- hs-global-partial-placeholder-${props.name} -->`
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
);
|
|
1258
|
+
}
|
|
1183
1259
|
export {
|
|
1184
1260
|
COMPONENT_EXTENSIONS,
|
|
1185
1261
|
CSS_LANGS_RE,
|
|
@@ -1187,6 +1263,7 @@ export {
|
|
|
1187
1263
|
ENABLED_FEATURES_GATE_MAP,
|
|
1188
1264
|
ENTRY_POINTS_PATH,
|
|
1189
1265
|
GATES,
|
|
1266
|
+
GlobalPartialSlot,
|
|
1190
1267
|
MODULE_FOLDER_PATH,
|
|
1191
1268
|
ModuleSlot,
|
|
1192
1269
|
TEMPLATE_FOLDER_PATH,
|
package/dist/run.js
CHANGED
|
@@ -811,7 +811,7 @@ function packagePath(metaUrl, projectPath) {
|
|
|
811
811
|
);
|
|
812
812
|
}
|
|
813
813
|
|
|
814
|
-
// ../cms-js-internal/dist/types-
|
|
814
|
+
// ../cms-js-internal/dist/types-BxnmA6nH.js
|
|
815
815
|
import path3 from "path";
|
|
816
816
|
import { createHash } from "crypto";
|
|
817
817
|
import fs2, { readFileSync, existsSync as existsSync2, readdirSync, lstatSync } from "fs";
|
|
@@ -819,6 +819,64 @@ import { join as join2 } from "path/posix";
|
|
|
819
819
|
var COMPONENT_EXTENSIONS = [".jsx", ".tsx", ".js", ".ts"];
|
|
820
820
|
var ENTRY_POINTS_PATH = "components/partials/";
|
|
821
821
|
var MODULE_FOLDER_PATH = "components/modules/";
|
|
822
|
+
function sortKeys(input, options = {}) {
|
|
823
|
+
const { deep, compare } = options;
|
|
824
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
825
|
+
function deepSortArray(array) {
|
|
826
|
+
const resultFromCache = cache.get(array);
|
|
827
|
+
if (resultFromCache !== void 0) {
|
|
828
|
+
return resultFromCache;
|
|
829
|
+
}
|
|
830
|
+
const result = [];
|
|
831
|
+
cache.set(array, result);
|
|
832
|
+
result.push(
|
|
833
|
+
...array.map((item) => {
|
|
834
|
+
if (Array.isArray(item)) {
|
|
835
|
+
return deepSortArray(item);
|
|
836
|
+
}
|
|
837
|
+
if (isPlainObject(item)) {
|
|
838
|
+
return _sortKeys(item);
|
|
839
|
+
}
|
|
840
|
+
return item;
|
|
841
|
+
})
|
|
842
|
+
);
|
|
843
|
+
return result;
|
|
844
|
+
}
|
|
845
|
+
function _sortKeys(object) {
|
|
846
|
+
const resultFromCache = cache.get(object);
|
|
847
|
+
if (resultFromCache !== void 0) {
|
|
848
|
+
return resultFromCache;
|
|
849
|
+
}
|
|
850
|
+
const result = {};
|
|
851
|
+
const keys = Object.keys(object).sort(compare);
|
|
852
|
+
cache.set(object, result);
|
|
853
|
+
for (const key of keys) {
|
|
854
|
+
const value = object[key];
|
|
855
|
+
let newValue;
|
|
856
|
+
if (deep && Array.isArray(value)) {
|
|
857
|
+
newValue = deepSortArray(value);
|
|
858
|
+
} else {
|
|
859
|
+
newValue = deep && isPlainObject(value) ? _sortKeys(value) : value;
|
|
860
|
+
}
|
|
861
|
+
Object.defineProperty(result, key, {
|
|
862
|
+
...Object.getOwnPropertyDescriptor(object, key),
|
|
863
|
+
value: newValue
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
return result;
|
|
867
|
+
}
|
|
868
|
+
if (Array.isArray(input)) {
|
|
869
|
+
return deep ? deepSortArray(input) : [...input];
|
|
870
|
+
}
|
|
871
|
+
return _sortKeys(input);
|
|
872
|
+
}
|
|
873
|
+
function isPlainObject(value) {
|
|
874
|
+
if (typeof value !== "object" || value === null) {
|
|
875
|
+
return false;
|
|
876
|
+
}
|
|
877
|
+
const prototype = Object.getPrototypeOf(value);
|
|
878
|
+
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
|
|
879
|
+
}
|
|
822
880
|
var badInlineJsChars = /[\u2028\u2029<>/]/g;
|
|
823
881
|
var inlineJsEscapeChars = {
|
|
824
882
|
"\u2028": "\\u2028",
|
|
@@ -836,11 +894,18 @@ function escapeForInlineJS(input) {
|
|
|
836
894
|
function jsonStringifyAndEscapeForInlineJS(input, { baseIndent = 0, jsonIndent = 2, prettyPrint = true } = {}) {
|
|
837
895
|
const indentString = " ".repeat(baseIndent);
|
|
838
896
|
jsonIndent = prettyPrint ? jsonIndent : void 0;
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
897
|
+
let sorted;
|
|
898
|
+
try {
|
|
899
|
+
if (isPlainObject(input) || Array.isArray(input)) {
|
|
900
|
+
sorted = sortKeys(input, { deep: true });
|
|
901
|
+
}
|
|
902
|
+
} catch (e) {
|
|
903
|
+
console.error("Error sorting Island keys", e);
|
|
904
|
+
}
|
|
905
|
+
return escapeForInlineJS(
|
|
906
|
+
JSON.stringify(sorted ?? input, null, jsonIndent)
|
|
907
|
+
).replace(/\n/gm, `
|
|
908
|
+
${indentString}`);
|
|
844
909
|
}
|
|
845
910
|
var viteRoot;
|
|
846
911
|
var viteCommand;
|
|
@@ -2101,7 +2166,7 @@ function trackUsage(action) {
|
|
|
2101
2166
|
eventName: EVENT_NAME,
|
|
2102
2167
|
action,
|
|
2103
2168
|
nodeVersion: getNodeVersionData(),
|
|
2104
|
-
version: "1.0.
|
|
2169
|
+
version: "1.0.30",
|
|
2105
2170
|
os: getPlatform()
|
|
2106
2171
|
};
|
|
2107
2172
|
const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
|
|
@@ -3423,6 +3488,26 @@ async function renderRemoteModulePreview(modulePath, authedPortalId, authedEnv,
|
|
|
3423
3488
|
const cssNeeded = Array.from(dom.window.document.querySelectorAll("style")).map((element) => element.outerHTML).join("");
|
|
3424
3489
|
return { html: modulePreviewContent, cssNeeded };
|
|
3425
3490
|
}
|
|
3491
|
+
async function signUrl(authedPortalId, unsignedUrl) {
|
|
3492
|
+
const request2 = {
|
|
3493
|
+
unsignedUrl,
|
|
3494
|
+
httpMethod: "POST"
|
|
3495
|
+
};
|
|
3496
|
+
try {
|
|
3497
|
+
const response = await hsCliHttp7.post(authedPortalId, {
|
|
3498
|
+
url: "/url-signer-rest/v1/signing",
|
|
3499
|
+
headers: {
|
|
3500
|
+
"Content-Type": "application/json",
|
|
3501
|
+
Accept: "application/json"
|
|
3502
|
+
},
|
|
3503
|
+
data: JSON.stringify(request2)
|
|
3504
|
+
});
|
|
3505
|
+
return response.data.signedUrl;
|
|
3506
|
+
} catch (error) {
|
|
3507
|
+
console.error("Error signing URL:", error);
|
|
3508
|
+
throw error;
|
|
3509
|
+
}
|
|
3510
|
+
}
|
|
3426
3511
|
async function renderLocalProjectModulePreview(moduleName, authedPortalId, authedEnv, authedHublet, webRoot2, viteServer, jsRenderingGates, projectName, projectComponentPath, fullOriginalUrl, cookieValue, fieldOverrides = {}) {
|
|
3427
3512
|
const modulePath = normalizePath4(
|
|
3428
3513
|
path7.resolve(webRoot2, "components/modules/", moduleName)
|
|
@@ -3486,8 +3571,15 @@ async function renderLocalProjectModulePreview(moduleName, authedPortalId, authe
|
|
|
3486
3571
|
});
|
|
3487
3572
|
const currentHubApiDomainOverride = process.env.HUBAPI_DOMAIN_OVERRIDE;
|
|
3488
3573
|
process.env.HUBAPI_DOMAIN_OVERRIDE = `api.hubspot`;
|
|
3574
|
+
const unsignedUrl = `https://app.hubspot${authedEnv === "qa" ? "qa" : ""}.com/api/cos-rendering/v1/public/_hcms/preview/template/multiform`;
|
|
3575
|
+
const signedUrl = await signUrl(authedPortalId, unsignedUrl);
|
|
3576
|
+
const signedUrlObj = new URL(signedUrl);
|
|
3577
|
+
queryParams.forEach((value, key) => {
|
|
3578
|
+
signedUrlObj.searchParams.append(key, value);
|
|
3579
|
+
});
|
|
3580
|
+
const signedUrlWithQueryParams = signedUrlObj.toString();
|
|
3489
3581
|
const templatePreview = (await hsCliHttp7.post(authedPortalId, {
|
|
3490
|
-
url:
|
|
3582
|
+
url: signedUrlWithQueryParams,
|
|
3491
3583
|
headers: {
|
|
3492
3584
|
["content-type"]: "application/x-www-form-urlencoded",
|
|
3493
3585
|
["Accept"]: "text/html",
|
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-BxnmA6nH.js
|
|
12
12
|
import path from "path";
|
|
13
13
|
import { createHash } from "crypto";
|
|
14
14
|
import fs, { readFileSync, existsSync, readdirSync, lstatSync } from "fs";
|
|
@@ -35,6 +35,64 @@ function createPreloadLink(assetPath, basePath = "") {
|
|
|
35
35
|
throw new Error(`Unknown preload type for ${assetPath}`);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
+
function sortKeys(input, options = {}) {
|
|
39
|
+
const { deep, compare } = options;
|
|
40
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
41
|
+
function deepSortArray(array) {
|
|
42
|
+
const resultFromCache = cache.get(array);
|
|
43
|
+
if (resultFromCache !== void 0) {
|
|
44
|
+
return resultFromCache;
|
|
45
|
+
}
|
|
46
|
+
const result = [];
|
|
47
|
+
cache.set(array, result);
|
|
48
|
+
result.push(
|
|
49
|
+
...array.map((item) => {
|
|
50
|
+
if (Array.isArray(item)) {
|
|
51
|
+
return deepSortArray(item);
|
|
52
|
+
}
|
|
53
|
+
if (isPlainObject(item)) {
|
|
54
|
+
return _sortKeys(item);
|
|
55
|
+
}
|
|
56
|
+
return item;
|
|
57
|
+
})
|
|
58
|
+
);
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
function _sortKeys(object) {
|
|
62
|
+
const resultFromCache = cache.get(object);
|
|
63
|
+
if (resultFromCache !== void 0) {
|
|
64
|
+
return resultFromCache;
|
|
65
|
+
}
|
|
66
|
+
const result = {};
|
|
67
|
+
const keys = Object.keys(object).sort(compare);
|
|
68
|
+
cache.set(object, result);
|
|
69
|
+
for (const key of keys) {
|
|
70
|
+
const value = object[key];
|
|
71
|
+
let newValue;
|
|
72
|
+
if (deep && Array.isArray(value)) {
|
|
73
|
+
newValue = deepSortArray(value);
|
|
74
|
+
} else {
|
|
75
|
+
newValue = deep && isPlainObject(value) ? _sortKeys(value) : value;
|
|
76
|
+
}
|
|
77
|
+
Object.defineProperty(result, key, {
|
|
78
|
+
...Object.getOwnPropertyDescriptor(object, key),
|
|
79
|
+
value: newValue
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return result;
|
|
83
|
+
}
|
|
84
|
+
if (Array.isArray(input)) {
|
|
85
|
+
return deep ? deepSortArray(input) : [...input];
|
|
86
|
+
}
|
|
87
|
+
return _sortKeys(input);
|
|
88
|
+
}
|
|
89
|
+
function isPlainObject(value) {
|
|
90
|
+
if (typeof value !== "object" || value === null) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
const prototype = Object.getPrototypeOf(value);
|
|
94
|
+
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
|
|
95
|
+
}
|
|
38
96
|
function escapeChar(unsafeChar) {
|
|
39
97
|
return inlineJsEscapeChars[unsafeChar];
|
|
40
98
|
}
|
|
@@ -44,11 +102,18 @@ function escapeForInlineJS(input) {
|
|
|
44
102
|
function jsonStringifyAndEscapeForInlineJS(input, { baseIndent = 0, jsonIndent = 2, prettyPrint = true } = {}) {
|
|
45
103
|
const indentString = " ".repeat(baseIndent);
|
|
46
104
|
jsonIndent = prettyPrint ? jsonIndent : void 0;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
105
|
+
let sorted;
|
|
106
|
+
try {
|
|
107
|
+
if (isPlainObject(input) || Array.isArray(input)) {
|
|
108
|
+
sorted = sortKeys(input, { deep: true });
|
|
109
|
+
}
|
|
110
|
+
} catch (e) {
|
|
111
|
+
console.error("Error sorting Island keys", e);
|
|
112
|
+
}
|
|
113
|
+
return escapeForInlineJS(
|
|
114
|
+
JSON.stringify(sorted ?? input, null, jsonIndent)
|
|
115
|
+
).replace(/\n/gm, `
|
|
116
|
+
${indentString}`);
|
|
52
117
|
}
|
|
53
118
|
function resolveIslandPlugin(islandsSet) {
|
|
54
119
|
return {
|
|
@@ -313,8 +378,8 @@ function isStylesheetAsset(staticAsset) {
|
|
|
313
378
|
return staticAsset.type === "stylesheet";
|
|
314
379
|
}
|
|
315
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;
|
|
316
|
-
var
|
|
317
|
-
"../cms-js-internal/dist/types-
|
|
381
|
+
var init_types_BxnmA6nH = __esm({
|
|
382
|
+
"../cms-js-internal/dist/types-BxnmA6nH.js"() {
|
|
318
383
|
COMPONENT_EXTENSIONS = [".jsx", ".tsx", ".js", ".ts"];
|
|
319
384
|
ENTRY_POINTS_PATH = "components/partials/";
|
|
320
385
|
MODULE_FOLDER_PATH = "components/modules/";
|
|
@@ -492,6 +557,7 @@ __export(dist_exports, {
|
|
|
492
557
|
ENABLED_FEATURES_GATE_MAP: () => ENABLED_FEATURES_GATE_MAP,
|
|
493
558
|
ENTRY_POINTS_PATH: () => ENTRY_POINTS_PATH,
|
|
494
559
|
GATES: () => GATES,
|
|
560
|
+
GlobalPartialSlot: () => GlobalPartialSlot,
|
|
495
561
|
MODULE_FOLDER_PATH: () => MODULE_FOLDER_PATH,
|
|
496
562
|
ModuleSlot: () => ModuleSlot,
|
|
497
563
|
TEMPLATE_FOLDER_PATH: () => TEMPLATE_FOLDER_PATH,
|
|
@@ -1095,11 +1161,22 @@ function ModuleSlot(props) {
|
|
|
1095
1161
|
}
|
|
1096
1162
|
);
|
|
1097
1163
|
}
|
|
1164
|
+
function GlobalPartialSlot(props) {
|
|
1165
|
+
return /* @__PURE__ */ jsx(
|
|
1166
|
+
"div",
|
|
1167
|
+
{
|
|
1168
|
+
suppressHydrationWarning: true,
|
|
1169
|
+
dangerouslySetInnerHTML: {
|
|
1170
|
+
__html: `<!-- hs-global-partial-placeholder-${props.name} -->`
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
);
|
|
1174
|
+
}
|
|
1098
1175
|
var setProperty, getProperty, hasProperty, serializeIslandDataForInlineScript, writeSharedStateToJsGlobal, createIslandsGlobalJsForClientInDev, traverse, CMS_MODULE_COMPONENT_NAME, DND_AREA_COMPONENT_NAME, PLUGIN_NAME, promiseForNewWritableStream, renderStreamToPromise, createServerRenderContextV22, createServerRenderContext2, renderServerSidePropsWithAsyncLocalStoreContext, bootStrapRenderContext;
|
|
1099
1176
|
var init_dist = __esm({
|
|
1100
1177
|
"../cms-js-internal/dist/index.js"() {
|
|
1101
|
-
|
|
1102
|
-
|
|
1178
|
+
init_types_BxnmA6nH();
|
|
1179
|
+
init_types_BxnmA6nH();
|
|
1103
1180
|
({ setProperty, getProperty, hasProperty } = dotProp);
|
|
1104
1181
|
serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestData, baseIndent = 0, prettyPrint, isUngatedForClientOnlySupplementalFieldSerialization = false) => {
|
|
1105
1182
|
const islandsArrayToSerialize = tweakedIslandsArray.map(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cms-dev-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.30",
|
|
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": "^1.0.
|
|
32
|
+
"@hubspot/cms-components": "^1.0.30",
|
|
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",
|
|
@@ -132,5 +132,5 @@
|
|
|
132
132
|
"publishConfig": {
|
|
133
133
|
"access": "public"
|
|
134
134
|
},
|
|
135
|
-
"gitHead": "
|
|
135
|
+
"gitHead": "2f5a54c35881df7dab94c9120155edbda106212f"
|
|
136
136
|
}
|
|
@@ -2,4 +2,5 @@ export declare function renderRemoteModulePreview(modulePath: string, authedPort
|
|
|
2
2
|
html: string;
|
|
3
3
|
cssNeeded: string;
|
|
4
4
|
}>;
|
|
5
|
+
export declare function signUrl(authedPortalId: number, unsignedUrl: string): Promise<string>;
|
|
5
6
|
export declare function renderLocalProjectModulePreview(moduleName: string, authedPortalId: any, authedEnv: any, authedHublet: any, webRoot: any, viteServer: any, jsRenderingGates: any, projectName: any, projectComponentPath: any, fullOriginalUrl: any, cookieValue: any, fieldOverrides?: {}): Promise<import("./renderComponentWithCSS.js").RenderResult>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ViteDevServer } from 'vite';
|
|
2
|
+
/**
|
|
3
|
+
* Processes HTML to find remote assets and replace with Vite-managed URLs
|
|
4
|
+
*/
|
|
5
|
+
export declare function processRemoteAssets(html: string, viteServer: ViteDevServer): Promise<string>;
|
|
6
|
+
/**
|
|
7
|
+
* Vite plugin to handle remote assets
|
|
8
|
+
*/
|
|
9
|
+
export declare function remoteAssetsPlugin(): {
|
|
10
|
+
name: string;
|
|
11
|
+
apply: "serve";
|
|
12
|
+
configResolved(config: any): void;
|
|
13
|
+
resolveId(id: string): string;
|
|
14
|
+
load(id: string): Promise<string>;
|
|
15
|
+
};
|