@storybook/core-server 7.0.0-beta.0 → 7.0.0-beta.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/dist/cjs/build-static.js
CHANGED
|
@@ -133,14 +133,9 @@ async function buildStaticStandalone(options) {
|
|
|
133
133
|
if (!(core !== null && core !== void 0 && core.disableTelemetry)) {
|
|
134
134
|
effects.push(initializedStoryIndexGenerator.then(async function (generator) {
|
|
135
135
|
var storyIndex = await (generator === null || generator === void 0 ? void 0 : generator.getIndex());
|
|
136
|
-
var payload = {
|
|
137
|
-
|
|
138
|
-
};
|
|
139
|
-
if (storyIndex) {
|
|
140
|
-
Object.assign(payload, {
|
|
141
|
-
storyIndex: (0, _summarizeIndex.summarizeIndex)(storyIndex)
|
|
142
|
-
});
|
|
143
|
-
}
|
|
136
|
+
var payload = storyIndex ? {
|
|
137
|
+
storyIndex: (0, _summarizeIndex.summarizeIndex)(storyIndex)
|
|
138
|
+
} : undefined;
|
|
144
139
|
await (0, _telemetry.telemetry)('build', payload, {
|
|
145
140
|
configDir: options.configDir
|
|
146
141
|
});
|
|
@@ -15,15 +15,10 @@ async function doTelemetry(core, initializedStoryIndexGenerator, options) {
|
|
|
15
15
|
var storyIndex = await (generator === null || generator === void 0 ? void 0 : generator.getIndex());
|
|
16
16
|
var versionCheck = options.versionCheck,
|
|
17
17
|
versionUpdates = options.versionUpdates;
|
|
18
|
-
var payload = {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
Object.assign(payload, {
|
|
23
|
-
versionStatus: versionUpdates ? (0, _versionStatus.versionStatus)(versionCheck) : 'disabled',
|
|
24
|
-
storyIndex: (0, _summarizeIndex.summarizeIndex)(storyIndex)
|
|
25
|
-
});
|
|
26
|
-
}
|
|
18
|
+
var payload = storyIndex ? {
|
|
19
|
+
versionStatus: versionUpdates ? (0, _versionStatus.versionStatus)(versionCheck) : 'disabled',
|
|
20
|
+
storyIndex: (0, _summarizeIndex.summarizeIndex)(storyIndex)
|
|
21
|
+
} : undefined;
|
|
27
22
|
(0, _telemetry.telemetry)('dev', payload, {
|
|
28
23
|
configDir: options.configDir
|
|
29
24
|
});
|
|
@@ -25,14 +25,14 @@ var promptCrashReports = async function () {
|
|
|
25
25
|
await _coreCommon.cache.set('enableCrashReports', enableCrashReports);
|
|
26
26
|
return enableCrashReports;
|
|
27
27
|
};
|
|
28
|
-
async function
|
|
28
|
+
async function shouldSendError({
|
|
29
29
|
cliOptions: cliOptions,
|
|
30
30
|
presetOptions: presetOptions
|
|
31
31
|
}) {
|
|
32
|
-
if (cliOptions !== null && cliOptions !== void 0 && cliOptions.disableTelemetry) return
|
|
32
|
+
if (cliOptions !== null && cliOptions !== void 0 && cliOptions.disableTelemetry) return false;
|
|
33
33
|
|
|
34
34
|
// If we are running init or similar, we just have to go with true here
|
|
35
|
-
if (!presetOptions) return
|
|
35
|
+
if (!presetOptions) return true;
|
|
36
36
|
|
|
37
37
|
// should we load the preset?
|
|
38
38
|
var presets = await (0, _coreCommon.loadAllPresets)(_objectSpread({
|
|
@@ -43,15 +43,15 @@ async function getErrorLevel({
|
|
|
43
43
|
// If the user has chosen to enable/disable crash reports in main.js
|
|
44
44
|
// or disabled telemetry, we can return that
|
|
45
45
|
var core = await presets.apply('core');
|
|
46
|
-
if ((core === null || core === void 0 ? void 0 : core.enableCrashReports) !== undefined) return core.enableCrashReports
|
|
47
|
-
if (core !== null && core !== void 0 && core.disableTelemetry) return
|
|
46
|
+
if ((core === null || core === void 0 ? void 0 : core.enableCrashReports) !== undefined) return core.enableCrashReports;
|
|
47
|
+
if (core !== null && core !== void 0 && core.disableTelemetry) return false;
|
|
48
48
|
|
|
49
49
|
// Deal with typo, remove in future version (7.1?)
|
|
50
50
|
var valueFromCache = (await _coreCommon.cache.get('enableCrashReports')) ?? (await _coreCommon.cache.get('enableCrashreports'));
|
|
51
|
-
if (valueFromCache !== undefined) return valueFromCache
|
|
51
|
+
if (valueFromCache !== undefined) return valueFromCache;
|
|
52
52
|
var valueFromPrompt = await promptCrashReports();
|
|
53
|
-
if (valueFromPrompt !== undefined) return valueFromPrompt
|
|
54
|
-
return
|
|
53
|
+
if (valueFromPrompt !== undefined) return valueFromPrompt;
|
|
54
|
+
return true;
|
|
55
55
|
}
|
|
56
56
|
async function withTelemetry(eventType, options, run) {
|
|
57
57
|
(0, _telemetry.telemetry)('boot', {
|
|
@@ -63,18 +63,15 @@ async function withTelemetry(eventType, options, run) {
|
|
|
63
63
|
await run();
|
|
64
64
|
} catch (error) {
|
|
65
65
|
try {
|
|
66
|
-
|
|
67
|
-
if (errorLevel !== 'none') {
|
|
66
|
+
if (await shouldSendError(options)) {
|
|
68
67
|
var _options$cliOptions, _options$presetOption;
|
|
69
|
-
var precedingUpgrade = await (0, _telemetry.getPrecedingUpgrade)();
|
|
70
68
|
await (0, _telemetry.telemetry)('error', {
|
|
71
69
|
eventType: eventType,
|
|
72
|
-
|
|
73
|
-
error: errorLevel === 'full' ? error : undefined
|
|
70
|
+
error: error
|
|
74
71
|
}, {
|
|
75
72
|
immediate: true,
|
|
76
73
|
configDir: ((_options$cliOptions = options.cliOptions) === null || _options$cliOptions === void 0 ? void 0 : _options$cliOptions.configDir) || ((_options$presetOption = options.presetOptions) === null || _options$presetOption === void 0 ? void 0 : _options$presetOption.configDir),
|
|
77
|
-
enableCrashReports:
|
|
74
|
+
enableCrashReports: true
|
|
78
75
|
});
|
|
79
76
|
}
|
|
80
77
|
} catch (err) {
|
package/dist/esm/build-static.js
CHANGED
|
@@ -13,7 +13,7 @@ import { dirname, isAbsolute, join, resolve } from 'path';
|
|
|
13
13
|
import { dedent } from 'ts-dedent';
|
|
14
14
|
import global from 'global';
|
|
15
15
|
import { logger } from '@storybook/node-logger';
|
|
16
|
-
import { telemetry
|
|
16
|
+
import { telemetry } from '@storybook/telemetry';
|
|
17
17
|
import { loadAllPresets, loadMainConfig, logConfig, normalizeStories, resolveAddonName } from '@storybook/core-common';
|
|
18
18
|
import { outputStats } from './utils/output-stats';
|
|
19
19
|
import { copyAllStaticFiles, copyAllStaticFilesRelativeToMain } from './utils/copy-all-static-files';
|
|
@@ -126,14 +126,9 @@ export async function buildStaticStandalone(options) {
|
|
|
126
126
|
if (!(core !== null && core !== void 0 && core.disableTelemetry)) {
|
|
127
127
|
effects.push(initializedStoryIndexGenerator.then(async function (generator) {
|
|
128
128
|
var storyIndex = await (generator === null || generator === void 0 ? void 0 : generator.getIndex());
|
|
129
|
-
var payload = {
|
|
130
|
-
|
|
131
|
-
};
|
|
132
|
-
if (storyIndex) {
|
|
133
|
-
Object.assign(payload, {
|
|
134
|
-
storyIndex: summarizeIndex(storyIndex)
|
|
135
|
-
});
|
|
136
|
-
}
|
|
129
|
+
var payload = storyIndex ? {
|
|
130
|
+
storyIndex: summarizeIndex(storyIndex)
|
|
131
|
+
} : undefined;
|
|
137
132
|
await telemetry('build', payload, {
|
|
138
133
|
configDir: options.configDir
|
|
139
134
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { telemetry
|
|
1
|
+
import { telemetry } from '@storybook/telemetry';
|
|
2
2
|
import { useStorybookMetadata } from './metadata';
|
|
3
3
|
import { summarizeIndex } from './summarizeIndex';
|
|
4
4
|
import { router } from './router';
|
|
@@ -9,15 +9,10 @@ export async function doTelemetry(core, initializedStoryIndexGenerator, options)
|
|
|
9
9
|
var storyIndex = await (generator === null || generator === void 0 ? void 0 : generator.getIndex());
|
|
10
10
|
var versionCheck = options.versionCheck,
|
|
11
11
|
versionUpdates = options.versionUpdates;
|
|
12
|
-
var payload = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
Object.assign(payload, {
|
|
17
|
-
versionStatus: versionUpdates ? versionStatus(versionCheck) : 'disabled',
|
|
18
|
-
storyIndex: summarizeIndex(storyIndex)
|
|
19
|
-
});
|
|
20
|
-
}
|
|
12
|
+
var payload = storyIndex ? {
|
|
13
|
+
versionStatus: versionUpdates ? versionStatus(versionCheck) : 'disabled',
|
|
14
|
+
storyIndex: summarizeIndex(storyIndex)
|
|
15
|
+
} : undefined;
|
|
21
16
|
telemetry('dev', payload, {
|
|
22
17
|
configDir: options.configDir
|
|
23
18
|
});
|
|
@@ -3,7 +3,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
3
3
|
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; }
|
|
4
4
|
import prompts from 'prompts';
|
|
5
5
|
import { loadAllPresets, cache } from '@storybook/core-common';
|
|
6
|
-
import { telemetry
|
|
6
|
+
import { telemetry } from '@storybook/telemetry';
|
|
7
7
|
var promptCrashReports = async function () {
|
|
8
8
|
if (process.env.CI && process.env.NODE_ENV !== 'test') {
|
|
9
9
|
return undefined;
|
|
@@ -18,14 +18,14 @@ var promptCrashReports = async function () {
|
|
|
18
18
|
await cache.set('enableCrashReports', enableCrashReports);
|
|
19
19
|
return enableCrashReports;
|
|
20
20
|
};
|
|
21
|
-
async function
|
|
21
|
+
async function shouldSendError({
|
|
22
22
|
cliOptions: cliOptions,
|
|
23
23
|
presetOptions: presetOptions
|
|
24
24
|
}) {
|
|
25
|
-
if (cliOptions !== null && cliOptions !== void 0 && cliOptions.disableTelemetry) return
|
|
25
|
+
if (cliOptions !== null && cliOptions !== void 0 && cliOptions.disableTelemetry) return false;
|
|
26
26
|
|
|
27
27
|
// If we are running init or similar, we just have to go with true here
|
|
28
|
-
if (!presetOptions) return
|
|
28
|
+
if (!presetOptions) return true;
|
|
29
29
|
|
|
30
30
|
// should we load the preset?
|
|
31
31
|
var presets = await loadAllPresets(_objectSpread({
|
|
@@ -36,15 +36,15 @@ async function getErrorLevel({
|
|
|
36
36
|
// If the user has chosen to enable/disable crash reports in main.js
|
|
37
37
|
// or disabled telemetry, we can return that
|
|
38
38
|
var core = await presets.apply('core');
|
|
39
|
-
if ((core === null || core === void 0 ? void 0 : core.enableCrashReports) !== undefined) return core.enableCrashReports
|
|
40
|
-
if (core !== null && core !== void 0 && core.disableTelemetry) return
|
|
39
|
+
if ((core === null || core === void 0 ? void 0 : core.enableCrashReports) !== undefined) return core.enableCrashReports;
|
|
40
|
+
if (core !== null && core !== void 0 && core.disableTelemetry) return false;
|
|
41
41
|
|
|
42
42
|
// Deal with typo, remove in future version (7.1?)
|
|
43
43
|
var valueFromCache = (await cache.get('enableCrashReports')) ?? (await cache.get('enableCrashreports'));
|
|
44
|
-
if (valueFromCache !== undefined) return valueFromCache
|
|
44
|
+
if (valueFromCache !== undefined) return valueFromCache;
|
|
45
45
|
var valueFromPrompt = await promptCrashReports();
|
|
46
|
-
if (valueFromPrompt !== undefined) return valueFromPrompt
|
|
47
|
-
return
|
|
46
|
+
if (valueFromPrompt !== undefined) return valueFromPrompt;
|
|
47
|
+
return true;
|
|
48
48
|
}
|
|
49
49
|
export async function withTelemetry(eventType, options, run) {
|
|
50
50
|
telemetry('boot', {
|
|
@@ -56,18 +56,15 @@ export async function withTelemetry(eventType, options, run) {
|
|
|
56
56
|
await run();
|
|
57
57
|
} catch (error) {
|
|
58
58
|
try {
|
|
59
|
-
|
|
60
|
-
if (errorLevel !== 'none') {
|
|
59
|
+
if (await shouldSendError(options)) {
|
|
61
60
|
var _options$cliOptions, _options$presetOption;
|
|
62
|
-
var precedingUpgrade = await getPrecedingUpgrade();
|
|
63
61
|
await telemetry('error', {
|
|
64
62
|
eventType: eventType,
|
|
65
|
-
|
|
66
|
-
error: errorLevel === 'full' ? error : undefined
|
|
63
|
+
error: error
|
|
67
64
|
}, {
|
|
68
65
|
immediate: true,
|
|
69
66
|
configDir: ((_options$cliOptions = options.cliOptions) === null || _options$cliOptions === void 0 ? void 0 : _options$cliOptions.configDir) || ((_options$presetOption = options.presetOptions) === null || _options$presetOption === void 0 ? void 0 : _options$presetOption.configDir),
|
|
70
|
-
enableCrashReports:
|
|
67
|
+
enableCrashReports: true
|
|
71
68
|
});
|
|
72
69
|
}
|
|
73
70
|
} catch (err) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/core-server",
|
|
3
|
-
"version": "7.0.0-beta.
|
|
3
|
+
"version": "7.0.0-beta.1",
|
|
4
4
|
"description": "Storybook framework-agnostic API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook"
|
|
@@ -35,16 +35,16 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@aw-web-design/x-default-browser": "1.4.88",
|
|
37
37
|
"@discoveryjs/json-ext": "^0.5.3",
|
|
38
|
-
"@storybook/builder-manager": "7.0.0-beta.
|
|
39
|
-
"@storybook/core-common": "7.0.0-beta.
|
|
40
|
-
"@storybook/core-events": "7.0.0-beta.
|
|
38
|
+
"@storybook/builder-manager": "7.0.0-beta.1",
|
|
39
|
+
"@storybook/core-common": "7.0.0-beta.1",
|
|
40
|
+
"@storybook/core-events": "7.0.0-beta.1",
|
|
41
41
|
"@storybook/csf": "next",
|
|
42
|
-
"@storybook/csf-tools": "7.0.0-beta.
|
|
42
|
+
"@storybook/csf-tools": "7.0.0-beta.1",
|
|
43
43
|
"@storybook/docs-mdx": "next",
|
|
44
|
-
"@storybook/node-logger": "7.0.0-beta.
|
|
45
|
-
"@storybook/preview-api": "7.0.0-beta.
|
|
46
|
-
"@storybook/telemetry": "7.0.0-beta.
|
|
47
|
-
"@storybook/types": "7.0.0-beta.
|
|
44
|
+
"@storybook/node-logger": "7.0.0-beta.1",
|
|
45
|
+
"@storybook/preview-api": "7.0.0-beta.1",
|
|
46
|
+
"@storybook/telemetry": "7.0.0-beta.1",
|
|
47
|
+
"@storybook/types": "7.0.0-beta.1",
|
|
48
48
|
"@types/node": "^16.0.0",
|
|
49
49
|
"@types/node-fetch": "^2.5.7",
|
|
50
50
|
"@types/pretty-hrtime": "^1.0.0",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"cli-table3": "^0.6.1",
|
|
56
56
|
"compression": "^1.7.4",
|
|
57
57
|
"detect-port": "^1.3.0",
|
|
58
|
-
"express": "^4.17.
|
|
58
|
+
"express": "^4.17.3",
|
|
59
59
|
"fs-extra": "^9.0.1",
|
|
60
60
|
"global": "^4.4.0",
|
|
61
61
|
"globby": "^11.0.2",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"ws": "^8.2.3"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
|
-
"@storybook/builder-webpack5": "7.0.0-beta.
|
|
79
|
+
"@storybook/builder-webpack5": "7.0.0-beta.1",
|
|
80
80
|
"@types/compression": "^1.7.0",
|
|
81
81
|
"@types/ip": "^1.1.0",
|
|
82
82
|
"@types/serve-favicon": "^2.5.2",
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
"publishConfig": {
|
|
102
102
|
"access": "public"
|
|
103
103
|
},
|
|
104
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "42c08678ac06d9c2c8e7a4c31a91e0a14bf5c2cd"
|
|
105
105
|
}
|