@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
@@ -4,25 +4,35 @@ 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
+
10
14
  var _fileHandling = require("../plugins/utils/fileHandling");
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 fs = require('fs');
19
+
13
20
  const options = (0, _utils.getOptions)();
14
21
  const defaultPostCssPluginOrder = ['valueReplacer', 'selectorReplace', 'hasRTL', 'hoverActive', 'combinerMediaQuery', 'cssVariableReplacement', 'selectorWeight', 'minifier', 'composeMinification'];
22
+
15
23
  function calculatePostCssPluginOrder(postCssPluginOrder, pluginOrder) {
16
24
  // if(typeof postCssPluginOrder === Boolean)
17
-
18
25
  if (Array.isArray(postCssPluginOrder)) {
19
26
  return postCssPluginOrder;
20
27
  }
28
+
21
29
  if (postCssPluginOrder) {
22
30
  return pluginOrder;
23
31
  }
32
+
24
33
  return defaultPostCssPluginOrder.filter(value => pluginOrder.includes(value));
25
34
  }
35
+
26
36
  const getCSSLoaders = optionsObj => {
27
37
  const {
28
38
  plugins,
@@ -53,23 +63,24 @@ const getCSSLoaders = optionsObj => {
53
63
  modules: {},
54
64
  sourceMap: true
55
65
  };
66
+
56
67
  if (classNameBlob) {
57
68
  cssLoaderOptions.modules.localIdentName = classNameBlob;
58
69
  } else {
59
70
  cssLoaderOptions.modules.getLocalIdent = (0, _cssClassNameGenerate.default)(cssUniqueness, cssHashSelectors, classNamePrefix, customClassNamePrefix, patterns, displayClassName);
60
71
  }
61
- const pluginOrder = calculatePostCssPluginOrder(postCssPluginOrder, Object.keys(plugins).filter(x => plugins[x] === true));
62
72
 
63
- // console.log('selector weight config : ', selectorWeightConfig);
73
+ const pluginOrder = calculatePostCssPluginOrder(postCssPluginOrder, Object.keys(plugins).filter(x => plugins[x] === true)); // console.log('selector weight config : ', selectorWeightConfig);
74
+
64
75
  const postcssPlugins = [plugins.valueReplacer && require('../postcss-plugins/ValueReplacer')(valueReplacer), plugins.hasRTL && require('@zohodesk/postcss-rtl')({
65
76
  addPrefixToSelector: function addPrefixToSelector(selector, prefix) {
66
77
  if (prefix === '[dir]') {
67
78
  return selector;
68
79
  }
80
+
69
81
  return `${prefix} ${selector}`; // Make selectors like [dir=rtl] > .selector
70
82
  }
71
- }), plugins.selectorReplace && require('../postcss-plugins/SelectorReplace')(selectorReplace), plugins.combinerMediaQuery && require('postcss-combine-media-query')(), plugins.hoverActive && require('../postcss-plugins/hoverActivePlugin')(mediaQueryHoverActiveString), plugins.cssVariableReplacement && fs.existsSync(cssVariableReplacementConfig) && require('../postcss-plugins/variableModificationPlugin/index').plugin(cssVariableReplacementConfig)
72
- // ,
83
+ }), plugins.selectorReplace && require('../postcss-plugins/SelectorReplace')(selectorReplace), plugins.combinerMediaQuery && require('postcss-combine-media-query')(), plugins.hoverActive && require('../postcss-plugins/hoverActivePlugin')(mediaQueryHoverActiveString), plugins.cssVariableReplacement && fs.existsSync(cssVariableReplacementConfig) && require('../postcss-plugins/variableModificationPlugin/index').plugin(cssVariableReplacementConfig) // ,
73
84
  // plugins.composeMinification &&
74
85
  // require('../postcss-plugins/composePlugin')()
75
86
  ].filter(Boolean);
