@dr.pogodin/react-utils 1.17.1 → 1.17.4

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 (97) hide show
  1. package/build/development/client/index.js.map +1 -1
  2. package/build/development/client/init.js +4 -2
  3. package/build/development/client/init.js.map +1 -1
  4. package/build/development/index.js.map +1 -1
  5. package/build/development/server/Cache.js.map +1 -1
  6. package/build/development/server/index.js +5 -10
  7. package/build/development/server/index.js.map +1 -1
  8. package/build/development/server/renderer.js +35 -15
  9. package/build/development/server/renderer.js.map +1 -1
  10. package/build/development/server/server.js.map +1 -1
  11. package/build/development/server/utils/errors.js.map +1 -1
  12. package/build/development/server/utils/index.js.map +1 -1
  13. package/build/development/shared/components/Button/index.js.map +1 -1
  14. package/build/development/shared/components/Checkbox/index.js.map +1 -1
  15. package/build/development/shared/components/CodeSplit/index.js.map +1 -1
  16. package/build/development/shared/components/Dropdown/index.js.map +1 -1
  17. package/build/development/shared/components/GenericLink/index.js.map +1 -1
  18. package/build/development/shared/components/Input/index.js.map +1 -1
  19. package/build/development/shared/components/Link.js.map +1 -1
  20. package/build/development/shared/components/MetaTags.js.map +1 -1
  21. package/build/development/shared/components/Modal/index.js.map +1 -1
  22. package/build/development/shared/components/NavLink.js.map +1 -1
  23. package/build/development/shared/components/PageLayout/index.js.map +1 -1
  24. package/build/development/shared/components/ScalableRect/index.js.map +1 -1
  25. package/build/development/shared/components/Throbber/index.js.map +1 -1
  26. package/build/development/shared/components/WithTooltip/Tooltip.js.map +1 -1
  27. package/build/development/shared/components/WithTooltip/index.js.map +1 -1
  28. package/build/development/shared/components/YouTubeVideo/index.js.map +1 -1
  29. package/build/development/shared/components/index.js.map +1 -1
  30. package/build/development/shared/utils/Barrier.js.map +1 -1
  31. package/build/development/shared/utils/Emitter.js.map +1 -1
  32. package/build/development/shared/utils/Semaphore.js.map +1 -1
  33. package/build/development/shared/utils/config.js.map +1 -1
  34. package/build/development/shared/utils/index.js.map +1 -1
  35. package/build/development/shared/utils/isomorphy.js +1 -1
  36. package/build/development/shared/utils/isomorphy.js.map +1 -1
  37. package/build/development/shared/utils/jest/E2eSsrEnv.js +191 -0
  38. package/build/development/shared/utils/jest/E2eSsrEnv.js.map +1 -0
  39. package/build/development/shared/utils/{jest.js → jest/index.js} +1 -1
  40. package/build/development/shared/utils/jest/index.js.map +1 -0
  41. package/build/development/shared/utils/splitComponent.js.map +1 -1
  42. package/build/development/shared/utils/time.js.map +1 -1
  43. package/build/development/shared/utils/webpack.js.map +1 -1
  44. package/build/development/web.bundle.js +1 -1
  45. package/build/production/client/index.js.map +1 -1
  46. package/build/production/client/init.js +1 -1
  47. package/build/production/client/init.js.map +1 -1
  48. package/build/production/index.js.map +1 -1
  49. package/build/production/server/Cache.js.map +1 -1
  50. package/build/production/server/index.js +5 -5
  51. package/build/production/server/index.js.map +1 -1
  52. package/build/production/server/renderer.js +27 -10
  53. package/build/production/server/renderer.js.map +1 -1
  54. package/build/production/server/server.js.map +1 -1
  55. package/build/production/server/utils/errors.js.map +1 -1
  56. package/build/production/server/utils/index.js.map +1 -1
  57. package/build/production/shared/components/Button/index.js.map +1 -1
  58. package/build/production/shared/components/Checkbox/index.js.map +1 -1
  59. package/build/production/shared/components/CodeSplit/index.js.map +1 -1
  60. package/build/production/shared/components/Dropdown/index.js.map +1 -1
  61. package/build/production/shared/components/GenericLink/index.js.map +1 -1
  62. package/build/production/shared/components/Input/index.js.map +1 -1
  63. package/build/production/shared/components/Link.js.map +1 -1
  64. package/build/production/shared/components/MetaTags.js.map +1 -1
  65. package/build/production/shared/components/Modal/index.js.map +1 -1
  66. package/build/production/shared/components/NavLink.js.map +1 -1
  67. package/build/production/shared/components/PageLayout/index.js.map +1 -1
  68. package/build/production/shared/components/ScalableRect/index.js.map +1 -1
  69. package/build/production/shared/components/Throbber/index.js.map +1 -1
  70. package/build/production/shared/components/WithTooltip/Tooltip.js.map +1 -1
  71. package/build/production/shared/components/WithTooltip/index.js.map +1 -1
  72. package/build/production/shared/components/YouTubeVideo/index.js.map +1 -1
  73. package/build/production/shared/components/index.js.map +1 -1
  74. package/build/production/shared/utils/Barrier.js.map +1 -1
  75. package/build/production/shared/utils/Emitter.js.map +1 -1
  76. package/build/production/shared/utils/Semaphore.js.map +1 -1
  77. package/build/production/shared/utils/config.js.map +1 -1
  78. package/build/production/shared/utils/index.js.map +1 -1
  79. package/build/production/shared/utils/isomorphy.js +1 -1
  80. package/build/production/shared/utils/isomorphy.js.map +1 -1
  81. package/build/production/shared/utils/jest/E2eSsrEnv.js +43 -0
  82. package/build/production/shared/utils/jest/E2eSsrEnv.js.map +1 -0
  83. package/build/production/shared/utils/{jest.js → jest/index.js} +1 -1
  84. package/build/production/shared/utils/jest/index.js.map +1 -0
  85. package/build/production/shared/utils/splitComponent.js.map +1 -1
  86. package/build/production/shared/utils/time.js.map +1 -1
  87. package/build/production/shared/utils/webpack.js.map +1 -1
  88. package/build/production/web.bundle.js +1 -1
  89. package/build/production/web.bundle.js.map +1 -1
  90. package/config/eslint/jest.json +1 -0
  91. package/config/webpack/app-base.js +48 -27
  92. package/config/webpack/app-development.js +40 -22
  93. package/config/webpack/app-production.js +8 -0
  94. package/config/webpack/lib-base.js +13 -6
  95. package/package.json +24 -21
  96. package/build/development/shared/utils/jest.js.map +0 -1
  97. package/build/production/shared/utils/jest.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/shared/utils/isomorphy.js"],"names":["IS_CLIENT_SIDE","process","versions","node","IS_SERVER_SIDE","getMode","env","NODE_ENV","isDevBuild","isProdBuild","getBuildInfo","window","global","TRU_BUILD_INFO","buildTimestamp","timestamp"],"mappings":";;;;;;;;;;;AAAA;;AAEA;AACA;AACA;AACO,MAAMA,cAAc,GAAG,OAAOC,OAAP,KAAmB,QAAnB,IACzB,CAACA,OAAO,CAACC,QADgB,IACJ,CAACD,OAAO,CAACC,QAAR,CAAiBC,IADrC;AAGP;AACA;AACA;;;AACO,MAAMC,cAAc,GAAG,CAACJ,cAAxB;AAEP;AACA;AACA;AACA;;;;AACA,SAASK,OAAT,GAAmB;AACjB,SAAOJ,OAAO,CAACK,GAAR,CAAYC,QAAnB;AACD;AAED;AACA;AACA;AACA;AACA;;;AACO,SAASC,UAAT,GAAsB;AAC3B,SAAOH,OAAO,OAAO,aAArB;AACD;AAED;AACA;AACA;AACA;AACA;;;AACO,SAASI,WAAT,GAAuB;AAC5B,SAAOJ,OAAO,OAAO,YAArB;AACD;AAED;AACA;AACA;AACA;;;AACO,SAASK,YAAT,GAAwB;AAC7B,SAAO,CAACV,cAAc,GAAGW,MAAH,GAAYC,MAA3B,EAAmCC,cAA1C;AACD;AAED;AACA;AACA;AACA;;;AACO,SAASC,cAAT,GAA0B;AAC/B,SAAOJ,YAAY,GAAGK,SAAtB;AACD","sourcesContent":["/* global window */\n\n/**\n * `true` within client-side environment (browser), `false` at server-side.\n */\nexport const IS_CLIENT_SIDE = typeof process !== 'object'\n || !process.versions || !process.versions.node;\n\n/**\n * `true` within the server-side environment (node), `false` at client-side.\n */\nexport const IS_SERVER_SIDE = !IS_CLIENT_SIDE;\n\n/**\n * @ignore\n * @return {string} Code mode: \"development\" or \"production\".\n */\nfunction getMode() {\n return process.env.NODE_ENV;\n}\n\n/**\n * Returns `true` if development version of the code is running;\n * `false` otherwise.\n * @return {boolean}\n */\nexport function isDevBuild() {\n return getMode() === 'development';\n}\n\n/**\n * Returns `true` if production build of the code is running;\n * `false` otherwise.\n * @return {boolean}\n */\nexport function isProdBuild() {\n return getMode() === 'production';\n}\n\n/**\n * Returns build info object.\n * @returns {object}\n */\nexport function getBuildInfo() {\n return (IS_CLIENT_SIDE ? window : global).TRU_BUILD_INFO;\n}\n\n/**\n * Returns build timestamp of the front-end JS bundle.\n * @return {string} ISO date/time string.\n */\nexport function buildTimestamp() {\n return getBuildInfo().timestamp;\n}\n"],"file":"isomorphy.js"}
