@web/storybook-builder 0.1.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/CHANGELOG.md +7 -0
- package/README.md +3 -0
- package/dist/generate-app-script.d.ts +3 -0
- package/dist/generate-app-script.d.ts.map +1 -0
- package/dist/generate-app-script.js +40 -0
- package/dist/generate-app-script.js.map +1 -0
- package/dist/generate-iframe-html.d.ts +4 -0
- package/dist/generate-iframe-html.d.ts.map +1 -0
- package/dist/generate-iframe-html.js +34 -0
- package/dist/generate-iframe-html.js.map +1 -0
- package/dist/generate-setup-addons-script.d.ts +2 -0
- package/dist/generate-setup-addons-script.d.ts.map +1 -0
- package/dist/generate-setup-addons-script.js +24 -0
- package/dist/generate-setup-addons-script.js.map +1 -0
- package/dist/generate-stories-script.d.ts +6 -0
- package/dist/generate-stories-script.d.ts.map +1 -0
- package/dist/generate-stories-script.js +76 -0
- package/dist/generate-stories-script.js.map +1 -0
- package/dist/get-node-module-dir.d.ts +2 -0
- package/dist/get-node-module-dir.d.ts.map +1 -0
- package/dist/get-node-module-dir.js +9 -0
- package/dist/get-node-module-dir.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +168 -0
- package/dist/index.js.map +1 -0
- package/dist/inject-exports-order.d.ts +2 -0
- package/dist/inject-exports-order.d.ts.map +1 -0
- package/dist/inject-exports-order.js +17 -0
- package/dist/inject-exports-order.js.map +1 -0
- package/dist/list-stories.d.ts +3 -0
- package/dist/list-stories.d.ts.map +1 -0
- package/dist/list-stories.js +45 -0
- package/dist/list-stories.js.map +1 -0
- package/dist/read-file-config.d.ts +3 -0
- package/dist/read-file-config.d.ts.map +1 -0
- package/dist/read-file-config.js +18 -0
- package/dist/read-file-config.js.map +1 -0
- package/dist/rollup-plugin-prebundle-modules.d.ts +5 -0
- package/dist/rollup-plugin-prebundle-modules.d.ts.map +1 -0
- package/dist/rollup-plugin-prebundle-modules.js +195 -0
- package/dist/rollup-plugin-prebundle-modules.js.map +1 -0
- package/dist/rollup-plugin-storybook-builder.d.ts +4 -0
- package/dist/rollup-plugin-storybook-builder.d.ts.map +1 -0
- package/dist/rollup-plugin-storybook-builder.js +48 -0
- package/dist/rollup-plugin-storybook-builder.js.map +1 -0
- package/dist/virtual-file-names.d.ts +4 -0
- package/dist/virtual-file-names.d.ts.map +1 -0
- package/dist/virtual-file-names.js +10 -0
- package/dist/virtual-file-names.js.map +1 -0
- package/index.d.ts +2 -0
- package/index.mjs +6 -0
- package/package.json +86 -0
- package/static/iframe-template.html +69 -0
package/CHANGELOG.md
ADDED
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-app-script.d.ts","sourceRoot":"","sources":["../src/generate-app-script.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAqB,MAAM,kBAAkB,CAAC;AAGnE,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,OAAO,mBAsCvD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// based on https://github.com/storybookjs/storybook/blob/v7.0.9/code/lib/builder-vite/src/codegen-modern-iframe-script.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.generateAppScript = void 0;
|
|
5
|
+
const core_common_1 = require("@storybook/core-common");
|
|
6
|
+
const virtual_file_names_1 = require("./virtual-file-names");
|
|
7
|
+
async function generateAppScript(options) {
|
|
8
|
+
const { presets, configDir } = options;
|
|
9
|
+
const previewOrConfigFile = (0, core_common_1.loadPreviewOrConfigFile)({ configDir });
|
|
10
|
+
const previewAnnotations = await presets.apply('previewAnnotations', [], options);
|
|
11
|
+
const previewAnnotationURLs = [...previewAnnotations, previewOrConfigFile]
|
|
12
|
+
.filter((path) => !!path)
|
|
13
|
+
.map((path) => (typeof path === 'object' ? path.bare : path));
|
|
14
|
+
// This is pulled out to a variable because it is reused in both the initial page load
|
|
15
|
+
// and the HMR handler. We don't use the hot.accept callback params because only the changed
|
|
16
|
+
// modules are provided, the rest are null. We can just re-import everything again in that case.
|
|
17
|
+
const getPreviewAnnotationsFunction = `
|
|
18
|
+
const getProjectAnnotations = async () => {
|
|
19
|
+
const configs = await Promise.all([
|
|
20
|
+
${previewAnnotationURLs.map(previewAnnotation => ` import('${previewAnnotation}')`).join(',\n')}
|
|
21
|
+
]);
|
|
22
|
+
return composeConfigs(configs);
|
|
23
|
+
}
|
|
24
|
+
`.trim();
|
|
25
|
+
return `
|
|
26
|
+
import { composeConfigs, PreviewWeb, ClientApi } from '@storybook/preview-api';
|
|
27
|
+
import '${virtual_file_names_1.virtualSetupAddonsFilename}';
|
|
28
|
+
import { importFn } from '${virtual_file_names_1.virtualStoriesFilename}';
|
|
29
|
+
|
|
30
|
+
${getPreviewAnnotationsFunction}
|
|
31
|
+
|
|
32
|
+
window.__STORYBOOK_PREVIEW__ = window.__STORYBOOK_PREVIEW__ || new PreviewWeb();
|
|
33
|
+
|
|
34
|
+
window.__STORYBOOK_STORY_STORE__ = window.__STORYBOOK_STORY_STORE__ || window.__STORYBOOK_PREVIEW__.storyStore;
|
|
35
|
+
window.__STORYBOOK_CLIENT_API__ = window.__STORYBOOK_CLIENT_API__ || new ClientApi({ storyStore: window.__STORYBOOK_PREVIEW__.storyStore });
|
|
36
|
+
window.__STORYBOOK_PREVIEW__.initialize({ importFn, getProjectAnnotations });
|
|
37
|
+
`.trim();
|
|
38
|
+
}
|
|
39
|
+
exports.generateAppScript = generateAppScript;
|
|
40
|
+
//# sourceMappingURL=generate-app-script.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-app-script.js","sourceRoot":"","sources":["../src/generate-app-script.ts"],"names":[],"mappings":";AAAA,0HAA0H;;;AAE1H,wDAAiE;AAEjE,6DAA0F;AAEnF,KAAK,UAAU,iBAAiB,CAAC,OAAgB;IACtD,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAEvC,MAAM,mBAAmB,GAAG,IAAA,qCAAuB,EAAC,EAAE,SAAS,EAAE,CAAC,CAAC;IACnE,MAAM,kBAAkB,GAAG,MAAM,OAAO,CAAC,KAAK,CAC5C,oBAAoB,EACpB,EAAE,EACF,OAAO,CACR,CAAC;IACF,MAAM,qBAAqB,GAAG,CAAC,GAAG,kBAAkB,EAAE,mBAAmB,CAAC;SACvE,MAAM,CAAC,CAAC,IAAI,EAA6B,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;SACnD,GAAG,CAAC,CAAC,IAAuB,EAAE,EAAE,CAAC,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAEnF,sFAAsF;IACtF,6FAA6F;IAC7F,iGAAiG;IACjG,MAAM,6BAA6B,GAAG;;;EAGtC,qBAAqB,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE,CAAC,eAAe,iBAAiB,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;;;;GAI/F,CAAC,IAAI,EAAE,CAAC;IAET,OAAO;;UAEC,+CAA0B;4BACR,2CAAsB;;EAEhD,6BAA6B;;;;;;;GAO5B,CAAC,IAAI,EAAE,CAAC;AACX,CAAC;AAtCD,8CAsCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-iframe-html.d.ts","sourceRoot":"","sources":["../src/generate-iframe-html.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAI5D,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,SAAS,CAAC;AAE7C,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAoC1E"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateIframeHtml = void 0;
|
|
4
|
+
const core_common_1 = require("@storybook/core-common");
|
|
5
|
+
const fs_extra_1 = require("fs-extra");
|
|
6
|
+
const virtual_file_names_1 = require("./virtual-file-names");
|
|
7
|
+
async function generateIframeHtml(options) {
|
|
8
|
+
const iframeHtmlTemplate = await (0, fs_extra_1.readFile)(require.resolve('../static/iframe-template.html'), 'utf-8');
|
|
9
|
+
const { configType, features, presets, serverChannelUrl } = options;
|
|
10
|
+
const frameworkOptions = await presets.apply('frameworkOptions');
|
|
11
|
+
const headHtmlSnippet = await presets.apply('previewHead');
|
|
12
|
+
const bodyHtmlSnippet = await presets.apply('previewBody');
|
|
13
|
+
const logLevel = await presets.apply('logLevel', undefined);
|
|
14
|
+
// const docsOptions = await presets.apply<DocsOptions>('docs');
|
|
15
|
+
const coreOptions = await presets.apply('core');
|
|
16
|
+
const stories = (0, core_common_1.normalizeStories)(await options.presets.apply('stories', [], options), {
|
|
17
|
+
configDir: options.configDir,
|
|
18
|
+
workingDir: process.cwd(),
|
|
19
|
+
}).map(specifier => (Object.assign(Object.assign({}, specifier), { importPathMatcher: specifier.importPathMatcher.source })));
|
|
20
|
+
return (iframeHtmlTemplate
|
|
21
|
+
.replace('[CONFIG_TYPE HERE]', configType || '')
|
|
22
|
+
.replace('[LOGLEVEL HERE]', logLevel || '')
|
|
23
|
+
.replace(`'[FRAMEWORK_OPTIONS HERE]'`, JSON.stringify(frameworkOptions))
|
|
24
|
+
.replace(`'[CHANNEL_OPTIONS HERE]'`, JSON.stringify(coreOptions && coreOptions.channelOptions ? coreOptions.channelOptions : {}))
|
|
25
|
+
.replace(`'[FEATURES HERE]'`, JSON.stringify(features || {}))
|
|
26
|
+
.replace(`'[STORIES HERE]'`, JSON.stringify(stories || {}))
|
|
27
|
+
// .replace(`'[DOCS_OPTIONS HERE]'`, JSON.stringify(docsOptions || {}))
|
|
28
|
+
.replace(`'[SERVER_CHANNEL_URL HERE]'`, JSON.stringify(serverChannelUrl))
|
|
29
|
+
.replace('<!-- [HEAD HTML SNIPPET HERE] -->', headHtmlSnippet || '')
|
|
30
|
+
.replace('<!-- [BODY HTML SNIPPET HERE] -->', bodyHtmlSnippet || '')
|
|
31
|
+
.replace(`[APP MODULE SRC HERE]`, virtual_file_names_1.virtualAppFilename));
|
|
32
|
+
}
|
|
33
|
+
exports.generateIframeHtml = generateIframeHtml;
|
|
34
|
+
//# sourceMappingURL=generate-iframe-html.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-iframe-html.js","sourceRoot":"","sources":["../src/generate-iframe-html.ts"],"names":[],"mappings":";;;AAAA,wDAA0D;AAE1D,uCAAoC;AACpC,6DAA0D;AAInD,KAAK,UAAU,kBAAkB,CAAC,OAAgB;IACvD,MAAM,kBAAkB,GAAG,MAAM,IAAA,mBAAQ,EACvC,OAAO,CAAC,OAAO,CAAC,gCAAgC,CAAC,EACjD,OAAO,CACR,CAAC;IACF,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC;IACpE,MAAM,gBAAgB,GAAG,MAAM,OAAO,CAAC,KAAK,CAA6B,kBAAkB,CAAC,CAAC;IAC7F,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC,KAAK,CAAc,aAAa,CAAC,CAAC;IACxE,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC,KAAK,CAAc,aAAa,CAAC,CAAC;IACxE,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IAC5D,gEAAgE;IAChE,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,KAAK,CAAa,MAAM,CAAC,CAAC;IAC5D,MAAM,OAAO,GAAG,IAAA,8BAAgB,EAAC,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE;QACp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 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// based on https://github.com/storybookjs/storybook/blob/v7.0.9/code/lib/builder-vite/src/codegen-set-addon-channel.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.generateSetupAddonsScript = void 0;
|
|
5
|
+
async function generateSetupAddonsScript() {
|
|
6
|
+
return `
|
|
7
|
+
import { createChannel as createPostMessageChannel } from '@storybook/channel-postmessage';
|
|
8
|
+
import { createChannel as createWebSocketChannel } from '@storybook/channel-websocket';
|
|
9
|
+
import { addons } from '@storybook/preview-api';
|
|
10
|
+
|
|
11
|
+
const channel = createPostMessageChannel({ page: 'preview' });
|
|
12
|
+
addons.setChannel(channel);
|
|
13
|
+
window.__STORYBOOK_ADDONS_CHANNEL__ = channel;
|
|
14
|
+
|
|
15
|
+
const { SERVER_CHANNEL_URL } = globalThis;
|
|
16
|
+
if (SERVER_CHANNEL_URL) {
|
|
17
|
+
const serverChannel = createWebSocketChannel({ url: SERVER_CHANNEL_URL });
|
|
18
|
+
addons.setServerChannel(serverChannel);
|
|
19
|
+
window.__STORYBOOK_SERVER_CHANNEL__ = serverChannel;
|
|
20
|
+
}
|
|
21
|
+
`.trim();
|
|
22
|
+
}
|
|
23
|
+
exports.generateSetupAddonsScript = generateSetupAddonsScript;
|
|
24
|
+
//# sourceMappingURL=generate-setup-addons-script.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-setup-addons-script.js","sourceRoot":"","sources":["../src/generate-setup-addons-script.ts"],"names":[],"mappings":";AAAA,uHAAuH;;;AAEhH,KAAK,UAAU,yBAAyB;IAC7C,OAAO;;;;;;;;;;;;;;;GAeN,CAAC,IAAI,EAAE,CAAC;AACX,CAAC;AAjBD,8DAiBC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Options } from '@storybook/types';
|
|
2
|
+
/**
|
|
3
|
+
* This file is largely based on https://github.com/storybookjs/storybook/blob/d1195cbd0c61687f1720fefdb772e2f490a46584/lib/core-common/src/utils/to-importFn.ts
|
|
4
|
+
*/
|
|
5
|
+
export declare function generateStoriesScript(options: Options): Promise<string>;
|
|
6
|
+
//# sourceMappingURL=generate-stories-script.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-stories-script.d.ts","sourceRoot":"","sources":["../src/generate-stories-script.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAIhD;;GAEG;AAEH,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,OAAO,mBAM3D"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// based on https://github.com/storybookjs/storybook/blob/v7.0.9/code/lib/builder-vite/src/codegen-importfn-script.ts
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.generateStoriesScript = void 0;
|
|
28
|
+
const pluginutils_1 = require("@rollup/pluginutils");
|
|
29
|
+
const node_logger_1 = require("@storybook/node-logger");
|
|
30
|
+
const path = __importStar(require("path"));
|
|
31
|
+
const list_stories_1 = require("./list-stories");
|
|
32
|
+
/**
|
|
33
|
+
* This file is largely based on https://github.com/storybookjs/storybook/blob/d1195cbd0c61687f1720fefdb772e2f490a46584/lib/core-common/src/utils/to-importFn.ts
|
|
34
|
+
*/
|
|
35
|
+
async function generateStoriesScript(options) {
|
|
36
|
+
// First we need to get an array of stories and their absolute paths.
|
|
37
|
+
const stories = await (0, list_stories_1.listStories)(options);
|
|
38
|
+
// We can then call toImportFn to create a function that can be used to load each story dynamically.
|
|
39
|
+
return (await toImportFn(stories)).trim();
|
|
40
|
+
}
|
|
41
|
+
exports.generateStoriesScript = generateStoriesScript;
|
|
42
|
+
/**
|
|
43
|
+
* This function takes an array of stories and creates a mapping between the stories' relative paths
|
|
44
|
+
* to the working directory and their dynamic imports. The import is done in an asynchronous function
|
|
45
|
+
* to delay loading. It then creates a function, `importFn(path)`, which resolves a path to an import
|
|
46
|
+
* function and this is called by Storybook to fetch a story dynamically when needed.
|
|
47
|
+
* @param stories An array of absolute story paths.
|
|
48
|
+
*/
|
|
49
|
+
async function toImportFn(stories) {
|
|
50
|
+
const objectEntries = stories.map(file => {
|
|
51
|
+
const ext = path.extname(file);
|
|
52
|
+
const relativePath = (0, pluginutils_1.normalizePath)(path.relative(process.cwd(), file));
|
|
53
|
+
if (!['.js', '.jsx', '.ts', '.tsx', '.mdx', '.svelte', '.vue'].includes(ext)) {
|
|
54
|
+
node_logger_1.logger.warn(`Cannot process ${ext} file with storyStoreV7: ${relativePath}`);
|
|
55
|
+
}
|
|
56
|
+
return ` '${toImportPath(relativePath)}': () => import('${process.cwd()}/${relativePath}')`;
|
|
57
|
+
});
|
|
58
|
+
return `
|
|
59
|
+
const importers = {
|
|
60
|
+
${objectEntries.join(',\n')}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export function importFn(path) {
|
|
64
|
+
return importers[path]();
|
|
65
|
+
}
|
|
66
|
+
`.trim();
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Paths get passed either with no leading './' - e.g. `src/Foo.stories.js`,
|
|
70
|
+
* or with a leading `../` (etc), e.g. `../src/Foo.stories.js`.
|
|
71
|
+
* We want to deal in importPaths relative to the working dir, so we normalize
|
|
72
|
+
*/
|
|
73
|
+
function toImportPath(relativePath) {
|
|
74
|
+
return relativePath.startsWith('../') ? relativePath : `./${relativePath}`;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=generate-stories-script.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-stories-script.js","sourceRoot":"","sources":["../src/generate-stories-script.ts"],"names":[],"mappings":";AAAA,qHAAqH;;;;;;;;;;;;;;;;;;;;;;;;;;AAErH,qDAAoD;AACpD,wDAAgD;AAEhD,2CAA6B;AAC7B,iDAA6C;AAE7C;;GAEG;AAEI,KAAK,UAAU,qBAAqB,CAAC,OAAgB;IAC1D,qEAAqE;IACrE,MAAM,OAAO,GAAG,MAAM,IAAA,0BAAW,EAAC,OAAO,CAAC,CAAC;IAE3C,oGAAoG;IACpG,OAAO,CAAC,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAC5C,CAAC;AAND,sDAMC;AAED;;;;;;GAMG;AACH,KAAK,UAAU,UAAU,CAAC,OAAiB;IACzC,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QACvC,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC/B,MAAM,YAAY,GAAG,IAAA,2BAAa,EAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;QACvE,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YAC5E,oBAAM,CAAC,IAAI,CAAC,kBAAkB,GAAG,4BAA4B,YAAY,EAAE,CAAC,CAAC;SAC9E;QAED,OAAO,MAAM,YAAY,CAAC,YAAY,CAAC,oBAAoB,OAAO,CAAC,GAAG,EAAE,IAAI,YAAY,IAAI,CAAC;IAC/F,CAAC,CAAC,CAAC;IAEH,OAAO;;EAEP,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC;;;;;;GAMxB,CAAC,IAAI,EAAE,CAAC;AACX,CAAC;AAED;;;;GAIG;AACH,SAAS,YAAY,CAAC,YAAoB;IACxC,OAAO,YAAY,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,YAAY,EAAE,CAAC;AAC7E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-node-module-dir.d.ts","sourceRoot":"","sources":["../src/get-node-module-dir.ts"],"names":[],"mappings":"AAEA,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE3D"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getNodeModuleDir = void 0;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
function getNodeModuleDir(moduleName) {
|
|
6
|
+
return (0, path_1.dirname)(require.resolve(`${moduleName}/package.json`));
|
|
7
|
+
}
|
|
8
|
+
exports.getNodeModuleDir = getNodeModuleDir;
|
|
9
|
+
//# sourceMappingURL=get-node-module-dir.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-node-module-dir.js","sourceRoot":"","sources":["../src/get-node-module-dir.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAE/B,SAAgB,gBAAgB,CAAC,UAAkB;IACjD,OAAO,IAAA,cAAO,EAAC,OAAO,CAAC,OAAO,CAAC,GAAG,UAAU,eAAe,CAAC,CAAC,CAAC;AAChE,CAAC;AAFD,4CAEC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Builder, Options, StorybookConfig as StorybookConfigBase } from '@storybook/types';
|
|
2
|
+
import { DevServerConfig } from '@web/dev-server';
|
|
3
|
+
import { RollupOptions } from 'rollup';
|
|
4
|
+
export type StorybookConfigWds = StorybookConfigBase & {
|
|
5
|
+
wdsFinal?: (config: DevServerConfig, options: Options) => DevServerConfig | Promise<DevServerConfig>;
|
|
6
|
+
rollupFinal?: (config: RollupOptions, options: Options) => RollupOptions | Promise<RollupOptions>;
|
|
7
|
+
};
|
|
8
|
+
export type BuilderOptions = {
|
|
9
|
+
/**
|
|
10
|
+
* Path to @web/dev-server config file, relative to CWD.
|
|
11
|
+
*/
|
|
12
|
+
wdsConfigPath?: string;
|
|
13
|
+
};
|
|
14
|
+
type WdsStats = {
|
|
15
|
+
toJson: () => any;
|
|
16
|
+
};
|
|
17
|
+
export type WdsBuilder = Builder<DevServerConfig, WdsStats>;
|
|
18
|
+
export declare const bail: WdsBuilder['bail'];
|
|
19
|
+
export declare const start: WdsBuilder['start'];
|
|
20
|
+
export declare const build: WdsBuilder['build'];
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,IAAI,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACjG,OAAO,EAAE,eAAe,EAAgC,MAAM,iBAAiB,CAAC;AAOhF,OAAO,EAA8B,aAAa,EAAU,MAAM,QAAQ,CAAC;AAe3E,MAAM,MAAM,kBAAkB,GAAG,mBAAmB,GAAG;IACrD,QAAQ,CAAC,EAAE,CACT,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,OAAO,KACb,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAChD,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,KAAK,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CACnG,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAGF,KAAK,QAAQ,GAAG;IACd,MAAM,EAAE,MAAM,GAAG,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;AAI5D,eAAO,MAAM,IAAI,EAAE,UAAU,CAAC,MAAM,CAEnC,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,UAAU,CAAC,OAAO,CAsErC,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,UAAU,CAAC,OAAO,CA+DrC,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.build = exports.start = exports.bail = void 0;
|
|
30
|
+
const plugin_node_resolve_1 = __importDefault(require("@rollup/plugin-node-resolve"));
|
|
31
|
+
const core_common_1 = require("@storybook/core-common");
|
|
32
|
+
const node_logger_1 = require("@storybook/node-logger");
|
|
33
|
+
const globals_1 = require("@storybook/preview/globals");
|
|
34
|
+
const dev_server_1 = require("@web/dev-server");
|
|
35
|
+
const dev_server_rollup_1 = require("@web/dev-server-rollup");
|
|
36
|
+
const rollup_plugin_html_1 = require("@web/rollup-plugin-html");
|
|
37
|
+
const express_1 = __importDefault(require("express"));
|
|
38
|
+
const fs = __importStar(require("fs-extra"));
|
|
39
|
+
const path_1 = require("path");
|
|
40
|
+
const rollup_1 = require("rollup");
|
|
41
|
+
const rollup_plugin_external_globals_1 = __importDefault(require("rollup-plugin-external-globals"));
|
|
42
|
+
const generate_iframe_html_1 = require("./generate-iframe-html");
|
|
43
|
+
const get_node_module_dir_1 = require("./get-node-module-dir");
|
|
44
|
+
const read_file_config_1 = require("./read-file-config");
|
|
45
|
+
const rollup_plugin_prebundle_modules_1 = require("./rollup-plugin-prebundle-modules");
|
|
46
|
+
const rollup_plugin_storybook_builder_1 = require("./rollup-plugin-storybook-builder");
|
|
47
|
+
const wdsPluginExternalGlobals = (0, dev_server_rollup_1.fromRollup)(rollup_plugin_external_globals_1.default);
|
|
48
|
+
const wdsPluginPrebundleModules = (0, dev_server_rollup_1.fromRollup)(rollup_plugin_prebundle_modules_1.rollupPluginPrebundleModules);
|
|
49
|
+
const wdsPluginStorybookBuilder = (0, dev_server_rollup_1.fromRollup)(rollup_plugin_storybook_builder_1.rollupPluginStorybookBuilder);
|
|
50
|
+
let wdsServer;
|
|
51
|
+
const bail = async () => {
|
|
52
|
+
await (wdsServer === null || wdsServer === void 0 ? void 0 : wdsServer.stop());
|
|
53
|
+
};
|
|
54
|
+
exports.bail = bail;
|
|
55
|
+
const start = async ({ startTime, options, router }) => {
|
|
56
|
+
const previewDirOrigin = (0, path_1.join)((0, get_node_module_dir_1.getNodeModuleDir)('@storybook/preview'), 'dist');
|
|
57
|
+
router.use('/sb-preview', express_1.default.static(previewDirOrigin, { immutable: true, maxAge: '5m' }));
|
|
58
|
+
router.use(`/${rollup_plugin_prebundle_modules_1.PREBUNDLED_MODULES_DIR}`, express_1.default.static((0, path_1.resolve)(`./${rollup_plugin_prebundle_modules_1.PREBUNDLED_MODULES_DIR}`)));
|
|
59
|
+
const env = await options.presets.apply('env');
|
|
60
|
+
const wdsStorybookConfig = {
|
|
61
|
+
nodeResolve: true,
|
|
62
|
+
plugins: [
|
|
63
|
+
{
|
|
64
|
+
name: 'storybook-iframe-html',
|
|
65
|
+
async serve(context) {
|
|
66
|
+
if (context.path === '/iframe.html') {
|
|
67
|
+
const iframeHtml = await (0, generate_iframe_html_1.generateIframeHtml)(options);
|
|
68
|
+
return { type: 'html', body: iframeHtml };
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
wdsPluginPrebundleModules(env),
|
|
73
|
+
wdsPluginStorybookBuilder(options),
|
|
74
|
+
wdsPluginExternalGlobals(globals_1.globals),
|
|
75
|
+
],
|
|
76
|
+
};
|
|
77
|
+
const { wdsConfigPath } = await (0, core_common_1.getBuilderOptions)(options);
|
|
78
|
+
const wdsUserConfig = await (0, read_file_config_1.readFileConfig)(wdsConfigPath);
|
|
79
|
+
const wdsFinalConfig = await options.presets.apply('wdsFinal', (0, dev_server_1.mergeConfigs)(wdsUserConfig, wdsStorybookConfig, {
|
|
80
|
+
// reset local config "open" as it should not be used for storybook specific configuration
|
|
81
|
+
open: false,
|
|
82
|
+
}), options);
|
|
83
|
+
// if "wdsFinal" added "open" then rewrite it to open on storybook host (unless it's a full URL)
|
|
84
|
+
if (wdsFinalConfig.open &&
|
|
85
|
+
typeof wdsFinalConfig.open === 'string' &&
|
|
86
|
+
!wdsFinalConfig.open.match(/^https?:\/\//)) {
|
|
87
|
+
const protocol = options.https ? 'https' : 'http';
|
|
88
|
+
const host = options.host || 'localhost';
|
|
89
|
+
const port = options.port;
|
|
90
|
+
wdsFinalConfig.open = `${protocol}://${host}:${port}${wdsFinalConfig.open}`;
|
|
91
|
+
}
|
|
92
|
+
// setup middleware mode
|
|
93
|
+
wdsFinalConfig.middlewareMode = true;
|
|
94
|
+
wdsFinalConfig.port = undefined;
|
|
95
|
+
wdsFinalConfig.hostname = undefined;
|
|
96
|
+
wdsServer = await (0, dev_server_1.startDevServer)({
|
|
97
|
+
// we load and merge configs manually
|
|
98
|
+
readFileConfig: false,
|
|
99
|
+
readCliArgs: false,
|
|
100
|
+
autoExitProcess: false,
|
|
101
|
+
logStartMessage: false,
|
|
102
|
+
config: wdsFinalConfig,
|
|
103
|
+
});
|
|
104
|
+
router.use(wdsServer.koaApp.callback());
|
|
105
|
+
return {
|
|
106
|
+
bail: exports.bail,
|
|
107
|
+
stats: { toJson: () => null },
|
|
108
|
+
totalTime: process.hrtime(startTime),
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
exports.start = start;
|
|
112
|
+
const build = async ({ startTime, options }) => {
|
|
113
|
+
const env = await options.presets.apply('env');
|
|
114
|
+
const rollupDefaultOutputOptions = {
|
|
115
|
+
dir: options.outputDir,
|
|
116
|
+
};
|
|
117
|
+
const rollupStorybookConfig = {
|
|
118
|
+
output: rollupDefaultOutputOptions,
|
|
119
|
+
external: ['./sb-preview/runtime.js'],
|
|
120
|
+
plugins: [
|
|
121
|
+
(0, rollup_plugin_html_1.rollupPluginHTML)({
|
|
122
|
+
input: { html: await (0, generate_iframe_html_1.generateIframeHtml)(options), name: 'iframe.html' },
|
|
123
|
+
// default assets behavior of the plugin breaks, sb-common-assets are shared between manager and preview and copied separately
|
|
124
|
+
extractAssets: false,
|
|
125
|
+
}),
|
|
126
|
+
(0, plugin_node_resolve_1.default)(),
|
|
127
|
+
(0, rollup_plugin_prebundle_modules_1.rollupPluginPrebundleModules)(env),
|
|
128
|
+
(0, rollup_plugin_storybook_builder_1.rollupPluginStorybookBuilder)(options),
|
|
129
|
+
(0, rollup_plugin_external_globals_1.default)(globals_1.globals),
|
|
130
|
+
],
|
|
131
|
+
};
|
|
132
|
+
const rollupFinalConfig = await options.presets.apply('rollupFinal', rollupStorybookConfig, options);
|
|
133
|
+
const rollupBuild = (async () => {
|
|
134
|
+
node_logger_1.logger.info('=> Building preview..');
|
|
135
|
+
let bundle;
|
|
136
|
+
try {
|
|
137
|
+
bundle = await (0, rollup_1.rollup)(rollupFinalConfig);
|
|
138
|
+
if (rollupFinalConfig.output) {
|
|
139
|
+
const outputOptionsArray = Array.isArray(rollupFinalConfig.output)
|
|
140
|
+
? rollupFinalConfig.output
|
|
141
|
+
: [rollupFinalConfig.output];
|
|
142
|
+
for (const outputOptions of outputOptionsArray) {
|
|
143
|
+
await bundle.write(outputOptions);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
finally {
|
|
148
|
+
if (bundle) {
|
|
149
|
+
bundle.close();
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
node_logger_1.logger.trace({ message: '=> Preview built', time: process.hrtime(startTime) });
|
|
153
|
+
})();
|
|
154
|
+
const previewDirOrigin = (0, path_1.join)((0, get_node_module_dir_1.getNodeModuleDir)('@storybook/preview'), 'dist');
|
|
155
|
+
const previewDirTarget = (0, path_1.join)(options.outputDir || '', `sb-preview`);
|
|
156
|
+
const previewFiles = fs.copy(previewDirOrigin, previewDirTarget, {
|
|
157
|
+
filter: src => {
|
|
158
|
+
const { ext } = (0, path_1.parse)(src);
|
|
159
|
+
if (ext) {
|
|
160
|
+
return ext === '.js';
|
|
161
|
+
}
|
|
162
|
+
return true;
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
await Promise.all([rollupBuild, previewFiles]);
|
|
166
|
+
};
|
|
167
|
+
exports.build = build;
|
|
168
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sFAAkE;AAClE,wDAA2D;AAC3D,wDAAgD;AAChD,wDAAqD;AAErD,gDAAgF;AAEhF,8DAAoD;AACpD,gEAA2D;AAC3D,sDAA8B;AAC9B,6CAA+B;AAC/B,+BAA4C;AAC5C,mCAA2E;AAC3E,oGAAyE;AACzE,iEAA4D;AAC5D,+DAAyD;AACzD,yDAAoD;AACpD,uFAG2C;AAC3C,uFAAiF;AAEjF,MAAM,wBAAwB,GAAG,IAAA,8BAAU,EAAC,wCAA2B,CAAC,CAAC;AACzE,MAAM,yBAAyB,GAAG,IAAA,8BAAU,EAAC,8DAA4B,CAAC,CAAC;AAC3E,MAAM,yBAAyB,GAAG,IAAA,8BAAU,EAAC,8DAA4B,CAAC,CAAC;AAwB3E,IAAI,SAAoB,CAAC;AAElB,MAAM,IAAI,GAAuB,KAAK,IAAI,EAAE;IACjD,MAAM,CAAA,SAAS,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"mappings":"AAIA,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,0BAWxE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// based on https://github.com/modernweb-dev/web/blob/%40web/dev-server-storybook%400.7.1/packages/dev-server-storybook/src/shared/stories/injectExportsOrder.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.injectExportsOrder = void 0;
|
|
5
|
+
const es_module_lexer_1 = require("es-module-lexer");
|
|
6
|
+
async function injectExportsOrder(source, filePath) {
|
|
7
|
+
const [, exports] = await (0, es_module_lexer_1.parse)(source, filePath);
|
|
8
|
+
if (exports.some(e => e.n === '__namedExportsOrder')) {
|
|
9
|
+
// user has defined named exports already
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
const orderedExports = exports.filter(e => e.n !== 'default');
|
|
13
|
+
const exportsArray = `['${orderedExports.map(({ n }) => n).join("', '")}']`;
|
|
14
|
+
return `${source};\nexport const __namedExportsOrder = ${exportsArray};`;
|
|
15
|
+
}
|
|
16
|
+
exports.injectExportsOrder = injectExportsOrder;
|
|
17
|
+
//# sourceMappingURL=inject-exports-order.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inject-exports-order.js","sourceRoot":"","sources":["../src/inject-exports-order.ts"],"names":[],"mappings":";AAAA,gKAAgK;;;AAEhK,qDAAwC;AAEjC,KAAK,UAAU,kBAAkB,CAAC,MAAc,EAAE,QAAgB;IACvE,MAAM,CAAC,EAAE,OAAO,CAAC,GAAG,MAAM,IAAA,uBAAK,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAClD,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,qBAAqB,CAAC,EAAE;QACpD,yCAAyC;QACzC,OAAO,IAAI,CAAC;KACb;IAED,MAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;IAC9D,MAAM,YAAY,GAAG,KAAK,cAAc,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IAE5E,OAAO,GAAG,MAAM,yCAAyC,YAAY,GAAG,CAAC;AAC3E,CAAC;AAXD,gDAWC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-stories.d.ts","sourceRoot":"","sources":["../src/list-stories.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAIhD,wBAAsB,WAAW,CAAC,OAAO,EAAE,OAAO,qBAkBjD"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// based on https://github.com/storybookjs/storybook/blob/v7.0.9/code/lib/builder-vite/src/list-stories.ts
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.listStories = void 0;
|
|
28
|
+
const core_common_1 = require("@storybook/core-common");
|
|
29
|
+
const glob_promise_1 = require("glob-promise");
|
|
30
|
+
const path = __importStar(require("path"));
|
|
31
|
+
async function listStories(options) {
|
|
32
|
+
const slash = (await Promise.resolve().then(() => __importStar(require('slash')))).default; // for CJS compatibility
|
|
33
|
+
return (await Promise.all((0, core_common_1.normalizeStories)(await options.presets.apply('stories', [], options), {
|
|
34
|
+
configDir: options.configDir,
|
|
35
|
+
workingDir: options.configDir,
|
|
36
|
+
}).map(({ directory, files }) => {
|
|
37
|
+
const pattern = path.join(directory, files);
|
|
38
|
+
const absolutePattern = path.isAbsolute(pattern)
|
|
39
|
+
? pattern
|
|
40
|
+
: path.join(options.configDir, pattern);
|
|
41
|
+
return (0, glob_promise_1.promise)(slash(absolutePattern), { follow: true });
|
|
42
|
+
}))).reduce((carry, stories) => carry.concat(stories), []);
|
|
43
|
+
}
|
|
44
|
+
exports.listStories = listStories;
|
|
45
|
+
//# sourceMappingURL=list-stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-stories.js","sourceRoot":"","sources":["../src/list-stories.ts"],"names":[],"mappings":";AAAA,0GAA0G;;;;;;;;;;;;;;;;;;;;;;;;;;AAE1G,wDAA0D;AAE1D,+CAA+C;AAC/C,2CAA6B;AAEtB,KAAK,UAAU,WAAW,CAAC,OAAgB;IAChD,MAAM,KAAK,GAAG,CAAC,wDAAa,OAAO,GAAC,CAAC,CAAC,OAAO,CAAC,CAAC,wBAAwB;IAEvE,OAAO,CACL,MAAM,OAAO,CAAC,GAAG,CACf,IAAA,8BAAgB,EAAC,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE;QACpE,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,UAAU,EAAE,OAAO,CAAC,SAAS;KAC9B,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE;QAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QAC5C,MAAM,eAAe,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;YAC9C,CAAC,CAAC,OAAO;YACT,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAE1C,OAAO,IAAA,sBAAI,EAAC,KAAK,CAAC,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IACxD,CAAC,CAAC,CACH,CACF,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;AAC1D,CAAC;AAlBD,kCAkBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-file-config.d.ts","sourceRoot":"","sources":["../src/read-file-config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAuB,MAAM,iBAAiB,CAAC;AAEvE,wBAAsB,cAAc,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CASlF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readFileConfig = void 0;
|
|
4
|
+
const config_loader_1 = require("@web/config-loader");
|
|
5
|
+
const dev_server_1 = require("@web/dev-server");
|
|
6
|
+
async function readFileConfig(customPath) {
|
|
7
|
+
try {
|
|
8
|
+
return await (0, config_loader_1.readConfig)('web-dev-server.config', customPath);
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
if (error instanceof config_loader_1.ConfigLoaderError) {
|
|
12
|
+
throw new dev_server_1.DevServerStartError(error.message);
|
|
13
|
+
}
|
|
14
|
+
throw error;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.readFileConfig = readFileConfig;
|
|
18
|
+
//# sourceMappingURL=read-file-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-file-config.js","sourceRoot":"","sources":["../src/read-file-config.ts"],"names":[],"mappings":";;;AAAA,sDAAmE;AACnE,gDAAuE;AAEhE,KAAK,UAAU,cAAc,CAAC,UAAmB;IACtD,IAAI;QACF,OAAO,MAAM,IAAA,0BAAU,EAAC,uBAAuB,EAAE,UAAU,CAAC,CAAC;KAC9D;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,KAAK,YAAY,iCAAiB,EAAE;YACtC,MAAM,IAAI,gCAAmB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;SAC9C;QACD,MAAM,KAAK,CAAC;KACb;AACH,CAAC;AATD,wCASC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Plugin } from 'rollup';
|
|
2
|
+
export declare const PREBUNDLED_MODULES_DIR = "node_modules/.prebundled_modules";
|
|
3
|
+
export declare function rollupPluginPrebundleModules(env: Record<string, string>): Plugin;
|
|
4
|
+
export declare const CANDIDATES: string[];
|
|
5
|
+
//# sourceMappingURL=rollup-plugin-prebundle-modules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rollup-plugin-prebundle-modules.d.ts","sourceRoot":"","sources":["../src/rollup-plugin-prebundle-modules.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGrC,eAAO,MAAM,sBAAsB,qCAAqC,CAAC;AAEzE,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CA0ChF;AAeD,eAAO,MAAM,UAAU,UAmHtB,CAAC"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.CANDIDATES = exports.rollupPluginPrebundleModules = exports.PREBUNDLED_MODULES_DIR = void 0;
|
|
27
|
+
const core_common_1 = require("@storybook/core-common");
|
|
28
|
+
const esbuild_1 = require("esbuild");
|
|
29
|
+
const path_1 = require("path");
|
|
30
|
+
const get_node_module_dir_1 = require("./get-node-module-dir");
|
|
31
|
+
exports.PREBUNDLED_MODULES_DIR = 'node_modules/.prebundled_modules';
|
|
32
|
+
function rollupPluginPrebundleModules(env) {
|
|
33
|
+
const modulePaths = {};
|
|
34
|
+
return {
|
|
35
|
+
name: 'rollup-plugin-prebundle-modules',
|
|
36
|
+
async buildStart() {
|
|
37
|
+
const esbuildCommonjsPlugin = (await Promise.resolve().then(() => __importStar(require('@chialab/esbuild-plugin-commonjs')))).default; // for CJS compatibility
|
|
38
|
+
const modules = getModules();
|
|
39
|
+
for (const module of modules) {
|
|
40
|
+
modulePaths[module] = (0, path_1.join)(process.cwd(), exports.PREBUNDLED_MODULES_DIR, module.endsWith('.js') ? module : `${module}.js`);
|
|
41
|
+
}
|
|
42
|
+
await (0, esbuild_1.build)({
|
|
43
|
+
entryPoints: modules,
|
|
44
|
+
outdir: exports.PREBUNDLED_MODULES_DIR,
|
|
45
|
+
bundle: true,
|
|
46
|
+
format: 'esm',
|
|
47
|
+
splitting: true,
|
|
48
|
+
sourcemap: true,
|
|
49
|
+
alias: {
|
|
50
|
+
assert: require.resolve('browser-assert'),
|
|
51
|
+
lodash: (0, get_node_module_dir_1.getNodeModuleDir)('lodash-es'),
|
|
52
|
+
path: require.resolve('path-browserify'),
|
|
53
|
+
},
|
|
54
|
+
define: Object.assign({}, (0, core_common_1.stringifyProcessEnvs)(env)),
|
|
55
|
+
plugins: [esbuildCommonjsPlugin()],
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
async resolveId(source) {
|
|
59
|
+
return modulePaths[source];
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
exports.rollupPluginPrebundleModules = rollupPluginPrebundleModules;
|
|
64
|
+
function getModules() {
|
|
65
|
+
const include = exports.CANDIDATES.filter(id => {
|
|
66
|
+
try {
|
|
67
|
+
require.resolve(id, { paths: [process.cwd()] });
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
catch (e) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
return include;
|
|
75
|
+
}
|
|
76
|
+
// taken from https://github.com/storybookjs/storybook/blob/v7.0.9/code/lib/builder-vite/src/optimizeDeps.ts#L7
|
|
77
|
+
exports.CANDIDATES = [
|
|
78
|
+
'@base2/pretty-print-object',
|
|
79
|
+
'@emotion/core',
|
|
80
|
+
'@emotion/is-prop-valid',
|
|
81
|
+
'@emotion/styled',
|
|
82
|
+
'@mdx-js/react',
|
|
83
|
+
'@storybook/addon-docs > acorn-jsx',
|
|
84
|
+
'@storybook/addon-docs',
|
|
85
|
+
'@storybook/addon-essentials/docs/mdx-react-shim',
|
|
86
|
+
'@storybook/channel-postmessage',
|
|
87
|
+
'@storybook/channel-websocket',
|
|
88
|
+
'@storybook/client-api',
|
|
89
|
+
'@storybook/client-logger',
|
|
90
|
+
'@storybook/core/client',
|
|
91
|
+
'@storybook/global',
|
|
92
|
+
'@storybook/preview-api',
|
|
93
|
+
'@storybook/preview-web',
|
|
94
|
+
'@storybook/react > acorn-jsx',
|
|
95
|
+
'@storybook/react',
|
|
96
|
+
'@storybook/svelte',
|
|
97
|
+
'@storybook/types',
|
|
98
|
+
'@storybook/vue3',
|
|
99
|
+
'acorn-jsx',
|
|
100
|
+
'acorn-walk',
|
|
101
|
+
'acorn',
|
|
102
|
+
'airbnb-js-shims',
|
|
103
|
+
'ansi-to-html',
|
|
104
|
+
'axe-core',
|
|
105
|
+
'color-convert',
|
|
106
|
+
'deep-object-diff',
|
|
107
|
+
'doctrine',
|
|
108
|
+
'emotion-theming',
|
|
109
|
+
'escodegen',
|
|
110
|
+
'estraverse',
|
|
111
|
+
'fast-deep-equal',
|
|
112
|
+
'html-tags',
|
|
113
|
+
'isobject',
|
|
114
|
+
'jest-mock',
|
|
115
|
+
'loader-utils',
|
|
116
|
+
'lodash/camelCase.js',
|
|
117
|
+
'lodash/camelCase',
|
|
118
|
+
'lodash/cloneDeep.js',
|
|
119
|
+
'lodash/cloneDeep',
|
|
120
|
+
'lodash/countBy.js',
|
|
121
|
+
'lodash/countBy',
|
|
122
|
+
'lodash/debounce.js',
|
|
123
|
+
'lodash/debounce',
|
|
124
|
+
'lodash/isEqual.js',
|
|
125
|
+
'lodash/isEqual',
|
|
126
|
+
'lodash/isFunction.js',
|
|
127
|
+
'lodash/isFunction',
|
|
128
|
+
'lodash/isPlainObject.js',
|
|
129
|
+
'lodash/isPlainObject',
|
|
130
|
+
'lodash/isString.js',
|
|
131
|
+
'lodash/isString',
|
|
132
|
+
'lodash/kebabCase.js',
|
|
133
|
+
'lodash/kebabCase',
|
|
134
|
+
'lodash/mapKeys.js',
|
|
135
|
+
'lodash/mapKeys',
|
|
136
|
+
'lodash/mapValues.js',
|
|
137
|
+
'lodash/mapValues',
|
|
138
|
+
'lodash/merge.js',
|
|
139
|
+
'lodash/merge',
|
|
140
|
+
'lodash/mergeWith.js',
|
|
141
|
+
'lodash/mergeWith',
|
|
142
|
+
'lodash/pick.js',
|
|
143
|
+
'lodash/pick',
|
|
144
|
+
'lodash/pickBy.js',
|
|
145
|
+
'lodash/pickBy',
|
|
146
|
+
'lodash/startCase.js',
|
|
147
|
+
'lodash/startCase',
|
|
148
|
+
'lodash/throttle.js',
|
|
149
|
+
'lodash/throttle',
|
|
150
|
+
'lodash/uniq.js',
|
|
151
|
+
'lodash/uniq',
|
|
152
|
+
'lodash/upperFirst.js',
|
|
153
|
+
'lodash/upperFirst',
|
|
154
|
+
'markdown-to-jsx',
|
|
155
|
+
'memoizerific',
|
|
156
|
+
'overlayscrollbars',
|
|
157
|
+
'polished',
|
|
158
|
+
'prettier/parser-babel',
|
|
159
|
+
'prettier/parser-flow',
|
|
160
|
+
'prettier/parser-typescript',
|
|
161
|
+
'prop-types',
|
|
162
|
+
'qs',
|
|
163
|
+
'react-dom',
|
|
164
|
+
'react-dom/client',
|
|
165
|
+
'react-fast-compare',
|
|
166
|
+
'react-is',
|
|
167
|
+
'react-textarea-autosize',
|
|
168
|
+
'react',
|
|
169
|
+
'react/jsx-runtime',
|
|
170
|
+
'refractor/core',
|
|
171
|
+
'refractor/lang/bash.js',
|
|
172
|
+
'refractor/lang/css.js',
|
|
173
|
+
'refractor/lang/graphql.js',
|
|
174
|
+
'refractor/lang/js-extras.js',
|
|
175
|
+
'refractor/lang/json.js',
|
|
176
|
+
'refractor/lang/jsx.js',
|
|
177
|
+
'refractor/lang/markdown.js',
|
|
178
|
+
'refractor/lang/markup.js',
|
|
179
|
+
'refractor/lang/tsx.js',
|
|
180
|
+
'refractor/lang/typescript.js',
|
|
181
|
+
'refractor/lang/yaml.js',
|
|
182
|
+
'regenerator-runtime/runtime.js',
|
|
183
|
+
'slash',
|
|
184
|
+
'store2',
|
|
185
|
+
'synchronous-promise',
|
|
186
|
+
'telejson',
|
|
187
|
+
'ts-dedent',
|
|
188
|
+
'unfetch',
|
|
189
|
+
'util-deprecate',
|
|
190
|
+
'vue',
|
|
191
|
+
'warning',
|
|
192
|
+
];
|
|
193
|
+
// we need more, probably Vite in builder-vite transforms those on the fly
|
|
194
|
+
exports.CANDIDATES.push('@testing-library/user-event', 'aria-query', 'lz-string', 'pretty-format', 'tiny-invariant');
|
|
195
|
+
//# sourceMappingURL=rollup-plugin-prebundle-modules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rollup-plugin-prebundle-modules.js","sourceRoot":"","sources":["../src/rollup-plugin-prebundle-modules.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAA8D;AAC9D,qCAAgC;AAChC,+BAA4B;AAE5B,+DAAyD;AAE5C,QAAA,sBAAsB,GAAG,kCAAkC,CAAC;AAEzE,SAAgB,4BAA4B,CAAC,GAA2B;IACtE,MAAM,WAAW,GAA2B,EAAE,CAAC;IAE/C,OAAO;QACL,IAAI,EAAE,iCAAiC;QAEvC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ACnB,iBAAiB;IACjB,cAAc;IACd,mBAAmB;IACnB,UAAU;IACV,uBAAuB;IACvB,sBAAsB;IACtB,4BAA4B;IAC5B,YAAY;IACZ,IAAI;IACJ,WAAW;IACX,kBAAkB;IAClB,oBAAoB;IACpB,UAAU;IACV,yBAAyB;IACzB,OAAO;IACP,mBAAmB;IACnB,gBAAgB;IAChB,wBAAwB;IACxB,uBAAuB;IACvB,2BAA2B;IAC3B,6BAA6B;IAC7B,wBAAwB;IACxB,uBAAuB;IACvB,4BAA4B;IAC5B,0BAA0B;IAC1B,uBAAuB;IACvB,8BAA8B;IAC9B,wBAAwB;IACxB,gCAAgC;IAChC,OAAO;IACP,QAAQ;IACR,qBAAqB;IACrB,UAAU;IACV,WAAW;IACX,SAAS;IACT,gBAAgB;IAChB,KAAK;IACL,SAAS;CACV,CAAC;AAEF,0EAA0E;AAC1E,kBAAU,CAAC,IAAI,CACb,6BAA6B,EAC7B,YAAY,EACZ,WAAW,EACX,eAAe,EACf,gBAAgB,CACjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rollup-plugin-storybook-builder.d.ts","sourceRoot":"","sources":["../src/rollup-plugin-storybook-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAYrC,wBAAgB,4BAA4B,CAAC,gBAAgB,EAAE,OAAO,GAAG,MAAM,CA6C9E"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rollupPluginStorybookBuilder = void 0;
|
|
4
|
+
const generate_app_script_1 = require("./generate-app-script");
|
|
5
|
+
const generate_setup_addons_script_1 = require("./generate-setup-addons-script");
|
|
6
|
+
const generate_stories_script_1 = require("./generate-stories-script");
|
|
7
|
+
const inject_exports_order_1 = require("./inject-exports-order");
|
|
8
|
+
const list_stories_1 = require("./list-stories");
|
|
9
|
+
const virtual_file_names_1 = require("./virtual-file-names");
|
|
10
|
+
function rollupPluginStorybookBuilder(storybookOptions) {
|
|
11
|
+
let storyFilePaths;
|
|
12
|
+
return {
|
|
13
|
+
name: 'rollup-plugin-storybook-builder',
|
|
14
|
+
async buildStart() {
|
|
15
|
+
storyFilePaths = await (0, list_stories_1.listStories)(storybookOptions);
|
|
16
|
+
},
|
|
17
|
+
async resolveId(source) {
|
|
18
|
+
if (source === virtual_file_names_1.virtualAppFilename) {
|
|
19
|
+
return './' + source;
|
|
20
|
+
}
|
|
21
|
+
if (source === virtual_file_names_1.virtualSetupAddonsFilename) {
|
|
22
|
+
return './' + source;
|
|
23
|
+
}
|
|
24
|
+
if (source === virtual_file_names_1.virtualStoriesFilename) {
|
|
25
|
+
return './' + source;
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
async load(id) {
|
|
29
|
+
if (id.endsWith(virtual_file_names_1.virtualAppFilename)) {
|
|
30
|
+
return (0, generate_app_script_1.generateAppScript)(storybookOptions);
|
|
31
|
+
}
|
|
32
|
+
if (id.endsWith(virtual_file_names_1.virtualSetupAddonsFilename)) {
|
|
33
|
+
return (0, generate_setup_addons_script_1.generateSetupAddonsScript)();
|
|
34
|
+
}
|
|
35
|
+
if (id.endsWith(virtual_file_names_1.virtualStoriesFilename)) {
|
|
36
|
+
return (0, generate_stories_script_1.generateStoriesScript)(storybookOptions);
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
async transform(code, id) {
|
|
40
|
+
if (storyFilePaths.includes(id)) {
|
|
41
|
+
// inject story order
|
|
42
|
+
return (0, inject_exports_order_1.injectExportsOrder)(code, id);
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
exports.rollupPluginStorybookBuilder = rollupPluginStorybookBuilder;
|
|
48
|
+
//# sourceMappingURL=rollup-plugin-storybook-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rollup-plugin-storybook-builder.js","sourceRoot":"","sources":["../src/rollup-plugin-storybook-builder.ts"],"names":[],"mappings":";;;AAEA,+DAA0D;AAC1D,iFAA2E;AAC3E,uEAAkE;AAClE,iEAA4D;AAC5D,iDAA6C;AAC7C,6DAI8B;AAE9B,SAAgB,4BAA4B,CAAC,gBAAyB;IACpE,IAAI,cAAwB,CAAC;IAE7B,OAAO;QACL,IAAI,EAAE,iCAAiC;QAEvC,KAAK,CAAC,UAAU;YACd,cAAc,GAAG,MAAM,IAAA,0BAAW,EAAC,gBAAgB,CAAC,CAAC;QACvD,CAAC;QAED,KAAK,CAAC,SAAS,CAAC,MAAM;YACpB,IAAI,MAAM,KAAK,uCAAkB,EAAE;gBACjC,OAAO,IAAI,GAAG,MAAM,CAAC;aACtB;YAED,IAAI,MAAM,KAAK,+CAA0B,EAAE;gBACzC,OAAO,IAAI,GAAG,MAAM,CAAC;aACtB;YAED,IAAI,MAAM,KAAK,2CAAsB,EAAE;gBACrC,OAAO,IAAI,GAAG,MAAM,CAAC;aACtB;QACH,CAAC;QAED,KAAK,CAAC,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,CAAC,QAAQ,CAAC,uCAAkB,CAAC,EAAE;gBACnC,OAAO,IAAA,uCAAiB,EAAC,gBAAgB,CAAC,CAAC;aAC5C;YAED,IAAI,EAAE,CAAC,QAAQ,CAAC,+CAA0B,CAAC,EAAE;gBAC3C,OAAO,IAAA,wDAAyB,GAAE,CAAC;aACpC;YAED,IAAI,EAAE,CAAC,QAAQ,CAAC,2CAAsB,CAAC,EAAE;gBACvC,OAAO,IAAA,+CAAqB,EAAC,gBAAgB,CAAC,CAAC;aAChD;QACH,CAAC;QAED,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE;YACtB,IAAI,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE;gBAC/B,qBAAqB;gBACrB,OAAO,IAAA,yCAAkB,EAAC,IAAI,EAAE,EAAE,CAAC,CAAC;aACrC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AA7CD,oEA6CC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"virtual-file-names.d.ts","sourceRoot":"","sources":["../src/virtual-file-names.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB,QAAoB,CAAC;AACpD,eAAO,MAAM,0BAA0B,QAA6B,CAAC;AACrE,eAAO,MAAM,sBAAsB,QAAwB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.virtualStoriesFilename = exports.virtualSetupAddonsFilename = exports.virtualAppFilename = void 0;
|
|
4
|
+
// must be valid names (without \0) to let the transform logic work, specifically "rollup-plugin-external-globals"
|
|
5
|
+
// must have extension, otherwise "fromRollup" adapter will resolve it incorrectly as an "outside of root" dir
|
|
6
|
+
const PREFIX = 'virtual-web-storybook-builder-';
|
|
7
|
+
exports.virtualAppFilename = `${PREFIX}app.js`;
|
|
8
|
+
exports.virtualSetupAddonsFilename = `${PREFIX}setup-addons.js`;
|
|
9
|
+
exports.virtualStoriesFilename = `${PREFIX}stories.js`;
|
|
10
|
+
//# sourceMappingURL=virtual-file-names.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"virtual-file-names.js","sourceRoot":"","sources":["../src/virtual-file-names.ts"],"names":[],"mappings":";;;AAAA,kHAAkH;AAClH,8GAA8G;AAC9G,MAAM,MAAM,GAAG,gCAAgC,CAAC;AACnC,QAAA,kBAAkB,GAAG,GAAG,MAAM,QAAQ,CAAC;AACvC,QAAA,0BAA0B,GAAG,GAAG,MAAM,iBAAiB,CAAC;AACxD,QAAA,sBAAsB,GAAG,GAAG,MAAM,YAAY,CAAC"}
|
package/index.d.ts
ADDED
package/index.mjs
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@web/storybook-builder",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
7
|
+
"description": "Storybook builder powered by `@web/dev-server`",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/modernweb-dev/web.git",
|
|
12
|
+
"directory": "packages/storybook-builder"
|
|
13
|
+
},
|
|
14
|
+
"author": "modern-web",
|
|
15
|
+
"homepage": "https://github.com/modernweb-dev/web/tree/master/packages/storybook-builder",
|
|
16
|
+
"main": "dist/index.js",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"require": "./dist/index.js",
|
|
20
|
+
"import": "./index.mjs",
|
|
21
|
+
"types": "./index.d.ts"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=16.0.0"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsc"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"*.d.ts",
|
|
32
|
+
"*.js",
|
|
33
|
+
"*.mjs",
|
|
34
|
+
"CHANGELOG.md",
|
|
35
|
+
"dist",
|
|
36
|
+
"static",
|
|
37
|
+
"README.md"
|
|
38
|
+
],
|
|
39
|
+
"keywords": [
|
|
40
|
+
"storybook",
|
|
41
|
+
"web",
|
|
42
|
+
"dev",
|
|
43
|
+
"server",
|
|
44
|
+
"builder",
|
|
45
|
+
"es modules",
|
|
46
|
+
"modules",
|
|
47
|
+
"esm"
|
|
48
|
+
],
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@chialab/esbuild-plugin-commonjs": "^0.17.2",
|
|
51
|
+
"@rollup/plugin-node-resolve": "^15.1.0",
|
|
52
|
+
"@rollup/pluginutils": "^5.0.2",
|
|
53
|
+
"@storybook/core-common": "^7.0.0",
|
|
54
|
+
"@storybook/node-logger": "^7.0.0",
|
|
55
|
+
"@storybook/preview": "^7.0.0",
|
|
56
|
+
"@web/dev-server": "^0.3.0",
|
|
57
|
+
"@web/dev-server-core": "^0.5.2",
|
|
58
|
+
"@web/dev-server-rollup": "^0.5.2",
|
|
59
|
+
"@web/rollup-plugin-html": "^2.0.0",
|
|
60
|
+
"browser-assert": "^1.2.1",
|
|
61
|
+
"es-module-lexer": "^1.2.1",
|
|
62
|
+
"esbuild": "^0.17.19",
|
|
63
|
+
"express": "^4.18.2",
|
|
64
|
+
"fs-extra": "^11.1.1",
|
|
65
|
+
"glob-promise": "^6.0.3",
|
|
66
|
+
"lodash-es": "^4.17.21",
|
|
67
|
+
"path-browserify": "^1.0.1",
|
|
68
|
+
"rollup": "^3.25.1",
|
|
69
|
+
"rollup-plugin-external-globals": "^0.7.3",
|
|
70
|
+
"slash": "^5.1.0"
|
|
71
|
+
},
|
|
72
|
+
"devDependencies": {
|
|
73
|
+
"@storybook/types": "^7.0.0",
|
|
74
|
+
"@types/fs-extra": "^11.0.1",
|
|
75
|
+
"@typescript-eslint/eslint-plugin": "^5.3.0",
|
|
76
|
+
"@typescript-eslint/parser": "^5.3.0",
|
|
77
|
+
"conventional-changelog-cli": "^3.0.0",
|
|
78
|
+
"eslint": "^8.1.0",
|
|
79
|
+
"eslint-config-prettier": "^8.3.0",
|
|
80
|
+
"husky": "^8.0.1",
|
|
81
|
+
"lint-staged": "^13.0.3",
|
|
82
|
+
"prettier": "^2.4.1",
|
|
83
|
+
"prettier-plugin-package": "^1.3.0",
|
|
84
|
+
"typescript": "~5.0.4"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>Storybook</title>
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
|
+
|
|
8
|
+
<link
|
|
9
|
+
rel="prefetch"
|
|
10
|
+
href="./sb-common-assets/nunito-sans-regular.woff2"
|
|
11
|
+
as="font"
|
|
12
|
+
type="font/woff2"
|
|
13
|
+
crossorigin
|
|
14
|
+
/>
|
|
15
|
+
<link
|
|
16
|
+
rel="prefetch"
|
|
17
|
+
href="./sb-common-assets/nunito-sans-italic.woff2"
|
|
18
|
+
as="font"
|
|
19
|
+
type="font/woff2"
|
|
20
|
+
crossorigin
|
|
21
|
+
/>
|
|
22
|
+
<link
|
|
23
|
+
rel="prefetch"
|
|
24
|
+
href="./sb-common-assets/nunito-sans-bold.woff2"
|
|
25
|
+
as="font"
|
|
26
|
+
type="font/woff2"
|
|
27
|
+
crossorigin
|
|
28
|
+
/>
|
|
29
|
+
<link
|
|
30
|
+
rel="prefetch"
|
|
31
|
+
href="./sb-common-assets/nunito-sans-bold-italic.woff2"
|
|
32
|
+
as="font"
|
|
33
|
+
type="font/woff2"
|
|
34
|
+
crossorigin
|
|
35
|
+
/>
|
|
36
|
+
<link rel="stylesheet" href="./sb-common-assets/fonts.css" />
|
|
37
|
+
|
|
38
|
+
<script>
|
|
39
|
+
window.CONFIG_TYPE = '[CONFIG_TYPE HERE]';
|
|
40
|
+
window.LOGLEVEL = '[LOGLEVEL HERE]';
|
|
41
|
+
window.FRAMEWORK_OPTIONS = '[FRAMEWORK_OPTIONS HERE]';
|
|
42
|
+
window.CHANNEL_OPTIONS = '[CHANNEL_OPTIONS HERE]';
|
|
43
|
+
window.FEATURES = '[FEATURES HERE]';
|
|
44
|
+
window.STORIES = '[STORIES HERE]';
|
|
45
|
+
// window.DOCS_OPTIONS = '[DOCS_OPTIONS HERE]';
|
|
46
|
+
window.SERVER_CHANNEL_URL = '[SERVER_CHANNEL_URL HERE]';
|
|
47
|
+
|
|
48
|
+
// TODO: check if it's relevant for us
|
|
49
|
+
// We do this so that "module && module.hot" etc. in Storybook source code
|
|
50
|
+
// doesn't fail (it will simply be disabled)
|
|
51
|
+
window.module = undefined;
|
|
52
|
+
window.global = window;
|
|
53
|
+
</script>
|
|
54
|
+
<!-- [HEAD HTML SNIPPET HERE] -->
|
|
55
|
+
</head>
|
|
56
|
+
|
|
57
|
+
<body>
|
|
58
|
+
<!-- [BODY HTML SNIPPET HERE] -->
|
|
59
|
+
<div id="storybook-root"></div>
|
|
60
|
+
<div id="storybook-docs"></div>
|
|
61
|
+
<script type="module">
|
|
62
|
+
// must be inside a script to be externalized
|
|
63
|
+
import './sb-preview/runtime.js';
|
|
64
|
+
|
|
65
|
+
// must be inside a script to be resolved
|
|
66
|
+
import '[APP MODULE SRC HERE]';
|
|
67
|
+
</script>
|
|
68
|
+
</body>
|
|
69
|
+
</html>
|