@zohodesk/react-cli 0.0.1-exp.169.2 → 0.0.1-exp.175.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (245) hide show
  1. package/.eslintignore +7 -7
  2. package/.eslintrc.js +180 -179
  3. package/.prettierrc +6 -6
  4. package/README.md +1028 -951
  5. package/bin/cli.js +483 -483
  6. package/cert/Tsicsezwild-22-23.crt +37 -37
  7. package/cert/Tsicsezwild-22-23.key +27 -27
  8. package/docs/CustomChunks.md +26 -26
  9. package/docs/DevStart.md +18 -18
  10. package/docs/HoverActive.md +12 -12
  11. package/docs/InstallNode.md +28 -28
  12. package/docs/TODOS.md +10 -10
  13. package/docs/ValueReplacer.md +60 -60
  14. package/docs/VariableConversion.md +678 -0
  15. package/docs/warnings_while_install.txt +35 -35
  16. package/files/eslintrc.js +62 -62
  17. package/files/prettierrc.js +3 -3
  18. package/lib/babel/cmjs-plugins-presets.js +0 -4
  19. package/lib/babel/es-plugins-presets.js +0 -4
  20. package/lib/common/getEntries.js +0 -10
  21. package/lib/common/getPublicPathConfig.js +0 -6
  22. package/lib/common/index.js +0 -5
  23. package/lib/common/splitChunks.js +2 -13
  24. package/lib/common/sslcertUpdater.js +6 -17
  25. package/lib/common/templateParameters.js +0 -2
  26. package/lib/common/testPattern.js +10 -21
  27. package/lib/common/valueReplacer.js +0 -15
  28. package/lib/configs/jest.config.js +8 -21
  29. package/lib/configs/libAlias.js +11 -2
  30. package/lib/configs/webpack.component.umd.config.js +0 -5
  31. package/lib/configs/webpack.css.umd.config.js +5 -13
  32. package/lib/configs/webpack.dev.config.js +13 -24
  33. package/lib/configs/webpack.docs.config.js +6 -12
  34. package/lib/configs/webpack.impact.config.js +6 -10
  35. package/lib/configs/webpack.prod.config.js +15 -26
  36. package/lib/hooks/docsProptypeHook.js +3 -7
  37. package/lib/jest/commitedFilesResult.js +3 -45
  38. package/lib/jest/coverageCollector.js +0 -11
  39. package/lib/jest/jsonMaker.js +0 -6
  40. package/lib/jest/preProcessors/cssPreprocessor.js +14 -13
  41. package/lib/jest/preProcessors/jsPreprocessor.js +0 -2
  42. package/lib/jest/preProcessors/otherFilesPreprocessor.js +0 -3
  43. package/lib/jest/result.js +0 -22
  44. package/lib/jest/run.js +6 -17
  45. package/lib/jest/setup.js +5 -57
  46. package/lib/loaderUtils/configsAssetsLoaders.js +34 -44
  47. package/lib/loaderUtils/getCSSLoaders.js +41 -28
  48. package/lib/loaderUtils/getDevJsLoaders.js +0 -8
  49. package/lib/loaderUtils/index.js +0 -3
  50. package/lib/loaders/docsLoader.js +0 -7
  51. package/lib/loaders/docsPropsLoader.js +3 -7
  52. package/lib/loaders/fileBountryLoader.js +0 -2
  53. package/lib/loaders/fileLoader.js +11 -22
  54. package/lib/loaders/scriptInstrumentLoader.js +5 -13
  55. package/lib/loaders/selectorMappingLoader.js +7 -25
  56. package/lib/loaders/workerLoader.js +13 -29
  57. package/lib/middlewares/HMRMiddleware.js +13 -26
  58. package/lib/middlewares/SSTMiddleware.js +0 -3
  59. package/lib/pluginUtils/configHtmlWebpackPlugins.js +53 -0
  60. package/lib/pluginUtils/getDevPlugins.js +20 -64
  61. package/lib/pluginUtils/getDocsPlugins.js +1 -10
  62. package/lib/pluginUtils/getLibraryImactPlugins.js +4 -5
  63. package/lib/pluginUtils/getLibraryPlugins.js +0 -5
  64. package/lib/pluginUtils/getProdPlugins.js +32 -78
  65. package/lib/pluginUtils/getServerPlugins.js +0 -5
  66. package/lib/pluginUtils/getUMDCSSPlugins.js +0 -7
  67. package/lib/pluginUtils/getUMDComponentPlugins.js +0 -7
  68. package/lib/pluginUtils/index.js +0 -8
  69. package/lib/plugins/CdnChangePlugin.js +0 -14
  70. package/lib/plugins/CleanupStatsPlugin.js +0 -5
  71. package/lib/plugins/EFCPlugin.js +23 -34
  72. package/lib/plugins/EFCPlugin.md +6 -6
  73. package/lib/plugins/EFCTemplatePlugin.js +23 -32
  74. package/lib/plugins/I18NInjectIntoIndexPlugin.js +12 -38
  75. package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +12 -17
  76. package/lib/plugins/I18nSplitPlugin/I18nDependency.js +4 -10
  77. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +46 -77
  78. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +44 -59
  79. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +21 -30
  80. package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -95
  81. package/lib/plugins/I18nSplitPlugin/README.md +25 -25
  82. package/lib/plugins/I18nSplitPlugin/index.js +70 -80
  83. package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +2 -12
  84. package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +0 -1
  85. package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +0 -5
  86. package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +0 -6
  87. package/lib/plugins/I18nSplitPlugin/utils/index.js +0 -4
  88. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +2 -20
  89. package/lib/plugins/ManifestPlugin.js +0 -17
  90. package/lib/plugins/ModuleStatsPlugin.js +0 -23
  91. package/lib/plugins/OptimizeJSPlugin.js +0 -7
  92. package/lib/plugins/PublicPathCallbackPlugin.js +0 -10
  93. package/lib/plugins/PublicPathChangePlugin.js +4 -36
  94. package/lib/plugins/ReportGeneratePlugin.js +4 -30
  95. package/lib/plugins/RequireVariablePublicPlugin.js +0 -6
  96. package/lib/plugins/ResourceHintsPlugin.js +20 -27
  97. package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +12 -17
  98. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +23 -38
  99. package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -30
  100. package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +2 -5
  101. package/lib/plugins/ScriptInstrumentPlugin.js +0 -7
  102. package/lib/plugins/ServiceWorkerPlugin.js +13 -29
  103. package/lib/plugins/ShadowDOMSupportPlugin.js +3 -40
  104. package/lib/plugins/SourceMapHookPlugin.js +0 -9
  105. package/lib/plugins/TPHashMappingPlugin.js +5 -19
  106. package/lib/plugins/UglifyCSSPlugin.js +0 -9
  107. package/lib/plugins/UnusedFilesFindPlugin.js +2 -35
  108. package/lib/plugins/index.js +0 -19
  109. package/lib/plugins/libraryImpactPlugin.js +0 -32
  110. package/lib/plugins/webpackwatchrunplugin.js +0 -5
  111. package/lib/postcss-plugins/ExcludePlugin.js +0 -4
  112. package/lib/postcss-plugins/RTLSplitPlugin.js +24 -37
  113. package/lib/postcss-plugins/ValueReplacer.js +9 -6
  114. package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +0 -3
  115. package/lib/postcss-plugins/__test__/test1Input.css +38 -38
  116. package/lib/postcss-plugins/__test__/test1Output.css +38 -38
  117. package/lib/postcss-plugins/hoverActivePlugin.js +80 -92
  118. package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +31 -0
  119. package/lib/postcss-plugins/variableModificationPlugin/index.js +232 -0
  120. package/lib/postcss-plugins/variableModifier.js +14 -20
  121. package/lib/schemas/index.js +28 -13
  122. package/lib/servers/clusterHubServer.js +0 -10
  123. package/lib/servers/devBuild.js +13 -24
  124. package/lib/servers/docsServer.js +0 -2
  125. package/lib/servers/docsServerCore.js +0 -21
  126. package/lib/servers/getCliPath.js +1 -10
  127. package/lib/servers/helpServer.js +0 -5
  128. package/lib/servers/httpsOptions.js +0 -4
  129. package/lib/servers/impactServer.js +2 -34
  130. package/lib/servers/mockserver.js +0 -9
  131. package/lib/servers/nowatchserver.js +12 -34
  132. package/lib/servers/scrServer.js +13 -20
  133. package/lib/servers/server.js +7 -35
  134. package/lib/servers/ssServer.js +0 -16
  135. package/lib/sh/pre-commit.sh +34 -34
  136. package/lib/sh/reportPublish.sh +45 -45
  137. package/lib/templates/CoverageScriptTemplate.js +0 -14
  138. package/lib/templates/WMSTemplate.js +6 -12
  139. package/lib/utils/babelPresets.js +0 -2
  140. package/lib/utils/buildstats.html +148 -148
  141. package/lib/utils/clean.js +2 -8
  142. package/lib/utils/copy.js +0 -6
  143. package/lib/utils/copyTimezones.js +0 -8
  144. package/lib/utils/createEventStream.js +0 -4
  145. package/lib/utils/cssClassNameGenerate.js +3 -19
  146. package/lib/utils/cssURLReplacer.js +0 -25
  147. package/lib/utils/dependencyPostPublish.js +0 -9
  148. package/lib/utils/fileUtils.js +0 -26
  149. package/lib/utils/folderIterator.js +0 -10
  150. package/lib/utils/getComponents.js +0 -21
  151. package/lib/utils/getCurrentBranch.js +0 -5
  152. package/lib/utils/getDependenciesImpactList.js +0 -21
  153. package/lib/utils/getHash.js +0 -7
  154. package/lib/utils/getIp.js +0 -2
  155. package/lib/utils/getOptions.js +38 -35
  156. package/lib/utils/getServerURL.js +0 -7
  157. package/lib/utils/index.js +2 -47
  158. package/lib/utils/init.js +0 -1
  159. package/lib/utils/initPreCommitHook.js +6 -29
  160. package/lib/utils/jsonHelper.js +2 -19
  161. package/lib/utils/libraryImpactConfig.js +0 -2
  162. package/lib/utils/lint/addScripts.js +2 -5
  163. package/lib/utils/lint/checkExistingConfig.js +3 -12
  164. package/lib/utils/lint/copyConfigs.js +0 -3
  165. package/lib/utils/lint/index.js +0 -9
  166. package/lib/utils/lint/lintScripts.js +0 -1
  167. package/lib/utils/lint/lintSetup.js +3 -4
  168. package/lib/utils/lint/lintStagedPreCommitHook.js +0 -1
  169. package/lib/utils/lint/question.js +0 -7
  170. package/lib/utils/lintReporter.js +0 -20
  171. package/lib/utils/mailSender.js +0 -7
  172. package/lib/utils/pullOrigin.js +0 -4
  173. package/lib/utils/reinstallDependencies.js +0 -28
  174. package/lib/utils/removeAttributes.js +0 -7
  175. package/lib/utils/repoClone.js +2 -27
  176. package/lib/utils/request.js +0 -12
  177. package/lib/utils/resultSchema.json +73 -73
  178. package/lib/utils/rtl.js +4 -16
  179. package/lib/utils/setEnvVariables.js +0 -2
  180. package/lib/utils/ssTestHack.js +0 -10
  181. package/lib/utils/switchBranch.js +0 -4
  182. package/lib/utils/urlConcat.js +0 -4
  183. package/lib/utils/useExitCleanup.js +9 -10
  184. package/npm8.md +9 -9
  185. package/package.json +146 -148
  186. package/postpublish.js +6 -6
  187. package/templates/app/.eslintrc.js +140 -140
  188. package/templates/app/README.md +12 -12
  189. package/templates/app/app/index.html +24 -24
  190. package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
  191. package/templates/app/app/properties/i18nkeys.json +3 -3
  192. package/templates/app/docs/all.html +69 -69
  193. package/templates/app/mockapi/index.js +18 -18
  194. package/templates/app/package.json +37 -37
  195. package/templates/app/src/actions/SampleActions/index.js +37 -37
  196. package/templates/app/src/actions/index.js +65 -65
  197. package/templates/app/src/appUrls.js +19 -19
  198. package/templates/app/src/components/Alert/Alert.js +134 -134
  199. package/templates/app/src/components/Alert/Alert.module.css +79 -79
  200. package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -37
  201. package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -84
  202. package/templates/app/src/components/Sample/Sample.module.css +11 -11
  203. package/templates/app/src/components/Sample/SampleList.js +61 -61
  204. package/templates/app/src/components/Slider/Slider.css +41 -41
  205. package/templates/app/src/components/Slider/Slider.js +55 -55
  206. package/templates/app/src/containers/AlertContainer/index.js +15 -15
  207. package/templates/app/src/containers/AppContainer/index.js +96 -96
  208. package/templates/app/src/containers/AppContainer/index.module.css +27 -27
  209. package/templates/app/src/containers/CustomMatch/index.js +65 -65
  210. package/templates/app/src/containers/DevTools/index.js +10 -10
  211. package/templates/app/src/containers/Header/index.js +67 -67
  212. package/templates/app/src/containers/Header/index.module.css +43 -43
  213. package/templates/app/src/containers/Redirect/index.js +63 -63
  214. package/templates/app/src/containers/Redirector/index.js +47 -47
  215. package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -42
  216. package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -3
  217. package/templates/app/src/historyChange.js +5 -5
  218. package/templates/app/src/index.html +10 -10
  219. package/templates/app/src/index.js +24 -24
  220. package/templates/app/src/middleware/PromiseMiddleware.js +59 -59
  221. package/templates/app/src/reducers/alertData.js +11 -11
  222. package/templates/app/src/reducers/index.js +6 -6
  223. package/templates/app/src/reducers/samples.js +19 -19
  224. package/templates/app/src/store/configureStore.dev.js +51 -51
  225. package/templates/app/src/store/configureStore.js +5 -5
  226. package/templates/app/src/store/configureStore.prod.js +26 -26
  227. package/templates/app/src/util/Common.js +5 -5
  228. package/templates/app/src/util/RequestAPI.js +132 -132
  229. package/templates/docs/all.html +249 -249
  230. package/templates/docs/component.html +178 -178
  231. package/templates/docs/components.html +221 -221
  232. package/templates/docs/css/b.min.css +6 -6
  233. package/templates/docs/css/component.css +42 -42
  234. package/templates/docs/css/componentTest.css +6 -6
  235. package/templates/docs/css/hopscotch.css +585 -585
  236. package/templates/docs/css/style.css +1022 -1022
  237. package/templates/docs/impactReportTemplate.html +154 -154
  238. package/templates/docs/index.html +1501 -1493
  239. package/templates/docs/js/active-line.js +72 -72
  240. package/templates/docs/js/b.min.js +7 -7
  241. package/templates/docs/js/codemirror.js +9680 -9680
  242. package/templates/docs/js/designTokens.js +334 -334
  243. package/templates/docs/js/j.min.js +4 -4
  244. package/templates/docs/js/javascript.js +874 -874
  245. package/templates/docs/js/matchbrackets.js +145 -145
