├── .prettierrc ├── src ├── .babelrc ├── __tests__ │ ├── integration-tests │ │ ├── __snapshots__ │ │ │ ├── basic-test.js.snap │ │ │ ├── columns-test.js.snap │ │ │ ├── rows-test.js.snap │ │ │ └── kitchen-sink-test.js.snap │ │ ├── basic-test.js │ │ ├── rows-test.js │ │ ├── columns-test.js │ │ ├── test-render.js │ │ └── kitchen-sink-test.js │ ├── __snapshots__ │ │ ├── local-state-test.js.snap │ │ ├── emoji-test.js.snap │ │ └── section-test.js.snap │ ├── local-state-test.js │ ├── emoji-test.js │ └── section-test.js ├── index.js.flow ├── demo.js ├── reconciler.js ├── components.js ├── index.js └── output.js ├── .flowconfig ├── .gitignore ├── flow-typed └── npm │ ├── flow-bin_v0.x.x.js │ ├── wrap-ansi_vx.x.x.js │ ├── babel-jest_vx.x.x.js │ ├── log-update_vx.x.x.js │ ├── strip-ansi_vx.x.x.js │ ├── babel-core_vx.x.x.js │ ├── ansi-escapes_vx.x.x.js │ ├── babel-preset-flow_vx.x.x.js │ ├── @babel │ ├── preset-flow_vx.x.x.js │ ├── preset-react_vx.x.x.js │ ├── plugin-proposal-class-properties_vx.x.x.js │ ├── cli_vx.x.x.js │ ├── preset-env_vx.x.x.js │ └── core_vx.x.x.js │ ├── babel-preset-react_vx.x.x.js │ ├── babel-preset-stage-2_vx.x.x.js │ ├── is-fullwidth-code-point_vx.x.x.js │ ├── eslint-plugin-prettier_vx.x.x.js │ ├── intercept-stdout_vx.x.x.js │ ├── jest-runner-flowtype_vx.x.x.js │ ├── wcwidth_vx.x.x.js │ ├── emoji-regex_vx.x.x.js │ ├── eslint-config-prettier_vx.x.x.js │ ├── jest-runner-eslint_vx.x.x.js │ ├── chalk_v2.x.x.js │ ├── babel-preset-env_vx.x.x.js │ ├── react-reconciler_vx.x.x.js │ ├── babel-cli_vx.x.x.js │ ├── babel-eslint_vx.x.x.js │ ├── prettier_v1.x.x.js │ ├── eslint-plugin-import_vx.x.x.js │ ├── eslint-plugin-jest_vx.x.x.js │ └── eslint-plugin-flowtype_vx.x.x.js ├── .eslintrc.json ├── jest.config.js ├── lib ├── index.js.flow ├── reconciler.js ├── components.js ├── index.js ├── demo.js └── output.js ├── .circleci └── config.yml ├── LICENSE ├── package.json ├── README.md └── .github └── demo.svg /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 80 3 | } 4 | -------------------------------------------------------------------------------- /src/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["@babel/preset-env", "@babel/preset-react", "@babel/preset-flow"], 3 | "plugins": [["@babel/plugin-proposal-class-properties", { "loose": false }]] 4 | } 5 | -------------------------------------------------------------------------------- /.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | 7 | [lints] 8 | 9 | [options] 10 | 11 | [strict] 12 | nonstrict-import 13 | unclear-type 14 | unsafe-getters-setters 15 | untyped-import 16 | untyped-type-import 17 | -------------------------------------------------------------------------------- /src/__tests__/integration-tests/__snapshots__/basic-test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Renderer should output text 1`] = ` 4 | "Basic test++++++++++++++++++++++++++++++++++++++++ 5 | " 6 | `; 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | 6 | # misc 7 | .DS_Store 8 | .env 9 | npm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | -------------------------------------------------------------------------------- /flow-typed/npm/flow-bin_v0.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 6a5610678d4b01e13bbfbbc62bdaf583 2 | // flow-typed version: 3817bc6980/flow-bin_v0.x.x/flow_>=v0.25.x 3 | 4 | declare module "flow-bin" { 5 | declare module.exports: string; 6 | } 7 | -------------------------------------------------------------------------------- /src/__tests__/integration-tests/__snapshots__/columns-test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Horizontal sections should render as columns 1`] = ` 4 | "1st column++++++2nd column++++++3rd column++++++++ 5 | " 6 | `; 7 | -------------------------------------------------------------------------------- /src/__tests__/integration-tests/basic-test.js: -------------------------------------------------------------------------------- 1 | // @flow strict 2 | 3 | import React from "react"; 4 | import TestRender from "./test-render"; 5 | import { Section } from "../../index"; 6 | 7 | TestRender("Renderer should output text",
Basic test
); 8 | -------------------------------------------------------------------------------- /src/__tests__/integration-tests/__snapshots__/rows-test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Rows should render on new lines 1`] = ` 4 | "1st row+++++++++++++++++++++++++++++++++++++++++++ 5 | 2nd row+++++++++++++++++++++++++++++++++++++++++++ 6 | 3rd row+++++++++++++++++++++++++++++++++++++++++++ 7 | " 8 | `; 9 | -------------------------------------------------------------------------------- /src/__tests__/integration-tests/rows-test.js: -------------------------------------------------------------------------------- 1 | // @flow strict 2 | 3 | import React from "react"; 4 | import TestRender from "./test-render"; 5 | import { Section } from "../../index"; 6 | 7 | TestRender( 8 | "Rows should render on new lines", 9 |
10 | 1st row 11 |
12 | 2nd row 13 |
14 | 3rd row 15 |
16 | ); 17 | -------------------------------------------------------------------------------- /src/__tests__/integration-tests/columns-test.js: -------------------------------------------------------------------------------- 1 | // @flow strict 2 | 3 | import React from "react"; 4 | import TestRender from "./test-render"; 5 | import { Section } from "../../index"; 6 | 7 | TestRender( 8 | "Horizontal sections should render as columns", 9 |
10 | 1st column 11 |
12 | 2nd column 13 |
14 | 3rd column 15 |
16 | ); 17 | -------------------------------------------------------------------------------- /src/__tests__/__snapshots__/local-state-test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`components should be able to use local state to manage updates 1`] = ` 4 | "Counter: 0++++++++++++++++++++++++++++++++++++++++ 5 | " 6 | `; 7 | 8 | exports[`components should be able to use local state to manage updates 2`] = ` 9 | "Counter: 1++++++++++++++++++++++++++++++++++++++++ 10 | " 11 | `; 12 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "babel-eslint", 3 | "extends": [ 4 | "eslint:recommended", 5 | "plugin:prettier/recommended", 6 | "plugin:jest/recommended", 7 | "plugin:flowtype/recommended", 8 | "plugin:react/recommended" 9 | ], 10 | "plugins": ["prettier", "jest", "import", "flowtype", "react"], 11 | "root": true, 12 | "env": { 13 | "es6": true, 14 | "node": true, 15 | "jest": true 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/__tests__/integration-tests/test-render.js: -------------------------------------------------------------------------------- 1 | // @flow strict 2 | 3 | import * as React from "react"; 4 | import ReactCLI from "../../index"; 5 | 6 | export default (testDescription: string, element: React.Node) => { 7 | test(testDescription, done => { 8 | ReactCLI( 9 | element, 10 | undefined, 11 | 50, 12 | output => { 13 | expect(output).toMatchSnapshot(); 14 | done(); 15 | }, 16 | "+" 17 | ); 18 | }); 19 | }; 20 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const ignorePatterns = ["node_modules", "flow-typed", "lib"]; 4 | 5 | module.exports = { 6 | projects: [ 7 | { 8 | displayName: "test", 9 | testMatch: ["/**/__tests__/**/*.js"], 10 | testPathIgnorePatterns: [...ignorePatterns, "test-render"] 11 | }, 12 | { 13 | runner: "jest-runner-eslint", 14 | displayName: "lint", 15 | testMatch: ["/**/*.js"], 16 | testPathIgnorePatterns: ignorePatterns 17 | } 18 | ] 19 | }; 20 | -------------------------------------------------------------------------------- /lib/index.js.flow: -------------------------------------------------------------------------------- 1 | // @flow strict 2 | 3 | import * as React from "react"; 4 | 5 | declare export default ( 6 | element: React.Node, 7 | callback?: () => void, 8 | width?: number, 9 | handler?: (output: string) => void, 10 | spacing?: string 11 | ) => void; 12 | 13 | declare export function Section(props: { 14 | horizontal?: boolean, 15 | align?: "left" | "center" | "right", 16 | border?: { 17 | vertical?: string, 18 | horizontal?: string, 19 | cornerTopLeft?: string, 20 | cornerTopRight?: string, 21 | cornerBottomLeft?: string, 22 | cornerBottomRight?: string 23 | }, 24 | height?: number 25 | }): React.Node; 26 | 27 | declare export function watchStdout(callback: (Array) => void): void; 28 | -------------------------------------------------------------------------------- /src/index.js.flow: -------------------------------------------------------------------------------- 1 | // @flow strict 2 | 3 | import * as React from "react"; 4 | 5 | declare export default ( 6 | element: React.Node, 7 | callback?: () => void, 8 | width?: number, 9 | handler?: (output: string) => void, 10 | spacing?: string 11 | ) => void; 12 | 13 | declare export function Section(props: { 14 | horizontal?: boolean, 15 | align?: "left" | "center" | "right", 16 | border?: { 17 | vertical?: string, 18 | horizontal?: string, 19 | cornerTopLeft?: string, 20 | cornerTopRight?: string, 21 | cornerBottomLeft?: string, 22 | cornerBottomRight?: string 23 | }, 24 | height?: number 25 | }): React.Node; 26 | 27 | declare export function watchStdout(callback: (Array) => void): void; 28 | -------------------------------------------------------------------------------- /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | # Javascript Node CircleCI 2.0 configuration file 2 | # 3 | # Check https://circleci.com/docs/2.0/language-javascript/ for more details 4 | # 5 | version: 2 6 | jobs: 7 | build: 8 | docker: 9 | # specify the version you desire here 10 | - image: circleci/node:10 11 | 12 | working_directory: ~/repo 13 | 14 | steps: 15 | - checkout 16 | 17 | # Download and cache dependencies 18 | - restore_cache: 19 | keys: 20 | - v1-dependencies-{{ checksum "package.json" }} 21 | # fallback to using the latest cache if no exact match is found 22 | - v1-dependencies- 23 | 24 | # install dependencies 25 | - run: npm install 26 | 27 | - save_cache: 28 | paths: 29 | - node_modules 30 | key: v1-dependencies-{{ checksum "package.json" }} 31 | 32 | # run tests! 33 | - run: npm run test 34 | -------------------------------------------------------------------------------- /src/__tests__/local-state-test.js: -------------------------------------------------------------------------------- 1 | // @flow strict 2 | 3 | import * as React from "react"; 4 | import ReactCLI, { Section } from "../index"; 5 | 6 | class TestComponent extends React.Component<{}, { count: number }> { 7 | state = { 8 | count: 0 9 | }; 10 | render() { 11 | return
Counter: {this.state.count}
; 12 | } 13 | } 14 | 15 | const componentReference = React.createRef(); 16 | let updateCount = 0; 17 | test("components should be able to use local state to manage updates", done => { 18 | ReactCLI( 19 | , 20 | () => { 21 | if (componentReference.current) { 22 | componentReference.current.setState({ count: 1 }); 23 | } 24 | }, 25 | 50, 26 | outputString => { 27 | updateCount++; 28 | // this should get called twice 29 | expect(outputString).toMatchSnapshot(); 30 | if (updateCount === 2) { 31 | done(); 32 | } 33 | }, 34 | "+" 35 | ); 36 | }); 37 | -------------------------------------------------------------------------------- /flow-typed/npm/wrap-ansi_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 2ed258db46ad21093b92ddf98a2c8cbb 2 | // flow-typed version: <>/wrap-ansi_v^4.0.0/flow_v0.85.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'wrap-ansi' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'wrap-ansi' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | 26 | 27 | // Filename aliases 28 | declare module 'wrap-ansi/index' { 29 | declare module.exports: $Exports<'wrap-ansi'>; 30 | } 31 | declare module 'wrap-ansi/index.js' { 32 | declare module.exports: $Exports<'wrap-ansi'>; 33 | } 34 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-jest_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: db2f34627ba64ebeb408d0f87a9ee9ce 2 | // flow-typed version: <>/babel-jest_v^23.6.0/flow_v0.85.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-jest' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-jest' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-jest/build/index' { 26 | declare module.exports: any; 27 | } 28 | 29 | // Filename aliases 30 | declare module 'babel-jest/build/index.js' { 31 | declare module.exports: $Exports<'babel-jest/build/index'>; 32 | } 33 | -------------------------------------------------------------------------------- /flow-typed/npm/log-update_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: bc2edb73e83411febf97810dbc70c762 2 | // flow-typed version: <>/log-update_v^2.3.0/flow_v0.76.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'log-update' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'log-update' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | 26 | 27 | // Filename aliases 28 | declare module 'log-update/index' { 29 | declare module.exports: $Exports<'log-update'>; 30 | } 31 | declare module 'log-update/index.js' { 32 | declare module.exports: $Exports<'log-update'>; 33 | } 34 | -------------------------------------------------------------------------------- /flow-typed/npm/strip-ansi_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 4b9536ad7521c09046e9063530b4d07a 2 | // flow-typed version: <>/strip-ansi_v^5.0.0/flow_v0.85.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'strip-ansi' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'strip-ansi' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | 26 | 27 | // Filename aliases 28 | declare module 'strip-ansi/index' { 29 | declare module.exports: $Exports<'strip-ansi'>; 30 | } 31 | declare module 'strip-ansi/index.js' { 32 | declare module.exports: $Exports<'strip-ansi'>; 33 | } 34 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-core_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: bcaf0f5053901c89efd5018efd334f28 2 | // flow-typed version: <>/babel-core_v^7.0.0-bridge/flow_v0.85.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-core' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-core' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | 26 | 27 | // Filename aliases 28 | declare module 'babel-core/index' { 29 | declare module.exports: $Exports<'babel-core'>; 30 | } 31 | declare module 'babel-core/index.js' { 32 | declare module.exports: $Exports<'babel-core'>; 33 | } 34 | -------------------------------------------------------------------------------- /flow-typed/npm/ansi-escapes_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 9753bca1f0499780907a02bab6804911 2 | // flow-typed version: <>/ansi-escapes_v^3.1.0/flow_v0.85.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'ansi-escapes' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'ansi-escapes' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | 26 | 27 | // Filename aliases 28 | declare module 'ansi-escapes/index' { 29 | declare module.exports: $Exports<'ansi-escapes'>; 30 | } 31 | declare module 'ansi-escapes/index.js' { 32 | declare module.exports: $Exports<'ansi-escapes'>; 33 | } 34 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-preset-flow_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: b3edf84f2525a3d8c1a6b7229308b75d 2 | // flow-typed version: <>/babel-preset-flow_v^6.23.0/flow_v0.76.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-preset-flow' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-preset-flow' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-preset-flow/lib/index' { 26 | declare module.exports: any; 27 | } 28 | 29 | // Filename aliases 30 | declare module 'babel-preset-flow/lib/index.js' { 31 | declare module.exports: $Exports<'babel-preset-flow/lib/index'>; 32 | } 33 | -------------------------------------------------------------------------------- /flow-typed/npm/@babel/preset-flow_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 393cd96a590f54c79f2bf06b71507103 2 | // flow-typed version: <>/@babel/preset-flow_v^7.0.0/flow_v0.85.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * '@babel/preset-flow' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module '@babel/preset-flow' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module '@babel/preset-flow/lib/index' { 26 | declare module.exports: any; 27 | } 28 | 29 | // Filename aliases 30 | declare module '@babel/preset-flow/lib/index.js' { 31 | declare module.exports: $Exports<'@babel/preset-flow/lib/index'>; 32 | } 33 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-preset-react_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: b5ef6ceeb087ce6c619609f6d363cf76 2 | // flow-typed version: <>/babel-preset-react_v^6.24.1/flow_v0.76.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-preset-react' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-preset-react' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-preset-react/lib/index' { 26 | declare module.exports: any; 27 | } 28 | 29 | // Filename aliases 30 | declare module 'babel-preset-react/lib/index.js' { 31 | declare module.exports: $Exports<'babel-preset-react/lib/index'>; 32 | } 33 | -------------------------------------------------------------------------------- /flow-typed/npm/@babel/preset-react_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 291fea44f48df514b27eea380d7d656c 2 | // flow-typed version: <>/@babel/preset-react_v^7.0.0/flow_v0.85.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * '@babel/preset-react' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module '@babel/preset-react' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module '@babel/preset-react/lib/index' { 26 | declare module.exports: any; 27 | } 28 | 29 | // Filename aliases 30 | declare module '@babel/preset-react/lib/index.js' { 31 | declare module.exports: $Exports<'@babel/preset-react/lib/index'>; 32 | } 33 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-preset-stage-2_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 62cbc85984874dfe6ae09b2acbdc85ce 2 | // flow-typed version: <>/babel-preset-stage-2_v^6.24.1/flow_v0.76.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-preset-stage-2' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-preset-stage-2' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-preset-stage-2/lib/index' { 26 | declare module.exports: any; 27 | } 28 | 29 | // Filename aliases 30 | declare module 'babel-preset-stage-2/lib/index.js' { 31 | declare module.exports: $Exports<'babel-preset-stage-2/lib/index'>; 32 | } 33 | -------------------------------------------------------------------------------- /flow-typed/npm/is-fullwidth-code-point_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 14ca438aa0c11e88a83dfe45bccb05d0 2 | // flow-typed version: <>/is-fullwidth-code-point_v^2.0.0/flow_v0.85.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'is-fullwidth-code-point' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'is-fullwidth-code-point' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | 26 | 27 | // Filename aliases 28 | declare module 'is-fullwidth-code-point/index' { 29 | declare module.exports: $Exports<'is-fullwidth-code-point'>; 30 | } 31 | declare module 'is-fullwidth-code-point/index.js' { 32 | declare module.exports: $Exports<'is-fullwidth-code-point'>; 33 | } 34 | -------------------------------------------------------------------------------- /flow-typed/npm/eslint-plugin-prettier_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: f8e45e3df52d2e5050f860478f414685 2 | // flow-typed version: <>/eslint-plugin-prettier_v^3.0.0/flow_v0.85.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'eslint-plugin-prettier' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'eslint-plugin-prettier' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'eslint-plugin-prettier/eslint-plugin-prettier' { 26 | declare module.exports: any; 27 | } 28 | 29 | // Filename aliases 30 | declare module 'eslint-plugin-prettier/eslint-plugin-prettier.js' { 31 | declare module.exports: $Exports<'eslint-plugin-prettier/eslint-plugin-prettier'>; 32 | } 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Mike Grip 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /flow-typed/npm/@babel/plugin-proposal-class-properties_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 5f0a55435ec67d89585fb06e54cdaef9 2 | // flow-typed version: <>/@babel/plugin-proposal-class-properties_v^7.1.0/flow_v0.85.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * '@babel/plugin-proposal-class-properties' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module '@babel/plugin-proposal-class-properties' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module '@babel/plugin-proposal-class-properties/lib/index' { 26 | declare module.exports: any; 27 | } 28 | 29 | // Filename aliases 30 | declare module '@babel/plugin-proposal-class-properties/lib/index.js' { 31 | declare module.exports: $Exports<'@babel/plugin-proposal-class-properties/lib/index'>; 32 | } 33 | -------------------------------------------------------------------------------- /flow-typed/npm/intercept-stdout_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: a0b6da847d244cecfa36d30de8d2fa4b 2 | // flow-typed version: <>/intercept-stdout_v^0.1.2/flow_v0.85.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'intercept-stdout' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'intercept-stdout' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'intercept-stdout/intercept-stdout' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'intercept-stdout/test/intercept' { 30 | declare module.exports: any; 31 | } 32 | 33 | // Filename aliases 34 | declare module 'intercept-stdout/intercept-stdout.js' { 35 | declare module.exports: $Exports<'intercept-stdout/intercept-stdout'>; 36 | } 37 | declare module 'intercept-stdout/test/intercept.js' { 38 | declare module.exports: $Exports<'intercept-stdout/test/intercept'>; 39 | } 40 | -------------------------------------------------------------------------------- /src/__tests__/__snapshots__/emoji-test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`columns containing emojis should render the correct width 1`] = ` 4 | "************************************************** 5 | *Row 1+++++++++++++++++++++++++++++++++++++++++++* 6 | *Row 2 🎉🍾🎉++++++++++++++++++++++++++++++++++++* 7 | ************************************************** 8 | " 9 | `; 10 | 11 | exports[`columns containing emojis should render the correct width 2`] = ` 12 | "************************************************** 13 | *Emoji test line one, its a lont line that takes+* 14 | *space 🤘++++++++++++++++++++++++++++++++++++++++* 15 | *🛠 Multiple emojis in the same line! 🍾 🛫++++++* 16 | *🛠 Some more emojis with elipsis... 🕸++++++++++* 17 | *An emoji in the middle 🛠 thats so \\"--crazy\\"++++* 18 | *one more for good measure... 🕸+++++++++++++++++* 19 | ************************************************** 20 | " 21 | `; 22 | 23 | exports[`columns containing emojis should render the correct width 3`] = ` 24 | "************************************************** 25 | *++++++++++++++++++++✔︎ Step 1++++++++++++++++++++* 26 | *++++++++++++++++++++◯ Step 2++++++++++++++++++++* 27 | *++++++++++++++++++++◯ Step 3++++++++++++++++++++* 28 | ************************************************** 29 | " 30 | `; 31 | -------------------------------------------------------------------------------- /flow-typed/npm/jest-runner-flowtype_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 10bb9e872afe98e86542cf9196cced9c 2 | // flow-typed version: <>/jest-runner-flowtype_v^0.0.7/flow_v0.85.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'jest-runner-flowtype' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'jest-runner-flowtype' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'jest-runner-flowtype/src/FlowtypeRunner' { 26 | declare module.exports: any; 27 | } 28 | 29 | // Filename aliases 30 | declare module 'jest-runner-flowtype/index' { 31 | declare module.exports: $Exports<'jest-runner-flowtype'>; 32 | } 33 | declare module 'jest-runner-flowtype/index.js' { 34 | declare module.exports: $Exports<'jest-runner-flowtype'>; 35 | } 36 | declare module 'jest-runner-flowtype/src/FlowtypeRunner.js' { 37 | declare module.exports: $Exports<'jest-runner-flowtype/src/FlowtypeRunner'>; 38 | } 39 | -------------------------------------------------------------------------------- /flow-typed/npm/wcwidth_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 670a68200c163a18b685400fa99d8d44 2 | // flow-typed version: <>/wcwidth_v^1.0.1/flow_v0.85.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'wcwidth' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'wcwidth' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'wcwidth/combining' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'wcwidth/test/index' { 30 | declare module.exports: any; 31 | } 32 | 33 | // Filename aliases 34 | declare module 'wcwidth/combining.js' { 35 | declare module.exports: $Exports<'wcwidth/combining'>; 36 | } 37 | declare module 'wcwidth/index' { 38 | declare module.exports: $Exports<'wcwidth'>; 39 | } 40 | declare module 'wcwidth/index.js' { 41 | declare module.exports: $Exports<'wcwidth'>; 42 | } 43 | declare module 'wcwidth/test/index.js' { 44 | declare module.exports: $Exports<'wcwidth/test/index'>; 45 | } 46 | -------------------------------------------------------------------------------- /src/demo.js: -------------------------------------------------------------------------------- 1 | // @flow strict-local 2 | 3 | import ReactCLI, { Section } from "./index"; 4 | import React from "react"; 5 | import chalk from "chalk"; 6 | 7 | class MyReactCLIApp extends React.Component<{}, { step: number }> { 8 | state = { 9 | step: 0 10 | }; 11 | 12 | componentDidMount() { 13 | setTimeout(() => this.setState({ step: 1 }), 1000); 14 | setTimeout(() => this.setState({ step: 2 }), 2000); 15 | setTimeout(() => this.setState({ step: 3 }), 3000); 16 | } 17 | 18 | render() { 19 | return ( 20 |
21 | My {chalk.blue("New")} {chalk.magenta("ReactCLI App")} 🚀 22 |
23 | 🛠 Emojis are difficult with monospaced text... 🕸 24 |
25 |
26 | {this.state.step >= 1 ? chalk.green("✓") : "◯"} Step 1
27 | {this.state.step >= 2 ? chalk.green("✓") : "◯"} Step 2
28 | {this.state.step >= 3 ? chalk.green("✓") : "◯"} Step 3 29 |
30 |
31 | Number of steps done:{" "} 32 | {chalk.bold.magenta(this.state.step.toString())} 33 |
34 |
35 |
36 | ); 37 | } 38 | } 39 | 40 | ReactCLI(, undefined, 60); 41 | -------------------------------------------------------------------------------- /src/__tests__/emoji-test.js: -------------------------------------------------------------------------------- 1 | // @flow strict 2 | 3 | import * as React from "react"; 4 | import ReactCLI, { Section } from "../index"; 5 | 6 | test("columns containing emojis should render the correct width", done => { 7 | ReactCLI( 8 |
9 | Row 1
Row 2 🎉🍾🎉 10 |
, 11 | undefined, 12 | 50, 13 | outputString => { 14 | expect(outputString).toMatchSnapshot(); 15 | done(); 16 | }, 17 | "+" 18 | ); 19 | 20 | ReactCLI( 21 |
22 | Emoji test line one, its a lont line that takes space 🤘 23 |
24 | 🛠 Multiple emojis in the same line! 🍾 🛫 25 |
26 | 🛠 Some more emojis with elipsis... 🕸 27 |
28 | An emoji in the middle 🛠 thats so {'"--crazy"'} 29 |
30 | one more for good measure... 🕸 31 |
32 |
, 33 | undefined, 34 | 50, 35 | outputString => { 36 | expect(outputString).toMatchSnapshot(); 37 | done(); 38 | }, 39 | "+" 40 | ); 41 | 42 | ReactCLI( 43 |
44 | ✔︎ Step 1
◯ Step 2
◯ Step 3 45 |
, 46 | undefined, 47 | 50, 48 | outputString => { 49 | expect(outputString).toMatchSnapshot(); 50 | done(); 51 | }, 52 | "+" 53 | ); 54 | }); 55 | -------------------------------------------------------------------------------- /flow-typed/npm/emoji-regex_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 41996ab01a6de9ac3ccc25b0663543d3 2 | // flow-typed version: <>/emoji-regex_v^7.0.1/flow_v0.85.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'emoji-regex' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'emoji-regex' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'emoji-regex/es2015/index' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'emoji-regex/es2015/text' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'emoji-regex/text' { 34 | declare module.exports: any; 35 | } 36 | 37 | // Filename aliases 38 | declare module 'emoji-regex/es2015/index.js' { 39 | declare module.exports: $Exports<'emoji-regex/es2015/index'>; 40 | } 41 | declare module 'emoji-regex/es2015/text.js' { 42 | declare module.exports: $Exports<'emoji-regex/es2015/text'>; 43 | } 44 | declare module 'emoji-regex/index' { 45 | declare module.exports: $Exports<'emoji-regex'>; 46 | } 47 | declare module 'emoji-regex/index.js' { 48 | declare module.exports: $Exports<'emoji-regex'>; 49 | } 50 | declare module 'emoji-regex/text.js' { 51 | declare module.exports: $Exports<'emoji-regex/text'>; 52 | } 53 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-cli-renderer", 3 | "version": "1.5.0", 4 | "main": "lib/index.js", 5 | "files": [ 6 | "lib" 7 | ], 8 | "license": "MIT", 9 | "private": false, 10 | "devDependencies": { 11 | "@babel/cli": "^7.1.2", 12 | "@babel/core": "^7.1.2", 13 | "@babel/plugin-proposal-class-properties": "^7.1.0", 14 | "@babel/preset-env": "^7.1.0", 15 | "@babel/preset-flow": "^7.0.0", 16 | "@babel/preset-react": "^7.0.0", 17 | "babel-core": "^7.0.0-bridge", 18 | "babel-eslint": "^10.0.1", 19 | "babel-jest": "^23.6.0", 20 | "chalk": "^2.4.1", 21 | "eslint": "^5.8.0", 22 | "eslint-config-prettier": "^3.1.0", 23 | "eslint-plugin-flowtype": "^3.1.4", 24 | "eslint-plugin-import": "^2.14.0", 25 | "eslint-plugin-jest": "^22.1.2", 26 | "eslint-plugin-prettier": "^3.0.0", 27 | "eslint-plugin-react": "^7.11.1", 28 | "flow-bin": "^0.89.0", 29 | "jest": "^23.6.0", 30 | "jest-runner-eslint": "^0.7.1", 31 | "prettier": "^1.14.3", 32 | "react": "^16.6.0" 33 | }, 34 | "scripts": { 35 | "build": "babel src/ -d lib/ --ignore '*/__tests__/*' && cp src/index.js.flow lib/", 36 | "debug": "node --inspect node_modules/.bin/jest --runInBand", 37 | "demo": "svg-term --command 'node lib/demo.js' --out .github/demo.svg --window --from 50 --to 5000 --term hyper --profile hyper-chesterish", 38 | "prepublish": "npm run build", 39 | "test": "jest" 40 | }, 41 | "dependencies": { 42 | "ansi-escapes": "^3.1.0", 43 | "intercept-stdout": "^0.1.2", 44 | "react-reconciler": "^0.17.2", 45 | "strip-ansi": "^5.0.0", 46 | "wcwidth": "^1.0.1", 47 | "wrap-ansi": "^4.0.0" 48 | }, 49 | "peerDependencies": { 50 | "react": "^16.4.0" 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/__tests__/integration-tests/__snapshots__/kitchen-sink-test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Columns and rows should work together 1`] = ` 4 | "Some text+++++++++++++++++++++++++++++++++++++++++ 5 | Column A++++++++Column B++++++++Column C++++++++++ 6 | Other text++++++++++++++++++++++++++++++++++++++++ 7 | " 8 | `; 9 | 10 | exports[`Columns should work nested within other columns 1`] = ` 11 | "Column A++++++++Column B++++++++Column C++++++++++ 12 | ++++++++++++++++++Some++++And+++++++++++++++++++++ 13 | +++++++++++++++++other+++heres++++++++++++++++++++ 14 | ++++++++++++++++++text++++the+++++++++++++++++++++ 15 | ++++++++++++++++++that+++other++++++++++++++++++++ 16 | +++++++++++++++++should++column+++++++++++++++++++ 17 | ++++++++++++++++probably++++++++++++++++++++++++++ 18 | ++++++++++++++++++wrap++++++++++++++++++++++++++++ 19 | " 20 | `; 21 | 22 | exports[`Columns, rows, section styles should all work together 1`] = ` 23 | "################################################## 24 | #++++++++++++++++++++Some App++++++++++++++++++++# 25 | #************************------------------------# 26 | #*+++++++✔︎ Step 1+++++++*|Some messages for this|# 27 | #*+++++++◯ Step 2+++++++*|app+++++++++++++++++++|# 28 | #*+++++++◯ Step 3+++++++*------------------------# 29 | #************************++++++++++++++++++++++++# 30 | #++++++Some stuff for this app is done! 🤘+++++++# 31 | #Heres some more informative stuff about your app# 32 | #++++++++++++++++++++browser+++++++++++++++++++++# 33 | #+++++++++++++++++++++↙↗ ↖↘++++++++++++++++++++++# 34 | #------------------------------------------------# 35 | #|++++++++server++++++++||++++++dev-server++++++|# 36 | #|++(initial response)++||+++++(app bundle)+++++|# 37 | #|++++localhost:3000++++||++++localhost:8080++++|# 38 | #------------------------|websocket server (for+|# 39 | #++++++++++++++++++++++++|+++++++++HMR)+++++++++|# 40 | #++++++++++++++++++++++++|++++localhost:8081++++|# 41 | #++++++++++++++++++++++++------------------------# 42 | ################################################## 43 | " 44 | `; 45 | -------------------------------------------------------------------------------- /src/reconciler.js: -------------------------------------------------------------------------------- 1 | // @flow strict 2 | 3 | import { Section, Text, Break } from "./components"; 4 | import Reconciler from "react-reconciler"; 5 | 6 | const ReconcilerConfig = { 7 | appendInitialChild(parentInstance, child) { 8 | parentInstance.children.push(child); 9 | }, 10 | 11 | createInstance(type, props) { 12 | // valid types: section, break 13 | switch (type) { 14 | case Break.type: 15 | return new Break(); 16 | case Section.type: 17 | return new Section({ 18 | useHorizontalOrientation: props.horizontal, 19 | align: props.align, 20 | border: props.border, 21 | height: props.height 22 | }); 23 | default: 24 | // throw error? 25 | return false; 26 | } 27 | }, 28 | 29 | createTextInstance(text) { 30 | return new Text(text); 31 | }, 32 | 33 | finalizeInitialChildren() { 34 | return false; 35 | }, 36 | 37 | getPublicInstance(inst) { 38 | return inst; 39 | }, 40 | 41 | prepareUpdate() { 42 | return true; 43 | }, 44 | 45 | resetAfterCommit(rootContainerInstance) { 46 | rootContainerInstance.update(); 47 | }, 48 | 49 | getChildHostContext() { 50 | return {}; 51 | }, 52 | 53 | shouldSetTextContent() { 54 | return false; 55 | }, 56 | 57 | now: () => {}, 58 | 59 | supportsMutation: true, 60 | 61 | appendChild(parentInstance, child) { 62 | parentInstance.children.push(child); 63 | }, 64 | 65 | appendChildToContainer(parentInstance, child) { 66 | parentInstance.root = child; 67 | }, 68 | 69 | removeChild(parentInstance, child) { 70 | parentInstance.splice(parentInstance.children.indexOf(child), 1); 71 | }, 72 | 73 | removeChildFromContainer(parentInstance, child) { 74 | parentInstance.splice(parentInstance.children.indexOf(child), 1); 75 | }, 76 | 77 | commitTextUpdate(textInstance, oldText, newText) { 78 | textInstance.text = newText; 79 | }, 80 | 81 | prepareForCommit() {}, 82 | resetTextContent() {}, 83 | getRootHostContext() {}, 84 | insertBefore() {}, 85 | commitUpdate() {}, 86 | commitMount() {} 87 | }; 88 | 89 | export default Reconciler(ReconcilerConfig); 90 | -------------------------------------------------------------------------------- /src/__tests__/integration-tests/kitchen-sink-test.js: -------------------------------------------------------------------------------- 1 | // @flow strict 2 | 3 | import React from "react"; 4 | import TestRender from "./test-render"; 5 | import { Section } from "../../index"; 6 | 7 | TestRender( 8 | "Columns and rows should work together", 9 |
10 | Some text 11 |
12 |
Column A
13 |
Column B
14 |
Column C
15 |
16 | Other text 17 |
18 | ); 19 | 20 | TestRender( 21 | "Columns should work nested within other columns", 22 |
23 |
Column A
24 |
25 | Column B 26 |
27 | Some other text that should probably wrap 28 |
29 | And heres the other column 30 |
31 |
32 |
Column C
33 |
34 | ); 35 | 36 | TestRender( 37 | "Columns, rows, section styles should all work together", 38 |
39 | Some App 40 |
41 |
42 |
43 | ✔︎ Step 1
◯ Step 2
◯ Step 3 44 |
45 |
46 | Some messages for this app 47 |
48 |
49 |
50 | Some stuff for this app is done! 🤘 51 |
52 | Heres some more informative stuff about your app 53 |
54 | browser 55 |
56 | ↙↗ ↖↘ 57 |
58 |
59 | server 60 |
61 | (initial response) 62 |
63 | localhost:3000 64 |
65 |
66 | dev-server 67 |
68 | (app bundle) 69 |
70 | localhost:8080 71 |
72 | websocket server (for HMR) 73 |
74 | localhost:8081 75 |
76 |
77 |
78 |
79 | ); 80 | -------------------------------------------------------------------------------- /src/__tests__/__snapshots__/section-test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`sections should be able to align text center 1`] = ` 4 | "+++++++++++++++++++Center text++++++++++++++++++++ 5 | " 6 | `; 7 | 8 | exports[`sections should be able to align text left 1`] = ` 9 | "Left text+++++++++++++++++++++++++++++++++++++++++ 10 | " 11 | `; 12 | 13 | exports[`sections should be able to align text right 1`] = ` 14 | "++++++++++++++++++++++++++++++++++++++++Right text 15 | " 16 | `; 17 | 18 | exports[`sections should be able to declare a fixed height 1`] = ` 19 | "Line 1 20 | Line 2 21 | Line 3 22 | " 23 | `; 24 | 25 | exports[`sections should be able to declare a fixed height 2`] = ` 26 | "************************************************** 27 | *Line 1 * 28 | *Line 2 * 29 | *Line 3 * 30 | 31 | 32 | ************************************************** 33 | " 34 | `; 35 | 36 | exports[`sections should be able to declare a fixed height 3`] = ` 37 | "Test Line 1 38 | Line 2 39 | Line 3 40 | " 41 | `; 42 | 43 | exports[`sections should be able to render a border 1`] = ` 44 | "-------------------------------------------------- 45 | |++++++++++++Test section with border++++++++++++| 46 | -------------------------------------------------- 47 | " 48 | `; 49 | 50 | exports[`sections should be able to render a border 2`] = ` 51 | "************************************************** 52 | *Some Text+++++++++++++++------------------------* 53 | *++++++++++++++++++++++++|++Test section with+++|* 54 | *++++++++++++++++++++++++|++++++++border++++++++|* 55 | *++++++++++++++++++++++++------------------------* 56 | ************************************************** 57 | " 58 | `; 59 | 60 | exports[`sections should be able to render horizontally 1`] = ` 61 | "Column 1+++++++++++++++++Column 2+++++++++++++++++ 62 | " 63 | `; 64 | 65 | exports[`sections should be able to render vertically 1`] = ` 66 | "Row 1+++++++++++++++++++++++++++++++++++++++++++++ 67 | Row 2+++++++++++++++++++++++++++++++++++++++++++++ 68 | " 69 | `; 70 | -------------------------------------------------------------------------------- /flow-typed/npm/eslint-config-prettier_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 28bd9d5cded61bd556e4548ce507056c 2 | // flow-typed version: <>/eslint-config-prettier_v^3.1.0/flow_v0.85.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'eslint-config-prettier' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'eslint-config-prettier' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'eslint-config-prettier/bin/cli' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'eslint-config-prettier/bin/validators' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'eslint-config-prettier/flowtype' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'eslint-config-prettier/react' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'eslint-config-prettier/standard' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'eslint-config-prettier/unicorn' { 46 | declare module.exports: any; 47 | } 48 | 49 | // Filename aliases 50 | declare module 'eslint-config-prettier/bin/cli.js' { 51 | declare module.exports: $Exports<'eslint-config-prettier/bin/cli'>; 52 | } 53 | declare module 'eslint-config-prettier/bin/validators.js' { 54 | declare module.exports: $Exports<'eslint-config-prettier/bin/validators'>; 55 | } 56 | declare module 'eslint-config-prettier/flowtype.js' { 57 | declare module.exports: $Exports<'eslint-config-prettier/flowtype'>; 58 | } 59 | declare module 'eslint-config-prettier/index' { 60 | declare module.exports: $Exports<'eslint-config-prettier'>; 61 | } 62 | declare module 'eslint-config-prettier/index.js' { 63 | declare module.exports: $Exports<'eslint-config-prettier'>; 64 | } 65 | declare module 'eslint-config-prettier/react.js' { 66 | declare module.exports: $Exports<'eslint-config-prettier/react'>; 67 | } 68 | declare module 'eslint-config-prettier/standard.js' { 69 | declare module.exports: $Exports<'eslint-config-prettier/standard'>; 70 | } 71 | declare module 'eslint-config-prettier/unicorn.js' { 72 | declare module.exports: $Exports<'eslint-config-prettier/unicorn'>; 73 | } 74 | -------------------------------------------------------------------------------- /flow-typed/npm/jest-runner-eslint_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 920cfb2bfde7ba04e6d93f9a22924b93 2 | // flow-typed version: <>/jest-runner-eslint_v^0.7.1/flow_v0.85.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'jest-runner-eslint' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'jest-runner-eslint' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'jest-runner-eslint/build/runner/index' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'jest-runner-eslint/build/runner/runESLint' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'jest-runner-eslint/build/utils/configOverrides' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'jest-runner-eslint/build/utils/getESLintOptions' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'jest-runner-eslint/build/utils/normalizeConfig' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'jest-runner-eslint/build/watchFixPlugin/index' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'jest-runner-eslint/watch-fix' { 50 | declare module.exports: any; 51 | } 52 | 53 | // Filename aliases 54 | declare module 'jest-runner-eslint/build/runner/index.js' { 55 | declare module.exports: $Exports<'jest-runner-eslint/build/runner/index'>; 56 | } 57 | declare module 'jest-runner-eslint/build/runner/runESLint.js' { 58 | declare module.exports: $Exports<'jest-runner-eslint/build/runner/runESLint'>; 59 | } 60 | declare module 'jest-runner-eslint/build/utils/configOverrides.js' { 61 | declare module.exports: $Exports<'jest-runner-eslint/build/utils/configOverrides'>; 62 | } 63 | declare module 'jest-runner-eslint/build/utils/getESLintOptions.js' { 64 | declare module.exports: $Exports<'jest-runner-eslint/build/utils/getESLintOptions'>; 65 | } 66 | declare module 'jest-runner-eslint/build/utils/normalizeConfig.js' { 67 | declare module.exports: $Exports<'jest-runner-eslint/build/utils/normalizeConfig'>; 68 | } 69 | declare module 'jest-runner-eslint/build/watchFixPlugin/index.js' { 70 | declare module.exports: $Exports<'jest-runner-eslint/build/watchFixPlugin/index'>; 71 | } 72 | declare module 'jest-runner-eslint/watch-fix.js' { 73 | declare module.exports: $Exports<'jest-runner-eslint/watch-fix'>; 74 | } 75 | -------------------------------------------------------------------------------- /flow-typed/npm/chalk_v2.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: db5b2cdde8db39d47e27cc8ab84f89bf 2 | // flow-typed version: d662d43161/chalk_v2.x.x/flow_>=v0.25.x 3 | 4 | // From: https://github.com/chalk/chalk/blob/master/index.js.flow 5 | 6 | declare module "chalk" { 7 | declare type TemplateStringsArray = $ReadOnlyArray; 8 | 9 | declare type Level = $Values<{ 10 | None: 0, 11 | Basic: 1, 12 | Ansi256: 2, 13 | TrueColor: 3 14 | }>; 15 | 16 | declare type ChalkOptions = {| 17 | enabled?: boolean, 18 | level?: Level 19 | |}; 20 | 21 | declare type ColorSupport = {| 22 | level: Level, 23 | hasBasic: boolean, 24 | has256: boolean, 25 | has16m: boolean 26 | |}; 27 | 28 | declare interface Chalk { 29 | (...text: string[]): string, 30 | (text: TemplateStringsArray, ...placeholders: string[]): string, 31 | constructor(options?: ChalkOptions): Chalk, 32 | enabled: boolean, 33 | level: Level, 34 | rgb(r: number, g: number, b: number): Chalk, 35 | hsl(h: number, s: number, l: number): Chalk, 36 | hsv(h: number, s: number, v: number): Chalk, 37 | hwb(h: number, w: number, b: number): Chalk, 38 | bgHex(color: string): Chalk, 39 | bgKeyword(color: string): Chalk, 40 | bgRgb(r: number, g: number, b: number): Chalk, 41 | bgHsl(h: number, s: number, l: number): Chalk, 42 | bgHsv(h: number, s: number, v: number): Chalk, 43 | bgHwb(h: number, w: number, b: number): Chalk, 44 | hex(color: string): Chalk, 45 | keyword(color: string): Chalk, 46 | 47 | +reset: Chalk, 48 | +bold: Chalk, 49 | +dim: Chalk, 50 | +italic: Chalk, 51 | +underline: Chalk, 52 | +inverse: Chalk, 53 | +hidden: Chalk, 54 | +strikethrough: Chalk, 55 | 56 | +visible: Chalk, 57 | 58 | +black: Chalk, 59 | +red: Chalk, 60 | +green: Chalk, 61 | +yellow: Chalk, 62 | +blue: Chalk, 63 | +magenta: Chalk, 64 | +cyan: Chalk, 65 | +white: Chalk, 66 | +gray: Chalk, 67 | +grey: Chalk, 68 | +blackBright: Chalk, 69 | +redBright: Chalk, 70 | +greenBright: Chalk, 71 | +yellowBright: Chalk, 72 | +blueBright: Chalk, 73 | +magentaBright: Chalk, 74 | +cyanBright: Chalk, 75 | +whiteBright: Chalk, 76 | 77 | +bgBlack: Chalk, 78 | +bgRed: Chalk, 79 | +bgGreen: Chalk, 80 | +bgYellow: Chalk, 81 | +bgBlue: Chalk, 82 | +bgMagenta: Chalk, 83 | +bgCyan: Chalk, 84 | +bgWhite: Chalk, 85 | +bgBlackBright: Chalk, 86 | +bgRedBright: Chalk, 87 | +bgGreenBright: Chalk, 88 | +bgYellowBright: Chalk, 89 | +bgBlueBright: Chalk, 90 | +bgMagentaBright: Chalk, 91 | +bgCyanBright: Chalk, 92 | +bgWhiteBrigh: Chalk, 93 | 94 | supportsColor: ColorSupport 95 | } 96 | 97 | declare module.exports: Chalk; 98 | } 99 | -------------------------------------------------------------------------------- /flow-typed/npm/@babel/cli_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: d3e92f8ef1f938cac34aa4c55682ab67 2 | // flow-typed version: <>/@babel/cli_v^7.1.2/flow_v0.85.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * '@babel/cli' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module '@babel/cli' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module '@babel/cli/bin/babel-external-helpers' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module '@babel/cli/bin/babel' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module '@babel/cli/lib/babel-external-helpers' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module '@babel/cli/lib/babel/dir' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module '@babel/cli/lib/babel/file' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module '@babel/cli/lib/babel/index' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module '@babel/cli/lib/babel/options' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module '@babel/cli/lib/babel/util' { 54 | declare module.exports: any; 55 | } 56 | 57 | // Filename aliases 58 | declare module '@babel/cli/bin/babel-external-helpers.js' { 59 | declare module.exports: $Exports<'@babel/cli/bin/babel-external-helpers'>; 60 | } 61 | declare module '@babel/cli/bin/babel.js' { 62 | declare module.exports: $Exports<'@babel/cli/bin/babel'>; 63 | } 64 | declare module '@babel/cli/index' { 65 | declare module.exports: $Exports<'@babel/cli'>; 66 | } 67 | declare module '@babel/cli/index.js' { 68 | declare module.exports: $Exports<'@babel/cli'>; 69 | } 70 | declare module '@babel/cli/lib/babel-external-helpers.js' { 71 | declare module.exports: $Exports<'@babel/cli/lib/babel-external-helpers'>; 72 | } 73 | declare module '@babel/cli/lib/babel/dir.js' { 74 | declare module.exports: $Exports<'@babel/cli/lib/babel/dir'>; 75 | } 76 | declare module '@babel/cli/lib/babel/file.js' { 77 | declare module.exports: $Exports<'@babel/cli/lib/babel/file'>; 78 | } 79 | declare module '@babel/cli/lib/babel/index.js' { 80 | declare module.exports: $Exports<'@babel/cli/lib/babel/index'>; 81 | } 82 | declare module '@babel/cli/lib/babel/options.js' { 83 | declare module.exports: $Exports<'@babel/cli/lib/babel/options'>; 84 | } 85 | declare module '@babel/cli/lib/babel/util.js' { 86 | declare module.exports: $Exports<'@babel/cli/lib/babel/util'>; 87 | } 88 | -------------------------------------------------------------------------------- /src/components.js: -------------------------------------------------------------------------------- 1 | // @flow strict 2 | 3 | class Border { 4 | vertical: ?string; 5 | horizontal: ?string; 6 | cornerTopLeft: ?string; 7 | cornerTopRight: ?string; 8 | cornerBottomLeft: ?string; 9 | cornerBottomRight: ?string; 10 | 11 | constructor({ 12 | vertical, 13 | horizontal, 14 | cornerTopLeft, 15 | cornerTopRight, 16 | cornerBottomLeft, 17 | cornerBottomRight 18 | }) { 19 | this.vertical = vertical; 20 | this.horizontal = horizontal; 21 | this.cornerTopLeft = cornerTopLeft; 22 | this.cornerTopRight = cornerTopRight; 23 | this.cornerBottomLeft = cornerBottomLeft; 24 | this.cornerBottomRight = cornerBottomRight; 25 | } 26 | 27 | horizontalWidth(): number { 28 | return ( 29 | Math.max( 30 | this.vertical ? this.vertical.length : 0, 31 | this.cornerTopLeft ? this.cornerTopLeft.length : 0, 32 | this.cornerBottomLeft ? this.cornerBottomLeft.length : 0 33 | ) + 34 | Math.max( 35 | this.vertical ? this.vertical.length : 0, 36 | this.cornerTopRight ? this.cornerTopRight.length : 0, 37 | this.cornerBottomRight ? this.cornerBottomRight.length : 0 38 | ) 39 | ); 40 | } 41 | 42 | verticalHeight(): number { 43 | return ( 44 | Math.max( 45 | this.horizontal ? this.horizontal.length : 0, 46 | this.cornerTopLeft ? this.cornerTopLeft.length : 0, 47 | this.cornerTopRight ? this.cornerTopRight.length : 0 48 | ) + 49 | Math.max( 50 | this.horizontal ? this.horizontal.length : 0, 51 | this.cornerBottomLeft ? this.cornerBottomLeft.length : 0, 52 | this.cornerBottomRight ? this.cornerBottomRight.length : 0 53 | ) 54 | ); 55 | } 56 | } 57 | export class Section { 58 | orientation: "vertical" | "horizontal"; 59 | align: "left" | "center" | "right"; 60 | children: Array
= []; 61 | border: Border; 62 | height: ?number; 63 | static type: "div" = "div"; 64 | 65 | constructor({ 66 | useHorizontalOrientation = false, 67 | align = "left", 68 | border = {}, 69 | height 70 | }: { 71 | useHorizontalOrientation: boolean, 72 | align: "left" | "center" | "right", 73 | border: { 74 | vertical?: string, 75 | horizontal?: string, 76 | cornerTopLeft?: string, 77 | cornerTopRight?: string, 78 | cornerBottomLeft?: string, 79 | cornerBottomRight?: string 80 | }, 81 | height?: number 82 | }) { 83 | this.orientation = useHorizontalOrientation ? "horizontal" : "vertical"; 84 | this.align = align; 85 | this.border = new Border(border); 86 | this.height = height; 87 | } 88 | } 89 | 90 | export class Text { 91 | text: string; 92 | 93 | constructor(text: string) { 94 | this.text = text; 95 | } 96 | } 97 | 98 | export class Break { 99 | static type: "br" = "br"; 100 | } 101 | -------------------------------------------------------------------------------- /lib/reconciler.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = void 0; 7 | 8 | var _components = require("./components"); 9 | 10 | var _reactReconciler = _interopRequireDefault(require("react-reconciler")); 11 | 12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 13 | 14 | // strict 15 | var ReconcilerConfig = { 16 | appendInitialChild: function appendInitialChild(parentInstance, child) { 17 | parentInstance.children.push(child); 18 | }, 19 | createInstance: function createInstance(type, props) { 20 | // valid types: section, break 21 | switch (type) { 22 | case _components.Break.type: 23 | return new _components.Break(); 24 | 25 | case _components.Section.type: 26 | return new _components.Section({ 27 | useHorizontalOrientation: props.horizontal, 28 | align: props.align, 29 | border: props.border, 30 | height: props.height 31 | }); 32 | 33 | default: 34 | // throw error? 35 | return false; 36 | } 37 | }, 38 | createTextInstance: function createTextInstance(text) { 39 | return new _components.Text(text); 40 | }, 41 | finalizeInitialChildren: function finalizeInitialChildren() { 42 | return false; 43 | }, 44 | getPublicInstance: function getPublicInstance(inst) { 45 | return inst; 46 | }, 47 | prepareUpdate: function prepareUpdate() { 48 | return true; 49 | }, 50 | resetAfterCommit: function resetAfterCommit(rootContainerInstance) { 51 | rootContainerInstance.update(); 52 | }, 53 | getChildHostContext: function getChildHostContext() { 54 | return {}; 55 | }, 56 | shouldSetTextContent: function shouldSetTextContent() { 57 | return false; 58 | }, 59 | now: function now() {}, 60 | supportsMutation: true, 61 | appendChild: function appendChild(parentInstance, child) { 62 | parentInstance.children.push(child); 63 | }, 64 | appendChildToContainer: function appendChildToContainer(parentInstance, child) { 65 | parentInstance.root = child; 66 | }, 67 | removeChild: function removeChild(parentInstance, child) { 68 | parentInstance.splice(parentInstance.children.indexOf(child), 1); 69 | }, 70 | removeChildFromContainer: function removeChildFromContainer(parentInstance, child) { 71 | parentInstance.splice(parentInstance.children.indexOf(child), 1); 72 | }, 73 | commitTextUpdate: function commitTextUpdate(textInstance, oldText, newText) { 74 | textInstance.text = newText; 75 | }, 76 | prepareForCommit: function prepareForCommit() {}, 77 | resetTextContent: function resetTextContent() {}, 78 | getRootHostContext: function getRootHostContext() {}, 79 | insertBefore: function insertBefore() {}, 80 | commitUpdate: function commitUpdate() {}, 81 | commitMount: function commitMount() {} 82 | }; 83 | 84 | var _default = (0, _reactReconciler.default)(ReconcilerConfig); 85 | 86 | exports.default = _default; -------------------------------------------------------------------------------- /flow-typed/npm/babel-preset-env_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 8771aedbbbbaebd92bf5dd5d2b88e200 2 | // flow-typed version: <>/babel-preset-env_v^1.7.0/flow_v0.76.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-preset-env' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-preset-env' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-preset-env/data/built-in-features' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'babel-preset-env/data/plugin-features' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'babel-preset-env/lib/default-includes' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'babel-preset-env/lib/index' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'babel-preset-env/lib/module-transformations' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'babel-preset-env/lib/normalize-options' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'babel-preset-env/lib/targets-parser' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'babel-preset-env/lib/transform-polyfill-require-plugin' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module 'babel-preset-env/lib/utils' { 58 | declare module.exports: any; 59 | } 60 | 61 | // Filename aliases 62 | declare module 'babel-preset-env/data/built-in-features.js' { 63 | declare module.exports: $Exports<'babel-preset-env/data/built-in-features'>; 64 | } 65 | declare module 'babel-preset-env/data/plugin-features.js' { 66 | declare module.exports: $Exports<'babel-preset-env/data/plugin-features'>; 67 | } 68 | declare module 'babel-preset-env/lib/default-includes.js' { 69 | declare module.exports: $Exports<'babel-preset-env/lib/default-includes'>; 70 | } 71 | declare module 'babel-preset-env/lib/index.js' { 72 | declare module.exports: $Exports<'babel-preset-env/lib/index'>; 73 | } 74 | declare module 'babel-preset-env/lib/module-transformations.js' { 75 | declare module.exports: $Exports<'babel-preset-env/lib/module-transformations'>; 76 | } 77 | declare module 'babel-preset-env/lib/normalize-options.js' { 78 | declare module.exports: $Exports<'babel-preset-env/lib/normalize-options'>; 79 | } 80 | declare module 'babel-preset-env/lib/targets-parser.js' { 81 | declare module.exports: $Exports<'babel-preset-env/lib/targets-parser'>; 82 | } 83 | declare module 'babel-preset-env/lib/transform-polyfill-require-plugin.js' { 84 | declare module.exports: $Exports<'babel-preset-env/lib/transform-polyfill-require-plugin'>; 85 | } 86 | declare module 'babel-preset-env/lib/utils.js' { 87 | declare module.exports: $Exports<'babel-preset-env/lib/utils'>; 88 | } 89 | -------------------------------------------------------------------------------- /flow-typed/npm/react-reconciler_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: dae3f034d25e3a4aa4a71ae43a02c4fe 2 | // flow-typed version: <>/react-reconciler_v^0.16.0/flow_v0.85.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'react-reconciler' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'react-reconciler' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'react-reconciler/cjs/react-reconciler-persistent.development' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'react-reconciler/cjs/react-reconciler-persistent.production.min' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'react-reconciler/cjs/react-reconciler-reflection.development' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'react-reconciler/cjs/react-reconciler-reflection.production.min' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'react-reconciler/cjs/react-reconciler.development' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'react-reconciler/cjs/react-reconciler.production.min' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'react-reconciler/persistent' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'react-reconciler/reflection' { 54 | declare module.exports: any; 55 | } 56 | 57 | // Filename aliases 58 | declare module 'react-reconciler/cjs/react-reconciler-persistent.development.js' { 59 | declare module.exports: $Exports<'react-reconciler/cjs/react-reconciler-persistent.development'>; 60 | } 61 | declare module 'react-reconciler/cjs/react-reconciler-persistent.production.min.js' { 62 | declare module.exports: $Exports<'react-reconciler/cjs/react-reconciler-persistent.production.min'>; 63 | } 64 | declare module 'react-reconciler/cjs/react-reconciler-reflection.development.js' { 65 | declare module.exports: $Exports<'react-reconciler/cjs/react-reconciler-reflection.development'>; 66 | } 67 | declare module 'react-reconciler/cjs/react-reconciler-reflection.production.min.js' { 68 | declare module.exports: $Exports<'react-reconciler/cjs/react-reconciler-reflection.production.min'>; 69 | } 70 | declare module 'react-reconciler/cjs/react-reconciler.development.js' { 71 | declare module.exports: $Exports<'react-reconciler/cjs/react-reconciler.development'>; 72 | } 73 | declare module 'react-reconciler/cjs/react-reconciler.production.min.js' { 74 | declare module.exports: $Exports<'react-reconciler/cjs/react-reconciler.production.min'>; 75 | } 76 | declare module 'react-reconciler/index' { 77 | declare module.exports: $Exports<'react-reconciler'>; 78 | } 79 | declare module 'react-reconciler/index.js' { 80 | declare module.exports: $Exports<'react-reconciler'>; 81 | } 82 | declare module 'react-reconciler/persistent.js' { 83 | declare module.exports: $Exports<'react-reconciler/persistent'>; 84 | } 85 | declare module 'react-reconciler/reflection.js' { 86 | declare module.exports: $Exports<'react-reconciler/reflection'>; 87 | } 88 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | // @flow strict 2 | 3 | import Reconciler from "./reconciler"; 4 | import * as React from "react"; 5 | import ansiEscapes from "ansi-escapes"; 6 | import { Section } from "./components"; 7 | import getOutputFromSection from "./output"; 8 | import interceptStdout from "intercept-stdout"; 9 | 10 | let previousLineCount = 0; 11 | function writeToConsole(output: string) { 12 | process.stdout.write(ansiEscapes.eraseLines(previousLineCount) + output); 13 | previousLineCount = output.split("\n").length; 14 | } 15 | 16 | class Console { 17 | consoleWidth: number; 18 | root: Section; 19 | handler: (output: string) => void; 20 | spacing: string; 21 | 22 | constructor({ 23 | handler, 24 | spacing, 25 | width 26 | }: { 27 | handler?: string => void, 28 | spacing?: string, 29 | width?: number 30 | }) { 31 | // use width override, then console width, then hardcoded default as last resort 32 | this.consoleWidth = width 33 | ? width 34 | : typeof process.stdout.columns === "number" 35 | ? process.stdout.columns - 10 36 | : 100; 37 | if (handler) { 38 | this.handler = handler; 39 | } else { 40 | let stopIntercept; 41 | this.handler = outputString => { 42 | if (stopIntercept) { 43 | stopIntercept(); 44 | } 45 | writeToConsole(outputString); 46 | // if any other console output comes in, first print that, then re-print 47 | // our node tree underneath 48 | // @TODO: figure out if there's a bettre way to do this, or if we could 49 | // pass it to the component being rendered so client's can handle output 50 | stopIntercept = interceptStdout(stdoutText => { 51 | stdOutListeners.forEach(listener => { 52 | listener(stdoutText.split("\n")); 53 | }); 54 | }); 55 | }; 56 | } 57 | this.spacing = spacing || " "; 58 | } 59 | 60 | update() { 61 | const output = getOutputFromSection({ 62 | section: this.root, 63 | width: this.consoleWidth 64 | }); 65 | 66 | let outputString = ""; 67 | let currentLineIndex = 0; 68 | while (currentLineIndex < output.getLineLength()) { 69 | outputString += output.generateOutput({ 70 | currentLineIndex, 71 | spacing: this.spacing, 72 | startLineIndex: 0 73 | }); 74 | outputString += "\n"; 75 | currentLineIndex++; 76 | } 77 | this.handler(outputString); 78 | } 79 | } 80 | 81 | function SectionComponent(props: { 82 | horizontal?: boolean, 83 | align?: "left" | "center" | "right", 84 | border?: { 85 | vertical?: string, 86 | horizontal?: string, 87 | cornerTopLeft?: string, 88 | cornerTopRight?: string, 89 | cornerBottomLeft?: string, 90 | cornerBottomRight?: string 91 | }, 92 | height?: number 93 | }) { 94 | return
; 95 | } 96 | export { SectionComponent as Section }; 97 | 98 | const stdOutListeners = []; 99 | export function watchStdout(callback: (Array) => void) { 100 | stdOutListeners.push(callback); 101 | } 102 | export default function render( 103 | element: React.Node, 104 | callback?: () => void, 105 | width?: number, 106 | handler?: (output: string) => void, 107 | spacing?: string 108 | ) { 109 | const container = new Console({ handler, spacing, width }); 110 | const node = Reconciler.createContainer(container); 111 | Reconciler.updateContainer(element, node, null, callback); 112 | } 113 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-cli_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 40ac71f9403783e7957989cfd3c8695f 2 | // flow-typed version: <>/babel-cli_v^6.26.0/flow_v0.76.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-cli' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-cli' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-cli/bin/babel-doctor' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'babel-cli/bin/babel-external-helpers' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'babel-cli/bin/babel-node' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'babel-cli/bin/babel' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'babel-cli/lib/_babel-node' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'babel-cli/lib/babel-external-helpers' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'babel-cli/lib/babel-node' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'babel-cli/lib/babel/dir' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module 'babel-cli/lib/babel/file' { 58 | declare module.exports: any; 59 | } 60 | 61 | declare module 'babel-cli/lib/babel/index' { 62 | declare module.exports: any; 63 | } 64 | 65 | declare module 'babel-cli/lib/babel/util' { 66 | declare module.exports: any; 67 | } 68 | 69 | // Filename aliases 70 | declare module 'babel-cli/bin/babel-doctor.js' { 71 | declare module.exports: $Exports<'babel-cli/bin/babel-doctor'>; 72 | } 73 | declare module 'babel-cli/bin/babel-external-helpers.js' { 74 | declare module.exports: $Exports<'babel-cli/bin/babel-external-helpers'>; 75 | } 76 | declare module 'babel-cli/bin/babel-node.js' { 77 | declare module.exports: $Exports<'babel-cli/bin/babel-node'>; 78 | } 79 | declare module 'babel-cli/bin/babel.js' { 80 | declare module.exports: $Exports<'babel-cli/bin/babel'>; 81 | } 82 | declare module 'babel-cli/index' { 83 | declare module.exports: $Exports<'babel-cli'>; 84 | } 85 | declare module 'babel-cli/index.js' { 86 | declare module.exports: $Exports<'babel-cli'>; 87 | } 88 | declare module 'babel-cli/lib/_babel-node.js' { 89 | declare module.exports: $Exports<'babel-cli/lib/_babel-node'>; 90 | } 91 | declare module 'babel-cli/lib/babel-external-helpers.js' { 92 | declare module.exports: $Exports<'babel-cli/lib/babel-external-helpers'>; 93 | } 94 | declare module 'babel-cli/lib/babel-node.js' { 95 | declare module.exports: $Exports<'babel-cli/lib/babel-node'>; 96 | } 97 | declare module 'babel-cli/lib/babel/dir.js' { 98 | declare module.exports: $Exports<'babel-cli/lib/babel/dir'>; 99 | } 100 | declare module 'babel-cli/lib/babel/file.js' { 101 | declare module.exports: $Exports<'babel-cli/lib/babel/file'>; 102 | } 103 | declare module 'babel-cli/lib/babel/index.js' { 104 | declare module.exports: $Exports<'babel-cli/lib/babel/index'>; 105 | } 106 | declare module 'babel-cli/lib/babel/util.js' { 107 | declare module.exports: $Exports<'babel-cli/lib/babel/util'>; 108 | } 109 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-eslint_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 23159085c96ea1c46d0b72b10dadc599 2 | // flow-typed version: <>/babel-eslint_v^10.0.1/flow_v0.85.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-eslint' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-eslint' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-eslint/lib/analyze-scope' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'babel-eslint/lib/babylon-to-espree/attachComments' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'babel-eslint/lib/babylon-to-espree/convertComments' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'babel-eslint/lib/babylon-to-espree/convertTemplateType' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'babel-eslint/lib/babylon-to-espree/index' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'babel-eslint/lib/babylon-to-espree/toAST' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'babel-eslint/lib/babylon-to-espree/toToken' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'babel-eslint/lib/babylon-to-espree/toTokens' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module 'babel-eslint/lib/index' { 58 | declare module.exports: any; 59 | } 60 | 61 | declare module 'babel-eslint/lib/parse-with-scope' { 62 | declare module.exports: any; 63 | } 64 | 65 | declare module 'babel-eslint/lib/parse' { 66 | declare module.exports: any; 67 | } 68 | 69 | declare module 'babel-eslint/lib/visitor-keys' { 70 | declare module.exports: any; 71 | } 72 | 73 | // Filename aliases 74 | declare module 'babel-eslint/lib/analyze-scope.js' { 75 | declare module.exports: $Exports<'babel-eslint/lib/analyze-scope'>; 76 | } 77 | declare module 'babel-eslint/lib/babylon-to-espree/attachComments.js' { 78 | declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/attachComments'>; 79 | } 80 | declare module 'babel-eslint/lib/babylon-to-espree/convertComments.js' { 81 | declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/convertComments'>; 82 | } 83 | declare module 'babel-eslint/lib/babylon-to-espree/convertTemplateType.js' { 84 | declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/convertTemplateType'>; 85 | } 86 | declare module 'babel-eslint/lib/babylon-to-espree/index.js' { 87 | declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/index'>; 88 | } 89 | declare module 'babel-eslint/lib/babylon-to-espree/toAST.js' { 90 | declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/toAST'>; 91 | } 92 | declare module 'babel-eslint/lib/babylon-to-espree/toToken.js' { 93 | declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/toToken'>; 94 | } 95 | declare module 'babel-eslint/lib/babylon-to-espree/toTokens.js' { 96 | declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/toTokens'>; 97 | } 98 | declare module 'babel-eslint/lib/index.js' { 99 | declare module.exports: $Exports<'babel-eslint/lib/index'>; 100 | } 101 | declare module 'babel-eslint/lib/parse-with-scope.js' { 102 | declare module.exports: $Exports<'babel-eslint/lib/parse-with-scope'>; 103 | } 104 | declare module 'babel-eslint/lib/parse.js' { 105 | declare module.exports: $Exports<'babel-eslint/lib/parse'>; 106 | } 107 | declare module 'babel-eslint/lib/visitor-keys.js' { 108 | declare module.exports: $Exports<'babel-eslint/lib/visitor-keys'>; 109 | } 110 | -------------------------------------------------------------------------------- /src/__tests__/section-test.js: -------------------------------------------------------------------------------- 1 | // @flow strict 2 | 3 | import * as React from "react"; 4 | import ReactCLI, { Section } from "../index"; 5 | 6 | test("sections should be able to render horizontally", done => { 7 | ReactCLI( 8 |
9 | Column 1
Column 2 10 |
, 11 | undefined, 12 | 50, 13 | outputString => { 14 | expect(outputString).toMatchSnapshot(); 15 | done(); 16 | }, 17 | "+" 18 | ); 19 | }); 20 | 21 | test("sections should be able to render vertically", done => { 22 | ReactCLI( 23 |
24 | Row 1
Row 2 25 |
, 26 | undefined, 27 | 50, 28 | outputString => { 29 | expect(outputString).toMatchSnapshot(); 30 | done(); 31 | }, 32 | "+" 33 | ); 34 | }); 35 | 36 | test("sections should be able to align text left", done => { 37 | ReactCLI( 38 |
Left text
, 39 | undefined, 40 | 50, 41 | outputString => { 42 | expect(outputString).toMatchSnapshot(); 43 | done(); 44 | }, 45 | "+" 46 | ); 47 | }); 48 | 49 | test("sections should be able to align text right", done => { 50 | ReactCLI( 51 |
Right text
, 52 | undefined, 53 | 50, 54 | outputString => { 55 | expect(outputString).toMatchSnapshot(); 56 | done(); 57 | }, 58 | "+" 59 | ); 60 | }); 61 | 62 | test("sections should be able to align text center", done => { 63 | ReactCLI( 64 |
Center text
, 65 | undefined, 66 | 50, 67 | outputString => { 68 | expect(outputString).toMatchSnapshot(); 69 | done(); 70 | }, 71 | "+" 72 | ); 73 | }); 74 | 75 | test("sections should be able to render a border", done => { 76 | ReactCLI( 77 |
78 |
89 | Test section with border 90 |
91 |
, 92 | undefined, 93 | 50, 94 | outputString => { 95 | expect(outputString).toMatchSnapshot(); 96 | done(); 97 | }, 98 | "+" 99 | ); 100 | 101 | ReactCLI( 102 |
103 | Some Text 104 |
115 | Test section with border 116 |
117 |
, 118 | undefined, 119 | 50, 120 | outputString => { 121 | expect(outputString).toMatchSnapshot(); 122 | done(); 123 | }, 124 | "+" 125 | ); 126 | }); 127 | 128 | test("sections should be able to declare a fixed height", done => { 129 | ReactCLI( 130 |
131 | Line 1
132 | Line 2
133 | Line 3
134 | Line 4
135 |
, 136 | undefined, 137 | 50, 138 | outputString => { 139 | expect(outputString).toMatchSnapshot(); 140 | done(); 141 | } 142 | ); 143 | 144 | ReactCLI( 145 |
146 | Line 1
147 | Line 2
148 | Line 3
149 |
, 150 | undefined, 151 | 50, 152 | outputString => { 153 | expect(outputString).toMatchSnapshot(); 154 | done(); 155 | } 156 | ); 157 | 158 | ReactCLI( 159 |
160 | Test 161 |
162 | Line 1
163 | Line 2
164 | Line 3
165 | Line 4
166 |
167 |
, 168 | undefined, 169 | 50, 170 | outputString => { 171 | expect(outputString).toMatchSnapshot(); 172 | done(); 173 | } 174 | ); 175 | }); 176 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # This repository is now archived 2 | This project was originally created as an alternative to the [Ink](https://github.com/vadimdemedes/ink) library, as a separate renderer for a real React component tree, for the command line. Ink has [since changed its architecture](https://github.com/vadimdemedes/ink/issues/90) to also become just a separate renderer, allowing the use of the actual React library. With this change, react-cli adds no extra value beyond the capabilities of the Ink library, which has a much larger user-base and its better supported. 3 | 4 | # ReactCLI 5 | 6 | ReactCLI is a react renderer for the command line. All of the benefits of React, right in your terminal. 7 | 8 | ![react-cli-demo](/.github/demo.svg) 9 | 10 | ```javascript 11 | import ReactCLI, { Section } from "react-cli-renderer"; 12 | import React from "react"; 13 | import chalk from "chalk"; 14 | 15 | class MyReactCLIApp extends React.Component { 16 | state = { 17 | step: 0 18 | }; 19 | 20 | componentDidMount() { 21 | setTimeout(() => this.setState({ step: 1 }), 1000); 22 | setTimeout(() => this.setState({ step: 2 }), 2000); 23 | setTimeout(() => this.setState({ step: 3 }), 3000); 24 | } 25 | 26 | render() { 27 | return ( 28 |
29 | My {chalk.blue("New")} {chalk.magenta("ReactCLI App")} 🚀 30 |
31 |
32 | {this.state.step >= 1 ? chalk.green("✔︎") : "◯"} Step 1
33 | {this.state.step >= 2 ? chalk.green("✔︎") : "◯"} Step 2
34 | {this.state.step >= 3 ? chalk.green("✔︎") : "◯"} Step 3 35 |
36 |
37 | Number of steps done:{" "} 38 | {chalk.bold.magenta(this.state.step.toString())} 39 |
40 |
41 |
42 | ); 43 | } 44 | } 45 | 46 | ReactCLI(); 47 | ``` 48 | 49 | _note: this example uses the "@babel/preset-env", "@babel/preset-react" babel presets, and "@babel/plugin-proposal-class-properties" plugin_ 50 | 51 | ## Getting started 52 | 53 | ### yarn 54 | 55 | ```bash 56 | yarn add react react-cli-renderer 57 | ``` 58 | 59 | ### npm 60 | 61 | ```bash 62 | npm install --save react react-cli-renderer 63 | ``` 64 | 65 | _note: You can use react-cli-renderer without babel, but you'll most likely want to write components [using JSX.](https://reactjs.org/docs/add-react-to-a-website.html#add-jsx-to-a-project)_ 66 | 67 | ### Compatibility with ink components 68 | 69 | [ink](https://github.com/vadimdemedes/ink) components do not work out-of-the-box with react-cli. However, if you're interested in re-using existing ink components, check out [ink-on-reactcli](https://github.com/cspotcode/ink-on-reactcli) for more information. 70 | 71 | ## About 72 | 73 | ReactCLI is analogous to ReactDOM or ReactNative. It just renders any updates dictated by React and the React reconciler to the command line. This means that you get all of the core features of React for free, like stateful components, context, refs, etc - in addition to being able to use third party libraries for things like state management. It also provides a couple core components that are useful for building out command line interfaces. 74 | 75 | ## Usage 76 | 77 | #### Components 78 | 79 | ReactCLI provides two components for building command line interfaces. 80 | 81 | - Section 82 | A new section is denoted by `Section`. A section can either be vertical, or horizontal. The children of a section can be a mix of text, or more sections. A section can also align text left, right, or center. 83 | 84 | ```javascript 85 |
86 |
Column 1
87 |
Column 2
88 |
89 | ``` 90 | 91 | - break 92 | Break components allow you to define columns and/or rows within a section (as opposed to using nested sections). 93 | 94 | ```javascript 95 |
96 | Row 1
97 | Row 2 98 |
99 | ``` 100 | 101 | # 102 | 103 | ## Built with ReactCLI 104 | 105 | _if you're using ReactCLI and want to add your project to this list, feel free to submit a PR!_ 106 | 107 | - [startd](https://github.com/mgrip/startd) 108 | 109 | Contributions welcome! 110 | 111 | ### 👨‍🎤👩‍🔬👨‍🎨 112 | 113 | # 114 | -------------------------------------------------------------------------------- /lib/components.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.Break = exports.Text = exports.Section = void 0; 7 | 8 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 9 | 10 | function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 11 | 12 | function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 13 | 14 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 15 | 16 | // strict 17 | var Border = 18 | /*#__PURE__*/ 19 | function () { 20 | function Border(_ref) { 21 | var vertical = _ref.vertical, 22 | horizontal = _ref.horizontal, 23 | cornerTopLeft = _ref.cornerTopLeft, 24 | cornerTopRight = _ref.cornerTopRight, 25 | cornerBottomLeft = _ref.cornerBottomLeft, 26 | cornerBottomRight = _ref.cornerBottomRight; 27 | 28 | _classCallCheck(this, Border); 29 | 30 | _defineProperty(this, "vertical", void 0); 31 | 32 | _defineProperty(this, "horizontal", void 0); 33 | 34 | _defineProperty(this, "cornerTopLeft", void 0); 35 | 36 | _defineProperty(this, "cornerTopRight", void 0); 37 | 38 | _defineProperty(this, "cornerBottomLeft", void 0); 39 | 40 | _defineProperty(this, "cornerBottomRight", void 0); 41 | 42 | this.vertical = vertical; 43 | this.horizontal = horizontal; 44 | this.cornerTopLeft = cornerTopLeft; 45 | this.cornerTopRight = cornerTopRight; 46 | this.cornerBottomLeft = cornerBottomLeft; 47 | this.cornerBottomRight = cornerBottomRight; 48 | } 49 | 50 | _createClass(Border, [{ 51 | key: "horizontalWidth", 52 | value: function horizontalWidth() { 53 | return Math.max(this.vertical ? this.vertical.length : 0, this.cornerTopLeft ? this.cornerTopLeft.length : 0, this.cornerBottomLeft ? this.cornerBottomLeft.length : 0) + Math.max(this.vertical ? this.vertical.length : 0, this.cornerTopRight ? this.cornerTopRight.length : 0, this.cornerBottomRight ? this.cornerBottomRight.length : 0); 54 | } 55 | }, { 56 | key: "verticalHeight", 57 | value: function verticalHeight() { 58 | return Math.max(this.horizontal ? this.horizontal.length : 0, this.cornerTopLeft ? this.cornerTopLeft.length : 0, this.cornerTopRight ? this.cornerTopRight.length : 0) + Math.max(this.horizontal ? this.horizontal.length : 0, this.cornerBottomLeft ? this.cornerBottomLeft.length : 0, this.cornerBottomRight ? this.cornerBottomRight.length : 0); 59 | } 60 | }]); 61 | 62 | return Border; 63 | }(); 64 | 65 | var Section = function Section(_ref2) { 66 | var _ref2$useHorizontalOr = _ref2.useHorizontalOrientation, 67 | useHorizontalOrientation = _ref2$useHorizontalOr === void 0 ? false : _ref2$useHorizontalOr, 68 | _ref2$align = _ref2.align, 69 | align = _ref2$align === void 0 ? "left" : _ref2$align, 70 | _ref2$border = _ref2.border, 71 | border = _ref2$border === void 0 ? {} : _ref2$border, 72 | height = _ref2.height; 73 | 74 | _classCallCheck(this, Section); 75 | 76 | _defineProperty(this, "orientation", void 0); 77 | 78 | _defineProperty(this, "align", void 0); 79 | 80 | _defineProperty(this, "children", []); 81 | 82 | _defineProperty(this, "border", void 0); 83 | 84 | _defineProperty(this, "height", void 0); 85 | 86 | this.orientation = useHorizontalOrientation ? "horizontal" : "vertical"; 87 | this.align = align; 88 | this.border = new Border(border); 89 | this.height = height; 90 | }; 91 | 92 | exports.Section = Section; 93 | 94 | _defineProperty(Section, "type", "div"); 95 | 96 | var Text = function Text(text) { 97 | _classCallCheck(this, Text); 98 | 99 | _defineProperty(this, "text", void 0); 100 | 101 | this.text = text; 102 | }; 103 | 104 | exports.Text = Text; 105 | 106 | var Break = function Break() { 107 | _classCallCheck(this, Break); 108 | }; 109 | 110 | exports.Break = Break; 111 | 112 | _defineProperty(Break, "type", "br"); -------------------------------------------------------------------------------- /flow-typed/npm/@babel/preset-env_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: c0a5ab01087f447794e3498c8584af4c 2 | // flow-typed version: <>/@babel/preset-env_v^7.1.0/flow_v0.85.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * '@babel/preset-env' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module '@babel/preset-env' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module '@babel/preset-env/data/built-in-features' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module '@babel/preset-env/data/plugin-features' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module '@babel/preset-env/data/shipped-proposals' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module '@babel/preset-env/data/unreleased-labels' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module '@babel/preset-env/lib/available-plugins' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module '@babel/preset-env/lib/built-in-definitions' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module '@babel/preset-env/lib/debug' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module '@babel/preset-env/lib/default-includes' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module '@babel/preset-env/lib/defaults' { 58 | declare module.exports: any; 59 | } 60 | 61 | declare module '@babel/preset-env/lib/index' { 62 | declare module.exports: any; 63 | } 64 | 65 | declare module '@babel/preset-env/lib/module-transformations' { 66 | declare module.exports: any; 67 | } 68 | 69 | declare module '@babel/preset-env/lib/normalize-options' { 70 | declare module.exports: any; 71 | } 72 | 73 | declare module '@babel/preset-env/lib/options' { 74 | declare module.exports: any; 75 | } 76 | 77 | declare module '@babel/preset-env/lib/targets-parser' { 78 | declare module.exports: any; 79 | } 80 | 81 | declare module '@babel/preset-env/lib/use-built-ins-entry-plugin' { 82 | declare module.exports: any; 83 | } 84 | 85 | declare module '@babel/preset-env/lib/use-built-ins-plugin' { 86 | declare module.exports: any; 87 | } 88 | 89 | declare module '@babel/preset-env/lib/utils' { 90 | declare module.exports: any; 91 | } 92 | 93 | // Filename aliases 94 | declare module '@babel/preset-env/data/built-in-features.js' { 95 | declare module.exports: $Exports<'@babel/preset-env/data/built-in-features'>; 96 | } 97 | declare module '@babel/preset-env/data/plugin-features.js' { 98 | declare module.exports: $Exports<'@babel/preset-env/data/plugin-features'>; 99 | } 100 | declare module '@babel/preset-env/data/shipped-proposals.js' { 101 | declare module.exports: $Exports<'@babel/preset-env/data/shipped-proposals'>; 102 | } 103 | declare module '@babel/preset-env/data/unreleased-labels.js' { 104 | declare module.exports: $Exports<'@babel/preset-env/data/unreleased-labels'>; 105 | } 106 | declare module '@babel/preset-env/lib/available-plugins.js' { 107 | declare module.exports: $Exports<'@babel/preset-env/lib/available-plugins'>; 108 | } 109 | declare module '@babel/preset-env/lib/built-in-definitions.js' { 110 | declare module.exports: $Exports<'@babel/preset-env/lib/built-in-definitions'>; 111 | } 112 | declare module '@babel/preset-env/lib/debug.js' { 113 | declare module.exports: $Exports<'@babel/preset-env/lib/debug'>; 114 | } 115 | declare module '@babel/preset-env/lib/default-includes.js' { 116 | declare module.exports: $Exports<'@babel/preset-env/lib/default-includes'>; 117 | } 118 | declare module '@babel/preset-env/lib/defaults.js' { 119 | declare module.exports: $Exports<'@babel/preset-env/lib/defaults'>; 120 | } 121 | declare module '@babel/preset-env/lib/index.js' { 122 | declare module.exports: $Exports<'@babel/preset-env/lib/index'>; 123 | } 124 | declare module '@babel/preset-env/lib/module-transformations.js' { 125 | declare module.exports: $Exports<'@babel/preset-env/lib/module-transformations'>; 126 | } 127 | declare module '@babel/preset-env/lib/normalize-options.js' { 128 | declare module.exports: $Exports<'@babel/preset-env/lib/normalize-options'>; 129 | } 130 | declare module '@babel/preset-env/lib/options.js' { 131 | declare module.exports: $Exports<'@babel/preset-env/lib/options'>; 132 | } 133 | declare module '@babel/preset-env/lib/targets-parser.js' { 134 | declare module.exports: $Exports<'@babel/preset-env/lib/targets-parser'>; 135 | } 136 | declare module '@babel/preset-env/lib/use-built-ins-entry-plugin.js' { 137 | declare module.exports: $Exports<'@babel/preset-env/lib/use-built-ins-entry-plugin'>; 138 | } 139 | declare module '@babel/preset-env/lib/use-built-ins-plugin.js' { 140 | declare module.exports: $Exports<'@babel/preset-env/lib/use-built-ins-plugin'>; 141 | } 142 | declare module '@babel/preset-env/lib/utils.js' { 143 | declare module.exports: $Exports<'@babel/preset-env/lib/utils'>; 144 | } 145 | -------------------------------------------------------------------------------- /lib/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.Section = SectionComponent; 7 | exports.watchStdout = watchStdout; 8 | exports.default = render; 9 | 10 | var _reconciler = _interopRequireDefault(require("./reconciler")); 11 | 12 | var React = _interopRequireWildcard(require("react")); 13 | 14 | var _ansiEscapes = _interopRequireDefault(require("ansi-escapes")); 15 | 16 | var _components = require("./components"); 17 | 18 | var _output = _interopRequireDefault(require("./output")); 19 | 20 | var _interceptStdout = _interopRequireDefault(require("intercept-stdout")); 21 | 22 | function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } 23 | 24 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 25 | 26 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 27 | 28 | function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 29 | 30 | function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 31 | 32 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 33 | 34 | var previousLineCount = 0; 35 | 36 | function writeToConsole(output) { 37 | process.stdout.write(_ansiEscapes.default.eraseLines(previousLineCount) + output); 38 | previousLineCount = output.split("\n").length; 39 | } 40 | 41 | var Console = 42 | /*#__PURE__*/ 43 | function () { 44 | function Console(_ref) { 45 | var handler = _ref.handler, 46 | spacing = _ref.spacing, 47 | width = _ref.width; 48 | 49 | _classCallCheck(this, Console); 50 | 51 | _defineProperty(this, "consoleWidth", void 0); 52 | 53 | _defineProperty(this, "root", void 0); 54 | 55 | _defineProperty(this, "handler", void 0); 56 | 57 | _defineProperty(this, "spacing", void 0); 58 | 59 | // use width override, then console width, then hardcoded default as last resort 60 | this.consoleWidth = width ? width : typeof process.stdout.columns === "number" ? process.stdout.columns - 10 : 100; 61 | 62 | if (handler) { 63 | this.handler = handler; 64 | } else { 65 | var stopIntercept; 66 | 67 | this.handler = function (outputString) { 68 | if (stopIntercept) { 69 | stopIntercept(); 70 | } 71 | 72 | writeToConsole(outputString); // if any other console output comes in, first print that, then re-print 73 | // our node tree underneath 74 | // @TODO: figure out if there's a bettre way to do this, or if we could 75 | // pass it to the component being rendered so client's can handle output 76 | 77 | stopIntercept = (0, _interceptStdout.default)(function (stdoutText) { 78 | stdOutListeners.forEach(function (listener) { 79 | listener(stdoutText.split("\n")); 80 | }); 81 | }); 82 | }; 83 | } 84 | 85 | this.spacing = spacing || " "; 86 | } 87 | 88 | _createClass(Console, [{ 89 | key: "update", 90 | value: function update() { 91 | var output = (0, _output.default)({ 92 | section: this.root, 93 | width: this.consoleWidth 94 | }); 95 | var outputString = ""; 96 | var currentLineIndex = 0; 97 | 98 | while (currentLineIndex < output.getLineLength()) { 99 | outputString += output.generateOutput({ 100 | currentLineIndex: currentLineIndex, 101 | spacing: this.spacing, 102 | startLineIndex: 0 103 | }); 104 | outputString += "\n"; 105 | currentLineIndex++; 106 | } 107 | 108 | this.handler(outputString); 109 | } 110 | }]); 111 | 112 | return Console; 113 | }(); 114 | 115 | function SectionComponent(props) { 116 | return React.createElement("div", props); 117 | } 118 | 119 | var stdOutListeners = []; 120 | 121 | function watchStdout(callback) { 122 | stdOutListeners.push(callback); 123 | } 124 | 125 | function render(element, callback, width, handler, spacing) { 126 | var container = new Console({ 127 | handler: handler, 128 | spacing: spacing, 129 | width: width 130 | }); 131 | 132 | var node = _reconciler.default.createContainer(container); 133 | 134 | _reconciler.default.updateContainer(element, node, null, callback); 135 | } -------------------------------------------------------------------------------- /flow-typed/npm/prettier_v1.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 066c92e9ccb5f0711df8d73cbca837d6 2 | // flow-typed version: 9e32affdbd/prettier_v1.x.x/flow_>=v0.56.x 3 | 4 | declare module "prettier" { 5 | declare export type AST = Object; 6 | declare export type Doc = Object; 7 | declare export type FastPath = Object; 8 | 9 | declare export type PrettierParserName = 10 | | "babylon" 11 | | "flow" 12 | | "typescript" 13 | | "postcss" 14 | | "css" 15 | | "less" 16 | | "scss" 17 | | "json" 18 | | "graphql" 19 | | "markdown" 20 | | "vue"; 21 | 22 | declare export type PrettierParser = { 23 | [name: PrettierParserName]: (text: string, options?: Object) => AST 24 | }; 25 | 26 | declare export type CustomParser = ( 27 | text: string, 28 | parsers: PrettierParser, 29 | options: Options 30 | ) => AST; 31 | 32 | declare export type Options = {| 33 | printWidth?: number, 34 | tabWidth?: number, 35 | useTabs?: boolean, 36 | semi?: boolean, 37 | singleQuote?: boolean, 38 | trailingComma?: "none" | "es5" | "all", 39 | bracketSpacing?: boolean, 40 | jsxBracketSameLine?: boolean, 41 | arrowParens?: "avoid" | "always", 42 | rangeStart?: number, 43 | rangeEnd?: number, 44 | parser?: PrettierParserName | CustomParser, 45 | filepath?: string, 46 | requirePragma?: boolean, 47 | insertPragma?: boolean, 48 | proseWrap?: "always" | "never" | "preserve", 49 | plugins?: Array 50 | |}; 51 | 52 | declare export type Plugin = { 53 | languages: SupportLanguage, 54 | parsers: { [parserName: string]: Parser }, 55 | printers: { [astFormat: string]: Printer } 56 | }; 57 | 58 | declare export type Parser = { 59 | parse: ( 60 | text: string, 61 | parsers: { [parserName: string]: Parser }, 62 | options: Object 63 | ) => AST, 64 | astFormat: string 65 | }; 66 | 67 | declare export type Printer = { 68 | print: ( 69 | path: FastPath, 70 | options: Object, 71 | print: (path: FastPath) => Doc 72 | ) => Doc, 73 | embed: ( 74 | path: FastPath, 75 | print: (path: FastPath) => Doc, 76 | textToDoc: (text: string, options: Object) => Doc, 77 | options: Object 78 | ) => ?Doc 79 | }; 80 | 81 | declare export type CursorOptions = {| 82 | cursorOffset: number, 83 | printWidth?: $PropertyType, 84 | tabWidth?: $PropertyType, 85 | useTabs?: $PropertyType, 86 | semi?: $PropertyType, 87 | singleQuote?: $PropertyType, 88 | trailingComma?: $PropertyType, 89 | bracketSpacing?: $PropertyType, 90 | jsxBracketSameLine?: $PropertyType, 91 | arrowParens?: $PropertyType, 92 | parser?: $PropertyType, 93 | filepath?: $PropertyType, 94 | requirePragma?: $PropertyType, 95 | insertPragma?: $PropertyType, 96 | proseWrap?: $PropertyType, 97 | plugins?: $PropertyType 98 | |}; 99 | 100 | declare export type CursorResult = {| 101 | formatted: string, 102 | cursorOffset: number 103 | |}; 104 | 105 | declare export type ResolveConfigOptions = {| 106 | useCache?: boolean, 107 | config?: string, 108 | editorconfig?: boolean 109 | |}; 110 | 111 | declare export type SupportLanguage = { 112 | name: string, 113 | since: string, 114 | parsers: Array, 115 | group?: string, 116 | tmScope: string, 117 | aceMode: string, 118 | codemirrorMode: string, 119 | codemirrorMimeType: string, 120 | aliases?: Array, 121 | extensions: Array, 122 | filenames?: Array, 123 | linguistLanguageId: number, 124 | vscodeLanguageIds: Array 125 | }; 126 | 127 | declare export type SupportOption = {| 128 | since: string, 129 | type: "int" | "boolean" | "choice" | "path", 130 | deprecated?: string, 131 | redirect?: SupportOptionRedirect, 132 | description: string, 133 | oppositeDescription?: string, 134 | default: SupportOptionValue, 135 | range?: SupportOptionRange, 136 | choices?: SupportOptionChoice 137 | |}; 138 | 139 | declare export type SupportOptionRedirect = {| 140 | options: string, 141 | value: SupportOptionValue 142 | |}; 143 | 144 | declare export type SupportOptionRange = {| 145 | start: number, 146 | end: number, 147 | step: number 148 | |}; 149 | 150 | declare export type SupportOptionChoice = {| 151 | value: boolean | string, 152 | description?: string, 153 | since?: string, 154 | deprecated?: string, 155 | redirect?: SupportOptionValue 156 | |}; 157 | 158 | declare export type SupportOptionValue = number | boolean | string; 159 | 160 | declare export type SupportInfo = {| 161 | languages: Array, 162 | options: Array 163 | |}; 164 | 165 | declare export type Prettier = {| 166 | format: (source: string, options?: Options) => string, 167 | check: (source: string, options?: Options) => boolean, 168 | formatWithCursor: (source: string, options: CursorOptions) => CursorResult, 169 | resolveConfig: { 170 | (filePath: string, options?: ResolveConfigOptions): Promise, 171 | sync(filePath: string, options?: ResolveConfigOptions): ?Options 172 | }, 173 | clearConfigCache: () => void, 174 | getSupportInfo: (version?: string) => SupportInfo 175 | |}; 176 | 177 | declare export default Prettier; 178 | } 179 | -------------------------------------------------------------------------------- /lib/demo.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _index = _interopRequireWildcard(require("./index")); 4 | 5 | var _react = _interopRequireDefault(require("react")); 6 | 7 | var _chalk = _interopRequireDefault(require("chalk")); 8 | 9 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 10 | 11 | function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } 12 | 13 | function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 14 | 15 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 16 | 17 | function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 18 | 19 | function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 20 | 21 | function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 22 | 23 | function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 24 | 25 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 26 | 27 | function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 28 | 29 | function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 30 | 31 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 32 | 33 | var MyReactCLIApp = 34 | /*#__PURE__*/ 35 | function (_React$Component) { 36 | _inherits(MyReactCLIApp, _React$Component); 37 | 38 | function MyReactCLIApp() { 39 | var _getPrototypeOf2; 40 | 41 | var _this; 42 | 43 | _classCallCheck(this, MyReactCLIApp); 44 | 45 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 46 | args[_key] = arguments[_key]; 47 | } 48 | 49 | _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(MyReactCLIApp)).call.apply(_getPrototypeOf2, [this].concat(args))); 50 | 51 | _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "state", { 52 | step: 0 53 | }); 54 | 55 | return _this; 56 | } 57 | 58 | _createClass(MyReactCLIApp, [{ 59 | key: "componentDidMount", 60 | value: function componentDidMount() { 61 | var _this2 = this; 62 | 63 | setTimeout(function () { 64 | return _this2.setState({ 65 | step: 1 66 | }); 67 | }, 1000); 68 | setTimeout(function () { 69 | return _this2.setState({ 70 | step: 2 71 | }); 72 | }, 2000); 73 | setTimeout(function () { 74 | return _this2.setState({ 75 | step: 3 76 | }); 77 | }, 3000); 78 | } 79 | }, { 80 | key: "render", 81 | value: function render() { 82 | return _react.default.createElement(_index.Section, { 83 | border: { 84 | horizontal: "*", 85 | vertical: "*" 86 | }, 87 | align: "cener" 88 | }, "My ", _chalk.default.blue("New"), " ", _chalk.default.magenta("ReactCLI App"), " \uD83D\uDE80", _react.default.createElement("br", null), "\uD83D\uDEE0 Emojis are difficult with monospaced text... \uD83D\uDD78", _react.default.createElement(_index.Section, { 89 | horizontal: true 90 | }, _react.default.createElement(_index.Section, { 91 | align: "center" 92 | }, this.state.step >= 1 ? _chalk.default.green("✓") : "◯", " Step 1", _react.default.createElement("br", null), this.state.step >= 2 ? _chalk.default.green("✓") : "◯", " Step 2", _react.default.createElement("br", null), this.state.step >= 3 ? _chalk.default.green("✓") : "◯", " Step 3"), _react.default.createElement(_index.Section, { 93 | border: { 94 | horizontal: "-", 95 | vertical: "|" 96 | }, 97 | align: "center" 98 | }, "Number of steps done:", " ", _chalk.default.bold.magenta(this.state.step.toString())))); 99 | } 100 | }]); 101 | 102 | return MyReactCLIApp; 103 | }(_react.default.Component); 104 | 105 | (0, _index.default)(_react.default.createElement(MyReactCLIApp, null), undefined, 60); -------------------------------------------------------------------------------- /.github/demo.svg: -------------------------------------------------------------------------------- 1 | *************************************************************MyNewReactCLIApp🚀**🛠Emojisaredifficultwithmonospacedtext...🕸**Step3-----------------------------**Step1-----------------------------**Step1-----------------------------**Step2|Numberofstepsdone:0|**Step2|Numberofstepsdone:1|**Step2|Numberofstepsdone:2|**Step2|Numberofstepsdone:3|**Step3-----------------------------* -------------------------------------------------------------------------------- /flow-typed/npm/@babel/core_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 469a97ffadacddf60bed731e3c543280 2 | // flow-typed version: <>/@babel/core_v^7.1.2/flow_v0.85.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * '@babel/core' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module '@babel/core' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module '@babel/core/lib/config/caching' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module '@babel/core/lib/config/config-chain' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module '@babel/core/lib/config/config-descriptors' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module '@babel/core/lib/config/files/configuration' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module '@babel/core/lib/config/files/index-browser' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module '@babel/core/lib/config/files/index' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module '@babel/core/lib/config/files/package' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module '@babel/core/lib/config/files/plugins' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module '@babel/core/lib/config/files/types' { 58 | declare module.exports: any; 59 | } 60 | 61 | declare module '@babel/core/lib/config/files/utils' { 62 | declare module.exports: any; 63 | } 64 | 65 | declare module '@babel/core/lib/config/full' { 66 | declare module.exports: any; 67 | } 68 | 69 | declare module '@babel/core/lib/config/helpers/config-api' { 70 | declare module.exports: any; 71 | } 72 | 73 | declare module '@babel/core/lib/config/helpers/environment' { 74 | declare module.exports: any; 75 | } 76 | 77 | declare module '@babel/core/lib/config/index' { 78 | declare module.exports: any; 79 | } 80 | 81 | declare module '@babel/core/lib/config/item' { 82 | declare module.exports: any; 83 | } 84 | 85 | declare module '@babel/core/lib/config/partial' { 86 | declare module.exports: any; 87 | } 88 | 89 | declare module '@babel/core/lib/config/pattern-to-regex' { 90 | declare module.exports: any; 91 | } 92 | 93 | declare module '@babel/core/lib/config/plugin' { 94 | declare module.exports: any; 95 | } 96 | 97 | declare module '@babel/core/lib/config/util' { 98 | declare module.exports: any; 99 | } 100 | 101 | declare module '@babel/core/lib/config/validation/option-assertions' { 102 | declare module.exports: any; 103 | } 104 | 105 | declare module '@babel/core/lib/config/validation/options' { 106 | declare module.exports: any; 107 | } 108 | 109 | declare module '@babel/core/lib/config/validation/plugins' { 110 | declare module.exports: any; 111 | } 112 | 113 | declare module '@babel/core/lib/config/validation/removed' { 114 | declare module.exports: any; 115 | } 116 | 117 | declare module '@babel/core/lib/index' { 118 | declare module.exports: any; 119 | } 120 | 121 | declare module '@babel/core/lib/parse' { 122 | declare module.exports: any; 123 | } 124 | 125 | declare module '@babel/core/lib/tools/build-external-helpers' { 126 | declare module.exports: any; 127 | } 128 | 129 | declare module '@babel/core/lib/transform-ast' { 130 | declare module.exports: any; 131 | } 132 | 133 | declare module '@babel/core/lib/transform-file-browser' { 134 | declare module.exports: any; 135 | } 136 | 137 | declare module '@babel/core/lib/transform-file-sync-browser' { 138 | declare module.exports: any; 139 | } 140 | 141 | declare module '@babel/core/lib/transform-file' { 142 | declare module.exports: any; 143 | } 144 | 145 | declare module '@babel/core/lib/transform' { 146 | declare module.exports: any; 147 | } 148 | 149 | declare module '@babel/core/lib/transformation/block-hoist-plugin' { 150 | declare module.exports: any; 151 | } 152 | 153 | declare module '@babel/core/lib/transformation/file/file' { 154 | declare module.exports: any; 155 | } 156 | 157 | declare module '@babel/core/lib/transformation/file/generate' { 158 | declare module.exports: any; 159 | } 160 | 161 | declare module '@babel/core/lib/transformation/file/merge-map' { 162 | declare module.exports: any; 163 | } 164 | 165 | declare module '@babel/core/lib/transformation/index' { 166 | declare module.exports: any; 167 | } 168 | 169 | declare module '@babel/core/lib/transformation/normalize-file' { 170 | declare module.exports: any; 171 | } 172 | 173 | declare module '@babel/core/lib/transformation/normalize-opts' { 174 | declare module.exports: any; 175 | } 176 | 177 | declare module '@babel/core/lib/transformation/plugin-pass' { 178 | declare module.exports: any; 179 | } 180 | 181 | declare module '@babel/core/lib/transformation/util/missing-plugin-helper' { 182 | declare module.exports: any; 183 | } 184 | 185 | // Filename aliases 186 | declare module '@babel/core/lib/config/caching.js' { 187 | declare module.exports: $Exports<'@babel/core/lib/config/caching'>; 188 | } 189 | declare module '@babel/core/lib/config/config-chain.js' { 190 | declare module.exports: $Exports<'@babel/core/lib/config/config-chain'>; 191 | } 192 | declare module '@babel/core/lib/config/config-descriptors.js' { 193 | declare module.exports: $Exports<'@babel/core/lib/config/config-descriptors'>; 194 | } 195 | declare module '@babel/core/lib/config/files/configuration.js' { 196 | declare module.exports: $Exports<'@babel/core/lib/config/files/configuration'>; 197 | } 198 | declare module '@babel/core/lib/config/files/index-browser.js' { 199 | declare module.exports: $Exports<'@babel/core/lib/config/files/index-browser'>; 200 | } 201 | declare module '@babel/core/lib/config/files/index.js' { 202 | declare module.exports: $Exports<'@babel/core/lib/config/files/index'>; 203 | } 204 | declare module '@babel/core/lib/config/files/package.js' { 205 | declare module.exports: $Exports<'@babel/core/lib/config/files/package'>; 206 | } 207 | declare module '@babel/core/lib/config/files/plugins.js' { 208 | declare module.exports: $Exports<'@babel/core/lib/config/files/plugins'>; 209 | } 210 | declare module '@babel/core/lib/config/files/types.js' { 211 | declare module.exports: $Exports<'@babel/core/lib/config/files/types'>; 212 | } 213 | declare module '@babel/core/lib/config/files/utils.js' { 214 | declare module.exports: $Exports<'@babel/core/lib/config/files/utils'>; 215 | } 216 | declare module '@babel/core/lib/config/full.js' { 217 | declare module.exports: $Exports<'@babel/core/lib/config/full'>; 218 | } 219 | declare module '@babel/core/lib/config/helpers/config-api.js' { 220 | declare module.exports: $Exports<'@babel/core/lib/config/helpers/config-api'>; 221 | } 222 | declare module '@babel/core/lib/config/helpers/environment.js' { 223 | declare module.exports: $Exports<'@babel/core/lib/config/helpers/environment'>; 224 | } 225 | declare module '@babel/core/lib/config/index.js' { 226 | declare module.exports: $Exports<'@babel/core/lib/config/index'>; 227 | } 228 | declare module '@babel/core/lib/config/item.js' { 229 | declare module.exports: $Exports<'@babel/core/lib/config/item'>; 230 | } 231 | declare module '@babel/core/lib/config/partial.js' { 232 | declare module.exports: $Exports<'@babel/core/lib/config/partial'>; 233 | } 234 | declare module '@babel/core/lib/config/pattern-to-regex.js' { 235 | declare module.exports: $Exports<'@babel/core/lib/config/pattern-to-regex'>; 236 | } 237 | declare module '@babel/core/lib/config/plugin.js' { 238 | declare module.exports: $Exports<'@babel/core/lib/config/plugin'>; 239 | } 240 | declare module '@babel/core/lib/config/util.js' { 241 | declare module.exports: $Exports<'@babel/core/lib/config/util'>; 242 | } 243 | declare module '@babel/core/lib/config/validation/option-assertions.js' { 244 | declare module.exports: $Exports<'@babel/core/lib/config/validation/option-assertions'>; 245 | } 246 | declare module '@babel/core/lib/config/validation/options.js' { 247 | declare module.exports: $Exports<'@babel/core/lib/config/validation/options'>; 248 | } 249 | declare module '@babel/core/lib/config/validation/plugins.js' { 250 | declare module.exports: $Exports<'@babel/core/lib/config/validation/plugins'>; 251 | } 252 | declare module '@babel/core/lib/config/validation/removed.js' { 253 | declare module.exports: $Exports<'@babel/core/lib/config/validation/removed'>; 254 | } 255 | declare module '@babel/core/lib/index.js' { 256 | declare module.exports: $Exports<'@babel/core/lib/index'>; 257 | } 258 | declare module '@babel/core/lib/parse.js' { 259 | declare module.exports: $Exports<'@babel/core/lib/parse'>; 260 | } 261 | declare module '@babel/core/lib/tools/build-external-helpers.js' { 262 | declare module.exports: $Exports<'@babel/core/lib/tools/build-external-helpers'>; 263 | } 264 | declare module '@babel/core/lib/transform-ast.js' { 265 | declare module.exports: $Exports<'@babel/core/lib/transform-ast'>; 266 | } 267 | declare module '@babel/core/lib/transform-file-browser.js' { 268 | declare module.exports: $Exports<'@babel/core/lib/transform-file-browser'>; 269 | } 270 | declare module '@babel/core/lib/transform-file-sync-browser.js' { 271 | declare module.exports: $Exports<'@babel/core/lib/transform-file-sync-browser'>; 272 | } 273 | declare module '@babel/core/lib/transform-file.js' { 274 | declare module.exports: $Exports<'@babel/core/lib/transform-file'>; 275 | } 276 | declare module '@babel/core/lib/transform.js' { 277 | declare module.exports: $Exports<'@babel/core/lib/transform'>; 278 | } 279 | declare module '@babel/core/lib/transformation/block-hoist-plugin.js' { 280 | declare module.exports: $Exports<'@babel/core/lib/transformation/block-hoist-plugin'>; 281 | } 282 | declare module '@babel/core/lib/transformation/file/file.js' { 283 | declare module.exports: $Exports<'@babel/core/lib/transformation/file/file'>; 284 | } 285 | declare module '@babel/core/lib/transformation/file/generate.js' { 286 | declare module.exports: $Exports<'@babel/core/lib/transformation/file/generate'>; 287 | } 288 | declare module '@babel/core/lib/transformation/file/merge-map.js' { 289 | declare module.exports: $Exports<'@babel/core/lib/transformation/file/merge-map'>; 290 | } 291 | declare module '@babel/core/lib/transformation/index.js' { 292 | declare module.exports: $Exports<'@babel/core/lib/transformation/index'>; 293 | } 294 | declare module '@babel/core/lib/transformation/normalize-file.js' { 295 | declare module.exports: $Exports<'@babel/core/lib/transformation/normalize-file'>; 296 | } 297 | declare module '@babel/core/lib/transformation/normalize-opts.js' { 298 | declare module.exports: $Exports<'@babel/core/lib/transformation/normalize-opts'>; 299 | } 300 | declare module '@babel/core/lib/transformation/plugin-pass.js' { 301 | declare module.exports: $Exports<'@babel/core/lib/transformation/plugin-pass'>; 302 | } 303 | declare module '@babel/core/lib/transformation/util/missing-plugin-helper.js' { 304 | declare module.exports: $Exports<'@babel/core/lib/transformation/util/missing-plugin-helper'>; 305 | } 306 | -------------------------------------------------------------------------------- /src/output.js: -------------------------------------------------------------------------------- 1 | // @flow strict 2 | 3 | import { Section, Text, Break } from "./components"; 4 | import stripAnsi from "strip-ansi"; 5 | import wrapAnsiNewLine from "wrap-ansi"; 6 | import wcwidth from "wcwidth"; 7 | // this module is helpful for dealing with ansi characters, but it returns a 8 | // string with embedded new lines. We need it as an array, so we'll split it here 9 | const wrapAnsi = (input: string, columns: number): Array => 10 | wrapAnsiNewLine(input, columns).split("\n"); 11 | 12 | function combineChildren(section: Section): Array { 13 | // If we have multiple text nodes in a row, first combine them into one 14 | const combinedChildren: Array = []; 15 | let textBuffer = []; 16 | section.children.forEach((child, index) => { 17 | if (child instanceof Text) { 18 | textBuffer.push(child); 19 | } else { 20 | if (textBuffer.length > 0) { 21 | combinedChildren.push( 22 | new Text(textBuffer.map(textObject => textObject.text).join("")) 23 | ); 24 | textBuffer = []; 25 | } 26 | combinedChildren.push(child); 27 | } 28 | if (index === section.children.length - 1 && textBuffer.length > 0) { 29 | combinedChildren.push( 30 | new Text(textBuffer.map(textObject => textObject.text).join("")) 31 | ); 32 | } 33 | }); 34 | return combinedChildren; 35 | } 36 | 37 | export default function getOutputFromSection({ 38 | section, 39 | width 40 | }: { 41 | section: Section, 42 | width: number 43 | }): RowOutput | ColumnOutput { 44 | if (section.orientation === "vertical") { 45 | return new RowOutput({ width, section }); 46 | } else { 47 | return new ColumnOutput({ width, section }); 48 | } 49 | } 50 | 51 | function textColumnCount(text: string): number { 52 | // leaving the wrapper for now since its been changed so much recently 53 | // emojis are hard 😓 54 | return wcwidth(stripAnsi(text)); 55 | } 56 | 57 | class RowOutput { 58 | width: number; 59 | rows: Array; 60 | section: Section; 61 | 62 | constructor({ width, section }: { width: number, section: Section }) { 63 | this.width = width; 64 | this.section = section; 65 | 66 | const combinedChildren = combineChildren(section); 67 | this.rows = combinedChildren.reduce((acc, child) => { 68 | if (child instanceof Section) { 69 | return acc.concat( 70 | getOutputFromSection({ 71 | section: child, 72 | width: width - this.section.border.horizontalWidth() 73 | }) 74 | ); 75 | } else if (child instanceof Text) { 76 | return acc.concat( 77 | new TextOutput( 78 | wrapAnsi(child.text, width - this.section.border.horizontalWidth()) 79 | ) 80 | ); 81 | } 82 | return acc; 83 | }, []); 84 | // @TODO i think we need to actually manipulate the section contents here. 85 | // might need to pass a temp fixed height down the tree as well 86 | } 87 | 88 | getLineLength(): number { 89 | const rowsLineLength = this.rows.reduce((acc, child) => { 90 | return acc + child.getLineLength(); 91 | }, 0); 92 | return ( 93 | (this.section.height ? this.section.height : rowsLineLength) + 94 | this.section.border.verticalHeight() 95 | ); 96 | } 97 | 98 | padText({ text, spacing }: { text: string, spacing: string }): string { 99 | const border = this.section.border.vertical || ""; 100 | const innerWidth = this.width - this.section.border.horizontalWidth(); 101 | 102 | let innerText; 103 | switch (this.section.align) { 104 | case "left": 105 | innerText = 106 | text + "".padStart(innerWidth - textColumnCount(text), spacing); 107 | break; 108 | case "right": 109 | innerText = 110 | "".padStart(innerWidth - textColumnCount(text), spacing) + text; 111 | break; 112 | default: 113 | innerText = 114 | "".padStart((innerWidth - textColumnCount(text)) / 2, spacing) + 115 | text + 116 | "".padStart( 117 | (innerWidth - textColumnCount(text)) / 2 + 118 | ((innerWidth - textColumnCount(text)) % 2), 119 | spacing 120 | ); 121 | break; 122 | } 123 | // @TODO: need to handle if the corners are wider than the border 124 | return border + innerText + border; 125 | } 126 | 127 | generateOutput({ 128 | currentLineIndex, 129 | startLineIndex, 130 | spacing 131 | }: { 132 | currentLineIndex: number, 133 | startLineIndex: number, 134 | spacing: string 135 | }): string { 136 | const topBorderLength = Math.max( 137 | (this.section.border.horizontal || "").length, 138 | (this.section.border.cornerTopLeft || "").length, 139 | (this.section.border.cornerTopRight || "").length 140 | ); 141 | const bottomBorderLength = Math.max( 142 | (this.section.border.horizontal || "").length, 143 | (this.section.border.cornerBottomLeft || "").length, 144 | (this.section.border.cornerBottomRight || "").length 145 | ); 146 | 147 | let outputString = ""; 148 | 149 | // print top border 150 | if ( 151 | topBorderLength > 0 && 152 | currentLineIndex < startLineIndex + topBorderLength && 153 | currentLineIndex >= startLineIndex 154 | ) { 155 | // @TODO need to account for corners and borders more than 1 length 156 | return outputString.padEnd( 157 | this.width, 158 | this.section.border.horizontal || "" 159 | ); 160 | } 161 | 162 | // print bottom border 163 | if ( 164 | bottomBorderLength > 0 && 165 | currentLineIndex < startLineIndex + this.getLineLength() && 166 | currentLineIndex >= 167 | startLineIndex + this.getLineLength() - bottomBorderLength 168 | ) { 169 | // @TODO need to account for corners and borders more than 1 length 170 | return outputString.padEnd( 171 | this.width, 172 | this.section.border.horizontal || "" 173 | ); 174 | } 175 | 176 | let tempLineIndex = startLineIndex + topBorderLength; 177 | this.rows.forEach(child => { 178 | if ( 179 | currentLineIndex >= tempLineIndex && 180 | currentLineIndex < tempLineIndex + child.getLineLength() 181 | ) { 182 | if (child instanceof RowOutput || child instanceof ColumnOutput) { 183 | outputString += this.padText({ 184 | spacing, 185 | text: child.generateOutput({ 186 | currentLineIndex, 187 | startLineIndex: tempLineIndex, 188 | spacing 189 | }) 190 | }); 191 | } else if (child instanceof TextOutput) { 192 | if ( 193 | currentLineIndex >= tempLineIndex && 194 | currentLineIndex < tempLineIndex + child.getLineLength() 195 | ) { 196 | const potentialOutput = 197 | child.text[currentLineIndex - tempLineIndex] || ""; 198 | outputString += this.padText({ spacing, text: potentialOutput }); 199 | } 200 | } 201 | } 202 | tempLineIndex += child.getLineLength(); 203 | }); 204 | return outputString; 205 | } 206 | } 207 | 208 | class ColumnOutput { 209 | width: number; 210 | columns: Array; 211 | section: Section; 212 | 213 | constructor({ width, section }: { width: number, section: Section }) { 214 | this.width = width; 215 | this.section = section; 216 | 217 | const combinedChildren = combineChildren(section); 218 | const columnNumber = combinedChildren.reduce( 219 | (acc, child) => (child instanceof Break ? acc : acc + 1), 220 | 0 221 | ); 222 | this.columns = combinedChildren.reduce((acc, child, index) => { 223 | let childWidth = Math.floor( 224 | (width - this.section.border.horizontalWidth()) / columnNumber 225 | ); 226 | if (index === combinedChildren.length - 1) { 227 | childWidth += 228 | (width - this.section.border.horizontalWidth()) % columnNumber; 229 | } 230 | if (child instanceof Section) { 231 | return acc.concat( 232 | getOutputFromSection({ 233 | section: child, 234 | width: childWidth 235 | }) 236 | ); 237 | } else if (child instanceof Text) { 238 | return acc.concat(new TextOutput(wrapAnsi(child.text, childWidth))); 239 | } 240 | return acc; 241 | }, []); 242 | } 243 | 244 | getLineLength(): number { 245 | const maxColumnHeight = this.columns.reduce((max, column) => { 246 | const columnLength = column.getLineLength(); 247 | return columnLength > max ? columnLength : max; 248 | }, 0); 249 | return ( 250 | (this.section.height ? this.section.height : maxColumnHeight) + 251 | this.section.border.verticalHeight() 252 | ); 253 | } 254 | 255 | padText({ 256 | text, 257 | spacing, 258 | index 259 | }: { 260 | text: string, 261 | spacing: string, 262 | index: number 263 | }): string { 264 | const innerWidth = this.width - this.section.border.horizontalWidth(); 265 | let columnWidth = Math.floor(innerWidth / this.columns.length); 266 | if (index == this.columns.length - 1) { 267 | columnWidth += innerWidth % this.columns.length; 268 | } 269 | 270 | let innerText; 271 | switch (this.section.align) { 272 | case "left": 273 | innerText = 274 | text + "".padStart(columnWidth - textColumnCount(text), spacing); 275 | break; 276 | case "right": 277 | innerText = 278 | "".padStart(columnWidth - textColumnCount(text), spacing) + text; 279 | break; 280 | default: 281 | innerText = 282 | "".padStart((columnWidth - textColumnCount(text)) / 2, spacing) + 283 | text + 284 | "".padStart( 285 | (columnWidth - textColumnCount(text)) / 2 + 286 | ((columnWidth - textColumnCount(text)) % 2), 287 | spacing 288 | ); 289 | break; 290 | } 291 | const border = this.section.border.vertical || ""; 292 | if (index === 0) { 293 | return border + innerText; 294 | } else if (index === this.columns.length - 1) { 295 | return innerText + border; 296 | } 297 | // @TODO: need to handle if the corners are wider than the border 298 | return innerText; 299 | } 300 | 301 | generateOutput({ 302 | currentLineIndex, 303 | startLineIndex, 304 | spacing 305 | }: { 306 | currentLineIndex: number, 307 | startLineIndex: number, 308 | spacing: string 309 | }): string { 310 | const maxColumnHeight = this.columns.reduce((acc, column) => { 311 | const currentColumnHeight = column.getLineLength(); 312 | return currentColumnHeight > acc ? currentColumnHeight : acc; 313 | }, 0); 314 | const topBorderLength = Math.max( 315 | (this.section.border.horizontal || "").length, 316 | (this.section.border.cornerTopLeft || "").length, 317 | (this.section.border.cornerTopRight || "").length 318 | ); 319 | const bottomBorderLength = Math.max( 320 | (this.section.border.horizontal || "").length, 321 | (this.section.border.cornerBottomLeft || "").length, 322 | (this.section.border.cornerBottomRight || "").length 323 | ); 324 | 325 | let outputString = ""; 326 | 327 | // print top border 328 | if ( 329 | topBorderLength > 0 && 330 | currentLineIndex < startLineIndex + topBorderLength && 331 | currentLineIndex >= startLineIndex 332 | ) { 333 | // @TODO need to account for corners and borders more than 1 length 334 | return outputString.padEnd( 335 | this.width, 336 | this.section.border.horizontal || "" 337 | ); 338 | } 339 | 340 | // print bottom border 341 | if ( 342 | bottomBorderLength > 0 && 343 | currentLineIndex < startLineIndex + this.getLineLength() && 344 | currentLineIndex >= 345 | startLineIndex + this.getLineLength() - bottomBorderLength 346 | ) { 347 | // @TODO need to account for corners and borders more than 1 length 348 | return outputString.padEnd( 349 | this.width, 350 | this.section.border.horizontal || "" 351 | ); 352 | } 353 | 354 | this.columns.forEach((column, columnIndex) => { 355 | if ( 356 | currentLineIndex >= 357 | startLineIndex + topBorderLength + column.getLineLength() 358 | ) { 359 | if ( 360 | currentLineIndex < 361 | startLineIndex + topBorderLength + maxColumnHeight 362 | ) { 363 | outputString += this.padText({ 364 | text: "", 365 | spacing, 366 | index: columnIndex 367 | }); 368 | } 369 | } else { 370 | if (column instanceof RowOutput || column instanceof ColumnOutput) { 371 | outputString += this.padText({ 372 | text: column.generateOutput({ 373 | currentLineIndex, 374 | startLineIndex: startLineIndex + topBorderLength, 375 | spacing 376 | }), 377 | spacing, 378 | index: columnIndex 379 | }); 380 | } else if (column instanceof TextOutput) { 381 | const potentialOutput = 382 | column.text[currentLineIndex - topBorderLength - startLineIndex] || 383 | ""; 384 | outputString += this.padText({ 385 | spacing, 386 | text: potentialOutput, 387 | index: columnIndex 388 | }); 389 | } 390 | } 391 | }); 392 | return outputString; 393 | } 394 | } 395 | 396 | class TextOutput { 397 | text: Array; 398 | 399 | constructor(text: Array) { 400 | this.text = text; 401 | } 402 | 403 | getLineLength(): number { 404 | return this.text.length; 405 | } 406 | } 407 | type OutputType = RowOutput | TextOutput | ColumnOutput; 408 | -------------------------------------------------------------------------------- /lib/output.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = getOutputFromSection; 7 | 8 | var _components = require("./components"); 9 | 10 | var _stripAnsi = _interopRequireDefault(require("strip-ansi")); 11 | 12 | var _wrapAnsi = _interopRequireDefault(require("wrap-ansi")); 13 | 14 | var _wcwidth = _interopRequireDefault(require("wcwidth")); 15 | 16 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 17 | 18 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 19 | 20 | function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 21 | 22 | function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 23 | 24 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 25 | 26 | // this module is helpful for dealing with ansi characters, but it returns a 27 | // string with embedded new lines. We need it as an array, so we'll split it here 28 | var wrapAnsi = function wrapAnsi(input, columns) { 29 | return (0, _wrapAnsi.default)(input, columns).split("\n"); 30 | }; 31 | 32 | function combineChildren(section) { 33 | // If we have multiple text nodes in a row, first combine them into one 34 | var combinedChildren = []; 35 | var textBuffer = []; 36 | section.children.forEach(function (child, index) { 37 | if (child instanceof _components.Text) { 38 | textBuffer.push(child); 39 | } else { 40 | if (textBuffer.length > 0) { 41 | combinedChildren.push(new _components.Text(textBuffer.map(function (textObject) { 42 | return textObject.text; 43 | }).join(""))); 44 | textBuffer = []; 45 | } 46 | 47 | combinedChildren.push(child); 48 | } 49 | 50 | if (index === section.children.length - 1 && textBuffer.length > 0) { 51 | combinedChildren.push(new _components.Text(textBuffer.map(function (textObject) { 52 | return textObject.text; 53 | }).join(""))); 54 | } 55 | }); 56 | return combinedChildren; 57 | } 58 | 59 | function getOutputFromSection(_ref) { 60 | var section = _ref.section, 61 | width = _ref.width; 62 | 63 | if (section.orientation === "vertical") { 64 | return new RowOutput({ 65 | width: width, 66 | section: section 67 | }); 68 | } else { 69 | return new ColumnOutput({ 70 | width: width, 71 | section: section 72 | }); 73 | } 74 | } 75 | 76 | function textColumnCount(text) { 77 | // leaving the wrapper for now since its been changed so much recently 78 | // emojis are hard 😓 79 | return (0, _wcwidth.default)((0, _stripAnsi.default)(text)); 80 | } 81 | 82 | var RowOutput = 83 | /*#__PURE__*/ 84 | function () { 85 | function RowOutput(_ref2) { 86 | var _this = this; 87 | 88 | var width = _ref2.width, 89 | section = _ref2.section; 90 | 91 | _classCallCheck(this, RowOutput); 92 | 93 | _defineProperty(this, "width", void 0); 94 | 95 | _defineProperty(this, "rows", void 0); 96 | 97 | _defineProperty(this, "section", void 0); 98 | 99 | this.width = width; 100 | this.section = section; 101 | var combinedChildren = combineChildren(section); 102 | this.rows = combinedChildren.reduce(function (acc, child) { 103 | if (child instanceof _components.Section) { 104 | return acc.concat(getOutputFromSection({ 105 | section: child, 106 | width: width - _this.section.border.horizontalWidth() 107 | })); 108 | } else if (child instanceof _components.Text) { 109 | return acc.concat(new TextOutput(wrapAnsi(child.text, width - _this.section.border.horizontalWidth()))); 110 | } 111 | 112 | return acc; 113 | }, []); // @TODO i think we need to actually manipulate the section contents here. 114 | // might need to pass a temp fixed height down the tree as well 115 | } 116 | 117 | _createClass(RowOutput, [{ 118 | key: "getLineLength", 119 | value: function getLineLength() { 120 | var rowsLineLength = this.rows.reduce(function (acc, child) { 121 | return acc + child.getLineLength(); 122 | }, 0); 123 | return (this.section.height ? this.section.height : rowsLineLength) + this.section.border.verticalHeight(); 124 | } 125 | }, { 126 | key: "padText", 127 | value: function padText(_ref3) { 128 | var text = _ref3.text, 129 | spacing = _ref3.spacing; 130 | var border = this.section.border.vertical || ""; 131 | var innerWidth = this.width - this.section.border.horizontalWidth(); 132 | var innerText; 133 | 134 | switch (this.section.align) { 135 | case "left": 136 | innerText = text + "".padStart(innerWidth - textColumnCount(text), spacing); 137 | break; 138 | 139 | case "right": 140 | innerText = "".padStart(innerWidth - textColumnCount(text), spacing) + text; 141 | break; 142 | 143 | default: 144 | innerText = "".padStart((innerWidth - textColumnCount(text)) / 2, spacing) + text + "".padStart((innerWidth - textColumnCount(text)) / 2 + (innerWidth - textColumnCount(text)) % 2, spacing); 145 | break; 146 | } // @TODO: need to handle if the corners are wider than the border 147 | 148 | 149 | return border + innerText + border; 150 | } 151 | }, { 152 | key: "generateOutput", 153 | value: function generateOutput(_ref4) { 154 | var _this2 = this; 155 | 156 | var currentLineIndex = _ref4.currentLineIndex, 157 | startLineIndex = _ref4.startLineIndex, 158 | spacing = _ref4.spacing; 159 | var topBorderLength = Math.max((this.section.border.horizontal || "").length, (this.section.border.cornerTopLeft || "").length, (this.section.border.cornerTopRight || "").length); 160 | var bottomBorderLength = Math.max((this.section.border.horizontal || "").length, (this.section.border.cornerBottomLeft || "").length, (this.section.border.cornerBottomRight || "").length); 161 | var outputString = ""; // print top border 162 | 163 | if (topBorderLength > 0 && currentLineIndex < startLineIndex + topBorderLength && currentLineIndex >= startLineIndex) { 164 | // @TODO need to account for corners and borders more than 1 length 165 | return outputString.padEnd(this.width, this.section.border.horizontal || ""); 166 | } // print bottom border 167 | 168 | 169 | if (bottomBorderLength > 0 && currentLineIndex < startLineIndex + this.getLineLength() && currentLineIndex >= startLineIndex + this.getLineLength() - bottomBorderLength) { 170 | // @TODO need to account for corners and borders more than 1 length 171 | return outputString.padEnd(this.width, this.section.border.horizontal || ""); 172 | } 173 | 174 | var tempLineIndex = startLineIndex + topBorderLength; 175 | this.rows.forEach(function (child) { 176 | if (currentLineIndex >= tempLineIndex && currentLineIndex < tempLineIndex + child.getLineLength()) { 177 | if (child instanceof RowOutput || child instanceof ColumnOutput) { 178 | outputString += _this2.padText({ 179 | spacing: spacing, 180 | text: child.generateOutput({ 181 | currentLineIndex: currentLineIndex, 182 | startLineIndex: tempLineIndex, 183 | spacing: spacing 184 | }) 185 | }); 186 | } else if (child instanceof TextOutput) { 187 | if (currentLineIndex >= tempLineIndex && currentLineIndex < tempLineIndex + child.getLineLength()) { 188 | var potentialOutput = child.text[currentLineIndex - tempLineIndex] || ""; 189 | outputString += _this2.padText({ 190 | spacing: spacing, 191 | text: potentialOutput 192 | }); 193 | } 194 | } 195 | } 196 | 197 | tempLineIndex += child.getLineLength(); 198 | }); 199 | return outputString; 200 | } 201 | }]); 202 | 203 | return RowOutput; 204 | }(); 205 | 206 | var ColumnOutput = 207 | /*#__PURE__*/ 208 | function () { 209 | function ColumnOutput(_ref5) { 210 | var _this3 = this; 211 | 212 | var width = _ref5.width, 213 | section = _ref5.section; 214 | 215 | _classCallCheck(this, ColumnOutput); 216 | 217 | _defineProperty(this, "width", void 0); 218 | 219 | _defineProperty(this, "columns", void 0); 220 | 221 | _defineProperty(this, "section", void 0); 222 | 223 | this.width = width; 224 | this.section = section; 225 | var combinedChildren = combineChildren(section); 226 | var columnNumber = combinedChildren.reduce(function (acc, child) { 227 | return child instanceof _components.Break ? acc : acc + 1; 228 | }, 0); 229 | this.columns = combinedChildren.reduce(function (acc, child, index) { 230 | var childWidth = Math.floor((width - _this3.section.border.horizontalWidth()) / columnNumber); 231 | 232 | if (index === combinedChildren.length - 1) { 233 | childWidth += (width - _this3.section.border.horizontalWidth()) % columnNumber; 234 | } 235 | 236 | if (child instanceof _components.Section) { 237 | return acc.concat(getOutputFromSection({ 238 | section: child, 239 | width: childWidth 240 | })); 241 | } else if (child instanceof _components.Text) { 242 | return acc.concat(new TextOutput(wrapAnsi(child.text, childWidth))); 243 | } 244 | 245 | return acc; 246 | }, []); 247 | } 248 | 249 | _createClass(ColumnOutput, [{ 250 | key: "getLineLength", 251 | value: function getLineLength() { 252 | var maxColumnHeight = this.columns.reduce(function (max, column) { 253 | var columnLength = column.getLineLength(); 254 | return columnLength > max ? columnLength : max; 255 | }, 0); 256 | return (this.section.height ? this.section.height : maxColumnHeight) + this.section.border.verticalHeight(); 257 | } 258 | }, { 259 | key: "padText", 260 | value: function padText(_ref6) { 261 | var text = _ref6.text, 262 | spacing = _ref6.spacing, 263 | index = _ref6.index; 264 | var innerWidth = this.width - this.section.border.horizontalWidth(); 265 | var columnWidth = Math.floor(innerWidth / this.columns.length); 266 | 267 | if (index == this.columns.length - 1) { 268 | columnWidth += innerWidth % this.columns.length; 269 | } 270 | 271 | var innerText; 272 | 273 | switch (this.section.align) { 274 | case "left": 275 | innerText = text + "".padStart(columnWidth - textColumnCount(text), spacing); 276 | break; 277 | 278 | case "right": 279 | innerText = "".padStart(columnWidth - textColumnCount(text), spacing) + text; 280 | break; 281 | 282 | default: 283 | innerText = "".padStart((columnWidth - textColumnCount(text)) / 2, spacing) + text + "".padStart((columnWidth - textColumnCount(text)) / 2 + (columnWidth - textColumnCount(text)) % 2, spacing); 284 | break; 285 | } 286 | 287 | var border = this.section.border.vertical || ""; 288 | 289 | if (index === 0) { 290 | return border + innerText; 291 | } else if (index === this.columns.length - 1) { 292 | return innerText + border; 293 | } // @TODO: need to handle if the corners are wider than the border 294 | 295 | 296 | return innerText; 297 | } 298 | }, { 299 | key: "generateOutput", 300 | value: function generateOutput(_ref7) { 301 | var _this4 = this; 302 | 303 | var currentLineIndex = _ref7.currentLineIndex, 304 | startLineIndex = _ref7.startLineIndex, 305 | spacing = _ref7.spacing; 306 | var maxColumnHeight = this.columns.reduce(function (acc, column) { 307 | var currentColumnHeight = column.getLineLength(); 308 | return currentColumnHeight > acc ? currentColumnHeight : acc; 309 | }, 0); 310 | var topBorderLength = Math.max((this.section.border.horizontal || "").length, (this.section.border.cornerTopLeft || "").length, (this.section.border.cornerTopRight || "").length); 311 | var bottomBorderLength = Math.max((this.section.border.horizontal || "").length, (this.section.border.cornerBottomLeft || "").length, (this.section.border.cornerBottomRight || "").length); 312 | var outputString = ""; // print top border 313 | 314 | if (topBorderLength > 0 && currentLineIndex < startLineIndex + topBorderLength && currentLineIndex >= startLineIndex) { 315 | // @TODO need to account for corners and borders more than 1 length 316 | return outputString.padEnd(this.width, this.section.border.horizontal || ""); 317 | } // print bottom border 318 | 319 | 320 | if (bottomBorderLength > 0 && currentLineIndex < startLineIndex + this.getLineLength() && currentLineIndex >= startLineIndex + this.getLineLength() - bottomBorderLength) { 321 | // @TODO need to account for corners and borders more than 1 length 322 | return outputString.padEnd(this.width, this.section.border.horizontal || ""); 323 | } 324 | 325 | this.columns.forEach(function (column, columnIndex) { 326 | if (currentLineIndex >= startLineIndex + topBorderLength + column.getLineLength()) { 327 | if (currentLineIndex < startLineIndex + topBorderLength + maxColumnHeight) { 328 | outputString += _this4.padText({ 329 | text: "", 330 | spacing: spacing, 331 | index: columnIndex 332 | }); 333 | } 334 | } else { 335 | if (column instanceof RowOutput || column instanceof ColumnOutput) { 336 | outputString += _this4.padText({ 337 | text: column.generateOutput({ 338 | currentLineIndex: currentLineIndex, 339 | startLineIndex: startLineIndex + topBorderLength, 340 | spacing: spacing 341 | }), 342 | spacing: spacing, 343 | index: columnIndex 344 | }); 345 | } else if (column instanceof TextOutput) { 346 | var potentialOutput = column.text[currentLineIndex - topBorderLength - startLineIndex] || ""; 347 | outputString += _this4.padText({ 348 | spacing: spacing, 349 | text: potentialOutput, 350 | index: columnIndex 351 | }); 352 | } 353 | } 354 | }); 355 | return outputString; 356 | } 357 | }]); 358 | 359 | return ColumnOutput; 360 | }(); 361 | 362 | var TextOutput = 363 | /*#__PURE__*/ 364 | function () { 365 | function TextOutput(text) { 366 | _classCallCheck(this, TextOutput); 367 | 368 | _defineProperty(this, "text", void 0); 369 | 370 | this.text = text; 371 | } 372 | 373 | _createClass(TextOutput, [{ 374 | key: "getLineLength", 375 | value: function getLineLength() { 376 | return this.text.length; 377 | } 378 | }]); 379 | 380 | return TextOutput; 381 | }(); -------------------------------------------------------------------------------- /flow-typed/npm/eslint-plugin-import_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: f89bb184d3718beaed125cd3387152be 2 | // flow-typed version: <>/eslint-plugin-import_v^2.14.0/flow_v0.85.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'eslint-plugin-import' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'eslint-plugin-import' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'eslint-plugin-import/config/electron' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'eslint-plugin-import/config/errors' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'eslint-plugin-import/config/react-native' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'eslint-plugin-import/config/react' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'eslint-plugin-import/config/recommended' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'eslint-plugin-import/config/stage-0' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'eslint-plugin-import/config/warnings' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'eslint-plugin-import/lib/core/importType' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module 'eslint-plugin-import/lib/core/staticRequire' { 58 | declare module.exports: any; 59 | } 60 | 61 | declare module 'eslint-plugin-import/lib/docsUrl' { 62 | declare module.exports: any; 63 | } 64 | 65 | declare module 'eslint-plugin-import/lib/ExportMap' { 66 | declare module.exports: any; 67 | } 68 | 69 | declare module 'eslint-plugin-import/lib/importDeclaration' { 70 | declare module.exports: any; 71 | } 72 | 73 | declare module 'eslint-plugin-import/lib/index' { 74 | declare module.exports: any; 75 | } 76 | 77 | declare module 'eslint-plugin-import/lib/rules/default' { 78 | declare module.exports: any; 79 | } 80 | 81 | declare module 'eslint-plugin-import/lib/rules/dynamic-import-chunkname' { 82 | declare module.exports: any; 83 | } 84 | 85 | declare module 'eslint-plugin-import/lib/rules/export' { 86 | declare module.exports: any; 87 | } 88 | 89 | declare module 'eslint-plugin-import/lib/rules/exports-last' { 90 | declare module.exports: any; 91 | } 92 | 93 | declare module 'eslint-plugin-import/lib/rules/extensions' { 94 | declare module.exports: any; 95 | } 96 | 97 | declare module 'eslint-plugin-import/lib/rules/first' { 98 | declare module.exports: any; 99 | } 100 | 101 | declare module 'eslint-plugin-import/lib/rules/group-exports' { 102 | declare module.exports: any; 103 | } 104 | 105 | declare module 'eslint-plugin-import/lib/rules/imports-first' { 106 | declare module.exports: any; 107 | } 108 | 109 | declare module 'eslint-plugin-import/lib/rules/max-dependencies' { 110 | declare module.exports: any; 111 | } 112 | 113 | declare module 'eslint-plugin-import/lib/rules/named' { 114 | declare module.exports: any; 115 | } 116 | 117 | declare module 'eslint-plugin-import/lib/rules/namespace' { 118 | declare module.exports: any; 119 | } 120 | 121 | declare module 'eslint-plugin-import/lib/rules/newline-after-import' { 122 | declare module.exports: any; 123 | } 124 | 125 | declare module 'eslint-plugin-import/lib/rules/no-absolute-path' { 126 | declare module.exports: any; 127 | } 128 | 129 | declare module 'eslint-plugin-import/lib/rules/no-amd' { 130 | declare module.exports: any; 131 | } 132 | 133 | declare module 'eslint-plugin-import/lib/rules/no-anonymous-default-export' { 134 | declare module.exports: any; 135 | } 136 | 137 | declare module 'eslint-plugin-import/lib/rules/no-commonjs' { 138 | declare module.exports: any; 139 | } 140 | 141 | declare module 'eslint-plugin-import/lib/rules/no-cycle' { 142 | declare module.exports: any; 143 | } 144 | 145 | declare module 'eslint-plugin-import/lib/rules/no-default-export' { 146 | declare module.exports: any; 147 | } 148 | 149 | declare module 'eslint-plugin-import/lib/rules/no-deprecated' { 150 | declare module.exports: any; 151 | } 152 | 153 | declare module 'eslint-plugin-import/lib/rules/no-duplicates' { 154 | declare module.exports: any; 155 | } 156 | 157 | declare module 'eslint-plugin-import/lib/rules/no-dynamic-require' { 158 | declare module.exports: any; 159 | } 160 | 161 | declare module 'eslint-plugin-import/lib/rules/no-extraneous-dependencies' { 162 | declare module.exports: any; 163 | } 164 | 165 | declare module 'eslint-plugin-import/lib/rules/no-internal-modules' { 166 | declare module.exports: any; 167 | } 168 | 169 | declare module 'eslint-plugin-import/lib/rules/no-mutable-exports' { 170 | declare module.exports: any; 171 | } 172 | 173 | declare module 'eslint-plugin-import/lib/rules/no-named-as-default-member' { 174 | declare module.exports: any; 175 | } 176 | 177 | declare module 'eslint-plugin-import/lib/rules/no-named-as-default' { 178 | declare module.exports: any; 179 | } 180 | 181 | declare module 'eslint-plugin-import/lib/rules/no-named-default' { 182 | declare module.exports: any; 183 | } 184 | 185 | declare module 'eslint-plugin-import/lib/rules/no-namespace' { 186 | declare module.exports: any; 187 | } 188 | 189 | declare module 'eslint-plugin-import/lib/rules/no-nodejs-modules' { 190 | declare module.exports: any; 191 | } 192 | 193 | declare module 'eslint-plugin-import/lib/rules/no-relative-parent-imports' { 194 | declare module.exports: any; 195 | } 196 | 197 | declare module 'eslint-plugin-import/lib/rules/no-restricted-paths' { 198 | declare module.exports: any; 199 | } 200 | 201 | declare module 'eslint-plugin-import/lib/rules/no-self-import' { 202 | declare module.exports: any; 203 | } 204 | 205 | declare module 'eslint-plugin-import/lib/rules/no-unassigned-import' { 206 | declare module.exports: any; 207 | } 208 | 209 | declare module 'eslint-plugin-import/lib/rules/no-unresolved' { 210 | declare module.exports: any; 211 | } 212 | 213 | declare module 'eslint-plugin-import/lib/rules/no-useless-path-segments' { 214 | declare module.exports: any; 215 | } 216 | 217 | declare module 'eslint-plugin-import/lib/rules/no-webpack-loader-syntax' { 218 | declare module.exports: any; 219 | } 220 | 221 | declare module 'eslint-plugin-import/lib/rules/order' { 222 | declare module.exports: any; 223 | } 224 | 225 | declare module 'eslint-plugin-import/lib/rules/prefer-default-export' { 226 | declare module.exports: any; 227 | } 228 | 229 | declare module 'eslint-plugin-import/lib/rules/unambiguous' { 230 | declare module.exports: any; 231 | } 232 | 233 | declare module 'eslint-plugin-import/memo-parser/index' { 234 | declare module.exports: any; 235 | } 236 | 237 | // Filename aliases 238 | declare module 'eslint-plugin-import/config/electron.js' { 239 | declare module.exports: $Exports<'eslint-plugin-import/config/electron'>; 240 | } 241 | declare module 'eslint-plugin-import/config/errors.js' { 242 | declare module.exports: $Exports<'eslint-plugin-import/config/errors'>; 243 | } 244 | declare module 'eslint-plugin-import/config/react-native.js' { 245 | declare module.exports: $Exports<'eslint-plugin-import/config/react-native'>; 246 | } 247 | declare module 'eslint-plugin-import/config/react.js' { 248 | declare module.exports: $Exports<'eslint-plugin-import/config/react'>; 249 | } 250 | declare module 'eslint-plugin-import/config/recommended.js' { 251 | declare module.exports: $Exports<'eslint-plugin-import/config/recommended'>; 252 | } 253 | declare module 'eslint-plugin-import/config/stage-0.js' { 254 | declare module.exports: $Exports<'eslint-plugin-import/config/stage-0'>; 255 | } 256 | declare module 'eslint-plugin-import/config/warnings.js' { 257 | declare module.exports: $Exports<'eslint-plugin-import/config/warnings'>; 258 | } 259 | declare module 'eslint-plugin-import/lib/core/importType.js' { 260 | declare module.exports: $Exports<'eslint-plugin-import/lib/core/importType'>; 261 | } 262 | declare module 'eslint-plugin-import/lib/core/staticRequire.js' { 263 | declare module.exports: $Exports<'eslint-plugin-import/lib/core/staticRequire'>; 264 | } 265 | declare module 'eslint-plugin-import/lib/docsUrl.js' { 266 | declare module.exports: $Exports<'eslint-plugin-import/lib/docsUrl'>; 267 | } 268 | declare module 'eslint-plugin-import/lib/ExportMap.js' { 269 | declare module.exports: $Exports<'eslint-plugin-import/lib/ExportMap'>; 270 | } 271 | declare module 'eslint-plugin-import/lib/importDeclaration.js' { 272 | declare module.exports: $Exports<'eslint-plugin-import/lib/importDeclaration'>; 273 | } 274 | declare module 'eslint-plugin-import/lib/index.js' { 275 | declare module.exports: $Exports<'eslint-plugin-import/lib/index'>; 276 | } 277 | declare module 'eslint-plugin-import/lib/rules/default.js' { 278 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/default'>; 279 | } 280 | declare module 'eslint-plugin-import/lib/rules/dynamic-import-chunkname.js' { 281 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/dynamic-import-chunkname'>; 282 | } 283 | declare module 'eslint-plugin-import/lib/rules/export.js' { 284 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/export'>; 285 | } 286 | declare module 'eslint-plugin-import/lib/rules/exports-last.js' { 287 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/exports-last'>; 288 | } 289 | declare module 'eslint-plugin-import/lib/rules/extensions.js' { 290 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/extensions'>; 291 | } 292 | declare module 'eslint-plugin-import/lib/rules/first.js' { 293 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/first'>; 294 | } 295 | declare module 'eslint-plugin-import/lib/rules/group-exports.js' { 296 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/group-exports'>; 297 | } 298 | declare module 'eslint-plugin-import/lib/rules/imports-first.js' { 299 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/imports-first'>; 300 | } 301 | declare module 'eslint-plugin-import/lib/rules/max-dependencies.js' { 302 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/max-dependencies'>; 303 | } 304 | declare module 'eslint-plugin-import/lib/rules/named.js' { 305 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/named'>; 306 | } 307 | declare module 'eslint-plugin-import/lib/rules/namespace.js' { 308 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/namespace'>; 309 | } 310 | declare module 'eslint-plugin-import/lib/rules/newline-after-import.js' { 311 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/newline-after-import'>; 312 | } 313 | declare module 'eslint-plugin-import/lib/rules/no-absolute-path.js' { 314 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-absolute-path'>; 315 | } 316 | declare module 'eslint-plugin-import/lib/rules/no-amd.js' { 317 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-amd'>; 318 | } 319 | declare module 'eslint-plugin-import/lib/rules/no-anonymous-default-export.js' { 320 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-anonymous-default-export'>; 321 | } 322 | declare module 'eslint-plugin-import/lib/rules/no-commonjs.js' { 323 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-commonjs'>; 324 | } 325 | declare module 'eslint-plugin-import/lib/rules/no-cycle.js' { 326 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-cycle'>; 327 | } 328 | declare module 'eslint-plugin-import/lib/rules/no-default-export.js' { 329 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-default-export'>; 330 | } 331 | declare module 'eslint-plugin-import/lib/rules/no-deprecated.js' { 332 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-deprecated'>; 333 | } 334 | declare module 'eslint-plugin-import/lib/rules/no-duplicates.js' { 335 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-duplicates'>; 336 | } 337 | declare module 'eslint-plugin-import/lib/rules/no-dynamic-require.js' { 338 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-dynamic-require'>; 339 | } 340 | declare module 'eslint-plugin-import/lib/rules/no-extraneous-dependencies.js' { 341 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-extraneous-dependencies'>; 342 | } 343 | declare module 'eslint-plugin-import/lib/rules/no-internal-modules.js' { 344 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-internal-modules'>; 345 | } 346 | declare module 'eslint-plugin-import/lib/rules/no-mutable-exports.js' { 347 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-mutable-exports'>; 348 | } 349 | declare module 'eslint-plugin-import/lib/rules/no-named-as-default-member.js' { 350 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-named-as-default-member'>; 351 | } 352 | declare module 'eslint-plugin-import/lib/rules/no-named-as-default.js' { 353 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-named-as-default'>; 354 | } 355 | declare module 'eslint-plugin-import/lib/rules/no-named-default.js' { 356 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-named-default'>; 357 | } 358 | declare module 'eslint-plugin-import/lib/rules/no-namespace.js' { 359 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-namespace'>; 360 | } 361 | declare module 'eslint-plugin-import/lib/rules/no-nodejs-modules.js' { 362 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-nodejs-modules'>; 363 | } 364 | declare module 'eslint-plugin-import/lib/rules/no-relative-parent-imports.js' { 365 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-relative-parent-imports'>; 366 | } 367 | declare module 'eslint-plugin-import/lib/rules/no-restricted-paths.js' { 368 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-restricted-paths'>; 369 | } 370 | declare module 'eslint-plugin-import/lib/rules/no-self-import.js' { 371 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-self-import'>; 372 | } 373 | declare module 'eslint-plugin-import/lib/rules/no-unassigned-import.js' { 374 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-unassigned-import'>; 375 | } 376 | declare module 'eslint-plugin-import/lib/rules/no-unresolved.js' { 377 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-unresolved'>; 378 | } 379 | declare module 'eslint-plugin-import/lib/rules/no-useless-path-segments.js' { 380 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-useless-path-segments'>; 381 | } 382 | declare module 'eslint-plugin-import/lib/rules/no-webpack-loader-syntax.js' { 383 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/no-webpack-loader-syntax'>; 384 | } 385 | declare module 'eslint-plugin-import/lib/rules/order.js' { 386 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/order'>; 387 | } 388 | declare module 'eslint-plugin-import/lib/rules/prefer-default-export.js' { 389 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/prefer-default-export'>; 390 | } 391 | declare module 'eslint-plugin-import/lib/rules/unambiguous.js' { 392 | declare module.exports: $Exports<'eslint-plugin-import/lib/rules/unambiguous'>; 393 | } 394 | declare module 'eslint-plugin-import/memo-parser/index.js' { 395 | declare module.exports: $Exports<'eslint-plugin-import/memo-parser/index'>; 396 | } 397 | -------------------------------------------------------------------------------- /flow-typed/npm/eslint-plugin-jest_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: af829a51c8f34283d8e83ebed7d9f93f 2 | // flow-typed version: <>/eslint-plugin-jest_v^21.26.2/flow_v0.85.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'eslint-plugin-jest' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'eslint-plugin-jest' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'eslint-plugin-jest/processors/__tests__/snapshot-processor.test' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'eslint-plugin-jest/processors/snapshot-processor' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'eslint-plugin-jest/rules/__tests__/consistent-test-it.test' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'eslint-plugin-jest/rules/__tests__/expect-expect.test' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'eslint-plugin-jest/rules/__tests__/lowercase-name.test' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'eslint-plugin-jest/rules/__tests__/no-alias-methods.test' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'eslint-plugin-jest/rules/__tests__/no-disabled-tests.test' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'eslint-plugin-jest/rules/__tests__/no-focused-tests.test' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module 'eslint-plugin-jest/rules/__tests__/no-hooks.test' { 58 | declare module.exports: any; 59 | } 60 | 61 | declare module 'eslint-plugin-jest/rules/__tests__/no-identical-title.test' { 62 | declare module.exports: any; 63 | } 64 | 65 | declare module 'eslint-plugin-jest/rules/__tests__/no-jasmine-globals.test' { 66 | declare module.exports: any; 67 | } 68 | 69 | declare module 'eslint-plugin-jest/rules/__tests__/no-jest-import.test' { 70 | declare module.exports: any; 71 | } 72 | 73 | declare module 'eslint-plugin-jest/rules/__tests__/no-large-snapshots.test' { 74 | declare module.exports: any; 75 | } 76 | 77 | declare module 'eslint-plugin-jest/rules/__tests__/no-test-callback.test' { 78 | declare module.exports: any; 79 | } 80 | 81 | declare module 'eslint-plugin-jest/rules/__tests__/no-test-prefixes.test' { 82 | declare module.exports: any; 83 | } 84 | 85 | declare module 'eslint-plugin-jest/rules/__tests__/no-test-return-statement.test' { 86 | declare module.exports: any; 87 | } 88 | 89 | declare module 'eslint-plugin-jest/rules/__tests__/prefer-expect-assertions.test' { 90 | declare module.exports: any; 91 | } 92 | 93 | declare module 'eslint-plugin-jest/rules/__tests__/prefer-inline-snapshots.test' { 94 | declare module.exports: any; 95 | } 96 | 97 | declare module 'eslint-plugin-jest/rules/__tests__/prefer-strict-equal.test' { 98 | declare module.exports: any; 99 | } 100 | 101 | declare module 'eslint-plugin-jest/rules/__tests__/prefer-to-be-null.test' { 102 | declare module.exports: any; 103 | } 104 | 105 | declare module 'eslint-plugin-jest/rules/__tests__/prefer-to-be-undefined.test' { 106 | declare module.exports: any; 107 | } 108 | 109 | declare module 'eslint-plugin-jest/rules/__tests__/prefer-to-contain.test' { 110 | declare module.exports: any; 111 | } 112 | 113 | declare module 'eslint-plugin-jest/rules/__tests__/prefer-to-have-length.test' { 114 | declare module.exports: any; 115 | } 116 | 117 | declare module 'eslint-plugin-jest/rules/__tests__/require-tothrow-message.test' { 118 | declare module.exports: any; 119 | } 120 | 121 | declare module 'eslint-plugin-jest/rules/__tests__/valid-describe.test' { 122 | declare module.exports: any; 123 | } 124 | 125 | declare module 'eslint-plugin-jest/rules/__tests__/valid-expect-in-promise.test' { 126 | declare module.exports: any; 127 | } 128 | 129 | declare module 'eslint-plugin-jest/rules/__tests__/valid-expect.test' { 130 | declare module.exports: any; 131 | } 132 | 133 | declare module 'eslint-plugin-jest/rules/consistent-test-it' { 134 | declare module.exports: any; 135 | } 136 | 137 | declare module 'eslint-plugin-jest/rules/expect-expect' { 138 | declare module.exports: any; 139 | } 140 | 141 | declare module 'eslint-plugin-jest/rules/lowercase-name' { 142 | declare module.exports: any; 143 | } 144 | 145 | declare module 'eslint-plugin-jest/rules/no-alias-methods' { 146 | declare module.exports: any; 147 | } 148 | 149 | declare module 'eslint-plugin-jest/rules/no-disabled-tests' { 150 | declare module.exports: any; 151 | } 152 | 153 | declare module 'eslint-plugin-jest/rules/no-focused-tests' { 154 | declare module.exports: any; 155 | } 156 | 157 | declare module 'eslint-plugin-jest/rules/no-hooks' { 158 | declare module.exports: any; 159 | } 160 | 161 | declare module 'eslint-plugin-jest/rules/no-identical-title' { 162 | declare module.exports: any; 163 | } 164 | 165 | declare module 'eslint-plugin-jest/rules/no-jasmine-globals' { 166 | declare module.exports: any; 167 | } 168 | 169 | declare module 'eslint-plugin-jest/rules/no-jest-import' { 170 | declare module.exports: any; 171 | } 172 | 173 | declare module 'eslint-plugin-jest/rules/no-large-snapshots' { 174 | declare module.exports: any; 175 | } 176 | 177 | declare module 'eslint-plugin-jest/rules/no-test-callback' { 178 | declare module.exports: any; 179 | } 180 | 181 | declare module 'eslint-plugin-jest/rules/no-test-prefixes' { 182 | declare module.exports: any; 183 | } 184 | 185 | declare module 'eslint-plugin-jest/rules/no-test-return-statement' { 186 | declare module.exports: any; 187 | } 188 | 189 | declare module 'eslint-plugin-jest/rules/prefer-expect-assertions' { 190 | declare module.exports: any; 191 | } 192 | 193 | declare module 'eslint-plugin-jest/rules/prefer-inline-snapshots' { 194 | declare module.exports: any; 195 | } 196 | 197 | declare module 'eslint-plugin-jest/rules/prefer-strict-equal' { 198 | declare module.exports: any; 199 | } 200 | 201 | declare module 'eslint-plugin-jest/rules/prefer-to-be-null' { 202 | declare module.exports: any; 203 | } 204 | 205 | declare module 'eslint-plugin-jest/rules/prefer-to-be-undefined' { 206 | declare module.exports: any; 207 | } 208 | 209 | declare module 'eslint-plugin-jest/rules/prefer-to-contain' { 210 | declare module.exports: any; 211 | } 212 | 213 | declare module 'eslint-plugin-jest/rules/prefer-to-have-length' { 214 | declare module.exports: any; 215 | } 216 | 217 | declare module 'eslint-plugin-jest/rules/require-tothrow-message' { 218 | declare module.exports: any; 219 | } 220 | 221 | declare module 'eslint-plugin-jest/rules/util' { 222 | declare module.exports: any; 223 | } 224 | 225 | declare module 'eslint-plugin-jest/rules/valid-describe' { 226 | declare module.exports: any; 227 | } 228 | 229 | declare module 'eslint-plugin-jest/rules/valid-expect-in-promise' { 230 | declare module.exports: any; 231 | } 232 | 233 | declare module 'eslint-plugin-jest/rules/valid-expect' { 234 | declare module.exports: any; 235 | } 236 | 237 | // Filename aliases 238 | declare module 'eslint-plugin-jest/index' { 239 | declare module.exports: $Exports<'eslint-plugin-jest'>; 240 | } 241 | declare module 'eslint-plugin-jest/index.js' { 242 | declare module.exports: $Exports<'eslint-plugin-jest'>; 243 | } 244 | declare module 'eslint-plugin-jest/processors/__tests__/snapshot-processor.test.js' { 245 | declare module.exports: $Exports<'eslint-plugin-jest/processors/__tests__/snapshot-processor.test'>; 246 | } 247 | declare module 'eslint-plugin-jest/processors/snapshot-processor.js' { 248 | declare module.exports: $Exports<'eslint-plugin-jest/processors/snapshot-processor'>; 249 | } 250 | declare module 'eslint-plugin-jest/rules/__tests__/consistent-test-it.test.js' { 251 | declare module.exports: $Exports<'eslint-plugin-jest/rules/__tests__/consistent-test-it.test'>; 252 | } 253 | declare module 'eslint-plugin-jest/rules/__tests__/expect-expect.test.js' { 254 | declare module.exports: $Exports<'eslint-plugin-jest/rules/__tests__/expect-expect.test'>; 255 | } 256 | declare module 'eslint-plugin-jest/rules/__tests__/lowercase-name.test.js' { 257 | declare module.exports: $Exports<'eslint-plugin-jest/rules/__tests__/lowercase-name.test'>; 258 | } 259 | declare module 'eslint-plugin-jest/rules/__tests__/no-alias-methods.test.js' { 260 | declare module.exports: $Exports<'eslint-plugin-jest/rules/__tests__/no-alias-methods.test'>; 261 | } 262 | declare module 'eslint-plugin-jest/rules/__tests__/no-disabled-tests.test.js' { 263 | declare module.exports: $Exports<'eslint-plugin-jest/rules/__tests__/no-disabled-tests.test'>; 264 | } 265 | declare module 'eslint-plugin-jest/rules/__tests__/no-focused-tests.test.js' { 266 | declare module.exports: $Exports<'eslint-plugin-jest/rules/__tests__/no-focused-tests.test'>; 267 | } 268 | declare module 'eslint-plugin-jest/rules/__tests__/no-hooks.test.js' { 269 | declare module.exports: $Exports<'eslint-plugin-jest/rules/__tests__/no-hooks.test'>; 270 | } 271 | declare module 'eslint-plugin-jest/rules/__tests__/no-identical-title.test.js' { 272 | declare module.exports: $Exports<'eslint-plugin-jest/rules/__tests__/no-identical-title.test'>; 273 | } 274 | declare module 'eslint-plugin-jest/rules/__tests__/no-jasmine-globals.test.js' { 275 | declare module.exports: $Exports<'eslint-plugin-jest/rules/__tests__/no-jasmine-globals.test'>; 276 | } 277 | declare module 'eslint-plugin-jest/rules/__tests__/no-jest-import.test.js' { 278 | declare module.exports: $Exports<'eslint-plugin-jest/rules/__tests__/no-jest-import.test'>; 279 | } 280 | declare module 'eslint-plugin-jest/rules/__tests__/no-large-snapshots.test.js' { 281 | declare module.exports: $Exports<'eslint-plugin-jest/rules/__tests__/no-large-snapshots.test'>; 282 | } 283 | declare module 'eslint-plugin-jest/rules/__tests__/no-test-callback.test.js' { 284 | declare module.exports: $Exports<'eslint-plugin-jest/rules/__tests__/no-test-callback.test'>; 285 | } 286 | declare module 'eslint-plugin-jest/rules/__tests__/no-test-prefixes.test.js' { 287 | declare module.exports: $Exports<'eslint-plugin-jest/rules/__tests__/no-test-prefixes.test'>; 288 | } 289 | declare module 'eslint-plugin-jest/rules/__tests__/no-test-return-statement.test.js' { 290 | declare module.exports: $Exports<'eslint-plugin-jest/rules/__tests__/no-test-return-statement.test'>; 291 | } 292 | declare module 'eslint-plugin-jest/rules/__tests__/prefer-expect-assertions.test.js' { 293 | declare module.exports: $Exports<'eslint-plugin-jest/rules/__tests__/prefer-expect-assertions.test'>; 294 | } 295 | declare module 'eslint-plugin-jest/rules/__tests__/prefer-inline-snapshots.test.js' { 296 | declare module.exports: $Exports<'eslint-plugin-jest/rules/__tests__/prefer-inline-snapshots.test'>; 297 | } 298 | declare module 'eslint-plugin-jest/rules/__tests__/prefer-strict-equal.test.js' { 299 | declare module.exports: $Exports<'eslint-plugin-jest/rules/__tests__/prefer-strict-equal.test'>; 300 | } 301 | declare module 'eslint-plugin-jest/rules/__tests__/prefer-to-be-null.test.js' { 302 | declare module.exports: $Exports<'eslint-plugin-jest/rules/__tests__/prefer-to-be-null.test'>; 303 | } 304 | declare module 'eslint-plugin-jest/rules/__tests__/prefer-to-be-undefined.test.js' { 305 | declare module.exports: $Exports<'eslint-plugin-jest/rules/__tests__/prefer-to-be-undefined.test'>; 306 | } 307 | declare module 'eslint-plugin-jest/rules/__tests__/prefer-to-contain.test.js' { 308 | declare module.exports: $Exports<'eslint-plugin-jest/rules/__tests__/prefer-to-contain.test'>; 309 | } 310 | declare module 'eslint-plugin-jest/rules/__tests__/prefer-to-have-length.test.js' { 311 | declare module.exports: $Exports<'eslint-plugin-jest/rules/__tests__/prefer-to-have-length.test'>; 312 | } 313 | declare module 'eslint-plugin-jest/rules/__tests__/require-tothrow-message.test.js' { 314 | declare module.exports: $Exports<'eslint-plugin-jest/rules/__tests__/require-tothrow-message.test'>; 315 | } 316 | declare module 'eslint-plugin-jest/rules/__tests__/valid-describe.test.js' { 317 | declare module.exports: $Exports<'eslint-plugin-jest/rules/__tests__/valid-describe.test'>; 318 | } 319 | declare module 'eslint-plugin-jest/rules/__tests__/valid-expect-in-promise.test.js' { 320 | declare module.exports: $Exports<'eslint-plugin-jest/rules/__tests__/valid-expect-in-promise.test'>; 321 | } 322 | declare module 'eslint-plugin-jest/rules/__tests__/valid-expect.test.js' { 323 | declare module.exports: $Exports<'eslint-plugin-jest/rules/__tests__/valid-expect.test'>; 324 | } 325 | declare module 'eslint-plugin-jest/rules/consistent-test-it.js' { 326 | declare module.exports: $Exports<'eslint-plugin-jest/rules/consistent-test-it'>; 327 | } 328 | declare module 'eslint-plugin-jest/rules/expect-expect.js' { 329 | declare module.exports: $Exports<'eslint-plugin-jest/rules/expect-expect'>; 330 | } 331 | declare module 'eslint-plugin-jest/rules/lowercase-name.js' { 332 | declare module.exports: $Exports<'eslint-plugin-jest/rules/lowercase-name'>; 333 | } 334 | declare module 'eslint-plugin-jest/rules/no-alias-methods.js' { 335 | declare module.exports: $Exports<'eslint-plugin-jest/rules/no-alias-methods'>; 336 | } 337 | declare module 'eslint-plugin-jest/rules/no-disabled-tests.js' { 338 | declare module.exports: $Exports<'eslint-plugin-jest/rules/no-disabled-tests'>; 339 | } 340 | declare module 'eslint-plugin-jest/rules/no-focused-tests.js' { 341 | declare module.exports: $Exports<'eslint-plugin-jest/rules/no-focused-tests'>; 342 | } 343 | declare module 'eslint-plugin-jest/rules/no-hooks.js' { 344 | declare module.exports: $Exports<'eslint-plugin-jest/rules/no-hooks'>; 345 | } 346 | declare module 'eslint-plugin-jest/rules/no-identical-title.js' { 347 | declare module.exports: $Exports<'eslint-plugin-jest/rules/no-identical-title'>; 348 | } 349 | declare module 'eslint-plugin-jest/rules/no-jasmine-globals.js' { 350 | declare module.exports: $Exports<'eslint-plugin-jest/rules/no-jasmine-globals'>; 351 | } 352 | declare module 'eslint-plugin-jest/rules/no-jest-import.js' { 353 | declare module.exports: $Exports<'eslint-plugin-jest/rules/no-jest-import'>; 354 | } 355 | declare module 'eslint-plugin-jest/rules/no-large-snapshots.js' { 356 | declare module.exports: $Exports<'eslint-plugin-jest/rules/no-large-snapshots'>; 357 | } 358 | declare module 'eslint-plugin-jest/rules/no-test-callback.js' { 359 | declare module.exports: $Exports<'eslint-plugin-jest/rules/no-test-callback'>; 360 | } 361 | declare module 'eslint-plugin-jest/rules/no-test-prefixes.js' { 362 | declare module.exports: $Exports<'eslint-plugin-jest/rules/no-test-prefixes'>; 363 | } 364 | declare module 'eslint-plugin-jest/rules/no-test-return-statement.js' { 365 | declare module.exports: $Exports<'eslint-plugin-jest/rules/no-test-return-statement'>; 366 | } 367 | declare module 'eslint-plugin-jest/rules/prefer-expect-assertions.js' { 368 | declare module.exports: $Exports<'eslint-plugin-jest/rules/prefer-expect-assertions'>; 369 | } 370 | declare module 'eslint-plugin-jest/rules/prefer-inline-snapshots.js' { 371 | declare module.exports: $Exports<'eslint-plugin-jest/rules/prefer-inline-snapshots'>; 372 | } 373 | declare module 'eslint-plugin-jest/rules/prefer-strict-equal.js' { 374 | declare module.exports: $Exports<'eslint-plugin-jest/rules/prefer-strict-equal'>; 375 | } 376 | declare module 'eslint-plugin-jest/rules/prefer-to-be-null.js' { 377 | declare module.exports: $Exports<'eslint-plugin-jest/rules/prefer-to-be-null'>; 378 | } 379 | declare module 'eslint-plugin-jest/rules/prefer-to-be-undefined.js' { 380 | declare module.exports: $Exports<'eslint-plugin-jest/rules/prefer-to-be-undefined'>; 381 | } 382 | declare module 'eslint-plugin-jest/rules/prefer-to-contain.js' { 383 | declare module.exports: $Exports<'eslint-plugin-jest/rules/prefer-to-contain'>; 384 | } 385 | declare module 'eslint-plugin-jest/rules/prefer-to-have-length.js' { 386 | declare module.exports: $Exports<'eslint-plugin-jest/rules/prefer-to-have-length'>; 387 | } 388 | declare module 'eslint-plugin-jest/rules/require-tothrow-message.js' { 389 | declare module.exports: $Exports<'eslint-plugin-jest/rules/require-tothrow-message'>; 390 | } 391 | declare module 'eslint-plugin-jest/rules/util.js' { 392 | declare module.exports: $Exports<'eslint-plugin-jest/rules/util'>; 393 | } 394 | declare module 'eslint-plugin-jest/rules/valid-describe.js' { 395 | declare module.exports: $Exports<'eslint-plugin-jest/rules/valid-describe'>; 396 | } 397 | declare module 'eslint-plugin-jest/rules/valid-expect-in-promise.js' { 398 | declare module.exports: $Exports<'eslint-plugin-jest/rules/valid-expect-in-promise'>; 399 | } 400 | declare module 'eslint-plugin-jest/rules/valid-expect.js' { 401 | declare module.exports: $Exports<'eslint-plugin-jest/rules/valid-expect'>; 402 | } 403 | -------------------------------------------------------------------------------- /flow-typed/npm/eslint-plugin-flowtype_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: b1f1a60de2e30d97d9db4522d2ca09e2 2 | // flow-typed version: <>/eslint-plugin-flowtype_v^3.1.4/flow_v0.85.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'eslint-plugin-flowtype' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'eslint-plugin-flowtype' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'eslint-plugin-flowtype/dist/bin/addAssertions' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'eslint-plugin-flowtype/dist/bin/checkDocs' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'eslint-plugin-flowtype/dist/bin/checkTests' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'eslint-plugin-flowtype/dist/bin/utilities' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'eslint-plugin-flowtype/dist/index' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'eslint-plugin-flowtype/dist/rules/arrayStyle/index' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'eslint-plugin-flowtype/dist/rules/arrayStyle/isSimpleType' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'eslint-plugin-flowtype/dist/rules/arrayStyle/needWrap' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module 'eslint-plugin-flowtype/dist/rules/arrayStyleComplexType' { 58 | declare module.exports: any; 59 | } 60 | 61 | declare module 'eslint-plugin-flowtype/dist/rules/arrayStyleSimpleType' { 62 | declare module.exports: any; 63 | } 64 | 65 | declare module 'eslint-plugin-flowtype/dist/rules/booleanStyle' { 66 | declare module.exports: any; 67 | } 68 | 69 | declare module 'eslint-plugin-flowtype/dist/rules/defineFlowType' { 70 | declare module.exports: any; 71 | } 72 | 73 | declare module 'eslint-plugin-flowtype/dist/rules/delimiterDangle' { 74 | declare module.exports: any; 75 | } 76 | 77 | declare module 'eslint-plugin-flowtype/dist/rules/genericSpacing' { 78 | declare module.exports: any; 79 | } 80 | 81 | declare module 'eslint-plugin-flowtype/dist/rules/newlineAfterFlowAnnotation' { 82 | declare module.exports: any; 83 | } 84 | 85 | declare module 'eslint-plugin-flowtype/dist/rules/noDupeKeys' { 86 | declare module.exports: any; 87 | } 88 | 89 | declare module 'eslint-plugin-flowtype/dist/rules/noExistentialType' { 90 | declare module.exports: any; 91 | } 92 | 93 | declare module 'eslint-plugin-flowtype/dist/rules/noFlowFixMeComments' { 94 | declare module.exports: any; 95 | } 96 | 97 | declare module 'eslint-plugin-flowtype/dist/rules/noMutableArray' { 98 | declare module.exports: any; 99 | } 100 | 101 | declare module 'eslint-plugin-flowtype/dist/rules/noPrimitiveConstructorTypes' { 102 | declare module.exports: any; 103 | } 104 | 105 | declare module 'eslint-plugin-flowtype/dist/rules/noTypesMissingFileAnnotation' { 106 | declare module.exports: any; 107 | } 108 | 109 | declare module 'eslint-plugin-flowtype/dist/rules/noUnusedExpressions' { 110 | declare module.exports: any; 111 | } 112 | 113 | declare module 'eslint-plugin-flowtype/dist/rules/noWeakTypes' { 114 | declare module.exports: any; 115 | } 116 | 117 | declare module 'eslint-plugin-flowtype/dist/rules/objectTypeDelimiter' { 118 | declare module.exports: any; 119 | } 120 | 121 | declare module 'eslint-plugin-flowtype/dist/rules/requireCompoundTypeAlias' { 122 | declare module.exports: any; 123 | } 124 | 125 | declare module 'eslint-plugin-flowtype/dist/rules/requireExactType' { 126 | declare module.exports: any; 127 | } 128 | 129 | declare module 'eslint-plugin-flowtype/dist/rules/requireParameterType' { 130 | declare module.exports: any; 131 | } 132 | 133 | declare module 'eslint-plugin-flowtype/dist/rules/requireReturnType' { 134 | declare module.exports: any; 135 | } 136 | 137 | declare module 'eslint-plugin-flowtype/dist/rules/requireTypesAtTop' { 138 | declare module.exports: any; 139 | } 140 | 141 | declare module 'eslint-plugin-flowtype/dist/rules/requireValidFileAnnotation' { 142 | declare module.exports: any; 143 | } 144 | 145 | declare module 'eslint-plugin-flowtype/dist/rules/requireVariableType' { 146 | declare module.exports: any; 147 | } 148 | 149 | declare module 'eslint-plugin-flowtype/dist/rules/semi' { 150 | declare module.exports: any; 151 | } 152 | 153 | declare module 'eslint-plugin-flowtype/dist/rules/sortKeys' { 154 | declare module.exports: any; 155 | } 156 | 157 | declare module 'eslint-plugin-flowtype/dist/rules/spaceAfterTypeColon' { 158 | declare module.exports: any; 159 | } 160 | 161 | declare module 'eslint-plugin-flowtype/dist/rules/spaceBeforeGenericBracket' { 162 | declare module.exports: any; 163 | } 164 | 165 | declare module 'eslint-plugin-flowtype/dist/rules/spaceBeforeTypeColon' { 166 | declare module.exports: any; 167 | } 168 | 169 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateFunctions' { 170 | declare module.exports: any; 171 | } 172 | 173 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateObjectTypeIndexer' { 174 | declare module.exports: any; 175 | } 176 | 177 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateObjectTypeProperty' { 178 | declare module.exports: any; 179 | } 180 | 181 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateReturnType' { 182 | declare module.exports: any; 183 | } 184 | 185 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateTypeCastExpression' { 186 | declare module.exports: any; 187 | } 188 | 189 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateTypical' { 190 | declare module.exports: any; 191 | } 192 | 193 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateVariables' { 194 | declare module.exports: any; 195 | } 196 | 197 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/index' { 198 | declare module.exports: any; 199 | } 200 | 201 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/reporter' { 202 | declare module.exports: any; 203 | } 204 | 205 | declare module 'eslint-plugin-flowtype/dist/rules/typeIdMatch' { 206 | declare module.exports: any; 207 | } 208 | 209 | declare module 'eslint-plugin-flowtype/dist/rules/typeImportStyle' { 210 | declare module.exports: any; 211 | } 212 | 213 | declare module 'eslint-plugin-flowtype/dist/rules/unionIntersectionSpacing' { 214 | declare module.exports: any; 215 | } 216 | 217 | declare module 'eslint-plugin-flowtype/dist/rules/useFlowType' { 218 | declare module.exports: any; 219 | } 220 | 221 | declare module 'eslint-plugin-flowtype/dist/rules/validSyntax' { 222 | declare module.exports: any; 223 | } 224 | 225 | declare module 'eslint-plugin-flowtype/dist/utilities/checkFlowFileAnnotation' { 226 | declare module.exports: any; 227 | } 228 | 229 | declare module 'eslint-plugin-flowtype/dist/utilities/fuzzyStringMatch' { 230 | declare module.exports: any; 231 | } 232 | 233 | declare module 'eslint-plugin-flowtype/dist/utilities/getParameterName' { 234 | declare module.exports: any; 235 | } 236 | 237 | declare module 'eslint-plugin-flowtype/dist/utilities/getTokenAfterParens' { 238 | declare module.exports: any; 239 | } 240 | 241 | declare module 'eslint-plugin-flowtype/dist/utilities/getTokenBeforeParens' { 242 | declare module.exports: any; 243 | } 244 | 245 | declare module 'eslint-plugin-flowtype/dist/utilities/index' { 246 | declare module.exports: any; 247 | } 248 | 249 | declare module 'eslint-plugin-flowtype/dist/utilities/isFlowFile' { 250 | declare module.exports: any; 251 | } 252 | 253 | declare module 'eslint-plugin-flowtype/dist/utilities/isFlowFileAnnotation' { 254 | declare module.exports: any; 255 | } 256 | 257 | declare module 'eslint-plugin-flowtype/dist/utilities/iterateFunctionNodes' { 258 | declare module.exports: any; 259 | } 260 | 261 | declare module 'eslint-plugin-flowtype/dist/utilities/quoteName' { 262 | declare module.exports: any; 263 | } 264 | 265 | declare module 'eslint-plugin-flowtype/dist/utilities/spacingFixers' { 266 | declare module.exports: any; 267 | } 268 | 269 | // Filename aliases 270 | declare module 'eslint-plugin-flowtype/dist/bin/addAssertions.js' { 271 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/bin/addAssertions'>; 272 | } 273 | declare module 'eslint-plugin-flowtype/dist/bin/checkDocs.js' { 274 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/bin/checkDocs'>; 275 | } 276 | declare module 'eslint-plugin-flowtype/dist/bin/checkTests.js' { 277 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/bin/checkTests'>; 278 | } 279 | declare module 'eslint-plugin-flowtype/dist/bin/utilities.js' { 280 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/bin/utilities'>; 281 | } 282 | declare module 'eslint-plugin-flowtype/dist/index.js' { 283 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/index'>; 284 | } 285 | declare module 'eslint-plugin-flowtype/dist/rules/arrayStyle/index.js' { 286 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/arrayStyle/index'>; 287 | } 288 | declare module 'eslint-plugin-flowtype/dist/rules/arrayStyle/isSimpleType.js' { 289 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/arrayStyle/isSimpleType'>; 290 | } 291 | declare module 'eslint-plugin-flowtype/dist/rules/arrayStyle/needWrap.js' { 292 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/arrayStyle/needWrap'>; 293 | } 294 | declare module 'eslint-plugin-flowtype/dist/rules/arrayStyleComplexType.js' { 295 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/arrayStyleComplexType'>; 296 | } 297 | declare module 'eslint-plugin-flowtype/dist/rules/arrayStyleSimpleType.js' { 298 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/arrayStyleSimpleType'>; 299 | } 300 | declare module 'eslint-plugin-flowtype/dist/rules/booleanStyle.js' { 301 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/booleanStyle'>; 302 | } 303 | declare module 'eslint-plugin-flowtype/dist/rules/defineFlowType.js' { 304 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/defineFlowType'>; 305 | } 306 | declare module 'eslint-plugin-flowtype/dist/rules/delimiterDangle.js' { 307 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/delimiterDangle'>; 308 | } 309 | declare module 'eslint-plugin-flowtype/dist/rules/genericSpacing.js' { 310 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/genericSpacing'>; 311 | } 312 | declare module 'eslint-plugin-flowtype/dist/rules/newlineAfterFlowAnnotation.js' { 313 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/newlineAfterFlowAnnotation'>; 314 | } 315 | declare module 'eslint-plugin-flowtype/dist/rules/noDupeKeys.js' { 316 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/noDupeKeys'>; 317 | } 318 | declare module 'eslint-plugin-flowtype/dist/rules/noExistentialType.js' { 319 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/noExistentialType'>; 320 | } 321 | declare module 'eslint-plugin-flowtype/dist/rules/noFlowFixMeComments.js' { 322 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/noFlowFixMeComments'>; 323 | } 324 | declare module 'eslint-plugin-flowtype/dist/rules/noMutableArray.js' { 325 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/noMutableArray'>; 326 | } 327 | declare module 'eslint-plugin-flowtype/dist/rules/noPrimitiveConstructorTypes.js' { 328 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/noPrimitiveConstructorTypes'>; 329 | } 330 | declare module 'eslint-plugin-flowtype/dist/rules/noTypesMissingFileAnnotation.js' { 331 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/noTypesMissingFileAnnotation'>; 332 | } 333 | declare module 'eslint-plugin-flowtype/dist/rules/noUnusedExpressions.js' { 334 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/noUnusedExpressions'>; 335 | } 336 | declare module 'eslint-plugin-flowtype/dist/rules/noWeakTypes.js' { 337 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/noWeakTypes'>; 338 | } 339 | declare module 'eslint-plugin-flowtype/dist/rules/objectTypeDelimiter.js' { 340 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/objectTypeDelimiter'>; 341 | } 342 | declare module 'eslint-plugin-flowtype/dist/rules/requireCompoundTypeAlias.js' { 343 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/requireCompoundTypeAlias'>; 344 | } 345 | declare module 'eslint-plugin-flowtype/dist/rules/requireExactType.js' { 346 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/requireExactType'>; 347 | } 348 | declare module 'eslint-plugin-flowtype/dist/rules/requireParameterType.js' { 349 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/requireParameterType'>; 350 | } 351 | declare module 'eslint-plugin-flowtype/dist/rules/requireReturnType.js' { 352 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/requireReturnType'>; 353 | } 354 | declare module 'eslint-plugin-flowtype/dist/rules/requireTypesAtTop.js' { 355 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/requireTypesAtTop'>; 356 | } 357 | declare module 'eslint-plugin-flowtype/dist/rules/requireValidFileAnnotation.js' { 358 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/requireValidFileAnnotation'>; 359 | } 360 | declare module 'eslint-plugin-flowtype/dist/rules/requireVariableType.js' { 361 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/requireVariableType'>; 362 | } 363 | declare module 'eslint-plugin-flowtype/dist/rules/semi.js' { 364 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/semi'>; 365 | } 366 | declare module 'eslint-plugin-flowtype/dist/rules/sortKeys.js' { 367 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/sortKeys'>; 368 | } 369 | declare module 'eslint-plugin-flowtype/dist/rules/spaceAfterTypeColon.js' { 370 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/spaceAfterTypeColon'>; 371 | } 372 | declare module 'eslint-plugin-flowtype/dist/rules/spaceBeforeGenericBracket.js' { 373 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/spaceBeforeGenericBracket'>; 374 | } 375 | declare module 'eslint-plugin-flowtype/dist/rules/spaceBeforeTypeColon.js' { 376 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/spaceBeforeTypeColon'>; 377 | } 378 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateFunctions.js' { 379 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateFunctions'>; 380 | } 381 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateObjectTypeIndexer.js' { 382 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateObjectTypeIndexer'>; 383 | } 384 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateObjectTypeProperty.js' { 385 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateObjectTypeProperty'>; 386 | } 387 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateReturnType.js' { 388 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateReturnType'>; 389 | } 390 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateTypeCastExpression.js' { 391 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateTypeCastExpression'>; 392 | } 393 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateTypical.js' { 394 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateTypical'>; 395 | } 396 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateVariables.js' { 397 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/typeColonSpacing/evaluateVariables'>; 398 | } 399 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/index.js' { 400 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/typeColonSpacing/index'>; 401 | } 402 | declare module 'eslint-plugin-flowtype/dist/rules/typeColonSpacing/reporter.js' { 403 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/typeColonSpacing/reporter'>; 404 | } 405 | declare module 'eslint-plugin-flowtype/dist/rules/typeIdMatch.js' { 406 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/typeIdMatch'>; 407 | } 408 | declare module 'eslint-plugin-flowtype/dist/rules/typeImportStyle.js' { 409 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/typeImportStyle'>; 410 | } 411 | declare module 'eslint-plugin-flowtype/dist/rules/unionIntersectionSpacing.js' { 412 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/unionIntersectionSpacing'>; 413 | } 414 | declare module 'eslint-plugin-flowtype/dist/rules/useFlowType.js' { 415 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/useFlowType'>; 416 | } 417 | declare module 'eslint-plugin-flowtype/dist/rules/validSyntax.js' { 418 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/rules/validSyntax'>; 419 | } 420 | declare module 'eslint-plugin-flowtype/dist/utilities/checkFlowFileAnnotation.js' { 421 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/checkFlowFileAnnotation'>; 422 | } 423 | declare module 'eslint-plugin-flowtype/dist/utilities/fuzzyStringMatch.js' { 424 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/fuzzyStringMatch'>; 425 | } 426 | declare module 'eslint-plugin-flowtype/dist/utilities/getParameterName.js' { 427 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/getParameterName'>; 428 | } 429 | declare module 'eslint-plugin-flowtype/dist/utilities/getTokenAfterParens.js' { 430 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/getTokenAfterParens'>; 431 | } 432 | declare module 'eslint-plugin-flowtype/dist/utilities/getTokenBeforeParens.js' { 433 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/getTokenBeforeParens'>; 434 | } 435 | declare module 'eslint-plugin-flowtype/dist/utilities/index.js' { 436 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/index'>; 437 | } 438 | declare module 'eslint-plugin-flowtype/dist/utilities/isFlowFile.js' { 439 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/isFlowFile'>; 440 | } 441 | declare module 'eslint-plugin-flowtype/dist/utilities/isFlowFileAnnotation.js' { 442 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/isFlowFileAnnotation'>; 443 | } 444 | declare module 'eslint-plugin-flowtype/dist/utilities/iterateFunctionNodes.js' { 445 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/iterateFunctionNodes'>; 446 | } 447 | declare module 'eslint-plugin-flowtype/dist/utilities/quoteName.js' { 448 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/quoteName'>; 449 | } 450 | declare module 'eslint-plugin-flowtype/dist/utilities/spacingFixers.js' { 451 | declare module.exports: $Exports<'eslint-plugin-flowtype/dist/utilities/spacingFixers'>; 452 | } 453 | --------------------------------------------------------------------------------