@zohodesk/react-cli 1.1.8 → 1.1.9

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.
package/README.md CHANGED
@@ -43,6 +43,29 @@ Now to run app
43
43
  ---
44
44
 
45
45
  # Change Logs
46
+ # 1.1.9 (25-7-2023)
47
+
48
+ **Features:-**
49
+
50
+ - we have added config file support for react-cli schema. the default config file name `build.config.js` support added. In `build.config.js` you must export configuration object under `config` key. And Note: `build.config.js` is high priority then `package.json` `react-cli` config.
51
+ - added support for using regex expression to get group of chunks chunkId via Resource Hint plugin prefetch/preload hook.
52
+ only will be activate when `resourceHints` => `allowPrefetchingMultipleChunks` as `true`
53
+ - added support for pattern as function for custom chunks split logic.
54
+ - added options to split chunks base config in the key `app` => `customChunksBaseConfig` as object
55
+ - added `postCssPluginOrder` feature :
56
+ - If `app > postCssPluginOrder` or `docs > postCssPluginOrder` is set to "false", default plugin order will be followed.
57
+ - If `app > postCssPluginOrder` or `docs > postCssPluginOrder` is set to "true", order preserved in `plugins` Object will be considered.
58
+ - If `app > postCssPluginOrder` or `docs > postCssPluginOrder` is set to an array with plugins in a custom order, the custom order will be considered.
59
+
60
+ - We use the same plugin names as in `patterns` for the plugins to execute successfully.
61
+
62
+
63
+ **Issue Fix**
64
+ - fixed file path separator issue with split chunks config for vendor exclude list for windows (that was work well for mac and ubuntu only issue in windows).
65
+ - fixed cssUniqueness pattern not working in docs.
66
+
67
+ **Changes**
68
+ - previously all custom chunks are enforce true, no we have given support for enforce false for chunks on splitChunks config.
46
69
 
47
70
  # 1.1.8
48
71
 
@@ -56,6 +79,20 @@ Now to run app
56
79
  For more info please refer to :
57
80
  [details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/2.0.0/docs/MarkdownParser.md)
58
81
 
82
+
83
+ # 1.1.6-exp.2
84
+ - fixed file path separator issue with split chunks config for vendor exclude list.
85
+ - added support for not doing enforce true for chunks on splitchunks config.
86
+
87
+ # 1.1.5-exp.5
88
+ - fixed the issues regarding custom chunks base config schema.
89
+
90
+ # 1.1.5-exp.4
91
+ - added support for using regex expression to get group of chunks chunkId via Resource Hint plugin prefetch/preload hook.
92
+
93
+ # 1.1.5-exp.3
94
+ - added options to split chunks base config
95
+ - added support for passing custom chunks split logic as function.
59
96
  # 1.1.6
60
97
 
61
98
  **Issue Fix**
package/bin/cli.js CHANGED
@@ -3,13 +3,17 @@
3
3
  const path = require('path');
4
4
  const { existsSync } = require('fs');
5
5
  const { spawnSync: _spawnSync, spawn } = require('child_process');
6
- const { getOptions } = require('../lib/utils/index.js');
6
+ const getOptions = require('../lib/utils/getOptions.js').default;
7
7
 
8
- const { log } = require('../lib/utils');
8
+ const { log } = require('../lib/utils/log.js');
9
9
  const { getCliPath } = require('../lib/servers/getCliPath.js');
10
10
  //initPreCommitHook();
11
11
 
12
- const options = getOptions();
12
+ const [, , option] = process.argv;
13
+ const args = process.argv.slice(3);
14
+ const appPath = process.cwd();
15
+
16
+ const options = getOptions({ start: true, build: true, docs: true }[option]);
13
17
 
