@dr.pogodin/react-utils 1.21.0 → 1.21.2

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 (116) hide show
  1. package/build/development/client/index.js +0 -7
  2. package/build/development/client/index.js.map +1 -1
  3. package/build/development/client/init.js +3 -17
  4. package/build/development/client/init.js.map +1 -1
  5. package/build/development/index.js +0 -13
  6. package/build/development/index.js.map +1 -1
  7. package/build/development/server/Cache.js +2 -9
  8. package/build/development/server/Cache.js.map +1 -1
  9. package/build/development/server/index.js +7 -32
  10. package/build/development/server/index.js.map +1 -1
  11. package/build/development/server/renderer.js +24 -80
  12. package/build/development/server/renderer.js.map +1 -1
  13. package/build/development/server/server.js +21 -61
  14. package/build/development/server/server.js.map +1 -1
  15. package/build/development/server/utils/errors.js +2 -9
  16. package/build/development/server/utils/errors.js.map +1 -1
  17. package/build/development/server/utils/index.js +0 -4
  18. package/build/development/shared/components/Button/index.js +2 -13
  19. package/build/development/shared/components/Button/index.js.map +1 -1
  20. package/build/development/shared/components/Checkbox/index.js +2 -9
  21. package/build/development/shared/components/Checkbox/index.js.map +1 -1
  22. package/build/development/shared/components/CodeSplit/index.js +11 -22
  23. package/build/development/shared/components/CodeSplit/index.js.map +1 -1
  24. package/build/development/shared/components/Dropdown/index.js +0 -11
  25. package/build/development/shared/components/Dropdown/index.js.map +1 -1
  26. package/build/development/shared/components/GenericLink/index.js +3 -9
  27. package/build/development/shared/components/GenericLink/index.js.map +1 -1
  28. package/build/development/shared/components/Input/index.js +0 -7
  29. package/build/development/shared/components/Input/index.js.map +1 -1
  30. package/build/development/shared/components/Link.js +3 -6
  31. package/build/development/shared/components/Link.js.map +1 -1
  32. package/build/development/shared/components/MetaTags.js +1 -8
  33. package/build/development/shared/components/MetaTags.js.map +1 -1
  34. package/build/development/shared/components/Modal/index.js +2 -19
  35. package/build/development/shared/components/Modal/index.js.map +1 -1
  36. package/build/development/shared/components/NavLink.js +2 -6
  37. package/build/development/shared/components/NavLink.js.map +1 -1
  38. package/build/development/shared/components/PageLayout/index.js +0 -7
  39. package/build/development/shared/components/PageLayout/index.js.map +1 -1
  40. package/build/development/shared/components/ScalableRect/index.js +1 -6
  41. package/build/development/shared/components/ScalableRect/index.js.map +1 -1
  42. package/build/development/shared/components/Throbber/index.js +0 -9
  43. package/build/development/shared/components/Throbber/index.js.map +1 -1
  44. package/build/development/shared/components/WithTooltip/Tooltip.js +9 -28
  45. package/build/development/shared/components/WithTooltip/Tooltip.js.map +1 -1
  46. package/build/development/shared/components/WithTooltip/index.js +0 -16
  47. package/build/development/shared/components/WithTooltip/index.js.map +1 -1
  48. package/build/development/shared/components/YouTubeVideo/index.js +3 -11
  49. package/build/development/shared/components/YouTubeVideo/index.js.map +1 -1
  50. package/build/development/shared/components/index.js +0 -17
  51. package/build/development/shared/components/index.js.map +1 -1
  52. package/build/development/shared/utils/Barrier.js +1 -13
  53. package/build/development/shared/utils/Barrier.js.map +1 -1
  54. package/build/development/shared/utils/Emitter.js +4 -13
  55. package/build/development/shared/utils/Emitter.js.map +1 -1
  56. package/build/development/shared/utils/Semaphore.js +13 -19
  57. package/build/development/shared/utils/Semaphore.js.map +1 -1
  58. package/build/development/shared/utils/config.js +0 -5
  59. package/build/development/shared/utils/config.js.map +1 -1
  60. package/build/development/shared/utils/index.js +5 -26
  61. package/build/development/shared/utils/index.js.map +1 -1
  62. package/build/development/shared/utils/isomorphy.js +6 -12
  63. package/build/development/shared/utils/isomorphy.js.map +1 -1
  64. package/build/development/shared/utils/jest/E2eSsrEnv.js +20 -41
  65. package/build/development/shared/utils/jest/E2eSsrEnv.js.map +1 -1
  66. package/build/development/shared/utils/jest/index.js +10 -31
  67. package/build/development/shared/utils/jest/index.js.map +1 -1
  68. package/build/development/shared/utils/splitComponent.js +2 -5
  69. package/build/development/shared/utils/splitComponent.js.map +1 -1
  70. package/build/development/shared/utils/time.js +6 -15
  71. package/build/development/shared/utils/time.js.map +1 -1
  72. package/build/development/shared/utils/webpack.js +1 -5
  73. package/build/development/shared/utils/webpack.js.map +1 -1
  74. package/build/development/style.css +5 -24
  75. package/build/development/web.bundle.js +27 -27
  76. package/build/production/client/index.js.map +1 -1
  77. package/build/production/client/init.js.map +1 -1
  78. package/build/production/index.js.map +1 -1
  79. package/build/production/server/Cache.js.map +1 -1
  80. package/build/production/server/index.js.map +1 -1
  81. package/build/production/server/renderer.js.map +1 -1
  82. package/build/production/server/server.js.map +1 -1
  83. package/build/production/server/utils/errors.js.map +1 -1
  84. package/build/production/shared/components/Button/index.js.map +1 -1
  85. package/build/production/shared/components/Checkbox/index.js.map +1 -1
  86. package/build/production/shared/components/CodeSplit/index.js.map +1 -1
  87. package/build/production/shared/components/Dropdown/index.js.map +1 -1
  88. package/build/production/shared/components/GenericLink/index.js.map +1 -1
  89. package/build/production/shared/components/Input/index.js.map +1 -1
  90. package/build/production/shared/components/Link.js.map +1 -1
  91. package/build/production/shared/components/MetaTags.js.map +1 -1
  92. package/build/production/shared/components/Modal/index.js.map +1 -1
  93. package/build/production/shared/components/NavLink.js.map +1 -1
  94. package/build/production/shared/components/PageLayout/index.js.map +1 -1
  95. package/build/production/shared/components/ScalableRect/index.js.map +1 -1
  96. package/build/production/shared/components/Throbber/index.js.map +1 -1
  97. package/build/production/shared/components/WithTooltip/Tooltip.js.map +1 -1
  98. package/build/production/shared/components/WithTooltip/index.js.map +1 -1
  99. package/build/production/shared/components/YouTubeVideo/index.js.map +1 -1
  100. package/build/production/shared/components/index.js.map +1 -1
  101. package/build/production/shared/utils/Barrier.js.map +1 -1
  102. package/build/production/shared/utils/Emitter.js.map +1 -1
  103. package/build/production/shared/utils/Semaphore.js.map +1 -1
  104. package/build/production/shared/utils/config.js.map +1 -1
  105. package/build/production/shared/utils/index.js.map +1 -1
  106. package/build/production/shared/utils/isomorphy.js.map +1 -1
  107. package/build/production/shared/utils/jest/E2eSsrEnv.js.map +1 -1
  108. package/build/production/shared/utils/jest/index.js.map +1 -1
  109. package/build/production/shared/utils/splitComponent.js.map +1 -1
  110. package/build/production/shared/utils/time.js.map +1 -1
  111. package/build/production/shared/utils/webpack.js.map +1 -1
  112. package/build/production/style.css +1 -1
  113. package/build/production/style.css.map +1 -1
  114. package/build/production/web.bundle.js.map +1 -1
  115. package/config/babel/node-ssr.js +1 -1
  116. package/package.json +26 -26
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = Launch;
7
-
8
7
  var _reactGlobalState = require("@dr.pogodin/react-global-state");
9
-
10
8
  var _client = require("react-dom/client");
11
-
12
9
  var _reactRouterDom = require("react-router-dom");
13
-
14
10
  var _jsxRuntime = require("react/jsx-runtime");
15
-
16
11
  // Initialization of client-side code.
17
-
18
12
  /* global document, window */
19
13
 
