@zohodesk/react-cli 1.1.17 → 1.1.18-exp.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. package/README.md +13 -0
  2. package/lib/babel/babel-option-utils/babel-preset-react-option.js +22 -0
  3. package/lib/babel/cmjs-plugins-presets.js +7 -1
  4. package/lib/babel/es-plugins-presets.js +7 -1
  5. package/lib/configs/webpack.dev.config.js +7 -2
  6. package/lib/configs/webpack.prod.config.js +9 -2
  7. package/lib/loaderUtils/getDevJsLoaders.js +5 -1
  8. package/lib/schemas/index.js +4 -0
  9. package/npm-shrinkwrap.json +31 -5
  10. package/package.json +1 -1
  11. package/packages/client_build_tool/lib/allCommandsConfigs.js +23 -0
  12. package/packages/client_build_tool/lib/buildToolLoggers.js +32 -0
  13. package/packages/client_build_tool/lib/commands/build/commandExecutor.js +21 -0
  14. package/packages/client_build_tool/lib/commands/build/config.js +12 -0
  15. package/packages/client_build_tool/lib/commands/build/errorHander.js +10 -0
  16. package/packages/client_build_tool/lib/commands/build/index.js +35 -0
  17. package/packages/client_build_tool/lib/commands/build/optionsProcesser.js +40 -0
  18. package/packages/client_build_tool/lib/commands/buildEs/commandExecutor.js +17 -0
  19. package/packages/client_build_tool/lib/commands/buildEs/config.js +12 -0
  20. package/packages/client_build_tool/lib/commands/buildLib/commandExecutor.js +17 -0
  21. package/packages/client_build_tool/lib/commands/buildLib/config.js +12 -0
  22. package/packages/client_build_tool/lib/commands/start/commandExecutor.js +13 -0
  23. package/packages/client_build_tool/lib/commands/start/config.js +12 -0
  24. package/packages/client_build_tool/lib/commands/start/deprecationHandler.js +10 -0
  25. package/packages/client_build_tool/lib/commands/start/errorHander.js +10 -0
  26. package/packages/client_build_tool/lib/commands/start/optionsProcesser.js +36 -0
  27. package/packages/client_build_tool/lib/commands/start/postProcesser.js +10 -0
  28. package/packages/client_build_tool/lib/commands/start/preProcesser.js +10 -0
  29. package/packages/client_build_tool/lib/commandsRouter.js +71 -0
  30. package/packages/client_build_tool/lib/shared/bundler/webpack/common/decidePublicPath.js +44 -0
  31. package/packages/client_build_tool/lib/shared/bundler/webpack/common/libAlias.js +31 -0
  32. package/packages/client_build_tool/lib/shared/bundler/webpack/common/nameTemplates.js +51 -0
  33. package/packages/client_build_tool/lib/shared/bundler/webpack/common/resourceBasedPublicPath.js +21 -0
  34. package/packages/client_build_tool/lib/shared/bundler/webpack/cssLoaders.js +16 -0
  35. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/CdnChangePlugin.js +111 -0
  36. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/EFCPlugin.js +1 -0
  37. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/ContributionGuide.md +11 -0
  38. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nKeysIdentifer.js +136 -0
  39. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nSplit.md +95 -0
  40. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/README.md +25 -0
  41. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/constants.js +29 -0
  42. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/createHash.js +24 -0
  43. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nDependency.js +99 -0
  44. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nLoadingRuntimeModule.js +81 -0
  45. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nModule.js +201 -0
  46. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/index.js +401 -0
  47. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/optionsHandler.js +67 -0
  48. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/pathCreator.js +23 -0
  49. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/readI18nValues.js +29 -0
  50. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateFileName.js +49 -0
  51. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateHashHelpers.js +77 -0
  52. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/collectI18nKeys.js +63 -0
  53. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/hashUtils.js +19 -0
  54. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/index.js +31 -0
  55. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/propertiesUtils.js +127 -0
  56. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RTLSplitPlugin.js +1 -0
  57. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +63 -0
  58. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtlCssPlugin.js +89 -0
  59. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtrSplit.md +34 -0
  60. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/replaceCssDirTemplate.js +15 -0
  61. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/ServiceWorkerPlugin.js +155 -0
  62. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/UglifyCSSPlugin.js +49 -0
  63. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_postcss_loaders/ExcludePlugin.js +58 -0
  64. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_postcss_loaders/RTLSplitPlugin.js +139 -0
  65. package/packages/client_build_tool/lib/shared/bundler/webpack/devServerConfig.js +34 -0
  66. package/packages/client_build_tool/lib/shared/bundler/webpack/getCSSLoaders.js +30 -0
  67. package/packages/client_build_tool/lib/shared/bundler/webpack/jsLoaders.js +17 -0
  68. package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/assetLoaders.js +14 -0
  69. package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/babelLoaderConfig.js +24 -0
  70. package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/configHtmlTemplateLoader.js +18 -0
  71. package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/configWebWorkerLoader.js +21 -0
  72. package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/configsAssetsLoaders.js +138 -0
  73. package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/cssClassNameGenerate.js +83 -0
  74. package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/getCssLoaderOptions.js +23 -0
  75. package/packages/client_build_tool/lib/shared/bundler/webpack/loaders/workerLoader.js +133 -0
  76. package/packages/client_build_tool/lib/shared/bundler/webpack/optimizationConfig.js +39 -0
  77. package/packages/client_build_tool/lib/shared/bundler/webpack/outputConfig.js +28 -0
  78. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configCdnChangePlugin.js +18 -0
  79. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configCopyThirdpartyFile.js +38 -0
  80. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configEnvVariables.js +24 -0
  81. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configHtmlWebpackPlugin.js +28 -0
  82. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configI18nSplitPlugin.js +35 -0
  83. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configIgnorePlugin.js +16 -0
  84. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configMiniCSSExtractPlugin.js +23 -0
  85. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configProgressPlugin.js +19 -0
  86. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configRtlCssPlugin.js +27 -0
  87. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configServiceWorkerPlugin.js +18 -0
  88. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configUglifyCSSPlugin.js +15 -0
  89. package/packages/client_build_tool/lib/shared/bundler/webpack/plugins.js +39 -0
  90. package/packages/client_build_tool/lib/shared/bundler/webpack/postcssPlugins.js +36 -0
  91. package/packages/client_build_tool/lib/shared/bundler/webpack/resolvers.js +42 -0
  92. package/packages/client_build_tool/lib/shared/bundler/webpack/splitChunksConfig.js +12 -0
  93. package/packages/client_build_tool/lib/shared/bundler/webpack/webpack.dev.config.js +17 -0
  94. package/packages/client_build_tool/lib/shared/bundler/webpack/webpackBuild.js +24 -0
  95. package/packages/client_build_tool/lib/shared/bundler/webpack/webpackConfig.js +50 -0
  96. package/packages/client_build_tool/lib/shared/commands-utlis/doBasicRequiermentCheck.js +16 -0
  97. package/packages/client_build_tool/lib/shared/commands-utlis/getCliPath.js +38 -0
  98. package/packages/client_build_tool/lib/shared/commands-utlis/index.js +29 -0
  99. package/packages/client_build_tool/lib/shared/commands-utlis/log.js +13 -0
  100. package/packages/client_build_tool/lib/shared/commands-utlis/readArgsFormCommandLine.js +11 -0
  101. package/packages/client_build_tool/lib/shared/commands-utlis/readOptionFormCommandLine.js +11 -0
  102. package/packages/client_build_tool/lib/shared/commands-utlis/spanSync.js +35 -0
  103. package/packages/client_build_tool/lib/shared/constants.js +33 -0
  104. package/packages/client_build_tool/lib/shared/schemas/applyValuesToShema.js +37 -0
  105. package/packages/client_build_tool/lib/shared/schemas/cliArgsToObject.js +37 -0
  106. package/packages/client_build_tool/lib/shared/schemas/defaultConfigValues.js +119 -0
  107. package/packages/client_build_tool/lib/shared/schemas/deprecatedOptionsHandler.js +65 -0
  108. package/packages/client_build_tool/lib/shared/schemas/getCWD.js +23 -0
  109. package/packages/client_build_tool/lib/shared/schemas/getNpmVersion.js +21 -0
  110. package/packages/client_build_tool/lib/shared/schemas/npmConfigToObject.js +32 -0
  111. package/packages/client_build_tool/lib/shared/schemas/oldDefaultConfigValues.js +480 -0
  112. package/packages/client_build_tool/lib/shared/schemas/readOptions.js +55 -0
  113. package/packages/client_build_tool/lib/shared/schemas/readOptionsForPackageJson.js +26 -0
  114. package/packages/client_build_tool/lib/shared/schemas/readOptionsOld.js +152 -0
  115. package/packages/client_build_tool/lib/shared/server/cert/Tsicsezwild-22-23.crt +37 -0
  116. package/packages/client_build_tool/lib/shared/server/cert/Tsicsezwild-22-23.key +27 -0
  117. package/packages/client_build_tool/lib/shared/server/configWebpackDevMiddleware.js +40 -0
  118. package/packages/client_build_tool/lib/shared/server/corsHandleing.js +28 -0
  119. package/packages/client_build_tool/lib/shared/server/getIp.js +30 -0
  120. package/packages/client_build_tool/lib/shared/server/getServerURL.js +29 -0
  121. package/packages/client_build_tool/lib/shared/server/httpsOptions.js +53 -0
  122. package/packages/client_build_tool/lib/shared/server/initExpressApp.js +19 -0
  123. package/packages/client_build_tool/lib/shared/server/initialHTMLHandling.js +66 -0
  124. package/packages/client_build_tool/lib/shared/server/serveContextFiles.js +24 -0
  125. package/packages/client_build_tool/lib/shared/server/serverBywebpackDevMiddleware.js +40 -0
  126. package/packages/client_build_tool/lib/shared/server/startHttpServer.js +26 -0
  127. package/packages/client_build_tool/lib/shared/server/startHttpsServer.js +34 -0
  128. package/packages/client_build_tool/lib/shared/server/unwanted/addHttp2Server.js +41 -0
  129. package/packages/client_build_tool/lib/shared/server/unwanted/configWebpackDevMiddleware.js +44 -0
  130. package/packages/client_build_tool/lib/shared/server/unwanted/devServerUtlis.js +1 -0
  131. package/packages/client_build_tool/lib/shared/server/unwanted/mockApiSupport.js +19 -0
  132. package/packages/client_build_tool/lib/shared/server/unwanted/webpackConfig.js +32 -0
  133. package/packages/client_build_tool/lib/shared/server/unwanted/websocketMockSetup.js +48 -0
  134. package/packages/client_build_tool/lib/shared/server/urlConcat.js +25 -0
  135. package/packages/client_build_tool/lib/shared/utils/utils.js +1 -0
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = loader;
7
+ exports.pitch = pitch;
8
+
9
+ var _path = _interopRequireDefault(require("path"));
10
+
11
+ var _SingleEntryPlugin = _interopRequireDefault(require("webpack/lib/SingleEntryPlugin"));
12
+
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+
15
+ // import { getOptions } from 'loader-utils';
16
+ // import validateOptions from 'schema-utils';
17
+ const schema = {
18
+ 'type': 'object',
19
+ 'properties': {
20
+ 'publicPath': {
21
+ 'anyOf': [{
22
+ 'type': 'string'
23
+ }, {
24
+ 'instanceof': 'Function'
25
+ }]
26
+ },
27
+ 'filename': {
28
+ 'anyOf': [{
29
+ 'type': 'string',
30
+ 'minLength': 1
31
+ }, {
32
+ 'instanceof': 'Function'
33
+ }]
34
+ },
35
+ 'chunkFilename': {
36
+ 'type': 'string',
37
+ 'minLength': 1
38
+ },
39
+ 'esModule': {
40
+ 'type': 'boolean'
41
+ }
42
+ },
43
+ 'additionalProperties': false
44
+ }; // eslint-disable-next-line
45
+
46
+ function loader() {}
47
+
48
+ function getDefaultFilename(filename) {
49
+ if (typeof filename === 'function') {
50
+ return filename;
51
+ }
52
+
53
+ return filename.replace(/\.([a-z]+)(\?.+)?$/i, '.worker.$1$2');
54
+ }
55
+
56
+ function getDefaultChunkFilename(chunkFilename) {
57
+ return chunkFilename.replace(/\.([a-z]+)(\?.+)?$/i, '.worker.$1$2');
58
+ }
59
+
60
+ function pitch(request) {
61
+ this.cacheable(false);
62
+ const options = this.getOptions(); // console.log(this.getOptions());
63
+ // validateOptions(schema, options, {
64
+ // name: 'Worker Loader',
65
+ // baseDataPath: 'options'
66
+ // });
67
+
68
+ const workerContext = {};
69
+ const compilerOptions = this._compiler.options || {};
70
+ const filename = options.filename ? options.filename : getDefaultFilename(compilerOptions.output.filename);
71
+ const chunkFilename = options.chunkFilename ? options.chunkFilename : getDefaultChunkFilename(compilerOptions.output.chunkFilename);
72
+ const publicPath = options.publicPath ? options.publicPath : compilerOptions.output.publicPath;
73
+ workerContext.options = {
74
+ filename,
75
+ chunkFilename,
76
+ publicPath,
77
+ globalObject: 'self'
78
+ };
79
+ workerContext.compiler = this._compilation.createChildCompiler(`worker-loader ${request}`, workerContext.options);
80
+ /*
81
+ new WebWorkerTemplatePlugin().apply(workerContext.compiler);
82
+
83
+ if (compilerOptions.externals) {
84
+ new ExternalsPlugin(
85
+ getExternalsType(compilerOptions),
86
+ compilerOptions.externals
87
+ ).apply(workerContext.compiler);
88
+ } */
89
+
90
+ new _SingleEntryPlugin.default(this.context, `!!${request}`, _path.default.parse(this.resourcePath).name).apply(workerContext.compiler);
91
+ workerContext.request = request;
92
+ const cb = this.async();
93
+ workerContext.compiler.runAsChild((errorArg, entries, compilation) => {
94
+ let error = errorArg;
95
+
96
+ if (!error && compilation.errors && compilation.errors.length) {
97
+ // eslint-disable-next-line
98
+ error = compilation.errors[0];
99
+ }
100
+
101
+ const entry = entries && entries[0] && entries[0].files.values().next().value;
102
+
103
+ if (!error && !entry) {
104
+ error = Error(`WorkerPlugin: no entry for ${request}`);
105
+ }
106
+
107
+ if (error) {
108
+ return cb(error);
109
+ }
110
+
111
+ function workerCode() {
112
+ let blob;
113
+
114
+ try {
115
+ blob = new Blob([`importScripts('${this.workerUrl}');`], {
116
+ 'type': 'application/javascript'
117
+ });
118
+ } catch (e1) {
119
+ throw new Error(e1);
120
+ }
121
+
122
+ let url = window.URL || window.webkitURL;
123
+ let blobUrl = url.createObjectURL(blob);
124
+ let worker = new Worker(blobUrl);
125
+ return worker;
126
+ }
127
+
128
+ return cb(null, `${options.esModule ? 'export default' : 'module.exports ='} {\n
129
+ workerUrl: __webpack_public_path__ + ${JSON.stringify(entry)}, \n
130
+ getInstance: ${workerCode} \n
131
+ }`);
132
+ });
133
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.optimizationConfig = optimizationConfig;
7
+
8
+ var _nameTemplates = require("./common/nameTemplates");
9
+
10
+ var _hashUtils = require("./custom_plugins/I18nSplitPlugin/utils/hashUtils");
11
+
12
+ var _splitChunksConfig = require("./splitChunksConfig");
13
+
14
+ function optimizationConfig(options) {
15
+ const {
16
+ changeRuntimeChunkChar
17
+ } = options;
18
+ const {
19
+ chunkSplitEnable
20
+ } = options.i18nChunkSplit;
21
+ const i18nChunkFilename = (0, _nameTemplates.nameTemplates)('i18nchunkjs', options);
22
+ const chunkFilenameHasContentHash = (0, _hashUtils.hasContentHash)(i18nChunkFilename);
23
+ /**
24
+ * NOTE: we only need multiple runtime files when we use contentHash
25
+ * other wise we don't need multiple runtime files based locale
26
+ * that's why we added chunkSplitEnable && chunkFilenameHasContentHash logic
27
+ */
28
+
29
+ const suffix = // chunkSplitEnable ? '_[locale]' : '';
30
+ chunkSplitEnable && chunkFilenameHasContentHash ? '_[locale]' : '';
31
+ const char = changeRuntimeChunkChar ? '-' : '~';
32
+ return {
33
+ splitChunks: (0, _splitChunksConfig.splitChunksConfig)(options),
34
+ moduleIds: 'named',
35
+ runtimeChunk: {
36
+ name: entrypoint => `runtime${char}${entrypoint.name}${suffix}`
37
+ }
38
+ };
39
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.outputConfig = outputConfig;
7
+
8
+ var _path = _interopRequireDefault(require("path"));
9
+
10
+ var _constants = require("../../constants");
11
+
12
+ var _nameTemplates = require("./common/nameTemplates");
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ function outputConfig(options) {
17
+ const {
18
+ output,
19
+ publicPath
20
+ } = options;
21
+ return {
22
+ filename: (0, _nameTemplates.nameTemplates)('js', options),
23
+ chunkFilename: (0, _nameTemplates.nameTemplates)('chunkjs', options),
24
+ publicPath,
25
+ // clean: true,
26
+ path: _path.default.resolve(_constants.appPath, output)
27
+ };
28
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.configCdnChangePlugin = configCdnChangePlugin;
7
+
8
+ var _CdnChangePlugin = _interopRequireDefault(require("../custom_plugins/CdnChangePlugin"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ function configCdnChangePlugin(options) {
13
+ const {
14
+ cdnMapping
15
+ } = options.app;
16
+ console.log(cdnMapping);
17
+ return new _CdnChangePlugin.default(cdnMapping);
18
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.configCopyThirdpartyFile = configCopyThirdpartyFile;
7
+
8
+ var _path = _interopRequireDefault(require("path"));
9
+
10
+ var _copyWebpackPlugin = _interopRequireDefault(require("copy-webpack-plugin"));
11
+
12
+ var _fs = require("fs");
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ function configCopyThirdpartyFile(options) {
17
+ const {
18
+ context
19
+ } = options;
20
+ const {
21
+ tpFolder
22
+ } = options.app;
23
+
24
+ const tpFolderActualPath = tpFolder && _path.default.join(process.cwd(), context, tpFolder);
25
+
26
+ if (!tpFolder || !(0, _fs.existsSync)(tpFolderActualPath)) {
27
+ // console.log(tpFolderActualPath, 'not exist', tpFolder);
28
+ return null;
29
+ }
30
+
31
+ return new _copyWebpackPlugin.default({
32
+ patterns: [{
33
+ from: `${tpFolderActualPath}/`,
34
+ to: `./${tpFolder}/`,
35
+ toType: 'dir'
36
+ }]
37
+ });
38
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.configEnvVariables = configEnvVariables;
7
+
8
+ var _webpack = require("webpack");
9
+
10
+ function configEnvVariables(options) {
11
+ return new _webpack.DefinePlugin({
12
+ __CLIENT__: true,
13
+ __TEST__: false,
14
+ __SERVER__: false,
15
+ __DEVELOPMENT__: true,
16
+ __LOCAL_PRODUCTION__: false,
17
+ __DEVTOOLS__: true,
18
+ __DOCS__: false,
19
+ NODE_ENV: JSON.stringify('development'),
20
+ 'process.env': {
21
+ NODE_ENV: JSON.stringify('development')
22
+ }
23
+ });
24
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.configHtmlWebpackPlugin = configHtmlWebpackPlugin;
7
+
8
+ var _htmlWebpackPlugin = _interopRequireDefault(require("html-webpack-plugin"));
9
+
10
+ var _constants = require("../../../constants");
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ function configHtmlWebpackPlugin(options) {
15
+ const {
16
+ htmlTemplate
17
+ } = options.app;
18
+ const {
19
+ inject
20
+ } = htmlTemplate;
21
+ return new _htmlWebpackPlugin.default({
22
+ filename: 'index.html',
23
+ template: _constants.appInitialHTMLTemplatePath,
24
+ minify: false,
25
+ inject,
26
+ scriptLoading: 'defer'
27
+ });
28
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.configI18nSplitPlugin = configI18nSplitPlugin;
7
+
8
+ var _nameTemplates = require("../common/nameTemplates");
9
+
10
+ var _I18nSplitPlugin = _interopRequireDefault(require("../custom_plugins/I18nSplitPlugin"));
11
+
12
+ var _resourceBasedPublicPath = require("../common/resourceBasedPublicPath");
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ function configI18nSplitPlugin(options) {
17
+ const {
18
+ i18nChunkSplit
19
+ } = options;
20
+ const i18nPublicPath = (0, _resourceBasedPublicPath.resourceBasedPublicPath)('i18n', options); // const i18nPublicPathAsExpression = publicPathAsExpression('i18n', options);
21
+
22
+ return new _I18nSplitPlugin.default({
23
+ jsResource: i18nChunkSplit.jsResource,
24
+ localeVarName: i18nChunkSplit.localeVarName,
25
+ jsonpFunc: i18nChunkSplit.jsonpFunc,
26
+ templateLabel: i18nChunkSplit.templateLabel,
27
+ disableDefault: i18nChunkSplit.disableDefault,
28
+ filename: (0, _nameTemplates.nameTemplates)('i18njs', options),
29
+ chunkFilename: (0, _nameTemplates.nameTemplates)('i18nchunkjs', options),
30
+ publicPath: i18nPublicPath,
31
+ i18nManifestFileName: (0, _nameTemplates.nameTemplates)('i18nmanifest', options),
32
+ // template: (object, locale) => `window.loadI18n(${JSON.stringify(object)}, ${JSON.stringify(locale)})`,
33
+ propertiesFolder: i18nChunkSplit.propertiesFolder
34
+ });
35
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.configIgnorePlugin = configIgnorePlugin;
7
+
8
+ var _webpack = require("webpack");
9
+
10
+ // eslint-disable-next-line no-unused-vars
11
+ function configIgnorePlugin(options) {
12
+ return new _webpack.IgnorePlugin({
13
+ resourceRegExp: /^\.\/domain$/,
14
+ contextRegExp: /moment$/
15
+ });
16
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.configMiniCSSExtractPlugin = configMiniCSSExtractPlugin;
7
+
8
+ var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
9
+
10
+ var _nameTemplates = require("../common/nameTemplates");
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ function configMiniCSSExtractPlugin(options) {
15
+ const {
16
+ enableRTLSplit
17
+ } = options.css.plugins.rtlSplit;
18
+ const cssLTRFileNameTempalte = enableRTLSplit ? (0, _nameTemplates.nameTemplates)('cssdir', options) : (0, _nameTemplates.nameTemplates)('css', options);
19
+ return new _miniCssExtractPlugin.default({
20
+ filename: cssLTRFileNameTempalte,
21
+ chunkFilename: cssLTRFileNameTempalte
22
+ });
23
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.configProgressPlugin = configProgressPlugin;
7
+
8
+ var _webpack = _interopRequireDefault(require("webpack"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ // eslint-disable-next-line no-unused-vars
13
+ function configProgressPlugin(options) {
14
+ return new _webpack.default.ProgressPlugin({
15
+ handler: (percentage, message) => {
16
+ console.info(percentage, message);
17
+ }
18
+ });
19
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.configRtlCssPlugin = configRtlCssPlugin;
7
+
8
+ var _RtlCssPlugin = require("../custom_plugins/RtlSplitPlugin/RtlCssPlugin");
9
+
10
+ function configRtlCssPlugin(options) {
11
+ const {
12
+ enableRTLSplit,
13
+ templateLabel,
14
+ disableMinifySelector,
15
+ dirVarName
16
+ } = options.css.plugins.rtlSplit;
17
+
18
+ if (!enableRTLSplit) {
19
+ return null;
20
+ }
21
+
22
+ return new _RtlCssPlugin.RtlCssPlugin({
23
+ templateLabel,
24
+ disableMinifySelector,
25
+ dirVarName
26
+ });
27
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.configServiceWorkerPlugin = configServiceWorkerPlugin;
7
+
8
+ var _ServiceWorkerPlugin = _interopRequireDefault(require("../custom_plugins/ServiceWorkerPlugin"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ function configServiceWorkerPlugin(options) {
13
+ const {
14
+ serviceWorker
15
+ } = options.app;
16
+ console.log(serviceWorker);
17
+ return new _ServiceWorkerPlugin.default(serviceWorker);
18
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.configUglifyCSSPlugin = configUglifyCSSPlugin;
7
+
8
+ var _UglifyCSSPlugin = _interopRequireDefault(require("../custom_plugins/UglifyCSSPlugin"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ // eslint-disable-next-line no-unused-vars
13
+ function configUglifyCSSPlugin(options) {
14
+ return new _UglifyCSSPlugin.default();
15
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.plugins = plugins;
7
+
8
+ var _configHtmlWebpackPlugin = require("./pluginConfigs/configHtmlWebpackPlugin");
9
+
10
+ var _configEnvVariables = require("./pluginConfigs/configEnvVariables");
11
+
12
+ var _configI18nSplitPlugin = require("./pluginConfigs/configI18nSplitPlugin");
13
+
14
+ var _configMiniCSSExtractPlugin = require("./pluginConfigs/configMiniCSSExtractPlugin");
15
+
16
+ var _configRtlCssPlugin = require("./pluginConfigs/configRtlCssPlugin");
17
+
18
+ var _configCopyThirdpartyFile = require("./pluginConfigs/configCopyThirdpartyFile");
19
+
20
+ var _configIgnorePlugin = require("./pluginConfigs/configIgnorePlugin");
21
+
22
+ var _configUglifyCSSPlugin = require("./pluginConfigs/configUglifyCSSPlugin");
23
+
24
+ var _configCdnChangePlugin = require("./pluginConfigs/configCdnChangePlugin");
25
+
26
+ var _configServiceWorkerPlugin = require("./pluginConfigs/configServiceWorkerPlugin");
27
+
28
+ var _configProgressPlugin = require("./pluginConfigs/configProgressPlugin");
29
+
30
+ // import { IgnorePlugin } from 'webpack';
31
+ function plugins(options) {
32
+ const {
33
+ i18nChunkSplit
34
+ } = options;
35
+ const {
36
+ rtlSplit
37
+ } = options.css.plugins;
38
+ return [(0, _configEnvVariables.configEnvVariables)(options), (0, _configIgnorePlugin.configIgnorePlugin)(options), (0, _configCopyThirdpartyFile.configCopyThirdpartyFile)(options), (0, _configMiniCSSExtractPlugin.configMiniCSSExtractPlugin)(options), i18nChunkSplit.chunkSplitEnable && (0, _configI18nSplitPlugin.configI18nSplitPlugin)(options), rtlSplit.enableRTLSplit && (0, _configRtlCssPlugin.configRtlCssPlugin)(options), (0, _configUglifyCSSPlugin.configUglifyCSSPlugin)(options), (0, _configHtmlWebpackPlugin.configHtmlWebpackPlugin)(options), (0, _configCdnChangePlugin.configCdnChangePlugin)(options), (0, _configServiceWorkerPlugin.configServiceWorkerPlugin)(options), (0, _configProgressPlugin.configProgressPlugin)(options)].filter(Boolean);
39
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.postcssPlugins = postcssPlugins;
7
+
8
+ var _postcssRtl = _interopRequireDefault(require("postcss-rtl"));
9
+
10
+ var _postcssSelectorReplace = _interopRequireDefault(require("postcss-selector-replace"));
11
+
12
+ var _ExcludePlugin = require("./custom_postcss_loaders/ExcludePlugin");
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ // import CheckPlugin from './custom_postcss_loaders/CheckPlugin';
17
+ // console.log({ postcssRTLPlugin });
18
+ function postcssPlugins(options) {
19
+ const {
20
+ plugins,
21
+ selectorReplace
22
+ } = options.css;
23
+ return [selectorReplace && (0, _postcssSelectorReplace.default)(selectorReplace), ...(0, _ExcludePlugin.excludeEmptyCheckPlugin)({
24
+ enable: plugins.rtl.enable,
25
+ exclude: plugins.rtl.exclude,
26
+ plugins: [(0, _postcssRtl.default)({
27
+ addPrefixToSelector: function addPrefixToSelector(selector, prefix) {
28
+ if (prefix === '[dir]') {
29
+ return selector;
30
+ }
31
+
32
+ return `${prefix} ${selector}`; // Make selectors like [dir=rtl] > .selector
33
+ }
34
+ })]
35
+ })].filter(Boolean);
36
+ }
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.loaderResolver = loaderResolver;
7
+ exports.moduleResolver = moduleResolver;
8
+
9
+ var _client_packages_group = require("@zohodesk/client_packages_group");
10
+
11
+ var _constants = require("../../constants");
12
+
13
+ var _libAlias = require("./common/libAlias");
14
+
15
+ function moduleResolver(options) {
16
+ const {
17
+ moduleResolvePath,
18
+ disableES5Transpile
19
+ } = options.app;
20
+ const nodeModulesPath = moduleResolvePath // eslint-disable-next-line import/no-dynamic-require, global-require
21
+ ? require(require.resolve(moduleResolvePath, {
22
+ paths: [options.cwd]
23
+ })).nodeModulesPath : _client_packages_group.nodeModulesPath; // const {unstableDepsInverse} = options;
24
+ // console.log({ nodeModulesPath });
25
+
26
+ return {
27
+ modules: [_constants.cliNodemodulesPath, nodeModulesPath, 'node_modules'].filter(Boolean),
28
+ alias: disableES5Transpile ? _libAlias.libAlias : {} // alias: { ...libAlias, ...clientDependenies }
29
+
30
+ };
31
+ }
32
+
33
+ function loaderResolver(options) {
34
+ // const unstableDepsInverse = false;
35
+ const {
36
+ unstableDepsInverse
37
+ } = options;
38
+ return {
39
+ modules: unstableDepsInverse ? ['node_modules', _constants.cliNodemodulesPath] : [_constants.cliNodemodulesPath, 'node_modules'] // alias: libAlias
40
+
41
+ };
42
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.splitChunksConfig = splitChunksConfig;
7
+
8
+ function splitChunksConfig(options) {
9
+ return {
10
+ chunks: 'all'
11
+ };
12
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _readOptions = require("../../schemas/readOptions");
9
+
10
+ var _webpackConfig = _interopRequireDefault(require("./webpackConfig"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ const options = (0, _readOptions.getOptions)();
15
+ const config = (0, _webpackConfig.default)(options);
16
+ var _default = config;
17
+ exports.default = _default;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = webpackBuild;
7
+
8
+ var _webpack = require("webpack");
9
+
10
+ var _webpackConfig = _interopRequireDefault(require("./webpackConfig"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ function webpackBuild(options) {
15
+ const config = (0, _webpackConfig.default)(options);
16
+ console.log('webpackBuild');
17
+ (0, _webpack.webpack)(config, (err, stats) => {
18
+ if (err || stats.hasErrors()) {
19
+ // ...
20
+ console.log('err', err);
21
+ } // Done processing
22
+
23
+ });
24
+ }