@openstack_dev/gatsby-theme-marketing-oif-core 1.0.11 → 1.0.12

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/.nvmrc CHANGED
@@ -1 +1 @@
1
- 18.15.0
1
+ 18.20.2
package/gatsby-config.js CHANGED
@@ -40,6 +40,13 @@ const manifestPlugin = faviconAsset
40
40
  : [];
41
41
 
42
42
  const plugins = [
43
+ {
44
+ resolve: "gatsby-plugin-mui-theme-provider",
45
+ options: {
46
+ themePath: `${__dirname}/src/theme.js`,
47
+ },
48
+ },
49
+ "gatsby-plugin-emotion-cache-provider",
43
50
  ...manifestPlugin,
44
51
  {
45
52
  resolve: "gatsby-alias-imports",
@@ -47,6 +54,7 @@ const plugins = [
47
54
  aliases: {
48
55
  "@utils": `${__dirname}/src/utils`,
49
56
  "@cms": `${__dirname}/src/cms`,
57
+ "@content": `${__dirname}/src/content`,
50
58
  },
51
59
  },
52
60
  },
package/gatsby-node.js CHANGED
@@ -140,9 +140,6 @@ exports.onCreateWebpackConfig = ({ actions, plugins }) => {
140
140
  },
141
141
  // allows content and data imports to correctly resolve when theming
142
142
  modules: [path.resolve("src")],
143
- alias: {
144
- "@utils": path.resolve(__dirname, "src/utils/"),
145
- },
146
143
  },
147
144
  // devtool: "source-map",
