@zohodesk/client_build_tool 0.0.6-exp.9 → 0.0.7

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 (85) hide show
  1. package/lib/schemas/defaultConfigValues.js +23 -2
  2. package/lib/schemas/readOptions.js +33 -0
  3. package/lib/shared/babel/babelWebConfig.js +4 -1
  4. package/lib/shared/babel/runBabelForTsFile.js +30 -0
  5. package/lib/shared/bundler/webpack/common/decidePublicPath.js +5 -0
  6. package/lib/shared/bundler/webpack/common/nameTemplates.js +13 -9
  7. package/lib/shared/bundler/webpack/custom_plugins/CdnChangePlugin/index.js +12 -4
  8. package/lib/shared/bundler/webpack/custom_plugins/CdnChangePlugin/webpackCustomJsUrlLoader.js +19 -238
  9. package/lib/shared/bundler/webpack/custom_plugins/CustomScriptLoadingPlugin.js +109 -0
  10. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nLoadingRuntimeModule.js +1 -1
  11. package/lib/shared/bundler/webpack/custom_plugins/InitialHtmlPlugin.js +4 -0
  12. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/addFilesNamesToManifestJson.js +8 -2
  13. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/createInitialEntries.js +7 -1
  14. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/createManifestJson.js +1 -1
  15. package/lib/shared/bundler/webpack/custom_plugins/ResourceHintsPlugin.js +1 -0
  16. package/lib/shared/bundler/webpack/custom_plugins/ServiceWorkerPlugin.js +5 -1
  17. package/lib/shared/bundler/webpack/custom_plugins/ServiceWorkerPluginUtils.js +13 -0
  18. package/lib/shared/bundler/webpack/custom_plugins/SourceMapPlugin/index.js +20 -2
  19. package/lib/shared/bundler/webpack/custom_plugins/TPHashMappingPlugin/index.js +1 -1
  20. package/lib/shared/bundler/webpack/custom_plugins/getInitialAssetsFuncTemplate.js +4 -4
  21. package/lib/shared/bundler/webpack/devtoolConfig.js +4 -1
  22. package/lib/shared/bundler/webpack/loaderConfigs/configsAssetsLoaders.js +1 -1
  23. package/lib/shared/bundler/webpack/loaderConfigs/cssClassNameGenerate.js +6 -1
  24. package/lib/shared/bundler/webpack/optimizationConfig.js +15 -2
  25. package/lib/shared/bundler/webpack/pluginConfigs/configCSSMinifierPlugin.js +5 -1
  26. package/lib/shared/bundler/webpack/pluginConfigs/configCustomScriptLoadingStrategyPlugin.js +76 -0
  27. package/lib/shared/bundler/webpack/pluginConfigs/configI18nSplitPlugin.js +1 -1
  28. package/lib/shared/bundler/webpack/pluginConfigs/configManifestJsonPlugin.js +25 -13
  29. package/lib/shared/bundler/webpack/pluginConfigs/configMiniCSSExtractPlugin.js +2 -1
  30. package/lib/shared/bundler/webpack/plugins.js +3 -1
  31. package/lib/shared/bundler/webpack/resolvers.js +2 -1
  32. package/lib/shared/bundler/webpack/tsLoaders.js +17 -0
  33. package/lib/shared/bundler/webpack/utils/index.js +6 -1
  34. package/lib/shared/bundler/webpack/webpackConfig.js +3 -1
  35. package/lib/shared/fileUtils/watchRun.js +13 -1
  36. package/lib/shared/postcss/custom_postcss_plugins/ValueReplacer.js +1 -1
  37. package/lib/shared/postcss/custom_postcss_plugins/VariableModificationPlugin/index.js +4 -0
  38. package/lib/shared/server/getServerURL.js +9 -2
  39. package/npm-shrinkwrap.json +412 -7328
  40. package/package.json +5 -2
  41. package/coverage/addFilesNamesToManifestJson.js.html +0 -148
  42. package/coverage/base.css +0 -224
  43. package/coverage/block-navigation.js +0 -87
  44. package/coverage/bundler/webpack/custom_plugins/AddManifestJson/addFilesNamesToManifestJson.js.html +0 -148
  45. package/coverage/bundler/webpack/custom_plugins/AddManifestJson/createInitialEntries.js.html +0 -136
  46. package/coverage/bundler/webpack/custom_plugins/AddManifestJson/createManifestJson.js.html +0 -181
  47. package/coverage/bundler/webpack/custom_plugins/AddManifestJson/findInitialFileNames.js.html +0 -133
  48. package/coverage/bundler/webpack/custom_plugins/AddManifestJson/index.html +0 -146
  49. package/coverage/bundler/webpack/custom_plugins/AddManifestJson/index.js.html +0 -199
  50. package/coverage/bundler/webpack/custom_plugins/AddManifestJson/removeHashFromFileName.js.html +0 -127
  51. package/coverage/bundler/webpack/custom_plugins/VariableConversionCollector/ErrorHandler.js.html +0 -346
  52. package/coverage/bundler/webpack/custom_plugins/VariableConversionCollector/index.html +0 -116
  53. package/coverage/bundler/webpack/custom_postcss_plugins/HoverActivePlugin/constants.js.html +0 -94
  54. package/coverage/bundler/webpack/custom_postcss_plugins/HoverActivePlugin/handleIgnores.js.html +0 -259
  55. package/coverage/bundler/webpack/custom_postcss_plugins/HoverActivePlugin/index.html +0 -236
  56. package/coverage/bundler/webpack/custom_postcss_plugins/HoverActivePlugin/index.js.html +0 -442
  57. package/coverage/bundler/webpack/custom_postcss_plugins/HoverActivePlugin/insertBefore.js.html +0 -154
  58. package/coverage/bundler/webpack/custom_postcss_plugins/HoverActivePlugin/isPreviouslyProcessed.js.html +0 -142
  59. package/coverage/bundler/webpack/custom_postcss_plugins/HoverActivePlugin/replaceUtils.js.html +0 -127
  60. package/coverage/bundler/webpack/custom_postcss_plugins/HoverActivePlugin/separateHoveredSelectorAndNormalSelector.js.html +0 -139
  61. package/coverage/bundler/webpack/custom_postcss_plugins/HoverActivePlugin/specialCases.js.html +0 -184
  62. package/coverage/bundler/webpack/custom_postcss_plugins/HoverActivePlugin/typeCheckUtils.js.html +0 -193
  63. package/coverage/bundler/webpack/custom_postcss_plugins/SelectorReplace.js.html +0 -292
  64. package/coverage/bundler/webpack/custom_postcss_plugins/ValueReplacer.js.html +0 -223
  65. package/coverage/bundler/webpack/custom_postcss_plugins/VariableModificationPlugin/index.html +0 -116
  66. package/coverage/bundler/webpack/custom_postcss_plugins/VariableModificationPlugin/index.js.html +0 -1126
  67. package/coverage/bundler/webpack/custom_postcss_plugins/index.html +0 -131
  68. package/coverage/bundler/webpack/loaderConfigs/getSpecificPostCssPlugin.js.html +0 -247
  69. package/coverage/bundler/webpack/loaderConfigs/index.html +0 -116
  70. package/coverage/coverage-final.json +0 -4
  71. package/coverage/coverage-summary.json +0 -5
  72. package/coverage/createInitialEntries.js.html +0 -136
  73. package/coverage/dummy.js.html +0 -238
  74. package/coverage/favicon.png +0 -0
  75. package/coverage/index.html +0 -146
  76. package/coverage/index.js.html +0 -169
  77. package/coverage/isObject.js.html +0 -94
  78. package/coverage/isValid.js.html +0 -106
  79. package/coverage/prettify.css +0 -1
  80. package/coverage/prettify.js +0 -2
  81. package/coverage/removeHashFromFileName.js.html +0 -127
  82. package/coverage/sort-arrow-sprite.png +0 -0
  83. package/coverage/sorter.js +0 -196
  84. package/result.json +0 -1
  85. package/unittest/index.html +0 -35
