@zohodesk/react-cli 1.1.29-exp.2 → 1.1.29-exp.3

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 (222) hide show
  1. package/README.md +18 -0
  2. package/lib/babel/babel-option-utils/babel-preset-react-option.js +3 -0
  3. package/lib/babel/cmjs-plugins-presets.js +13 -2
  4. package/lib/babel/es-plugins-presets.js +14 -3
  5. package/lib/common/buildEs.js +0 -1
  6. package/lib/common/getEntries.js +13 -2
  7. package/lib/common/getPublicPathConfig.js +6 -0
  8. package/lib/common/index.js +6 -1
  9. package/lib/common/runPreProcess.js +15 -6
  10. package/lib/common/splitChunks.js +21 -2
  11. package/lib/common/sslcertUpdater.js +18 -7
  12. package/lib/common/templateParameters.js +2 -0
  13. package/lib/common/testPattern.js +21 -10
  14. package/lib/common/valueReplacer.js +16 -1
  15. package/lib/configs/jest.config.js +11 -2
  16. package/lib/configs/libAlias.js +16 -10
  17. package/lib/configs/resolvers.js +16 -6
  18. package/lib/configs/webpack.component.umd.config.js +6 -1
  19. package/lib/configs/webpack.css.umd.config.js +14 -6
  20. package/lib/configs/webpack.dev.config.js +14 -1
  21. package/lib/configs/webpack.docs.config.js +9 -1
  22. package/lib/configs/webpack.impact.config.js +8 -1
  23. package/lib/configs/webpack.prod.config.js +17 -4
  24. package/lib/constants.js +18 -9
  25. package/lib/deprecationLogger.js +7 -0
  26. package/lib/hooks/docsProptypeHook.js +8 -4
  27. package/lib/jest/commitedFilesResult.js +46 -4
  28. package/lib/jest/coverageCollector.js +12 -1
  29. package/lib/jest/jsonMaker.js +6 -0
  30. package/lib/jest/preProcessors/cssPreprocessor.js +9 -1
  31. package/lib/jest/preProcessors/jsPreprocessor.js +11 -2
  32. package/lib/jest/preProcessors/otherFilesPreprocessor.js +4 -1
  33. package/lib/jest/result.js +23 -1
  34. package/lib/jest/run.js +18 -7
  35. package/lib/jest/setup.js +60 -8
  36. package/lib/loaderUtils/configsAssetsLoaders.js +12 -2
  37. package/lib/loaderUtils/getCSSLoaders.js +22 -10
  38. package/lib/loaderUtils/getDevJsLoaders.js +13 -4
  39. package/lib/loaderUtils/index.js +4 -1
  40. package/lib/loaderUtils/tests/windowsModification.test.js +1 -0
  41. package/lib/loaderUtils/windowsModification.js +3 -2
  42. package/lib/loaders/__test__/markdownLoader.spec.js +1 -0
  43. package/lib/loaders/composeLoader.js +37 -13
  44. package/lib/loaders/docsLoader.js +12 -1
  45. package/lib/loaders/docsPropsLoader.js +8 -4
  46. package/lib/loaders/enhancedReactLiveConverter.js +23 -2
  47. package/lib/loaders/fileBountryLoader.js +3 -1
  48. package/lib/loaders/fileLoader.js +23 -12
  49. package/lib/loaders/markdownLoader.js +19 -14
  50. package/lib/loaders/reactLiveConvertor.js +15 -5
  51. package/lib/loaders/scriptInstrumentLoader.js +16 -7
  52. package/lib/loaders/selectorMappingLoader.js +26 -7
  53. package/lib/loaders/workerLoader.js +24 -9
  54. package/lib/logger.js +4 -0
  55. package/lib/middlewares/HMRMiddleware.js +27 -13
  56. package/lib/middlewares/SSTMiddleware.js +5 -1
  57. package/lib/pluginUtils/configHtmlWebpackPlugins.js +24 -1
  58. package/lib/pluginUtils/getDevPlugins.js +42 -9
  59. package/lib/pluginUtils/getDocsPlugins.js +13 -3
  60. package/lib/pluginUtils/getLibraryImactPlugins.js +6 -5
  61. package/lib/pluginUtils/getLibraryPlugins.js +8 -2
  62. package/lib/pluginUtils/getProdPlugins.js +47 -8
  63. package/lib/pluginUtils/getServerPlugins.js +8 -2
  64. package/lib/pluginUtils/getUMDCSSPlugins.js +10 -2
  65. package/lib/pluginUtils/getUMDComponentPlugins.js +10 -2
  66. package/lib/pluginUtils/index.js +9 -1
  67. package/lib/plugins/CdnChangePlugin.js +18 -2
  68. package/lib/plugins/CleanupStatsPlugin.js +5 -0
  69. package/lib/plugins/CssOrderControlPlugin.js +6 -3
  70. package/lib/plugins/CustomAttributePlugin.js +19 -14
  71. package/lib/plugins/CustomScriptLoadingStrategyPlugin.js +23 -3
  72. package/lib/plugins/EFCPlugin.js +34 -20
  73. package/lib/plugins/EFCTemplatePlugin.js +30 -19
  74. package/lib/plugins/EfcResourceCleanupPlugin.js +3 -0
  75. package/lib/plugins/EventsHandlingPlugin.js +4 -2
  76. package/lib/plugins/I18NInjectIntoIndexPlugin.js +37 -14
  77. package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +15 -10
  78. package/lib/plugins/I18nSplitPlugin/I18nDependency.js +10 -4
  79. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +155 -78
  80. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +81 -198
  81. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +23 -12
  82. package/lib/plugins/I18nSplitPlugin/index.js +24 -13
  83. package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +12 -2
  84. package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +1 -0
  85. package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +5 -0
  86. package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +8 -1
  87. package/lib/plugins/I18nSplitPlugin/utils/index.js +4 -0
  88. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +20 -0
  89. package/lib/plugins/I18nSplitPlugin/utils/unicodeConversion.js +1 -0
  90. package/lib/plugins/ManifestPlugin.js +18 -1
  91. package/lib/plugins/MinifyPlugin.js +10 -1
  92. package/lib/plugins/ModuleStatsPlugin.js +24 -1
  93. package/lib/plugins/OptimizeJSPlugin.js +10 -2
  94. package/lib/plugins/PublicPathCallbackPlugin.js +12 -1
  95. package/lib/plugins/PublicPathChangePlugin.js +39 -6
  96. package/lib/plugins/ReportGeneratePlugin.js +32 -5
  97. package/lib/plugins/RequireVariablePublicPlugin.js +8 -1
  98. package/lib/plugins/ResourceHintsPlugin.js +13 -4
  99. package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +17 -12
  100. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +17 -10
  101. package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +5 -2
  102. package/lib/plugins/ScriptInstrumentPlugin.js +8 -1
  103. package/lib/plugins/SelectorPlugin.js +32 -6
  104. package/lib/plugins/ServiceWorkerPlugin.js +22 -5
  105. package/lib/plugins/ShadowDOMSupportPlugin.js +41 -4
  106. package/lib/plugins/SourceMapHookPlugin.js +12 -2
  107. package/lib/plugins/StatsPlugin.js +14 -0
  108. package/lib/plugins/TPHashMappingPlugin.js +18 -3
  109. package/lib/plugins/UnusedFilesFindPlugin.js +39 -4
  110. package/lib/plugins/VariableConversionCollector.js +42 -15
  111. package/lib/plugins/index.js +20 -1
  112. package/lib/plugins/libraryImpactPlugin.js +33 -1
  113. package/lib/plugins/utils/classHandling.js +6 -0
  114. package/lib/plugins/utils/fileHandling.js +15 -6
  115. package/lib/plugins/utils/tests/fileHandling.test.js +4 -0
  116. package/lib/plugins/variableConvertorUtils.js +29 -14
  117. package/lib/plugins/webpackwatchrunplugin.js +5 -0
  118. package/lib/postcss-plugins/EmptyPlugin.js +4 -3
  119. package/lib/postcss-plugins/ExcludePlugin.js +5 -1
  120. package/lib/postcss-plugins/IncludePlugin.js +5 -1
  121. package/lib/postcss-plugins/RTLSplitPlugin.js +27 -14
  122. package/lib/postcss-plugins/SelectorReplace.js +16 -1
  123. package/lib/postcss-plugins/ValueReplacer.js +6 -7
  124. package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +3 -0
  125. package/lib/postcss-plugins/__test__/selectorReplace.test.js +3 -6
  126. package/lib/postcss-plugins/__test__/valueReplacer.spec.js +5 -2
  127. package/lib/postcss-plugins/hoverActivePlugin.js +67 -31
  128. package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +7 -0
  129. package/lib/postcss-plugins/variableModificationPlugin/index.js +49 -28
  130. package/lib/schemas/index.js +10 -3
  131. package/lib/servers/clusterHubServer.js +11 -1
  132. package/lib/servers/devBuild.js +26 -14
  133. package/lib/servers/docsServer.js +3 -1
  134. package/lib/servers/docsServerCore.js +22 -1
  135. package/lib/servers/getCliPath.js +9 -0
  136. package/lib/servers/helpServer.js +6 -1
  137. package/lib/servers/httpsOptions.js +8 -2
  138. package/lib/servers/impactServer.js +35 -3
  139. package/lib/servers/mockserver.js +10 -1
  140. package/lib/servers/nowatchserver.js +37 -12
  141. package/lib/servers/requireLocalOrGlobal.js +17 -6
  142. package/lib/servers/scrServer.js +21 -14
  143. package/lib/servers/server.js +36 -6
  144. package/lib/servers/ssServer.js +17 -1
  145. package/lib/templates/CoverageScriptTemplate.js +14 -0
  146. package/lib/templates/WMSTemplate.js +13 -7
  147. package/lib/templates/linterConstant.js +4 -2
  148. package/lib/utils/babelPresets.js +7 -3
  149. package/lib/utils/clean.js +9 -3
  150. package/lib/utils/copy.js +7 -1
  151. package/lib/utils/copyTimezones.js +9 -1
  152. package/lib/utils/createEventStream.js +6 -1
  153. package/lib/utils/cssClassNameGenerate.js +30 -10
  154. package/lib/utils/cssURLReplacer.js +22 -1
  155. package/lib/utils/dependencyPostPublish.js +10 -1
  156. package/lib/utils/deprecationSupport.js +32 -7
  157. package/lib/utils/fileUtils.js +28 -1
  158. package/lib/utils/folderIterator.js +13 -2
  159. package/lib/utils/getComponents.js +21 -0
  160. package/lib/utils/getCurrentBranch.js +5 -0
  161. package/lib/utils/getDependenciesImpactList.js +22 -1
  162. package/lib/utils/getFileType.js +10 -2
  163. package/lib/utils/getHash.js +8 -1
  164. package/lib/utils/getIp.js +2 -0
  165. package/lib/utils/getOptions.js +53 -16
  166. package/lib/utils/getServerURL.js +10 -1
  167. package/lib/utils/index.js +51 -4
  168. package/lib/utils/init.js +1 -0
  169. package/lib/utils/initPreCommitHook.js +30 -7
  170. package/lib/utils/jsonHelper.js +22 -3
  171. package/lib/utils/libraryImpactConfig.js +5 -2
  172. package/lib/utils/lint/addScripts.js +5 -2
  173. package/lib/utils/lint/checkExistingConfig.js +12 -3
  174. package/lib/utils/lint/copyConfigs.js +3 -0
  175. package/lib/utils/lint/index.js +9 -0
  176. package/lib/utils/lint/lintScripts.js +1 -0
  177. package/lib/utils/lint/lintSetup.js +4 -3
  178. package/lib/utils/lint/lintStagedPreCommitHook.js +1 -0
  179. package/lib/utils/lint/question.js +7 -0
  180. package/lib/utils/lintReporter.js +20 -0
  181. package/lib/utils/log.js +1 -0
  182. package/lib/utils/mailSender.js +8 -1
  183. package/lib/utils/object-manipulation.js +17 -1
  184. package/lib/utils/pullOrigin.js +4 -0
  185. package/lib/utils/reinstallDependencies.js +29 -1
  186. package/lib/utils/removeAttributes.js +8 -1
  187. package/lib/utils/repoClone.js +28 -3
  188. package/lib/utils/request.js +12 -0
  189. package/lib/utils/rtl.js +17 -5
  190. package/lib/utils/selectorReplacer.js +16 -10
  191. package/lib/utils/setEnvVariables.js +2 -0
  192. package/lib/utils/ssTestHack.js +11 -1
  193. package/lib/utils/switchBranch.js +5 -0
  194. package/lib/utils/typeCheck.js +1 -0
  195. package/lib/utils/urlConcat.js +4 -0
  196. package/lib/utils/useExitCleanup.js +10 -9
  197. package/lib/utils/variableConverter.js +31 -22
  198. package/{package-lock.json → npm-shrinkwrap.json} +2333 -2101
  199. package/package.json +3 -2
  200. package/lib/plugins/I18nSplitPlugin/utils/applyMetaManifest.js +0 -279
  201. package/lib/plugins/I18nSplitPlugin/utils/createMetaManifest.js +0 -51
  202. package/lib/plugins/I18nSplitPlugin/utils/createRegularManifest.js +0 -48
  203. package/lib/plugins/newi18nsplitplugin/18nPlugin1.js +0 -306
  204. package/lib/plugins/newi18nsplitplugin/18nPlugin2.js +0 -363
  205. package/lib/plugins/newi18nsplitplugin/18nPlugin3.js +0 -694
  206. package/lib/plugins/newi18nsplitplugin/18nPlugin_hashed.js +0 -1258
  207. package/lib/plugins/newi18nsplitplugin/18nPlugin_working.js +0 -542
  208. package/lib/plugins/newi18nsplitplugin/18nplugin.js +0 -974
  209. package/lib/plugins/newi18nsplitplugin/ChunkManager.js +0 -131
  210. package/lib/plugins/newi18nsplitplugin/GenerateModuleIdToKeysMapPlugin.js +0 -59
  211. package/lib/plugins/newi18nsplitplugin/I18nDiffPlugin.js +0 -262
  212. package/lib/plugins/newi18nsplitplugin/I18nDownloadLogic.js +0 -166
  213. package/lib/plugins/newi18nsplitplugin/I18nPropertiesPlugin.js +0 -111
  214. package/lib/plugins/newi18nsplitplugin/KeyCollector.js +0 -163
  215. package/lib/plugins/newi18nsplitplugin/ManifestGenerator.js +0 -88
  216. package/lib/plugins/newi18nsplitplugin/UnicodeConversionPlugin.js +0 -101
  217. package/lib/plugins/newi18nsplitplugin/constants.js +0 -162
  218. package/lib/plugins/newi18nsplitplugin/utils/I18nKeyHasher.js +0 -78
  219. package/lib/plugins/newi18nsplitplugin/utils/getJsResourceKeys.js +0 -22
  220. package/lib/plugins/newi18nsplitplugin/utils/i18nChunkUtils.js +0 -18
  221. package/lib/plugins/newi18nsplitplugin/utils/manifestGenerator.js +0 -580
  222. package/lib/plugins/newi18nsplitplugin/utils/propertiesUtils.js +0 -54
