storybook-builder-rsbuild 0.0.1-beta.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/LICENSE +21 -0
- package/README.md +11 -0
- package/dist/chunk-TTFRSOOU.mjs +34 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +627 -0
- package/dist/index.mjs +554 -0
- package/dist/loaders/export-order-loader.d.ts +2 -0
- package/dist/loaders/export-order-loader.js +72 -0
- package/dist/loaders/export-order-loader.mjs +41 -0
- package/dist/presets/custom-rsbuild-preset.d.ts +2 -0
- package/dist/presets/custom-rsbuild-preset.js +56 -0
- package/dist/presets/preview-preset.d.ts +2 -0
- package/dist/presets/preview-preset.js +427 -0
- package/dist/preview-preset.d.ts +2 -0
- package/dist/preview-preset.js +42 -0
- package/package.json +112 -0
- package/templates/preview.ejs +54 -0
- package/templates/virtualModuleModernEntry.js.handlebars +34 -0
- package/typings.d.ts +2 -0
@@ -0,0 +1,54 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8" />
|
5
|
+
<title><%= htmlWebpackPlugin.options.title || 'Storybook'%></title>
|
6
|
+
|
7
|
+
<% if (htmlWebpackPlugin.files.favicon) { %>
|
8
|
+
<link rel="shortcut icon" href="<%= htmlWebpackPlugin.files.favicon%>" />
|
9
|
+
<% } %>
|
10
|
+
|
11
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
12
|
+
|
13
|
+
<link rel="prefetch" href="./sb-common-assets/nunito-sans-regular.woff2" as="font" type="font/woff2" crossorigin />
|
14
|
+
<link rel="prefetch" href="./sb-common-assets/nunito-sans-italic.woff2" as="font" type="font/woff2" crossorigin />
|
15
|
+
<link rel="prefetch" href="./sb-common-assets/nunito-sans-bold.woff2" as="font" type="font/woff2" crossorigin />
|
16
|
+
<link rel="prefetch" href="./sb-common-assets/nunito-sans-bold-italic.woff2" as="font" type="font/woff2" crossorigin />
|
17
|
+
<link rel="stylesheet" href="./sb-common-assets/fonts.css" />
|
18
|
+
|
19
|
+
<% if (typeof headHtmlSnippet !== 'undefined') { %> <%= headHtmlSnippet %> <% } %> <%
|
20
|
+
htmlWebpackPlugin.files.css.forEach(file => { %>
|
21
|
+
<link href="<%= file %>" rel="stylesheet" />
|
22
|
+
<% }); %>
|
23
|
+
|
24
|
+
<style>
|
25
|
+
#storybook-root[hidden],
|
26
|
+
#storybook-docs[hidden] {
|
27
|
+
display: none !important;
|
28
|
+
}
|
29
|
+
</style>
|
30
|
+
</head>
|
31
|
+
<body>
|
32
|
+
<% if (typeof bodyHtmlSnippet !== 'undefined') { %> <%= bodyHtmlSnippet %> <% } %>
|
33
|
+
|
34
|
+
<div id="storybook-root"></div>
|
35
|
+
<div id="storybook-docs"></div>
|
36
|
+
|
37
|
+
<% if (typeof globals !== 'undefined' && Object.keys(globals).length) { %>
|
38
|
+
<script>
|
39
|
+
<% for (var varName in globals) { %>
|
40
|
+
<% if (globals[varName] != undefined) { %>
|
41
|
+
window['<%=varName%>'] = <%= JSON.stringify(globals[varName]) %>;
|
42
|
+
<% } %>
|
43
|
+
<% } %>
|
44
|
+
</script>
|
45
|
+
<% } %>
|
46
|
+
<script type="module">
|
47
|
+
import './sb-preview/runtime.js';
|
48
|
+
|
49
|
+
<% htmlWebpackPlugin.files.js.forEach(file => { %>
|
50
|
+
import './<%= file %>';
|
51
|
+
<% }); %>
|
52
|
+
</script>
|
53
|
+
</body>
|
54
|
+
</html>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import { global } from '@storybook/global';
|
2
|
+
|
3
|
+
import { ClientApi, PreviewWeb, addons, composeConfigs } from '@storybook/preview-api';
|
4
|
+
import { createBrowserChannel } from '@storybook/channels';
|
5
|
+
|
6
|
+
import { importFn } from './{{storiesFilename}}';
|
7
|
+
|
8
|
+
const getProjectAnnotations = () =>
|
9
|
+
composeConfigs([{{#each previewAnnotations}}require('{{this}}'),{{/each}}]);
|
10
|
+
|
11
|
+
const channel = createBrowserChannel({ page: 'preview' });
|
12
|
+
addons.setChannel(channel);
|
13
|
+
|
14
|
+
if (global.CONFIG_TYPE === 'DEVELOPMENT'){
|
15
|
+
window.__STORYBOOK_SERVER_CHANNEL__ = channel;
|
16
|
+
}
|
17
|
+
|
18
|
+
const preview = new PreviewWeb(importFn, getProjectAnnotations);
|
19
|
+
|
20
|
+
window.__STORYBOOK_PREVIEW__ = preview;
|
21
|
+
window.__STORYBOOK_STORY_STORE__ = preview.storyStore;
|
22
|
+
window.__STORYBOOK_ADDONS_CHANNEL__ = channel;
|
23
|
+
|
24
|
+
if (import.meta.webpackHot) {
|
25
|
+
import.meta.webpackHot.accept('./{{storiesFilename}}', () => {
|
26
|
+
// importFn has changed so we need to patch the new one in
|
27
|
+
preview.onStoriesChanged({ importFn });
|
28
|
+
});
|
29
|
+
|
30
|
+
import.meta.webpackHot.accept([{{#each previewAnnotations}}'{{this}}',{{/each}}], () => {
|
31
|
+
// getProjectAnnotations has changed so we need to patch the new one in
|
32
|
+
preview.onGetProjectAnnotationsChanged({ getProjectAnnotations });
|
33
|
+
});
|
34
|
+
}
|
package/typings.d.ts
ADDED