@zohodesk/client_build_tool 0.0.11-exp.10 → 0.0.11-exp.11

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.
@@ -66,8 +66,7 @@ class I18nNumericIndexPlugin {
66
66
  emitChunk(compilation, filename, locale, data, fileType = null) {
67
67
  const content = decodeUnicodeEscapes(JSON.stringify(data));
68
68
  const fileContent = `${this.options.jsonpFunc}(${content});`;
69
- let outputPath = filename.replace(/\[locale\]/g, locale); // Check if template contains [contenthash] placeholder or use legacy includeContentHash flag
70
-
69
+ let outputPath = filename.replace(/\[locale\]/g, locale);
71
70
  const hasContentHashPlaceholder = filename.includes('[contenthash]');
72
71
  const shouldIncludeHash = hasContentHashPlaceholder || this.options.includeContentHash;
73
72
 
@@ -75,10 +74,8 @@ class I18nNumericIndexPlugin {
75
74
  const contentHash = this.generateContentHash(fileContent, compilation);
76
75
 
77
76
  if (hasContentHashPlaceholder) {
78
- // Replace [contenthash] placeholder with actual hash
79
77
  outputPath = outputPath.replace(/\[contenthash\]/g, contentHash);
80
78
  } else {
81
- // Legacy behavior: append hash before .js extension
82
79
  outputPath = outputPath.replace(/\.js$/, `.${contentHash}.js`);
83
80
  }
84
81
  }
@@ -86,8 +83,7 @@ class I18nNumericIndexPlugin {
86
83
  if (this.options.generateManifest) {
87
84
  const cleanName = filename.replace(/\[locale\]/g, locale).replace(/\[contenthash\]/g, '').replace(/\.js$/, '.js');
88
85
  const cleanNameWithType = fileType ? cleanName.replace(/\.js$/, `.${fileType}.js`) : cleanName;
89
- const manifestKey = cleanNameWithType.split('/').pop(); // Extract just the filename for the key
90
-
86
+ const manifestKey = cleanNameWithType.split('/').pop();
91
87
  this.manifest[manifestKey] = outputPath.split('/').pop();
92
88
  }
93
89
 
@@ -46,10 +46,9 @@ function loadNumericMap(numericMapPath, compilation) {
46
46
  }
47
47
  }
48
48
 
49
- function loadAllLocaleFiles(propertiesPath, baseFileName, compilation, jsResourceBase) {
49
+ function loadAllLocaleFiles(propertiesPath, compilation, jsResourceBase) {
50
50
  const allI18n = {};
51
- const locales = []; // Always use the jsResourceBase as en_US base
52
-
51
+ const locales = [];
53
52
  allI18n['en_US'] = jsResourceBase;
54
53
  locales.push('en_US');
55
54
 
@@ -87,12 +86,11 @@ function loadAllLocaleFiles(propertiesPath, baseFileName, compilation, jsResourc
87
86
  function loadI18nData(options, compilation) {
88
87
  const jsResourcePath = path.resolve(compilation.compiler.context, options.jsResourcePath);
89
88
  const propertiesPath = path.resolve(compilation.compiler.context, options.propertiesFolderPath);
90
- const baseFileName = path.basename(options.jsResourcePath, '.properties');
91
89
  const jsResourceBase = loadPropertiesFile(jsResourcePath, compilation, 'JS resources');
92
90
  const {
93
91
  allI18n,
94
92
  locales
95
- } = loadAllLocaleFiles(propertiesPath, baseFileName, compilation, jsResourceBase);
93
+ } = loadAllLocaleFiles(propertiesPath, compilation, jsResourceBase);
96
94
  return {
97
95
  jsResourceBase,
98
96
  allI18n,
@@ -1,9 +1,5 @@
1
1
  "use strict";
2
2
 
3
- const path = require('path');
4
-
5
- const fs = require('fs');
6
-
7
3
  const {
8
4
  getPropertiesAsJSON
9
5
  } = require('../custom_plugins/I18nSplitPlugin/utils/propertiesUtils');
@@ -54,8 +54,7 @@ module.exports = function i18nIdReplaceLoader(source, map) {
54
54
  numericIdMap = parsedData.originalKeyToNumericId;
55
55
  }
56
56
  }
57
- } catch (err) {// ignore - optional file
58
- }
57
+ } catch (err) {}
59
58
  }
60
59
 
61
60
  if (!numericIdMap) {
@@ -17,7 +17,6 @@ function configI18nNumericIndexPlugin(options) {
17
17
  }
18
18
 
19
19
  const i18nOpts = options.i18nIndexing;
20
- const cdnConfig = options.cdnMapping || {};
21
20
  const requiredOptions = ['jsResourcePath', 'propertiesFolderPath', 'numericMapPath', 'jsonpFunc', 'htmlTemplateLabel', 'localeVarName', 'numericFilenameTemplate', 'dynamicFilenameTemplate'];
22
21
  const missingOptions = requiredOptions.filter(opt => !i18nOpts[opt]);
23
22
 
@@ -40,17 +39,13 @@ function configI18nNumericIndexPlugin(options) {
40
39
 
41
40
  if (!i18nOpts.dynamicFilenameTemplate.includes('[locale]')) {
42
41
  return null;
43
- } // Empty prefix - HtmlWebpackPlugin handles publicPath
44
-
45
-
46
- const i18nAssetsPublicPathPrefix = ''; // Smart contenthash detection based on template content
42
+ }
47
43
 
44
+ const i18nAssetsPublicPathPrefix = '';
48
45
  const hasContentHashInNumeric = i18nOpts.numericFilenameTemplate.includes('[contenthash]');
49
46
  const hasContentHashInDynamic = i18nOpts.dynamicFilenameTemplate.includes('[contenthash]');
50
- const hasContentHashInSingle = i18nOpts.singleFileTemplate?.includes('[contenthash]'); // Determine if hashing should be enabled based on template content
51
-
52
- const shouldIncludeContentHash = i18nOpts.singleFile ? hasContentHashInSingle : hasContentHashInNumeric || hasContentHashInDynamic; // Use explicit includeContentHash if provided, otherwise use smart detection
53
-
47
+ const hasContentHashInSingle = i18nOpts.singleFileTemplate?.includes('[contenthash]');
48
+ const shouldIncludeContentHash = i18nOpts.singleFile ? hasContentHashInSingle : hasContentHashInNumeric || hasContentHashInDynamic;
54
49
  const finalIncludeContentHash = i18nOpts.includeContentHash !== undefined ? i18nOpts.includeContentHash : shouldIncludeContentHash;
55
50
  const numericIndexPluginOptions = {
56
51
  enable: i18nOpts.enable,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/client_build_tool",
3
- "version": "0.0.11-exp.10",
3
+ "version": "0.0.11-exp.11",
4
4
  "description": "A CLI tool to build web applications and client libraries",
5
5
  "main": "lib/index.js",
6
6
  "bin": {