@hubspot/cms-dev-server 0.4.18 → 0.6.0
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/components/ModulesList.js +14 -0
- package/dist/components/PartialsList.js +13 -0
- package/dist/createDevServer.js +162 -0
- package/dist/createViteDevServer.js +51 -0
- package/dist/fsevents-72LCIACT.node +0 -0
- package/dist/index.js +3 -2
- package/dist/internalSsr.js +20 -12
- package/dist/lib/cli.js +27 -0
- package/dist/lib/debug.js +2 -0
- package/dist/lib/errors.js +22 -0
- package/dist/lib/fullOriginalUrlFromRequest.js +3 -0
- package/dist/lib/httpsRedirectingServer.js +48 -0
- package/dist/lib/moduleGraph.js +11 -0
- package/dist/lib/proxyHelpers.js +70 -0
- package/dist/lib/proxyHelpers.test.js +136 -0
- package/dist/lib/renderComponentWithCSS.js +26 -0
- package/dist/lib/renderHelpers.js +45 -0
- package/dist/lib/renderModule.js +56 -0
- package/dist/lib/renderPartial.js +15 -0
- package/dist/lib/templates.js +55 -0
- package/dist/proxyPage/constants.js +1 -0
- package/dist/proxyPage/fetchContentMetadata.js +59 -0
- package/dist/proxyPage/fetchDomains.js +29 -0
- package/dist/proxyPage/fetchPreviewInfo.js +37 -0
- package/dist/proxyPage/proxyPage.js +174 -0
- package/dist/proxyPage/renderLocalError.js +27 -0
- package/dist/proxyPage/utils.js +38 -0
- package/dist/routes/createDevServerRoutes.js +43 -0
- package/dist/routes/homeRouteHandler.js +12 -0
- package/dist/routes/linksToAllModulesRouteHandler.js +10 -0
- package/dist/routes/linksToAllPartialsRouteHandler.js +10 -0
- package/dist/routes/module.js +41 -0
- package/dist/routes/partial.js +30 -0
- package/dist/routes/proxyPageResourceRedirect.js +22 -0
- package/dist/routes/proxyPageRouteHandler.js +40 -0
- package/dist/routes/proxyPathPageResourceRedirect.js +36 -0
- package/dist/routes/proxyPathPageRouteHandler.js +43 -0
- package/dist/run.js +119 -56
- package/dist/shadowDevServer/createShadowDevServerRoutes.js +63 -0
- package/dist/shadowDevServer/startShadowDevServer.js +31 -0
- package/dist/storybook/getFieldsArgTypes.js +54 -0
- package/dist/storybook/getFieldsArgTypes.test.js +91 -0
- package/dist/storybook/getNestedFieldObjectForArgs.js +22 -0
- package/dist/storybook/getNestedFieldObjectForArgs.test.js +40 -0
- package/dist/storybook/index.js +1 -1
- package/dist/storybook/main.js +20 -12
- package/dist/storybook/moduleStory.js +61 -0
- package/dist/storybook/preview.js +9 -0
- package/dist/storybook/types.js +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
import { ModuleFields, BooleanField, TextField, FieldGroup, NumberField, ColorField, } from '@hubspot/cms-components/fields';
|
|
4
|
+
import { renderFieldsToJson } from '@hubspot/cms-js-internal';
|
|
5
|
+
import getFieldsArgTypes from './getFieldsArgTypes.js';
|
|
6
|
+
describe('getFieldsArgTypes', () => {
|
|
7
|
+
it('creates argType for boolean field', () => {
|
|
8
|
+
const fields = (_jsx(ModuleFields, { children: _jsx(BooleanField, { name: "testBooleanField", label: "field", default: false }) }));
|
|
9
|
+
const argTypes = getFieldsArgTypes(renderFieldsToJson(fields));
|
|
10
|
+
expect(argTypes).toStrictEqual({
|
|
11
|
+
testBooleanField: {
|
|
12
|
+
control: 'boolean',
|
|
13
|
+
defaultValue: false,
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
it('creates text argType for text field', () => {
|
|
18
|
+
const fields = (_jsx(ModuleFields, { children: _jsx(TextField, { name: "testStringField", label: "field", default: 'test' }) }));
|
|
19
|
+
const argTypes = getFieldsArgTypes(renderFieldsToJson(fields));
|
|
20
|
+
expect(argTypes).toStrictEqual({
|
|
21
|
+
testStringField: {
|
|
22
|
+
control: 'text',
|
|
23
|
+
defaultValue: 'test',
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
it('creates number argType for number field', () => {
|
|
28
|
+
const fields = (_jsx(ModuleFields, { children: _jsx(NumberField, { name: "testNumberField", label: "field", default: 123 }) }));
|
|
29
|
+
const argTypes = getFieldsArgTypes(renderFieldsToJson(fields));
|
|
30
|
+
expect(argTypes).toStrictEqual({
|
|
31
|
+
testNumberField: {
|
|
32
|
+
control: 'number',
|
|
33
|
+
defaultValue: 123,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
it('creates object argType for unknown field', () => {
|
|
38
|
+
const fields = (_jsx(ModuleFields, { children: _jsx(ColorField, { name: "testColorField", label: "field", default: {
|
|
39
|
+
color: '#fff',
|
|
40
|
+
} }) }));
|
|
41
|
+
const argTypes = getFieldsArgTypes(renderFieldsToJson(fields));
|
|
42
|
+
expect(argTypes).toStrictEqual({
|
|
43
|
+
testColorField: {
|
|
44
|
+
control: 'object',
|
|
45
|
+
defaultValue: {
|
|
46
|
+
color: '#fff',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
it('prefixes fields in a group with . separated group names', () => {
|
|
52
|
+
const fields = (_jsx(ModuleFields, { children: _jsxs(FieldGroup, { name: "mygroup", label: "field group", children: [_jsx(TextField, { name: "testStringField", label: "field", default: 'test' }), _jsx(BooleanField, { name: "testBooleanField", label: "field", default: false })] }) }));
|
|
53
|
+
const argTypes = getFieldsArgTypes(renderFieldsToJson(fields));
|
|
54
|
+
expect(argTypes).toStrictEqual({
|
|
55
|
+
'mygroup.testStringField': {
|
|
56
|
+
control: 'text',
|
|
57
|
+
defaultValue: 'test',
|
|
58
|
+
},
|
|
59
|
+
'mygroup.testBooleanField': {
|
|
60
|
+
control: 'boolean',
|
|
61
|
+
defaultValue: false,
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
it('handles multiple nesting alongside top level values', () => {
|
|
66
|
+
const fields = (_jsxs(ModuleFields, { children: [_jsx(TextField, { name: "toplevel", label: "top level text field", default: "defaultvalue" }), _jsxs(FieldGroup, { name: "mygroup", label: "field group", children: [_jsx(TextField, { name: "testStringField", label: "field", default: 'test' }), _jsx(BooleanField, { name: "testBooleanField", label: "field", default: false }), _jsxs(FieldGroup, { name: "nestedgroup", label: "nested group", children: [_jsx(TextField, { name: "testStringField", label: "field", default: 'test' }), _jsx(BooleanField, { name: "testBooleanField", label: "field", default: false })] })] })] }));
|
|
67
|
+
const argTypes = getFieldsArgTypes(renderFieldsToJson(fields));
|
|
68
|
+
expect(argTypes).toStrictEqual({
|
|
69
|
+
toplevel: {
|
|
70
|
+
control: 'text',
|
|
71
|
+
defaultValue: 'defaultvalue',
|
|
72
|
+
},
|
|
73
|
+
'mygroup.testStringField': {
|
|
74
|
+
control: 'text',
|
|
75
|
+
defaultValue: 'test',
|
|
76
|
+
},
|
|
77
|
+
'mygroup.testBooleanField': {
|
|
78
|
+
control: 'boolean',
|
|
79
|
+
defaultValue: false,
|
|
80
|
+
},
|
|
81
|
+
'mygroup.nestedgroup.testStringField': {
|
|
82
|
+
control: 'text',
|
|
83
|
+
defaultValue: 'test',
|
|
84
|
+
},
|
|
85
|
+
'mygroup.nestedgroup.testBooleanField': {
|
|
86
|
+
control: 'boolean',
|
|
87
|
+
defaultValue: false,
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// default values come through via `defaultValue` in the story's argTypes, we
|
|
2
|
+
// need to re-nest them to match the field structure
|
|
3
|
+
export default function getNestedFieldObjectForArgs(_args) {
|
|
4
|
+
const result = {};
|
|
5
|
+
for (const argPath in _args) {
|
|
6
|
+
if (Object.prototype.hasOwnProperty.call(_args, argPath)) {
|
|
7
|
+
const argPathSegments = argPath.split('.');
|
|
8
|
+
const nestedSegments = argPathSegments.slice(0, -1);
|
|
9
|
+
const fieldName = argPathSegments[argPathSegments.length - 1];
|
|
10
|
+
const fieldValue = _args[argPath];
|
|
11
|
+
let currentNest = result;
|
|
12
|
+
for (const segment of nestedSegments) {
|
|
13
|
+
if (!Object.prototype.hasOwnProperty.call(currentNest, segment)) {
|
|
14
|
+
currentNest[segment] = {};
|
|
15
|
+
}
|
|
16
|
+
currentNest = currentNest[segment];
|
|
17
|
+
}
|
|
18
|
+
currentNest[fieldName] = fieldValue;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import getNestedFieldObjectForArgs from './getNestedFieldObjectForArgs.js';
|
|
3
|
+
describe('getNestedFieldObjectForArgs', () => {
|
|
4
|
+
it('leaves top level args as is', () => {
|
|
5
|
+
const argMap = {
|
|
6
|
+
testField: 'testValue',
|
|
7
|
+
testField2: 'testValue',
|
|
8
|
+
};
|
|
9
|
+
const result = getNestedFieldObjectForArgs(argMap);
|
|
10
|
+
expect(result).toStrictEqual(argMap);
|
|
11
|
+
});
|
|
12
|
+
it('turns a . separated arg name into a nested field', () => {
|
|
13
|
+
const argMap = {
|
|
14
|
+
'group.testField': 'testValue',
|
|
15
|
+
topLevelField: 'testValue',
|
|
16
|
+
};
|
|
17
|
+
const result = getNestedFieldObjectForArgs(argMap);
|
|
18
|
+
expect(result).toStrictEqual({
|
|
19
|
+
group: {
|
|
20
|
+
testField: 'testValue',
|
|
21
|
+
},
|
|
22
|
+
topLevelField: 'testValue',
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
it('keeps nested fields with the same group prefix nested in the same object', () => {
|
|
26
|
+
const argMap = {
|
|
27
|
+
'group.testField': 'testValue',
|
|
28
|
+
'group.secondField': 'testValue',
|
|
29
|
+
topLevelField: 'testValue',
|
|
30
|
+
};
|
|
31
|
+
const result = getNestedFieldObjectForArgs(argMap);
|
|
32
|
+
expect(result).toStrictEqual({
|
|
33
|
+
group: {
|
|
34
|
+
testField: 'testValue',
|
|
35
|
+
secondField: 'testValue',
|
|
36
|
+
},
|
|
37
|
+
topLevelField: 'testValue',
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
});
|
package/dist/storybook/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { createRequire } from "module";
|
|
|
8
8
|
import * as jsxRuntime from "react/jsx-runtime";
|
|
9
9
|
import stream from "stream";
|
|
10
10
|
import { renderToPipeableStream, renderToStaticMarkup } from "react-dom/server";
|
|
11
|
-
import {
|
|
11
|
+
import { createServerRenderContextV2, ServerRenderContext } from "@hubspot/cms-components";
|
|
12
12
|
import { createHash } from "crypto";
|
|
13
13
|
import { existsSync, readdirSync, lstatSync } from "fs";
|
|
14
14
|
import { join } from "path/posix";
|
package/dist/storybook/main.js
CHANGED
|
@@ -52,7 +52,7 @@ import { createRequire } from "module";
|
|
|
52
52
|
import * as jsxRuntime from "react/jsx-runtime";
|
|
53
53
|
import stream from "stream";
|
|
54
54
|
import { renderToPipeableStream, renderToStaticMarkup } from "react-dom/server";
|
|
55
|
-
import {
|
|
55
|
+
import { createServerRenderContextV2, ServerRenderContext } from "@hubspot/cms-components";
|
|
56
56
|
import { createHash } from "crypto";
|
|
57
57
|
import { existsSync, readdirSync, lstatSync } from "fs";
|
|
58
58
|
import { join } from "path/posix";
|
|
@@ -178,18 +178,22 @@ function clientIslandEntryPlugin() {
|
|
|
178
178
|
}
|
|
179
179
|
};
|
|
180
180
|
}
|
|
181
|
-
async function renderComponentOnServer(Component, props, pageUrl, environmentConfig, renderOptions) {
|
|
181
|
+
async function renderComponentOnServer(Component, props, pageUrl, environmentConfig, entryPointBasePath, renderOptions) {
|
|
182
182
|
const componentDebugName = Component.displayName || Component.name;
|
|
183
183
|
return renderOnServer(
|
|
184
184
|
/* @__PURE__ */ jsx2(Component, { ...props }),
|
|
185
185
|
pageUrl,
|
|
186
186
|
environmentConfig,
|
|
187
|
+
entryPointBasePath,
|
|
187
188
|
componentDebugName,
|
|
188
189
|
renderOptions
|
|
189
190
|
);
|
|
190
191
|
}
|
|
191
|
-
async function renderOnServer(elements, pageUrl, environmentConfig, debugName, renderOptions) {
|
|
192
|
-
const renderContext =
|
|
192
|
+
async function renderOnServer(elements, pageUrl, environmentConfig, entryPointBasePath, debugName, renderOptions) {
|
|
193
|
+
const renderContext = createServerRenderContextV2(pageUrl, {
|
|
194
|
+
environmentConfig,
|
|
195
|
+
entryPointBasePath
|
|
196
|
+
});
|
|
193
197
|
let html = await renderStreamToPromise(
|
|
194
198
|
/* @__PURE__ */ jsx2(ServerRenderContext.Provider, { value: renderContext, children: elements }),
|
|
195
199
|
renderOptions
|
|
@@ -243,13 +247,16 @@ function findAllPartialsInRoot(webRoot2) {
|
|
|
243
247
|
);
|
|
244
248
|
return { partialNames, partialSubpaths };
|
|
245
249
|
}
|
|
246
|
-
function getServerGlobalsToInject(environmentConfig, hsServerPageUrl) {
|
|
250
|
+
function getServerGlobalsToInject(environmentConfig, hsServerPageUrl, hsBasePath) {
|
|
247
251
|
const globals = [
|
|
248
252
|
`window.__hsEnvConfig = ${JSON.stringify(environmentConfig.toJSON())};`
|
|
249
253
|
];
|
|
250
254
|
if (hsServerPageUrl) {
|
|
251
255
|
globals.push(`window.__hsServerPageUrl = '${hsServerPageUrl}';`);
|
|
252
256
|
}
|
|
257
|
+
if (hsBasePath) {
|
|
258
|
+
globals.push(`window.__hsBasePath = '${hsBasePath}';`);
|
|
259
|
+
}
|
|
253
260
|
return `
|
|
254
261
|
<script type="text/javascript">
|
|
255
262
|
${globals.join("\n ")}
|
|
@@ -402,7 +409,8 @@ ${indentString}`);
|
|
|
402
409
|
"CMS:JSRenderer:SharedDeps",
|
|
403
410
|
"CMS:JSRenderer:GetServerSideProps",
|
|
404
411
|
"CMS:JSRenderer:LocalProxySchemaVersion1",
|
|
405
|
-
"CMS:JSRenderer:GraphQLQueryBuild"
|
|
412
|
+
"CMS:JSRenderer:GraphQLQueryBuild",
|
|
413
|
+
"CMS:JSRenderer:SeparateIslandRenderOption"
|
|
406
414
|
];
|
|
407
415
|
ENABLED_FEATURES_GATE_MAP = {
|
|
408
416
|
"cms:jsr:sharedDeps": "CMS:JSRenderer:SharedDeps",
|
|
@@ -411,7 +419,7 @@ ${indentString}`);
|
|
|
411
419
|
"cms:jsr:graphqQLQueryBuild": "CMS:JSRenderer:GraphQLQueryBuild"
|
|
412
420
|
};
|
|
413
421
|
BUILD_INFO_PATH = "/build-info.json";
|
|
414
|
-
clientRenderIsland = "import type { RenderableIsland } from '@hubspot/cms-components';\nimport {
|
|
422
|
+
clientRenderIsland = "import type { RenderableIsland } from '@hubspot/cms-components';\nimport {\n ClientRenderContextProvider,\n buildIslandIdentifierPrefix,\n} from '@hubspot/cms-components';\nimport { Suspense } from 'react';\nimport ReactDOMClient from 'react-dom/client';\n\nexport function clientRenderIsland(\n renderableIsland: RenderableIsland,\n Component: any\n) {\n const { island, rootElement, postHydration, pageUrl, islands, basePath } =\n renderableIsland;\n let reactRoot: any;\n\n const rootOptions = {\n // Ensure useId is unique across island roots\n identifierPrefix: buildIslandIdentifierPrefix(renderableIsland.island.id),\n };\n\n const elementsToHydrate = (\n <Suspense fallback={`client hydrate fail/waiting for ${island.id}`}>\n <ClientRenderContextProvider\n pageUrl={pageUrl}\n islands={islands}\n onTopLevelHydrationFinish={postHydration}\n island={island}\n basePath={basePath}\n >\n <Component islandId={island.id} {...island.props} />\n </ClientRenderContextProvider>\n </Suspense>\n );\n\n if (island.clientOnly) {\n reactRoot = ReactDOMClient.createRoot(rootElement, rootOptions);\n reactRoot.render(elementsToHydrate);\n } else {\n reactRoot = ReactDOMClient.hydrateRoot(\n rootElement,\n elementsToHydrate,\n rootOptions\n );\n }\n return reactRoot;\n}\n";
|
|
415
423
|
virtualClientRenderIslandModuleId = "virtual:clientRenderIsland.tsx";
|
|
416
424
|
jsx2 = jsxRuntime.jsx;
|
|
417
425
|
promiseForNewWritableStream = () => {
|
|
@@ -432,21 +440,21 @@ ${indentString}`);
|
|
|
432
440
|
});
|
|
433
441
|
return { streamDonePromise, writableStream };
|
|
434
442
|
};
|
|
435
|
-
renderStreamToPromise = async (reactElements,
|
|
443
|
+
renderStreamToPromise = async (reactElements, options) => {
|
|
436
444
|
const { streamDonePromise, writableStream } = promiseForNewWritableStream();
|
|
437
445
|
const {
|
|
438
446
|
pipe
|
|
439
447
|
/* abort */
|
|
440
448
|
} = renderToPipeableStream(reactElements, {
|
|
441
|
-
...
|
|
449
|
+
...options || {},
|
|
442
450
|
onShellReady() {
|
|
443
451
|
},
|
|
444
452
|
onAllReady() {
|
|
445
453
|
pipe(writableStream);
|
|
454
|
+
if (options == null ? void 0 : options.onAllReady) {
|
|
455
|
+
options.onAllReady();
|
|
456
|
+
}
|
|
446
457
|
}
|
|
447
|
-
// We will log the error sent to the writable, any need to do something in these callbacks?
|
|
448
|
-
// onShellError(error) {},
|
|
449
|
-
// onError(error) {},
|
|
450
458
|
});
|
|
451
459
|
return streamDonePromise;
|
|
452
460
|
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
3
|
+
import { renderToStaticMarkup } from 'react-dom/server';
|
|
4
|
+
import { renderFieldsToJson } from '@hubspot/cms-js-internal';
|
|
5
|
+
import getFieldsArgTypes from './getFieldsArgTypes.js';
|
|
6
|
+
import getNestedFieldObjectForArgs from './getNestedFieldObjectForArgs.js';
|
|
7
|
+
export function moduleFieldsToJson(fields) {
|
|
8
|
+
let moduleJson;
|
|
9
|
+
const outputCallback = (callbackJson) => {
|
|
10
|
+
moduleJson = callbackJson;
|
|
11
|
+
};
|
|
12
|
+
renderToStaticMarkup(React.cloneElement(fields, {
|
|
13
|
+
outputCallback,
|
|
14
|
+
}));
|
|
15
|
+
if (!moduleJson) {
|
|
16
|
+
throw new Error("couldn't render module fields definition to fields.json");
|
|
17
|
+
}
|
|
18
|
+
return moduleJson;
|
|
19
|
+
}
|
|
20
|
+
export function moduleStory(ModuleComponent, fields) {
|
|
21
|
+
const moduleJson = renderFieldsToJson(fields);
|
|
22
|
+
const argTypes = getFieldsArgTypes(moduleJson);
|
|
23
|
+
const story = (_args) => _jsx(ModuleComponent, { ..._args });
|
|
24
|
+
const storyWithArgs = story.bind({});
|
|
25
|
+
storyWithArgs.argTypes = argTypes;
|
|
26
|
+
storyWithArgs.args = {};
|
|
27
|
+
return storyWithArgs;
|
|
28
|
+
}
|
|
29
|
+
export function moduleStoryWithIsland(moduleName, fields) {
|
|
30
|
+
const moduleJson = moduleFieldsToJson(fields);
|
|
31
|
+
const argTypes = getFieldsArgTypes(moduleJson);
|
|
32
|
+
const story = (_args) => {
|
|
33
|
+
const fieldValues = getNestedFieldObjectForArgs(_args);
|
|
34
|
+
const fieldValuesString = JSON.stringify(fieldValues);
|
|
35
|
+
const domain = `${window.location.protocol}//${window.location.hostname.replace('storybook.', '')}:3000`;
|
|
36
|
+
const fieldValuesJson = encodeURIComponent(fieldValuesString);
|
|
37
|
+
const iframeSrc = `${domain}/module/${moduleName}?fields=${fieldValuesJson}`;
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
const existingElement = document.querySelector('#hs-module-iframe');
|
|
40
|
+
if (existingElement) {
|
|
41
|
+
existingElement.setAttribute('src', iframeSrc);
|
|
42
|
+
return () => {
|
|
43
|
+
existingElement.remove();
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const iframeElement = document.createElement('iframe');
|
|
47
|
+
iframeElement.setAttribute('src', iframeSrc);
|
|
48
|
+
iframeElement.setAttribute('id', 'hs-module-iframe');
|
|
49
|
+
iframeElement.setAttribute('style', `border: none;width: 100%;height: 100%;overflow: auto;`);
|
|
50
|
+
document.body.appendChild(iframeElement);
|
|
51
|
+
return () => {
|
|
52
|
+
iframeElement.remove();
|
|
53
|
+
};
|
|
54
|
+
}, [iframeSrc]);
|
|
55
|
+
return _jsx("div", {});
|
|
56
|
+
};
|
|
57
|
+
const storyWithArgs = story.bind({});
|
|
58
|
+
storyWithArgs.argTypes = argTypes;
|
|
59
|
+
storyWithArgs.args = {};
|
|
60
|
+
return storyWithArgs;
|
|
61
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ServerRenderContext, createServerRenderContext, ClientRenderContextProvider, } from '@hubspot/cms-components';
|
|
3
|
+
export const parameters = {
|
|
4
|
+
actions: { argTypesRegex: '^on[A-Z].*' },
|
|
5
|
+
};
|
|
6
|
+
const contextValue = createServerRenderContext('http://testUrl.com');
|
|
7
|
+
export const decorators = [
|
|
8
|
+
Story => (_jsx(ClientRenderContextProvider, { pageUrl: "http://test.com", islands: [], children: _jsx(ServerRenderContext.Provider, { value: contextValue, children: _jsx(Story, {}) }) })),
|
|
9
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cms-dev-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@hubspot/cli-lib": "^3.0.12",
|
|
27
|
-
"@hubspot/cms-components": "^0.
|
|
27
|
+
"@hubspot/cms-components": "^0.6.0",
|
|
28
28
|
"@storybook/addon-actions": "^7.0.0-beta.19",
|
|
29
29
|
"@storybook/addon-essentials": "^7.0.0-beta.19",
|
|
30
30
|
"@storybook/addon-interactions": "^7.0.0-beta.19",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"react-dom": "^18.1.0",
|
|
44
44
|
"request": "^2.88.2",
|
|
45
45
|
"typescript": "~4.7.0",
|
|
46
|
-
"vite": "
|
|
46
|
+
"vite": "4.2.2",
|
|
47
47
|
"vite-plugin-inspect": "^0.4.3",
|
|
48
48
|
"vite-plugin-mkcert": "^1.10.1"
|
|
49
49
|
},
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"node-fetch": "^3.3.0",
|
|
58
58
|
"nodemon": "^2.0.15",
|
|
59
59
|
"ts-node": "^10.7.0",
|
|
60
|
-
"vitest": "0.
|
|
60
|
+
"vitest": "0.30.1"
|
|
61
61
|
},
|
|
62
62
|
"main": "./dist/index.js",
|
|
63
63
|
"exports": {
|
|
@@ -95,5 +95,5 @@
|
|
|
95
95
|
"publishConfig": {
|
|
96
96
|
"access": "public"
|
|
97
97
|
},
|
|
98
|
-
"gitHead": "
|
|
98
|
+
"gitHead": "37158ed08c4679713bd4f651505d463a4ae2e70e"
|
|
99
99
|
}
|