You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/gatsby-lifecycle-apis.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,23 +29,23 @@ During "bootstrap" gatsby:
29
29
- extracts, runs, and replaces graphql queries for pages and `StaticQuery`s
30
30
- writes out the pages to cache
31
31
32
-
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.
32
+
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.
33
33
34
-
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 provided plugins in `gatsby-node.js`, `gatsby-browser.js` or `gatsby-ssr.js`. **The sequence of your plugins matter**, so if the output of one plugin depends on another you should be sure to reflect this in `gatsby-config.js`.
34
+
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`.
35
35
36
36
The sequence of the **main** bootstrap Node API lifecycles are:
37
37
38
-
-[onPreBootstrap](https://www.gatsbyjs.org/docs/node-apis/#onPreBootstrap)eg implemented by [gatsby-plugin-typography](https://github.com/gatsbyjs/gatsby/blob/06e4fccb1abc32ba29e878bb3de303afac390e4a/packages/gatsby-plugin-typography/src/gatsby-node.js)
39
-
-[sourceNodes](https://www.gatsbyjs.org/docs/node-apis/#sourceNodes)eg implemented by [gatsby-source-wikipedia](https://github.com/gatsbyjs/gatsby/blob/1fb19f9ad16618acdac7eda33d295d8ceba7f393/packages/gatsby-source-wikipedia/src/gatsby-node.js)
38
+
-[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)
39
+
-[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)
40
40
- within this `createNode` can be called multiple times, which then triggers [onCreateNode](https://www.gatsbyjs.org/docs/node-apis/#onCreateNode).
41
41
- (the first schema build happens here)
42
-
-[resolvableExtensions](https://www.gatsbyjs.org/docs/node-apis/#resolvableExtensions) for filetype/language extensions eg [gatsby-plugin-typescript](https://github.com/gatsbyjs/gatsby/blob/1fb19f9ad16618acdac7eda33d295d8ceba7f393/packages/gatsby-plugin-typescript/src/gatsby-node.js)
43
-
-[createPages](https://www.gatsbyjs.org/docs/node-apis/#createPages)eg implemented by [page-hot-reloader](https://github.com/gatsbyjs/gatsby/blob/1fb19f9ad16618acdac7eda33d295d8ceba7f393/packages/gatsby/src/bootstrap/page-hot-reloader.js)
42
+
-[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)
43
+
-[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)
44
44
- within this `createPage` can be called any number of times, which then triggers [onCreatePage](https://www.gatsbyjs.org/docs/node-apis/#onCreatePage)
45
-
-[onPreExtractQueries](https://www.gatsbyjs.org/docs/node-apis/#onPreExtractQueries)eg implemented by [gatsby-transformer-sharp](https://github.com/gatsbyjs/gatsby/blob/1fb19f9ad16618acdac7eda33d295d8ceba7f393/packages/gatsby-transformer-sharp/src/gatsby-node.js) and [gatsby-source-contentful](https://github.com/gatsbyjs/gatsby/blob/73523c39bba87869d802d8a3445279e42671efdb/packages/gatsby-source-contentful/src/gatsby-node.js)
45
+
-[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)
46
46
- (schema update happens here)
47
-
-**extract queries from components** where the [queryCompiler](https://github.com/gatsbyjs/gatsby/blob/ffd8b2d691c995c760fe380769852bcdb26a2278/packages/gatsby/src/internal-plugins/query-runner/query-compiler.js#L189) replaces page GraphQL queries and `StaticQueries`
48
-
- The [queries are run](https://github.com/gatsbyjs/gatsby/blob/ffd8b2d691c995c760fe380769852bcdb26a2278/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js#L100), and the [pages are written out](https://github.com/gatsbyjs/gatsby/blob/ffd8b2d691c995c760fe380769852bcdb26a2278/packages/gatsby/src/internal-plugins/query-runner/pages-writer.js)
47
+
-**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`
48
+
- 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)
49
49
-[onPostBoostrap](https://www.gatsbyjs.org/docs/node-apis/#onPostBootstrap) is called (but it is not often used)
0 commit comments