@lvce-editor/output-view 2.21.1 → 2.23.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 +112 -74
- package/package.json +1 -1
|
@@ -1164,6 +1164,28 @@ const create$2 = rpcId => {
|
|
|
1164
1164
|
};
|
|
1165
1165
|
};
|
|
1166
1166
|
|
|
1167
|
+
const Log = 'log';
|
|
1168
|
+
const ToolBar = 'toolbar';
|
|
1169
|
+
|
|
1170
|
+
const Button = 1;
|
|
1171
|
+
const Div = 4;
|
|
1172
|
+
const Input = 6;
|
|
1173
|
+
const Span = 8;
|
|
1174
|
+
const Text$1 = 12;
|
|
1175
|
+
const A = 53;
|
|
1176
|
+
const Select$1 = 63;
|
|
1177
|
+
const Option$1 = 64;
|
|
1178
|
+
|
|
1179
|
+
const Space = 9;
|
|
1180
|
+
const PageUp = 10;
|
|
1181
|
+
const PageDown = 11;
|
|
1182
|
+
const End = 255;
|
|
1183
|
+
const Home = 12;
|
|
1184
|
+
const LeftArrow = 13;
|
|
1185
|
+
const UpArrow = 14;
|
|
1186
|
+
const RightArrow = 15;
|
|
1187
|
+
const DownArrow = 16;
|
|
1188
|
+
|
|
1167
1189
|
const ExtensionManagementWorker = 9006;
|
|
1168
1190
|
const FileSystemWorker = 209;
|
|
1169
1191
|
const OutputWorker = 7001;
|
|
@@ -1231,42 +1253,68 @@ const create$1 = () => {
|
|
|
1231
1253
|
const states = Object.create(null);
|
|
1232
1254
|
const commandMapRef = {};
|
|
1233
1255
|
return {
|
|
1234
|
-
|
|
1235
|
-
|
|
1256
|
+
clear() {
|
|
1257
|
+
for (const key of Object.keys(states)) {
|
|
1258
|
+
delete states[key];
|
|
1259
|
+
}
|
|
1236
1260
|
},
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
};
|
|
1261
|
+
diff(uid, modules, numbers) {
|
|
1262
|
+
const {
|
|
1263
|
+
newState,
|
|
1264
|
+
oldState
|
|
1265
|
+
} = states[uid];
|
|
1266
|
+
const diffResult = [];
|
|
1267
|
+
for (let i = 0; i < modules.length; i++) {
|
|
1268
|
+
const fn = modules[i];
|
|
1269
|
+
if (!fn(oldState, newState)) {
|
|
1270
|
+
diffResult.push(numbers[i]);
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
return diffResult;
|
|
1242
1274
|
},
|
|
1243
1275
|
dispose(uid) {
|
|
1244
1276
|
delete states[uid];
|
|
1245
1277
|
},
|
|
1278
|
+
get(uid) {
|
|
1279
|
+
return states[uid];
|
|
1280
|
+
},
|
|
1281
|
+
getCommandIds() {
|
|
1282
|
+
const keys = Object.keys(commandMapRef);
|
|
1283
|
+
const ids = keys.map(toCommandId);
|
|
1284
|
+
return ids;
|
|
1285
|
+
},
|
|
1246
1286
|
getKeys() {
|
|
1247
1287
|
return Object.keys(states).map(key => {
|
|
1248
|
-
return Number.
|
|
1288
|
+
return Number.parseFloat(key);
|
|
1249
1289
|
});
|
|
1250
1290
|
},
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1291
|
+
registerCommands(commandMap) {
|
|
1292
|
+
Object.assign(commandMapRef, commandMap);
|
|
1293
|
+
},
|
|
1294
|
+
set(uid, oldState, newState) {
|
|
1295
|
+
states[uid] = {
|
|
1296
|
+
newState,
|
|
1297
|
+
oldState
|
|
1298
|
+
};
|
|
1255
1299
|
},
|
|
1256
1300
|
wrapCommand(fn) {
|
|
1257
1301
|
const wrapped = async (uid, ...args) => {
|
|
1258
1302
|
const {
|
|
1259
|
-
|
|
1260
|
-
|
|
1303
|
+
newState,
|
|
1304
|
+
oldState
|
|
1261
1305
|
} = states[uid];
|
|
1262
1306
|
const newerState = await fn(newState, ...args);
|
|
1263
1307
|
if (oldState === newerState || newState === newerState) {
|
|
1264
1308
|
return;
|
|
1265
1309
|
}
|
|
1266
|
-
const
|
|
1310
|
+
const latestOld = states[uid];
|
|
1311
|
+
const latestNew = {
|
|
1312
|
+
...latestOld.newState,
|
|
1313
|
+
...newerState
|
|
1314
|
+
};
|
|
1267
1315
|
states[uid] = {
|
|
1268
|
-
|
|
1269
|
-
|
|
1316
|
+
newState: latestNew,
|
|
1317
|
+
oldState: latestOld.oldState
|
|
1270
1318
|
};
|
|
1271
1319
|
};
|
|
1272
1320
|
return wrapped;
|
|
@@ -1280,27 +1328,36 @@ const create$1 = () => {
|
|
|
1280
1328
|
};
|
|
1281
1329
|
return wrapped;
|
|
1282
1330
|
},
|
|
1283
|
-
|
|
1284
|
-
const {
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
const
|
|
1291
|
-
|
|
1292
|
-
|
|
1331
|
+
wrapLoadContent(fn) {
|
|
1332
|
+
const wrapped = async (uid, ...args) => {
|
|
1333
|
+
const {
|
|
1334
|
+
newState,
|
|
1335
|
+
oldState
|
|
1336
|
+
} = states[uid];
|
|
1337
|
+
const result = await fn(newState, ...args);
|
|
1338
|
+
const {
|
|
1339
|
+
error,
|
|
1340
|
+
state
|
|
1341
|
+
} = result;
|
|
1342
|
+
if (oldState === state || newState === state) {
|
|
1343
|
+
return {
|
|
1344
|
+
error
|
|
1345
|
+
};
|
|
1293
1346
|
}
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1347
|
+
const latestOld = states[uid];
|
|
1348
|
+
const latestNew = {
|
|
1349
|
+
...latestOld.newState,
|
|
1350
|
+
...state
|
|
1351
|
+
};
|
|
1352
|
+
states[uid] = {
|
|
1353
|
+
newState: latestNew,
|
|
1354
|
+
oldState: latestOld.oldState
|
|
1355
|
+
};
|
|
1356
|
+
return {
|
|
1357
|
+
error
|
|
1358
|
+
};
|
|
1359
|
+
};
|
|
1360
|
+
return wrapped;
|
|
1304
1361
|
}
|
|
1305
1362
|
};
|
|
1306
1363
|
};
|
|
@@ -1308,7 +1365,7 @@ const terminate = () => {
|
|
|
1308
1365
|
globalThis.close();
|
|
1309
1366
|
};
|
|
1310
1367
|
|
|
1311
|
-
const Text
|
|
1368
|
+
const Text = 1;
|
|
1312
1369
|
const Link = 2;
|
|
1313
1370
|
const LogLevel = 3;
|
|
1314
1371
|
const RepeatCount = 4;
|
|
@@ -1379,8 +1436,8 @@ const Actions = 'Actions';
|
|
|
1379
1436
|
const Message = 'Message';
|
|
1380
1437
|
const Viewlet = 'Viewlet';
|
|
1381
1438
|
const Output$1 = 'Output';
|
|
1382
|
-
const Option
|
|
1383
|
-
const Select
|
|
1439
|
+
const Option = 'Option';
|
|
1440
|
+
const Select = 'Select';
|
|
1384
1441
|
const Error$1 = 'Error';
|
|
1385
1442
|
const Line = 'Line';
|
|
1386
1443
|
const OutputRepeatCount = 'OutputRepeatCount';
|
|
@@ -1429,14 +1486,14 @@ const parseStructuredLogLine = line => {
|
|
|
1429
1486
|
type: LogLevel,
|
|
1430
1487
|
value: normalizeLevel(parsed.level)
|
|
1431
1488
|
}, {
|
|
1432
|
-
type: Text
|
|
1489
|
+
type: Text,
|
|
1433
1490
|
value: parsed.message
|
|
1434
1491
|
}];
|
|
1435
1492
|
if (!parsed.source) {
|
|
1436
1493
|
return parts;
|
|
1437
1494
|
}
|
|
1438
1495
|
return [...parts, {
|
|
1439
|
-
type: Text
|
|
1496
|
+
type: Text,
|
|
1440
1497
|
value: ' '
|
|
1441
1498
|
}, {
|
|
1442
1499
|
className: OutputSourceLink,
|
|
@@ -1484,7 +1541,7 @@ const parseLine = line => {
|
|
|
1484
1541
|
if (!match) {
|
|
1485
1542
|
if (rest) {
|
|
1486
1543
|
parts.push({
|
|
1487
|
-
type: Text
|
|
1544
|
+
type: Text,
|
|
1488
1545
|
value: rest
|
|
1489
1546
|
});
|
|
1490
1547
|
}
|
|
@@ -1493,7 +1550,7 @@ const parseLine = line => {
|
|
|
1493
1550
|
const index = rest.indexOf(match);
|
|
1494
1551
|
if (index > 0) {
|
|
1495
1552
|
parts.push({
|
|
1496
|
-
type: Text
|
|
1553
|
+
type: Text,
|
|
1497
1554
|
value: rest.slice(0, index)
|
|
1498
1555
|
});
|
|
1499
1556
|
}
|
|
@@ -1502,7 +1559,7 @@ const parseLine = line => {
|
|
|
1502
1559
|
}
|
|
1503
1560
|
if (parts.length === 0) {
|
|
1504
1561
|
return [{
|
|
1505
|
-
type: Text
|
|
1562
|
+
type: Text,
|
|
1506
1563
|
value: ''
|
|
1507
1564
|
}];
|
|
1508
1565
|
}
|
|
@@ -1704,28 +1761,6 @@ const focusIndex = (state, index) => {
|
|
|
1704
1761
|
};
|
|
1705
1762
|
};
|
|
1706
1763
|
|
|
1707
|
-
const Log = 'log';
|
|
1708
|
-
const ToolBar = 'toolbar';
|
|
1709
|
-
|
|
1710
|
-
const Button = 1;
|
|
1711
|
-
const Div = 4;
|
|
1712
|
-
const Input = 6;
|
|
1713
|
-
const Span = 8;
|
|
1714
|
-
const Text = 12;
|
|
1715
|
-
const A = 53;
|
|
1716
|
-
const Select = 63;
|
|
1717
|
-
const Option = 64;
|
|
1718
|
-
|
|
1719
|
-
const Space = 9;
|
|
1720
|
-
const PageUp = 10;
|
|
1721
|
-
const PageDown = 11;
|
|
1722
|
-
const End = 255;
|
|
1723
|
-
const Home = 12;
|
|
1724
|
-
const LeftArrow = 13;
|
|
1725
|
-
const UpArrow = 14;
|
|
1726
|
-
const RightArrow = 15;
|
|
1727
|
-
const DownArrow = 16;
|
|
1728
|
-
|
|
1729
1764
|
const mergeClassNames = (...classNames) => {
|
|
1730
1765
|
return classNames.filter(Boolean).join(' ');
|
|
1731
1766
|
};
|
|
@@ -1734,7 +1769,7 @@ const text = data => {
|
|
|
1734
1769
|
return {
|
|
1735
1770
|
childCount: 0,
|
|
1736
1771
|
text: data,
|
|
1737
|
-
type: Text
|
|
1772
|
+
type: Text$1
|
|
1738
1773
|
};
|
|
1739
1774
|
};
|
|
1740
1775
|
|
|
@@ -2105,10 +2140,13 @@ const getLogsDir = async () => {
|
|
|
2105
2140
|
};
|
|
2106
2141
|
|
|
2107
2142
|
const legacyWindowLogFileName = 'log-window.txt';
|
|
2143
|
+
const isWindowLogFileName = name => {
|
|
2144
|
+
return /^\d+\.txt$/.test(name) || /^\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}\.\d{3}Z\.txt$/.test(name);
|
|
2145
|
+
};
|
|
2108
2146
|
const getLatestLogFileName = dirents => {
|
|
2109
2147
|
let latest = '';
|
|
2110
2148
|
for (const dirent of dirents) {
|
|
2111
|
-
if (dirent.type === 1 &&
|
|
2149
|
+
if (dirent.type === 1 && isWindowLogFileName(dirent.name) && dirent.name > latest) {
|
|
2112
2150
|
latest = dirent.name;
|
|
2113
2151
|
}
|
|
2114
2152
|
}
|
|
@@ -2332,7 +2370,7 @@ const getLinePartDom = part => {
|
|
|
2332
2370
|
childCount: 2,
|
|
2333
2371
|
nodes: [repeatCountNode, text(part.value), spaceNode]
|
|
2334
2372
|
};
|
|
2335
|
-
case Text
|
|
2373
|
+
case Text:
|
|
2336
2374
|
return {
|
|
2337
2375
|
childCount: 1,
|
|
2338
2376
|
nodes: [text(part.value)]
|
|
@@ -2513,8 +2551,8 @@ const getOptionVirtualDom = option => {
|
|
|
2513
2551
|
} = option;
|
|
2514
2552
|
return [{
|
|
2515
2553
|
childCount: 1,
|
|
2516
|
-
className: Option
|
|
2517
|
-
type: Option,
|
|
2554
|
+
className: Option,
|
|
2555
|
+
type: Option$1,
|
|
2518
2556
|
value: id
|
|
2519
2557
|
}, text(label)];
|
|
2520
2558
|
};
|
|
@@ -2522,10 +2560,10 @@ const getOptionVirtualDom = option => {
|
|
|
2522
2560
|
const getSelectVirtualDom = options => {
|
|
2523
2561
|
return [{
|
|
2524
2562
|
childCount: options.length,
|
|
2525
|
-
className: Select
|
|
2563
|
+
className: Select,
|
|
2526
2564
|
name: Output,
|
|
2527
2565
|
onChange: HandleSelect,
|
|
2528
|
-
type: Select
|
|
2566
|
+
type: Select$1
|
|
2529
2567
|
}, ...options.flatMap(getOptionVirtualDom)];
|
|
2530
2568
|
};
|
|
2531
2569
|
|