From e4b7229ea55474803075f05f2a6162a84e8812a8 Mon Sep 17 00:00:00 2001 From: Ardo Kusuma Date: Sat, 28 Jul 2018 18:59:21 -0700 Subject: [PATCH 01/12] chore: export flow type --- .npmignore | 11 +++++- package.json | 1 + rollup.config.js | 3 ++ scripts/prepublish-flow.js | 46 ++++++++++++++++++++++++ scripts/prepublish.sh | 1 + scripts/rollup-plugin-flow-entry.js | 55 +++++++++++++++++++++++++++++ src/components/checkbox/index.js | 3 ++ src/components/input/index.js | 3 ++ src/components/popover/index.js | 3 ++ src/components/tooltip/index.js | 3 ++ src/helpers/overrides.js | 11 +++--- 11 files changed, 134 insertions(+), 6 deletions(-) create mode 100644 scripts/prepublish-flow.js create mode 100644 scripts/rollup-plugin-flow-entry.js diff --git a/.npmignore b/.npmignore index cdecc52010..71e1b66ecd 100644 --- a/.npmignore +++ b/.npmignore @@ -6,7 +6,6 @@ flow-typed node_modules rfcs scripts -src commitlint.config.js docker-compose.yml @@ -15,3 +14,13 @@ jest-e2e.config.js jest.config.js rollup.config_e2e.js rollup.config.js + +# The parts below are due to flow type +*.test.js +*.setup.js +*.stories.js +stories.js +*.test.js.snap +test +__mocks__ +e2e.js diff --git a/package.json b/package.json index 00815f428a..01ab877950 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ }, "scripts": { "lint": "eslint ./", + "flow": "flow --show-all-errors", "commitmsg": "commitlint -e $GIT_PARAMS", "test": "yarn lint && yarn unit-test", "storybook": "start-storybook -p 6006", diff --git a/rollup.config.js b/rollup.config.js index 41d7b9c6e4..626f2c1f30 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -9,6 +9,8 @@ import commonjs from 'rollup-plugin-commonjs'; import fs from 'fs'; import path from 'path'; +import uberFlowEntry from './scripts/rollup-plugin-flow-entry'; + function getComponents() { return fs.readdirSync('./src/components').filter(filename => { const {ext, name} = path.parse(filename); @@ -70,6 +72,7 @@ function getSharedConfig({filePath, name}) { 'node_modules/create-react-context/index.js': ['createReactContext'], }, }), + uberFlowEntry(), ], }; } diff --git a/scripts/prepublish-flow.js b/scripts/prepublish-flow.js new file mode 100644 index 0000000000..eb7b23a045 --- /dev/null +++ b/scripts/prepublish-flow.js @@ -0,0 +1,46 @@ +/* eslint-disable flowtype/require-valid-file-annotation */ +const path = require('path'); +const fs = require('fs'); + +function getNewFileContent(fileContent) { + /* + Since we're going to copy `dist` dictionary into root in our publish step, + we will need to remove one level of the path. + Hence, instead of `../src` and `../../src`, they will become `./src` and `../src` respectively. + */ + + // Remove one level if exists (check for `../`) + const regex = new RegExp(/\.\.\//, 'g'); + const matched = fileContent.match(regex); + if (matched.length > 0) { + // Check whether it's only one `..` + if (matched.length === 1) { + // Only 1, replace it with `./` + fileContent = fileContent.replace('../', './'); + } else { + // Must be more than 1 + fileContent = fileContent.replace('../', ''); + } + } + return fileContent; +} + +function fromDir(startPath, filter) { + if (!fs.existsSync(startPath)) { + return; + } + const files = fs.readdirSync(startPath); + for (let i = 0; i < files.length; i++) { + const filename = path.join(startPath, files[i]); + const stat = fs.lstatSync(filename); + if (stat.isDirectory()) { + fromDir(filename, filter); // recurse + } else if (filename.indexOf(filter) >= 0) { + const contents = fs.readFileSync(filename, 'utf8'); + const newFileContent = getNewFileContent(contents); + fs.writeFileSync(filename, newFileContent); + } + } +} + +fromDir(`${__dirname}/../dist`, '.js.flow'); diff --git a/scripts/prepublish.sh b/scripts/prepublish.sh index bdada9ee4e..60c029bbd5 100755 --- a/scripts/prepublish.sh +++ b/scripts/prepublish.sh @@ -6,4 +6,5 @@ fi; # When Buildkite publishes to npm, the published files are available in the root # directory, which allows for a clean include or require of sub-modules. yarn build +node ./scripts/prepublish-flow.js cp -r ./dist/* ./ diff --git a/scripts/rollup-plugin-flow-entry.js b/scripts/rollup-plugin-flow-entry.js new file mode 100644 index 0000000000..a692c0e4e1 --- /dev/null +++ b/scripts/rollup-plugin-flow-entry.js @@ -0,0 +1,55 @@ +/* eslint-disable flowtype/require-valid-file-annotation */ +import fs from 'fs'; +import path from 'path'; + +/* +We can consider this as well: +https://github.com/RichieAHB/rollup-plugin-flow-defs/blob/master/src/index.js + +This code is inspired by that npm package anyway. + */ + +function getFlowFileContent(filePath) { + return `// @flow +export * from '${filePath}';`; +} + +export default function uberFlowEntry() { + let input; + return { + name: '@uber/rollup-plugin-flow-entry', + options(opts) { + input = opts.input; + }, + async generateBundle(opts) { + const {file = ''} = opts || {}; + + // Create file path if does not exist + await new Promise(resolve => { + const dirname = path.dirname(file); + if (!fs.existsSync(dirname)) { + fs.mkdirSync(dirname); + } + resolve('ok'); + }); + + await new Promise((resolve, reject) => { + /* + path.dirname(input); // src/components/popover + path.basename(input); // index.js + path.dirname(file); // this is output, `dist/popover` + */ + const relativePath = path.join( + path.relative(path.dirname(file), path.dirname(input)), + path.basename(input), + ); + fs.writeFile(`${file}.flow`, getFlowFileContent(relativePath), err => { + if (err) { + reject(err); + } + resolve('ok'); + }); + }); + }, + }; +} diff --git a/src/components/checkbox/index.js b/src/components/checkbox/index.js index e240b743f4..071506732d 100644 --- a/src/components/checkbox/index.js +++ b/src/components/checkbox/index.js @@ -10,3 +10,6 @@ export { Label as StyledLabel, Input as StyledInput, } from './styled-components'; + +// Flow +export * from './types'; diff --git a/src/components/input/index.js b/src/components/input/index.js index 8f593e8b67..a1b439d794 100644 --- a/src/components/input/index.js +++ b/src/components/input/index.js @@ -13,3 +13,6 @@ export { Caption as StyledCaption, } from './styled-components'; export {STATE_CHANGE_TYPE, ADJOINED, SIZE} from './constants'; + +// Flow +export * from './types'; diff --git a/src/components/popover/index.js b/src/components/popover/index.js index f32311034a..ca53bd5b56 100644 --- a/src/components/popover/index.js +++ b/src/components/popover/index.js @@ -16,3 +16,6 @@ export { Inner as StyledInner, Padding as StyledPadding, } from './styled-components'; + +// Flow +export * from './types'; diff --git a/src/components/tooltip/index.js b/src/components/tooltip/index.js index a9234188e1..f4a56fe888 100644 --- a/src/components/tooltip/index.js +++ b/src/components/tooltip/index.js @@ -15,3 +15,6 @@ export { Body as StyledBody, Inner as StyledInner, } from './styled-components'; + +// Flow +export * from './types'; diff --git a/src/helpers/overrides.js b/src/helpers/overrides.js index 112cf20d39..b8f3d2175d 100644 --- a/src/helpers/overrides.js +++ b/src/helpers/overrides.js @@ -1,12 +1,13 @@ // @flow +import type {ComponentType} from 'react'; export type OverrideT = | { - component?: ?React.ComponentType, + component?: ?ComponentType, props?: ?{}, style?: ?{}, } - | React.ComponentType; + | ComponentType; export type OverridesT = { [string]: OverrideT<*>, @@ -14,8 +15,8 @@ export type OverridesT = { export function getComponent( override: ?OverrideT, - defaultComponent: React.ComponentType, -): React.ComponentType { + defaultComponent: ComponentType, +): ComponentType { if (override && typeof override === 'object') { return override.component || defaultComponent; } @@ -41,7 +42,7 @@ export function getOverrideProps(override: ?OverrideT) { export function toObjectOverride(override: OverrideT): OverrideT { if (typeof override === 'function') { return { - component: (override: React.ComponentType), + component: (override: ComponentType), }; } return override; From 3dd9d65290b2065b8ddc52e650cff9d228f549b2 Mon Sep 17 00:00:00 2001 From: Ardo Kusuma Date: Sat, 28 Jul 2018 23:51:22 -0700 Subject: [PATCH 02/12] chore: simply flow export --- .npmignore | 2 +- package.json | 2 +- scripts/prepublish-flow.js | 46 ----------------------------- scripts/prepublish.sh | 1 - scripts/rollup-plugin-flow-entry.js | 13 ++++++++ src/helpers/overrides.js | 12 ++++---- 6 files changed, 21 insertions(+), 55 deletions(-) delete mode 100644 scripts/prepublish-flow.js diff --git a/.npmignore b/.npmignore index 71e1b66ecd..816f20cca8 100644 --- a/.npmignore +++ b/.npmignore @@ -2,10 +2,10 @@ coverage dist e2e -flow-typed node_modules rfcs scripts +flow-typed commitlint.config.js docker-compose.yml diff --git a/package.json b/package.json index 01ab877950..99e2dba2f6 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "storybook": "start-storybook -p 6006", "build-storybook": "build-storybook -o docs", "precommit": "pretty-quick --staged && yarn run test", - "build": "rollup -c rollup.config.js", + "build": "rm -rf dist && rollup -c rollup.config.js", "unit-test": "yarn jest --coverage", "e2e": "node ./e2e/e2e.js", "build-e2e": "rollup -c rollup.config_e2e.js", diff --git a/scripts/prepublish-flow.js b/scripts/prepublish-flow.js deleted file mode 100644 index eb7b23a045..0000000000 --- a/scripts/prepublish-flow.js +++ /dev/null @@ -1,46 +0,0 @@ -/* eslint-disable flowtype/require-valid-file-annotation */ -const path = require('path'); -const fs = require('fs'); - -function getNewFileContent(fileContent) { - /* - Since we're going to copy `dist` dictionary into root in our publish step, - we will need to remove one level of the path. - Hence, instead of `../src` and `../../src`, they will become `./src` and `../src` respectively. - */ - - // Remove one level if exists (check for `../`) - const regex = new RegExp(/\.\.\//, 'g'); - const matched = fileContent.match(regex); - if (matched.length > 0) { - // Check whether it's only one `..` - if (matched.length === 1) { - // Only 1, replace it with `./` - fileContent = fileContent.replace('../', './'); - } else { - // Must be more than 1 - fileContent = fileContent.replace('../', ''); - } - } - return fileContent; -} - -function fromDir(startPath, filter) { - if (!fs.existsSync(startPath)) { - return; - } - const files = fs.readdirSync(startPath); - for (let i = 0; i < files.length; i++) { - const filename = path.join(startPath, files[i]); - const stat = fs.lstatSync(filename); - if (stat.isDirectory()) { - fromDir(filename, filter); // recurse - } else if (filename.indexOf(filter) >= 0) { - const contents = fs.readFileSync(filename, 'utf8'); - const newFileContent = getNewFileContent(contents); - fs.writeFileSync(filename, newFileContent); - } - } -} - -fromDir(`${__dirname}/../dist`, '.js.flow'); diff --git a/scripts/prepublish.sh b/scripts/prepublish.sh index 60c029bbd5..bdada9ee4e 100755 --- a/scripts/prepublish.sh +++ b/scripts/prepublish.sh @@ -6,5 +6,4 @@ fi; # When Buildkite publishes to npm, the published files are available in the root # directory, which allows for a clean include or require of sub-modules. yarn build -node ./scripts/prepublish-flow.js cp -r ./dist/* ./ diff --git a/scripts/rollup-plugin-flow-entry.js b/scripts/rollup-plugin-flow-entry.js index a692c0e4e1..7c6a24cef3 100644 --- a/scripts/rollup-plugin-flow-entry.js +++ b/scripts/rollup-plugin-flow-entry.js @@ -10,7 +10,20 @@ This code is inspired by that npm package anyway. */ function getFlowFileContent(filePath) { + const regex = new RegExp(/\.\.\//, 'g'); + const matched = filePath.match(regex); + if (matched.length > 0) { + // Check whether it's only one `..` + if (matched.length === 1) { + // Only 1, replace it with `./` + filePath = filePath.replace('../', './'); + } else { + // Must be more than 1 + filePath = filePath.replace('../', ''); + } + } return `// @flow +// $FlowFixMe path is assuming that it's already in root directory export * from '${filePath}';`; } diff --git a/src/helpers/overrides.js b/src/helpers/overrides.js index b8f3d2175d..63318f108d 100644 --- a/src/helpers/overrides.js +++ b/src/helpers/overrides.js @@ -1,13 +1,13 @@ // @flow -import type {ComponentType} from 'react'; +import * as React from 'react'; export type OverrideT = | { - component?: ?ComponentType, + component?: ?React.ComponentType, props?: ?{}, style?: ?{}, } - | ComponentType; + | React.ComponentType; export type OverridesT = { [string]: OverrideT<*>, @@ -15,8 +15,8 @@ export type OverridesT = { export function getComponent( override: ?OverrideT, - defaultComponent: ComponentType, -): ComponentType { + defaultComponent: React.ComponentType, +): React.ComponentType { if (override && typeof override === 'object') { return override.component || defaultComponent; } @@ -42,7 +42,7 @@ export function getOverrideProps(override: ?OverrideT) { export function toObjectOverride(override: OverrideT): OverrideT { if (typeof override === 'function') { return { - component: (override: ComponentType), + component: (override: React.ComponentType), }; } return override; From f6dc491c898f0b6fb63c8b8a6d32568c8a081f86 Mon Sep 17 00:00:00 2001 From: Ardo Kusuma Date: Sat, 28 Jul 2018 23:54:00 -0700 Subject: [PATCH 03/12] chore: add comment --- scripts/rollup-plugin-flow-entry.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/rollup-plugin-flow-entry.js b/scripts/rollup-plugin-flow-entry.js index 7c6a24cef3..253e42a095 100644 --- a/scripts/rollup-plugin-flow-entry.js +++ b/scripts/rollup-plugin-flow-entry.js @@ -10,6 +10,11 @@ This code is inspired by that npm package anyway. */ function getFlowFileContent(filePath) { + /* + Since we're going to copy `dist` dictionary into root in our publish step, + we will need to remove one level of the path. + Hence, instead of `../src` and `../../src`, they will become `./src` and `../src` respectively. + */ const regex = new RegExp(/\.\.\//, 'g'); const matched = filePath.match(regex); if (matched.length > 0) { From 6f9e24f7cff4e22889add812f9f55eb7bc018719 Mon Sep 17 00:00:00 2001 From: Ardo Kusuma Date: Mon, 30 Jul 2018 11:24:34 -0700 Subject: [PATCH 04/12] chore: use .js.flow files --- .npmignore | 11 +- package.json | 12 +- rollup.config.js | 5 +- scripts/flow-copy-src.js | 19 ++ scripts/rollup-plugin-flow-entry.js | 4 +- yarn.lock | 373 +++++++++++++++++++++------- 6 files changed, 312 insertions(+), 112 deletions(-) create mode 100644 scripts/flow-copy-src.js diff --git a/.npmignore b/.npmignore index 816f20cca8..c29e951abe 100644 --- a/.npmignore +++ b/.npmignore @@ -6,6 +6,7 @@ node_modules rfcs scripts flow-typed +/src commitlint.config.js docker-compose.yml @@ -14,13 +15,3 @@ jest-e2e.config.js jest.config.js rollup.config_e2e.js rollup.config.js - -# The parts below are due to flow type -*.test.js -*.setup.js -*.stories.js -stories.js -*.test.js.snap -test -__mocks__ -e2e.js diff --git a/package.json b/package.json index 99e2dba2f6..790cd7a57d 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,8 @@ "storybook": "start-storybook -p 6006", "build-storybook": "build-storybook -o docs", "precommit": "pretty-quick --staged && yarn run test", - "build": "rm -rf dist && rollup -c rollup.config.js", + "build": + "rm -rf dist && rollup -c rollup.config.js && node ./scripts/flow-copy-src.js", "unit-test": "yarn jest --coverage", "e2e": "node ./e2e/e2e.js", "build-e2e": "rollup -c rollup.config_e2e.js", @@ -68,6 +69,7 @@ "eslint-plugin-prettier": "^2.6.1", "eslint-plugin-react": "^7.10.0", "flow-bin": "^0.75.0", + "flow-copy-source": "^2.0.2", "geckodriver": "^1.11.0", "husky": "^0.14.3", "jest": "^23.3.0", @@ -76,15 +78,15 @@ "pretty-quick": "^1.4.1", "react": "^16.4.0", "react-dom": "^16.4.0", - "rollup": "^0.57.1", - "rollup-plugin-babel": "^3.0.3", + "rollup": "^0.63.4", + "rollup-plugin-babel": "^3.0.7", "rollup-plugin-commonjs": "^9.1.3", - "rollup-plugin-filesize": "^1.5.0", + "rollup-plugin-filesize": "^4.0.1", "rollup-plugin-json": "^3.0.0", "rollup-plugin-node-resolve": "^3.3.0", "rollup-plugin-progress": "^0.4.0", "rollup-plugin-replace": "^2.0.0", - "rollup-plugin-visualizer": "^0.4.0", + "rollup-plugin-visualizer": "^0.8.0", "selenium-webdriver": "^4.0.0-alpha.1", "serve-static": "^1.13.2", "storybook-readme": "^3.3.0", diff --git a/rollup.config.js b/rollup.config.js index 626f2c1f30..c9edc980aa 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -9,7 +9,7 @@ import commonjs from 'rollup-plugin-commonjs'; import fs from 'fs'; import path from 'path'; -import uberFlowEntry from './scripts/rollup-plugin-flow-entry'; +import flowEntry from './scripts/rollup-plugin-flow-entry'; function getComponents() { return fs.readdirSync('./src/components').filter(filename => { @@ -72,7 +72,8 @@ function getSharedConfig({filePath, name}) { 'node_modules/create-react-context/index.js': ['createReactContext'], }, }), - uberFlowEntry(), + flowEntry(), + // flowCopySrc(), ], }; } diff --git a/scripts/flow-copy-src.js b/scripts/flow-copy-src.js new file mode 100644 index 0000000000..bbaa27fffb --- /dev/null +++ b/scripts/flow-copy-src.js @@ -0,0 +1,19 @@ +/* eslint-disable flowtype/require-valid-file-annotation */ +const flowCopySource = require('flow-copy-source'); + +async function run() { + await flowCopySource([`${__dirname}/../src`], `${__dirname}/../dist/src`, { + ignore: [ + '**/*.test.js', + '**/*.setup.js', + '**/*stories.js', + 'test/**/*.js', + '**/__mocks__/*.js', + '**/e2e.js', + 'coverage/**/*.js', + '**/*examples.js', + ], + }); +} + +run(); diff --git a/scripts/rollup-plugin-flow-entry.js b/scripts/rollup-plugin-flow-entry.js index 253e42a095..011fe5b695 100644 --- a/scripts/rollup-plugin-flow-entry.js +++ b/scripts/rollup-plugin-flow-entry.js @@ -32,10 +32,10 @@ function getFlowFileContent(filePath) { export * from '${filePath}';`; } -export default function uberFlowEntry() { +export default function flowEntry() { let input; return { - name: '@uber/rollup-plugin-flow-entry', + name: 'rollup-plugin-flow-entry', options(opts) { input = opts.input; }, diff --git a/yarn.lock b/yarn.lock index fbec43e0fe..0702029dca 100644 --- a/yarn.lock +++ b/yarn.lock @@ -459,19 +459,9 @@ react-split-pane "^0.1.77" react-treebeard "^2.1.0" -"@types/acorn@^4.0.3": - version "4.0.3" - resolved "https://registry.yarnpkg.com/@types/acorn/-/acorn-4.0.3.tgz#d1f3e738dde52536f9aad3d3380d14e448820afd" - dependencies: - "@types/estree" "*" - -"@types/estree@*": +"@types/estree@0.0.39": version "0.0.39" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" - -"@types/estree@0.0.38": - version "0.0.38" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.38.tgz#c1be40aa933723c608820a99a373a16d215a1ca2" + resolved "https://unpm.uberinternal.com/@types%2festree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" "@types/node@*": version "10.5.2" @@ -505,12 +495,6 @@ acorn-dynamic-import@^2.0.0: dependencies: acorn "^4.0.3" -acorn-dynamic-import@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/acorn-dynamic-import/-/acorn-dynamic-import-3.0.0.tgz#901ceee4c7faaef7e07ad2a47e890675da50a278" - dependencies: - acorn "^5.0.0" - acorn-globals@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-4.1.0.tgz#ab716025dbe17c54d3ef81d32ece2b2d99fe2538" @@ -527,7 +511,7 @@ acorn@^4.0.3: version "4.0.13" resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787" -acorn@^5.0.0, acorn@^5.0.3, acorn@^5.3.0, acorn@^5.5.3, acorn@^5.6.0: +acorn@^5.0.0, acorn@^5.0.3, acorn@^5.3.0, acorn@^5.6.0: version "5.7.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.1.tgz#f095829297706a7c9776958c0afc8930a9b9d9d8" @@ -1932,6 +1916,13 @@ binary-extensions@^1.0.0: version "1.11.0" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.11.0.tgz#46aa1751fb6a2f93ee5e689bb1087d4b14c6c205" +bl@^1.0.0: + version "1.2.2" + resolved "https://unpm.uberinternal.com/bl/-/bl-1.2.2.tgz#a160911717103c07410cef63ef51b397c025af9c" + dependencies: + readable-stream "^2.3.5" + safe-buffer "^5.1.1" + bluebird@3.4.6: version "3.4.6" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.4.6.tgz#01da8d821d87813d158967e743d5fe6c62cf8c0f" @@ -2017,6 +2008,13 @@ brorand@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" +brotli-size@0.0.2: + version "0.0.2" + resolved "https://unpm.uberinternal.com/brotli-size/-/brotli-size-0.0.2.tgz#5a0bf4282201c9fb78afb414182e50f53bcc5e1b" + dependencies: + duplexer "^0.1.1" + iltorb "^2.0.5" + browser-process-hrtime@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-0.1.2.tgz#425d68a58d3447f02a04aa894187fce8af8b7b8e" @@ -2107,6 +2105,21 @@ bser@^2.0.0: dependencies: node-int64 "^0.4.0" +buffer-alloc-unsafe@^1.1.0: + version "1.1.0" + resolved "https://unpm.uberinternal.com/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz#bd7dc26ae2972d0eda253be061dba992349c19f0" + +buffer-alloc@^1.1.0: + version "1.2.0" + resolved "https://unpm.uberinternal.com/buffer-alloc/-/buffer-alloc-1.2.0.tgz#890dd90d923a873e08e10e5fd51a57e5b7cce0ec" + dependencies: + buffer-alloc-unsafe "^1.1.0" + buffer-fill "^1.0.0" + +buffer-fill@^1.0.0: + version "1.0.0" + resolved "https://unpm.uberinternal.com/buffer-fill/-/buffer-fill-1.0.0.tgz#f8f78b76789888ef39f205cd637f68e702122b2c" + buffer-from@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.0.tgz#87fcaa3a298358e0ade6e442cfce840740d1ad04" @@ -2306,7 +2319,7 @@ chokidar@^1.6.1: optionalDependencies: fsevents "^1.0.0" -chokidar@^2.0.2: +chokidar@^2.0.0, chokidar@^2.0.2: version "2.0.4" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.0.4.tgz#356ff4e2b0e8e43e322d18a372460bbcf3accd26" dependencies: @@ -2898,12 +2911,6 @@ date-now@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b" -date-time@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/date-time/-/date-time-2.1.0.tgz#0286d1b4c769633b3ca13e1e62558d2dbdc2eba2" - dependencies: - time-zone "^1.0.0" - debug@2.6.9, debug@^2.1.2, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.6, debug@^2.6.8, debug@^2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" @@ -2927,10 +2934,22 @@ decamelize@^1.0.0, decamelize@^1.1.0, decamelize@^1.1.1, decamelize@^1.1.2: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" +decamelize@^2.0.0: + version "2.0.0" + resolved "https://unpm.uberinternal.com/decamelize/-/decamelize-2.0.0.tgz#656d7bbc8094c4c788ea53c5840908c9c7d063c7" + dependencies: + xregexp "4.0.0" + decode-uri-component@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" +decompress-response@^3.3.0: + version "3.3.0" + resolved "https://unpm.uberinternal.com/decompress-response/-/decompress-response-3.3.0.tgz#80a4dd323748384bfa248083622aedec982adff3" + dependencies: + mimic-response "^1.0.0" + deep-assign@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/deep-assign/-/deep-assign-2.0.0.tgz#ebe06b1f07f08dae597620e3dd1622f371a1c572" @@ -3051,7 +3070,7 @@ detect-indent@^4.0.0: dependencies: repeating "^2.0.0" -detect-libc@^1.0.2: +detect-libc@^1.0.2, detect-libc@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" @@ -3762,6 +3781,10 @@ expand-range@^1.8.1: dependencies: fill-range "^2.1.0" +expand-template@^1.0.2: + version "1.1.1" + resolved "https://unpm.uberinternal.com/expand-template/-/expand-template-1.1.1.tgz#981f188c0c3a87d2e28f559bc541426ff94f21dd" + expand-tilde@^2.0.0, expand-tilde@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/expand-tilde/-/expand-tilde-2.0.2.tgz#97e801aa052df02454de46b02bf621642cdc8502" @@ -4036,6 +4059,12 @@ find-up@^2.0.0, find-up@^2.1.0: dependencies: locate-path "^2.0.0" +find-up@^3.0.0: + version "3.0.0" + resolved "https://unpm.uberinternal.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" + dependencies: + locate-path "^3.0.0" + flat-cache@^1.2.1: version "1.3.0" resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.0.tgz#d3030b32b38154f4e3b7e9c709f490f7ef97c481" @@ -4053,6 +4082,16 @@ flow-bin@^0.75.0: version "0.75.0" resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.75.0.tgz#b96d1ee99d3b446a3226be66b4013224ce9df260" +flow-copy-source@^2.0.2: + version "2.0.2" + resolved "https://unpm.uberinternal.com/flow-copy-source/-/flow-copy-source-2.0.2.tgz#096e579a9bb63a38afc5d4dd68ac847a5be27594" + dependencies: + chokidar "^2.0.0" + fs-extra "^7.0.0" + glob "^7.0.0" + kefir "^3.7.3" + yargs "^12.0.1" + flush-write-stream@^1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/flush-write-stream/-/flush-write-stream-1.0.3.tgz#c5d586ef38af6097650b49bc41b55fabb19f35bd" @@ -4107,6 +4146,18 @@ from2@^2.1.0: inherits "^2.0.1" readable-stream "^2.0.0" +fs-constants@^1.0.0: + version "1.0.0" + resolved "https://unpm.uberinternal.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad" + +fs-extra@^7.0.0: + version "7.0.0" + resolved "https://unpm.uberinternal.com/fs-extra/-/fs-extra-7.0.0.tgz#8cc3f47ce07ef7b3593a11b9fb245f7e34c041d6" + dependencies: + graceful-fs "^4.1.2" + jsonfile "^4.0.0" + universalify "^0.1.0" + fs-minipass@^1.2.5: version "1.2.5" resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.5.tgz#06c277218454ec288df77ada54a03b8702aacb9d" @@ -4211,6 +4262,10 @@ git-raw-commits@^1.3.0: split2 "^2.0.0" through2 "^2.0.0" +github-from-package@0.0.0: + version "0.0.0" + resolved "https://unpm.uberinternal.com/github-from-package/-/github-from-package-0.0.0.tgz#97fb5d96bfde8973313f20e8288ef9a167fa64ce" + glamor@^2.20.40: version "2.20.40" resolved "https://registry.yarnpkg.com/glamor/-/glamor-2.20.40.tgz#f606660357b7cf18dface731ad1a2cfa93817f05" @@ -4352,7 +4407,7 @@ got@5.6.0: unzip-response "^1.0.0" url-parse-lax "^1.0.0" -graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.3, graceful-fs@^4.1.4: +graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.3, graceful-fs@^4.1.4, graceful-fs@^4.1.6: version "4.1.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" @@ -4656,6 +4711,16 @@ ignore@^3.3.3, ignore@^3.3.7: version "3.3.10" resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043" +iltorb@^2.0.5: + version "2.3.2" + resolved "https://unpm.uberinternal.com/iltorb/-/iltorb-2.3.2.tgz#886b6b406fde6dc5116d8fe431df582328d937a6" + dependencies: + detect-libc "^1.0.3" + nan "^2.10.0" + npmlog "^4.1.2" + prebuild-install "^3.0.0" + which-pm-runs "^1.0.0" + immediate@~3.0.5: version "3.0.6" resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.0.6.tgz#9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b" @@ -5028,12 +5093,6 @@ is-redirect@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-redirect/-/is-redirect-1.0.0.tgz#1d03dded53bd8db0f30c26e4f95d36fc7c87dc24" -is-reference@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-reference/-/is-reference-1.1.0.tgz#50e6ef3f64c361e2c53c0416cdc9420037f2685b" - dependencies: - "@types/estree" "0.0.38" - is-regex@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" @@ -5642,6 +5701,12 @@ json5@^0.5.0, json5@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" +jsonfile@^4.0.0: + version "4.0.0" + resolved "https://unpm.uberinternal.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" + optionalDependencies: + graceful-fs "^4.1.6" + jsonify@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" @@ -5675,6 +5740,12 @@ jszip@^3.1.3: pako "~1.0.2" readable-stream "~2.0.6" +kefir@^3.7.3: + version "3.8.3" + resolved "https://unpm.uberinternal.com/kefir/-/kefir-3.8.3.tgz#8e0ab10084ed8a01cbb5d4f7f18a0b859f7b9bd9" + dependencies: + symbol-observable "1.0.4" + kew@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/kew/-/kew-0.7.0.tgz#79d93d2d33363d6fdd2970b335d9141ad591d79b" @@ -5787,10 +5858,6 @@ loader-utils@^1.0.2, loader-utils@^1.1.0: emojis-list "^2.0.0" json5 "^0.5.0" -locate-character@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/locate-character/-/locate-character-2.0.5.tgz#f2d2614d49820ecb3c92d80d193b8db755f74c0f" - locate-path@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" @@ -5798,6 +5865,13 @@ locate-path@^2.0.0: p-locate "^2.0.0" path-exists "^3.0.0" +locate-path@^3.0.0: + version "3.0.0" + resolved "https://unpm.uberinternal.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" + dependencies: + p-locate "^3.0.0" + path-exists "^3.0.0" + lodash-es@^4.2.1: version "4.17.10" resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.10.tgz#62cd7104cdf5dd87f235a837f0ede0e8e5117e05" @@ -6183,6 +6257,10 @@ mimic-fn@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" +mimic-response@^1.0.0: + version "1.0.1" + resolved "https://unpm.uberinternal.com/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b" + min-document@^2.19.0: version "2.19.0" resolved "https://registry.yarnpkg.com/min-document/-/min-document-2.19.0.tgz#7bd282e3f5842ed295bb748cdd9f1ffa2c824685" @@ -6304,7 +6382,7 @@ mute-stream@0.0.7: version "0.0.7" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" -nan@^2.9.2: +nan@^2.10.0, nan@^2.9.2: version "2.10.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.10.0.tgz#96d0cd610ebd58d4b4de9cc0c6828cda99c7548f" @@ -6372,6 +6450,12 @@ no-case@^2.2.0: dependencies: lower-case "^1.1.1" +node-abi@^2.2.0: + version "2.4.3" + resolved "https://unpm.uberinternal.com/node-abi/-/node-abi-2.4.3.tgz#43666b7b17e57863e572409edbb82115ac7af28b" + dependencies: + semver "^5.4.1" + node-dir@^0.1.10: version "0.1.17" resolved "https://registry.yarnpkg.com/node-dir/-/node-dir-0.1.17.tgz#5f5665d93351335caabef8f1c554516cf5f1e4e5" @@ -6452,6 +6536,10 @@ nomnom@~1.6.2: colors "0.5.x" underscore "~1.4.4" +noop-logger@^0.1.1: + version "0.1.1" + resolved "https://unpm.uberinternal.com/noop-logger/-/noop-logger-0.1.1.tgz#94a2b1633c4f1317553007d8966fd0e841b6a4c2" + nopt@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d" @@ -6508,7 +6596,7 @@ npm-run-path@^2.0.0: dependencies: path-key "^2.0.0" -npmlog@^4.0.2, npmlog@^4.1.2: +npmlog@^4.0.1, npmlog@^4.0.2, npmlog@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" dependencies: @@ -6672,7 +6760,7 @@ os-browserify@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.3.0.tgz#854373c7f5c2315914fc9bfc6bd8238fdda1ec27" -os-homedir@^1.0.0: +os-homedir@^1.0.0, os-homedir@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" @@ -6713,12 +6801,24 @@ p-limit@^1.1.0: dependencies: p-try "^1.0.0" +p-limit@^2.0.0: + version "2.0.0" + resolved "https://unpm.uberinternal.com/p-limit/-/p-limit-2.0.0.tgz#e624ed54ee8c460a778b3c9f3670496ff8a57aec" + dependencies: + p-try "^2.0.0" + p-locate@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" dependencies: p-limit "^1.1.0" +p-locate@^3.0.0: + version "3.0.0" + resolved "https://unpm.uberinternal.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" + dependencies: + p-limit "^2.0.0" + p-map@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/p-map/-/p-map-1.2.0.tgz#e4e94f311eabbc8633a1e79908165fca26241b6b" @@ -6727,6 +6827,10 @@ p-try@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" +p-try@^2.0.0: + version "2.0.0" + resolved "https://unpm.uberinternal.com/p-try/-/p-try-2.0.0.tgz#85080bb87c64688fa47996fe8f7dfbe8211760b1" + pako@~1.0.2, pako@~1.0.5: version "1.0.6" resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.6.tgz#0101211baa70c4bca4a0f63f2206e97b7dfaf258" @@ -6777,10 +6881,6 @@ parse-json@^4.0.0: error-ex "^1.3.1" json-parse-better-errors "^1.0.1" -parse-ms@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/parse-ms/-/parse-ms-1.0.1.tgz#56346d4749d78f23430ca0c713850aef91aa361d" - parse-passwd@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6" @@ -7192,6 +7292,26 @@ postcss@^6.0.0, postcss@^6.0.1, postcss@^6.0.17: source-map "^0.6.1" supports-color "^5.4.0" +prebuild-install@^3.0.0: + version "3.0.0" + resolved "https://unpm.uberinternal.com/prebuild-install/-/prebuild-install-3.0.0.tgz#0fd5b2c48ffcf4ceefa64d04a4c5a328d79ad66c" + dependencies: + detect-libc "^1.0.3" + expand-template "^1.0.2" + github-from-package "0.0.0" + minimist "^1.2.0" + mkdirp "^0.5.1" + node-abi "^2.2.0" + noop-logger "^0.1.1" + npmlog "^4.0.1" + os-homedir "^1.0.1" + pump "^2.0.1" + rc "^1.1.6" + simple-get "^2.7.0" + tar-fs "^1.13.0" + tunnel-agent "^0.6.0" + which-pm-runs "^1.0.0" + prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" @@ -7222,12 +7342,6 @@ pretty-format@^23.2.0: ansi-regex "^3.0.0" ansi-styles "^3.2.0" -pretty-ms@^3.1.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/pretty-ms/-/pretty-ms-3.2.0.tgz#87a8feaf27fc18414d75441467d411d6e6098a25" - dependencies: - parse-ms "^1.0.0" - pretty-quick@^1.4.1: version "1.6.0" resolved "https://registry.yarnpkg.com/pretty-quick/-/pretty-quick-1.6.0.tgz#afc3591eb5c4cf37614a305d489a8a40e57c9258" @@ -7329,6 +7443,13 @@ public-encrypt@^4.0.0: parse-asn1 "^5.0.0" randombytes "^2.0.1" +pump@^1.0.0: + version "1.0.3" + resolved "https://unpm.uberinternal.com/pump/-/pump-1.0.3.tgz#5dfe8311c33bbf6fc18261f9f34702c47c08a954" + dependencies: + end-of-stream "^1.1.0" + once "^1.3.1" + pump@^2.0.0, pump@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/pump/-/pump-2.0.1.tgz#12399add6e4cf7526d973cbc8b5ce2e2908b3909" @@ -7451,7 +7572,7 @@ raw-body@2.3.2: iconv-lite "0.4.19" unpipe "1.0.0" -rc@^1.2.7: +rc@^1.1.6, rc@^1.2.7: version "1.2.8" resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" dependencies: @@ -7714,7 +7835,7 @@ read-pkg@^3.0.0: normalize-package-data "^2.3.2" path-type "^3.0.0" -"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.3, readable-stream@^2.3.6: +"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.0, readable-stream@^2.3.3, readable-stream@^2.3.5, readable-stream@^2.3.6: version "2.3.6" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" dependencies: @@ -7973,10 +8094,6 @@ require-main-filename@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" -require-relative@^0.8.7: - version "0.8.7" - resolved "https://registry.yarnpkg.com/require-relative/-/require-relative-0.8.7.tgz#7999539fc9e047a37928fa196f8e1563dabd36de" - require-uncached@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" @@ -8063,9 +8180,9 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: hash-base "^3.0.0" inherits "^2.0.1" -rollup-plugin-babel@^3.0.3: +rollup-plugin-babel@^3.0.7: version "3.0.7" - resolved "https://registry.yarnpkg.com/rollup-plugin-babel/-/rollup-plugin-babel-3.0.7.tgz#5b13611f1ab8922497e9d15197ae5d8a23fe3b1e" + resolved "https://unpm.uberinternal.com/rollup-plugin-babel/-/rollup-plugin-babel-3.0.7.tgz#5b13611f1ab8922497e9d15197ae5d8a23fe3b1e" dependencies: rollup-pluginutils "^1.5.0" @@ -8078,15 +8195,17 @@ rollup-plugin-commonjs@^9.1.3: resolve "^1.5.0" rollup-pluginutils "^2.0.1" -rollup-plugin-filesize@^1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/rollup-plugin-filesize/-/rollup-plugin-filesize-1.5.0.tgz#bb5841242d88be57f231c9e8a3a541925392178b" +rollup-plugin-filesize@^4.0.1: + version "4.0.1" + resolved "https://unpm.uberinternal.com/rollup-plugin-filesize/-/rollup-plugin-filesize-4.0.1.tgz#9c5e682716cea026025ebf99720b4e603b20545c" dependencies: boxen "^1.1.0" + brotli-size "0.0.2" colors "^1.1.2" deep-assign "^2.0.0" filesize "^3.5.6" gzip-size "^3.0.0" + terser "^3.8.0" rollup-plugin-json@^3.0.0: version "3.0.0" @@ -8117,11 +8236,12 @@ rollup-plugin-replace@^2.0.0: minimatch "^3.0.2" rollup-pluginutils "^2.0.1" -rollup-plugin-visualizer@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/rollup-plugin-visualizer/-/rollup-plugin-visualizer-0.4.0.tgz#11237cf8678b1a41f664722820fe8592330c8923" +rollup-plugin-visualizer@^0.8.0: + version "0.8.0" + resolved "https://unpm.uberinternal.com/rollup-plugin-visualizer/-/rollup-plugin-visualizer-0.8.0.tgz#dd4df7c7d4dc49443ab6b62a729ff9977aea0697" dependencies: - source-map "^0.7.2" + mkdirp "^0.5.1" + source-map "^0.7.3" rollup-pluginutils@^1.5.0, rollup-pluginutils@^1.5.1: version "1.5.2" @@ -8137,21 +8257,12 @@ rollup-pluginutils@^2.0.1, rollup-pluginutils@^2.2.0: estree-walker "^0.5.2" micromatch "^2.3.11" -rollup@^0.57.1: - version "0.57.1" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.57.1.tgz#0bb28be6151d253f67cf4a00fea48fb823c74027" - dependencies: - "@types/acorn" "^4.0.3" - acorn "^5.5.3" - acorn-dynamic-import "^3.0.0" - date-time "^2.1.0" - is-reference "^1.1.0" - locate-character "^2.0.5" - pretty-ms "^3.1.0" - require-relative "^0.8.7" - rollup-pluginutils "^2.0.1" - signal-exit "^3.0.2" - sourcemap-codec "^1.4.1" +rollup@^0.63.4: + version "0.63.4" + resolved "https://unpm.uberinternal.com/rollup/-/rollup-0.63.4.tgz#cb58bf6c2a6c38542cae250684c962799ad7c00c" + dependencies: + "@types/estree" "0.0.39" + "@types/node" "*" rst-selector-parser@^2.2.3: version "2.2.3" @@ -8386,6 +8497,18 @@ signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" +simple-concat@^1.0.0: + version "1.0.0" + resolved "https://unpm.uberinternal.com/simple-concat/-/simple-concat-1.0.0.tgz#7344cbb8b6e26fb27d66b2fc86f9f6d5997521c6" + +simple-get@^2.7.0: + version "2.8.1" + resolved "https://unpm.uberinternal.com/simple-get/-/simple-get-2.8.1.tgz#0e22e91d4575d87620620bc91308d57a77f44b5d" + dependencies: + decompress-response "^3.3.0" + once "^1.3.1" + simple-concat "^1.0.0" + sisteransi@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-0.1.1.tgz#5431447d5f7d1675aac667ccd0b865a4994cb3ce" @@ -8464,7 +8587,7 @@ source-map-support@^0.4.15: dependencies: source-map "^0.5.6" -source-map-support@^0.5.6: +source-map-support@^0.5.6, source-map-support@~0.5.6: version "0.5.6" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.6.tgz#4435cee46b1aab62b8e8610ce60f788091c51c13" dependencies: @@ -8489,13 +8612,9 @@ source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" -source-map@^0.7.2: +source-map@^0.7.3: version "0.7.3" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" - -sourcemap-codec@^1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.1.tgz#c8fd92d91889e902a07aee392bdd2c5863958ba2" + resolved "https://unpm.uberinternal.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" spdx-correct@^3.0.0: version "3.0.0" @@ -8807,6 +8926,10 @@ symbol-observable@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.1.tgz#8340fc4702c3122df5d22288f88283f513d3fdd4" +symbol-observable@1.0.4: + version "1.0.4" + resolved "https://unpm.uberinternal.com/symbol-observable/-/symbol-observable-1.0.4.tgz#29bf615d4aa7121bdd898b22d4b3f9bc4e2aa03d" + symbol-observable@^1.0.3: version "1.2.0" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" @@ -8836,6 +8959,27 @@ tapable@^0.2.3, tapable@^0.2.7: version "0.2.8" resolved "https://registry.yarnpkg.com/tapable/-/tapable-0.2.8.tgz#99372a5c999bf2df160afc0d74bed4f47948cd22" +tar-fs@^1.13.0: + version "1.16.3" + resolved "https://unpm.uberinternal.com/tar-fs/-/tar-fs-1.16.3.tgz#966a628841da2c4010406a82167cbd5e0c72d509" + dependencies: + chownr "^1.0.1" + mkdirp "^0.5.1" + pump "^1.0.0" + tar-stream "^1.1.2" + +tar-stream@^1.1.2: + version "1.6.1" + resolved "https://unpm.uberinternal.com/tar-stream/-/tar-stream-1.6.1.tgz#f84ef1696269d6223ca48f6e1eeede3f7e81f395" + dependencies: + bl "^1.0.0" + buffer-alloc "^1.1.0" + end-of-stream "^1.0.0" + fs-constants "^1.0.0" + readable-stream "^2.3.0" + to-buffer "^1.1.0" + xtend "^4.0.0" + tar@4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/tar/-/tar-4.0.2.tgz#e8e22bf3eec330e5c616d415a698395e294e8fad" @@ -8864,6 +9008,14 @@ term-size@^1.2.0: dependencies: execa "^0.7.0" +terser@^3.8.0: + version "3.8.1" + resolved "https://unpm.uberinternal.com/terser/-/terser-3.8.1.tgz#cb70070ac9e0a71add169dfb63c0a64fca2738ac" + dependencies: + commander "~2.16.0" + source-map "~0.6.1" + source-map-support "~0.5.6" + test-exclude@^4.2.1: version "4.2.1" resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-4.2.1.tgz#dfa222f03480bca69207ca728b37d74b45f724fa" @@ -8901,10 +9053,6 @@ time-stamp@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/time-stamp/-/time-stamp-2.0.0.tgz#95c6a44530e15ba8d6f4a3ecb8c3a3fac46da357" -time-zone@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/time-zone/-/time-zone-1.0.0.tgz#99c5bf55958966af6d06d83bdf3800dc82faec5d" - timed-out@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/timed-out/-/timed-out-2.0.0.tgz#f38b0ae81d3747d628001f41dafc652ace671c0a" @@ -8943,6 +9091,10 @@ to-arraybuffer@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz#7d229b1fcc637e466ca081180836a7aabff83f43" +to-buffer@^1.1.0: + version "1.1.1" + resolved "https://unpm.uberinternal.com/to-buffer/-/to-buffer-1.1.1.tgz#493bd48f62d7c43fcded313a03dcadb2e1213a80" + to-fast-properties@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47" @@ -9124,6 +9276,10 @@ unique-slug@^2.0.0: dependencies: imurmurhash "^0.1.4" +universalify@^0.1.0: + version "0.1.2" + resolved "https://unpm.uberinternal.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" + unpipe@1.0.0, unpipe@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" @@ -9415,6 +9571,10 @@ which-module@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" +which-pm-runs@^1.0.0: + version "1.0.0" + resolved "https://unpm.uberinternal.com/which-pm-runs/-/which-pm-runs-1.0.0.tgz#670b3afbc552e0b55df6b7780ca74615f23ad1cb" + which@^1.2.12, which@^1.2.14, which@^1.2.9, which@^1.3.0: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" @@ -9502,6 +9662,10 @@ xmlbuilder@~9.0.1: version "9.0.7" resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-9.0.7.tgz#132ee63d2ec5565c557e20f4c22df9aca686b10d" +xregexp@4.0.0: + version "4.0.0" + resolved "https://unpm.uberinternal.com/xregexp/-/xregexp-4.0.0.tgz#e698189de49dd2a18cc5687b05e17c8e43943020" + xtend@^4.0.0, xtend@~4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" @@ -9510,7 +9674,7 @@ y18n@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" -y18n@^4.0.0: +"y18n@^3.2.1 || ^4.0.0", y18n@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" @@ -9522,6 +9686,12 @@ yallist@^3.0.0, yallist@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.2.tgz#8452b4bb7e83c7c188d8041c1a837c773d6d8bb9" +yargs-parser@^10.1.0: + version "10.1.0" + resolved "https://unpm.uberinternal.com/yargs-parser/-/yargs-parser-10.1.0.tgz#7202265b89f7e9e9f2e5765e0fe735a905edbaa8" + dependencies: + camelcase "^4.1.0" + yargs-parser@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-7.0.0.tgz#8d0ac42f16ea55debd332caf4c4038b3e3f5dfd9" @@ -9551,6 +9721,23 @@ yargs@^11.0.0: y18n "^3.2.1" yargs-parser "^9.0.2" +yargs@^12.0.1: + version "12.0.1" + resolved "https://unpm.uberinternal.com/yargs/-/yargs-12.0.1.tgz#6432e56123bb4e7c3562115401e98374060261c2" + dependencies: + cliui "^4.0.0" + decamelize "^2.0.0" + find-up "^3.0.0" + get-caller-file "^1.0.1" + os-locale "^2.0.0" + require-directory "^2.1.1" + require-main-filename "^1.0.1" + set-blocking "^2.0.0" + string-width "^2.0.0" + which-module "^2.0.0" + y18n "^3.2.1 || ^4.0.0" + yargs-parser "^10.1.0" + yargs@^8.0.2: version "8.0.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-8.0.2.tgz#6299a9055b1cefc969ff7e79c1d918dceb22c360" From 6d7c74bb4b9e6c3888b5a780e0ac6a5772fb37a1 Mon Sep 17 00:00:00 2001 From: Ardo Kusuma Date: Mon, 30 Jul 2018 14:09:41 -0700 Subject: [PATCH 05/12] chore: rebase with master --- Dockerfile | 2 +- package.json | 12 ++++++------ rollup.config.js | 13 ++++++------- scripts/prepublish.sh | 9 --------- 4 files changed, 13 insertions(+), 23 deletions(-) delete mode 100755 scripts/prepublish.sh diff --git a/Dockerfile b/Dockerfile index 5e4695c890..cc02aafe74 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ WORKDIR /baseui # Copy manifests and install dependencies. # Doing this before a build step can more effectively leverage Docker caching. COPY package.json yarn.lock /baseui/ -RUN yarn --ignore-scripts +RUN yarn # Copy the current files to the docker image. COPY . . diff --git a/package.json b/package.json index 790cd7a57d..e912dcadae 100644 --- a/package.json +++ b/package.json @@ -9,9 +9,9 @@ "url": "https://github.com/uber-web/baseui/issues" }, "homepage": "https://github.com/uber-web/baseui#readme", - "main": "dist/baseui.es.js", - "jsnext:main": "dist/baseui.es.js", - "module": "dist/baseui.es.js", + "main": "baseui.js", + "jsnext:main": "baseui.es.js", + "module": "baseui.es.js", "repository": { "type": "git", "url": "git+https://github.com/uber-web/baseui.git" @@ -25,12 +25,12 @@ "build-storybook": "build-storybook -o docs", "precommit": "pretty-quick --staged && yarn run test", "build": - "rm -rf dist && rollup -c rollup.config.js && node ./scripts/flow-copy-src.js", + "rm -rf dist && rollup -c rollup.config.js && node ./scripts/flow-copy-src.js && cp package.json dist/package.json", "unit-test": "yarn jest --coverage", "e2e": "node ./e2e/e2e.js", "build-e2e": "rollup -c rollup.config_e2e.js", "serve-e2e": "node e2e/serve.js", - "prepublishOnly": ". ./resources/prepublish.sh", + "release": "yarn build && yarn publish dist", "test-e2e": "pkill \"chromedriver|geckodriver|safaridriver\" | jest --config=jest-e2e.config.js" }, @@ -80,7 +80,7 @@ "react-dom": "^16.4.0", "rollup": "^0.63.4", "rollup-plugin-babel": "^3.0.7", - "rollup-plugin-commonjs": "^9.1.3", + "rollup-plugin-commonjs": "^9.1.4", "rollup-plugin-filesize": "^4.0.1", "rollup-plugin-json": "^3.0.0", "rollup-plugin-node-resolve": "^3.3.0", diff --git a/rollup.config.js b/rollup.config.js index c9edc980aa..22557fa332 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -59,6 +59,12 @@ function getSharedConfig({filePath, name}) { plugins: [ progress(), nodeResolve(), + commonjs({ + include: 'node_modules/**', + namedExports: { + 'node_modules/create-react-context/index.js': ['createReactContext'], + }, + }), babel({ babelrc: false, presets: [['es2015', {modules: false}], 'stage-1', 'react'], @@ -66,14 +72,7 @@ function getSharedConfig({filePath, name}) { }), visualizer(), filesize(), - commonjs({ - include: 'node_modules/**', - namedExports: { - 'node_modules/create-react-context/index.js': ['createReactContext'], - }, - }), flowEntry(), - // flowCopySrc(), ], }; } diff --git a/scripts/prepublish.sh b/scripts/prepublish.sh deleted file mode 100755 index bdada9ee4e..0000000000 --- a/scripts/prepublish.sh +++ /dev/null @@ -1,9 +0,0 @@ -if [ "$CI" != true ]; then - echo "\n\n\n \033[101;30m Only the CI can publish to npm. \033[0m" 1>&2; - exit 1; -fi; - -# When Buildkite publishes to npm, the published files are available in the root -# directory, which allows for a clean include or require of sub-modules. -yarn build -cp -r ./dist/* ./ From c679b2dda89d40ee12efb15fbcd5a24f6524f971 Mon Sep 17 00:00:00 2001 From: Ardo Kusuma Date: Tue, 31 Jul 2018 11:27:35 -0700 Subject: [PATCH 06/12] chore: rebase with master --- .npmignore | 17 ----------- src/components/checkbox/checkbox.js | 10 +++---- src/components/input/base-input.js | 14 ++++----- src/components/input/input.js | 16 +++++----- src/components/popover/popover.js | 10 +++---- src/components/popover/types.js | 12 ++++++-- src/helpers/__tests__/overrides.test.js | 38 +++++++++++------------ src/helpers/overrides.js | 40 ++++++++++++++----------- yarn.lock | 6 ++-- 9 files changed, 76 insertions(+), 87 deletions(-) delete mode 100644 .npmignore diff --git a/.npmignore b/.npmignore deleted file mode 100644 index c29e951abe..0000000000 --- a/.npmignore +++ /dev/null @@ -1,17 +0,0 @@ -.* -coverage -dist -e2e -node_modules -rfcs -scripts -flow-typed -/src - -commitlint.config.js -docker-compose.yml -Dockerfile -jest-e2e.config.js -jest.config.js -rollup.config_e2e.js -rollup.config.js diff --git a/src/components/checkbox/checkbox.js b/src/components/checkbox/checkbox.js index 519ac344b3..9053d4a2d0 100644 --- a/src/components/checkbox/checkbox.js +++ b/src/components/checkbox/checkbox.js @@ -1,6 +1,6 @@ // @flow import React from 'react'; -import {getComponent, getOverrideProps} from '../../helpers/overrides'; +import {getOverride, getOverrideProps} from '../../helpers/overrides'; import type {PropsT, DefaultPropsT, StatelessStateT} from './types'; import { Checkmark as StyledCheckmark, @@ -80,10 +80,10 @@ class StatelessCheckbox extends React.Component { Input: InputOverride, } = overrides; - const Root = getComponent(RootOverride, StyledRoot); - const Checkmark = getComponent(CheckmarkOverride, StyledCheckmark); - const Label = getComponent(LabelOverride, StyledLabel); - const Input = getComponent(InputOverride, StyledInput); + const Root = getOverride(RootOverride) || StyledRoot; + const Checkmark = getOverride(CheckmarkOverride) || StyledCheckmark; + const Label = getOverride(LabelOverride) || StyledLabel; + const Input = getOverride(InputOverride) || StyledInput; const events = { onChange, diff --git a/src/components/input/base-input.js b/src/components/input/base-input.js index 011b96094f..109133c9e6 100644 --- a/src/components/input/base-input.js +++ b/src/components/input/base-input.js @@ -1,7 +1,7 @@ // @flow import * as React from 'react'; import getBuiId from '../../utils/get-bui-id'; -import {getComponent, getOverrideProps} from '../../helpers/overrides'; +import {getOverride, getOverrideProps} from '../../helpers/overrides'; import type {BaseInputPropsT, InternalStateT} from './types'; import {getSharedProps} from './utils'; import {ADJOINED, SIZE} from './constants'; @@ -89,13 +89,11 @@ class BaseInput extends React.Component { const sharedProps = getSharedProps(this.props, this.state); - const InputContainer = getComponent( - InputContainerOverride, - StyledInputContainer, - ); - const Input = getComponent(InputOverride, StyledInput); - const Before = getComponent(BeforeOverride, null); - const After = getComponent(AfterOverride, null); + const InputContainer = + getOverride(InputContainerOverride) || StyledInputContainer; + const Input = getOverride(InputOverride) || StyledInput; + const Before = getOverride(BeforeOverride) || null; + const After = getOverride(AfterOverride) || null; return ( { Caption: CaptionOverride, } = this.props.overrides; - const Label = getComponent(LabelOverride, StyledLabel); - const Root = getComponent(RootOverride, StyledRoot); - const StartEnhancer = getComponent( - StartEnhancerOverride, - StyledInputEnhancer, - ); - const EndEnhancer = getComponent(EndEnhancerOverride, StyledInputEnhancer); - const Caption = getComponent(CaptionOverride, StyledCaption); + const Label = getOverride(LabelOverride) || StyledLabel; + const Root = getOverride(RootOverride) || StyledRoot; + const StartEnhancer = + getOverride(StartEnhancerOverride) || StyledInputEnhancer; + const EndEnhancer = getOverride(EndEnhancerOverride) || StyledInputEnhancer; + const Caption = getOverride(CaptionOverride) || StyledCaption; const sharedProps = getSharedProps(this.props, this.state); diff --git a/src/components/popover/popover.js b/src/components/popover/popover.js index 75637ae38b..992bc695aa 100644 --- a/src/components/popover/popover.js +++ b/src/components/popover/popover.js @@ -4,7 +4,7 @@ import * as React from 'react'; import ReactDOM from 'react-dom'; import document from 'global/document'; import Popper from 'popper.js'; -import {getComponent, getOverrideProps} from '../../helpers/overrides'; +import {getOverride, getOverrideProps} from '../../helpers/overrides'; import isBrowser from '../../utils/is-browser'; import getBuiId from '../../utils/get-bui-id'; import {ACCESSIBILITY_TYPE, PLACEMENT, TRIGGER_TYPE} from './constants'; @@ -364,7 +364,7 @@ class Popover extends React.Component { return bodyProps; } - getSharedProps(): SharedStylePropsArgT { + getSharedProps(): $Diff { const {isOpen, showArrow} = this.props; const {isAnimating, arrowOffset, popoverOffset, placement} = this.state; return { @@ -421,9 +421,9 @@ class Popover extends React.Component { Inner: InnerOverride, } = overrides; - const Arrow = getComponent(ArrowOverride, StyledArrow); - const Body = getComponent(BodyOverride, StyledBody); - const Inner = getComponent(InnerOverride, StyledInner); + const Arrow = getOverride(ArrowOverride) || StyledArrow; + const Body = getOverride(BodyOverride) || StyledBody; + const Inner = getOverride(InnerOverride) || StyledInner; const sharedProps = this.getSharedProps(); const bodyProps = this.getPopoverBodyProps(); diff --git a/src/components/popover/types.js b/src/components/popover/types.js index afb2eebe21..311b4e4c31 100644 --- a/src/components/popover/types.js +++ b/src/components/popover/types.js @@ -35,9 +35,9 @@ export type StatefulContentRenderPropT = ({ }) => React.Node; export type OverridesT = { - Body?: OverrideT, - Arrow?: OverrideT, - Inner?: OverrideT, + Body?: OverrideT, + Arrow?: OverrideT, + Inner?: OverrideT, }; // Basically React.Node minus React.Portal and Iterable @@ -147,6 +147,12 @@ export type SharedStylePropsArgT = { $popoverOffset: OffsetT, $placement: PopoverPlacementT, $showArrow: boolean, + children?: React.Node, + // Styletron stuff + $as?: string, + // TODO: Get this to work without 'any' + /* eslint-disable-next-line flowtype/no-weak-types */ + $ref?: React.Ref, }; export type SharedStylePropsT = SharedStylePropsArgT & { diff --git a/src/helpers/__tests__/overrides.test.js b/src/helpers/__tests__/overrides.test.js index cacab5de16..6d61b742e1 100644 --- a/src/helpers/__tests__/overrides.test.js +++ b/src/helpers/__tests__/overrides.test.js @@ -1,27 +1,26 @@ // @flow +import * as React from 'react'; import { - getComponent, + getOverride, getOverrideProps, toObjectOverride, mergeOverrides, } from '../overrides'; -test('Helpers - Overrides - getComponent', () => { - const DefaultComponent = jest.fn(); - const CustomComponent = jest.fn(); - expect(getComponent(null, DefaultComponent)).toEqual(DefaultComponent); - // $FlowFixMe - expect(getComponent(CustomComponent, DefaultComponent)).toEqual( - CustomComponent, - ); - // $FlowFixMe - expect(getComponent({component: CustomComponent}, DefaultComponent)).toEqual( - CustomComponent, - ); +function getMockComponent(): React.ComponentType { + const mock: React.ComponentType = () => null; + return mock; +} + +test('Helpers - Overrides - getOverride', () => { + const CustomComponent = getMockComponent(); + expect(getOverride(null)).toEqual(null); + expect(getOverride(CustomComponent)).toEqual(CustomComponent); + expect(getOverride({component: CustomComponent})).toEqual(CustomComponent); }); test('Helpers - Overrides - getOverrideProps', () => { - const CustomComponent = jest.fn(); + const CustomComponent = getMockComponent(); const override = { props: {propName: 'propsValue'}, style: {color: 'blue'}, @@ -29,7 +28,6 @@ test('Helpers - Overrides - getOverrideProps', () => { expect(getOverrideProps(null)).toMatchSnapshot( 'returns empty object when no overrides', ); - // $FlowFixMe expect(getOverrideProps(CustomComponent)).toMatchSnapshot( 'returns empty object when override is a component', ); @@ -39,8 +37,10 @@ test('Helpers - Overrides - getOverrideProps', () => { }); test('Helpers - Overrides - toObjectOverride', () => { - const CustomComponent = jest.fn(); + const CustomComponent = getMockComponent(); + // $FlowFixMe - Calling toObjectOverride with no args expect(toObjectOverride()).toBeUndefined(); + // $FlowFixMe - Calling toObjectOverride with null expect(toObjectOverride(null)).toBe(null); expect(toObjectOverride(CustomComponent)).toEqual({ component: CustomComponent, @@ -57,9 +57,9 @@ test('Helpers - Overrides - toObjectOverride', () => { }); test('Helpers - Overrides - mergeOverrides', () => { - const CustomRoot = jest.fn(); - const CustomFoo = jest.fn(); - const CustomBar = jest.fn(); + const CustomRoot = getMockComponent(); + const CustomFoo = getMockComponent(); + const CustomBar = getMockComponent(); const overrides1 = { Root: CustomRoot, diff --git a/src/helpers/overrides.js b/src/helpers/overrides.js index 63318f108d..e5d88ff789 100644 --- a/src/helpers/overrides.js +++ b/src/helpers/overrides.js @@ -1,26 +1,30 @@ // @flow import * as React from 'react'; -export type OverrideT = - | { - component?: ?React.ComponentType, - props?: ?{}, - style?: ?{}, - } - | React.ComponentType; +export type OverrideObjectT = {| + component?: ?React.ComponentType, + props?: ?{}, + style?: ?{}, +|}; -export type OverridesT = { - [string]: OverrideT<*>, +export type OverrideT = OverrideObjectT | React.ComponentType; + +export type OverridesT = { + [string]: OverrideT, }; -export function getComponent( +export function getOverride( override: ?OverrideT, - defaultComponent: React.ComponentType, -): React.ComponentType { +): ?React.ComponentType { + // Check if override is OverrideObjectT if (override && typeof override === 'object') { - return override.component || defaultComponent; + // TODO remove this 'any' once this flow issue is fixed: + // https://github.com/facebook/flow/issues/6666 + // eslint-disable-next-line flowtype/no-weak-types + return (override: any).component; } - return override || defaultComponent; + // Otherwise it must be a component type (function or class) or null/undefined + return override; } export function getOverrideProps(override: ?OverrideT) { @@ -53,10 +57,10 @@ export function toObjectOverride(override: OverrideT): OverrideT { * inject your own overrides into a child component, but also * accept further overrides from your parent. */ -export function mergeOverrides( - target?: OverridesT = {}, - source?: OverridesT = {}, -): OverridesT { +export function mergeOverrides( + target?: OverridesT = {}, + source?: OverridesT = {}, +): OverridesT { return Object.keys({...target, ...source}).reduce((acc, name) => { acc[name] = { ...toObjectOverride(target[name]), diff --git a/yarn.lock b/yarn.lock index 0702029dca..537c7d4616 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8186,9 +8186,9 @@ rollup-plugin-babel@^3.0.7: dependencies: rollup-pluginutils "^1.5.0" -rollup-plugin-commonjs@^9.1.3: - version "9.1.3" - resolved "https://registry.yarnpkg.com/rollup-plugin-commonjs/-/rollup-plugin-commonjs-9.1.3.tgz#37bfbf341292ea14f512438a56df8f9ca3ba4d67" +rollup-plugin-commonjs@^9.1.4: + version "9.1.4" + resolved "https://registry.yarnpkg.com/rollup-plugin-commonjs/-/rollup-plugin-commonjs-9.1.4.tgz#525b701adfd40e314b5bb6888d88edc28e10442f" dependencies: estree-walker "^0.5.1" magic-string "^0.22.4" From 4d869f0b8d354f36fa362d79021da05370b02804 Mon Sep 17 00:00:00 2001 From: Ardo Kusuma Date: Tue, 31 Jul 2018 12:44:42 -0700 Subject: [PATCH 07/12] chore: remove flow from scripts --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index e912dcadae..91f463c176 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,6 @@ }, "scripts": { "lint": "eslint ./", - "flow": "flow --show-all-errors", "commitmsg": "commitlint -e $GIT_PARAMS", "test": "yarn lint && yarn unit-test", "storybook": "start-storybook -p 6006", From 243eb12ab459ee81ea6f7cfded8ace3a444b8f39 Mon Sep 17 00:00:00 2001 From: Ardo Kusuma Date: Tue, 31 Jul 2018 14:11:21 -0700 Subject: [PATCH 08/12] chore: remove flowfixme --- scripts/rollup-plugin-flow-entry.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/rollup-plugin-flow-entry.js b/scripts/rollup-plugin-flow-entry.js index 011fe5b695..4626555605 100644 --- a/scripts/rollup-plugin-flow-entry.js +++ b/scripts/rollup-plugin-flow-entry.js @@ -27,8 +27,8 @@ function getFlowFileContent(filePath) { filePath = filePath.replace('../', ''); } } + filePath = filePath.replace('.js', ''); // Remove the `.js` extension, if any return `// @flow -// $FlowFixMe path is assuming that it's already in root directory export * from '${filePath}';`; } From 7b1658971765e8b8f6a7e188af993250e22d438d Mon Sep 17 00:00:00 2001 From: Ardo Kusuma Date: Tue, 31 Jul 2018 14:30:24 -0700 Subject: [PATCH 09/12] chore: go away unpm --- package.json | 7 ++++--- yarn.lock | 30 +++++++++++++++--------------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index 91f463c176..c871ed1901 100644 --- a/package.json +++ b/package.json @@ -9,9 +9,10 @@ "url": "https://github.com/uber-web/baseui/issues" }, "homepage": "https://github.com/uber-web/baseui#readme", - "main": "baseui.js", - "jsnext:main": "baseui.es.js", - "module": "baseui.es.js", + "files": ["dist"], + "main": "dist/baseui.js", + "jsnext:main": "dist/baseui.es.js", + "module": "dist/baseui.es.js", "repository": { "type": "git", "url": "git+https://github.com/uber-web/baseui.git" diff --git a/yarn.lock b/yarn.lock index 0b23ddf773..56a4bd72aa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2936,7 +2936,7 @@ decamelize@^1.0.0, decamelize@^1.1.0, decamelize@^1.1.1, decamelize@^1.1.2: decamelize@^2.0.0: version "2.0.0" - resolved "https://unpm.uberinternal.com/decamelize/-/decamelize-2.0.0.tgz#656d7bbc8094c4c788ea53c5840908c9c7d063c7" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-2.0.0.tgz#656d7bbc8094c4c788ea53c5840908c9c7d063c7" dependencies: xregexp "4.0.0" @@ -4061,7 +4061,7 @@ find-up@^2.0.0, find-up@^2.1.0: find-up@^3.0.0: version "3.0.0" - resolved "https://unpm.uberinternal.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" dependencies: locate-path "^3.0.0" @@ -4084,7 +4084,7 @@ flow-bin@^0.75.0: flow-copy-source@^2.0.2: version "2.0.2" - resolved "https://unpm.uberinternal.com/flow-copy-source/-/flow-copy-source-2.0.2.tgz#096e579a9bb63a38afc5d4dd68ac847a5be27594" + resolved "https://registry.yarnpkg.com/flow-copy-source/-/flow-copy-source-2.0.2.tgz#096e579a9bb63a38afc5d4dd68ac847a5be27594" dependencies: chokidar "^2.0.0" fs-extra "^7.0.0" @@ -5703,7 +5703,7 @@ json5@^0.5.0, json5@^0.5.1: jsonfile@^4.0.0: version "4.0.0" - resolved "https://unpm.uberinternal.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" optionalDependencies: graceful-fs "^4.1.6" @@ -5742,7 +5742,7 @@ jszip@^3.1.3: kefir@^3.7.3: version "3.8.3" - resolved "https://unpm.uberinternal.com/kefir/-/kefir-3.8.3.tgz#8e0ab10084ed8a01cbb5d4f7f18a0b859f7b9bd9" + resolved "https://registry.yarnpkg.com/kefir/-/kefir-3.8.3.tgz#8e0ab10084ed8a01cbb5d4f7f18a0b859f7b9bd9" dependencies: symbol-observable "1.0.4" @@ -5867,7 +5867,7 @@ locate-path@^2.0.0: locate-path@^3.0.0: version "3.0.0" - resolved "https://unpm.uberinternal.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" dependencies: p-locate "^3.0.0" path-exists "^3.0.0" @@ -6803,7 +6803,7 @@ p-limit@^1.1.0: p-limit@^2.0.0: version "2.0.0" - resolved "https://unpm.uberinternal.com/p-limit/-/p-limit-2.0.0.tgz#e624ed54ee8c460a778b3c9f3670496ff8a57aec" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.0.0.tgz#e624ed54ee8c460a778b3c9f3670496ff8a57aec" dependencies: p-try "^2.0.0" @@ -6815,7 +6815,7 @@ p-locate@^2.0.0: p-locate@^3.0.0: version "3.0.0" - resolved "https://unpm.uberinternal.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" dependencies: p-limit "^2.0.0" @@ -6829,7 +6829,7 @@ p-try@^1.0.0: p-try@^2.0.0: version "2.0.0" - resolved "https://unpm.uberinternal.com/p-try/-/p-try-2.0.0.tgz#85080bb87c64688fa47996fe8f7dfbe8211760b1" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.0.0.tgz#85080bb87c64688fa47996fe8f7dfbe8211760b1" pako@~1.0.2, pako@~1.0.5: version "1.0.6" @@ -8182,7 +8182,7 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: rollup-plugin-babel@^3.0.7: version "3.0.7" - resolved "https://unpm.uberinternal.com/rollup-plugin-babel/-/rollup-plugin-babel-3.0.7.tgz#5b13611f1ab8922497e9d15197ae5d8a23fe3b1e" + resolved "https://registry.yarnpkg.com/rollup-plugin-babel/-/rollup-plugin-babel-3.0.7.tgz#5b13611f1ab8922497e9d15197ae5d8a23fe3b1e" dependencies: rollup-pluginutils "^1.5.0" @@ -8928,7 +8928,7 @@ symbol-observable@1.0.1: symbol-observable@1.0.4: version "1.0.4" - resolved "https://unpm.uberinternal.com/symbol-observable/-/symbol-observable-1.0.4.tgz#29bf615d4aa7121bdd898b22d4b3f9bc4e2aa03d" + resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.4.tgz#29bf615d4aa7121bdd898b22d4b3f9bc4e2aa03d" symbol-observable@^1.0.3: version "1.2.0" @@ -9278,7 +9278,7 @@ unique-slug@^2.0.0: universalify@^0.1.0: version "0.1.2" - resolved "https://unpm.uberinternal.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" unpipe@1.0.0, unpipe@~1.0.0: version "1.0.0" @@ -9664,7 +9664,7 @@ xmlbuilder@~9.0.1: xregexp@4.0.0: version "4.0.0" - resolved "https://unpm.uberinternal.com/xregexp/-/xregexp-4.0.0.tgz#e698189de49dd2a18cc5687b05e17c8e43943020" + resolved "https://registry.yarnpkg.com/xregexp/-/xregexp-4.0.0.tgz#e698189de49dd2a18cc5687b05e17c8e43943020" xtend@^4.0.0, xtend@~4.0.1: version "4.0.1" @@ -9688,7 +9688,7 @@ yallist@^3.0.0, yallist@^3.0.2: yargs-parser@^10.1.0: version "10.1.0" - resolved "https://unpm.uberinternal.com/yargs-parser/-/yargs-parser-10.1.0.tgz#7202265b89f7e9e9f2e5765e0fe735a905edbaa8" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-10.1.0.tgz#7202265b89f7e9e9f2e5765e0fe735a905edbaa8" dependencies: camelcase "^4.1.0" @@ -9723,7 +9723,7 @@ yargs@^11.0.0: yargs@^12.0.1: version "12.0.1" - resolved "https://unpm.uberinternal.com/yargs/-/yargs-12.0.1.tgz#6432e56123bb4e7c3562115401e98374060261c2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.1.tgz#6432e56123bb4e7c3562115401e98374060261c2" dependencies: cliui "^4.0.0" decamelize "^2.0.0" From d4d4bc1683e9f54500bf8a34912951b97ed374b3 Mon Sep 17 00:00:00 2001 From: Ardo Kusuma Date: Tue, 31 Jul 2018 15:12:14 -0700 Subject: [PATCH 10/12] chore: undo package.json changes on files and main stuff --- package.json | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index c871ed1901..91f463c176 100644 --- a/package.json +++ b/package.json @@ -9,10 +9,9 @@ "url": "https://github.com/uber-web/baseui/issues" }, "homepage": "https://github.com/uber-web/baseui#readme", - "files": ["dist"], - "main": "dist/baseui.js", - "jsnext:main": "dist/baseui.es.js", - "module": "dist/baseui.es.js", + "main": "baseui.js", + "jsnext:main": "baseui.es.js", + "module": "baseui.es.js", "repository": { "type": "git", "url": "git+https://github.com/uber-web/baseui.git" From 0b7e481cc0d9f5d6e4716343fdeddbd955feb099 Mon Sep 17 00:00:00 2001 From: Ardo Kusuma Date: Wed, 1 Aug 2018 17:24:21 -0700 Subject: [PATCH 11/12] chore: address comments --- scripts/flow-copy-src.js | 2 +- scripts/rollup-plugin-flow-entry.js | 26 +++++++++++++++++++------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/scripts/flow-copy-src.js b/scripts/flow-copy-src.js index bbaa27fffb..dc17bed966 100644 --- a/scripts/flow-copy-src.js +++ b/scripts/flow-copy-src.js @@ -1,4 +1,4 @@ -/* eslint-disable flowtype/require-valid-file-annotation */ +// @flow const flowCopySource = require('flow-copy-source'); async function run() { diff --git a/scripts/rollup-plugin-flow-entry.js b/scripts/rollup-plugin-flow-entry.js index 4626555605..832cd67fb8 100644 --- a/scripts/rollup-plugin-flow-entry.js +++ b/scripts/rollup-plugin-flow-entry.js @@ -1,33 +1,45 @@ -/* eslint-disable flowtype/require-valid-file-annotation */ +// @flow import fs from 'fs'; import path from 'path'; /* We can consider this as well: https://github.com/RichieAHB/rollup-plugin-flow-defs/blob/master/src/index.js - This code is inspired by that npm package anyway. + +The reason why we don't use that is because: +* Package depends on `mkdirp`. It's just one dependency, but it's an extra dep for such a simple thing to do. +* We cannot override the output path for the flow entry file content + +Hence, it's easier to write our own so we can do full modifications as needed. */ function getFlowFileContent(filePath) { /* - Since we're going to copy `dist` dictionary into root in our publish step, - we will need to remove one level of the path. + Since we're running this during rollup process, it will be relative to the main `src` directory. + We do not want that. + We want to make it point to the `src` directory that will be created with our scripts later in the build process + from `flow-copy-src.js`. + Hence, instead of `../src` and `../../src`, they will become `./src` and `../src` respectively. */ + + // Find `../` pattern in the `filePath` const regex = new RegExp(/\.\.\//, 'g'); + // We want to know how many `../` is inside the file path const matched = filePath.match(regex); if (matched.length > 0) { - // Check whether it's only one `..` + // Check whether it's only one `../` if (matched.length === 1) { // Only 1, replace it with `./` filePath = filePath.replace('../', './'); } else { - // Must be more than 1 + // Must be more than 1, then just remove one `../` filePath = filePath.replace('../', ''); } } - filePath = filePath.replace('.js', ''); // Remove the `.js` extension, if any + // Remove the `.js` extension, if any, so that it could point to `.js.flow` automatically + filePath = filePath.replace('.js', ''); return `// @flow export * from '${filePath}';`; } From 49a356ec1a20a24138e96310dd1961cee41b1a1a Mon Sep 17 00:00:00 2001 From: Ardo Kusuma Date: Wed, 1 Aug 2018 19:30:45 -0700 Subject: [PATCH 12/12] fix: flow error --- scripts/rollup-plugin-flow-entry.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/rollup-plugin-flow-entry.js b/scripts/rollup-plugin-flow-entry.js index 832cd67fb8..47baa13ce6 100644 --- a/scripts/rollup-plugin-flow-entry.js +++ b/scripts/rollup-plugin-flow-entry.js @@ -28,7 +28,7 @@ function getFlowFileContent(filePath) { const regex = new RegExp(/\.\.\//, 'g'); // We want to know how many `../` is inside the file path const matched = filePath.match(regex); - if (matched.length > 0) { + if (matched && matched.length > 0) { // Check whether it's only one `../` if (matched.length === 1) { // Only 1, replace it with `./` @@ -48,9 +48,11 @@ export default function flowEntry() { let input; return { name: 'rollup-plugin-flow-entry', + // $FlowFixMe can't have annotations here since it's for rollup options(opts) { input = opts.input; }, + // $FlowFixMe can't have annotations here since it's for rollup async generateBundle(opts) { const {file = ''} = opts || {};