@storybook/addon-essentials 7.0.0-alpha.0 → 7.0.0-alpha.3
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/index.js +14 -56
- package/package.json +15 -15
package/dist/cjs/index.js
CHANGED
|
@@ -1,95 +1,53 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
|
-
require("core-js/modules/es.array.iterator.js");
|
|
6
|
-
|
|
7
|
-
require("core-js/modules/es.string.iterator.js");
|
|
8
|
-
|
|
9
|
-
require("core-js/modules/es.weak-map.js");
|
|
10
|
-
|
|
11
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
12
|
-
|
|
13
|
-
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
14
|
-
|
|
15
|
-
require("core-js/modules/es.symbol.js");
|
|
16
|
-
|
|
17
|
-
require("core-js/modules/es.symbol.description.js");
|
|
18
|
-
|
|
19
|
-
require("core-js/modules/es.symbol.iterator.js");
|
|
20
|
-
|
|
21
3
|
Object.defineProperty(exports, "__esModule", {
|
|
22
4
|
value: true
|
|
23
5
|
});
|
|
24
6
|
exports.addons = addons;
|
|
25
7
|
|
|
26
|
-
require("core-js/modules/es.array.join.js");
|
|
27
|
-
|
|
28
|
-
require("core-js/modules/es.array.find.js");
|
|
29
|
-
|
|
30
|
-
require("core-js/modules/es.object.to-string.js");
|
|
31
|
-
|
|
32
|
-
require("core-js/modules/es.function.name.js");
|
|
33
|
-
|
|
34
|
-
require("core-js/modules/es.string.starts-with.js");
|
|
35
|
-
|
|
36
|
-
require("core-js/modules/es.array.map.js");
|
|
37
|
-
|
|
38
|
-
require("core-js/modules/es.array.filter.js");
|
|
39
|
-
|
|
40
8
|
var _path = _interopRequireWildcard(require("path"));
|
|
41
9
|
|
|
42
10
|
var _nodeLogger = require("@storybook/node-logger");
|
|
43
11
|
|
|
44
12
|
var _coreCommon = require("@storybook/core-common");
|
|
45
13
|
|
|
46
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function
|
|
14
|
+
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); }
|
|
47
15
|
|
|
48
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null ||
|
|
16
|
+
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; }
|
|
49
17
|
|
|
50
|
-
|
|
51
|
-
|
|
18
|
+
const requireMain = configDir => {
|
|
19
|
+
const absoluteConfigDir = _path.default.isAbsolute(configDir) ? configDir : _path.default.join(process.cwd(), configDir);
|
|
52
20
|
|
|
53
|
-
|
|
21
|
+
const mainFile = _path.default.join(absoluteConfigDir, 'main');
|
|
54
22
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return (_serverRequire = (0, _coreCommon.serverRequire)(mainFile)) !== null && _serverRequire !== void 0 ? _serverRequire : {};
|
|
23
|
+
return (0, _coreCommon.serverRequire)(mainFile) ?? {};
|
|
58
24
|
};
|
|
59
25
|
|
|
60
|
-
function addons() {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
var checkInstalled = function checkInstalled(addon, main) {
|
|
26
|
+
function addons(options = {}) {
|
|
27
|
+
const checkInstalled = (addon, main) => {
|
|
64
28
|
var _main$addons;
|
|
65
29
|
|
|
66
|
-
|
|
67
|
-
|
|
30
|
+
const existingAddon = (_main$addons = main.addons) === null || _main$addons === void 0 ? void 0 : _main$addons.find(entry => {
|
|
31
|
+
const name = typeof entry === 'string' ? entry : entry.name;
|
|
68
32
|
return name === null || name === void 0 ? void 0 : name.startsWith(addon);
|
|
69
33
|
});
|
|
70
34
|
|
|
71
35
|
if (existingAddon) {
|
|
72
|
-
_nodeLogger.logger.info(
|
|
36
|
+
_nodeLogger.logger.info(`Found existing addon ${JSON.stringify(existingAddon)}, skipping.`);
|
|
73
37
|
}
|
|
74
38
|
|
|
75
39
|
return !!existingAddon;
|
|
76
40
|
};
|
|
77
41
|
|
|
78
|
-
|
|
79
|
-
return ['docs', 'controls', 'actions', 'backgrounds', 'viewport', 'toolbars', 'measure', 'outline'].filter(
|
|
80
|
-
return options[key] !== false;
|
|
81
|
-
}).map(function (key) {
|
|
82
|
-
return "@storybook/addon-".concat(key);
|
|
83
|
-
}).filter(function (addon) {
|
|
84
|
-
return !checkInstalled(addon, main);
|
|
85
|
-
}) // Use `require.resolve` to ensure Yarn PnP compatibility
|
|
42
|
+
const main = requireMain(options.configDir);
|
|
43
|
+
return ['docs', 'controls', 'actions', 'backgrounds', 'viewport', 'toolbars', 'measure', 'outline'].filter(key => options[key] !== false).map(key => `@storybook/addon-${key}`).filter(addon => !checkInstalled(addon, main)) // Use `require.resolve` to ensure Yarn PnP compatibility
|
|
86
44
|
// Files of various addons should be resolved in the context of `addon-essentials` as they are listed as deps here
|
|
87
45
|
// and not in `@storybook/core` nor in SB user projects. If `@storybook/core` make the require itself Yarn 2 will
|
|
88
46
|
// throw an error saying that the package to require must be added as a dependency. Doing `require.resolve` will
|
|
89
47
|
// allow `@storybook/core` to work with absolute path directly, no more require of dep no more issue.
|
|
90
48
|
// File to load can be `preset.js`, `register.js`, or the package entry point, so we need to check all these cases
|
|
91
49
|
// as it's done in `lib/core/src/server/presets.js`.
|
|
92
|
-
.map(
|
|
50
|
+
.map(addon => {
|
|
93
51
|
try {
|
|
94
52
|
return (0, _path.dirname)(require.resolve((0, _path.join)(addon, 'package.json'))); // eslint-disable-next-line no-empty
|
|
95
53
|
} catch (err) {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/addon-essentials",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.3",
|
|
4
4
|
"description": "Curated addons to bring out the best of Storybook",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"addon",
|
|
@@ -32,25 +32,25 @@
|
|
|
32
32
|
"prepare": "node ../../scripts/prepare.js"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@storybook/addon-actions": "7.0.0-alpha.
|
|
36
|
-
"@storybook/addon-backgrounds": "7.0.0-alpha.
|
|
37
|
-
"@storybook/addon-controls": "7.0.0-alpha.
|
|
38
|
-
"@storybook/addon-docs": "7.0.0-alpha.
|
|
39
|
-
"@storybook/addon-measure": "7.0.0-alpha.
|
|
40
|
-
"@storybook/addon-outline": "7.0.0-alpha.
|
|
41
|
-
"@storybook/addon-toolbars": "7.0.0-alpha.
|
|
42
|
-
"@storybook/addon-viewport": "7.0.0-alpha.
|
|
43
|
-
"@storybook/addons": "7.0.0-alpha.
|
|
44
|
-
"@storybook/api": "7.0.0-alpha.
|
|
45
|
-
"@storybook/core-common": "7.0.0-alpha.
|
|
46
|
-
"@storybook/node-logger": "7.0.0-alpha.
|
|
35
|
+
"@storybook/addon-actions": "7.0.0-alpha.3",
|
|
36
|
+
"@storybook/addon-backgrounds": "7.0.0-alpha.3",
|
|
37
|
+
"@storybook/addon-controls": "7.0.0-alpha.3",
|
|
38
|
+
"@storybook/addon-docs": "7.0.0-alpha.3",
|
|
39
|
+
"@storybook/addon-measure": "7.0.0-alpha.3",
|
|
40
|
+
"@storybook/addon-outline": "7.0.0-alpha.3",
|
|
41
|
+
"@storybook/addon-toolbars": "7.0.0-alpha.3",
|
|
42
|
+
"@storybook/addon-viewport": "7.0.0-alpha.3",
|
|
43
|
+
"@storybook/addons": "7.0.0-alpha.3",
|
|
44
|
+
"@storybook/api": "7.0.0-alpha.3",
|
|
45
|
+
"@storybook/core-common": "7.0.0-alpha.3",
|
|
46
|
+
"@storybook/node-logger": "7.0.0-alpha.3",
|
|
47
47
|
"core-js": "^3.8.2",
|
|
48
48
|
"regenerator-runtime": "^0.13.7",
|
|
49
49
|
"ts-dedent": "^2.0.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@babel/core": "^7.12.10",
|
|
53
|
-
"@storybook/vue": "7.0.0-alpha.
|
|
53
|
+
"@storybook/vue": "7.0.0-alpha.3",
|
|
54
54
|
"@types/jest": "^26.0.16"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"publishConfig": {
|
|
98
98
|
"access": "public"
|
|
99
99
|
},
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "629b056190993bcee6445471b8cb27208eb401a9"
|
|
101
101
|
}
|