@zohodesk/client_build_tool 0.0.11-exp.16.0 → 0.0.11-exp.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/README.md +102 -0
  2. package/README_backup.md +102 -0
  3. package/lib/allCommandsConfigs.js +7 -2
  4. package/lib/commands/build/commandExecutor.js +5 -1
  5. package/lib/commands/build/config.js +3 -2
  6. package/lib/commands/build/optionsProcessor.js +5 -2
  7. package/lib/commands/build/preProcessor.js +2 -0
  8. package/lib/commands/buildEs/commandExecutor.js +5 -0
  9. package/lib/commands/buildEs/config.js +3 -2
  10. package/lib/commands/buildEs/preProcessor.js +2 -0
  11. package/lib/commands/buildLib/commandExecutor.js +5 -0
  12. package/lib/commands/buildLib/config.js +3 -2
  13. package/lib/commands/buildLib/preProcessor.js +2 -0
  14. package/lib/commands/mockserver/commandExecutor.js +9 -2
  15. package/lib/commands/mockserver/config.js +3 -2
  16. package/lib/commands/pre_process/commandExecutor.js +2 -0
  17. package/lib/commands/pre_process/config.js +3 -2
  18. package/lib/commands/start/commandExecutor.js +2 -0
  19. package/lib/commands/start/config.js +3 -2
  20. package/lib/commands/start/optionsProcessor.js +4 -2
  21. package/lib/commands/start/preProcessor.js +2 -0
  22. package/lib/commands/template/commandExecutor.js +7 -0
  23. package/lib/commands/template/config.js +3 -2
  24. package/lib/commands/version/commandExecutor.js +3 -0
  25. package/lib/commands/version/config.js +3 -2
  26. package/lib/commandsRouter.js +21 -5
  27. package/lib/index.js +2 -0
  28. package/lib/logger.js +5 -0
  29. package/lib/schemas/applyValuesToSchema/index.js +8 -0
  30. package/lib/schemas/applyValuesToSchema/isObject.js +1 -0
  31. package/lib/schemas/applyValuesToSchema/isValid.js +2 -0
  32. package/lib/schemas/cliArgsToObject.js +6 -2
  33. package/lib/schemas/defaultConfigValues.js +17 -4
  34. package/lib/schemas/defaultConfigValuesOnly.js +33 -4
  35. package/lib/schemas/deprecatedOptionsHandler.js +16 -7
  36. package/lib/schemas/getNpmVersion.js +5 -0
  37. package/lib/schemas/giveDefaultValue.js +3 -0
  38. package/lib/schemas/npmConfigToObject.js +5 -2
  39. package/lib/schemas/readOptions.js +30 -10
  40. package/lib/schemas/readOptionsForConfigFile.js +12 -2
  41. package/lib/shared/babel/addDefaultPlugins.js +2 -0
  42. package/lib/shared/babel/babelWebConfig.js +10 -1
  43. package/lib/shared/babel/babel_plugins/removeAttributesPlugin.js +4 -0
  44. package/lib/shared/babel/getBabelPlugin.js +7 -2
  45. package/lib/shared/babel/runBabelForJSFile.js +4 -1
  46. package/lib/shared/babel/runBabelForTsFile.js +5 -1
  47. package/lib/shared/bundler/webpack/common/decidePublicPath.js +5 -0
  48. package/lib/shared/bundler/webpack/common/libAlias.js +3 -3
  49. package/lib/shared/bundler/webpack/common/modeUtils.js +5 -0
  50. package/lib/shared/bundler/webpack/common/nameTemplates.js +18 -11
  51. package/lib/shared/bundler/webpack/common/resourceBasedPublicPath.js +3 -2
  52. package/lib/shared/bundler/webpack/configCustomLoaders.js +1 -0
  53. package/lib/shared/bundler/webpack/cssLoaders.js +2 -0
  54. package/lib/shared/bundler/webpack/custom_plugins/BundleIntegrityReport/index.js +20 -1
  55. package/lib/shared/bundler/webpack/custom_plugins/CdnChangePlugin/index.js +25 -20
  56. package/lib/shared/bundler/webpack/custom_plugins/CdnChangePlugin/webpackCustomJsUrlLoader.js +9 -4
  57. package/lib/shared/bundler/webpack/custom_plugins/CustomScriptLoadingPlugin.js +23 -3
  58. package/lib/shared/bundler/webpack/custom_plugins/EFCTemplatePlugin.js +19 -8
  59. package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nGroupRuntimeModule.js +61 -37
  60. package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexHtmlInjectorPlugin.js +33 -15
  61. package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexPlugin.js +108 -60
  62. package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/utils/i18nDataLoader.js +26 -20
  63. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nFilesEmitPlugin.js +26 -5
  64. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nKeysIdentifer.js +16 -13
  65. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nRuntimeDealerPlugin.js +53 -19
  66. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/LocaleChunkAssetsStore.js +17 -2
  67. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/ModulesI18nKeysStore.js +13 -0
  68. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/constants.js +21 -11
  69. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/createHash.js +4 -0
  70. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nLoadingRuntimeModule.js +14 -4
  71. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/index.js +13 -3
  72. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/iterateModulesInChunk.js +12 -3
  73. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/optionsHandler.js +7 -2
  74. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/pathCreator.js +2 -0
  75. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/readI18nValues.js +3 -2
  76. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateFileName.js +4 -2
  77. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateHashHelpers.js +13 -8
  78. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/collectI18nKeys.js +14 -2
  79. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/getChunkModules.js +1 -0
  80. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/hashUtils.js +3 -1
  81. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/index.js +4 -0
  82. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/propertiesUtils.js +25 -5
  83. package/lib/shared/bundler/webpack/custom_plugins/InitialHtmlPlugin.js +10 -3
  84. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/addFilesNamesToManifestJson.js +6 -1
  85. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/createInitialEntries.js +6 -1
  86. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/createManifestJson.js +6 -0
  87. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/findInitialFileNames.js +1 -0
  88. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/index.js +7 -0
  89. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/removeHashFromFileName.js +1 -0
  90. package/lib/shared/bundler/webpack/custom_plugins/ResourceHintsPlugin.js +17 -13
  91. package/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +15 -6
  92. package/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtlCssPlugin.js +13 -4
  93. package/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/replaceCssDirTemplate.js +6 -4
  94. package/lib/shared/bundler/webpack/custom_plugins/RuntimeResourceCleanup/index.js +10 -0
  95. package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/classHandling.js +3 -0
  96. package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/index.js +20 -4
  97. package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/selectorWeightPrefixAdder.js +12 -10
  98. package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/windowsModification.js +3 -2
  99. package/lib/shared/bundler/webpack/custom_plugins/ServiceWorkerPlugin.js +20 -7
  100. package/lib/shared/bundler/webpack/custom_plugins/ServiceWorkerPluginUtils.js +1 -0
  101. package/lib/shared/bundler/webpack/custom_plugins/SourceMapPlugin/index.js +10 -7
  102. package/lib/shared/bundler/webpack/custom_plugins/TPHashMappingPlugin/addHashToFilePath.js +6 -1
  103. package/lib/shared/bundler/webpack/custom_plugins/TPHashMappingPlugin/index.js +16 -1
  104. package/lib/shared/bundler/webpack/custom_plugins/UglifyCSSPlugin/index.js.js +11 -4
  105. package/lib/shared/bundler/webpack/custom_plugins/VariableConversionCollector/ErrorHandler.js +10 -3
  106. package/lib/shared/bundler/webpack/custom_plugins/VariableConversionCollector/index.js +62 -27
  107. package/lib/shared/bundler/webpack/custom_plugins/custom_attribute_plugin/index.js +15 -3
  108. package/lib/shared/bundler/webpack/custom_plugins/emitAsset.js +1 -0
  109. package/lib/shared/bundler/webpack/custom_plugins/getInitialAssetsFuncTemplate.js +12 -2
  110. package/lib/shared/bundler/webpack/custom_plugins/getInitialI18nAssetsArrayStr.js +7 -2
  111. package/lib/shared/bundler/webpack/defaultVendorPatternList.js +6 -2
  112. package/lib/shared/bundler/webpack/devtoolConfig.js +1 -0
  113. package/lib/shared/bundler/webpack/entryConfig.js +4 -0
  114. package/lib/shared/bundler/webpack/externals.js +1 -0
  115. package/lib/shared/bundler/webpack/getCSSLoaders.js +6 -1
  116. package/lib/shared/bundler/webpack/getFilenameFromModule.js +5 -1
  117. package/lib/shared/bundler/webpack/jsLoaders.js +10 -6
  118. package/lib/shared/bundler/webpack/loaderConfigs/assetLoaders.js +2 -0
  119. package/lib/shared/bundler/webpack/loaderConfigs/babelLoaderConfig.js +3 -2
  120. package/lib/shared/bundler/webpack/loaderConfigs/checkIsPatternsMatchFilename.js +12 -3
  121. package/lib/shared/bundler/webpack/loaderConfigs/configHtmlTemplateLoader.js +1 -0
  122. package/lib/shared/bundler/webpack/loaderConfigs/configPostCssLoader.js +10 -2
  123. package/lib/shared/bundler/webpack/loaderConfigs/configWebWorkerLoader.js +2 -0
  124. package/lib/shared/bundler/webpack/loaderConfigs/configsAssetsLoaders.js +12 -0
  125. package/lib/shared/bundler/webpack/loaderConfigs/cssClassNameGenerate.js +15 -1
  126. package/lib/shared/bundler/webpack/loaderConfigs/getCssLoaderOptions.js +4 -1
  127. package/lib/shared/bundler/webpack/loaderConfigs/i18nIdReplaceLoaderConfig.js +16 -8
  128. package/lib/shared/bundler/webpack/loaders/i18nIdReplaceLoader.js +29 -22
  129. package/lib/shared/bundler/webpack/loaders/miniCssFallBackLoader.js +2 -2
  130. package/lib/shared/bundler/webpack/loaders/workerLoader.js +19 -8
  131. package/lib/shared/bundler/webpack/optimizationConfig.js +13 -5
  132. package/lib/shared/bundler/webpack/outputConfig.js +9 -1
  133. package/lib/shared/bundler/webpack/pluginConfigs/configBundleAnalyzer.js +9 -5
  134. package/lib/shared/bundler/webpack/pluginConfigs/configBundleIntegrityReport.js +5 -0
  135. package/lib/shared/bundler/webpack/pluginConfigs/configCSSMinifierPlugin.js +9 -4
  136. package/lib/shared/bundler/webpack/pluginConfigs/configCdnChangePlugin.js +8 -3
  137. package/lib/shared/bundler/webpack/pluginConfigs/configCopyPublicFolders.js +16 -1
  138. package/lib/shared/bundler/webpack/pluginConfigs/configCustomAttributesPlugin.js +4 -0
  139. package/lib/shared/bundler/webpack/pluginConfigs/configCustomScriptLoadingStrategyPlugin.js +16 -0
  140. package/lib/shared/bundler/webpack/pluginConfigs/configEFCTemplatePlugin.js +5 -0
  141. package/lib/shared/bundler/webpack/pluginConfigs/configEnvVariables.js +5 -0
  142. package/lib/shared/bundler/webpack/pluginConfigs/configHtmlWebpackPlugin.js +8 -2
  143. package/lib/shared/bundler/webpack/pluginConfigs/configI18nIndexingPlugin.js +9 -5
  144. package/lib/shared/bundler/webpack/pluginConfigs/configI18nNumericHtmlInjector.js +25 -19
  145. package/lib/shared/bundler/webpack/pluginConfigs/configI18nNumericIndexPlugin.js +26 -12
  146. package/lib/shared/bundler/webpack/pluginConfigs/configI18nSplitPlugin.js +9 -3
  147. package/lib/shared/bundler/webpack/pluginConfigs/configIgnorePlugin.js +2 -0
  148. package/lib/shared/bundler/webpack/pluginConfigs/configManifestJsonPlugin.js +7 -0
  149. package/lib/shared/bundler/webpack/pluginConfigs/configMiniCSSExtractPlugin.js +7 -3
  150. package/lib/shared/bundler/webpack/pluginConfigs/configProgressPlugin.js +5 -1
  151. package/lib/shared/bundler/webpack/pluginConfigs/configResourceHintsPlugin.js +4 -1
  152. package/lib/shared/bundler/webpack/pluginConfigs/configRtlCssPlugin.js +4 -0
  153. package/lib/shared/bundler/webpack/pluginConfigs/configRuntimeResourceCleanup.js +8 -3
  154. package/lib/shared/bundler/webpack/pluginConfigs/configSelectorWeightPlugin.js +6 -1
  155. package/lib/shared/bundler/webpack/pluginConfigs/configServiceWorkerPlugin.js +8 -3
  156. package/lib/shared/bundler/webpack/pluginConfigs/configSourceMapPlugin.js +4 -0
  157. package/lib/shared/bundler/webpack/pluginConfigs/configTPHashMappingPlugin.js +8 -1
  158. package/lib/shared/bundler/webpack/pluginConfigs/configVariableConversionPlugin.js +6 -1
  159. package/lib/shared/bundler/webpack/plugins.js +24 -1
  160. package/lib/shared/bundler/webpack/resolvers.js +17 -3
  161. package/lib/shared/bundler/webpack/splitChunksConfig.js +15 -2
  162. package/lib/shared/bundler/webpack/statsConfig.js +5 -2
  163. package/lib/shared/bundler/webpack/tsLoaders.js +4 -2
  164. package/lib/shared/bundler/webpack/utils/index.js +12 -1
  165. package/lib/shared/bundler/webpack/utils/object-manipulation.js +16 -2
  166. package/lib/shared/bundler/webpack/utils/updateArrayWithDefault.js +7 -0
  167. package/lib/shared/bundler/webpack/webpackBuild.js +8 -1
  168. package/lib/shared/bundler/webpack/webpackConfig.js +17 -0
  169. package/lib/shared/commands-utils/doBasicRequirementCheck.js +3 -0
  170. package/lib/shared/commands-utils/getCliPath.js +9 -5
  171. package/lib/shared/commands-utils/index.js +3 -0
  172. package/lib/shared/commands-utils/log.js +2 -0
  173. package/lib/shared/commands-utils/readArgsFormCommandLine.js +1 -0
  174. package/lib/shared/commands-utils/readOptionFormCommandLine.js +1 -0
  175. package/lib/shared/commands-utils/spawnSyncIO.js +13 -5
  176. package/lib/shared/constants.js +29 -9
  177. package/lib/shared/fileUtils/copyFile.js +8 -1
  178. package/lib/shared/fileUtils/directoryIterator.js +4 -0
  179. package/lib/shared/fileUtils/watchRun.js +24 -3
  180. package/lib/shared/postcss/custom_postcss_plugins/EmptyPlugin.js +6 -1
  181. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/constants.js +3 -2
  182. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/handleIgnores.js +13 -6
  183. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/index.js +26 -6
  184. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/insertBefore.js +9 -6
  185. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/isPreviouslyProcessed.js +3 -0
  186. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/replaceUtils.js +7 -2
  187. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/separateHoveredSelectorAndNormalSelector.js +2 -0
  188. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/specialCases.js +9 -4
  189. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/typeCheckUtils.js +10 -0
  190. package/lib/shared/postcss/custom_postcss_plugins/RTLSplitPlugin.js +29 -16
  191. package/lib/shared/postcss/custom_postcss_plugins/SelectorReplace.js +17 -0
  192. package/lib/shared/postcss/custom_postcss_plugins/ValueReplacer.js +9 -4
  193. package/lib/shared/postcss/custom_postcss_plugins/VariableModificationPlugin/index.js +63 -27
  194. package/lib/shared/postcss/filterPluginsAllowedForSpecficFile.js +13 -5
  195. package/lib/shared/postcss/getAllowedPostCssPlugins.js +3 -0
  196. package/lib/shared/postcss/getSpecificPostCssPlugin.js +17 -7
  197. package/lib/shared/postcss/runPostCssForCssFile.js +9 -1
  198. package/lib/shared/pre_process/runPreProcess.js +11 -0
  199. package/lib/shared/server/configWebpackDevMiddleware.js +8 -1
  200. package/lib/shared/server/corsHandling.js +6 -2
  201. package/lib/shared/server/getIp.js +7 -1
  202. package/lib/shared/server/getServerURL.js +6 -0
  203. package/lib/shared/server/httpsOptions.js +11 -0
  204. package/lib/shared/server/initExpressApp.js +4 -1
  205. package/lib/shared/server/initialHTMLHandling.js +16 -7
  206. package/lib/shared/server/mockApiHandler.js +16 -8
  207. package/lib/shared/server/mockServer.js +7 -0
  208. package/lib/shared/server/serveContextFiles.js +5 -1
  209. package/lib/shared/server/serverBywebpackDevMiddleware.js +9 -4
  210. package/lib/shared/server/startHttpServer.js +3 -0
  211. package/lib/shared/server/startHttpsServer.js +9 -1
  212. package/lib/shared/server/unwanted/addHttp2Server.js +7 -2
  213. package/lib/shared/server/unwanted/configWebpackDevMiddleware.js +8 -1
  214. package/lib/shared/server/unwanted/mockApiSupport.js +2 -0
  215. package/lib/shared/server/unwanted/websocketMockSetup.js +7 -1
  216. package/lib/shared/server/urlConcat.js +8 -3
  217. package/lib/shared/utils/requireLocalOrGlobal.js +25 -10
  218. package/lib/shared/utils/versionPrint.js +6 -1
  219. package/npm-shrinkwrap.json +2 -2
  220. package/package.json +1 -1