@@ -94,7 +105,6 @@ const getCSSLoaders = optionsObj => {
94
105
  ident: 'postcss',
95
106
  plugins: function (params) {
96
107
  // console.log('check here : ', params.resourcePath);
97
-
98
108
  // getCSSLoaders for all postcss filtering
99
109
 
100
110
  /*
@@ -154,8 +164,8 @@ const getCSSLoaders = optionsObj => {
154
164
  filterObject: patterns,
155
165
  plugins: postcssPlugins,
156
166
  order: pluginOrder
157
- });
158
- // postcssPlugins that are allowed
167
+ }); // postcssPlugins that are allowed
168
+
159
169
  return finalPostcssPlugins.length > 0 ? finalPostcssPlugins : [require('../postcss-plugins/EmptyPlugin')()];
160
170
  }
161
171
  }
@@ -163,4 +173,6 @@ const getCSSLoaders = optionsObj => {
163
173
  loader: require.resolve('../loaders/composeLoader')
164
174
  } : null].filter(Boolean);
165
175
  };
166
- var _default = exports.default = getCSSLoaders;
176
+
177
+ var _default = getCSSLoaders;
178
+ exports.default = _default;
@@ -4,9 +4,13 @@ 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
  var _babelPresetReactOption = _interopRequireDefault(require("../babel/babel-option-utils/babel-preset-react-option"));
9
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
10
14
  let getDevJsLoaders = options => {
11
15
  let {
12
16
  app: {
@@ -20,11 +24,13 @@ let getDevJsLoaders = options => {
20
24
  }
21
25
  } = options;
22
26
  let loaders = [];
27
+
23
28
  if (instrumentScript) {
24
29
  loaders.push({
25
30
  loader: require.resolve('../loaders/scriptInstrumentLoader.js')
26
31
  });
27
32
  }
33
+
28
34
  loaders.push({
29
35
  loader: 'babel-loader',
30
36
  options: {
@@ -40,8 +46,7 @@ let getDevJsLoaders = options => {
40
46
  }], (0, _babelPresetReactOption.default)({
41
47
  disableES5Transpile
42
48
  }), enableTypeScript ? require.resolve('@babel/preset-typescript') : null].filter(Boolean),
43
- plugins: disableES5Transpile ? [require.resolve('@babel/plugin-syntax-dynamic-import'), require.resolve('babel-plugin-lodash'),
44
- // require.resolve('@babel/plugin-proposal-object-rest-spread'),
49
+ plugins: disableES5Transpile ? [require.resolve('@babel/plugin-syntax-dynamic-import'), require.resolve('babel-plugin-lodash'), // require.resolve('@babel/plugin-proposal-object-rest-spread'),
45
50
  devConsoleExculde ? [require.resolve('babel-plugin-transform-remove-console'), {
46
51
  exclude: ['error', 'log']
47
52
  }] : null].filter(Boolean) : [require.resolve('@babel/plugin-syntax-dynamic-import'), require.resolve('babel-plugin-lodash'), require.resolve('@babel/plugin-proposal-object-rest-spread'), devConsoleExculde ? [require.resolve('babel-plugin-transform-remove-console'), {
@@ -50,6 +55,7 @@ let getDevJsLoaders = options => {
50
55
  cacheDirectory: true
51
56
  }
52
57
  });
58
+
53
59
  if (enableEslint) {
54
60
  loaders.push({
55
61
  loader: 'eslint-loader',
@@ -60,6 +66,9 @@ let getDevJsLoaders = options => {
60
66
  }
61
67
  });
62
68
  }
69
+
63
70
  return loaders;
64
71
  };
65
- var _default = exports.default = getDevJsLoaders;
72
+
73
+ var _default = getDevJsLoaders;
74
+ 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"));
20
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
22
+
23
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -3,6 +3,7 @@
3
3
  const {
4
4
  windowsModificationFile
5
5
  } = require('../windowsModification');
6
+
6
7
  const tests = ['D:\\MyWork\\React Build\\desk_client_app\\jsapps\\supportapp\\src\\components\\Accessibility\\Accessibility.module.css', 'D:/MyWork/React Build/desk_client_app/jsapps/supportapp/src/components/Accessibility/Accessibility.module.css', 'desk_client_app\\jsapps\\supportapp\\src\\components\\Accessibility\\Accessibility.module.css', 'desk_client_app/jsapps/supportapp/src/components/Accessibility/Accessibility.module.css', 'src\\components\\Accessibility\\Accessibility.module.css', 'src/components/Accessibility/Accessibility.module.css', 'Accessibility.module.css', ''];
7
8
  tests.forEach(test => {
8
9
  console.log(windowsModificationFile(test));
@@ -6,10 +6,11 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.windowsModification = windowsModification;
7
7
  exports.windowsModificationFile = windowsModificationFile;
8
8
  const isWin = process.platform === 'win32';
9
+
9
10
  function windowsModification(array) {
10
11
  return isWin ? array && Array.isArray(array) && array.map(r => r.replace(/\//g, '\\')) : array;
11
12
  }
13
+
12
14
  function windowsModificationFile(filename) {
13
15
  return isWin ? filename.replace(/\//g, '\\') : filename;
14
- }
15
- // module.exports = { windowsModification, windowsModificationFile };
16
+ } // module.exports = { windowsModification, windowsModificationFile };
@@ -4,6 +4,7 @@ const {
4
4
  markdownParser
5
5
  } = require('../markdownLoader'); // Replace './your-file' with the correct file path
6
6
 
7
+
7
8
  describe('markdownParser', () => {
8
9
  test('For {}(braces) case', () => {
9
10
  const source = `
@@ -1,12 +1,19 @@
1
1
  "use strict";
2
2
 
3
3
  var _path = _interopRequireDefault(require("path"));
4
+
4
5
  var _postcss = _interopRequireDefault(require("postcss"));
6
+
5
7
  var _classHandling = require("../../lib/plugins/utils/classHandling");
8
+
6
9
  var _fileHandling = require("../plugins/utils/fileHandling");
10
+
7
11
  var _utils = require("../utils");
12
+
8
13
  var _ignore = _interopRequireDefault(require("ignore"));
9
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
+
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+
10
17
  const supportedProps = ['margin-top', 'margin-bottom', 'margin-left', 'margin-right', 'margin', 'padding-top', 'padding-bottom', 'padding-left', 'padding-right', 'padding', 'top', 'bottom', 'left', 'right', 'height', 'width', 'min-height', 'min-width', 'max-height', 'max-width', 'float', 'overflow', 'position', 'display', 'text-align', 'white-space', 'visibility'];
11
18
  const renameProps = {
12
19
  position: {
@@ -115,37 +122,46 @@ const renameProps = {
115
122
  neg: 'maxw_'
116
123
  }
117
124
  };
125
+
118
126
  function objToClassName(prop, data) {
119
127
  return renameProps[prop] ? data < 0 ? renameProps[prop].neg ? `${renameProps[prop].neg}${data * -1}` : `undef${data * -1}` : renameProps[prop].pos ? `${renameProps[prop].pos}${data}` : `undef${data}` : `undef${data}`;
120
128
  }
129
+
121
130
  function objtoClassNameString(prop, data) {
122
131
  let temp = data.toString().replace(/-/gi, '');
123
132
  return `${renameProps[prop].cls}_${temp.replace(/\s*/gi, '')}`;
124
133
  }
134
+
125
135
  const multipleClassName = {
126
136
  margin: ['margin-top', 'margin-right', 'margin-bottom', 'margin-left'],
127
137
  padding: ['padding-top', 'padding-right', 'padding-bottom', 'padding-left']
128
138
  };
139
+
129
140
  function objToClassNameMultiple(prop, data) {
130
141
  data = data.trim().replace(/\s+/gi, ' ');
131
142
  let dataArr = data.split(' ');
143
+
132
144
  if (dataArr.length === 3) {
133
145
  dataArr[3] = dataArr[1];
134
146
  }
147
+
135
148
  if (dataArr.length === 2) {
136
149
  dataArr[3] = dataArr[1];
137
150
  dataArr[2] = dataArr[0];
138
151
  }
152
+
139
153
  if (dataArr.length === 1) {
140
154
  dataArr[3] = dataArr[0];
141
155
  dataArr[2] = dataArr[0];
142
156
  dataArr[1] = dataArr[0];
143
157
  }
158
+
144
159
  let composeClasses = '';
145
160
  dataArr.forEach((data, index) => composeClasses += `${objToClassName(multipleClassName[prop][index], parseInt(data, 10))} `);
146
161
  composeClasses = composeClasses.substring(0, composeClasses.length - 1);
147
162
  return composeClasses;
148
163
  }
164
+
149
165
  const commonFilePath = {
150
166
  margin: 'src/common/css/margin.css',
151
167
  'margin-left': 'src/common/css/margin.css',
@@ -177,11 +193,12 @@ const commonFilePath = {
177
193
  'white-space': 'src/common/css/textProps.css',
178
194
  visibility: 'src/common/css/textProps.css'
179
195
  };
196
+
180
197
  function generateComposeString(resourcePath, prop, value) {
181
- let composeString = `from "${_path.default.relative(_path.default.parse(resourcePath).dir,
182
- // resourcePath
198
+ let composeString = `from "${_path.default.relative(_path.default.parse(resourcePath).dir, // resourcePath
183
199
  commonFilePath[prop]).replace(/\\/gi, '/')}"`;