20
14
  /**
@@ -31,7 +25,6 @@ function Launch(Application) {
31
25
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Application, {})
32
26
  })
33
27
  });
34
-
35
28
  if (options.dontHydrate) {
36
29
  const root = (0, _client.createRoot)(container);
37
30
  root.render(scene);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Launch","Application","options","container","document","getElementById","scene","window","ISTATE","dontHydrate","root","createRoot","render","hydrateRoot"],"sources":["../../../src/client/index.jsx"],"sourcesContent":["// Initialization of client-side code.\n/* global document, window */\n\nimport { GlobalStateProvider } from '@dr.pogodin/react-global-state';\n\nimport { createRoot, hydrateRoot } from 'react-dom/client';\nimport { BrowserRouter } from 'react-router-dom';\n\n/**\n * Prepares and launches the app at client side.\n * @param {object} Application Root application component\n * @param {object} [options={}] Optional. Additional settings.\n */\nexport default function Launch(Application, options = {}) {\n const container = document.getElementById('react-view');\n const scene = (\n <GlobalStateProvider initialState={window.ISTATE}>\n <BrowserRouter>\n <Application />\n </BrowserRouter>\n </GlobalStateProvider>\n );\n\n if (options.dontHydrate) {\n const root = createRoot(container);\n root.render(scene);\n } else hydrateRoot(container, scene);\n}\n"],"mappings":";;;;;;;AAGA;;AAEA;;AACA;;;;AANA;;AACA;;AAOA;AACA;AACA;AACA;AACA;AACe,SAASA,MAAT,CAAgBC,WAAhB,EAA2C;EAAA,IAAdC,OAAc,uEAAJ,EAAI;EACxD,MAAMC,SAAS,GAAGC,QAAQ,CAACC,cAAT,CAAwB,YAAxB,CAAlB;EACA,MAAMC,KAAK,gBACT,qBAAC,qCAAD;IAAqB,YAAY,EAAEC,MAAM,CAACC,MAA1C;IAAA,uBACE,qBAAC,6BAAD;MAAA,uBACE,qBAAC,WAAD;IADF;EADF,EADF;;EAQA,IAAIN,OAAO,CAACO,WAAZ,EAAyB;IACvB,MAAMC,IAAI,GAAG,IAAAC,kBAAA,EAAWR,SAAX,CAAb;IACAO,IAAI,CAACE,MAAL,CAAYN,KAAZ;EACD,CAHD,MAGO,IAAAO,mBAAA,EAAYV,SAAZ,EAAuBG,KAAvB;AACR"}
1
+ {"version":3,"file":"index.js","names":["Launch","Application","options","container","document","getElementById","scene","window","ISTATE","dontHydrate","root","createRoot","render","hydrateRoot"],"sources":["../../../src/client/index.jsx"],"sourcesContent":["// Initialization of client-side code.\n/* global document, window */\n\nimport { GlobalStateProvider } from '@dr.pogodin/react-global-state';\n\nimport { createRoot, hydrateRoot } from 'react-dom/client';\nimport { BrowserRouter } from 'react-router-dom';\n\n/**\n * Prepares and launches the app at client side.\n * @param {object} Application Root application component\n * @param {object} [options={}] Optional. Additional settings.\n */\nexport default function Launch(Application, options = {}) {\n const container = document.getElementById('react-view');\n const scene = (\n <GlobalStateProvider initialState={window.ISTATE}>\n <BrowserRouter>\n <Application />\n </BrowserRouter>\n </GlobalStateProvider>\n );\n\n if (options.dontHydrate) {\n const root = createRoot(container);\n root.render(scene);\n } else hydrateRoot(container, scene);\n}\n"],"mappings":";;;;;;AAGA;AAEA;AACA;AAAiD;AANjD;AACA;;AAOA;AACA;AACA;AACA;AACA;AACe,SAASA,MAAM,CAACC,WAAW,EAAgB;EAAA,IAAdC,OAAO,uEAAG,CAAC,CAAC;EACtD,MAAMC,SAAS,GAAGC,QAAQ,CAACC,cAAc,CAAC,YAAY,CAAC;EACvD,MAAMC,KAAK,gBACT,qBAAC,qCAAmB;IAAC,YAAY,EAAEC,MAAM,CAACC,MAAO;IAAA,uBAC/C,qBAAC,6BAAa;MAAA,uBACZ,qBAAC,WAAW;IAAG;EACD,EAEnB;EAED,IAAIN,OAAO,CAACO,WAAW,EAAE;IACvB,MAAMC,IAAI,GAAG,IAAAC,kBAAU,EAACR,SAAS,CAAC;IAClCO,IAAI,CAACE,MAAM,CAACN,KAAK,CAAC;EACpB,CAAC,MAAM,IAAAO,mBAAW,EAACV,SAAS,EAAEG,KAAK,CAAC;AACtC"}
@@ -1,18 +1,15 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  var _cookie = _interopRequireDefault(require("cookie"));
6
-
7
5
  var _forge = _interopRequireDefault(require("node-forge/lib/forge"));
8
-
9
6
  require("node-forge/lib/aes");
10
-
11
7
  /**
12
8
  * Initialization of client-side environment.
13
9
  */
14
10
 
15
11
  /* global BUILD_INFO, document, window */
12
+
16
13
  // Note: this way, only required part of "node-forge": AES, and some utils,
17
14
  // is bundled into client-side code.
18
15
 
@@ -21,28 +18,23 @@ require("node-forge/lib/aes");
21
18
  if (typeof BUILD_INFO !== 'undefined') {
22
19
  window.TRU_BUILD_INFO = BUILD_INFO;
23
20
  }
21
+
24
22
  /* Removes data injection script out of the document.
25
23
  * The if block is here for test purposes. */
26
-
27
-
28
24
  if (!window.TRU_KEEP_INJ_SCRIPT) {
29
25
  const block = document.querySelector('script[id="inj"]');
30
26
  if (block) document.getElementsByTagName('body')[0].removeChild(block);
31
27
  }
32
- /* TODO: A proper logger should be moved to `@dr.pogodin/react-utils`. */
33
28
 
29
+ /* TODO: A proper logger should be moved to `@dr.pogodin/react-utils`. */
34
30
  /* eslint-disable no-console */
35
-
36
-
37
31
  const {
38
32
  useServiceWorker
39
33
  } = window.TRU_BUILD_INFO;
