swpp-backends 0.0.12-alpha → 1.0.1
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/dist/UpdateJsonBuilder.js +23 -0
- package/dist/fileAnalyzer.js +2 -1
- package/package.json +1 -1
|
@@ -237,8 +237,31 @@ function zipJson(json) {
|
|
|
237
237
|
delete info.change;
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
+
function limit(json) {
|
|
241
|
+
const charLimit = (0, SwppRules_1.readRules)().config.json.charLimit;
|
|
242
|
+
for (let i = 0; i !== -1; ++i) {
|
|
243
|
+
if (i === 999) {
|
|
244
|
+
(0, Utils_1.error)('UpdateJsonLimit', `JSON 输出长度异常:${JSON.stringify(json, null, 4)}`);
|
|
245
|
+
throw 'update json limit error';
|
|
246
|
+
}
|
|
247
|
+
const len = JSON.stringify(json).length;
|
|
248
|
+
if (len > charLimit) {
|
|
249
|
+
if (json.info.length === 1) {
|
|
250
|
+
delete json.info[0].change;
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
json.info.pop();
|
|
254
|
+
if (json.info.length === 1)
|
|
255
|
+
delete json.info[0].change;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
else
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
240
262
|
merge(json.info[0]);
|
|
241
263
|
deleteUnreachableExp(json.info);
|
|
264
|
+
limit(json);
|
|
242
265
|
return json;
|
|
243
266
|
}
|
|
244
267
|
/**
|
package/dist/fileAnalyzer.js
CHANGED
|
@@ -233,7 +233,6 @@ async function eachAllLinkInUrl(domain, url, result, event) {
|
|
|
233
233
|
return;
|
|
234
234
|
if (!(isExternalLink(domain, url) && findCache(new URL(url))))
|
|
235
235
|
return;
|
|
236
|
-
event?.(url);
|
|
237
236
|
const stable = isStable(url);
|
|
238
237
|
if (stable) {
|
|
239
238
|
const old = readOldVersionJson()?.list;
|
|
@@ -251,6 +250,7 @@ async function eachAllLinkInUrl(domain, url, result, event) {
|
|
|
251
250
|
}
|
|
252
251
|
};
|
|
253
252
|
copyTree(url);
|
|
253
|
+
event?.(url);
|
|
254
254
|
return;
|
|
255
255
|
}
|
|
256
256
|
}
|
|
@@ -259,6 +259,7 @@ async function eachAllLinkInUrl(domain, url, result, event) {
|
|
|
259
259
|
(0, Utils_1.error)('LinkItorInUrl', `拉取文件 [${url}] 时出现错误:${response?.status}`);
|
|
260
260
|
return;
|
|
261
261
|
}
|
|
262
|
+
event?.(url);
|
|
262
263
|
const pathname = new URL(url).pathname;
|
|
263
264
|
let content;
|
|
264
265
|
const nextEvent = (it) => {
|