@@ -1,34 +1,40 @@
1
1
  "use strict";
2
2
 
3
3
  var _querystring = _interopRequireDefault(require("querystring"));
4
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
4
+
5
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6
+
5
7
  let log = (...args) => {
6
8
  let print = console;
7
9
  print.log(...args);
8
- };
10
+ }; // eslint-disable-next-line no-undef
11
+
9
12
 
10
- // eslint-disable-next-line no-undef
11
13
  let options = _querystring.default.parse(__resourceQuery.slice(1));
14
+
12
15
  window.WebSocket = window.WebSocket || window.MozWebSocket;
13
16
  let connection = new WebSocket(options.wmsPath);
17
+
14
18
  connection.onopen = () => {
15
19
  // connection is opened and ready to use
16
20
  log('open');
17
21
  };
22
+
18
23
  connection.onerror = error => {
19
24
  // an error occurred when sending/receiving data
20
25
  throw error;
21
26
  };
27
+
22
28
  connection.onmessage = message => {
23
29
  // try to decode json (I assume that each message
24
30
  // from server is json)
25
31
  try {
26
- let json = JSON.parse(message.data);
27
- // eslint-disable-next-line no-undef
32
+ let json = JSON.parse(message.data); // eslint-disable-next-line no-undef
33
+
28
34
  Collaboration.handleCustomMessage(json);
29
35
  } catch (e) {
30
36
  log('This doesn\'t look like a valid JSON: ', message.data);
31
37
  return;
32
- }
33
- // handle incoming message
38
+ } // handle incoming message
39
+
34
40
  };