@@ -4,31 +4,24 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = HMRMiddleware;
7
-
8
7
  function pathMatch(url, path) {
9
8
  if (url === path) {
10
9
  return true;
11
10
  }
12
-
13
11
  let q = url.indexOf('?');
14
-
15
12
  if (q === -1) {
16
13
  return false;
17
14
  }
18
-
19
15
  return url.substring(0, q) === path;
20
16
  }
21
-
22
17
  function createEventStream(heartbeat) {
23
18
  let clientId = 0;
24
19
  let clients = {};
25
-
26
20
  function everyClient(fn) {
27
21
  Object.keys(clients).forEach(id => {
28
22
  fn(clients[id]);
29
23
  });
30
24
  }
31
-
32
25
  setInterval(() => {
33
26
  everyClient(client => {
34
27
  client.write(`data: ${JSON.stringify({
@@ -59,22 +52,20 @@ function createEventStream(heartbeat) {
59
52
  }
60
53
  };
61
54
  }
62
-
63
55
  function extractBundles(stats) {
64
56
  // Stats has modules, single bundle
65
57
  if (stats.modules) {
66
58
  return [stats];
67
- } // Stats has children, multiple bundles
68
-
59
+ }
69
60
 
61
+ // Stats has children, multiple bundles
70
62
  if (stats.children && stats.children.length) {
71
63
  return stats.children;
72
- } // Not sure, assume single
73
-
64
+ }
74
65
 
66
+ // Not sure, assume single
75
67
  return [stats];
76
68
  }
77
-
78
69
  function publishStats(action, statsResult, eventStream, log) {
79
70
  // For multi-compiler, stats will be an object with a 'children' array of stats
80
71
  let bundles = extractBundles(statsResult.toJson({
@@ -83,7 +74,8 @@ function publishStats(action, statsResult, eventStream, log) {
83
74
  bundles.forEach(stats => {
84
75
  if (log) {
85
76
  log(`webpack built ${stats.name ? `${stats.name} ` : ''}${stats.hash} in ${stats.time}ms`);
86
- } // if (
77
+ }
78
+ // if (
87
79
  // // !force &&
88
80
  // action !== 'sync' &&
89
81
  // stats &&
@@ -95,13 +87,10 @@ function publishStats(action, statsResult, eventStream, log) {
95
87
  // type: 'still-ok'
96
88
  // });
97
89
  // }
98
-
99
-
100
90
  eventStream.publish({
101
91
  type: 'hash',
102
92
  data: stats.hash
103
93
  });
104
-
105
94
  if (stats.errors.length > 0) {
106
95
  eventStream.publish({
107
96
  type: 'errors',
@@ -119,9 +108,9 @@ function publishStats(action, statsResult, eventStream, log) {
119
108
  }
120
109
  });
121
110
  }
122
-
123
111
  function HMRMiddleware(compiler, opts = {}) {
124
- opts.log = // eslint-disable-next-line no-console
112
+ opts.log =
113
+ // eslint-disable-next-line no-console
125
114
  typeof opts.log === 'undefined' ? console.log.bind(console) : opts.log;
126
115
  opts.path = opts.path || '/__webpack_hmr';
127
116
  opts.heartbeat = opts.heartbeat || 10 * 1000;
@@ -133,16 +122,13 @@ function HMRMiddleware(compiler, opts = {}) {
133
122
  opts.log('webpack compilation starts...');
134
123
  loggedInfo = true;
135
124
  }
136
-
137
125
  callback && callback();
138
126
  });
139
127
  compiler.hooks.compile.tap('HMRMiddleware', () => {
140
128
  latestStats = null;
141
-
142
129
  if (opts.log) {
143
130
  opts.log('webpack building...');
144
131
  }
145
-
146
132
  eventStream.publish({
147
133
  type: 'building'
148
134
  });
@@ -152,13 +138,12 @@ function HMRMiddleware(compiler, opts = {}) {
152
138
  latestStats = statsResult;
153
139
  publishStats('built', latestStats, eventStream, opts.log);
154
140
  });
155
-
156
141
  let middleware = function (req, res, next) {
157
142
  if (!pathMatch(req.url, opts.path)) {
158
143
  return next();
159
144
  }
160
-
161
- eventStream.handler(req, res); // if (latestStats) {
145
+ eventStream.handler(req, res);
146
+ // if (latestStats) {
162
147
  // // Explicitly not passing in `log` fn as we don't want to log again on
163
148
  // // the server
164
149
  // // publishStats('sync', latestStats, eventStream);
@@ -167,7 +152,9 @@ function HMRMiddleware(compiler, opts = {}) {
167
152
 
168
153
  middleware.publish = eventStream.publish;
169
154
  return middleware;
170
- } // function buildModuleMap(modules) {
155
+ }
156
+
157
+ // function buildModuleMap(modules) {
171
158
  // let map = {};
172
159
  // modules.forEach(function(module) {
173
160
  // map[module.id] = module.name;
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _utils = require("../utils");
9
-
10
8
  function SSTMiddleware(compiler, callback) {
11
9
  compiler.hooks.done.tap('SSTMiddleware', stats => {
12
10
  (0, _utils.log)('Compilation finished!');
@@ -16,6 +14,5 @@ function SSTMiddleware(compiler, callback) {
16
14
  next();
17
15
  };
18
16
  }
19
-
20
17
  var _default = SSTMiddleware;
21
18
  exports.default = _default;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.configHtmlWebpackPlugins = configHtmlWebpackPlugins;
7
+ var _path = _interopRequireDefault(require("path"));
8
+ var _htmlWebpackPlugin = _interopRequireDefault(require("html-webpack-plugin"));
9
+ var _htmlWebpackInjectAttributesPlugin = _interopRequireDefault(require("html-webpack-inject-attributes-plugin"));
10
+ var _common = require("../common");
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ const defaultHTMLMiniFyOption = {
13
+ collapseWhitespace: true,
14
+ minifyCSS: true,
15
+ minifyJS: true,
16
+ keepClosingSlash: true,
17
+ removeComments: false,
18
+ removeRedundantAttributes: true,
19
+ removeScriptTypeAttributes: true,
20
+ removeStyleLinkTypeAttributes: true,
21
+ useShortDoctype: true
22
+ };
23
+ function configHtmlWebpackPlugins(plugins, {
24
+ enableChunkHash = false,
25
+ folder,
26
+ inject,
27
+ crossorigin,
28
+ hasEFC,
29
+ minify: minifyHtmlOptions = false
30
+ }) {
31
+ const optionsHtmlWebpack = {
32
+ chunksSortMode: 'none',
33
+ filename: enableChunkHash ? 'index.[templatehash:20].html' : 'index.html',
34
+ template: _path.default.join(process.cwd(), folder, 'index.html'),
35
+ minify: minifyHtmlOptions === true ? defaultHTMLMiniFyOption : minifyHtmlOptions === null ? false : minifyHtmlOptions,
36
+ // : typeof minifyHtmlOptions === 'object'
37
+ // ? minifyHtmlOptions
38
+ // : minifyHtmlOptions,,
39
+ templateParameters: _common.templateParameters,
40
+ scriptLoading: 'defer',
41
+ inject: inject
42
+ };
43
+ console.log({
44
+ optionsHtmlWebpack
45
+ });
46
+ if (hasEFC) {
47
+ optionsHtmlWebpack.excludeChunks = ['efc', 'widget'];
48
+ }
49
+ plugins.push(new _htmlWebpackPlugin.default(optionsHtmlWebpack));
50
+ crossorigin && plugins.push(new _htmlWebpackInjectAttributesPlugin.default({
51
+ crossorigin: 'anonymous'
52
+ }));
53
+ }
@@ -4,39 +4,21 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _path = _interopRequireDefault(require("path"));
9
-
10
8
  var _fs = _interopRequireDefault(require("fs"));
11
-
12
9
  var _caseSensitivePathsWebpackPlugin = _interopRequireDefault(require("case-sensitive-paths-webpack-plugin"));
13
-
14
10
  var _lodashWebpackPlugin = _interopRequireDefault(require("lodash-webpack-plugin"));
15
-
16
11
  var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
17
-
18
- var _htmlWebpackPlugin = _interopRequireDefault(require("html-webpack-plugin"));
19
-
20
- var _htmlWebpackInjectAttributesPlugin = _interopRequireDefault(require("html-webpack-inject-attributes-plugin"));
21
-
22
12
  var _I18nSplitPlugin = _interopRequireDefault(require("../plugins/I18nSplitPlugin"));
23
-
24
13
  var _RequireVariablePublicPlugin = _interopRequireDefault(require("../plugins/RequireVariablePublicPlugin"));
25
-
26
14
  var _copyWebpackPlugin = _interopRequireDefault(require("copy-webpack-plugin"));
27
-
28
15
  var _webpack = _interopRequireDefault(require("webpack"));
29
-
30
16
  var _plugins = require("../plugins");
31
-
32
- var _common = require("../common");
33
-
34
17
  var _RtlCssPlugin = require("../plugins/RtlSplitPlugin/RtlCssPlugin");
35
-
18
+ var _configHtmlWebpackPlugins = require("./configHtmlWebpackPlugins");
36
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
-
38
- let getDevPlugins = (options, publicPath) => {
39
- let {
20
+ const getDevPlugins = (options, publicPath) => {
21
+ const {
40
22
  app: {
41
23
  tpFolder,
42
24
  folder,
@@ -68,7 +50,7 @@ let getDevPlugins = (options, publicPath) => {
68
50
  const hasEFC = newOptionForEnableEFC || prevOptionForEnableEFC;
69
51
  const cssLTRFileNameTempalte = enableRTLSplit ? 'css/[name].ltr.css' : 'css/[name].css';
70
52
  const cssRTLFileNameTempalte = 'css/[name].rtl.css';
71
- let plugins = [new _plugins.CleanUpStatsPlugin(), new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.IgnorePlugin(/^\.\/domain$/, /moment$/), new _webpack.default.DefinePlugin({
53
+ const plugins = [new _plugins.CleanUpStatsPlugin(), new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.IgnorePlugin(/^\.\/domain$/, /moment$/), new _webpack.default.DefinePlugin({
72
54
  __CLIENT__: true,
73
55
  __TEST__: false,
74
56
  __SERVER__: false,
@@ -84,7 +66,6 @@ let getDevPlugins = (options, publicPath) => {
84
66
  // ignoreOrder: true,
85
67
  chunkFilename: cssLTRFileNameTempalte
86
68
  }), new _plugins.ResourceHintsPlugin()];
87
-
88
69
  if (enableRTLSplit) {
89
70
  plugins.push(new _RtlCssPlugin.RtlCssPlugin({
90
71
  templateLabel: options.css.templateLabel,
@@ -95,24 +76,21 @@ let getDevPlugins = (options, publicPath) => {
95
76
  filename: cssRTLFileNameTempalte
96
77
  }));
97
78
  }
98
-
99
79
  if (unusedFiles.enable) {
100
80
  plugins.push(new _plugins.UnusedFilesFindPlugin(Object.assign(unusedFiles, {
101
81
  origin: _path.default.join(process.cwd(), folder)
102
82
  })));
103
83
  }
104
-
105
84
  const i18nManifestFileName = 'i18n-manifest.json';
106
- /**
107
- * NOTE:
108
- * this file name ext .i18n.js added
109
- * Because, in service worker they maintain cache as file name based
110
- * So, to make differce we added .i18n.js ext.
85
+ /**
86
+ * NOTE:
87
+ * this file name ext .i18n.js added
88
+ * Because, in service worker they maintain cache as file name based
89
+ * So, to make differce we added .i18n.js ext.
111
90
  */
112
91
 
113
92
  const i18nFileNameTemplate = 'i18n-chunk/[locale]/[name].i18n.js';
114
93
  const i18nPublicPath = publicPath || '';
115
-
116
94
  if (i18n.chunkSplitEnable) {
117
95
  plugins.push(new _I18nSplitPlugin.default({
118
96
  jsResource: i18n.jsResource,
@@ -126,8 +104,7 @@ let getDevPlugins = (options, publicPath) => {
126
104
  propertiesFolder: i18n.propertiesFolder
127
105
  }));
128
106
  } else {
129
- let i18nPath = _path.default.join(process.cwd(), context, 'i18n');
130
-
107
+ const i18nPath = _path.default.join(process.cwd(), context, 'i18n');
131
108
  if (_fs.default.existsSync(i18nPath)) {
132
109
  plugins.push(new _copyWebpackPlugin.default([{
133
110
  from: `${i18nPath}/`,
@@ -136,7 +113,6 @@ let getDevPlugins = (options, publicPath) => {
136
113
  }]));
137
114
  }
138
115
  }
139
-
140
116
  tpFolder && plugins.push(new _copyWebpackPlugin.default([{
141
117
  from: `${_path.default.join(process.cwd(), context, tpFolder)}/`,
142
118
  to: `./${tpFolder}/`,
@@ -146,20 +122,15 @@ let getDevPlugins = (options, publicPath) => {
146
122
  collections: true,
147
123
  shorthands: true
148
124
  }));
149
-
125
+ (0, _configHtmlWebpackPlugins.configHtmlWebpackPlugins)(plugins, {
126
+ enableChunkHash: false,
127
+ folder,
128
+ minify: false,
129
+ inject,
130
+ crossorigin,
131
+ hasEFC
132
+ });
150
133
  if (hasEFC) {
151
- plugins.push(new _htmlWebpackPlugin.default({
152
- chunksSortMode: 'none',
153
- filename: 'index.html',
154
- template: _path.default.join(process.cwd(), folder, 'index.html'),
155
- excludeChunks: ['efc', 'widget'],
156
- templateParameters: _common.templateParameters,
157
- scriptLoading: 'defer',
158
- inject: inject
159
- }));
160
- crossorigin && plugins.push(new _htmlWebpackInjectAttributesPlugin.default({
161
- crossorigin: 'anonymous'
162
- }));
163
134
  plugins.push(new _plugins.EFCPlugin({
164
135
  isDevelopment: true,
165
136
  i18nManifestFileName,
@@ -168,20 +139,8 @@ let getDevPlugins = (options, publicPath) => {
168
139
  serverUrl: publicPath,
169
140
  entryPointName: 'efc',
170
141
  nameScope: efcNameSpace,
171
- localeAttr: efcLocaleAttr // outputFile: 'zohodesk-efc-sdk-latest.js',
172
-
173
- }));
174
- } else {
175
- plugins.push(new _htmlWebpackPlugin.default({
176
- chunksSortMode: 'none',
177
- filename: 'index.html',
178
- template: _path.default.join(process.cwd(), folder, 'index.html'),
179
- templateParameters: _common.templateParameters,
180
- scriptLoading: 'defer',
181
- inject: inject
182
- }));
183
- crossorigin && plugins.push(new _htmlWebpackInjectAttributesPlugin.default({
184
- crossorigin: 'anonymous'
142
+ localeAttr: efcLocaleAttr
143
+ // outputFile: 'zohodesk-efc-sdk-latest.js',
185
144
  }));
186
145
  }
187
146
 
@@ -195,15 +154,12 @@ let getDevPlugins = (options, publicPath) => {
195
154
  }));
196
155
  instrumentScript && plugins.push(new _plugins.ScriptInstrumentPlugin());
197
156
  hasShadowDOM && plugins.push(new _plugins.ShadowDOMSupportPlugin());
198
-
199
157
  if (devCssFileBountry) {
200
158
  plugins.push(new _RequireVariablePublicPlugin.default({
201
159
  requireFuncName: 'require'
202
160
  }));
203
161
  }
204
-
205
162
  return plugins.filter(Boolean);
206
163
  };
207
-
208
164
  var _default = getDevPlugins;
209
165
  exports.default = _default;
@@ -4,21 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _caseSensitivePathsWebpackPlugin = _interopRequireDefault(require("case-sensitive-paths-webpack-plugin"));
9
-
10
8
  var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
11
-
12
9
  var _webpack = _interopRequireDefault(require("webpack"));
13
-
14
10
  var _path = _interopRequireDefault(require("path"));
15
-
16
11
  var _plugins = require("../plugins");
17
-
18
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
13
  // isForLibraryImpact this variable for now only used in getLibraryImactPlugins.
21
14
  // So you gona use it please check with that function as well
15
+
22
16
  let getDocsPlugins = (isSSTest, options, isForLibraryImpact = false) => {
23
17
  let {
24
18
  app: {
@@ -38,7 +32,6 @@ let getDocsPlugins = (isSSTest, options, isForLibraryImpact = false) => {
38
32
  filename: 'css/[name].css',
39
33
  chunkFilename: 'css/[name].css'
40
34
  })].filter(Boolean);
41
-
42
35
  if (unusedFiles.enable) {
43
36
  plugins.push(new _plugins.UnusedFilesFindPlugin(Object.assign(unusedFiles, {
44
37
  docsFilename: 'Undocsfiles.json',
@@ -46,9 +39,7 @@ let getDocsPlugins = (isSSTest, options, isForLibraryImpact = false) => {
46
39
  origin: _path.default.join(process.cwd(), folder)
47
40
  })));
48
41
  }
49
-
50
42
  return plugins;
51
43
  };
52
-
53
44
  var _default = getDocsPlugins;
54
45
  exports.default = _default;
@@ -4,16 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = getLibraryImactPlugins;
7
-
8
7
  var _libraryImpactPlugin = _interopRequireDefault(require("../plugins/libraryImpactPlugin"));
9
-
10
8
  var _getDocsPlugins = _interopRequireDefault(require("./getDocsPlugins"));
11
-
12
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
10
  // import ModuleStatsPlugin from '../plugins/ModuleStatsPlugin';
11
+
15
12
  function getLibraryImactPlugins(options) {
16
- let plugins = (0, _getDocsPlugins.default)(false, options, true); // for performance But for furture maintanablity we adding isForLibraryImpact in getDocsPlugin
13
+ let plugins = (0, _getDocsPlugins.default)(false, options, true);
14
+
15
+ // for performance But for furture maintanablity we adding isForLibraryImpact in getDocsPlugin
17
16
  // plugins.filter(plugin => !(plugin instanceof ModuleStatsPlugin));
18
17
 
19
18
  plugins.push(new _libraryImpactPlugin.default({
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _caseSensitivePathsWebpackPlugin = _interopRequireDefault(require("case-sensitive-paths-webpack-plugin"));
9
-
10
8
  var _webpack = _interopRequireDefault(require("webpack"));
11
-
12
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
10
  let getLibraryPlugins = () => {
15
11
  let plugins = [new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.DefinePlugin({
16
12
  __TEST__: false,
@@ -23,6 +19,5 @@ let getLibraryPlugins = () => {
23
19
  })];
24
20
  return plugins;
25
21
  };
26
-
27
22
  var _default = getLibraryPlugins;
28
23
  exports.default = _default;