@zohodesk/react-cli 0.0.1-beta.98 → 0.0.1-betaa.138.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/README.md +149 -0
  3. package/bin/cli.js +34 -29
  4. package/files/eslintrc.js +57 -0
  5. package/files/prettierrc.js +3 -0
  6. package/lib/babel/cmjs-plugins-presets.js +16 -9
  7. package/lib/babel/es-plugins-presets.js +26 -14
  8. package/lib/common/getEntries.js +31 -22
  9. package/lib/common/getPublicPathConfig.js +27 -13
  10. package/lib/common/index.js +21 -25
  11. package/lib/common/splitChunks.js +62 -53
  12. package/lib/common/templateParameters.js +10 -8
  13. package/lib/configs/jest.config.js +15 -25
  14. package/lib/configs/webpack.component.umd.config.js +31 -37
  15. package/lib/configs/webpack.css.umd.config.js +44 -47
  16. package/lib/configs/webpack.dev.config.js +70 -52
  17. package/lib/configs/webpack.docs.config.js +106 -106
  18. package/lib/configs/webpack.prod.config.js +95 -75
  19. package/lib/hooks/docsProptypeHook.js +32 -38
  20. package/lib/jest/commitedFilesResult.js +103 -74
  21. package/lib/jest/coverageCollector.js +41 -21
  22. package/lib/jest/jsonMaker.js +15 -16
  23. package/lib/jest/preProcessors/cssPreprocessor.js +16 -18
  24. package/lib/jest/preProcessors/jsPreprocessor.js +3 -5
  25. package/lib/jest/preProcessors/otherFilesPreprocessor.js +5 -6
  26. package/lib/jest/result.js +90 -45
  27. package/lib/jest/run.js +43 -43
  28. package/lib/jest/setup.js +102 -95
  29. package/lib/loaderUtils/getCSSLoaders.js +21 -22
  30. package/lib/loaderUtils/getDevJsLoaders.js +25 -23
  31. package/lib/loaderUtils/index.js +11 -13
  32. package/lib/loaders/docsLoader.js +15 -15
  33. package/lib/loaders/docsPropsLoader.js +14 -17
  34. package/lib/loaders/fileLoader.js +33 -35
  35. package/lib/loaders/scriptInstrumentLoader.js +21 -20
  36. package/lib/loaders/workerLoader.js +136 -0
  37. package/lib/middlewares/HMRMiddleware.js +54 -45
  38. package/lib/middlewares/SSTMiddleware.js +8 -5
  39. package/lib/pluginUtils/getDevPlugins.js +114 -52
  40. package/lib/pluginUtils/getDocsPlugins.js +25 -29
  41. package/lib/pluginUtils/getLibraryPlugins.js +8 -10
  42. package/lib/pluginUtils/getProdPlugins.js +163 -74
  43. package/lib/pluginUtils/getServerPlugins.js +8 -11
  44. package/lib/pluginUtils/getUMDCSSPlugins.js +11 -15
  45. package/lib/pluginUtils/getUMDComponentPlugins.js +11 -15
  46. package/lib/pluginUtils/index.js +36 -43
  47. package/lib/plugins/CdnChangePlugin.js +63 -0
  48. package/lib/plugins/CleanupStatsPlugin.js +18 -32
  49. package/lib/plugins/CustomAttributePlugin.js +79 -0
  50. package/lib/plugins/CustomAttributePlugin.md +35 -0
  51. package/lib/plugins/EFCPlugin.js +185 -0
  52. package/lib/plugins/I18NInjectIntoIndexPlugin.js +118 -52
  53. package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +60 -0
  54. package/lib/plugins/I18nSplitPlugin/I18nDependency.js +44 -0
  55. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +266 -0
  56. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +183 -0
  57. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +100 -0
  58. package/lib/plugins/I18nSplitPlugin/I18nSplit.md +86 -0
  59. package/lib/plugins/I18nSplitPlugin/README.md +25 -0
  60. package/lib/plugins/I18nSplitPlugin/index.js +185 -0
  61. package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +64 -0
  62. package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +13 -0
  63. package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +26 -0
  64. package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +40 -0
  65. package/lib/plugins/I18nSplitPlugin/utils/index.js +31 -0
  66. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +112 -0
  67. package/lib/plugins/ManifestPlugin.js +52 -63
  68. package/lib/plugins/ModuleStatsPlugin.js +83 -173
  69. package/lib/plugins/OptimizeJSPlugin.js +24 -41
  70. package/lib/plugins/PublicPathCallbackPlugin.js +42 -116
  71. package/lib/plugins/PublicPathChangePlugin.js +175 -284
  72. package/lib/plugins/ReportGeneratePlugin.js +150 -151
  73. package/lib/plugins/ResourceHintsPlugin.js +53 -35
  74. package/lib/plugins/ScriptInstrumentPlugin.js +22 -37
  75. package/lib/plugins/ServiceWorkerPlugin.js +81 -57
  76. package/lib/plugins/ShadowDOMSupportPlugin.js +153 -234
  77. package/lib/plugins/SourceMapHookPlugin.js +21 -33
  78. package/lib/plugins/TPHashMappingPlugin.js +67 -0
  79. package/lib/plugins/UglifyCSSPlugin.js +23 -30
  80. package/lib/plugins/UnusedFilesFindPlugin.js +137 -152
  81. package/lib/plugins/index.js +100 -91
  82. package/lib/plugins/webpackwatchrunplugin.js +18 -30
  83. package/lib/postcss-plugins/ExcludeRTLPlugin.js +14 -17
  84. package/lib/schemas/index.js +336 -81
  85. package/lib/servers/clusterHubServer.js +22 -26
  86. package/lib/servers/docsServer.js +3 -5
  87. package/lib/servers/docsServerCore.js +84 -91
  88. package/lib/servers/helpServer.js +19 -21
  89. package/lib/servers/impactServer.js +99 -92
  90. package/lib/servers/mockserver.js +24 -24
  91. package/lib/servers/scrServer.js +78 -98
  92. package/lib/servers/server.js +101 -122
  93. package/lib/servers/ssServer.js +63 -61
  94. package/lib/sh/reportPublish.sh +1 -2
  95. package/lib/templates/CoverageScriptTemplate.js +45 -18
  96. package/lib/templates/WMSTemplate.js +17 -18
  97. package/lib/templates/linterConstant.js +6 -4
  98. package/lib/utils/babelPresets.js +12 -5
  99. package/lib/utils/clean.js +12 -11
  100. package/lib/utils/copy.js +12 -34
  101. package/lib/utils/copyTimezones.js +9 -16
  102. package/lib/utils/createEventStream.js +24 -19
  103. package/lib/utils/cssClassNameGenerate.js +44 -73
  104. package/lib/utils/cssURLReplacer.js +62 -56
  105. package/lib/utils/dependencyPostPublish.js +20 -19
  106. package/lib/utils/fileUtils.js +66 -54
  107. package/lib/utils/folderIterator.js +20 -21
  108. package/lib/utils/getComponents.js +70 -27
  109. package/lib/utils/getCurrentBranch.js +11 -17
  110. package/lib/utils/getDependenciesImpactList.js +114 -187
  111. package/lib/utils/getHash.js +9 -13
  112. package/lib/utils/getIp.js +9 -9
  113. package/lib/utils/getOptions.js +26 -29
  114. package/lib/utils/getServerURL.js +19 -10
  115. package/lib/utils/index.js +147 -126
  116. package/lib/utils/init.js +2 -2
  117. package/lib/utils/initPreCommitHook.js +40 -32
  118. package/lib/utils/jsonHelper.js +37 -21
  119. package/lib/utils/lint/addScripts.js +27 -0
  120. package/lib/utils/lint/checkExistingConfig.js +67 -0
  121. package/lib/utils/lint/copyConfigs.js +24 -0
  122. package/lib/utils/lint/index.js +54 -0
  123. package/lib/utils/lint/lintScripts.js +11 -0
  124. package/lib/utils/lint/lintSetup.js +31 -0
  125. package/lib/utils/lint/lintStagedPreCommitHook.js +7 -0
  126. package/lib/utils/lint/question.js +30 -0
  127. package/lib/utils/lintReporter.js +70 -56
  128. package/lib/utils/mailSender.js +12 -27
  129. package/lib/utils/pullOrigin.js +21 -18
  130. package/lib/utils/reinstallDependencies.js +76 -85
  131. package/lib/utils/removeAttributes.js +25 -23
  132. package/lib/utils/repoClone.js +47 -45
  133. package/lib/utils/request.js +64 -77
  134. package/lib/utils/rtl.js +22 -29
  135. package/lib/utils/setEnvVariables.js +5 -6
  136. package/lib/utils/ssTestHack.js +21 -19
  137. package/lib/utils/switchBranch.js +21 -20
  138. package/lib/utils/urlConcat.js +22 -0
  139. package/package.json +72 -67
