@zohodesk/react-cli 1.1.14-exp.2 → 1.1.14-kubernetes

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 (102) hide show
  1. package/README.md +16 -281
  2. package/bin/cli.js +55 -30
  3. package/docs/CustomChunks.md +9 -12
  4. package/docs/SelectorWeight.md +0 -3
  5. package/docs/ValueReplacer.md +0 -27
  6. package/docs/VariableConversion.md +1 -6
  7. package/lib/common/splitChunks.js +45 -65
  8. package/lib/common/testPattern.js +11 -9
  9. package/lib/common/valueReplacer.js +3 -1
  10. package/lib/configs/resolvers.js +5 -16
  11. package/lib/configs/webpack.css.umd.config.js +2 -3
  12. package/lib/configs/webpack.dev.config.js +5 -15
  13. package/lib/configs/webpack.docs.config.js +3 -14
  14. package/lib/configs/webpack.impact.config.js +2 -8
  15. package/lib/configs/webpack.prod.config.js +5 -15
  16. package/lib/constants.js +3 -3
  17. package/lib/loaderUtils/getCSSLoaders.js +49 -98
  18. package/lib/loaderUtils/windowsModification.js +1 -6
  19. package/lib/loaders/docsLoader.js +7 -18
  20. package/lib/loaders/selectorMappingLoader.js +9 -9
  21. package/lib/pluginUtils/getDevPlugins.js +6 -25
  22. package/lib/pluginUtils/getProdPlugins.js +5 -32
  23. package/lib/pluginUtils/getUMDCSSPlugins.js +1 -1
  24. package/lib/pluginUtils/getUMDComponentPlugins.js +1 -1
  25. package/lib/plugins/EFCPlugin.js +9 -9
  26. package/lib/plugins/EFCTemplatePlugin.js +12 -10
  27. package/lib/plugins/I18NInjectIntoIndexPlugin.js +9 -8
  28. package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +3 -2
  29. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +13 -29
  30. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +7 -2
  31. package/lib/plugins/I18nSplitPlugin/index.js +1 -1
  32. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +8 -8
  33. package/lib/plugins/ReportGeneratePlugin.js +6 -8
  34. package/lib/plugins/ResourceHintsPlugin.js +3 -13
  35. package/lib/plugins/SelectorPlugin.js +37 -77
  36. package/lib/plugins/{MinifyPlugin.js → UglifyCSSPlugin.js} +3 -3
  37. package/lib/plugins/UnusedFilesFindPlugin.js +5 -7
  38. package/lib/plugins/VariableConversionCollector.js +101 -40
  39. package/lib/plugins/composeCommonPlugin.js +30 -0
  40. package/lib/plugins/index.js +7 -7
  41. package/lib/postcss-plugins/ExcludePlugin.js +1 -1
  42. package/lib/postcss-plugins/RTLSplitPlugin.js +10 -4
  43. package/lib/postcss-plugins/ValueReplacer.js +29 -8
  44. package/lib/postcss-plugins/hoverActivePlugin.js +6 -0
  45. package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +1 -0
  46. package/lib/postcss-plugins/variableModificationPlugin/index.js +38 -94
  47. package/lib/postcss-plugins/variableModifier.js +244 -0
  48. package/lib/schemas/index.js +18 -94
  49. package/lib/servers/devBuild.js +11 -13
  50. package/lib/servers/getCliPath.js +5 -3
  51. package/lib/servers/httpsOptions.js +13 -12
  52. package/lib/servers/nowatchserver.js +55 -62
  53. package/lib/servers/server.js +52 -53
  54. package/lib/utils/cssClassNameGenerate.js +13 -70
  55. package/lib/utils/getOptions.js +28 -35
  56. package/lib/utils/getServerURL.js +9 -1
  57. package/lib/utils/index.js +12 -14
  58. package/lib/utils/initPreCommitHook.js +5 -5
  59. package/lib/utils/pullOrigin.js +3 -3
  60. package/lib/utils/reinstallDependencies.js +3 -3
  61. package/lib/utils/switchBranch.js +2 -4
  62. package/package.json +3 -5
  63. package/templates/docs/all.html +0 -1
  64. package/templates/docs/component.html +0 -1
  65. package/templates/docs/components.html +0 -1
  66. package/templates/docs/css/style.css +169 -136
  67. package/templates/docs/index.html +632 -796
  68. package/.vscode/settings.json +0 -25
  69. package/docs/ComposeMinification.md +0 -13
  70. package/docs/MarkdownParser.md +0 -18
  71. package/docs/ReactLive.md +0 -14
  72. package/docs/patternFiltering.md +0 -57
  73. package/lib/common/buildEs.js +0 -12
  74. package/lib/common/runPreProcess.js +0 -71
  75. package/lib/deprecationLogger.js +0 -40
  76. package/lib/loaderUtils/tests/windowsModification.test.js +0 -10
  77. package/lib/loaders/__test__/markdownLoader.spec.js +0 -145
  78. package/lib/loaders/composeLoader.js +0 -298
  79. package/lib/loaders/markdownLoader.js +0 -71
  80. package/lib/loaders/reactLiveConvertor.js +0 -105
  81. package/lib/logger.js +0 -27
  82. package/lib/plugins/CustomAttributePlugin.js +0 -82
  83. package/lib/plugins/CustomAttributePlugin.md +0 -35
  84. package/lib/plugins/EfcResourceCleanupPlugin.js +0 -43
  85. package/lib/plugins/StatsPlugin.js +0 -82
  86. package/lib/plugins/utils/classHandling.js +0 -35
  87. package/lib/plugins/utils/fileHandling.js +0 -92
  88. package/lib/plugins/utils/tests/fileHandling.test.js +0 -30
  89. package/lib/plugins/variableConvertorUtils.js +0 -133
  90. package/lib/postcss-plugins/EmptyPlugin.js +0 -8
  91. package/lib/postcss-plugins/IncludePlugin.js +0 -23
  92. package/lib/postcss-plugins/SelectorReplace.js +0 -80
  93. package/lib/postcss-plugins/__test__/selectorReplace.test.js +0 -28
  94. package/lib/postcss-plugins/__test__/valueReplacer.spec.js +0 -43
  95. package/lib/servers/requireLocalOrGlobal.js +0 -61
  96. package/lib/utils/deprecationSupport.js +0 -134
  97. package/lib/utils/log.js +0 -11
  98. package/lib/utils/object-manipulation.js +0 -88
  99. package/lib/utils/selectorReplacer.js +0 -47
  100. package/lib/utils/variableConverter.js +0 -104
  101. package/npm-shrinkwrap.json +0 -33485
  102. package/templates/docs/css/markdown.css +0 -202
