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

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 (128) hide show
  1. package/.eslintignore +7 -7
  2. package/.eslintrc.js +180 -179
  3. package/.prettierrc +6 -6
  4. package/{CHANGELOG.md → CHANGELOG-fz.md} +0 -0
  5. package/Changelog.md +1019 -0
  6. package/README.md +27 -951
  7. package/bin/cli.js +483 -483
  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/configs/jest.config.js +8 -12
  19. package/lib/configs/libAlias.js +10 -3
  20. package/lib/configs/resolvers.js +38 -0
  21. package/lib/configs/webpack.css.umd.config.js +4 -4
  22. package/lib/configs/webpack.dev.config.js +17 -22
  23. package/lib/configs/webpack.docs.config.js +10 -15
  24. package/lib/configs/webpack.impact.config.js +11 -11
  25. package/lib/configs/webpack.prod.config.js +22 -24
  26. package/lib/constants.js +31 -0
  27. package/lib/jest/preProcessors/cssPreprocessor.js +16 -7
  28. package/lib/loaderUtils/configsAssetsLoaders.js +33 -33
  29. package/lib/loaderUtils/getCSSLoaders.js +42 -22
  30. package/lib/loaders/workerLoader.js +9 -9
  31. package/lib/pluginUtils/configHtmlWebpackPlugins.js +59 -0
  32. package/lib/pluginUtils/getDevPlugins.js +19 -39
  33. package/lib/pluginUtils/getProdPlugins.js +29 -47
  34. package/lib/plugins/EFCPlugin.md +6 -6
  35. package/lib/plugins/I18NInjectIntoIndexPlugin.js +4 -4
  36. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +38 -38
  37. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +30 -30
  38. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +8 -8
  39. package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -95
  40. package/lib/plugins/I18nSplitPlugin/README.md +25 -25
  41. package/lib/plugins/I18nSplitPlugin/index.js +57 -57
  42. package/lib/plugins/ResourceHintsPlugin.js +17 -17
  43. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +16 -24
  44. package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -30
  45. package/lib/plugins/ServiceWorkerPlugin.js +9 -9
  46. package/lib/plugins/TPHashMappingPlugin.js +4 -4
  47. package/lib/postcss-plugins/RTLSplitPlugin.js +10 -10
  48. package/lib/postcss-plugins/__test__/test1Input.css +38 -38
  49. package/lib/postcss-plugins/__test__/test1Output.css +38 -38
  50. package/lib/postcss-plugins/hoverActivePlugin.js +54 -30
  51. package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +37 -0
  52. package/lib/postcss-plugins/variableModificationPlugin/index.js +248 -0
  53. package/lib/postcss-plugins/variableModifier.js +1 -0
  54. package/lib/schemas/index.js +36 -8
  55. package/lib/servers/docsServerCore.js +13 -12
  56. package/lib/servers/getCliPath.js +1 -1
  57. package/lib/servers/httpsOptions.js +40 -9
  58. package/lib/servers/nowatchserver.js +12 -11
  59. package/lib/servers/server.js +14 -13
  60. package/lib/sh/pre-commit.sh +34 -34
  61. package/lib/sh/reportPublish.sh +45 -45
  62. package/lib/utils/buildstats.html +148 -148
  63. package/lib/utils/getOptions.js +42 -14
  64. package/lib/utils/resultSchema.json +73 -73
  65. package/npm8.md +9 -9
  66. package/package.json +119 -148
  67. package/postpublish.js +8 -6
  68. package/templates/app/.eslintrc.js +140 -140
  69. package/templates/app/README.md +12 -12
  70. package/templates/app/app/index.html +24 -24
  71. package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
  72. package/templates/app/app/properties/i18nkeys.json +3 -3
  73. package/templates/app/docs/all.html +69 -69
  74. package/templates/app/mockapi/index.js +18 -18
  75. package/templates/app/package.json +37 -37
  76. package/templates/app/src/actions/SampleActions/index.js +37 -37
  77. package/templates/app/src/actions/index.js +65 -65
  78. package/templates/app/src/appUrls.js +19 -19
  79. package/templates/app/src/components/Alert/Alert.js +134 -134
  80. package/templates/app/src/components/Alert/Alert.module.css +79 -79
  81. package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -37
  82. package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -84
  83. package/templates/app/src/components/Sample/Sample.module.css +11 -11
  84. package/templates/app/src/components/Sample/SampleList.js +61 -61
  85. package/templates/app/src/components/Slider/Slider.css +41 -41
  86. package/templates/app/src/components/Slider/Slider.js +55 -55
  87. package/templates/app/src/containers/AlertContainer/index.js +15 -15
  88. package/templates/app/src/containers/AppContainer/index.js +96 -96
  89. package/templates/app/src/containers/AppContainer/index.module.css +27 -27
  90. package/templates/app/src/containers/CustomMatch/index.js +65 -65
  91. package/templates/app/src/containers/DevTools/index.js +10 -10
  92. package/templates/app/src/containers/Header/index.js +67 -67
  93. package/templates/app/src/containers/Header/index.module.css +43 -43
  94. package/templates/app/src/containers/Redirect/index.js +63 -63
  95. package/templates/app/src/containers/Redirector/index.js +47 -47
  96. package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -42
  97. package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -3
  98. package/templates/app/src/historyChange.js +5 -5
  99. package/templates/app/src/index.html +10 -10
  100. package/templates/app/src/index.js +24 -24
  101. package/templates/app/src/middleware/PromiseMiddleware.js +59 -59
  102. package/templates/app/src/reducers/alertData.js +11 -11
  103. package/templates/app/src/reducers/index.js +6 -6
  104. package/templates/app/src/reducers/samples.js +19 -19
  105. package/templates/app/src/store/configureStore.dev.js +51 -51
  106. package/templates/app/src/store/configureStore.js +5 -5
  107. package/templates/app/src/store/configureStore.prod.js +26 -26
  108. package/templates/app/src/util/Common.js +5 -5
  109. package/templates/app/src/util/RequestAPI.js +132 -132
  110. package/templates/docs/all.html +249 -249
  111. package/templates/docs/component.html +178 -178
  112. package/templates/docs/components.html +221 -221
  113. package/templates/docs/css/b.min.css +6 -6
  114. package/templates/docs/css/component.css +42 -42
  115. package/templates/docs/css/componentTest.css +6 -6
  116. package/templates/docs/css/hopscotch.css +585 -585
  117. package/templates/docs/css/style.css +1022 -1022
  118. package/templates/docs/impactReportTemplate.html +154 -154
  119. package/templates/docs/index.html +1501 -1493
  120. package/templates/docs/js/active-line.js +72 -72
  121. package/templates/docs/js/b.min.js +7 -7
  122. package/templates/docs/js/codemirror.js +9680 -9680
  123. package/templates/docs/js/designTokens.js +334 -334
  124. package/templates/docs/js/j.min.js +4 -4
  125. package/templates/docs/js/javascript.js +874 -874
  126. package/templates/docs/js/matchbrackets.js +145 -145
  127. package/cert/Tsicsezwild-22-23.crt +0 -37
  128. package/cert/Tsicsezwild-22-23.key +0 -27
