@zohodesk/react-cli 1.1.12 → 1.1.13

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 CHANGED
@@ -44,50 +44,24 @@ Now to run app
44
44
 
45
45
  # Change Logs
46
46
 
47
- # 1.1.12
48
-
49
- **Features**
50
- - Generating stats.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`.
51
- - Added Resource Cleanup plugin to cleanup resource retained by build tool. this plugin is controlled by custom attributes enable flag.
47
+ # 1.1.13 (4-9-2023)
52
48
 
53
49
  **Changes**
54
- - Added a new config `stats` to control stats file generation.
55
- - Using Existing custom attributes flag, we can control resource cleanup plugin.
56
50
 
57
- # 1.1.11-exp.6 (31-8-2023)
51
+ - Fixed the issue related to the resource cleanup plugin. (EfcResouceCleanupPlugin)
58
52
 
59
- **Features**
60
53
 
61
- - Added Resource Cleanup plugin to cleanup resource retained by build tool. this plugin is controlled by custom attributes enable flag.
62
-
63
- **Changes**
64
-
65
- - For stats plugin, added the separation of object manipulation method with converting object to string.
66
-
67
- # 1.1.11-exp.3 (22-8-2023)
68
-
69
- **Changes**
54
+ # 1.1.12 (1-9-2023)
70
55
 
71
- - Changed the default name of stats file to `build-report-integrity.json`
72
- - Added optimization to reduce the stats file creation time. like streaming.
73
- - Added support to exclude keys suggested
74
-
75
- # 1.1.11-exp.2 (11-8-2023)
76
-
77
- **Changes**
78
-
79
- - Added more customization support for `stats.json` output.
80
- - Disabling `bundle-analyser` stats report for our customized stats output based on a flag.
56
+ **Features**
81
57
 
82
- # 1.1.11-exp.1 (8-8-2023)
58
+ - Generating stats.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`.
59
+ - Added Resource Cleanup plugin to cleanup resource retained by build tool. this plugin is controlled by custom attributes enable flag.
83
60
 
84
61
  **Changes**
85
62
 
86
63
  - Added a new config `stats` to control stats file generation.
87
-
88
- **Features:-**
89
-
90
- - Generating stats.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`.
64
+ - Using Existing custom attributes flag, we can control resource cleanup plugin.
91
65
 
92
66
  # 1.1.11 (4-8-2023)
93
67
 
@@ -193,7 +193,9 @@ const getDevPlugins = (options, publicPath) => {
193
193
  }));
194
194
  instrumentScript && pluginsArr.push(new _plugins.ScriptInstrumentPlugin());
195
195
  customAttributes.enable && pluginsArr.push(new _CustomAttributePlugin.CustomAttributePlugin(customAttributes));
196
- customAttributes.enable && pluginsArr.push(new _EfcResourceCleanupPlugin.default(customAttributes));
196
+ customAttributes.enable && pluginsArr.push(new _EfcResourceCleanupPlugin.default(Object.assign({}, customAttributes, {
197
+ globalCacheObj: context
198
+ })));
197
199
  hasShadowDOM && pluginsArr.push(new _plugins.ShadowDOMSupportPlugin());
198
200
 
199
201
  if (devCssFileBountry) {
@@ -298,7 +298,9 @@ const getProdPlugins = (options, publicPath = '') => {
298
298
 
299
299
 
300
300
  customAttributes.enable && pluginsArr.push(new _CustomAttributePlugin.CustomAttributePlugin(customAttributes));
301
- customAttributes.enable && pluginsArr.push(new _EfcResourceCleanupPlugin.default(customAttributes));
301
+ customAttributes.enable && pluginsArr.push(new _EfcResourceCleanupPlugin.default(Object.assign({}, customAttributes, {
302
+ globalCacheObj: context
303
+ })));
302
304
  enableStats && pluginsArr.push(new _StatsPlugin.default({
303
305
  statsOptions,
304
306
  statsOutputExcludeKeys,
@@ -15,10 +15,14 @@ module.exports = class EfcResouceCleanupPlugin {
15
15
  mainTemplate
16
16
  }) => {
17
17
  mainTemplate.hooks.afterStartup.tap(plugInName, source => {
18
- const attributesArr = Object.entries(this.options.attributes);
18
+ const {
19
+ attributes,
20
+ globalCacheObj
21
+ } = this.options;
22
+ const attributesArr = Object.entries(attributes);
19
23
  const [[attributekey, attributeValue]] = attributesArr;
20
24
  const resourceSelector = `[${attributekey}="${attributeValue}"]`;
21
- return Template.asString([source, Template.indent([` jsonpArray.unInstall = function() {
25
+ return Template.asString([source, Template.indent([` window['${globalCacheObj}Jsonp'].unInstall = function() {
22
26
  Object.keys(installedModules).forEach(installedModulesKey => installedModules[installedModulesKey] = null);
23
27
  Object.keys(modules).forEach(moduleKey => modules[moduleKey] = null);
24
28
  `, `
@@ -27,11 +31,11 @@ module.exports = class EfcResouceCleanupPlugin {
27
31
  __webpack_require__.m = null;
28
32
  __webpack_require__.c = null;
29
33
 
30
- `, `
31
- const addedResources = document.querySelectorAll('${resourceSelector}');
32
- addedResources.forEach(addedResource => addedResource.remove());
33
- }
34
- `])]);
34
+ `, attributekey && attributeValue ? `
35
+ const addedResources = document.querySelectorAll('${resourceSelector}');
36
+ addedResources.forEach(addedResource => addedResource.remove());
37
+ }
38
+ ` : ''])]);
35
39
  });
36
40
  });
37
41
  }
@@ -20,13 +20,13 @@ const statsSchema = {
20
20
 
21
21
  class StatsPlugin {
22
22
  constructor({
23
- statsOptions = {},
24
- statsOutputExcludeKeys = [],
25
- statsFileName = 'bundle-report-integrity.json'
23
+ statsOptions,
24
+ statsOutputExcludeKeys,
25
+ statsFileName
26
26
  }) {
27
- this.excludeKeysInStat = statsOutputExcludeKeys;
28
- this.statsOptions = Object.assign({}, statsSchema, statsOptions);
29
- this.statsFileName = statsFileName;
27
+ this.excludeKeysInStat = statsOutputExcludeKeys || [];
28
+ this.statsFileName = statsFileName || 'bundle-report-integrity.json';
29
+ this.statsOptions = Object.assign({}, statsSchema, statsOptions || {});
30
30
  }
31
31
 
32
32
  apply(compiler) {
@@ -729,9 +729,9 @@ var _default = {
729
729
  value: false,
730
730
  cli: 'enable_stats'
731
731
  },
732
- fileName: undefined,
733
- options: undefined,
734
- excludeKeys: undefined
732
+ fileName: null,
733
+ options: null,
734
+ excludeKeys: null
735
735
  }
736
736
  };
737
737
  exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/react-cli",
3
- "version": "1.1.12",
3
+ "version": "1.1.13",
4
4
  "description": "A CLI tool for build modern web application and libraries",
5
5
  "scripts": {
6
6
  "init": "node ./lib/utils/init.js",