40
-
41
34
  if (useServiceWorker) {
42
35
  const {
43
36
  navigator
44
37
  } = window;
45
-
46
38
  if ('serviceWorker' in navigator) {
47
39
  window.addEventListener('load', async () => {
48
40
  try {
@@ -61,17 +53,12 @@ if (useServiceWorker) {
61
53
  /* eslint-enable no-console */
62
54
 
63
55
  /* Decodes data injected at the server side. */
64
-
65
-
66
56
  if (window.INJ) {
67
57
  const {
68
58
  key
69
59
  } = window.TRU_BUILD_INFO;
70
-
71
60
  let data = _forge.default.util.decode64(window.INJ);
72
-
73
61
  const decipher = _forge.default.cipher.createDecipher('AES-CBC', key);
74
-
75
62
  decipher.start({
76
63
  iv: data.slice(0, 32)
77
64
  });
@@ -89,6 +76,5 @@ if (window.INJ) {
89
76
  window.CHUNK_GROUPS = {};
90
77
  window.CONFIG = {};
91
78
  }
92
-
93
79
  window.CONFIG.CSRF = _cookie.default.parse(document.cookie).csrfToken;
94
80
  //# sourceMappingURL=init.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"init.js","names":["BUILD_INFO","window","TRU_BUILD_INFO","TRU_KEEP_INJ_SCRIPT","block","document","querySelector","getElementsByTagName","removeChild","useServiceWorker","navigator","addEventListener","reg","serviceWorker","register","console","log","err","INJ","key","data","forge","util","decode64","decipher","cipher","createDecipher","start","iv","slice","update","createBuffer","finish","decodeUtf8","output","eval","CHUNK_GROUPS","CONFIG","ISTATE","CSRF","cookie","parse","csrfToken"],"sources":["../../../src/client/init.js"],"sourcesContent":["/**\n * Initialization of client-side environment.\n */\n\n/* global BUILD_INFO, document, window */\n\nimport cookie from 'cookie';\n\n// Note: this way, only required part of \"node-forge\": AES, and some utils,\n// is bundled into client-side code.\nimport forge from 'node-forge/lib/forge';\nimport 'node-forge/lib/aes';\n\n/* `BUILD_INFO` is always injected by Webpack build, but this check is needed\n * to adopt the code for usage in tests. */\nif (typeof BUILD_INFO !== 'undefined') {\n window.TRU_BUILD_INFO = BUILD_INFO;\n}\n\n/* Removes data injection script out of the document.\n * The if block is here for test purposes. */\nif (!window.TRU_KEEP_INJ_SCRIPT) {\n const block = document.querySelector('script[id=\"inj\"]');\n if (block) document.getElementsByTagName('body')[0].removeChild(block);\n}\n\n/* TODO: A proper logger should be moved to `@dr.pogodin/react-utils`. */\n/* eslint-disable no-console */\nconst { useServiceWorker } = window.TRU_BUILD_INFO;\nif (useServiceWorker) {\n const { navigator } = window;\n if ('serviceWorker' in navigator) {\n window.addEventListener('load', async () => {\n try {\n // Note: no matter the \"publicPath\", we want to serve the service worker\n // from the web app root, to allow it control any and all pages of the\n // web app (otherwise, it will be restricted to the scope of its path).\n // The server takes it into account.\n const reg = await navigator\n .serviceWorker.register('/__service-worker.js');\n console.log('SW registered:', reg);\n } catch (err) {\n console.log('SW registration failed:', err);\n }\n });\n }\n}\n/* eslint-enable no-console */\n\n/* Decodes data injected at the server side. */\nif (window.INJ) {\n const { key } = window.TRU_BUILD_INFO;\n let data = forge.util.decode64(window.INJ);\n const decipher = forge.cipher.createDecipher('AES-CBC', key);\n decipher.start({ iv: data.slice(0, 32) });\n decipher.update(forge.util.createBuffer(data.slice(32)));\n decipher.finish();\n\n data = forge.util.decodeUtf8(decipher.output.data);\n data = eval(`(${data})`); // eslint-disable-line no-eval\n\n window.CHUNK_GROUPS = data.CHUNK_GROUPS;\n window.CONFIG = data.CONFIG;\n window.ISTATE = data.ISTATE;\n} else {\n // This is possible when the client-side bundle is launched as a stand-alone\n // precompiled website, rather than served by react-utils' based server.\n window.CHUNK_GROUPS = {};\n window.CONFIG = {};\n}\n\nwindow.CONFIG.CSRF = cookie.parse(document.cookie).csrfToken;\n"],"mappings":";;;;AAMA;;AAIA;;AACA;;AAXA;AACA;AACA;;AAEA;AAIA;AACA;;AAIA;AACA;AACA,IAAI,OAAOA,UAAP,KAAsB,WAA1B,EAAuC;EACrCC,MAAM,CAACC,cAAP,GAAwBF,UAAxB;AACD;AAED;AACA;;;AACA,IAAI,CAACC,MAAM,CAACE,mBAAZ,EAAiC;EAC/B,MAAM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AZ,IAAI,GAAGC,cAAA,CAAMC,IAAN,CAAWW,UAAX,CAAsBT,QAAQ,CAACU,MAAT,CAAgBd,IAAtC,CAAP;EACAA,IAAI,GAAGe,IAAI,CAAE,IAAGf,IAAK,GAAV,CAAX,CATc,CASY;;EAE1BnB,MAAM,CAACmC,YAAP,GAAsBhB,IAAI,CAACgB,YAA3B;EACAnC,MAAM,CAACoC,MAAP,GAAgBjB,IAAI,CAACiB,MAArB;EACApC,MAAM,CAACqC,MAAP,GAAgBlB,IAAI,CAACkB,MAArB;AACD,CAdD,MAcO;EACL;EACA;EACArC,MAAM,CAACmC,YAAP,GAAsB,EAAtB;EACAnC,MAAM,CAACoC,MAAP,GAAgB,EAAhB;AACD;;AAEDpC,MAAM,CAACoC,MAAP,CAAcE,IAAd,GAAqBC,eAAA,CAAOC,KAAP,CAAapC,QAAQ,CAACmC,MAAtB,EAA8BE,SAAnD"}
1
+ {"version":3,"file":"init.js","names":["BUILD_INFO","window","TRU_BUILD_INFO","TRU_KEEP_INJ_SCRIPT","block","document","querySelector","getElementsByTagName","removeChild","useServiceWorker","navigator","addEventListener","reg","serviceWorker","register","console","log","err","INJ","key","data","forge","util","decode64","decipher","cipher","createDecipher","start","iv","slice","update","createBuffer","finish","decodeUtf8","output","eval","CHUNK_GROUPS","CONFIG","ISTATE","CSRF","cookie","parse","csrfToken"],"sources":["../../../src/client/init.js"],"sourcesContent":["/**\n * Initialization of client-side environment.\n */\n\n/* global BUILD_INFO, document, window */\n\nimport cookie from 'cookie';\n\n// Note: this way, only required part of \"node-forge\": AES, and some utils,\n// is bundled into client-side code.\nimport forge from 'node-forge/lib/forge';\nimport 'node-forge/lib/aes';\n\n/* `BUILD_INFO` is always injected by Webpack build, but this check is needed\n * to adopt the code for usage in tests. */\nif (typeof BUILD_INFO !== 'undefined') {\n window.TRU_BUILD_INFO = BUILD_INFO;\n}\n\n/* Removes data injection script out of the document.\n * The if block is here for test purposes. */\nif (!window.TRU_KEEP_INJ_SCRIPT) {\n const block = document.querySelector('script[id=\"inj\"]');\n if (block) document.getElementsByTagName('body')[0].removeChild(block);\n}\n\n/* TODO: A proper logger should be moved to `@dr.pogodin/react-utils`. */\n/* eslint-disable no-console */\nconst { useServiceWorker } = window.TRU_BUILD_INFO;\nif (useServiceWorker) {\n const { navigator } = window;\n if ('serviceWorker' in navigator) {\n window.addEventListener('load', async () => {\n try {\n // Note: no matter the \"publicPath\", we want to serve the service worker\n // from the web app root, to allow it control any and all pages of the\n // web app (otherwise, it will be restricted to the scope of its path).\n // The server takes it into account.\n const reg = await navigator\n .serviceWorker.register('/__service-worker.js');\n console.log('SW registered:', reg);\n } catch (err) {\n console.log('SW registration failed:', err);\n }\n });\n }\n}\n/* eslint-enable no-console */\n\n/* Decodes data injected at the server side. */\nif (window.INJ) {\n const { key } = window.TRU_BUILD_INFO;\n let data = forge.util.decode64(window.INJ);\n const decipher = forge.cipher.createDecipher('AES-CBC', key);\n decipher.start({ iv: data.slice(0, 32) });\n decipher.update(forge.util.createBuffer(data.slice(32)));\n decipher.finish();\n\n data = forge.util.decodeUtf8(decipher.output.data);\n data = eval(`(${data})`); // eslint-disable-line no-eval\n\n window.CHUNK_GROUPS = data.CHUNK_GROUPS;\n window.CONFIG = data.CONFIG;\n window.ISTATE = data.ISTATE;\n} else {\n // This is possible when the client-side bundle is launched as a stand-alone\n // precompiled website, rather than served by react-utils' based server.\n window.CHUNK_GROUPS = {};\n window.CONFIG = {};\n}\n\nwindow.CONFIG.CSRF = cookie.parse(document.cookie).csrfToken;\n"],"mappings":";;;AAMA;AAIA;AACA;AAXA;AACA;AACA;;AAEA;;AAIA;AACA;;AAIA;AACA;AACA,IAAI,OAAOA,UAAU,KAAK,WAAW,EAAE;EACrCC,MAAM,CAACC,cAAc,GAAGF,UAAU;AACpC;;AAEA;AACA;AACA,IAAI,CAACC,MAAM,CAACE,mBAAmB,EAAE;EAC/B,MAAMC,KAAK,GAAGC,QAAQ,CAACC,aAAa,CAAC,kBAAkB,CAAC;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C,cAAK,CAACC,IAAI,CAACW,UAAU,CAACT,QAAQ,CAACU,MAAM,CAACd,IAAI,CAAC;EAClDA,IAAI,GAAGe,IAAI,CAAE,IAAGf,IAAK,GAAE,CAAC,CAAC,CAAC;;EAE1BnB,MAAM,CAACmC,YAAY,GAAGhB,IAAI,CAACgB,YAAY;EACvCnC,MAAM,CAACoC,MAAM,GAAGjB,IAAI,CAACiB,MAAM;EAC3BpC,MAAM,CAACqC,MAAM,GAAGlB,IAAI,CAACkB,MAAM;AAC7B,CAAC,MAAM;EACL;EACA;EACArC,MAAM,CAACmC,YAAY,GAAG,CAAC,CAAC;EACxBnC,MAAM,CAACoC,MAAM,GAAG,CAAC,CAAC;AACpB;AAEApC,MAAM,CAACoC,MAAM,CAACE,IAAI,GAAGC,eAAM,CAACC,KAAK,CAACpC,QAAQ,CAACmC,MAAM,CAAC,CAACE,SAAS"}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
@@ -60,9 +59,7 @@ Object.defineProperty(exports, "useGlobalState", {
60
59
  return _reactGlobalState.useGlobalState;
61
60
  }
62
61
  });
63
-
64
62
  var _utils = require("./shared/utils");
65
-
66
63
  Object.keys(_utils).forEach(function (key) {
67
64
  if (key === "default" || key === "__esModule") return;
68
65
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -74,17 +71,11 @@ Object.keys(_utils).forEach(function (key) {
74
71
  }
75
72
  });
76
73
  });
77
-
78
74
  var _axios = _interopRequireDefault(require("axios"));
79
-
80
75
  var _PT = _interopRequireWildcard(require("prop-types"));
81
-
82
76
  exports.PT = _PT;
83
-
84
77
  var _reactGlobalState = require("@dr.pogodin/react-global-state");
85
-
86
78
  var _components = require("./shared/components");
87
-
88
79
  Object.keys(_components).forEach(function (key) {
89
80
  if (key === "default" || key === "__esModule") return;
90
81
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -96,12 +87,8 @@ Object.keys(_components).forEach(function (key) {
96
87
  }
97
88
  });
98
89
  });
99
-
100
90
  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); }
101
-
102
91
  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; }
103
-
104
92
  const server = _utils.webpack.requireWeak("./server", __dirname);
105
-
106
93
  exports.server = server;
107
94
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["server","webpack","requireWeak","__dirname"],"sources":["../../src/index.js"],"sourcesContent":["import 'styles/global.scss';\n\nimport { webpack } from 'utils';\n\nconst server = webpack.requireWeak('./server', __dirname);\n\nexport { default as api } from 'axios';\nexport * as PT from 'prop-types';\n\nexport {\n getGlobalState,\n getSsrContext,\n GlobalStateProvider,\n useAsyncCollection,\n useAsyncData,\n useGlobalState,\n} from '@dr.pogodin/react-global-state';\n\nexport * from 'components';\nexport * from 'utils';\n\nexport { server };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;AAiBA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AAbA;;;;;;AAGA;;AASA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;;;;;AAdA,MAAMA,MAAM,GAAGC,cAAA,CAAQC,WAAR,aAAgCC,SAAhC,CAAf"}
1
+ {"version":3,"file":"index.js","names":["server","webpack","requireWeak","__dirname"],"sources":["../../src/index.js"],"sourcesContent":["import 'styles/global.scss';\n\nimport { webpack } from 'utils';\n\nconst server = webpack.requireWeak('./server', __dirname);\n\nexport { default as api } from 'axios';\nexport * as PT from 'prop-types';\n\nexport {\n getGlobalState,\n getSsrContext,\n GlobalStateProvider,\n useAsyncCollection,\n useAsyncData,\n useGlobalState,\n} from '@dr.pogodin/react-global-state';\n\nexport * from 'components';\nexport * from 'utils';\n\nexport { server };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AAiBA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAbA;AAAuC;AAAA;AAGvC;AASA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAA2B;AAAA;AAd3B,MAAMA,MAAM,GAAGC,cAAO,CAACC,WAAW,aAAaC,SAAS,CAAC;AAAC"}
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  /**
9
8
  * Implements the static cache.
10
9
  * @ignore
@@ -17,6 +16,7 @@ class Cache {
17
16
  size: 0
18
17
  };
19
18
  }
19
+
20
20
  /**
21
21
  * Cache lookup.
22
22
  * @ignore
@@ -26,8 +26,6 @@ class Cache {
26
26
  * @returns {string} Cached item, or null if the item is absent in cache,
27
27
  * or stale.
28
28
  */
29
-
30
-
31
29
  get({
32
30
  key,
33
31
  maxage = Number.MAX_VALUE
@@ -35,14 +33,13 @@ class Cache {
35
33
  const item = this.private.items[key];
36
34
  return item && Date.now() - item.timestamp < maxage ? item.data : null;
37
35
  }
36
+
38
37
  /**
39
38
  * Adds item to cache.
40
39
  * @ignore
41
40
  * @param {string} data Item to add.
42
41
  * @param {string} key Key to store the item at.
43
42
  */
44
-
45
-
46
43
  add(data, key) {
47
44
  const p = this.private;
48
45
  const old = p.items[key];
@@ -52,11 +49,9 @@ class Cache {
52
49
  timestamp: Date.now()
53
50
  };
54
51
  p.size += data.length;
55
-
56
52
  if (p.size > p.maxSize) {
57
53
  const items = Object.entries(p.items);
58
54
  items.sort((a, b) => a[1].timestamp - b[1].timestamp);
59
-
60
55
  for (let i = 0; i < items.length; ++i) {
61
56
  const item = items[i];
62
57
  delete p.items[item[0]];
@@ -65,8 +60,6 @@ class Cache {
65
60
  }
66
61
  }
67
62
  }
68
-
69
63
  }
70
-
71
64
  exports.default = Cache;
72
65
  //# sourceMappingURL=Cache.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Cache.js","names":["Cache","constructor","maxSize","private","items","size","get","key","maxage","Number","MAX_VALUE","item","Date","now","timestamp","data","add","p","old","length","Object","entries","sort","a","b","i"],"sources":["../../../src/server/Cache.js"],"sourcesContent":["/**\n * Implements the static cache.\n * @ignore\n */\nexport default class Cache {\n constructor(maxSize) {\n this.private = {\n items: {},\n maxSize,\n size: 0,\n };\n }\n\n /**\n * Cache lookup.\n * @ignore\n * @param {string} key Item key to look for.\n * @param {number} [maxage=Number.MAX_VALUE] Optional. The maximum age of\n * cached item to serve. Default to infinite.\n * @returns {string} Cached item, or null if the item is absent in cache,\n * or stale.\n */\n get({ key, maxage = Number.MAX_VALUE }) {\n const item = this.private.items[key];\n return item && Date.now() - item.timestamp < maxage ? item.data : null;\n }\n\n /**\n * Adds item to cache.\n * @ignore\n * @param {string} data Item to add.\n * @param {string} key Key to store the item at.\n */\n add(data, key) {\n const p = this.private;\n const old = p.items[key];\n if (old) p.size -= old.data.length;\n p.items[key] = { data, timestamp: Date.now() };\n p.size += data.length;\n if (p.size > p.maxSize) {\n const items = Object.entries(p.items);\n items.sort((a, b) => a[1].timestamp - b[1].timestamp);\n for (let i = 0; i < items.length; ++i) {\n const item = items[i];\n delete p.items[item[0]];\n p.size -= item[1].data.length;\n if (p.size < p.maxSize / 2) break;\n }\n }\n }\n}\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACe,MAAMA,KAAN,CAAY;EACzBC,WAAW,CAACC,OAAD,EAAU;IACnB,KAAKC,OAAL,GAAe;MACbC,KAAK,EAAE,EADM;MAEbF,OAFa;MAGbG,IAAI,EAAE;IAHO,CAAf;EAKD;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;EACEC,GAAG,CAAC;IAAEC,GAAF;IAAOC,MAAM,GAAGC,MAAM,CAACC;EAAvB,CAAD,EAAqC;IACtC,MAAMC,IAAI,GAAG,KAAKR,OAAL,CAAaC,KAAb,CAAmBG,GAAnB,CAAb;IACA,OAAOI,IAAI,IAAIC,IAAI,CAACC,GAAL,KAAaF,IAAI,CAACG,SAAlB,GAA8BN,MAAtC,GAA+CG,IAAI,CAACI,IAApD,GAA2D,IAAlE;EACD;EAED;AACF;AACA;AACA;AACA;AACA;;;EACEC,GAAG,CAACD,IAAD,EAAOR,GAAP,EAAY;IACb,MAAMU,CAAC,GAAG,KAAKd,OAAf;IACA,MAAMe,GAAG,GAAGD,CAAC,CAACb,KAAF,CAAQG,GAAR,CAAZ;IACA,IAAIW,GAAJ,EAASD,CAAC,CAACZ,IAAF,IAAUa,GAAG,CAACH,IAAJ,CAASI,MAAnB;IACTF,CAAC,CAACb,KAAF,CAAQG,GAAR,IAAe;MAAEQ,IAAF;MAAQD,SAAS,EAAEF,IAAI,CAACC,GAAL;IAAnB,CAAf;IACAI,CAAC,CAACZ,IAAF,IAAUU,IAAI,CAACI,MAAf;;IACA,IAAIF,CAAC,CAACZ,IAAF,GAASY,CAAC,CAACf,OAAf,EAAwB;MACtB,MAAME,KAAK,GAAGgB,MAAM,CAACC,OAAP,CAAeJ,CAAC,CAACb,KAAjB,CAAd;MACAA,KAAK,CAACkB,IAAN,CAAW,CAACC,CAAD,EAAIC,CAAJ,KAAUD,CAAC,CAAC,CAAD,CAAD,CAAKT,SAAL,GAAiBU,CAAC,CAAC,CAAD,CAAD,CAAKV,SAA3C;;MACA,KAAK,IAAIW,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGrB,KAAK,CAACe,MAA1B,EAAkC,EAAEM,CAApC,EAAuC;QACrC,MAAMd,IAAI,GAAGP,KAAK,CAACqB,CAAD,CAAlB;QACA,OAAOR,CAAC,CAACb,KAAF,CAAQO,IAAI,CAAC,CAAD,CAAZ,CAAP;QACAM,CAAC,CAACZ,IAAF,IAAUM,IAAI,CAAC,CAAD,CAAJ,CAAQI,IAAR,CAAaI,MAAvB;QACA,IAAIF,CAAC,CAACZ,IAAF,GAASY,CAAC,CAACf,OAAF,GAAY,CAAzB,EAA4B;MAC7B;IACF;EACF;;AA7CwB"}
1
+ {"version":3,"file":"Cache.js","names":["Cache","constructor","maxSize","private","items","size","get","key","maxage","Number","MAX_VALUE","item","Date","now","timestamp","data","add","p","old","length","Object","entries","sort","a","b","i"],"sources":["../../../src/server/Cache.js"],"sourcesContent":["/**\n * Implements the static cache.\n * @ignore\n */\nexport default class Cache {\n constructor(maxSize) {\n this.private = {\n items: {},\n maxSize,\n size: 0,\n };\n }\n\n /**\n * Cache lookup.\n * @ignore\n * @param {string} key Item key to look for.\n * @param {number} [maxage=Number.MAX_VALUE] Optional. The maximum age of\n * cached item to serve. Default to infinite.\n * @returns {string} Cached item, or null if the item is absent in cache,\n * or stale.\n */\n get({ key, maxage = Number.MAX_VALUE }) {\n const item = this.private.items[key];\n return item && Date.now() - item.timestamp < maxage ? item.data : null;\n }\n\n /**\n * Adds item to cache.\n * @ignore\n * @param {string} data Item to add.\n * @param {string} key Key to store the item at.\n */\n add(data, key) {\n const p = this.private;\n const old = p.items[key];\n if (old) p.size -= old.data.length;\n p.items[key] = { data, timestamp: Date.now() };\n p.size += data.length;\n if (p.size > p.maxSize) {\n const items = Object.entries(p.items);\n items.sort((a, b) => a[1].timestamp - b[1].timestamp);\n for (let i = 0; i < items.length; ++i) {\n const item = items[i];\n delete p.items[item[0]];\n p.size -= item[1].data.length;\n if (p.size < p.maxSize / 2) break;\n }\n }\n }\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACe,MAAMA,KAAK,CAAC;EACzBC,WAAW,CAACC,OAAO,EAAE;IACnB,IAAI,CAACC,OAAO,GAAG;MACbC,KAAK,EAAE,CAAC,CAAC;MACTF,OAAO;MACPG,IAAI,EAAE;IACR,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,GAAG,CAAC;IAAEC,GAAG;IAAEC,MAAM,GAAGC,MAAM,CAACC;EAAU,CAAC,EAAE;IACtC,MAAMC,IAAI,GAAG,IAAI,CAACR,OAAO,CAACC,KAAK,CAACG,GAAG,CAAC;IACpC,OAAOI,IAAI,IAAIC,IAAI,CAACC,GAAG,EAAE,GAAGF,IAAI,CAACG,SAAS,GAAGN,MAAM,GAAGG,IAAI,CAACI,IAAI,GAAG,IAAI;EACxE;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEC,GAAG,CAACD,IAAI,EAAER,GAAG,EAAE;IACb,MAAMU,CAAC,GAAG,IAAI,CAACd,OAAO;IACtB,MAAMe,GAAG,GAAGD,CAAC,CAACb,KAAK,CAACG,GAAG,CAAC;IACxB,IAAIW,GAAG,EAAED,CAAC,CAACZ,IAAI,IAAIa,GAAG,CAACH,IAAI,CAACI,MAAM;IAClCF,CAAC,CAACb,KAAK,CAACG,GAAG,CAAC,GAAG;MAAEQ,IAAI;MAAED,SAAS,EAAEF,IAAI,CAACC,GAAG;IAAG,CAAC;IAC9CI,CAAC,CAACZ,IAAI,IAAIU,IAAI,CAACI,MAAM;IACrB,IAAIF,CAAC,CAACZ,IAAI,GAAGY,CAAC,CAACf,OAAO,EAAE;MACtB,MAAME,KAAK,GAAGgB,MAAM,CAACC,OAAO,CAACJ,CAAC,CAACb,KAAK,CAAC;MACrCA,KAAK,CAACkB,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAAC,CAAC,CAAC,CAACT,SAAS,GAAGU,CAAC,CAAC,CAAC,CAAC,CAACV,SAAS,CAAC;MACrD,KAAK,IAAIW,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGrB,KAAK,CAACe,MAAM,EAAE,EAAEM,CAAC,EAAE;QACrC,MAAMd,IAAI,GAAGP,KAAK,CAACqB,CAAC,CAAC;QACrB,OAAOR,CAAC,CAACb,KAAK,CAACO,IAAI,CAAC,CAAC,CAAC,CAAC;QACvBM,CAAC,CAACZ,IAAI,IAAIM,IAAI,CAAC,CAAC,CAAC,CAACI,IAAI,CAACI,MAAM;QAC7B,IAAIF,CAAC,CAACZ,IAAI,GAAGY,CAAC,CAACf,OAAO,GAAG,CAAC,EAAE;MAC9B;IACF;EACF;AACF;AAAC"}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
@@ -15,23 +14,14 @@ Object.defineProperty(exports, "getDefaultCspSettings", {
15
14
  return _server.getDefaultCspSettings;
16
15
  }
17
16
  });
18
-
19
17
  require("source-map-support/register");
20
-
21
18
  var _lodash = require("lodash");
22
-
23
19
  var _http = _interopRequireDefault(require("http"));
24
-
25
20
  var _https = _interopRequireDefault(require("https"));
26
-
27
21
  require("raf/polyfill");
28
-
29
22
  var _server = _interopRequireWildcard(require("./server"));
30
-
31
23
  var _renderer = require("./renderer");
32
-
33
24
  var _utils = require("./utils");
34
-
35
25
  Object.keys(_utils).forEach(function (key) {
36
26
  if (key === "default" || key === "__esModule") return;
37
27
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -43,11 +33,8 @@ Object.keys(_utils).forEach(function (key) {
43
33
  }
44
34
  });
45
35
  });
46
-
47
36
  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); }
48
-
49
37
  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; }
