From 84d87389aaca625872a5b51391efcf5d246bd372 Mon Sep 17 00:00:00 2001 From: Kevin Ross Date: Thu, 28 Sep 2017 17:47:29 -0500 Subject: [PATCH] [flow] Add examples/create-react-app-with-flow https://github.com/callemall/material-ui/issues/8073#issuecomment-332980465 --- .eslintignore | 4 +- docs/src/modules/components/withRoot.js | 3 + docs/src/pages/getting-started/examples.md | 1 + docs/src/pages/guides/flow.md | 16 + .../create-react-app-with-flow/.flowconfig | 36 ++ .../create-react-app-with-flow/.gitignore | 23 + examples/create-react-app-with-flow/README.md | 24 + .../flow-typed/npm/enzyme_vx.x.x.js | 249 +++++++++++ .../flow-typed/npm/flow-bin_v0.x.x.js | 6 + .../npm/jss-preset-default_vx.x.x.js | 53 +++ .../flow-typed/npm/prop-types_v15.x.x.js | 34 ++ .../flow-typed/npm/react-jss_vx.x.x.js | 130 ++++++ .../flow-typed/npm/react-scripts_vx.x.x.js | 165 +++++++ .../flow-typed/npm/recompose_vx.x.x.js | 423 ++++++++++++++++++ .../flow/webpack.js | 5 + .../create-react-app-with-flow/package.json | 26 ++ .../public/favicon.ico | Bin 0 -> 24838 bytes .../public/index.html | 39 ++ .../public/manifest.json | 15 + .../src/components/withRoot.js | 60 +++ .../create-react-app-with-flow/src/index.js | 7 + .../src/pages/index.js | 77 ++++ .../src/styles/createContext.js | 32 ++ pages/guides/flow.js | 12 + 24 files changed, 1438 insertions(+), 2 deletions(-) create mode 100644 docs/src/pages/guides/flow.md create mode 100644 examples/create-react-app-with-flow/.flowconfig create mode 100644 examples/create-react-app-with-flow/.gitignore create mode 100644 examples/create-react-app-with-flow/README.md create mode 100644 examples/create-react-app-with-flow/flow-typed/npm/enzyme_vx.x.x.js create mode 100644 examples/create-react-app-with-flow/flow-typed/npm/flow-bin_v0.x.x.js create mode 100644 examples/create-react-app-with-flow/flow-typed/npm/jss-preset-default_vx.x.x.js create mode 100644 examples/create-react-app-with-flow/flow-typed/npm/prop-types_v15.x.x.js create mode 100644 examples/create-react-app-with-flow/flow-typed/npm/react-jss_vx.x.x.js create mode 100644 examples/create-react-app-with-flow/flow-typed/npm/react-scripts_vx.x.x.js create mode 100644 examples/create-react-app-with-flow/flow-typed/npm/recompose_vx.x.x.js create mode 100644 examples/create-react-app-with-flow/flow/webpack.js create mode 100644 examples/create-react-app-with-flow/package.json create mode 100644 examples/create-react-app-with-flow/public/favicon.ico create mode 100644 examples/create-react-app-with-flow/public/index.html create mode 100644 examples/create-react-app-with-flow/public/manifest.json create mode 100644 examples/create-react-app-with-flow/src/components/withRoot.js create mode 100644 examples/create-react-app-with-flow/src/index.js create mode 100644 examples/create-react-app-with-flow/src/pages/index.js create mode 100644 examples/create-react-app-with-flow/src/styles/createContext.js create mode 100644 pages/guides/flow.js diff --git a/.eslintignore b/.eslintignore index 18556fa58555dd..b15869f286f2cc 100644 --- a/.eslintignore +++ b/.eslintignore @@ -6,8 +6,8 @@ coverage /next.config.js /docs/src/modules/utils/find.js /docs/export -/flow -/flow-typed +flow +flow-typed /packages/*/lib /packages/material-ui-icons/test/fixtures /packages/material-ui-icons/src diff --git a/docs/src/modules/components/withRoot.js b/docs/src/modules/components/withRoot.js index 89b32b13cf0b85..bc7bd339e1a61d 100644 --- a/docs/src/modules/components/withRoot.js +++ b/docs/src/modules/components/withRoot.js @@ -84,6 +84,9 @@ const pages = [ { pathname: '/guides/comparison', }, + { + pathname: '/guides/flow', + }, ], }, { diff --git a/docs/src/pages/getting-started/examples.md b/docs/src/pages/getting-started/examples.md index aed68e75470650..db4bd22d89369f 100644 --- a/docs/src/pages/getting-started/examples.md +++ b/docs/src/pages/getting-started/examples.md @@ -5,6 +5,7 @@ Are you looking for an example project to get started? We host some example projects. You can find them in our [GitHub repository](https://github.com/callemall/material-ui) under the [`/examples`](https://github.com/callemall/material-ui/tree/v1-beta/examples) folder: - [Create React App](https://github.com/callemall/material-ui/tree/v1-beta/examples/create-react-app) - [Next.js](https://github.com/callemall/material-ui/tree/v1-beta/examples/nextjs) +- [Create React App with Flow](https://github.com/callemall/material-ui/tree/v1-beta/examples/create-react-app-with-flow) The source code for this documentation site is also included in the repository. This is a slightly more complex project. diff --git a/docs/src/pages/guides/flow.md b/docs/src/pages/guides/flow.md new file mode 100644 index 00000000000000..5f9da03ca8382d --- /dev/null +++ b/docs/src/pages/guides/flow.md @@ -0,0 +1,16 @@ +# Flow + +You can add static typing to JavaScript to improve developer productivity and code quality thanks to [Flow](https://github.com/facebook/flow) + +## Installation in your own project + +Have a look at the [Create React App with Flow](https://github.com/callemall/material-ui/tree/v1-beta/examples/create-react-app-with-flow) example. + +1. Copy `.flowconfig` +1. Change `module.name_mapper` to your project name +1. Copy `flow` dir to seed your own local libdefs (in case you need any) +1. `yarn add -D flow-bin` +1. Decide on `enzyme` - flow is expecting it in your `package.json` because `material-ui` includes reusable `test-utils`. If you do not want it, uncomment `L12` in the `.flowconfig` +1. Copy `package.json` script `flow` +1. `flow-typed install` +1. `yarn flow` diff --git a/examples/create-react-app-with-flow/.flowconfig b/examples/create-react-app-with-flow/.flowconfig new file mode 100644 index 00000000000000..c6ef36e3074eb5 --- /dev/null +++ b/examples/create-react-app-with-flow/.flowconfig @@ -0,0 +1,36 @@ +[ignore] +/build/.* +.*/node_modules/editions +.*/node_modules/babel-plugin-flow-react-proptypes +.*/node_modules/babel-plugin-transform-react-remove-prop-types +.*/node_modules/eslint-plugin-jsx-a11y +.*/node_modules/graphql +.*/node_modules/kefir +.*/node_modules/react-event-listener/src + +; Comment this line if you do not use enzyme. +.*/node_modules/material-ui/test-utils + +; flow 55 +; FIXME: we should be flow checking against jss +.*/node_modules/jss/lib/.*\.js\.flow + +[include] + +[libs] +# local/custom libdefs +./flow +;./node_modules/jss/flow-typed + +[options] +esproposal.class_static_fields=enable +esproposal.class_instance_fields=enable +esproposal.export_star_as=enable +esproposal.decorators=ignore + +unsafe.enable_getters_and_setters=true + +module.name_mapper='^flow-example-material-ui\/\(.*\)$' -> '/src/\1' + +suppress_type=$FlowFixMe +suppress_comment= \\(.\\|\n\\)*\\$FlowFixMe diff --git a/examples/create-react-app-with-flow/.gitignore b/examples/create-react-app-with-flow/.gitignore new file mode 100644 index 00000000000000..1d25a2dee96ac3 --- /dev/null +++ b/examples/create-react-app-with-flow/.gitignore @@ -0,0 +1,23 @@ +# See https://help.github.com/ignore-files/ for more about ignoring files. + +# dependencies +/node_modules + +# testing +/coverage + +# production +/build + +# misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +yarn.lock diff --git a/examples/create-react-app-with-flow/README.md b/examples/create-react-app-with-flow/README.md new file mode 100644 index 00000000000000..58dc9f28512402 --- /dev/null +++ b/examples/create-react-app-with-flow/README.md @@ -0,0 +1,24 @@ +# Create React App example with Flow + +## How to use + +Download the example [or clone the repo](https://github.com/callemall/material-ui): + +```bash +curl https://codeload.github.com/callemall/material-ui/tar.gz/v1-beta | tar -xz --strip=2 material-ui-1-beta/examples/create-react-app-with-flow +cd create-react-app-with-flow +``` + +Install it and run: + +```bash +yarn install +yarn global add flow-typed +flow-typed install +yarn flow +yarn start +``` + +## The idea behind the example + +This example demonstrate how you can use [Create React App](https://github.com/facebookincubator/create-react-app) with [Flow](https://github.com/facebook/flow). diff --git a/examples/create-react-app-with-flow/flow-typed/npm/enzyme_vx.x.x.js b/examples/create-react-app-with-flow/flow-typed/npm/enzyme_vx.x.x.js new file mode 100644 index 00000000000000..d6fcd6b2a03bc6 --- /dev/null +++ b/examples/create-react-app-with-flow/flow-typed/npm/enzyme_vx.x.x.js @@ -0,0 +1,249 @@ +// flow-typed signature: aeca26121e9f8555aa262114d701f021 +// flow-typed version: <>/enzyme_v^3.0.0/flow_v0.55.0 + +/** + * This is an autogenerated libdef stub for: + * + * 'enzyme' + * + * Fill this stub out by replacing all the `any` types. + * + * Once filled out, we encourage you to share your work with the + * community by sending a pull request to: + * https://github.com/flowtype/flow-typed + */ + +declare module 'enzyme' { + declare module.exports: any; +} + +/** + * We include stubs for each file inside this npm package in case you need to + * require those files directly. Feel free to delete any files that aren't + * needed. + */ +declare module 'enzyme/build/configuration' { + declare module.exports: any; +} + +declare module 'enzyme/build/Debug' { + declare module.exports: any; +} + +declare module 'enzyme/build/EnzymeAdapter' { + declare module.exports: any; +} + +declare module 'enzyme/build/index' { + declare module.exports: any; +} + +declare module 'enzyme/build/mount' { + declare module.exports: any; +} + +declare module 'enzyme/build/ReactWrapper' { + declare module.exports: any; +} + +declare module 'enzyme/build/render' { + declare module.exports: any; +} + +declare module 'enzyme/build/RSTTraversal' { + declare module.exports: any; +} + +declare module 'enzyme/build/selectors' { + declare module.exports: any; +} + +declare module 'enzyme/build/shallow' { + declare module.exports: any; +} + +declare module 'enzyme/build/ShallowWrapper' { + declare module.exports: any; +} + +declare module 'enzyme/build/Utils' { + declare module.exports: any; +} + +declare module 'enzyme/build/validateAdapter' { + declare module.exports: any; +} + +declare module 'enzyme/mount' { + declare module.exports: any; +} + +declare module 'enzyme/ReactWrapper' { + declare module.exports: any; +} + +declare module 'enzyme/render' { + declare module.exports: any; +} + +declare module 'enzyme/shallow' { + declare module.exports: any; +} + +declare module 'enzyme/ShallowWrapper' { + declare module.exports: any; +} + +declare module 'enzyme/src/configuration' { + declare module.exports: any; +} + +declare module 'enzyme/src/Debug' { + declare module.exports: any; +} + +declare module 'enzyme/src/EnzymeAdapter' { + declare module.exports: any; +} + +declare module 'enzyme/src/index' { + declare module.exports: any; +} + +declare module 'enzyme/src/mount' { + declare module.exports: any; +} + +declare module 'enzyme/src/ReactWrapper' { + declare module.exports: any; +} + +declare module 'enzyme/src/render' { + declare module.exports: any; +} + +declare module 'enzyme/src/RSTTraversal' { + declare module.exports: any; +} + +declare module 'enzyme/src/selectors' { + declare module.exports: any; +} + +declare module 'enzyme/src/shallow' { + declare module.exports: any; +} + +declare module 'enzyme/src/ShallowWrapper' { + declare module.exports: any; +} + +declare module 'enzyme/src/Utils' { + declare module.exports: any; +} + +declare module 'enzyme/src/validateAdapter' { + declare module.exports: any; +} + +declare module 'enzyme/withDom' { + declare module.exports: any; +} + +// Filename aliases +declare module 'enzyme/build/configuration.js' { + declare module.exports: $Exports<'enzyme/build/configuration'>; +} +declare module 'enzyme/build/Debug.js' { + declare module.exports: $Exports<'enzyme/build/Debug'>; +} +declare module 'enzyme/build/EnzymeAdapter.js' { + declare module.exports: $Exports<'enzyme/build/EnzymeAdapter'>; +} +declare module 'enzyme/build/index.js' { + declare module.exports: $Exports<'enzyme/build/index'>; +} +declare module 'enzyme/build/mount.js' { + declare module.exports: $Exports<'enzyme/build/mount'>; +} +declare module 'enzyme/build/ReactWrapper.js' { + declare module.exports: $Exports<'enzyme/build/ReactWrapper'>; +} +declare module 'enzyme/build/render.js' { + declare module.exports: $Exports<'enzyme/build/render'>; +} +declare module 'enzyme/build/RSTTraversal.js' { + declare module.exports: $Exports<'enzyme/build/RSTTraversal'>; +} +declare module 'enzyme/build/selectors.js' { + declare module.exports: $Exports<'enzyme/build/selectors'>; +} +declare module 'enzyme/build/shallow.js' { + declare module.exports: $Exports<'enzyme/build/shallow'>; +} +declare module 'enzyme/build/ShallowWrapper.js' { + declare module.exports: $Exports<'enzyme/build/ShallowWrapper'>; +} +declare module 'enzyme/build/Utils.js' { + declare module.exports: $Exports<'enzyme/build/Utils'>; +} +declare module 'enzyme/build/validateAdapter.js' { + declare module.exports: $Exports<'enzyme/build/validateAdapter'>; +} +declare module 'enzyme/mount.js' { + declare module.exports: $Exports<'enzyme/mount'>; +} +declare module 'enzyme/ReactWrapper.js' { + declare module.exports: $Exports<'enzyme/ReactWrapper'>; +} +declare module 'enzyme/render.js' { + declare module.exports: $Exports<'enzyme/render'>; +} +declare module 'enzyme/shallow.js' { + declare module.exports: $Exports<'enzyme/shallow'>; +} +declare module 'enzyme/ShallowWrapper.js' { + declare module.exports: $Exports<'enzyme/ShallowWrapper'>; +} +declare module 'enzyme/src/configuration.js' { + declare module.exports: $Exports<'enzyme/src/configuration'>; +} +declare module 'enzyme/src/Debug.js' { + declare module.exports: $Exports<'enzyme/src/Debug'>; +} +declare module 'enzyme/src/EnzymeAdapter.js' { + declare module.exports: $Exports<'enzyme/src/EnzymeAdapter'>; +} +declare module 'enzyme/src/index.js' { + declare module.exports: $Exports<'enzyme/src/index'>; +} +declare module 'enzyme/src/mount.js' { + declare module.exports: $Exports<'enzyme/src/mount'>; +} +declare module 'enzyme/src/ReactWrapper.js' { + declare module.exports: $Exports<'enzyme/src/ReactWrapper'>; +} +declare module 'enzyme/src/render.js' { + declare module.exports: $Exports<'enzyme/src/render'>; +} +declare module 'enzyme/src/RSTTraversal.js' { + declare module.exports: $Exports<'enzyme/src/RSTTraversal'>; +} +declare module 'enzyme/src/selectors.js' { + declare module.exports: $Exports<'enzyme/src/selectors'>; +} +declare module 'enzyme/src/shallow.js' { + declare module.exports: $Exports<'enzyme/src/shallow'>; +} +declare module 'enzyme/src/ShallowWrapper.js' { + declare module.exports: $Exports<'enzyme/src/ShallowWrapper'>; +} +declare module 'enzyme/src/Utils.js' { + declare module.exports: $Exports<'enzyme/src/Utils'>; +} +declare module 'enzyme/src/validateAdapter.js' { + declare module.exports: $Exports<'enzyme/src/validateAdapter'>; +} +declare module 'enzyme/withDom.js' { + declare module.exports: $Exports<'enzyme/withDom'>; +} diff --git a/examples/create-react-app-with-flow/flow-typed/npm/flow-bin_v0.x.x.js b/examples/create-react-app-with-flow/flow-typed/npm/flow-bin_v0.x.x.js new file mode 100644 index 00000000000000..c538e2086f1198 --- /dev/null +++ b/examples/create-react-app-with-flow/flow-typed/npm/flow-bin_v0.x.x.js @@ -0,0 +1,6 @@ +// flow-typed signature: 6a5610678d4b01e13bbfbbc62bdaf583 +// flow-typed version: 3817bc6980/flow-bin_v0.x.x/flow_>=v0.25.x + +declare module "flow-bin" { + declare module.exports: string; +} diff --git a/examples/create-react-app-with-flow/flow-typed/npm/jss-preset-default_vx.x.x.js b/examples/create-react-app-with-flow/flow-typed/npm/jss-preset-default_vx.x.x.js new file mode 100644 index 00000000000000..e3c8548928e4ca --- /dev/null +++ b/examples/create-react-app-with-flow/flow-typed/npm/jss-preset-default_vx.x.x.js @@ -0,0 +1,53 @@ +// flow-typed signature: 80f037b2a5143b759b6803da758cefe8 +// flow-typed version: <>/jss-preset-default_v^3.0.0/flow_v0.55.0 + +/** + * This is an autogenerated libdef stub for: + * + * 'jss-preset-default' + * + * Fill this stub out by replacing all the `any` types. + * + * Once filled out, we encourage you to share your work with the + * community by sending a pull request to: + * https://github.com/flowtype/flow-typed + */ + +declare module 'jss-preset-default' { + declare module.exports: any; +} + +/** + * We include stubs for each file inside this npm package in case you need to + * require those files directly. Feel free to delete any files that aren't + * needed. + */ +declare module 'jss-preset-default/dist/jss-preset-default' { + declare module.exports: any; +} + +declare module 'jss-preset-default/dist/jss-preset-default.min' { + declare module.exports: any; +} + +declare module 'jss-preset-default/lib/index' { + declare module.exports: any; +} + +declare module 'jss-preset-default/webpack.config' { + declare module.exports: any; +} + +// Filename aliases +declare module 'jss-preset-default/dist/jss-preset-default.js' { + declare module.exports: $Exports<'jss-preset-default/dist/jss-preset-default'>; +} +declare module 'jss-preset-default/dist/jss-preset-default.min.js' { + declare module.exports: $Exports<'jss-preset-default/dist/jss-preset-default.min'>; +} +declare module 'jss-preset-default/lib/index.js' { + declare module.exports: $Exports<'jss-preset-default/lib/index'>; +} +declare module 'jss-preset-default/webpack.config.js' { + declare module.exports: $Exports<'jss-preset-default/webpack.config'>; +} diff --git a/examples/create-react-app-with-flow/flow-typed/npm/prop-types_v15.x.x.js b/examples/create-react-app-with-flow/flow-typed/npm/prop-types_v15.x.x.js new file mode 100644 index 00000000000000..113b0b5c4f7d0d --- /dev/null +++ b/examples/create-react-app-with-flow/flow-typed/npm/prop-types_v15.x.x.js @@ -0,0 +1,34 @@ +// flow-typed signature: 3eaa1f24c7397b78a7481992d2cddcb2 +// flow-typed version: a1a20d4928/prop-types_v15.x.x/flow_>=v0.41.x + +type $npm$propTypes$ReactPropsCheckType = ( + props: any, + propName: string, + componentName: string, + href?: string) => ?Error; + +declare module 'prop-types' { + declare var array: React$PropType$Primitive>; + declare var bool: React$PropType$Primitive; + declare var func: React$PropType$Primitive; + declare var number: React$PropType$Primitive; + declare var object: React$PropType$Primitive; + declare var string: React$PropType$Primitive; + declare var any: React$PropType$Primitive; + declare var arrayOf: React$PropType$ArrayOf; + declare var element: React$PropType$Primitive; /* TODO */ + declare var instanceOf: React$PropType$InstanceOf; + declare var node: React$PropType$Primitive; /* TODO */ + declare var objectOf: React$PropType$ObjectOf; + declare var oneOf: React$PropType$OneOf; + declare var oneOfType: React$PropType$OneOfType; + declare var shape: React$PropType$Shape; + + declare function checkPropTypes( + propTypes: $Subtype<{[_: $Keys]: $npm$propTypes$ReactPropsCheckType}>, + values: V, + location: string, + componentName: string, + getStack: ?(() => ?string) + ) : void; +} diff --git a/examples/create-react-app-with-flow/flow-typed/npm/react-jss_vx.x.x.js b/examples/create-react-app-with-flow/flow-typed/npm/react-jss_vx.x.x.js new file mode 100644 index 00000000000000..27762ec291bb21 --- /dev/null +++ b/examples/create-react-app-with-flow/flow-typed/npm/react-jss_vx.x.x.js @@ -0,0 +1,130 @@ +// flow-typed signature: b005b00f09e34a66b94e8ba2966ef084 +// flow-typed version: <>/react-jss_v^7.2.0/flow_v0.55.0 + +/** + * This is an autogenerated libdef stub for: + * + * 'react-jss' + * + * Fill this stub out by replacing all the `any` types. + * + * Once filled out, we encourage you to share your work with the + * community by sending a pull request to: + * https://github.com/flowtype/flow-typed + */ + +declare module 'react-jss' { + declare module.exports: any; +} + +/** + * We include stubs for each file inside this npm package in case you need to + * require those files directly. Feel free to delete any files that aren't + * needed. + */ +declare module 'react-jss/dist/react-jss' { + declare module.exports: any; +} + +declare module 'react-jss/dist/react-jss.min' { + declare module.exports: any; +} + +declare module 'react-jss/karma.conf' { + declare module.exports: any; +} + +declare module 'react-jss/lib/compose' { + declare module.exports: any; +} + +declare module 'react-jss/lib/contextTypes' { + declare module.exports: any; +} + +declare module 'react-jss/lib/createHoc' { + declare module.exports: any; +} + +declare module 'react-jss/lib/getDisplayName' { + declare module.exports: any; +} + +declare module 'react-jss/lib/index' { + declare module.exports: any; +} + +declare module 'react-jss/lib/index.test' { + declare module.exports: any; +} + +declare module 'react-jss/lib/injectSheet' { + declare module.exports: any; +} + +declare module 'react-jss/lib/jss' { + declare module.exports: any; +} + +declare module 'react-jss/lib/JssProvider' { + declare module.exports: any; +} + +declare module 'react-jss/lib/ns' { + declare module.exports: any; +} + +declare module 'react-jss/tests.webpack' { + declare module.exports: any; +} + +declare module 'react-jss/webpack.config' { + declare module.exports: any; +} + +// Filename aliases +declare module 'react-jss/dist/react-jss.js' { + declare module.exports: $Exports<'react-jss/dist/react-jss'>; +} +declare module 'react-jss/dist/react-jss.min.js' { + declare module.exports: $Exports<'react-jss/dist/react-jss.min'>; +} +declare module 'react-jss/karma.conf.js' { + declare module.exports: $Exports<'react-jss/karma.conf'>; +} +declare module 'react-jss/lib/compose.js' { + declare module.exports: $Exports<'react-jss/lib/compose'>; +} +declare module 'react-jss/lib/contextTypes.js' { + declare module.exports: $Exports<'react-jss/lib/contextTypes'>; +} +declare module 'react-jss/lib/createHoc.js' { + declare module.exports: $Exports<'react-jss/lib/createHoc'>; +} +declare module 'react-jss/lib/getDisplayName.js' { + declare module.exports: $Exports<'react-jss/lib/getDisplayName'>; +} +declare module 'react-jss/lib/index.js' { + declare module.exports: $Exports<'react-jss/lib/index'>; +} +declare module 'react-jss/lib/index.test.js' { + declare module.exports: $Exports<'react-jss/lib/index.test'>; +} +declare module 'react-jss/lib/injectSheet.js' { + declare module.exports: $Exports<'react-jss/lib/injectSheet'>; +} +declare module 'react-jss/lib/jss.js' { + declare module.exports: $Exports<'react-jss/lib/jss'>; +} +declare module 'react-jss/lib/JssProvider.js' { + declare module.exports: $Exports<'react-jss/lib/JssProvider'>; +} +declare module 'react-jss/lib/ns.js' { + declare module.exports: $Exports<'react-jss/lib/ns'>; +} +declare module 'react-jss/tests.webpack.js' { + declare module.exports: $Exports<'react-jss/tests.webpack'>; +} +declare module 'react-jss/webpack.config.js' { + declare module.exports: $Exports<'react-jss/webpack.config'>; +} diff --git a/examples/create-react-app-with-flow/flow-typed/npm/react-scripts_vx.x.x.js b/examples/create-react-app-with-flow/flow-typed/npm/react-scripts_vx.x.x.js new file mode 100644 index 00000000000000..f661e930640796 --- /dev/null +++ b/examples/create-react-app-with-flow/flow-typed/npm/react-scripts_vx.x.x.js @@ -0,0 +1,165 @@ +// flow-typed signature: d7493248f214f10926d98f8bf99f36fe +// flow-typed version: <>/react-scripts_v^1.0.14/flow_v0.55.0 + +/** + * This is an autogenerated libdef stub for: + * + * 'react-scripts' + * + * Fill this stub out by replacing all the `any` types. + * + * Once filled out, we encourage you to share your work with the + * community by sending a pull request to: + * https://github.com/flowtype/flow-typed + */ + +declare module 'react-scripts' { + declare module.exports: any; +} + +/** + * We include stubs for each file inside this npm package in case you need to + * require those files directly. Feel free to delete any files that aren't + * needed. + */ +declare module 'react-scripts/bin/react-scripts' { + declare module.exports: any; +} + +declare module 'react-scripts/config/env' { + declare module.exports: any; +} + +declare module 'react-scripts/config/jest/babelTransform' { + declare module.exports: any; +} + +declare module 'react-scripts/config/jest/cssTransform' { + declare module.exports: any; +} + +declare module 'react-scripts/config/jest/fileTransform' { + declare module.exports: any; +} + +declare module 'react-scripts/config/paths' { + declare module.exports: any; +} + +declare module 'react-scripts/config/polyfills' { + declare module.exports: any; +} + +declare module 'react-scripts/config/webpack.config.dev' { + declare module.exports: any; +} + +declare module 'react-scripts/config/webpack.config.prod' { + declare module.exports: any; +} + +declare module 'react-scripts/config/webpackDevServer.config' { + declare module.exports: any; +} + +declare module 'react-scripts/scripts/build' { + declare module.exports: any; +} + +declare module 'react-scripts/scripts/eject' { + declare module.exports: any; +} + +declare module 'react-scripts/scripts/init' { + declare module.exports: any; +} + +declare module 'react-scripts/scripts/start' { + declare module.exports: any; +} + +declare module 'react-scripts/scripts/test' { + declare module.exports: any; +} + +declare module 'react-scripts/scripts/utils/createJestConfig' { + declare module.exports: any; +} + +declare module 'react-scripts/template/src/App' { + declare module.exports: any; +} + +declare module 'react-scripts/template/src/App.test' { + declare module.exports: any; +} + +declare module 'react-scripts/template/src/index' { + declare module.exports: any; +} + +declare module 'react-scripts/template/src/registerServiceWorker' { + declare module.exports: any; +} + +// Filename aliases +declare module 'react-scripts/bin/react-scripts.js' { + declare module.exports: $Exports<'react-scripts/bin/react-scripts'>; +} +declare module 'react-scripts/config/env.js' { + declare module.exports: $Exports<'react-scripts/config/env'>; +} +declare module 'react-scripts/config/jest/babelTransform.js' { + declare module.exports: $Exports<'react-scripts/config/jest/babelTransform'>; +} +declare module 'react-scripts/config/jest/cssTransform.js' { + declare module.exports: $Exports<'react-scripts/config/jest/cssTransform'>; +} +declare module 'react-scripts/config/jest/fileTransform.js' { + declare module.exports: $Exports<'react-scripts/config/jest/fileTransform'>; +} +declare module 'react-scripts/config/paths.js' { + declare module.exports: $Exports<'react-scripts/config/paths'>; +} +declare module 'react-scripts/config/polyfills.js' { + declare module.exports: $Exports<'react-scripts/config/polyfills'>; +} +declare module 'react-scripts/config/webpack.config.dev.js' { + declare module.exports: $Exports<'react-scripts/config/webpack.config.dev'>; +} +declare module 'react-scripts/config/webpack.config.prod.js' { + declare module.exports: $Exports<'react-scripts/config/webpack.config.prod'>; +} +declare module 'react-scripts/config/webpackDevServer.config.js' { + declare module.exports: $Exports<'react-scripts/config/webpackDevServer.config'>; +} +declare module 'react-scripts/scripts/build.js' { + declare module.exports: $Exports<'react-scripts/scripts/build'>; +} +declare module 'react-scripts/scripts/eject.js' { + declare module.exports: $Exports<'react-scripts/scripts/eject'>; +} +declare module 'react-scripts/scripts/init.js' { + declare module.exports: $Exports<'react-scripts/scripts/init'>; +} +declare module 'react-scripts/scripts/start.js' { + declare module.exports: $Exports<'react-scripts/scripts/start'>; +} +declare module 'react-scripts/scripts/test.js' { + declare module.exports: $Exports<'react-scripts/scripts/test'>; +} +declare module 'react-scripts/scripts/utils/createJestConfig.js' { + declare module.exports: $Exports<'react-scripts/scripts/utils/createJestConfig'>; +} +declare module 'react-scripts/template/src/App.js' { + declare module.exports: $Exports<'react-scripts/template/src/App'>; +} +declare module 'react-scripts/template/src/App.test.js' { + declare module.exports: $Exports<'react-scripts/template/src/App.test'>; +} +declare module 'react-scripts/template/src/index.js' { + declare module.exports: $Exports<'react-scripts/template/src/index'>; +} +declare module 'react-scripts/template/src/registerServiceWorker.js' { + declare module.exports: $Exports<'react-scripts/template/src/registerServiceWorker'>; +} diff --git a/examples/create-react-app-with-flow/flow-typed/npm/recompose_vx.x.x.js b/examples/create-react-app-with-flow/flow-typed/npm/recompose_vx.x.x.js new file mode 100644 index 00000000000000..52d6f2102b327a --- /dev/null +++ b/examples/create-react-app-with-flow/flow-typed/npm/recompose_vx.x.x.js @@ -0,0 +1,423 @@ +// flow-typed signature: a10a905bc753bb836a4ddff1765fc9fc +// flow-typed version: <>/recompose_v^0.25.1/flow_v0.55.0 + +/** + * This is an autogenerated libdef stub for: + * + * 'recompose' + * + * Fill this stub out by replacing all the `any` types. + * + * Once filled out, we encourage you to share your work with the + * community by sending a pull request to: + * https://github.com/flowtype/flow-typed + */ + +declare module 'recompose' { + declare module.exports: any; +} + +/** + * We include stubs for each file inside this npm package in case you need to + * require those files directly. Feel free to delete any files that aren't + * needed. + */ +declare module 'recompose/baconObservableConfig' { + declare module.exports: any; +} + +declare module 'recompose/branch' { + declare module.exports: any; +} + +declare module 'recompose/build/Recompose' { + declare module.exports: any; +} + +declare module 'recompose/build/Recompose.min' { + declare module.exports: any; +} + +declare module 'recompose/cjs/Recompose' { + declare module.exports: any; +} + +declare module 'recompose/componentFromProp' { + declare module.exports: any; +} + +declare module 'recompose/componentFromStream' { + declare module.exports: any; +} + +declare module 'recompose/compose' { + declare module.exports: any; +} + +declare module 'recompose/createEagerElement' { + declare module.exports: any; +} + +declare module 'recompose/createEagerFactory' { + declare module.exports: any; +} + +declare module 'recompose/createEventHandler' { + declare module.exports: any; +} + +declare module 'recompose/createSink' { + declare module.exports: any; +} + +declare module 'recompose/defaultProps' { + declare module.exports: any; +} + +declare module 'recompose/es/Recompose' { + declare module.exports: any; +} + +declare module 'recompose/flattenProp' { + declare module.exports: any; +} + +declare module 'recompose/flydObservableConfig' { + declare module.exports: any; +} + +declare module 'recompose/getContext' { + declare module.exports: any; +} + +declare module 'recompose/getDisplayName' { + declare module.exports: any; +} + +declare module 'recompose/hoistStatics' { + declare module.exports: any; +} + +declare module 'recompose/isClassComponent' { + declare module.exports: any; +} + +declare module 'recompose/isReferentiallyTransparentFunctionComponent' { + declare module.exports: any; +} + +declare module 'recompose/kefirObservableConfig' { + declare module.exports: any; +} + +declare module 'recompose/lifecycle' { + declare module.exports: any; +} + +declare module 'recompose/mapProps' { + declare module.exports: any; +} + +declare module 'recompose/mapPropsStream' { + declare module.exports: any; +} + +declare module 'recompose/mostObservableConfig' { + declare module.exports: any; +} + +declare module 'recompose/nest' { + declare module.exports: any; +} + +declare module 'recompose/onlyUpdateForKeys' { + declare module.exports: any; +} + +declare module 'recompose/onlyUpdateForPropTypes' { + declare module.exports: any; +} + +declare module 'recompose/pure' { + declare module.exports: any; +} + +declare module 'recompose/renameProp' { + declare module.exports: any; +} + +declare module 'recompose/renameProps' { + declare module.exports: any; +} + +declare module 'recompose/renderComponent' { + declare module.exports: any; +} + +declare module 'recompose/renderNothing' { + declare module.exports: any; +} + +declare module 'recompose/rxjs4ObservableConfig' { + declare module.exports: any; +} + +declare module 'recompose/rxjsObservableConfig' { + declare module.exports: any; +} + +declare module 'recompose/setDisplayName' { + declare module.exports: any; +} + +declare module 'recompose/setObservableConfig' { + declare module.exports: any; +} + +declare module 'recompose/setPropTypes' { + declare module.exports: any; +} + +declare module 'recompose/setStatic' { + declare module.exports: any; +} + +declare module 'recompose/shallowEqual' { + declare module.exports: any; +} + +declare module 'recompose/shouldUpdate' { + declare module.exports: any; +} + +declare module 'recompose/toClass' { + declare module.exports: any; +} + +declare module 'recompose/utils/createEagerElementUtil' { + declare module.exports: any; +} + +declare module 'recompose/utils/mapValues' { + declare module.exports: any; +} + +declare module 'recompose/utils/omit' { + declare module.exports: any; +} + +declare module 'recompose/utils/pick' { + declare module.exports: any; +} + +declare module 'recompose/withContext' { + declare module.exports: any; +} + +declare module 'recompose/withHandlers' { + declare module.exports: any; +} + +declare module 'recompose/withProps' { + declare module.exports: any; +} + +declare module 'recompose/withPropsOnChange' { + declare module.exports: any; +} + +declare module 'recompose/withReducer' { + declare module.exports: any; +} + +declare module 'recompose/withState' { + declare module.exports: any; +} + +declare module 'recompose/withStateHandlers' { + declare module.exports: any; +} + +declare module 'recompose/wrapDisplayName' { + declare module.exports: any; +} + +declare module 'recompose/xstreamObservableConfig' { + declare module.exports: any; +} + +// Filename aliases +declare module 'recompose/baconObservableConfig.js' { + declare module.exports: $Exports<'recompose/baconObservableConfig'>; +} +declare module 'recompose/branch.js' { + declare module.exports: $Exports<'recompose/branch'>; +} +declare module 'recompose/build/Recompose.js' { + declare module.exports: $Exports<'recompose/build/Recompose'>; +} +declare module 'recompose/build/Recompose.min.js' { + declare module.exports: $Exports<'recompose/build/Recompose.min'>; +} +declare module 'recompose/cjs/Recompose.js' { + declare module.exports: $Exports<'recompose/cjs/Recompose'>; +} +declare module 'recompose/componentFromProp.js' { + declare module.exports: $Exports<'recompose/componentFromProp'>; +} +declare module 'recompose/componentFromStream.js' { + declare module.exports: $Exports<'recompose/componentFromStream'>; +} +declare module 'recompose/compose.js' { + declare module.exports: $Exports<'recompose/compose'>; +} +declare module 'recompose/createEagerElement.js' { + declare module.exports: $Exports<'recompose/createEagerElement'>; +} +declare module 'recompose/createEagerFactory.js' { + declare module.exports: $Exports<'recompose/createEagerFactory'>; +} +declare module 'recompose/createEventHandler.js' { + declare module.exports: $Exports<'recompose/createEventHandler'>; +} +declare module 'recompose/createSink.js' { + declare module.exports: $Exports<'recompose/createSink'>; +} +declare module 'recompose/defaultProps.js' { + declare module.exports: $Exports<'recompose/defaultProps'>; +} +declare module 'recompose/es/Recompose.js' { + declare module.exports: $Exports<'recompose/es/Recompose'>; +} +declare module 'recompose/flattenProp.js' { + declare module.exports: $Exports<'recompose/flattenProp'>; +} +declare module 'recompose/flydObservableConfig.js' { + declare module.exports: $Exports<'recompose/flydObservableConfig'>; +} +declare module 'recompose/getContext.js' { + declare module.exports: $Exports<'recompose/getContext'>; +} +declare module 'recompose/getDisplayName.js' { + declare module.exports: $Exports<'recompose/getDisplayName'>; +} +declare module 'recompose/hoistStatics.js' { + declare module.exports: $Exports<'recompose/hoistStatics'>; +} +declare module 'recompose/index' { + declare module.exports: $Exports<'recompose'>; +} +declare module 'recompose/index.js' { + declare module.exports: $Exports<'recompose'>; +} +declare module 'recompose/isClassComponent.js' { + declare module.exports: $Exports<'recompose/isClassComponent'>; +} +declare module 'recompose/isReferentiallyTransparentFunctionComponent.js' { + declare module.exports: $Exports<'recompose/isReferentiallyTransparentFunctionComponent'>; +} +declare module 'recompose/kefirObservableConfig.js' { + declare module.exports: $Exports<'recompose/kefirObservableConfig'>; +} +declare module 'recompose/lifecycle.js' { + declare module.exports: $Exports<'recompose/lifecycle'>; +} +declare module 'recompose/mapProps.js' { + declare module.exports: $Exports<'recompose/mapProps'>; +} +declare module 'recompose/mapPropsStream.js' { + declare module.exports: $Exports<'recompose/mapPropsStream'>; +} +declare module 'recompose/mostObservableConfig.js' { + declare module.exports: $Exports<'recompose/mostObservableConfig'>; +} +declare module 'recompose/nest.js' { + declare module.exports: $Exports<'recompose/nest'>; +} +declare module 'recompose/onlyUpdateForKeys.js' { + declare module.exports: $Exports<'recompose/onlyUpdateForKeys'>; +} +declare module 'recompose/onlyUpdateForPropTypes.js' { + declare module.exports: $Exports<'recompose/onlyUpdateForPropTypes'>; +} +declare module 'recompose/pure.js' { + declare module.exports: $Exports<'recompose/pure'>; +} +declare module 'recompose/renameProp.js' { + declare module.exports: $Exports<'recompose/renameProp'>; +} +declare module 'recompose/renameProps.js' { + declare module.exports: $Exports<'recompose/renameProps'>; +} +declare module 'recompose/renderComponent.js' { + declare module.exports: $Exports<'recompose/renderComponent'>; +} +declare module 'recompose/renderNothing.js' { + declare module.exports: $Exports<'recompose/renderNothing'>; +} +declare module 'recompose/rxjs4ObservableConfig.js' { + declare module.exports: $Exports<'recompose/rxjs4ObservableConfig'>; +} +declare module 'recompose/rxjsObservableConfig.js' { + declare module.exports: $Exports<'recompose/rxjsObservableConfig'>; +} +declare module 'recompose/setDisplayName.js' { + declare module.exports: $Exports<'recompose/setDisplayName'>; +} +declare module 'recompose/setObservableConfig.js' { + declare module.exports: $Exports<'recompose/setObservableConfig'>; +} +declare module 'recompose/setPropTypes.js' { + declare module.exports: $Exports<'recompose/setPropTypes'>; +} +declare module 'recompose/setStatic.js' { + declare module.exports: $Exports<'recompose/setStatic'>; +} +declare module 'recompose/shallowEqual.js' { + declare module.exports: $Exports<'recompose/shallowEqual'>; +} +declare module 'recompose/shouldUpdate.js' { + declare module.exports: $Exports<'recompose/shouldUpdate'>; +} +declare module 'recompose/toClass.js' { + declare module.exports: $Exports<'recompose/toClass'>; +} +declare module 'recompose/utils/createEagerElementUtil.js' { + declare module.exports: $Exports<'recompose/utils/createEagerElementUtil'>; +} +declare module 'recompose/utils/mapValues.js' { + declare module.exports: $Exports<'recompose/utils/mapValues'>; +} +declare module 'recompose/utils/omit.js' { + declare module.exports: $Exports<'recompose/utils/omit'>; +} +declare module 'recompose/utils/pick.js' { + declare module.exports: $Exports<'recompose/utils/pick'>; +} +declare module 'recompose/withContext.js' { + declare module.exports: $Exports<'recompose/withContext'>; +} +declare module 'recompose/withHandlers.js' { + declare module.exports: $Exports<'recompose/withHandlers'>; +} +declare module 'recompose/withProps.js' { + declare module.exports: $Exports<'recompose/withProps'>; +} +declare module 'recompose/withPropsOnChange.js' { + declare module.exports: $Exports<'recompose/withPropsOnChange'>; +} +declare module 'recompose/withReducer.js' { + declare module.exports: $Exports<'recompose/withReducer'>; +} +declare module 'recompose/withState.js' { + declare module.exports: $Exports<'recompose/withState'>; +} +declare module 'recompose/withStateHandlers.js' { + declare module.exports: $Exports<'recompose/withStateHandlers'>; +} +declare module 'recompose/wrapDisplayName.js' { + declare module.exports: $Exports<'recompose/wrapDisplayName'>; +} +declare module 'recompose/xstreamObservableConfig.js' { + declare module.exports: $Exports<'recompose/xstreamObservableConfig'>; +} diff --git a/examples/create-react-app-with-flow/flow/webpack.js b/examples/create-react-app-with-flow/flow/webpack.js new file mode 100644 index 00000000000000..9f1b90f048051f --- /dev/null +++ b/examples/create-react-app-with-flow/flow/webpack.js @@ -0,0 +1,5 @@ +declare var module : { + hot : { + accept(path:string, callback:() => void): void; + }; +}; diff --git a/examples/create-react-app-with-flow/package.json b/examples/create-react-app-with-flow/package.json new file mode 100644 index 00000000000000..b652ccf15f2d6c --- /dev/null +++ b/examples/create-react-app-with-flow/package.json @@ -0,0 +1,26 @@ +{ + "name": "create-react-app-with-flow", + "version": "1.0.0", + "private": true, + "dependencies": { + "jss": "latest", + "jss-preset-default": "latest", + "material-ui": "next", + "prop-types": "latest", + "react": "latest", + "react-dom": "latest", + "react-jss": "latest", + "react-scripts": "latest", + "recompose": "latest" + }, + "devDependencies": { + "enzyme": "latest", + "flow-bin": "latest" + }, + "scripts": { + "start": "react-scripts start", + "build": "react-scripts build", + "test": "react-scripts test --env=jsdom", + "eject": "react-scripts eject" + } +} diff --git a/examples/create-react-app-with-flow/public/favicon.ico b/examples/create-react-app-with-flow/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..5c125de5d897c1ff5692a656485b3216123dcd89 GIT binary patch literal 24838 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 + + + + + + + + + + + + My page + + +
+ + + diff --git a/examples/create-react-app-with-flow/public/manifest.json b/examples/create-react-app-with-flow/public/manifest.json new file mode 100644 index 00000000000000..be607e41771912 --- /dev/null +++ b/examples/create-react-app-with-flow/public/manifest.json @@ -0,0 +1,15 @@ +{ + "short_name": "React App", + "name": "Create React App Sample", + "icons": [ + { + "src": "favicon.ico", + "sizes": "192x192", + "type": "image/png" + } + ], + "start_url": "./index.html", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/examples/create-react-app-with-flow/src/components/withRoot.js b/examples/create-react-app-with-flow/src/components/withRoot.js new file mode 100644 index 00000000000000..8e0a8e4ca918f2 --- /dev/null +++ b/examples/create-react-app-with-flow/src/components/withRoot.js @@ -0,0 +1,60 @@ +// @flow + +import React, { Component } from 'react'; +import type { ComponentType } from 'react'; +import JssProvider from 'react-jss/lib/JssProvider'; +import { withStyles, MuiThemeProvider } from 'material-ui/styles'; +import wrapDisplayName from 'recompose/wrapDisplayName'; +import createContext from '../styles/createContext'; + +// Apply some reset +const styles = theme => ({ + '@global': { + html: { + background: theme.palette.background.default, + WebkitFontSmoothing: 'antialiased', // Antialiasing. + MozOsxFontSmoothing: 'grayscale', // Antialiasing. + }, + body: { + margin: 0, + }, + }, +}); + +let AppWrapper = props => props.children; + +AppWrapper = withStyles(styles)(AppWrapper); + +const context = createContext(); + +function withRoot(BaseComponent: ComponentType<*>) { + class WithRoot extends Component<{}> { + componentDidMount() { + // Remove the server-side injected CSS. + const jssStyles = document.querySelector('#jss-server-side'); + if (jssStyles && jssStyles.parentNode) { + jssStyles.parentNode.removeChild(jssStyles); + } + } + + render() { + return ( + + + + + + + + ); + } + } + + if (process.env.NODE_ENV !== 'production') { + WithRoot.displayName = wrapDisplayName(BaseComponent, 'withRoot'); + } + + return WithRoot; +} + +export default withRoot; diff --git a/examples/create-react-app-with-flow/src/index.js b/examples/create-react-app-with-flow/src/index.js new file mode 100644 index 00000000000000..4e840adf40f178 --- /dev/null +++ b/examples/create-react-app-with-flow/src/index.js @@ -0,0 +1,7 @@ +// @flow + +import React from 'react'; +import { render } from 'react-dom'; +import Index from './pages/index'; + +render(, document.querySelector('#root')); diff --git a/examples/create-react-app-with-flow/src/pages/index.js b/examples/create-react-app-with-flow/src/pages/index.js new file mode 100644 index 00000000000000..1e0f9e8a4e42d0 --- /dev/null +++ b/examples/create-react-app-with-flow/src/pages/index.js @@ -0,0 +1,77 @@ +// @flow + +import React, { Component } from 'react'; +import Button from 'material-ui/Button'; +import Dialog, { + DialogTitle, + DialogContent, + DialogContentText, + DialogActions, +} from 'material-ui/Dialog'; +import Typography from 'material-ui/Typography'; +import withStyles from 'material-ui/styles/withStyles'; +import withRoot from '../components/withRoot'; + +const styles = { + root: { + textAlign: 'center', + paddingTop: 200, + }, +}; + +type DefaultProps = { + classes: Object, +}; + +export type Props = {}; + +type State = { + open: boolean, +}; + +class Index extends Component { + state = { + open: false, + }; + + handleRequestClose = () => { + this.setState({ + open: false, + }); + }; + + handleClick = () => { + this.setState({ + open: true, + }); + }; + + render() { + return ( +
+ + Super Secret Password + + 1-2-3-4-5 + + + + + + + Material-UI + + + example project + + +
+ ); + } +} + +export default withRoot(withStyles(styles)(Index)); diff --git a/examples/create-react-app-with-flow/src/styles/createContext.js b/examples/create-react-app-with-flow/src/styles/createContext.js new file mode 100644 index 00000000000000..3c80609016248c --- /dev/null +++ b/examples/create-react-app-with-flow/src/styles/createContext.js @@ -0,0 +1,32 @@ +// @flow + +import { create } from 'jss'; +import preset from 'jss-preset-default'; +import { SheetsRegistry } from 'react-jss/lib/jss'; +import { createMuiTheme } from 'material-ui/styles'; +import { purple, green } from 'material-ui/colors'; +import createGenerateClassName from 'material-ui/styles/createGenerateClassName'; + +const theme = createMuiTheme({ + palette: { + primary: purple, + secondary: green, + }, +}); + +// Configure JSS +const jss = create(preset()); +jss.options.createGenerateClassName = createGenerateClassName; + +export const sheetsManager: Map<*, *> = new Map(); + +export default function createContext() { + return { + jss, + theme, + // This is needed in order to deduplicate the injection of CSS in the page. + sheetsManager, + // This is needed in order to inject the critical CSS. + sheetsRegistry: new SheetsRegistry(), + }; +} diff --git a/pages/guides/flow.js b/pages/guides/flow.js new file mode 100644 index 00000000000000..95d7497d98d42a --- /dev/null +++ b/pages/guides/flow.js @@ -0,0 +1,12 @@ +// @flow + +import React from 'react'; +import withRoot from 'docs/src/modules/components/withRoot'; +import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs'; +import markdown from 'docs/src/pages/guides/flow.md'; + +function Page() { + return ; +} + +export default withRoot(Page);