@zohodesk/react-cli 1.1.18 → 1.1.19-exp.2

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 (166) hide show
  1. package/README.md +6 -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.prod.config.js +9 -2
  6. package/lib/loaderUtils/getDevJsLoaders.js +7 -2
  7. package/lib/loaders/workerLoader.js +39 -24
  8. package/lib/pluginUtils/configHtmlWebpackPlugins.js +9 -2
  9. package/lib/pluginUtils/getDevPlugins.js +4 -2
  10. package/lib/pluginUtils/getProdPlugins.js +3 -1
  11. package/lib/schemas/index.js +2 -1
  12. package/npm-shrinkwrap.json +19077 -15
  13. package/package.json +1 -1
  14. package/packages/client_build_tool/lib/allCommandsConfigs.js +23 -0
  15. package/packages/client_build_tool/lib/buildToolLoggers.js +32 -0
  16. package/packages/client_build_tool/lib/commands/build/commandExecutor.js +21 -0
  17. package/packages/client_build_tool/lib/commands/build/config.js +12 -0
  18. package/packages/client_build_tool/lib/commands/build/errorHander.js +10 -0
  19. package/packages/client_build_tool/lib/commands/build/index.js +35 -0
  20. package/packages/client_build_tool/lib/commands/build/optionsProcesser.js +40 -0
  21. package/packages/client_build_tool/lib/commands/buildEs/commandExecutor.js +17 -0
  22. package/packages/client_build_tool/lib/commands/buildEs/config.js +12 -0
  23. package/packages/client_build_tool/lib/commands/buildLib/commandExecutor.js +17 -0
  24. package/packages/client_build_tool/lib/commands/buildLib/config.js +12 -0
  25. package/packages/client_build_tool/lib/commands/start/commandExecutor.js +13 -0
  26. package/packages/client_build_tool/lib/commands/start/config.js +12 -0
  27. package/packages/client_build_tool/lib/commands/start/deprecationHandler.js +10 -0
  28. package/packages/client_build_tool/lib/commands/start/errorHander.js +10 -0
  29. package/packages/client_build_tool/lib/commands/start/optionsProcesser.js +36 -0
  30. package/packages/client_build_tool/lib/commands/start/postProcesser.js +10 -0
  31. package/packages/client_build_tool/lib/commands/start/preProcesser.js +10 -0
  32. package/packages/client_build_tool/lib/commandsRouter.js +71 -0
  33. package/packages/client_build_tool/lib/shared/bundler/webpack/common/decidePublicPath.js +44 -0
  34. package/packages/client_build_tool/lib/shared/bundler/webpack/common/libAlias.js +31 -0
  35. package/packages/client_build_tool/lib/shared/bundler/webpack/common/nameTemplates.js +51 -0
  36. package/packages/client_build_tool/lib/shared/bundler/webpack/common/resourceBasedPublicPath.js +21 -0
  37. package/packages/client_build_tool/lib/shared/bundler/webpack/cssLoaders.js +16 -0
  38. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/CdnChangePlugin.js +111 -0
  39. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/EFCPlugin.js +1 -0
  40. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/ContributionGuide.md +11 -0
  41. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nKeysIdentifer.js +136 -0
  42. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nSplit.md +95 -0
  43. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/README.md +25 -0
  44. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/constants.js +29 -0
  45. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/createHash.js +24 -0
  46. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nDependency.js +99 -0
  47. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nLoadingRuntimeModule.js +81 -0
  48. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nModule.js +201 -0
  49. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/index.js +401 -0
  50. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/optionsHandler.js +67 -0
  51. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/pathCreator.js +23 -0
  52. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/readI18nValues.js +29 -0
  53. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateFileName.js +49 -0
  54. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateHashHelpers.js +77 -0
  55. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/collectI18nKeys.js +63 -0
  56. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/hashUtils.js +19 -0
  57. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/index.js +31 -0
  58. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/propertiesUtils.js +127 -0
  59. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RTLSplitPlugin.js +1 -0
  60. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +63 -0
  61. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtlCssPlugin.js +89 -0
  62. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtrSplit.md +34 -0
  63. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/replaceCssDirTemplate.js +15 -0
  64. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/ServiceWorkerPlugin.js +155 -0
  65. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/UglifyCSSPlugin.js +49 -0
  66. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_postcss_loaders/ExcludePlugin.js +58 -0
  67. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_postcss_loaders/RTLSplitPlugin.js +139 -0
  68. package/packages/client_build_tool/lib/shared/bundler/webpack/devServerConfig.js +34 -0
  69. package/packages/client_build_tool/lib/shared/bundler/webpack/getCSSLoaders.js +30 -0
  70. package/packages/client_build_tool/lib/shared/bundler/webpack/jsLoaders.js +17 -0
  71. package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/assetLoaders.js +14 -0
  72. package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/babelLoaderConfig.js +24 -0
  73. package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/configHtmlTemplateLoader.js +18 -0
  74. package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/configWebWorkerLoader.js +21 -0
  75. package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/configsAssetsLoaders.js +138 -0
  76. package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/cssClassNameGenerate.js +83 -0
  77. package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/getCssLoaderOptions.js +23 -0
  78. package/packages/client_build_tool/lib/shared/bundler/webpack/loaders/workerLoader.js +133 -0
  79. package/packages/client_build_tool/lib/shared/bundler/webpack/optimizationConfig.js +39 -0
  80. package/packages/client_build_tool/lib/shared/bundler/webpack/outputConfig.js +28 -0
  81. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configCdnChangePlugin.js +18 -0
  82. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configCopyThirdpartyFile.js +38 -0
  83. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configEnvVariables.js +24 -0
  84. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configHtmlWebpackPlugin.js +28 -0
  85. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configI18nSplitPlugin.js +35 -0
  86. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configIgnorePlugin.js +16 -0
  87. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configMiniCSSExtractPlugin.js +23 -0
  88. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configProgressPlugin.js +19 -0
  89. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configRtlCssPlugin.js +27 -0
  90. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configServiceWorkerPlugin.js +18 -0
  91. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configUglifyCSSPlugin.js +15 -0
  92. package/packages/client_build_tool/lib/shared/bundler/webpack/plugins.js +39 -0
  93. package/packages/client_build_tool/lib/shared/bundler/webpack/postcssPlugins.js +36 -0
  94. package/packages/client_build_tool/lib/shared/bundler/webpack/resolvers.js +42 -0
  95. package/packages/client_build_tool/lib/shared/bundler/webpack/splitChunksConfig.js +12 -0
  96. package/packages/client_build_tool/lib/shared/bundler/webpack/webpack.dev.config.js +17 -0
  97. package/packages/client_build_tool/lib/shared/bundler/webpack/webpackBuild.js +24 -0
  98. package/packages/client_build_tool/lib/shared/bundler/webpack/webpackConfig.js +50 -0
  99. package/packages/client_build_tool/lib/shared/commands-utlis/doBasicRequiermentCheck.js +16 -0
  100. package/packages/client_build_tool/lib/shared/commands-utlis/getCliPath.js +38 -0
  101. package/packages/client_build_tool/lib/shared/commands-utlis/index.js +29 -0
  102. package/packages/client_build_tool/lib/shared/commands-utlis/log.js +13 -0
  103. package/packages/client_build_tool/lib/shared/commands-utlis/readArgsFormCommandLine.js +11 -0
  104. package/packages/client_build_tool/lib/shared/commands-utlis/readOptionFormCommandLine.js +11 -0
  105. package/packages/client_build_tool/lib/shared/commands-utlis/spanSync.js +35 -0
  106. package/packages/client_build_tool/lib/shared/constants.js +33 -0
  107. package/packages/client_build_tool/lib/shared/schemas/applyValuesToShema.js +37 -0
  108. package/packages/client_build_tool/lib/shared/schemas/cliArgsToObject.js +37 -0
  109. package/packages/client_build_tool/lib/shared/schemas/defaultConfigValues.js +119 -0
  110. package/packages/client_build_tool/lib/shared/schemas/deprecatedOptionsHandler.js +65 -0
  111. package/packages/client_build_tool/lib/shared/schemas/getCWD.js +23 -0
  112. package/packages/client_build_tool/lib/shared/schemas/getNpmVersion.js +21 -0
  113. package/packages/client_build_tool/lib/shared/schemas/npmConfigToObject.js +32 -0
  114. package/packages/client_build_tool/lib/shared/schemas/oldDefaultConfigValues.js +480 -0
  115. package/packages/client_build_tool/lib/shared/schemas/readOptions.js +55 -0
  116. package/packages/client_build_tool/lib/shared/schemas/readOptionsForPackageJson.js +26 -0
  117. package/packages/client_build_tool/lib/shared/schemas/readOptionsOld.js +152 -0
  118. package/packages/client_build_tool/lib/shared/server/cert/Tsicsezwild-22-23.crt +37 -0
  119. package/packages/client_build_tool/lib/shared/server/cert/Tsicsezwild-22-23.key +27 -0
  120. package/packages/client_build_tool/lib/shared/server/configWebpackDevMiddleware.js +40 -0
  121. package/packages/client_build_tool/lib/shared/server/corsHandleing.js +28 -0
  122. package/packages/client_build_tool/lib/shared/server/getIp.js +30 -0
  123. package/packages/client_build_tool/lib/shared/server/getServerURL.js +29 -0
  124. package/packages/client_build_tool/lib/shared/server/httpsOptions.js +53 -0
  125. package/packages/client_build_tool/lib/shared/server/initExpressApp.js +19 -0
  126. package/packages/client_build_tool/lib/shared/server/initialHTMLHandling.js +66 -0
  127. package/packages/client_build_tool/lib/shared/server/serveContextFiles.js +24 -0
  128. package/packages/client_build_tool/lib/shared/server/serverBywebpackDevMiddleware.js +40 -0
  129. package/packages/client_build_tool/lib/shared/server/startHttpServer.js +26 -0
  130. package/packages/client_build_tool/lib/shared/server/startHttpsServer.js +34 -0
  131. package/packages/client_build_tool/lib/shared/server/unwanted/addHttp2Server.js +41 -0
  132. package/packages/client_build_tool/lib/shared/server/unwanted/configWebpackDevMiddleware.js +44 -0
  133. package/packages/client_build_tool/lib/shared/server/unwanted/devServerUtlis.js +1 -0
  134. package/packages/client_build_tool/lib/shared/server/unwanted/mockApiSupport.js +19 -0
  135. package/packages/client_build_tool/lib/shared/server/unwanted/webpackConfig.js +32 -0
  136. package/packages/client_build_tool/lib/shared/server/unwanted/websocketMockSetup.js +48 -0
  137. package/packages/client_build_tool/lib/shared/server/urlConcat.js +25 -0
  138. package/packages/client_build_tool/lib/shared/utils/utils.js +1 -0
  139. package/packages/client_build_tool/node_modules/history/CHANGES.md +395 -0
  140. package/packages/client_build_tool/node_modules/history/DOMUtils.js +3 -0
  141. package/packages/client_build_tool/node_modules/history/ExecutionEnvironment.js +3 -0
  142. package/packages/client_build_tool/node_modules/history/LICENSE +21 -0
  143. package/packages/client_build_tool/node_modules/history/LocationUtils.js +3 -0
  144. package/packages/client_build_tool/node_modules/history/PathUtils.js +3 -0
  145. package/packages/client_build_tool/node_modules/history/README.md +282 -0
  146. package/packages/client_build_tool/node_modules/history/cjs/history.js +933 -0
  147. package/packages/client_build_tool/node_modules/history/cjs/history.min.js +1 -0
  148. package/packages/client_build_tool/node_modules/history/createBrowserHistory.js +3 -0
  149. package/packages/client_build_tool/node_modules/history/createHashHistory.js +3 -0
  150. package/packages/client_build_tool/node_modules/history/createMemoryHistory.js +3 -0
  151. package/packages/client_build_tool/node_modules/history/createTransitionManager.js +3 -0
  152. package/packages/client_build_tool/node_modules/history/es/DOMUtils.js +7 -0
  153. package/packages/client_build_tool/node_modules/history/es/ExecutionEnvironment.js +7 -0
  154. package/packages/client_build_tool/node_modules/history/es/LocationUtils.js +7 -0
  155. package/packages/client_build_tool/node_modules/history/es/PathUtils.js +7 -0
  156. package/packages/client_build_tool/node_modules/history/es/createBrowserHistory.js +7 -0
  157. package/packages/client_build_tool/node_modules/history/es/createHashHistory.js +7 -0
  158. package/packages/client_build_tool/node_modules/history/es/createMemoryHistory.js +7 -0
  159. package/packages/client_build_tool/node_modules/history/es/createTransitionManager.js +7 -0
  160. package/packages/client_build_tool/node_modules/history/es/warnAboutDeprecatedESMImport.js +35 -0
  161. package/packages/client_build_tool/node_modules/history/esm/history.js +904 -0
  162. package/packages/client_build_tool/node_modules/history/index.js +7 -0
  163. package/packages/client_build_tool/node_modules/history/package.json +117 -0
  164. package/packages/client_build_tool/node_modules/history/umd/history.js +1059 -0
  165. package/packages/client_build_tool/node_modules/history/umd/history.min.js +1 -0
  166. package/packages/client_build_tool/node_modules/history/warnAboutDeprecatedCJSRequire.js +35 -0