1
+ {"version":3,"file":"isomorphy.js","names":["IS_CLIENT_SIDE","process","versions","node","global","REACT_UTILS_FORCE_CLIENT_SIDE","IS_SERVER_SIDE","getMode","env","NODE_ENV","isDevBuild","isProdBuild","getBuildInfo","window","TRU_BUILD_INFO","buildTimestamp","timestamp"],"sources":["../../../../src/shared/utils/isomorphy.js"],"sourcesContent":["/* global window */\n\n/**\n * `true` within client-side environment (browser), `false` at server-side.\n */\nexport const IS_CLIENT_SIDE = typeof process !== 'object'\n || !process.versions || !process.versions.node\n || !!global.REACT_UTILS_FORCE_CLIENT_SIDE;\n\n/**\n * `true` within the server-side environment (node), `false` at client-side.\n */\nexport const IS_SERVER_SIDE = !IS_CLIENT_SIDE;\n\n/**\n * @ignore\n * @return {string} Code mode: \"development\" or \"production\".\n */\nfunction getMode() {\n return process.env.NODE_ENV;\n}\n\n/**\n * Returns `true` if development version of the code is running;\n * `false` otherwise.\n * @return {boolean}\n */\nexport function isDevBuild() {\n return getMode() === 'development';\n}\n\n/**\n * Returns `true` if production build of the code is running;\n * `false` otherwise.\n * @return {boolean}\n */\nexport function isProdBuild() {\n return getMode() === 'production';\n}\n\n/**\n * Returns build info object.\n * @returns {object}\n */\nexport function getBuildInfo() {\n return (IS_CLIENT_SIDE ? window : global).TRU_BUILD_INFO;\n}\n\n/**\n * Returns build timestamp of the front-end JS bundle.\n * @return {string} ISO date/time string.\n */\nexport function buildTimestamp() {\n return getBuildInfo().timestamp;\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAEA;AACA;AACA;AACO,MAAMA,cAAc,GAAG,OAAOC,OAAP,KAAmB,QAAnB,IACzB,CAACA,OAAO,CAACC,QADgB,IACJ,CAACD,OAAO,CAACC,QAAR,CAAiBC,IADd,IAEzB,CAAC,CAACC,MAAM,CAACC,6BAFP;AAIP;AACA;AACA;;;AACO,MAAMC,cAAc,GAAG,CAACN,cAAxB;AAEP;AACA;AACA;AACA;;;;AACA,SAASO,OAAT,GAAmB;EACjB,OAAON,OAAO,CAACO,GAAR,CAAYC,QAAnB;AACD;AAED;AACA;AACA;AACA;AACA;;;AACO,SAASC,UAAT,GAAsB;EAC3B,OAAOH,OAAO,OAAO,aAArB;AACD;AAED;AACA;AACA;AACA;AACA;;;AACO,SAASI,WAAT,GAAuB;EAC5B,OAAOJ,OAAO,OAAO,YAArB;AACD;AAED;AACA;AACA;AACA;;;AACO,SAASK,YAAT,GAAwB;EAC7B,OAAO,CAACZ,cAAc,GAAGa,MAAH,GAAYT,MAA3B,EAAmCU,cAA1C;AACD;AAED;AACA;AACA;AACA;;;AACO,SAASC,cAAT,GAA0B;EAC/B,OAAOH,YAAY,GAAGI,SAAtB;AACD"}
@@ -0,0 +1,191 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _path = _interopRequireDefault(require("path"));
11
+
12
+ var _renderer = _interopRequireDefault(require("../../../server/renderer"));
13
+
14
+ var _lodash = require("lodash");
15
+
16
+ var _register = _interopRequireDefault(require("@babel/register"));
17
+
18
+ var _jestEnvironmentJsdom = _interopRequireDefault(require("jest-environment-jsdom"));
19
+
20
+ var _memfs = require("memfs");
21
+
22
+ var _webpack = _interopRequireDefault(require("webpack"));
23
+
24
+ /**
25
+ * Jest environment for end-to-end SSR and client-side testing. It relies on
26
+ * the standard react-utils mechanics to execute SSR of given scene, and also
27
+ * Webpack build of the code for client-side execution, it further exposes
28
+ * Jsdom environment for the client-side testing of the outcomes.
29
+ */
30
+
31
+ /* eslint-disable global-require, import/no-dynamic-require */
32
+ // BEWARE: The module is not imported into the JU module / the main assembly of
33
+ // the library, because doing so easily breaks stuff:
34
+ // 1) This module depends on Node-specific modules, which would make JU
35
+ // incompatible with JsDom if included into JU.
36
+ // 2) If this module is weakly imported from somewhere else in the lib,
37
+ // it seems to randomly break tests using it for a different reason,
38
+ // probably some sort of a require-loop, or some issues with weak
39
+ // require in that scenario.
40
+ // As this environment is a part of the Jest testing utils,
41
+ // we assume development dependencies are available when it is used.
42
+
43
+ /* eslint-disable import/no-extraneous-dependencies */
44
+
45
+ /* eslint-enable import/no-extraneous-dependencies */
46
+ class E2eSsrEnv extends _jestEnvironmentJsdom.default {
47
+ /**
48
+ * Loads Webpack config, and exposes it to the environment via global
49
+ * webpackConfig object.
50
+ */
51
+ loadWebpackConfig() {
52
+ let options = this.pragmas['webpack-config-options'];
53
+ options = options ? JSON.parse(options) : {};
54
+ (0, _lodash.defaults)(options, {
55
+ context: this.testFolder,
56
+ dontEmitBuildInfo: true
57
+ });
58
+ let factory = this.pragmas['webpack-config-factory'] || '';
59
+ factory = require(_path.default.resolve(this.rootDir, factory));
60
+ this.global.webpackConfig = factory(options);
61
+ this.global.buildInfo = factory.buildInfo;
62
+ }
63
+ /**
64
+ * Executes Webpack build.
65
+ * @return {Promise}
66
+ */
67
+
68
+
69
+ async runWebpack() {
70
+ this.loadWebpackConfig();
71
+ const compiler = (0, _webpack.default)(this.global.webpackConfig);
72
+ const fs = (0, _memfs.createFsFromVolume)(new _memfs.Volume());
73
+ compiler.outputFileSystem = fs;
74
+ return new Promise((done, fail) => {
75
+ compiler.run((err, stats) => {
76
+ if (err) fail(err);
77
+ this.global.webpackOutputFs = fs;
78
+ this.global.webpackStats = stats.toJson(); // Keeps reference to the raw Webpack stats object, which should be
79
+ // explicitly passed to the server-side renderer alongside the request,
80
+ // so that it can to pick up asset paths for different named chunks.
81
+
82
+ this.webpackStats = stats;
83
+ done();
84
+ });
85
+ });
86
+ }
87
+
88
+ async runSsr() {
89
+ let options = this.pragmas['ssr-options'];
90
+ options = options ? JSON.parse(options) : {};
91
+ let root;
92
+
93
+ switch (options.root) {
94
+ case 'TEST':
95
+ root = this.testFolder;
96
+ break;
97
+
98
+ default:
99
+ root = process.cwd();
100
+ } // Note: This enables Babel transformation for the code dynamically loaded
101
+ // below, as the usual Jest Babel setup does not seem to apply to
102
+ // the environment code, and imports from it.
103
+
104
+
105
+ (0, _register.default)({
106
+ envName: options.babelEnv,
107
+ extensions: ['.js', '.jsx', '.svg'],
108
+ root
109
+ });
110
+ if (!options.buildInfo) options.buildInfo = this.global.buildInfo;
111
+
112
+ if (options.entry) {
113
+ const p = _path.default.resolve(this.testFolder, options.entry);
114
+
115
+ options.Application = require(p)[options.entryExportName || 'default'];
116
+ }
117
+
118
+ const renderer = (0, _renderer.default)(this.global.webpackConfig, options);
119
+ const markup = await new Promise((done, fail) => {
120
+ renderer(this.ssrRequest, // TODO: This will do for now, with the current implementation of
121
+ // the renderer, but it will require a rework once the renderer is
122
+ // updated to do streaming.
123
+ {
124
+ send: done,
125
+ set: _lodash.noop,
126
+ // This is how up-to-date Webpack stats are passed to the server in
127
+ // development mode, and we use this here always, instead of having
128
+ // to pass some information via filesystem.
129
+ locals: {
130
+ webpack: {
131
+ devMiddleware: {
132
+ stats: this.webpackStats
133
+ }
134
+ }
135
+ }
136
+ }, error => {
137
+ if (error) fail(error);else done('');
138
+ });
139
+ });
140
+ this.global.ssrMarkup = markup;
141
+ this.global.ssrOptions = options;
142
+ }
143
+
144
+ constructor(config, context) {
145
+ const pragmas = context.docblockPragmas;
146
+ let request = pragmas['ssr-request'];
147
+ request = request ? JSON.parse(request) : {};
148
+ if (!request.url) request.url = '/'; // This ensures the initial JsDom URL matches the value we use for SSR.
149
+
150
+ (0, _lodash.set)(config.projectConfig, 'testEnvironmentOptions.url', `http://localhost${request.url}`);
151
+ super(config, context);
152
+ this.global.dom = this.dom; // Extracts necessary settings from config and context.
153
+
154
+ const {
155
+ projectConfig
156
+ } = config;
157
+ this.rootDir = projectConfig.rootDir;
158
+ this.testFolder = _path.default.dirname(context.testPath);
159
+ this.withSsr = !pragmas['no-ssr'];
160
+ this.ssrRequest = request;
161
+ this.pragmas = pragmas;
162
+ }
163
+
164
+ async setup() {
165
+ await super.setup();
166
+ await this.runWebpack();
167
+ if (this.withSsr) await this.runSsr();
168
+ this.global.REACT_UTILS_FORCE_CLIENT_SIDE = true;
169
+ }
170
+
171
+ async teardown() {
172
+ delete this.global.REACT_UTILS_FORCE_CLIENT_SIDE; // Resets module cache and @babel/register. Effectively this ensures that
173
+ // the next time an instance of this environment is set up, all modules are
174
+ // transformed by Babel from scratch, thus taking into account the latest
175
+ // Babel config (which may change between different environment instances,
176
+ // which does not seem to be taken into account by Babel / Node caches
177
+ // automatically).
178
+
179
+ Object.keys(require.cache).forEach(key => {
180
+ delete require.cache[key];
181
+ });
182
+
183
+ _register.default.revert();
184
+
185
+ super.teardown();
186
+ }
187
+
188
+ }
189
+
190
+ exports.default = E2eSsrEnv;
191
+ //# sourceMappingURL=E2eSsrEnv.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"E2eSsrEnv.js","names":["E2eSsrEnv","JsdomEnv","loadWebpackConfig","options","pragmas","JSON","parse","context","testFolder","dontEmitBuildInfo","factory","require","path","resolve","rootDir","global","webpackConfig","buildInfo","runWebpack","compiler","fs","Volume","outputFileSystem","Promise","done","fail","run","err","stats","webpackOutputFs","webpackStats","toJson","runSsr","root","process","cwd","envName","babelEnv","extensions","entry","p","Application","entryExportName","renderer","markup","ssrRequest","send","set","noop","locals","webpack","devMiddleware","error","ssrMarkup","ssrOptions","constructor","config","docblockPragmas","request","url","projectConfig","dom","dirname","testPath","withSsr","setup","REACT_UTILS_FORCE_CLIENT_SIDE","teardown","Object","keys","cache","forEach","key","register","revert"],"sources":["../../../../../src/shared/utils/jest/E2eSsrEnv.js"],"sourcesContent":["/**\n * Jest environment for end-to-end SSR and client-side testing. It relies on\n * the standard react-utils mechanics to execute SSR of given scene, and also\n * Webpack build of the code for client-side execution, it further exposes\n * Jsdom environment for the client-side testing of the outcomes.\n */\n/* eslint-disable global-require, import/no-dynamic-require */\n\n// BEWARE: The module is not imported into the JU module / the main assembly of\n// the library, because doing so easily breaks stuff:\n// 1) This module depends on Node-specific modules, which would make JU\n// incompatible with JsDom if included into JU.\n// 2) If this module is weakly imported from somewhere else in the lib,\n// it seems to randomly break tests using it for a different reason,\n// probably some sort of a require-loop, or some issues with weak\n// require in that scenario.\n\nimport path from 'path';\nimport ssrFactory from 'server/renderer';\n\nimport { defaults, noop, set } from 'lodash';\n\n// As this environment is a part of the Jest testing utils,\n// we assume development dependencies are available when it is used.\n/* eslint-disable import/no-extraneous-dependencies */\nimport register from '@babel/register';\nimport JsdomEnv from 'jest-environment-jsdom';\nimport { createFsFromVolume, Volume } from 'memfs';\nimport webpack from 'webpack';\n/* eslint-enable import/no-extraneous-dependencies */\n\nexport default class E2eSsrEnv extends JsdomEnv {\n /**\n * Loads Webpack config, and exposes it to the environment via global\n * webpackConfig object.\n */\n loadWebpackConfig() {\n let options = this.pragmas['webpack-config-options'];\n options = options ? JSON.parse(options) : {};\n defaults(options, {\n context: this.testFolder,\n dontEmitBuildInfo: true,\n });\n\n let factory = this.pragmas['webpack-config-factory'] || '';\n factory = require(path.resolve(this.rootDir, factory));\n this.global.webpackConfig = factory(options);\n this.global.buildInfo = factory.buildInfo;\n }\n\n /**\n * Executes Webpack build.\n * @return {Promise}\n */\n async runWebpack() {\n this.loadWebpackConfig();\n\n const compiler = webpack(this.global.webpackConfig);\n const fs = createFsFromVolume(new Volume());\n compiler.outputFileSystem = fs;\n return new Promise((done, fail) => {\n compiler.run((err, stats) => {\n if (err) fail(err);\n this.global.webpackOutputFs = fs;\n this.global.webpackStats = stats.toJson();\n\n // Keeps reference to the raw Webpack stats object, which should be\n // explicitly passed to the server-side renderer alongside the request,\n // so that it can to pick up asset paths for different named chunks.\n this.webpackStats = stats;\n\n done();\n });\n });\n }\n\n async runSsr() {\n let options = this.pragmas['ssr-options'];\n options = options ? JSON.parse(options) : {};\n\n let root;\n switch (options.root) {\n case 'TEST': root = this.testFolder; break;\n default: root = process.cwd();\n }\n\n // Note: This enables Babel transformation for the code dynamically loaded\n // below, as the usual Jest Babel setup does not seem to apply to\n // the environment code, and imports from it.\n register({\n envName: options.babelEnv,\n extensions: ['.js', '.jsx', '.svg'],\n root,\n });\n\n if (!options.buildInfo) options.buildInfo = this.global.buildInfo;\n\n if (options.entry) {\n const p = path.resolve(this.testFolder, options.entry);\n options.Application = require(p)[options.entryExportName || 'default'];\n }\n\n const renderer = ssrFactory(this.global.webpackConfig, options);\n const markup = await new Promise((done, fail) => {\n renderer(\n this.ssrRequest,\n\n // TODO: This will do for now, with the current implementation of\n // the renderer, but it will require a rework once the renderer is\n // updated to do streaming.\n {\n send: done,\n set: noop,\n\n // This is how up-to-date Webpack stats are passed to the server in\n // development mode, and we use this here always, instead of having\n // to pass some information via filesystem.\n locals: {\n webpack: {\n devMiddleware: {\n stats: this.webpackStats,\n },\n },\n },\n },\n\n (error) => {\n if (error) fail(error);\n else done('');\n },\n );\n });\n\n this.global.ssrMarkup = markup;\n this.global.ssrOptions = options;\n }\n\n constructor(config, context) {\n const pragmas = context.docblockPragmas;\n let request = pragmas['ssr-request'];\n request = request ? JSON.parse(request) : {};\n if (!request.url) request.url = '/';\n\n // This ensures the initial JsDom URL matches the value we use for SSR.\n set(\n config.projectConfig,\n 'testEnvironmentOptions.url',\n `http://localhost${request.url}`,\n );\n\n super(config, context);\n\n this.global.dom = this.dom;\n\n // Extracts necessary settings from config and context.\n const { projectConfig } = config;\n this.rootDir = projectConfig.rootDir;\n this.testFolder = path.dirname(context.testPath);\n this.withSsr = !pragmas['no-ssr'];\n this.ssrRequest = request;\n this.pragmas = pragmas;\n }\n\n async setup() {\n await super.setup();\n await this.runWebpack();\n if (this.withSsr) await this.runSsr();\n this.global.REACT_UTILS_FORCE_CLIENT_SIDE = true;\n }\n\n async teardown() {\n delete this.global.REACT_UTILS_FORCE_CLIENT_SIDE;\n\n // Resets module cache and @babel/register. Effectively this ensures that\n // the next time an instance of this environment is set up, all modules are\n // transformed by Babel from scratch, thus taking into account the latest\n // Babel config (which may change between different environment instances,\n // which does not seem to be taken into account by Babel / Node caches\n // automatically).\n Object.keys(require.cache).forEach((key) => {\n delete require.cache[key];\n });\n register.revert();\n super.teardown();\n }\n}\n"],"mappings":";;;;;;;;;AAiBA;;AACA;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L,GAAeA,OAAf;EACD;;EAEU,MAAL6D,KAAK,GAAG;IACZ,MAAM,MAAMA,KAAN,EAAN;IACA,MAAM,KAAK/C,UAAL,EAAN;IACA,IAAI,KAAK8C,OAAT,EAAkB,MAAM,KAAKhC,MAAL,EAAN;IAClB,KAAKjB,MAAL,CAAYmD,6BAAZ,GAA4C,IAA5C;EACD;;EAEa,MAARC,QAAQ,GAAG;IACf,OAAO,KAAKpD,MAAL,CAAYmD,6BAAnB,CADe,CAGf;IACA;IACA;IACA;IACA;IACA;;IACAE,MAAM,CAACC,IAAP,CAAY1D,OAAO,CAAC2D,KAApB,EAA2BC,OAA3B,CAAoCC,GAAD,IAAS;MAC1C,OAAO7D,OAAO,CAAC2D,KAAR,CAAcE,GAAd,CAAP;IACD,CAFD;;IAGAC,kBAASC,MAAT;;IACA,MAAMP,QAAN;EACD;;AAzJ6C"}
@@ -185,4 +185,4 @@ function snapshot(component) {
185
185
 
186
186
  const simulate = _testUtils.default.Simulate;
187
187
  exports.simulate = simulate;
188
- //# sourceMappingURL=jest.js.map
188
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["global","IS_REACT_ACT_ENVIRONMENT","originalProcessVersions","process","versions","mockClientSide","Object","defineProperty","value","unmockClientSide","writable","getMockUuid","seed","x","toString","padStart","slice","mockTimer","time","mockdate","set","Date","now","jest","advanceTimersByTime","mount","scene","root","res","document","createElement","body","appendChild","destroy","unmount","remove","render","component","Renderer","create","toJSON","shallowRender","renderer","ShallowRenderer","getRenderOutput","shallowSnapshot","expect","toMatchSnapshot","snapshot","simulate","TU","Simulate"],"sources":["../../../../../src/shared/utils/jest/index.jsx"],"sourcesContent":["/* global expect, jest, document */\n/* eslint-disable import/no-extraneous-dependencies */\n\nimport mockdate from 'mockdate';\nimport { createRoot } from 'react-dom/client';\nimport TU, { act } from 'react-dom/test-utils';\n\n/* eslint-disable import/no-extraneous-dependencies */\nimport Renderer from 'react-test-renderer';\nimport ShallowRenderer from 'react-test-renderer/shallow';\n/* eslint-enable import/no-extraneous-dependencies */\n\n/**\n * An alias for [act(..)](https://reactjs.org/docs/test-utils.html#act)\n * from `react-dom/test-utils`.\n * @param {function} action\n */\nexport { act };\n\nglobal.IS_REACT_ACT_ENVIRONMENT = true;\n\nconst originalProcessVersions = process.versions;\n\n/**\n * Tricks **react-utils** into thinking the test is running within client-side\n * (browser) environment.\n */\nexport function mockClientSide() {\n Object.defineProperty(process, 'versions', { value: null });\n}\n\n/**\n * Reverts the effect of {@link module:JU.mockClientSide mockClientSide(..)}.\n */\nexport function unmockClientSide() {\n Object.defineProperty(process, 'versions', {\n value: originalProcessVersions,\n writable: false,\n });\n}\n\n/**\n * Generates a mock UUID, or better said it determenistically transforms given\n * `seed` number into a UUID-formatted string.\n * @param {number} seed\n * @return {string}\n */\nexport function getMockUuid(seed = 0) {\n const x = seed.toString(16).padStart(32, '0');\n return `${x.slice(0, 8)}-${x.slice(8, 12)}-${x.slice(12, 16)}-${x.slice(16, 20)}-${x.slice(20)}`;\n}\n\n/**\n * Advances mock timers, and mock date by the specified time.\n * @param {number} time Time step [ms].\n * @returns {Promise} Wait for this to \"jump after\" any async code which should\n * be executed because of the mock time movement.\n */\nexport async function mockTimer(time) {\n mockdate.set(time + Date.now());\n jest.advanceTimersByTime(time);\n}\n\n/**\n * Mounts `scene` to the DOM, and returns the root scene element.\n * @param {React.ReactNode} scene\n * @return {HTMLElement} Created container DOM element with destroy() function\n * attached.\n */\nexport function mount(scene) {\n let root;\n const res = document.createElement('div');\n document.body.appendChild(res);\n res.destroy = () => {\n act(() => root.unmount());\n res.remove();\n };\n act(() => {\n root = createRoot(res);\n root.render(scene);\n });\n return res;\n}\n\n/* OLD STUFF BELOW THIS MARK */\n\n/**\n * Renders provided ReactJS component into JSON representation of the component\n * tree, using [`react-test-renderer`](https://www.npmjs.com/package/react-test-renderer).\n * @param {object} component ReactJS component to render.\n * @return {object} JSON representation of the rendered tree.\n * @example\n * import { JU } from '@dr.pogodin/react-utils';\n * console.log(JU.render(<div>Example</div>));\n */\nexport function render(component) {\n return Renderer.create(component).toJSON();\n}\n\n/**\n * Generates a shallow render of given ReactJS component, using\n * [react-test-renderer/shallow](https://reactjs.org/docs/shallow-renderer.html)\n * and returns the result.\n * @param {object} component ReactJS component to render.\n * @return {object} JSON representation of the shallow component's render tree.\n */\nexport function shallowRender(component) {\n const renderer = new ShallowRenderer();\n renderer.render(component);\n return renderer.getRenderOutput();\n}\n\n/**\n * Makes a shallow snapshot test of the given ReactJS component, and also\n * returns JSON representation of the rendered component tree. Under the hood\n * it uses {@link module:JU.shallowRender shallowRender(..)} to generate\n * the render, then executes `expect(RENDER_RESULT).toMatchSnapshot()`,\n * and finally returns the `RENDER_RESULT` to the caller.\n * @param {object} component ReactJS component to render.\n * @return {object} JSON representation of shallow render.\n */\nexport function shallowSnapshot(component) {\n const res = shallowRender(component);\n expect(res).toMatchSnapshot();\n return res;\n}\n\n/**\n * Makes snapshot test of the given ReactJS component, and also returns JSON\n * representation of the rendered component tree. Under the hood, it uses\n * {@link module:JU.render render(..)} to render it, then executes\n * `expect(RENDER_RESULT).toMatchSnapshot()`, and then returns `RENDER_RESULT`.\n * @param {object} component ReactJS component to render.\n * @return {object} JSON render of the component.\n */\nexport function snapshot(component) {\n const res = render(component);\n expect(res).toMatchSnapshot();\n return res;\n}\n\nexport const simulate = TU.Simulate;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AACA;;AAGA;;AACA;;;;;;AATA;;AACA;;AAMA;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AAGAA,MAAM,CAACC,wBAAP,GAAkC,IAAlC;AAEA,MAAMC,uBAAuB,GAAGC,OAAO,CAACC,QAAxC;AAEA;AACA;AACA;AACA;;AACO,SAASC,cAAT,GAA0B;EAC/BC,MAAM,CAACC,cAAP,CAAsBJ,OAAtB,EAA+B,UAA/B,EAA2C;IAAEK,KAAK,EAAE;EAAT,CAA3C;AACD;A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CAAP;IACAD,IAAI,CAACS,MAAL,CAAYV,KAAZ;EACD,CAHD;EAIA,OAAOE,GAAP;AACD;AAED;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASQ,MAAT,CAAgBC,SAAhB,EAA2B;EAChC,OAAOC,2BAASC,MAAT,CAAgBF,SAAhB,EAA2BG,MAA3B,EAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,aAAT,CAAuBJ,SAAvB,EAAkC;EACvC,MAAMK,QAAQ,GAAG,IAAIC,gBAAJ,EAAjB;EACAD,QAAQ,CAACN,MAAT,CAAgBC,SAAhB;EACA,OAAOK,QAAQ,CAACE,eAAT,EAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,eAAT,CAAyBR,SAAzB,EAAoC;EACzC,MAAMT,GAAG,GAAGa,aAAa,CAACJ,SAAD,CAAzB;EACAS,MAAM,CAAClB,GAAD,CAAN,CAAYmB,eAAZ;EACA,OAAOnB,GAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASoB,QAAT,CAAkBX,SAAlB,EAA6B;EAClC,MAAMT,GAAG,GAAGQ,MAAM,CAACC,SAAD,CAAlB;EACAS,MAAM,CAAClB,GAAD,CAAN,CAAYmB,eAAZ;EACA,OAAOnB,GAAP;AACD;;AAEM,MAAMqB,QAAQ,GAAGC,mBAAGC,QAApB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/shared/utils/splitComponent.js"],"names":["splitComponent","chunkName","getComponent","placeholder","children","props","CodeSplit"],"mappings":";;;;;;;;;AAEA;;AAEA;;AAJA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,cAAT,CAAwB;AACrCC,EAAAA,SADqC;AAErCC,EAAAA,YAFqC;AAGrCC,EAAAA;AAHqC,CAAxB,EAIZ;AACD;AACA,SAAO,CAAC;AAAEC,IAAAA,QAAF;AAAY,OAAGC;AAAf,MAAyB,EAA1B,kBAAiC,0BACtCC,kBADsC,EAEtC,EACE,GAAGD,KADL;AAEEJ,IAAAA,SAFF;AAGEC,IAAAA,YAHF;AAIEC,IAAAA;AAJF,GAFsC,EAQtCC,QARsC,CAAxC;AAUD","sourcesContent":["/* eslint-disable react/jsx-props-no-spreading */\n\nimport { createElement } from 'react';\n\nimport CodeSplit from 'components/CodeSplit';\n\n/**\n * Wraps a regular React component into a \"code splitting\" component,\n * i.e. all code used exclusively by that component and its sub-tree\n * will go into a separate, asynchronously loaded, code chunk for\n * the client-side.\n * @param {object} options\n * @param {string} options.chunkName\n * @param {function} options.getComponent\n * @param {React.Element} [options.placeholder]\n * @return {React.ElementType}\n */\nexport default function splitComponent({\n chunkName,\n getComponent,\n placeholder,\n}) {\n // eslint-disable-next-line react/prop-types\n return ({ children, ...props } = {}) => createElement(\n CodeSplit,\n {\n ...props,\n chunkName,\n getComponent,\n placeholder,\n },\n children,\n );\n}\n"],"file":"splitComponent.js"}
1
+ {"version":3,"file":"splitComponent.js","names":["splitComponent","chunkName","getComponent","placeholder","children","props","CodeSplit"],"sources":["../../../../src/shared/utils/splitComponent.js"],"sourcesContent":["/* eslint-disable react/jsx-props-no-spreading */\n\nimport { createElement } from 'react';\n\nimport CodeSplit from 'components/CodeSplit';\n\n/**\n * Wraps a regular React component into a \"code splitting\" component,\n * i.e. all code used exclusively by that component and its sub-tree\n * will go into a separate, asynchronously loaded, code chunk for\n * the client-side.\n * @param {object} options\n * @param {string} options.chunkName\n * @param {function} options.getComponent\n * @param {React.Element} [options.placeholder]\n * @return {React.ElementType}\n */\nexport default function splitComponent({\n chunkName,\n getComponent,\n placeholder,\n}) {\n // eslint-disable-next-line react/prop-types\n return ({ children, ...props } = {}) => createElement(\n CodeSplit,\n {\n ...props,\n chunkName,\n getComponent,\n placeholder,\n },\n children,\n );\n}\n"],"mappings":";;;;;;;;;AAEA;;AAEA;;AAJA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,cAAT,CAAwB;EACrCC,SADqC;EAErCC,YAFqC;EAGrCC;AAHqC,CAAxB,EAIZ;EACD;EACA,OAAO,CAAC;IAAEC,QAAF;IAAY,GAAGC;EAAf,IAAyB,EAA1B,kBAAiC,0BACtCC,kBADsC,EAEtC,EACE,GAAGD,KADL;IAEEJ,SAFF;IAGEC,YAHF;IAIEC;EAJF,CAFsC,EAQtCC,QARsC,CAAxC;AAUD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/shared/utils/time.js"],"names":["dayjs","SEC_MS","MIN_MS","HOUR_MS","DAY_MS","YEAR_MS","now","Date","timer","timeout","res","Barrier","id","setTimeout","resolve","bind","abort","clearTimeout"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACAA,eAAMC,MAAN,GAAe,IAAf;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACAD,eAAME,MAAN,GAAe,KAAKF,eAAMC,MAA1B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACAD,eAAMG,OAAN,GAAgB,KAAKH,eAAME,MAA3B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACAF,eAAMI,MAAN,GAAe,KAAKJ,eAAMG,OAA1B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACAH,eAAMK,OAAN,GAAgB,MAAML,eAAMI,MAA5B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACAJ,eAAMM,GAAN,GAAYC,IAAI,CAACD,GAAjB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACAN,eAAMQ,KAAN,GAAc,eAAeA,KAAf,CAAqBC,OAArB,EAA8B;AAC1C,QAAMC,GAAG,GAAG,IAAIC,gBAAJ,EAAZ;AACA,QAAMC,EAAE,GAAGC,UAAU,CAACH,GAAG,CAACI,OAAJ,CAAYC,IAAZ,CAAiBL,GAAjB,CAAD,EAAwBD,OAAxB,CAArB;;AACAC,EAAAA,GAAG,CAACM,KAAJ,GAAY,MAAMC,YAAY,CAACL,EAAD,CAA9B;;AACA,SAAOF,GAAP;AACD,CALD;;eAOeV,c","sourcesContent":["import dayjs from 'dayjs';\nimport { Barrier } from './Barrier';\n\n/**\n * @static\n * @const SEC_MS\n * @desc One second, expressed in milliseconds (equals 1000 ms).\n * @example\n * import { time } from '@dr.pogodin/react-utils';\n * console.log(time.SEC_MS); // Prints: 1000\n */\ndayjs.SEC_MS = 1000;\n\n/**\n * @static\n * @const MIN_MS\n * @desc One minute, expressed in milliseconds (equals 60 &times; `SEC_MS`).\n * @example\n * import { time } from '@dr.pogodin/react-utils';\n * console.log(time.MIN_MS); // Prints: 60000\n */\ndayjs.MIN_MS = 60 * dayjs.SEC_MS;\n\n/**\n * @static\n * @const HOUR_MS\n * @desc One hour, expressed in milliseconds (equals 60 &times; `MIN_MS`).\n * @example\n * import { time } from '@dr.pogodin/react-utils';\n * console.log(time.HOUR_MS); // Prints: 3600000\n */\ndayjs.HOUR_MS = 60 * dayjs.MIN_MS;\n\n/**\n * @static\n * @const DAY_MS\n * @desc One day, expressed in milliseconds (equals 24 &times; `HOUR_MS`).\n * @example\n * import { time } from '@dr.pogodin/react-utils';\n * console.log(time.DAY_MS); // Prints: 86400000\n */\ndayjs.DAY_MS = 24 * dayjs.HOUR_MS;\n\n/**\n * @static\n * @const YEAR_MS\n * @desc One year, expressed in milliseconds (equals 365 &times; `DAY_MS`,\n * thus a normal, non-leap year).\n * @example\n * import { time } from '@dr.pogodin/react-utils';\n * console.log(time.YEAR_MS); // Prints: 31536000000\n */\ndayjs.YEAR_MS = 365 * dayjs.DAY_MS;\n\n/**\n * @static\n * @func now\n * @desc Returns Unix timestamp [ms] (thus, it is just an alias for `Date.now`).\n * @return {number}\n * @example\n * import { time } from '@dr.pogodin/react-utils';\n * console.log(time.now()); // Prints the current timestamp, e.g. 1618608761000.\n */\ndayjs.now = Date.now;\n\n/**\n * Creates a Promise, which resolves after the given timeout.\n * @param {number} timeout Timeout [ms].\n * @return {Barrier} Resolves after the timeout. It has additional\n * .abort() method attached, which cancels the pending timer resolution\n * (without resolving or rejecting the barrier).\n */\ndayjs.timer = async function timer(timeout) {\n const res = new Barrier();\n const id = setTimeout(res.resolve.bind(res), timeout);\n res.abort = () => clearTimeout(id);\n return res;\n};\n\nexport default dayjs;\n"],"file":"time.js"}
1
+ {"version":3,"file":"time.js","names":["dayjs","SEC_MS","MIN_MS","HOUR_MS","DAY_MS","YEAR_MS","now","Date","timer","timeout","res","Barrier","id","setTimeout","resolve","bind","abort","clearTimeout"],"sources":["../../../../src/shared/utils/time.js"],"sourcesContent":["import dayjs from 'dayjs';\nimport { Barrier } from './Barrier';\n\n/**\n * @static\n * @const SEC_MS\n * @desc One second, expressed in milliseconds (equals 1000 ms).\n * @example\n * import { time } from '@dr.pogodin/react-utils';\n * console.log(time.SEC_MS); // Prints: 1000\n */\ndayjs.SEC_MS = 1000;\n\n/**\n * @static\n * @const MIN_MS\n * @desc One minute, expressed in milliseconds (equals 60 &times; `SEC_MS`).\n * @example\n * import { time } from '@dr.pogodin/react-utils';\n * console.log(time.MIN_MS); // Prints: 60000\n */\ndayjs.MIN_MS = 60 * dayjs.SEC_MS;\n\n/**\n * @static\n * @const HOUR_MS\n * @desc One hour, expressed in milliseconds (equals 60 &times; `MIN_MS`).\n * @example\n * import { time } from '@dr.pogodin/react-utils';\n * console.log(time.HOUR_MS); // Prints: 3600000\n */\ndayjs.HOUR_MS = 60 * dayjs.MIN_MS;\n\n/**\n * @static\n * @const DAY_MS\n * @desc One day, expressed in milliseconds (equals 24 &times; `HOUR_MS`).\n * @example\n * import { time } from '@dr.pogodin/react-utils';\n * console.log(time.DAY_MS); // Prints: 86400000\n */\ndayjs.DAY_MS = 24 * dayjs.HOUR_MS;\n\n/**\n * @static\n * @const YEAR_MS\n * @desc One year, expressed in milliseconds (equals 365 &times; `DAY_MS`,\n * thus a normal, non-leap year).\n * @example\n * import { time } from '@dr.pogodin/react-utils';\n * console.log(time.YEAR_MS); // Prints: 31536000000\n */\ndayjs.YEAR_MS = 365 * dayjs.DAY_MS;\n\n/**\n * @static\n * @func now\n * @desc Returns Unix timestamp [ms] (thus, it is just an alias for `Date.now`).\n * @return {number}\n * @example\n * import { time } from '@dr.pogodin/react-utils';\n * console.log(time.now()); // Prints the current timestamp, e.g. 1618608761000.\n */\ndayjs.now = Date.now;\n\n/**\n * Creates a Promise, which resolves after the given timeout.\n * @param {number} timeout Timeout [ms].\n * @return {Barrier} Resolves after the timeout. It has additional\n * .abort() method attached, which cancels the pending timer resolution\n * (without resolving or rejecting the barrier).\n */\ndayjs.timer = async function timer(timeout) {\n const res = new Barrier();\n const id = setTimeout(res.resolve.bind(res), timeout);\n res.abort = () => clearTimeout(id);\n return res;\n};\n\nexport default dayjs;\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACAA,eAAMC,MAAN,GAAe,IAAf;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACAD,eAAME,MAAN,GAAe,KAAKF,eAAMC,MAA1B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACAD,eAAMG,OAAN,GAAgB,KAAKH,eAAME,MAA3B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACAF,eAAMI,MAAN,GAAe,KAAKJ,eAAMG,OAA1B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACAH,eAAMK,OAAN,GAAgB,MAAML,eAAMI,MAA5B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACAJ,eAAMM,GAAN,GAAYC,IAAI,CAACD,GAAjB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACAN,eAAMQ,KAAN,GAAc,eAAeA,KAAf,CAAqBC,OAArB,EAA8B;EAC1C,MAAMC,GAAG,GAAG,IAAIC,gBAAJ,EAAZ;EACA,MAAMC,EAAE,GAAGC,UAAU,CAACH,GAAG,CAACI,OAAJ,CAAYC,IAAZ,CAAiBL,GAAjB,CAAD,EAAwBD,OAAxB,CAArB;;EACAC,GAAG,CAACM,KAAJ,GAAY,MAAMC,YAAY,CAACL,EAAD,CAA9B;;EACA,OAAOF,GAAP;AACD,CALD;;eAOeV,c"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/shared/utils/webpack.js"],"names":["requireWeak","modulePath","basePath","IS_CLIENT_SIDE","resolve","eval","path","default","def","named","Object","entries","forEach","key","value","Error","resolveWeak"],"mappings":";;;;;;;;AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,WAAT,CAAqBC,UAArB,EAAiCC,QAAjC,EAA2C;AAChD,MAAIC,yBAAJ,EAAoB,OAAO,IAAP;;AAEpB,MAAI;AACF;AACA,UAAM;AAAEC,MAAAA;AAAF,QAAcC,IAAI,CAAC,SAAD,CAAJ,CAAgB,MAAhB,CAApB;AACA,UAAMC,IAAI,GAAGJ,QAAQ,GAAGE,OAAO,CAACF,QAAD,EAAWD,UAAX,CAAV,GAAmCA,UAAxD;AACA,UAAM;AAAEM,MAAAA,OAAO,EAAEC,GAAX;AAAgB,SAAGC;AAAnB,QAA6BJ,IAAI,CAAC,SAAD,CAAJ,CAAgBC,IAAhB,CAAnC;AACA;;AAEA,QAAI,CAACE,GAAL,EAAU,OAAOC,KAAP;AAEVC,IAAAA,MAAM,CAACC,OAAP,CAAeF,KAAf,EAAsBG,OAAtB,CAA8B,CAAC,CAACC,GAAD,EAAMC,KAAN,CAAD,KAAkB;AAC9C,UAAIN,GAAG,CAACK,GAAD,CAAP,EAAc,MAAME,KAAK,CAAC,4CAAD,CAAX;AACdP,MAAAA,GAAG,CAACK,GAAD,CAAH,GAAWC,KAAX;AACD,KAHD;AAIA,WAAON,GAAP;AACD,GAdD,CAcE,MAAM;AACN,WAAO,IAAP;AACD;AACF;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASQ,WAAT,CAAqBf,UAArB,EAAiC;AACtC,SAAOA,UAAP;AACD","sourcesContent":["import { IS_CLIENT_SIDE } from './isomorphy';\n\n/**\n * Requires the specified module without including it into the bundle during\n * Webpack build.\n * @param {string} modulePath\n * @param {string} [basePath]\n * @return {object} Required module.\n */\nexport function requireWeak(modulePath, basePath) {\n if (IS_CLIENT_SIDE) return null;\n\n try {\n /* eslint-disable no-eval */\n const { resolve } = eval('require')('path');\n const path = basePath ? resolve(basePath, modulePath) : modulePath;\n const { default: def, ...named } = eval('require')(path);\n /* eslint-enable no-eval */\n\n if (!def) return named;\n\n Object.entries(named).forEach(([key, value]) => {\n if (def[key]) throw Error('Conflict between default and named exports');\n def[key] = value;\n });\n return def;\n } catch {\n return null;\n }\n}\n\n/**\n * Resolves specified module path with help of Babel's module resolver.\n * Yes, the function itself just returns its argument to the caller, but Babel\n * is configured to resolve the first argument of resolveWeak(..) function, thus\n * the result will be the resolved path.\n * @param {string} modulePath\n * @return {string} Absolute or relative path to the module.\n */\nexport function resolveWeak(modulePath) {\n return modulePath;\n}\n"],"file":"webpack.js"}
1
+ {"version":3,"file":"webpack.js","names":["requireWeak","modulePath","basePath","IS_CLIENT_SIDE","resolve","eval","path","default","def","named","Object","entries","forEach","key","value","Error","resolveWeak"],"sources":["../../../../src/shared/utils/webpack.js"],"sourcesContent":["import { IS_CLIENT_SIDE } from './isomorphy';\n\n/**\n * Requires the specified module without including it into the bundle during\n * Webpack build.\n * @param {string} modulePath\n * @param {string} [basePath]\n * @return {object} Required module.\n */\nexport function requireWeak(modulePath, basePath) {\n if (IS_CLIENT_SIDE) return null;\n\n try {\n /* eslint-disable no-eval */\n const { resolve } = eval('require')('path');\n const path = basePath ? resolve(basePath, modulePath) : modulePath;\n const { default: def, ...named } = eval('require')(path);\n /* eslint-enable no-eval */\n\n if (!def) return named;\n\n Object.entries(named).forEach(([key, value]) => {\n if (def[key]) throw Error('Conflict between default and named exports');\n def[key] = value;\n });\n return def;\n } catch {\n return null;\n }\n}\n\n/**\n * Resolves specified module path with help of Babel's module resolver.\n * Yes, the function itself just returns its argument to the caller, but Babel\n * is configured to resolve the first argument of resolveWeak(..) function, thus\n * the result will be the resolved path.\n * @param {string} modulePath\n * @return {string} Absolute or relative path to the module.\n */\nexport function resolveWeak(modulePath) {\n return modulePath;\n}\n"],"mappings":";;;;;;;;AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,WAAT,CAAqBC,UAArB,EAAiCC,QAAjC,EAA2C;EAChD,IAAIC,yBAAJ,EAAoB,OAAO,IAAP;;EAEpB,IAAI;IACF;IACA,MAAM;MAAEC;IAAF,IAAcC,IAAI,CAAC,SAAD,CAAJ,CAAgB,MAAhB,CAApB;IACA,MAAMC,IAAI,GAAGJ,QAAQ,GAAGE,OAAO,CAACF,QAAD,EAAWD,UAAX,CAAV,GAAmCA,UAAxD;IACA,MAAM;MAAEM,OAAO,EAAEC,GAAX;MAAgB,GAAGC;IAAnB,IAA6BJ,IAAI,CAAC,SAAD,CAAJ,CAAgBC,IAAhB,CAAnC;IACA;;IAEA,IAAI,CAACE,GAAL,EAAU,OAAOC,KAAP;IAEVC,MAAM,CAACC,OAAP,CAAeF,KAAf,EAAsBG,OAAtB,CAA8B,CAAC,CAACC,GAAD,EAAMC,KAAN,CAAD,KAAkB;MAC9C,IAAIN,GAAG,CAACK,GAAD,CAAP,EAAc,MAAME,KAAK,CAAC,4CAAD,CAAX;MACdP,GAAG,CAACK,GAAD,CAAH,GAAWC,KAAX;IACD,CAHD;IAIA,OAAON,GAAP;EACD,CAdD,CAcE,MAAM;IACN,OAAO,IAAP;EACD;AACF;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASQ,WAAT,CAAqBf,UAArB,EAAiC;EACtC,OAAOA,UAAP;AACD"}
@@ -266,7 +266,7 @@ eval("var __dirname = \"/\";\n__webpack_require__.r(__webpack_exports__);\n/* ha
266
266
  \***************************************/
267
267
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
268
268
 
269
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"IS_CLIENT_SIDE\": function() { return /* binding */ IS_CLIENT_SIDE; },\n/* harmony export */ \"IS_SERVER_SIDE\": function() { return /* binding */ IS_SERVER_SIDE; },\n/* harmony export */ \"buildTimestamp\": function() { return /* binding */ buildTimestamp; },\n/* harmony export */ \"getBuildInfo\": function() { return /* binding */ getBuildInfo; },\n/* harmony export */ \"isDevBuild\": function() { return /* binding */ isDevBuild; },\n/* harmony export */ \"isProdBuild\": function() { return /* binding */ isProdBuild; }\n/* harmony export */ });\n/* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/typeof */ \"@babel/runtime/helpers/typeof\");\n/* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__);\n\n\n/* global window */\n\n/**\n * `true` within client-side environment (browser), `false` at server-side.\n */\nvar IS_CLIENT_SIDE = (typeof process === \"undefined\" ? \"undefined\" : _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default()(process)) !== 'object' || !process.versions || !process.versions.node;\n/**\n * `true` within the server-side environment (node), `false` at client-side.\n */\n\nvar IS_SERVER_SIDE = !IS_CLIENT_SIDE;\n/**\n * @ignore\n * @return {string} Code mode: \"development\" or \"production\".\n */\n\nfunction getMode() {\n return \"development\";\n}\n/**\n * Returns `true` if development version of the code is running;\n * `false` otherwise.\n * @return {boolean}\n */\n\n\nfunction isDevBuild() {\n return getMode() === 'development';\n}\n/**\n * Returns `true` if production build of the code is running;\n * `false` otherwise.\n * @return {boolean}\n */\n\nfunction isProdBuild() {\n return getMode() === 'production';\n}\n/**\n * Returns build info object.\n * @returns {object}\n */\n\nfunction getBuildInfo() {\n return (IS_CLIENT_SIDE ? window : __webpack_require__.g).TRU_BUILD_INFO;\n}\n/**\n * Returns build timestamp of the front-end JS bundle.\n * @return {string} ISO date/time string.\n */\n\nfunction buildTimestamp() {\n return getBuildInfo().timestamp;\n}\n\n//# sourceURL=webpack://@dr.pogodin/react-utils/./src/shared/utils/isomorphy.js?");
269
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"IS_CLIENT_SIDE\": function() { return /* binding */ IS_CLIENT_SIDE; },\n/* harmony export */ \"IS_SERVER_SIDE\": function() { return /* binding */ IS_SERVER_SIDE; },\n/* harmony export */ \"buildTimestamp\": function() { return /* binding */ buildTimestamp; },\n/* harmony export */ \"getBuildInfo\": function() { return /* binding */ getBuildInfo; },\n/* harmony export */ \"isDevBuild\": function() { return /* binding */ isDevBuild; },\n/* harmony export */ \"isProdBuild\": function() { return /* binding */ isProdBuild; }\n/* harmony export */ });\n/* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/typeof */ \"@babel/runtime/helpers/typeof\");\n/* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__);\n\n\n/* global window */\n\n/**\n * `true` within client-side environment (browser), `false` at server-side.\n */\nvar IS_CLIENT_SIDE = (typeof process === \"undefined\" ? \"undefined\" : _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default()(process)) !== 'object' || !process.versions || !process.versions.node || !!__webpack_require__.g.REACT_UTILS_FORCE_CLIENT_SIDE;\n/**\n * `true` within the server-side environment (node), `false` at client-side.\n */\n\nvar IS_SERVER_SIDE = !IS_CLIENT_SIDE;\n/**\n * @ignore\n * @return {string} Code mode: \"development\" or \"production\".\n */\n\nfunction getMode() {\n return \"development\";\n}\n/**\n * Returns `true` if development version of the code is running;\n * `false` otherwise.\n * @return {boolean}\n */\n\n\nfunction isDevBuild() {\n return getMode() === 'development';\n}\n/**\n * Returns `true` if production build of the code is running;\n * `false` otherwise.\n * @return {boolean}\n */\n\nfunction isProdBuild() {\n return getMode() === 'production';\n}\n/**\n * Returns build info object.\n * @returns {object}\n */\n\nfunction getBuildInfo() {\n return (IS_CLIENT_SIDE ? window : __webpack_require__.g).TRU_BUILD_INFO;\n}\n/**\n * Returns build timestamp of the front-end JS bundle.\n * @return {string} ISO date/time string.\n */\n\nfunction buildTimestamp() {\n return getBuildInfo().timestamp;\n}\n\n//# sourceURL=webpack://@dr.pogodin/react-utils/./src/shared/utils/isomorphy.js?");
270
270
 
271
271
  /***/ }),
272
272
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/index.jsx"],"names":["Launch","Application","options","container","document","getElementById","scene","window","ISTATE","dontHydrate","root","render"],"mappings":"6FAGA,gEAEA,wCACA,gD,6CANA;AACA,6B,CAOA;AACA;AACA;AACA;AACA,GACe,QAASA,CAAAA,MAAT,CAAgBC,WAAhB,CAA2C,IAAdC,CAAAA,OAAc,2DAAJ,EAAI,CACxD,GAAMC,CAAAA,SAAS,CAAGC,QAAQ,CAACC,cAAT,CAAwB,YAAxB,CAAlB,CACA,GAAMC,CAAAA,KAAK,cACT,oBAAC,qCAAD,EAAqB,YAAY,CAAEC,MAAM,CAACC,MAA1C,uBACE,oBAAC,6BAAD,wBACE,oBAAC,WAAD,IADF,EADF,EADF,CAQA,GAAIN,OAAO,CAACO,WAAZ,CAAyB,CACvB,GAAMC,CAAAA,IAAI,CAAG,uBAAWP,SAAX,CAAb,CACAO,IAAI,CAACC,MAAL,CAAYL,KAAZ,CACD,CAHD,IAGO,wBAAYH,SAAZ,CAAuBG,KAAvB,CACR","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"],"file":"index.js"}
1
+ {"version":3,"file":"index.js","names":["Launch","Application","options","container","document","getElementById","scene","window","ISTATE","dontHydrate","root","render"],"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":"6FAGA,gEAEA,wCACA,gD,6CANA;AACA,6B,CAOA;AACA;AACA;AACA;AACA,GACe,QAASA,CAAAA,MAAT,CAAgBC,WAAhB,CAA2C,IAAdC,CAAAA,OAAc,2DAAJ,EAAI,CACxD,GAAMC,CAAAA,SAAS,CAAGC,QAAQ,CAACC,cAAT,CAAwB,YAAxB,CAAlB,CACA,GAAMC,CAAAA,KAAK,cACT,oBAAC,qCAAD,EAAqB,YAAY,CAAEC,MAAM,CAACC,MAA1C,uBACE,oBAAC,6BAAD,wBACE,oBAAC,WAAD,IADF,EADF,EADF,CAQA,GAAIN,OAAO,CAACO,WAAZ,CAAyB,CACvB,GAAMC,CAAAA,IAAI,CAAG,uBAAWP,SAAX,CAAb,CACAO,IAAI,CAACC,MAAL,CAAYL,KAAZ,CACD,CAHD,IAGO,wBAAYH,SAAZ,CAAuBG,KAAvB,CACR"}
@@ -4,7 +4,7 @@
4
4
  // is bundled into client-side code.
5
5
  /* `BUILD_INFO` is always injected by Webpack build, but this check is needed
6
6
  * to adopt the code for usage in tests. */if(typeof BUILD_INFO!=="undefined"){window.TRU_BUILD_INFO=BUILD_INFO}/* Removes data injection script out of the document.
7
- * The if block is here for test purposes. */if(!window.TRU_KEEP_INJ_SCRIPT){var block=document.querySelector("script[id=\"inj\"]");if(block)document.getElementsByTagName("body")[0].removeChild(block)}/* TODO: A proper logger should be moved to `@dr.pogodin/react-utils`. */ /* eslint-disable no-console */var useServiceWorker=window.TRU_BUILD_INFO.useServiceWorker;if(useServiceWorker){var _window=window,navigator=_window.navigator;if("serviceWorker"in navigator){window.addEventListener("load",/*#__PURE__*/(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(){var reg;return _regenerator.default.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.prev=0;_context.next=3;return navigator.serviceWorker.register("/__service-worker.js");case 3:reg=_context.sent;console.log("SW registered:",reg);_context.next=10;break;case 7:_context.prev=7;_context.t0=_context["catch"](0);console.log("SW registration failed:",_context.t0);case 10:case"end":return _context.stop();}}},_callee,null,[[0,7]])})))}}/* eslint-enable no-console */ /* Decodes data injected at the server side. */if(window.INJ){var key=window.TRU_BUILD_INFO.key;var data=_forge.default.util.decode64(window.INJ);var decipher=_forge.default.cipher.createDecipher("AES-CBC",key);decipher.start({iv:data.slice(0,32)});decipher.update(_forge.default.util.createBuffer(data.slice(32)));decipher.finish();data=_forge.default.util.decodeUtf8(decipher.output.data);data=eval("(".concat(data,")"));// eslint-disable-line no-eval
7
+ * The if block is here for test purposes. */if(!window.TRU_KEEP_INJ_SCRIPT){var block=document.querySelector("script[id=\"inj\"]");if(block)document.getElementsByTagName("body")[0].removeChild(block)}/* TODO: A proper logger should be moved to `@dr.pogodin/react-utils`. */ /* eslint-disable no-console */var _window$TRU_BUILD_INF=window.TRU_BUILD_INFO,publicPath=_window$TRU_BUILD_INF.publicPath,useServiceWorker=_window$TRU_BUILD_INF.useServiceWorker;if(useServiceWorker){var _window=window,navigator=_window.navigator;if("serviceWorker"in navigator){window.addEventListener("load",/*#__PURE__*/(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(){var reg;return _regenerator.default.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.prev=0;_context.next=3;return navigator.serviceWorker.register("".concat(publicPath,"/__service-worker.js"));case 3:reg=_context.sent;console.log("SW registered:",reg);_context.next=10;break;case 7:_context.prev=7;_context.t0=_context["catch"](0);console.log("SW registration failed:",_context.t0);case 10:case"end":return _context.stop();}}},_callee,null,[[0,7]])})))}}/* eslint-enable no-console */ /* Decodes data injected at the server side. */if(window.INJ){var key=window.TRU_BUILD_INFO.key;var data=_forge.default.util.decode64(window.INJ);var decipher=_forge.default.cipher.createDecipher("AES-CBC",key);decipher.start({iv:data.slice(0,32)});decipher.update(_forge.default.util.createBuffer(data.slice(32)));decipher.finish();data=_forge.default.util.decodeUtf8(decipher.output.data);data=eval("(".concat(data,")"));// eslint-disable-line no-eval
8
8
  window.CHUNK_GROUPS=data.CHUNK_GROUPS;window.CONFIG=data.CONFIG;window.ISTATE=data.ISTATE}else{// This is possible when the client-side bundle is launched as a stand-alone
9
9
  // precompiled website, rather than served by react-utils' based server.
10
10
  window.CHUNK_GROUPS={};window.CONFIG={}}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/init.js"],"names":["BUILD_INFO","window","TRU_BUILD_INFO","TRU_KEEP_INJ_SCRIPT","block","document","querySelector","getElementsByTagName","removeChild","useServiceWorker","navigator","addEventListener","serviceWorker","register","reg","console","log","INJ","key","data","forge","util","decode64","decipher","cipher","createDecipher","start","iv","slice","update","createBuffer","finish","decodeUtf8","output","eval","CHUNK_GROUPS","CONFIG","ISTATE"],"mappings":"iRAQA,mEACA,8BATA;AACA;AACA,G,CAEA,yC,CAEA;AACA;AAIA;AACA,2CACA,GAAI,MAAOA,CAAAA,UAAP,GAAsB,WAA1B,CAAuC,CACrCC,MAAM,CAACC,cAAP,CAAwBF,UACzB,CAED;AACA,6CACA,GAAI,CAACC,MAAM,CAACE,mBAAZ,CAAiC,CAC/B,GAAMC,CAAAA,KAAK,CAAGC,QAAQ,CAACC,aAAT,CAAuB,oBAAvB,CAAd,CACA,GAAIF,KAAJ,CAAWC,QAAQ,CAACE,oBAAT,CAA8B,MAA9B,EAAsC,CAAtC,EAAyCC,WAAzC,CAAqDJ,KAArD,CACZ,CAED,yE,CACA,+BACA,GAAQK,CAAAA,gBAAR,CAA6BR,MAAM,CAACC,cAApC,CAAQO,gBAAR,CACA,GAAIA,gBAAJ,CAAsB,CACpB,YAAsBR,MAAtB,CAAQS,SAAR,SAAQA,SAAR,CACA,GAAI,iBAAmBA,CAAAA,SAAvB,CAAkC,CAChCT,MAAM,CAACU,gBAAP,CAAwB,MAAxB,oFAAgC,kLAEVD,CAAAA,SAAS,CACxBE,aADe,CACDC,QADC,CACQ,sBADR,CAFU,QAEtBC,GAFsB,eAI5BC,OAAO,CAACC,GAAR,CAAY,gBAAZ,CAA8BF,GAA9B,EAJ4B,+EAM5BC,OAAO,CAACC,GAAR,CAAY,yBAAZ,cAN4B,mEAAhC,GASD,CACF,CACD,8B,CAEA,+CACA,GAAIf,MAAM,CAACgB,GAAX,CAAgB,CACd,GAAQC,CAAAA,GAAR,CAAgBjB,MAAM,CAACC,cAAvB,CAAQgB,GAAR,CACA,GAAIC,CAAAA,IAAI,CAAGC,eAAMC,IAAN,CAAWC,QAAX,CAAoBrB,MAAM,CAACgB,GAA3B,CAAX,CACA,GAAMM,CAAAA,QAAQ,CAAGH,eAAMI,MAAN,CAAaC,cAAb,CAA4B,SAA5B,CAAuCP,GAAvC,CAAjB,CACAK,QAAQ,CAACG,KAAT,CAAe,CAAEC,EAAE,CAAER,IAAI,CAACS,KAAL,CAAW,CAAX,CAAc,EAAd,CAAN,CAAf,EACAL,QAAQ,CAACM,MAAT,CAAgBT,eAAMC,IAAN,CAAWS,YAAX,CAAwBX,IAAI,CAACS,KAAL,CAAW,EAAX,CAAxB,CAAhB,EACAL,QAAQ,CAACQ,MAAT,GAEAZ,IAAI,CAAGC,eAAMC,IAAN,CAAWW,UAAX,CAAsBT,QAAQ,CAACU,MAAT,CAAgBd,IAAtC,CAAP,CACAA,IAAI,CAAGe,IAAI,YAAKf,IAAL,MAAX,CAA0B;AAE1BlB,MAAM,CAACkC,YAAP,CAAsBhB,IAAI,CAACgB,YAA3B,CACAlC,MAAM,CAACmC,MAAP,CAAgBjB,IAAI,CAACiB,MAArB,CACAnC,MAAM,CAACoC,MAAP,CAAgBlB,IAAI,CAACkB,MACtB,CAdD,IAcO,CACL;AACA;AACApC,MAAM,CAACkC,YAAP,CAAsB,EAAtB,CACAlC,MAAM,CAACmC,MAAP,CAAgB,EACjB","sourcesContent":["/**\n * Initialization of client-side environment.\n */\n\n/* global BUILD_INFO, document, window */\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 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"],"file":"init.js"}
