@zohodesk/react-cli 1.1.20-exp.1 → 1.1.20-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/README.md CHANGED
@@ -44,26 +44,6 @@ Now to run app
44
44
 
45
45
  # Change Logs
46
46
 
47
- # 1.1.20-exp.1
48
-
49
- **Changes**
50
-
51
- - Added memory leak fixes for script, links tags
52
-
53
- **Feature**
54
- - Custom Script loading strategy support for initial html script tags.
55
-
56
- # 1.1.19-exp.18
57
-
58
- **Changes**
59
-
60
- - To do further build size optimization by utilizing webpack provided config.
61
-
62
- ```
63
- innerGraph: true,
64
- usedExports: true,
65
- sideEffects: true
66
- ```
67
47
  # 1.1.19 (27-5-2024)
68
48
 
69
49
  **Feature**
@@ -27,15 +27,24 @@ let getEntries = (appSchemas, mode) => {
27
27
  } = appSchemas.efc;
28
28
  const hasEFC = newOptionForEnableEFC || prevOptionForEnableEFC;
29
29
  let mainJs = [];
30
+ let payloadJs = [];
30
31
  let entry = {
31
- main: mainJs
32
+ main: mainJs,
33
+ payload: payloadJs
32
34
  };
33
35
 
34
- if (mode === 'dev' || mode === 'dev-no-warn') {
35
- mainJs.push(`${_path.default.join(__dirname, '..', 'templates', 'WMSTemplate')}?wmsPath=wss:${(0, _utils.getServerURL)(server)}`);
36
+ if (mode === 'dev' || mode === 'dev-no-warn') {// mainJs.push(
37
+ // `${path.join(
38
+ // __dirname,
39
+ // '..',
40
+ // 'templates',
41
+ // 'WMSTemplate'
42
+ // )}?wmsPath=wss:${getServerURL(server)}`
43
+ // );
36
44
  }
37
45
 
38
46
  mainJs.push(_path.default.join(appPath, folder, isReactMig ? 'migration.js' : 'index.js'));
47
+ payloadJs.push(_path.default.join(appPath, folder, '_utils', 'payloadEncryption.js'));
39
48
 
40
49
  if (hasWidget) {
41
50
  entry.widget = [_path.default.join(appPath, folder, 'widget.js')];
@@ -102,10 +102,7 @@ module.exports = {
102
102
  // exclude: /\/smap/
103
103
  // })
104
104
  // ],
105
- moduleIds: 'named',
106
- usedExports: true,
107
- // innerGraph: true, // this property present on webpack 5
108
- sideEffects: true
105
+ moduleIds: 'named'
109
106
  },
110
107
  stats: {
111
108
  children: false,
@@ -19,32 +19,32 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
19
19
  /* import WebWorkerTemplatePlugin from 'webpack/lib/webworker/WebWorkerTemplatePlugin';
20
20
  import ExternalsPlugin from 'webpack/lib/ExternalsPlugin'; */
21
21
  const schema = {
22
- type: 'object',
23
- properties: {
24
- publicPath: {
25
- anyOf: [{
26
- type: 'string'
22
+ 'type': 'object',
23
+ 'properties': {
24
+ 'publicPath': {
25
+ 'anyOf': [{
26
+ 'type': 'string'
27
27
  }, {
28
- instanceof: 'Function'
28
+ 'instanceof': 'Function'
29
29
  }]
30
30
  },
31
- filename: {
32
- anyOf: [{
33
- type: 'string',
34
- minLength: 1
31
+ 'filename': {
32
+ 'anyOf': [{
33
+ 'type': 'string',
34
+ 'minLength': 1
35
35
  }, {
36
- instanceof: 'Function'
36
+ 'instanceof': 'Function'
37
37
  }]
38
38
  },
39
- chunkFilename: {
40
- type: 'string',
41
- minLength: 1
39
+ 'chunkFilename': {
40
+ 'type': 'string',
41
+ 'minLength': 1
42
42
  },
43
- esModule: {
44
- type: 'boolean'
43
+ 'esModule': {
44
+ 'type': 'boolean'
45
45
  }
46
46
  },
47
- additionalProperties: false
47
+ 'additionalProperties': false
48
48
  }; // eslint-disable-next-line
49
49
 
50
50
  function loader() {}
@@ -112,40 +112,25 @@ function pitch(request) {
112
112
  }
113
113
 
114
114
  function workerCode() {
115
- if (this.workerInstance) {
116
- return this.workerInstance;
117
- }
118
-
119
115
  let blob;
120
116
 
121
117
  try {
122
118
  blob = new Blob([`importScripts('${this.workerUrl}');`], {
123
- type: 'application/javascript'
119
+ 'type': 'application/javascript'
124
120
  });
125
121
  } catch (e1) {
126
122
  throw new Error(e1);
127
123
  }
128
124
 
129
- const url = window.URL || window.webkitURL;
130
- const blobUrl = url.createObjectURL(blob);
131
- this.workerInstance = new Worker(blobUrl);
132
- return this.workerInstance;
125
+ let url = window.URL || window.webkitURL;
126
+ let blobUrl = url.createObjectURL(blob);
127
+ let worker = new Worker(blobUrl);
128
+ return worker;
133
129
  }
134
130
 
135
- return cb(null, `const workerObj ={\n
136
- workerInstance: null, \n
131
+ return cb(null, `${options.esModule ? 'export default' : 'module.exports ='} {\n
137
132
  workerUrl: __webpack_public_path__ + ${JSON.stringify(entry)}, \n
138
133
  getInstance: ${workerCode} \n
139
- };\n
140
- workerObj.getInstance();
141
- ${options.esModule ? 'export default' : 'module.exports ='} workerObj;
142
- `); // return cb(
143
- // null,
144
- // `${options.esModule ? 'export default' : 'module.exports ='} {\n
145
- // workerInstance: null, \n
146
- // workerUrl: __webpack_public_path__ + ${JSON.stringify(entry)}, \n
147
- // getInstance: ${workerCode} \n
148
- // }`
149
- // );
134
+ }`);
150
135
  });
151
136
  }
@@ -13,10 +13,6 @@ var _htmlWebpackInjectAttributesPlugin = _interopRequireDefault(require("html-we
13
13
 
14
14
  var _common = require("../common");
15
15
 
16
- var _utils = require("../utils");
17
-
18
- var _CustomScriptLoadingStrategyPlugin = _interopRequireDefault(require("../plugins/CustomScriptLoadingStrategyPlugin"));
19
-
20
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
17
 
22
18
  const defaultHTMLMiniFyOption = {
@@ -30,47 +26,6 @@ const defaultHTMLMiniFyOption = {
30
26
  removeStyleLinkTypeAttributes: true,
31
27
  useShortDoctype: true
32
28
  };
33
- const defaultScriptLoadingStrategy = 'defer';
34
- const allowedScriptLoadingStrategies = ['blocking', 'defer', 'async', 'module'];
35
-
36
- function isAllowedScriptLoadingStrategyUsed(scriptLoadingStategey) {
37
- return allowedScriptLoadingStrategies.includes(scriptLoadingStategey);
38
- }
39
-
40
- function getScriptLoadingStrategyForStringType(scriptLoadingStategey) {
41
- if (isAllowedScriptLoadingStrategyUsed(scriptLoadingStategey)) {
42
- return scriptLoadingStategey;
43
- }
44
-
45
- return defaultScriptLoadingStrategy;
46
- }
47
-
48
- function getScriptLoadingStrategyForObject(scriptLoadingStategey) {
49
- if (Object.keys(scriptLoadingStategey).length === 0) {
50
- return defaultScriptLoadingStrategy;
51
- }
52
-
53
- const isAllowedScriptLoadingStrategy = Object.keys(scriptLoadingStategey).every(key => isAllowedScriptLoadingStrategyUsed(key));
54
-
55
- if (isAllowedScriptLoadingStrategy) {
56
- return Object.assign({}, scriptLoadingStategey);
57
- }
58
-
59
- console.warn('un supported script loading strategy used', scriptLoadingStategey);
60
- return defaultScriptLoadingStrategy;
61
- }
62
-
63
- function getScriptLoadingStrategy(scriptLoadingStategey) {
64
- if ((0, _utils.getTypeOf)(scriptLoadingStategey) === 'string') {
65
- return getScriptLoadingStrategyForStringType(scriptLoadingStategey);
66
- }
67
-
68
- if ((0, _utils.getTypeOf)(scriptLoadingStategey) === 'object') {
69
- return getScriptLoadingStrategyForObject(scriptLoadingStategey);
70
- }
71
-
72
- return 'defer';
73
- }
74
29
 
75
30
  function configHtmlWebpackPlugins(plugins, {
76
31
  enableChunkHash = false,
@@ -78,8 +33,7 @@ function configHtmlWebpackPlugins(plugins, {
78
33
  inject,
79
34
  crossorigin,
80
35
  hasEFC,
81
- minify: minifyHtmlOptions = false,
82
- customScriptLoadingStrategey
36
+ minify: minifyHtmlOptions = false
83
37
  }) {
84
38
  const optionsHtmlWebpack = {
85
39
  chunksSortMode: 'none',
@@ -102,16 +56,4 @@ function configHtmlWebpackPlugins(plugins, {
102
56
  crossorigin && plugins.push(new _htmlWebpackInjectAttributesPlugin.default({
103
57
  crossorigin: 'anonymous'
104
58
  }));
105
-
106
- if (customScriptLoadingStrategey) {
107
- console.log('script loading stategy', customScriptLoadingStrategey);
108
- const currentScriptLoadingStrategy = getScriptLoadingStrategy(customScriptLoadingStrategey);
109
- console.log('currentscriptloading strategy', currentScriptLoadingStrategy);
110
-
111
- if ((0, _utils.getTypeOf)(currentScriptLoadingStrategy) === 'object') {
112
- plugins.push(new _CustomScriptLoadingStrategyPlugin.default({
113
- scriptLoadingStategey: currentScriptLoadingStrategy
114
- }));
115
- }
116
- }
117
59
  }
@@ -37,8 +37,6 @@ var _configHtmlWebpackPlugins = require("./configHtmlWebpackPlugins");
37
37
 
38
38
  var _EfcResourceCleanupPlugin = _interopRequireDefault(require("../plugins/EfcResourceCleanupPlugin"));
39
39
 
40
- var _EventsHandlingPlugin = require("../plugins/EventsHandlingPlugin");
41
-
42
40
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
43
41
 
44
42
  // import { windowsModification } from '../loaderUtils/windowsModification';
@@ -62,8 +60,7 @@ const getDevPlugins = (options, publicPath) => {
62
60
  mode
63
61
  },
64
62
  htmlTemplate: {
65
- inject,
66
- customScriptLoadingStrategey
63
+ inject
67
64
  },
68
65
  crossorigin
69
66
  },
@@ -169,8 +166,7 @@ const getDevPlugins = (options, publicPath) => {
169
166
  minify: false,
170
167
  inject,
171
168
  crossorigin,
172
- hasEFC,
173
- customScriptLoadingStrategey
169
+ hasEFC
174
170
  });
175
171
 
176
172
  if (hasEFC) {
@@ -221,13 +217,12 @@ const getDevPlugins = (options, publicPath) => {
221
217
  exclude: exclude.selectorWeight,
222
218
  patterns
223
219
  }));
224
- }
225
-
226
- pluginsArr.push(new _EventsHandlingPlugin.EventsHandlingPlugin()); // if (pluginObject.minifier) {
220
+ } // if (pluginObject.minifier) {
227
221
  // // console.log('minifier active');
228
222
  // pluginsArr.push(new MinifierPlugin());
229
223
  // }
230
224
 
225
+
231
226
  return pluginsArr.filter(Boolean);
232
227
  };
233
228
 
@@ -27,8 +27,6 @@ var _VariableConversionCollector = _interopRequireDefault(require("../plugins/Va
27
27
 
28
28
  var _SelectorPlugin = _interopRequireDefault(require("../plugins/SelectorPlugin"));
29
29
 
30
- var _EventsHandlingPlugin = require("../plugins/EventsHandlingPlugin");
31
-
32
30
  var _plugins = require("../plugins");
33
31
 
34
32
  var _CustomAttributePlugin = require("../plugins/CustomAttributePlugin");
@@ -80,8 +78,7 @@ const getProdPlugins = (options, publicPath = '') => {
80
78
  } = options.app;
81
79
  const {
82
80
  inject,
83
- minify: minifyHtmlOptions,
84
- customScriptLoadingStrategey
81
+ minify: minifyHtmlOptions
85
82
  } = htmlTemplate;
86
83
  const {
87
84
  i18n
@@ -179,7 +176,6 @@ const getProdPlugins = (options, publicPath = '') => {
179
176
  folder,
180
177
  inject,
181
178
  minify: minifyHtmlOptions,
182
- customScriptLoadingStrategey,
183
179
  crossorigin,
184
180
  hasEFC
185
181
  });
@@ -310,7 +306,6 @@ const getProdPlugins = (options, publicPath = '') => {
310
306
  statsOutputExcludeKeys,
311
307
  statsFileName
312
308
  }));
313
- pluginsArr.push(new _EventsHandlingPlugin.EventsHandlingPlugin());
314
309
  return pluginsArr;
315
310
  };
316
311
 
@@ -228,12 +228,8 @@ class I18nDownlodLogic {
228
228
  if(dataSrc === srcPath || dataSrc === fullsrcPath){ return resolve();}
229
229
  }
230
230
  var scriptTag = document.createElement("script");
231
- scriptTag.onload = () => {
232
- scriptTag.onerror = scriptTag.onload = null;
233
- resolve();
234
- };
231
+ scriptTag.onload = resolve;
235
232
  scriptTag.onerror = function(event) {
236
- scriptTag.onerror = scriptTag.onload = null;
237
233
  var request = event && event.target && event.target.src || fullsrcPath;
238
234
  var err = new Error("Loading I18N chunk " + chunkId + " failed.\\n(" + request + ")");
239
235
  err.code = "I18N_CHUNK_LOAD_FAILED";
@@ -322,8 +322,7 @@ var _default = {
322
322
  },
323
323
  htmlTemplate: {
324
324
  minify: null,
325
- inject: true,
326
- customScriptLoadingStrategey: null
325
+ inject: true
327
326
  },
328
327
  removePropTypes: false,
329
328
  customChunksBaseConfig: null,
@@ -167,20 +167,6 @@ var _getComponents = _interopRequireDefault(require("./getComponents"));
167
167
 
168
168
  var _ssTestHack = _interopRequireDefault(require("./ssTestHack"));
169
169
 
170
- var _typeCheck = require("./typeCheck");
171
-
172
- Object.keys(_typeCheck).forEach(function (key) {
173
- if (key === "default" || key === "__esModule") return;
174
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
175
- if (key in exports && exports[key] === _typeCheck[key]) return;
176
- Object.defineProperty(exports, key, {
177
- enumerable: true,
178
- get: function () {
179
- return _typeCheck[key];
180
- }
181
- });
182
- });
183
-
184
170
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
185
171
 
186
172
  // eslint-disable-next-line no-duplicate-imports
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@zohodesk/react-cli",
3
- "version": "1.1.20-exp.1",
3
+ "version": "1.1.18-exp.1",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@zohodesk/react-cli",
9
- "version": "1.1.20-exp.1",
9
+ "version": "1.1.18-exp.1",
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
12
  "@babel/cli": "7.10.5",
@@ -4554,7 +4554,6 @@
4554
4554
  "version": "2.7.1",
4555
4555
  "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
4556
4556
  "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
4557
- "deprecated": "Rimraf versions prior to v4 are no longer supported",
4558
4557
  "dependencies": {
4559
4558
  "glob": "^7.1.3"
4560
4559
  },
@@ -5223,7 +5222,6 @@
5223
5222
  "version": "1.0.5",
5224
5223
  "resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz",
5225
5224
  "integrity": "sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A==",
5226
- "deprecated": "This package is no longer supported.",
5227
5225
  "dependencies": {
5228
5226
  "aproba": "^1.1.1",
5229
5227
  "fs-write-stream-atomic": "^1.0.8",
@@ -5237,7 +5235,6 @@
5237
5235
  "version": "2.7.1",
5238
5236
  "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
5239
5237
  "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
5240
- "deprecated": "Rimraf versions prior to v4 are no longer supported",
5241
5238
  "dependencies": {
5242
5239
  "glob": "^7.1.3"
5243
5240
  },
@@ -7587,7 +7584,6 @@
7587
7584
  "version": "2.6.3",
7588
7585
  "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz",
7589
7586
  "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==",
7590
- "deprecated": "Rimraf versions prior to v4 are no longer supported",
7591
7587
  "dependencies": {
7592
7588
  "glob": "^7.1.3"
7593
7589
  },
@@ -7731,7 +7727,6 @@
7731
7727
  "version": "1.0.10",
7732
7728
  "resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz",
7733
7729
  "integrity": "sha512-gehEzmPn2nAwr39eay+x3X34Ra+M2QlVUTLhkXPjWdeO8RF9kszk116avgBJM3ZyNHgHXBNx+VmPaFC36k0PzA==",
7734
- "deprecated": "This package is no longer supported.",
7735
7730
  "dependencies": {
7736
7731
  "graceful-fs": "^4.1.2",
7737
7732
  "iferr": "^0.1.5",
@@ -8075,7 +8070,6 @@
8075
8070
  "version": "7.2.3",
8076
8071
  "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
8077
8072
  "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
8078
- "deprecated": "Glob versions prior to v9 are no longer supported",
8079
8073
  "dependencies": {
8080
8074
  "fs.realpath": "^1.0.0",
8081
8075
  "inflight": "^1.0.4",
@@ -8226,7 +8220,6 @@
8226
8220
  "version": "7.1.7",
8227
8221
  "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz",
8228
8222
  "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==",
8229
- "deprecated": "Glob versions prior to v9 are no longer supported",
8230
8223
  "dependencies": {
8231
8224
  "fs.realpath": "^1.0.0",
8232
8225
  "inflight": "^1.0.4",
@@ -9108,7 +9101,6 @@
9108
9101
  "version": "1.0.6",
9109
9102
  "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
9110
9103
  "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
9111
- "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.",
9112
9104
  "dependencies": {
9113
9105
  "once": "^1.3.0",
9114
9106
  "wrappy": "1"
@@ -12746,7 +12738,6 @@
12746
12738
  "version": "1.0.1",
12747
12739
  "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz",
12748
12740
  "integrity": "sha512-hdrFxZOycD/g6A6SoI2bB5NA/5NEqD0569+S47WZhPvm46sD50ZHdYaFmnua5lndde9rCHGjmfK7Z8BuCt/PcQ==",
12749
- "deprecated": "This package is no longer supported.",
12750
12741
  "dependencies": {
12751
12742
  "aproba": "^1.1.1",
12752
12743
  "copy-concurrently": "^1.0.0",
@@ -12760,7 +12751,6 @@
12760
12751
  "version": "2.7.1",
12761
12752
  "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
12762
12753
  "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
12763
- "deprecated": "Rimraf versions prior to v4 are no longer supported",
12764
12754
  "dependencies": {
12765
12755
  "glob": "^7.1.3"
12766
12756
  },
@@ -15689,7 +15679,6 @@
15689
15679
  "version": "3.0.2",
15690
15680
  "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
15691
15681
  "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
15692
- "deprecated": "Rimraf versions prior to v4 are no longer supported",
15693
15682
  "dependencies": {
15694
15683
  "glob": "^7.1.3"
15695
15684
  },
@@ -15811,8 +15800,7 @@
15811
15800
  "node_modules/safe-require": {
15812
15801
  "version": "1.0.4",
15813
15802
  "resolved": "https://registry.npmjs.org/safe-require/-/safe-require-1.0.4.tgz",
15814
- "integrity": "sha512-1elAbSH1u7HVMfbuqktLWAN0wMOeT+FnJVqMhBgEJLvL95m+KT433tiJdGMV1e3TstQXRt1YrKQDRBu0Kpk4WA==",
15815
- "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."
15803
+ "integrity": "sha512-1elAbSH1u7HVMfbuqktLWAN0wMOeT+FnJVqMhBgEJLvL95m+KT433tiJdGMV1e3TstQXRt1YrKQDRBu0Kpk4WA=="
15816
15804
  },
15817
15805
  "node_modules/safer-buffer": {
15818
15806
  "version": "2.1.2",
@@ -15929,7 +15917,6 @@
15929
15917
  "version": "2.7.1",
15930
15918
  "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
15931
15919
  "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
15932
- "deprecated": "Rimraf versions prior to v4 are no longer supported",
15933
15920
  "dependencies": {
15934
15921
  "glob": "^7.1.3"
15935
15922
  },
@@ -18046,7 +18033,6 @@
18046
18033
  "version": "7.1.7",
18047
18034
  "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz",
18048
18035
  "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==",
18049
- "deprecated": "Glob versions prior to v9 are no longer supported",
18050
18036
  "dependencies": {
18051
18037
  "fs.realpath": "^1.0.0",
18052
18038
  "inflight": "^1.0.4",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/react-cli",
3
- "version": "1.1.20-exp.1",
3
+ "version": "1.1.20-exp.2",
4
4
  "description": "A CLI tool for build modern web application and libraries",
5
5
  "scripts": {
6
6
  "init": "node ./lib/utils/init.js",
@@ -1,111 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _htmlWebpackPlugin = _interopRequireDefault(require("html-webpack-plugin"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
- const pluginName = 'CustomScriptLoadingStrategyPlugin';
13
-
14
- class CustomScriptLoadingStrategyPlugin {
15
- constructor({
16
- scriptLoadingStategey
17
- } = {}) {
18
- this.scriptLoadingStrategy = scriptLoadingStategey;
19
- }
20
-
21
- getFileNameFromTagSrc(src) {
22
- const fileNameArr = src.split('/');
23
- return fileNameArr[fileNameArr.length - 1];
24
- }
25
-
26
- addAttributestToTag(tag, attributes) {
27
- tag.attributes = Object.assign({}, tag.attributes, attributes);
28
- }
29
-
30
- matchFileName(tag, fileName) {
31
- return fileName.test(this.getFileNameFromTagSrc(tag.attributes.src));
32
- }
33
-
34
- blockingStrategy(tag) {
35
- delete tag.attributes.defer;
36
- delete tag.attributes.async;
37
- }
38
-
39
- deferStrategy(tag) {
40
- delete tag.attributes.async;
41
- }
42
-
43
- asyncStrategy(tag) {
44
- delete tag.attributes.defer;
45
- }
46
-
47
- moduleStrategy(tag) {
48
- this.deferStrategy(tag);
49
- }
50
-
51
- matchStrategy(scriptLoadingStrategy, tag) {
52
- if (scriptLoadingStrategy === 'blocking') {
53
- this.blockingStrategy(tag);
54
- }
55
-
56
- if (scriptLoadingStrategy === 'defer') {
57
- this.deferStrategy(tag);
58
- }
59
-
60
- if (scriptLoadingStrategy === 'async') {
61
- this.asyncStrategy(tag);
62
- }
63
-
64
- if (scriptLoadingStrategy === 'module') {
65
- this.moduleStrategy(tag);
66
- }
67
- }
68
-
69
- matchAndApplyCustomLoadingStrategyToScripts(tags) {
70
- Object.keys(this.scriptLoadingStrategy).forEach(scriptLoadingStrategy => {
71
- console.log('sc', scriptLoadingStrategy);
72
- const filesToMatch = this.scriptLoadingStrategy[scriptLoadingStrategy];
73
- tags.forEach(tag => {
74
- if (tag.attributes.src) {
75
- const isFileMatch = filesToMatch.some(fileName => this.matchFileName(tag, fileName));
76
-
77
- if (isFileMatch) {
78
- this.matchStrategy(scriptLoadingStrategy, tag);
79
- this.addAttributestToTag(tag, {
80
- [scriptLoadingStrategy]: true
81
- });
82
- }
83
- } // filesToMatch.forEach(fileName => {
84
- // if (!this.matchFileName(tag, fileName)) {
85
- // return;
86
- // }
87
- // this.matchStrategy(scriptLoadingStrategy, tag);
88
- // this.addAttributestToTag(tag, fileName, {
89
- // [scriptLoadingStrategy]: true
90
- // });
91
- // });
92
-
93
- });
94
- });
95
- }
96
-
97
- apply(compiler) {
98
- compiler.hooks.compilation.tap(pluginName, compilation => {
99
- _htmlWebpackPlugin.default.getHooks(compilation).alterAssetTagGroups.tapAsync(pluginName, (data, callback) => {
100
- const tags = [...data.bodyTags, ...data.headTags];
101
- console.log('tags', tags);
102
- this.matchAndApplyCustomLoadingStrategyToScripts(tags);
103
- console.log('tags after', tags);
104
- callback(null, data);
105
- });
106
- });
107
- }
108
-
109
- }
110
-
111
- exports.default = CustomScriptLoadingStrategyPlugin;
@@ -1,36 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.EventsHandlingPlugin = void 0;
7
-
8
- /* eslint-disable no-use-before-define */
9
- class EventsHandlingPlugin {
10
- constructor(options) {}
11
-
12
- apply(compiler) {
13
- console.log("hi"); // NOTE: we not using this, Reason currently this option is only need for EFC,
14
- // So it do not needed.
15
-
16
- compiler.hooks.thisCompilation.tap({
17
- name: 'CustomAttributePlugin',
18
- stage: 1,
19
- fn: compilation => {
20
- compilation.mainTemplate.hooks.requireEnsure.tap('CustomAttributePlugin', source => {
21
- // const str = attributeSetTemplate(cssAttributes, 'linkTag');
22
- const replacesourcedStr = source.replace('linkTag.onerror = function(event) {', 'linkTag.onerror = function(event) { linkTag.onerror = linkTag.onload = null');
23
- const re = replacesourcedStr.replace('linkTag.onload = resolve', `linkTag.onload = () => {
24
- linkTag.onerror = linkTag.onload = null;
25
- resolve();
26
- };`); // console.log({ s: source, r: replacedStr });
27
-
28
- return re;
29
- });
30
- }
31
- });
32
- }
33
-
34
- }
35
-
36
- exports.EventsHandlingPlugin = EventsHandlingPlugin;
@@ -1,10 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getTypeOf = getTypeOf;
7
-
8
- function getTypeOf(value) {
9
- return Object.prototype.toString.call(value).split(/\s/)[1].replace(/\]/, '').toLowerCase();
10
- }