@dr.pogodin/react-utils 1.20.1 → 1.21.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.
@@ -79,6 +79,12 @@ class E2eSsrEnv extends _jestEnvironmentJsdom.default {
79
79
  return new Promise((done, fail) => {
80
80
  compiler.run((err, stats) => {
81
81
  if (err) fail(err);
82
+
83
+ if (stats.hasErrors()) {
84
+ console.error(stats.toJson().errors);
85
+ fail(Error('Webpack compilation failed'));
86
+ }
87
+
82
88
  this.global.webpackStats = stats.toJson(); // Keeps reference to the raw Webpack stats object, which should be
83
89
  // explicitly passed to the server-side renderer alongside the request,
84
90
  // so that it can to pick up asset paths for different named chunks.
@@ -1 +1 @@
1
- {"version":3,"file":"E2eSsrEnv.js","names":["E2eSsrEnv","JsdomEnv","loadWebpackConfig","options","pragmas","JSON","parse","defaults","context","testFolder","fs","global","webpackOutputFs","factory","require","path","resolve","rootDir","webpackConfig","buildInfo","existsSync","readFileSync","runWebpack","compiler","webpack","outputFileSystem","Promise","done","fail","run","err","stats","webpackStats","toJson","runSsr","logger","undefined","debug","noop","info","log","warn","root","process","cwd","register","envName","babelEnv","extensions","entry","p","Application","entryExportName","renderer","ssrFactory","status","markup","ssrRequest","cookie","send","set","value","locals","devMiddleware","error","ssrMarkup","ssrOptions","ssrStatus","constructor","config","docblockPragmas","request","url","csrfToken","projectConfig","dom","createFsFromVolume","Volume","dirname","testPath","withSsr","setup","REACT_UTILS_FORCE_CLIENT_SIDE","teardown","Object","keys","cache","forEach","key","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 fs: this.global.webpackOutputFs,\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\n const fs = this.global.webpackOutputFs;\n let buildInfo = `${options.context}/.build-info`;\n if (fs.existsSync(buildInfo)) {\n buildInfo = fs.readFileSync(buildInfo, 'utf8');\n this.global.buildInfo = JSON.parse(buildInfo);\n }\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 compiler.outputFileSystem = this.global.webpackOutputFs;\n return new Promise((done, fail) => {\n compiler.run((err, stats) => {\n if (err) fail(err);\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() {\n let options = this.pragmas['ssr-options'];\n options = options ? JSON.parse(options) : {};\n\n // TODO: This is temporary to shortcut the logging added to SSR.\n if (options.logger === undefined) {\n options.logger = {\n debug: noop,\n info: noop,\n log: noop,\n warn: noop,\n };\n }\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 let status = 200; // OK\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 cookie: noop,\n send: done,\n set: noop,\n status: (value) => {\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 },\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 this.global.ssrStatus = status;\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 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}`,\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\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;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AA5BA;AACA;AACA;AACA;AACA;AACA;;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;;AACA;;AAKA;AAEe,MAAMA,SAAN,SAAwBC,6BAAxB,CAAiC;EAC9C;AACF;AACA;AACA;EACEC,iBAAiB,GAAG;IAClB,IAAIC,OAAO,GAAG,KAAKC,OAAL,CAAa,wBAAb,CAAd;IACAD,OAAO,GAAGA,OAAO,GAAGE,IAAI,CAACC,KAAL,CAAWH,OAAX,CAAH,GAAyB,EAA1C;IACA,IAAAI,gBAAA,EAASJ,OAAT,EAAkB;MAChBK,OAAO,EAAE,KAAKC,UADE;MAEhBC,EAAE,EAAE,KAAKC,MAAL,CAAYC;IAFA,CAAlB;IAKA,IAAIC,OAAO,GAAG,KAAKT,OAAL,CAAa,wBAAb,KAA0C,EAAxD;IACAS,OAAO,GAAGC,OAAO,CAACC,aAAA,CAAKC,OAAL,CAAa,KAAKC,OAAlB,EAA2BJ,OAA3B,CAAD,CAAjB;IACA,KAAKF,MAAL,CAAYO,aAAZ,GAA4BL,OAAO,CAACV,OAAD,CAAnC;IAEA,MAAMO,EAAE,GAAG,KAAKC,MAAL,CAAYC,eAAvB;IACA,IAAIO,SAAS,GAAI,G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,KAAKqD,UAAL,GAAkBc,OAAlB;IACA,KAAKnE,OAAL,GAAeA,OAAf;EACD;;EAEU,MAAL6E,KAAK,GAAG;IACZ,MAAM,MAAMA,KAAN,EAAN;IACA,MAAM,KAAK3D,UAAL,EAAN;IACA,IAAI,KAAK0D,OAAT,EAAkB,MAAM,KAAK9C,MAAL,EAAN;IAClB,KAAKvB,MAAL,CAAYuE,6BAAZ,GAA4C,IAA5C;EACD;;EAEa,MAARC,QAAQ,GAAG;IACf,OAAO,KAAKxE,MAAL,CAAYuE,6BAAnB,CADe,CAGf;IACA;IACA;IACA;IACA;IACA;;IACAE,MAAM,CAACC,IAAP,CAAYvE,OAAO,CAACwE,KAApB,EAA2BC,OAA3B,CAAoCC,GAAD,IAAS;MAC1C,OAAO1E,OAAO,CAACwE,KAAR,CAAcE,GAAd,CAAP;IACD,CAFD;;IAGA3C,iBAAA,CAAS4C,MAAT;;IACA,MAAMN,QAAN;EACD;;AAhL6C"}
1
+ {"version":3,"file":"E2eSsrEnv.js","names":["E2eSsrEnv","JsdomEnv","loadWebpackConfig","options","pragmas","JSON","parse","defaults","context","testFolder","fs","global","webpackOutputFs","factory","require","path","resolve","rootDir","webpackConfig","buildInfo","existsSync","readFileSync","runWebpack","compiler","webpack","outputFileSystem","Promise","done","fail","run","err","stats","hasErrors","console","error","toJson","errors","Error","webpackStats","runSsr","logger","undefined","debug","noop","info","log","warn","root","process","cwd","register","envName","babelEnv","extensions","entry","p","Application","entryExportName","renderer","ssrFactory","status","markup","ssrRequest","cookie","send","set","value","locals","devMiddleware","ssrMarkup","ssrOptions","ssrStatus","constructor","config","docblockPragmas","request","url","csrfToken","projectConfig","dom","createFsFromVolume","Volume","dirname","testPath","withSsr","setup","REACT_UTILS_FORCE_CLIENT_SIDE","teardown","Object","keys","cache","forEach","key","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 fs: this.global.webpackOutputFs,\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\n const fs = this.global.webpackOutputFs;\n let buildInfo = `${options.context}/.build-info`;\n if (fs.existsSync(buildInfo)) {\n buildInfo = fs.readFileSync(buildInfo, 'utf8');\n this.global.buildInfo = JSON.parse(buildInfo);\n }\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 compiler.outputFileSystem = this.global.webpackOutputFs;\n return new Promise((done, fail) => {\n compiler.run((err, stats) => {\n if (err) fail(err);\n if (stats.hasErrors()) {\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() {\n let options = this.pragmas['ssr-options'];\n options = options ? JSON.parse(options) : {};\n\n // TODO: This is temporary to shortcut the logging added to SSR.\n if (options.logger === undefined) {\n options.logger = {\n debug: noop,\n info: noop,\n log: noop,\n warn: noop,\n };\n }\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 let status = 200; // OK\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 cookie: noop,\n send: done,\n set: noop,\n status: (value) => {\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 },\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 this.global.ssrStatus = status;\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 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}`,\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\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;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AA5BA;AACA;AACA;AACA;AACA;AACA;;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;;AACA;;AAKA;AAEe,MAAMA,SAAN,SAAwBC,6BAAxB,CAAiC;EAC9C;AACF;AACA;AACA;EACEC,iBAAiB,GAAG;IAClB,IAAIC,OAAO,GAAG,KAAKC,OAAL,CAAa,wBAAb,CAAd;IACAD,OAAO,GAAGA,OAAO,GAAGE,IAAI,CAACC,KAAL,CAAWH,OAAX,CAAH,GAAyB,EAA1C;IACA,IAAAI,gBAAA,EAASJ,OAAT,EAAkB;MAChBK,OAAO,EAAE,KAAKC,UADE;MAEhBC,EAAE,EAAE,KAAKC,MAAL,CAAYC;IAFA,CAAlB;IAKA,IAAIC,OAAO,GAAG,KAAKT,OAAL,CAAa,wBAAb,KAA0C,EAAxD;IACAS,OAAO,GAAGC,O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AKG,MAAL,CAAYoE,GAAZ,GAAkB,KAAKA,GAAvB;IACA,KAAKpE,MAAL,CAAYC,eAAZ,GAA8B,IAAAoE,yBAAA,EAAmB,IAAIC,aAAJ,EAAnB,CAA9B,CAjB2B,CAmB3B;;IACA,MAAM;MAAEH;IAAF,IAAoBL,MAA1B;IACA,KAAKxD,OAAL,GAAe6D,aAAa,CAAC7D,OAA7B;IACA,KAAKR,UAAL,GAAkBM,aAAA,CAAKmE,OAAL,CAAa1E,OAAO,CAAC2E,QAArB,CAAlB;IACA,KAAKC,OAAL,GAAe,CAAChF,OAAO,CAAC,QAAD,CAAvB;IACA,KAAK0D,UAAL,GAAkBa,OAAlB;IACA,KAAKvE,OAAL,GAAeA,OAAf;EACD;;EAEU,MAALiF,KAAK,GAAG;IACZ,MAAM,MAAMA,KAAN,EAAN;IACA,MAAM,KAAK/D,UAAL,EAAN;IACA,IAAI,KAAK8D,OAAT,EAAkB,MAAM,KAAK7C,MAAL,EAAN;IAClB,KAAK5B,MAAL,CAAY2E,6BAAZ,GAA4C,IAA5C;EACD;;EAEa,MAARC,QAAQ,GAAG;IACf,OAAO,KAAK5E,MAAL,CAAY2E,6BAAnB,CADe,CAGf;IACA;IACA;IACA;IACA;IACA;;IACAE,MAAM,CAACC,IAAP,CAAY3E,OAAO,CAAC4E,KAApB,EAA2BC,OAA3B,CAAoCC,GAAD,IAAS;MAC1C,OAAO9E,OAAO,CAAC4E,KAAR,CAAcE,GAAd,CAAP;IACD,CAFD;;IAGA1C,iBAAA,CAAS2C,MAAT;;IACA,MAAMN,QAAN;EACD;;AApL6C"}
@@ -547,8 +547,7 @@ body.scrolling-disabled-by-modal {
547
547
  to {
548
548
  opacity: 1;
549
549
  }
550
- }
551
- @keyframes -dr-pogodin-react-utils___src-shared-components-WithTooltip-default-theme___appearance___L4ubm- {
550
+ }@keyframes -dr-pogodin-react-utils___src-shared-components-WithTooltip-default-theme___appearance___L4ubm- {
552
551
  from {
553
552
  opacity: 0;
554
553
  }
@@ -19,7 +19,7 @@
19
19
  */loadWebpackConfig(){let options=this.pragmas["webpack-config-options"];options=options?JSON.parse(options):{};(0,_lodash.defaults)(options,{context:this.testFolder,fs:this.global.webpackOutputFs});let factory=this.pragmas["webpack-config-factory"]||"";factory=require(_path.default.resolve(this.rootDir,factory));this.global.webpackConfig=factory(options);const fs=this.global.webpackOutputFs;let buildInfo=`${options.context}/.build-info`;if(fs.existsSync(buildInfo)){buildInfo=fs.readFileSync(buildInfo,"utf8");this.global.buildInfo=JSON.parse(buildInfo)}}/**
20
20
  * Executes Webpack build.
21
21
  * @return {Promise}
22
- */async runWebpack(){this.loadWebpackConfig();const compiler=(0,_webpack.default)(this.global.webpackConfig);compiler.outputFileSystem=this.global.webpackOutputFs;return new Promise((done,fail)=>{compiler.run((err,stats)=>{if(err)fail(err);this.global.webpackStats=stats.toJson();// Keeps reference to the raw Webpack stats object, which should be
22
+ */async runWebpack(){this.loadWebpackConfig();const compiler=(0,_webpack.default)(this.global.webpackConfig);compiler.outputFileSystem=this.global.webpackOutputFs;return new Promise((done,fail)=>{compiler.run((err,stats)=>{if(err)fail(err);if(stats.hasErrors()){console.error(stats.toJson().errors);fail(Error("Webpack compilation failed"))}this.global.webpackStats=stats.toJson();// Keeps reference to the raw Webpack stats object, which should be
23
23
  // explicitly passed to the server-side renderer alongside the request,
24
24
  // so that it can to pick up asset paths for different named chunks.
25
25
  this.webpackStats=stats;done()})})}async runSsr(){let options=this.pragmas["ssr-options"];options=options?JSON.parse(options):{};// TODO: This is temporary to shortcut the logging added to SSR.
@@ -1 +1 @@
1
- {"version":3,"file":"E2eSsrEnv.js","names":["E2eSsrEnv","JsdomEnv","loadWebpackConfig","options","pragmas","JSON","parse","defaults","context","testFolder","fs","global","webpackOutputFs","factory","require","path","resolve","rootDir","webpackConfig","buildInfo","existsSync","readFileSync","runWebpack","compiler","webpack","outputFileSystem","Promise","done","fail","run","err","stats","webpackStats","toJson","runSsr","logger","undefined","debug","noop","info","log","warn","root","process","cwd","register","envName","babelEnv","extensions","entry","p","Application","entryExportName","renderer","ssrFactory","status","markup","ssrRequest","cookie","send","set","value","locals","devMiddleware","error","ssrMarkup","ssrOptions","ssrStatus","constructor","config","docblockPragmas","request","url","csrfToken","projectConfig","dom","createFsFromVolume","Volume","dirname","testPath","withSsr","setup","REACT_UTILS_FORCE_CLIENT_SIDE","teardown","Object","keys","cache","forEach","key","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 fs: this.global.webpackOutputFs,\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\n const fs = this.global.webpackOutputFs;\n let buildInfo = `${options.context}/.build-info`;\n if (fs.existsSync(buildInfo)) {\n buildInfo = fs.readFileSync(buildInfo, 'utf8');\n this.global.buildInfo = JSON.parse(buildInfo);\n }\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 compiler.outputFileSystem = this.global.webpackOutputFs;\n return new Promise((done, fail) => {\n compiler.run((err, stats) => {\n if (err) fail(err);\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() {\n let options = this.pragmas['ssr-options'];\n options = options ? JSON.parse(options) : {};\n\n // TODO: This is temporary to shortcut the logging added to SSR.\n if (options.logger === undefined) {\n options.logger = {\n debug: noop,\n info: noop,\n log: noop,\n warn: noop,\n };\n }\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 let status = 200; // OK\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 cookie: noop,\n send: done,\n set: noop,\n status: (value) => {\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 },\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 this.global.ssrStatus = status;\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 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}`,\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\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":"gLAiBA,kDACA,0EAEA,8BAKA,iEACA,oFACA,4BACA,wDA5BA;AACA;AACA;AACA;AACA;AACA,G,CACA,8D,CAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA,sD,CAKA,qDAEe,KAAMA,UAAN,QAAwBC,8BAAS,CAC9C;AACF;AACA;AACA,KACEC,iBAAiB,EAAG,CAClB,GAAIC,QAAO,CAAG,KAAKC,OAAL,CAAa,wBAAb,CAAd,CACAD,OAA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D,OAAd,EAEA,KAAKG,MAAL,CAAYgE,GAAZ,CAAkB,KAAKA,GAAvB,CACA,KAAKhE,MAAL,CAAYC,eAAZ,CAA8B,GAAAgE,yBAAA,EAAmB,GAAIC,cAAvB,CAA9B,CAEA;AACA,KAAM,CAAEH,aAAF,EAAoBL,MAA1B,CACA,KAAKpD,OAAL,CAAeyD,aAAa,CAACzD,OAA7B,CACA,KAAKR,UAAL,CAAkBM,aAAA,CAAK+D,OAAL,CAAatE,OAAO,CAACuE,QAArB,CAAlB,CACA,KAAKC,OAAL,CAAe,CAAC5E,OAAO,CAAC,QAAD,CAAvB,CACA,KAAKqD,UAAL,CAAkBc,OAAlB,CACA,KAAKnE,OAAL,CAAeA,OAChB,CAEU,KAAL6E,MAAK,EAAG,CACZ,KAAM,OAAMA,KAAN,EAAN,CACA,KAAM,MAAK3D,UAAL,EAAN,CACA,GAAI,KAAK0D,OAAT,CAAkB,KAAM,MAAK9C,MAAL,EAAN,CAClB,KAAKvB,MAAL,CAAYuE,6BAAZ,CAA4C,IAC7C,CAEa,KAARC,SAAQ,EAAG,CACf,MAAO,MAAKxE,MAAL,CAAYuE,6BAAnB,CAEA;AACA;AACA;AACA;AACA;AACA;AACAE,MAAM,CAACC,IAAP,CAAYvE,OAAO,CAACwE,KAApB,EAA2BC,OAA3B,CAAoCC,GAAD,EAAS,CAC1C,MAAO1E,QAAO,CAACwE,KAAR,CAAcE,GAAd,CACR,CAFD,EAGA3C,iBAAA,CAAS4C,MAAT,GACA,MAAMN,QAAN,EACD,CAhL6C,C"}
1
+ {"version":3,"file":"E2eSsrEnv.js","names":["E2eSsrEnv","JsdomEnv","loadWebpackConfig","options","pragmas","JSON","parse","defaults","context","testFolder","fs","global","webpackOutputFs","factory","require","path","resolve","rootDir","webpackConfig","buildInfo","existsSync","readFileSync","runWebpack","compiler","webpack","outputFileSystem","Promise","done","fail","run","err","stats","hasErrors","console","error","toJson","errors","Error","webpackStats","runSsr","logger","undefined","debug","noop","info","log","warn","root","process","cwd","register","envName","babelEnv","extensions","entry","p","Application","entryExportName","renderer","ssrFactory","status","markup","ssrRequest","cookie","send","set","value","locals","devMiddleware","ssrMarkup","ssrOptions","ssrStatus","constructor","config","docblockPragmas","request","url","csrfToken","projectConfig","dom","createFsFromVolume","Volume","dirname","testPath","withSsr","setup","REACT_UTILS_FORCE_CLIENT_SIDE","teardown","Object","keys","cache","forEach","key","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 fs: this.global.webpackOutputFs,\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\n const fs = this.global.webpackOutputFs;\n let buildInfo = `${options.context}/.build-info`;\n if (fs.existsSync(buildInfo)) {\n buildInfo = fs.readFileSync(buildInfo, 'utf8');\n this.global.buildInfo = JSON.parse(buildInfo);\n }\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 compiler.outputFileSystem = this.global.webpackOutputFs;\n return new Promise((done, fail) => {\n compiler.run((err, stats) => {\n if (err) fail(err);\n if (stats.hasErrors()) {\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() {\n let options = this.pragmas['ssr-options'];\n options = options ? JSON.parse(options) : {};\n\n // TODO: This is temporary to shortcut the logging added to SSR.\n if (options.logger === undefined) {\n options.logger = {\n debug: noop,\n info: noop,\n log: noop,\n warn: noop,\n };\n }\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 let status = 200; // OK\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 cookie: noop,\n send: done,\n set: noop,\n status: (value) => {\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 },\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 this.global.ssrStatus = status;\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 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}`,\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\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":"gLAiBA,kDACA,0EAEA,8BAKA,iEACA,oFACA,4BACA,wDA5BA;AACA;AACA;AACA;AACA;AACA,G,CACA,8D,CAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA,sD,CAKA,qDAEe,KAAMA,UAAN,QAAwBC,8BAAS,CAC9C;AACF;AACA;AACA,KACEC,iBAAiB,EAAG,CA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.20.1",
2
+ "version": "1.21.0",
3
3
  "bin": {
4
4
  "react-utils-build": "bin/build.js",
5
5
  "react-utils-setup": "bin/setup.js"
@@ -12,8 +12,8 @@
12
12
  "@dr.pogodin/babel-plugin-react-css-modules": "^6.8.2",
13
13
  "@dr.pogodin/react-global-state": "^0.9.0",
14
14
  "@dr.pogodin/react-themes": "^1.4.4",
15
- "axios": "^0.27.2",
16
- "commander": "^9.4.0",
15
+ "axios": "^1.0.0",
16
+ "commander": "^9.4.1",
17
17
  "compression": "^1.7.4",
18
18
  "config": "^3.3.8",
19
19
  "cookie": "^0.5.0",
@@ -24,7 +24,7 @@
24
24
  "express": "^4.18.1",
25
25
  "helmet": "^6.0.0",
26
26
  "http-status-codes": "^2.2.0",
27
- "joi": "^17.6.0",
27
+ "joi": "^17.6.2",
28
28
  "lodash": "^4.17.21",
29
29
  "morgan": "^1.10.0",
30
30
  "node-forge": "^1.3.1",
@@ -34,7 +34,7 @@
34
34
  "react": "^18.2.0",
35
35
  "react-dom": "^18.2.0",
36
36
  "react-helmet": "^6.1.0",
37
- "react-router-dom": "^6.4.0",
37
+ "react-router-dom": "^6.4.1",
38
38
  "request-ip": "^3.3.0",
39
39
  "rimraf": "^3.0.2",
40
40
  "serialize-javascript": "^6.0.0",
@@ -45,41 +45,41 @@
45
45
  },
46
46
  "description": "Collection of generic ReactJS components and utils",
47
47
  "devDependencies": {
48
- "@babel/cli": "^7.18.10",
49
- "@babel/core": "^7.19.1",
48
+ "@babel/cli": "^7.19.3",
49
+ "@babel/core": "^7.19.3",
50
50
  "@babel/eslint-parser": "^7.19.1",
51
51
  "@babel/eslint-plugin": "^7.19.1",
52
52
  "@babel/node": "^7.19.1",
53
53
  "@babel/plugin-transform-runtime": "^7.19.1",
54
- "@babel/preset-env": "^7.19.1",
54
+ "@babel/preset-env": "^7.19.3",
55
55
  "@babel/preset-react": "^7.18.6",
56
56
  "@babel/register": "^7.18.9",
57
57
  "@dr.pogodin/babel-plugin-transform-assets": "^1.1.1",
58
58
  "@dr.pogodin/babel-preset-svgr": "^1.4.2",
59
59
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.7",
60
60
  "autoprefixer": "^10.4.12",
61
- "babel-jest": "^29.0.3",
61
+ "babel-jest": "^29.1.2",
62
62
  "babel-loader": "^8.2.5",
63
63
  "babel-plugin-module-resolver": "^4.1.0",
64
- "core-js": "^3.25.2",
64
+ "core-js": "^3.25.5",
65
65
  "css-loader": "^6.7.1",
66
- "css-minimizer-webpack-plugin": "^4.1.0",
67
- "eslint": "^8.23.1",
66
+ "css-minimizer-webpack-plugin": "^4.2.0",
67
+ "eslint": "^8.24.0",
68
68
  "eslint-config-airbnb": "^19.0.4",
69
69
  "eslint-import-resolver-babel-module": "^5.3.1",
70
70
  "eslint-plugin-import": "^2.26.0",
71
- "eslint-plugin-jest": "^27.0.4",
71
+ "eslint-plugin-jest": "^27.1.0",
72
72
  "eslint-plugin-jsx-a11y": "^6.6.1",
73
73
  "eslint-plugin-react": "^7.31.8",
74
74
  "eslint-plugin-react-hooks": "^4.6.0",
75
75
  "identity-obj-proxy": "^3.0.0",
76
- "jest": "^29.0.3",
77
- "jest-environment-jsdom": "^29.0.3",
76
+ "jest": "^29.1.2",
77
+ "jest-environment-jsdom": "^29.1.2",
78
78
  "memfs": "^3.4.7",
79
79
  "mini-css-extract-plugin": "^2.6.1",
80
80
  "mockdate": "^3.0.5",
81
81
  "nodelist-foreach-polyfill": "^1.2.0",
82
- "postcss": "^8.4.16",
82
+ "postcss": "^8.4.17",
83
83
  "postcss-loader": "^7.0.1",
84
84
  "postcss-scss": "^4.0.5",
85
85
  "pretty": "^2.0.0",
@@ -87,12 +87,12 @@
87
87
  "react-test-renderer": "^18.2.0",
88
88
  "regenerator-runtime": "^0.13.9",
89
89
  "resolve-url-loader": "^5.0.0",
90
- "sass": "^1.54.9",
90
+ "sass": "^1.55.0",
91
91
  "sass-loader": "^13.0.2",
92
92
  "sitemap": "^7.1.1",
93
- "stylelint": "^14.12.1",
93
+ "stylelint": "^14.13.0",
94
94
  "stylelint-config-standard-scss": "^5.0.0",
95
- "supertest": "^6.2.4",
95
+ "supertest": "^6.3.0",
96
96
  "webpack": "^5.74.0",
97
97
  "webpack-dev-middleware": "^5.3.3",
98
98
  "webpack-hot-middleware": "^2.25.2",