@storybook/react 5.3.10 → 5.3.14

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.
@@ -138,7 +138,7 @@ var Welcome = function Welcome(_ref4) {
138
138
  var showApp = _ref4.showApp;
139
139
  return _react["default"].createElement(Main, null, _react["default"].createElement(Title, null, "Welcome to storybook"), _react["default"].createElement("p", null, "This is a UI component dev environment for your app."), _react["default"].createElement("p", null, "We've added some basic stories inside the ", _react["default"].createElement(InlineCode, null, "src/stories"), " directory.", _react["default"].createElement("br", null), "A story is a single state of one or more UI components. You can have as many stories as you want.", _react["default"].createElement("br", null), "(Basically a story is like a visual test case.)"), _react["default"].createElement("p", null, "See these sample ", _react["default"].createElement(NavButton, {
140
140
  onClick: showApp
141
- }, "stories"), " for a component called\xA0", _react["default"].createElement(InlineCode, null, "Button"), "."), _react["default"].createElement("p", null, "Just like that, you can add your own components as stories.", _react["default"].createElement("br", null), "You can also edit those components and see changes right away.", _react["default"].createElement("br", null), "(Try editing the ", _react["default"].createElement(InlineCode, null, "Button"), " stories located at\xA0", _react["default"].createElement(InlineCode, null, "src/stories/index.js"), ".)"), _react["default"].createElement("p", null, "Usually we create stories with smaller UI components in the app.", _react["default"].createElement("br", null), "Have a look at the\xA0", _react["default"].createElement(Link, {
141
+ }, "stories"), " for a component called\xA0", _react["default"].createElement(InlineCode, null, "Button"), "."), _react["default"].createElement("p", null, "Just like that, you can add your own components as stories.", _react["default"].createElement("br", null), "You can also edit those components and see changes right away.", _react["default"].createElement("br", null), "(Try editing the ", _react["default"].createElement(InlineCode, null, "Button"), " stories located at\xA0", _react["default"].createElement(InlineCode, null, "src/stories/1-Button.stories.js"), ".)"), _react["default"].createElement("p", null, "Usually we create stories with smaller UI components in the app.", _react["default"].createElement("br", null), "Have a look at the\xA0", _react["default"].createElement(Link, {
142
142
  href: "https://storybook.js.org/basics/writing-stories",
143
143
  target: "_blank",
144
144
  rel: "noopener noreferrer"
@@ -17,8 +17,6 @@ var _path = _interopRequireDefault(require("path"));
17
17
 
18
18
  var _semver = _interopRequireDefault(require("semver"));
19
19
 
20
- var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
21
-
22
20
  var _RuleSet = require("webpack/lib/RuleSet");
23
21
 
24
22
  var _nodeLogger = require("@storybook/node-logger");
@@ -167,14 +165,14 @@ function applyCRAWebpackConfig(baseConfig, configDir) {
167
165
 
168
166
  const craWebpackConfig = getCraWebpackConfig(baseConfig.mode);
169
167
  const craStyleRules = getStyleRules(craWebpackConfig.module.rules);
170
- const craTypeScriptRules = hasTsSupport ? getTypeScriptRules(craWebpackConfig.module.rules, configDir) : []; // Add css minification for production
171
-
172
- const plugins = [...baseConfig.plugins];
173
-
174
- if (baseConfig.mode === 'production') {
175
- // @ts-ignore
176
- plugins.push(new _miniCssExtractPlugin.default());
177
- }
168
+ const craTypeScriptRules = hasTsSupport ? getTypeScriptRules(craWebpackConfig.module.rules, configDir) : []; // I disabled the MiniCssExtractPlugin, because there's often a version mismatch between CRA & storybook
169
+ // causing a lot of issues of the build-storybook failing
170
+ // Add css minification for production
171
+
172
+ const plugins = [...baseConfig.plugins]; // if (baseConfig.mode === 'production') {
173
+ // // @ts-ignore
174
+ // plugins.push(new MiniCssExtractPlugin());
175
+ // }
178
176
 
179
177
  return _objectSpread({}, baseConfig, {
180
178
  module: _objectSpread({}, baseConfig.module, {
@@ -36,7 +36,6 @@ export declare function babelDefault(config: Configuration, { presetsList }: {
36
36
  cache?: boolean | object;
37
37
  watch?: boolean;
38
38
  watchOptions?: import("webpack").ICompiler.WatchOptions;
39
- debug?: boolean;
40
39
  node?: false | import("webpack").Node;
41
40
  amd?: {
42
41
  [moduleName: string]: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/react",
3
- "version": "5.3.10",
3
+ "version": "5.3.14",
4
4
  "description": "Storybook for React: Develop React Component in isolation with Hot Reloading.",
5
5
  "keywords": [
6
6
  "storybook"
@@ -15,13 +15,6 @@
15
15
  "directory": "app/react"
16
16
  },
17
17
  "license": "MIT",
18
- "files": [
19
- "bin/**/*",
20
- "dist/**/*",
21
- "README.md",
22
- "*.js",
23
- "*.d.ts"
24
- ],
25
18
  "main": "dist/client/index.js",
26
19
  "types": "dist/client/index.d.ts",
27
20
  "bin": {
@@ -29,6 +22,14 @@
29
22
  "start-storybook": "./bin/index.js",
30
23
  "storybook-server": "./bin/index.js"
31
24
  },
25
+ "files": [
26
+ "bin/**/*",
27
+ "dist/**/*",
28
+ "README.md",
29
+ "*.js",
30
+ "*.d.ts",
31
+ "ts3.5/**/*"
32
+ ],
32
33
  "scripts": {
33
34
  "prepare": "node ../../scripts/prepare.js"
34
35
  },
@@ -36,9 +37,9 @@
36
37
  "@babel/plugin-transform-react-constant-elements": "^7.6.3",
37
38
  "@babel/preset-flow": "^7.0.0",
38
39
  "@babel/preset-react": "^7.0.0",
39
- "@storybook/addons": "5.3.10",
40
- "@storybook/core": "5.3.10",
41
- "@storybook/node-logger": "5.3.10",
40
+ "@storybook/addons": "5.3.14",
41
+ "@storybook/core": "5.3.14",
42
+ "@storybook/node-logger": "5.3.14",
42
43
  "@svgr/webpack": "^4.0.3",
43
44
  "@types/webpack-env": "^1.15.0",
44
45
  "babel-plugin-add-react-displayname": "^0.0.5",
@@ -47,7 +48,7 @@
47
48
  "core-js": "^3.0.1",
48
49
  "global": "^4.3.2",
49
50
  "lodash": "^4.17.15",
50
- "mini-css-extract-plugin": "^0.9.0",
51
+ "mini-css-extract-plugin": "^0.7.0",
51
52
  "prop-types": "^15.7.2",
52
53
  "react-dev-utils": "^9.0.0",
53
54
  "regenerator-runtime": "^0.13.3",
@@ -72,5 +73,12 @@
72
73
  "publishConfig": {
73
74
  "access": "public"
74
75
  },
75
- "gitHead": "589bec8cb46cf8a32c887ac1d81fddc27e4aaac7"
76
+ "gitHead": "91d9c0c4e0afd7e494b23ec8076b21e45b7a8906",
77
+ "typesVersions": {
78
+ "<=3.5": {
79
+ "*": [
80
+ "ts3.5/*"
81
+ ]
82
+ }
83
+ }
76
84
  }
@@ -0,0 +1 @@
1
+ export { storiesOf, setAddon, addDecorator, DecoratorFn, addParameters, configure, getStorybook, raw, forceReRender, } from './preview';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,24 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="webpack-env" />
3
+ import { ClientStoryApi, Loadable } from '@storybook/addons';
4
+ import './globals';
5
+ import { IStorybookSection, StoryFnReactReturnType } from './types';
6
+ interface ClientApi extends ClientStoryApi<StoryFnReactReturnType> {
7
+ setAddon(addon: any): void;
8
+ configure(loader: Loadable, module: NodeModule): void;
9
+ getStorybook(): IStorybookSection[];
10
+ clearDecorators(): void;
11
+ forceReRender(): void;
12
+ raw: () => any;
13
+ }
14
+ export declare const storiesOf: ClientApi['storiesOf'];
15
+ export declare const configure: ClientApi['configure'];
16
+ export declare const addDecorator: ClientApi['addDecorator'];
17
+ export declare type DecoratorFn = Parameters<typeof addDecorator>[0];
18
+ export declare const addParameters: ClientApi['addParameters'];
19
+ export declare const clearDecorators: ClientApi['clearDecorators'];
20
+ export declare const setAddon: ClientApi['setAddon'];
21
+ export declare const forceReRender: ClientApi['forceReRender'];
22
+ export declare const getStorybook: ClientApi['getStorybook'];
23
+ export declare const raw: ClientApi['raw'];
24
+ export {};
@@ -0,0 +1,2 @@
1
+ import { RenderMainArgs } from './types';
2
+ export default function renderMain({ storyFn: StoryFn, showMain, showException, forceRender, }: RenderMainArgs): Promise<void>;
@@ -0,0 +1,23 @@
1
+ import { FunctionComponent, ReactElement } from 'react';
2
+ export interface ShowErrorArgs {
3
+ title: string;
4
+ description: string;
5
+ }
6
+ export interface RenderMainArgs {
7
+ storyFn: FunctionComponent<any>;
8
+ selectedKind: string;
9
+ selectedStory: string;
10
+ showMain: () => void;
11
+ showError: (args: ShowErrorArgs) => void;
12
+ showException: (err: Error) => void;
13
+ forceRender: boolean;
14
+ }
15
+ export declare type StoryFnReactReturnType = ReactElement<unknown>;
16
+ export interface IStorybookStory {
17
+ name: string;
18
+ render: () => any;
19
+ }
20
+ export interface IStorybookSection {
21
+ kind: string;
22
+ stories: IStorybookStory[];
23
+ }
@@ -0,0 +1,4 @@
1
+ import { FunctionComponent, HTMLAttributes } from 'react';
2
+ declare type Props = Pick<HTMLAttributes<HTMLButtonElement>, 'onClick'>;
3
+ declare const Button: FunctionComponent<Props>;
4
+ export default Button;
@@ -0,0 +1,6 @@
1
+ import { FunctionComponent } from 'react';
2
+ declare type WelcomeProps = {
3
+ showApp: () => void;
4
+ };
5
+ declare const Welcome: FunctionComponent<WelcomeProps>;
6
+ export { Welcome as default };
@@ -0,0 +1,25 @@
1
+ declare class BaseTestPlugin1 {
2
+ }
3
+ declare class BaseTestPlugin2 {
4
+ }
5
+ declare const _default: {
6
+ devtool: string;
7
+ resolve: {
8
+ extensions: string[];
9
+ alias: {
10
+ baseAlias: string;
11
+ };
12
+ modules: any[];
13
+ };
14
+ module: {
15
+ noParse: RegExp;
16
+ rules: {
17
+ test: RegExp;
18
+ include: string;
19
+ loader: string;
20
+ options: {};
21
+ }[];
22
+ };
23
+ plugins: (BaseTestPlugin1 | BaseTestPlugin2)[];
24
+ };
25
+ export default _default;
@@ -0,0 +1,189 @@
1
+ declare const _default: ({
2
+ parser: {
3
+ requireEnsure: boolean;
4
+ };
5
+ test?: undefined;
6
+ enforce?: undefined;
7
+ use?: undefined;
8
+ include?: undefined;
9
+ oneOf?: undefined;
10
+ } | {
11
+ test: RegExp;
12
+ enforce: string;
13
+ use: {
14
+ options: {
15
+ formatter: string;
16
+ eslintPath: string;
17
+ baseConfig: {
18
+ extends: string[];
19
+ };
20
+ ignore: boolean;
21
+ useEslintrc: boolean;
22
+ };
23
+ loader: string;
24
+ }[];
25
+ include: string;
26
+ parser?: undefined;
27
+ oneOf?: undefined;
28
+ } | {
29
+ oneOf: ({
30
+ test: RegExp[];
31
+ loader: string;
32
+ options: {
33
+ limit: number;
34
+ name: string;
35
+ customize?: undefined;
36
+ babelrc?: undefined;
37
+ configFile?: undefined;
38
+ presets?: undefined;
39
+ cacheIdentifier?: undefined;
40
+ plugins?: undefined;
41
+ cacheDirectory?: undefined;
42
+ cacheCompression?: undefined;
43
+ compact?: undefined;
44
+ sourceMaps?: undefined;
45
+ };
46
+ include?: undefined;
47
+ exclude?: undefined;
48
+ use?: undefined;
49
+ sideEffects?: undefined;
50
+ } | {
51
+ test: RegExp;
52
+ include: string;
53
+ loader: string;
54
+ options: {
55
+ customize: string;
56
+ babelrc: boolean;
57
+ configFile: boolean;
58
+ presets: string[];
59
+ cacheIdentifier: string;
60
+ plugins: (string | {
61
+ loaderMap: {
62
+ svg: {
63
+ ReactComponent: string;
64
+ };
65
+ };
66
+ })[][];
67
+ cacheDirectory: boolean;
68
+ cacheCompression: boolean;
69
+ compact: boolean;
70
+ limit?: undefined;
71
+ name?: undefined;
72
+ sourceMaps?: undefined;
73
+ };
74
+ exclude?: undefined;
75
+ use?: undefined;
76
+ sideEffects?: undefined;
77
+ } | {
78
+ test: RegExp;
79
+ exclude: {};
80
+ loader: string;
81
+ options: {
82
+ babelrc: boolean;
83
+ configFile: boolean;
84
+ compact: boolean;
85
+ presets: (string | {
86
+ helpers: boolean;
87
+ })[][];
88
+ cacheDirectory: boolean;
89
+ cacheCompression: boolean;
90
+ cacheIdentifier: string;
91
+ sourceMaps: boolean;
92
+ limit?: undefined;
93
+ name?: undefined;
94
+ customize?: undefined;
95
+ plugins?: undefined;
96
+ };
97
+ include?: undefined;
98
+ use?: undefined;
99
+ sideEffects?: undefined;
100
+ } | {
101
+ test: RegExp;
102
+ exclude: {};
103
+ use: (string | {
104
+ loader: string;
105
+ options: {
106
+ importLoaders: number;
107
+ sourceMap: boolean;
108
+ ident?: undefined;
109
+ };
110
+ } | {
111
+ loader: string;
112
+ options: {
113
+ ident: string;
114
+ sourceMap: boolean;
115
+ importLoaders?: undefined;
116
+ };
117
+ } | {
118
+ loader: string;
119
+ options: {
120
+ sourceMap: boolean;
121
+ importLoaders?: undefined;
122
+ ident?: undefined;
123
+ };
124
+ })[];
125
+ sideEffects: boolean;
126
+ loader?: undefined;
127
+ options?: undefined;
128
+ include?: undefined;
129
+ } | {
130
+ test: RegExp;
131
+ use: (string | {
132
+ loader: string;
133
+ options: {
134
+ importLoaders: number;
135
+ sourceMap: boolean;
136
+ modules: boolean;
137
+ ident?: undefined;
138
+ };
139
+ } | {
140
+ loader: string;
141
+ options: {
142
+ ident: string;
143
+ sourceMap: boolean;
144
+ importLoaders?: undefined;
145
+ modules?: undefined;
146
+ };
147
+ } | {
148
+ loader: string;
149
+ options: {
150
+ sourceMap: boolean;
151
+ importLoaders?: undefined;
152
+ modules?: undefined;
153
+ ident?: undefined;
154
+ };
155
+ })[];
156
+ loader?: undefined;
157
+ options?: undefined;
158
+ include?: undefined;
159
+ exclude?: undefined;
160
+ sideEffects?: undefined;
161
+ } | {
162
+ loader: string;
163
+ exclude: {}[];
164
+ options: {
165
+ name: string;
166
+ limit?: undefined;
167
+ customize?: undefined;
168
+ babelrc?: undefined;
169
+ configFile?: undefined;
170
+ presets?: undefined;
171
+ cacheIdentifier?: undefined;
172
+ plugins?: undefined;
173
+ cacheDirectory?: undefined;
174
+ cacheCompression?: undefined;
175
+ compact?: undefined;
176
+ sourceMaps?: undefined;
177
+ };
178
+ test?: undefined;
179
+ include?: undefined;
180
+ use?: undefined;
181
+ sideEffects?: undefined;
182
+ })[];
183
+ parser?: undefined;
184
+ test?: undefined;
185
+ enforce?: undefined;
186
+ use?: undefined;
187
+ include?: undefined;
188
+ })[];
189
+ export default _default;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import { Configuration, RuleSetRule } from 'webpack';
2
+ export declare function getReactScriptsPath({ noCache }?: {
3
+ noCache?: boolean;
4
+ }): string;
5
+ export declare function isReactScriptsInstalled(requiredVersion?: string): boolean;
6
+ export declare const getRules: (extensions: string[]) => (rules: RuleSetRule[]) => RuleSetRule[];
7
+ export declare const getTypeScriptRules: (webpackConfigRules: RuleSetRule[], configDir: string) => RuleSetRule[];
8
+ export declare function getCraWebpackConfig(mode: 'development' | 'production' | 'none'): any;
9
+ export declare function applyCRAWebpackConfig(baseConfig: Configuration, configDir: string): Configuration;
@@ -0,0 +1,51 @@
1
+ import { Configuration } from 'webpack';
2
+ declare type Preset = string | {
3
+ name: string;
4
+ };
5
+ export declare function webpackFinal(config: Configuration, { presetsList, configDir }: {
6
+ presetsList: Preset[];
7
+ configDir: string;
8
+ }): Configuration;
9
+ export declare function managerWebpack(config: Configuration, { presetsList }: {
10
+ presetsList: Preset[];
11
+ }): Configuration;
12
+ export declare function babelDefault(config: Configuration, { presetsList }: {
13
+ presetsList: Preset[];
14
+ }): Configuration | {
15
+ presets: string[];
16
+ plugins: (string | {
17
+ loaderMap: {
18
+ svg: {
19
+ ReactComponent: string;
20
+ };
21
+ };
22
+ })[][];
23
+ mode?: "none" | "development" | "production";
24
+ name?: string;
25
+ context?: string;
26
+ entry?: string | string[] | import("webpack").Entry | import("webpack").EntryFunc;
27
+ devtool?: import("webpack").Options.Devtool;
28
+ output?: import("webpack").Output;
29
+ module?: import("webpack").Module;
30
+ resolve?: import("webpack").Resolve;
31
+ resolveLoader?: import("webpack").ResolveLoader;
32
+ externals?: string | RegExp | import("webpack").ExternalsObjectElement | import("webpack").ExternalsFunctionElement | import("webpack").ExternalsElement[];
33
+ target?: "web" | "webworker" | "node" | "async-node" | "node-webkit" | "atom" | "electron" | "electron-renderer" | "electron-main" | ((compiler?: any) => void);
34
+ bail?: boolean;
35
+ profile?: boolean;
36
+ cache?: boolean | object;
37
+ watch?: boolean;
38
+ watchOptions?: import("webpack").ICompiler.WatchOptions;
39
+ node?: false | import("webpack").Node;
40
+ amd?: {
41
+ [moduleName: string]: boolean;
42
+ };
43
+ recordsPath?: string;
44
+ recordsInputPath?: string;
45
+ recordsOutputPath?: string;
46
+ stats?: import("webpack").Stats.ToStringOptions;
47
+ performance?: false | import("webpack").Options.Performance;
48
+ parallelism?: number;
49
+ optimization?: import("webpack").Options.Optimization;
50
+ };
51
+ export {};
@@ -0,0 +1,43 @@
1
+ import { TransformOptions } from '@babel/core';
2
+ export declare function babel(config: TransformOptions): {
3
+ plugins: any[];
4
+ ast?: boolean;
5
+ auxiliaryCommentAfter?: string;
6
+ auxiliaryCommentBefore?: string;
7
+ root?: string;
8
+ rootMode?: "root" | "upward" | "upward-optional";
9
+ configFile?: string | false;
10
+ babelrc?: boolean;
11
+ babelrcRoots?: string | true | string[];
12
+ envName?: string;
13
+ code?: boolean;
14
+ comments?: boolean;
15
+ compact?: boolean | "auto";
16
+ cwd?: string;
17
+ caller?: import("@babel/core").TransformCaller;
18
+ env?: {
19
+ [index: string]: TransformOptions;
20
+ };
21
+ extends?: string;
22
+ filename?: string;
23
+ filenameRelative?: string;
24
+ generatorOpts?: import("@babel/generator").GeneratorOptions;
25
+ getModuleId?: (moduleName: string) => string;
26
+ highlightCode?: boolean;
27
+ ignore?: string[];
28
+ inputSourceMap?: object;
29
+ minified?: boolean;
30
+ moduleId?: string;
31
+ moduleIds?: boolean;
32
+ moduleRoot?: string;
33
+ only?: string | RegExp | (string | RegExp)[];
34
+ parserOpts?: import("@babel/parser").ParserOptions;
35
+ presets?: import("@babel/core").PluginItem[];
36
+ retainLines?: boolean;
37
+ shouldPrintComment?: (commentContents: string) => boolean;
38
+ sourceFileName?: string;
39
+ sourceMaps?: boolean | "inline" | "both";
40
+ sourceRoot?: string;
41
+ sourceType?: "script" | "module" | "unambiguous";
42
+ wrapPluginVisitorMethod?: (pluginAlias: string, visitorType: "enter" | "exit", callback: (path: import("@babel/traverse").NodePath<import("@babel/types").Node>, state: any) => void) => (path: import("@babel/traverse").NodePath<import("@babel/types").Node>, state: any) => void;
43
+ };
@@ -0,0 +1,43 @@
1
+ import { TransformOptions } from '@babel/core';
2
+ export declare function babelDefault(config: TransformOptions): {
3
+ presets: (string | object)[];
4
+ plugins: (string | object)[];
5
+ ast?: boolean;
6
+ auxiliaryCommentAfter?: string;
7
+ auxiliaryCommentBefore?: string;
8
+ root?: string;
9
+ rootMode?: "root" | "upward" | "upward-optional";
10
+ configFile?: string | false;
11
+ babelrc?: boolean;
12
+ babelrcRoots?: string | true | string[];
13
+ envName?: string;
14
+ code?: boolean;
15
+ comments?: boolean;
16
+ compact?: boolean | "auto";
17
+ cwd?: string;
18
+ caller?: import("@babel/core").TransformCaller;
19
+ env?: {
20
+ [index: string]: TransformOptions;
21
+ };
22
+ extends?: string;
23
+ filename?: string;
24
+ filenameRelative?: string;
25
+ generatorOpts?: import("@babel/generator").GeneratorOptions;
26
+ getModuleId?: (moduleName: string) => string;
27
+ highlightCode?: boolean;
28
+ ignore?: string[];
29
+ inputSourceMap?: object;
30
+ minified?: boolean;
31
+ moduleId?: string;
32
+ moduleIds?: boolean;
33
+ moduleRoot?: string;
34
+ only?: string | RegExp | (string | RegExp)[];
35
+ parserOpts?: import("@babel/parser").ParserOptions;
36
+ retainLines?: boolean;
37
+ shouldPrintComment?: (commentContents: string) => boolean;
38
+ sourceFileName?: string;
39
+ sourceMaps?: boolean | "inline" | "both";
40
+ sourceRoot?: string;
41
+ sourceType?: "script" | "module" | "unambiguous";
42
+ wrapPluginVisitorMethod?: (pluginAlias: string, visitorType: "enter" | "exit", callback: (path: import("@babel/traverse").NodePath<import("@babel/types").Node>, state: any) => void) => (path: import("@babel/traverse").NodePath<import("@babel/types").Node>, state: any) => void;
43
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ packageJson: any;
3
+ framework: string;
4
+ frameworkPresets: string[];
5
+ };
6
+ export default _default;