@web/storybook-builder 0.1.21 → 0.2.1
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 +12 -0
- package/dist/esbuild-plugin-commonjs-named-exports.d.ts.map +1 -1
- package/dist/esbuild-plugin-commonjs-named-exports.js +8 -5
- package/dist/esbuild-plugin-commonjs-named-exports.js.map +1 -1
- package/dist/generate-app-script.d.ts.map +1 -1
- package/dist/generate-app-script.js +7 -5
- package/dist/generate-app-script.js.map +1 -1
- package/dist/generate-iframe-html.d.ts.map +1 -1
- package/dist/generate-iframe-html.js +18 -8
- package/dist/generate-iframe-html.js.map +1 -1
- package/dist/generate-setup-addons-script.d.ts.map +1 -1
- package/dist/generate-setup-addons-script.js +6 -10
- package/dist/generate-setup-addons-script.js.map +1 -1
- package/dist/generate-stories-script.d.ts +0 -3
- package/dist/generate-stories-script.d.ts.map +1 -1
- package/dist/generate-stories-script.js +11 -40
- package/dist/generate-stories-script.js.map +1 -1
- package/dist/get-node-module-dir.js +2 -2
- package/dist/get-node-module-dir.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -35
- package/dist/index.js.map +1 -1
- package/dist/list-stories.d.ts.map +1 -1
- package/dist/list-stories.js +4 -6
- package/dist/list-stories.js.map +1 -1
- package/dist/rollup-plugin-mdx.d.ts +1 -1
- package/dist/rollup-plugin-mdx.d.ts.map +1 -1
- package/dist/rollup-plugin-mdx.js +21 -19
- package/dist/rollup-plugin-mdx.js.map +1 -1
- package/dist/rollup-plugin-prebundle-modules.d.ts +2 -1
- package/dist/rollup-plugin-prebundle-modules.d.ts.map +1 -1
- package/dist/rollup-plugin-prebundle-modules.js +47 -53
- package/dist/rollup-plugin-prebundle-modules.js.map +1 -1
- package/dist/rollup-plugin-storybook-builder.d.ts +1 -1
- package/dist/rollup-plugin-storybook-builder.d.ts.map +1 -1
- package/dist/rollup-plugin-storybook-builder.js +4 -4
- package/dist/rollup-plugin-storybook-builder.js.map +1 -1
- package/dist/stringify-process-envs.d.ts +2 -0
- package/dist/stringify-process-envs.d.ts.map +1 -0
- package/dist/stringify-process-envs.js +13 -0
- package/dist/stringify-process-envs.js.map +1 -0
- package/package.json +14 -14
- package/static/iframe-template.html +37 -36
package/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"esbuild-plugin-commonjs-named-exports.d.ts","sourceRoot":"","sources":["../src/esbuild-plugin-commonjs-named-exports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAItC,wBAAgB,iCAAiC,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"esbuild-plugin-commonjs-named-exports.d.ts","sourceRoot":"","sources":["../src/esbuild-plugin-commonjs-named-exports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAItC,wBAAgB,iCAAiC,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,CAwF3E"}
|
|
@@ -35,8 +35,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
35
35
|
};
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
37
|
exports.esbuildPluginCommonjsNamedExports = void 0;
|
|
38
|
-
const
|
|
39
|
-
const
|
|
38
|
+
const promises_1 = require("node:fs/promises");
|
|
39
|
+
const node_path_1 = require("node:path");
|
|
40
40
|
function esbuildPluginCommonjsNamedExports(modules) {
|
|
41
41
|
return {
|
|
42
42
|
name: 'commonjs-named-exports',
|
|
@@ -49,6 +49,9 @@ function esbuildPluginCommonjsNamedExports(modules) {
|
|
|
49
49
|
if ((_a = args.pluginData) === null || _a === void 0 ? void 0 : _a.preventInfiniteRecursion)
|
|
50
50
|
return;
|
|
51
51
|
const { path } = args, rest = __rest(args, ["path"]);
|
|
52
|
+
rest.kind = 'entry-point'; // forces resolution to the file path, because we need names for external modules too
|
|
53
|
+
rest.importer = '';
|
|
54
|
+
rest.namespace = '';
|
|
52
55
|
rest.pluginData = { preventInfiniteRecursion: true };
|
|
53
56
|
const resolveResult = await build.resolve(path, rest);
|
|
54
57
|
const resolvedPath = resolveResult.path;
|
|
@@ -85,11 +88,11 @@ function esbuildPluginCommonjsNamedExports(modules) {
|
|
|
85
88
|
const finalExports = ['default', ...filteredNamedExports];
|
|
86
89
|
return {
|
|
87
90
|
resolveDir,
|
|
88
|
-
contents: `export { ${finalExports.join(',')} } from './${slash((0,
|
|
91
|
+
contents: `export { ${finalExports.join(',')} } from './${slash((0, node_path_1.relative)(resolveDir, resolvedPath))}';`,
|
|
89
92
|
};
|
|
90
93
|
});
|
|
91
94
|
async function getNamedExports(path) {
|
|
92
|
-
const source = await (0,
|
|
95
|
+
const source = await (0, promises_1.readFile)(path, { encoding: 'utf8' });
|
|
93
96
|
let exports = [];
|
|
94
97
|
let reexports = [];
|
|
95
98
|
try {
|
|
@@ -99,7 +102,7 @@ function esbuildPluginCommonjsNamedExports(modules) {
|
|
|
99
102
|
// good place to start debugging if imports are not working
|
|
100
103
|
}
|
|
101
104
|
for (const reexport of reexports) {
|
|
102
|
-
const reexportPath = require.resolve(reexport, { paths: [(0,
|
|
105
|
+
const reexportPath = require.resolve(reexport, { paths: [(0, node_path_1.dirname)(path)] });
|
|
103
106
|
const deepExports = await getNamedExports(reexportPath);
|
|
104
107
|
for (const deepExport of deepExports) {
|
|
105
108
|
exports.push(deepExport);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"esbuild-plugin-commonjs-named-exports.js","sourceRoot":"","sources":["../src/esbuild-plugin-commonjs-named-exports.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA
|
|
1
|
+
{"version":3,"file":"esbuild-plugin-commonjs-named-exports.js","sourceRoot":"","sources":["../src/esbuild-plugin-commonjs-named-exports.ts"],"names":[],"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AAO,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;iBAC1C;gBAAC,OAAO,CAAC,EAAE;oBACV,2DAA2D;iBAC5D;gBAED,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE;oBAChC,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,IAAA,mBAAO,EAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;oBAC3E,MAAM,WAAW,GAAG,MAAM,eAAe,CAAC,YAAY,CAAC,CAAC;oBACxD,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;wBACpC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;qBAC1B;iBACF;gBAED,OAAO,OAAO,CAAC;YACjB,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAxFD,8EAwFC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-app-script.d.ts","sourceRoot":"","sources":["../src/generate-app-script.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAqB,MAAM,kBAAkB,CAAC;AAGnE,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"generate-app-script.d.ts","sourceRoot":"","sources":["../src/generate-app-script.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAqB,MAAM,kBAAkB,CAAC;AAGnE,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,OAAO,mBA0CvD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// based on https://github.com/storybookjs/storybook/blob/
|
|
2
|
+
// based on https://github.com/storybookjs/storybook/blob/v8.5.0/code/builders/builder-vite/src/codegen-modern-iframe-script.ts
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.generateAppScript = void 0;
|
|
5
5
|
const pluginutils_1 = require("@rollup/pluginutils");
|
|
@@ -26,17 +26,19 @@ ${previewAnnotationURLs
|
|
|
26
26
|
}
|
|
27
27
|
`.trim();
|
|
28
28
|
return `
|
|
29
|
-
import {
|
|
29
|
+
import { setup } from '@storybook/core/preview/runtime';
|
|
30
30
|
import '${virtual_file_names_js_1.virtualSetupAddonsFilename}';
|
|
31
|
+
|
|
32
|
+
setup();
|
|
33
|
+
|
|
34
|
+
import { composeConfigs, PreviewWeb, ClientApi } from '@storybook/preview-api';
|
|
31
35
|
import { importFn } from '${virtual_file_names_js_1.virtualStoriesFilename}';
|
|
32
36
|
|
|
33
37
|
${getPreviewAnnotationsFunction}
|
|
34
38
|
|
|
35
|
-
window.__STORYBOOK_PREVIEW__ = window.__STORYBOOK_PREVIEW__ || new PreviewWeb();
|
|
39
|
+
window.__STORYBOOK_PREVIEW__ = window.__STORYBOOK_PREVIEW__ || new PreviewWeb(importFn, getProjectAnnotations);
|
|
36
40
|
|
|
37
41
|
window.__STORYBOOK_STORY_STORE__ = window.__STORYBOOK_STORY_STORE__ || window.__STORYBOOK_PREVIEW__.storyStore;
|
|
38
|
-
window.__STORYBOOK_CLIENT_API__ = window.__STORYBOOK_CLIENT_API__ || new ClientApi({ storyStore: window.__STORYBOOK_PREVIEW__.storyStore });
|
|
39
|
-
window.__STORYBOOK_PREVIEW__.initialize({ importFn, getProjectAnnotations });
|
|
40
42
|
`.trim();
|
|
41
43
|
}
|
|
42
44
|
exports.generateAppScript = generateAppScript;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-app-script.js","sourceRoot":"","sources":["../src/generate-app-script.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"generate-app-script.js","sourceRoot":"","sources":["../src/generate-app-script.ts"],"names":[],"mappings":";AAAA,+HAA+H;;;AAE/H,qDAAoD;AACpD,wDAAiE;AAEjE,mEAA6F;AAEtF,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;SACpB,GAAG,CAAC,iBAAiB,CAAC,EAAE,CAAC,eAAe,IAAA,2BAAa,EAAC,iBAAiB,CAAC,IAAI,CAAC;SAC7E,IAAI,CAAC,KAAK,CAAC;;;;GAIX,CAAC,IAAI,EAAE,CAAC;IAET,OAAO;;UAEC,kDAA0B;;;;;4BAKR,8CAAsB;;EAEhD,6BAA6B;;;;;GAK5B,CAAC,IAAI,EAAE,CAAC;AACX,CAAC;AA1CD,8CA0CC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-iframe-html.d.ts","sourceRoot":"","sources":["../src/generate-iframe-html.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate-iframe-html.d.ts","sourceRoot":"","sources":["../src/generate-iframe-html.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAe,OAAO,EAAe,MAAM,kBAAkB,CAAC;AAI1E,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,SAAS,CAAC;AAE7C,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CA4C1E"}
|
|
@@ -1,34 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// based on https://github.com/storybookjs/storybook/blob/v8.5.0/code/builders/builder-vite/src/transform-iframe-html.ts
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.generateIframeHtml = void 0;
|
|
4
5
|
const core_common_1 = require("@storybook/core-common");
|
|
5
|
-
const
|
|
6
|
+
const promises_1 = require("node:fs/promises");
|
|
6
7
|
const virtual_file_names_js_1 = require("./virtual-file-names.js");
|
|
7
8
|
async function generateIframeHtml(options) {
|
|
8
|
-
|
|
9
|
-
const
|
|
9
|
+
var _a;
|
|
10
|
+
const iframeHtmlTemplate = await (0, promises_1.readFile)(require.resolve('../static/iframe-template.html'), {
|
|
11
|
+
encoding: 'utf-8',
|
|
12
|
+
});
|
|
13
|
+
const { configType, features, presets } = options;
|
|
14
|
+
const build = await presets.apply('build');
|
|
10
15
|
const frameworkOptions = await presets.apply('frameworkOptions');
|
|
11
16
|
const headHtmlSnippet = await presets.apply('previewHead');
|
|
12
17
|
const bodyHtmlSnippet = await presets.apply('previewBody');
|
|
13
18
|
const logLevel = await presets.apply('logLevel', undefined);
|
|
14
|
-
|
|
19
|
+
const docsOptions = await presets.apply('docs');
|
|
20
|
+
const tagsOptions = await presets.apply('tags');
|
|
15
21
|
const coreOptions = await presets.apply('core');
|
|
16
22
|
const stories = (0, core_common_1.normalizeStories)(await options.presets.apply('stories', [], options), {
|
|
17
23
|
configDir: options.configDir,
|
|
18
24
|
workingDir: process.cwd(),
|
|
19
25
|
}).map(specifier => (Object.assign(Object.assign({}, specifier), { importPathMatcher: specifier.importPathMatcher.source })));
|
|
20
|
-
|
|
26
|
+
const otherGlobals = Object.assign({}, (((_a = build === null || build === void 0 ? void 0 : build.test) === null || _a === void 0 ? void 0 : _a.disableBlocks) ? { __STORYBOOK_BLOCKS_EMPTY_MODULE__: {} } : {}));
|
|
27
|
+
return iframeHtmlTemplate
|
|
21
28
|
.replace('[CONFIG_TYPE HERE]', configType || '')
|
|
22
29
|
.replace('[LOGLEVEL HERE]', logLevel || '')
|
|
23
30
|
.replace(`'[FRAMEWORK_OPTIONS HERE]'`, JSON.stringify(frameworkOptions))
|
|
31
|
+
.replace(`('OTHER_GLOBLALS HERE');`, Object.entries(otherGlobals)
|
|
32
|
+
.map(([k, v]) => `window["${k}"] = ${JSON.stringify(v)};`)
|
|
33
|
+
.join(''))
|
|
24
34
|
.replace(`'[CHANNEL_OPTIONS HERE]'`, JSON.stringify(coreOptions && coreOptions.channelOptions ? coreOptions.channelOptions : {}))
|
|
25
35
|
.replace(`'[FEATURES HERE]'`, JSON.stringify(features || {}))
|
|
26
36
|
.replace(`'[STORIES HERE]'`, JSON.stringify(stories || {}))
|
|
27
|
-
|
|
28
|
-
.replace(`'[
|
|
37
|
+
.replace(`'[DOCS_OPTIONS HERE]'`, JSON.stringify(docsOptions || {}))
|
|
38
|
+
.replace(`'[TAGS_OPTIONS HERE]'`, JSON.stringify(tagsOptions || {}))
|
|
29
39
|
.replace('<!-- [HEAD HTML SNIPPET HERE] -->', headHtmlSnippet || '')
|
|
30
40
|
.replace('<!-- [BODY HTML SNIPPET HERE] -->', bodyHtmlSnippet || '')
|
|
31
|
-
.replace(`[APP MODULE SRC HERE]`, virtual_file_names_js_1.virtualAppFilename)
|
|
41
|
+
.replace(`[APP MODULE SRC HERE]`, virtual_file_names_js_1.virtualAppFilename);
|
|
32
42
|
}
|
|
33
43
|
exports.generateIframeHtml = generateIframeHtml;
|
|
34
44
|
//# sourceMappingURL=generate-iframe-html.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-iframe-html.js","sourceRoot":"","sources":["../src/generate-iframe-html.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate-iframe-html.js","sourceRoot":"","sources":["../src/generate-iframe-html.ts"],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AAE,eAAe,IAAI,EAAE,CAAC;SACnE,OAAO,CAAC,mCAAmC,EAAE,eAAe,IAAI,EAAE,CAAC;SACnE,OAAO,CAAC,uBAAuB,EAAE,0CAAkB,CAAC,CAAC;AAC1D,CAAC;AA5CD,gDA4CC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-setup-addons-script.d.ts","sourceRoot":"","sources":["../src/generate-setup-addons-script.ts"],"names":[],"mappings":"AAEA,wBAAsB,yBAAyB,
|
|
1
|
+
{"version":3,"file":"generate-setup-addons-script.d.ts","sourceRoot":"","sources":["../src/generate-setup-addons-script.ts"],"names":[],"mappings":"AAEA,wBAAsB,yBAAyB,oBAa9C"}
|
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// based on https://github.com/storybookjs/storybook/blob/
|
|
2
|
+
// based on https://github.com/storybookjs/storybook/blob/v8.5.0/code/builders/builder-vite/src/codegen-set-addon-channel.ts
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.generateSetupAddonsScript = void 0;
|
|
5
5
|
async function generateSetupAddonsScript() {
|
|
6
6
|
return `
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { addons } from '@storybook/preview-api';
|
|
7
|
+
import { createBrowserChannel } from 'storybook/internal/channels';
|
|
8
|
+
import { addons } from 'storybook/internal/preview-api';
|
|
10
9
|
|
|
11
|
-
const channel =
|
|
10
|
+
const channel = createBrowserChannel({ page: 'preview' });
|
|
12
11
|
addons.setChannel(channel);
|
|
13
12
|
window.__STORYBOOK_ADDONS_CHANNEL__ = channel;
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const serverChannel = createWebSocketChannel({ url: SERVER_CHANNEL_URL });
|
|
18
|
-
addons.setServerChannel(serverChannel);
|
|
19
|
-
window.__STORYBOOK_SERVER_CHANNEL__ = serverChannel;
|
|
14
|
+
if (window.CONFIG_TYPE === 'DEVELOPMENT'){
|
|
15
|
+
window.__STORYBOOK_SERVER_CHANNEL__ = channel;
|
|
20
16
|
}
|
|
21
17
|
`.trim();
|
|
22
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-setup-addons-script.js","sourceRoot":"","sources":["../src/generate-setup-addons-script.ts"],"names":[],"mappings":";AAAA,
|
|
1
|
+
{"version":3,"file":"generate-setup-addons-script.js","sourceRoot":"","sources":["../src/generate-setup-addons-script.ts"],"names":[],"mappings":";AAAA,4HAA4H;;;AAErH,KAAK,UAAU,yBAAyB;IAC7C,OAAO;;;;;;;;;;;GAWN,CAAC,IAAI,EAAE,CAAC;AACX,CAAC;AAbD,8DAaC"}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
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
2
|
export declare function generateStoriesScript(options: Options): Promise<string>;
|
|
6
3
|
//# sourceMappingURL=generate-stories-script.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-stories-script.d.ts","sourceRoot":"","sources":["../src/generate-stories-script.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate-stories-script.d.ts","sourceRoot":"","sources":["../src/generate-stories-script.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAIhD,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAM7E"}
|
|
@@ -1,58 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// based on https://github.com/storybookjs/storybook/blob/
|
|
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
|
-
};
|
|
2
|
+
// based on https://github.com/storybookjs/storybook/blob/v8.5.0/code/builders/builder-vite/src/codegen-importfn-script.ts
|
|
26
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
4
|
exports.generateStoriesScript = void 0;
|
|
28
5
|
const pluginutils_1 = require("@rollup/pluginutils");
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const list_stories_js_1 = require("./list-stories.js");
|
|
32
|
-
/**
|
|
33
|
-
* This file is largely based on https://github.com/storybookjs/storybook/blob/d1195cbd0c61687f1720fefdb772e2f490a46584/lib/core-common/src/utils/to-importFn.ts
|
|
34
|
-
*/
|
|
6
|
+
const node_path_1 = require("node:path");
|
|
7
|
+
const list_stories_1 = require("./list-stories");
|
|
35
8
|
async function generateStoriesScript(options) {
|
|
36
9
|
// First we need to get an array of stories and their absolute paths.
|
|
37
|
-
const stories = await (0,
|
|
10
|
+
const stories = await (0, list_stories_1.listStories)(options);
|
|
38
11
|
// We can then call toImportFn to create a function that can be used to load each story dynamically.
|
|
39
|
-
return
|
|
12
|
+
return await toImportFn(stories);
|
|
40
13
|
}
|
|
41
14
|
exports.generateStoriesScript = generateStoriesScript;
|
|
42
15
|
/**
|
|
43
16
|
* 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
|
|
45
|
-
* to delay loading
|
|
46
|
-
* function
|
|
17
|
+
* to the working directory and their dynamic imports. The import is done in an asynchronous
|
|
18
|
+
* function to delay loading and to allow rollup to split the code into smaller chunks. It then
|
|
19
|
+
* creates a function, `importFn(path)`, which resolves a path to an import function and this is
|
|
20
|
+
* called by Storybook to fetch a story dynamically when needed.
|
|
21
|
+
*
|
|
47
22
|
* @param stories An array of absolute story paths.
|
|
48
23
|
*/
|
|
49
24
|
async function toImportFn(stories) {
|
|
50
25
|
const objectEntries = stories.map(file => {
|
|
51
|
-
const
|
|
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
|
-
}
|
|
26
|
+
const relativePath = (0, pluginutils_1.normalizePath)((0, node_path_1.relative)(process.cwd(), file));
|
|
56
27
|
const importPath = toImportPath(relativePath);
|
|
57
28
|
let actualPath = file;
|
|
58
29
|
if (actualPath.endsWith('.mdx')) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-stories-script.js","sourceRoot":"","sources":["../src/generate-stories-script.ts"],"names":[],"mappings":";AAAA,
|
|
1
|
+
{"version":3,"file":"generate-stories-script.js","sourceRoot":"","sources":["../src/generate-stories-script.ts"],"names":[],"mappings":";AAAA,0HAA0H;;;AAE1H,qDAAoD;AAEpD,yCAAqC;AACrC,iDAA6C;AAEtC,KAAK,UAAU,qBAAqB,CAAC,OAAgB;IAC1D,qEAAqE;IACrE,MAAM,OAAO,GAAG,MAAM,IAAA,0BAAW,EAAC,OAAO,CAAC,CAAC;IAE3C,oGAAoG;IACpG,OAAO,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;AACnC,CAAC;AAND,sDAMC;AAED;;;;;;;;GAQG;AACH,KAAK,UAAU,UAAU,CAAC,OAAiB;IACzC,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QACvC,MAAM,YAAY,GAAG,IAAA,2BAAa,EAAC,IAAA,oBAAQ,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;QAClE,MAAM,UAAU,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC;QAC9C,IAAI,UAAU,GAAG,IAAI,CAAC;QACtB,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;YAC/B,UAAU,GAAG,GAAG,UAAU,KAAK,CAAC;SACjC;QAED,OAAO,MAAM,UAAU,oBAAoB,UAAU,IAAI,CAAC;IAC5D,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"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getNodeModuleDir = void 0;
|
|
4
|
-
const
|
|
4
|
+
const node_path_1 = require("node:path");
|
|
5
5
|
function getNodeModuleDir(moduleName) {
|
|
6
|
-
return (0,
|
|
6
|
+
return (0, node_path_1.dirname)(require.resolve(`${moduleName}/package.json`));
|
|
7
7
|
}
|
|
8
8
|
exports.getNodeModuleDir = getNodeModuleDir;
|
|
9
9
|
//# sourceMappingURL=get-node-module-dir.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-node-module-dir.js","sourceRoot":"","sources":["../src/get-node-module-dir.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"get-node-module-dir.js","sourceRoot":"","sources":["../src/get-node-module-dir.ts"],"names":[],"mappings":";;;AAAA,yCAAoC;AAEpC,SAAgB,gBAAgB,CAAC,UAAkB;IACjD,OAAO,IAAA,mBAAO,EAAC,OAAO,CAAC,OAAO,CAAC,GAAG,UAAU,eAAe,CAAC,CAAC,CAAC;AAChE,CAAC;AAFD,4CAEC"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,IAAI,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACjG,OAAO,EAAE,eAAe,EAAgC,MAAM,iBAAiB,CAAC;AAMhF,OAAO,EAA8B,aAAa,EAAU,MAAM,QAAQ,CAAC;AAoB3E,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,CAwFrC,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,UAAU,CAAC,OAAO,CAuErC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,33 +1,11 @@
|
|
|
1
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
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
4
|
};
|
|
28
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
6
|
exports.build = exports.start = exports.bail = void 0;
|
|
30
7
|
const plugin_node_resolve_1 = __importDefault(require("@rollup/plugin-node-resolve"));
|
|
8
|
+
const plugin_replace_1 = __importDefault(require("@rollup/plugin-replace"));
|
|
31
9
|
const core_common_1 = require("@storybook/core-common");
|
|
32
10
|
const node_logger_1 = require("@storybook/node-logger");
|
|
33
11
|
// Import both globals and globalsNameReferenceMap to prevent retrocompatibility.
|
|
@@ -36,20 +14,22 @@ const globals_1 = require("@storybook/preview/globals");
|
|
|
36
14
|
const dev_server_1 = require("@web/dev-server");
|
|
37
15
|
const dev_server_rollup_1 = require("@web/dev-server-rollup");
|
|
38
16
|
const rollup_plugin_html_1 = require("@web/rollup-plugin-html");
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const path_1 = require("path");
|
|
17
|
+
const promises_1 = require("node:fs/promises");
|
|
18
|
+
const node_path_1 = require("node:path");
|
|
42
19
|
const rollup_1 = require("rollup");
|
|
43
20
|
const rollup_plugin_external_globals_1 = __importDefault(require("rollup-plugin-external-globals"));
|
|
21
|
+
const sirv_1 = __importDefault(require("sirv"));
|
|
44
22
|
const generate_iframe_html_js_1 = require("./generate-iframe-html.js");
|
|
45
23
|
const get_node_module_dir_js_1 = require("./get-node-module-dir.js");
|
|
46
24
|
const read_file_config_js_1 = require("./read-file-config.js");
|
|
47
25
|
const rollup_plugin_mdx_js_1 = require("./rollup-plugin-mdx.js");
|
|
48
26
|
const rollup_plugin_prebundle_modules_js_1 = require("./rollup-plugin-prebundle-modules.js");
|
|
49
27
|
const rollup_plugin_storybook_builder_js_1 = require("./rollup-plugin-storybook-builder.js");
|
|
28
|
+
const stringify_process_envs_js_1 = require("./stringify-process-envs.js");
|
|
50
29
|
const wdsPluginExternalGlobals = (0, dev_server_rollup_1.fromRollup)(rollup_plugin_external_globals_1.default);
|
|
51
30
|
const wdsPluginMdx = (0, dev_server_rollup_1.fromRollup)(rollup_plugin_mdx_js_1.rollupPluginMdx);
|
|
52
31
|
const wdsPluginPrebundleModules = (0, dev_server_rollup_1.fromRollup)(rollup_plugin_prebundle_modules_js_1.rollupPluginPrebundleModules);
|
|
32
|
+
const wdsPluginReplace = (0, dev_server_rollup_1.fromRollup)(plugin_replace_1.default);
|
|
53
33
|
const wdsPluginStorybookBuilder = (0, dev_server_rollup_1.fromRollup)(rollup_plugin_storybook_builder_js_1.rollupPluginStorybookBuilder);
|
|
54
34
|
let wdsServer;
|
|
55
35
|
const bail = async () => {
|
|
@@ -57,9 +37,13 @@ const bail = async () => {
|
|
|
57
37
|
};
|
|
58
38
|
exports.bail = bail;
|
|
59
39
|
const start = async ({ startTime, options, router, server }) => {
|
|
60
|
-
const previewDirOrigin = (0,
|
|
61
|
-
router.use('/sb-preview',
|
|
62
|
-
|
|
40
|
+
const previewDirOrigin = (0, node_path_1.join)((0, get_node_module_dir_js_1.getNodeModuleDir)('@storybook/core'), 'dist', 'preview');
|
|
41
|
+
router.use('/sb-preview', (0, sirv_1.default)(previewDirOrigin, {
|
|
42
|
+
maxAge: 300000,
|
|
43
|
+
dev: true,
|
|
44
|
+
immutable: true,
|
|
45
|
+
}));
|
|
46
|
+
router.use(`/${rollup_plugin_prebundle_modules_js_1.PREBUNDLED_MODULES_DIR}`, (0, sirv_1.default)((0, node_path_1.resolve)(`./${rollup_plugin_prebundle_modules_js_1.PREBUNDLED_MODULES_DIR}`), { dev: true }));
|
|
63
47
|
const env = await options.presets.apply('env');
|
|
64
48
|
const wdsStorybookConfig = {
|
|
65
49
|
nodeResolve: true,
|
|
@@ -73,10 +57,11 @@ const start = async ({ startTime, options, router, server }) => {
|
|
|
73
57
|
}
|
|
74
58
|
},
|
|
75
59
|
},
|
|
76
|
-
wdsPluginPrebundleModules(env),
|
|
60
|
+
wdsPluginPrebundleModules(env, options),
|
|
77
61
|
wdsPluginStorybookBuilder(options),
|
|
78
62
|
wdsPluginMdx(options),
|
|
79
63
|
wdsPluginExternalGlobals(globals_1.globalsNameReferenceMap || globals_1.globals),
|
|
64
|
+
wdsPluginReplace(Object.assign(Object.assign({}, (0, stringify_process_envs_js_1.stringifyProcessEnvs)(env)), { include: ['**/node_modules/@storybook/**/*'], preventAssignment: true })),
|
|
80
65
|
],
|
|
81
66
|
};
|
|
82
67
|
const { wdsConfigPath } = await (0, core_common_1.getBuilderOptions)(options);
|
|
@@ -132,10 +117,11 @@ const build = async ({ startTime, options }) => {
|
|
|
132
117
|
externalAssets: 'sb-common-assets/**',
|
|
133
118
|
}),
|
|
134
119
|
(0, plugin_node_resolve_1.default)(),
|
|
135
|
-
(0, rollup_plugin_prebundle_modules_js_1.rollupPluginPrebundleModules)(env),
|
|
120
|
+
(0, rollup_plugin_prebundle_modules_js_1.rollupPluginPrebundleModules)(env, options),
|
|
136
121
|
(0, rollup_plugin_storybook_builder_js_1.rollupPluginStorybookBuilder)(options),
|
|
137
122
|
(0, rollup_plugin_mdx_js_1.rollupPluginMdx)(options),
|
|
138
123
|
(0, rollup_plugin_external_globals_1.default)(globals_1.globalsNameReferenceMap || globals_1.globals),
|
|
124
|
+
(0, plugin_replace_1.default)(Object.assign(Object.assign({}, (0, stringify_process_envs_js_1.stringifyProcessEnvs)(env)), { include: ['**/node_modules/@storybook/**/*'], preventAssignment: true })),
|
|
139
125
|
],
|
|
140
126
|
};
|
|
141
127
|
const rollupFinalConfig = await options.presets.apply('rollupFinal', rollupStorybookConfig, options);
|
|
@@ -160,16 +146,17 @@ const build = async ({ startTime, options }) => {
|
|
|
160
146
|
}
|
|
161
147
|
node_logger_1.logger.trace({ message: '=> Preview built', time: process.hrtime(startTime) });
|
|
162
148
|
})();
|
|
163
|
-
const previewDirOrigin = (0,
|
|
164
|
-
const previewDirTarget = (0,
|
|
165
|
-
const previewFiles =
|
|
149
|
+
const previewDirOrigin = (0, node_path_1.join)((0, get_node_module_dir_js_1.getNodeModuleDir)('@storybook/core'), 'dist', 'preview');
|
|
150
|
+
const previewDirTarget = (0, node_path_1.join)(options.outputDir || '', `sb-preview`);
|
|
151
|
+
const previewFiles = (0, promises_1.cp)(previewDirOrigin, previewDirTarget, {
|
|
166
152
|
filter: src => {
|
|
167
|
-
const { ext } = (0,
|
|
153
|
+
const { ext } = (0, node_path_1.parse)(src);
|
|
168
154
|
if (ext) {
|
|
169
155
|
return ext === '.js';
|
|
170
156
|
}
|
|
171
157
|
return true;
|
|
172
158
|
},
|
|
159
|
+
recursive: true,
|
|
173
160
|
});
|
|
174
161
|
await Promise.all([rollupBuild, previewFiles]);
|
|
175
162
|
};
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,sFAAkE;AAClE,4EAAyD;AACzD,wDAA2D;AAC3D,wDAAgD;AAChD,iFAAiF;AACjF,aAAa;AACb,wDAA8E;AAE9E,gDAAgF;AAEhF,8DAAoD;AACpD,gEAA2D;AAC3D,+CAAsC;AACtC,yCAAiD;AACjD,mCAA2E;AAC3E,oGAAyE;AACzE,gDAAwB;AACxB,uEAA+D;AAC/D,qEAA4D;AAC5D,+DAAuD;AACvD,iEAAyD;AACzD,6FAG8C;AAC9C,6FAAoF;AACpF,2EAAmE;AAEnE,MAAM,wBAAwB,GAAG,IAAA,8BAAU,EAAC,wCAA2B,CAAC,CAAC;AACzE,MAAM,YAAY,GAAG,IAAA,8BAAU,EAAC,sCAAe,CAAC,CAAC;AACjD,MAAM,yBAAyB,GAAG,IAAA,8BAAU,EAAC,iEAA4B,CAAC,CAAC;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B,GAAG,IAAA,gBAAI,EAAC,IAAA,yCAAgB,EAAC,iBAAiB,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IACtF,MAAM,gBAAgB,GAAG,IAAA,gBAAI,EAAC,OAAO,CAAC,SAAS,IAAI,EAAE,EAAE,YAAY,CAAC,CAAC;IACrE,MAAM,YAAY,GAAG,IAAA,aAAE,EAAC,gBAAgB,EAAE,gBAAgB,EAAE;QAC1D,MAAM,EAAE,GAAG,CAAC,EAAE;YACZ,MAAM,EAAE,GAAG,EAAE,GAAG,IAAA,iBAAK,EAAC,GAAG,CAAC,CAAC;YAC3B,IAAI,GAAG,EAAE;gBACP,OAAO,GAAG,KAAK,KAAK,CAAC;aACtB;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,SAAS,EAAE,IAAI;KAChB,CAAC,CAAC;IAEH,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC;AACjD,CAAC,CAAC;AAvEW,QAAA,KAAK,SAuEhB"}
|
|
@@ -1 +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,
|
|
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,qBAgBjD"}
|
package/dist/list-stories.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// based on https://github.com/storybookjs/storybook/blob/
|
|
2
|
+
// based on https://github.com/storybookjs/storybook/blob/v8.5.0/code/builders/builder-vite/src/list-stories.ts
|
|
3
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
4
|
if (k2 === undefined) k2 = k;
|
|
5
5
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -27,17 +27,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
27
27
|
exports.listStories = void 0;
|
|
28
28
|
const core_common_1 = require("@storybook/core-common");
|
|
29
29
|
const glob_promise_1 = require("glob-promise");
|
|
30
|
-
const
|
|
30
|
+
const node_path_1 = require("node:path");
|
|
31
31
|
async function listStories(options) {
|
|
32
32
|
const slash = (await Promise.resolve().then(() => __importStar(require('slash')))).default; // for CJS compatibility
|
|
33
33
|
return (await Promise.all((0, core_common_1.normalizeStories)(await options.presets.apply('stories', [], options), {
|
|
34
34
|
configDir: options.configDir,
|
|
35
35
|
workingDir: options.configDir,
|
|
36
36
|
}).map(({ directory, files }) => {
|
|
37
|
-
const pattern =
|
|
38
|
-
const absolutePattern =
|
|
39
|
-
? pattern
|
|
40
|
-
: path.join(options.configDir, pattern);
|
|
37
|
+
const pattern = (0, node_path_1.join)(directory, files);
|
|
38
|
+
const absolutePattern = (0, node_path_1.isAbsolute)(pattern) ? pattern : (0, node_path_1.join)(options.configDir, pattern);
|
|
41
39
|
return (0, glob_promise_1.promise)(slash(absolutePattern), { follow: true });
|
|
42
40
|
}))).reduce((carry, stories) => carry.concat(stories), []);
|
|
43
41
|
}
|
package/dist/list-stories.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-stories.js","sourceRoot":"","sources":["../src/list-stories.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"list-stories.js","sourceRoot":"","sources":["../src/list-stories.ts"],"names":[],"mappings":";AAAA,+GAA+G;;;;;;;;;;;;;;;;;;;;;;;;;;AAE/G,wDAA0D;AAE1D,+CAA+C;AAC/C,yCAA6C;AAEtC,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,IAAA,gBAAI,EAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QACvC,MAAM,eAAe,GAAG,IAAA,sBAAU,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAA,gBAAI,EAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAEzF,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;AAhBD,kCAgBC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Options } from '@storybook/types';
|
|
2
2
|
import type { Plugin } from 'rollup';
|
|
3
|
-
export declare function rollupPluginMdx(
|
|
3
|
+
export declare function rollupPluginMdx(options: Options): Plugin;
|
|
4
4
|
//# sourceMappingURL=rollup-plugin-mdx.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup-plugin-mdx.d.ts","sourceRoot":"","sources":["../src/rollup-plugin-mdx.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAKhD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,wBAAgB,eAAe,CAAC,
|
|
1
|
+
{"version":3,"file":"rollup-plugin-mdx.d.ts","sourceRoot":"","sources":["../src/rollup-plugin-mdx.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAKhD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAqDxD"}
|
|
@@ -4,18 +4,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.rollupPluginMdx = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
function rollupPluginMdx(
|
|
7
|
+
const mdx_1 = require("@mdx-js/mdx");
|
|
8
|
+
const promises_1 = require("node:fs/promises");
|
|
9
|
+
const node_path_1 = require("node:path");
|
|
10
|
+
const rehype_external_links_1 = __importDefault(require("rehype-external-links"));
|
|
11
|
+
const rehype_slug_1 = __importDefault(require("rehype-slug"));
|
|
12
|
+
function rollupPluginMdx(options) {
|
|
13
13
|
let mdxPluginOptions;
|
|
14
14
|
let jsxOptions;
|
|
15
15
|
return {
|
|
16
16
|
name: 'rollup-plugin-mdx',
|
|
17
17
|
async buildStart() {
|
|
18
|
-
({ mdxPluginOptions, jsxOptions } = await
|
|
18
|
+
({ mdxPluginOptions, jsxOptions } = await options.presets.apply('options', {}));
|
|
19
19
|
},
|
|
20
20
|
async resolveId(id) {
|
|
21
21
|
if (id.endsWith('.mdx.js')) {
|
|
@@ -27,18 +27,20 @@ function rollupPluginMdx(storybookOptions) {
|
|
|
27
27
|
if (!id.endsWith('.mdx.js'))
|
|
28
28
|
return;
|
|
29
29
|
const mdxPath = id.replace(/\.js$/, '');
|
|
30
|
-
const mdxCode = await (0,
|
|
31
|
-
const mdxLoaderOptions = await
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
30
|
+
const mdxCode = await (0, promises_1.readFile)(mdxPath.split('/').join(node_path_1.sep), { encoding: 'utf8' });
|
|
31
|
+
const mdxLoaderOptions = await options.presets.apply('mdxLoaderOptions', Object.assign(Object.assign({}, mdxPluginOptions), { mdxCompileOptions: Object.assign(Object.assign({
|
|
32
|
+
// this is done by Storybook in 3 different places:
|
|
33
|
+
// 1. addon-essentials preset (not working for users who install addon-docs directly without addon-essentials)
|
|
34
|
+
// 2. addon-docs vite plugin (not run for our builder, because it's in the builder-vite hook)
|
|
35
|
+
// 3. addon-docs webpack loader (not run for our builder, because it's in the builder-webpack hook)
|
|
36
|
+
// so we need to duplicate same logic here
|
|
37
|
+
providerImportSource: (0, node_path_1.join)((0, node_path_1.dirname)(require.resolve('@storybook/addon-docs/package.json')), '/dist/shims/mdx-react-shim.mjs') }, mdxPluginOptions === null || mdxPluginOptions === void 0 ? void 0 : mdxPluginOptions.mdxCompileOptions), { rehypePlugins: [
|
|
38
|
+
...((_b = (_a = mdxPluginOptions === null || mdxPluginOptions === void 0 ? void 0 : mdxPluginOptions.mdxCompileOptions) === null || _a === void 0 ? void 0 : _a.rehypePlugins) !== null && _b !== void 0 ? _b : []),
|
|
39
|
+
rehype_slug_1.default,
|
|
40
|
+
rehype_external_links_1.default,
|
|
41
|
+
] }), jsxOptions }));
|
|
42
|
+
const mdxResult = await (0, mdx_1.compile)(mdxCode, mdxLoaderOptions.mdxCompileOptions);
|
|
43
|
+
return mdxResult.toString();
|
|
42
44
|
},
|
|
43
45
|
};
|
|
44
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup-plugin-mdx.js","sourceRoot":"","sources":["../src/rollup-plugin-mdx.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"rollup-plugin-mdx.js","sourceRoot":"","sources":["../src/rollup-plugin-mdx.ts"],"names":[],"mappings":";;;;;;AAAA,qCAAsC;AAEtC,+CAA4C;AAC5C,yCAA+C;AAC/C,kFAAwD;AACxD,8DAAqC;AAGrC,SAAgB,eAAe,CAAC,OAAgB;IAC9C,IAAI,gBAAqC,CAAC;IAC1C,IAAI,UAA+B,CAAC;IAEpC,OAAO;QACL,IAAI,EAAE,mBAAmB;QAEzB,KAAK,CAAC,UAAU;YACd,CAAC,EAAE,gBAAgB,EAAE,UAAU,EAAE,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,CAC7D,SAAS,EACT,EAAE,CACH,CAAC,CAAC;QACL,CAAC;QAED,KAAK,CAAC,SAAS,CAAC,EAAE;YAChB,IAAI,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;gBAC1B,OAAO,EAAE,CAAC;aACX;QACH,CAAC;QAED,KAAK,CAAC,IAAI,CAAC,EAAU;;YACnB,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC;gBAAE,OAAO;YAEpC,MAAM,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YACxC,MAAM,OAAO,GAAG,MAAM,IAAA,mBAAQ,EAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,eAAG,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;YAEnF,MAAM,gBAAgB,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,kBAAkB,kCAClE,gBAAgB,KACnB,iBAAiB;oBACf,mDAAmD;oBACnD,8GAA8G;oBAC9G,6FAA6F;oBAC7F,mGAAmG;oBACnG,0CAA0C;oBAC1C,oBAAoB,EAAE,IAAA,gBAAI,EACxB,IAAA,mBAAO,EAAC,OAAO,CAAC,OAAO,CAAC,oCAAoC,CAAC,CAAC,EAC9D,gCAAgC,CACjC,IACE,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,iBAAiB,KACtC,aAAa,EAAE;wBACb,GAAG,CAAC,MAAA,MAAA,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,iBAAiB,0CAAE,aAAa,mCAAI,EAAE,CAAC;wBAC7D,qBAAU;wBACV,+BAAmB;qBACpB,KAEH,UAAU,IACV,CAAC;YAEH,MAAM,SAAS,GAAG,MAAM,IAAA,aAAO,EAAC,OAAO,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;YAE7E,OAAO,SAAS,CAAC,QAAQ,EAAE,CAAC;QAC9B,CAAC;KACF,CAAC;AACJ,CAAC;AArDD,0CAqDC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { Options } from '@storybook/types';
|
|
1
2
|
import type { Plugin } from 'rollup';
|
|
2
3
|
export declare const PREBUNDLED_MODULES_DIR: string;
|
|
3
|
-
export declare function rollupPluginPrebundleModules(env: Record<string, string
|
|
4
|
+
export declare function rollupPluginPrebundleModules(env: Record<string, string>, options: Options): Plugin;
|
|
4
5
|
export declare const CANDIDATES: string[];
|
|
5
6
|
//# sourceMappingURL=rollup-plugin-prebundle-modules.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup-plugin-prebundle-modules.d.ts","sourceRoot":"","sources":["../src/rollup-plugin-prebundle-modules.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rollup-plugin-prebundle-modules.d.ts","sourceRoot":"","sources":["../src/rollup-plugin-prebundle-modules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAIhD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIrC,eAAO,MAAM,sBAAsB,QAAgD,CAAC;AAEpF,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC3B,OAAO,EAAE,OAAO,GACf,MAAM,CA2CR;AAKD,eAAO,MAAM,UAAU,UAqBtB,CAAC"}
|
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CANDIDATES = exports.rollupPluginPrebundleModules = exports.PREBUNDLED_MODULES_DIR = void 0;
|
|
4
|
-
const core_common_1 = require("@storybook/core-common");
|
|
5
4
|
const esbuild_1 = require("esbuild");
|
|
6
|
-
const
|
|
7
|
-
const
|
|
5
|
+
const promises_1 = require("node:fs/promises");
|
|
6
|
+
const node_path_1 = require("node:path");
|
|
8
7
|
const esbuild_plugin_commonjs_named_exports_js_1 = require("./esbuild-plugin-commonjs-named-exports.js");
|
|
9
|
-
const
|
|
10
|
-
exports.PREBUNDLED_MODULES_DIR = (0,
|
|
11
|
-
function rollupPluginPrebundleModules(env) {
|
|
8
|
+
const stringify_process_envs_js_1 = require("./stringify-process-envs.js");
|
|
9
|
+
exports.PREBUNDLED_MODULES_DIR = (0, node_path_1.normalize)('node_modules/.prebundled_modules');
|
|
10
|
+
function rollupPluginPrebundleModules(env, options) {
|
|
12
11
|
const modulePaths = {};
|
|
13
12
|
return {
|
|
14
13
|
name: 'rollup-plugin-prebundle-modules',
|
|
15
14
|
async buildStart() {
|
|
16
15
|
const modules = exports.CANDIDATES.filter(moduleExists);
|
|
17
|
-
const modulesDir = (0,
|
|
18
|
-
await (0,
|
|
16
|
+
const modulesDir = (0, node_path_1.join)(process.cwd(), exports.PREBUNDLED_MODULES_DIR);
|
|
17
|
+
await (0, promises_1.rm)(modulesDir, { recursive: true, force: true });
|
|
19
18
|
for (const module of modules) {
|
|
20
|
-
modulePaths[module] = (0,
|
|
19
|
+
modulePaths[module] = (0, node_path_1.join)(modulesDir, module.endsWith('.js') ? module.replace(/\.js$/, '.mjs') : `${module}.mjs`);
|
|
21
20
|
}
|
|
22
21
|
await (0, esbuild_1.build)({
|
|
23
22
|
entryPoints: modules,
|
|
@@ -27,23 +26,12 @@ function rollupPluginPrebundleModules(env) {
|
|
|
27
26
|
format: 'esm',
|
|
28
27
|
splitting: true,
|
|
29
28
|
sourcemap: true,
|
|
30
|
-
alias: Object.assign({
|
|
31
|
-
'@storybook/react-dom-shim': getReactDomShimAlias(),
|
|
29
|
+
alias: Object.assign({}, (moduleExists('@storybook/react-dom-shim') && {
|
|
30
|
+
'@storybook/react-dom-shim': await getReactDomShimAlias(options),
|
|
32
31
|
})),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
// see more https://github.com/nodejs/node/issues/38128#issuecomment-814969356
|
|
37
|
-
delete define['process.env.NODE_PATH'];
|
|
38
|
-
return define;
|
|
39
|
-
})(),
|
|
40
|
-
plugins: [
|
|
41
|
-
(0, esbuild_plugin_commonjs_named_exports_js_1.esbuildPluginCommonjsNamedExports)(modules.filter(module =>
|
|
42
|
-
// lodash is solved by the lodash-es alias
|
|
43
|
-
!module.startsWith('lodash/') &&
|
|
44
|
-
// @storybook/react-dom-shim is just an alias to an ESM module
|
|
45
|
-
module !== '@storybook/react-dom-shim')),
|
|
46
|
-
],
|
|
32
|
+
external: [...modules],
|
|
33
|
+
define: (0, stringify_process_envs_js_1.stringifyProcessEnvs)(env),
|
|
34
|
+
plugins: [(0, esbuild_plugin_commonjs_named_exports_js_1.esbuildPluginCommonjsNamedExports)(modules)],
|
|
47
35
|
});
|
|
48
36
|
},
|
|
49
37
|
async resolveId(source) {
|
|
@@ -52,45 +40,27 @@ function rollupPluginPrebundleModules(env) {
|
|
|
52
40
|
};
|
|
53
41
|
}
|
|
54
42
|
exports.rollupPluginPrebundleModules = rollupPluginPrebundleModules;
|
|
55
|
-
// this is different to https://github.com/storybookjs/storybook/blob/
|
|
43
|
+
// this is different to https://github.com/storybookjs/storybook/blob/v8.5.0/code/builders/builder-vite/src/optimizeDeps.ts
|
|
56
44
|
// builder-vite bundles different dependencies for performance reasons
|
|
57
45
|
// we aim only at browserifying NodeJS dependencies (CommonJS/process.env/...)
|
|
58
46
|
exports.CANDIDATES = [
|
|
59
47
|
/* for different addons built with React and for MDX */
|
|
60
|
-
'@storybook/react-dom-shim',
|
|
61
48
|
'react',
|
|
62
|
-
|
|
49
|
+
'react/jsx-runtime',
|
|
50
|
+
'react/jsx-dev-runtime',
|
|
63
51
|
'react-dom',
|
|
52
|
+
'react-dom/client',
|
|
64
53
|
/* for different packages */
|
|
65
|
-
'tiny-invariant',
|
|
66
|
-
/* for @storybook/addon-interactions */
|
|
67
|
-
'jest-mock',
|
|
68
|
-
// @testing-library has ESM, but imports/exports are not working correctly between packages
|
|
69
|
-
// specifically "@testing-library/user-event" has "dist/esm/utils/misc/getWindow.js" (see https://cdn.jsdelivr.net/npm/@testing-library/user-event@14.4.3/dist/esm/utils/misc/getWindow.js)
|
|
70
|
-
// which uses "@testing-library/dom" in `import { getWindowFromNode } from '@testing-library/dom/dist/helpers.js';`
|
|
71
|
-
// which doesn't get resolved to "@testing-library/dom" ESM "dom.esm.js" (see https://cdn.jsdelivr.net/npm/@testing-library/dom@9.3.1/dist/@testing-library/dom.esm.js)
|
|
72
|
-
// and instead gets resolved to "@testing-library/dom" CommonJS "dist/helpers.js" (see https://cdn.jsdelivr.net/npm/@testing-library/dom@9.3.1/dist/helpers.js)
|
|
73
|
-
'@testing-library/dom',
|
|
74
|
-
'@testing-library/user-event',
|
|
75
|
-
/* for @storybook/addon-docs */
|
|
76
|
-
'color-convert',
|
|
77
|
-
'doctrine',
|
|
78
|
-
'lodash/cloneDeep.js',
|
|
79
|
-
'lodash/mapValues.js',
|
|
80
|
-
'lodash/pickBy.js',
|
|
81
|
-
'lodash/throttle.js',
|
|
82
|
-
'lodash/uniq.js',
|
|
83
54
|
'memoizerific',
|
|
84
|
-
'
|
|
55
|
+
'tiny-invariant',
|
|
56
|
+
/* for @storybook/core */
|
|
57
|
+
'jsdoc-type-pratt-parser',
|
|
85
58
|
/* for @storybook/addon-a11y */
|
|
86
59
|
'axe-core',
|
|
60
|
+
'vitest-axe/matchers',
|
|
61
|
+
/* for @storybook/addon-docs */
|
|
62
|
+
'color-convert',
|
|
87
63
|
];
|
|
88
|
-
function getReactDomShimAlias() {
|
|
89
|
-
const { version } = require('react-dom');
|
|
90
|
-
return version.startsWith('18')
|
|
91
|
-
? require.resolve('@storybook/react-dom-shim/dist/react-18').replace(/\.js$/, '.mjs')
|
|
92
|
-
: require.resolve('@storybook/react-dom-shim').replace(/\.js$/, '.mjs');
|
|
93
|
-
}
|
|
94
64
|
function moduleExists(moduleName) {
|
|
95
65
|
try {
|
|
96
66
|
require.resolve(moduleName, { paths: [process.cwd()] });
|
|
@@ -100,4 +70,28 @@ function moduleExists(moduleName) {
|
|
|
100
70
|
return false;
|
|
101
71
|
}
|
|
102
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Get react-dom version from the resolvedReact preset, which points to either a root react-dom
|
|
75
|
+
* dependency or the react-dom dependency shipped with addon-docs
|
|
76
|
+
*/
|
|
77
|
+
async function getIsReactVersion18or19(options) {
|
|
78
|
+
const { legacyRootApi } = (await options.presets.apply('frameworkOptions')) || {};
|
|
79
|
+
if (legacyRootApi) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
const resolvedReact = await options.presets.apply('resolvedReact', {});
|
|
83
|
+
const reactDom = resolvedReact.reactDom || (0, node_path_1.dirname)(require.resolve('react-dom/package.json'));
|
|
84
|
+
if (!(0, node_path_1.isAbsolute)(reactDom)) {
|
|
85
|
+
// if react-dom is not resolved to a file we can't be sure if the version in package.json is correct or even if package.json exists
|
|
86
|
+
// this happens when react-dom is resolved to 'preact/compat' for example
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
const { version } = JSON.parse(await (0, promises_1.readFile)((0, node_path_1.join)(reactDom, 'package.json'), 'utf-8'));
|
|
90
|
+
return version.startsWith('18') || version.startsWith('19') || version.startsWith('0.0.0');
|
|
91
|
+
}
|
|
92
|
+
async function getReactDomShimAlias(options) {
|
|
93
|
+
return (await getIsReactVersion18or19(options))
|
|
94
|
+
? require.resolve('@storybook/react-dom-shim')
|
|
95
|
+
: require.resolve('@storybook/react-dom-shim/dist/react-16');
|
|
96
|
+
}
|
|
103
97
|
//# sourceMappingURL=rollup-plugin-prebundle-modules.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup-plugin-prebundle-modules.js","sourceRoot":"","sources":["../src/rollup-plugin-prebundle-modules.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"rollup-plugin-prebundle-modules.js","sourceRoot":"","sources":["../src/rollup-plugin-prebundle-modules.ts"],"names":[],"mappings":";;;AACA,qCAAgC;AAChC,+CAAgD;AAChD,yCAAiE;AAEjE,yGAA+F;AAC/F,2EAAmE;AAEtD,QAAA,sBAAsB,GAAG,IAAA,qBAAS,EAAC,kCAAkC,CAAC,CAAC;AAEpF,SAAgB,4BAA4B,CAC1C,GAA2B,EAC3B,OAAgB;IAEhB,MAAM,WAAW,GAA2B,EAAE,CAAC;IAE/C,OAAO;QACL,IAAI,EAAE,iCAAiC;QAEvC,KAAK,CAAC,UAAU;YACd,MAAM,OAAO,GAAG,kBAAU,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YAEhD,MAAM,UAAU,GAAG,IAAA,gBAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,8BAAsB,CAAC,CAAC;YAC/D,MAAM,IAAA,aAAE,EAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YAEvD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;gBAC5B,WAAW,CAAC,MAAM,CAAC,GAAG,IAAA,gBAAI,EACxB,UAAU,EACV,MAAM,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AAC;AACjE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Options } from '@storybook/types';
|
|
2
2
|
import type { Plugin } from 'rollup';
|
|
3
|
-
export declare function rollupPluginStorybookBuilder(
|
|
3
|
+
export declare function rollupPluginStorybookBuilder(options: Options): Plugin;
|
|
4
4
|
//# sourceMappingURL=rollup-plugin-storybook-builder.d.ts.map
|
|
@@ -1 +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,
|
|
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,OAAO,EAAE,OAAO,GAAG,MAAM,CA6CrE"}
|
|
@@ -7,12 +7,12 @@ const generate_stories_script_js_1 = require("./generate-stories-script.js");
|
|
|
7
7
|
const inject_exports_order_js_1 = require("./inject-exports-order.js");
|
|
8
8
|
const list_stories_js_1 = require("./list-stories.js");
|
|
9
9
|
const virtual_file_names_js_1 = require("./virtual-file-names.js");
|
|
10
|
-
function rollupPluginStorybookBuilder(
|
|
10
|
+
function rollupPluginStorybookBuilder(options) {
|
|
11
11
|
let storyFilePaths;
|
|
12
12
|
return {
|
|
13
13
|
name: 'rollup-plugin-storybook-builder',
|
|
14
14
|
async buildStart() {
|
|
15
|
-
storyFilePaths = await (0, list_stories_js_1.listStories)(
|
|
15
|
+
storyFilePaths = await (0, list_stories_js_1.listStories)(options);
|
|
16
16
|
},
|
|
17
17
|
async resolveId(source) {
|
|
18
18
|
if (source === virtual_file_names_js_1.virtualAppFilename) {
|
|
@@ -27,13 +27,13 @@ function rollupPluginStorybookBuilder(storybookOptions) {
|
|
|
27
27
|
},
|
|
28
28
|
async load(id) {
|
|
29
29
|
if (id.endsWith(virtual_file_names_js_1.virtualAppFilename)) {
|
|
30
|
-
return (0, generate_app_script_js_1.generateAppScript)(
|
|
30
|
+
return (0, generate_app_script_js_1.generateAppScript)(options);
|
|
31
31
|
}
|
|
32
32
|
if (id.endsWith(virtual_file_names_js_1.virtualSetupAddonsFilename)) {
|
|
33
33
|
return (0, generate_setup_addons_script_js_1.generateSetupAddonsScript)();
|
|
34
34
|
}
|
|
35
35
|
if (id.endsWith(virtual_file_names_js_1.virtualStoriesFilename)) {
|
|
36
|
-
return (0, generate_stories_script_js_1.generateStoriesScript)(
|
|
36
|
+
return (0, generate_stories_script_js_1.generateStoriesScript)(options);
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
async transform(code, id) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup-plugin-storybook-builder.js","sourceRoot":"","sources":["../src/rollup-plugin-storybook-builder.ts"],"names":[],"mappings":";;;AAEA,qEAA6D;AAC7D,uFAA8E;AAC9E,6EAAqE;AACrE,uEAA+D;AAC/D,uDAAgD;AAChD,mEAIiC;AAEjC,SAAgB,4BAA4B,CAAC,
|
|
1
|
+
{"version":3,"file":"rollup-plugin-storybook-builder.js","sourceRoot":"","sources":["../src/rollup-plugin-storybook-builder.ts"],"names":[],"mappings":";;;AAEA,qEAA6D;AAC7D,uFAA8E;AAC9E,6EAAqE;AACrE,uEAA+D;AAC/D,uDAAgD;AAChD,mEAIiC;AAEjC,SAAgB,4BAA4B,CAAC,OAAgB;IAC3D,IAAI,cAAwB,CAAC;IAE7B,OAAO;QACL,IAAI,EAAE,iCAAiC;QAEvC,KAAK,CAAC,UAAU;YACd,cAAc,GAAG,MAAM,IAAA,6BAAW,EAAC,OAAO,CAAC,CAAC;QAC9C,CAAC;QAED,KAAK,CAAC,SAAS,CAAC,MAAM;YACpB,IAAI,MAAM,KAAK,0CAAkB,EAAE;gBACjC,OAAO,IAAI,GAAG,MAAM,CAAC;aACtB;YAED,IAAI,MAAM,KAAK,kDAA0B,EAAE;gBACzC,OAAO,IAAI,GAAG,MAAM,CAAC;aACtB;YAED,IAAI,MAAM,KAAK,8CAAsB,EAAE;gBACrC,OAAO,IAAI,GAAG,MAAM,CAAC;aACtB;QACH,CAAC;QAED,KAAK,CAAC,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,CAAC,QAAQ,CAAC,0CAAkB,CAAC,EAAE;gBACnC,OAAO,IAAA,0CAAiB,EAAC,OAAO,CAAC,CAAC;aACnC;YAED,IAAI,EAAE,CAAC,QAAQ,CAAC,kDAA0B,CAAC,EAAE;gBAC3C,OAAO,IAAA,2DAAyB,GAAE,CAAC;aACpC;YAED,IAAI,EAAE,CAAC,QAAQ,CAAC,8CAAsB,CAAC,EAAE;gBACvC,OAAO,IAAA,kDAAqB,EAAC,OAAO,CAAC,CAAC;aACvC;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,4CAAkB,EAAC,IAAI,EAAE,EAAE,CAAC,CAAC;aACrC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AA7CD,oEA6CC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stringify-process-envs.d.ts","sourceRoot":"","sources":["../src/stringify-process-envs.ts"],"names":[],"mappings":"AAEA,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,0BAQ/D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stringifyProcessEnvs = void 0;
|
|
4
|
+
const core_common_1 = require("@storybook/core-common");
|
|
5
|
+
function stringifyProcessEnvs(env) {
|
|
6
|
+
const result = (0, core_common_1.stringifyProcessEnvs)(env);
|
|
7
|
+
// "NODE_PATH" pollutes the output, it's not really used and is not recommended in general
|
|
8
|
+
// see more https://github.com/nodejs/node/issues/38128#issuecomment-814969356
|
|
9
|
+
delete result['process.env.NODE_PATH'];
|
|
10
|
+
return result;
|
|
11
|
+
}
|
|
12
|
+
exports.stringifyProcessEnvs = stringifyProcessEnvs;
|
|
13
|
+
//# sourceMappingURL=stringify-process-envs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stringify-process-envs.js","sourceRoot":"","sources":["../src/stringify-process-envs.ts"],"names":[],"mappings":";;;AAAA,wDAA+F;AAE/F,SAAgB,oBAAoB,CAAC,GAA2B;IAC9D,MAAM,MAAM,GAAG,IAAA,kCAA6B,EAAC,GAAG,CAAC,CAAC;IAElD,0FAA0F;IAC1F,8EAA8E;IAC9E,OAAO,MAAM,CAAC,uBAAuB,CAAC,CAAC;IAEvC,OAAO,MAAM,CAAC;AAChB,CAAC;AARD,oDAQC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@web/storybook-builder",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
"main": "dist/index.js",
|
|
17
17
|
"exports": {
|
|
18
18
|
".": {
|
|
19
|
+
"types": "./index.d.ts",
|
|
19
20
|
"require": "./dist/index.js",
|
|
20
|
-
"import": "./index.mjs"
|
|
21
|
-
"types": "./index.d.ts"
|
|
21
|
+
"import": "./index.mjs"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"engines": {
|
|
25
|
-
"node": ">=
|
|
25
|
+
"node": ">=18.0.0"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"build": "tsc"
|
|
@@ -47,12 +47,13 @@
|
|
|
47
47
|
"esm"
|
|
48
48
|
],
|
|
49
49
|
"dependencies": {
|
|
50
|
+
"@mdx-js/mdx": "^3.0.0",
|
|
50
51
|
"@rollup/plugin-node-resolve": "^15.1.0",
|
|
52
|
+
"@rollup/plugin-replace": "^6.0.2",
|
|
51
53
|
"@rollup/pluginutils": "^5.0.2",
|
|
52
|
-
"@storybook/core-common": "^
|
|
53
|
-
"@storybook/
|
|
54
|
-
"@storybook/
|
|
55
|
-
"@storybook/preview": "^7.0.0",
|
|
54
|
+
"@storybook/core-common": "^8.5.0",
|
|
55
|
+
"@storybook/node-logger": "^8.5.0",
|
|
56
|
+
"@storybook/preview": "^8.5.0",
|
|
56
57
|
"@web/config-loader": "^0.3.2",
|
|
57
58
|
"@web/dev-server": "^0.4.0",
|
|
58
59
|
"@web/dev-server-core": "^0.7.5",
|
|
@@ -61,19 +62,18 @@
|
|
|
61
62
|
"browser-assert": "^1.2.1",
|
|
62
63
|
"cjs-module-lexer": "^1.2.3",
|
|
63
64
|
"es-module-lexer": "^1.2.1",
|
|
64
|
-
"esbuild": "^0.
|
|
65
|
-
"express": "^4.21.2",
|
|
66
|
-
"fs-extra": "^11.1.1",
|
|
65
|
+
"esbuild": "^0.25.0",
|
|
67
66
|
"glob-promise": "^6.0.3",
|
|
68
67
|
"lodash-es": "^4.17.21",
|
|
69
68
|
"path-browserify": "^1.0.1",
|
|
70
|
-
"
|
|
71
|
-
"
|
|
69
|
+
"rehype-external-links": "^3.0.0",
|
|
70
|
+
"rehype-slug": "^6.0.0",
|
|
72
71
|
"rollup": "^4.4.1",
|
|
73
72
|
"rollup-plugin-external-globals": "^0.9.0",
|
|
73
|
+
"sirv": "^2.0.4",
|
|
74
74
|
"slash": "^5.1.0"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@storybook/types": "^
|
|
77
|
+
"@storybook/types": "^8.5.0"
|
|
78
78
|
}
|
|
79
79
|
}
|
|
@@ -1,39 +1,44 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
|
+
<!--suppress HtmlUnknownTarget -->
|
|
2
3
|
<html lang="en">
|
|
3
4
|
<head>
|
|
4
5
|
<meta charset="utf-8" />
|
|
5
6
|
<title>Storybook</title>
|
|
6
7
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
8
|
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
9
|
+
<style>
|
|
10
|
+
@font-face {
|
|
11
|
+
font-family: 'Nunito Sans';
|
|
12
|
+
font-style: normal;
|
|
13
|
+
font-weight: 400;
|
|
14
|
+
font-display: swap;
|
|
15
|
+
src: url('./sb-common-assets/nunito-sans-regular.woff2') format('woff2');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@font-face {
|
|
19
|
+
font-family: 'Nunito Sans';
|
|
20
|
+
font-style: italic;
|
|
21
|
+
font-weight: 400;
|
|
22
|
+
font-display: swap;
|
|
23
|
+
src: url('./sb-common-assets/nunito-sans-italic.woff2') format('woff2');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@font-face {
|
|
27
|
+
font-family: 'Nunito Sans';
|
|
28
|
+
font-style: normal;
|
|
29
|
+
font-weight: 700;
|
|
30
|
+
font-display: swap;
|
|
31
|
+
src: url('./sb-common-assets/nunito-sans-bold.woff2') format('woff2');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@font-face {
|
|
35
|
+
font-family: 'Nunito Sans';
|
|
36
|
+
font-style: italic;
|
|
37
|
+
font-weight: 700;
|
|
38
|
+
font-display: swap;
|
|
39
|
+
src: url('./sb-common-assets/nunito-sans-bold-italic.woff2') format('woff2');
|
|
40
|
+
}
|
|
41
|
+
</style>
|
|
37
42
|
|
|
38
43
|
<script>
|
|
39
44
|
window.CONFIG_TYPE = '[CONFIG_TYPE HERE]';
|
|
@@ -42,14 +47,10 @@
|
|
|
42
47
|
window.CHANNEL_OPTIONS = '[CHANNEL_OPTIONS HERE]';
|
|
43
48
|
window.FEATURES = '[FEATURES HERE]';
|
|
44
49
|
window.STORIES = '[STORIES HERE]';
|
|
45
|
-
|
|
46
|
-
window.
|
|
50
|
+
window.DOCS_OPTIONS = '[DOCS_OPTIONS HERE]';
|
|
51
|
+
window.TAGS_OPTIONS = '[TAGS_OPTIONS HERE]';
|
|
47
52
|
|
|
48
|
-
|
|
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
|
+
('OTHER_GLOBLALS HERE');
|
|
53
54
|
</script>
|
|
54
55
|
<!-- [HEAD HTML SNIPPET HERE] -->
|
|
55
56
|
</head>
|