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

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 (221) hide show
  1. package/lib/babel/babel-option-utils/babel-preset-react-option.js +0 -3
  2. package/lib/babel/cmjs-plugins-presets.js +1 -8
  3. package/lib/babel/es-plugins-presets.js +1 -8
  4. package/lib/common/buildEs.js +1 -0
  5. package/lib/common/getEntries.js +2 -13
  6. package/lib/common/getPublicPathConfig.js +0 -6
  7. package/lib/common/index.js +1 -6
  8. package/lib/common/runPreProcess.js +6 -15
  9. package/lib/common/splitChunks.js +2 -21
  10. package/lib/common/sslcertUpdater.js +7 -18
  11. package/lib/common/templateParameters.js +0 -2
  12. package/lib/common/testPattern.js +10 -21
  13. package/lib/common/valueReplacer.js +1 -16
  14. package/lib/configs/jest.config.js +1 -10
  15. package/lib/configs/libAlias.js +8 -14
  16. package/lib/configs/resolvers.js +4 -14
  17. package/lib/configs/webpack.component.umd.config.js +1 -6
  18. package/lib/configs/webpack.css.umd.config.js +6 -14
  19. package/lib/configs/webpack.dev.config.js +1 -14
  20. package/lib/configs/webpack.docs.config.js +1 -9
  21. package/lib/configs/webpack.impact.config.js +1 -8
  22. package/lib/configs/webpack.prod.config.js +4 -17
  23. package/lib/constants.js +9 -18
  24. package/lib/deprecationLogger.js +0 -7
  25. package/lib/hooks/docsProptypeHook.js +4 -8
  26. package/lib/jest/commitedFilesResult.js +4 -46
  27. package/lib/jest/coverageCollector.js +1 -12
  28. package/lib/jest/jsonMaker.js +0 -6
  29. package/lib/jest/preProcessors/cssPreprocessor.js +1 -9
  30. package/lib/jest/preProcessors/jsPreprocessor.js +1 -6
  31. package/lib/jest/preProcessors/otherFilesPreprocessor.js +1 -4
  32. package/lib/jest/result.js +1 -23
  33. package/lib/jest/run.js +7 -18
  34. package/lib/jest/setup.js +8 -60
  35. package/lib/loaderUtils/configsAssetsLoaders.js +2 -12
  36. package/lib/loaderUtils/getCSSLoaders.js +10 -22
  37. package/lib/loaderUtils/getDevJsLoaders.js +4 -13
  38. package/lib/loaderUtils/index.js +1 -4
  39. package/lib/loaderUtils/tests/windowsModification.test.js +0 -1
  40. package/lib/loaderUtils/windowsModification.js +2 -3
  41. package/lib/loaders/__test__/markdownLoader.spec.js +0 -1
  42. package/lib/loaders/composeLoader.js +13 -37
  43. package/lib/loaders/docsLoader.js +1 -12
  44. package/lib/loaders/docsPropsLoader.js +4 -8
  45. package/lib/loaders/enhancedReactLiveConverter.js +2 -23
  46. package/lib/loaders/fileBountryLoader.js +1 -3
  47. package/lib/loaders/fileLoader.js +12 -23
  48. package/lib/loaders/markdownLoader.js +14 -19
  49. package/lib/loaders/reactLiveConvertor.js +5 -15
  50. package/lib/loaders/scriptInstrumentLoader.js +7 -16
  51. package/lib/loaders/selectorMappingLoader.js +7 -26
  52. package/lib/loaders/workerLoader.js +9 -24
  53. package/lib/logger.js +0 -4
  54. package/lib/middlewares/HMRMiddleware.js +13 -27
  55. package/lib/middlewares/SSTMiddleware.js +1 -5
  56. package/lib/pluginUtils/configHtmlWebpackPlugins.js +1 -24
  57. package/lib/pluginUtils/getDevPlugins.js +9 -42
  58. package/lib/pluginUtils/getDocsPlugins.js +3 -13
  59. package/lib/pluginUtils/getLibraryImactPlugins.js +5 -6
  60. package/lib/pluginUtils/getLibraryPlugins.js +2 -8
  61. package/lib/pluginUtils/getProdPlugins.js +8 -47
  62. package/lib/pluginUtils/getServerPlugins.js +2 -8
  63. package/lib/pluginUtils/getUMDCSSPlugins.js +2 -10
  64. package/lib/pluginUtils/getUMDComponentPlugins.js +2 -10
  65. package/lib/pluginUtils/index.js +1 -9
  66. package/lib/plugins/CdnChangePlugin.js +2 -18
  67. package/lib/plugins/CleanupStatsPlugin.js +0 -5
  68. package/lib/plugins/CssOrderControlPlugin.js +3 -6
  69. package/lib/plugins/CustomAttributePlugin.js +14 -19
  70. package/lib/plugins/CustomScriptLoadingStrategyPlugin.js +3 -23
  71. package/lib/plugins/EFCPlugin.js +20 -34
  72. package/lib/plugins/EFCTemplatePlugin.js +19 -30
  73. package/lib/plugins/EfcResourceCleanupPlugin.js +0 -3
  74. package/lib/plugins/EventsHandlingPlugin.js +2 -4
  75. package/lib/plugins/I18NInjectIntoIndexPlugin.js +11 -37
  76. package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +10 -15
  77. package/lib/plugins/I18nSplitPlugin/I18nDependency.js +4 -10
  78. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +12 -25
  79. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +55 -133
  80. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +12 -23
  81. package/lib/plugins/I18nSplitPlugin/index.js +13 -24
  82. package/lib/plugins/I18nSplitPlugin/utils/applyMetaManifest.js +64 -58
  83. package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +2 -12
  84. package/lib/plugins/I18nSplitPlugin/utils/createMetaManifest.js +10 -29
  85. package/lib/plugins/I18nSplitPlugin/utils/createRegularManifest.js +8 -19
  86. package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +0 -1
  87. package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +0 -5
  88. package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +1 -8
  89. package/lib/plugins/I18nSplitPlugin/utils/index.js +0 -4
  90. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +0 -20
  91. package/lib/plugins/I18nSplitPlugin/utils/unicodeConversion.js +0 -1
  92. package/lib/plugins/ManifestPlugin.js +1 -18
  93. package/lib/plugins/MinifyPlugin.js +1 -10
  94. package/lib/plugins/ModuleStatsPlugin.js +1 -24
  95. package/lib/plugins/OptimizeJSPlugin.js +2 -10
  96. package/lib/plugins/PublicPathCallbackPlugin.js +1 -12
  97. package/lib/plugins/PublicPathChangePlugin.js +6 -39
  98. package/lib/plugins/ReportGeneratePlugin.js +5 -32
  99. package/lib/plugins/RequireVariablePublicPlugin.js +1 -8
  100. package/lib/plugins/ResourceHintsPlugin.js +4 -13
  101. package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +12 -17
  102. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +10 -17
  103. package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +2 -5
  104. package/lib/plugins/ScriptInstrumentPlugin.js +1 -8
  105. package/lib/plugins/SelectorPlugin.js +6 -32
  106. package/lib/plugins/ServiceWorkerPlugin.js +5 -22
  107. package/lib/plugins/ShadowDOMSupportPlugin.js +4 -41
  108. package/lib/plugins/SourceMapHookPlugin.js +2 -12
  109. package/lib/plugins/StatsPlugin.js +0 -14
  110. package/lib/plugins/TPHashMappingPlugin.js +3 -18
  111. package/lib/plugins/UnusedFilesFindPlugin.js +4 -39
  112. package/lib/plugins/VariableConversionCollector.js +15 -42
  113. package/lib/plugins/index.js +1 -20
  114. package/lib/plugins/libraryImpactPlugin.js +1 -33
  115. package/lib/plugins/newi18nsplitplugin/18nPlugin1.js +306 -0
  116. package/lib/plugins/newi18nsplitplugin/18nPlugin2.js +363 -0
  117. package/lib/plugins/newi18nsplitplugin/18nPlugin3.js +694 -0
  118. package/lib/plugins/newi18nsplitplugin/18nPlugin_hashed.js +1258 -0
  119. package/lib/plugins/newi18nsplitplugin/18nPlugin_working.js +542 -0
  120. package/lib/plugins/newi18nsplitplugin/18nplugin.js +974 -0
  121. package/lib/plugins/newi18nsplitplugin/ChunkManager.js +131 -0
  122. package/lib/plugins/newi18nsplitplugin/GenerateModuleIdToKeysMapPlugin.js +59 -0
  123. package/lib/plugins/newi18nsplitplugin/I18nDiffPlugin.js +262 -0
  124. package/lib/plugins/newi18nsplitplugin/I18nDownloadLogic.js +166 -0
  125. package/lib/plugins/newi18nsplitplugin/I18nPropertiesPlugin.js +111 -0
  126. package/lib/plugins/newi18nsplitplugin/KeyCollector.js +163 -0
  127. package/lib/plugins/newi18nsplitplugin/ManifestGenerator.js +88 -0
  128. package/lib/plugins/newi18nsplitplugin/UnicodeConversionPlugin.js +101 -0
  129. package/lib/plugins/newi18nsplitplugin/constants.js +162 -0
  130. package/lib/plugins/newi18nsplitplugin/utils/I18nKeyHasher.js +78 -0
  131. package/lib/plugins/newi18nsplitplugin/utils/getJsResourceKeys.js +22 -0
  132. package/lib/plugins/newi18nsplitplugin/utils/i18nChunkUtils.js +18 -0
  133. package/lib/plugins/newi18nsplitplugin/utils/manifestGenerator.js +580 -0
  134. package/lib/plugins/newi18nsplitplugin/utils/propertiesUtils.js +54 -0
  135. package/lib/plugins/utils/classHandling.js +0 -6
  136. package/lib/plugins/utils/fileHandling.js +6 -15
  137. package/lib/plugins/utils/tests/fileHandling.test.js +0 -4
  138. package/lib/plugins/variableConvertorUtils.js +14 -29
  139. package/lib/plugins/webpackwatchrunplugin.js +0 -5
  140. package/lib/postcss-plugins/EmptyPlugin.js +3 -4
  141. package/lib/postcss-plugins/ExcludePlugin.js +1 -5
  142. package/lib/postcss-plugins/IncludePlugin.js +1 -5
  143. package/lib/postcss-plugins/RTLSplitPlugin.js +14 -27
  144. package/lib/postcss-plugins/SelectorReplace.js +1 -16
  145. package/lib/postcss-plugins/ValueReplacer.js +7 -6
  146. package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +0 -3
  147. package/lib/postcss-plugins/__test__/selectorReplace.test.js +6 -3
  148. package/lib/postcss-plugins/__test__/valueReplacer.spec.js +2 -5
  149. package/lib/postcss-plugins/hoverActivePlugin.js +31 -67
  150. package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +0 -7
  151. package/lib/postcss-plugins/variableModificationPlugin/index.js +28 -49
  152. package/lib/schemas/index.js +3 -9
  153. package/lib/servers/clusterHubServer.js +1 -11
  154. package/lib/servers/devBuild.js +14 -26
  155. package/lib/servers/docsServer.js +1 -3
  156. package/lib/servers/docsServerCore.js +1 -22
  157. package/lib/servers/getCliPath.js +0 -9
  158. package/lib/servers/helpServer.js +1 -6
  159. package/lib/servers/httpsOptions.js +2 -8
  160. package/lib/servers/impactServer.js +3 -35
  161. package/lib/servers/mockserver.js +1 -10
  162. package/lib/servers/nowatchserver.js +12 -37
  163. package/lib/servers/requireLocalOrGlobal.js +6 -17
  164. package/lib/servers/scrServer.js +14 -21
  165. package/lib/servers/server.js +6 -36
  166. package/lib/servers/ssServer.js +1 -17
  167. package/lib/templates/CoverageScriptTemplate.js +0 -14
  168. package/lib/templates/WMSTemplate.js +7 -13
  169. package/lib/templates/linterConstant.js +2 -4
  170. package/lib/utils/babelPresets.js +3 -7
  171. package/lib/utils/clean.js +3 -9
  172. package/lib/utils/copy.js +1 -7
  173. package/lib/utils/copyTimezones.js +1 -9
  174. package/lib/utils/createEventStream.js +1 -6
  175. package/lib/utils/cssClassNameGenerate.js +10 -30
  176. package/lib/utils/cssURLReplacer.js +1 -22
  177. package/lib/utils/dependencyPostPublish.js +1 -10
  178. package/lib/utils/deprecationSupport.js +7 -32
  179. package/lib/utils/fileUtils.js +1 -28
  180. package/lib/utils/folderIterator.js +2 -13
  181. package/lib/utils/getComponents.js +0 -21
  182. package/lib/utils/getCurrentBranch.js +0 -5
  183. package/lib/utils/getDependenciesImpactList.js +1 -22
  184. package/lib/utils/getFileType.js +2 -10
  185. package/lib/utils/getHash.js +1 -8
  186. package/lib/utils/getIp.js +0 -2
  187. package/lib/utils/getOptions.js +16 -53
  188. package/lib/utils/getServerURL.js +1 -10
  189. package/lib/utils/index.js +4 -51
  190. package/lib/utils/init.js +0 -1
  191. package/lib/utils/initPreCommitHook.js +7 -30
  192. package/lib/utils/jsonHelper.js +3 -22
  193. package/lib/utils/libraryImpactConfig.js +2 -5
  194. package/lib/utils/lint/addScripts.js +2 -5
  195. package/lib/utils/lint/checkExistingConfig.js +3 -12
  196. package/lib/utils/lint/copyConfigs.js +0 -3
  197. package/lib/utils/lint/index.js +0 -9
  198. package/lib/utils/lint/lintScripts.js +0 -1
  199. package/lib/utils/lint/lintSetup.js +3 -4
  200. package/lib/utils/lint/lintStagedPreCommitHook.js +0 -1
  201. package/lib/utils/lint/question.js +0 -7
  202. package/lib/utils/lintReporter.js +0 -20
  203. package/lib/utils/log.js +0 -1
  204. package/lib/utils/mailSender.js +1 -8
  205. package/lib/utils/object-manipulation.js +1 -17
  206. package/lib/utils/pullOrigin.js +0 -4
  207. package/lib/utils/reinstallDependencies.js +1 -29
  208. package/lib/utils/removeAttributes.js +1 -8
  209. package/lib/utils/repoClone.js +3 -28
  210. package/lib/utils/request.js +0 -12
  211. package/lib/utils/rtl.js +5 -17
  212. package/lib/utils/selectorReplacer.js +10 -16
  213. package/lib/utils/setEnvVariables.js +0 -2
  214. package/lib/utils/ssTestHack.js +1 -11
  215. package/lib/utils/switchBranch.js +0 -5
  216. package/lib/utils/typeCheck.js +0 -1
  217. package/lib/utils/urlConcat.js +0 -4
  218. package/lib/utils/useExitCleanup.js +9 -10
  219. package/lib/utils/variableConverter.js +22 -31
  220. package/{npm-shrinkwrap.json → package-lock.json} +2098 -1999
  221. package/package.json +1 -1
