@lvce-editor/extension-management-worker 4.90.0 → 4.90.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.
|
@@ -1818,10 +1818,11 @@ const isStaticHttpAssetDir = assetDir => {
|
|
|
1818
1818
|
const isHttpLocation = () => {
|
|
1819
1819
|
return Reflect.has(globalThis, 'location') && globalThis.location.protocol.startsWith('http');
|
|
1820
1820
|
};
|
|
1821
|
-
const getRuntimeContext = async (assetDir, platform) => {
|
|
1821
|
+
const getRuntimeContext = async (assetDir, platform, applicationId) => {
|
|
1822
1822
|
const shouldInferPlatform = isMissingPlatform(platform);
|
|
1823
|
-
const
|
|
1824
|
-
const
|
|
1823
|
+
const invoke = command => applicationId === undefined ? invoke$4(command) : invoke$4('Application.execute', applicationId, command);
|
|
1824
|
+
const resolvedAssetDir = isMissingAssetDir(assetDir) ? await invoke('Layout.getAssetDir') : assetDir;
|
|
1825
|
+
const resolvedPlatform = shouldInferPlatform ? await invoke('Layout.getPlatform') : platform;
|
|
1825
1826
|
if (shouldInferPlatform && isHttpLocation() && isStaticHttpAssetDir(resolvedAssetDir)) {
|
|
1826
1827
|
return {
|
|
1827
1828
|
assetDir: resolvedAssetDir,
|
|
@@ -3547,7 +3548,14 @@ const deferInvalidateExtensionsCache = (extensionId, disabled) => {
|
|
|
3547
3548
|
}, 0);
|
|
3548
3549
|
};
|
|
3549
3550
|
|
|
3550
|
-
const handleChange$1 = async _id => {
|
|
3551
|
+
const handleChange$1 = async (_id, applicationId) => {
|
|
3552
|
+
if (applicationId !== undefined) {
|
|
3553
|
+
const visible = await invoke$4('Application.execute', applicationId, 'Layout.getStatusBarVisible');
|
|
3554
|
+
if (visible) {
|
|
3555
|
+
await invoke$4('Application.execute', applicationId, 'StatusBar.handleChange');
|
|
3556
|
+
}
|
|
3557
|
+
return;
|
|
3558
|
+
}
|
|
3551
3559
|
const statusBarVisible = await invoke$4('Layout.getStatusBarVisible');
|
|
3552
3560
|
if (!statusBarVisible) {
|
|
3553
3561
|
return;
|
|
@@ -3647,6 +3655,42 @@ const createWebViewWorkerRpc = async (rpcInfo, port) => {
|
|
|
3647
3655
|
});
|
|
3648
3656
|
};
|
|
3649
3657
|
|
|
3658
|
+
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
|
|
3659
|
+
|
|
3660
|
+
const instances = Object.create(null);
|
|
3661
|
+
const set$1 = (uid, instance) => {
|
|
3662
|
+
instances[uid] = instance;
|
|
3663
|
+
};
|
|
3664
|
+
const get$1 = uid => {
|
|
3665
|
+
return instances[uid];
|
|
3666
|
+
};
|
|
3667
|
+
const getEntries = () => {
|
|
3668
|
+
return Object.entries(instances).map(([uid, instance]) => ({
|
|
3669
|
+
instance,
|
|
3670
|
+
uid: Number(uid)
|
|
3671
|
+
}));
|
|
3672
|
+
};
|
|
3673
|
+
const remove = uid => {
|
|
3674
|
+
delete instances[uid];
|
|
3675
|
+
};
|
|
3676
|
+
const invalidateRpc = rpc => {
|
|
3677
|
+
for (const {
|
|
3678
|
+
instance,
|
|
3679
|
+
uid
|
|
3680
|
+
} of getEntries()) {
|
|
3681
|
+
if (instance.status === 'ready' && instance.rpc === rpc) {
|
|
3682
|
+
set$1(uid, {
|
|
3683
|
+
error: {
|
|
3684
|
+
message: 'Extension runtime disposed',
|
|
3685
|
+
name: 'Error'
|
|
3686
|
+
},
|
|
3687
|
+
status: 'error',
|
|
3688
|
+
viewId: instance.viewId
|
|
3689
|
+
});
|
|
3690
|
+
}
|
|
3691
|
+
}
|
|
3692
|
+
};
|
|
3693
|
+
|
|
3650
3694
|
const disposeIsolatedExtensionHostWorker = async (extensionId, invoke = invoke$2) => {
|
|
3651
3695
|
unregister(extensionId);
|
|
3652
3696
|
const rpc = remove$1(extensionId);
|
|
@@ -3654,6 +3698,7 @@ const disposeIsolatedExtensionHostWorker = async (extensionId, invoke = invoke$2
|
|
|
3654
3698
|
await disposeOwner(extensionId);
|
|
3655
3699
|
return false;
|
|
3656
3700
|
}
|
|
3701
|
+
invalidateRpc(rpc);
|
|
3657
3702
|
resetExtensionActivation(extensionId);
|
|
3658
3703
|
resetExtensionRuntimeState(extensionId);
|
|
3659
3704
|
// Close all owned resources even if one backend fails during teardown.
|
|
@@ -4999,7 +5044,7 @@ const getOutputChannelProviders = async extensionsState => {
|
|
|
4999
5044
|
const {
|
|
5000
5045
|
assetDir,
|
|
5001
5046
|
platform
|
|
5002
|
-
} = await getRuntimeContext('', extensionsState.platform);
|
|
5047
|
+
} = await getRuntimeContext('', extensionsState.platform, extensionsState.applicationId);
|
|
5003
5048
|
const extensions = await getAllExtensionsWithState(extensionsState, assetDir, platform);
|
|
5004
5049
|
const outputExtensions = extensions.filter(hasOutputChannels);
|
|
5005
5050
|
const providers = await Promise.all(outputExtensions.map(extension => getExtensionOutputChannelProviders(extension, assetDir, platform)));
|
|
@@ -5026,7 +5071,7 @@ const resolveOutputChannel = async (extensionsState, uri) => {
|
|
|
5026
5071
|
const {
|
|
5027
5072
|
assetDir,
|
|
5028
5073
|
platform
|
|
5029
|
-
} = await getRuntimeContext('', extensionsState.platform);
|
|
5074
|
+
} = await getRuntimeContext('', extensionsState.platform, extensionsState.applicationId);
|
|
5030
5075
|
const extensions = await getAllExtensionsWithState(extensionsState, assetDir, platform);
|
|
5031
5076
|
const extension = extensions.find(candidate => getExtensionId$3(candidate) === extensionId && hasOutputChannels(candidate));
|
|
5032
5077
|
const isContributed = extension?.outputChannels?.some(outputChannel => outputChannel.id === outputChannelId);
|
|
@@ -5064,25 +5109,6 @@ const readOutputChannel = async (extensionsState, uri) => {
|
|
|
5064
5109
|
return logs;
|
|
5065
5110
|
};
|
|
5066
5111
|
|
|
5067
|
-
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
|
|
5068
|
-
|
|
5069
|
-
const instances = Object.create(null);
|
|
5070
|
-
const set$1 = (uid, instance) => {
|
|
5071
|
-
instances[uid] = instance;
|
|
5072
|
-
};
|
|
5073
|
-
const get$1 = uid => {
|
|
5074
|
-
return instances[uid];
|
|
5075
|
-
};
|
|
5076
|
-
const getEntries = () => {
|
|
5077
|
-
return Object.entries(instances).map(([uid, instance]) => ({
|
|
5078
|
-
instance,
|
|
5079
|
-
uid: Number(uid)
|
|
5080
|
-
}));
|
|
5081
|
-
};
|
|
5082
|
-
const remove = uid => {
|
|
5083
|
-
delete instances[uid];
|
|
5084
|
-
};
|
|
5085
|
-
|
|
5086
5112
|
const serializeError = error => {
|
|
5087
5113
|
if (error instanceof Error) {
|
|
5088
5114
|
return {
|
|
@@ -6544,7 +6570,7 @@ const wrapSourceControlProviderCommand = methodName => {
|
|
|
6544
6570
|
return executeRequiredSourceControlProvider(extensionsState, providerId, methodName, ...args);
|
|
6545
6571
|
});
|
|
6546
6572
|
};
|
|
6547
|
-
const sharedApplicationCommands = new Set(['Extensions.getColorThemeCss', 'Extensions.getColorThemeCssFromJson', 'Extensions.getColorThemeJson', 'Extensions.getColorThemeNames'
|
|
6573
|
+
const sharedApplicationCommands = new Set(['Extensions.getColorThemeCss', 'Extensions.getColorThemeCssFromJson', 'Extensions.getColorThemeJson', 'Extensions.getColorThemeNames']);
|
|
6548
6574
|
const invokeForApplication = async (applicationId, method, ...args) => {
|
|
6549
6575
|
const application = get$7(applicationId);
|
|
6550
6576
|
const command = commandMap[method];
|
|
@@ -6570,6 +6596,8 @@ const invokeForApplication = async (applicationId, method, ...args) => {
|
|
|
6570
6596
|
return getAllExtensionsWithState(application, args[0] || '', args[1] ?? application.platform, args[2]);
|
|
6571
6597
|
case 'Extensions.getDynamicWebExtensions':
|
|
6572
6598
|
return application.webExtensions;
|
|
6599
|
+
case 'Extensions.getPreference':
|
|
6600
|
+
return invoke$2('Application.execute', applicationId, 'Preferences.get', ...args);
|
|
6573
6601
|
case 'Extensions.getRpcInfo':
|
|
6574
6602
|
return getRpcInfo$1(application, args[0]);
|
|
6575
6603
|
case 'Extensions.getRuntimeStatus':
|
|
@@ -6589,8 +6617,14 @@ const invokeForApplication = async (applicationId, method, ...args) => {
|
|
|
6589
6617
|
return requestViewRerender(args[0], applicationId);
|
|
6590
6618
|
case 'Extensions.sendMessagePortToFileSystemWorker':
|
|
6591
6619
|
return createFileSystemPort(application, args[0]);
|
|
6620
|
+
case 'Extensions.setPreference':
|
|
6621
|
+
return invoke$2('Application.execute', applicationId, 'Preferences.update', {
|
|
6622
|
+
[args[0]]: args[1]
|
|
6623
|
+
});
|
|
6592
6624
|
case 'Extensions.showNotification':
|
|
6593
6625
|
return invoke$2('Application.execute', applicationId, 'Notification.create', ...args);
|
|
6626
|
+
case 'StatusBar.handleChange':
|
|
6627
|
+
return handleChange$1(args[0], applicationId);
|
|
6594
6628
|
default:
|
|
6595
6629
|
throw new Error(`Extension command does not support application context: ${method}`);
|
|
6596
6630
|
}
|