@dr.pogodin/react-utils 1.47.4 → 1.48.0

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 (129) hide show
  1. package/build/development/client/getInj.js +4 -0
  2. package/build/development/client/getInj.js.map +1 -1
  3. package/build/development/index.js +1 -1
  4. package/build/development/index.js.map +1 -1
  5. package/build/development/server/server.js +0 -1
  6. package/build/development/server/server.js.map +1 -1
  7. package/build/development/shared/components/Button/index.js +13 -9
  8. package/build/development/shared/components/Button/index.js.map +1 -1
  9. package/build/development/shared/components/Checkbox/index.js +8 -7
  10. package/build/development/shared/components/Checkbox/index.js.map +1 -1
  11. package/build/development/shared/components/Input/index.js +14 -12
  12. package/build/development/shared/components/Input/index.js.map +1 -1
  13. package/build/development/shared/components/Modal/index.js +15 -3
  14. package/build/development/shared/components/Modal/index.js.map +1 -1
  15. package/build/development/shared/components/PageLayout/index.js +18 -15
  16. package/build/development/shared/components/PageLayout/index.js.map +1 -1
  17. package/build/development/shared/components/TextArea/index.js +9 -8
  18. package/build/development/shared/components/TextArea/index.js.map +1 -1
  19. package/build/development/shared/components/Throbber/index.js +15 -12
  20. package/build/development/shared/components/Throbber/index.js.map +1 -1
  21. package/build/development/shared/components/WithTooltip/index.js +6 -6
  22. package/build/development/shared/components/WithTooltip/index.js.map +1 -1
  23. package/build/development/shared/components/YouTubeVideo/index.js +6 -5
  24. package/build/development/shared/components/YouTubeVideo/index.js.map +1 -1
  25. package/build/development/shared/components/selectors/CustomDropdown/index.js +13 -12
  26. package/build/development/shared/components/selectors/CustomDropdown/index.js.map +1 -1
  27. package/build/development/shared/components/selectors/NativeDropdown/index.js +11 -10
  28. package/build/development/shared/components/selectors/NativeDropdown/index.js.map +1 -1
  29. package/build/development/shared/components/selectors/Switch/index.js +9 -9
  30. package/build/development/shared/components/selectors/Switch/index.js.map +1 -1
  31. package/build/development/shared/components/selectors/common.js.map +1 -1
  32. package/build/development/shared/components/selectors/index.js +1 -1
  33. package/build/development/shared/components/selectors/index.js.map +1 -1
  34. package/build/development/shared/utils/index.js +2 -5
  35. package/build/development/shared/utils/index.js.map +1 -1
  36. package/build/development/shared/utils/jest/E2eSsrEnv.js +0 -1
  37. package/build/development/shared/utils/jest/E2eSsrEnv.js.map +1 -1
  38. package/build/production/client/getInj.js +2 -2
  39. package/build/production/client/getInj.js.map +1 -1
  40. package/build/production/index.js +1 -1
  41. package/build/production/index.js.map +1 -1
  42. package/build/production/server/server.js +1 -1
  43. package/build/production/server/server.js.map +1 -1
  44. package/build/production/shared/components/Button/index.js +3 -8
  45. package/build/production/shared/components/Button/index.js.map +1 -1
  46. package/build/production/shared/components/Checkbox/index.js +1 -1
  47. package/build/production/shared/components/Checkbox/index.js.map +1 -1
  48. package/build/production/shared/components/Input/index.js +6 -6
  49. package/build/production/shared/components/Input/index.js.map +1 -1
  50. package/build/production/shared/components/Modal/index.js +3 -2
  51. package/build/production/shared/components/Modal/index.js.map +1 -1
  52. package/build/production/shared/components/PageLayout/index.js +2 -2
  53. package/build/production/shared/components/PageLayout/index.js.map +1 -1
  54. package/build/production/shared/components/TextArea/index.js +4 -4
  55. package/build/production/shared/components/TextArea/index.js.map +1 -1
  56. package/build/production/shared/components/Throbber/index.js +2 -2
  57. package/build/production/shared/components/Throbber/index.js.map +1 -1
  58. package/build/production/shared/components/WithTooltip/index.js +3 -3
  59. package/build/production/shared/components/WithTooltip/index.js.map +1 -1
  60. package/build/production/shared/components/YouTubeVideo/index.js +4 -4
  61. package/build/production/shared/components/YouTubeVideo/index.js.map +1 -1
  62. package/build/production/shared/components/selectors/CustomDropdown/index.js +2 -2
  63. package/build/production/shared/components/selectors/CustomDropdown/index.js.map +1 -1
  64. package/build/production/shared/components/selectors/NativeDropdown/index.js +3 -3
  65. package/build/production/shared/components/selectors/NativeDropdown/index.js.map +1 -1
  66. package/build/production/shared/components/selectors/Switch/index.js +1 -1
  67. package/build/production/shared/components/selectors/Switch/index.js.map +1 -1
  68. package/build/production/shared/components/selectors/common.js.map +1 -1
  69. package/build/production/shared/components/selectors/index.js +1 -1
  70. package/build/production/shared/components/selectors/index.js.map +1 -1
  71. package/build/production/shared/utils/index.js +1 -1
  72. package/build/production/shared/utils/index.js.map +1 -1
  73. package/build/production/shared/utils/jest/E2eSsrEnv.js +1 -1
  74. package/build/production/shared/utils/jest/E2eSsrEnv.js.map +1 -1
  75. package/build/types-code/index.d.ts +1 -1
  76. package/build/types-code/shared/components/Button/index.d.ts +6 -10
  77. package/build/types-code/shared/components/Checkbox/index.d.ts +4 -3
  78. package/build/types-code/shared/components/Input/index.d.ts +12 -4
  79. package/build/types-code/shared/components/Modal/index.d.ts +6 -3
  80. package/build/types-code/shared/components/PageLayout/index.d.ts +19 -4
  81. package/build/types-code/shared/components/TextArea/index.d.ts +4 -4
  82. package/build/types-code/shared/components/Throbber/index.d.ts +13 -3
  83. package/build/types-code/shared/components/WithTooltip/index.d.ts +18 -4
  84. package/build/types-code/shared/components/YouTubeVideo/index.d.ts +20 -4
  85. package/build/types-code/shared/components/selectors/CustomDropdown/index.d.ts +3 -2
  86. package/build/types-code/shared/components/selectors/NativeDropdown/index.d.ts +22 -2
  87. package/build/types-code/shared/components/selectors/Switch/index.d.ts +7 -6
  88. package/build/types-code/shared/components/selectors/common.d.ts +2 -3
  89. package/build/types-code/shared/components/selectors/index.d.ts +2 -2
  90. package/build/types-code/shared/utils/index.d.ts +2 -7
  91. package/build/web/client/getInj.js +3 -0
  92. package/build/web/client/getInj.js.map +1 -1
  93. package/build/web/index.js +1 -1
  94. package/build/web/index.js.map +1 -1
  95. package/build/web/server/server.js +0 -1
  96. package/build/web/server/server.js.map +1 -1
  97. package/build/web/shared/components/Button/index.js +13 -9
  98. package/build/web/shared/components/Button/index.js.map +1 -1
  99. package/build/web/shared/components/Checkbox/index.js +8 -7
  100. package/build/web/shared/components/Checkbox/index.js.map +1 -1
  101. package/build/web/shared/components/Input/index.js +14 -12
  102. package/build/web/shared/components/Input/index.js.map +1 -1
  103. package/build/web/shared/components/Modal/index.js +15 -3
  104. package/build/web/shared/components/Modal/index.js.map +1 -1
  105. package/build/web/shared/components/PageLayout/index.js +18 -15
  106. package/build/web/shared/components/PageLayout/index.js.map +1 -1
  107. package/build/web/shared/components/TextArea/index.js +9 -8
  108. package/build/web/shared/components/TextArea/index.js.map +1 -1
  109. package/build/web/shared/components/Throbber/index.js +15 -12
  110. package/build/web/shared/components/Throbber/index.js.map +1 -1
  111. package/build/web/shared/components/WithTooltip/index.js +6 -6
  112. package/build/web/shared/components/WithTooltip/index.js.map +1 -1
  113. package/build/web/shared/components/YouTubeVideo/index.js +6 -5
  114. package/build/web/shared/components/YouTubeVideo/index.js.map +1 -1
  115. package/build/web/shared/components/selectors/CustomDropdown/index.js +13 -12
  116. package/build/web/shared/components/selectors/CustomDropdown/index.js.map +1 -1
  117. package/build/web/shared/components/selectors/NativeDropdown/index.js +11 -10
  118. package/build/web/shared/components/selectors/NativeDropdown/index.js.map +1 -1
  119. package/build/web/shared/components/selectors/Switch/index.js +9 -9
  120. package/build/web/shared/components/selectors/Switch/index.js.map +1 -1
  121. package/build/web/shared/components/selectors/common.js.map +1 -1
  122. package/build/web/shared/components/selectors/index.js +1 -1
  123. package/build/web/shared/components/selectors/index.js.map +1 -1
  124. package/build/web/shared/utils/index.js +2 -5
  125. package/build/web/shared/utils/index.js.map +1 -1
  126. package/build/web/shared/utils/jest/E2eSsrEnv.js +0 -1
  127. package/build/web/shared/utils/jest/E2eSsrEnv.js.map +1 -1
  128. package/config/babel/webpack.js +1 -1
  129. package/package.json +15 -15