@@ -4,5 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.htmlTemplate = exports.endTag = void 0;
7
- const htmlTemplate = exports.htmlTemplate = '<!DOCTYPE html><html> <head> <title>Eslint Security Rule</title> <style type="text/css"> body{margin: 0; font: 93.75%/1.6 -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif;}body, html{width: 100%; height: 100%;}.pkCont{}.pkEmpty{height: 300px;display: flex;align-items: center;justify-content: center;font-size: 20px;}.pkUl{margin: 0; padding: 0; list-style-type: none;}.pkLi{}.pkRow{display: flex; padding: 12px 16px;}.pkArrowCont{cursor: pointer; width: 50px; display: flex; align-items: center; justify-content: center; background-color: #f4f5f5; border-radius: 4px;}.pkArrow{width: 1px; height: 1px; border: 5px solid; border-color: #000 transparent transparent; margin-top: 7px;}.pkDetailsOpen .pkArrow{margin: 0 0 7px; border-color: transparent transparent #000;}.pkFileName{font-weight: 600; margin: 0 8px;}.pkUrl{flex: 1; min-width: 0; min-height: 0; word-break: break-word; word-wrap: break-word; color: blue;}.pkDetails{margin-left: 66px; display: none;}.pkDetailsOpen .pkDetails{display: block;}.pkDetailsHead{font-weight: 600; display: flex; border: 1px solid #e5e5e5; padding: 3px 8px;}.pkDetailsBody{max-height: 400px; overflow: auto;}.pkDetailsRow{display: flex; padding: 10px 8px;}.pkDetailsRow:nth-child(even){background-color: #f4f5f5;}.pkDetailsCol{word-break: break-word; word-wrap: break-word;}.pkError{color: red;}.pkDetailsCol:nth-child(1){width: 10%;}.pkDetailsCol:nth-child(2){width: 10%;}.pkDetailsCol:nth-child(3){width: 40%;}.pkDetailsCol:nth-child(4){width: 40%;}</style> <script>function toggleWrapper(element){var classArray=element.parentElement.parentElement.className; if (classArray.includes("pkDetailsOpen")){element.parentElement.parentElement.className="pkLi";}else{element.parentElement.parentElement.className="pkLi pkDetailsOpen";}}</script> </head> <body> <div class="pkCont">';
8
- const endTag = exports.endTag = '</div></body></html>';
7
+ const htmlTemplate = '<!DOCTYPE html><html> <head> <title>Eslint Security Rule</title> <style type="text/css"> body{margin: 0; font: 93.75%/1.6 -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif;}body, html{width: 100%; height: 100%;}.pkCont{}.pkEmpty{height: 300px;display: flex;align-items: center;justify-content: center;font-size: 20px;}.pkUl{margin: 0; padding: 0; list-style-type: none;}.pkLi{}.pkRow{display: flex; padding: 12px 16px;}.pkArrowCont{cursor: pointer; width: 50px; display: flex; align-items: center; justify-content: center; background-color: #f4f5f5; border-radius: 4px;}.pkArrow{width: 1px; height: 1px; border: 5px solid; border-color: #000 transparent transparent; margin-top: 7px;}.pkDetailsOpen .pkArrow{margin: 0 0 7px; border-color: transparent transparent #000;}.pkFileName{font-weight: 600; margin: 0 8px;}.pkUrl{flex: 1; min-width: 0; min-height: 0; word-break: break-word; word-wrap: break-word; color: blue;}.pkDetails{margin-left: 66px; display: none;}.pkDetailsOpen .pkDetails{display: block;}.pkDetailsHead{font-weight: 600; display: flex; border: 1px solid #e5e5e5; padding: 3px 8px;}.pkDetailsBody{max-height: 400px; overflow: auto;}.pkDetailsRow{display: flex; padding: 10px 8px;}.pkDetailsRow:nth-child(even){background-color: #f4f5f5;}.pkDetailsCol{word-break: break-word; word-wrap: break-word;}.pkError{color: red;}.pkDetailsCol:nth-child(1){width: 10%;}.pkDetailsCol:nth-child(2){width: 10%;}.pkDetailsCol:nth-child(3){width: 40%;}.pkDetailsCol:nth-child(4){width: 40%;}</style> <script>function toggleWrapper(element){var classArray=element.parentElement.parentElement.className; if (classArray.includes("pkDetailsOpen")){element.parentElement.parentElement.className="pkLi";}else{element.parentElement.parentElement.className="pkLi pkDetailsOpen";}}</script> </head> <body> <div class="pkCont">';
8
+ exports.htmlTemplate = htmlTemplate;
9
+ const endTag = '</div></body></html>';
10
+ exports.endTag = endTag;
@@ -4,8 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = exports.a = void 0;
7
- let a = exports.a = require.resolve('babel-plugin-transform-define');
8
- var _default = exports.default = {
7
+
8
+ let a = require.resolve('babel-plugin-transform-define');
9
+
10
+ exports.a = a;
11
+ var _default = {
9
12
  presets: [['env', {
10
13
  modules: false
11
14
  }], 'react'],
@@ -15,4 +18,5 @@ var _default = exports.default = {
15
18
  regenerator: false,
16
19
  moduleName: 'babel-runtime'
17
20
  }]]