@@ -11,42 +11,41 @@ var _cssClassNameGenerate = _interopRequireDefault(require("../utils/cssClassNam
11
11
 
12
12
  var _utils = require("../utils");
13
13
 
14
- var _fileHandling = require("../plugins/utils/fileHandling");
14
+ var _windowsModification = require("./windowsModification");
15
15
 
16
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
17
 
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
21
 
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));
22
+ function excludeEmptyCheckPlugin({
23
+ enable,
24
+ ignore,
25
+ plugins
26
+ }) {
27
+ return enable ? ignore.length === 0 ? plugins : [require('../postcss-plugins/ExcludePlugin')({
28
+ ignore,
29
+ plugins
30
+ })] : [];
34
31
  }
35
32
 
36
33
  const getCSSLoaders = optionsObj => {
37
34
  const {
38
35
  plugins,
39
- patterns,
36
+ exclude,
40
37
  mediaQueryHoverActiveString,
41
38
  cssVariableReplacementConfig,
42
39
  classNameBlob,
43
40
  cssUniqueness,
44
41
  selectorReplace,
45
42
  cssHashSelectors,
46
- classNamePrefix,
47
- postCssPluginOrder,
48
- customClassNamePrefix
49
- } = optionsObj;
43
+ classNamePrefix
44
+ } = optionsObj; // console.log('plugins:')
45
+ // console.log(plugins)
46
+ // console.log('exclude:')
47
+ // console.log(exclude)
48
+
50
49
  const {
51
50
  devCssFileBountry
52
51
  } = options.app;