@@ -1 +1 @@
1
- {"version":3,"file":"E2eSsrEnv.js","names":["path","defaults","set","register","JsdomEnv","Volume","createFsFromVolume","webpack","noop","E2eSsrEnv","loadWebpackConfig","optionsString","pragmas","options","JSON","parse","context","testFolder","fs","global","webpackOutputFs","factoryPath","factory","resolve","rootDir","default","webpackConfig","buildInfo","existsSync","readFileSync","runWebpack","Error","compiler","outputFileSystem","Promise","done","fail","run","err","stats","hasErrors","console","error","toJson","errors","webpackStats","runSsr","logger","debug","info","log","warn","cleanup","entry","p","module","exportName","entryExportName","Application","ssrFactory","renderer","status","markup","ssrRequest","cookie","send","value","locals","devMiddleware","ssrMarkup","ssrOptions","ssrStatus","constructor","config","docblockPragmas","requestString","request","url","csrfToken","projectConfig","dom","dirname","testPath","withSsr","root","process","cwd","envName","babelEnv","extensions","setup","require","cache","setBuildInfo","undefined","REACT_UTILS_FORCE_CLIENT_SIDE","teardown","Object","keys","forEach","key","revert"],"sources":["../../../../../src/shared/utils/jest/E2eSsrEnv.ts"],"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\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\n// TODO: We need to add correct typing for environment options.\n\nimport path from 'node:path';\n\nimport type { Request, Response } from 'express';\n\nimport { defaults, set } from 'lodash-es';\n\nimport type { ReactNode } from 'react';\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/experimental-worker';\n\nimport JsdomEnv from 'jest-environment-jsdom';\nimport { Volume, createFsFromVolume } from 'memfs';\nimport webpack, { type Configuration } from 'webpack';\n/* eslint-enable import/no-extraneous-dependencies */\n\nimport type {\n EnvironmentContext,\n JestEnvironmentConfig,\n} from '@jest/environment';\n\nfunction noop() {\n // NOOP\n}\n\nexport default class E2eSsrEnv extends JsdomEnv {\n pragmas: Record<string, string | string[]>;\n\n ssrRequest: object;\n\n rootDir: string;\n\n testFolder: string;\n\n withSsr: boolean;\n\n webpackStats?: webpack.StatsCompilation;\n\n /**\n * Loads Webpack config, and exposes it to the environment via global\n * webpackConfig object.\n */\n private async loadWebpackConfig() {\n const optionsString = this.pragmas['webpack-config-options'] as string;\n\n const options = (optionsString ? JSON.parse(optionsString) : {}) as\n webpack.Configuration;\n\n defaults(options, {\n context: this.testFolder,\n fs: this.global.webpackOutputFs,\n });\n\n const factoryPath = this.pragmas['webpack-config-factory'] as string;\n\n let factory = await import(/* webpackChunkName: \"not-a-valid-chunk\" */\n path.resolve(this.rootDir, factoryPath)\n ) as (((ops: Configuration) => Configuration) | {\n default: (ops: Configuration) => Configuration;\n });\n\n factory = 'default' in factory ? factory.default : factory;\n\n this.global.webpackConfig = factory(options);\n\n const fs = this.global.webpackOutputFs;\n let buildInfo = `${options.context}/.build-info`;\n if (fs.existsSync(buildInfo)) {\n buildInfo = fs.readFileSync(buildInfo, 'utf8') as string;\n this.global.buildInfo = JSON.parse(buildInfo);\n }\n }\n\n /**\n * Executes Webpack build.\n * @return {Promise}\n */\n async runWebpack(): Promise<void> {\n await this.loadWebpackConfig();\n\n if (!this.global.webpackConfig) throw Error('Failed to load Webpack config');\n const compiler = webpack(this.global.webpackConfig);\n if (!compiler) throw Error('Failed to construct Webpack compiler');\n\n // TODO: The \"as typeof compiler.outputFileSystem\" piece below is\n // a workaround for the Webpack regression:\n // https://github.com/webpack/webpack/issues/18242\n compiler.outputFileSystem = this.global.webpackOutputFs as\n typeof compiler.outputFileSystem;\n\n return new Promise<void>((done, fail) => {\n compiler.run((err, stats) => {\n if (err) fail(err);\n if (stats?.hasErrors()) {\n // eslint-disable-next-line no-console\n console.error(stats.toJson().errors);\n fail(Error('Webpack compilation failed'));\n }\n\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(): Promise<void> {\n const optionsString = this.pragmas['ssr-options'] as string;\n const options = optionsString\n ? JSON.parse(optionsString) as Record<string, unknown>\n : {};\n\n // TODO: This is temporary to shortcut the logging added to SSR.\n options.logger ??= {\n debug: noop,\n info: noop,\n log: noop,\n warn: noop,\n };\n\n options.buildInfo ??= this.global.buildInfo;\n\n let cleanup: (() => void) | undefined;\n\n if (options.entry) {\n const p = path.resolve(this.testFolder, options.entry as string);\n const module = await import(/* webpackChunkName: \"not-a-valid-chunk\" */\n p\n ) as NodeJS.Module;\n\n if ('cleanup' in module) cleanup = module.cleanup as () => void;\n\n const exportName = (options.entryExportName as string) || 'default';\n if (exportName in module) {\n options.Application = (\n module as unknown as Record<string, unknown>\n )[exportName] as ReactNode;\n }\n }\n\n const { default: ssrFactory } = await import(/* webpackChunkName: \"not-a-valid-chunk\" */ 'server/renderer');\n const renderer = ssrFactory(this.global.webpackConfig!, options);\n let status = 200; // OK\n const markup = await new Promise<string>((done, fail) => {\n void renderer(\n this.ssrRequest as Request,\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 cookie: noop,\n send: done,\n set: noop,\n status: (value: number) => {\n status = value;\n },\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 } as unknown) as Response,\n\n (error) => {\n // TODO: Strictly speaking, that error as Error casting is not all\n // correct, but it works, so no need to spend time on it right now.\n if (error) fail(error as Error);\n else done('');\n },\n );\n });\n\n this.global.ssrMarkup = markup;\n this.global.ssrOptions = options;\n this.global.ssrStatus = status;\n\n if (cleanup) cleanup();\n }\n\n constructor(\n config: JestEnvironmentConfig,\n context: EnvironmentContext,\n ) {\n const pragmas = context.docblockPragmas;\n\n const requestString = pragmas['ssr-request'] as string;\n const request = requestString\n ? JSON.parse(requestString) as Record<string, unknown>\n : {};\n\n request.url ??= '/';\n request.csrfToken = noop;\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 as string}`,\n );\n\n super(config, context);\n\n this.global.dom = this.dom;\n this.global.webpackOutputFs = createFsFromVolume(new Volume());\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 // The usual \"babel-jest\" transformation setup does not apply to\n // the environment code and imports from it, this workaround enables it.\n const optionsString = this.pragmas['ssr-options'] as string;\n const options = optionsString\n ? JSON.parse(optionsString) as Record<string, unknown>\n : {};\n let root;\n switch (options.root) {\n case 'TEST':\n root = this.testFolder;\n break;\n default: root = process.cwd();\n }\n\n // BEWARE: Anything imported prior to this register() call seems to be\n // transpiled again by Babel if loaded after this call. This causes very\n // confusing errors when testing the code dependent on some sort of contexts\n // (because loading a module again effectively creates a new context object,\n // which is not recognized by the code expecting another context instance).\n // That's why below we prefer dynamic imports for some React Utils methods.\n register({\n envName: options.babelEnv as string,\n extensions: ['.js', '.jsx', '.ts', '.tsx', '.svg'],\n root,\n });\n }\n\n async setup(): Promise<void> {\n await super.setup();\n await this.runWebpack();\n\n // NOTE: It is possible that the Webpack run above, and the SSR run below\n // load different versions of the same module (CommonJS, and ES), and it may\n // cause very confusing problems (e.g. see:\n // https://github.com/birdofpreyru/react-utils/issues/413).\n // It seems we can't reset the cache of ES modules, and Jest's module reset\n // does not reset modules loaded in this enviroment module, and also only\n // replacing entire cache object by and empty {} seems to help (in contrast\n // to deleting all entries by their keys, as it is done within .teardown()\n // method below). Thus, for now we do this as a hotfix, and we also reset\n // build info to undefined, because ES module version not beeing reset\n // triggers an error on the subsequent test using the environment.\n // TODO: Look for a cleaner solution.\n require.cache = {};\n\n const { setBuildInfo } = await import(/* webpackChunkName: \"not-a-valid-chunk\" */'../isomorphy/buildInfo');\n setBuildInfo(undefined, true);\n\n if (this.withSsr) await this.runSsr();\n this.global.REACT_UTILS_FORCE_CLIENT_SIDE = true;\n }\n\n async teardown(): Promise<void> {\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 await super.teardown();\n }\n}\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,OAAOA,IAAI,MAAM,WAAW;AAI5B,SAASC,QAAQ,EAAEC,GAAG,QAAQ,WAAW;AAIzC;AACA;AACA;AACA,OAAOC,QAAQ,MAAM,qCAAqC;AAE1D,OAAOC,QAAQ,MAAM,wBAAwB;AAC7C,SAASC,MAAM,EAAEC,kBAAkB,QAAQ,OAAO;AAClD,OAAOC,OAAO,MAA8B,SAAS;AACrD;;AAOA,SAASC,IAAIA,CAAA,EAAG;EACd;AAAA;AAGF,eAAe,MAAMC,SAAS,SAASL,QAAQ,CAAC;EAa9C;AACF;AACA;AACA;EACE,MAAcM,iBAAiBA,CAAA,EAAG;IAChC,MAAMC,aAAa,GAAG,IAAI,CAACC,OAAO,CAAC,wBAAwB,CAAW;IAEtE,MAAMC,OAAO,GAAIF,aAAa,GAAGG,IAAI,CAACC,KAAK,CAACJ,aAAa,CAAC,GAAG,CAAC,CACvC;IAEvBV,QAAQ,CAACY,OAAO,EAAE;MAChBG,OAAO,EAAE,IAAI,CAACC,UAAU;MACxBC,EAAE,EAAE,IAAI,CAACC,MAAM,CAACC;IAClB,CAAC,CAAC;IAEF,MAAMC,WAAW,GAAG,IAAI,CAACT,OAAO,CAAC,wBAAwB,CAAW;IAEpE,IAAIU,OAAO,GAAG,MAAM,MAA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;IACF,CAAC,CAAC;EACJ;EAEA,MAAMM,KAAKA,CAAA,EAAkB;IAC3B,MAAM,KAAK,CAACA,KAAK,CAAC,CAAC;IACnB,MAAM,IAAI,CAAC5D,UAAU,CAAC,CAAC;;IAEvB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA6D,OAAO,CAACC,KAAK,GAAG,CAAC,CAAC;IAElB,MAAM;MAAEC;IAAa,CAAC,GAAG,MAAM,MAAM,CAAC,mEAAmE,CAAC;IAC1GA,YAAY,CAACC,SAAS,EAAE,IAAI,CAAC;IAE7B,IAAI,IAAI,CAACX,OAAO,EAAE,MAAM,IAAI,CAACrC,MAAM,CAAC,CAAC;IACrC,IAAI,CAAC3B,MAAM,CAAC4E,6BAA6B,GAAG,IAAI;EAClD;EAEA,MAAMC,QAAQA,CAAA,EAAkB;IAC9B,OAAO,IAAI,CAAC7E,MAAM,CAAC4E,6BAA6B;;IAEhD;IACA;IACA;IACA;IACA;IACA;IACAE,MAAM,CAACC,IAAI,CAACP,OAAO,CAACC,KAAK,CAAC,CAACO,OAAO,CAAEC,GAAG,IAAK;MAC1C,OAAOT,OAAO,CAACC,KAAK,CAACQ,GAAG,CAAC;IAC3B,CAAC,CAAC;IACFjG,QAAQ,CAACkG,MAAM,CAAC,CAAC;IACjB,MAAM,KAAK,CAACL,QAAQ,CAAC,CAAC;EACxB;AACF","ignoreList":[]}
1
+ {"version":3,"file":"E2eSsrEnv.js","names":["path","defaults","set","register","JsdomEnv","Volume","createFsFromVolume","webpack","noop","E2eSsrEnv","loadWebpackConfig","optionsString","pragmas","options","JSON","parse","context","testFolder","fs","global","webpackOutputFs","factoryPath","factory","resolve","rootDir","default","webpackConfig","buildInfo","existsSync","readFileSync","runWebpack","Error","compiler","outputFileSystem","Promise","done","fail","run","err","stats","hasErrors","console","error","toJson","errors","webpackStats","runSsr","logger","debug","info","log","warn","cleanup","entry","p","module","exportName","entryExportName","Application","ssrFactory","renderer","status","markup","ssrRequest","cookie","send","value","locals","devMiddleware","ssrMarkup","ssrOptions","ssrStatus","constructor","config","docblockPragmas","requestString","request","url","csrfToken","projectConfig","dom","dirname","testPath","withSsr","root","process","cwd","envName","babelEnv","extensions","setup","require","cache","setBuildInfo","undefined","REACT_UTILS_FORCE_CLIENT_SIDE","teardown","Object","keys","forEach","key","revert"],"sources":["../../../../../src/shared/utils/jest/E2eSsrEnv.ts"],"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\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\n// TODO: We need to add correct typing for environment options.\n\nimport path from 'node:path';\n\nimport type { Request, Response } from 'express';\n\nimport { defaults, set } from 'lodash-es';\n\nimport type { ReactNode } from 'react';\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/experimental-worker';\n\nimport JsdomEnv from 'jest-environment-jsdom';\nimport { Volume, createFsFromVolume } from 'memfs';\nimport webpack, { type Configuration } from 'webpack';\n/* eslint-enable import/no-extraneous-dependencies */\n\nimport type {\n EnvironmentContext,\n JestEnvironmentConfig,\n} from '@jest/environment';\n\nfunction noop() {\n // NOOP\n}\n\nexport default class E2eSsrEnv extends JsdomEnv {\n pragmas: Record<string, string | string[]>;\n\n ssrRequest: object;\n\n rootDir: string;\n\n testFolder: string;\n\n withSsr: boolean;\n\n webpackStats?: webpack.StatsCompilation;\n\n /**\n * Loads Webpack config, and exposes it to the environment via global\n * webpackConfig object.\n */\n private async loadWebpackConfig() {\n const optionsString = this.pragmas['webpack-config-options'] as string;\n\n const options = (optionsString ? JSON.parse(optionsString) : {}) as\n webpack.Configuration;\n\n defaults(options, {\n context: this.testFolder,\n fs: this.global.webpackOutputFs,\n });\n\n const factoryPath = this.pragmas['webpack-config-factory'] as string;\n\n let factory = await import(/* webpackChunkName: \"not-a-valid-chunk\" */\n path.resolve(this.rootDir, factoryPath)\n ) as (((ops: Configuration) => Configuration) | {\n default: (ops: Configuration) => Configuration;\n });\n\n factory = 'default' in factory ? factory.default : factory;\n\n this.global.webpackConfig = factory(options);\n\n const fs = this.global.webpackOutputFs;\n let buildInfo = `${options.context}/.build-info`;\n if (fs.existsSync(buildInfo)) {\n buildInfo = fs.readFileSync(buildInfo, 'utf8') as string;\n this.global.buildInfo = JSON.parse(buildInfo);\n }\n }\n\n /**\n * Executes Webpack build.\n * @return {Promise}\n */\n async runWebpack(): Promise<void> {\n await this.loadWebpackConfig();\n\n if (!this.global.webpackConfig) throw Error('Failed to load Webpack config');\n const compiler = webpack(this.global.webpackConfig);\n\n // TODO: The \"as typeof compiler.outputFileSystem\" piece below is\n // a workaround for the Webpack regression:\n // https://github.com/webpack/webpack/issues/18242\n compiler.outputFileSystem = this.global.webpackOutputFs as\n typeof compiler.outputFileSystem;\n\n return new Promise<void>((done, fail) => {\n compiler.run((err, stats) => {\n if (err) fail(err);\n if (stats?.hasErrors()) {\n // eslint-disable-next-line no-console\n console.error(stats.toJson().errors);\n fail(Error('Webpack compilation failed'));\n }\n\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(): Promise<void> {\n const optionsString = this.pragmas['ssr-options'] as string;\n const options = optionsString\n ? JSON.parse(optionsString) as Record<string, unknown>\n : {};\n\n // TODO: This is temporary to shortcut the logging added to SSR.\n options.logger ??= {\n debug: noop,\n info: noop,\n log: noop,\n warn: noop,\n };\n\n options.buildInfo ??= this.global.buildInfo;\n\n let cleanup: (() => void) | undefined;\n\n if (options.entry) {\n const p = path.resolve(this.testFolder, options.entry as string);\n const module = await import(/* webpackChunkName: \"not-a-valid-chunk\" */\n p\n ) as NodeJS.Module;\n\n if ('cleanup' in module) cleanup = module.cleanup as () => void;\n\n const exportName = (options.entryExportName as string) || 'default';\n if (exportName in module) {\n options.Application = (\n module as unknown as Record<string, unknown>\n )[exportName] as ReactNode;\n }\n }\n\n const { default: ssrFactory } = await import(/* webpackChunkName: \"not-a-valid-chunk\" */ 'server/renderer');\n const renderer = ssrFactory(this.global.webpackConfig!, options);\n let status = 200; // OK\n const markup = await new Promise<string>((done, fail) => {\n void renderer(\n this.ssrRequest as Request,\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 cookie: noop,\n send: done,\n set: noop,\n status: (value: number) => {\n status = value;\n },\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 } as unknown) as Response,\n\n (error) => {\n // TODO: Strictly speaking, that error as Error casting is not all\n // correct, but it works, so no need to spend time on it right now.\n if (error) fail(error as Error);\n else done('');\n },\n );\n });\n\n this.global.ssrMarkup = markup;\n this.global.ssrOptions = options;\n this.global.ssrStatus = status;\n\n if (cleanup) cleanup();\n }\n\n constructor(\n config: JestEnvironmentConfig,\n context: EnvironmentContext,\n ) {\n const pragmas = context.docblockPragmas;\n\n const requestString = pragmas['ssr-request'] as string;\n const request = requestString\n ? JSON.parse(requestString) as Record<string, unknown>\n : {};\n\n request.url ??= '/';\n request.csrfToken = noop;\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 as string}`,\n );\n\n super(config, context);\n\n this.global.dom = this.dom;\n this.global.webpackOutputFs = createFsFromVolume(new Volume());\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 // The usual \"babel-jest\" transformation setup does not apply to\n // the environment code and imports from it, this workaround enables it.\n const optionsString = this.pragmas['ssr-options'] as string;\n const options = optionsString\n ? JSON.parse(optionsString) as Record<string, unknown>\n : {};\n let root;\n switch (options.root) {\n case 'TEST':\n root = this.testFolder;\n break;\n default: root = process.cwd();\n }\n\n // BEWARE: Anything imported prior to this register() call seems to be\n // transpiled again by Babel if loaded after this call. This causes very\n // confusing errors when testing the code dependent on some sort of contexts\n // (because loading a module again effectively creates a new context object,\n // which is not recognized by the code expecting another context instance).\n // That's why below we prefer dynamic imports for some React Utils methods.\n register({\n envName: options.babelEnv as string,\n extensions: ['.js', '.jsx', '.ts', '.tsx', '.svg'],\n root,\n });\n }\n\n async setup(): Promise<void> {\n await super.setup();\n await this.runWebpack();\n\n // NOTE: It is possible that the Webpack run above, and the SSR run below\n // load different versions of the same module (CommonJS, and ES), and it may\n // cause very confusing problems (e.g. see:\n // https://github.com/birdofpreyru/react-utils/issues/413).\n // It seems we can't reset the cache of ES modules, and Jest's module reset\n // does not reset modules loaded in this enviroment module, and also only\n // replacing entire cache object by and empty {} seems to help (in contrast\n // to deleting all entries by their keys, as it is done within .teardown()\n // method below). Thus, for now we do this as a hotfix, and we also reset\n // build info to undefined, because ES module version not beeing reset\n // triggers an error on the subsequent test using the environment.\n // TODO: Look for a cleaner solution.\n require.cache = {};\n\n const { setBuildInfo } = await import(/* webpackChunkName: \"not-a-valid-chunk\" */'../isomorphy/buildInfo');\n setBuildInfo(undefined, true);\n\n if (this.withSsr) await this.runSsr();\n this.global.REACT_UTILS_FORCE_CLIENT_SIDE = true;\n }\n\n async teardown(): Promise<void> {\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 await super.teardown();\n }\n}\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,OAAOA,IAAI,MAAM,WAAW;AAI5B,SAASC,QAAQ,EAAEC,GAAG,QAAQ,WAAW;AAIzC;AACA;AACA;AACA,OAAOC,QAAQ,MAAM,qCAAqC;AAE1D,OAAOC,QAAQ,MAAM,wBAAwB;AAC7C,SAASC,MAAM,EAAEC,kBAAkB,QAAQ,OAAO;AAClD,OAAOC,OAAO,MAA8B,SAAS;AACrD;;AAOA,SAASC,IAAIA,CAAA,EAAG;EACd;AAAA;AAGF,eAAe,MAAMC,SAAS,SAASL,QAAQ,CAAC;EAa9C;AACF;AACA;AACA;EACE,MAAcM,iBAAiBA,CAAA,EAAG;IAChC,MAAMC,aAAa,GAAG,IAAI,CAACC,OAAO,CAAC,wBAAwB,CAAW;IAEtE,MAAMC,OAAO,GAAIF,aAAa,GAAGG,IAAI,CAACC,KAAK,CAACJ,aAAa,CAAC,GAAG,CAAC,CACvC;IAEvBV,QAAQ,CAACY,OAAO,EAAE;MAChBG,OAAO,EAAE,IAAI,CAACC,UAAU;MACxBC,EAAE,EAAE,IAAI,CAACC,MAAM,CAACC;IAClB,CAAC,CAAC;IAEF,MAAMC,WAAW,GAAG,IAAI,CAACT,OAAO,CAAC,wBAAwB,CAAW;IAEpE,IAAIU,OAAO,GAAG,MAAM,MAAM,CAAC;IACzBtB,IAAI,CAACuB,OAAO,CAAC,IAAI,CAACC,OAAO,EAAEH,WAAW,CACxC,CAEE;IAEFC,OAAO,GAAG,SAAS,IAAIA,OAAO,GAAGA,OAAO,CAACG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;IACA6D,OAAO,CAACC,KAAK,GAAG,CAAC,CAAC;IAElB,MAAM;MAAEC;IAAa,CAAC,GAAG,MAAM,MAAM,CAAC,mEAAmE,CAAC;IAC1GA,YAAY,CAACC,SAAS,EAAE,IAAI,CAAC;IAE7B,IAAI,IAAI,CAACX,OAAO,EAAE,MAAM,IAAI,CAACrC,MAAM,CAAC,CAAC;IACrC,IAAI,CAAC3B,MAAM,CAAC4E,6BAA6B,GAAG,IAAI;EAClD;EAEA,MAAMC,QAAQA,CAAA,EAAkB;IAC9B,OAAO,IAAI,CAAC7E,MAAM,CAAC4E,6BAA6B;;IAEhD;IACA;IACA;IACA;IACA;IACA;IACAE,MAAM,CAACC,IAAI,CAACP,OAAO,CAACC,KAAK,CAAC,CAACO,OAAO,CAAEC,GAAG,IAAK;MAC1C,OAAOT,OAAO,CAACC,KAAK,CAACQ,GAAG,CAAC;IAC3B,CAAC,CAAC;IACFjG,QAAQ,CAACkG,MAAM,CAAC,CAAC;IACjB,MAAM,KAAK,CAACL,QAAQ,CAAC,CAAC;EACxB;AACF","ignoreList":[]}
@@ -37,7 +37,7 @@ function newBaseConfig(options) {
37
37
  presets: [
38
38
  ['@babel/env', {
39
39
  bugfixes: true,
40
- corejs: '3.46',
40
+ corejs: '3.47',
41
41
  // Leaves it to the Webpack to deal with modules.
42
42
  modules: (_a = options.modules) !== null && _a !== void 0 ? _a : false,
43
43
  targets: (_b = options.targets) !== null && _b !== void 0 ? _b : 'defaults',
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.47.4",
2
+ "version": "1.48.0",
3
3
  "bin": {
4
4
  "react-utils-build": "bin/build.js",
5
5
  "react-utils-setup": "bin/setup.js"
@@ -14,15 +14,15 @@
14
14
  "@dr.pogodin/js-utils": "^0.1.4",
15
15
  "@dr.pogodin/react-global-state": "^0.21.2",
16
16
  "@dr.pogodin/react-helmet": "^3.0.4",
17
- "@dr.pogodin/react-themes": "^1.9.4",
17
+ "@dr.pogodin/react-themes": "^1.10.1",
18
18
  "@jest/environment": "^30.2.0",
19
19
  "axios": "^1.13.2",
20
20
  "commander": "^14.0.2",
21
21
  "compression": "^1.8.1",
22
22
  "config": "^4.1.1",
23
- "cookie": "^1.0.2",
23
+ "cookie": "^1.1.0",
24
24
  "cookie-parser": "^1.4.7",
25
- "core-js": "^3.46.0",
25
+ "core-js": "^3.47.0",
26
26
  "cross-env": "^10.1.0",
27
27
  "dayjs": "^1.11.19",
28
28
  "express": "^5.1.0",
@@ -36,7 +36,7 @@
36
36
  "react-dom": "^19.2.0",
37
37
  "react-router": "^7.9.6",
38
38
  "request-ip": "^3.3.0",
39
- "rimraf": "^6.1.0",
39
+ "rimraf": "^6.1.2",
40
40
  "serialize-javascript": "^7.0.0",
41
41
  "serve-favicon": "^2.5.1",
42
42
  "source-map-support": "^0.5.21",
@@ -55,8 +55,8 @@
55
55
  "@babel/register": "^7.28.3",
56
56
  "@dr.pogodin/babel-plugin-transform-assets": "^1.2.5",
57
57
  "@dr.pogodin/babel-preset-svgr": "^1.9.2",
58
- "@dr.pogodin/eslint-configs": "^0.1.1",
59
- "@pmmmwh/react-refresh-webpack-plugin": "^0.6.1",
58
+ "@dr.pogodin/eslint-configs": "^0.1.2",
59
+ "@pmmmwh/react-refresh-webpack-plugin": "^0.6.2",
60
60
  "@standard-schema/spec": "^1.0.0",
61
61
  "@testing-library/dom": "^10.4.1",
62
62
  "@testing-library/react": "^16.3.0",
@@ -68,11 +68,11 @@
68
68
  "@types/cookie-parser": "^1.4.10",
69
69
  "@types/express": "^5.0.5",
70
70
  "@types/jest": "^30.0.0",
71
- "@types/lodash": "^4.17.20",
71
+ "@types/lodash": "^4.17.21",
72
72
  "@types/lodash-es": "^4.17.12",
73
73
  "@types/morgan": "^1.9.10",
74
74
  "@types/pretty": "^2.0.3",
75
- "@types/react": "^19.2.5",
75
+ "@types/react": "^19.2.7",
76
76
  "@types/react-dom": "^19.2.3",
77
77
  "@types/request-ip": "^0.0.41",
78
78
  "@types/serialize-javascript": "^5.0.4",
@@ -101,24 +101,24 @@
101
101
  "pretty": "^2.0.0",
102
102
  "react-refresh": "^0.18.0",
103
103
  "resolve-url-loader": "^5.0.0",
104
- "sass": "^1.94.0",
104
+ "sass": "^1.94.2",
105
105
  "sass-loader": "^16.0.6",
106
106
  "sitemap": "^9.0.0",
107
107
  "source-map-loader": "^5.0.0",
108
- "stylelint": "^16.25.0",
108
+ "stylelint": "^16.26.0",
109
109
  "stylelint-config-standard-scss": "^16.0.0",
110
110
  "supertest": "^7.1.4",
111
111
  "tsc-alias": "1.8.16",
112
112
  "tstyche": "^5.0.1",
113
113
  "typed-scss-modules": "^8.1.1",
114
114
  "typescript": "^5.9.3",
115
- "webpack": "^5.102.1",
115
+ "webpack": "^5.103.0",
116
116
  "webpack-dev-middleware": "^7.4.5",
117
117
  "webpack-hot-middleware": "^2.26.1",
118
118
  "webpack-merge": "^6.0.1",
119
- "workbox-core": "^7.3.0",
120
- "workbox-precaching": "^7.3.0",
121
- "workbox-webpack-plugin": "^7.3.0"
119
+ "workbox-core": "^7.4.0",
120
+ "workbox-precaching": "^7.4.0",
121
+ "workbox-webpack-plugin": "^7.4.0"
122
122
  },
123
123
  "engines": {
124
124
  "node": ">=22.21",