@zohodesk/client_build_tool 0.0.11-exp.13 → 0.0.11-exp.15.1

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.
@@ -28,7 +28,8 @@ class I18nNumericIndexPlugin {
28
28
  singleFile: options.singleFile || false,
29
29
  singleFileTemplate: options.singleFileTemplate,
30
30
  includeContentHash: options.includeContentHash || false,
31
- generateManifest: options.generateManifest || false
31
+ generateManifest: options.generateManifest || false,
32
+ manifestPath: options.manifestPath || 'i18n/manifest.json'
32
33
  };
33
34
  this.numericMap = null;
34
35
  this.i18nData = null;
@@ -157,7 +158,18 @@ class I18nNumericIndexPlugin {
157
158
  });
158
159
 
159
160
  if (this.options.generateManifest && Object.keys(this.manifest).length > 0) {
160
- const manifestPath = path.dirname(this.options.numericFilenameTemplate) + '/manifest.json';
161
+ // Determine manifest path
162
+ let manifestPath;
163
+
164
+ if (this.options.manifestPath) {
165
+ // Use explicitly configured path
166
+ manifestPath = this.options.manifestPath;
167
+ } else {
168
+ // Default to same directory as i18n files with manifest.json name
169
+ const template = this.options.singleFileTemplate || this.options.numericFilenameTemplate;
170
+ manifestPath = path.dirname(template) + '/manifest.json';
171
+ }
172
+
161
173
  const manifestContent = JSON.stringify(this.manifest, null, 2);
162
174
  compilation.emitAsset(manifestPath, new RawSource(manifestContent));
163
175
  }
@@ -43,9 +43,10 @@ function folderPatterns(publicFolders) {
43
43
 
44
44
  function configCopyPublicFolders(options) {
45
45
  let {
46
- publicFolders
46
+ publicFolders,
47
+ mode = 'dev'
47
48
  } = options;
48
- publicFolders = (0, _updateArrayWithDefault.updateArrayWithDefault)(publicFolders, defaultPublicFolders);
49
+ publicFolders = (0, _updateArrayWithDefault.updateArrayWithDefault)(publicFolders[mode], defaultPublicFolders);
49
50
 
50
51
  if (publicFolders.length === 0) {
51
52
  return null;
@@ -16,8 +16,11 @@ function configI18nNumericIndexPlugin(options) {
16
16
  return null;
17
17
  }
18
18
 
19
- const i18nOpts = options.i18nIndexing;
20
- const requiredOptions = ['jsResourcePath', 'propertiesFolderPath', 'numericMapPath', 'jsonpFunc', 'htmlTemplateLabel', 'localeVarName', 'numericFilenameTemplate', 'dynamicFilenameTemplate'];
19
+ const i18nOpts = options.i18nIndexing; // Check for required options based on singleFile mode
20
+
21
+ const baseRequiredOptions = ['jsResourcePath', 'propertiesFolderPath', 'numericMapPath', 'jsonpFunc', 'htmlTemplateLabel', 'localeVarName']; // Add template requirements based on mode
22
+
23
+ const requiredOptions = i18nOpts.singleFile ? [...baseRequiredOptions, 'singleFileTemplate'] : [...baseRequiredOptions, 'numericFilenameTemplate', 'dynamicFilenameTemplate'];
21
24
  const missingOptions = requiredOptions.filter(opt => !i18nOpts[opt]);
22
25
 
23
26
  if (missingOptions.length > 0) {
@@ -31,14 +34,20 @@ function configI18nNumericIndexPlugin(options) {
31
34
  jsResource: i18nOpts.jsResourcePath,
32
35
  propertiesFolder: i18nOpts.propertiesFolderPath,
33
36
  disableDefault: false
34
- });
37
+ }); // Validate template patterns based on mode
35
38
 
36
- if (!i18nOpts.numericFilenameTemplate.includes('[locale]')) {
37
- return null;
38
- }
39
+ if (i18nOpts.singleFile) {
40
+ if (i18nOpts.singleFileTemplate && !i18nOpts.singleFileTemplate.includes('[locale]')) {
41
+ return null;
42
+ }
43
+ } else {
44
+ if (!i18nOpts.numericFilenameTemplate?.includes('[locale]')) {
45
+ return null;
46
+ }
39
47
 
40
- if (!i18nOpts.dynamicFilenameTemplate.includes('[locale]')) {
41
- return null;
48
+ if (!i18nOpts.dynamicFilenameTemplate?.includes('[locale]')) {
49
+ return null;
50
+ }
42
51
  }
43
52
 
44
53
  const i18nAssetsPublicPathPrefix = '';
@@ -60,7 +69,8 @@ function configI18nNumericIndexPlugin(options) {
60
69
  jsonpFunc: i18nOpts.jsonpFunc,
61
70
  singleFile: i18nOpts.singleFile || false,
62
71
  includeContentHash: finalIncludeContentHash,
63
- generateManifest: i18nOpts.generateManifest || false
72
+ generateManifest: i18nOpts.generateManifest || false,
73
+ manifestPath: i18nOpts.manifestPath
64
74
  };
65
75
  const htmlInjectorOptions = {
66
76
  numericFilenameTemplate: i18nOpts.numericFilenameTemplate,
@@ -259,7 +259,7 @@ var _default = ({
259
259
  if (range) {
260
260
  // console.log('multiple :', decl.value)
261
261
  let newVal = '';
262
- decl.value.split(' ').forEach(singleVal => {
262
+ decl.value.split(' ').filter(Boolean).forEach(singleVal => {
263
263
  newVal += `${singleConvertor(singleVal, settings.replacements.px, {
264
264
  decl,
265
265
  filename,
@@ -44,6 +44,13 @@ function handleMockApi(mockEntryFile, app) {
44
44
  const entryFilePath = (0, _constants.joinWithAppPath)(mockEntryFile); // eslint-disable-next-line no-use-before-define
45
45
 
46
46
  const mockFunc = safeRequire(entryFilePath);
47
+
48
+ if (typeof mockFunc === 'function') {
49
+ // eslint-disable-next-line no-use-before-define
50
+ mockFunc(app);
51
+ return;
52
+ }
53
+
47
54
  mockFunc?.mockApi?.(app);
48
55
  } // function handleMockApi(params) {
49
56
  // }
@@ -17,10 +17,11 @@ function urlConcat(url, path) {
17
17
  const slashRemovedPath = removeFrontSlash(path);
18
18
 
19
19
  if (slashRemovedUrl === '') {
20
- return path;
21
- }
20
+ return `${path}/`;
21
+ } //return `${slashRemovedUrl}/${slashRemovedPath}`;
22
22
 
23
- return `${slashRemovedUrl}/${slashRemovedPath}/`;
23
+
24
+ return `${[slashRemovedUrl, slashRemovedPath].filter(a => a).join('/')}/`;
24
25
  }
25
26
 
26
27
  function removeLastSlash(url) {