@storybook/core-server 7.0.0-alpha.2 → 7.0.0-alpha.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/build-dev.js +5 -11
- package/dist/cjs/build-static.js +56 -83
- package/dist/cjs/dev-server.js +3 -6
- package/dist/cjs/index.js +0 -14
- package/dist/cjs/presets/common-preset.js +40 -10
- package/dist/cjs/standalone.js +0 -2
- package/dist/cjs/utils/StoryIndexGenerator.js +321 -60
- package/dist/cjs/utils/__mockdata__/duplicate/A.stories.js +14 -0
- package/dist/cjs/utils/__mockdata__/duplicate/SecondA.stories.js +14 -0
- package/dist/cjs/utils/__mockdata__/{src → errors}/NoMeta.stories.js +0 -0
- package/dist/cjs/utils/copy-all-static-files.js +1 -3
- package/dist/cjs/utils/get-builders.js +1 -3
- package/dist/cjs/utils/metadata.js +2 -6
- package/dist/cjs/utils/open-in-browser.js +5 -5
- package/dist/cjs/utils/output-startup-information.js +2 -2
- package/dist/cjs/utils/output-stats.js +0 -2
- package/dist/cjs/utils/release-notes.js +0 -4
- package/dist/cjs/utils/server-init.js +0 -2
- package/dist/cjs/utils/server-statics.js +3 -5
- package/dist/cjs/utils/stories-json.js +61 -11
- package/dist/cjs/utils/update-check.js +2 -4
- package/dist/cjs/utils/watch-story-specifiers.js +5 -4
- package/dist/esm/build-dev.js +5 -9
- package/dist/esm/build-static.js +56 -75
- package/dist/esm/dev-server.js +3 -4
- package/dist/esm/index.js +3 -2
- package/dist/esm/presets/common-preset.js +30 -5
- package/dist/esm/standalone.js +0 -1
- package/dist/esm/utils/StoryIndexGenerator.js +321 -53
- package/dist/esm/utils/__mockdata__/duplicate/A.stories.js +6 -0
- package/dist/esm/utils/__mockdata__/duplicate/SecondA.stories.js +6 -0
- package/dist/esm/utils/__mockdata__/{src → errors}/NoMeta.stories.js +0 -0
- package/dist/esm/utils/copy-all-static-files.js +1 -2
- package/dist/esm/utils/get-builders.js +1 -3
- package/dist/esm/utils/metadata.js +2 -3
- package/dist/esm/utils/open-in-browser.js +6 -5
- package/dist/esm/utils/output-startup-information.js +1 -1
- package/dist/esm/utils/output-stats.js +0 -1
- package/dist/esm/utils/release-notes.js +0 -2
- package/dist/esm/utils/server-init.js +0 -1
- package/dist/esm/utils/server-statics.js +1 -2
- package/dist/esm/utils/stories-json.js +56 -8
- package/dist/esm/utils/update-check.js +1 -2
- package/dist/esm/utils/watch-story-specifiers.js +4 -3
- package/dist/types/build-static.d.ts +3 -1
- package/dist/types/dev-server.d.ts +3 -3
- package/dist/types/index.d.ts +2 -2
- package/dist/types/presets/common-preset.d.ts +4 -1
- package/dist/types/utils/StoryIndexGenerator.d.ts +44 -7
- package/dist/types/utils/__mockdata__/{src → errors}/NoMeta.stories.d.ts +0 -0
- package/dist/types/utils/get-builders.d.ts +1 -1
- package/dist/types/utils/stories-json.d.ts +3 -1
- package/package.json +21 -23
- package/LICENSE +0 -21
- package/typings.d.ts +0 -14
package/dist/cjs/build-dev.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.symbol.description.js");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.buildDevStandalone = buildDevStandalone;
|
|
9
7
|
|
|
10
|
-
require("core-js/modules/es.promise.js");
|
|
11
|
-
|
|
12
8
|
var _coreCommon = require("@storybook/core-common");
|
|
13
9
|
|
|
14
10
|
var _prompts = _interopRequireDefault(require("prompts"));
|
|
@@ -106,7 +102,7 @@ async function buildDevStandalone(options) {
|
|
|
106
102
|
|
|
107
103
|
_nodeLogger.logger.info('=> Loading presets');
|
|
108
104
|
|
|
109
|
-
var presets = (0, _coreCommon.loadAllPresets)(_objectSpread({
|
|
105
|
+
var presets = await (0, _coreCommon.loadAllPresets)(_objectSpread({
|
|
110
106
|
corePresets: corePresets,
|
|
111
107
|
overridePresets: []
|
|
112
108
|
}, options));
|
|
@@ -118,7 +114,7 @@ async function buildDevStandalone(options) {
|
|
|
118
114
|
previewBuilder = _await$getBuilders2[0],
|
|
119
115
|
managerBuilder = _await$getBuilders2[1];
|
|
120
116
|
|
|
121
|
-
presets = (0, _coreCommon.loadAllPresets)(_objectSpread({
|
|
117
|
+
presets = await (0, _coreCommon.loadAllPresets)(_objectSpread({
|
|
122
118
|
corePresets: [require.resolve('./presets/common-preset'), ...managerBuilder.corePresets, ...previewBuilder.corePresets, ...corePresets, require.resolve('./presets/babel-cache-preset')],
|
|
123
119
|
overridePresets: previewBuilder.overridePresets
|
|
124
120
|
}, options));
|
|
@@ -143,14 +139,12 @@ async function buildDevStandalone(options) {
|
|
|
143
139
|
|
|
144
140
|
if (options.webpackStatsJson) {
|
|
145
141
|
var target = options.webpackStatsJson === true ? options.outputDir : options.webpackStatsJson;
|
|
146
|
-
await (0, _outputStats.outputStats)(target, previewStats
|
|
142
|
+
await (0, _outputStats.outputStats)(target, previewStats);
|
|
147
143
|
}
|
|
148
144
|
|
|
149
145
|
if (options.smokeTest) {
|
|
150
|
-
var warnings = [];
|
|
151
|
-
|
|
152
|
-
warnings.push(...(managerStats && managerStats.toJson().warnings || [])); // @ts-ignore
|
|
153
|
-
|
|
146
|
+
var warnings = [];
|
|
147
|
+
warnings.push(...(managerStats && managerStats.toJson().warnings || []));
|
|
154
148
|
warnings.push(...(managerStats && previewStats.toJson().warnings || []));
|
|
155
149
|
var problems = warnings.filter(function (warning) {
|
|
156
150
|
return !warning.message.includes(`export 'useInsertionEffect'`);
|
package/dist/cjs/build-static.js
CHANGED
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.symbol.description.js");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.buildStaticStandalone = buildStaticStandalone;
|
|
9
7
|
|
|
10
|
-
require("core-js/modules/es.promise.js");
|
|
11
|
-
|
|
12
8
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
13
9
|
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
10
|
+
var _fsExtra = require("fs-extra");
|
|
17
11
|
|
|
18
|
-
var _path =
|
|
12
|
+
var _path = require("path");
|
|
19
13
|
|
|
20
|
-
var _tsDedent =
|
|
14
|
+
var _tsDedent = require("ts-dedent");
|
|
21
15
|
|
|
22
16
|
var _global = _interopRequireDefault(require("global"));
|
|
23
17
|
|
|
@@ -59,10 +53,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
59
53
|
|
|
60
54
|
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; }
|
|
61
55
|
|
|
62
|
-
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); }
|
|
63
|
-
|
|
64
|
-
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; }
|
|
65
|
-
|
|
66
56
|
async function buildStaticStandalone(options) {
|
|
67
57
|
var _options$staticDir;
|
|
68
58
|
|
|
@@ -77,25 +67,18 @@ async function buildStaticStandalone(options) {
|
|
|
77
67
|
throw new Error("Won't copy root directory. Check your staticDirs!");
|
|
78
68
|
}
|
|
79
69
|
|
|
80
|
-
options.outputDir = _path.
|
|
81
|
-
options.configDir = _path.
|
|
70
|
+
options.outputDir = (0, _path.isAbsolute)(options.outputDir) ? options.outputDir : (0, _path.join)(process.cwd(), options.outputDir);
|
|
71
|
+
options.configDir = (0, _path.resolve)(options.configDir);
|
|
82
72
|
/* eslint-enable no-param-reassign */
|
|
83
73
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
_nodeLogger.logger.info((0, _chalk.default)`=> Cleaning outputDir: {cyan ${options.outputDir}}`);
|
|
74
|
+
_nodeLogger.logger.info((0, _chalk.default)`=> Cleaning outputDir: {cyan ${options.outputDir.replace(process.cwd(), '')}}`);
|
|
87
75
|
|
|
88
76
|
if (options.outputDir === '/') {
|
|
89
77
|
throw new Error("Won't remove directory '/'. Check your outputDir!");
|
|
90
78
|
}
|
|
91
79
|
|
|
92
|
-
await _fsExtra.
|
|
93
|
-
await (0,
|
|
94
|
-
|
|
95
|
-
var _await$import = await Promise.resolve().then(function () {
|
|
96
|
-
return _interopRequireWildcard(require('@storybook/manager-webpack5/prebuilt-manager'));
|
|
97
|
-
}),
|
|
98
|
-
getPrebuiltDir = _await$import.getPrebuiltDir;
|
|
80
|
+
await (0, _fsExtra.emptyDir)(options.outputDir);
|
|
81
|
+
await (0, _fsExtra.ensureDir)(options.outputDir);
|
|
99
82
|
|
|
100
83
|
var _loadMainConfig = (0, _coreCommon.loadMainConfig)(options),
|
|
101
84
|
framework = _loadMainConfig.framework;
|
|
@@ -111,7 +94,7 @@ async function buildStaticStandalone(options) {
|
|
|
111
94
|
|
|
112
95
|
_nodeLogger.logger.info('=> Loading presets');
|
|
113
96
|
|
|
114
|
-
var presets = (0, _coreCommon.loadAllPresets)(_objectSpread({
|
|
97
|
+
var presets = await (0, _coreCommon.loadAllPresets)(_objectSpread({
|
|
115
98
|
corePresets: [require.resolve('./presets/common-preset'), ...corePresets],
|
|
116
99
|
overridePresets: []
|
|
117
100
|
}, options));
|
|
@@ -123,14 +106,27 @@ async function buildStaticStandalone(options) {
|
|
|
123
106
|
previewBuilder = _await$getBuilders2[0],
|
|
124
107
|
managerBuilder = _await$getBuilders2[1];
|
|
125
108
|
|
|
126
|
-
presets = (0, _coreCommon.loadAllPresets)(_objectSpread({
|
|
127
|
-
corePresets: [require.resolve('./presets/common-preset'), ...managerBuilder.corePresets, ...previewBuilder.corePresets, ...corePresets, require.resolve('./presets/babel-cache-preset')],
|
|
128
|
-
overridePresets: previewBuilder.overridePresets
|
|
109
|
+
presets = await (0, _coreCommon.loadAllPresets)(_objectSpread({
|
|
110
|
+
corePresets: [require.resolve('./presets/common-preset'), ...(managerBuilder.corePresets || []), ...(previewBuilder.corePresets || []), ...corePresets, require.resolve('./presets/babel-cache-preset')],
|
|
111
|
+
overridePresets: previewBuilder.overridePresets || []
|
|
129
112
|
}, options));
|
|
130
|
-
|
|
113
|
+
|
|
114
|
+
var _await$Promise$all = await Promise.all([presets.apply('features'), presets.apply('core'), presets.apply('staticDirs'), presets.apply('storyIndexers', []), presets.apply('stories'), presets.apply('docs', {})]),
|
|
115
|
+
_await$Promise$all2 = _slicedToArray(_await$Promise$all, 6),
|
|
116
|
+
features = _await$Promise$all2[0],
|
|
117
|
+
core = _await$Promise$all2[1],
|
|
118
|
+
staticDirs = _await$Promise$all2[2],
|
|
119
|
+
storyIndexers = _await$Promise$all2[3],
|
|
120
|
+
stories = _await$Promise$all2[4],
|
|
121
|
+
docsOptions = _await$Promise$all2[5];
|
|
122
|
+
|
|
123
|
+
var fullOptions = _objectSpread(_objectSpread({}, options), {}, {
|
|
124
|
+
presets: presets,
|
|
125
|
+
features: features
|
|
126
|
+
});
|
|
131
127
|
|
|
132
128
|
if (staticDirs && options.staticDir) {
|
|
133
|
-
throw new Error((0, _tsDedent.
|
|
129
|
+
throw new Error((0, _tsDedent.dedent)`
|
|
134
130
|
Conflict when trying to read staticDirs:
|
|
135
131
|
* Storybook's configuration option: 'staticDirs'
|
|
136
132
|
* Storybook's CLI flag: '--staticDir' or '-s'
|
|
@@ -139,17 +135,23 @@ async function buildStaticStandalone(options) {
|
|
|
139
135
|
`);
|
|
140
136
|
}
|
|
141
137
|
|
|
138
|
+
var effects = [];
|
|
139
|
+
_global.default.FEATURES = features;
|
|
140
|
+
await managerBuilder.build({
|
|
141
|
+
startTime: process.hrtime(),
|
|
142
|
+
options: fullOptions
|
|
143
|
+
});
|
|
144
|
+
|
|
142
145
|
if (staticDirs) {
|
|
143
|
-
|
|
146
|
+
effects.push((0, _copyAllStaticFiles.copyAllStaticFilesRelativeToMain)(staticDirs, options.outputDir, options.configDir));
|
|
144
147
|
}
|
|
145
148
|
|
|
146
149
|
if (options.staticDir) {
|
|
147
|
-
|
|
150
|
+
effects.push((0, _copyAllStaticFiles.copyAllStaticFiles)(options.staticDir, options.outputDir));
|
|
148
151
|
}
|
|
149
152
|
|
|
150
|
-
var
|
|
151
|
-
|
|
152
|
-
var extractTasks = [];
|
|
153
|
+
var coreServerPublicDir = (0, _path.join)((0, _path.dirname)(require.resolve('@storybook/core-server/package.json')), 'public');
|
|
154
|
+
effects.push((0, _fsExtra.copy)(coreServerPublicDir, options.outputDir));
|
|
153
155
|
var initializedStoryIndexGenerator = Promise.resolve(undefined);
|
|
154
156
|
|
|
155
157
|
if ((features !== null && features !== void 0 && features.buildStoriesJson || features !== null && features !== void 0 && features.storyStoreV7) && !options.ignorePreview) {
|
|
@@ -158,23 +160,22 @@ async function buildStaticStandalone(options) {
|
|
|
158
160
|
configDir: options.configDir,
|
|
159
161
|
workingDir: workingDir
|
|
160
162
|
};
|
|
161
|
-
var normalizedStories = (0, _coreCommon.normalizeStories)(
|
|
162
|
-
var storyIndexers = await presets.apply('storyIndexers', []);
|
|
163
|
+
var normalizedStories = (0, _coreCommon.normalizeStories)(stories, directories);
|
|
163
164
|
var generator = new _StoryIndexGenerator.StoryIndexGenerator(normalizedStories, _objectSpread(_objectSpread({}, directories), {}, {
|
|
164
165
|
storyIndexers: storyIndexers,
|
|
166
|
+
docs: docsOptions,
|
|
165
167
|
storiesV2Compatibility: !(features !== null && features !== void 0 && features.breakingChangesV7) && !(features !== null && features !== void 0 && features.storyStoreV7),
|
|
166
|
-
storyStoreV7: features
|
|
168
|
+
storyStoreV7: !!(features !== null && features !== void 0 && features.storyStoreV7)
|
|
167
169
|
}));
|
|
168
170
|
initializedStoryIndexGenerator = generator.initialize().then(function () {
|
|
169
171
|
return generator;
|
|
170
172
|
});
|
|
171
|
-
|
|
173
|
+
effects.push((0, _storiesJson.extractStoriesJson)((0, _path.join)(options.outputDir, 'stories.json'), initializedStoryIndexGenerator, _storiesJson.convertToIndexV3));
|
|
174
|
+
effects.push((0, _storiesJson.extractStoriesJson)((0, _path.join)(options.outputDir, 'index.json'), initializedStoryIndexGenerator));
|
|
172
175
|
}
|
|
173
176
|
|
|
174
|
-
var core = await presets.apply('core');
|
|
175
|
-
|
|
176
177
|
if (!(core !== null && core !== void 0 && core.disableTelemetry)) {
|
|
177
|
-
initializedStoryIndexGenerator.then(async function (generator) {
|
|
178
|
+
effects.push(initializedStoryIndexGenerator.then(async function (generator) {
|
|
178
179
|
if (!generator) {
|
|
179
180
|
return;
|
|
180
181
|
}
|
|
@@ -182,65 +183,37 @@ async function buildStaticStandalone(options) {
|
|
|
182
183
|
var storyIndex = await generator.getIndex();
|
|
183
184
|
var payload = storyIndex ? {
|
|
184
185
|
storyIndex: {
|
|
185
|
-
storyCount: Object.keys(storyIndex.
|
|
186
|
+
storyCount: Object.keys(storyIndex.entries).length,
|
|
186
187
|
version: storyIndex.v
|
|
187
188
|
}
|
|
188
189
|
} : undefined;
|
|
189
|
-
(0, _telemetry.telemetry)('build', payload, {
|
|
190
|
+
await (0, _telemetry.telemetry)('build', payload, {
|
|
190
191
|
configDir: options.configDir
|
|
191
192
|
});
|
|
192
|
-
});
|
|
193
|
+
}));
|
|
193
194
|
}
|
|
194
195
|
|
|
195
196
|
if (!(core !== null && core !== void 0 && core.disableProjectJson)) {
|
|
196
|
-
|
|
197
|
+
effects.push((0, _metadata.extractStorybookMetadata)((0, _path.join)(options.outputDir, 'project.json'), options.configDir));
|
|
197
198
|
}
|
|
198
199
|
|
|
199
|
-
var fullOptions = _objectSpread(_objectSpread({}, options), {}, {
|
|
200
|
-
presets: presets,
|
|
201
|
-
features: features
|
|
202
|
-
});
|
|
203
|
-
|
|
204
200
|
if (options.debugWebpack) {
|
|
205
201
|
(0, _coreCommon.logConfig)('Preview webpack config', await previewBuilder.getConfig(fullOptions));
|
|
206
|
-
(0, _coreCommon.logConfig)('Manager webpack config', await managerBuilder.getConfig(fullOptions));
|
|
207
202
|
}
|
|
208
203
|
|
|
209
|
-
var prebuiltDir = await getPrebuiltDir(fullOptions);
|
|
210
|
-
var startTime = process.hrtime(); // When using the prebuilt manager, we straight up copy it into the outputDir instead of building it
|
|
211
|
-
|
|
212
|
-
var manager = prebuiltDir ? (0, _cpy.default)('**', options.outputDir, {
|
|
213
|
-
cwd: prebuiltDir,
|
|
214
|
-
parents: true
|
|
215
|
-
}).then(function () {}) : managerBuilder.build({
|
|
216
|
-
startTime: startTime,
|
|
217
|
-
options: fullOptions
|
|
218
|
-
});
|
|
219
|
-
|
|
220
204
|
if (options.ignorePreview) {
|
|
221
205
|
_nodeLogger.logger.info(`=> Not building preview`);
|
|
222
206
|
}
|
|
223
207
|
|
|
224
|
-
|
|
225
|
-
startTime:
|
|
208
|
+
await Promise.all([...(options.ignorePreview ? [] : [previewBuilder.build({
|
|
209
|
+
startTime: process.hrtime(),
|
|
226
210
|
options: fullOptions
|
|
227
|
-
})
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
}),
|
|
233
|
-
await (managerBuilder === null || managerBuilder === void 0 ? void 0 : managerBuilder.bail());
|
|
234
|
-
throw err;
|
|
235
|
-
}), ...extractTasks]),
|
|
236
|
-
_await$Promise$all2 = _slicedToArray(_await$Promise$all, 2),
|
|
237
|
-
managerStats = _await$Promise$all2[0],
|
|
238
|
-
previewStats = _await$Promise$all2[1];
|
|
239
|
-
|
|
240
|
-
if (options.webpackStatsJson) {
|
|
241
|
-
var target = options.webpackStatsJson === true ? options.outputDir : options.webpackStatsJson;
|
|
242
|
-
await (0, _outputStats.outputStats)(target, previewStats, managerStats);
|
|
243
|
-
}
|
|
211
|
+
}).then(async function (previewStats) {
|
|
212
|
+
if (options.webpackStatsJson) {
|
|
213
|
+
var target = options.webpackStatsJson === true ? options.outputDir : options.webpackStatsJson;
|
|
214
|
+
await (0, _outputStats.outputStats)(target, previewStats);
|
|
215
|
+
}
|
|
216
|
+
})]), ...effects]);
|
|
244
217
|
|
|
245
218
|
_nodeLogger.logger.info(`=> Output directory: ${options.outputDir}`);
|
|
246
219
|
}
|
package/dist/cjs/dev-server.js
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.symbol.description.js");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.router = exports.DEBOUNCE = void 0;
|
|
9
7
|
exports.storybookDevServer = storybookDevServer;
|
|
10
8
|
|
|
11
|
-
require("core-js/modules/es.promise.js");
|
|
12
|
-
|
|
13
9
|
var _express = _interopRequireWildcard(require("express"));
|
|
14
10
|
|
|
15
11
|
var _compression = _interopRequireDefault(require("compression"));
|
|
@@ -87,8 +83,10 @@ async function storybookDevServer(options) {
|
|
|
87
83
|
};
|
|
88
84
|
var normalizedStories = (0, _coreCommon.normalizeStories)(await options.presets.apply('stories'), directories);
|
|
89
85
|
var storyIndexers = await options.presets.apply('storyIndexers', []);
|
|
86
|
+
var docsOptions = await options.presets.apply('docs', {});
|
|
90
87
|
var generator = new _StoryIndexGenerator.StoryIndexGenerator(normalizedStories, _objectSpread(_objectSpread({}, directories), {}, {
|
|
91
88
|
storyIndexers: storyIndexers,
|
|
89
|
+
docs: docsOptions,
|
|
92
90
|
workingDir: workingDir,
|
|
93
91
|
storiesV2Compatibility: !(features !== null && features !== void 0 && features.breakingChangesV7) && !(features !== null && features !== void 0 && features.storyStoreV7),
|
|
94
92
|
storyStoreV7: features === null || features === void 0 ? void 0 : features.storyStoreV7
|
|
@@ -121,7 +119,7 @@ async function storybookDevServer(options) {
|
|
|
121
119
|
var storyIndex = await generator.getIndex();
|
|
122
120
|
var payload = storyIndex ? {
|
|
123
121
|
storyIndex: {
|
|
124
|
-
storyCount: Object.keys(storyIndex.
|
|
122
|
+
storyCount: Object.keys(storyIndex.entries).length,
|
|
125
123
|
version: storyIndex.v
|
|
126
124
|
}
|
|
127
125
|
} : undefined;
|
|
@@ -191,7 +189,6 @@ async function storybookDevServer(options) {
|
|
|
191
189
|
|
|
192
190
|
if (options.debugWebpack) {
|
|
193
191
|
(0, _coreCommon.logConfig)('Preview webpack config', await previewBuilder.getConfig(options));
|
|
194
|
-
(0, _coreCommon.logConfig)('Manager webpack config', await managerBuilder.getConfig(options));
|
|
195
192
|
}
|
|
196
193
|
|
|
197
194
|
var preview = options.ignorePreview ? Promise.resolve() : previewBuilder.start({
|
package/dist/cjs/index.js
CHANGED
|
@@ -5,23 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {
|
|
7
7
|
getPreviewHeadTemplate: true,
|
|
8
|
-
getManagerHeadTemplate: true,
|
|
9
|
-
getManagerMainTemplate: true,
|
|
10
8
|
getPreviewBodyTemplate: true,
|
|
11
9
|
getPreviewMainTemplate: true
|
|
12
10
|
};
|
|
13
|
-
Object.defineProperty(exports, "getManagerHeadTemplate", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function () {
|
|
16
|
-
return _coreCommon.getManagerHeadTemplate;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports, "getManagerMainTemplate", {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get: function () {
|
|
22
|
-
return _coreCommon.getManagerMainTemplate;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
11
|
Object.defineProperty(exports, "getPreviewBodyTemplate", {
|
|
26
12
|
enumerable: true,
|
|
27
13
|
get: function () {
|
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.typescript = exports.storyIndexers = exports.previewMainTemplate = exports.previewHead = exports.previewEntries = exports.previewBody = exports.
|
|
7
|
-
|
|
8
|
-
require("core-js/modules/es.promise.js");
|
|
6
|
+
exports.typescript = exports.title = exports.storyIndexers = exports.previewMainTemplate = exports.previewHead = exports.previewEntries = exports.previewBody = exports.logLevel = exports.frameworkOptions = exports.features = exports.env = exports.docs = exports.core = exports.config = exports.babel = void 0;
|
|
9
7
|
|
|
10
8
|
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
11
9
|
|
|
@@ -28,6 +26,12 @@ var babel = async function (_, options) {
|
|
|
28
26
|
|
|
29
27
|
exports.babel = babel;
|
|
30
28
|
|
|
29
|
+
var title = function (previous, options) {
|
|
30
|
+
return previous || options.packageJson.name || false;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
exports.title = title;
|
|
34
|
+
|
|
31
35
|
var logLevel = function (previous, options) {
|
|
32
36
|
return previous || options.loglevel || 'info';
|
|
33
37
|
};
|
|
@@ -68,12 +72,6 @@ var previewMainTemplate = function () {
|
|
|
68
72
|
|
|
69
73
|
exports.previewMainTemplate = previewMainTemplate;
|
|
70
74
|
|
|
71
|
-
var managerMainTemplate = function () {
|
|
72
|
-
return (0, _coreCommon.getManagerMainTemplate)();
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
exports.managerMainTemplate = managerMainTemplate;
|
|
76
|
-
|
|
77
75
|
var previewEntries = function (entries = []) {
|
|
78
76
|
entries.push(require.resolve('@storybook/core-client/dist/esm/globals/globals'));
|
|
79
77
|
return entries;
|
|
@@ -172,4 +170,36 @@ var storyIndexers = async function (indexers) {
|
|
|
172
170
|
}, ...(indexers || [])];
|
|
173
171
|
};
|
|
174
172
|
|
|
175
|
-
exports.storyIndexers = storyIndexers;
|
|
173
|
+
exports.storyIndexers = storyIndexers;
|
|
174
|
+
|
|
175
|
+
var frameworkOptions = async function (_, options) {
|
|
176
|
+
var config = await options.presets.apply('framework');
|
|
177
|
+
|
|
178
|
+
if (typeof config === 'string') {
|
|
179
|
+
return {
|
|
180
|
+
name: config,
|
|
181
|
+
options: {}
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (typeof config === 'undefined') {
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return {
|
|
190
|
+
name: config.name,
|
|
191
|
+
options: config.options
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
exports.frameworkOptions = frameworkOptions;
|
|
196
|
+
|
|
197
|
+
var docs = function (docsOptions, {
|
|
198
|
+
docs: docsMode
|
|
199
|
+
}) {
|
|
200
|
+
return _objectSpread(_objectSpread({}, docsOptions), {}, {
|
|
201
|
+
docsMode: docsMode
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
exports.docs = docs;
|