@zohodesk/client_build_tool 0.0.14 → 0.0.15
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 +27 -0
- package/README.md +27 -0
- package/lib/schemas/defaultConfigValues.js +11 -1
- package/lib/shared/bundler/webpack/custom_plugins/ChunkHierarchyPlugin.js +64 -0
- package/lib/shared/bundler/webpack/custom_plugins/InjectChunkGraphPlugin.js +45 -0
- package/lib/shared/bundler/webpack/custom_plugins/ResourceHintsPlugin.js +39 -36
- package/lib/shared/bundler/webpack/pluginConfigs/configChunkHierarchyPlugin.js +21 -0
- package/lib/shared/bundler/webpack/pluginConfigs/configInjectChunkGraphPlugin.js +22 -0
- package/lib/shared/bundler/webpack/pluginConfigs/configResourceHintsPlugin.js +8 -4
- package/lib/shared/bundler/webpack/plugins.js +5 -1
- package/lib/shared/bundler/webpack/tsLoaders.js +0 -1
- package/package.json +3 -2
- package/lib/shared/bundler/webpack/common/i18nOptionsValidator.js +0 -121
- package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nGroupRuntimeModule.js +0 -199
- package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexHtmlInjectorPlugin.js +0 -110
- package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexPlugin.js +0 -478
- package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/utils/i18nDataLoader.js +0 -115
- package/lib/shared/bundler/webpack/loaderConfigs/i18nIdReplaceLoaderConfig.js +0 -69
- package/lib/shared/bundler/webpack/loaders/i18nIdReplaceLoader.js +0 -126
- package/lib/shared/bundler/webpack/pluginConfigs/configI18nIndexingPlugin.js +0 -42
- package/lib/shared/bundler/webpack/pluginConfigs/configI18nNumericHtmlInjector.js +0 -82
- package/lib/shared/bundler/webpack/pluginConfigs/configI18nNumericIndexPlugin.js +0 -95
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
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
|
+
|
|
3
30
|
# v0.0.14 (06-10-2025)
|
|
4
31
|
|
|
5
32
|
**Feature:-**
|
package/README.md
CHANGED
|
@@ -306,6 +306,33 @@ 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
|
+
|
|
309
336
|
# v0.0.14 (06-10-2025)
|
|
310
337
|
|
|
311
338
|
**Feature:-**
|
|
@@ -7,6 +7,8 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _os = require("os");
|
|
9
9
|
|
|
10
|
+
var _webpack = require("webpack");
|
|
11
|
+
|
|
10
12
|
// NOTE: Don't use 'config_file' as cli option it was reserved
|
|
11
13
|
var _default = {
|
|
12
14
|
context: {
|
|
@@ -300,7 +302,8 @@ var _default = {
|
|
|
300
302
|
},
|
|
301
303
|
customLoaders: [],
|
|
302
304
|
resourceHints: {
|
|
303
|
-
|
|
305
|
+
enable: false,
|
|
306
|
+
PreloadChunkNames: []
|
|
304
307
|
},
|
|
305
308
|
devModeContentHashAllowedTypes: null,
|
|
306
309
|
nameTemplateCustomization: null,
|
|
@@ -359,6 +362,13 @@ var _default = {
|
|
|
359
362
|
enableSubResourceIntegrity: {
|
|
360
363
|
value: false,
|
|
361
364
|
cli: 'enable_sub_resource_integrity'
|
|
365
|
+
},
|
|
366
|
+
chunkGraph: {
|
|
367
|
+
enable: {
|
|
368
|
+
value: false,
|
|
369
|
+
cli: 'chunk_graph_enable'
|
|
370
|
+
},
|
|
371
|
+
fileName: ''
|
|
362
372
|
}
|
|
363
373
|
};
|
|
364
374
|
exports.default = _default;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// plugins/ChunkHierarchyPlugin.js
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
|
|
6
|
+
const path = require("path");
|
|
7
|
+
|
|
8
|
+
class ChunkHierarchyPlugin {
|
|
9
|
+
constructor(outputFileName) {
|
|
10
|
+
this.outputFileName = outputFileName || "chunk-hierarchy-report.json";
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
apply(compiler) {
|
|
14
|
+
compiler.hooks.afterEmit.tap("ChunkHierarchyPlugin", compilation => {
|
|
15
|
+
try {
|
|
16
|
+
const {
|
|
17
|
+
chunkGraph,
|
|
18
|
+
moduleGraph
|
|
19
|
+
} = compilation;
|
|
20
|
+
const hierarchy = {};
|
|
21
|
+
|
|
22
|
+
for (const chunk of compilation.chunks) {
|
|
23
|
+
// skip unnamed or runtime chunks
|
|
24
|
+
if (!chunk.name) {
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
;
|
|
29
|
+
|
|
30
|
+
if (chunk.name.includes("runtime")) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
;
|
|
35
|
+
const modules = chunkGraph.getChunkModulesIterable(chunk);
|
|
36
|
+
const deps = new Set();
|
|
37
|
+
|
|
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
|
+
|
|
46
|
+
hierarchy[chunk.name] = Array.from(deps);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const outputPath = compiler.options.output.path;
|
|
50
|
+
const outputFile = path.join(outputPath, this.outputFileName); // Ensure folder exists before writing
|
|
51
|
+
|
|
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);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
module.exports = ChunkHierarchyPlugin;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
RawSource
|
|
5
|
+
} = require('webpack-sources');
|
|
6
|
+
|
|
7
|
+
class InjectChunkGraphPlugin {
|
|
8
|
+
constructor(resourceHints) {
|
|
9
|
+
this.chunkNames = resourceHints.PreloadChunkNames || [];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
apply(compiler) {
|
|
13
|
+
compiler.hooks.thisCompilation.tap('InjectChunkGraphPlugin', compilation => {
|
|
14
|
+
compilation.hooks.processAssets.tap({
|
|
15
|
+
name: 'InjectChunkGraphPlugin',
|
|
16
|
+
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS
|
|
17
|
+
}, () => {
|
|
18
|
+
const stats = compilation.getStats().toJson({
|
|
19
|
+
all: true
|
|
20
|
+
});
|
|
21
|
+
const chunkGraph = {};
|
|
22
|
+
this.chunkNames.forEach(chunkName => {
|
|
23
|
+
const chunkGroup = stats.namedChunkGroups?.[chunkName];
|
|
24
|
+
|
|
25
|
+
if (!chunkGroup) {
|
|
26
|
+
compilation.warnings.push(new Error(`[InjectChunkGraphPlugin] Chunk group "${chunkName}" not found.`));
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
chunkGraph[chunkName] = chunkGroup.chunks;
|
|
31
|
+
}); // Find runtime chunk file
|
|
32
|
+
|
|
33
|
+
const runtimeChunk = stats.chunks.find(chunk => chunk.names?.some(n => n.includes('runtime~main')));
|
|
34
|
+
const runtimeChunkName = runtimeChunk.files[0];
|
|
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
|
|
37
|
+
|
|
38
|
+
compilation.updateAsset(runtimeChunkName, new RawSource(newSource));
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
module.exports = InjectChunkGraphPlugin;
|
|
@@ -22,11 +22,8 @@ const pluginName = 'prefetch-preload-chunk-plugin';
|
|
|
22
22
|
|
|
23
23
|
class ResourceHintsPlugin {
|
|
24
24
|
constructor({
|
|
25
|
-
publicPath
|
|
26
|
-
resourceHints
|
|
25
|
+
publicPath
|
|
27
26
|
}) {
|
|
28
|
-
this.resourceHints = resourceHints;
|
|
29
|
-
this.allowPrefetchingMultipleChunks = resourceHints.allowPrefetchingMultipleChunks;
|
|
30
27
|
this.publicPathsTemplateObj = {
|
|
31
28
|
js: publicPath,
|
|
32
29
|
css: publicPath,
|
|
@@ -53,7 +50,6 @@ class ResourceHintsPlugin {
|
|
|
53
50
|
compilation.addRuntimeModule(entryRuntimeChunk, // eslint-disable-next-line no-use-before-define
|
|
54
51
|
new ResourceHintsRuntimePlugin(compiler, {
|
|
55
52
|
chunk: entryRuntimeChunk,
|
|
56
|
-
allowPrefetchingMultipleChunks: this.allowPrefetchingMultipleChunks,
|
|
57
53
|
publicPathsTemplateObj
|
|
58
54
|
}));
|
|
59
55
|
};
|
|
@@ -69,13 +65,11 @@ exports.default = ResourceHintsPlugin;
|
|
|
69
65
|
class ResourceHintsRuntimePlugin extends _webpack.RuntimeModule {
|
|
70
66
|
constructor(compiler, {
|
|
71
67
|
chunk,
|
|
72
|
-
publicPathsTemplateObj
|
|
73
|
-
allowPrefetchingMultipleChunks
|
|
68
|
+
publicPathsTemplateObj
|
|
74
69
|
}) {
|
|
75
70
|
super('ResourceHintsRuntimePlugin loading', 10);
|
|
76
71
|
this.compiler = compiler;
|
|
77
72
|
this.publicPathsTemplateObj = publicPathsTemplateObj;
|
|
78
|
-
this.allowPrefetchingMultipleChunks = allowPrefetchingMultipleChunks;
|
|
79
73
|
this.chunk = chunk;
|
|
80
74
|
}
|
|
81
75
|
|
|
@@ -85,7 +79,7 @@ class ResourceHintsRuntimePlugin extends _webpack.RuntimeModule {
|
|
|
85
79
|
} = this;
|
|
86
80
|
const idNameMap = chunk.getChunkMaps().name;
|
|
87
81
|
const nameIdMap = {};
|
|
88
|
-
let needsMap =
|
|
82
|
+
let needsMap = false;
|
|
89
83
|
Object.keys(idNameMap).forEach(key => {
|
|
90
84
|
const value = idNameMap[key];
|
|
91
85
|
nameIdMap[value] = key;
|
|
@@ -111,7 +105,7 @@ class ResourceHintsRuntimePlugin extends _webpack.RuntimeModule {
|
|
|
111
105
|
*/
|
|
112
106
|
|
|
113
107
|
return _webpack.Template.asString([`const ntc = ${JSON.stringify(needsMap ? nameIdMap : {})};
|
|
114
|
-
|
|
108
|
+
// const cns = Object.keys(ntc);
|
|
115
109
|
|
|
116
110
|
function clt(href, rel) {
|
|
117
111
|
let link = document.createElement("link");
|
|
@@ -129,8 +123,8 @@ class ResourceHintsRuntimePlugin extends _webpack.RuntimeModule {
|
|
|
129
123
|
//return !url.includes(".undefined.");
|
|
130
124
|
return url.indexOf(".undefined") === -1;
|
|
131
125
|
}
|
|
132
|
-
function lpp(
|
|
133
|
-
let chunkId = ${_webpack.RuntimeGlobals.require}.getChunkId(_chunkId);
|
|
126
|
+
function lpp(chunkId, rel) {
|
|
127
|
+
// let chunkId = ${_webpack.RuntimeGlobals.require}.getChunkId(_chunkId);
|
|
134
128
|
// ${_webpack.RuntimeGlobals.require}.e(chunkId);
|
|
135
129
|
if(__webpack_require__.O.j(chunkId)) {
|
|
136
130
|
return;
|
|
@@ -145,33 +139,29 @@ class ResourceHintsRuntimePlugin extends _webpack.RuntimeModule {
|
|
|
145
139
|
}
|
|
146
140
|
}
|
|
147
141
|
|
|
148
|
-
${_webpack.RuntimeGlobals.require}.getChunkId = function getChunkId(
|
|
149
|
-
|
|
150
|
-
return chunkId;
|
|
142
|
+
${_webpack.RuntimeGlobals.require}.getChunkId = function getChunkId(chunkName) {
|
|
143
|
+
return ntc[chunkName]||chunkName;
|
|
151
144
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
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) {
|
|
145
|
+
|
|
146
|
+
// Preload a chunk (${pluginName})
|
|
147
|
+
${_webpack.RuntimeGlobals.require}.plc = function preloadChunk(chunkId) {
|
|
148
|
+
const preloadChunkGraph = {{--preload-chunk-graph-object}}
|
|
164
149
|
${`
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
})
|
|
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
|
+
`}
|
|
169
159
|
};
|
|
170
160
|
|
|
171
|
-
//
|
|
172
|
-
${_webpack.RuntimeGlobals.require}.
|
|
173
|
-
let idOfAChunk = ${_webpack.RuntimeGlobals.require}.
|
|
174
|
-
lpp(idOfAChunk, "
|
|
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");
|
|
175
165
|
}
|
|
176
166
|
` // `// Prefetch a chunk (${pluginName})`,
|
|
177
167
|
// `${RuntimeGlobals.require}.pfc = function prefetchChunk(chunkId) {`,
|
|
@@ -190,4 +180,17 @@ class ResourceHintsRuntimePlugin extends _webpack.RuntimeModule {
|
|
|
190
180
|
]);
|
|
191
181
|
}
|
|
192
182
|
|
|
193
|
-
}
|
|
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
|
+
// }
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.configChunkHierarchyPlugin = configChunkHierarchyPlugin;
|
|
7
|
+
|
|
8
|
+
var _modeUtils = require("../common/modeUtils");
|
|
9
|
+
|
|
10
|
+
var _ChunkHierarchyPlugin = _interopRequireDefault(require("../custom_plugins/ChunkHierarchyPlugin"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
/* eslint-disable no-use-before-define */
|
|
15
|
+
function configChunkHierarchyPlugin(options) {
|
|
16
|
+
if (options.chunkGraph.enable && (0, _modeUtils.isProductionMode)(options.mode)) {
|
|
17
|
+
return new _ChunkHierarchyPlugin.default(options.chunkGraph.fileName);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.configInjectChunkGraphPlugin = configInjectChunkGraphPlugin;
|
|
7
|
+
|
|
8
|
+
var _InjectChunkGraphPlugin = _interopRequireDefault(require("../custom_plugins/InjectChunkGraphPlugin"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
function configInjectChunkGraphPlugin(options) {
|
|
13
|
+
const {
|
|
14
|
+
resourceHints
|
|
15
|
+
} = options;
|
|
16
|
+
|
|
17
|
+
if (resourceHints.enable) {
|
|
18
|
+
return new _InjectChunkGraphPlugin.default(resourceHints);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
@@ -14,8 +14,12 @@ function configResourceHintsPlugin(options) {
|
|
|
14
14
|
publicPath,
|
|
15
15
|
resourceHints
|
|
16
16
|
} = options;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
|
|
18
|
+
if (resourceHints.enable) {
|
|
19
|
+
return new _ResourceHintsPlugin.default({
|
|
20
|
+
publicPath: JSON.stringify(publicPath)
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return null;
|
|
21
25
|
}
|
|
@@ -51,10 +51,14 @@ var _configMurphyInjectorPlugin = require("./pluginConfigs/configMurphyInjectorP
|
|
|
51
51
|
|
|
52
52
|
var _configCustomScriptLoadingStrategyPlugin = require("./pluginConfigs/configCustomScriptLoadingStrategyPlugin");
|
|
53
53
|
|
|
54
|
+
var _configChunkHierarchyPlugin = require("./pluginConfigs/configChunkHierarchyPlugin");
|
|
55
|
+
|
|
56
|
+
var _configInjectChunkGraphPlugin = require("./pluginConfigs/configInjectChunkGraphPlugin");
|
|
57
|
+
|
|
54
58
|
// import { IgnorePlugin } from 'webpack';
|
|
55
59
|
function plugins(options) {
|
|
56
60
|
const {
|
|
57
61
|
webpackPlugins
|
|
58
62
|
} = options;
|
|
59
|
-
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), ...webpackPlugins].filter(Boolean);
|
|
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);
|
|
60
64
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/client_build_tool",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"description": "A CLI tool to build web applications and client libraries",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
21
|
-
"url": "https://zgit.
|
|
21
|
+
"url": "https://zgit.csecz.zohocorpin.com/zohodesk/react-cli.git"
|
|
22
22
|
},
|
|
23
23
|
"keywords": [
|
|
24
24
|
"buildtool",
|
|
@@ -32,6 +32,7 @@
|
|
|
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",
|
|
35
36
|
"@zohodesk/client_packages_group": "1.0.2",
|
|
36
37
|
"babel-loader": "9.1.2",
|
|
37
38
|
"babel-plugin-module-resolver": "5.0.2",
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.validateI18nChunkSplitOptions = validateI18nChunkSplitOptions;
|
|
7
|
-
exports.validateI18nIndexingOptions = validateI18nIndexingOptions;
|
|
8
|
-
exports.validateI18nOptions = validateI18nOptions;
|
|
9
|
-
exports.validateRequiredFields = validateRequiredFields;
|
|
10
|
-
exports.validateTemplateFormat = validateTemplateFormat;
|
|
11
|
-
const LOCALE_PLACEHOLDER = '[locale]';
|
|
12
|
-
const REQUIRED_OPTIONS = ['jsResourcePath', 'propertiesFolderPath', 'numericMapPath'];
|
|
13
|
-
|
|
14
|
-
function validateRequiredFields(options, requiredFields) {
|
|
15
|
-
const missingOptions = requiredFields.filter(opt => {
|
|
16
|
-
const value = options[opt];
|
|
17
|
-
return value === undefined || value === null || typeof value === 'string' && value.trim() === '';
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
if (missingOptions.length > 0) {
|
|
21
|
-
throw new Error(`[I18nOptionsValidator] Missing required i18n options: ${missingOptions.join(', ')}`);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function validateTemplateFormat(template, templateName) {
|
|
26
|
-
if (!template || typeof template !== 'string') {
|
|
27
|
-
throw new Error(`[I18nOptionsValidator] ${templateName} must be a non-empty string`);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (!template.includes(LOCALE_PLACEHOLDER)) {
|
|
31
|
-
throw new Error(`[I18nOptionsValidator] ${templateName} must include ${LOCALE_PLACEHOLDER} placeholder`);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function validateI18nIndexingOptions(i18nOpts) {
|
|
36
|
-
if (!i18nOpts || typeof i18nOpts !== 'object') {
|
|
37
|
-
throw new Error('[I18nOptionsValidator] i18nIndexing configuration must be a valid object');
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (!i18nOpts.enable) {
|
|
41
|
-
return {
|
|
42
|
-
skipValidation: true
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
validateRequiredFields(i18nOpts, REQUIRED_OPTIONS);
|
|
47
|
-
const numericTemplate = i18nOpts.numericFilenameTemplate || '[locale]/numeric.i18n.js';
|
|
48
|
-
const dynamicTemplate = i18nOpts.dynamicFilenameTemplate || '[locale]/dynamic.i18n.js';
|
|
49
|
-
validateTemplateFormat(numericTemplate, 'numericFilenameTemplate');
|
|
50
|
-
validateTemplateFormat(dynamicTemplate, 'dynamicFilenameTemplate');
|
|
51
|
-
|
|
52
|
-
if (i18nOpts.singleFileTemplate) {
|
|
53
|
-
validateTemplateFormat(i18nOpts.singleFileTemplate, 'singleFileTemplate');
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const includeContentHash = i18nOpts.includeContentHash;
|
|
57
|
-
const injectHtml = i18nOpts.injectI18nUrlInIndex !== undefined ? i18nOpts.injectI18nUrlInIndex : true;
|
|
58
|
-
|
|
59
|
-
if (includeContentHash && injectHtml) {
|
|
60
|
-
throw new Error('[I18nOptionsValidator] includeContentHash and injectI18nUrlInIndex cannot both be true - content hash changes filenames dynamically but HTML injection needs static filenames');
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return {
|
|
64
|
-
skipValidation: false
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function validateI18nChunkSplitOptions(chunkSplitOpts) {
|
|
69
|
-
if (!chunkSplitOpts || typeof chunkSplitOpts !== 'object') {
|
|
70
|
-
throw new Error('[I18nOptionsValidator] i18nChunkSplit configuration must be a valid object');
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (!chunkSplitOpts.chunkSplitEnable || !chunkSplitOpts.useNumericIndexing) {
|
|
74
|
-
return {
|
|
75
|
-
skipValidation: true
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (!chunkSplitOpts.jsResource) {
|
|
80
|
-
throw new Error('[I18nOptionsValidator] Missing required jsResource in i18nChunkSplit options');
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (!chunkSplitOpts.numericMapPath) {
|
|
84
|
-
throw new Error('[I18nOptionsValidator] Missing required numericMapPath in i18nChunkSplit options');
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return {
|
|
88
|
-
skipValidation: false
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function validateI18nOptions(options) {
|
|
93
|
-
if (!options || typeof options !== 'object') {
|
|
94
|
-
throw new Error('[I18nOptionsValidator] Options must be a valid object');
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const hasIndexing = options.i18nIndexing && options.i18nIndexing.enable;
|
|
98
|
-
const hasChunkSplit = options.i18nChunkSplit && options.i18nChunkSplit.chunkSplitEnable && options.i18nChunkSplit.useNumericIndexing;
|
|
99
|
-
|
|
100
|
-
if (!hasIndexing && !hasChunkSplit) {
|
|
101
|
-
throw new Error('[I18nOptionsValidator] i18n validation requires either i18nIndexing to be enabled or i18nChunkSplit with useNumericIndexing');
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if (hasIndexing) {
|
|
105
|
-
const result = validateI18nIndexingOptions(options.i18nIndexing);
|
|
106
|
-
|
|
107
|
-
if (result.skipValidation) {
|
|
108
|
-
throw new Error('[I18nOptionsValidator] i18nIndexing is not properly enabled');
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (hasChunkSplit) {
|
|
113
|
-
const result = validateI18nChunkSplitOptions(options.i18nChunkSplit);
|
|
114
|
-
|
|
115
|
-
if (result.skipValidation) {
|
|
116
|
-
throw new Error('[I18nOptionsValidator] i18nChunkSplit is not properly configured');
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return true;
|
|
121
|
-
}
|