@zohodesk/react-cli 0.0.1-test.148.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintignore +7 -7
- package/.eslintrc.js +180 -183
- package/.prettierrc +6 -0
- package/{CHANGELOG.md → CHANGELOG-fz.md} +0 -0
- package/Changelog.md +1019 -0
- package/README.md +1152 -678
- package/bin/cli.js +483 -392
- package/docs/CustomChunks.md +26 -0
- package/docs/DevServerPort.md +39 -0
- package/docs/DevStart.md +18 -0
- package/docs/HoverActive.md +12 -0
- package/docs/InstallNode.md +28 -0
- package/docs/SelectorWeight.md +6 -0
- package/docs/TODOS.md +10 -0
- package/docs/ValueReplacer.md +60 -0
- package/docs/VariableConversion.md +724 -0
- package/docs/warnings_while_install.txt +35 -0
- package/files/eslintrc.js +62 -62
- package/files/prettierrc.js +3 -3
- package/lib/common/index.js +6 -6
- package/lib/common/splitChunks.js +60 -12
- package/lib/common/sslcertUpdater.js +59 -0
- package/lib/common/testPattern.js +69 -0
- package/lib/common/valueReplacer.js +55 -0
- package/lib/configs/jest.config.js +18 -8
- package/lib/configs/libAlias.js +38 -0
- package/lib/configs/resolvers.js +40 -0
- package/lib/configs/webpack.css.umd.config.js +4 -4
- package/lib/configs/webpack.dev.config.js +59 -54
- package/lib/configs/webpack.docs.config.js +56 -53
- package/lib/configs/webpack.impact.config.js +54 -50
- package/lib/configs/webpack.prod.config.js +72 -47
- package/lib/constants.js +31 -0
- package/lib/jest/preProcessors/cssPreprocessor.js +16 -7
- package/lib/loaderUtils/configsAssetsLoaders.js +117 -0
- package/lib/loaderUtils/getCSSLoaders.js +89 -21
- package/lib/loaderUtils/index.js +4 -4
- package/lib/loaderUtils/windowsModification.js +11 -0
- package/lib/loaders/fileBountryLoader.js +17 -0
- package/lib/loaders/scriptInstrumentLoader.js +2 -2
- package/lib/loaders/selectorMappingLoader.js +75 -0
- package/lib/loaders/workerLoader.js +9 -9
- package/lib/pluginUtils/configHtmlWebpackPlugins.js +59 -0
- package/lib/pluginUtils/getDevPlugins.js +69 -45
- package/lib/pluginUtils/getDocsPlugins.js +6 -8
- package/lib/pluginUtils/getLibraryImactPlugins.js +23 -0
- package/lib/pluginUtils/getProdPlugins.js +73 -58
- package/lib/pluginUtils/index.js +12 -12
- package/lib/plugins/CdnChangePlugin.js +16 -2
- package/lib/plugins/EFCPlugin.js +52 -20
- package/lib/plugins/EFCPlugin.md +6 -0
- package/lib/plugins/EFCTemplatePlugin.js +151 -0
- package/lib/plugins/I18NInjectIntoIndexPlugin.js +4 -4
- package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +38 -38
- package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +30 -30
- package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +8 -8
- package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -86
- package/lib/plugins/I18nSplitPlugin/README.md +25 -25
- package/lib/plugins/I18nSplitPlugin/index.js +57 -57
- package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +2 -2
- package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +1 -1
- package/lib/plugins/ManifestPlugin.js +8 -0
- package/lib/plugins/RequireVariablePublicPlugin.js +30 -0
- package/lib/plugins/ResourceHintsPlugin.js +17 -17
- package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +11 -7
- package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -0
- package/lib/plugins/SelectorPlugin.js +97 -0
- package/lib/plugins/ServiceWorkerPlugin.js +13 -9
- package/lib/plugins/SourceMapHookPlugin.js +9 -3
- package/lib/plugins/TPHashMappingPlugin.js +4 -4
- package/lib/plugins/VariableConversionCollector.js +352 -0
- package/lib/plugins/composeCommonPlugin.js +30 -0
- package/lib/plugins/index.js +36 -36
- package/lib/plugins/libraryImpactPlugin.js +14 -2
- package/lib/postcss-plugins/{ExcludeRTLPlugin.js → ExcludePlugin.js} +1 -1
- package/lib/postcss-plugins/RTLSplitPlugin.js +36 -32
- package/lib/postcss-plugins/ValueReplacer.js +46 -0
- package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +22 -0
- package/lib/postcss-plugins/__test__/test1Input.css +39 -0
- package/lib/postcss-plugins/__test__/test1Output.css +39 -0
- package/lib/postcss-plugins/hoverActivePlugin.js +389 -0
- package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +60 -0
- package/lib/postcss-plugins/variableModificationPlugin/index.js +307 -0
- package/lib/postcss-plugins/variableModifier.js +244 -0
- package/lib/schemas/index.js +166 -11
- package/lib/servers/devBuild.js +102 -0
- package/lib/servers/docsServerCore.js +16 -18
- package/lib/servers/getCliPath.js +28 -0
- package/lib/servers/httpsOptions.js +49 -0
- package/lib/servers/nowatchserver.js +206 -0
- package/lib/servers/server.js +114 -82
- package/lib/sh/pre-commit.sh +34 -34
- package/lib/sh/reportPublish.sh +45 -45
- package/lib/templates/linterConstant.js +1 -1
- package/lib/utils/buildstats.html +148 -148
- package/lib/utils/cssClassNameGenerate.js +9 -2
- package/lib/utils/cssURLReplacer.js +30 -43
- package/lib/utils/getCurrentBranch.js +1 -1
- package/lib/utils/getDependenciesImpactList.js +14 -12
- package/lib/utils/getFileType.js +49 -0
- package/lib/utils/getOptions.js +118 -10
- package/lib/utils/index.js +44 -20
- package/lib/utils/jsonHelper.js +12 -3
- package/lib/utils/reinstallDependencies.js +1 -1
- package/lib/utils/repoClone.js +16 -4
- package/lib/utils/resultSchema.json +73 -73
- package/lib/utils/rtl.js +19 -2
- package/lib/utils/useExitCleanup.js +55 -0
- package/npm8.md +9 -0
- package/package.json +121 -142
- package/postpublish.js +8 -0
- package/result.json +1 -0
- package/templates/app/.eslintrc.js +140 -140
- package/templates/app/README.md +12 -12
- package/templates/app/app/index.html +24 -24
- package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
- package/templates/app/app/properties/i18nkeys.json +3 -3
- package/templates/app/docs/all.html +69 -69
- package/templates/app/mockapi/index.js +18 -18
- package/templates/app/package.json +37 -37
- package/templates/app/src/actions/SampleActions/index.js +37 -37
- package/templates/app/src/actions/index.js +65 -65
- package/templates/app/src/appUrls.js +19 -19
- package/templates/app/src/components/Alert/Alert.js +134 -134
- package/templates/app/src/components/Alert/Alert.module.css +79 -79
- package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -37
- package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -84
- package/templates/app/src/components/Sample/Sample.module.css +11 -11
- package/templates/app/src/components/Sample/SampleList.js +61 -61
- package/templates/app/src/components/Slider/Slider.css +41 -41
- package/templates/app/src/components/Slider/Slider.js +55 -55
- package/templates/app/src/containers/AlertContainer/index.js +15 -15
- package/templates/app/src/containers/AppContainer/index.js +96 -96
- package/templates/app/src/containers/AppContainer/index.module.css +27 -27
- package/templates/app/src/containers/CustomMatch/index.js +65 -65
- package/templates/app/src/containers/DevTools/index.js +10 -10
- package/templates/app/src/containers/Header/index.js +67 -67
- package/templates/app/src/containers/Header/index.module.css +43 -43
- package/templates/app/src/containers/Redirect/index.js +63 -63
- package/templates/app/src/containers/Redirector/index.js +47 -47
- package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -42
- package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -3
- package/templates/app/src/historyChange.js +5 -5
- package/templates/app/src/index.html +10 -10
- package/templates/app/src/index.js +24 -24
- package/templates/app/src/middleware/PromiseMiddleware.js +59 -59
- package/templates/app/src/reducers/alertData.js +11 -11
- package/templates/app/src/reducers/index.js +6 -6
- package/templates/app/src/reducers/samples.js +19 -19
- package/templates/app/src/store/configureStore.dev.js +51 -51
- package/templates/app/src/store/configureStore.js +5 -5
- package/templates/app/src/store/configureStore.prod.js +26 -26
- package/templates/app/src/util/Common.js +5 -5
- package/templates/app/src/util/RequestAPI.js +132 -132
- package/templates/docs/all.html +249 -249
- package/templates/docs/component.html +178 -178
- package/templates/docs/components.html +221 -221
- package/templates/docs/css/b.min.css +6 -6
- package/templates/docs/css/component.css +42 -42
- package/templates/docs/css/componentTest.css +6 -6
- package/templates/docs/css/hopscotch.css +585 -585
- package/templates/docs/css/style.css +1022 -1022
- package/templates/docs/impactReportTemplate.html +154 -154
- package/templates/docs/index.html +1501 -1493
- package/templates/docs/js/active-line.js +72 -72
- package/templates/docs/js/b.min.js +7 -7
- package/templates/docs/js/codemirror.js +9680 -9680
- package/templates/docs/js/designTokens.js +334 -334
- package/templates/docs/js/j.min.js +4 -4
- package/templates/docs/js/javascript.js +874 -874
- package/templates/docs/js/matchbrackets.js +145 -145
- package/unittest/index.html +37 -0
- package/cert/cert.pem +0 -105
- package/cert/key.pem +0 -30
@@ -1,148 +1,148 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
|
5
|
-
<style>
|
6
|
-
#file {
|
7
|
-
font-family: 'Trebuchet MS', Arial, Helvetica, sans-serif;
|
8
|
-
border-collapse: collapse;
|
9
|
-
width: 100%;
|
10
|
-
}
|
11
|
-
#redTd {
|
12
|
-
color: red;
|
13
|
-
}
|
14
|
-
#greenTD {
|
15
|
-
color: green;
|
16
|
-
}
|
17
|
-
#file td,
|
18
|
-
#file th {
|
19
|
-
border: 1px solid #ddd;
|
20
|
-
padding: 8px;
|
21
|
-
text-align: center;
|
22
|
-
}
|
23
|
-
|
24
|
-
#file tr:nth-child(even) {
|
25
|
-
background-color: #f2f2f2;
|
26
|
-
}
|
27
|
-
|
28
|
-
#file tr:hover {
|
29
|
-
background-color: #ddd;
|
30
|
-
}
|
31
|
-
|
32
|
-
#file th {
|
33
|
-
padding-top: 12px;
|
34
|
-
padding-bottom: 12px;
|
35
|
-
background-color: #2a2d36;
|
36
|
-
color: white;
|
37
|
-
}
|
38
|
-
#sizeTable {
|
39
|
-
float: left;
|
40
|
-
width: 50%;
|
41
|
-
}
|
42
|
-
#hashTable {
|
43
|
-
display: inline-block;
|
44
|
-
width: 50%;
|
45
|
-
}
|
46
|
-
</style>
|
47
|
-
<script type="text/javascript" src="./buildtrack.js"></script>
|
48
|
-
</head>
|
49
|
-
<body>
|
50
|
-
<div>
|
51
|
-
<div style="float: left;margin-right: 10px;">Branch Name:</div>
|
52
|
-
<h4 id="h4" style="margin: 0px;"></h4>
|
53
|
-
</div>
|
54
|
-
<div id="sizeTable">
|
55
|
-
<div>
|
56
|
-
<h3>Size changes</h3>
|
57
|
-
<h3></h3>
|
58
|
-
</div>
|
59
|
-
<table id="file" class="table table-bordered table-hover table-condensed">
|
60
|
-
<thead>
|
61
|
-
<tr>
|
62
|
-
<th title="Field #1">Name</th>
|
63
|
-
<th title="Field #2">Size / Diff</th>
|
64
|
-
<th title="Field #3">Size / Old</th>
|
65
|
-
<th title="Field #4">Size / New</th>
|
66
|
-
</tr>
|
67
|
-
</thead>
|
68
|
-
<tbody id="sizeTbody"></tbody>
|
69
|
-
</table>
|
70
|
-
</div>
|
71
|
-
<div id="hashTable">
|
72
|
-
<div>
|
73
|
-
<h3>Hash changes</h3>
|
74
|
-
<h3></h3>
|
75
|
-
</div>
|
76
|
-
<table id="file" class="table table-bordered table-hover table-condensed">
|
77
|
-
<thead>
|
78
|
-
<tr>
|
79
|
-
<th style="background-color: #4CAF50;" title="Field #1">Name</th>
|
80
|
-
<th style="background-color: #4CAF50;" title="Field #2">
|
81
|
-
Hash / Old
|
82
|
-
</th>
|
83
|
-
<th style="background-color: #4CAF50;" title="Field #3">
|
84
|
-
Hash / New
|
85
|
-
</th>
|
86
|
-
</tr>
|
87
|
-
</thead>
|
88
|
-
<tbody id="hashTbody"></tbody>
|
89
|
-
</table>
|
90
|
-
</div>
|
91
|
-
|
92
|
-
<script type="text/javascript">
|
93
|
-
function load() {
|
94
|
-
if (statsJson) {
|
95
|
-
var tdStringSize = '';
|
96
|
-
var tdStringHash = '';
|
97
|
-
if (statsJson.increased.length > 0) {
|
98
|
-
statsJson.increased.forEach(fileObj => {
|
99
|
-
let colorTD = '</td><td>';
|
100
|
-
if (fileObj.size.diff.split(' ').length > 2) {
|
101
|
-
colorTD = '</td><td id="greenTd">';
|
102
|
-
} else {
|
103
|
-
colorTD = '</td><td id="redTd">';
|
104
|
-
}
|
105
|
-
|
106
|
-
tdStringSize =
|
107
|
-
tdStringSize +
|
108
|
-
'<tr><td>' +
|
109
|
-
fileObj.name +
|
110
|
-
colorTD +
|
111
|
-
fileObj.size.diff +
|
112
|
-
'</td><td>' +
|
113
|
-
fileObj.size.old +
|
114
|
-
'</td><td>' +
|
115
|
-
fileObj.size.new +
|
116
|
-
'</td><tr>';
|
117
|
-
});
|
118
|
-
} else {
|
119
|
-
tdStringSize = '<tr><td></td><td></td><td></td></tr>';
|
120
|
-
}
|
121
|
-
document.getElementById('sizeTbody').innerHTML = tdStringSize;
|
122
|
-
if (statsJson.hashChanged.length > 0) {
|
123
|
-
statsJson.hashChanged.forEach(fileObj => {
|
124
|
-
tdStringHash =
|
125
|
-
tdStringHash +
|
126
|
-
'<tr><td>' +
|
127
|
-
fileObj.name +
|
128
|
-
'</td><td>' +
|
129
|
-
fileObj.hash.old +
|
130
|
-
'</td><td>' +
|
131
|
-
fileObj.hash.new +
|
132
|
-
'</td><tr>';
|
133
|
-
});
|
134
|
-
} else {
|
135
|
-
tdStringHash = '<tr><td></td><td></td><td></td></tr>';
|
136
|
-
}
|
137
|
-
document.getElementById('hashTbody').innerHTML = tdStringHash;
|
138
|
-
if (statsJson.branchName) {
|
139
|
-
document.getElementById('h4').innerHTML = statsJson.branchName;
|
140
|
-
} else {
|
141
|
-
document.getElementById('h4').innerHTML = 'Not specified';
|
142
|
-
}
|
143
|
-
}
|
144
|
-
}
|
145
|
-
load();
|
146
|
-
</script>
|
147
|
-
</body>
|
148
|
-
</html>
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
|
5
|
+
<style>
|
6
|
+
#file {
|
7
|
+
font-family: 'Trebuchet MS', Arial, Helvetica, sans-serif;
|
8
|
+
border-collapse: collapse;
|
9
|
+
width: 100%;
|
10
|
+
}
|
11
|
+
#redTd {
|
12
|
+
color: red;
|
13
|
+
}
|
14
|
+
#greenTD {
|
15
|
+
color: green;
|
16
|
+
}
|
17
|
+
#file td,
|
18
|
+
#file th {
|
19
|
+
border: 1px solid #ddd;
|
20
|
+
padding: 8px;
|
21
|
+
text-align: center;
|
22
|
+
}
|
23
|
+
|
24
|
+
#file tr:nth-child(even) {
|
25
|
+
background-color: #f2f2f2;
|
26
|
+
}
|
27
|
+
|
28
|
+
#file tr:hover {
|
29
|
+
background-color: #ddd;
|
30
|
+
}
|
31
|
+
|
32
|
+
#file th {
|
33
|
+
padding-top: 12px;
|
34
|
+
padding-bottom: 12px;
|
35
|
+
background-color: #2a2d36;
|
36
|
+
color: white;
|
37
|
+
}
|
38
|
+
#sizeTable {
|
39
|
+
float: left;
|
40
|
+
width: 50%;
|
41
|
+
}
|
42
|
+
#hashTable {
|
43
|
+
display: inline-block;
|
44
|
+
width: 50%;
|
45
|
+
}
|
46
|
+
</style>
|
47
|
+
<script type="text/javascript" src="./buildtrack.js"></script>
|
48
|
+
</head>
|
49
|
+
<body>
|
50
|
+
<div>
|
51
|
+
<div style="float: left;margin-right: 10px;">Branch Name:</div>
|
52
|
+
<h4 id="h4" style="margin: 0px;"></h4>
|
53
|
+
</div>
|
54
|
+
<div id="sizeTable">
|
55
|
+
<div>
|
56
|
+
<h3>Size changes</h3>
|
57
|
+
<h3></h3>
|
58
|
+
</div>
|
59
|
+
<table id="file" class="table table-bordered table-hover table-condensed">
|
60
|
+
<thead>
|
61
|
+
<tr>
|
62
|
+
<th title="Field #1">Name</th>
|
63
|
+
<th title="Field #2">Size / Diff</th>
|
64
|
+
<th title="Field #3">Size / Old</th>
|
65
|
+
<th title="Field #4">Size / New</th>
|
66
|
+
</tr>
|
67
|
+
</thead>
|
68
|
+
<tbody id="sizeTbody"></tbody>
|
69
|
+
</table>
|
70
|
+
</div>
|
71
|
+
<div id="hashTable">
|
72
|
+
<div>
|
73
|
+
<h3>Hash changes</h3>
|
74
|
+
<h3></h3>
|
75
|
+
</div>
|
76
|
+
<table id="file" class="table table-bordered table-hover table-condensed">
|
77
|
+
<thead>
|
78
|
+
<tr>
|
79
|
+
<th style="background-color: #4CAF50;" title="Field #1">Name</th>
|
80
|
+
<th style="background-color: #4CAF50;" title="Field #2">
|
81
|
+
Hash / Old
|
82
|
+
</th>
|
83
|
+
<th style="background-color: #4CAF50;" title="Field #3">
|
84
|
+
Hash / New
|
85
|
+
</th>
|
86
|
+
</tr>
|
87
|
+
</thead>
|
88
|
+
<tbody id="hashTbody"></tbody>
|
89
|
+
</table>
|
90
|
+
</div>
|
91
|
+
|
92
|
+
<script type="text/javascript">
|
93
|
+
function load() {
|
94
|
+
if (statsJson) {
|
95
|
+
var tdStringSize = '';
|
96
|
+
var tdStringHash = '';
|
97
|
+
if (statsJson.increased.length > 0) {
|
98
|
+
statsJson.increased.forEach(fileObj => {
|
99
|
+
let colorTD = '</td><td>';
|
100
|
+
if (fileObj.size.diff.split(' ').length > 2) {
|
101
|
+
colorTD = '</td><td id="greenTd">';
|
102
|
+
} else {
|
103
|
+
colorTD = '</td><td id="redTd">';
|
104
|
+
}
|
105
|
+
|
106
|
+
tdStringSize =
|
107
|
+
tdStringSize +
|
108
|
+
'<tr><td>' +
|
109
|
+
fileObj.name +
|
110
|
+
colorTD +
|
111
|
+
fileObj.size.diff +
|
112
|
+
'</td><td>' +
|
113
|
+
fileObj.size.old +
|
114
|
+
'</td><td>' +
|
115
|
+
fileObj.size.new +
|
116
|
+
'</td><tr>';
|
117
|
+
});
|
118
|
+
} else {
|
119
|
+
tdStringSize = '<tr><td></td><td></td><td></td></tr>';
|
120
|
+
}
|
121
|
+
document.getElementById('sizeTbody').innerHTML = tdStringSize;
|
122
|
+
if (statsJson.hashChanged.length > 0) {
|
123
|
+
statsJson.hashChanged.forEach(fileObj => {
|
124
|
+
tdStringHash =
|
125
|
+
tdStringHash +
|
126
|
+
'<tr><td>' +
|
127
|
+
fileObj.name +
|
128
|
+
'</td><td>' +
|
129
|
+
fileObj.hash.old +
|
130
|
+
'</td><td>' +
|
131
|
+
fileObj.hash.new +
|
132
|
+
'</td><tr>';
|
133
|
+
});
|
134
|
+
} else {
|
135
|
+
tdStringHash = '<tr><td></td><td></td><td></td></tr>';
|
136
|
+
}
|
137
|
+
document.getElementById('hashTbody').innerHTML = tdStringHash;
|
138
|
+
if (statsJson.branchName) {
|
139
|
+
document.getElementById('h4').innerHTML = statsJson.branchName;
|
140
|
+
} else {
|
141
|
+
document.getElementById('h4').innerHTML = 'Not specified';
|
142
|
+
}
|
143
|
+
}
|
144
|
+
}
|
145
|
+
load();
|
146
|
+
</script>
|
147
|
+
</body>
|
148
|
+
</html>
|
@@ -40,6 +40,13 @@ var _default = (unique = true, {
|
|
40
40
|
filenames,
|
41
41
|
packages
|
42
42
|
}, classNamePrefix) => (context, localIdentName, localName) => {
|
43
|
+
// NOTE: in build macine we use date as folder path.
|
44
|
+
// So every time we create new build there is path will alway different
|
45
|
+
// in order to minmaze that problem we try in relative path;
|
46
|
+
// console.log('context.resourcePath', context.resourcePath, context);
|
47
|
+
// let contextResourcePath = context.resourcePath;
|
48
|
+
let relativePath = _path.default.relative(context.rootContext, context.resourcePath);
|
49
|
+
|
43
50
|
if (context.resourcePath.endsWith('.plain.css')) {
|
44
51
|
return localName;
|
45
52
|
}
|
@@ -47,7 +54,7 @@ var _default = (unique = true, {
|
|
47
54
|
|
48
55
|
|
49
56
|
if (unique) {
|
50
|
-
let h = (0, _getHash.default)(
|
57
|
+
let h = (0, _getHash.default)(`${relativePath}-${localName}`, 10);
|
51
58
|
return `${classNamePrefix}${h}`;
|
52
59
|
}
|
53
60
|
/* old production mode end*/
|
@@ -60,7 +67,7 @@ var _default = (unique = true, {
|
|
60
67
|
//let local = localName.toLowerCase()
|
61
68
|
|
62
69
|
if (isSelectorPackage(context.resourcePath, packages) || filenames.indexOf(cleanFileName) !== -1) {
|
63
|
-
let h = (0, _getHash.default)(
|
70
|
+
let h = (0, _getHash.default)(`${relativePath}-${localName}`, 10);
|
64
71
|
return `${classNamePrefix}${h}`;
|
65
72
|
}
|
66
73
|
|
@@ -3,19 +3,26 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.cssUrlReplacer =
|
6
|
+
exports.cssUrlReplacer = void 0;
|
7
|
+
Object.defineProperty(exports, "getFileType", {
|
8
|
+
enumerable: true,
|
9
|
+
get: function () {
|
10
|
+
return _getFileType.getFileType;
|
11
|
+
}
|
12
|
+
});
|
13
|
+
exports.getUrls = void 0;
|
7
14
|
|
8
15
|
var _fs = _interopRequireDefault(require("fs"));
|
9
16
|
|
10
|
-
var _path = _interopRequireDefault(require("path"));
|
11
|
-
|
12
17
|
var _crypto = _interopRequireDefault(require("crypto"));
|
13
18
|
|
19
|
+
var _getFileType = require("./getFileType");
|
20
|
+
|
14
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
22
|
|
16
|
-
|
23
|
+
const urlRegex = /url\(.*?\)/g;
|
17
24
|
|
18
|
-
|
25
|
+
const getHash = (file, isPath = false, needSubStr = true) => {
|
19
26
|
let hash = _crypto.default.createHash('md5');
|
20
27
|
|
21
28
|
if (isPath) {
|
@@ -28,45 +35,25 @@ let getHash = (file, isPath = false, needSubStr = true) => {
|
|
28
35
|
return hash ? needSubStr ? hash.substring(0, 20) : hash : null;
|
29
36
|
};
|
30
37
|
|
31
|
-
|
32
|
-
let {
|
33
|
-
ext
|
34
|
-
} = _path.default.parse(file);
|
35
|
-
|
36
|
-
if (ext === '.gif' || ext === '.png' || ext === '.jpg' || ext === '.jpeg' || ext === '.ico') {
|
37
|
-
return 'image';
|
38
|
-
} else if (ext === '.svg' || ext === '.woff' || ext === '.eot' || ext === '.ttf' || ext === '.woff2') {
|
39
|
-
return 'font';
|
40
|
-
} else if (ext === '.js') {
|
41
|
-
return 'js';
|
42
|
-
} else if (ext === '.css') {
|
43
|
-
return 'css';
|
44
|
-
}
|
45
|
-
|
46
|
-
return null;
|
47
|
-
};
|
48
|
-
|
49
|
-
exports.getFileType = getFileType;
|
50
|
-
|
51
|
-
let formatUrl = str => {
|
38
|
+
const formatUrl = str => {
|
52
39
|
let char = str.includes('"') ? '"' : str.includes('\'') ? '\'' : '(';
|
53
|
-
|
54
|
-
|
40
|
+
const statingIdx = str.indexOf(char) + 1;
|
41
|
+
const substr = str.substring(statingIdx, str.length);
|
55
42
|
char = char === '(' ? ')' : char;
|
56
43
|
return substr.substring(0, substr.indexOf(char));
|
57
44
|
};
|
58
45
|
|
59
|
-
|
60
|
-
|
46
|
+
const getUrls = css => {
|
47
|
+
const urlMatches = css.match(urlRegex);
|
61
48
|
let src = css;
|
62
49
|
|
63
50
|
if (urlMatches) {
|
64
|
-
|
51
|
+
const patterns = {};
|
65
52
|
urlMatches.forEach(pattern => {
|
66
|
-
|
67
|
-
|
53
|
+
const url = formatUrl(pattern);
|
54
|
+
const hash = getHash(url);
|
68
55
|
patterns[url] = hash;
|
69
|
-
|
56
|
+
const regex = new RegExp(pattern.replace(/([<>*()?${}|])/g, '\\$1'), 'g');
|
70
57
|
src = src.replace(regex, hash);
|
71
58
|
});
|
72
59
|
return {
|
@@ -78,12 +65,12 @@ let getUrls = css => {
|
|
78
65
|
|
79
66
|
exports.getUrls = getUrls;
|
80
67
|
|
81
|
-
|
82
|
-
|
68
|
+
const cssUrlReplacer = (css, domains, chunkHash = {}) => {
|
69
|
+
const obj = getUrls(css);
|
83
70
|
let src = css;
|
84
71
|
|
85
72
|
if (obj) {
|
86
|
-
|
73
|
+
const patterns = obj.urls;
|
87
74
|
src = obj.css;
|
88
75
|
Object.keys(patterns).forEach(pattern => {
|
89
76
|
let urlParts = pattern.split('/');
|
@@ -97,20 +84,20 @@ let cssUrlReplacer = (css, domains, chunkHash = {}) => {
|
|
97
84
|
fileName = fileName.replace(/\?.*$/g, '');
|
98
85
|
}
|
99
86
|
|
100
|
-
|
101
|
-
|
102
|
-
|
87
|
+
const hash = patterns[pattern];
|
88
|
+
const filename = fileName.replace(/(\?|#).*?$/g, '');
|
89
|
+
const regex = new RegExp(hash, 'g');
|
103
90
|
let {
|
104
91
|
hashedName
|
105
92
|
} = chunkHash[filename] || fileName;
|
106
93
|
|
107
94
|
if (domains && typeof urlParts[0] === 'string' && !urlParts[0].includes('http')) {
|
108
|
-
|
95
|
+
const {
|
109
96
|
font,
|
110
97
|
image
|
111
98
|
} = domains;
|
112
|
-
|
113
|
-
|
99
|
+
const type = (0, _getFileType.getFileType)(filename);
|
100
|
+
const customPath = type === 'image' ? `${image}/images` : type === 'font' ? `${font}/fonts` : urlParts.join('/');
|
114
101
|
urlParts = customPath.split('/');
|
115
102
|
}
|
116
103
|
|
@@ -22,7 +22,7 @@ var _default = (type = 'git', cwd = process.cwd()) => {
|
|
22
22
|
});
|
23
23
|
}
|
24
24
|
|
25
|
-
let [currentBranch] = results.output.filter(d => d);
|
25
|
+
let [currentBranch] = results && results.output ? results.output.filter(d => d) : [''];
|
26
26
|
return currentBranch.replace(/(\r\n|\n|\r)/gm, '');
|
27
27
|
};
|
28
28
|
|
@@ -51,20 +51,22 @@ let getLiveDependenciesInfo = (branch, tokenGit) => new Promise((resolve, reject
|
|
51
51
|
}).catch(reject);
|
52
52
|
});
|
53
53
|
|
54
|
-
let getDependencyChangeset = (
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
54
|
+
let getDependencyChangeset = (dependency, version) => {
|
55
|
+
return new Promise(resolve => {
|
56
|
+
let url = `${'ht'}${'tp'}://tsi-desk-mock.tsi.zohocorpin.com:8080/Hbase/getKey?method=getkey&tablename=${dependency}_changesets&row=dependencies_changesets&column=${version}`;
|
57
|
+
(0, _request.default)({
|
58
|
+
url
|
59
|
+
}).then(({
|
60
|
+
body
|
61
|
+
}) => {
|
62
|
+
if (body == "") {
|
63
|
+
console.log("Changeset for the " + dependency + " version " + version + " not stored in Hbase!");
|
64
|
+
}
|
64
65
|
|
65
|
-
|
66
|
+
resolve(body);
|
67
|
+
});
|
66
68
|
});
|
67
|
-
}
|
69
|
+
};
|
68
70
|
|
69
71
|
let getImpactDiff = (srcBranch, targetBranch, appName) => new Promise(resolve => {
|
70
72
|
let diff = {
|
@@ -0,0 +1,49 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.getFileType = getFileType;
|
7
|
+
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
9
|
+
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
|
+
|
12
|
+
/* eslint-disable no-use-before-define */
|
13
|
+
function getFileType(file) {
|
14
|
+
const {
|
15
|
+
ext
|
16
|
+
} = _path.default.parse(file);
|
17
|
+
|
18
|
+
if (isImageFileExt(ext)) {
|
19
|
+
return 'image';
|
20
|
+
} else if (isFontFileExt(ext)) {
|
21
|
+
return 'font';
|
22
|
+
} else if (isVideoFileExt(ext)) {
|
23
|
+
return 'video';
|
24
|
+
} else if (isAudioFileExt(ext)) {
|
25
|
+
return 'audio';
|
26
|
+
} else if (ext === '.js') {
|
27
|
+
return 'js';
|
28
|
+
} else if (ext === '.css') {
|
29
|
+
return 'css';
|
30
|
+
}
|
31
|
+
|
32
|
+
return null;
|
33
|
+
}
|
34
|
+
|
35
|
+
function isImageFileExt(ext) {
|
36
|
+
return ext === '.gif' || ext === '.png' || ext === '.jpg' || ext === '.jpeg' || ext === '.webp' || ext === '.ico';
|
37
|
+
}
|
38
|
+
|
39
|
+
function isFontFileExt(ext) {
|
40
|
+
return ext === '.svg' || ext === '.woff' || ext === '.eot' || ext === '.ttf' || ext === '.woff2';
|
41
|
+
}
|
42
|
+
|
43
|
+
function isVideoFileExt(ext) {
|
44
|
+
return ext === '.mp4' || ext === '.webm';
|
45
|
+
}
|
46
|
+
|
47
|
+
function isAudioFileExt(ext) {
|
48
|
+
return ext === '.ogg';
|
49
|
+
}
|