@@ -15,9 +15,6 @@ Object.defineProperty(exports, "getDevJsLoaders", {
15
15
  return _getDevJsLoaders.default;
16
16
  }
17
17
  });
18
-
19
18
  var _getDevJsLoaders = _interopRequireDefault(require("./getDevJsLoaders"));
20
-
21
19
  var _getCSSLoaders = _interopRequireDefault(require("./getCSSLoaders"));
22
-
23
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -3,7 +3,6 @@
3
3
  const {
4
4
  windowsModificationFile
5
5
  } = require('../windowsModification');
6
-
7
6
  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', ''];
8
7
  tests.forEach(test => {
9
8
  console.log(windowsModificationFile(test));
@@ -6,11 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.windowsModification = windowsModification;
7
7
  exports.windowsModificationFile = windowsModificationFile;
8
8
  const isWin = process.platform === 'win32';
9
-
10
9
  function windowsModification(array) {
11
10
  return isWin ? array && Array.isArray(array) && array.map(r => r.replace(/\//g, '\\')) : array;
12
11
  }
13
-
14
12
  function windowsModificationFile(filename) {
15
13
  return isWin ? filename.replace(/\//g, '\\') : filename;
16
- } // module.exports = { windowsModification, windowsModificationFile };
14
+ }
15
+ // module.exports = { windowsModification, windowsModificationFile };
@@ -4,7 +4,6 @@ const {
4
4
  markdownParser
5
5
  } = require('../markdownLoader'); // Replace './your-file' with the correct file path
6
6
 
7
-
8
7
  describe('markdownParser', () => {
9
8
  test('For {}(braces) case', () => {
10
9
  const source = `
@@ -1,19 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _path = _interopRequireDefault(require("path"));
4
-
5
4
  var _postcss = _interopRequireDefault(require("postcss"));
6
-
7
5
  var _classHandling = require("../../lib/plugins/utils/classHandling");
8
-
9
6
  var _fileHandling = require("../plugins/utils/fileHandling");
10
-
11
7
  var _utils = require("../utils");
12
-
13
8
  var _ignore = _interopRequireDefault(require("ignore"));
14
-
15
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
-
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
10
  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'];
18
11
  const renameProps = {
19
12
  position: {
@@ -122,46 +115,37 @@ const renameProps = {
122
115
  neg: 'maxw_'
123
116
  }
124
117
  };
125
-
126
118
  function objToClassName(prop, data) {
127
119
  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}`;
128
120
  }
129
-
130
121
  function objtoClassNameString(prop, data) {
131
122
  let temp = data.toString().replace(/-/gi, '');
132
123
  return `${renameProps[prop].cls}_${temp.replace(/\s*/gi, '')}`;
133
124
  }
134
-
135
125
  const multipleClassName = {
136
126
  margin: ['margin-top', 'margin-right', 'margin-bottom', 'margin-left'],
137
127
  padding: ['padding-top', 'padding-right', 'padding-bottom', 'padding-left']
138
128
  };
139
-
140
129
  function objToClassNameMultiple(prop, data) {
141
130
  data = data.trim().replace(/\s+/gi, ' ');
142
131
  let dataArr = data.split(' ');
143
-
144
132
  if (dataArr.length === 3) {
145
133
  dataArr[3] = dataArr[1];
146
134
  }
147
-
148
135
  if (dataArr.length === 2) {
149
136
  dataArr[3] = dataArr[1];
150
137
  dataArr[2] = dataArr[0];
151
138
  }
152
-
153
139
  if (dataArr.length === 1) {
154
140
  dataArr[3] = dataArr[0];
155
141
  dataArr[2] = dataArr[0];
156
142
  dataArr[1] = dataArr[0];
157
143
  }
158
-
159
144
  let composeClasses = '';
160
145
  dataArr.forEach((data, index) => composeClasses += `${objToClassName(multipleClassName[prop][index], parseInt(data, 10))} `);
161
146
  composeClasses = composeClasses.substring(0, composeClasses.length - 1);
162
147
  return composeClasses;
163
148
  }
164
-
165
149
  const commonFilePath = {
166
150
  margin: 'src/common/css/margin.css',
167
151
  'margin-left': 'src/common/css/margin.css',
@@ -193,12 +177,11 @@ const commonFilePath = {
193
177
  'white-space': 'src/common/css/textProps.css',
194
178
  visibility: 'src/common/css/textProps.css'
195
179
  };
196
-
197
180
  function generateComposeString(resourcePath, prop, value) {
198
- let composeString = `from "${_path.default.relative(_path.default.parse(resourcePath).dir, // resourcePath
181
+ let composeString = `from "${_path.default.relative(_path.default.parse(resourcePath).dir,
182
+ // resourcePath
199
183
  commonFilePath[prop]).replace(/\\/gi, '/')}"`;
200
184
  let cls = '';
201
-
202
185
  if (/^position|^overflow|^display|^float|^text-align|^white-space|^visibility/gi.test(prop)) {
203
186
  console.log(prop, value, 'textvals');
204
187
  cls = objtoClassNameString(prop, value);
@@ -209,10 +192,10 @@ function generateComposeString(resourcePath, prop, value) {
209
192
  // console.log(prop, value, 'common');
210
193
  cls = objToClassName(prop, parseInt(value));
211
194
  }
212
-
213
195
  composeString = `${cls} ${composeString}`;
214
196
  return composeString;
215
- } // const preNames = {
197
+ }
198
+ // const preNames = {
216
199
  // height: 'zd-height-',
217
200
  // 'max-height': 'zd-height-',
218
201
  // 'min-height': 'zd-height-',
@@ -232,67 +215,60 @@ function generateComposeString(resourcePath, prop, value) {
232
215
  // 'margin-left': 'zd-margin-',
233
216
  // 'margin-right': 'zd-margin-'
234
217
  // };
235
-
236
-
237
218
  function allowParent(rule) {
238
219
  return rule.parent.type === 'root' || rule.parent.type === 'atrule' && rule.parent.name === 'media';
239
220
  }
240
-
241
221
  module.exports = function (source) {
242
222
  const {
243
223
  resourcePath
244
224
  } = this;
245
- const options = (0, _utils.getOptions)(); // console.log(options.app.patterns.composeMinification);
225
+ const options = (0, _utils.getOptions)();
226
+ // console.log(options.app.patterns.composeMinification);
246
227
  // const ig = ignore({ allowRelativePaths: true }).add(options.app.patterns.composeMinification);
247
228
  // const newFilename = path.relative(path.parse(process.cwd()).base, resourcePath);
248
229
  // console.log(newFilename, ig.ignores(newFilename));
249
230
 
250
231
  let root = _postcss.default.parse(source);
251
-
252
232
  if (!(0, _fileHandling.isFileNameMatchingPluginPattern)({
253
233
  filename: resourcePath,
254
234
  filterArr: options.app.patterns.composeMinification
255
235
  })) {
256
236
  return root.toString();
257
237
  }
258
-
259
238
  root.walkRules(rule => {
260
239
  rule.walkDecls(decl => {
261
240
  if (/^-ms|^-webkit|^moz/gi.test(decl.prop)) {
262
241
  return;
263
242
  }
264
-
265
243
  if (!allowParent(rule)) {
266
244
  return;
267
245
  }
268
-
269
246
  if ((0, _classHandling.isInsideMediaQuery)(rule)) {
270
247
  console.log('inside media query', rule.selector);
271
248
  return;
272
249
  }
273
-
274
250
  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(--')) {
275
251
  decl.value = generateComposeString(resourcePath, decl.prop, decl.value);
276
252
  decl.prop = 'composes';
277
253
  return;
278
254
  }
279
-
280
255
  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)) {
281
256
  // n++ < 10 && console.log(composeString);
282
257
  // if (!composeString.includes('src')) {
283
258
  // if (/px$/gi.test(decl.value)) {
284
- decl.value = generateComposeString(resourcePath, decl.prop, decl.value); // }
259
+ decl.value = generateComposeString(resourcePath, decl.prop, decl.value);
260
+ // }
285
261
  // if (/^position$|^display$|^overflow$|^float$/gi.test(decl.prop)) {
286
262
  // console.log(decl.prop);
287
263
  // }
288
-
289
- decl.prop = 'composes'; // console.log(decl.prop, decl.value);
264
+ decl.prop = 'composes';
265
+ // console.log(decl.prop, decl.value);
290
266
  // n < 10 && console.log(rule.selector, decl.prop, decl.value);
291
267
  // }
292
268
  }
293
269
  });
294
270
  });
295
- const output = root.toString(); // console.log(output);
296
-
271
+ const output = root.toString();
272
+ // console.log(output);
297
273
  return output;
298
274
  };
@@ -1,33 +1,22 @@
1
1
  "use strict";
2
2
 
3
3
  var _fs = _interopRequireDefault(require("fs"));
4
-
5
4
  var _getOptions = _interopRequireDefault(require("../utils/getOptions.js"));
6
-
7
5
  var _path = _interopRequireDefault(require("path"));
8
-
9
6
  var _enhancedReactLiveConverter = require("./enhancedReactLiveConverter.js");
10
-
11
7
  var _markdownLoader = require("./markdownLoader.js");
12
-
13
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
-
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
9
  module.exports = function (source) {
16
10
  const comNameAry = this.resourcePath.split(_path.default.sep);
17
11
  const filePath = this.resourcePath;
18
-
19
12
  const appPath = _fs.default.realpathSync(process.cwd());
20
-
21
13
  const changePath = filePath.replace('/lib/', '/src/');
22
14
  const comName = comNameAry[comNameAry.length - 1];
23
15
  const name = comName.substring(0, comName.lastIndexOf('.'));
24
16
  const options = (0, _getOptions.default)();
25
17
  const originalFilePath = filePath.startsWith(appPath) ? filePath : changePath;
26
-
27
18
  const src = _fs.default.readFileSync(originalFilePath).toString();
28
-
29
19
  options.docs.enableMDParser && (source = (0, _markdownLoader.markdownParser)(source));
30
20
  options.docs.enableReactLive && (source = (0, _enhancedReactLiveConverter.enhancedReactLiveConverter)(source, originalFilePath)); //to Enable the ReactLive Converter
31
-
32
21
  return `${source};${name}.source=${JSON.stringify(src)};${name}.filePath=${JSON.stringify(filePath)}`;
33
22
  };
@@ -1,25 +1,21 @@
1
1
  "use strict";
2
2
 
3
3
  var _reactDocgen = _interopRequireDefault(require("react-docgen"));
4
-
5
4
  var _path = _interopRequireDefault(require("path"));
6
-
7
5
  var _utils = require("../utils");
8
-
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
-
6
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
7
  // import loaderUtils from 'loader-utils';
8
+
12
9
  module.exports = source => {
13
- (void 0).cacheable && (void 0).cacheable(); // let query = loaderUtils.parseQuery(this.query);
10
+ (void 0).cacheable && (void 0).cacheable();
11
+ // let query = loaderUtils.parseQuery(this.query);
14
12
 
15
13
  let value = {};
16
-
17
14
  try {
18
15
  value = _reactDocgen.default.parse(source);
19
16
  } catch (e) {
20
17
  (0, _utils.log)('ERROR in docgen-loader', e);
21
18
  }
22
-
23
19
  let comNameAry = (void 0).resourcePath.split(_path.default.sep);
24
20
  let comName = comNameAry[comNameAry.length - 1];
25
21
  let name = comName.substring(0, comName.lastIndexOf('.'));
@@ -4,20 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.enhancedReactLiveConverter = enhancedReactLiveConverter;
7
-
8
7
  const parser = require('@babel/parser');
9
-
10
8
  const traverse = require('@babel/traverse').default;
11
-
12
9
  const t = require("@babel/types");
13
-
14
10
  const path = require('path');
15
-
16
11
  function getFilename(originalFilePath) {
17
12
  const [fileName] = path.basename(originalFilePath).split('.');
18
13
  return fileName;
19
14
  }
20
-
21
15
  function convertKeyToValue(object = {}) {
22
16
  let keys = Object.keys(object);
23
17
  let values = Object.values(object);
@@ -26,20 +20,16 @@ function convertKeyToValue(object = {}) {
26
20
  item = item.replace(/{|}/g, "");
27
21
  item = '{ ' + item + ' }';
28
22
  }
29
-
30
23
  value = value + "'" + values[i] + "'" + ": " + item + ",";
31
24
  return value;
32
25
  }, '');
33
26
  }
34
-
35
27
  function mergeDuplicateValues(obj) {
36
28
  let mergedObj = {};
37
-
38
29
  for (let key in obj) {
39
30
  if (obj.hasOwnProperty(key)) {
40
31
  let value = obj[key];
41
32
  let existingKey = Object.keys(mergedObj).find(k => mergedObj[k] === value);
42
-
43
33
  if (existingKey) {
44
34
  mergedObj[existingKey + ' , ' + key] = value;
45
35
  delete mergedObj[existingKey];
@@ -48,40 +38,33 @@ function mergeDuplicateValues(obj) {
48
38
  }
49
39
  }
50
40
  }
51
-
52
41
  return mergedObj;
53
42
  }
54
-
55
43
  function enhancedReactLiveConverter(source, originalFilePath) {
56
44
  const fileName = getFilename(originalFilePath);
57
-
58
45
  if (!source) {
59
46
  return '';
60
47
  }
61
-
62
48
  let docCode = '';
63
49
  const fileContent = source.replace(/[\s\r\n]*$/, '');
64
50
  const ast = parser.parse(fileContent, {
65
51
  sourceType: 'module',
66
52
  plugins: ['jsx', 'classProperties']
67
53
  });
68
-
69
54
  function createImportStatements(input) {
70
55
  let output = '';
71
-
72
56
  for (const key in input) {
73
57
  if (input.hasOwnProperty(key) && key !== 'React') {
74
58
  output += `import ${key} from '${input[key]}';\n`;
75
59
  }
76
60
  }
77
-
78
61
  return output;
79
62
  }
80
-
81
63
  const importBlock = {};
82
64
  const printableCode = {};
83
- let remainingBlock = ''; // Traverse the AST and find the import and export blocks
65
+ let remainingBlock = '';
84
66
 
67
+ // Traverse the AST and find the import and export blocks
85
68
  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();
86
69
  traverse(ast, {
87
70
  ImportDeclaration(path) {
@@ -97,14 +80,11 @@ function enhancedReactLiveConverter(source, originalFilePath) {
97
80
  }
98
81
  }).join(", ");
99
82
  },
100
-
101
83
  ExpressionStatement(path) {
102
84
  const expression = path.get('expression');
103
85
  const expressionLeft = expression.get('left');
104
-
105
86
  if (path.isExpressionStatement() && expression.isAssignmentExpression() && expressionLeft.isMemberExpression()) {
106
87
  const docCheck = expressionLeft.toString();
107
-
108
88
  if (docCheck === `${fileName}.docs`) {
109
89
  docCode = expression.toString();
110
90
  } else if (docCheck.includes(fileName)) {
@@ -114,7 +94,6 @@ function enhancedReactLiveConverter(source, originalFilePath) {
114
94
  }
115
95
  }
116
96
  }
117
-
118
97
  });
119
98
  remainingCode = remainingCode.replace(/__DOCS__/, true);
120
99
  remainingCode = remainingCode.replace(/`/g, '\\`').replace(/\$\{/g, '$\\{');
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  var _path = _interopRequireDefault(require("path"));
4
-
5
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6
-
4
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
7
5
  module.exports = function (source) {
8
6
  const {
9
7
  rootContext,
@@ -1,64 +1,55 @@
1
1
  "use strict";
2
2
 
3
3
  var _path = _interopRequireDefault(require("path"));
4
-
5
4
  var _loaderUtils = _interopRequireDefault(require("loader-utils"));
6
-
7
5
  var _common = require("../common");
8
-
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
-
6
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
7
  module.exports = function (content) {
12
8
  let {
13
9
  userRequest
14
10
  } = this._module.issuer;
15
11
  this.cacheable && this.cacheable();
16
-
17
12
  if (!this.emitFile) {
18
13
  throw new Error('emitFile is required from module system');
19
14
  }
20
-
21
15
  let options = _loaderUtils.default.getOptions(this) || {};
22
- let query = this.resourceQuery ? _loaderUtils.default.parseQuery(this.resourceQuery) : {}; // let configKey = query.config || 'fileLoader';
16
+ let query = this.resourceQuery ? _loaderUtils.default.parseQuery(this.resourceQuery) : {};
17
+
18
+ // let configKey = query.config || 'fileLoader';
23
19
 
24
20
  let config = {
25
21
  // publicPath: false,
26
22
  useRelativePath: false,
27
- name: '[hash].[ext]' // publicPathStrigify: true
28
-
29
- }; // options takes precedence over config
23
+ name: '[hash].[ext]'
24
+ // publicPathStrigify: true
25
+ };
30
26
 
27
+ // options takes precedence over config
31
28
  Object.keys(options).forEach(attr => {
32
29
  config[attr] = options[attr];
33
- }); // query takes precedence over config and options
30
+ });
34
31
 
32
+ // query takes precedence over config and options
35
33
  Object.keys(query).forEach(attr => {
36
34
  config[attr] = query[attr];
37
35
  });
38
36
  let context = config.context || options.context;
39
-
40
37
  let url = _loaderUtils.default.interpolateName(this, config.name, {
41
38
  context: context,
42
39
  content: content,
43
40
  regExp: config.regExp
44
41
  });
45
-
46
42
  let outputPath = '';
47
43
  let filePath = this.resourcePath;
48
-
49
44
  if (config.useRelativePath) {
50
45
  let issuerContext = this._module && this._module.issuer && this._module.issuer.context || context;
51
-
52
46
  let relativeUrl = issuerContext && _path.default.relative(issuerContext, filePath).split(_path.default.sep).join('/');
53
-
54
47
  let relativePath = relativeUrl && `${_path.default.dirname(relativeUrl)}/`;
55
-
56
48
  if (~relativePath.indexOf('../')) {
57
49
  outputPath = _path.default.posix.join(outputPath, relativePath, url);
58
50
  } else {
59
51
  outputPath = relativePath + url;
60
52
  }
61
-
62
53
  url = relativePath + url;
63
54
  } else if (config.outputPath) {
64
55
  // support functions as outputPath to generate them dynamically
@@ -67,9 +58,9 @@ module.exports = function (content) {
67
58
  } else {
68
59
  outputPath = url;
69
60
  }
70
-
71
61
  let requestFromJS = /\.js$/.test(userRequest);
72
- let publicPath = requestFromJS ? (0, _common.getPublicPathConfig)(url) : `__webpack_public_path__ + ${JSON.stringify(url)}`; // if (config.publicPath !== false) {
62
+ let publicPath = requestFromJS ? (0, _common.getPublicPathConfig)(url) : `__webpack_public_path__ + ${JSON.stringify(url)}`;
63
+ // if (config.publicPath !== false) {
73
64
  // // support functions as publicPath to generate them dynamically
74
65
  // if (config.publicPathStringify) {
75
66
  // publicPath = JSON.Stringify(
@@ -88,8 +79,6 @@ module.exports = function (content) {
88
79
  if (query.emitFile === undefined || query.emitFile) {
89
80
  this.emitFile(outputPath, content);
90
81
  }
91
-
92
82
  return `module.exports = ${publicPath};`;
93
83
  };
94
-
95
84
  module.exports.raw = true;
@@ -4,31 +4,27 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.markdownParser = markdownParser;
7
-
8
- const markdownIt = require('markdown-it'); // const md = new markdownIt({ linkify: true,breaks:true });
9
-
10
-
7
+ const markdownIt = require('markdown-it');
8
+ // const md = new markdownIt({ linkify: true,breaks:true });
11
9
  const md = new markdownIt({
12
10
  html: false,
13
11
  linkify: true,
14
12
  typographer: true,
15
13
  breaks: true,
16
14
  xhtmlOut: true
17
- }); //const md = new markdownIt();
18
-
15
+ });
16
+ //const md = new markdownIt();
19
17
  function markdownParser(source) {
20
18
  if (!source) {
21
19
  return '';
22
20
  }
23
-
24
21
  const startTag = '/* MD:START';
25
- const endTag = 'MD:END */'; // Iterate through all occurrences of the tags
22
+ const endTag = 'MD:END */';
26
23
 
24
+ // Iterate through all occurrences of the tags
27
25
  let startIndex = source.indexOf(startTag);
28
-
29
26
  while (startIndex !== -1) {
30
27
  const endIndex = source.indexOf(endTag, startIndex);
31
-
32
28
  if (endIndex !== -1) {
33
29
  const extractedMarkdown = source.slice(startIndex + startTag.length, endIndex);
34
30
  let lines = extractedMarkdown.split('\n');
@@ -36,8 +32,8 @@ function markdownParser(source) {
36
32
  const firstLineIndentMatch = lines[0].match(/^\s+/);
37
33
  const firstLineIndent = firstLineIndentMatch ? firstLineIndentMatch[0] : '';
38
34
  const modifiedStr = lines.map(line => line.replace(new RegExp(`^${firstLineIndent}`), '')).join('\n').replace(/(:--)|(--:)/g, '---');
39
- let html = md.render(modifiedStr); //html = html.replace(/"|<hr>|<img src=(".*?")>|<br>|:--|--:|{|}|\$/g, match => {
40
-
35
+ let html = md.render(modifiedStr);
36
+ //html = html.replace(/"|<hr>|<img src=(".*?")>|<br>|:--|--:|{|}|\$/g, match => {
41
37
  html = html.replace(/"|{|}|\$/g, match => {
42
38
  // if (match === '<hr>') {
43
39
  // return '<hr/>';
@@ -51,21 +47,20 @@ function markdownParser(source) {
51
47
  return '&#123;';
52
48
  } else if (match === '}') {
53
49
  return '&#125;';
54
- } // else if (match === ':--' || match === '--:' ) {
50
+ }
51
+ // else if (match === ':--' || match === '--:' ) {
55
52
  // return '---';
56
53
  // }
57
54
  else if (match === '}') {
58
55
  return '&#125;';
59
56
  }
60
-
61
57
  return match;
62
- }); // console.log(html,"html");
63
-
58
+ });
59
+ // console.log(html,"html");
64
60
  source = source.replace(source.slice(startIndex, endIndex + endTag.length), '<><div class="markDown">' + html + '</div></>');
65
61
  }
66
-
67
- startIndex = source.indexOf(startTag, startIndex + 1); // console.log(source)
62
+ startIndex = source.indexOf(startTag, startIndex + 1);
63
+ // console.log(source)
68
64
  }
69
-
70
65
  return source;
71
66
  }
@@ -4,25 +4,18 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.reactLiveConvertor = reactLiveConvertor;
7
-
8
7
  const parser = require('@babel/parser');
9
-
10
8
  const traverse = require('@babel/traverse').default;
11
-
12
9
  const path = require('path');
13
-
14
10
  function getFilename(originalFilePath) {
15
11
  const [fileName] = path.basename(originalFilePath).split('.');
16
12
  return fileName;
17
13
  }
18
-
19
14
  function reactLiveConvertor(source, originalFilePath) {
20
15
  const fileName = getFilename(originalFilePath);
21
-
22
16
  if (!source) {
23
17
  return '';
24
18
  }
25
-
26
19
  let importBlock = '';
27
20
  let docCode = '';
28
21
  const packages = new Set();
@@ -30,8 +23,9 @@ function reactLiveConvertor(source, originalFilePath) {
30
23
  const ast = parser.parse(fileContent, {
31
24
  sourceType: 'module',
32
25
  plugins: ['jsx', 'classProperties']
33
- }); // Traverse the AST and find the import and export blocks
26
+ });
34
27
 
28
+ // Traverse the AST and find the import and export blocks
35
29
  let remainingCode = ast.program.body.filter(node => node.type !== 'ImportDeclaration').map(node => fileContent.substring(node.start, node.end)).join('').replace(/export default/, '').replace(/export /, '').trim();
36
30
  traverse(ast, {
37
31
  ImportDeclaration(path) {
@@ -40,35 +34,31 @@ function reactLiveConvertor(source, originalFilePath) {
40
34
  if (specifier.type === 'ImportSpecifier') {
41
35
  packages.add(specifier.imported.name);
42
36
  }
43
-
44
37
  if (specifier.local.type === 'Identifier') {
45
38
  packages.add(specifier.local.name);
46
39
  }
47
40
  });
48
41
  },
49
-
50
42
  ExpressionStatement(path) {
51
43
  const expression = path.get('expression');
52
44
  const expressionLeft = expression.get('left');
53
-
54
45
  if (path.isExpressionStatement() && expression.isAssignmentExpression() && expressionLeft.isMemberExpression()) {
55
46
  const docCheck = expressionLeft.toString();
56
-
57
47
  if (docCheck === `${fileName}.docs`) {
58
48
  docCode = expression.toString();
59
49
  }
60
50
  }
61
- } // IfStatement(path){
51
+ }
52
+ // IfStatement(path){
62
53
  // if(path.node.type == 'IfStatement'){
63
54
  // if(path.node.test.name == '__DOCS__'){
64
55
  // let final = fileContent.slice(path.node.start,path.node.end)
65
56
  // fileContent = fileContent.replace(final,'')
66
57
  // console.log(fileContent);
58
+
67
59
  // }
68
60
  // }
69
61
  // }
70
-
71
-
72
62
  });
73
63
  remainingCode = remainingCode.replace(/__DOCS__/, true);
74
64
  remainingCode = remainingCode.replace(/`/g, '\\`').replace(/\$\{/g, '$\\{');