@storybook/addon-essentials 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/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
- var requireMain = function requireMain(configDir) {
13
- var _serverRequire;
14
-
15
- var absoluteConfigDir = path.isAbsolute(configDir) ? configDir : path.join(process.cwd(), configDir);
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
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
22
-
23
- var checkInstalled = function checkInstalled(addon, main) {
24
- var _main$addons;
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("Found existing addon ".concat(JSON.stringify(existingAddon), ", skipping."));
19
+ logger.info(`Found existing addon ${JSON.stringify(existingAddon)}, skipping.`);
33
20
  }
34
21
 
35
22
  return !!existingAddon;
36
23
  };
37
24
 
38
- var main = requireMain(options.configDir);
39
- return ['docs', 'controls', 'actions', 'backgrounds', 'viewport', 'toolbars', 'measure', 'outline'].filter(function (key) {
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(function (addon) {
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": "6.5.7",
3
+ "version": "7.0.0-alpha.0",
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/ts3.9/index.d.ts",
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": "6.5.7",
43
- "@storybook/addon-backgrounds": "6.5.7",
44
- "@storybook/addon-controls": "6.5.7",
45
- "@storybook/addon-docs": "6.5.7",
46
- "@storybook/addon-measure": "6.5.7",
47
- "@storybook/addon-outline": "6.5.7",
48
- "@storybook/addon-toolbars": "6.5.7",
49
- "@storybook/addon-viewport": "6.5.7",
50
- "@storybook/addons": "6.5.7",
51
- "@storybook/api": "6.5.7",
52
- "@storybook/core-common": "6.5.7",
53
- "@storybook/node-logger": "6.5.7",
35
+ "@storybook/addon-actions": "7.0.0-alpha.0",
36
+ "@storybook/addon-backgrounds": "7.0.0-alpha.0",
37
+ "@storybook/addon-controls": "7.0.0-alpha.0",
38
+ "@storybook/addon-docs": "7.0.0-alpha.0",
39
+ "@storybook/addon-measure": "7.0.0-alpha.0",
40
+ "@storybook/addon-outline": "7.0.0-alpha.0",
41
+ "@storybook/addon-toolbars": "7.0.0-alpha.0",
42
+ "@storybook/addon-viewport": "7.0.0-alpha.0",
43
+ "@storybook/addons": "7.0.0-alpha.0",
44
+ "@storybook/api": "7.0.0-alpha.0",
45
+ "@storybook/core-common": "7.0.0-alpha.0",
46
+ "@storybook/node-logger": "7.0.0-alpha.0",
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": "6.5.7",
61
- "@types/jest": "^26.0.16",
62
- "@types/webpack-env": "^1.16.0"
53
+ "@storybook/vue": "7.0.0-alpha.0",
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": "7e19d3e734efa14e7cffba146295ca0d3467a8c6",
124
- "sbmodern": "dist/modern/index.js"
100
+ "gitHead": "c82d897ea765da8cf4fbbcc2af1f28c808a93e23"
125
101
  }
@@ -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
- }
@@ -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 {};