├── README.md
├── lerna.json
├── package-lock.json
├── package.json
└── packages
├── examples
├── rola-compiler-test
│ ├── client.js
│ ├── components
│ │ ├── App.js
│ │ ├── History.js
│ │ └── State.js
│ ├── package-lock.json
│ ├── package.json
│ ├── routes.js
│ ├── routes
│ │ ├── 404.js
│ │ ├── about.js
│ │ └── home.js
│ ├── server.js
│ ├── styles
│ │ └── main.css
│ └── test.js
├── rola-static-styled-components
│ ├── .gitignore
│ ├── client.js
│ ├── components
│ │ ├── App.js
│ │ ├── History.js
│ │ └── State.js
│ ├── package-lock.json
│ ├── package.json
│ ├── rola.config.js
│ ├── rola.plugins.js
│ ├── routes.js
│ ├── routes
│ │ ├── About.js
│ │ └── Home.js
│ ├── server.js
│ └── static
│ │ └── Home.js
├── rola-static-test
│ ├── .gitignore
│ ├── components
│ │ ├── App.js
│ │ ├── History.js
│ │ └── State.js
│ ├── package-lock.json
│ ├── package.json
│ ├── rola.config.js
│ └── routes
│ │ ├── about.js
│ │ └── home.js
└── rola-test
│ ├── .gitignore
│ ├── build
│ ├── assets
│ │ ├── about
│ │ │ └── index.html
│ │ ├── client.css
│ │ ├── client.js
│ │ └── index.html
│ └── server.js
│ ├── client.js
│ ├── components
│ ├── App.js
│ ├── History.js
│ └── State.js
│ ├── package-lock.json
│ ├── package.json
│ ├── rola.config.js
│ ├── routes.js
│ ├── routes
│ ├── 404.js
│ ├── about.js
│ └── home.js
│ ├── server.js
│ ├── static
│ ├── About.js
│ └── Home.js
│ └── styles
│ └── main.css
├── plugin-document
├── README.md
├── package-lock.json
├── package.json
└── rola-plugin-document.js
├── plugin-styled-components
├── README.md
├── dist
│ └── rola-plugin-styled-components.js
├── package-lock.json
├── package.json
└── rola-plugin-styled-components.js
├── preset-node
├── README.md
├── package-lock.json
├── package.json
└── rola-preset-node.js
├── preset-postcss
├── README.md
├── package-lock.json
├── package.json
└── rola-preset-postcss.js
├── preset-sass
├── README.md
├── package-lock.json
├── package.json
└── rola-preset-sass.js
├── rola-compiler
├── .gitignore
├── README.md
├── cli.js
├── index.js
├── lib
│ ├── clientReloader.js
│ ├── createConfig.js
│ ├── emitter.js
│ └── stats.js
├── package-lock.json
└── package.json
├── rola-log
├── README.md
├── index.js
├── lib
│ └── flattenRoutes.js
├── package-lock.json
└── package.json
├── rola-static
├── .gitignore
├── README.md
├── cli.js
├── index.js
├── lib
│ ├── emitter.js
│ ├── fileLedger.js
│ ├── fileManager.js
│ ├── getRoutes.js
│ ├── html.js
│ ├── loadRoutes.js
│ ├── logger.js
│ ├── render.js
│ └── require.js
├── package-lock.json
└── package.json
├── rola-util
├── README.md
├── createClientRoot.js
├── createDocument.js
├── createServerRoot.js
├── document.js
├── filterStaticRoutePaths.js
├── getConfig.js
├── getModule.js
├── index.js
├── lib
│ ├── transpile.js
│ └── transpileAndGetModule.js
├── package-lock.json
├── package.json
├── postServerRender.js
├── preServerRender.js
└── tests
│ ├── filterStaticRoutePaths.test.js
│ └── getModule.test.js
└── rola
├── .gitignore
├── README.md
├── cli.js
├── index.js
├── lib
├── Link.js
├── Rola.js
├── Router.js
├── client.js
├── createStatic.js
├── history.js
├── matcher.js
├── server.js
└── state.js
├── package-lock.json
├── package.json
└── util
├── clientReloader.js
├── createConfig.js
└── createServer.js
/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 | ```
4 | npm i rola -g
5 | ```
6 |
7 |
8 |
9 | > This project is *alpha*, so I don't recommend using it in production *yet*. I
10 | > welcome all ideas, critiques, and PRs :)
11 |
12 |
13 |
14 | `rola` is a framework for building production React sites. Easily build static
15 | pages, a client bundle, server-side rendering and a custom API, all within the
16 | same project structure. It's simple to opt-in or out of what you don't need, and
17 | the codebase is simple enough that anyone can contribute plugins and features.
18 |
19 | ## Features
20 | - easy opt-in builds
21 | - ⚡️ static page generation
22 | - 🤓 server side rendering
23 | - 🏖 client-side application bundle
24 | - simple built-in routing
25 | - zero learning curve state management
26 | - simple plugin API
27 |
28 | ## Install
29 | ```
30 | npm i rola --save
31 | ```
32 |
33 | ## Usage
34 | Coming soooooon.
35 |
36 | ## Presets
37 | - [@rola/preset-postcss](https://github.com/estrattonbailey/rola/tree/master/packages/preset-postcss)
38 | - [@rola/preset-sass](https://github.com/estrattonbailey/rola/tree/master/packages/preset-sass)
39 |
40 | > Have a request? Open an
41 | > [issue](https://github.com/estrattonbailey/rola/issues)!
42 |
43 | ## Plugins
44 | - [@rola/plugin-styled-components](https://github.com/estrattonbailey/rola/tree/master/packages/plugin-styled-components)
45 | - [@rola/plugin-document](https://github.com/estrattonbailey/rola/tree/master/packages/plugin-document)
46 |
47 | > Have a request? Open an
48 | > [issue](https://github.com/estrattonbailey/rola/issues)!
49 |
50 | ## Motivation
51 | More flexible, less config, API with high "guessability".
52 |
53 | ## Contributing
54 | Oh please do! Let's collab :)
55 |
56 | ## License
57 | MIT License © [Eric Bailey](https://estrattonbailey.com)
58 |
--------------------------------------------------------------------------------
/lerna.json:
--------------------------------------------------------------------------------
1 | {
2 | "packages": [
3 | "packages/*"
4 | ],
5 | "version": "0.10.8"
6 | }
7 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "root",
3 | "private": true,
4 | "scripts": {
5 | "publish": "NPM_CONFIG_OTP= lerna publish"
6 | },
7 | "devDependencies": {
8 | "lerna": "^3.13.1"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/packages/examples/rola-compiler-test/client.js:
--------------------------------------------------------------------------------
1 | import '@/styles/main.css'
2 |
3 | import { client } from 'rola'
4 | import routes from '@/routes.js'
5 |
6 | client(routes, {})(document.getElementById('root'))
7 |
--------------------------------------------------------------------------------
/packages/examples/rola-compiler-test/components/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { Link } from 'rola'
3 |
4 | export default function App (props) {
5 | return (
6 |
7 |
12 |
13 |
14 | {props.children}
15 |
16 |
17 | )
18 | }
19 |
--------------------------------------------------------------------------------
/packages/examples/rola-compiler-test/components/History.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { withHistory } from 'hypr/history'
3 |
4 | export default withHistory(
5 | class ComponentWithHistory extends React.Component {
6 | componentDidMount () {
7 | console.log('history', this.props)
8 | }
9 |
10 | render () {
11 | return null
12 | }
13 | }
14 | )
15 |
--------------------------------------------------------------------------------
/packages/examples/rola-compiler-test/components/State.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { withState } from 'hypr/state'
3 |
4 | export default withState(state => state)(
5 | class ComponentWithState extends React.Component {
6 | componentDidMount () {
7 | console.log('state', this.props)
8 | }
9 |
10 | render () {
11 | return null
12 | }
13 | }
14 | )
15 |
--------------------------------------------------------------------------------
/packages/examples/rola-compiler-test/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "rola-hello-world",
3 | "private": true,
4 | "scripts": {
5 | "start": "rola-compiler watch",
6 | "build": "rola-compiler build"
7 | },
8 | "author": "estrattonbailey",
9 | "dependencies": {
10 | "@rola/compiler": "^0.2.3",
11 | "@rola/plugin-node": "^0.2.2",
12 | "@rola/plugin-postcss": "^0.2.3",
13 | "react": "^16.6.3",
14 | "react-dom": "^16.6.3",
15 | "rola": "^0.2.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/packages/examples/rola-compiler-test/routes.js:
--------------------------------------------------------------------------------
1 | import * as home from '@/routes/home.js'
2 | import * as about from '@/routes/about.js'
3 | import * as notfound from '@/routes/404.js'
4 |
5 | export default [
6 | home,
7 | about,
8 | notfound
9 | ]
10 |
--------------------------------------------------------------------------------
/packages/examples/rola-compiler-test/routes/404.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | export const pathname = '*'
4 |
5 | export function load (state, req) {
6 | return {
7 | status: 404,
8 | state: {
9 | meta: {
10 | title: '404 Not Found'
11 | }
12 | }
13 | }
14 | }
15 |
16 | export function view ({ pathname, state }) {
17 | return (
18 | 404 Not Found
19 | )
20 | }
21 |
--------------------------------------------------------------------------------
/packages/examples/rola-compiler-test/routes/about.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import App from '@/components/App.js'
3 |
4 | export const pathname = '/about'
5 |
6 | export function config () {
7 | return load()
8 | }
9 |
10 | export function load (state, req) {
11 | return {
12 | state: {
13 | title: 'about - hypr - the react toolkit',
14 | meta: {
15 | title: 'about - hypr - the react toolkit',
16 | },
17 | }
18 | }
19 | }
20 |
21 | export function view ({ pathname, state }) {
22 | return (
23 |
24 | {state.title}
25 |
26 | )
27 | }
28 |
--------------------------------------------------------------------------------
/packages/examples/rola-compiler-test/routes/home.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import App from '@/components/App.js'
3 |
4 | export const pathname = '/'
5 |
6 | export function config () {
7 | return load()
8 | }
9 |
10 | export function load (state, req) {
11 | return {
12 | state: {
13 | title: 'home - hypr - the react toolkit',
14 | meta: {
15 | title: 'home - hypr - the react toolkit',
16 | },
17 | }
18 | }
19 | }
20 |
21 | export function view ({ pathname, state }) {
22 | return (
23 |
24 | {state.title}
25 |
26 | )
27 | }
28 |
--------------------------------------------------------------------------------
/packages/examples/rola-compiler-test/server.js:
--------------------------------------------------------------------------------
1 | import { server } from 'rola'
2 | import routes from '@/routes.js'
3 |
4 | export default server(routes, {})
5 |
--------------------------------------------------------------------------------
/packages/examples/rola-compiler-test/styles/main.css:
--------------------------------------------------------------------------------
1 | html, body {
2 | background: whitesmoke;
3 | }
4 |
--------------------------------------------------------------------------------
/packages/examples/rola-compiler-test/test.js:
--------------------------------------------------------------------------------
1 | const compiler = require('@rola/compiler')
2 |
3 | const app = compiler([
4 | {
5 | in: './client.js',
6 | out: './build',
7 | presets: [
8 | require('@rola/preset-postcss')()
9 | ]
10 | },
11 | {
12 | in: './server.js',
13 | out: './build',
14 | presets: [
15 | require('@rola/preset-node')()
16 | ]
17 | },
18 | {
19 | in: './routes/*.js',
20 | out: './build/routes',
21 | preset: [
22 | require('@rola/preset-node')()
23 | ]
24 | }
25 | ])
26 |
27 | app.on('error', e => console.error(e))
28 | app.on('stats', stats => console.log(JSON.stringify(stats, null, ' ')))
29 |
30 | // app.watch()
31 | app.build()
32 |
--------------------------------------------------------------------------------
/packages/examples/rola-static-styled-components/.gitignore:
--------------------------------------------------------------------------------
1 | build
2 |
--------------------------------------------------------------------------------
/packages/examples/rola-static-styled-components/client.js:
--------------------------------------------------------------------------------
1 | import { client } from 'rola'
2 | import routes from '@/routes.js'
3 |
4 | client(routes)(document.getElementById('root'))
5 |
--------------------------------------------------------------------------------
/packages/examples/rola-static-styled-components/components/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { Link } from 'rola'
3 |
4 | export default function App (props) {
5 | return (
6 |
7 |
12 |
13 |
14 | {props.children}
15 |
16 |
17 | )
18 | }
19 |
--------------------------------------------------------------------------------
/packages/examples/rola-static-styled-components/components/History.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { withHistory } from 'hypr/history'
3 |
4 | export default withHistory(
5 | class ComponentWithHistory extends React.Component {
6 | componentDidMount () {
7 | console.log('history', this.props)
8 | }
9 |
10 | render () {
11 | return null
12 | }
13 | }
14 | )
15 |
--------------------------------------------------------------------------------
/packages/examples/rola-static-styled-components/components/State.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { withState } from 'hypr/state'
3 |
4 | export default withState(state => state)(
5 | class ComponentWithState extends React.Component {
6 | componentDidMount () {
7 | console.log('state', this.props)
8 | }
9 |
10 | render () {
11 | return null
12 | }
13 | }
14 | )
15 |
--------------------------------------------------------------------------------
/packages/examples/rola-static-styled-components/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "rola-static-styled-components",
3 | "private": true,
4 | "scripts": {
5 | "start": "rola watch",
6 | "build": "rola build"
7 | },
8 | "author": "estrattonbailey",
9 | "dependencies": {
10 | "@rola/plugin-document": "^0.2.7",
11 | "@rola/plugin-styled-components": "^0.6.4",
12 | "react": "^16.6.3",
13 | "react-dom": "^16.6.3",
14 | "rola": "^0.6.4",
15 | "styled-components": "^4.1.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/packages/examples/rola-static-styled-components/rola.config.js:
--------------------------------------------------------------------------------
1 | export const presets = [
2 | ]
3 |
--------------------------------------------------------------------------------
/packages/examples/rola-static-styled-components/rola.plugins.js:
--------------------------------------------------------------------------------
1 | import styled from '@rola/plugin-styled-components'
2 |
3 | export default [
4 | styled()
5 | ]
6 |
--------------------------------------------------------------------------------
/packages/examples/rola-static-styled-components/routes.js:
--------------------------------------------------------------------------------
1 | import * as Home from '@/routes/Home.js'
2 | import * as About from '@/routes/About.js'
3 |
4 | export default [
5 | Home,
6 | About
7 | ]
8 |
--------------------------------------------------------------------------------
/packages/examples/rola-static-styled-components/routes/About.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { withState } from 'rola'
3 | import App from '@/components/App.js'
4 |
5 | export const pathname = '/about'
6 |
7 | export function load (state, req) {
8 | return {
9 | state: {
10 | title: 'about - hypr - the react toolkit',
11 | meta: {
12 | title: 'about - hypr - the react toolkit',
13 | },
14 | }
15 | }
16 | }
17 |
18 | export const view = withState(state => ({
19 | foo: true
20 | }))(
21 | function view ({ pathname, state, foo }) {
22 | return (
23 |
24 | {state.title}
25 |
26 | )
27 | }
28 | )
29 |
--------------------------------------------------------------------------------
/packages/examples/rola-static-styled-components/routes/Home.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import App from '@/components/App.js'
3 | import styled from 'styled-components'
4 |
5 | export const pathname = '/'
6 |
7 | export function load (state, req) {
8 | return {
9 | state: {
10 | title: 'home - hypr - the react toolkit',
11 | meta: {
12 | title: 'home - hypr - the react toolkit',
13 | },
14 | }
15 | }
16 | }
17 |
18 | const H1 = styled.h1`
19 | color: blue;
20 | `
21 |
22 | export function view ({ pathname, state }) {
23 | return (
24 |
25 | {state.title}
26 |
27 | )
28 | }
29 |
--------------------------------------------------------------------------------
/packages/examples/rola-static-styled-components/server.js:
--------------------------------------------------------------------------------
1 | import { server } from 'rola'
2 | import routes from '@/routes.js'
3 |
4 | export default server(routes, {})
5 |
--------------------------------------------------------------------------------
/packages/examples/rola-static-styled-components/static/Home.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { createStatic } from 'rola'
3 | import * as Home from '@/routes/Home.js'
4 |
5 | export const pathname = Home.pathname
6 |
7 | export function config (state, req) {
8 | return Home.load()
9 | }
10 |
11 | export const view = createStatic(Home.view)
12 |
--------------------------------------------------------------------------------
/packages/examples/rola-static-test/.gitignore:
--------------------------------------------------------------------------------
1 | build
2 |
--------------------------------------------------------------------------------
/packages/examples/rola-static-test/components/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { Link } from 'rola'
3 |
4 | export default function App (props) {
5 | return (
6 |
7 |
8 |
9 |
10 |
11 |
16 |
17 |
18 | {props.children}
19 |
20 |
21 |
22 |
27 |
28 |
29 | )
30 | }
31 |
--------------------------------------------------------------------------------
/packages/examples/rola-static-test/components/History.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { withHistory } from 'hypr/history'
3 |
4 | export default withHistory(
5 | class ComponentWithHistory extends React.Component {
6 | componentDidMount () {
7 | console.log('history', this.props)
8 | }
9 |
10 | render () {
11 | return null
12 | }
13 | }
14 | )
15 |
--------------------------------------------------------------------------------
/packages/examples/rola-static-test/components/State.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { withState } from 'hypr/state'
3 |
4 | export default withState(state => state)(
5 | class ComponentWithState extends React.Component {
6 | componentDidMount () {
7 | console.log('state', this.props)
8 | }
9 |
10 | render () {
11 | return null
12 | }
13 | }
14 | )
15 |
--------------------------------------------------------------------------------
/packages/examples/rola-static-test/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "rola-static-hello-world",
3 | "private": true,
4 | "scripts": {
5 | "start": "rola-static watch routes/ build/",
6 | "build": "rola-static render routes/ build/"
7 | },
8 | "author": "estrattonbailey",
9 | "dependencies": {
10 | "@rola/plugin-document": "^0.2.7",
11 | "@rola/static": "^0.2.10",
12 | "react": "^16.6.3",
13 | "react-dom": "^16.6.3",
14 | "rola": "^0.2.10"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/packages/examples/rola-static-test/rola.config.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import document from '@rola/plugin-document'
3 |
4 | export default {
5 | plugins: [
6 | document(({ state, view }) => {
7 | return `${view}`
8 | })
9 | ]
10 | }
11 |
--------------------------------------------------------------------------------
/packages/examples/rola-static-test/routes/about.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import App from '@/components/App.js'
3 |
4 | export const pathname = '/about'
5 |
6 | export function config (state, req) {
7 | return {
8 | state: {
9 | title: 'about - hypr - the react toolkit',
10 | meta: {
11 | title: 'about - hypr - the react toolkit',
12 | },
13 | }
14 | }
15 | }
16 |
17 | export function view ({ pathname, state }) {
18 | return (
19 |
20 | {state.title}
21 |
22 | )
23 | }
24 |
--------------------------------------------------------------------------------
/packages/examples/rola-static-test/routes/home.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import App from '@/components/App.js'
3 |
4 | export const pathname = '/'
5 |
6 | export function config (state, req) {
7 | return {
8 | state: {
9 | title: 'home - hypr - the react toolkit',
10 | meta: {
11 | title: 'home - hypr - the react toolkit',
12 | },
13 | }
14 | }
15 | }
16 |
17 | export function view ({ pathname, state }) {
18 | return (
19 |
20 | {state.title}
21 |
22 | )
23 | }
24 |
--------------------------------------------------------------------------------
/packages/examples/rola-test/.gitignore:
--------------------------------------------------------------------------------
1 | .rola
2 |
--------------------------------------------------------------------------------
/packages/examples/rola-test/build/assets/about/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | home - hypr - the react toolkit
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/packages/examples/rola-test/build/assets/client.css:
--------------------------------------------------------------------------------
1 | body,html{background:#f5f5f5}
2 |
3 | /*# sourceMappingURL=client.css.map*/
--------------------------------------------------------------------------------
/packages/examples/rola-test/build/assets/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | home - hypr - the react toolkit
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/packages/examples/rola-test/client.js:
--------------------------------------------------------------------------------
1 | import '@/styles/main.css'
2 |
3 | import { client } from 'rola'
4 | import routes from '@/routes.js'
5 |
6 | client(routes, {}, {})
7 |
--------------------------------------------------------------------------------
/packages/examples/rola-test/components/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { Link } from 'rola'
3 |
4 | export default function App (props) {
5 | return (
6 |
7 |
12 |
13 |
14 | {props.children}
15 |
16 |
17 | )
18 | }
19 |
--------------------------------------------------------------------------------
/packages/examples/rola-test/components/History.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { withHistory } from 'hypr/history'
3 |
4 | export default withHistory(
5 | class ComponentWithHistory extends React.Component {
6 | componentDidMount () {
7 | console.log('history', this.props)
8 | }
9 |
10 | render () {
11 | return null
12 | }
13 | }
14 | )
15 |
--------------------------------------------------------------------------------
/packages/examples/rola-test/components/State.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { withState } from 'hypr/state'
3 |
4 | export default withState(state => state)(
5 | class ComponentWithState extends React.Component {
6 | componentDidMount () {
7 | console.log('state', this.props)
8 | }
9 |
10 | render () {
11 | return null
12 | }
13 | }
14 | )
15 |
--------------------------------------------------------------------------------
/packages/examples/rola-test/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "rola-test",
3 | "version": "0.0.1",
4 | "private": true,
5 | "scripts": {
6 | "start": "rola watch",
7 | "build": "rola build"
8 | },
9 | "author": "estrattonbailey",
10 | "dependencies": {
11 | "@rola/plugin-document": "^0.9.0",
12 | "@rola/preset-postcss": "^0.10.0",
13 | "react": "^17.8.4",
14 | "react-dom": "^16.8.4",
15 | "rola": "^0.10.0"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/packages/examples/rola-test/rola.config.js:
--------------------------------------------------------------------------------
1 | import postcss from '@rola/preset-postcss'
2 |
3 | export const presets = [
4 | postcss()
5 | ]
6 |
--------------------------------------------------------------------------------
/packages/examples/rola-test/routes.js:
--------------------------------------------------------------------------------
1 | import * as Home from '@/routes/Home.js'
2 | import * as About from '@/routes/About.js'
3 | import * as Notfound from '@/routes/404.js'
4 |
5 | export default [
6 | Home,
7 | About,
8 | Notfound
9 | ]
10 |
--------------------------------------------------------------------------------
/packages/examples/rola-test/routes/404.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | export const pathname = '*'
4 |
5 | export function load (state, req) {
6 | return {
7 | status: 404,
8 | state: {
9 | meta: {
10 | title: '404 Not Found'
11 | }
12 | }
13 | }
14 | }
15 |
16 | export function view ({ pathname, state }) {
17 | return (
18 | 404 Not Found
19 | )
20 | }
21 |
--------------------------------------------------------------------------------
/packages/examples/rola-test/routes/about.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import App from '@/components/App.js'
3 |
4 | export const pathname = '/about'
5 |
6 | export function load (state, req) {
7 | return {
8 | state: {
9 | title: 'about - hypr - the react toolkit',
10 | meta: {
11 | title: 'about - hypr - the react toolkit',
12 | },
13 | }
14 | }
15 | }
16 |
17 | export function view ({ pathname, state }) {
18 | return (
19 |
20 | {state.title}
21 |
22 | )
23 | }
24 |
--------------------------------------------------------------------------------
/packages/examples/rola-test/routes/home.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { withState } from 'rola'
3 | import App from '@/components/App.js'
4 |
5 | export const pathname = '/'
6 |
7 | export function load (state, req) {
8 | return {
9 | state: {
10 | title: 'home - hypr - the react toolkit',
11 | meta: {
12 | title: 'home - hypr - the react toolkit',
13 | },
14 | }
15 | }
16 | }
17 |
18 | export const view = withState(state => state)(
19 | function view ({ pathname, state }) {
20 | return (
21 |
22 | {state.title}
23 |
24 | )
25 | }
26 | )
27 |
--------------------------------------------------------------------------------
/packages/examples/rola-test/server.js:
--------------------------------------------------------------------------------
1 | import { server } from 'rola'
2 | import routes from '@/routes.js'
3 |
4 | export default server(routes, {})
5 |
--------------------------------------------------------------------------------
/packages/examples/rola-test/static/About.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import * as About from '@/routes/About.js'
3 |
4 | export const pathname = About.pathname
5 |
6 | export function load () {
7 | return {
8 | state: {
9 | title: 'home - hypr - the react toolkit',
10 | meta: {
11 | title: 'home - hypr - the react toolkit',
12 | },
13 | }
14 | }
15 | }
16 |
17 | export const view = About.view
18 |
--------------------------------------------------------------------------------
/packages/examples/rola-test/static/Home.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import * as Home from '@/routes/Home.js'
3 |
4 | export const pathname = Home.pathname
5 |
6 | export function load () {
7 | return {
8 | state: {
9 | title: 'home - hypr - the react toolkit',
10 | meta: {
11 | title: 'home - hypr - the react toolkit',
12 | },
13 | }
14 | }
15 | }
16 |
17 | export const view = Home.view
18 |
--------------------------------------------------------------------------------
/packages/examples/rola-test/styles/main.css:
--------------------------------------------------------------------------------
1 | html, body {
2 | background: whitesmoke;
3 | }
4 |
--------------------------------------------------------------------------------
/packages/plugin-document/README.md:
--------------------------------------------------------------------------------
1 | # @rola/plugin-document
2 | Quick access to the document creation process in
3 | [rola](https://github.com/estrattonbailey/rola).
4 |
5 | > See [plugin docs](https://github.com/estrattonbailey/rola/issues/20) for more info.
6 |
7 | ## Install
8 | ```bash
9 | npm i @rola/plugin-document --save
10 | ```
11 |
12 | ## Usage
13 | Add the plugin to the `plugins` array in your `rola.plugins.js`:
14 |
15 | ```javascript
16 | import document from '@rola/plugin-document'
17 |
18 | export default [
19 | document(({ context, ...customProps }) => {
20 | return {
21 | head: [ '' ],
22 | body: [ '' ]
23 | }
24 | })
25 | ]
26 | ```
27 |
28 | ## License
29 | MIT License © [Eric Bailey](https://estrattonbailey.com)
30 |
--------------------------------------------------------------------------------
/packages/plugin-document/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@rola/plugin-document",
3 | "version": "0.2.5",
4 | "lockfileVersion": 1
5 | }
6 |
--------------------------------------------------------------------------------
/packages/plugin-document/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@rola/plugin-document",
3 | "version": "0.10.5",
4 | "description": "Tap into rola document creation.",
5 | "main": "rola-plugin-document.js",
6 | "scripts": {},
7 | "repository": {
8 | "type": "git",
9 | "url": "git+ssh://git@github.com/estrattonbailey/rola.git"
10 | },
11 | "author": "estrattonbailey",
12 | "license": "MIT",
13 | "bugs": {
14 | "url": "https://github.com/estrattonbailey/rola/issues"
15 | },
16 | "homepage": "https://github.com/estrattonbailey/rola#readme",
17 | "gitHead": "570605c164cc377cf02c6819a29398857ca7bb7"
18 | }
19 |
--------------------------------------------------------------------------------
/packages/plugin-document/rola-plugin-document.js:
--------------------------------------------------------------------------------
1 | module.exports = fn => ({
2 | createDocument (props) {
3 | return fn(props)
4 | }
5 | })
6 |
--------------------------------------------------------------------------------
/packages/plugin-styled-components/README.md:
--------------------------------------------------------------------------------
1 | # @rola/plugin-styled-components
2 | Enable [Styled Components](https://www.styled-components.com/) support in
3 | [rola](https://github.com/estrattonbailey/rola).
4 |
5 | ## Install
6 | ```bash
7 | npm i @rola/plugin-styled-components --save
8 | ```
9 |
10 | ## Usage
11 | Add the plugin to the `plugins` array in your `rola.plugins.js`:
12 |
13 | ```javascript
14 | import styled from '@rola/plugin-styled-components'
15 |
16 | export default [
17 | styled()
18 | ]
19 | ```
20 |
21 | ## License
22 | MIT License © [Eric Bailey](https://estrattonbailey.com)
23 |
--------------------------------------------------------------------------------
/packages/plugin-styled-components/dist/rola-plugin-styled-components.js:
--------------------------------------------------------------------------------
1 | var e,t=(e=require("react"))&&"object"==typeof e&&"default"in e?e.default:e,r=require("styled-components"),n=new Map;module.exports=function(e){return void 0===e&&(e={}),{createDocument:function(e){return{head:e.style}},createServerRoot:function(e){var a=e.root,o=e.context,u=new r.ServerStyleSheet;return n.set(o.pathname,u),function(e){return t.createElement(r.StyleSheetManager,{sheet:u.instance},t.createElement(a,e))}},postServerRender:function(e){var t=e.context,r=n.get(t.pathname);if(!r)return{};var a=r.getStyleTags();return r.seal(),n.delete(t.pathname),{style:a}}}};
2 | //# sourceMappingURL=rola-plugin-styled-components.js.map
3 |
--------------------------------------------------------------------------------
/packages/plugin-styled-components/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@rola/plugin-styled-components",
3 | "version": "0.10.7",
4 | "description": "Compile node with rola.",
5 | "main": "dist/rola-plugin-styled-components.js",
6 | "source": "rola-plugin-styled-components.js",
7 | "scripts": {
8 | "build": "microbundle build -f cjs",
9 | "watch": "microbundle watch -f cjs"
10 | },
11 | "repository": {
12 | "type": "git",
13 | "url": "git+ssh://git@github.com/estrattonbailey/rola.git"
14 | },
15 | "author": "estrattonbailey",
16 | "license": "MIT",
17 | "bugs": {
18 | "url": "https://github.com/estrattonbailey/rola/issues"
19 | },
20 | "homepage": "https://github.com/estrattonbailey/rola#readme",
21 | "dependencies": {
22 | "react": "^16.8.4",
23 | "react-dom": "^16.8.4",
24 | "styled-components": "^4.1.3"
25 | },
26 | "devDependencies": {
27 | "microbundle": "^0.11.0"
28 | },
29 | "gitHead": "570605c164cc377cf02c6819a29398857ca7bb7"
30 | }
31 |
--------------------------------------------------------------------------------
/packages/plugin-styled-components/rola-plugin-styled-components.js:
--------------------------------------------------------------------------------
1 | /** @jsx React.createElement */
2 | import React from 'react'
3 | import { ServerStyleSheet, StyleSheetManager } from 'styled-components'
4 |
5 | const sheets = new Map()
6 |
7 | export default (options = {}) => {
8 | return {
9 | createDocument ({ context, style }) {
10 | return {
11 | head: style
12 | }
13 | },
14 | createServerRoot ({ root: Root, context }) {
15 | const sheet = new ServerStyleSheet()
16 |
17 | sheets.set(context.pathname, sheet)
18 |
19 | return props =>
20 | },
21 | postServerRender ({ context }) {
22 | const sheet = sheets.get(context.pathname)
23 |
24 | if (!sheet) return {}
25 |
26 | const style = sheet.getStyleTags()
27 |
28 | sheet.seal()
29 | sheets.delete(context.pathname)
30 |
31 | return { style }
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/packages/preset-node/README.md:
--------------------------------------------------------------------------------
1 | # @rola/preset-sass
2 | Bundle for Node using [rola](https://github.com/estrattonbailey/rola).
3 |
4 | > Unless you're building something using
5 | > [@rola/compiler](https://github.com/estrattonbailey/rola/tree/master/packages/rola-compiler)
6 | > directly, you won't need this module for your rola project.
7 |
8 | ## Install
9 | ```bash
10 | npm i @rola/preset-node --save
11 | ```
12 |
13 | ## Usage
14 | Add the preset to the `presets` array on your [@rola/compiler](https://github.com/estrattonbailey/rola/tree/master/packages/rola-compiler) instance:
15 |
16 | ```javascript
17 | import compiler from '@rola/compiler'
18 | import node from '@rola/preset-node'
19 |
20 | compiler({
21 | in: './index.js',
22 | out: './build',
23 | presets: [
24 | node()
25 | ]
26 | })
27 | ```
28 |
29 | ## License
30 | MIT License © [Eric Bailey](https://estrattonbailey.com)
31 |
--------------------------------------------------------------------------------
/packages/preset-node/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@rola/preset-node",
3 | "version": "0.10.7",
4 | "description": "Compile node with rola.",
5 | "main": "rola-preset-node.js",
6 | "scripts": {},
7 | "repository": {
8 | "type": "git",
9 | "url": "git+ssh://git@github.com/estrattonbailey/rola.git"
10 | },
11 | "author": "estrattonbailey",
12 | "license": "MIT",
13 | "bugs": {
14 | "url": "https://github.com/estrattonbailey/rola/issues"
15 | },
16 | "homepage": "https://github.com/estrattonbailey/rola#readme",
17 | "dependencies": {
18 | "source-map-support": "^0.5.9",
19 | "webpack": "^4.29.6"
20 | },
21 | "gitHead": "570605c164cc377cf02c6819a29398857ca7bb7"
22 | }
23 |
--------------------------------------------------------------------------------
/packages/preset-node/rola-preset-node.js:
--------------------------------------------------------------------------------
1 | const webpack = require('webpack')
2 |
3 | module.exports = (options = {}) => {
4 | return {
5 | createConfig ({ config, context }) {
6 | config.target = 'node'
7 |
8 | config.node = Object.assign({
9 | console: false,
10 | global: true,
11 | process: true,
12 | __filename: 'mock',
13 | __dirname: 'mock',
14 | Buffer: true,
15 | setImmediate: true
16 | }, options)
17 |
18 | config.plugins.push(
19 | new webpack.BannerPlugin({
20 | banner: `require('source-map-support').install({ hookRequire: true });`,
21 | raw: true,
22 | entryOnly: true,
23 | exclude: /\.(sa|sc|c)ss$/
24 | })
25 | )
26 |
27 | config.devtool = 'inline-source-map'
28 |
29 | return config
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/packages/preset-postcss/README.md:
--------------------------------------------------------------------------------
1 | # @rola/preset-postcss
2 | Enable PostCSS support in [rola](https://github.com/estrattonbailey/rola). Comes
3 | with sane defaults for things like CSS variables and SASS-like nesting.
4 |
5 | ## Install
6 | ```bash
7 | npm i @rola/preset-postcss --save
8 | ```
9 |
10 | ## Usage
11 | Add the preset to the `presets` array in your `rola.config.js`:
12 |
13 | ```javascript
14 | import css from '@rola/preset-postcss'
15 |
16 | export const presets = [
17 | css()
18 | ]
19 | ```
20 |
21 | ## License
22 | MIT License © [Eric Bailey](https://estrattonbailey.com)
23 |
--------------------------------------------------------------------------------
/packages/preset-postcss/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@rola/preset-postcss",
3 | "version": "0.10.7",
4 | "description": "Enable PostCSS for rola.",
5 | "main": "rola-preset-postcss.js",
6 | "repository": {
7 | "type": "git",
8 | "url": "git+ssh://git@github.com/estrattonbailey/rola.git"
9 | },
10 | "author": "estrattonbailey",
11 | "license": "MIT",
12 | "bugs": {
13 | "url": "https://github.com/estrattonbailey/rola/issues"
14 | },
15 | "homepage": "https://github.com/estrattonbailey/rola#readme",
16 | "dependencies": {
17 | "css-loader": "^2.1.0",
18 | "cssnano": "^4.1.10",
19 | "mini-css-extract-plugin": "^0.5.0",
20 | "postcss": "^7.0.14",
21 | "postcss-cssnext": "^3.1.0",
22 | "postcss-discard-comments": "^4.0.2",
23 | "postcss-import": "^12.0.1",
24 | "postcss-loader": "^3.0.0",
25 | "postcss-nested": "^3.0.0",
26 | "webpack": "^4.29.6"
27 | },
28 | "gitHead": "570605c164cc377cf02c6819a29398857ca7bb7"
29 | }
30 |
--------------------------------------------------------------------------------
/packages/preset-postcss/rola-preset-postcss.js:
--------------------------------------------------------------------------------
1 | const ExtractCSS = require('mini-css-extract-plugin')
2 |
3 | module.exports = (options = {}) => {
4 | return {
5 | createDocument ({ context }) {
6 | return {
7 | head: ``
8 | }
9 | },
10 | createConfig ({ config, context }) {
11 | if (context.server) return
12 |
13 | config.module.rules.push({
14 | test: /\.css$/,
15 | exclude: /node_modules/,
16 | use: [
17 | ExtractCSS.loader,
18 | require.resolve('css-loader'),
19 | {
20 | loader: require.resolve('postcss-loader'),
21 | options: {
22 | plugins: [
23 | require('postcss-import'),
24 | require('postcss-nested'),
25 | require('postcss-cssnext')({
26 | warnForDuplicates: false,
27 | warnForDeprecations: false
28 | }),
29 | require('postcss-discard-comments'),
30 | context.watch && require('cssnano')
31 | ].filter(Boolean)
32 | }
33 | }
34 | ]
35 | })
36 |
37 | config.plugins.push(
38 | new ExtractCSS({
39 | filename: options.filename || '[name].css'
40 | })
41 | )
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/packages/preset-sass/README.md:
--------------------------------------------------------------------------------
1 | # @rola/preset-sass
2 | Enable SASS/SCSS support in [rola](https://github.com/estrattonbailey/rola).
3 |
4 | ## Install
5 | ```bash
6 | npm i @rola/preset-sass --save
7 | ```
8 |
9 | ## Usage
10 | Add the preset to the `presets` array in your `rola.config.js`:
11 |
12 | ```javascript
13 | import sass from '@rola/preset-sass'
14 |
15 | export const presets = [
16 | sass()
17 | ]
18 | ```
19 |
20 | ## License
21 | MIT License © [Eric Bailey](https://estrattonbailey.com)
22 |
--------------------------------------------------------------------------------
/packages/preset-sass/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@rola/preset-sass",
3 | "version": "0.10.7",
4 | "description": "Enable SASS for rola.",
5 | "main": "rola-preset-sass.js",
6 | "scripts": {},
7 | "repository": {
8 | "type": "git",
9 | "url": "git+ssh://git@github.com/estrattonbailey/rola.git"
10 | },
11 | "author": "estrattonbailey",
12 | "license": "MIT",
13 | "bugs": {
14 | "url": "https://github.com/estrattonbailey/rola/issues"
15 | },
16 | "homepage": "https://github.com/estrattonbailey/rola#readme",
17 | "dependencies": {
18 | "css-loader": "^2.1.0",
19 | "cssnano": "^4.1.10",
20 | "mini-css-extract-plugin": "^0.5.0",
21 | "sass": "^1.17.3",
22 | "sass-loader": "^7.1.0",
23 | "style-loader": "^0.20.3"
24 | },
25 | "gitHead": "570605c164cc377cf02c6819a29398857ca7bb7"
26 | }
27 |
--------------------------------------------------------------------------------
/packages/preset-sass/rola-preset-sass.js:
--------------------------------------------------------------------------------
1 | const ExtractCSS = require('mini-css-extract-plugin')
2 |
3 | module.exports = (options = {}) => {
4 | return {
5 | createConfig ({ config, context }) {
6 | if (context.server) return
7 |
8 | config.module.rules.push({
9 | test: /\.(sa|sc)ss$/,
10 | exclude: /node_modules/,
11 | use: [
12 | ExtractCSS.loader,
13 | require.resolve('css-loader'),
14 | {
15 | loader: require.resolve('sass-loader'),
16 | options: {
17 | implementation: require('sass')
18 | }
19 | }
20 | ]
21 | })
22 |
23 | config.plugins.push(
24 | new ExtractCSS({
25 | filename: options.filename || '[name].css'
26 | })
27 | )
28 |
29 | return config
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/packages/rola-compiler/.gitignore:
--------------------------------------------------------------------------------
1 | dist
2 | test.js
3 | test
4 |
--------------------------------------------------------------------------------
/packages/rola-compiler/README.md:
--------------------------------------------------------------------------------
1 | # @rola/compiler
2 | A compiler utility for [rola](https://github.com/estrattonbailey/rola).
3 |
4 | ## License
5 | MIT License © [Eric Bailey](https://estrattonbailey.com)
6 |
--------------------------------------------------------------------------------
/packages/rola-compiler/cli.js:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env node
2 | 'use strict'
3 |
4 | const fs = require('fs')
5 | const path = require('path')
6 | const exit = require('exit')
7 | const onExit = require('exit-hook')
8 | const match = require('matched')
9 | const log = require('log-update')
10 | const c = require('ansi-colors')
11 |
12 | const cwd = process.cwd()
13 | const pkg = require('./package.json')
14 | const rolaCompiler = require('./index.js')
15 | const postcss = require('@rola/preset-postcss')
16 |
17 | const prog = require('commander')
18 | .version(pkg.version)
19 | .option('--out