@@ -1,35 +1,35 @@
1
- npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
2
- npm WARN deprecated eslint-loader@4.0.2: This loader has been deprecated. Please use eslint-webpack-plugin
3
- npm WARN deprecated gitlab@14.2.2: The gitlab package has found a new home in the @gitbeaker organization. For the latest gitlab node library, check out @gitbeaker/node. A full list of the features can be found here: https://github.com/jdalrymple/gitbeaker#readme
4
- npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
5
- npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
6
- npm WARN deprecated webdriverio@4.14.4: outdated version, please use @next
7
- npm WARN deprecated mkdirp@0.3.5: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
8
- npm WARN deprecated cross-spawn-async@1.0.1: cross-spawn no longer requires a build toolchain, use it instead
9
- npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
10
- npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
11
- npm WARN deprecated har-validator@5.1.5: this library is no longer supported
12
- npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
13
- npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
14
- npm WARN deprecated sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
15
- npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
16
- npm WARN deprecated flatten@1.0.3: flatten is deprecated in favor of utility frameworks such as lodash.
17
- npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/chokidar/node_modules/fsevents):
18
- npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
19
- npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^2.1.2 (node_modules/jest-haste-map/node_modules/fsevents):
20
- npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
21
- npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/nodemon/node_modules/chokidar/node_modules/fsevents):
22
- npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
23
- npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/watchpack/node_modules/chokidar/node_modules/fsevents):
24
- npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
25
- npm WARN check2@1.0.0 No description
26
- npm WARN check2@1.0.0 No repository field.
27
-
28
- + @zohodesk/react-cli@0.0.1-beta.165
29
- updated 1 package and audited 1899 packages in 51.509s
30
-
31
- 21 packages are looking for funding
32
- run `npm fund` for details
33
-
34
- found 42 vulnerabilities (2 low, 20 moderate, 8 high, 12 critical)
35
- run `npm audit fix` to fix them, or `npm audit` for details
1
+ npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
2
+ npm WARN deprecated eslint-loader@4.0.2: This loader has been deprecated. Please use eslint-webpack-plugin
3
+ npm WARN deprecated gitlab@14.2.2: The gitlab package has found a new home in the @gitbeaker organization. For the latest gitlab node library, check out @gitbeaker/node. A full list of the features can be found here: https://github.com/jdalrymple/gitbeaker#readme
4
+ npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
5
+ npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
6
+ npm WARN deprecated webdriverio@4.14.4: outdated version, please use @next
7
+ npm WARN deprecated mkdirp@0.3.5: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
8
+ npm WARN deprecated cross-spawn-async@1.0.1: cross-spawn no longer requires a build toolchain, use it instead
9
+ npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
10
+ npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
11
+ npm WARN deprecated har-validator@5.1.5: this library is no longer supported
12
+ npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
13
+ npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
14
+ npm WARN deprecated sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
15
+ npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
16
+ npm WARN deprecated flatten@1.0.3: flatten is deprecated in favor of utility frameworks such as lodash.
17
+ npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/chokidar/node_modules/fsevents):
18
+ npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
19
+ npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^2.1.2 (node_modules/jest-haste-map/node_modules/fsevents):
20
+ npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
21
+ npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/nodemon/node_modules/chokidar/node_modules/fsevents):
22
+ npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
23
+ npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/watchpack/node_modules/chokidar/node_modules/fsevents):
24
+ npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
25
+ npm WARN check2@1.0.0 No description
26
+ npm WARN check2@1.0.0 No repository field.
27
+
28
+ + @zohodesk/react-cli@0.0.1-beta.165
29
+ updated 1 package and audited 1899 packages in 51.509s
30
+
31
+ 21 packages are looking for funding
32
+ run `npm fund` for details
33
+
34
+ found 42 vulnerabilities (2 low, 20 moderate, 8 high, 12 critical)
35
+ run `npm audit fix` to fix them, or `npm audit` for details
package/files/eslintrc.js CHANGED
@@ -1,62 +1,62 @@
1
- const [off, , error] = ['off', 'warn', 'error'];
2
-
3
- module.exports = {
4
- env: {
5
- browser: true,
6
- es2021: true,
7
- },
8
- extends: [
9
- 'plugin:react/recommended',
10
- 'plugin:react-hooks/recommended',
11
- 'airbnb',
12
- 'prettier',
13
- ],
14
- parserOptions: {
15
- ecmaFeatures: {
16
- jsx: true,
17
- },
18
- ecmaVersion: 12,
19
- sourceType: 'module',
20
- },
21
- plugins: [
22
- 'react',
23
- 'css-modules',
24
- '@zohodesk/zsecurity',
25
- '@zohodesk/react-performance',
26
- ],
27
- rules: {
28
- // Internal Rules
29
- '@zohodesk/react-performance/no-ref-mapstatetoprops': error,
30
- '@zohodesk/zsecurity/no-unsecure-html': error,
31
- '@zohodesk/zsecurity/no-protocol-check': error,
32
-
33
- // CSS Module Rules
34
- 'css-modules/no-unused-class': [error, { camelCase: true }],
35
- 'css-modules/no-undef-class': [error, { camelCase: 'only' }],
36
-
37
- 'import/no-unresolved': off,
38
- 'import/no-extraneous-dependencies': off,
39
-
40
- // As redux used
41
- 'no-shadow': off, // As we import the action files and use the same name in getting from props built from connect.
42
- 'react/jsx-filename-extension': off,
43
-
44
- // As we don't follow
45
- 'react/require-default-props': off,
46
- 'react/jsx-props-no-spreading': off,
47
-
48
- // As we didn't update
49
- 'react/jsx-fragments': off,
50
-
51
- // Not needed
52
- 'no-plusplus': off,
53
- 'no-unused-expressions': [
54
- error,
55
- {
56
- allowShortCircuit: true,
57
- allowTernary: true,
58
- },
59
- ],
60
- 'react/jsx-no-target-blank': error,
61
- },
62
- };
1
+ const [off, , error] = ['off', 'warn', 'error'];
2
+
3
+ module.exports = {
4
+ env: {
5
+ browser: true,
6
+ es2021: true,
7
+ },
8
+ extends: [
9
+ 'plugin:react/recommended',
10
+ 'plugin:react-hooks/recommended',
11
+ 'airbnb',
12
+ 'prettier',
13
+ ],
14
+ parserOptions: {
15
+ ecmaFeatures: {
16
+ jsx: true,
17
+ },
18
+ ecmaVersion: 12,
19
+ sourceType: 'module',
20
+ },
21
+ plugins: [
22
+ 'react',
23
+ 'css-modules',
24
+ '@zohodesk/zsecurity',
25
+ '@zohodesk/react-performance',
26
+ ],
27
+ rules: {
28
+ // Internal Rules
29
+ '@zohodesk/react-performance/no-ref-mapstatetoprops': error,
30
+ '@zohodesk/zsecurity/no-unsecure-html': error,
31
+ '@zohodesk/zsecurity/no-protocol-check': error,
32
+
33
+ // CSS Module Rules
34
+ 'css-modules/no-unused-class': [error, { camelCase: true }],
35
+ 'css-modules/no-undef-class': [error, { camelCase: 'only' }],
36
+
37
+ 'import/no-unresolved': off,
38
+ 'import/no-extraneous-dependencies': off,
39
+
40
+ // As redux used
41
+ 'no-shadow': off, // As we import the action files and use the same name in getting from props built from connect.
42
+ 'react/jsx-filename-extension': off,
43
+
44
+ // As we don't follow
45
+ 'react/require-default-props': off,
46
+ 'react/jsx-props-no-spreading': off,
47
+
48
+ // As we didn't update
49
+ 'react/jsx-fragments': off,
50
+
51
+ // Not needed
52
+ 'no-plusplus': off,
53
+ 'no-unused-expressions': [
54
+ error,
55
+ {
56
+ allowShortCircuit: true,
57
+ allowTernary: true,
58
+ },
59
+ ],
60
+ 'react/jsx-no-target-blank': error,
61
+ },
62
+ };
@@ -1,3 +1,3 @@
1
- module.exports = {
2
- trailingComma: 'none',
3
- };
1
+ module.exports = {
2
+ trailingComma: 'none',
3
+ };
@@ -8,17 +8,11 @@ var _libAlias = require("./libAlias");
8
8
 
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
10
 
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
- }, {});
11
+ const appPath = process.cwd();
18
12
 
