@zohodesk/client_build_tool 0.0.15-exp.2 → 0.0.15-exp.3

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.
package/CHANGELOG.md CHANGED
@@ -1,32 +1,5 @@
1
1
  # Changelog and Release Notes
2
2
 
3
- # v0.0.15 (11-10-2025)
4
-
5
- **Feature:-**
6
- - Chunk Dependency Mapping: Added a new feature that generates a JSON file listing all chunk dependencies in the Webpack build
7
- For example, if main.js is a chunk, the generated JSON will include all of its direct imports (dependencies).
8
- - Purpose:
9
- To provide clear visibility into chunk relationships and dependencies for debugging, optimization, and performance analysis.
10
-
11
- ```
12
- chunkGraph:{
13
- enable: { value: true },
14
- fileName: ''
15
- }
16
- ```
17
-
18
- - Preload Chunk Split Visualization
19
- Enhanced the Preload Chunk (PLC) mechanism to identify and list the sub-chunks generated from a preloaded parent chunk.
20
- When a chunk is configured for preloading (e.g., ticket.js), the system now traces and records all the split chunks associated with it — for example
21
-
22
- ```
23
- resourceHints: {
24
- enable: true,
25
- PreloadChunkNames: [//name of chunks to be preload//]
26
- },
27
- ```
28
-
29
-
30
3
  # v0.0.14 (06-10-2025)
31
4
 
32
5
  **Feature:-**
package/README.md CHANGED
@@ -306,33 +306,6 @@ First Release
306
306
  - 'templates' command to create es for react library
307
307
  # Changelog and Release Notes
308
308
 
309
- # v0.0.15 (11-10-2025)
310
-
311
- **Feature:-**
312
- - Chunk Dependency Mapping: Added a new feature that generates a JSON file listing all chunk dependencies in the Webpack build
313
- For example, if main.js is a chunk, the generated JSON will include all of its direct imports (dependencies).
314
- - Purpose:
315
- To provide clear visibility into chunk relationships and dependencies for debugging, optimization, and performance analysis.
316
-
317
- ```
318
- chunkGraph:{
319
- enable: { value: true },
320
- fileName: ''
321
- }
322
- ```
323
-
324
- - Preload Chunk Split Visualization
325
- Enhanced the Preload Chunk (PLC) mechanism to identify and list the sub-chunks generated from a preloaded parent chunk.
326
- When a chunk is configured for preloading (e.g., ticket.js), the system now traces and records all the split chunks associated with it — for example
327
-
328
- ```
329
- resourceHints: {
330
- enable: true,
331
- PreloadChunkNames: [//name of chunks to be preload//]
332
- },
333
- ```
334
-
335
-
336
309
  # v0.0.14 (06-10-2025)
337
310
 
338
311
  **Feature:-**
@@ -300,8 +300,7 @@ var _default = {
300
300
  },
301
301
  customLoaders: [],
302
302
  resourceHints: {
303
- enable: false,
304
- PreloadChunkNames: []
303
+ allowPrefetchingMultipleChunks: false
305
304
  },
306
305
  devModeContentHashAllowedTypes: null,
307
306
  nameTemplateCustomization: null,
@@ -22,8 +22,11 @@ const pluginName = 'prefetch-preload-chunk-plugin';
22
22
 
