@zohodesk/react-cli 1.1.7 → 1.1.8-exp.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. package/.eslintignore +7 -7
  2. package/.eslintrc.js +180 -180
  3. package/.prettierrc +6 -6
  4. package/Changelog.md +1019 -1019
  5. package/README.md +1293 -1251
  6. package/bin/cli.js +497 -497
  7. package/docs/ComposeMinification.md +13 -13
  8. package/docs/CustomChunks.md +29 -26
  9. package/docs/DevServerPort.md +39 -39
  10. package/docs/DevStart.md +18 -18
  11. package/docs/HoverActive.md +12 -12
  12. package/docs/InstallNode.md +28 -28
  13. package/docs/MarkdownParser.md +17 -17
  14. package/docs/ReactLive.md +13 -13
  15. package/docs/SelectorWeight.md +8 -8
  16. package/docs/TODOS.md +10 -10
  17. package/docs/ValueReplacer.md +60 -60
  18. package/docs/VariableConversion.md +729 -729
  19. package/docs/patternFiltering.md +56 -56
  20. package/docs/warnings_while_install.txt +35 -35
  21. package/files/eslintrc.js +62 -62
  22. package/files/prettierrc.js +3 -3
  23. package/lib/common/splitChunks.js +65 -45
  24. package/lib/common/testPattern.js +9 -9
  25. package/lib/configs/webpack.css.umd.config.js +4 -4
  26. package/lib/configs/webpack.dev.config.js +24 -3
  27. package/lib/configs/webpack.docs.config.js +22 -3
  28. package/lib/configs/webpack.impact.config.js +4 -2
  29. package/lib/configs/webpack.prod.config.js +6 -3
  30. package/lib/deprecationLogger.js +41 -0
  31. package/lib/loaderUtils/configsAssetsLoaders.js +33 -33
  32. package/lib/loaderUtils/getCSSLoaders.js +77 -56
  33. package/lib/loaders/workerLoader.js +9 -9
  34. package/lib/pluginUtils/getDevPlugins.js +8 -7
  35. package/lib/pluginUtils/getProdPlugins.js +6 -6
  36. package/lib/plugins/CustomAttributePlugin.md +35 -35
  37. package/lib/plugins/EFCPlugin.md +6 -6
  38. package/lib/plugins/I18NInjectIntoIndexPlugin.js +4 -4
  39. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +38 -38
  40. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +30 -30
  41. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +8 -8
  42. package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -95
  43. package/lib/plugins/I18nSplitPlugin/README.md +25 -25
  44. package/lib/plugins/I18nSplitPlugin/index.js +57 -57
  45. package/lib/plugins/ResourceHintsPlugin.js +30 -20
  46. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +6 -6
  47. package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -30
  48. package/lib/plugins/SelectorPlugin.js +29 -29
  49. package/lib/plugins/ServiceWorkerPlugin.js +9 -9
  50. package/lib/plugins/TPHashMappingPlugin.js +4 -4
  51. package/lib/plugins/VariableConversionCollector.js +59 -59
  52. package/lib/plugins/utils/fileHandling.js +35 -42
  53. package/lib/plugins/variableConvertorUtils.js +9 -9
  54. package/lib/postcss-plugins/RTLSplitPlugin.js +10 -10
  55. package/lib/postcss-plugins/__test__/test1Input.css +38 -38
  56. package/lib/postcss-plugins/__test__/test1Output.css +38 -38
  57. package/lib/postcss-plugins/hoverActivePlugin.js +3 -3
  58. package/lib/schemas/index.js +19 -36
  59. package/lib/sh/pre-commit.sh +34 -34
  60. package/lib/sh/reportPublish.sh +45 -45
  61. package/lib/utils/buildstats.html +148 -148
  62. package/lib/utils/cssClassNameGenerate.js +13 -13
  63. package/lib/utils/deprecationSupport.js +123 -0
  64. package/lib/utils/getOptions.js +18 -78
  65. package/lib/utils/resultSchema.json +73 -73
  66. package/npm-shrinkwrap.json +14454 -33393
  67. package/npm8.md +9 -9
  68. package/package.json +123 -123
  69. package/postpublish.js +8 -8
  70. package/result.json +1 -0
  71. package/templates/app/.eslintrc.js +140 -140
  72. package/templates/app/README.md +12 -12
  73. package/templates/app/app/index.html +24 -24
  74. package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
  75. package/templates/app/app/properties/i18nkeys.json +3 -3
  76. package/templates/app/docs/all.html +69 -69
  77. package/templates/app/mockapi/index.js +18 -18
  78. package/templates/app/package.json +37 -37
  79. package/templates/app/src/actions/SampleActions/index.js +37 -37
  80. package/templates/app/src/actions/index.js +65 -65
  81. package/templates/app/src/appUrls.js +19 -19
  82. package/templates/app/src/components/Alert/Alert.js +134 -134
  83. package/templates/app/src/components/Alert/Alert.module.css +79 -79
  84. package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -37
  85. package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -84
  86. package/templates/app/src/components/Sample/Sample.module.css +11 -11
  87. package/templates/app/src/components/Sample/SampleList.js +61 -61
  88. package/templates/app/src/components/Slider/Slider.css +41 -41
  89. package/templates/app/src/components/Slider/Slider.js +55 -55
  90. package/templates/app/src/containers/AlertContainer/index.js +15 -15
  91. package/templates/app/src/containers/AppContainer/index.js +96 -96
  92. package/templates/app/src/containers/AppContainer/index.module.css +27 -27
  93. package/templates/app/src/containers/CustomMatch/index.js +65 -65
  94. package/templates/app/src/containers/DevTools/index.js +10 -10
  95. package/templates/app/src/containers/Header/index.js +67 -67
  96. package/templates/app/src/containers/Header/index.module.css +43 -43
  97. package/templates/app/src/containers/Redirect/index.js +63 -63
  98. package/templates/app/src/containers/Redirector/index.js +47 -47
  99. package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -42
  100. package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -3
  101. package/templates/app/src/historyChange.js +5 -5
  102. package/templates/app/src/index.html +10 -10
  103. package/templates/app/src/index.js +24 -24
  104. package/templates/app/src/middleware/PromiseMiddleware.js +59 -59
  105. package/templates/app/src/reducers/alertData.js +11 -11
  106. package/templates/app/src/reducers/index.js +6 -6
  107. package/templates/app/src/reducers/samples.js +19 -19
  108. package/templates/app/src/store/configureStore.dev.js +51 -51
  109. package/templates/app/src/store/configureStore.js +5 -5
  110. package/templates/app/src/store/configureStore.prod.js +26 -26
  111. package/templates/app/src/util/Common.js +5 -5
  112. package/templates/app/src/util/RequestAPI.js +132 -132
  113. package/templates/docs/all.html +250 -250
  114. package/templates/docs/component.html +179 -179
  115. package/templates/docs/components.html +222 -222
  116. package/templates/docs/css/b.min.css +6 -6
  117. package/templates/docs/css/component.css +42 -42
  118. package/templates/docs/css/componentTest.css +6 -6
  119. package/templates/docs/css/hopscotch.css +585 -585
  120. package/templates/docs/css/markdown.css +202 -202
  121. package/templates/docs/css/style.css +1022 -1022
  122. package/templates/docs/impactReportTemplate.html +154 -154
  123. package/templates/docs/index.html +1502 -1502
  124. package/templates/docs/js/active-line.js +72 -72
  125. package/templates/docs/js/b.min.js +7 -7
  126. package/templates/docs/js/codemirror.js +9680 -9680
  127. package/templates/docs/js/designTokens.js +334 -334
  128. package/templates/docs/js/j.min.js +4 -4
  129. package/templates/docs/js/javascript.js +874 -874
  130. package/templates/docs/js/matchbrackets.js +145 -145
  131. package/unittest/index.html +37 -0
