swpp-backends 1.0.0 → 1.0.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.
|
@@ -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/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|