@zohodesk/react-cli 0.0.1-exp.164.1 → 0.0.1-exp.166.2
Sign up to get free protection for your applications and to get access to all the features.
- package/DOTO.md +13 -0
- package/README.md +32 -12
- package/bin/cli.js +22 -1
- package/docs/CustomChunks.md +26 -0
- package/docs/TODOS.md +10 -0
- package/docs/ValueReplacer.md +60 -0
- package/docs/warnings_while_install.txt +35 -0
- package/lib/common/splitChunks.js +48 -37
- package/lib/common/testPattern.js +0 -2
- package/lib/common/valueReplacer.js +55 -0
- package/lib/configs/jest.config.js +6 -1
- package/lib/configs/webpack.docs.config.js +30 -26
- package/lib/configs/webpack.prod.config.js +1 -1
- package/lib/loaderUtils/getCSSLoaders.js +17 -13
- package/lib/postcss-plugins/ValueReplacer.js +46 -0
- package/lib/schemas/index.js +12 -0
- package/lib/servers/devBulid.js +98 -0
- package/lib/servers/getCliPath.js +24 -0
- package/lib/servers/nowatchserver.js +9 -84
- package/lib/servers/server.js +9 -2
- package/lib/utils/rtl.js +19 -2
- package/lib/utils/useExitCleanup.js +55 -0
- package/package.json +1 -1
- package/lib/common/criteriaHandler.js +0 -91
- package/lib/common/splitChunks1.js +0 -95
- package/lib/common/splitChunksNew.js +0 -129
@@ -1,129 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = void 0;
|
7
|
-
|
8
|
-
var _path = _interopRequireDefault(require("path"));
|
9
|
-
|
10
|
-
var _os = _interopRequireDefault(require("os"));
|
11
|
-
|
12
|
-
var _utils = require("../utils");
|
13
|
-
|
14
|
-
var _testPattern = require("./testPattern");
|
15
|
-
|
16
|
-
var _criteriaHandler = require("./criteriaHandler");
|
17
|
-
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19
|
-
|
20
|
-
const isWindows = _os.default.platform().toLowerCase() === 'win32';
|
21
|
-
const ps = _path.default.sep;
|
22
|
-
const options = (0, _utils.getOptions)();
|
23
|
-
const {
|
24
|
-
app: {
|
25
|
-
vendorExclude,
|
26
|
-
customChunks,
|
27
|
-
vendorInclude
|
28
|
-
}
|
29
|
-
} = options;
|
30
|
-
|
31
|
-
const canExclude = (m, excludeList) => {
|
32
|
-
let {
|
33
|
-
userRequest
|
34
|
-
} = m;
|
35
|
-
(0, _criteriaHandler.criteriaHandler)();
|
36
|
-
return (// if node_modules not in path then it is obviously not vendor
|
37
|
-
userRequest.indexOf('node_modules') === -1 || // for css currnetly we use style so it is not vendor
|
38
|
-
userRequest.endsWith('.css') || //I don't know what it is but not vendor (due to previous code)
|
39
|
-
userRequest.endsWith('publicPathConfig.js') || // this list given by user, So we need to exclude them
|
40
|
-
excludeList.some(item => (0, _testPattern.isRelatedPackage)(userRequest, item)) || // this is for exclude dependency module by excluded user
|
41
|
-
(0, _testPattern.isDependency)(m, excludeList)
|
42
|
-
);
|
43
|
-
};
|
44
|
-
|
45
|
-
let isVendor = function isVendor(module) {
|
46
|
-
let {
|
47
|
-
userRequest
|
48
|
-
} = module;
|
49
|
-
let excludeList = ['script-loader', 'raw-loader', 'react', 'react-dom'];
|
50
|
-
excludeList = [...excludeList, ...vendorExclude];
|
51
|
-
return userRequest && (vendorInclude.some(item => userRequest.indexOf(item) !== -1) || // (userRequest.indexOf('node_modules') >= 0 &&
|
52
|
-
// userRequest.endsWith('.css') === false &&
|
53
|
-
// userRequest.endsWith('publicPathConfig.js') === false &&
|
54
|
-
// excludeList.every(
|
55
|
-
// item => userRequest.indexOf(`node_modules${ps}${item}${ps}`) === -1
|
56
|
-
// )))
|
57
|
-
!canExclude(module, excludeList));
|
58
|
-
};
|
59
|
-
|
60
|
-
let isReact = module => {
|
61
|
-
let {
|
62
|
-
userRequest
|
63
|
-
} = module;
|
64
|
-
let reactBundle = ['react', 'react-dom'];
|
65
|
-
return userRequest && reactBundle.some(pkg => userRequest.indexOf(`node_modules${ps}${pkg}${ps}`) >= 0);
|
66
|
-
};
|
67
|
-
|
68
|
-
let defaultChunks = {
|
69
|
-
'react.vendor': {
|
70
|
-
name: 'react.vendor',
|
71
|
-
chunks: 'all',
|
72
|
-
minChunks: 1,
|
73
|
-
test: isReact,
|
74
|
-
priority: -10
|
75
|
-
},
|
76
|
-
vendor: {
|
77
|
-
name: 'vendor',
|
78
|
-
chunks: 'all',
|
79
|
-
minChunks: 1,
|
80
|
-
test: isVendor,
|
81
|
-
priority: -10
|
82
|
-
}
|
83
|
-
};
|
84
|
-
let customChunksConfig = {};
|
85
|
-
console.log(customChunks, 'hi');
|
86
|
-
customChunks.map(({
|
87
|
-
name,
|
88
|
-
pattern,
|
89
|
-
size = 2,
|
90
|
-
rules,
|
91
|
-
chunks = 'all',
|
92
|
-
includeDepenency
|
93
|
-
}, index) => customChunksConfig[name] = {
|
94
|
-
name,
|
95
|
-
test: rules ? m => {
|
96
|
-
let {
|
97
|
-
userRequest
|
98
|
-
} = m;
|
99
|
-
let pkgs = rules;
|
100
|
-
|
101
|
-
if (!Array.isArray(rules)) {
|
102
|
-
pkgs = [rules];
|
103
|
-
}
|
104
|
-
|
105
|
-
return pkgs.some(p => (0, _testPattern.isRelated)(userRequest, p)) || includeDepenency && (0, _testPattern.isDependency)(m, pkgs);
|
106
|
-
} : new RegExp(isWindows ? pattern.replace(/\//g, '\\') : pattern),
|
107
|
-
chunks,
|
108
|
-
enforce: true,
|
109
|
-
minChunks: size,
|
110
|
-
priority: -10 * (index + 2)
|
111
|
-
});
|
112
|
-
var _default = {
|
113
|
-
cacheGroups: Object.assign({
|
114
|
-
default: false,
|
115
|
-
vendors: false
|
116
|
-
}, defaultChunks, customChunksConfig)
|
117
|
-
}; // supportapp / src / analytics / utils / dashboards / chartUI.js;
|
118
|
-
// supportapp / src / modules / analytics / utils / chartTheme.js;
|
119
|
-
// a = [
|
120
|
-
// 'supportapp/src/analytics/utils/dashboards/chartUI.js',
|
121
|
-
// 'supportapp/src/components/analytics/dashboarddetail/Chart/Chart.js',
|
122
|
-
// 'supportapp/src/modules/analytics/utils/chartTheme.js',
|
123
|
-
// 'supportapp/src/modules/analytics/utils/ChartUI.js',
|
124
|
-
// 'supportapp/src/components/zia/zianotifications/ZiaNotificationDashBoard/ZiaNotificationChart.js',
|
125
|
-
// 'supportapp/src/components/analytics/dashboarddetail/SegmentAudience/DayoftheWeek/DayoftheWeek.js',
|
126
|
-
// 'supportapp/src/components/analytics/dashboarddetail/SegmentAudience/HouroftheDay/HouroftheDay.js'
|
127
|
-
// ];
|
128
|
-
|
129
|
-
exports.default = _default;
|