package/CHANGELOG.md CHANGED
@@ -31,6 +31,11 @@ fz-react-cli app <appname>
31
31
  - lint for js and css
32
32
  - parseQuery => getOptions
33
33
 
34
+
35
+ #0.0.1-alpha.113
36
+
37
+ - Upgraded 'moment' to version 2.29.1 and 'moment-timezone' to version 0.5.32
38
+
34
39
  # 0.0.3-beta.138
35
40
 
36
41
  - Coverage calculation issue fix and transform issue fix
package/README.md CHANGED
@@ -2,6 +2,155 @@
2
2
 
3
3
  A CLI tool for build modern web application and libraries
4
4
 
5
+ # 0.0.1-betaa.138.1
6
+ - new feature added for custom extra attribute for dynamically added tags by webpack.
7
+ - To enable this feature you need to enable "react-cli" => "app" => "customAttributes" => "enable"
8
+ - For more [details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/9eea8df14e55584b2114b5e484ca8b751a4ba191/src/plugins/CustomAttributePlugin.md)
9
+
10
+ # 0.0.1-beta.138
11
+
12
+ - sstest library version updated
13
+ - unitcase calcluation issues fixed
14
+
15
+
16
+ # 0.0.1-beta.137
17
+ - Third party css files loading issue fix
18
+ # 0.0.1-beta.136
19
+ - eslint support
20
+ # 0.0.1-beta.135
21
+ - windows publish issue
22
+
23
+ # 0.0.1-beta.134
24
+ - Build Issue Fix
25
+ # 0.0.1-beta.133
26
+ - CDN Changes in I18nSplitPlugin
27
+ - nonce support added for i18n chunks
28
+
29
+ # 0.0.1-beta.132
30
+ - CDN Changes in EFC Plugin
31
+ # 0.0.1-beta.131
32
+ - Added Cdn Change Plugin
33
+ # 0.0.1-beta.130
34
+
35
+ - Babel 7 migration, ES6 build generation config and polyfill removal
36
+ - CopyPlugin issue fix
37
+
38
+ #0.0.1-beta.129
39
+
40
+ - Upgraded 'moment' to version 2.29.1 and 'moment-timezone' to version 0.5.32
41
+
42
+ # 0.0.1-beta.128
43
+
44
+ - Added support to generate hash for the third party files(TPHashMappingPlugin)
45
+
46
+ # 0.0.1-beta.127
47
+
48
+ - service worker plugin - to recursively add multiple directories (recursive=true)
49
+
50
+ # 0.0.1-beta.126
51
+
52
+ - issue fix in i18n split plugin
53
+
54
+ ## expremental versions
55
+
56
+ - 0.0.1-beta.121
57
+ - 0.0.1-beta.122
58
+ - 0.0.1-beta.123
59
+ - 0.0.1-beta.124
60
+ - 0.0.1-beta.125
61
+
62
+ # 0.0.1-beta.120
63
+
64
+ - issue fix in third party file copying
65
+
66
+ ## expremental versions
67
+
68
+ - 0.0.1-beta.119
69
+ - 0.0.1-beta.118
70
+
71
+ #0.0.1-beta.117
72
+
73
+ - createSDkFile otion added for efc
74
+ - small fix in i18n split plugin
75
+
76
+ #0.0.1-beta.116
77
+
78
+ - thirdparty package move to build (tpFolder in app config)
79
+
80
+ #0.0.1-beta.115
81
+
82
+ - Added Web worker support
83
+
84
+ #0.0.1-beta.114
85
+
86
+ - i18n split based on chunk
87
+ - to enable i18n chunk spilt you have to add config in you package.json
88
+
89
+ #0.0.1-beta.113
90
+
91
+ - Upgraded 'fz-i18n' package version to 1.2.0-beta.15
92
+
93
+ #0.0.1-beta.112
94
+
95
+ - Duplicate Prefetch Request Issue Fixed (Resource Hint Plugin)
96
+ - Service worker plugin changes
97
+
98
+ #0.0.1-beta.111
99
+
100
+ - hasRTL, selectorReplace Condition Separated
101
+
102
+ #0.0.1-beta.110
103
+
104
+ - SplitChunk Order Issue Fixed
105
+ - https url issue Fixed
106
+
107
+ #0.0.1-beta.109
108
+
109
+ - @zohodesk/screenshottest package version update (19) and log for the gitlab private api to check the response
110
+
111
+ #0.0.1-beta.108
112
+
113
+ - @zohodesk/screenshottest package version update (18)
114
+
115
+ #0.0.1-beta.107
116
+
117
+ - changed component without docs finder added
118
+
119
+ #0.0.1-beta.106
120
+
121
+ - custom chunk support changes
122
+ - css absolute url fix
123
+
124
+ #0.0.1-beta.105
125
+
126
+ - @zohodesk/screenshottest package version update (17) with the issue fix
127
+
128
+ #0.0.1-beta.104
129
+
130
+ - ModuleStatsPlugin inject false option added to solve the webpack build twice issue
131
+
132
+ #0.0.1-beta.103
133
+
134
+ - @zohodesk/screenshottest package version update (16) with the issue fix
135
+
136
+ #0.0.1-beta.102
137
+
138
+ - @zohodesk/screenshottest package version update (15) with the issue fix
139
+
140
+ #0.0.1-beta.101
141
+
142
+ - 100 changes readme missing
143
+ - bundle analyser changes
144
+
145
+ #0.0.1-beta.100
146
+
147
+ - @zohodesk/screenshottest package version update with the issue fix
148
+ - font public path replace issue for url fonts - fixed
149
+
150
+ #0.0.1-beta.99
151
+
152
+ - can't publish already published
153
+
5
154
  #0.0.1-beta.98
