@zohodesk/react-cli 0.0.1-exp.175.1 → 0.0.1-exp.176.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. package/README.md +35 -40
  2. package/docs/SelectorWeight.md +6 -0
  3. package/docs/VariableConversion.md +33 -1
  4. package/lib/babel/cmjs-plugins-presets.js +4 -0
  5. package/lib/babel/es-plugins-presets.js +4 -0
  6. package/lib/common/getEntries.js +10 -0
  7. package/lib/common/getPublicPathConfig.js +6 -0
  8. package/lib/common/index.js +5 -0
  9. package/lib/common/splitChunks.js +13 -2
  10. package/lib/common/sslcertUpdater.js +17 -6
  11. package/lib/common/templateParameters.js +2 -0
  12. package/lib/common/testPattern.js +21 -10
  13. package/lib/common/valueReplacer.js +15 -0
  14. package/lib/configs/jest.config.js +9 -0
  15. package/lib/configs/libAlias.js +2 -4
  16. package/lib/configs/webpack.component.umd.config.js +5 -0
  17. package/lib/configs/webpack.css.umd.config.js +13 -5
  18. package/lib/configs/webpack.dev.config.js +36 -2
  19. package/lib/configs/webpack.docs.config.js +21 -1
  20. package/lib/configs/webpack.impact.config.js +19 -1
  21. package/lib/configs/webpack.prod.config.js +37 -3
  22. package/lib/hooks/docsProptypeHook.js +7 -3
  23. package/lib/jest/commitedFilesResult.js +45 -3
  24. package/lib/jest/coverageCollector.js +11 -0
  25. package/lib/jest/jsonMaker.js +6 -0
  26. package/lib/jest/preProcessors/cssPreprocessor.js +8 -0
  27. package/lib/jest/preProcessors/jsPreprocessor.js +2 -0
  28. package/lib/jest/preProcessors/otherFilesPreprocessor.js +3 -0
  29. package/lib/jest/result.js +22 -0
  30. package/lib/jest/run.js +17 -6
  31. package/lib/jest/setup.js +57 -5
  32. package/lib/loaderUtils/configsAssetsLoaders.js +11 -1
  33. package/lib/loaderUtils/getCSSLoaders.js +35 -20
  34. package/lib/loaderUtils/getDevJsLoaders.js +8 -0
  35. package/lib/loaderUtils/index.js +3 -0
  36. package/lib/loaderUtils/windowsModification.js +11 -0
  37. package/lib/loaders/docsLoader.js +7 -0
  38. package/lib/loaders/docsPropsLoader.js +7 -3
  39. package/lib/loaders/fileBountryLoader.js +2 -0
  40. package/lib/loaders/fileLoader.js +22 -11
  41. package/lib/loaders/scriptInstrumentLoader.js +13 -5
  42. package/lib/loaders/selectorMappingLoader.js +25 -7
  43. package/lib/loaders/workerLoader.js +20 -4
  44. package/lib/middlewares/HMRMiddleware.js +26 -13
  45. package/lib/middlewares/SSTMiddleware.js +3 -0
  46. package/lib/pluginUtils/configHtmlWebpackPlugins.js +9 -3
  47. package/lib/pluginUtils/getDevPlugins.js +63 -17
  48. package/lib/pluginUtils/getDocsPlugins.js +10 -1
  49. package/lib/pluginUtils/getLibraryImactPlugins.js +5 -4
  50. package/lib/pluginUtils/getLibraryPlugins.js +5 -0
  51. package/lib/pluginUtils/getProdPlugins.js +72 -23
  52. package/lib/pluginUtils/getServerPlugins.js +5 -0
  53. package/lib/pluginUtils/getUMDCSSPlugins.js +7 -0
  54. package/lib/pluginUtils/getUMDComponentPlugins.js +7 -0
  55. package/lib/pluginUtils/index.js +8 -0
  56. package/lib/plugins/CdnChangePlugin.js +14 -0
  57. package/lib/plugins/CleanupStatsPlugin.js +5 -0
  58. package/lib/plugins/EFCPlugin.js +34 -23
  59. package/lib/plugins/EFCTemplatePlugin.js +32 -23
  60. package/lib/plugins/I18NInjectIntoIndexPlugin.js +34 -8
  61. package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +17 -12
  62. package/lib/plugins/I18nSplitPlugin/I18nDependency.js +10 -4
  63. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +39 -8
  64. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +29 -14
  65. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +22 -13
  66. package/lib/plugins/I18nSplitPlugin/index.js +23 -13
  67. package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +12 -2
  68. package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +1 -0
  69. package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +5 -0
  70. package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +6 -0
  71. package/lib/plugins/I18nSplitPlugin/utils/index.js +4 -0
  72. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +20 -2
  73. package/lib/plugins/ManifestPlugin.js +17 -0
  74. package/lib/plugins/ModuleStatsPlugin.js +23 -0
  75. package/lib/plugins/OptimizeJSPlugin.js +7 -0
  76. package/lib/plugins/PublicPathCallbackPlugin.js +10 -0
  77. package/lib/plugins/PublicPathChangePlugin.js +36 -4
  78. package/lib/plugins/ReportGeneratePlugin.js +30 -4
  79. package/lib/plugins/RequireVariablePublicPlugin.js +6 -0
  80. package/lib/plugins/ResourceHintsPlugin.js +10 -3
  81. package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +17 -12
  82. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +16 -9
  83. package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +5 -2
  84. package/lib/plugins/ScriptInstrumentPlugin.js +7 -0
  85. package/lib/plugins/SelectorPlugin.js +97 -0
  86. package/lib/plugins/ServiceWorkerPlugin.js +20 -4
  87. package/lib/plugins/ShadowDOMSupportPlugin.js +40 -3
  88. package/lib/plugins/SourceMapHookPlugin.js +9 -0
  89. package/lib/plugins/TPHashMappingPlugin.js +15 -1
  90. package/lib/plugins/UglifyCSSPlugin.js +9 -0
  91. package/lib/plugins/UnusedFilesFindPlugin.js +35 -2
  92. package/lib/plugins/VariableConversionCollector.js +252 -0
  93. package/lib/plugins/composeCommonPlugin.js +30 -0
  94. package/lib/plugins/index.js +19 -0
  95. package/lib/plugins/libraryImpactPlugin.js +32 -0
  96. package/lib/plugins/webpackwatchrunplugin.js +5 -0
  97. package/lib/postcss-plugins/ExcludePlugin.js +4 -0
  98. package/lib/postcss-plugins/RTLSplitPlugin.js +27 -14
  99. package/lib/postcss-plugins/ValueReplacer.js +6 -9
  100. package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +3 -0
  101. package/lib/postcss-plugins/hoverActivePlugin.js +66 -30
  102. package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +40 -13
  103. package/lib/postcss-plugins/variableModificationPlugin/index.js +215 -141
  104. package/lib/postcss-plugins/variableModifier.js +20 -13
  105. package/lib/schemas/index.js +23 -4
  106. package/lib/servers/clusterHubServer.js +10 -0
  107. package/lib/servers/devBuild.js +24 -13
  108. package/lib/servers/docsServer.js +2 -0
  109. package/lib/servers/docsServerCore.js +21 -0
  110. package/lib/servers/getCliPath.js +9 -0
  111. package/lib/servers/helpServer.js +5 -0
  112. package/lib/servers/httpsOptions.js +4 -0
  113. package/lib/servers/impactServer.js +34 -2
  114. package/lib/servers/mockserver.js +9 -0
  115. package/lib/servers/nowatchserver.js +34 -12
  116. package/lib/servers/scrServer.js +20 -13
  117. package/lib/servers/server.js +35 -7
  118. package/lib/servers/ssServer.js +16 -0
  119. package/lib/templates/CoverageScriptTemplate.js +14 -0
  120. package/lib/templates/WMSTemplate.js +12 -6
  121. package/lib/utils/babelPresets.js +2 -0
  122. package/lib/utils/clean.js +8 -2
  123. package/lib/utils/copy.js +6 -0
  124. package/lib/utils/copyTimezones.js +8 -0
  125. package/lib/utils/createEventStream.js +4 -0
  126. package/lib/utils/cssClassNameGenerate.js +19 -3
  127. package/lib/utils/cssURLReplacer.js +50 -38
  128. package/lib/utils/dependencyPostPublish.js +9 -0
  129. package/lib/utils/fileUtils.js +26 -0
  130. package/lib/utils/folderIterator.js +10 -0
  131. package/lib/utils/getComponents.js +21 -0
  132. package/lib/utils/getCurrentBranch.js +5 -0
  133. package/lib/utils/getDependenciesImpactList.js +21 -0
  134. package/lib/utils/getFileType.js +49 -0
  135. package/lib/utils/getHash.js +7 -0
  136. package/lib/utils/getIp.js +2 -0
  137. package/lib/utils/getOptions.js +39 -14
  138. package/lib/utils/getServerURL.js +7 -0
  139. package/lib/utils/index.js +47 -2
  140. package/lib/utils/init.js +1 -0
  141. package/lib/utils/initPreCommitHook.js +29 -6
  142. package/lib/utils/jsonHelper.js +19 -2
  143. package/lib/utils/libraryImpactConfig.js +2 -0
  144. package/lib/utils/lint/addScripts.js +5 -2
  145. package/lib/utils/lint/checkExistingConfig.js +12 -3
  146. package/lib/utils/lint/copyConfigs.js +3 -0
  147. package/lib/utils/lint/index.js +9 -0
  148. package/lib/utils/lint/lintScripts.js +1 -0
  149. package/lib/utils/lint/lintSetup.js +4 -3
  150. package/lib/utils/lint/lintStagedPreCommitHook.js +1 -0
  151. package/lib/utils/lint/question.js +7 -0
  152. package/lib/utils/lintReporter.js +20 -0
  153. package/lib/utils/mailSender.js +7 -0
  154. package/lib/utils/pullOrigin.js +4 -0
  155. package/lib/utils/reinstallDependencies.js +28 -0
  156. package/lib/utils/removeAttributes.js +7 -0
  157. package/lib/utils/repoClone.js +27 -2
  158. package/lib/utils/request.js +12 -0
  159. package/lib/utils/rtl.js +16 -4
  160. package/lib/utils/setEnvVariables.js +2 -0
  161. package/lib/utils/ssTestHack.js +10 -0
  162. package/lib/utils/switchBranch.js +4 -0
  163. package/lib/utils/urlConcat.js +4 -0
  164. package/lib/utils/useExitCleanup.js +10 -9
  165. package/package.json +10 -9
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
 
