@lvce-editor/output-view 2.24.4 → 2.24.6
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 +110 -14
- package/package.json +1 -1
|
@@ -1555,7 +1555,13 @@ const getLinkPart = match => {
|
|
|
1555
1555
|
value: match
|
|
1556
1556
|
};
|
|
1557
1557
|
};
|
|
1558
|
-
const parseLine = line => {
|
|
1558
|
+
const parseLine = (line, parseLinks = true) => {
|
|
1559
|
+
if (!parseLinks) {
|
|
1560
|
+
return [{
|
|
1561
|
+
type: Text,
|
|
1562
|
+
value: line
|
|
1563
|
+
}];
|
|
1564
|
+
}
|
|
1559
1565
|
const structuredLine = parseStructuredLogLine(line);
|
|
1560
1566
|
if (structuredLine) {
|
|
1561
1567
|
return structuredLine;
|
|
@@ -1598,10 +1604,10 @@ const readOutput = async uri => {
|
|
|
1598
1604
|
}
|
|
1599
1605
|
return readFile(uri);
|
|
1600
1606
|
};
|
|
1601
|
-
const loadLines = async uri => {
|
|
1607
|
+
const loadLines = async (uri, parseLinks = true) => {
|
|
1602
1608
|
try {
|
|
1603
1609
|
const content = await readOutput(uri);
|
|
1604
|
-
const lines = aggregateLines(content.split('\n').map(parseLine));
|
|
1610
|
+
const lines = aggregateLines(content.split('\n').map(line => parseLine(line, parseLinks)));
|
|
1605
1611
|
return {
|
|
1606
1612
|
code: 0,
|
|
1607
1613
|
error: '',
|
|
@@ -1649,7 +1655,7 @@ const clear = async state => {
|
|
|
1649
1655
|
code,
|
|
1650
1656
|
error,
|
|
1651
1657
|
lines
|
|
1652
|
-
} = await loadLines(uri);
|
|
1658
|
+
} = await loadLines(uri, option.parseLinks);
|
|
1653
1659
|
const filteredItems = filterItems(lines, filterValue);
|
|
1654
1660
|
return {
|
|
1655
1661
|
...state,
|
|
@@ -2353,7 +2359,7 @@ const selectChannel = async (state, id) => {
|
|
|
2353
2359
|
code,
|
|
2354
2360
|
error,
|
|
2355
2361
|
lines
|
|
2356
|
-
} = await loadLines(matchingOption.uri);
|
|
2362
|
+
} = await loadLines(matchingOption.uri, matchingOption.parseLinks);
|
|
2357
2363
|
|
|
2358
2364
|
// TODO memory leak and race condition, need to dispose file watcher of previous uri
|
|
2359
2365
|
const newWatchId = isExtensionOutputUri(matchingOption.uri) ? 0 : createWatchId();
|
|
@@ -2539,6 +2545,22 @@ const getWindowLogUri = async logsFolderUri => {
|
|
|
2539
2545
|
return legacyWindowLogUri;
|
|
2540
2546
|
};
|
|
2541
2547
|
|
|
2548
|
+
const createState = () => {
|
|
2549
|
+
let active = false;
|
|
2550
|
+
const isActive = () => active;
|
|
2551
|
+
const setActive = value => {
|
|
2552
|
+
active = value;
|
|
2553
|
+
};
|
|
2554
|
+
return {
|
|
2555
|
+
isActive,
|
|
2556
|
+
setActive
|
|
2557
|
+
};
|
|
2558
|
+
};
|
|
2559
|
+
const {
|
|
2560
|
+
isActive,
|
|
2561
|
+
setActive
|
|
2562
|
+
} = createState();
|
|
2563
|
+
|
|
2542
2564
|
const loadOptions = async platform => {
|
|
2543
2565
|
const extensionOptions = await getExtensionOptions();
|
|
2544
2566
|
const detailOptions = await getExtensionDetailOptions();
|
|
@@ -2546,13 +2568,16 @@ const loadOptions = async platform => {
|
|
|
2546
2568
|
return [...detailOptions, ...extensionOptions];
|
|
2547
2569
|
}
|
|
2548
2570
|
const logsFolderUri = await getLogsDir();
|
|
2571
|
+
const previewSandboxActive = isActive();
|
|
2549
2572
|
const previewSandboxLogUri = `${logsFolderUri}/log-preview-sandbox.txt`;
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
await
|
|
2573
|
+
if (previewSandboxActive) {
|
|
2574
|
+
try {
|
|
2575
|
+
if (!(await exists(previewSandboxLogUri))) {
|
|
2576
|
+
await writeFile(previewSandboxLogUri, '');
|
|
2577
|
+
}
|
|
2578
|
+
} catch {
|
|
2579
|
+
// Keep the Output view usable if the preview log cannot be initialized.
|
|
2553
2580
|
}
|
|
2554
|
-
} catch {
|
|
2555
|
-
// Keep the Output view usable if the preview log cannot be initialized.
|
|
2556
2581
|
}
|
|
2557
2582
|
const windowLogUri = platform === Electron ? await getWindowLogUri(logsFolderUri) : `${logsFolderUri}/log-window.txt`;
|
|
2558
2583
|
return [{
|
|
@@ -2567,11 +2592,11 @@ const loadOptions = async platform => {
|
|
|
2567
2592
|
id: Window,
|
|
2568
2593
|
label: 'Window',
|
|
2569
2594
|
uri: windowLogUri
|
|
2570
|
-
}, {
|
|
2595
|
+
}, ...(previewSandboxActive ? [{
|
|
2571
2596
|
id: PreviewSandbox,
|
|
2572
2597
|
label: 'Preview Sandbox',
|
|
2573
2598
|
uri: previewSandboxLogUri
|
|
2574
|
-
}, ...detailOptions, ...extensionOptions];
|
|
2599
|
+
}] : []), ...detailOptions, ...extensionOptions];
|
|
2575
2600
|
};
|
|
2576
2601
|
|
|
2577
2602
|
const getSavedFilterValue = savedState => {
|
|
@@ -2655,7 +2680,7 @@ const loadContent = async (state, savedState) => {
|
|
|
2655
2680
|
code,
|
|
2656
2681
|
error,
|
|
2657
2682
|
lines
|
|
2658
|
-
} = await loadLines(uri);
|
|
2683
|
+
} = await loadLines(uri, option.parseLinks);
|
|
2659
2684
|
const filteredItems = filterItems(lines, filterValue);
|
|
2660
2685
|
const newWatchId = isExtensionOutputUri(uri) ? 0 : createWatchId();
|
|
2661
2686
|
await setupChangeListener(watchId, newWatchId, uri);
|
|
@@ -2702,7 +2727,7 @@ const refresh = async state => {
|
|
|
2702
2727
|
code,
|
|
2703
2728
|
error,
|
|
2704
2729
|
lines
|
|
2705
|
-
} = await loadLines(matchingOption.uri);
|
|
2730
|
+
} = await loadLines(matchingOption.uri, matchingOption.parseLinks);
|
|
2706
2731
|
const filteredItems = filterItems(lines, filterValue);
|
|
2707
2732
|
return {
|
|
2708
2733
|
...state,
|
|
@@ -2713,6 +2738,54 @@ const refresh = async state => {
|
|
|
2713
2738
|
};
|
|
2714
2739
|
};
|
|
2715
2740
|
|
|
2741
|
+
const refreshOptions = async state => {
|
|
2742
|
+
const {
|
|
2743
|
+
filterValue,
|
|
2744
|
+
platform,
|
|
2745
|
+
selectedOption,
|
|
2746
|
+
watchId
|
|
2747
|
+
} = state;
|
|
2748
|
+
const options = await loadOptions(platform);
|
|
2749
|
+
const option = options.find(option => option.id === selectedOption) || options[0];
|
|
2750
|
+
if (!option) {
|
|
2751
|
+
await setupChangeListener(watchId, 0, '');
|
|
2752
|
+
return {
|
|
2753
|
+
...state,
|
|
2754
|
+
error: '',
|
|
2755
|
+
errorCode: 0,
|
|
2756
|
+
filteredItems: [],
|
|
2757
|
+
listItems: [],
|
|
2758
|
+
options,
|
|
2759
|
+
selectedOption: '',
|
|
2760
|
+
watchId: 0
|
|
2761
|
+
};
|
|
2762
|
+
}
|
|
2763
|
+
if (option.id === selectedOption) {
|
|
2764
|
+
return {
|
|
2765
|
+
...state,
|
|
2766
|
+
options
|
|
2767
|
+
};
|
|
2768
|
+
}
|
|
2769
|
+
const {
|
|
2770
|
+
code,
|
|
2771
|
+
error,
|
|
2772
|
+
lines
|
|
2773
|
+
} = await loadLines(option.uri, option.parseLinks);
|
|
2774
|
+
const filteredItems = filterItems(lines, filterValue);
|
|
2775
|
+
const newWatchId = isExtensionOutputUri(option.uri) ? 0 : createWatchId();
|
|
2776
|
+
await setupChangeListener(watchId, newWatchId, option.uri);
|
|
2777
|
+
return {
|
|
2778
|
+
...state,
|
|
2779
|
+
error,
|
|
2780
|
+
errorCode: code,
|
|
2781
|
+
filteredItems,
|
|
2782
|
+
listItems: lines,
|
|
2783
|
+
options,
|
|
2784
|
+
selectedOption: option.id,
|
|
2785
|
+
watchId: newWatchId
|
|
2786
|
+
};
|
|
2787
|
+
};
|
|
2788
|
+
|
|
2716
2789
|
const renderCss = (oldState, newState) => {
|
|
2717
2790
|
const {
|
|
2718
2791
|
deltaY,
|
|
@@ -3032,6 +3105,28 @@ const setOutputChannel = async state => {
|
|
|
3032
3105
|
};
|
|
3033
3106
|
|
|
3034
3107
|
const handleDirectMessagePort = (port, setAsRendererProcess = true) => handleMessagePort(port, commandMap, setAsRendererProcess);
|
|
3108
|
+
const setPreviewSandboxActive = async active => {
|
|
3109
|
+
if (isActive() === active) {
|
|
3110
|
+
return;
|
|
3111
|
+
}
|
|
3112
|
+
setActive(active);
|
|
3113
|
+
for (const uid of getKeys()) {
|
|
3114
|
+
const current = get(uid);
|
|
3115
|
+
if (!current) {
|
|
3116
|
+
continue;
|
|
3117
|
+
}
|
|
3118
|
+
const updatedState = await refreshOptions(current.newState);
|
|
3119
|
+
const latest = get(uid);
|
|
3120
|
+
if (!latest) {
|
|
3121
|
+
continue;
|
|
3122
|
+
}
|
|
3123
|
+
set$1(uid, latest.oldState, {
|
|
3124
|
+
...latest.newState,
|
|
3125
|
+
...updatedState
|
|
3126
|
+
});
|
|
3127
|
+
await invoke$1('Viewlet.requestRender', uid);
|
|
3128
|
+
}
|
|
3129
|
+
};
|
|
3035
3130
|
const commandMap = {
|
|
3036
3131
|
'Output.clear': wrapCommand(clear),
|
|
3037
3132
|
'Output.closeFindWidget': wrapCommand(closeFindWidget),
|
|
@@ -3074,6 +3169,7 @@ const commandMap = {
|
|
|
3074
3169
|
'Output.setDeltaY': wrapCommand(setDeltaY),
|
|
3075
3170
|
'Output.setLogLevel': setLogLevel,
|
|
3076
3171
|
'Output.setOutputChannel': wrapCommand(setOutputChannel),
|
|
3172
|
+
'Output.setPreviewSandboxActive': setPreviewSandboxActive,
|
|
3077
3173
|
'Output.terminate': terminate
|
|
3078
3174
|
};
|
|
3079
3175
|
|