@zohodesk/react-cli 0.0.1-beta.17 → 0.0.1-beta.171

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 (292) hide show
  1. package/.eslintignore +1 -0
  2. package/.eslintrc.js +49 -10
  3. package/.prettierrc +6 -0
  4. package/CHANGELOG.md +5 -0
  5. package/README.md +859 -0
  6. package/bin/cli.js +215 -46
  7. package/cert/Tsicsezwild-22-23.crt +37 -0
  8. package/cert/Tsicsezwild-22-23.key +27 -0
  9. package/docs/CustomChunks.md +26 -0
  10. package/docs/DevStart.md +18 -0
  11. package/docs/HoverActive.md +12 -0
  12. package/docs/InstallNode.md +28 -0
  13. package/docs/TODOS.md +10 -0
  14. package/docs/ValueReplacer.md +60 -0
  15. package/docs/warnings_while_install.txt +35 -0
  16. package/files/eslintrc.js +62 -0
  17. package/files/prettierrc.js +3 -0
  18. package/lib/babel/cmjs-plugins-presets.js +24 -0
  19. package/lib/babel/es-plugins-presets.js +34 -0
  20. package/lib/common/getEntries.js +33 -46
  21. package/lib/common/getPublicPathConfig.js +40 -0
  22. package/lib/common/index.js +24 -19
  23. package/lib/common/splitChunks.js +110 -25
  24. package/lib/common/sslcertUpdater.js +59 -0
  25. package/lib/common/templateParameters.js +25 -0
  26. package/lib/common/testPattern.js +69 -0
  27. package/lib/common/valueReplacer.js +55 -0
  28. package/lib/configs/jest.config.js +31 -27
  29. package/lib/configs/libAlias.js +31 -0
  30. package/lib/configs/webpack.component.umd.config.js +46 -53
  31. package/lib/configs/webpack.css.umd.config.js +47 -46
  32. package/lib/configs/webpack.dev.config.js +99 -84
  33. package/lib/configs/webpack.docs.config.js +65 -57
  34. package/lib/configs/webpack.impact.config.js +109 -0
  35. package/lib/configs/webpack.prod.config.js +147 -104
  36. package/lib/hooks/docsProptypeHook.js +32 -38
  37. package/lib/jest/commitedFilesResult.js +144 -71
  38. package/lib/jest/coverageCollector.js +68 -35
  39. package/lib/jest/jsonMaker.js +54 -0
  40. package/lib/jest/preProcessors/cssPreprocessor.js +16 -18
  41. package/lib/jest/preProcessors/jsPreprocessor.js +5 -6
  42. package/lib/jest/preProcessors/otherFilesPreprocessor.js +5 -6
  43. package/lib/jest/result.js +92 -42
  44. package/lib/jest/run.js +75 -28
  45. package/lib/jest/setup.js +103 -102
  46. package/lib/loaderUtils/configsAssetsLoaders.js +117 -0
  47. package/lib/loaderUtils/getCSSLoaders.js +113 -0
  48. package/lib/loaderUtils/getDevJsLoaders.js +35 -23
  49. package/lib/loaderUtils/index.js +14 -7
  50. package/lib/loaders/docsLoader.js +15 -15
  51. package/lib/loaders/docsPropsLoader.js +14 -17
  52. package/lib/loaders/fileBountryLoader.js +17 -0
  53. package/lib/loaders/fileLoader.js +47 -38
  54. package/lib/loaders/scriptInstrumentLoader.js +23 -20
  55. package/lib/loaders/selectorMappingLoader.js +75 -0
  56. package/lib/loaders/workerLoader.js +136 -0
  57. package/lib/middlewares/HMRMiddleware.js +90 -72
  58. package/lib/middlewares/SSTMiddleware.js +21 -0
  59. package/lib/pluginUtils/getDevPlugins.js +177 -30
  60. package/lib/pluginUtils/getDocsPlugins.js +36 -15
  61. package/lib/pluginUtils/getLibraryImactPlugins.js +23 -0
  62. package/lib/pluginUtils/getLibraryPlugins.js +8 -10
  63. package/lib/pluginUtils/getProdPlugins.js +244 -37
  64. package/lib/pluginUtils/getServerPlugins.js +8 -11
  65. package/lib/pluginUtils/getUMDCSSPlugins.js +14 -18
  66. package/lib/pluginUtils/getUMDComponentPlugins.js +14 -9
  67. package/lib/pluginUtils/index.js +36 -43
  68. package/lib/plugins/CdnChangePlugin.js +77 -0
  69. package/lib/plugins/CleanupStatsPlugin.js +28 -0
  70. package/lib/plugins/EFCPlugin.js +241 -0
  71. package/lib/plugins/EFCPlugin.md +6 -0
  72. package/lib/plugins/EFCTemplatePlugin.js +151 -0
  73. package/lib/plugins/I18NInjectIntoIndexPlugin.js +141 -0
  74. package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +60 -0
  75. package/lib/plugins/I18nSplitPlugin/I18nDependency.js +44 -0
  76. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +266 -0
  77. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +183 -0
  78. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +100 -0
  79. package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -0
  80. package/lib/plugins/I18nSplitPlugin/README.md +25 -0
  81. package/lib/plugins/I18nSplitPlugin/index.js +185 -0
  82. package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +64 -0
  83. package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +13 -0
  84. package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +26 -0
  85. package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +40 -0
  86. package/lib/plugins/I18nSplitPlugin/utils/index.js +31 -0
  87. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +112 -0
  88. package/lib/plugins/ManifestPlugin.js +86 -0
  89. package/lib/plugins/ModuleStatsPlugin.js +98 -97
  90. package/lib/plugins/OptimizeJSPlugin.js +41 -0
  91. package/lib/plugins/PublicPathCallbackPlugin.js +63 -0
  92. package/lib/plugins/PublicPathChangePlugin.js +226 -0
  93. package/lib/plugins/ReportGeneratePlugin.js +181 -0
  94. package/lib/plugins/RequireVariablePublicPlugin.js +30 -0
  95. package/lib/plugins/ResourceHintsPlugin.js +67 -0
  96. package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +80 -0
  97. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +82 -0
  98. package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -0
  99. package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +26 -0
  100. package/lib/plugins/ScriptInstrumentPlugin.js +22 -37
  101. package/lib/plugins/ServiceWorkerPlugin.js +107 -0
  102. package/lib/plugins/ShadowDOMSupportPlugin.js +270 -0
  103. package/lib/plugins/SourceMapHookPlugin.js +25 -59
  104. package/lib/plugins/TPHashMappingPlugin.js +67 -0
  105. package/lib/plugins/UglifyCSSPlugin.js +39 -0
  106. package/lib/plugins/UnusedFilesFindPlugin.js +150 -97
  107. package/lib/plugins/index.js +127 -37
  108. package/lib/plugins/libraryImpactPlugin.js +190 -0
  109. package/lib/plugins/webpackwatchrunplugin.js +26 -0
  110. package/lib/postcss-plugins/ExcludePlugin.js +23 -0
  111. package/lib/postcss-plugins/RTLSplitPlugin.js +138 -0
  112. package/lib/postcss-plugins/ValueReplacer.js +46 -0
  113. package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +22 -0
  114. package/lib/postcss-plugins/__test__/test1Input.css +39 -0
  115. package/lib/postcss-plugins/__test__/test1Output.css +39 -0
  116. package/lib/postcss-plugins/hoverActivePlugin.js +368 -0
  117. package/lib/postcss-plugins/variableModifier.js +243 -0
  118. package/lib/schemas/index.js +541 -65
  119. package/lib/servers/clusterHubServer.js +22 -26
  120. package/lib/servers/devBuild.js +102 -0
  121. package/lib/servers/docsServer.js +3 -5
  122. package/lib/servers/docsServerCore.js +94 -79
  123. package/lib/servers/getCliPath.js +28 -0
  124. package/lib/servers/helpServer.js +19 -21
  125. package/lib/servers/httpsOptions.js +18 -0
  126. package/lib/servers/impactServer.js +123 -115
  127. package/lib/servers/mockserver.js +44 -0
  128. package/lib/servers/nowatchserver.js +200 -0
  129. package/lib/servers/scrServer.js +147 -0
  130. package/lib/servers/server.js +134 -132
  131. package/lib/servers/ssServer.js +106 -70
  132. package/lib/sh/reportPublish.sh +16 -10
  133. package/lib/templates/CoverageScriptTemplate.js +45 -18
  134. package/lib/templates/WMSTemplate.js +17 -18
  135. package/lib/templates/linterConstant.js +10 -0
  136. package/lib/utils/babelPresets.js +12 -4
  137. package/lib/utils/buildstats.html +148 -0
  138. package/lib/utils/clean.js +12 -11
  139. package/lib/utils/copy.js +16 -109
  140. package/lib/utils/copyTimezones.js +21 -0
  141. package/lib/utils/createEventStream.js +24 -19
  142. package/lib/utils/cssClassNameGenerate.js +77 -0
  143. package/lib/utils/cssURLReplacer.js +136 -0
  144. package/lib/utils/dependencyPostPublish.js +42 -0
  145. package/lib/utils/fileUtils.js +125 -0
  146. package/lib/utils/folderIterator.js +47 -0
  147. package/lib/utils/getComponents.js +126 -0
  148. package/lib/utils/getCurrentBranch.js +11 -17
  149. package/lib/utils/getDependenciesImpactList.js +151 -0
  150. package/lib/utils/getHash.js +26 -0
  151. package/lib/utils/getIp.js +20 -0
  152. package/lib/utils/getOptions.js +113 -28
  153. package/lib/utils/getServerURL.js +25 -8
  154. package/lib/utils/index.js +283 -68
  155. package/lib/utils/init.js +2 -2
  156. package/lib/utils/initPreCommitHook.js +47 -27
  157. package/lib/utils/jsonHelper.js +106 -0
  158. package/lib/utils/libraryImpactConfig.js +63 -0
  159. package/lib/utils/lint/addScripts.js +27 -0
  160. package/lib/utils/lint/checkExistingConfig.js +67 -0
  161. package/lib/utils/lint/copyConfigs.js +24 -0
  162. package/lib/utils/lint/index.js +54 -0
  163. package/lib/utils/lint/lintScripts.js +11 -0
  164. package/lib/utils/lint/lintSetup.js +31 -0
  165. package/lib/utils/lint/lintStagedPreCommitHook.js +7 -0
  166. package/lib/utils/lint/question.js +30 -0
  167. package/lib/utils/lintReporter.js +142 -0
  168. package/lib/utils/mailSender.js +16 -25
  169. package/lib/utils/pullOrigin.js +28 -0
  170. package/lib/utils/reinstallDependencies.js +133 -0
  171. package/lib/utils/removeAttributes.js +25 -23
  172. package/lib/utils/repoClone.js +59 -63
  173. package/lib/utils/request.js +64 -77
  174. package/lib/utils/resultSchema.json +73 -0
  175. package/lib/utils/rtl.js +59 -0
  176. package/lib/utils/setEnvVariables.js +13 -0
  177. package/lib/utils/ssTestHack.js +48 -0
  178. package/lib/utils/switchBranch.js +28 -0
  179. package/lib/utils/urlConcat.js +22 -0
  180. package/lib/utils/useExitCleanup.js +55 -0
  181. package/npm8.md +9 -0
  182. package/package.json +96 -64
  183. package/postpublish.js +6 -0
  184. package/templates/app/.eslintrc.js +140 -0
  185. package/templates/app/README.md +12 -12
  186. package/templates/app/app/index.html +24 -8
  187. package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
  188. package/templates/app/app/properties/i18nkeys.json +3 -3
  189. package/templates/app/docs/all.html +69 -69
  190. package/templates/app/mockapi/index.js +18 -13
  191. package/templates/app/package.json +37 -17
  192. package/templates/app/src/actions/SampleActions/index.js +37 -0
  193. package/templates/app/src/actions/index.js +65 -0
  194. package/templates/app/src/appUrls.js +19 -0
  195. package/templates/app/src/components/Alert/Alert.js +134 -0
  196. package/templates/app/src/components/Alert/Alert.module.css +79 -0
  197. package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -0
  198. package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -0
  199. package/templates/app/src/components/Sample/Sample.module.css +11 -0
  200. package/templates/app/src/components/Sample/SampleList.js +61 -0
  201. package/templates/app/src/components/Slider/Slider.css +41 -0
  202. package/templates/app/src/components/Slider/Slider.js +55 -0
  203. package/templates/app/src/containers/AlertContainer/index.js +15 -0
  204. package/templates/app/src/containers/AppContainer/index.js +96 -0
  205. package/templates/app/src/containers/AppContainer/index.module.css +27 -0
  206. package/templates/app/src/containers/CustomMatch/index.js +65 -0
  207. package/templates/app/src/containers/DevTools/index.js +10 -0
  208. package/templates/app/src/containers/Header/index.js +67 -0
  209. package/templates/app/src/containers/Header/index.module.css +43 -0
  210. package/templates/app/src/containers/Redirect/index.js +63 -0
  211. package/templates/app/src/containers/Redirector/index.js +47 -0
  212. package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -0
  213. package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -0
  214. package/templates/app/src/historyChange.js +5 -0
  215. package/templates/app/src/index.html +10 -0
  216. package/templates/app/src/index.js +24 -0
  217. package/templates/app/src/middleware/PromiseMiddleware.js +59 -0
  218. package/templates/app/src/reducers/alertData.js +11 -0
  219. package/templates/app/src/reducers/index.js +6 -0
  220. package/templates/app/src/reducers/samples.js +19 -0
  221. package/templates/app/src/store/configureStore.dev.js +51 -0
  222. package/templates/app/src/store/configureStore.js +5 -0
  223. package/templates/app/src/store/configureStore.prod.js +26 -0
  224. package/templates/app/src/util/Common.js +5 -0
  225. package/templates/app/src/util/RequestAPI.js +132 -0
  226. package/templates/appold/README.md +12 -0
  227. package/templates/appold/app/index.html +8 -0
  228. package/templates/appold/app/properties/ApplicationResources_en_US.properties +1 -0
  229. package/templates/appold/app/properties/i18nkeys.json +3 -0
  230. package/templates/appold/docs/all.html +69 -0
  231. package/templates/appold/mockapi/index.js +13 -0
  232. package/templates/{app → appold}/mockapi/tickets.json +0 -0
  233. package/templates/appold/package.json +17 -0
  234. package/templates/appold/src/components/Text/Text.css +0 -0
  235. package/templates/appold/src/components/Text/Text.js +23 -0
  236. package/templates/appold/src/components/Text/__tests__/Text.spec.js +30 -0
  237. package/templates/appold/src/components/Text/docs/Text__default.docs.js +16 -0
  238. package/templates/appold/src/components/docs.js +1 -0
  239. package/templates/appold/src/components/index.js +5 -0
  240. package/templates/appold/src/index.js +13 -0
  241. package/templates/docs/all.html +1 -1
  242. package/templates/docs/component.html +110 -69
  243. package/templates/docs/components.html +221 -0
  244. package/templates/docs/css/component.css +12 -14
  245. package/templates/docs/css/componentTest.css +7 -0
  246. package/templates/docs/css/style.css +150 -206
  247. package/templates/docs/impactReportTemplate.html +154 -0
  248. package/templates/docs/index.html +1482 -1336
  249. package/templates/library/src/index.js +0 -0
  250. package/.npmignore +0 -3
  251. package/cert/cert.pem +0 -129
  252. package/cert/key.pem +0 -27
  253. package/lib/common/getInsertAt.js +0 -36
  254. package/lib/common/getInsertIntoFunction.js +0 -13
  255. package/lib/configs/webpack.server.config.js +0 -93
  256. package/lib/plugins/ChunkManifestReplacePlugin.js +0 -94
  257. package/lib/plugins/RuntimePublicPathPlugin.js +0 -46
  258. package/lib/rmcntrlm.sh +0 -14
  259. package/lib/servers/nodeServer.js +0 -238
  260. package/lib/templates/HMRTemplate.js +0 -256
  261. package/lib/templates/publicPathTemplate.js +0 -16
  262. package/lib/utils/setConfig.js +0 -14
  263. package/node_modules/history/CHANGES.md +0 -395
  264. package/node_modules/history/DOMUtils.js +0 -3
  265. package/node_modules/history/ExecutionEnvironment.js +0 -3
  266. package/node_modules/history/LICENSE +0 -21
  267. package/node_modules/history/LocationUtils.js +0 -3
  268. package/node_modules/history/PathUtils.js +0 -3
  269. package/node_modules/history/README.md +0 -282
  270. package/node_modules/history/cjs/history.js +0 -933
  271. package/node_modules/history/cjs/history.min.js +0 -1
  272. package/node_modules/history/createBrowserHistory.js +0 -3
  273. package/node_modules/history/createHashHistory.js +0 -3
  274. package/node_modules/history/createMemoryHistory.js +0 -3
  275. package/node_modules/history/createTransitionManager.js +0 -3
  276. package/node_modules/history/es/DOMUtils.js +0 -7
  277. package/node_modules/history/es/ExecutionEnvironment.js +0 -7
  278. package/node_modules/history/es/LocationUtils.js +0 -7
  279. package/node_modules/history/es/PathUtils.js +0 -7
  280. package/node_modules/history/es/createBrowserHistory.js +0 -7
  281. package/node_modules/history/es/createHashHistory.js +0 -7
  282. package/node_modules/history/es/createMemoryHistory.js +0 -7
  283. package/node_modules/history/es/createTransitionManager.js +0 -7
  284. package/node_modules/history/es/warnAboutDeprecatedESMImport.js +0 -35
  285. package/node_modules/history/esm/history.js +0 -904
  286. package/node_modules/history/index.js +0 -7
  287. package/node_modules/history/package.json +0 -134
  288. package/node_modules/history/umd/history.js +0 -1059
  289. package/node_modules/history/umd/history.min.js +0 -1
  290. package/node_modules/history/warnAboutDeprecatedCJSRequire.js +0 -35
  291. package/templates/app/.npmignore +0 -9
  292. package/templates/library/.npmignore +0 -9
