From 422bc3a177553c4a8877f0ed907efd725f903e7b Mon Sep 17 00:00:00 2001 From: Jon Palmer Date: Thu, 2 Jan 2020 13:00:26 -0500 Subject: [PATCH 01/25] Initial support for @storybook/server --- app/server/README.md | 25 +++++++++ app/server/bin/build.js | 4 ++ app/server/bin/index.js | 3 + app/server/package.json | 55 +++++++++++++++++++ app/server/src/client/index.ts | 14 +++++ app/server/src/client/preview/globals.ts | 3 + app/server/src/client/preview/index.ts | 40 ++++++++++++++ app/server/src/client/preview/render.ts | 46 ++++++++++++++++ app/server/src/client/preview/types.ts | 30 ++++++++++ app/server/src/server/build.ts | 4 ++ .../src/server/framework-preset-server.ts | 22 ++++++++ app/server/src/server/index.ts | 4 ++ app/server/src/server/options.ts | 8 +++ app/server/src/typings.d.ts | 5 ++ app/server/standalone.js | 8 +++ app/server/tsconfig.json | 9 +++ 16 files changed, 280 insertions(+) create mode 100644 app/server/README.md create mode 100755 app/server/bin/build.js create mode 100755 app/server/bin/index.js create mode 100644 app/server/package.json create mode 100644 app/server/src/client/index.ts create mode 100644 app/server/src/client/preview/globals.ts create mode 100644 app/server/src/client/preview/index.ts create mode 100644 app/server/src/client/preview/render.ts create mode 100644 app/server/src/client/preview/types.ts create mode 100644 app/server/src/server/build.ts create mode 100644 app/server/src/server/framework-preset-server.ts create mode 100644 app/server/src/server/index.ts create mode 100644 app/server/src/server/options.ts create mode 100644 app/server/src/typings.d.ts create mode 100644 app/server/standalone.js create mode 100644 app/server/tsconfig.json diff --git a/app/server/README.md b/app/server/README.md new file mode 100644 index 000000000000..ff667d03b18c --- /dev/null +++ b/app/server/README.md @@ -0,0 +1,25 @@ +# Storybook for HTML + +--- + +Storybook for HTML is a UI development environment for your plain HTML snippets. +With it, you can visualize different states of your UI components and develop them interactively. + +![Storybook Screenshot](https://github.com/storybookjs/storybook/blob/master/media/storybook-intro.gif) + +Storybook runs outside of your app. +So you can develop UI components in isolation without worrying about app specific dependencies and requirements. + +## Getting Started + +```sh +cd my-app +npx -p @storybook/cli sb init -t html +``` + +For more information visit: [storybook.js.org](https://storybook.js.org) + +--- + +Storybook also comes with a lot of [addons](https://storybook.js.org/addons/introduction) and a great API to customize as you wish. +You can also build a [static version](https://storybook.js.org/basics/exporting-storybook) of your storybook and deploy it anywhere you want. diff --git a/app/server/bin/build.js b/app/server/bin/build.js new file mode 100755 index 000000000000..26142ec0af29 --- /dev/null +++ b/app/server/bin/build.js @@ -0,0 +1,4 @@ +#!/usr/bin/env node + +process.env.NODE_ENV = process.env.NODE_ENV || 'production'; +require('../dist/server/build'); diff --git a/app/server/bin/index.js b/app/server/bin/index.js new file mode 100755 index 000000000000..2e96258ce63d --- /dev/null +++ b/app/server/bin/index.js @@ -0,0 +1,3 @@ +#!/usr/bin/env node + +require('../dist/server'); diff --git a/app/server/package.json b/app/server/package.json new file mode 100644 index 000000000000..61045fff655b --- /dev/null +++ b/app/server/package.json @@ -0,0 +1,55 @@ +{ + "name": "@storybook/server", + "version": "5.3.0-rc.3", + "description": "Storybook for Server: View HTML snippets from a server in isolation with Hot Reloading.", + "keywords": [ + "storybook" + ], + "homepage": "https://github.com/storybookjs/storybook/tree/master/app/server", + "bugs": { + "url": "https://github.com/storybookjs/storybook/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/storybookjs/storybook.git", + "directory": "app/html" + }, + "license": "MIT", + "files": [ + "bin/**/*", + "dist/**/*", + "README.md", + "*.js", + "*.d.ts" + ], + "main": "dist/client/index.js", + "types": "dist/client/index.d.ts", + "bin": { + "build-storybook": "./bin/build.js", + "start-storybook": "./bin/index.js", + "storybook-server": "./bin/index.js" + }, + "scripts": { + "prepare": "node ../../scripts/prepare.js" + }, + "dependencies": { + "@storybook/addons": "5.3.0-rc.3", + "@storybook/core": "5.3.0-rc.3", + "@types/webpack-env": "^1.13.9", + "core-js": "^3.0.1", + "global": "^4.3.2", + "html-loader": "^0.5.5", + "regenerator-runtime": "^0.13.3", + "ts-dedent": "^1.1.0" + }, + "peerDependencies": { + "babel-loader": "^7.0.0 || ^8.0.0" + }, + "engines": { + "node": ">=8.0.0" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "6ad2664adf18b50ea3ce015cbae2ff3e9a60cc4a" +} diff --git a/app/server/src/client/index.ts b/app/server/src/client/index.ts new file mode 100644 index 000000000000..8034a9d6433d --- /dev/null +++ b/app/server/src/client/index.ts @@ -0,0 +1,14 @@ +export { + storiesOf, + setAddon, + addDecorator, + addParameters, + configure, + getStorybook, + forceReRender, + raw, +} from './preview'; + +if (module && module.hot && module.hot.decline) { + module.hot.decline(); +} diff --git a/app/server/src/client/preview/globals.ts b/app/server/src/client/preview/globals.ts new file mode 100644 index 000000000000..90dca4aa3750 --- /dev/null +++ b/app/server/src/client/preview/globals.ts @@ -0,0 +1,3 @@ +import { window } from 'global'; + +window.STORYBOOK_ENV = 'SERVER'; diff --git a/app/server/src/client/preview/index.ts b/app/server/src/client/preview/index.ts new file mode 100644 index 000000000000..c7ccc70bd48e --- /dev/null +++ b/app/server/src/client/preview/index.ts @@ -0,0 +1,40 @@ +/* eslint-disable prefer-destructuring */ +import { start } from '@storybook/core/client'; +import { ClientStoryApi, Loadable } from '@storybook/addons'; + +import './globals'; +import render, { setFetchStoryHtml } from './render'; +import { StoryFnServerReturnType, IStorybookSection, FetchStoryHtmlType } from './types'; + +const framework = 'server'; + +interface ClientApi extends ClientStoryApi { + setAddon(addon: any): void; + configure(fetch: FetchStoryHtmlType, loader: Loadable, module: NodeModule): void; + getStorybook(): IStorybookSection[]; + clearDecorators(): void; + forceReRender(): void; + raw: () => any; // todo add type +} + +const api = start(render); + +export const storiesOf: ClientApi['storiesOf'] = (kind, m) => { + return (api.clientApi.storiesOf(kind, m) as ReturnType).addParameters({ + framework, + }); +}; + +const setRenderFecthAndConfigure: ClientApi['configure'] = (fetch, ...args) => { + setFetchStoryHtml(fetch); + api.configure(...args, framework); +}; + +export const configure: ClientApi['configure'] = setRenderFecthAndConfigure; +export const addDecorator: ClientApi['addDecorator'] = api.clientApi.addDecorator; +export const addParameters: ClientApi['addParameters'] = api.clientApi.addParameters; +export const clearDecorators: ClientApi['clearDecorators'] = api.clientApi.clearDecorators; +export const setAddon: ClientApi['setAddon'] = api.clientApi.setAddon; +export const forceReRender: ClientApi['forceReRender'] = api.forceReRender; +export const getStorybook: ClientApi['getStorybook'] = api.clientApi.getStorybook; +export const raw: ClientApi['raw'] = api.clientApi.raw; diff --git a/app/server/src/client/preview/render.ts b/app/server/src/client/preview/render.ts new file mode 100644 index 000000000000..67981c13ef5f --- /dev/null +++ b/app/server/src/client/preview/render.ts @@ -0,0 +1,46 @@ +import { document, Node } from 'global'; +import dedent from 'ts-dedent'; +import { RenderMainArgs, FetchStoryHtmlType } from './types'; + +const rootElement = document.getElementById('root'); + +let fetchStoryHtml: FetchStoryHtmlType; + +export default async function renderMain({ + storyFn, + id, + selectedKind, + selectedStory, + showMain, + showError, + forceRender, +}: RenderMainArgs) { + const params = storyFn(); + + const element = await fetchStoryHtml(id, params); + + showMain(); + if (typeof element === 'string') { + rootElement.innerHTML = element; + } else if (element instanceof Node) { + // Don't re-mount the element if it didn't change and neither did the story + if (rootElement.firstChild === element && forceRender === true) { + return; + } + + rootElement.innerHTML = ''; + rootElement.appendChild(element); + } else { + showError({ + title: `Expecting an HTML snippet or DOM node from the story: "${selectedStory}" of "${selectedKind}".`, + description: dedent` + Did you forget to return the HTML snippet from the story? + Use "() => " or when defining the story. + `, + }); + } +} + +export const setFetchStoryHtml: any = (fetchHtml: FetchStoryHtmlType) => { + fetchStoryHtml = fetchHtml; +}; diff --git a/app/server/src/client/preview/types.ts b/app/server/src/client/preview/types.ts new file mode 100644 index 000000000000..e33e686a8e5e --- /dev/null +++ b/app/server/src/client/preview/types.ts @@ -0,0 +1,30 @@ +import { StoryFn } from '@storybook/addons'; + +export type StoryFnServerReturnType = any; + +export type FetchStoryHtmlType = (id: string, params: any) => Promise; + +export interface IStorybookStory { + name: string; + render: () => any; +} + +export interface IStorybookSection { + kind: string; + stories: IStorybookStory[]; +} + +export interface ShowErrorArgs { + title: string; + description: string; +} + +export interface RenderMainArgs { + storyFn: () => StoryFn; + id: string; + selectedKind: string; + selectedStory: string; + showMain: () => void; + showError: (args: ShowErrorArgs) => void; + forceRender: boolean; +} diff --git a/app/server/src/server/build.ts b/app/server/src/server/build.ts new file mode 100644 index 000000000000..d8abf06a4396 --- /dev/null +++ b/app/server/src/server/build.ts @@ -0,0 +1,4 @@ +import { buildStatic } from '@storybook/core/server'; +import options from './options'; + +buildStatic(options); diff --git a/app/server/src/server/framework-preset-server.ts b/app/server/src/server/framework-preset-server.ts new file mode 100644 index 000000000000..a3b4185d0a1a --- /dev/null +++ b/app/server/src/server/framework-preset-server.ts @@ -0,0 +1,22 @@ +// eslint-disable-next-line import/no-extraneous-dependencies +import { Configuration } from 'webpack'; + +export function webpack(config: Configuration) { + return { + ...config, + module: { + ...config.module, + rules: [ + ...config.module.rules, + { + test: /\.html$/, + use: [ + { + loader: require.resolve('html-loader'), + }, + ], + }, + ], + }, + }; +} diff --git a/app/server/src/server/index.ts b/app/server/src/server/index.ts new file mode 100644 index 000000000000..774d96025a84 --- /dev/null +++ b/app/server/src/server/index.ts @@ -0,0 +1,4 @@ +import { buildDev } from '@storybook/core/server'; +import options from './options'; + +buildDev(options); diff --git a/app/server/src/server/options.ts b/app/server/src/server/options.ts new file mode 100644 index 000000000000..da5391d10823 --- /dev/null +++ b/app/server/src/server/options.ts @@ -0,0 +1,8 @@ +// tslint:disable-next-line: no-var-requires +const packageJson = require('../../package.json'); + +export default { + packageJson, + framework: 'server', + frameworkPresets: [require.resolve('./framework-preset-server.js')], +}; diff --git a/app/server/src/typings.d.ts b/app/server/src/typings.d.ts new file mode 100644 index 000000000000..690e93343de2 --- /dev/null +++ b/app/server/src/typings.d.ts @@ -0,0 +1,5 @@ +declare module '@storybook/core/*'; +declare module 'global'; + +// will be provided by the webpack define plugin +declare var NODE_ENV: string | undefined; diff --git a/app/server/standalone.js b/app/server/standalone.js new file mode 100644 index 000000000000..1b1febe0d3bb --- /dev/null +++ b/app/server/standalone.js @@ -0,0 +1,8 @@ +const build = require('@storybook/core/standalone'); +const frameworkOptions = require('./dist/server/options').default; + +async function buildStandalone(options) { + return build(options, frameworkOptions); +} + +module.exports = buildStandalone; diff --git a/app/server/tsconfig.json b/app/server/tsconfig.json new file mode 100644 index 000000000000..82ce44329cc6 --- /dev/null +++ b/app/server/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "rootDir": "./src", + "types": ["webpack-env"] + }, + "include": ["src/**/*"], + "exclude": ["src/__tests__/**/*"] +} From 65a8886ac7bd3509720dc2e4bab5ed3d0f0d8e1b Mon Sep 17 00:00:00 2001 From: Jon Palmer Date: Thu, 2 Jan 2020 13:00:48 -0500 Subject: [PATCH 02/25] Cleanup and add example app --- app/server/src/client/index.ts | 1 + app/server/src/client/preview/index.ts | 13 +- examples/server-kitchen-sink/.babelrc | 0 .../server-kitchen-sink/client/storybook.html | 18 ++ .../server-kitchen-sink/client/storybook.js | 32 +++ examples/server-kitchen-sink/package.json | 18 ++ examples/server-kitchen-sink/server/app.js | 24 ++ .../server-kitchen-sink/server/renderStory.js | 11 + .../server-kitchen-sink/server/stories.js | 12 + .../server-kitchen-sink/server/templates.js | 4 + yarn.lock | 234 +++++++++++++++++- 11 files changed, 350 insertions(+), 17 deletions(-) create mode 100644 examples/server-kitchen-sink/.babelrc create mode 100644 examples/server-kitchen-sink/client/storybook.html create mode 100644 examples/server-kitchen-sink/client/storybook.js create mode 100644 examples/server-kitchen-sink/package.json create mode 100644 examples/server-kitchen-sink/server/app.js create mode 100644 examples/server-kitchen-sink/server/renderStory.js create mode 100644 examples/server-kitchen-sink/server/stories.js create mode 100644 examples/server-kitchen-sink/server/templates.js diff --git a/app/server/src/client/index.ts b/app/server/src/client/index.ts index 8034a9d6433d..e63533d6db21 100644 --- a/app/server/src/client/index.ts +++ b/app/server/src/client/index.ts @@ -7,6 +7,7 @@ export { getStorybook, forceReRender, raw, + setFetchStoryHtml, } from './preview'; if (module && module.hot && module.hot.decline) { diff --git a/app/server/src/client/preview/index.ts b/app/server/src/client/preview/index.ts index c7ccc70bd48e..0349d61f248f 100644 --- a/app/server/src/client/preview/index.ts +++ b/app/server/src/client/preview/index.ts @@ -3,18 +3,19 @@ import { start } from '@storybook/core/client'; import { ClientStoryApi, Loadable } from '@storybook/addons'; import './globals'; -import render, { setFetchStoryHtml } from './render'; +import render from './render'; import { StoryFnServerReturnType, IStorybookSection, FetchStoryHtmlType } from './types'; const framework = 'server'; interface ClientApi extends ClientStoryApi { setAddon(addon: any): void; - configure(fetch: FetchStoryHtmlType, loader: Loadable, module: NodeModule): void; + configure(loader: Loadable, module: NodeModule): void; getStorybook(): IStorybookSection[]; clearDecorators(): void; forceReRender(): void; raw: () => any; // todo add type + setFetchStoryHtml: FetchStoryHtmlType; } const api = start(render); @@ -25,12 +26,7 @@ export const storiesOf: ClientApi['storiesOf'] = (kind, m) => { }); }; -const setRenderFecthAndConfigure: ClientApi['configure'] = (fetch, ...args) => { - setFetchStoryHtml(fetch); - api.configure(...args, framework); -}; - -export const configure: ClientApi['configure'] = setRenderFecthAndConfigure; +export const configure: ClientApi['configure'] = (...args) => api.configure(...args, framework); export const addDecorator: ClientApi['addDecorator'] = api.clientApi.addDecorator; export const addParameters: ClientApi['addParameters'] = api.clientApi.addParameters; export const clearDecorators: ClientApi['clearDecorators'] = api.clientApi.clearDecorators; @@ -38,3 +34,4 @@ export const setAddon: ClientApi['setAddon'] = api.clientApi.setAddon; export const forceReRender: ClientApi['forceReRender'] = api.forceReRender; export const getStorybook: ClientApi['getStorybook'] = api.clientApi.getStorybook; export const raw: ClientApi['raw'] = api.clientApi.raw; +export { setFetchStoryHtml } from './render'; diff --git a/examples/server-kitchen-sink/.babelrc b/examples/server-kitchen-sink/.babelrc new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/examples/server-kitchen-sink/client/storybook.html b/examples/server-kitchen-sink/client/storybook.html new file mode 100644 index 000000000000..5ad7fc27c95e --- /dev/null +++ b/examples/server-kitchen-sink/client/storybook.html @@ -0,0 +1,18 @@ + + + + + + + + + +
+
+ +
+
+
+
+ + diff --git a/examples/server-kitchen-sink/client/storybook.js b/examples/server-kitchen-sink/client/storybook.js new file mode 100644 index 000000000000..0d890c8ccbcc --- /dev/null +++ b/examples/server-kitchen-sink/client/storybook.js @@ -0,0 +1,32 @@ +import camelcase from 'camelcase'; +import { configure, setFetchStoryHtml } from '@storybook/server'; +import stories from '../server/stories'; + +const port = process.env.PORT || 8080; + +const fetchHtml = async (id, params) => { + const [component, story] = id.split('--').map(s => camelcase(s)); + + const url = `http://localhost:${port}/storybook_preview/${component}/${story}`; + + // eslint-disable-next-line no-undef + const response = await fetch(url); + return response.text(); +}; + +const storyBookStories = Object.keys(stories).map(component => { + const storybookDescription = { + default: { + title: component, + }, + }; + Object.keys(stories[component]).forEach(storyName => { + storybookDescription[storyName] = () => {}; + }); + + return storybookDescription; +}); + +setFetchStoryHtml(fetchHtml); + +configure(() => storyBookStories, module); diff --git a/examples/server-kitchen-sink/package.json b/examples/server-kitchen-sink/package.json new file mode 100644 index 000000000000..a3e295cad397 --- /dev/null +++ b/examples/server-kitchen-sink/package.json @@ -0,0 +1,18 @@ +{ + "name": "server-kitchen-sink", + "version": "0.0.0", + "private": true, + "scripts": { + "dev": "PORT=1337 nodemon server/app.js", + "start": "PORT=1337 node server/app.js" + }, + "devDependencies": { + "@storybook/server": "5.3.0-rc.3", + "camelcase": "^5.3.1", + "concurrently": "^5.0.0", + "express": "~4.16.4", + "morgan": "^1.9.1", + "nodemon": "^2.0.2", + "parcel-bundler": "^1.12.4" + } +} diff --git a/examples/server-kitchen-sink/server/app.js b/examples/server-kitchen-sink/server/app.js new file mode 100644 index 000000000000..0557714d846b --- /dev/null +++ b/examples/server-kitchen-sink/server/app.js @@ -0,0 +1,24 @@ +const express = require('express'); +const morgan = require('morgan'); +const Bundler = require('parcel-bundler'); +const Path = require('path'); + +const renderStory = require('./renderStory'); + +const port = process.env.PORT || 8080; + +const app = express(); + +app.use(morgan('tiny')); + +app.get('/', (req, res) => res.send('Hello World!')); + +app.get('/storybook_preview/:component/:story', (req, res) => { + res.send(renderStory(req.params.component, req.params.story, req.query)); +}); + +const storybookFile = Path.join(__dirname, '../client/storybook.html'); +const bundler = new Bundler(storybookFile, {}); +app.use(bundler.middleware()); + +app.listen(port); diff --git a/examples/server-kitchen-sink/server/renderStory.js b/examples/server-kitchen-sink/server/renderStory.js new file mode 100644 index 000000000000..9dcebf18a44c --- /dev/null +++ b/examples/server-kitchen-sink/server/renderStory.js @@ -0,0 +1,11 @@ +const stories = require('./stories'); +const templates = require('./templates'); + +const renderStory = (component, story, params) => { + const template = templates[component]; + const defaultParams = stories[component][story]; + + return template({ ...defaultParams, ...params }); +}; + +module.exports = renderStory; diff --git a/examples/server-kitchen-sink/server/stories.js b/examples/server-kitchen-sink/server/stories.js new file mode 100644 index 000000000000..1dff810b1d3f --- /dev/null +++ b/examples/server-kitchen-sink/server/stories.js @@ -0,0 +1,12 @@ +module.exports = { + button: { + withShortText: { text: 'OK' }, + withLongText: { text: 'Push Me Please!' }, + withReallyLongText: { text: 'Push Me Please! You know you want to!!' }, + }, + message: { + hello: { message: 'Hello World!', color: 'black' }, + red: { message: 'Hello World!', color: 'red' }, + goodbye: { message: 'Bye!', color: 'green' }, + }, +}; diff --git a/examples/server-kitchen-sink/server/templates.js b/examples/server-kitchen-sink/server/templates.js new file mode 100644 index 000000000000..879bf646376f --- /dev/null +++ b/examples/server-kitchen-sink/server/templates.js @@ -0,0 +1,4 @@ +module.exports = { + button: params => ``, + message: params => `
${params.message}
`, +}; diff --git a/yarn.lock b/yarn.lock index 8b1a179f4b92..18f08595001d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5011,6 +5011,13 @@ analytics-node@3.3.0: remove-trailing-slash "^0.1.0" uuid "^3.2.1" +ansi-align@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ansi-align/-/ansi-align-2.0.0.tgz#c36aeccba563b89ceb556f3690f0b1d9e3547f7f" + integrity sha1-w2rsy6VjuJzrVW82kPCx2eNUf38= + dependencies: + string-width "^2.0.0" + ansi-align@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/ansi-align/-/ansi-align-3.0.0.tgz#b536b371cf687caaef236c18d3e21fe3797467cb" @@ -7350,6 +7357,19 @@ boxen@4.1.0, boxen@^4.1.0: type-fest "^0.5.2" widest-line "^3.1.0" +boxen@^1.2.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/boxen/-/boxen-1.3.0.tgz#55c6c39a8ba58d9c61ad22cd877532deb665a20b" + integrity sha512-TNPjfTr432qx7yOjQyaXm3dSR0MH9vXp7eT1BFSl/C51g+EFnOR9hTg1IreahGBmDNCehscshe45f+C1TBZbLw== + dependencies: + ansi-align "^2.0.0" + camelcase "^4.0.0" + chalk "^2.0.1" + cli-boxes "^1.0.0" + string-width "^2.0.0" + term-size "^1.2.0" + widest-line "^2.0.0" + boxen@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/boxen/-/boxen-3.2.0.tgz#fbdff0de93636ab4450886b6ff45b92d098f45eb" @@ -8522,7 +8542,7 @@ camelcase@^3.0.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-3.0.0.tgz#32fc4b9fcdaf845fcdf7e73bb97cac2261f0ab0a" integrity sha1-MvxLn82vhF/N9+c7uXysImHwqwo= -camelcase@^4.1.0: +camelcase@^4.0.0, camelcase@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" integrity sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0= @@ -8806,6 +8826,21 @@ chokidar@^2.0.0, chokidar@^2.0.2, chokidar@^2.0.3, chokidar@^2.0.4, chokidar@^2. optionalDependencies: fsevents "^1.2.7" +chokidar@^3.2.2: + version "3.3.1" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.3.1.tgz#c84e5b3d18d9a4d77558fef466b1bf16bbeb3450" + integrity sha512-4QYCEWOcK3OJrxwvyyAOxFuhpvOVCYkr33LPfFNBjAD/w3sEzWsp2BUOkI4l9bHvWioAd0rc6NlHUOEaWkTeqg== + dependencies: + anymatch "~3.1.1" + braces "~3.0.2" + glob-parent "~5.1.0" + is-binary-path "~2.1.0" + is-glob "~4.0.1" + normalize-path "~3.0.0" + readdirp "~3.3.0" + optionalDependencies: + fsevents "~2.1.2" + chownr@^1.0.1, chownr@^1.1.1, chownr@^1.1.2: version "1.1.3" resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.3.tgz#42d837d5239688d55f303003a508230fa6727142" @@ -8907,6 +8942,11 @@ clean-webpack-plugin@^1.0.1: dependencies: rimraf "^2.6.1" +cli-boxes@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-1.0.0.tgz#4fa917c3e59c94a004cd61f8ee509da651687143" + integrity sha1-T6kXw+WclKAEzWH47lCdplFocUM= + cli-boxes@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-2.2.0.tgz#538ecae8f9c6ca508e3c3c95b453fe93cb4c168d" @@ -9462,6 +9502,18 @@ config-chain@^1.1.11: ini "^1.3.4" proto-list "~1.2.1" +configstore@^3.0.0: + version "3.1.2" + resolved "https://registry.yarnpkg.com/configstore/-/configstore-3.1.2.tgz#c6f25defaeef26df12dd33414b001fe81a543f8f" + integrity sha512-vtv5HtGjcYUgFrXc6Kx747B83MRRVS5R1VTEQoXvuP+kMI+if6uywV0nDGoiydJRy4yk7h9od5Og0kxx4zUXmw== + dependencies: + dot-prop "^4.1.0" + graceful-fs "^4.1.2" + make-dir "^1.0.0" + unique-string "^1.0.0" + write-file-atomic "^2.0.0" + xdg-basedir "^3.0.0" + configstore@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/configstore/-/configstore-4.0.0.tgz#5933311e95d3687efb592c528b922d9262d227e7" @@ -13477,7 +13529,7 @@ express-graphql@^0.9.0: http-errors "^1.7.3" raw-body "^2.4.1" -express@4.16.4: +express@4.16.4, express@~4.16.4: version "4.16.4" resolved "https://registry.yarnpkg.com/express/-/express-4.16.4.tgz#fddef61926109e24c515ea97fd2f1bdbf62df12e" integrity sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg== @@ -14571,7 +14623,7 @@ fsevents@^1.0.0, fsevents@^1.2.3, fsevents@^1.2.7: nan "^2.12.1" node-pre-gyp "^0.12.0" -fsevents@~2.1.1: +fsevents@~2.1.1, fsevents@~2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.2.tgz#4c0a1fb34bc68e543b4b82a9ec392bfbda840805" integrity sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA== @@ -16183,6 +16235,11 @@ iferr@^0.1.5: resolved "https://registry.yarnpkg.com/iferr/-/iferr-0.1.5.tgz#c60eed69e6d8fdb6b3104a1fcbca1c192dc5b501" integrity sha1-xg7taebY/bazEEofy8ocGS3FtQE= +ignore-by-default@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/ignore-by-default/-/ignore-by-default-1.0.1.tgz#48ca6d72f6c6a3af00a9ad4ae6876be3889e2b09" + integrity sha1-SMptcvbGo68Aqa1K5odr44ieKwk= + ignore-walk@^3.0.1: version "3.0.3" resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.3.tgz#017e2447184bfeade7c238e4aefdd1e8f95b1e37" @@ -16725,7 +16782,7 @@ is-callable@^1.1.4: resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75" integrity sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA== -is-ci@1.2.1: +is-ci@1.2.1, is-ci@^1.0.10: version "1.2.1" resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.2.1.tgz#e3779c8ee17fccf428488f6e281187f2e632841c" integrity sha512-s6tfsaQaQi3JNciBH6shVqEDvhGut0SUXr31ag8Pd8BBbVVlcGfWhpPmEOoM6RJ5TFhbypvf5yyRw/VXW1IiWg== @@ -16955,6 +17012,11 @@ is-negated-glob@^1.0.0: resolved "https://registry.yarnpkg.com/is-negated-glob/-/is-negated-glob-1.0.0.tgz#6910bca5da8c95e784b5751b976cf5a10fee36d2" integrity sha1-aRC8pdqMleeEtXUbl2z1oQ/uNtI= +is-npm@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-npm/-/is-npm-1.0.0.tgz#f2fb63a65e4905b406c86072765a1a4dc793b9f4" + integrity sha1-8vtjpl5JBbQGyGBydloaTceTufQ= + is-npm@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-npm/-/is-npm-3.0.0.tgz#ec9147bfb629c43f494cf67936a961edec7e8053" @@ -18781,6 +18843,13 @@ latest-version@5.1.0, latest-version@^5.0.0: dependencies: package-json "^6.3.0" +latest-version@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/latest-version/-/latest-version-3.1.0.tgz#a205383fea322b33b5ae3b18abee0dc2f356ee15" + integrity sha1-ogU4P+oyKzO1rjsYq+4NwvNW7hU= + dependencies: + package-json "^4.0.0" + lazy-ass@1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/lazy-ass/-/lazy-ass-1.6.0.tgz#7999655e8646c17f089fdd187d150d3324d54513" @@ -21804,6 +21873,22 @@ node-uuid@~1.4.0: resolved "https://registry.yarnpkg.com/node-uuid/-/node-uuid-1.4.8.tgz#b040eb0923968afabf8d32fb1f17f1167fdab907" integrity sha1-sEDrCSOWivq/jTL7HxfxFn/auQc= +nodemon@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/nodemon/-/nodemon-2.0.2.tgz#9c7efeaaf9b8259295a97e5d4585ba8f0cbe50b0" + integrity sha512-GWhYPMfde2+M0FsHnggIHXTqPDHXia32HRhh6H0d75Mt9FKUoCBvumNHr7LdrpPBTKxsWmIEOjoN+P4IU6Hcaw== + dependencies: + chokidar "^3.2.2" + debug "^3.2.6" + ignore-by-default "^1.0.1" + minimatch "^3.0.4" + pstree.remy "^1.1.7" + semver "^5.7.1" + supports-color "^5.5.0" + touch "^3.1.0" + undefsafe "^2.0.2" + update-notifier "^2.5.0" + noop-fn@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/noop-fn/-/noop-fn-1.0.0.tgz#5f33d47f13d2150df93e0cb036699e982f78ffbf" @@ -21829,6 +21914,13 @@ nopt@^4.0.1: abbrev "1" osenv "^0.1.4" +nopt@~1.0.10: + version "1.0.10" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-1.0.10.tgz#6ddd21bd2a31417b92727dd585f8a6f37608ebee" + integrity sha1-bd0hvSoxQXuScn3Vhfim83YI6+4= + dependencies: + abbrev "1" + normalize-html-whitespace@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/normalize-html-whitespace/-/normalize-html-whitespace-1.0.0.tgz#5e3c8e192f1b06c3b9eee4b7e7f28854c7601e34" @@ -22667,6 +22759,16 @@ package-json@6.4.0: registry-url "^5.0.0" semver "^6.1.1" +package-json@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/package-json/-/package-json-4.0.1.tgz#8869a0401253661c4c4ca3da6c2121ed555f5eed" + integrity sha1-iGmgQBJTZhxMTKPabCEh7VVfXu0= + dependencies: + got "^6.7.1" + registry-auth-token "^3.0.1" + registry-url "^3.0.3" + semver "^5.1.0" + package-json@^6.3.0: version "6.5.0" resolved "https://registry.yarnpkg.com/package-json/-/package-json-6.5.0.tgz#6feedaca35e75725876d0b0e64974697fed145b0" @@ -22812,6 +22914,71 @@ param-case@2.1.x, param-case@^2.1.1: dependencies: no-case "^2.2.0" +parcel-bundler@^1.12.4: + version "1.12.4" + resolved "https://registry.yarnpkg.com/parcel-bundler/-/parcel-bundler-1.12.4.tgz#31223f4ab4d00323a109fce28d5e46775409a9ee" + integrity sha512-G+iZGGiPEXcRzw0fiRxWYCKxdt/F7l9a0xkiU4XbcVRJCSlBnioWEwJMutOCCpoQmaQtjB4RBHDGIHN85AIhLQ== + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/core" "^7.4.4" + "@babel/generator" "^7.4.4" + "@babel/parser" "^7.4.4" + "@babel/plugin-transform-flow-strip-types" "^7.4.4" + "@babel/plugin-transform-modules-commonjs" "^7.4.4" + "@babel/plugin-transform-react-jsx" "^7.0.0" + "@babel/preset-env" "^7.4.4" + "@babel/runtime" "^7.4.4" + "@babel/template" "^7.4.4" + "@babel/traverse" "^7.4.4" + "@babel/types" "^7.4.4" + "@iarna/toml" "^2.2.0" + "@parcel/fs" "^1.11.0" + "@parcel/logger" "^1.11.1" + "@parcel/utils" "^1.11.0" + "@parcel/watcher" "^1.12.1" + "@parcel/workers" "^1.11.0" + ansi-to-html "^0.6.4" + babylon-walk "^1.0.2" + browserslist "^4.1.0" + chalk "^2.1.0" + clone "^2.1.1" + command-exists "^1.2.6" + commander "^2.11.0" + core-js "^2.6.5" + cross-spawn "^6.0.4" + css-modules-loader-core "^1.1.0" + cssnano "^4.0.0" + deasync "^0.1.14" + dotenv "^5.0.0" + dotenv-expand "^5.1.0" + envinfo "^7.3.1" + fast-glob "^2.2.2" + filesize "^3.6.0" + get-port "^3.2.0" + htmlnano "^0.2.2" + is-glob "^4.0.0" + is-url "^1.2.2" + js-yaml "^3.10.0" + json5 "^1.0.1" + micromatch "^3.0.4" + mkdirp "^0.5.1" + node-forge "^0.7.1" + node-libs-browser "^2.0.0" + opn "^5.1.0" + postcss "^7.0.11" + postcss-value-parser "^3.3.1" + posthtml "^0.11.2" + posthtml-parser "^0.4.0" + posthtml-render "^1.1.3" + resolve "^1.4.0" + semver "^5.4.1" + serialize-to-js "^3.0.0" + serve-static "^1.12.4" + source-map "0.6.1" + terser "^3.7.3" + v8-compile-cache "^2.0.0" + ws "^5.1.1" + parcel@^1.12.3: version "1.12.4" resolved "https://registry.yarnpkg.com/parcel/-/parcel-1.12.4.tgz#c8136085179c6382e632ca98126093e110be2ac5" @@ -23272,7 +23439,7 @@ physical-cpu-count@^2.0.0: resolved "https://registry.yarnpkg.com/physical-cpu-count/-/physical-cpu-count-2.0.0.tgz#18de2f97e4bf7a9551ad7511942b5496f7aba660" integrity sha1-GN4vl+S/epVRrXURlCtUlverpmA= -picomatch@^2.0.4, picomatch@^2.0.5: +picomatch@^2.0.4, picomatch@^2.0.5, picomatch@^2.0.7: version "2.1.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.1.1.tgz#ecdfbea7704adb5fe6fb47f9866c4c0e15e905c5" integrity sha512-OYMyqkKzK7blWO/+XZYP6w8hH0LDvkBvdvKukti+7kqYFCiEAk+gI3DWnryapc0Dau05ugGTy0foQ6mqn4AHYA== @@ -24759,6 +24926,11 @@ psl@^1.1.24, psl@^1.1.28: resolved "https://registry.yarnpkg.com/psl/-/psl-1.4.0.tgz#5dd26156cdb69fa1fdb8ab1991667d3f80ced7c2" integrity sha512-HZzqCGPecFLyoRj5HLfuDSKYTJkAfB5thKBIkRHtGjWwY7p1dAyveIbXIq4tO0KYfDF2tHqPUgY9SDnGm00uFw== +pstree.remy@^1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/pstree.remy/-/pstree.remy-1.1.7.tgz#c76963a28047ed61542dc361aa26ee55a7fa15f3" + integrity sha512-xsMgrUwRpuGskEzBFkH8NmTimbZ5PcPup0LA8JJkHIm2IMUbQcpo3yeLNWVrufEYjh8YwtSVh0xz6UeWc5Oh5A== + public-encrypt@^4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/public-encrypt/-/public-encrypt-4.0.3.tgz#4fcc9d77a07e48ba7527e7cbe0de33d0701331e0" @@ -25414,7 +25586,7 @@ rax@^1.1.0: rax-create-factory "^1.0.0" rax-is-valid-element "^1.0.0" -rc@^1.1.0, rc@^1.1.6, rc@^1.2.7, rc@^1.2.8: +rc@^1.0.1, rc@^1.1.0, rc@^1.1.6, rc@^1.2.7, rc@^1.2.8: version "1.2.8" resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== @@ -26439,6 +26611,13 @@ readdirp@~3.2.0: dependencies: picomatch "^2.0.4" +readdirp@~3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.3.0.tgz#984458d13a1e42e2e9f5841b129e162f369aff17" + integrity sha512-zz0pAkSPOXXm1viEwygWIPSPkcBYjW1xU5j/JBh5t9bGCJwa6f9+BJa6VaB2g+b55yVrmXzqkyLf4xaWYM0IkQ== + dependencies: + picomatch "^2.0.7" + readjson@^1.1.0: version "1.1.4" resolved "https://registry.yarnpkg.com/readjson/-/readjson-1.1.4.tgz#89501f648453dcda9b15399b3fb10c38249662c7" @@ -26713,7 +26892,7 @@ regexpu-core@^4.6.0: unicode-match-property-ecmascript "^1.0.4" unicode-match-property-value-ecmascript "^1.1.0" -registry-auth-token@^3.4.0: +registry-auth-token@^3.0.1, registry-auth-token@^3.4.0: version "3.4.0" resolved "https://registry.yarnpkg.com/registry-auth-token/-/registry-auth-token-3.4.0.tgz#d7446815433f5d5ed6431cd5dca21048f66b397e" integrity sha512-4LM6Fw8eBQdwMYcES4yTnn2TqIasbXuwDx3um+QRs7S55aMKCBKBxvPXl2RiUjHwuJLTyYfxSpmfSAjQpcuP+A== @@ -26729,6 +26908,13 @@ registry-auth-token@^4.0.0: rc "^1.2.8" safe-buffer "^5.0.1" +registry-url@^3.0.3: + version "3.1.0" + resolved "https://registry.yarnpkg.com/registry-url/-/registry-url-3.1.0.tgz#3d4ef870f73dde1d77f0cf9a381432444e174942" + integrity sha1-PU74cPc93h138M+aOBQyRE4XSUI= + dependencies: + rc "^1.0.1" + registry-url@^5.0.0: version "5.1.0" resolved "https://registry.yarnpkg.com/registry-url/-/registry-url-5.1.0.tgz#e98334b50d5434b81136b44ec638d9c2009c5009" @@ -28028,7 +28214,7 @@ semver-intersect@1.4.0: dependencies: semver "^5.0.0" -"semver@2 || 3 || 4 || 5", "semver@2.x || 3.x || 4 || 5", semver@^5.0.0, semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0, semver@^5.7.0: +"semver@2 || 3 || 4 || 5", "semver@2.x || 3.x || 4 || 5", semver@^5.0.0, semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0, semver@^5.7.0, semver@^5.7.1: version "5.7.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== @@ -29647,7 +29833,7 @@ sum-up@^1.0.1: dependencies: chalk "^1.0.0" -supports-color@5.5.0, supports-color@^5.0.0, supports-color@^5.3.0, supports-color@^5.4.0: +supports-color@5.5.0, supports-color@^5.0.0, supports-color@^5.3.0, supports-color@^5.4.0, supports-color@^5.5.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== @@ -30417,6 +30603,13 @@ toposort@^2.0.2: resolved "https://registry.yarnpkg.com/toposort/-/toposort-2.0.2.tgz#ae21768175d1559d48bef35420b2f4962f09c330" integrity sha1-riF2gXXRVZ1IvvNUILL0li8JwzA= +touch@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/touch/-/touch-3.1.0.tgz#fe365f5f75ec9ed4e56825e0bb76d24ab74af83b" + integrity sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA== + dependencies: + nopt "~1.0.10" + tough-cookie@>=0.12.0, tough-cookie@>=2.3.3, tough-cookie@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-3.0.1.tgz#9df4f57e739c26930a018184887f4adb7dca73b2" @@ -30991,6 +31184,13 @@ undeclared-identifiers@^1.1.2: simple-concat "^1.0.0" xtend "^4.0.1" +undefsafe@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/undefsafe/-/undefsafe-2.0.2.tgz#225f6b9e0337663e0d8e7cfd686fc2836ccace76" + integrity sha1-Il9rngM3Zj4Njnz9aG/Cg2zKznY= + dependencies: + debug "^2.2.0" + underscore.string@^3.2.2, underscore.string@~3.3.4: version "3.3.5" resolved "https://registry.yarnpkg.com/underscore.string/-/underscore.string-3.3.5.tgz#fc2ad255b8bd309e239cbc5816fd23a9b7ea4023" @@ -31431,6 +31631,22 @@ upath@^1.0.2, upath@^1.1.0, upath@^1.1.1: resolved "https://registry.yarnpkg.com/upath/-/upath-1.2.0.tgz#8f66dbcd55a883acdae4408af8b035a5044c1894" integrity sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg== +update-notifier@^2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/update-notifier/-/update-notifier-2.5.0.tgz#d0744593e13f161e406acb1d9408b72cad08aff6" + integrity sha512-gwMdhgJHGuj/+wHJJs9e6PcCszpxR1b236igrOkUofGhqJuG+amlIKwApH1IW1WWl7ovZxsX49lMBWLxSdm5Dw== + dependencies: + boxen "^1.2.1" + chalk "^2.0.1" + configstore "^3.0.0" + import-lazy "^2.1.0" + is-ci "^1.0.10" + is-installed-globally "^0.1.0" + is-npm "^1.0.0" + latest-version "^3.0.0" + semver-diff "^2.0.0" + xdg-basedir "^3.0.0" + update-notifier@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/update-notifier/-/update-notifier-3.0.1.tgz#78ecb68b915e2fd1be9f767f6e298ce87b736250" From 1bbc7cfbfa9b2d4ebd7cfcead0b00e1db55b99dc Mon Sep 17 00:00:00 2001 From: Jon Palmer Date: Thu, 2 Jan 2020 13:00:56 -0500 Subject: [PATCH 03/25] Add Options to configure signature --- app/server/src/client/index.ts | 1 - app/server/src/client/preview/index.ts | 15 +++++++++------ app/server/src/client/preview/types.ts | 4 ++++ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/app/server/src/client/index.ts b/app/server/src/client/index.ts index e63533d6db21..8034a9d6433d 100644 --- a/app/server/src/client/index.ts +++ b/app/server/src/client/index.ts @@ -7,7 +7,6 @@ export { getStorybook, forceReRender, raw, - setFetchStoryHtml, } from './preview'; if (module && module.hot && module.hot.decline) { diff --git a/app/server/src/client/preview/index.ts b/app/server/src/client/preview/index.ts index 0349d61f248f..3a40f147a589 100644 --- a/app/server/src/client/preview/index.ts +++ b/app/server/src/client/preview/index.ts @@ -3,19 +3,18 @@ import { start } from '@storybook/core/client'; import { ClientStoryApi, Loadable } from '@storybook/addons'; import './globals'; -import render from './render'; -import { StoryFnServerReturnType, IStorybookSection, FetchStoryHtmlType } from './types'; +import render, { setFetchStoryHtml } from './render'; +import { StoryFnServerReturnType, IStorybookSection, ConfigureOptionsArgs } from './types'; const framework = 'server'; interface ClientApi extends ClientStoryApi { setAddon(addon: any): void; - configure(loader: Loadable, module: NodeModule): void; + configure(loader: Loadable, module: NodeModule, options: ConfigureOptionsArgs): void; getStorybook(): IStorybookSection[]; clearDecorators(): void; forceReRender(): void; raw: () => any; // todo add type - setFetchStoryHtml: FetchStoryHtmlType; } const api = start(render); @@ -26,7 +25,12 @@ export const storiesOf: ClientApi['storiesOf'] = (kind, m) => { }); }; -export const configure: ClientApi['configure'] = (...args) => api.configure(...args, framework); +const setRenderFecthAndConfigure: ClientApi['configure'] = (loader, module, options) => { + setFetchStoryHtml(options.fetchStoryHtml); + api.configure(loader, module, framework); +}; + +export const configure: ClientApi['configure'] = setRenderFecthAndConfigure; export const addDecorator: ClientApi['addDecorator'] = api.clientApi.addDecorator; export const addParameters: ClientApi['addParameters'] = api.clientApi.addParameters; export const clearDecorators: ClientApi['clearDecorators'] = api.clientApi.clearDecorators; @@ -34,4 +38,3 @@ export const setAddon: ClientApi['setAddon'] = api.clientApi.setAddon; export const forceReRender: ClientApi['forceReRender'] = api.forceReRender; export const getStorybook: ClientApi['getStorybook'] = api.clientApi.getStorybook; export const raw: ClientApi['raw'] = api.clientApi.raw; -export { setFetchStoryHtml } from './render'; diff --git a/app/server/src/client/preview/types.ts b/app/server/src/client/preview/types.ts index e33e686a8e5e..4b267c0256dc 100644 --- a/app/server/src/client/preview/types.ts +++ b/app/server/src/client/preview/types.ts @@ -19,6 +19,10 @@ export interface ShowErrorArgs { description: string; } +export interface ConfigureOptionsArgs { + fetchStoryHtml: FetchStoryHtmlType; +} + export interface RenderMainArgs { storyFn: () => StoryFn; id: string; From 7099e18cff7a4632448975c7391a38563a970e6f Mon Sep 17 00:00:00 2001 From: Jon Palmer Date: Thu, 2 Jan 2020 13:01:07 -0500 Subject: [PATCH 04/25] Wire up the knobs --- .../server-kitchen-sink/client/storybook.js | 25 ++++---------- .../client/storybook.stories.js | 33 +++++++++++++++++++ examples/server-kitchen-sink/package.json | 4 ++- yarn.lock | 9 ++++- 4 files changed, 50 insertions(+), 21 deletions(-) create mode 100644 examples/server-kitchen-sink/client/storybook.stories.js diff --git a/examples/server-kitchen-sink/client/storybook.js b/examples/server-kitchen-sink/client/storybook.js index 0d890c8ccbcc..047458d3cd0d 100644 --- a/examples/server-kitchen-sink/client/storybook.js +++ b/examples/server-kitchen-sink/client/storybook.js @@ -1,32 +1,19 @@ import camelcase from 'camelcase'; -import { configure, setFetchStoryHtml } from '@storybook/server'; -import stories from '../server/stories'; +import { configure } from '@storybook/server'; + +import stories from './storybook.stories'; const port = process.env.PORT || 8080; const fetchHtml = async (id, params) => { const [component, story] = id.split('--').map(s => camelcase(s)); - const url = `http://localhost:${port}/storybook_preview/${component}/${story}`; + const url = new URL(`http://localhost:${port}/storybook_preview/${component}/${story}`); + url.search = new URLSearchParams(params).toString(); // eslint-disable-next-line no-undef const response = await fetch(url); return response.text(); }; -const storyBookStories = Object.keys(stories).map(component => { - const storybookDescription = { - default: { - title: component, - }, - }; - Object.keys(stories[component]).forEach(storyName => { - storybookDescription[storyName] = () => {}; - }); - - return storybookDescription; -}); - -setFetchStoryHtml(fetchHtml); - -configure(() => storyBookStories, module); +configure(() => stories, module, { fetchStoryHtml: fetchHtml }); diff --git a/examples/server-kitchen-sink/client/storybook.stories.js b/examples/server-kitchen-sink/client/storybook.stories.js new file mode 100644 index 000000000000..880af3e8b056 --- /dev/null +++ b/examples/server-kitchen-sink/client/storybook.stories.js @@ -0,0 +1,33 @@ +import { text, withKnobs } from '@storybook/addon-knobs'; +import { titleCase } from 'title-case'; + +import stories from '../server/stories'; + +const storyBookStories = Object.keys(stories).map(component => { + const storybookDescription = { + default: { + title: component, + decorators: [withKnobs], + }, + }; + const componentStories = stories[component]; + Object.keys(componentStories).forEach(storyName => { + const componentStory = componentStories[storyName]; + + storybookDescription[storyName] = () => { + // Build the list of knobs from the stroy arguments. Assume that all arguments are text. + // More sophisticated server backends could have DSLs to provide other types. + const knobs = {}; + Object.keys(componentStory).forEach(argument => { + const name = titleCase(argument); + const defaultValue = componentStory[argument]; + knobs[argument] = text(name, defaultValue); + }); + return knobs; + }; + }); + + return storybookDescription; +}); + +export default storyBookStories; diff --git a/examples/server-kitchen-sink/package.json b/examples/server-kitchen-sink/package.json index a3e295cad397..7bda7201065d 100644 --- a/examples/server-kitchen-sink/package.json +++ b/examples/server-kitchen-sink/package.json @@ -7,12 +7,14 @@ "start": "PORT=1337 node server/app.js" }, "devDependencies": { + "@storybook/addon-knobs": "5.3.0-rc.3", "@storybook/server": "5.3.0-rc.3", "camelcase": "^5.3.1", "concurrently": "^5.0.0", "express": "~4.16.4", "morgan": "^1.9.1", "nodemon": "^2.0.2", - "parcel-bundler": "^1.12.4" + "parcel-bundler": "^1.12.4", + "title-case": "^3.0.2" } } diff --git a/yarn.lock b/yarn.lock index 18f08595001d..112ad7929bee 100644 --- a/yarn.lock +++ b/yarn.lock @@ -30466,6 +30466,13 @@ tinycolor2@^1.4.1: resolved "https://registry.yarnpkg.com/tinycolor2/-/tinycolor2-1.4.1.tgz#f4fad333447bc0b07d4dc8e9209d8f39a8ac77e8" integrity sha1-9PrTM0R7wLB9TcjpIJ2POaisd+g= +title-case@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/title-case/-/title-case-3.0.2.tgz#9f926a0a42071366f85470572f312c4b647773ab" + integrity sha512-1P5hyjEhJ9Ab0AT8Xbm0z1avwPSgRR6XtFSNCdfo6B7111TTTja+456UZ2ZPkbTbzqBwIpQxp/tazh5UvpJ+fA== + dependencies: + tslib "^1.10.0" + tmp@0.0.28: version "0.0.28" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.28.tgz#172735b7f614ea7af39664fa84cf0de4e515d120" @@ -30871,7 +30878,7 @@ tsconfig-paths@^3.4.0: minimist "^1.2.0" strip-bom "^3.0.0" -tslib@1.10.0, tslib@^1.7.1, tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3: +tslib@1.10.0, tslib@^1.10.0, tslib@^1.7.1, tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3: version "1.10.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== From d4c2faa66958b4635dee04bb4cfefa576e43ef20 Mon Sep 17 00:00:00 2001 From: Jon Palmer Date: Thu, 2 Jan 2020 13:01:15 -0500 Subject: [PATCH 05/25] Refactor to use parameters Template based server side rendering Added a bunch of stories to the example app --- app/server/package.json | 7 +- app/server/src/client/preview/render.ts | 19 +++- app/server/src/client/preview/types.ts | 3 +- .../src/server/framework-preset-server.ts | 18 +--- examples/server-kitchen-sink/client/.eslintrc | 8 ++ .../server-kitchen-sink/client/stories.json | 42 ++++++++ .../client/stories/addon-a11y.stories.js | 37 +++++++ .../client/stories/addon-actions.stories.js | 80 ++++++++++++++++ .../stories/addon-backgrounds.stories.js | 25 +++++ .../client/stories/addon-knobs.stories.js | 96 +++++++++++++++++++ .../client/stories/addon-notes.stories.js | 12 +++ .../client/stories/demo.stories.js | 36 +++++++ .../client/stories/welcome.stories.js | 13 +++ .../server-kitchen-sink/client/storybook.html | 3 + .../server-kitchen-sink/client/storybook.js | 38 ++++++-- .../client/storybook.stories.js | 33 ------- examples/server-kitchen-sink/package.json | 21 ++-- examples/server-kitchen-sink/server/app.js | 10 +- .../server-kitchen-sink/server/renderStory.js | 11 --- .../server-kitchen-sink/server/stories.js | 12 --- .../server-kitchen-sink/server/templates.js | 4 - .../server/views/addons/a11y/contrast.pug | 1 + .../server/views/addons/a11y/default.pug | 1 + .../server/views/addons/a11y/disabled.pug | 1 + .../server/views/addons/a11y/label.pug | 1 + .../server/views/addons/actions/button.pug | 1 + .../server/views/addons/actions/story1.pug | 1 + .../server/views/addons/actions/story2.pug | 1 + .../server/views/addons/actions/story3.pug | 1 + .../server/views/addons/actions/story4.pug | 1 + .../server/views/addons/actions/story5.pug | 3 + .../server/views/addons/actions/story6.pug | 1 + .../server/views/addons/actions/story7.pug | 1 + .../server/views/addons/actions/story8.pug | 1 + .../views/addons/backgrounds/story1.pug | 1 + .../views/addons/backgrounds/story2.pug | 1 + .../server/views/addons/knobs/simple.pug | 1 + .../server/views/addons/knobs/story3.pug | 1 + .../server/views/addons/knobs/story4.pug | 13 +++ .../server/views/addons/knobs/story5.pug | 1 + .../server/views/addons/notes/story1.pug | 2 + .../server/views/demo/button.pug | 1 + .../server/views/demo/heading.pug | 1 + .../server/views/demo/headings.pug | 4 + .../server/views/demo/params.pug | 1 + .../server/views/welcome/welcome.pug | 36 +++++++ yarn.lock | 11 +-- 47 files changed, 503 insertions(+), 114 deletions(-) create mode 100644 examples/server-kitchen-sink/client/.eslintrc create mode 100644 examples/server-kitchen-sink/client/stories.json create mode 100644 examples/server-kitchen-sink/client/stories/addon-a11y.stories.js create mode 100644 examples/server-kitchen-sink/client/stories/addon-actions.stories.js create mode 100644 examples/server-kitchen-sink/client/stories/addon-backgrounds.stories.js create mode 100644 examples/server-kitchen-sink/client/stories/addon-knobs.stories.js create mode 100644 examples/server-kitchen-sink/client/stories/addon-notes.stories.js create mode 100644 examples/server-kitchen-sink/client/stories/demo.stories.js create mode 100644 examples/server-kitchen-sink/client/stories/welcome.stories.js delete mode 100644 examples/server-kitchen-sink/client/storybook.stories.js delete mode 100644 examples/server-kitchen-sink/server/renderStory.js delete mode 100644 examples/server-kitchen-sink/server/stories.js delete mode 100644 examples/server-kitchen-sink/server/templates.js create mode 100644 examples/server-kitchen-sink/server/views/addons/a11y/contrast.pug create mode 100644 examples/server-kitchen-sink/server/views/addons/a11y/default.pug create mode 100644 examples/server-kitchen-sink/server/views/addons/a11y/disabled.pug create mode 100644 examples/server-kitchen-sink/server/views/addons/a11y/label.pug create mode 100644 examples/server-kitchen-sink/server/views/addons/actions/button.pug create mode 100644 examples/server-kitchen-sink/server/views/addons/actions/story1.pug create mode 100644 examples/server-kitchen-sink/server/views/addons/actions/story2.pug create mode 100644 examples/server-kitchen-sink/server/views/addons/actions/story3.pug create mode 100644 examples/server-kitchen-sink/server/views/addons/actions/story4.pug create mode 100644 examples/server-kitchen-sink/server/views/addons/actions/story5.pug create mode 100644 examples/server-kitchen-sink/server/views/addons/actions/story6.pug create mode 100644 examples/server-kitchen-sink/server/views/addons/actions/story7.pug create mode 100644 examples/server-kitchen-sink/server/views/addons/actions/story8.pug create mode 100644 examples/server-kitchen-sink/server/views/addons/backgrounds/story1.pug create mode 100644 examples/server-kitchen-sink/server/views/addons/backgrounds/story2.pug create mode 100644 examples/server-kitchen-sink/server/views/addons/knobs/simple.pug create mode 100644 examples/server-kitchen-sink/server/views/addons/knobs/story3.pug create mode 100644 examples/server-kitchen-sink/server/views/addons/knobs/story4.pug create mode 100644 examples/server-kitchen-sink/server/views/addons/knobs/story5.pug create mode 100644 examples/server-kitchen-sink/server/views/addons/notes/story1.pug create mode 100644 examples/server-kitchen-sink/server/views/demo/button.pug create mode 100644 examples/server-kitchen-sink/server/views/demo/heading.pug create mode 100644 examples/server-kitchen-sink/server/views/demo/headings.pug create mode 100644 examples/server-kitchen-sink/server/views/demo/params.pug create mode 100644 examples/server-kitchen-sink/server/views/welcome/welcome.pug diff --git a/app/server/package.json b/app/server/package.json index 61045fff655b..e05b53b06af7 100644 --- a/app/server/package.json +++ b/app/server/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/server", - "version": "5.3.0-rc.3", + "version": "5.3.0-rc.4", "description": "Storybook for Server: View HTML snippets from a server in isolation with Hot Reloading.", "keywords": [ "storybook" @@ -33,12 +33,11 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "5.3.0-rc.3", - "@storybook/core": "5.3.0-rc.3", + "@storybook/addons": "5.3.0-rc.4", + "@storybook/core": "5.3.0-rc.4", "@types/webpack-env": "^1.13.9", "core-js": "^3.0.1", "global": "^4.3.2", - "html-loader": "^0.5.5", "regenerator-runtime": "^0.13.3", "ts-dedent": "^1.1.0" }, diff --git a/app/server/src/client/preview/render.ts b/app/server/src/client/preview/render.ts index 67981c13ef5f..309d186eb739 100644 --- a/app/server/src/client/preview/render.ts +++ b/app/server/src/client/preview/render.ts @@ -14,10 +14,27 @@ export default async function renderMain({ showMain, showError, forceRender, + parameters, }: RenderMainArgs) { const params = storyFn(); - const element = await fetchStoryHtml(id, params); + const { + server: { url, id: storyId }, + } = parameters; + + if (fetchStoryHtml === undefined) { + showError({ + title: `Expecting fetchStoryHtml to be configured for @storybook/server.`, + description: dedent` + Did you forget to pass a fetchStoryHtml function to configure? + Use "configure(() => stories, module, { fetchStoryHtml: yourFetchHtmlFunction });". + `, + }); + return; + } + + const fetchId = storyId || id; + const element = await fetchStoryHtml(url, fetchId, params); showMain(); if (typeof element === 'string') { diff --git a/app/server/src/client/preview/types.ts b/app/server/src/client/preview/types.ts index 4b267c0256dc..c05f54ca5f47 100644 --- a/app/server/src/client/preview/types.ts +++ b/app/server/src/client/preview/types.ts @@ -2,7 +2,7 @@ import { StoryFn } from '@storybook/addons'; export type StoryFnServerReturnType = any; -export type FetchStoryHtmlType = (id: string, params: any) => Promise; +export type FetchStoryHtmlType = (url: string, id: string, params: any) => Promise; export interface IStorybookStory { name: string; @@ -31,4 +31,5 @@ export interface RenderMainArgs { showMain: () => void; showError: (args: ShowErrorArgs) => void; forceRender: boolean; + parameters: any; } diff --git a/app/server/src/server/framework-preset-server.ts b/app/server/src/server/framework-preset-server.ts index a3b4185d0a1a..99c260139df1 100644 --- a/app/server/src/server/framework-preset-server.ts +++ b/app/server/src/server/framework-preset-server.ts @@ -2,21 +2,5 @@ import { Configuration } from 'webpack'; export function webpack(config: Configuration) { - return { - ...config, - module: { - ...config.module, - rules: [ - ...config.module.rules, - { - test: /\.html$/, - use: [ - { - loader: require.resolve('html-loader'), - }, - ], - }, - ], - }, - }; + return config; } diff --git a/examples/server-kitchen-sink/client/.eslintrc b/examples/server-kitchen-sink/client/.eslintrc new file mode 100644 index 000000000000..1fddb2b7b9fe --- /dev/null +++ b/examples/server-kitchen-sink/client/.eslintrc @@ -0,0 +1,8 @@ +{ + "env": { + "browser": true + }, + "globals": { + "fetch": true + } +} \ No newline at end of file diff --git a/examples/server-kitchen-sink/client/stories.json b/examples/server-kitchen-sink/client/stories.json new file mode 100644 index 000000000000..e291b56d657d --- /dev/null +++ b/examples/server-kitchen-sink/client/stories.json @@ -0,0 +1,42 @@ +[ + { + "title": "Demo Examples", + "decorators": ["a11y", "knobs"], + "parameters": { + "options": { "selectedPanel": "storybook/a11y/panel" }, + "backgrounds": [ + { "name": "light", "value": "#eeeeee" }, + { "name": "dark", "value": "#222222", "default": true } + ] + }, + "stories": [ + { + "name": "Heading" + }, + { + "name": "With Knobs", + "parameters": { + "knobs": [ + {"name": "name", "type": "text", "default": "John Smith"}, + {"name": "age", "type": "number", "default": "42"} + ] + } + }, + { + "name": "Simple note", + "parameters": { + "notes": "My notes on some bold text" + } + }, + { + "name": "With Actions", + "parameters": { + "actions": [ + { "click": "clicked", "contextmenu": "right clicked" }, + { "clearOnStoryChange": false } + ] + } + } + ] + } +] \ No newline at end of file diff --git a/examples/server-kitchen-sink/client/stories/addon-a11y.stories.js b/examples/server-kitchen-sink/client/stories/addon-a11y.stories.js new file mode 100644 index 000000000000..7af944630975 --- /dev/null +++ b/examples/server-kitchen-sink/client/stories/addon-a11y.stories.js @@ -0,0 +1,37 @@ +import { withA11y } from '@storybook/addon-a11y'; + +export default { + title: 'Addons/a11y', + decorators: [withA11y], + parameters: { + options: { selectedPanel: 'storybook/a11y/panel' }, + }, +}; + +export const Default = () => {}; +Default.story = { + parameters: { + server: { id: 'addons/a11y/default' }, + }, +}; +export const Label = () => {}; +Label.story = { + parameters: { + server: { id: 'addons/a11y/label' }, + }, +}; + +export const Disabled = () => {}; +Disabled.story = { + parameters: { + server: { id: 'addons/a11y/disabled' }, + }, +}; + +export const Contrast = () => {}; +Contrast.story = { + name: 'Invalid contrast', + parameters: { + server: { id: 'addons/a11y/contrast' }, + }, +}; diff --git a/examples/server-kitchen-sink/client/stories/addon-actions.stories.js b/examples/server-kitchen-sink/client/stories/addon-actions.stories.js new file mode 100644 index 000000000000..e025b9c584d4 --- /dev/null +++ b/examples/server-kitchen-sink/client/stories/addon-actions.stories.js @@ -0,0 +1,80 @@ +import { withActions, decorate } from '@storybook/addon-actions'; + +const pickTarget = decorate([args => [args[0].target]]); + +const button = () => {}; + +export default { + title: 'Addons/Actions', +}; + +export const Story1 = () => withActions('click')(button); +Story1.story = { + name: 'Hello World', + parameters: { + server: { id: 'addons/actions/story1' }, + }, +}; +export const Story2 = () => withActions('click', 'contextmenu')(button); +Story2.story = { + name: 'Multiple actions', + parameters: { + server: { id: 'addons/actions/story2' }, + }, +}; + +export const Story3 = () => + withActions('click', 'contextmenu', { clearOnStoryChange: false })(button); +Story3.story = { + name: 'Multiple actions + config', + parameters: { + server: { id: 'addons/actions/story3' }, + }, +}; + +export const Story4 = () => withActions({ click: 'clicked', contextmenu: 'right clicked' })(button); +Story4.story = { + name: 'Multiple actions, object', + parameters: { + server: { id: 'addons/actions/story4' }, + }, +}; + +export const Story5 = () => + withActions({ 'click .btn': 'clicked', contextmenu: 'right clicked' })(button); + +Story5.story = { + name: 'Multiple actions, selector', + parameters: { + server: { id: 'addons/actions/story5' }, + }, +}; + +export const Story6 = () => + withActions( + { click: 'clicked', contextmenu: 'right clicked' }, + { clearOnStoryChange: false } + )(button); +Story6.story = { + name: 'Multiple actions, object + config', + parameters: { + server: { id: 'addons/actions/story6' }, + }, +}; + +export const Story7 = () => pickTarget.withActions('click', 'contextmenu')(button); +Story7.story = { + name: 'Decorated actions', + parameters: { + server: { id: 'addons/actions/story7' }, + }, +}; + +export const Story8 = () => + pickTarget.withActions('click', 'contextmenu', { clearOnStoryChange: false })(button); +Story8.story = { + name: 'Decorated actions + config', + parameters: { + server: { id: 'addons/actions/story8' }, + }, +}; diff --git a/examples/server-kitchen-sink/client/stories/addon-backgrounds.stories.js b/examples/server-kitchen-sink/client/stories/addon-backgrounds.stories.js new file mode 100644 index 000000000000..a8a57aaa8355 --- /dev/null +++ b/examples/server-kitchen-sink/client/stories/addon-backgrounds.stories.js @@ -0,0 +1,25 @@ +export default { + title: 'Addons/Backgrounds', + parameters: { + backgrounds: [ + { name: 'light', value: '#eeeeee' }, + { name: 'dark', value: '#222222', default: true }, + ], + }, +}; + +export const Story1 = () => {}; +Story1.story = { + name: 'story 1', + parameters: { + server: { id: 'addons/backgrounds/story1' }, + }, +}; + +export const Story2 = () => {}; +Story2.story = { + name: 'story 2', + parameters: { + server: { id: 'addons/backgrounds/story2' }, + }, +}; diff --git a/examples/server-kitchen-sink/client/stories/addon-knobs.stories.js b/examples/server-kitchen-sink/client/stories/addon-knobs.stories.js new file mode 100644 index 000000000000..ca2483f8f791 --- /dev/null +++ b/examples/server-kitchen-sink/client/stories/addon-knobs.stories.js @@ -0,0 +1,96 @@ +import { + array, + boolean, + color, + date, + select, + withKnobs, + text, + number, +} from '@storybook/addon-knobs'; + +export default { + title: 'Addons/Knobs', + decorators: [withKnobs], +}; + +export const Simple = () => { + const name = text('Name', 'John Doe'); + const age = number('Age', 44); + const content = `I am ${name} and I'm ${age} years old.`; + return { content }; +}; +Simple.story = { + parameters: { + server: { id: 'addons/knobs/simple' }, + }, +}; + +export const Story3 = () => { + const name = text('Name', 'John Doe'); + const textColor = color('Text color', 'orangered'); + return { name, textColor }; +}; +Story3.story = { + name: 'CSS transitions', + parameters: { + server: { id: 'addons/knobs/story3' }, + }, +}; + +export const Story4 = () => { + const name = text('Name', 'Jane'); + const stock = number('Stock', 20, { + range: true, + min: 0, + max: 30, + step: 5, + }); + const fruits = { + Apple: 'apples', + Banana: 'bananas', + Cherry: 'cherries', + }; + const fruit = select('Fruit', fruits, 'apples'); + const price = number('Price', 2.25); + const colour = color('Border', 'deeppink'); + const today = date('Today', new Date('Jan 20 2017 GMT+0')); + const items = array('Items', ['Laptop', 'Book', 'Whiskey']); + const nice = boolean('Nice', true); + + const stockMessage = stock + ? `I have a stock of ${stock} ${fruit}, costing $${price} each.` + : `I'm out of ${fruit}${nice ? ', Sorry!' : '.'}`; + + const salutation = nice ? 'Nice to meet you!' : 'Leave me alone!'; + const dateOptions = { year: 'numeric', month: 'long', day: 'numeric', timeZone: 'UTC' }; + + const style = `border: 2px dotted ${colour}; padding: 8px 22px; border-radius: 8px`; + + return { + style, + name, + today, + dateOptions: JSON.stringify(dateOptions), + stockMessage, + items: JSON.stringify(items), + salutation, + }; +}; +Story4.story = { + name: 'All knobs', + parameters: { + server: { id: 'addons/knobs/story4' }, + }, +}; + +export const Story5 = () => { + const content = text('Rendered string', ''); + return { content }; +}; +Story5.story = { + name: 'XSS safety', + parameters: { + server: { id: 'addons/knobs/story5' }, + }, +}; diff --git a/examples/server-kitchen-sink/client/stories/addon-notes.stories.js b/examples/server-kitchen-sink/client/stories/addon-notes.stories.js new file mode 100644 index 000000000000..257c94248699 --- /dev/null +++ b/examples/server-kitchen-sink/client/stories/addon-notes.stories.js @@ -0,0 +1,12 @@ +export default { + title: 'Addons/Notes', +}; + +export const Story1 = () => {}; +Story1.story = { + name: 'Simple note', + parameters: { + notes: 'My notes on some bold text', + server: { id: 'addons/notes/story1' }, + }, +}; diff --git a/examples/server-kitchen-sink/client/stories/demo.stories.js b/examples/server-kitchen-sink/client/stories/demo.stories.js new file mode 100644 index 000000000000..89a048adb106 --- /dev/null +++ b/examples/server-kitchen-sink/client/stories/demo.stories.js @@ -0,0 +1,36 @@ +export default { + title: 'Demo', + parameters: { + componentSubtitle: 'Handy status label', + }, +}; + +export const Heading = () => {}; +Heading.story = { + parameters: { + server: { id: 'demo/heading' }, + }, +}; + +export const Headings = () => {}; +Headings.story = { + parameters: { + server: { id: 'demo/headings' }, + }, +}; + +export const Button = () => {}; +Button.story = { + parameters: { + docs: { component: 'hi there docs' }, + server: { id: 'demo/button' }, + }, +}; +export const Params = () => { + return { message: 'Hi World!' }; +}; +Params.story = { + parameters: { + server: { id: 'demo/params' }, + }, +}; diff --git a/examples/server-kitchen-sink/client/stories/welcome.stories.js b/examples/server-kitchen-sink/client/stories/welcome.stories.js new file mode 100644 index 000000000000..35636669975c --- /dev/null +++ b/examples/server-kitchen-sink/client/stories/welcome.stories.js @@ -0,0 +1,13 @@ +import { withLinks } from '@storybook/addon-links'; + +export default { + title: 'Welcome', + decorators: [withLinks], +}; + +export const Welcome = () => {}; +Welcome.story = { + parameters: { + server: { id: 'welcome/welcome' }, + }, +}; diff --git a/examples/server-kitchen-sink/client/storybook.html b/examples/server-kitchen-sink/client/storybook.html index 5ad7fc27c95e..2f4b6420e05f 100644 --- a/examples/server-kitchen-sink/client/storybook.html +++ b/examples/server-kitchen-sink/client/storybook.html @@ -5,6 +5,9 @@ +
diff --git a/examples/server-kitchen-sink/client/storybook.js b/examples/server-kitchen-sink/client/storybook.js index 047458d3cd0d..8fa531c610c1 100644 --- a/examples/server-kitchen-sink/client/storybook.js +++ b/examples/server-kitchen-sink/client/storybook.js @@ -1,19 +1,37 @@ -import camelcase from 'camelcase'; -import { configure } from '@storybook/server'; +import { configure, addParameters } from '@storybook/server'; -import stories from './storybook.stories'; +import * as a11yStories from './stories/addon-a11y.stories'; +import * as actionsStories from './stories/addon-actions.stories'; +import * as backgroundStories from './stories/addon-backgrounds.stories'; +import * as knobsStories from './stories/addon-knobs.stories'; +import * as notesStories from './stories/addon-notes.stories'; +import * as welcomeStories from './stories/welcome.stories'; +import * as demoStories from './stories/demo.stories'; const port = process.env.PORT || 8080; -const fetchHtml = async (id, params) => { - const [component, story] = id.split('--').map(s => camelcase(s)); +addParameters({ server: { url: `http://localhost:${port}/storybook_preview` } }); - const url = new URL(`http://localhost:${port}/storybook_preview/${component}/${story}`); - url.search = new URLSearchParams(params).toString(); +const fetchHtml = async (url, id, params) => { + const fetchUrl = new URL(`${url}/${id}`); + fetchUrl.search = new URLSearchParams(params).toString(); - // eslint-disable-next-line no-undef - const response = await fetch(url); + const response = await fetch(fetchUrl); return response.text(); }; -configure(() => stories, module, { fetchStoryHtml: fetchHtml }); +configure( + () => [ + a11yStories, + actionsStories, + backgroundStories, + knobsStories, + notesStories, + welcomeStories, + demoStories, + ], + module, + { + fetchStoryHtml: fetchHtml, + } +); diff --git a/examples/server-kitchen-sink/client/storybook.stories.js b/examples/server-kitchen-sink/client/storybook.stories.js deleted file mode 100644 index 880af3e8b056..000000000000 --- a/examples/server-kitchen-sink/client/storybook.stories.js +++ /dev/null @@ -1,33 +0,0 @@ -import { text, withKnobs } from '@storybook/addon-knobs'; -import { titleCase } from 'title-case'; - -import stories from '../server/stories'; - -const storyBookStories = Object.keys(stories).map(component => { - const storybookDescription = { - default: { - title: component, - decorators: [withKnobs], - }, - }; - const componentStories = stories[component]; - Object.keys(componentStories).forEach(storyName => { - const componentStory = componentStories[storyName]; - - storybookDescription[storyName] = () => { - // Build the list of knobs from the stroy arguments. Assume that all arguments are text. - // More sophisticated server backends could have DSLs to provide other types. - const knobs = {}; - Object.keys(componentStory).forEach(argument => { - const name = titleCase(argument); - const defaultValue = componentStory[argument]; - knobs[argument] = text(name, defaultValue); - }); - return knobs; - }; - }); - - return storybookDescription; -}); - -export default storyBookStories; diff --git a/examples/server-kitchen-sink/package.json b/examples/server-kitchen-sink/package.json index 7bda7201065d..8eb8fbc6e374 100644 --- a/examples/server-kitchen-sink/package.json +++ b/examples/server-kitchen-sink/package.json @@ -1,20 +1,27 @@ { "name": "server-kitchen-sink", - "version": "0.0.0", + "version": "5.3.0-rc.4", "private": true, "scripts": { "dev": "PORT=1337 nodemon server/app.js", "start": "PORT=1337 node server/app.js" }, + "dependencies": { + "pug": "^2.0.4" + }, "devDependencies": { - "@storybook/addon-knobs": "5.3.0-rc.3", - "@storybook/server": "5.3.0-rc.3", - "camelcase": "^5.3.1", - "concurrently": "^5.0.0", + "@storybook/addon-a11y": "5.3.0-rc.4", + "@storybook/addon-actions": "5.3.0-rc.4", + "@storybook/addon-backgrounds": "5.3.0-rc.4", + "@storybook/addon-centered": "5.3.0-rc.4", + "@storybook/addon-knobs": "5.3.0-rc.4", + "@storybook/addon-links": "5.3.0-rc.4", + "@storybook/addon-notes": "5.3.0-rc.4", + "@storybook/csf": "0.0.1", + "@storybook/server": "5.3.0-rc.4", "express": "~4.16.4", "morgan": "^1.9.1", "nodemon": "^2.0.2", - "parcel-bundler": "^1.12.4", - "title-case": "^3.0.2" + "parcel-bundler": "^1.12.4" } } diff --git a/examples/server-kitchen-sink/server/app.js b/examples/server-kitchen-sink/server/app.js index 0557714d846b..b77036260583 100644 --- a/examples/server-kitchen-sink/server/app.js +++ b/examples/server-kitchen-sink/server/app.js @@ -3,18 +3,18 @@ const morgan = require('morgan'); const Bundler = require('parcel-bundler'); const Path = require('path'); -const renderStory = require('./renderStory'); - const port = process.env.PORT || 8080; const app = express(); -app.use(morgan('tiny')); +app.use(morgan('dev')); +app.set('views', Path.join(__dirname, 'views')); +app.set('view engine', 'pug'); app.get('/', (req, res) => res.send('Hello World!')); -app.get('/storybook_preview/:component/:story', (req, res) => { - res.send(renderStory(req.params.component, req.params.story, req.query)); +app.get(/storybook_preview\/(.*)/, (req, res) => { + res.render(req.params[0], req.query); }); const storybookFile = Path.join(__dirname, '../client/storybook.html'); diff --git a/examples/server-kitchen-sink/server/renderStory.js b/examples/server-kitchen-sink/server/renderStory.js deleted file mode 100644 index 9dcebf18a44c..000000000000 --- a/examples/server-kitchen-sink/server/renderStory.js +++ /dev/null @@ -1,11 +0,0 @@ -const stories = require('./stories'); -const templates = require('./templates'); - -const renderStory = (component, story, params) => { - const template = templates[component]; - const defaultParams = stories[component][story]; - - return template({ ...defaultParams, ...params }); -}; - -module.exports = renderStory; diff --git a/examples/server-kitchen-sink/server/stories.js b/examples/server-kitchen-sink/server/stories.js deleted file mode 100644 index 1dff810b1d3f..000000000000 --- a/examples/server-kitchen-sink/server/stories.js +++ /dev/null @@ -1,12 +0,0 @@ -module.exports = { - button: { - withShortText: { text: 'OK' }, - withLongText: { text: 'Push Me Please!' }, - withReallyLongText: { text: 'Push Me Please! You know you want to!!' }, - }, - message: { - hello: { message: 'Hello World!', color: 'black' }, - red: { message: 'Hello World!', color: 'red' }, - goodbye: { message: 'Bye!', color: 'green' }, - }, -}; diff --git a/examples/server-kitchen-sink/server/templates.js b/examples/server-kitchen-sink/server/templates.js deleted file mode 100644 index 879bf646376f..000000000000 --- a/examples/server-kitchen-sink/server/templates.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - button: params => ``, - message: params => `
${params.message}
`, -}; diff --git a/examples/server-kitchen-sink/server/views/addons/a11y/contrast.pug b/examples/server-kitchen-sink/server/views/addons/a11y/contrast.pug new file mode 100644 index 000000000000..4b217011d3a1 --- /dev/null +++ b/examples/server-kitchen-sink/server/views/addons/a11y/contrast.pug @@ -0,0 +1 @@ +button(style='color: black; background-color: brown;') Testing the a11y addon \ No newline at end of file diff --git a/examples/server-kitchen-sink/server/views/addons/a11y/default.pug b/examples/server-kitchen-sink/server/views/addons/a11y/default.pug new file mode 100644 index 000000000000..0900630d219d --- /dev/null +++ b/examples/server-kitchen-sink/server/views/addons/a11y/default.pug @@ -0,0 +1 @@ +button \ No newline at end of file diff --git a/examples/server-kitchen-sink/server/views/addons/a11y/disabled.pug b/examples/server-kitchen-sink/server/views/addons/a11y/disabled.pug new file mode 100644 index 000000000000..2b3652f5ecc7 --- /dev/null +++ b/examples/server-kitchen-sink/server/views/addons/a11y/disabled.pug @@ -0,0 +1 @@ +button(disabled) Testing the a11y addon \ No newline at end of file diff --git a/examples/server-kitchen-sink/server/views/addons/a11y/label.pug b/examples/server-kitchen-sink/server/views/addons/a11y/label.pug new file mode 100644 index 000000000000..901f438d64a5 --- /dev/null +++ b/examples/server-kitchen-sink/server/views/addons/a11y/label.pug @@ -0,0 +1 @@ +button Testing the a11y addon \ No newline at end of file diff --git a/examples/server-kitchen-sink/server/views/addons/actions/button.pug b/examples/server-kitchen-sink/server/views/addons/actions/button.pug new file mode 100644 index 000000000000..e612bbfb36f1 --- /dev/null +++ b/examples/server-kitchen-sink/server/views/addons/actions/button.pug @@ -0,0 +1 @@ +button(type="button") Hello World \ No newline at end of file diff --git a/examples/server-kitchen-sink/server/views/addons/actions/story1.pug b/examples/server-kitchen-sink/server/views/addons/actions/story1.pug new file mode 100644 index 000000000000..7894bcc0743b --- /dev/null +++ b/examples/server-kitchen-sink/server/views/addons/actions/story1.pug @@ -0,0 +1 @@ +include button.pug \ No newline at end of file diff --git a/examples/server-kitchen-sink/server/views/addons/actions/story2.pug b/examples/server-kitchen-sink/server/views/addons/actions/story2.pug new file mode 100644 index 000000000000..7894bcc0743b --- /dev/null +++ b/examples/server-kitchen-sink/server/views/addons/actions/story2.pug @@ -0,0 +1 @@ +include button.pug \ No newline at end of file diff --git a/examples/server-kitchen-sink/server/views/addons/actions/story3.pug b/examples/server-kitchen-sink/server/views/addons/actions/story3.pug new file mode 100644 index 000000000000..7894bcc0743b --- /dev/null +++ b/examples/server-kitchen-sink/server/views/addons/actions/story3.pug @@ -0,0 +1 @@ +include button.pug \ No newline at end of file diff --git a/examples/server-kitchen-sink/server/views/addons/actions/story4.pug b/examples/server-kitchen-sink/server/views/addons/actions/story4.pug new file mode 100644 index 000000000000..7894bcc0743b --- /dev/null +++ b/examples/server-kitchen-sink/server/views/addons/actions/story4.pug @@ -0,0 +1 @@ +include button.pug \ No newline at end of file diff --git a/examples/server-kitchen-sink/server/views/addons/actions/story5.pug b/examples/server-kitchen-sink/server/views/addons/actions/story5.pug new file mode 100644 index 000000000000..557c20da0e89 --- /dev/null +++ b/examples/server-kitchen-sink/server/views/addons/actions/story5.pug @@ -0,0 +1,3 @@ +div + | Clicks on this button will be logged: + button(class="btn" type="button") Button \ No newline at end of file diff --git a/examples/server-kitchen-sink/server/views/addons/actions/story6.pug b/examples/server-kitchen-sink/server/views/addons/actions/story6.pug new file mode 100644 index 000000000000..7894bcc0743b --- /dev/null +++ b/examples/server-kitchen-sink/server/views/addons/actions/story6.pug @@ -0,0 +1 @@ +include button.pug \ No newline at end of file diff --git a/examples/server-kitchen-sink/server/views/addons/actions/story7.pug b/examples/server-kitchen-sink/server/views/addons/actions/story7.pug new file mode 100644 index 000000000000..7894bcc0743b --- /dev/null +++ b/examples/server-kitchen-sink/server/views/addons/actions/story7.pug @@ -0,0 +1 @@ +include button.pug \ No newline at end of file diff --git a/examples/server-kitchen-sink/server/views/addons/actions/story8.pug b/examples/server-kitchen-sink/server/views/addons/actions/story8.pug new file mode 100644 index 000000000000..7894bcc0743b --- /dev/null +++ b/examples/server-kitchen-sink/server/views/addons/actions/story8.pug @@ -0,0 +1 @@ +include button.pug \ No newline at end of file diff --git a/examples/server-kitchen-sink/server/views/addons/backgrounds/story1.pug b/examples/server-kitchen-sink/server/views/addons/backgrounds/story1.pug new file mode 100644 index 000000000000..7d62c85d7cdf --- /dev/null +++ b/examples/server-kitchen-sink/server/views/addons/backgrounds/story1.pug @@ -0,0 +1 @@ +span(style="color: white") You should be able to switch backgrounds for this story \ No newline at end of file diff --git a/examples/server-kitchen-sink/server/views/addons/backgrounds/story2.pug b/examples/server-kitchen-sink/server/views/addons/backgrounds/story2.pug new file mode 100644 index 000000000000..82abc4ee834a --- /dev/null +++ b/examples/server-kitchen-sink/server/views/addons/backgrounds/story2.pug @@ -0,0 +1 @@ +span(style="color: white") This one too! \ No newline at end of file diff --git a/examples/server-kitchen-sink/server/views/addons/knobs/simple.pug b/examples/server-kitchen-sink/server/views/addons/knobs/simple.pug new file mode 100644 index 000000000000..bc2061c0a0b5 --- /dev/null +++ b/examples/server-kitchen-sink/server/views/addons/knobs/simple.pug @@ -0,0 +1 @@ +div= content \ No newline at end of file diff --git a/examples/server-kitchen-sink/server/views/addons/knobs/story3.pug b/examples/server-kitchen-sink/server/views/addons/knobs/story3.pug new file mode 100644 index 000000000000..ec8996a53780 --- /dev/null +++ b/examples/server-kitchen-sink/server/views/addons/knobs/story3.pug @@ -0,0 +1 @@ +p(style=`transition: color 0.5s ease-out; color: ${textColor}`)= name \ No newline at end of file diff --git a/examples/server-kitchen-sink/server/views/addons/knobs/story4.pug b/examples/server-kitchen-sink/server/views/addons/knobs/story4.pug new file mode 100644 index 000000000000..73b54dd3e7cd --- /dev/null +++ b/examples/server-kitchen-sink/server/views/addons/knobs/story4.pug @@ -0,0 +1,13 @@ +- today = new Date(parseInt(today, 10)); +- dateOptions = JSON.parse(dateOptions); +- items = JSON.parse(items); + +div(style='#{style}') + h1 My name is #{name}, + h3 today is #{today.toLocaleDateString('en-US', dateOptions)} + p !{stockMessage} + p Also, I have: + ul + each item in items + li= item + p #{salutation} \ No newline at end of file diff --git a/examples/server-kitchen-sink/server/views/addons/knobs/story5.pug b/examples/server-kitchen-sink/server/views/addons/knobs/story5.pug new file mode 100644 index 000000000000..6e0f1c5d2d33 --- /dev/null +++ b/examples/server-kitchen-sink/server/views/addons/knobs/story5.pug @@ -0,0 +1 @@ + !{content} \ No newline at end of file diff --git a/examples/server-kitchen-sink/server/views/addons/notes/story1.pug b/examples/server-kitchen-sink/server/views/addons/notes/story1.pug new file mode 100644 index 000000000000..dee88febdf62 --- /dev/null +++ b/examples/server-kitchen-sink/server/views/addons/notes/story1.pug @@ -0,0 +1,2 @@ +p + strong This is a fragment of HTML diff --git a/examples/server-kitchen-sink/server/views/demo/button.pug b/examples/server-kitchen-sink/server/views/demo/button.pug new file mode 100644 index 000000000000..69e440c555c6 --- /dev/null +++ b/examples/server-kitchen-sink/server/views/demo/button.pug @@ -0,0 +1 @@ +button Hello Button \ No newline at end of file diff --git a/examples/server-kitchen-sink/server/views/demo/heading.pug b/examples/server-kitchen-sink/server/views/demo/heading.pug new file mode 100644 index 000000000000..23b68dd8f3e9 --- /dev/null +++ b/examples/server-kitchen-sink/server/views/demo/heading.pug @@ -0,0 +1 @@ +h1 Hello World \ No newline at end of file diff --git a/examples/server-kitchen-sink/server/views/demo/headings.pug b/examples/server-kitchen-sink/server/views/demo/headings.pug new file mode 100644 index 000000000000..23a6d7f78ab6 --- /dev/null +++ b/examples/server-kitchen-sink/server/views/demo/headings.pug @@ -0,0 +1,4 @@ +h1 Hellow World +h2 Hellow World +h3 Hellow World +h4 Hellow World \ No newline at end of file diff --git a/examples/server-kitchen-sink/server/views/demo/params.pug b/examples/server-kitchen-sink/server/views/demo/params.pug new file mode 100644 index 000000000000..21cb5e2114f8 --- /dev/null +++ b/examples/server-kitchen-sink/server/views/demo/params.pug @@ -0,0 +1 @@ +h1= message \ No newline at end of file diff --git a/examples/server-kitchen-sink/server/views/welcome/welcome.pug b/examples/server-kitchen-sink/server/views/welcome/welcome.pug new file mode 100644 index 000000000000..8c4c4701261a --- /dev/null +++ b/examples/server-kitchen-sink/server/views/welcome/welcome.pug @@ -0,0 +1,36 @@ +.main + h1 Welcome to Storybook for Server + p This is a UI component dev environment for your plain HTML snippets. + p. + We've added some basic stories inside the #[code.code stories] directory. + #[br] + A story is a single state of one or more UI components. You can have as many stories as you want. + #[br] + (Basically a story is like a visual test case.) + p. + See these sample #[a.link(href='#' data-sb-kind='Demo Card' data-sb-story='Front') stories] + p. + Just like that, you can add your own snippets as stories. + #[br] + You can also edit those snippets and see changes right away. + #[br] + p. + Usually we create stories with smaller UI components in the app. + #[br] + Have a look at the #[a.link(href='https://storybook.js.org/basics/writing-stories' target='_blank') Writing Stories] section in our documentation. +style. + .main { + padding: 15px; + line-height: 1.4; + font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; + background-color: #ffffff; + } + .code { + font-size: 15px; + font-weight: 600; + padding: 2px 5px; + border: 1px solid #eae9e9; + border-radius: 4px; + background-color: #f3f2f2; + color: #3a3a3a; + } \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 112ad7929bee..281fe09c4814 100644 --- a/yarn.lock +++ b/yarn.lock @@ -25034,7 +25034,7 @@ pug-walk@^1.1.8: resolved "https://registry.yarnpkg.com/pug-walk/-/pug-walk-1.1.8.tgz#b408f67f27912f8c21da2f45b7230c4bd2a5ea7a" integrity sha512-GMu3M5nUL3fju4/egXwZO0XLi6fW/K3T3VTgFQ14GxNi8btlxgT5qZL//JwZFm/2Fa64J/PNS8AZeys3wiMkVA== -pug@^2.0.3: +pug@^2.0.3, pug@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/pug/-/pug-2.0.4.tgz#ee7682ec0a60494b38d48a88f05f3b0ac931377d" integrity sha512-XhoaDlvi6NIzL49nu094R2NA6P37ijtgMDuWE+ofekDChvfKnzFal60bhSdiy8y2PBO6fmz3oMEIcfpBVRUdvw== @@ -30466,13 +30466,6 @@ tinycolor2@^1.4.1: resolved "https://registry.yarnpkg.com/tinycolor2/-/tinycolor2-1.4.1.tgz#f4fad333447bc0b07d4dc8e9209d8f39a8ac77e8" integrity sha1-9PrTM0R7wLB9TcjpIJ2POaisd+g= -title-case@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/title-case/-/title-case-3.0.2.tgz#9f926a0a42071366f85470572f312c4b647773ab" - integrity sha512-1P5hyjEhJ9Ab0AT8Xbm0z1avwPSgRR6XtFSNCdfo6B7111TTTja+456UZ2ZPkbTbzqBwIpQxp/tazh5UvpJ+fA== - dependencies: - tslib "^1.10.0" - tmp@0.0.28: version "0.0.28" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.28.tgz#172735b7f614ea7af39664fa84cf0de4e515d120" @@ -30878,7 +30871,7 @@ tsconfig-paths@^3.4.0: minimist "^1.2.0" strip-bom "^3.0.0" -tslib@1.10.0, tslib@^1.10.0, tslib@^1.7.1, tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3: +tslib@1.10.0, tslib@^1.7.1, tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3: version "1.10.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== From a685fc41f8f126d36f94437a9ed811bafc615bdb Mon Sep 17 00:00:00 2001 From: Jon Palmer Date: Thu, 2 Jan 2020 13:01:28 -0500 Subject: [PATCH 06/25] Support Parameters and StoryFn as a way to pass params to the server --- app/server/src/client/preview/render.ts | 7 ++-- .../client/stories/demo.stories.js | 8 ---- .../client/stories/params.stories.js | 41 +++++++++++++++++++ .../server-kitchen-sink/client/storybook.js | 2 + .../server/views/demo/params.pug | 1 - .../server/views/params/override.pug | 1 + .../server/views/params/params.pug | 1 + .../server/views/params/story.pug | 1 + .../server/views/params/story_fn_override.pug | 1 + 9 files changed, 51 insertions(+), 12 deletions(-) create mode 100644 examples/server-kitchen-sink/client/stories/params.stories.js delete mode 100644 examples/server-kitchen-sink/server/views/demo/params.pug create mode 100644 examples/server-kitchen-sink/server/views/params/override.pug create mode 100644 examples/server-kitchen-sink/server/views/params/params.pug create mode 100644 examples/server-kitchen-sink/server/views/params/story.pug create mode 100644 examples/server-kitchen-sink/server/views/params/story_fn_override.pug diff --git a/app/server/src/client/preview/render.ts b/app/server/src/client/preview/render.ts index 309d186eb739..bbb83ee7fcc7 100644 --- a/app/server/src/client/preview/render.ts +++ b/app/server/src/client/preview/render.ts @@ -16,10 +16,10 @@ export default async function renderMain({ forceRender, parameters, }: RenderMainArgs) { - const params = storyFn(); + const storyParams = storyFn(); const { - server: { url, id: storyId }, + server: { url, id: storyId, params }, } = parameters; if (fetchStoryHtml === undefined) { @@ -34,7 +34,8 @@ export default async function renderMain({ } const fetchId = storyId || id; - const element = await fetchStoryHtml(url, fetchId, params); + const fetchParams = { ...params, ...storyParams }; + const element = await fetchStoryHtml(url, fetchId, fetchParams); showMain(); if (typeof element === 'string') { diff --git a/examples/server-kitchen-sink/client/stories/demo.stories.js b/examples/server-kitchen-sink/client/stories/demo.stories.js index 89a048adb106..974fe132f7e3 100644 --- a/examples/server-kitchen-sink/client/stories/demo.stories.js +++ b/examples/server-kitchen-sink/client/stories/demo.stories.js @@ -26,11 +26,3 @@ Button.story = { server: { id: 'demo/button' }, }, }; -export const Params = () => { - return { message: 'Hi World!' }; -}; -Params.story = { - parameters: { - server: { id: 'demo/params' }, - }, -}; diff --git a/examples/server-kitchen-sink/client/stories/params.stories.js b/examples/server-kitchen-sink/client/stories/params.stories.js new file mode 100644 index 000000000000..9d5bc9d8908b --- /dev/null +++ b/examples/server-kitchen-sink/client/stories/params.stories.js @@ -0,0 +1,41 @@ +export default { + title: 'Params', + parameters: { + componentSubtitle: 'Handy status label', + server: { + params: { color: 'red' }, + }, + }, +}; + +export const Story = () => {}; +Story.story = { + parameters: { + server: { + id: 'params/story', + params: { message: 'Hello World' }, + }, + }, +}; + +export const Override = () => {}; +Override.story = { + parameters: { + docs: { component: 'hi there docs' }, + server: { + id: 'params/override', + params: { message: 'Hello World', color: 'green' }, + }, + }, +}; +export const StoryFnOverride = () => { + return { message: 'Hi World!', color: 'blue' }; +}; +StoryFnOverride.story = { + parameters: { + server: { + id: 'params/story_fn_override', + params: { message: 'Hello World', color: 'green' }, + }, + }, +}; diff --git a/examples/server-kitchen-sink/client/storybook.js b/examples/server-kitchen-sink/client/storybook.js index 8fa531c610c1..d23f550c627a 100644 --- a/examples/server-kitchen-sink/client/storybook.js +++ b/examples/server-kitchen-sink/client/storybook.js @@ -6,6 +6,7 @@ import * as backgroundStories from './stories/addon-backgrounds.stories'; import * as knobsStories from './stories/addon-knobs.stories'; import * as notesStories from './stories/addon-notes.stories'; import * as welcomeStories from './stories/welcome.stories'; +import * as paramsStories from './stories/params.stories'; import * as demoStories from './stories/demo.stories'; const port = process.env.PORT || 8080; @@ -28,6 +29,7 @@ configure( knobsStories, notesStories, welcomeStories, + paramsStories, demoStories, ], module, diff --git a/examples/server-kitchen-sink/server/views/demo/params.pug b/examples/server-kitchen-sink/server/views/demo/params.pug deleted file mode 100644 index 21cb5e2114f8..000000000000 --- a/examples/server-kitchen-sink/server/views/demo/params.pug +++ /dev/null @@ -1 +0,0 @@ -h1= message \ No newline at end of file diff --git a/examples/server-kitchen-sink/server/views/params/override.pug b/examples/server-kitchen-sink/server/views/params/override.pug new file mode 100644 index 000000000000..b60cffc6349b --- /dev/null +++ b/examples/server-kitchen-sink/server/views/params/override.pug @@ -0,0 +1 @@ +include params.pug \ No newline at end of file diff --git a/examples/server-kitchen-sink/server/views/params/params.pug b/examples/server-kitchen-sink/server/views/params/params.pug new file mode 100644 index 000000000000..5020bd41af24 --- /dev/null +++ b/examples/server-kitchen-sink/server/views/params/params.pug @@ -0,0 +1 @@ +h1(style=`color: ${color}`)= message \ No newline at end of file diff --git a/examples/server-kitchen-sink/server/views/params/story.pug b/examples/server-kitchen-sink/server/views/params/story.pug new file mode 100644 index 000000000000..b60cffc6349b --- /dev/null +++ b/examples/server-kitchen-sink/server/views/params/story.pug @@ -0,0 +1 @@ +include params.pug \ No newline at end of file diff --git a/examples/server-kitchen-sink/server/views/params/story_fn_override.pug b/examples/server-kitchen-sink/server/views/params/story_fn_override.pug new file mode 100644 index 000000000000..b60cffc6349b --- /dev/null +++ b/examples/server-kitchen-sink/server/views/params/story_fn_override.pug @@ -0,0 +1 @@ +include params.pug \ No newline at end of file From a06694dcb160ef382a049641501cccb5313ed821 Mon Sep 17 00:00:00 2001 From: Jon Palmer Date: Thu, 2 Jan 2020 13:01:37 -0500 Subject: [PATCH 07/25] fetchStoryHtml now optional --- app/server/src/client/preview/index.ts | 6 ++- app/server/src/client/preview/render.ts | 25 +++++------ .../server-kitchen-sink/client/stories.json | 42 ------------------- .../client/stories/index.js | 19 +++++++++ .../server-kitchen-sink/client/storybook.js | 34 ++------------- 5 files changed, 37 insertions(+), 89 deletions(-) delete mode 100644 examples/server-kitchen-sink/client/stories.json create mode 100644 examples/server-kitchen-sink/client/stories/index.js diff --git a/app/server/src/client/preview/index.ts b/app/server/src/client/preview/index.ts index 3a40f147a589..2f9ffc233dbc 100644 --- a/app/server/src/client/preview/index.ts +++ b/app/server/src/client/preview/index.ts @@ -10,7 +10,7 @@ const framework = 'server'; interface ClientApi extends ClientStoryApi { setAddon(addon: any): void; - configure(loader: Loadable, module: NodeModule, options: ConfigureOptionsArgs): void; + configure(loader: Loadable, module: NodeModule, options?: ConfigureOptionsArgs): void; getStorybook(): IStorybookSection[]; clearDecorators(): void; forceReRender(): void; @@ -26,7 +26,9 @@ export const storiesOf: ClientApi['storiesOf'] = (kind, m) => { }; const setRenderFecthAndConfigure: ClientApi['configure'] = (loader, module, options) => { - setFetchStoryHtml(options.fetchStoryHtml); + if (options && options.fetchStoryHtml) { + setFetchStoryHtml(options.fetchStoryHtml); + } api.configure(loader, module, framework); }; diff --git a/app/server/src/client/preview/render.ts b/app/server/src/client/preview/render.ts index bbb83ee7fcc7..409d9de252ad 100644 --- a/app/server/src/client/preview/render.ts +++ b/app/server/src/client/preview/render.ts @@ -1,10 +1,16 @@ -import { document, Node } from 'global'; +import { document, fetch, Node } from 'global'; import dedent from 'ts-dedent'; import { RenderMainArgs, FetchStoryHtmlType } from './types'; const rootElement = document.getElementById('root'); -let fetchStoryHtml: FetchStoryHtmlType; +let fetchStoryHtml: FetchStoryHtmlType = async (url, id, params) => { + const fetchUrl = new URL(`${url}/${id}`); + fetchUrl.search = new URLSearchParams(params).toString(); + + const response = await fetch(fetchUrl); + return response.text(); +}; export default async function renderMain({ storyFn, @@ -22,17 +28,6 @@ export default async function renderMain({ server: { url, id: storyId, params }, } = parameters; - if (fetchStoryHtml === undefined) { - showError({ - title: `Expecting fetchStoryHtml to be configured for @storybook/server.`, - description: dedent` - Did you forget to pass a fetchStoryHtml function to configure? - Use "configure(() => stories, module, { fetchStoryHtml: yourFetchHtmlFunction });". - `, - }); - return; - } - const fetchId = storyId || id; const fetchParams = { ...params, ...storyParams }; const element = await fetchStoryHtml(url, fetchId, fetchParams); @@ -60,5 +55,7 @@ export default async function renderMain({ } export const setFetchStoryHtml: any = (fetchHtml: FetchStoryHtmlType) => { - fetchStoryHtml = fetchHtml; + if (fetchHtml !== undefined) { + fetchStoryHtml = fetchHtml; + } }; diff --git a/examples/server-kitchen-sink/client/stories.json b/examples/server-kitchen-sink/client/stories.json deleted file mode 100644 index e291b56d657d..000000000000 --- a/examples/server-kitchen-sink/client/stories.json +++ /dev/null @@ -1,42 +0,0 @@ -[ - { - "title": "Demo Examples", - "decorators": ["a11y", "knobs"], - "parameters": { - "options": { "selectedPanel": "storybook/a11y/panel" }, - "backgrounds": [ - { "name": "light", "value": "#eeeeee" }, - { "name": "dark", "value": "#222222", "default": true } - ] - }, - "stories": [ - { - "name": "Heading" - }, - { - "name": "With Knobs", - "parameters": { - "knobs": [ - {"name": "name", "type": "text", "default": "John Smith"}, - {"name": "age", "type": "number", "default": "42"} - ] - } - }, - { - "name": "Simple note", - "parameters": { - "notes": "My notes on some bold text" - } - }, - { - "name": "With Actions", - "parameters": { - "actions": [ - { "click": "clicked", "contextmenu": "right clicked" }, - { "clearOnStoryChange": false } - ] - } - } - ] - } -] \ No newline at end of file diff --git a/examples/server-kitchen-sink/client/stories/index.js b/examples/server-kitchen-sink/client/stories/index.js new file mode 100644 index 000000000000..3cd911cd24d2 --- /dev/null +++ b/examples/server-kitchen-sink/client/stories/index.js @@ -0,0 +1,19 @@ +import * as a11yStories from './addon-a11y.stories'; +import * as actionsStories from './addon-actions.stories'; +import * as backgroundStories from './addon-backgrounds.stories'; +import * as knobsStories from './addon-knobs.stories'; +import * as notesStories from './addon-notes.stories'; +import * as welcomeStories from './welcome.stories'; +import * as paramsStories from './params.stories'; +import * as demoStories from './demo.stories'; + +export default [ + a11yStories, + actionsStories, + backgroundStories, + knobsStories, + notesStories, + welcomeStories, + paramsStories, + demoStories, +]; diff --git a/examples/server-kitchen-sink/client/storybook.js b/examples/server-kitchen-sink/client/storybook.js index d23f550c627a..2536370ae36a 100644 --- a/examples/server-kitchen-sink/client/storybook.js +++ b/examples/server-kitchen-sink/client/storybook.js @@ -1,39 +1,11 @@ import { configure, addParameters } from '@storybook/server'; -import * as a11yStories from './stories/addon-a11y.stories'; -import * as actionsStories from './stories/addon-actions.stories'; -import * as backgroundStories from './stories/addon-backgrounds.stories'; -import * as knobsStories from './stories/addon-knobs.stories'; -import * as notesStories from './stories/addon-notes.stories'; -import * as welcomeStories from './stories/welcome.stories'; -import * as paramsStories from './stories/params.stories'; -import * as demoStories from './stories/demo.stories'; +import stories from './stories'; const port = process.env.PORT || 8080; addParameters({ server: { url: `http://localhost:${port}/storybook_preview` } }); -const fetchHtml = async (url, id, params) => { - const fetchUrl = new URL(`${url}/${id}`); - fetchUrl.search = new URLSearchParams(params).toString(); +console.log('stories', stories); - const response = await fetch(fetchUrl); - return response.text(); -}; - -configure( - () => [ - a11yStories, - actionsStories, - backgroundStories, - knobsStories, - notesStories, - welcomeStories, - paramsStories, - demoStories, - ], - module, - { - fetchStoryHtml: fetchHtml, - } -); +configure(() => stories, module); From d066a06f076e567fac12996c079ff1c72d4f4fa6 Mon Sep 17 00:00:00 2001 From: Jon Palmer Date: Thu, 2 Jan 2020 13:01:45 -0500 Subject: [PATCH 08/25] Update Readme --- app/server/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/server/README.md b/app/server/README.md index ff667d03b18c..2602ec86b0e6 100644 --- a/app/server/README.md +++ b/app/server/README.md @@ -2,7 +2,7 @@ --- -Storybook for HTML is a UI development environment for your plain HTML snippets. +Storybook for Server is a UI development environment for your plain HTML snippets rendered by your server backend. With it, you can visualize different states of your UI components and develop them interactively. ![Storybook Screenshot](https://github.com/storybookjs/storybook/blob/master/media/storybook-intro.gif) @@ -14,7 +14,7 @@ So you can develop UI components in isolation without worrying about app specifi ```sh cd my-app -npx -p @storybook/cli sb init -t html +npx -p @storybook/cli sb init -t server ``` For more information visit: [storybook.js.org](https://storybook.js.org) From 507002ebc9100fe62f2ef92cc5951a3059416eb9 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Mon, 30 Dec 2019 12:35:55 +0800 Subject: [PATCH 09/25] Storybook Docs work in progress --- examples/server-kitchen-sink/README.md | 20 +++++++++++++++++++ .../server-kitchen-sink/client/storybook.js | 7 ++++++- examples/server-kitchen-sink/package.json | 4 +++- 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 examples/server-kitchen-sink/README.md diff --git a/examples/server-kitchen-sink/README.md b/examples/server-kitchen-sink/README.md new file mode 100644 index 000000000000..9b4edcdb9905 --- /dev/null +++ b/examples/server-kitchen-sink/README.md @@ -0,0 +1,20 @@ +# Server Kitchen Sink + +This project demonstrates a standalone server using `@storybook/server`. + +To run the server: + +``` +yarn start +``` + +This starts an express server on port `1337`. + +To view the stories in the storybook UI: + +``` +cd ../official-storybook +yarn storybook --preview-url=http://localhost:1337/storybook_preview +``` + +This runs the Storybook dev server, but instead of showing `official-storybook`'s stories, it attaches to the server, lists its stories in the navigation, and shows its stories in the preview iframe. diff --git a/examples/server-kitchen-sink/client/storybook.js b/examples/server-kitchen-sink/client/storybook.js index 2536370ae36a..c2412504adba 100644 --- a/examples/server-kitchen-sink/client/storybook.js +++ b/examples/server-kitchen-sink/client/storybook.js @@ -1,10 +1,15 @@ +import React from 'react'; import { configure, addParameters } from '@storybook/server'; +// import { DocsPage, DocsContainer } from '@storybook/addon-docs/blocks'; import stories from './stories'; const port = process.env.PORT || 8080; -addParameters({ server: { url: `http://localhost:${port}/storybook_preview` } }); +addParameters({ + server: { url: `http://localhost:${port}/storybook_preview` }, + docs: { page: () =>
hello docs
}, +}); console.log('stories', stories); diff --git a/examples/server-kitchen-sink/package.json b/examples/server-kitchen-sink/package.json index 8eb8fbc6e374..66dde192d117 100644 --- a/examples/server-kitchen-sink/package.json +++ b/examples/server-kitchen-sink/package.json @@ -14,6 +14,7 @@ "@storybook/addon-actions": "5.3.0-rc.4", "@storybook/addon-backgrounds": "5.3.0-rc.4", "@storybook/addon-centered": "5.3.0-rc.4", + "@storybook/addon-docs": "5.3.0-rc.4", "@storybook/addon-knobs": "5.3.0-rc.4", "@storybook/addon-links": "5.3.0-rc.4", "@storybook/addon-notes": "5.3.0-rc.4", @@ -22,6 +23,7 @@ "express": "~4.16.4", "morgan": "^1.9.1", "nodemon": "^2.0.2", - "parcel-bundler": "^1.12.4" + "parcel-bundler": "^1.12.4", + "react": "*" } } From d4820e0b3197a173a46ba8739c69034ac494158f Mon Sep 17 00:00:00 2001 From: Jon Palmer Date: Mon, 30 Dec 2019 03:36:48 -0500 Subject: [PATCH 10/25] Docs WIP with wepack not Parcel --- examples/server-kitchen-sink/.babelrc | 5 + examples/server-kitchen-sink/README.md | 2 +- .../client/stories/demo.stories.js | 4 - .../server-kitchen-sink/client/storybook.js | 3 +- examples/server-kitchen-sink/package.json | 20 +- examples/server-kitchen-sink/server/app.js | 22 +- .../server-kitchen-sink/webpack.config.js | 29 ++ yarn.lock | 340 ++++++++++++++---- 8 files changed, 336 insertions(+), 89 deletions(-) create mode 100644 examples/server-kitchen-sink/webpack.config.js diff --git a/examples/server-kitchen-sink/.babelrc b/examples/server-kitchen-sink/.babelrc index e69de29bb2d1..41b1f6da7f98 100644 --- a/examples/server-kitchen-sink/.babelrc +++ b/examples/server-kitchen-sink/.babelrc @@ -0,0 +1,5 @@ +{ + "presets": [ + "@babel/preset-env", "@babel/react" + ] +} \ No newline at end of file diff --git a/examples/server-kitchen-sink/README.md b/examples/server-kitchen-sink/README.md index 9b4edcdb9905..23441837b966 100644 --- a/examples/server-kitchen-sink/README.md +++ b/examples/server-kitchen-sink/README.md @@ -14,7 +14,7 @@ To view the stories in the storybook UI: ``` cd ../official-storybook -yarn storybook --preview-url=http://localhost:1337/storybook_preview +yarn storybook --preview-url=http://localhost:1337/storybook.html ``` This runs the Storybook dev server, but instead of showing `official-storybook`'s stories, it attaches to the server, lists its stories in the navigation, and shows its stories in the preview iframe. diff --git a/examples/server-kitchen-sink/client/stories/demo.stories.js b/examples/server-kitchen-sink/client/stories/demo.stories.js index 974fe132f7e3..bec7e5accfb5 100644 --- a/examples/server-kitchen-sink/client/stories/demo.stories.js +++ b/examples/server-kitchen-sink/client/stories/demo.stories.js @@ -1,8 +1,5 @@ export default { title: 'Demo', - parameters: { - componentSubtitle: 'Handy status label', - }, }; export const Heading = () => {}; @@ -22,7 +19,6 @@ Headings.story = { export const Button = () => {}; Button.story = { parameters: { - docs: { component: 'hi there docs' }, server: { id: 'demo/button' }, }, }; diff --git a/examples/server-kitchen-sink/client/storybook.js b/examples/server-kitchen-sink/client/storybook.js index c2412504adba..73dac8e5c5fa 100644 --- a/examples/server-kitchen-sink/client/storybook.js +++ b/examples/server-kitchen-sink/client/storybook.js @@ -4,10 +4,11 @@ import { configure, addParameters } from '@storybook/server'; import stories from './stories'; -const port = process.env.PORT || 8080; +const port = process.env.PORT || 1337; addParameters({ server: { url: `http://localhost:${port}/storybook_preview` }, + // docs: { page: DocsPage, container: DocsContainer }, docs: { page: () =>
hello docs
}, }); diff --git a/examples/server-kitchen-sink/package.json b/examples/server-kitchen-sink/package.json index 66dde192d117..51ce10e5c03f 100644 --- a/examples/server-kitchen-sink/package.json +++ b/examples/server-kitchen-sink/package.json @@ -3,13 +3,13 @@ "version": "5.3.0-rc.4", "private": true, "scripts": { - "dev": "PORT=1337 nodemon server/app.js", - "start": "PORT=1337 node server/app.js" - }, - "dependencies": { - "pug": "^2.0.4" + "start": "PORT=1337 nodemon server/app.js" }, "devDependencies": { + "@babel/core": "^7.7.7", + "@babel/node": "^7.7.7", + "@babel/preset-env": "^7.7.7", + "@babel/preset-react": "^7.7.4", "@storybook/addon-a11y": "5.3.0-rc.4", "@storybook/addon-actions": "5.3.0-rc.4", "@storybook/addon-backgrounds": "5.3.0-rc.4", @@ -20,10 +20,16 @@ "@storybook/addon-notes": "5.3.0-rc.4", "@storybook/csf": "0.0.1", "@storybook/server": "5.3.0-rc.4", + "babel-loader": "^8.0.6", + "cors": "^2.8.5", "express": "~4.16.4", + "html-webpack-plugin": "^3.2.0", "morgan": "^1.9.1", "nodemon": "^2.0.2", - "parcel-bundler": "^1.12.4", - "react": "*" + "pug": "^2.0.4", + "react": "^16.12.0", + "webpack": "^4.33.0", + "webpack-dev-middleware": "^3.7.2", + "webpack-hot-middleware": "^2.25.0" } } diff --git a/examples/server-kitchen-sink/server/app.js b/examples/server-kitchen-sink/server/app.js index b77036260583..88376dd6446e 100644 --- a/examples/server-kitchen-sink/server/app.js +++ b/examples/server-kitchen-sink/server/app.js @@ -1,14 +1,19 @@ const express = require('express'); +const cors = require('cors'); const morgan = require('morgan'); -const Bundler = require('parcel-bundler'); -const Path = require('path'); +const path = require('path'); +const webpack = require('webpack'); +const webpackMiddleware = require('webpack-dev-middleware'); +const webpackHotMiddleware = require('webpack-hot-middleware'); + +const webpackConfig = require('../webpack.config.js'); const port = process.env.PORT || 8080; const app = express(); - +app.use(cors()); app.use(morgan('dev')); -app.set('views', Path.join(__dirname, 'views')); +app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'pug'); app.get('/', (req, res) => res.send('Hello World!')); @@ -17,8 +22,11 @@ app.get(/storybook_preview\/(.*)/, (req, res) => { res.render(req.params[0], req.query); }); -const storybookFile = Path.join(__dirname, '../client/storybook.html'); -const bundler = new Bundler(storybookFile, {}); -app.use(bundler.middleware()); +app.use(webpackMiddleware(webpack(webpackConfig))); +app.use(webpackHotMiddleware(webpack(webpackConfig))); + +app.get('*', (req, res) => { + res.sendFile(path.join(__dirname, '../client/storybook.html')); +}); app.listen(port); diff --git a/examples/server-kitchen-sink/webpack.config.js b/examples/server-kitchen-sink/webpack.config.js new file mode 100644 index 000000000000..d87cce4f8d48 --- /dev/null +++ b/examples/server-kitchen-sink/webpack.config.js @@ -0,0 +1,29 @@ +const path = require('path'); +const HtmlWebpackPlugin = require('html-webpack-plugin'); + +module.exports = { + entry: './client/storybook.js', + output: { + path: path.join(__dirname, 'build'), + publicPath: '/', + filename: 'storybook.js', + }, + devtool: '#source-map', + module: { + rules: [ + { + test: /\.(js|jsx)$/, + exclude: /node_modules/, + use: { + loader: 'babel-loader', + }, + }, + ], + }, + plugins: [ + new HtmlWebpackPlugin({ + template: path.join(__dirname, 'client/storybook.html'), + fileName: path.join(__dirname, 'build/storybook.html'), + }), + ], +}; diff --git a/yarn.lock b/yarn.lock index 281fe09c4814..66e28e5e77e2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -318,6 +318,26 @@ semver "^5.4.1" source-map "^0.5.0" +"@babel/core@^7.7.7": + version "7.7.7" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.7.7.tgz#ee155d2e12300bcc0cff6a8ad46f2af5063803e9" + integrity sha512-jlSjuj/7z138NLZALxVgrx13AOtqip42ATZP7+kYl53GvDV6+4dCek1mVUo8z8c8Xnw/mx2q3d9HWh3griuesQ== + dependencies: + "@babel/code-frame" "^7.5.5" + "@babel/generator" "^7.7.7" + "@babel/helpers" "^7.7.4" + "@babel/parser" "^7.7.7" + "@babel/template" "^7.7.4" + "@babel/traverse" "^7.7.4" + "@babel/types" "^7.7.4" + convert-source-map "^1.7.0" + debug "^4.1.0" + json5 "^2.1.0" + lodash "^4.17.13" + resolve "^1.3.2" + semver "^5.4.1" + source-map "^0.5.0" + "@babel/generator@^7.0.0", "@babel/generator@^7.4.0", "@babel/generator@^7.4.4", "@babel/generator@^7.5.5", "@babel/generator@^7.6.0", "@babel/generator@^7.6.2", "@babel/generator@^7.6.4", "@babel/generator@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.7.4.tgz#db651e2840ca9aa66f327dcec1dc5f5fa9611369" @@ -328,6 +348,16 @@ lodash "^4.17.13" source-map "^0.5.0" +"@babel/generator@^7.7.7": + version "7.7.7" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.7.7.tgz#859ac733c44c74148e1a72980a64ec84b85f4f45" + integrity sha512-/AOIBpHh/JU1l0ZFS4kiRCBnLi6OTHzh0RPk3h9isBxkkqELtQNFi1Vr/tiG9p1yfoUdKVwISuXWQR+hwwM4VQ== + dependencies: + "@babel/types" "^7.7.4" + jsesc "^2.5.1" + lodash "^4.17.13" + source-map "^0.5.0" + "@babel/helper-annotate-as-pure@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.7.4.tgz#bb3faf1e74b74bd547e867e48f551fa6b098b6ce" @@ -446,6 +476,18 @@ "@babel/types" "^7.7.4" lodash "^4.17.13" +"@babel/helper-module-transforms@^7.7.5": + version "7.7.5" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.7.5.tgz#d044da7ffd91ec967db25cd6748f704b6b244835" + integrity sha512-A7pSxyJf1gN5qXVcidwLWydjftUN878VkalhXX5iQDuGyiGK3sOrrKKHF4/A4fwHtnsotv/NipwAeLzY4KQPvw== + dependencies: + "@babel/helper-module-imports" "^7.7.4" + "@babel/helper-simple-access" "^7.7.4" + "@babel/helper-split-export-declaration" "^7.7.4" + "@babel/template" "^7.7.4" + "@babel/types" "^7.7.4" + lodash "^4.17.13" + "@babel/helper-optimise-call-expression@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.7.4.tgz#034af31370d2995242aa4df402c3b7794b2dcdf2" @@ -529,6 +571,20 @@ esutils "^2.0.2" js-tokens "^4.0.0" +"@babel/node@^7.7.7": + version "7.7.7" + resolved "https://registry.yarnpkg.com/@babel/node/-/node-7.7.7.tgz#10c488ca36da07670be0131679c4e22f9d7795d4" + integrity sha512-QWWbQ6AyDffz6mA2mF0jixb/3IyRlqWgz5JNa2F6kSYe4vhPEytwuGmanx0NQJxBufDjffm/jYPuIfKfAyVzuA== + dependencies: + "@babel/register" "^7.7.7" + commander "^2.8.1" + core-js "^3.2.1" + lodash "^4.17.13" + node-environment-flags "^1.0.5" + regenerator-runtime "^0.13.3" + resolve "^1.13.1" + v8flags "^3.1.1" + "@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.1.6", "@babel/parser@^7.2.3", "@babel/parser@^7.4.2", "@babel/parser@^7.4.3", "@babel/parser@^7.4.4", "@babel/parser@^7.5.5", "@babel/parser@^7.6.0", "@babel/parser@^7.6.2", "@babel/parser@^7.6.4", "@babel/parser@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.4.tgz#75ab2d7110c2cf2fa949959afb05fa346d2231bb" @@ -539,6 +595,11 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.5.tgz#cbf45321619ac12d83363fcf9c94bb67fa646d71" integrity sha512-KNlOe9+/nk4i29g0VXgl8PEXIRms5xKLJeuZ6UptN0fHv+jDiriG+y94X6qAgWTR0h3KaoM1wK5G5h7MHFRSig== +"@babel/parser@^7.7.7": + version "7.7.7" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.7.tgz#1b886595419cf92d811316d5b715a53ff38b4937" + integrity sha512-WtTZMZAZLbeymhkd/sEaPD8IQyGAhmuTuvTzLiCFM7iXiVdY0gc0IaI+cW0fh1BnSMbJSzXX6/fHllgHKwHhXw== + "@babel/plugin-external-helpers@^7.0.0": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-external-helpers/-/plugin-external-helpers-7.7.4.tgz#8aa7aa402f0e2ecb924611cbf30942a497dfd17e" @@ -687,6 +748,14 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-object-rest-spread" "^7.7.4" +"@babel/plugin-proposal-object-rest-spread@^7.7.7": + version "7.7.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.7.7.tgz#9f27075004ab99be08c5c1bd653a2985813cb370" + integrity sha512-3qp9I8lelgzNedI3hrhkvhaEYree6+WHnyA/q4Dza9z7iEIs1eyhWyJnetk3jJ69RT0AT4G0UhEGwyGFJ7GUuQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-object-rest-spread" "^7.7.4" + "@babel/plugin-proposal-optional-catch-binding@^7.0.0", "@babel/plugin-proposal-optional-catch-binding@^7.2.0", "@babel/plugin-proposal-optional-catch-binding@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.7.4.tgz#ec21e8aeb09ec6711bc0a39ca49520abee1de379" @@ -711,6 +780,14 @@ "@babel/helper-create-regexp-features-plugin" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-proposal-unicode-property-regex@^7.7.7": + version "7.7.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.7.7.tgz#433fa9dac64f953c12578b29633f456b68831c4e" + integrity sha512-80PbkKyORBUVm1fbTLrHpYdJxMThzM1UqFGh0ALEhO9TYbG86Ah9zQYAB/84axz2vcxefDLdZwWwZNlYARlu9w== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.7.4" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-async-generators@^7.2.0", "@babel/plugin-syntax-async-generators@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.7.4.tgz#331aaf310a10c80c44a66b238b6e49132bd3c889" @@ -925,6 +1002,14 @@ "@babel/helper-create-regexp-features-plugin" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-transform-dotall-regex@^7.7.7": + version "7.7.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.7.7.tgz#3e9713f1b69f339e87fa796b097d73ded16b937b" + integrity sha512-b4in+YlTeE/QmTgrllnb3bHA0HntYvjz8O3Mcbx75UBPJA2xhb5A8nle498VhxSXJHQefjtQxpnLPehDJ4TRlg== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.7.4" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-duplicate-keys@^7.2.0", "@babel/plugin-transform-duplicate-keys@^7.5.0", "@babel/plugin-transform-duplicate-keys@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.7.4.tgz#3d21731a42e3f598a73835299dd0169c3b90ac91" @@ -994,6 +1079,15 @@ "@babel/helper-plugin-utils" "^7.0.0" babel-plugin-dynamic-import-node "^2.3.0" +"@babel/plugin-transform-modules-amd@^7.7.5": + version "7.7.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.7.5.tgz#39e0fb717224b59475b306402bb8eedab01e729c" + integrity sha512-CT57FG4A2ZUNU1v+HdvDSDrjNWBrtCmSH6YbbgN3Lrf0Di/q/lWRxZrE72p3+HCCz9UjfZOEBdphgC0nzOS6DQ== + dependencies: + "@babel/helper-module-transforms" "^7.7.5" + "@babel/helper-plugin-utils" "^7.0.0" + babel-plugin-dynamic-import-node "^2.3.0" + "@babel/plugin-transform-modules-commonjs@^7.0.0", "@babel/plugin-transform-modules-commonjs@^7.2.0", "@babel/plugin-transform-modules-commonjs@^7.4.4", "@babel/plugin-transform-modules-commonjs@^7.5.0", "@babel/plugin-transform-modules-commonjs@^7.6.0", "@babel/plugin-transform-modules-commonjs@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.7.4.tgz#bee4386e550446343dd52a571eda47851ff857a3" @@ -1004,6 +1098,16 @@ "@babel/helper-simple-access" "^7.7.4" babel-plugin-dynamic-import-node "^2.3.0" +"@babel/plugin-transform-modules-commonjs@^7.7.5": + version "7.7.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.7.5.tgz#1d27f5eb0bcf7543e774950e5b2fa782e637b345" + integrity sha512-9Cq4zTFExwFhQI6MT1aFxgqhIsMWQWDVwOgLzl7PTWJHsNaqFvklAU+Oz6AQLAS0dJKTwZSOCo20INwktxpi3Q== + dependencies: + "@babel/helper-module-transforms" "^7.7.5" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-simple-access" "^7.7.4" + babel-plugin-dynamic-import-node "^2.3.0" + "@babel/plugin-transform-modules-systemjs@^7.2.0", "@babel/plugin-transform-modules-systemjs@^7.5.0", "@babel/plugin-transform-modules-systemjs@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.7.4.tgz#cd98152339d3e763dfe838b7d4273edaf520bb30" @@ -1059,6 +1163,15 @@ "@babel/helper-get-function-arity" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-transform-parameters@^7.7.7": + version "7.7.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.7.7.tgz#7a884b2460164dc5f194f668332736584c760007" + integrity sha512-OhGSrf9ZBrr1fw84oFXj5hgi8Nmg+E2w5L7NhnG0lPvpDtqd7dbyilM2/vR8CKbJ907RyxPh2kj6sBCSSfI9Ew== + dependencies: + "@babel/helper-call-delegate" "^7.7.4" + "@babel/helper-get-function-arity" "^7.7.4" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-property-literals@^7.0.0", "@babel/plugin-transform-property-literals@^7.2.0", "@babel/plugin-transform-property-literals@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.7.4.tgz#2388d6505ef89b266103f450f9167e6bd73f98c2" @@ -1120,6 +1233,13 @@ dependencies: regenerator-transform "^0.14.0" +"@babel/plugin-transform-regenerator@^7.7.5": + version "7.7.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.7.5.tgz#3a8757ee1a2780f390e89f246065ecf59c26fce9" + integrity sha512-/8I8tPvX2FkuEyWbjRCt4qTAgZK0DVy8QRguhA524UH48RfGJy94On2ri+dCuwOpcerPRl9O4ebQkRcVzIaGBw== + dependencies: + regenerator-transform "^0.14.0" + "@babel/plugin-transform-reserved-words@^7.2.0", "@babel/plugin-transform-reserved-words@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.7.4.tgz#6a7cf123ad175bb5c69aec8f6f0770387ed3f1eb" @@ -1433,6 +1553,63 @@ js-levenshtein "^1.1.3" semver "^5.5.0" +"@babel/preset-env@^7.7.7": + version "7.7.7" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.7.7.tgz#c294167b91e53e7e36d820e943ece8d0c7fe46ac" + integrity sha512-pCu0hrSSDVI7kCVUOdcMNQEbOPJ52E+LrQ14sN8uL2ALfSqePZQlKrOy+tM4uhEdYlCHi4imr8Zz2cZe9oSdIg== + dependencies: + "@babel/helper-module-imports" "^7.7.4" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-proposal-async-generator-functions" "^7.7.4" + "@babel/plugin-proposal-dynamic-import" "^7.7.4" + "@babel/plugin-proposal-json-strings" "^7.7.4" + "@babel/plugin-proposal-object-rest-spread" "^7.7.7" + "@babel/plugin-proposal-optional-catch-binding" "^7.7.4" + "@babel/plugin-proposal-unicode-property-regex" "^7.7.7" + "@babel/plugin-syntax-async-generators" "^7.7.4" + "@babel/plugin-syntax-dynamic-import" "^7.7.4" + "@babel/plugin-syntax-json-strings" "^7.7.4" + "@babel/plugin-syntax-object-rest-spread" "^7.7.4" + "@babel/plugin-syntax-optional-catch-binding" "^7.7.4" + "@babel/plugin-syntax-top-level-await" "^7.7.4" + "@babel/plugin-transform-arrow-functions" "^7.7.4" + "@babel/plugin-transform-async-to-generator" "^7.7.4" + "@babel/plugin-transform-block-scoped-functions" "^7.7.4" + "@babel/plugin-transform-block-scoping" "^7.7.4" + "@babel/plugin-transform-classes" "^7.7.4" + "@babel/plugin-transform-computed-properties" "^7.7.4" + "@babel/plugin-transform-destructuring" "^7.7.4" + "@babel/plugin-transform-dotall-regex" "^7.7.7" + "@babel/plugin-transform-duplicate-keys" "^7.7.4" + "@babel/plugin-transform-exponentiation-operator" "^7.7.4" + "@babel/plugin-transform-for-of" "^7.7.4" + "@babel/plugin-transform-function-name" "^7.7.4" + "@babel/plugin-transform-literals" "^7.7.4" + "@babel/plugin-transform-member-expression-literals" "^7.7.4" + "@babel/plugin-transform-modules-amd" "^7.7.5" + "@babel/plugin-transform-modules-commonjs" "^7.7.5" + "@babel/plugin-transform-modules-systemjs" "^7.7.4" + "@babel/plugin-transform-modules-umd" "^7.7.4" + "@babel/plugin-transform-named-capturing-groups-regex" "^7.7.4" + "@babel/plugin-transform-new-target" "^7.7.4" + "@babel/plugin-transform-object-super" "^7.7.4" + "@babel/plugin-transform-parameters" "^7.7.7" + "@babel/plugin-transform-property-literals" "^7.7.4" + "@babel/plugin-transform-regenerator" "^7.7.5" + "@babel/plugin-transform-reserved-words" "^7.7.4" + "@babel/plugin-transform-shorthand-properties" "^7.7.4" + "@babel/plugin-transform-spread" "^7.7.4" + "@babel/plugin-transform-sticky-regex" "^7.7.4" + "@babel/plugin-transform-template-literals" "^7.7.4" + "@babel/plugin-transform-typeof-symbol" "^7.7.4" + "@babel/plugin-transform-unicode-regex" "^7.7.4" + "@babel/types" "^7.7.4" + browserslist "^4.6.0" + core-js-compat "^3.6.0" + invariant "^2.2.2" + js-levenshtein "^1.1.3" + semver "^5.5.0" + "@babel/preset-flow@7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/preset-flow/-/preset-flow-7.0.0.tgz#afd764835d9535ec63d8c7d4caf1c06457263da2" @@ -1460,7 +1637,7 @@ "@babel/plugin-transform-react-jsx-self" "^7.0.0" "@babel/plugin-transform-react-jsx-source" "^7.0.0" -"@babel/preset-react@^7.0.0": +"@babel/preset-react@^7.0.0", "@babel/preset-react@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/preset-react/-/preset-react-7.7.4.tgz#3fe2ea698d8fb536d8e7881a592c3c1ee8bf5707" integrity sha512-j+vZtg0/8pQr1H8wKoaJyGL2IEk3rG/GIvua7Sec7meXVIvGycihlGMx5xcU00kqCJbwzHs18xTu3YfREOqQ+g== @@ -1498,6 +1675,17 @@ pirates "^4.0.0" source-map-support "^0.5.16" +"@babel/register@^7.7.7": + version "7.7.7" + resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.7.7.tgz#46910c4d1926b9c6096421b23d1f9e159c1dcee1" + integrity sha512-S2mv9a5dc2pcpg/ConlKZx/6wXaEwHeqfo7x/QbXsdCAZm+WJC1ekVvL1TVxNsedTs5y/gG63MhJTEsmwmjtiA== + dependencies: + find-cache-dir "^2.0.0" + lodash "^4.17.13" + make-dir "^2.1.0" + pirates "^4.0.0" + source-map-support "^0.5.16" + "@babel/runtime@7.6.0": version "7.6.0" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.6.0.tgz#4fc1d642a9fd0299754e8b5de62c631cf5568205" @@ -8153,6 +8341,15 @@ browserslist@^4.0.0, browserslist@^4.1.0, browserslist@^4.1.1, browserslist@^4.3 electron-to-chromium "^1.3.306" node-releases "^1.1.40" +browserslist@^4.8.2: + version "4.8.2" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.8.2.tgz#b45720ad5fbc8713b7253c20766f701c9a694289" + integrity sha512-+M4oeaTplPm/f1pXDw84YohEv7B1i/2Aisei8s4s6k3QsoSHa7i5sz8u/cGQkkatCPxMASKxPualR4wwYgVboA== + dependencies: + caniuse-lite "^1.0.30001015" + electron-to-chromium "^1.3.322" + node-releases "^1.1.42" + browserstack@^1.5.1: version "1.5.3" resolved "https://registry.yarnpkg.com/browserstack/-/browserstack-1.5.3.tgz#93ab48799a12ef99dbd074dd595410ddb196a7ac" @@ -8589,6 +8786,11 @@ caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000844, caniuse-lite@^1.0.30000939, can resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001012.tgz#653ec635e815b9e0fb801890923b0c2079eb34ec" integrity sha512-7RR4Uh04t9K1uYRWzOJmzplgEOAXbfK72oVNokCdMzA67trrhPzy93ahKk1AWHiA0c58tD2P+NHqxrA8FZ+Trg== +caniuse-lite@^1.0.30001015: + version "1.0.30001017" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001017.tgz#d3ad6ec18148b9bd991829958d9d7e562bb78cd6" + integrity sha512-EDnZyOJ6eYh6lHmCvCdHAFbfV4KJ9lSdfv4h/ppEhrU/Yudkl7jujwMZ1we6RX7DXqBfT04pVMQ4J+1wcTlsKA== + canonical-path@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/canonical-path/-/canonical-path-1.0.0.tgz#fcb470c23958def85081856be7a86e904f180d1d" @@ -9335,7 +9537,7 @@ commander@2.8.x: dependencies: graceful-readlink ">= 1.0.0" -commander@^2.11.0, commander@^2.12.1, commander@^2.15.1, commander@^2.18.0, commander@^2.19.0, commander@^2.20.0, commander@^2.6.0, commander@^2.9.0, commander@~2.20.3: +commander@^2.11.0, commander@^2.12.1, commander@^2.15.1, commander@^2.18.0, commander@^2.19.0, commander@^2.20.0, commander@^2.6.0, commander@^2.8.1, commander@^2.9.0, commander@~2.20.3: version "2.20.3" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== @@ -9844,6 +10046,14 @@ core-js-compat@^3.1.1: browserslist "^4.7.3" semver "^6.3.0" +core-js-compat@^3.6.0: + version "3.6.1" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.6.1.tgz#39638c935c83c93a793abb628b252ec43e85783a" + integrity sha512-2Tl1EuxZo94QS2VeH28Ebf5g3xbPZG/hj/N5HDDy4XMP/ImR0JIer/nggQRiMN91Q54JVkGbytf42wO29oXVHg== + dependencies: + browserslist "^4.8.2" + semver "7.0.0" + core-js-pure@^3.0.1: version "3.4.2" resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.4.2.tgz#ffd4ea4dc1f8517f75d4a929986a214629477417" @@ -9869,6 +10079,11 @@ core-js@^3.0.1, core-js@^3.0.4: resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.4.2.tgz#ee2b1a60b50388d8ddcda8cdb44a92c7a9ea76df" integrity sha512-bUTfqFWtNKWp73oNIfRkqwYZJeNT3lstzZcAkhhiuvDraRSgOH1/+F9ZklbpR4zpdKuo4cpXN8tKP7s61yjX+g== +core-js@^3.2.1: + version "3.6.1" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.6.1.tgz#39d5e2e346258cc01eb7d44345b1c3c014ca3f05" + integrity sha512-186WjSik2iTGfDjfdCZAxv2ormxtKgemjC3SI6PL31qOA0j5LhTDVjHChccoc7brwLvpvLPiMyRlcO88C4l1QQ== + core-object@^3.1.5: version "3.1.5" resolved "https://registry.yarnpkg.com/core-object/-/core-object-3.1.5.tgz#fa627b87502adc98045e44678e9a8ec3b9c0d2a9" @@ -11401,6 +11616,11 @@ electron-to-chromium@^1.3.191, electron-to-chromium@^1.3.247, electron-to-chromi resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.314.tgz#c186a499ed2c9057bce9eb8dca294d6d5450facc" integrity sha512-IKDR/xCxKFhPts7h+VaSXS02Z1mznP3fli1BbXWXeN89i2gCzKraU8qLpEid8YzKcmZdZD3Mly3cn5/lY9xsBQ== +electron-to-chromium@^1.3.322: + version "1.3.322" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.322.tgz#a6f7e1c79025c2b05838e8e344f6e89eb83213a8" + integrity sha512-Tc8JQEfGQ1MzfSzI/bTlSr7btJv/FFO7Yh6tanqVmIWOuNCu6/D1MilIEgLtmWqIrsv+o4IjpLAhgMBr/ncNAA== + elegant-spinner@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/elegant-spinner/-/elegant-spinner-1.0.1.tgz#db043521c95d7e303fd8f345bedc3349cfb0729e" @@ -15922,6 +16142,19 @@ html-webpack-plugin@4.0.0-beta.5: tapable "^1.1.0" util.promisify "1.0.0" +html-webpack-plugin@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/html-webpack-plugin/-/html-webpack-plugin-3.2.0.tgz#b01abbd723acaaa7b37b6af4492ebda03d9dd37b" + integrity sha1-sBq71yOsqqeze2r0SS69oD2d03s= + dependencies: + html-minifier "^3.2.3" + loader-utils "^0.2.16" + lodash "^4.17.3" + pretty-error "^2.0.2" + tapable "^1.0.0" + toposort "^1.0.0" + util.promisify "1.0.0" + html-webpack-plugin@^4.0.0-beta.2: version "4.0.0-beta.11" resolved "https://registry.yarnpkg.com/html-webpack-plugin/-/html-webpack-plugin-4.0.0-beta.11.tgz#3059a69144b5aecef97708196ca32f9e68677715" @@ -19761,7 +19994,7 @@ lodash.uniqby@^4.7.0: resolved "https://registry.yarnpkg.com/lodash.uniqby/-/lodash.uniqby-4.7.0.tgz#d99c07a669e9e6d24e1362dfe266c67616af1302" integrity sha1-2ZwHpmnp5tJOE2Lf4mbGdhavEwI= -lodash@4.17.15, "lodash@>=3.5 <5", lodash@^4.0.0, lodash@^4.0.1, lodash@^4.13.1, lodash@^4.15.0, lodash@^4.16.2, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.5.0, lodash@^4.5.1, lodash@^4.6.0, lodash@^4.6.1, lodash@~4.17.10: +lodash@4.17.15, "lodash@>=3.5 <5", lodash@^4.0.0, lodash@^4.0.1, lodash@^4.13.1, lodash@^4.15.0, lodash@^4.16.2, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.5.0, lodash@^4.5.1, lodash@^4.6.0, lodash@^4.6.1, lodash@~4.17.10: version "4.17.15" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== @@ -21664,6 +21897,14 @@ node-dir@^0.1.10, node-dir@^0.1.17: dependencies: minimatch "^3.0.2" +node-environment-flags@^1.0.5: + version "1.0.6" + resolved "https://registry.yarnpkg.com/node-environment-flags/-/node-environment-flags-1.0.6.tgz#a30ac13621f6f7d674260a54dede048c3982c088" + integrity sha512-5Evy2epuL+6TM0lCQGpFIj6KwiEsGh1SrHUhTbNX+sLbBtjidPZFAnVK9y5yU1+h//RitLbRHTIMyxQPtxMdHw== + dependencies: + object.getownpropertydescriptors "^2.0.3" + semver "^5.7.0" + node-fetch-npm@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/node-fetch-npm/-/node-fetch-npm-2.0.2.tgz#7258c9046182dca345b4208eda918daf33697ff7" @@ -21845,6 +22086,13 @@ node-releases@^1.1.25, node-releases@^1.1.29, node-releases@^1.1.40: dependencies: semver "^6.3.0" +node-releases@^1.1.42: + version "1.1.44" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.44.tgz#cd66438a6eb875e3eb012b6a12e48d9f4326ffd7" + integrity sha512-NwbdvJyR7nrcGrXvKAvzc5raj/NkoJudkarh2yIpJ4t0NH4aqjUDz/486P+ynIW5eokKOfzGNRdYoLfBlomruw== + dependencies: + semver "^6.3.0" + node-sass@^4.12.0: version "4.13.0" resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.13.0.tgz#b647288babdd6a1cb726de4545516b31f90da066" @@ -22914,71 +23162,6 @@ param-case@2.1.x, param-case@^2.1.1: dependencies: no-case "^2.2.0" -parcel-bundler@^1.12.4: - version "1.12.4" - resolved "https://registry.yarnpkg.com/parcel-bundler/-/parcel-bundler-1.12.4.tgz#31223f4ab4d00323a109fce28d5e46775409a9ee" - integrity sha512-G+iZGGiPEXcRzw0fiRxWYCKxdt/F7l9a0xkiU4XbcVRJCSlBnioWEwJMutOCCpoQmaQtjB4RBHDGIHN85AIhLQ== - dependencies: - "@babel/code-frame" "^7.0.0" - "@babel/core" "^7.4.4" - "@babel/generator" "^7.4.4" - "@babel/parser" "^7.4.4" - "@babel/plugin-transform-flow-strip-types" "^7.4.4" - "@babel/plugin-transform-modules-commonjs" "^7.4.4" - "@babel/plugin-transform-react-jsx" "^7.0.0" - "@babel/preset-env" "^7.4.4" - "@babel/runtime" "^7.4.4" - "@babel/template" "^7.4.4" - "@babel/traverse" "^7.4.4" - "@babel/types" "^7.4.4" - "@iarna/toml" "^2.2.0" - "@parcel/fs" "^1.11.0" - "@parcel/logger" "^1.11.1" - "@parcel/utils" "^1.11.0" - "@parcel/watcher" "^1.12.1" - "@parcel/workers" "^1.11.0" - ansi-to-html "^0.6.4" - babylon-walk "^1.0.2" - browserslist "^4.1.0" - chalk "^2.1.0" - clone "^2.1.1" - command-exists "^1.2.6" - commander "^2.11.0" - core-js "^2.6.5" - cross-spawn "^6.0.4" - css-modules-loader-core "^1.1.0" - cssnano "^4.0.0" - deasync "^0.1.14" - dotenv "^5.0.0" - dotenv-expand "^5.1.0" - envinfo "^7.3.1" - fast-glob "^2.2.2" - filesize "^3.6.0" - get-port "^3.2.0" - htmlnano "^0.2.2" - is-glob "^4.0.0" - is-url "^1.2.2" - js-yaml "^3.10.0" - json5 "^1.0.1" - micromatch "^3.0.4" - mkdirp "^0.5.1" - node-forge "^0.7.1" - node-libs-browser "^2.0.0" - opn "^5.1.0" - postcss "^7.0.11" - postcss-value-parser "^3.3.1" - posthtml "^0.11.2" - posthtml-parser "^0.4.0" - posthtml-render "^1.1.3" - resolve "^1.4.0" - semver "^5.4.1" - serialize-to-js "^3.0.0" - serve-static "^1.12.4" - source-map "0.6.1" - terser "^3.7.3" - v8-compile-cache "^2.0.0" - ws "^5.1.1" - parcel@^1.12.3: version "1.12.4" resolved "https://registry.yarnpkg.com/parcel/-/parcel-1.12.4.tgz#c8136085179c6382e632ca98126093e110be2ac5" @@ -26358,7 +26541,7 @@ react-transition-group@^2.2.1: prop-types "^15.6.2" react-lifecycles-compat "^3.0.4" -react@*, react@16.12.0, react@^16.10.2, react@^16.6.0, react@^16.8.3, react@^16.8.4: +react@*, react@16.12.0, react@^16.10.2, react@^16.12.0, react@^16.6.0, react@^16.8.3, react@^16.8.4: version "16.12.0" resolved "https://registry.yarnpkg.com/react/-/react-16.12.0.tgz#0c0a9c6a142429e3614834d5a778e18aa78a0b83" integrity sha512-fglqy3k5E+81pA8s+7K0/T3DBCF0ZDOher1elBFzF7O6arXJgzyu/FW+COxFvAWXJoJN9KIZbT2LXlukwphYTA== @@ -27550,6 +27733,13 @@ resolve@1.x, resolve@^1.1.4, resolve@^1.1.5, resolve@^1.1.6, resolve@^1.1.7, res dependencies: path-parse "^1.0.6" +resolve@^1.13.1: + version "1.14.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.14.1.tgz#9e018c540fcf0c427d678b9931cbf45e984bcaff" + integrity sha512-fn5Wobh4cxbLzuHaE+nphztHy43/b++4M6SsGFC2gB8uYwf0C8LcarfCz1un7UTW8OFQg9iNjZ4xpcFVGebDPg== + dependencies: + path-parse "^1.0.6" + responselike@1.0.2, responselike@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/responselike/-/responselike-1.0.2.tgz#918720ef3b631c5642be068f15ade5a46f4ba1e7" @@ -30598,6 +30788,11 @@ topo@3.x.x: dependencies: hoek "6.x.x" +toposort@^1.0.0: + version "1.0.7" + resolved "https://registry.yarnpkg.com/toposort/-/toposort-1.0.7.tgz#2e68442d9f64ec720b8cc89e6443ac6caa950029" + integrity sha1-LmhELZ9k7HILjMieZEOsbKqVACk= + toposort@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/toposort/-/toposort-2.0.2.tgz#ae21768175d1559d48bef35420b2f4962f09c330" @@ -31892,6 +32087,13 @@ v8-compile-cache@^2.0.0, v8-compile-cache@^2.0.3: resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz#e14de37b31a6d194f5690d67efc4e7f6fc6ab30e" integrity sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g== +v8flags@^3.1.1: + version "3.1.3" + resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-3.1.3.tgz#fc9dc23521ca20c5433f81cc4eb9b3033bb105d8" + integrity sha512-amh9CCg3ZxkzQ48Mhcb8iX7xpAfYJgePHxWMQCBWECpOSqJUXgY26ncA61UTV0BkPqfhcy6mzwCIoP4ygxpW8w== + dependencies: + homedir-polyfill "^1.0.1" + validate-npm-package-license@^3.0.1, validate-npm-package-license@^3.0.3: version "3.0.4" resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" From c8faee0ac08f8e01acf330452fc115eaf1caf670 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Tue, 31 Dec 2019 12:54:27 +0800 Subject: [PATCH 11/25] Workaround for docs linking CORS error --- addons/docs/src/blocks/DocsContainer.tsx | 8 +++++++- addons/docs/src/blocks/mdx.tsx | 11 +++++++---- examples/server-kitchen-sink/client/storybook.js | 5 ++--- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/addons/docs/src/blocks/DocsContainer.tsx b/addons/docs/src/blocks/DocsContainer.tsx index cedf8e18f4de..b59829db714d 100644 --- a/addons/docs/src/blocks/DocsContainer.tsx +++ b/addons/docs/src/blocks/DocsContainer.tsx @@ -29,7 +29,13 @@ export const DocsContainer: FunctionComponent = ({ context, const allComponents = { ...defaultComponents, ...userComponents }; useEffect(() => { - const url = new URL(window.parent.location); + let url: URL; + try { + url = new URL(window.parent.location); + } catch (err) { + return; + } + if (url.hash) { const element = document.getElementById(url.hash.substring(1)); if (element) { diff --git a/addons/docs/src/blocks/mdx.tsx b/addons/docs/src/blocks/mdx.tsx index ca5225602199..f2fd037b5d5b 100644 --- a/addons/docs/src/blocks/mdx.tsx +++ b/addons/docs/src/blocks/mdx.tsx @@ -49,10 +49,13 @@ export const CodeOrSourceMdx: FC = ({ className, children, }; function generateHrefWithHash(hash: string): string { - const url = new URL(window.parent.location); - const href = `${url.origin}/${url.search}#${hash}`; - - return href; + try { + const url = new URL(window.parent.location); + const href = `${url.origin}/${url.search}#${hash}`; + return href; + } catch (err) { + return ''; + } } // @ts-ignore diff --git a/examples/server-kitchen-sink/client/storybook.js b/examples/server-kitchen-sink/client/storybook.js index 73dac8e5c5fa..c8d3695bcc01 100644 --- a/examples/server-kitchen-sink/client/storybook.js +++ b/examples/server-kitchen-sink/client/storybook.js @@ -1,6 +1,6 @@ import React from 'react'; import { configure, addParameters } from '@storybook/server'; -// import { DocsPage, DocsContainer } from '@storybook/addon-docs/blocks'; +import { DocsPage, DocsContainer } from '@storybook/addon-docs/blocks'; import stories from './stories'; @@ -8,8 +8,7 @@ const port = process.env.PORT || 1337; addParameters({ server: { url: `http://localhost:${port}/storybook_preview` }, - // docs: { page: DocsPage, container: DocsContainer }, - docs: { page: () =>
hello docs
}, + docs: { page: DocsPage, container: DocsContainer }, }); console.log('stories', stories); From 3791af26be9cab24509fbb2ef020a1451c73b255 Mon Sep 17 00:00:00 2001 From: Jon Palmer Date: Thu, 2 Jan 2020 13:01:53 -0500 Subject: [PATCH 12/25] Update to rc.6 --- app/server/package.json | 6 +++--- examples/server-kitchen-sink/package.json | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/server/package.json b/app/server/package.json index e05b53b06af7..5b3eddfc127d 100644 --- a/app/server/package.json +++ b/app/server/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/server", - "version": "5.3.0-rc.4", + "version": "5.3.0-rc.6", "description": "Storybook for Server: View HTML snippets from a server in isolation with Hot Reloading.", "keywords": [ "storybook" @@ -33,8 +33,8 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "5.3.0-rc.4", - "@storybook/core": "5.3.0-rc.4", + "@storybook/addons": "5.3.0-rc.6", + "@storybook/core": "5.3.0-rc.6", "@types/webpack-env": "^1.13.9", "core-js": "^3.0.1", "global": "^4.3.2", diff --git a/examples/server-kitchen-sink/package.json b/examples/server-kitchen-sink/package.json index 51ce10e5c03f..bbecc209adc8 100644 --- a/examples/server-kitchen-sink/package.json +++ b/examples/server-kitchen-sink/package.json @@ -1,6 +1,6 @@ { "name": "server-kitchen-sink", - "version": "5.3.0-rc.4", + "version": "5.3.0-rc.6", "private": true, "scripts": { "start": "PORT=1337 nodemon server/app.js" @@ -10,16 +10,16 @@ "@babel/node": "^7.7.7", "@babel/preset-env": "^7.7.7", "@babel/preset-react": "^7.7.4", - "@storybook/addon-a11y": "5.3.0-rc.4", - "@storybook/addon-actions": "5.3.0-rc.4", - "@storybook/addon-backgrounds": "5.3.0-rc.4", - "@storybook/addon-centered": "5.3.0-rc.4", - "@storybook/addon-docs": "5.3.0-rc.4", - "@storybook/addon-knobs": "5.3.0-rc.4", - "@storybook/addon-links": "5.3.0-rc.4", - "@storybook/addon-notes": "5.3.0-rc.4", + "@storybook/addon-a11y": "5.3.0-rc.6", + "@storybook/addon-actions": "5.3.0-rc.6", + "@storybook/addon-backgrounds": "5.3.0-rc.6", + "@storybook/addon-centered": "5.3.0-rc.6", + "@storybook/addon-docs": "5.3.0-rc.6", + "@storybook/addon-knobs": "5.3.0-rc.6", + "@storybook/addon-links": "5.3.0-rc.6", + "@storybook/addon-notes": "5.3.0-rc.6", "@storybook/csf": "0.0.1", - "@storybook/server": "5.3.0-rc.4", + "@storybook/server": "5.3.0-rc.6", "babel-loader": "^8.0.6", "cors": "^2.8.5", "express": "~4.16.4", From 614ddcdf1b5976781cd155d9362e9012cb67eb0a Mon Sep 17 00:00:00 2001 From: Jon Palmer Date: Thu, 2 Jan 2020 13:02:00 -0500 Subject: [PATCH 13/25] .storybook example app with CSF compiler --- app/server/package.json | 2 + .../src/lib/compiler/decorators/actions.ts | 37 ++++++++ .../src/lib/compiler/decorators/index.ts | 31 +++++++ .../src/lib/compiler/decorators/knobs.ts | 93 +++++++++++++++++++ .../src/lib/compiler/decorators/utils.ts | 21 +++++ app/server/src/lib/compiler/index.ts | 38 ++++++++ app/server/src/lib/compiler/stringifier.ts | 85 +++++++++++++++++ app/server/src/lib/compiler/types.ts | 31 +++++++ .../src/server/framework-preset-server.ts | 20 +++- app/server/src/server/loader.ts | 5 + .../server-kitchen-sink/client/storybook.js | 1 - .../server-kitchen-sink2/.storybook/main.js | 15 +++ .../.storybook/preview.js | 25 +++++ examples/server-kitchen-sink2/README.md | 9 ++ examples/server-kitchen-sink2/package.json | 34 +++++++ examples/server-kitchen-sink2/server.js | 21 +++++ .../stories/addon-a11y.stories.json | 34 +++++++ .../stories/addon-actions.stories.json | 45 +++++++++ .../stories/addon-backgrounds.stories.json | 23 +++++ .../stories/addon-knobs.stories.json | 64 +++++++++++++ .../stories/addon-notes.stories.json | 12 +++ .../stories/demo.stories.json | 23 +++++ .../stories/params.stories.json | 28 ++++++ .../stories/welcome.stories.json | 14 +++ .../views/addons/a11y/contrast.pug | 1 + .../views/addons/a11y/default.pug | 1 + .../views/addons/a11y/disabled.pug | 1 + .../views/addons/a11y/label.pug | 1 + .../views/addons/actions/button.pug | 1 + .../views/addons/actions/story1.pug | 1 + .../views/addons/actions/story2.pug | 1 + .../views/addons/actions/story3.pug | 1 + .../views/addons/actions/story4.pug | 1 + .../views/addons/actions/story5.pug | 3 + .../views/addons/actions/story6.pug | 1 + .../views/addons/actions/story7.pug | 1 + .../views/addons/actions/story8.pug | 1 + .../views/addons/backgrounds/story1.pug | 1 + .../views/addons/backgrounds/story2.pug | 1 + .../views/addons/knobs/all.pug | 18 ++++ .../views/addons/knobs/css.pug | 1 + .../views/addons/knobs/simple.pug | 2 + .../views/addons/knobs/xss_safety.pug | 1 + .../views/addons/notes/story1.pug | 2 + .../views/demo/button.pug | 1 + .../views/demo/heading.pug | 1 + .../views/demo/headings.pug | 4 + .../views/params/override.pug | 1 + .../views/params/params.pug | 1 + .../views/params/story.pug | 1 + .../views/params/story_fn_override.pug | 1 + .../views/welcome/welcome.pug | 36 +++++++ yarn.lock | 25 +++++ 53 files changed, 821 insertions(+), 2 deletions(-) create mode 100644 app/server/src/lib/compiler/decorators/actions.ts create mode 100644 app/server/src/lib/compiler/decorators/index.ts create mode 100644 app/server/src/lib/compiler/decorators/knobs.ts create mode 100644 app/server/src/lib/compiler/decorators/utils.ts create mode 100644 app/server/src/lib/compiler/index.ts create mode 100644 app/server/src/lib/compiler/stringifier.ts create mode 100644 app/server/src/lib/compiler/types.ts create mode 100644 app/server/src/server/loader.ts create mode 100644 examples/server-kitchen-sink2/.storybook/main.js create mode 100644 examples/server-kitchen-sink2/.storybook/preview.js create mode 100644 examples/server-kitchen-sink2/README.md create mode 100644 examples/server-kitchen-sink2/package.json create mode 100644 examples/server-kitchen-sink2/server.js create mode 100644 examples/server-kitchen-sink2/stories/addon-a11y.stories.json create mode 100644 examples/server-kitchen-sink2/stories/addon-actions.stories.json create mode 100644 examples/server-kitchen-sink2/stories/addon-backgrounds.stories.json create mode 100644 examples/server-kitchen-sink2/stories/addon-knobs.stories.json create mode 100644 examples/server-kitchen-sink2/stories/addon-notes.stories.json create mode 100644 examples/server-kitchen-sink2/stories/demo.stories.json create mode 100644 examples/server-kitchen-sink2/stories/params.stories.json create mode 100644 examples/server-kitchen-sink2/stories/welcome.stories.json create mode 100644 examples/server-kitchen-sink2/views/addons/a11y/contrast.pug create mode 100644 examples/server-kitchen-sink2/views/addons/a11y/default.pug create mode 100644 examples/server-kitchen-sink2/views/addons/a11y/disabled.pug create mode 100644 examples/server-kitchen-sink2/views/addons/a11y/label.pug create mode 100644 examples/server-kitchen-sink2/views/addons/actions/button.pug create mode 100644 examples/server-kitchen-sink2/views/addons/actions/story1.pug create mode 100644 examples/server-kitchen-sink2/views/addons/actions/story2.pug create mode 100644 examples/server-kitchen-sink2/views/addons/actions/story3.pug create mode 100644 examples/server-kitchen-sink2/views/addons/actions/story4.pug create mode 100644 examples/server-kitchen-sink2/views/addons/actions/story5.pug create mode 100644 examples/server-kitchen-sink2/views/addons/actions/story6.pug create mode 100644 examples/server-kitchen-sink2/views/addons/actions/story7.pug create mode 100644 examples/server-kitchen-sink2/views/addons/actions/story8.pug create mode 100644 examples/server-kitchen-sink2/views/addons/backgrounds/story1.pug create mode 100644 examples/server-kitchen-sink2/views/addons/backgrounds/story2.pug create mode 100644 examples/server-kitchen-sink2/views/addons/knobs/all.pug create mode 100644 examples/server-kitchen-sink2/views/addons/knobs/css.pug create mode 100644 examples/server-kitchen-sink2/views/addons/knobs/simple.pug create mode 100644 examples/server-kitchen-sink2/views/addons/knobs/xss_safety.pug create mode 100644 examples/server-kitchen-sink2/views/addons/notes/story1.pug create mode 100644 examples/server-kitchen-sink2/views/demo/button.pug create mode 100644 examples/server-kitchen-sink2/views/demo/heading.pug create mode 100644 examples/server-kitchen-sink2/views/demo/headings.pug create mode 100644 examples/server-kitchen-sink2/views/params/override.pug create mode 100644 examples/server-kitchen-sink2/views/params/params.pug create mode 100644 examples/server-kitchen-sink2/views/params/story.pug create mode 100644 examples/server-kitchen-sink2/views/params/story_fn_override.pug create mode 100644 examples/server-kitchen-sink2/views/welcome/welcome.pug diff --git a/app/server/package.json b/app/server/package.json index 5b3eddfc127d..fbcb9a9fda83 100644 --- a/app/server/package.json +++ b/app/server/package.json @@ -35,10 +35,12 @@ "dependencies": { "@storybook/addons": "5.3.0-rc.6", "@storybook/core": "5.3.0-rc.6", + "@storybook/node-logger": "^5.2.8", "@types/webpack-env": "^1.13.9", "core-js": "^3.0.1", "global": "^4.3.2", "regenerator-runtime": "^0.13.3", + "safe-identifier": "^0.3.1", "ts-dedent": "^1.1.0" }, "peerDependencies": { diff --git a/app/server/src/lib/compiler/decorators/actions.ts b/app/server/src/lib/compiler/decorators/actions.ts new file mode 100644 index 000000000000..cf7677c7b342 --- /dev/null +++ b/app/server/src/lib/compiler/decorators/actions.ts @@ -0,0 +1,37 @@ +import { StorybookSection, StorybookStory } from '../types'; +import { importMeta } from './utils'; +import { stringifyObject } from '../stringifier'; + +type Action = string | any; + +function stringifyActionsDecorator(actions: Action[], importName: string): string[] { + if (!actions || actions.length === 0) return []; + + const actionArgs = actions.map(action => stringifyObject(action, 2)).join(',\n '); + + return [`${importName}(${actionArgs})`]; +} + +function actionsStoryDecorator(story: StorybookStory, importName: string): StorybookStory { + const { name, storyFn, decorators = [], actions, ...options } = story; + + return { + name, + storyFn, + decorators: [...decorators, ...stringifyActionsDecorator(actions, importName)], + ...options, + }; +} + +export default function actionsDecorator(section: StorybookSection): StorybookSection { + const { title, imports, decorators, stories, ...options } = section; + const { importName, moduleName } = importMeta('actions'); + + return { + title, + imports: { ...imports, ...{ [moduleName]: [importName] } }, + decorators, + stories: stories.map(story => actionsStoryDecorator(story, importName)), + ...options, + }; +} diff --git a/app/server/src/lib/compiler/decorators/index.ts b/app/server/src/lib/compiler/decorators/index.ts new file mode 100644 index 000000000000..9a5284827470 --- /dev/null +++ b/app/server/src/lib/compiler/decorators/index.ts @@ -0,0 +1,31 @@ +import { StorybookSection, Decorator } from '../types'; +import { decorateSimpleAddon } from './utils'; +import knobsDecorator from './knobs'; +import actionsDecorator from './actions'; + +export function a11yDecorator(section: StorybookSection): StorybookSection { + return decorateSimpleAddon(section, 'a11y'); +} + +export function linksDecorator(section: StorybookSection): StorybookSection { + return decorateSimpleAddon(section, 'links'); +} + +// Order matters. We need to do knobs before actions to get the right StoryFn wrapping +const allDecorators: Record = { + a11y: a11yDecorator, + links: linksDecorator, + knobs: knobsDecorator, + actions: actionsDecorator, +}; + +export default function decorateSection( + section: StorybookSection, + addons: string[] +): StorybookSection { + const decorators = Object.keys(allDecorators) + .filter(addon => addons.includes(addon)) + .map(addon => allDecorators[addon]); + + return decorators.reduce((sec, decorator) => decorator(sec), section); +} diff --git a/app/server/src/lib/compiler/decorators/knobs.ts b/app/server/src/lib/compiler/decorators/knobs.ts new file mode 100644 index 000000000000..f300fb0b3bc4 --- /dev/null +++ b/app/server/src/lib/compiler/decorators/knobs.ts @@ -0,0 +1,93 @@ +import dedent from 'ts-dedent'; +import { StorybookSection, StorybookStory } from '../types'; +import { decorateSimpleAddon, importMeta } from './utils'; +import { stringifyObject } from '../stringifier'; + +type KnobType = 'text' | 'number' | 'color' | 'array' | 'boolean' | 'object' | 'date' | 'select'; + +interface StoryKnob { + param: string; + type: KnobType; + name: string; + value: any; + [x: string]: any; +} + +function stringifyKnob(knob: StoryKnob) { + const { param, type, name, value, ...opts } = knob; + const knobParam = param || name; // Todo: can we do away with this? + const level = 2; + const stringifiedValue = stringifyObject(value, level); + // TODO: Add group + const knobFunction = (t => { + switch (t) { + case 'text': + return `text('${name}', ${stringifiedValue})`; + case 'number': + return `number('${name}', ${stringifiedValue}, ${stringifyObject(opts, level)})`; + case 'color': + return `color('${name}', ${stringifiedValue})`; + case 'array': + return `array('${name}', ${stringifiedValue}).join(',')`; + case 'boolean': + return `boolean('${name}', ${stringifiedValue})`; + case 'object': + return `object('${name}', ${stringifiedValue})`; + case 'date': + return `date('${name}', new Date(${stringifiedValue}))`; + case 'select': + return `select('${name}', ${stringifyObject(opts.options, level)}, ${stringifiedValue})`; + default: + return ''; + } + })(type); + + return `${knobParam}: ${knobFunction}`; +} + +function stringifyStoryFunction(knobs: StoryKnob[], storyFn: string) { + if (!knobs || knobs.length === 0) return storyFn; + + return dedent` + () => { + return { + ${knobs.map((knob: any) => `${stringifyKnob(knob)},`).join('\n ')} + }; + } + `; +} + +function knobsStoryDecorator(story: StorybookStory): StorybookStory { + const { name, storyFn, knobs, ...options } = story; + + return { + name, + storyFn: stringifyStoryFunction(knobs, storyFn), + ...options, + }; +} + +export default function knobsDecorator(section: StorybookSection): StorybookSection { + const { title, imports, decorators, stories, ...options } = decorateSimpleAddon(section, 'knobs'); + const { importName, moduleName } = importMeta('knobs'); + + const knobImports = [ + importName, + 'array', + 'boolean', + 'color', + 'date', + 'text', + 'number', + 'object', + 'select', + ]; + + return { + title, + imports: { ...imports, ...{ [moduleName]: knobImports } }, + decorators, + stories: stories.map(story => knobsStoryDecorator(story)), + ...options, + }; +} diff --git a/app/server/src/lib/compiler/decorators/utils.ts b/app/server/src/lib/compiler/decorators/utils.ts new file mode 100644 index 000000000000..838df57a9d74 --- /dev/null +++ b/app/server/src/lib/compiler/decorators/utils.ts @@ -0,0 +1,21 @@ +import { StorybookSection } from '../types'; + +export function importMeta(addon: string) { + return { + importName: `with${addon.charAt(0).toUpperCase() + addon.slice(1)}`, + moduleName: `@storybook/addon-${addon}`, + }; +} + +export function decorateSimpleAddon(section: StorybookSection, addon: string) { + const { title, imports, decorators, stories, ...options } = section; + const { importName, moduleName } = importMeta(addon); + + return { + title, + imports: { ...imports, ...{ [moduleName]: [importName] } }, + decorators: [...decorators, importName], + stories, + ...options, + }; +} diff --git a/app/server/src/lib/compiler/index.ts b/app/server/src/lib/compiler/index.ts new file mode 100644 index 000000000000..7bdda279494c --- /dev/null +++ b/app/server/src/lib/compiler/index.ts @@ -0,0 +1,38 @@ +import { + CompileCsfModuleArgs, + CompileStorybookSectionArgs, + CompileStorybookStoryArgs, + StorybookSection, + StorybookStory, +} from './types'; + +import stringifier from './stringifier'; +import decorate from './decorators'; + +function createStory(storyArgs: CompileStorybookStoryArgs): StorybookStory { + const { name, ...options } = storyArgs; + + return { + name, + storyFn: '() => {}', + ...options, + }; +} + +function createSection(args: CompileStorybookSectionArgs): StorybookSection { + const { title, stories, ...options } = args; + return { + imports: {}, + decorators: [], + title, + stories: stories.map(storyArgs => createStory(storyArgs)), + ...options, + }; +} + +export default function compileCsfModule(args: CompileCsfModuleArgs): string { + const { addons = [], ...compileSectionArgs } = args; + const storybookSection = createSection(compileSectionArgs); + const decoratedSection = decorate(storybookSection, addons); + return stringifier(decoratedSection); +} diff --git a/app/server/src/lib/compiler/stringifier.ts b/app/server/src/lib/compiler/stringifier.ts new file mode 100644 index 000000000000..105789a0e3a5 --- /dev/null +++ b/app/server/src/lib/compiler/stringifier.ts @@ -0,0 +1,85 @@ +import dedent from 'ts-dedent'; +import { StorybookStory, StorybookSection } from './types'; + +const { identifier } = require('safe-identifier'); + +export function stringifyObject(object: any, level = 0, excludeOuterParams = false): string { + if (typeof object === 'string') { + return `'${object}'`; + } + const indent = ' '.repeat(level); + if (Array.isArray(object)) { + const arrayString: string[] = object.map((item: any) => stringifyObject(item, level + 1)); + return `[\n${indent} ${arrayString.join(`,\n${indent} `)}\n${indent}]`; + } + if (typeof object === 'object') { + let objectString = ''; + if (Object.keys(object).length > 0) { + const objectStrings: string[] = Object.keys(object).map(key => { + const value: string = stringifyObject(object[key], level + 1); + return `\n${indent} ${key}: ${value}`; + }); + objectString = objectStrings.join(','); + } + if (level === 0 && excludeOuterParams) { + return objectString; + } + return `{${objectString}\n${indent}}`; + } + + return object; +} + +export function stringifyImports(imports: Record): string { + if (Object.keys(imports).length === 0) return ''; + return Object.entries(imports) + .map(([module, names]) => `import { ${names.sort().join(', ')} } from '${module}';\n`) + .join(); +} + +export function stringifyDecorators(decorators: string[]): string { + return decorators && decorators.length > 0 + ? `\n decorators: [\n ${decorators.join(',\n ')}\n ],` + : ''; +} + +export function stringifyDefault(section: StorybookSection): string { + const { title, imports, decorators, stories, ...options } = section; + + const decoratorsString = stringifyDecorators(decorators); + + const optionsString = stringifyObject(options, 0, true); + + return dedent` + export default { + title: '${title}',${decoratorsString}${optionsString} + } + + `; +} + +export function stringifyStory(story: StorybookStory): string { + const { name, storyFn, decorators, ...options } = story; + const storyId = identifier(name); + + const decoratorsString = stringifyDecorators(decorators); + const optionsString = stringifyObject({ name, ...options }, 0, true); + + let storyString = ''; + if (decoratorsString.length > 0 || optionsString.length > 0) { + storyString = dedent`${storyId}.story = {${decoratorsString}${optionsString} + }`; + } + return `export const ${storyId} = ${storyFn};\n${storyString}`; +} + +export default function stringifySection(section: StorybookSection): string { + const sectionString = [ + stringifyImports(section.imports), + stringifyDefault(section), + ...section.stories.map(story => stringifyStory(story)), + ].join('\n'); + + // console.log('sectionString:\n', sectionString); + return sectionString; +} diff --git a/app/server/src/lib/compiler/types.ts b/app/server/src/lib/compiler/types.ts new file mode 100644 index 000000000000..0de8dbd14f2b --- /dev/null +++ b/app/server/src/lib/compiler/types.ts @@ -0,0 +1,31 @@ +export interface CompileStorybookStoryArgs { + name: string; + [x: string]: any; +} + +export interface CompileStorybookSectionArgs { + title: string; + stories: CompileStorybookStoryArgs[]; + [x: string]: any; +} + +export interface CompileCsfModuleArgs extends CompileStorybookSectionArgs { + addons?: string[]; +} + +export interface StorybookStory { + name: string; + storyFn: string; + decorators?: string[]; + [x: string]: any; +} + +export interface StorybookSection { + imports: Record; + decorators?: string[]; + title: string; + stories: StorybookStory[]; + [x: string]: any; +} + +export type Decorator = (section: StorybookSection) => StorybookSection; diff --git a/app/server/src/server/framework-preset-server.ts b/app/server/src/server/framework-preset-server.ts index 99c260139df1..2604c82e8b0f 100644 --- a/app/server/src/server/framework-preset-server.ts +++ b/app/server/src/server/framework-preset-server.ts @@ -1,6 +1,24 @@ // eslint-disable-next-line import/no-extraneous-dependencies import { Configuration } from 'webpack'; +import path from 'path'; export function webpack(config: Configuration) { - return config; + return { + ...config, + module: { + ...config.module, + rules: [ + ...config.module.rules, + { + type: 'javascript/auto', + test: /\.stories\.json$/, + use: [ + { + loader: path.resolve(__dirname, './loader.js'), + }, + ], + }, + ], + }, + }; } diff --git a/app/server/src/server/loader.ts b/app/server/src/server/loader.ts new file mode 100644 index 000000000000..778d692b334c --- /dev/null +++ b/app/server/src/server/loader.ts @@ -0,0 +1,5 @@ +import compileCsfModule from '../lib/compiler'; + +export default (content: string) => { + return compileCsfModule(JSON.parse(content)); +}; diff --git a/examples/server-kitchen-sink/client/storybook.js b/examples/server-kitchen-sink/client/storybook.js index c8d3695bcc01..9d1adf3d8805 100644 --- a/examples/server-kitchen-sink/client/storybook.js +++ b/examples/server-kitchen-sink/client/storybook.js @@ -1,4 +1,3 @@ -import React from 'react'; import { configure, addParameters } from '@storybook/server'; import { DocsPage, DocsContainer } from '@storybook/addon-docs/blocks'; diff --git a/examples/server-kitchen-sink2/.storybook/main.js b/examples/server-kitchen-sink2/.storybook/main.js new file mode 100644 index 000000000000..afaab0b2ddc8 --- /dev/null +++ b/examples/server-kitchen-sink2/.storybook/main.js @@ -0,0 +1,15 @@ +module.exports = { + // this dirname is because we run tests from project root + stories: [`${__dirname}/../stories/*.stories.*`], + + presets: ['@storybook/addon-docs/preset'], + addons: [ + '@storybook/addon-a11y/register', + '@storybook/addon-actions/register', + '@storybook/addon-backgrounds/register', + '@storybook/addon-knobs/register', + '@storybook/addon-links/register', + '@storybook/addon-notes/register', + '@storybook/addon-options/register', + ], +}; diff --git a/examples/server-kitchen-sink2/.storybook/preview.js b/examples/server-kitchen-sink2/.storybook/preview.js new file mode 100644 index 000000000000..467139f265b9 --- /dev/null +++ b/examples/server-kitchen-sink2/.storybook/preview.js @@ -0,0 +1,25 @@ +import { addParameters, addDecorator } from '@storybook/server'; +import { withA11y } from '@storybook/addon-a11y'; + +addDecorator(withA11y); + +const port = process.env.SERVER_PORT || 1337; + +addParameters({ + a11y: { + config: {}, + options: { + checks: { 'color-contrast': { options: { noScroll: true } } }, + restoreScroll: true, + }, + }, + options: { + showRoots: true, + }, + docs: { + iframeHeight: '200px', + }, + server: { + url: `http://localhost:${port}/storybook_preview`, + }, +}); diff --git a/examples/server-kitchen-sink2/README.md b/examples/server-kitchen-sink2/README.md new file mode 100644 index 000000000000..6679953ba470 --- /dev/null +++ b/examples/server-kitchen-sink2/README.md @@ -0,0 +1,9 @@ +# Server Kitchen Sink + +This is a dmmo app to test a standalone server using integration with Storybook using `@storybook/server`. + +Run `yarn install` to sync Storybook module with the source. + +Run `yarn start` to start. + +This starts an ExpressJS server on port `1337` and Storybook on port `9006`. diff --git a/examples/server-kitchen-sink2/package.json b/examples/server-kitchen-sink2/package.json new file mode 100644 index 000000000000..0d91f07a5c7c --- /dev/null +++ b/examples/server-kitchen-sink2/package.json @@ -0,0 +1,34 @@ +{ + "name": "server-kitchen-sink2", + "version": "5.3.0-rc.6", + "private": true, + "description": "", + "keywords": [], + "license": "MIT", + "author": "", + "main": "index.js", + "scripts": { + "build-storybook": "build-storybook", + "server": "PORT=1337 nodemon server.js", + "start": "concurrently \"yarn server\" \"yarn storybook\"", + "storybook": "SERVER_PORT=1137 start-storybook -p 9006 --quiet" + }, + "devDependencies": { + "@storybook/addon-a11y": "5.3.0-rc.6", + "@storybook/addon-actions": "5.3.0-rc.6", + "@storybook/addon-backgrounds": "5.3.0-rc.6", + "@storybook/addon-centered": "5.3.0-rc.6", + "@storybook/addon-knobs": "5.3.0-rc.6", + "@storybook/addon-links": "5.3.0-rc.6", + "@storybook/addon-notes": "5.3.0-rc.6", + "@storybook/node-logger": "5.3.0-rc.6", + "@storybook/server": "5.3.0-rc.6", + "concurrently": "^5.0.2", + "cors": "^2.8.5", + "express": "~4.16.4", + "morgan": "^1.9.1", + "nodemon": "^2.0.2", + "pug": "^2.0.4", + "safe-identifier": "^0.3.1" + } +} diff --git a/examples/server-kitchen-sink2/server.js b/examples/server-kitchen-sink2/server.js new file mode 100644 index 000000000000..ea25081f0915 --- /dev/null +++ b/examples/server-kitchen-sink2/server.js @@ -0,0 +1,21 @@ +const express = require('express'); +const cors = require('cors'); +const morgan = require('morgan'); +const path = require('path'); +const { logger } = require('@storybook/node-logger'); + +const port = process.env.PORT || 8080; + +const app = express(); +app.use(cors()); +app.use(morgan('dev')); +app.set('views', path.join(__dirname, 'views')); +app.set('view engine', 'pug'); + +app.get('/', (req, res) => res.send('Hello World!')); + +app.get(/storybook_preview\/(.*)/, (req, res) => { + res.render(req.params[0], req.query); +}); + +app.listen(port, () => logger.info(`Server listening on port ${port}!`)); diff --git a/examples/server-kitchen-sink2/stories/addon-a11y.stories.json b/examples/server-kitchen-sink2/stories/addon-a11y.stories.json new file mode 100644 index 000000000000..24687d848bcf --- /dev/null +++ b/examples/server-kitchen-sink2/stories/addon-a11y.stories.json @@ -0,0 +1,34 @@ +{ + "title": "Addons/a11y", + "addons": ["a11y"], + "parameters": { + "options": { "selectedPanel": "storybook/a11y/panel" } + }, + "stories": [ + { + "name": "Default", + "parameters": { + "server": { "id": "addons/a11y/default" } + } + }, + { + "name": "Label", + "parameters": { + "server": { "id": "addons/a11y/label" } + } + }, + { + "name": "Disabled", + "parameters": { + "server": { "id": "addons/a11y/disabled" } + } + }, + { + "id": "Contrast", + "name": "Invalid contrast", + "parameters": { + "server": { "id": "addons/a11y/contrast" } + } + } + ] +} diff --git a/examples/server-kitchen-sink2/stories/addon-actions.stories.json b/examples/server-kitchen-sink2/stories/addon-actions.stories.json new file mode 100644 index 000000000000..c227a231b095 --- /dev/null +++ b/examples/server-kitchen-sink2/stories/addon-actions.stories.json @@ -0,0 +1,45 @@ + { + "title": "Addons/Actions", + "addons": ["actions"], + "parameters": { + "options": { "selectedPanel": "storybook/actions/panel" } + }, + "stories": [ + { + "name": "Hello World", + "parameters": { + "server": { "id": "addons/actions/story1" } + }, + "actions": ["click"] + }, + { + "name": "Multiple actions", + "parameters": { + "server": { "id": "addons/actions/story2" } + }, + "actions": ["click", "contextmenu"] + }, + { + "name": "Multiple actions + config", + "parameters": { + "server": { "id": "addons/actions/story3" } + }, + "actions": ["click", "contextmenu", { "clearOnStoryChange": false }] + }, + { + "name": "Multiple actions, object", + "parameters": { + "server": { "id": "addons/actions/story4" } + }, + "actions": [{ "click": "clicked", "contextmenu": "right clicked" }] + }, + + { + "name": "Multiple actions, object + config", + "parameters": { + "server": { "id": "addons/actions/story6" } + }, + "actions": [{ "click": "clicked", "contextmenu": "right clicked" }, { "clearOnStoryChange": false }] + } + ] +} diff --git a/examples/server-kitchen-sink2/stories/addon-backgrounds.stories.json b/examples/server-kitchen-sink2/stories/addon-backgrounds.stories.json new file mode 100644 index 000000000000..dc77798cbb24 --- /dev/null +++ b/examples/server-kitchen-sink2/stories/addon-backgrounds.stories.json @@ -0,0 +1,23 @@ +{ + "title": "Addons/Backgrounds", + "parameters": { + "backgrounds": [ + { "name": "light", "value": "#eeeeee" }, + { "name": "dark", "value": "#222222", "default": true } + ] + }, + "stories": [ + { + "name": "Story 1", + "parameters": { + "server": { "id": "addons/backgrounds/story1" } + } + }, + { + "name": "Story 2", + "parameters": { + "server": { "id": "addons/backgrounds/story2" } + } + } + ] +} diff --git a/examples/server-kitchen-sink2/stories/addon-knobs.stories.json b/examples/server-kitchen-sink2/stories/addon-knobs.stories.json new file mode 100644 index 000000000000..17a293eb5d1e --- /dev/null +++ b/examples/server-kitchen-sink2/stories/addon-knobs.stories.json @@ -0,0 +1,64 @@ +{ + "title": "Addons/Knobs", + "addons": ["knobs"], + "parameters": { + "options": { "selectedPanel": "storybook/knobs/panel" } + }, + "stories": [ + { + "name": "Simple", + "parameters": { + "server": { "id": "addons/knobs/simple" } + }, + "knobs": [ + { "type": "text", "name": "Name", "value": "John Doe", "param": "name"}, + { "type": "number", "name": "Age", "value": 44, "param": "age"} + ] + }, + { + "name": "CSS transitions", + "parameters": { + "server": { "id": "addons/knobs/css" } + }, + "knobs": [ + { "type": "text", "name": "Name", "value": "John Doe", "param": "name"}, + { "type": "color", "name": "Text Color", "value": "orangered", "param": "textColor"} + ] + }, + { + "name": "All knobs", + "parameters": { + "server": { "id": "addons/knobs/all" } + }, + "knobs": [ + { "type": "text", "name": "Name", "value": "Jane", "param": "name"}, + { + "type": "number", + "name": "Stock", + "value": 20, + "param": "stock", + "range": true, + "min": 0, + "max": 30, + "step": 5 + }, + { + "type": "select", + "name": "Fruit", + "value": "apples", + "param": "fruit", + "options": { + "Apple": "apples", + "Banana": "bananas", + "Cherry": "cherries" + } + }, + { "type": "number", "name": "Price", "value": 2.25, "param": "price"}, + { "type": "color", "name": "Border", "value": "deeppink", "param": "colour"}, + { "type": "date", "name": "Today", "value": "Jan 20 2017 GMT+0", "param": "today"}, + { "type": "array", "name": "Items", "value": ["Laptop", "Book", "Whiskey"], "param": "items"}, + { "type": "boolean", "name": "Nice", "value": true, "param": "nice"} + ] + } + ] +} diff --git a/examples/server-kitchen-sink2/stories/addon-notes.stories.json b/examples/server-kitchen-sink2/stories/addon-notes.stories.json new file mode 100644 index 000000000000..9dc4e21c17d5 --- /dev/null +++ b/examples/server-kitchen-sink2/stories/addon-notes.stories.json @@ -0,0 +1,12 @@ +{ + "title": "Addons/Notes", + "stories": [ + { + "name": "Simple note", + "parameters": { + "notes": "My notes on some bold text", + "server": { "id": "addons/notes/story1" } + } + } + ] +} diff --git a/examples/server-kitchen-sink2/stories/demo.stories.json b/examples/server-kitchen-sink2/stories/demo.stories.json new file mode 100644 index 000000000000..207332142d29 --- /dev/null +++ b/examples/server-kitchen-sink2/stories/demo.stories.json @@ -0,0 +1,23 @@ +{ + "title": "Demo", + "stories": [ + { + "name": "Heading", + "parameters": { + "server": { "id": "demo/heading" } + } + }, + { + "name": "Headings", + "parameters": { + "server": { "id": "demo/headings" } + } + }, + { + "name": "Button", + "parameters": { + "server": { "id": "demo/button" } + } + } + ] +} diff --git a/examples/server-kitchen-sink2/stories/params.stories.json b/examples/server-kitchen-sink2/stories/params.stories.json new file mode 100644 index 000000000000..c714b0a562df --- /dev/null +++ b/examples/server-kitchen-sink2/stories/params.stories.json @@ -0,0 +1,28 @@ +{ + "title": "Params", + "parameters": { + "server": { + "params": { "color": "red" } + } + }, + "stories": [ + { + "name": "Story", + "parameters": { + "server": { + "id": "params/story", + "params": { "message": "Hello World" } + } + } + }, + { + "name": "Override", + "parameters": { + "server": { + "id": "params/override", + "params": { "message": "Hello World", "color": "green" } + } + } + } + ] +} diff --git a/examples/server-kitchen-sink2/stories/welcome.stories.json b/examples/server-kitchen-sink2/stories/welcome.stories.json new file mode 100644 index 000000000000..4c1974ae1912 --- /dev/null +++ b/examples/server-kitchen-sink2/stories/welcome.stories.json @@ -0,0 +1,14 @@ +{ + "title": "Welcome", + "addons": ["links"], + "stories": [ + { + "name": "Welcome", + "parameters": { + "server": { + "id": "welcome/welcome" + } + } + } + ] +} diff --git a/examples/server-kitchen-sink2/views/addons/a11y/contrast.pug b/examples/server-kitchen-sink2/views/addons/a11y/contrast.pug new file mode 100644 index 000000000000..4b217011d3a1 --- /dev/null +++ b/examples/server-kitchen-sink2/views/addons/a11y/contrast.pug @@ -0,0 +1 @@ +button(style='color: black; background-color: brown;') Testing the a11y addon \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/a11y/default.pug b/examples/server-kitchen-sink2/views/addons/a11y/default.pug new file mode 100644 index 000000000000..0900630d219d --- /dev/null +++ b/examples/server-kitchen-sink2/views/addons/a11y/default.pug @@ -0,0 +1 @@ +button \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/a11y/disabled.pug b/examples/server-kitchen-sink2/views/addons/a11y/disabled.pug new file mode 100644 index 000000000000..2b3652f5ecc7 --- /dev/null +++ b/examples/server-kitchen-sink2/views/addons/a11y/disabled.pug @@ -0,0 +1 @@ +button(disabled) Testing the a11y addon \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/a11y/label.pug b/examples/server-kitchen-sink2/views/addons/a11y/label.pug new file mode 100644 index 000000000000..901f438d64a5 --- /dev/null +++ b/examples/server-kitchen-sink2/views/addons/a11y/label.pug @@ -0,0 +1 @@ +button Testing the a11y addon \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/actions/button.pug b/examples/server-kitchen-sink2/views/addons/actions/button.pug new file mode 100644 index 000000000000..e612bbfb36f1 --- /dev/null +++ b/examples/server-kitchen-sink2/views/addons/actions/button.pug @@ -0,0 +1 @@ +button(type="button") Hello World \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/actions/story1.pug b/examples/server-kitchen-sink2/views/addons/actions/story1.pug new file mode 100644 index 000000000000..7894bcc0743b --- /dev/null +++ b/examples/server-kitchen-sink2/views/addons/actions/story1.pug @@ -0,0 +1 @@ +include button.pug \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/actions/story2.pug b/examples/server-kitchen-sink2/views/addons/actions/story2.pug new file mode 100644 index 000000000000..7894bcc0743b --- /dev/null +++ b/examples/server-kitchen-sink2/views/addons/actions/story2.pug @@ -0,0 +1 @@ +include button.pug \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/actions/story3.pug b/examples/server-kitchen-sink2/views/addons/actions/story3.pug new file mode 100644 index 000000000000..7894bcc0743b --- /dev/null +++ b/examples/server-kitchen-sink2/views/addons/actions/story3.pug @@ -0,0 +1 @@ +include button.pug \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/actions/story4.pug b/examples/server-kitchen-sink2/views/addons/actions/story4.pug new file mode 100644 index 000000000000..7894bcc0743b --- /dev/null +++ b/examples/server-kitchen-sink2/views/addons/actions/story4.pug @@ -0,0 +1 @@ +include button.pug \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/actions/story5.pug b/examples/server-kitchen-sink2/views/addons/actions/story5.pug new file mode 100644 index 000000000000..557c20da0e89 --- /dev/null +++ b/examples/server-kitchen-sink2/views/addons/actions/story5.pug @@ -0,0 +1,3 @@ +div + | Clicks on this button will be logged: + button(class="btn" type="button") Button \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/actions/story6.pug b/examples/server-kitchen-sink2/views/addons/actions/story6.pug new file mode 100644 index 000000000000..7894bcc0743b --- /dev/null +++ b/examples/server-kitchen-sink2/views/addons/actions/story6.pug @@ -0,0 +1 @@ +include button.pug \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/actions/story7.pug b/examples/server-kitchen-sink2/views/addons/actions/story7.pug new file mode 100644 index 000000000000..7894bcc0743b --- /dev/null +++ b/examples/server-kitchen-sink2/views/addons/actions/story7.pug @@ -0,0 +1 @@ +include button.pug \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/actions/story8.pug b/examples/server-kitchen-sink2/views/addons/actions/story8.pug new file mode 100644 index 000000000000..7894bcc0743b --- /dev/null +++ b/examples/server-kitchen-sink2/views/addons/actions/story8.pug @@ -0,0 +1 @@ +include button.pug \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/backgrounds/story1.pug b/examples/server-kitchen-sink2/views/addons/backgrounds/story1.pug new file mode 100644 index 000000000000..7d62c85d7cdf --- /dev/null +++ b/examples/server-kitchen-sink2/views/addons/backgrounds/story1.pug @@ -0,0 +1 @@ +span(style="color: white") You should be able to switch backgrounds for this story \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/backgrounds/story2.pug b/examples/server-kitchen-sink2/views/addons/backgrounds/story2.pug new file mode 100644 index 000000000000..82abc4ee834a --- /dev/null +++ b/examples/server-kitchen-sink2/views/addons/backgrounds/story2.pug @@ -0,0 +1 @@ +span(style="color: white") This one too! \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/knobs/all.pug b/examples/server-kitchen-sink2/views/addons/knobs/all.pug new file mode 100644 index 000000000000..f7003e395ec7 --- /dev/null +++ b/examples/server-kitchen-sink2/views/addons/knobs/all.pug @@ -0,0 +1,18 @@ +- nice = (nice === 'true') +- stock = parseInt(stock) +- stockMessage = stock > 0 ? `I have a stock of ${stock} ${fruit}, costing $${price} each.` : `I'm out of ${fruit}${nice ? ', Sorry!' : '.'}`; +- salutation = nice ? 'Nice to meet you!' : 'Leave me alone!'; +- dateOptions = { year: 'numeric', month: 'long', day: 'numeric', timeZone: 'UTC' }; +- style = `border: 2px dotted ${colour}; padding: 8px 22px; border-radius: 8px`; +- today = new Date(parseInt(today, 10)); +- items = items.split(','); + +div(style=`${style}`) + h1 My name is #{name}, + h3 today is #{today.toLocaleDateString('en-US', dateOptions)} + p !{stockMessage} + p Also, I have: + ul + each item in items + li= item + p #{salutation} \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/knobs/css.pug b/examples/server-kitchen-sink2/views/addons/knobs/css.pug new file mode 100644 index 000000000000..ec8996a53780 --- /dev/null +++ b/examples/server-kitchen-sink2/views/addons/knobs/css.pug @@ -0,0 +1 @@ +p(style=`transition: color 0.5s ease-out; color: ${textColor}`)= name \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/knobs/simple.pug b/examples/server-kitchen-sink2/views/addons/knobs/simple.pug new file mode 100644 index 000000000000..899a25344ca4 --- /dev/null +++ b/examples/server-kitchen-sink2/views/addons/knobs/simple.pug @@ -0,0 +1,2 @@ +div. + I am #{name} and I'm #{age} years old. \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/knobs/xss_safety.pug b/examples/server-kitchen-sink2/views/addons/knobs/xss_safety.pug new file mode 100644 index 000000000000..6e0f1c5d2d33 --- /dev/null +++ b/examples/server-kitchen-sink2/views/addons/knobs/xss_safety.pug @@ -0,0 +1 @@ + !{content} \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/notes/story1.pug b/examples/server-kitchen-sink2/views/addons/notes/story1.pug new file mode 100644 index 000000000000..dee88febdf62 --- /dev/null +++ b/examples/server-kitchen-sink2/views/addons/notes/story1.pug @@ -0,0 +1,2 @@ +p + strong This is a fragment of HTML diff --git a/examples/server-kitchen-sink2/views/demo/button.pug b/examples/server-kitchen-sink2/views/demo/button.pug new file mode 100644 index 000000000000..69e440c555c6 --- /dev/null +++ b/examples/server-kitchen-sink2/views/demo/button.pug @@ -0,0 +1 @@ +button Hello Button \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/demo/heading.pug b/examples/server-kitchen-sink2/views/demo/heading.pug new file mode 100644 index 000000000000..23b68dd8f3e9 --- /dev/null +++ b/examples/server-kitchen-sink2/views/demo/heading.pug @@ -0,0 +1 @@ +h1 Hello World \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/demo/headings.pug b/examples/server-kitchen-sink2/views/demo/headings.pug new file mode 100644 index 000000000000..23a6d7f78ab6 --- /dev/null +++ b/examples/server-kitchen-sink2/views/demo/headings.pug @@ -0,0 +1,4 @@ +h1 Hellow World +h2 Hellow World +h3 Hellow World +h4 Hellow World \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/params/override.pug b/examples/server-kitchen-sink2/views/params/override.pug new file mode 100644 index 000000000000..b60cffc6349b --- /dev/null +++ b/examples/server-kitchen-sink2/views/params/override.pug @@ -0,0 +1 @@ +include params.pug \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/params/params.pug b/examples/server-kitchen-sink2/views/params/params.pug new file mode 100644 index 000000000000..5020bd41af24 --- /dev/null +++ b/examples/server-kitchen-sink2/views/params/params.pug @@ -0,0 +1 @@ +h1(style=`color: ${color}`)= message \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/params/story.pug b/examples/server-kitchen-sink2/views/params/story.pug new file mode 100644 index 000000000000..b60cffc6349b --- /dev/null +++ b/examples/server-kitchen-sink2/views/params/story.pug @@ -0,0 +1 @@ +include params.pug \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/params/story_fn_override.pug b/examples/server-kitchen-sink2/views/params/story_fn_override.pug new file mode 100644 index 000000000000..b60cffc6349b --- /dev/null +++ b/examples/server-kitchen-sink2/views/params/story_fn_override.pug @@ -0,0 +1 @@ +include params.pug \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/welcome/welcome.pug b/examples/server-kitchen-sink2/views/welcome/welcome.pug new file mode 100644 index 000000000000..fe663b9d7c93 --- /dev/null +++ b/examples/server-kitchen-sink2/views/welcome/welcome.pug @@ -0,0 +1,36 @@ +.main + h1 Welcome to Storybook for Server + p This is a UI component dev environment for your plain HTML snippets. + p. + We've added some basic stories inside the #[code.code stories] directory. + #[br] + A story is a single state of one or more UI components. You can have as many stories as you want. + #[br] + (Basically a story is like a visual test case.) + p. + See these sample #[a.link(href='#' data-sb-kind='Demo' data-sb-story='Headings') stories] + p. + Just like that, you can add your own snippets as stories. + #[br] + You can also edit those snippets and see changes right away. + #[br] + p. + Usually we create stories with smaller UI components in the app. + #[br] + Have a look at the #[a.link(href='https://storybook.js.org/basics/writing-stories' target='_blank') Writing Stories] section in our documentation. +style. + .main { + padding: 15px; + line-height: 1.4; + font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; + background-color: #ffffff; + } + .code { + font-size: 15px; + font-weight: 600; + padding: 2px 5px; + border: 1px solid #eae9e9; + border-radius: 4px; + background-color: #f3f2f2; + color: #3a3a3a; + } \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 66e28e5e77e2..5d083257418d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9696,6 +9696,21 @@ concurrently@^5.0.0: tree-kill "^1.2.1" yargs "^12.0.5" +concurrently@^5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/concurrently/-/concurrently-5.0.2.tgz#4d2911018c0f15ddec34a8e668fc48dced7f3b1e" + integrity sha512-iUNVI6PzKO0RVXV9pHWM0khvEbELxf3XLIoChaV6hHyoIaJuxQWZiOwlNysnJX5khsfvIK66+OJqRdbYrdsR1g== + dependencies: + chalk "^2.4.2" + date-fns "^2.0.1" + lodash "^4.17.15" + read-pkg "^4.0.1" + rxjs "^6.5.2" + spawn-command "^0.0.2-1" + supports-color "^6.1.0" + tree-kill "^1.2.2" + yargs "^13.3.0" + config-chain@^1.1.11: version "1.1.12" resolved "https://registry.yarnpkg.com/config-chain/-/config-chain-1.1.12.tgz#0fde8d091200eb5e808caf25fe618c02f48e4efa" @@ -28105,6 +28120,11 @@ safe-buffer@>=5.1.0, safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519" integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg== +safe-identifier@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/safe-identifier/-/safe-identifier-0.3.1.tgz#466b956ef8558b10bbe15b87fedf470ab283cd39" + integrity sha512-+vr9lVsmciuoP1fz8w30qDcohwH2S/tb5dPGQ8zHmG9jQf7YHU2fIKGxxcDpeY38J0Dep+DdPMz8FszVZT0Mbw== + safe-json-parse@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/safe-json-parse/-/safe-json-parse-1.0.1.tgz#3e76723e38dfdda13c9b1d29a1e07ffee4b30b57" @@ -30867,6 +30887,11 @@ tree-kill@1.2.1, tree-kill@^1.1.0, tree-kill@^1.2.1: resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.1.tgz#5398f374e2f292b9dcc7b2e71e30a5c3bb6c743a" integrity sha512-4hjqbObwlh2dLyW4tcz0Ymw0ggoaVDMveUB9w8kFSQScdRLo0gxO9J7WFcUBo+W3C1TLdFIEwNOWebgZZ0RH9Q== +tree-kill@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.2.tgz#4ca09a9092c88b73a7cdc5e8a01b507b0790a0cc" + integrity sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A== + tree-sync@^1.2.2: version "1.4.0" resolved "https://registry.yarnpkg.com/tree-sync/-/tree-sync-1.4.0.tgz#314598d13abaf752547d9335b8f95d9a137100d6" From 11b7d9decfbc594e48d691bf80e5f8ba85829ccf Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Thu, 2 Jan 2020 09:00:10 +0800 Subject: [PATCH 14/25] Sever: Add snapshot compiler test --- app/server/package.json | 3 +++ .../lib/compiler/__testfixtures__/notes.json | 12 ++++++++++ .../compiler/__testfixtures__/notes.snapshot | 19 +++++++++++++++ .../lib/compiler/json-to-csf-compiler.test.ts | 24 +++++++++++++++++++ app/server/src/typings.d.ts | 1 + 5 files changed, 59 insertions(+) create mode 100644 app/server/src/lib/compiler/__testfixtures__/notes.json create mode 100644 app/server/src/lib/compiler/__testfixtures__/notes.snapshot create mode 100644 app/server/src/lib/compiler/json-to-csf-compiler.test.ts diff --git a/app/server/package.json b/app/server/package.json index fbcb9a9fda83..337dfba5e24d 100644 --- a/app/server/package.json +++ b/app/server/package.json @@ -43,6 +43,9 @@ "safe-identifier": "^0.3.1", "ts-dedent": "^1.1.0" }, + "devDependencies": { + "fs-extra": "^8.0.1" + }, "peerDependencies": { "babel-loader": "^7.0.0 || ^8.0.0" }, diff --git a/app/server/src/lib/compiler/__testfixtures__/notes.json b/app/server/src/lib/compiler/__testfixtures__/notes.json new file mode 100644 index 000000000000..9dc4e21c17d5 --- /dev/null +++ b/app/server/src/lib/compiler/__testfixtures__/notes.json @@ -0,0 +1,12 @@ +{ + "title": "Addons/Notes", + "stories": [ + { + "name": "Simple note", + "parameters": { + "notes": "My notes on some bold text", + "server": { "id": "addons/notes/story1" } + } + } + ] +} diff --git a/app/server/src/lib/compiler/__testfixtures__/notes.snapshot b/app/server/src/lib/compiler/__testfixtures__/notes.snapshot new file mode 100644 index 000000000000..a5cbf3c0946c --- /dev/null +++ b/app/server/src/lib/compiler/__testfixtures__/notes.snapshot @@ -0,0 +1,19 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`json-to-csf-compiler notes.json 1`] = ` +" +export default { + title: 'Addons/Notes', +} + +export const Simple_note = () => {}; +Simple_note.story = { + name: 'Simple note', + parameters: { + notes: 'My notes on some bold text', + server: { + id: 'addons/notes/story1' + } + } +}" +`; diff --git a/app/server/src/lib/compiler/json-to-csf-compiler.test.ts b/app/server/src/lib/compiler/json-to-csf-compiler.test.ts new file mode 100644 index 000000000000..3d994408f81d --- /dev/null +++ b/app/server/src/lib/compiler/json-to-csf-compiler.test.ts @@ -0,0 +1,24 @@ +import 'jest-specific-snapshot'; +import path from 'path'; +import fs from 'fs-extra'; +import compileCsfModule from '.'; + +const inputRegExp = /\.json$/; + +async function generate(filePath: string) { + const content = await fs.readFile(filePath, 'utf8'); + return compileCsfModule(JSON.parse(content)); +} + +describe('json-to-csf-compiler', () => { + const transformFixturesDir = path.join(__dirname, '__testfixtures__'); + fs.readdirSync(transformFixturesDir) + .filter((fileName: string) => inputRegExp.test(fileName)) + .forEach((fixtureFile: string) => { + it(fixtureFile, async () => { + const inputPath = path.join(transformFixturesDir, fixtureFile); + const code = await generate(inputPath); + expect(code).toMatchSpecificSnapshot(inputPath.replace(inputRegExp, '.snapshot')); + }); + }); +}); diff --git a/app/server/src/typings.d.ts b/app/server/src/typings.d.ts index 690e93343de2..ef324850aa08 100644 --- a/app/server/src/typings.d.ts +++ b/app/server/src/typings.d.ts @@ -1,5 +1,6 @@ declare module '@storybook/core/*'; declare module 'global'; +declare module 'fs-extra'; // will be provided by the webpack define plugin declare var NODE_ENV: string | undefined; From f70294d100cf8e9a77e8ee1ec055d242c9e72f33 Mon Sep 17 00:00:00 2001 From: Jon Palmer Date: Thu, 2 Jan 2020 13:02:09 -0500 Subject: [PATCH 15/25] Feedback from PR * More snapshot tests * Fixed some bugs * Added kitchen sink example to demo app --- app/server/src/client/preview/index.ts | 17 ++-- app/server/src/client/preview/render.ts | 2 +- .../lib/compiler/__testfixtures__/a11y.json | 15 ++++ .../compiler/__testfixtures__/a11y.snapshot | 28 +++++++ .../compiler/__testfixtures__/actions.json | 16 ++++ .../__testfixtures__/actions.snapshot | 34 ++++++++ .../__testfixtures__/backgrounds.json | 17 ++++ .../__testfixtures__/backgrounds.snapshot | 32 ++++++++ .../__testfixtures__/kitchen_sink.json | 40 ++++++++++ .../__testfixtures__/kitchen_sink.snapshot | 78 +++++++++++++++++++ .../lib/compiler/__testfixtures__/knobs.json | 19 +++++ .../compiler/__testfixtures__/knobs.snapshot | 33 ++++++++ .../lib/compiler/__testfixtures__/links.json | 14 ++++ .../compiler/__testfixtures__/links.snapshot | 23 ++++++ .../__testfixtures__/multiple_stories.json | 23 ++++++ .../multiple_stories.snapshot | 39 ++++++++++ .../compiler/__testfixtures__/notes.snapshot | 5 +- .../lib/compiler/__testfixtures__/params.json | 19 +++++ .../compiler/__testfixtures__/params.snapshot | 29 +++++++ .../__testfixtures__/params_override.json | 19 +++++ .../__testfixtures__/params_override.snapshot | 30 +++++++ .../src/lib/compiler/decorators/actions.ts | 10 ++- .../src/lib/compiler/decorators/index.ts | 22 ++---- .../src/lib/compiler/decorators/knobs.ts | 2 +- app/server/src/lib/compiler/index.ts | 10 +-- .../lib/compiler/json-to-csf-compiler.test.ts | 2 +- app/server/src/lib/compiler/stringifier.ts | 20 ++--- app/server/src/server/loader.ts | 2 +- .../stories/addon-actions.stories.json | 1 - .../stories/kitchen_sink.stories.json | 33 ++++++++ 30 files changed, 585 insertions(+), 49 deletions(-) create mode 100644 app/server/src/lib/compiler/__testfixtures__/a11y.json create mode 100644 app/server/src/lib/compiler/__testfixtures__/a11y.snapshot create mode 100644 app/server/src/lib/compiler/__testfixtures__/actions.json create mode 100644 app/server/src/lib/compiler/__testfixtures__/actions.snapshot create mode 100644 app/server/src/lib/compiler/__testfixtures__/backgrounds.json create mode 100644 app/server/src/lib/compiler/__testfixtures__/backgrounds.snapshot create mode 100644 app/server/src/lib/compiler/__testfixtures__/kitchen_sink.json create mode 100644 app/server/src/lib/compiler/__testfixtures__/kitchen_sink.snapshot create mode 100644 app/server/src/lib/compiler/__testfixtures__/knobs.json create mode 100644 app/server/src/lib/compiler/__testfixtures__/knobs.snapshot create mode 100644 app/server/src/lib/compiler/__testfixtures__/links.json create mode 100644 app/server/src/lib/compiler/__testfixtures__/links.snapshot create mode 100644 app/server/src/lib/compiler/__testfixtures__/multiple_stories.json create mode 100644 app/server/src/lib/compiler/__testfixtures__/multiple_stories.snapshot create mode 100644 app/server/src/lib/compiler/__testfixtures__/params.json create mode 100644 app/server/src/lib/compiler/__testfixtures__/params.snapshot create mode 100644 app/server/src/lib/compiler/__testfixtures__/params_override.json create mode 100644 app/server/src/lib/compiler/__testfixtures__/params_override.snapshot create mode 100644 examples/server-kitchen-sink2/stories/kitchen_sink.stories.json diff --git a/app/server/src/client/preview/index.ts b/app/server/src/client/preview/index.ts index 2f9ffc233dbc..31278387d389 100644 --- a/app/server/src/client/preview/index.ts +++ b/app/server/src/client/preview/index.ts @@ -1,9 +1,8 @@ -/* eslint-disable prefer-destructuring */ import { start } from '@storybook/core/client'; import { ClientStoryApi, Loadable } from '@storybook/addons'; import './globals'; -import render, { setFetchStoryHtml } from './render'; +import { renderMain as render, setFetchStoryHtml } from './render'; import { StoryFnServerReturnType, IStorybookSection, ConfigureOptionsArgs } from './types'; const framework = 'server'; @@ -33,10 +32,10 @@ const setRenderFecthAndConfigure: ClientApi['configure'] = (loader, module, opti }; export const configure: ClientApi['configure'] = setRenderFecthAndConfigure; -export const addDecorator: ClientApi['addDecorator'] = api.clientApi.addDecorator; -export const addParameters: ClientApi['addParameters'] = api.clientApi.addParameters; -export const clearDecorators: ClientApi['clearDecorators'] = api.clientApi.clearDecorators; -export const setAddon: ClientApi['setAddon'] = api.clientApi.setAddon; -export const forceReRender: ClientApi['forceReRender'] = api.forceReRender; -export const getStorybook: ClientApi['getStorybook'] = api.clientApi.getStorybook; -export const raw: ClientApi['raw'] = api.clientApi.raw; +export const { addDecorator } = api.clientApi; +export const { addParameters } = api.clientApi; +export const { clearDecorators } = api.clientApi; +export const { setAddon } = api.clientApi; +export const { forceReRender } = api; +export const { getStorybook } = api.clientApi; +export const { raw } = api.clientApi; diff --git a/app/server/src/client/preview/render.ts b/app/server/src/client/preview/render.ts index 409d9de252ad..d06e3ef4211e 100644 --- a/app/server/src/client/preview/render.ts +++ b/app/server/src/client/preview/render.ts @@ -12,7 +12,7 @@ let fetchStoryHtml: FetchStoryHtmlType = async (url, id, params) => { return response.text(); }; -export default async function renderMain({ +export async function renderMain({ storyFn, id, selectedKind, diff --git a/app/server/src/lib/compiler/__testfixtures__/a11y.json b/app/server/src/lib/compiler/__testfixtures__/a11y.json new file mode 100644 index 000000000000..cbbc9279e2b8 --- /dev/null +++ b/app/server/src/lib/compiler/__testfixtures__/a11y.json @@ -0,0 +1,15 @@ +{ + "title": "Addons/a11y", + "addons": ["a11y"], + "parameters": { + "options": { "selectedPanel": "storybook/a11y/panel" } + }, + "stories": [ + { + "name": "Label", + "parameters": { + "server": { "id": "addons/a11y/label" } + } + } + ] +} diff --git a/app/server/src/lib/compiler/__testfixtures__/a11y.snapshot b/app/server/src/lib/compiler/__testfixtures__/a11y.snapshot new file mode 100644 index 000000000000..32059d5a8fa8 --- /dev/null +++ b/app/server/src/lib/compiler/__testfixtures__/a11y.snapshot @@ -0,0 +1,28 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`json-to-csf-compiler a11y.json 1`] = ` +"import { withA11y } from '@storybook/addon-a11y'; + +export default { + title: 'Addons/a11y', + decorators: [ + withA11y + ], + parameters: { + options: { + selectedPanel: 'storybook/a11y/panel' + } + } +}; + +export const Label = () => {}; +Label.story = { + name: 'Label', + parameters: { + server: { + id: 'addons/a11y/label' + } + } +}; +" +`; diff --git a/app/server/src/lib/compiler/__testfixtures__/actions.json b/app/server/src/lib/compiler/__testfixtures__/actions.json new file mode 100644 index 000000000000..6adb4d8c591b --- /dev/null +++ b/app/server/src/lib/compiler/__testfixtures__/actions.json @@ -0,0 +1,16 @@ +{ + "title": "Addons/Actions", + "addons": ["actions"], + "parameters": { + "options": { "selectedPanel": "storybook/actions/panel" } + }, + "stories": [ + { + "name": "Multiple actions + config", + "parameters": { + "server": { "id": "addons/actions/story3" } + }, + "actions": ["click", "contextmenu", { "clearOnStoryChange": false }] + } + ] +} diff --git a/app/server/src/lib/compiler/__testfixtures__/actions.snapshot b/app/server/src/lib/compiler/__testfixtures__/actions.snapshot new file mode 100644 index 000000000000..b6a1c8f83f95 --- /dev/null +++ b/app/server/src/lib/compiler/__testfixtures__/actions.snapshot @@ -0,0 +1,34 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`json-to-csf-compiler actions.json 1`] = ` +"import { withActions } from '@storybook/addon-actions'; + +export default { + title: 'Addons/Actions', + parameters: { + options: { + selectedPanel: 'storybook/actions/panel' + } + } +}; + +export const Multiple_actions_config = () => {}; +Multiple_actions_config.story = { + decorators: [ + withActions( + 'click', + 'contextmenu', + { + clearOnStoryChange: false + } + ) + ], + name: 'Multiple actions + config', + parameters: { + server: { + id: 'addons/actions/story3' + } + } +}; +" +`; diff --git a/app/server/src/lib/compiler/__testfixtures__/backgrounds.json b/app/server/src/lib/compiler/__testfixtures__/backgrounds.json new file mode 100644 index 000000000000..4c91c4f4c51c --- /dev/null +++ b/app/server/src/lib/compiler/__testfixtures__/backgrounds.json @@ -0,0 +1,17 @@ +{ + "title": "Addons/Backgrounds", + "parameters": { + "backgrounds": [ + { "name": "light", "value": "#eeeeee" }, + { "name": "dark", "value": "#222222", "default": true } + ] + }, + "stories": [ + { + "name": "Story 1", + "parameters": { + "server": { "id": "addons/backgrounds/story1" } + } + } + ] +} diff --git a/app/server/src/lib/compiler/__testfixtures__/backgrounds.snapshot b/app/server/src/lib/compiler/__testfixtures__/backgrounds.snapshot new file mode 100644 index 000000000000..c1408fd5dbc2 --- /dev/null +++ b/app/server/src/lib/compiler/__testfixtures__/backgrounds.snapshot @@ -0,0 +1,32 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`json-to-csf-compiler backgrounds.json 1`] = ` +" +export default { + title: 'Addons/Backgrounds', + parameters: { + backgrounds: [ + { + name: 'light', + value: '#eeeeee' + }, + { + name: 'dark', + value: '#222222', + default: true + } + ] + } +}; + +export const Story_1 = () => {}; +Story_1.story = { + name: 'Story 1', + parameters: { + server: { + id: 'addons/backgrounds/story1' + } + } +}; +" +`; diff --git a/app/server/src/lib/compiler/__testfixtures__/kitchen_sink.json b/app/server/src/lib/compiler/__testfixtures__/kitchen_sink.json new file mode 100644 index 000000000000..e97dd4abfe87 --- /dev/null +++ b/app/server/src/lib/compiler/__testfixtures__/kitchen_sink.json @@ -0,0 +1,40 @@ +{ + "title": "Kitchen Sink", + "addons": ["a11y", "knobs", "actions", "links"], + "parameters": { + "backgrounds": [ + { "name": "light", "value": "#eeeeee" }, + { "name": "dark", "value": "#222222", "default": true } + ], + "options": { "selectedPanel": "storybook/a11y/panel" }, + "server": { + "params": { "color": "red" } + } + }, + "stories": [ + { + "name": "Heading", + "parameters": { + "notes": "My notes on some bold text", + "server": { + "id": "demo/heading", + "params": { + "color": "orange" + } + } + }, + "knobs": [ + { "type": "text", "name": "Name", "value": "John Doe", "param": "name"}, + { "type": "number", "name": "Age", "value": 44, "param": "age"} + ], + "actions": ["click", "contextmenu", { "clearOnStoryChange": false }] + }, + { + "name": "Button", + "parameters": { + "notes": "My notes on a button", + "server": { "id": "demo/button" } + } + } + ] +} diff --git a/app/server/src/lib/compiler/__testfixtures__/kitchen_sink.snapshot b/app/server/src/lib/compiler/__testfixtures__/kitchen_sink.snapshot new file mode 100644 index 000000000000..5049179d7a75 --- /dev/null +++ b/app/server/src/lib/compiler/__testfixtures__/kitchen_sink.snapshot @@ -0,0 +1,78 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`json-to-csf-compiler kitchen_sink.json 1`] = ` +"import { withA11y } from '@storybook/addon-a11y'; +import { withLinks } from '@storybook/addon-links'; +import { array, boolean, color, date, number, object, select, text, withKnobs } from '@storybook/addon-knobs'; +import { withActions } from '@storybook/addon-actions'; + +export default { + title: 'Kitchen Sink', + decorators: [ + withA11y, + withLinks, + withKnobs + ], + parameters: { + backgrounds: [ + { + name: 'light', + value: '#eeeeee' + }, + { + name: 'dark', + value: '#222222', + default: true + } + ], + options: { + selectedPanel: 'storybook/a11y/panel' + }, + server: { + params: { + color: 'red' + } + } + } +}; + +export const Heading = () => { + return { + name: text('Name', 'John Doe'), + age: number('Age', 44, {}), + }; +}; +Heading.story = { + decorators: [ + withActions( + 'click', + 'contextmenu', + { + clearOnStoryChange: false + } + ) + ], + name: 'Heading', + parameters: { + notes: 'My notes on some bold text', + server: { + id: 'demo/heading', + params: { + color: 'orange' + } + } + } +}; + +export const Button = () => {}; +Button.story = { + name: 'Button', + parameters: { + notes: 'My notes on a button', + server: { + id: 'demo/button' + } + } +}; +" +`; diff --git a/app/server/src/lib/compiler/__testfixtures__/knobs.json b/app/server/src/lib/compiler/__testfixtures__/knobs.json new file mode 100644 index 000000000000..b62edc82bdcd --- /dev/null +++ b/app/server/src/lib/compiler/__testfixtures__/knobs.json @@ -0,0 +1,19 @@ +{ + "title": "Addons/Knobs", + "addons": ["knobs"], + "parameters": { + "options": { "selectedPanel": "storybook/knobs/panel" } + }, + "stories": [ + { + "name": "Simple", + "parameters": { + "server": { "id": "addons/knobs/simple" } + }, + "knobs": [ + { "type": "text", "name": "Name", "value": "John Doe", "param": "name"}, + { "type": "number", "name": "Age", "value": 44, "param": "age"} + ] + } + ] +} diff --git a/app/server/src/lib/compiler/__testfixtures__/knobs.snapshot b/app/server/src/lib/compiler/__testfixtures__/knobs.snapshot new file mode 100644 index 000000000000..0b385ccad0b9 --- /dev/null +++ b/app/server/src/lib/compiler/__testfixtures__/knobs.snapshot @@ -0,0 +1,33 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`json-to-csf-compiler knobs.json 1`] = ` +"import { array, boolean, color, date, number, object, select, text, withKnobs } from '@storybook/addon-knobs'; + +export default { + title: 'Addons/Knobs', + decorators: [ + withKnobs + ], + parameters: { + options: { + selectedPanel: 'storybook/knobs/panel' + } + } +}; + +export const Simple = () => { + return { + name: text('Name', 'John Doe'), + age: number('Age', 44, {}), + }; +}; +Simple.story = { + name: 'Simple', + parameters: { + server: { + id: 'addons/knobs/simple' + } + } +}; +" +`; diff --git a/app/server/src/lib/compiler/__testfixtures__/links.json b/app/server/src/lib/compiler/__testfixtures__/links.json new file mode 100644 index 000000000000..4c1974ae1912 --- /dev/null +++ b/app/server/src/lib/compiler/__testfixtures__/links.json @@ -0,0 +1,14 @@ +{ + "title": "Welcome", + "addons": ["links"], + "stories": [ + { + "name": "Welcome", + "parameters": { + "server": { + "id": "welcome/welcome" + } + } + } + ] +} diff --git a/app/server/src/lib/compiler/__testfixtures__/links.snapshot b/app/server/src/lib/compiler/__testfixtures__/links.snapshot new file mode 100644 index 000000000000..b4c137add594 --- /dev/null +++ b/app/server/src/lib/compiler/__testfixtures__/links.snapshot @@ -0,0 +1,23 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`json-to-csf-compiler links.json 1`] = ` +"import { withLinks } from '@storybook/addon-links'; + +export default { + title: 'Welcome', + decorators: [ + withLinks + ], +}; + +export const Welcome = () => {}; +Welcome.story = { + name: 'Welcome', + parameters: { + server: { + id: 'welcome/welcome' + } + } +}; +" +`; diff --git a/app/server/src/lib/compiler/__testfixtures__/multiple_stories.json b/app/server/src/lib/compiler/__testfixtures__/multiple_stories.json new file mode 100644 index 000000000000..207332142d29 --- /dev/null +++ b/app/server/src/lib/compiler/__testfixtures__/multiple_stories.json @@ -0,0 +1,23 @@ +{ + "title": "Demo", + "stories": [ + { + "name": "Heading", + "parameters": { + "server": { "id": "demo/heading" } + } + }, + { + "name": "Headings", + "parameters": { + "server": { "id": "demo/headings" } + } + }, + { + "name": "Button", + "parameters": { + "server": { "id": "demo/button" } + } + } + ] +} diff --git a/app/server/src/lib/compiler/__testfixtures__/multiple_stories.snapshot b/app/server/src/lib/compiler/__testfixtures__/multiple_stories.snapshot new file mode 100644 index 000000000000..4e1bc924e2fc --- /dev/null +++ b/app/server/src/lib/compiler/__testfixtures__/multiple_stories.snapshot @@ -0,0 +1,39 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`json-to-csf-compiler multiple_stories.json 1`] = ` +" +export default { + title: 'Demo', +}; + +export const Heading = () => {}; +Heading.story = { + name: 'Heading', + parameters: { + server: { + id: 'demo/heading' + } + } +}; + +export const Headings = () => {}; +Headings.story = { + name: 'Headings', + parameters: { + server: { + id: 'demo/headings' + } + } +}; + +export const Button = () => {}; +Button.story = { + name: 'Button', + parameters: { + server: { + id: 'demo/button' + } + } +}; +" +`; diff --git a/app/server/src/lib/compiler/__testfixtures__/notes.snapshot b/app/server/src/lib/compiler/__testfixtures__/notes.snapshot index a5cbf3c0946c..95760047ea4b 100644 --- a/app/server/src/lib/compiler/__testfixtures__/notes.snapshot +++ b/app/server/src/lib/compiler/__testfixtures__/notes.snapshot @@ -4,7 +4,7 @@ exports[`json-to-csf-compiler notes.json 1`] = ` " export default { title: 'Addons/Notes', -} +}; export const Simple_note = () => {}; Simple_note.story = { @@ -15,5 +15,6 @@ Simple_note.story = { id: 'addons/notes/story1' } } -}" +}; +" `; diff --git a/app/server/src/lib/compiler/__testfixtures__/params.json b/app/server/src/lib/compiler/__testfixtures__/params.json new file mode 100644 index 000000000000..60f6b720cf42 --- /dev/null +++ b/app/server/src/lib/compiler/__testfixtures__/params.json @@ -0,0 +1,19 @@ +{ + "title": "Params", + "parameters": { + "server": { + "params": { "color": "red" } + } + }, + "stories": [ + { + "name": "Story", + "parameters": { + "server": { + "id": "params/story", + "params": { "message": "Hello World" } + } + } + } + ] +} diff --git a/app/server/src/lib/compiler/__testfixtures__/params.snapshot b/app/server/src/lib/compiler/__testfixtures__/params.snapshot new file mode 100644 index 000000000000..c0517efed521 --- /dev/null +++ b/app/server/src/lib/compiler/__testfixtures__/params.snapshot @@ -0,0 +1,29 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`json-to-csf-compiler params.json 1`] = ` +" +export default { + title: 'Params', + parameters: { + server: { + params: { + color: 'red' + } + } + } +}; + +export const Story = () => {}; +Story.story = { + name: 'Story', + parameters: { + server: { + id: 'params/story', + params: { + message: 'Hello World' + } + } + } +}; +" +`; diff --git a/app/server/src/lib/compiler/__testfixtures__/params_override.json b/app/server/src/lib/compiler/__testfixtures__/params_override.json new file mode 100644 index 000000000000..717be13a4ad3 --- /dev/null +++ b/app/server/src/lib/compiler/__testfixtures__/params_override.json @@ -0,0 +1,19 @@ +{ + "title": "Params", + "parameters": { + "server": { + "params": { "color": "red" } + } + }, + "stories": [ + { + "name": "Override", + "parameters": { + "server": { + "id": "params/override", + "params": { "message": "Hello World", "color": "green" } + } + } + } + ] +} diff --git a/app/server/src/lib/compiler/__testfixtures__/params_override.snapshot b/app/server/src/lib/compiler/__testfixtures__/params_override.snapshot new file mode 100644 index 000000000000..897da9eaf040 --- /dev/null +++ b/app/server/src/lib/compiler/__testfixtures__/params_override.snapshot @@ -0,0 +1,30 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`json-to-csf-compiler params_override.json 1`] = ` +" +export default { + title: 'Params', + parameters: { + server: { + params: { + color: 'red' + } + } + } +}; + +export const Override = () => {}; +Override.story = { + name: 'Override', + parameters: { + server: { + id: 'params/override', + params: { + message: 'Hello World', + color: 'green' + } + } + } +}; +" +`; diff --git a/app/server/src/lib/compiler/decorators/actions.ts b/app/server/src/lib/compiler/decorators/actions.ts index cf7677c7b342..9ae92240e5c3 100644 --- a/app/server/src/lib/compiler/decorators/actions.ts +++ b/app/server/src/lib/compiler/decorators/actions.ts @@ -7,9 +7,13 @@ type Action = string | any; function stringifyActionsDecorator(actions: Action[], importName: string): string[] { if (!actions || actions.length === 0) return []; - const actionArgs = actions.map(action => stringifyObject(action, 2)).join(',\n '); + // // const actionArgs = actions.map(action => stringifyObject(action, 3)).join(',\n '); - return [`${importName}(${actionArgs})`]; + // return [`${importName}(\n ${actionArgs}\n )`]; + + const actionArgs = stringifyObject(actions, 2, true); + + return [`${importName}(\n ${actionArgs}\n )`]; } function actionsStoryDecorator(story: StorybookStory, importName: string): StorybookStory { @@ -23,7 +27,7 @@ function actionsStoryDecorator(story: StorybookStory, importName: string): Story }; } -export default function actionsDecorator(section: StorybookSection): StorybookSection { +export function actionsDecorator(section: StorybookSection): StorybookSection { const { title, imports, decorators, stories, ...options } = section; const { importName, moduleName } = importMeta('actions'); diff --git a/app/server/src/lib/compiler/decorators/index.ts b/app/server/src/lib/compiler/decorators/index.ts index 9a5284827470..2e6969dcb50c 100644 --- a/app/server/src/lib/compiler/decorators/index.ts +++ b/app/server/src/lib/compiler/decorators/index.ts @@ -1,28 +1,20 @@ import { StorybookSection, Decorator } from '../types'; import { decorateSimpleAddon } from './utils'; -import knobsDecorator from './knobs'; -import actionsDecorator from './actions'; +import { knobsDecorator } from './knobs'; +import { actionsDecorator } from './actions'; -export function a11yDecorator(section: StorybookSection): StorybookSection { - return decorateSimpleAddon(section, 'a11y'); +function createSimpleDecorator(addon: string) { + return (section: StorybookSection): StorybookSection => decorateSimpleAddon(section, addon); } -export function linksDecorator(section: StorybookSection): StorybookSection { - return decorateSimpleAddon(section, 'links'); -} - -// Order matters. We need to do knobs before actions to get the right StoryFn wrapping const allDecorators: Record = { - a11y: a11yDecorator, - links: linksDecorator, + a11y: createSimpleDecorator('a11y'), + links: createSimpleDecorator('links'), knobs: knobsDecorator, actions: actionsDecorator, }; -export default function decorateSection( - section: StorybookSection, - addons: string[] -): StorybookSection { +export function decorateSection(section: StorybookSection, addons: string[]): StorybookSection { const decorators = Object.keys(allDecorators) .filter(addon => addons.includes(addon)) .map(addon => allDecorators[addon]); diff --git a/app/server/src/lib/compiler/decorators/knobs.ts b/app/server/src/lib/compiler/decorators/knobs.ts index f300fb0b3bc4..69d6f87ee86b 100644 --- a/app/server/src/lib/compiler/decorators/knobs.ts +++ b/app/server/src/lib/compiler/decorators/knobs.ts @@ -67,7 +67,7 @@ function knobsStoryDecorator(story: StorybookStory): StorybookStory { }; } -export default function knobsDecorator(section: StorybookSection): StorybookSection { +export function knobsDecorator(section: StorybookSection): StorybookSection { const { title, imports, decorators, stories, ...options } = decorateSimpleAddon(section, 'knobs'); const { importName, moduleName } = importMeta('knobs'); diff --git a/app/server/src/lib/compiler/index.ts b/app/server/src/lib/compiler/index.ts index 7bdda279494c..d25f090d3502 100644 --- a/app/server/src/lib/compiler/index.ts +++ b/app/server/src/lib/compiler/index.ts @@ -6,8 +6,8 @@ import { StorybookStory, } from './types'; -import stringifier from './stringifier'; -import decorate from './decorators'; +import { stringifySection } from './stringifier'; +import { decorateSection } from './decorators'; function createStory(storyArgs: CompileStorybookStoryArgs): StorybookStory { const { name, ...options } = storyArgs; @@ -30,9 +30,9 @@ function createSection(args: CompileStorybookSectionArgs): StorybookSection { }; } -export default function compileCsfModule(args: CompileCsfModuleArgs): string { +export function compileCsfModule(args: CompileCsfModuleArgs): string { const { addons = [], ...compileSectionArgs } = args; const storybookSection = createSection(compileSectionArgs); - const decoratedSection = decorate(storybookSection, addons); - return stringifier(decoratedSection); + const decoratedSection = decorateSection(storybookSection, addons); + return stringifySection(decoratedSection); } diff --git a/app/server/src/lib/compiler/json-to-csf-compiler.test.ts b/app/server/src/lib/compiler/json-to-csf-compiler.test.ts index 3d994408f81d..503cf198a995 100644 --- a/app/server/src/lib/compiler/json-to-csf-compiler.test.ts +++ b/app/server/src/lib/compiler/json-to-csf-compiler.test.ts @@ -1,7 +1,7 @@ import 'jest-specific-snapshot'; import path from 'path'; import fs from 'fs-extra'; -import compileCsfModule from '.'; +import { compileCsfModule } from '.'; const inputRegExp = /\.json$/; diff --git a/app/server/src/lib/compiler/stringifier.ts b/app/server/src/lib/compiler/stringifier.ts index 105789a0e3a5..2926c3281caf 100644 --- a/app/server/src/lib/compiler/stringifier.ts +++ b/app/server/src/lib/compiler/stringifier.ts @@ -9,8 +9,10 @@ export function stringifyObject(object: any, level = 0, excludeOuterParams = fal } const indent = ' '.repeat(level); if (Array.isArray(object)) { - const arrayString: string[] = object.map((item: any) => stringifyObject(item, level + 1)); - return `[\n${indent} ${arrayString.join(`,\n${indent} `)}\n${indent}]`; + const arrayStrings: string[] = object.map((item: any) => stringifyObject(item, level + 1)); + const arrayString = arrayStrings.join(`,\n${indent} `); + if (excludeOuterParams) return arrayString; + return `[\n${indent} ${arrayString}\n${indent}]`; } if (typeof object === 'object') { let objectString = ''; @@ -21,9 +23,8 @@ export function stringifyObject(object: any, level = 0, excludeOuterParams = fal }); objectString = objectStrings.join(','); } - if (level === 0 && excludeOuterParams) { - return objectString; - } + if (excludeOuterParams) return objectString; + if (objectString.length === 0) return '{}'; return `{${objectString}\n${indent}}`; } @@ -34,7 +35,7 @@ export function stringifyImports(imports: Record): string { if (Object.keys(imports).length === 0) return ''; return Object.entries(imports) .map(([module, names]) => `import { ${names.sort().join(', ')} } from '${module}';\n`) - .join(); + .join(''); } export function stringifyDecorators(decorators: string[]): string { @@ -53,7 +54,7 @@ export function stringifyDefault(section: StorybookSection): string { return dedent` export default { title: '${title}',${decoratorsString}${optionsString} - } + }; `; } @@ -67,13 +68,12 @@ export function stringifyStory(story: StorybookStory): string { let storyString = ''; if (decoratorsString.length > 0 || optionsString.length > 0) { - storyString = dedent`${storyId}.story = {${decoratorsString}${optionsString} - }`; + storyString = `${storyId}.story = {${decoratorsString}${optionsString}\n};\n`; } return `export const ${storyId} = ${storyFn};\n${storyString}`; } -export default function stringifySection(section: StorybookSection): string { +export function stringifySection(section: StorybookSection): string { const sectionString = [ stringifyImports(section.imports), stringifyDefault(section), diff --git a/app/server/src/server/loader.ts b/app/server/src/server/loader.ts index 778d692b334c..67b8aab46e0c 100644 --- a/app/server/src/server/loader.ts +++ b/app/server/src/server/loader.ts @@ -1,4 +1,4 @@ -import compileCsfModule from '../lib/compiler'; +import { compileCsfModule } from '../lib/compiler'; export default (content: string) => { return compileCsfModule(JSON.parse(content)); diff --git a/examples/server-kitchen-sink2/stories/addon-actions.stories.json b/examples/server-kitchen-sink2/stories/addon-actions.stories.json index c227a231b095..0680dd89da6d 100644 --- a/examples/server-kitchen-sink2/stories/addon-actions.stories.json +++ b/examples/server-kitchen-sink2/stories/addon-actions.stories.json @@ -33,7 +33,6 @@ }, "actions": [{ "click": "clicked", "contextmenu": "right clicked" }] }, - { "name": "Multiple actions, object + config", "parameters": { diff --git a/examples/server-kitchen-sink2/stories/kitchen_sink.stories.json b/examples/server-kitchen-sink2/stories/kitchen_sink.stories.json new file mode 100644 index 000000000000..528bdec0a405 --- /dev/null +++ b/examples/server-kitchen-sink2/stories/kitchen_sink.stories.json @@ -0,0 +1,33 @@ +{ + "title": "Kitchen Sink", + "addons": ["a11y", "knobs", "actions", "links"], + "parameters": { + "backgrounds": [ + { "name": "light", "value": "#eeeeee" }, + { "name": "dark", "value": "#222222", "default": true } + ], + "options": { "selectedPanel": "storybook/a11y/panel" }, + "server": { + "params": { "name": "Jane Doe" } + } + }, + "stories": [ + { + "name": "All the things", + "parameters": { + "notes": "My notes on some person", + "server": { + "id": "addons/knobs/simple", + "params": { + "name": "Jim Doe" + } + } + }, + "knobs": [ + { "type": "text", "name": "Name", "value": "John Doe", "param": "name"}, + { "type": "number", "name": "Age", "value": 44, "param": "age"} + ], + "actions": ["click", "contextmenu", { "clearOnStoryChange": false }] + } + ] +} From 4a9366edec4f7af1cc106e2f7b16b2ccd4237f00 Mon Sep 17 00:00:00 2001 From: Jon Palmer Date: Thu, 2 Jan 2020 13:02:16 -0500 Subject: [PATCH 16/25] Cleanup --- app/server/src/client/preview/index.ts | 16 +++++++++------- .../src/lib/compiler/decorators/actions.ts | 5 ----- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/app/server/src/client/preview/index.ts b/app/server/src/client/preview/index.ts index 31278387d389..499cea35e275 100644 --- a/app/server/src/client/preview/index.ts +++ b/app/server/src/client/preview/index.ts @@ -32,10 +32,12 @@ const setRenderFecthAndConfigure: ClientApi['configure'] = (loader, module, opti }; export const configure: ClientApi['configure'] = setRenderFecthAndConfigure; -export const { addDecorator } = api.clientApi; -export const { addParameters } = api.clientApi; -export const { clearDecorators } = api.clientApi; -export const { setAddon } = api.clientApi; -export const { forceReRender } = api; -export const { getStorybook } = api.clientApi; -export const { raw } = api.clientApi; +export const { + addDecorator, + addParameters, + clearDecorators, + setAddon, + forceReRender, + getStorybook, + raw, +} = api.clientApi; diff --git a/app/server/src/lib/compiler/decorators/actions.ts b/app/server/src/lib/compiler/decorators/actions.ts index 9ae92240e5c3..190f0f292aff 100644 --- a/app/server/src/lib/compiler/decorators/actions.ts +++ b/app/server/src/lib/compiler/decorators/actions.ts @@ -7,12 +7,7 @@ type Action = string | any; function stringifyActionsDecorator(actions: Action[], importName: string): string[] { if (!actions || actions.length === 0) return []; - // // const actionArgs = actions.map(action => stringifyObject(action, 3)).join(',\n '); - - // return [`${importName}(\n ${actionArgs}\n )`]; - const actionArgs = stringifyObject(actions, 2, true); - return [`${importName}(\n ${actionArgs}\n )`]; } From 9987b50367e8874f0f3e7454d9b0ea4831350f94 Mon Sep 17 00:00:00 2001 From: Jon Palmer Date: Thu, 2 Jan 2020 13:02:24 -0500 Subject: [PATCH 17/25] Update to new main.js format --- .../server-kitchen-sink2/.storybook/main.js | 20 +++++++++---------- examples/server-kitchen-sink2/README.md | 4 ++-- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/examples/server-kitchen-sink2/.storybook/main.js b/examples/server-kitchen-sink2/.storybook/main.js index afaab0b2ddc8..263d95f9579c 100644 --- a/examples/server-kitchen-sink2/.storybook/main.js +++ b/examples/server-kitchen-sink2/.storybook/main.js @@ -1,15 +1,13 @@ module.exports = { - // this dirname is because we run tests from project root - stories: [`${__dirname}/../stories/*.stories.*`], - - presets: ['@storybook/addon-docs/preset'], + stories: ['../stories/**/*.stories.json'], addons: [ - '@storybook/addon-a11y/register', - '@storybook/addon-actions/register', - '@storybook/addon-backgrounds/register', - '@storybook/addon-knobs/register', - '@storybook/addon-links/register', - '@storybook/addon-notes/register', - '@storybook/addon-options/register', + '@storybook/addon-docs', + '@storybook/addon-a11y', + '@storybook/addon-actions', + '@storybook/addon-backgrounds', + '@storybook/addon-knobs', + '@storybook/addon-links', + '@storybook/addon-notes', + '@storybook/addon-options', ], }; diff --git a/examples/server-kitchen-sink2/README.md b/examples/server-kitchen-sink2/README.md index 6679953ba470..7f9cddd5ecd9 100644 --- a/examples/server-kitchen-sink2/README.md +++ b/examples/server-kitchen-sink2/README.md @@ -1,9 +1,9 @@ # Server Kitchen Sink -This is a dmmo app to test a standalone server using integration with Storybook using `@storybook/server`. +This is a demo app to test a standalone server using integration with Storybook using `@storybook/server`. Run `yarn install` to sync Storybook module with the source. -Run `yarn start` to start. +Run `yarn start` to start. This starts an ExpressJS server on port `1337` and Storybook on port `9006`. From 0510b17dee3a615c4744d0dacd947b1f067c8033 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Thu, 2 Jan 2020 16:01:59 +0800 Subject: [PATCH 18/25] Update README.md --- app/server/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/server/README.md b/app/server/README.md index 2602ec86b0e6..37bc6240d2e3 100644 --- a/app/server/README.md +++ b/app/server/README.md @@ -1,4 +1,4 @@ -# Storybook for HTML +# Storybook for Server --- From 3838f66712c864cfbd9d0d84de0f56ac52471f4d Mon Sep 17 00:00:00 2001 From: Jon Palmer Date: Thu, 2 Jan 2020 13:02:55 -0500 Subject: [PATCH 19/25] Rename kitchen sink app --- examples/server-kitchen-sink/.babelrc | 5 - .../.storybook/main.js | 0 .../.storybook/preview.js | 0 examples/server-kitchen-sink/README.md | 19 +--- examples/server-kitchen-sink/client/.eslintrc | 8 -- .../client/stories/addon-a11y.stories.js | 37 ------- .../client/stories/addon-actions.stories.js | 80 ---------------- .../stories/addon-backgrounds.stories.js | 25 ----- .../client/stories/addon-knobs.stories.js | 96 ------------------- .../client/stories/addon-notes.stories.js | 12 --- .../client/stories/demo.stories.js | 24 ----- .../client/stories/index.js | 19 ---- .../client/stories/params.stories.js | 41 -------- .../client/stories/welcome.stories.js | 13 --- .../server-kitchen-sink/client/storybook.html | 21 ---- .../server-kitchen-sink/client/storybook.js | 15 --- examples/server-kitchen-sink/package.json | 25 +++-- .../server.js | 0 examples/server-kitchen-sink/server/app.js | 32 ------- .../server/views/addons/knobs/simple.pug | 1 - .../server/views/addons/knobs/story3.pug | 1 - .../server/views/addons/knobs/story4.pug | 13 --- .../server/views/addons/knobs/story5.pug | 1 - .../server/views/welcome/welcome.pug | 36 ------- .../stories/addon-a11y.stories.json | 0 .../stories/addon-actions.stories.json | 0 .../stories/addon-backgrounds.stories.json | 0 .../stories/addon-knobs.stories.json | 0 .../stories/addon-notes.stories.json | 0 .../stories/demo.stories.json | 0 .../stories/kitchen_sink.stories.json | 0 .../stories/params.stories.json | 0 .../stories/welcome.stories.json | 0 .../views/addons/a11y/contrast.pug | 0 .../views/addons/a11y/default.pug | 0 .../views/addons/a11y/disabled.pug | 0 .../{server => }/views/addons/a11y/label.pug | 0 .../views/addons/actions/button.pug | 0 .../views/addons/actions/story1.pug | 0 .../views/addons/actions/story2.pug | 0 .../views/addons/actions/story3.pug | 0 .../views/addons/actions/story4.pug | 0 .../views/addons/actions/story5.pug | 0 .../views/addons/actions/story6.pug | 0 .../views/addons/actions/story7.pug | 0 .../views/addons/actions/story8.pug | 0 .../views/addons/backgrounds/story1.pug | 0 .../views/addons/backgrounds/story2.pug | 0 .../views/addons/knobs/all.pug | 0 .../views/addons/knobs/css.pug | 0 .../views/addons/knobs/simple.pug | 0 .../views/addons/knobs/xss_safety.pug | 0 .../views/addons/notes/story1.pug | 0 .../{server => }/views/demo/button.pug | 0 .../{server => }/views/demo/heading.pug | 0 .../{server => }/views/demo/headings.pug | 0 .../{server => }/views/params/override.pug | 0 .../{server => }/views/params/params.pug | 0 .../{server => }/views/params/story.pug | 0 .../views/params/story_fn_override.pug | 0 .../views/welcome/welcome.pug | 0 .../server-kitchen-sink/webpack.config.js | 29 ------ examples/server-kitchen-sink2/README.md | 9 -- examples/server-kitchen-sink2/package.json | 34 ------- .../views/addons/a11y/contrast.pug | 1 - .../views/addons/a11y/default.pug | 1 - .../views/addons/a11y/disabled.pug | 1 - .../views/addons/a11y/label.pug | 1 - .../views/addons/actions/button.pug | 1 - .../views/addons/actions/story1.pug | 1 - .../views/addons/actions/story2.pug | 1 - .../views/addons/actions/story3.pug | 1 - .../views/addons/actions/story4.pug | 1 - .../views/addons/actions/story5.pug | 3 - .../views/addons/actions/story6.pug | 1 - .../views/addons/actions/story7.pug | 1 - .../views/addons/actions/story8.pug | 1 - .../views/addons/backgrounds/story1.pug | 1 - .../views/addons/backgrounds/story2.pug | 1 - .../views/addons/notes/story1.pug | 2 - .../views/demo/button.pug | 1 - .../views/demo/heading.pug | 1 - .../views/demo/headings.pug | 4 - .../views/params/override.pug | 1 - .../views/params/params.pug | 1 - .../views/params/story.pug | 1 - .../views/params/story_fn_override.pug | 1 - 87 files changed, 16 insertions(+), 609 deletions(-) delete mode 100644 examples/server-kitchen-sink/.babelrc rename examples/{server-kitchen-sink2 => server-kitchen-sink}/.storybook/main.js (100%) rename examples/{server-kitchen-sink2 => server-kitchen-sink}/.storybook/preview.js (100%) delete mode 100644 examples/server-kitchen-sink/client/.eslintrc delete mode 100644 examples/server-kitchen-sink/client/stories/addon-a11y.stories.js delete mode 100644 examples/server-kitchen-sink/client/stories/addon-actions.stories.js delete mode 100644 examples/server-kitchen-sink/client/stories/addon-backgrounds.stories.js delete mode 100644 examples/server-kitchen-sink/client/stories/addon-knobs.stories.js delete mode 100644 examples/server-kitchen-sink/client/stories/addon-notes.stories.js delete mode 100644 examples/server-kitchen-sink/client/stories/demo.stories.js delete mode 100644 examples/server-kitchen-sink/client/stories/index.js delete mode 100644 examples/server-kitchen-sink/client/stories/params.stories.js delete mode 100644 examples/server-kitchen-sink/client/stories/welcome.stories.js delete mode 100644 examples/server-kitchen-sink/client/storybook.html delete mode 100644 examples/server-kitchen-sink/client/storybook.js rename examples/{server-kitchen-sink2 => server-kitchen-sink}/server.js (100%) delete mode 100644 examples/server-kitchen-sink/server/app.js delete mode 100644 examples/server-kitchen-sink/server/views/addons/knobs/simple.pug delete mode 100644 examples/server-kitchen-sink/server/views/addons/knobs/story3.pug delete mode 100644 examples/server-kitchen-sink/server/views/addons/knobs/story4.pug delete mode 100644 examples/server-kitchen-sink/server/views/addons/knobs/story5.pug delete mode 100644 examples/server-kitchen-sink/server/views/welcome/welcome.pug rename examples/{server-kitchen-sink2 => server-kitchen-sink}/stories/addon-a11y.stories.json (100%) rename examples/{server-kitchen-sink2 => server-kitchen-sink}/stories/addon-actions.stories.json (100%) rename examples/{server-kitchen-sink2 => server-kitchen-sink}/stories/addon-backgrounds.stories.json (100%) rename examples/{server-kitchen-sink2 => server-kitchen-sink}/stories/addon-knobs.stories.json (100%) rename examples/{server-kitchen-sink2 => server-kitchen-sink}/stories/addon-notes.stories.json (100%) rename examples/{server-kitchen-sink2 => server-kitchen-sink}/stories/demo.stories.json (100%) rename examples/{server-kitchen-sink2 => server-kitchen-sink}/stories/kitchen_sink.stories.json (100%) rename examples/{server-kitchen-sink2 => server-kitchen-sink}/stories/params.stories.json (100%) rename examples/{server-kitchen-sink2 => server-kitchen-sink}/stories/welcome.stories.json (100%) rename examples/server-kitchen-sink/{server => }/views/addons/a11y/contrast.pug (100%) rename examples/server-kitchen-sink/{server => }/views/addons/a11y/default.pug (100%) rename examples/server-kitchen-sink/{server => }/views/addons/a11y/disabled.pug (100%) rename examples/server-kitchen-sink/{server => }/views/addons/a11y/label.pug (100%) rename examples/server-kitchen-sink/{server => }/views/addons/actions/button.pug (100%) rename examples/server-kitchen-sink/{server => }/views/addons/actions/story1.pug (100%) rename examples/server-kitchen-sink/{server => }/views/addons/actions/story2.pug (100%) rename examples/server-kitchen-sink/{server => }/views/addons/actions/story3.pug (100%) rename examples/server-kitchen-sink/{server => }/views/addons/actions/story4.pug (100%) rename examples/server-kitchen-sink/{server => }/views/addons/actions/story5.pug (100%) rename examples/server-kitchen-sink/{server => }/views/addons/actions/story6.pug (100%) rename examples/server-kitchen-sink/{server => }/views/addons/actions/story7.pug (100%) rename examples/server-kitchen-sink/{server => }/views/addons/actions/story8.pug (100%) rename examples/server-kitchen-sink/{server => }/views/addons/backgrounds/story1.pug (100%) rename examples/server-kitchen-sink/{server => }/views/addons/backgrounds/story2.pug (100%) rename examples/{server-kitchen-sink2 => server-kitchen-sink}/views/addons/knobs/all.pug (100%) rename examples/{server-kitchen-sink2 => server-kitchen-sink}/views/addons/knobs/css.pug (100%) rename examples/{server-kitchen-sink2 => server-kitchen-sink}/views/addons/knobs/simple.pug (100%) rename examples/{server-kitchen-sink2 => server-kitchen-sink}/views/addons/knobs/xss_safety.pug (100%) rename examples/server-kitchen-sink/{server => }/views/addons/notes/story1.pug (100%) rename examples/server-kitchen-sink/{server => }/views/demo/button.pug (100%) rename examples/server-kitchen-sink/{server => }/views/demo/heading.pug (100%) rename examples/server-kitchen-sink/{server => }/views/demo/headings.pug (100%) rename examples/server-kitchen-sink/{server => }/views/params/override.pug (100%) rename examples/server-kitchen-sink/{server => }/views/params/params.pug (100%) rename examples/server-kitchen-sink/{server => }/views/params/story.pug (100%) rename examples/server-kitchen-sink/{server => }/views/params/story_fn_override.pug (100%) rename examples/{server-kitchen-sink2 => server-kitchen-sink}/views/welcome/welcome.pug (100%) delete mode 100644 examples/server-kitchen-sink/webpack.config.js delete mode 100644 examples/server-kitchen-sink2/README.md delete mode 100644 examples/server-kitchen-sink2/package.json delete mode 100644 examples/server-kitchen-sink2/views/addons/a11y/contrast.pug delete mode 100644 examples/server-kitchen-sink2/views/addons/a11y/default.pug delete mode 100644 examples/server-kitchen-sink2/views/addons/a11y/disabled.pug delete mode 100644 examples/server-kitchen-sink2/views/addons/a11y/label.pug delete mode 100644 examples/server-kitchen-sink2/views/addons/actions/button.pug delete mode 100644 examples/server-kitchen-sink2/views/addons/actions/story1.pug delete mode 100644 examples/server-kitchen-sink2/views/addons/actions/story2.pug delete mode 100644 examples/server-kitchen-sink2/views/addons/actions/story3.pug delete mode 100644 examples/server-kitchen-sink2/views/addons/actions/story4.pug delete mode 100644 examples/server-kitchen-sink2/views/addons/actions/story5.pug delete mode 100644 examples/server-kitchen-sink2/views/addons/actions/story6.pug delete mode 100644 examples/server-kitchen-sink2/views/addons/actions/story7.pug delete mode 100644 examples/server-kitchen-sink2/views/addons/actions/story8.pug delete mode 100644 examples/server-kitchen-sink2/views/addons/backgrounds/story1.pug delete mode 100644 examples/server-kitchen-sink2/views/addons/backgrounds/story2.pug delete mode 100644 examples/server-kitchen-sink2/views/addons/notes/story1.pug delete mode 100644 examples/server-kitchen-sink2/views/demo/button.pug delete mode 100644 examples/server-kitchen-sink2/views/demo/heading.pug delete mode 100644 examples/server-kitchen-sink2/views/demo/headings.pug delete mode 100644 examples/server-kitchen-sink2/views/params/override.pug delete mode 100644 examples/server-kitchen-sink2/views/params/params.pug delete mode 100644 examples/server-kitchen-sink2/views/params/story.pug delete mode 100644 examples/server-kitchen-sink2/views/params/story_fn_override.pug diff --git a/examples/server-kitchen-sink/.babelrc b/examples/server-kitchen-sink/.babelrc deleted file mode 100644 index 41b1f6da7f98..000000000000 --- a/examples/server-kitchen-sink/.babelrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "presets": [ - "@babel/preset-env", "@babel/react" - ] -} \ No newline at end of file diff --git a/examples/server-kitchen-sink2/.storybook/main.js b/examples/server-kitchen-sink/.storybook/main.js similarity index 100% rename from examples/server-kitchen-sink2/.storybook/main.js rename to examples/server-kitchen-sink/.storybook/main.js diff --git a/examples/server-kitchen-sink2/.storybook/preview.js b/examples/server-kitchen-sink/.storybook/preview.js similarity index 100% rename from examples/server-kitchen-sink2/.storybook/preview.js rename to examples/server-kitchen-sink/.storybook/preview.js diff --git a/examples/server-kitchen-sink/README.md b/examples/server-kitchen-sink/README.md index 23441837b966..6679953ba470 100644 --- a/examples/server-kitchen-sink/README.md +++ b/examples/server-kitchen-sink/README.md @@ -1,20 +1,9 @@ # Server Kitchen Sink -This project demonstrates a standalone server using `@storybook/server`. +This is a dmmo app to test a standalone server using integration with Storybook using `@storybook/server`. -To run the server: +Run `yarn install` to sync Storybook module with the source. -``` -yarn start -``` +Run `yarn start` to start. -This starts an express server on port `1337`. - -To view the stories in the storybook UI: - -``` -cd ../official-storybook -yarn storybook --preview-url=http://localhost:1337/storybook.html -``` - -This runs the Storybook dev server, but instead of showing `official-storybook`'s stories, it attaches to the server, lists its stories in the navigation, and shows its stories in the preview iframe. +This starts an ExpressJS server on port `1337` and Storybook on port `9006`. diff --git a/examples/server-kitchen-sink/client/.eslintrc b/examples/server-kitchen-sink/client/.eslintrc deleted file mode 100644 index 1fddb2b7b9fe..000000000000 --- a/examples/server-kitchen-sink/client/.eslintrc +++ /dev/null @@ -1,8 +0,0 @@ -{ - "env": { - "browser": true - }, - "globals": { - "fetch": true - } -} \ No newline at end of file diff --git a/examples/server-kitchen-sink/client/stories/addon-a11y.stories.js b/examples/server-kitchen-sink/client/stories/addon-a11y.stories.js deleted file mode 100644 index 7af944630975..000000000000 --- a/examples/server-kitchen-sink/client/stories/addon-a11y.stories.js +++ /dev/null @@ -1,37 +0,0 @@ -import { withA11y } from '@storybook/addon-a11y'; - -export default { - title: 'Addons/a11y', - decorators: [withA11y], - parameters: { - options: { selectedPanel: 'storybook/a11y/panel' }, - }, -}; - -export const Default = () => {}; -Default.story = { - parameters: { - server: { id: 'addons/a11y/default' }, - }, -}; -export const Label = () => {}; -Label.story = { - parameters: { - server: { id: 'addons/a11y/label' }, - }, -}; - -export const Disabled = () => {}; -Disabled.story = { - parameters: { - server: { id: 'addons/a11y/disabled' }, - }, -}; - -export const Contrast = () => {}; -Contrast.story = { - name: 'Invalid contrast', - parameters: { - server: { id: 'addons/a11y/contrast' }, - }, -}; diff --git a/examples/server-kitchen-sink/client/stories/addon-actions.stories.js b/examples/server-kitchen-sink/client/stories/addon-actions.stories.js deleted file mode 100644 index e025b9c584d4..000000000000 --- a/examples/server-kitchen-sink/client/stories/addon-actions.stories.js +++ /dev/null @@ -1,80 +0,0 @@ -import { withActions, decorate } from '@storybook/addon-actions'; - -const pickTarget = decorate([args => [args[0].target]]); - -const button = () => {}; - -export default { - title: 'Addons/Actions', -}; - -export const Story1 = () => withActions('click')(button); -Story1.story = { - name: 'Hello World', - parameters: { - server: { id: 'addons/actions/story1' }, - }, -}; -export const Story2 = () => withActions('click', 'contextmenu')(button); -Story2.story = { - name: 'Multiple actions', - parameters: { - server: { id: 'addons/actions/story2' }, - }, -}; - -export const Story3 = () => - withActions('click', 'contextmenu', { clearOnStoryChange: false })(button); -Story3.story = { - name: 'Multiple actions + config', - parameters: { - server: { id: 'addons/actions/story3' }, - }, -}; - -export const Story4 = () => withActions({ click: 'clicked', contextmenu: 'right clicked' })(button); -Story4.story = { - name: 'Multiple actions, object', - parameters: { - server: { id: 'addons/actions/story4' }, - }, -}; - -export const Story5 = () => - withActions({ 'click .btn': 'clicked', contextmenu: 'right clicked' })(button); - -Story5.story = { - name: 'Multiple actions, selector', - parameters: { - server: { id: 'addons/actions/story5' }, - }, -}; - -export const Story6 = () => - withActions( - { click: 'clicked', contextmenu: 'right clicked' }, - { clearOnStoryChange: false } - )(button); -Story6.story = { - name: 'Multiple actions, object + config', - parameters: { - server: { id: 'addons/actions/story6' }, - }, -}; - -export const Story7 = () => pickTarget.withActions('click', 'contextmenu')(button); -Story7.story = { - name: 'Decorated actions', - parameters: { - server: { id: 'addons/actions/story7' }, - }, -}; - -export const Story8 = () => - pickTarget.withActions('click', 'contextmenu', { clearOnStoryChange: false })(button); -Story8.story = { - name: 'Decorated actions + config', - parameters: { - server: { id: 'addons/actions/story8' }, - }, -}; diff --git a/examples/server-kitchen-sink/client/stories/addon-backgrounds.stories.js b/examples/server-kitchen-sink/client/stories/addon-backgrounds.stories.js deleted file mode 100644 index a8a57aaa8355..000000000000 --- a/examples/server-kitchen-sink/client/stories/addon-backgrounds.stories.js +++ /dev/null @@ -1,25 +0,0 @@ -export default { - title: 'Addons/Backgrounds', - parameters: { - backgrounds: [ - { name: 'light', value: '#eeeeee' }, - { name: 'dark', value: '#222222', default: true }, - ], - }, -}; - -export const Story1 = () => {}; -Story1.story = { - name: 'story 1', - parameters: { - server: { id: 'addons/backgrounds/story1' }, - }, -}; - -export const Story2 = () => {}; -Story2.story = { - name: 'story 2', - parameters: { - server: { id: 'addons/backgrounds/story2' }, - }, -}; diff --git a/examples/server-kitchen-sink/client/stories/addon-knobs.stories.js b/examples/server-kitchen-sink/client/stories/addon-knobs.stories.js deleted file mode 100644 index ca2483f8f791..000000000000 --- a/examples/server-kitchen-sink/client/stories/addon-knobs.stories.js +++ /dev/null @@ -1,96 +0,0 @@ -import { - array, - boolean, - color, - date, - select, - withKnobs, - text, - number, -} from '@storybook/addon-knobs'; - -export default { - title: 'Addons/Knobs', - decorators: [withKnobs], -}; - -export const Simple = () => { - const name = text('Name', 'John Doe'); - const age = number('Age', 44); - const content = `I am ${name} and I'm ${age} years old.`; - return { content }; -}; -Simple.story = { - parameters: { - server: { id: 'addons/knobs/simple' }, - }, -}; - -export const Story3 = () => { - const name = text('Name', 'John Doe'); - const textColor = color('Text color', 'orangered'); - return { name, textColor }; -}; -Story3.story = { - name: 'CSS transitions', - parameters: { - server: { id: 'addons/knobs/story3' }, - }, -}; - -export const Story4 = () => { - const name = text('Name', 'Jane'); - const stock = number('Stock', 20, { - range: true, - min: 0, - max: 30, - step: 5, - }); - const fruits = { - Apple: 'apples', - Banana: 'bananas', - Cherry: 'cherries', - }; - const fruit = select('Fruit', fruits, 'apples'); - const price = number('Price', 2.25); - const colour = color('Border', 'deeppink'); - const today = date('Today', new Date('Jan 20 2017 GMT+0')); - const items = array('Items', ['Laptop', 'Book', 'Whiskey']); - const nice = boolean('Nice', true); - - const stockMessage = stock - ? `I have a stock of ${stock} ${fruit}, costing $${price} each.` - : `I'm out of ${fruit}${nice ? ', Sorry!' : '.'}`; - - const salutation = nice ? 'Nice to meet you!' : 'Leave me alone!'; - const dateOptions = { year: 'numeric', month: 'long', day: 'numeric', timeZone: 'UTC' }; - - const style = `border: 2px dotted ${colour}; padding: 8px 22px; border-radius: 8px`; - - return { - style, - name, - today, - dateOptions: JSON.stringify(dateOptions), - stockMessage, - items: JSON.stringify(items), - salutation, - }; -}; -Story4.story = { - name: 'All knobs', - parameters: { - server: { id: 'addons/knobs/story4' }, - }, -}; - -export const Story5 = () => { - const content = text('Rendered string', ''); - return { content }; -}; -Story5.story = { - name: 'XSS safety', - parameters: { - server: { id: 'addons/knobs/story5' }, - }, -}; diff --git a/examples/server-kitchen-sink/client/stories/addon-notes.stories.js b/examples/server-kitchen-sink/client/stories/addon-notes.stories.js deleted file mode 100644 index 257c94248699..000000000000 --- a/examples/server-kitchen-sink/client/stories/addon-notes.stories.js +++ /dev/null @@ -1,12 +0,0 @@ -export default { - title: 'Addons/Notes', -}; - -export const Story1 = () => {}; -Story1.story = { - name: 'Simple note', - parameters: { - notes: 'My notes on some bold text', - server: { id: 'addons/notes/story1' }, - }, -}; diff --git a/examples/server-kitchen-sink/client/stories/demo.stories.js b/examples/server-kitchen-sink/client/stories/demo.stories.js deleted file mode 100644 index bec7e5accfb5..000000000000 --- a/examples/server-kitchen-sink/client/stories/demo.stories.js +++ /dev/null @@ -1,24 +0,0 @@ -export default { - title: 'Demo', -}; - -export const Heading = () => {}; -Heading.story = { - parameters: { - server: { id: 'demo/heading' }, - }, -}; - -export const Headings = () => {}; -Headings.story = { - parameters: { - server: { id: 'demo/headings' }, - }, -}; - -export const Button = () => {}; -Button.story = { - parameters: { - server: { id: 'demo/button' }, - }, -}; diff --git a/examples/server-kitchen-sink/client/stories/index.js b/examples/server-kitchen-sink/client/stories/index.js deleted file mode 100644 index 3cd911cd24d2..000000000000 --- a/examples/server-kitchen-sink/client/stories/index.js +++ /dev/null @@ -1,19 +0,0 @@ -import * as a11yStories from './addon-a11y.stories'; -import * as actionsStories from './addon-actions.stories'; -import * as backgroundStories from './addon-backgrounds.stories'; -import * as knobsStories from './addon-knobs.stories'; -import * as notesStories from './addon-notes.stories'; -import * as welcomeStories from './welcome.stories'; -import * as paramsStories from './params.stories'; -import * as demoStories from './demo.stories'; - -export default [ - a11yStories, - actionsStories, - backgroundStories, - knobsStories, - notesStories, - welcomeStories, - paramsStories, - demoStories, -]; diff --git a/examples/server-kitchen-sink/client/stories/params.stories.js b/examples/server-kitchen-sink/client/stories/params.stories.js deleted file mode 100644 index 9d5bc9d8908b..000000000000 --- a/examples/server-kitchen-sink/client/stories/params.stories.js +++ /dev/null @@ -1,41 +0,0 @@ -export default { - title: 'Params', - parameters: { - componentSubtitle: 'Handy status label', - server: { - params: { color: 'red' }, - }, - }, -}; - -export const Story = () => {}; -Story.story = { - parameters: { - server: { - id: 'params/story', - params: { message: 'Hello World' }, - }, - }, -}; - -export const Override = () => {}; -Override.story = { - parameters: { - docs: { component: 'hi there docs' }, - server: { - id: 'params/override', - params: { message: 'Hello World', color: 'green' }, - }, - }, -}; -export const StoryFnOverride = () => { - return { message: 'Hi World!', color: 'blue' }; -}; -StoryFnOverride.story = { - parameters: { - server: { - id: 'params/story_fn_override', - params: { message: 'Hello World', color: 'green' }, - }, - }, -}; diff --git a/examples/server-kitchen-sink/client/stories/welcome.stories.js b/examples/server-kitchen-sink/client/stories/welcome.stories.js deleted file mode 100644 index 35636669975c..000000000000 --- a/examples/server-kitchen-sink/client/stories/welcome.stories.js +++ /dev/null @@ -1,13 +0,0 @@ -import { withLinks } from '@storybook/addon-links'; - -export default { - title: 'Welcome', - decorators: [withLinks], -}; - -export const Welcome = () => {}; -Welcome.story = { - parameters: { - server: { id: 'welcome/welcome' }, - }, -}; diff --git a/examples/server-kitchen-sink/client/storybook.html b/examples/server-kitchen-sink/client/storybook.html deleted file mode 100644 index 2f4b6420e05f..000000000000 --- a/examples/server-kitchen-sink/client/storybook.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - -
-
- -
-
-
-
- - diff --git a/examples/server-kitchen-sink/client/storybook.js b/examples/server-kitchen-sink/client/storybook.js deleted file mode 100644 index 9d1adf3d8805..000000000000 --- a/examples/server-kitchen-sink/client/storybook.js +++ /dev/null @@ -1,15 +0,0 @@ -import { configure, addParameters } from '@storybook/server'; -import { DocsPage, DocsContainer } from '@storybook/addon-docs/blocks'; - -import stories from './stories'; - -const port = process.env.PORT || 1337; - -addParameters({ - server: { url: `http://localhost:${port}/storybook_preview` }, - docs: { page: DocsPage, container: DocsContainer }, -}); - -console.log('stories', stories); - -configure(() => stories, module); diff --git a/examples/server-kitchen-sink/package.json b/examples/server-kitchen-sink/package.json index bbecc209adc8..6114d606bf74 100644 --- a/examples/server-kitchen-sink/package.json +++ b/examples/server-kitchen-sink/package.json @@ -2,34 +2,33 @@ "name": "server-kitchen-sink", "version": "5.3.0-rc.6", "private": true, + "description": "", + "keywords": [], + "license": "MIT", + "author": "", + "main": "index.js", "scripts": { - "start": "PORT=1337 nodemon server/app.js" + "build-storybook": "build-storybook", + "server": "PORT=1337 nodemon server.js", + "start": "concurrently \"yarn server\" \"yarn storybook\"", + "storybook": "SERVER_PORT=1137 start-storybook -p 9006 --quiet" }, "devDependencies": { - "@babel/core": "^7.7.7", - "@babel/node": "^7.7.7", - "@babel/preset-env": "^7.7.7", - "@babel/preset-react": "^7.7.4", "@storybook/addon-a11y": "5.3.0-rc.6", "@storybook/addon-actions": "5.3.0-rc.6", "@storybook/addon-backgrounds": "5.3.0-rc.6", "@storybook/addon-centered": "5.3.0-rc.6", - "@storybook/addon-docs": "5.3.0-rc.6", "@storybook/addon-knobs": "5.3.0-rc.6", "@storybook/addon-links": "5.3.0-rc.6", "@storybook/addon-notes": "5.3.0-rc.6", - "@storybook/csf": "0.0.1", + "@storybook/node-logger": "5.3.0-rc.6", "@storybook/server": "5.3.0-rc.6", - "babel-loader": "^8.0.6", + "concurrently": "^5.0.2", "cors": "^2.8.5", "express": "~4.16.4", - "html-webpack-plugin": "^3.2.0", "morgan": "^1.9.1", "nodemon": "^2.0.2", "pug": "^2.0.4", - "react": "^16.12.0", - "webpack": "^4.33.0", - "webpack-dev-middleware": "^3.7.2", - "webpack-hot-middleware": "^2.25.0" + "safe-identifier": "^0.3.1" } } diff --git a/examples/server-kitchen-sink2/server.js b/examples/server-kitchen-sink/server.js similarity index 100% rename from examples/server-kitchen-sink2/server.js rename to examples/server-kitchen-sink/server.js diff --git a/examples/server-kitchen-sink/server/app.js b/examples/server-kitchen-sink/server/app.js deleted file mode 100644 index 88376dd6446e..000000000000 --- a/examples/server-kitchen-sink/server/app.js +++ /dev/null @@ -1,32 +0,0 @@ -const express = require('express'); -const cors = require('cors'); -const morgan = require('morgan'); -const path = require('path'); -const webpack = require('webpack'); -const webpackMiddleware = require('webpack-dev-middleware'); -const webpackHotMiddleware = require('webpack-hot-middleware'); - -const webpackConfig = require('../webpack.config.js'); - -const port = process.env.PORT || 8080; - -const app = express(); -app.use(cors()); -app.use(morgan('dev')); -app.set('views', path.join(__dirname, 'views')); -app.set('view engine', 'pug'); - -app.get('/', (req, res) => res.send('Hello World!')); - -app.get(/storybook_preview\/(.*)/, (req, res) => { - res.render(req.params[0], req.query); -}); - -app.use(webpackMiddleware(webpack(webpackConfig))); -app.use(webpackHotMiddleware(webpack(webpackConfig))); - -app.get('*', (req, res) => { - res.sendFile(path.join(__dirname, '../client/storybook.html')); -}); - -app.listen(port); diff --git a/examples/server-kitchen-sink/server/views/addons/knobs/simple.pug b/examples/server-kitchen-sink/server/views/addons/knobs/simple.pug deleted file mode 100644 index bc2061c0a0b5..000000000000 --- a/examples/server-kitchen-sink/server/views/addons/knobs/simple.pug +++ /dev/null @@ -1 +0,0 @@ -div= content \ No newline at end of file diff --git a/examples/server-kitchen-sink/server/views/addons/knobs/story3.pug b/examples/server-kitchen-sink/server/views/addons/knobs/story3.pug deleted file mode 100644 index ec8996a53780..000000000000 --- a/examples/server-kitchen-sink/server/views/addons/knobs/story3.pug +++ /dev/null @@ -1 +0,0 @@ -p(style=`transition: color 0.5s ease-out; color: ${textColor}`)= name \ No newline at end of file diff --git a/examples/server-kitchen-sink/server/views/addons/knobs/story4.pug b/examples/server-kitchen-sink/server/views/addons/knobs/story4.pug deleted file mode 100644 index 73b54dd3e7cd..000000000000 --- a/examples/server-kitchen-sink/server/views/addons/knobs/story4.pug +++ /dev/null @@ -1,13 +0,0 @@ -- today = new Date(parseInt(today, 10)); -- dateOptions = JSON.parse(dateOptions); -- items = JSON.parse(items); - -div(style='#{style}') - h1 My name is #{name}, - h3 today is #{today.toLocaleDateString('en-US', dateOptions)} - p !{stockMessage} - p Also, I have: - ul - each item in items - li= item - p #{salutation} \ No newline at end of file diff --git a/examples/server-kitchen-sink/server/views/addons/knobs/story5.pug b/examples/server-kitchen-sink/server/views/addons/knobs/story5.pug deleted file mode 100644 index 6e0f1c5d2d33..000000000000 --- a/examples/server-kitchen-sink/server/views/addons/knobs/story5.pug +++ /dev/null @@ -1 +0,0 @@ - !{content} \ No newline at end of file diff --git a/examples/server-kitchen-sink/server/views/welcome/welcome.pug b/examples/server-kitchen-sink/server/views/welcome/welcome.pug deleted file mode 100644 index 8c4c4701261a..000000000000 --- a/examples/server-kitchen-sink/server/views/welcome/welcome.pug +++ /dev/null @@ -1,36 +0,0 @@ -.main - h1 Welcome to Storybook for Server - p This is a UI component dev environment for your plain HTML snippets. - p. - We've added some basic stories inside the #[code.code stories] directory. - #[br] - A story is a single state of one or more UI components. You can have as many stories as you want. - #[br] - (Basically a story is like a visual test case.) - p. - See these sample #[a.link(href='#' data-sb-kind='Demo Card' data-sb-story='Front') stories] - p. - Just like that, you can add your own snippets as stories. - #[br] - You can also edit those snippets and see changes right away. - #[br] - p. - Usually we create stories with smaller UI components in the app. - #[br] - Have a look at the #[a.link(href='https://storybook.js.org/basics/writing-stories' target='_blank') Writing Stories] section in our documentation. -style. - .main { - padding: 15px; - line-height: 1.4; - font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; - background-color: #ffffff; - } - .code { - font-size: 15px; - font-weight: 600; - padding: 2px 5px; - border: 1px solid #eae9e9; - border-radius: 4px; - background-color: #f3f2f2; - color: #3a3a3a; - } \ No newline at end of file diff --git a/examples/server-kitchen-sink2/stories/addon-a11y.stories.json b/examples/server-kitchen-sink/stories/addon-a11y.stories.json similarity index 100% rename from examples/server-kitchen-sink2/stories/addon-a11y.stories.json rename to examples/server-kitchen-sink/stories/addon-a11y.stories.json diff --git a/examples/server-kitchen-sink2/stories/addon-actions.stories.json b/examples/server-kitchen-sink/stories/addon-actions.stories.json similarity index 100% rename from examples/server-kitchen-sink2/stories/addon-actions.stories.json rename to examples/server-kitchen-sink/stories/addon-actions.stories.json diff --git a/examples/server-kitchen-sink2/stories/addon-backgrounds.stories.json b/examples/server-kitchen-sink/stories/addon-backgrounds.stories.json similarity index 100% rename from examples/server-kitchen-sink2/stories/addon-backgrounds.stories.json rename to examples/server-kitchen-sink/stories/addon-backgrounds.stories.json diff --git a/examples/server-kitchen-sink2/stories/addon-knobs.stories.json b/examples/server-kitchen-sink/stories/addon-knobs.stories.json similarity index 100% rename from examples/server-kitchen-sink2/stories/addon-knobs.stories.json rename to examples/server-kitchen-sink/stories/addon-knobs.stories.json diff --git a/examples/server-kitchen-sink2/stories/addon-notes.stories.json b/examples/server-kitchen-sink/stories/addon-notes.stories.json similarity index 100% rename from examples/server-kitchen-sink2/stories/addon-notes.stories.json rename to examples/server-kitchen-sink/stories/addon-notes.stories.json diff --git a/examples/server-kitchen-sink2/stories/demo.stories.json b/examples/server-kitchen-sink/stories/demo.stories.json similarity index 100% rename from examples/server-kitchen-sink2/stories/demo.stories.json rename to examples/server-kitchen-sink/stories/demo.stories.json diff --git a/examples/server-kitchen-sink2/stories/kitchen_sink.stories.json b/examples/server-kitchen-sink/stories/kitchen_sink.stories.json similarity index 100% rename from examples/server-kitchen-sink2/stories/kitchen_sink.stories.json rename to examples/server-kitchen-sink/stories/kitchen_sink.stories.json diff --git a/examples/server-kitchen-sink2/stories/params.stories.json b/examples/server-kitchen-sink/stories/params.stories.json similarity index 100% rename from examples/server-kitchen-sink2/stories/params.stories.json rename to examples/server-kitchen-sink/stories/params.stories.json diff --git a/examples/server-kitchen-sink2/stories/welcome.stories.json b/examples/server-kitchen-sink/stories/welcome.stories.json similarity index 100% rename from examples/server-kitchen-sink2/stories/welcome.stories.json rename to examples/server-kitchen-sink/stories/welcome.stories.json diff --git a/examples/server-kitchen-sink/server/views/addons/a11y/contrast.pug b/examples/server-kitchen-sink/views/addons/a11y/contrast.pug similarity index 100% rename from examples/server-kitchen-sink/server/views/addons/a11y/contrast.pug rename to examples/server-kitchen-sink/views/addons/a11y/contrast.pug diff --git a/examples/server-kitchen-sink/server/views/addons/a11y/default.pug b/examples/server-kitchen-sink/views/addons/a11y/default.pug similarity index 100% rename from examples/server-kitchen-sink/server/views/addons/a11y/default.pug rename to examples/server-kitchen-sink/views/addons/a11y/default.pug diff --git a/examples/server-kitchen-sink/server/views/addons/a11y/disabled.pug b/examples/server-kitchen-sink/views/addons/a11y/disabled.pug similarity index 100% rename from examples/server-kitchen-sink/server/views/addons/a11y/disabled.pug rename to examples/server-kitchen-sink/views/addons/a11y/disabled.pug diff --git a/examples/server-kitchen-sink/server/views/addons/a11y/label.pug b/examples/server-kitchen-sink/views/addons/a11y/label.pug similarity index 100% rename from examples/server-kitchen-sink/server/views/addons/a11y/label.pug rename to examples/server-kitchen-sink/views/addons/a11y/label.pug diff --git a/examples/server-kitchen-sink/server/views/addons/actions/button.pug b/examples/server-kitchen-sink/views/addons/actions/button.pug similarity index 100% rename from examples/server-kitchen-sink/server/views/addons/actions/button.pug rename to examples/server-kitchen-sink/views/addons/actions/button.pug diff --git a/examples/server-kitchen-sink/server/views/addons/actions/story1.pug b/examples/server-kitchen-sink/views/addons/actions/story1.pug similarity index 100% rename from examples/server-kitchen-sink/server/views/addons/actions/story1.pug rename to examples/server-kitchen-sink/views/addons/actions/story1.pug diff --git a/examples/server-kitchen-sink/server/views/addons/actions/story2.pug b/examples/server-kitchen-sink/views/addons/actions/story2.pug similarity index 100% rename from examples/server-kitchen-sink/server/views/addons/actions/story2.pug rename to examples/server-kitchen-sink/views/addons/actions/story2.pug diff --git a/examples/server-kitchen-sink/server/views/addons/actions/story3.pug b/examples/server-kitchen-sink/views/addons/actions/story3.pug similarity index 100% rename from examples/server-kitchen-sink/server/views/addons/actions/story3.pug rename to examples/server-kitchen-sink/views/addons/actions/story3.pug diff --git a/examples/server-kitchen-sink/server/views/addons/actions/story4.pug b/examples/server-kitchen-sink/views/addons/actions/story4.pug similarity index 100% rename from examples/server-kitchen-sink/server/views/addons/actions/story4.pug rename to examples/server-kitchen-sink/views/addons/actions/story4.pug diff --git a/examples/server-kitchen-sink/server/views/addons/actions/story5.pug b/examples/server-kitchen-sink/views/addons/actions/story5.pug similarity index 100% rename from examples/server-kitchen-sink/server/views/addons/actions/story5.pug rename to examples/server-kitchen-sink/views/addons/actions/story5.pug diff --git a/examples/server-kitchen-sink/server/views/addons/actions/story6.pug b/examples/server-kitchen-sink/views/addons/actions/story6.pug similarity index 100% rename from examples/server-kitchen-sink/server/views/addons/actions/story6.pug rename to examples/server-kitchen-sink/views/addons/actions/story6.pug diff --git a/examples/server-kitchen-sink/server/views/addons/actions/story7.pug b/examples/server-kitchen-sink/views/addons/actions/story7.pug similarity index 100% rename from examples/server-kitchen-sink/server/views/addons/actions/story7.pug rename to examples/server-kitchen-sink/views/addons/actions/story7.pug diff --git a/examples/server-kitchen-sink/server/views/addons/actions/story8.pug b/examples/server-kitchen-sink/views/addons/actions/story8.pug similarity index 100% rename from examples/server-kitchen-sink/server/views/addons/actions/story8.pug rename to examples/server-kitchen-sink/views/addons/actions/story8.pug diff --git a/examples/server-kitchen-sink/server/views/addons/backgrounds/story1.pug b/examples/server-kitchen-sink/views/addons/backgrounds/story1.pug similarity index 100% rename from examples/server-kitchen-sink/server/views/addons/backgrounds/story1.pug rename to examples/server-kitchen-sink/views/addons/backgrounds/story1.pug diff --git a/examples/server-kitchen-sink/server/views/addons/backgrounds/story2.pug b/examples/server-kitchen-sink/views/addons/backgrounds/story2.pug similarity index 100% rename from examples/server-kitchen-sink/server/views/addons/backgrounds/story2.pug rename to examples/server-kitchen-sink/views/addons/backgrounds/story2.pug diff --git a/examples/server-kitchen-sink2/views/addons/knobs/all.pug b/examples/server-kitchen-sink/views/addons/knobs/all.pug similarity index 100% rename from examples/server-kitchen-sink2/views/addons/knobs/all.pug rename to examples/server-kitchen-sink/views/addons/knobs/all.pug diff --git a/examples/server-kitchen-sink2/views/addons/knobs/css.pug b/examples/server-kitchen-sink/views/addons/knobs/css.pug similarity index 100% rename from examples/server-kitchen-sink2/views/addons/knobs/css.pug rename to examples/server-kitchen-sink/views/addons/knobs/css.pug diff --git a/examples/server-kitchen-sink2/views/addons/knobs/simple.pug b/examples/server-kitchen-sink/views/addons/knobs/simple.pug similarity index 100% rename from examples/server-kitchen-sink2/views/addons/knobs/simple.pug rename to examples/server-kitchen-sink/views/addons/knobs/simple.pug diff --git a/examples/server-kitchen-sink2/views/addons/knobs/xss_safety.pug b/examples/server-kitchen-sink/views/addons/knobs/xss_safety.pug similarity index 100% rename from examples/server-kitchen-sink2/views/addons/knobs/xss_safety.pug rename to examples/server-kitchen-sink/views/addons/knobs/xss_safety.pug diff --git a/examples/server-kitchen-sink/server/views/addons/notes/story1.pug b/examples/server-kitchen-sink/views/addons/notes/story1.pug similarity index 100% rename from examples/server-kitchen-sink/server/views/addons/notes/story1.pug rename to examples/server-kitchen-sink/views/addons/notes/story1.pug diff --git a/examples/server-kitchen-sink/server/views/demo/button.pug b/examples/server-kitchen-sink/views/demo/button.pug similarity index 100% rename from examples/server-kitchen-sink/server/views/demo/button.pug rename to examples/server-kitchen-sink/views/demo/button.pug diff --git a/examples/server-kitchen-sink/server/views/demo/heading.pug b/examples/server-kitchen-sink/views/demo/heading.pug similarity index 100% rename from examples/server-kitchen-sink/server/views/demo/heading.pug rename to examples/server-kitchen-sink/views/demo/heading.pug diff --git a/examples/server-kitchen-sink/server/views/demo/headings.pug b/examples/server-kitchen-sink/views/demo/headings.pug similarity index 100% rename from examples/server-kitchen-sink/server/views/demo/headings.pug rename to examples/server-kitchen-sink/views/demo/headings.pug diff --git a/examples/server-kitchen-sink/server/views/params/override.pug b/examples/server-kitchen-sink/views/params/override.pug similarity index 100% rename from examples/server-kitchen-sink/server/views/params/override.pug rename to examples/server-kitchen-sink/views/params/override.pug diff --git a/examples/server-kitchen-sink/server/views/params/params.pug b/examples/server-kitchen-sink/views/params/params.pug similarity index 100% rename from examples/server-kitchen-sink/server/views/params/params.pug rename to examples/server-kitchen-sink/views/params/params.pug diff --git a/examples/server-kitchen-sink/server/views/params/story.pug b/examples/server-kitchen-sink/views/params/story.pug similarity index 100% rename from examples/server-kitchen-sink/server/views/params/story.pug rename to examples/server-kitchen-sink/views/params/story.pug diff --git a/examples/server-kitchen-sink/server/views/params/story_fn_override.pug b/examples/server-kitchen-sink/views/params/story_fn_override.pug similarity index 100% rename from examples/server-kitchen-sink/server/views/params/story_fn_override.pug rename to examples/server-kitchen-sink/views/params/story_fn_override.pug diff --git a/examples/server-kitchen-sink2/views/welcome/welcome.pug b/examples/server-kitchen-sink/views/welcome/welcome.pug similarity index 100% rename from examples/server-kitchen-sink2/views/welcome/welcome.pug rename to examples/server-kitchen-sink/views/welcome/welcome.pug diff --git a/examples/server-kitchen-sink/webpack.config.js b/examples/server-kitchen-sink/webpack.config.js deleted file mode 100644 index d87cce4f8d48..000000000000 --- a/examples/server-kitchen-sink/webpack.config.js +++ /dev/null @@ -1,29 +0,0 @@ -const path = require('path'); -const HtmlWebpackPlugin = require('html-webpack-plugin'); - -module.exports = { - entry: './client/storybook.js', - output: { - path: path.join(__dirname, 'build'), - publicPath: '/', - filename: 'storybook.js', - }, - devtool: '#source-map', - module: { - rules: [ - { - test: /\.(js|jsx)$/, - exclude: /node_modules/, - use: { - loader: 'babel-loader', - }, - }, - ], - }, - plugins: [ - new HtmlWebpackPlugin({ - template: path.join(__dirname, 'client/storybook.html'), - fileName: path.join(__dirname, 'build/storybook.html'), - }), - ], -}; diff --git a/examples/server-kitchen-sink2/README.md b/examples/server-kitchen-sink2/README.md deleted file mode 100644 index 7f9cddd5ecd9..000000000000 --- a/examples/server-kitchen-sink2/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Server Kitchen Sink - -This is a demo app to test a standalone server using integration with Storybook using `@storybook/server`. - -Run `yarn install` to sync Storybook module with the source. - -Run `yarn start` to start. - -This starts an ExpressJS server on port `1337` and Storybook on port `9006`. diff --git a/examples/server-kitchen-sink2/package.json b/examples/server-kitchen-sink2/package.json deleted file mode 100644 index 0d91f07a5c7c..000000000000 --- a/examples/server-kitchen-sink2/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "server-kitchen-sink2", - "version": "5.3.0-rc.6", - "private": true, - "description": "", - "keywords": [], - "license": "MIT", - "author": "", - "main": "index.js", - "scripts": { - "build-storybook": "build-storybook", - "server": "PORT=1337 nodemon server.js", - "start": "concurrently \"yarn server\" \"yarn storybook\"", - "storybook": "SERVER_PORT=1137 start-storybook -p 9006 --quiet" - }, - "devDependencies": { - "@storybook/addon-a11y": "5.3.0-rc.6", - "@storybook/addon-actions": "5.3.0-rc.6", - "@storybook/addon-backgrounds": "5.3.0-rc.6", - "@storybook/addon-centered": "5.3.0-rc.6", - "@storybook/addon-knobs": "5.3.0-rc.6", - "@storybook/addon-links": "5.3.0-rc.6", - "@storybook/addon-notes": "5.3.0-rc.6", - "@storybook/node-logger": "5.3.0-rc.6", - "@storybook/server": "5.3.0-rc.6", - "concurrently": "^5.0.2", - "cors": "^2.8.5", - "express": "~4.16.4", - "morgan": "^1.9.1", - "nodemon": "^2.0.2", - "pug": "^2.0.4", - "safe-identifier": "^0.3.1" - } -} diff --git a/examples/server-kitchen-sink2/views/addons/a11y/contrast.pug b/examples/server-kitchen-sink2/views/addons/a11y/contrast.pug deleted file mode 100644 index 4b217011d3a1..000000000000 --- a/examples/server-kitchen-sink2/views/addons/a11y/contrast.pug +++ /dev/null @@ -1 +0,0 @@ -button(style='color: black; background-color: brown;') Testing the a11y addon \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/a11y/default.pug b/examples/server-kitchen-sink2/views/addons/a11y/default.pug deleted file mode 100644 index 0900630d219d..000000000000 --- a/examples/server-kitchen-sink2/views/addons/a11y/default.pug +++ /dev/null @@ -1 +0,0 @@ -button \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/a11y/disabled.pug b/examples/server-kitchen-sink2/views/addons/a11y/disabled.pug deleted file mode 100644 index 2b3652f5ecc7..000000000000 --- a/examples/server-kitchen-sink2/views/addons/a11y/disabled.pug +++ /dev/null @@ -1 +0,0 @@ -button(disabled) Testing the a11y addon \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/a11y/label.pug b/examples/server-kitchen-sink2/views/addons/a11y/label.pug deleted file mode 100644 index 901f438d64a5..000000000000 --- a/examples/server-kitchen-sink2/views/addons/a11y/label.pug +++ /dev/null @@ -1 +0,0 @@ -button Testing the a11y addon \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/actions/button.pug b/examples/server-kitchen-sink2/views/addons/actions/button.pug deleted file mode 100644 index e612bbfb36f1..000000000000 --- a/examples/server-kitchen-sink2/views/addons/actions/button.pug +++ /dev/null @@ -1 +0,0 @@ -button(type="button") Hello World \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/actions/story1.pug b/examples/server-kitchen-sink2/views/addons/actions/story1.pug deleted file mode 100644 index 7894bcc0743b..000000000000 --- a/examples/server-kitchen-sink2/views/addons/actions/story1.pug +++ /dev/null @@ -1 +0,0 @@ -include button.pug \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/actions/story2.pug b/examples/server-kitchen-sink2/views/addons/actions/story2.pug deleted file mode 100644 index 7894bcc0743b..000000000000 --- a/examples/server-kitchen-sink2/views/addons/actions/story2.pug +++ /dev/null @@ -1 +0,0 @@ -include button.pug \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/actions/story3.pug b/examples/server-kitchen-sink2/views/addons/actions/story3.pug deleted file mode 100644 index 7894bcc0743b..000000000000 --- a/examples/server-kitchen-sink2/views/addons/actions/story3.pug +++ /dev/null @@ -1 +0,0 @@ -include button.pug \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/actions/story4.pug b/examples/server-kitchen-sink2/views/addons/actions/story4.pug deleted file mode 100644 index 7894bcc0743b..000000000000 --- a/examples/server-kitchen-sink2/views/addons/actions/story4.pug +++ /dev/null @@ -1 +0,0 @@ -include button.pug \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/actions/story5.pug b/examples/server-kitchen-sink2/views/addons/actions/story5.pug deleted file mode 100644 index 557c20da0e89..000000000000 --- a/examples/server-kitchen-sink2/views/addons/actions/story5.pug +++ /dev/null @@ -1,3 +0,0 @@ -div - | Clicks on this button will be logged: - button(class="btn" type="button") Button \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/actions/story6.pug b/examples/server-kitchen-sink2/views/addons/actions/story6.pug deleted file mode 100644 index 7894bcc0743b..000000000000 --- a/examples/server-kitchen-sink2/views/addons/actions/story6.pug +++ /dev/null @@ -1 +0,0 @@ -include button.pug \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/actions/story7.pug b/examples/server-kitchen-sink2/views/addons/actions/story7.pug deleted file mode 100644 index 7894bcc0743b..000000000000 --- a/examples/server-kitchen-sink2/views/addons/actions/story7.pug +++ /dev/null @@ -1 +0,0 @@ -include button.pug \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/actions/story8.pug b/examples/server-kitchen-sink2/views/addons/actions/story8.pug deleted file mode 100644 index 7894bcc0743b..000000000000 --- a/examples/server-kitchen-sink2/views/addons/actions/story8.pug +++ /dev/null @@ -1 +0,0 @@ -include button.pug \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/backgrounds/story1.pug b/examples/server-kitchen-sink2/views/addons/backgrounds/story1.pug deleted file mode 100644 index 7d62c85d7cdf..000000000000 --- a/examples/server-kitchen-sink2/views/addons/backgrounds/story1.pug +++ /dev/null @@ -1 +0,0 @@ -span(style="color: white") You should be able to switch backgrounds for this story \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/backgrounds/story2.pug b/examples/server-kitchen-sink2/views/addons/backgrounds/story2.pug deleted file mode 100644 index 82abc4ee834a..000000000000 --- a/examples/server-kitchen-sink2/views/addons/backgrounds/story2.pug +++ /dev/null @@ -1 +0,0 @@ -span(style="color: white") This one too! \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/addons/notes/story1.pug b/examples/server-kitchen-sink2/views/addons/notes/story1.pug deleted file mode 100644 index dee88febdf62..000000000000 --- a/examples/server-kitchen-sink2/views/addons/notes/story1.pug +++ /dev/null @@ -1,2 +0,0 @@ -p - strong This is a fragment of HTML diff --git a/examples/server-kitchen-sink2/views/demo/button.pug b/examples/server-kitchen-sink2/views/demo/button.pug deleted file mode 100644 index 69e440c555c6..000000000000 --- a/examples/server-kitchen-sink2/views/demo/button.pug +++ /dev/null @@ -1 +0,0 @@ -button Hello Button \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/demo/heading.pug b/examples/server-kitchen-sink2/views/demo/heading.pug deleted file mode 100644 index 23b68dd8f3e9..000000000000 --- a/examples/server-kitchen-sink2/views/demo/heading.pug +++ /dev/null @@ -1 +0,0 @@ -h1 Hello World \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/demo/headings.pug b/examples/server-kitchen-sink2/views/demo/headings.pug deleted file mode 100644 index 23a6d7f78ab6..000000000000 --- a/examples/server-kitchen-sink2/views/demo/headings.pug +++ /dev/null @@ -1,4 +0,0 @@ -h1 Hellow World -h2 Hellow World -h3 Hellow World -h4 Hellow World \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/params/override.pug b/examples/server-kitchen-sink2/views/params/override.pug deleted file mode 100644 index b60cffc6349b..000000000000 --- a/examples/server-kitchen-sink2/views/params/override.pug +++ /dev/null @@ -1 +0,0 @@ -include params.pug \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/params/params.pug b/examples/server-kitchen-sink2/views/params/params.pug deleted file mode 100644 index 5020bd41af24..000000000000 --- a/examples/server-kitchen-sink2/views/params/params.pug +++ /dev/null @@ -1 +0,0 @@ -h1(style=`color: ${color}`)= message \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/params/story.pug b/examples/server-kitchen-sink2/views/params/story.pug deleted file mode 100644 index b60cffc6349b..000000000000 --- a/examples/server-kitchen-sink2/views/params/story.pug +++ /dev/null @@ -1 +0,0 @@ -include params.pug \ No newline at end of file diff --git a/examples/server-kitchen-sink2/views/params/story_fn_override.pug b/examples/server-kitchen-sink2/views/params/story_fn_override.pug deleted file mode 100644 index b60cffc6349b..000000000000 --- a/examples/server-kitchen-sink2/views/params/story_fn_override.pug +++ /dev/null @@ -1 +0,0 @@ -include params.pug \ No newline at end of file From d61bbe50f5a3092770d158e147fa76d5e747ecdd Mon Sep 17 00:00:00 2001 From: Jon Palmer Date: Thu, 2 Jan 2020 13:03:54 -0500 Subject: [PATCH 20/25] rc.7 --- app/server/package.json | 6 +- examples/server-kitchen-sink/package.json | 20 +- yarn.lock | 275 +--------------------- 3 files changed, 17 insertions(+), 284 deletions(-) diff --git a/app/server/package.json b/app/server/package.json index 337dfba5e24d..d6fc37ce8f8c 100644 --- a/app/server/package.json +++ b/app/server/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/server", - "version": "5.3.0-rc.6", + "version": "5.3.0-rc.7", "description": "Storybook for Server: View HTML snippets from a server in isolation with Hot Reloading.", "keywords": [ "storybook" @@ -33,8 +33,8 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "5.3.0-rc.6", - "@storybook/core": "5.3.0-rc.6", + "@storybook/addons": "5.3.0-rc.7", + "@storybook/core": "5.3.0-rc.7", "@storybook/node-logger": "^5.2.8", "@types/webpack-env": "^1.13.9", "core-js": "^3.0.1", diff --git a/examples/server-kitchen-sink/package.json b/examples/server-kitchen-sink/package.json index 6114d606bf74..42bef000497b 100644 --- a/examples/server-kitchen-sink/package.json +++ b/examples/server-kitchen-sink/package.json @@ -1,6 +1,6 @@ { "name": "server-kitchen-sink", - "version": "5.3.0-rc.6", + "version": "5.3.0-rc.7", "private": true, "description": "", "keywords": [], @@ -14,15 +14,15 @@ "storybook": "SERVER_PORT=1137 start-storybook -p 9006 --quiet" }, "devDependencies": { - "@storybook/addon-a11y": "5.3.0-rc.6", - "@storybook/addon-actions": "5.3.0-rc.6", - "@storybook/addon-backgrounds": "5.3.0-rc.6", - "@storybook/addon-centered": "5.3.0-rc.6", - "@storybook/addon-knobs": "5.3.0-rc.6", - "@storybook/addon-links": "5.3.0-rc.6", - "@storybook/addon-notes": "5.3.0-rc.6", - "@storybook/node-logger": "5.3.0-rc.6", - "@storybook/server": "5.3.0-rc.6", + "@storybook/addon-a11y": "5.3.0-rc.7", + "@storybook/addon-actions": "5.3.0-rc.7", + "@storybook/addon-backgrounds": "5.3.0-rc.7", + "@storybook/addon-centered": "5.3.0-rc.7", + "@storybook/addon-knobs": "5.3.0-rc.7", + "@storybook/addon-links": "5.3.0-rc.7", + "@storybook/addon-notes": "5.3.0-rc.7", + "@storybook/node-logger": "5.3.0-rc.7", + "@storybook/server": "5.3.0-rc.7", "concurrently": "^5.0.2", "cors": "^2.8.5", "express": "~4.16.4", diff --git a/yarn.lock b/yarn.lock index 5d083257418d..645d669c37bc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -318,26 +318,6 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/core@^7.7.7": - version "7.7.7" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.7.7.tgz#ee155d2e12300bcc0cff6a8ad46f2af5063803e9" - integrity sha512-jlSjuj/7z138NLZALxVgrx13AOtqip42ATZP7+kYl53GvDV6+4dCek1mVUo8z8c8Xnw/mx2q3d9HWh3griuesQ== - dependencies: - "@babel/code-frame" "^7.5.5" - "@babel/generator" "^7.7.7" - "@babel/helpers" "^7.7.4" - "@babel/parser" "^7.7.7" - "@babel/template" "^7.7.4" - "@babel/traverse" "^7.7.4" - "@babel/types" "^7.7.4" - convert-source-map "^1.7.0" - debug "^4.1.0" - json5 "^2.1.0" - lodash "^4.17.13" - resolve "^1.3.2" - semver "^5.4.1" - source-map "^0.5.0" - "@babel/generator@^7.0.0", "@babel/generator@^7.4.0", "@babel/generator@^7.4.4", "@babel/generator@^7.5.5", "@babel/generator@^7.6.0", "@babel/generator@^7.6.2", "@babel/generator@^7.6.4", "@babel/generator@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.7.4.tgz#db651e2840ca9aa66f327dcec1dc5f5fa9611369" @@ -348,16 +328,6 @@ lodash "^4.17.13" source-map "^0.5.0" -"@babel/generator@^7.7.7": - version "7.7.7" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.7.7.tgz#859ac733c44c74148e1a72980a64ec84b85f4f45" - integrity sha512-/AOIBpHh/JU1l0ZFS4kiRCBnLi6OTHzh0RPk3h9isBxkkqELtQNFi1Vr/tiG9p1yfoUdKVwISuXWQR+hwwM4VQ== - dependencies: - "@babel/types" "^7.7.4" - jsesc "^2.5.1" - lodash "^4.17.13" - source-map "^0.5.0" - "@babel/helper-annotate-as-pure@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.7.4.tgz#bb3faf1e74b74bd547e867e48f551fa6b098b6ce" @@ -476,18 +446,6 @@ "@babel/types" "^7.7.4" lodash "^4.17.13" -"@babel/helper-module-transforms@^7.7.5": - version "7.7.5" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.7.5.tgz#d044da7ffd91ec967db25cd6748f704b6b244835" - integrity sha512-A7pSxyJf1gN5qXVcidwLWydjftUN878VkalhXX5iQDuGyiGK3sOrrKKHF4/A4fwHtnsotv/NipwAeLzY4KQPvw== - dependencies: - "@babel/helper-module-imports" "^7.7.4" - "@babel/helper-simple-access" "^7.7.4" - "@babel/helper-split-export-declaration" "^7.7.4" - "@babel/template" "^7.7.4" - "@babel/types" "^7.7.4" - lodash "^4.17.13" - "@babel/helper-optimise-call-expression@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.7.4.tgz#034af31370d2995242aa4df402c3b7794b2dcdf2" @@ -571,20 +529,6 @@ esutils "^2.0.2" js-tokens "^4.0.0" -"@babel/node@^7.7.7": - version "7.7.7" - resolved "https://registry.yarnpkg.com/@babel/node/-/node-7.7.7.tgz#10c488ca36da07670be0131679c4e22f9d7795d4" - integrity sha512-QWWbQ6AyDffz6mA2mF0jixb/3IyRlqWgz5JNa2F6kSYe4vhPEytwuGmanx0NQJxBufDjffm/jYPuIfKfAyVzuA== - dependencies: - "@babel/register" "^7.7.7" - commander "^2.8.1" - core-js "^3.2.1" - lodash "^4.17.13" - node-environment-flags "^1.0.5" - regenerator-runtime "^0.13.3" - resolve "^1.13.1" - v8flags "^3.1.1" - "@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.1.6", "@babel/parser@^7.2.3", "@babel/parser@^7.4.2", "@babel/parser@^7.4.3", "@babel/parser@^7.4.4", "@babel/parser@^7.5.5", "@babel/parser@^7.6.0", "@babel/parser@^7.6.2", "@babel/parser@^7.6.4", "@babel/parser@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.4.tgz#75ab2d7110c2cf2fa949959afb05fa346d2231bb" @@ -595,11 +539,6 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.5.tgz#cbf45321619ac12d83363fcf9c94bb67fa646d71" integrity sha512-KNlOe9+/nk4i29g0VXgl8PEXIRms5xKLJeuZ6UptN0fHv+jDiriG+y94X6qAgWTR0h3KaoM1wK5G5h7MHFRSig== -"@babel/parser@^7.7.7": - version "7.7.7" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.7.tgz#1b886595419cf92d811316d5b715a53ff38b4937" - integrity sha512-WtTZMZAZLbeymhkd/sEaPD8IQyGAhmuTuvTzLiCFM7iXiVdY0gc0IaI+cW0fh1BnSMbJSzXX6/fHllgHKwHhXw== - "@babel/plugin-external-helpers@^7.0.0": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-external-helpers/-/plugin-external-helpers-7.7.4.tgz#8aa7aa402f0e2ecb924611cbf30942a497dfd17e" @@ -748,14 +687,6 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-object-rest-spread" "^7.7.4" -"@babel/plugin-proposal-object-rest-spread@^7.7.7": - version "7.7.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.7.7.tgz#9f27075004ab99be08c5c1bd653a2985813cb370" - integrity sha512-3qp9I8lelgzNedI3hrhkvhaEYree6+WHnyA/q4Dza9z7iEIs1eyhWyJnetk3jJ69RT0AT4G0UhEGwyGFJ7GUuQ== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-object-rest-spread" "^7.7.4" - "@babel/plugin-proposal-optional-catch-binding@^7.0.0", "@babel/plugin-proposal-optional-catch-binding@^7.2.0", "@babel/plugin-proposal-optional-catch-binding@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.7.4.tgz#ec21e8aeb09ec6711bc0a39ca49520abee1de379" @@ -780,14 +711,6 @@ "@babel/helper-create-regexp-features-plugin" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-proposal-unicode-property-regex@^7.7.7": - version "7.7.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.7.7.tgz#433fa9dac64f953c12578b29633f456b68831c4e" - integrity sha512-80PbkKyORBUVm1fbTLrHpYdJxMThzM1UqFGh0ALEhO9TYbG86Ah9zQYAB/84axz2vcxefDLdZwWwZNlYARlu9w== - dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.7.4" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-async-generators@^7.2.0", "@babel/plugin-syntax-async-generators@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.7.4.tgz#331aaf310a10c80c44a66b238b6e49132bd3c889" @@ -1002,14 +925,6 @@ "@babel/helper-create-regexp-features-plugin" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-dotall-regex@^7.7.7": - version "7.7.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.7.7.tgz#3e9713f1b69f339e87fa796b097d73ded16b937b" - integrity sha512-b4in+YlTeE/QmTgrllnb3bHA0HntYvjz8O3Mcbx75UBPJA2xhb5A8nle498VhxSXJHQefjtQxpnLPehDJ4TRlg== - dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.7.4" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-transform-duplicate-keys@^7.2.0", "@babel/plugin-transform-duplicate-keys@^7.5.0", "@babel/plugin-transform-duplicate-keys@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.7.4.tgz#3d21731a42e3f598a73835299dd0169c3b90ac91" @@ -1079,15 +994,6 @@ "@babel/helper-plugin-utils" "^7.0.0" babel-plugin-dynamic-import-node "^2.3.0" -"@babel/plugin-transform-modules-amd@^7.7.5": - version "7.7.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.7.5.tgz#39e0fb717224b59475b306402bb8eedab01e729c" - integrity sha512-CT57FG4A2ZUNU1v+HdvDSDrjNWBrtCmSH6YbbgN3Lrf0Di/q/lWRxZrE72p3+HCCz9UjfZOEBdphgC0nzOS6DQ== - dependencies: - "@babel/helper-module-transforms" "^7.7.5" - "@babel/helper-plugin-utils" "^7.0.0" - babel-plugin-dynamic-import-node "^2.3.0" - "@babel/plugin-transform-modules-commonjs@^7.0.0", "@babel/plugin-transform-modules-commonjs@^7.2.0", "@babel/plugin-transform-modules-commonjs@^7.4.4", "@babel/plugin-transform-modules-commonjs@^7.5.0", "@babel/plugin-transform-modules-commonjs@^7.6.0", "@babel/plugin-transform-modules-commonjs@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.7.4.tgz#bee4386e550446343dd52a571eda47851ff857a3" @@ -1098,16 +1004,6 @@ "@babel/helper-simple-access" "^7.7.4" babel-plugin-dynamic-import-node "^2.3.0" -"@babel/plugin-transform-modules-commonjs@^7.7.5": - version "7.7.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.7.5.tgz#1d27f5eb0bcf7543e774950e5b2fa782e637b345" - integrity sha512-9Cq4zTFExwFhQI6MT1aFxgqhIsMWQWDVwOgLzl7PTWJHsNaqFvklAU+Oz6AQLAS0dJKTwZSOCo20INwktxpi3Q== - dependencies: - "@babel/helper-module-transforms" "^7.7.5" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-simple-access" "^7.7.4" - babel-plugin-dynamic-import-node "^2.3.0" - "@babel/plugin-transform-modules-systemjs@^7.2.0", "@babel/plugin-transform-modules-systemjs@^7.5.0", "@babel/plugin-transform-modules-systemjs@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.7.4.tgz#cd98152339d3e763dfe838b7d4273edaf520bb30" @@ -1163,15 +1059,6 @@ "@babel/helper-get-function-arity" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-parameters@^7.7.7": - version "7.7.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.7.7.tgz#7a884b2460164dc5f194f668332736584c760007" - integrity sha512-OhGSrf9ZBrr1fw84oFXj5hgi8Nmg+E2w5L7NhnG0lPvpDtqd7dbyilM2/vR8CKbJ907RyxPh2kj6sBCSSfI9Ew== - dependencies: - "@babel/helper-call-delegate" "^7.7.4" - "@babel/helper-get-function-arity" "^7.7.4" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-transform-property-literals@^7.0.0", "@babel/plugin-transform-property-literals@^7.2.0", "@babel/plugin-transform-property-literals@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.7.4.tgz#2388d6505ef89b266103f450f9167e6bd73f98c2" @@ -1233,13 +1120,6 @@ dependencies: regenerator-transform "^0.14.0" -"@babel/plugin-transform-regenerator@^7.7.5": - version "7.7.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.7.5.tgz#3a8757ee1a2780f390e89f246065ecf59c26fce9" - integrity sha512-/8I8tPvX2FkuEyWbjRCt4qTAgZK0DVy8QRguhA524UH48RfGJy94On2ri+dCuwOpcerPRl9O4ebQkRcVzIaGBw== - dependencies: - regenerator-transform "^0.14.0" - "@babel/plugin-transform-reserved-words@^7.2.0", "@babel/plugin-transform-reserved-words@^7.7.4": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.7.4.tgz#6a7cf123ad175bb5c69aec8f6f0770387ed3f1eb" @@ -1553,63 +1433,6 @@ js-levenshtein "^1.1.3" semver "^5.5.0" -"@babel/preset-env@^7.7.7": - version "7.7.7" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.7.7.tgz#c294167b91e53e7e36d820e943ece8d0c7fe46ac" - integrity sha512-pCu0hrSSDVI7kCVUOdcMNQEbOPJ52E+LrQ14sN8uL2ALfSqePZQlKrOy+tM4uhEdYlCHi4imr8Zz2cZe9oSdIg== - dependencies: - "@babel/helper-module-imports" "^7.7.4" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-proposal-async-generator-functions" "^7.7.4" - "@babel/plugin-proposal-dynamic-import" "^7.7.4" - "@babel/plugin-proposal-json-strings" "^7.7.4" - "@babel/plugin-proposal-object-rest-spread" "^7.7.7" - "@babel/plugin-proposal-optional-catch-binding" "^7.7.4" - "@babel/plugin-proposal-unicode-property-regex" "^7.7.7" - "@babel/plugin-syntax-async-generators" "^7.7.4" - "@babel/plugin-syntax-dynamic-import" "^7.7.4" - "@babel/plugin-syntax-json-strings" "^7.7.4" - "@babel/plugin-syntax-object-rest-spread" "^7.7.4" - "@babel/plugin-syntax-optional-catch-binding" "^7.7.4" - "@babel/plugin-syntax-top-level-await" "^7.7.4" - "@babel/plugin-transform-arrow-functions" "^7.7.4" - "@babel/plugin-transform-async-to-generator" "^7.7.4" - "@babel/plugin-transform-block-scoped-functions" "^7.7.4" - "@babel/plugin-transform-block-scoping" "^7.7.4" - "@babel/plugin-transform-classes" "^7.7.4" - "@babel/plugin-transform-computed-properties" "^7.7.4" - "@babel/plugin-transform-destructuring" "^7.7.4" - "@babel/plugin-transform-dotall-regex" "^7.7.7" - "@babel/plugin-transform-duplicate-keys" "^7.7.4" - "@babel/plugin-transform-exponentiation-operator" "^7.7.4" - "@babel/plugin-transform-for-of" "^7.7.4" - "@babel/plugin-transform-function-name" "^7.7.4" - "@babel/plugin-transform-literals" "^7.7.4" - "@babel/plugin-transform-member-expression-literals" "^7.7.4" - "@babel/plugin-transform-modules-amd" "^7.7.5" - "@babel/plugin-transform-modules-commonjs" "^7.7.5" - "@babel/plugin-transform-modules-systemjs" "^7.7.4" - "@babel/plugin-transform-modules-umd" "^7.7.4" - "@babel/plugin-transform-named-capturing-groups-regex" "^7.7.4" - "@babel/plugin-transform-new-target" "^7.7.4" - "@babel/plugin-transform-object-super" "^7.7.4" - "@babel/plugin-transform-parameters" "^7.7.7" - "@babel/plugin-transform-property-literals" "^7.7.4" - "@babel/plugin-transform-regenerator" "^7.7.5" - "@babel/plugin-transform-reserved-words" "^7.7.4" - "@babel/plugin-transform-shorthand-properties" "^7.7.4" - "@babel/plugin-transform-spread" "^7.7.4" - "@babel/plugin-transform-sticky-regex" "^7.7.4" - "@babel/plugin-transform-template-literals" "^7.7.4" - "@babel/plugin-transform-typeof-symbol" "^7.7.4" - "@babel/plugin-transform-unicode-regex" "^7.7.4" - "@babel/types" "^7.7.4" - browserslist "^4.6.0" - core-js-compat "^3.6.0" - invariant "^2.2.2" - js-levenshtein "^1.1.3" - semver "^5.5.0" - "@babel/preset-flow@7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/preset-flow/-/preset-flow-7.0.0.tgz#afd764835d9535ec63d8c7d4caf1c06457263da2" @@ -1637,7 +1460,7 @@ "@babel/plugin-transform-react-jsx-self" "^7.0.0" "@babel/plugin-transform-react-jsx-source" "^7.0.0" -"@babel/preset-react@^7.0.0", "@babel/preset-react@^7.7.4": +"@babel/preset-react@^7.0.0": version "7.7.4" resolved "https://registry.yarnpkg.com/@babel/preset-react/-/preset-react-7.7.4.tgz#3fe2ea698d8fb536d8e7881a592c3c1ee8bf5707" integrity sha512-j+vZtg0/8pQr1H8wKoaJyGL2IEk3rG/GIvua7Sec7meXVIvGycihlGMx5xcU00kqCJbwzHs18xTu3YfREOqQ+g== @@ -1675,17 +1498,6 @@ pirates "^4.0.0" source-map-support "^0.5.16" -"@babel/register@^7.7.7": - version "7.7.7" - resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.7.7.tgz#46910c4d1926b9c6096421b23d1f9e159c1dcee1" - integrity sha512-S2mv9a5dc2pcpg/ConlKZx/6wXaEwHeqfo7x/QbXsdCAZm+WJC1ekVvL1TVxNsedTs5y/gG63MhJTEsmwmjtiA== - dependencies: - find-cache-dir "^2.0.0" - lodash "^4.17.13" - make-dir "^2.1.0" - pirates "^4.0.0" - source-map-support "^0.5.16" - "@babel/runtime@7.6.0": version "7.6.0" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.6.0.tgz#4fc1d642a9fd0299754e8b5de62c631cf5568205" @@ -8341,15 +8153,6 @@ browserslist@^4.0.0, browserslist@^4.1.0, browserslist@^4.1.1, browserslist@^4.3 electron-to-chromium "^1.3.306" node-releases "^1.1.40" -browserslist@^4.8.2: - version "4.8.2" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.8.2.tgz#b45720ad5fbc8713b7253c20766f701c9a694289" - integrity sha512-+M4oeaTplPm/f1pXDw84YohEv7B1i/2Aisei8s4s6k3QsoSHa7i5sz8u/cGQkkatCPxMASKxPualR4wwYgVboA== - dependencies: - caniuse-lite "^1.0.30001015" - electron-to-chromium "^1.3.322" - node-releases "^1.1.42" - browserstack@^1.5.1: version "1.5.3" resolved "https://registry.yarnpkg.com/browserstack/-/browserstack-1.5.3.tgz#93ab48799a12ef99dbd074dd595410ddb196a7ac" @@ -8786,11 +8589,6 @@ caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000844, caniuse-lite@^1.0.30000939, can resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001012.tgz#653ec635e815b9e0fb801890923b0c2079eb34ec" integrity sha512-7RR4Uh04t9K1uYRWzOJmzplgEOAXbfK72oVNokCdMzA67trrhPzy93ahKk1AWHiA0c58tD2P+NHqxrA8FZ+Trg== -caniuse-lite@^1.0.30001015: - version "1.0.30001017" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001017.tgz#d3ad6ec18148b9bd991829958d9d7e562bb78cd6" - integrity sha512-EDnZyOJ6eYh6lHmCvCdHAFbfV4KJ9lSdfv4h/ppEhrU/Yudkl7jujwMZ1we6RX7DXqBfT04pVMQ4J+1wcTlsKA== - canonical-path@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/canonical-path/-/canonical-path-1.0.0.tgz#fcb470c23958def85081856be7a86e904f180d1d" @@ -9537,7 +9335,7 @@ commander@2.8.x: dependencies: graceful-readlink ">= 1.0.0" -commander@^2.11.0, commander@^2.12.1, commander@^2.15.1, commander@^2.18.0, commander@^2.19.0, commander@^2.20.0, commander@^2.6.0, commander@^2.8.1, commander@^2.9.0, commander@~2.20.3: +commander@^2.11.0, commander@^2.12.1, commander@^2.15.1, commander@^2.18.0, commander@^2.19.0, commander@^2.20.0, commander@^2.6.0, commander@^2.9.0, commander@~2.20.3: version "2.20.3" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== @@ -10061,14 +9859,6 @@ core-js-compat@^3.1.1: browserslist "^4.7.3" semver "^6.3.0" -core-js-compat@^3.6.0: - version "3.6.1" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.6.1.tgz#39638c935c83c93a793abb628b252ec43e85783a" - integrity sha512-2Tl1EuxZo94QS2VeH28Ebf5g3xbPZG/hj/N5HDDy4XMP/ImR0JIer/nggQRiMN91Q54JVkGbytf42wO29oXVHg== - dependencies: - browserslist "^4.8.2" - semver "7.0.0" - core-js-pure@^3.0.1: version "3.4.2" resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.4.2.tgz#ffd4ea4dc1f8517f75d4a929986a214629477417" @@ -10094,11 +9884,6 @@ core-js@^3.0.1, core-js@^3.0.4: resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.4.2.tgz#ee2b1a60b50388d8ddcda8cdb44a92c7a9ea76df" integrity sha512-bUTfqFWtNKWp73oNIfRkqwYZJeNT3lstzZcAkhhiuvDraRSgOH1/+F9ZklbpR4zpdKuo4cpXN8tKP7s61yjX+g== -core-js@^3.2.1: - version "3.6.1" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.6.1.tgz#39d5e2e346258cc01eb7d44345b1c3c014ca3f05" - integrity sha512-186WjSik2iTGfDjfdCZAxv2ormxtKgemjC3SI6PL31qOA0j5LhTDVjHChccoc7brwLvpvLPiMyRlcO88C4l1QQ== - core-object@^3.1.5: version "3.1.5" resolved "https://registry.yarnpkg.com/core-object/-/core-object-3.1.5.tgz#fa627b87502adc98045e44678e9a8ec3b9c0d2a9" @@ -11631,11 +11416,6 @@ electron-to-chromium@^1.3.191, electron-to-chromium@^1.3.247, electron-to-chromi resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.314.tgz#c186a499ed2c9057bce9eb8dca294d6d5450facc" integrity sha512-IKDR/xCxKFhPts7h+VaSXS02Z1mznP3fli1BbXWXeN89i2gCzKraU8qLpEid8YzKcmZdZD3Mly3cn5/lY9xsBQ== -electron-to-chromium@^1.3.322: - version "1.3.322" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.322.tgz#a6f7e1c79025c2b05838e8e344f6e89eb83213a8" - integrity sha512-Tc8JQEfGQ1MzfSzI/bTlSr7btJv/FFO7Yh6tanqVmIWOuNCu6/D1MilIEgLtmWqIrsv+o4IjpLAhgMBr/ncNAA== - elegant-spinner@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/elegant-spinner/-/elegant-spinner-1.0.1.tgz#db043521c95d7e303fd8f345bedc3349cfb0729e" @@ -16157,19 +15937,6 @@ html-webpack-plugin@4.0.0-beta.5: tapable "^1.1.0" util.promisify "1.0.0" -html-webpack-plugin@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/html-webpack-plugin/-/html-webpack-plugin-3.2.0.tgz#b01abbd723acaaa7b37b6af4492ebda03d9dd37b" - integrity sha1-sBq71yOsqqeze2r0SS69oD2d03s= - dependencies: - html-minifier "^3.2.3" - loader-utils "^0.2.16" - lodash "^4.17.3" - pretty-error "^2.0.2" - tapable "^1.0.0" - toposort "^1.0.0" - util.promisify "1.0.0" - html-webpack-plugin@^4.0.0-beta.2: version "4.0.0-beta.11" resolved "https://registry.yarnpkg.com/html-webpack-plugin/-/html-webpack-plugin-4.0.0-beta.11.tgz#3059a69144b5aecef97708196ca32f9e68677715" @@ -20009,7 +19776,7 @@ lodash.uniqby@^4.7.0: resolved "https://registry.yarnpkg.com/lodash.uniqby/-/lodash.uniqby-4.7.0.tgz#d99c07a669e9e6d24e1362dfe266c67616af1302" integrity sha1-2ZwHpmnp5tJOE2Lf4mbGdhavEwI= -lodash@4.17.15, "lodash@>=3.5 <5", lodash@^4.0.0, lodash@^4.0.1, lodash@^4.13.1, lodash@^4.15.0, lodash@^4.16.2, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.5.0, lodash@^4.5.1, lodash@^4.6.0, lodash@^4.6.1, lodash@~4.17.10: +lodash@4.17.15, "lodash@>=3.5 <5", lodash@^4.0.0, lodash@^4.0.1, lodash@^4.13.1, lodash@^4.15.0, lodash@^4.16.2, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.5.0, lodash@^4.5.1, lodash@^4.6.0, lodash@^4.6.1, lodash@~4.17.10: version "4.17.15" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== @@ -21912,14 +21679,6 @@ node-dir@^0.1.10, node-dir@^0.1.17: dependencies: minimatch "^3.0.2" -node-environment-flags@^1.0.5: - version "1.0.6" - resolved "https://registry.yarnpkg.com/node-environment-flags/-/node-environment-flags-1.0.6.tgz#a30ac13621f6f7d674260a54dede048c3982c088" - integrity sha512-5Evy2epuL+6TM0lCQGpFIj6KwiEsGh1SrHUhTbNX+sLbBtjidPZFAnVK9y5yU1+h//RitLbRHTIMyxQPtxMdHw== - dependencies: - object.getownpropertydescriptors "^2.0.3" - semver "^5.7.0" - node-fetch-npm@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/node-fetch-npm/-/node-fetch-npm-2.0.2.tgz#7258c9046182dca345b4208eda918daf33697ff7" @@ -22101,13 +21860,6 @@ node-releases@^1.1.25, node-releases@^1.1.29, node-releases@^1.1.40: dependencies: semver "^6.3.0" -node-releases@^1.1.42: - version "1.1.44" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.44.tgz#cd66438a6eb875e3eb012b6a12e48d9f4326ffd7" - integrity sha512-NwbdvJyR7nrcGrXvKAvzc5raj/NkoJudkarh2yIpJ4t0NH4aqjUDz/486P+ynIW5eokKOfzGNRdYoLfBlomruw== - dependencies: - semver "^6.3.0" - node-sass@^4.12.0: version "4.13.0" resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.13.0.tgz#b647288babdd6a1cb726de4545516b31f90da066" @@ -26556,7 +26308,7 @@ react-transition-group@^2.2.1: prop-types "^15.6.2" react-lifecycles-compat "^3.0.4" -react@*, react@16.12.0, react@^16.10.2, react@^16.12.0, react@^16.6.0, react@^16.8.3, react@^16.8.4: +react@*, react@16.12.0, react@^16.10.2, react@^16.6.0, react@^16.8.3, react@^16.8.4: version "16.12.0" resolved "https://registry.yarnpkg.com/react/-/react-16.12.0.tgz#0c0a9c6a142429e3614834d5a778e18aa78a0b83" integrity sha512-fglqy3k5E+81pA8s+7K0/T3DBCF0ZDOher1elBFzF7O6arXJgzyu/FW+COxFvAWXJoJN9KIZbT2LXlukwphYTA== @@ -27748,13 +27500,6 @@ resolve@1.x, resolve@^1.1.4, resolve@^1.1.5, resolve@^1.1.6, resolve@^1.1.7, res dependencies: path-parse "^1.0.6" -resolve@^1.13.1: - version "1.14.1" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.14.1.tgz#9e018c540fcf0c427d678b9931cbf45e984bcaff" - integrity sha512-fn5Wobh4cxbLzuHaE+nphztHy43/b++4M6SsGFC2gB8uYwf0C8LcarfCz1un7UTW8OFQg9iNjZ4xpcFVGebDPg== - dependencies: - path-parse "^1.0.6" - responselike@1.0.2, responselike@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/responselike/-/responselike-1.0.2.tgz#918720ef3b631c5642be068f15ade5a46f4ba1e7" @@ -30808,11 +30553,6 @@ topo@3.x.x: dependencies: hoek "6.x.x" -toposort@^1.0.0: - version "1.0.7" - resolved "https://registry.yarnpkg.com/toposort/-/toposort-1.0.7.tgz#2e68442d9f64ec720b8cc89e6443ac6caa950029" - integrity sha1-LmhELZ9k7HILjMieZEOsbKqVACk= - toposort@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/toposort/-/toposort-2.0.2.tgz#ae21768175d1559d48bef35420b2f4962f09c330" @@ -32112,13 +31852,6 @@ v8-compile-cache@^2.0.0, v8-compile-cache@^2.0.3: resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz#e14de37b31a6d194f5690d67efc4e7f6fc6ab30e" integrity sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g== -v8flags@^3.1.1: - version "3.1.3" - resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-3.1.3.tgz#fc9dc23521ca20c5433f81cc4eb9b3033bb105d8" - integrity sha512-amh9CCg3ZxkzQ48Mhcb8iX7xpAfYJgePHxWMQCBWECpOSqJUXgY26ncA61UTV0BkPqfhcy6mzwCIoP4ygxpW8w== - dependencies: - homedir-polyfill "^1.0.1" - validate-npm-package-license@^3.0.1, validate-npm-package-license@^3.0.3: version "3.0.4" resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" From 0a65a5a01c623aa293ed61b53bd2edb73a691077 Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Mon, 3 Feb 2020 23:08:38 +1100 Subject: [PATCH 21/25] Fix typo --- app/server/src/client/preview/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/server/src/client/preview/index.ts b/app/server/src/client/preview/index.ts index 499cea35e275..bccce6b8ac26 100644 --- a/app/server/src/client/preview/index.ts +++ b/app/server/src/client/preview/index.ts @@ -24,14 +24,14 @@ export const storiesOf: ClientApi['storiesOf'] = (kind, m) => { }); }; -const setRenderFecthAndConfigure: ClientApi['configure'] = (loader, module, options) => { +const setRenderFetchAndConfigure: ClientApi['configure'] = (loader, module, options) => { if (options && options.fetchStoryHtml) { setFetchStoryHtml(options.fetchStoryHtml); } api.configure(loader, module, framework); }; -export const configure: ClientApi['configure'] = setRenderFecthAndConfigure; +export const configure: ClientApi['configure'] = setRenderFetchAndConfigure; export const { addDecorator, addParameters, From c15feb6b0ddfea31b37b0dd46a350d44947d40be Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Mon, 3 Feb 2020 23:11:35 +1100 Subject: [PATCH 22/25] Rename `id` to `path` to be a bit more general --- app/server/src/client/preview/render.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/server/src/client/preview/render.ts b/app/server/src/client/preview/render.ts index d06e3ef4211e..9bb8a94dfe9a 100644 --- a/app/server/src/client/preview/render.ts +++ b/app/server/src/client/preview/render.ts @@ -4,8 +4,8 @@ import { RenderMainArgs, FetchStoryHtmlType } from './types'; const rootElement = document.getElementById('root'); -let fetchStoryHtml: FetchStoryHtmlType = async (url, id, params) => { - const fetchUrl = new URL(`${url}/${id}`); +let fetchStoryHtml: FetchStoryHtmlType = async (url, path, params) => { + const fetchUrl = new URL(`${url}/${path}`); fetchUrl.search = new URLSearchParams(params).toString(); const response = await fetch(fetchUrl); From d12beea104b8bbde94a924f906ecd97ce08f0459 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Tue, 4 Feb 2020 13:30:56 +0800 Subject: [PATCH 23/25] Update package.json --- app/server/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/server/package.json b/app/server/package.json index d6fc37ce8f8c..9d6ea1d5f6a9 100644 --- a/app/server/package.json +++ b/app/server/package.json @@ -1,6 +1,6 @@ { "name": "@storybook/server", - "version": "5.3.0-rc.7", + "version": "6.0.0-alpha.4", "description": "Storybook for Server: View HTML snippets from a server in isolation with Hot Reloading.", "keywords": [ "storybook" @@ -33,8 +33,8 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addons": "5.3.0-rc.7", - "@storybook/core": "5.3.0-rc.7", + "@storybook/addons": "6.0.0-alpha.4", + "@storybook/core": "6.0.0-alpha.4", "@storybook/node-logger": "^5.2.8", "@types/webpack-env": "^1.13.9", "core-js": "^3.0.1", From c7532e237aa0f4a44d5abfef40608f281d1b9147 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Tue, 4 Feb 2020 13:35:06 +0800 Subject: [PATCH 24/25] Update package.json --- examples/server-kitchen-sink/package.json | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/server-kitchen-sink/package.json b/examples/server-kitchen-sink/package.json index 42bef000497b..3cc656cc0535 100644 --- a/examples/server-kitchen-sink/package.json +++ b/examples/server-kitchen-sink/package.json @@ -1,6 +1,6 @@ { "name": "server-kitchen-sink", - "version": "5.3.0-rc.7", + "version": "6.0.0-alpha.4", "private": true, "description": "", "keywords": [], @@ -14,15 +14,15 @@ "storybook": "SERVER_PORT=1137 start-storybook -p 9006 --quiet" }, "devDependencies": { - "@storybook/addon-a11y": "5.3.0-rc.7", - "@storybook/addon-actions": "5.3.0-rc.7", - "@storybook/addon-backgrounds": "5.3.0-rc.7", - "@storybook/addon-centered": "5.3.0-rc.7", - "@storybook/addon-knobs": "5.3.0-rc.7", - "@storybook/addon-links": "5.3.0-rc.7", - "@storybook/addon-notes": "5.3.0-rc.7", - "@storybook/node-logger": "5.3.0-rc.7", - "@storybook/server": "5.3.0-rc.7", + "@storybook/addon-a11y": "6.0.0-alpha.4", + "@storybook/addon-actions": "6.0.0-alpha.4", + "@storybook/addon-backgrounds": "6.0.0-alpha.4", + "@storybook/addon-centered": "6.0.0-alpha.4", + "@storybook/addon-knobs": "6.0.0-alpha.4", + "@storybook/addon-links": "6.0.0-alpha.4", + "@storybook/addon-notes": "6.0.0-alpha.4", + "@storybook/node-logger": "6.0.0-alpha.4", + "@storybook/server": "6.0.0-alpha.4", "concurrently": "^5.0.2", "cors": "^2.8.5", "express": "~4.16.4", From 3007fe5066c1d526bf233e83fb84ad80a139a2aa Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Tue, 4 Feb 2020 13:37:43 +0800 Subject: [PATCH 25/25] Update yarn.lock --- yarn.lock | 436 +----------------------------------------------------- 1 file changed, 7 insertions(+), 429 deletions(-) diff --git a/yarn.lock b/yarn.lock index 5962c10b43aa..da82482f22bb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -777,7 +777,7 @@ "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-object-rest-spread" "^7.8.0" -"@babel/plugin-proposal-object-rest-spread@^7.0.0", "@babel/plugin-proposal-object-rest-spread@^7.2.0", "@babel/plugin-proposal-object-rest-spread@^7.3.2", "@babel/plugin-proposal-object-rest-spread@^7.6.2", "@babel/plugin-proposal-object-rest-spread@^7.7.4", "@babel/plugin-proposal-object-rest-spread@^7.8.3": +"@babel/plugin-proposal-object-rest-spread@^7.0.0", "@babel/plugin-proposal-object-rest-spread@^7.2.0", "@babel/plugin-proposal-object-rest-spread@^7.6.2", "@babel/plugin-proposal-object-rest-spread@^7.7.4", "@babel/plugin-proposal-object-rest-spread@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.8.3.tgz#eb5ae366118ddca67bed583b53d7554cad9951bb" integrity sha512-8qvuPwU/xxUCt78HocNlv0mXXo0wdh9VT1R04WU8HGOfaOob26pF+9P5/lYjN/q7DHOX1bvX60hnhOvuQUJdbA== @@ -3535,146 +3535,6 @@ dependencies: type-detect "4.0.8" -"@storybook/addon-a11y@5.3.0-rc.7": - version "5.3.0-rc.7" - resolved "https://registry.yarnpkg.com/@storybook/addon-a11y/-/addon-a11y-5.3.0-rc.7.tgz#5ad083417b738f9ac635ba5d111c216a8a941070" - integrity sha512-v8np99pQ0/3NdHGLOUcK4m26IWJQtQH/Aka48A9pb3/UUptUa8LD3zc9Oy0Si3ZjSrEEq8KE4N3Dfq9wKBRCgw== - dependencies: - "@storybook/addons" "5.3.0-rc.7" - "@storybook/api" "5.3.0-rc.7" - "@storybook/client-logger" "5.3.0-rc.7" - "@storybook/components" "5.3.0-rc.7" - "@storybook/core-events" "5.3.0-rc.7" - "@storybook/theming" "5.3.0-rc.7" - axe-core "^3.3.2" - core-js "^3.0.1" - global "^4.3.2" - memoizerific "^1.11.3" - react "^16.8.3" - react-redux "^7.0.2" - react-sizeme "^2.5.2" - redux "^4.0.1" - ts-dedent "^1.1.0" - util-deprecate "^1.0.2" - -"@storybook/addon-actions@5.3.0-rc.7": - version "5.3.0-rc.7" - resolved "https://registry.yarnpkg.com/@storybook/addon-actions/-/addon-actions-5.3.0-rc.7.tgz#8a254a86410e68db026fb00719a46bf9576ec3a9" - integrity sha512-NNkxfXqvEwBkSJw1ZeGBvCWhHMjUSWfcBvlsIKpxfhcbZf4WEB/wjT2r83YAYBBYM13wrok3WadpbeCb1ZWCGA== - dependencies: - "@storybook/addons" "5.3.0-rc.7" - "@storybook/api" "5.3.0-rc.7" - "@storybook/client-api" "5.3.0-rc.7" - "@storybook/components" "5.3.0-rc.7" - "@storybook/core-events" "5.3.0-rc.7" - "@storybook/theming" "5.3.0-rc.7" - core-js "^3.0.1" - fast-deep-equal "^2.0.1" - global "^4.3.2" - polished "^3.3.1" - prop-types "^15.7.2" - react "^16.8.3" - react-inspector "^4.0.0" - uuid "^3.3.2" - -"@storybook/addon-backgrounds@5.3.0-rc.7": - version "5.3.0-rc.7" - resolved "https://registry.yarnpkg.com/@storybook/addon-backgrounds/-/addon-backgrounds-5.3.0-rc.7.tgz#7461d8fe022bcef45e19c1e6dfd7730b53b5c75d" - integrity sha512-uTdsY07bBbCKEyGnpCU5A+EGKauJQ9BO9lrNZ8B6Oh//aqP56isIOs2LEDeOI66sKa2FPCk/yu6eK0eParmbKg== - dependencies: - "@storybook/addons" "5.3.0-rc.7" - "@storybook/api" "5.3.0-rc.7" - "@storybook/client-logger" "5.3.0-rc.7" - "@storybook/components" "5.3.0-rc.7" - "@storybook/core-events" "5.3.0-rc.7" - "@storybook/theming" "5.3.0-rc.7" - core-js "^3.0.1" - memoizerific "^1.11.3" - react "^16.8.3" - util-deprecate "^1.0.2" - -"@storybook/addon-centered@5.3.0-rc.7": - version "5.3.0-rc.7" - resolved "https://registry.yarnpkg.com/@storybook/addon-centered/-/addon-centered-5.3.0-rc.7.tgz#13053665f9f3a39923eff881ee4403813426fa1c" - integrity sha512-acbkK7oaP9CKZDCS9iFyxt5urgubYlD16Z8BrFKm/Epw4EAf3kBLAUrxe3cPtFDlBSWzHmx6KlzZnahgNdkRJQ== - dependencies: - "@storybook/addons" "5.3.0-rc.7" - core-js "^3.0.1" - global "^4.3.2" - util-deprecate "^1.0.2" - -"@storybook/addon-knobs@5.3.0-rc.7": - version "5.3.0-rc.7" - resolved "https://registry.yarnpkg.com/@storybook/addon-knobs/-/addon-knobs-5.3.0-rc.7.tgz#e887c65aabd2d358b3a1fea3b7d497de7493f162" - integrity sha512-uDfz9pBbzTCKIl9uvThpNtRaSC5A1ppEqTfm+tsK3rUndoIyzLIC9WAYr41kAJe2PPOfI0ad7ZV3IXChJ4gHpg== - dependencies: - "@storybook/addons" "5.3.0-rc.7" - "@storybook/api" "5.3.0-rc.7" - "@storybook/client-api" "5.3.0-rc.7" - "@storybook/components" "5.3.0-rc.7" - "@storybook/core-events" "5.3.0-rc.7" - "@storybook/theming" "5.3.0-rc.7" - "@types/react-color" "^3.0.1" - copy-to-clipboard "^3.0.8" - core-js "^3.0.1" - escape-html "^1.0.3" - fast-deep-equal "^2.0.1" - global "^4.3.2" - lodash "^4.17.15" - prop-types "^15.7.2" - qs "^6.6.0" - react-color "^2.17.0" - react-lifecycles-compat "^3.0.4" - react-select "^3.0.8" - -"@storybook/addon-links@5.3.0-rc.7": - version "5.3.0-rc.7" - resolved "https://registry.yarnpkg.com/@storybook/addon-links/-/addon-links-5.3.0-rc.7.tgz#5d2b9a5e367caf783665bad8b1729c02cf3445cb" - integrity sha512-gqXID8YFruMagxrM4ydJ32ZPY3BX/6ws/GKQCqLaRMefLxc46tX1encBfhkLe+AUGrgJZWWrhKcDNpqbUyppKg== - dependencies: - "@storybook/addons" "5.3.0-rc.7" - "@storybook/client-logger" "5.3.0-rc.7" - "@storybook/core-events" "5.3.0-rc.7" - "@storybook/csf" "0.0.1" - "@storybook/router" "5.3.0-rc.7" - core-js "^3.0.1" - global "^4.3.2" - prop-types "^15.7.2" - qs "^6.6.0" - ts-dedent "^1.1.0" - -"@storybook/addon-notes@5.3.0-rc.7": - version "5.3.0-rc.7" - resolved "https://registry.yarnpkg.com/@storybook/addon-notes/-/addon-notes-5.3.0-rc.7.tgz#7d5434d833675ca660a01d0195f8ce8358a100fd" - integrity sha512-p/0pdccZd5FYDGSc1pPspqVMCPdENuIQyZa4pGmMZzuQ2LVopb5odGUNjSNhVAuivFgv02gdv8E+OTOC+bmfQQ== - dependencies: - "@storybook/addons" "5.3.0-rc.7" - "@storybook/api" "5.3.0-rc.7" - "@storybook/client-logger" "5.3.0-rc.7" - "@storybook/components" "5.3.0-rc.7" - "@storybook/core-events" "5.3.0-rc.7" - "@storybook/router" "5.3.0-rc.7" - "@storybook/theming" "5.3.0-rc.7" - core-js "^3.0.1" - global "^4.3.2" - markdown-to-jsx "^6.10.3" - memoizerific "^1.11.3" - prop-types "^15.7.2" - util-deprecate "^1.0.2" - -"@storybook/addons@5.3.0-rc.7": - version "5.3.0-rc.7" - resolved "https://registry.yarnpkg.com/@storybook/addons/-/addons-5.3.0-rc.7.tgz#830cd78fc39eb1a5292c7f20af9b5f3a07858e4e" - integrity sha512-TpCheFVHW40wmtbTg9HRmV4q9rsNx1+DpCnfRWP4BL0F5adhN4MkwRd98vGqvQc+SIKbyqR0MM7+dstsMnHYgQ== - dependencies: - "@storybook/api" "5.3.0-rc.7" - "@storybook/channels" "5.3.0-rc.7" - "@storybook/client-logger" "5.3.0-rc.7" - "@storybook/core-events" "5.3.0-rc.7" - core-js "^3.0.1" - global "^4.3.2" - util-deprecate "^1.0.2" - "@storybook/addons@6.0.0-alpha.0": version "6.0.0-alpha.0" resolved "https://registry.yarnpkg.com/@storybook/addons/-/addons-6.0.0-alpha.0.tgz#f4416a8c9c081961e5950a7962d7a5102138717e" @@ -3688,30 +3548,6 @@ global "^4.3.2" util-deprecate "^1.0.2" -"@storybook/api@5.3.0-rc.7": - version "5.3.0-rc.7" - resolved "https://registry.yarnpkg.com/@storybook/api/-/api-5.3.0-rc.7.tgz#ab36f7193c7b708af0a937deae8b854d169139ef" - integrity sha512-fg1K291kaRtxnHy++cZr8Gf8BSBio633MkQPrxOLYqg52ZVvFd5ttx45f3Jj9O48tOCoGp1bldlGjPh/3oY9mg== - dependencies: - "@storybook/channels" "5.3.0-rc.7" - "@storybook/client-logger" "5.3.0-rc.7" - "@storybook/core-events" "5.3.0-rc.7" - "@storybook/csf" "0.0.1" - "@storybook/router" "5.3.0-rc.7" - "@storybook/theming" "5.3.0-rc.7" - core-js "^3.0.1" - fast-deep-equal "^2.0.1" - global "^4.3.2" - lodash "^4.17.15" - memoizerific "^1.11.3" - prop-types "^15.6.2" - react "^16.8.3" - semver "^6.0.0" - shallow-equal "^1.1.0" - store2 "^2.7.1" - telejson "^3.2.0" - util-deprecate "^1.0.2" - "@storybook/api@6.0.0-alpha.0": version "6.0.0-alpha.0" resolved "https://registry.yarnpkg.com/@storybook/api/-/api-6.0.0-alpha.0.tgz#9b612f8c41fb8b1f9bbd3c990b5a1b3beb0eb82a" @@ -3738,17 +3574,6 @@ telejson "^3.2.0" util-deprecate "^1.0.2" -"@storybook/channel-postmessage@5.3.0-rc.7": - version "5.3.0-rc.7" - resolved "https://registry.yarnpkg.com/@storybook/channel-postmessage/-/channel-postmessage-5.3.0-rc.7.tgz#bf8db97fd25a75a4f766981e046e76ec47f854b5" - integrity sha512-eL+BrsZvYnCwT0otqerM961xKvteuaZC586zn2WOmVpO2ZYM9bJQeKw7FOhR+G8blwHz90kLjxXnKuEwO/uTvg== - dependencies: - "@storybook/channels" "5.3.0-rc.7" - "@storybook/client-logger" "5.3.0-rc.7" - core-js "^3.0.1" - global "^4.3.2" - telejson "^3.2.0" - "@storybook/channel-postmessage@6.0.0-alpha.0": version "6.0.0-alpha.0" resolved "https://registry.yarnpkg.com/@storybook/channel-postmessage/-/channel-postmessage-6.0.0-alpha.0.tgz#dec7245e9be7b1303c8bd60e664134a56639ae54" @@ -3770,13 +3595,6 @@ global "^4.3.2" json-fn "^1.1.1" -"@storybook/channels@5.3.0-rc.7": - version "5.3.0-rc.7" - resolved "https://registry.yarnpkg.com/@storybook/channels/-/channels-5.3.0-rc.7.tgz#17cab85086121941f66d5e9fd474403dc5ee85e4" - integrity sha512-jlt4PaDLYcFPxpN+FZBXLSZpHgs4JAcHblgbWbEH7Otd0ph+2E3Q0TuCnbfNlJUdjUnqLp2jXDulNvpRRz1n8Q== - dependencies: - core-js "^3.0.1" - "@storybook/channels@6.0.0-alpha.0": version "6.0.0-alpha.0" resolved "https://registry.yarnpkg.com/@storybook/channels/-/channels-6.0.0-alpha.0.tgz#c86e3bdff2e98444a0e9938a1a4abec503221af4" @@ -3784,28 +3602,6 @@ dependencies: core-js "^3.0.1" -"@storybook/client-api@5.3.0-rc.7": - version "5.3.0-rc.7" - resolved "https://registry.yarnpkg.com/@storybook/client-api/-/client-api-5.3.0-rc.7.tgz#be6e145acb6ea598e557f5568773bff0b9397f33" - integrity sha512-UTm8PGi7Wi6ASGhu75kEHrCT5wSTVsNmL5FwxwxAaW2O1vfXAZbxQjEhXe9CyQE9DFkgu2zx22QyOObKmXXH9g== - dependencies: - "@storybook/addons" "5.3.0-rc.7" - "@storybook/channel-postmessage" "5.3.0-rc.7" - "@storybook/channels" "5.3.0-rc.7" - "@storybook/client-logger" "5.3.0-rc.7" - "@storybook/core-events" "5.3.0-rc.7" - "@storybook/csf" "0.0.1" - core-js "^3.0.1" - eventemitter3 "^4.0.0" - global "^4.3.2" - is-plain-object "^3.0.0" - lodash "^4.17.15" - memoizerific "^1.11.3" - qs "^6.6.0" - stable "^0.1.8" - ts-dedent "^1.1.0" - util-deprecate "^1.0.2" - "@storybook/client-api@6.0.0-alpha.0": version "6.0.0-alpha.0" resolved "https://registry.yarnpkg.com/@storybook/client-api/-/client-api-6.0.0-alpha.0.tgz#9a6766a9878ee1f41b35debd93d480fef50506c2" @@ -3829,13 +3625,6 @@ ts-dedent "^1.1.0" util-deprecate "^1.0.2" -"@storybook/client-logger@5.3.0-rc.7": - version "5.3.0-rc.7" - resolved "https://registry.yarnpkg.com/@storybook/client-logger/-/client-logger-5.3.0-rc.7.tgz#fb09f731906f2918eabeee1164b0998959755a77" - integrity sha512-bL7lLgQ6sqksYQr+cPirzUzsz5//PcfdB9ysOyejW7TJnqDQQjtlUfS6OVZyXZ8y8dz7cNI/l7Ol1KqSntMMrg== - dependencies: - core-js "^3.0.1" - "@storybook/client-logger@6.0.0-alpha.0": version "6.0.0-alpha.0" resolved "https://registry.yarnpkg.com/@storybook/client-logger/-/client-logger-6.0.0-alpha.0.tgz#c8dd075d5a4a78158f6acb8ace14cf0492f2af16" @@ -3843,40 +3632,6 @@ dependencies: core-js "^3.0.1" -"@storybook/components@5.3.0-rc.7": - version "5.3.0-rc.7" - resolved "https://registry.yarnpkg.com/@storybook/components/-/components-5.3.0-rc.7.tgz#af6b66a6967e089f98be101a37bfabfd78e645c9" - integrity sha512-FOCIner6P6h0wYEu4gN4VEPlg6ch64t5QYV7dqm3vEYr5UFuEi4MJEl9abdsfvenzYNsc2HNq0vq61irEvyoFw== - dependencies: - "@storybook/client-logger" "5.3.0-rc.7" - "@storybook/theming" "5.3.0-rc.7" - "@types/react-syntax-highlighter" "11.0.2" - "@types/react-textarea-autosize" "^4.3.3" - core-js "^3.0.1" - global "^4.3.2" - lodash "^4.17.15" - markdown-to-jsx "^6.9.1" - memoizerific "^1.11.3" - polished "^3.3.1" - popper.js "^1.14.7" - prop-types "^15.7.2" - react "^16.8.3" - react-dom "^16.8.3" - react-focus-lock "^2.1.0" - react-helmet-async "^1.0.2" - react-popper-tooltip "^2.8.3" - react-syntax-highlighter "^11.0.2" - react-textarea-autosize "^7.1.0" - simplebar-react "^1.0.0-alpha.6" - ts-dedent "^1.1.0" - -"@storybook/core-events@5.3.0-rc.7": - version "5.3.0-rc.7" - resolved "https://registry.yarnpkg.com/@storybook/core-events/-/core-events-5.3.0-rc.7.tgz#8d95f9beab966ab10ba38982f4cb90e06b9542e5" - integrity sha512-X4JIMTKy/EUlD574BnvnFYbFn7/w7mSwAhenXzCF/9248ngn6clMUPrJ/tyXIYw9K/piHy96jXCB+taikuh+fg== - dependencies: - core-js "^3.0.1" - "@storybook/core-events@6.0.0-alpha.0": version "6.0.0-alpha.0" resolved "https://registry.yarnpkg.com/@storybook/core-events/-/core-events-6.0.0-alpha.0.tgz#a35d2f96f6d38aba080d7f5f1ec67799325728de" @@ -3884,85 +3639,6 @@ dependencies: core-js "^3.0.1" -"@storybook/core@5.3.0-rc.7": - version "5.3.0-rc.7" - resolved "https://registry.yarnpkg.com/@storybook/core/-/core-5.3.0-rc.7.tgz#5416d5ff8f4b7b91b27258bea2e75ee5b90da285" - integrity sha512-97V5l/Dg4HfNjOnTFwHSJFdKZcK9IglRVZAovP8GaiVdrYvBWQz4f9FnWhvcioO5NyYAWeyD9u6GDkcvGry+4A== - dependencies: - "@babel/plugin-proposal-class-properties" "^7.3.3" - "@babel/plugin-proposal-object-rest-spread" "^7.3.2" - "@babel/plugin-syntax-dynamic-import" "^7.2.0" - "@babel/plugin-transform-react-constant-elements" "^7.2.0" - "@babel/preset-env" "^7.4.5" - "@storybook/addons" "5.3.0-rc.7" - "@storybook/channel-postmessage" "5.3.0-rc.7" - "@storybook/client-api" "5.3.0-rc.7" - "@storybook/client-logger" "5.3.0-rc.7" - "@storybook/core-events" "5.3.0-rc.7" - "@storybook/csf" "0.0.1" - "@storybook/node-logger" "5.3.0-rc.7" - "@storybook/router" "5.3.0-rc.7" - "@storybook/theming" "5.3.0-rc.7" - "@storybook/ui" "5.3.0-rc.7" - airbnb-js-shims "^2.2.1" - ansi-to-html "^0.6.11" - autoprefixer "^9.7.2" - babel-plugin-add-react-displayname "^0.0.5" - babel-plugin-emotion "^10.0.20" - babel-plugin-macros "^2.7.0" - babel-preset-minify "^0.5.0 || 0.6.0-alpha.5" - boxen "^4.1.0" - case-sensitive-paths-webpack-plugin "^2.2.0" - chalk "^3.0.0" - cli-table3 "0.5.1" - commander "^4.0.1" - core-js "^3.0.1" - corejs-upgrade-webpack-plugin "^2.2.0" - css-loader "^3.0.0" - detect-port "^1.3.0" - dotenv-webpack "^1.7.0" - ejs "^2.7.4" - express "^4.17.0" - file-loader "^4.2.0" - file-system-cache "^1.0.5" - find-cache-dir "^3.0.0" - find-up "^4.1.0" - fs-extra "^8.0.1" - glob-base "^0.3.0" - global "^4.3.2" - html-webpack-plugin "^4.0.0-beta.2" - inquirer "^7.0.0" - interpret "^2.0.0" - ip "^1.1.5" - json5 "^2.1.1" - lazy-universal-dotenv "^3.0.1" - micromatch "^4.0.2" - node-fetch "^2.6.0" - open "^7.0.0" - pnp-webpack-plugin "1.5.0" - postcss-flexbugs-fixes "^4.1.0" - postcss-loader "^3.0.0" - pretty-hrtime "^1.0.3" - qs "^6.6.0" - raw-loader "^3.1.0" - react-dev-utils "^9.0.0" - regenerator-runtime "^0.13.3" - resolve "^1.11.0" - resolve-from "^5.0.0" - semver "^6.0.0" - serve-favicon "^2.5.0" - shelljs "^0.8.3" - style-loader "^1.0.0" - terser-webpack-plugin "^2.1.2" - ts-dedent "^1.1.0" - unfetch "^4.1.0" - url-loader "^2.0.1" - util-deprecate "^1.0.2" - webpack "^4.33.0" - webpack-dev-middleware "^3.7.0" - webpack-hot-middleware "^2.25.0" - webpack-virtual-modules "^0.2.0" - "@storybook/csf@0.0.1": version "0.0.1" resolved "https://registry.yarnpkg.com/@storybook/csf/-/csf-0.0.1.tgz#95901507dc02f0bc6f9ac8ee1983e2fc5bb98ce6" @@ -4008,17 +3684,6 @@ remark-lint "^6.0.4" remark-preset-lint-recommended "^3.0.2" -"@storybook/node-logger@5.3.0-rc.7": - version "5.3.0-rc.7" - resolved "https://registry.yarnpkg.com/@storybook/node-logger/-/node-logger-5.3.0-rc.7.tgz#2a02c2f0cc4468e8f03a1ec98263b25299ef191d" - integrity sha512-drt8kLMeO+wnPfQ3TDVXbCP4ej5Ofli/pTS0bqVAb8/PMSot9YiZYSh/0mfChYM1RveP06KksUgGG5QTqzseBA== - dependencies: - chalk "^3.0.0" - core-js "^3.0.1" - npmlog "^4.1.2" - pretty-hrtime "^1.0.3" - regenerator-runtime "^0.13.3" - "@storybook/node-logger@^5.2.0": version "5.3.9" resolved "https://registry.yarnpkg.com/@storybook/node-logger/-/node-logger-5.3.9.tgz#5de49697b5e2565a4a84bd56244a424368f5e726" @@ -4069,20 +3734,6 @@ emotion-theming "^10.0.19" react-native-swipe-gestures "^1.0.4" -"@storybook/router@5.3.0-rc.7": - version "5.3.0-rc.7" - resolved "https://registry.yarnpkg.com/@storybook/router/-/router-5.3.0-rc.7.tgz#fa069824f007bc304ccf036c2923a2fb84e4f8e7" - integrity sha512-GFdqdJiNAa98ynRDwWyJ0zcScCbje2iipG+bhJk4VMm8FAiYTH7KKDKFfUt4qXcLb14kbug/BQ5HjVzvNEEYIA== - dependencies: - "@reach/router" "^1.2.1" - "@storybook/csf" "0.0.1" - "@types/reach__router" "^1.2.3" - core-js "^3.0.1" - global "^4.3.2" - lodash "^4.17.15" - memoizerific "^1.11.3" - qs "^6.6.0" - "@storybook/router@6.0.0-alpha.0": version "6.0.0-alpha.0" resolved "https://registry.yarnpkg.com/@storybook/router/-/router-6.0.0-alpha.0.tgz#c2b9da6c7eba0dccf32228a72e23ecf8875aacac" @@ -4098,24 +3749,6 @@ qs "^6.6.0" util-deprecate "^1.0.2" -"@storybook/theming@5.3.0-rc.7": - version "5.3.0-rc.7" - resolved "https://registry.yarnpkg.com/@storybook/theming/-/theming-5.3.0-rc.7.tgz#15de449c587f39b1d700458c1dc4d2e2545e380b" - integrity sha512-rJUhuYacumHNzU9X7P6DbiRivLpsOuFw1xRWcLXNMkm1TJ9ZrnrlxO7jbxfUk8Y3M52S/tFr9di72cnFEMozWQ== - dependencies: - "@emotion/core" "^10.0.20" - "@emotion/styled" "^10.0.17" - "@storybook/client-logger" "5.3.0-rc.7" - core-js "^3.0.1" - deep-object-diff "^1.1.0" - emotion-theming "^10.0.19" - global "^4.3.2" - memoizerific "^1.11.3" - polished "^3.3.1" - prop-types "^15.7.2" - resolve-from "^5.0.0" - ts-dedent "^1.1.0" - "@storybook/theming@6.0.0-alpha.0": version "6.0.0-alpha.0" resolved "https://registry.yarnpkg.com/@storybook/theming/-/theming-6.0.0-alpha.0.tgz#0a9580cecb1c9609e070c8db7737bd121faf56c3" @@ -4135,46 +3768,6 @@ resolve-from "^5.0.0" ts-dedent "^1.1.0" -"@storybook/ui@5.3.0-rc.7": - version "5.3.0-rc.7" - resolved "https://registry.yarnpkg.com/@storybook/ui/-/ui-5.3.0-rc.7.tgz#39a27275c68e554f0be94022f0a7402fbcd5f09b" - integrity sha512-UzHBvO8lqziBKYoopSCOaQf/0yL7FQTk9uhvj7jNGXCbQXaVSNsnzdhIPmwA9TLl1bUBIYJpALSPW0KBS+rnAw== - dependencies: - "@emotion/core" "^10.0.20" - "@storybook/addons" "5.3.0-rc.7" - "@storybook/api" "5.3.0-rc.7" - "@storybook/channels" "5.3.0-rc.7" - "@storybook/client-logger" "5.3.0-rc.7" - "@storybook/components" "5.3.0-rc.7" - "@storybook/core-events" "5.3.0-rc.7" - "@storybook/router" "5.3.0-rc.7" - "@storybook/theming" "5.3.0-rc.7" - copy-to-clipboard "^3.0.8" - core-js "^3.0.1" - core-js-pure "^3.0.1" - emotion-theming "^10.0.19" - fast-deep-equal "^2.0.1" - fuse.js "^3.4.6" - global "^4.3.2" - lodash "^4.17.15" - markdown-to-jsx "^6.9.3" - memoizerific "^1.11.3" - polished "^3.3.1" - prop-types "^15.7.2" - qs "^6.6.0" - react "^16.8.3" - react-dom "^16.8.3" - react-draggable "^4.0.3" - react-helmet-async "^1.0.2" - react-hotkeys "2.0.0" - react-sizeme "^2.6.7" - regenerator-runtime "^0.13.2" - resolve-from "^5.0.0" - semver "^6.0.0" - store2 "^2.7.1" - telejson "^3.2.0" - util-deprecate "^1.0.2" - "@stroncium/procfs@^1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@stroncium/procfs/-/procfs-1.0.0.tgz#b7989b3783070e1bc2f25cba7d4eab17e607f770" @@ -4793,13 +4386,6 @@ "@types/react-dom" "*" "@types/react-transition-group" "*" -"@types/react-syntax-highlighter@11.0.2": - version "11.0.2" - resolved "https://registry.yarnpkg.com/@types/react-syntax-highlighter/-/react-syntax-highlighter-11.0.2.tgz#a2e3ff657d7c47813f80ca930f3d959c31ec51e3" - integrity sha512-iMNcixH8330f2dq0RY+VOXCP8JFehgmOhLOtnO85Ty+qu0fHXJNEqWx5VuFv8v0aEq0U/N9d/k1yvA+c6PEmPw== - dependencies: - "@types/react" "*" - "@types/react-syntax-highlighter@^11.0.2", "@types/react-syntax-highlighter@^11.0.4": version "11.0.4" resolved "https://registry.yarnpkg.com/@types/react-syntax-highlighter/-/react-syntax-highlighter-11.0.4.tgz#d86d17697db62f98046874f62fdb3e53a0bbc4cd" @@ -10193,14 +9779,6 @@ core-util-is@1.0.2, core-util-is@~1.0.0: resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= -corejs-upgrade-webpack-plugin@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/corejs-upgrade-webpack-plugin/-/corejs-upgrade-webpack-plugin-2.2.0.tgz#503293bf1fdcb104918eb40d0294e4776ad6923a" - integrity sha512-J0QMp9GNoiw91Kj/dkIQFZeiCXgXoja/Wlht1SPybxerBWh4NCmb0pOgCv61lrlQZETwvVVfAFAA3IqoEO9aqQ== - dependencies: - resolve-from "^5.0.0" - webpack "^4.38.0" - corejs-upgrade-webpack-plugin@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/corejs-upgrade-webpack-plugin/-/corejs-upgrade-webpack-plugin-3.0.1.tgz#40b2ec86ebc7fc92cde78bb64080d2c08e7ef340" @@ -11770,7 +11348,7 @@ ee-first@1.1.1: resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= -ejs@^2.6.1, ejs@^2.7.4: +ejs@^2.6.1: version "2.7.4" resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.7.4.tgz#48661287573dcc53e366c7a1ae52c3a120eec9ba" integrity sha512-7vmuyh5+kuUyJKePhQfRQBhXV5Ce+RnaeeQArKu1EAMpL3WbgMt5WG6uQZpEVvYSSsxMXRKOewtDk9RaTKXRlA== @@ -13827,7 +13405,7 @@ file-loader@4.2.0: loader-utils "^1.2.3" schema-utils "^2.0.0" -file-loader@4.3.0, file-loader@^4.2.0, file-loader@~4.3.0: +file-loader@4.3.0, file-loader@~4.3.0: version "4.3.0" resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-4.3.0.tgz#780f040f729b3d18019f20605f723e844b8a58af" integrity sha512-aKrYPYjF1yG3oX0kWRrqrSMfgftm7oJW5M+m4owoldH5C51C0RkIwB++JbRvEW3IU6/ZG5n8UvEcdgwOt2UOWA== @@ -24777,7 +24355,7 @@ raw-body@~1.1.0: bytes "1" string_decoder "0.10" -raw-loader@3.1.0, raw-loader@^3.1.0: +raw-loader@3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/raw-loader/-/raw-loader-3.1.0.tgz#5e9d399a5a222cc0de18f42c3bc5e49677532b3f" integrity sha512-lzUVMuJ06HF4rYveaz9Tv0WRlUMxJ0Y1hgSkkgg+50iEdaI0TthyEDe08KIHb0XsF6rn8WYTqPCaGTZg3sX+qA== @@ -24974,7 +24552,7 @@ react-dev-utils@^10.0.0: strip-ansi "5.2.0" text-table "0.2.0" -react-dev-utils@^9.0.0, react-dev-utils@^9.0.1, react-dev-utils@^9.0.4, react-dev-utils@^9.1.0: +react-dev-utils@^9.0.1, react-dev-utils@^9.0.4, react-dev-utils@^9.1.0: version "9.1.0" resolved "https://registry.yarnpkg.com/react-dev-utils/-/react-dev-utils-9.1.0.tgz#3ad2bb8848a32319d760d0a84c56c14bdaae5e81" integrity sha512-X2KYF/lIGyGwP/F/oXgGDF24nxDA2KC4b7AFto+eqzc/t838gpSGiaU8trTqHXOohuLxxc5qi1eDzsl9ucPDpg== @@ -29028,7 +28606,7 @@ terser-webpack-plugin@2.2.1: terser "^4.3.9" webpack-sources "^1.4.3" -terser-webpack-plugin@^2.1.2, terser-webpack-plugin@^2.1.3, terser-webpack-plugin@^2.3.4: +terser-webpack-plugin@^2.1.3, terser-webpack-plugin@^2.3.4: version "2.3.4" resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-2.3.4.tgz#ac045703bd8da0936ce910d8fb6350d0e1dee5fe" integrity sha512-Nv96Nws2R2nrFOpbzF6IxRDpIkkIfmhvOws+IqMvYdFLO7o6wAILWFKONFgaYy8+T4LVz77DQW0f7wOeDEAjrg== @@ -30466,7 +30044,7 @@ url-loader@2.1.0: mime "^2.4.4" schema-utils "^2.0.0" -url-loader@2.3.0, url-loader@^2.0.1: +url-loader@2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/url-loader/-/url-loader-2.3.0.tgz#e0e2ef658f003efb8ca41b0f3ffbf76bab88658b" integrity sha512-goSdg8VY+7nPZKUEChZSEtW5gjbS66USIGCeSJ1OVOJ7Yfuh/36YxCwMi5HVEJh6mqUYOoy3NJ0vlOMrWsSHog==