184
200
  let cls = '';
201
+
185
202
  if (/^position|^overflow|^display|^float|^text-align|^white-space|^visibility/gi.test(prop)) {
186
203
  console.log(prop, value, 'textvals');
187
204
  cls = objtoClassNameString(prop, value);
@@ -192,10 +209,10 @@ function generateComposeString(resourcePath, prop, value) {
192
209
  // console.log(prop, value, 'common');
193
210
  cls = objToClassName(prop, parseInt(value));
194
211
  }
212
+
195
213
  composeString = `${cls} ${composeString}`;
196
214
  return composeString;
197
- }
198
- // const preNames = {
215
+ } // const preNames = {
199
216
  // height: 'zd-height-',
200
217
  // 'max-height': 'zd-height-',
201
218
  // 'min-height': 'zd-height-',
@@ -215,60 +232,67 @@ function generateComposeString(resourcePath, prop, value) {
215
232
  // 'margin-left': 'zd-margin-',
216
233
  // 'margin-right': 'zd-margin-'
217
234
  // };
235
+
236
+
218
237
  function allowParent(rule) {
219
238
  return rule.parent.type === 'root' || rule.parent.type === 'atrule' && rule.parent.name === 'media';
220
239
  }
240
+
221
241
  module.exports = function (source) {
222
242
  const {
223
243
  resourcePath
224
244
  } = this;
225
- const options = (0, _utils.getOptions)();
226
- // console.log(options.app.patterns.composeMinification);
245
+ const options = (0, _utils.getOptions)(); // console.log(options.app.patterns.composeMinification);
227
246
  // const ig = ignore({ allowRelativePaths: true }).add(options.app.patterns.composeMinification);
228
247
  // const newFilename = path.relative(path.parse(process.cwd()).base, resourcePath);
229
248
  // console.log(newFilename, ig.ignores(newFilename));
230
249
 
231
250
  let root = _postcss.default.parse(source);
251
+
232
252
  if (!(0, _fileHandling.isFileNameMatchingPluginPattern)({
233
253
  filename: resourcePath,
234
254
  filterArr: options.app.patterns.composeMinification
235
255
  })) {
236
256
  return root.toString();
237
257
  }
258
+
238
259
  root.walkRules(rule => {
239
260
  rule.walkDecls(decl => {
240
261
  if (/^-ms|^-webkit|^moz/gi.test(decl.prop)) {
241
262
  return;
242
263
  }
264
+
243
265
  if (!allowParent(rule)) {
244
266
  return;
245
267
  }
268
+
246
269
  if ((0, _classHandling.isInsideMediaQuery)(rule)) {
247
270
  console.log('inside media query', rule.selector);
248
271
  return;
249
272
  }
273
+
250
274
  if (supportedProps.includes(decl.prop) && /^position$|^overflow|^float|^display|^text-align|^white-space|^visibility/gi.test(decl.prop) && !/[,\s+]+|(\w+)\.|:|::|body|(\d+)%|>/gi.test(rule.selector) && commonFilePath[decl.prop] && !decl.value.includes('var(--')) {
251
275
  decl.value = generateComposeString(resourcePath, decl.prop, decl.value);
252
276
  decl.prop = 'composes';
253
277
  return;
254
278
  }
279
+
255
280
  if (supportedProps.includes(decl.prop) && /px$/gi.test(decl.value) && !/^--/gi.test(decl.prop) && commonFilePath[decl.prop] && !decl.value.includes('calc') && !/[,\s+]+|(\w+)\.|:|(\d+)%/gi.test(rule.selector)) {
256
281
  // n++ < 10 && console.log(composeString);
257
282
  // if (!composeString.includes('src')) {
258
283
  // if (/px$/gi.test(decl.value)) {
259
- decl.value = generateComposeString(resourcePath, decl.prop, decl.value);
260
- // }
284
+ decl.value = generateComposeString(resourcePath, decl.prop, decl.value); // }
261
285
  // if (/^position$|^display$|^overflow$|^float$/gi.test(decl.prop)) {
262
286
  // console.log(decl.prop);
263
287
  // }
264
- decl.prop = 'composes';
265
- // console.log(decl.prop, decl.value);
288
+
289
+ decl.prop = 'composes'; // console.log(decl.prop, decl.value);
266
290
  // n < 10 && console.log(rule.selector, decl.prop, decl.value);
267
291
  // }
268
292
  }
269
293
  });
270
294
  });
271
- const output = root.toString();
272
- // console.log(output);
295
+ const output = root.toString(); // console.log(output);
296
+
273
297
  return output;
274
298
  };
@@ -1,22 +1,33 @@
1
1
  "use strict";
2
2
 
3
3
  var _fs = _interopRequireDefault(require("fs"));
4
+
4
5
  var _getOptions = _interopRequireDefault(require("../utils/getOptions.js"));
6
+
5
7
  var _path = _interopRequireDefault(require("path"));
8
+
6
9
  var _enhancedReactLiveConverter = require("./enhancedReactLiveConverter.js");
10
+
7
11
  var _markdownLoader = require("./markdownLoader.js");
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+
9
15
  module.exports = function (source) {
10
16
  const comNameAry = this.resourcePath.split(_path.default.sep);
11
17
  const filePath = this.resourcePath;
18
+
12
19
  const appPath = _fs.default.realpathSync(process.cwd());
20
+
13
21
  const changePath = filePath.replace('/lib/', '/src/');
14
22
  const comName = comNameAry[comNameAry.length - 1];
15
23
  const name = comName.substring(0, comName.lastIndexOf('.'));
16
24
  const options = (0, _getOptions.default)();
17
25
  const originalFilePath = filePath.startsWith(appPath) ? filePath : changePath;
26
+
18
27
  const src = _fs.default.readFileSync(originalFilePath).toString();
28
+
19
29
  options.docs.enableMDParser && (source = (0, _markdownLoader.markdownParser)(source));
20
30
  options.docs.enableReactLive && (source = (0, _enhancedReactLiveConverter.enhancedReactLiveConverter)(source, originalFilePath)); //to Enable the ReactLive Converter
31
+
21
32
  return `${source};${name}.source=${JSON.stringify(src)};${name}.filePath=${JSON.stringify(filePath)}`;
22
33
  };
@@ -1,21 +1,25 @@
1
1
  "use strict";
2
2
 
3
3
  var _reactDocgen = _interopRequireDefault(require("react-docgen"));
4
+
4
5
  var _path = _interopRequireDefault(require("path"));
6
+
5
7
  var _utils = require("../utils");
6
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
7
- // import loaderUtils from 'loader-utils';
8
8
 
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+
11
+ // import loaderUtils from 'loader-utils';
9
12
  module.exports = source => {
10
- (void 0).cacheable && (void 0).cacheable();
11
- // let query = loaderUtils.parseQuery(this.query);
13
+ (void 0).cacheable && (void 0).cacheable(); // let query = loaderUtils.parseQuery(this.query);
12
14
 
13
15
  let value = {};
16
+
14
17
  try {
15
18
  value = _reactDocgen.default.parse(source);
16
19
  } catch (e) {
17
20
  (0, _utils.log)('ERROR in docgen-loader', e);
18
21
  }
22
+
19
23
  let comNameAry = (void 0).resourcePath.split(_path.default.sep);
20
24
  let comName = comNameAry[comNameAry.length - 1];
21
25
  let name = comName.substring(0, comName.lastIndexOf('.'));
@@ -4,14 +4,20 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.enhancedReactLiveConverter = enhancedReactLiveConverter;
7
+
7
8
  const parser = require('@babel/parser');
9
+
8
10
  const traverse = require('@babel/traverse').default;
11
+
9
12
  const t = require("@babel/types");
13
+
10
14
  const path = require('path');
15
+
11
16
  function getFilename(originalFilePath) {
12
17
  const [fileName] = path.basename(originalFilePath).split('.');
13
18
  return fileName;
14
19
  }
20
+
15
21
  function convertKeyToValue(object = {}) {
16
22
  let keys = Object.keys(object);
17
23
  let values = Object.values(object);
@@ -20,16 +26,20 @@ function convertKeyToValue(object = {}) {
20
26
  item = item.replace(/{|}/g, "");
21
27
  item = '{ ' + item + ' }';
22
28
  }
29
+
23
30
  value = value + "'" + values[i] + "'" + ": " + item + ",";
24
31
  return value;
25
32
  }, '');
26
33
  }