@@ -0,0 +1,155 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _fs = _interopRequireDefault(require("fs"));
9
+
10
+ var _path = _interopRequireDefault(require("path"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ //import { getI18nFileUrlPathTemplate } from './I18nSplitPlugin/utils/getI18nFileUrlPathTemplate';
15
+ //import { getOptions } from '../utils';
16
+ //import I18nKeysIdentifer from './I18nSplitPlugin/I18nKeysIdentifer';
17
+ //import { replaceCssDirTemplateMapper } from './RtlSplitPlugin/replaceCssDirTemplate';
18
+ // const {
19
+ // css: { enableRTLSplit },
20
+ // i18n: { chunkSplitEnable }
21
+ // } = getOptions();
22
+ class ServiceWorkerPlugin {
23
+ constructor(options) {
24
+ this.i18nFileNameTemplate = options.i18nFileNameTemplate;
25
+ this.fileName = options.fileName;
26
+ this.serviceWorkerPath = options.filePath;
27
+ this.writePath = options.exitPath;
28
+ this.replaceText = options.replaceText; // this.publicPaths = options.publicPaths;
29
+ }
30
+
31
+ isInitialChunk(chunk) {
32
+ if ('canBeInitial' in chunk) {
33
+ return chunk.canBeInitial();
34
+ }
35
+
36
+ return chunk.isInitial();
37
+ }
38
+
39
+ apply(compiler) {
40
+ compiler.hooks.emit.tap('ServiceWorkerPlugin', compilation => {
41
+ _fs.default.readFile(this.serviceWorkerPath, 'utf-8', (err, data) => {
42
+ if (err) {
43
+ throw new Error(err);
44
+ } else {
45
+ /* const extractedChunks = compilation.chunks.filter(chunk => {
46
+ if ('canBeInitial' in chunk) {
47
+ return chunk.canBeInitial();
48
+ }
49
+ return chunk.isInitial();
50
+ }); */
51
+ // let [js, css, , , i18nPublicPath] = this.publicPaths;
52
+ // let initialChunkUrls = [];
53
+ let allChunkUrls = [];
54
+ let allI18nAssets = [];
55
+ let entrypoint = compilation.entrypoints.get('main');
56
+ let initialChunkUrls = entrypoint.getFiles();
57
+ const cssDirTemplate = '@dir@';
58
+ /**
59
+ * NOTE:
60
+ * if chunkSplitEnable is false means,
61
+ * serviceWorker will get i18n files path for html
62
+ */
63
+ // let initalI18nAssets = chunkSplitEnable
64
+ // ? entrypoint.chunks
65
+ // //.filter(chunk => I18nKeysIdentifer.isChunkHasI18n(chunk))
66
+ // .map(chunk =>
67
+ // getI18nFileUrlPathTemplate(
68
+ // compilation,
69
+ // chunk,
70
+ // this.i18nFileNameTemplate,
71
+ // '@locale@'
72
+ // )
73
+ // )
74
+ // : [];
75
+
76
+ let initalI18nAssets = []; //chunkSplitEnable &&
77
+
78
+ compilation.chunks.filter(c => !this.isInitialChunk(c)) //.filter(chunk => I18nKeysIdentifer.isChunkHasI18n(chunk))
79
+ .forEach(chunk => {
80
+ // let isInitial = this.isInitialChunk(chunk);
81
+ allChunkUrls = allChunkUrls.concat(chunk.files); // allI18nAssets.push(
82
+ // getI18nFileUrlPathTemplate(
83
+ // compilation,
84
+ // chunk,
85
+ // this.i18nFileNameTemplate,
86
+ // '@locale@'
87
+ // )
88
+ // );
89
+ });
90
+ /** Removing source map files from getting added */
91
+
92
+ initialChunkUrls = initialChunkUrls.filter(fileName => !fileName.endsWith('.map'));
93
+ allChunkUrls = allChunkUrls.filter(fileName => !fileName.endsWith('.map')); // if (enableRTLSplit) {
94
+ // initialChunkUrls = replaceCssDirTemplateMapper(
95
+ // initialChunkUrls,
96
+ // cssDirTemplate
97
+ // );
98
+ // allChunkUrls = replaceCssDirTemplateMapper(
99
+ // allChunkUrls,
100
+ // cssDirTemplate
101
+ // );
102
+ // }
103
+
104
+ let mod = data.replace(this.replaceText, `self.assets = ${JSON.stringify(initialChunkUrls.concat(initalI18nAssets))};self.allChunks = ${JSON.stringify(allChunkUrls.concat(allI18nAssets))};`);
105
+
106
+ if (!_fs.default.existsSync(this.writePath)) {
107
+ _fs.default.mkdirSync(this.writePath, {
108
+ recursive: true
109
+ });
110
+ }
111
+
112
+ _fs.default.writeFileSync(_path.default.join(this.writePath, `${this.fileName}`), mod);
113
+ }
114
+ });
115
+ });
116
+ }
117
+
118
+ } // compiler.hooks.thisCompilation.tap('AddAssetPlugin', compilation => {
119
+ // compilation.hooks.processAssets.tapPromise(tapOptions, async () => {
120
+ // let source;
121
+ // if (typeof this.source === 'string') {
122
+ // if (compilation.getAsset(this.filePath)) {
123
+ // // Skip emitting the asset again because it's immutable
124
+ // return;
125
+ // }
126
+ // source = this.source;
127
+ // } else {
128
+ // source = await this.source(compilation);
129
+ // }
130
+ // compilation.emitAsset(this.filePath, new RawSource(source));
131
+ // });
132
+ // });
133
+ // getContentHash(compiler, compilation, source) {
134
+ // const { outputOptions } = compilation;
135
+ // const { hashDigest, hashDigestLength, hashFunction, hashSalt } =
136
+ // outputOptions;
137
+ // const hash = compiler.webpack.util.createHash(
138
+ // /** @type {string} */ (hashFunction)
139
+ // );
140
+ // if (hashSalt) {
141
+ // hash.update(hashSalt);
142
+ // }
143
+ // hash.update(source);
144
+ // const fullContentHash = hash.digest(hashDigest);
145
+ // return fullContentHash.toString().slice(0, hashDigestLength);
146
+ // }
147
+ // const contentHash = CopyPlugin.getContentHash(
148
+ // compiler,
149
+ // compilation,
150
+ // source.buffer()
151
+ // );
152
+ //hash same as index.html file ??
153
+
154
+
155
+ exports.default = ServiceWorkerPlugin;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _uglifycss = _interopRequireDefault(require("uglifycss"));
9
+
10
+ var _webpack = require("webpack");
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ /* eslint-disable class-methods-use-this */
15
+ // import { RawSource } from 'webpack-sources';
16
+ const pluginName = 'UglifyCSSPlugin'; // TODO: Check for css minimizer plugin
17
+
18
+ class UglifyCSSPlugin {
19
+ apply(compiler) {
20
+ const {
21
+ RawSource
22
+ } = compiler.webpack.sources;
23
+ compiler.hooks.emit.tap(pluginName, compilation => {
24
+ compilation.hooks.processAssets.tapAsync({
25
+ name: pluginName,
26
+ stage: _webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE
27
+ }, assets => {
28
+ Object.keys(assets).filter(filename => /\.css$/.test(filename)).forEach(filename => {
29
+ try {
30
+ let asset = compilation.assets[filename].source();
31
+
32
+ if (typeof asset !== 'string') {
33
+ asset = asset.toString();
34
+ }
35
+
36
+ const result = _uglifycss.default.processString(asset);
37
+
38
+ compilation.updateAsset(filename, new RawSource(result));
39
+ } catch (e) {
40
+ compilation.errors.push(e);
41
+ }
42
+ });
43
+ });
44
+ });
45
+ }
46
+
47
+ }
48
+
49
+ exports.default = UglifyCSSPlugin;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ exports.excludeEmptyCheckPlugin = excludeEmptyCheckPlugin;
8
+
9
+ var _postcss = _interopRequireDefault(require("postcss"));
10
+
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+
13
+ const ExcludePlugin = opts => {
14
+ const {
15
+ plugins,
16
+ exclude
17
+ } = opts;
18
+ return {
19
+ postcssPlugin: 'postcss-dark-theme-class',
20
+
21
+ Once(root, {
22
+ result
23
+ }) {
24
+ const inputFile = root.source.input.file;
25
+ const isIgnoredFile = exclude.some(file => inputFile.indexOf(file) !== -1);
26
+
27
+ if (!isIgnoredFile) {
28
+ const handler = response => response.messages.forEach(msg => result.messages.push(msg));
29
+
30
+ return (0, _postcss.default)(plugins).process(root, {
31
+ from: undefined
32
+ }).then(handler);
33
+ }
34
+
35
+ return root;
36
+ }
37
+
38
+ };
39
+ };
40
+
41
+ ExcludePlugin.postcss = true;
42
+ var _default = ExcludePlugin;
43
+ exports.default = _default;
44
+
45
+ function excludeEmptyCheckPlugin({
46
+ enable,
47
+ exclude,
48
+ plugins
49
+ }) {
50
+ if (!enable) {
51
+ return [];
52
+ }
53
+
54
+ return exclude.length === 0 ? plugins : [ExcludePlugin({
55
+ exclude,
56
+ plugins
57
+ })];
58
+ }
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.separateRtlAndLtr = separateRtlAndLtr;
7
+ exports.separateSingleDir = separateSingleDir;
8
+
9
+ var postcss = _interopRequireWildcard(require("postcss"));
10
+
11
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
12
+
13
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
+
15
+ /* eslint-disable no-param-reassign */
16
+ const oppositeDir = {
17
+ ltr: 'rtl',
18
+ rtl: 'ltr'
19
+ };
20
+
21
+ function compareSelector(selector1, selector2) {
22
+ // console.log({ selector1, selector2 }, selector1 === selector2);
23
+ return selector1 === selector2;
24
+ }
25
+
26
+ const directionRegexs = {
27
+ ltr: /\[dir=ltr\]/,
28
+ rtl: /\[dir=rtl\]/
29
+ };
30
+
31
+ const getRegex = dir => directionRegexs[dir];
32
+
33
+ const getOppositeRegex = dir => getRegex(oppositeDir[dir]);
34
+
35
+ function selectorMinifySameDir(selector, direction) {
36
+ // NOTE: if this rule is same dir as current need
37
+ // then we can just remove that [dir=ltr] or [dir=rtl]
38
+ // it just for minimaze selector
39
+ const regex = getRegex(direction);
40
+ return selector.replace(regex, '').trim();
41
+ }
42
+ /**
43
+ * this funtion will remove given rule,
44
+ * if given selector and it's previous sibiling rule selector are same
45
+ * current rule properties will move to previous sibiling rule.
46
+ * @param {Rule} rule current rule
47
+ */
48
+
49
+
50
+ function mergeIfSameSelector(rule) {
51
+ // NOTE: to merge dublicate selector rules
52
+ const prev = rule.prev();
53
+
54
+ if (prev && compareSelector(prev.selector, rule.selector)) {
55
+ rule.each(decl => {
56
+ prev.append(decl);
57
+ });
58
+ rule.remove();
59
+ }
60
+ }
61
+ /**
62
+ * this funtion will remove given rule,
63
+ * if given selector and it's previous sibiling rule selector are same
64
+ * current rule properties will move to previous sibiling rule.
65
+ * @param {Rule} rule current rule
66
+ */
67
+
68
+
69
+ function removeIfOppsiteDirRule(rule, direction, rootOptions) {
70
+ // console.log({ rule, type: rule.type });
71
+ const selectors = rule.selector.split(/\s*,\s*/); // NOTE: if we use opposite dir selector as custom override reason,
72
+ // and compain normal selector with it, In this case
73
+ // we just a have to remove that selector only not full rule
74
+
75
+ const oppositeDirRegex = getOppositeRegex(direction);
76
+ let remainingSelectors = selectors.filter(selector => !oppositeDirRegex.test(selector));
77
+
78
+ if (!rootOptions.disableMinifySelector) {
79
+ remainingSelectors = remainingSelectors.map(selector => selectorMinifySameDir(selector, direction));
80
+ }
81
+
82
+ if (remainingSelectors.length) {
83
+ rule.selector = remainingSelectors.join(', ');
84
+ } else {
85
+ // NOTE: every selector is opposite dir then we have to remove the rule
86
+ rule.remove();
87
+ }
88
+ }
89
+
90
+ function removeIfOppsiteDirKeyframe(rule, direction) {
91
+ const name = rule.params;
92
+ const keyFrameDirName = name.slice(name.lastIndexOf('-') + 1);
93
+
94
+ if (keyFrameDirName === oppositeDir[direction]) {
95
+ // console.log({ m: 'removed', keyFrameName: rule.params });
96
+ rule.remove();
97
+ }
98
+ }
99
+
100
+ function separateSingleDir(root, direction, rootOptions) {
101
+ root.walkRules(rule => {
102
+ removeIfOppsiteDirRule(rule, direction, rootOptions);
103
+ mergeIfSameSelector(rule);
104
+ });
105
+ root.walkAtRules(rule => {
106
+ removeIfOppsiteDirKeyframe(rule, direction);
107
+ });
108
+ return root;
109
+ }
110
+
111
+ function separateRtlAndLtr(css, rootOptions) {
112
+ // let processor = postcss([]).process(css);
113
+ const root = postcss.parse(css); // let { root } = processor;
114
+ // console.log(processor, root);
115
+ // NOTE: I did first rtl then ltr , Because for ltr I use original root ref
116
+
117
+ const rtlRoot = separateSingleDir(root.clone(), 'rtl', rootOptions); // console.log('############################');
118
+
119
+ const ltrRoot = separateSingleDir(root, 'ltr', rootOptions);
120
+ return {
121
+ ltrRoot,
122
+ rtlRoot,
123
+ ltr: ltrRoot.toString(),
124
+ rtl: rtlRoot.toString()
125
+ };
126
+ } // NOTE: to test in https://astexplorer.net/
127
+ // you can test with sample input https://astexplorer.net/#/gist/a892a509eb585099355ef53ef094f836/1ca70d5f7af3b88ca4910296e12f118e9712c874
128
+ // export default postcss.plugin('postcss-rtl-remove', (options = {}) =>
129
+ // // Work with options here
130
+ // root => {
131
+ // const rtlRoot = separateSingleDir(root.clone(), 'rtl');
132
+ // const ltrRoot = separateSingleDir(root, 'ltr');
133
+ // // root.append(postcss.comment({ text: 'comment' }));
134
+ // root.append(postcss.comment({ text: 'this is spliting part ' }));
135
+ // root.append(rtlRoot);
136
+ // //console.log({root, roots:root+""}, root+"")
137
+ // // Transform CSS AST here
138
+ // }
139
+ // );
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.devServerConfig = devServerConfig;
7
+
8
+ var _path = require("path");
9
+
10
+ var _constants = require("../../constants");
11
+
12
+ // import { httpsOptions } from '../../server/httpsOptions';
13
+ function devServerConfig(options) {
14
+ const {
15
+ context,
16
+ server
17
+ } = options;
18
+ const {
19
+ port
20
+ } = server;
21
+ return {
22
+ static: {
23
+ directory: (0, _path.join)(_constants.appPath, context)
24
+ },
25
+ allowedHosts: 'all',
26
+ // https: httpsOptions(options),
27
+ client: {
28
+ logging: 'error',
29
+ overlay: true
30
+ },
31
+ // contentBase: "app"
32
+ port
33
+ };
34
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getCSSLoaders = getCSSLoaders;
7
+
8
+ var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
9
+
10
+ var _getCssLoaderOptions = require("./loaderConfigs/getCssLoaderOptions");
11
+
12
+ var _postcssPlugins = require("./postcssPlugins");
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ function getCSSLoaders(options) {
17
+ const neededPostCssPlugins = (0, _postcssPlugins.postcssPlugins)(options);
18
+ const cssLoaderOptions = (0, _getCssLoaderOptions.getCssLoaderOptions)(options);
19
+ return [_miniCssExtractPlugin.default.loader, {
20
+ loader: 'css-loader',
21
+ options: cssLoaderOptions
22
+ }, neededPostCssPlugins.length && {
23
+ loader: 'postcss-loader',
24
+ options: {
25
+ postcssOptions: {
26
+ plugins: neededPostCssPlugins
27
+ }
28
+ }
29
+ }].filter(Boolean);
30
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.jsLoaders = jsLoaders;
7
+
8
+ var _babelLoaderConfig = require("./loaderConfigs/babelLoaderConfig");
9
+
10
+ function jsLoaders(options) {
11
+ return [{
12
+ test: /\.js$/,
13
+ exclude: /node_modules/,
14
+ use: [(0, _babelLoaderConfig.babelLoaderConfig)(options)] // include: path.join(appPath, folder)
15
+
16
+ }];
17
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.assetLoaders = assetLoaders;
7
+
8
+ var _configsAssetsLoaders = require("./configsAssetsLoaders");
9
+
10
+ function assetLoaders(options) {
11
+ // const { enableChunkHash } = options;
12
+ // const nameTemplate = createNameTemplate(enableChunkHash);
13
+ return [(0, _configsAssetsLoaders.configImageLoader)(options), (0, _configsAssetsLoaders.configFontLoader)(options), (0, _configsAssetsLoaders.configSVGLoader)(options), (0, _configsAssetsLoaders.configAudioLoader)(options), (0, _configsAssetsLoaders.configVideoLoader)(options)];
14
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.babelLoaderConfig = babelLoaderConfig;
7
+ const supportedBrowserVersions = ['last 3 Chrome versions', 'last 3 Firefox versions', 'last 3 Edge versions', 'last 3 Safari versions'];
8
+
9
+ function babelLoaderConfig(options) {
10
+ return {
11
+ loader: 'babel-loader',
12
+ options: {
13
+ presets: [[require.resolve('@babel/preset-env'), {
14
+ modules: false,
15
+ useBuiltIns: 'usage',
16
+ corejs: 3,
17
+ targets: {
18
+ browsers: supportedBrowserVersions
19
+ }
20
+ }], require.resolve('@babel/preset-react')],
21
+ cacheDirectory: true
22
+ }
23
+ };
24
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.configHtmlTemplateLoader = configHtmlTemplateLoader;
7
+
8
+ function configHtmlTemplateLoader(options) {
9
+ return {
10
+ test: /\.tmpl$/,
11
+ use: [{
12
+ loader: 'html-loader',
13
+ options: {
14
+ minimize: true
15
+ }
16
+ }]
17
+ };
18
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.configWebWorkerLoader = configWebWorkerLoader;
7
+
8
+ var _nameTemplates = require("../common/nameTemplates");
9
+
10
+ function configWebWorkerLoader(options) {
11
+ return {
12
+ test: /\.worker.js$/,
13
+ use: {
14
+ loader: require.resolve('../loaders/workerLoader.js'),
15
+ options: {
16
+ esModule: true,
17
+ filename: (0, _nameTemplates.nameTemplates)('workerjs', options)
18
+ }
19
+ }
20
+ };
21
+ }