@zohodesk/client_build_tool 0.0.15 → 0.0.16-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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog and Release Notes
2
2
 
3
+ # v0.0.16 (05-11-2025)
4
+
5
+ **Adjustments:-**
6
+ - ChunkHierarchyPlugin.js – Added support for ConcatenatedModule modules.
7
+ - InjectChunkGraphPlugin.js – Changed the template name from {{--preload-chunk-graph-object}} to __PRELOAD_CHUNK_GRAPH__ to resolve minification issues.
8
+ - Disabled CSS source map generation – CSS source maps were being created when RTL split was disabled and sourceMap was enabled, causing issues. Hence, CSS source map creation has been disabled
9
+ - Source map path correction – The resolving paths in source map files appeared as zohodesk-react/./src, which was incompatible with the Murphy tool. Updated it to zohodesk-react/src by adding a function to devtoolModuleFilenameTemplate in the output configuration.
10
+ - ChunkHierarchyPlugin – Made it active in development mode as well by removing the “run only in production” condition.
11
+
3
12
  # v0.0.15 (11-10-2025)
4
13
 
5
14
  **Feature:-**
@@ -19,6 +28,8 @@ To provide clear visibility into chunk relationships and dependencies for debugg
19
28
  Enhanced the Preload Chunk (PLC) mechanism to identify and list the sub-chunks generated from a preloaded parent chunk.
20
29
  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
30
 
31
+ if resourceHints not enabled plc , pfc and custom function related to this are not created
32
+
22
33
  ```
23
34
  resourceHints: {
24
35
  enable: true,
package/README.md CHANGED
@@ -306,6 +306,15 @@ First Release
306
306
  - 'templates' command to create es for react library
307
307
  # Changelog and Release Notes
308
308
 
309
+ # v0.0.16 (05-11-2025)
310
+
311
+ **Adjustments:-**
312
+ - ChunkHierarchyPlugin.js – Added support for ConcatenatedModule modules.
313
+ - InjectChunkGraphPlugin.js – Changed the template name from {{--preload-chunk-graph-object}} to __PRELOAD_CHUNK_GRAPH__ to resolve minification issues.
314
+ - Disabled CSS source map generation – CSS source maps were being created when RTL split was disabled and sourceMap was enabled, causing issues. Hence, CSS source map creation has been disabled
315
+ - Source map path correction – The resolving paths in source map files appeared as zohodesk-react/./src, which was incompatible with the Murphy tool. Updated it to zohodesk-react/src by adding a function to devtoolModuleFilenameTemplate in the output configuration.
316
+ - ChunkHierarchyPlugin – Made it active in development mode as well by removing the “run only in production” condition.
317
+
309
318
  # v0.0.15 (11-10-2025)
310
319
 
311
320
  **Feature:-**
@@ -325,6 +334,8 @@ To provide clear visibility into chunk relationships and dependencies for debugg
325
334
  Enhanced the Preload Chunk (PLC) mechanism to identify and list the sub-chunks generated from a preloaded parent chunk.
326
335
  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
336
 
337
+ if resourceHints not enabled plc , pfc and custom function related to this are not created
338
+
328
339
  ```