@@ -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
+ (0, _logger.messageLogger)('\x1b[33m%s\x1b[0m', message);
15
+ }
16
+
17
+ function printLine() {
18
+ deprecateMessage('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! \n ');
19
+ }
20
+
21
+ let isFirstDeprecation = false;
22
+
23
+ function deprecateOption(previousObjPath = '', newObjPath = '', message = '') {
24
+ // eslint-disable-next-line no-use-before-define
25
+ deprecationLoggerStart();
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
+ }
@@ -79,39 +79,39 @@ function createNameTemplate(enableChunkHash) {
79
79
  const ext = `${enableChunkHash ? '.[hash:20]' : ''}.[ext]`;
80
80
  return `[name]${ext}`;
81
81
  }
82
- /*
83
- export function createImageAndFontsAndSVGLoaders(enableChunkHash) {
84
- const nameTemplate = createNameTemplate(enableChunkHash);
85
- return [
86
- configImageLoader(nameTemplate),
87
- configFontLoader(nameTemplate),
88
- configSVGLoader(nameTemplate),
89
- configAudioLoader(nameTemplate)
90
- ];
91
- }
82
+ /*
83
+ export function createImageAndFontsAndSVGLoaders(enableChunkHash) {
84
+ const nameTemplate = createNameTemplate(enableChunkHash);
85
+ return [
86
+ configImageLoader(nameTemplate),
87
+ configFontLoader(nameTemplate),
88
+ configSVGLoader(nameTemplate),
89
+ configAudioLoader(nameTemplate)
90
+ ];
91
+ }
92
92
  */
