@zohodesk/react-cli 1.1.8 → 1.1.10

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.
@@ -13,25 +13,25 @@ var _path = require("path");
13
13
  const isWindows = _path.sep !== '/'; // this function will return true if pattern matched
14
14
 
15
15
  function _testPattern(req, pattern) {
16
- let modifyedPattern = pattern;
16
+ let modifiedPattern = pattern;
17
17
 
18
- if (/[*.$^]/.test(modifyedPattern)) {
18
+ if (/[*.$^]/.test(modifiedPattern)) {
19
19
  if (isWindows) {
20
- // modifyedPattern = pattern.replace(/\//g, ps.replace(/\\/g, '\\\\'));
21
- modifyedPattern = modifyedPattern.replace(/\//g, '\\\\');
20
+ // modifiedPattern = pattern.replace(/\//g, ps.replace(/\\/g, '\\\\'));
21
+ modifiedPattern = modifiedPattern.replace(/\//g, '\\\\');
22
22
  }
23
23
 
24
- modifyedPattern = modifyedPattern.replace(/\./g, '\\.').replace(/\*/g, '.*');
25
- const re = new RegExp(modifyedPattern);
24
+ modifiedPattern = modifiedPattern.replace(/\./g, '\\.').replace(/\*/g, '.*');
25
+ const re = new RegExp(modifiedPattern);
26
26
  return re.test(req);
27
27
  }
28
28
 
29
29
  if (isWindows) {
30
- // modifyedPattern = pattern.replace(/\//g, ps.replace(/\\/g, '\\\\'));
31
- modifyedPattern = modifyedPattern.replace(/\//g, '\\');
30
+ // modifiedPattern = pattern.replace(/\//g, ps.replace(/\\/g, '\\\\'));
31
+ modifiedPattern = modifiedPattern.replace(/\//g, '\\');
32
32
  }
33
33
 
34
- return req.indexOf(modifyedPattern) !== -1;
34
+ return req.indexOf(modifiedPattern) !== -1;
35
35
  }
36
36
 
37
37
  function testPattern(req, pattern) {
@@ -39,7 +39,8 @@ const {
39
39
  selectorReplace,
40
40
  devConsoleExculde,
41
41
  sourcemap,
42
- crossorigin
42
+ crossorigin,
43
+ postCssPluginOrder
43
44
  }
44
45
  } = options;
45
46
  const {
@@ -109,7 +110,8 @@ module.exports = {
109
110
  selectorWeightConfig,
110
111
  classNameBlob: '[local]',
111
112
  cssUniqueness: false,
112
- selectorReplace: null
113
+ selectorReplace: null,
114
+ postCssPluginOrder
113
115
  })
114
116
  } : null, {
115
117
  test: seperateCssModules ? /\.module\.css$/ : /(\.module)?\.css$/,
@@ -124,7 +126,8 @@ module.exports = {
124
126
  cssUniqueness,
125
127
  selectorReplace,
126
128
  cssHashSelectors,
127
- classNamePrefix
129
+ classNamePrefix,
130
+ postCssPluginOrder
128
131
  })
129
132
  }, (0, _configsAssetsLoaders.configImageLoader)(nameTemplate), (0, _configsAssetsLoaders.configFontLoader)(nameTemplate), (0, _configsAssetsLoaders.configSVGLoader)(nameTemplate), (0, _configsAssetsLoaders.configVideoLoader)(nameTemplate), (0, _configsAssetsLoaders.configAudioLoader)(nameTemplate), {
130
133
  test: /\.tmpl$/,
@@ -28,7 +28,8 @@ const {
28
28
  selectorWeightConfig,
29
29
  cssHashSelectors,
30
30
  classNamePrefix,
31
- selectorReplace
31
+ selectorReplace,
32
+ postCssPluginOrder
32
33
  },
33
34
  app: {
34
35
  folder
@@ -87,7 +88,8 @@ module.exports = isSSTest => ({
87
88
  cssUniqueness,
88
89
  selectorReplace,
89
90
  cssHashSelectors,
90
- classNamePrefix
91
+ classNamePrefix,
92
+ postCssPluginOrder
91
93
  })
92
94
  }, (0, _configsAssetsLoaders.configImageLoader)(nameTemplate), (0, _configsAssetsLoaders.configFontLoader)(nameTemplate), (0, _configsAssetsLoaders.configSVGLoader)(nameTemplate), (0, _configsAssetsLoaders.configAudioLoader)(nameTemplate), (0, _configsAssetsLoaders.configVideoLoader)(nameTemplate), {
93
95
  test: /\.html$/,
@@ -27,7 +27,8 @@ const {
27
27
  selectorWeightConfig,
28
28
  cssHashSelectors,
29
29
  enableChunkHash,
30
- classNamePrefix
30
+ classNamePrefix,
31
+ postCssPluginOrder
31
32
  },
32
33
  app: {
33
34
  folder
@@ -86,7 +87,8 @@ module.exports = {
86
87
  cssUniqueness,
87
88
  selectorReplace: null,
88
89
  cssHashSelectors,
89
- classNamePrefix
90
+ classNamePrefix,
91
+ postCssPluginOrder
90
92
  })
91
93
  }, (0, _configsAssetsLoaders.configImageLoader)(nameTemplate), (0, _configsAssetsLoaders.configFontLoader)(nameTemplate), (0, _configsAssetsLoaders.configSVGLoader)(nameTemplate), (0, _configsAssetsLoaders.configAudioLoader)(nameTemplate), (0, _configsAssetsLoaders.configVideoLoader)(nameTemplate), {
92
94
  test: /\.html$/,
@@ -44,7 +44,8 @@ const {
44
44
  selectorReplace,
45
45
  removePropTypes,
46
46
  devConsoleExculde,
47
- crossorigin
47
+ crossorigin,
48
+ postCssPluginOrder
48
49
  }
49
50
  } = options;
50
51
  let {
@@ -160,7 +161,8 @@ module.exports = {
160
161
  mediaQueryHoverActiveString,
161
162
  classNameBlob: '[local]',
162
163
  cssUniqueness: false,
163
- selectorReplace: null
164
+ selectorReplace: null,
165
+ postCssPluginOrder
164
166
  })
165
167
  } : null, {
166
168
  test: seperateCssModules ? /\.module\.css$/ : /\.css$/,
@@ -175,7 +177,8 @@ module.exports = {
175
177
  cssUniqueness,
176
178
  selectorReplace,
177
179
  cssHashSelectors,
178
- classNamePrefix
180
+ classNamePrefix,
181
+ postCssPluginOrder
179
182
  })
180
183
  }, {
181
184
  test: /\.jpe?g$|\.gif$|\.png$/,
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.deprecateMessage = deprecateMessage;
7
+ exports.deprecateOption = deprecateOption;
8
+ exports.deprecationLoggerEnd = deprecationLoggerEnd;
9
+
10
+ var _logger = require("./logger");
11
+
12
+ function deprecateMessage(message) {
13
+ // eslint-disable-next-line no-use-before-define
14
+ deprecationLoggerStart();
15
+ (0, _logger.messageLogger)('\x1b[36m%s\x1b[0m', message);
16
+ }
17
+
18
+ function printLine() {
19
+ deprecateMessage('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! \n ');
20
+ }
21
+
22
+ let isFirstDeprecation = false;
23
+
24
+ function deprecateOption(previousObjPath = '', newObjPath = '', message = '') {
25
+ deprecateMessage(`Please move "${previousObjPath.split('.').join(' > ')}" to "${newObjPath.split('.').join(' > ')}" following option ${message}`);
26
+ }
27
+
28
+ function deprecationLoggerStart() {
29
+ if (!isFirstDeprecation) {
30
+ isFirstDeprecation = true;
31
+ printLine();
32
+ }
33
+ }
34
+
35
+ function deprecationLoggerEnd() {
36
+ if (isFirstDeprecation) {
37
+ isFirstDeprecation = false;
38
+ printLine();
39
+ }
40
+ }
@@ -18,6 +18,20 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
18
18
  const fs = require('fs');
19
19
 
20
20
  const options = (0, _utils.getOptions)();
21
+ const defaultPostCssPluginOrder = ['valueReplacer', 'selectorReplace', 'hasRTL', 'hoverActive', 'combinerMediaQuery', 'cssVariableReplacement', 'selectorWeight', 'minifier', 'composeMinification'];
22
+
23
+ function calculatePostCssPluginOrder(postCssPluginOrder, pluginOrder) {
24
+ // if(typeof postCssPluginOrder === Boolean)
25
+ if (Array.isArray(postCssPluginOrder)) {
26
+ return postCssPluginOrder;
27
+ }
28
+
29
+ if (postCssPluginOrder) {
30
+ return pluginOrder;
31
+ }
32
+
33
+ return defaultPostCssPluginOrder.filter(value => pluginOrder.includes(value));
34
+ }
21
35
 
22
36
  const getCSSLoaders = optionsObj => {
23
37
  const {
@@ -29,7 +43,8 @@ const getCSSLoaders = optionsObj => {
29
43
  cssUniqueness,
30
44
  selectorReplace,
31
45
  cssHashSelectors,
32
- classNamePrefix
46
+ classNamePrefix,
47
+ postCssPluginOrder
33
48
  } = optionsObj;
34
49
  const {
35
50
  devCssFileBountry
@@ -51,10 +66,11 @@ const getCSSLoaders = optionsObj => {
51
66
  cssLoaderOptions.modules.localIdentName = classNameBlob;
52
67
  } else {
53
68
  cssLoaderOptions.modules.getLocalIdent = (0, _cssClassNameGenerate.default)(cssUniqueness, cssHashSelectors, classNamePrefix, patterns);
54
- } // console.log('selector weight config : ', selectorWeightConfig);
69
+ }
55
70
 
71
+ const pluginOrder = calculatePostCssPluginOrder(postCssPluginOrder, Object.keys(plugins).filter(x => plugins[x] === true)); // console.log('selector weight config : ', selectorWeightConfig);
56
72
 
57
- let postcssPlugins = [plugins.valueReplacer && require('../postcss-plugins/ValueReplacer')(valueReplacer), plugins.selectorReplace && require('../postcss-plugins/SelectorReplace')(selectorReplace), plugins.hasRTL && require('@zohodesk/postcss-rtl')({
73
+ const postcssPlugins = [plugins.valueReplacer && require('../postcss-plugins/ValueReplacer')(valueReplacer), plugins.hasRTL && require('@zohodesk/postcss-rtl')({
58
74
  addPrefixToSelector: function addPrefixToSelector(selector, prefix) {
59
75
  if (prefix === '[dir]') {
60
76
  return selector;
@@ -62,7 +78,7 @@ const getCSSLoaders = optionsObj => {
62
78
 
63
79
  return `${prefix} ${selector}`; // Make selectors like [dir=rtl] > .selector
64
80
  }
65
- }), 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) // ,
81
+ }), 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) // ,
66
82
  // plugins.composeMinification &&
67
83
  // require('../postcss-plugins/composePlugin')()
68
84
  ].filter(Boolean);
@@ -141,13 +157,14 @@ const getCSSLoaders = optionsObj => {
141
157
  */
142
158
  // console.log(params.resourcePath);
143
159
  // console.log(postcssPlugins);
144
- const finalpostcssPlugins = (0, _fileHandling.isFileNameMatchingPattern)({
160
+ const finalPostcssPlugins = (0, _fileHandling.isFileNameMatchingPattern)({
145
161
  filename: params.resourcePath,
146
162
  filterObject: patterns,
147
- plugins: postcssPlugins
163
+ plugins: postcssPlugins,
164
+ order: pluginOrder
148
165
  }); // postcssPlugins that are allowed
149
166
 
150
- return finalpostcssPlugins.length > 0 ? finalpostcssPlugins : [require('../postcss-plugins/EmptyPlugin')()];
167
+ return finalPostcssPlugins.length > 0 ? finalPostcssPlugins : [require('../postcss-plugins/EmptyPlugin')()];
151
168
  }
152
169
  }
153
170
  } : null, plugins.composeMinification ? {
@@ -72,7 +72,8 @@ const getDevPlugins = (options, publicPath) => {
72
72
  enableRTLSplit
73
73
  },
74
74
  i18n,
75
- unusedFiles
75
+ unusedFiles,
76
+ resourceHints
76
77
  } = options;
77
78
  const hasEFC = newOptionForEnableEFC || prevOptionForEnableEFC;
78
79
  const cssLTRFileNameTempalte = enableRTLSplit ? 'css/[name].ltr.css' : 'css/[name].css';
@@ -94,7 +95,7 @@ const getDevPlugins = (options, publicPath) => {
94
95
  filename: cssLTRFileNameTempalte,
95
96
  // ignoreOrder: true,
96
97
  chunkFilename: cssLTRFileNameTempalte
97
- }), new _plugins.ResourceHintsPlugin()];
98
+ }), new _plugins.ResourceHintsPlugin(resourceHints)];
98
99
 
99
100
  if (enableRTLSplit) {
100
101
  pluginsArr.push(new _RtlCssPlugin.RtlCssPlugin({
@@ -107,7 +107,7 @@ const getProdPlugins = (options, publicPath = '') => {
107
107
  // ignoreOrder: true,
108
108
  filename: cssLTRFileNameTempalte,
109
109
  chunkFilename: cssLTRFileNameTempalte
110
- }), new _plugins.ResourceHintsPlugin(), new _plugins.MinifyPlugin()];
110
+ }), new _plugins.ResourceHintsPlugin(options.resourceHints), new _plugins.MinifyPlugin()];
111
111
 
