{"x0":{"title":"Compositor x0","basename":"/x0"},"ava":{"babel":{"plugins":["transform-runtime"],"presets":["env","stage-0","react"]},"files":["test/*","!test/components","!test/output"],"require":["babel-register"]},"bin":{"x0":"cli.js"},"bugs":{"url":"https://github.com/c8r/x0/issues"},"dist":{"shasum":"adf5d5b44dbfa01dcf99fc307e2083681cf0818c","tarball":"https://registry.npmjs.org/@compositor/x0/-/x0-5.0.0-9.tgz","fileCount":11,"integrity":"sha512-NDf/ma6BBtcXhHk5dcGk7WDtThKYJdgItbNRe7cSOkLOccO3Svr7LD7ZCh4dz3f+8/b736LRQw38IE63uuB/8A==","signatures":[{"sig":"MEUCIQCdp7QMy6/FkPWHVLtnE+lrj5k7YNZAm8cGzm3Z7O1f/AIgcvymCedrJE1M1Q0TL4jCggi8NwpHKWLAyhN4f2BtnAQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26729,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbA57lCRA9TVsSAnZWagAAGN0P/RvKBN8g7EBXl+xRHVHW\nR0F+UMWxKGovjJWbuVhBiBtabN1ENRlEm63Ke5O+FXfa+fJiDB/F18hxx82h\nxI6qeXDWa/aDnurPdgoWnCNMkvYLSZf2dEC4IjAVxVRdM7vzwiHt2w3AxJ/l\ny6qqIqYsdbGWhV9jj9ujTHm28m+dk9+AyIxVSLOgGax18V4DclkwEtO1dJdi\nUwpeyvGKL3Mh5j5kCiGQpGTZgFJhn3cgP38cYDRFX6T6r2tPEHI8FpuN1zvX\nHJyxOKu6hpLl6dWr2+T3qttZYinlbYrfyR2sP6cn8bnZHzJ8jtylOPCiSkH6\nJZ3/m0+woXYVFA8N/BKgtVDplkFc+/wQh6y3kZ4oyuz7vszqhwz38E/z2S37\nv8bLnJNOv3VUm1Hueg/PSKllVQjBk3z7v7jaYqdDfLU88brwB+qBFnaPr/fV\nostRYMUpwgvAgbeeTcfu418lOCIes/2ndOuzO0KbXeP3Fu15aAcUQuPs+A9J\nEgr1um0fVcb0fe/hjTDTiRCKOyq0b6sOdTeSMqS1JThYD7K0EzV2RQ9dKHAX\nBFborIjluUzer3UGnMbSK/8Ch1mCiEwmtFn4DmFfd/U33taetEtDcGrwzg1q\nDnEx+uo+WKLRBElJUFuZWfhTH+9W1pBeRX1Jh22cQo9BnFEq5u+QG5/64ONA\nV1Yq\r\n=lCzN\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","name":"@compositor/x0","author":{"name":"Brent Jackson"},"readme":"\n# x0\n\nZero-config React development environment and static site generator\n\n[![Build Status][build-badge]][build]\n\n```sh\nnpm install -g @compositor/x0\n```\n\n[build-badge]: https://img.shields.io/travis/c8r/x0/master.svg?style=flat-square\n[build]: https://travis-ci.org/c8r/x0\n\n![screen-demo](docs/demo.gif)\n\n## Features\n\n- Zero-config\n- Hot-loading development environment\n- Works with virtually any React component\\*\n- No confusing APIs\n- Automatic file system based routing\n- Exports static HTML\n- Exports JS bundles\n- Works with CSS-in-JS libraries like [styled-components][sc] and [emotion][emotion]\n- Support for async data fetching\n\n\\* Custom [webpack configuration](#webpack) is required for components that rely on webpack-based features\n\n\n## Isolated development environment\n\n```sh\nx0 components\n```\n\nOptions:\n\n```\n-o --open       Open dev server in default browser\n-p --port       Custom port for dev server\n-t --template   Path to custom HTML template\n--webpack       Path to custom webpack configuration\n```\n\n```sh\nx0 components -op 8080\n```\n\n\n## Static Build\n\nExport static HTML and client-side bundle\n\n```sh\nx0 build components\n```\n\nExport static HTML without bundle\n\n```sh\nx0 build components --static\n```\n\nOptions\n\n```\n-d --out-dir    Output directory (default dist)\n-s --static     Output static HTML without JS bundle\n-t --template   Path to custom HTML template\n--webpack       Path to custom webpack configuration\n```\n\n\n## Fetching Data\n\nUse the async `getInitialProps` static method to fetch data for static rendering.\nThis method was inspired by [Next.js][nextjs].\n\n```jsx\nconst Index = props => (\n  <h1>Hello {props.data}</h1>\n)\n\nIndex.getInitialProps = async () => {\n  const fetch = require('isomorphic-fetch')\n  const res = await fetch('http://example.com/data')\n  const data = await res.json()\n\n  return { data }\n}\n```\n\n## Custom App\n\nA custom `App` component can be provided by including an `_app.js` file.\nThe `App` component uses the [render props][render-props] pattern to provide additional state and props to its child routes.\n\n[render-props]: https://reactjs.org/docs/render-props.html\n\n```jsx\n// example _app.js\nimport React from 'react'\n\nexport default class extends React.Component {\n  state = {\n    count: 0\n  }\n\n  update = fn => this.setState(fn)\n\n  render () {\n    const { render, routes } = this.props\n\n    return render({\n      ...this.state,\n      decrement: () => this.update(s => ({ count: s.count - 1 })),\n      increment: () => this.update(s => ({ count: s.count + 1 }))\n    })\n  }\n}\n```\n\n### Layouts\n\nThe `App` component can also be used to provide a common layout for all routes.\n\n```jsx\n// example _app.js\nimport React from 'react'\nimport Nav from '../components/Nav'\nimport Header from '../components/Header'\nimport Footer from '../components/Footer'\n\nexport default class extends React.Component {\n  render () {\n    const {\n      render,\n      routes\n    } = this.props\n\n    const route = routes.find(route => route.path === props.location.pathname)\n\n    return (\n      <React.Fragment>\n        <Nav />\n        <Header\n          route={route}\n        />\n        {render()}\n        <Footer />\n      </React.Fragment>\n    )\n  }\n}\n```\n\n## CSS-in-JS\n\nx0 supports server-side rendering for [styled-components][sc] and [emotion][emotion] with zero configuration.\n\n### Styled Components\n\nTo enable CSS rendering for static export, ensure that `styled-components` is installed as a dependency in your `package.json`\n\n```json\n\"dependencies\": {\n  \"styled-components\": \"^3.2.6\"\n}\n```\n\n### Emotion\n\nEnsure `emotion` is installed as a dependency in your `package.json`\n\n```json\n\"dependencies\": {\n  \"emotion\": \"^9.1.3\"\n}\n```\n\n## Configuration\n\nDefault options can be set in the `x0` field in `package.json`.\n\n```json\n\"x0\": {\n  \"static\": true,\n  \"outDir\": \"site\",\n  \"title\": \"Hello\",\n}\n```\n\n## Head content\n\nHead elements such as `<title>`, `<meta>`, and `<style>` can be configured with the `x0` field in `package.json`.\n\n```json\n\"x0\": {\n  \"title\": \"My Site\",\n  \"meta\": [\n    { \"name\": \"twitter:card\", \"content\": \"summary\" }\n    { \"name\": \"twitter:image\", \"content\": \"kitten.png\" }\n  ],\n  \"links\": [\n    {\n      \"rel\": \"stylesheet\",\n      \"href\": \"https://fonts.googleapis.com/css?family=Roboto\"\n    }\n  ]\n}\n```\n\n## Custom HTML Template\n\nA custom HTML template can be passed as the `template` option.\n\n```json\n\"x0\": {\n  \"template\": \"./html.js\"\n}\n```\n\n```js\n// example template\nmodule.exports = ({\n  html,\n  css,\n  scripts,\n  title,\n  meta = [],\n  links = [],\n  static: isStatic\n}) => `<!DOCTYPE html>\n<head>\n  <title>{title}</title>\n  ${css}\n</head>\n<div id=root>${html}</div>\n${scripts}\n`\n```\n\n### Routing\n\nx0 creates routes based on the file system, using [react-router][react-router].\nTo set the base URL for static builds, use the `basename` option.\n\n```json\n\"x0\": {\n  \"basename\": \"/my-site\"\n}\n```\n\n#### Links\n\nTo link between different components, install `react-router-dom` and use the `Link` component.\n\n```sh\nnpm i react-router-dom\n```\n\n```js\nimport React from 'react'\nimport { Link } from 'react-router-dom'\n\nexport default () => (\n  <div>\n    <h1>Home</h1>\n    <nav>\n      <Link to='/'>Home</Link>\n      <Link to='/about'>About</Link>\n    </nav>\n  </div>\n)\n```\n\n### JSX Format\n\nx0 includes support for the [Compositor JSX][jsx-loader] file format.\n\n```jsx\n---\ntitle: Hello\nscope: import * as scope from 'rebass'\n---\n<Box px={2} py={4}>\n  <Heading>\n    {props.title}\n  </Heading>\n</Box>\n```\n\n### MDX Format\n\nx0 includes support for the [MDX][mdx] file format.\n\n```mdx\nimport { Box } from 'rebass'\n\n# Hello MDX\n\n<Box p={4} bg='tomato'>\n  Beep Boop\n</Box>\n```\n\n### webpack\n\nWebpack configuration files named `webpack.config.js` will automatically be merged with the built-in configuration, using [webpack-merge][webpack-merge].\nTo use a custom filename, pass the file path to the `--webpack` flag.\n\n```js\n// webpack.config.js example\nmodule.exports = {\n  module: {\n    rules: [\n      { test: /\\.txt$/, loader: 'raw-loader' }\n    ]\n  }\n}\n```\n\nSee the [example](examples/webpack-config).\n\n#### Related\n\n- [Compositor JSX][jsx-loader]\n- [MDX][mdx]\n- [React Router][react-router]\n- [Mini HTML Webpack Plugin][mini-html]\n- [Styled Components][sc]\n- [Emotion][emotion]\n- [webpack][webpack]\n- [Create React App](https://github.com/facebookincubator/create-react-app)\n- [Next.js][nextjs]\n- [Gatsby][gatsby]\n- [React-Static][react-static]\n\n---\n\n[Made by Compositor](https://compositor.io/)\n|\n[MIT License](LICENSE.md)\n\n[jsx-loader]: https://github.com/c8r/jsx-loader\n[mdx]: https://github.com/mdx-js/mdx\n[nextjs]: https://github.com/zeit/next.js\n[react-router]: https://github.com/ReactTraining/react-router\n[mini-html]: https://github.com/styleguidist/mini-html-webpack-plugin\n[sc]: https://github.com/styled-components/styled-components\n[emotion]: https://github.com/emotion-js/emotion\n[glamorous]: https://github.com/paypal/glamorous\n[glamor]: https://github.com/threepointone/glamor\n[gatsby]: https://github.com/gatsbyjs/gatsby\n[react-static]: https://github.com/nozzle/react-static\n[react-loadable]: https://github.com/thejameskyle/react-loadable\n[webpack-merge]: https://github.com/survivejs/webpack-merge\n[webpack]: https://webpack.js.org\n","gitHead":"e2e1789c985a00c34b753f51de686b4d20eb1409","license":"MIT","scripts":{"test":"nyc ava","build":"./cli.js build docs","cover":"nyc report --reporter=html --reporter=lcov","start":"./cli.js docs -op 8888","static":"./cli.js build docs --static"},"_npmUser":{"name":"jxnblk","email":"jxnblk@gmail.com"},"homepage":"https://github.com/c8r/x0#readme","keywords":[],"repository":{"url":"git+https://github.com/c8r/x0.git","type":"git"},"_npmVersion":"6.0.1","description":"Zero-config React development environment and static site generator","directories":{},"maintainers":[{"name":"johno","email":"johnotander@gmail.com"},{"name":"jxnblk","email":"jxnblk@gmail.com"},{"name":"mrmrs","email":"hi@mrmrs.cc"}],"_nodeVersion":"8.1.2","dependencies":{"meow":"^5.0.0","chalk":"^2.4.1","react":"^16.3.2","glamor":"^2.20.40","semver":"^5.5.0","emotion":"^9.1.3","find-up":"^2.1.0","webpack":"^4.8.3","fs-extra":"^6.0.1","pkg-conf":"^2.1.0","react-dom":"^16.3.2","babel-core":"^6.26.3","clipboardy":"^1.2.3","@mdx-js/mdx":"^0.9.0","koa-connect":"^2.0.1","read-pkg-up":"^3.0.0","babel-loader":"^7.1.4","react-router":"^4.2.0","html-minifier":"^3.5.15","webpack-merge":"^4.1.2","webpack-serve":"^1.0.2","@mdx-js/loader":"^0.9.0","babel-register":"^6.26.0","emotion-server":"^9.1.3","@compositor/log":"^1.0.0-0","react-dev-utils":"^5.0.1","update-notifier":"^2.5.0","babel-preset-env":"^1.7.0","react-router-dom":"^4.2.2","babel-preset-react":"^6.24.1","babel-plugin-macros":"^2.2.1","babel-preset-stage-0":"^6.24.1","@compositor/jsx-loader":"^1.0.0-2","mini-html-webpack-plugin":"^0.2.3","connect-history-api-fallback":"^1.5.0","babel-plugin-transform-runtime":"^6.23.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"ava":"^0.24.0","nyc":"^11.8.0","rebass":"^2.0.0-2","refunk":"^2.2.4","nano-style":"^1.0.0","styled-system":"^2.2.5","isomorphic-fetch":"^2.2.1","styled-components":"^3.2.6"},"_npmOperationalInternal":{"tmp":"tmp/x0_5.0.0-9_1526963940931_0.6607076440293438","host":"s3://npm-registry-packages"},"_id":"@compositor/x0@5.0.0-9","version":"5.0.0-9"}