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,252 +1,252 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This argument is empty. This is for consistency so `pluginOptions` is always second argument.
|
|
3
|
-
* @typedef {undefined} emptyArg
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Object containing options defined in `gatsby-config.js`
|
|
7
|
-
* @typedef {object} pluginOptions
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Called when the Gatsby browser runtime first starts.
|
|
11
|
-
* @param {emptyArg} _
|
|
12
|
-
* @param {pluginOptions} pluginOptions
|
|
13
|
-
* @example
|
|
14
|
-
* exports.onClientEntry = () => {
|
|
15
|
-
* console.log("We've started!")
|
|
16
|
-
* callAnalyticsAPI()
|
|
17
|
-
* }
|
|
18
|
-
*/
|
|
19
|
-
export declare const onClientEntry = true;
|
|
20
|
-
/**
|
|
21
|
-
* Called when the initial (but not subsequent) render of Gatsby App is done on the client.
|
|
22
|
-
* @param {emptyArg} _
|
|
23
|
-
* @param {pluginOptions} pluginOptions
|
|
24
|
-
* @example
|
|
25
|
-
* exports.onInitialClientRender = () => {
|
|
26
|
-
* console.log("ReactDOM.render has executed")
|
|
27
|
-
* }
|
|
28
|
-
*/
|
|
29
|
-
export declare const onInitialClientRender = true;
|
|
30
|
-
/**
|
|
31
|
-
* Called when changing location is started.
|
|
32
|
-
* @param {object} $0
|
|
33
|
-
* @param {object} $0.location A location object
|
|
34
|
-
* @param {object|null} $0.prevLocation The previous location object
|
|
35
|
-
* @param {pluginOptions} pluginOptions
|
|
36
|
-
* @example
|
|
37
|
-
* exports.onPreRouteUpdate = ({ location, prevLocation }) => {
|
|
38
|
-
* console.log("Gatsby started to change location to", location.pathname)
|
|
39
|
-
* console.log("Gatsby started to change location from", prevLocation ? prevLocation.pathname : null)
|
|
40
|
-
* }
|
|
41
|
-
*/
|
|
42
|
-
export declare const onPreRouteUpdate = true;
|
|
43
|
-
/**
|
|
44
|
-
* Called when changing location is longer than 1 second.
|
|
45
|
-
* @param {object} $0
|
|
46
|
-
* @param {object} $0.location A location object
|
|
47
|
-
* @param {object} $0.action The "action" that caused the route change
|
|
48
|
-
* @param {pluginOptions} pluginOptions
|
|
49
|
-
* @example
|
|
50
|
-
* exports.onRouteUpdateDelayed = () => {
|
|
51
|
-
* console.log("We can show loading indicator now")
|
|
52
|
-
* }
|
|
53
|
-
*/
|
|
54
|
-
export declare const onRouteUpdateDelayed = true;
|
|
55
|
-
/**
|
|
56
|
-
* Called when the user changes routes, including on the initial load of the app
|
|
57
|
-
* @param {object} $0
|
|
58
|
-
* @param {object} $0.location A location object
|
|
59
|
-
* @param {object|null} $0.prevLocation The previous location object
|
|
60
|
-
* @param {pluginOptions} pluginOptions
|
|
61
|
-
* @example
|
|
62
|
-
* exports.onRouteUpdate = ({ location, prevLocation }) => {
|
|
63
|
-
* console.log('new pathname', location.pathname)
|
|
64
|
-
* console.log('old pathname', prevLocation ? prevLocation.pathname : null)
|
|
65
|
-
* }
|
|
66
|
-
*/
|
|
67
|
-
export declare const onRouteUpdate = true;
|
|
68
|
-
/**
|
|
69
|
-
* Allows a plugin to influence scrolling behavior on navigation.
|
|
70
|
-
* Default behavior is persisting last known scrolling positions and scrolling back to them on navigation.
|
|
71
|
-
* Plugins can also override this and return an Array of coordinates or an element name to scroll to.
|
|
72
|
-
* @param {object} $0
|
|
73
|
-
* @param {object} $0.prevRouterProps The previous state of the router before the route change.
|
|
74
|
-
* @param {object} $0.routerProps The current state of the router.
|
|
75
|
-
* @param {string} $0.pathname The new pathname (for backwards compatibility with v1).
|
|
76
|
-
* @param {function} $0.getSavedScrollPosition Takes a location and returns the
|
|
77
|
-
* coordinates of the last scroll position for that location, or `null`. Gatsby
|
|
78
|
-
* saves scroll positions for each route in `SessionStorage`, so they are
|
|
79
|
-
* available after page reload.
|
|
80
|
-
* @returns {(boolean|string|Array)} Should return either an [x, y] Array of
|
|
81
|
-
* coordinates to scroll to, a string of the `id` or `name` of an element to
|
|
82
|
-
* scroll to, `false` to not update the scroll position, or `true` for the
|
|
83
|
-
* default behavior.
|
|
84
|
-
* @param {pluginOptions} pluginOptions
|
|
85
|
-
* @example
|
|
86
|
-
* exports.shouldUpdateScroll = ({
|
|
87
|
-
* routerProps: { location },
|
|
88
|
-
* getSavedScrollPosition
|
|
89
|
-
* }) => {
|
|
90
|
-
* const currentPosition = getSavedScrollPosition(location)
|
|
91
|
-
* const queriedPosition = getSavedScrollPosition({ pathname: `/random` })
|
|
92
|
-
*
|
|
93
|
-
* window.scrollTo(...(currentPosition || [0, 0]))
|
|
94
|
-
*
|
|
95
|
-
* return false
|
|
96
|
-
* }
|
|
97
|
-
*/
|
|
98
|
-
export declare const shouldUpdateScroll = true;
|
|
99
|
-
/**
|
|
100
|
-
* Allow a plugin to register a Service Worker. Should be a function that returns true.
|
|
101
|
-
* @param {emptyArg} _
|
|
102
|
-
* @param {pluginOptions} pluginOptions
|
|
103
|
-
* @returns {boolean} Should Gatsby register `/sw.js` service worker
|
|
104
|
-
* @example
|
|
105
|
-
* exports.registerServiceWorker = () => true
|
|
106
|
-
*/
|
|
107
|
-
export declare const registerServiceWorker = true;
|
|
108
|
-
/**
|
|
109
|
-
* Allow a plugin to replace the page component renderer.
|
|
110
|
-
* @deprecated Use [wrapPageElement](#wrapPageElement) to decorate page element.
|
|
111
|
-
* @param {object} $0
|
|
112
|
-
* @param {object} $0.props The props of the page.
|
|
113
|
-
* @param {object} $0.loader The gatsby loader.
|
|
114
|
-
* @param {pluginOptions} pluginOptions
|
|
115
|
-
* @returns {ReactNode} Replaced default page renderer
|
|
116
|
-
*/
|
|
117
|
-
export declare const replaceComponentRenderer = true;
|
|
118
|
-
/**
|
|
119
|
-
* Allow a plugin to wrap the page element.
|
|
120
|
-
*
|
|
121
|
-
* This is useful for setting wrapper components around pages that won't get
|
|
122
|
-
* unmounted on page changes. For setting Provider components, use [wrapRootElement](#wrapRootElement).
|
|
123
|
-
*
|
|
124
|
-
* _Note:_
|
|
125
|
-
* There is an equivalent hook in Gatsby's [SSR API](/docs/ssr-apis/#wrapPageElement).
|
|
126
|
-
* It is recommended to use both APIs together.
|
|
127
|
-
* For example usage, check out [Using i18n](https://github.com/gatsbyjs/gatsby/tree/master/examples/using-i18n).
|
|
128
|
-
* @param {object} $0
|
|
129
|
-
* @param {ReactNode} $0.element The "Page" React Element built by Gatsby.
|
|
130
|
-
* @param {object} $0.props Props object used by page.
|
|
131
|
-
* @param {pluginOptions} pluginOptions
|
|
132
|
-
* @returns {ReactNode} Wrapped element
|
|
133
|
-
* @example
|
|
134
|
-
* const React = require("react")
|
|
135
|
-
* const Layout = require("./src/components/layout").default
|
|
136
|
-
*
|
|
137
|
-
* exports.wrapPageElement = ({ element, props }) => {
|
|
138
|
-
* // props provide same data to Layout as Page element will get
|
|
139
|
-
* // including location, data, etc - you don't need to pass it
|
|
140
|
-
* return <Layout {...props}>{element}</Layout>
|
|
141
|
-
* }
|
|
142
|
-
*/
|
|
143
|
-
export declare const wrapPageElement = true;
|
|
144
|
-
/**
|
|
145
|
-
* Allow a plugin to wrap the root element.
|
|
146
|
-
*
|
|
147
|
-
* This is useful to set up any Provider components that will wrap your application.
|
|
148
|
-
* For setting persistent UI elements around pages use [wrapPageElement](#wrapPageElement).
|
|
149
|
-
*
|
|
150
|
-
* _Note:_
|
|
151
|
-
* There is an equivalent hook in Gatsby's [SSR API](/docs/ssr-apis/#wrapRootElement).
|
|
152
|
-
* It is recommended to use both APIs together.
|
|
153
|
-
* For example usage, check out [Using redux](https://github.com/gatsbyjs/gatsby/tree/master/examples/using-redux).
|
|
154
|
-
* @param {object} $0
|
|
155
|
-
* @param {ReactNode} $0.element The "Root" React Element built by Gatsby.
|
|
156
|
-
* @param {pluginOptions} pluginOptions
|
|
157
|
-
* @returns {ReactNode} Wrapped element
|
|
158
|
-
* @example
|
|
159
|
-
* const React = require("react")
|
|
160
|
-
* const { Provider } = require("react-redux")
|
|
161
|
-
*
|
|
162
|
-
* const createStore = require("./src/state/createStore")
|
|
163
|
-
* const store = createStore()
|
|
164
|
-
*
|
|
165
|
-
* exports.wrapRootElement = ({ element }) => {
|
|
166
|
-
* return (
|
|
167
|
-
* <Provider store={store}>
|
|
168
|
-
* {element}
|
|
169
|
-
* </Provider>
|
|
170
|
-
* )
|
|
171
|
-
* }
|
|
172
|
-
*/
|
|
173
|
-
export declare const wrapRootElement = true;
|
|
174
|
-
/**
|
|
175
|
-
* Called when prefetching for a pathname is triggered. Allows
|
|
176
|
-
* for plugins with custom prefetching logic.
|
|
177
|
-
* @param {object} $0
|
|
178
|
-
* @param {string} $0.pathname The pathname whose resources should now be prefetched
|
|
179
|
-
* @param {function} $0.loadPage Function for fetching resources related to pathname
|
|
180
|
-
* @param {pluginOptions} pluginOptions
|
|
181
|
-
*/
|
|
182
|
-
export declare const onPrefetchPathname = true;
|
|
183
|
-
/**
|
|
184
|
-
* Called when prefetching for a pathname is successful. Allows
|
|
185
|
-
* for plugins with custom prefetching logic.
|
|
186
|
-
* @param {object} $0
|
|
187
|
-
* @param {string} $0.pathname The pathname whose resources have now been prefetched
|
|
188
|
-
* @param {pluginOptions} pluginOptions
|
|
189
|
-
*/
|
|
190
|
-
export declare const onPostPrefetchPathname = true;
|
|
191
|
-
/**
|
|
192
|
-
* Plugins can take over prefetching logic. If they do, they should call this
|
|
193
|
-
* to disable the now duplicate core prefetching logic.
|
|
194
|
-
* @param {emptyArg} _
|
|
195
|
-
* @param {pluginOptions} pluginOptions
|
|
196
|
-
* @returns {boolean} Should disable core prefetching
|
|
197
|
-
* @example
|
|
198
|
-
* exports.disableCorePrefetching = () => true
|
|
199
|
-
*/
|
|
200
|
-
export declare const disableCorePrefetching = true;
|
|
201
|
-
/**
|
|
202
|
-
* Allow a plugin to replace the `ReactDOM.render`/`ReactDOM.hydrate` function call by a custom renderer.
|
|
203
|
-
* @param {emptyArg} _
|
|
204
|
-
* @param {pluginOptions} pluginOptions
|
|
205
|
-
* @returns {Function} This method should return a function with same signature as `ReactDOM.render()`
|
|
206
|
-
*
|
|
207
|
-
* _Note:_ it's very important to call the `callback` after rendering, otherwise Gatsby will not be able to call `onInitialClientRender`
|
|
208
|
-
* @example
|
|
209
|
-
* exports.replaceHydrateFunction = () => {
|
|
210
|
-
* return (element, container, callback) => {
|
|
211
|
-
* console.log("rendering!");
|
|
212
|
-
* ReactDOM.render(element, container, callback);
|
|
213
|
-
* };
|
|
214
|
-
* };
|
|
215
|
-
*/
|
|
216
|
-
export declare const replaceHydrateFunction = true;
|
|
217
|
-
/**
|
|
218
|
-
* Inform plugins when a service worker has been installed.
|
|
219
|
-
* @param {object} $0
|
|
220
|
-
* @param {object} $0.serviceWorker The service worker instance.
|
|
221
|
-
* @param {pluginOptions} pluginOptions
|
|
222
|
-
*/
|
|
223
|
-
export declare const onServiceWorkerInstalled = true;
|
|
224
|
-
/**
|
|
225
|
-
* Inform plugins of when a service worker has an update available.
|
|
226
|
-
* @param {object} $0
|
|
227
|
-
* @param {object} $0.serviceWorker The service worker instance.
|
|
228
|
-
* @param {pluginOptions} pluginOptions
|
|
229
|
-
*/
|
|
230
|
-
export declare const onServiceWorkerUpdateFound = true;
|
|
231
|
-
/**
|
|
232
|
-
* Inform plugins when a service worker has been updated in the background
|
|
233
|
-
* and the page is ready to reload to apply changes.
|
|
234
|
-
* @param {object} $0
|
|
235
|
-
* @param {object} $0.serviceWorker The service worker instance.
|
|
236
|
-
* @param {pluginOptions} pluginOptions
|
|
237
|
-
*/
|
|
238
|
-
export declare const onServiceWorkerUpdateReady = true;
|
|
239
|
-
/**
|
|
240
|
-
* Inform plugins when a service worker has become active.
|
|
241
|
-
* @param {object} $0
|
|
242
|
-
* @param {object} $0.serviceWorker The service worker instance.
|
|
243
|
-
* @param {pluginOptions} pluginOptions
|
|
244
|
-
*/
|
|
245
|
-
export declare const onServiceWorkerActive = true;
|
|
246
|
-
/**
|
|
247
|
-
* Inform plugins when a service worker is redundant.
|
|
248
|
-
* @param {object} $0
|
|
249
|
-
* @param {object} $0.serviceWorker The service worker instance.
|
|
250
|
-
* @param {pluginOptions} pluginOptions
|
|
251
|
-
*/
|
|
252
|
-
export declare const onServiceWorkerRedundant = true;
|
|
1
|
+
/**
|
|
2
|
+
* This argument is empty. This is for consistency so `pluginOptions` is always second argument.
|
|
3
|
+
* @typedef {undefined} emptyArg
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Object containing options defined in `gatsby-config.js`
|
|
7
|
+
* @typedef {object} pluginOptions
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Called when the Gatsby browser runtime first starts.
|
|
11
|
+
* @param {emptyArg} _
|
|
12
|
+
* @param {pluginOptions} pluginOptions
|
|
13
|
+
* @example
|
|
14
|
+
* exports.onClientEntry = () => {
|
|
15
|
+
* console.log("We've started!")
|
|
16
|
+
* callAnalyticsAPI()
|
|
17
|
+
* }
|
|
18
|
+
*/
|
|
19
|
+
export declare const onClientEntry = true;
|
|
20
|
+
/**
|
|
21
|
+
* Called when the initial (but not subsequent) render of Gatsby App is done on the client.
|
|
22
|
+
* @param {emptyArg} _
|
|
23
|
+
* @param {pluginOptions} pluginOptions
|
|
24
|
+
* @example
|
|
25
|
+
* exports.onInitialClientRender = () => {
|
|
26
|
+
* console.log("ReactDOM.render has executed")
|
|
27
|
+
* }
|
|
28
|
+
*/
|
|
29
|
+
export declare const onInitialClientRender = true;
|
|
30
|
+
/**
|
|
31
|
+
* Called when changing location is started.
|
|
32
|
+
* @param {object} $0
|
|
33
|
+
* @param {object} $0.location A location object
|
|
34
|
+
* @param {object|null} $0.prevLocation The previous location object
|
|
35
|
+
* @param {pluginOptions} pluginOptions
|
|
36
|
+
* @example
|
|
37
|
+
* exports.onPreRouteUpdate = ({ location, prevLocation }) => {
|
|
38
|
+
* console.log("Gatsby started to change location to", location.pathname)
|
|
39
|
+
* console.log("Gatsby started to change location from", prevLocation ? prevLocation.pathname : null)
|
|
40
|
+
* }
|
|
41
|
+
*/
|
|
42
|
+
export declare const onPreRouteUpdate = true;
|
|
43
|
+
/**
|
|
44
|
+
* Called when changing location is longer than 1 second.
|
|
45
|
+
* @param {object} $0
|
|
46
|
+
* @param {object} $0.location A location object
|
|
47
|
+
* @param {object} $0.action The "action" that caused the route change
|
|
48
|
+
* @param {pluginOptions} pluginOptions
|
|
49
|
+
* @example
|
|
50
|
+
* exports.onRouteUpdateDelayed = () => {
|
|
51
|
+
* console.log("We can show loading indicator now")
|
|
52
|
+
* }
|
|
53
|
+
*/
|
|
54
|
+
export declare const onRouteUpdateDelayed = true;
|
|
55
|
+
/**
|
|
56
|
+
* Called when the user changes routes, including on the initial load of the app
|
|
57
|
+
* @param {object} $0
|
|
58
|
+
* @param {object} $0.location A location object
|
|
59
|
+
* @param {object|null} $0.prevLocation The previous location object
|
|
60
|
+
* @param {pluginOptions} pluginOptions
|
|
61
|
+
* @example
|
|
62
|
+
* exports.onRouteUpdate = ({ location, prevLocation }) => {
|
|
63
|
+
* console.log('new pathname', location.pathname)
|
|
64
|
+
* console.log('old pathname', prevLocation ? prevLocation.pathname : null)
|
|
65
|
+
* }
|
|
66
|
+
*/
|
|
67
|
+
export declare const onRouteUpdate = true;
|
|
68
|
+
/**
|
|
69
|
+
* Allows a plugin to influence scrolling behavior on navigation.
|
|
70
|
+
* Default behavior is persisting last known scrolling positions and scrolling back to them on navigation.
|
|
71
|
+
* Plugins can also override this and return an Array of coordinates or an element name to scroll to.
|
|
72
|
+
* @param {object} $0
|
|
73
|
+
* @param {object} $0.prevRouterProps The previous state of the router before the route change.
|
|
74
|
+
* @param {object} $0.routerProps The current state of the router.
|
|
75
|
+
* @param {string} $0.pathname The new pathname (for backwards compatibility with v1).
|
|
76
|
+
* @param {function} $0.getSavedScrollPosition Takes a location and returns the
|
|
77
|
+
* coordinates of the last scroll position for that location, or `null`. Gatsby
|
|
78
|
+
* saves scroll positions for each route in `SessionStorage`, so they are
|
|
79
|
+
* available after page reload.
|
|
80
|
+
* @returns {(boolean|string|Array)} Should return either an [x, y] Array of
|
|
81
|
+
* coordinates to scroll to, a string of the `id` or `name` of an element to
|
|
82
|
+
* scroll to, `false` to not update the scroll position, or `true` for the
|
|
83
|
+
* default behavior.
|
|
84
|
+
* @param {pluginOptions} pluginOptions
|
|
85
|
+
* @example
|
|
86
|
+
* exports.shouldUpdateScroll = ({
|
|
87
|
+
* routerProps: { location },
|
|
88
|
+
* getSavedScrollPosition
|
|
89
|
+
* }) => {
|
|
90
|
+
* const currentPosition = getSavedScrollPosition(location)
|
|
91
|
+
* const queriedPosition = getSavedScrollPosition({ pathname: `/random` })
|
|
92
|
+
*
|
|
93
|
+
* window.scrollTo(...(currentPosition || [0, 0]))
|
|
94
|
+
*
|
|
95
|
+
* return false
|
|
96
|
+
* }
|
|
97
|
+
*/
|
|
98
|
+
export declare const shouldUpdateScroll = true;
|
|
99
|
+
/**
|
|
100
|
+
* Allow a plugin to register a Service Worker. Should be a function that returns true.
|
|
101
|
+
* @param {emptyArg} _
|
|
102
|
+
* @param {pluginOptions} pluginOptions
|
|
103
|
+
* @returns {boolean} Should Gatsby register `/sw.js` service worker
|
|
104
|
+
* @example
|
|
105
|
+
* exports.registerServiceWorker = () => true
|
|
106
|
+
*/
|
|
107
|
+
export declare const registerServiceWorker = true;
|
|
108
|
+
/**
|
|
109
|
+
* Allow a plugin to replace the page component renderer.
|
|
110
|
+
* @deprecated Use [wrapPageElement](#wrapPageElement) to decorate page element.
|
|
111
|
+
* @param {object} $0
|
|
112
|
+
* @param {object} $0.props The props of the page.
|
|
113
|
+
* @param {object} $0.loader The gatsby loader.
|
|
114
|
+
* @param {pluginOptions} pluginOptions
|
|
115
|
+
* @returns {ReactNode} Replaced default page renderer
|
|
116
|
+
*/
|
|
117
|
+
export declare const replaceComponentRenderer = true;
|
|
118
|
+
/**
|
|
119
|
+
* Allow a plugin to wrap the page element.
|
|
120
|
+
*
|
|
121
|
+
* This is useful for setting wrapper components around pages that won't get
|
|
122
|
+
* unmounted on page changes. For setting Provider components, use [wrapRootElement](#wrapRootElement).
|
|
123
|
+
*
|
|
124
|
+
* _Note:_
|
|
125
|
+
* There is an equivalent hook in Gatsby's [SSR API](/docs/ssr-apis/#wrapPageElement).
|
|
126
|
+
* It is recommended to use both APIs together.
|
|
127
|
+
* For example usage, check out [Using i18n](https://github.com/gatsbyjs/gatsby/tree/master/examples/using-i18n).
|
|
128
|
+
* @param {object} $0
|
|
129
|
+
* @param {ReactNode} $0.element The "Page" React Element built by Gatsby.
|
|
130
|
+
* @param {object} $0.props Props object used by page.
|
|
131
|
+
* @param {pluginOptions} pluginOptions
|
|
132
|
+
* @returns {ReactNode} Wrapped element
|
|
133
|
+
* @example
|
|
134
|
+
* const React = require("react")
|
|
135
|
+
* const Layout = require("./src/components/layout").default
|
|
136
|
+
*
|
|
137
|
+
* exports.wrapPageElement = ({ element, props }) => {
|
|
138
|
+
* // props provide same data to Layout as Page element will get
|
|
139
|
+
* // including location, data, etc - you don't need to pass it
|
|
140
|
+
* return <Layout {...props}>{element}</Layout>
|
|
141
|
+
* }
|
|
142
|
+
*/
|
|
143
|
+
export declare const wrapPageElement = true;
|
|
144
|
+
/**
|
|
145
|
+
* Allow a plugin to wrap the root element.
|
|
146
|
+
*
|
|
147
|
+
* This is useful to set up any Provider components that will wrap your application.
|
|
148
|
+
* For setting persistent UI elements around pages use [wrapPageElement](#wrapPageElement).
|
|
149
|
+
*
|
|
150
|
+
* _Note:_
|
|
151
|
+
* There is an equivalent hook in Gatsby's [SSR API](/docs/ssr-apis/#wrapRootElement).
|
|
152
|
+
* It is recommended to use both APIs together.
|
|
153
|
+
* For example usage, check out [Using redux](https://github.com/gatsbyjs/gatsby/tree/master/examples/using-redux).
|
|
154
|
+
* @param {object} $0
|
|
155
|
+
* @param {ReactNode} $0.element The "Root" React Element built by Gatsby.
|
|
156
|
+
* @param {pluginOptions} pluginOptions
|
|
157
|
+
* @returns {ReactNode} Wrapped element
|
|
158
|
+
* @example
|
|
159
|
+
* const React = require("react")
|
|
160
|
+
* const { Provider } = require("react-redux")
|
|
161
|
+
*
|
|
162
|
+
* const createStore = require("./src/state/createStore")
|
|
163
|
+
* const store = createStore()
|
|
164
|
+
*
|
|
165
|
+
* exports.wrapRootElement = ({ element }) => {
|
|
166
|
+
* return (
|
|
167
|
+
* <Provider store={store}>
|
|
168
|
+
* {element}
|
|
169
|
+
* </Provider>
|
|
170
|
+
* )
|
|
171
|
+
* }
|
|
172
|
+
*/
|
|
173
|
+
export declare const wrapRootElement = true;
|
|
174
|
+
/**
|
|
175
|
+
* Called when prefetching for a pathname is triggered. Allows
|
|
176
|
+
* for plugins with custom prefetching logic.
|
|
177
|
+
* @param {object} $0
|
|
178
|
+
* @param {string} $0.pathname The pathname whose resources should now be prefetched
|
|
179
|
+
* @param {function} $0.loadPage Function for fetching resources related to pathname
|
|
180
|
+
* @param {pluginOptions} pluginOptions
|
|
181
|
+
*/
|
|
182
|
+
export declare const onPrefetchPathname = true;
|
|
183
|
+
/**
|
|
184
|
+
* Called when prefetching for a pathname is successful. Allows
|
|
185
|
+
* for plugins with custom prefetching logic.
|
|
186
|
+
* @param {object} $0
|
|
187
|
+
* @param {string} $0.pathname The pathname whose resources have now been prefetched
|
|
188
|
+
* @param {pluginOptions} pluginOptions
|
|
189
|
+
*/
|
|
190
|
+
export declare const onPostPrefetchPathname = true;
|
|
191
|
+
/**
|
|
192
|
+
* Plugins can take over prefetching logic. If they do, they should call this
|
|
193
|
+
* to disable the now duplicate core prefetching logic.
|
|
194
|
+
* @param {emptyArg} _
|
|
195
|
+
* @param {pluginOptions} pluginOptions
|
|
196
|
+
* @returns {boolean} Should disable core prefetching
|
|
197
|
+
* @example
|
|
198
|
+
* exports.disableCorePrefetching = () => true
|
|
199
|
+
*/
|
|
200
|
+
export declare const disableCorePrefetching = true;
|
|
201
|
+
/**
|
|
202
|
+
* Allow a plugin to replace the `ReactDOM.render`/`ReactDOM.hydrate` function call by a custom renderer.
|
|
203
|
+
* @param {emptyArg} _
|
|
204
|
+
* @param {pluginOptions} pluginOptions
|
|
205
|
+
* @returns {Function} This method should return a function with same signature as `ReactDOM.render()`
|
|
206
|
+
*
|
|
207
|
+
* _Note:_ it's very important to call the `callback` after rendering, otherwise Gatsby will not be able to call `onInitialClientRender`
|
|
208
|
+
* @example
|
|
209
|
+
* exports.replaceHydrateFunction = () => {
|
|
210
|
+
* return (element, container, callback) => {
|
|
211
|
+
* console.log("rendering!");
|
|
212
|
+
* ReactDOM.render(element, container, callback);
|
|
213
|
+
* };
|
|
214
|
+
* };
|
|
215
|
+
*/
|
|
216
|
+
export declare const replaceHydrateFunction = true;
|
|
217
|
+
/**
|
|
218
|
+
* Inform plugins when a service worker has been installed.
|
|
219
|
+
* @param {object} $0
|
|
220
|
+
* @param {object} $0.serviceWorker The service worker instance.
|
|
221
|
+
* @param {pluginOptions} pluginOptions
|
|
222
|
+
*/
|
|
223
|
+
export declare const onServiceWorkerInstalled = true;
|
|
224
|
+
/**
|
|
225
|
+
* Inform plugins of when a service worker has an update available.
|
|
226
|
+
* @param {object} $0
|
|
227
|
+
* @param {object} $0.serviceWorker The service worker instance.
|
|
228
|
+
* @param {pluginOptions} pluginOptions
|
|
229
|
+
*/
|
|
230
|
+
export declare const onServiceWorkerUpdateFound = true;
|
|
231
|
+
/**
|
|
232
|
+
* Inform plugins when a service worker has been updated in the background
|
|
233
|
+
* and the page is ready to reload to apply changes.
|
|
234
|
+
* @param {object} $0
|
|
235
|
+
* @param {object} $0.serviceWorker The service worker instance.
|
|
236
|
+
* @param {pluginOptions} pluginOptions
|
|
237
|
+
*/
|
|
238
|
+
export declare const onServiceWorkerUpdateReady = true;
|
|
239
|
+
/**
|
|
240
|
+
* Inform plugins when a service worker has become active.
|
|
241
|
+
* @param {object} $0
|
|
242
|
+
* @param {object} $0.serviceWorker The service worker instance.
|
|
243
|
+
* @param {pluginOptions} pluginOptions
|
|
244
|
+
*/
|
|
245
|
+
export declare const onServiceWorkerActive = true;
|
|
246
|
+
/**
|
|
247
|
+
* Inform plugins when a service worker is redundant.
|
|
248
|
+
* @param {object} $0
|
|
249
|
+
* @param {object} $0.serviceWorker The service worker instance.
|
|
250
|
+
* @param {pluginOptions} pluginOptions
|
|
251
|
+
*/
|
|
252
|
+
export declare const onServiceWorkerRedundant = true;
|