@lvce-editor/output-view 2.2.0 → 2.4.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 +48 -139
- package/package.json +1 -1
|
@@ -63,7 +63,7 @@ class AssertionError extends Error {
|
|
|
63
63
|
const Object$1 = 1;
|
|
64
64
|
const Number$1 = 2;
|
|
65
65
|
const Array$1 = 3;
|
|
66
|
-
const String = 4;
|
|
66
|
+
const String$1 = 4;
|
|
67
67
|
const Boolean$1 = 5;
|
|
68
68
|
const Function = 6;
|
|
69
69
|
const Null = 7;
|
|
@@ -75,7 +75,7 @@ const getType = value => {
|
|
|
75
75
|
case 'function':
|
|
76
76
|
return Function;
|
|
77
77
|
case 'string':
|
|
78
|
-
return String;
|
|
78
|
+
return String$1;
|
|
79
79
|
case 'object':
|
|
80
80
|
if (value === null) {
|
|
81
81
|
return Null;
|
|
@@ -1049,18 +1049,22 @@ const RightArrow = 15;
|
|
|
1049
1049
|
const DownArrow = 16;
|
|
1050
1050
|
|
|
1051
1051
|
const ExtensionHostWorker = 44;
|
|
1052
|
-
const FileSystemWorker
|
|
1052
|
+
const FileSystemWorker = 209;
|
|
1053
1053
|
const OutputWorker = 7001;
|
|
1054
1054
|
const RendererWorker = 1;
|
|
1055
1055
|
|
|
1056
1056
|
const rpcs = Object.create(null);
|
|
1057
|
-
const set$
|
|
1057
|
+
const set$5 = (id, rpc) => {
|
|
1058
1058
|
rpcs[id] = rpc;
|
|
1059
1059
|
};
|
|
1060
1060
|
const get$1 = id => {
|
|
1061
1061
|
return rpcs[id];
|
|
1062
1062
|
};
|
|
1063
|
+
const remove = id => {
|
|
1064
|
+
delete rpcs[id];
|
|
1065
|
+
};
|
|
1063
1066
|
|
|
1067
|
+
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
1064
1068
|
const create$2 = rpcId => {
|
|
1065
1069
|
return {
|
|
1066
1070
|
async dispose() {
|
|
@@ -1079,145 +1083,56 @@ const create$2 = rpcId => {
|
|
|
1079
1083
|
// @ts-ignore
|
|
1080
1084
|
return rpc.invokeAndTransfer(method, ...params);
|
|
1081
1085
|
},
|
|
1086
|
+
registerMockRpc(commandMap) {
|
|
1087
|
+
const mockRpc = createMockRpc({
|
|
1088
|
+
commandMap
|
|
1089
|
+
});
|
|
1090
|
+
set$5(rpcId, mockRpc);
|
|
1091
|
+
// @ts-ignore
|
|
1092
|
+
mockRpc[Symbol.dispose] = () => {
|
|
1093
|
+
remove(rpcId);
|
|
1094
|
+
};
|
|
1095
|
+
// @ts-ignore
|
|
1096
|
+
return mockRpc;
|
|
1097
|
+
},
|
|
1082
1098
|
set(rpc) {
|
|
1083
|
-
set$
|
|
1099
|
+
set$5(rpcId, rpc);
|
|
1084
1100
|
}
|
|
1085
1101
|
};
|
|
1086
1102
|
};
|
|
1087
1103
|
|
|
1088
1104
|
const {
|
|
1089
|
-
dispose: dispose$1,
|
|
1090
1105
|
invoke: invoke$3,
|
|
1091
|
-
|
|
1092
|
-
set: set$5
|
|
1106
|
+
set: set$4
|
|
1093
1107
|
} = create$2(ExtensionHostWorker);
|
|
1094
|
-
const executeReferenceProvider = async (id, offset) => {
|
|
1095
|
-
// @ts-ignore
|
|
1096
|
-
return invoke$3('ExtensionHostReference.executeReferenceProvider', id, offset);
|
|
1097
|
-
};
|
|
1098
|
-
const executeFileReferenceProvider = async id => {
|
|
1099
|
-
// @ts-ignore
|
|
1100
|
-
return invoke$3('ExtensionHostReference.executeFileReferenceProvider', id);
|
|
1101
|
-
};
|
|
1102
|
-
const getRuntimeStatus = async extensionId => {
|
|
1103
|
-
// @ts-ignore
|
|
1104
|
-
return invoke$3('ExtensionHost.getRuntimeStatus', extensionId);
|
|
1105
|
-
};
|
|
1106
|
-
const registerMockRpc$1 = commandMap => {
|
|
1107
|
-
const mockRpc = createMockRpc({
|
|
1108
|
-
commandMap
|
|
1109
|
-
});
|
|
1110
|
-
set$5(mockRpc);
|
|
1111
|
-
return mockRpc;
|
|
1112
|
-
};
|
|
1113
1108
|
|
|
1114
1109
|
const ExtensionHost = {
|
|
1115
1110
|
__proto__: null,
|
|
1116
|
-
dispose: dispose$1,
|
|
1117
|
-
executeFileReferenceProvider,
|
|
1118
|
-
executeReferenceProvider,
|
|
1119
|
-
getRuntimeStatus,
|
|
1120
1111
|
invoke: invoke$3,
|
|
1121
|
-
|
|
1122
|
-
registerMockRpc: registerMockRpc$1,
|
|
1123
|
-
set: set$5
|
|
1112
|
+
set: set$4
|
|
1124
1113
|
};
|
|
1125
1114
|
|
|
1126
1115
|
const {
|
|
1127
|
-
dispose,
|
|
1128
1116
|
invoke: invoke$2,
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
const remove = async dirent => {
|
|
1133
|
-
return invoke$2('FileSystem.remove', dirent);
|
|
1134
|
-
};
|
|
1135
|
-
const readDirWithFileTypes = async uri => {
|
|
1136
|
-
return invoke$2('FileSystem.readDirWithFileTypes', uri);
|
|
1137
|
-
};
|
|
1138
|
-
const getPathSeparator = async root => {
|
|
1139
|
-
return invoke$2('FileSystem.getPathSeparator', root);
|
|
1140
|
-
};
|
|
1141
|
-
const getRealPath = async path => {
|
|
1142
|
-
return invoke$2('FileSystem.getRealPath', path);
|
|
1143
|
-
};
|
|
1144
|
-
const stat = async dirent => {
|
|
1145
|
-
return invoke$2('FileSystem.stat', dirent);
|
|
1146
|
-
};
|
|
1147
|
-
const createFile = async uri => {
|
|
1148
|
-
return invoke$2('FileSystem.writeFile', uri, '');
|
|
1149
|
-
};
|
|
1150
|
-
const readFile$1 = async uri => {
|
|
1117
|
+
set: set$3
|
|
1118
|
+
} = create$2(FileSystemWorker);
|
|
1119
|
+
const readFile = async uri => {
|
|
1151
1120
|
return invoke$2('FileSystem.readFile', uri);
|
|
1152
1121
|
};
|
|
1153
|
-
const writeFile
|
|
1122
|
+
const writeFile = async (uri, content) => {
|
|
1154
1123
|
return invoke$2('FileSystem.writeFile', uri, content);
|
|
1155
1124
|
};
|
|
1156
|
-
const mkdir = async uri => {
|
|
1157
|
-
return invoke$2('FileSystem.mkdir', uri);
|
|
1158
|
-
};
|
|
1159
|
-
const rename = async (oldUri, newUri) => {
|
|
1160
|
-
return invoke$2('FileSystem.rename', oldUri, newUri);
|
|
1161
|
-
};
|
|
1162
|
-
const copy = async (oldUri, newUri) => {
|
|
1163
|
-
return invoke$2('FileSystem.copy', oldUri, newUri);
|
|
1164
|
-
};
|
|
1165
|
-
const exists = async uri => {
|
|
1166
|
-
return invoke$2('FileSystem.exists', uri);
|
|
1167
|
-
};
|
|
1168
|
-
const getFolderSize = async uri => {
|
|
1169
|
-
return invoke$2('FileSystem.getFolderSize', uri);
|
|
1170
|
-
};
|
|
1171
|
-
const readFileAsBlob = async uri => {
|
|
1172
|
-
return invoke$2('FileSystem.readFileAsBlob', uri);
|
|
1173
|
-
};
|
|
1174
|
-
const appendFile = async (uri, text) => {
|
|
1175
|
-
return invoke$2('FileSystem.appendFile', uri, text);
|
|
1176
|
-
};
|
|
1177
1125
|
const watchFile = async (watchId, uri, rpcId) => {
|
|
1178
1126
|
await invoke$2('FileSystem.watchFile', watchId, uri, rpcId);
|
|
1179
1127
|
};
|
|
1180
1128
|
const unwatchFile = async watchId => {
|
|
1181
1129
|
await invoke$2('FileSystem.unwatchFile', watchId);
|
|
1182
1130
|
};
|
|
1183
|
-
const registerMockRpc = commandMap => {
|
|
1184
|
-
const mockRpc = createMockRpc({
|
|
1185
|
-
commandMap
|
|
1186
|
-
});
|
|
1187
|
-
set$4(mockRpc);
|
|
1188
|
-
return mockRpc;
|
|
1189
|
-
};
|
|
1190
|
-
|
|
1191
|
-
const FileSystemWorker = {
|
|
1192
|
-
__proto__: null,
|
|
1193
|
-
appendFile,
|
|
1194
|
-
copy,
|
|
1195
|
-
createFile,
|
|
1196
|
-
dispose,
|
|
1197
|
-
exists,
|
|
1198
|
-
getFolderSize,
|
|
1199
|
-
getPathSeparator,
|
|
1200
|
-
getRealPath,
|
|
1201
|
-
invoke: invoke$2,
|
|
1202
|
-
invokeAndTransfer: invokeAndTransfer$1,
|
|
1203
|
-
mkdir,
|
|
1204
|
-
readDirWithFileTypes,
|
|
1205
|
-
readFile: readFile$1,
|
|
1206
|
-
readFileAsBlob,
|
|
1207
|
-
registerMockRpc,
|
|
1208
|
-
remove,
|
|
1209
|
-
rename,
|
|
1210
|
-
set: set$4,
|
|
1211
|
-
stat,
|
|
1212
|
-
unwatchFile,
|
|
1213
|
-
watchFile,
|
|
1214
|
-
writeFile: writeFile$1
|
|
1215
|
-
};
|
|
1216
1131
|
|
|
1217
1132
|
const {
|
|
1218
1133
|
invoke: invoke$1,
|
|
1219
1134
|
invokeAndTransfer,
|
|
1220
|
-
set: set$
|
|
1135
|
+
set: set$2
|
|
1221
1136
|
} = create$2(RendererWorker);
|
|
1222
1137
|
const sendMessagePortToFileSystemWorker$1 = async (port, rpcId) => {
|
|
1223
1138
|
const command = 'FileSystem.handleMessagePort';
|
|
@@ -1325,12 +1240,6 @@ const terminate = () => {
|
|
|
1325
1240
|
globalThis.close();
|
|
1326
1241
|
};
|
|
1327
1242
|
|
|
1328
|
-
const {
|
|
1329
|
-
readFile,
|
|
1330
|
-
set: set$2,
|
|
1331
|
-
writeFile
|
|
1332
|
-
} = FileSystemWorker;
|
|
1333
|
-
|
|
1334
1243
|
const getTextFromParts = parts => {
|
|
1335
1244
|
let result = '';
|
|
1336
1245
|
for (const part of parts) {
|
|
@@ -1408,13 +1317,13 @@ const loadLines = async uri => {
|
|
|
1408
1317
|
if (isFileNotFoundError(error)) {
|
|
1409
1318
|
return {
|
|
1410
1319
|
code: 1,
|
|
1411
|
-
error:
|
|
1320
|
+
error: 'log file not found',
|
|
1412
1321
|
lines: []
|
|
1413
1322
|
};
|
|
1414
1323
|
}
|
|
1415
1324
|
return {
|
|
1416
1325
|
code: 2,
|
|
1417
|
-
error:
|
|
1326
|
+
error: String(error),
|
|
1418
1327
|
lines: []
|
|
1419
1328
|
};
|
|
1420
1329
|
}
|
|
@@ -1748,7 +1657,7 @@ const selectChannel = async (state, id) => {
|
|
|
1748
1657
|
if (!matchingOption) {
|
|
1749
1658
|
return state;
|
|
1750
1659
|
}
|
|
1751
|
-
// TODO potential race
|
|
1660
|
+
// TODO potential race condition when switching output channels fast
|
|
1752
1661
|
const {
|
|
1753
1662
|
code,
|
|
1754
1663
|
error,
|
|
@@ -1818,21 +1727,13 @@ const createFileSystemWorkerRpc = async () => {
|
|
|
1818
1727
|
|
|
1819
1728
|
const initializeFileSystemWorker = async () => {
|
|
1820
1729
|
const rpc = await createFileSystemWorkerRpc();
|
|
1821
|
-
set$
|
|
1730
|
+
set$3(rpc);
|
|
1822
1731
|
};
|
|
1823
1732
|
|
|
1824
1733
|
const initialize = async () => {
|
|
1825
1734
|
await Promise.all([initializeFileSystemWorker(), initializeExtensionHost()]);
|
|
1826
1735
|
};
|
|
1827
1736
|
|
|
1828
|
-
const getLogsDir = async () => {
|
|
1829
|
-
try {
|
|
1830
|
-
return await getLogsDir$1();
|
|
1831
|
-
} catch {
|
|
1832
|
-
return `file:///tmp`;
|
|
1833
|
-
}
|
|
1834
|
-
};
|
|
1835
|
-
|
|
1836
1737
|
const Web = 1;
|
|
1837
1738
|
|
|
1838
1739
|
const getSelectedItem = (selectedOption, platform) => {
|
|
@@ -1915,19 +1816,28 @@ const getExtensionOptions = async () => {
|
|
|
1915
1816
|
}
|
|
1916
1817
|
};
|
|
1917
1818
|
|
|
1918
|
-
const
|
|
1819
|
+
const getLogsDir = async () => {
|
|
1820
|
+
try {
|
|
1821
|
+
return await getLogsDir$1();
|
|
1822
|
+
} catch {
|
|
1823
|
+
return `file:///tmp`;
|
|
1824
|
+
}
|
|
1825
|
+
};
|
|
1826
|
+
|
|
1827
|
+
const loadOptions = async platform => {
|
|
1919
1828
|
const extensionOptions = await getExtensionOptions();
|
|
1920
1829
|
if (platform === Web) {
|
|
1921
1830
|
return extensionOptions;
|
|
1922
1831
|
}
|
|
1832
|
+
const logsFolderUri = await getLogsDir();
|
|
1923
1833
|
return [{
|
|
1924
1834
|
id: MainProcess,
|
|
1925
1835
|
label: 'Main Process',
|
|
1926
|
-
uri: `${
|
|
1836
|
+
uri: `${logsFolderUri}/log-main-process.txt`
|
|
1927
1837
|
}, {
|
|
1928
1838
|
id: SharedProcess,
|
|
1929
1839
|
label: 'Shared Process',
|
|
1930
|
-
uri: `${
|
|
1840
|
+
uri: `${logsFolderUri}/log-shared-process.txt`
|
|
1931
1841
|
}, ...extensionOptions];
|
|
1932
1842
|
};
|
|
1933
1843
|
|
|
@@ -1978,14 +1888,13 @@ const loadContent = async (state, savedState) => {
|
|
|
1978
1888
|
watchId
|
|
1979
1889
|
} = state;
|
|
1980
1890
|
const collapsedUris = getSavedCollapsedUris(savedState);
|
|
1981
|
-
const logsFolderPath = await getLogsDir();
|
|
1982
1891
|
const {
|
|
1983
1892
|
filterValue,
|
|
1984
1893
|
scrollLockEnabled,
|
|
1985
1894
|
selectedOption
|
|
1986
1895
|
} = restoreState(savedState);
|
|
1987
1896
|
const selectedId = getSelectedItem(selectedOption, platform);
|
|
1988
|
-
const options = await loadOptions(platform
|
|
1897
|
+
const options = await loadOptions(platform);
|
|
1989
1898
|
const option = getMatchingOpen(options, selectedId);
|
|
1990
1899
|
if (!option) {
|
|
1991
1900
|
throw new Error('option not found');
|
|
@@ -2056,7 +1965,7 @@ const refresh = async state => {
|
|
|
2056
1965
|
};
|
|
2057
1966
|
|
|
2058
1967
|
const renderFilterValue = (oldState, newState) => {
|
|
2059
|
-
return ['Viewlet.setValueByName',
|
|
1968
|
+
return ['Viewlet.setValueByName', Filter$2, newState.filterValue];
|
|
2060
1969
|
};
|
|
2061
1970
|
|
|
2062
1971
|
const Filter = 'Filter';
|
|
@@ -2156,7 +2065,7 @@ const renderItems = (oldState, newState) => {
|
|
|
2156
2065
|
const renderSelectedItem = (oldState, newState) => {
|
|
2157
2066
|
const value = newState.selectedOption;
|
|
2158
2067
|
const name = Output$1;
|
|
2159
|
-
return ['Viewlet.setValueByName',
|
|
2068
|
+
return ['Viewlet.setValueByName', name, value];
|
|
2160
2069
|
};
|
|
2161
2070
|
|
|
2162
2071
|
const getRenderer = diffType => {
|
|
@@ -2414,7 +2323,7 @@ const listen = async () => {
|
|
|
2414
2323
|
const rpc = await WebWorkerRpcClient.create({
|
|
2415
2324
|
commandMap: commandMapRef
|
|
2416
2325
|
});
|
|
2417
|
-
set$
|
|
2326
|
+
set$2(rpc);
|
|
2418
2327
|
};
|
|
2419
2328
|
|
|
2420
2329
|
const main = async () => {
|