6
155
 
7
156
  - defer break public path adding regex - fixed
package/bin/cli.js CHANGED
@@ -24,36 +24,43 @@ let [, , option] = process.argv;
24
24
  let args = process.argv.slice(3);
25
25
  let appPath = process.cwd();
26
26
 
27
- let isNodeModuleUnderAppFolder = __dirname.indexOf(appPath) !== -1;
28
-
29
- let webpack = !isNodeModuleUnderAppFolder
30
- ? path.join(__dirname, '..', 'node_modules', '.bin', 'webpack')
31
- : 'webpack';
32
- let nodemon = !isNodeModuleUnderAppFolder
33
- ? path.join(__dirname, '..', 'node_modules', '.bin', 'nodemon')
34
- : 'nodemon';
35
- let babel = !isNodeModuleUnderAppFolder
36
- ? path.join(__dirname, '..', 'node_modules', '.bin', 'babel')
37
- : 'babel';
38
-
39
- let propertyToJson = !isNodeModuleUnderAppFolder
40
- ? path.join(__dirname, '..', 'node_modules', '.bin', 'propertyToJson')
41
- : 'propertyToJson';
42
-
43
- let esLint = !isNodeModuleUnderAppFolder
44
- ? path.join(__dirname, '..', 'node_modules', '.bin', 'eslint')
45
- : 'eslint';
46
-
47
- if (isWindows) {
48
- webpack += '.cmd';
49
- babel += '.cmd';
50
- propertyToJson += '.cmd';
51
- esLint += '.cmd';
52
- nodemon += '.cmd';
27
+ const isNodeModuleUnderAppFolder = __dirname.indexOf(appPath) !== -1;
28
+
29
+ const _getCliPath = !isNodeModuleUnderAppFolder
30
+ ? libName => path.join(__dirname, '..', 'node_modules', '.bin', libName)
31
+ : libName => libName;
32
+ const suffixExt = isWindows ? '.cmd' : '';
33
+
34
+ function getCliPath(libName) {
35
+ return _getCliPath(libName) + suffixExt;
53
36
  }
54
37
 
38
+ let webpack = getCliPath('webpack');
39
+ let nodemon = getCliPath('nodemon');
40
+ let babel = getCliPath('babel');
41
+ let propertyToJson = getCliPath('propertyToJson');
42
+ let esLint = getCliPath('eslint');
43
+
55
44
  let result;
56
45
  switch (option) {
46
+ case 'lint-setup': {
47
+ result = spawnSync(
48
+ 'node',
49
+ [require.resolve('../lib/utils/lint/index.js')].concat(args),
50
+ { stdio: 'inherit' }
51
+ );
52
+ process.exit(result.status);
53
+ break;
54
+ }
55
+ case 'add-lint-scripts': {
56
+ result = spawnSync(
57
+ 'node',
58
+ [require.resolve('../lib/utils/lint/lintScripts.js')].concat(args),
59
+ { stdio: 'inherit' }
60
+ );
61
+ process.exit(result.status);
62
+ break;
63
+ }
57
64
  case 'postpublish':
58
65
  result = spawnSync(
59
66
  'node',
@@ -274,9 +281,7 @@ switch (option) {
274
281
  case 'publish:report':
275
282
  result = spawnSync(
276
283
  'sh',
277
- [path.join(__dirname, '..', 'lib', 'sh', 'reportPublish.sh')].concat(
278
- args
279
- ),
284
+ [path.join(__dirname, '..', 'lib', 'sh', 'reportPublish.sh')].concat(args),
280
285
  { stdio: 'inherit' }
281
286
  );
282
287
  process.exit(result.status);
@@ -0,0 +1,57 @@
1
+ const [off, , error] = ['off', 'warn', 'error'];
2
+
3
+ module.exports = {
4
+ env: {
5
+ browser: true,
6
+ es2021: true,
7
+ },
8
+ extends: ['plugin:react/recommended', 'airbnb', 'prettier'],
9
+ parserOptions: {
10
+ ecmaFeatures: {
11
+ jsx: true,
12
+ },
13
+ ecmaVersion: 12,
14
+ sourceType: 'module',
15
+ },
16
+ plugins: [
17
+ 'react',
18
+ 'css-modules',
19
+ '@zohodesk/zsecurity',
20
+ '@zohodesk/react-performance',
21
+ ],
22
+ rules: {
23
+ // Internal Rules
24
+ '@zohodesk/react-performance/no-ref-mapstatetoprops': error,
25
+ '@zohodesk/zsecurity/no-unsecure-html': error,
26
+ '@zohodesk/zsecurity/no-protocol-check': error,
27
+
28
+ // CSS Module Rules
29
+ 'css-modules/no-unused-class': [error, { camelCase: true }],
30
+ 'css-modules/no-undef-class': [error, { camelCase: 'only' }],
31
+
32
+ 'import/no-unresolved': off,
33
+ 'import/no-extraneous-dependencies': off,
34
+
35
+ // As redux used
36
+ 'no-shadow': off, // As we import the action files and use the same name in getting from props built from connect.
37
+ 'react/jsx-filename-extension': off,
38
+
39
+ // As we don't follow
40
+ 'react/require-default-props': off,
41
+ 'react/jsx-props-no-spreading': off,
42
+
43
+ // As we didn't update
44
+ 'react/jsx-fragments': off,
45
+
46
+ // Not needed
47
+ 'no-plusplus': off,
48
+ 'no-unused-expressions': [
49
+ error,
50
+ {
51
+ allowShortCircuit: true,
52
+ allowTernary: true,
53
+ },
54
+ ],
55
+ 'react/jsx-no-target-blank': error,
56
+ },
57
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ trailingComma: 'none',
3
+ };
@@ -1,17 +1,24 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.default = void 0;
6
7
 
7
- var _utils = require('../utils');
8
+ var _utils = require("../utils");
8
9
 
9
- var _getOptions = (0, _utils.getOptions)(),
10
- mode = _getOptions.module.mode;
10
+ let {
11
+ module: {
12
+ mode
13
+ }
14
+ } = (0, _utils.getOptions)();
15
+ let isProd = mode.toLowerCase() === 'prod';
11
16
 
12
- var isProd = mode.toLowerCase() === 'prod';
17
+ var _default = () => ({
18
+ presets: [require.resolve('@babel/preset-env'), require.resolve('@babel/preset-react')],
19
+ plugins: [[require.resolve('babel-plugin-transform-define'), isProd ? {
20
+ __DOCS__: false
21
+ } : {}]]
22
+ });
13
23
 
14
- exports.default = {
15
- presets: ['env', 'react'],
16
- plugins: [['transform-define', isProd ? { __DOCS__: false } : {}], 'syntax-dynamic-import']
17
- };
24
+ exports.default = _default;
@@ -1,22 +1,34 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.default = void 0;
6
7
 
7
- var _utils = require('../utils');
8
+ var _utils = require("../utils");
8
9
 
9
- var _getOptions = (0, _utils.getOptions)(),
10
- mode = _getOptions.module.mode;
10
+ let {
11
+ module: {
12
+ mode,
13
+ disableES5Transpile
14
+ }
15
+ } = (0, _utils.getOptions)();
16
+ let isProd = mode.toLowerCase() === 'prod';
11
17
 
12
- var isProd = mode.toLowerCase() === 'prod';
18
+ var _default = () => ({
19
+ presets: [[require.resolve('@babel/preset-env'), disableES5Transpile ? {
20
+ modules: false,
21
+ useBuiltIns: 'usage',
22
+ corejs: 3,
23
+ targets: {
24
+ browsers: ['last 3 Chrome versions', 'last 3 Firefox versions', 'last 3 Edge versions', 'last 3 Safari versions']
25
+ }
26
+ } : {
27
+ modules: false
28
+ }], require.resolve('@babel/preset-react')],
29
+ plugins: [[require.resolve('babel-plugin-transform-define'), isProd ? {
30
+ __DOCS__: false
31
+ } : {}], require.resolve('@babel/plugin-syntax-dynamic-import')]
32
+ });
13
33
 
14
- exports.default = {
15
- presets: [['env', { modules: false }], 'react'],
16
- plugins: [['transform-runtime', {
17
- helpers: true,
18
- polyfill: true,
19
- regenerator: false,
20
- moduleName: 'babel-runtime'
21
- }], ['transform-define', isProd ? { __DOCS__: false } : {}], 'syntax-dynamic-import']
22
- };
34
+ exports.default = _default;
@@ -1,43 +1,52 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.default = void 0;
6
7
 
7
- var _path = require('path');
8
+ var _path = _interopRequireDefault(require("path"));
8
9
 
9
- var _path2 = _interopRequireDefault(_path);
10
-
11
- var _utils = require('../utils');
10
+ var _utils = require("../utils");
12
11
 
13
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
13
 
15
- var getEntries = function getEntries(appSchemas, mode) {
16
- var appPath = process.cwd();
17
- var _appSchemas$app = appSchemas.app,
18
- isReactMig = _appSchemas$app.isReactMig,
19
- hasWidget = _appSchemas$app.hasWidget,
20
- hasEFC = _appSchemas$app.hasEFC,
21
- server = _appSchemas$app.server,
22
- folder = _appSchemas$app.folder;
23
-
24
-
25
- var mainJs = [];
26
- var entry = { main: mainJs };
14
+ let getEntries = (appSchemas, mode) => {
15
+ let appPath = process.cwd();
16
+ let {
17
+ isReactMig,
18
+ hasWidget,
19
+ server,
20
+ folder
21
+ } = appSchemas.app;
22
+ const {
23
+ hasEFC: prevOptionForEnableEFC
24
+ } = appSchemas.app;
25
+ const {
26
+ hasEFC: newOptionForEnableEFC
27
+ } = appSchemas.efc;
28
+ const hasEFC = newOptionForEnableEFC || prevOptionForEnableEFC;
29
+ let mainJs = [];
30
+ let entry = {
31
+ main: mainJs
32
+ };
27
33
 
28
34
  if (mode === 'dev' || mode === 'dev-no-warn') {
29
- mainJs.push(_path2.default.join(__dirname, '..', 'templates', 'WMSTemplate') + '?wmsPath=wss:' + (0, _utils.getServerURL)(server));
35
+ mainJs.push(`${_path.default.join(__dirname, '..', 'templates', 'WMSTemplate')}?wmsPath=wss:${(0, _utils.getServerURL)(server)}`);
30
36
  }
31
37
 
32
- mainJs.push(_path2.default.join(appPath, folder, isReactMig ? 'migration.js' : 'index.js'));
38
+ mainJs.push(_path.default.join(appPath, folder, isReactMig ? 'migration.js' : 'index.js'));
33
39
 
34
40
  if (hasWidget) {
35
- entry.widget = [_path2.default.join(appPath, folder, 'widget.js')];
41
+ entry.widget = [_path.default.join(appPath, folder, 'widget.js')];
36
42
  }
43
+
37
44
  if (hasEFC) {
38
- entry.efc = [_path2.default.join(appPath, folder, 'efc.js')];
45
+ entry.efc = [_path.default.join(appPath, folder, 'efc.js')];
39
46
  }
40
47
 
41
48
  return entry;
42
49
  };
43
- exports.default = getEntries;
50
+
51
+ var _default = getEntries;
52
+ exports.default = _default;
@@ -1,26 +1,40 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.default = void 0;
6
7
 
7
- var _utils = require('../utils');
8
+ var _utils = require("../utils");
8
9
 
9
- var _getOptions = (0, _utils.getOptions)(),
10
- _getOptions$app = _getOptions.app,
11
- publicPaths = _getOptions$app.publicPaths,
12
- mode = _getOptions$app.server.mode;
10
+ let {
11
+ app: {
12
+ publicPaths,
13
+ cdnMapping: {
14
+ isCdnEnabled,
15
+ variableName
16
+ },
17
+ server: {
18
+ mode
19
+ }
20
+ }
21
+ } = (0, _utils.getOptions)();
22
+ let isDevelopment = mode === 'dev' || mode === 'prod' || mode === 'dev-no-warn';
13
23
 
14
- var isDevelopment = mode === 'dev' || mode === 'prod' || mode === 'dev-no-warn';
24
+ var _default = url => {
25
+ let type = (0, _utils.getFileType)(url);
15
26
 
16
- exports.default = function (url) {
17
- var type = (0, _utils.getFileType)(url);
18
27
  if (!isDevelopment) {
19
28
  if (publicPaths && publicPaths.callback) {
20
- return publicPaths.callback + '(' + JSON.stringify(type) + ') + ' + JSON.stringify(url);
29
+ return `${publicPaths.callback}(${JSON.stringify(type)}) + ${JSON.stringify(url)}`;
30
+ } else if (isCdnEnabled) {
31
+ return `window["${variableName}"] + ${JSON.stringify(url)}`;
21
32
  } else if (publicPaths) {
22
- return '__REACT_CLI_' + type.toUpperCase() + '_PUBLIC_PATH__ + ' + JSON.stringify(url);
33
+ return `__REACT_CLI_${type.toUpperCase()}_PUBLIC_PATH__ + ${JSON.stringify(url)}`;
23
34
  }
24
35
  }
25
- return '__webpack_public_path__ + ' + JSON.stringify(url);
26
- };
36
+
37
+ return `__webpack_public_path__ + ${JSON.stringify(url)}`;
38
+ };
39
+
40
+ exports.default = _default;
@@ -1,43 +1,39 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
- var _splitChunks = require('./splitChunks');
8
-
9
- Object.defineProperty(exports, 'splitChunks', {
6
+ Object.defineProperty(exports, "getEntries", {
10
7
  enumerable: true,
11
- get: function get() {
12
- return _interopRequireDefault(_splitChunks).default;
8
+ get: function () {
9
+ return _getEntries.default;
13
10
  }
14
11
  });
15
-
16
- var _getEntries = require('./getEntries');
17
-
18
- Object.defineProperty(exports, 'getEntries', {
12
+ Object.defineProperty(exports, "getPublicPathConfig", {
19
13
  enumerable: true,
20
- get: function get() {
21
- return _interopRequireDefault(_getEntries).default;
14
+ get: function () {
15
+ return _getPublicPathConfig.default;
22
16
  }
23
17
  });
24
-
25
- var _getPublicPathConfig = require('./getPublicPathConfig');
26
-
27
- Object.defineProperty(exports, 'getPublicPathConfig', {
18
+ Object.defineProperty(exports, "splitChunks", {
28
19
  enumerable: true,
29
- get: function get() {
30
- return _interopRequireDefault(_getPublicPathConfig).default;
20
+ get: function () {
21
+ return _splitChunks.default;
31
22
  }
32
23
  });
33
-
34
- var _templateParameters = require('./templateParameters');
35
-
36
- Object.defineProperty(exports, 'templateParameters', {
24
+ Object.defineProperty(exports, "templateParameters", {
37
25
  enumerable: true,
38
- get: function get() {
39
- return _interopRequireDefault(_templateParameters).default;
26
+ get: function () {
27
+ return _templateParameters.default;
40
28
  }
41
29
  });
42
30
 
31
+ var _splitChunks = _interopRequireDefault(require("./splitChunks"));
32
+
33
+ var _getEntries = _interopRequireDefault(require("./getEntries"));
34
+
35
+ var _getPublicPathConfig = _interopRequireDefault(require("./getPublicPathConfig"));
36
+
37
+ var _templateParameters = _interopRequireDefault(require("./templateParameters"));
38
+
43
39
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }