@lvce-editor/extension-management-worker 4.85.0 → 4.86.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.
|
@@ -2832,6 +2832,12 @@ const reset = applicationId => {
|
|
|
2832
2832
|
}
|
|
2833
2833
|
};
|
|
2834
2834
|
|
|
2835
|
+
const getCacheFileHandle = async (extensionId, name) => {
|
|
2836
|
+
const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(extensionId));
|
|
2837
|
+
const hash = Array.from(new Uint8Array(digest), byte => byte.toString(16).padStart(2, '0')).join('');
|
|
2838
|
+
return invoke$8('Opfs.getCacheFileHandle', `extension-${hash}`, name);
|
|
2839
|
+
};
|
|
2840
|
+
|
|
2835
2841
|
const prefix = '[Extension] Uncaught Error: ';
|
|
2836
2842
|
const handleUncaughtExtensionError = async error => {
|
|
2837
2843
|
const prettyError = await invoke$7('Errors.prepare', error);
|
|
@@ -3044,6 +3050,7 @@ const createExtensionCommandMap = (extensionId, invokeCommand = invokeGlobalComm
|
|
|
3044
3050
|
return {
|
|
3045
3051
|
...inheritedCommands,
|
|
3046
3052
|
'Extensions.executeCommand': (id, ...args) => executeCommand$1(invokeCommand, id, ...args),
|
|
3053
|
+
'Extensions.getCacheFileHandle': name => invokeCommand('Extensions.getCacheFileHandle', name),
|
|
3047
3054
|
'Extensions.registerFileChangeHandler': () => invokeCommand('Extensions.registerFileChangeHandler'),
|
|
3048
3055
|
'Extensions.unregisterFileChangeHandler': () => invokeCommand('Extensions.unregisterFileChangeHandler')
|
|
3049
3056
|
};
|
|
@@ -3062,6 +3069,9 @@ const createExtensionCommandMap = (extensionId, invokeCommand = invokeGlobalComm
|
|
|
3062
3069
|
'Extensions.executeCommand'(id, ...args) {
|
|
3063
3070
|
return executeCommand$1(invokeCommand, id, ...args);
|
|
3064
3071
|
},
|
|
3072
|
+
'Extensions.getCacheFileHandle'(name) {
|
|
3073
|
+
return getCacheFileHandle(extensionId, name);
|
|
3074
|
+
},
|
|
3065
3075
|
'Extensions.getSecret'(key) {
|
|
3066
3076
|
return getSecret(extensionId, key);
|
|
3067
3077
|
},
|
|
@@ -3117,6 +3127,9 @@ const createIsolatedExtensionHostWorker = async (extensionId, absolutePath, work
|
|
|
3117
3127
|
const runtimeId = getRuntimeId(extensionId, application);
|
|
3118
3128
|
const invokeCommand = application === undefined ? undefined : (method, ...args) => {
|
|
3119
3129
|
assertCurrentApplication(application);
|
|
3130
|
+
if (method === 'Extensions.getCacheFileHandle') {
|
|
3131
|
+
return getCacheFileHandle(extensionId, args[0]);
|
|
3132
|
+
}
|
|
3120
3133
|
if (method === 'Extensions.registerFileChangeHandler') {
|
|
3121
3134
|
return register(extensionId, application.applicationId);
|
|
3122
3135
|
}
|