@@ -5,8 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.addFilesNamesToManifestJson = addFilesNamesToManifestJson;
7
7
 
8
+ var _path = _interopRequireDefault(require("path"));
9
+
8
10
  var _removeHashFromFileName = require("./removeHashFromFileName");
9
11
 
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
10
14
  function addFilesNamesToManifestJson({
11
15
  manifestJson,
12
16
  option,
@@ -15,9 +19,11 @@ function addFilesNamesToManifestJson({
15
19
  }) {
16
20
  const json = manifestJson;
17
21
  Object.keys(assets).forEach(filename => {
22
+ const fileName = _path.default.parse(filename).base;
23
+
18
24
  if (option.test(filename)) {
19
- const filenameNameWithoutHash = (0, _removeHashFromFileName.removeHashFromFileName)(filename, hashDigestLength);
20
- json[filenameNameWithoutHash] = filename;
25
+ const filenameNameWithoutHash = (0, _removeHashFromFileName.removeHashFromFileName)(fileName, hashDigestLength);
26
+ json[filenameNameWithoutHash] = fileName;
21
27
  }
22
28
  });
23
29
  return json;
@@ -5,11 +5,17 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.createInitialEntriesForManifestJson = createInitialEntriesForManifestJson;
7
7
 
8
+ var _path = _interopRequireDefault(require("path"));
9
+
8
10
  var _removeHashFromFileName = require("./removeHashFromFileName");
9
11
 
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
10
14
  function createInitialEntriesForManifestJson(initialFileNames, hashLength) {
11
15
  const initialEntries = {};
12
- initialFileNames.forEach(fileName => {
16
+ initialFileNames.forEach(filename => {
17
+ const fileName = _path.default.parse(filename).base;
18
+
13
19
  const filenameNameWithoutHash = (0, _removeHashFromFileName.removeHashFromFileName)(fileName, hashLength);
14
20
  initialEntries[filenameNameWithoutHash] = fileName;
15
21
  });
@@ -22,7 +22,7 @@ function createManifestJson({
22
22
  if (option.needInitialEntries) {
23
23
  const initialFileNames = (0, _findInitialFileNames.findInitialFileNames)(compilation);
24
24
  const initialEntries = (0, _createInitialEntries.createInitialEntriesForManifestJson)(initialFileNames, hashDigestLength);
25
- manifestJson.initialEntries = initialEntries;
25
+ manifestJson.entryFiles = initialEntries;
26
26
  }
27
27
 
28
28
  const outputJson = (0, _addFilesNamesToManifestJson.addFilesNamesToManifestJson)({
@@ -117,6 +117,7 @@ class ResourceHintsRuntimePlugin extends _webpack.RuntimeModule {
117
117
  let link = document.createElement("link");
118
118
  link.href = href;
119
119
  link.rel = rel;
120
+ __webpack_require__.nc && link.setAttribute("nonce", __webpack_require__.nc)
120
121
  if(href.endsWith(".css")) {
121
122
  link.as="style";
122
123
  } else if (href.endsWith(".js")) {
@@ -15,6 +15,8 @@ var _replaceCssDirTemplate = require("./RtlSplitPlugin/replaceCssDirTemplate");
15
15
 
16
16
  var _getInitialAssetsFuncTemplate = require("./getInitialAssetsFuncTemplate");
17
17
 
18
+ var _ServiceWorkerPluginUtils = require("./ServiceWorkerPluginUtils");
19
+
18
20
  const pluginName = 'ServiceWorkerPlugin';
19
21
 
20
22
  class ServiceWorkerPlugin {
@@ -83,8 +85,10 @@ class ServiceWorkerPlugin {
83
85
 
84
86
  [...compilation.chunks].filter(c => !this.isInitialChunk(c)).forEach(chunk => {
85
87
  allChunkUrls = [...allChunkUrls, ...chunk.files];
88
+ allI18nAssets.push((0, _ServiceWorkerPluginUtils.getI18nFileUrlPathTemplate)(compilation, chunk, this.i18nFileNameTemplate, '@locale@'));
86
89
  });
87
90
  allChunkUrls = allChunkUrls.filter(fileName => !fileName.endsWith('.map'));
91
+ allChunkUrls = allChunkUrls.map(fileName => fileName.replace('smap/', ''));
88
92
 
89
93
  if (enableRTLSplit) {
90
94
  allChunkUrls = (0, _replaceCssDirTemplate.replaceCssDirTemplateMapper)(allChunkUrls, _getInitialAssetsFuncTemplate.cssDirTemplate);
@@ -93,7 +97,7 @@ class ServiceWorkerPlugin {
93
97
  const mod = templateContent.replace(this.replaceText, `
94
98
  ${initialAssetsFuncTemplate}
95
99
 
96
- let initialAssetsObj = getInitialAssets({ lang: langLocale, dir: cssDir });
100
+ let initialAssetsObj = getInitialAssets();
97
101
 
98
102
  let initialAssets = initialAssetsObj.i18n.concat(
99
103
  initialAssetsObj.css,
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getI18nFileUrlPathTemplate = getI18nFileUrlPathTemplate;
7
+
8
+ function getI18nFileUrlPathTemplate(compilation, chunk, filenameTemplate, localeTemplate) {
9
+ const urlpath = compilation.getPath(filenameTemplate, {
10
+ chunk
11
+ });
12
+ return urlpath.replace('[locale]', localeTemplate);
13
+ }
@@ -13,7 +13,7 @@ function checkSmapFilePattern(assetName) {
13
13
  }
14
14
 
15
15
  function skipRuntimeFiles(assetName) {
16
- return !assetName.includes('runtime') || !assetName.includes('[locale]');
16
+ return !assetName.includes('[locale]');
17
17
  }
18
18
 
19
19
  const pluginName = 'SplitSourceMapPlugin'; // Purpose:
@@ -44,7 +44,25 @@ class SourceMapPlugin {
44
44
  }
45
45
  }
46
46
  });
47
- });
47
+ }); // if contenthash enabled we need to add this to include the runtime files
48
+ // compilation.hooks.processAssets.tap(
49
+ // {
50
+ // name: pluginName,
51
+ // stage: Compilation.PROCESS_ASSETS_STAGE_DERIVED
52
+ // // additionalAssets: true
53
+ // },
54
+ // assets => {
55
+ // Object.keys(assets).forEach(assetName => {
56
+ // if (assetName.includes('runtime') && skipRuntimeFiles(assetName) ) {
57
+ // const runtimeAssetCode = assets[assetName].source();
58
+ // const newAssetName = `smap/${assetName}`;
59
+ // compilation.emitAsset(
60
+ // newAssetName,
61
+ // new RawSource(runtimeAssetCode)
62
+ // );
63
+ // };
64
+ // });
65
+ // });
48
66
  });
49
67
  }
50
68
 
@@ -29,7 +29,7 @@ class TPHashMappingPlugin {
29
29
 
30
30
  getFiles() {
31
31
  const hashMapping = {};
32
- this.fileMappings.filter(f => f.enable).forEach(fileInfo => {
32
+ this.fileMappings.forEach(fileInfo => {
33
33
  const filePath = _path.default.join(this.tpFolder, fileInfo.filePath);
34
34
 
35
35
  if (_fs.default.existsSync(filePath)) {
@@ -46,11 +46,11 @@ function getInitialAssetsFuncTemplate({
46
46
  chunkSplitEnable,
47
47
  i18nFileNameTemplate
48
48
  });
49
- const initialAssetsFuncTemplate = `function ${functionName}({ lang, dir}) {
49
+ const initialAssetsFuncTemplate = `function ${functionName}() {
50
50
  return {
51
- js: ${JSON.stringify(initialJsFiles)}.map(urlPath => urlPath.replace(/@locale@/g, lang)),
52
- css: ${JSON.stringify(initialCssFiles)}${enableRTLSplit ? '.map(urlPath => urlPath.replace(/@dir@/g, dir))' : ''},
53
- i18n: ${initialI18nAssets},
51
+ js: ${JSON.stringify(initialJsFiles)}.map(urlPath => urlPath.replace('smap/', '')),
52
+ css: ${JSON.stringify(initialCssFiles)},
53
+ i18n: ${initialI18nAssets}
54
54
  }
55
55
  }`;
56
56
  return initialAssetsFuncTemplate;
@@ -5,6 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.devtoolConfig = devtoolConfig;
7
7
 
8
+ // eslint-disable-next-line consistent-return
8
9
  function devtoolConfig(options) {
9
- return options.devtool;
10
+ if (options.createSeparateSMap) {
11
+ return options.devtool;
12
+ }
10
13
  }
@@ -14,7 +14,7 @@ var _nameTemplates = require("../common/nameTemplates");
14
14
  const ImageExtRegex = /\.jpe?g$|\.gif$|\.png|\.webp$/;
15
15
  const FontExtRegex = /\.woff2|\.woff$|\.ttf$|\.eot$/;
16
16
  const SVGExtRegex = /\.svg$/;
17
- const AudioExtRegex = /\.ogg$/;
17
+ const AudioExtRegex = /\.ogg|\.mp3$/;
18
18
  const VideoExtRegex = /\.mp4|\.webm$/;
19
19
 
20
20
  function createAssetLoader({
@@ -51,7 +51,12 @@ var _default = options => {
51
51
 
52
52
  const fileNameWithoutExt = _path.default.parse(relativePath).name;
53
53
 
54
- const cleanFileName = fileNameWithoutExt.replace(/-/g, '_').toLowerCase();
54
+ let cleanFileName = fileNameWithoutExt.replace(/-/g, '_').toLowerCase();
55
+
56
+ if (cleanFileName.endsWith('.module')) {
57
+ cleanFileName = cleanFileName.slice(0, -7);
58
+ }
59
+
55
60
  const suitableBlob = getSuitableBlob(customizations, resourcePath);
56
61
  return suitableBlob.replaceAll('[local]', localName).replaceAll('[prefix]', classNamePrefix).replaceAll('[filename]', cleanFileName).replaceAll('[hash]', getHash(`${relativePath}-${localName}`, 10));
57
62
  };
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.optimizationConfig = optimizationConfig;
7
7
 
8
+ var _terserWebpackPlugin = _interopRequireDefault(require("terser-webpack-plugin"));
9
+
8
10
  var _nameTemplates = require("./common/nameTemplates");
9
11
 
10
12
  var _hashUtils = require("./custom_plugins/I18nSplitPlugin/utils/hashUtils");
@@ -13,6 +15,8 @@ var _configCSSMinifierPlugin = require("./pluginConfigs/configCSSMinifierPlugin"
13
15
 
14
16
  var _splitChunksConfig = require("./splitChunksConfig");
15
17
 
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
16
20
  function optimizationConfig(options) {
17
21
  const {
18
22
  changeRuntimeChunkChar
@@ -20,7 +24,7 @@ function optimizationConfig(options) {
20
24
  const {
21
25
  chunkSplitEnable
22
26
  } = options.i18nChunkSplit;
23
- const i18nChunkFilename = (0, _nameTemplates.nameTemplates)('i18nchunkjs', options);
27
+ const i18nChunkFilename = (0, _nameTemplates.nameTemplates)('i18njs', options);
24
28
  const chunkFilenameHasContentHash = (0, _hashUtils.hasContentHash)(i18nChunkFilename);
25
29
  /**
26
30
  * NOTE: we only need multiple runtime files when we use contentHash
@@ -31,10 +35,19 @@ function optimizationConfig(options) {
31
35
  const suffix = // chunkSplitEnable ? '_[locale]' : '';
32
36
  chunkSplitEnable && chunkFilenameHasContentHash ? '_[locale]' : '';
33
37
  const char = changeRuntimeChunkChar;
38
+ const excludeList = options.optimization.jsExcludePath;
34
39
  return {
35
40
  splitChunks: (0, _splitChunksConfig.splitChunksConfig)(options),
36
41
  minimizer: [// For webpack@5 you can use the `...` syntax to extend existing minimizers (i.e. `terser-webpack-plugin`), uncomment the next line
37
- '...', (0, _configCSSMinifierPlugin.configCSSMinifierPlugin)(options)].filter(Boolean),
42
+ // '...',
43
+ excludeList !== '' ? new _terserWebpackPlugin.default({
44
+ exclude: excludeList,
45
+ extractComments: false // Do not extract comments to .LICENSE.txt files
46
+
47
+ }) : new _terserWebpackPlugin.default({
48
+ extractComments: false // Do not extract comments to .LICENSE.txt files
49
+
50
+ }), (0, _configCSSMinifierPlugin.configCSSMinifierPlugin)(options)].filter(Boolean),
38
51
  moduleIds: 'named',
39
52
  runtimeChunk: {
40
53
  name: entrypoint => `runtime${char}${entrypoint.name}${suffix}`
@@ -14,11 +14,15 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
14
14
  // import UglifyCSSPlugin from '../custom_plugins/UglifyCSSPlugin';
15
15
  // eslint-disable-next-line no-unused-vars
16
16
  function configCSSMinifierPlugin(options) {
17
+ const excludeList = options.optimization.cssExcludePath;
18
+
17
19
  if ((0, _modeUtils.isNotProduction)(options)) {
18
20
  return null;
19
21
  } // return null;
20
22
  // return new UglifyCSSPlugin();
21
23
 
22
24
 
23
- return new _cssMinimizerWebpackPlugin.default();
25
+ return excludeList !== '' ? new _cssMinimizerWebpackPlugin.default({
26
+ exclude: excludeList
27
+ }) : new _cssMinimizerWebpackPlugin.default();
24
28
  }
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.configCustomScriptLoadingStrategyPlugin = configCustomScriptLoadingStrategyPlugin;
7
+
8
+ var _CustomScriptLoadingPlugin = require("../custom_plugins/CustomScriptLoadingPlugin");
9
+
10
+ var _utils = require("../utils");
11
+
12
+ const defaultScriptLoadingStrategy = 'defer';
13
+ const allowedScriptLoadingStrategies = ['blocking', 'defer', 'async', 'module'];
14
+
15
+ function isAllowedScriptLoadingStrategyUsed(scriptLoadingStategey) {
16
+ return allowedScriptLoadingStrategies.includes(scriptLoadingStategey);
17
+ }
18
+
19
+ function getScriptLoadingStrategyForStringType(scriptLoadingStategey) {
20
+ if (isAllowedScriptLoadingStrategyUsed(scriptLoadingStategey)) {
21
+ return scriptLoadingStategey;
22
+ }
23
+
24
+ return defaultScriptLoadingStrategy;
25
+ }
26
+
27
+ function getScriptLoadingStrategyForObject(scriptLoadingStategey) {
28
+ if (Object.keys(scriptLoadingStategey).length === 0) {
29
+ return defaultScriptLoadingStrategy;
30
+ }
31
+
32
+ const isAllowedScriptLoadingStrategy = Object.keys(scriptLoadingStategey).every(key => isAllowedScriptLoadingStrategyUsed(key));
33
+
34
+ if (isAllowedScriptLoadingStrategy) {
35
+ return Object.assign({}, scriptLoadingStategey);
36
+ }
37
+
38
+ console.warn('un supported script loading strategy used', scriptLoadingStategey);
39
+ return defaultScriptLoadingStrategy;
40
+ }
41
+
42
+ function getScriptLoadingStrategy(scriptLoadingStategey) {
43
+ if ((0, _utils.getTypeOf)(scriptLoadingStategey) === 'string') {
44
+ return {
45
+ [getScriptLoadingStrategyForStringType(scriptLoadingStategey)]: [/.*/]
46
+ };
47
+ }
48
+
49
+ if ((0, _utils.getTypeOf)(scriptLoadingStategey) === 'object') {
50
+ return getScriptLoadingStrategyForObject(scriptLoadingStategey);
51
+ }
52
+
53
+ return {
54
+ [defaultScriptLoadingStrategy]: [/.*/]
55
+ };
56
+ }
57
+
58
+ function configCustomScriptLoadingStrategyPlugin(options) {
59
+ const {
60
+ customScriptLoadingStrategey
61
+ } = options;
62
+
63
+ if (customScriptLoadingStrategey) {
64
+ const currentScriptLoadingStrategy = getScriptLoadingStrategy(customScriptLoadingStrategey.options);
65
+
66
+ if ((0, _utils.getTypeOf)(currentScriptLoadingStrategy) === 'object') {
67
+ return new _CustomScriptLoadingPlugin.CustomScriptLoadingStrategyPlugin({
68
+ scriptLoadingStategey: currentScriptLoadingStrategy
69
+ });
70
+ } else {
71
+ return null;
72
+ }
73
+ } else {
74
+ return null;
75
+ }
76
+ }
@@ -32,7 +32,7 @@ function configI18nSplitPlugin(options) {
32
32
  templateLabel: i18nChunkSplit.templateLabel,
33
33
  disableDefault: i18nChunkSplit.disableDefault,
34
34
  filename: (0, _nameTemplates.nameTemplates)('i18njs', options),
35
- chunkFilename: (0, _nameTemplates.nameTemplates)('i18nchunkjs', options),
35
+ chunkFilename: (0, _nameTemplates.nameTemplates)('i18njs', options),
36
36
  publicPath: i18nPublicPath,
37
37
  i18nManifestFileName: (0, _nameTemplates.nameTemplates)('i18nmanifest', options),
38
38
  // template: (object, locale) => `window.loadI18n(${JSON.stringify(object)}, ${JSON.stringify(locale)})`,
@@ -9,24 +9,36 @@ var _ManifestJsonPlugin = require("../custom_plugins/ManifestJsonPlugin");
9
9
 
10
10
  function configManifestJsonPlugin(options) {
11
11
  const {
12
- manifestJson
13
- } = options;
12
+ enable,
13
+ i18nManifestJson,
14
+ licenseManifest
15
+ } = options.manifestJson;
14
16
 
15
- if (!manifestJson.enable) {
17
+ if (!enable) {
16
18
  return null;
17
19
  }
18
20
 
19
- return new _ManifestJsonPlugin.AddFileToManifestJson([{
21
+ const params = [{
20
22
  outputJsonFileName: 'manifest.json',
21
23
  test: f => !/\.i18n\.js$|\.LICENSE\.txt$|\.map$/.test(f),
22
24
  needInitialEntries: true
23
- }, {
24
- outputJsonFileName: 'i18nManifest.json',
25
- test: f => /\.i18n\.js$/g.test(f),
26
- needInitialEntries: false
27
- }, {
28
- outputJsonFileName: 'licenseManifest.json',
29
- test: f => /\.LICENSE\.txt$/g.test(f),
30
- needInitialEntries: false
31
- }]);
25
+ }];
26
+
27
+ if (i18nManifestJson) {
28
+ params.push({
29
+ outputJsonFileName: 'i18nManifest.json',
30
+ test: f => /\.i18n\.js$/g.test(f),
31
+ needInitialEntries: false
32
+ });
33
+ }
34
+
35
+ if (licenseManifest) {
36
+ params.push({
37
+ outputJsonFileName: 'licenseManifest.json',
38
+ test: f => /\.LICENSE\.txt$/g.test(f),
39
+ needInitialEntries: false
40
+ });
41
+ }
42
+
43
+ return new _ManifestJsonPlugin.AddFileToManifestJson(params);
32
44
  }
@@ -15,7 +15,8 @@ function configMiniCSSExtractPlugin(options) {
15
15
  const {
16
16
  enableRTLSplit
17
17
  } = options.css.plugins.rtlSplit;
18
- const cssLTRFileNameTempalte = enableRTLSplit ? (0, _nameTemplates.nameTemplates)('cssdir', options) : (0, _nameTemplates.nameTemplates)('css', options);
18
+ const cssLTRFileNameTempalte = enableRTLSplit ? (0, _nameTemplates.nameTemplates)('cssdir', options) : (0, _nameTemplates.nameTemplates)('css', options); // eslint-disable-next-line no-undef
19
+
19
20
  return new _miniCssExtractPlugin.default({
20
21
  filename: cssLTRFileNameTempalte,
21
22
  chunkFilename: cssLTRFileNameTempalte
@@ -47,10 +47,12 @@ var _configBundleIntegrityReport = require("./pluginConfigs/configBundleIntegrit
47
47
 
48
48
  var _configRuntimeResourceCleanup = require("./pluginConfigs/configRuntimeResourceCleanup");
49
49
 
50
+ var _configCustomScriptLoadingStrategyPlugin = require("./pluginConfigs/configCustomScriptLoadingStrategyPlugin");
51
+
50
52
  // import { IgnorePlugin } from 'webpack';
51
53
  function plugins(options) {
52
54
  const {
53
55
  webpackPlugins
54
56
  } = options;
55
- return [(0, _configEnvVariables.configEnvVariables)(options), (0, _configCustomAttributesPlugin.configCustomAttributesPlugin)(options), (0, _configTPHashMappingPlugin.configTPHashMappingPlugin)(options), (0, _configCopyPublicFolders.configCopyPublicFolders)(options), (0, _configIgnorePlugin.configIgnorePlugin)(options), (0, _configMiniCSSExtractPlugin.configMiniCSSExtractPlugin)(options), (0, _configSelectorWeightPlugin.configSelectorWeightPlugin)(options), (0, _configVariableConversionPlugin.configVariableConversionPlugin)(options), (0, _configI18nSplitPlugin.configI18nSplitPlugin)(options), (0, _configRtlCssPlugin.configRtlCssPlugin)(options), (0, _configHtmlWebpackPlugin.configHtmlWebpackPlugin)(options), (0, _configCdnChangePlugin.configCdnChangePlugin)(options), (0, _configServiceWorkerPlugin.configServiceWorkerPlugin)(options), (0, _configEFCTemplatePlugin.configEFCTemplatePlugin)(options), (0, _configResourceHintsPlugin.configResourceHintsPlugin)(options), (0, _configBundleAnalyzer.configBundleAnalyzer)(options), (0, _configManifestJsonPlugin.configManifestJsonPlugin)(options), (0, _configSourceMapPlugin.configSourceMapPlugin)(options), (0, _configProgressPlugin.configProgressPlugin)(options), (0, _configBundleIntegrityReport.configBundleIntegrityReport)(options), (0, _configRuntimeResourceCleanup.configRuntimeResourceCleanup)(options), ...webpackPlugins].filter(Boolean);
57
+ return [(0, _configEnvVariables.configEnvVariables)(options), (0, _configCustomAttributesPlugin.configCustomAttributesPlugin)(options), (0, _configTPHashMappingPlugin.configTPHashMappingPlugin)(options), (0, _configCopyPublicFolders.configCopyPublicFolders)(options), (0, _configIgnorePlugin.configIgnorePlugin)(options), (0, _configMiniCSSExtractPlugin.configMiniCSSExtractPlugin)(options), (0, _configSelectorWeightPlugin.configSelectorWeightPlugin)(options), (0, _configVariableConversionPlugin.configVariableConversionPlugin)(options), (0, _configI18nSplitPlugin.configI18nSplitPlugin)(options), (0, _configRtlCssPlugin.configRtlCssPlugin)(options), (0, _configHtmlWebpackPlugin.configHtmlWebpackPlugin)(options), (0, _configCustomScriptLoadingStrategyPlugin.configCustomScriptLoadingStrategyPlugin)(options), (0, _configCdnChangePlugin.configCdnChangePlugin)(options), (0, _configServiceWorkerPlugin.configServiceWorkerPlugin)(options), (0, _configEFCTemplatePlugin.configEFCTemplatePlugin)(options), (0, _configResourceHintsPlugin.configResourceHintsPlugin)(options), (0, _configBundleAnalyzer.configBundleAnalyzer)(options), (0, _configManifestJsonPlugin.configManifestJsonPlugin)(options), (0, _configSourceMapPlugin.configSourceMapPlugin)(options), (0, _configProgressPlugin.configProgressPlugin)(options), (0, _configBundleIntegrityReport.configBundleIntegrityReport)(options), (0, _configRuntimeResourceCleanup.configRuntimeResourceCleanup)(options), ...webpackPlugins].filter(Boolean);
56
58
  }
@@ -62,7 +62,8 @@ function moduleResolver(options) {
62
62
  modules: useAppNodeModulesAsPreferred(preferLocalFirst, [nodeModulesPath, _constants.cliNodeModulesPath].filter(Boolean)),
63
63
  alias: { ...(defaultAlias ? _libAlias.libAlias : {}),
64
64
  ...(alias || {})
65
- }
65
+ },
66
+ extensions: ['.ts', '.js', '.json', '.tsx']
66
67
  };
67
68
  }
68
69
 
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.tsLoaders = tsLoaders;
7
+
8
+ var _babelLoaderConfig = require("./loaderConfigs/babelLoaderConfig");
9
+
10
+ function tsLoaders(options) {
11
+ return [{
12
+ test: /\.tsx$/,
13
+ exclude: /node_modules/,
14
+ use: [(0, _babelLoaderConfig.babelLoaderConfig)(options)] // include: path.join(appPath, folder)
15
+
16
+ }];
17
+ }
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.getTypeOf = getTypeOf;
6
7
  exports.isJsFile = exports.isDirRelatedCss = exports.isCssFile = exports.isCss = void 0;
7
8
 
8
9
  var _path = _interopRequireDefault(require("path"));
@@ -23,4 +24,8 @@ exports.isJsFile = isJsFile;
23
24
 
24
25
  const isCssFile = file => /\.css$/.test(file);
25
26
 
26
- exports.isCssFile = isCssFile;
27
+ exports.isCssFile = isCssFile;
28
+
29
+ function getTypeOf(value) {
30
+ return Object.prototype.toString.call(value).split(/\s/)[1].replace(/\]/, '').toLowerCase();
31
+ }
@@ -11,6 +11,8 @@ var _outputConfig = require("./outputConfig");
11
11
 
12
12
  var _jsLoaders = require("./jsLoaders");
13
13
 
14
+ var _tsLoaders = require("./tsLoaders");
15
+
14
16
  var _cssLoaders = require("./cssLoaders");
15
17
 
16
18
  var _assetLoaders = require("./loaderConfigs/assetLoaders");
@@ -46,7 +48,7 @@ function webpackConfigCreator(options) {
46
48
  module: {
47
49
  /* strictExportPresence for break the build when imported module not present in respective file */
48
50
  // strictExportPresence: true,
49
- rules: [...(0, _jsLoaders.jsLoaders)(options), ...(0, _cssLoaders.cssLoaders)(options), (0, _configWebWorkerLoader.configWebWorkerLoader)(options), (0, _configHtmlTemplateLoader.configHtmlTemplateLoader)(options), ...(0, _assetLoaders.assetLoaders)(options), ...(0, _configCustomLoaders.configCustomLoaders)(options)]
51
+ rules: [...(0, _jsLoaders.jsLoaders)(options), ...(0, _tsLoaders.tsLoaders)(options), ...(0, _cssLoaders.cssLoaders)(options), (0, _configWebWorkerLoader.configWebWorkerLoader)(options), (0, _configHtmlTemplateLoader.configHtmlTemplateLoader)(options), ...(0, _assetLoaders.assetLoaders)(options), ...(0, _configCustomLoaders.configCustomLoaders)(options)]
50
52
  },
51
53
  plugins: (0, _plugins.plugins)(options),
52
54
  externals: (0, _externals.externals)(options),
@@ -11,6 +11,8 @@ var _watcher = _interopRequireDefault(require("watcher"));
11
11
 
12
12
  var _runBabelForJSFile = require("../babel/runBabelForJSFile");
13
13
 
14
+ var _runBabelForTsFile = require("../babel/runBabelForTsFile");
15
+
14
16
  var _runPostCssForCssFile = require("../postcss/runPostCssForCssFile");
15
17
 
16
18
  var _directoryIterator = require("./directoryIterator");
@@ -23,6 +25,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
23
25
 
24
26
  const isJs = ext => ext === '.js';
25
27
 
28
+ const isTs = ext => ext === '.ts' || ext === '.tsx';
29
+
26
30
  const isCss = ext => ext === '.css';
27
31
 
28
32
  function watchRun({
@@ -54,6 +58,13 @@ function watchRun({
54
58
  outputFile,
55
59
  options
56
60
  });
61
+ } else if (isTs(ext)) {
62
+ (0, _runBabelForTsFile.runBabelForTSFile)({
63
+ filename,
64
+ outputFile,
65
+ options,
66
+ mode
67
+ });
57
68
  } else {
58
69
  (0, _copyFile.copyFile)(filename, outputFile);
59
70
  }
@@ -81,7 +92,8 @@ function watchRun({
81
92
  const watcher = new _watcher.default(src, {
82
93
  recursive: true,
83
94
  ignoreInitial: true,
84
- ignore: filename => filename.indexOf('__tests__') !== -1
95
+ ignore: filename => filename.indexOf('__tests__') !== -1 // remove the test cases
96
+
85
97
  });
86
98
  watcher.on('all', (event, filename) => {
87
99
  if (event === 'unlink' || event === 'unlinkDir') {
@@ -46,7 +46,7 @@ const PostcssValueReplacer = (valueReplacer = []) => {
46
46
  const propOptions = options[decl.prop];
47
47
  propOptions?.sortedKeys.forEach(k => {
48
48
  // eslint-disable-next-line no-param-reassign
49
- decl.value = decl.value.replaceAll(k, propOptions.values[k]);
49
+ decl.value = decl.value.replaceAll(new RegExp(k, 'g'), propOptions.values[k]);
50
50
  });
51
51
  }
52
52
  };
@@ -108,6 +108,10 @@ const singleConvertor = (value, changeVal, details, range) => {
108
108
  }
109
109
  }
110
110
 
111
+ if (value == '0px') {
112
+ value = value.replace('px', '');
113
+ }
114
+
111
115
  if (getNumericValue(value) >= range.start && getNumericValue(value) <= range.end || getNumericValue(value) === 0) {
112
116
  let retVal = value.replace(/(\d+)px/gi, changeVal.replace('$$', '$1'));
113
117
 
@@ -9,10 +9,11 @@ exports.getServerUrl = getServerUrl;
9
9
  function getServerDomain(serverInfo) {
10
10
  const {
11
11
  host,
12
- domain
12
+ domain,
13
+ k8s
13
14
  } = serverInfo;
14
15
 
15
- if (domain) {
16
+ if (domain && !k8s) {
16
17
  return `${host}.${domain}.zohocorpin.com`;
17
18
  }
18
19
 
@@ -21,9 +22,15 @@ function getServerDomain(serverInfo) {
21
22
 
22
23
  function getServerUrl({
23
24
  domain,
25
+ k8s,
24
26
  port,
25
27
  protocol = 'http'
26
28
  }) {
27
29
  const prefix = protocol ? `${protocol}:` : '';
30
+
31
+ if (k8s) {
32
+ return `${prefix}//${domain}`;
33
+ }
34
+
28
35
  return `${prefix}//${domain}:${port}/`;
29
36
  }