18
- };
21
+ };
22
+ exports.default = _default;
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _rimraf = _interopRequireDefault(require("rimraf"));
4
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
4
+
5
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6
+
5
7
  let help = false;
6
- let dashdash = false;
7
- //eslint-disable-next-line array-callback-return
8
+ let dashdash = false; //eslint-disable-next-line array-callback-return
9
+
8
10
  let args = process.argv.slice(2).filter(arg => {
9
11
  if (dashdash) {
10
12
  return !!arg;
@@ -16,17 +18,21 @@ let args = process.argv.slice(2).filter(arg => {
16
18
  return !!arg;
17
19
  }
18
20
  });
21
+
19
22
  let go = n => {
20
23
  if (n >= args.length) {
21
24
  return;
22
25
  }
26
+
23
27
  (0, _rimraf.default)(args[n], er => {
24
28
  if (er) {
25
29
  throw er;
26
30
  }
31
+
27
32
  go(n + 1);
28
33
  });
29
34
  };
35
+
30
36
  if (help || args.length === 0) {
31
37
  // If they didn't ask for help, then this is not a "success"
32
38
  // eslint-disable-next-line no-console
package/lib/utils/copy.js CHANGED
@@ -1,11 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  var _path = _interopRequireDefault(require("path"));
4
+
4
5
  var _fs = _interopRequireDefault(require("fs"));
6
+
5
7
  var _fileUtils = require("./fileUtils");
6
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
8
+
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+
7
11
  let args = process.argv.slice(2);
12
+
8
13
  let appPath = _fs.default.realpathSync(process.cwd());
14
+
9
15
  let [srcPath, targetPath, exts, isCopy = true, flatten = '', changeExt = ''] = args;
10
16
  exts = exts ? exts.split(',').map(ext => `.${ext.trim()}`) : false;
11
17
  srcPath = _path.default.join(appPath, srcPath);
@@ -1,13 +1,21 @@
1
1
  "use strict";
2
2
 
3
3
  var _path = _interopRequireDefault(require("path"));
4
+
4
5
  var _fs = _interopRequireDefault(require("fs"));
6
+
5
7
  var _fileUtils = require("./fileUtils");
6
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
8
+
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+
7
11
  let args = process.argv.slice(2);
12
+
8
13
  let appPath = _fs.default.realpathSync(process.cwd());
14
+
9
15
  let [targetPath] = args;
10
16
  targetPath = targetPath === '."' || !targetPath ? '' : targetPath;
11
17
  targetPath = _path.default.join(appPath, targetPath);
18
+
12
19
  let srcPath = _path.default.resolve(_path.default.dirname(require.resolve('@zohodesk/datetimejs')), '../data/timezones/');
20
+
13
21
  (0, _fileUtils.copy)(srcPath, targetPath, true, null, 'flatten');
@@ -4,14 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+
7
8
  let createEventStream = (heartbeat, heartbeatInfo = null) => {
8
9
  let clientId = 0;
9
10
  let clients = {};
11
+
10
12
  let everyClient = fn => {
11
13
  Object.keys(clients).forEach(id => {
12
14
  fn(clients[id]);
13
15
  });
14
16
  };
17
+
15
18
  setInterval(() => {
16
19
  everyClient(client => {
17
20
  if (heartbeatInfo) {
@@ -49,4 +52,6 @@ let createEventStream = (heartbeat, heartbeatInfo = null) => {
49
52
  }
50
53
  };
51
54
  };
52
- var _default = exports.default = createEventStream;
55
+
56
+ var _default = createEventStream;
57
+ exports.default = _default;
@@ -4,28 +4,40 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+
7
8
  var _os = _interopRequireDefault(require("os"));
9
+
8
10
  var _path = _interopRequireDefault(require("path"));
11
+
9
12
  var _fileHandling = require("../plugins/utils/fileHandling");
13
+
10
14
  var _getHash = _interopRequireDefault(require("./getHash"));
11
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
12
18
  const isWindows = _os.default.platform().toLowerCase() === 'win32';
19
+
13
20
  const isSelectorPackage = (resourcePath, packages) => {
14
21
  if (!resourcePath.includes('node_modules')) {
15
22
  return false;
16
23
  }
24
+
17
25
  let isValid = false;
26
+
18
27
  for (let pack of packages) {
19
28
  if (isWindows) {
20
29
  pack = pack.replace(/\//g, '\\');
21
30
  }
31
+
22
32
  if (resourcePath.includes(pack)) {
23
33
  isValid = true;
24
34
  break;
25
35
  }
26
36
  }
37
+
27
38
  return isValid;
28
39
  };
40
+
29
41
  function patternBasedClass({
30
42
  customClassNamePrefix,
31
43
  context,
@@ -46,24 +58,24 @@ function patternBasedClass({
46
58
  });
47
59
  return newName;
48
60
  }
61
+
49
62
  var _default = (unique = true, {
50
63
  filenames,
51
64
  packages
52
65
  }, classNamePrefix, customClassNamePrefix, patterns, displayClassName) => (context, localIdentName, localName) => {
53
66
  // console.log(patterns, context.resourcePath);
54
-
55
67
  // NOTE: in build machine we use date as folder path.
56
68
  // So every time we create new build there is path will alway different
57
69
  // in order to minimize that problem we try in relative path;
58
70
  // console.log('context.resourcePath', context.resourcePath, context);
59
71
  // let contextResourcePath = context.resourcePath;
60
-
61
72
  const filePaths = context.resourcePath.split(_path.default.sep);
62
73
  const fileName = filePaths[filePaths.length - 1];
63
74
  const [fileNameWithoutExt] = fileName.split('.');
64
75
  const cleanFileName = fileNameWithoutExt.replace(/-/g, '_').toLowerCase();
65
- const relativePath = _path.default.relative(context.rootContext, context.resourcePath);
66
- // console.log('customClassNamePrefix', customClassNamePrefix);
76
+
77
+ const relativePath = _path.default.relative(context.rootContext, context.resourcePath); // console.log('customClassNamePrefix', customClassNamePrefix);
78
+
67
79
  /*
68
80
  input :
69
81
  context.resourcePath : 'D:/MyWork/..../desk_client_app/supportapp/src/components/Avatar/Avatar.module.css,
@@ -78,15 +90,17 @@ var _default = (unique = true, {
78
90
  output :
79
91
  true or false
80
92
  */
93
+
94
+
81
95
  if (displayClassName) {
82
96
  return `${fileNameWithoutExt}__${localName}`;
83
- }
97
+ } // return cleanFileName
84
98
 
85
- // return cleanFileName
86
99
 
87
100
  if (context.resourcePath.endsWith('.plain.css')) {
88
101
  return localName;
89
102
  }
103
+
90
104
  if (!(0, _fileHandling.isFileNameMatchingPluginPattern)({
91
105
  filename: context.resourcePath,
92
106
  filterArr: patterns.cssUniqueness
@@ -94,26 +108,32 @@ var _default = (unique = true, {
94
108
  return `${classNamePrefix}-${cleanFileName}-${localName}`;
95
109
  }
96
110
  /* old production mode start without breaking so added. may be removed in future*/
111
+
112
+
97
113
  if (unique) {
98
114
  const h = (0, _getHash.default)(`${relativePath}-${localName}`, 10);
99
115
  return `${classNamePrefix}${h}`;
100
116
  }
117
+
101
118
  const patternClass = patternBasedClass({
102
119
  customClassNamePrefix,
103
120
  context,
104
121
  relativePath,
105
122
  localName
106
123
  });
124
+
107
125
  if (patternClass) {
108
126
  return patternClass;
109
- }
110
-
111
- //css file has case sensitive selector issue so can't toLowerCase
127
+ } //css file has case sensitive selector issue so can't toLowerCase
112
128
  //let local = localName.toLowerCase()
129
+
130
+
113
131
  if (isSelectorPackage(context.resourcePath, packages) || filenames.indexOf(cleanFileName) !== -1) {
114
132
  const h = (0, _getHash.default)(`${relativePath}-${localName}`, 10);
115
133
  return `${classNamePrefix}${h}`;
116
134
  }
135
+
117
136
  return `${classNamePrefix}-${cleanFileName}-${localName}`;
118
137
  };
138
+
119
139
  exports.default = _default;
@@ -11,21 +11,30 @@ Object.defineProperty(exports, "getFileType", {
11
11
  }
12
12
  });
13
13
  exports.getUrls = void 0;
14
+
14
15
  var _fs = _interopRequireDefault(require("fs"));
16
+
15
17
  var _crypto = _interopRequireDefault(require("crypto"));
18
+
16
19
  var _getFileType = require("./getFileType");
17
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
20
+
21
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
+
18
23
  const urlRegex = /url\(.*?\)/g;
24
+
19
25
  const getHash = (file, isPath = false, needSubStr = true) => {
20
26
  let hash = _crypto.default.createHash('md5');
27
+
21
28
  if (isPath) {
22
29
  hash.update(_fs.default.readFileSync(file));
23
30
  } else {
24
31
  hash.update(file);
25
32
  }
33
+
26
34
  hash = hash.digest('hex');
27
35
  return hash ? needSubStr ? hash.substring(0, 20) : hash : null;
28
36
  };
37
+
29
38
  const formatUrl = str => {
30
39
  let char = str.includes('"') ? '"' : str.includes('\'') ? '\'' : '(';
31
40
  const statingIdx = str.indexOf(char) + 1;
@@ -33,9 +42,11 @@ const formatUrl = str => {
33
42
  char = char === '(' ? ')' : char;
34
43
  return substr.substring(0, substr.indexOf(char));
35
44
  };
45
+
36
46
  const getUrls = css => {
37
47
  const urlMatches = css.match(urlRegex);
38
48
  let src = css;
49
+
39
50
  if (urlMatches) {
40
51
  const patterns = {};
41
52
  urlMatches.forEach(pattern => {
@@ -51,16 +62,20 @@ const getUrls = css => {
51
62
  };
52
63
  }
53
64
  };
65
+
54
66
  exports.getUrls = getUrls;
67
+
55
68
  const cssUrlReplacer = (css, domains, chunkHash = {}) => {
56
69
  const obj = getUrls(css);
57
70
  let src = css;
71
+
58
72
  if (obj) {
59
73
  const patterns = obj.urls;
60
74
  src = obj.css;
61
75
  Object.keys(patterns).forEach(pattern => {
62
76
  let urlParts = pattern.split('/');
63
77
  let fileName = urlParts.pop();
78
+
64
79
  if (fileName.includes('#')) {
65
80
  if (fileName.includes('?')) {
66
81
  fileName = fileName.replace(/\?.*#/g, '#');
@@ -68,12 +83,14 @@ const cssUrlReplacer = (css, domains, chunkHash = {}) => {
68
83
  } else {
69
84
  fileName = fileName.replace(/\?.*$/g, '');
70
85
  }
86
+
71
87
  const hash = patterns[pattern];
72
88
  const filename = fileName.replace(/(\?|#).*?$/g, '');
73
89
  const regex = new RegExp(hash, 'g');
74
90
  let {
75
91
  hashedName
76
92
  } = chunkHash[filename] || fileName;
93
+
77
94
  if (domains && typeof urlParts[0] === 'string' && !urlParts[0].includes('http')) {
78
95
  const {
79
96
  font,
@@ -83,6 +100,7 @@ const cssUrlReplacer = (css, domains, chunkHash = {}) => {
83
100
  const customPath = type === 'image' ? `${image}/images` : type === 'font' ? `${font}/fonts` : urlParts.join('/');
84
101
  urlParts = customPath.split('/');
85
102
  }
103
+
86
104
  if (hashedName) {
87
105
  if (fileName.includes('#')) {
88
106
  if (fileName.includes('?')) {
@@ -92,11 +110,14 @@ const cssUrlReplacer = (css, domains, chunkHash = {}) => {
92
110
  }
93
111
  }
94
112
  }
113
+
95
114
  urlParts.push(hashedName || fileName);
96
115
  urlParts = urlParts.join('/');
97
116
  src = src.replace(regex, `url('${urlParts}')`);
98
117
  });
99
118
  }
119
+
100
120
  return src;
101
121
  };
122
+
102
123
  exports.cssUrlReplacer = cssUrlReplacer;
@@ -1,22 +1,31 @@
1
1
  "use strict";
2
2
 
3
3
  var _child_process = require("child_process");
4
+
4
5
  var _path = _interopRequireDefault(require("path"));
6
+
5
7
  var _request = _interopRequireDefault(require("./request"));
8
+
6
9
  var _index = require("./index");
7
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+
8
13
  let changeset = (0, _child_process.execSync)('git rev-parse HEAD', {
9
14
  cwd: process.cwd()
10
15
  }).toString() || '';
11
16
  changeset = changeset.trim();
17
+
12
18
  if (!changeset) {
13
19
  throw new Error('Changeset doesn\'t exists');
14
20
  }
21
+
15
22
  (0, _index.log)(changeset, 'changeset');
23
+
16
24
  let {
17
25
  version,
18
26
  name
19
27
  } = require(_path.default.join(process.cwd(), './package.json'));
28
+
20
29
  (0, _request.default)({
21
30
  url: `${'ht'}${'tp'}://tsi-desk-mock.tsi.zohocorpin.com:8080/Hbase/addKey?method=addkey`,
22
31
  method: 'POST',
@@ -4,25 +4,35 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.deprecationSupport = deprecationSupport;
7
+
7
8
  var _path = _interopRequireDefault(require("path"));
9
+
8
10
  var deprecationHandlers = _interopRequireWildcard(require("../deprecationLogger"));
11
+
9
12
  var _windowsModification = require("../loaderUtils/windowsModification");
10
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
11
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
12
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+
14
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
+
16
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
13
20
  let {
14
21
  deprecateMessage,
15
22
  deprecateOption,
16
23
  deprecationLoggerEnd
17
24
  } = deprecationHandlers;
25
+
18
26
  function modifyCssArr(arr) {
19
27
  return arr.map(x => {
20
28
  const includeCss = !x.startsWith('!');
21
29
  const modifier = includeCss ? '/*.css' : '';
22
30
  const filePath = x.replace(/^!/, ''); // Remove the "!" symbol if present
31
+
23
32
  return (0, _windowsModification.windowsModificationFile)(_path.default.join(includeCss ? '**' : '!**', filePath, '**', modifier));
24
33
  });
25
34
  }
35
+
26
36
  const defaultPostCssPluginOptions = {
27
37
  valueReplacer: null,
28
38
  hasRTL: false,
@@ -34,66 +44,80 @@ const defaultPostCssPluginOptions = {
34
44
  minifier: false,
35
45
  composeMinification: false
36
46
  };
47
+
37
48
  function deprecationSupport(options, disableDeprecationWarning) {
38
49
  if (disableDeprecationWarning) {
39
50
  /* eslint-disable no-empty-function */
40
51
  deprecateMessage = () => {};
52
+
41
53
  deprecateOption = () => {};
54
+
42
55
  deprecationLoggerEnd = () => {};
43
56
  /* eslint-enable no-empty-function */
57
+
44
58
  }
59
+
45
60
  options.app.plugins = options.app.plugins || defaultPostCssPluginOptions;
46
61
  options.docs.plugins = options.docs.plugins || defaultPostCssPluginOptions;
47
- options.css.plugins = options.css.plugins || defaultPostCssPluginOptions;
62
+ options.css.plugins = options.css.plugins || defaultPostCssPluginOptions; // if (selectn(options, ".app.hasRTL") === true) {
48
63
 
49
- // if (selectn(options, ".app.hasRTL") === true) {
50
64
  if (options.app.hasRTL === true) {
51
65
  deprecateOption('app.hasRTL', 'app.plugins.hasRTL');
52
66
  options.app.plugins.hasRTL = true;
53
67
  }
68
+
54
69
  if (options.docs.hasRTL === true) {
55
70
  deprecateOption('docs.hasRTL', 'docs.plugins.hasRTL');
56
71
  options.docs.plugins.hasRTL = true;
57
72
  }
73
+
58
74
  if (options.app.selectorReplace !== null && options.app.plugins && (options.app.plugins.selectorReplace === null || options.app.plugins.selectorReplace === undefined)) {
59
75
  deprecateMessage('when you use app.selectorReplace mention enable or disable app.plugins.selectorReplace by setting value to true or false');
60
76
  options.app.plugins.selectorReplace = true;
61
77
  }
78
+
62
79
  if (options.docs.selectorReplace !== null && options.docs.plugins && (options.docs.plugins.selectorReplace === null || options.docs.plugins.selectorReplace === undefined)) {
63
80
  deprecateMessage('when you use docs.selectorReplace mention enable or disable docs.plugins.selectorReplace by setting value to true or false');
64
81
  options.docs.plugins.selectorReplace = true;
65
82
  }
83
+
66
84
  if (options.css.valueReplacer !== null && options.css.plugins && (options.app.plugins.valueReplacer === null || options.app.plugins.valueReplacer === undefined)) {
67
85
  deprecateMessage('when you use app.valueReplacer mention enable or disable app.plugins.valueReplacer by setting value to true or false');
68
86
  options.app.plugins.valueReplacer = true;
69
87
  }
88
+
70
89
  if (!options.app.patterns) {
71
90
  options.app.patterns = {};
72
91
  }
92
+
73
93
  function handleRTL(rtlExclude, rtl, hasRTL, type) {
74
94
  if (rtlExclude && rtlExclude.length > 0) {
75
95
  options[type].patterns.hasRTL = modifyCssArr(rtlExclude);
76
96
  deprecateOption(`${type}.rtlExclude`, `${type}.patterns.hasRTL`);
77
97
  }
98
+
78
99
  if (rtl && rtl.length > 0) {
79
100
  options[type].patterns.hasRTL = modifyCssArr(rtl);
80
101
  deprecateOption(`${type}.exclude.rtl`, `${type}.patterns.hasRTL`);
81
102
  }
103
+
82
104
  if (hasRTL && hasRTL.length > 0) {
83
105
  options[type].patterns.hasRTL = modifyCssArr(hasRTL);
84
106
  deprecateOption(`${type}.exclude.hasRTL`, `${type}.patterns.hasRTL`);
85
107
  }
86
108
  }
109
+
87
110
  function addExcludesToPattern(patterns, exclude, type) {
88
111
  Object.keys(defaultPostCssPluginOptions).forEach(key => {
89
112
  if (!exclude[key] || exclude[key].length === 0) {
90
113
  return;
91
114
  }
115
+
92
116
  if (patterns[key].length === 0) {
93
117
  deprecateOption(`${type}.exclude.${key}`, `${type}.patterns.${key}`);
94
118
  let tempArr = exclude[key];
95
- tempArr = tempArr.map(x => _path.default.join('!**', x, '**'));
96
- // Since patterns[key] is empty we need to wildcard for allow all others.
119
+ tempArr = tempArr.map(x => _path.default.join('!**', x, '**')); // Since patterns[key] is empty we need to wildcard for allow all others.
120
+
97
121
  tempArr.unshift('*');
98
122
  patterns[key] = tempArr;
99
123
  } else if (exclude[key].length > 0 && patterns[key].length > 0) {
@@ -101,6 +125,7 @@ function deprecationSupport(options, disableDeprecationWarning) {
101
125
  }
102
126
  });
103
127
  }
128
+
104
129
  handleRTL(options.app.rtlExclude, options.app.exclude.rtl, options.app.exclude.hasRTL, 'app');
105
130
  handleRTL(options.docs.rtlExclude, options.docs.exclude.rtl, options.docs.exclude.hasRTL, 'docs');
106
131
  addExcludesToPattern(options.app.patterns, options.app.exclude, 'app');