mirror of
https://codeberg.org/nobody/LocalCDN.git
synced 2025-02-17 04:10:53 +01:00
Improved: Handling of single version number (#129)
This commit is contained in:
parent
19ace23b45
commit
1ddaf28c31
@ -56,6 +56,7 @@ const MessageResponse = {
|
||||
const Resource = {
|
||||
'MAPPING_EXPRESSION': /\.map$/i,
|
||||
'VERSION_EXPRESSION': /(?:\d{1,2}\.){1,3}\d{1,2}/,
|
||||
'SINGLE_NUMBER_EXPRESSION': /^\D+\d\D+$/,
|
||||
'VERSION_PLACEHOLDER': '{version}'
|
||||
};
|
||||
|
||||
|
@ -117,8 +117,14 @@ requestAnalyzer._findLocalTarget = function (resourceMappings, basePath, channel
|
||||
});
|
||||
|
||||
resourcePath = channelPath.replace(basePath, '');
|
||||
versionNumber = resourcePath.match(Resource.VERSION_EXPRESSION);
|
||||
resourcePattern = resourcePath.replace(versionNumber, Resource.VERSION_PLACEHOLDER);
|
||||
if (Resource.SINGLE_NUMBER_EXPRESSION.test(channelPath)) {
|
||||
versionNumber = channelPath.match(/\d/);
|
||||
resourcePattern = resourcePath.replace(versionNumber, Resource.VERSION_PLACEHOLDER);
|
||||
versionNumber = [versionNumber + '.0'];
|
||||
} else {
|
||||
versionNumber = resourcePath.match(Resource.VERSION_EXPRESSION);
|
||||
resourcePattern = resourcePath.replace(versionNumber, Resource.VERSION_PLACEHOLDER);
|
||||
}
|
||||
|
||||
shorthandResource = shorthands.specialFiles(channelHost, channelPath, destinationSearchString);
|
||||
if (shorthandResource) {
|
||||
|
@ -108,14 +108,6 @@ shorthands.specialFiles = function (channelHost, channelPath, searchString) {
|
||||
'path': 'resources/object-assign/4.1.1/object-assign.min.jsm',
|
||||
'bundle': ''
|
||||
};
|
||||
} else if ((channelHost + channelPath).includes('cdn.jsdelivr.net/npm/algoliasearch@3/dist/algoliasearch.')) {
|
||||
return {
|
||||
'source': channelHost,
|
||||
'versionRequested': '3.0',
|
||||
'versionDelivered': '3.35.1',
|
||||
'path': 'resources/algoliasearch/3.35.1/algoliasearch.min.jsm',
|
||||
'bundle': ''
|
||||
};
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -28,6 +28,7 @@
|
||||
<li>Updated: Font Awesome v5.15.0 -> v5.15.1 (<a href="https://codeberg.org/nobody/LocalCDN/issues/125">#125</a>)</li>
|
||||
<li>Fixed: Typo in Chart.js (<a href="https://codeberg.org/nobody/LocalCDN/issues/127">#127</a>)</li>
|
||||
<li>Added: clipboard.js in cdn.jsdelivr.net (<a href="https://codeberg.org/nobody/LocalCDN/issues/128">#128</a>)</li>
|
||||
<li>Improved: Handling of single version number (<a href="https://codeberg.org/nobody/LocalCDN/issues/129">#129</a>)</li>
|
||||
</ul>
|
||||
<div id="generator-section">
|
||||
<div class="topic-label">
|
||||
|
Loading…
x
Reference in New Issue
Block a user