-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(gatsby): Add TS type/v4 patches for
unstable_onPluginInit
(#33062)
- Loading branch information
Showing
5 changed files
with
114 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
diff --git a/packages/gatsby/index.d.ts b/packages/gatsby/index.d.ts | ||
index 4ed2e22114..df803ef8b4 100644 | ||
--- a/packages/gatsby/index.d.ts | ||
+++ b/packages/gatsby/index.d.ts | ||
@@ -350,7 +350,7 @@ export interface GatsbyNode< | ||
callback: PluginCallback<void> | ||
): void | Promise<void> | ||
|
||
- /** Called at the end of the bootstrap process after all other extension APIs have been called. If you indend to use this API in a plugin, use "unstable_onPluginInit" instead. */ | ||
+ /** Called at the end of the bootstrap process after all other extension APIs have been called. If you indend to use this API in a plugin, use "onPluginInit" instead. */ | ||
onPreBootstrap?( | ||
args: ParentSpanPluginArgs, | ||
options: PluginOptions, | ||
@@ -376,18 +376,18 @@ export interface GatsbyNode< | ||
* @gatsbyVersion 3.9.0 | ||
* @example | ||
* let createJobV2 | ||
- * exports.unstable_onPluginInit = ({ actions }) => { | ||
+ * exports.onPluginInit = ({ actions }) => { | ||
* // Store job creation action to use it later | ||
* createJobV2 = actions.createJobV2 | ||
* } | ||
*/ | ||
- unstable_onPluginInit?( | ||
+ onPluginInit?( | ||
args: ParentSpanPluginArgs, | ||
options: PluginOptions, | ||
callback: PluginCallback<void> | ||
): void | Promise<void> | ||
|
||
- /** The first API called during Gatsby execution, runs as soon as plugins are loaded, before cache initialization and bootstrap preparation. If you indend to use this API in a plugin, use "unstable_onPluginInit" instead. */ | ||
+ /** The first API called during Gatsby execution, runs as soon as plugins are loaded, before cache initialization and bootstrap preparation. If you indend to use this API in a plugin, use "onPluginInit" instead. */ | ||
onPreInit?( | ||
args: ParentSpanPluginArgs, | ||
options: PluginOptions, | ||
diff --git a/packages/gatsby/scripts/__tests__/api.js b/packages/gatsby/scripts/__tests__/api.js | ||
index c0b7735a76..593059e8ce 100644 | ||
--- a/packages/gatsby/scripts/__tests__/api.js | ||
+++ b/packages/gatsby/scripts/__tests__/api.js | ||
@@ -57,7 +57,7 @@ it("generates the expected api output", done => { | ||
"resolvableExtensions": Object {}, | ||
"setFieldsOnGraphQLNodeType": Object {}, | ||
"sourceNodes": Object {}, | ||
- "unstable_onPluginInit": Object { | ||
+ "onPluginInit": Object { | ||
"version": "3.9.0", | ||
}, | ||
"unstable_shouldOnCreateNode": Object { | ||
diff --git a/packages/gatsby/src/utils/api-node-docs.ts b/packages/gatsby/src/utils/api-node-docs.ts | ||
index 793386f614..06b2259350 100644 | ||
--- a/packages/gatsby/src/utils/api-node-docs.ts | ||
+++ b/packages/gatsby/src/utils/api-node-docs.ts | ||
@@ -415,14 +415,13 @@ export const onPreInit = true | ||
* | ||
* @example | ||
* let createJobV2 | ||
- * exports.unstable_onPluginInit = ({ actions }) => { | ||
+ * exports.onPluginInit = ({ actions }) => { | ||
* // store job creation action to use it later | ||
* createJobV2 = actions.createJobV2 | ||
* } | ||
* @gatsbyVersion 3.9.0 | ||
*/ | ||
-// eslint-disable-next-line @typescript-eslint/naming-convention | ||
-export const unstable_onPluginInit = true | ||
+export const onPluginInit = true | ||
|
||
/** | ||
* Called once Gatsby has initialized itself and is ready to bootstrap your site. |