@lvce-editor/extension-management-worker 4.88.4 → 4.89.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.
|
@@ -127,11 +127,21 @@ const removeWebExtension = (id, applicationId) => {
|
|
|
127
127
|
}, applicationId);
|
|
128
128
|
return true;
|
|
129
129
|
};
|
|
130
|
-
const clearCachedExtensions = applicationId => {
|
|
130
|
+
const clearCachedExtensions = (applicationId, expected) => {
|
|
131
|
+
const current = get$7(applicationId);
|
|
132
|
+
if (expected !== undefined && current.cachedExtensions?.extensions !== expected) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
131
135
|
update({
|
|
132
136
|
cachedExtensions: undefined
|
|
133
137
|
}, applicationId);
|
|
134
138
|
};
|
|
139
|
+
const clearAllCachedExtensions = () => {
|
|
140
|
+
clearCachedExtensions();
|
|
141
|
+
for (const applicationId of applications$2.keys()) {
|
|
142
|
+
clearCachedExtensions(applicationId);
|
|
143
|
+
}
|
|
144
|
+
};
|
|
135
145
|
const getOrCreateWebExtensionsCache = extensionsState => {
|
|
136
146
|
const existing = webExtensionsCaches.get(extensionsState);
|
|
137
147
|
if (existing) {
|
|
@@ -747,7 +757,7 @@ const waitForWebSocketToBeOpen = webSocket => {
|
|
|
747
757
|
open: Open
|
|
748
758
|
});
|
|
749
759
|
};
|
|
750
|
-
const create$
|
|
760
|
+
const create$d = async ({
|
|
751
761
|
webSocket
|
|
752
762
|
}) => {
|
|
753
763
|
const firstWebSocketEvent = await waitForWebSocketToBeOpen(webSocket);
|
|
@@ -784,7 +794,7 @@ const wrap = webSocket => {
|
|
|
784
794
|
};
|
|
785
795
|
const IpcParentWithWebSocket$1 = {
|
|
786
796
|
__proto__: null,
|
|
787
|
-
create: create$
|
|
797
|
+
create: create$d,
|
|
788
798
|
wrap
|
|
789
799
|
};
|
|
790
800
|
|
|
@@ -1095,7 +1105,7 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
|
1095
1105
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
1096
1106
|
return create$1$1(id, errorProperty);
|
|
1097
1107
|
};
|
|
1098
|
-
const create$
|
|
1108
|
+
const create$c = (message, result) => {
|
|
1099
1109
|
return {
|
|
1100
1110
|
id: message.id,
|
|
1101
1111
|
jsonrpc: Two$1,
|
|
@@ -1104,7 +1114,7 @@ const create$b = (message, result) => {
|
|
|
1104
1114
|
};
|
|
1105
1115
|
const getSuccessResponse = (message, result) => {
|
|
1106
1116
|
const resultProperty = result ?? null;
|
|
1107
|
-
return create$
|
|
1117
|
+
return create$c(message, resultProperty);
|
|
1108
1118
|
};
|
|
1109
1119
|
const getErrorResponseSimple = (id, error) => {
|
|
1110
1120
|
return {
|
|
@@ -1203,7 +1213,7 @@ const handleJsonRpcMessage = async (...args) => {
|
|
|
1203
1213
|
|
|
1204
1214
|
const Two = '2.0';
|
|
1205
1215
|
|
|
1206
|
-
const create$
|
|
1216
|
+
const create$b = (method, params) => {
|
|
1207
1217
|
return {
|
|
1208
1218
|
jsonrpc: Two,
|
|
1209
1219
|
method,
|
|
@@ -1211,7 +1221,7 @@ const create$a = (method, params) => {
|
|
|
1211
1221
|
};
|
|
1212
1222
|
};
|
|
1213
1223
|
|
|
1214
|
-
const create$
|
|
1224
|
+
const create$a = (id, method, params) => {
|
|
1215
1225
|
const message = {
|
|
1216
1226
|
id,
|
|
1217
1227
|
jsonrpc: Two,
|
|
@@ -1222,12 +1232,12 @@ const create$9 = (id, method, params) => {
|
|
|
1222
1232
|
};
|
|
1223
1233
|
|
|
1224
1234
|
let id = 0;
|
|
1225
|
-
const create$
|
|
1235
|
+
const create$9 = () => {
|
|
1226
1236
|
return ++id;
|
|
1227
1237
|
};
|
|
1228
1238
|
|
|
1229
1239
|
const registerPromise = map => {
|
|
1230
|
-
const id = create$
|
|
1240
|
+
const id = create$9();
|
|
1231
1241
|
const {
|
|
1232
1242
|
promise,
|
|
1233
1243
|
resolve
|
|
@@ -1244,7 +1254,7 @@ const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer)
|
|
|
1244
1254
|
id,
|
|
1245
1255
|
promise
|
|
1246
1256
|
} = registerPromise(callbacks);
|
|
1247
|
-
const message = create$
|
|
1257
|
+
const message = create$a(id, method, params);
|
|
1248
1258
|
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
1249
1259
|
ipc.sendAndTransfer(message);
|
|
1250
1260
|
} else {
|
|
@@ -1280,7 +1290,7 @@ const createRpc = ipc => {
|
|
|
1280
1290
|
* @deprecated
|
|
1281
1291
|
*/
|
|
1282
1292
|
send(method, ...params) {
|
|
1283
|
-
const message = create$
|
|
1293
|
+
const message = create$b(method, params);
|
|
1284
1294
|
ipc.send(message);
|
|
1285
1295
|
}
|
|
1286
1296
|
};
|
|
@@ -1351,7 +1361,7 @@ const createSharedLazyRpc = factory => {
|
|
|
1351
1361
|
};
|
|
1352
1362
|
};
|
|
1353
1363
|
|
|
1354
|
-
const create$
|
|
1364
|
+
const create$8 = async ({
|
|
1355
1365
|
commandMap,
|
|
1356
1366
|
isMessagePortOpen = true,
|
|
1357
1367
|
messagePort
|
|
@@ -1369,7 +1379,7 @@ const create$7 = async ({
|
|
|
1369
1379
|
return rpc;
|
|
1370
1380
|
};
|
|
1371
1381
|
|
|
1372
|
-
const create$
|
|
1382
|
+
const create$7 = async ({
|
|
1373
1383
|
commandMap,
|
|
1374
1384
|
isMessagePortOpen,
|
|
1375
1385
|
send
|
|
@@ -1379,20 +1389,20 @@ const create$6 = async ({
|
|
|
1379
1389
|
port2
|
|
1380
1390
|
} = new MessageChannel();
|
|
1381
1391
|
await send(port1);
|
|
1382
|
-
return create$
|
|
1392
|
+
return create$8({
|
|
1383
1393
|
commandMap,
|
|
1384
1394
|
isMessagePortOpen,
|
|
1385
1395
|
messagePort: port2
|
|
1386
1396
|
});
|
|
1387
1397
|
};
|
|
1388
1398
|
|
|
1389
|
-
const create$
|
|
1399
|
+
const create$6 = async ({
|
|
1390
1400
|
commandMap,
|
|
1391
1401
|
isMessagePortOpen,
|
|
1392
1402
|
send
|
|
1393
1403
|
}) => {
|
|
1394
1404
|
return createSharedLazyRpc(() => {
|
|
1395
|
-
return create$
|
|
1405
|
+
return create$7({
|
|
1396
1406
|
commandMap,
|
|
1397
1407
|
isMessagePortOpen,
|
|
1398
1408
|
send
|
|
@@ -1420,7 +1430,7 @@ const getProtocol = () => {
|
|
|
1420
1430
|
return location.protocol;
|
|
1421
1431
|
};
|
|
1422
1432
|
|
|
1423
|
-
const create$
|
|
1433
|
+
const create$5 = async ({
|
|
1424
1434
|
commandMap,
|
|
1425
1435
|
webSocket
|
|
1426
1436
|
}) => {
|
|
@@ -1452,7 +1462,7 @@ const connect$1 = async ({
|
|
|
1452
1462
|
}) => {
|
|
1453
1463
|
const webSocket = new WebSocket(wsUrl);
|
|
1454
1464
|
try {
|
|
1455
|
-
const rpc = await create$
|
|
1465
|
+
const rpc = await create$5({
|
|
1456
1466
|
commandMap,
|
|
1457
1467
|
webSocket
|
|
1458
1468
|
});
|
|
@@ -1465,7 +1475,7 @@ const connect$1 = async ({
|
|
|
1465
1475
|
throw error;
|
|
1466
1476
|
}
|
|
1467
1477
|
};
|
|
1468
|
-
const create$
|
|
1478
|
+
const create$4 = async ({
|
|
1469
1479
|
commandMap,
|
|
1470
1480
|
onClose,
|
|
1471
1481
|
type
|
|
@@ -1494,7 +1504,7 @@ const create$3 = async ({
|
|
|
1494
1504
|
return connection.rpc;
|
|
1495
1505
|
};
|
|
1496
1506
|
|
|
1497
|
-
const create$
|
|
1507
|
+
const create$3 = async ({
|
|
1498
1508
|
commandMap,
|
|
1499
1509
|
isMessagePortOpen,
|
|
1500
1510
|
messagePort
|
|
@@ -1511,7 +1521,7 @@ const create$2 = async ({
|
|
|
1511
1521
|
return rpc;
|
|
1512
1522
|
};
|
|
1513
1523
|
|
|
1514
|
-
const create$
|
|
1524
|
+
const create$2 = async ({
|
|
1515
1525
|
commandMap
|
|
1516
1526
|
}) => {
|
|
1517
1527
|
// TODO create a commandMap per rpc instance
|
|
@@ -1568,7 +1578,7 @@ const remove$2 = id => {
|
|
|
1568
1578
|
};
|
|
1569
1579
|
|
|
1570
1580
|
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
1571
|
-
const create = rpcId => {
|
|
1581
|
+
const create$1 = rpcId => {
|
|
1572
1582
|
return {
|
|
1573
1583
|
async dispose() {
|
|
1574
1584
|
const rpc = get$5(rpcId);
|
|
@@ -1607,13 +1617,13 @@ const create = rpcId => {
|
|
|
1607
1617
|
const {
|
|
1608
1618
|
invoke: invoke$9,
|
|
1609
1619
|
set: set$c
|
|
1610
|
-
} = create(6010);
|
|
1620
|
+
} = create$1(6010);
|
|
1611
1621
|
|
|
1612
1622
|
const {
|
|
1613
1623
|
invoke: invoke$8,
|
|
1614
1624
|
invokeAndTransfer: invokeAndTransfer$2,
|
|
1615
1625
|
set: set$b
|
|
1616
|
-
} = create(19_001);
|
|
1626
|
+
} = create$1(19_001);
|
|
1617
1627
|
const getCacheStorageItem = async (request, cacheName, bucketName, bucketOptions) => {
|
|
1618
1628
|
return invoke$8('Cache.getCacheStorageItem', request, cacheName, bucketName, bucketOptions);
|
|
1619
1629
|
};
|
|
@@ -1627,12 +1637,12 @@ const setCacheStorageItem = async (request, value, cacheName, headers, bucketNam
|
|
|
1627
1637
|
const {
|
|
1628
1638
|
invoke: invoke$7,
|
|
1629
1639
|
set: set$a
|
|
1630
|
-
} = create(ErrorWorker);
|
|
1640
|
+
} = create$1(ErrorWorker);
|
|
1631
1641
|
|
|
1632
1642
|
const {
|
|
1633
1643
|
invoke: invoke$6,
|
|
1634
1644
|
set: set$9
|
|
1635
|
-
} = create(FileSystemWorker);
|
|
1645
|
+
} = create$1(FileSystemWorker);
|
|
1636
1646
|
const readFile$1 = async uri => {
|
|
1637
1647
|
return invoke$6('FileSystem.readFile', uri);
|
|
1638
1648
|
};
|
|
@@ -1649,13 +1659,13 @@ const exists = async uri => {
|
|
|
1649
1659
|
const {
|
|
1650
1660
|
invoke: invoke$5,
|
|
1651
1661
|
set: set$8
|
|
1652
|
-
} = create(MainProcess);
|
|
1662
|
+
} = create$1(MainProcess);
|
|
1653
1663
|
|
|
1654
1664
|
const {
|
|
1655
1665
|
invoke: invoke$4,
|
|
1656
1666
|
invokeAndTransfer: invokeAndTransfer$1,
|
|
1657
1667
|
set: set$7
|
|
1658
|
-
} = create(RendererWorker);
|
|
1668
|
+
} = create$1(RendererWorker);
|
|
1659
1669
|
const sendMessagePortToAuthWorker = async (port, rpcId) => {
|
|
1660
1670
|
const command = 'HandleMessagePort.handleMessagePort';
|
|
1661
1671
|
await invokeAndTransfer$1('SendMessagePortToExtensionHostWorker.sendMessagePortToAuthWorker', port, command, rpcId);
|
|
@@ -1680,7 +1690,7 @@ const sendMessagePortToSharedProcess = async port => {
|
|
|
1680
1690
|
const {
|
|
1681
1691
|
invoke: invoke$3,
|
|
1682
1692
|
set: set$6
|
|
1683
|
-
} = create(SharedProcess);
|
|
1693
|
+
} = create$1(SharedProcess);
|
|
1684
1694
|
|
|
1685
1695
|
const extensions = Object.create(null);
|
|
1686
1696
|
const get$4 = extensionId => {
|
|
@@ -2166,6 +2176,32 @@ const getExtensionsWithState = async (extensions, extensionsState, platform) =>
|
|
|
2166
2176
|
} = await getWorkspaceExtensionEnablementSafe();
|
|
2167
2177
|
return withDisabledState(extensionsWithDisabledState, workspaceDisabledIds, workspaceEnabledIds);
|
|
2168
2178
|
};
|
|
2179
|
+
const getSharedProcessExtensions = (extensionsState, fields) => {
|
|
2180
|
+
const current = get$7(extensionsState.applicationId);
|
|
2181
|
+
const requestedFields = fields === undefined ? undefined : [...new Set([...fields, 'id', 'disabled'])];
|
|
2182
|
+
const cached = current.cachedExtensions;
|
|
2183
|
+
if (cached) {
|
|
2184
|
+
const cachedFields = cached.fields;
|
|
2185
|
+
if (cachedFields === undefined || requestedFields !== undefined && requestedFields.every(field => cachedFields.includes(field))) {
|
|
2186
|
+
return cached.extensions;
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
const extensions = Promise.try(() => requestedFields === undefined ? invoke$3('ExtensionManagement.getAllExtensions') : invoke$3('ExtensionManagement.getAllExtensions', requestedFields));
|
|
2190
|
+
update({
|
|
2191
|
+
cachedExtensions: {
|
|
2192
|
+
extensions,
|
|
2193
|
+
fields: requestedFields
|
|
2194
|
+
}
|
|
2195
|
+
}, extensionsState.applicationId);
|
|
2196
|
+
void extensions.catch(() => {
|
|
2197
|
+
try {
|
|
2198
|
+
clearCachedExtensions(extensionsState.applicationId, extensions);
|
|
2199
|
+
} catch {
|
|
2200
|
+
// The application may have been disposed while discovery was pending.
|
|
2201
|
+
}
|
|
2202
|
+
});
|
|
2203
|
+
return extensions;
|
|
2204
|
+
};
|
|
2169
2205
|
const getAllExtensionsWithState = async (extensionsState, assetDir, platform, fields) => {
|
|
2170
2206
|
const {
|
|
2171
2207
|
assetDir: resolvedAssetDir,
|
|
@@ -2187,7 +2223,7 @@ const getAllExtensionsWithState = async (extensionsState, assetDir, platform, fi
|
|
|
2187
2223
|
const compatibleExtensions = [...webExtensions, ...meta].filter(extension => isExtensionCompatible(extension, resolvedPlatform));
|
|
2188
2224
|
extensions = await getExtensionsWithState(compatibleExtensions, extensionsState, resolvedPlatform);
|
|
2189
2225
|
} else {
|
|
2190
|
-
const local =
|
|
2226
|
+
const local = await getSharedProcessExtensions(extensionsState, fields);
|
|
2191
2227
|
extensions = await getExtensionsWithState([...local, ...meta], extensionsState, resolvedPlatform);
|
|
2192
2228
|
}
|
|
2193
2229
|
if (fields === undefined) {
|
|
@@ -2452,7 +2488,7 @@ const fileSystemMethods = new Set(['readFile', 'readDirWithFileTypes', 'stat', '
|
|
|
2452
2488
|
const createFileSystemPort = async (application, port, extensionId) => {
|
|
2453
2489
|
const services = getServices(application);
|
|
2454
2490
|
const version = extensionId === undefined ? 0 : services.extensionVersions.get(extensionId) || 0;
|
|
2455
|
-
const rpc = await create$
|
|
2491
|
+
const rpc = await create$8({
|
|
2456
2492
|
commandMap: {},
|
|
2457
2493
|
messagePort: port
|
|
2458
2494
|
});
|
|
@@ -2476,7 +2512,7 @@ const createFileSystemPort = async (application, port, extensionId) => {
|
|
|
2476
2512
|
throw error;
|
|
2477
2513
|
}
|
|
2478
2514
|
};
|
|
2479
|
-
const dispose = async application => {
|
|
2515
|
+
const dispose$1 = async application => {
|
|
2480
2516
|
const services = applications$1.get(application.applicationGeneration);
|
|
2481
2517
|
if (!services) return;
|
|
2482
2518
|
applications$1.delete(application.applicationGeneration);
|
|
@@ -2806,6 +2842,69 @@ const createNodeRpcMessagePort = async (extensionId, rpcId, port) => {
|
|
|
2806
2842
|
await invokeAndTransfer$1('ExtensionNodeRpc.createMessagePort', port, extensionId, rpcId);
|
|
2807
2843
|
};
|
|
2808
2844
|
|
|
2845
|
+
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
|
|
2846
|
+
const registrations = new Map();
|
|
2847
|
+
const byId = new Map();
|
|
2848
|
+
const keyFor = (extensionId, clientId, application) => JSON.stringify([application?.applicationGeneration ?? null, extensionId, clientId]);
|
|
2849
|
+
const create = async (extensionId, clientId, options, application) => {
|
|
2850
|
+
if (application) assertCurrentApplication(application);
|
|
2851
|
+
if (!Number.isSafeInteger(clientId) || clientId < 1 || !Array.isArray(options?.roots) || options.roots.length === 0 || options.recursive !== undefined && typeof options.recursive !== 'boolean' || options.roots.some(uri => typeof uri !== 'string' || !uri.startsWith('file://')) || options.exclude !== undefined && (!Array.isArray(options.exclude) || options.exclude.some(name => typeof name !== 'string'))) {
|
|
2852
|
+
throw new Error('File watchers require disk roots and a valid registration id');
|
|
2853
|
+
}
|
|
2854
|
+
// Application hosts can expose virtual disk paths through browser callbacks;
|
|
2855
|
+
// a host-process watch would observe a different filesystem for those URIs.
|
|
2856
|
+
if (application) throw new Error('Disk watchers are unavailable for application filesystem providers');
|
|
2857
|
+
const key = keyFor(extensionId, clientId, application);
|
|
2858
|
+
if (registrations.has(key)) throw new Error('File watcher is already registered');
|
|
2859
|
+
const registration = {
|
|
2860
|
+
application,
|
|
2861
|
+
clientId,
|
|
2862
|
+
disposed: false,
|
|
2863
|
+
extensionId,
|
|
2864
|
+
id: crypto.randomUUID()
|
|
2865
|
+
};
|
|
2866
|
+
registrations.set(key, registration);
|
|
2867
|
+
byId.set(registration.id, registration);
|
|
2868
|
+
try {
|
|
2869
|
+
await invoke$2('FileWatcher.watchExtension', registration.id, {
|
|
2870
|
+
...(options.recursive === false && {
|
|
2871
|
+
depth: 0
|
|
2872
|
+
}),
|
|
2873
|
+
exclude: options.exclude || [],
|
|
2874
|
+
roots: options.roots
|
|
2875
|
+
});
|
|
2876
|
+
if (registrations.get(key) !== registration || registration.disposed) throw new Error('File watcher was disposed during registration');
|
|
2877
|
+
} catch (error) {
|
|
2878
|
+
await dispose(extensionId, clientId, application);
|
|
2879
|
+
throw error;
|
|
2880
|
+
}
|
|
2881
|
+
};
|
|
2882
|
+
const dispose = async (extensionId, clientId, application) => {
|
|
2883
|
+
const key = keyFor(extensionId, clientId, application);
|
|
2884
|
+
const registration = registrations.get(key);
|
|
2885
|
+
if (!registration) return;
|
|
2886
|
+
registration.disposed = true;
|
|
2887
|
+
await invoke$2('FileWatcher.disposeExtension', registration.id);
|
|
2888
|
+
registrations.delete(key);
|
|
2889
|
+
byId.delete(registration.id);
|
|
2890
|
+
};
|
|
2891
|
+
const disposeOwner = async (extensionId, applicationId) => {
|
|
2892
|
+
const owned = registrations.values().filter(registration => registration.extensionId === extensionId && registration.application?.applicationId === applicationId).toArray();
|
|
2893
|
+
await Promise.all(owned.map(registration => dispose(extensionId, registration.clientId, registration.application)));
|
|
2894
|
+
};
|
|
2895
|
+
const handleEvent = async (id, event) => {
|
|
2896
|
+
const registration = byId.get(id);
|
|
2897
|
+
if (!registration || registration.disposed) return;
|
|
2898
|
+
const {
|
|
2899
|
+
application,
|
|
2900
|
+
clientId,
|
|
2901
|
+
extensionId
|
|
2902
|
+
} = registration;
|
|
2903
|
+
if (application) assertCurrentApplication(application);
|
|
2904
|
+
const rpc = get$2(extensionId, application?.applicationId);
|
|
2905
|
+
await rpc?.invoke('ExtensionApi.handleFileWatcherEvent', clientId, event);
|
|
2906
|
+
};
|
|
2907
|
+
|
|
2809
2908
|
const extensionIds = new Set();
|
|
2810
2909
|
const applications = new Map();
|
|
2811
2910
|
const register = (extensionId, applicationId) => {
|
|
@@ -3060,6 +3159,8 @@ const createExtensionCommandMap = (extensionId, invokeCommand = invokeGlobalComm
|
|
|
3060
3159
|
// callback (notifications, secrets, file watchers, or privileged node ports).
|
|
3061
3160
|
return {
|
|
3062
3161
|
...inheritedCommands,
|
|
3162
|
+
'Extensions.createFileSystemWatcher': (clientId, options) => invokeCommand('Extensions.createFileSystemWatcher', clientId, options),
|
|
3163
|
+
'Extensions.disposeFileSystemWatcher': clientId => invokeCommand('Extensions.disposeFileSystemWatcher', clientId),
|
|
3063
3164
|
'Extensions.executeCommand': (id, ...args) => executeCommand$1(invokeCommand, id, ...args),
|
|
3064
3165
|
'Extensions.getCacheFileHandle': name => invokeCommand('Extensions.getCacheFileHandle', name),
|
|
3065
3166
|
'Extensions.registerFileChangeHandler': () => invokeCommand('Extensions.registerFileChangeHandler'),
|
|
@@ -3069,6 +3170,9 @@ const createExtensionCommandMap = (extensionId, invokeCommand = invokeGlobalComm
|
|
|
3069
3170
|
}
|
|
3070
3171
|
return {
|
|
3071
3172
|
...inheritedCommands,
|
|
3173
|
+
'Extensions.createFileSystemWatcher'(clientId, options) {
|
|
3174
|
+
return create(extensionId, clientId, options);
|
|
3175
|
+
},
|
|
3072
3176
|
'Extensions.createNodeRpcConnection'(rpcId) {
|
|
3073
3177
|
return createNodeRpcConnection(extensionId, rpcId);
|
|
3074
3178
|
},
|
|
@@ -3078,6 +3182,9 @@ const createExtensionCommandMap = (extensionId, invokeCommand = invokeGlobalComm
|
|
|
3078
3182
|
'Extensions.deleteSecret'(key) {
|
|
3079
3183
|
return deleteSecret(extensionId, key);
|
|
3080
3184
|
},
|
|
3185
|
+
'Extensions.disposeFileSystemWatcher'(clientId) {
|
|
3186
|
+
return dispose(extensionId, clientId);
|
|
3187
|
+
},
|
|
3081
3188
|
'Extensions.executeCommand'(id, ...args) {
|
|
3082
3189
|
return executeCommand$1(invokeCommand, id, ...args);
|
|
3083
3190
|
},
|
|
@@ -3145,6 +3252,12 @@ const createIsolatedExtensionHostWorker = async (extensionId, absolutePath, work
|
|
|
3145
3252
|
if (method === 'Extensions.getCacheFileHandle') {
|
|
3146
3253
|
return getCacheFileHandle(extensionId, args[0]);
|
|
3147
3254
|
}
|
|
3255
|
+
if (method === 'Extensions.createFileSystemWatcher') {
|
|
3256
|
+
return create(extensionId, args[0], args[1], application);
|
|
3257
|
+
}
|
|
3258
|
+
if (method === 'Extensions.disposeFileSystemWatcher') {
|
|
3259
|
+
return dispose(extensionId, args[0], application);
|
|
3260
|
+
}
|
|
3148
3261
|
if (method === 'Extensions.registerFileChangeHandler') {
|
|
3149
3262
|
return register(extensionId, application.applicationId);
|
|
3150
3263
|
}
|
|
@@ -3179,7 +3292,7 @@ const createIsolatedExtensionHostWorker = async (extensionId, absolutePath, work
|
|
|
3179
3292
|
return bindCommandMap(rpc, commandMap);
|
|
3180
3293
|
};
|
|
3181
3294
|
const createWorker = (extensionId, absolutePath, workerName, contentSecurityPolicy, application) => {
|
|
3182
|
-
return createIsolatedExtensionHostWorker(extensionId, absolutePath, workerName, contentSecurityPolicy, create$
|
|
3295
|
+
return createIsolatedExtensionHostWorker(extensionId, absolutePath, workerName, contentSecurityPolicy, create$7, invokeAndTransfer, application);
|
|
3183
3296
|
};
|
|
3184
3297
|
const createAndStoreRpc = async (extensionId, absolutePath, workerName, contentSecurityPolicy, create, application) => {
|
|
3185
3298
|
try {
|
|
@@ -3414,6 +3527,7 @@ const activateByEvent = async (event, assetDir, platform, application) => {
|
|
|
3414
3527
|
};
|
|
3415
3528
|
|
|
3416
3529
|
const invalidateExtensionsCache = async (extensionId, disabled) => {
|
|
3530
|
+
clearAllCachedExtensions();
|
|
3417
3531
|
try {
|
|
3418
3532
|
if (extensionId) {
|
|
3419
3533
|
await invoke$4('ExtensionManagement.handleExtensionsCacheInvalidated', extensionId, disabled);
|
|
@@ -3534,20 +3648,16 @@ const disposeIsolatedExtensionHostWorker = async (extensionId, invoke = invoke$2
|
|
|
3534
3648
|
unregister(extensionId);
|
|
3535
3649
|
const rpc = remove$1(extensionId);
|
|
3536
3650
|
if (!rpc) {
|
|
3651
|
+
await disposeOwner(extensionId);
|
|
3537
3652
|
return false;
|
|
3538
3653
|
}
|
|
3539
3654
|
resetExtensionActivation(extensionId);
|
|
3540
3655
|
resetExtensionRuntimeState(extensionId);
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
try {
|
|
3547
|
-
await rpc.dispose();
|
|
3548
|
-
} catch {
|
|
3549
|
-
// The extension is already disabled and removed from state.
|
|
3550
|
-
}
|
|
3656
|
+
// Close all owned resources even if one backend fails during teardown.
|
|
3657
|
+
const [watchers] = await Promise.allSettled([disposeOwner(extensionId), Promise.try(() => invoke('LaunchIsolatedExtensionHostWorker.disposeIsolatedExtensionHostWorker', extensionId)), Promise.try(() => rpc.dispose())]);
|
|
3658
|
+
// Older renderers may not support worker disposal; watcher cleanup failures
|
|
3659
|
+
// still need to remain visible so their registrations can be retried.
|
|
3660
|
+
if (watchers.status === 'rejected') throw watchers.reason;
|
|
3551
3661
|
return true;
|
|
3552
3662
|
};
|
|
3553
3663
|
|
|
@@ -3662,7 +3772,7 @@ const disposeExtensionApplication = async applicationId => {
|
|
|
3662
3772
|
clear$1(applicationId);
|
|
3663
3773
|
resetAllExtensionActivations(application);
|
|
3664
3774
|
reset(applicationId);
|
|
3665
|
-
const results = await Promise.allSettled([dispose(application), ...runtimes.map(async ({
|
|
3775
|
+
const results = await Promise.allSettled([dispose$1(application), ...runtimes.map(async ({
|
|
3666
3776
|
id,
|
|
3667
3777
|
rpc
|
|
3668
3778
|
}) => {
|
|
@@ -5583,7 +5693,7 @@ const createWebViewIpc = async webView => {
|
|
|
5583
5693
|
port1,
|
|
5584
5694
|
port2
|
|
5585
5695
|
} = getPortTuple();
|
|
5586
|
-
const rpcPromise = create$
|
|
5696
|
+
const rpcPromise = create$3({
|
|
5587
5697
|
commandMap: {},
|
|
5588
5698
|
isMessagePortOpen: false,
|
|
5589
5699
|
messagePort: port2
|
|
@@ -5974,7 +6084,7 @@ const StatusBarWorker = 200;
|
|
|
5974
6084
|
const NotificationCenterWorker = 201;
|
|
5975
6085
|
|
|
5976
6086
|
const handleMessagePort = async (port, rpcId) => {
|
|
5977
|
-
const rpc = await create$
|
|
6087
|
+
const rpc = await create$8({
|
|
5978
6088
|
commandMap: commandMapRef,
|
|
5979
6089
|
messagePort: port
|
|
5980
6090
|
});
|
|
@@ -5990,7 +6100,7 @@ const handleViewContextChange = async (uid, viewId, context) => {
|
|
|
5990
6100
|
};
|
|
5991
6101
|
|
|
5992
6102
|
const defaultDependencies$4 = {
|
|
5993
|
-
createRpc: create$
|
|
6103
|
+
createRpc: create$6,
|
|
5994
6104
|
invokeRendererAndTransfer: invokeAndTransfer$1,
|
|
5995
6105
|
setMainProcess: set$8
|
|
5996
6106
|
};
|
|
@@ -6011,12 +6121,12 @@ const initializeMainProcess = async (platform, dependencies = defaultDependencie
|
|
|
6011
6121
|
};
|
|
6012
6122
|
|
|
6013
6123
|
const defaultDependencies$3 = {
|
|
6014
|
-
createLegacyWebSocketRpc: create$
|
|
6015
|
-
createTransferMessagePortRpc: create$
|
|
6124
|
+
createLegacyWebSocketRpc: create$4,
|
|
6125
|
+
createTransferMessagePortRpc: create$7,
|
|
6016
6126
|
createWebSocket(url, protocols) {
|
|
6017
6127
|
return new WebSocket(url, [...protocols]);
|
|
6018
6128
|
},
|
|
6019
|
-
createWebSocketRpc: create$
|
|
6129
|
+
createWebSocketRpc: create$5,
|
|
6020
6130
|
invokeRenderer: invoke$4,
|
|
6021
6131
|
sendMessagePortToSharedProcess: sendMessagePortToSharedProcess,
|
|
6022
6132
|
setSharedProcess: set$6
|
|
@@ -6578,6 +6688,7 @@ const commandMap = {
|
|
|
6578
6688
|
'Extensions.getWorkspaceTransportUri': getWorkspaceTransportUri,
|
|
6579
6689
|
'Extensions.handleData': handleData,
|
|
6580
6690
|
'Extensions.handleFileChanges': handleFileChanges,
|
|
6691
|
+
'Extensions.handleFileWatcherEvent': handleEvent,
|
|
6581
6692
|
'Extensions.handleLinkedExtensionChange': handleLinkedExtensionChange,
|
|
6582
6693
|
'Extensions.handleMessagePort': handleMessagePort,
|
|
6583
6694
|
'Extensions.handleUncaughtExtensionError': handleUncaughtExtensionError,
|
|
@@ -6610,7 +6721,7 @@ const commandMap = {
|
|
|
6610
6721
|
};
|
|
6611
6722
|
|
|
6612
6723
|
const initializeAuthWorker = async () => {
|
|
6613
|
-
const rpc = await create$
|
|
6724
|
+
const rpc = await create$6({
|
|
6614
6725
|
commandMap: commandMapRef,
|
|
6615
6726
|
async send(port) {
|
|
6616
6727
|
await sendMessagePortToAuthWorker(port, 0);
|
|
@@ -6620,7 +6731,7 @@ const initializeAuthWorker = async () => {
|
|
|
6620
6731
|
};
|
|
6621
6732
|
|
|
6622
6733
|
const initializeCacheWorker = async () => {
|
|
6623
|
-
const rpc = await create$
|
|
6734
|
+
const rpc = await create$6({
|
|
6624
6735
|
commandMap: commandMapRef,
|
|
6625
6736
|
async send(port) {
|
|
6626
6737
|
await invokeAndTransfer$1('SendMessagePortToExtensionHostWorker.sendMessagePortToCacheWorker', port);
|
|
@@ -6630,7 +6741,7 @@ const initializeCacheWorker = async () => {
|
|
|
6630
6741
|
};
|
|
6631
6742
|
|
|
6632
6743
|
const initializeErrorWorker = async () => {
|
|
6633
|
-
const rpc = await create$
|
|
6744
|
+
const rpc = await create$6({
|
|
6634
6745
|
commandMap: commandMapRef,
|
|
6635
6746
|
async send(port) {
|
|
6636
6747
|
await sendMessagePortToErrorWorker(port, 0);
|
|
@@ -6640,7 +6751,7 @@ const initializeErrorWorker = async () => {
|
|
|
6640
6751
|
};
|
|
6641
6752
|
|
|
6642
6753
|
const initializeFileSystemWorker = async () => {
|
|
6643
|
-
const rpc = await create$
|
|
6754
|
+
const rpc = await create$6({
|
|
6644
6755
|
commandMap: commandMapRef,
|
|
6645
6756
|
async send(port) {
|
|
6646
6757
|
await sendMessagePortToFileSystemWorker$1(port, 0);
|
|
@@ -6650,7 +6761,7 @@ const initializeFileSystemWorker = async () => {
|
|
|
6650
6761
|
};
|
|
6651
6762
|
|
|
6652
6763
|
const initializeIframeWorker = async () => {
|
|
6653
|
-
const rpc = await create$
|
|
6764
|
+
const rpc = await create$6({
|
|
6654
6765
|
commandMap: {},
|
|
6655
6766
|
async send(port) {
|
|
6656
6767
|
await sendMessagePortToIconThemeWorker(port, 0);
|
|
@@ -6660,7 +6771,7 @@ const initializeIframeWorker = async () => {
|
|
|
6660
6771
|
};
|
|
6661
6772
|
|
|
6662
6773
|
const initializeRendererWorker = async () => {
|
|
6663
|
-
const rpc = await create$
|
|
6774
|
+
const rpc = await create$2({
|
|
6664
6775
|
commandMap: commandMap
|
|
6665
6776
|
});
|
|
6666
6777
|
set$7(rpc);
|