14
18
  function spawnSync(...args) {
15
19
  const result = _spawnSync(...args);
@@ -28,10 +32,6 @@ const {
28
32
  reportPath: reportPath
29
33
  } = esLintOptions || {};
30
34
 
31
- const [, , option] = process.argv;
32
- const args = process.argv.slice(3);
33
- const appPath = process.cwd();
34
-
35
35
  const webpack = getCliPath('webpack');
36
36
 
37
37
  const nodemon = getCliPath('nodemon');
@@ -48,10 +48,14 @@ if (preprocesserPath && existsSync(preprocesserPath)) {
48
48
  switch (option) {
49
49
  case 'start':
50
50
  case 'docs':
51
- spawn(preprocessCli, [preprocesserPath], {
52
- stdio: 'inherit',
53
- cwd: path.parse(preprocesserPath).dir
54
- });
51
+ spawn(
52
+ preprocessCli,
53
+ [preprocesserPath, '--watch', path.parse(preprocesserPath).dir],
54
+ {
55
+ stdio: 'inherit',
56
+ cwd: path.parse(preprocesserPath).dir
57
+ }
58
+ );
55
59
  // NOTE: it's ok if we not close this here
56
60
  // Because when node server stops this program willbe closed So this nodemon will be killed as well
57
61
  break;
@@ -270,7 +274,7 @@ switch (option) {
270
274
  require.resolve('../lib/servers/mockserver.js'),
271
275
  '--delay',
272
276
  '2500ms',
273
- 'watch',
277
+ '--watch',
274
278
  `${appPath + path.sep}mockapi`
275
279
  ].concat(args),
276
280
  { stdio: 'inherit' }
@@ -4,23 +4,26 @@ In react-cli we provide options to create custom chunks.
4
4
  This Custom Chunk Option is array of Object
5
5
  that Object keys are
6
6
 
7
- - `pattern` regex pattern as string
8
- - `name` chunk name
9
- - `size` is count which is minmum chunk dublicated or need in chunks
7
+ - `pattern` **{ String | Function | Array<String> }** regex pattern as string and custom logic to split chunks can be defined using function
8
+ - `name` **{ String }** chunk name
9
+ - `size` **{ Number }** is count which is minimum chunk duplicated or need in chunks
10
10
 
11
11
  > Since 0.0.1-exp.164.1
12
12
 
13
13
  extra features in custom chunks :-
14
14
  for more details [SplitChunkPlugin](https://webpack.js.org/plugins/split-chunks-plugin/) webpack
15
15
 
16
- - `minChunks`: `minChunks` is alies of `size` default value is `2`,
17
- - `rules`: `rules` is same as `pattern` with some easy hooks
16
+ - `minChunks`: `minChunks` is alias of `size` default value is `2`,
17
+ - `rules`: `rules` is same as `pattern` with some easy hooks **(removed after v1.1.5)**
18
18
  - use `/` for both windows and linux we will replace internally
19
19
  - for `.*` we need to use `*`
20
20
  - we can consider rules as regex when the `rules-string` has any of these `*`, `^`, `$`. So if you want regex then kindly use `*` in your `rules-string` for force regex
21
21
  - `chunks`: by this option we can specify , default value is `all`,
22
22
  - `priority`: priority default value is `-10 * (index + 2)`,
23
- - `enforce`: enforce default value is true,
24
- - `maxSize`: maxSize, default value is 0,
25
- - `minSize`: minSize, default value is 20000,
26
- includeDepenency: includeDepenency default value is false
23
+ - `enforce`: enforce default value is `true`,
24
+ - `maxSize`: maxSize, default value is `0`,
25
+ - `minSize`: minSize, default value is `20000`,
26
+ - `reuseExistingChunk` If the current chunk contains modules already split out from the main bundle, it will be reused instead of a new one being generated. This can affect the resulting file name of the chunk.
27
+ - `automaticNamePrefix` with this you can specify for chunks created through that specified config. default value `''`.
28
+ - `cacheGroupName`: `cacheGroupName` is alias of `name`, But it won't work as chunk name, instead it will just work as key in cacheGroup.
29
+ <!-- includeDependency: includeDependency default value is `false` -->
@@ -15,35 +15,53 @@ var _testPattern = require("./testPattern");
15
15
 
16
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
17
 
18
- let isWindows = _os.default.platform().toLowerCase() === 'win32';
19
- let ps = _path.default.sep;
20
- let options = (0, _utils.getOptions)();
21
- let {
18
+ const isWindows = _os.default.platform().toLowerCase() === 'win32';
19
+ const ps = _path.default.sep;
20
+ const options = (0, _utils.getOptions)();
21
+ const {
22
22
  app: {
23
23
  vendorExclude,
24
24
  customChunks,
25
- vendorInclude
25
+ vendorInclude,
26
+ customChunksBaseConfig
26
27
  }
27
28
  } = options;
29
+ const reactBundleIncludeList = ['react', 'react-dom', 'react-redux', 'react-transition-group', 'scheduler', 'prop-types'];
30
+ const vendorExcludeList = ['script-loader', 'raw-loader', ...reactBundleIncludeList, ...vendorExclude.map(vendorPath => vendorPath.replace(/[/\\]/g, _path.default.sep))];
31
+ const vendorIncludeList = [...vendorInclude].map(vendorPath => vendorPath.replace(/[/\\]/g, _path.default.sep));
28
32
 
29
- let isVendor = function isVendor(module) {
30
- let {
33
+ const isVendor = function isVendor(module) {
34
+ const {
31
35
  userRequest
32
36
  } = module;
33
- let excludeList = ['script-loader', 'raw-loader', 'react', 'react-dom'];
34
- excludeList = [...excludeList, ...vendorExclude];
35
- return userRequest && (vendorInclude.some(item => userRequest.indexOf(item) !== -1) || userRequest.indexOf('node_modules') >= 0 && userRequest.endsWith('.css') === false && userRequest.endsWith('publicPathConfig.js') === false && excludeList.every(item => userRequest.indexOf(`node_modules${ps}${item}${ps}`) === -1));
37
+ return userRequest && (vendorIncludeList.some(item => userRequest.indexOf(item) !== -1) || userRequest.indexOf('node_modules') >= 0 && userRequest.endsWith('.css') === false && userRequest.endsWith('publicPathConfig.js') === false && vendorExcludeList.every(item => userRequest.indexOf(`node_modules${ps}${item}${ps}`) === -1));
36
38
  };
37
39
 
38
- let isReact = module => {
39
- let {
40
+ const isReact = module => {
41
+ const {
40
42
  userRequest
41
43
  } = module;
42
- let reactBundle = ['react', 'react-dom'];
43
- return userRequest && reactBundle.some(pkg => userRequest.indexOf(`node_modules${ps}${pkg}${ps}`) >= 0);
44
+ return userRequest && reactBundleIncludeList.some(pkg => userRequest.indexOf(`node_modules${ps}${pkg}${ps}`) >= 0);
44
45
  };
45
46
 
46
- let defaultChunks = {
47
+ function rulesMatcher(pattern) {
48
+ if (typeof pattern === 'function') {
49
+ return pattern;
50
+ }
51
+
52
+ if (Array.isArray(pattern)) {
53
+ return ({
54
+ userRequest
55
+ }) => (0, _testPattern.testPattern)(userRequest, pattern);
56
+ }
57
+
58
+ return new RegExp(isWindows ? pattern.replace(/\//g, '\\') : pattern);
59
+ }
60
+
61
+ const baseSplitChunkConfig = Object.assign({
62
+ minSize: 15000
63
+ }, customChunksBaseConfig);
64
+ const specificCacheGroupConfig = {
47
65
  'react.vendor': {
48
66
  name: 'react.vendor',
49
67
  chunks: 'all',
@@ -63,45 +81,35 @@ let defaultChunks = {
63
81
  priority: -10
64
82
  }
65
83
  };
66
- let customChunksConfig = {};
84
+ const customChunksConfig = {};
67
85
  customChunks.map((obj, index) => ({
68
86
  name: obj.name,
69
- pattern: obj.pattern,
87
+ chunks: obj.chunks || 'all',
70
88
  minChunks: obj.minChunks || obj.size || 2,
71
- rules: obj.rules,
72
- // includeDepenency: obj.includeDepenency || false,
89
+ pattern: obj.pattern,
73
90
  priority: obj.priority || -10 * (index + 2),
74
- enforce: obj.enforce || true,
75
- maxSize: obj.maxSize,
76
- // || 0,
91
+ enforce: obj.enforce,
77
92
  minSize: obj.minSize,
78
93
  // || 20000,
79
- chunks: obj.chunks || 'all'
80
- })).map(({
94
+ maxSize: obj.maxSize,
95
+ // || 0,
96
+ reuseExistingChunk: obj.reuseExistingChunk,
97
+ cacheGroupName: obj.cacheGroupName || obj.name
98
+ })).forEach(({
81
99
  name,
82
- pattern,
100
+ chunks = 'all',
83
101
  minChunks,
84
- rules,
102
+ pattern,
85
103
  priority,
86
- // includeDepenency,
87
104
  enforce,
88
105
  minSize,
89
106
  maxSize,
90
- chunks = 'all'
107
+ reuseExistingChunk,
108
+ cacheGroupName
91
109
  }) => {
92
- let obj = {
93
- name,
94
- test: rules ? m => {
95
- const {
96
- userRequest
97
- } = m;
98
- return (0, _testPattern.testPattern)(userRequest, rules); // return (
99
- // pkgs.some(p => isRelated(userRequest, p)) ||
100
- // (includeDepenency && isDependency(m, pkgs))
101
- // );
102
- } : new RegExp(isWindows ? pattern.replace(/\//g, '\\') : pattern),
110
+ const obj = {
111
+ test: rulesMatcher(pattern),
103
112
  chunks,
104
- enforce,
105
113
  minChunks,
106
114
  priority
107
115
  };
@@ -114,13 +122,25 @@ customChunks.map((obj, index) => ({
114
122
  obj.maxSize = maxSize;
115
123
  }
116
124
 
117
- return customChunksConfig[name] = obj;
125
+ if (enforce !== false) {
126
+ obj.enforce = true;
127
+ }
128
+
129
+ if (name !== undefined) {
130
+ obj.name = name;
131
+ }
132
+
133
+ if (reuseExistingChunk !== undefined) {
134
+ obj.reuseExistingChunk = reuseExistingChunk;
135
+ }
136
+
137
+ customChunksConfig[cacheGroupName] = obj;
118
138
  });
119
- var _default = {
120
- minSize: 12000,
139
+ const splitChunkConfig = Object.assign({}, baseSplitChunkConfig, {
121
140
  cacheGroups: Object.assign({
122
141
  default: false,
123
142
  vendors: false
124
- }, defaultChunks, customChunksConfig)
125
- };
143
+ }, specificCacheGroupConfig, customChunksConfig)
144
+ });
145
+ var _default = splitChunkConfig;
126
146
  exports.default = _default;
@@ -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,41 @@
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
+ exports.deprecationLoggerStart = deprecationLoggerStart;
10
+
11
+ var _logger = require("./logger");
12
+
13
+ function deprecateMessage(message) {
14
+ // eslint-disable-next-line no-use-before-define
15
+ deprecationLoggerStart();
16
+ (0, _logger.messageLogger)('\x1b[36m%s\x1b[0m', message);
17
+ }
18
+
19
+ function printLine() {
20
+ deprecateMessage('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! \n ');
21
+ }
22
+
23
+ let isFirstDeprecation = false;
24
+
25
+ function deprecateOption(previousObjPath = '', newObjPath = '', message = '') {
26
+ deprecateMessage(`Please move "${previousObjPath.split('.').join(' > ')}" to "${newObjPath.split('.').join(' > ')}" following option ${message}`);
27
+ }
28
+
29
+ function deprecationLoggerStart() {
30
+ if (!isFirstDeprecation) {
31
+ isFirstDeprecation = true;
32
+ printLine();
33
+ }
34
+ }
35
+
36
+ function deprecationLoggerEnd() {
37
+ if (isFirstDeprecation) {
38
+ isFirstDeprecation = false;
39
+ printLine();
40
+ }
41
+ }
@@ -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] !== false)); // 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
  }