@@ -5,28 +5,33 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.hackForComposes = hackForComposes;
7
7
  exports.removeRuleIfNoNormalSelectors = removeRuleIfNoNormalSelectors;
8
+
8
9
  var _insertBefore = require("./insertBefore");
10
+
9
11
  var _replaceUtils = require("./replaceUtils");
12
+
10
13
  function hackForComposes(rule, hoveredSelectors, params) {
11
14
  const {
12
15
  Rule
13
16
  } = params;
17
+
14
18
  if (hoveredSelectors.length === 0) {
15
19
  return;
16
- }
17
-
18
- // NOTE: we create Empty Rule with hovered selectors that :hover removed from hover selector
20
+ } // NOTE: we create Empty Rule with hovered selectors that :hover removed from hover selector
19
21
  // Reason: when composes looking for selector it most be at least empty rule other wise composes will throw error.
22
+
23
+
20
24
  (0, _insertBefore.insertBefore)(rule, new Rule({
21
25
  selector: hoveredSelectors.map(_replaceUtils.removeHoverFromSelector).join(',')
22
26
  }));
23
27
  }
24
-
25
28
  /**
26
29
  * NOTE: this function will remove rule if the rule has no normal selectors.
27
30
  * @param {Rule} rule
28
31
  * @returns
29
32
  */