112
112
  if (enableRTLSplit) {
113
113
  pluginsArr.push(new _RtlCssPlugin.RtlCssPlugin({
@@ -13,6 +13,8 @@ var _redis = _interopRequireDefault(require("redis"));
13
13
 
14
14
  var _utils = require("../utils");
15
15
 
16
+ var _log = require("../utils/log");
17
+
16
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
19
 
18
20
  let options = (0, _utils.getOptions)();
@@ -68,10 +70,10 @@ class reportGeneratePlugin {
68
70
  let client = _redis.default.createClient(redisPort, redisHost);
69
71
 
70
72
  client.on('connect', () => {
71
- (0, _utils.log)('Redis client connected');
73
+ (0, _log.log)('Redis client connected');
72
74
  });
73
75
  client.on('error', err => {
74
- (0, _utils.log)(`Something went wrong ${err}`);
76
+ (0, _log.log)(`Something went wrong ${err}`);
75
77
  });
76
78
 
77
79
  if (_fs.default.existsSync(_path.default.resolve(process.cwd(), 'build', 'stats.json'))) {
@@ -80,7 +82,7 @@ class reportGeneratePlugin {
80
82
  statsJSON = JSON.parse(statsJSON);
81
83
  let finalObj = {};
82
84
  let branchName = branch ? branch : (0, _utils.getCurrentBranch)();
83
- (0, _utils.log)(branchName);
85
+ (0, _log.log)(branchName);
84
86
  statsJSON.assets.forEach(assetObj => {
85
87
  let nameSplitList = assetObj.name.split('/')[assetObj.name.split('/').length - 1].split('.'); // eslint-disable-line
86
88
 
@@ -111,7 +113,7 @@ class reportGeneratePlugin {
111
113
  };
112
114
  client.get(branchName, (err, reply) => {
113
115
  if (err) {
114
- (0, _utils.log)(err);
116
+ (0, _log.log)(err);
115
117
  } else {
116
118
  reply = JSON.parse(reply); // eslint-disable-line
117
119
 
@@ -147,7 +149,7 @@ class reportGeneratePlugin {
147
149
  throw err;
148
150
  }
149
151
 
150
- (0, _utils.log)('Stats Json generated!');
152
+ (0, _log.log)('Stats Json generated!');
151
153
  });
152
154
  }
153
155
  });
@@ -169,7 +171,7 @@ class reportGeneratePlugin {
169
171
  }
170
172
 
171
173
  if (err) {
172
- (0, _utils.log)(err);
174
+ (0, _log.log)(err);
173
175
  }
174
176
  });
175
177
  }
@@ -12,14 +12,21 @@ const {
12
12
  const pluginName = 'prefetch-preload-chunk-plugin';
13
13
 
14
14
  class ResourceHintsPlugin {
15
+ constructor(options) {
16
+ this.options = options;
17
+ }
18
+
15
19
  apply(compiler) {
16
20
  compiler.hooks.thisCompilation.tap(pluginName, ({
17
21
  mainTemplate
18
22
  }) => {
19
23
  mainTemplate.hooks.requireExtensions.tap(pluginName, (source, chunk, hash) => {
24
+ const {
25
+ allowPrefetchingMultipleChunks
26
+ } = this.options;
20
27
  const idNameMap = chunk.getChunkMaps().name;
21
28
  const nameIdMap = {};
22
- let needsMap = false;
29
+ let needsMap = allowPrefetchingMultipleChunks;
23
30
 
24
31
  for (const key in idNameMap) {
25
32
  if (Object.prototype.hasOwnProperty.call(idNameMap, key)) {
@@ -32,7 +39,10 @@ class ResourceHintsPlugin {
32
39
  }
33
40
  }
34
41
 
35
- return Template.asString([source, '', `${mainTemplate.requireFn}.getChunkId = function getChunkId(chunkId) {`, Template.indent((needsMap ? [`chunkId = ${JSON.stringify(nameIdMap)}[chunkId]||chunkId;`] : []).concat(['return chunkId;'])), '}', `// Prefetch a chunk (${pluginName})`, `${mainTemplate.requireFn}.pfc = function prefetchChunk(chunkId) {`, Template.indent([`chunkId = ${mainTemplate.requireFn}.getChunkId(chunkId)`, `${mainTemplate.requireFn}.e(chunkId);`]), '};',
42
+ return Template.asString([source, Template.indent([`const nameToChunkIdMap = ${JSON.stringify(needsMap ? nameIdMap : {})};`, 'const chunkNames = Object.keys(nameToChunkIdMap);']), `${mainTemplate.requireFn}.getChunkIds = function getChunkIds(chunkId) {`, Template.indent([allowPrefetchingMultipleChunks ? `const isRegExAsChunkId = chunkId instanceof RegExp;
43
+ return isRegExAsChunkId ? chunkNames.filter(chunkName => chunkId.test(chunkName)).map(chunkName => nameToChunkIdMap[chunkName]) : [nameToChunkIdMap[chunkId] || chunkId];` : needsMap ? 'return [nameToChunkIdMap[chunkId] || chunkId];' : 'return [chunkId];']), '}', `// Prefetch a chunk (${pluginName})`, `${mainTemplate.requireFn}.pfc = function prefetchChunk(chunkId) {`, Template.indent([`let chunkIds = ${mainTemplate.requireFn}.getChunkIds(chunkId)`, `chunkIds.forEach(idOfAChunk => {
44
+ ${mainTemplate.requireFn}.e(idOfAChunk);
45
+ })`]), '};',
36
46
  /*
37
47
  (needsMap
38
48
  ? [`chunkId = ${JSON.stringify(nameIdMap)}[chunkId]||chunkId;`]
@@ -53,7 +63,7 @@ class ResourceHintsPlugin {
53
63
  ),
54
64
  '}',
55
65
  */
56
- `// Preload a chunk (${pluginName})`, `${mainTemplate.requireFn}.plc = function preloadChunk(chunkId) {`, Template.indent([`chunkId = ${mainTemplate.requireFn}.getChunkId(chunkId)`, 'if(installedChunks[chunkId] === undefined) {', Template.indent(['installedChunks[chunkId] = null;', mainTemplate.hooks.linkPreload.call('', chunk, hash), 'document.head.appendChild(link);', `${mainTemplate.requireFn}.e(chunkId);` // 'var head = document.getElementsByTagName(\'head\')[0];',
66
+ `// Preload a chunk (${pluginName})`, `${mainTemplate.requireFn}.plc = function preloadChunk(chunkId) {`, Template.indent([`chunkId = ${mainTemplate.requireFn}.getChunkIds(chunkId)[0]`, 'if(installedChunks[chunkId] === undefined) {', Template.indent(['installedChunks[chunkId] = null;', mainTemplate.hooks.linkPreload.call('', chunk, hash), 'document.head.appendChild(link);', `${mainTemplate.requireFn}.e(chunkId);` // 'var head = document.getElementsByTagName(\'head\')[0];',
57
67
  // mainTemplate.hooks.jsonpScript.call('', chunk, hash),
58
68
  // 'head.appendChild(script);'
59
69
  ]), '}']), '};']);
@@ -11,6 +11,8 @@ var _fs = _interopRequireDefault(require("fs"));
11
11
 
12
12
  var _utils = require("../utils");
13
13
 
14
+ var _log = require("../utils/log");
15
+
14
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
17
 
16
18
  let excludeDocsJSON = '{}';
@@ -97,10 +99,10 @@ class UnusedFilesFindPlugin {
97
99
  Object.keys(unDocsCompObj).forEach(key => {
98
100
  if (unDocsCompObj[key].length > 0) {
99
101
  if (key === 'withoutDocs') {
100
- (0, _utils.log)('\x1b[36m%s\x1b[0m', '\nPlease write docs file for below componenst :- \n');
102
+ (0, _log.log)('\x1b[36m%s\x1b[0m', '\nPlease write docs file for below componenst :- \n');
101
103
  unDocsCompObj[key].forEach(value => {
102
104
  if (!excludeDocsArray.docs.exclude.includes(value)) {
103
- (0, _utils.log)('\x1b[33m%s\x1b[0m', `${value}`);
105
+ (0, _log.log)('\x1b[33m%s\x1b[0m', `${value}`);
104
106
  }
105
107
  });
106
108
  }
@@ -162,10 +164,10 @@ class UnusedFilesFindPlugin {
162
164
  });
163
165
 
164
166
  if (!unusedFiles.length) {
165
- (0, _utils.log)('There is no unused files');
167
+ (0, _log.log)('There is no unused files');
166
168
  } else {
167
169
  if (this.outputFileName) {
168
- (0, _utils.log)(`You can see unused files info from ${_path.default.join(outputPath, this.outputFileName)} path`);
170
+ (0, _log.log)(`You can see unused files info from ${_path.default.join(outputPath, this.outputFileName)} path`);
169
171
  (0, _utils.makeDir)(outputPath);
170
172
  (0, _utils.writeFile)(_path.default.join(outputPath, this.outputFileName), JSON.stringify(unusedFiles)).then(() => {
171
173
  if (this.sstest) {
@@ -179,7 +181,7 @@ class UnusedFilesFindPlugin {
179
181
  unusedFiles.forEach(file => {
180
182
  _fs.default.unlinkSync(file);
181
183
 
182
- (0, _utils.log)(`Deleted - ${file}`);
184
+ (0, _log.log)(`Deleted - ${file}`);
183
185
  });
184
186
  }
185
187
  });
@@ -6,15 +6,13 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.isFileNameMatchingPattern = isFileNameMatchingPattern;
7
7
  exports.isFileNameMatchingPluginPattern = isFileNameMatchingPluginPattern;
8
8
 
9
- var _windowsModification = require("../../loaderUtils/windowsModification");
10
-
11
9
  var _ignore = _interopRequireDefault(require("ignore"));
12
10
 
13
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
12
 
15
13
  const path = require('path');
16
14
 
17
- let aliasNames = {
15
+ const aliasNames = {
18
16
  valueReplacer: 'postcss-value-replacer',
19
17
  selectorReplace: 'postcss-selector-replace-new',
20
18
  hasRTL: 'postcss-rtl',
@@ -48,48 +46,47 @@ unique scenario
48
46
  function isFileNameMatchingPattern({
49
47
  filename,
50
48
  filterObject,
51
- plugins
49
+ plugins,
50
+ order
52
51
  }) {
53
- const finalPlugins = [];
54
- Object.keys(filterObject).forEach(key => {
55
- plugins.forEach(x => {
56
- if (aliasNames[key] === x.postcssPlugin) {
57
- const ig = (0, _ignore.default)({
58
- allowRelativePaths: true
59
- }).add(filterObject[key]);
52
+ const pluginObj = {};
53
+ plugins.forEach(p => {
54
+ pluginObj[p.postcssPlugin] = p;
55
+ });
56
+ const finalPlugins = order.filter(key => {
57
+ const pluginSpecificFilter = filterObject[key];
58
+
59
+ if (!pluginSpecificFilter || pluginSpecificFilter.length === 0) {
60
+ return true;
61
+ } // eslint-disable-next-line no-use-before-define
62
+
63
+
64
+ const isMatching = isFilePathMatchingPattern(filename, pluginSpecificFilter);
65
+ return isMatching;
66
+ }).map(key => {
67
+ const p = pluginObj[aliasNames[key]];
68
+ return p;
69
+ }); // if unknown key given in plugins and pattern loop will run but post-css plugin won't be available and will be undefined in array
70
+ // So we do filter as safety measure.
71
+
72
+ return finalPlugins.filter(Boolean);
73
+ }
60
74
 
61
- if (ig.ignores(filename)) {
62
- finalPlugins.push(x);
63
- }
64
- }
65
- });
66
- }); // console.log(filename);
75
+ function isFilePathMatchingPattern(filePath, patterns) {
76
+ if (patterns.length === 0) {
77
+ return true;
78
+ }
67
79
 
68
- return finalPlugins; // console.log(filename, filterObject);
80
+ const ig = (0, _ignore.default)({
81
+ allowRelativePaths: true
82
+ }).add(patterns);
83
+ return ig.ignores(filePath);
69
84
  }
70
85
 
71
86
  function isFileNameMatchingPluginPattern({
72
87
  filename,
73
- filterArr // =process.cwd()
74
-
88
+ filterArr
75
89
  }) {
76
- // console.log(rootDir);
77
- let include = true; // console.log(rootDir);
78
- // const regex = `^(.+?)${rootDir}?\\\\`;
79
- // console.log(plugin);
80
-
81
- const newFilename = path.relative(path.parse(process.cwd()).base, filename); // const newFilename = windowsModificationFile(filename).replace(
82
- // new RegExp(regex, 'gi'),
83
- // ''
84
- // );
85
-
86
- const ig = (0, _ignore.default)({
87
- allowRelativePaths: true
88
- }).add(filterArr);
89
-
90
- if (!ig.ignores(newFilename)) {
91
- include = false;
92
- }
93
-
94
- return include;
90
+ const newFilename = path.relative(path.parse(process.cwd()).base, filename);
91
+ return isFilePathMatchingPattern(newFilename, filterArr);
95
92
  }
@@ -36,6 +36,9 @@ var _default = {
36
36
  cli: 'stop_nodemon'
37
37
  }
38
38
  },
39
+ resourceHints: {
40
+ allowPrefetchingMultipleChunks: false
41
+ },
39
42
  i18n: {
40
43
  chunkSplitEnable: {
41
44
  value: false,
@@ -68,17 +71,9 @@ var _default = {
68
71
  before: [],
69
72
  after: []
70
73
  },
71
- plugins: {
72
- valueReplacer: false,
73
- selectorReplace: false,
74
- hasRTL: false,
75
- hoverActive: false,
76
- combinerMediaQuery: false,
77
- cssVariableReplacement: false,
78
- selectorWeight: false,
79
- minifier: false,
80
- composeMinification: false
81
- },
74
+ plugins: null,
75
+ // @type {Boolean | Array}
76
+ postCssPluginOrder: null,
82
77
  patterns: {
83
78
  valueReplacer: [],
84
79
  selectorReplace: [],
@@ -95,7 +90,8 @@ var _default = {
95
90
  hoverActive: [],
96
91
  combinerMediaQuery: [],
97
92
  cssVariableReplacement: [],
98
- selectorWeight: []
93
+ selectorWeight: [],
94
+ hasRTL: []
99
95
  },
100
96
  cssVariableReplacementConfig: '',
101
97
  selectorWeightConfig: {
@@ -267,17 +263,8 @@ var _default = {
267
263
  value: true,
268
264
  cli: 'enable_smaphook'
269
265
  },
270
- plugins: {
271
- valueReplacer: false,
272
- selectorReplace: false,
273
- hasRTL: false,
274
- hoverActive: false,
275
- combinerMediaQuery: false,
276
- cssVariableReplacement: false,
277
- selectorWeight: false,
278
- minifier: false,
279
- composeMinification: false
280
- },
266
+ plugins: null,
267
+ postCssPluginOrder: null,
281
268
  patterns: {
282
269
  valueReplacer: [],
283
270
  selectorReplace: [],
@@ -294,7 +281,8 @@ var _default = {
294
281
  hoverActive: [],
295
282
  combinerMediaQuery: [],
296
283
  cssVariableReplacement: [],
297
- selectorWeight: []
284
+ selectorWeight: [],
285
+ hasRTL: []
298
286
  },
299
287
  cssVariableReplacementConfig: '',
300
288
  selectorWeightConfig: {
@@ -333,6 +321,7 @@ var _default = {
333
321
  inject: true
334
322
  },
335
323
  removePropTypes: false,
324
+ customChunksBaseConfig: null,
336
325
  customChunks: [{
337
326
  name: 'styles',
338
327
  pattern: '\\.css$'
@@ -388,16 +377,8 @@ var _default = {
388
377
  },
389
378
  rtlExclude: [],
390
379
  selectorReplace: null,
391
- plugins: {
392
- rtl: false,
393
- hoverActive: false,
394
- combinerMediaQuery: false,
395
- cssVariableReplacement: false,
396
- selectorWeight: false,
397
- minifier: false,
398
- composeMinification: false,
399
- selectorReplace: false
400
- },
380
+ plugins: null,
381
+ postCssPluginOrder: null,
401
382
  patterns: {
402
383
  valueReplacer: [],
403
384
  selectorReplace: [],
@@ -405,14 +386,16 @@ var _default = {
405
386
  combinerMediaQuery: [],
406
387
  hasRTL: [],
407
388
  cssVariableReplacement: [],
408
- selectorWeight: []
389
+ selectorWeight: [],
390
+ cssUniqueness: []
409
391
  },
410
392
  exclude: {
411
393
  rtl: [],
412
394
  hoverActive: [],
413
395
  combinerMediaQuery: [],
414
396
  cssVariableReplacement: [],
415
- selectorWeight: []
397
+ selectorWeight: [],
398
+ hasRTL: []
416
399
  },
417
400
  cssVariableReplacementConfig: '',
418
401
  selectorWeightConfig: {