1
+ {"version":3,"file":"init.js","names":["BUILD_INFO","window","TRU_BUILD_INFO","TRU_KEEP_INJ_SCRIPT","block","document","querySelector","getElementsByTagName","removeChild","publicPath","useServiceWorker","navigator","addEventListener","serviceWorker","register","reg","console","log","INJ","key","data","forge","util","decode64","decipher","cipher","createDecipher","start","iv","slice","update","createBuffer","finish","decodeUtf8","output","eval","CHUNK_GROUPS","CONFIG","ISTATE"],"sources":["../../../src/client/init.js"],"sourcesContent":["/**\n * Initialization of client-side environment.\n */\n\n/* global BUILD_INFO, document, window */\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 { publicPath, useServiceWorker } = window.TRU_BUILD_INFO;\nif (useServiceWorker) {\n const { navigator } = window;\n if ('serviceWorker' in navigator) {\n window.addEventListener('load', async () => {\n try {\n const reg = await navigator\n .serviceWorker.register(`${publicPath}/__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"],"mappings":"iRAQA,mEACA,8BATA;AACA;AACA,G,CAEA,yC,CAEA;AACA;AAIA;AACA,2CACA,GAAI,MAAOA,CAAAA,UAAP,GAAsB,WAA1B,CAAuC,CACrCC,MAAM,CAACC,cAAP,CAAwBF,UACzB,CAED;AACA,6CACA,GAAI,CAACC,MAAM,CAACE,mBAAZ,CAAiC,CAC/B,GAAMC,CAAAA,KAAK,CAAGC,QAAQ,CAACC,aAAT,CAAuB,oBAAvB,CAAd,CACA,GAAIF,KAAJ,CAAWC,QAAQ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IAAI,CAAGe,IAAI,YAAKf,IAAL,MAAX,CAA0B;AAE1BnB,MAAM,CAACmC,YAAP,CAAsBhB,IAAI,CAACgB,YAA3B,CACAnC,MAAM,CAACoC,MAAP,CAAgBjB,IAAI,CAACiB,MAArB,CACApC,MAAM,CAACqC,MAAP,CAAgBlB,IAAI,CAACkB,MACtB,CAdD,IAcO,CACL;AACA;AACArC,MAAM,CAACmC,YAAP,CAAsB,EAAtB,CACAnC,MAAM,CAACoC,MAAP,CAAgB,EACjB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.js"],"names":["server","webpack","requireWeak","__dirname"],"mappings":"yiCAEA,qCAgBA,wSAZA,oD,sEAGA,gEAQA,sW,o9BAbA,KAAMA,CAAAA,MAAM,CAAGC,eAAQC,WAAR,YAAgCC,SAAhC,CAAf,C","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 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"],"file":"index.js"}
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 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":"yiCAEA,qCAgBA,wSAZA,oD,sEAGA,gEAQA,sW,o9BAbA,KAAMA,CAAAA,MAAM,CAAGC,eAAQC,WAAR,YAAgCC,SAAhC,CAAf,C"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/server/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"],"mappings":"6FAAA;AACA;AACA;AACA,GACe,KAAMA,CAAAA,KAAM,CACzBC,WAAW,CAACC,OAAD,CAAU,CACnB,KAAKC,OAAL,CAAe,CACbC,KAAK,CAAE,EADM,CAEbF,OAFa,CAGbG,IAAI,CAAE,CAHO,CAKhB,CAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KACEC,GAAG,CAAC,CAAEC,GAAF,CAAOC,MAAM,CAAGC,MAAM,CAACC,SAAvB,CAAD,CAAqC,CACtC,KAAMC,CAAAA,IAAI,CAAG,KAAKR,OAAL,CAAaC,KAAb,CAAmBG,GAAnB,CAAb,CACA,MAAOI,CAAAA,IAAI,EAAIC,IAAI,CAACC,GAAL,GAAaF,IAAI,CAACG,SAAlB,CAA8BN,MAAtC,CAA+CG,IAAI,CAACI,IAApD,CAA2D,IACnE,CAED;AACF;AACA;AACA;AACA;AACA,KACEC,GAAG,CAACD,IAAD,CAAOR,GAAP,CAAY,CACb,KAAMU,CAAAA,CAAC,CAAG,KAAKd,OAAf,CACA,KAAMe,CAAAA,GAAG,CAAGD,CAAC,CAACb,KAAF,CAAQG,GAAR,CAAZ,CACA,GAAIW,GAAJ,CAASD,CAAC,CAACZ,IAAF,EAAUa,GAAG,CAACH,IAAJ,CAASI,MAAnB,CACTF,CAAC,CAACb,KAAF,CAAQG,GAAR,EAAe,CAAEQ,IAAF,CAAQD,SAAS,CAAEF,IAAI,CAACC,GAAL,EAAnB,CAAf,CACAI,CAAC,CAACZ,IAAF,EAAUU,IAAI,CAACI,MAAf,CACA,GAAIF,CAAC,CAACZ,IAAF,CAASY,CAAC,CAACf,OAAf,CAAwB,CACtB,KAAME,CAAAA,KAAK,CAAGgB,MAAM,CAACC,OAAP,CAAeJ,CAAC,CAACb,KAAjB,CAAd,CACAA,KAAK,CAACkB,IAAN,CAAW,CAACC,CAAD,CAAIC,CAAJ,GAAUD,CAAC,CAAC,CAAD,CAAD,CAAKT,SAAL,CAAiBU,CAAC,CAAC,CAAD,CAAD,CAAKV,SAA3C,EACA,IAAK,GAAIW,CAAAA,CAAC,CAAG,CAAb,CAAgBA,CAAC,CAAGrB,KAAK,CAACe,MAA1B,CAAkC,EAAEM,CAApC,CAAuC,CACrC,KAAMd,CAAAA,IAAI,CAAGP,KAAK,CAACqB,CAAD,CAAlB,CACA,MAAOR,CAAAA,CAAC,CAACb,KAAF,CAAQO,IAAI,CAAC,CAAD,CAAZ,CAAP,CACAM,CAAC,CAACZ,IAAF,EAAUM,IAAI,CAAC,CAAD,CAAJ,CAAQI,IAAR,CAAaI,MAAvB,CACA,GAAIF,CAAC,CAACZ,IAAF,CAASY,CAAC,CAACf,OAAF,CAAY,CAAzB,CAA4B,KAC7B,CACF,CACF,CA7CwB,C","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"],"file":"Cache.js"}
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":"6FAAA;AACA;AACA;AACA,GACe,KAAMA,CAAAA,KAAM,CACzBC,WAAW,CAACC,OAAD,CAAU,CACnB,KAAKC,OAAL,CAAe,CACbC,KAAK,CAAE,EADM,CAEbF,OAFa,CAGbG,IAAI,CAAE,CAHO,CAKhB,CAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KACEC,GAAG,CAAC,CAAEC,GAAF,CAAOC,MAAM,CAAGC,MAAM,CAACC,SAAvB,CAAD,CAAqC,CACtC,KAAMC,CAAAA,IAAI,C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R,CAAaI,MAAvB,CACA,GAAIF,CAAC,CAACZ,IAAF,CAASY,CAAC,CAACf,OAAF,CAAY,CAAzB,CAA4B,KAC7B,CACF,CACF,CA7CwB,C"}
@@ -1,5 +1,4 @@
1
- "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});var _exportNames={getDefaultCspSettings:true};exports.default=void 0;Object.defineProperty(exports,"getDefaultCspSettings",{enumerable:true,get:function(){return _server.getDefaultCspSettings}});require("source-map-support/register");var _lodash=require("lodash");var _http=_interopRequireDefault(require("http"));var _https=_interopRequireDefault(require("https"));require("raf/polyfill");var _winston=_interopRequireDefault(require("winston"));var _server=_interopRequireWildcard(require("./server"));var _renderer=require("./renderer");var _utils=require("./utils");Object.keys(_utils).forEach(function(key){if(key==="default"||key==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,key))return;if(key in exports&&exports[key]===_utils[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function(){return _utils[key]}})});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)}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}/* Polyfill required by ReactJS. */ // Various default settings of server factory (launch() function).
2
- const DEFAULT_MAX_SSR_ROUNDS=10;const DEFAULT_SSR_TIMEOUT=1000;/**
1
+ "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});var _exportNames={getDefaultCspSettings:true};exports.default=void 0;Object.defineProperty(exports,"getDefaultCspSettings",{enumerable:true,get:function(){return _server.getDefaultCspSettings}});require("source-map-support/register");var _lodash=require("lodash");var _http=_interopRequireDefault(require("http"));var _https=_interopRequireDefault(require("https"));require("raf/polyfill");var _winston=_interopRequireDefault(require("winston"));var _server=_interopRequireWildcard(require("./server"));var _renderer=require("./renderer");var _utils=require("./utils");Object.keys(_utils).forEach(function(key){if(key==="default"||key==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,key))return;if(key in exports&&exports[key]===_utils[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function(){return _utils[key]}})});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)}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}/* Polyfill required by ReactJS. */ /**
3
2
  * Normalizes a port into a number, string, or false.
4
3
  * TODO: Drop this function?
5
4
  * @ignore
@@ -10,8 +9,9 @@ const DEFAULT_MAX_SSR_ROUNDS=10;const DEFAULT_SSR_TIMEOUT=1000;/**
10
9
  * or detailed configuration, supports server-side rendering,
11
10
  * and development tools, including Hot Module Reloading (HMR).
12
11
  *
13
- * See {@link module:ReactGlobalState ReactGlobalState} for some additional
14
- * notes related to SSR, access to incoming requests during SSR, _etc._
12
+ * NOTE: Many of options defined below are passed down to the server and
13
+ * renderer factories, and their declared default values are set in those
14
+ * factories, rather than here.
15
15
  *
16
16
  * @param {object} webpackConfig Webpack configuration used to build
17
17
  * the frontend bundle. In production mode the server will read out of it
@@ -122,5 +122,5 @@ const DEFAULT_MAX_SSR_ROUNDS=10;const DEFAULT_SSR_TIMEOUT=1000;/**
122
122
  * defaults to 1 second.
123
123
  * @return {Promise<{ expressServer: object, httpServer: object }>} Resolves to
124
124
  * an object with created Express and HTTP servers.
125
- */async function launch(webpackConfig,options){/* Options normalization. */const ops=options?(0,_lodash.cloneDeep)(options):{};ops.port=normalizePort(ops.port||process.env.PORT||3000);(0,_lodash.defaults)(ops,{httpsRedirect:true,maxSsrRounds:DEFAULT_MAX_SSR_ROUNDS,ssrTimeout:DEFAULT_SSR_TIMEOUT});if(!ops.staticCacheSize)ops.staticCacheSize=1.e7;if((0,_lodash.isUndefined)(ops.logger)){const{format,transports}=_winston.default;ops.logger=_winston.default.createLogger({level:ops.defaultLoggerLogLevel||"info",format:format.combine(format.splat(),format.timestamp(),format.colorize(),format.printf(({level,message,timestamp,stack,...rest})=>{let res=`${level}\t(at ${timestamp}):\t${message}`;if(Object.keys(rest).length){res+=`\n${JSON.stringify(rest,null,2)}`}if(stack)res+=`\n${stack}`;return res})),transports:[new transports.Console]})}/* Creates servers, resolves and sets the port. */const expressServer=await(0,_server.default)(webpackConfig,ops);let httpServer;if(ops.https){httpServer=_https.default.createServer({cert:ops.https.cert,key:ops.https.key},expressServer)}else httpServer=_http.default.createServer(expressServer);/* Sets error handler for HTTP(S) server. */httpServer.on("error",error=>{if(error.syscall!=="listen")throw error;const bind=(0,_lodash.isString)(ops.port)?`Pipe ${ops.port}`:`Port ${ops.port}`;/* Human-readable message for some specific listen errors. */switch(error.code){case"EACCES":ops.logger.error(`${bind} requires elevated privileges`);process.exit(1);break;case"EADDRINUSE":ops.logger.error(`${bind} is already in use`);process.exit(1);break;default:throw error;}});/* Listening event handler for HTTP(S) server. */httpServer.on("listening",()=>{const addr=httpServer.address();const bind=(0,_lodash.isString)(addr)?`pipe ${addr}`:`port ${addr.port}`;ops.logger.info(`Server listening on ${bind} in ${process.env.NODE_ENV} mode`)});httpServer.listen(ops.port);return{expressServer,httpServer}}launch.SCRIPT_LOCATIONS=_renderer.SCRIPT_LOCATIONS;var _default=launch;exports.default=_default;
125
+ */async function launch(webpackConfig,options){/* Options normalization. */const ops=options?(0,_lodash.cloneDeep)(options):{};ops.port=normalizePort(ops.port||process.env.PORT||3000);(0,_lodash.defaults)(ops,{httpsRedirect:true});if((0,_lodash.isUndefined)(ops.logger)){const{format,transports}=_winston.default;ops.logger=_winston.default.createLogger({level:ops.defaultLoggerLogLevel||"info",format:format.combine(format.splat(),format.timestamp(),format.colorize(),format.printf(({level,message,timestamp,stack,...rest})=>{let res=`${level}\t(at ${timestamp}):\t${message}`;if(Object.keys(rest).length){res+=`\n${JSON.stringify(rest,null,2)}`}if(stack)res+=`\n${stack}`;return res})),transports:[new transports.Console]})}/* Creates servers, resolves and sets the port. */const expressServer=await(0,_server.default)(webpackConfig,ops);let httpServer;if(ops.https){httpServer=_https.default.createServer({cert:ops.https.cert,key:ops.https.key},expressServer)}else httpServer=_http.default.createServer(expressServer);/* Sets error handler for HTTP(S) server. */httpServer.on("error",error=>{if(error.syscall!=="listen")throw error;const bind=(0,_lodash.isString)(ops.port)?`Pipe ${ops.port}`:`Port ${ops.port}`;/* Human-readable message for some specific listen errors. */switch(error.code){case"EACCES":ops.logger.error(`${bind} requires elevated privileges`);process.exit(1);break;case"EADDRINUSE":ops.logger.error(`${bind} is already in use`);process.exit(1);break;default:throw error;}});/* Listening event handler for HTTP(S) server. */httpServer.on("listening",()=>{const addr=httpServer.address();const bind=(0,_lodash.isString)(addr)?`pipe ${addr}`:`port ${addr.port}`;ops.logger.info(`Server listening on ${bind} in ${process.env.NODE_ENV} mode`)});httpServer.listen(ops.port);return{expressServer,httpServer}}launch.SCRIPT_LOCATIONS=_renderer.SCRIPT_LOCATIONS;var _default=launch;exports.default=_default;
126
126
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/server/index.js"],"names":["DEFAULT_MAX_SSR_ROUNDS","DEFAULT_SSR_TIMEOUT","normalizePort","value","port","launch","webpackConfig","options","ops","process","env","PORT","httpsRedirect","maxSsrRounds","ssrTimeout","staticCacheSize","logger","format","transports","winston","createLogger","level","defaultLoggerLogLevel","combine","splat","timestamp","colorize","printf","message","stack","rest","res","Object","keys","length","JSON","stringify","Console","expressServer","httpServer","https","createServer","cert","key","http","on","error","syscall","bind","code","exit","addr","address","info","NODE_ENV","listen","SCRIPT_LOCATIONS"],"mappings":"4VAAA,uCAEA,8BAUA,kDACA,oDAGA,wBAEA,wDAEA,yDACA,oCAGA,sU,o9BATA,mC,CAWA;AACA,KAAMA,CAAAA,sBAAsB,CAAG,EAA/B,CACA,KAAMC,CAAAA,mBAAmB,CAAG,IAA5B,CAEA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,QAASC,CAAAA,aAAT,CAAuBC,KAAvB,CAA8B,CAC5B,KAAMC,CAAAA,IAAI,CAAG,qBAASD,KAAT,CAAb,CACA,GAAI,qBAASC,IAAT,CAAJ,CAAoB,MAAOA,CAAAA,IAAP,CAAa,iBACjC,GAAI,CAAC,qBAASA,IAAT,CAAL,CAAqB,MAAOD,CAAAA,KAAP,CAAc,gBACnC,MAAO,MACR,CAED;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,GACA,cAAeE,CAAAA,MAAf,CAAsBC,aAAtB,CAAqCC,OAArC,CAA8C,CAC5C,4BACA,KAAMC,CAAAA,GAAG,CAAGD,OAAO,CAAG,sBAAUA,OAAV,CAAH,CAAwB,EAA3C,CACAC,GAAG,CAACJ,IAAJ,CAAWF,aAAa,CAACM,GAAG,CAACJ,IAAJ,EAAYK,OAAO,CAACC,GAAR,CAAYC,IAAxB,EAAgC,IAAjC,CAAxB,CACA,qBAASH,GAAT,CAAc,CACZI,aAAa,CAAE,IADH,CAEZC,YAAY,CAAEb,sBAFF,CAGZc,UAAU,CAAEb,mBAHA,CAAd,EAKA,GAAI,CAACO,GAAG,CAACO,eAAT,CAA0BP,GAAG,CAACO,eAAJ,CAAsB,IAAtB,CAE1B,GAAI,wBAAYP,GAAG,CAACQ,MAAhB,CAAJ,CAA6B,CAC3B,KAAM,CAAEC,MAAF,CAAUC,UAAV,EAAyBC,gBAA/B,CACAX,GAAG,CAACQ,MAAJ,CAAaG,iBAAQC,YAAR,CAAqB,CAChCC,KAAK,CAAEb,GAAG,CAACc,qBAAJ,EAA6B,MADJ,CAEhCL,MAAM,CAAEA,MAAM,CAACM,OAAP,CACNN,MAAM,CAACO,KAAP,EADM,CAENP,MAAM,CAAC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OI,GAAG,CAACJ,IAAK,EAAxE,CAEA,6DACA,OAAQ0C,KAAK,CAACG,IAAd,EACE,IAAK,QAAL,CACEzC,GAAG,CAACQ,MAAJ,CAAW8B,KAAX,CAAkB,GAAEE,IAAK,+BAAzB,EACAvC,OAAO,CAACyC,IAAR,CAAa,CAAb,EACA,MACF,IAAK,YAAL,CACE1C,GAAG,CAACQ,MAAJ,CAAW8B,KAAX,CAAkB,GAAEE,IAAK,oBAAzB,EACAvC,OAAO,CAACyC,IAAR,CAAa,CAAb,EACA,MACF,QACE,KAAMJ,CAAAA,KAAN,CAVJ,CAYD,CAjBD,EAmBA,iDACAP,UAAU,CAACM,EAAX,CAAc,WAAd,CAA2B,IAAM,CAC/B,KAAMM,CAAAA,IAAI,CAAGZ,UAAU,CAACa,OAAX,EAAb,CACA,KAAMJ,CAAAA,IAAI,CAAG,qBAASG,IAAT,EAAkB,QAAOA,IAAK,EAA9B,CAAmC,QAAOA,IAAI,CAAC/C,IAAK,EAAjE,CACAI,GAAG,CAACQ,MAAJ,CAAWqC,IAAX,CAAiB,uBAAsBL,IAAK,OAC1CvC,OAAO,CAACC,GAAR,CAAY4C,QAAS,OADvB,CAED,CALD,EAOAf,UAAU,CAACgB,MAAX,CAAkB/C,GAAG,CAACJ,IAAtB,EAEA,MAAO,CACLkC,aADK,CAELC,UAFK,CAIR,CAEDlC,MAAM,CAACmD,gBAAP,CAA0BA,0BAA1B,C,aAEenD,M","sourcesContent":["import 'source-map-support/register';\n\nimport {\n cloneDeep,\n defaults,\n isFinite,\n isNumber,\n isUndefined,\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 winston from 'winston';\n\nimport serverFactory from './server';\nimport { SCRIPT_LOCATIONS } from './renderer';\n\nexport { getDefaultCspSettings } from './server';\nexport * from './utils';\n\n// Various default settings of server factory (launch() function).\nconst DEFAULT_MAX_SSR_ROUNDS = 10;\nconst DEFAULT_SSR_TIMEOUT = 1000;\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 * See {@link module:ReactGlobalState ReactGlobalState} for some additional\n * notes related to SSR, access to incoming requests during SSR, _etc._\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, {\n httpsRedirect: true,\n maxSsrRounds: DEFAULT_MAX_SSR_ROUNDS,\n ssrTimeout: DEFAULT_SSR_TIMEOUT,\n });\n if (!ops.staticCacheSize) ops.staticCacheSize = 1.e7;\n\n if (isUndefined(ops.logger)) {\n const { format, transports } = winston;\n ops.logger = winston.createLogger({\n level: ops.defaultLoggerLogLevel || 'info',\n format: format.combine(\n format.splat(),\n format.timestamp(),\n format.colorize(),\n format.printf(\n ({\n level,\n message,\n timestamp,\n stack,\n ...rest\n }) => {\n let res = `${level}\\t(at ${timestamp}):\\t${message}`;\n if (Object.keys(rest).length) {\n res += `\\n${JSON.stringify(rest, null, 2)}`;\n }\n if (stack) res += `\\n${stack}`;\n return res;\n },\n ),\n ),\n transports: [new transports.Console()],\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 process.exit(1);\n break;\n case 'EADDRINUSE':\n ops.logger.error(`${bind} is already in use`);\n process.exit(1);\n break;\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"],"file":"index.js"}
1
+ {"version":3,"file":"index.js","names":["normalizePort","value","port","launch","webpackConfig","options","ops","process","env","PORT","httpsRedirect","logger","format","transports","winston","createLogger","level","defaultLoggerLogLevel","combine","splat","timestamp","colorize","printf","message","stack","rest","res","Object","keys","length","JSON","stringify","Console","expressServer","httpServer","https","createServer","cert","key","http","on","error","syscall","bind","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 isUndefined,\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 winston from 'winston';\n\nimport serverFactory from './server';\nimport { SCRIPT_LOCATIONS } 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 (isUndefined(ops.logger)) {\n const { format, transports } = winston;\n ops.logger = winston.createLogger({\n level: ops.defaultLoggerLogLevel || 'info',\n format: format.combine(\n format.splat(),\n format.timestamp(),\n format.colorize(),\n format.printf(\n ({\n level,\n message,\n timestamp,\n stack,\n ...rest\n }) => {\n let res = `${level}\\t(at ${timestamp}):\\t${message}`;\n if (Object.keys(rest).length) {\n res += `\\n${JSON.stringify(rest, null, 2)}`;\n }\n if (stack) res += `\\n${stack}`;\n return res;\n },\n ),\n ),\n transports: [new transports.Console()],\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 process.exit(1);\n break;\n case 'EADDRINUSE':\n ops.logger.error(`${bind} is already in use`);\n process.exit(1);\n break;\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":"4VAAA,uCAEA,8BAUA,kDACA,oDAGA,wBAEA,wDAEA,yDACA,oCAGA,sU,o9BATA,mC,CAWA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,QAASA,CAAAA,aAAT,CAAuBC,KAAvB,CAA8B,CAC5B,KAAMC,CAAAA,IAAI,CAAG,qBAASD,KAAT,CAAb,CACA,GAAI,qBAASC,IAAT,CAAJ,CAAoB,MAAOA,CAAAA,IAAP,CAAa,iBACjC,GAAI,CAAC,qBAASA,IAAT,CAAL,CAAqB,MAAOD,CAAAA,KAAP,CAAc,gBACnC,MAAO,MACR,CAED;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,GACA,cAAeE,CAAAA,MAAf,CAAsBC,aAAtB,CAAqCC,OAArC,CAA8C,CAC5C,4BACA,KAAMC,CAAAA,GAAG,CAAGD,OAAO,CAAG,sBAAUA,OAAV,CAAH,CAAwB,EAA3C,CACAC,GAAG,CAACJ,IAAJ,CAAWF,aAAa,CAACM,GAAG,CAACJ,IAAJ,EAAYK,OAAO,CAACC,GAAR,CAAYC,IAAxB,EAAgC,IAAjC,CAAxB,CACA,qBAASH,GAAT,CAAc,CAAEI,aAAa,CAAE,IAAjB,CAAd,EAEA,GAAI,wBAAYJ,GAAG,CAACK,MAAhB,CAAJ,CAA6B,CAC3B,KAAM,CAAEC,MAAF,CAAUC,UAAV,EAAyBC,gBAA/B,CACAR,GAAG,CAACK,MAAJ,CAAa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