33
+
34
+
30
35
  function removeRuleIfNoNormalSelectors(normalSelectors, rule) {
31
36
  if (normalSelectors.length) {
32
37
  // NOTE: removed hovered selectors
@@ -12,31 +12,41 @@ exports.isParentAtRuleContainsParam = isParentAtRuleContainsParam;
12
12
  exports.isRule = isRule;
13
13
  exports.isRuleNotInsideAtRule = isRuleNotInsideAtRule;
14
14
  exports.isSelectorHasHover = isSelectorHasHover;
15
+
15
16
  var _constants = require("./constants");
17
+
16
18
  function isComment(node) {
17
19
  return node.type === 'comment';
18
20
  }
21
+
19
22
  function isRule(node) {
20
23
  return node.type === 'rule';
21
24
  }
25
+
22
26
  function isMediaQuery(node) {
23
27
  return node.name === 'media';
24
28
  }
29
+
25
30
  function isAtRule(node) {
26
31
  return node.type === 'atrule';
27
32
  }
33
+
28
34
  function isAtRuleContainsParam(atRule, content) {
29
35
  return atRule.params.includes(content);
30
36
  }
37
+
31
38
  function isParentAtRuleContainsParam(rule, content) {
32
39
  return isAtRuleContainsParam(rule.parent, content);
33
40
  }
41
+
34
42
  function isParentAtRule(rule) {
35
43
  return isAtRule(rule.parent);
36
44
  }
45
+
37
46
  function isRuleNotInsideAtRule(node) {
38
47
  return isRule(node) && node && !isAtRule(node.parent);
39
48
  }
49
+
40
50
  function isSelectorHasHover(selector) {
41
51
  return selector.indexOf(_constants.HOVER_NOTATION) !== -1;
42
52
  }
@@ -5,24 +5,33 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.separateRtlAndLtr = separateRtlAndLtr;
7
7
  exports.separateSingleDir = separateSingleDir;
8
+
8
9
  var postcss = _interopRequireWildcard(require("postcss"));
9
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
10
- /* eslint-disable no-param-reassign */
11
10
 
11
+ 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); }
12
+
13
+ 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; }
14
+
15
+ /* eslint-disable no-param-reassign */
12
16
  const oppositeDir = {
13
17
  ltr: 'rtl',
14
18
  rtl: 'ltr'
15
19
  };
