@zohodesk/react-cli 0.0.1-exp.161.2 → 0.0.1-exp.161.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. package/README.md +9 -48
  2. package/lib/common/index.js +6 -6
  3. package/lib/loaderUtils/index.js +4 -4
  4. package/lib/pluginUtils/getDevPlugins.js +0 -2
  5. package/lib/pluginUtils/getProdPlugins.js +0 -2
  6. package/lib/pluginUtils/index.js +12 -12
  7. package/lib/plugins/EFCPlugin.js +13 -43
  8. package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +2 -2
  9. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +1 -1
  10. package/lib/plugins/ManifestPlugin.js +0 -8
  11. package/lib/plugins/index.js +36 -36
  12. package/lib/postcss-plugins/RTLSplitPlugin.js +1 -1
  13. package/lib/schemas/index.js +0 -3
  14. package/lib/templates/linterConstant.js +1 -1
  15. package/lib/utils/cssClassNameGenerate.js +2 -9
  16. package/lib/utils/cssURLReplacer.js +1 -1
  17. package/lib/utils/index.js +19 -21
  18. package/lib/utils/jsonHelper.js +1 -1
  19. package/lib/utils/reinstallDependencies.js +1 -1
  20. package/package.json +4 -5
  21. package/lib/plugins/EFCTemplatePlugin.js +0 -151
  22. package/node_modules0/history/CHANGES.md +0 -395
  23. package/node_modules0/history/DOMUtils.js +0 -3
  24. package/node_modules0/history/ExecutionEnvironment.js +0 -3
  25. package/node_modules0/history/LICENSE +0 -21
  26. package/node_modules0/history/LocationUtils.js +0 -3
  27. package/node_modules0/history/PathUtils.js +0 -3
  28. package/node_modules0/history/README.md +0 -282
  29. package/node_modules0/history/cjs/history.js +0 -933
  30. package/node_modules0/history/cjs/history.min.js +0 -1
  31. package/node_modules0/history/createBrowserHistory.js +0 -3
  32. package/node_modules0/history/createHashHistory.js +0 -3
  33. package/node_modules0/history/createMemoryHistory.js +0 -3
  34. package/node_modules0/history/createTransitionManager.js +0 -3
  35. package/node_modules0/history/es/DOMUtils.js +0 -7
  36. package/node_modules0/history/es/ExecutionEnvironment.js +0 -7
  37. package/node_modules0/history/es/LocationUtils.js +0 -7
  38. package/node_modules0/history/es/PathUtils.js +0 -7
  39. package/node_modules0/history/es/createBrowserHistory.js +0 -7
  40. package/node_modules0/history/es/createHashHistory.js +0 -7
  41. package/node_modules0/history/es/createMemoryHistory.js +0 -7
  42. package/node_modules0/history/es/createTransitionManager.js +0 -7
  43. package/node_modules0/history/es/warnAboutDeprecatedESMImport.js +0 -35
  44. package/node_modules0/history/esm/history.js +0 -904
  45. package/node_modules0/history/index.js +0 -7
  46. package/node_modules0/history/package.json +0 -120
  47. package/node_modules0/history/umd/history.js +0 -1059
  48. package/node_modules0/history/umd/history.min.js +0 -1
  49. package/node_modules0/history/warnAboutDeprecatedCJSRequire.js +0 -35
@@ -21,16 +21,22 @@ var _exportNames = {
21
21
  getComponents: true,
22
22
  ssTestHack: true
23
23
  };
24
+ Object.defineProperty(exports, "getOptions", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _getOptions.default;
28
+ }
29
+ });
24
30
  Object.defineProperty(exports, "createEventStream", {
25
31
  enumerable: true,
26
32
  get: function () {
27
33
  return _createEventStream.default;
28
34
  }
29
35
  });
