@zohodesk/client_build_tool 0.0.14 → 0.0.15-exp.10
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/README.md +131 -0
- package/README_backup.md +131 -0
- package/lib/schemas/defaultConfigValues.js +2 -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 +3 -1
- package/npm-shrinkwrap.json +17 -2
- package/package.json +2 -1
- 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/README.md
CHANGED
|
@@ -425,6 +425,137 @@ For example
|
|
|
425
425
|
- `customAttributes` support for add attributes to html, link , script tag in the output build.
|
|
426
426
|
|
|
427
427
|
|
|
428
|
+
## v0.0.1 (18-04-2023)
|
|
429
|
+
|
|
430
|
+
First Release
|
|
431
|
+
**Features:-**
|
|
432
|
+
|
|
433
|
+
- 'start' command to run react app
|
|
434
|
+
- 'build' command to create build for react app
|
|
435
|
+
- 'build:lib' command to create lib for react library
|
|
436
|
+
- 'build:es' command to create es for react library
|
|
437
|
+
- 'templates' command to create es for react library
|
|
438
|
+
# Changelog and Release Notes
|
|
439
|
+
|
|
440
|
+
# v0.0.14 (06-10-2025)
|
|
441
|
+
|
|
442
|
+
**Feature:-**
|
|
443
|
+
- Added integrity and crossorigin attributes for all the js and css files in index.html
|
|
444
|
+
|
|
445
|
+
```enableSubResourceIntegrity: true
|
|
446
|
+
```
|
|
447
|
+
**Adjustments:-**
|
|
448
|
+
- add ts-loader to parse tsx and ts files
|
|
449
|
+
|
|
450
|
+
# v0.0.13 (02-09-2025)
|
|
451
|
+
|
|
452
|
+
**Adjustments:-**
|
|
453
|
+
- Source map files are created in the smap/ folder by default. However, they are also being created in the js/ folder to resolve the issue where Murphy was unable to locate them.
|
|
454
|
+
|
|
455
|
+
**Feature:-**
|
|
456
|
+
- Added support for Murphy to be built as a separate chunk and injected as the top script in the initial HTML.
|
|
457
|
+
- To enable this support , add this in your configuration
|
|
458
|
+
|
|
459
|
+
```murphyBootstrapHtml{
|
|
460
|
+
enable: true,
|
|
461
|
+
chunkName: '',
|
|
462
|
+
filePath: ''
|
|
463
|
+
}```
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
# v0.0.12 (14-08-2025)
|
|
468
|
+
|
|
469
|
+
- Fixed the initial i18n loading issue caused by using the same function in both the i18nRuntimeDealer plugin and decidePublicPath
|
|
470
|
+
|
|
471
|
+
# v0.0.11 (07-08-2025) (had an issue while enable i18n chunk split plugin)
|
|
472
|
+
- remove babel-plugin-module-resolver dependencies
|
|
473
|
+
|
|
474
|
+
**Adjustments:-**
|
|
475
|
+
- Public Folder configuration is separated for development and production
|
|
476
|
+
|
|
477
|
+
**Bug Fix:-**
|
|
478
|
+
- Fixed the issue where the build log was not visible when `stats (bundle integrity)` was enabled. The problem was resolved by adding an error check in the `bundleIntegrity plugin`.
|
|
479
|
+
- Removed the babel-plugin-module-resolver dependency to resolve the alias resolution issue in the application.
|
|
480
|
+
- Fixed the issue where a space in the variable name causes it to return an undefined value.
|
|
481
|
+
- Fixed the URL path generation issue that occurred while using context in the development setup.
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
# v0.0.10 (12-05-2025)
|
|
485
|
+
**Feature:-**
|
|
486
|
+
- `alias` support for `build:es` and `build:lib`
|
|
487
|
+
- Add babel-plugin-module-resolver dependencies
|
|
488
|
+
- Modify getBabelPlugin to include module resolver with aliases
|
|
489
|
+
|
|
490
|
+
**Bug Fix:-**
|
|
491
|
+
- Enhance runBabelForTSFile to handle both .tsx and .ts file extensions
|
|
492
|
+
- Update mockApiHandler to ensure mock function is called correctly
|
|
493
|
+
|
|
494
|
+
**Change:-**
|
|
495
|
+
- Refactor defaultConfigValues.js to include cli options for enableRTLSplit
|
|
496
|
+
|
|
497
|
+
## v0.0.9
|
|
498
|
+
|
|
499
|
+
**Feature:-**
|
|
500
|
+
- externals was added to Prevent bundling of certain imported packages and retrieve these external dependencies at runtime.
|
|
501
|
+
- to use externals, we use the following pattern in `app > externals` :
|
|
502
|
+
|
|
503
|
+
For example
|
|
504
|
+
```
|
|
505
|
+
externals: {
|
|
506
|
+
<key> : <value>
|
|
507
|
+
}
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
## v0.0.6 (4-09-2023)
|
|
511
|
+
|
|
512
|
+
**Feature:-**
|
|
513
|
+
- Generating bundle integrity report json file for the build assets only in production mode. To use this feature we need to add `stats > enable` or cli flags `enable_stats`.
|
|
514
|
+
- Added Resource Cleanup plugin to cleanup resource retained by build tool. this plugin is controlled by efc flag resourcecleanup flag.
|
|
515
|
+
- added support for using regex expression to get group of chunks chunkId via Resource Hint plugin prefetch/preload hook.
|
|
516
|
+
only will be activate when `resourceHints` => `allowPrefetchingMultipleChunks` as `true`
|
|
517
|
+
- added support for glob pattern for custom chunks split logic.
|
|
518
|
+
- added options to split chunks base config in the key `app` => `customChunksBaseConfig` as object
|
|
519
|
+
|
|
520
|
+
**Change:-**
|
|
521
|
+
- i18n name not generated issue fix.
|
|
522
|
+
- public path not correctly set issue fix.
|
|
523
|
+
- changing plugin hook stages in i18nRuntimePlugin and sourceMapPlugin
|
|
524
|
+
## v0.0.5 (6-08-2023)
|
|
525
|
+
|
|
526
|
+
**Changes:--**
|
|
527
|
+
- Typo fix in i18nRuntimeDealerPlugin.js
|
|
528
|
+
- fixing some bugs in resolvers.js file
|
|
529
|
+
|
|
530
|
+
## v0.0.3 (1-08-2023)
|
|
531
|
+
|
|
532
|
+
**Changes:--**
|
|
533
|
+
- `devtool` default value changed from `hidden-cheap-source-map` to `source-map`
|
|
534
|
+
- unwanted files deleted from build
|
|
535
|
+
|
|
536
|
+
**Issue Fix:--**
|
|
537
|
+
- The issue with the source map not being created in the build has been fixed."
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
## v0.0.2 (28-04-2023)
|
|
541
|
+
|
|
542
|
+
**Features:-**
|
|
543
|
+
|
|
544
|
+
- `devModeContentHashAllowedTypes` support added for some project there will be a need for hash even though they run dev mode. for details [details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/3.0.0/packages/client_build_tool/ConfigurationDocumentation.md#devModeContentHashAllowedTypes)
|
|
545
|
+
- `devLikeHash` support for disable content hash for file names in production mode. for details [details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/3.0.0/packages/client_build_tool/ConfigurationDocumentation.md#devLikeHash)
|
|
546
|
+
- `disableReactDevWarning` disable react dev warning such as prop-type warnings will be removed in dev mode build or server. for details [details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/3.0.0/packages/client_build_tool/ConfigurationDocumentation.md#disableReactDevWarning) can be enabled via `--disable_react_dev_warning` too.
|
|
547
|
+
- `statsLogConfig` support to customize default webpack log after build finished. for details [details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/3.0.0/packages/client_build_tool/ConfigurationDocumentation.md#statsLogConfig) can be enabled via `--disable_react_dev_warning` too.
|
|
548
|
+
- `enableChunkHash` renamed as `enableFileNameHashing`
|
|
549
|
+
|
|
550
|
+
- `pre_processor` command to run the preprocessor.js file.preProcessor runs in build, start, buildEs, buildLib commands bu default. and we have watch mode support as well with the option (`-w`)
|
|
551
|
+
- `createSeparateSmap` flag `source_map_enable` renamed as `enable_smap`
|
|
552
|
+
- `removeAttribute` option changes as `babelCustomizations.removeAttribute`
|
|
553
|
+
- `removePropTypes` support for remove the prop types package in the output build.
|
|
554
|
+
- `devConsoleExclude` support for remove the _console statements_ such as _console.log_, _console.warn_ in the output build.
|
|
555
|
+
- `manifestJson` default value set as false.
|
|
556
|
+
- `customAttributes` support for add attributes to html, link , script tag in the output build.
|
|
557
|
+
|
|
558
|
+
|
|
428
559
|
## v0.0.1 (18-04-2023)
|
|
429
560
|
|
|
430
561
|
First Release
|
package/README_backup.md
CHANGED
|
@@ -294,6 +294,137 @@ For example
|
|
|
294
294
|
- `customAttributes` support for add attributes to html, link , script tag in the output build.
|
|
295
295
|
|
|
296
296
|
|
|
297
|
+
## v0.0.1 (18-04-2023)
|
|
298
|
+
|
|
299
|
+
First Release
|
|
300
|
+
**Features:-**
|
|
301
|
+
|
|
302
|
+
- 'start' command to run react app
|
|
303
|
+
- 'build' command to create build for react app
|
|
304
|
+
- 'build:lib' command to create lib for react library
|
|
305
|
+
- 'build:es' command to create es for react library
|
|
306
|
+
- 'templates' command to create es for react library
|
|
307
|
+
# Changelog and Release Notes
|
|
308
|
+
|
|
309
|
+
# v0.0.14 (06-10-2025)
|
|
310
|
+
|
|
311
|
+
**Feature:-**
|
|
312
|
+
- Added integrity and crossorigin attributes for all the js and css files in index.html
|
|
313
|
+
|
|
314
|
+
```enableSubResourceIntegrity: true
|
|
315
|
+
```
|
|
316
|
+
**Adjustments:-**
|
|
317
|
+
- add ts-loader to parse tsx and ts files
|
|
318
|
+
|
|
319
|
+
# v0.0.13 (02-09-2025)
|
|
320
|
+
|
|
321
|
+
**Adjustments:-**
|
|
322
|
+
- Source map files are created in the smap/ folder by default. However, they are also being created in the js/ folder to resolve the issue where Murphy was unable to locate them.
|
|
323
|
+
|
|
324
|
+
**Feature:-**
|
|
325
|
+
- Added support for Murphy to be built as a separate chunk and injected as the top script in the initial HTML.
|
|
326
|
+
- To enable this support , add this in your configuration
|
|
327
|
+
|
|
328
|
+
```murphyBootstrapHtml{
|
|
329
|
+
enable: true,
|
|
330
|
+
chunkName: '',
|
|
331
|
+
filePath: ''
|
|
332
|
+
}```
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
# v0.0.12 (14-08-2025)
|
|
337
|
+
|
|
338
|
+
- Fixed the initial i18n loading issue caused by using the same function in both the i18nRuntimeDealer plugin and decidePublicPath
|
|
339
|
+
|
|
340
|
+
# v0.0.11 (07-08-2025) (had an issue while enable i18n chunk split plugin)
|
|
341
|
+
- remove babel-plugin-module-resolver dependencies
|
|
342
|
+
|
|
343
|
+
**Adjustments:-**
|
|
344
|
+
- Public Folder configuration is separated for development and production
|
|
345
|
+
|
|
346
|
+
**Bug Fix:-**
|
|
347
|
+
- Fixed the issue where the build log was not visible when `stats (bundle integrity)` was enabled. The problem was resolved by adding an error check in the `bundleIntegrity plugin`.
|
|
348
|
+
- Removed the babel-plugin-module-resolver dependency to resolve the alias resolution issue in the application.
|
|
349
|
+
- Fixed the issue where a space in the variable name causes it to return an undefined value.
|
|
350
|
+
- Fixed the URL path generation issue that occurred while using context in the development setup.
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
# v0.0.10 (12-05-2025)
|
|
354
|
+
**Feature:-**
|
|
355
|
+
- `alias` support for `build:es` and `build:lib`
|
|
356
|
+
- Add babel-plugin-module-resolver dependencies
|
|
357
|
+
- Modify getBabelPlugin to include module resolver with aliases
|
|
358
|
+
|
|
359
|
+
**Bug Fix:-**
|
|
360
|
+
- Enhance runBabelForTSFile to handle both .tsx and .ts file extensions
|
|
361
|
+
- Update mockApiHandler to ensure mock function is called correctly
|
|
362
|
+
|
|
363
|
+
**Change:-**
|
|
364
|
+
- Refactor defaultConfigValues.js to include cli options for enableRTLSplit
|
|
365
|
+
|
|
366
|
+
## v0.0.9
|
|
367
|
+
|
|
368
|
+
**Feature:-**
|
|
369
|
+
- externals was added to Prevent bundling of certain imported packages and retrieve these external dependencies at runtime.
|
|
370
|
+
- to use externals, we use the following pattern in `app > externals` :
|
|
371
|
+
|
|
372
|
+
For example
|
|
373
|
+
```
|
|
374
|
+
externals: {
|
|
375
|
+
<key> : <value>
|
|
376
|
+
}
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
## v0.0.6 (4-09-2023)
|
|
380
|
+
|
|
381
|
+
**Feature:-**
|
|
382
|
+
- Generating bundle integrity report json file for the build assets only in production mode. To use this feature we need to add `stats > enable` or cli flags `enable_stats`.
|
|
383
|
+
- Added Resource Cleanup plugin to cleanup resource retained by build tool. this plugin is controlled by efc flag resourcecleanup flag.
|
|
384
|
+
- added support for using regex expression to get group of chunks chunkId via Resource Hint plugin prefetch/preload hook.
|
|
385
|
+
only will be activate when `resourceHints` => `allowPrefetchingMultipleChunks` as `true`
|
|
386
|
+
- added support for glob pattern for custom chunks split logic.
|
|
387
|
+
- added options to split chunks base config in the key `app` => `customChunksBaseConfig` as object
|
|
388
|
+
|
|
389
|
+
**Change:-**
|
|
390
|
+
- i18n name not generated issue fix.
|
|
391
|
+
- public path not correctly set issue fix.
|
|
392
|
+
- changing plugin hook stages in i18nRuntimePlugin and sourceMapPlugin
|
|
393
|
+
## v0.0.5 (6-08-2023)
|
|
394
|
+
|
|
395
|
+
**Changes:--**
|
|
396
|
+
- Typo fix in i18nRuntimeDealerPlugin.js
|
|
397
|
+
- fixing some bugs in resolvers.js file
|
|
398
|
+
|
|
399
|
+
## v0.0.3 (1-08-2023)
|
|
400
|
+
|
|
401
|
+
**Changes:--**
|
|
402
|
+
- `devtool` default value changed from `hidden-cheap-source-map` to `source-map`
|
|
403
|
+
- unwanted files deleted from build
|
|
404
|
+
|
|
405
|
+
**Issue Fix:--**
|
|
406
|
+
- The issue with the source map not being created in the build has been fixed."
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
## v0.0.2 (28-04-2023)
|
|
410
|
+
|
|
411
|
+
**Features:-**
|
|
412
|
+
|
|
413
|
+
- `devModeContentHashAllowedTypes` support added for some project there will be a need for hash even though they run dev mode. for details [details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/3.0.0/packages/client_build_tool/ConfigurationDocumentation.md#devModeContentHashAllowedTypes)
|
|
414
|
+
- `devLikeHash` support for disable content hash for file names in production mode. for details [details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/3.0.0/packages/client_build_tool/ConfigurationDocumentation.md#devLikeHash)
|
|
415
|
+
- `disableReactDevWarning` disable react dev warning such as prop-type warnings will be removed in dev mode build or server. for details [details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/3.0.0/packages/client_build_tool/ConfigurationDocumentation.md#disableReactDevWarning) can be enabled via `--disable_react_dev_warning` too.
|
|
416
|
+
- `statsLogConfig` support to customize default webpack log after build finished. for details [details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/3.0.0/packages/client_build_tool/ConfigurationDocumentation.md#statsLogConfig) can be enabled via `--disable_react_dev_warning` too.
|
|
417
|
+
- `enableChunkHash` renamed as `enableFileNameHashing`
|
|
418
|
+
|
|
419
|
+
- `pre_processor` command to run the preprocessor.js file.preProcessor runs in build, start, buildEs, buildLib commands bu default. and we have watch mode support as well with the option (`-w`)
|
|
420
|
+
- `createSeparateSmap` flag `source_map_enable` renamed as `enable_smap`
|
|
421
|
+
- `removeAttribute` option changes as `babelCustomizations.removeAttribute`
|
|
422
|
+
- `removePropTypes` support for remove the prop types package in the output build.
|
|
423
|
+
- `devConsoleExclude` support for remove the _console statements_ such as _console.log_, _console.warn_ in the output build.
|
|
424
|
+
- `manifestJson` default value set as false.
|
|
425
|
+
- `customAttributes` support for add attributes to html, link , script tag in the output build.
|
|
426
|
+
|
|
427
|
+
|
|
297
428
|
## v0.0.1 (18-04-2023)
|
|
298
429
|
|
|
299
430
|
First Release
|
|
@@ -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__', `${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__
|
|
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)(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,12 @@ var _configMurphyInjectorPlugin = require("./pluginConfigs/configMurphyInjectorP
|
|
|
51
51
|
|
|
52
52
|
var _configCustomScriptLoadingStrategyPlugin = require("./pluginConfigs/configCustomScriptLoadingStrategyPlugin");
|
|
53
53
|
|
|
54
|
+
var _configInjectChunkGraphPlugin = require("./pluginConfigs/configInjectChunkGraphPlugin");
|
|
55
|
+
|
|
54
56
|
// import { IgnorePlugin } from 'webpack';
|
|
55
57
|
function plugins(options) {
|
|
56
58
|
const {
|
|
57
59
|
webpackPlugins
|
|
58
60
|
} = 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);
|
|
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, _configInjectChunkGraphPlugin.configInjectChunkGraphPlugin)(options), ...webpackPlugins].filter(Boolean);
|
|
60
62
|
}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/client_build_tool",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14-exp.3",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@zohodesk/client_build_tool",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.14-exp.3",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@babel/cli": "7.17.10",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"@babel/preset-env": "7.18.2",
|
|
15
15
|
"@babel/preset-react": "7.17.12",
|
|
16
16
|
"@babel/preset-typescript": "7.23.2",
|
|
17
|
+
"@zohodesk-private/client_dev_cert": "^1.0.6",
|
|
17
18
|
"@zohodesk/client_packages_group": "1.0.2",
|
|
18
19
|
"babel-loader": "9.1.2",
|
|
19
20
|
"babel-plugin-module-resolver": "5.0.2",
|
|
@@ -2483,6 +2484,15 @@
|
|
|
2483
2484
|
"resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz",
|
|
2484
2485
|
"integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ=="
|
|
2485
2486
|
},
|
|
2487
|
+
"node_modules/@zohodesk-private/client_dev_cert": {
|
|
2488
|
+
"version": "1.0.6",
|
|
2489
|
+
"resolved": "http://cm-npmregistry.csez.zohocorpin.com/@zohodesk-private%2fclient_dev_cert/-/client_dev_cert-1.0.6.tgz",
|
|
2490
|
+
"integrity": "sha512-WIupOy5tTEdJdIM7c8aCkAIXDxP3EuGrncc/USE4YSEibi7uyatqqgXH1QBQUMJBUDhBQhy1F8vlLF+Bd8pvRg==",
|
|
2491
|
+
"license": "ISC",
|
|
2492
|
+
"bin": {
|
|
2493
|
+
"cert_update": "src/cert-fallback.js"
|
|
2494
|
+
}
|
|
2495
|
+
},
|
|
2486
2496
|
"node_modules/@zohodesk/client_packages_group": {
|
|
2487
2497
|
"version": "1.0.2",
|
|
2488
2498
|
"resolved": "https://registry.npmjs.org/@zohodesk/client_packages_group/-/client_packages_group-1.0.2.tgz",
|
|
@@ -9778,6 +9788,11 @@
|
|
|
9778
9788
|
"resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz",
|
|
9779
9789
|
"integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ=="
|
|
9780
9790
|
},
|
|
9791
|
+
"@zohodesk-private/client_dev_cert": {
|
|
9792
|
+
"version": "1.0.6",
|
|
9793
|
+
"resolved": "http://cm-npmregistry.csez.zohocorpin.com/@zohodesk-private%2fclient_dev_cert/-/client_dev_cert-1.0.6.tgz",
|
|
9794
|
+
"integrity": "sha512-WIupOy5tTEdJdIM7c8aCkAIXDxP3EuGrncc/USE4YSEibi7uyatqqgXH1QBQUMJBUDhBQhy1F8vlLF+Bd8pvRg=="
|
|
9795
|
+
},
|
|
9781
9796
|
"@zohodesk/client_packages_group": {
|
|
9782
9797
|
"version": "1.0.2",
|
|
9783
9798
|
"resolved": "https://registry.npmjs.org/@zohodesk/client_packages_group/-/client_packages_group-1.0.2.tgz",
|