@dr.pogodin/react-utils 1.42.0 → 1.42.1

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 (230) hide show
  1. package/babel.config.js +3 -0
  2. package/bin/build.js +5 -8
  3. package/bin/setup.js +2 -1
  4. package/build/development/client/getInj.js +7 -2
  5. package/build/development/client/getInj.js.map +1 -1
  6. package/build/development/client/index.js +1 -2
  7. package/build/development/client/index.js.map +1 -1
  8. package/build/development/client/init.js +16 -13
  9. package/build/development/client/init.js.map +1 -1
  10. package/build/development/index.js +4 -1
  11. package/build/development/index.js.map +1 -1
  12. package/build/development/server/Cache.js +5 -9
  13. package/build/development/server/Cache.js.map +1 -1
  14. package/build/development/server/index.js +14 -11
  15. package/build/development/server/index.js.map +1 -1
  16. package/build/development/server/renderer.js +36 -40
  17. package/build/development/server/renderer.js.map +1 -1
  18. package/build/development/server/server.js +19 -12
  19. package/build/development/server/server.js.map +1 -1
  20. package/build/development/server/utils/errors.js.map +1 -1
  21. package/build/development/shared/components/Button/index.js +2 -3
  22. package/build/development/shared/components/Button/index.js.map +1 -1
  23. package/build/development/shared/components/Checkbox/index.js +3 -1
  24. package/build/development/shared/components/Checkbox/index.js.map +1 -1
  25. package/build/development/shared/components/GenericLink/index.js +13 -6
  26. package/build/development/shared/components/GenericLink/index.js.map +1 -1
  27. package/build/development/shared/components/Input/index.js +5 -1
  28. package/build/development/shared/components/Input/index.js.map +1 -1
  29. package/build/development/shared/components/Link.js +5 -6
  30. package/build/development/shared/components/Link.js.map +1 -1
  31. package/build/development/shared/components/MetaTags.js +31 -24
  32. package/build/development/shared/components/MetaTags.js.map +1 -1
  33. package/build/development/shared/components/Modal/index.js +13 -6
  34. package/build/development/shared/components/Modal/index.js.map +1 -1
  35. package/build/development/shared/components/NavLink.js +6 -6
  36. package/build/development/shared/components/NavLink.js.map +1 -1
  37. package/build/development/shared/components/TextArea/index.js +6 -3
  38. package/build/development/shared/components/TextArea/index.js.map +1 -1
  39. package/build/development/shared/components/WithTooltip/Tooltip.js +35 -39
  40. package/build/development/shared/components/WithTooltip/Tooltip.js.map +1 -1
  41. package/build/development/shared/components/WithTooltip/index.js +27 -21
  42. package/build/development/shared/components/WithTooltip/index.js.map +1 -1
  43. package/build/development/shared/components/YouTubeVideo/index.js +4 -3
  44. package/build/development/shared/components/YouTubeVideo/index.js.map +1 -1
  45. package/build/development/shared/components/selectors/CustomDropdown/Options/index.js +4 -5
  46. package/build/development/shared/components/selectors/CustomDropdown/Options/index.js.map +1 -1
  47. package/build/development/shared/components/selectors/CustomDropdown/index.js +7 -9
  48. package/build/development/shared/components/selectors/CustomDropdown/index.js.map +1 -1
  49. package/build/development/shared/components/selectors/NativeDropdown/index.js +3 -5
  50. package/build/development/shared/components/selectors/NativeDropdown/index.js.map +1 -1
  51. package/build/development/shared/components/selectors/Switch/index.js +21 -20
  52. package/build/development/shared/components/selectors/Switch/index.js.map +1 -1
  53. package/build/development/shared/utils/config.js +6 -3
  54. package/build/development/shared/utils/config.js.map +1 -1
  55. package/build/development/shared/utils/globalState.js +6 -0
  56. package/build/development/shared/utils/globalState.js.map +1 -1
  57. package/build/development/shared/utils/isomorphy/buildInfo.js.map +1 -1
  58. package/build/development/shared/utils/isomorphy/environment-check.js +6 -1
  59. package/build/development/shared/utils/isomorphy/environment-check.js.map +1 -1
  60. package/build/development/shared/utils/isomorphy/index.js +1 -3
  61. package/build/development/shared/utils/isomorphy/index.js.map +1 -1
  62. package/build/development/shared/utils/jest/E2eSsrEnv.js +26 -17
  63. package/build/development/shared/utils/jest/E2eSsrEnv.js.map +1 -1
  64. package/build/development/shared/utils/jest/global.js +0 -7
  65. package/build/development/shared/utils/jest/global.js.map +1 -1
  66. package/build/development/shared/utils/jest/index.js +15 -4
  67. package/build/development/shared/utils/jest/index.js.map +1 -1
  68. package/build/development/shared/utils/splitComponent.js +37 -19
  69. package/build/development/shared/utils/splitComponent.js.map +1 -1
  70. package/build/development/shared/utils/time.js +3 -3
  71. package/build/development/shared/utils/time.js.map +1 -1
  72. package/build/development/shared/utils/webpack.js +11 -11
  73. package/build/development/shared/utils/webpack.js.map +1 -1
  74. package/build/development/web.bundle.js +30 -30
  75. package/build/production/client/getInj.js +4 -2
  76. package/build/production/client/getInj.js.map +1 -1
  77. package/build/production/client/index.js +2 -2
  78. package/build/production/client/index.js.map +1 -1
  79. package/build/production/client/init.js +4 -2
  80. package/build/production/client/init.js.map +1 -1
  81. package/build/production/index.js +2 -1
  82. package/build/production/index.js.map +1 -1
  83. package/build/production/server/Cache.js +1 -2
  84. package/build/production/server/Cache.js.map +1 -1
  85. package/build/production/server/index.js +9 -5
  86. package/build/production/server/index.js.map +1 -1
  87. package/build/production/server/renderer.js +24 -21
  88. package/build/production/server/renderer.js.map +1 -1
  89. package/build/production/server/server.js +13 -8
  90. package/build/production/server/server.js.map +1 -1
  91. package/build/production/server/utils/errors.js.map +1 -1
  92. package/build/production/shared/components/Button/index.js +1 -1
  93. package/build/production/shared/components/Button/index.js.map +1 -1
  94. package/build/production/shared/components/Checkbox/index.js +1 -1
  95. package/build/production/shared/components/Checkbox/index.js.map +1 -1
  96. package/build/production/shared/components/GenericLink/index.js +6 -4
  97. package/build/production/shared/components/GenericLink/index.js.map +1 -1
  98. package/build/production/shared/components/Input/index.js +3 -1
  99. package/build/production/shared/components/Input/index.js.map +1 -1
  100. package/build/production/shared/components/Link.js +3 -1
  101. package/build/production/shared/components/Link.js.map +1 -1
  102. package/build/production/shared/components/MetaTags.js +5 -2
  103. package/build/production/shared/components/MetaTags.js.map +1 -1
  104. package/build/production/shared/components/Modal/index.js +6 -2
  105. package/build/production/shared/components/Modal/index.js.map +1 -1
  106. package/build/production/shared/components/NavLink.js +4 -1
  107. package/build/production/shared/components/NavLink.js.map +1 -1
  108. package/build/production/shared/components/TextArea/index.js +4 -4
  109. package/build/production/shared/components/TextArea/index.js.map +1 -1
  110. package/build/production/shared/components/WithTooltip/Tooltip.js +37 -38
  111. package/build/production/shared/components/WithTooltip/Tooltip.js.map +1 -1
  112. package/build/production/shared/components/WithTooltip/index.js +4 -4
  113. package/build/production/shared/components/WithTooltip/index.js.map +1 -1
  114. package/build/production/shared/components/YouTubeVideo/index.js +3 -2
  115. package/build/production/shared/components/YouTubeVideo/index.js.map +1 -1
  116. package/build/production/shared/components/selectors/CustomDropdown/Options/index.js +2 -2
  117. package/build/production/shared/components/selectors/CustomDropdown/Options/index.js.map +1 -1
  118. package/build/production/shared/components/selectors/CustomDropdown/index.js +2 -2
  119. package/build/production/shared/components/selectors/CustomDropdown/index.js.map +1 -1
  120. package/build/production/shared/components/selectors/NativeDropdown/index.js +2 -2
  121. package/build/production/shared/components/selectors/NativeDropdown/index.js.map +1 -1
  122. package/build/production/shared/components/selectors/Switch/index.js +1 -1
  123. package/build/production/shared/components/selectors/Switch/index.js.map +1 -1
  124. package/build/production/shared/utils/config.js +6 -4
  125. package/build/production/shared/utils/config.js.map +1 -1
  126. package/build/production/shared/utils/globalState.js +4 -1
  127. package/build/production/shared/utils/globalState.js.map +1 -1
  128. package/build/production/shared/utils/isomorphy/buildInfo.js.map +1 -1
  129. package/build/production/shared/utils/isomorphy/environment-check.js +5 -1
  130. package/build/production/shared/utils/isomorphy/environment-check.js.map +1 -1
  131. package/build/production/shared/utils/isomorphy/index.js +1 -3
  132. package/build/production/shared/utils/isomorphy/index.js.map +1 -1
  133. package/build/production/shared/utils/jest/E2eSsrEnv.js +15 -8
  134. package/build/production/shared/utils/jest/E2eSsrEnv.js.map +1 -1
  135. package/build/production/shared/utils/jest/global.js +1 -1
  136. package/build/production/shared/utils/jest/global.js.map +1 -1
  137. package/build/production/shared/utils/jest/index.js +13 -5
  138. package/build/production/shared/utils/jest/index.js.map +1 -1
  139. package/build/production/shared/utils/splitComponent.js +16 -8
  140. package/build/production/shared/utils/splitComponent.js.map +1 -1
  141. package/build/production/shared/utils/time.js +2 -2
  142. package/build/production/shared/utils/time.js.map +1 -1
  143. package/build/production/shared/utils/webpack.js +5 -2
  144. package/build/production/shared/utils/webpack.js.map +1 -1
  145. package/build/production/web.bundle.js +1 -1
  146. package/build/production/web.bundle.js.map +1 -1
  147. package/build/types-code/client/getInj.d.ts +1 -1
  148. package/build/types-code/client/index.d.ts +2 -2
  149. package/build/types-code/client/init.d.ts +1 -1
  150. package/build/types-code/index.d.ts +6 -5
  151. package/build/types-code/server/Cache.d.ts +1 -2
  152. package/build/types-code/server/index.d.ts +4 -5
  153. package/build/types-code/server/renderer.d.ts +8 -10
  154. package/build/types-code/server/server.d.ts +3 -5
  155. package/build/types-code/server/utils/errors.d.ts +1 -1
  156. package/build/types-code/shared/components/Button/index.d.ts +2 -2
  157. package/build/types-code/shared/components/TextArea/index.d.ts +3 -3
  158. package/build/types-code/shared/components/WithTooltip/Tooltip.d.ts +7 -1
  159. package/build/types-code/shared/components/index.d.ts +12 -12
  160. package/build/types-code/shared/utils/config.d.ts +1 -1
  161. package/build/types-code/shared/utils/globalState.d.ts +3 -6
  162. package/build/types-code/shared/utils/isomorphy/index.d.ts +1 -3
  163. package/build/types-code/shared/utils/jest/E2eSsrEnv.d.ts +1 -1
  164. package/build/types-code/shared/utils/jest/global.d.ts +4 -4
  165. package/build/types-code/shared/utils/jest/index.d.ts +2 -2
  166. package/build/types-code/shared/utils/webpack.d.ts +1 -1
  167. package/config/babel/node-ssr.d.ts +3 -2
  168. package/config/babel/node-ssr.js +5 -7
  169. package/config/babel/webpack.d.ts +3 -11
  170. package/config/babel/webpack.js +15 -15
  171. package/config/eslint/default.mjs +32 -0
  172. package/config/jest/default.js +10 -6
  173. package/config/jest/resolver.js +2 -0
  174. package/config/jest/setup.js +2 -2
  175. package/config/stylelint/default.js +3 -0
  176. package/config/webpack/app-base.d.ts +0 -6
  177. package/config/webpack/app-base.js +64 -70
  178. package/config/webpack/app-development.d.ts +2 -2
  179. package/config/webpack/app-development.js +8 -12
  180. package/config/webpack/app-production.js +1 -0
  181. package/config/webpack/lib-base.js +20 -18
  182. package/config/webpack/lib-development.js +1 -0
  183. package/config/webpack/lib-production.js +1 -0
  184. package/config/workbox/default.js +2 -5
  185. package/dev-styles.js +1 -0
  186. package/eslint.config.mjs +13 -0
  187. package/node-entry.js +7 -2
  188. package/null.js +1 -0
  189. package/package.json +17 -25
  190. package/prod-styles.js +1 -0
  191. package/src/client/getInj.ts +8 -3
  192. package/src/client/index.tsx +4 -4
  193. package/src/client/init.ts +18 -15
  194. package/src/index.ts +8 -3
  195. package/src/server/Cache.ts +7 -15
  196. package/src/server/index.ts +30 -21
  197. package/src/server/renderer.tsx +76 -66
  198. package/src/server/server.ts +38 -20
  199. package/src/server/utils/errors.ts +6 -3
  200. package/src/shared/components/Button/index.tsx +4 -5
  201. package/src/shared/components/Checkbox/index.tsx +10 -7
  202. package/src/shared/components/GenericLink/index.tsx +14 -7
  203. package/src/shared/components/Input/index.tsx +4 -1
  204. package/src/shared/components/Link.tsx +9 -5
  205. package/src/shared/components/MetaTags.tsx +21 -15
  206. package/src/shared/components/Modal/index.tsx +12 -11
  207. package/src/shared/components/NavLink.tsx +10 -5
  208. package/src/shared/components/TextArea/index.tsx +17 -9
  209. package/src/shared/components/WithTooltip/{Tooltip.tsx → Tooltip.ts} +35 -39
  210. package/src/shared/components/WithTooltip/index.tsx +36 -30
  211. package/src/shared/components/YouTubeVideo/index.tsx +10 -6
  212. package/src/shared/components/selectors/CustomDropdown/Options/index.tsx +5 -6
  213. package/src/shared/components/selectors/CustomDropdown/index.tsx +10 -14
  214. package/src/shared/components/selectors/NativeDropdown/index.tsx +5 -7
  215. package/src/shared/components/selectors/Switch/index.tsx +19 -17
  216. package/src/shared/utils/config.ts +12 -5
  217. package/src/shared/utils/globalState.ts +8 -5
  218. package/src/shared/utils/isomorphy/buildInfo.ts +1 -1
  219. package/src/shared/utils/isomorphy/environment-check.ts +5 -1
  220. package/src/shared/utils/isomorphy/index.ts +4 -6
  221. package/src/shared/utils/jest/E2eSsrEnv.ts +64 -39
  222. package/src/shared/utils/jest/global.ts +6 -8
  223. package/src/shared/utils/jest/{index.tsx → index.ts} +25 -12
  224. package/src/shared/utils/splitComponent.tsx +44 -25
  225. package/src/shared/utils/time.ts +16 -9
  226. package/src/shared/utils/webpack.ts +19 -14
  227. package/webpack.config.ts +36 -10
  228. package/config/eslint/default.json +0 -30
  229. package/config/eslint/jest.json +0 -19
  230. package/config/eslint/typescript.js +0 -46