148
145
  plugins: [
package/gatsby-ssr.js CHANGED
@@ -1,12 +1,7 @@
1
- import * as React from "react";
2
1
  import { JSDOM } from "jsdom";
3
2
  import { XMLHttpRequest } from "xmlhttprequest";
4
- import { renderToString } from "react-dom/server";
5
- import { CacheProvider } from "@emotion/react";
6
- import createEmotionServer from "@emotion/server/create-instance";
7
3
  import { ReduxWrapper } from "./src/state/ReduxWrapper";
8
4
  import { HeadComponents } from "./src/components/head-components";
9
- import createEmotionCache from "./src/utils/createEmotionCache";
10
5
 
11
6
  export const onRenderBody = ({ setHeadComponents }) => {
12
7
  if (process.env.NODE_ENV === "production") {
@@ -14,32 +9,6 @@ export const onRenderBody = ({ setHeadComponents }) => {
14
9
  }
15
10
  };
16
11
 
17
- export const replaceRenderer = ({
18
- bodyComponent,
19
- setHeadComponents,
20
- replaceBodyHTMLString,
21
- }) => {
22
- const cache = createEmotionCache();
23
- const { extractCriticalToChunks } = createEmotionServer(cache);
24
-
25
- const emotionStyles = extractCriticalToChunks(
26
- renderToString(<CacheProvider value={cache}>{bodyComponent}</CacheProvider>),
27
- );
28
-
29
- setHeadComponents(
30
- emotionStyles.styles.map((style) => (
31
- <style
32
- data-emotion={`${style.key} ${style.ids.join(" ")}`}
33
- key={style.key}
34
- dangerouslySetInnerHTML={{ __html: style.css }}
35
- />
36
- )),
37
- );
38
-
39
- // render the result from `extractCritical`
40
- replaceBodyHTMLString(emotionStyles.html);
41
- };
42
-
43
12
  export const wrapRootElement = ReduxWrapper;
44
13
 
45
14
  // build enabler polyfills
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openstack_dev/gatsby-theme-marketing-oif-core",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "Base theme for Marketing Sites",
5
5
  "author": "smarcet",
6
6
  "keywords": [
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { CacheProvider } from "@emotion/react";
3
+ import getEmotionCache from "./get-emotion-cache";
4
+
5
+ const cache = getEmotionCache();
6
+
7
+ export const wrapRootElement = ({ element }) => (
8
+ <CacheProvider value={cache}>{element}</CacheProvider>
9
+ );
@@ -0,0 +1,36 @@
1
+ import * as React from "react";
2
+ import { CacheProvider } from "@emotion/react";
3
+ import createEmotionServer from "@emotion/server/create-instance";
4
+ import { renderToString } from "react-dom/server";
5
+
6
+ import getEmotionCache from "./get-emotion-cache";
7
+
8
+ export const replaceRenderer = ({
9
+ bodyComponent,
10
+ setHeadComponents,
11
+ replaceBodyHTMLString,
12
+ }) => {
13
+ // see https://mui.com/material-ui/guides/server-rendering/
14
+ const cache = getEmotionCache();
15
+ const { extractCritical } = createEmotionServer(cache);
16
+
17
+ const initialHTML = renderToString(
18
+ <CacheProvider value={cache}>{bodyComponent}</CacheProvider>,
19
+ );
20
+
21
+ // see https://emotion.sh/docs/ssr#extractcritical
22
+ const { html, css, ids } = extractCritical(initialHTML);
23
+
24
+ const style = (
25
+ <style
26
+ key="theme-styles"
27
+ data-emotion={`css ${ids.join(" ")}`}
28
+ dangerouslySetInnerHTML={{ __html: css }}
29
+ />
30
+ );
31
+
32
+ setHeadComponents([style]);
33
+
34
+ // render the result from `extractCritical`
35
+ replaceBodyHTMLString(html);
36
+ };
@@ -0,0 +1,5 @@
1
+ import createCache from "@emotion/cache";
2
+
3
+ export default function getEmotionCache(props) {
4
+ return createCache(props ?? { key: "css" });
5
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "name": "gatsby-plugin-emotion-cache-provider"
3
+ }
@@ -0,0 +1,3 @@
1
+ import wrapThemeProvider from "./wrapThemeProvider";
2
+ // see https://galenwong.github.io/blog/2020-02-27-mui-jss-rendering/
3
+ export const wrapRootElement = wrapThemeProvider;
@@ -0,0 +1,43 @@
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+
4
+ // Copy and past from https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-plugin-typography
5
+ exports.onPreBootstrap = ({ cache }, pluginOptions) => {
6
+ let data = "";
7
+ console.log(
8
+ "gatsby-plugin-mui-theme-provider::onPreBootstrap",
9
+ pluginOptions,
10
+ );
11
+ if (pluginOptions.themePath) {
12
+ console.log(
13
+ `gatsby-plugin-mui-theme-provider::onPreBootstrap loading file ${pluginOptions.themePath}`,
14
+ );
15
+ data = fs.readFileSync(pluginOptions.themePath, {
16
+ encoding: "utf8",
17
+ flag: "r",
18
+ });
19
+ }
20
+
21
+ const dir = cache.directory;
22
+
23
+ if (!fs.existsSync(dir)) {
24
+ fs.mkdirSync(dir);
25
+ }
26
+
27
+ fs.writeFileSync(path.join(dir, "custom-theme.js"), data);
28
+ };
29
+
30
+ exports.onCreateWebpackConfig = ({ actions, cache }) => {
31
+ const themeFile = path.join(cache.directory, "custom-theme.js");
32
+ console.log(
33
+ `gatsby-plugin-mui-theme-provider::onCreateWebpackConfig ${themeFile}`,
34
+ );
35
+ const { setWebpackConfig } = actions;
36
+ setWebpackConfig({
37
+ resolve: {
38
+ alias: {
39
+ "custom-theme": themeFile,
40
+ },
41
+ },
42
+ });
43
+ };
@@ -0,0 +1,3 @@
1
+ import wrapThemeProvider from "./wrapThemeProvider";
2
+ // see https://galenwong.github.io/blog/2020-02-27-mui-jss-rendering/
3
+ export const wrapRootElement = wrapThemeProvider;
@@ -0,0 +1,3 @@
1
+ {
2
+ "name": "gatsby-plugin-mui-theme-provider"
3
+ }
@@ -0,0 +1,13 @@
1
+ import * as React from "react";
2
+ import { ThemeProvider } from "@mui/material/styles";
3
+ import CssBaseline from "@mui/material/CssBaseline";
4
+ import theme from "custom-theme";
5
+ // see https://galenwong.github.io/blog/2020-02-27-mui-jss-rendering/
6
+ const wrapThemeProvider = ({ element }) => (
7
+ <ThemeProvider theme={theme}>
8
+ <CssBaseline />
9
+ {element}
10
+ </ThemeProvider>
11
+ );
12
+
13
+ export default wrapThemeProvider;
@@ -1,14 +1,11 @@
1
1
  import React from "react";
2
2
  import PropTypes from "prop-types";
3
- import CssBaseline from "@mui/material/CssBaseline";
4
- import { ThemeProvider } from "@mui/material/styles";
5
3
  import loadable from "@loadable/component";
6
4
  import Footer from "./Footer";
7
5
  import SponsoredProjectsNav from "./SponsoredProjectsNav";
8
6
  import SubscribeForm from "./SubscribeForm";
9
7
  import AnnouncementBanner from "./AnnouncementBanner";
10
8
  import Header from "./Header";
11
- import theme from "../theme";
12
9
  import NavBarPlaceholder from "./Navbar/placeholder";
13
10
 
14
11
  const Navbar = loadable(() => import("./Navbar"), {
@@ -18,22 +15,19 @@ const Navbar = loadable(() => import("./Navbar"), {
18
15
 
19
16
  function Layout({ children }) {
20
17
  return (
21
- <ThemeProvider theme={theme}>
22
- <CssBaseline />
18
+ <div>
19
+ <SponsoredProjectsNav />
20
+ <Navbar />
23
21
  <div>
24
- <SponsoredProjectsNav />
25
- <Navbar />
26
- <div>
27
- <Header />
28
- <AnnouncementBanner />
29
- <main id="content-wrapper">
30
- {children}
31
- <SubscribeForm />
32
- </main>
33
- <Footer />
34
- </div>
22
+ <Header />
23
+ <AnnouncementBanner />
24
+ <main id="content-wrapper">
25
+ {children}
26
+ <SubscribeForm />
27
+ </main>
28
+ <Footer />
35
29
  </div>
36
- </ThemeProvider>
30
+ </div>
37
31
  );
38
32
  }
39
33
 
@@ -1 +1 @@
1
- { "staticJsonFilesBuildTime": [], "lastBuild": 1713964554954 }
1
+ { "staticJsonFilesBuildTime": [], "lastBuild": 1714686144309 }