@hubspot/cms-dev-server 0.14.5 → 0.14.6
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/createViteDevServer-5624911d.js +69 -0
- package/dist/index-de34229d.js +525 -0
- package/dist/index-e4860c0f.js +150 -0
- package/dist/index.js +27 -25
- package/dist/index2.js +178 -0
- package/dist/internalSsr.js +370 -299
- package/dist/main.js +52 -0
- package/dist/preview.js +18 -0
- package/dist/run.js +354 -326
- package/dist/storybook/index.js +7 -5
- package/dist/storybook-main/main.js +418 -340
- package/package.json +3 -3
- package/types/island-runtime.d.ts +2 -0
package/dist/main.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import { mergeConfig } from "vite";
|
|
3
|
+
const webRoot = process.env.WEB_ROOT;
|
|
4
|
+
const storyPath = path.resolve(process.cwd(), webRoot, "**/*.stories.*");
|
|
5
|
+
const jsRenderingGates = process.env.GATES ? process.env.GATES.split(",") : [];
|
|
6
|
+
const main = {
|
|
7
|
+
addons: ["@storybook/addon-essentials"],
|
|
8
|
+
framework: "@storybook/react-vite",
|
|
9
|
+
stories: [storyPath],
|
|
10
|
+
previewHead: (head) => {
|
|
11
|
+
return `
|
|
12
|
+
${head}
|
|
13
|
+
|
|
14
|
+
<script type="module">
|
|
15
|
+
import { initConfigSingletonFromJSON } from '@hubspot/cms-components/config';
|
|
16
|
+
|
|
17
|
+
initConfigSingletonFromJSON(${JSON.stringify({
|
|
18
|
+
portalId: process.env.portalId,
|
|
19
|
+
hublet: process.env.hublet,
|
|
20
|
+
hsEnv: process.env.hsEnv,
|
|
21
|
+
hsDeployed: false,
|
|
22
|
+
hsJSRGates: jsRenderingGates
|
|
23
|
+
})})
|
|
24
|
+
<\/script>
|
|
25
|
+
|
|
26
|
+
`;
|
|
27
|
+
},
|
|
28
|
+
viteFinal: async (config) => {
|
|
29
|
+
const { resolveIslandPlugin } = await import("./index-de34229d.js");
|
|
30
|
+
const viteConfig = {
|
|
31
|
+
resolve: {
|
|
32
|
+
dedupe: [
|
|
33
|
+
"react",
|
|
34
|
+
"react-dom",
|
|
35
|
+
"@hubspot/cms-components",
|
|
36
|
+
"@hubspot/cms-dev-server"
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
optimizeDeps: {
|
|
40
|
+
include: ["react", "react-dom", "react-dom/client"]
|
|
41
|
+
},
|
|
42
|
+
css: {
|
|
43
|
+
postcss: webRoot
|
|
44
|
+
},
|
|
45
|
+
plugins: [resolveIslandPlugin(jsRenderingGates)]
|
|
46
|
+
};
|
|
47
|
+
return mergeConfig(config, viteConfig);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
export {
|
|
51
|
+
main as default
|
|
52
|
+
};
|
package/dist/preview.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { d as createServerRenderContextV2, j as jsx, C as ClientRenderContextProvider, S as ServerRenderContext } from "./index-e4860c0f.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import "react/jsx-runtime";
|
|
4
|
+
import "stream";
|
|
5
|
+
import "react-dom/server";
|
|
6
|
+
const parameters = {
|
|
7
|
+
actions: { argTypesRegex: "^on[A-Z].*" }
|
|
8
|
+
};
|
|
9
|
+
const contextValue = createServerRenderContextV2("http://testUrl.com", {
|
|
10
|
+
environmentConfig: null
|
|
11
|
+
});
|
|
12
|
+
const decorators = [
|
|
13
|
+
(Story) => /* @__PURE__ */ jsx(ClientRenderContextProvider, { pageUrl: "http://test.com", islands: [], children: /* @__PURE__ */ jsx(ServerRenderContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(Story, {}) }) })
|
|
14
|
+
];
|
|
15
|
+
export {
|
|
16
|
+
decorators,
|
|
17
|
+
parameters
|
|
18
|
+
};
|