@lvce-editor/output-view 2.21.0 → 2.21.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/outputViewWorkerMain.js +35 -1
- package/package.json +1 -1
|
@@ -1179,6 +1179,9 @@ const {
|
|
|
1179
1179
|
invoke: invoke$3,
|
|
1180
1180
|
set: set$4
|
|
1181
1181
|
} = create$2(FileSystemWorker);
|
|
1182
|
+
const readDirWithFileTypes = async uri => {
|
|
1183
|
+
return invoke$3('FileSystem.readDirWithFileTypes', uri);
|
|
1184
|
+
};
|
|
1182
1185
|
const readFile = async uri => {
|
|
1183
1186
|
return invoke$3('FileSystem.readFile', uri);
|
|
1184
1187
|
};
|
|
@@ -1210,6 +1213,9 @@ const sendMessagePortToExtensionManagementWorker = async (port, rpcId) => {
|
|
|
1210
1213
|
const command = 'Extensions.handleMessagePort';
|
|
1211
1214
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionManagementWorker', port, command, rpcId);
|
|
1212
1215
|
};
|
|
1216
|
+
const getWindowId = async () => {
|
|
1217
|
+
return invoke$1('GetWindowId.getWindowId');
|
|
1218
|
+
};
|
|
1213
1219
|
const showSaveFilePicker = async () => {
|
|
1214
1220
|
return invoke$1('FilePicker.showSaveFilePicker');
|
|
1215
1221
|
};
|
|
@@ -2014,6 +2020,7 @@ const initialize = async () => {
|
|
|
2014
2020
|
};
|
|
2015
2021
|
|
|
2016
2022
|
const Web = 1;
|
|
2023
|
+
const Electron = 2;
|
|
2017
2024
|
|
|
2018
2025
|
const getSelectedItem = (selectedOption, platform) => {
|
|
2019
2026
|
if (selectedOption) {
|
|
@@ -2097,12 +2104,39 @@ const getLogsDir = async () => {
|
|
|
2097
2104
|
}
|
|
2098
2105
|
};
|
|
2099
2106
|
|
|
2107
|
+
const legacyWindowLogFileName = 'log-window.txt';
|
|
2108
|
+
const getLatestLogFileName = dirents => {
|
|
2109
|
+
let latest = '';
|
|
2110
|
+
for (const dirent of dirents) {
|
|
2111
|
+
if (dirent.type === 1 && /^\d+\.txt$/.test(dirent.name) && dirent.name > latest) {
|
|
2112
|
+
latest = dirent.name;
|
|
2113
|
+
}
|
|
2114
|
+
}
|
|
2115
|
+
return latest;
|
|
2116
|
+
};
|
|
2117
|
+
const getWindowLogUri = async logsFolderUri => {
|
|
2118
|
+
const legacyWindowLogUri = `${logsFolderUri}/${legacyWindowLogFileName}`;
|
|
2119
|
+
try {
|
|
2120
|
+
const windowId = await getWindowId();
|
|
2121
|
+
const windowLogsFolderUri = `${logsFolderUri}/${windowId}`;
|
|
2122
|
+
const dirents = await readDirWithFileTypes(windowLogsFolderUri);
|
|
2123
|
+
const latestLogFileName = getLatestLogFileName(dirents);
|
|
2124
|
+
if (latestLogFileName) {
|
|
2125
|
+
return `${windowLogsFolderUri}/${latestLogFileName}`;
|
|
2126
|
+
}
|
|
2127
|
+
} catch {
|
|
2128
|
+
return legacyWindowLogUri;
|
|
2129
|
+
}
|
|
2130
|
+
return legacyWindowLogUri;
|
|
2131
|
+
};
|
|
2132
|
+
|
|
2100
2133
|
const loadOptions = async platform => {
|
|
2101
2134
|
const extensionOptions = await getExtensionOptions();
|
|
2102
2135
|
if (platform === Web) {
|
|
2103
2136
|
return extensionOptions;
|
|
2104
2137
|
}
|
|
2105
2138
|
const logsFolderUri = await getLogsDir();
|
|
2139
|
+
const windowLogUri = platform === Electron ? await getWindowLogUri(logsFolderUri) : `${logsFolderUri}/log-window.txt`;
|
|
2106
2140
|
return [{
|
|
2107
2141
|
id: MainProcess,
|
|
2108
2142
|
label: 'Main Process',
|
|
@@ -2114,7 +2148,7 @@ const loadOptions = async platform => {
|
|
|
2114
2148
|
}, {
|
|
2115
2149
|
id: Window,
|
|
2116
2150
|
label: 'Window',
|
|
2117
|
-
uri:
|
|
2151
|
+
uri: windowLogUri
|
|
2118
2152
|
}, ...extensionOptions];
|
|
2119
2153
|
};
|
|
2120
2154
|
|