@zohodesk/react-cli 1.1.29-exp.1 → 1.1.29-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 (221) hide show
  1. package/lib/babel/babel-option-utils/babel-preset-react-option.js +0 -3
  2. package/lib/babel/cmjs-plugins-presets.js +1 -8
  3. package/lib/babel/es-plugins-presets.js +1 -8
  4. package/lib/common/buildEs.js +1 -0
  5. package/lib/common/getEntries.js +2 -13
  6. package/lib/common/getPublicPathConfig.js +0 -6
  7. package/lib/common/index.js +1 -6
  8. package/lib/common/runPreProcess.js +6 -15
  9. package/lib/common/splitChunks.js +2 -21
  10. package/lib/common/sslcertUpdater.js +7 -18
  11. package/lib/common/templateParameters.js +0 -2
  12. package/lib/common/testPattern.js +10 -21
  13. package/lib/common/valueReplacer.js +1 -16
  14. package/lib/configs/jest.config.js +1 -10
  15. package/lib/configs/libAlias.js +8 -14
  16. package/lib/configs/resolvers.js +4 -14
  17. package/lib/configs/webpack.component.umd.config.js +1 -6
  18. package/lib/configs/webpack.css.umd.config.js +6 -14
  19. package/lib/configs/webpack.dev.config.js +1 -14
  20. package/lib/configs/webpack.docs.config.js +1 -9
  21. package/lib/configs/webpack.impact.config.js +1 -8
  22. package/lib/configs/webpack.prod.config.js +4 -17
  23. package/lib/constants.js +9 -18
  24. package/lib/deprecationLogger.js +0 -7
  25. package/lib/hooks/docsProptypeHook.js +4 -8
  26. package/lib/jest/commitedFilesResult.js +4 -46
  27. package/lib/jest/coverageCollector.js +1 -12
  28. package/lib/jest/jsonMaker.js +0 -6
  29. package/lib/jest/preProcessors/cssPreprocessor.js +1 -9
  30. package/lib/jest/preProcessors/jsPreprocessor.js +1 -6
  31. package/lib/jest/preProcessors/otherFilesPreprocessor.js +1 -4
  32. package/lib/jest/result.js +1 -23
  33. package/lib/jest/run.js +7 -18
  34. package/lib/jest/setup.js +8 -60
  35. package/lib/loaderUtils/configsAssetsLoaders.js +2 -12
  36. package/lib/loaderUtils/getCSSLoaders.js +10 -22
  37. package/lib/loaderUtils/getDevJsLoaders.js +4 -13
  38. package/lib/loaderUtils/index.js +1 -4
  39. package/lib/loaderUtils/tests/windowsModification.test.js +0 -1
  40. package/lib/loaderUtils/windowsModification.js +2 -3
  41. package/lib/loaders/__test__/markdownLoader.spec.js +0 -1
  42. package/lib/loaders/composeLoader.js +13 -37
  43. package/lib/loaders/docsLoader.js +1 -12
  44. package/lib/loaders/docsPropsLoader.js +4 -8
  45. package/lib/loaders/enhancedReactLiveConverter.js +2 -23
  46. package/lib/loaders/fileBountryLoader.js +1 -3
  47. package/lib/loaders/fileLoader.js +12 -23
  48. package/lib/loaders/markdownLoader.js +14 -19
  49. package/lib/loaders/reactLiveConvertor.js +5 -15
  50. package/lib/loaders/scriptInstrumentLoader.js +7 -16
  51. package/lib/loaders/selectorMappingLoader.js +7 -26
  52. package/lib/loaders/workerLoader.js +9 -24
  53. package/lib/logger.js +0 -4
  54. package/lib/middlewares/HMRMiddleware.js +13 -27
  55. package/lib/middlewares/SSTMiddleware.js +1 -5
  56. package/lib/pluginUtils/configHtmlWebpackPlugins.js +1 -24
  57. package/lib/pluginUtils/getDevPlugins.js +9 -42
  58. package/lib/pluginUtils/getDocsPlugins.js +3 -13
  59. package/lib/pluginUtils/getLibraryImactPlugins.js +5 -6
  60. package/lib/pluginUtils/getLibraryPlugins.js +2 -8
  61. package/lib/pluginUtils/getProdPlugins.js +8 -47
  62. package/lib/pluginUtils/getServerPlugins.js +2 -8
  63. package/lib/pluginUtils/getUMDCSSPlugins.js +2 -10
  64. package/lib/pluginUtils/getUMDComponentPlugins.js +2 -10
  65. package/lib/pluginUtils/index.js +1 -9
  66. package/lib/plugins/CdnChangePlugin.js +2 -18
  67. package/lib/plugins/CleanupStatsPlugin.js +0 -5
  68. package/lib/plugins/CssOrderControlPlugin.js +3 -6
  69. package/lib/plugins/CustomAttributePlugin.js +14 -19
  70. package/lib/plugins/CustomScriptLoadingStrategyPlugin.js +3 -23
  71. package/lib/plugins/EFCPlugin.js +20 -34
  72. package/lib/plugins/EFCTemplatePlugin.js +19 -30
  73. package/lib/plugins/EfcResourceCleanupPlugin.js +0 -3
  74. package/lib/plugins/EventsHandlingPlugin.js +2 -4
  75. package/lib/plugins/I18NInjectIntoIndexPlugin.js +11 -37
  76. package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +10 -15
  77. package/lib/plugins/I18nSplitPlugin/I18nDependency.js +4 -10
  78. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +12 -25
  79. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +55 -133
  80. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +12 -23
  81. package/lib/plugins/I18nSplitPlugin/index.js +13 -24
  82. package/lib/plugins/I18nSplitPlugin/utils/applyMetaManifest.js +64 -58
  83. package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +2 -12
  84. package/lib/plugins/I18nSplitPlugin/utils/createMetaManifest.js +10 -29
  85. package/lib/plugins/I18nSplitPlugin/utils/createRegularManifest.js +8 -19
  86. package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +0 -1
  87. package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +0 -5
  88. package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +1 -8
  89. package/lib/plugins/I18nSplitPlugin/utils/index.js +0 -4
  90. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +0 -20
  91. package/lib/plugins/I18nSplitPlugin/utils/unicodeConversion.js +0 -1
  92. package/lib/plugins/ManifestPlugin.js +1 -18
  93. package/lib/plugins/MinifyPlugin.js +1 -10
  94. package/lib/plugins/ModuleStatsPlugin.js +1 -24
  95. package/lib/plugins/OptimizeJSPlugin.js +2 -10
  96. package/lib/plugins/PublicPathCallbackPlugin.js +1 -12
  97. package/lib/plugins/PublicPathChangePlugin.js +6 -39
  98. package/lib/plugins/ReportGeneratePlugin.js +5 -32
  99. package/lib/plugins/RequireVariablePublicPlugin.js +1 -8
  100. package/lib/plugins/ResourceHintsPlugin.js +4 -13
  101. package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +12 -17
  102. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +10 -17
  103. package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +2 -5
  104. package/lib/plugins/ScriptInstrumentPlugin.js +1 -8
  105. package/lib/plugins/SelectorPlugin.js +6 -32
  106. package/lib/plugins/ServiceWorkerPlugin.js +5 -22
  107. package/lib/plugins/ShadowDOMSupportPlugin.js +4 -41
  108. package/lib/plugins/SourceMapHookPlugin.js +2 -12
  109. package/lib/plugins/StatsPlugin.js +0 -14
  110. package/lib/plugins/TPHashMappingPlugin.js +3 -18
  111. package/lib/plugins/UnusedFilesFindPlugin.js +4 -39
  112. package/lib/plugins/VariableConversionCollector.js +15 -42
  113. package/lib/plugins/index.js +1 -20
  114. package/lib/plugins/libraryImpactPlugin.js +1 -33
  115. package/lib/plugins/newi18nsplitplugin/18nPlugin1.js +306 -0
  116. package/lib/plugins/newi18nsplitplugin/18nPlugin2.js +363 -0
  117. package/lib/plugins/newi18nsplitplugin/18nPlugin3.js +694 -0
  118. package/lib/plugins/newi18nsplitplugin/18nPlugin_hashed.js +1258 -0
  119. package/lib/plugins/newi18nsplitplugin/18nPlugin_working.js +542 -0
  120. package/lib/plugins/newi18nsplitplugin/18nplugin.js +974 -0
  121. package/lib/plugins/newi18nsplitplugin/ChunkManager.js +131 -0
  122. package/lib/plugins/newi18nsplitplugin/GenerateModuleIdToKeysMapPlugin.js +59 -0
  123. package/lib/plugins/newi18nsplitplugin/I18nDiffPlugin.js +262 -0
  124. package/lib/plugins/newi18nsplitplugin/I18nDownloadLogic.js +166 -0
  125. package/lib/plugins/newi18nsplitplugin/I18nPropertiesPlugin.js +111 -0
  126. package/lib/plugins/newi18nsplitplugin/KeyCollector.js +163 -0
  127. package/lib/plugins/newi18nsplitplugin/ManifestGenerator.js +88 -0
  128. package/lib/plugins/newi18nsplitplugin/UnicodeConversionPlugin.js +101 -0
  129. package/lib/plugins/newi18nsplitplugin/constants.js +162 -0
  130. package/lib/plugins/newi18nsplitplugin/utils/I18nKeyHasher.js +78 -0
  131. package/lib/plugins/newi18nsplitplugin/utils/getJsResourceKeys.js +22 -0
  132. package/lib/plugins/newi18nsplitplugin/utils/i18nChunkUtils.js +18 -0
  133. package/lib/plugins/newi18nsplitplugin/utils/manifestGenerator.js +580 -0
  134. package/lib/plugins/newi18nsplitplugin/utils/propertiesUtils.js +54 -0
  135. package/lib/plugins/utils/classHandling.js +0 -6
  136. package/lib/plugins/utils/fileHandling.js +6 -15
  137. package/lib/plugins/utils/tests/fileHandling.test.js +0 -4
  138. package/lib/plugins/variableConvertorUtils.js +14 -29
  139. package/lib/plugins/webpackwatchrunplugin.js +0 -5
  140. package/lib/postcss-plugins/EmptyPlugin.js +3 -4
  141. package/lib/postcss-plugins/ExcludePlugin.js +1 -5
  142. package/lib/postcss-plugins/IncludePlugin.js +1 -5
  143. package/lib/postcss-plugins/RTLSplitPlugin.js +14 -27
  144. package/lib/postcss-plugins/SelectorReplace.js +1 -16
  145. package/lib/postcss-plugins/ValueReplacer.js +7 -6
  146. package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +0 -3
  147. package/lib/postcss-plugins/__test__/selectorReplace.test.js +6 -3
  148. package/lib/postcss-plugins/__test__/valueReplacer.spec.js +2 -5
  149. package/lib/postcss-plugins/hoverActivePlugin.js +31 -67
  150. package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +0 -7
  151. package/lib/postcss-plugins/variableModificationPlugin/index.js +28 -49
  152. package/lib/schemas/index.js +3 -9
  153. package/lib/servers/clusterHubServer.js +1 -11
  154. package/lib/servers/devBuild.js +14 -26
  155. package/lib/servers/docsServer.js +1 -3
  156. package/lib/servers/docsServerCore.js +1 -22
  157. package/lib/servers/getCliPath.js +0 -9
  158. package/lib/servers/helpServer.js +1 -6
  159. package/lib/servers/httpsOptions.js +2 -8
  160. package/lib/servers/impactServer.js +3 -35
  161. package/lib/servers/mockserver.js +1 -10
  162. package/lib/servers/nowatchserver.js +12 -37
  163. package/lib/servers/requireLocalOrGlobal.js +6 -17
  164. package/lib/servers/scrServer.js +14 -21
  165. package/lib/servers/server.js +6 -36
  166. package/lib/servers/ssServer.js +1 -17
  167. package/lib/templates/CoverageScriptTemplate.js +0 -14
  168. package/lib/templates/WMSTemplate.js +7 -13
  169. package/lib/templates/linterConstant.js +2 -4
  170. package/lib/utils/babelPresets.js +3 -7
  171. package/lib/utils/clean.js +3 -9
  172. package/lib/utils/copy.js +1 -7
  173. package/lib/utils/copyTimezones.js +1 -9
  174. package/lib/utils/createEventStream.js +1 -6
  175. package/lib/utils/cssClassNameGenerate.js +10 -30
  176. package/lib/utils/cssURLReplacer.js +1 -22
  177. package/lib/utils/dependencyPostPublish.js +1 -10
  178. package/lib/utils/deprecationSupport.js +7 -32
  179. package/lib/utils/fileUtils.js +1 -28
  180. package/lib/utils/folderIterator.js +2 -13
  181. package/lib/utils/getComponents.js +0 -21
  182. package/lib/utils/getCurrentBranch.js +0 -5
  183. package/lib/utils/getDependenciesImpactList.js +1 -22
  184. package/lib/utils/getFileType.js +2 -10
  185. package/lib/utils/getHash.js +1 -8
  186. package/lib/utils/getIp.js +0 -2
  187. package/lib/utils/getOptions.js +16 -53
  188. package/lib/utils/getServerURL.js +1 -10
  189. package/lib/utils/index.js +4 -51
  190. package/lib/utils/init.js +0 -1
  191. package/lib/utils/initPreCommitHook.js +7 -30
  192. package/lib/utils/jsonHelper.js +3 -22
  193. package/lib/utils/libraryImpactConfig.js +2 -5
  194. package/lib/utils/lint/addScripts.js +2 -5
  195. package/lib/utils/lint/checkExistingConfig.js +3 -12
  196. package/lib/utils/lint/copyConfigs.js +0 -3
  197. package/lib/utils/lint/index.js +0 -9
  198. package/lib/utils/lint/lintScripts.js +0 -1
  199. package/lib/utils/lint/lintSetup.js +3 -4
  200. package/lib/utils/lint/lintStagedPreCommitHook.js +0 -1
  201. package/lib/utils/lint/question.js +0 -7
  202. package/lib/utils/lintReporter.js +0 -20
  203. package/lib/utils/log.js +0 -1
  204. package/lib/utils/mailSender.js +1 -8
  205. package/lib/utils/object-manipulation.js +1 -17
  206. package/lib/utils/pullOrigin.js +0 -4
  207. package/lib/utils/reinstallDependencies.js +1 -29
  208. package/lib/utils/removeAttributes.js +1 -8
  209. package/lib/utils/repoClone.js +3 -28
  210. package/lib/utils/request.js +0 -12
  211. package/lib/utils/rtl.js +5 -17
  212. package/lib/utils/selectorReplacer.js +10 -16
  213. package/lib/utils/setEnvVariables.js +0 -2
  214. package/lib/utils/ssTestHack.js +1 -11
  215. package/lib/utils/switchBranch.js +0 -5
  216. package/lib/utils/typeCheck.js +0 -1
  217. package/lib/utils/urlConcat.js +0 -4
  218. package/lib/utils/useExitCleanup.js +9 -10
  219. package/lib/utils/variableConverter.js +22 -31
  220. package/{npm-shrinkwrap.json → package-lock.json} +2098 -1999
  221. package/package.json +1 -1
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createRegularManifest = createRegularManifest;
7
-
8
7
  var _webpackSources = require("webpack-sources");
