@lvce-editor/output-view 2.12.1 → 2.14.0
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/outputViewWorkerMain.js +31 -10
- package/package.json +1 -1
|
@@ -1298,12 +1298,6 @@ const isFileNotFoundError = error => {
|
|
|
1298
1298
|
return error?.message?.includes('File not found') ?? false;
|
|
1299
1299
|
};
|
|
1300
1300
|
|
|
1301
|
-
const RE_URL = /(?:https?:\/\/\S+|file:\/\/\S+)/;
|
|
1302
|
-
const getLinkMatch = text => {
|
|
1303
|
-
const match = text.match(RE_URL);
|
|
1304
|
-
return match ? match[0] : null;
|
|
1305
|
-
};
|
|
1306
|
-
|
|
1307
1301
|
const Filter$2 = 'Filter';
|
|
1308
1302
|
const IconButton = 'IconButton';
|
|
1309
1303
|
const InputBox = 'InputBox';
|
|
@@ -1321,6 +1315,20 @@ const Line = 'Line';
|
|
|
1321
1315
|
const OutputRepeatCount = 'OutputRepeatCount';
|
|
1322
1316
|
const OutputSourceLink = 'OutputSourceLink';
|
|
1323
1317
|
|
|
1318
|
+
const RE_URL = /(?:https?:\/\/|file:\/\/|lvce(?:-oss)?:\/\/)\S+/;
|
|
1319
|
+
const trailingPunctuation = '!),.;?]}';
|
|
1320
|
+
const trimTrailingPunctuation = value => {
|
|
1321
|
+
let end = value.length;
|
|
1322
|
+
while (end > 0 && trailingPunctuation.includes(value[end - 1])) {
|
|
1323
|
+
end--;
|
|
1324
|
+
}
|
|
1325
|
+
return value.slice(0, end);
|
|
1326
|
+
};
|
|
1327
|
+
const getLinkMatch = text => {
|
|
1328
|
+
const match = text.match(RE_URL);
|
|
1329
|
+
return match ? trimTrailingPunctuation(match[0]) : null;
|
|
1330
|
+
};
|
|
1331
|
+
|
|
1324
1332
|
const isStructuredLogEntry = value => {
|
|
1325
1333
|
return value?.category === 'Window' && typeof value.level === 'string' && typeof value.line === 'number' && typeof value.message === 'string' && typeof value.source === 'string' && typeof value.timestamp === 'string';
|
|
1326
1334
|
};
|
|
@@ -1367,6 +1375,22 @@ const parseStructuredLogLine = line => {
|
|
|
1367
1375
|
}];
|
|
1368
1376
|
};
|
|
1369
1377
|
|
|
1378
|
+
const RE_SOURCE_LINK = /^lvce(?:-oss)?:\/\//;
|
|
1379
|
+
const RE_SOURCE_LOCATION = /:\d+(?::\d+)?$/;
|
|
1380
|
+
const getLinkPart = match => {
|
|
1381
|
+
if (RE_SOURCE_LINK.test(match)) {
|
|
1382
|
+
return {
|
|
1383
|
+
className: OutputSourceLink,
|
|
1384
|
+
label: match,
|
|
1385
|
+
type: Link,
|
|
1386
|
+
value: match.replace(RE_SOURCE_LOCATION, '')
|
|
1387
|
+
};
|
|
1388
|
+
}
|
|
1389
|
+
return {
|
|
1390
|
+
type: Link,
|
|
1391
|
+
value: match
|
|
1392
|
+
};
|
|
1393
|
+
};
|
|
1370
1394
|
const parseLine = line => {
|
|
1371
1395
|
const structuredLine = parseStructuredLogLine(line);
|
|
1372
1396
|
if (structuredLine) {
|
|
@@ -1392,10 +1416,7 @@ const parseLine = line => {
|
|
|
1392
1416
|
value: rest.slice(0, index)
|
|
1393
1417
|
});
|
|
1394
1418
|
}
|
|
1395
|
-
parts.push(
|
|
1396
|
-
type: Link,
|
|
1397
|
-
value: match
|
|
1398
|
-
});
|
|
1419
|
+
parts.push(getLinkPart(match));
|
|
1399
1420
|
rest = rest.slice(index + match.length);
|
|
1400
1421
|
}
|
|
1401
1422
|
if (parts.length === 0) {
|