@@ -1,25 +1,39 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- var _path = require('path');
3
+ var _fs = require("fs");
4
4
 
5
- var _path2 = _interopRequireDefault(_path);
5
+ var _path = _interopRequireDefault(require("path"));
6
+
7
+ var _libAlias = require("./libAlias");
6
8
 
7
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
10
 
9
- var appPath = process.cwd();
11
+ let appPath = process.cwd(); // '^@root(.*)$': '<rootDir>/src$1',
12
+ // '^@components(.*)$': '<rootDir>/src/components$1',
13
+
14
+ let moduleNameMapper = Object.keys(_libAlias.libAlias).reduce((previousValue, key) => {
15
+ previousValue[`^${key}(.*)$`] = `${_libAlias.libAlias[key]}$1`;
16
+ return previousValue;
17
+ }, {});
10
18
 
11
- var commonConfig = {
19
+ const appGlobals = _path.default.resolve(appPath, '__testUtils__', 'globals.js');
20
+
21
+ let commonConfig = {
12
22
  coverageReporters: ['json', 'html', 'json-summary', 'text'],
13
23
  collectCoverage: true,
14
- moduleDirectories: [_path2.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules'],
24
+ moduleDirectories: [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules'],
15
25
  transform: {
16
- '^.+\\.(js|jsx)$': _path2.default.resolve(__dirname, '..', 'jest', 'preProcessors', 'jsPreprocessor.js'),
17
- '^.+\\.css$': _path2.default.resolve(__dirname, '..', 'jest', 'preProcessors', 'cssPreprocessor.js'),
18
- '^(?!.*\\.(js|jsx|css|json)$)': _path2.default.resolve(__dirname, '..', 'jest', 'preProcessors', 'otherFilesPreprocessor.js')
26
+ '^.+\\.(js|jsx)$': _path.default.resolve(__dirname, '..', 'jest', 'preProcessors', 'jsPreprocessor.js'),
27
+ '^.+\\.css$': _path.default.resolve(__dirname, '..', 'jest', 'preProcessors', 'cssPreprocessor.js'),
28
+ '^(?!.*\\.(js|jsx|css|json)$)': _path.default.resolve(__dirname, '..', 'jest', 'preProcessors', 'otherFilesPreprocessor.js')
29
+ },
30
+ moduleNameMapper: { ...moduleNameMapper,
31
+ '\\.(css|less)$': 'identity-obj-proxy'
19
32
  },
20
- transformIgnorePatterns: ['/node_modules.*?.js$'],
33
+ transformIgnorePatterns: ['/node_modules/(?!(@zohodesk)/)'],
34
+ // transformIgnorePatterns: ['/node_modules.*?.js$'],
21
35
  moduleFileExtensions: ['js'],
22
- setupFiles: [_path2.default.resolve(appPath, '__testUtils__', 'globals.js'), _path2.default.resolve(__dirname, '..', 'jest', 'setup.js')],
36
+ setupFiles: [(0, _fs.existsSync)(appGlobals) && appGlobals, _path.default.resolve(__dirname, '..', 'jest', 'setup.js')].filter(Boolean),
23
37
  globals: {
24
38
  __DEVELOPMENT__: true,
25
39
  __DOCS__: false,
@@ -27,20 +41,13 @@ var commonConfig = {
27
41
  }
28
42
  };
29
43
 
30
- module.exports = function () {
31
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
32
- args[_key] = arguments[_key];
33
- }
34
-
35
- var appFolder = args[0],
36
- _args$ = args[1],
37
- forCommittedFiles = _args$ === undefined ? false : _args$;
38
-
44
+ module.exports = (...args) => {
45
+ let [appFolder, forCommittedFiles = false] = args;
39
46
 
40
47
  if (forCommittedFiles) {
41
48
  return Object.assign({}, commonConfig, {
42
- coverageDirectory: _path2.default.resolve(appPath, 'commitCoverage'),
43
- testResultsProcessor: _path2.default.resolve(__dirname, '..', 'jest', 'commitedFilesResult.js')
49
+ coverageDirectory: _path.default.resolve(appPath, 'commitCoverage'),
50
+ testResultsProcessor: _path.default.resolve(__dirname, '..', 'jest', 'commitedFilesResult.js')
44
51
  });
45
52
  }
46
53
 
@@ -48,11 +55,8 @@ module.exports = function () {
48
55
  rootDir: appPath,
49
56
  testPathIgnorePatterns: ['/node_modules/', 'docs'],
50
57
  unmockedModulePathPatterns: ['__tests__', 'node_modules', '.*'],
51
- roots: ['<rootDir>/' + appFolder + '/'],
58
+ roots: [`<rootDir>/${appFolder}/`],
52
59
  testRegex: '(/__tests__/.*|\\.(test|spec))\\.(jsx|js|json|node)$',
53
- moduleNameMapper: {
54
- '\\.(css|less)$': 'identity-obj-proxy'
55
- },
56
- testResultsProcessor: _path2.default.resolve(__dirname, '..', 'jest', 'result.js')
60
+ testResultsProcessor: _path.default.resolve(__dirname, '..', 'jest', 'result.js')
57
61
  });
58
62
  };
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.libAlias = void 0;
7
+ // the reason for alias at the time was code tree shaking
8
+ // tree shaking was most compactable with ES module system
9
+ // FIXME: But there is a posiblity when these package does not have lib,
10
+ // app will work because of alias, But may be jest won't work because of not alais
11
+ // So need to think about use alais in jest
12
+ const libAlias = {
13
+ '@zohodesk/components/lib': '@zohodesk/components/es',
14
+ // '@zohodesk/zc-custom/lib': '@zohodesk/zc-custom/es',
15
+ '@zohodesk/dot/lib': '@zohodesk/dot/es',
16
+ '@zohodesk/i18n/lib': '@zohodesk/i18n/es',
17
+ '@zohodesk/icons/lib': '@zohodesk/icons/es',
18
+ '@zohodesk/normalizer/lib': '@zohodesk/normalizer/es',
19
+ '@zohodesk/perf-components/lib': '@zohodesk/perf-components/es',
20
+ '@zohodesk/perf-middleware/lib': '@zohodesk/perf-middleware/es',
21
+ '@zohodesk/permissions/lib': '@zohodesk/permissions/es',
22
+ '@zohodesk/platform-middleware/lib': '@zohodesk/platform-middleware/es',
23
+ '@zohodesk/react-dnd/lib': '@zohodesk/react-dnd/es',
24
+ '@zohodesk/router-middleware/lib': '@zohodesk/router-middleware/es',
25
+ '@zohodesk/storage/lib': '@zohodesk/storage/es',
26
+ '@zohodesk/svg/lib': '@zohodesk/svg/es',
27
+ '@zohodesk/timetracker/lib': '@zohodesk/timetracker/es',
28
+ '@zohodesk/variables/lib': '@zohodesk/variables/es',
29
+ '@zohodesk/virtualizer/lib': '@zohodesk/virtualizer/es'
30
+ };
31
+ exports.libAlias = libAlias;
@@ -1,49 +1,39 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- var _path = require('path');
3
+ var _path = _interopRequireDefault(require("path"));
4
4
 
5
- var _path2 = _interopRequireDefault(_path);
5
+ var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
6
6
 
7
- var _utils = require('../utils');
7
+ var _utils = require("../utils");
8
8
 
9
- var _pluginUtils = require('../pluginUtils');
9
+ var _pluginUtils = require("../pluginUtils");
10
10
 
11
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
12
 
13
- var options = (0, _utils.getOptions)();
14
-
15
- var _options$umd$componen = options.umd.component,
16
- umdVar = _options$umd$componen.umdVar,
17
- isHtml = _options$umd$componen.isHtml,
18
- isDocs = _options$umd$componen.isDocs,
19
- watch = _options$umd$componen.watch,
20
- outputFolder = _options$umd$componen.outputFolder,
21
- cssUniqueness = _options$umd$componen.cssUniqueness,
22
- folder = _options$umd$componen.folder,
23
- singleStyleTag = _options$umd$componen.singleStyleTag;
24
-
25
-
26
- var appPath = process.cwd();
27
- var className = cssUniqueness ? 'fz__[hash:base64:5]' : '[name]__[local]';
28
-
29
- var styleLoaderOption = {
30
- singleton: singleStyleTag
31
- };
32
-
33
- // let publicPath =
34
- // `${process.env.npm_config_public_path ||
35
- // `${'//js.zohostatic.com/support/zohodeskcomponent' +
36
- // '@'}${
37
- // process.env.npm_package_version}` }/dist/`;
38
-
13
+ let options = (0, _utils.getOptions)();
14
+ let {
15
+ umd: {
16
+ component: {
17
+ umdVar,
18
+ isHtml,
19
+ isDocs,
20
+ watch,
21
+ outputFolder,
22
+ cssUniqueness,
23
+ folder
24
+ }
25
+ }
26
+ } = options;
27
+ let appPath = process.cwd();
28
+ let className = cssUniqueness ? 'fz__[hash:base64:5]' : '[name]__[local]';
39
29
  module.exports = {
40
30
  watch: watch,
41
31
  entry: {
42
- main: _path2.default.join(appPath, folder, isHtml ? 'html.js' : 'index.js')
32
+ main: _path.default.join(appPath, folder, isHtml ? 'html.js' : 'index.js')
43
33
  },
44
34
  output: {
45
- path: _path2.default.join(appPath, outputFolder),
46
- filename: '[name].js',
35
+ path: _path.default.join(appPath, outputFolder),
36
+ filename: 'js/[name].js',
47
37
  library: umdVar,
48
38
  libraryTarget: 'umd'
49
39
  },
@@ -54,38 +44,41 @@ module.exports = {
54
44
  plugins: (0, _pluginUtils.getUMDComponentPlugins)(isDocs),
55
45
  module: {
56
46
  rules: [{
57
- include: /\.json$/,
58
- use: [{
59
- loader: 'json-loader'
60
- }]
61
- }, {
62
47
  test: /\.js$/,
63
48
  use: [{
64
49
  loader: 'babel-loader',
65
50
  options: {
66
- presets: [[require.resolve('babel-preset-env'), { modules: false }], require.resolve('babel-preset-react')],
67
- plugins: [[require.resolve('babel-plugin-transform-runtime'), {
68
- helpers: true,
69
- polyfill: true,
70
- regenerator: false,
71
- moduleName: 'babel-runtime'
72
- }]],
51
+ presets: [[require.resolve('@babel/preset-env'), {
52
+ modules: false
53
+ }], require.resolve('@babel/preset-react')],
54
+ plugins: [require.resolve('@babel/plugin-proposal-object-rest-spread')],
73
55
  cacheDirectory: true
74
56
  }
75
57
  }],
76
- include: _path2.default.join(appPath, 'src')
58
+ include: _path.default.join(appPath, 'src')
77
59
  }, {
78
- test: /\.css$/,
79
- use: [{ loader: 'style-loader', options: styleLoaderOption }, 'css-loader?modules&localIdentName=' + className]
60
+ test: /(\.module)?\.css$/,
61
+ use: [{
62
+ loader: _miniCssExtractPlugin.default.loader,
63
+ options: {
64
+ publicPath: '../'
65
+ }
66
+ }, {
67
+ loader: 'css-loader',
68
+ options: {
69
+ modules: true,
70
+ localIdentName: className
71
+ }
72
+ }]
80
73
  }, isDocs ? {
81
74
  test: /\.docs\.js$/,
82
- use: require.resolve('../docsLoader.js'),
75
+ use: require.resolve('../loaders/docsLoader.js'),
83
76
  exclude: /node_modules/
84
77
  } : {}, {
85
78
  test: /\.jpe?g$|\.gif$|\.png$/,
86
79
  use: ['url-loader?limit=10000&name=./images/[name].[ext]']
87
80
  }, {
88
- test: /\.woff$|\.ttf$|\.eot$/,
81
+ test: /\.woff$|\.woff2$|\.ttf$|\.eot$/,
89
82
  use: ['url-loader?limit=10000&name=./fonts/[name].[ext]']
90
83
  }, {
91
84
  test: /\.svg$/,
@@ -102,9 +95,9 @@ module.exports = {
102
95
  }]
103
96
  },
104
97
  resolve: {
105
- modules: [_path2.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
98
+ modules: [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
106
99
  },
107
100
  resolveLoader: {
108
- modules: [_path2.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
101
+ modules: [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
109
102
  }
110
103
  };
@@ -1,42 +1,42 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- var _path = require('path');
3
+ var _path = _interopRequireDefault(require("path"));
4
4
 
5
- var _path2 = _interopRequireDefault(_path);
5
+ var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
6
6
 
7
- var _miniCssExtractPlugin = require('mini-css-extract-plugin');
7
+ var _utils = require("../utils");
8
8
 
9
- var _miniCssExtractPlugin2 = _interopRequireDefault(_miniCssExtractPlugin);
9
+ var _cssClassNameGenerate = _interopRequireDefault(require("../utils/cssClassNameGenerate"));
10
10
 
11
- var _utils = require('../utils');
12
-
13
- var _pluginUtils = require('../pluginUtils');
11
+ var _pluginUtils = require("../pluginUtils");
14
12
 
15
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
14
 
17
- var options = (0, _utils.getOptions)();
18
- var _options$umd$css = options.umd.css,
19
- umdVar = _options$umd$css.umdVar,
20
- watch = _options$umd$css.watch,
21
- outputFolder = _options$umd$css.outputFolder,
22
- cssUniqueness = _options$umd$css.cssUniqueness,
23
- folder = _options$umd$css.folder,
24
- publicPath = _options$umd$css.publicPath,
25
- packageVersion = options.packageVersion;
26
-
27
-
28
- var appPath = process.cwd();
29
- var className = cssUniqueness ? 'fz__[hash:base64:5]' : '[name]__[local]';
30
-
31
- var publicPathStr = (publicPath || '//js.zohostatic.com/support/zohodeskcomponent@' + packageVersion) + '/' + outputFolder + '/';
32
-
15
+ let options = (0, _utils.getOptions)();
16
+ let {
17
+ umd: {
18
+ css: {
19
+ umdVar,
20
+ watch,
21
+ outputFolder,
22
+ cssUniqueness,
23
+ folder,
24
+ publicPath,
25
+ cssHashSelectors,
26
+ classNamePrefix
27
+ }
28
+ },
29
+ packageVersion
30
+ } = options;
31
+ let appPath = process.cwd();
32
+ let publicPathStr = `${publicPath || `${'//js.zohostatic.com/support/zohodeskcomponent@'}${packageVersion}`}/${outputFolder}/`;
33
33
  module.exports = {
34
34
  watch: watch,
35
35
  entry: {
36
- main: _path2.default.join(appPath, folder, 'css.js')
36
+ main: _path.default.join(appPath, folder, 'css.js')
37
37
  },
38
38
  output: {
39
- path: _path2.default.resolve(appPath, outputFolder),
39
+ path: _path.default.resolve(appPath, outputFolder),
40
40
  filename: '[name].js',
41
41
  library: umdVar,
42
42
  libraryTarget: 'umd',
@@ -58,39 +58,40 @@ module.exports = {
58
58
  use: [{
59
59
  loader: 'babel-loader',
60
60
  options: {
61
- presets: [[require.resolve('babel-preset-env'), { modules: false }], require.resolve('babel-preset-react')],
62
- plugins: [[require.resolve('babel-plugin-transform-runtime'), {
63
- helpers: true,
64
- polyfill: true,
65
- regenerator: false,
66
- moduleName: 'babel-runtime'
67
- }]],
61
+ presets: [[require.resolve('@babel/preset-env'), {
62
+ modules: false
63
+ }], require.resolve('@babel/preset-react')],
64
+ plugins: [require.resolve('@babel/plugin-proposal-object-rest-spread')],
68
65
  cacheDirectory: true
69
66
  }
70
67
  }],
71
- include: _path2.default.join(appPath, 'src')
72
- }, {
73
- test: /\.css$/,
68
+ include: _path.default.join(appPath, 'src')
69
+ }
70
+ /*,
71
+ {
72
+ test: /\.css$/,
73
+ use: [MiniCssExtractPlugin.loader, 'css-loader']
74
+ }*/
75
+ , {
76
+ test: /(\.module)?\.css$/,
74
77
  use: [{
75
- loader: _miniCssExtractPlugin2.default.loader,
78
+ loader: _miniCssExtractPlugin.default.loader,
76
79
  options: {
77
- // you can specify a publicPath here
78
- // by default it use publicPath in webpackOptions.output
79
- //publicPath: '../'
80
+ publicPath: '../'
80
81
  }
81
82
  }, {
82
83
  loader: 'css-loader',
83
84
  options: {
84
- modules: true,
85
- localIdentName: '' + className,
86
- minimize: true
85
+ modules: {
86
+ getLocalIdent: (0, _cssClassNameGenerate.default)(cssUniqueness, cssHashSelectors, classNamePrefix)
87
+ }
87
88
  }
88
89
  }]
89
90
  }, {
90
91
  test: /\.jpe?g$|\.gif$|\.png$/,
91
92
  use: ['url-loader?limit=10000&name=./images/[name].[ext]']
92
93
  }, {
93
- test: /\.woff$|\.ttf$|\.eot$/,
94
+ test: /\.woff$|\.woff2$|\.ttf$|\.eot$/,
94
95
  use: ['url-loader?limit=10000&name=./fonts/[name].[ext]']
95
96
  }, {
96
97
  test: /\.svg$/,
@@ -107,9 +108,9 @@ module.exports = {
107
108
  }]
108
109
  },
109
110
  resolve: {
110
- modules: [_path2.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
111
+ modules: [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
111
112
  },
112
113
  resolveLoader: {
113
- modules: [_path2.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
114
+ modules: [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
114
115
  }
115
116
  };
@@ -1,120 +1,135 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- var _path = require('path');
3
+ var _path = _interopRequireDefault(require("path"));
4
4
 
5
- var _path2 = _interopRequireDefault(_path);
5
+ var _utils = require("../utils");
6
6
 
7
- var _utils = require('../utils');
7
+ var _common = require("../common");
8
8
 
9
- var _common = require('../common');
9
+ var _pluginUtils = require("../pluginUtils");
10
10
 
11
- var _miniCssExtractPlugin = require('mini-css-extract-plugin');
11
+ var _loaderUtils = require("../loaderUtils");
12
12
 
13
- var _miniCssExtractPlugin2 = _interopRequireDefault(_miniCssExtractPlugin);
13
+ var _libAlias = require("./libAlias");
14
14
 
15
- var _pluginUtils = require('../pluginUtils');
16
-
17
- var _loaderUtils = require('../loaderUtils');
15
+ var _configsAssetsLoaders = require("../loaderUtils/configsAssetsLoaders");
18
16
 
19
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
18
 
21
- var options = (0, _utils.getOptions)();
22
- var _options$app = options.app,
23
- folder = _options$app.folder,
24
- context = _options$app.context,
25
- server = _options$app.server,
26
- styleTarget = _options$app.styleTarget,
27
- useInsertInto = _options$app.useInsertInto,
28
- useInsertAt = _options$app.useInsertAt,
29
- outputFolder = _options$app.outputFolder,
30
- disableES5Transpile = _options$app.disableES5Transpile,
31
- singleStyleTag = _options$app.singleStyleTag,
32
- enableEslint = options.esLint.enable;
33
- var hotReload = server.hotReload,
34
- disableContextURL = server.disableContextURL;
35
-
36
-
37
- var appPath = process.cwd();
38
- var contextURL = disableContextURL ? '' : context;
39
- var serverUrl = (0, _utils.getServerURL)(server);
40
-
41
- var styleLoaderOption = {
42
- singleton: singleStyleTag
43
- };
44
-
45
- if (useInsertInto) {
46
- styleLoaderOption.insertInto = (0, _common.getInsertIntoFunction)(styleTarget);
47
- }
48
-
49
- if (useInsertAt) {
50
- var getInsertAt = require('../common/getInsertAt');
51
- var insertAt = getInsertAt();
52
- styleLoaderOption.insertAt = insertAt;
53
- }
54
-
55
- var output = {
56
- path: _path2.default.join(appPath, outputFolder),
19
+ let options = (0, _utils.getOptions)();
20
+ let {
21
+ unstableDepsInverse,
22
+ app: {
23
+ folder,
24
+ context,
25
+ server,
26
+ outputFolder,
27
+ plugins,
28
+ exclude,
29
+ mediaQueryHoverActiveString,
30
+ cssUniqueness,
31
+ seperateCssModules,
32
+ changeRuntimeChunkChar,
33
+ // we are going to use this for fonts file name collide in issue in devmode
34
+ enableChunkHash,
35
+ cssHashSelectors,
36
+ classNamePrefix,
37
+ selectorReplace,
38
+ disableES5Transpile,
39
+ devConsoleExculde,
40
+ sourcemap,
41
+ crossorigin
42
+ }
43
+ } = options;
44
+ let {
45
+ disableContextURL
46
+ } = server;
47
+ let appPath = process.cwd();
48
+ let contextURL = disableContextURL ? '' : context;
49
+ let serverUrl = (0, _utils.getServerURL)(server, 'https');
50
+ let output = {
51
+ path: _path.default.join(appPath, outputFolder),
57
52
  filename: 'js/[name].js',
58
53
  chunkFilename: 'js/[name].js',
59
- publicPath: [serverUrl, contextURL].filter(function (a) {
60
- return a;
61
- }).join('/') + '/',
62
- jsonpFunction: context + 'Jsonp'
54
+ publicPath: `${[serverUrl, contextURL].filter(a => a).join('/')}/`,
55
+ jsonpFunction: `${context}Jsonp`
63
56
  };
57
+ const nameTemplate = (0, _configsAssetsLoaders.createNameTemplate)(enableChunkHash);
64
58
 
65
- if (hotReload) {
66
- output.devtoolModuleFilenameTemplate = function (info) {
67
- return _path2.default.resolve(info.absoluteResourcePath);
68
- };
59
+ if (crossorigin) {
60
+ output.crossOriginLoading = 'anonymous';
69
61
  }
70
62
 
71
63
  module.exports = {
72
- entry: (0, _common.getEntries)(options, 'development'),
73
- devtool: hotReload ? 'cheap-module-source-map' : 'cheap-eval-source-map',
64
+ entry: (0, _common.getEntries)(options, 'dev'),
65
+ devtool: sourcemap,
74
66
  mode: 'development',
75
- output: output,
76
- optimization: { splitChunks: _common.splitChunks },
77
- plugins: (0, _pluginUtils.getDevPlugins)(options),
67
+ // watchOptions: {
68
+ // ignored: /node_modules.(?!@zohodesk)/
69
+ // },
70
+ output,
71
+ stats: options.app.disableWatch ? 'errors-only' : {
72
+ children: false
73
+ },
74
+ optimization: {
75
+ splitChunks: _common.splitChunks,
76
+ moduleIds: 'named',
77
+ runtimeChunk: {
78
+ name: entrypoint => changeRuntimeChunkChar ? `./runtime-${entrypoint.name}` : `./runtime~${entrypoint.name}`
79
+ }
80
+ },
81
+ plugins: (0, _pluginUtils.getDevPlugins)(options, output.publicPath),
78
82
  module: {
83
+ /* strictExportPresence for break the build when imported module not present in respective file */
84
+ strictExportPresence: true,
79
85
  rules: [{
80
86
  test: /\.js$/,
81
- use: (0, _loaderUtils.getDevJsLoaders)(enableEslint, disableES5Transpile, hotReload),
82
- // exclude: /(node_modules|bower_components)/
83
- include: _path2.default.join(appPath, folder)
84
- }, {
87
+ use: (0, _loaderUtils.getDevJsLoaders)(options),
88
+ include: module => {
89
+ let srcPath = _path.default.join(appPath, folder);
90
+
91
+ let depsPath = _path.default.join(appPath, 'node_modules', '@zohodesk');
92
+
93
+ if (module.includes(srcPath) || devConsoleExculde && module.includes(depsPath)) {
94
+ return true;
95
+ }
96
+
97
+ return false;
98
+ }
99
+ }, seperateCssModules ? {
85
100
  test: /\.css$/,
101
+ exclude: /\.module\.css$/,
102
+ use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, mediaQueryHoverActiveString, '[local]', false, null)
103
+ } : null, {
104
+ test: seperateCssModules ? /\.module\.css$/ : /(\.module)?\.css$/,
105
+ use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, mediaQueryHoverActiveString, null, cssUniqueness, selectorReplace, cssHashSelectors, classNamePrefix)
106
+ }, (0, _configsAssetsLoaders.configImageLoader)(nameTemplate), (0, _configsAssetsLoaders.configFontLoader)(nameTemplate), (0, _configsAssetsLoaders.configSVGLoader)(nameTemplate), (0, _configsAssetsLoaders.configVideoLoader)(nameTemplate), (0, _configsAssetsLoaders.configAudioLoader)(nameTemplate), {
107
+ test: /\.tmpl$/,
86
108
  use: [{
87
- loader: _miniCssExtractPlugin2.default.loader,
109
+ loader: 'html-loader',
88
110
  options: {
89
- // you can specify a publicPath here
90
- // by default it use publicPath in webpackOptions.output
91
- //publicPath: '../'
92
- }
93
- }, {
94
- loader: 'css-loader',
95
- options: {
96
- modules: true,
97
- localIdentName: '[name]__[local]__[hash:base64:5]'
111
+ minimize: true
98
112
  }
99
113
  }]
100
114
  }, {
101
- test: /\.jpe?g$|\.gif$|\.png$/,
102
- use: ['url-loader?limit=1000&name=./images/[name].[ext]']
103
- }, {
104
- test: /\.woff2|\.woff$|\.ttf$|\.eot$/,
105
- use: ['url-loader?limit=1000&name=./fonts/[name].[ext]']
106
- }, {
107
- test: /\.svg$/,
108
- use: ['url-loader?limit=1&name=./fonts/[name].[ext]']
109
- }]
115
+ test: /\.worker.js$/,
116
+ use: {
117
+ loader: require.resolve('../loaders/workerLoader.js'),
118
+ options: {
119
+ esModule: true,
120
+ filename: 'js/[name].js'
121
+ }
122
+ }
123
+ }].filter(Boolean)
110
124
  },
111
125
  externals: {
112
126
  ZC: '$ZC'
113
127
  },
114
128
  resolve: {
115
- modules: [_path2.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
129
+ modules: unstableDepsInverse ? ['node_modules', _path.default.resolve(__dirname, '..', '..', 'node_modules')] : [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules'],
130
+ alias: disableES5Transpile ? _libAlias.libAlias : {}
116
131
  },
117
132
  resolveLoader: {
118
- modules: [_path2.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
133
+ modules: unstableDepsInverse ? ['node_modules', _path.default.resolve(__dirname, '..', '..', 'node_modules')] : [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
119
134
  }
120
135
  };