From 56f80698e42bafca96c2e9d8642b69f7d7a19d92 Mon Sep 17 00:00:00 2001 From: pieh Date: Thu, 6 Oct 2022 15:57:03 +0200 Subject: [PATCH] remove slice export from main and move to patch --- .../gatsby/cache-dir/gatsby-browser-entry.js | 1 - packages/gatsby/src/utils/webpack.config.js | 1 - .../v5/3-remove-static-query-component.patch | 2 +- patches/v5/5-slices-api.patch | 29 +++++++++++++------ 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/packages/gatsby/cache-dir/gatsby-browser-entry.js b/packages/gatsby/cache-dir/gatsby-browser-entry.js index 65218f27844e2..c2bfd3e2b7d6c 100644 --- a/packages/gatsby/cache-dir/gatsby-browser-entry.js +++ b/packages/gatsby/cache-dir/gatsby-browser-entry.js @@ -23,5 +23,4 @@ export { export { graphql, prefetchPathname } export { StaticQuery, StaticQueryContext, useStaticQuery } from "./static-query" -export { Slice } from "./slice" export * from "gatsby-script" diff --git a/packages/gatsby/src/utils/webpack.config.js b/packages/gatsby/src/utils/webpack.config.js index 63906e9afbbc5..8d9f04a997b5f 100644 --- a/packages/gatsby/src/utils/webpack.config.js +++ b/packages/gatsby/src/utils/webpack.config.js @@ -227,7 +227,6 @@ module.exports = async ( }) ), "global.hasPartialHydration": isPartialHydrationEnabled, - "_CFLAGS_.GATSBY_MAJOR": JSON.stringify(_CFLAGS_.GATSBY_MAJOR), }), plugins.virtualModules(), diff --git a/patches/v5/3-remove-static-query-component.patch b/patches/v5/3-remove-static-query-component.patch index 1a7eb7a4e2820..c01ab591156c8 100644 --- a/patches/v5/3-remove-static-query-component.patch +++ b/patches/v5/3-remove-static-query-component.patch @@ -8,7 +8,7 @@ index c2bfd3e2b7..9e0f1205bf 100644 export { graphql, prefetchPathname } -export { StaticQuery, StaticQueryContext, useStaticQuery } from "./static-query" +export { StaticQueryContext, useStaticQuery } from "./static-query" - export { Slice } from "./slice" + export * from "gatsby-script" diff --git a/packages/gatsby/cache-dir/static-query.js b/packages/gatsby/cache-dir/static-query.js index e31cebb08a..cef8ab70ed 100644 --- a/packages/gatsby/cache-dir/static-query.js diff --git a/patches/v5/5-slices-api.patch b/patches/v5/5-slices-api.patch index 4e1bc7a88725a..41f6cc10bb891 100644 --- a/patches/v5/5-slices-api.patch +++ b/patches/v5/5-slices-api.patch @@ -1,5 +1,15 @@ +diff --git a/packages/gatsby/cache-dir/gatsby-browser-entry.js b/packages/gatsby/cache-dir/gatsby-browser-entry.js +index 9e0f1205bf..f0a7dcb841 100644 +--- a/packages/gatsby/cache-dir/gatsby-browser-entry.js ++++ b/packages/gatsby/cache-dir/gatsby-browser-entry.js +@@ -23,4 +23,5 @@ export { + + export { graphql, prefetchPathname } + export { StaticQueryContext, useStaticQuery } from "./static-query" ++export { Slice } from "./slice" + export * from "gatsby-script" diff --git a/packages/gatsby/index.d.ts b/packages/gatsby/index.d.ts -index 57c92929c1..10763ffa32 100644 +index db2b6a78c1..f0e7745e01 100644 --- a/packages/gatsby/index.d.ts +++ b/packages/gatsby/index.d.ts @@ -182,6 +182,30 @@ export type HeadFC = ( @@ -33,7 +43,7 @@ index 57c92929c1..10763ffa32 100644 /** * Props object passed into the [getServerData](https://www.gatsbyjs.com/docs/reference/rendering-options/server-side-rendering/) function. */ -@@ -1227,6 +1251,14 @@ export interface Actions { +@@ -1207,6 +1231,14 @@ export interface Actions { option?: ActionOptions ): void @@ -48,19 +58,20 @@ index 57c92929c1..10763ffa32 100644 /** @see https://www.gatsbyjs.com/docs/actions/#deleteNode */ deleteNode(node: NodeInput, plugin?: ActionPlugin): void -@@ -1664,6 +1696,12 @@ export interface Page> { +@@ -1642,6 +1674,13 @@ export interface Page> { + context?: TContext + ownerNodeId?: string defer?: boolean - } - ++ slices?: Record ++} ++ +export interface SliceInput> { + id: string + component: string + context?: TContext -+} -+ + } + export interface IPluginRefObject { - resolve: string - options?: IPluginRefOptions diff --git a/packages/gatsby/src/redux/actions/restricted.ts b/packages/gatsby/src/redux/actions/restricted.ts index cb105dfa6d..0ee5d3eda7 100644 --- a/packages/gatsby/src/redux/actions/restricted.ts