@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,138 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.configAudioLoader = configAudioLoader;
7
+ exports.configFontLoader = configFontLoader;
8
+ exports.configImageLoader = configImageLoader;
9
+ exports.configSVGLoader = configSVGLoader;
10
+ exports.configVideoLoader = configVideoLoader;
11
+
12
+ var _nameTemplates = require("../common/nameTemplates");
13
+
14
+ // function getLoaderOptionQueryString(params) {
15
+ const ImageExtRegex = /\.jpe?g$|\.gif$|\.png|\.webp$/;
16
+ const FontExtRegex = /\.woff2|\.woff$|\.ttf$|\.eot$/;
17
+ const SVGExtRegex = /\.svg$/;
18
+ const AudioExtRegex = /\.ogg$/;
19
+ const VideoExtRegex = /\.mp4|\.webm$/;
20
+
21
+ function createAssetLoader({
22
+ test,
23
+ nameTemplate,
24
+ limit
25
+ }) {
26
+ const conf = {
27
+ test,
28
+ type: 'asset'
29
+ };
30
+
31
+ if (limit) {
32
+ conf.parser = {
33
+ dataUrlCondition: {
34
+ maxSize: limit // 4 * 1024 // 4kb
35
+
36
+ }
37
+ };
38
+ } else {
39
+ conf.type = 'asset/resource';
40
+ }
41
+
42
+ if (nameTemplate) {
43
+ conf.generator = {
44
+ filename: nameTemplate
45
+ };
46
+ }
47
+
48
+ return conf;
49
+ }
50
+ /**
51
+ * @typedef {Object} LoaderConfig
52
+ * @property {Number} enableChunkHash
53
+ */
54
+
55
+ /**
56
+ * @param {LoaderConfig} options
57
+ * @returns
58
+ */
59
+
60
+
61
+ function configImageLoader(options) {
62
+ return createAssetLoader({
63
+ test: ImageExtRegex,
64
+ nameTemplate: (0, _nameTemplates.nameTemplates)('image', options),
65
+ limit: 1000
66
+ });
67
+ }
68
+
69
+ function configFontLoader(options) {
70
+ return createAssetLoader({
71
+ test: FontExtRegex,
72
+ nameTemplate: (0, _nameTemplates.nameTemplates)('font', options),
73
+ limit: 1000
74
+ });
75
+ }
76
+
77
+ function configSVGLoader(options) {
78
+ return createAssetLoader({
79
+ test: SVGExtRegex,
80
+ nameTemplate: (0, _nameTemplates.nameTemplates)('svg', options),
81
+ limit: 1000
82
+ });
83
+ }
84
+
85
+ function configAudioLoader(options) {
86
+ return createAssetLoader({
87
+ test: AudioExtRegex,
88
+ nameTemplate: (0, _nameTemplates.nameTemplates)('audio', options)
89
+ });
90
+ }
91
+
92
+ function configVideoLoader(options) {
93
+ return createAssetLoader({
94
+ test: VideoExtRegex,
95
+ nameTemplate: (0, _nameTemplates.nameTemplates)('video', options)
96
+ });
97
+ }
98
+ /*
99
+ export function createNameTemplate(enableChunkHash) {
100
+ const ext = `${enableChunkHash ? ".[hash:20]" : ""}.[ext]`;
101
+ return `[name]${ext}`;
102
+ }
103
+
104
+ export function createImageAndFontsAndSVGLoaders(enableChunkHash) {
105
+ const nameTemplate = createNameTemplate(enableChunkHash);
106
+ return [
107
+ configImageLoader(nameTemplate),
108
+ configFontLoader(nameTemplate),
109
+ configSVGLoader(nameTemplate),
110
+ configAudioLoader(nameTemplate)
111
+ ];
112
+ }
113
+ */
114
+
115
+ /*
116
+ export function createLoaderOptionObject(
117
+ loaderName,
118
+ nameTemplate,
119
+ fallback,
120
+ limit = 1000
121
+ ) {
122
+ return {
123
+ loader: loaderName,
124
+ options: {
125
+ limit,
126
+ name: nameTemplate,
127
+ fallback
128
+ }
129
+ };
130
+ }
131
+
132
+ function configLoaderObject(filter, loaderAndOptions) {
133
+ return {
134
+ test: filter,
135
+ use: loaderAndOptions
136
+ };
137
+ }
138
+ */
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _crypto = require("crypto");
9
+
10
+ var _os = _interopRequireDefault(require("os"));
11
+
12
+ var _path = _interopRequireDefault(require("path"));
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ function getHash(str) {
17
+ return (0, _crypto.createHash)('md5').update(str).digest();
18
+ }
19
+
20
+ const isWindows = _os.default.platform().toLowerCase() === 'win32';
21
+
22
+ const isFileEligibleToHashClass = (resourcePath, machineBasedPatterns) => {
23
+ if (!resourcePath.includes('node_modules')) {
24
+ return false;
25
+ }
26
+
27
+ return machineBasedPatterns.some(p => resourcePath.includes(p));
28
+ };
29
+
30
+ var _default = options => {
31
+ const {
32
+ classNameOptions
33
+ } = options.css;
34
+ const {
35
+ cssHashSelectors,
36
+ classNamePrefix
37
+ } = classNameOptions;
38
+ let canApplyHashClassName = null;
39
+
40
+ if (cssHashSelectors) {
41
+ const {
42
+ filenames,
43
+ packages
44
+ } = cssHashSelectors;
45
+ const machineBasedPatterns = isWindows ? packages.map(e => e.replace(/\//g, '\\')) : packages;
46
+
47
+ canApplyHashClassName = function canApplyHashClassName(resourcePath, cleanFileName) {
48
+ return isFileEligibleToHashClass(resourcePath, machineBasedPatterns) || filenames.indexOf(cleanFileName);
49
+ };
50
+ }
51
+
52
+ return (context, localIdentName, localName) => {
53
+ // NOTE: in build macine we use date as folder path.
54
+ // So every time we create new build there is path will alway different
55
+ // in order to minmaze that problem we try in relative path;
56
+ // console.log('context.resourcePath', context.resourcePath, context);
57
+ // let contextResourcePath = context.resourcePath;
58
+ const {
59
+ rootContext,
60
+ resourcePath
61
+ } = context;
62
+
63
+ const relativePath = _path.default.relative(rootContext, resourcePath);
64
+
65
+ if (resourcePath.endsWith('.plain.css')) {
66
+ return localName;
67
+ }
68
+
69
+ const fileNameWithoutExt = _path.default.parse(relativePath).name;
70
+
71
+ const cleanFileName = fileNameWithoutExt.replace(/-/g, '_').toLowerCase(); // css file has casesensitive selector issue so can't toLowerCase
72
+ // let local = localName.toLowerCase()
73
+
74
+ if (canApplyHashClassName && canApplyHashClassName(resourcePath, cleanFileName)) {
75
+ const h = getHash(`${relativePath}-${localName}`, 10);
76
+ return `${classNamePrefix}${h}`;
77
+ }
78
+
79
+ return `${classNamePrefix}-${cleanFileName}-${localName}`;
80
+ };
81
+ };
82
+
83
+ exports.default = _default;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getCssLoaderOptions = getCssLoaderOptions;
7
+
8
+ var _cssClassNameGenerate = _interopRequireDefault(require("./cssClassNameGenerate"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ function getCssLoaderOptions(options) {
13
+ // const { classNameOptions } = options.css;
14
+ const cssLoaderOptions = {
15
+ importLoaders: 1,
16
+ modules: {
17
+ // localIdentName: classNameOptions.classNameBlob,
18
+ getLocalIdent: (0, _cssClassNameGenerate.default)(options)
19
+ },
20
+ sourceMap: true
21
+ };
22
+ return cssLoaderOptions;
23
+ }
@@ -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
+ }