From ac4a874651cd861cf04563249e8470867b01a145 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Thu, 28 Jun 2018 20:40:16 -0700 Subject: [PATCH 01/29] Hulksmash slowdowns on larger sites --- packages/gatsby/src/commands/build-html.js | 2 +- .../internal-data-bridge/gatsby-node.js | 35 +------ .../query-runner/gatsby-node.js | 14 +-- .../query-runner/page-query-runner.js | 30 +++++- .../query-runner/pages-writer.js | 1 + .../query-runner/query-queue.js | 97 ++++++++++--------- .../query-runner/query-runner.js | 18 +++- .../query-runner/query-watcher.js | 2 +- packages/gatsby/src/redux/actions.js | 25 +++-- .../gatsby/src/redux/reducers/components.js | 7 ++ packages/gatsby/src/redux/reducers/pages.js | 27 +++--- packages/gatsby/src/utils/api-runner-node.js | 6 ++ packages/gatsby/src/utils/profile.js | 57 +++++++++++ 13 files changed, 206 insertions(+), 115 deletions(-) create mode 100644 packages/gatsby/src/utils/profile.js diff --git a/packages/gatsby/src/commands/build-html.js b/packages/gatsby/src/commands/build-html.js index a7af8fee9a0f1..e424e3e63890e 100644 --- a/packages/gatsby/src/commands/build-html.js +++ b/packages/gatsby/src/commands/build-html.js @@ -13,7 +13,7 @@ module.exports = async (program: any) => { debug(`generating static HTML`) // Reduce pages objects to an array of paths. - const pages = store.getState().pages.map(page => page.path) + const pages = [...store.getState().pages.values()].map(page => page.path) // Static site generation. const compilerConfig = await webpackConfig( diff --git a/packages/gatsby/src/internal-plugins/internal-data-bridge/gatsby-node.js b/packages/gatsby/src/internal-plugins/internal-data-bridge/gatsby-node.js index 408f03e850f8e..4eb49c4bc9edb 100644 --- a/packages/gatsby/src/internal-plugins/internal-data-bridge/gatsby-node.js +++ b/packages/gatsby/src/internal-plugins/internal-data-bridge/gatsby-node.js @@ -40,6 +40,7 @@ function transformPackageJson(json) { return json } +const createPageId = path => `SitePage ${path}` exports.sourceNodes = ({ actions, store }) => { const { createNode } = actions const state = store.getState() @@ -136,37 +137,3 @@ exports.sourceNodes = ({ actions, store }) => { } }) } - -const createPageId = path => `SitePage ${path}` - -exports.onCreatePage = ({ page, actions }) => { - const { createNode } = actions - // eslint-disable-next-line - const { updatedAt, ...pageWithoutUpdated } = page - - // Add page. - createNode({ - ...pageWithoutUpdated, - id: createPageId(page.path), - parent: `SOURCE`, - children: [], - internal: { - type: `SitePage`, - contentDigest: crypto - .createHash(`md5`) - .update(JSON.stringify(page)) - .digest(`hex`), - description: - page.pluginCreatorId === `Plugin default-site-plugin` - ? `Your site's "gatsby-node.js"` - : page.pluginCreatorId, - }, - }) -} - -// Listen for DELETE_PAGE and delete page nodes. -emitter.on(`DELETE_PAGE`, action => { - const nodeId = createPageId(action.payload.path) - const node = getNode(nodeId) - boundActionCreators.deleteNode({ node }) -}) diff --git a/packages/gatsby/src/internal-plugins/query-runner/gatsby-node.js b/packages/gatsby/src/internal-plugins/query-runner/gatsby-node.js index 2f021f5bd1782..030587b767492 100644 --- a/packages/gatsby/src/internal-plugins/query-runner/gatsby-node.js +++ b/packages/gatsby/src/internal-plugins/query-runner/gatsby-node.js @@ -3,12 +3,14 @@ const { watchComponent } = require(`./query-watcher`) let components = {} exports.onCreatePage = ({ page, store }) => { - const component = store.getState().components[page.componentPath] + // In development, watch the component to detect query changes. + if (process.env.NODE_ENV !== `production`) { + const component = store.getState().components[page.componentPath] - if (components[component.componentPath]) { - return - } + if (components[component.componentPath]) { + return + } - // Watch the component to detect query changes. - watchComponent(component.componentPath) + watchComponent(component.componentPath) + } } diff --git a/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js b/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js index 4ed2677711c83..28ba9400a0153 100644 --- a/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js +++ b/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js @@ -21,19 +21,27 @@ let active = false // Afterwards we listen "API_RUNNING_QUEUE_EMPTY" and check // for dirty nodes before running queries. exports.runQueries = async () => { + console.log(`inside runQueries`) // Run queued dirty nodes now that we're active. + let start = process.hrtime() queuedDirtyActions = _.uniq(queuedDirtyActions, a => a.payload.id) + global._PROFILE({ start, name: `uniq queuedDirtyActions` }) + console.log(`hi`) const dirtyIds = findDirtyIds(queuedDirtyActions) + console.log(`hi 2`) await runQueriesForPathnames(dirtyIds) + console.log(`hi 3`) queuedDirtyActions = [] // Find ids without data dependencies (i.e. no queries have been run for // them before) and run them. const cleanIds = findIdsWithoutDataDependencies() + console.log(`hi 4`) // Run these pages await runQueriesForPathnames(cleanIds) + console.log(`hi 5`) active = true return @@ -67,6 +75,7 @@ emitter.on(`API_RUNNING_QUEUE_EMPTY`, runQueuedActions) let seenIdsWithoutDataDependencies = [] const findIdsWithoutDataDependencies = () => { + const start = process.hrtime() const state = store.getState() const allTrackedIds = _.uniq( _.flatten( @@ -81,7 +90,7 @@ const findIdsWithoutDataDependencies = () => { // paths. const notTrackedIds = _.difference( [ - ...state.pages.map(p => p.path), + ...[...state.pages.values()].map(p => p.path), ...[...state.staticQueryComponents.values()].map(c => c.jsonName), ], [...allTrackedIds, ...seenIdsWithoutDataDependencies] @@ -94,15 +103,22 @@ const findIdsWithoutDataDependencies = () => { ...seenIdsWithoutDataDependencies, ]) + global._PROFILE({ start, name: `findIdsWithoutDataDependencies` }) return notTrackedIds } const runQueriesForPathnames = pathnames => { + console.log(`pathnames count`, pathnames.length) + const start = process.hrtime() + const blah = process.hrtime() const staticQueries = pathnames.filter(p => p.slice(0, 4) === `sq--`) const pageQueries = pathnames.filter(p => p.slice(0, 4) !== `sq--`) const state = store.getState() + global._PROFILE({ start: blah, name: `filter paths for running` }) + console.log(`boo`) staticQueries.forEach(id => { + const start2 = process.hrtime() const staticQueryComponent = store.getState().staticQueryComponents.get(id) const queryJob: QueryJob = { id: staticQueryComponent.hash, @@ -113,10 +129,14 @@ const runQueriesForPathnames = pathnames => { context: { path: staticQueryComponent.jsonName }, } queue.push(queryJob) + global._PROFILE({ start: start2, name: `queue static query` }) }) + console.log(`boo 2`) - const pages = [...state.pages] + const start3 = process.hrtime() + const pages = [...state.pages.values()] let didNotQueueItems = true + console.log(`boo 3`) pageQueries.forEach(id => { const page = pages.find(pl => pl.path === id) if (page) { @@ -136,19 +156,24 @@ const runQueriesForPathnames = pathnames => { ) } }) + global._PROFILE({ start: start3, name: `queue page queries` }) + console.log(`boo 4`) if (didNotQueueItems || !pathnames || pathnames.length === 0) { return Promise.resolve() } + console.log(`boo 5`) return new Promise(resolve => { queue.on(`drain`, () => { + global._PROFILE({ start, name: `runQueriesForPathnames` }) resolve() }) }) } const findDirtyIds = actions => { + const start = process.hrtime() const state = store.getState() const uniqDirties = _.uniq( actions.reduce((dirtyIds, action) => { @@ -167,5 +192,6 @@ const findDirtyIds = actions => { return _.compact(dirtyIds) }, []) ) + global._PROFILE({ start, name: `findDirtyIds` }) return uniqDirties } diff --git a/packages/gatsby/src/internal-plugins/query-runner/pages-writer.js b/packages/gatsby/src/internal-plugins/query-runner/pages-writer.js index 2fac1fd8212bf..8fa2e37a7e635 100644 --- a/packages/gatsby/src/internal-plugins/query-runner/pages-writer.js +++ b/packages/gatsby/src/internal-plugins/query-runner/pages-writer.js @@ -12,6 +12,7 @@ let lastHash = null const writePages = async () => { bootstrapFinished = true let { program, jsonDataPaths, pages } = store.getState() + pages = [...pages.values()] const pagesComponentDependencies = {} diff --git a/packages/gatsby/src/internal-plugins/query-runner/query-queue.js b/packages/gatsby/src/internal-plugins/query-runner/query-queue.js index 056b9ba8b33eb..c7bcdbd441a6e 100644 --- a/packages/gatsby/src/internal-plugins/query-runner/query-queue.js +++ b/packages/gatsby/src/internal-plugins/query-runner/query-queue.js @@ -7,52 +7,59 @@ const websocketManager = require(`../../utils/websocket-manager`) const processing = new Set() const waiting = new Map() -const queue = new Queue( - (plObj, callback) => { - const state = store.getState() - processing.add(plObj.id) - - return queryRunner(plObj, state.components[plObj.component]) - .catch(e => console.log(`Error running queryRunner`, e)) - .then( - result => { - processing.delete(plObj.id) - if (waiting.has(plObj.id)) { - queue.push(waiting.get(plObj.id)) - waiting.delete(plObj.id) - } - return callback(null, result) - }, - error => callback(error) - ) +const queueOptions = { + concurrent: 4, + // Merge duplicate jobs. + merge: (oldTask, newTask, cb) => { + cb(null, newTask) }, - { - concurrent: 4, - // Merge duplicate jobs. - merge: (oldTask, newTask, cb) => { - cb(null, newTask) - }, - priority: (job, cb) => { - const activePaths = Array.from(websocketManager.activePaths.values()) - if (job.path && activePaths.includes(job.path)) { - cb(null, 10) - } else { - cb(null, 1) - } - }, - // Filter out new query jobs if that query is already running. When the - // query finshes, it checks the waiting map and pushes another job to - // make sure all the user changes are captured. - filter: (job, cb) => { - if (processing.has(job.id)) { - waiting.set(job.id, job) - cb(`already running`) - } else { - cb(null, job) - } - }, - } -) + priority: (job, cb) => { + const activePaths = Array.from(websocketManager.activePaths.values()) + if (job.path && activePaths.includes(job.path)) { + cb(null, 10) + } else { + cb(null, 1) + } + }, + // Filter out new query jobs if that query is already running. When the + // query finshes, it checks the waiting map and pushes another job to + // make sure all the user changes are captured. + filter: (job, cb) => { + if (processing.has(job.id)) { + waiting.set(job.id, job) + cb(`already running`) + } else { + cb(null, job) + } + }, +} + +// During builds we don't need all the filtering, etc. so we +// remove them to speed up queries +if (process.env.gatsby_executing_command === `build`) { + delete queueOptions.filter + delete queueOptions.priority + delete queueOptions.merge +} + +const queue = new Queue((plObj, callback) => { + const state = store.getState() + processing.add(plObj.id) + + return queryRunner(plObj, state.components[plObj.component]) + .catch(e => console.log(`Error running queryRunner`, e)) + .then( + result => { + processing.delete(plObj.id) + if (waiting.has(plObj.id)) { + queue.push(waiting.get(plObj.id)) + waiting.delete(plObj.id) + } + return callback(null, result) + }, + error => callback(error) + ) +}, queueOptions) queue.on(`drain`, () => { emitter.emit(`QUERY_QUEUE_DRAINED`) diff --git a/packages/gatsby/src/internal-plugins/query-runner/query-runner.js b/packages/gatsby/src/internal-plugins/query-runner/query-runner.js index 942170f0cd591..8ea1df9505625 100644 --- a/packages/gatsby/src/internal-plugins/query-runner/query-runner.js +++ b/packages/gatsby/src/internal-plugins/query-runner/query-runner.js @@ -67,9 +67,21 @@ ${formatErrorDetails(errorDetails)}`) // Add the page context onto the results. if (queryJob?.isPage) { - result[`pageContext`] = queryJob.context + result[`pageContext`] = { ...queryJob.context } } + // Delete internal data from pageContext + delete result.pageContext.jsonName + delete result.pageContext.path + delete result.pageContext.internalComponentName + delete result.pageContext.component + delete result.pageContext.componentChunkName + delete result.pageContext.updatedAt + delete result.pageContext.pluginCreator___NODE + delete result.pageContext.pluginCreatorId + delete result.pageContext.componentPath + delete result.pageContext.context + const resultJSON = JSON.stringify(result) const resultHash = require(`crypto`) .createHash(`sha1`) @@ -115,7 +127,9 @@ ${formatErrorDetails(errorDetails)}`) `${dataPath}.json` ) - await fs.writeFile(resultPath, resultJSON) + if (resultJSON !== ``) { + await fs.writeFile(resultPath, resultJSON) + } store.dispatch({ type: `SET_JSON_DATA_PATH`, diff --git a/packages/gatsby/src/internal-plugins/query-runner/query-watcher.js b/packages/gatsby/src/internal-plugins/query-runner/query-watcher.js index 7c3344c57671a..8aee8237e8bda 100644 --- a/packages/gatsby/src/internal-plugins/query-runner/query-watcher.js +++ b/packages/gatsby/src/internal-plugins/query-runner/query-watcher.js @@ -21,7 +21,7 @@ const report = require(`gatsby-cli/lib/reporter`) exports.extractQueries = () => { const state = store.getState() - const pages = [...state.pages] + const pages = [...state.pages.values()] const components = _.uniq(pages.map(p => normalize(p.component))) const staticQueryComponents = [] const queryCompilerPromise = queryCompiler().then(queries => { diff --git a/packages/gatsby/src/redux/actions.js b/packages/gatsby/src/redux/actions.js index 21b3c9bf49a8f..0e074c17eb8d2 100644 --- a/packages/gatsby/src/redux/actions.js +++ b/packages/gatsby/src/redux/actions.js @@ -11,6 +11,8 @@ const kebabHash = require(`kebab-hash`) const { hasNodeChanged, getNode } = require(`./index`) const { trackInlineObjectsInRootNode } = require(`../schema/node-tracking`) const { store } = require(`./index`) +const profile = require(`../utils/profile`) +const fileExistsSync = require(`fs-exists-cached`).sync import * as joiSchemas from "../joi-schemas/joi" import { generateComponentChunkName } from "../utils/js-chunk-names" @@ -95,7 +97,9 @@ const hasWarnedForPageComponent = new Set() * }, * }) */ +const fileOkCache = {} actions.createPage = (page: PageInput, plugin?: Plugin, traceId?: string) => { + const start = process.hrtime() let noPageOrComponent = false let name = `The plugin "${plugin.name}"` if (plugin.name === `default-site-plugin`) { @@ -174,7 +178,7 @@ ${reservedFields.map(f => ` * "${f}"`).join(`\n`)} // Don't check if the component exists during tests as we use a lot of fake // component paths. if (process.env.NODE_ENV !== `test`) { - if (!fs.existsSync(page.component)) { + if (!fileExistsSync(page.component)) { const message = `${name} created a page with a component that doesn't exist` console.log(``) console.log(chalk.bold.red(message)) @@ -234,17 +238,15 @@ ${reservedFields.map(f => ` * "${f}"`).join(`\n`)} internalPage.path = `/${internalPage.path}` } - const result = Joi.validate(internalPage, joiSchemas.pageSchema) - if (result.error) { - console.log(chalk.blue.bgYellow(`The upserted page didn't pass validation`)) - console.log(chalk.bold.red(result.error)) - console.log(internalPage) - return null - } - // Validate that the page component imports React and exports something // (hopefully a component). - if (!internalPage.component.includes(`/.cache/`)) { + // + // Only run validation once during builds. + if ( + !internalPage.component.includes(`/.cache/`) && + (process.env.NODE_ENV === `production` && + !fileOkCache[internalPage.component]) + ) { const fileContent = fs.readFileSync(internalPage.component, `utf-8`) let notEmpty = true let includesDefaultExport = true @@ -287,8 +289,11 @@ ${reservedFields.map(f => ` * "${f}"`).join(`\n`)} // TODO actually do die during builds. // process.exit(1) } + + fileOkCache[internalPage.component] = true } + profile({ start, name: `actions_createPage`, parent: `site createPages` }) return { type: `CREATE_PAGE`, plugin, diff --git a/packages/gatsby/src/redux/reducers/components.js b/packages/gatsby/src/redux/reducers/components.js index 62b5e36d38929..8565947497574 100644 --- a/packages/gatsby/src/redux/reducers/components.js +++ b/packages/gatsby/src/redux/reducers/components.js @@ -1,11 +1,13 @@ const _ = require(`lodash`) const normalize = require(`normalize-path`) +const profile = require(`../../utils/profile`) module.exports = (state = {}, action) => { switch (action.type) { case `DELETE_CACHE`: return {} case `CREATE_PAGE`: + const start = process.hrtime() action.payload.componentPath = normalize(action.payload.component) state[action.payload.componentPath] = _.merge( { query: `` }, @@ -14,6 +16,11 @@ module.exports = (state = {}, action) => { componentPath: action.payload.componentPath, } ) + profile({ + start, + name: `reducers/components`, + parent: `site createPages`, + }) return state case `DELETE_PAGE`: action.payload.componentPath = normalize(action.payload.component) diff --git a/packages/gatsby/src/redux/reducers/pages.js b/packages/gatsby/src/redux/reducers/pages.js index 445056b7b610f..be731135c6c41 100644 --- a/packages/gatsby/src/redux/reducers/pages.js +++ b/packages/gatsby/src/redux/reducers/pages.js @@ -1,16 +1,12 @@ const normalize = require(`normalize-path`) +const profile = require(`../../utils/profile`) -const stateToMap = state => { - let stateMap = new Map() - state.forEach(payload => stateMap.set(payload.path, payload)) - return stateMap -} - -module.exports = (state = [], action) => { +module.exports = (state = new Map(), action) => { switch (action.type) { case `DELETE_CACHE`: - return [] + return new Map() case `CREATE_PAGE`: { + const start = process.hrtime() action.payload.component = normalize(action.payload.component) if (!action.plugin && !action.plugin.name) { console.log(``) @@ -25,14 +21,17 @@ module.exports = (state = [], action) => { action.payload.pluginCreator___NODE = action.plugin.id action.payload.pluginCreatorId = action.plugin.id - let stateMap = stateToMap(state) - stateMap.set(action.payload.path, action.payload) - return Array.from(stateMap.values()) + state.set(action.payload.path, action.payload) + profile({ + start, + name: `reducers/pages`, + parent: `site createPages`, + }) + return state } case `DELETE_PAGE`: { - let stateMap = stateToMap(state) - stateMap.delete(action.payload.path) - return Array.from(stateMap.values()) + state.delete(action.payload.path) + return state } default: return state diff --git a/packages/gatsby/src/utils/api-runner-node.js b/packages/gatsby/src/utils/api-runner-node.js index 4b2ea6cd605b2..5e99a354b1892 100644 --- a/packages/gatsby/src/utils/api-runner-node.js +++ b/packages/gatsby/src/utils/api-runner-node.js @@ -139,6 +139,7 @@ module.exports = async (api, args = {}, pluginSource) => const apiRunInstance = { api, + start: process.hrtime(), args, pluginSource, resolve, @@ -184,6 +185,11 @@ module.exports = async (api, args = {}, pluginSource) => // Filter out empty responses and return if the // api caller isn't waiting for cascading actions to finish. if (!args.waitForCascadingActions) { + // console.log({ name: apiRunInstance.api }) + global._PROFILE({ + start: apiRunInstance.start, + name: `nodeAPI/${apiRunInstance.api}`, + }) resolve(apiRunInstance.results) } diff --git a/packages/gatsby/src/utils/profile.js b/packages/gatsby/src/utils/profile.js new file mode 100644 index 0000000000000..4a9d5fe5a3819 --- /dev/null +++ b/packages/gatsby/src/utils/profile.js @@ -0,0 +1,57 @@ +const convertHrtime = require(`convert-hrtime`) +const _ = require(`lodash`) +const treeify = require(`treeify`) +const deepMapKeys = require(`deep-map-keys`) + +let root = { + ROOT: process.hrtime(), +} + +const profile = ({ name, start, parent }) => { + const span = convertHrtime(process.hrtime(start)) + let path = parent ? `${parent}.${name}` : name + let currentValue = _.get(root, path) + if (_.isObject(currentValue)) { + path = `${path}.ROOT` + currentValue = _.get(root, path) + } + const newValue = currentValue + ? currentValue + span.milliseconds + : span.milliseconds + // if (name === `run-query`) { + // console.log({ + // path, + // span: span.milliseconds, + // newValue, + // }) + // } + root = _.set(root, path, newValue) +} + +global._PROFILE = profile +module.exports = profile + +const labelify = (object, rootValue) => { + return _.mapKeys(object, (value, key, o) => { + const currentValue = _.isObject(value) ? value.ROOT : value + return `${key}: ${currentValue}ms | ${( + (currentValue / rootValue) * + 100 + ).toFixed(2) + "%"}` + }) +} + +process.on(`exit`, () => { + root.ROOT = convertHrtime(process.hrtime(root.ROOT)).milliseconds + root = labelify(root, root.ROOT) + for (var prop in root) { + if (_.isObject(root[prop]) && root[prop].ROOT) { + const rootValue = root[prop].ROOT + delete root[prop].ROOT + root[prop] = labelify(root[prop], rootValue) + } + } + console.log(``) + console.log(`===PROFILE===`) + console.log(treeify.asTree(root)) +}) From cb3371321eeb613d5340d567d5841d28c8dd58ec Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Fri, 29 Jun 2018 19:23:07 -0700 Subject: [PATCH 02/29] Switch more existsSync to use caching version --- packages/gatsby-cli/package.json | 1 + packages/gatsby-cli/src/create-cli.js | 3 ++- packages/gatsby-cli/src/init-starter.js | 5 +++-- packages/gatsby-plugin-netlify/src/gatsby-node.js | 2 +- packages/gatsby-plugin-page-creator/package.json | 1 + packages/gatsby-plugin-page-creator/src/gatsby-node.js | 3 ++- packages/gatsby-plugin-sharp/package.json | 1 + packages/gatsby-plugin-sharp/src/index.js | 3 ++- packages/gatsby/src/bootstrap/get-config-file.js | 3 ++- packages/gatsby/src/bootstrap/load-plugins/load.js | 7 ++++--- .../src/internal-plugins/load-babel-config/gatsby-node.js | 3 ++- .../internal-plugins/query-runner/page-query-runner.js | 8 -------- 12 files changed, 21 insertions(+), 19 deletions(-) diff --git a/packages/gatsby-cli/package.json b/packages/gatsby-cli/package.json index a6f441c1a5f5c..b6bdcf7fc598c 100644 --- a/packages/gatsby-cli/package.json +++ b/packages/gatsby-cli/package.json @@ -18,6 +18,7 @@ "core-js": "^2.5.0", "envinfo": "^5.8.1", "execa": "^0.8.0", + "fs-exists-cached": "^1.0.0", "fs-extra": "^4.0.1", "hosted-git-info": "^2.6.0", "lodash": "^4.17.4", diff --git a/packages/gatsby-cli/src/create-cli.js b/packages/gatsby-cli/src/create-cli.js index b00f613eb0e21..e8ccac5977fbf 100644 --- a/packages/gatsby-cli/src/create-cli.js +++ b/packages/gatsby-cli/src/create-cli.js @@ -4,6 +4,7 @@ const yargs = require(`yargs`) const report = require(`./reporter`) const fs = require(`fs`) const envinfo = require(`envinfo`) +const existsSync = require(`fs-exists-cached`).sync const DEFAULT_BROWSERS = [`>0.25%`, `not dead`] @@ -19,7 +20,7 @@ function buildLocalCommands(cli, isLocalSite) { const directory = path.resolve(`.`) let siteInfo = { directory, browserslist: DEFAULT_BROWSERS } - const useYarn = fs.existsSync(path.join(directory, `yarn.lock`)) + const useYarn = existsSync(path.join(directory, `yarn.lock`)) if (isLocalSite) { const json = require(path.join(directory, `package.json`)) siteInfo.sitePackageJson = json diff --git a/packages/gatsby-cli/src/init-starter.js b/packages/gatsby-cli/src/init-starter.js index 27f88642d463a..285d736b71dc6 100644 --- a/packages/gatsby-cli/src/init-starter.js +++ b/packages/gatsby-cli/src/init-starter.js @@ -6,6 +6,7 @@ const fs = require(`fs-extra`) const sysPath = require(`path`) const report = require(`./reporter`) const url = require(`url`) +const existsSync = require(`fs-exists-cached`).sync const spawn = (cmd: string) => { const [file, ...args] = cmd.split(/\s+/) @@ -49,7 +50,7 @@ const copy = async (starterPath: string, rootPath: string) => { // 493 = parseInt('755', 8) await fs.mkdirp(rootPath, { mode: 493 }) - if (!fs.existsSync(starterPath)) { + if (!existsSync(starterPath)) { throw new Error(`starter ${starterPath} doesn't exist`) } @@ -117,7 +118,7 @@ module.exports = async (starter: string, options: InitOptions = {}) => { return } - if (fs.existsSync(sysPath.join(rootPath, `package.json`))) { + if (existsSync(sysPath.join(rootPath, `package.json`))) { report.panic(`Directory ${rootPath} is already an npm project`) return } diff --git a/packages/gatsby-plugin-netlify/src/gatsby-node.js b/packages/gatsby-plugin-netlify/src/gatsby-node.js index 492ea5f3d33d1..afe7787de7c35 100644 --- a/packages/gatsby-plugin-netlify/src/gatsby-node.js +++ b/packages/gatsby-plugin-netlify/src/gatsby-node.js @@ -34,7 +34,7 @@ exports.onPostBuild = async ({ store, pathPrefix }, userPluginOptions) => { let rewrites = [] if (pluginOptions.generateMatchPathRewrites) { const { pages } = store.getState() - rewrites = pages + rewrites = Array.from(pages.values()) .filter(page => page.matchPath && page.matchPath !== page.path) .map(page => { return { diff --git a/packages/gatsby-plugin-page-creator/package.json b/packages/gatsby-plugin-page-creator/package.json index 16479d957f4e8..c83fb054466c3 100644 --- a/packages/gatsby-plugin-page-creator/package.json +++ b/packages/gatsby-plugin-page-creator/package.json @@ -21,6 +21,7 @@ "@babel/runtime": "7.0.0-beta.51", "bluebird": "^3.5.0", "chokidar": "^1.7.0", + "fs-exists-cached": "^1.0.0", "glob": "^7.1.1", "lodash": "^4.17.4", "parse-filepath": "^1.0.1", diff --git a/packages/gatsby-plugin-page-creator/src/gatsby-node.js b/packages/gatsby-plugin-page-creator/src/gatsby-node.js index 17355c721bf13..04bdcb4cec2b4 100644 --- a/packages/gatsby-plugin-page-creator/src/gatsby-node.js +++ b/packages/gatsby-plugin-page-creator/src/gatsby-node.js @@ -4,6 +4,7 @@ const _ = require(`lodash`) const chokidar = require(`chokidar`) const systemPath = require(`path`) const fs = require(`fs`) +const existsSync = require(`fs-exists-cached`).sync const glob = Promise.promisify(globCB) @@ -35,7 +36,7 @@ exports.createPagesStatefully = async ( } // Validate that the path exists. - if (pathCheck && !fs.existsSync(pagesPath)) { + if (pathCheck && !existsSync(pagesPath)) { reporter.panic( ` The path passed to gatsby-plugin-page-creator does not exist on your file system: diff --git a/packages/gatsby-plugin-sharp/package.json b/packages/gatsby-plugin-sharp/package.json index 32e794c007544..ef692e026a68a 100644 --- a/packages/gatsby-plugin-sharp/package.json +++ b/packages/gatsby-plugin-sharp/package.json @@ -10,6 +10,7 @@ "@babel/runtime": "7.0.0-beta.51", "async": "^2.1.2", "bluebird": "^3.5.0", + "fs-exists-cached": "^1.0.0", "imagemin": "^5.2.2", "imagemin-pngquant": "^5.1.0", "imagemin-webp": "^4.0.0", diff --git a/packages/gatsby-plugin-sharp/src/index.js b/packages/gatsby-plugin-sharp/src/index.js index 89ed756da4228..f545ecf04923c 100644 --- a/packages/gatsby-plugin-sharp/src/index.js +++ b/packages/gatsby-plugin-sharp/src/index.js @@ -10,6 +10,7 @@ const imageminPngquant = require(`imagemin-pngquant`) const imageminWebp = require(`imagemin-webp`) const queue = require(`async/queue`) const path = require(`path`) +const existsSync = require(`fs-exists-cached`).sync const imageSizeCache = new Map() const getImageSize = file => { @@ -245,7 +246,7 @@ const queueJob = (job, reporter) => { } // Check if the output file already exists so we don't redo work. - if (fs.existsSync(job.outputPath)) { + if (existsSync(job.outputPath)) { return } diff --git a/packages/gatsby/src/bootstrap/get-config-file.js b/packages/gatsby/src/bootstrap/get-config-file.js index 358431b04b4b0..14c87d56950a5 100644 --- a/packages/gatsby/src/bootstrap/get-config-file.js +++ b/packages/gatsby/src/bootstrap/get-config-file.js @@ -5,6 +5,7 @@ const testRequireError = require(`../utils/test-require-error`).default const report = require(`gatsby-cli/lib/reporter`) const chalk = require(`chalk`) const path = require(`path`) +const existsSync = require(`fs-exists-cached`).sync function isNearMatch( fileName: string, @@ -45,7 +46,7 @@ module.exports = async function getConfigFile( ) console.log(``) process.exit(1) - } else if (fs.existsSync(path.join(rootDir, `src`, configName))) { + } else if (existsSync(path.join(rootDir, `src`, configName))) { console.log(``) report.error( `Your ${configName} file is in the wrong place. You've placed it in the src/ directory. It must instead be at the root of your site next to your package.json file.` diff --git a/packages/gatsby/src/bootstrap/load-plugins/load.js b/packages/gatsby/src/bootstrap/load-plugins/load.js index aa412a0bbf632..a707bbaca4384 100644 --- a/packages/gatsby/src/bootstrap/load-plugins/load.js +++ b/packages/gatsby/src/bootstrap/load-plugins/load.js @@ -5,6 +5,7 @@ const path = require(`path`) const crypto = require(`crypto`) const glob = require(`glob`) const { store } = require(`../../redux`) +const existsSync = require(`fs-exists-cached`).sync function createFileContentHash(root, globPattern) { const hash = crypto.createHash(`md5`) @@ -34,12 +35,12 @@ function createFileContentHash(root, globPattern) { */ function resolvePlugin(pluginName) { // Only find plugins when we're not given an absolute path - if (!fs.existsSync(pluginName)) { + if (!existsSync(pluginName)) { // Find the plugin in the local plugins folder const resolvedPath = slash(path.resolve(`./plugins/${pluginName}`)) - if (fs.existsSync(resolvedPath)) { - if (fs.existsSync(`${resolvedPath}/package.json`)) { + if (existsSync(resolvedPath)) { + if (existsSync(`${resolvedPath}/package.json`)) { const packageJSON = JSON.parse( fs.readFileSync(`${resolvedPath}/package.json`, `utf-8`) ) diff --git a/packages/gatsby/src/internal-plugins/load-babel-config/gatsby-node.js b/packages/gatsby/src/internal-plugins/load-babel-config/gatsby-node.js index 31fb1f758c87e..a31860cf66271 100644 --- a/packages/gatsby/src/internal-plugins/load-babel-config/gatsby-node.js +++ b/packages/gatsby/src/internal-plugins/load-babel-config/gatsby-node.js @@ -5,6 +5,7 @@ const path = require(`path`) const json5 = require(`json5`) const _ = require(`lodash`) const report = require(`gatsby-cli/lib/reporter`) +const existsSync = require(`fs-exists-cached`).sync const testRequireError = require(`../../utils/test-require-error`).default @@ -15,7 +16,7 @@ const testRequireError = require(`../../utils/test-require-error`).default */ function findBabelrc(directory) { const babelrcPath = path.join(directory, `.babelrc`) - if (fs.existsSync(babelrcPath)) { + if (existsSync(babelrcPath)) { try { const babelrc = fs.readFileSync(babelrcPath, `utf-8`) return json5.parse(babelrc) diff --git a/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js b/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js index 28ba9400a0153..eb565448987aa 100644 --- a/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js +++ b/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js @@ -21,27 +21,21 @@ let active = false // Afterwards we listen "API_RUNNING_QUEUE_EMPTY" and check // for dirty nodes before running queries. exports.runQueries = async () => { - console.log(`inside runQueries`) // Run queued dirty nodes now that we're active. let start = process.hrtime() queuedDirtyActions = _.uniq(queuedDirtyActions, a => a.payload.id) global._PROFILE({ start, name: `uniq queuedDirtyActions` }) - console.log(`hi`) const dirtyIds = findDirtyIds(queuedDirtyActions) - console.log(`hi 2`) await runQueriesForPathnames(dirtyIds) - console.log(`hi 3`) queuedDirtyActions = [] // Find ids without data dependencies (i.e. no queries have been run for // them before) and run them. const cleanIds = findIdsWithoutDataDependencies() - console.log(`hi 4`) // Run these pages await runQueriesForPathnames(cleanIds) - console.log(`hi 5`) active = true return @@ -108,14 +102,12 @@ const findIdsWithoutDataDependencies = () => { } const runQueriesForPathnames = pathnames => { - console.log(`pathnames count`, pathnames.length) const start = process.hrtime() const blah = process.hrtime() const staticQueries = pathnames.filter(p => p.slice(0, 4) === `sq--`) const pageQueries = pathnames.filter(p => p.slice(0, 4) !== `sq--`) const state = store.getState() global._PROFILE({ start: blah, name: `filter paths for running` }) - console.log(`boo`) staticQueries.forEach(id => { const start2 = process.hrtime() From 253e353d90c272b9eab145bc9281c045b76dfa62 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Fri, 29 Jun 2018 19:44:28 -0700 Subject: [PATCH 03/29] Convert node reducer to use Map --- packages/gatsby/package.json | 1 + .../__snapshots__/load-plugins.js.snap | 2 -- packages/gatsby/src/commands/build-html.js | 2 +- .../query-runner/page-query-runner.js | 8 ++--- .../query-runner/query-runner.js | 26 +++++++------- .../__tests__/__snapshots__/nodes.js.snap | 8 ++--- .../__tests__/__snapshots__/pages.js.snap | 34 +++++++++---------- packages/gatsby/src/redux/__tests__/nodes.js | 30 ++++++++-------- packages/gatsby/src/redux/__tests__/pages.js | 8 ++--- packages/gatsby/src/redux/index.js | 10 ++++-- packages/gatsby/src/redux/plugin-runner.js | 2 +- packages/gatsby/src/redux/reducers/nodes.js | 29 ++++++---------- packages/gatsby/src/utils/source-nodes.js | 4 +-- yarn.lock | 8 +++++ 14 files changed, 85 insertions(+), 87 deletions(-) diff --git a/packages/gatsby/package.json b/packages/gatsby/package.json index 6a04b5cccc76c..9d145fda3757f 100644 --- a/packages/gatsby/package.json +++ b/packages/gatsby/package.json @@ -117,6 +117,7 @@ "socket.io": "^2.0.3", "string-similarity": "^1.2.0", "style-loader": "^0.19.1", + "treeify": "^1.1.0", "type-of": "^2.0.1", "uglifyjs-webpack-plugin": "^1.2.4", "url-loader": "^1.0.1", diff --git a/packages/gatsby/src/bootstrap/load-plugins/__tests__/__snapshots__/load-plugins.js.snap b/packages/gatsby/src/bootstrap/load-plugins/__tests__/__snapshots__/load-plugins.js.snap index 32a6b68333b89..0f89592b98034 100644 --- a/packages/gatsby/src/bootstrap/load-plugins/__tests__/__snapshots__/load-plugins.js.snap +++ b/packages/gatsby/src/bootstrap/load-plugins/__tests__/__snapshots__/load-plugins.js.snap @@ -36,7 +36,6 @@ Array [ "name": "internal-data-bridge", "nodeAPIs": Array [ "sourceNodes", - "onCreatePage", ], "pluginOptions": Object { "plugins": Array [], @@ -140,7 +139,6 @@ Array [ "name": "internal-data-bridge", "nodeAPIs": Array [ "sourceNodes", - "onCreatePage", ], "pluginOptions": Object { "plugins": Array [], diff --git a/packages/gatsby/src/commands/build-html.js b/packages/gatsby/src/commands/build-html.js index e424e3e63890e..92c4fa45a6a66 100644 --- a/packages/gatsby/src/commands/build-html.js +++ b/packages/gatsby/src/commands/build-html.js @@ -13,7 +13,7 @@ module.exports = async (program: any) => { debug(`generating static HTML`) // Reduce pages objects to an array of paths. - const pages = [...store.getState().pages.values()].map(page => page.path) + const pages = Array.from(store.getState().pages.values(), page => page.path) // Static site generation. const compilerConfig = await webpackConfig( diff --git a/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js b/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js index eb565448987aa..93ea40e53f9ed 100644 --- a/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js +++ b/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js @@ -84,7 +84,7 @@ const findIdsWithoutDataDependencies = () => { // paths. const notTrackedIds = _.difference( [ - ...[...state.pages.values()].map(p => p.path), + ...Array.from(state.pages.values(), p => p.path), ...[...state.staticQueryComponents.values()].map(c => c.jsonName), ], [...allTrackedIds, ...seenIdsWithoutDataDependencies] @@ -123,12 +123,10 @@ const runQueriesForPathnames = pathnames => { queue.push(queryJob) global._PROFILE({ start: start2, name: `queue static query` }) }) - console.log(`boo 2`) const start3 = process.hrtime() - const pages = [...state.pages.values()] + const pages = Array.from(state.pages.values()) let didNotQueueItems = true - console.log(`boo 3`) pageQueries.forEach(id => { const page = pages.find(pl => pl.path === id) if (page) { @@ -149,12 +147,10 @@ const runQueriesForPathnames = pathnames => { } }) global._PROFILE({ start: start3, name: `queue page queries` }) - console.log(`boo 4`) if (didNotQueueItems || !pathnames || pathnames.length === 0) { return Promise.resolve() } - console.log(`boo 5`) return new Promise(resolve => { queue.on(`drain`, () => { diff --git a/packages/gatsby/src/internal-plugins/query-runner/query-runner.js b/packages/gatsby/src/internal-plugins/query-runner/query-runner.js index 8ea1df9505625..a2e61fbc10272 100644 --- a/packages/gatsby/src/internal-plugins/query-runner/query-runner.js +++ b/packages/gatsby/src/internal-plugins/query-runner/query-runner.js @@ -71,16 +71,18 @@ ${formatErrorDetails(errorDetails)}`) } // Delete internal data from pageContext - delete result.pageContext.jsonName - delete result.pageContext.path - delete result.pageContext.internalComponentName - delete result.pageContext.component - delete result.pageContext.componentChunkName - delete result.pageContext.updatedAt - delete result.pageContext.pluginCreator___NODE - delete result.pageContext.pluginCreatorId - delete result.pageContext.componentPath - delete result.pageContext.context + if (result.pageContext) { + delete result.pageContext.jsonName + delete result.pageContext.path + delete result.pageContext.internalComponentName + delete result.pageContext.component + delete result.pageContext.componentChunkName + delete result.pageContext.updatedAt + delete result.pageContext.pluginCreator___NODE + delete result.pageContext.pluginCreatorId + delete result.pageContext.componentPath + delete result.pageContext.context + } const resultJSON = JSON.stringify(result) const resultHash = require(`crypto`) @@ -127,9 +129,7 @@ ${formatErrorDetails(errorDetails)}`) `${dataPath}.json` ) - if (resultJSON !== ``) { - await fs.writeFile(resultPath, resultJSON) - } + await fs.writeFile(resultPath, resultJSON) store.dispatch({ type: `SET_JSON_DATA_PATH`, diff --git a/packages/gatsby/src/redux/__tests__/__snapshots__/nodes.js.snap b/packages/gatsby/src/redux/__tests__/__snapshots__/nodes.js.snap index 9b98163e97175..ce3a35ecdd3a7 100644 --- a/packages/gatsby/src/redux/__tests__/__snapshots__/nodes.js.snap +++ b/packages/gatsby/src/redux/__tests__/__snapshots__/nodes.js.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Create and update nodes allows adding fields to nodes 1`] = ` -Object { - "hi": Object { +Map { + "hi" => Object { "children": Array [], "fields": Object { "joy": "soul's delight", @@ -44,8 +44,8 @@ Object { `; exports[`Create and update nodes allows creating nodes 2`] = ` -Object { - "hi": Object { +Map { + "hi" => Object { "children": Array [], "id": "hi", "internal": Object { diff --git a/packages/gatsby/src/redux/__tests__/__snapshots__/pages.js.snap b/packages/gatsby/src/redux/__tests__/__snapshots__/pages.js.snap index 66540d525e5b0..015923e6d65c9 100644 --- a/packages/gatsby/src/redux/__tests__/__snapshots__/pages.js.snap +++ b/packages/gatsby/src/redux/__tests__/__snapshots__/pages.js.snap @@ -46,8 +46,8 @@ The following fields are used by the page object and should be avoided. `; exports[`Add pages allows you to add multiple pages 1`] = ` -Array [ - Object { +Map { + "/hi/" => Object { "component": "/whatever/index.js", "componentChunkName": "component---whatever-index-js", "context": Object {}, @@ -59,7 +59,7 @@ Array [ "pluginCreator___NODE": "test", "updatedAt": 1482363367071, }, - Object { + "/hi/pizza/" => Object { "component": "/whatever/index.js", "componentChunkName": "component---whatever-index-js", "context": Object {}, @@ -71,7 +71,7 @@ Array [ "pluginCreator___NODE": "test", "updatedAt": 1482363367071, }, -] +} `; exports[`Add pages allows you to add pages 1`] = ` @@ -98,8 +98,8 @@ Object { `; exports[`Add pages allows you to add pages 2`] = ` -Array [ - Object { +Map { + "/hi/" => Object { "component": "/whatever/index.js", "componentChunkName": "component---whatever-index-js", "context": Object {}, @@ -111,7 +111,7 @@ Array [ "pluginCreator___NODE": "test", "updatedAt": 1482363367071, }, -] +} `; exports[`Add pages allows you to add pages with context 1`] = ` @@ -140,8 +140,8 @@ Object { `; exports[`Add pages allows you to add pages with context 2`] = ` -Array [ - Object { +Map { + "/hi/" => Object { "component": "/whatever/index.js", "componentChunkName": "component---whatever-index-js", "context": Object { @@ -155,7 +155,7 @@ Array [ "pluginCreator___NODE": "test", "updatedAt": 1482363367071, }, -] +} `; exports[`Add pages allows you to add pages with matchPath 1`] = ` @@ -182,8 +182,8 @@ Object { `; exports[`Add pages allows you to add pages with matchPath 2`] = ` -Array [ - Object { +Map { + "/hi/" => Object { "component": "/whatever/index.js", "componentChunkName": "component---whatever-index-js", "context": Object {}, @@ -195,14 +195,14 @@ Array [ "pluginCreator___NODE": "test", "updatedAt": 1482363367071, }, -] +} `; -exports[`Add pages allows you to delete paths 1`] = `Array []`; +exports[`Add pages allows you to delete paths 1`] = `Map {}`; exports[`Add pages allows you to update existing pages (based on path) 1`] = ` -Array [ - Object { +Map { + "/hi/" => Object { "component": "/whatever2/index.js", "componentChunkName": "component---whatever-2-index-js", "context": Object {}, @@ -214,5 +214,5 @@ Array [ "pluginCreator___NODE": "test", "updatedAt": 1482363367071, }, -] +} `; diff --git a/packages/gatsby/src/redux/__tests__/nodes.js b/packages/gatsby/src/redux/__tests__/nodes.js index 8b78ef141d2d1..5b0b81a2ce157 100644 --- a/packages/gatsby/src/redux/__tests__/nodes.js +++ b/packages/gatsby/src/redux/__tests__/nodes.js @@ -78,9 +78,9 @@ describe(`Create and update nodes`, () => { ) let state = nodeReducer(undefined, action) state = nodeReducer(state, updateAction) - expect(state[`hi`].pickle).toEqual(false) - expect(state[`hi`].deep.array[0]).toEqual(1) - expect(state[`hi`].deep2.boom).toEqual(`foo`) + expect(state.get(`hi`).pickle).toEqual(false) + expect(state.get(`hi`).deep.array[0]).toEqual(1) + expect(state.get(`hi`).deep2.boom).toEqual(`foo`) }) it(`deletes previously transformed children nodes when the parent node is updated`, () => { @@ -121,8 +121,8 @@ describe(`Create and update nodes`, () => { store.dispatch( actions.createParentChildLink( { - parent: store.getState().nodes[`hi`], - child: store.getState().nodes[`hi-1`], + parent: store.getState().nodes.get(`hi`), + child: store.getState().nodes.get(`hi-1`), }, { name: `tests`, @@ -150,8 +150,8 @@ describe(`Create and update nodes`, () => { store.dispatch( actions.createParentChildLink( { - parent: store.getState().nodes[`hi-1`], - child: store.getState().nodes[`hi-1-1`], + parent: store.getState().nodes.get(`hi-1`), + child: store.getState().nodes.get(`hi-1-1`), }, { name: `tests`, @@ -175,7 +175,7 @@ describe(`Create and update nodes`, () => { } ) ) - expect(Object.keys(store.getState().nodes).length).toEqual(1) + expect(store.getState().nodes.size).toEqual(1) }) it(`deletes previously transformed children nodes when the parent node is deleted`, () => { @@ -230,7 +230,7 @@ describe(`Create and update nodes`, () => { store.dispatch( actions.createParentChildLink( { - parent: store.getState().nodes[`hi`], + parent: store.getState().nodes.get(`hi`), child: getNode(`hi-1`), }, { @@ -276,7 +276,7 @@ describe(`Create and update nodes`, () => { } ) ) - expect(Object.keys(store.getState().nodes).length).toEqual(1) + expect(store.getState().nodes.size).toEqual(1) }) it(`deletes previously transformed children nodes when parent nodes are deleted`, () => { @@ -355,7 +355,7 @@ describe(`Create and update nodes`, () => { name: `tests`, }) ) - expect(Object.keys(store.getState().nodes).length).toEqual(0) + expect(store.getState().nodes.size).toEqual(0) }) it(`allows deleting nodes`, () => { @@ -463,7 +463,7 @@ describe(`Create and update nodes`, () => { const addFieldAction = actions.createNodeField( { - node: state[`hi`], + node: state.get(`hi`), name: `joy`, value: `soul's delight`, }, @@ -495,7 +495,7 @@ describe(`Create and update nodes`, () => { const addFieldAction = actions.createNodeField( { - node: state[`hi`], + node: state.get(`hi`), name: `joy`, value: `soul's delight`, }, @@ -508,7 +508,7 @@ describe(`Create and update nodes`, () => { function callActionCreator() { actions.createNodeField( { - node: state[`hi`], + node: state.get(`hi`), name: `joy`, value: `soul's delight`, }, @@ -587,6 +587,6 @@ describe(`Create and update nodes`, () => { actions.deleteNode(undefined, { name: `tests`, }) - expect(Object.keys(store.getState().nodes).length).toEqual(0) + expect(store.getState().nodes.size).toEqual(0) }) }) diff --git a/packages/gatsby/src/redux/__tests__/pages.js b/packages/gatsby/src/redux/__tests__/pages.js index b19bd1c0be9c1..e73319b48b9a4 100644 --- a/packages/gatsby/src/redux/__tests__/pages.js +++ b/packages/gatsby/src/redux/__tests__/pages.js @@ -96,7 +96,7 @@ describe(`Add pages`, () => { { id: `test`, name: `test` } ) const state = reducer(undefined, action) - expect(state[0].path).toEqual(`/hi/`) + expect(Array.from(state.values())[0].path).toEqual(`/hi/`) }) it(`allows you to add pages with context`, () => { @@ -150,7 +150,7 @@ describe(`Add pages`, () => { let state = reducer(undefined, action) state = reducer(state, action2) expect(state).toMatchSnapshot() - expect(state.length).toEqual(2) + expect(state.size).toEqual(2) }) it(`allows you to update existing pages (based on path)`, () => { @@ -175,7 +175,7 @@ describe(`Add pages`, () => { let state = reducer(undefined, action) state = reducer(state, action2) expect(state).toMatchSnapshot() - expect(state.length).toEqual(1) + expect(state.size).toEqual(1) }) it(`allows you to delete paths`, () => { @@ -192,6 +192,6 @@ describe(`Add pages`, () => { let state = reducer(undefined, action) state = reducer(state, action2) expect(state).toMatchSnapshot() - expect(state.length).toEqual(0) + expect(state.size).toEqual(0) }) }) diff --git a/packages/gatsby/src/redux/index.js b/packages/gatsby/src/redux/index.js index 9518498e0b91f..1295d7dd33125 100644 --- a/packages/gatsby/src/redux/index.js +++ b/packages/gatsby/src/redux/index.js @@ -18,6 +18,11 @@ try { initialState = JSON.parse( fs.readFileSync(`${process.cwd()}/.cache/redux-state.json`) ) + const nodes = new Map() + Object.keys(initialState.nodes).forEach(key => { + nodes.set(key, initialState.nodes[key]) + }) + initialState.nodes = nodes } catch (e) { // ignore errors. } @@ -92,10 +97,9 @@ exports.store = store * @returns {Array} */ exports.getNodes = () => { - let nodes = _.values(store.getState().nodes) - return nodes ? nodes : [] + return Array.from(store.getState().nodes.values()) } -const getNode = id => store.getState().nodes[id] +const getNode = id => store.getState().nodes.get(id) /** Get node by id from store. * diff --git a/packages/gatsby/src/redux/plugin-runner.js b/packages/gatsby/src/redux/plugin-runner.js index bf27187676b60..55f51dd8726c4 100644 --- a/packages/gatsby/src/redux/plugin-runner.js +++ b/packages/gatsby/src/redux/plugin-runner.js @@ -4,7 +4,7 @@ const { store, emitter } = require(`./index`) const apiRunnerNode = require(`../utils/api-runner-node`) emitter.on(`CREATE_NODE`, action => { - const node = store.getState().nodes[action.payload.id] + const node = store.getState().nodes.get(action.payload.id) apiRunnerNode(`onCreateNode`, { node, traceId: action.traceId }) }) diff --git a/packages/gatsby/src/redux/reducers/nodes.js b/packages/gatsby/src/redux/reducers/nodes.js index e375682ec4211..86f4d1f5f710f 100644 --- a/packages/gatsby/src/redux/reducers/nodes.js +++ b/packages/gatsby/src/redux/reducers/nodes.js @@ -1,34 +1,25 @@ -const _ = require(`lodash`) - -module.exports = (state = {}, action) => { - let newState +module.exports = (state = new Map(), action) => { switch (action.type) { case `DELETE_CACHE`: - return {} + return new Map() case `CREATE_NODE`: { - newState = { - ...state, - [action.payload.id]: action.payload, - } - return newState + state.set(action.payload.id, action.payload) + return state } case `ADD_FIELD_TO_NODE`: case `ADD_CHILD_NODE_TO_PARENT_NODE`: - newState = { - ...state, - [action.payload.id]: action.payload, - } - return newState + state.set(action.payload.id, action.payload) + return state case `DELETE_NODE`: { - newState = _.omit(state, action.payload.id) - return newState + state.delete(action.payload.id) + return state } case `DELETE_NODES`: { - newState = _.omit(state, action.payload) - return newState + action.payload.forEach(id => state.delete(id)) + return state } default: diff --git a/packages/gatsby/src/utils/source-nodes.js b/packages/gatsby/src/utils/source-nodes.js index 232776ea020be..40d98190595e7 100644 --- a/packages/gatsby/src/utils/source-nodes.js +++ b/packages/gatsby/src/utils/source-nodes.js @@ -18,7 +18,7 @@ function discoverPluginsWithoutNodes(storeState) { ) // Find out which plugins own already created nodes const nodeOwners = _.uniq( - _.values(storeState.nodes).reduce((acc, node) => { + Array.from(storeState.nodes.values()).reduce((acc, node) => { acc.push(node.internal.owner) return acc }, []) @@ -44,7 +44,7 @@ module.exports = async () => { // Garbage collect stale data nodes const touchedNodes = Object.keys(state.nodesTouched) - const staleNodes = _.values(state.nodes).filter(node => { + const staleNodes = Array.from(state.nodes.values()).filter(node => { // Find the root node. let rootNode = node let whileCount = 0 diff --git a/yarn.lock b/yarn.lock index 257d88b8406e6..dd8706f29d2c6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6659,6 +6659,10 @@ fs-copy-file-sync@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/fs-copy-file-sync/-/fs-copy-file-sync-1.1.1.tgz#11bf32c096c10d126e5f6b36d06eece776062918" +fs-exists-cached@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs-exists-cached/-/fs-exists-cached-1.0.0.tgz#cf25554ca050dc49ae6656b41de42258989dcbce" + fs-extra@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-2.0.0.tgz#337352bded4a0b714f3eb84de8cea765e9d37600" @@ -15317,6 +15321,10 @@ tr46@^1.0.1: dependencies: punycode "^2.1.0" +treeify@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/treeify/-/treeify-1.1.0.tgz#4e31c6a463accd0943879f30667c4fdaff411bb8" + trim-lines@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/trim-lines/-/trim-lines-1.1.1.tgz#da738ff58fa74817588455e30b11b85289f2a396" From 84c516ab820518def536341e069eca31f9c10b2f Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Fri, 29 Jun 2018 20:52:28 -0700 Subject: [PATCH 04/29] Fix most lint errors --- packages/gatsby-cli/src/create-cli.js | 1 - packages/gatsby-plugin-page-creator/src/gatsby-node.js | 1 - packages/gatsby/src/redux/index.js | 4 +--- packages/gatsby/src/redux/reducers/components.js | 7 ------- packages/gatsby/src/utils/profile.js | 8 +++----- 5 files changed, 4 insertions(+), 17 deletions(-) diff --git a/packages/gatsby-cli/src/create-cli.js b/packages/gatsby-cli/src/create-cli.js index e8ccac5977fbf..385222f6cba09 100644 --- a/packages/gatsby-cli/src/create-cli.js +++ b/packages/gatsby-cli/src/create-cli.js @@ -2,7 +2,6 @@ const path = require(`path`) const resolveCwd = require(`resolve-cwd`) const yargs = require(`yargs`) const report = require(`./reporter`) -const fs = require(`fs`) const envinfo = require(`envinfo`) const existsSync = require(`fs-exists-cached`).sync diff --git a/packages/gatsby-plugin-page-creator/src/gatsby-node.js b/packages/gatsby-plugin-page-creator/src/gatsby-node.js index 04bdcb4cec2b4..0b84b88f3fb08 100644 --- a/packages/gatsby-plugin-page-creator/src/gatsby-node.js +++ b/packages/gatsby-plugin-page-creator/src/gatsby-node.js @@ -3,7 +3,6 @@ const Promise = require(`bluebird`) const _ = require(`lodash`) const chokidar = require(`chokidar`) const systemPath = require(`path`) -const fs = require(`fs`) const existsSync = require(`fs-exists-cached`).sync const glob = Promise.promisify(globCB) diff --git a/packages/gatsby/src/redux/index.js b/packages/gatsby/src/redux/index.js index 1295d7dd33125..06a4c384b6e46 100644 --- a/packages/gatsby/src/redux/index.js +++ b/packages/gatsby/src/redux/index.js @@ -96,9 +96,7 @@ exports.store = store * * @returns {Array} */ -exports.getNodes = () => { - return Array.from(store.getState().nodes.values()) -} +exports.getNodes = () => Array.from(store.getState().nodes.values()) const getNode = id => store.getState().nodes.get(id) /** Get node by id from store. diff --git a/packages/gatsby/src/redux/reducers/components.js b/packages/gatsby/src/redux/reducers/components.js index 8565947497574..62b5e36d38929 100644 --- a/packages/gatsby/src/redux/reducers/components.js +++ b/packages/gatsby/src/redux/reducers/components.js @@ -1,13 +1,11 @@ const _ = require(`lodash`) const normalize = require(`normalize-path`) -const profile = require(`../../utils/profile`) module.exports = (state = {}, action) => { switch (action.type) { case `DELETE_CACHE`: return {} case `CREATE_PAGE`: - const start = process.hrtime() action.payload.componentPath = normalize(action.payload.component) state[action.payload.componentPath] = _.merge( { query: `` }, @@ -16,11 +14,6 @@ module.exports = (state = {}, action) => { componentPath: action.payload.componentPath, } ) - profile({ - start, - name: `reducers/components`, - parent: `site createPages`, - }) return state case `DELETE_PAGE`: action.payload.componentPath = normalize(action.payload.component) diff --git a/packages/gatsby/src/utils/profile.js b/packages/gatsby/src/utils/profile.js index 4a9d5fe5a3819..dc0dd0a5b2bfa 100644 --- a/packages/gatsby/src/utils/profile.js +++ b/packages/gatsby/src/utils/profile.js @@ -1,7 +1,6 @@ const convertHrtime = require(`convert-hrtime`) const _ = require(`lodash`) const treeify = require(`treeify`) -const deepMapKeys = require(`deep-map-keys`) let root = { ROOT: process.hrtime(), @@ -31,15 +30,14 @@ const profile = ({ name, start, parent }) => { global._PROFILE = profile module.exports = profile -const labelify = (object, rootValue) => { - return _.mapKeys(object, (value, key, o) => { +const labelify = (object, rootValue) => + _.mapKeys(object, (value, key, o) => { const currentValue = _.isObject(value) ? value.ROOT : value return `${key}: ${currentValue}ms | ${( (currentValue / rootValue) * 100 - ).toFixed(2) + "%"}` + ).toFixed(2) + `%`}` }) -} process.on(`exit`, () => { root.ROOT = convertHrtime(process.hrtime(root.ROOT)).milliseconds From 266f5ae81c52a69e436115826e39dade35d3f3c4 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Tue, 3 Jul 2018 19:53:54 -0600 Subject: [PATCH 05/29] Split writing page data json files into 999 folders to speed writes --- packages/gatsby/package.json | 1 + packages/gatsby/src/bootstrap/index.js | 9 +++++++-- .../internal-plugins/query-runner/query-runner.js | 14 ++++++++++---- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/packages/gatsby/package.json b/packages/gatsby/package.json index 2af8c14493a69..c1d79ff70cd71 100644 --- a/packages/gatsby/package.json +++ b/packages/gatsby/package.json @@ -70,6 +70,7 @@ "graphql-relay": "^0.5.5", "graphql-skip-limit": "^2.0.0-beta.2", "graphql-type-json": "^0.2.1", + "hash-mod": "^0.0.5", "history": "^4.6.2", "invariant": "^2.2.4", "is-relative": "^1.0.0", diff --git a/packages/gatsby/src/bootstrap/index.js b/packages/gatsby/src/bootstrap/index.js index 7ae341d6b0fd3..655489514a362 100644 --- a/packages/gatsby/src/bootstrap/index.js +++ b/packages/gatsby/src/bootstrap/index.js @@ -159,8 +159,13 @@ module.exports = async (args: BootstrapArgs) => { // directory. initCache() - // Ensure the public/static directory is created. - await fs.ensureDirSync(`${program.directory}/public/static/d`) + // Ensure the public/static directory and data subdirectories are created. + await fs.ensureDir(`${program.directory}/public/static`) + await Promise.all( + _.range(0, 999).map(i => + fs.ensureDir(`${program.directory}/public/static/d/${i}`) + ) + ) // Copy our site files to the root of the site. activity = report.activityTimer(`copy gatsby files`) diff --git a/packages/gatsby/src/internal-plugins/query-runner/query-runner.js b/packages/gatsby/src/internal-plugins/query-runner/query-runner.js index a2e61fbc10272..fc7a24c2e33de 100644 --- a/packages/gatsby/src/internal-plugins/query-runner/query-runner.js +++ b/packages/gatsby/src/internal-plugins/query-runner/query-runner.js @@ -9,6 +9,7 @@ const path = require(`path`) const { store } = require(`../../redux`) const { generatePathChunkName } = require(`../../utils/js-chunk-names`) const { formatErrorDetails } = require(`./utils`) +const mod = require(`hash-mod`)(999) const resultHashes = {} @@ -66,8 +67,8 @@ ${formatErrorDetails(errorDetails)}`) } // Add the page context onto the results. - if (queryJob?.isPage) { - result[`pageContext`] = { ...queryJob.context } + if (queryJob && queryJob.isPage) { + result[`pageContext`] = Object.assign({}, queryJob.context) } // Delete internal data from pageContext @@ -95,7 +96,7 @@ ${formatErrorDetails(errorDetails)}`) .replace(/[^a-zA-Z0-9-_]/g, ``) let dataPath - if (queryJob?.isPage) { + if (queryJob.isPage) { dataPath = `${generatePathChunkName(queryJob.jsonName)}-${resultHash}` } else { dataPath = queryJob.hash @@ -119,6 +120,7 @@ ${formatErrorDetails(errorDetails)}`) if (resultHashes[queryJob.id] !== resultHash) { resultHashes[queryJob.id] = resultHash + const modInt = mod(dataPath).toString() // Always write file to public/static/d/ folder. const resultPath = path.join( @@ -126,13 +128,17 @@ ${formatErrorDetails(errorDetails)}`) `public`, `static`, `d`, + modInt, `${dataPath}.json` ) + dataPath = `${modInt}/${dataPath}` + await fs.writeFile(resultPath, resultJSON) store.dispatch({ - type: `SET_JSON_DATA_PATH`, + type: ` + SET_JSON_DATA_PATH `, payload: { [queryJob.jsonName]: dataPath, }, From 110b99e9103439532668b28d4c57be73b6103b6b Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Thu, 5 Jul 2018 13:37:53 -0600 Subject: [PATCH 06/29] Use forEach instead of reduce when prepping page data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For building a 25k page site, it reduced the time spent writing out page data from 32 seconds to 0.32 seconds 😱 --- .../query-runner/pages-writer.js | 44 ++++++++++--------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/packages/gatsby/src/internal-plugins/query-runner/pages-writer.js b/packages/gatsby/src/internal-plugins/query-runner/pages-writer.js index 8fa2e37a7e635..6f42f78ab2914 100644 --- a/packages/gatsby/src/internal-plugins/query-runner/pages-writer.js +++ b/packages/gatsby/src/internal-plugins/query-runner/pages-writer.js @@ -17,26 +17,26 @@ const writePages = async () => { const pagesComponentDependencies = {} // Write out pages.json - const pagesData = _.sortBy( - pages.reduce((mem, { path, matchPath, componentChunkName, jsonName }) => { - const pageComponentsChunkNames = { - componentChunkName, - } - - if (program._[0] === `develop`) { - pagesComponentDependencies[path] = pageComponentsChunkNames - } - - return [ - ...mem, - { - ...pageComponentsChunkNames, - jsonName, - path, - matchPath, - }, - ] - }, []), + let pagesData = [] + pages.forEach(({ path, matchPath, componentChunkName, jsonName }) => { + const pageComponentsChunkNames = { + componentChunkName, + } + + if (program._[0] === `develop`) { + pagesComponentDependencies[path] = pageComponentsChunkNames + } + + pagesData.push({ + ...pageComponentsChunkNames, + jsonName, + path, + matchPath, + }) + }) + + pagesData = _.sortBy( + pagesData, // Sort pages with matchPath to end so explicit routes // will match before general. p => (p.matchPath ? 1 : 0) @@ -113,7 +113,7 @@ const preferDefault = m => m && m.default || m .then(() => fs.move(tmp, destination, { overwrite: true })) } - return await Promise.all([ + const result = await Promise.all([ writeAndMove(`pages.json`, JSON.stringify(pagesData, null, 4)), writeAndMove(`sync-requires.js`, syncRequires), writeAndMove(`async-requires.js`, asyncRequires), @@ -125,6 +125,8 @@ const preferDefault = m => m && m.default || m }) ), ]) + + return result } exports.writePages = writePages From 710d9d81b5c6813f1ffa9bd997e16ad42b2a7371 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Thu, 5 Jul 2018 19:34:20 -0600 Subject: [PATCH 07/29] Profiled code and fixed hot functions --- packages/gatsby/cache-dir/static-entry.js | 6 +- .../query-runner/page-query-runner.js | 4 +- packages/gatsby/src/utils/api-runner-node.js | 64 +++++++++++-------- 3 files changed, 43 insertions(+), 31 deletions(-) diff --git a/packages/gatsby/cache-dir/static-entry.js b/packages/gatsby/cache-dir/static-entry.js index b677047053c28..6e9ce14f2ea00 100644 --- a/packages/gatsby/cache-dir/static-entry.js +++ b/packages/gatsby/cache-dir/static-entry.js @@ -9,6 +9,10 @@ const apiRunner = require(`./api-runner-ssr`) const syncRequires = require(`./sync-requires`) const { dataPaths, pages } = require(`./data.json`) +// Speed up looking up pages. +const pagesObjectMap = new Map() +pages.forEach(p => pagesObjectMap.set(p.path, p)) + const stats = JSON.parse( fs.readFileSync(`${process.cwd()}/public/webpack.stats.json`, `utf-8`) ) @@ -48,7 +52,7 @@ function urlJoin(...parts) { }, ``) } -const getPage = path => pages.find(page => page.path === path) +const getPage = path => pagesObjectMap.get(path) const createElement = React.createElement diff --git a/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js b/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js index 93ea40e53f9ed..6d06359597f03 100644 --- a/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js +++ b/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js @@ -125,10 +125,10 @@ const runQueriesForPathnames = pathnames => { }) const start3 = process.hrtime() - const pages = Array.from(state.pages.values()) + const pages = state.pages let didNotQueueItems = true pageQueries.forEach(id => { - const page = pages.find(pl => pl.path === id) + const page = pages.get(id) if (page) { didNotQueueItems = false queue.push( diff --git a/packages/gatsby/src/utils/api-runner-node.js b/packages/gatsby/src/utils/api-runner-node.js index 5e99a354b1892..c5533f3f119b8 100644 --- a/packages/gatsby/src/utils/api-runner-node.js +++ b/packages/gatsby/src/utils/api-runner-node.js @@ -2,8 +2,6 @@ const Promise = require(`bluebird`) const glob = require(`glob`) const _ = require(`lodash`) -const mapSeries = require(`async/mapSeries`) - const reporter = require(`gatsby-cli/lib/reporter`) const cache = require(`./cache`) const apiList = require(`./api-node-docs`) @@ -106,7 +104,8 @@ const runAPI = (plugin, api, args) => { let filteredPlugins const hasAPIFile = plugin => glob.sync(`${plugin.resolve}/gatsby-node*`)[0] -let apisRunning = [] +let apisRunningById = new Map() +let apisRunningByTraceId = new Map() let waitingForCasacadeToFinish = [] module.exports = async (api, args = {}, pluginSource) => @@ -139,42 +138,53 @@ module.exports = async (api, args = {}, pluginSource) => const apiRunInstance = { api, - start: process.hrtime(), args, pluginSource, resolve, startTime: new Date().toJSON(), traceId: args.traceId, } + apiRunInstance.id = `${api}|${apiRunInstance.startTime}|${ + apiRunInstance.traceId + }|${JSON.stringify(args)}` if (args.waitForCascadingActions) { waitingForCasacadeToFinish.push(apiRunInstance) } - apisRunning.push(apiRunInstance) + apisRunningById.set(apiRunInstance.id, apiRunInstance) + if (apisRunningByTraceId.has(apiRunInstance.traceId)) { + const currentCount = apisRunningByTraceId.get(apiRunInstance.traceId) + apisRunningByTraceId.set(apiRunInstance.traceId, currentCount + 1) + } else { + apisRunningByTraceId.set(apiRunInstance.traceId, 1) + } let pluginName = null - mapSeries( - noSourcePluginPlugins, - (plugin, callback) => { - if (plugin.name === `default-site-plugin`) { - pluginName = `gatsby-node.js` - } else { - pluginName = `Plugin ${plugin.name}` - } - Promise.resolve(runAPI(plugin, api, args)).asCallback(callback) - }, - (err, results) => { + Promise.mapSeries(noSourcePluginPlugins, plugin => { + if (plugin.name === `default-site-plugin`) { + pluginName = `gatsby-node.js` + } else { + pluginName = `Plugin ${plugin.name}` + } + return Promise.resolve(runAPI(plugin, api, args)) + }) + .catch(err => { if (err) { if (process.env.NODE_ENV === `production`) { return reporter.panic(`${pluginName} returned an error`, err) } return reporter.error(`${pluginName} returned an error`, err) } + return null + }) + .then(results => { // Remove runner instance - apisRunning = apisRunning.filter(runner => runner !== apiRunInstance) + apisRunningById.delete(apiRunInstance.id) + const currentCount = apisRunningByTraceId.get(apiRunInstance.traceId) + apisRunningByTraceId.set(apiRunInstance.traceId, currentCount - 1) - if (apisRunning.length === 0) { + if (apisRunningById.size === 0) { const { emitter } = require(`../redux`) emitter.emit(`API_RUNNING_QUEUE_EMPTY`) } @@ -185,26 +195,24 @@ module.exports = async (api, args = {}, pluginSource) => // Filter out empty responses and return if the // api caller isn't waiting for cascading actions to finish. if (!args.waitForCascadingActions) { - // console.log({ name: apiRunInstance.api }) - global._PROFILE({ - start: apiRunInstance.start, - name: `nodeAPI/${apiRunInstance.api}`, - }) resolve(apiRunInstance.results) } // Check if any of our waiters are done. - return (waitingForCasacadeToFinish = waitingForCasacadeToFinish.filter( + waitingForCasacadeToFinish = waitingForCasacadeToFinish.filter( instance => { // If none of its trace IDs are running, it's done. - if (!_.some(apisRunning, a => a.traceId === instance.traceId)) { + const apisByTraceIdCount = apisRunningByTraceId.get( + instance.traceId + ) + if (apisByTraceIdCount === 0) { instance.resolve(instance.results) return false } else { return true } } - )) - } - ) + ) + return + }) }) From 6a8e9a05ac95a41f5bc02d002bc73be4dec6a604 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Fri, 6 Jul 2018 19:03:02 -0600 Subject: [PATCH 08/29] WIP commit to dramatically speed up graphql queries Not really loving all the nested caching I'm adding... but it's necessary. Will revisit this Monday to see if there's a cleaner way to cache things. --- .../src/extend-node-type.js | 6 + .../query-runner/gatsby-node.js | 9 +- .../query-runner/page-query-runner.js | 1 - .../query-runner/query-runner.js | 21 ++- packages/gatsby/src/joi-schemas/joi.js | 16 +- packages/gatsby/src/redux/actions.js | 12 +- packages/gatsby/src/redux/index.js | 1 + .../src/redux/reducers/json-data-paths.js | 6 +- .../gatsby/src/schema/build-node-types.js | 40 ++++- packages/gatsby/src/schema/node-tracking.js | 10 -- packages/gatsby/src/schema/run-sift.js | 137 ++++++++++++++---- packages/gatsby/src/utils/cache.js | 47 ++---- packages/gatsby/src/utils/profile.js | 24 +++ 13 files changed, 232 insertions(+), 98 deletions(-) diff --git a/packages/gatsby-transformer-remark/src/extend-node-type.js b/packages/gatsby-transformer-remark/src/extend-node-type.js index 0f50c194df2c0..a3be3fe81a5c7 100644 --- a/packages/gatsby-transformer-remark/src/extend-node-type.js +++ b/packages/gatsby-transformer-remark/src/extend-node-type.js @@ -24,6 +24,8 @@ const remark2retext = require(`remark-retext`) const stripPosition = require(`unist-util-remove-position`) const hastReparseRaw = require(`hast-util-raw`) +global.mdToHTML = [] + let pluginsCacheStr = `` let pathPrefixCacheStr = `` const astCacheKey = node => @@ -280,6 +282,7 @@ module.exports = ( if (cachedHTML) { return cachedHTML } else { + const start = process.hrtime() const ast = await getHTMLAst(markdownNode) // Save new HTML to cache and return const html = hastToHTML(ast, { @@ -288,6 +291,9 @@ module.exports = ( // Save new HTML to cache and return cache.set(htmlCacheKey(markdownNode), html) + global.mdToHTML.push( + require(`convert-hrtime`)(process.hrtime(start)).milliseconds + ) return html } } diff --git a/packages/gatsby/src/internal-plugins/query-runner/gatsby-node.js b/packages/gatsby/src/internal-plugins/query-runner/gatsby-node.js index 030587b767492..315f757847589 100644 --- a/packages/gatsby/src/internal-plugins/query-runner/gatsby-node.js +++ b/packages/gatsby/src/internal-plugins/query-runner/gatsby-node.js @@ -5,7 +5,14 @@ let components = {} exports.onCreatePage = ({ page, store }) => { // In development, watch the component to detect query changes. if (process.env.NODE_ENV !== `production`) { - const component = store.getState().components[page.componentPath] + const component = store.getState().components.get(page.componentPath) + + if (!component) { + console.log({ components: store.getState().components }) + console.log({ page }) + console.log({ component }) + process.exit() + } if (components[component.componentPath]) { return diff --git a/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js b/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js index 4a349c797b3ae..e30afd50a4235 100644 --- a/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js +++ b/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js @@ -35,7 +35,6 @@ exports.runInitialQueries = async () => { const runQueries = async () => { // Find paths dependent on dirty nodes queuedDirtyActions = _.uniq(queuedDirtyActions, a => a.payload.id) - global._PROFILE({ start, name: `uniq queuedDirtyActions` }) const dirtyIds = findDirtyIds(queuedDirtyActions) queuedDirtyActions = [] diff --git a/packages/gatsby/src/internal-plugins/query-runner/query-runner.js b/packages/gatsby/src/internal-plugins/query-runner/query-runner.js index fc7a24c2e33de..5137461a1964b 100644 --- a/packages/gatsby/src/internal-plugins/query-runner/query-runner.js +++ b/packages/gatsby/src/internal-plugins/query-runner/query-runner.js @@ -10,6 +10,7 @@ const { store } = require(`../../redux`) const { generatePathChunkName } = require(`../../utils/js-chunk-names`) const { formatErrorDetails } = require(`./utils`) const mod = require(`hash-mod`)(999) +const convertHrtime = require(`convert-hrtime`) const resultHashes = {} @@ -23,8 +24,13 @@ type QueryJob = { isPage: Boolean, } +global.queryRuns = [] +global.actualQuery = [] +global.writeQueryResult = [] + // Run query module.exports = async (queryJob: QueryJob, component: Any) => { + const start = process.hrtime() const { schema, program } = store.getState() const graphql = (query, context) => @@ -37,7 +43,11 @@ module.exports = async (queryJob: QueryJob, component: Any) => { if (!queryJob.query || queryJob.query === ``) { result = {} } else { + const startQuery = process.hrtime() result = await graphql(queryJob.query, queryJob.context) + global.actualQuery.push( + convertHrtime(process.hrtime(startQuery)).milliseconds + ) } // If there's a graphql error then log the error. If we're building, also @@ -134,16 +144,21 @@ ${formatErrorDetails(errorDetails)}`) dataPath = `${modInt}/${dataPath}` + const startWriteFile = process.hrtime() await fs.writeFile(resultPath, resultJSON) + global.writeQueryResult.push( + convertHrtime(process.hrtime(startWriteFile)).milliseconds + ) store.dispatch({ - type: ` - SET_JSON_DATA_PATH `, + type: `SET_JSON_DATA_PATH`, payload: { - [queryJob.jsonName]: dataPath, + key: queryJob.jsonName, + value: dataPath, }, }) + global.queryRuns.push(convertHrtime(process.hrtime(start)).milliseconds) return } } diff --git a/packages/gatsby/src/joi-schemas/joi.js b/packages/gatsby/src/joi-schemas/joi.js index 2eef9c03d3bd1..664dd4122a22e 100644 --- a/packages/gatsby/src/joi-schemas/joi.js +++ b/packages/gatsby/src/joi-schemas/joi.js @@ -28,16 +28,8 @@ export const pageSchema = Joi.object() export const nodeSchema = Joi.object() .keys({ id: Joi.string().required(), - children: Joi.array() - .items(Joi.string(), Joi.object().forbidden()) - .required(), - parent: Joi.string() - .allow(null) - .required() - .error( - () => - `"parent" must be the "id" of another node or if there is no parent (common), "null"` - ), + children: Joi.array().items(Joi.string(), Joi.object().forbidden()), + parent: Joi.string().allow(null), fields: Joi.object(), internal: Joi.object() .keys({ @@ -49,6 +41,8 @@ export const nodeSchema = Joi.object() content: Joi.string().allow(``), description: Joi.string(), }) - .unknown({ allow: false }), // Don't allow non-standard fields + .unknown({ + allow: false, + }), // Don't allow non-standard fields }) .unknown() diff --git a/packages/gatsby/src/redux/actions.js b/packages/gatsby/src/redux/actions.js index 224bbd9fe596a..a18fbc58531f4 100644 --- a/packages/gatsby/src/redux/actions.js +++ b/packages/gatsby/src/redux/actions.js @@ -469,12 +469,22 @@ actions.createNode = (node: any, plugin?: Plugin, traceId?: string) => { node.internal = {} } + // Ensure the new node has a children array. + if (!node.array && !_.isArray(node.children)) { + node.children = [] + } + + // Ensure the new node has a parent field + if (!node.parent) { + node.parent = null + } + // Tell user not to set the owner name themself. if (node.internal.owner) { console.log(JSON.stringify(node, null, 4)) console.log( chalk.bold.red( - `The node internal.owner field is set automatically by Gatsby and not by plugin` + `The node internal.owner field is set automatically by Gatsby and not by plugins` ) ) process.exit(1) diff --git a/packages/gatsby/src/redux/index.js b/packages/gatsby/src/redux/index.js index 87d3e432af2fa..9610caf81b268 100644 --- a/packages/gatsby/src/redux/index.js +++ b/packages/gatsby/src/redux/index.js @@ -32,6 +32,7 @@ try { initialState.staticQueryComponents ) initialState.components = objectToMap(initialState.components) + initialState.nodes = objectToMap(initialState.nodes) } catch (e) { // ignore errors. } diff --git a/packages/gatsby/src/redux/reducers/json-data-paths.js b/packages/gatsby/src/redux/reducers/json-data-paths.js index b69a4b34a2f70..8238a1708757a 100644 --- a/packages/gatsby/src/redux/reducers/json-data-paths.js +++ b/packages/gatsby/src/redux/reducers/json-data-paths.js @@ -5,10 +5,8 @@ module.exports = (state = {}, action) => { // case `DELETE_ALL_JSON_DATA_PATHS`: // return {} case `SET_JSON_DATA_PATH`: - return { - ...state, - ...action.payload, - } + state[action.payload.key] = action.payload.value + return state // case `DELETE_JSON_DATA_PATH`: // return omit(state, action.payload) default: diff --git a/packages/gatsby/src/schema/build-node-types.js b/packages/gatsby/src/schema/build-node-types.js index fcf4335c77fa2..dd433e78b5ae9 100644 --- a/packages/gatsby/src/schema/build-node-types.js +++ b/packages/gatsby/src/schema/build-node-types.js @@ -23,7 +23,11 @@ const { clearTypeExampleValues } = require(`./data-tree-utils`) import type { ProcessedNodeType } from "./infer-graphql-type" -type TypeMap = { [typeName: string]: ProcessedNodeType } +type TypeMap = { + [typeName: string]: ProcessedNodeType, +} + +const nodesCache = new Map() module.exports = async () => { const types = _.groupBy(getNodes(), node => node.internal.type) @@ -85,7 +89,10 @@ module.exports = async () => { // Add dependencies for the path filteredNodes.forEach(n => - createPageDependency({ path, nodeId: n.id }) + createPageDependency({ + path, + nodeId: n.id, + }) ) return filteredNodes }, @@ -103,7 +110,10 @@ module.exports = async () => { if (childNode) { // Add dependencies for the path - createPageDependency({ path, nodeId: childNode.id }) + createPageDependency({ + path, + nodeId: childNode.id, + }) return childNode } return null @@ -172,17 +182,31 @@ module.exports = async () => { args: filterFields, resolve(a, args, context) { const runSift = require(`./run-sift`) - const latestNodes = _.filter( - getNodes(), - n => n.internal.type === typeName - ) + let latestNodes + if ( + process.env.NODE_ENV === `production` && + nodesCache.has(typeName) + ) { + latestNodes = nodesCache.get(typeName) + } else { + latestNodes = _.filter( + getNodes(), + n => n.internal.type === typeName + ) + nodesCache.set(typeName, latestNodes) + } if (!_.isObject(args)) { args = {} } return runSift({ - args: { filter: { ...args } }, + args: { + filter: { + ...args, + }, + }, nodes: latestNodes, path: context.path ? context.path : ``, + typeName: typeName, type: gqlType, }) }, diff --git a/packages/gatsby/src/schema/node-tracking.js b/packages/gatsby/src/schema/node-tracking.js index c4ab1282cdf8c..495e720d44bab 100644 --- a/packages/gatsby/src/schema/node-tracking.js +++ b/packages/gatsby/src/schema/node-tracking.js @@ -29,16 +29,7 @@ const addRootNodeToInlineObject = (data, nodeId) => { * and that Node object. * @param {Node} node Root Node */ -// const nodeDigestTracked = new Set() const trackInlineObjectsInRootNode = node => { - // const id = - // node && node.internal && node.internal.contentDigest - // ? node.internal.contentDigest - // : node.id - // if (nodeDigestTracked.has(id)) { - // return node - // } - _.each(node, (v, k) => { // Ignore the node internal object. if (k === `internal`) { @@ -47,7 +38,6 @@ const trackInlineObjectsInRootNode = node => { addRootNodeToInlineObject(v, node.id) }) - // nodeDigestTracked.add(id) return node } exports.trackInlineObjectsInRootNode = trackInlineObjectsInRootNode diff --git a/packages/gatsby/src/schema/run-sift.js b/packages/gatsby/src/schema/run-sift.js index be8fa5fb47e2f..15bdc12578c5c 100644 --- a/packages/gatsby/src/schema/run-sift.js +++ b/packages/gatsby/src/schema/run-sift.js @@ -7,16 +7,30 @@ const prepareRegex = require(`./prepare-regex`) const Promise = require(`bluebird`) const { trackInlineObjectsInRootNode } = require(`./node-tracking`) +const resolvedNodesCache = new Map() const enhancedNodeCache = new Map() +const enhancedNodePromiseCache = new Map() const enhancedNodeCacheId = ({ node, args }) => node && node.internal && node.internal.contentDigest - ? `${node.id}${node.internal.contentDigest}${JSON.stringify(args)}` + ? JSON.stringify({ + nodeid: node.id, + digest: node.internal.contentDigest, + ...args, + }) : null function awaitSiftField(fields, node, k) { const field = fields[k] if (field.resolve) { - return field.resolve(node, {}, {}, { fieldName: k }) + console.log(`resolving`, field) + return field.resolve( + node, + {}, + {}, + { + fieldName: k, + } + ) } else if (node[k] !== undefined) { return node[k] } @@ -24,18 +38,25 @@ function awaitSiftField(fields, node, k) { return undefined } +global.runSift = [] +global.promiseMapTimes = [] +global.resolveRecursive = [] +global.trackInline = [] + /* -* Filters a list of nodes using mongodb-like syntax. -* Returns a single unwrapped element if connection = false. -* -*/ + * Filters a list of nodes using mongodb-like syntax. + * Returns a single unwrapped element if connection = false. + * + */ module.exports = ({ args, nodes, type, + typeName, connection = false, path = ``, }: Object) => { + const startSift = process.hrtime() // Clone args as for some reason graphql-js removes the constructor // from nested objects which breaks a check in sift.js. const clonedArgs = JSON.parse(JSON.stringify(args)) @@ -81,13 +102,18 @@ module.exports = ({ // Ignore connection and sorting args. if (_.includes([`skip`, `limit`, `sort`], k)) return - siftArgs.push(siftifyArgs({ [k]: v })) + siftArgs.push( + siftifyArgs({ + [k]: v, + }) + ) extractFieldsToSift(``, k, {}, fieldsToSift, v) }) } // Resolves every field used in the node. function resolveRecursive(node, siftFieldsObj, gqFields) { + const start = process.hrtime() return Promise.all( _.keys(siftFieldsObj).map(k => Promise.resolve(awaitSiftField(gqFields, node, k)) @@ -113,35 +139,76 @@ module.exports = ({ .then(v => [k, v]) ) ).then(resolvedFields => { - const myNode = { ...node } + const myNode = { + ...node, + } resolvedFields.forEach(([k, v]) => (myNode[k] = v)) + global.resolveRecursive.push( + require(`convert-hrtime`)(process.hrtime(start)).milliseconds + ) return myNode }) } - return Promise.all( - nodes.map(node => { - const cacheKey = enhancedNodeCacheId({ node, args: fieldsToSift }) - if (cacheKey && enhancedNodeCache.has(cacheKey)) { - return Promise.resolve(enhancedNodeCache.get(cacheKey)) - } - - return resolveRecursive(node, fieldsToSift, type.getFields()).then( - resolvedNode => { - trackInlineObjectsInRootNode(resolvedNode) - if (cacheKey) { - enhancedNodeCache.set(cacheKey, resolvedNode) - } - return resolvedNode - } - ) + const start = process.hrtime() + const nodesPromise = () => { + const nodesCacheKey = JSON.stringify({ + // typeName + count being the same is a pretty good + // indication that the nodes are the same. + typeName, + nodesLength: nodes.length, + ...fieldsToSift, }) - ).then(myNodes => { - myNodes = myNodes.map(trackInlineObjectsInRootNode) + if (resolvedNodesCache.has(nodesCacheKey)) { + return Promise.resolve(resolvedNodesCache.get(nodesCacheKey)) + } else { + return Promise.all( + nodes.map(node => { + const cacheKey = enhancedNodeCacheId({ + node, + args: fieldsToSift, + }) + if (cacheKey && enhancedNodeCache.has(cacheKey)) { + return Promise.resolve(enhancedNodeCache.get(cacheKey)) + } else if (cacheKey && enhancedNodePromiseCache.has(cacheKey)) { + return enhancedNodePromiseCache.get(cacheKey) + } + + const enhancedNodeGenerationPromise = new Promise(resolve => { + resolveRecursive(node, fieldsToSift, type.getFields()).then( + resolvedNode => { + const startTrack = process.hrtime() + trackInlineObjectsInRootNode(resolvedNode) + global.trackInline.push( + require(`convert-hrtime`)(process.hrtime(startTrack)) + .milliseconds + ) + if (cacheKey) { + enhancedNodeCache.set(cacheKey, resolvedNode) + } + resolve(resolvedNode) + } + ) + }) + enhancedNodePromiseCache.set(cacheKey, enhancedNodeGenerationPromise) + return enhancedNodeGenerationPromise + }) + ).then(resolvedNodes => { + resolvedNodesCache.set(nodesCacheKey, resolvedNodes) + return resolvedNodes + }) + } + } + const tempPromise = nodesPromise().then(myNodes => { if (!connection) { const index = _.isEmpty(siftArgs) ? 0 - : sift.indexOf({ $and: siftArgs }, myNodes) + : sift.indexOf( + { + $and: siftArgs, + }, + myNodes + ) // If a node is found, create a dependency between the resulting node and // the path. @@ -159,7 +226,12 @@ module.exports = ({ let result = _.isEmpty(siftArgs) ? myNodes - : sift({ $and: siftArgs }, myNodes) + : sift( + { + $and: siftArgs, + }, + myNodes + ) if (!result || !result.length) return null @@ -184,4 +256,13 @@ module.exports = ({ } return connectionArray }) + + global.promiseMapTimes.push( + require(`convert-hrtime`)(process.hrtime(start)).milliseconds + ) + global.runSift.push( + require(`convert-hrtime`)(process.hrtime(startSift)).milliseconds + ) + + return tempPromise } diff --git a/packages/gatsby/src/utils/cache.js b/packages/gatsby/src/utils/cache.js index b80cb3b88c50b..a807a69cee0f4 100644 --- a/packages/gatsby/src/utils/cache.js +++ b/packages/gatsby/src/utils/cache.js @@ -1,10 +1,20 @@ const Promise = require(`bluebird`) -const low = require(`lowdb`) const fs = require(`fs-extra`) const _ = require(`lodash`) +const objectToMap = obj => new Map(Object.entries(obj)) + +const mapToObject = map => { + const obj = {} + for (let [key, value] of map) { + obj[key] = value + } + return obj +} + let db let directory +let save /** * Initialize cache store. Reuse existing store if available. @@ -16,13 +26,6 @@ exports.initCache = () => { } else { directory = process.cwd() + `/.cache/cache` } - db = low(null, { - format: { - serialize: obj => JSON.stringify(obj), - deserialize: str => JSON.parse(str), - }, - }) - db._.mixin(require(`lodash-id`)) let previousState try { @@ -32,9 +35,9 @@ exports.initCache = () => { } if (previousState) { - db.defaults(previousState).write() + db = objectToMap(previousState) } else { - db.defaults({ keys: [] }).write() + db = new Map() } } @@ -45,21 +48,7 @@ exports.initCache = () => { */ exports.get = key => new Promise((resolve, reject) => { - let pair - try { - pair = db - .get(`keys`) - .getById(key) - .value() - } catch (e) { - // ignore - } - - if (pair) { - resolve(pair.value) - } else { - resolve() - } + resolve(db.get(key)) }) /** @@ -70,18 +59,14 @@ exports.get = key => */ exports.set = (key, value) => new Promise((resolve, reject) => { - db.get(`keys`) - .upsert({ id: key, value }) - .write() + db.set(key, value) save() resolve(`Ok`) }) -let save - if (process.env.NODE_ENV !== `test`) { save = _.debounce(() => { - fs.writeFile(`${directory}/db.json`, JSON.stringify(db.getState())) + fs.writeFile(`${directory}/db.json`, JSON.stringify(mapToObject(db))) }, 250) } else { save = _.noop diff --git a/packages/gatsby/src/utils/profile.js b/packages/gatsby/src/utils/profile.js index dc0dd0a5b2bfa..3ec2f17d615b8 100644 --- a/packages/gatsby/src/utils/profile.js +++ b/packages/gatsby/src/utils/profile.js @@ -1,6 +1,7 @@ const convertHrtime = require(`convert-hrtime`) const _ = require(`lodash`) const treeify = require(`treeify`) +const ss = require(`simple-statistics`) let root = { ROOT: process.hrtime(), @@ -39,6 +40,18 @@ const labelify = (object, rootValue) => ).toFixed(2) + `%`}` }) +const descriptiveStats = (array, label) => { + if (!array || array.length === 0) return + console.log(``) + console.log(label) + console.log(`count:`, array.length) + console.log(`min:`, ss.min(array)) + console.log(`max:`, ss.max(array)) + console.log(`mean:`, ss.mean(array)) + console.log(`quantile 25:`, ss.quantile(array, 0.25)) + console.log(`quantile 75:`, ss.quantile(array, 0.75)) +} + process.on(`exit`, () => { root.ROOT = convertHrtime(process.hrtime(root.ROOT)).milliseconds root = labelify(root, root.ROOT) @@ -52,4 +65,15 @@ process.on(`exit`, () => { console.log(``) console.log(`===PROFILE===`) console.log(treeify.asTree(root)) + descriptiveStats(global.queryRuns, `Query runs`) + descriptiveStats(global.actualQuery, `actual query run`) + descriptiveStats(global.writeQueryResult, `write query result`) + descriptiveStats(global.mdToHTML, `Markdown to HTML`) + descriptiveStats(global.runSift, `run-sift`) + descriptiveStats(global.trackInline, `track inline in run-sift`) + descriptiveStats( + global.resolveRecursive, + `resolve additional fields on nodes` + ) + descriptiveStats(global.promiseMapTimes, `run-sift map nodes`) }) From 044e7b61924a660e622d2e6a582eef8e09566860 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Mon, 9 Jul 2018 14:56:06 -0700 Subject: [PATCH 09/29] Handle picking directory to write StaticQuery results --- .../internal-plugins/query-runner/query-runner.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/gatsby/src/internal-plugins/query-runner/query-runner.js b/packages/gatsby/src/internal-plugins/query-runner/query-runner.js index 5137461a1964b..08a3972d46ff8 100644 --- a/packages/gatsby/src/internal-plugins/query-runner/query-runner.js +++ b/packages/gatsby/src/internal-plugins/query-runner/query-runner.js @@ -130,7 +130,13 @@ ${formatErrorDetails(errorDetails)}`) if (resultHashes[queryJob.id] !== resultHash) { resultHashes[queryJob.id] = resultHash - const modInt = mod(dataPath).toString() + let modInt = `` + // We leave StaticQuery results at public/static/d + // as the babel plugin has that path hard-coded + // for importing static query results. + if (queryJob.isPage) { + modInt = mod(dataPath).toString() + } // Always write file to public/static/d/ folder. const resultPath = path.join( @@ -142,7 +148,9 @@ ${formatErrorDetails(errorDetails)}`) `${dataPath}.json` ) - dataPath = `${modInt}/${dataPath}` + if (queryJob.isPage) { + dataPath = `${modInt}/${dataPath}` + } const startWriteFile = process.hrtime() await fs.writeFile(resultPath, resultJSON) From f231e08ed493a2f6c26a77880f04574aa4f27a5b Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Mon, 9 Jul 2018 14:58:16 -0700 Subject: [PATCH 10/29] Speed up resolving queries when the query is querying a node by id --- packages/gatsby/src/schema/run-sift.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/packages/gatsby/src/schema/run-sift.js b/packages/gatsby/src/schema/run-sift.js index 15bdc12578c5c..ff7a423bfd997 100644 --- a/packages/gatsby/src/schema/run-sift.js +++ b/packages/gatsby/src/schema/run-sift.js @@ -6,6 +6,7 @@ const { createPageDependency } = require(`../redux/actions/add-page-dependency`) const prepareRegex = require(`./prepare-regex`) const Promise = require(`bluebird`) const { trackInlineObjectsInRootNode } = require(`./node-tracking`) +const { getNode } = require(`../redux`) const resolvedNodesCache = new Map() const enhancedNodeCache = new Map() @@ -150,6 +151,28 @@ module.exports = ({ }) } + // If the the query only has a filter for an "id", then we'll just grab + // that ID and return it. + if ( + Object.keys(fieldsToSift).length === 1 && + Object.keys(fieldsToSift)[0] === `id` + ) { + const node = resolveRecursive( + getNode(siftArgs[0].id[`$eq`]), + fieldsToSift, + type.getFields() + ) + + if (node) { + createPageDependency({ + path, + nodeId: node.id, + }) + } + + return node + } + const start = process.hrtime() const nodesPromise = () => { const nodesCacheKey = JSON.stringify({ From 0c43b29fef992b3384c84005dff18cd1d98ed634 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Mon, 9 Jul 2018 19:22:00 -0700 Subject: [PATCH 11/29] Show pages rendered / second while building HTML --- packages/gatsby-cli/src/reporter/index.js | 3 +++ packages/gatsby/src/commands/build-html.js | 4 ++-- packages/gatsby/src/commands/build.js | 2 +- packages/gatsby/src/utils/html-renderer.js | 16 +++++++++++++++- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/packages/gatsby-cli/src/reporter/index.js b/packages/gatsby-cli/src/reporter/index.js index 3560c0a1754a7..d321dde61baeb 100644 --- a/packages/gatsby-cli/src/reporter/index.js +++ b/packages/gatsby-cli/src/reporter/index.js @@ -85,6 +85,9 @@ module.exports = Object.assign(reporter, { start: () => { spinner.tick(name) }, + setStatus: status => { + spinner.tick(`${name} — ${status}`) + }, end: () => { reporter.success(`${name} — ${elapsedTime()}`) spinner.end() diff --git a/packages/gatsby/src/commands/build-html.js b/packages/gatsby/src/commands/build-html.js index 92c4fa45a6a66..d78c38d1da89f 100644 --- a/packages/gatsby/src/commands/build-html.js +++ b/packages/gatsby/src/commands/build-html.js @@ -8,7 +8,7 @@ const { store } = require(`../redux`) const { createErrorFromString } = require(`gatsby-cli/lib/reporter/errors`) const renderHTML = require(`../utils/html-renderer`) -module.exports = async (program: any) => { +module.exports = async (program: any, activity: any) => { const { directory } = program debug(`generating static HTML`) @@ -41,7 +41,7 @@ module.exports = async (program: any) => { ) } - return renderHTML(require(outputFile), pages) + return renderHTML(require(outputFile), pages, activity) .then(() => { // Remove the temp JS bundle file built for the static-site-generator-plugin try { diff --git a/packages/gatsby/src/commands/build.js b/packages/gatsby/src/commands/build.js index 1cb8e86f8d310..b7eeea7a6de5a 100644 --- a/packages/gatsby/src/commands/build.js +++ b/packages/gatsby/src/commands/build.js @@ -41,7 +41,7 @@ module.exports = async function build(program: BuildArgs) { activity = report.activityTimer(`Building static HTML for pages`) activity.start() - await buildHTML(program).catch(err => { + await buildHTML(program, activity).catch(err => { reportFailure( report.stripIndent` Building static HTML for pages failed diff --git a/packages/gatsby/src/utils/html-renderer.js b/packages/gatsby/src/utils/html-renderer.js index bc43d47b39dea..03aa4a6ef7004 100644 --- a/packages/gatsby/src/utils/html-renderer.js +++ b/packages/gatsby/src/utils/html-renderer.js @@ -1,6 +1,7 @@ const Queue = require(`better-queue`) const fs = require(`fs-extra`) const path = require(`path`) +const convertHrtime = require(`convert-hrtime`) // copied from https://github.com/markdalgleish/static-site-generator-webpack-plugin/blob/master/index.js#L161 const generatePathToOutput = outputPath => { @@ -13,8 +14,9 @@ const generatePathToOutput = outputPath => { return path.join(process.cwd(), `public`, outputFileName) } -module.exports = (htmlComponentRenderer, pages) => +module.exports = (htmlComponentRenderer, pages, activity) => new Promise((resolve, reject) => { + const start = process.hrtime() const queue = new Queue( (path, callback) => { try { @@ -36,6 +38,18 @@ module.exports = (htmlComponentRenderer, pages) => queue.push(page) }) + queue.on(`task_finish`, () => { + const stats = queue.getStats() + // console.log({ + // stats, + // }) + activity.setStatus( + `${stats.total}/${pages.length} ${( + stats.total / convertHrtime(process.hrtime(start)).seconds + ).toFixed(2)} pages / second` + ) + }) + queue.on(`drain`, () => { resolve() }) From 109d6915edd990bd43488ecdab06ece88153018e Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Tue, 10 Jul 2018 09:21:21 -0700 Subject: [PATCH 12/29] Add sites for benchmarking --- benchmarks/create-pages/.gitignore | 62 +++++++++++++++++++ benchmarks/create-pages/LICENSE | 21 +++++++ benchmarks/create-pages/README.md | 5 ++ benchmarks/create-pages/gatsby-node.js | 18 ++++++ benchmarks/create-pages/package.json | 19 ++++++ benchmarks/create-pages/src/pages/index.js | 3 + .../create-pages/src/templates/blank.js | 3 + benchmarks/markdown/.gitignore | 62 +++++++++++++++++++ benchmarks/markdown/LICENSE | 21 +++++++ benchmarks/markdown/README.md | 5 ++ benchmarks/markdown/gatsby-config.js | 3 + benchmarks/markdown/gatsby-node.js | 36 +++++++++++ benchmarks/markdown/package.json | 20 ++++++ benchmarks/markdown/src/pages/index.js | 3 + benchmarks/markdown/src/templates/blank.js | 24 +++++++ 15 files changed, 305 insertions(+) create mode 100644 benchmarks/create-pages/.gitignore create mode 100644 benchmarks/create-pages/LICENSE create mode 100644 benchmarks/create-pages/README.md create mode 100644 benchmarks/create-pages/gatsby-node.js create mode 100644 benchmarks/create-pages/package.json create mode 100644 benchmarks/create-pages/src/pages/index.js create mode 100644 benchmarks/create-pages/src/templates/blank.js create mode 100644 benchmarks/markdown/.gitignore create mode 100644 benchmarks/markdown/LICENSE create mode 100644 benchmarks/markdown/README.md create mode 100644 benchmarks/markdown/gatsby-config.js create mode 100644 benchmarks/markdown/gatsby-node.js create mode 100644 benchmarks/markdown/package.json create mode 100644 benchmarks/markdown/src/pages/index.js create mode 100644 benchmarks/markdown/src/templates/blank.js diff --git a/benchmarks/create-pages/.gitignore b/benchmarks/create-pages/.gitignore new file mode 100644 index 0000000000000..da3d72140c77d --- /dev/null +++ b/benchmarks/create-pages/.gitignore @@ -0,0 +1,62 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Typescript v1 declaration files +typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env + +.cache/ +public +yarn-error.log diff --git a/benchmarks/create-pages/LICENSE b/benchmarks/create-pages/LICENSE new file mode 100644 index 0000000000000..996428e740d30 --- /dev/null +++ b/benchmarks/create-pages/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 gatsbyjs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/benchmarks/create-pages/README.md b/benchmarks/create-pages/README.md new file mode 100644 index 0000000000000..6bcb9451f22d7 --- /dev/null +++ b/benchmarks/create-pages/README.md @@ -0,0 +1,5 @@ +# createPages benchmark + +Stress tests creating lots of tiny pages. + +Defaults to building a site with 5k pages. Set the `NUM_PAGES` environment variable to change that e.g. `NUM_PAGES=25000 gatsby build` diff --git a/benchmarks/create-pages/gatsby-node.js b/benchmarks/create-pages/gatsby-node.js new file mode 100644 index 0000000000000..48fae63f86027 --- /dev/null +++ b/benchmarks/create-pages/gatsby-node.js @@ -0,0 +1,18 @@ +let NUM_PAGES = 5000 + +if (process.env.NUM_PAGES) { + NUM_PAGES = process.env.NUM_PAGES +} + +exports.createPages = ({ actions: { createPage } }) => { + var step + for (step = 0; step < NUM_PAGES; step++) { + createPage({ + path: `/path/${step}/`, + component: require.resolve(`./src/templates/blank.js`), + context: { + id: step, + }, + }) + } +} diff --git a/benchmarks/create-pages/package.json b/benchmarks/create-pages/package.json new file mode 100644 index 0000000000000..493f2b8976a5e --- /dev/null +++ b/benchmarks/create-pages/package.json @@ -0,0 +1,19 @@ +{ + "name": "gatsby-starter-hello-world", + "description": "Gatsby hello world starter", + "license": "MIT", + "scripts": { + "develop": "gatsby develop", + "build": "gatsby build", + "serve": "gatsby serve" + }, + "dependencies": { + "fs-exists-cached": "^1.0.0", + "gatsby": "next", + "hash-mod": "^0.0.5", + "react": "^16.3.2", + "react-dom": "^16.3.2", + "simple-statistics": "^6.1.0", + "treeify": "^1.1.0" + } +} diff --git a/benchmarks/create-pages/src/pages/index.js b/benchmarks/create-pages/src/pages/index.js new file mode 100644 index 0000000000000..92b25c10168f8 --- /dev/null +++ b/benchmarks/create-pages/src/pages/index.js @@ -0,0 +1,3 @@ +import React from "react" + +export default () =>
Hello world!
diff --git a/benchmarks/create-pages/src/templates/blank.js b/benchmarks/create-pages/src/templates/blank.js new file mode 100644 index 0000000000000..c146c8ce8392b --- /dev/null +++ b/benchmarks/create-pages/src/templates/blank.js @@ -0,0 +1,3 @@ +import React from "react" + +export default () =>
Yo!
diff --git a/benchmarks/markdown/.gitignore b/benchmarks/markdown/.gitignore new file mode 100644 index 0000000000000..da3d72140c77d --- /dev/null +++ b/benchmarks/markdown/.gitignore @@ -0,0 +1,62 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Typescript v1 declaration files +typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env + +.cache/ +public +yarn-error.log diff --git a/benchmarks/markdown/LICENSE b/benchmarks/markdown/LICENSE new file mode 100644 index 0000000000000..996428e740d30 --- /dev/null +++ b/benchmarks/markdown/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 gatsbyjs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/benchmarks/markdown/README.md b/benchmarks/markdown/README.md new file mode 100644 index 0000000000000..2f01368d2d624 --- /dev/null +++ b/benchmarks/markdown/README.md @@ -0,0 +1,5 @@ +# Markdown benchmark + +Stress tests creating lots of pages rendered from Markdown. + +Defaults to building a site with 5k markdown pages. Set the `NUM_PAGES` environment variable to change that e.g. `NUM_PAGES=25000 gatsby build` diff --git a/benchmarks/markdown/gatsby-config.js b/benchmarks/markdown/gatsby-config.js new file mode 100644 index 0000000000000..c39d69b15059c --- /dev/null +++ b/benchmarks/markdown/gatsby-config.js @@ -0,0 +1,3 @@ +module.exports = { + plugins: [`gatsby-transformer-remark`], +}; diff --git a/benchmarks/markdown/gatsby-node.js b/benchmarks/markdown/gatsby-node.js new file mode 100644 index 0000000000000..ec0da9e20652a --- /dev/null +++ b/benchmarks/markdown/gatsby-node.js @@ -0,0 +1,36 @@ +let NUM_PAGES = 5000 + +if (process.env.NUM_PAGES) { + NUM_PAGES = process.env.NUM_PAGES +} + +exports.sourceNodes = ({ actions: { createNode } }) => { + // Create markdown nodes + let step + for (step = 0; step < NUM_PAGES; step++) { + createNode({ + id: step.toString(), + parent: null, + children: [], + internal: { + type: `FakeMarkdown`, + mediaType: `text/markdown`, + content: `---\ntitle: "hi"\n---\nWhat up folks? This is _lit_\n\n##Page #${step}`, + contentDigest: step.toString(), + }, + }) + } +} + +exports.createPages = ({ actions: { createPage } }) => { + let step + for (step = 0; step < NUM_PAGES; step++) { + createPage({ + path: `/path/${step}/`, + component: require.resolve(`./src/templates/blank.js`), + context: { + id: step, + }, + }) + } +} diff --git a/benchmarks/markdown/package.json b/benchmarks/markdown/package.json new file mode 100644 index 0000000000000..7557be53c302a --- /dev/null +++ b/benchmarks/markdown/package.json @@ -0,0 +1,20 @@ +{ + "name": "gatsby-starter-hello-world", + "description": "Gatsby hello world starter", + "license": "MIT", + "scripts": { + "develop": "gatsby develop", + "build": "gatsby build", + "serve": "gatsby serve" + }, + "dependencies": { + "fs-exists-cached": "^1.0.0", + "gatsby": "next", + "gatsby-transformer-remark": "^2.1.1-beta.2", + "hash-mod": "^0.0.5", + "react": "^16.3.2", + "react-dom": "^16.3.2", + "simple-statistics": "^6.1.0", + "treeify": "^1.1.0" + } +} diff --git a/benchmarks/markdown/src/pages/index.js b/benchmarks/markdown/src/pages/index.js new file mode 100644 index 0000000000000..92b25c10168f8 --- /dev/null +++ b/benchmarks/markdown/src/pages/index.js @@ -0,0 +1,3 @@ +import React from "react" + +export default () =>
Hello world!
diff --git a/benchmarks/markdown/src/templates/blank.js b/benchmarks/markdown/src/templates/blank.js new file mode 100644 index 0000000000000..44f1542528f72 --- /dev/null +++ b/benchmarks/markdown/src/templates/blank.js @@ -0,0 +1,24 @@ +import React from "react"; + +export default ({ data }) => { + const markdown = data.fakeMarkdown.childMarkdownRemark; + return ( +
+

{markdown.frontmatter.title}

+
+
+ ); +}; + +export const query = graphql` + query testing($id: String!) { + fakeMarkdown(id: { eq: $id }) { + childMarkdownRemark { + frontmatter { + title + } + html + } + } + } +`; From 272e6b02b50e4a5ddb02bd7cab3aa9d6041b33ef Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Tue, 10 Jul 2018 14:59:35 -0700 Subject: [PATCH 13/29] Persist activity status at end and show queries/second for graphql --- packages/gatsby-cli/src/reporter/index.js | 9 ++++++-- packages/gatsby/src/bootstrap/index.js | 26 ++++++++++++++++++---- packages/gatsby/src/utils/html-renderer.js | 15 ++++++------- 3 files changed, 36 insertions(+), 14 deletions(-) diff --git a/packages/gatsby-cli/src/reporter/index.js b/packages/gatsby-cli/src/reporter/index.js index d321dde61baeb..b3628f6496a46 100644 --- a/packages/gatsby-cli/src/reporter/index.js +++ b/packages/gatsby-cli/src/reporter/index.js @@ -75,6 +75,7 @@ module.exports = Object.assign(reporter, { activityTimer(name) { const spinner = reporter.activity() const start = process.hrtime() + let status const elapsedTime = () => { var elapsed = process.hrtime(start) @@ -85,11 +86,15 @@ module.exports = Object.assign(reporter, { start: () => { spinner.tick(name) }, - setStatus: status => { + setStatus: s => { + status = s spinner.tick(`${name} — ${status}`) }, end: () => { - reporter.success(`${name} — ${elapsedTime()}`) + const str = status + ? `${name} — ${elapsedTime()} — ${status}` + : `${name} — ${elapsedTime()}` + reporter.success(str) spinner.end() }, } diff --git a/packages/gatsby/src/bootstrap/index.js b/packages/gatsby/src/bootstrap/index.js index 7cc2f07f6e206..0a57b3e7eb61c 100644 --- a/packages/gatsby/src/bootstrap/index.js +++ b/packages/gatsby/src/bootstrap/index.js @@ -7,6 +7,7 @@ const md5File = require(`md5-file/promise`) const crypto = require(`crypto`) const del = require(`del`) const path = require(`path`) +const convertHrtime = require(`convert-hrtime`) const apiRunnerNode = require(`../utils/api-runner-node`) const { graphql } = require(`graphql`) @@ -27,6 +28,7 @@ const { const { runInitialQueries, } = require(`../internal-plugins/query-runner/page-query-runner`) +const queryQueue = require(`../internal-plugins/query-runner/query-queue`) const { writePages } = require(`../internal-plugins/query-runner/pages-writer`) const { writeRedirects, @@ -174,7 +176,9 @@ module.exports = async (args: BootstrapArgs) => { const siteDir = `${program.directory}/.cache` const tryRequire = `${__dirname}/../utils/test-require-error.js` try { - await fs.copy(srcDir, siteDir, { clobber: true }) + await fs.copy(srcDir, siteDir, { + clobber: true, + }) await fs.copy(tryRequire, `${siteDir}/test-require-error.js`, { clobber: true, }) @@ -344,7 +348,17 @@ module.exports = async (args: BootstrapArgs) => { // Run queries activity = report.activityTimer(`run graphql queries`) activity.start() - await runInitialQueries() + const startQueries = process.hrtime() + queryQueue.on(`task_finish`, () => { + const stats = queryQueue.getStats() + // console.log({ stats }) + activity.setStatus( + `${stats.total}/${stats.peak} ${( + stats.total / convertHrtime(process.hrtime(startQueries)).seconds + ).toFixed(2)} queries/second` + ) + }) + await runInitialQueries(activity) activity.end() // Write out files. @@ -375,7 +389,9 @@ module.exports = async (args: BootstrapArgs) => { activity.start() apiRunnerNode(`onPostBootstrap`).then(() => { activity.end() - resolve({ graphqlRunner }) + resolve({ + graphqlRunner, + }) }) } }, 100) @@ -391,7 +407,9 @@ module.exports = async (args: BootstrapArgs) => { report.info(`bootstrap finished - ${process.uptime()} s`) report.log(``) emitter.emit(`BOOTSTRAP_FINISHED`) - return { graphqlRunner } + return { + graphqlRunner, + } } else { return new Promise(resolve => { // Wait until all side effect jobs are finished. diff --git a/packages/gatsby/src/utils/html-renderer.js b/packages/gatsby/src/utils/html-renderer.js index 03aa4a6ef7004..97e09e512856f 100644 --- a/packages/gatsby/src/utils/html-renderer.js +++ b/packages/gatsby/src/utils/html-renderer.js @@ -40,14 +40,13 @@ module.exports = (htmlComponentRenderer, pages, activity) => queue.on(`task_finish`, () => { const stats = queue.getStats() - // console.log({ - // stats, - // }) - activity.setStatus( - `${stats.total}/${pages.length} ${( - stats.total / convertHrtime(process.hrtime(start)).seconds - ).toFixed(2)} pages / second` - ) + if (activity) { + activity.setStatus( + `${stats.total}/${pages.length} ${( + stats.total / convertHrtime(process.hrtime(start)).seconds + ).toFixed(2)} pages/second` + ) + } }) queue.on(`drain`, () => { From 19f6c3b93084edfc059e352cf58052117fc014b7 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Tue, 10 Jul 2018 15:11:18 -0700 Subject: [PATCH 14/29] Restore creating SitePage nodes as no longer slow --- .../internal-data-bridge/gatsby-node.js | 34 +++++++++++++++++++ .../query-runner/gatsby-node.js | 3 -- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/packages/gatsby/src/internal-plugins/internal-data-bridge/gatsby-node.js b/packages/gatsby/src/internal-plugins/internal-data-bridge/gatsby-node.js index 4eb49c4bc9edb..36d6b1ecdf2a2 100644 --- a/packages/gatsby/src/internal-plugins/internal-data-bridge/gatsby-node.js +++ b/packages/gatsby/src/internal-plugins/internal-data-bridge/gatsby-node.js @@ -137,3 +137,37 @@ exports.sourceNodes = ({ actions, store }) => { } }) } + +const createPageId = path => `SitePage ${path}` + +exports.onCreatePage = ({ page, actions }) => { + const { createNode } = actions + // eslint-disable-next-line + const { updatedAt, ...pageWithoutUpdated } = page + + // Add page. + createNode({ + ...pageWithoutUpdated, + id: createPageId(page.path), + parent: `SOURCE`, + children: [], + internal: { + type: `SitePage`, + contentDigest: crypto + .createHash(`md5`) + .update(JSON.stringify(page)) + .digest(`hex`), + description: + page.pluginCreatorId === `Plugin default-site-plugin` + ? `Your site's "gatsby-node.js"` + : page.pluginCreatorId, + }, + }) +} + +// Listen for DELETE_PAGE and delete page nodes. +emitter.on(`DELETE_PAGE`, action => { + const nodeId = createPageId(action.payload.path) + const node = getNode(nodeId) + boundActionCreators.deleteNode({ node }) +}) diff --git a/packages/gatsby/src/internal-plugins/query-runner/gatsby-node.js b/packages/gatsby/src/internal-plugins/query-runner/gatsby-node.js index 315f757847589..91c246e4963a1 100644 --- a/packages/gatsby/src/internal-plugins/query-runner/gatsby-node.js +++ b/packages/gatsby/src/internal-plugins/query-runner/gatsby-node.js @@ -8,9 +8,6 @@ exports.onCreatePage = ({ page, store }) => { const component = store.getState().components.get(page.componentPath) if (!component) { - console.log({ components: store.getState().components }) - console.log({ page }) - console.log({ component }) process.exit() } From a46c2078c2d67d5364be5efc7503125eaca7e43f Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Tue, 10 Jul 2018 15:46:18 -0700 Subject: [PATCH 15/29] Correct storing/using/deleting nodes --- benchmarks/markdown/src/templates/blank.js | 11 ++++++----- packages/gatsby/src/redux/actions.js | 4 +++- packages/gatsby/src/redux/index.js | 3 ++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/benchmarks/markdown/src/templates/blank.js b/benchmarks/markdown/src/templates/blank.js index 44f1542528f72..66205fb85a64e 100644 --- a/benchmarks/markdown/src/templates/blank.js +++ b/benchmarks/markdown/src/templates/blank.js @@ -1,14 +1,15 @@ -import React from "react"; +import React from "react" +import { graphql } from "gatsby" export default ({ data }) => { - const markdown = data.fakeMarkdown.childMarkdownRemark; + const markdown = data.fakeMarkdown.childMarkdownRemark return (

{markdown.frontmatter.title}

- ); -}; + ) +} export const query = graphql` query testing($id: String!) { @@ -21,4 +22,4 @@ export const query = graphql` } } } -`; +` diff --git a/packages/gatsby/src/redux/actions.js b/packages/gatsby/src/redux/actions.js index a18fbc58531f4..c47de252b320c 100644 --- a/packages/gatsby/src/redux/actions.js +++ b/packages/gatsby/src/redux/actions.js @@ -585,7 +585,9 @@ actions.createNode = (node: any, plugin?: Plugin, traceId?: string) => { if (oldNode) { const descendantNodes = findChildrenRecursively(oldNode.children) if (descendantNodes.length > 0) { - deleteAction = actions.deleteNodes(descendantNodes) + deleteAction = descendantNodes.forEach(n => + actions.deleteNode({ node: n }) + ) } } diff --git a/packages/gatsby/src/redux/index.js b/packages/gatsby/src/redux/index.js index 9610caf81b268..3908913f1a569 100644 --- a/packages/gatsby/src/redux/index.js +++ b/packages/gatsby/src/redux/index.js @@ -86,6 +86,7 @@ const saveState = _.debounce(state => { pickedState.staticQueryComponents ) pickedState.components = mapToObject(pickedState.components) + pickedState.nodes = mapToObject(pickedState.nodes) fs.writeFile( `${process.cwd()}/.cache/redux-state.json`, stringify(pickedState, null, 2), @@ -131,7 +132,7 @@ exports.getNode = getNode * @returns {boolean} */ exports.hasNodeChanged = (id, digest) => { - const node = store.getState().nodes[id] + const node = store.getState().nodes.get(id) if (!node) { return true } else { From fe4125b4e6b7451f4abd32f7f7b00513786c9fd9 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Tue, 10 Jul 2018 16:14:42 -0700 Subject: [PATCH 16/29] Disable profiling --- .../src/extend-node-type.js | 6 - .../query-runner/page-query-runner.js | 12 -- .../query-runner/query-runner.js | 15 -- packages/gatsby/src/schema/run-sift.js | 23 --- packages/gatsby/src/utils/profile.js | 136 ++++++++---------- 5 files changed, 63 insertions(+), 129 deletions(-) diff --git a/packages/gatsby-transformer-remark/src/extend-node-type.js b/packages/gatsby-transformer-remark/src/extend-node-type.js index a3be3fe81a5c7..0f50c194df2c0 100644 --- a/packages/gatsby-transformer-remark/src/extend-node-type.js +++ b/packages/gatsby-transformer-remark/src/extend-node-type.js @@ -24,8 +24,6 @@ const remark2retext = require(`remark-retext`) const stripPosition = require(`unist-util-remove-position`) const hastReparseRaw = require(`hast-util-raw`) -global.mdToHTML = [] - let pluginsCacheStr = `` let pathPrefixCacheStr = `` const astCacheKey = node => @@ -282,7 +280,6 @@ module.exports = ( if (cachedHTML) { return cachedHTML } else { - const start = process.hrtime() const ast = await getHTMLAst(markdownNode) // Save new HTML to cache and return const html = hastToHTML(ast, { @@ -291,9 +288,6 @@ module.exports = ( // Save new HTML to cache and return cache.set(htmlCacheKey(markdownNode), html) - global.mdToHTML.push( - require(`convert-hrtime`)(process.hrtime(start)).milliseconds - ) return html } } diff --git a/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js b/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js index e30afd50a4235..ec8648a75ab3f 100644 --- a/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js +++ b/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js @@ -78,7 +78,6 @@ emitter.on(`API_RUNNING_QUEUE_EMPTY`, runQueuedActions) let seenIdsWithoutDataDependencies = [] const findIdsWithoutDataDependencies = () => { - const start = process.hrtime() const state = store.getState() const allTrackedIds = _.uniq( _.flatten( @@ -106,20 +105,15 @@ const findIdsWithoutDataDependencies = () => { ...seenIdsWithoutDataDependencies, ]) - global._PROFILE({ start, name: `findIdsWithoutDataDependencies` }) return notTrackedIds } const runQueriesForPathnames = pathnames => { - const start = process.hrtime() - const blah = process.hrtime() const staticQueries = pathnames.filter(p => p.slice(0, 4) === `sq--`) const pageQueries = pathnames.filter(p => p.slice(0, 4) !== `sq--`) const state = store.getState() - global._PROFILE({ start: blah, name: `filter paths for running` }) staticQueries.forEach(id => { - const start2 = process.hrtime() const staticQueryComponent = store.getState().staticQueryComponents.get(id) const queryJob: QueryJob = { id: staticQueryComponent.hash, @@ -130,10 +124,8 @@ const runQueriesForPathnames = pathnames => { context: { path: staticQueryComponent.jsonName }, } queue.push(queryJob) - global._PROFILE({ start: start2, name: `queue static query` }) }) - const start3 = process.hrtime() const pages = state.pages let didNotQueueItems = true pageQueries.forEach(id => { @@ -155,7 +147,6 @@ const runQueriesForPathnames = pathnames => { ) } }) - global._PROFILE({ start: start3, name: `queue page queries` }) if (didNotQueueItems || !pathnames || pathnames.length === 0) { return Promise.resolve() @@ -163,14 +154,12 @@ const runQueriesForPathnames = pathnames => { return new Promise(resolve => { queue.on(`drain`, () => { - global._PROFILE({ start, name: `runQueriesForPathnames` }) resolve() }) }) } const findDirtyIds = actions => { - const start = process.hrtime() const state = store.getState() const uniqDirties = _.uniq( actions.reduce((dirtyIds, action) => { @@ -189,6 +178,5 @@ const findDirtyIds = actions => { return _.compact(dirtyIds) }, []) ) - global._PROFILE({ start, name: `findDirtyIds` }) return uniqDirties } diff --git a/packages/gatsby/src/internal-plugins/query-runner/query-runner.js b/packages/gatsby/src/internal-plugins/query-runner/query-runner.js index 08a3972d46ff8..7f0d2a68a69e6 100644 --- a/packages/gatsby/src/internal-plugins/query-runner/query-runner.js +++ b/packages/gatsby/src/internal-plugins/query-runner/query-runner.js @@ -10,7 +10,6 @@ const { store } = require(`../../redux`) const { generatePathChunkName } = require(`../../utils/js-chunk-names`) const { formatErrorDetails } = require(`./utils`) const mod = require(`hash-mod`)(999) -const convertHrtime = require(`convert-hrtime`) const resultHashes = {} @@ -24,13 +23,8 @@ type QueryJob = { isPage: Boolean, } -global.queryRuns = [] -global.actualQuery = [] -global.writeQueryResult = [] - // Run query module.exports = async (queryJob: QueryJob, component: Any) => { - const start = process.hrtime() const { schema, program } = store.getState() const graphql = (query, context) => @@ -43,11 +37,7 @@ module.exports = async (queryJob: QueryJob, component: Any) => { if (!queryJob.query || queryJob.query === ``) { result = {} } else { - const startQuery = process.hrtime() result = await graphql(queryJob.query, queryJob.context) - global.actualQuery.push( - convertHrtime(process.hrtime(startQuery)).milliseconds - ) } // If there's a graphql error then log the error. If we're building, also @@ -152,11 +142,7 @@ ${formatErrorDetails(errorDetails)}`) dataPath = `${modInt}/${dataPath}` } - const startWriteFile = process.hrtime() await fs.writeFile(resultPath, resultJSON) - global.writeQueryResult.push( - convertHrtime(process.hrtime(startWriteFile)).milliseconds - ) store.dispatch({ type: `SET_JSON_DATA_PATH`, @@ -166,7 +152,6 @@ ${formatErrorDetails(errorDetails)}`) }, }) - global.queryRuns.push(convertHrtime(process.hrtime(start)).milliseconds) return } } diff --git a/packages/gatsby/src/schema/run-sift.js b/packages/gatsby/src/schema/run-sift.js index ff7a423bfd997..b3bdc13a08a32 100644 --- a/packages/gatsby/src/schema/run-sift.js +++ b/packages/gatsby/src/schema/run-sift.js @@ -39,11 +39,6 @@ function awaitSiftField(fields, node, k) { return undefined } -global.runSift = [] -global.promiseMapTimes = [] -global.resolveRecursive = [] -global.trackInline = [] - /* * Filters a list of nodes using mongodb-like syntax. * Returns a single unwrapped element if connection = false. @@ -57,7 +52,6 @@ module.exports = ({ connection = false, path = ``, }: Object) => { - const startSift = process.hrtime() // Clone args as for some reason graphql-js removes the constructor // from nested objects which breaks a check in sift.js. const clonedArgs = JSON.parse(JSON.stringify(args)) @@ -114,7 +108,6 @@ module.exports = ({ // Resolves every field used in the node. function resolveRecursive(node, siftFieldsObj, gqFields) { - const start = process.hrtime() return Promise.all( _.keys(siftFieldsObj).map(k => Promise.resolve(awaitSiftField(gqFields, node, k)) @@ -144,9 +137,6 @@ module.exports = ({ ...node, } resolvedFields.forEach(([k, v]) => (myNode[k] = v)) - global.resolveRecursive.push( - require(`convert-hrtime`)(process.hrtime(start)).milliseconds - ) return myNode }) } @@ -173,7 +163,6 @@ module.exports = ({ return node } - const start = process.hrtime() const nodesPromise = () => { const nodesCacheKey = JSON.stringify({ // typeName + count being the same is a pretty good @@ -200,12 +189,7 @@ module.exports = ({ const enhancedNodeGenerationPromise = new Promise(resolve => { resolveRecursive(node, fieldsToSift, type.getFields()).then( resolvedNode => { - const startTrack = process.hrtime() trackInlineObjectsInRootNode(resolvedNode) - global.trackInline.push( - require(`convert-hrtime`)(process.hrtime(startTrack)) - .milliseconds - ) if (cacheKey) { enhancedNodeCache.set(cacheKey, resolvedNode) } @@ -280,12 +264,5 @@ module.exports = ({ return connectionArray }) - global.promiseMapTimes.push( - require(`convert-hrtime`)(process.hrtime(start)).milliseconds - ) - global.runSift.push( - require(`convert-hrtime`)(process.hrtime(startSift)).milliseconds - ) - return tempPromise } diff --git a/packages/gatsby/src/utils/profile.js b/packages/gatsby/src/utils/profile.js index 3ec2f17d615b8..d6033ebbe341e 100644 --- a/packages/gatsby/src/utils/profile.js +++ b/packages/gatsby/src/utils/profile.js @@ -1,79 +1,69 @@ -const convertHrtime = require(`convert-hrtime`) -const _ = require(`lodash`) -const treeify = require(`treeify`) -const ss = require(`simple-statistics`) +// const convertHrtime = require(`convert-hrtime`) +// const _ = require(`lodash`) +// const treeify = require(`treeify`) +// const ss = require(`simple-statistics`) -let root = { - ROOT: process.hrtime(), -} +// let root = { +// ROOT: process.hrtime(), +// } -const profile = ({ name, start, parent }) => { - const span = convertHrtime(process.hrtime(start)) - let path = parent ? `${parent}.${name}` : name - let currentValue = _.get(root, path) - if (_.isObject(currentValue)) { - path = `${path}.ROOT` - currentValue = _.get(root, path) - } - const newValue = currentValue - ? currentValue + span.milliseconds - : span.milliseconds - // if (name === `run-query`) { - // console.log({ - // path, - // span: span.milliseconds, - // newValue, - // }) - // } - root = _.set(root, path, newValue) -} +// const profile = ({ name, start, parent }) => { +// const span = convertHrtime(process.hrtime(start)) +// let path = parent ? `${parent}.${name}` : name +// let currentValue = _.get(root, path) +// if (_.isObject(currentValue)) { +// path = `${path}.ROOT` +// currentValue = _.get(root, path) +// } +// const newValue = currentValue +// ? currentValue + span.milliseconds +// : span.milliseconds +// if (name === `run-query`) { +// console.log({ +// path, +// span: span.milliseconds, +// newValue, +// }) +// } +// root = _.set(root, path, newValue) +// } -global._PROFILE = profile -module.exports = profile +// global._PROFILE = profile +// module.exports = profile -const labelify = (object, rootValue) => - _.mapKeys(object, (value, key, o) => { - const currentValue = _.isObject(value) ? value.ROOT : value - return `${key}: ${currentValue}ms | ${( - (currentValue / rootValue) * - 100 - ).toFixed(2) + `%`}` - }) +// const labelify = (object, rootValue) => +// _.mapKeys(object, (value, key, o) => { +// const currentValue = _.isObject(value) ? value.ROOT : value +// return `${key}: ${currentValue}ms | ${( +// (currentValue / rootValue) * +// 100 +// ).toFixed(2) + `%`}` +// }) -const descriptiveStats = (array, label) => { - if (!array || array.length === 0) return - console.log(``) - console.log(label) - console.log(`count:`, array.length) - console.log(`min:`, ss.min(array)) - console.log(`max:`, ss.max(array)) - console.log(`mean:`, ss.mean(array)) - console.log(`quantile 25:`, ss.quantile(array, 0.25)) - console.log(`quantile 75:`, ss.quantile(array, 0.75)) -} +// const descriptiveStats = (array, label) => { +// if (!array || array.length === 0) return +// console.log(``) +// console.log(label) +// console.log(`count:`, array.length) +// console.log(`min:`, ss.min(array)) +// console.log(`max:`, ss.max(array)) +// console.log(`mean:`, ss.mean(array)) +// console.log(`quantile 25:`, ss.quantile(array, 0.25)) +// console.log(`quantile 75:`, ss.quantile(array, 0.75)) +// } -process.on(`exit`, () => { - root.ROOT = convertHrtime(process.hrtime(root.ROOT)).milliseconds - root = labelify(root, root.ROOT) - for (var prop in root) { - if (_.isObject(root[prop]) && root[prop].ROOT) { - const rootValue = root[prop].ROOT - delete root[prop].ROOT - root[prop] = labelify(root[prop], rootValue) - } - } - console.log(``) - console.log(`===PROFILE===`) - console.log(treeify.asTree(root)) - descriptiveStats(global.queryRuns, `Query runs`) - descriptiveStats(global.actualQuery, `actual query run`) - descriptiveStats(global.writeQueryResult, `write query result`) - descriptiveStats(global.mdToHTML, `Markdown to HTML`) - descriptiveStats(global.runSift, `run-sift`) - descriptiveStats(global.trackInline, `track inline in run-sift`) - descriptiveStats( - global.resolveRecursive, - `resolve additional fields on nodes` - ) - descriptiveStats(global.promiseMapTimes, `run-sift map nodes`) -}) +// process.on(`exit`, () => { +// root.ROOT = convertHrtime(process.hrtime(root.ROOT)).milliseconds +// root = labelify(root, root.ROOT) +// for (var prop in root) { +// if (_.isObject(root[prop]) && root[prop].ROOT) { +// const rootValue = root[prop].ROOT +// delete root[prop].ROOT +// root[prop] = labelify(root[prop], rootValue) +// } +// } +// console.log(``) +// console.log(`===PROFILE===`) +// console.log(treeify.asTree(root)) +// descriptiveStats(global.promiseMapTimes, `run-sift map nodes`) +// }) From d3a95a0a8ffcff5479687e38ff53ab1b286848ad Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Tue, 10 Jul 2018 16:21:01 -0700 Subject: [PATCH 17/29] Remove extra dependencies --- benchmarks/create-pages/package.json | 6 +----- benchmarks/markdown/package.json | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/benchmarks/create-pages/package.json b/benchmarks/create-pages/package.json index 493f2b8976a5e..05abd1709e6c1 100644 --- a/benchmarks/create-pages/package.json +++ b/benchmarks/create-pages/package.json @@ -8,12 +8,8 @@ "serve": "gatsby serve" }, "dependencies": { - "fs-exists-cached": "^1.0.0", "gatsby": "next", - "hash-mod": "^0.0.5", "react": "^16.3.2", - "react-dom": "^16.3.2", - "simple-statistics": "^6.1.0", - "treeify": "^1.1.0" + "react-dom": "^16.3.2" } } diff --git a/benchmarks/markdown/package.json b/benchmarks/markdown/package.json index 7557be53c302a..5d64c8ccbd708 100644 --- a/benchmarks/markdown/package.json +++ b/benchmarks/markdown/package.json @@ -8,13 +8,9 @@ "serve": "gatsby serve" }, "dependencies": { - "fs-exists-cached": "^1.0.0", "gatsby": "next", "gatsby-transformer-remark": "^2.1.1-beta.2", - "hash-mod": "^0.0.5", "react": "^16.3.2", - "react-dom": "^16.3.2", - "simple-statistics": "^6.1.0", - "treeify": "^1.1.0" + "react-dom": "^16.3.2" } } From d6eefc59fecbeffd43c464a3a04bc498d6352f49 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Tue, 10 Jul 2018 16:24:05 -0700 Subject: [PATCH 18/29] Format + fix linting --- .../src/internal-plugins/internal-data-bridge/gatsby-node.js | 3 +-- .../gatsby/src/internal-plugins/query-runner/query-watcher.js | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/gatsby/src/internal-plugins/internal-data-bridge/gatsby-node.js b/packages/gatsby/src/internal-plugins/internal-data-bridge/gatsby-node.js index 36d6b1ecdf2a2..2ffb5d30f9896 100644 --- a/packages/gatsby/src/internal-plugins/internal-data-bridge/gatsby-node.js +++ b/packages/gatsby/src/internal-plugins/internal-data-bridge/gatsby-node.js @@ -41,6 +41,7 @@ function transformPackageJson(json) { } const createPageId = path => `SitePage ${path}` + exports.sourceNodes = ({ actions, store }) => { const { createNode } = actions const state = store.getState() @@ -138,8 +139,6 @@ exports.sourceNodes = ({ actions, store }) => { }) } -const createPageId = path => `SitePage ${path}` - exports.onCreatePage = ({ page, actions }) => { const { createNode } = actions // eslint-disable-next-line diff --git a/packages/gatsby/src/internal-plugins/query-runner/query-watcher.js b/packages/gatsby/src/internal-plugins/query-runner/query-watcher.js index cf47f458158a7..e2b218025e9c4 100644 --- a/packages/gatsby/src/internal-plugins/query-runner/query-watcher.js +++ b/packages/gatsby/src/internal-plugins/query-runner/query-watcher.js @@ -173,7 +173,9 @@ const queueQueriesForPageComponent = componentPath => { const getPagesForComponent = componentPath => { const state = store.getState() - return [...state.pages.values()].filter(p => p.componentPath === componentPath) + return [...state.pages.values()].filter( + p => p.componentPath === componentPath + ) } const filesToWatch = new Set() From b729410947fe22ba80c3d05b496dd5a1f1a0a4fb Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Tue, 10 Jul 2018 17:04:04 -0700 Subject: [PATCH 19/29] remove console.log and unused profile --- packages/gatsby/src/bootstrap/index.js | 1 - packages/gatsby/src/redux/actions.js | 3 --- packages/gatsby/src/schema/run-sift.js | 1 - 3 files changed, 5 deletions(-) diff --git a/packages/gatsby/src/bootstrap/index.js b/packages/gatsby/src/bootstrap/index.js index 0a57b3e7eb61c..7a9700b0dfd5f 100644 --- a/packages/gatsby/src/bootstrap/index.js +++ b/packages/gatsby/src/bootstrap/index.js @@ -351,7 +351,6 @@ module.exports = async (args: BootstrapArgs) => { const startQueries = process.hrtime() queryQueue.on(`task_finish`, () => { const stats = queryQueue.getStats() - // console.log({ stats }) activity.setStatus( `${stats.total}/${stats.peak} ${( stats.total / convertHrtime(process.hrtime(startQueries)).seconds diff --git a/packages/gatsby/src/redux/actions.js b/packages/gatsby/src/redux/actions.js index c47de252b320c..9e90f4ef87d51 100644 --- a/packages/gatsby/src/redux/actions.js +++ b/packages/gatsby/src/redux/actions.js @@ -11,7 +11,6 @@ const kebabHash = require(`kebab-hash`) const { hasNodeChanged, getNode } = require(`./index`) const { trackInlineObjectsInRootNode } = require(`../schema/node-tracking`) const { store } = require(`./index`) -const profile = require(`../utils/profile`) const fileExistsSync = require(`fs-exists-cached`).sync import * as joiSchemas from "../joi-schemas/joi" import { generateComponentChunkName } from "../utils/js-chunk-names" @@ -99,7 +98,6 @@ const hasWarnedForPageComponent = new Set() */ const fileOkCache = {} actions.createPage = (page: PageInput, plugin?: Plugin, traceId?: string) => { - const start = process.hrtime() let noPageOrComponent = false let name = `The plugin "${plugin.name}"` if (plugin.name === `default-site-plugin`) { @@ -294,7 +292,6 @@ ${reservedFields.map(f => ` * "${f}"`).join(`\n`)} fileOkCache[internalPage.component] = true } - profile({ start, name: `actions_createPage`, parent: `site createPages` }) return { type: `CREATE_PAGE`, plugin, diff --git a/packages/gatsby/src/schema/run-sift.js b/packages/gatsby/src/schema/run-sift.js index b3bdc13a08a32..1adee7fa0daf7 100644 --- a/packages/gatsby/src/schema/run-sift.js +++ b/packages/gatsby/src/schema/run-sift.js @@ -23,7 +23,6 @@ const enhancedNodeCacheId = ({ node, args }) => function awaitSiftField(fields, node, k) { const field = fields[k] if (field.resolve) { - console.log(`resolving`, field) return field.resolve( node, {}, From 34db11f0aecde47994cd31ddae6eb42b31eab15a Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Tue, 10 Jul 2018 17:15:57 -0700 Subject: [PATCH 20/29] Remove another profile --- packages/gatsby/src/redux/reducers/pages.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/packages/gatsby/src/redux/reducers/pages.js b/packages/gatsby/src/redux/reducers/pages.js index be731135c6c41..6788e45db4c96 100644 --- a/packages/gatsby/src/redux/reducers/pages.js +++ b/packages/gatsby/src/redux/reducers/pages.js @@ -1,12 +1,10 @@ const normalize = require(`normalize-path`) -const profile = require(`../../utils/profile`) module.exports = (state = new Map(), action) => { switch (action.type) { case `DELETE_CACHE`: return new Map() case `CREATE_PAGE`: { - const start = process.hrtime() action.payload.component = normalize(action.payload.component) if (!action.plugin && !action.plugin.name) { console.log(``) @@ -22,11 +20,6 @@ module.exports = (state = new Map(), action) => { action.payload.pluginCreatorId = action.plugin.id state.set(action.payload.path, action.payload) - profile({ - start, - name: `reducers/pages`, - parent: `site createPages`, - }) return state } case `DELETE_PAGE`: { From daf690fe34f77bbca7250b1fbaa353ff0cb36f42 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Tue, 10 Jul 2018 18:36:49 -0700 Subject: [PATCH 21/29] Fix tests (hopefully) --- .../__snapshots__/load-plugins.js.snap | 2 + packages/gatsby/src/redux/__tests__/nodes.js | 9 +- packages/gatsby/src/redux/actions.js | 4 +- packages/gatsby/src/redux/index.js | 16 +- packages/gatsby/src/schema/run-sift.js | 5 +- yarn.lock | 797 ++++++++++-------- 6 files changed, 448 insertions(+), 385 deletions(-) diff --git a/packages/gatsby/src/bootstrap/load-plugins/__tests__/__snapshots__/load-plugins.js.snap b/packages/gatsby/src/bootstrap/load-plugins/__tests__/__snapshots__/load-plugins.js.snap index 0f89592b98034..32a6b68333b89 100644 --- a/packages/gatsby/src/bootstrap/load-plugins/__tests__/__snapshots__/load-plugins.js.snap +++ b/packages/gatsby/src/bootstrap/load-plugins/__tests__/__snapshots__/load-plugins.js.snap @@ -36,6 +36,7 @@ Array [ "name": "internal-data-bridge", "nodeAPIs": Array [ "sourceNodes", + "onCreatePage", ], "pluginOptions": Object { "plugins": Array [], @@ -139,6 +140,7 @@ Array [ "name": "internal-data-bridge", "nodeAPIs": Array [ "sourceNodes", + "onCreatePage", ], "pluginOptions": Object { "plugins": Array [], diff --git a/packages/gatsby/src/redux/__tests__/nodes.js b/packages/gatsby/src/redux/__tests__/nodes.js index 5b0b81a2ce157..3ce2ac9efbd74 100644 --- a/packages/gatsby/src/redux/__tests__/nodes.js +++ b/packages/gatsby/src/redux/__tests__/nodes.js @@ -351,9 +351,12 @@ describe(`Create and update nodes`, () => { ) ) store.dispatch( - actions.deleteNodes([`hi`], { - name: `tests`, - }) + actions.deleteNode( + { node: getNode(`hi`) }, + { + name: `tests`, + } + ) ) expect(store.getState().nodes.size).toEqual(0) }) diff --git a/packages/gatsby/src/redux/actions.js b/packages/gatsby/src/redux/actions.js index 9e90f4ef87d51..ecb891468d543 100644 --- a/packages/gatsby/src/redux/actions.js +++ b/packages/gatsby/src/redux/actions.js @@ -582,8 +582,8 @@ actions.createNode = (node: any, plugin?: Plugin, traceId?: string) => { if (oldNode) { const descendantNodes = findChildrenRecursively(oldNode.children) if (descendantNodes.length > 0) { - deleteAction = descendantNodes.forEach(n => - actions.deleteNode({ node: n }) + deleteAction = descendantNodes.map(n => + actions.deleteNode({ node: getNode(n) }) ) } } diff --git a/packages/gatsby/src/redux/index.js b/packages/gatsby/src/redux/index.js index 3908913f1a569..e1f0ac1ef3658 100644 --- a/packages/gatsby/src/redux/index.js +++ b/packages/gatsby/src/redux/index.js @@ -28,11 +28,17 @@ try { initialState = JSON.parse( fs.readFileSync(`${process.cwd()}/.cache/redux-state.json`) ) - initialState.staticQueryComponents = objectToMap( - initialState.staticQueryComponents - ) - initialState.components = objectToMap(initialState.components) - initialState.nodes = objectToMap(initialState.nodes) + if (initialState.staticQueryComponents) { + initialState.staticQueryComponents = objectToMap( + initialState.staticQueryComponents + ) + } + if (initialState.components) { + initialState.components = objectToMap(initialState.components) + } + if (initialState.nodes) { + initialState.nodes = objectToMap(initialState.nodes) + } } catch (e) { // ignore errors. } diff --git a/packages/gatsby/src/schema/run-sift.js b/packages/gatsby/src/schema/run-sift.js index 1adee7fa0daf7..44cb2757b733d 100644 --- a/packages/gatsby/src/schema/run-sift.js +++ b/packages/gatsby/src/schema/run-sift.js @@ -170,7 +170,10 @@ module.exports = ({ nodesLength: nodes.length, ...fieldsToSift, }) - if (resolvedNodesCache.has(nodesCacheKey)) { + if ( + process.env.NODE_ENV !== `test` && + resolvedNodesCache.has(nodesCacheKey) + ) { return Promise.resolve(resolvedNodesCache.get(nodesCacheKey)) } else { return Promise.all( diff --git a/yarn.lock b/yarn.lock index b82f4756dad12..9f952f07f0a88 100644 --- a/yarn.lock +++ b/yarn.lock @@ -31,12 +31,18 @@ dependencies: "@babel/highlight" "7.0.0-beta.44" -"@babel/code-frame@7.0.0-beta.51", "@babel/code-frame@^7.0.0-beta.35", "@babel/code-frame@^7.0.0-beta.51": +"@babel/code-frame@7.0.0-beta.51": version "7.0.0-beta.51" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.51.tgz#bd71d9b192af978df915829d39d4094456439a0c" dependencies: "@babel/highlight" "7.0.0-beta.51" +"@babel/code-frame@^7.0.0-beta.35", "@babel/code-frame@^7.0.0-beta.51": + version "7.0.0-beta.52" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.52.tgz#192483bfa0d1e467c101571c21029ccb74af2801" + dependencies: + "@babel/highlight" "7.0.0-beta.52" + "@babel/core@7.0.0-beta.51": version "7.0.0-beta.51" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.0.0-beta.51.tgz#0e54bd6b638736b2ae593c31a47f0969e2b2b96d" @@ -174,13 +180,20 @@ dependencies: "@babel/types" "7.0.0-beta.51" -"@babel/helper-module-imports@7.0.0-beta.51", "@babel/helper-module-imports@^7.0.0-beta.49": +"@babel/helper-module-imports@7.0.0-beta.51": version "7.0.0-beta.51" resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.0.0-beta.51.tgz#ce00428045fbb7d5ebc0ea7bf835789f15366ab2" dependencies: "@babel/types" "7.0.0-beta.51" lodash "^4.17.5" +"@babel/helper-module-imports@^7.0.0-beta.49": + version "7.0.0-beta.52" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.0.0-beta.52.tgz#70840e83ae891f94702c6c613787c48ee3c965bb" + dependencies: + "@babel/types" "7.0.0-beta.52" + lodash "^4.17.5" + "@babel/helper-module-transforms@7.0.0-beta.51": version "7.0.0-beta.51" resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.0.0-beta.51.tgz#13af0c8ee41f277743c8fc43d444315db2326f73" @@ -280,6 +293,14 @@ esutils "^2.0.2" js-tokens "^3.0.0" +"@babel/highlight@7.0.0-beta.52": + version "7.0.0-beta.52" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-beta.52.tgz#ef24931432f06155e7bc39cdb8a6b37b4a28b3d0" + dependencies: + chalk "^2.0.0" + esutils "^2.0.2" + js-tokens "^3.0.0" + "@babel/node@7.0.0-beta.51": version "7.0.0-beta.51" resolved "https://registry.yarnpkg.com/@babel/node/-/node-7.0.0-beta.51.tgz#fe6f4507b5633b822892be854c24c684c6606c18" @@ -816,7 +837,7 @@ lodash "^4.2.0" to-fast-properties "^2.0.0" -"@babel/types@7.0.0-beta.51", "@babel/types@^7.0.0-beta.49": +"@babel/types@7.0.0-beta.51": version "7.0.0-beta.51" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.51.tgz#d802b7b543b5836c778aa691797abf00f3d97ea9" dependencies: @@ -824,6 +845,14 @@ lodash "^4.17.5" to-fast-properties "^2.0.0" +"@babel/types@7.0.0-beta.52", "@babel/types@^7.0.0-beta.49": + version "7.0.0-beta.52" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.52.tgz#a3e5620b1534b253a50abcf2222b520e23b16da2" + dependencies: + esutils "^2.0.2" + lodash "^4.17.5" + to-fast-properties "^2.0.0" + "@contentful/axios@^0.18.0": version "0.18.0" resolved "https://registry.yarnpkg.com/@contentful/axios/-/axios-0.18.0.tgz#576e0e6047411a66971e82d40688a8c795e62f27" @@ -1345,12 +1374,12 @@ resolved "https://registry.yarnpkg.com/@types/mkdirp/-/mkdirp-0.3.29.tgz#7f2ad7ec55f914482fc9b1ec4bb1ae6028d46066" "@types/node@*": - version "10.3.3" - resolved "https://registry.yarnpkg.com/@types/node/-/node-10.3.3.tgz#8798d9e39af2fa604f715ee6a6b19796528e46c3" + version "10.5.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.5.2.tgz#f19f05314d5421fe37e74153254201a7bf00a707" "@types/node@^7.0.11": - version "7.0.66" - resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.66.tgz#3d1dc4d6f52e484e843806ff456379f7e6ad5553" + version "7.0.67" + resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.67.tgz#3aeacf429e24e08e14d7621039d37b7f53542ecf" "@types/react-router-dom@^4.2.5": version "4.2.7" @@ -1361,15 +1390,15 @@ "@types/react-router" "*" "@types/react-router@*": - version "4.0.26" - resolved "https://registry.yarnpkg.com/@types/react-router/-/react-router-4.0.26.tgz#4489c873642baa633014294a6d0a290001ba9860" + version "4.0.28" + resolved "https://registry.yarnpkg.com/@types/react-router/-/react-router-4.0.28.tgz#b0445fc38613c81e92ca9ec0e08ab36697d51003" dependencies: "@types/history" "*" "@types/react" "*" "@types/react@*": - version "16.3.18" - resolved "https://registry.yarnpkg.com/@types/react/-/react-16.3.18.tgz#bf195aed4d77dc86f06e4c9bb760214a3b822b8d" + version "16.4.6" + resolved "https://registry.yarnpkg.com/@types/react/-/react-16.4.6.tgz#5024957c6bcef4f02823accf5974faba2e54fada" dependencies: csstype "^2.2.0" @@ -1377,140 +1406,140 @@ version "0.0.32" resolved "https://registry.yarnpkg.com/@types/tmp/-/tmp-0.0.32.tgz#0d3cb31022f8427ea58c008af32b80da126ca4e3" -"@webassemblyjs/ast@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.5.12.tgz#a9acbcb3f25333c4edfa1fdf3186b1ccf64e6664" +"@webassemblyjs/ast@1.5.13": + version "1.5.13" + resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.5.13.tgz#81155a570bd5803a30ec31436bc2c9c0ede38f25" dependencies: - "@webassemblyjs/helper-module-context" "1.5.12" - "@webassemblyjs/helper-wasm-bytecode" "1.5.12" - "@webassemblyjs/wast-parser" "1.5.12" + "@webassemblyjs/helper-module-context" "1.5.13" + "@webassemblyjs/helper-wasm-bytecode" "1.5.13" + "@webassemblyjs/wast-parser" "1.5.13" debug "^3.1.0" mamacro "^0.0.3" -"@webassemblyjs/floating-point-hex-parser@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.5.12.tgz#0f36044ffe9652468ce7ae5a08716a4eeff9cd9c" +"@webassemblyjs/floating-point-hex-parser@1.5.13": + version "1.5.13" + resolved "https://registry.yarnpkg.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.5.13.tgz#29ce0baa97411f70e8cce68ce9c0f9d819a4e298" -"@webassemblyjs/helper-api-error@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-api-error/-/helper-api-error-1.5.12.tgz#05466833ff2f9d8953a1a327746e1d112ea62aaf" +"@webassemblyjs/helper-api-error@1.5.13": + version "1.5.13" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-api-error/-/helper-api-error-1.5.13.tgz#e49b051d67ee19a56e29b9aa8bd949b5b4442a59" -"@webassemblyjs/helper-buffer@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.5.12.tgz#1f0de5aaabefef89aec314f7f970009cd159c73d" +"@webassemblyjs/helper-buffer@1.5.13": + version "1.5.13" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.5.13.tgz#873bb0a1b46449231137c1262ddfd05695195a1e" dependencies: debug "^3.1.0" -"@webassemblyjs/helper-code-frame@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.5.12.tgz#3cdc1953093760d1c0f0caf745ccd62bdb6627c7" +"@webassemblyjs/helper-code-frame@1.5.13": + version "1.5.13" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.5.13.tgz#1bd2181b6a0be14e004f0fe9f5a660d265362b58" dependencies: - "@webassemblyjs/wast-printer" "1.5.12" + "@webassemblyjs/wast-printer" "1.5.13" -"@webassemblyjs/helper-fsm@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-fsm/-/helper-fsm-1.5.12.tgz#6bc1442b037f8e30f2e57b987cee5c806dd15027" +"@webassemblyjs/helper-fsm@1.5.13": + version "1.5.13" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-fsm/-/helper-fsm-1.5.13.tgz#cdf3d9d33005d543a5c5e5adaabf679ffa8db924" -"@webassemblyjs/helper-module-context@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-module-context/-/helper-module-context-1.5.12.tgz#b5588ca78b33b8a0da75f9ab8c769a3707baa861" +"@webassemblyjs/helper-module-context@1.5.13": + version "1.5.13" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-module-context/-/helper-module-context-1.5.13.tgz#dc29ddfb51ed657655286f94a5d72d8a489147c5" dependencies: debug "^3.1.0" mamacro "^0.0.3" -"@webassemblyjs/helper-wasm-bytecode@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.5.12.tgz#d12a3859db882a448891a866a05d0be63785b616" +"@webassemblyjs/helper-wasm-bytecode@1.5.13": + version "1.5.13" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.5.13.tgz#03245817f0a762382e61733146f5773def15a747" -"@webassemblyjs/helper-wasm-section@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.5.12.tgz#ff9fe1507d368ad437e7969d25e8c1693dac1884" +"@webassemblyjs/helper-wasm-section@1.5.13": + version "1.5.13" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.5.13.tgz#efc76f44a10d3073b584b43c38a179df173d5c7d" dependencies: - "@webassemblyjs/ast" "1.5.12" - "@webassemblyjs/helper-buffer" "1.5.12" - "@webassemblyjs/helper-wasm-bytecode" "1.5.12" - "@webassemblyjs/wasm-gen" "1.5.12" + "@webassemblyjs/ast" "1.5.13" + "@webassemblyjs/helper-buffer" "1.5.13" + "@webassemblyjs/helper-wasm-bytecode" "1.5.13" + "@webassemblyjs/wasm-gen" "1.5.13" debug "^3.1.0" -"@webassemblyjs/ieee754@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/ieee754/-/ieee754-1.5.12.tgz#ee9574bc558888f13097ce3e7900dff234ea19a4" +"@webassemblyjs/ieee754@1.5.13": + version "1.5.13" + resolved "https://registry.yarnpkg.com/@webassemblyjs/ieee754/-/ieee754-1.5.13.tgz#573e97c8c12e4eebb316ca5fde0203ddd90b0364" dependencies: ieee754 "^1.1.11" -"@webassemblyjs/leb128@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/leb128/-/leb128-1.5.12.tgz#0308eec652765ee567d8a5fa108b4f0b25b458e1" +"@webassemblyjs/leb128@1.5.13": + version "1.5.13" + resolved "https://registry.yarnpkg.com/@webassemblyjs/leb128/-/leb128-1.5.13.tgz#ab52ebab9cec283c1c1897ac1da833a04a3f4cee" dependencies: - leb "^0.3.0" + long "4.0.0" -"@webassemblyjs/utf8@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/utf8/-/utf8-1.5.12.tgz#d5916222ef314bf60d6806ed5ac045989bfd92ce" +"@webassemblyjs/utf8@1.5.13": + version "1.5.13" + resolved "https://registry.yarnpkg.com/@webassemblyjs/utf8/-/utf8-1.5.13.tgz#6b53d2cd861cf94fa99c1f12779dde692fbc2469" -"@webassemblyjs/wasm-edit@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.5.12.tgz#821c9358e644a166f2c910e5af1b46ce795a17aa" +"@webassemblyjs/wasm-edit@1.5.13": + version "1.5.13" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.5.13.tgz#c9cef5664c245cf11b3b3a73110c9155831724a8" dependencies: - "@webassemblyjs/ast" "1.5.12" - "@webassemblyjs/helper-buffer" "1.5.12" - "@webassemblyjs/helper-wasm-bytecode" "1.5.12" - "@webassemblyjs/helper-wasm-section" "1.5.12" - "@webassemblyjs/wasm-gen" "1.5.12" - "@webassemblyjs/wasm-opt" "1.5.12" - "@webassemblyjs/wasm-parser" "1.5.12" - "@webassemblyjs/wast-printer" "1.5.12" + "@webassemblyjs/ast" "1.5.13" + "@webassemblyjs/helper-buffer" "1.5.13" + "@webassemblyjs/helper-wasm-bytecode" "1.5.13" + "@webassemblyjs/helper-wasm-section" "1.5.13" + "@webassemblyjs/wasm-gen" "1.5.13" + "@webassemblyjs/wasm-opt" "1.5.13" + "@webassemblyjs/wasm-parser" "1.5.13" + "@webassemblyjs/wast-printer" "1.5.13" debug "^3.1.0" -"@webassemblyjs/wasm-gen@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.5.12.tgz#0b7ccfdb93dab902cc0251014e2e18bae3139bcb" +"@webassemblyjs/wasm-gen@1.5.13": + version "1.5.13" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.5.13.tgz#8e6ea113c4b432fa66540189e79b16d7a140700e" dependencies: - "@webassemblyjs/ast" "1.5.12" - "@webassemblyjs/helper-wasm-bytecode" "1.5.12" - "@webassemblyjs/ieee754" "1.5.12" - "@webassemblyjs/leb128" "1.5.12" - "@webassemblyjs/utf8" "1.5.12" + "@webassemblyjs/ast" "1.5.13" + "@webassemblyjs/helper-wasm-bytecode" "1.5.13" + "@webassemblyjs/ieee754" "1.5.13" + "@webassemblyjs/leb128" "1.5.13" + "@webassemblyjs/utf8" "1.5.13" -"@webassemblyjs/wasm-opt@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.5.12.tgz#bd758a8bc670f585ff1ae85f84095a9e0229cbc9" +"@webassemblyjs/wasm-opt@1.5.13": + version "1.5.13" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.5.13.tgz#147aad7717a7ee4211c36b21a5f4c30dddf33138" dependencies: - "@webassemblyjs/ast" "1.5.12" - "@webassemblyjs/helper-buffer" "1.5.12" - "@webassemblyjs/wasm-gen" "1.5.12" - "@webassemblyjs/wasm-parser" "1.5.12" + "@webassemblyjs/ast" "1.5.13" + "@webassemblyjs/helper-buffer" "1.5.13" + "@webassemblyjs/wasm-gen" "1.5.13" + "@webassemblyjs/wasm-parser" "1.5.13" debug "^3.1.0" -"@webassemblyjs/wasm-parser@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.5.12.tgz#7b10b4388ecf98bd7a22e702aa62ec2f46d0c75e" - dependencies: - "@webassemblyjs/ast" "1.5.12" - "@webassemblyjs/helper-api-error" "1.5.12" - "@webassemblyjs/helper-wasm-bytecode" "1.5.12" - "@webassemblyjs/ieee754" "1.5.12" - "@webassemblyjs/leb128" "1.5.12" - "@webassemblyjs/utf8" "1.5.12" - -"@webassemblyjs/wast-parser@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-parser/-/wast-parser-1.5.12.tgz#9cf5ae600ecae0640437b5d4de5dd6b6088d0d8b" - dependencies: - "@webassemblyjs/ast" "1.5.12" - "@webassemblyjs/floating-point-hex-parser" "1.5.12" - "@webassemblyjs/helper-api-error" "1.5.12" - "@webassemblyjs/helper-code-frame" "1.5.12" - "@webassemblyjs/helper-fsm" "1.5.12" +"@webassemblyjs/wasm-parser@1.5.13": + version "1.5.13" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.5.13.tgz#6f46516c5bb23904fbdf58009233c2dd8a54c72f" + dependencies: + "@webassemblyjs/ast" "1.5.13" + "@webassemblyjs/helper-api-error" "1.5.13" + "@webassemblyjs/helper-wasm-bytecode" "1.5.13" + "@webassemblyjs/ieee754" "1.5.13" + "@webassemblyjs/leb128" "1.5.13" + "@webassemblyjs/utf8" "1.5.13" + +"@webassemblyjs/wast-parser@1.5.13": + version "1.5.13" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-parser/-/wast-parser-1.5.13.tgz#5727a705d397ae6a3ae99d7f5460acf2ec646eea" + dependencies: + "@webassemblyjs/ast" "1.5.13" + "@webassemblyjs/floating-point-hex-parser" "1.5.13" + "@webassemblyjs/helper-api-error" "1.5.13" + "@webassemblyjs/helper-code-frame" "1.5.13" + "@webassemblyjs/helper-fsm" "1.5.13" long "^3.2.0" mamacro "^0.0.3" -"@webassemblyjs/wast-printer@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-printer/-/wast-printer-1.5.12.tgz#563ca4d01b22d21640b2463dc5e3d7f7d9dac520" +"@webassemblyjs/wast-printer@1.5.13": + version "1.5.13" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-printer/-/wast-printer-1.5.13.tgz#bb34d528c14b4f579e7ec11e793ec50ad7cd7c95" dependencies: - "@webassemblyjs/ast" "1.5.12" - "@webassemblyjs/wast-parser" "1.5.12" + "@webassemblyjs/ast" "1.5.13" + "@webassemblyjs/wast-parser" "1.5.13" long "^3.2.0" "@webpack-contrib/schema-utils@^1.0.0-beta.0": @@ -1634,8 +1663,8 @@ ajv@^5.0.0, ajv@^5.1.0, ajv@^5.2.3, ajv@^5.3.0: json-schema-traverse "^0.3.0" ajv@^6.1.0, ajv@^6.5.0: - version "6.5.1" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.5.1.tgz#88ebc1263c7133937d108b80c5572e64e1d9322d" + version "6.5.2" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.5.2.tgz#678495f9b82f7cca6be248dd92f59bff5e1f4360" dependencies: fast-deep-equal "^2.0.1" fast-json-stable-stringify "^2.0.0" @@ -1643,8 +1672,8 @@ ajv@^6.1.0, ajv@^6.5.0: uri-js "^4.2.1" algoliasearch@^3.25.1: - version "3.28.0" - resolved "https://registry.yarnpkg.com/algoliasearch/-/algoliasearch-3.28.0.tgz#12b6c8bda397eba805a7ff998ac87f6988411d2d" + version "3.29.0" + resolved "https://registry.yarnpkg.com/algoliasearch/-/algoliasearch-3.29.0.tgz#d04021a5450be55ce314b928bba4a38723399bd8" dependencies: agentkeepalive "^2.2.0" debug "^2.6.8" @@ -1804,9 +1833,9 @@ argv@0.0.2: version "0.0.2" resolved "https://registry.yarnpkg.com/argv/-/argv-0.0.2.tgz#ecbd16f8949b157183711b1bda334f37840185ab" -aria-query@^0.7.0: - version "0.7.1" - resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-0.7.1.tgz#26cbb5aff64144b0a825be1846e0b16cfa00b11e" +aria-query@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-3.0.0.tgz#65b3fcc1ca1155a8c9ae64d6eee297f15d5133cc" dependencies: ast-types-flow "0.0.7" commander "^2.11.0" @@ -1948,7 +1977,7 @@ assign-symbols@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" -ast-types-flow@0.0.7: +ast-types-flow@0.0.7, ast-types-flow@^0.0.7: version "0.0.7" resolved "https://registry.yarnpkg.com/ast-types-flow/-/ast-types-flow-0.0.7.tgz#f70b735c6bca1a5c9c22d982c3e39e7feba3bdad" @@ -2037,9 +2066,9 @@ axios@^0.18.0: follow-redirects "^1.3.0" is-buffer "^1.1.5" -axobject-query@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-0.1.0.tgz#62f59dbc59c9f9242759ca349960e7a2fe3c36c0" +axobject-query@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-2.0.1.tgz#05dfa705ada8ad9db993fa6896f22d395b0b0a07" dependencies: ast-types-flow "0.0.7" @@ -2091,8 +2120,8 @@ babel-eslint@8.2.1: eslint-visitor-keys "^1.0.0" babel-eslint@^8.2.2: - version "8.2.3" - resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-8.2.3.tgz#1a2e6681cc9bc4473c32899e59915e19cd6733cf" + version "8.2.5" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-8.2.5.tgz#dc2331c259d36782aa189da510c43dedd5adc7a3" dependencies: "@babel/code-frame" "7.0.0-beta.44" "@babel/traverse" "7.0.0-beta.44" @@ -2979,8 +3008,8 @@ batch@0.6.1: resolved "https://registry.yarnpkg.com/batch/-/batch-0.6.1.tgz#dc34314f4e679318093fc760272525f94bf25c16" bcrypt-pbkdf@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz#63bc5dcb61331b92bc05fd528953c33462a06f8d" + version "1.0.2" + resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" dependencies: tweetnacl "^0.14.3" @@ -3166,8 +3195,8 @@ boom@2.x.x: hoek "2.x.x" bowser@^1.7.3: - version "1.9.3" - resolved "https://registry.yarnpkg.com/bowser/-/bowser-1.9.3.tgz#6643ae4d783f31683f6d23156976b74183862162" + version "1.9.4" + resolved "https://registry.yarnpkg.com/bowser/-/bowser-1.9.4.tgz#890c58a2813a9d3243704334fa81b96a5c150c9a" boxen@1.3.0, boxen@^1.2.1: version "1.3.0" @@ -3220,8 +3249,8 @@ browser-process-hrtime@^0.1.2: resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-0.1.2.tgz#425d68a58d3447f02a04aa894187fce8af8b7b8e" browser-resolve@^1.11.2, browser-resolve@^1.7.0: - version "1.11.2" - resolved "https://registry.yarnpkg.com/browser-resolve/-/browser-resolve-1.11.2.tgz#8ff09b0a2c421718a1051c260b32e48f442938ce" + version "1.11.3" + resolved "https://registry.yarnpkg.com/browser-resolve/-/browser-resolve-1.11.3.tgz#9b7cbb3d0f510e4cb86bdbd796124d28b5890af6" dependencies: resolve "1.1.7" @@ -3249,12 +3278,13 @@ browserify-cipher@^1.0.0: evp_bytestokey "^1.0.0" browserify-des@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/browserify-des/-/browserify-des-1.0.1.tgz#3343124db6d7ad53e26a8826318712bdc8450f9c" + version "1.0.2" + resolved "https://registry.yarnpkg.com/browserify-des/-/browserify-des-1.0.2.tgz#3af4f1f59839403572f1c66204375f7a7f703e9c" dependencies: cipher-base "^1.0.1" des.js "^1.0.0" inherits "^2.0.1" + safe-buffer "^5.1.2" browserify-rsa@^4.0.0: version "4.0.1" @@ -3534,12 +3564,12 @@ caniuse-api@^1.5.2: lodash.uniq "^4.5.0" caniuse-db@^1.0.30000529, caniuse-db@^1.0.30000634, caniuse-db@^1.0.30000639: - version "1.0.30000856" - resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000856.tgz#fbebb99abe15a5654fc7747ebb5315bdfde3358f" + version "1.0.30000865" + resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000865.tgz#82ffb64d40f7567620aac02d3a632079689abc6b" caniuse-lite@^1.0.30000792, caniuse-lite@^1.0.30000805, caniuse-lite@^1.0.30000844: - version "1.0.30000856" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000856.tgz#ecc16978135a6f219b138991eb62009d25ee8daa" + version "1.0.30000865" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000865.tgz#70026616e8afe6e1442f8bb4e1092987d81a2f25" capture-exit@^1.2.0: version "1.2.0" @@ -3585,8 +3615,8 @@ center-align@^0.1.1: lazy-cache "^1.0.3" cfb@~1.0.2: - version "1.0.7" - resolved "https://registry.yarnpkg.com/cfb/-/cfb-1.0.7.tgz#ccb615eb1bb0a039e7829ab0b2ad4ea564fbaa78" + version "1.0.8" + resolved "https://registry.yarnpkg.com/cfb/-/cfb-1.0.8.tgz#77f213493d697d754fd9c0f5511eab5ad72d02cf" dependencies: commander "^2.14.1" printj "~1.1.2" @@ -3726,8 +3756,8 @@ chokidar@^1.7.0: fsevents "^1.0.0" chokidar@^2.0.0, chokidar@^2.0.2, chokidar@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.0.3.tgz#dcbd4f6cbb2a55b4799ba8a840ac527e5f4b1176" + version "2.0.4" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.0.4.tgz#356ff4e2b0e8e43e322d18a372460bbcf3accd26" dependencies: anymatch "^2.0.0" async-each "^1.0.0" @@ -3736,12 +3766,13 @@ chokidar@^2.0.0, chokidar@^2.0.2, chokidar@^2.0.3: inherits "^2.0.1" is-binary-path "^1.0.0" is-glob "^4.0.0" + lodash.debounce "^4.0.8" normalize-path "^2.1.1" path-is-absolute "^1.0.0" readdirp "^2.0.0" - upath "^1.0.0" + upath "^1.0.5" optionalDependencies: - fsevents "^1.1.2" + fsevents "^1.2.2" chownr@^1.0.1: version "1.0.1" @@ -4052,8 +4083,8 @@ comma-separated-tokens@^1.0.0, comma-separated-tokens@^1.0.1: trim "0.0.1" command-exists@^1.2.2: - version "1.2.6" - resolved "https://registry.yarnpkg.com/command-exists/-/command-exists-1.2.6.tgz#577f8e5feb0cb0f159cd557a51a9be1bdd76e09e" + version "1.2.7" + resolved "https://registry.yarnpkg.com/command-exists/-/command-exists-1.2.7.tgz#16828f0c3ff2b0c58805861ef211b64fc15692a8" command-join@^2.0.0: version "2.0.0" @@ -4063,9 +4094,9 @@ commander@2.11.0: version "2.11.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563" -commander@2.15.x, commander@^2.11.0, commander@^2.14.1, commander@^2.8.1, commander@^2.9.0, commander@~2.15.0: - version "2.15.1" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.15.1.tgz#df46e867d0fc2aec66a34662b406a9ccafff5b0f" +commander@2.16.x, commander@^2.11.0, commander@^2.14.1, commander@^2.8.1, commander@^2.9.0, commander@~2.16.0: + version "2.16.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.16.0.tgz#f16390593996ceb4f3eeb020b31d78528f7f8a50" commander@~2.13.0: version "2.13.0" @@ -4473,17 +4504,14 @@ cors@^2.7.1: object-assign "^4" vary "^1" -cosmiconfig@^2.1.0, cosmiconfig@^2.1.1: - version "2.2.2" - resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-2.2.2.tgz#6173cebd56fac042c1f4390edf7af6c07c7cb892" +cosmiconfig@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-4.0.0.tgz#760391549580bbd2df1e562bc177b13c290972dc" dependencies: is-directory "^0.3.1" - js-yaml "^3.4.3" - minimist "^1.2.0" - object-assign "^4.1.0" - os-homedir "^1.0.1" - parse-json "^2.2.0" - require-from-string "^1.1.0" + js-yaml "^3.9.0" + parse-json "^4.0.0" + require-from-string "^2.0.1" cosmiconfig@^5.0.2: version "5.0.5" @@ -4730,8 +4758,8 @@ csso@~2.3.1: source-map "^0.5.3" cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0": - version "0.3.2" - resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.2.tgz#b8036170c79f07a90ff2f16e22284027a243848b" + version "0.3.4" + resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.4.tgz#8cd52e8a3acfd68d3aed38ee0a640177d2f9d797" "cssstyle@>= 0.3.1 < 0.4.0": version "0.3.1" @@ -4740,8 +4768,8 @@ cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0": cssom "0.3.x" csstype@^2.2.0: - version "2.5.3" - resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.5.3.tgz#2504152e6e1cc59b32098b7f5d6a63f16294c1f7" + version "2.5.5" + resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.5.5.tgz#4125484a3d42189a863943f23b9e4b80fedfa106" csvtojson@^1.1: version "1.1.12" @@ -4774,7 +4802,7 @@ d@1: dependencies: es5-ext "^0.10.9" -damerau-levenshtein@^1.0.0: +damerau-levenshtein@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/damerau-levenshtein/-/damerau-levenshtein-1.0.4.tgz#03191c432cb6eea168bb77f3a55ffdccb8978514" @@ -5542,8 +5570,8 @@ ejs@^2.4.1: resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.6.1.tgz#498ec0d495655abc6f23cd61868d926464071aa0" electron-to-chromium@^1.2.7, electron-to-chromium@^1.3.30, electron-to-chromium@^1.3.47: - version "1.3.48" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.48.tgz#d3b0d8593814044e092ece2108fc3ac9aea4b900" + version "1.3.52" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.52.tgz#d2d9f1270ba4a3b967b831c40ef71fb4d9ab5ce0" elliptic@^6.0.0: version "6.4.0" @@ -5561,7 +5589,7 @@ elliptic@^6.0.0: version "6.1.1" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-6.1.1.tgz#c6cd0ec1b0642e2a3c67a1137efc5e796da4f88e" -emoji-regex@^6.1.0: +emoji-regex@^6.5.1: version "6.5.1" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-6.5.1.tgz#9baea929b155565c11ea41c6626eaa65cef992c2" @@ -5622,9 +5650,9 @@ engine.io@~3.2.0: engine.io-parser "~2.1.0" ws "~3.3.1" -enhanced-resolve@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-4.0.0.tgz#e34a6eaa790f62fccd71d93959f56b2b432db10a" +enhanced-resolve@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-4.1.0.tgz#41c7e0bfdfe74ac1ffe1e57ad6a5c6c9f3742a7f" dependencies: graceful-fs "^4.1.2" memory-fs "^0.4.0" @@ -5656,8 +5684,8 @@ errno@^0.1.3, errno@~0.1.7: prr "~1.0.1" error-ex@^1.2.0, error-ex@^1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.1.tgz#f855a86ce61adc4e8621c3cda21e7a7612c3a8dc" + version "1.3.2" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" dependencies: is-arrayish "^0.2.1" @@ -5800,8 +5828,8 @@ eslint-plugin-flow-vars@^0.5.0: resolved "https://registry.yarnpkg.com/eslint-plugin-flow-vars/-/eslint-plugin-flow-vars-0.5.0.tgz#a7fb78fd873c86e0e5839df3b3c90d47bc68c6d2" eslint-plugin-flowtype@^2.46.1: - version "2.49.3" - resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.49.3.tgz#ccca6ee5ba2027eb3ed36bc2ec8c9a842feee841" + version "2.50.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.50.0.tgz#953e262fa9b5d0fa76e178604892cf60dfb916da" dependencies: lodash "^4.17.10" @@ -5813,8 +5841,8 @@ eslint-plugin-graphql@^2.0.0: lodash "^4.11.1" eslint-plugin-import@^2.9.0: - version "2.12.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.12.0.tgz#dad31781292d6664b25317fd049d2e2b2f02205d" + version "2.13.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.13.0.tgz#df24f241175e312d91662dc91ca84064caec14ed" dependencies: contains-path "^0.1.0" debug "^2.6.8" @@ -5828,32 +5856,33 @@ eslint-plugin-import@^2.9.0: resolve "^1.6.0" eslint-plugin-jsx-a11y@^6.0.2, eslint-plugin-jsx-a11y@^6.0.3: - version "6.0.3" - resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.0.3.tgz#54583d1ae442483162e040e13cc31865465100e5" + version "6.1.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.1.0.tgz#569f6f2d29546cab82cedaa077ec829693b0c42d" dependencies: - aria-query "^0.7.0" + aria-query "^3.0.0" array-includes "^3.0.3" - ast-types-flow "0.0.7" - axobject-query "^0.1.0" - damerau-levenshtein "^1.0.0" - emoji-regex "^6.1.0" - jsx-ast-utils "^2.0.0" + ast-types-flow "^0.0.7" + axobject-query "^2.0.1" + damerau-levenshtein "^1.0.4" + emoji-regex "^6.5.1" + has "^1.0.3" + jsx-ast-utils "^2.0.1" eslint-plugin-prettier@^2.6.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.6.0.tgz#33e4e228bdb06142d03c560ce04ec23f6c767dd7" + version "2.6.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.6.2.tgz#71998c60aedfa2141f7bfcbf9d1c459bf98b4fad" dependencies: fast-diff "^1.1.1" jest-docblock "^21.0.0" eslint-plugin-react@^7.7.0, eslint-plugin-react@^7.8.2: - version "7.9.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.9.1.tgz#101aadd15e7c7b431ed025303ac7b421a8e3dc15" + version "7.10.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.10.0.tgz#af5c1fef31c4704db02098f9be18202993828b50" dependencies: doctrine "^2.1.0" - has "^1.0.2" + has "^1.0.3" jsx-ast-utils "^2.0.1" - prop-types "^15.6.1" + prop-types "^15.6.2" eslint-scope@^3.7.1, eslint-scope@~3.7.1: version "3.7.1" @@ -5909,7 +5938,7 @@ eslint@^4.0.0, eslint@^4.19.1, eslint@^4.5.0: table "4.0.2" text-table "~0.2.0" -espree@^3.5.4: +espree@^3.5.2, espree@^3.5.4: version "3.5.4" resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.4.tgz#b0f447187c8a8bed944b815a660bddf5deb5d1a7" dependencies: @@ -6007,10 +6036,10 @@ exec-series@^1.0.0: object-assign "^4.1.0" exec-sh@^0.2.0: - version "0.2.1" - resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.2.1.tgz#163b98a6e89e6b65b47c2a28d215bc1f63989c38" + version "0.2.2" + resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.2.2.tgz#2a5e7ffcbd7d0ba2755bdecb16e5a427dfbdec36" dependencies: - merge "^1.1.3" + merge "^1.2.0" execa@^0.10.0: version "0.10.0" @@ -6528,10 +6557,10 @@ flat-cache@^1.2.1: write "^0.2.1" flat@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/flat/-/flat-4.0.0.tgz#3abc7f3b588e64ce77dc42fd59aa35806622fea8" + version "4.1.0" + resolved "https://registry.yarnpkg.com/flat/-/flat-4.1.0.tgz#090bec8b05e39cba309747f1d588f04dbaf98db2" dependencies: - is-buffer "~1.1.5" + is-buffer "~2.0.3" flatten@^1.0.2: version "1.0.2" @@ -6557,8 +6586,8 @@ focus-group@^0.3.1: resolved "https://registry.yarnpkg.com/focus-group/-/focus-group-0.3.1.tgz#e0f32ed86b0dabdd6ffcebdf898ecb32e47fedce" follow-redirects@^1.0.0, follow-redirects@^1.2.5, follow-redirects@^1.3.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.0.tgz#234f49cf770b7f35b40e790f636ceba0c3a0ab77" + version "1.5.1" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.1.tgz#67a8f14f5a1f67f962c2c46469c79eaec0a90291" dependencies: debug "^3.1.0" @@ -6735,7 +6764,7 @@ fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" -fsevents@^1.0.0, fsevents@^1.0.14, fsevents@^1.1.2, fsevents@^1.2.3: +fsevents@^1.0.0, fsevents@^1.0.14, fsevents@^1.2.2, fsevents@^1.2.3: version "1.2.4" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.4.tgz#f41dcb1af2582af3692da36fc55cbd8e1041c426" dependencies: @@ -7037,8 +7066,8 @@ globals-docs@^2.4.0: resolved "https://registry.yarnpkg.com/globals-docs/-/globals-docs-2.4.0.tgz#f2c647544eb6161c7c38452808e16e693c2dafbb" globals@^11.0.1, globals@^11.1.0: - version "11.5.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-11.5.0.tgz#6bc840de6771173b191f13d3a9c94d441ee92642" + version "11.7.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.7.0.tgz#a583faa43055b1aca771914bf68258e2fc125673" globals@^9.18.0: version "9.18.0" @@ -7145,8 +7174,8 @@ got@^7.0.0, got@^7.1.0: url-to-options "^1.0.1" got@^8.0.0, got@^8.0.1: - version "8.3.1" - resolved "https://registry.yarnpkg.com/got/-/got-8.3.1.tgz#093324403d4d955f5a16a7a8d39955d055ae10ed" + version "8.3.2" + resolved "https://registry.yarnpkg.com/got/-/got-8.3.2.tgz#1d23f64390e97f776cac52e5b936e5f514d2e937" dependencies: "@sindresorhus/is" "^0.7.0" cacheable-request "^2.1.1" @@ -7167,8 +7196,8 @@ got@^8.0.0, got@^8.0.1: url-to-options "^1.0.1" gotrue-js@^0.9.15: - version "0.9.21" - resolved "https://registry.yarnpkg.com/gotrue-js/-/gotrue-js-0.9.21.tgz#38be75c5dfee370d87166e43ab5b2b56717a1484" + version "0.9.22" + resolved "https://registry.yarnpkg.com/gotrue-js/-/gotrue-js-0.9.22.tgz#2f013c59caba5a17b47ad856cd140842190f93c5" dependencies: micro-api-client "^3.2.1" @@ -7415,7 +7444,7 @@ has-values@^1.0.0: is-number "^3.0.0" kind-of "^4.0.0" -has@^1.0.1, has@^1.0.2: +has@^1.0.1, has@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" dependencies: @@ -7428,12 +7457,16 @@ hash-base@^3.0.0: inherits "^2.0.1" safe-buffer "^5.0.1" +hash-mod@^0.0.5: + version "0.0.5" + resolved "https://registry.yarnpkg.com/hash-mod/-/hash-mod-0.0.5.tgz#daf1e4973a9116643467d54ee7690b43ef802ecc" + hash.js@^1.0.0, hash.js@^1.0.3: - version "1.1.4" - resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.4.tgz#8b50e1f35d51bd01e5ed9ece4dbe3549ccfa0a3c" + version "1.1.5" + resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.5.tgz#e38ab4b85dfb1e0c40fe9265c0e9b54854c23812" dependencies: inherits "^2.0.3" - minimalistic-assert "^1.0.0" + minimalistic-assert "^1.0.1" hast-to-hyperscript@^3.0.0: version "3.1.0" @@ -7448,8 +7481,8 @@ hast-to-hyperscript@^3.0.0: unist-util-is "^2.0.0" hast-util-embedded@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/hast-util-embedded/-/hast-util-embedded-1.0.0.tgz#49d6114b40933a9d0bd708a3b012378f2cd6e86c" + version "1.0.1" + resolved "https://registry.yarnpkg.com/hast-util-embedded/-/hast-util-embedded-1.0.1.tgz#2889896b4fd1d485a51cb9ce4f5bd17b47049eba" dependencies: hast-util-is-element "^1.0.0" @@ -7484,12 +7517,12 @@ hast-util-is-body-ok-link@^1.0.0: hast-util-is-element "^1.0.0" hast-util-is-element@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/hast-util-is-element/-/hast-util-is-element-1.0.0.tgz#3f7216978b2ae14d98749878782675f33be3ce00" + version "1.0.1" + resolved "https://registry.yarnpkg.com/hast-util-is-element/-/hast-util-is-element-1.0.1.tgz#c76e8aafbdb6e5c83265bf50324e2f2e024eb12a" hast-util-parse-selector@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/hast-util-parse-selector/-/hast-util-parse-selector-2.1.0.tgz#b55c0f4bb7bb2040c889c325ef87ab29c38102b4" + version "2.1.1" + resolved "https://registry.yarnpkg.com/hast-util-parse-selector/-/hast-util-parse-selector-2.1.1.tgz#fc06985272f5d204a25187f002bb916521e74f3a" hast-util-raw@^2.0.2: version "2.0.2" @@ -7552,8 +7585,8 @@ hast-util-to-string@^1.0.0: resolved "https://registry.yarnpkg.com/hast-util-to-string/-/hast-util-to-string-1.0.1.tgz#b28055cdca012d3c8fd048757c8483d0de0d002c" hast-util-whitespace@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/hast-util-whitespace/-/hast-util-whitespace-1.0.0.tgz#bd096919625d2936e1ff17bc4df7fd727f17ece9" + version "1.0.1" + resolved "https://registry.yarnpkg.com/hast-util-whitespace/-/hast-util-whitespace-1.0.1.tgz#d67da2c87637b1ce1d85dd15b270ba057930149a" hastscript@^3.0.0: version "3.1.0" @@ -7620,8 +7653,8 @@ hoek@4.x.x: resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.1.tgz#9634502aa12c445dd5a7c5734b572bb8738aacbb" hoist-non-react-statics@^2.1.0, hoist-non-react-statics@^2.5.0: - version "2.5.4" - resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.5.4.tgz#fc3b1ac05d2ae3abedec84eba846511b0d4fcc4f" + version "2.5.5" + resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.5.5.tgz#c5903cf409c0dfd908f388e619d86b9c1174cb47" home-or-tmp@^2.0.0: version "2.0.0" @@ -7641,8 +7674,8 @@ homedir-polyfill@^1.0.1: parse-passwd "^1.0.0" hosted-git-info@^2.1.4, hosted-git-info@^2.5.0, hosted-git-info@^2.6.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.6.0.tgz#23235b29ab230c576aab0d4f13fc046b0b038222" + version "2.7.1" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047" hpack.js@^2.1.6: version "2.1.6" @@ -7668,16 +7701,16 @@ html-entities@^1.2.0: resolved "https://registry.yarnpkg.com/html-entities/-/html-entities-1.2.1.tgz#0df29351f0721163515dfb9e5543e5f6eed5162f" html-minifier@^3.2.3: - version "3.5.16" - resolved "https://registry.yarnpkg.com/html-minifier/-/html-minifier-3.5.16.tgz#39f5aabaf78bdfc057fe67334226efd7f3851175" + version "3.5.18" + resolved "https://registry.yarnpkg.com/html-minifier/-/html-minifier-3.5.18.tgz#fc8b02826cbbafc6de19a103c41c830a91cffe5a" dependencies: camel-case "3.0.x" clean-css "4.1.x" - commander "2.15.x" + commander "2.16.x" he "1.1.x" param-case "2.1.x" relateurl "0.2.x" - uglify-js "3.3.x" + uglify-js "3.4.x" html-void-elements@^1.0.0, html-void-elements@^1.0.1: version "1.0.3" @@ -7833,8 +7866,8 @@ ignore-walk@^3.0.1: minimatch "^3.0.4" ignore@^3.2.7, ignore@^3.3.3, ignore@^3.3.5: - version "3.3.8" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.8.tgz#3f8e9c35d38708a3a7e0e9abb6c73e7ee7707b2b" + version "3.3.10" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043" image-size@^0.6.1: version "0.6.3" @@ -7880,6 +7913,18 @@ immutable@~3.7.6: version "3.7.6" resolved "https://registry.yarnpkg.com/immutable/-/immutable-3.7.6.tgz#13b4d3cb12befa15482a26fe1b2ebae640071e4b" +import-cwd@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/import-cwd/-/import-cwd-2.1.0.tgz#aa6cf36e722761285cb371ec6519f53e2435b0a9" + dependencies: + import-from "^2.1.0" + +import-from@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/import-from/-/import-from-2.1.0.tgz#335db7f2a7affd53aaa471d4b8021dee36b7f3b1" + dependencies: + resolve-from "^3.0.0" + import-lazy@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/import-lazy/-/import-lazy-2.1.0.tgz#05698e3d45c88e8d7e9d92cb0584e77f096f3e43" @@ -8114,8 +8159,8 @@ is-arrayish@^0.2.1: resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" is-arrayish@^0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.3.1.tgz#c2dfc386abaa0c3e33c48db3fe87059e69065efd" + version "0.3.2" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.3.2.tgz#4574a2ae56f7ab206896fb431eaeed066fdf8f03" is-binary-path@^1.0.0: version "1.0.1" @@ -8123,10 +8168,14 @@ is-binary-path@^1.0.0: dependencies: binary-extensions "^1.0.0" -is-buffer@^1.1.4, is-buffer@^1.1.5, is-buffer@~1.1.1, is-buffer@~1.1.5: +is-buffer@^1.1.4, is-buffer@^1.1.5, is-buffer@~1.1.1: version "1.1.6" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" +is-buffer@~2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.3.tgz#4ecf3fcf749cbd1e472689e109ac66261a25e725" + is-builtin-module@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-1.0.0.tgz#540572d34f7ac3119f8f76c30cbc1b1e037affbe" @@ -8138,8 +8187,8 @@ is-bzip2@^1.0.0: resolved "https://registry.yarnpkg.com/is-bzip2/-/is-bzip2-1.0.0.tgz#5ee58eaa5a2e9c80e21407bedf23ae5ac091b3fc" is-callable@^1.1.1, is-callable@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.3.tgz#86eb75392805ddc33af71c92a0eedf74ee7604b2" + version "1.1.4" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75" is-ci@^1.0.10: version "1.1.0" @@ -8348,12 +8397,6 @@ is-object@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-object/-/is-object-1.0.1.tgz#8952688c5ec2ffd6b03ecc85e769e02903083470" -is-odd@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-odd/-/is-odd-2.0.0.tgz#7646624671fd7ea558ccd9a2795182f2958f1b24" - dependencies: - is-number "^4.0.0" - is-online@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/is-online/-/is-online-7.0.0.tgz#7e2408c0ae1e7e37ba8d50bdb237260d32bfd96e" @@ -9025,6 +9068,10 @@ js-tokens@^3.0.0, js-tokens@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" +"js-tokens@^3.0.0 || ^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + js-yaml@3.11.0: version "3.11.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.11.0.tgz#597c1a8bd57152f26d622ce4117851a51f5ebaef" @@ -9032,7 +9079,7 @@ js-yaml@3.11.0: argparse "^1.0.7" esprima "^4.0.0" -js-yaml@^3.10.0, js-yaml@^3.11.0, js-yaml@^3.4.3, js-yaml@^3.5.2, js-yaml@^3.7.0, js-yaml@^3.9.0, js-yaml@^3.9.1: +js-yaml@^3.10.0, js-yaml@^3.11.0, js-yaml@^3.5.2, js-yaml@^3.7.0, js-yaml@^3.9.0, js-yaml@^3.9.1: version "3.12.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1" dependencies: @@ -9187,7 +9234,7 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.10.0" -jsx-ast-utils@^2.0.0, jsx-ast-utils@^2.0.1: +jsx-ast-utils@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-2.0.1.tgz#e801b1b39985e20fffc87b40e3748080e2dcac7f" dependencies: @@ -9294,10 +9341,6 @@ lead@^1.0.0: dependencies: flush-write-stream "^1.0.2" -leb@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/leb/-/leb-0.3.0.tgz#32bee9fad168328d6aea8522d833f4180eed1da3" - left-pad@^1.2.0: version "1.3.0" resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.3.0.tgz#5b8a3a7765dfe001261dde915589e782f8c94d1e" @@ -9561,6 +9604,10 @@ lodash.clonedeep@4.5.0, lodash.clonedeep@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" +lodash.debounce@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" + lodash.defaults@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-4.2.0.tgz#d09178716ffea4dde9e5fb7b37f6f0802274580c" @@ -9753,6 +9800,10 @@ loglevelnext@^1.0.1: es6-symbol "^3.1.1" object.assign "^4.1.0" +long@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28" + long@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/long/-/long-3.2.0.tgz#d821b7138ca1cb581c172990ef14db200b5c474b" @@ -9770,10 +9821,10 @@ longest@^1.0.0, longest@^1.0.1: resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" + version "1.4.0" + resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" dependencies: - js-tokens "^3.0.0" + js-tokens "^3.0.0 || ^4.0.0" loud-rejection@^1.0.0, loud-rejection@^1.2.0, loud-rejection@^1.6.0: version "1.6.0" @@ -10088,7 +10139,7 @@ merge2@^1.2.1: version "1.2.2" resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.2.2.tgz#03212e3da8d86c4d8523cebd6318193414f94e34" -merge@^1.1.3: +merge@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/merge/-/merge-1.2.0.tgz#7531e39d4949c281a66b8c5a6e0265e8b05894da" @@ -10223,14 +10274,7 @@ min-document@^2.19.0: dependencies: dom-walk "^0.1.0" -mini-css-extract-plugin@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-0.4.0.tgz#ff3bf08bee96e618e177c16ca6131bfecef707f9" - dependencies: - loader-utils "^1.1.0" - webpack-sources "^1.1.0" - -mini-css-extract-plugin@^0.4.1: +mini-css-extract-plugin@^0.4.0, mini-css-extract-plugin@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-0.4.1.tgz#d2bcf77bb2596b8e4bd9257e43d3f9164c2e86cb" dependencies: @@ -10242,7 +10286,7 @@ mini-svg-data-uri@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/mini-svg-data-uri/-/mini-svg-data-uri-1.0.1.tgz#d81ffc14b85558860581cc58d9790daaecbe91bf" -minimalistic-assert@^1.0.0: +minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" @@ -10470,16 +10514,19 @@ nan@^2.10.0, nan@^2.9.2: version "2.10.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.10.0.tgz#96d0cd610ebd58d4b4de9cc0c6828cda99c7548f" +nanoid@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-1.0.7.tgz#23857a9514ae8efb7374221b923a2b92be3f74f2" + nanomatch@^1.2.9: - version "1.2.9" - resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.9.tgz#879f7150cb2dab7a471259066c104eee6e0fa7c2" + version "1.2.13" + resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" dependencies: arr-diff "^4.0.0" array-unique "^0.3.2" define-property "^2.0.2" extend-shallow "^3.0.2" fragment-cache "^0.2.1" - is-odd "^2.0.0" is-windows "^1.0.2" kind-of "^6.0.2" object.pick "^1.3.0" @@ -10497,7 +10544,7 @@ ncom@~1.0.1: dependencies: sc-formatter "~3.0.1" -needle@^2.2.0: +needle@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/needle/-/needle-2.2.1.tgz#b5e325bd3aae8c2678902fa296f729455d1d3a7d" dependencies: @@ -10514,8 +10561,8 @@ neo-async@^2.5.0: resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.5.1.tgz#acb909e327b1e87ec9ef15f41b8a269512ad41ee" netlify-cms@^1.3.5: - version "1.9.2" - resolved "https://registry.yarnpkg.com/netlify-cms/-/netlify-cms-1.9.2.tgz#ccc40d5747d14ab4562c1e1fda2d3f3cd8db62ab" + version "1.9.3" + resolved "https://registry.yarnpkg.com/netlify-cms/-/netlify-cms-1.9.3.tgz#f65d82b7779983e471fc40307c900ed809dc2819" dependencies: classnames "^2.2.5" create-react-class "^15.6.0" @@ -10610,8 +10657,8 @@ no-case@^2.2.0, no-case@^2.3.2: lower-case "^1.1.1" node-abi@^2.2.0: - version "2.4.1" - resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-2.4.1.tgz#7628c4d4ec4e9cd3764ceb3652f36b2e7f8d4923" + version "2.4.3" + resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-2.4.3.tgz#43666b7b17e57863e572409edbb82115ac7af28b" dependencies: semver "^5.4.1" @@ -10726,16 +10773,16 @@ node-plop@=0.9.0: resolve "^1.2.0" node-pre-gyp@^0.10.0: - version "0.10.0" - resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.10.0.tgz#6e4ef5bb5c5203c6552448828c852c40111aac46" + version "0.10.3" + resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.10.3.tgz#3070040716afdc778747b61b6887bf78880b80fc" dependencies: detect-libc "^1.0.2" mkdirp "^0.5.1" - needle "^2.2.0" + needle "^2.2.1" nopt "^4.0.1" npm-packlist "^1.1.6" npmlog "^4.0.2" - rc "^1.1.7" + rc "^1.2.7" rimraf "^2.6.1" semver "^5.3.0" tar "^4" @@ -10910,8 +10957,8 @@ number-is-nan@^1.0.0: resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" nwsapi@^2.0.0: - version "2.0.3" - resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.0.3.tgz#3f4010d6c943f34018d3dfb5f2fbc0de90476959" + version "2.0.4" + resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.0.4.tgz#dc79040a5f77b97716dc79565fc7fc3ef7d50570" nyc@^7.0.0: version "7.1.0" @@ -10976,8 +11023,8 @@ object-hash@^1.1.4: resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-1.3.0.tgz#76d9ba6ff113cf8efc0d996102851fe6723963e2" object-keys@^1.0.11, object-keys@^1.0.8, object-keys@~1.0.0: - version "1.0.11" - resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d" + version "1.0.12" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.12.tgz#09c53855377575310cca62f55bb334abff7b3ed2" object-path@^0.11.2: version "0.11.4" @@ -11729,36 +11776,20 @@ postcss-flexbugs-fixes@^3.0.0: dependencies: postcss "^6.0.1" -postcss-load-config@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/postcss-load-config/-/postcss-load-config-1.2.0.tgz#539e9afc9ddc8620121ebf9d8c3673e0ce50d28a" - dependencies: - cosmiconfig "^2.1.0" - object-assign "^4.1.0" - postcss-load-options "^1.2.0" - postcss-load-plugins "^2.3.0" - -postcss-load-options@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/postcss-load-options/-/postcss-load-options-1.2.0.tgz#b098b1559ddac2df04bc0bb375f99a5cfe2b6d8c" - dependencies: - cosmiconfig "^2.1.0" - object-assign "^4.1.0" - -postcss-load-plugins@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/postcss-load-plugins/-/postcss-load-plugins-2.3.0.tgz#745768116599aca2f009fad426b00175049d8d92" +postcss-load-config@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/postcss-load-config/-/postcss-load-config-2.0.0.tgz#f1312ddbf5912cd747177083c5ef7a19d62ee484" dependencies: - cosmiconfig "^2.1.1" - object-assign "^4.1.0" + cosmiconfig "^4.0.0" + import-cwd "^2.0.0" postcss-loader@^2.1.3: - version "2.1.5" - resolved "https://registry.yarnpkg.com/postcss-loader/-/postcss-loader-2.1.5.tgz#3c6336ee641c8f95138172533ae461a83595e788" + version "2.1.6" + resolved "https://registry.yarnpkg.com/postcss-loader/-/postcss-loader-2.1.6.tgz#1d7dd7b17c6ba234b9bed5af13e0bea40a42d740" dependencies: loader-utils "^1.1.0" postcss "^6.0.0" - postcss-load-config "^1.2.0" + postcss-load-config "^2.0.0" schema-utils "^0.4.0" postcss-merge-idents@^2.1.5: @@ -11970,8 +12001,8 @@ postcss@^5.0.10, postcss@^5.0.11, postcss@^5.0.12, postcss@^5.0.13, postcss@^5.0 supports-color "^3.2.3" postcss@^6.0.0, postcss@^6.0.1, postcss@^6.0.14, postcss@^6.0.17, postcss@^6.0.22: - version "6.0.22" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-6.0.22.tgz#e23b78314905c3b90cbd61702121e7a78848f2a3" + version "6.0.23" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-6.0.23.tgz#61c82cc328ac60e677645f979054eb98bc0e3324" dependencies: chalk "^2.4.1" source-map "^0.6.1" @@ -12043,8 +12074,8 @@ prettier-eslint-cli@4.7.1: yargs "10.0.3" prettier-eslint@^8.5.0: - version "8.8.1" - resolved "https://registry.yarnpkg.com/prettier-eslint/-/prettier-eslint-8.8.1.tgz#38505163274742f2a0b31653c39e40f37ebd07da" + version "8.8.2" + resolved "https://registry.yarnpkg.com/prettier-eslint/-/prettier-eslint-8.8.2.tgz#fcb29a48ab4524e234680797fe70e9d136ccaf0b" dependencies: babel-runtime "^6.26.0" common-tags "^1.4.0" @@ -12054,14 +12085,15 @@ prettier-eslint@^8.5.0: lodash.merge "^4.6.0" loglevel-colored-level-prefix "^1.0.0" prettier "^1.7.0" - pretty-format "^22.0.3" + pretty-format "^23.0.1" require-relative "^0.8.7" typescript "^2.5.1" - typescript-eslint-parser "^11.0.0" + typescript-eslint-parser "^16.0.0" + vue-eslint-parser "^2.0.2" prettier@^1.12, prettier@^1.7.0: - version "1.13.5" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.13.5.tgz#7ae2076998c8edce79d63834e9b7b09fead6bfd0" + version "1.13.7" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.13.7.tgz#850f3b8af784a49a6ea2d2eaa7ed1428a34b7281" pretty-bytes@^4.0.2: version "4.0.2" @@ -12074,20 +12106,27 @@ pretty-error@^2.0.2, pretty-error@^2.1.1: renderkid "^2.0.1" utila "~0.4" -pretty-format@^22.0.3, pretty-format@^22.4.0, pretty-format@^22.4.3: +pretty-format@^22.4.0, pretty-format@^22.4.3: version "22.4.3" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-22.4.3.tgz#f873d780839a9c02e9664c8a082e9ee79eaac16f" dependencies: ansi-regex "^3.0.0" ansi-styles "^3.2.0" +pretty-format@^23.0.1: + version "23.2.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-23.2.0.tgz#3b0aaa63c018a53583373c1cb3a5d96cc5e83017" + dependencies: + ansi-regex "^3.0.0" + ansi-styles "^3.2.0" + printj@~1.1.0, printj@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/printj/-/printj-1.1.2.tgz#d90deb2975a8b9f600fb3a1c94e3f4c53c78a222" prismjs@^1.13.0, prismjs@^1.14.0: - version "1.14.0" - resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.14.0.tgz#bbccfdb8be5d850d26453933cb50122ca0362ae0" + version "1.15.0" + resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.15.0.tgz#8801d332e472091ba8def94976c8877ad60398d9" optionalDependencies: clipboard "^2.0.0" @@ -12146,11 +12185,10 @@ promzard@^0.3.0: dependencies: read "1" -prop-types@^15.0.0, prop-types@^15.5.10, prop-types@^15.5.4, prop-types@^15.5.6, prop-types@^15.5.7, prop-types@^15.5.8, prop-types@^15.6.0, prop-types@^15.6.1: - version "15.6.1" - resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.1.tgz#36644453564255ddda391191fb3a125cbdf654ca" +prop-types@^15.0.0, prop-types@^15.5.10, prop-types@^15.5.4, prop-types@^15.5.6, prop-types@^15.5.7, prop-types@^15.5.8, prop-types@^15.6.0, prop-types@^15.6.1, prop-types@^15.6.2: + version "15.6.2" + resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.2.tgz#05d5ca77b4453e985d60fc7ff8c859094a497102" dependencies: - fbjs "^0.8.16" loose-envify "^1.3.1" object-assign "^4.1.1" @@ -12352,7 +12390,7 @@ raw-loader@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/raw-loader/-/raw-loader-0.5.1.tgz#0c3d0beaed8a01c966d9787bf778281252a979aa" -rc@^1.0.1, rc@^1.1.2, rc@^1.1.6, rc@^1.1.7: +rc@^1.0.1, rc@^1.1.2, 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: @@ -12491,8 +12529,8 @@ react-lifecycles-compat@^3.0.0, react-lifecycles-compat@^3.0.2, react-lifecycles resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362" react-modal@^3.1.5: - version "3.4.5" - resolved "https://registry.yarnpkg.com/react-modal/-/react-modal-3.4.5.tgz#75a7eefb8f4c8247278d5ce1c41249d7785d9f69" + version "3.5.1" + resolved "https://registry.yarnpkg.com/react-modal/-/react-modal-3.5.1.tgz#33d38527def90ea324848f7d63e53acc4468a451" dependencies: exenv "^1.2.0" prop-types "^15.5.10" @@ -12565,11 +12603,12 @@ react-sortable-hoc@^0.6.8: prop-types "^15.5.7" react-split-pane@^0.1.66: - version "0.1.77" - resolved "https://registry.yarnpkg.com/react-split-pane/-/react-split-pane-0.1.77.tgz#f0c8cd18d076bbac900248dcf6dbcec02d5340db" + version "0.1.81" + resolved "https://registry.yarnpkg.com/react-split-pane/-/react-split-pane-0.1.81.tgz#b1e8b82e0a6edd10f18fd639a5f512db3cbbb4e6" dependencies: inline-style-prefixer "^3.0.6" prop-types "^15.5.10" + react-lifecycles-compat "^3.0.4" react-style-proptype "^3.0.0" react-style-proptype@^3.0.0: @@ -12611,12 +12650,13 @@ react-transition-group@^1.1.3: warning "^3.0.0" react-transition-group@^2.2.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-2.3.1.tgz#31d611b33e143a5e0f2d94c348e026a0f3b474b6" + version "2.4.0" + resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-2.4.0.tgz#1d9391fabfd82e016f26fabd1eec329dbd922b5a" dependencies: dom-helpers "^3.3.1" loose-envify "^1.3.1" - prop-types "^15.6.1" + prop-types "^15.6.2" + react-lifecycles-compat "^3.0.4" react-waypoint@^7.1.0: version "7.3.4" @@ -12807,8 +12847,8 @@ readdirp@^2.0.0: set-immediate-shim "^1.0.1" realpath-native@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/realpath-native/-/realpath-native-1.0.0.tgz#7885721a83b43bd5327609f0ddecb2482305fdf0" + version "1.0.1" + resolved "https://registry.yarnpkg.com/realpath-native/-/realpath-native-1.0.1.tgz#07f40a0cce8f8261e2e8b7ebebf5c95965d7b633" dependencies: util.promisify "^1.0.0" @@ -13430,9 +13470,9 @@ require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" -require-from-string@^1.1.0: - version "1.2.1" - resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-1.2.1.tgz#529c9ccef27380adfec9a2f965b649bbee636418" +require-from-string@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" require-main-filename@^1.0.1: version "1.0.1" @@ -13516,8 +13556,8 @@ resolve@1.1.7: resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" resolve@^1.1.3, resolve@^1.1.6, resolve@^1.1.7, resolve@^1.2.0, resolve@^1.3.2, resolve@^1.5.0, resolve@^1.6.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.8.0.tgz#a7f2ac27b78480ecc09c83782741d9f26e4f0c3e" + version "1.8.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.8.1.tgz#82f1ec19a423ac1fbd080b0bab06ba36e84a7a26" dependencies: path-parse "^1.0.5" @@ -13888,14 +13928,10 @@ semver-truncate@^1.0.0: dependencies: semver "^5.3.0" -"semver@2 || 3 || 4 || 5", "semver@2.x || 3.x || 4 || 5", semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0: +"semver@2 || 3 || 4 || 5", "semver@2.x || 3.x || 4 || 5", semver@5.5.0, semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0: version "5.5.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab" -semver@5.4.1: - version "5.4.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e" - semver@^4.0.3: version "4.3.6" resolved "https://registry.yarnpkg.com/semver/-/semver-4.3.6.tgz#300bc6e0e86374f7ba61068b5b1ecd57fc6532da" @@ -14047,12 +14083,12 @@ shallow-equal@^1.0.0: resolved "https://registry.yarnpkg.com/shallow-equal/-/shallow-equal-1.0.0.tgz#508d1838b3de590ab8757b011b25e430900945f7" shallowequal@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/shallowequal/-/shallowequal-1.0.2.tgz#1561dbdefb8c01408100319085764da3fcf83f8f" + version "1.1.0" + resolved "https://registry.yarnpkg.com/shallowequal/-/shallowequal-1.1.0.tgz#188d521de95b9087404fd4dcb68b13df0ae4e7f8" sharp@^0.20.2: - version "0.20.3" - resolved "https://registry.yarnpkg.com/sharp/-/sharp-0.20.3.tgz#315cbd44c36a0c403433a5d7b50bcbdf81b0ede0" + version "0.20.5" + resolved "https://registry.yarnpkg.com/sharp/-/sharp-0.20.5.tgz#fc19d9639b1c792fa68a21624c75069923e79edd" dependencies: color "^3.0.0" detect-libc "^1.0.3" @@ -14089,8 +14125,10 @@ shellwords@^0.1.1: resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" shortid@^2.2.6: - version "2.2.8" - resolved "https://registry.yarnpkg.com/shortid/-/shortid-2.2.8.tgz#033b117d6a2e975804f6f0969dbe7d3d0b355131" + version "2.2.11" + resolved "https://registry.yarnpkg.com/shortid/-/shortid-2.2.11.tgz#a77896f086b0dae7fce1237e29232d2aeef5738e" + dependencies: + nanoid "^1.0.7" sift@^5.1.0: version "5.1.0" @@ -14138,8 +14176,8 @@ slash@^1.0.0: resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" slate-base64-serializer@^0.2.8: - version "0.2.34" - resolved "https://registry.yarnpkg.com/slate-base64-serializer/-/slate-base64-serializer-0.2.34.tgz#8a310672bf2f1b00dd469bc5e5247c20bb1ecd40" + version "0.2.39" + resolved "https://registry.yarnpkg.com/slate-base64-serializer/-/slate-base64-serializer-0.2.39.tgz#8ea625cdeae3309a926546fd5b845099ba50fade" dependencies: isomorphic-base64 "^1.0.2" @@ -14162,8 +14200,8 @@ slate-plain-serializer@^0.4.0, slate-plain-serializer@^0.4.6: slate-dev-logger "^0.1.36" slate-prop-types@^0.4.6: - version "0.4.32" - resolved "https://registry.yarnpkg.com/slate-prop-types/-/slate-prop-types-0.4.32.tgz#3d39a6db4b61a416ea54af6512f5ffa5542095d2" + version "0.4.37" + resolved "https://registry.yarnpkg.com/slate-prop-types/-/slate-prop-types-0.4.37.tgz#ac7706dd64fd166066cd8313c4d3942df64ad7f0" dependencies: slate-dev-logger "^0.1.39" @@ -15023,8 +15061,8 @@ tapable@^1.0.0: resolved "https://registry.yarnpkg.com/tapable/-/tapable-1.0.0.tgz#cbb639d9002eed9c6b5975eb20598d7936f1f9f2" tar-fs@^1.13.0: - version "1.16.2" - resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-1.16.2.tgz#17e5239747e399f7e77344f5f53365f04af53577" + version "1.16.3" + resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-1.16.3.tgz#966a628841da2c4010406a82167cbd5e0c72d509" dependencies: chownr "^1.0.1" mkdirp "^0.5.1" @@ -15323,8 +15361,8 @@ toposort@^1.0.0: resolved "https://registry.yarnpkg.com/toposort/-/toposort-1.0.7.tgz#2e68442d9f64ec720b8cc89e6443ac6caa950029" tough-cookie@>=2.3.3, tough-cookie@^2.3.3: - version "2.4.2" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.4.2.tgz#aa9133154518b494efab98a58247bfc38818c00c" + version "2.4.3" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.4.3.tgz#53f36da3f47783b0925afa06ff9f3b165280f781" dependencies: psl "^1.1.24" punycode "^1.4.1" @@ -15390,8 +15428,8 @@ truncate-utf8-bytes@^1.0.0: utf8-byte-length "^1.0.1" tslib@^1.6.0, tslib@^1.9.0: - version "1.9.2" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.2.tgz#8be0cc9a1f6dc7727c38deb16c2ebd1a2892988e" + version "1.9.3" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" tty-browserify@0.0.0: version "0.0.0" @@ -15436,12 +15474,12 @@ typedarray@^0.0.6, typedarray@~0.0.5: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" -typescript-eslint-parser@^11.0.0: - version "11.0.0" - resolved "https://registry.yarnpkg.com/typescript-eslint-parser/-/typescript-eslint-parser-11.0.0.tgz#37dba6a0130dd307504aa4b4b21b0d3dc7d4e9f2" +typescript-eslint-parser@^16.0.0: + version "16.0.1" + resolved "https://registry.yarnpkg.com/typescript-eslint-parser/-/typescript-eslint-parser-16.0.1.tgz#b40681c7043b222b9772748b700a000b241c031b" dependencies: lodash.unescape "4.0.1" - semver "5.4.1" + semver "5.5.0" typescript@^2.5.1: version "2.9.2" @@ -15458,11 +15496,11 @@ uglify-es@^3.3.4: commander "~2.13.0" source-map "~0.6.1" -uglify-js@3.3.x: - version "3.3.28" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.3.28.tgz#0efb9a13850e11303361c1051f64d2ec68d9be06" +uglify-js@3.4.x: + version "3.4.4" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.4.4.tgz#92e79532a3aeffd4b6c65755bdba8d5bad98d607" dependencies: - commander "~2.15.0" + commander "~2.16.0" source-map "~0.6.1" uglify-js@^2.6: @@ -15479,8 +15517,8 @@ uglify-to-browserify@~1.0.0: resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" uglifyjs-webpack-plugin@^1.2.4: - version "1.2.5" - resolved "https://registry.yarnpkg.com/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-1.2.5.tgz#2ef8387c8f1a903ec5e44fa36f9f3cbdcea67641" + version "1.2.7" + resolved "https://registry.yarnpkg.com/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-1.2.7.tgz#57638dd99c853a1ebfe9d97b42160a8a507f9d00" dependencies: cacache "^10.0.4" find-cache-dir "^1.0.0" @@ -15690,8 +15728,8 @@ unist-util-visit@^1.0.0, unist-util-visit@^1.1.0, unist-util-visit@^1.1.1, unist unist-util-is "^2.1.1" universalify@^0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.1.tgz#fa71badd4437af4c148841e3b3b165f9e9e590b7" + version "0.1.2" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" unpipe@1.0.0, unpipe@~1.0.0: version "1.0.0" @@ -15712,7 +15750,7 @@ unzip-response@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/unzip-response/-/unzip-response-2.0.1.tgz#d2f0f737d16b0615e72a6935ed04214572d56f97" -upath@^1.0.0: +upath@^1.0.5: version "1.1.0" resolved "https://registry.yarnpkg.com/upath/-/upath-1.1.0.tgz#35256597e46a581db4793d0ce47fa9aebfc9fabd" @@ -15876,8 +15914,8 @@ uuid@^2.0.1: resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a" uuid@^3.0.0, uuid@^3.0.1, uuid@^3.1.0: - version "3.2.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.2.1.tgz#12c528bb9d58d0b9265d9a2f6f0fe8be17ff1f14" + version "3.3.2" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" uws@8.14.0: version "8.14.0" @@ -16072,8 +16110,8 @@ vinyl@^1.0.0: replace-ext "0.0.1" vinyl@^2.0.0, vinyl@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-2.1.0.tgz#021f9c2cf951d6b939943c89eb5ee5add4fd924c" + version "2.2.0" + resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-2.2.0.tgz#d85b07da96e458d25b2ffe19fece9f2caa13ed86" dependencies: clone "^2.1.1" clone-buffer "^1.0.0" @@ -16088,6 +16126,17 @@ vm-browserify@0.0.4: dependencies: indexof "0.0.1" +vue-eslint-parser@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/vue-eslint-parser/-/vue-eslint-parser-2.0.3.tgz#c268c96c6d94cfe3d938a5f7593959b0ca3360d1" + dependencies: + debug "^3.1.0" + eslint-scope "^3.7.1" + eslint-visitor-keys "^1.0.0" + espree "^3.5.2" + esquery "^1.0.0" + lodash "^4.17.4" + vue-template-compiler@^2.5.16: version "2.5.16" resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.5.16.tgz#93b48570e56c720cdf3f051cc15287c26fbd04cb" @@ -16259,20 +16308,20 @@ webpack-stats-plugin@^0.1.5: resolved "https://registry.yarnpkg.com/webpack-stats-plugin/-/webpack-stats-plugin-0.1.5.tgz#29e5f12ebfd53158d31d656a113ac1f7b86179d9" webpack@^4.12.0: - version "4.12.0" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.12.0.tgz#14758e035ae69747f68dd0edf3c5a572a82bdee9" - dependencies: - "@webassemblyjs/ast" "1.5.12" - "@webassemblyjs/helper-module-context" "1.5.12" - "@webassemblyjs/wasm-edit" "1.5.12" - "@webassemblyjs/wasm-opt" "1.5.12" - "@webassemblyjs/wasm-parser" "1.5.12" + version "4.15.1" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.15.1.tgz#dc716779a3b88827c369f18c71a6137fa7e582fd" + dependencies: + "@webassemblyjs/ast" "1.5.13" + "@webassemblyjs/helper-module-context" "1.5.13" + "@webassemblyjs/wasm-edit" "1.5.13" + "@webassemblyjs/wasm-opt" "1.5.13" + "@webassemblyjs/wasm-parser" "1.5.13" acorn "^5.6.2" acorn-dynamic-import "^3.0.0" ajv "^6.1.0" ajv-keywords "^3.1.0" chrome-trace-event "^1.0.0" - enhanced-resolve "^4.0.0" + enhanced-resolve "^4.1.0" eslint-scope "^3.7.1" json-parse-better-errors "^1.0.2" loader-runner "^2.3.0" @@ -16550,8 +16599,8 @@ xmlhttprequest-ssl@~1.5.4: resolved "https://registry.yarnpkg.com/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz#c2876b06168aadc40e57d97e81191ac8f4398b3e" xstate@^3.1.0: - version "3.3.2" - resolved "https://registry.yarnpkg.com/xstate/-/xstate-3.3.2.tgz#4be8003fef861c5e4dd4ceb1037d9cdd39635316" + version "3.3.3" + resolved "https://registry.yarnpkg.com/xstate/-/xstate-3.3.3.tgz#64177cd4473d4c2424b3df7d2434d835404b09a9" "xtend@>=4.0.0 <4.1.0-0", xtend@^4.0.0, xtend@^4.0.1, xtend@~4.0.0, xtend@~4.0.1: version "4.0.1" @@ -16621,7 +16670,7 @@ yargs@10.0.3: y18n "^3.2.1" yargs-parser "^8.0.0" -yargs@11.0.0, yargs@^11.0.0: +yargs@11.0.0: version "11.0.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-11.0.0.tgz#c052931006c5eee74610e5fc0354bedfd08a201b" dependencies: @@ -16655,7 +16704,7 @@ yargs@^10.0.3: y18n "^3.2.1" yargs-parser "^8.1.0" -yargs@^11.1.0: +yargs@^11.0.0, yargs@^11.1.0: version "11.1.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-11.1.0.tgz#90b869934ed6e871115ea2ff58b03f4724ed2d77" dependencies: @@ -16737,8 +16786,8 @@ yargs@~3.10.0: window-size "0.1.0" yauzl@^2.2.1, yauzl@^2.4.2: - version "2.9.2" - resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-2.9.2.tgz#4fb1bc7ae1fc2f57037b54af6acc8fe1031c5b77" + version "2.10.0" + resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-2.10.0.tgz#c7eb17c93e112cb1086fa6d8e51fb0667b79a5f9" dependencies: buffer-crc32 "~0.2.3" fd-slicer "~1.1.0" From d3acb9ede3bbc0c935bb262463a7484c9cfcb44d Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Tue, 10 Jul 2018 18:53:26 -0700 Subject: [PATCH 22/29] Check if nodes exists, sometimes a test fails otherwise --- packages/gatsby/src/redux/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/gatsby/src/redux/index.js b/packages/gatsby/src/redux/index.js index e1f0ac1ef3658..52f4cad7c2016 100644 --- a/packages/gatsby/src/redux/index.js +++ b/packages/gatsby/src/redux/index.js @@ -120,7 +120,14 @@ exports.store = store * * @returns {Array} */ -exports.getNodes = () => Array.from(store.getState().nodes.values()) +exports.getNodes = () => { + const nodes = store.getState().nodes + if (nodes) { + return Array.from(nodes.values()) + } else { + return [] + } +} const getNode = id => store.getState().nodes.get(id) /** Get node by id from store. From 145a34b4f98c8b60793eb5b8eadec28392266a80 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Tue, 10 Jul 2018 19:01:16 -0700 Subject: [PATCH 23/29] debugging... --- packages/gatsby/src/redux/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/gatsby/src/redux/index.js b/packages/gatsby/src/redux/index.js index 52f4cad7c2016..960e9f0ab8920 100644 --- a/packages/gatsby/src/redux/index.js +++ b/packages/gatsby/src/redux/index.js @@ -40,6 +40,9 @@ try { initialState.nodes = objectToMap(initialState.nodes) } } catch (e) { + if (process.env.NODE_ENV === `test`) { + console.log(`error loading initialState`, e) + } // ignore errors. } From c85d41eb0773f4a99e9ddedd5cc2adac1a780c5b Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Tue, 10 Jul 2018 19:14:20 -0700 Subject: [PATCH 24/29] Work around... --- packages/gatsby/src/redux/index.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/gatsby/src/redux/index.js b/packages/gatsby/src/redux/index.js index 960e9f0ab8920..2e45c8247e341 100644 --- a/packages/gatsby/src/redux/index.js +++ b/packages/gatsby/src/redux/index.js @@ -25,9 +25,13 @@ const mapToObject = map => { // Read from cache the old node data. let initialState = {} try { - initialState = JSON.parse( - fs.readFileSync(`${process.cwd()}/.cache/redux-state.json`) - ) + const file = fs.readFileSync(`${process.cwd()}/.cache/redux-state.json`) + // Apparently the file mocking in node-tracking-test.js + // can override the file reading replacing the mocked string with + // an already parsed object. + if (!_.isPlainObject(file)) { + initialState = JSON.parse(file) + } if (initialState.staticQueryComponents) { initialState.staticQueryComponents = objectToMap( initialState.staticQueryComponents From 2cb28c7c034e59c8346240826995421f65361c2c Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Tue, 10 Jul 2018 19:22:27 -0700 Subject: [PATCH 25/29] Don't need to run bootstrap on tests as jest compiles code --- .travis.yml | 2 +- yarn.lock | 283 +--------------------------------------------------- 2 files changed, 4 insertions(+), 281 deletions(-) diff --git a/.travis.yml b/.travis.yml index 31f4e413e7a4d..44cab9577d4d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,7 +23,7 @@ jobs: - curl -o- -L https://yarnpkg.com/install.sh | bash - export PATH=$HOME/.yarn/bin:$PATH install: - - yarn run bootstrap + - yarn script: - yarn test diff --git a/yarn.lock b/yarn.lock index e44a917a41f16..3b2d0f9c21db9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1447,7 +1447,6 @@ debug "^3.1.0" mamacro "^0.0.3" -<<<<<<< HEAD "@webassemblyjs/floating-point-hex-parser@1.5.13": version "1.5.13" resolved "https://registry.yarnpkg.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.5.13.tgz#29ce0baa97411f70e8cce68ce9c0f9d819a4e298" @@ -1465,92 +1464,13 @@ "@webassemblyjs/helper-code-frame@1.5.13": version "1.5.13" resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.5.13.tgz#1bd2181b6a0be14e004f0fe9f5a660d265362b58" -======= -"@webassemblyjs/ast@1.5.13": - version "1.5.13" - resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.5.13.tgz#81155a570bd5803a30ec31436bc2c9c0ede38f25" - dependencies: - "@webassemblyjs/helper-module-context" "1.5.13" - "@webassemblyjs/helper-wasm-bytecode" "1.5.13" - "@webassemblyjs/wast-parser" "1.5.13" - debug "^3.1.0" - mamacro "^0.0.3" - -"@webassemblyjs/floating-point-hex-parser@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.5.12.tgz#0f36044ffe9652468ce7ae5a08716a4eeff9cd9c" - -"@webassemblyjs/floating-point-hex-parser@1.5.13": - version "1.5.13" - resolved "https://registry.yarnpkg.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.5.13.tgz#29ce0baa97411f70e8cce68ce9c0f9d819a4e298" - -"@webassemblyjs/helper-api-error@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-api-error/-/helper-api-error-1.5.12.tgz#05466833ff2f9d8953a1a327746e1d112ea62aaf" - -"@webassemblyjs/helper-api-error@1.5.13": - version "1.5.13" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-api-error/-/helper-api-error-1.5.13.tgz#e49b051d67ee19a56e29b9aa8bd949b5b4442a59" - -"@webassemblyjs/helper-buffer@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.5.12.tgz#1f0de5aaabefef89aec314f7f970009cd159c73d" - dependencies: - debug "^3.1.0" - -"@webassemblyjs/helper-buffer@1.5.13": - version "1.5.13" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.5.13.tgz#873bb0a1b46449231137c1262ddfd05695195a1e" - dependencies: - debug "^3.1.0" - -"@webassemblyjs/helper-code-frame@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.5.12.tgz#3cdc1953093760d1c0f0caf745ccd62bdb6627c7" ->>>>>>> origin/master dependencies: "@webassemblyjs/wast-printer" "1.5.13" -<<<<<<< HEAD "@webassemblyjs/helper-fsm@1.5.13": version "1.5.13" resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-fsm/-/helper-fsm-1.5.13.tgz#cdf3d9d33005d543a5c5e5adaabf679ffa8db924" -"@webassemblyjs/helper-module-context@1.5.13": - version "1.5.13" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-module-context/-/helper-module-context-1.5.13.tgz#dc29ddfb51ed657655286f94a5d72d8a489147c5" -======= -"@webassemblyjs/helper-code-frame@1.5.13": - version "1.5.13" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.5.13.tgz#1bd2181b6a0be14e004f0fe9f5a660d265362b58" - dependencies: - "@webassemblyjs/wast-printer" "1.5.13" - -"@webassemblyjs/helper-fsm@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-fsm/-/helper-fsm-1.5.12.tgz#6bc1442b037f8e30f2e57b987cee5c806dd15027" - -"@webassemblyjs/helper-fsm@1.5.13": - version "1.5.13" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-fsm/-/helper-fsm-1.5.13.tgz#cdf3d9d33005d543a5c5e5adaabf679ffa8db924" - -"@webassemblyjs/helper-module-context@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-module-context/-/helper-module-context-1.5.12.tgz#b5588ca78b33b8a0da75f9ab8c769a3707baa861" ->>>>>>> origin/master - dependencies: - debug "^3.1.0" - mamacro "^0.0.3" - -<<<<<<< HEAD -"@webassemblyjs/helper-wasm-bytecode@1.5.13": - version "1.5.13" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.5.13.tgz#03245817f0a762382e61733146f5773def15a747" - -"@webassemblyjs/helper-wasm-section@1.5.13": - version "1.5.13" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.5.13.tgz#efc76f44a10d3073b584b43c38a179df173d5c7d" -======= "@webassemblyjs/helper-module-context@1.5.13": version "1.5.13" resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-module-context/-/helper-module-context-1.5.13.tgz#dc29ddfb51ed657655286f94a5d72d8a489147c5" @@ -1558,36 +1478,10 @@ debug "^3.1.0" mamacro "^0.0.3" -"@webassemblyjs/helper-wasm-bytecode@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.5.12.tgz#d12a3859db882a448891a866a05d0be63785b616" - "@webassemblyjs/helper-wasm-bytecode@1.5.13": version "1.5.13" resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.5.13.tgz#03245817f0a762382e61733146f5773def15a747" -"@webassemblyjs/helper-wasm-section@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.5.12.tgz#ff9fe1507d368ad437e7969d25e8c1693dac1884" ->>>>>>> origin/master - dependencies: - "@webassemblyjs/ast" "1.5.13" - "@webassemblyjs/helper-buffer" "1.5.13" - "@webassemblyjs/helper-wasm-bytecode" "1.5.13" - "@webassemblyjs/wasm-gen" "1.5.13" - debug "^3.1.0" - -<<<<<<< HEAD -"@webassemblyjs/ieee754@1.5.13": - version "1.5.13" - resolved "https://registry.yarnpkg.com/@webassemblyjs/ieee754/-/ieee754-1.5.13.tgz#573e97c8c12e4eebb316ca5fde0203ddd90b0364" - dependencies: - ieee754 "^1.1.11" - -"@webassemblyjs/leb128@1.5.13": - version "1.5.13" - resolved "https://registry.yarnpkg.com/@webassemblyjs/leb128/-/leb128-1.5.13.tgz#ab52ebab9cec283c1c1897ac1da833a04a3f4cee" -======= "@webassemblyjs/helper-wasm-section@1.5.13": version "1.5.13" resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.5.13.tgz#efc76f44a10d3073b584b43c38a179df173d5c7d" @@ -1598,68 +1492,22 @@ "@webassemblyjs/wasm-gen" "1.5.13" debug "^3.1.0" -"@webassemblyjs/ieee754@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/ieee754/-/ieee754-1.5.12.tgz#ee9574bc558888f13097ce3e7900dff234ea19a4" - dependencies: - ieee754 "^1.1.11" - "@webassemblyjs/ieee754@1.5.13": version "1.5.13" resolved "https://registry.yarnpkg.com/@webassemblyjs/ieee754/-/ieee754-1.5.13.tgz#573e97c8c12e4eebb316ca5fde0203ddd90b0364" dependencies: ieee754 "^1.1.11" -"@webassemblyjs/leb128@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/leb128/-/leb128-1.5.12.tgz#0308eec652765ee567d8a5fa108b4f0b25b458e1" ->>>>>>> origin/master - dependencies: - long "4.0.0" - -<<<<<<< HEAD -"@webassemblyjs/utf8@1.5.13": - version "1.5.13" - resolved "https://registry.yarnpkg.com/@webassemblyjs/utf8/-/utf8-1.5.13.tgz#6b53d2cd861cf94fa99c1f12779dde692fbc2469" - -"@webassemblyjs/wasm-edit@1.5.13": - version "1.5.13" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.5.13.tgz#c9cef5664c245cf11b3b3a73110c9155831724a8" -======= "@webassemblyjs/leb128@1.5.13": version "1.5.13" resolved "https://registry.yarnpkg.com/@webassemblyjs/leb128/-/leb128-1.5.13.tgz#ab52ebab9cec283c1c1897ac1da833a04a3f4cee" dependencies: long "4.0.0" -"@webassemblyjs/utf8@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/utf8/-/utf8-1.5.12.tgz#d5916222ef314bf60d6806ed5ac045989bfd92ce" - "@webassemblyjs/utf8@1.5.13": version "1.5.13" resolved "https://registry.yarnpkg.com/@webassemblyjs/utf8/-/utf8-1.5.13.tgz#6b53d2cd861cf94fa99c1f12779dde692fbc2469" -"@webassemblyjs/wasm-edit@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.5.12.tgz#821c9358e644a166f2c910e5af1b46ce795a17aa" ->>>>>>> origin/master - dependencies: - "@webassemblyjs/ast" "1.5.13" - "@webassemblyjs/helper-buffer" "1.5.13" - "@webassemblyjs/helper-wasm-bytecode" "1.5.13" - "@webassemblyjs/helper-wasm-section" "1.5.13" - "@webassemblyjs/wasm-gen" "1.5.13" - "@webassemblyjs/wasm-opt" "1.5.13" - "@webassemblyjs/wasm-parser" "1.5.13" - "@webassemblyjs/wast-printer" "1.5.13" - debug "^3.1.0" - -<<<<<<< HEAD -"@webassemblyjs/wasm-gen@1.5.13": - version "1.5.13" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.5.13.tgz#8e6ea113c4b432fa66540189e79b16d7a140700e" -======= "@webassemblyjs/wasm-edit@1.5.13": version "1.5.13" resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.5.13.tgz#c9cef5664c245cf11b3b3a73110c9155831724a8" @@ -1674,22 +1522,6 @@ "@webassemblyjs/wast-printer" "1.5.13" debug "^3.1.0" -"@webassemblyjs/wasm-gen@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.5.12.tgz#0b7ccfdb93dab902cc0251014e2e18bae3139bcb" ->>>>>>> origin/master - dependencies: - "@webassemblyjs/ast" "1.5.13" - "@webassemblyjs/helper-wasm-bytecode" "1.5.13" - "@webassemblyjs/ieee754" "1.5.13" - "@webassemblyjs/leb128" "1.5.13" - "@webassemblyjs/utf8" "1.5.13" - -<<<<<<< HEAD -"@webassemblyjs/wasm-opt@1.5.13": - version "1.5.13" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.5.13.tgz#147aad7717a7ee4211c36b21a5f4c30dddf33138" -======= "@webassemblyjs/wasm-gen@1.5.13": version "1.5.13" resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.5.13.tgz#8e6ea113c4b432fa66540189e79b16d7a140700e" @@ -1700,19 +1532,6 @@ "@webassemblyjs/leb128" "1.5.13" "@webassemblyjs/utf8" "1.5.13" -"@webassemblyjs/wasm-opt@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.5.12.tgz#bd758a8bc670f585ff1ae85f84095a9e0229cbc9" ->>>>>>> origin/master - dependencies: - "@webassemblyjs/ast" "1.5.13" - "@webassemblyjs/helper-buffer" "1.5.13" - "@webassemblyjs/wasm-gen" "1.5.13" - "@webassemblyjs/wasm-parser" "1.5.13" - debug "^3.1.0" - -<<<<<<< HEAD -======= "@webassemblyjs/wasm-opt@1.5.13": version "1.5.13" resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.5.13.tgz#147aad7717a7ee4211c36b21a5f4c30dddf33138" @@ -1723,18 +1542,6 @@ "@webassemblyjs/wasm-parser" "1.5.13" debug "^3.1.0" -"@webassemblyjs/wasm-parser@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.5.12.tgz#7b10b4388ecf98bd7a22e702aa62ec2f46d0c75e" - dependencies: - "@webassemblyjs/ast" "1.5.12" - "@webassemblyjs/helper-api-error" "1.5.12" - "@webassemblyjs/helper-wasm-bytecode" "1.5.12" - "@webassemblyjs/ieee754" "1.5.12" - "@webassemblyjs/leb128" "1.5.12" - "@webassemblyjs/utf8" "1.5.12" - ->>>>>>> origin/master "@webassemblyjs/wasm-parser@1.5.13": version "1.5.13" resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.5.13.tgz#6f46516c5bb23904fbdf58009233c2dd8a54c72f" @@ -1746,7 +1553,6 @@ "@webassemblyjs/leb128" "1.5.13" "@webassemblyjs/utf8" "1.5.13" -<<<<<<< HEAD "@webassemblyjs/wast-parser@1.5.13": version "1.5.13" resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-parser/-/wast-parser-1.5.13.tgz#5727a705d397ae6a3ae99d7f5460acf2ec646eea" @@ -1759,43 +1565,6 @@ long "^3.2.0" mamacro "^0.0.3" -"@webassemblyjs/wast-printer@1.5.13": - version "1.5.13" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-printer/-/wast-printer-1.5.13.tgz#bb34d528c14b4f579e7ec11e793ec50ad7cd7c95" -======= -"@webassemblyjs/wast-parser@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-parser/-/wast-parser-1.5.12.tgz#9cf5ae600ecae0640437b5d4de5dd6b6088d0d8b" - dependencies: - "@webassemblyjs/ast" "1.5.12" - "@webassemblyjs/floating-point-hex-parser" "1.5.12" - "@webassemblyjs/helper-api-error" "1.5.12" - "@webassemblyjs/helper-code-frame" "1.5.12" - "@webassemblyjs/helper-fsm" "1.5.12" - long "^3.2.0" - mamacro "^0.0.3" - -"@webassemblyjs/wast-parser@1.5.13": - version "1.5.13" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-parser/-/wast-parser-1.5.13.tgz#5727a705d397ae6a3ae99d7f5460acf2ec646eea" - dependencies: - "@webassemblyjs/ast" "1.5.13" - "@webassemblyjs/floating-point-hex-parser" "1.5.13" - "@webassemblyjs/helper-api-error" "1.5.13" - "@webassemblyjs/helper-code-frame" "1.5.13" - "@webassemblyjs/helper-fsm" "1.5.13" - long "^3.2.0" - mamacro "^0.0.3" - -"@webassemblyjs/wast-printer@1.5.12": - version "1.5.12" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-printer/-/wast-printer-1.5.12.tgz#563ca4d01b22d21640b2463dc5e3d7f7d9dac520" ->>>>>>> origin/master - dependencies: - "@webassemblyjs/ast" "1.5.13" - "@webassemblyjs/wast-parser" "1.5.13" - long "^3.2.0" - "@webassemblyjs/wast-printer@1.5.13": version "1.5.13" resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-printer/-/wast-printer-1.5.13.tgz#bb34d528c14b4f579e7ec11e793ec50ad7cd7c95" @@ -5937,14 +5706,6 @@ enhanced-resolve@^4.1.0: memory-fs "^0.4.0" tapable "^1.0.0" -enhanced-resolve@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-4.1.0.tgz#41c7e0bfdfe74ac1ffe1e57ad6a5c6c9f3742a7f" - dependencies: - graceful-fs "^4.1.2" - memory-fs "^0.4.0" - tapable "^1.0.0" - entities@^1.1.1, entities@~1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.1.tgz#6e5c2d0a5621b5dadaecef80b90edfb5cd7772f0" @@ -15885,11 +15646,7 @@ tsickle@^0.27.2: source-map "^0.6.0" source-map-support "^0.5.0" -tslib@^1.6.0, tslib@^1.9.0: - version "1.9.3" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" - -tslib@^1.7.1: +tslib@^1.6.0, tslib@^1.7.1, tslib@^1.9.0: version "1.9.3" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" @@ -16387,11 +16144,7 @@ uuid@^2.0.1: version "2.0.3" resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a" -uuid@^3.0.0, uuid@^3.0.1, uuid@^3.1.0: - version "3.3.2" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" - -uuid@^3.2.1: +uuid@^3.0.0, uuid@^3.0.1, uuid@^3.1.0, uuid@^3.2.1: version "3.3.2" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" @@ -16785,37 +16538,7 @@ webpack-stats-plugin@^0.1.5: version "0.1.5" resolved "https://registry.yarnpkg.com/webpack-stats-plugin/-/webpack-stats-plugin-0.1.5.tgz#29e5f12ebfd53158d31d656a113ac1f7b86179d9" -webpack@^4.12.0: - version "4.15.1" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.15.1.tgz#dc716779a3b88827c369f18c71a6137fa7e582fd" - dependencies: - "@webassemblyjs/ast" "1.5.13" - "@webassemblyjs/helper-module-context" "1.5.13" - "@webassemblyjs/wasm-edit" "1.5.13" - "@webassemblyjs/wasm-opt" "1.5.13" - "@webassemblyjs/wasm-parser" "1.5.13" - acorn "^5.6.2" - acorn-dynamic-import "^3.0.0" - ajv "^6.1.0" - ajv-keywords "^3.1.0" - chrome-trace-event "^1.0.0" - enhanced-resolve "^4.1.0" - eslint-scope "^3.7.1" - json-parse-better-errors "^1.0.2" - loader-runner "^2.3.0" - loader-utils "^1.1.0" - memory-fs "~0.4.1" - micromatch "^3.1.8" - mkdirp "~0.5.0" - neo-async "^2.5.0" - node-libs-browser "^2.0.0" - schema-utils "^0.4.4" - tapable "^1.0.0" - uglifyjs-webpack-plugin "^1.2.4" - watchpack "^1.5.0" - webpack-sources "^1.0.1" - -webpack@^4.14.0: +webpack@^4.12.0, webpack@^4.14.0: version "4.15.1" resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.15.1.tgz#dc716779a3b88827c369f18c71a6137fa7e582fd" dependencies: From b7ebd8e753f91568dd3a419eac78752bcbb62d74 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Tue, 10 Jul 2018 19:22:51 -0700 Subject: [PATCH 26/29] Lodash uses Object.entries which fails on node 6... :-" --- packages/gatsby/src/redux/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/gatsby/src/redux/index.js b/packages/gatsby/src/redux/index.js index 2e45c8247e341..2438a4e2ee00f 100644 --- a/packages/gatsby/src/redux/index.js +++ b/packages/gatsby/src/redux/index.js @@ -29,7 +29,7 @@ try { // Apparently the file mocking in node-tracking-test.js // can override the file reading replacing the mocked string with // an already parsed object. - if (!_.isPlainObject(file)) { + if (typeof file === `object`) { initialState = JSON.parse(file) } if (initialState.staticQueryComponents) { From a4a13910534a15c09ec9864f8bf534c153b1a312 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Tue, 10 Jul 2018 19:27:31 -0700 Subject: [PATCH 27/29] Ok, do need bootstrap to link packages --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 44cab9577d4d8..31f4e413e7a4d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,7 +23,7 @@ jobs: - curl -o- -L https://yarnpkg.com/install.sh | bash - export PATH=$HOME/.yarn/bin:$PATH install: - - yarn + - yarn run bootstrap script: - yarn test From aa4704363bcb9000943addeb522da76d592a3dec Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Tue, 10 Jul 2018 19:38:47 -0700 Subject: [PATCH 28/29] Try try again --- packages/gatsby/src/redux/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/gatsby/src/redux/index.js b/packages/gatsby/src/redux/index.js index 2438a4e2ee00f..4f5045543aa57 100644 --- a/packages/gatsby/src/redux/index.js +++ b/packages/gatsby/src/redux/index.js @@ -29,7 +29,7 @@ try { // Apparently the file mocking in node-tracking-test.js // can override the file reading replacing the mocked string with // an already parsed object. - if (typeof file === `object`) { + if (Buffer.isBuffer(file) || typeof file === `string`) { initialState = JSON.parse(file) } if (initialState.staticQueryComponents) { From fa32e5dca64acea4d715391b8f856022e1399785 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Tue, 10 Jul 2018 19:48:44 -0700 Subject: [PATCH 29/29] Ugh, problem was Object.entries isn't in Node 6 --- packages/gatsby/src/redux/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/gatsby/src/redux/index.js b/packages/gatsby/src/redux/index.js index 4f5045543aa57..a8c9105b44ebc 100644 --- a/packages/gatsby/src/redux/index.js +++ b/packages/gatsby/src/redux/index.js @@ -12,7 +12,13 @@ const emitter = mitt() // Reducers const reducers = require(`./reducers`) -const objectToMap = obj => new Map(Object.entries(obj)) +const objectToMap = obj => { + let map = new Map() + Object.keys(obj).forEach(key => { + map.set(key, obj[key]) + }) + return map +} const mapToObject = map => { const obj = {}