@storybook/addon-essentials 7.0.0-alpha.4 → 7.0.0-alpha.40

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/README.md CHANGED
@@ -8,12 +8,14 @@ Each addon is documented and maintained by the core team and will be upgraded al
8
8
 
9
9
  Storybook essentials includes the following addons. Addons can be disabled and re-configured as [described below](#configuration):
10
10
 
11
- - [Actions](https://github.com/storybookjs/storybook/tree/next/addons/actions)
12
- - [Backgrounds](https://github.com/storybookjs/storybook/tree/next/addons/backgrounds)
13
- - [Controls](https://github.com/storybookjs/storybook/tree/next/addons/controls)
14
- - [Docs](https://github.com/storybookjs/storybook/tree/next/addons/docs)
15
- - [Viewport](https://github.com/storybookjs/storybook/tree/next/addons/viewport)
16
- - [Toolbars](https://github.com/storybookjs/storybook/tree/next/addons/toolbars)
11
+ - [Actions](https://github.com/storybookjs/storybook/tree/next/code/addons/actions)
12
+ - [Backgrounds](https://github.com/storybookjs/storybook/tree/next/code/addons/backgrounds)
13
+ - [Controls](https://github.com/storybookjs/storybook/tree/next/code/addons/controls)
14
+ - [Docs](https://github.com/storybookjs/storybook/tree/next/code/addons/docs)
15
+ - [Viewport](https://github.com/storybookjs/storybook/tree/next/code/addons/viewport)
16
+ - [Toolbars](https://github.com/storybookjs/storybook/tree/next/code/addons/toolbars)
17
+ - [Measure](https://github.com/storybookjs/storybook/tree/next/code/addons/measure)
18
+ - [Outline](https://github.com/storybookjs/storybook/tree/next/code/addons/outline)
17
19
 
18
20
  ## Installation
19
21
 
@@ -9,5 +9,6 @@ interface PresetOptions {
9
9
  measure?: boolean;
10
10
  outline?: boolean;
11
11
  }
12
- export declare function addons(options: PresetOptions): string[];
13
- export {};
12
+ declare function addons(options: PresetOptions): string[];
13
+
14
+ export { addons };
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var m=Object.create;var s=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var v=(o,n)=>{for(var e in n)s(o,e,{get:n[e],enumerable:!0})},g=(o,n,e,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of f(n))!k.call(o,t)&&t!==e&&s(o,t,{get:()=>n[t],enumerable:!(r=p(n,t))||r.enumerable});return o};var j=(o,n,e)=>(e=o!=null?m(h(o)):{},g(n||!o||!o.__esModule?s(e,"default",{value:o,enumerable:!0}):e,o)),q=o=>g(s({},"__esModule",{value:!0}),o);var x={};v(x,{addons:()=>w});module.exports=q(x);var i=j(require("path")),d=require("@storybook/node-logger"),b=require("@storybook/core-common"),y=o=>{let n=i.default.isAbsolute(o)?o:i.default.join(process.cwd(),o),e=i.default.join(n,"main");return(0,b.serverRequire)(e)??{}};function w(o){let n=(r,t)=>{var u;let a=(u=t.addons)==null?void 0:u.find(l=>{let c=typeof l=="string"?l:l.name;return c==null?void 0:c.startsWith(r)});return a&&d.logger.info(`Found existing addon ${JSON.stringify(a)}, skipping.`),!!a},e=y(o.configDir);return["docs","controls","actions","backgrounds","viewport","toolbars","measure","outline","highlight"].filter(r=>o[r]!==!1).map(r=>`@storybook/addon-${r}`).filter(r=>!n(r,e)).map(r=>{try{return(0,i.dirname)(require.resolve((0,i.join)(r,"package.json")))}catch{}return require.resolve(r)})}0&&(module.exports={addons});
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ var s=(o=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(o,{get:(e,r)=>(typeof require!="undefined"?require:e)[r]}):o)(function(o){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+o+'" is not supported')});import a,{dirname as c,join as u}from"path";import{logger as g}from"@storybook/node-logger";import{serverRequire as m}from"@storybook/core-common";var d=o=>{let e=a.isAbsolute(o)?o:a.join(process.cwd(),o),r=a.join(e,"main");return m(r)??{}};function j(o){let e=(n,l)=>{let t=l.addons?.find(i=>(typeof i=="string"?i:i.name)?.startsWith(n));return t&&g.info(`Found existing addon ${JSON.stringify(t)}, skipping.`),!!t},r=d(o.configDir);return["docs","controls","actions","backgrounds","viewport","toolbars","measure","outline","highlight"].filter(n=>o[n]!==!1).map(n=>`@storybook/addon-${n}`).filter(n=>!e(n,r)).map(n=>{try{return c(s.resolve(u(n,"package.json")))}catch{}return s.resolve(n)})}export{j as addons};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/addon-essentials",
3
- "version": "7.0.0-alpha.4",
3
+ "version": "7.0.0-alpha.40",
4
4
  "description": "Curated addons to bring out the best of Storybook",
5
5
  "keywords": [
6
6
  "addon",
@@ -21,36 +21,46 @@
21
21
  "url": "https://opencollective.com/storybook"
22
22
  },
23
23
  "license": "MIT",
24
- "main": "dist/cjs/index.js",
25
- "module": "dist/esm/index.js",
26
- "types": "dist/types/index.d.ts",
24
+ "exports": {
25
+ ".": {
26
+ "require": "./dist/index.js",
27
+ "import": "./dist/index.mjs",
28
+ "types": "./dist/index.d.ts"
29
+ },
30
+ "./package.json": "./package.json"
31
+ },
32
+ "main": "dist/index.js",
33
+ "module": "dist/index.mjs",
34
+ "types": "dist/index.d.ts",
27
35
  "files": [
28
36
  "dist/**/*",
29
37
  "README.md"
30
38
  ],
31
39
  "scripts": {
32
- "prepare": "node ../../scripts/prepare.js"
40
+ "check": "../../../scripts/node_modules/.bin/tsc --noEmit",
41
+ "prep": "../../../scripts/prepare/bundle.ts"
33
42
  },
34
43
  "dependencies": {
35
- "@storybook/addon-actions": "7.0.0-alpha.4",
36
- "@storybook/addon-backgrounds": "7.0.0-alpha.4",
37
- "@storybook/addon-controls": "7.0.0-alpha.4",
38
- "@storybook/addon-docs": "7.0.0-alpha.4",
39
- "@storybook/addon-measure": "7.0.0-alpha.4",
40
- "@storybook/addon-outline": "7.0.0-alpha.4",
41
- "@storybook/addon-toolbars": "7.0.0-alpha.4",
42
- "@storybook/addon-viewport": "7.0.0-alpha.4",
43
- "@storybook/addons": "7.0.0-alpha.4",
44
- "@storybook/api": "7.0.0-alpha.4",
45
- "@storybook/core-common": "7.0.0-alpha.4",
46
- "@storybook/node-logger": "7.0.0-alpha.4",
47
- "core-js": "^3.8.2",
44
+ "@storybook/addon-actions": "7.0.0-alpha.40",
45
+ "@storybook/addon-backgrounds": "7.0.0-alpha.40",
46
+ "@storybook/addon-controls": "7.0.0-alpha.40",
47
+ "@storybook/addon-docs": "7.0.0-alpha.40",
48
+ "@storybook/addon-highlight": "7.0.0-alpha.40",
49
+ "@storybook/addon-measure": "7.0.0-alpha.40",
50
+ "@storybook/addon-outline": "7.0.0-alpha.40",
51
+ "@storybook/addon-toolbars": "7.0.0-alpha.40",
52
+ "@storybook/addon-viewport": "7.0.0-alpha.40",
53
+ "@storybook/addons": "7.0.0-alpha.40",
54
+ "@storybook/api": "7.0.0-alpha.40",
55
+ "@storybook/core-common": "7.0.0-alpha.40",
56
+ "@storybook/node-logger": "7.0.0-alpha.40",
48
57
  "ts-dedent": "^2.0.0"
49
58
  },
50
59
  "devDependencies": {
51
60
  "@babel/core": "^7.12.10",
52
- "@storybook/vue": "7.0.0-alpha.4",
53
- "@types/jest": "^26.0.16"
61
+ "@storybook/vue": "7.0.0-alpha.40",
62
+ "@types/jest": "^26.0.16",
63
+ "typescript": "~4.6.3"
54
64
  },
55
65
  "peerDependencies": {
56
66
  "@babel/core": "^7.9.6"
@@ -96,5 +106,11 @@
96
106
  "publishConfig": {
97
107
  "access": "public"
98
108
  },
99
- "gitHead": "006ed54452dd7c37a8cbe91a84f5312182f7ca00"
109
+ "bundler": {
110
+ "entries": [
111
+ "./src/index.ts"
112
+ ],
113
+ "platform": "node"
114
+ },
115
+ "gitHead": "8f6d8629f1ad7e776c39e2c7621f4a0d538aa93c"
100
116
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2017 Kadira Inc. <hello@kadira.io>
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
package/dist/cjs/index.js DELETED
@@ -1,57 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.addons = addons;
7
-
8
- var _path = _interopRequireWildcard(require("path"));
9
-
10
- var _nodeLogger = require("@storybook/node-logger");
11
-
12
- var _coreCommon = require("@storybook/core-common");
13
-
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); }
15
-
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; }
17
-
18
- const requireMain = configDir => {
19
- const absoluteConfigDir = _path.default.isAbsolute(configDir) ? configDir : _path.default.join(process.cwd(), configDir);
20
-
21
- const mainFile = _path.default.join(absoluteConfigDir, 'main');
22
-
23
- return (0, _coreCommon.serverRequire)(mainFile) ?? {};
24
- };
25
-
26
- function addons(options) {
27
- const checkInstalled = (addon, main) => {
28
- var _main$addons;
29
-
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;
32
- return name === null || name === void 0 ? void 0 : name.startsWith(addon);
33
- });
34
-
35
- if (existingAddon) {
36
- _nodeLogger.logger.info(`Found existing addon ${JSON.stringify(existingAddon)}, skipping.`);
37
- }
38
-
39
- return !!existingAddon;
40
- };
41
-
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
44
- // Files of various addons should be resolved in the context of `addon-essentials` as they are listed as deps here
45
- // and not in `@storybook/core` nor in SB user projects. If `@storybook/core` make the require itself Yarn 2 will
46
- // throw an error saying that the package to require must be added as a dependency. Doing `require.resolve` will
47
- // allow `@storybook/core` to work with absolute path directly, no more require of dep no more issue.
48
- // File to load can be `preset.js`, `register.js`, or the package entry point, so we need to check all these cases
49
- // as it's done in `lib/core/src/server/presets.js`.
50
- .map(addon => {
51
- try {
52
- return (0, _path.dirname)(require.resolve((0, _path.join)(addon, 'package.json'))); // eslint-disable-next-line no-empty
53
- } catch (err) {}
54
-
55
- return require.resolve(addon);
56
- });
57
- }
package/dist/esm/index.js DELETED
@@ -1,40 +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
- const absoluteConfigDir = path.isAbsolute(configDir) ? configDir : path.join(process.cwd(), configDir);
7
- const mainFile = path.join(absoluteConfigDir, 'main');
8
- return serverRequire(mainFile) ?? {};
9
- };
10
-
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);
16
- });
17
-
18
- if (existingAddon) {
19
- logger.info(`Found existing addon ${JSON.stringify(existingAddon)}, skipping.`);
20
- }
21
-
22
- return !!existingAddon;
23
- };
24
-
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
27
- // Files of various addons should be resolved in the context of `addon-essentials` as they are listed as deps here
28
- // and not in `@storybook/core` nor in SB user projects. If `@storybook/core` make the require itself Yarn 2 will
29
- // throw an error saying that the package to require must be added as a dependency. Doing `require.resolve` will
30
- // allow `@storybook/core` to work with absolute path directly, no more require of dep no more issue.
31
- // File to load can be `preset.js`, `register.js`, or the package entry point, so we need to check all these cases
32
- // as it's done in `lib/core/src/server/presets.js`.
33
- .map(addon => {
34
- try {
35
- return dirname(require.resolve(join(addon, 'package.json'))); // eslint-disable-next-line no-empty
36
- } catch (err) {}
37
-
38
- return require.resolve(addon);
39
- });
40
- }