30
- Object.defineProperty(exports, "getComponents", {
36
+ Object.defineProperty(exports, "getServerURL", {
31
37
  enumerable: true,
32
38
  get: function () {
33
- return _getComponents.default;
39
+ return _getServerURL.default;
34
40
  }
35
41
  });
36
42
  Object.defineProperty(exports, "getCurrentBranch", {
@@ -39,23 +45,22 @@ Object.defineProperty(exports, "getCurrentBranch", {
39
45
  return _getCurrentBranch.default;
40
46
  }
41
47
  });
42
- Object.defineProperty(exports, "getDependenciesImpactList", {
48
+ Object.defineProperty(exports, "switchBranch", {
43
49
  enumerable: true,
44
50
  get: function () {
45
- return _getDependenciesImpactList.default;
51
+ return _switchBranch.default;
46
52
  }
47
53
  });
48
- exports.getLibraryConflict = exports.getInfoFromPublicPaths = void 0;
49
- Object.defineProperty(exports, "getOptions", {
54
+ Object.defineProperty(exports, "pullOrigin", {
50
55
  enumerable: true,
51
56
  get: function () {
52
- return _getOptions.default;
57
+ return _pullOrigin.default;
53
58
  }
54
59
  });
55
- Object.defineProperty(exports, "getServerURL", {
60
+ Object.defineProperty(exports, "request", {
56
61
  enumerable: true,
57
62
  get: function () {
58
- return _getServerURL.default;
63
+ return _request.default;
59
64
  }
60
65
  });
61
66
  Object.defineProperty(exports, "jsonHelper", {
@@ -64,17 +69,16 @@ Object.defineProperty(exports, "jsonHelper", {
64
69
  return _jsonHelper.default;
65
70
  }
66
71
  });
67
- exports.makeDir = exports.log = void 0;
68
- Object.defineProperty(exports, "pullOrigin", {
72
+ Object.defineProperty(exports, "getDependenciesImpactList", {
69
73
  enumerable: true,
70
74
  get: function () {
71
- return _pullOrigin.default;
75
+ return _getDependenciesImpactList.default;
72
76
  }
73
77
  });
74
- Object.defineProperty(exports, "request", {
78
+ Object.defineProperty(exports, "getComponents", {
75
79
  enumerable: true,
76
80
  get: function () {
77
- return _request.default;
81
+ return _getComponents.default;
78
82
  }
79
83
  });
80
84
  Object.defineProperty(exports, "ssTestHack", {
@@ -83,13 +87,7 @@ Object.defineProperty(exports, "ssTestHack", {
83
87
  return _ssTestHack.default;
84
88
  }
85
89
  });
86
- Object.defineProperty(exports, "switchBranch", {
87
- enumerable: true,
88
- get: function () {
89
- return _switchBranch.default;
90
- }
91
- });
92
- exports.writeFile = void 0;
90
+ exports.getLibraryConflict = exports.getInfoFromPublicPaths = exports.makeDir = exports.writeFile = exports.log = void 0;
93
91
 
94
92
  var _stream = require("stream");
95
93
 
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.setTestInfoStatus = exports.jsonHelper = exports.jsonConcate = exports.getRunnerDetail = exports.fileHandler = void 0;
6
+ exports.setTestInfoStatus = exports.jsonHelper = exports.jsonConcate = exports.fileHandler = exports.getRunnerDetail = void 0;
7
7
 
8
8
  let fs = require('fs');
9
9
 
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.reinstallDependencies1 = exports.reinstallDependencies = exports.collectPackageDiff = void 0;
6
+ exports.reinstallDependencies = exports.reinstallDependencies1 = exports.collectPackageDiff = void 0;
7
7
 
8
8
  var _fs = _interopRequireDefault(require("fs"));
9
9
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/react-cli",
3
- "version": "0.0.1-exp.161.2",
3
+ "version": "0.0.1-exp.161.3",
4
4
  "description": "A CLI tool for build modern web application and libraries",
5
5
  "scripts": {
6
6
  "init": "node ./lib/utils/init.js",
@@ -35,7 +35,7 @@
35
35
  "@babel/preset-env": "7.11.0",
36
36
  "@babel/preset-react": "7.10.4",
37
37
  "@babel/runtime": "7.11.2",
38
- "@zohodesk/datetimejs": "1.0.0-beta.7",
38
+ "@zohodesk/datetimejs": "1.0.0-exp.6.1",
39
39
  "@zohodesk/eslint-plugin-react-performance": "1.0.3",
40
40
  "@zohodesk/eslint-plugin-zsecurity": "0.0.1-beta.4",
41
41
  "@zohodesk/normalizer": "1.0.2",
@@ -55,7 +55,6 @@
55
55
  "copy-webpack-plugin": "5.1.2",
56
56
  "core-js": "3.6.5",
57
57
  "css-loader": "4.2.1",
58
- "debug": "4.3.3",
59
58
  "escodegen": "2.0.0",
60
59
  "eslint": "7.6.0",
61
60
  "eslint-html-reporter": "0.7.4",
@@ -94,9 +93,9 @@
94
93
  "postcss-loader": "3.0.0",
95
94
  "postcss-selector-replace": "1.0.2",
96
95
  "prop-types": "15.7.2",
97
- "react": "^16.8.6",
96
+ "react": "16.13.1",
98
97
  "react-dev-utils": "10.2.1",
99
- "react-dom": "^16.8.6",
98
+ "react-dom": "16.13.1",
100
99
  "react-error-overlay": "6.0.7",
101
100
  "react-redux": "7.2.1",
102
101
  "react-router": "5.2.0",
@@ -1,151 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _webpackSources = require("webpack-sources");
9
-
10
- var _utils = require("../utils");
11
-
12
- var _path = _interopRequireDefault(require("path"));
13
-
14
- var _fs = require("fs");
15
-
16
- var _getI18nFileUrlPathTemplate = require("./I18nSplitPlugin/utils/getI18nFileUrlPathTemplate");
17
-
18
- var _I18nKeysIdentifer = _interopRequireDefault(require("./I18nSplitPlugin/I18nKeysIdentifer"));
19
-
20
- var _replaceCssDirTemplate = require("./RtlSplitPlugin/replaceCssDirTemplate");
21
-
22
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
24
- // import { getShortI18nAssets } from './I18nSplitPlugin/utils/hashUtils';
25
- const cliOptions = (0, _utils.getOptions)();
26
- const {
27
- i18n: {
28
- chunkSplitEnable
29
- },
30
- css: {
31
- enableRTLSplit
32
- },
33
- efc: efcOptios
34
- } = cliOptions;
35
- const {
36
- createSDkFile
37
- } = efcOptios; // for smap relate changes
38
- // CdnChangePlugin
39
- // SourceMapHookPlugin
40
-
41
- class EFCTemplatePlugin {
42
- constructor(options = {}) {
43
- // console.log(' templateFilePath ', process.cwd(), options.templateFilePath, templateFilePath);
44
- this.templateFilePath = _path.default.join(process.cwd(), options.templateFilePath); // console.log(' templateFilePath ', this.templateFilePath);
45
-
46
- this.i18nFileNameTemplate = options.i18nFileNameTemplate;
47
- this.publicPath = options.publicPath; // NOTE: this logic may be needed for i18n splited file name with contenthash cases
48
- // this.i18nManifestFileName = options.i18nManifestFileName;
49
- // IMPORTANT: here we mergeing optionds from pacakge.json and options via constructor
50
- // So when debugging consider this as well
51
- // this.options = Object.assign({}, efcOptios, options);
52
-
53
- this.entryPointName = options.entryPointName || 'efc';
54
- this.outputFile = efcOptios.outputFile.replace('[version]', efcOptios.version);
55
- } // NOTE: this logic may be needed for i18n splited file name with contenthash cases
56
- // getI18nManifest(compilation) {
57
- // const i18nManifestFile =
58
- // compilation.assets[this.options.i18nManifestFileName];
59
- // if (i18nManifestFile) {
60
- // const manifest = JSON.parse(i18nManifestFile.source());
61
- // return manifest;
62
- // }
63
- // return {};
64
- // }
65
-
66
-
67
- getI18nAssetsStr(entryPoint, compilation) {
68
- // NOTE: we have used lang variable inside
69
- if (!chunkSplitEnable) {
70
- let i18nAsstes = {};
71
- let i18nFiles = Object.keys(compilation.assets).filter(assert => assert.indexOf(`i18n${_path.default.sep}`) !== -1); //hook for i18n url contains i18n/ may cause problem
72
-
73
- i18nAsstes = i18nFiles.reduce((res, i18nFilePath) => {
74
- let fileName = i18nFilePath.replace(`i18n${_path.default.sep}`, '');
75
- let splittedFileName = fileName.split('.');
76
- res[splittedFileName[0]] = i18nFilePath;
77
- return res;
78
- }, {});
79
- return `[${JSON.stringify(i18nAsstes)}[lang]]`;
80
- }
81
-
82
- let initalI18nAssets = entryPoint.chunks.filter(chunk => _I18nKeysIdentifer.default.isChunkHasI18n(chunk)).map(chunk => (0, _getI18nFileUrlPathTemplate.getI18nFileUrlPathTemplate)(compilation, chunk, this.i18nFileNameTemplate, '@locale@'));
83
- return `${JSON.stringify(initalI18nAssets)}.map(urlpath => urlpath.replace(/@locale@/g, lang))`;
84
- }
85
-
86
- templateReplacer(entryPoint, compilation) {
87
- const cssDirTemplate = '@dir@'; // const i18nManifest = this.getI18nManifest(compilation);
88
-
89
- const initialFiles = entryPoint.getFiles();
90
- const filteredInitialFiles = initialFiles.filter(file => /\.(css|js)$/.test(file));
91
- const initialJsFiles = filteredInitialFiles.filter(file => /\.js$/.test(file));
92
- let initialCssFiles = filteredInitialFiles.filter(file => /\.css$/.test(file));
93
-
94
- if (enableRTLSplit) {
95
- initialCssFiles = initialCssFiles.map(filePath => (0, _replaceCssDirTemplate.replaceCssDirTemplate)(filePath, cssDirTemplate));
96
- } // const i18nAssets = getShortI18nAssets(
97
- // entryPoint.chunks,
98
- // i18nManifest,
99
- // '' // i18nJsPath
100
- // );
101
-
102
-
103
- const initalI18nAssets = this.getI18nAssetsStr(entryPoint, compilation, '' // i18nJsPath
104
- );
105
- let templateStr = (0, _fs.readFileSync)(this.templateFilePath).toString();
106
- return templateStr.replace('((\'getInitalAssets\'))', `function getInitalAssets(assetsType, lang) {
107
- if (assetsType === "js") {
108
- return ${JSON.stringify(initialJsFiles)}
109
- }
110
- if (assetsType === "css") {
111
- return ${JSON.stringify(initialCssFiles)}
112
- }
113
- if (assetsType === "i18n") {
114
- return ${initalI18nAssets};
115
- }
116
- return [];
117
- }`).replace('((\'@dir@\'))', '\'@dir@\'').replace('((\'publicPath\'))', this.publicPath).replace('((\'@locale@\'))', '\'@locale@\'');
118
- }
119
-
120
- apply(compiler) {
121
- if (!createSDkFile) {
122
- return;
123
- }
124
-
125
- compiler.hooks.emit.tap('EFCTemplatePlugin', compilation => {
126
- const {
127
- entryPointName,
128
- outputFile
129
- } = this;
130
- const entryPoint = compilation.entrypoints.get(entryPointName);
131
-
132
- if (!entryPoint) {
133
- return;
134
- }
135
-
136
- if (!(0, _fs.existsSync)(this.templateFilePath)) {
137
- console.error(`EFC Template file not exists ${this.templateFilePath}`);
138
- return;
139
- }
140
-
141
- const source = new _webpackSources.RawSource(this.templateReplacer(entryPoint, compilation));
142
- compilation.assets[outputFile] = source; // console.log('EFCTemplatePlugin working');
143
- // eslint-disable-next-line no-console
144
-
145
- console.log('The EFC embedded code was created successfully..!!!');
146
- });
147
- }
148
-
149
- }
150
-
151
- exports.default = EFCTemplatePlugin;