gatsby 2.32.2 → 2.32.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/cli.js +0 -0
- package/dist/bootstrap/create-graphql-runner.d.ts +11 -11
- package/dist/bootstrap/get-config-file.d.ts +4 -4
- package/dist/bootstrap/load-plugins/index.d.ts +2 -2
- package/dist/bootstrap/load-plugins/load.d.ts +11 -11
- package/dist/bootstrap/load-plugins/types.d.ts +40 -40
- package/dist/bootstrap/load-plugins/validate.d.ts +39 -39
- package/dist/bootstrap/prefer-default.d.ts +1 -1
- package/dist/bootstrap/redirects-writer.d.ts +2 -2
- package/dist/bootstrap/remove-stale-jobs.d.ts +2 -2
- package/dist/bootstrap/requires-writer.d.ts +10 -10
- package/dist/bootstrap/resolve-module-exports.d.ts +15 -15
- package/dist/commands/develop-static.d.ts +3 -3
- package/dist/commands/types.d.ts +48 -48
- package/dist/db/common/query.d.ts +37 -37
- package/dist/internal.d.ts +5 -5
- package/dist/joi-schemas/joi.d.ts +6 -6
- package/dist/query/error-parser.d.ts +19 -19
- package/dist/query/graphql-runner.d.ts +30 -30
- package/dist/query/graphql-span-tracer.d.ts +19 -19
- package/dist/query/query-watcher.d.ts +17 -17
- package/dist/query/types.d.ts +34 -34
- package/dist/query/utils.d.ts +4 -4
- package/dist/redux/actions/add-page-dependency.d.ts +5 -5
- package/dist/redux/actions/index.d.ts +13 -13
- package/dist/redux/actions/internal.d.ts +109 -109
- package/dist/redux/actions/restricted.d.ts +293 -293
- package/dist/redux/index.d.ts +12 -12
- package/dist/redux/nodes.d.ts +92 -92
- package/dist/redux/persist.d.ts +3 -3
- package/dist/redux/plugin-runner.d.ts +1 -1
- package/dist/redux/reducers/babelrc.d.ts +9 -9
- package/dist/redux/reducers/components.d.ts +7 -7
- package/dist/redux/reducers/config.d.ts +2 -2
- package/dist/redux/reducers/definitions.d.ts +2 -2
- package/dist/redux/reducers/flattened-plugins.d.ts +15 -15
- package/dist/redux/reducers/index.d.ts +34 -34
- package/dist/redux/reducers/inference-metadata.d.ts +7 -7
- package/dist/redux/reducers/jobs.d.ts +5 -5
- package/dist/redux/reducers/jobsv2.d.ts +5 -5
- package/dist/redux/reducers/last-action.d.ts +2 -2
- package/dist/redux/reducers/nodes-by-type.d.ts +2 -2
- package/dist/redux/reducers/nodes-touched.d.ts +3 -3
- package/dist/redux/reducers/nodes.d.ts +2 -2
- package/dist/redux/reducers/page-data-stats.d.ts +2 -2
- package/dist/redux/reducers/page-data.d.ts +2 -2
- package/dist/redux/reducers/pages.d.ts +2 -2
- package/dist/redux/reducers/pending-page-data-writes.d.ts +4 -4
- package/dist/redux/reducers/program.d.ts +2 -2
- package/dist/redux/reducers/queries.d.ts +26 -26
- package/dist/redux/reducers/redirects.d.ts +2 -2
- package/dist/redux/reducers/resolved-nodes.d.ts +2 -2
- package/dist/redux/reducers/schema-customization.d.ts +23 -23
- package/dist/redux/reducers/schema.d.ts +3 -3
- package/dist/redux/reducers/static-queries-by-template.d.ts +2 -2
- package/dist/redux/reducers/static-query-components.d.ts +2 -2
- package/dist/redux/reducers/status.d.ts +5 -5
- package/dist/redux/reducers/themes.d.ts +2 -2
- package/dist/redux/reducers/visited-page.d.ts +2 -2
- package/dist/redux/reducers/webpack-compilation-hash.d.ts +2 -2
- package/dist/redux/reducers/webpack.d.ts +2 -2
- package/dist/redux/types.d.ts +667 -667
- package/dist/schema/context.d.ts +13 -13
- package/dist/schema/infer/inference-metadata.d.ts +72 -72
- package/dist/schema/infer/type-conflict-reporter.d.ts +28 -28
- package/dist/schema/resolvers.d.ts +34 -34
- package/dist/schema/type-definitions.d.ts +42 -42
- package/dist/schema/types/date.d.ts +40 -40
- package/dist/schema/types/derived-types.d.ts +42 -42
- package/dist/schema/types/filter.d.ts +12 -12
- package/dist/schema/types/node-interface.d.ts +14 -14
- package/dist/schema/types/sort.d.ts +18 -18
- package/dist/schema/types/type-builders.d.ts +36 -36
- package/dist/services/build-schema.d.ts +2 -2
- package/dist/services/calculate-dirty-queries.d.ts +5 -5
- package/dist/services/create-pages-statefully.d.ts +2 -2
- package/dist/services/create-pages.d.ts +5 -5
- package/dist/services/customize-schema.d.ts +2 -2
- package/dist/services/extract-queries.d.ts +2 -2
- package/dist/services/index.d.ts +19 -19
- package/dist/services/initialize.d.ts +8 -8
- package/dist/services/listen-for-mutations.d.ts +2 -2
- package/dist/services/listen-to-webpack.d.ts +3 -3
- package/dist/services/post-bootstrap.d.ts +2 -2
- package/dist/services/rebuild-schema-with-site-pages.d.ts +2 -2
- package/dist/services/recompile.d.ts +3 -3
- package/dist/services/run-mutation-batch.d.ts +2 -2
- package/dist/services/run-page-queries.d.ts +2 -2
- package/dist/services/run-static-queries.d.ts +2 -2
- package/dist/services/source-nodes.d.ts +5 -5
- package/dist/services/start-webpack-server.d.ts +9 -9
- package/dist/services/types.d.ts +45 -45
- package/dist/services/write-out-redirects.d.ts +2 -2
- package/dist/services/write-out-requires.d.ts +2 -2
- package/dist/state-machines/data-layer/actions.d.ts +8 -8
- package/dist/state-machines/data-layer/index.d.ts +24 -24
- package/dist/state-machines/data-layer/services.d.ts +3 -3
- package/dist/state-machines/data-layer/types.d.ts +30 -30
- package/dist/state-machines/develop/actions.d.ts +37 -37
- package/dist/state-machines/index.d.ts +7 -7
- package/dist/state-machines/query-running/actions.d.ts +9 -9
- package/dist/state-machines/query-running/index.d.ts +7 -7
- package/dist/state-machines/query-running/services.d.ts +3 -3
- package/dist/state-machines/query-running/types.d.ts +23 -23
- package/dist/state-machines/waiting/actions.d.ts +11 -11
- package/dist/state-machines/waiting/index.d.ts +12 -12
- package/dist/state-machines/waiting/services.d.ts +3 -3
- package/dist/state-machines/waiting/types.d.ts +12 -12
- package/dist/types.d.ts +9 -9
- package/dist/utils/api-browser-docs.d.ts +252 -252
- package/dist/utils/api-node-docs.d.ts +443 -443
- package/dist/utils/assert-store.d.ts +2 -2
- package/dist/utils/babel-parse-to-ast.d.ts +4 -4
- package/dist/utils/browserslist.d.ts +1 -1
- package/dist/utils/call-deferred-api.d.ts +8 -8
- package/dist/utils/changed-pages.d.ts +6 -6
- package/dist/utils/create-node-id.d.ts +24 -24
- package/dist/utils/create-schema-customization.d.ts +6 -6
- package/dist/utils/develop-preload-headers.d.ts +7 -7
- package/dist/utils/did-you-mean.d.ts +3 -3
- package/dist/utils/find-page-by-path.d.ts +2 -2
- package/dist/utils/flags.d.ts +34 -34
- package/dist/utils/gatsby-dependents.d.ts +8 -8
- package/dist/utils/gatsby-webpack-virtual-modules.d.ts +6 -6
- package/dist/utils/get-latest-apis.d.ts +6 -6
- package/dist/utils/get-page-data.d.ts +3 -3
- package/dist/utils/get-react-hot-loader-strategy.d.ts +1 -1
- package/dist/utils/get-value-at.d.ts +1 -1
- package/dist/utils/handle-flags.d.ts +7 -7
- package/dist/utils/is-32-bit-integer.d.ts +1 -1
- package/dist/utils/jobs-manager.d.ts +61 -61
- package/dist/utils/loading-indicator.d.ts +3 -3
- package/dist/utils/map-templates-to-static-query-hashes.d.ts +16 -16
- package/dist/utils/mett.d.ts +10 -10
- package/dist/utils/page-data.d.ts +22 -22
- package/dist/utils/path.d.ts +5 -5
- package/dist/utils/prepare-urls.d.ts +7 -7
- package/dist/utils/print-deprecation-warnings.d.ts +1 -1
- package/dist/utils/print-instructions.d.ts +2 -2
- package/dist/utils/sample-site-for-experiment.d.ts +2 -2
- package/dist/utils/show-experiment-notice.d.ts +6 -6
- package/dist/utils/source-nodes.d.ts +8 -8
- package/dist/utils/stack-trace-utils.d.ts +22 -22
- package/dist/utils/start-server.d.ts +25 -25
- package/dist/utils/test-require-error.d.ts +1 -1
- package/dist/utils/wait-until-jobs-complete.d.ts +1 -1
- package/dist/utils/webpack-error-utils.d.ts +18 -18
- package/dist/utils/webpack-status.d.ts +3 -3
- package/dist/utils/websocket-manager.d.ts +39 -39
- package/dist/utils/worker/pool.d.ts +2 -2
- package/gatsby-admin-public/4c744e84-6c27fb4a13dc8c8c3e88.js.map +1 -1
- package/gatsby-admin-public/69bd6bf3-00a5b50945cce68e041c.js.map +1 -1
- package/gatsby-admin-public/784b2cee55c07b638f20445dec340adf9f1888a3-d690a55f56dedc0f95b3.js.map +1 -1
- package/gatsby-admin-public/854a7ef1f34af0aefbdfdd9304a0c00251662775-30cef3c004238987a416.js.map +1 -1
- package/gatsby-admin-public/{app-d9751648e893ba210043.js → app-74fe4789160202707c96.js} +2 -2
- package/gatsby-admin-public/{app-d9751648e893ba210043.js.LICENSE.txt → app-74fe4789160202707c96.js.LICENSE.txt} +0 -0
- package/gatsby-admin-public/app-74fe4789160202707c96.js.map +1 -0
- package/gatsby-admin-public/c432bec7e9afb3443fd639df9e5f119e13575cf7-976ea4aa8380d4a68cb1.js.map +1 -1
- package/gatsby-admin-public/chunk-map.json +1 -1
- package/gatsby-admin-public/component---src-pages-index-tsx-70aa31e4e1eca0a560a8.js.map +1 -1
- package/gatsby-admin-public/component---src-pages-plugins-tsx-c6700b48ed9ac88a9768.js.map +1 -1
- package/gatsby-admin-public/{component---src-pages-recipe-js-91150640d438410a1a0b.js → component---src-pages-recipe-js-4e8fdacf3e36393b3739.js} +1 -1
- package/gatsby-admin-public/component---src-pages-recipe-js-4e8fdacf3e36393b3739.js.map +1 -0
- package/gatsby-admin-public/e2852b4470dcb2615e49edcd9de2a3c8119d4bec-fbd253211b90ee4d944c.js.map +1 -1
- package/gatsby-admin-public/framework-b5530edc347e85dd3979.js.map +1 -1
- package/gatsby-admin-public/index.html +1 -1
- package/gatsby-admin-public/page-data/app-data.json +1 -1
- package/gatsby-admin-public/pages/index.html +1 -1
- package/gatsby-admin-public/plugins/index.html +1 -1
- package/gatsby-admin-public/polyfill-bb3950ad41cd96a6ba64.js.map +1 -1
- package/gatsby-admin-public/recipe/index.html +1 -1
- package/gatsby-admin-public/recipes/index.html +1 -1
- package/gatsby-admin-public/{webpack-runtime-0a97eab52901d3d030d8.js → webpack-runtime-ce59e1ba33a41c65ea97.js} +2 -2
- package/gatsby-admin-public/{webpack-runtime-0a97eab52901d3d030d8.js.map → webpack-runtime-ce59e1ba33a41c65ea97.js.map} +1 -1
- package/gatsby-admin-public/webpack.stats.json +1 -1
- package/package.json +3 -3
- package/gatsby-admin-public/app-d9751648e893ba210043.js.map +0 -1
- package/gatsby-admin-public/component---src-pages-recipe-js-91150640d438410a1a0b.js.map +0 -1
|
@@ -1,443 +1,443 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Lets plugins implementing support for other compile-to-js add to the list
|
|
3
|
-
* of "resolvable" file extensions. Gatsby supports `.js` and `.jsx` by default.
|
|
4
|
-
* @returns {Array<string>} array of extensions
|
|
5
|
-
*/
|
|
6
|
-
export declare const resolvableExtensions = true;
|
|
7
|
-
/**
|
|
8
|
-
* Tell plugins to add pages. This extension point is called only after the initial
|
|
9
|
-
* sourcing and transformation of nodes plus creation of the GraphQL schema are
|
|
10
|
-
* complete so you can query your data in order to create pages.
|
|
11
|
-
*
|
|
12
|
-
* See also [the documentation for the action `createPage`](/docs/actions/#createPage).
|
|
13
|
-
*
|
|
14
|
-
* @param {object} $0 See the [documentation for `Node API Helpers` for more details](/docs/node-api-helpers)
|
|
15
|
-
* @param {Actions} $0.actions See the [list of documented actions](/docs/actions)
|
|
16
|
-
* @param {function} $0.actions.createPages [Documentation for this action](/docs/actions/#createPage)
|
|
17
|
-
* @param {function} $0.graphql: Query GraphQL API. See [examples here](/docs/creating-and-modifying-pages/#creating-pages-in-gatsby-nodejs)
|
|
18
|
-
* @param {GatsbyReporter} $0.reporter Log issues. See [GatsbyReporter documentation](/docs/node-api-helpers/#GatsbyReporter) for more details
|
|
19
|
-
* @returns {Promise<void>} No return value required, but the caller will `await` any promise that's returned
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* const path = require(`path`)
|
|
23
|
-
*
|
|
24
|
-
* exports.createPages = ({ graphql, actions }) => {
|
|
25
|
-
* const { createPage } = actions
|
|
26
|
-
* const blogPostTemplate = path.resolve(`src/templates/blog-post.js`)
|
|
27
|
-
* // Query for markdown nodes to use in creating pages.
|
|
28
|
-
* // You can query for whatever data you want to create pages for e.g.
|
|
29
|
-
* // products, portfolio items, landing pages, etc.
|
|
30
|
-
* // Variables can be added as the second function parameter
|
|
31
|
-
* return graphql(`
|
|
32
|
-
* query loadPagesQuery ($limit: Int!) {
|
|
33
|
-
* allMarkdownRemark(limit: $limit) {
|
|
34
|
-
* edges {
|
|
35
|
-
* node {
|
|
36
|
-
* frontmatter {
|
|
37
|
-
* slug
|
|
38
|
-
* }
|
|
39
|
-
* }
|
|
40
|
-
* }
|
|
41
|
-
* }
|
|
42
|
-
* }
|
|
43
|
-
* `, { limit: 1000 }).then(result => {
|
|
44
|
-
* if (result.errors) {
|
|
45
|
-
* throw result.errors
|
|
46
|
-
* }
|
|
47
|
-
*
|
|
48
|
-
* // Create blog post pages.
|
|
49
|
-
* result.data.allMarkdownRemark.edges.forEach(edge => {
|
|
50
|
-
* createPage({
|
|
51
|
-
* // Path for this page — required
|
|
52
|
-
* path: `${edge.node.frontmatter.slug}`,
|
|
53
|
-
* component: blogPostTemplate,
|
|
54
|
-
* context: {
|
|
55
|
-
* // Add optional context data to be inserted
|
|
56
|
-
* // as props into the page component..
|
|
57
|
-
* //
|
|
58
|
-
* // The context data can also be used as
|
|
59
|
-
* // arguments to the page GraphQL query.
|
|
60
|
-
* //
|
|
61
|
-
* // The page "path" is always available as a GraphQL
|
|
62
|
-
* // argument.
|
|
63
|
-
* },
|
|
64
|
-
* })
|
|
65
|
-
* })
|
|
66
|
-
* })
|
|
67
|
-
* }
|
|
68
|
-
*/
|
|
69
|
-
export declare const createPages = true;
|
|
70
|
-
/**
|
|
71
|
-
* Like `createPages` but for plugins who want to manage creating and removing
|
|
72
|
-
* pages themselves in response to changes in data *not* managed by Gatsby.
|
|
73
|
-
* Plugins implementing `createPages` will get called regularly to recompute
|
|
74
|
-
* page information as Gatsby's data changes but those implementing
|
|
75
|
-
* `createPagesStatefully` will not.
|
|
76
|
-
*
|
|
77
|
-
* An example of a plugin that uses this extension point is the plugin
|
|
78
|
-
* [gatsby-plugin-page-creator](https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-plugin-page-creator)
|
|
79
|
-
* which monitors the `src/pages` directory for the adding and removal of JS
|
|
80
|
-
* pages. As its source of truth, files in the pages directory, is not known by
|
|
81
|
-
* Gatsby, it needs to keep its own state about its world to know when to
|
|
82
|
-
* add and remove pages.
|
|
83
|
-
*/
|
|
84
|
-
export declare const createPagesStatefully = true;
|
|
85
|
-
/**
|
|
86
|
-
* Extension point to tell plugins to source nodes. This API is called during
|
|
87
|
-
* the Gatsby bootstrap sequence. Source plugins use this hook to create nodes.
|
|
88
|
-
* This API is called exactly once per plugin (and once for your site's
|
|
89
|
-
* `gatsby-config.js` file). If you define this hook in `gatsby-node.js` it
|
|
90
|
-
* will be called exactly once after all of your source plugins have finished
|
|
91
|
-
* creating nodes.
|
|
92
|
-
*
|
|
93
|
-
* See also the documentation for [`createNode`](/docs/actions/#createNode).
|
|
94
|
-
* @example
|
|
95
|
-
* exports.sourceNodes = ({ actions, createNodeId, createContentDigest }) => {
|
|
96
|
-
* const { createNode } = actions
|
|
97
|
-
*
|
|
98
|
-
* // Data can come from anywhere, but for now create it manually
|
|
99
|
-
* const myData = {
|
|
100
|
-
* key: 123,
|
|
101
|
-
* foo: `The foo field of my node`,
|
|
102
|
-
* bar: `Baz`
|
|
103
|
-
* }
|
|
104
|
-
*
|
|
105
|
-
* const nodeContent = JSON.stringify(myData)
|
|
106
|
-
*
|
|
107
|
-
* const nodeMeta = {
|
|
108
|
-
* id: createNodeId(`my-data-${myData.key}`),
|
|
109
|
-
* parent: null,
|
|
110
|
-
* children: [],
|
|
111
|
-
* internal: {
|
|
112
|
-
* type: `MyNodeType`,
|
|
113
|
-
* mediaType: `text/html`,
|
|
114
|
-
* content: nodeContent,
|
|
115
|
-
* contentDigest: createContentDigest(myData)
|
|
116
|
-
* }
|
|
117
|
-
* }
|
|
118
|
-
*
|
|
119
|
-
* const node = Object.assign({}, myData, nodeMeta)
|
|
120
|
-
* createNode(node)
|
|
121
|
-
* }
|
|
122
|
-
*/
|
|
123
|
-
export declare const sourceNodes = true;
|
|
124
|
-
/**
|
|
125
|
-
* Called when a new node is created. Plugins wishing to extend or
|
|
126
|
-
* transform nodes created by other plugins should implement this API.
|
|
127
|
-
*
|
|
128
|
-
* See also the documentation for [`createNode`](/docs/actions/#createNode)
|
|
129
|
-
* and [`createNodeField`](/docs/actions/#createNodeField)
|
|
130
|
-
* @example
|
|
131
|
-
* exports.onCreateNode = ({ node, actions }) => {
|
|
132
|
-
* const { createNode, createNodeField } = actions
|
|
133
|
-
* // Transform the new node here and create a new node or
|
|
134
|
-
* // create a new node field.
|
|
135
|
-
* }
|
|
136
|
-
*/
|
|
137
|
-
export declare const onCreateNode = true;
|
|
138
|
-
/**
|
|
139
|
-
* Called before scheduling a `onCreateNode` callback for a plugin. If it returns falsy
|
|
140
|
-
* then Gatsby will not schedule the `onCreateNode` callback for this node for this plugin.
|
|
141
|
-
* Note: this API does not receive the regular `api` that other callbacks get as first arg.
|
|
142
|
-
*
|
|
143
|
-
* @gatsbyVersion 2.24.80
|
|
144
|
-
* @example
|
|
145
|
-
* exports.unstable_shouldOnCreateNode = ({node}, pluginOptions) => node.internal.type === 'Image'
|
|
146
|
-
*/
|
|
147
|
-
export declare const unstable_shouldOnCreateNode = true;
|
|
148
|
-
/**
|
|
149
|
-
* Called when a new page is created. This extension API is useful
|
|
150
|
-
* for programmatically manipulating pages created by other plugins e.g.
|
|
151
|
-
* if you want paths without trailing slashes.
|
|
152
|
-
*
|
|
153
|
-
* There is a mechanism in Gatsby to prevent calling onCreatePage for pages
|
|
154
|
-
* created by the same gatsby-node.js to avoid infinite loops/callback.
|
|
155
|
-
*
|
|
156
|
-
* See the guide [Creating and Modifying Pages](/docs/creating-and-modifying-pages/)
|
|
157
|
-
* for more on this API.
|
|
158
|
-
*/
|
|
159
|
-
export declare const onCreatePage = true;
|
|
160
|
-
/**
|
|
161
|
-
* Called during the creation of the GraphQL schema. Allows plugins
|
|
162
|
-
* to add new fields to the types created from data nodes. It will be called
|
|
163
|
-
* separately for each type.
|
|
164
|
-
*
|
|
165
|
-
* This function should return an object in the shape of
|
|
166
|
-
* [GraphQLFieldConfigMap](https://graphql.org/graphql-js/type/#graphqlobjecttype)
|
|
167
|
-
* which will be appended to fields inferred by Gatsby from data nodes.
|
|
168
|
-
*
|
|
169
|
-
* *Note:* Import GraphQL types from `gatsby/graphql` and don't add the `graphql`
|
|
170
|
-
* package to your project/plugin dependencies to avoid `Schema must
|
|
171
|
-
* contain unique named types but contains multiple types named` errors.
|
|
172
|
-
* `gatsby/graphql` exports all builtin GraphQL types as well as the `GraphQLJSON`
|
|
173
|
-
* type.
|
|
174
|
-
*
|
|
175
|
-
* Many transformer plugins use this to add fields that take arguments.
|
|
176
|
-
*
|
|
177
|
-
* * [`gatsby-transformer-remark`](/plugins/gatsby-transformer-remark/)
|
|
178
|
-
* adds an "excerpt" field where the user when writing their query can specify
|
|
179
|
-
* how many characters to prune the markdown source to.
|
|
180
|
-
* * [`gatsby-transformer-sharp`](/plugins/gatsby-transformer-sharp/) exposes
|
|
181
|
-
* many image transformation options as GraphQL fields.
|
|
182
|
-
*
|
|
183
|
-
* @param {object} $0
|
|
184
|
-
* @param {object} $0.type Object containing `name` and `nodes`
|
|
185
|
-
* @example
|
|
186
|
-
* import { GraphQLString } from "gatsby/graphql"
|
|
187
|
-
*
|
|
188
|
-
* exports.setFieldsOnGraphQLNodeType = ({ type }) => {
|
|
189
|
-
* if (type.name === `File`) {
|
|
190
|
-
* return {
|
|
191
|
-
* newField: {
|
|
192
|
-
* type: GraphQLString,
|
|
193
|
-
* args: {
|
|
194
|
-
* myArgument: {
|
|
195
|
-
* type: GraphQLString,
|
|
196
|
-
* }
|
|
197
|
-
* },
|
|
198
|
-
* resolve: (source, fieldArgs) => {
|
|
199
|
-
* return `Id of this node is ${source.id}.
|
|
200
|
-
* Field was called with argument: ${fieldArgs.myArgument}`
|
|
201
|
-
* }
|
|
202
|
-
* }
|
|
203
|
-
* }
|
|
204
|
-
* }
|
|
205
|
-
*
|
|
206
|
-
* // by default return empty object
|
|
207
|
-
* return {}
|
|
208
|
-
* }
|
|
209
|
-
*/
|
|
210
|
-
export declare const setFieldsOnGraphQLNodeType = true;
|
|
211
|
-
/**
|
|
212
|
-
* Customize Gatsby's GraphQL schema by creating type definitions, field
|
|
213
|
-
* extensions or adding third-party schemas.
|
|
214
|
-
*
|
|
215
|
-
* The [`createTypes`](/docs/actions/#createTypes),
|
|
216
|
-
* [`createFieldExtension`](/docs/actions/#createFieldExtension) and
|
|
217
|
-
* [`addThirdPartySchema`](/docs/actions/#addThirdPartySchema) actions
|
|
218
|
-
* are only available in this API. For details on their usage please refer to
|
|
219
|
-
* the actions documentation.
|
|
220
|
-
*
|
|
221
|
-
* This API runs immediately before schema generation. For modifications of the
|
|
222
|
-
* generated schema, e.g. to customize added third-party types, use the
|
|
223
|
-
* [`createResolvers`](/docs/node-apis/#createResolvers) API.
|
|
224
|
-
*
|
|
225
|
-
* @gatsbyVersion 2.12.0
|
|
226
|
-
* @param {object} $0
|
|
227
|
-
* @param {object} $0.actions
|
|
228
|
-
* @param {object} $0.actions.createTypes
|
|
229
|
-
* @param {object} $0.actions.createFieldExtension
|
|
230
|
-
* @param {object} $0.actions.addThirdPartySchema
|
|
231
|
-
* @example
|
|
232
|
-
* exports.createSchemaCustomization = ({ actions }) => {
|
|
233
|
-
* const { createTypes, createFieldExtension } = actions
|
|
234
|
-
*
|
|
235
|
-
* createFieldExtension({
|
|
236
|
-
* name: 'shout',
|
|
237
|
-
* extend: () => ({
|
|
238
|
-
* resolve(source, args, context, info) {
|
|
239
|
-
* return String(source[info.fieldName]).toUpperCase()
|
|
240
|
-
* }
|
|
241
|
-
* })
|
|
242
|
-
* })
|
|
243
|
-
*
|
|
244
|
-
* const typeDefs = `
|
|
245
|
-
* type MarkdownRemark implements Node @dontInfer {
|
|
246
|
-
* frontmatter: Frontmatter
|
|
247
|
-
* }
|
|
248
|
-
* type Frontmatter {
|
|
249
|
-
* title: String!
|
|
250
|
-
* tagline: String @shout
|
|
251
|
-
* date: Date @dateformat
|
|
252
|
-
* image: File @fileByRelativePath
|
|
253
|
-
* }
|
|
254
|
-
* `
|
|
255
|
-
* createTypes(typeDefs)
|
|
256
|
-
* }
|
|
257
|
-
*/
|
|
258
|
-
export declare const createSchemaCustomization = true;
|
|
259
|
-
/**
|
|
260
|
-
* Add custom field resolvers to the GraphQL schema.
|
|
261
|
-
*
|
|
262
|
-
* Allows adding new fields to types by providing field configs, or adding resolver
|
|
263
|
-
* functions to existing fields.
|
|
264
|
-
*
|
|
265
|
-
* Things to note:
|
|
266
|
-
* * Overriding field types is disallowed, instead use the `createTypes`
|
|
267
|
-
* action. In case of types added from third-party schemas, where this is not
|
|
268
|
-
* possible, overriding field types is allowed.
|
|
269
|
-
* * New fields will not be available on `filter` and `sort` input types. Extend
|
|
270
|
-
* types defined with `createTypes` if you need this.
|
|
271
|
-
* * In field configs, types can be referenced as strings.
|
|
272
|
-
* * When extending a field with an existing field resolver, the original
|
|
273
|
-
* resolver function is available from `info.originalResolver`.
|
|
274
|
-
* * The `createResolvers` API is called as the last step in schema generation.
|
|
275
|
-
* Thus, an intermediate schema is made available on the `intermediateSchema` property.
|
|
276
|
-
* In resolver functions themselves, it is recommended to access the final
|
|
277
|
-
* built schema from `info.schema`.
|
|
278
|
-
* * Gatsby's data layer, including all internal query capabilities, is
|
|
279
|
-
* exposed on [`context.nodeModel`](/docs/node-model/). The node store can be
|
|
280
|
-
* queried directly with `getAllNodes`, `getNodeById` and `getNodesByIds`,
|
|
281
|
-
* while more advanced queries can be composed with `runQuery`. Note that
|
|
282
|
-
* `runQuery` will call field resolvers before querying, so e.g. foreign-key
|
|
283
|
-
* fields will be expanded to full nodes. The other methods on `nodeModel`
|
|
284
|
-
* don't do this.
|
|
285
|
-
* * It is possible to add fields to the root `Query` type.
|
|
286
|
-
* * When using the first resolver argument (`source` in the example below,
|
|
287
|
-
* often also called `parent` or `root`), take care of the fact that field
|
|
288
|
-
* resolvers can be called more than once in a query, e.g. when the field is
|
|
289
|
-
* present both in the input filter and in the selection set. This means that
|
|
290
|
-
* foreign-key fields on `source` can be either resolved or not-resolved.
|
|
291
|
-
*
|
|
292
|
-
* For fuller examples, see [`using-type-definitions`](https://github.com/gatsbyjs/gatsby/tree/master/examples/using-type-definitions).
|
|
293
|
-
*
|
|
294
|
-
* @gatsbyVersion 2.2.0
|
|
295
|
-
* @param {object} $0
|
|
296
|
-
* @param {GraphQLSchema} $0.intermediateSchema Current GraphQL schema
|
|
297
|
-
* @param {function} $0.createResolvers Add custom resolvers to GraphQL field configs
|
|
298
|
-
* @param {object} $1
|
|
299
|
-
* @param {object} $1.resolvers An object map of GraphQL type names to custom resolver functions
|
|
300
|
-
* @param {object} $1.options Optional createResolvers options
|
|
301
|
-
* @param {object} $1.options.ignoreNonexistentTypes Silences the warning when trying to add resolvers for types that don't exist. Useful for optional extensions.
|
|
302
|
-
* @example
|
|
303
|
-
* exports.createResolvers = ({ createResolvers }) => {
|
|
304
|
-
* const resolvers = {
|
|
305
|
-
* Author: {
|
|
306
|
-
* fullName: {
|
|
307
|
-
* resolve: (source, args, context, info) => {
|
|
308
|
-
* return source.firstName + source.lastName
|
|
309
|
-
* }
|
|
310
|
-
* },
|
|
311
|
-
* },
|
|
312
|
-
* Query: {
|
|
313
|
-
* allRecentPosts: {
|
|
314
|
-
* type: [`BlogPost`],
|
|
315
|
-
* resolve: (source, args, context, info) => {
|
|
316
|
-
* const posts = context.nodeModel.getAllNodes({ type: `BlogPost` })
|
|
317
|
-
* const recentPosts = posts.filter(
|
|
318
|
-
* post => post.publishedAt > Date.UTC(2018, 0, 1)
|
|
319
|
-
* )
|
|
320
|
-
* return recentPosts
|
|
321
|
-
* }
|
|
322
|
-
* }
|
|
323
|
-
* }
|
|
324
|
-
* }
|
|
325
|
-
* createResolvers(resolvers)
|
|
326
|
-
* }
|
|
327
|
-
*/
|
|
328
|
-
export declare const createResolvers = true;
|
|
329
|
-
/**
|
|
330
|
-
* Ask compile-to-js plugins to process source to JavaScript so the query
|
|
331
|
-
* runner can extract out GraphQL queries for running.
|
|
332
|
-
*/
|
|
333
|
-
export declare const preprocessSource = true;
|
|
334
|
-
/**
|
|
335
|
-
* Tell plugins with expensive "side effects" from queries to start running
|
|
336
|
-
* those now. This is a soon-to-be-replaced API only currently in use by
|
|
337
|
-
* `gatsby-plugin-sharp`.
|
|
338
|
-
*/
|
|
339
|
-
export declare const generateSideEffects = true;
|
|
340
|
-
/**
|
|
341
|
-
* Let plugins extend/mutate the site's Babel configuration by calling
|
|
342
|
-
* [`setBabelPlugin`](/docs/actions/#setBabelPlugin) or
|
|
343
|
-
* [`setBabelPreset`](/docs/actions/#setBabelPreset).
|
|
344
|
-
* @param {object} $0
|
|
345
|
-
* @param {string} $0.stage The current build stage. One of 'develop', 'develop-html',
|
|
346
|
-
* 'build-javascript', or 'build-html'
|
|
347
|
-
* @param {object} $0.actions
|
|
348
|
-
* @param {object} options The Babel configuration
|
|
349
|
-
* @example
|
|
350
|
-
* exports.onCreateBabelConfig = ({ actions }) => {
|
|
351
|
-
* actions.setBabelPlugin({
|
|
352
|
-
* name: `babel-plugin-that-i-like`,
|
|
353
|
-
* options: {}
|
|
354
|
-
* })
|
|
355
|
-
* }
|
|
356
|
-
*/
|
|
357
|
-
export declare const onCreateBabelConfig = true;
|
|
358
|
-
/**
|
|
359
|
-
* Let plugins extend/mutate the site's webpack configuration.
|
|
360
|
-
*
|
|
361
|
-
* See also the documentation for [`setWebpackConfig`](/docs/actions/#setWebpackConfig).
|
|
362
|
-
*
|
|
363
|
-
* @param {object} $0
|
|
364
|
-
* @param {string} $0.stage The current build stage. One of 'develop', 'develop-html',
|
|
365
|
-
* 'build-javascript', or 'build-html'
|
|
366
|
-
* @param {function} $0.getConfig Returns the current webpack config
|
|
367
|
-
* @param {object} $0.rules A set of preconfigured webpack config rules
|
|
368
|
-
* @param {object} $0.loaders A set of preconfigured webpack config loaders
|
|
369
|
-
* @param {object} $0.plugins A set of preconfigured webpack config plugins
|
|
370
|
-
* @param {object} $0.actions
|
|
371
|
-
* @example
|
|
372
|
-
* exports.onCreateWebpackConfig = ({
|
|
373
|
-
* stage, getConfig, rules, loaders, actions
|
|
374
|
-
* }) => {
|
|
375
|
-
* actions.setWebpackConfig({
|
|
376
|
-
* module: {
|
|
377
|
-
* rules: [
|
|
378
|
-
* {
|
|
379
|
-
* test: 'my-css',
|
|
380
|
-
* use: [loaders.style(), loaders.css()]
|
|
381
|
-
* },
|
|
382
|
-
* ],
|
|
383
|
-
* },
|
|
384
|
-
* });
|
|
385
|
-
* }
|
|
386
|
-
*/
|
|
387
|
-
export declare const onCreateWebpackConfig = true;
|
|
388
|
-
/**
|
|
389
|
-
* The first API called during Gatsby execution, runs as soon as plugins are loaded, before cache initialization and bootstrap preparation.
|
|
390
|
-
*/
|
|
391
|
-
export declare const onPreInit = true;
|
|
392
|
-
/**
|
|
393
|
-
* Called once Gatsby has initialized itself and is ready to bootstrap your site.
|
|
394
|
-
*/
|
|
395
|
-
export declare const onPreBootstrap = true;
|
|
396
|
-
/**
|
|
397
|
-
* Called at the end of the bootstrap process after all other extension APIs have been called.
|
|
398
|
-
*/
|
|
399
|
-
export declare const onPostBootstrap = true;
|
|
400
|
-
/**
|
|
401
|
-
* The first extension point called during the build process. Called after the bootstrap has completed but before the build steps start.
|
|
402
|
-
*/
|
|
403
|
-
export declare const onPreBuild = true;
|
|
404
|
-
/**
|
|
405
|
-
* The last extension point called after all other parts of the build process
|
|
406
|
-
* are complete.
|
|
407
|
-
*/
|
|
408
|
-
export declare const onPostBuild = true;
|
|
409
|
-
/**
|
|
410
|
-
* Run before GraphQL queries/fragments are extracted from JavaScript files. Useful for plugins
|
|
411
|
-
* to add more JavaScript files with queries/fragments e.g. from node_modules.
|
|
412
|
-
*
|
|
413
|
-
* See gatsby-transformer-sharp and gatsby-source-contentful for examples.
|
|
414
|
-
*/
|
|
415
|
-
export declare const onPreExtractQueries = true;
|
|
416
|
-
/**
|
|
417
|
-
* Run when the `gatsby develop` server is started. It can be used for adding proxies and Express middleware
|
|
418
|
-
* to the server.
|
|
419
|
-
* @param {object} $0
|
|
420
|
-
* @param {Express} $0.app The [Express app](https://expressjs.com/en/4x/api.html#app) used to run the dev server
|
|
421
|
-
* @example
|
|
422
|
-
* exports.onCreateDevServer = ({ app }) => {
|
|
423
|
-
* app.get('/hello', function (req, res) {
|
|
424
|
-
* res.send('hello world')
|
|
425
|
-
* })
|
|
426
|
-
* }
|
|
427
|
-
*/
|
|
428
|
-
export declare const onCreateDevServer = true;
|
|
429
|
-
/**
|
|
430
|
-
* Run during the bootstrap phase. Plugins can use this to define a schema for their options using
|
|
431
|
-
* [Joi](https://joi.dev) to validate the options users pass to the plugin.
|
|
432
|
-
* @gatsbyVersion 2.25.0
|
|
433
|
-
* @param {object} $0
|
|
434
|
-
* @param {Joi} $0.Joi The instance of [Joi](https://joi.dev) to define the schema
|
|
435
|
-
* @example
|
|
436
|
-
* exports.pluginOptionsSchema = ({ Joi }) => {
|
|
437
|
-
* return Joi.object({
|
|
438
|
-
* // Validate that the anonymize option is defined by the user and is a boolean
|
|
439
|
-
* anonymize: Joi.boolean().required(),
|
|
440
|
-
* })
|
|
441
|
-
* }
|
|
442
|
-
*/
|
|
443
|
-
export declare const pluginOptionsSchema = true;
|
|
1
|
+
/**
|
|
2
|
+
* Lets plugins implementing support for other compile-to-js add to the list
|
|
3
|
+
* of "resolvable" file extensions. Gatsby supports `.js` and `.jsx` by default.
|
|
4
|
+
* @returns {Array<string>} array of extensions
|
|
5
|
+
*/
|
|
6
|
+
export declare const resolvableExtensions = true;
|
|
7
|
+
/**
|
|
8
|
+
* Tell plugins to add pages. This extension point is called only after the initial
|
|
9
|
+
* sourcing and transformation of nodes plus creation of the GraphQL schema are
|
|
10
|
+
* complete so you can query your data in order to create pages.
|
|
11
|
+
*
|
|
12
|
+
* See also [the documentation for the action `createPage`](/docs/actions/#createPage).
|
|
13
|
+
*
|
|
14
|
+
* @param {object} $0 See the [documentation for `Node API Helpers` for more details](/docs/node-api-helpers)
|
|
15
|
+
* @param {Actions} $0.actions See the [list of documented actions](/docs/actions)
|
|
16
|
+
* @param {function} $0.actions.createPages [Documentation for this action](/docs/actions/#createPage)
|
|
17
|
+
* @param {function} $0.graphql: Query GraphQL API. See [examples here](/docs/creating-and-modifying-pages/#creating-pages-in-gatsby-nodejs)
|
|
18
|
+
* @param {GatsbyReporter} $0.reporter Log issues. See [GatsbyReporter documentation](/docs/node-api-helpers/#GatsbyReporter) for more details
|
|
19
|
+
* @returns {Promise<void>} No return value required, but the caller will `await` any promise that's returned
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* const path = require(`path`)
|
|
23
|
+
*
|
|
24
|
+
* exports.createPages = ({ graphql, actions }) => {
|
|
25
|
+
* const { createPage } = actions
|
|
26
|
+
* const blogPostTemplate = path.resolve(`src/templates/blog-post.js`)
|
|
27
|
+
* // Query for markdown nodes to use in creating pages.
|
|
28
|
+
* // You can query for whatever data you want to create pages for e.g.
|
|
29
|
+
* // products, portfolio items, landing pages, etc.
|
|
30
|
+
* // Variables can be added as the second function parameter
|
|
31
|
+
* return graphql(`
|
|
32
|
+
* query loadPagesQuery ($limit: Int!) {
|
|
33
|
+
* allMarkdownRemark(limit: $limit) {
|
|
34
|
+
* edges {
|
|
35
|
+
* node {
|
|
36
|
+
* frontmatter {
|
|
37
|
+
* slug
|
|
38
|
+
* }
|
|
39
|
+
* }
|
|
40
|
+
* }
|
|
41
|
+
* }
|
|
42
|
+
* }
|
|
43
|
+
* `, { limit: 1000 }).then(result => {
|
|
44
|
+
* if (result.errors) {
|
|
45
|
+
* throw result.errors
|
|
46
|
+
* }
|
|
47
|
+
*
|
|
48
|
+
* // Create blog post pages.
|
|
49
|
+
* result.data.allMarkdownRemark.edges.forEach(edge => {
|
|
50
|
+
* createPage({
|
|
51
|
+
* // Path for this page — required
|
|
52
|
+
* path: `${edge.node.frontmatter.slug}`,
|
|
53
|
+
* component: blogPostTemplate,
|
|
54
|
+
* context: {
|
|
55
|
+
* // Add optional context data to be inserted
|
|
56
|
+
* // as props into the page component..
|
|
57
|
+
* //
|
|
58
|
+
* // The context data can also be used as
|
|
59
|
+
* // arguments to the page GraphQL query.
|
|
60
|
+
* //
|
|
61
|
+
* // The page "path" is always available as a GraphQL
|
|
62
|
+
* // argument.
|
|
63
|
+
* },
|
|
64
|
+
* })
|
|
65
|
+
* })
|
|
66
|
+
* })
|
|
67
|
+
* }
|
|
68
|
+
*/
|
|
69
|
+
export declare const createPages = true;
|
|
70
|
+
/**
|
|
71
|
+
* Like `createPages` but for plugins who want to manage creating and removing
|
|
72
|
+
* pages themselves in response to changes in data *not* managed by Gatsby.
|
|
73
|
+
* Plugins implementing `createPages` will get called regularly to recompute
|
|
74
|
+
* page information as Gatsby's data changes but those implementing
|
|
75
|
+
* `createPagesStatefully` will not.
|
|
76
|
+
*
|
|
77
|
+
* An example of a plugin that uses this extension point is the plugin
|
|
78
|
+
* [gatsby-plugin-page-creator](https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-plugin-page-creator)
|
|
79
|
+
* which monitors the `src/pages` directory for the adding and removal of JS
|
|
80
|
+
* pages. As its source of truth, files in the pages directory, is not known by
|
|
81
|
+
* Gatsby, it needs to keep its own state about its world to know when to
|
|
82
|
+
* add and remove pages.
|
|
83
|
+
*/
|
|
84
|
+
export declare const createPagesStatefully = true;
|
|
85
|
+
/**
|
|
86
|
+
* Extension point to tell plugins to source nodes. This API is called during
|
|
87
|
+
* the Gatsby bootstrap sequence. Source plugins use this hook to create nodes.
|
|
88
|
+
* This API is called exactly once per plugin (and once for your site's
|
|
89
|
+
* `gatsby-config.js` file). If you define this hook in `gatsby-node.js` it
|
|
90
|
+
* will be called exactly once after all of your source plugins have finished
|
|
91
|
+
* creating nodes.
|
|
92
|
+
*
|
|
93
|
+
* See also the documentation for [`createNode`](/docs/actions/#createNode).
|
|
94
|
+
* @example
|
|
95
|
+
* exports.sourceNodes = ({ actions, createNodeId, createContentDigest }) => {
|
|
96
|
+
* const { createNode } = actions
|
|
97
|
+
*
|
|
98
|
+
* // Data can come from anywhere, but for now create it manually
|
|
99
|
+
* const myData = {
|
|
100
|
+
* key: 123,
|
|
101
|
+
* foo: `The foo field of my node`,
|
|
102
|
+
* bar: `Baz`
|
|
103
|
+
* }
|
|
104
|
+
*
|
|
105
|
+
* const nodeContent = JSON.stringify(myData)
|
|
106
|
+
*
|
|
107
|
+
* const nodeMeta = {
|
|
108
|
+
* id: createNodeId(`my-data-${myData.key}`),
|
|
109
|
+
* parent: null,
|
|
110
|
+
* children: [],
|
|
111
|
+
* internal: {
|
|
112
|
+
* type: `MyNodeType`,
|
|
113
|
+
* mediaType: `text/html`,
|
|
114
|
+
* content: nodeContent,
|
|
115
|
+
* contentDigest: createContentDigest(myData)
|
|
116
|
+
* }
|
|
117
|
+
* }
|
|
118
|
+
*
|
|
119
|
+
* const node = Object.assign({}, myData, nodeMeta)
|
|
120
|
+
* createNode(node)
|
|
121
|
+
* }
|
|
122
|
+
*/
|
|
123
|
+
export declare const sourceNodes = true;
|
|
124
|
+
/**
|
|
125
|
+
* Called when a new node is created. Plugins wishing to extend or
|
|
126
|
+
* transform nodes created by other plugins should implement this API.
|
|
127
|
+
*
|
|
128
|
+
* See also the documentation for [`createNode`](/docs/actions/#createNode)
|
|
129
|
+
* and [`createNodeField`](/docs/actions/#createNodeField)
|
|
130
|
+
* @example
|
|
131
|
+
* exports.onCreateNode = ({ node, actions }) => {
|
|
132
|
+
* const { createNode, createNodeField } = actions
|
|
133
|
+
* // Transform the new node here and create a new node or
|
|
134
|
+
* // create a new node field.
|
|
135
|
+
* }
|
|
136
|
+
*/
|
|
137
|
+
export declare const onCreateNode = true;
|
|
138
|
+
/**
|
|
139
|
+
* Called before scheduling a `onCreateNode` callback for a plugin. If it returns falsy
|
|
140
|
+
* then Gatsby will not schedule the `onCreateNode` callback for this node for this plugin.
|
|
141
|
+
* Note: this API does not receive the regular `api` that other callbacks get as first arg.
|
|
142
|
+
*
|
|
143
|
+
* @gatsbyVersion 2.24.80
|
|
144
|
+
* @example
|
|
145
|
+
* exports.unstable_shouldOnCreateNode = ({node}, pluginOptions) => node.internal.type === 'Image'
|
|
146
|
+
*/
|
|
147
|
+
export declare const unstable_shouldOnCreateNode = true;
|
|
148
|
+
/**
|
|
149
|
+
* Called when a new page is created. This extension API is useful
|
|
150
|
+
* for programmatically manipulating pages created by other plugins e.g.
|
|
151
|
+
* if you want paths without trailing slashes.
|
|
152
|
+
*
|
|
153
|
+
* There is a mechanism in Gatsby to prevent calling onCreatePage for pages
|
|
154
|
+
* created by the same gatsby-node.js to avoid infinite loops/callback.
|
|
155
|
+
*
|
|
156
|
+
* See the guide [Creating and Modifying Pages](/docs/creating-and-modifying-pages/)
|
|
157
|
+
* for more on this API.
|
|
158
|
+
*/
|
|
159
|
+
export declare const onCreatePage = true;
|
|
160
|
+
/**
|
|
161
|
+
* Called during the creation of the GraphQL schema. Allows plugins
|
|
162
|
+
* to add new fields to the types created from data nodes. It will be called
|
|
163
|
+
* separately for each type.
|
|
164
|
+
*
|
|
165
|
+
* This function should return an object in the shape of
|
|
166
|
+
* [GraphQLFieldConfigMap](https://graphql.org/graphql-js/type/#graphqlobjecttype)
|
|
167
|
+
* which will be appended to fields inferred by Gatsby from data nodes.
|
|
168
|
+
*
|
|
169
|
+
* *Note:* Import GraphQL types from `gatsby/graphql` and don't add the `graphql`
|
|
170
|
+
* package to your project/plugin dependencies to avoid `Schema must
|
|
171
|
+
* contain unique named types but contains multiple types named` errors.
|
|
172
|
+
* `gatsby/graphql` exports all builtin GraphQL types as well as the `GraphQLJSON`
|
|
173
|
+
* type.
|
|
174
|
+
*
|
|
175
|
+
* Many transformer plugins use this to add fields that take arguments.
|
|
176
|
+
*
|
|
177
|
+
* * [`gatsby-transformer-remark`](/plugins/gatsby-transformer-remark/)
|
|
178
|
+
* adds an "excerpt" field where the user when writing their query can specify
|
|
179
|
+
* how many characters to prune the markdown source to.
|
|
180
|
+
* * [`gatsby-transformer-sharp`](/plugins/gatsby-transformer-sharp/) exposes
|
|
181
|
+
* many image transformation options as GraphQL fields.
|
|
182
|
+
*
|
|
183
|
+
* @param {object} $0
|
|
184
|
+
* @param {object} $0.type Object containing `name` and `nodes`
|
|
185
|
+
* @example
|
|
186
|
+
* import { GraphQLString } from "gatsby/graphql"
|
|
187
|
+
*
|
|
188
|
+
* exports.setFieldsOnGraphQLNodeType = ({ type }) => {
|
|
189
|
+
* if (type.name === `File`) {
|
|
190
|
+
* return {
|
|
191
|
+
* newField: {
|
|
192
|
+
* type: GraphQLString,
|
|
193
|
+
* args: {
|
|
194
|
+
* myArgument: {
|
|
195
|
+
* type: GraphQLString,
|
|
196
|
+
* }
|
|
197
|
+
* },
|
|
198
|
+
* resolve: (source, fieldArgs) => {
|
|
199
|
+
* return `Id of this node is ${source.id}.
|
|
200
|
+
* Field was called with argument: ${fieldArgs.myArgument}`
|
|
201
|
+
* }
|
|
202
|
+
* }
|
|
203
|
+
* }
|
|
204
|
+
* }
|
|
205
|
+
*
|
|
206
|
+
* // by default return empty object
|
|
207
|
+
* return {}
|
|
208
|
+
* }
|
|
209
|
+
*/
|
|
210
|
+
export declare const setFieldsOnGraphQLNodeType = true;
|
|
211
|
+
/**
|
|
212
|
+
* Customize Gatsby's GraphQL schema by creating type definitions, field
|
|
213
|
+
* extensions or adding third-party schemas.
|
|
214
|
+
*
|
|
215
|
+
* The [`createTypes`](/docs/actions/#createTypes),
|
|
216
|
+
* [`createFieldExtension`](/docs/actions/#createFieldExtension) and
|
|
217
|
+
* [`addThirdPartySchema`](/docs/actions/#addThirdPartySchema) actions
|
|
218
|
+
* are only available in this API. For details on their usage please refer to
|
|
219
|
+
* the actions documentation.
|
|
220
|
+
*
|
|
221
|
+
* This API runs immediately before schema generation. For modifications of the
|
|
222
|
+
* generated schema, e.g. to customize added third-party types, use the
|
|
223
|
+
* [`createResolvers`](/docs/node-apis/#createResolvers) API.
|
|
224
|
+
*
|
|
225
|
+
* @gatsbyVersion 2.12.0
|
|
226
|
+
* @param {object} $0
|
|
227
|
+
* @param {object} $0.actions
|
|
228
|
+
* @param {object} $0.actions.createTypes
|
|
229
|
+
* @param {object} $0.actions.createFieldExtension
|
|
230
|
+
* @param {object} $0.actions.addThirdPartySchema
|
|
231
|
+
* @example
|
|
232
|
+
* exports.createSchemaCustomization = ({ actions }) => {
|
|
233
|
+
* const { createTypes, createFieldExtension } = actions
|
|
234
|
+
*
|
|
235
|
+
* createFieldExtension({
|
|
236
|
+
* name: 'shout',
|
|
237
|
+
* extend: () => ({
|
|
238
|
+
* resolve(source, args, context, info) {
|
|
239
|
+
* return String(source[info.fieldName]).toUpperCase()
|
|
240
|
+
* }
|
|
241
|
+
* })
|
|
242
|
+
* })
|
|
243
|
+
*
|
|
244
|
+
* const typeDefs = `
|
|
245
|
+
* type MarkdownRemark implements Node @dontInfer {
|
|
246
|
+
* frontmatter: Frontmatter
|
|
247
|
+
* }
|
|
248
|
+
* type Frontmatter {
|
|
249
|
+
* title: String!
|
|
250
|
+
* tagline: String @shout
|
|
251
|
+
* date: Date @dateformat
|
|
252
|
+
* image: File @fileByRelativePath
|
|
253
|
+
* }
|
|
254
|
+
* `
|
|
255
|
+
* createTypes(typeDefs)
|
|
256
|
+
* }
|
|
257
|
+
*/
|
|
258
|
+
export declare const createSchemaCustomization = true;
|
|
259
|
+
/**
|
|
260
|
+
* Add custom field resolvers to the GraphQL schema.
|
|
261
|
+
*
|
|
262
|
+
* Allows adding new fields to types by providing field configs, or adding resolver
|
|
263
|
+
* functions to existing fields.
|
|
264
|
+
*
|
|
265
|
+
* Things to note:
|
|
266
|
+
* * Overriding field types is disallowed, instead use the `createTypes`
|
|
267
|
+
* action. In case of types added from third-party schemas, where this is not
|
|
268
|
+
* possible, overriding field types is allowed.
|
|
269
|
+
* * New fields will not be available on `filter` and `sort` input types. Extend
|
|
270
|
+
* types defined with `createTypes` if you need this.
|
|
271
|
+
* * In field configs, types can be referenced as strings.
|
|
272
|
+
* * When extending a field with an existing field resolver, the original
|
|
273
|
+
* resolver function is available from `info.originalResolver`.
|
|
274
|
+
* * The `createResolvers` API is called as the last step in schema generation.
|
|
275
|
+
* Thus, an intermediate schema is made available on the `intermediateSchema` property.
|
|
276
|
+
* In resolver functions themselves, it is recommended to access the final
|
|
277
|
+
* built schema from `info.schema`.
|
|
278
|
+
* * Gatsby's data layer, including all internal query capabilities, is
|
|
279
|
+
* exposed on [`context.nodeModel`](/docs/node-model/). The node store can be
|
|
280
|
+
* queried directly with `getAllNodes`, `getNodeById` and `getNodesByIds`,
|
|
281
|
+
* while more advanced queries can be composed with `runQuery`. Note that
|
|
282
|
+
* `runQuery` will call field resolvers before querying, so e.g. foreign-key
|
|
283
|
+
* fields will be expanded to full nodes. The other methods on `nodeModel`
|
|
284
|
+
* don't do this.
|
|
285
|
+
* * It is possible to add fields to the root `Query` type.
|
|
286
|
+
* * When using the first resolver argument (`source` in the example below,
|
|
287
|
+
* often also called `parent` or `root`), take care of the fact that field
|
|
288
|
+
* resolvers can be called more than once in a query, e.g. when the field is
|
|
289
|
+
* present both in the input filter and in the selection set. This means that
|
|
290
|
+
* foreign-key fields on `source` can be either resolved or not-resolved.
|
|
291
|
+
*
|
|
292
|
+
* For fuller examples, see [`using-type-definitions`](https://github.com/gatsbyjs/gatsby/tree/master/examples/using-type-definitions).
|
|
293
|
+
*
|
|
294
|
+
* @gatsbyVersion 2.2.0
|
|
295
|
+
* @param {object} $0
|
|
296
|
+
* @param {GraphQLSchema} $0.intermediateSchema Current GraphQL schema
|
|
297
|
+
* @param {function} $0.createResolvers Add custom resolvers to GraphQL field configs
|
|
298
|
+
* @param {object} $1
|
|
299
|
+
* @param {object} $1.resolvers An object map of GraphQL type names to custom resolver functions
|
|
300
|
+
* @param {object} $1.options Optional createResolvers options
|
|
301
|
+
* @param {object} $1.options.ignoreNonexistentTypes Silences the warning when trying to add resolvers for types that don't exist. Useful for optional extensions.
|
|
302
|
+
* @example
|
|
303
|
+
* exports.createResolvers = ({ createResolvers }) => {
|
|
304
|
+
* const resolvers = {
|
|
305
|
+
* Author: {
|
|
306
|
+
* fullName: {
|
|
307
|
+
* resolve: (source, args, context, info) => {
|
|
308
|
+
* return source.firstName + source.lastName
|
|
309
|
+
* }
|
|
310
|
+
* },
|
|
311
|
+
* },
|
|
312
|
+
* Query: {
|
|
313
|
+
* allRecentPosts: {
|
|
314
|
+
* type: [`BlogPost`],
|
|
315
|
+
* resolve: (source, args, context, info) => {
|
|
316
|
+
* const posts = context.nodeModel.getAllNodes({ type: `BlogPost` })
|
|
317
|
+
* const recentPosts = posts.filter(
|
|
318
|
+
* post => post.publishedAt > Date.UTC(2018, 0, 1)
|
|
319
|
+
* )
|
|
320
|
+
* return recentPosts
|
|
321
|
+
* }
|
|
322
|
+
* }
|
|
323
|
+
* }
|
|
324
|
+
* }
|
|
325
|
+
* createResolvers(resolvers)
|
|
326
|
+
* }
|
|
327
|
+
*/
|
|
328
|
+
export declare const createResolvers = true;
|
|
329
|
+
/**
|
|
330
|
+
* Ask compile-to-js plugins to process source to JavaScript so the query
|
|
331
|
+
* runner can extract out GraphQL queries for running.
|
|
332
|
+
*/
|
|
333
|
+
export declare const preprocessSource = true;
|
|
334
|
+
/**
|
|
335
|
+
* Tell plugins with expensive "side effects" from queries to start running
|
|
336
|
+
* those now. This is a soon-to-be-replaced API only currently in use by
|
|
337
|
+
* `gatsby-plugin-sharp`.
|
|
338
|
+
*/
|
|
339
|
+
export declare const generateSideEffects = true;
|
|
340
|
+
/**
|
|
341
|
+
* Let plugins extend/mutate the site's Babel configuration by calling
|
|
342
|
+
* [`setBabelPlugin`](/docs/actions/#setBabelPlugin) or
|
|
343
|
+
* [`setBabelPreset`](/docs/actions/#setBabelPreset).
|
|
344
|
+
* @param {object} $0
|
|
345
|
+
* @param {string} $0.stage The current build stage. One of 'develop', 'develop-html',
|
|
346
|
+
* 'build-javascript', or 'build-html'
|
|
347
|
+
* @param {object} $0.actions
|
|
348
|
+
* @param {object} options The Babel configuration
|
|
349
|
+
* @example
|
|
350
|
+
* exports.onCreateBabelConfig = ({ actions }) => {
|
|
351
|
+
* actions.setBabelPlugin({
|
|
352
|
+
* name: `babel-plugin-that-i-like`,
|
|
353
|
+
* options: {}
|
|
354
|
+
* })
|
|
355
|
+
* }
|
|
356
|
+
*/
|
|
357
|
+
export declare const onCreateBabelConfig = true;
|
|
358
|
+
/**
|
|
359
|
+
* Let plugins extend/mutate the site's webpack configuration.
|
|
360
|
+
*
|
|
361
|
+
* See also the documentation for [`setWebpackConfig`](/docs/actions/#setWebpackConfig).
|
|
362
|
+
*
|
|
363
|
+
* @param {object} $0
|
|
364
|
+
* @param {string} $0.stage The current build stage. One of 'develop', 'develop-html',
|
|
365
|
+
* 'build-javascript', or 'build-html'
|
|
366
|
+
* @param {function} $0.getConfig Returns the current webpack config
|
|
367
|
+
* @param {object} $0.rules A set of preconfigured webpack config rules
|
|
368
|
+
* @param {object} $0.loaders A set of preconfigured webpack config loaders
|
|
369
|
+
* @param {object} $0.plugins A set of preconfigured webpack config plugins
|
|
370
|
+
* @param {object} $0.actions
|
|
371
|
+
* @example
|
|
372
|
+
* exports.onCreateWebpackConfig = ({
|
|
373
|
+
* stage, getConfig, rules, loaders, actions
|
|
374
|
+
* }) => {
|
|
375
|
+
* actions.setWebpackConfig({
|
|
376
|
+
* module: {
|
|
377
|
+
* rules: [
|
|
378
|
+
* {
|
|
379
|
+
* test: 'my-css',
|
|
380
|
+
* use: [loaders.style(), loaders.css()]
|
|
381
|
+
* },
|
|
382
|
+
* ],
|
|
383
|
+
* },
|
|
384
|
+
* });
|
|
385
|
+
* }
|
|
386
|
+
*/
|
|
387
|
+
export declare const onCreateWebpackConfig = true;
|
|
388
|
+
/**
|
|
389
|
+
* The first API called during Gatsby execution, runs as soon as plugins are loaded, before cache initialization and bootstrap preparation.
|
|
390
|
+
*/
|
|
391
|
+
export declare const onPreInit = true;
|
|
392
|
+
/**
|
|
393
|
+
* Called once Gatsby has initialized itself and is ready to bootstrap your site.
|
|
394
|
+
*/
|
|
395
|
+
export declare const onPreBootstrap = true;
|
|
396
|
+
/**
|
|
397
|
+
* Called at the end of the bootstrap process after all other extension APIs have been called.
|
|
398
|
+
*/
|
|
399
|
+
export declare const onPostBootstrap = true;
|
|
400
|
+
/**
|
|
401
|
+
* The first extension point called during the build process. Called after the bootstrap has completed but before the build steps start.
|
|
402
|
+
*/
|
|
403
|
+
export declare const onPreBuild = true;
|
|
404
|
+
/**
|
|
405
|
+
* The last extension point called after all other parts of the build process
|
|
406
|
+
* are complete.
|
|
407
|
+
*/
|
|
408
|
+
export declare const onPostBuild = true;
|
|
409
|
+
/**
|
|
410
|
+
* Run before GraphQL queries/fragments are extracted from JavaScript files. Useful for plugins
|
|
411
|
+
* to add more JavaScript files with queries/fragments e.g. from node_modules.
|
|
412
|
+
*
|
|
413
|
+
* See gatsby-transformer-sharp and gatsby-source-contentful for examples.
|
|
414
|
+
*/
|
|
415
|
+
export declare const onPreExtractQueries = true;
|
|
416
|
+
/**
|
|
417
|
+
* Run when the `gatsby develop` server is started. It can be used for adding proxies and Express middleware
|
|
418
|
+
* to the server.
|
|
419
|
+
* @param {object} $0
|
|
420
|
+
* @param {Express} $0.app The [Express app](https://expressjs.com/en/4x/api.html#app) used to run the dev server
|
|
421
|
+
* @example
|
|
422
|
+
* exports.onCreateDevServer = ({ app }) => {
|
|
423
|
+
* app.get('/hello', function (req, res) {
|
|
424
|
+
* res.send('hello world')
|
|
425
|
+
* })
|
|
426
|
+
* }
|
|
427
|
+
*/
|
|
428
|
+
export declare const onCreateDevServer = true;
|
|
429
|
+
/**
|
|
430
|
+
* Run during the bootstrap phase. Plugins can use this to define a schema for their options using
|
|
431
|
+
* [Joi](https://joi.dev) to validate the options users pass to the plugin.
|
|
432
|
+
* @gatsbyVersion 2.25.0
|
|
433
|
+
* @param {object} $0
|
|
434
|
+
* @param {Joi} $0.Joi The instance of [Joi](https://joi.dev) to define the schema
|
|
435
|
+
* @example
|
|
436
|
+
* exports.pluginOptionsSchema = ({ Joi }) => {
|
|
437
|
+
* return Joi.object({
|
|
438
|
+
* // Validate that the anonymize option is defined by the user and is a boolean
|
|
439
|
+
* anonymize: Joi.boolean().required(),
|
|
440
|
+
* })
|
|
441
|
+
* }
|
|
442
|
+
*/
|
|
443
|
+
export declare const pluginOptionsSchema = true;
|