@ressjs/assets 0.6.0-rc.0 → 0.6.0-rc.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.
- package/dist/resolve.d.ts +1 -1
- package/dist/resolve.js +7 -0
- package/package.json +6 -2
package/dist/resolve.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { PlatformInfo, PlatformRegistry } from '@ressjs/platform';
|
|
2
2
|
import type { AssetVariant } from './types';
|
|
3
3
|
/** Selecciona la variante más específica para una plataforma. */
|
|
4
|
-
export declare function resolveAssetVariant(platform: PlatformInfo, available:
|
|
4
|
+
export declare function resolveAssetVariant<T extends AssetVariant>(platform: PlatformInfo, available: T[], registry: PlatformRegistry): T;
|
package/dist/resolve.js
CHANGED
|
@@ -13,6 +13,13 @@ function resolveAssetVariant(platform, available, registry) {
|
|
|
13
13
|
return applicable.reduce((best, candidate) => {
|
|
14
14
|
if (candidate.tags.length !== best.tags.length)
|
|
15
15
|
return candidate.tags.length > best.tags.length ? candidate : best;
|
|
16
|
+
const rank = (variant) => variant.tags.length
|
|
17
|
+
? Math.min(...variant.tags.map((tag) => registry.axisPrecedence.indexOf(tag.axis)))
|
|
18
|
+
: registry.axisPrecedence.length;
|
|
19
|
+
const candidateRank = rank(candidate);
|
|
20
|
+
const bestRank = rank(best);
|
|
21
|
+
if (candidateRank !== bestRank)
|
|
22
|
+
return candidateRank < bestRank ? candidate : best;
|
|
16
23
|
return candidate.suffix.localeCompare(best.suffix) < 0 ? candidate : best;
|
|
17
24
|
});
|
|
18
25
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ressjs/assets",
|
|
3
|
-
"version": "0.6.0-rc.
|
|
3
|
+
"version": "0.6.0-rc.1",
|
|
4
4
|
"description": "Assets de ress.js: variantes de plataforma, Style y Script",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
+
"browser": {
|
|
11
|
+
"types": "./dist/client/entry.d.mts",
|
|
12
|
+
"default": "./dist/client/entry.mjs"
|
|
13
|
+
},
|
|
10
14
|
"types": "./dist/index.d.ts",
|
|
11
15
|
"require": "./dist/index.js",
|
|
12
16
|
"import": "./dist/index.js"
|
|
@@ -36,7 +40,7 @@
|
|
|
36
40
|
"access": "public"
|
|
37
41
|
},
|
|
38
42
|
"dependencies": {
|
|
39
|
-
"@ressjs/platform": "0.6.0-rc.
|
|
43
|
+
"@ressjs/platform": "0.6.0-rc.1",
|
|
40
44
|
"fast-glob": "^3.3.3"
|
|
41
45
|
},
|
|
42
46
|
"peerDependencies": {
|