@@ -1,10 +1,5 @@
1
1
  "use strict";
2
- /**
3
- * @category Configs
4
- * @module webpack/app-base
5
- * @desc
6
- * Base [Webpack](https://webpack.js.org/) configuration for apps.
7
- */
2
+ /* eslint-disable import/no-extraneous-dependencies */
8
3
  var __importDefault = (this && this.__importDefault) || function (mod) {
9
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
10
5
  };
@@ -130,27 +125,28 @@ const utils_1 = require("@dr.pogodin/babel-plugin-react-css-modules/utils");
130
125
  * - **`timestamp`** — The value set for `BUILD_TIMESTAMP`.
131
126
  */
132
127
  function configFactory(ops) {
133
- var _a;
128
+ var _a, _b;
134
129
  const o = (0, lodash_1.defaults)((0, lodash_1.clone)(ops), {
135
130
  babelLoaderOptions: {},
136
131
  cssLocalIdent: '[hash:base64:6]',
137
132
  outputPath: 'build/web-public',
138
133
  publicPath: '',
139
134
  });
140
- const fs = ops.fs || fs_1.default;
135
+ const fs = (_a = ops.fs) !== null && _a !== void 0 ? _a : fs_1.default;
136
+ // TODO: Should it be improved and re-validated? Are we using it in any project
137
+ // as is?
141
138
  /* TODO: This works in practice, but being async and not awaited it is a bad
142
139
  * pattern. */
143
140
  if (o.sitemap) {
144
141
  const sitemapUrl = path_1.default.resolve(o.context, o.sitemap);
145
- /* eslint-disable global-require, import/no-dynamic-require */
142
+ // eslint-disable-next-line import/no-dynamic-require, @typescript-eslint/no-require-imports
146
143
  let source = require(sitemapUrl);
147
144
  if ((0, lodash_1.isFunction)(source))
148
145
  source = source();
149
- /* eslint-enable global-require, import/no-dynamic-require */
150
146
  const sm = new sitemap_1.default.SitemapStream();
151
147
  source.forEach((item) => sm.write(item));
152
148
  sm.end();
153
- sitemap_1.default.streamToPromise(sm).then((sitemap) => {
149
+ void sitemap_1.default.streamToPromise(sm).then((sitemap) => {
154
150
  const outUrl = path_1.default.resolve(o.context, o.outputPath);
155
151
  if (!fs.existsSync(outUrl))
156
152
  fs.mkdirSync(outUrl);
@@ -178,18 +174,16 @@ function configFactory(ops) {
178
174
  }
179
175
  // Even if "keepBuildInfo" option was provided, we still generate a new
180
176
  // build info object in case nothing could be loaded.
181
- if (!buildInfo) {
182
- buildInfo = Object.freeze({
183
- /* A random 32-bit key, that can be used for encryption. */
184
- key: node_forge_1.default.random.getBytesSync(32),
185
- /* Public path used during build. */
186
- publicPath: o.publicPath,
187
- /* `true` if client-side code should setup a service worker. */
188
- useServiceWorker: Boolean(o.workbox),
189
- // Build timestamp.
190
- timestamp: new Date().toISOString(),
191
- });
192
- }
177
+ buildInfo !== null && buildInfo !== void 0 ? buildInfo : (buildInfo = Object.freeze({
178
+ /* A random 32-bit key, that can be used for encryption. */
179
+ key: node_forge_1.default.random.getBytesSync(32),
180
+ /* Public path used during build. */
181
+ publicPath: o.publicPath,
182
+ /* `true` if client-side code should setup a service worker. */
183
+ useServiceWorker: Boolean(o.workbox),
184
+ // Build timestamp.
185
+ timestamp: new Date().toISOString(),
186
+ }));
193
187
  // If not opted-out, we write the build info to the filesystem. We also attach
194
188
  // it to the factory function itself, so it can be easily accessed right after
195
189
  // the factory call in testing scenarios.
@@ -220,61 +214,19 @@ function configFactory(ops) {
220
214
  return {
221
215
  context: o.context,
222
216
  entry,
223
- node: {
224
- __dirname: true,
225
- },
226
217
  mode: o.mode,
227
- output: {
228
- chunkFilename: '[contenthash].js',
229
- filename: '[contenthash].js',
230
- path: path_1.default.resolve(__dirname, o.context, o.outputPath),
231
- publicPath: `${o.publicPath}/`,
232
- },
233
- plugins,
234
- resolve: {
235
- alias: {
236
- // NOTE: The "conditionNames" workaround below messes up the loading of
237
- // Babel's runtime helper for require of CJS and ES styles of modules
238
- // (without this alias it is resolved to
239
- // @babel/runtime/helpers/esm/interopRequireDefault, which has
240
- // the hepler function attached to "default" export).
241
- '@babel/runtime/helpers/interopRequireDefault': path_1.default.resolve(o.context, 'node_modules/@babel/runtime/helpers/interopRequireDefault'),
242
- // Aliases to JS an JSX files are handled by Babel.
243
- assets: path_1.default.resolve(o.context, 'src/assets'),
244
- components: path_1.default.resolve(o.context, 'src/shared/components'),
245
- fonts: path_1.default.resolve(o.context, 'src/assets/fonts'),
246
- styles: path_1.default.resolve(o.context, 'src/styles'),
247
- },
248
- // NOTE: This is primarily motivated by the issue #413
249
- // https://github.com/birdofpreyru/react-utils/issues/413
250
- // caused by react-router exporting different package builds
251
- // for "import" and "default" conditions, resulting in Webpack
252
- // picking up different module versions for import() and require()
253
- // imports. Adding "import" with the highest priorty below forces
254
- // the "import" to be used, working around the problem.
255
- conditionNames: ['import', '...'],
256
- extensions: [
257
- '.ts',
258
- '.tsx',
259
- '.js',
260
- '.jsx',
261
- '.json',
262
- '.scss',
263
- ],
264
- symlinks: false,
265
- },
266
218
  module: {
267
219
  rules: [{
268
220
  /* Loads font resources from "src/assets/fonts" folder. */
269
221
  test: /\.(eot|otf|svg|ttf|woff2?)$/,
222
+ generator: {
223
+ filename: 'fonts/[contenthash][ext][query]',
224
+ },
270
225
  include: [
271
226
  /node_modules/,
272
227
  /src[/\\]assets[/\\]fonts/,
273
228
  ],
274
229
  type: 'asset/resource',
275
- generator: {
276
- filename: 'fonts/[contenthash][ext][query]',
277
- },
278
230
  }, {
279
231
  // Aggregates source maps from dependencies.
280
232
  test: /\.js$/,
@@ -284,7 +236,7 @@ function configFactory(ops) {
284
236
  // Loads JS modules (.cjs, .js, .jsx); TS modules (.ts, .tsx);
285
237
  // and SVG assets (.svg).
286
238
  test: ops.typescript ? /\.(cjs|(j|t)sx?|svg)$/ : /\.(cjs|jsx?|svg)$/,
287
- exclude: (_a = ops.babelLoaderExclude) !== null && _a !== void 0 ? _a : [/node_modules/],
239
+ exclude: (_b = ops.babelLoaderExclude) !== null && _b !== void 0 ? _b : [/node_modules/],
288
240
  loader: 'babel-loader',
289
241
  options: Object.assign({ babelrc: false, configFile: false, envName: o.babelEnv, presets: [['@dr.pogodin/react-utils/config/babel/webpack', {
290
242
  typescript: ops.typescript,
@@ -292,10 +244,10 @@ function configFactory(ops) {
292
244
  }, {
293
245
  /* Loads image assets. */
294
246
  test: /\.(gif|jpe?g|png)$/,
295
- type: 'asset/resource',
296
247
  generator: {
297
248
  filename: 'images/[contenthash][ext][query]',
298
249
  },
250
+ type: 'asset/resource',
299
251
  }, {
300
252
  /* Loads SCSS stylesheets. */
301
253
  test: /\.scss$/,
@@ -338,5 +290,47 @@ function configFactory(ops) {
338
290
  ],
339
291
  }],
340
292
  },
293
+ node: {
294
+ __dirname: true,
295
+ },
296
+ output: {
297
+ chunkFilename: '[contenthash].js',
298
+ filename: '[contenthash].js',
299
+ path: path_1.default.resolve(__dirname, o.context, o.outputPath),
300
+ publicPath: `${o.publicPath}/`,
301
+ },
302
+ plugins,
303
+ resolve: {
304
+ alias: {
305
+ // NOTE: The "conditionNames" workaround below messes up the loading of
306
+ // Babel's runtime helper for require of CJS and ES styles of modules
307
+ // (without this alias it is resolved to
308
+ // @babel/runtime/helpers/esm/interopRequireDefault, which has
309
+ // the hepler function attached to "default" export).
310
+ '@babel/runtime/helpers/interopRequireDefault': path_1.default.resolve(o.context, 'node_modules/@babel/runtime/helpers/interopRequireDefault'),
311
+ // Aliases to JS an JSX files are handled by Babel.
312
+ assets: path_1.default.resolve(o.context, 'src/assets'),
313
+ components: path_1.default.resolve(o.context, 'src/shared/components'),
314
+ fonts: path_1.default.resolve(o.context, 'src/assets/fonts'),
315
+ styles: path_1.default.resolve(o.context, 'src/styles'),
316
+ },
317
+ // NOTE: This is primarily motivated by the issue #413
318
+ // https://github.com/birdofpreyru/react-utils/issues/413
319
+ // caused by react-router exporting different package builds
320
+ // for "import" and "default" conditions, resulting in Webpack
321
+ // picking up different module versions for import() and require()
322
+ // imports. Adding "import" with the highest priorty below forces
323
+ // the "import" to be used, working around the problem.
324
+ conditionNames: ['import', '...'],
325
+ extensions: [
326
+ '.ts',
327
+ '.tsx',
328
+ '.js',
329
+ '.jsx',
330
+ '.json',
331
+ '.scss',
332
+ ],
333
+ symlinks: false,
334
+ },
341
335
  };
342
336
  }
@@ -1,5 +1,5 @@
1
1
  import MiniCssExtractPlugin from 'mini-css-extract-plugin';
2
- import webpack from 'webpack';
2
+ import { type Configuration } from 'webpack';
3
3
  import { type OptionsT as BaseOptionsT } from './app-base';
4
4
  type OptionsT = BaseOptionsT & {
5
5
  dontUseHmr?: boolean;
@@ -11,5 +11,5 @@ type OptionsT = BaseOptionsT & {
11
11
  * @param [ops.dontUseReactGlobalStateDebugging]
12
12
  * @param [ops.dontUseHmr]
13
13
  */
14
- export default function configFactory(ops: OptionsT): webpack.Configuration;
14
+ export default function configFactory(ops: OptionsT): Configuration;
15
15
  export {};
@@ -1,14 +1,10 @@
1
1
  "use strict";
2
+ /* eslint-disable import/no-extraneous-dependencies */
2
3
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
5
  };
5
6
  Object.defineProperty(exports, "__esModule", { value: true });
6
7
  exports.default = configFactory;
7
- /**
8
- * @category Configs
9
- * @module webpack/app-development
10
- * @desc development Webpack configuration for applications.
11
- */
12
8
  const lodash_1 = require("lodash");
13
9
  const mini_css_extract_plugin_1 = __importDefault(require("mini-css-extract-plugin"));
14
10
  const react_refresh_webpack_plugin_1 = __importDefault(require("@pmmmwh/react-refresh-webpack-plugin"));
@@ -42,13 +38,13 @@ function configFactory(ops) {
42
38
  // "ReferenceError: $RefreshReg$ is not defined" error. For now it seems
43
39
  // fine to keep these plugins anyway, thus the shortcut of "if" condition
44
40
  // below.
45
- if (true || !o.dontUseHmr) {
46
- plugins.push(new webpack_1.default.HotModuleReplacementPlugin(), new react_refresh_webpack_plugin_1.default({
47
- overlay: {
48
- sockIntegration: 'whm',
49
- },
50
- }));
51
- }
41
+ // if (true ?? !o.dontUseHmr) {
42
+ plugins.push(new webpack_1.default.HotModuleReplacementPlugin(), new react_refresh_webpack_plugin_1.default({
43
+ overlay: {
44
+ sockIntegration: 'whm',
45
+ },
46
+ }));
47
+ // }
52
48
  const res = (0, webpack_merge_1.merge)((0, app_base_1.default)(Object.assign(Object.assign({}, o), { babelEnv: 'development', entry, mode: 'development' })), {
53
49
  output: {
54
50
  chunkFilename: '[id].js',
@@ -9,6 +9,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
9
9
  };
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.default = configFactory;
12
+ /* eslint-disable import/no-extraneous-dependencies */
12
13
  const css_minimizer_webpack_plugin_1 = __importDefault(require("css-minimizer-webpack-plugin"));
13
14
  const mini_css_extract_plugin_1 = __importDefault(require("mini-css-extract-plugin"));
14
15
  const webpack_1 = __importDefault(require("webpack"));
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  };
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.default = configFactory;
8
+ /* eslint-disable import/no-extraneous-dependencies */
8
9
  const path_1 = __importDefault(require("path"));
9
10
  const autoprefixer_1 = __importDefault(require("autoprefixer"));
10
11
  const mini_css_extract_plugin_1 = __importDefault(require("mini-css-extract-plugin"));
@@ -17,6 +18,7 @@ const utils_1 = require("@dr.pogodin/babel-plugin-react-css-modules/utils");
17
18
  * @return {object}
18
19
  */
19
20
  function configFactory(ops) {
21
+ var _a;
20
22
  const plugins = [
21
23
  new mini_css_extract_plugin_1.default(Object.assign({ filename: 'style.css' }, ops.cssExtractionOptions)),
22
24
  ];
@@ -44,18 +46,6 @@ function configFactory(ops) {
44
46
  'uuid',
45
47
  ],
46
48
  mode: ops.mode,
47
- output: {
48
- filename: 'web.bundle.js',
49
- // TODO: Check, whether this fix can be dropped.
50
- // Workaround to fix umd build, restore webpack v3 behaviour
51
- // https://github.com/webpack/webpack/issues/6677
52
- // https://github.com/webpack/webpack/issues/6642
53
- globalObject: "typeof self !== 'undefined' ? self : this",
54
- library: ops.library,
55
- path: ops.outputPath,
56
- libraryTarget: 'umd',
57
- },
58
- plugins,
59
49
  module: {
60
50
  rules: [{
61
51
  /* Handles font imports in url(..) instructions in CSS. Effectively,
@@ -63,11 +53,6 @@ function configFactory(ops) {
63
53
  * the original location of the font assets in
64
54
  * the library being build. */
65
55
  test: /\.(eot|otf|svg|ttf|woff2?)$/,
66
- include: [
67
- /node_modules/,
68
- /src[/\\]assets[/\\]fonts/,
69
- ],
70
- type: 'asset/resource',
71
56
  generator: {
72
57
  // TODO: This comes from the older config version which relied on
73
58
  // file-loader. It might require some correction to correctly join
@@ -75,6 +60,11 @@ function configFactory(ops) {
75
60
  filename: '../shared/[path][name][ext]',
76
61
  publicPath: `${ops.library}/build/shared`,
77
62
  },
63
+ include: [
64
+ /node_modules/,
65
+ /src[/\\]assets[/\\]fonts/,
66
+ ],
67
+ type: 'asset/resource',
78
68
  }, {
79
69
  // Aggregates source maps from dependencies.
80
70
  test: /\.js$/,
@@ -96,7 +86,7 @@ function configFactory(ops) {
96
86
  noRR: true,
97
87
  typescript: ops.typescript,
98
88
  }],
99
- ] }, ops.babelLoaderOptions || {}),
89
+ ] }, (_a = ops.babelLoaderOptions) !== null && _a !== void 0 ? _a : {}),
100
90
  }, {
101
91
  /* Loads SCSS stylesheets. */
102
92
  test: /\.scss/,
@@ -143,6 +133,18 @@ function configFactory(ops) {
143
133
  ],
144
134
  }],
145
135
  },
136
+ output: {
137
+ filename: 'web.bundle.js',
138
+ // TODO: Check, whether this fix can be dropped.
139
+ // Workaround to fix umd build, restore webpack v3 behaviour
140
+ // https://github.com/webpack/webpack/issues/6677
141
+ // https://github.com/webpack/webpack/issues/6642
142
+ globalObject: "typeof self !== 'undefined' ? self : this",
143
+ library: ops.library,
144
+ libraryTarget: 'umd',
145
+ path: ops.outputPath,
146
+ },
147
+ plugins,
146
148
  resolve: {
147
149
  alias: {
148
150
  /* Aliases to JS an JSX files are handled by Babel. */
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  };
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.default = configFactory;
8
+ /* eslint-disable import/no-extraneous-dependencies */
8
9
  const path_1 = __importDefault(require("path"));
9
10
  const webpack_1 = __importDefault(require("webpack"));
10
11
  const webpack_merge_1 = require("webpack-merge");
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  };
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.default = configFactory;
8
+ /* eslint-disable import/no-extraneous-dependencies */
8
9
  const path_1 = __importDefault(require("path"));
9
10
  const css_minimizer_webpack_plugin_1 = __importDefault(require("css-minimizer-webpack-plugin"));
10
11
  const webpack_1 = __importDefault(require("webpack"));
@@ -1,10 +1,8 @@
1
1
  /**
2
2
  * Default Workbox config.
3
3
  */
4
- /* global self */
5
4
 
6
- // This is to whitelist self usage beloew.
7
- /* eslint-disable no-restricted-globals */
5
+ /* global self */
8
6
 
9
7
  /* eslint-disable import/no-extraneous-dependencies */
10
8
  import { clientsClaim } from 'workbox-core';
@@ -14,6 +12,5 @@ import { precacheAndRoute } from 'workbox-precaching';
14
12
  self.skipWaiting();
15
13
  clientsClaim();
16
14
 
17
- /* eslint-disable no-underscore-dangle */
15
+ // eslint-disable-next-line no-underscore-dangle
18
16
  precacheAndRoute(self.__WB_MANIFEST);
19
- /* eslint-enable no-underscore-dangle */
package/dev-styles.js CHANGED
@@ -0,0 +1 @@
1
+ // TODO: Do we really need this module?
@@ -0,0 +1,13 @@
1
+ import config from './config/eslint/default.mjs';
2
+
3
+ config.push(
4
+ {
5
+ ignores: [
6
+ 'config/babel/',
7
+ 'config/webpack/',
8
+ 'docs/.docusaurus/',
9
+ ],
10
+ },
11
+ );
12
+
13
+ export default config;
package/node-entry.js CHANGED
@@ -1,10 +1,15 @@
1
+ // TODO: We should re-visit, if this can be simplified / optimized?
2
+ /* global global, module, process, require */
3
+
1
4
  // This permits to load the library in react-native, or other environment that
2
5
  // does not have __dirname global. It probably breaks a few node-specific lib
3
6
  // pieces, but that does not seem to prevent more relevant parts from working.
4
- // eslint-disable-next-line no-underscore-dangle
5
- if (typeof __dirname === 'undefined') global.__dirname = '';
7
+ if (typeof __dirname === 'undefined') {
8
+ global.__dirname = ''; // eslint-disable-line no-underscore-dangle
9
+ }
6
10
 
7
11
  // Again, for react-native, and maybe some other environments, we need
8
12
  // to have no dynamic requires below (i.e. can't do require(`./build/${env}`)).
13
+ // eslint-disable-next-line import/no-commonjs
9
14
  module.exports = process.env.NODE_ENV === 'production'
10
15
  ? require('./build/production') : require('./build/development');
package/null.js CHANGED
@@ -0,0 +1 @@
1
+ // TODO: Do we really need this module?
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.42.0",
2
+ "version": "1.42.1",
3
3
  "bin": {
4
4
  "react-utils-build": "bin/build.js",
5
5
  "react-utils-setup": "bin/setup.js"
@@ -9,10 +9,11 @@
9
9
  },
10
10
  "dependencies": {
11
11
  "@babel/runtime": "^7.27.0",
12
- "@dr.pogodin/babel-plugin-react-css-modules": "^6.13.3",
12
+ "@dr.pogodin/babel-plugin-react-css-modules": "^6.13.4",
13
13
  "@dr.pogodin/csurf": "^1.14.1",
14
14
  "@dr.pogodin/js-utils": "^0.0.17",
15
15
  "@dr.pogodin/react-global-state": "^0.18.1",
16
+ "@dr.pogodin/react-helmet": "^3.0.1",
16
17
  "@dr.pogodin/react-themes": "^1.8.0",
17
18
  "@jest/environment": "^29.7.0",
18
19
  "axios": "^1.8.4",
@@ -34,8 +35,7 @@
34
35
  "raf": "^3.4.1",
35
36
  "react": "^19.1.0",
36
37
  "react-dom": "^19.1.0",
37
- "@dr.pogodin/react-helmet": "^2.0.4",
38
- "react-router": "^7.4.1",
38
+ "react-router": "^7.5.1",
39
39
  "request-ip": "^3.3.0",
40
40
  "rimraf": "^6.0.0",
41
41
  "serialize-javascript": "^6.0.2",
@@ -48,8 +48,6 @@
48
48
  "devDependencies": {
49
49
  "@babel/cli": "^7.27.0",
50
50
  "@babel/core": "^7.26.10",
51
- "@babel/eslint-parser": "^7.27.0",
52
- "@babel/eslint-plugin": "^7.27.0",
53
51
  "@babel/node": "^7.26.0",
54
52
  "@babel/plugin-transform-runtime": "^7.26.10",
55
53
  "@babel/preset-env": "^7.26.9",
@@ -58,9 +56,10 @@
58
56
  "@babel/register": "^7.25.9",
59
57
  "@dr.pogodin/babel-plugin-transform-assets": "^1.2.4",
60
58
  "@dr.pogodin/babel-preset-svgr": "^1.9.0",
59
+ "@dr.pogodin/eslint-configs": "^0.0.2",
61
60
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.16",
62
61
  "@testing-library/dom": "^10.4.0",
63
- "@testing-library/react": "^16.2.0",
62
+ "@testing-library/react": "^16.3.0",
64
63
  "@testing-library/user-event": "^14.6.1",
65
64
  "@tsconfig/recommended": "^1.0.8",
66
65
  "@types/compression": "^1.7.5",
@@ -74,13 +73,14 @@
74
73
  "@types/morgan": "^1.9.9",
75
74
  "@types/node-forge": "^1.3.11",
76
75
  "@types/pretty": "^2.0.3",
77
- "@types/react": "^19.0.12",
78
- "@types/react-dom": "^19.0.4",
76
+ "@types/react": "^19.1.2",
77
+ "@types/react-dom": "^19.1.2",
79
78
  "@types/request-ip": "^0.0.41",
80
79
  "@types/serialize-javascript": "^5.0.4",
81
80
  "@types/serve-favicon": "^2.5.7",
82
81
  "@types/supertest": "^6.0.3",
83
82
  "@types/webpack": "^5.28.5",
83
+ "@types/webpack-hot-middleware": "^2.25.9",
84
84
  "autoprefixer": "^10.4.21",
85
85
  "babel-jest": "^29.7.0",
86
86
  "babel-loader": "^10.0.0",
@@ -88,15 +88,7 @@
88
88
  "core-js": "^3.41.0",
89
89
  "css-loader": "^7.1.2",
90
90
  "css-minimizer-webpack-plugin": "^7.0.2",
91
- "eslint": "^8.57.1",
92
- "eslint-config-airbnb": "^19.0.4",
93
- "eslint-config-airbnb-typescript": "^18.0.0",
94
- "eslint-import-resolver-babel-module": "^5.3.2",
95
- "eslint-plugin-import": "^2.31.0",
96
- "eslint-plugin-jest": "^28.11.0",
97
- "eslint-plugin-jsx-a11y": "^6.10.2",
98
- "eslint-plugin-react": "^7.37.4",
99
- "eslint-plugin-react-hooks": "^4.6.2",
91
+ "eslint": "^9.25.0",
100
92
  "identity-obj-proxy": "^3.0.0",
101
93
  "jest": "^29.7.0",
102
94
  "jest-environment-jsdom": "^29.7.0",
@@ -111,19 +103,18 @@
111
103
  "react-refresh": "^0.17.0",
112
104
  "regenerator-runtime": "^0.14.1",
113
105
  "resolve-url-loader": "^5.0.0",
114
- "sass": "^1.86.0",
106
+ "sass": "^1.86.3",
115
107
  "sass-loader": "^16.0.5",
116
108
  "sitemap": "^8.0.0",
117
109
  "source-map-loader": "^5.0.0",
118
- "stylelint": "^16.17.0",
110
+ "stylelint": "^16.18.0",
119
111
  "stylelint-config-standard-scss": "^14.0.0",
120
112
  "supertest": "^7.1.0",
121
- "tsc-alias": "^1.8.13",
113
+ "tsc-alias": "^1.8.15",
122
114
  "tstyche": "^3.5.0",
123
115
  "typed-scss-modules": "^8.1.1",
124
- "typescript": "^5.8.2",
125
- "typescript-eslint": "^8.28.0",
126
- "webpack": "^5.98.0",
116
+ "typescript": "^5.8.3",
117
+ "webpack": "^5.99.6",
127
118
  "webpack-dev-middleware": "^7.4.2",
128
119
  "webpack-hot-middleware": "^2.26.1",
129
120
  "webpack-merge": "^6.0.1",
@@ -152,6 +143,7 @@
152
143
  "react-native": "./node-entry.js"
153
144
  },
154
145
  "./config/*": "./config/*.js",
146
+ "./config/eslint/*": "./config/eslint/*.mjs",
155
147
  "./config/*.json": "./config/*.json",
156
148
  "./jest": "./build/production/shared/utils/jest/index.js",
157
149
  "./mixins": "./src/styles/mixins.scss",
@@ -201,7 +193,7 @@
201
193
  "jest:types": "tstyche",
202
194
  "jest": "npm run jest:types && npm run jest:1 && npm run jest:2",
203
195
  "lint": "npm run lint:code && npm run lint:scss",
204
- "lint:code": "eslint --ext .js,.jsx,.ts,.tsx .",
196
+ "lint:code": "eslint",
205
197
  "lint:scss": "stylelint -- **/*.{css,scss}",
206
198
  "test": "npm run lint && npm run typecheck && npm run jest",
207
199
  "typecheck": "tsc --project __tests__/tsconfig.json"
package/prod-styles.js CHANGED
@@ -0,0 +1 @@
1
+ // TODO: Do we really need this module?
@@ -5,6 +5,8 @@
5
5
  // Note: this way, only required part of "node-forge": AES, and some utils,
6
6
  // is bundled into client-side code.
7
7
  import forge from 'node-forge/lib/forge';
8
+
9
+ // eslint-disable-next-line import/no-unassigned-import
8
10
  import 'node-forge/lib/aes';
9
11
 
10
12
  import type { InjT } from 'utils/globalState';
@@ -16,8 +18,8 @@ import { getBuildInfo } from 'utils/isomorphy/buildInfo';
16
18
  // environment, but there is no document.
17
19
  let inj: InjT = {};
18
20
 
19
- const metaElement: HTMLMetaElement | null = typeof document !== 'undefined'
20
- ? document.querySelector('meta[itemprop="drpruinj"]') : null;
21
+ const metaElement: HTMLMetaElement | null = typeof document === 'undefined'
22
+ ? null : document.querySelector('meta[itemprop="drpruinj"]');
21
23
 
22
24
  if (metaElement) {
23
25
  metaElement.remove();
@@ -30,7 +32,10 @@ if (metaElement) {
30
32
  d.finish();
31
33
 
32
34
  data = forge.util.decodeUtf8(d.output.data);
33
- inj = eval(`(${data})`); // eslint-disable-line no-eval
35
+
36
+ // TODO: Double-check, if there is a safer alternative to parse it?
37
+ // eslint-disable-next-line no-eval
38
+ inj = eval(`(${data})`) as InjT;
34
39
  } else if (typeof window !== 'undefined' && window.REACT_UTILS_INJECTION) {
35
40
  inj = window.REACT_UTILS_INJECTION;
36
41
  delete window.REACT_UTILS_INJECTION;
@@ -1,7 +1,7 @@
1
1
  // Initialization of client-side code.
2
2
  /* global document */
3
3
 
4
- import { type ComponentType } from 'react';
4
+ import type { ComponentType } from 'react';
5
5
  import { createRoot, hydrateRoot } from 'react-dom/client';
6
6
  import { HelmetProvider } from '@dr.pogodin/react-helmet';
7
7
  import { BrowserRouter } from 'react-router';
@@ -12,7 +12,7 @@ import getInj from './getInj';
12
12
 
13
13
  type OptionsT = {
14
14
  dontHydrate?: boolean;
15
- initialState?: any;
15
+ initialState?: unknown;
16
16
  };
17
17
 
18
18
  /**
@@ -23,11 +23,11 @@ type OptionsT = {
23
23
  export default function Launch(
24
24
  Application: ComponentType,
25
25
  options: OptionsT = {},
26
- ) {
26
+ ): void {
27
27
  const container = document.getElementById('react-view');
28
28
  if (!container) throw Error('Failed to find container for React app');
29
29
  const scene = (
30
- <GlobalStateProvider initialState={getInj().ISTATE || options.initialState}>
30
+ <GlobalStateProvider initialState={getInj().ISTATE ?? options.initialState}>
31
31
  <BrowserRouter>
32
32
  <HelmetProvider>
33
33
  <Application />