9
-
10
8
  function createRegularManifest(compilation, plugin) {
11
9
  const {
12
10
  regularManifest,
@@ -15,44 +13,35 @@ function createRegularManifest(compilation, plugin) {
15
13
  // e.g., ['en_US', 'fr_FR', ...]
16
14
  i18nManifestFileName,
17
15
  // e.g., 'i18n-manifest.json'
18
- deskI18nManifestFileName = 'desk-i18n-manifest.js'
19
- } = plugin; // 1. Create the final manifest structure.
20
-
16
+ deskI18nManifestFileName = 'i18n-chunk/desk-i18n-manifest.js'
17
+ } = plugin;
21
18
  const finalManifest = {
22
19
  locales: [...locales],
23
20
  chunks: {},
24
21
  basePath: 'i18n-chunk/[locale]/'
25
22
  };
26
-
27
23
  for (const chunkId of Object.keys(regularManifest)) {
28
24
  const localePaths = regularManifest[chunkId];
29
25
  if (!localePaths) continue;
30
26
  const entries = Object.entries(localePaths);
31
27
  if (!entries.length) continue;
32
28
  const [someLocale, fullPath] = entries[0];
33
- if (!fullPath) continue; // Remove the first two segments from the full path to get the basename.
34
-
29
+ if (!fullPath) continue;
35
30
  const pathSegments = fullPath.split('/');
36
31
  const basename = pathSegments.slice(2).join('/');
37
32
  finalManifest.chunks[chunkId] = basename;
38
- } // Convert the manifest object to a prettified JSON string.
39
-
40
-
41
- const manifestStr = JSON.stringify(finalManifest, null, 2); // 2. Create the JSON asset (plain JSON, without any wrapping).
42
-
43
- const jsonManifestSource = new _webpackSources.RawSource(manifestStr); // 3. Create the manifest code for window.desk_i18n_manifest.
44
-
33
+ }
34
+ const manifestStr = JSON.stringify(finalManifest, null, 2);
35
+ const jsonManifestSource = new _webpackSources.RawSource(manifestStr);
45
36
  const deskI18nManifestCode = `
46
37
  (function() {
47
38
  window.desk_i18n_manifest = ${manifestStr};
48
39
  })();
49
40
  `;
