@storybook/addon-essentials 6.5.9 → 7.0.0-alpha.2
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/dist/esm/index.js +13 -32
- package/dist/{ts3.9 → types}/index.d.ts +0 -0
- package/package.json +17 -41
- package/dist/modern/index.js +0 -44
- package/dist/ts3.4/index.d.ts +0 -13
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/dist/esm/index.js
CHANGED
|
@@ -1,55 +1,36 @@
|
|
|
1
|
-
import "core-js/modules/es.array.join.js";
|
|
2
|
-
import "core-js/modules/es.array.find.js";
|
|
3
|
-
import "core-js/modules/es.object.to-string.js";
|
|
4
|
-
import "core-js/modules/es.function.name.js";
|
|
5
|
-
import "core-js/modules/es.string.starts-with.js";
|
|
6
|
-
import "core-js/modules/es.array.map.js";
|
|
7
|
-
import "core-js/modules/es.array.filter.js";
|
|
8
1
|
import path, { dirname, join } from 'path';
|
|
9
2
|
import { logger } from '@storybook/node-logger';
|
|
10
3
|
import { serverRequire } from '@storybook/core-common';
|
|
11
4
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var mainFile = path.join(absoluteConfigDir, 'main');
|
|
17
|
-
return (_serverRequire = serverRequire(mainFile)) !== null && _serverRequire !== void 0 ? _serverRequire : {};
|
|
5
|
+
const requireMain = configDir => {
|
|
6
|
+
const absoluteConfigDir = path.isAbsolute(configDir) ? configDir : path.join(process.cwd(), configDir);
|
|
7
|
+
const mainFile = path.join(absoluteConfigDir, 'main');
|
|
8
|
+
return serverRequire(mainFile) ?? {};
|
|
18
9
|
};
|
|
19
10
|
|
|
20
|
-
export function addons() {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var existingAddon = (_main$addons = main.addons) === null || _main$addons === void 0 ? void 0 : _main$addons.find(function (entry) {
|
|
27
|
-
var name = typeof entry === 'string' ? entry : entry.name;
|
|
28
|
-
return name === null || name === void 0 ? void 0 : name.startsWith(addon);
|
|
11
|
+
export function addons(options = {}) {
|
|
12
|
+
const checkInstalled = (addon, main) => {
|
|
13
|
+
const existingAddon = main.addons?.find(entry => {
|
|
14
|
+
const name = typeof entry === 'string' ? entry : entry.name;
|
|
15
|
+
return name?.startsWith(addon);
|
|
29
16
|
});
|
|
30
17
|
|
|
31
18
|
if (existingAddon) {
|
|
32
|
-
logger.info(
|
|
19
|
+
logger.info(`Found existing addon ${JSON.stringify(existingAddon)}, skipping.`);
|
|
33
20
|
}
|
|
34
21
|
|
|
35
22
|
return !!existingAddon;
|
|
36
23
|
};
|
|
37
24
|
|
|
38
|
-
|
|
39
|
-
return ['docs', 'controls', 'actions', 'backgrounds', 'viewport', 'toolbars', 'measure', 'outline'].filter(
|
|
40
|
-
return options[key] !== false;
|
|
41
|
-
}).map(function (key) {
|
|
42
|
-
return "@storybook/addon-".concat(key);
|
|
43
|
-
}).filter(function (addon) {
|
|
44
|
-
return !checkInstalled(addon, main);
|
|
45
|
-
}) // Use `require.resolve` to ensure Yarn PnP compatibility
|
|
25
|
+
const main = requireMain(options.configDir);
|
|
26
|
+
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
|
|
46
27
|
// Files of various addons should be resolved in the context of `addon-essentials` as they are listed as deps here
|
|
47
28
|
// and not in `@storybook/core` nor in SB user projects. If `@storybook/core` make the require itself Yarn 2 will
|
|
48
29
|
// throw an error saying that the package to require must be added as a dependency. Doing `require.resolve` will
|
|
49
30
|
// allow `@storybook/core` to work with absolute path directly, no more require of dep no more issue.
|
|
50
31
|
// File to load can be `preset.js`, `register.js`, or the package entry point, so we need to check all these cases
|
|
51
32
|
// as it's done in `lib/core/src/server/presets.js`.
|
|
52
|
-
.map(
|
|
33
|
+
.map(addon => {
|
|
53
34
|
try {
|
|
54
35
|
return dirname(require.resolve(join(addon, 'package.json'))); // eslint-disable-next-line no-empty
|
|
55
36
|
} catch (err) {}
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/addon-essentials",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-alpha.2",
|
|
4
4
|
"description": "Curated addons to bring out the best of Storybook",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"addon",
|
|
@@ -23,14 +23,7 @@
|
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"main": "dist/cjs/index.js",
|
|
25
25
|
"module": "dist/esm/index.js",
|
|
26
|
-
"types": "dist/
|
|
27
|
-
"typesVersions": {
|
|
28
|
-
"<3.8": {
|
|
29
|
-
"dist/ts3.9/*": [
|
|
30
|
-
"dist/ts3.4/*"
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
},
|
|
26
|
+
"types": "dist/types/index.d.ts",
|
|
34
27
|
"files": [
|
|
35
28
|
"dist/**/*",
|
|
36
29
|
"README.md"
|
|
@@ -39,27 +32,26 @@
|
|
|
39
32
|
"prepare": "node ../../scripts/prepare.js"
|
|
40
33
|
},
|
|
41
34
|
"dependencies": {
|
|
42
|
-
"@storybook/addon-actions": "
|
|
43
|
-
"@storybook/addon-backgrounds": "
|
|
44
|
-
"@storybook/addon-controls": "
|
|
45
|
-
"@storybook/addon-docs": "
|
|
46
|
-
"@storybook/addon-measure": "
|
|
47
|
-
"@storybook/addon-outline": "
|
|
48
|
-
"@storybook/addon-toolbars": "
|
|
49
|
-
"@storybook/addon-viewport": "
|
|
50
|
-
"@storybook/addons": "
|
|
51
|
-
"@storybook/api": "
|
|
52
|
-
"@storybook/core-common": "
|
|
53
|
-
"@storybook/node-logger": "
|
|
35
|
+
"@storybook/addon-actions": "7.0.0-alpha.2",
|
|
36
|
+
"@storybook/addon-backgrounds": "7.0.0-alpha.2",
|
|
37
|
+
"@storybook/addon-controls": "7.0.0-alpha.2",
|
|
38
|
+
"@storybook/addon-docs": "7.0.0-alpha.2",
|
|
39
|
+
"@storybook/addon-measure": "7.0.0-alpha.2",
|
|
40
|
+
"@storybook/addon-outline": "7.0.0-alpha.2",
|
|
41
|
+
"@storybook/addon-toolbars": "7.0.0-alpha.2",
|
|
42
|
+
"@storybook/addon-viewport": "7.0.0-alpha.2",
|
|
43
|
+
"@storybook/addons": "7.0.0-alpha.2",
|
|
44
|
+
"@storybook/api": "7.0.0-alpha.2",
|
|
45
|
+
"@storybook/core-common": "7.0.0-alpha.2",
|
|
46
|
+
"@storybook/node-logger": "7.0.0-alpha.2",
|
|
54
47
|
"core-js": "^3.8.2",
|
|
55
48
|
"regenerator-runtime": "^0.13.7",
|
|
56
49
|
"ts-dedent": "^2.0.0"
|
|
57
50
|
},
|
|
58
51
|
"devDependencies": {
|
|
59
52
|
"@babel/core": "^7.12.10",
|
|
60
|
-
"@storybook/vue": "
|
|
61
|
-
"@types/jest": "^26.0.16"
|
|
62
|
-
"@types/webpack-env": "^1.16.0"
|
|
53
|
+
"@storybook/vue": "7.0.0-alpha.2",
|
|
54
|
+
"@types/jest": "^26.0.16"
|
|
63
55
|
},
|
|
64
56
|
"peerDependencies": {
|
|
65
57
|
"@babel/core": "^7.9.6"
|
|
@@ -68,18 +60,6 @@
|
|
|
68
60
|
"@storybook/angular": {
|
|
69
61
|
"optional": true
|
|
70
62
|
},
|
|
71
|
-
"@storybook/builder-manager4": {
|
|
72
|
-
"optional": true
|
|
73
|
-
},
|
|
74
|
-
"@storybook/builder-manager5": {
|
|
75
|
-
"optional": true
|
|
76
|
-
},
|
|
77
|
-
"@storybook/builder-webpack4": {
|
|
78
|
-
"optional": true
|
|
79
|
-
},
|
|
80
|
-
"@storybook/builder-webpack5": {
|
|
81
|
-
"optional": true
|
|
82
|
-
},
|
|
83
63
|
"@storybook/html": {
|
|
84
64
|
"optional": true
|
|
85
65
|
},
|
|
@@ -112,14 +92,10 @@
|
|
|
112
92
|
},
|
|
113
93
|
"vue": {
|
|
114
94
|
"optional": true
|
|
115
|
-
},
|
|
116
|
-
"webpack": {
|
|
117
|
-
"optional": true
|
|
118
95
|
}
|
|
119
96
|
},
|
|
120
97
|
"publishConfig": {
|
|
121
98
|
"access": "public"
|
|
122
99
|
},
|
|
123
|
-
"gitHead": "
|
|
124
|
-
"sbmodern": "dist/modern/index.js"
|
|
100
|
+
"gitHead": "44920e2b6bd51981bac5124743c29fb9f5517e44"
|
|
125
101
|
}
|
package/dist/modern/index.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import path, { dirname, join } from 'path';
|
|
2
|
-
import { logger } from '@storybook/node-logger';
|
|
3
|
-
import { serverRequire } from '@storybook/core-common';
|
|
4
|
-
|
|
5
|
-
const requireMain = configDir => {
|
|
6
|
-
var _serverRequire;
|
|
7
|
-
|
|
8
|
-
const absoluteConfigDir = path.isAbsolute(configDir) ? configDir : path.join(process.cwd(), configDir);
|
|
9
|
-
const mainFile = path.join(absoluteConfigDir, 'main');
|
|
10
|
-
return (_serverRequire = serverRequire(mainFile)) !== null && _serverRequire !== void 0 ? _serverRequire : {};
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export function addons(options = {}) {
|
|
14
|
-
const checkInstalled = (addon, main) => {
|
|
15
|
-
var _main$addons;
|
|
16
|
-
|
|
17
|
-
const existingAddon = (_main$addons = main.addons) === null || _main$addons === void 0 ? void 0 : _main$addons.find(entry => {
|
|
18
|
-
const name = typeof entry === 'string' ? entry : entry.name;
|
|
19
|
-
return name === null || name === void 0 ? void 0 : name.startsWith(addon);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
if (existingAddon) {
|
|
23
|
-
logger.info(`Found existing addon ${JSON.stringify(existingAddon)}, skipping.`);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return !!existingAddon;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const main = requireMain(options.configDir);
|
|
30
|
-
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
|
|
31
|
-
// Files of various addons should be resolved in the context of `addon-essentials` as they are listed as deps here
|
|
32
|
-
// and not in `@storybook/core` nor in SB user projects. If `@storybook/core` make the require itself Yarn 2 will
|
|
33
|
-
// throw an error saying that the package to require must be added as a dependency. Doing `require.resolve` will
|
|
34
|
-
// allow `@storybook/core` to work with absolute path directly, no more require of dep no more issue.
|
|
35
|
-
// File to load can be `preset.js`, `register.js`, or the package entry point, so we need to check all these cases
|
|
36
|
-
// as it's done in `lib/core/src/server/presets.js`.
|
|
37
|
-
.map(addon => {
|
|
38
|
-
try {
|
|
39
|
-
return dirname(require.resolve(join(addon, 'package.json'))); // eslint-disable-next-line no-empty
|
|
40
|
-
} catch (err) {}
|
|
41
|
-
|
|
42
|
-
return require.resolve(addon);
|
|
43
|
-
});
|
|
44
|
-
}
|
package/dist/ts3.4/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
interface PresetOptions {
|
|
2
|
-
configDir?: string;
|
|
3
|
-
docs?: boolean;
|
|
4
|
-
controls?: boolean;
|
|
5
|
-
actions?: boolean;
|
|
6
|
-
backgrounds?: boolean;
|
|
7
|
-
viewport?: boolean;
|
|
8
|
-
toolbars?: boolean;
|
|
9
|
-
measure?: boolean;
|
|
10
|
-
outline?: boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare function addons(options?: PresetOptions): string[];
|
|
13
|
-
export {};
|