20
+
16
21
  function compareSelector(selector1, selector2) {
17
22
  // console.log({ selector1, selector2 }, selector1 === selector2);
18
23
  return selector1 === selector2;
19
24
  }
25
+
20
26
  const directionRegexs = {
21
27
  ltr: /\[dir=ltr\]/,
22
28
  rtl: /\[dir=rtl\]/
23
29
  };
30
+
24
31
  const getRegex = dir => directionRegexs[dir];
32
+
25
33
  const getOppositeRegex = dir => getRegex(oppositeDir[dir]);
34
+
26
35
  function selectorMinifySameDir(selector, direction) {
27
36
  // NOTE: if this rule is same dir as current need
28
37
  // then we can just remove that [dir=ltr] or [dir=rtl]
@@ -30,16 +39,18 @@ function selectorMinifySameDir(selector, direction) {
30
39
  const regex = getRegex(direction);
31
40
  return selector.replace(regex, '').trim();
32
41
  }
33
-
34
42
  /**
35
43
  * this funtion will remove given rule,
36
44
  * if given selector and it's previous sibiling rule selector are same
37
45
  * current rule properties will move to previous sibiling rule.
38
46
  * @param {Rule} rule current rule
39
47
  */
48
+
49
+
40
50
  function mergeIfSameSelector(rule) {
41
51
  // NOTE: to merge dublicate selector rules
42
52
  const prev = rule.prev();
53
+
43
54
  if (prev && compareSelector(prev.selector, rule.selector)) {
44
55
  rule.each(decl => {
45
56
  prev.append(decl);
@@ -47,25 +58,27 @@ function mergeIfSameSelector(rule) {
47
58
  rule.remove();
48
59
  }
49
60
  }
50
-
51
61
  /**
52
62
  * this funtion will remove given rule,
53
63
  * if given selector and it's previous sibiling rule selector are same
54
64
  * current rule properties will move to previous sibiling rule.
55
65
  * @param {Rule} rule current rule
56
66
  */
67
+
68
+
57
69
  function removeIfOppsiteDirRule(rule, direction, rootOptions) {
58
70
  // console.log({ rule, type: rule.type });
59
- const selectors = rule.selector.split(/\s*,\s*/);
60
-
61
- // NOTE: if we use opposite dir selector as custom override reason,
71
+ const selectors = rule.selector.split(/\s*,\s*/); // NOTE: if we use opposite dir selector as custom override reason,
62
72
  // and compain normal selector with it, In this case
63
73
  // we just a have to remove that selector only not full rule
74
+
64
75
  const oppositeDirRegex = getOppositeRegex(direction);
65
76
  let remainingSelectors = selectors.filter(selector => !oppositeDirRegex.test(selector));
77
+
66
78
  if (!rootOptions.disableMinifySelector) {
67
79
  remainingSelectors = remainingSelectors.map(selector => selectorMinifySameDir(selector, direction));
68
80
  }
81
+
69
82
  if (remainingSelectors.length) {
70
83
  rule.selector = remainingSelectors.join(', ');
71
84
  } else {
@@ -73,14 +86,17 @@ function removeIfOppsiteDirRule(rule, direction, rootOptions) {
73
86
  rule.remove();
74
87
  }
75
88
  }
89
+
76
90
  function removeIfOppsiteDirKeyframe(rule, direction) {
77
91
  const name = rule.params;
78
92
  const keyFrameDirName = name.slice(name.lastIndexOf('-') + 1);
93
+
79
94
  if (keyFrameDirName === oppositeDir[direction]) {
80
95
  // console.log({ m: 'removed', keyFrameName: rule.params });
81
96
  rule.remove();
82
97
  }
83
98
  }
99
+
84
100
  function separateSingleDir(root, direction, rootOptions) {
85
101
  root.walkRules(rule => {
86
102
  removeIfOppsiteDirRule(rule, direction, rootOptions);
@@ -91,14 +107,15 @@ function separateSingleDir(root, direction, rootOptions) {
91
107
  });
92
108
  return root;
93
109
  }
110
+
94
111
  function separateRtlAndLtr(css, rootOptions) {
95
112
  // let processor = postcss([]).process(css);
96
- const root = postcss.parse(css);
97
- // let { root } = processor;
113
+ const root = postcss.parse(css); // let { root } = processor;
98
114
  // console.log(processor, root);
99
115
  // NOTE: I did first rtl then ltr , Because for ltr I use original root ref
100
- const rtlRoot = separateSingleDir(root.clone(), 'rtl', rootOptions);
101
- // console.log('############################');
116
+
117
+ const rtlRoot = separateSingleDir(root.clone(), 'rtl', rootOptions); // console.log('############################');
118
+
102
119
  const ltrRoot = separateSingleDir(root, 'ltr', rootOptions);
103
120
  return {
104
121
  ltrRoot,
@@ -106,11 +123,8 @@ function separateRtlAndLtr(css, rootOptions) {
106
123
  ltr: ltrRoot.toString(),
107
124
  rtl: rtlRoot.toString()
108
125
  };
109
- }
110
-
111
- // NOTE: to test in https://astexplorer.net/
126
+ } // NOTE: to test in https://astexplorer.net/
112
127
  // you can test with sample input https://astexplorer.net/#/gist/a892a509eb585099355ef53ef094f836/1ca70d5f7af3b88ca4910296e12f118e9712c874
113
-
114
128
  // export default postcss.plugin('postcss-rtl-remove', (options = {}) =>
115
129
  // // Work with options here
116
130
  // root => {
@@ -119,7 +133,6 @@ function separateRtlAndLtr(css, rootOptions) {
119
133
  // // root.append(postcss.comment({ text: 'comment' }));
120
134
  // root.append(postcss.comment({ text: 'this is spliting part ' }));
121
135
  // root.append(rtlRoot);
122
-
123
136
  // //console.log({root, roots:root+""}, root+"")
124
137
  // // Transform CSS AST here
125
138
  // }
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+
7
8
  /* eslint-disable no-param-reassign */
8
9
  var _default = (opts = {}) => {
9
10
  // eslint-disable-next-line no-use-before-define
@@ -14,10 +15,12 @@ var _default = (opts = {}) => {
14
15
  } = opts;
15
16
  return {
16
17
  postcssPlugin: 'postcss-selector-replace',
18
+
17
19
  Once(root) {
18
20
  root.walkRules(rule => {
19
21
  before.forEach((beforeOpt, idx) => {
20
22
  const afterOpt = after[idx];
23
+
21
24
  if (typeof beforeOpt === 'string') {
22
25
  rule.selector = rule.selector.split(beforeOpt).join(afterOpt);
23
26
  } else {
@@ -26,46 +29,60 @@ var _default = (opts = {}) => {
26
29
  });
27
30
  });
28
31
  }
32
+
29
33
  };
30
34
  };
35
+
31
36
  exports.default = _default;
37
+
32
38
  function validator(opts) {
33
39
  if (!opts || typeof opts !== 'object') {
34
40
  throw new Error('Always requires argment');
35
41
  }
42
+
36
43
  const {
37
44
  before,
38
45
  after
39
46
  } = opts;
47
+
40
48
  if (!before || !after) {
41
49
  throw new Error('Be sure to have "before" and "after" object names');
42
50
  }
51
+
43
52
  if (!Array.isArray(before) || !Array.isArray(after)) {
44
53
  throw new Error('Objects "before" and "after" must be of type Array');
45
54
  }
55
+
46
56
  if (before.length !== after.length) {
47
57
  throw new Error('Length of before and after options must be the same');
48
58
  }
59
+
49
60
  if (before.length === 0) {
50
61
  throw new Error('Array length is 1 or more');
51
62
  }
63
+
52
64
  before.forEach((beforeOpt, idx) => {
53
65
  const afterOpt = after[idx];
66
+
54
67
  switch (true) {
55
68
  case typeof beforeOpt === 'string':
56
69
  {
57
70
  if (!typeof afterOpt === 'string') {
58
71
  throw new Error(`The after option ${afterOpt} must be a string. If you want to apply the replace callback function, then use a RegExp for the before option`);
59
72
  }
73
+
60
74
  break;
61
75
  }
76
+
62
77
  case beforeOpt instanceof RegExp:
63
78
  {
64
79
  if (!typeof afterOpt === 'string' && !typeof afterOpt === 'function') {
65
80
  throw new Error(`The after option ${afterOpt} must be either a string, or a function`);
66
81
  }
82
+
67
83
  break;
68
84
  }
85
+
69
86
  default:
70
87
  throw new Error(`The before option ${beforeOpt} must be either a string, or a RegExp`);
71
88
  }
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- const diffBasedOnStrLength = (a, b) => b.length - a.length;
8
7
 
8
+ const diffBasedOnStrLength = (a, b) => b.length - a.length;
9
9
  /**
10
10
  * @param {Array} valueReplacer
11
11
  * [
@@ -17,12 +17,15 @@ const diffBasedOnStrLength = (a, b) => b.length - a.length;
17
17
  }
18
18
  ]
19
19
  */
20
+
21
+
20
22
  const PostcssValueReplacer = (valueReplacer = []) => {
21
23
  const options = {};
22
24
  valueReplacer.forEach(obj => {
23
25
  obj.props.forEach(prop => {
24
26
  const valueKeys = Object.keys(obj.values);
25
27
  const propOptions = options[prop];
28
+
26
29
  if (options[prop]) {
27
30
  valueKeys.forEach(k => {
28
31
  propOptions.values[k] = obj.values[k];
@@ -35,8 +38,8 @@ const PostcssValueReplacer = (valueReplacer = []) => {
35
38
  };
36
39
  }
37
40
  });
38
- });
39
- // Work with options here
41
+ }); // Work with options here
42
+
40
43
  return {
41
44
  postcssPlugin: 'postcss-value-replacer',
42
45
  Declaration: decl => {
@@ -48,5 +51,7 @@ const PostcssValueReplacer = (valueReplacer = []) => {
48
51
  }
49
52
  };
50
53
  };
54
+
51
55
  PostcssValueReplacer.postcss = true;
52
- var _default = exports.default = PostcssValueReplacer;
56
+ var _default = PostcssValueReplacer;
57
+ exports.default = _default;
@@ -4,10 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+
7
8
  var _fs = _interopRequireDefault(require("fs"));
9
+
8
10
  var _path = _interopRequireDefault(require("path"));
11
+
9
12
  var _ErrorHandler = require("../../../bundler/webpack/custom_plugins/VariableConversionCollector/ErrorHandler");
10
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
11
16
  const convertableProps = {
12
17
  'font-size': true,
13
18
  margin: true,
@@ -52,30 +57,35 @@ const constantValues = {
52
57
  center: true,
53
58
  right: true
54
59
  };
60
+
55
61
  function getNumericValue(value) {
56
62
  if (value.includes('var')) {
57
63
  return parseInt(value.replace(/var\(--zd_size(\d+)\)/gi, '$1').replace(/var\(--zd_font_size(\d+)\)/gi, '$1'));
58
64
  }
65
+
59
66
  if (value.includes('rect')) {
60
67
  return parseInt(value.replace('rect(', '').replace(')', '').replace(',', ''));
61
- }
62
- // Not need for this dum loop
68
+ } // Not need for this dum loop
63
69
  // allowed.forEach(alwdUnit => {
64
70
  // if (value.includes(alwdUnit)) {
65
71
  // return parseInt(value);
66
72
  // }
67
73
  // });
68
74
 
75
+
69
76
  if (constantValues[value.toLowerCase()]) {
70
77
  return 1;
71
78
  }
79
+
72
80
  return parseInt(value);
73
81
  }
82
+
74
83
  function pxToCalc(value) {
75
84
  const arr = value.split(' ');
76
85
  arr.forEach((val, index) => {
77
86
  ['px'].forEach(unit => {
78
87
  const valWithUnit = new RegExp(`(\\d+)${unit}`, 'gi');
88
+
79
89
  if (valWithUnit.test(val)) {
80
90
  arr[index] = val.replace(valWithUnit, '(var(--zd_size$1))');
81
91
  }
@@ -83,31 +93,38 @@ function pxToCalc(value) {
83
93
  });
84
94
  return arr.join(' ');
85
95
  }
96
+
86
97
  const singleConvertor = (value, changeVal, details, range) => {
87
98
  const {
88
99
  path,
89
100
  filename,
90
101
  decl
91
102
  } = details;
103
+
92
104
  if (decl.prop === 'background-position') {
93
105
  if (isNaN(parseInt(value))) {
94
106
  // console.log(`${value} skipped`);
95
107
  return;
96
108
  }
97
109
  }
110
+
98
111
  if (value == '0px') {
99
112
  value = value.replace('px', '');
100
113
  }
114
+
101
115
  if (getNumericValue(value) >= range.start && getNumericValue(value) <= range.end || getNumericValue(value) === 0) {
102
116
  let retVal = value.replace(/(\d+)px/gi, changeVal.replace('$$', '$1'));
117
+
103
118
  if (/^-var/.test(retVal)) {
104
119
  retVal = `calc( ${retVal.substring(1)} * -1 )`;
105
120
  }
121
+
106
122
  return retVal;
107
- }
108
- // if (!value.includes('rect')) {
123
+ } // if (!value.includes('rect')) {
109
124
  // if(unitErrorVal && unitErrorVal != '0' ){
110
125
  // console.log(value, 'not within range')
126
+
127
+
111
128
  const errObj = {
112
129
  decl,
113
130
  type: 'RANGE_ERROR',
@@ -115,9 +132,10 @@ const singleConvertor = (value, changeVal, details, range) => {
115
132
  message: `value (${value}) (${typeof value}) not within range (${range.start},${range.end})\r`,
116
133
  path
117
134
  };
135
+
118
136
  _ErrorHandler.errHandler.errorTable.push(errObj);
119
- _ErrorHandler.errHandler.errorFunction(errObj);
120
- // errorFunction(
137
+
138
+ _ErrorHandler.errHandler.errorFunction(errObj); // errorFunction(
121
139
  // {
122
140
  // decl,
123
141
  // type: 'RANGE_ERROR',
@@ -135,20 +153,24 @@ const singleConvertor = (value, changeVal, details, range) => {
135
153
  // } else {
136
154
  // console.log('++++++++++++++++++++++rect val!', value);
137
155
  // }
156
+
138
157
  };
158
+
139
159
  var _default = ({
140
160
  configFile
141
161
  }) => {
142
162
  const rawdata = _fs.default.readFileSync(configFile);
163
+
143
164
  const data = JSON.parse(rawdata);
144
165
  const {
145
166
  errorsAllowed,
146
- settings: settingsObject
147
- // errorLog: errorLogStatus,
167
+ settings: settingsObject // errorLog: errorLogStatus,
148
168
  // errorInConsole: errorConsoleStatus
149
- } = data;
150
- // const keys = Object.keys(settingsObject);
169
+
170
+ } = data; // const keys = Object.keys(settingsObject);
171
+
151
172
  _ErrorHandler.errHandler.setAllowedErrs(errorsAllowed);
173
+
152
174
  const replacementArray = [];
153
175
  Object.keys(settingsObject).forEach(key => {
154
176
  Object.values(settingsObject[key].replacements).forEach(val => {
@@ -176,12 +198,12 @@ var _default = ({
176
198
  // case font-size
177
199
  const commentStr = 'variable:ignore';
178
200
  const prevNode = rule.nodes[position - 1];
179
- const fromPath = rootOriginal.source.input.from;
180
- // this will be problem for linux and mac use require('path').sep
201
+ const fromPath = rootOriginal.source.input.from; // this will be problem for linux and mac use require('path').sep
181
202
  // split not need use slice and lastIndexOf less memory
182
- const filename = fromPath.split(_path.default.sep).pop();
183
- // if(filename.includes('AddFormResponsive.module.css'){
203
+
204
+ const filename = fromPath.split(_path.default.sep).pop(); // if(filename.includes('AddFormResponsive.module.css'){
184
205
  // }
206
+
185
207
  if (prevNode && prevNode.type === 'comment' && prevNode.text.toLowerCase().includes(commentStr)) {
186
208
  const errObj = {
187
209
  decl,
@@ -190,31 +212,33 @@ var _default = ({
190
212
  message: 'Declaration Ignored',
191
213
  path: fromPath
192
214
  };
215
+
193
216
  _ErrorHandler.errHandler.errorTable.push(errObj);
217
+
194
218
  _ErrorHandler.errHandler.DECLARATION_IGNORED(errObj);
219
+
195
220
  return;
196
221
  }
222
+
197
223
  if (settingsObject[decl.prop] && !decl.value.includes('var(--')) {
198
- const settings = settingsObject[decl.prop];
199
- // console.log(settings)
224
+ const settings = settingsObject[decl.prop]; // console.log(settings)
225
+
200
226
  const {
201
227
  allowed,
202
228
  range
203
- } = settings;
204
- // suggestion filter !decl.value.includes('calc')
229
+ } = settings; // suggestion filter !decl.value.includes('calc')
205
230
  // Reason below some of logic happen based on this
206
- const unit = decl.value.toString()
207
- // no need round braket since you do not need group for less memory
208
- .replace(/\d+/gi, '').replace('var(--zd_size)', 'px').replace('var(--zd_font_size)', 'px').replace('rect(', '').replace(')', '').replace('px,', 'px').replace(',', '').split(' ').filter(x => x !== '');
209
- // unit = unit.replace(unit, unit.replace('-',''))
231
+
232
+ const unit = decl.value.toString() // no need round braket since you do not need group for less memory
233
+ .replace(/\d+/gi, '').replace('var(--zd_size)', 'px').replace('var(--zd_font_size)', 'px').replace('rect(', '').replace(')', '').replace('px,', 'px').replace(',', '').split(' ').filter(x => x !== ''); // unit = unit.replace(unit, unit.replace('-',''))
210
234
  // console.log('unit : ');
211
235
  // console.log(unit);
236
+
212
237
  unit.forEach((val, index) => {
213
238
  allowed.forEach(alwdVal => {
214
239
  if (val.includes(alwdVal)) {
215
240
  // ## for what purpose
216
- unit[index] = val
217
- // .replace(new RegExp('(\\d+).(\\d+)(\\w+)', 'gi'), '$3')
241
+ unit[index] = val // .replace(new RegExp('(\\d+).(\\d+)(\\w+)', 'gi'), '$3')
218
242
  .replace(`-${alwdVal}`, `${alwdVal}`).replace(`-.${alwdVal}`, `${alwdVal}`).replace(`${alwdVal},`, `${alwdVal}`);
219
243
  }
220
244
  });
@@ -228,8 +252,8 @@ var _default = ({
228
252
  unitErrorVal = val;
229
253
  }
230
254
  }
231
- });
232
- // console.log(allowed, replacements, range)
255
+ }); // console.log(allowed, replacements, range)
256
+
233
257
  if (!unitError) {
234
258
  // use variable decl.value.split(' ')
235
259
  if (range) {
@@ -252,20 +276,27 @@ var _default = ({
252
276
  unitErrorVal,
253
277
  path: fromPath
254
278
  };
279
+
255
280
  if (unitErrorVal.trim() === '.') {
256
281
  errObj.type = 'DECIMAL_CHECK';
257
282
  errObj.message = `${unitErrorVal} (Decimal Value) Please check`;
283
+
258
284
  _ErrorHandler.errHandler.errorTable.push(errObj);
285
+
259
286
  _ErrorHandler.errHandler.DECIMAL_CHECK(errObj);
260
287
  } else if (unitErrorVal.includes('.') && !unitErrorVal.includes('%')) {
261
288
  errObj.type = 'DECIMAL_REJECT';
262
289
  errObj.message = `${unitErrorVal} (Decimal Value) Not Allowed \r`;
290
+
263
291
  _ErrorHandler.errHandler.errorTable.push(errObj);
292
+
264
293
  _ErrorHandler.errHandler.DECIMAL_REJECT(errObj);
265
294
  } else if (!unitErrorVal.includes('%')) {
266
295
  errObj.type = 'UNIT_ERROR';
267
296
  errObj.message = `${unitErrorVal} (Unit) Not Allowed`;
297
+
268
298
  _ErrorHandler.errHandler.errorTable.push(errObj);
299
+
269
300
  _ErrorHandler.errHandler.UNIT_ERROR(errObj);
270
301
  }
271
302
  } else {
@@ -287,10 +318,12 @@ var _default = ({
287
318
  }, range);
288
319
  return convertedVal || val;
289
320
  }
321
+
290
322
  return val;
291
323
  });
292
324
  decl.value = convertedVals.join(' ');
293
325
  }
326
+
294
327
  if (decl.prop && decl.value && !decl.prop.includes('--') && valRegex.test(decl.value) && (settingsObject[decl.prop] || convertableProps[decl.prop]) && decl.value.includes('var') && !decl.value.includes('calc')) {
295
328
  const errObj = {
296
329
  decl,
@@ -299,7 +332,9 @@ var _default = ({
299
332
  message: `value (${decl.value}) has var in it, kindly check`,
300
333
  path: fromPath
301
334
  };
335
+
302
336
  _ErrorHandler.errHandler.errorTable.push(errObj);
337
+
303
338
  _ErrorHandler.errHandler.VARIABLE_PRESENT(errObj);
304
339
  }
305
340
  }
@@ -308,4 +343,5 @@ var _default = ({
308
343
  }
309
344
  };
310
345
  };
346
+
311
347
  exports.default = _default;
@@ -7,41 +7,49 @@ exports.filterCustomPluginsAllowedForSpecificFile = filterCustomPluginsAllowedFo
7
7
  exports.filterPluginsAllowedForSpecificFile = filterPluginsAllowedForSpecificFile;
8
8
  exports.getEnabledPlugins = getEnabledPlugins;
9
9
  exports.mapDefaultSupportedPlugins = mapDefaultSupportedPlugins;
10
+
10
11
  var _checkIsPatternsMatchFilename = require("../bundler/webpack/loaderConfigs/checkIsPatternsMatchFilename");
12
+
11
13
  var _getSpecificPostCssPlugin = require("./getSpecificPostCssPlugin");
12
- /* eslint-disable no-use-before-define */
13
14
 
15
+ /* eslint-disable no-use-before-define */
14
16
  function mapDefaultSupportedPlugins(pluginsOptions) {
15
- return _getSpecificPostCssPlugin.supportedPluginsOptionNames.map(pluginName => ({
16
- ...pluginsOptions[pluginName],
17
+ return _getSpecificPostCssPlugin.supportedPluginsOptionNames.map(pluginName => ({ ...pluginsOptions[pluginName],
17
18
  pluginName
18
19
  }));
19
20
  }
21
+
20
22
  function getEnabledPlugins(pluginsOptions) {
21
23
  function isEnabled(pluginName) {
22
24
  return pluginsOptions[pluginName].enable;
23
25
  }
24
- return _getSpecificPostCssPlugin.supportedPluginsOptionNames.filter(isEnabled).map(pluginName => ({
25
- ...pluginsOptions[pluginName],
26
+
27
+ return _getSpecificPostCssPlugin.supportedPluginsOptionNames.filter(isEnabled).map(pluginName => ({ ...pluginsOptions[pluginName],
26
28
  pluginName
27
29
  }));
28
30
  }
31
+
29
32
  function filterPluginsAllowedForSpecificFile(plugins, filename) {
30
33
  return plugins.filter(pluginOption => checkIsPluginAllowed(pluginOption, filename)).map(pluginOption => (0, _getSpecificPostCssPlugin.getSpecificPostCssPlugin)(pluginOption)).filter(Boolean);
31
34
  }
35
+
32
36
  function checkIsPluginAllowed(pluginOption, filename) {
33
37
  return (0, _checkIsPatternsMatchFilename.checkIsPatternsMatchFilename)(pluginOption.patterns, filename);
34
38
  }
39
+
35
40
  function getCustomPlugins(pluginOption) {
36
41
  if (typeof pluginOption.plugin === 'string') {
37
42
  // eslint-disable-next-line import/no-dynamic-require, global-require
38
43
  return require(pluginOption.plugin).plugin(pluginOption);
39
44
  }
45
+
40
46
  if (typeof pluginOption.plugin === 'function') {
41
47
  return pluginOption.plugin(pluginOption);
42
48
  }
49
+
43
50
  return null;
44
51
  }
52
+
45
53
  function filterCustomPluginsAllowedForSpecificFile(customPlugins, filename) {
46
54
  return customPlugins.filter(pluginOption => checkIsPluginAllowed(pluginOption, filename)).map(getCustomPlugins).filter(Boolean);
47
55
  }