3
3
  var _babelJest = _interopRequireDefault(require("babel-jest"));
4
+
4
5
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6
+
5
7
  module.exports = _babelJest.default.createTransformer({
6
8
  presets: [require.resolve('@babel/preset-env'), require.resolve('@babel/preset-react')],
7
9
  plugins: [require.resolve('babel-plugin-transform-dynamic-import')]
@@ -1,9 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _path = _interopRequireDefault(require("path"));
4
+
4
5
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6
+
5
7
  module.exports = {
6
8
  process(src, filename) {
7
9
  return `module.exports = ${JSON.stringify(_path.default.basename(filename))};`;
8
10
  }
11
+
9
12
  };
@@ -1,18 +1,25 @@
1
1
  "use strict";
2
2
 
3
3
  var _fs = _interopRequireDefault(require("fs"));
4
+
4
5
  var _utils = require("../utils");
6
+
5
7
  var _jsonMaker = _interopRequireDefault(require("./jsonMaker"));
8
+
6
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+
7
11
  let unitTestReport = [];
12
+
8
13
  const result = inp => {
9
14
  inp.endTime = Date.now();
10
15
  let testPathPattern = process.argv[process.argv.length - 1];
16
+
11
17
  if (testPathPattern.indexOf('--') !== -1) {
12
18
  testPathPattern = '';
13
19
  } else {
14
20
  testPathPattern = _fs.default.realpathSync(process.cwd());
15
21
  }
22
+
16
23
  let testPathRegex = new RegExp(testPathPattern);
17
24
  let {
18
25
  testResults
@@ -20,9 +27,11 @@ const result = inp => {
20
27
  let testFilesArr = [];
21
28
  testResults.forEach(testResult => {
22
29
  let filePath = testResult.testFilePath;
30
+
23
31
  if (!testPathRegex.test(filePath)) {
24
32
  return;
25
33
  }
34
+
26
35
  filePath = filePath.replace('.spec', '');
27
36
  filePath = filePath.replace('/__tests__', '');
28
37
  filePath = filePath.replace('/__test__', '');
@@ -39,28 +48,35 @@ const result = inp => {
39
48
  });
40
49
  });
41
50
  });
51
+
42
52
  let coverageSummary = _fs.default.readFileSync('./coverage/coverage-summary.json').toString();
53
+
43
54
  if (coverageSummary.indexOf('\\') !== -1) {
44
55
  coverageSummary = coverageSummary.replace(/\\/g, '\\\\');
45
56
  }
57
+
46
58
  let coverageJson = JSON.parse(coverageSummary);
47
59
  let linesPercent = 0;
48
60
  let functionPercent = 0;
49
61
  let statementPerment = 0;
50
62
  let branchesPercent = 0;
51
63
  let i = 0;
64
+
52
65
  for (i; i < testFilesArr.length; i++) {
53
66
  let curSourceFile = testFilesArr[i].sourcePath;
54
67
  let coverageData = coverageJson[curSourceFile];
68
+
55
69
  if (!coverageData) {
56
70
  (0, _utils.log)(`Can't able to find source for ${testFilesArr[i].testPath}\n Or The spec file getting failed during test. Please check the file name and the path is correct for test file or Make them pass.`);
57
71
  continue;
58
72
  }
73
+
59
74
  linesPercent += coverageData.lines.pct;
60
75
  functionPercent += coverageData.functions.pct;
61
76
  statementPerment += coverageData.statements.pct;
62
77
  branchesPercent += coverageData.branches.pct;
63
78
  }
79
+
64
80
  let totalLinesPercent = linesPercent / (i * 100) * 100;
65
81
  let totalFunctionPercent = functionPercent / (i * 100) * 100;
66
82
  let totalStatementPercent = statementPerment / (i * 100) * 100;
@@ -69,12 +85,14 @@ const result = inp => {
69
85
  let coverage = (totalPercentage / 4).toFixed(2);
70
86
  coverage = Number(coverage);
71
87
  (0, _jsonMaker.default)(inp, coverage, 'Yes', 'unitcase');
88
+
72
89
  if (Number.isNaN(coverage)) {
73
90
  (0, _utils.log)('This build does\'t have any JS changes!');
74
91
  coverage = 0;
75
92
  } else {
76
93
  (0, _utils.log)(`COVERAGE ${coverage}%`);
77
94
  }
95
+
78
96
  let html = `<html>
79
97
  <head>
80
98
  <style>
@@ -116,10 +134,14 @@ const result = inp => {
116
134
  </body>
117
135
  </html>
118
136
  `;
137
+
119
138
  if (!_fs.default.existsSync('./unittest')) {
120
139
  _fs.default.mkdirSync('./unittest');
121
140
  }
141
+
122
142
  _fs.default.writeFileSync('./unittest/index.html', html, 'utf8');
143
+
123
144
  return inp;
124
145
  };
146
+
125
147
  module.exports = result;
package/lib/jest/run.js CHANGED
@@ -1,11 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  var _jest = require("jest");
4
+
4
5
  var _fs = _interopRequireDefault(require("fs"));
6
+
5
7
  var _utils = require("../utils");
8
+
6
9
  var _jsonHelper = require("../utils/jsonHelper");
10
+
7
11
  var _coverageCollector = _interopRequireDefault(require("./coverageCollector"));
12
+
8
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+
9
15
  let options = (0, _utils.getOptions)();
10
16
  let {
11
17
  app: {
@@ -21,7 +27,9 @@ let {
21
27
  }
22
28
  } = options;
23
29
  let argv = process.argv.slice(2);
30
+
24
31
  let config = require('../configs/jest.config');
32
+
25
33
  if (isCommitCoverage) {
26
34
  (0, _coverageCollector.default)(srcBranch, targetBranch, serviceName, impactServerDomain).then((res = {}) => {
27
35
  if (res.STATUS) {
@@ -29,12 +37,15 @@ if (isCommitCoverage) {
29
37
  let content = {
30
38
  FILES: res.LIST
31
39
  };
40
+
32
41
  if (!_fs.default.existsSync('./coverageTest')) {
33
42
  _fs.default.mkdirSync('./coverageTest');
43
+
34
44
  _fs.default.writeFileSync('./coverageTest/result.json', JSON.stringify(content), 'utf8');
35
45
  } else {
36
46
  _fs.default.writeFileSync('./coverageTest/result.json', JSON.stringify(content), 'utf8');
37
47
  }
48
+
38
49
  argv.push('--findRelatedTests');
39
50
  argv = argv.concat(res.LIST);
40
51
  argv = argv.concat(['--config', JSON.stringify(config(null, true))]);
@@ -42,12 +53,12 @@ if (isCommitCoverage) {
42
53
  argv.push('--silent');
43
54
  (0, _jest.run)(argv);
44
55
  } else {
45
- (0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, ['tests', 'modifiedFileUnitCase', 'hasChanges'], false);
46
- // jsonHelper(
56
+ (0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, ['tests', 'modifiedFileUnitCase', 'hasChanges'], false); // jsonHelper(
47
57
  // `${process.cwd()}/result.json`,
48
58
  // 'testInfo.isBuildVerified',
49
59
  // true
50
60
  // );
61
+
51
62
  (0, _jsonHelper.setTestInfoStatus)(`${process.cwd()}/result.json`, true);
52
63
  (0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'testInfo.failures', [{
53
64
  type: 'modifiedUnitcases',
@@ -56,17 +67,17 @@ if (isCommitCoverage) {
56
67
  (0, _utils.log)('No JS changes with last changeset!');
57
68
  }
58
69
  } else {
59
- (0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, ['tests', 'modifiedFileUnitCase', 'isExecuted'], res.STATUS);
60
- // jsonHelper(
70
+ (0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, ['tests', 'modifiedFileUnitCase', 'isExecuted'], res.STATUS); // jsonHelper(
61
71
  // `${process.cwd()}/result.json`,
62
72
  // 'testInfo.isBuildVerified',
63
73
  // true
64
74
  // );
65
- (0, _jsonHelper.setTestInfoStatus)(`${process.cwd()}/result.json`, true);
66
- // jsonHelper(`${process.cwd()}/result.json`, 'testInfo.failures', [{
75
+
76
+ (0, _jsonHelper.setTestInfoStatus)(`${process.cwd()}/result.json`, true); // jsonHelper(`${process.cwd()}/result.json`, 'testInfo.failures', [{
67
77
  // type: 'modifiedUnitcases',
68
78
  // message: res.REASON
69
79
  // }]);
80
+
70
81
  (0, _utils.log)(res.REASON);
71
82
  }
72
83
  });
package/lib/jest/setup.js CHANGED
@@ -1,15 +1,22 @@
1
1
  "use strict";
2
2
 
3
3
  var _jsdom = require("jsdom");
4
+
4
5
  var _testUtils = _interopRequireDefault(require("react-dom/test-utils"));
6
+
5
7
  var _react = _interopRequireDefault(require("react"));
8
+
6
9
  var _propTypes = _interopRequireDefault(require("prop-types"));
10
+
7
11
  var _reactDom = _interopRequireDefault(require("react-dom"));
12
+
8
13
  var _xhr = _interopRequireDefault(require("xhr2"));
14
+
9
15
  var _nock = _interopRequireDefault(require("nock"));
16
+
10
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
- //$Id$//
12
18
 
19
+ //$Id$//
13
20
  let mockDomain = 'htt' + 'p://zoho.com';
14
21
  const {
15
22
  document
@@ -21,136 +28,181 @@ global.localStorage = global.sessionStorage = {
21
28
  getItem(key) {
22
29
  return this[key];
23
30
  },
31
+
24
32
  setItem(key, value) {
25
33
  if (value.length > 100) {
26
34
  throw new Error('Data size is too exceeded');
27
35
  }
36
+
28
37
  this[key] = value;
29
38
  },
39
+
30
40
  removeItem(key) {
31
41
  delete this[key];
32
42
  },
43
+
33
44
  clear() {
34
45
  let keys = ['getItem', 'setItem', 'removeItem', 'clear'];
46
+
35
47
  for (let key in this) {
36
48
  if (keys.indexOf(key) === -1) {
37
49
  delete this[key];
38
50
  }
39
51
  }
40
52
  }
53
+
41
54
  };
42
55
  global.ZE_Init = {};
56
+
43
57
  global.String.prototype.contains = function (text) {
44
58
  return this.indexOf(text) != -1;
45
59
  };
60
+
46
61
  global.TestUtils = _testUtils.default;
47
62
  let xmlReq = _xhr.default;
63
+
48
64
  window.XMLHttpRequest = function () {
49
65
  let xmlReqCopy = new xmlReq();
50
66
  let originalOpen = xmlReqCopy.open;
67
+
51
68
  xmlReqCopy.open = function () {
52
69
  if (arguments[1].indexOf('http') != 0) {
53
70
  arguments[1] = mockDomain + arguments[1];
54
71
  }
72
+
55
73
  return originalOpen.apply(this, arguments);
56
74
  };
75
+
57
76
  return xmlReqCopy;
58
77
  };
78
+
59
79
  _testUtils.default.scryRenderedComponentsWithTestid = function (dom, name) {
60
80
  let componentList = _testUtils.default.findAllInRenderedTree(dom, (i, j) => {
61
81
  if (_testUtils.default.isDOMComponent(i)) {
62
82
  let val = i.getAttribute('data-id');
83
+
63
84
  if (typeof val !== 'undefined' && val == name) {
64
85
  return true;
65
86
  }
87
+
66
88
  return false;
67
89
  }
68
90
  });
91
+
69
92
  return componentList;
70
93
  };
94
+
71
95
  _testUtils.default.findRenderedComponentsWithTestid = function (dom, name) {
72
96
  let list = _testUtils.default.scryRenderedComponentsWithTestid(dom, name);
97
+
73
98
  if (list.length !== 1) {
74
99
  throw new Error(`Did not find exactly one match (found: ${list.length}) ` + `for data-id:${name}`);
75
100
  }
101
+
76
102
  return list[0];
77
103
  };
104
+
78
105
  global.render = function (Component, props) {
79
106
  const renderedDOM = _testUtils.default.renderIntoDocument( /*#__PURE__*/_react.default.createElement(Component, props));
107
+
80
108
  return {
81
109
  props,
82
110
  renderedDOM
83
111
  };
84
112
  };
113
+
85
114
  global.setup = function (Component, props, state) {
86
115
  let router = {
87
116
  router: {
88
117
  push() {},
118
+
89
119
  createHref(ob) {
90
120
  return ob.pathname;
91
121
  },
122
+
92
123
  isActive() {
93
124
  return true;
94
125
  },
126
+
95
127
  replace() {},
128
+
96
129
  go() {},
130
+
97
131
  goBack() {},
132
+
98
133
  goForward() {},
134
+
99
135
  setRouteLeaveHook() {},
136
+
100
137
  getState() {}
138
+
101
139
  },
102
140
  store: {
103
141
  getState() {
104
142
  return state;
105
143
  }
144
+
106
145
  }
107
- };
108
- // var store = {
146
+ }; // var store = {
109
147
  // store:{
110
148
  // getState:function(){return state;}
111
149
  // }
112
150
  // }
151
+
113
152
  var Component = higherComponent(Component, router);
153
+
114
154
  const renderedDOM = _testUtils.default.renderIntoDocument( /*#__PURE__*/_react.default.createElement(Component, props), router);
155
+
115
156
  return {
116
157
  props,
117
158
  renderedDOM
118
159
  };
119
160
  };
161
+
120
162
  function higherComponent(ActualComponent, context) {
121
163
  if (context) {
122
164
  class HigherComponent extends _react.default.Component {
123
165
  constructor() {
124
166
  super();
125
167
  }
168
+
126
169
  getChildContext() {
127
170
  return context;
128
171
  }
172
+
129
173
  render() {
130
174
  return /*#__PURE__*/_react.default.createElement(ActualComponent, this.props);
131
175
  }
176
+
132
177
  }
178
+
133
179
  HigherComponent.childContextTypes = {
134
180
  router: _propTypes.default.any,
135
181
  store: _propTypes.default.any
136
182
  };
137
183
  return HigherComponent;
138
184
  }
185
+
139
186
  return ActualComponent;
140
187
  }
188
+
141
189
  global.window.matchMedia = window.matchMedia || function () {
142
190
  return {
143
191
  matches: false,
192
+
144
193
  addListener() {},
194
+
145
195
  removeListener() {}
196
+
146
197
  };
147
- };
148
- // global.renderHTML = function(comp) {
198
+ }; // global.renderHTML = function(comp) {
149
199
  // return ReactDOM.findDOMNode(comp);
150
200
  // };
151
201
 
202
+
152
203
  global.TestUtils = _testUtils.default;
153
204
  global.XMLHttpRequest = window.XMLHttpRequest;
205
+
154
206
  global.getI18NValue = function (inp) {
155
207
  return inp;
156
208
  };
@@ -10,47 +10,57 @@ exports.configSVGLoader = configSVGLoader;
10
10
  exports.configVideoLoader = configVideoLoader;
11
11
  exports.configVideoLoaderObj = configVideoLoaderObj;
12
12
  exports.createNameTemplate = createNameTemplate;
13
+
13
14
  var _path = _interopRequireDefault(require("path"));
15
+
14
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
15
18
  // function getLoaderOptionQueryString(params) {
16
19
  const ImageExtRegex = /\.jpe?g$|\.gif$|\.png$/;
17
20
  const FontExtRegex = /\.woff2|\.woff$|\.ttf$|\.eot$/;
18
21
  const SVGExtRegex = /\.svg$/;
19
22
  const AudioExtRegex = /\.ogg$/;
20
23
  const VidioExtRegex = /\.mp4$/;
24
+
21
25
  function createLoaderOptionQueryString(loaderName, nameTemplate, limit = 1000) {
22
26
  return `${loaderName}?limit=${limit}&name=${nameTemplate}`;
23
27
  }
28
+
24
29
  function configImageLoader(nameTemplate) {
25
30
  return {
26
31
  test: ImageExtRegex,
27
32
  use: createLoaderOptionQueryString('url-loader', `./images/${nameTemplate}`)
28
33
  };
29
34
  }
35
+
30
36
  function configFontLoader(nameTemplate) {
31
37
  return {
32
38
  test: FontExtRegex,
33
39
  use: createLoaderOptionQueryString('url-loader', `./fonts/${nameTemplate}`)
34
40
  };
35
41
  }
42
+
36
43
  function configSVGLoader(nameTemplate) {
37
44
  return {
38
45
  test: SVGExtRegex,
39
46
  use: createLoaderOptionQueryString('url-loader', `./fonts/${nameTemplate}`, 1)
40
47
  };
41
48
  }
49
+
42
50
  function configAudioLoader(nameTemplate) {
43
51
  return {
44
52
  test: AudioExtRegex,
45
53
  use: createLoaderOptionQueryString('file-loader', `./fonts/${nameTemplate}`, 1)
46
54
  };
47
55
  }
56
+
48
57
  function configVideoLoader(nameTemplate) {
49
58
  return {
50
59
  test: VidioExtRegex,
51
60
  use: createLoaderOptionQueryString('url-loader', `./images/${nameTemplate}`, 1)
52
61
  };
53
62
  }
63
+
54
64
  function configVideoLoaderObj(nameTemplate) {
55
65
  return {
56
66
  test: VidioExtRegex,
@@ -64,11 +74,11 @@ function configVideoLoaderObj(nameTemplate) {
64
74
  }
65
75
  };
66
76
  }
77
+
67
78
  function createNameTemplate(enableChunkHash) {
68
79
  const ext = `${enableChunkHash ? '.[hash:20]' : ''}.[ext]`;
69
80
  return `[name]${ext}`;
70
81
  }
71
-
72
82
  /*
73
83
  export function createImageAndFontsAndSVGLoaders(enableChunkHash) {
74
84
  const nameTemplate = createNameTemplate(enableChunkHash);
@@ -4,16 +4,21 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+
7
8
  var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
9
+
8
10
  var _cssClassNameGenerate = _interopRequireDefault(require("../utils/cssClassNameGenerate"));
11
+
9
12
  var _utils = require("../utils");
13
+
14
+ var _windowsModification = require("./windowsModification");
15
+
10
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
11
18
  const fs = require('fs');
19
+
12
20
  const options = (0, _utils.getOptions)();
13
- const isWin = process.platform === 'win32';
14
- function windowsModification(array) {
15
- return isWin ? array.map(r => r.replace(/\//g, '\\')) : array;
16
- }
21
+
17
22
  function excludeEmptyCheckPlugin({
18
23
  enable,
19
24
  ignore,
@@ -24,11 +29,23 @@ function excludeEmptyCheckPlugin({
24
29
  plugins
25
30
  })] : [];
26
31
  }
27
- const getCSSLoaders = (plugins, exclude, mediaQueryHoverActiveString, cssVariableReplacementConfig, classNameBlob, cssUniqueness, selectorReplace, cssHashSelectors, classNamePrefix) => {
28
- // console.log('plugins:')
32
+
33
+ const getCSSLoaders = optionsObj => {
34
+ const {
35
+ plugins,
36
+ exclude,
37
+ mediaQueryHoverActiveString,
38
+ cssVariableReplacementConfig,
39
+ classNameBlob,
40
+ cssUniqueness,
41
+ selectorReplace,
42
+ cssHashSelectors,
43
+ classNamePrefix
44
+ } = optionsObj; // console.log('plugins:')
29
45
  // console.log(plugins)
30
46
  // console.log('exclude:')
31
47
  // console.log(exclude)
48
+
32
49
  const {
33
50
  devCssFileBountry
34
51
  } = options.app;
@@ -38,29 +55,25 @@ const getCSSLoaders = (plugins, exclude, mediaQueryHoverActiveString, cssVariabl
38
55
  const {
39
56
  cssSelectorZipPath
40
57
  } = options.impactService;
41
- fs.writeFileSync('./css_error.log', '');
42
- const rtlExcludeLocal = windowsModification(exclude.rtl);
43
- const hoverActiveExcludeLocal = windowsModification(exclude.hoverActive);
44
- const combinerMediaQueryExcludeLocal = windowsModification(exclude.combinerMediaQuery);
45
- const cssVariableReplacementExcludeLocal = windowsModification(exclude.cssVariableReplacement);
58
+ const rtlExcludeLocal = (0, _windowsModification.windowsModification)(exclude.rtl);
59
+ const hoverActiveExcludeLocal = (0, _windowsModification.windowsModification)(exclude.hoverActive);
60
+ const combinerMediaQueryExcludeLocal = (0, _windowsModification.windowsModification)(exclude.combinerMediaQuery);
61
+ const cssVariableReplacementExcludeLocal = (0, _windowsModification.windowsModification)(exclude.cssVariableReplacement);
46
62
  const cssLoaderOptions = {
47
63
  // importLoaders: hasRTL||hoverActive ? 1 : 0,
48
64
  importLoaders: 1,
49
65
  modules: {},
50
66
  sourceMap: true
51
67
  };
68
+
52
69
  if (classNameBlob) {
53
70
  cssLoaderOptions.modules.localIdentName = classNameBlob;
54
71
  } else {
55
72
  cssLoaderOptions.modules.getLocalIdent = (0, _cssClassNameGenerate.default)(cssUniqueness, cssHashSelectors, classNamePrefix);
56
- }
57
- const postcssPlugins = [valueReplacer && require('../postcss-plugins/ValueReplacer')(valueReplacer), selectorReplace && require('postcss-selector-replace')(selectorReplace),
58
- // ...excludeEmptyCheckPlugin({
59
- // enable: true,
60
- // ignore: [],
61
- // plugins: [require('../postcss-plugins/variablePropertiesCollector').default()]
62
- // }),
63
- ...excludeEmptyCheckPlugin({
73
+ } // console.log('selector weight config : ', selectorWeightConfig);
74
+
75
+
76
+ const postcssPlugins = [valueReplacer && require('../postcss-plugins/ValueReplacer')(valueReplacer), selectorReplace && require('postcss-selector-replace')(selectorReplace), ...excludeEmptyCheckPlugin({
64
77
  enable: plugins.hasRTL,
65
78
  ignore: rtlExcludeLocal,
66
79
  plugins: [require('@zohodesk/postcss-rtl')({
@@ -68,6 +81,7 @@ const getCSSLoaders = (plugins, exclude, mediaQueryHoverActiveString, cssVariabl
68
81
  if (prefix === '[dir]') {
69
82
  return selector;
70
83
  }
84
+
71
85
  return `${prefix} ${selector}`; // Make selectors like [dir=rtl] > .selector
72
86
  }
73
87
  })]
@@ -82,7 +96,7 @@ const getCSSLoaders = (plugins, exclude, mediaQueryHoverActiveString, cssVariabl
82
96
  }), ...excludeEmptyCheckPlugin({
83
97
  enable: plugins.cssVariableReplacement,
84
98
  ignore: cssVariableReplacementExcludeLocal,
85
- plugins: [fs.existsSync(cssVariableReplacementConfig) && require('../postcss-plugins/variableModificationPlugin/index')(cssVariableReplacementConfig)]
99
+ plugins: [fs.existsSync(cssVariableReplacementConfig) && require('../postcss-plugins/variableModificationPlugin/index').plugin(cssVariableReplacementConfig)]
86
100
  })].filter(Boolean);
87
101
  return [cssSelectorZipPath && {
88
102
  loader: require.resolve('../loaders/selectorMappingLoader')
@@ -109,5 +123,6 @@ const getCSSLoaders = (plugins, exclude, mediaQueryHoverActiveString, cssVariabl
109
123
  }
110
124
  } : null].filter(Boolean);
111
125
  };
126
+
112
127
  var _default = getCSSLoaders;
113
128
  exports.default = _default;
@@ -4,8 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+
7
8
  var _path = _interopRequireDefault(require("path"));
9
+
8
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
9
12
  let getDevJsLoaders = options => {
10
13
  let {
11
14
  app: {
@@ -18,11 +21,13 @@ let getDevJsLoaders = options => {
18
21
  }
19
22
  } = options;
20
23
  let loaders = [];
24
+
21
25
  if (instrumentScript) {
22
26
  loaders.push({
23
27
  loader: require.resolve('../loaders/scriptInstrumentLoader.js')
24
28
  });
25
29
  }
30
+
26
31
  loaders.push({
27
32
  loader: 'babel-loader',
28
33
  options: {
@@ -44,6 +49,7 @@ let getDevJsLoaders = options => {
44
49
  cacheDirectory: true
45
50
  }
46
51
  });
52
+
47
53
  if (enableEslint) {
48
54
  loaders.push({
49
55
  loader: 'eslint-loader',
@@ -54,7 +60,9 @@ let getDevJsLoaders = options => {
54
60
  }
55
61
  });
56
62
  }
63
+
57
64
  return loaders;
58
65
  };
66
+
59
67
  var _default = getDevJsLoaders;
60
68
  exports.default = _default;
@@ -15,6 +15,9 @@ Object.defineProperty(exports, "getDevJsLoaders", {
15
15
  return _getDevJsLoaders.default;
16
16
  }
17
17
  });
18
+
18
19
  var _getDevJsLoaders = _interopRequireDefault(require("./getDevJsLoaders"));
20
+
19
21
  var _getCSSLoaders = _interopRequireDefault(require("./getCSSLoaders"));
22
+
20
23
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.windowsModification = windowsModification;
7
+ const isWin = process.platform === 'win32';
8
+
9
+ function windowsModification(array) {
10
+ return isWin ? array && Array.isArray(array) && array.map(r => r.replace(/\//g, '\\')) : array;
11
+ }
@@ -1,15 +1,22 @@
1
1
  "use strict";
2
2
 
3
3
  var _fs = _interopRequireDefault(require("fs"));
4
+
4
5
  var _path = _interopRequireDefault(require("path"));
6
+
5
7
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
+
6
9
  module.exports = function (source) {
7
10
  let comNameAry = this.resourcePath.split(_path.default.sep);
8
11
  let filePath = this.resourcePath;
12
+
9
13
  let appPath = _fs.default.realpathSync(process.cwd());
14
+
10
15
  let changePath = filePath.replace('/lib/', '/src/');
11
16
  let comName = comNameAry[comNameAry.length - 1];
12
17
  let name = comName.substring(0, comName.lastIndexOf('.'));
18
+
13
19
  let src = _fs.default.readFileSync(filePath.startsWith(appPath) ? filePath : changePath).toString();
20
+
14
21
  return `${source};${name}.source=${JSON.stringify(src)};${name}.filePath=${JSON.stringify(filePath)}`;
15
22
  };