@lvce-editor/extension-management-worker 4.88.0 → 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.
|
@@ -6215,6 +6215,18 @@ const getRemoteUrl = uri => {
|
|
|
6215
6215
|
return `/remote/${normalized}`;
|
|
6216
6216
|
};
|
|
6217
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
|
+
};
|
|
6218
6230
|
const getLanguagesFromExtension = (extension, platform) => {
|
|
6219
6231
|
// TODO what if extension is null? should not crash process, handle error gracefully
|
|
6220
6232
|
// TODO what if extension languages is not of type array?
|
|
@@ -6237,7 +6249,8 @@ const getLanguagesFromExtension = (extension, platform) => {
|
|
|
6237
6249
|
};
|
|
6238
6250
|
}
|
|
6239
6251
|
const relativePath = `${extensionPath}/${language.tokenize}`;
|
|
6240
|
-
const
|
|
6252
|
+
const builtinTokenizerUrl = getBuiltinTokenizerUrl(extension, language.tokenize);
|
|
6253
|
+
const absolutePath = builtinTokenizerUrl || (platform === Web ? relativePath : getRemoteUrl(relativePath));
|
|
6241
6254
|
return {
|
|
6242
6255
|
...language,
|
|
6243
6256
|
extensionPath,
|