@lvce-editor/extension-management-worker 1.19.0 → 1.20.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.
|
@@ -231,8 +231,8 @@ const getModuleNotFoundError = stderr => {
|
|
|
231
231
|
const messageIndex = lines.findIndex(isModuleNotFoundMessage);
|
|
232
232
|
const message = lines[messageIndex];
|
|
233
233
|
return {
|
|
234
|
-
|
|
235
|
-
|
|
234
|
+
code: ERR_MODULE_NOT_FOUND,
|
|
235
|
+
message
|
|
236
236
|
};
|
|
237
237
|
};
|
|
238
238
|
const isModuleNotFoundError = stderr => {
|
|
@@ -255,14 +255,14 @@ const isUnhelpfulNativeModuleError = stderr => {
|
|
|
255
255
|
const getNativeModuleErrorMessage = stderr => {
|
|
256
256
|
const message = getMessageCodeBlock(stderr);
|
|
257
257
|
return {
|
|
258
|
-
|
|
259
|
-
|
|
258
|
+
code: E_INCOMPATIBLE_NATIVE_MODULE,
|
|
259
|
+
message: `Incompatible native node module: ${message}`
|
|
260
260
|
};
|
|
261
261
|
};
|
|
262
262
|
const getModuleSyntaxError = () => {
|
|
263
263
|
return {
|
|
264
|
-
|
|
265
|
-
|
|
264
|
+
code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON,
|
|
265
|
+
message: `ES Modules are not supported in electron`
|
|
266
266
|
};
|
|
267
267
|
};
|
|
268
268
|
const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
@@ -281,8 +281,8 @@ const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
|
281
281
|
rest
|
|
282
282
|
} = getDetails(lines);
|
|
283
283
|
return {
|
|
284
|
-
message: actualMessage,
|
|
285
284
|
code: '',
|
|
285
|
+
message: actualMessage,
|
|
286
286
|
stack: rest
|
|
287
287
|
};
|
|
288
288
|
};
|
|
@@ -292,8 +292,8 @@ class IpcError extends VError {
|
|
|
292
292
|
if (stdout || stderr) {
|
|
293
293
|
// @ts-ignore
|
|
294
294
|
const {
|
|
295
|
-
message,
|
|
296
295
|
code,
|
|
296
|
+
message,
|
|
297
297
|
stack
|
|
298
298
|
} = getHelpfulChildProcessError(stdout, stderr);
|
|
299
299
|
const cause = new Error(message);
|
|
@@ -354,8 +354,8 @@ const wrap$f = global => {
|
|
|
354
354
|
};
|
|
355
355
|
const waitForFirstMessage = async port => {
|
|
356
356
|
const {
|
|
357
|
-
|
|
358
|
-
|
|
357
|
+
promise,
|
|
358
|
+
resolve
|
|
359
359
|
} = Promise.withResolvers();
|
|
360
360
|
port.addEventListener('message', resolve, {
|
|
361
361
|
once: true
|
|
@@ -375,8 +375,8 @@ const listen$6 = async () => {
|
|
|
375
375
|
const type = firstMessage.params[0];
|
|
376
376
|
if (type === 'message-port') {
|
|
377
377
|
parentIpc.send({
|
|
378
|
-
jsonrpc: '2.0',
|
|
379
378
|
id: firstMessage.id,
|
|
379
|
+
jsonrpc: '2.0',
|
|
380
380
|
result: null
|
|
381
381
|
});
|
|
382
382
|
parentIpc.dispose();
|
|
@@ -436,8 +436,8 @@ const removeListener = (emitter, type, callback) => {
|
|
|
436
436
|
};
|
|
437
437
|
const getFirstEvent = (eventEmitter, eventMap) => {
|
|
438
438
|
const {
|
|
439
|
-
|
|
440
|
-
|
|
439
|
+
promise,
|
|
440
|
+
resolve
|
|
441
441
|
} = Promise.withResolvers();
|
|
442
442
|
const listenerMap = Object.create(null);
|
|
443
443
|
const cleanup = value => {
|
|
@@ -449,8 +449,8 @@ const getFirstEvent = (eventEmitter, eventMap) => {
|
|
|
449
449
|
for (const [event, type] of Object.entries(eventMap)) {
|
|
450
450
|
const listener = event => {
|
|
451
451
|
cleanup({
|
|
452
|
-
|
|
453
|
-
|
|
452
|
+
event,
|
|
453
|
+
type
|
|
454
454
|
});
|
|
455
455
|
};
|
|
456
456
|
addListener(eventEmitter, event, listener);
|
|
@@ -460,8 +460,8 @@ const getFirstEvent = (eventEmitter, eventMap) => {
|
|
|
460
460
|
};
|
|
461
461
|
const Message$1 = 3;
|
|
462
462
|
const create$5$1 = async ({
|
|
463
|
-
|
|
464
|
-
|
|
463
|
+
isMessagePortOpen,
|
|
464
|
+
messagePort
|
|
465
465
|
}) => {
|
|
466
466
|
if (!isMessagePort(messagePort)) {
|
|
467
467
|
throw new IpcError('port must be of type MessagePort');
|
|
@@ -474,8 +474,8 @@ const create$5$1 = async ({
|
|
|
474
474
|
});
|
|
475
475
|
messagePort.start();
|
|
476
476
|
const {
|
|
477
|
-
|
|
478
|
-
|
|
477
|
+
event,
|
|
478
|
+
type
|
|
479
479
|
} = await eventPromise;
|
|
480
480
|
if (type !== Message$1) {
|
|
481
481
|
throw new IpcError('Failed to wait for ipc message');
|
|
@@ -529,9 +529,9 @@ const parse = content => {
|
|
|
529
529
|
};
|
|
530
530
|
const waitForWebSocketToBeOpen = webSocket => {
|
|
531
531
|
return getFirstEvent(webSocket, {
|
|
532
|
-
open: Open,
|
|
533
532
|
close: Close,
|
|
534
|
-
error: Error$3
|
|
533
|
+
error: Error$3,
|
|
534
|
+
open: Open
|
|
535
535
|
});
|
|
536
536
|
};
|
|
537
537
|
const create$7 = async ({
|
|
@@ -1149,16 +1149,18 @@ const WebWorkerRpcClient = {
|
|
|
1149
1149
|
create: create$4
|
|
1150
1150
|
};
|
|
1151
1151
|
|
|
1152
|
+
const Web = 1;
|
|
1153
|
+
const Electron = 2;
|
|
1154
|
+
const Remote = 3;
|
|
1155
|
+
const Test = 4;
|
|
1156
|
+
|
|
1152
1157
|
const ExtensionHostWorker = 44;
|
|
1153
1158
|
const FileSystemWorker = 209;
|
|
1154
1159
|
const RendererWorker = 1;
|
|
1155
|
-
const SharedProcess =
|
|
1160
|
+
const SharedProcess = 1492;
|
|
1156
1161
|
|
|
1157
1162
|
const rpcs$1 = Object.create(null);
|
|
1158
1163
|
const set$7 = (id, rpc) => {
|
|
1159
|
-
if (rpcs$1[id]) {
|
|
1160
|
-
throw new Error(`rpc with id ${id} is already registered`);
|
|
1161
|
-
}
|
|
1162
1164
|
rpcs$1[id] = rpc;
|
|
1163
1165
|
};
|
|
1164
1166
|
const get$4 = id => {
|
|
@@ -1380,11 +1382,6 @@ const get$2 = id => {
|
|
|
1380
1382
|
return rpcs[id];
|
|
1381
1383
|
};
|
|
1382
1384
|
|
|
1383
|
-
const Web = 1;
|
|
1384
|
-
const Electron = 2;
|
|
1385
|
-
const Remote = 3;
|
|
1386
|
-
const Test = 4;
|
|
1387
|
-
|
|
1388
1385
|
const getUrlPrefix = (platform, extensionPath) => {
|
|
1389
1386
|
if (extensionPath.startsWith('http://') || extensionPath.startsWith('https://')) {
|
|
1390
1387
|
return extensionPath;
|
|
@@ -1831,18 +1828,31 @@ const getDynamicWebExtensions = () => {
|
|
|
1831
1828
|
return state$1.webExtensions;
|
|
1832
1829
|
};
|
|
1833
1830
|
|
|
1834
|
-
const
|
|
1831
|
+
const getWebExtensionsUrl = assetDir => {
|
|
1832
|
+
return `${assetDir}/config/extensions.json`;
|
|
1833
|
+
};
|
|
1834
|
+
|
|
1835
|
+
const getWebExtensions = async assetDir => {
|
|
1836
|
+
try {
|
|
1837
|
+
return await getJson(getWebExtensionsUrl(assetDir));
|
|
1838
|
+
} catch {
|
|
1839
|
+
return [];
|
|
1840
|
+
}
|
|
1841
|
+
};
|
|
1842
|
+
|
|
1843
|
+
const getAllExtensions = async assetDir => {
|
|
1835
1844
|
const state = get$1();
|
|
1836
1845
|
const meta = getDynamicWebExtensions();
|
|
1837
1846
|
if (state.platform === Web) {
|
|
1838
|
-
|
|
1847
|
+
const webExtensions = await getWebExtensions(assetDir);
|
|
1848
|
+
return [...webExtensions, ...meta];
|
|
1839
1849
|
}
|
|
1840
1850
|
const local = await invoke$1('ExtensionManagement.getAllExtensions');
|
|
1841
1851
|
return [...local, ...meta];
|
|
1842
1852
|
};
|
|
1843
1853
|
|
|
1844
|
-
const getColorThemeJson$2 = async colorThemeId => {
|
|
1845
|
-
const extensions = await getAllExtensions();
|
|
1854
|
+
const getColorThemeJson$2 = async (colorThemeId, assetDir) => {
|
|
1855
|
+
const extensions = await getAllExtensions(assetDir);
|
|
1846
1856
|
const colorThemeUri = getColorThemeUri(extensions, colorThemeId);
|
|
1847
1857
|
if (!colorThemeUri) {
|
|
1848
1858
|
return {};
|
|
@@ -1864,7 +1874,7 @@ const getColorThemeJson = (colorThemeId, platform, assetDir) => {
|
|
|
1864
1874
|
if (platform === Web) {
|
|
1865
1875
|
return getColorThemeJson$1(colorThemeId, assetDir);
|
|
1866
1876
|
}
|
|
1867
|
-
return getColorThemeJson$2(colorThemeId);
|
|
1877
|
+
return getColorThemeJson$2(colorThemeId, assetDir);
|
|
1868
1878
|
};
|
|
1869
1879
|
|
|
1870
1880
|
const getColorThemeCssFromJson = async (colorThemeId, colorThemeJson) => {
|
|
@@ -1895,14 +1905,14 @@ const getColorThemeNamesFromExtensions = async extensions => {
|
|
|
1895
1905
|
return colorThemeNames;
|
|
1896
1906
|
};
|
|
1897
1907
|
|
|
1898
|
-
const getColorThemeNames = async
|
|
1899
|
-
const extensions = await getAllExtensions();
|
|
1908
|
+
const getColorThemeNames = async assetDir => {
|
|
1909
|
+
const extensions = await getAllExtensions(assetDir);
|
|
1900
1910
|
const colorThemeNames = getColorThemeNamesFromExtensions(extensions);
|
|
1901
1911
|
return colorThemeNames;
|
|
1902
1912
|
};
|
|
1903
1913
|
|
|
1904
|
-
const getExtension = async id => {
|
|
1905
|
-
const allExtensions = await getAllExtensions();
|
|
1914
|
+
const getExtension = async (id, assetDir) => {
|
|
1915
|
+
const allExtensions = await getAllExtensions(assetDir);
|
|
1906
1916
|
for (const extension of allExtensions) {
|
|
1907
1917
|
if (extension.id === id) {
|
|
1908
1918
|
return extension;
|
|
@@ -2098,9 +2108,9 @@ const getLanguagesFromExtension = (extension, platform) => {
|
|
|
2098
2108
|
return extension.languages.map(getLanguageFromExtension);
|
|
2099
2109
|
};
|
|
2100
2110
|
|
|
2101
|
-
const getLanguages = async platform => {
|
|
2111
|
+
const getLanguages = async (platform, assetDir) => {
|
|
2102
2112
|
try {
|
|
2103
|
-
const extensions = await getAllExtensions();
|
|
2113
|
+
const extensions = await getAllExtensions(assetDir);
|
|
2104
2114
|
const languages = extensions.flatMap(extension => getLanguagesFromExtension(extension, platform));
|
|
2105
2115
|
return languages;
|
|
2106
2116
|
} catch (error) {
|