@lvce-editor/extension-management-worker 4.25.0 → 4.25.2
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.
|
@@ -1212,7 +1212,7 @@ const createMockRpc = ({
|
|
|
1212
1212
|
};
|
|
1213
1213
|
|
|
1214
1214
|
const rpcs$2 = Object.create(null);
|
|
1215
|
-
const set$
|
|
1215
|
+
const set$a = (id, rpc) => {
|
|
1216
1216
|
rpcs$2[id] = rpc;
|
|
1217
1217
|
};
|
|
1218
1218
|
const get$5 = id => {
|
|
@@ -1245,7 +1245,7 @@ const create$1 = rpcId => {
|
|
|
1245
1245
|
const mockRpc = createMockRpc({
|
|
1246
1246
|
commandMap
|
|
1247
1247
|
});
|
|
1248
|
-
set$
|
|
1248
|
+
set$a(rpcId, mockRpc);
|
|
1249
1249
|
// @ts-ignore
|
|
1250
1250
|
mockRpc[Symbol.dispose] = () => {
|
|
1251
1251
|
remove$1(rpcId);
|
|
@@ -1254,7 +1254,7 @@ const create$1 = rpcId => {
|
|
|
1254
1254
|
return mockRpc;
|
|
1255
1255
|
},
|
|
1256
1256
|
set(rpc) {
|
|
1257
|
-
set$
|
|
1257
|
+
set$a(rpcId, rpc);
|
|
1258
1258
|
}
|
|
1259
1259
|
};
|
|
1260
1260
|
};
|
|
@@ -1264,11 +1264,17 @@ const Electron = 2;
|
|
|
1264
1264
|
const Remote = 3;
|
|
1265
1265
|
const Test = 4;
|
|
1266
1266
|
|
|
1267
|
+
const ErrorWorker = 3308;
|
|
1267
1268
|
const ExtensionHostWorker = 44;
|
|
1268
1269
|
const FileSystemWorker = 209;
|
|
1269
1270
|
const RendererWorker = 1;
|
|
1270
1271
|
const SharedProcess = 1492;
|
|
1271
1272
|
|
|
1273
|
+
const {
|
|
1274
|
+
invoke: invoke$6,
|
|
1275
|
+
set: set$9
|
|
1276
|
+
} = create$1(ErrorWorker);
|
|
1277
|
+
|
|
1272
1278
|
const {
|
|
1273
1279
|
dispose,
|
|
1274
1280
|
invoke: invoke$5,
|
|
@@ -1328,6 +1334,10 @@ const {
|
|
|
1328
1334
|
invokeAndTransfer: invokeAndTransfer$1,
|
|
1329
1335
|
set: set$6
|
|
1330
1336
|
} = create$1(RendererWorker);
|
|
1337
|
+
const sendMessagePortToErrorWorker = async (port, rpcId) => {
|
|
1338
|
+
const command = 'Errors.handleMessagePort';
|
|
1339
|
+
await invokeAndTransfer$1('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
|
|
1340
|
+
};
|
|
1331
1341
|
const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
|
|
1332
1342
|
const command = 'IconTheme.handleMessagePort';
|
|
1333
1343
|
await invokeAndTransfer$1('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
|
|
@@ -1597,6 +1607,29 @@ const getOrCreateIsolatedExtensionHostWorker = async (extensionId, absolutePath,
|
|
|
1597
1607
|
return rpc;
|
|
1598
1608
|
};
|
|
1599
1609
|
|
|
1610
|
+
const activateIsolatedExtension = async (extensionId, absolutePath, workerName, activationEvent, getOrCreate = getOrCreateIsolatedExtensionHostWorker) => {
|
|
1611
|
+
const startTime = performance.now();
|
|
1612
|
+
updateRuntimeStatus(extensionId, {
|
|
1613
|
+
activationEvent,
|
|
1614
|
+
activationStartTime: startTime,
|
|
1615
|
+
status: Activating
|
|
1616
|
+
});
|
|
1617
|
+
try {
|
|
1618
|
+
await getOrCreate(extensionId, absolutePath, workerName);
|
|
1619
|
+
const endTime = performance.now();
|
|
1620
|
+
updateRuntimeStatus(extensionId, {
|
|
1621
|
+
activationEndTime: endTime,
|
|
1622
|
+
activationTime: endTime - startTime,
|
|
1623
|
+
status: Activated
|
|
1624
|
+
});
|
|
1625
|
+
} catch (error) {
|
|
1626
|
+
updateRuntimeStatus(extensionId, {
|
|
1627
|
+
status: Error$1
|
|
1628
|
+
});
|
|
1629
|
+
throw error;
|
|
1630
|
+
}
|
|
1631
|
+
};
|
|
1632
|
+
|
|
1600
1633
|
const rpcs = Object.create(null);
|
|
1601
1634
|
const add = (id, rpc) => {
|
|
1602
1635
|
rpcs[id] = rpc;
|
|
@@ -1696,7 +1729,7 @@ const activateExtension3 = async (extension, absolutePath, activationEvent, plat
|
|
|
1696
1729
|
handleRpcInfos(extension, platform);
|
|
1697
1730
|
const extensionId = extension.id || interExtensionId(extension.uri);
|
|
1698
1731
|
if (isExtensionIsolated(extension)) {
|
|
1699
|
-
await
|
|
1732
|
+
await activateIsolatedExtension(extensionId, absolutePath, extension.workerName || '', activationEvent);
|
|
1700
1733
|
return;
|
|
1701
1734
|
}
|
|
1702
1735
|
await importExtension(extensionId, absolutePath, activationEvent);
|
|
@@ -2375,7 +2408,7 @@ const executeDiagnosticProvider = async (extensionsState, textDocument, ...args)
|
|
|
2375
2408
|
const extensions = await getMatchingExtensions$3(extensionsState, textDocument, assetDir, platform);
|
|
2376
2409
|
const rpcs = await Promise.all(extensions.map(extension => getRpc$1(extension, assetDir, platform)));
|
|
2377
2410
|
const results = await Promise.all(rpcs.map(rpc => executeRpcDiagnosticProvider(rpc, textDocument, args)));
|
|
2378
|
-
return results
|
|
2411
|
+
return results.flat();
|
|
2379
2412
|
};
|
|
2380
2413
|
|
|
2381
2414
|
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
|
|
@@ -3131,6 +3164,12 @@ const handleMessagePort = async (port, rpcId) => {
|
|
|
3131
3164
|
}
|
|
3132
3165
|
};
|
|
3133
3166
|
|
|
3167
|
+
const prefix = '[Extension] Uncaught Error: ';
|
|
3168
|
+
const handleUncaughtExtensionError = async error => {
|
|
3169
|
+
const prettyError = await invoke$6('Errors.prepare', error);
|
|
3170
|
+
await invoke$6('Errors.print', prettyError, prefix);
|
|
3171
|
+
};
|
|
3172
|
+
|
|
3134
3173
|
const handleViewContextChange = async (uid, viewId, context) => {
|
|
3135
3174
|
await invoke$3('ExtensionManagement.handleViewContextChange', uid, viewId, context);
|
|
3136
3175
|
};
|
|
@@ -3310,6 +3349,7 @@ const commandMap = {
|
|
|
3310
3349
|
'Extensions.getViews': getViews,
|
|
3311
3350
|
'Extensions.handleData': handleData,
|
|
3312
3351
|
'Extensions.handleMessagePort': handleMessagePort,
|
|
3352
|
+
'Extensions.handleUncaughtExtensionError': handleUncaughtExtensionError,
|
|
3313
3353
|
'Extensions.handleViewContextChange': handleViewContextChange,
|
|
3314
3354
|
'Extensions.importExtension': importExtension,
|
|
3315
3355
|
'Extensions.initialize': initialize,
|
|
@@ -3326,6 +3366,16 @@ const commandMap = {
|
|
|
3326
3366
|
'StatusBar.handleChange': handleChange
|
|
3327
3367
|
};
|
|
3328
3368
|
|
|
3369
|
+
const initializeErrorWorker = async () => {
|
|
3370
|
+
const rpc = await create$6({
|
|
3371
|
+
commandMap: commandMapRef,
|
|
3372
|
+
async send(port) {
|
|
3373
|
+
await sendMessagePortToErrorWorker(port, 0);
|
|
3374
|
+
}
|
|
3375
|
+
});
|
|
3376
|
+
set$9(rpc);
|
|
3377
|
+
};
|
|
3378
|
+
|
|
3329
3379
|
const initializeExtensionHostWorker = async () => {
|
|
3330
3380
|
const rpc = await create$6({
|
|
3331
3381
|
commandMap: commandMapRef,
|
|
@@ -3365,7 +3415,7 @@ const initializeRendererWorker = async () => {
|
|
|
3365
3415
|
|
|
3366
3416
|
const listen = async () => {
|
|
3367
3417
|
Object.assign(commandMapRef, commandMap);
|
|
3368
|
-
await Promise.all([initializeRendererWorker(), initializeFileSystemWorker(), initializeIframeWorker(), initializeExtensionHostWorker()]);
|
|
3418
|
+
await Promise.all([initializeRendererWorker(), initializeErrorWorker(), initializeFileSystemWorker(), initializeIframeWorker(), initializeExtensionHostWorker()]);
|
|
3369
3419
|
};
|
|
3370
3420
|
|
|
3371
3421
|
const main = async () => {
|