93
93
 
94
- /*
95
- export function createLoaderOptionObject(
96
- loaderName,
97
- nameTemplate,
98
- fallback,
99
- limit = 1000
100
- ) {
101
- return {
102
- loader: loaderName,
103
- options: {
104
- limit,
105
- name: nameTemplate,
106
- fallback
107
- }
108
- };
109
- }
110
-
111
- function configLoaderObject(filter, loaderAndOptions) {
112
- return {
113
- test: filter,
114
- use: loaderAndOptions
115
- };
116
- }
94
+ /*
95
+ export function createLoaderOptionObject(
96
+ loaderName,
97
+ nameTemplate,
98
+ fallback,
99
+ limit = 1000
100
+ ) {
101
+ return {
102
+ loader: loaderName,
103
+ options: {
104
+ limit,
105
+ name: nameTemplate,
106
+ fallback
107
+ }
108
+ };
109
+ }
110
+
111
+ function configLoaderObject(filter, loaderAndOptions) {
112
+ return {
113
+ test: filter,
114
+ use: loaderAndOptions
115
+ };
116
+ }
117
117
  */
@@ -18,6 +18,24 @@ 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 (typeof postCssPluginOrder === 'boolean') {
26
+ if (postCssPluginOrder) {
27
+ return pluginOrder;
28
+ }
29
+
30
+ return defaultPostCssPluginOrder.filter(value => pluginOrder.includes(value));
31
+ }
32
+
33
+ if (Array.isArray(postCssPluginOrder)) {
34
+ return postCssPluginOrder;
35
+ }
36
+
37
+ return [];
38
+ }
21
39
 
