@lvce-editor/extension-management-worker 4.87.1 → 4.88.1
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.
|
@@ -1297,6 +1297,9 @@ const logError = () => {
|
|
|
1297
1297
|
// handled by renderer worker
|
|
1298
1298
|
};
|
|
1299
1299
|
const handleMessage = event => {
|
|
1300
|
+
if (event.data === 'ready') {
|
|
1301
|
+
return Promise.resolve();
|
|
1302
|
+
}
|
|
1300
1303
|
const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
|
|
1301
1304
|
const actualExecute = event?.target?.execute || execute;
|
|
1302
1305
|
return handleJsonRpcMessage(event.target, event.data, actualExecute, event.target._resolve, preparePrettyError, logError, actualRequiresSocket);
|
|
@@ -6212,6 +6215,18 @@ const getRemoteUrl = uri => {
|
|
|
6212
6215
|
return `/remote/${normalized}`;
|
|
6213
6216
|
};
|
|
6214
6217
|
|
|
6218
|
+
const builtinStaticPathRegex = /(?:^|\/)static\/([a-f\d]{7,40})\/extensions\/([^/]+)$/i;
|
|
6219
|
+
const getBuiltinTokenizerUrl = (extension, tokenizePath) => {
|
|
6220
|
+
if (typeof extension.id !== 'string' || !extension.id.startsWith('builtin.') || typeof extension.path !== 'string') {
|
|
6221
|
+
return '';
|
|
6222
|
+
}
|
|
6223
|
+
const match = extension.path.match(builtinStaticPathRegex);
|
|
6224
|
+
if (!match || match[2] !== extension.id) {
|
|
6225
|
+
return '';
|
|
6226
|
+
}
|
|
6227
|
+
const [, commitHash, extensionId] = match;
|
|
6228
|
+
return `/${commitHash}/extensions/${extensionId}/${tokenizePath}`;
|
|
6229
|
+
};
|
|
6215
6230
|
const getLanguagesFromExtension = (extension, platform) => {
|
|
6216
6231
|
// TODO what if extension is null? should not crash process, handle error gracefully
|
|
6217
6232
|
// TODO what if extension languages is not of type array?
|
|
@@ -6234,7 +6249,8 @@ const getLanguagesFromExtension = (extension, platform) => {
|
|
|
6234
6249
|
};
|
|
6235
6250
|
}
|
|
6236
6251
|
const relativePath = `${extensionPath}/${language.tokenize}`;
|
|
6237
|
-
const
|
|
6252
|
+
const builtinTokenizerUrl = getBuiltinTokenizerUrl(extension, language.tokenize);
|
|
6253
|
+
const absolutePath = builtinTokenizerUrl || (platform === Web ? relativePath : getRemoteUrl(relativePath));
|
|
6238
6254
|
return {
|
|
6239
6255
|
...language,
|
|
6240
6256
|
extensionPath,
|