-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrender-page.js
9754 lines (8101 loc) · 378 KB
/
render-page.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("@reach/router"), require("core-js/modules/es6.array.find"), require("core-js/modules/es6.array.iterator"), require("core-js/modules/es6.array.sort"), require("core-js/modules/es6.function.name"), require("core-js/modules/es6.map"), require("core-js/modules/es6.object.assign"), require("core-js/modules/es6.object.to-string"), require("core-js/modules/es6.regexp.constructor"), require("core-js/modules/es6.regexp.match"), require("core-js/modules/es6.regexp.replace"), require("core-js/modules/es6.regexp.split"), require("core-js/modules/es6.regexp.to-string"), require("core-js/modules/es6.string.ends-with"), require("core-js/modules/es6.string.includes"), require("core-js/modules/es6.string.iterator"), require("core-js/modules/es6.string.link"), require("core-js/modules/es6.string.small"), require("core-js/modules/es7.array.includes"), require("core-js/modules/web.dom.iterable"), require("fs"), require("lodash"), require("minimatch"), require("path"), require("react"), require("react-dom/server"), require("react-helmet"));
else if(typeof define === 'function' && define.amd)
define("lib", ["@reach/router", "core-js/modules/es6.array.find", "core-js/modules/es6.array.iterator", "core-js/modules/es6.array.sort", "core-js/modules/es6.function.name", "core-js/modules/es6.map", "core-js/modules/es6.object.assign", "core-js/modules/es6.object.to-string", "core-js/modules/es6.regexp.constructor", "core-js/modules/es6.regexp.match", "core-js/modules/es6.regexp.replace", "core-js/modules/es6.regexp.split", "core-js/modules/es6.regexp.to-string", "core-js/modules/es6.string.ends-with", "core-js/modules/es6.string.includes", "core-js/modules/es6.string.iterator", "core-js/modules/es6.string.link", "core-js/modules/es6.string.small", "core-js/modules/es7.array.includes", "core-js/modules/web.dom.iterable", "fs", "lodash", "minimatch", "path", "react", "react-dom/server", "react-helmet"], factory);
else if(typeof exports === 'object')
exports["lib"] = factory(require("@reach/router"), require("core-js/modules/es6.array.find"), require("core-js/modules/es6.array.iterator"), require("core-js/modules/es6.array.sort"), require("core-js/modules/es6.function.name"), require("core-js/modules/es6.map"), require("core-js/modules/es6.object.assign"), require("core-js/modules/es6.object.to-string"), require("core-js/modules/es6.regexp.constructor"), require("core-js/modules/es6.regexp.match"), require("core-js/modules/es6.regexp.replace"), require("core-js/modules/es6.regexp.split"), require("core-js/modules/es6.regexp.to-string"), require("core-js/modules/es6.string.ends-with"), require("core-js/modules/es6.string.includes"), require("core-js/modules/es6.string.iterator"), require("core-js/modules/es6.string.link"), require("core-js/modules/es6.string.small"), require("core-js/modules/es7.array.includes"), require("core-js/modules/web.dom.iterable"), require("fs"), require("lodash"), require("minimatch"), require("path"), require("react"), require("react-dom/server"), require("react-helmet"));
else
root["lib"] = factory(root["@reach/router"], root["core-js/modules/es6.array.find"], root["core-js/modules/es6.array.iterator"], root["core-js/modules/es6.array.sort"], root["core-js/modules/es6.function.name"], root["core-js/modules/es6.map"], root["core-js/modules/es6.object.assign"], root["core-js/modules/es6.object.to-string"], root["core-js/modules/es6.regexp.constructor"], root["core-js/modules/es6.regexp.match"], root["core-js/modules/es6.regexp.replace"], root["core-js/modules/es6.regexp.split"], root["core-js/modules/es6.regexp.to-string"], root["core-js/modules/es6.string.ends-with"], root["core-js/modules/es6.string.includes"], root["core-js/modules/es6.string.iterator"], root["core-js/modules/es6.string.link"], root["core-js/modules/es6.string.small"], root["core-js/modules/es7.array.includes"], root["core-js/modules/web.dom.iterable"], root["fs"], root["lodash"], root["minimatch"], root["path"], root["react"], root["react-dom/server"], root["react-helmet"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE__reach_router__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_array_find__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_array_iterator__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_array_sort__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_function_name__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_map__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_object_assign__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_object_to_string__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_regexp_constructor__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_regexp_match__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_regexp_replace__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_regexp_split__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_regexp_to_string__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_string_ends_with__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_string_includes__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_string_iterator__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_string_link__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_string_small__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es7_array_includes__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_web_dom_iterable__, __WEBPACK_EXTERNAL_MODULE_fs__, __WEBPACK_EXTERNAL_MODULE_lodash__, __WEBPACK_EXTERNAL_MODULE_minimatch__, __WEBPACK_EXTERNAL_MODULE_path__, __WEBPACK_EXTERNAL_MODULE_react__, __WEBPACK_EXTERNAL_MODULE_react_dom_server__, __WEBPACK_EXTERNAL_MODULE_react_helmet__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "./.cache/static-entry.js");
/******/ })
/************************************************************************/
/******/ ({
/***/ "./.cache/api-runner-ssr.js":
/*!**********************************!*\
!*** ./.cache/api-runner-ssr.js ***!
\**********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var plugins = [{
plugin: __webpack_require__(/*! ./node_modules/gatsby-plugin-glamor/gatsby-ssr */ "./node_modules/gatsby-plugin-glamor/gatsby-ssr.js"),
options: {
"plugins": []
}
}, {
plugin: __webpack_require__(/*! ./plugins/gatsby-remark-header-custom-ids/gatsby-ssr */ "./plugins/gatsby-remark-header-custom-ids/gatsby-ssr.js"),
options: {
"plugins": []
}
}, {
plugin: __webpack_require__(/*! ./node_modules/gatsby-plugin-google-analytics/gatsby-ssr */ "./node_modules/gatsby-plugin-google-analytics/gatsby-ssr.js"),
options: {
"plugins": [],
"trackingId": "UA-41298772-1"
}
}, {
plugin: __webpack_require__(/*! ./node_modules/gatsby-plugin-react-helmet/gatsby-ssr */ "./node_modules/gatsby-plugin-react-helmet/gatsby-ssr.js"),
options: {
"plugins": []
}
}]; // During bootstrap, we write requires at top of this file which looks like:
// var plugins = [
// {
// plugin: require("/path/to/plugin1/gatsby-ssr.js"),
// options: { ... },
// },
// {
// plugin: require("/path/to/plugin2/gatsby-ssr.js"),
// options: { ... },
// },
// ]
var apis = __webpack_require__(/*! ./api-ssr-docs */ "./.cache/api-ssr-docs.js"); // Run the specified API in any plugins that have implemented it
module.exports = function (api, args, defaultReturn, argTransform) {
if (!apis[api]) {
console.log("This API doesn't exist", api);
} // Run each plugin in series.
// eslint-disable-next-line no-undef
var results = plugins.map(function (plugin) {
if (!plugin.plugin[api]) {
return undefined;
}
var result = plugin.plugin[api](args, plugin.options);
if (result && argTransform) {
args = argTransform({
args: args,
result: result
});
}
return result;
}); // Filter out undefined results.
results = results.filter(function (result) {
return typeof result !== "undefined";
});
if (results.length > 0) {
return results;
} else {
return [defaultReturn];
}
};
/***/ }),
/***/ "./.cache/api-ssr-docs.js":
/*!********************************!*\
!*** ./.cache/api-ssr-docs.js ***!
\********************************/
/*! no static exports found */
/***/ (function(module, exports) {
/**
* Replace the default server renderer. This is useful for integration with
* Redux, css-in-js libraries, etc. that need custom setups for server
* rendering.
* @param {Object} $0
* @param {function} $0.replaceBodyHTMLString Call this with the HTML string
* you render. **WARNING** if multiple plugins implement this API it's the
* last plugin that "wins". TODO implement an automated warning against this.
* @param {function} $0.setHeadComponents Takes an array of components as its
* first argument which are added to the `headComponents` array which is passed
* to the `html.js` component.
* @param {function} $0.setHtmlAttributes Takes an object of props which will
* spread into the `<html>` component.
* @param {function} $0.setBodyAttributes Takes an object of props which will
* spread into the `<body>` component.
* @param {function} $0.setPreBodyComponents Takes an array of components as its
* first argument which are added to the `preBodyComponents` array which is passed
* to the `html.js` component.
* @param {function} $0.setPostBodyComponents Takes an array of components as its
* first argument which are added to the `postBodyComponents` array which is passed
* to the `html.js` component.
* @param {function} $0.setBodyProps Takes an object of data which
* is merged with other body props and passed to `html.js` as `bodyProps`.
* @param {Object} pluginOptions
* @example
* // From gatsby-plugin-glamor
* const { renderToString } = require("react-dom/server")
* const inline = require("glamor-inline")
*
* exports.replaceRenderer = ({ bodyComponent, replaceBodyHTMLString }) => {
* const bodyHTML = renderToString(bodyComponent)
* const inlinedHTML = inline(bodyHTML)
*
* replaceBodyHTMLString(inlinedHTML)
* }
*/
exports.replaceRenderer = true;
/**
* Called after every page Gatsby server renders while building HTML so you can
* set head and body components to be rendered in your `html.js`.
*
* Gatsby does a two-pass render for HTML. It loops through your pages first
* rendering only the body and then takes the result body HTML string and
* passes it as the `body` prop to your `html.js` to complete the render.
*
* It's often handy to be able to send custom components to your `html.js`.
* For example, it's a very common pattern for React.js libraries that
* support server rendering to pull out data generated during the render to
* add to your HTML.
*
* Using this API over [`replaceRenderer`](#replaceRenderer) is preferable as
* multiple plugins can implement this API where only one plugin can take
* over server rendering. However, if your plugin requires taking over server
* rendering then that's the one to
* use
* @param {Object} $0
* @param {string} $0.pathname The pathname of the page currently being rendered.
* @param {function} $0.setHeadComponents Takes an array of components as its
* first argument which are added to the `headComponents` array which is passed
* to the `html.js` component.
* @param {function} $0.setHtmlAttributes Takes an object of props which will
* spread into the `<html>` component.
* @param {function} $0.setBodyAttributes Takes an object of props which will
* spread into the `<body>` component.
* @param {function} $0.setPreBodyComponents Takes an array of components as its
* first argument which are added to the `preBodyComponents` array which is passed
* to the `html.js` component.
* @param {function} $0.setPostBodyComponents Takes an array of components as its
* first argument which are added to the `postBodyComponents` array which is passed
* to the `html.js` component.
* @param {function} $0.setBodyProps Takes an object of data which
* is merged with other body props and passed to `html.js` as `bodyProps`.
* @param {Object} pluginOptions
* @example
* const { Helmet } = require("react-helmet")
*
* exports.onRenderBody = (
* { setHeadComponents, setHtmlAttributes, setBodyAttributes },
* pluginOptions
* ) => {
* const helmet = Helmet.renderStatic()
* setHtmlAttributes(helmet.htmlAttributes.toComponent())
* setBodyAttributes(helmet.bodyAttributes.toComponent())
* setHeadComponents([
* helmet.title.toComponent(),
* helmet.link.toComponent(),
* helmet.meta.toComponent(),
* helmet.noscript.toComponent(),
* helmet.script.toComponent(),
* helmet.style.toComponent(),
* ])
* }
*/
exports.onRenderBody = true;
/**
* Called after every page Gatsby server renders while building HTML so you can
* replace head components to be rendered in your `html.js`. This is useful if
* you need to reorder scripts or styles added by other plugins.
* @param {Object} $0
* @param {Array<ReactNode>} $0.getHeadComponents Returns the current `headComponents` array.
* @param {function} $0.replaceHeadComponents Takes an array of components as its
* first argument which replace the `headComponents` array which is passed
* to the `html.js` component. **WARNING** if multiple plugins implement this
* API it's the last plugin that "wins".
* @param {Array<ReactNode>} $0.getPreBodyComponents Returns the current `preBodyComponents` array.
* @param {function} $0.replacePreBodyComponents Takes an array of components as its
* first argument which replace the `preBodyComponents` array which is passed
* to the `html.js` component. **WARNING** if multiple plugins implement this
* API it's the last plugin that "wins".
* @param {Array<ReactNode>} $0.getPostBodyComponents Returns the current `postBodyComponents` array.
* @param {function} $0.replacePostBodyComponents Takes an array of components as its
* first argument which replace the `postBodyComponents` array which is passed
* to the `html.js` component. **WARNING** if multiple plugins implement this
* API it's the last plugin that "wins".
* @param {Object} pluginOptions
* @example
* // Move Typography.js styles to the top of the head section so they're loaded first.
* exports.onPreRenderHTML = ({ getHeadComponents, replaceHeadComponents }) => {
* const headComponents = getHeadComponents()
* headComponents.sort((x, y) => {
* if (x.key === 'TypographyStyle') {
* return -1
* } else if (y.key === 'TypographyStyle') {
* return 1
* }
* return 0
* })
* replaceHeadComponents(headComponents)
* }
*/
exports.onPreRenderHTML = true;
/**
* Allow a plugin to wrap the page element.
*
* This is useful for setting wrapper component around pages that won't get
* unmounted on page change. For setting Provider components use [wrapRootElement](#wrapRootElement).
*
* _Note:_ [There is equivalent hook in Browser API](/docs/browser-apis/#wrapPageElement)
* @param {object} $0
* @param {ReactNode} $0.element The "Page" React Element built by Gatsby.
* @param {object} $0.props Props object used by page.
* @example
* import React from "react"
* import Layout from "./src/components/layout"
*
* export const wrapPageElement = ({ element, props }) => {
* // props provide same data to Layout as Page element will get
* // including location, data, etc - you don't need to pass it
* return <Layout {...props}>{element}</Layout>
* }
*/
exports.wrapPageElement = true;
/**
* Allow a plugin to wrap the root element.
*
* This is useful to setup any Providers component that will wrap your application.
* For setting persistent UI elements around pages use [wrapPageElement](#wrapPageElement).
*
* _Note:_ [There is equivalent hook in Browser API](/docs/browser-apis/#wrapRootElement)
* @param {object} $0
* @param {ReactNode} $0.element The "Root" React Element built by Gatsby.
* @example
* import React from "react"
* import { Provider } from "react-redux"
*
* import createStore from "./src/state/createStore"
* const store = createStore()
*
* export const wrapRootElement = ({ element }) => {
* return (
* <Provider store={store}>
* {element}
* </Provider>
* )
* }
*/
exports.wrapRootElement = true;
/***/ }),
/***/ "./.cache/data.json":
/*!**************************!*\
!*** ./.cache/data.json ***!
\**************************/
/*! exports provided: pages, dataPaths, default */
/***/ (function(module) {
module.exports = {"pages":[{"componentChunkName":"component---src-pages-index-js","jsonName":"index","path":"/"},{"componentChunkName":"component---src-pages-404-js","jsonName":"404-html-516","path":"/404.html"},{"componentChunkName":"component---src-pages-404-js","jsonName":"404-22d","path":"/404/"},{"componentChunkName":"component---src-templates-docs-js","jsonName":"docs-advanced-plugin-apis-html-af8","path":"/docs/advanced-plugin-apis.html"},{"componentChunkName":"component---src-templates-docs-js","jsonName":"docs-bundling-contexts-html-7ab","path":"/docs/bundling-contexts.html"},{"componentChunkName":"component---src-templates-docs-js","jsonName":"docs-code-splitting-html-e39","path":"/docs/code-splitting.html"},{"componentChunkName":"component---src-templates-docs-js","jsonName":"docs-common-plugins-html-95d","path":"/docs/common-plugins.html"},{"componentChunkName":"component---src-templates-docs-js","jsonName":"docs-extended-configurations-html-b9b","path":"/docs/extended-configurations.html"},{"componentChunkName":"component---src-templates-docs-js","jsonName":"docs-getting-started-html-f09","path":"/docs/getting-started.html"},{"componentChunkName":"component---src-templates-docs-js","jsonName":"docs-inputs-html-893","path":"/docs/inputs.html"},{"componentChunkName":"component---src-templates-docs-js","jsonName":"docs-modes-html-959","path":"/docs/modes.html"},{"componentChunkName":"component---src-templates-docs-js","jsonName":"docs-output-formats-html-6e4","path":"/docs/output-formats.html"},{"componentChunkName":"component---src-templates-docs-js","jsonName":"docs-plugin-system-html-3f5","path":"/docs/plugin-system.html"},{"componentChunkName":"component---src-templates-docs-js","jsonName":"docs-roadmap-html-fe9","path":"/docs/roadmap.html"},{"componentChunkName":"component---src-templates-docs-js","jsonName":"docs-runtimes-html-678","path":"/docs/runtimes.html"},{"componentChunkName":"component---src-templates-docs-js","jsonName":"docs-the-module-graph-html-523","path":"/docs/the-module-graph.html"},{"componentChunkName":"component---src-pages-versions-js","jsonName":"versions-724","path":"/versions/"}],"dataPaths":{"404-22d":"820/path---404-22-d-bce-0SUcWyAf8ecbYDsMhQkEfPzV8","404-html-516":"285/path---404-html-516-62a-0SUcWyAf8ecbYDsMhQkEfPzV8","dev-404-page-5f9":"386/path---dev-404-page-5-f-9-fab-0SUcWyAf8ecbYDsMhQkEfPzV8","docs-advanced-plugin-apis-html-af8":"856/path---docs-advanced-plugin-apis-html-af-8-6d3-NCWehrpbuwnr7Nnh2fUyusI","docs-atomic-modules-html-c50":"255/path---docs-atomic-modules-html-c-50-6bb-ADbfxcMsXgS7HF83K6xdeXemRfY","docs-bundling-contexts-html-7ab":"467/path---docs-bundling-contexts-html-7-ab-f4a-48IfBZI8PtAygYU7mzLEtD8x0JI","docs-code-splitting-html-e39":"520/path---docs-code-splitting-html-e-39-59e-NRu9Husot0k9PtMVofL2NgB9sEY","docs-common-plugins-html-95d":"827/path---docs-common-plugins-html-95-d-ba0-vlWbnrZf7ZjmamWVpFqLLx04","docs-execution-contexts-html-493":"783/path---docs-execution-contexts-html-493-2cc-NoCtLVcy7wXFfanfGU5YHNoBpuk","docs-extended-configurations-html-b9b":"430/path---docs-extended-configurations-html-b-9-b-e8e-HydmRKUaBsUoSo4qLJYBI8KKa8Q","docs-getting-started-html-f09":"408/path---docs-getting-started-html-f-09-04d-VtNBKXLF2VEVFCAmW30kySslw","docs-inputs-html-893":"449/path---docs-inputs-html-893-796-0CQppbaINseAP14YVFnXxx5XH0","docs-mode-html-42f":"664/path---docs-mode-html-42-f-cc4-TVdqRn0QIQXkeO8Gr0BQS4AcjpE","docs-modes-html-83f":"892/path---docs-modes-html-83-f-8f5-bNNrrNsor1XLDjxp1eCoI533RE","docs-modes-html-959":"882/path---docs-modes-html-959-488-1DIusf0jSwqGMcFFVGm6fzk2Fo","docs-output-formats-html-6e4":"110/path---docs-output-formats-html-6-e-4-8a6-nrLMDk3fqRYNjM0UA9bM5CmsAM","docs-output-formats-html-d3c":"757/path---docs-output-formats-html-d-3-c-b50-44Oh0wSyKd9FwXggZEf6weIn2k","docs-plugin-system-html-3f5":"537/path---docs-plugin-system-html-3-f-5-48f-aklSe5kz4savy11SxrQ0M41vu2Y","docs-roadmap-html-fe9":"216/path---docs-roadmap-html-fe-9-800-QHQQsM2CN7gVD5ETn61KLiNLZSM","docs-runtimes-html-678":"567/path---docs-runtimes-html-678-0c2-Al2eyjhzw2KxiJg1FYXMnFWBM","docs-the-module-graph-html-523":"954/path---docs-the-module-graph-html-523-d78-SEkafD8IGX5HFTUlWdxPlE8de8","index":"609/path---index-6a9-U3uNTzcjtEeUDrFXBGzDWdSru2g","versions-724":"726/path---versions-724-e4e-0SUcWyAf8ecbYDsMhQkEfPzV8"}};
/***/ }),
/***/ "./.cache/default-html.js":
/*!********************************!*\
!*** ./.cache/default-html.js ***!
\********************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* WEBPACK VAR INJECTION */(function(Glamor) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return HTML; });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
function HTML(props) {
return Glamor.createElement("html", props.htmlAttributes, Glamor.createElement("head", null, Glamor.createElement("meta", {
charSet: "utf-8"
}), Glamor.createElement("meta", {
httpEquiv: "x-ua-compatible",
content: "ie=edge"
}), Glamor.createElement("meta", {
name: "viewport",
content: "width=device-width, initial-scale=1, shrink-to-fit=no"
}), props.headComponents), Glamor.createElement("body", props.bodyAttributes, props.preBodyComponents, Glamor.createElement("noscript", {
key: "noscript",
id: "gatsby-noscript"
}, "This app works best with JavaScript enabled."), Glamor.createElement("div", {
key: "body",
id: "___gatsby",
dangerouslySetInnerHTML: {
__html: props.body
}
}), props.postBodyComponents));
}
HTML.propTypes = {
htmlAttributes: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.object,
headComponents: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.array,
bodyAttributes: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.object,
preBodyComponents: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.array,
body: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
postBodyComponents: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.array
};
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! glamor/react */ "./node_modules/glamor/react.js")))
/***/ }),
/***/ "./.cache/gatsby-browser-entry.js":
/*!****************************************!*\
!*** ./.cache/gatsby-browser-entry.js ***!
\****************************************/
/*! exports provided: Link, withPrefix, graphql, parsePath, navigate, push, replace, navigateTo, StaticQueryContext, StaticQuery, PageRenderer, useStaticQuery */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* WEBPACK VAR INJECTION */(function(Glamor) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "graphql", function() { return graphql; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StaticQueryContext", function() { return StaticQueryContext; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StaticQuery", function() { return StaticQuery; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useStaticQuery", function() { return useStaticQuery; });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var gatsby_link__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! gatsby-link */ "./node_modules/gatsby-link/index.js");
/* harmony import */ var gatsby_link__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(gatsby_link__WEBPACK_IMPORTED_MODULE_2__);
/* harmony reexport (default from non-harmony) */ __webpack_require__.d(__webpack_exports__, "Link", function() { return gatsby_link__WEBPACK_IMPORTED_MODULE_2___default.a; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "withPrefix", function() { return gatsby_link__WEBPACK_IMPORTED_MODULE_2__["withPrefix"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "parsePath", function() { return gatsby_link__WEBPACK_IMPORTED_MODULE_2__["parsePath"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "navigate", function() { return gatsby_link__WEBPACK_IMPORTED_MODULE_2__["navigate"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "push", function() { return gatsby_link__WEBPACK_IMPORTED_MODULE_2__["push"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "replace", function() { return gatsby_link__WEBPACK_IMPORTED_MODULE_2__["replace"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "navigateTo", function() { return gatsby_link__WEBPACK_IMPORTED_MODULE_2__["navigateTo"]; });
/* harmony import */ var _public_page_renderer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./public-page-renderer */ "./.cache/public-page-renderer.js");
/* harmony import */ var _public_page_renderer__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_public_page_renderer__WEBPACK_IMPORTED_MODULE_3__);
/* harmony reexport (default from non-harmony) */ __webpack_require__.d(__webpack_exports__, "PageRenderer", function() { return _public_page_renderer__WEBPACK_IMPORTED_MODULE_3___default.a; });
var StaticQueryContext = react__WEBPACK_IMPORTED_MODULE_0___default.a.createContext({});
var StaticQuery = function StaticQuery(props) {
return Glamor.createElement(StaticQueryContext.Consumer, null, function (staticQueryData) {
if (props.data || staticQueryData[props.query] && staticQueryData[props.query].data) {
return (props.render || props.children)(props.data ? props.data.data : staticQueryData[props.query].data);
} else {
return Glamor.createElement("div", null, "Loading (StaticQuery)");
}
});
};
var useStaticQuery = function useStaticQuery(query) {
if (typeof react__WEBPACK_IMPORTED_MODULE_0___default.a.useContext !== "function" && "production" === "development") {
throw new Error("You're likely using a version of React that doesn't support Hooks\n" + "Please update React and ReactDOM to 16.8.0 or later to use the useStaticQuery hook.");
}
var context = react__WEBPACK_IMPORTED_MODULE_0___default.a.useContext(StaticQueryContext);
if (context[query] && context[query].data) {
return context[query].data;
} else {
throw new Error("The result of this StaticQuery could not be fetched.\n\n" + "This is likely a bug in Gatsby and if refreshing the page does not fix it, " + "please open an issue in https://github.com/gatsbyjs/gatsby/issues");
}
};
StaticQuery.propTypes = {
data: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.object,
query: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string.isRequired,
render: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.func,
children: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.func
};
function graphql() {
throw new Error("It appears like Gatsby is misconfigured. Gatsby related `graphql` calls " + "are supposed to only be evaluated at compile time, and then compiled away,. " + "Unfortunately, something went wrong and the query was left in the compiled code.\n\n." + "Unless your site has a complex or custom babel/Gatsby configuration this is likely a bug in Gatsby.");
}
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! glamor/react */ "./node_modules/glamor/react.js")))
/***/ }),
/***/ "./.cache/public-page-renderer.js":
/*!****************************************!*\
!*** ./.cache/public-page-renderer.js ***!
\****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var preferDefault = function preferDefault(m) {
return m && m.default || m;
};
if (false) {} else if (false) {} else {
module.exports = function () {
return null;
};
}
/***/ }),
/***/ "./.cache/static-entry.js":
/*!********************************!*\
!*** ./.cache/static-entry.js ***!
\********************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* WEBPACK VAR INJECTION */(function(Glamor) {/* harmony import */ var core_js_modules_es6_string_ends_with__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.string.ends-with */ "core-js/modules/es6.string.ends-with");
/* harmony import */ var core_js_modules_es6_string_ends_with__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_string_ends_with__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var core_js_modules_es6_function_name__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es6.function.name */ "core-js/modules/es6.function.name");
/* harmony import */ var core_js_modules_es6_function_name__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_function_name__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var core_js_modules_es6_array_sort__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es6.array.sort */ "core-js/modules/es6.array.sort");
/* harmony import */ var core_js_modules_es6_array_sort__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_array_sort__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var core_js_modules_es6_object_assign__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! core-js/modules/es6.object.assign */ "core-js/modules/es6.object.assign");
/* harmony import */ var core_js_modules_es6_object_assign__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_object_assign__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/inheritsLoose */ "./node_modules/@babel/runtime/helpers/inheritsLoose.js");
/* harmony import */ var _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var core_js_modules_es6_regexp_to_string__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! core-js/modules/es6.regexp.to-string */ "core-js/modules/es6.regexp.to-string");
/* harmony import */ var core_js_modules_es6_regexp_to_string__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_to_string__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var core_js_modules_es6_regexp_split__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! core-js/modules/es6.regexp.split */ "core-js/modules/es6.regexp.split");
/* harmony import */ var core_js_modules_es6_regexp_split__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_split__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var core_js_modules_es6_regexp_constructor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! core-js/modules/es6.regexp.constructor */ "core-js/modules/es6.regexp.constructor");
/* harmony import */ var core_js_modules_es6_regexp_constructor__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_constructor__WEBPACK_IMPORTED_MODULE_7__);
/* harmony import */ var core_js_modules_web_dom_iterable__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! core-js/modules/web.dom.iterable */ "core-js/modules/web.dom.iterable");
/* harmony import */ var core_js_modules_web_dom_iterable__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_iterable__WEBPACK_IMPORTED_MODULE_8__);
/* harmony import */ var core_js_modules_es6_array_iterator__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! core-js/modules/es6.array.iterator */ "core-js/modules/es6.array.iterator");
/* harmony import */ var core_js_modules_es6_array_iterator__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_array_iterator__WEBPACK_IMPORTED_MODULE_9__);
/* harmony import */ var core_js_modules_es6_object_to_string__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! core-js/modules/es6.object.to-string */ "core-js/modules/es6.object.to-string");
/* harmony import */ var core_js_modules_es6_object_to_string__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_object_to_string__WEBPACK_IMPORTED_MODULE_10__);
/* harmony import */ var core_js_modules_es6_string_iterator__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! core-js/modules/es6.string.iterator */ "core-js/modules/es6.string.iterator");
/* harmony import */ var core_js_modules_es6_string_iterator__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_string_iterator__WEBPACK_IMPORTED_MODULE_11__);
/* harmony import */ var core_js_modules_es6_map__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! core-js/modules/es6.map */ "core-js/modules/es6.map");
/* harmony import */ var core_js_modules_es6_map__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_map__WEBPACK_IMPORTED_MODULE_12__);
var React = __webpack_require__(/*! react */ "react");
var fs = __webpack_require__(/*! fs */ "fs");
var _require = __webpack_require__(/*! path */ "path"),
join = _require.join;
var _require2 = __webpack_require__(/*! react-dom/server */ "react-dom/server"),
renderToString = _require2.renderToString,
renderToStaticMarkup = _require2.renderToStaticMarkup;
var _require3 = __webpack_require__(/*! @reach/router */ "@reach/router"),
ServerLocation = _require3.ServerLocation,
Router = _require3.Router,
isRedirect = _require3.isRedirect;
var _require4 = __webpack_require__(/*! lodash */ "lodash"),
get = _require4.get,
merge = _require4.merge,
isObject = _require4.isObject,
flatten = _require4.flatten,
uniqBy = _require4.uniqBy;
var apiRunner = __webpack_require__(/*! ./api-runner-ssr */ "./.cache/api-runner-ssr.js");
var syncRequires = __webpack_require__(/*! ./sync-requires */ "./.cache/sync-requires.js");
var _require5 = __webpack_require__(/*! ./data.json */ "./.cache/data.json"),
dataPaths = _require5.dataPaths,
pages = _require5.pages;
var _require6 = __webpack_require__(/*! gatsby/package.json */ "./node_modules/gatsby/package.json"),
gatsbyVersion = _require6.version; // Speed up looking up pages.
var pagesObjectMap = new Map();
pages.forEach(function (p) {
return pagesObjectMap.set(p.path, p);
});
var stats = JSON.parse(fs.readFileSync(process.cwd() + "/public/webpack.stats.json", "utf-8"));
var chunkMapping = JSON.parse(fs.readFileSync(process.cwd() + "/public/chunk-map.json", "utf-8")); // const testRequireError = require("./test-require-error")
// For some extremely mysterious reason, webpack adds the above module *after*
// this module so that when this code runs, testRequireError is undefined.
// So in the meantime, we'll just inline it.
var testRequireError = function testRequireError(moduleName, err) {
var regex = new RegExp("Error: Cannot find module\\s." + moduleName);
var firstLine = err.toString().split("\n")[0];
return regex.test(firstLine);
};
var Html;
try {
Html = __webpack_require__(/*! ../src/html */ "./src/html.js");
} catch (err) {
if (testRequireError("../src/html", err)) {
Html = __webpack_require__(/*! ./default-html */ "./.cache/default-html.js");
} else {
throw err;
}
}
Html = Html && Html.__esModule ? Html.default : Html;
var getPage = function getPage(path) {
return pagesObjectMap.get(path);
};
var createElement = React.createElement;
var sanitizeComponents = function sanitizeComponents(components) {
if (Array.isArray(components)) {
// remove falsy items
return components.filter(function (val) {
return Array.isArray(val) ? val.length > 0 : val;
});
} else {
// we also accept single components, so we need to handle this case as well
return components ? [components] : [];
}
};
/* harmony default export */ __webpack_exports__["default"] = (function (pagePath, callback) {
var _postBodyComponents;
var bodyHtml = "";
var headComponents = [Glamor.createElement("meta", {
name: "generator",
content: "Gatsby " + gatsbyVersion,
key: "generator-" + gatsbyVersion
})];
var htmlAttributes = {};
var bodyAttributes = {};
var preBodyComponents = [];
var postBodyComponents = [];
var bodyProps = {};
var replaceBodyHTMLString = function replaceBodyHTMLString(body) {
bodyHtml = body;
};
var setHeadComponents = function setHeadComponents(components) {
headComponents = headComponents.concat(sanitizeComponents(components));
};
var setHtmlAttributes = function setHtmlAttributes(attributes) {
htmlAttributes = merge(htmlAttributes, attributes);
};
var setBodyAttributes = function setBodyAttributes(attributes) {
bodyAttributes = merge(bodyAttributes, attributes);
};
var setPreBodyComponents = function setPreBodyComponents(components) {
preBodyComponents = preBodyComponents.concat(sanitizeComponents(components));
};
var setPostBodyComponents = function setPostBodyComponents(components) {
postBodyComponents = postBodyComponents.concat(sanitizeComponents(components));
};
var setBodyProps = function setBodyProps(props) {
bodyProps = merge({}, bodyProps, props);
};
var getHeadComponents = function getHeadComponents() {
return headComponents;
};
var replaceHeadComponents = function replaceHeadComponents(components) {
headComponents = sanitizeComponents(components);
};
var getPreBodyComponents = function getPreBodyComponents() {
return preBodyComponents;
};
var replacePreBodyComponents = function replacePreBodyComponents(components) {
preBodyComponents = sanitizeComponents(components);
};
var getPostBodyComponents = function getPostBodyComponents() {
return postBodyComponents;
};
var replacePostBodyComponents = function replacePostBodyComponents(components) {
postBodyComponents = sanitizeComponents(components);
};
var page = getPage(pagePath);
var dataAndContext = {};
if (page.jsonName in dataPaths) {
var pathToJsonData = join(process.cwd(), "/public/static/d", dataPaths[page.jsonName] + ".json");
try {
dataAndContext = JSON.parse(fs.readFileSync(pathToJsonData));
} catch (e) {
console.log("error", pathToJsonData, e);
process.exit();
}
}
var RouteHandler =
/*#__PURE__*/
function (_React$Component) {
_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_4___default()(RouteHandler, _React$Component);
function RouteHandler() {
return _React$Component.apply(this, arguments) || this;
}
var _proto = RouteHandler.prototype;
_proto.render = function render() {
var props = Object.assign({}, this.props, dataAndContext, {
pathContext: dataAndContext.pageContext
});
var pageElement = createElement(syncRequires.components[page.componentChunkName], props);
var wrappedPage = apiRunner("wrapPageElement", {
element: pageElement,
props: props
}, pageElement, function (_ref) {
var result = _ref.result;
return {
element: result,
props: props
};
}).pop();
return wrappedPage;
};
return RouteHandler;
}(React.Component);
var routerElement = createElement(ServerLocation, {
url: "" + "" + pagePath
}, createElement(Router, {
baseuri: "" + ""
}, createElement(RouteHandler, {
path: "/*"
})));
var bodyComponent = apiRunner("wrapRootElement", {
element: routerElement,
pathname: pagePath
}, routerElement, function (_ref2) {
var result = _ref2.result;
return {
element: result,
pathname: pagePath
};
}).pop(); // Let the site or plugin render the page component.
apiRunner("replaceRenderer", {
bodyComponent: bodyComponent,
replaceBodyHTMLString: replaceBodyHTMLString,
setHeadComponents: setHeadComponents,
setHtmlAttributes: setHtmlAttributes,
setBodyAttributes: setBodyAttributes,
setPreBodyComponents: setPreBodyComponents,
setPostBodyComponents: setPostBodyComponents,
setBodyProps: setBodyProps,
pathname: pagePath,
pathPrefix: ""
}); // If no one stepped up, we'll handle it.
if (!bodyHtml) {
try {
bodyHtml = renderToString(bodyComponent);
} catch (e) {
// ignore @reach/router redirect errors
if (!isRedirect(e)) throw e;
}
} // Create paths to scripts
var scriptsAndStyles = flatten(["app", page.componentChunkName].map(function (s) {
var fetchKey = "assetsByChunkName[" + s + "]";
var chunks = get(stats, fetchKey);
var namedChunkGroups = get(stats, "namedChunkGroups");
if (!chunks) {
return null;
}
chunks = chunks.map(function (chunk) {
if (chunk === "/") {
return null;
}
return {
rel: "preload",
name: chunk
};
});
namedChunkGroups[s].assets.forEach(function (asset) {
return chunks.push({
rel: "preload",
name: asset
});
});
var childAssets = namedChunkGroups[s].childAssets;
var _loop = function _loop(rel) {
chunks = merge(chunks, childAssets[rel].map(function (chunk) {
return {
rel: rel,
name: chunk
};
}));
};
for (var rel in childAssets) {
_loop(rel);
}
return chunks;
})).filter(function (s) {
return isObject(s);
}).sort(function (s1, s2) {
return s1.rel == "preload" ? -1 : 1;
}); // given priority to preload
scriptsAndStyles = uniqBy(scriptsAndStyles, function (item) {
return item.name;
});
var scripts = scriptsAndStyles.filter(function (script) {
return script.name && script.name.endsWith(".js");
});
var styles = scriptsAndStyles.filter(function (style) {
return style.name && style.name.endsWith(".css");
});
apiRunner("onRenderBody", {
setHeadComponents: setHeadComponents,
setHtmlAttributes: setHtmlAttributes,
setBodyAttributes: setBodyAttributes,
setPreBodyComponents: setPreBodyComponents,
setPostBodyComponents: setPostBodyComponents,
setBodyProps: setBodyProps,
pathname: pagePath,
bodyHtml: bodyHtml,
scripts: scripts,
styles: styles,
pathPrefix: ""
});
scripts.slice(0).reverse().forEach(function (script) {
// Add preload/prefetch <link>s for scripts.
headComponents.push(Glamor.createElement("link", {
as: "script",
rel: script.rel,
key: script.name,
href: "" + "/" + script.name
}));
});
if (page.jsonName in dataPaths) {
var dataPath = "" + "/static/d/" + dataPaths[page.jsonName] + ".json";
headComponents.push(Glamor.createElement("link", {
as: "fetch",
rel: "preload",
key: dataPath,
href: dataPath,
crossOrigin: "use-credentials"
}));
}
styles.slice(0).reverse().forEach(function (style) {
// Add <link>s for styles that should be prefetched
// otherwise, inline as a <style> tag
if (style.rel === "prefetch") {
headComponents.push(Glamor.createElement("link", {
as: "style",
rel: style.rel,
key: style.name,
href: "" + "/" + style.name
}));
} else {
headComponents.unshift(Glamor.createElement("style", {
"data-href": "" + "/" + style.name,
dangerouslySetInnerHTML: {
__html: fs.readFileSync(join(process.cwd(), "public", style.name), "utf-8")
}
}));
}
}); // Add page metadata for the current page
var windowData = "/*<![CDATA[*/window.page=" + JSON.stringify(page) + ";" + (page.jsonName in dataPaths ? "window.dataPath=\"" + dataPaths[page.jsonName] + "\";" : "") + "/*]]>*/";
postBodyComponents.push(Glamor.createElement("script", {
key: "script-loader",
id: "gatsby-script-loader",
dangerouslySetInnerHTML: {
__html: windowData
}
})); // Add chunk mapping metadata
var scriptChunkMapping = "/*<![CDATA[*/window.___chunkMapping=" + JSON.stringify(chunkMapping) + ";/*]]>*/";
postBodyComponents.push(Glamor.createElement("script", {
key: "chunk-mapping",
id: "gatsby-chunk-mapping",
dangerouslySetInnerHTML: {
__html: scriptChunkMapping
}
})); // Filter out prefetched bundles as adding them as a script tag
// would force high priority fetching.
var bodyScripts = scripts.filter(function (s) {
return s.rel !== "prefetch";
}).map(function (s) {
var scriptPath = "" + "/" + JSON.stringify(s.name).slice(1, -1);
return Glamor.createElement("script", {
key: scriptPath,
src: scriptPath,
async: true
});
});
(_postBodyComponents = postBodyComponents).push.apply(_postBodyComponents, bodyScripts);
apiRunner("onPreRenderHTML", {
getHeadComponents: getHeadComponents,
replaceHeadComponents: replaceHeadComponents,
getPreBodyComponents: getPreBodyComponents,
replacePreBodyComponents: replacePreBodyComponents,
getPostBodyComponents: getPostBodyComponents,
replacePostBodyComponents: replacePostBodyComponents,
pathname: pagePath,
pathPrefix: ""
});
var html = "<!DOCTYPE html>" + renderToStaticMarkup(Glamor.createElement(Html, Object.assign({}, bodyProps, {
headComponents: headComponents,
htmlAttributes: htmlAttributes,
bodyAttributes: bodyAttributes,
preBodyComponents: preBodyComponents,
postBodyComponents: postBodyComponents,
body: bodyHtml,
path: pagePath
})));
callback(null, html);
});
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! glamor/react */ "./node_modules/glamor/react.js")))
/***/ }),
/***/ "./.cache/sync-requires.js":
/*!*********************************!*\
!*** ./.cache/sync-requires.js ***!
\*********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var _require = __webpack_require__(/*! react-hot-loader/root */ "./node_modules/react-hot-loader/root.js"),
hot = _require.hot; // prefer default export if available
var preferDefault = function preferDefault(m) {
return m && m.default || m;
};
exports.components = {
"component---src-templates-docs-js": hot(preferDefault(__webpack_require__(/*! ./src/templates/docs.js */ "./src/templates/docs.js"))),
"component---src-pages-404-js": hot(preferDefault(__webpack_require__(/*! ./src/pages/404.js */ "./src/pages/404.js"))),
"component---src-pages-index-js": hot(preferDefault(__webpack_require__(/*! ./src/pages/index.js */ "./src/pages/index.js"))),