22
40
  const getCSSLoaders = optionsObj => {
23
41
  const {
@@ -29,7 +47,8 @@ const getCSSLoaders = optionsObj => {
29
47
  cssUniqueness,
30
48
  selectorReplace,
31
49
  cssHashSelectors,
32
- classNamePrefix
50
+ classNamePrefix,
51
+ postCssPluginOrder
33
52
  } = optionsObj;
34
53
  const {
35
54
  devCssFileBountry
@@ -54,7 +73,7 @@ const getCSSLoaders = optionsObj => {
54
73
  } // console.log('selector weight config : ', selectorWeightConfig);
55
74
 
56
75
 
57
- let postcssPlugins = [plugins.valueReplacer && require('../postcss-plugins/ValueReplacer')(valueReplacer), plugins.selectorReplace && require('../postcss-plugins/SelectorReplace')(selectorReplace), plugins.hasRTL && require('@zohodesk/postcss-rtl')({
76
+ const postcssPlugins = [plugins.valueReplacer && require('../postcss-plugins/ValueReplacer')(valueReplacer), plugins.hasRTL && require('@zohodesk/postcss-rtl')({
58
77
  addPrefixToSelector: function addPrefixToSelector(selector, prefix) {
59
78
  if (prefix === '[dir]') {
60
79
  return selector;
@@ -62,7 +81,7 @@ const getCSSLoaders = optionsObj => {
62
81
 
63
82
  return `${prefix} ${selector}`; // Make selectors like [dir=rtl] > .selector
64
83
  }
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) // ,
84
+ }), 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
85
  // plugins.composeMinification &&
67
86
  // require('../postcss-plugins/composePlugin')()
68
87
  ].filter(Boolean);
@@ -89,65 +108,67 @@ const getCSSLoaders = optionsObj => {
89
108
  // console.log('check here : ', params.resourcePath);
90
109
  // getCSSLoaders for all postcss filtering
91
110
 
92
- /*
93
- input :
94
- params.resourcePath : 'D:/MyWork/..../desk_client_app/supportapp/src/components/Avatar/Avatar.module.css,
95
- patterns : [
96
- // include all files
97
- "valueReplacer": [
98
- "*"
99
- ],
100
- // include all files
101
- "selectorReplace": [
102
- "*"
103
- ],
104
- // include src folder, include deskapp folder, exclude node modules
105
- "hoverActive": [
106
- "src",
107
- "deskapp",
108
- "!node_modules"
109
- ],
110
- // include src folder, include deskapp folder, exclude node modules
111
- "combinerMediaQuery": [
112
- "src",
113
- "deskapp",
114
- "!node_modules"
115
- ],
116
- // include src folder, include deskapp folder, exclude node modules
117
- "hasRTL": [
118
- "src",
119
- "deskapp",
120
- "!node_modules"
121
- ],
122
- // include src folder, include deskapp folder, exclude node modules
123
- "cssVariableReplacement": [
124
- "src",
125
- "deskapp",
126
- "!node_modules"
127
- ],
128
- // include src folder, include deskapp folder, exclude node modules
129
- "selectorWeight": [
130
- "src",
131
- "deskapp",
132
- "!node_modules"
133
- ],
134
- // include all files
135
- "cssUniqueness": [
136
- "*"
137
- ]
138
- ],
139
-
140
- [ postcssPlugins that are implemented ]
141
- */
111
+ /*
112
+ input :
113
+ params.resourcePath : 'D:/MyWork/..../desk_client_app/supportapp/src/components/Avatar/Avatar.module.css,
114
+ patterns : [
115
+ // include all files
116
+ "valueReplacer": [
117
+ "*"
118
+ ],
119
+ // include all files
120
+ "selectorReplace": [
121
+ "*"
122
+ ],
123
+ // include src folder, include deskapp folder, exclude node modules
124
+ "hoverActive": [
125
+ "src",
126
+ "deskapp",
127
+ "!node_modules"
128
+ ],
129
+ // include src folder, include deskapp folder, exclude node modules
130
+ "combinerMediaQuery": [
131
+ "src",
132
+ "deskapp",
133
+ "!node_modules"
134
+ ],
135
+ // include src folder, include deskapp folder, exclude node modules
136
+ "hasRTL": [
137
+ "src",
138
+ "deskapp",
139
+ "!node_modules"
140
+ ],
141
+ // include src folder, include deskapp folder, exclude node modules
142
+ "cssVariableReplacement": [
143
+ "src",
144
+ "deskapp",
145
+ "!node_modules"
146
+ ],
147
+ // include src folder, include deskapp folder, exclude node modules
148
+ "selectorWeight": [
149
+ "src",
150
+ "deskapp",
151
+ "!node_modules"
152
+ ],
153
+ // include all files
154
+ "cssUniqueness": [
155
+ "*"
156
+ ]
157
+ ],
158
+
159
+ [ postcssPlugins that are implemented ]
160
+ */
142
161
  // console.log(params.resourcePath);
143
162
  // console.log(postcssPlugins);
144
- const finalpostcssPlugins = (0, _fileHandling.isFileNameMatchingPattern)({
163
+ const pluginOrder = Object.keys(plugins).filter(x => plugins[x] !== false);
164
+ const finalPostcssPlugins = (0, _fileHandling.isFileNameMatchingPattern)({
145
165
  filename: params.resourcePath,
146
166
  filterObject: patterns,
147
- plugins: postcssPlugins
167
+ plugins: postcssPlugins,
168
+ order: calculatePostCssPluginOrder(postCssPluginOrder, pluginOrder)
148
169
  }); // postcssPlugins that are allowed
149
170
 
150
- return finalpostcssPlugins.length > 0 ? finalpostcssPlugins : [require('../postcss-plugins/EmptyPlugin')()];
171
+ return finalPostcssPlugins.length > 0 ? finalPostcssPlugins : [require('../postcss-plugins/EmptyPlugin')()];
151
172
  }
152
173
  }
153
174
  } : null, plugins.composeMinification ? {
@@ -16,7 +16,7 @@ var _SingleEntryPlugin = _interopRequireDefault(require("webpack/lib/SingleEntry
16
16
 
17
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
18
 
19
- /* import WebWorkerTemplatePlugin from 'webpack/lib/webworker/WebWorkerTemplatePlugin';
19
+ /* import WebWorkerTemplatePlugin from 'webpack/lib/webworker/WebWorkerTemplatePlugin';
20
20
  import ExternalsPlugin from 'webpack/lib/ExternalsPlugin'; */
21
21
  const schema = {
22
22
  'type': 'object',
@@ -80,14 +80,14 @@ function pitch(request) {
80
80
  globalObject: 'self'
81
81
  };
82
82
  workerContext.compiler = this._compilation.createChildCompiler(`worker-loader ${request}`, workerContext.options);
83
- /*
84
- new WebWorkerTemplatePlugin().apply(workerContext.compiler);
85
-
86
- if (compilerOptions.externals) {
87
- new ExternalsPlugin(
88
- getExternalsType(compilerOptions),
89
- compilerOptions.externals
90
- ).apply(workerContext.compiler);
83
+ /*
84
+ new WebWorkerTemplatePlugin().apply(workerContext.compiler);
85
+
86
+ if (compilerOptions.externals) {
87
+ new ExternalsPlugin(
88
+ getExternalsType(compilerOptions),
89
+ compilerOptions.externals
90
+ ).apply(workerContext.compiler);
91
91
  } */
92
92
 
93
93
  new _SingleEntryPlugin.default(this.context, `!!${request}`, _path.default.parse(this.resourcePath).name).apply(workerContext.compiler);
@@ -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({
@@ -114,11 +115,11 @@ const getDevPlugins = (options, publicPath) => {
114
115
  }
115
116
 
116
117
  const i18nManifestFileName = 'i18n-manifest.json';
117
- /**
118
- * NOTE:
119
- * this file name ext .i18n.js added
120
- * Because, in service worker they maintain cache as file name based
121
- * So, to make differce we added .i18n.js ext.
118
+ /**
119
+ * NOTE:
120
+ * this file name ext .i18n.js added
121
+ * Because, in service worker they maintain cache as file name based
122
+ * So, to make differce we added .i18n.js ext.
122
123
  */
123
124
 
124
125
  const i18nFileNameTemplate = 'i18n-chunk/[locale]/[name].i18n.js';
@@ -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({
@@ -121,11 +121,11 @@ const getProdPlugins = (options, publicPath = '') => {
121
121
  }
122
122
 
123
123
  const i18nManifestFileName = 'i18n-manifest.json';
124
- /**
125
- * NOTE:
126
- * this file name ext .i18n.js added
127
- * Because, in service worker they maintain cache as file name based
128
- * So, to make differce we added .i18n.js ext.
124
+ /**
125
+ * NOTE:
126
+ * this file name ext .i18n.js added
127
+ * Because, in service worker they maintain cache as file name based
128
+ * So, to make differce we added .i18n.js ext.
129
129
  */
130
130
 
131
131
  const i18nFileNameTemplate = 'i18n-chunk/[locale]/[name].[chunkhash].i18n.js';
@@ -1,35 +1,35 @@
1
- # CustomAttributePlugin
2
- In this plugin we added all dynamic chunks tags (like js script tags , css script tags, i18n split script tags) to extra custom attribute
3
-
4
- ## Options
5
-
6
- ```json
7
- {
8
- "name": "some",
9
- "react-cli": {
10
- "app": {
11
- "customAttributes": {// this is the all options
12
- "enable": false,
13
- "attributes": null,
14
- "jsAttributes": null,
15
- "cssAttributes": null,
16
- "i18nAttributes": null
17
- }
18
- }
19
- }
20
- ```
21
-
22
- ### enable [Boolean]
23
- this decides is this plugin or feature needs to be enabled of not.
24
-
25
-
26
- ### attributes [Object]
27
- It was object of key value pairs Example Given Option {"data-app-name":"myapp"}
28
- Then all dynamically (js script tags , css script tags, i18n split script tags) added tags via webpack
29
-
30
- ### jsAttributes [Object]
31
- same as [attributes] but only for js script tags
32
- ### cssAttributes [Object]
33
- same as [attributes] but only for css script tags
34
- ### i18nAttributes [Object]
35
- same as [attributes] but only for i18n split script tags
1
+ # CustomAttributePlugin
2
+ In this plugin we added all dynamic chunks tags (like js script tags , css script tags, i18n split script tags) to extra custom attribute
3
+
4
+ ## Options
5
+
6
+ ```json
7
+ {
8
+ "name": "some",
9
+ "react-cli": {
10
+ "app": {
11
+ "customAttributes": {// this is the all options
12
+ "enable": false,
13
+ "attributes": null,
14
+ "jsAttributes": null,
15
+ "cssAttributes": null,
16
+ "i18nAttributes": null
17
+ }
18
+ }
19
+ }
20
+ ```
21
+
22
+ ### enable [Boolean]
23
+ this decides is this plugin or feature needs to be enabled of not.
24
+
25
+
26
+ ### attributes [Object]
27
+ It was object of key value pairs Example Given Option {"data-app-name":"myapp"}
28
+ Then all dynamically (js script tags , css script tags, i18n split script tags) added tags via webpack
29
+
30
+ ### jsAttributes [Object]
31
+ same as [attributes] but only for js script tags
32
+ ### cssAttributes [Object]
33
+ same as [attributes] but only for css script tags
34
+ ### i18nAttributes [Object]
35
+ same as [attributes] but only for i18n split script tags
@@ -1,6 +1,6 @@
1
- # EFC Plugin
2
-
3
- In EFC plugin we are create sdk file for efc related purpose
4
-
5
-
6
- # document will be soon
1
+ # EFC Plugin
2
+
3
+ In EFC plugin we are create sdk file for efc related purpose
4
+
5
+
6
+ # document will be soon
@@ -115,10 +115,10 @@ class I18NInjectIntoIndexPlugin {
115
115
  i18nObj = i18nFiles.reduce((res, next) => {
116
116
  const fileName = next.replace(`i18n${_path.default.sep}`, '');
117
117
  const splittedFileName = fileName.split('.');
118
- /* if (this.isDevelopment) {
119
- res[splittedFileName[0]] = `${this.publicPath}/i18n/${fileName}`;
120
- } else {
121
- res[splittedFileName[0]] = fileName;
118
+ /* if (this.isDevelopment) {
119
+ res[splittedFileName[0]] = `${this.publicPath}/i18n/${fileName}`;
120
+ } else {
121
+ res[splittedFileName[0]] = fileName;
122
122
  } */
123
123
 
124
124
  res[splittedFileName[0]] = `${this.publicPath}/i18n/${fileName}`;
@@ -13,23 +13,23 @@ var _hashUtils = require("./utils/hashUtils");
13
13
 
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
 
16
- /**
17
- * this plugin for the download i18n files
18
- * So, if need to downoad i18n in browser this plugin handle that
19
- *
20
- *
21
- * this plugin works
22
- * how it works?
23
- * this plugin hook the requireEnsure method and we write logic for current compiled file download logic
24
- *
25
- * hinds:-
26
- * requireEnsure method was loader for all js chunk's ,
27
- * which means if we use dynamic import then this function will create script tag for that dynamic resource
28
- * so every dynamic js chunk will load by this function,
29
- * So we update this function with when dynamic jschunk call the nour code also execute
30
- *
31
- * some thing missing in this definetion
32
- *
16
+ /**
17
+ * this plugin for the download i18n files
18
+ * So, if need to downoad i18n in browser this plugin handle that
19
+ *
20
+ *
21
+ * this plugin works
22
+ * how it works?
23
+ * this plugin hook the requireEnsure method and we write logic for current compiled file download logic
24
+ *
25
+ * hinds:-
26
+ * requireEnsure method was loader for all js chunk's ,
27
+ * which means if we use dynamic import then this function will create script tag for that dynamic resource
28
+ * so every dynamic js chunk will load by this function,
29
+ * So we update this function with when dynamic jschunk call the nour code also execute
30
+ *
31
+ * some thing missing in this definetion
32
+ *
33
33
  */
34
34
  // import { REGEXP_HASH, REGEXP_CHUNKHASH } from './utils/hashUtils';
35
35
  const pluginName = 'DownloadLogicOfI18n'; // const pluginName = 'i18n-plugin';
@@ -126,20 +126,20 @@ class I18nDownlodLogic {
126
126
  return _webpack.Template.asString([source, '', '// object to store loaded I18N chunks', 'var installedI18nChunks = {', _webpack.Template.indent(mainChunk.ids.map(id => `${JSON.stringify(id)}: 0`).join(',\n')), '};']);
127
127
  });
128
128
  mainTemplate.hooks.requireEnsure.tap(pluginName, (source, mainChunk, hash) => {
129
- /**
130
- * for Information this is tapped in mainTemplate ,
131
- * So this hooks argument chunk is main chunk means entry chunk mostly.
132
- * if any chunk has i18n then we must write our download i18n logic,
129
+ /**
130
+ * for Information this is tapped in mainTemplate ,
131
+ * So this hooks argument chunk is main chunk means entry chunk mostly.
132
+ * if any chunk has i18n then we must write our download i18n logic,
133
133
  */
134
134
  const chunkMap = this.getI18nChunkObject(mainChunk);
135
135
 
136
136
  if (!Object.keys(chunkMap).length) {
137
137
  return source;
138
138
  }
139
- /**
140
- * chunkMaps has
141
- * @property {Object} hash [it has key as chunk id and value as chunkHash ]
142
- * @property {Object} name [it has key as chunk id and value as chunk name ]
139
+ /**
140
+ * chunkMaps has
141
+ * @property {Object} hash [it has key as chunk id and value as chunkHash ]
142
+ * @property {Object} name [it has key as chunk id and value as chunk name ]
143
143
  */
144
144
 
145
145
 
@@ -176,22 +176,22 @@ class I18nDownlodLogic {
176
176
  },
177
177
  contentHashType: MODULE_TYPE
178
178
  });
179
- /** IDEA:
180
- * as my suggestion ignore this `jsop` approch,
181
- * Because json parse is faster then js parse.
182
- * my suggestion is make ajax or fetch request
179
+ /** IDEA:
180
+ * as my suggestion ignore this `jsop` approch,
181
+ * Because json parse is faster then js parse.
182
+ * my suggestion is make ajax or fetch request
183
183
  */
184
184
 
185
185
  const buf = [];
186
- /*
187
- if (REGEXP_HASH.test(filenameTemplate)) {
188
- buf.push(
189
- `var hash = ${mainTemplate.renderCurrentHashCode(hash)};`
190
- );
191
- }
192
- if (REGEXP_CHUNKHASH.test(filenameTemplate)) {
193
- buf.push(`var chunkHashes = ${JSON.stringify(chunkMaps.hash)};`);
194
- }
186
+ /*
187
+ if (REGEXP_HASH.test(filenameTemplate)) {
188
+ buf.push(
189
+ `var hash = ${mainTemplate.renderCurrentHashCode(hash)};`
190
+ );
191
+ }
192
+ if (REGEXP_CHUNKHASH.test(filenameTemplate)) {
193
+ buf.push(`var chunkHashes = ${JSON.stringify(chunkMaps.hash)};`);
194
+ }
195
195
  */
196
196
 
197
197
  if ((0, _hashUtils.hasContentHash)(filenameTemplate)) {