diff --git a/docs/docs/gatsby-lifecycle-apis.md b/docs/docs/gatsby-lifecycle-apis.md index 19a723fc54773..07fae023b6baa 100644 --- a/docs/docs/gatsby-lifecycle-apis.md +++ b/docs/docs/gatsby-lifecycle-apis.md @@ -29,20 +29,20 @@ During "bootstrap" gatsby: - extracts, runs, and replaces graphql queries for pages and `StaticQuery`s - writes out the pages to cache -In development this is a running process powered by [Webpack](https://github.com/gatsbyjs/gatsby/blob/dd91b8dceb3b8a20820b15acae36529799217ae4/packages/gatsby/package.json#L128) and [react-hot-loader](https://github.com/gatsbyjs/gatsby/blob/dd91b8dceb3b8a20820b15acae36529799217ae4/packages/gatsby/package.json#L104), so changes to any files get re-run through the sequence again, with [smart cache invalidation](https://github.com/gatsbyjs/gatsby/blob/ffd8b2d691c995c760fe380769852bcdb26a2278/packages/gatsby/src/bootstrap/index.js#L141). In particular, source plugins like gatsby-source-filesystem can also be watching files for changes which can trigger re-running queries. Queries are also watched so if you modify a query your development environment is reloaded. +In development this is a running process powered by [Webpack](https://github.com/gatsbyjs/gatsby/blob/dd91b8dceb3b8a20820b15acae36529799217ae4/packages/gatsby/package.json#L128) and [`react-hot-loader`](https://github.com/gatsbyjs/gatsby/blob/dd91b8dceb3b8a20820b15acae36529799217ae4/packages/gatsby/package.json#L104), so changes to any files get re-run through the sequence again, with [smart cache invalidation](https://github.com/gatsbyjs/gatsby/blob/ffd8b2d691c995c760fe380769852bcdb26a2278/packages/gatsby/src/bootstrap/index.js#L141). For example, `gatsby-source-filesystem` watches files for changes, and each change triggers re-running queries. Other plugins may also perform this service. Queries are also watched so if you modify a query your development app is hot reloaded. The core of the bootstrap process is the "api-runner", which helps to execute APIs in sequence, with state managed in Redux. Gatsby exposes a number of lifecycle APIs which can either be implemented by you (or any of your configured plugins) in `gatsby-node.js`, `gatsby-browser.js` or `gatsby-ssr.js`. The sequence of the **main** bootstrap Node API lifecycles are: -- [onPreBootstrap](https://www.gatsbyjs.org/docs/node-apis/#onPreBootstrap) e.g. implemented by [gatsby-plugin-typography](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-plugin-typography/src/gatsby-node.js) -- [sourceNodes](https://www.gatsbyjs.org/docs/node-apis/#sourceNodes) e.g. implemented by [gatsby-source-wikipedia](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-source-wikipedia/src/gatsby-node.js) +- [onPreBootstrap](https://www.gatsbyjs.org/docs/node-apis/#onPreBootstrap) e.g. implemented by [`gatsby-plugin-typography`](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-plugin-typography/src/gatsby-node.js) +- [sourceNodes](https://www.gatsbyjs.org/docs/node-apis/#sourceNodes) e.g. implemented by [`gatsby-source-wikipedia`](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-source-wikipedia/src/gatsby-node.js) - within this `createNode` can be called multiple times, which then triggers [onCreateNode](https://www.gatsbyjs.org/docs/node-apis/#onCreateNode). - (the first schema build happens here) -- [resolvableExtensions](https://www.gatsbyjs.org/docs/node-apis/#resolvableExtensions) for filetype/language extensions eg [gatsby-plugin-typescript](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-plugin-typescript/src/gatsby-node.js) -- [createPages](https://www.gatsbyjs.org/docs/node-apis/#createPages) e.g. implemented by [page-hot-reloader](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/bootstrap/page-hot-reloader.js) +- [resolvableExtensions](https://www.gatsbyjs.org/docs/node-apis/#resolvableExtensions) for filetype/language extensions eg [`gatsby-plugin-typescript`](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-plugin-typescript/src/gatsby-node.js) +- [createPages](https://www.gatsbyjs.org/docs/node-apis/#createPages) e.g. implemented by [`page-hot-reloader`](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/bootstrap/page-hot-reloader.js) - within this `createPage` can be called any number of times, which then triggers [onCreatePage](https://www.gatsbyjs.org/docs/node-apis/#onCreatePage) -- [onPreExtractQueries](https://www.gatsbyjs.org/docs/node-apis/#onPreExtractQueries) e.g. implemented by [gatsby-transformer-sharp](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-transformer-sharp/src/gatsby-node.js) and [gatsby-source-contentful](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-source-contentful/src/gatsby-node.js) +- [onPreExtractQueries](https://www.gatsbyjs.org/docs/node-apis/#onPreExtractQueries) e.g. implemented by [`gatsby-transformer-sharp`](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-transformer-sharp/src/gatsby-node.js) and [`gatsby-source-contentful`](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-source-contentful/src/gatsby-node.js) - (schema update happens here) - **extract queries from components** where the [queryCompiler](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/internal-plugins/query-runner/query-compiler.js#L189) replaces page GraphQL queries and `StaticQueries` - The [queries are run](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js#L100), and the [pages are written out](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/internal-plugins/query-runner/pages-writer.js)