50
- const deskI18nManifestSource = new _webpackSources.RawSource(deskI18nManifestCode); // 4. Emit the plain JSON manifest asset.
51
-
41
+ const deskI18nManifestSource = new _webpackSources.RawSource(deskI18nManifestCode);
52
42
  compilation.emitAsset(i18nManifestFileName, jsonManifestSource, {
53
43
  desc: 'Emitted plain JSON i18n manifest'
54
- }); // 5. Emit the desk i18n manifest asset.
55
-
44
+ });
56
45
  compilation.emitAsset(deskI18nManifestFileName, deskI18nManifestSource, {
57
46
  desc: 'Emitted manifest attached to window.desk_i18n_manifest'
58
47
  });
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getI18nFileUrlPathTemplate = getI18nFileUrlPathTemplate;
7
-
8
7
  function getI18nFileUrlPathTemplate(compilation, chunk, filenameTemplate, localeTemplate) {
9
8
  let urlpath = compilation.getPath(filenameTemplate, {
10
9
  chunk
@@ -4,23 +4,18 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = getI18nKeysFormModules;
7
-
8
7
  var _I18nDependency = require("../I18nDependency");
9
-
10
8
  function getI18nKeysFormModules(modules) {
11
9
  const i18nTemObj = {};
12
-
13
10
  for (let m of modules) {
14
11
  for (let dep of m.dependencies) {
15
12
  if (!(dep instanceof _I18nDependency.I18nDependency)) {
16
13
  continue;
17
14
  }
18
-
19
15
  for (const key of dep.i18nKeys) {
20
16
  i18nTemObj[key] = 1;
21
17
  }
22
18
  }
23
19
  }
24
-
25
20
  return Object.keys(i18nTemObj);
26
21
  }
@@ -6,32 +6,25 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.REGEXP_CONTENTHASH = void 0;
7
7
  exports.getShortI18nAssets = getShortI18nAssets;
8
8
  exports.hasContentHash = hasContentHash;
9
-
10
9
  var _urlConcat = require("../../../utils/urlConcat");
11
-
12
10
  // export const REGEXP_CHUNKHASH = /\[chunkhash(?::(\d+))?\]/gi;
13
11
  // export const REGEXP_HASH = /\[hash(?::(\d+))?\]/gi;
14
12
  // export const REGEXP_NAME = /\[name\]/gi;
15
13
  // export const REGEXP_PLACEHOLDERS = /\[(name|id|chunkhash)\]/gi;
16
14
  // TODO: want to choose file type for i18n load
17
- const REGEXP_CONTENTHASH = /\[contenthash(?::(\d+))?\]/gi;
18
- exports.REGEXP_CONTENTHASH = REGEXP_CONTENTHASH;
19
-
15
+ const REGEXP_CONTENTHASH = exports.REGEXP_CONTENTHASH = /\[contenthash(?::(\d+))?\]/gi;
20
16
  function hasContentHash(filenameTemplate) {
21
17
  return REGEXP_CONTENTHASH.test(filenameTemplate);
22
18
  }
23
-
24
19
  function getShortI18nAssets(chunks, i18nManifest, publicPathPrefix) {
25
20
  const i18nAssets = {};
26
21
  chunks.forEach(chunk => {
27
22
  const i18nFiles = i18nManifest[chunk.id];
28
-
29
23
  if (i18nFiles) {
30
24
  Object.keys(i18nFiles).forEach(locale => {
31
25
  if (!i18nAssets[locale]) {
32
26
  i18nAssets[locale] = [];
33
27
  }
34
-
35
28
  i18nAssets[locale].push((0, _urlConcat.urlConcat)(publicPathPrefix, i18nFiles[locale]));
36
29
  });
37
30
  }
@@ -3,9 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  var _collectI18nKeys = require("./collectI18nKeys");
8
-
9
7
  Object.keys(_collectI18nKeys).forEach(function (key) {
10
8
  if (key === "default" || key === "__esModule") return;
11
9
  if (key in exports && exports[key] === _collectI18nKeys[key]) return;
@@ -16,9 +14,7 @@ Object.keys(_collectI18nKeys).forEach(function (key) {
16
14
  }
17
15
  });
18
16
  });
19
-
20
17
  var _propertiesUtils = require("./propertiesUtils");
21
-
22
18
  Object.keys(_propertiesUtils).forEach(function (key) {
23
19
  if (key === "default" || key === "__esModule") return;
24
20
  if (key in exports && exports[key] === _propertiesUtils[key]) return;
@@ -6,19 +6,13 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getAllI18n = getAllI18n;
7
7
  exports.getPropertiesAsJSON = getPropertiesAsJSON;
8
8
  exports.jsonToString = jsonToString;
9
-
10
9
  var _fs = require("fs");
11
-
12
10
  var _path = require("path");
13
-
14
11
  var _logger = require("../../../logger");
15
-
16
12
  var _unicodeConversion = require("./unicodeConversion");
17
-
18
13
  function isComment(line) {
19
14
  return line[0] === '#';
20
15
  }
21
-
22
16
  function getPropertiesAsJSON(filePath) {
23
17
  try {
24
18
  const data = (0, _fs.readFileSync)(filePath);
@@ -26,16 +20,13 @@ function getPropertiesAsJSON(filePath) {
26
20
  const i18nObj = {};
27
21
  source.split(/\r?\n\r?/).forEach(fline => {
28
22
  const line = fline.trim();
29
-
30
23
  if (!line || isComment(line)) {
31
24
  return;
32
25
  }
33
-
34
26
  const ind = line.indexOf('=');
35
27
  const key = line.slice(0, ind).replace(/\\ /g, ' ');
36
28
  let value = line.slice(ind + 1);
37
29
  value = (0, _unicodeConversion.convertUnicode)(value);
38
-
39
30
  if (key && value) {
40
31
  i18nObj[key] = value;
41
32
  }
@@ -45,19 +36,15 @@ function getPropertiesAsJSON(filePath) {
45
36
  return {};
46
37
  }
47
38
  }
48
-
49
39
  function getLang(file) {
50
40
  const underScoreIndex = file.indexOf('_');
51
41
  let language = 'en_US';
52
-
53
42
  if (underScoreIndex !== -1) {
54
43
  language = file.substring(underScoreIndex + 1);
55
44
  language = language.slice(0, language.indexOf('.'));
56
45
  }
57
-
58
46
  return language;
59
47
  }
60
-
61
48
  function getAllI18n({
62
49
  folderPath,
63
50
  disableDefault,
@@ -71,11 +58,9 @@ function getAllI18n({
71
58
  const context = (0, _path.join)(process.cwd(), folderPath);
72
59
  files.forEach(file => {
73
60
  const filePath = (0, _path.join)(context, file);
74
-
75
61
  if (exclude.test(filePath) || !include.test(filePath)) {
76
62
  return;
77
63
  }
78
-
79
64
  const i18n = getPropertiesAsJSON(filePath);
80
65
  allLangI18n[getLang(file)] = disableDefault ? i18n : Object.assign({}, jsResourceI18nKeys, i18n);
81
66
  });
@@ -85,27 +70,22 @@ function getAllI18n({
85
70
  return {};
86
71
  }
87
72
  }
88
-
89
73
  function jsonToString(json, keySeperator) {
90
74
  let str = '{';
91
75
  const keys = Object.keys(json);
92
76
  keys.forEach((key, i) => {
93
77
  const value = json[key];
94
-
95
78
  if (!value) {
96
79
  return;
97
80
  }
98
-
99
81
  str += `"${keySeperator ? key.replace(/(\.|\\(\s+))/g, keySeperator) : key}":"${value.replace(/.?"/g, match => {
100
82
  if (match[0] === '\\') {
101
83
  return match;
102
84
  } else if (match.length === 2) {
103
85
  return `${match[0]}\\${match[1]}`;
104
86
  }
105
-
106
87
  return `\\${match}`;
107
88
  }).replace(/(\r\n|\n|\r)/g, '')}"`;
108
-
109
89
  if (i !== keys.length - 1) {
110
90
  str += ',';
111
91
  }
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.convertUnicode = convertUnicode;
7
-
8
7
  function convertUnicode(str) {
9
8
  const unicodeRegex = /\\u([a-fA-F0-9]{4})/g;
10
9
  const converted = str.replace(unicodeRegex, (match, hex) => {
@@ -4,42 +4,32 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _path = _interopRequireDefault(require("path"));
9
-
10
8
  var _webpackSources = require("webpack-sources");
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
10
  let filenameParser = filename => {
15
11
  let filepaths = filename.split('/');
16
12
  let hashedName = filepaths[filepaths.length - 1];
17
-
18
13
  let {
19
14
  name,
20
15
  ext
21
16
  } = _path.default.parse(hashedName);
22
-
23
17
  let nameparts = name.split('.');
24
-
25
18
  if (ext === '.css' && /^(rtl|ltr)$/.test(nameparts[nameparts.length - 1])) {
26
19
  return {
27
20
  name: nameparts.slice(0, nameparts.length - 2).join('.') + ext,
28
21
  hashedName
29
22
  };
30
23
  }
31
-
32
24
  return {
33
25
  name: nameparts.slice(0, nameparts.length - 1).join('.') + ext,
34
26
  hashedName
35
27
  };
36
28
  };
37
-
38
29
  class ManifestPlugin {
39
30
  constructor(options) {
40
31
  this.options = options;
41
32
  }
42
-
43
33
  apply(compiler) {
44
34
  compiler.hooks.emit.tap('PublicPathChangePlugin', compilation => {
45
35
  let stats = compilation.getStats().toJson();
@@ -48,25 +38,20 @@ class ManifestPlugin {
48
38
  name: filename,
49
39
  hashedName
50
40
  } = filenameParser(name);
51
-
52
41
  if (chunk.canBeInitial()) {
53
42
  if (!files.entryFiles) {
54
43
  files.entryFiles = {};
55
44
  }
56
-
57
45
  files.entryFiles[filename] = hashedName;
58
46
  }
59
-
60
47
  files[filename] = hashedName;
61
48
  return files;
62
49
  }, files), {});
63
50
  manifest = stats.assets.reduce((files, asset) => {
64
51
  let isEntryAsset = asset.chunks.length > 0;
65
-
66
52
  if (isEntryAsset) {
67
53
  return files;
68
54
  }
69
-
70
55
  let {
71
56
  name: filename
72
57
  } = asset;
@@ -80,7 +65,5 @@ class ManifestPlugin {
80
65
  compilation.assets[this.options.fileName] = new _webpackSources.RawSource(JSON.stringify(manifest));
81
66
  });
82
67
  }
83
-
84
68
  }
85
-
86
69
  exports.default = ManifestPlugin;
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _webpackSources = require("webpack-sources");
9
-
10
8
  var _uglifycss = _interopRequireDefault(require("uglifycss"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
10
  class MinifierPlugin {
15
11
  apply(compiler) {
16
12
  compiler.hooks.emit.tap('MinifierPlugin', compilation => {
@@ -18,13 +14,10 @@ class MinifierPlugin {
18
14
  if (/\.css$/.test(filename)) {
19
15
  try {
20
16
  let asset = compilation.assets[filename].source();
21
-
22
17
  if (typeof asset !== 'string') {
23
18
  asset = asset.toString();
24
19
  }
25
-
26
20
  const result = _uglifycss.default.processString(asset);
27
-
28
21
  compilation.assets[filename] = new _webpackSources.RawSource(result);
29
22
  } catch (e) {
30
23
  compilation.errors.push(e);
@@ -33,7 +26,5 @@ class MinifierPlugin {
33
26
  });
34
27
  });
35
28
  }
36
-
37
29
  }
38
-
39
30
  exports.default = MinifierPlugin;
@@ -4,39 +4,29 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _path = _interopRequireDefault(require("path"));
9
-
10
8
  var _webpackSources = require("webpack-sources");
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
10
  let isValidModule = name => {
15
11
  if (name.includes('node_modules') && (name.includes(`@zohodesk${_path.default.sep}components`) || name.includes(`@zohodesk${_path.default.sep}dot`) || name.includes(`@zohodesk${_path.default.sep}icons`) || name.includes(`@zohodesk${_path.default.sep}svg`)) && !name.endsWith('docs.js')) {
16
12
  return true;
17
13
  }
18
-
19
14
  return !name.includes('index.js') && !name.endsWith('.css') && !name.endsWith('.png') && !name.includes('node_modules') && name.includes('src');
20
15
  };
21
-
22
16
  let getModuleName = modulePath => {
23
17
  let [name] = _path.default.parse(modulePath).name.split('.');
24
-
25
18
  if (modulePath.includes(`@zohodesk${_path.default.sep}components`)) {
26
19
  name = `@zohodesk/components/${name}`;
27
20
  } else if (modulePath.includes(`@zohodesk${_path.default.sep}dot`)) {
28
21
  name = `@zohodesk/dot/${name}`;
29
22
  }
30
-
31
23
  return name;
32
24
  };
33
-
34
25
  class ModuleStatsPlugin {
35
26
  constructor(options = {}) {
36
27
  this.options = options;
37
28
  this.options.filename = options.filename || 'js/moduleStats.js';
38
29
  }
39
-
40
30
  apply(compiler) {
41
31
  compiler.hooks.emit.tap('ModuleStatsPlugin', compilation => {
42
32
  let stats = compilation.getStats().toJson();
@@ -44,13 +34,11 @@ class ModuleStatsPlugin {
44
34
  let {
45
35
  modules
46
36
  } = stats;
47
-
48
37
  for (let module of modules) {
49
38
  let {
50
39
  name,
51
40
  reasons
52
41
  } = module;
53
-
54
42
  if (isValidModule(name)) {
55
43
  let references = new Set();
56
44
  let referencedby = new Set();
@@ -59,7 +47,6 @@ class ModuleStatsPlugin {
59
47
  compilation.modules.forEach(module => {
60
48
  module.reasons.forEach(reason => {
61
49
  let exportedValue = reason.dependency;
62
-
63
50
  if (exportedValue.type === 'harmony export imported specifier') {
64
51
  if (exportedValue.module.userRequest.includes(name.replace('.', ''))) {
65
52
  docsName = exportedValue.name;
@@ -68,35 +55,29 @@ class ModuleStatsPlugin {
68
55
  });
69
56
  });
70
57
  let currentModuleName = name;
71
-
72
58
  if (Array.isArray(reasons)) {
73
59
  for (let reason of reasons) {
74
60
  let {
75
61
  moduleName
76
62
  } = reason;
77
-
78
63
  if (isValidModule(moduleName)) {
79
64
  let reasonedModuleName = moduleName;
80
65
  referencedby.add(reasonedModuleName);
81
66
  }
82
67
  }
83
68
  }
84
-
85
69
  for (let subModule of modules) {
86
70
  let {
87
71
  name: subModuleName,
88
72
  reasons
89
73
  } = subModule;
90
-
91
74
  if (isValidModule(subModuleName)) {
92
75
  let currentModuleName = subModuleName;
93
-
94
76
  if (Array.isArray(reasons)) {
95
77
  for (let reason of reasons) {
96
78
  let {
97
79
  moduleName: reasonedModuleName
98
80
  } = reason;
99
-
100
81
  if (name === reasonedModuleName) {
101
82
  references.add(currentModuleName);
102
83
  }
@@ -104,7 +85,6 @@ class ModuleStatsPlugin {
104
85
  }
105
86
  }
106
87
  }
107
-
108
88
  results[currentModuleName] = {
109
89
  name: currentModuleName,
110
90
  references: Array.from(references),
@@ -114,11 +94,8 @@ class ModuleStatsPlugin {
114
94
  };
115
95
  }
116
96
  }
117
-
118
97
  compilation.assets[this.options.filename] = new _webpackSources.RawSource(JSON.stringify(results));
119
98
  });
120
99
  }
121
-
122
100
  }
123
-
124
101
  exports.default = ModuleStatsPlugin;
@@ -4,18 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _optimizeJs = _interopRequireDefault(require("optimize-js"));
9
-
10
8
  var _webpackSources = require("webpack-sources");
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
10
  class OptimizeJSPlugin {
15
11
  constructor(options = {}) {
16
12
  this.optimize = options.optimize;
17
13
  }
18
-
19
14
  apply(compiler) {
20
15
  compiler.hooks.compilation.tap('OptimizeJSPlugin', compilation => {
21
16
  compilation.hooks.afterOptimizeChunks.tap('OptimizeJSPlugin', chunks => {
@@ -34,8 +29,5 @@ class OptimizeJSPlugin {
34
29
  });
35
30
  });
36
31
  }
37
-
38
32
  }
39
-
40
- var _default = OptimizeJSPlugin;
41
- exports.default = _default;
33
+ var _default = exports.default = OptimizeJSPlugin;
@@ -5,17 +5,14 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  const MODULE_TYPE = 'css/mini-extract';
8
-
9
8
  class PublicPathCallbackPlugin {
10
9
  constructor({
11
10
  callback
12
11
  }) {
13
12
  this.publicPathCallback = callback;
14
13
  }
15
-
16
14
  getCssChunkObject(mainChunk) {
17
15
  const obj = {};
18
-
19
16
  for (const chunk of mainChunk.getAllAsyncChunks()) {
20
17
  for (const module of chunk.modulesIterable) {
21
18
  if (module.type === MODULE_TYPE) {
@@ -24,25 +21,20 @@ class PublicPathCallbackPlugin {
24
21
  }
25
22
  }
26
23
  }
27
-
28
24
  return obj;
29
25
  }
30
-
31
26
  needChunkOnDemandLoadingCode(chunk) {
32
27
  for (const chunkGroup of chunk.groupsIterable) {
33
28
  if (chunkGroup.getNumberOfChildren() > 0) {
34
29
  return true;
35
30
  }
36
31
  }
37
-
38
32
  return false;
39
33
  }
40
-
41
34
  apply(compiler) {
42
35
  compiler.hooks.thisCompilation.tap('PublicPathCallbackPlugin', compilation => {
43
36
  compilation.mainTemplate.hooks.requireEnsure.tap('PublicPathCallbackPlugin', (source, chunk) => {
44
37
  const chunkMap = this.getCssChunkObject(chunk);
45
-
46
38
  if (Object.keys(chunkMap).length > 0) {
47
39
  return source.replace('__webpack_require__.p', `${this.publicPathCallback}("css")`);
48
40
  }
@@ -56,8 +48,5 @@ class PublicPathCallbackPlugin {
56
48
  });
57
49
  });
58
50
  }
59
-
60
51
  }
61
-
62
- var _default = PublicPathCallbackPlugin;
63
- exports.default = _default;
52
+ var _default = exports.default = PublicPathCallbackPlugin;