gatsby 3.14.0-drupal-next.70 → 3.14.0-drupal-next.78

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.
Files changed (141) hide show
  1. package/apis.json +63 -0
  2. package/cache-dir/commonjs/api-runner-browser-plugins.js +15 -0
  3. package/cache-dir/commonjs/api-runner-browser.js +55 -0
  4. package/cache-dir/commonjs/api-runner-ssr.js +101 -0
  5. package/cache-dir/commonjs/api-ssr-docs.js +207 -0
  6. package/cache-dir/commonjs/app.js +217 -0
  7. package/cache-dir/commonjs/css-to-object.js +21 -0
  8. package/cache-dir/commonjs/debug-log.js +10 -0
  9. package/cache-dir/commonjs/default-html.js +37 -0
  10. package/cache-dir/commonjs/dev-loader.js +197 -0
  11. package/cache-dir/commonjs/develop-static-entry.js +149 -0
  12. package/cache-dir/commonjs/dummy.js +7 -0
  13. package/cache-dir/commonjs/emitter.js +12 -0
  14. package/cache-dir/commonjs/ensure-resources.js +126 -0
  15. package/cache-dir/commonjs/error-overlay-handler.js +42 -0
  16. package/cache-dir/commonjs/fast-refresh-overlay/components/accordion.js +93 -0
  17. package/cache-dir/commonjs/fast-refresh-overlay/components/build-error.js +52 -0
  18. package/cache-dir/commonjs/fast-refresh-overlay/components/code-frame.js +42 -0
  19. package/cache-dir/commonjs/fast-refresh-overlay/components/dev-ssr-error.js +58 -0
  20. package/cache-dir/commonjs/fast-refresh-overlay/components/error-boundary.js +33 -0
  21. package/cache-dir/commonjs/fast-refresh-overlay/components/graphql-errors.js +88 -0
  22. package/cache-dir/commonjs/fast-refresh-overlay/components/hooks.js +55 -0
  23. package/cache-dir/commonjs/fast-refresh-overlay/components/overlay.js +161 -0
  24. package/cache-dir/commonjs/fast-refresh-overlay/components/runtime-errors.js +95 -0
  25. package/cache-dir/commonjs/fast-refresh-overlay/components/use-id.js +56 -0
  26. package/cache-dir/commonjs/fast-refresh-overlay/helpers/focus-trap.js +3214 -0
  27. package/cache-dir/commonjs/fast-refresh-overlay/helpers/keys.js +81 -0
  28. package/cache-dir/commonjs/fast-refresh-overlay/helpers/lock-body.js +54 -0
  29. package/cache-dir/commonjs/fast-refresh-overlay/helpers/match.js +47 -0
  30. package/cache-dir/commonjs/fast-refresh-overlay/index.js +182 -0
  31. package/cache-dir/commonjs/fast-refresh-overlay/style.js +423 -0
  32. package/cache-dir/commonjs/fast-refresh-overlay/utils.js +88 -0
  33. package/cache-dir/commonjs/find-path.js +167 -0
  34. package/cache-dir/commonjs/gatsby-browser-entry.js +107 -0
  35. package/cache-dir/commonjs/loader.js +592 -0
  36. package/cache-dir/commonjs/loading-indicator/index.js +34 -0
  37. package/cache-dir/commonjs/loading-indicator/indicator.js +72 -0
  38. package/cache-dir/commonjs/loading-indicator/style.js +107 -0
  39. package/cache-dir/commonjs/navigation.js +323 -0
  40. package/cache-dir/commonjs/normalize-page-path.js +22 -0
  41. package/cache-dir/commonjs/page-renderer.js +54 -0
  42. package/cache-dir/commonjs/pages.json +1 -0
  43. package/cache-dir/commonjs/polyfill-entry.js +7 -0
  44. package/cache-dir/commonjs/prefetch.js +79 -0
  45. package/cache-dir/commonjs/production-app.js +208 -0
  46. package/cache-dir/commonjs/public-page-renderer-dev.js +33 -0
  47. package/cache-dir/commonjs/public-page-renderer-prod.js +38 -0
  48. package/cache-dir/commonjs/public-page-renderer.js +11 -0
  49. package/cache-dir/commonjs/query-result-store.js +144 -0
  50. package/cache-dir/commonjs/react-lifecycles-compat.js +3 -0
  51. package/cache-dir/commonjs/redirect-utils.js +30 -0
  52. package/cache-dir/commonjs/redirects.json +1 -0
  53. package/cache-dir/commonjs/register-service-worker.js +66 -0
  54. package/cache-dir/commonjs/root.js +113 -0
  55. package/cache-dir/commonjs/route-announcer-props.js +23 -0
  56. package/cache-dir/commonjs/server-utils/writable-as-promise.js +41 -0
  57. package/cache-dir/commonjs/shadow-portal.js +41 -0
  58. package/cache-dir/commonjs/socketIo.js +66 -0
  59. package/cache-dir/commonjs/ssr-builtin-trackers/child_process.js +8 -0
  60. package/cache-dir/commonjs/ssr-builtin-trackers/fs.js +7 -0
  61. package/cache-dir/commonjs/ssr-builtin-trackers/http.js +9 -0
  62. package/cache-dir/commonjs/ssr-builtin-trackers/http2.js +7 -0
  63. package/cache-dir/commonjs/ssr-builtin-trackers/https.js +9 -0
  64. package/cache-dir/commonjs/ssr-builtin-trackers/tracking-unsafe-module-wrapper.js +64 -0
  65. package/cache-dir/commonjs/ssr-develop-static-entry.js +339 -0
  66. package/cache-dir/commonjs/static-entry.js +478 -0
  67. package/cache-dir/commonjs/strip-prefix.js +24 -0
  68. package/dist/redux/reducers/components.js +10 -2
  69. package/dist/redux/reducers/components.js.map +1 -1
  70. package/dist/redux/reducers/html.js +4 -1
  71. package/dist/redux/reducers/html.js.map +1 -1
  72. package/dist/redux/reducers/index.js +4 -0
  73. package/dist/redux/reducers/index.js.map +1 -1
  74. package/dist/redux/reducers/queries.js +21 -11
  75. package/dist/redux/reducers/queries.js.map +1 -1
  76. package/dist/redux/reducers/tick.js +30 -0
  77. package/dist/redux/reducers/tick.js.map +1 -0
  78. package/dist/utils/api-runner-node.js +3 -1
  79. package/dist/utils/api-runner-node.js.map +1 -1
  80. package/dist/utils/source-nodes.js +45 -1
  81. package/dist/utils/source-nodes.js.map +1 -1
  82. package/dist/utils/worker/child/queries.js +5 -1
  83. package/dist/utils/worker/child/queries.js.map +1 -1
  84. package/gatsby-admin-public/4c744e84-68fce5225c02bf5771b5.js +2 -0
  85. package/gatsby-admin-public/4c744e84-68fce5225c02bf5771b5.js.map +1 -0
  86. package/gatsby-admin-public/69bd6bf3-684a0eb07103ce2347bb.js +2 -0
  87. package/gatsby-admin-public/69bd6bf3-684a0eb07103ce2347bb.js.map +1 -0
  88. package/gatsby-admin-public/784b2cee55c07b638f20445dec340adf9f1888a3-b2fc60100cf82df7f003.js +3 -0
  89. package/gatsby-admin-public/784b2cee55c07b638f20445dec340adf9f1888a3-b2fc60100cf82df7f003.js.LICENSE.txt +8 -0
  90. package/gatsby-admin-public/784b2cee55c07b638f20445dec340adf9f1888a3-b2fc60100cf82df7f003.js.map +1 -0
  91. package/gatsby-admin-public/854a7ef1f34af0aefbdfdd9304a0c00251662775-e2e8402c4d45f5fee48d.js +2 -0
  92. package/gatsby-admin-public/854a7ef1f34af0aefbdfdd9304a0c00251662775-e2e8402c4d45f5fee48d.js.map +1 -0
  93. package/gatsby-admin-public/app-552da616a99bc886bb71.js +3 -0
  94. package/gatsby-admin-public/app-552da616a99bc886bb71.js.LICENSE.txt +4 -0
  95. package/gatsby-admin-public/app-552da616a99bc886bb71.js.map +1 -0
  96. package/gatsby-admin-public/c432bec7e9afb3443fd639df9e5f119e13575cf7-8db0534ff52e363cdb1d.js +2 -0
  97. package/gatsby-admin-public/c432bec7e9afb3443fd639df9e5f119e13575cf7-8db0534ff52e363cdb1d.js.map +1 -0
  98. package/gatsby-admin-public/chunk-map.json +1 -0
  99. package/gatsby-admin-public/component---src-pages-index-tsx-ae7aa7efde37ccf72193.js +3 -0
  100. package/gatsby-admin-public/component---src-pages-index-tsx-ae7aa7efde37ccf72193.js.LICENSE.txt +5 -0
  101. package/gatsby-admin-public/component---src-pages-index-tsx-ae7aa7efde37ccf72193.js.map +1 -0
  102. package/gatsby-admin-public/component---src-pages-pages-tsx-b4a6c93567ec792e0974.js +2 -0
  103. package/gatsby-admin-public/component---src-pages-pages-tsx-b4a6c93567ec792e0974.js.map +1 -0
  104. package/gatsby-admin-public/component---src-pages-plugins-tsx-c2eb4db8168edfc87864.js +3 -0
  105. package/gatsby-admin-public/component---src-pages-plugins-tsx-c2eb4db8168edfc87864.js.LICENSE.txt +13 -0
  106. package/gatsby-admin-public/component---src-pages-plugins-tsx-c2eb4db8168edfc87864.js.map +1 -0
  107. package/gatsby-admin-public/component---src-pages-recipe-js-c33ae0ed3a512fe2bdb8.js +2 -0
  108. package/gatsby-admin-public/component---src-pages-recipe-js-c33ae0ed3a512fe2bdb8.js.map +1 -0
  109. package/gatsby-admin-public/component---src-pages-recipes-tsx-d347016863bb8d7ed197.js +2 -0
  110. package/gatsby-admin-public/component---src-pages-recipes-tsx-d347016863bb8d7ed197.js.map +1 -0
  111. package/gatsby-admin-public/e2852b4470dcb2615e49edcd9de2a3c8119d4bec-fdf65cf14f60e302e2d6.js +2 -0
  112. package/gatsby-admin-public/e2852b4470dcb2615e49edcd9de2a3c8119d4bec-fdf65cf14f60e302e2d6.js.map +1 -0
  113. package/gatsby-admin-public/favicon.ico +0 -0
  114. package/gatsby-admin-public/framework-b24cde22b86a9930317b.js +3 -0
  115. package/gatsby-admin-public/framework-b24cde22b86a9930317b.js.LICENSE.txt +26 -0
  116. package/gatsby-admin-public/framework-b24cde22b86a9930317b.js.map +1 -0
  117. package/gatsby-admin-public/index.html +1 -0
  118. package/gatsby-admin-public/page-data/app-data.json +1 -0
  119. package/gatsby-admin-public/page-data/index/page-data.json +5 -0
  120. package/gatsby-admin-public/page-data/pages/page-data.json +5 -0
  121. package/gatsby-admin-public/page-data/plugins/page-data.json +6 -0
  122. package/gatsby-admin-public/page-data/recipe/page-data.json +5 -0
  123. package/gatsby-admin-public/page-data/recipes/page-data.json +5 -0
  124. package/gatsby-admin-public/pages/index.html +1 -0
  125. package/gatsby-admin-public/plugins/index.html +1 -0
  126. package/gatsby-admin-public/polyfill-1052586767322c15619a.js +2 -0
  127. package/gatsby-admin-public/polyfill-1052586767322c15619a.js.map +1 -0
  128. package/gatsby-admin-public/recipe/index.html +1 -0
  129. package/gatsby-admin-public/recipes/index.html +1 -0
  130. package/gatsby-admin-public/static/skaterboi-f8d224bfd4e15e2d57c2aa63a09a3e31.svg +98 -0
  131. package/gatsby-admin-public/static/webfonts/s/inter/v3/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuDyYAZ9hiA.woff2 +0 -0
  132. package/gatsby-admin-public/static/webfonts/s/inter/v3/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuDyYAZ9hjg.woff +0 -0
  133. package/gatsby-admin-public/static/webfonts/s/inter/v3/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuGKYAZ9hiA.woff2 +0 -0
  134. package/gatsby-admin-public/static/webfonts/s/inter/v3/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuGKYAZ9hjg.woff +0 -0
  135. package/gatsby-admin-public/static/webfonts/s/inter/v3/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuLyfAZ9hiA.woff2 +0 -0
  136. package/gatsby-admin-public/static/webfonts/s/inter/v3/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuLyfAZ9hjg.woff +0 -0
  137. package/gatsby-admin-public/styles.ac2d3128404ecdaeec67.css +1 -0
  138. package/gatsby-admin-public/webpack-runtime-d39de238447331b7e7f5.js +2 -0
  139. package/gatsby-admin-public/webpack-runtime-d39de238447331b7e7f5.js.map +1 -0
  140. package/gatsby-admin-public/webpack.stats.json +1 -0
  141. package/package.json +3 -3