23
23
  class ResourceHintsPlugin {
24
24
  constructor({
25
- publicPath
25
+ publicPath,
26
+ resourceHints
26
27
  }) {
28
+ this.resourceHints = resourceHints;
29
+ this.allowPrefetchingMultipleChunks = resourceHints.allowPrefetchingMultipleChunks;
27
30
  this.publicPathsTemplateObj = {
28
31
  js: publicPath,
29
32
  css: publicPath,
@@ -50,6 +53,7 @@ class ResourceHintsPlugin {
50
53
  compilation.addRuntimeModule(entryRuntimeChunk, // eslint-disable-next-line no-use-before-define
51
54
  new ResourceHintsRuntimePlugin(compiler, {
52
55
  chunk: entryRuntimeChunk,
56
+ allowPrefetchingMultipleChunks: this.allowPrefetchingMultipleChunks,
53
57
  publicPathsTemplateObj
54
58
  }));
55
59
  };
@@ -65,11 +69,13 @@ exports.default = ResourceHintsPlugin;
65
69
  class ResourceHintsRuntimePlugin extends _webpack.RuntimeModule {
66
70
  constructor(compiler, {
67
71
  chunk,
68
- publicPathsTemplateObj
72
+ publicPathsTemplateObj,
73
+ allowPrefetchingMultipleChunks
69
74
  }) {
70
75
  super('ResourceHintsRuntimePlugin loading', 10);
71
76
  this.compiler = compiler;
72
77
  this.publicPathsTemplateObj = publicPathsTemplateObj;
78
+ this.allowPrefetchingMultipleChunks = allowPrefetchingMultipleChunks;
73
79
  this.chunk = chunk;
74
80
  }
75
81
 
@@ -79,7 +85,7 @@ class ResourceHintsRuntimePlugin extends _webpack.RuntimeModule {
79
85
  } = this;
80
86
  const idNameMap = chunk.getChunkMaps().name;
81
87
  const nameIdMap = {};
82
- let needsMap = false;
88
+ let needsMap = this.allowPrefetchingMultipleChunks;
83
89
  Object.keys(idNameMap).forEach(key => {
84
90
  const value = idNameMap[key];
85
91
  nameIdMap[value] = key;
@@ -105,7 +111,7 @@ class ResourceHintsRuntimePlugin extends _webpack.RuntimeModule {
105
111
  */
106
112
 
107
113
  return _webpack.Template.asString([`const ntc = ${JSON.stringify(needsMap ? nameIdMap : {})};
108
- // const cns = Object.keys(ntc);
114
+ const cns = Object.keys(ntc);
109
115
 
110
116
  function clt(href, rel) {
111
117
  let link = document.createElement("link");
@@ -123,8 +129,8 @@ class ResourceHintsRuntimePlugin extends _webpack.RuntimeModule {
123
129
  //return !url.includes(".undefined.");
124
130
  return url.indexOf(".undefined") === -1;
125
131
  }
126
- function lpp(chunkId, rel) {
127
- // let chunkId = ${_webpack.RuntimeGlobals.require}.getChunkId(_chunkId);
132
+ function lpp(_chunkId, rel) {
133
+ let chunkId = ${_webpack.RuntimeGlobals.require}.getChunkId(_chunkId);
128
134
  // ${_webpack.RuntimeGlobals.require}.e(chunkId);
129
135
  if(__webpack_require__.O.j(chunkId)) {
130
136
  return;
@@ -139,29 +145,33 @@ class ResourceHintsRuntimePlugin extends _webpack.RuntimeModule {
139
145
  }
140
146
  }
141
147
 
142
- ${_webpack.RuntimeGlobals.require}.getChunkId = function getChunkId(chunkName) {
143
- return ntc[chunkName]||chunkName;
148
+ ${_webpack.RuntimeGlobals.require}.getChunkId = function getChunkId(chunkId) {
149
+ ${needsMap ? 'chunkId = ntc[chunkId]||chunkId;' : ''}
150
+ return chunkId;
144
151
  }
145
-
146
- // Preload a chunk (${pluginName})
147
- ${_webpack.RuntimeGlobals.require}.plc = function preloadChunk(chunkId) {
148
- const preloadChunkGraph = {{--preload-chunk-graph-object}}
152
+ ${_webpack.RuntimeGlobals.require}.getChunkIds = function getChunkIds(chunkId) {
153
+ ${// eslint-disable-next-line no-nested-ternary
154
+ this.allowPrefetchingMultipleChunks ? `
155
+ const isRegExAsChunkId = chunkId instanceof RegExp;
156
+ if(isRegExAsChunkId) {
157
+ return cns.filter(chunkName => chunkId.test(chunkName)).map(chunkName => ntc[chunkName]);
158
+ }
159
+ return [${_webpack.RuntimeGlobals.require}.getChunkId(chunkId)];
160
+ ` : `return [${_webpack.RuntimeGlobals.require}.getChunkId(chunkId)];`}
161
+ }
162
+ // Prefetch a chunk (${pluginName})
163
+ ${_webpack.RuntimeGlobals.require}.pfc = function prefetchChunk(chunkId) {
149
164
  ${`
150
- if (typeof preloadChunkGraph !== 'object' || !preloadChunkGraph) return;
151
- preloadChunkGraph[chunkId].forEach(idOfAChunk => {
152
- ${_webpack.RuntimeGlobals.require}.e(idOfAChunk);
153
- })
154
- // let idOfAChunk = ${_webpack.RuntimeGlobals.require}.getChunkId(chunkId);
155
- // chunkIds.forEach(idOfAChunk => {
156
- // ${_webpack.RuntimeGlobals.require}.e(idOfAChunk);
157
- // })
158
- `}
165
+ let chunkIds = ${_webpack.RuntimeGlobals.require}.getChunkIds(chunkId);
166
+ chunkIds.forEach(idOfAChunk => {
167
+ ${_webpack.RuntimeGlobals.require}.e(idOfAChunk);
168
+ })`}
159
169
  };
160
170
 
161
- // Prefetch a chunk (${pluginName})
162
- ${_webpack.RuntimeGlobals.require}.pfc = function prefetchChunk(chunkId) {
163
- let idOfAChunk = ${_webpack.RuntimeGlobals.require}.getChunkId(chunkId);
164
- lpp(idOfAChunk, "prefetch");
171
+ // Preload a chunk (${pluginName})
172
+ ${_webpack.RuntimeGlobals.require}.plc = function preloadChunk(chunkId) {
173
+ let idOfAChunk = ${_webpack.RuntimeGlobals.require}.getChunkIds(chunkId)[0];
174
+ lpp(idOfAChunk, "preload");
165
175
  }
166
176
  ` // `// Prefetch a chunk (${pluginName})`,
167
177
  // `${RuntimeGlobals.require}.pfc = function prefetchChunk(chunkId) {`,
@@ -180,17 +190,4 @@ class ResourceHintsRuntimePlugin extends _webpack.RuntimeModule {
180
190
  ]);
181
191
  }
182
192
 
183
- } // ${RuntimeGlobals.require}.getChunkIds = function getChunkIds(chunkId) {
184
- // ${
185
- // // eslint-disable-next-line no-nested-ternary
186
- // this.allowPrefetchingMultipleChunks
187
- // ? `
188
- // const isRegExAsChunkId = chunkId instanceof RegExp;
189
- // if(isRegExAsChunkId) {
190
- // return cns.filter(chunkName => chunkId.test(chunkName)).map(chunkName => ntc[chunkName]);
191
- // }
192
- // return [${RuntimeGlobals.require}.getChunkId(chunkId)];
193
- // `
194
- // : `return [${RuntimeGlobals.require}.getChunkId(chunkId)];`
195
- // }
196
- // }
193
+ }
@@ -13,7 +13,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
13
13
 
14
14
  /* eslint-disable no-use-before-define */
15
15
  function configChunkHierarchyPlugin(options) {
16
- if (options.chunkGraph.enable && (0, _modeUtils.isProductionMode)(options.mode)) {
16
+ if (options.chunkGraph.enable || (0, _modeUtils.isProductionMode)(mode)) {
17
+ console.log('running');
17
18
  return new _ChunkHierarchyPlugin.default(options.chunkGraph.fileName);
18
19
  }
19
20
 
@@ -14,12 +14,8 @@ function configResourceHintsPlugin(options) {
14
14
  publicPath,
15
15
  resourceHints
16
16
  } = options;
17
-
18
- if (resourceHints.enable) {
19
- return new _ResourceHintsPlugin.default({
20
- publicPath: JSON.stringify(publicPath)
21
- });
22
- }
23
-
24
- return null;
17
+ return new _ResourceHintsPlugin.default({
18
+ resourceHints,
19
+ publicPath: JSON.stringify(publicPath)
20
+ });
25
21
  }
@@ -53,12 +53,10 @@ var _configCustomScriptLoadingStrategyPlugin = require("./pluginConfigs/configCu
53
53
 
54
54
  var _configChunkHierarchyPlugin = require("./pluginConfigs/configChunkHierarchyPlugin");
55
55
 
56
- var _configInjectChunkGraphPlugin = require("./pluginConfigs/configInjectChunkGraphPlugin");
57
-
58
56
  // import { IgnorePlugin } from 'webpack';
59
57
  function plugins(options) {
60
58
  const {
61
59
  webpackPlugins
62
60
  } = options;
63
- 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), (0, _configMurphyInjectorPlugin.configMurphyInjectorPlugin)(options), (0, _configChunkHierarchyPlugin.configChunkHierarchyPlugin)(options), (0, _configInjectChunkGraphPlugin.configInjectChunkGraphPlugin)(options), ...webpackPlugins].filter(Boolean);
61
+ 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), (0, _configMurphyInjectorPlugin.configMurphyInjectorPlugin)(options), (0, _configChunkHierarchyPlugin.configChunkHierarchyPlugin)(options), ...webpackPlugins].filter(Boolean);
64
62
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/client_build_tool",
3
- "version": "0.0.15-exp.2",
3
+ "version": "0.0.15-exp.3",
4
4
  "description": "A CLI tool to build web applications and client libraries",
5
5
  "main": "lib/index.js",
6
6
  "bin": {
@@ -32,7 +32,6 @@
32
32
  "@babel/preset-env": "7.18.2",
33
33
  "@babel/preset-react": "7.17.12",
34
34
  "@babel/preset-typescript": "7.23.2",
35
- "@zohodesk-private/client_dev_cert": "^1.0.6",
36
35
  "@zohodesk/client_packages_group": "1.0.2",
37
36
  "babel-loader": "9.1.2",
38
37
  "babel-plugin-module-resolver": "5.0.2",