34
+
27
35
  function mergeDuplicateValues(obj) {
28
36
  let mergedObj = {};
37
+
29
38
  for (let key in obj) {
30
39
  if (obj.hasOwnProperty(key)) {
31
40
  let value = obj[key];
32
41
  let existingKey = Object.keys(mergedObj).find(k => mergedObj[k] === value);
42
+
33
43
  if (existingKey) {
34
44
  mergedObj[existingKey + ' , ' + key] = value;
35
45
  delete mergedObj[existingKey];
@@ -38,33 +48,40 @@ function mergeDuplicateValues(obj) {
38
48
  }
39
49
  }
40
50
  }
51
+
41
52
  return mergedObj;
42
53
  }
54
+
43
55
  function enhancedReactLiveConverter(source, originalFilePath) {
44
56
  const fileName = getFilename(originalFilePath);
57
+
45
58
  if (!source) {
46
59
  return '';
47
60
  }
61
+
48
62
  let docCode = '';
49
63
  const fileContent = source.replace(/[\s\r\n]*$/, '');
50
64
  const ast = parser.parse(fileContent, {
51
65
  sourceType: 'module',
52
66
  plugins: ['jsx', 'classProperties']
53
67
  });
68
+
54
69
  function createImportStatements(input) {
55
70
  let output = '';
71
+
56
72
  for (const key in input) {
57
73
  if (input.hasOwnProperty(key) && key !== 'React') {
58
74
  output += `import ${key} from '${input[key]}';\n`;
59
75
  }
60
76
  }
77
+
61
78
  return output;
62
79
  }
80
+
63
81
  const importBlock = {};
64
82
  const printableCode = {};
65
- let remainingBlock = '';
83
+ let remainingBlock = ''; // Traverse the AST and find the import and export blocks
66
84
 
67
- // Traverse the AST and find the import and export blocks
68
85
  let remainingCode = ast.program.body.filter(node => node.type !== 'ImportDeclaration').filter(node => node.type !== 'ExpressionStatement').map(node => fileContent.substring(node.start, node.end)).join('').trim();
69
86
  traverse(ast, {
70
87
  ImportDeclaration(path) {
@@ -80,11 +97,14 @@ function enhancedReactLiveConverter(source, originalFilePath) {
80
97
  }
81
98
  }).join(", ");
82
99
  },
100
+
83
101
  ExpressionStatement(path) {
84
102
  const expression = path.get('expression');
85
103
  const expressionLeft = expression.get('left');
104
+
86
105
  if (path.isExpressionStatement() && expression.isAssignmentExpression() && expressionLeft.isMemberExpression()) {
87
106
  const docCheck = expressionLeft.toString();
107
+
88
108
  if (docCheck === `${fileName}.docs`) {
89
109
  docCode = expression.toString();
90
110
  } else if (docCheck.includes(fileName)) {
@@ -94,6 +114,7 @@ function enhancedReactLiveConverter(source, originalFilePath) {
94
114
  }
95
115
  }
96
116
  }
117
+
97
118
  });
98
119
  remainingCode = remainingCode.replace(/__DOCS__/, true);
99
120
  remainingCode = remainingCode.replace(/`/g, '\\`').replace(/\$\{/g, '$\\{');
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
 
3
3
  var _path = _interopRequireDefault(require("path"));
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
  module.exports = function (source) {
6
8
  const {
7
9
  rootContext,
@@ -1,55 +1,64 @@
1
1
  "use strict";
2
2
 
3
3
  var _path = _interopRequireDefault(require("path"));
4
+
4
5
  var _loaderUtils = _interopRequireDefault(require("loader-utils"));
6
+
5
7
  var _common = require("../common");
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
  module.exports = function (content) {
8
12
  let {
9
13
  userRequest
10
14
  } = this._module.issuer;
11
15
  this.cacheable && this.cacheable();
16
+
12
17
  if (!this.emitFile) {
13
18
  throw new Error('emitFile is required from module system');
14
19
  }
15
- let options = _loaderUtils.default.getOptions(this) || {};
16
- let query = this.resourceQuery ? _loaderUtils.default.parseQuery(this.resourceQuery) : {};
17
20
 
18
- // let configKey = query.config || 'fileLoader';
21
+ let options = _loaderUtils.default.getOptions(this) || {};
22
+ let query = this.resourceQuery ? _loaderUtils.default.parseQuery(this.resourceQuery) : {}; // let configKey = query.config || 'fileLoader';
19
23
 
20
24
  let config = {
21
25
  // publicPath: false,
22
26
  useRelativePath: false,
23
- name: '[hash].[ext]'
24
- // publicPathStrigify: true
25
- };
27
+ name: '[hash].[ext]' // publicPathStrigify: true
28
+
29
+ }; // options takes precedence over config
26
30
 
27
- // options takes precedence over config
28
31
  Object.keys(options).forEach(attr => {
29
32
  config[attr] = options[attr];
30
- });
33
+ }); // query takes precedence over config and options
31
34
 
32
- // query takes precedence over config and options
33
35
  Object.keys(query).forEach(attr => {
34
36
  config[attr] = query[attr];
35
37
  });
36
38
  let context = config.context || options.context;
39
+
37
40
  let url = _loaderUtils.default.interpolateName(this, config.name, {
38
41
  context: context,
39
42
  content: content,
40
43
  regExp: config.regExp
41
44
  });
45
+
42
46
  let outputPath = '';
43
47
  let filePath = this.resourcePath;
48
+
44
49
  if (config.useRelativePath) {
45
50
  let issuerContext = this._module && this._module.issuer && this._module.issuer.context || context;
51
+
46
52
  let relativeUrl = issuerContext && _path.default.relative(issuerContext, filePath).split(_path.default.sep).join('/');
53
+
47
54
  let relativePath = relativeUrl && `${_path.default.dirname(relativeUrl)}/`;
55
+
48
56
  if (~relativePath.indexOf('../')) {
49
57
  outputPath = _path.default.posix.join(outputPath, relativePath, url);
50
58
  } else {
51
59
  outputPath = relativePath + url;
52
60
  }
61
+
53
62
  url = relativePath + url;
54
63
  } else if (config.outputPath) {
55
64
  // support functions as outputPath to generate them dynamically
@@ -58,9 +67,9 @@ module.exports = function (content) {
58
67
  } else {
59
68
  outputPath = url;
60
69
  }
70
+
61
71
  let requestFromJS = /\.js$/.test(userRequest);
62
- let publicPath = requestFromJS ? (0, _common.getPublicPathConfig)(url) : `__webpack_public_path__ + ${JSON.stringify(url)}`;
63
- // if (config.publicPath !== false) {
72
+ let publicPath = requestFromJS ? (0, _common.getPublicPathConfig)(url) : `__webpack_public_path__ + ${JSON.stringify(url)}`; // if (config.publicPath !== false) {
64
73
  // // support functions as publicPath to generate them dynamically
65
74
  // if (config.publicPathStringify) {
66
75
  // publicPath = JSON.Stringify(
@@ -79,6 +88,8 @@ module.exports = function (content) {
79
88
  if (query.emitFile === undefined || query.emitFile) {
80
89
  this.emitFile(outputPath, content);
81
90
  }
91
+
82
92
  return `module.exports = ${publicPath};`;
83
93
  };
94
+
84
95
  module.exports.raw = true;