package/apis.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "ssr": {
3
+ "replaceRenderer": {},
4
+ "onRenderBody": {},
5
+ "onPreRenderHTML": {},
6
+ "wrapPageElement": {},
7
+ "wrapRootElement": {}
8
+ },
9
+ "browser": {
10
+ "onClientEntry": {},
11
+ "onInitialClientRender": {},
12
+ "onPreRouteUpdate": {},
13
+ "onRouteUpdateDelayed": {},
14
+ "onRouteUpdate": {},
15
+ "shouldUpdateScroll": {},
16
+ "registerServiceWorker": {},
17
+ "wrapPageElement": {},
18
+ "wrapRootElement": {},
19
+ "onPrefetchPathname": {},
20
+ "onPostPrefetchPathname": {},
21
+ "disableCorePrefetching": {},
22
+ "replaceHydrateFunction": {},
23
+ "onServiceWorkerInstalled": {},
24
+ "onServiceWorkerUpdateFound": {},
25
+ "onServiceWorkerUpdateReady": {},
26
+ "onServiceWorkerActive": {},
27
+ "onServiceWorkerRedundant": {}
28
+ },
29
+ "node": {
30
+ "resolvableExtensions": {},
31
+ "createPages": {},
32
+ "createPagesStatefully": {},
33
+ "sourceNodes": {},
34
+ "onCreateNode": {},
35
+ "unstable_shouldOnCreateNode": {
36
+ "version": "2.24.80"
37
+ },
38
+ "onCreatePage": {},
39
+ "setFieldsOnGraphQLNodeType": {},
40
+ "createSchemaCustomization": {
41
+ "version": "2.12.0"
42
+ },
43
+ "createResolvers": {
44
+ "version": "2.2.0"
45
+ },
46
+ "preprocessSource": {},
47
+ "onCreateBabelConfig": {},
48
+ "onCreateWebpackConfig": {},
49
+ "onPreInit": {},
50
+ "unstable_onPluginInit": {
51
+ "version": "3.9.0"
52
+ },
53
+ "onPreBootstrap": {},
54
+ "onPostBootstrap": {},
55
+ "onPreBuild": {},
56
+ "onPostBuild": {},
57
+ "onPreExtractQueries": {},
58
+ "onCreateDevServer": {},
59
+ "pluginOptionsSchema": {
60
+ "version": "2.25.0"
61
+ }
62
+ }
63
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ // During bootstrap, we write requires at top of this file which looks
4
+ // basically like:
5
+ // module.exports = [
6
+ // {
7
+ // plugin: require("/path/to/plugin1/gatsby-browser.js"),
8
+ // options: { ... },
9
+ // },
10
+ // {
11
+ // plugin: require("/path/to/plugin2/gatsby-browser.js"),
12
+ // options: { ... },
13
+ // },
14
+ // ]
15
+ module.exports = [];
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ const plugins = require(`./api-runner-browser-plugins`);
4
+
5
+ const {
6
+ getResourceURLsForPathname,
7
+ loadPage,
8
+ loadPageSync
9
+ } = require(`./loader`).publicLoader;
10
+
11
+ exports.apiRunner = (api, args = {}, defaultReturn, argTransform) => {
12
+ // Hooks for gatsby-cypress's API handler
13
+ if (process.env.CYPRESS_SUPPORT) {
14
+ if (window.___apiHandler) {
15
+ window.___apiHandler(api);
16
+ } else if (window.___resolvedAPIs) {
17
+ window.___resolvedAPIs.push(api);
18
+ } else {
19
+ window.___resolvedAPIs = [api];
20
+ }
21
+ }
22
+
23
+ let results = plugins.map(plugin => {
24
+ if (!plugin.plugin[api]) {
25
+ return undefined;
26
+ }
27
+
28
+ args.getResourceURLsForPathname = getResourceURLsForPathname;
29
+ args.loadPage = loadPage;
30
+ args.loadPageSync = loadPageSync;
31
+ const result = plugin.plugin[api](args, plugin.options);
32
+
33
+ if (result && argTransform) {
34
+ args = argTransform({
35
+ args,
36
+ result,
37
+ plugin
38
+ });
39
+ }
40
+
41
+ return result;
42
+ }); // Filter out undefined results.
43
+
44
+ results = results.filter(result => typeof result !== `undefined`);
45
+
46
+ if (results.length > 0) {
47
+ return results;
48
+ } else if (defaultReturn) {
49
+ return [defaultReturn];
50
+ } else {
51
+ return [];
52
+ }
53
+ };
54
+
55
+ exports.apiRunnerAsync = (api, args, defaultReturn) => plugins.reduce((previous, next) => next.plugin[api] ? previous.then(() => next.plugin[api](args, next.options)) : previous, Promise.resolve());
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.apiRunner = apiRunner;
5
+ exports.apiRunnerAsync = apiRunnerAsync;
6
+
7
+ /* global plugins */
8
+ // During bootstrap, we write requires at top of this file which looks like:
9
+ // var plugins = [
10
+ // {
11
+ // plugin: require("/path/to/plugin1/gatsby-ssr.js"),
12
+ // options: { ... },
13
+ // },
14
+ // {
15
+ // plugin: require("/path/to/plugin2/gatsby-ssr.js"),
16
+ // options: { ... },
17
+ // },
18
+ // ]
19
+ const apis = require(`./api-ssr-docs`);
20
+
21
+ function augmentErrorWithPlugin(plugin, err) {
22
+ if (plugin.name !== `default-site-plugin`) {
23
+ // default-site-plugin is user code and will print proper stack trace,
24
+ // so no point in annotating error message pointing out which plugin is root of the problem
25
+ err.message += ` (from plugin: ${plugin.name})`;
26
+ }
27
+
28
+ throw err;
29
+ }
30
+
31
+ function apiRunner(api, args, defaultReturn, argTransform) {
32
+ if (!apis[api]) {
33
+ console.log(`This API doesn't exist`, api);
34
+ }
35
+
36
+ const results = [];
37
+ plugins.forEach(plugin => {
38
+ const apiFn = plugin.plugin[api];
39
+
40
+ if (!apiFn) {
41
+ return;
42
+ }
43
+
44
+ try {
45
+ const result = apiFn(args, plugin.options);
46
+
47
+ if (result && argTransform) {
48
+ args = argTransform({
49
+ args,
50
+ result
51
+ });
52
+ } // This if case keeps behaviour as before, we should allow undefined here as the api is defined
53
+ // TODO V4
54
+
55
+
56
+ if (typeof result !== `undefined`) {
57
+ results.push(result);
58
+ }
59
+ } catch (e) {
60
+ augmentErrorWithPlugin(plugin, e);
61
+ }
62
+ });
63
+ return results.length ? results : [defaultReturn];
64
+ }
65
+
66
+ async function apiRunnerAsync(api, args, defaultReturn, argTransform) {
67
+ if (!apis[api]) {
68
+ console.log(`This API doesn't exist`, api);
69
+ }
70
+
71
+ const results = [];
72
+
73
+ for (const plugin of plugins) {
74
+ const apiFn = plugin.plugin[api];
75
+
76
+ if (!apiFn) {
77
+ continue;
78
+ }
79
+
80
+ try {
81
+ const result = await apiFn(args, plugin.options);
82
+
83
+ if (result && argTransform) {
84
+ args = argTransform({
85
+ args,
86
+ result
87
+ });
88
+ } // This if case keeps behaviour as before, we should allow undefined here as the api is defined
89
+ // TODO V4
90
+
91
+
92
+ if (typeof result !== `undefined`) {
93
+ results.push(result);
94
+ }
95
+ } catch (e) {
96
+ augmentErrorWithPlugin(plugin, e);
97
+ }
98
+ }
99
+
100
+ return results.length ? results : [defaultReturn];
101
+ }
@@ -0,0 +1,207 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Object containing options defined in `gatsby-config.js`
5
+ * @typedef {object} pluginOptions
6
+ */
7
+
8
+ /**
9
+ * Replace the default server renderer. This is useful for integration with
10
+ * Redux, css-in-js libraries, etc. that need custom setups for server
11
+ * rendering.
12
+ * @param {object} $0
13
+ * @param {string} $0.pathname The pathname of the page currently being rendered.
14
+ * @param {ReactNode} $0.bodyComponent The React element to be rendered as the page body
15
+ * @param {function} $0.replaceBodyHTMLString Call this with the HTML string
16
+ * you render. **WARNING** if multiple plugins implement this API it's the
17
+ * last plugin that "wins". TODO implement an automated warning against this.
18
+ * @param {function} $0.setHeadComponents Takes an array of components as its
19
+ * first argument which are added to the `headComponents` array which is passed
20
+ * to the `html.js` component.
21
+ * @param {function} $0.setHtmlAttributes Takes an object of props which will
22
+ * spread into the `<html>` component.
23
+ * @param {function} $0.setBodyAttributes Takes an object of props which will
24
+ * spread into the `<body>` component.
25
+ * @param {function} $0.setPreBodyComponents Takes an array of components as its
26
+ * first argument which are added to the `preBodyComponents` array which is passed
27
+ * to the `html.js` component.
28
+ * @param {function} $0.setPostBodyComponents Takes an array of components as its
29
+ * first argument which are added to the `postBodyComponents` array which is passed
30
+ * to the `html.js` component.
31
+ * @param {function} $0.setBodyProps Takes an object of data which
32
+ * is merged with other body props and passed to `html.js` as `bodyProps`.
33
+ * @param {pluginOptions} pluginOptions
34
+ * @example
35
+ * // From gatsby-plugin-glamor
36
+ * const { renderToString } = require("react-dom/server")
37
+ * const inline = require("glamor-inline")
38
+ *
39
+ * exports.replaceRenderer = ({ bodyComponent, replaceBodyHTMLString }) => {
40
+ * const bodyHTML = renderToString(bodyComponent)
41
+ * const inlinedHTML = inline(bodyHTML)
42
+ *
43
+ * replaceBodyHTMLString(inlinedHTML)
44
+ * }
45
+ */
46
+ exports.replaceRenderer = true;
47
+ /**
48
+ * Called after every page Gatsby server renders while building HTML so you can
49
+ * set head and body components to be rendered in your `html.js`.
50
+ *
51
+ * Gatsby does a two-pass render for HTML. It loops through your pages first
52
+ * rendering only the body and then takes the result body HTML string and
53
+ * passes it as the `body` prop to your `html.js` to complete the render.
54
+ *
55
+ * It's often handy to be able to send custom components to your `html.js`.
56
+ * For example, it's a very common pattern for React.js libraries that
57
+ * support server rendering to pull out data generated during the render to
58
+ * add to your HTML.
59
+ *
60
+ * Using this API over [`replaceRenderer`](#replaceRenderer) is preferable as
61
+ * multiple plugins can implement this API where only one plugin can take
62
+ * over server rendering. However, if your plugin requires taking over server
63
+ * rendering then that's the one to
64
+ * use
65
+ * @param {object} $0
66
+ * @param {string} $0.pathname The pathname of the page currently being rendered.
67
+ * @param {function} $0.setHeadComponents Takes an array of components as its
68
+ * first argument which are added to the `headComponents` array which is passed
69
+ * to the `html.js` component.
70
+ * @param {function} $0.setHtmlAttributes Takes an object of props which will
71
+ * spread into the `<html>` component.
72
+ * @param {function} $0.setBodyAttributes Takes an object of props which will
73
+ * spread into the `<body>` component.
74
+ * @param {function} $0.setPreBodyComponents Takes an array of components as its
75
+ * first argument which are added to the `preBodyComponents` array which is passed
76
+ * to the `html.js` component.
77
+ * @param {function} $0.setPostBodyComponents Takes an array of components as its
78
+ * first argument which are added to the `postBodyComponents` array which is passed
79
+ * to the `html.js` component.
80
+ * @param {function} $0.setBodyProps Takes an object of data which
81
+ * is merged with other body props and passed to `html.js` as `bodyProps`.
82
+ * @param {pluginOptions} pluginOptions
83
+ * @example
84
+ * // Import React so that you can use JSX in HeadComponents
85
+ * const React = require("react")
86
+ *
87
+ * const HtmlAttributes = {
88
+ * lang: "en"
89
+ * }
90
+ *
91
+ * const HeadComponents = [
92
+ * <script key="my-script" src="https://gatsby.dev/my-script" />
93
+ * ]
94
+ *
95
+ * const BodyAttributes = {
96
+ * "data-theme": "dark"
97
+ * }
98
+ *
99
+ * exports.onRenderBody = ({
100
+ * setHeadComponents,
101
+ * setHtmlAttributes,
102
+ * setBodyAttributes
103
+ * }, pluginOptions) => {
104
+ * setHtmlAttributes(HtmlAttributes)
105
+ * setHeadComponents(HeadComponents)
106
+ * setBodyAttributes(BodyAttributes)
107
+ * }
108
+ */
109
+
110
+ exports.onRenderBody = true;
111
+ /**
112
+ * Called after every page Gatsby server renders while building HTML so you can
113
+ * replace head components to be rendered in your `html.js`. This is useful if
114
+ * you need to reorder scripts or styles added by other plugins.
115
+ * @param {object} $0
116
+ * @param {string} $0.pathname The pathname of the page currently being rendered.
117
+ * @param {Array<ReactNode>} $0.getHeadComponents Returns the current `headComponents` array.
118
+ * @param {function} $0.replaceHeadComponents Takes an array of components as its
119
+ * first argument which replace the `headComponents` array which is passed
120
+ * to the `html.js` component. **WARNING** if multiple plugins implement this
121
+ * API it's the last plugin that "wins".
122
+ * @param {Array<ReactNode>} $0.getPreBodyComponents Returns the current `preBodyComponents` array.
123
+ * @param {function} $0.replacePreBodyComponents Takes an array of components as its
124
+ * first argument which replace the `preBodyComponents` array which is passed
125
+ * to the `html.js` component. **WARNING** if multiple plugins implement this
126
+ * API it's the last plugin that "wins".
127
+ * @param {Array<ReactNode>} $0.getPostBodyComponents Returns the current `postBodyComponents` array.
128
+ * @param {function} $0.replacePostBodyComponents Takes an array of components as its
129
+ * first argument which replace the `postBodyComponents` array which is passed
130
+ * to the `html.js` component. **WARNING** if multiple plugins implement this
131
+ * API it's the last plugin that "wins".
132
+ * @param {pluginOptions} pluginOptions
133
+ * @example
134
+ * // Move Typography.js styles to the top of the head section so they're loaded first.
135
+ * exports.onPreRenderHTML = ({ getHeadComponents, replaceHeadComponents }) => {
136
+ * const headComponents = getHeadComponents()
137
+ * headComponents.sort((x, y) => {
138
+ * if (x.key === 'TypographyStyle') {
139
+ * return -1
140
+ * } else if (y.key === 'TypographyStyle') {
141
+ * return 1
142
+ * }
143
+ * return 0
144
+ * })
145
+ * replaceHeadComponents(headComponents)
146
+ * }
147
+ */
148
+
149
+ exports.onPreRenderHTML = true;
150
+ /**
151
+ * Allow a plugin to wrap the page element.
152
+ *
153
+ * This is useful for setting wrapper components around pages that won't get
154
+ * unmounted on page changes. For setting Provider components, use [wrapRootElement](#wrapRootElement).
155
+ *
156
+ * _Note:_
157
+ * There is an equivalent hook in Gatsby's [Browser API](/docs/browser-apis/#wrapPageElement).
158
+ * It is recommended to use both APIs together.
159
+ * For example usage, check out [Using i18n](https://github.com/gatsbyjs/gatsby/tree/master/examples/using-i18n).
160
+ * @param {object} $0
161
+ * @param {ReactNode} $0.element The "Page" React Element built by Gatsby.
162
+ * @param {object} $0.props Props object used by page.
163
+ * @param {pluginOptions} pluginOptions
164
+ * @returns {ReactNode} Wrapped element
165
+ * @example
166
+ * const React = require("react")
167
+ * const Layout = require("./src/components/layout").default
168
+ *
169
+ * exports.wrapPageElement = ({ element, props }) => {
170
+ * // props provide same data to Layout as Page element will get
171
+ * // including location, data, etc - you don't need to pass it
172
+ * return <Layout {...props}>{element}</Layout>
173
+ * }
174
+ */
175
+
176
+ exports.wrapPageElement = true;
177
+ /**
178
+ * Allow a plugin to wrap the root element.
179
+ *
180
+ * This is useful to set up any Provider components that will wrap your application.
181
+ * For setting persistent UI elements around pages use [wrapPageElement](#wrapPageElement).
182
+ *
183
+ * _Note:_
184
+ * There is an equivalent hook in Gatsby's [Browser API](/docs/browser-apis/#wrapRootElement).
185
+ * It is recommended to use both APIs together.
186
+ * For example usage, check out [Using redux](https://github.com/gatsbyjs/gatsby/tree/master/examples/using-redux).
187
+ * @param {object} $0
188
+ * @param {ReactNode} $0.element The "Root" React Element built by Gatsby.
189
+ * @param {pluginOptions} pluginOptions
190
+ * @returns {ReactNode} Wrapped element
191
+ * @example
192
+ * const React = require("react")
193
+ * const { Provider } = require("react-redux")
194
+ *
195
+ * const createStore = require("./src/state/createStore")
196
+ * const store = createStore()
197
+ *
198
+ * exports.wrapRootElement = ({ element }) => {
199
+ * return (
200
+ * <Provider store={store}>
201
+ * {element}
202
+ * </Provider>
203
+ * )
204
+ * }
205
+ */
206
+
207
+ exports.wrapRootElement = true;
@@ -0,0 +1,217 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ exports.__esModule = true;
6
+ exports.notCalledFunction = notCalledFunction;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _reactDom = _interopRequireDefault(require("react-dom"));
11
+
12
+ var _socket = _interopRequireDefault(require("socket.io-client"));
13
+
14
+ var _socketIo = _interopRequireDefault(require("./socketIo"));
15
+
16
+ var _emitter = _interopRequireDefault(require("./emitter"));
17
+
18
+ var _apiRunnerBrowser = require("./api-runner-browser");
19
+
20
+ var _loader = require("./loader");
21
+
22
+ var _indicator = require("./loading-indicator/indicator");
23
+
24
+ var _devLoader = _interopRequireDefault(require("./dev-loader"));
25
+
26
+ var _asyncRequires = _interopRequireDefault(require("$virtual/async-requires"));
27
+
28
+ var _matchPaths = _interopRequireDefault(require("$virtual/match-paths.json"));
29
+
30
+ var _loadingIndicator = require("./loading-indicator");
31
+
32
+ var _root = _interopRequireDefault(require("./root"));
33
+
34
+ var _navigation = require("./navigation");
35
+
36
+ require("./blank.css");
37
+
38
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
39
+
40
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
41
+
42
+ // Enable fast-refresh for virtual sync-requires, gatsby-browser & navigation
43
+ // To ensure that our <Root /> component can hot reload in case anything below doesn't
44
+ // satisfy fast-refresh constraints
45
+ module.hot.accept([`$virtual/async-requires`, `./api-runner-browser`, `./navigation`], () => {
46
+ // asyncRequires should be automatically updated here (due to ESM import and webpack HMR spec),
47
+ // but loader doesn't know that and needs to be manually nudged
48
+ loader.updateAsyncRequires(_asyncRequires.default);
49
+ });
50
+ window.___emitter = _emitter.default;
51
+ const loader = new _devLoader.default(_asyncRequires.default, _matchPaths.default);
52
+ (0, _loader.setLoader)(loader);
53
+ loader.setApiRunner(_apiRunnerBrowser.apiRunner);
54
+ window.___loader = _loader.publicLoader; // Do dummy dynamic import so the jsonp __webpack_require__.e is added to the commons.js
55
+ // bundle. This ensures hot reloading doesn't break when someone first adds
56
+ // a dynamic import.
57
+ //
58
+ // Without this, the runtime breaks with a
59
+ // "TypeError: __webpack_require__.e is not a function"
60
+ // error.
61
+
62
+ function notCalledFunction() {
63
+ return Promise.resolve().then(() => _interopRequireWildcard(require(`./dummy`)));
64
+ } // Let the site/plugins run code very early.
65
+
66
+
67
+ (0, _apiRunnerBrowser.apiRunnerAsync)(`onClientEntry`).then(() => {
68
+ // Hook up the client to socket.io on server
69
+ const socket = (0, _socketIo.default)();
70
+
71
+ if (socket) {
72
+ socket.on(`reload`, () => {
73
+ window.location.reload();
74
+ });
75
+ }
76
+
77
+ fetch(`/___services`).then(res => res.json()).then(services => {
78
+ if (services.developstatusserver) {
79
+ let isRestarting = false;
80
+ const parentSocket = (0, _socket.default)(`${window.location.protocol}//${window.location.hostname}:${services.developstatusserver.port}`);
81
+ parentSocket.on(`structured-log`, msg => {
82
+ if (!isRestarting && msg.type === `LOG_ACTION` && msg.action.type === `DEVELOP` && msg.action.payload === `RESTART_REQUIRED` && window.confirm(`The develop process needs to be restarted for the changes to ${msg.action.dirtyFile} to be applied.\nDo you want to restart the develop process now?`)) {
83
+ isRestarting = true;
84
+ parentSocket.emit(`develop:restart`, () => {
85
+ window.location.reload();
86
+ });
87
+ }
88
+
89
+ if (isRestarting && msg.type === `LOG_ACTION` && msg.action.type === `SET_STATUS` && msg.action.payload === `SUCCESS`) {
90
+ isRestarting = false;
91
+ window.location.reload();
92
+ }
93
+ }); // Prevents certain browsers spamming XHR 'ERR_CONNECTION_REFUSED'
94
+ // errors within the console, such as when exiting the develop process.
95
+
96
+ parentSocket.on(`disconnect`, () => {
97
+ console.warn(`[socket.io] Disconnected. Unable to perform health-check.`);
98
+ parentSocket.close();
99
+ });
100
+ }
101
+ });
102
+ /**
103
+ * Service Workers are persistent by nature. They stick around,
104
+ * serving a cached version of the site if they aren't removed.
105
+ * This is especially frustrating when you need to test the
106
+ * production build on your local machine.
107
+ *
108
+ * Let's warn if we find service workers in development.
109
+ */
110
+
111
+ if (`serviceWorker` in navigator) {
112
+ navigator.serviceWorker.getRegistrations().then(registrations => {
113
+ if (registrations.length > 0) console.warn(`Warning: found one or more service workers present.`, `If your site isn't behaving as expected, you might want to remove these.`, registrations);
114
+ });
115
+ }
116
+
117
+ const rootElement = document.getElementById(`___gatsby`);
118
+ const focusEl = document.getElementById(`gatsby-focus-wrapper`); // Client only pages have any empty body so we just do a normal
119
+ // render to avoid React complaining about hydration mis-matches.
120
+
121
+ let defaultRenderer = _reactDom.default.render;
122
+
123
+ if (focusEl && focusEl.children.length) {
124
+ if (_reactDom.default.hydrateRoot) {
125
+ defaultRenderer = _reactDom.default.hydrateRoot;
126
+ } else {
127
+ defaultRenderer = _reactDom.default.hydrate;
128
+ }
129
+ }
130
+
131
+ const renderer = (0, _apiRunnerBrowser.apiRunner)(`replaceHydrateFunction`, undefined, defaultRenderer)[0];
132
+ let dismissLoadingIndicator;
133
+
134
+ if (process.env.GATSBY_EXPERIMENTAL_QUERY_ON_DEMAND && process.env.GATSBY_QUERY_ON_DEMAND_LOADING_INDICATOR === `true`) {
135
+ let indicatorMountElement;
136
+ const showIndicatorTimeout = setTimeout(() => {
137
+ indicatorMountElement = document.createElement(`first-render-loading-indicator`);
138
+ document.body.append(indicatorMountElement);
139
+
140
+ _reactDom.default.render( /*#__PURE__*/_react.default.createElement(_indicator.Indicator, null), indicatorMountElement);
141
+ }, 1000);
142
+
143
+ dismissLoadingIndicator = () => {
144
+ clearTimeout(showIndicatorTimeout);
145
+
146
+ if (indicatorMountElement) {
147
+ _reactDom.default.unmountComponentAtNode(indicatorMountElement);
148
+
149
+ indicatorMountElement.remove();
150
+ }
151
+ };
152
+ }
153
+
154
+ Promise.all([loader.loadPage(`/dev-404-page/`), loader.loadPage(`/404.html`), loader.loadPage(window.location.pathname)]).then(() => {
155
+ (0, _navigation.init)();
156
+
157
+ function onHydrated() {
158
+ (0, _apiRunnerBrowser.apiRunner)(`onInitialClientRender`); // Render query on demand overlay
159
+
160
+ if (process.env.GATSBY_QUERY_ON_DEMAND_LOADING_INDICATOR && process.env.GATSBY_QUERY_ON_DEMAND_LOADING_INDICATOR === `true`) {
161
+ const indicatorMountElement = document.createElement(`div`);
162
+ indicatorMountElement.setAttribute(`id`, `query-on-demand-indicator-element`);
163
+ document.body.append(indicatorMountElement);
164
+
165
+ if (renderer === _reactDom.default.hydrateRoot) {
166
+ _reactDom.default.createRoot(indicatorMountElement).render( /*#__PURE__*/_react.default.createElement(_loadingIndicator.LoadingIndicatorEventHandler, null));
167
+ } else {
168
+ _reactDom.default.render( /*#__PURE__*/_react.default.createElement(_loadingIndicator.LoadingIndicatorEventHandler, null), indicatorMountElement);
169
+ }
170
+ }
171
+ }
172
+
173
+ function App() {
174
+ const onClientEntryRanRef = _react.default.useRef(false);
175
+
176
+ _react.default.useEffect(() => {
177
+ if (!onClientEntryRanRef.current) {
178
+ onClientEntryRanRef.current = true;
179
+ onHydrated();
180
+ }
181
+ }, []);
182
+
183
+ return /*#__PURE__*/_react.default.createElement(_root.default, null);
184
+ }
185
+
186
+ function runRender() {
187
+ if (dismissLoadingIndicator) {
188
+ dismissLoadingIndicator();
189
+ }
190
+
191
+ if (renderer === _reactDom.default.hydrateRoot) {
192
+ renderer(rootElement, /*#__PURE__*/_react.default.createElement(App, null));
193
+ } else {
194
+ renderer( /*#__PURE__*/_react.default.createElement(App, null), rootElement);
195
+ }
196
+ } // https://github.com/madrobby/zepto/blob/b5ed8d607f67724788ec9ff492be297f64d47dfc/src/zepto.js#L439-L450
197
+ // TODO remove IE 10 support
198
+
199
+
200
+ const doc = document;
201
+
202
+ if (doc.readyState === `complete` || doc.readyState !== `loading` && !doc.documentElement.doScroll) {
203
+ setTimeout(function () {
204
+ runRender();
205
+ }, 0);
206
+ } else {
207
+ const handler = function () {
208
+ doc.removeEventListener(`DOMContentLoaded`, handler, false);
209
+ window.removeEventListener(`load`, handler, false);
210
+ runRender();
211
+ };
212
+
213
+ doc.addEventListener(`DOMContentLoaded`, handler, false);
214
+ window.addEventListener(`load`, handler, false);
215
+ }
216
+ });
217
+ });
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.css = css;
5
+
6
+ /**
7
+ * Converts a string of CSS into object syntax
8
+ * @param strings
9
+ * @param keys
10
+ * @returns {Object} CSS in object syntax
11
+ * @example
12
+ * const output = css`
13
+ * html {
14
+ * color: rebeccapurple;
15
+ * }
16
+ * `
17
+ */
18
+ function css(strings, ...keys) {
19
+ const lastIndex = strings.length - 1;
20
+ return strings.slice(0, lastIndex).reduce((p, s, i) => p + s + keys[i], ``) + strings[lastIndex];
21
+ }