50
-
51
38
  /* Polyfill required by ReactJS. */
52
39
 
53
40
  /**
@@ -59,14 +46,11 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
59
46
  */
60
47
  function normalizePort(value) {
61
48
  const port = (0, _lodash.toNumber)(value);
62
- if ((0, _lodash.isFinite)(port)) return port;
63
- /* port number */
64
-
65
- if (!(0, _lodash.isNumber)(port)) return value;
66
- /* named pipe */
67
-
49
+ if ((0, _lodash.isFinite)(port)) return port; /* port number */
50
+ if (!(0, _lodash.isNumber)(port)) return value; /* named pipe */
68
51
  return false;
69
52
  }
53
+
70
54
  /**
71
55
  * Creates and launches web-server for ReactJS application. Allows zero
72
56
  * or detailed configuration, supports server-side rendering,
@@ -186,8 +170,6 @@ function normalizePort(value) {
186
170
  * @return {Promise<{ expressServer: object, httpServer: object }>} Resolves to
187
171
  * an object with created Express and HTTP servers.
188
172
  */
189
-
190
-
191
173
  async function launch(webpackConfig, options) {
192
174
  /* Options normalization. */
193
175
  const ops = options ? (0, _lodash.cloneDeep)(options) : {};
@@ -195,47 +177,41 @@ async function launch(webpackConfig, options) {
195
177
  (0, _lodash.defaults)(ops, {
196
178
  httpsRedirect: true
197
179
  });
198
-
199
180
  if (ops.logger === undefined) {
200
181
  ops.logger = (0, _renderer.newDefaultLogger)({
201
182
  defaultLogLevel: ops.defaultLoggerLogLevel
202
183
  });
203
184
  }
204
- /* Creates servers, resolves and sets the port. */
205
-
206
185
 
186
+ /* Creates servers, resolves and sets the port. */
207
187
  const expressServer = await (0, _server.default)(webpackConfig, ops);
208
188
  let httpServer;
209
-
210
189
  if (ops.https) {
211
190
  httpServer = _https.default.createServer({
212
191
  cert: ops.https.cert,
213
192
  key: ops.https.key
214
193
  }, expressServer);
215
194
  } else httpServer = _http.default.createServer(expressServer);
216
- /* Sets error handler for HTTP(S) server. */
217
-
218
195
 
196
+ /* Sets error handler for HTTP(S) server. */
219
197
  httpServer.on('error', error => {
220
198
  if (error.syscall !== 'listen') throw error;
221
199
  const bind = (0, _lodash.isString)(ops.port) ? `Pipe ${ops.port}` : `Port ${ops.port}`;
222
- /* Human-readable message for some specific listen errors. */
223
200
 
201
+ /* Human-readable message for some specific listen errors. */
224
202
  switch (error.code) {
225
203
  case 'EACCES':
226
204
  ops.logger.error(`${bind} requires elevated privileges`);
227
205
  return process.exit(1);
228
-
229
206
  case 'EADDRINUSE':
230
207
  ops.logger.error(`${bind} is already in use`);
231
208
  return process.exit(1);
232
-
233
209
  default:
234
210
  throw error;
235
211
  }
236
212
  });
237
- /* Listening event handler for HTTP(S) server. */
238
213
 
214
+ /* Listening event handler for HTTP(S) server. */
239
215
  httpServer.on('listening', () => {
240
216
  const addr = httpServer.address();
241
217
  const bind = (0, _lodash.isString)(addr) ? `pipe ${addr}` : `port ${addr.port}`;
@@ -247,7 +223,6 @@ async function launch(webpackConfig, options) {
247
223
  httpServer
248
224
  };
249
225
  }
250
-
251
226
  launch.SCRIPT_LOCATIONS = _renderer.SCRIPT_LOCATIONS;
252
227
  var _default = launch;
253
228
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["normalizePort","value","port","toNumber","isFinite","isNumber","launch","webpackConfig","options","ops","cloneDeep","process","env","PORT","defaults","httpsRedirect","logger","undefined","newDefaultLogger","defaultLogLevel","defaultLoggerLogLevel","expressServer","serverFactory","httpServer","https","createServer","cert","key","http","on","error","syscall","bind","isString","code","exit","addr","address","info","NODE_ENV","listen","SCRIPT_LOCATIONS"],"sources":["../../../src/server/index.js"],"sourcesContent":["import 'source-map-support/register';\n\nimport {\n cloneDeep,\n defaults,\n isFinite,\n isNumber,\n isString,\n toNumber,\n} from 'lodash';\n\nimport http from 'http';\nimport https from 'https';\n\n/* Polyfill required by ReactJS. */\nimport 'raf/polyfill';\n\nimport serverFactory from './server';\nimport { SCRIPT_LOCATIONS, newDefaultLogger } from './renderer';\n\nexport { getDefaultCspSettings } from './server';\nexport * from './utils';\n\n/**\n * Normalizes a port into a number, string, or false.\n * TODO: Drop this function?\n * @ignore\n * @param {String} value Port name or number.\n * @return Port number (Number), name (String), or false.\n */\nfunction normalizePort(value) {\n const port = toNumber(value);\n if (isFinite(port)) return port; /* port number */\n if (!isNumber(port)) return value; /* named pipe */\n return false;\n}\n\n/**\n * Creates and launches web-server for ReactJS application. Allows zero\n * or detailed configuration, supports server-side rendering,\n * and development tools, including Hot Module Reloading (HMR).\n *\n * NOTE: Many of options defined below are passed down to the server and\n * renderer factories, and their declared default values are set in those\n * factories, rather than here.\n *\n * @param {object} webpackConfig Webpack configuration used to build\n * the frontend bundle. In production mode the server will read out of it\n * `context`, `publicPath`, and a few other parameters, necessary to locate\n * and serve the app bundle. In development mode the server will use entire\n * provided config to build the app bundle in memory, and further watch and\n * update it via HMR.\n * @param {object} [options] Additional parameters.\n * @param {Component} [options.Application] The root ReactJS component of\n * the app to use for the server-side rendering. When not provided\n * the server-side rendering is disabled.\n * @param {function} [options.beforeExpressJsError] Asynchronous callback\n * (`(server) => Promise<boolean>`) to be executed just before the default error\n * handler is added to ExpressJS server. If the callback is provided and its\n * result resolves to a truthy value, `react-utils` won't attach the default\n * error handler.\n * @param {function} [options.beforeExpressJsSetup] Asynchronous callback\n * (`(server) => Promise) to be executed right after ExpressJS server creation,\n * before any configuration is performed.\n * @param {BeforeRenderHook} [options.beforeRender] The hook to run just before\n * the server-side rendering. For each incoming request, it will be executed\n * just before the HTML markup is generated at the server. It allows to load\n * and provide the data necessary for server-side rendering, and also to inject\n * additional configuration and scripts into the generated HTML code.\n * @param {boolean} [options.noCsp] Set `true` to disable\n * Content-Security-Policy (CSP) headers altogether.\n * @param {function} [options.cspSettingsHook] A hook allowing\n * to customize [CSP](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP)\n * settings for [helmet](https://github.com/helmetjs/helmet)'s\n * `contentSecurityPolicy` middleware on per-request basis.\n *\n * If provided it should be a with signature: \\\n * `(defaultSettings: object, req: object)` &rArr; `object` \\\n * which gets the default settings (also used without the hook),\n * and the incoming request object. The hook response will be passed\n * as options to the helmet `contentSecurityPolicy` middleware.\n *\n * Currently, the default settings is the following object in production\n * environment:\n * ```js\n * {\n * directives: {\n * defaultSrc: [\"'self'\"],\n * baseUri: [\"'self'\"],\n * blockAllMixedContent: [],\n * fontSrc: [\"'self'\", 'https:', 'data:'],\n * frameAncestors: [\"'self'\"],\n * frameSrc: [\"'self'\", 'https://*.youtube.com'],\n * imgSrc: [\"'self'\", 'data:'],\n * objectSrc: [\"'none'\"],\n * scriptSrc: [\"'self'\", \"'unsafe-eval'\", `'nonce-UNIQUE_NONCE_VALUE'`],\n * scriptSrcAttr: [\"'none'\"],\n * styleSrc: [\"'self'\", 'https:', \"'unsafe-inline'\"],\n * upgradeInsecureRequests: [] // Removed in dev mode.\n * }\n * }\n * ```\n * It matches the default value used by Helmet with a few updates:\n * - YouTube host is whitelisted in the `frameSrc` directive to ensure\n * the {@link YouTubeVideo} component works.\n * - An unique per-request nonce is added to `scriptSrc` directive to\n * whitelist auxiliary scripts injected by react-utils. The actual nonce\n * value can be fetched by host code via `.nonce` field of `req` argument\n * of `.beforeRender` hook.\n * - `upgradeInsecureRequests` directive is removed in development mode,\n * to simplify local testing with http requests.\n * @param {string} [options.defaultLoggerLogLevel='info'] Log level for\n * the default logger, which is created if no `logger` option provided.\n * @param {boolean} [options.devMode] Pass in `true` to start the server in\n * development mode.\n * @param {string} [options.favicon] Path to the favicon to use by the server.\n * By default no favicon is used.\n * @param {object} [options.https] If provided, HTTPS server will be started,\n * instead of HTTP otherwise. The object should provide SSL certificate and key\n * via two string fields: `cert`, and `key`.\n * @param {string} [options.https.cert] SSL Certificate.\n * @param {string} [options.https.key] SSL key.\n * @param {boolean} [options.httpsRedirect=true] Pass in `true` to enable\n * automatic redirection of all incoming HTTP requests to HTTPS.\n *\n * To smoothly use it at `localhost` you need to run the server in HTTPS mode,\n * and also properly create and install a self-signed SSL sertificate on your\n * system. This article is helpful:\n * [How to get HTTPS working on your local development environment in 5 minutes](https://medium.freecodecamp.org/how-to-get-https-working-on-your-local-development-environment-in-5-minutes-7af615770eec)\n * @param {Logger} [options.logger] The logger to use at server side.\n * By default [`winston`](https://www.npmjs.com/package/winston) logger\n * with console transport is used. The logger you provide, or the default\n * `winston` logger otherwise, will be attached to the created ExpressJS server\n * object.\n * @param {function} [options.onExpressJsSetup] An async callback\n * (`(server) => Promise`) to be triggered when most of the server\n * configuration is completed, just before the server-side renderer,\n * and the default error handler are attached. You can use it to mount\n * custom API routes. The server-side logger can be accessed as `server.logger`.\n * @param {number|string} [options.port=3000] The port to start the server on.\n * @param {number} [options.staticCacheSize=1.e7] The maximum\n * static cache size in bytes. Defaults to ~10 MB.\n * @param {function} [options.staticCacheController] When given, it activates,\n * and controls the static caching of generated HTML markup. When this function\n * is provided, on each incoming request it is triggered with the request\n * passed in as the argument. To attempt to serve the response from the cache\n * it should return the object with the following fields:\n * - `key: string` &ndash; the cache key for the response;\n * - `maxage?: number` &ndash; the maximum age of cached result in ms.\n * If undefined - infinite age is assumed.\n * @param {number} [options.maxSsrRounds=10] Maximum number of SSR rounds.\n * @param {number} [options.ssrTimeout=1000] SSR timeout in milliseconds,\n * defaults to 1 second.\n * @return {Promise<{ expressServer: object, httpServer: object }>} Resolves to\n * an object with created Express and HTTP servers.\n */\nasync function launch(webpackConfig, options) {\n /* Options normalization. */\n const ops = options ? cloneDeep(options) : {};\n ops.port = normalizePort(ops.port || process.env.PORT || 3000);\n defaults(ops, { httpsRedirect: true });\n\n if (ops.logger === undefined) {\n ops.logger = newDefaultLogger({\n defaultLogLevel: ops.defaultLoggerLogLevel,\n });\n }\n\n /* Creates servers, resolves and sets the port. */\n const expressServer = await serverFactory(webpackConfig, ops);\n\n let httpServer;\n if (ops.https) {\n httpServer = https.createServer({\n cert: ops.https.cert,\n key: ops.https.key,\n }, expressServer);\n } else httpServer = http.createServer(expressServer);\n\n /* Sets error handler for HTTP(S) server. */\n httpServer.on('error', (error) => {\n if (error.syscall !== 'listen') throw error;\n const bind = isString(ops.port) ? `Pipe ${ops.port}` : `Port ${ops.port}`;\n\n /* Human-readable message for some specific listen errors. */\n switch (error.code) {\n case 'EACCES':\n ops.logger.error(`${bind} requires elevated privileges`);\n return process.exit(1);\n case 'EADDRINUSE':\n ops.logger.error(`${bind} is already in use`);\n return process.exit(1);\n default:\n throw error;\n }\n });\n\n /* Listening event handler for HTTP(S) server. */\n httpServer.on('listening', () => {\n const addr = httpServer.address();\n const bind = isString(addr) ? `pipe ${addr}` : `port ${addr.port}`;\n ops.logger.info(`Server listening on ${bind} in ${\n process.env.NODE_ENV} mode`);\n });\n\n httpServer.listen(ops.port);\n\n return {\n expressServer,\n httpServer,\n };\n}\n\nlaunch.SCRIPT_LOCATIONS = SCRIPT_LOCATIONS;\n\nexport default launch;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AAEA;;AASA;;AACA;;AAGA;;AAEA;;AACA;;AAGA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;;;;;AAPA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,aAAT,CAAuBC,KAAvB,EAA8B;EAC5B,MAAMC,IAAI,GAAG,IAAAC,gBAAA,EAASF,KAAT,CAAb;EACA,IAAI,IAAAG,gBAAA,EAASF,IAAT,CAAJ,EAAoB,OAAOA,IAAP;EAAa;;EACjC,IAAI,CAAC,IAAAG,gBAAA,EAASH,IAAT,CAAL,EAAqB,OAAOD,KAAP;EAAc;;EACnC,OAAO,KAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,eAAeK,MAAf,CAAsBC,aAAtB,EAAqCC,OAArC,EAA8C;EAC5C;EACA,MAAMC,GAAG,GAAGD,OAAO,GAAG,IAAAE,iBAAA,EAAUF,OAAV,CAAH,GAAwB,EAA3C;EACAC,GAAG,CAACP,IAAJ,GAAWF,aAAa,CAACS,GAAG,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AAK,oBAAzB;QACA,OAAOrB,OAAO,CAACwB,IAAR,CAAa,CAAb,CAAP;;MACF;QACE,MAAML,KAAN;IARJ;EAUD,CAfD;EAiBA;;EACAP,UAAU,CAACM,EAAX,CAAc,WAAd,EAA2B,MAAM;IAC/B,MAAMO,IAAI,GAAGb,UAAU,CAACc,OAAX,EAAb;IACA,MAAML,IAAI,GAAG,IAAAC,gBAAA,EAASG,IAAT,IAAkB,QAAOA,IAAK,EAA9B,GAAmC,QAAOA,IAAI,CAAClC,IAAK,EAAjE;IACAO,GAAG,CAACO,MAAJ,CAAWsB,IAAX,CAAiB,uBAAsBN,IAAK,OAC1CrB,OAAO,CAACC,GAAR,CAAY2B,QAAS,OADvB;EAED,CALD;EAOAhB,UAAU,CAACiB,MAAX,CAAkB/B,GAAG,CAACP,IAAtB;EAEA,OAAO;IACLmB,aADK;IAELE;EAFK,CAAP;AAID;;AAEDjB,MAAM,CAACmC,gBAAP,GAA0BA,0BAA1B;eAEenC,M"}
1
+ {"version":3,"file":"index.js","names":["normalizePort","value","port","toNumber","isFinite","isNumber","launch","webpackConfig","options","ops","cloneDeep","process","env","PORT","defaults","httpsRedirect","logger","undefined","newDefaultLogger","defaultLogLevel","defaultLoggerLogLevel","expressServer","serverFactory","httpServer","https","createServer","cert","key","http","on","error","syscall","bind","isString","code","exit","addr","address","info","NODE_ENV","listen","SCRIPT_LOCATIONS"],"sources":["../../../src/server/index.js"],"sourcesContent":["import 'source-map-support/register';\n\nimport {\n cloneDeep,\n defaults,\n isFinite,\n isNumber,\n isString,\n toNumber,\n} from 'lodash';\n\nimport http from 'http';\nimport https from 'https';\n\n/* Polyfill required by ReactJS. */\nimport 'raf/polyfill';\n\nimport serverFactory from './server';\nimport { SCRIPT_LOCATIONS, newDefaultLogger } from './renderer';\n\nexport { getDefaultCspSettings } from './server';\nexport * from './utils';\n\n/**\n * Normalizes a port into a number, string, or false.\n * TODO: Drop this function?\n * @ignore\n * @param {String} value Port name or number.\n * @return Port number (Number), name (String), or false.\n */\nfunction normalizePort(value) {\n const port = toNumber(value);\n if (isFinite(port)) return port; /* port number */\n if (!isNumber(port)) return value; /* named pipe */\n return false;\n}\n\n/**\n * Creates and launches web-server for ReactJS application. Allows zero\n * or detailed configuration, supports server-side rendering,\n * and development tools, including Hot Module Reloading (HMR).\n *\n * NOTE: Many of options defined below are passed down to the server and\n * renderer factories, and their declared default values are set in those\n * factories, rather than here.\n *\n * @param {object} webpackConfig Webpack configuration used to build\n * the frontend bundle. In production mode the server will read out of it\n * `context`, `publicPath`, and a few other parameters, necessary to locate\n * and serve the app bundle. In development mode the server will use entire\n * provided config to build the app bundle in memory, and further watch and\n * update it via HMR.\n * @param {object} [options] Additional parameters.\n * @param {Component} [options.Application] The root ReactJS component of\n * the app to use for the server-side rendering. When not provided\n * the server-side rendering is disabled.\n * @param {function} [options.beforeExpressJsError] Asynchronous callback\n * (`(server) => Promise<boolean>`) to be executed just before the default error\n * handler is added to ExpressJS server. If the callback is provided and its\n * result resolves to a truthy value, `react-utils` won't attach the default\n * error handler.\n * @param {function} [options.beforeExpressJsSetup] Asynchronous callback\n * (`(server) => Promise) to be executed right after ExpressJS server creation,\n * before any configuration is performed.\n * @param {BeforeRenderHook} [options.beforeRender] The hook to run just before\n * the server-side rendering. For each incoming request, it will be executed\n * just before the HTML markup is generated at the server. It allows to load\n * and provide the data necessary for server-side rendering, and also to inject\n * additional configuration and scripts into the generated HTML code.\n * @param {boolean} [options.noCsp] Set `true` to disable\n * Content-Security-Policy (CSP) headers altogether.\n * @param {function} [options.cspSettingsHook] A hook allowing\n * to customize [CSP](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP)\n * settings for [helmet](https://github.com/helmetjs/helmet)'s\n * `contentSecurityPolicy` middleware on per-request basis.\n *\n * If provided it should be a with signature: \\\n * `(defaultSettings: object, req: object)` &rArr; `object` \\\n * which gets the default settings (also used without the hook),\n * and the incoming request object. The hook response will be passed\n * as options to the helmet `contentSecurityPolicy` middleware.\n *\n * Currently, the default settings is the following object in production\n * environment:\n * ```js\n * {\n * directives: {\n * defaultSrc: [\"'self'\"],\n * baseUri: [\"'self'\"],\n * blockAllMixedContent: [],\n * fontSrc: [\"'self'\", 'https:', 'data:'],\n * frameAncestors: [\"'self'\"],\n * frameSrc: [\"'self'\", 'https://*.youtube.com'],\n * imgSrc: [\"'self'\", 'data:'],\n * objectSrc: [\"'none'\"],\n * scriptSrc: [\"'self'\", \"'unsafe-eval'\", `'nonce-UNIQUE_NONCE_VALUE'`],\n * scriptSrcAttr: [\"'none'\"],\n * styleSrc: [\"'self'\", 'https:', \"'unsafe-inline'\"],\n * upgradeInsecureRequests: [] // Removed in dev mode.\n * }\n * }\n * ```\n * It matches the default value used by Helmet with a few updates:\n * - YouTube host is whitelisted in the `frameSrc` directive to ensure\n * the {@link YouTubeVideo} component works.\n * - An unique per-request nonce is added to `scriptSrc` directive to\n * whitelist auxiliary scripts injected by react-utils. The actual nonce\n * value can be fetched by host code via `.nonce` field of `req` argument\n * of `.beforeRender` hook.\n * - `upgradeInsecureRequests` directive is removed in development mode,\n * to simplify local testing with http requests.\n * @param {string} [options.defaultLoggerLogLevel='info'] Log level for\n * the default logger, which is created if no `logger` option provided.\n * @param {boolean} [options.devMode] Pass in `true` to start the server in\n * development mode.\n * @param {string} [options.favicon] Path to the favicon to use by the server.\n * By default no favicon is used.\n * @param {object} [options.https] If provided, HTTPS server will be started,\n * instead of HTTP otherwise. The object should provide SSL certificate and key\n * via two string fields: `cert`, and `key`.\n * @param {string} [options.https.cert] SSL Certificate.\n * @param {string} [options.https.key] SSL key.\n * @param {boolean} [options.httpsRedirect=true] Pass in `true` to enable\n * automatic redirection of all incoming HTTP requests to HTTPS.\n *\n * To smoothly use it at `localhost` you need to run the server in HTTPS mode,\n * and also properly create and install a self-signed SSL sertificate on your\n * system. This article is helpful:\n * [How to get HTTPS working on your local development environment in 5 minutes](https://medium.freecodecamp.org/how-to-get-https-working-on-your-local-development-environment-in-5-minutes-7af615770eec)\n * @param {Logger} [options.logger] The logger to use at server side.\n * By default [`winston`](https://www.npmjs.com/package/winston) logger\n * with console transport is used. The logger you provide, or the default\n * `winston` logger otherwise, will be attached to the created ExpressJS server\n * object.\n * @param {function} [options.onExpressJsSetup] An async callback\n * (`(server) => Promise`) to be triggered when most of the server\n * configuration is completed, just before the server-side renderer,\n * and the default error handler are attached. You can use it to mount\n * custom API routes. The server-side logger can be accessed as `server.logger`.\n * @param {number|string} [options.port=3000] The port to start the server on.\n * @param {number} [options.staticCacheSize=1.e7] The maximum\n * static cache size in bytes. Defaults to ~10 MB.\n * @param {function} [options.staticCacheController] When given, it activates,\n * and controls the static caching of generated HTML markup. When this function\n * is provided, on each incoming request it is triggered with the request\n * passed in as the argument. To attempt to serve the response from the cache\n * it should return the object with the following fields:\n * - `key: string` &ndash; the cache key for the response;\n * - `maxage?: number` &ndash; the maximum age of cached result in ms.\n * If undefined - infinite age is assumed.\n * @param {number} [options.maxSsrRounds=10] Maximum number of SSR rounds.\n * @param {number} [options.ssrTimeout=1000] SSR timeout in milliseconds,\n * defaults to 1 second.\n * @return {Promise<{ expressServer: object, httpServer: object }>} Resolves to\n * an object with created Express and HTTP servers.\n */\nasync function launch(webpackConfig, options) {\n /* Options normalization. */\n const ops = options ? cloneDeep(options) : {};\n ops.port = normalizePort(ops.port || process.env.PORT || 3000);\n defaults(ops, { httpsRedirect: true });\n\n if (ops.logger === undefined) {\n ops.logger = newDefaultLogger({\n defaultLogLevel: ops.defaultLoggerLogLevel,\n });\n }\n\n /* Creates servers, resolves and sets the port. */\n const expressServer = await serverFactory(webpackConfig, ops);\n\n let httpServer;\n if (ops.https) {\n httpServer = https.createServer({\n cert: ops.https.cert,\n key: ops.https.key,\n }, expressServer);\n } else httpServer = http.createServer(expressServer);\n\n /* Sets error handler for HTTP(S) server. */\n httpServer.on('error', (error) => {\n if (error.syscall !== 'listen') throw error;\n const bind = isString(ops.port) ? `Pipe ${ops.port}` : `Port ${ops.port}`;\n\n /* Human-readable message for some specific listen errors. */\n switch (error.code) {\n case 'EACCES':\n ops.logger.error(`${bind} requires elevated privileges`);\n return process.exit(1);\n case 'EADDRINUSE':\n ops.logger.error(`${bind} is already in use`);\n return process.exit(1);\n default:\n throw error;\n }\n });\n\n /* Listening event handler for HTTP(S) server. */\n httpServer.on('listening', () => {\n const addr = httpServer.address();\n const bind = isString(addr) ? `pipe ${addr}` : `port ${addr.port}`;\n ops.logger.info(`Server listening on ${bind} in ${\n process.env.NODE_ENV} mode`);\n });\n\n httpServer.listen(ops.port);\n\n return {\n expressServer,\n httpServer,\n };\n}\n\nlaunch.SCRIPT_LOCATIONS = SCRIPT_LOCATIONS;\n\nexport default launch;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAEA;AASA;AACA;AAGA;AAEA;AACA;AAGA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAAwB;AAAA;AAPxB;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,aAAa,CAACC,KAAK,EAAE;EAC5B,MAAMC,IAAI,GAAG,IAAAC,gBAAQ,EAACF,KAAK,CAAC;EAC5B,IAAI,IAAAG,gBAAQ,EAACF,IAAI,CAAC,EAAE,OAAOA,IAAI,CAAC,CAAC;EACjC,IAAI,CAAC,IAAAG,gBAAQ,EAACH,IAAI,CAAC,EAAE,OAAOD,KAAK,CAAC,CAAC;EACnC,OAAO,KAAK;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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