@storybook/core-server 6.5.7 → 7.0.0-alpha.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/README.md +0 -1
- package/dist/cjs/build-dev.js +55 -140
- package/dist/cjs/build-static.js +45 -75
- package/dist/cjs/dev-server.js +10 -7
- package/dist/cjs/presets/babel-cache-preset.js +2 -4
- package/dist/cjs/presets/common-preset.js +32 -16
- package/dist/cjs/standalone.js +9 -1
- package/dist/cjs/utils/StoryIndexGenerator.js +16 -4
- package/dist/cjs/utils/{get-manager-builder.js → get-builders.js} +31 -25
- package/dist/esm/build-dev.js +53 -130
- package/dist/esm/build-static.js +40 -64
- package/dist/esm/dev-server.js +10 -6
- package/dist/esm/presets/babel-cache-preset.js +1 -2
- package/dist/esm/presets/common-preset.js +24 -15
- package/dist/esm/standalone.js +8 -1
- package/dist/esm/utils/StoryIndexGenerator.js +17 -5
- package/dist/esm/utils/get-builders.js +36 -0
- package/dist/types/build-dev.d.ts +2 -0
- package/dist/{ts3.9 → types}/build-static.d.ts +0 -1
- package/dist/{ts3.9 → types}/dev-server.d.ts +0 -0
- package/dist/{ts3.9 → types}/index.d.ts +0 -0
- package/dist/types/presets/babel-cache-preset.d.ts +1 -0
- package/dist/{ts3.4 → types}/presets/common-preset.d.ts +29 -31
- package/dist/{ts3.9 → types}/standalone.d.ts +0 -0
- package/dist/{ts3.9 → types}/utils/StoryIndexGenerator.d.ts +4 -1
- package/dist/{ts3.9 → types}/utils/__mockdata__/E.stories.d.ts +0 -0
- package/dist/{ts3.9 → types}/utils/__mockdata__/deeply/nested/single/File.stories.d.ts +0 -0
- package/dist/{ts3.9 → types}/utils/__mockdata__/src/B.stories.d.ts +0 -0
- package/dist/{ts3.9 → types}/utils/__mockdata__/src/NoMeta.stories.d.ts +0 -0
- package/dist/{ts3.9 → types}/utils/__mockdata__/src/nested/Button.d.ts +0 -0
- package/dist/{ts3.9 → types}/utils/__mockdata__/src/nested/Button.stories.d.ts +0 -0
- package/dist/{ts3.9 → types}/utils/__mockdata__/src/second-nested/G.stories.d.ts +0 -0
- package/dist/{ts3.9 → types}/utils/copy-all-static-files.d.ts +0 -0
- package/dist/types/utils/get-builders.d.ts +2 -0
- package/dist/{ts3.9 → types}/utils/get-server-channel.d.ts +0 -0
- package/dist/{ts3.9 → types}/utils/metadata.d.ts +0 -0
- package/dist/{ts3.9 → types}/utils/middleware.d.ts +0 -0
- package/dist/{ts3.9 → types}/utils/open-in-browser.d.ts +0 -0
- package/dist/{ts3.9 → types}/utils/output-startup-information.d.ts +0 -0
- package/dist/{ts3.4 → types}/utils/output-stats.d.ts +3 -3
- package/dist/{ts3.9 → types}/utils/release-notes.d.ts +0 -0
- package/dist/{ts3.9 → types}/utils/server-address.d.ts +0 -0
- package/dist/{ts3.9 → types}/utils/server-init.d.ts +0 -0
- package/dist/{ts3.9 → types}/utils/server-statics.d.ts +0 -0
- package/dist/{ts3.9 → types}/utils/stories-json.d.ts +0 -0
- package/dist/{ts3.9 → types}/utils/update-check.d.ts +0 -0
- package/dist/{ts3.9 → types}/utils/watch-story-specifiers.d.ts +0 -0
- package/package.json +14 -23
- package/dist/cjs/cli/dev.js +0 -63
- package/dist/cjs/cli/index.js +0 -31
- package/dist/cjs/cli/prod.js +0 -43
- package/dist/cjs/cli/utils.js +0 -63
- package/dist/cjs/utils/get-preview-builder.js +0 -47
- package/dist/esm/cli/dev.js +0 -44
- package/dist/esm/cli/index.js +0 -2
- package/dist/esm/cli/prod.js +0 -26
- package/dist/esm/cli/utils.js +0 -48
- package/dist/esm/utils/get-manager-builder.js +0 -26
- package/dist/esm/utils/get-preview-builder.js +0 -28
- package/dist/modern/build-dev.js +0 -232
- package/dist/modern/build-static.js +0 -237
- package/dist/modern/cli/dev.js +0 -44
- package/dist/modern/cli/index.js +0 -2
- package/dist/modern/cli/prod.js +0 -26
- package/dist/modern/cli/utils.js +0 -48
- package/dist/modern/dev-server.js +0 -200
- package/dist/modern/index.js +0 -4
- package/dist/modern/presets/babel-cache-preset.js +0 -18
- package/dist/modern/presets/common-preset.js +0 -124
- package/dist/modern/standalone.js +0 -30
- package/dist/modern/utils/StoryIndexGenerator.js +0 -222
- package/dist/modern/utils/__mockdata__/E.stories.js +0 -5
- package/dist/modern/utils/__mockdata__/deeply/nested/single/File.stories.js +0 -4
- package/dist/modern/utils/__mockdata__/preview.js +0 -1
- package/dist/modern/utils/__mockdata__/src/A.stories.js +0 -5
- package/dist/modern/utils/__mockdata__/src/B.stories.js +0 -5
- package/dist/modern/utils/__mockdata__/src/C.js +0 -1
- package/dist/modern/utils/__mockdata__/src/D.stories.js +0 -5
- package/dist/modern/utils/__mockdata__/src/NoMeta.stories.js +0 -4
- package/dist/modern/utils/__mockdata__/src/first-nested/deeply/F.stories.js +0 -5
- package/dist/modern/utils/__mockdata__/src/nested/Button.js +0 -1
- package/dist/modern/utils/__mockdata__/src/nested/Button.stories.js +0 -5
- package/dist/modern/utils/__mockdata__/src/second-nested/G.stories.js +0 -5
- package/dist/modern/utils/copy-all-static-files.js +0 -62
- package/dist/modern/utils/get-manager-builder.js +0 -26
- package/dist/modern/utils/get-preview-builder.js +0 -28
- package/dist/modern/utils/get-server-channel.js +0 -39
- package/dist/modern/utils/metadata.js +0 -14
- package/dist/modern/utils/middleware.js +0 -27
- package/dist/modern/utils/open-in-browser.js +0 -26
- package/dist/modern/utils/output-startup-information.js +0 -54
- package/dist/modern/utils/output-stats.js +0 -37
- package/dist/modern/utils/release-notes.js +0 -63
- package/dist/modern/utils/server-address.js +0 -20
- package/dist/modern/utils/server-init.js +0 -29
- package/dist/modern/utils/server-statics.js +0 -97
- package/dist/modern/utils/stories-json.js +0 -42
- package/dist/modern/utils/update-check.js +0 -65
- package/dist/modern/utils/watch-story-specifiers.js +0 -99
- package/dist/ts3.4/build-dev.d.ts +0 -3
- package/dist/ts3.4/build-static.d.ts +0 -3
- package/dist/ts3.4/cli/dev.d.ts +0 -6
- package/dist/ts3.4/cli/index.d.ts +0 -2
- package/dist/ts3.4/cli/prod.d.ts +0 -7
- package/dist/ts3.4/cli/utils.d.ts +0 -5
- package/dist/ts3.4/dev-server.d.ts +0 -24
- package/dist/ts3.4/index.d.ts +0 -4
- package/dist/ts3.4/presets/babel-cache-preset.d.ts +0 -2
- package/dist/ts3.4/standalone.d.ts +0 -2
- package/dist/ts3.4/utils/StoryIndexGenerator.d.ts +0 -27
- package/dist/ts3.4/utils/__mockdata__/E.stories.d.ts +0 -5
- package/dist/ts3.4/utils/__mockdata__/deeply/nested/single/File.stories.d.ts +0 -5
- package/dist/ts3.4/utils/__mockdata__/src/B.stories.d.ts +0 -5
- package/dist/ts3.4/utils/__mockdata__/src/NoMeta.stories.d.ts +0 -1
- package/dist/ts3.4/utils/__mockdata__/src/nested/Button.d.ts +0 -1
- package/dist/ts3.4/utils/__mockdata__/src/nested/Button.stories.d.ts +0 -5
- package/dist/ts3.4/utils/__mockdata__/src/second-nested/G.stories.d.ts +0 -5
- package/dist/ts3.4/utils/copy-all-static-files.d.ts +0 -2
- package/dist/ts3.4/utils/get-manager-builder.d.ts +0 -2
- package/dist/ts3.4/utils/get-preview-builder.d.ts +0 -2
- package/dist/ts3.4/utils/get-server-channel.d.ts +0 -9
- package/dist/ts3.4/utils/metadata.d.ts +0 -3
- package/dist/ts3.4/utils/middleware.d.ts +0 -1
- package/dist/ts3.4/utils/open-in-browser.d.ts +0 -1
- package/dist/ts3.4/utils/output-startup-information.d.ts +0 -16
- package/dist/ts3.4/utils/release-notes.d.ts +0 -8
- package/dist/ts3.4/utils/server-address.d.ts +0 -8
- package/dist/ts3.4/utils/server-init.d.ts +0 -10
- package/dist/ts3.4/utils/server-statics.d.ts +0 -8
- package/dist/ts3.4/utils/stories-json.d.ts +0 -13
- package/dist/ts3.4/utils/update-check.d.ts +0 -3
- package/dist/ts3.4/utils/watch-story-specifiers.d.ts +0 -5
- package/dist/ts3.9/build-dev.d.ts +0 -3
- package/dist/ts3.9/cli/dev.d.ts +0 -6
- package/dist/ts3.9/cli/index.d.ts +0 -2
- package/dist/ts3.9/cli/prod.d.ts +0 -7
- package/dist/ts3.9/cli/utils.d.ts +0 -5
- package/dist/ts3.9/presets/babel-cache-preset.d.ts +0 -2
- package/dist/ts3.9/presets/common-preset.d.ts +0 -31
- package/dist/ts3.9/utils/get-manager-builder.d.ts +0 -2
- package/dist/ts3.9/utils/get-preview-builder.d.ts +0 -2
- package/dist/ts3.9/utils/output-stats.d.ts +0 -3
|
@@ -80,9 +80,9 @@ class StoryIndexGenerator {
|
|
|
80
80
|
files.sort().forEach(function (absolutePath) {
|
|
81
81
|
var ext = _path.default.extname(absolutePath);
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
if (ext === '.storyshot') {
|
|
84
|
+
var relativePath = _path.default.relative(_this.options.workingDir, absolutePath);
|
|
84
85
|
|
|
85
|
-
if (!['.js', '.jsx', '.ts', '.tsx', '.mdx'].includes(ext)) {
|
|
86
86
|
_nodeLogger.logger.info(`Skipping ${ext} file ${relativePath}`);
|
|
87
87
|
|
|
88
88
|
return;
|
|
@@ -109,6 +109,18 @@ class StoryIndexGenerator {
|
|
|
109
109
|
}))).flat();
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
+
async index(filePath, options) {
|
|
113
|
+
var storyIndexer = this.options.storyIndexers.find(function (indexer) {
|
|
114
|
+
return indexer.test.exec(filePath);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
if (!storyIndexer) {
|
|
118
|
+
throw new Error(`No matching story indexer found for ${filePath}`);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return storyIndexer.indexer(filePath, options);
|
|
122
|
+
}
|
|
123
|
+
|
|
112
124
|
async extractStories(specifier, absolutePath) {
|
|
113
125
|
var relativePath = _path.default.relative(this.options.workingDir, absolutePath);
|
|
114
126
|
|
|
@@ -122,9 +134,9 @@ class StoryIndexGenerator {
|
|
|
122
134
|
return (0, _store.userOrAutoTitleFromSpecifier)(importPath, specifier, userTitle);
|
|
123
135
|
};
|
|
124
136
|
|
|
125
|
-
var csf =
|
|
137
|
+
var csf = await this.index(absolutePath, {
|
|
126
138
|
makeTitle: makeTitle
|
|
127
|
-
})
|
|
139
|
+
});
|
|
128
140
|
csf.stories.forEach(function ({
|
|
129
141
|
id: id,
|
|
130
142
|
name: name
|
|
@@ -3,43 +3,49 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.getBuilders = getBuilders;
|
|
7
7
|
|
|
8
8
|
require("core-js/modules/es.promise.js");
|
|
9
9
|
|
|
10
|
-
var _path = _interopRequireDefault(require("path"));
|
|
11
|
-
|
|
12
|
-
var _coreCommon = require("@storybook/core-common");
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
11
|
|
|
18
12
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
13
|
|
|
20
14
|
async function getManagerBuilder(configDir) {
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
var builderPackage = require.resolve('@storybook/manager-webpack5', {
|
|
16
|
+
paths: [configDir]
|
|
17
|
+
});
|
|
24
18
|
|
|
25
|
-
var
|
|
19
|
+
var managerBuilder = await Promise.resolve(`${builderPackage}`).then(function (s) {
|
|
20
|
+
return _interopRequireWildcard(require(s));
|
|
21
|
+
});
|
|
22
|
+
return managerBuilder;
|
|
23
|
+
}
|
|
26
24
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
core = _ref.core;
|
|
25
|
+
async function getPreviewBuilder(builderName, configDir) {
|
|
26
|
+
var builderPackage;
|
|
31
27
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
if (builderName) {
|
|
29
|
+
builderPackage = require.resolve(['webpack5'].includes(builderName) ? `@storybook/builder-${builderName}` : builderName, {
|
|
30
|
+
paths: [configDir]
|
|
31
|
+
});
|
|
32
|
+
} else {
|
|
33
|
+
throw new Error('no builder configured!');
|
|
34
|
+
}
|
|
37
35
|
|
|
38
|
-
var
|
|
39
|
-
paths: [main]
|
|
40
|
-
}) : '@storybook/manager-webpack4';
|
|
41
|
-
var managerBuilder = await Promise.resolve(`${builderPackage}`).then(function (s) {
|
|
36
|
+
var previewBuilder = await Promise.resolve(`${builderPackage}`).then(function (s) {
|
|
42
37
|
return _interopRequireWildcard(require(s));
|
|
43
38
|
});
|
|
44
|
-
return
|
|
39
|
+
return previewBuilder;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function getBuilders({
|
|
43
|
+
presets: presets,
|
|
44
|
+
configDir: configDir
|
|
45
|
+
}) {
|
|
46
|
+
var _core$builder;
|
|
47
|
+
|
|
48
|
+
var core = await presets.apply('core', undefined);
|
|
49
|
+
var builderName = typeof (core === null || core === void 0 ? void 0 : core.builder) === 'string' ? core.builder : core === null || core === void 0 ? void 0 : (_core$builder = core.builder) === null || _core$builder === void 0 ? void 0 : _core$builder.name;
|
|
50
|
+
return Promise.all([getPreviewBuilder(builderName, configDir), getManagerBuilder(configDir)]);
|
|
45
51
|
}
|
package/dist/esm/build-dev.js
CHANGED
|
@@ -18,29 +18,23 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
18
18
|
|
|
19
19
|
import "core-js/modules/es.promise.js";
|
|
20
20
|
import "core-js/modules/es.symbol.description.js";
|
|
21
|
-
import {
|
|
21
|
+
import { resolvePathInStorybookCache, loadAllPresets, cache, loadMainConfig } from '@storybook/core-common';
|
|
22
22
|
import prompts from 'prompts';
|
|
23
|
-
import { resolvePathInStorybookCache, loadAllPresets, cache } from '@storybook/core-common';
|
|
24
|
-
import { telemetry } from '@storybook/telemetry';
|
|
25
|
-
import dedent from 'ts-dedent';
|
|
26
23
|
import global from 'global';
|
|
27
|
-
import
|
|
24
|
+
import { join, resolve } from 'path';
|
|
25
|
+
import { logger } from '@storybook/node-logger';
|
|
28
26
|
import { storybookDevServer } from './dev-server';
|
|
29
|
-
import { getDevCli } from './cli';
|
|
30
27
|
import { getReleaseNotesData, getReleaseNotesFailedState } from './utils/release-notes';
|
|
31
28
|
import { outputStats } from './utils/output-stats';
|
|
32
29
|
import { outputStartupInformation } from './utils/output-startup-information';
|
|
33
30
|
import { updateCheck } from './utils/update-check';
|
|
34
31
|
import { getServerPort, getServerChannelUrl } from './utils/server-address';
|
|
35
|
-
import {
|
|
36
|
-
import { getManagerBuilder } from './utils/get-manager-builder';
|
|
32
|
+
import { getBuilders } from './utils/get-builders';
|
|
37
33
|
export async function buildDevStandalone(options) {
|
|
38
34
|
var packageJson = options.packageJson,
|
|
39
35
|
versionUpdates = options.versionUpdates,
|
|
40
36
|
releaseNotes = options.releaseNotes;
|
|
41
|
-
var version = packageJson.version,
|
|
42
|
-
_packageJson$name = packageJson.name,
|
|
43
|
-
name = _packageJson$name === void 0 ? '' : _packageJson$name; // updateInfo and releaseNotesData are cached, so this is typically pretty fast
|
|
37
|
+
var version = packageJson.version; // updateInfo and releaseNotesData are cached, so this is typically pretty fast
|
|
44
38
|
|
|
45
39
|
var _await$Promise$all = await Promise.all([getServerPort(options.port), versionUpdates ? updateCheck(version) : Promise.resolve({
|
|
46
40
|
success: false,
|
|
@@ -70,15 +64,38 @@ export async function buildDevStandalone(options) {
|
|
|
70
64
|
options.versionCheck = versionCheck;
|
|
71
65
|
options.releaseNotesData = releaseNotesData;
|
|
72
66
|
options.configType = 'DEVELOPMENT';
|
|
73
|
-
options.configDir =
|
|
74
|
-
options.outputDir = options.smokeTest ? resolvePathInStorybookCache('public') :
|
|
67
|
+
options.configDir = resolve(options.configDir);
|
|
68
|
+
options.outputDir = options.smokeTest ? resolvePathInStorybookCache('public') : resolve(options.outputDir || resolvePathInStorybookCache('public'));
|
|
75
69
|
options.serverChannelUrl = getServerChannelUrl(port, options);
|
|
76
70
|
/* eslint-enable no-param-reassign */
|
|
77
71
|
|
|
78
|
-
var
|
|
79
|
-
|
|
72
|
+
var _loadMainConfig = loadMainConfig(options),
|
|
73
|
+
framework = _loadMainConfig.framework;
|
|
74
|
+
|
|
75
|
+
var corePresets = [];
|
|
76
|
+
var frameworkName = typeof framework === 'string' ? framework : framework === null || framework === void 0 ? void 0 : framework.name;
|
|
77
|
+
|
|
78
|
+
if (frameworkName) {
|
|
79
|
+
corePresets.push(join(frameworkName, 'preset'));
|
|
80
|
+
} else {
|
|
81
|
+
logger.warn(`you have not specified a framework in your ${options.configDir}/main.js`);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
logger.info('=> Loading presets');
|
|
80
85
|
var presets = loadAllPresets(_objectSpread({
|
|
81
|
-
corePresets:
|
|
86
|
+
corePresets: corePresets,
|
|
87
|
+
overridePresets: []
|
|
88
|
+
}, options));
|
|
89
|
+
|
|
90
|
+
var _await$getBuilders = await getBuilders(_objectSpread(_objectSpread({}, options), {}, {
|
|
91
|
+
presets: presets
|
|
92
|
+
})),
|
|
93
|
+
_await$getBuilders2 = _slicedToArray(_await$getBuilders, 2),
|
|
94
|
+
previewBuilder = _await$getBuilders2[0],
|
|
95
|
+
managerBuilder = _await$getBuilders2[1];
|
|
96
|
+
|
|
97
|
+
presets = loadAllPresets(_objectSpread({
|
|
98
|
+
corePresets: [require.resolve('./presets/common-preset'), ...managerBuilder.corePresets, ...previewBuilder.corePresets, ...corePresets, require.resolve('./presets/babel-cache-preset')],
|
|
82
99
|
overridePresets: previewBuilder.overridePresets
|
|
83
100
|
}, options));
|
|
84
101
|
var features = await presets.apply('features');
|
|
@@ -106,127 +123,33 @@ export async function buildDevStandalone(options) {
|
|
|
106
123
|
}
|
|
107
124
|
|
|
108
125
|
if (options.smokeTest) {
|
|
109
|
-
// @ts-ignore
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
var
|
|
115
|
-
|
|
116
|
-
|
|
126
|
+
var warnings = []; // @ts-ignore
|
|
127
|
+
|
|
128
|
+
warnings.push(...(managerStats && managerStats.toJson().warnings || [])); // @ts-ignore
|
|
129
|
+
|
|
130
|
+
warnings.push(...(managerStats && previewStats.toJson().warnings || []));
|
|
131
|
+
var problems = warnings.filter(function (warning) {
|
|
132
|
+
return !warning.message.includes(`export 'useInsertionEffect'`);
|
|
133
|
+
}).filter(function (warning) {
|
|
134
|
+
return !warning.message.includes(`compilation but it's unused`);
|
|
135
|
+
}).filter(function (warning) {
|
|
136
|
+
return !warning.message.includes(`Conflicting values for 'process.env.NODE_ENV'`);
|
|
137
|
+
});
|
|
138
|
+
console.log(problems.map(function (p) {
|
|
139
|
+
return p.stack;
|
|
140
|
+
}));
|
|
141
|
+
process.exit(problems.length > 0 ? 1 : 0);
|
|
117
142
|
return;
|
|
118
|
-
}
|
|
119
|
-
|
|
143
|
+
}
|
|
120
144
|
|
|
121
|
-
var
|
|
122
|
-
var frameworkName = packageName.charAt(0).toUpperCase() + packageName.slice(1);
|
|
145
|
+
var name = frameworkName.split('@storybook/').length > 1 ? frameworkName.split('@storybook/')[1] : frameworkName;
|
|
123
146
|
outputStartupInformation({
|
|
124
147
|
updateInfo: versionCheck,
|
|
125
148
|
version: version,
|
|
126
|
-
name:
|
|
149
|
+
name: name,
|
|
127
150
|
address: address,
|
|
128
151
|
networkAddress: networkAddress,
|
|
129
152
|
managerTotalTime: managerTotalTime,
|
|
130
153
|
previewTotalTime: previewTotalTime
|
|
131
154
|
});
|
|
132
|
-
}
|
|
133
|
-
export async function buildDev(loadOptions) {
|
|
134
|
-
var cliOptions = await getDevCli(loadOptions.packageJson);
|
|
135
|
-
|
|
136
|
-
var options = _objectSpread(_objectSpread(_objectSpread({}, cliOptions), loadOptions), {}, {
|
|
137
|
-
configDir: loadOptions.configDir || cliOptions.configDir || './.storybook',
|
|
138
|
-
configType: 'DEVELOPMENT',
|
|
139
|
-
ignorePreview: !!cliOptions.previewUrl && !cliOptions.forceBuildPreview,
|
|
140
|
-
docsMode: !!cliOptions.docs,
|
|
141
|
-
cache: cache
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
try {
|
|
145
|
-
await buildDevStandalone(options);
|
|
146
|
-
} catch (error) {
|
|
147
|
-
var _error$compilation;
|
|
148
|
-
|
|
149
|
-
// this is a weird bugfix, somehow 'node-pre-gyp' is polluting the npmLog header
|
|
150
|
-
npmLog.heading = '';
|
|
151
|
-
|
|
152
|
-
if (error instanceof Error) {
|
|
153
|
-
if (error.error) {
|
|
154
|
-
logger.error(error.error);
|
|
155
|
-
} else if (error.stats && error.stats.compilation.errors) {
|
|
156
|
-
error.stats.compilation.errors.forEach(function (e) {
|
|
157
|
-
return logger.plain(e);
|
|
158
|
-
});
|
|
159
|
-
} else {
|
|
160
|
-
logger.error(error);
|
|
161
|
-
}
|
|
162
|
-
} else if ((_error$compilation = error.compilation) !== null && _error$compilation !== void 0 && _error$compilation.errors) {
|
|
163
|
-
error.compilation.errors.forEach(function (e) {
|
|
164
|
-
return logger.plain(e);
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
logger.line();
|
|
169
|
-
logger.warn(error.close ? dedent`
|
|
170
|
-
FATAL broken build!, will close the process,
|
|
171
|
-
Fix the error below and restart storybook.
|
|
172
|
-
` : dedent`
|
|
173
|
-
Broken build, fix the error above.
|
|
174
|
-
You may need to refresh the browser.
|
|
175
|
-
`);
|
|
176
|
-
logger.line();
|
|
177
|
-
var presets = loadAllPresets(_objectSpread({
|
|
178
|
-
corePresets: [require.resolve('./presets/common-preset')],
|
|
179
|
-
overridePresets: []
|
|
180
|
-
}, options));
|
|
181
|
-
var core = await presets.apply('core');
|
|
182
|
-
|
|
183
|
-
if (!(core !== null && core !== void 0 && core.disableTelemetry)) {
|
|
184
|
-
var enableCrashReports;
|
|
185
|
-
|
|
186
|
-
if (core.enableCrashReports !== undefined) {
|
|
187
|
-
enableCrashReports = core.enableCrashReports;
|
|
188
|
-
} else {
|
|
189
|
-
var valueFromCache = await cache.get('enableCrashreports');
|
|
190
|
-
|
|
191
|
-
if (valueFromCache !== undefined) {
|
|
192
|
-
enableCrashReports = valueFromCache;
|
|
193
|
-
} else {
|
|
194
|
-
var valueFromPrompt = await promptCrashReports(options);
|
|
195
|
-
|
|
196
|
-
if (valueFromPrompt !== undefined) {
|
|
197
|
-
enableCrashReports = valueFromPrompt;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
await telemetry('error-dev', {
|
|
203
|
-
error: error
|
|
204
|
-
}, {
|
|
205
|
-
immediate: true,
|
|
206
|
-
configDir: options.configDir,
|
|
207
|
-
enableCrashReports: enableCrashReports
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
process.exit(1);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
var promptCrashReports = async function ({
|
|
216
|
-
packageJson: packageJson
|
|
217
|
-
}) {
|
|
218
|
-
if (process.env.CI) {
|
|
219
|
-
return undefined;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
var _await$prompts2 = await prompts({
|
|
223
|
-
type: 'confirm',
|
|
224
|
-
name: 'enableCrashReports',
|
|
225
|
-
message: `Would you like to send crash reports to Storybook?`,
|
|
226
|
-
initial: true
|
|
227
|
-
}),
|
|
228
|
-
enableCrashReports = _await$prompts2.enableCrashReports;
|
|
229
|
-
|
|
230
|
-
await cache.set('enableCrashreports', enableCrashReports);
|
|
231
|
-
return enableCrashReports;
|
|
232
|
-
};
|
|
155
|
+
}
|
package/dist/esm/build-static.js
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import "core-js/modules/es.symbol.description.js";
|
|
2
|
-
var _excluded = ["packageJson"];
|
|
3
|
-
|
|
4
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
5
|
-
|
|
6
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
7
|
-
|
|
8
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
2
|
|
|
10
3
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -24,25 +17,24 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
24
17
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
25
18
|
|
|
26
19
|
import "core-js/modules/es.promise.js";
|
|
20
|
+
import "core-js/modules/es.symbol.description.js";
|
|
27
21
|
import chalk from 'chalk';
|
|
28
22
|
import cpy from 'cpy';
|
|
29
23
|
import fs from 'fs-extra';
|
|
30
|
-
import path from 'path';
|
|
24
|
+
import path, { join } from 'path';
|
|
31
25
|
import dedent from 'ts-dedent';
|
|
32
26
|
import global from 'global';
|
|
33
27
|
import { logger } from '@storybook/node-logger';
|
|
34
28
|
import { telemetry } from '@storybook/telemetry';
|
|
35
|
-
import {
|
|
36
|
-
import { getProdCli } from './cli';
|
|
29
|
+
import { loadAllPresets, normalizeStories, logConfig, loadMainConfig } from '@storybook/core-common';
|
|
37
30
|
import { outputStats } from './utils/output-stats';
|
|
38
31
|
import { copyAllStaticFiles, copyAllStaticFilesRelativeToMain } from './utils/copy-all-static-files';
|
|
39
|
-
import {
|
|
40
|
-
import { getManagerBuilder } from './utils/get-manager-builder';
|
|
32
|
+
import { getBuilders } from './utils/get-builders';
|
|
41
33
|
import { extractStoriesJson } from './utils/stories-json';
|
|
42
34
|
import { extractStorybookMetadata } from './utils/metadata';
|
|
43
35
|
import { StoryIndexGenerator } from './utils/StoryIndexGenerator';
|
|
44
36
|
export async function buildStaticStandalone(options) {
|
|
45
|
-
var _options$staticDir
|
|
37
|
+
var _options$staticDir;
|
|
46
38
|
|
|
47
39
|
/* eslint-disable no-param-reassign */
|
|
48
40
|
options.configType = 'PRODUCTION';
|
|
@@ -69,10 +61,37 @@ export async function buildStaticStandalone(options) {
|
|
|
69
61
|
|
|
70
62
|
await fs.emptyDir(options.outputDir);
|
|
71
63
|
await cpy(defaultFavIcon, options.outputDir);
|
|
72
|
-
|
|
73
|
-
var
|
|
64
|
+
|
|
65
|
+
var _await$import = await import('@storybook/manager-webpack5/prebuilt-manager'),
|
|
66
|
+
getPrebuiltDir = _await$import.getPrebuiltDir;
|
|
67
|
+
|
|
68
|
+
var _loadMainConfig = loadMainConfig(options),
|
|
69
|
+
framework = _loadMainConfig.framework;
|
|
70
|
+
|
|
71
|
+
var corePresets = [];
|
|
72
|
+
var frameworkName = typeof framework === 'string' ? framework : framework === null || framework === void 0 ? void 0 : framework.name;
|
|
73
|
+
|
|
74
|
+
if (frameworkName) {
|
|
75
|
+
corePresets.push(join(frameworkName, 'preset'));
|
|
76
|
+
} else {
|
|
77
|
+
logger.warn(`you have not specified a framework in your ${options.configDir}/main.js`);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
logger.info('=> Loading presets');
|
|
74
81
|
var presets = loadAllPresets(_objectSpread({
|
|
75
|
-
corePresets: [require.resolve('./presets/common-preset'), ...
|
|
82
|
+
corePresets: [require.resolve('./presets/common-preset'), ...corePresets],
|
|
83
|
+
overridePresets: []
|
|
84
|
+
}, options));
|
|
85
|
+
|
|
86
|
+
var _await$getBuilders = await getBuilders(_objectSpread(_objectSpread({}, options), {}, {
|
|
87
|
+
presets: presets
|
|
88
|
+
})),
|
|
89
|
+
_await$getBuilders2 = _slicedToArray(_await$getBuilders, 2),
|
|
90
|
+
previewBuilder = _await$getBuilders2[0],
|
|
91
|
+
managerBuilder = _await$getBuilders2[1];
|
|
92
|
+
|
|
93
|
+
presets = loadAllPresets(_objectSpread({
|
|
94
|
+
corePresets: [require.resolve('./presets/common-preset'), ...managerBuilder.corePresets, ...previewBuilder.corePresets, ...corePresets, require.resolve('./presets/babel-cache-preset')],
|
|
76
95
|
overridePresets: previewBuilder.overridePresets
|
|
77
96
|
}, options));
|
|
78
97
|
var staticDirs = await presets.apply('staticDirs');
|
|
@@ -100,14 +119,16 @@ export async function buildStaticStandalone(options) {
|
|
|
100
119
|
var extractTasks = [];
|
|
101
120
|
var initializedStoryIndexGenerator = Promise.resolve(undefined);
|
|
102
121
|
|
|
103
|
-
if (features !== null && features !== void 0 && features.buildStoriesJson || features !== null && features !== void 0 && features.storyStoreV7) {
|
|
122
|
+
if ((features !== null && features !== void 0 && features.buildStoriesJson || features !== null && features !== void 0 && features.storyStoreV7) && !options.ignorePreview) {
|
|
104
123
|
var workingDir = process.cwd();
|
|
105
124
|
var directories = {
|
|
106
125
|
configDir: options.configDir,
|
|
107
126
|
workingDir: workingDir
|
|
108
127
|
};
|
|
109
128
|
var normalizedStories = normalizeStories(await presets.apply('stories'), directories);
|
|
129
|
+
var storyIndexers = await presets.apply('storyIndexers', []);
|
|
110
130
|
var generator = new StoryIndexGenerator(normalizedStories, _objectSpread(_objectSpread({}, directories), {}, {
|
|
131
|
+
storyIndexers: storyIndexers,
|
|
111
132
|
storiesV2Compatibility: !(features !== null && features !== void 0 && features.breakingChangesV7) && !(features !== null && features !== void 0 && features.storyStoreV7),
|
|
112
133
|
storyStoreV7: features === null || features === void 0 ? void 0 : features.storyStoreV7
|
|
113
134
|
}));
|
|
@@ -152,12 +173,6 @@ export async function buildStaticStandalone(options) {
|
|
|
152
173
|
logConfig('Manager webpack config', await managerBuilder.getConfig(fullOptions));
|
|
153
174
|
}
|
|
154
175
|
|
|
155
|
-
var builderName = typeof (core === null || core === void 0 ? void 0 : core.builder) === 'string' ? core.builder : core === null || core === void 0 ? void 0 : (_core$builder = core.builder) === null || _core$builder === void 0 ? void 0 : _core$builder.name;
|
|
156
|
-
|
|
157
|
-
var _ref = builderName === 'webpack5' ? // eslint-disable-next-line import/no-extraneous-dependencies
|
|
158
|
-
await import('@storybook/manager-webpack5/prebuilt-manager') : await import('@storybook/manager-webpack4/prebuilt-manager'),
|
|
159
|
-
getPrebuiltDir = _ref.getPrebuiltDir;
|
|
160
|
-
|
|
161
176
|
var prebuiltDir = await getPrebuiltDir(fullOptions);
|
|
162
177
|
var startTime = process.hrtime(); // When using the prebuilt manager, we straight up copy it into the outputDir instead of building it
|
|
163
178
|
|
|
@@ -179,10 +194,10 @@ export async function buildStaticStandalone(options) {
|
|
|
179
194
|
});
|
|
180
195
|
|
|
181
196
|
var _await$Promise$all = await Promise.all([manager.catch(async function (err) {
|
|
182
|
-
await previewBuilder.bail();
|
|
197
|
+
await (previewBuilder === null || previewBuilder === void 0 ? void 0 : previewBuilder.bail());
|
|
183
198
|
throw err;
|
|
184
199
|
}), preview.catch(async function (err) {
|
|
185
|
-
await managerBuilder.bail();
|
|
200
|
+
await (managerBuilder === null || managerBuilder === void 0 ? void 0 : managerBuilder.bail());
|
|
186
201
|
throw err;
|
|
187
202
|
}), ...extractTasks]),
|
|
188
203
|
_await$Promise$all2 = _slicedToArray(_await$Promise$all, 2),
|
|
@@ -195,43 +210,4 @@ export async function buildStaticStandalone(options) {
|
|
|
195
210
|
}
|
|
196
211
|
|
|
197
212
|
logger.info(`=> Output directory: ${options.outputDir}`);
|
|
198
|
-
}
|
|
199
|
-
export async function buildStatic(_ref2) {
|
|
200
|
-
var packageJson = _ref2.packageJson,
|
|
201
|
-
loadOptions = _objectWithoutProperties(_ref2, _excluded);
|
|
202
|
-
|
|
203
|
-
var cliOptions = getProdCli(packageJson);
|
|
204
|
-
|
|
205
|
-
var options = _objectSpread(_objectSpread(_objectSpread({}, cliOptions), loadOptions), {}, {
|
|
206
|
-
packageJson: packageJson,
|
|
207
|
-
configDir: loadOptions.configDir || cliOptions.configDir || './.storybook',
|
|
208
|
-
outputDir: loadOptions.outputDir || cliOptions.outputDir || './storybook-static',
|
|
209
|
-
ignorePreview: (!!loadOptions.ignorePreview || !!cliOptions.previewUrl) && !cliOptions.forceBuildPreview,
|
|
210
|
-
docsMode: !!cliOptions.docs,
|
|
211
|
-
configType: 'PRODUCTION',
|
|
212
|
-
cache: cache
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
try {
|
|
216
|
-
await buildStaticStandalone(options);
|
|
217
|
-
} catch (error) {
|
|
218
|
-
logger.error(error);
|
|
219
|
-
var presets = loadAllPresets(_objectSpread({
|
|
220
|
-
corePresets: [require.resolve('./presets/common-preset')],
|
|
221
|
-
overridePresets: []
|
|
222
|
-
}, options));
|
|
223
|
-
var core = await presets.apply('core');
|
|
224
|
-
|
|
225
|
-
if (!(core !== null && core !== void 0 && core.disableTelemetry)) {
|
|
226
|
-
await telemetry('error-build', {
|
|
227
|
-
error: error
|
|
228
|
-
}, {
|
|
229
|
-
immediate: true,
|
|
230
|
-
configDir: options.configDir,
|
|
231
|
-
enableCrashReports: options.enableCrashReports
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
process.exit(1);
|
|
236
|
-
}
|
|
237
213
|
}
|
package/dist/esm/dev-server.js
CHANGED
|
@@ -30,8 +30,7 @@ import { useStoriesJson } from './utils/stories-json';
|
|
|
30
30
|
import { useStorybookMetadata } from './utils/metadata';
|
|
31
31
|
import { getServerChannel } from './utils/get-server-channel';
|
|
32
32
|
import { openInBrowser } from './utils/open-in-browser';
|
|
33
|
-
import {
|
|
34
|
-
import { getManagerBuilder } from './utils/get-manager-builder';
|
|
33
|
+
import { getBuilders } from './utils/get-builders';
|
|
35
34
|
import { StoryIndexGenerator } from './utils/StoryIndexGenerator'; // @ts-ignore
|
|
36
35
|
|
|
37
36
|
export var router = new Router();
|
|
@@ -54,7 +53,9 @@ export async function storybookDevServer(options) {
|
|
|
54
53
|
workingDir: workingDir
|
|
55
54
|
};
|
|
56
55
|
var normalizedStories = normalizeStories(await options.presets.apply('stories'), directories);
|
|
56
|
+
var storyIndexers = await options.presets.apply('storyIndexers', []);
|
|
57
57
|
var generator = new StoryIndexGenerator(normalizedStories, _objectSpread(_objectSpread({}, directories), {}, {
|
|
58
|
+
storyIndexers: storyIndexers,
|
|
58
59
|
workingDir: workingDir,
|
|
59
60
|
storiesV2Compatibility: !(features !== null && features !== void 0 && features.breakingChangesV7) && !(features !== null && features !== void 0 && features.storyStoreV7),
|
|
60
61
|
storyStoreV7: features === null || features === void 0 ? void 0 : features.storyStoreV7
|
|
@@ -149,8 +150,11 @@ export async function storybookDevServer(options) {
|
|
|
149
150
|
return error ? reject(error) : resolve();
|
|
150
151
|
});
|
|
151
152
|
});
|
|
152
|
-
|
|
153
|
-
var
|
|
153
|
+
|
|
154
|
+
var _await$getBuilders = await getBuilders(options),
|
|
155
|
+
_await$getBuilders2 = _slicedToArray(_await$getBuilders, 2),
|
|
156
|
+
previewBuilder = _await$getBuilders2[0],
|
|
157
|
+
managerBuilder = _await$getBuilders2[1];
|
|
154
158
|
|
|
155
159
|
if (options.debugWebpack) {
|
|
156
160
|
logConfig('Preview webpack config', await previewBuilder.getConfig(options));
|
|
@@ -171,7 +175,7 @@ export async function storybookDevServer(options) {
|
|
|
171
175
|
});
|
|
172
176
|
|
|
173
177
|
var _await$Promise$all = await Promise.all([preview.catch(async function (err) {
|
|
174
|
-
await managerBuilder.bail();
|
|
178
|
+
await (managerBuilder === null || managerBuilder === void 0 ? void 0 : managerBuilder.bail());
|
|
175
179
|
throw err;
|
|
176
180
|
}), manager // TODO #13083 Restore this when compiling the preview is fast enough
|
|
177
181
|
// .then((result) => {
|
|
@@ -179,7 +183,7 @@ export async function storybookDevServer(options) {
|
|
|
179
183
|
// return result;
|
|
180
184
|
// })
|
|
181
185
|
.catch(async function (err) {
|
|
182
|
-
await previewBuilder.bail();
|
|
186
|
+
await (previewBuilder === null || previewBuilder === void 0 ? void 0 : previewBuilder.bail());
|
|
183
187
|
throw err;
|
|
184
188
|
})]),
|
|
185
189
|
_await$Promise$all2 = _slicedToArray(_await$Promise$all, 2),
|
|
@@ -5,20 +5,19 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
5
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
|
|
7
7
|
import "core-js/modules/es.promise.js";
|
|
8
|
-
import
|
|
8
|
+
import fs from 'fs-extra';
|
|
9
|
+
import { getPreviewBodyTemplate, getPreviewHeadTemplate, getManagerMainTemplate, getPreviewMainTemplate, getStorybookBabelConfig, loadEnvs } from '@storybook/core-common';
|
|
10
|
+
import { loadCsf } from '@storybook/csf-tools';
|
|
9
11
|
export var babel = async function (_, options) {
|
|
10
12
|
var _options$features;
|
|
11
13
|
|
|
12
|
-
var
|
|
13
|
-
presets = options.presets;
|
|
14
|
+
var presets = options.presets;
|
|
14
15
|
|
|
15
16
|
if ((_options$features = options.features) !== null && _options$features !== void 0 && _options$features.babelModeV7) {
|
|
16
17
|
return presets.apply('babelDefault', {}, options);
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
return
|
|
20
|
-
return presets.apply('babelDefault', getStorybookBabelConfig(), options);
|
|
21
|
-
});
|
|
20
|
+
return presets.apply('babelDefault', getStorybookBabelConfig(), options);
|
|
22
21
|
};
|
|
23
22
|
export var logLevel = function (previous, options) {
|
|
24
23
|
return previous || options.loglevel || 'info';
|
|
@@ -48,8 +47,7 @@ export var previewMainTemplate = function () {
|
|
|
48
47
|
export var managerMainTemplate = function () {
|
|
49
48
|
return getManagerMainTemplate();
|
|
50
49
|
};
|
|
51
|
-
export var previewEntries = function (entries = []
|
|
52
|
-
if (!options.modern) entries.push(require.resolve('@storybook/core-client/dist/esm/globals/polyfills'));
|
|
50
|
+
export var previewEntries = function (entries = []) {
|
|
53
51
|
entries.push(require.resolve('@storybook/core-client/dist/esm/globals/globals'));
|
|
54
52
|
return entries;
|
|
55
53
|
};
|
|
@@ -109,16 +107,27 @@ export var config = async function (base, options) {
|
|
|
109
107
|
export var features = async function (existing) {
|
|
110
108
|
return _objectSpread(_objectSpread({}, existing), {}, {
|
|
111
109
|
postcss: true,
|
|
112
|
-
emotionAlias: false,
|
|
113
|
-
// TODO remove in 7.0, this no longer does anything
|
|
114
110
|
warnOnLegacyHierarchySeparator: true,
|
|
115
111
|
buildStoriesJson: false,
|
|
116
|
-
storyStoreV7:
|
|
117
|
-
modernInlineRender:
|
|
118
|
-
breakingChangesV7:
|
|
112
|
+
storyStoreV7: true,
|
|
113
|
+
modernInlineRender: true,
|
|
114
|
+
breakingChangesV7: true,
|
|
119
115
|
interactionsDebugger: false,
|
|
120
|
-
babelModeV7:
|
|
121
|
-
argTypeTargetsV7:
|
|
116
|
+
babelModeV7: true,
|
|
117
|
+
argTypeTargetsV7: true,
|
|
122
118
|
previewMdx2: false
|
|
123
119
|
});
|
|
120
|
+
};
|
|
121
|
+
export var storyIndexers = async function (indexers) {
|
|
122
|
+
var csfIndexer = async function (fileName, opts) {
|
|
123
|
+
var code = (await fs.readFile(fileName, 'utf-8')).toString();
|
|
124
|
+
return loadCsf(code, _objectSpread(_objectSpread({}, opts), {}, {
|
|
125
|
+
fileName: fileName
|
|
126
|
+
})).parse();
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
return [{
|
|
130
|
+
test: /(stories|story)\.[tj]sx?$/,
|
|
131
|
+
indexer: csfIndexer
|
|
132
|
+
}, ...(indexers || [])];
|
|
124
133
|
};
|