329
340
  resourceHints: {
330
341
  enable: true,
@@ -1,64 +1,65 @@
1
1
  "use strict";
2
2
 
3
3
  // plugins/ChunkHierarchyPlugin.js
4
- const fs = require("fs");
4
+ const fs = require('fs');
5
5
 
6
- const path = require("path");
6
+ const path = require('path');
7
7
 
8
8
  class ChunkHierarchyPlugin {
9
- constructor(outputFileName) {
10
- this.outputFileName = outputFileName || "chunk-hierarchy-report.json";
9
+ constructor(outputFile) {
10
+ this.outputFile = outputFile || 'chunk-hierarchy-report.json';
11
11
  }
12
12
 
13
13
  apply(compiler) {
14
- compiler.hooks.afterEmit.tap("ChunkHierarchyPlugin", compilation => {
15
- try {
16
- const {
17
- chunkGraph,
18
- moduleGraph
19
- } = compilation;
20
- const hierarchy = {};
14
+ compiler.hooks.emit.tapAsync('ChunkHierarchyPlugin', (compilation, callback) => {
15
+ const result = {};
21
16
 
22
- for (const chunk of compilation.chunks) {
23
- // skip unnamed or runtime chunks
24
- if (!chunk.name) {
25
- continue;
26
- }
17
+ for (const chunk of compilation.chunks) {
18
+ const chunkName = chunk.name || chunk.id;
19
+ const modules = [];
27
20
 
28
- ;
21
+ for (const module of compilation.chunkGraph.getChunkModulesIterable(chunk)) {
22
+ // Recursively extract real modules (handle ConcatenatedModules)
23
+ collectModules(module, modules, compiler.context);
24
+ }
25
+
26
+ result[chunkName] = modules;
27
+ }
28
+
29
+ const json = JSON.stringify(result, null, 2);
30
+ const outputPath = path.join(compiler.outputPath, this.outputFile);
31
+ fs.mkdirSync(outputPath, {
32
+ recursive: true
33
+ });
34
+ fs.writeFileSync(outputPath, json, 'utf-8');
35
+ callback();
36
+ });
37
+ }
29
38
 
30
- if (chunk.name.includes("runtime")) {
31
- continue;
32
- }
39
+ }
33
40
 
34
- ;
35
- const modules = chunkGraph.getChunkModulesIterable(chunk);
36
- const deps = new Set();
41
+ function collectModules(module, modules, context) {
42
+ // Handle normal modules
43
+ if (module.resource) {
44
+ modules.push(path.relative(context, module.resource));
45
+ return;
46
+ } // Handle ConcatenatedModule (webpack internal)
37
47
 
38
- for (const module of modules) {
39
- for (const conn of moduleGraph.getOutgoingConnections(module)) {
40
- if (conn.module && conn.module.resource) {
41
- deps.add(conn.module.resource.match(/jsapps\/supportapp.*/)?.[0]);
42
- }
43
- }
44
- }
45
48
 
46
- hierarchy[chunk.name] = Array.from(deps);
47
- }
49
+ if (module.modules) {
50
+ for (const innerModule of module.modules) {
51
+ collectModules(innerModule, modules, context);
52
+ }
53
+ } // Handle Webpack 5 internal API (ConcatenatedModule inside _orderedConcatenationList)
48
54
 
49
- const outputPath = compiler.options.output.path;
50
- const outputFile = path.join(outputPath, this.outputFileName); // Ensure folder exists before writing
51
55
 
52
- fs.mkdirSync(outputPath, {
53
- recursive: true
54
- });
55
- fs.writeFileSync(outputFile, JSON.stringify(hierarchy, null, 2), "utf-8");
56
- } catch (err) {
57
- console.error("❌ ChunkHierarchyPlugin failed:", err);
56
+ if (module._orderedConcatenationList) {
57
+ for (const item of module._orderedConcatenationList) {
58
+ if (item.module) {
59
+ collectModules(item.module, modules, context);
58
60
  }
59
- });
61
+ }
60
62
  }
61
-
62
63
  }
63
64
 
64
65
  module.exports = ChunkHierarchyPlugin;
@@ -33,9 +33,13 @@ class InjectChunkGraphPlugin {
33
33
  const runtimeChunk = stats.chunks.find(chunk => chunk.names?.some(n => n.includes('runtime~main')));
34
34
  const runtimeChunkName = runtimeChunk.files[0];
35
35
  const originalSource = compilation.assets[runtimeChunkName].source();
36
- const newSource = originalSource.replace('{{--preload-chunk-graph-object}}', `${JSON.stringify(chunkGraph)}`); // Update the runtime asset with injected code
36
+ const newSource = originalSource.replace('__PRELOAD_CHUNK_GRAPH__', `${JSON.stringify(chunkGraph)}`); // Update the runtime asset with injected code
37
37
 
38
38
  compilation.updateAsset(runtimeChunkName, new RawSource(newSource));
39
+
40
+ if (runtimeChunkName.includes('smap/')) {
41
+ compilation.updateAsset(runtimeChunkName.replace('smap/', ''), new RawSource(newSource));
42
+ }
39
43
  });
40
44
  });
41
45
  }
@@ -145,7 +145,7 @@ class ResourceHintsRuntimePlugin extends _webpack.RuntimeModule {
145
145
 
146
146
  // Preload a chunk (${pluginName})
147
147
  ${_webpack.RuntimeGlobals.require}.plc = function preloadChunk(chunkId) {
148
- const preloadChunkGraph = {{--preload-chunk-graph-object}}
148
+ const preloadChunkGraph = __PRELOAD_CHUNK_GRAPH__
149
149
  ${`
150
150
  if (typeof preloadChunkGraph !== 'object' || !preloadChunkGraph) return;
151
151
  preloadChunkGraph[chunkId].forEach(idOfAChunk => {
@@ -15,7 +15,7 @@ function getCssLoaderOptions(options) {
15
15
  modules: {
16
16
  getLocalIdent: (0, _cssClassNameGenerate.default)(options)
17
17
  },
18
- sourceMap: true
18
+ sourceMap: false
19
19
  };
20
20
  return cssLoaderOptions;
21
21
  }
@@ -27,7 +27,17 @@ function outputConfig(options) {
27
27
  chunkLoadingGlobal: (0, _modeUtils.getGlobalCacheStorageName)(options),
28
28
  publicPath,
29
29
  // clean: true,
30
- path: _path.default.resolve(_constants.appPath, output)
30
+ path: _path.default.resolve(_constants.appPath, output),
31
+ devtoolModuleFilenameTemplate: info => {
32
+ let resourcePath = info.resourcePath;
33
+ const namespace = info.namespace;
34
+
35
+ if (resourcePath.startsWith('./')) {
36
+ resourcePath = resourcePath.substring(2);
37
+ }
38
+
39
+ return `webpack://${namespace}/${resourcePath}`;
40
+ }
31
41
  };
32
42
 
33
43
  if (htmlTemplate.crossorigin) {
@@ -13,7 +13,7 @@ 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) {
17
17
  return new _ChunkHierarchyPlugin.default(options.chunkGraph.fileName);
18
18
  }
19
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/client_build_tool",
3
- "version": "0.0.15",
3
+ "version": "0.0.16-exp.2",
4
4
  "description": "A CLI tool to build web applications and client libraries",
5
5
  "main": "lib/index.js",
6
6
  "bin": {
@@ -17,7 +17,7 @@
17
17
  "test": "react-cli test"
18
18
  },
19
19
  "repository": {
20
- "type": "git",
20
+ "type": "git",
21
21
  "url": "https://zgit.csecz.zohocorpin.com/zohodesk/react-cli.git"
22
22
  },
23
23
  "keywords": [