Skip to content

Commit

Permalink
Revert "Convert api-browser and api-node docs to TS (#23688)"
Browse files Browse the repository at this point in the history
This reverts commit 7888560.
  • Loading branch information
gabrieluizramos authored May 6, 2020
1 parent aa1ebb9 commit 9c6c405
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 45 deletions.
2 changes: 1 addition & 1 deletion docs/docs/browser-apis.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Gatsby Browser APIs
description: Documentation about leveraging standard browser APIs within Gatsby
jsdoc: ["gatsby/src/utils/api-browser-docs.ts"]
jsdoc: ["gatsby/src/utils/api-browser-docs.js"]
apiCalls: BrowserAPI
showTopLevelSignatures: true
---
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/node-apis.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Gatsby Node APIs
description: Documentation on Node APIs used in Gatsby build process for common uses like creating pages
jsdoc: ["gatsby/src/utils/api-node-docs.ts"]
jsdoc: ["gatsby/src/utils/api-node-docs.js"]
apiCalls: NodeAPI
---

Expand Down
4 changes: 2 additions & 2 deletions packages/gatsby/scripts/output-api-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const OUTPUT_FILE_NAME = `apis.json`
async function outputFile() {
const apis = await Promise.all([
path.join('cache-dir', 'api-ssr-docs.js'),
path.join('src', 'utils', 'api-browser-docs.ts'),
path.join('src', 'utils', 'api-node-docs.ts')
path.join('src', 'utils', 'api-browser-docs.js'),
path.join('src', 'utils', 'api-node-docs.js')
]
.map(filePath => {
const resolved = path.resolve(filePath)
Expand Down
4 changes: 2 additions & 2 deletions packages/gatsby/src/bootstrap/load-plugins/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const _ = require(`lodash`)

const { store } = require(`../../redux`)
import * as nodeAPIs from "../../utils/api-node-docs"
import * as browserAPIs from "../../utils/api-browser-docs"
const nodeAPIs = require(`../../utils/api-node-docs`)
const browserAPIs = require(`../../utils/api-browser-docs`)
const ssrAPIs = require(`../../../cache-dir/api-ssr-docs`)
const { loadPlugins } = require(`./load`)
const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* callAnalyticsAPI()
* }
*/
export const onClientEntry = true
exports.onClientEntry = true

/**
* Called when the initial (but not subsequent) render of Gatsby App is done on the client.
Expand All @@ -29,7 +29,7 @@ export const onClientEntry = true
* console.log("ReactDOM.render has executed")
* }
*/
export const onInitialClientRender = true
exports.onInitialClientRender = true

/**
* Called when changing location is started.
Expand All @@ -43,7 +43,7 @@ export const onInitialClientRender = true
* console.log("Gatsby started to change location from", prevLocation ? prevLocation.pathname : null)
* }
*/
export const onPreRouteUpdate = true
exports.onPreRouteUpdate = true

/**
* Called when changing location is longer than 1 second.
Expand All @@ -56,7 +56,7 @@ export const onPreRouteUpdate = true
* console.log("We can show loading indicator now")
* }
*/
export const onRouteUpdateDelayed = true
exports.onRouteUpdateDelayed = true

/**
* Called when the user changes routes, including on the initial load of the app
Expand All @@ -70,7 +70,7 @@ export const onRouteUpdateDelayed = true
* console.log('old pathname', prevLocation ? prevLocation.pathname : null)
* }
*/
export const onRouteUpdate = true
exports.onRouteUpdate = true

/**
* Allows a plugin to influence scrolling behavior on navigation.
Expand Down Expand Up @@ -102,7 +102,7 @@ export const onRouteUpdate = true
* return false
* }
*/
export const shouldUpdateScroll = true
exports.shouldUpdateScroll = true

/**
* Allow a plugin to register a Service Worker. Should be a function that returns true.
Expand All @@ -112,7 +112,7 @@ export const shouldUpdateScroll = true
* @example
* exports.registerServiceWorker = () => true
*/
export const registerServiceWorker = true
exports.registerServiceWorker = true

/**
* Allow a plugin to replace the page component renderer.
Expand All @@ -123,7 +123,7 @@ export const registerServiceWorker = true
* @param {pluginOptions} pluginOptions
* @returns {ReactNode} Replaced default page renderer
*/
export const replaceComponentRenderer = true
exports.replaceComponentRenderer = true

/**
* Allow a plugin to wrap the page element.
Expand All @@ -150,7 +150,7 @@ export const replaceComponentRenderer = true
* return <Layout {...props}>{element}</Layout>
* }
*/
export const wrapPageElement = true
exports.wrapPageElement = true

/**
* Allow a plugin to wrap the root element.
Expand Down Expand Up @@ -181,7 +181,7 @@ export const wrapPageElement = true
* )
* }
*/
export const wrapRootElement = true
exports.wrapRootElement = true

/**
* Called when prefetching for a pathname is triggered. Allows
Expand All @@ -191,7 +191,7 @@ export const wrapRootElement = true
* @param {function} $0.loadPage Function for fetching resources related to pathname
* @param {pluginOptions} pluginOptions
*/
export const onPrefetchPathname = true
exports.onPrefetchPathname = true

/**
* Called when prefetching for a pathname is successful. Allows
Expand All @@ -200,7 +200,7 @@ export const onPrefetchPathname = true
* @param {string} $0.pathname The pathname whose resources have now been prefetched
* @param {pluginOptions} pluginOptions
*/
export const onPostPrefetchPathname = true
exports.onPostPrefetchPathname = true

/**
* Plugins can take over prefetching logic. If they do, they should call this
Expand All @@ -211,7 +211,7 @@ export const onPostPrefetchPathname = true
* @example
* exports.disableCorePrefetching = () => true
*/
export const disableCorePrefetching = true
exports.disableCorePrefetching = true

/**
* Allow a plugin to replace the `ReactDOM.render`/`ReactDOM.hydrate` function call by a custom renderer.
Expand All @@ -228,23 +228,23 @@ export const disableCorePrefetching = true
* };
* };
*/
export const replaceHydrateFunction = true
exports.replaceHydrateFunction = true

/**
* Inform plugins when a service worker has been installed.
* @param {object} $0
* @param {object} $0.serviceWorker The service worker instance.
* @param {pluginOptions} pluginOptions
*/
export const onServiceWorkerInstalled = true
exports.onServiceWorkerInstalled = true

/**
* Inform plugins of when a service worker has an update available.
* @param {object} $0
* @param {object} $0.serviceWorker The service worker instance.
* @param {pluginOptions} pluginOptions
*/
export const onServiceWorkerUpdateFound = true
exports.onServiceWorkerUpdateFound = true

/**
* Inform plugins when a service worker has been updated in the background
Expand All @@ -253,20 +253,20 @@ export const onServiceWorkerUpdateFound = true
* @param {object} $0.serviceWorker The service worker instance.
* @param {pluginOptions} pluginOptions
*/
export const onServiceWorkerUpdateReady = true
exports.onServiceWorkerUpdateReady = true

/**
* Inform plugins when a service worker has become active.
* @param {object} $0
* @param {object} $0.serviceWorker The service worker instance.
* @param {pluginOptions} pluginOptions
*/
export const onServiceWorkerActive = true
exports.onServiceWorkerActive = true

/**
* Inform plugins when a service worker is redundant.
* @param {object} $0
* @param {object} $0.serviceWorker The service worker instance.
* @param {pluginOptions} pluginOptions
*/
export const onServiceWorkerRedundant = true
exports.onServiceWorkerRedundant = true
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* of "resolvable" file extensions. Gatsby supports `.js` and `.jsx` by default.
* @returns {Array<string>} array of extensions
*/
export const resolvableExtensions = true
exports.resolvableExtensions = true

/**
* Tell plugins to add pages. This extension point is called only after the initial
Expand Down Expand Up @@ -60,7 +60,7 @@ export const resolvableExtensions = true
* }
*/

export const createPages = true
exports.createPages = true

/**
* Like `createPages` but for plugins who want to manage creating and removing
Expand All @@ -76,7 +76,7 @@ export const createPages = true
* Gatsby, it needs to keep its own state about its world to know when to
* add and remove pages.
*/
export const createPagesStatefully = true
exports.createPagesStatefully = true

/**
* Extension point to tell plugins to source nodes. This API is called during
Expand Down Expand Up @@ -116,7 +116,7 @@ export const createPagesStatefully = true
* createNode(node)
* }
*/
export const sourceNodes = true
exports.sourceNodes = true

/**
* Called when a new node is created. Plugins wishing to extend or
Expand All @@ -131,7 +131,7 @@ export const sourceNodes = true
* // create a new node field.
* }
*/
export const onCreateNode = true
exports.onCreateNode = true

/**
* Called when a new page is created. This extension API is useful
Expand All @@ -144,7 +144,7 @@ export const onCreateNode = true
* See the guide [Creating and Modifying Pages](/docs/creating-and-modifying-pages/)
* for more on this API.
*/
export const onCreatePage = true
exports.onCreatePage = true

/**
* Called during the creation of the GraphQL schema. Allows plugins
Expand Down Expand Up @@ -196,7 +196,7 @@ export const onCreatePage = true
* return {}
* }
*/
export const setFieldsOnGraphQLNodeType = true
exports.setFieldsOnGraphQLNodeType = true

/**
* Customize Gatsby's GraphQL schema by creating type definitions, field
Expand Down Expand Up @@ -245,7 +245,7 @@ export const setFieldsOnGraphQLNodeType = true
* createTypes(typeDefs)
* }
*/
export const createSchemaCustomization = true
exports.createSchemaCustomization = true

/**
* Add custom field resolvers to the GraphQL schema.
Expand Down Expand Up @@ -316,27 +316,27 @@ export const createSchemaCustomization = true
* createResolvers(resolvers)
* }
*/
export const createResolvers = true
exports.createResolvers = true

/**
* Ask compile-to-js plugins to process source to JavaScript so the query
* runner can extract out GraphQL queries for running.
*/
export const preprocessSource = true
exports.preprocessSource = true

/**
* Tell plugins with expensive "side effects" from queries to start running
* those now. This is a soon-to-be-replaced API only currently in use by
* `gatsby-plugin-sharp`.
*/
export const generateSideEffects = true
exports.generateSideEffects = true

/**
* Let plugins extend/mutate the site's Babel configuration.
* This API will change before 2.0 as it needs still to be converted to use
* Redux actions.
*/
export const onCreateBabelConfig = true
exports.onCreateBabelConfig = true

/**
* Let plugins extend/mutate the site's webpack configuration.
Expand Down Expand Up @@ -367,41 +367,41 @@ export const onCreateBabelConfig = true
* });
* }
*/
export const onCreateWebpackConfig = true
exports.onCreateWebpackConfig = true

/**
* The first API called during Gatsby execution, runs as soon as plugins are loaded, before cache initialization and bootstrap preparation.
*/
export const onPreInit = true
exports.onPreInit = true

/**
* Called once Gatsby has initialized itself and is ready to bootstrap your site.
*/
export const onPreBootstrap = true
exports.onPreBootstrap = true

/**
* Called at the end of the bootstrap process after all other extension APIs have been called.
*/
export const onPostBootstrap = true
exports.onPostBootstrap = true

/**
* The first extension point called during the build process. Called after the bootstrap has completed but before the build steps start.
*/
export const onPreBuild = true
exports.onPreBuild = true

/**
* The last extension point called after all other parts of the build process
* are complete.
*/
export const onPostBuild = true
exports.onPostBuild = true

/**
* Run before GraphQL queries/fragments are extracted from JavaScript files. Useful for plugins
* to add more JavaScript files with queries/fragments e.g. from node_modules.
*
* See gatsby-transformer-sharp and gatsby-source-contentful for examples.
*/
export const onPreExtractQueries = true
exports.onPreExtractQueries = true

/**
* Run when gatsby develop server is started, its useful to add proxy and middleware
Expand All @@ -415,4 +415,4 @@ export const onPreExtractQueries = true
* })
* }
*/
export const onCreateDevServer = true
exports.onCreateDevServer = true

0 comments on commit 9c6c405

Please sign in to comment.