19
13
  const appGlobals = _path.default.resolve(appPath, '__testUtils__', 'globals.js');
20
14
 
21
- let commonConfig = {
15
+ const commonConfig = {
22
16
  coverageReporters: ['json', 'html', 'json-summary', 'text'],
23
17
  collectCoverage: true,
24
18
  moduleDirectories: [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules'],
@@ -27,9 +21,11 @@ let commonConfig = {
27
21
  '^.+\\.css$': _path.default.resolve(__dirname, '..', 'jest', 'preProcessors', 'cssPreprocessor.js'),
28
22
  '^(?!.*\\.(js|jsx|css|json)$)': _path.default.resolve(__dirname, '..', 'jest', 'preProcessors', 'otherFilesPreprocessor.js')
29
23
  },
30
- moduleNameMapper: { ...moduleNameMapper,
31
- '\\.(css|less)$': 'identity-obj-proxy'
32
- },
24
+ moduleNameMapper: _libAlias.jestModuleNameMapper,
25
+ // moduleNameMapper: {
26
+ // ...moduleNameMapper,
27
+ // '\\.(css|less)$': 'identity-obj-proxy'
28
+ // },
33
29
  transformIgnorePatterns: ['/node_modules/(?!(@zohodesk)/)'],
34
30
  // transformIgnorePatterns: ['/node_modules.*?.js$'],
35
31
  moduleFileExtensions: ['js'],
@@ -42,7 +38,7 @@ let commonConfig = {
42
38
  };
43
39
 
44
40
  module.exports = (...args) => {
45
- let [appFolder, forCommittedFiles = false] = args;
41
+ const [appFolder, forCommittedFiles = false] = args;
46
42
 
47
43
  if (forCommittedFiles) {
48
44
  return Object.assign({}, commonConfig, {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.libAlias = void 0;
6
+ exports.libAlias = exports.jestModuleNameMapper = void 0;
7
7
  // the reason for alias at the time was code tree shaking
8
8
  // tree shaking was most compactable with ES module system
9
9
  // FIXME: But there is a posiblity when these package does not have lib,
@@ -27,5 +27,12 @@ const libAlias = {
27
27
  '@zohodesk/timetracker/lib': '@zohodesk/timetracker/es',
28
28
  '@zohodesk/variables/lib': '@zohodesk/variables/es',
29
29
  '@zohodesk/virtualizer/lib': '@zohodesk/virtualizer/es'
30
- };
31
- exports.libAlias = libAlias;
30
+ }; // '^@root(.*)$': '<rootDir>/src$1',
31
+ // '^@components(.*)$': '<rootDir>/src/components$1',
32
+
33
+ exports.libAlias = libAlias;
34
+ const jestModuleNameMapper = Object.keys(libAlias).reduce((previousValue, key) => {
35
+ previousValue[`^${key}(.*)$`] = `${libAlias[key]}$1`;
36
+ return previousValue;
37
+ }, {});
38
+ exports.jestModuleNameMapper = jestModuleNameMapper;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.loaderResolver = loaderResolver;
7
+ exports.moduleResolver = moduleResolver;
8
+
9
+ var _constants = require("../constants");
10
+
11
+ var _libAlias = require("./libAlias");
12
+
13
+ function moduleResolver(options) {
14
+ const {
15
+ moduleResolvePath,
16
+ disableES5Transpile
17
+ } = options.app;
18
+ const nodeModulesPath = moduleResolvePath ? require(require.resolve(moduleResolvePath, {
19
+ paths: [options.cwd]
20
+ })).nodeModulesPath : ''; // const {unstableDepsInverse} = options;
21
+
22
+ return {
23
+ modules: [nodeModulesPath, 'node_modules'].filter(Boolean),
24
+ alias: disableES5Transpile ? _libAlias.libAlias : {} // alias: { ...libAlias, ...clientDependenies }
25
+
26
+ };
27
+ }
28
+
29
+ function loaderResolver(options) {
30
+ // const unstableDepsInverse = false;
31
+ const {
32
+ unstableDepsInverse
33
+ } = options;
34
+ return {
35
+ modules: unstableDepsInverse ? ['node_modules', _constants.cliNodemodulesPath] : [_constants.cliNodemodulesPath, 'node_modules'] // alias: libAlias
36
+
37
+ };
38
+ }
@@ -67,10 +67,10 @@ module.exports = {
67
67
  }],
68
68
  include: _path.default.join(appPath, 'src')
69
69
  }
70
- /*,
71
- {
72
- test: /\.css$/,
73
- use: [MiniCssExtractPlugin.loader, 'css-loader']
70
+ /*,
71
+ {
72
+ test: /\.css$/,
73
+ use: [MiniCssExtractPlugin.loader, 'css-loader']
74
74
  }*/
75
75
  , {
76
76
  test: /(\.module)?\.css$/,
@@ -10,15 +10,14 @@ var _pluginUtils = require("../pluginUtils");
10
10
 
11
11
  var _loaderUtils = require("../loaderUtils");
12
12
 
13
- var _libAlias = require("./libAlias");
14
-
15
13
  var _configsAssetsLoaders = require("../loaderUtils/configsAssetsLoaders");
16
14
 
15
+ var _resolvers = require("./resolvers");
16
+
17
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
18
 
19
- let options = (0, _utils.getOptions)();
20
- let {
21
- unstableDepsInverse,
19
+ const options = (0, _utils.getOptions)();
20
+ const {
22
21
  app: {
23
22
  folder,
24
23
  context,
@@ -26,6 +25,8 @@ let {
26
25
  outputFolder,
27
26
  plugins,
28
27
  exclude,
28
+ mediaQueryHoverActiveString,
29
+ cssVariableReplacementConfig,
29
30
  cssUniqueness,
30
31
  seperateCssModules,
31
32
  changeRuntimeChunkChar,
@@ -34,19 +35,18 @@ let {
34
35
  cssHashSelectors,
35
36
  classNamePrefix,
36
37
  selectorReplace,
37
- disableES5Transpile,
38
38
  devConsoleExculde,
39
39
  sourcemap,
40
40
  crossorigin
41
41
  }
42
42
  } = options;
43
- let {
43
+ const {
44
44
  disableContextURL
45
45
  } = server;
46
- let appPath = process.cwd();
47
- let contextURL = disableContextURL ? '' : context;
48
- let serverUrl = (0, _utils.getServerURL)(server, 'https');
49
- let output = {
46
+ const appPath = process.cwd();
47
+ const contextURL = disableContextURL ? '' : context;
48
+ const serverUrl = (0, _utils.getServerURL)(server, 'https');
49
+ const output = {
50
50
  path: _path.default.join(appPath, outputFolder),
51
51
  filename: 'js/[name].js',
52
52
  chunkFilename: 'js/[name].js',
@@ -85,9 +85,9 @@ module.exports = {
85
85
  test: /\.js$/,
86
86
  use: (0, _loaderUtils.getDevJsLoaders)(options),
87
87
  include: module => {
88
- let srcPath = _path.default.join(appPath, folder);
88
+ const srcPath = _path.default.join(appPath, folder);
89
89
 
90
- let depsPath = _path.default.join(appPath, 'node_modules', '@zohodesk');
90
+ const depsPath = _path.default.join(appPath, 'node_modules', '@zohodesk');
91
91
 
92
92
  if (module.includes(srcPath) || devConsoleExculde && module.includes(depsPath)) {
93
93
  return true;
@@ -98,10 +98,10 @@ module.exports = {
98
98
  }, seperateCssModules ? {
99
99
  test: /\.css$/,
100
100
  exclude: /\.module\.css$/,
101
- use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, '[local]', false, null)
101
+ use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, mediaQueryHoverActiveString, cssVariableReplacementConfig, '[local]', false, null)
102
102
  } : null, {
103
103
  test: seperateCssModules ? /\.module\.css$/ : /(\.module)?\.css$/,
104
- use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, null, cssUniqueness, selectorReplace, cssHashSelectors, classNamePrefix)
104
+ use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, mediaQueryHoverActiveString, cssVariableReplacementConfig, null, cssUniqueness, selectorReplace, cssHashSelectors, classNamePrefix)
105
105
  }, (0, _configsAssetsLoaders.configImageLoader)(nameTemplate), (0, _configsAssetsLoaders.configFontLoader)(nameTemplate), (0, _configsAssetsLoaders.configSVGLoader)(nameTemplate), (0, _configsAssetsLoaders.configVideoLoader)(nameTemplate), (0, _configsAssetsLoaders.configAudioLoader)(nameTemplate), {
106
106
  test: /\.tmpl$/,
107
107
  use: [{
@@ -124,11 +124,6 @@ module.exports = {
124
124
  externals: {
125
125
  ZC: '$ZC'
126
126
  },
127
- resolve: {
128
- modules: unstableDepsInverse ? ['node_modules', _path.default.resolve(__dirname, '..', '..', 'node_modules')] : [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules'],
129
- alias: disableES5Transpile ? _libAlias.libAlias : {}
130
- },
131
- resolveLoader: {
132
- modules: unstableDepsInverse ? ['node_modules', _path.default.resolve(__dirname, '..', '..', 'node_modules')] : [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
133
- }
127
+ resolve: (0, _resolvers.moduleResolver)(options),
128
+ resolveLoader: (0, _resolvers.loaderResolver)(options)
134
129
  };
@@ -8,22 +8,22 @@ var _pluginUtils = require("../pluginUtils");
8
8
 
9
9
  var _loaderUtils = require("../loaderUtils");
10
10
 
11
- var _libAlias = require("./libAlias");
12
-
13
11
  var _configsAssetsLoaders = require("../loaderUtils/configsAssetsLoaders");
14
12
 
13
+ var _resolvers = require("./resolvers");
14
+
15
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
16
 
17
- let options = (0, _utils.getOptions)();
18
- let {
19
- unstableDepsInverse,
17
+ const options = (0, _utils.getOptions)();
18
+ const {
20
19
  docs: {
21
20
  componentFolder,
22
- disableES5Transpile,
23
21
  enableChunkHash,
24
22
  cssUniqueness,
25
23
  plugins,
26
24
  exclude,
25
+ mediaQueryHoverActiveString,
26
+ cssVariableReplacementConfig,
27
27
  cssHashSelectors,
28
28
  classNamePrefix
29
29
  },
@@ -31,7 +31,7 @@ let {
31
31
  folder
32
32
  }
33
33
  } = options;
34
- let appPath = process.cwd();
34
+ const appPath = process.cwd();
35
35
  const nameTemplate = (0, _configsAssetsLoaders.createNameTemplate)(enableChunkHash);
36
36
 
37
37
  module.exports = isSSTest => ({
@@ -73,7 +73,7 @@ module.exports = isSSTest => ({
73
73
  exclude: /node_modules/
74
74
  }, {
75
75
  test: /(\.module)?\.css$/,
76
- use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, false, cssUniqueness, null, cssHashSelectors, classNamePrefix)
76
+ use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, mediaQueryHoverActiveString, cssVariableReplacementConfig, false, cssUniqueness, null, cssHashSelectors, classNamePrefix)
77
77
  }, (0, _configsAssetsLoaders.configImageLoader)(nameTemplate), (0, _configsAssetsLoaders.configFontLoader)(nameTemplate), (0, _configsAssetsLoaders.configSVGLoader)(nameTemplate), (0, _configsAssetsLoaders.configAudioLoader)(nameTemplate), (0, _configsAssetsLoaders.configVideoLoader)(nameTemplate), {
78
78
  test: /\.html$/,
79
79
  use: {
@@ -102,11 +102,6 @@ module.exports = isSSTest => ({
102
102
  externals: {
103
103
  ZC: '$ZC'
104
104
  },
105
- resolve: {
106
- modules: unstableDepsInverse ? ['node_modules', _path.default.resolve(__dirname, '..', '..', 'node_modules')] : [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules'],
107
- alias: disableES5Transpile ? _libAlias.libAlias : {}
108
- },
109
- resolveLoader: {
110
- modules: unstableDepsInverse ? ['node_modules', _path.default.resolve(__dirname, '..', '..', 'node_modules')] : [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
111
- }
105
+ resolve: (0, _resolvers.moduleResolver)(options),
106
+ resolveLoader: (0, _resolvers.loaderResolver)(options)
112
107
  });
@@ -10,15 +10,19 @@ var _getLibraryImactPlugins = _interopRequireDefault(require("../pluginUtils/get
10
10
 
11
11
  var _configsAssetsLoaders = require("../loaderUtils/configsAssetsLoaders");
12
12
 
13
+ var _resolvers = require("./resolvers");
14
+
13
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
16
 
15
- let options = (0, _utils.getOptions)();
16
- let {
17
+ const options = (0, _utils.getOptions)();
18
+ const {
17
19
  docs: {
18
20
  componentFolder,
19
21
  cssUniqueness,
20
22
  plugins,
21
23
  exclude,
24
+ mediaQueryHoverActiveString,
25
+ cssVariableReplacementConfig,
22
26
  cssHashSelectors,
23
27
  enableChunkHash,
24
28
  classNamePrefix
@@ -27,7 +31,7 @@ let {
27
31
  folder
28
32
  }
29
33
  } = options;
30
- let appPath = process.cwd();
34
+ const appPath = process.cwd();
31
35
  const nameTemplate = (0, _configsAssetsLoaders.createNameTemplate)(enableChunkHash);
32
36
  module.exports = {
33
37
  entry: {
@@ -36,6 +40,7 @@ module.exports = {
36
40
  },
37
41
  devtool: 'none',
38
42
  mode: 'development',
43
+ stats: 'errors-only',
39
44
  output: {
40
45
  path: _path.default.join(appPath, 'build'),
41
46
  filename: 'js/[name].js',
@@ -68,7 +73,7 @@ module.exports = {
68
73
  exclude: /node_modules/
69
74
  }, {
70
75
  test: /(\.module)?\.css$/,
71
- use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, false, cssUniqueness, null, cssHashSelectors, classNamePrefix)
76
+ use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, mediaQueryHoverActiveString, cssVariableReplacementConfig, false, cssUniqueness, null, cssHashSelectors, classNamePrefix)
72
77
  }, (0, _configsAssetsLoaders.configImageLoader)(nameTemplate), (0, _configsAssetsLoaders.configFontLoader)(nameTemplate), (0, _configsAssetsLoaders.configSVGLoader)(nameTemplate), (0, _configsAssetsLoaders.configAudioLoader)(nameTemplate), (0, _configsAssetsLoaders.configVideoLoader)(nameTemplate), {
73
78
  test: /\.html$/,
74
79
  use: {
@@ -98,11 +103,6 @@ module.exports = {
98
103
  externals: {
99
104
  ZC: '$ZC'
100
105
  },
101
- resolve: {
102
- modules: [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
103
- },
104
- resolveLoader: {
105
- modules: [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
106
- },
107
- stats: 'errors-only'
106
+ resolve: (0, _resolvers.moduleResolver)(options),
107
+ resolveLoader: (0, _resolvers.loaderResolver)(options)
108
108
  };
@@ -10,20 +10,18 @@ var _pluginUtils = require("../pluginUtils");
10
10
 
11
11
  var _loaderUtils = require("../loaderUtils");
12
12
 
13
- var _libAlias = require("./libAlias");
14
-
15
13
  var _configsAssetsLoaders = require("../loaderUtils/configsAssetsLoaders");
16
14
 
15
+ var _resolvers = require("./resolvers");
16
+
17
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
18
 
19
19
  // import TerserPlugin from 'terser-webpack-plugin';
20
- let options = (0, _utils.getOptions)();
21
- let {
22
- unstableDepsInverse,
20
+ const options = (0, _utils.getOptions)();
21
+ const {
23
22
  app: {
24
23
  folder,
25
24
  context,
26
- enableChunkHash,
27
25
  outputFolder,
28
26
  disableES5Transpile,
29
27
  removeAttribute,
@@ -31,6 +29,8 @@ let {
31
29
  server,
32
30
  plugins,
33
31
  exclude,
32
+ mediaQueryHoverActiveString,
33
+ cssVariableReplacementConfig,
34
34
  cssUniqueness,
35
35
  server: {
36
36
  mode
@@ -45,10 +45,13 @@ let {
45
45
  crossorigin
46
46
  }
47
47
  } = options;
48
- let appPath = process.cwd();
49
- let isDevelopment = mode === 'prod' || mode === 'dev' || mode === 'dev-no-warn';
48
+ let {
49
+ enableChunkHash
50
+ } = options.app;
51
+ const appPath = process.cwd();
52
+ const isDevelopment = mode === 'prod' || mode === 'dev' || mode === 'dev-no-warn';
50
53
  enableChunkHash = !isDevelopment && enableChunkHash;
51
- let output = {
54
+ const output = {
52
55
  path: _path.default.resolve(appPath, outputFolder),
53
56
  filename: enableChunkHash ? 'js/[name].[chunkhash:20]_.js' : 'js/[name]_.js',
54
57
  chunkFilename: enableChunkHash ? 'js/[name].[chunkhash:20]_.js' : 'js/[name]_.js',
@@ -61,15 +64,15 @@ if (crossorigin) {
61
64
  }
62
65
 
63
66
  if (isDevelopment) {
64
- let {
67
+ const {
65
68
  disableContextURL
66
69
  } = server;
67
- let contextURL = disableContextURL ? '' : context;
68
- let serverUrl = (0, _utils.getServerURL)(server, 'https');
70
+ const contextURL = disableContextURL ? '' : context;
71
+ const serverUrl = (0, _utils.getServerURL)(server, 'https');
69
72
  output.publicPath = `${[serverUrl, contextURL].filter(a => a).join('/')}/`;
70
73
  }
71
74
 
72
- let shouldRemovePropTypes = !isDevelopment && removePropTypes;
75
+ const shouldRemovePropTypes = !isDevelopment && removePropTypes;
73
76
  module.exports = {
74
77
  entry: (0, _common.getEntries)(options, 'production'),
75
78
  devtool: isDevelopment ? 'cheap-module-source-map' : enableSMap ? 'hidden-source-map' : 'none',
@@ -133,9 +136,9 @@ module.exports = {
133
136
  }].filter(Boolean),
134
137
  // include: path.join(appPath, folder)
135
138
  include: module => {
136
- let srcPath = _path.default.join(appPath, folder);
139
+ const srcPath = _path.default.join(appPath, folder);
137
140
 
138
- let depsPath = _path.default.join(appPath, 'node_modules', '@zohodesk');
141
+ const depsPath = _path.default.join(appPath, 'node_modules', '@zohodesk');
139
142
 
140
143
  if (module.includes(srcPath) || devConsoleExculde && module.includes(depsPath)) {
141
144
  return true;
@@ -146,10 +149,10 @@ module.exports = {
146
149
  }, seperateCssModules ? {
147
150
  test: /\.css$/,
148
151
  exclude: /\.module\.css$/,
149
- use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, '[local]', false, null)
152
+ use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, cssVariableReplacementConfig, mediaQueryHoverActiveString, '[local]', false, null)
150
153
  } : null, {
151
154
  test: seperateCssModules ? /\.module\.css$/ : /\.css$/,
152
- use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, false, cssUniqueness, selectorReplace, cssHashSelectors, classNamePrefix)
155
+ use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, mediaQueryHoverActiveString, cssVariableReplacementConfig, false, cssUniqueness, selectorReplace, cssHashSelectors, classNamePrefix)
153
156
  }, {
154
157
  test: /\.jpe?g$|\.gif$|\.png$/,
155
158
  use: [{
@@ -210,11 +213,6 @@ module.exports = {
210
213
  externals: {
211
214
  ZC: '$ZC'
212
215
  },
213
- resolve: {
214
- modules: unstableDepsInverse ? ['node_modules', _path.default.resolve(__dirname, '..', '..', 'node_modules')] : [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules'],
215
- alias: disableES5Transpile ? _libAlias.libAlias : {}
216
- },
217
- resolveLoader: {
218
- modules: unstableDepsInverse ? ['node_modules', _path.default.resolve(__dirname, '..', '..', 'node_modules')] : [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
219
- }
216
+ resolve: (0, _resolvers.moduleResolver)(options),
217
+ resolveLoader: (0, _resolvers.loaderResolver)(options)
220
218
  };