Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pixi/assets

Package Overview
Dependencies
Maintainers
2
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/assets - npm Package Compare versions

Comparing version 7.3.0 to 7.3.1

5

lib/Assets.js

@@ -89,5 +89,4 @@ "use strict";

if (typeof url != "string") {
this.add(url);
const srcs = url.src || url.srcs, aliases = url.alias || url.name;
return aliases && Array.isArray(aliases) ? aliases[0] : srcs && Array.isArray(srcs) ? srcs[0] : aliases || srcs;
const aliases = this.resolver.getAlias(url);
return aliases.some((alias) => !this.resolver.hasKey(alias)) && this.add(url), Array.isArray(aliases) ? aliases[0] : aliases;
}

@@ -94,0 +93,0 @@ return this.resolver.hasKey(url) || this.add({ alias: url, src: url }), url;

@@ -174,2 +174,7 @@ import type { ArrayOr, AssetsBundle, AssetsManifest, AssetSrc, LoadParserName, ResolvedAsset, UnresolvedAsset } from '../types';

/**
* Returns the aliases for a given asset
* @param asset - the asset to get the aliases for
*/
getAlias(asset: UnresolvedAsset): string[];
/**
* Add a manifest to the asset resolver. This is a nice way to add all the asset information in one go.

@@ -176,0 +181,0 @@ * generally a manifest would be built using a tool.

24

lib/resolver/Resolver.js

@@ -129,2 +129,14 @@ "use strict";

/**
* Returns the aliases for a given asset
* @param asset - the asset to get the aliases for
*/
getAlias(asset) {
const { alias, name, src, srcs } = asset;
return convertToList.convertToList(
alias || name || src || srcs,
(value) => typeof value == "string" ? value : Array.isArray(value) ? value.map((v) => v?.src ?? v?.srcs ?? v) : value?.src || value?.srcs ? value.src ?? value.srcs : value,
!0
);
}
/**
* Add a manifest to the asset resolver. This is a nice way to add all the asset information in one go.

@@ -233,6 +245,6 @@ * generally a manifest would be built using a tool.

}, convertToList.convertToList(assets).forEach((asset) => {
const { alias, name, src, srcs: srcs2 } = asset;
const { src, srcs: srcs2 } = asset;
let { data: data2, format: format2, loadParser: loadParser2 } = asset;
const srcsToUse = convertToList.convertToList(src || srcs2).map((src2) => typeof src2 == "string" ? createStringVariations.createStringVariations(src2) : Array.isArray(src2) ? src2 : [src2]), aliasesToUse = convertToList.convertToList(alias || name);
Array.isArray(alias) ? alias.forEach(keyCheck) : keyCheck(alias);
const srcsToUse = convertToList.convertToList(src || srcs2).map((src2) => typeof src2 == "string" ? createStringVariations.createStringVariations(src2) : Array.isArray(src2) ? src2 : [src2]), aliasesToUse = this.getAlias(asset);
Array.isArray(aliasesToUse) ? aliasesToUse.forEach(keyCheck) : keyCheck(aliasesToUse);
const resolvedAssets = [];

@@ -256,2 +268,4 @@ srcsToUse.forEach((srcs3) => {

};
if (!aliasesToUse)
throw new Error(`[Resolver] alias is undefined for this asset: ${formattedAsset.src}`);
formattedAsset = this.buildResolvedAsset(formattedAsset, {

@@ -264,4 +278,4 @@ aliases: aliasesToUse,

});
}), aliasesToUse.forEach((alias2) => {
this._assetMap[alias2] = resolvedAssets;
}), aliasesToUse.forEach((alias) => {
this._assetMap[alias] = resolvedAssets;
});

@@ -268,0 +282,0 @@ });

@@ -1,1 +0,1 @@

export declare const convertToList: <T>(input: string | T | (string | T)[], transform?: (input: string) => T) => T[];
export declare const convertToList: <T>(input: string | T | (string | T)[], transform?: (input: string) => T, forceTransform?: boolean) => T[];
"use strict";
const convertToList = (input, transform) => (Array.isArray(input) || (input = [input]), transform ? input.map((item) => typeof item == "string" ? transform(item) : item) : input);
const convertToList = (input, transform, forceTransform = !1) => (Array.isArray(input) || (input = [input]), transform ? input.map((item) => typeof item == "string" || forceTransform ? transform(item) : item) : input);
exports.convertToList = convertToList;
//# sourceMappingURL=convertToList.js.map
{
"name": "@pixi/assets",
"version": "7.3.0",
"version": "7.3.1",
"description": "Asset manager for PixiJS, loading resolving and Cacheing",

@@ -50,5 +50,5 @@ "keywords": [

"peerDependencies": {
"@pixi/core": "7.3.0",
"@pixi/utils": "7.3.0"
"@pixi/core": "7.3.1",
"@pixi/utils": "7.3.1"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc