@hubspot/cms-dev-server 1.0.34 → 1.0.36
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 +5 -3
- package/dist/index.js +58 -36
- package/dist/island-runtime.js +55 -4
- package/dist/run.js +58 -36
- package/dist/storybook-main/main.js +53 -11
- package/package.json +12 -10
|
@@ -7,6 +7,7 @@ import { normalizePath as normalizePath2 } from "vite";
|
|
|
7
7
|
|
|
8
8
|
// src/createViteDevServer.ts
|
|
9
9
|
import { createServer as createViteServer } from "vite";
|
|
10
|
+
import { createRequire } from "module";
|
|
10
11
|
import { default as react } from "@vitejs/plugin-react";
|
|
11
12
|
|
|
12
13
|
// ../cms-js-internal/dist/types-BxnmA6nH.js
|
|
@@ -606,13 +607,14 @@ Custom origin: ${process.env.VITE_ORIGIN}
|
|
|
606
607
|
include: ["react", "react-dom", "react-dom/client"]
|
|
607
608
|
}
|
|
608
609
|
} : {};
|
|
610
|
+
const require2 = createRequire(import.meta.url);
|
|
609
611
|
const reactAndIslandsPlugins = isProjectWithReact || process.env.VITEST ? [
|
|
610
612
|
react({
|
|
611
613
|
babel: {
|
|
612
614
|
plugins: [
|
|
613
|
-
"babel-plugin-styled-components",
|
|
614
|
-
"styled-jsx/babel",
|
|
615
|
-
"macros"
|
|
615
|
+
require2.resolve("babel-plugin-styled-components"),
|
|
616
|
+
require2.resolve("styled-jsx/babel"),
|
|
617
|
+
require2.resolve("babel-plugin-macros")
|
|
616
618
|
]
|
|
617
619
|
}
|
|
618
620
|
}),
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// src/createViteDevServer.ts
|
|
2
2
|
import { createServer as createViteServer } from "vite";
|
|
3
|
+
import { createRequire } from "module";
|
|
3
4
|
import { default as react } from "@vitejs/plugin-react";
|
|
4
5
|
|
|
5
6
|
// ../cms-js-internal/dist/types-BxnmA6nH.js
|
|
@@ -1162,13 +1163,14 @@ Custom origin: ${process.env.VITE_ORIGIN}
|
|
|
1162
1163
|
include: ["react", "react-dom", "react-dom/client"]
|
|
1163
1164
|
}
|
|
1164
1165
|
} : {};
|
|
1166
|
+
const require2 = createRequire(import.meta.url);
|
|
1165
1167
|
const reactAndIslandsPlugins = isProjectWithReact || process.env.VITEST ? [
|
|
1166
1168
|
react({
|
|
1167
1169
|
babel: {
|
|
1168
1170
|
plugins: [
|
|
1169
|
-
"babel-plugin-styled-components",
|
|
1170
|
-
"styled-jsx/babel",
|
|
1171
|
-
"macros"
|
|
1171
|
+
require2.resolve("babel-plugin-styled-components"),
|
|
1172
|
+
require2.resolve("styled-jsx/babel"),
|
|
1173
|
+
require2.resolve("babel-plugin-macros")
|
|
1172
1174
|
]
|
|
1173
1175
|
}
|
|
1174
1176
|
}),
|
|
@@ -1209,13 +1211,13 @@ var createViteDevServer_default = createViteDevServer;
|
|
|
1209
1211
|
|
|
1210
1212
|
// src/createDevServer.ts
|
|
1211
1213
|
import path16 from "path";
|
|
1214
|
+
import fs7 from "fs";
|
|
1212
1215
|
import url2 from "url";
|
|
1213
1216
|
import express2 from "express";
|
|
1214
1217
|
import http3 from "http";
|
|
1215
1218
|
import bodyParser from "body-parser";
|
|
1216
1219
|
import { spawn as spawn2 } from "child_process";
|
|
1217
1220
|
import { normalizePath as normalizePath10 } from "vite";
|
|
1218
|
-
import { Transform } from "stream";
|
|
1219
1221
|
|
|
1220
1222
|
// src/routes/createDevServerRoutes.ts
|
|
1221
1223
|
import {
|
|
@@ -1638,7 +1640,7 @@ function trackUsage(action) {
|
|
|
1638
1640
|
eventName: EVENT_NAME,
|
|
1639
1641
|
action,
|
|
1640
1642
|
nodeVersion: getNodeVersionData(),
|
|
1641
|
-
version: "1.0.
|
|
1643
|
+
version: "1.0.36",
|
|
1642
1644
|
os: getPlatform()
|
|
1643
1645
|
};
|
|
1644
1646
|
const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
|
|
@@ -4668,6 +4670,7 @@ async function startShadowDevServer(devServerPort, shadowPort, themePath) {
|
|
|
4668
4670
|
import {
|
|
4669
4671
|
createServer as createViteServer2
|
|
4670
4672
|
} from "vite";
|
|
4673
|
+
import { createRequire as createRequire2 } from "module";
|
|
4671
4674
|
import { default as react2 } from "@vitejs/plugin-react";
|
|
4672
4675
|
import { default as mkcert2 } from "vite-plugin-mkcert";
|
|
4673
4676
|
var isProd3 = true;
|
|
@@ -4700,15 +4703,18 @@ async function createAppServer(appWebRoot, port, sslEnabled) {
|
|
|
4700
4703
|
include: ["react", "react-dom", "react-dom/client"]
|
|
4701
4704
|
},
|
|
4702
4705
|
plugins: [
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4706
|
+
(() => {
|
|
4707
|
+
const require2 = createRequire2(import.meta.url);
|
|
4708
|
+
return react2({
|
|
4709
|
+
babel: {
|
|
4710
|
+
plugins: [
|
|
4711
|
+
require2.resolve("babel-plugin-styled-components"),
|
|
4712
|
+
require2.resolve("styled-jsx/babel"),
|
|
4713
|
+
require2.resolve("babel-plugin-macros")
|
|
4714
|
+
]
|
|
4715
|
+
}
|
|
4716
|
+
});
|
|
4717
|
+
})(),
|
|
4712
4718
|
clientIslandEntryPlugin(),
|
|
4713
4719
|
resolveIslandPlugin(),
|
|
4714
4720
|
sslEnabled ? mkcert2() : null
|
|
@@ -5575,8 +5581,34 @@ HubSpot CMS dev server running at ${protocol}://hslocal.net:${PORT}${extraServer
|
|
|
5575
5581
|
const packageRoot = path16.dirname(url2.fileURLToPath(import.meta.url));
|
|
5576
5582
|
const configPath = path16.resolve(packageRoot, "./storybook-main");
|
|
5577
5583
|
sendTrackingRequest("start-storybook");
|
|
5584
|
+
let storybookBin;
|
|
5585
|
+
try {
|
|
5586
|
+
const sbPackagePath = await import.meta.resolve("storybook/package.json");
|
|
5587
|
+
const sbPackageDir = path16.dirname(url2.fileURLToPath(sbPackagePath));
|
|
5588
|
+
const packageJson = JSON.parse(
|
|
5589
|
+
fs7.readFileSync(path16.join(sbPackageDir, "package.json"), "utf-8")
|
|
5590
|
+
);
|
|
5591
|
+
storybookBin = path16.join(
|
|
5592
|
+
sbPackageDir,
|
|
5593
|
+
packageJson.bin.storybook || packageJson.bin
|
|
5594
|
+
);
|
|
5595
|
+
} catch (e) {
|
|
5596
|
+
console.error(
|
|
5597
|
+
wrapMessageInColor(
|
|
5598
|
+
"red",
|
|
5599
|
+
"Could not find storybook dependencies. The --storybook flag will be ignored."
|
|
5600
|
+
)
|
|
5601
|
+
);
|
|
5602
|
+
return;
|
|
5603
|
+
}
|
|
5604
|
+
console.log(
|
|
5605
|
+
wrapMessageInColor(
|
|
5606
|
+
"yellow",
|
|
5607
|
+
`Starting storybook server on port ${STORYBOOK_PORT}`
|
|
5608
|
+
)
|
|
5609
|
+
);
|
|
5578
5610
|
const storybookProcess = spawn2(
|
|
5579
|
-
|
|
5611
|
+
storybookBin,
|
|
5580
5612
|
[
|
|
5581
5613
|
"dev",
|
|
5582
5614
|
"-p",
|
|
@@ -5594,29 +5626,19 @@ HubSpot CMS dev server running at ${protocol}://hslocal.net:${PORT}${extraServer
|
|
|
5594
5626
|
hsEnv: authedEnv,
|
|
5595
5627
|
hublet: authedHublet,
|
|
5596
5628
|
WEB_ROOT: path16.join(webRoot, "components")
|
|
5597
|
-
}
|
|
5629
|
+
},
|
|
5630
|
+
stdio: "inherit"
|
|
5598
5631
|
}
|
|
5599
5632
|
);
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
callback(null, wrapMessageInColor("yellow", chunk.toString()));
|
|
5610
|
-
}
|
|
5611
|
-
})
|
|
5612
|
-
).pipe(process.stdout);
|
|
5613
|
-
storybookProcess.stderr.pipe(
|
|
5614
|
-
new Transform({
|
|
5615
|
-
transform(chunk, _encoding, callback) {
|
|
5616
|
-
callback(null, wrapMessageInColor("red", chunk.toString()));
|
|
5617
|
-
}
|
|
5618
|
-
})
|
|
5619
|
-
).pipe(process.stderr);
|
|
5633
|
+
storybookProcess.on("error", (err) => {
|
|
5634
|
+
console.error(
|
|
5635
|
+
wrapMessageInColor(
|
|
5636
|
+
"red",
|
|
5637
|
+
"Failed to start storybook. The --storybook flag will be ignored."
|
|
5638
|
+
)
|
|
5639
|
+
);
|
|
5640
|
+
console.error(err);
|
|
5641
|
+
});
|
|
5620
5642
|
}
|
|
5621
5643
|
return {
|
|
5622
5644
|
close: () => {
|
package/dist/island-runtime.js
CHANGED
|
@@ -12,6 +12,60 @@ var onVisible = (islandEl, callback) => {
|
|
|
12
12
|
observer.observe(child);
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
|
+
var MAX_HOSTNAME_LENGTH = 255;
|
|
16
|
+
var VALID_HOSTNAME_PATTERN = /^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
|
|
17
|
+
var FORBIDDEN_HOSTNAME_CHARS = /[/?#@:&=+$,[\]<>%\s"'`\\]/;
|
|
18
|
+
var INVALID_SUBSTRINGS = [
|
|
19
|
+
"://",
|
|
20
|
+
"?",
|
|
21
|
+
"#",
|
|
22
|
+
";",
|
|
23
|
+
"\\",
|
|
24
|
+
"..",
|
|
25
|
+
"//",
|
|
26
|
+
// eslint-disable-next-line no-script-url
|
|
27
|
+
"javascript:",
|
|
28
|
+
"data:",
|
|
29
|
+
"vbscript:",
|
|
30
|
+
"<script",
|
|
31
|
+
"base64",
|
|
32
|
+
"alert(",
|
|
33
|
+
"eval(",
|
|
34
|
+
"Function("
|
|
35
|
+
];
|
|
36
|
+
function isValidHostname(hostname) {
|
|
37
|
+
const isLengthOutOfRange = hostname.length < 1 || hostname.length > MAX_HOSTNAME_LENGTH;
|
|
38
|
+
if (!hostname || typeof hostname !== "string" || isLengthOutOfRange || !hostname.includes(".") || FORBIDDEN_HOSTNAME_CHARS.test(hostname) || !VALID_HOSTNAME_PATTERN.test(hostname) || INVALID_SUBSTRINGS.some(
|
|
39
|
+
(sub) => hostname.toLowerCase().includes(sub.toLowerCase())
|
|
40
|
+
) || /^[0-9.]+$/.test(hostname)) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
return hostname.split(".").every(
|
|
44
|
+
(label) => label.length >= 1 && label.length <= 63 && !label.startsWith("-") && !label.endsWith("-")
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
function getSecureOverrideUrl(path) {
|
|
48
|
+
const currentUrl = new URL(window.location.toString());
|
|
49
|
+
const overrideHost = currentUrl.searchParams.get("hsDebugOverridePublicHost");
|
|
50
|
+
try {
|
|
51
|
+
if (!overrideHost) {
|
|
52
|
+
throw new Error("No override host provided");
|
|
53
|
+
}
|
|
54
|
+
if (!isValidHostname(overrideHost)) {
|
|
55
|
+
throw new Error("Invalid hostname format");
|
|
56
|
+
}
|
|
57
|
+
const overriddenUrl = new URL(
|
|
58
|
+
`${currentUrl.protocol}//${overrideHost}${path}`
|
|
59
|
+
);
|
|
60
|
+
if (!["http:", "https:"].includes(overriddenUrl.protocol)) {
|
|
61
|
+
throw new Error("Invalid protocol");
|
|
62
|
+
}
|
|
63
|
+
return overriddenUrl.toString();
|
|
64
|
+
} catch (e) {
|
|
65
|
+
console.warn(`Invalid debug override host: ${overrideHost}`, e);
|
|
66
|
+
return `${window.location.origin}${path}`;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
15
69
|
var rootsToProcess;
|
|
16
70
|
var hydrationQueue = [];
|
|
17
71
|
var hydrationTypesToAccept = /* @__PURE__ */ new Set(["load", "visible"]);
|
|
@@ -137,10 +191,7 @@ function waitThenLoadAndHydrateIfNeeded(root, LoadableIslandModule, LoadableWrap
|
|
|
137
191
|
function getLoadableModuleFor(root) {
|
|
138
192
|
let url = root.url;
|
|
139
193
|
if (root.url.startsWith("/") && !root.url.startsWith("//") && window.location.search.includes("hsDebugOverridePublicHost=")) {
|
|
140
|
-
|
|
141
|
-
url = `${currentUrl.protocol}//${currentUrl.searchParams.get(
|
|
142
|
-
"hsDebugOverridePublicHost"
|
|
143
|
-
)}${root.url}`;
|
|
194
|
+
url = getSecureOverrideUrl(root.url);
|
|
144
195
|
} else if (!root.url.startsWith("https://") && !root.url.startsWith("http://") && !root.url.startsWith("//")) {
|
|
145
196
|
url = `${window.location.origin}${root.url}`;
|
|
146
197
|
}
|
package/dist/run.js
CHANGED
|
@@ -759,13 +759,13 @@ async function buildThemePreviewOptions(webRoot2, isUsingLocalWorkspace = false)
|
|
|
759
759
|
|
|
760
760
|
// src/createDevServer.ts
|
|
761
761
|
import path17 from "path";
|
|
762
|
+
import fs8 from "fs";
|
|
762
763
|
import url2 from "url";
|
|
763
764
|
import express2 from "express";
|
|
764
765
|
import http3 from "http";
|
|
765
766
|
import bodyParser from "body-parser";
|
|
766
767
|
import { spawn as spawn2 } from "child_process";
|
|
767
768
|
import { normalizePath as normalizePath10 } from "vite";
|
|
768
|
-
import { Transform } from "stream";
|
|
769
769
|
|
|
770
770
|
// src/routes/createDevServerRoutes.ts
|
|
771
771
|
import {
|
|
@@ -2166,7 +2166,7 @@ function trackUsage(action) {
|
|
|
2166
2166
|
eventName: EVENT_NAME,
|
|
2167
2167
|
action,
|
|
2168
2168
|
nodeVersion: getNodeVersionData(),
|
|
2169
|
-
version: "1.0.
|
|
2169
|
+
version: "1.0.36",
|
|
2170
2170
|
os: getPlatform()
|
|
2171
2171
|
};
|
|
2172
2172
|
const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
|
|
@@ -4835,6 +4835,7 @@ async function fetchProjectByName(accountId, projectName) {
|
|
|
4835
4835
|
|
|
4836
4836
|
// src/createViteDevServer.ts
|
|
4837
4837
|
import { createServer as createViteServer } from "vite";
|
|
4838
|
+
import { createRequire } from "module";
|
|
4838
4839
|
import { default as react } from "@vitejs/plugin-react";
|
|
4839
4840
|
import { default as mkcert } from "vite-plugin-mkcert";
|
|
4840
4841
|
import { viteCommonjs } from "@originjs/vite-plugin-commonjs";
|
|
@@ -5000,13 +5001,14 @@ Custom origin: ${process.env.VITE_ORIGIN}
|
|
|
5000
5001
|
include: ["react", "react-dom", "react-dom/client"]
|
|
5001
5002
|
}
|
|
5002
5003
|
} : {};
|
|
5004
|
+
const require2 = createRequire(import.meta.url);
|
|
5003
5005
|
const reactAndIslandsPlugins = isProjectWithReact || process.env.VITEST ? [
|
|
5004
5006
|
react({
|
|
5005
5007
|
babel: {
|
|
5006
5008
|
plugins: [
|
|
5007
|
-
"babel-plugin-styled-components",
|
|
5008
|
-
"styled-jsx/babel",
|
|
5009
|
-
"macros"
|
|
5009
|
+
require2.resolve("babel-plugin-styled-components"),
|
|
5010
|
+
require2.resolve("styled-jsx/babel"),
|
|
5011
|
+
require2.resolve("babel-plugin-macros")
|
|
5010
5012
|
]
|
|
5011
5013
|
}
|
|
5012
5014
|
}),
|
|
@@ -5408,6 +5410,7 @@ async function startShadowDevServer(devServerPort, shadowPort, themePath) {
|
|
|
5408
5410
|
import {
|
|
5409
5411
|
createServer as createViteServer2
|
|
5410
5412
|
} from "vite";
|
|
5413
|
+
import { createRequire as createRequire2 } from "module";
|
|
5411
5414
|
import { default as react2 } from "@vitejs/plugin-react";
|
|
5412
5415
|
import { default as mkcert2 } from "vite-plugin-mkcert";
|
|
5413
5416
|
var isProd3 = true;
|
|
@@ -5440,15 +5443,18 @@ async function createAppServer(appWebRoot, port, sslEnabled) {
|
|
|
5440
5443
|
include: ["react", "react-dom", "react-dom/client"]
|
|
5441
5444
|
},
|
|
5442
5445
|
plugins: [
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
|
|
5446
|
+
(() => {
|
|
5447
|
+
const require2 = createRequire2(import.meta.url);
|
|
5448
|
+
return react2({
|
|
5449
|
+
babel: {
|
|
5450
|
+
plugins: [
|
|
5451
|
+
require2.resolve("babel-plugin-styled-components"),
|
|
5452
|
+
require2.resolve("styled-jsx/babel"),
|
|
5453
|
+
require2.resolve("babel-plugin-macros")
|
|
5454
|
+
]
|
|
5455
|
+
}
|
|
5456
|
+
});
|
|
5457
|
+
})(),
|
|
5452
5458
|
clientIslandEntryPlugin(),
|
|
5453
5459
|
resolveIslandPlugin(),
|
|
5454
5460
|
sslEnabled ? mkcert2() : null
|
|
@@ -6315,8 +6321,34 @@ HubSpot CMS dev server running at ${protocol}://hslocal.net:${PORT}${extraServer
|
|
|
6315
6321
|
const packageRoot = path17.dirname(url2.fileURLToPath(import.meta.url));
|
|
6316
6322
|
const configPath = path17.resolve(packageRoot, "./storybook-main");
|
|
6317
6323
|
sendTrackingRequest("start-storybook");
|
|
6324
|
+
let storybookBin;
|
|
6325
|
+
try {
|
|
6326
|
+
const sbPackagePath = await import.meta.resolve("storybook/package.json");
|
|
6327
|
+
const sbPackageDir = path17.dirname(url2.fileURLToPath(sbPackagePath));
|
|
6328
|
+
const packageJson = JSON.parse(
|
|
6329
|
+
fs8.readFileSync(path17.join(sbPackageDir, "package.json"), "utf-8")
|
|
6330
|
+
);
|
|
6331
|
+
storybookBin = path17.join(
|
|
6332
|
+
sbPackageDir,
|
|
6333
|
+
packageJson.bin.storybook || packageJson.bin
|
|
6334
|
+
);
|
|
6335
|
+
} catch (e) {
|
|
6336
|
+
console.error(
|
|
6337
|
+
wrapMessageInColor(
|
|
6338
|
+
"red",
|
|
6339
|
+
"Could not find storybook dependencies. The --storybook flag will be ignored."
|
|
6340
|
+
)
|
|
6341
|
+
);
|
|
6342
|
+
return;
|
|
6343
|
+
}
|
|
6344
|
+
console.log(
|
|
6345
|
+
wrapMessageInColor(
|
|
6346
|
+
"yellow",
|
|
6347
|
+
`Starting storybook server on port ${STORYBOOK_PORT}`
|
|
6348
|
+
)
|
|
6349
|
+
);
|
|
6318
6350
|
const storybookProcess = spawn2(
|
|
6319
|
-
|
|
6351
|
+
storybookBin,
|
|
6320
6352
|
[
|
|
6321
6353
|
"dev",
|
|
6322
6354
|
"-p",
|
|
@@ -6334,29 +6366,19 @@ HubSpot CMS dev server running at ${protocol}://hslocal.net:${PORT}${extraServer
|
|
|
6334
6366
|
hsEnv: authedEnv,
|
|
6335
6367
|
hublet: authedHublet,
|
|
6336
6368
|
WEB_ROOT: path17.join(webRoot2, "components")
|
|
6337
|
-
}
|
|
6369
|
+
},
|
|
6370
|
+
stdio: "inherit"
|
|
6338
6371
|
}
|
|
6339
6372
|
);
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
callback(null, wrapMessageInColor("yellow", chunk.toString()));
|
|
6350
|
-
}
|
|
6351
|
-
})
|
|
6352
|
-
).pipe(process.stdout);
|
|
6353
|
-
storybookProcess.stderr.pipe(
|
|
6354
|
-
new Transform({
|
|
6355
|
-
transform(chunk, _encoding, callback) {
|
|
6356
|
-
callback(null, wrapMessageInColor("red", chunk.toString()));
|
|
6357
|
-
}
|
|
6358
|
-
})
|
|
6359
|
-
).pipe(process.stderr);
|
|
6373
|
+
storybookProcess.on("error", (err) => {
|
|
6374
|
+
console.error(
|
|
6375
|
+
wrapMessageInColor(
|
|
6376
|
+
"red",
|
|
6377
|
+
"Failed to start storybook. The --storybook flag will be ignored."
|
|
6378
|
+
)
|
|
6379
|
+
);
|
|
6380
|
+
console.error(err);
|
|
6381
|
+
});
|
|
6360
6382
|
}
|
|
6361
6383
|
return {
|
|
6362
6384
|
close: () => {
|
|
@@ -1341,6 +1341,7 @@ ${indentString}`);
|
|
|
1341
1341
|
// src/storybook-main/main.ts
|
|
1342
1342
|
init_dist();
|
|
1343
1343
|
import path2 from "path";
|
|
1344
|
+
import { createRequire } from "module";
|
|
1344
1345
|
import { mergeConfig } from "vite";
|
|
1345
1346
|
import { withoutVitePlugins } from "@storybook/builder-vite";
|
|
1346
1347
|
import { default as react } from "@vitejs/plugin-react";
|
|
@@ -1375,32 +1376,73 @@ var main_default = {
|
|
|
1375
1376
|
viteFinal: async (config) => {
|
|
1376
1377
|
const { resolveIslandPlugin: resolveIslandPlugin2 } = await Promise.resolve().then(() => (init_dist(), dist_exports));
|
|
1377
1378
|
const viteConfig = {
|
|
1379
|
+
define: {
|
|
1380
|
+
global: "globalThis",
|
|
1381
|
+
"process.env": "{}",
|
|
1382
|
+
"process.platform": '"browser"',
|
|
1383
|
+
"process.version": '"v18.0.0"',
|
|
1384
|
+
"process.versions": "{}",
|
|
1385
|
+
"process.browser": "true",
|
|
1386
|
+
"process.nextTick": "((fn, ...args) => setTimeout(() => fn(...args), 0))"
|
|
1387
|
+
},
|
|
1378
1388
|
resolve: {
|
|
1379
1389
|
dedupe: [
|
|
1380
1390
|
"react",
|
|
1381
1391
|
"react-dom",
|
|
1382
1392
|
"@hubspot/cms-components",
|
|
1383
1393
|
"@hubspot/cms-dev-server"
|
|
1384
|
-
]
|
|
1394
|
+
],
|
|
1395
|
+
alias: {
|
|
1396
|
+
process: "process/browser",
|
|
1397
|
+
buffer: "buffer"
|
|
1398
|
+
}
|
|
1385
1399
|
},
|
|
1386
1400
|
optimizeDeps: {
|
|
1387
|
-
include: ["react", "react-dom", "react-dom/client"],
|
|
1401
|
+
include: ["react", "react-dom", "react-dom/client", "buffer"],
|
|
1388
1402
|
exclude: ["fsevents"]
|
|
1389
1403
|
},
|
|
1390
1404
|
css: {
|
|
1391
1405
|
postcss: webRoot
|
|
1392
1406
|
},
|
|
1393
1407
|
plugins: [
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
"
|
|
1401
|
-
|
|
1408
|
+
// Provide Node.js globals for browser environment
|
|
1409
|
+
{
|
|
1410
|
+
name: "provide-nodejs-globals",
|
|
1411
|
+
config(__config, { command }) {
|
|
1412
|
+
if (command === "serve") {
|
|
1413
|
+
config.define = config.define || {};
|
|
1414
|
+
config.define.global = "globalThis";
|
|
1415
|
+
config.define.Buffer = "Buffer";
|
|
1416
|
+
}
|
|
1417
|
+
},
|
|
1418
|
+
transformIndexHtml: {
|
|
1419
|
+
order: "pre",
|
|
1420
|
+
handler(html) {
|
|
1421
|
+
return html.replace(
|
|
1422
|
+
"<head>",
|
|
1423
|
+
`<head>
|
|
1424
|
+
<script type="module">
|
|
1425
|
+
import { Buffer } from 'buffer';
|
|
1426
|
+
window.Buffer = Buffer;
|
|
1427
|
+
globalThis.Buffer = Buffer;
|
|
1428
|
+
</script>`
|
|
1429
|
+
);
|
|
1430
|
+
}
|
|
1402
1431
|
}
|
|
1403
|
-
}
|
|
1432
|
+
},
|
|
1433
|
+
resolveIslandPlugin2(),
|
|
1434
|
+
(() => {
|
|
1435
|
+
const require2 = createRequire(import.meta.url);
|
|
1436
|
+
return react({
|
|
1437
|
+
babel: {
|
|
1438
|
+
plugins: [
|
|
1439
|
+
require2.resolve("babel-plugin-styled-components"),
|
|
1440
|
+
require2.resolve("styled-jsx/babel"),
|
|
1441
|
+
require2.resolve("babel-plugin-macros")
|
|
1442
|
+
]
|
|
1443
|
+
}
|
|
1444
|
+
});
|
|
1445
|
+
})()
|
|
1404
1446
|
]
|
|
1405
1447
|
};
|
|
1406
1448
|
const configNoReact = {
|
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.36",
|
|
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.36",
|
|
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",
|
|
@@ -39,13 +39,14 @@
|
|
|
39
39
|
"@radix-ui/react-toggle": "^1.1.3",
|
|
40
40
|
"@radix-ui/react-tooltip": "^1.1.4",
|
|
41
41
|
"@sentry/node": "^6.2.0",
|
|
42
|
-
"@storybook/addon-actions": "
|
|
43
|
-
"@storybook/addon-essentials": "
|
|
44
|
-
"@storybook/addon-interactions": "
|
|
45
|
-
"@storybook/addon-links": "
|
|
46
|
-
"@storybook/
|
|
47
|
-
"@storybook/react
|
|
48
|
-
"@storybook/
|
|
42
|
+
"@storybook/addon-actions": "^8.6.14",
|
|
43
|
+
"@storybook/addon-essentials": "^8.6.14",
|
|
44
|
+
"@storybook/addon-interactions": "^8.6.14",
|
|
45
|
+
"@storybook/addon-links": "^8.6.14",
|
|
46
|
+
"@storybook/builder-vite": "^8.6.14",
|
|
47
|
+
"@storybook/react": "^8.6.14",
|
|
48
|
+
"@storybook/react-vite": "^8.6.14",
|
|
49
|
+
"@storybook/test": "^8.6.14",
|
|
49
50
|
"@vitejs/plugin-react": "^4.2.1",
|
|
50
51
|
"ansi-to-html": "0.7.x",
|
|
51
52
|
"babel-plugin-macros": "^3.1.0",
|
|
@@ -67,6 +68,7 @@
|
|
|
67
68
|
"react": "18.3.1",
|
|
68
69
|
"react-dom": "18.3.1",
|
|
69
70
|
"request": "^2.88.2",
|
|
71
|
+
"storybook": "^8.6.14",
|
|
70
72
|
"styled-jsx": "5.1.2",
|
|
71
73
|
"tailwind-merge": "^2.5.4",
|
|
72
74
|
"tailwindcss-animate": "^1.0.7",
|
|
@@ -132,5 +134,5 @@
|
|
|
132
134
|
"publishConfig": {
|
|
133
135
|
"access": "public"
|
|
134
136
|
},
|
|
135
|
-
"gitHead": "
|
|
137
|
+
"gitHead": "a73d9576dca18ecca3b3a192144804ec436ce75c"
|
|
136
138
|
}
|