@@ -56,6 +55,10 @@ const getCSSLoaders = optionsObj => {
56
55
  const {
57
56
  cssSelectorZipPath
58
57
  } = options.impactService;
58
+ const rtlExcludeLocal = (0, _windowsModification.windowsModification)(exclude.rtl);
59
+ const hoverActiveExcludeLocal = (0, _windowsModification.windowsModification)(exclude.hoverActive);
60
+ const combinerMediaQueryExcludeLocal = (0, _windowsModification.windowsModification)(exclude.combinerMediaQuery);
61
+ const cssVariableReplacementExcludeLocal = (0, _windowsModification.windowsModification)(exclude.cssVariableReplacement);
59
62
  const cssLoaderOptions = {
60
63
  // importLoaders: hasRTL||hoverActive ? 1 : 0,
61
64
  importLoaders: 1,
@@ -66,23 +69,35 @@ const getCSSLoaders = optionsObj => {
66
69
  if (classNameBlob) {
67
70
  cssLoaderOptions.modules.localIdentName = classNameBlob;
68
71
  } else {
69
- cssLoaderOptions.modules.getLocalIdent = (0, _cssClassNameGenerate.default)(cssUniqueness, cssHashSelectors, classNamePrefix, customClassNamePrefix, patterns);
70
- }
72
+ cssLoaderOptions.modules.getLocalIdent = (0, _cssClassNameGenerate.default)(cssUniqueness, cssHashSelectors, classNamePrefix);
73
+ } // console.log('selector weight config : ', selectorWeightConfig);
71
74
 
72
- const pluginOrder = calculatePostCssPluginOrder(postCssPluginOrder, Object.keys(plugins).filter(x => plugins[x] === true)); // console.log('selector weight config : ', selectorWeightConfig);
73
75
 
74
- const postcssPlugins = [plugins.valueReplacer && require('../postcss-plugins/ValueReplacer')(valueReplacer), plugins.hasRTL && require('@zohodesk/postcss-rtl')({
75
- addPrefixToSelector: function addPrefixToSelector(selector, prefix) {
76
- if (prefix === '[dir]') {
77
- return selector;
78
- }
76
+ const postcssPlugins = [valueReplacer && require('../postcss-plugins/ValueReplacer')(valueReplacer), selectorReplace && require('postcss-selector-replace')(selectorReplace), ...excludeEmptyCheckPlugin({
77
+ enable: plugins.hasRTL,
78
+ ignore: rtlExcludeLocal,
79
+ plugins: [require('@zohodesk/postcss-rtl')({
80
+ addPrefixToSelector: function addPrefixToSelector(selector, prefix) {
81
+ if (prefix === '[dir]') {
82
+ return selector;
83
+ }
79
84
 
80
- return `${prefix} ${selector}`; // Make selectors like [dir=rtl] > .selector
81
- }
82
- }), 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) // ,
83
- // plugins.composeMinification &&
84
- // require('../postcss-plugins/composePlugin')()
85
- ].filter(Boolean);
85
+ return `${prefix} ${selector}`; // Make selectors like [dir=rtl] > .selector
86
+ }
87
+ })]
88
+ }), ...excludeEmptyCheckPlugin({
89
+ enable: plugins.combinerMediaQuery,
90
+ ignore: combinerMediaQueryExcludeLocal,
91
+ plugins: [require('postcss-combine-media-query')]
92
+ }), ...excludeEmptyCheckPlugin({
93
+ enable: plugins.hoverActive,
94
+ ignore: hoverActiveExcludeLocal,
95
+ plugins: [require('../postcss-plugins/hoverActivePlugin')(mediaQueryHoverActiveString)]
96
+ }), ...excludeEmptyCheckPlugin({
97
+ enable: plugins.cssVariableReplacement,
98
+ ignore: cssVariableReplacementExcludeLocal,
99
+ plugins: [fs.existsSync(cssVariableReplacementConfig) && require('../postcss-plugins/variableModificationPlugin/index').plugin(cssVariableReplacementConfig)]
100
+ })].filter(Boolean);
86
101
  return [cssSelectorZipPath && {
87
102
  loader: require.resolve('../loaders/selectorMappingLoader')
88
103
  }, {
@@ -102,74 +117,10 @@ const getCSSLoaders = optionsObj => {
102
117
  loader: 'postcss-loader',
103
118
  options: {
104
119
  ident: 'postcss',
105
- plugins: function (params) {
106
- // console.log('check here : ', params.resourcePath);
107
- // getCSSLoaders for all postcss filtering
108
-
109
- /*
110
- input :
111
- params.resourcePath : 'D:/MyWork/..../desk_client_app/supportapp/src/components/Avatar/Avatar.module.css,
112
- patterns : [
113
- // include all files
114
- "valueReplacer": [
115
- "*"
116
- ],
117
- // include all files
118
- "selectorReplace": [
119
- "*"
120
- ],
121
- // include src folder, include deskapp folder, exclude node modules
122
- "hoverActive": [
123
- "src",
124
- "deskapp",
125
- "!node_modules"
126
- ],
127
- // include src folder, include deskapp folder, exclude node modules
128
- "combinerMediaQuery": [
129
- "src",
130
- "deskapp",
131
- "!node_modules"
132
- ],
133
- // include src folder, include deskapp folder, exclude node modules
134
- "hasRTL": [
135
- "src",
136
- "deskapp",
137
- "!node_modules"
138
- ],
139
- // include src folder, include deskapp folder, exclude node modules
140
- "cssVariableReplacement": [
141
- "src",
142
- "deskapp",
143
- "!node_modules"
144
- ],
145
- // include src folder, include deskapp folder, exclude node modules
146
- "selectorWeight": [
147
- "src",
148
- "deskapp",
149
- "!node_modules"
150
- ],
151
- // include all files
152
- "cssUniqueness": [
153
- "*"
154
- ]
155
- ],
156
-
157
- [ postcssPlugins that are implemented ]
158
- */
159
- // console.log(params.resourcePath);
160
- // console.log(postcssPlugins);
161
- const finalPostcssPlugins = (0, _fileHandling.isFileNameMatchingPattern)({
162
- filename: params.resourcePath,
163
- filterObject: patterns,
164
- plugins: postcssPlugins,
165
- order: pluginOrder
166
- }); // postcssPlugins that are allowed
167
-
168
- return finalPostcssPlugins.length > 0 ? finalPostcssPlugins : [require('../postcss-plugins/EmptyPlugin')()];
120
+ plugins: function () {
121
+ return postcssPlugins;
169
122
  }
170
123
  }
171
- } : null, plugins.composeMinification ? {
172
- loader: require.resolve('../loaders/composeLoader')
173
124
  } : null].filter(Boolean);
174
125
  };
175
126
 
@@ -4,13 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.windowsModification = windowsModification;
7
- exports.windowsModificationFile = windowsModificationFile;
8
7
  const isWin = process.platform === 'win32';
9
8
 
10
9
  function windowsModification(array) {
11
10
  return isWin ? array && Array.isArray(array) && array.map(r => r.replace(/\//g, '\\')) : array;
12
- }
13
-
14
- function windowsModificationFile(filename) {
15
- return isWin ? filename.replace(/\//g, '\\') : filename;
16
- } // module.exports = { windowsModification, windowsModificationFile };
11
+ }
@@ -2,32 +2,21 @@
2
2
 
3
3
  var _fs = _interopRequireDefault(require("fs"));
4
4
 
5
- var _getOptions = _interopRequireDefault(require("../utils/getOptions.js"));
6
-
7
5
  var _path = _interopRequireDefault(require("path"));
8
6
 
9
- var _reactLiveConvertor = require("./reactLiveConvertor");
10
-
11
- var _markdownLoader = require("./markdownLoader.js");
12
-
13
7
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
8
 
15
9
  module.exports = function (source) {
16
- const comNameAry = this.resourcePath.split(_path.default.sep);
17
- const filePath = this.resourcePath;
18
-
19
- const appPath = _fs.default.realpathSync(process.cwd());
10
+ let comNameAry = this.resourcePath.split(_path.default.sep);
11
+ let filePath = this.resourcePath;
20
12
 
21
- const changePath = filePath.replace('/lib/', '/src/');
22
- const comName = comNameAry[comNameAry.length - 1];
23
- const name = comName.substring(0, comName.lastIndexOf('.'));
24
- const options = (0, _getOptions.default)();
25
- const originalFilePath = filePath.startsWith(appPath) ? filePath : changePath;
13
+ let appPath = _fs.default.realpathSync(process.cwd());
26
14
 
27
- const src = _fs.default.readFileSync(originalFilePath).toString();
15
+ let changePath = filePath.replace('/lib/', '/src/');
16
+ let comName = comNameAry[comNameAry.length - 1];
17
+ let name = comName.substring(0, comName.lastIndexOf('.'));
28
18
 
29
- options.docs.enableMDParser && (source = (0, _markdownLoader.markdownParser)(source));
30
- options.docs.enableReactLive && (source = (0, _reactLiveConvertor.reactLiveConvertor)(source, originalFilePath)); //to Enable the ReactLive Converter
19
+ let src = _fs.default.readFileSync(filePath.startsWith(appPath) ? filePath : changePath).toString();
31
20
 
32
21
  return `${source};${name}.source=${JSON.stringify(src)};${name}.filePath=${JSON.stringify(filePath)}`;
33
22
  };
@@ -6,25 +6,25 @@ var _fs = _interopRequireDefault(require("fs"));
6
6
 
7
7
  var _utils = require("../utils");
8
8
 
9
- var _logger = require("../logger");
10
-
11
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
10
 
13
- const options = (0, _utils.getOptions)();
11
+ let options = (0, _utils.getOptions)();
14
12
  const {
15
13
  cssSelectorZipPath
16
14
  } = options.impactService;
17
15
 
18
- const zipname = _path.default.parse(cssSelectorZipPath).name; // TODO:NOTE: need to check about .. path related files creation
16
+ const zipname = _path.default.parse(cssSelectorZipPath).name; // console.log({ cssSelectorZipPath, zipname });
17
+ // TODO:NOTE: need to check about .. path related files creation
19
18
  // for now no css files have given form react-cli need to make sure about it.
20
19
 
21
20
 
22
- const zippath = _path.default.join(process.cwd(), cssSelectorZipPath);
21
+ let zippath = _path.default.join(process.cwd(), cssSelectorZipPath);
23
22
 
24
23
  if (_fs.default.existsSync(_path.default.join(process.cwd(), cssSelectorZipPath))) {
25
24
  _fs.default.rmSync(zippath);
26
25
 
27
- (0, _logger.messageLogger)('zip file deleted', zippath); // fs.rmSync(zippath, {force:true})
26
+ console.log('zip file deleted', zippath); // fs.rmSync(zippath, {force:true})
27
+ // console.log('created folder ==> ', dpath);
28
28
  } // const minicssComment =
29
29
  // '// extracted by mini-css-extract-plugin\n';
30
30
 
@@ -39,15 +39,15 @@ module.exports = function (source) {
39
39
 
40
40
  const relativePath = _path.default.relative(rootContext, resourcePath);
41
41
 
42
- const fpath = _path.default.join(rootContext, zipname, relativePath);
42
+ let fpath = _path.default.join(rootContext, zipname, relativePath);
43
43
 
44
- const originalpath = _path.default.join(rootContext, relativePath);
44
+ let originalpath = _path.default.join(rootContext, relativePath);
45
45
 
46
46
  if (relativePath.startsWith('..')) {
47
47
  throw `unexpected path ${relativePath}`;
48
48
  }
49
49
 
50
- const dpath = fpath.slice(0, fpath.lastIndexOf(_path.default.sep));
50
+ let dpath = fpath.slice(0, fpath.lastIndexOf(_path.default.sep));
51
51
 
52
52
  if (!_fs.default.existsSync(originalpath)) {
53
53
  throw `originalpath not exixt ${originalpath}`;
@@ -25,8 +25,6 @@ var _webpack = _interopRequireDefault(require("webpack"));
25
25
 
26
26
  var _plugins = require("../plugins");
27
27
 
28
- var _CustomAttributePlugin = require("../plugins/CustomAttributePlugin");
29
-
30
28
  var _RtlCssPlugin = require("../plugins/RtlSplitPlugin/RtlCssPlugin");
31
29
 
32
30
  var _VariableConversionCollector = _interopRequireDefault(require("../plugins/VariableConversionCollector"));
@@ -35,8 +33,6 @@ var _SelectorPlugin = _interopRequireDefault(require("../plugins/SelectorPlugin"
35
33
 
36
34
  var _configHtmlWebpackPlugins = require("./configHtmlWebpackPlugins");
37
35
 
38
- var _EfcResourceCleanupPlugin = _interopRequireDefault(require("../plugins/EfcResourceCleanupPlugin"));
39
-
40
36
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
41
37
 
42
38
  // import { windowsModification } from '../loaderUtils/windowsModification';
@@ -46,15 +42,13 @@ const getDevPlugins = (options, publicPath) => {
46
42
  tpFolder,
47
43
  folder,
48
44
  instrumentScript,
49
- customAttributes,
50
45
  devCssFileBountry,
51
46
  context,
52
47
  hasEFC: prevOptionForEnableEFC,
53
48
  hasShadowDOM,
54
49
  cssVariableReplacementConfig,
55
50
  plugins: pluginObject,
56
- patterns,
57
- exclude,
51
+ // exclude,
58
52
  selectorWeightConfig,
59
53
  server: {
60
54
  mode
@@ -74,8 +68,7 @@ const getDevPlugins = (options, publicPath) => {
74
68
  enableRTLSplit
75
69
  },
76
70
  i18n,
77
- unusedFiles,
78
- resourceHints
71
+ unusedFiles
79
72
  } = options;
80
73
  const hasEFC = newOptionForEnableEFC || prevOptionForEnableEFC;
81
74
  const cssLTRFileNameTempalte = enableRTLSplit ? 'css/[name].ltr.css' : 'css/[name].css';
@@ -93,11 +86,10 @@ const getDevPlugins = (options, publicPath) => {
93
86
  NODE_ENV: JSON.stringify(mode === 'dev-no-warn' ? 'production' : 'development')
94
87
  }
95
88
  }), new _miniCssExtractPlugin.default({
96
- attributes: customAttributes.cssAttributes,
97
89
  filename: cssLTRFileNameTempalte,
98
90
  // ignoreOrder: true,
99
91
  chunkFilename: cssLTRFileNameTempalte
100
- }), new _plugins.ResourceHintsPlugin(resourceHints)];
92
+ }), new _plugins.ResourceHintsPlugin()];
101
93
 
102
94
  if (enableRTLSplit) {
103
95
  pluginsArr.push(new _RtlCssPlugin.RtlCssPlugin({
@@ -192,10 +184,6 @@ const getDevPlugins = (options, publicPath) => {
192
184
  mainChunkName: 'main'
193
185
  }));
194
186
  instrumentScript && pluginsArr.push(new _plugins.ScriptInstrumentPlugin());
195
- customAttributes.enable && pluginsArr.push(new _CustomAttributePlugin.CustomAttributePlugin(customAttributes));
196
- customAttributes.enable && pluginsArr.push(new _EfcResourceCleanupPlugin.default(Object.assign({}, customAttributes, {
197
- globalCacheObj: context
198
- })));
199
187
  hasShadowDOM && pluginsArr.push(new _plugins.ShadowDOMSupportPlugin());
200
188
 
201
189
  if (devCssFileBountry) {
@@ -206,22 +194,15 @@ const getDevPlugins = (options, publicPath) => {
206
194
 
207
195
  if (pluginObject.cssVariableReplacement) {
208
196
  pluginsArr.push(new _VariableConversionCollector.default({
209
- cssVariableReplacementConfig,
210
- patterns
197
+ cssVariableReplacementConfig
211
198
  }));
212
199
  }
213
200
 
214
201
  if (pluginObject.selectorWeight) {
215
202
  pluginsArr.push(new _SelectorPlugin.default({
216
- selectorWeightConfig,
217
- exclude: exclude.selectorWeight,
218
- patterns
203
+ selectorWeightConfig
219
204
  }));
220
- } // if (pluginObject.minifier) {
221
- // // console.log('minifier active');
222
- // pluginsArr.push(new MinifierPlugin());
223
- // }
224
-
205
+ }
225
206
 
226
207
  return pluginsArr.filter(Boolean);
227
208
  };
@@ -29,16 +29,10 @@ var _SelectorPlugin = _interopRequireDefault(require("../plugins/SelectorPlugin"
29
29
 
30
30
  var _plugins = require("../plugins");
31
31
 
32
- var _CustomAttributePlugin = require("../plugins/CustomAttributePlugin");
33
-
34
32
  var _RtlCssPlugin = require("../plugins/RtlSplitPlugin/RtlCssPlugin");
35
33
 
36
34
  var _configHtmlWebpackPlugins = require("./configHtmlWebpackPlugins");
37
35
 
38
- var _StatsPlugin = _interopRequireDefault(require("../plugins/StatsPlugin"));
39
-
40
- var _EfcResourceCleanupPlugin = _interopRequireDefault(require("../plugins/EfcResourceCleanupPlugin"));
41
-
42
36
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
43
37
 
44
38
  // eslint-disable-next-line no-unused-vars
@@ -51,14 +45,12 @@ const getProdPlugins = (options, publicPath = '') => {
51
45
  bundleAnalyze,
52
46
  optimize,
53
47
  publicPaths,
54
- patterns,
55
48
  hasEFC: prevOptionForEnableEFC,
56
49
  enableSMapHook,
57
50
  tpFolder,
58
51
  folder,
59
52
  outputFolder,
60
53
  context,
61
- exclude,
62
54
  enableSMap,
63
55
  server: {
64
56
  mode
@@ -71,7 +63,6 @@ const getProdPlugins = (options, publicPath = '') => {
71
63
  resourceHints,
72
64
  serviceWorker,
73
65
  htmlTemplate,
74
- customAttributes,
75
66
  tpHashMapping,
76
67
  cdnMapping,
77
68
  crossorigin
@@ -92,12 +83,6 @@ const getProdPlugins = (options, publicPath = '') => {
92
83
  templateFilePath,
93
84
  localeAttr: efcLocaleAttr
94
85
  } = options.efc;
95
- const {
96
- enable: enableStats,
97
- options: statsOptions,
98
- excludeKeys: statsOutputExcludeKeys,
99
- fileName: statsFileName
100
- } = options.stats;
101
86
  const hasEFC = newOptionForEnableEFC || prevOptionForEnableEFC;
102
87
  const hashTempalate = enableChunkHash ? '.[chunkhash:20]_' : '';
103
88
  const cssLTRFileNameTempalte = `css/[name]${hashTempalate}${enableRTLSplit ? '.ltr' : ''}.css`;
@@ -117,7 +102,7 @@ const getProdPlugins = (options, publicPath = '') => {
117
102
  // ignoreOrder: true,
118
103
  filename: cssLTRFileNameTempalte,
119
104
  chunkFilename: cssLTRFileNameTempalte
120
- }), new _plugins.ResourceHintsPlugin(options.resourceHints), new _plugins.MinifyPlugin()];
105
+ }), new _plugins.ResourceHintsPlugin(), new _plugins.UglifyCSSPlugin()];
121
106
 
122
107
  if (enableRTLSplit) {
123
108
  pluginsArr.push(new _RtlCssPlugin.RtlCssPlugin({
@@ -237,9 +222,9 @@ const getProdPlugins = (options, publicPath = '') => {
237
222
  if (bundleAnalyze) {
238
223
  pluginsArr.push(new _webpackBundleAnalyzer.BundleAnalyzerPlugin({
239
224
  analyzerMode: 'static',
240
- generateStatsFile: !enableStats,
225
+ generateStatsFile: true,
241
226
  openAnalyzer: false,
242
- statsOptions: enableStats ? null : {
227
+ statsOptions: {
243
228
  source: false,
244
229
  normal: true,
245
230
  chunks: false,
@@ -283,29 +268,17 @@ const getProdPlugins = (options, publicPath = '') => {
283
268
 
284
269
  if (pluginObject.cssVariableReplacement) {
285
270
  pluginsArr.push(new _VariableConversionCollector.default({
286
- cssVariableReplacementConfig,
287
- patterns
271
+ cssVariableReplacementConfig
288
272
  }));
289
273
  }
290
274
 
291
275
  if (pluginObject.selectorWeight) {
292
276
  pluginsArr.push(new _SelectorPlugin.default({
293
- selectorWeightConfig,
294
- exclude: exclude.selectorWeight,
295
- patterns
277
+ selectorWeightConfig
296
278
  }));
297
279
  } // plugins.push(new VariableConversionCollector({}));
298
280
 
299
281
 
300
- customAttributes.enable && pluginsArr.push(new _CustomAttributePlugin.CustomAttributePlugin(customAttributes));
301
- customAttributes.enable && pluginsArr.push(new _EfcResourceCleanupPlugin.default(Object.assign({}, customAttributes, {
302
- globalCacheObj: context
303
- })));
304
- enableStats && pluginsArr.push(new _StatsPlugin.default({
305
- statsOptions,
306
- statsOutputExcludeKeys,
307
- statsFileName
308
- }));
309
282
  return pluginsArr;
310
283
  };
311
284
 
@@ -27,7 +27,7 @@ let getUMDCSSPlugins = () => {
27
27
  }), new _miniCssExtractPlugin.default({
28
28
  filename: 'css/[name].css',
29
29
  chunkFilename: 'css/[id].css'
30
- }), new _plugins.MinifyPlugin()];
30
+ }), new _plugins.UglifyCSSPlugin()];
31
31
  return plugins;
32
32
  };
33
33
 
@@ -27,7 +27,7 @@ let getUMDComponentPlugins = isDocs => {
27
27
  }), new _miniCssExtractPlugin.default({
28
28
  filename: 'css/[name].css',
29
29
  chunkFilename: 'css/[name].css'
30
- }), new _plugins.MinifyPlugin()];
30
+ }), new _plugins.UglifyCSSPlugin()];
31
31
  return plugins;
32
32
  };
33
33
 
@@ -19,8 +19,6 @@ var _replaceCssDirTemplate = require("./RtlSplitPlugin/replaceCssDirTemplate");
19
19
 
20
20
  var _EFCTemplatePlugin = _interopRequireDefault(require("./EFCTemplatePlugin"));
21
21
 
22
- var _logger = require("../logger");
23
-
24
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
23
 
26
24
  // import { getShortI18nAssets } from './I18nSplitPlugin/utils/hashUtils';
@@ -87,18 +85,18 @@ class EFCPlugin {
87
85
  getI18nAssetsStr(entryPoint, compilation) {
88
86
  if (!chunkSplitEnable) {
89
87
  let i18nAsstes = {};
90
- const i18nFiles = Object.keys(compilation.assets).filter(assert => assert.indexOf(`i18n${_path.default.sep}`) !== -1); //hook for i18n url contains i18n/ may cause problem
88
+ let i18nFiles = Object.keys(compilation.assets).filter(assert => assert.indexOf(`i18n${_path.default.sep}`) !== -1); //hook for i18n url contains i18n/ may cause problem
91
89
 
92
90
  i18nAsstes = i18nFiles.reduce((res, i18nFilePath) => {
93
- const fileName = i18nFilePath.replace(`i18n${_path.default.sep}`, '');
94
- const splittedFileName = fileName.split('.');
91
+ let fileName = i18nFilePath.replace(`i18n${_path.default.sep}`, '');
92
+ let splittedFileName = fileName.split('.');
95
93
  res[splittedFileName[0]] = i18nFilePath;
96
94
  return res;
97
95
  }, {});
98
96
  return `[${JSON.stringify(i18nAsstes)}[lang]]`;
99
97
  }
100
98
 
101
- const initalI18nAssets = entryPoint.chunks.filter(chunk => _I18nKeysIdentifer.default.isChunkHasI18n(chunk)).map(chunk => (0, _getI18nFileUrlPathTemplate.getI18nFileUrlPathTemplate)(compilation, chunk, this.i18nFileNameTemplate, '@locale@'));
99
+ let initalI18nAssets = entryPoint.chunks.filter(chunk => _I18nKeysIdentifer.default.isChunkHasI18n(chunk)).map(chunk => (0, _getI18nFileUrlPathTemplate.getI18nFileUrlPathTemplate)(compilation, chunk, this.i18nFileNameTemplate, '@locale@'));
102
100
  return `${JSON.stringify(initalI18nAssets)}.map(urlpath => urlpath.replace(/@locale@/g, lang))`;
103
101
  }
104
102
 
@@ -207,7 +205,8 @@ class EFCPlugin {
207
205
  apply(compiler) {
208
206
  if (!createSDkFile) {
209
207
  return;
210
- }
208
+ } //console.log('this.templateFilePath', this.templateFilePath, this.options);
209
+
211
210
 
212
211
  if (this.templateFilePath) {
213
212
  new _EFCTemplatePlugin.default({
@@ -231,8 +230,9 @@ class EFCPlugin {
231
230
  }
232
231
 
233
232
  const source = new _webpackSources.RawSource(this.createFileContent(compilation));
234
- compilation.assets[outputFile] = source;
235
- (0, _logger.messageLogger)('The EFC embedded code was created successfully..!!!');
233
+ compilation.assets[outputFile] = source; // eslint-disable-next-line no-console
234
+
235
+ console.log('The EFC embedded code was created successfully..!!!');
236
236
  });
237
237
  }
238
238
 
@@ -19,8 +19,6 @@ var _I18nKeysIdentifer = _interopRequireDefault(require("./I18nSplitPlugin/I18nK
19
19
 
20
20
  var _replaceCssDirTemplate = require("./RtlSplitPlugin/replaceCssDirTemplate");
21
21
 
22
- var _logger = require("../logger");
23
-
24
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
23
 
26
24
  // import { getShortI18nAssets } from './I18nSplitPlugin/utils/hashUtils';
@@ -42,7 +40,9 @@ const {
42
40
 
43
41
  class EFCTemplatePlugin {
44
42
  constructor(options = {}) {
45
- this.templateFilePath = _path.default.join(process.cwd(), options.templateFilePath);
43
+ // console.log(' templateFilePath ', process.cwd(), options.templateFilePath, templateFilePath);
44
+ this.templateFilePath = _path.default.join(process.cwd(), options.templateFilePath); // console.log(' templateFilePath ', this.templateFilePath);
45
+
46
46
  this.i18nFileNameTemplate = options.i18nFileNameTemplate;
47
47
  this.publicPath = options.publicPath; // NOTE: this logic may be needed for i18n splited file name with contenthash cases
48
48
  // this.i18nManifestFileName = options.i18nManifestFileName;
@@ -68,18 +68,18 @@ class EFCTemplatePlugin {
68
68
  // NOTE: we have used lang variable inside
69
69
  if (!chunkSplitEnable) {
70
70
  let i18nAsstes = {};
71
- const i18nFiles = Object.keys(compilation.assets).filter(assert => assert.indexOf(`i18n${_path.default.sep}`) !== -1); //hook for i18n url contains i18n/ may cause problem
71
+ let i18nFiles = Object.keys(compilation.assets).filter(assert => assert.indexOf(`i18n${_path.default.sep}`) !== -1); //hook for i18n url contains i18n/ may cause problem
72
72
 
73
73
  i18nAsstes = i18nFiles.reduce((res, i18nFilePath) => {
74
- const fileName = i18nFilePath.replace(`i18n${_path.default.sep}`, '');
75
- const splittedFileName = fileName.split('.');
74
+ let fileName = i18nFilePath.replace(`i18n${_path.default.sep}`, '');
75
+ let splittedFileName = fileName.split('.');
76
76
  res[splittedFileName[0]] = i18nFilePath;
77
77
  return res;
78
78
  }, {});
79
79
  return `[${JSON.stringify(i18nAsstes)}[lang]]`;
80
80
  }
81
81
 
82
- const initalI18nAssets = entryPoint.chunks.filter(chunk => _I18nKeysIdentifer.default.isChunkHasI18n(chunk)).map(chunk => (0, _getI18nFileUrlPathTemplate.getI18nFileUrlPathTemplate)(compilation, chunk, this.i18nFileNameTemplate, '@locale@'));
82
+ let initalI18nAssets = entryPoint.chunks.filter(chunk => _I18nKeysIdentifer.default.isChunkHasI18n(chunk)).map(chunk => (0, _getI18nFileUrlPathTemplate.getI18nFileUrlPathTemplate)(compilation, chunk, this.i18nFileNameTemplate, '@locale@'));
83
83
  return `${JSON.stringify(initalI18nAssets)}.map(urlpath => urlpath.replace(/@locale@/g, lang))`;
84
84
  }
85
85
 
@@ -102,7 +102,7 @@ class EFCTemplatePlugin {
102
102
 
103
103
  const initalI18nAssets = this.getI18nAssetsStr(entryPoint, compilation, '' // i18nJsPath
104
104
  );
105
- const templateStr = (0, _fs.readFileSync)(this.templateFilePath).toString();
105
+ let templateStr = (0, _fs.readFileSync)(this.templateFilePath).toString();
106
106
  return templateStr.replace('((\'getInitalAssets\'))', `function getInitalAssets(assetsType, lang) {
107
107
  if (assetsType === "js") {
108
108
  return ${JSON.stringify(initialJsFiles)}
@@ -139,8 +139,10 @@ class EFCTemplatePlugin {
139
139
  }
140
140
 
141
141
  const source = new _webpackSources.RawSource(this.templateReplacer(entryPoint, compilation));
142
- compilation.assets[outputFile] = source;
143
- (0, _logger.messageLogger)('The EFC embedded code was created successfully..!!!');
142
+ compilation.assets[outputFile] = source; // console.log('EFCTemplatePlugin working');
143
+ // eslint-disable-next-line no-console
144
+
145
+ console.log('The EFC embedded code was created successfully..!!!');
144
146
  });
145
147
  }
146
148