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

@pixi/assets

Package Overview
Dependencies
Maintainers
1
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.0.4 to 7.0.5

lib/utils/checkDataUrl.d.ts

26

lib/Assets.d.ts
import { Cache } from './cache/Cache';
import { Loader } from './loader/Loader';
import { Resolver } from './resolver/Resolver';
import type { FormatDetectionParser } from './detections';
import type { LoadAsset, LoaderParser } from './loader';
import { Loader } from './loader/Loader';
import type { PreferOrder, ResolveAsset, ResolverBundle, ResolverManifest, ResolveURLParser } from './resolver';
import { Resolver } from './resolver/Resolver';
import type { ResolveAsset, ResolverBundle, ResolverManifest } from './resolver';
export declare type ProgressCallback = (progress: number) => void;

@@ -36,17 +36,2 @@ /**

};
/** resolver specific options */
resolver?: {
/**
* a list of urlParsers, these can read the URL and pick put the various options.
* for example there is a texture URL parser that picks our resolution and file format.
* You can add custom ways to read URLs and extract information here.
*/
urlParsers?: ResolveURLParser[];
/**
* a list of preferOrders that let the resolver know which asset to pick.
* already built-in we have a texture preferOrders that let the resolve know which asset to prefer
* if it has multiple assets to pick from (resolution/formats etc)
*/
preferOrders?: PreferOrder[];
};
}

@@ -369,5 +354,6 @@ /**

* @param bundleIds - the bundle id or ids to load
* @param onProgress - optional function that is called when progress on asset loading is made.
* @param onProgress - Optional function that is called when progress on asset loading is made.
* The function is passed a single parameter, `progress`, which represents the percentage (0.0 - 1.0)
* of the assets loaded.
* of the assets loaded. Do not use this function to detect when assets are complete and available,
* instead use the Promise returned by this function.
* @returns all the bundles assets or a hash of assets for each bundle specified

@@ -374,0 +360,0 @@ */

@@ -26,2 +26,3 @@ 'use strict';

if (this._initialized) {
console.warn("[Assets]AssetManager already initialized, did you load before calling this Asset.init()?");
return;

@@ -28,0 +29,0 @@ }

@@ -25,2 +25,3 @@ 'use strict';

if (!result) {
console.warn(`[Assets] Asset id ${key} was not found in the Cache`);
}

@@ -55,2 +56,3 @@ return result;

if (this._cache.has(key2) && this._cache.get(key2) !== value) {
console.warn("[Cache] already has key:", key2);
}

@@ -72,2 +74,3 @@ this._cache.set(key2, cacheableAssets[key2]);

if (!this._cacheMap.has(key)) {
console.warn(`[Assets] Asset id ${key} was not found in the Cache`);
return;

@@ -74,0 +77,0 @@ }

@@ -12,2 +12,4 @@ 'use strict';

require('./detections/index.js');
var checkDataUrl = require('./utils/checkDataUrl.js');
var checkExtension = require('./utils/checkExtension.js');
var convertToList = require('./utils/convertToList.js');

@@ -24,3 +26,2 @@ var createStringVariations = require('./utils/createStringVariations.js');

var loadTexture = require('./loader/parsers/textures/loadTexture.js');
var checkExtension = require('./loader/parsers/textures/utils/checkExtension.js');
var createTexture = require('./loader/parsers/textures/utils/createTexture.js');

@@ -36,2 +37,4 @@ var resolveTextureUrl = require('./resolver/parsers/resolveTextureUrl.js');

exports.AssetsClass = Assets.AssetsClass;
exports.checkDataUrl = checkDataUrl.checkDataUrl;
exports.checkExtension = checkExtension.checkExtension;
exports.convertToList = convertToList.convertToList;

@@ -50,3 +53,2 @@ exports.createStringVariations = createStringVariations.createStringVariations;

exports.loadTextures = loadTexture.loadTextures;
exports.checkExtension = checkExtension.checkExtension;
exports.createTexture = createTexture.createTexture;

@@ -53,0 +55,0 @@ exports.resolveTextureUrl = resolveTextureUrl.resolveTextureUrl;

@@ -38,3 +38,6 @@ import type { LoaderParser } from './parsers/LoaderParser';

* @param assetsToLoadIn - urls that you want to load, or a single one!
* @param onProgress - a function that gets called when the progress changes
* @param onProgress - For multiple asset loading only, an optional function that is called
* when progress on asset loading is made. The function is passed a single parameter, `progress`,
* which represents the percentage (0.0 - 1.0) of the assets loaded. Do not use this function
* to detect when assets are complete and available, instead use the Promise returned by this function.
*/

@@ -41,0 +44,0 @@ load(assetsToLoadIn: string | string[] | LoadAsset | LoadAsset[], onProgress?: (progress: number) => void): Promise<{

@@ -34,2 +34,3 @@ 'use strict';

if (!result.parser) {
console.warn(`[Assets] ${url} could not be loaded as we don't know how to parse it, ensure the correct parser has being added`);
return null;

@@ -36,0 +37,0 @@ }

@@ -6,2 +6,4 @@ 'use strict';

var core = require('@pixi/core');
var checkDataUrl = require('../../utils/checkDataUrl.js');
var checkExtension = require('../../utils/checkExtension.js');
var LoaderParser = require('./LoaderParser.js');

@@ -22,3 +24,9 @@

];
const validFonts = ["woff", "woff2", "ttf", "otf"];
const validFontExtensions = [".ttf", ".otf", ".woff", ".woff2"];
const validFontMIMEs = [
"font/ttf",
"font/otf",
"font/woff",
"font/woff2"
];
function getFontFamilyName(url) {

@@ -37,5 +45,3 @@ const ext = core.utils.path.extname(url);

test(url) {
const tempURL = url.split("?")[0];
const extension = tempURL.split(".").pop();
return validFonts.includes(extension);
return checkDataUrl.checkDataUrl(url, validFontMIMEs) || checkExtension.checkExtension(url, validFontExtensions);
},

@@ -54,3 +60,3 @@ async load(url, options) {

const weight = weights[i];
const font = new FontFace(name, `url(${url})`, {
const font = new FontFace(name, `url(${encodeURI(url)})`, {
...data,

@@ -65,2 +71,3 @@ weight

}
console.warn("[loadWebFont] FontFace API is not supported. Skipping loading font");
return null;

@@ -67,0 +74,0 @@ },

@@ -6,8 +6,15 @@ 'use strict';

var core = require('@pixi/core');
var checkDataUrl = require('../../../utils/checkDataUrl.js');
var checkExtension = require('../../../utils/checkExtension.js');
var LoaderParser = require('../LoaderParser.js');
var WorkerManager = require('../WorkerManager.js');
var checkExtension = require('./utils/checkExtension.js');
var createTexture = require('./utils/createTexture.js');
const validImages = [".jpg", ".png", ".jpeg", ".avif", ".webp"];
const validImageExtensions = [".jpeg", ".jpg", ".png", ".webp", ".avif"];
const validImageMIMEs = [
"image/jpeg",
"image/png",
"image/webp",
"image/avif"
];
async function loadImageBitmap(url) {

@@ -31,10 +38,3 @@ const response = await core.settings.ADAPTER.fetch(url);

test(url) {
let isValidBase64Suffix = false;
for (let i = 0; i < validImages.length; i++) {
if (url.startsWith(`data:image/${validImages[i].slice(1)}`)) {
isValidBase64Suffix = true;
break;
}
}
return isValidBase64Suffix || checkExtension.checkExtension(url, validImages);
return checkDataUrl.checkDataUrl(url, validImageMIMEs) || checkExtension.checkExtension(url, validImageExtensions);
},

@@ -41,0 +41,0 @@ async load(url, asset, loader) {

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

export * from './checkExtension';
export * from './createTexture';

@@ -5,3 +5,2 @@ 'use strict';

var checkExtension = require('./checkExtension.js');
var createTexture = require('./createTexture.js');

@@ -11,4 +10,3 @@

exports.checkExtension = checkExtension.checkExtension;
exports.createTexture = createTexture.createTexture;
//# sourceMappingURL=index.js.map

@@ -52,2 +52,3 @@ 'use strict';

if (this._manifest) {
console.warn("[Resolver] Manifest already exists, this will be overwritten");
}

@@ -82,2 +83,3 @@ this._manifest = manifest;

if (this._assetMap[key]) {
console.warn(`[Resolver] already has key: ${key} overwriting`);
}

@@ -84,0 +86,0 @@ });

@@ -0,3 +1,5 @@

export * from './checkDataUrl';
export * from './checkExtension';
export * from './convertToList';
export * from './createStringVariations';
export * from './isSingleItem';

@@ -5,2 +5,4 @@ 'use strict';

var checkDataUrl = require('./checkDataUrl.js');
var checkExtension = require('./checkExtension.js');
var convertToList = require('./convertToList.js');

@@ -12,2 +14,4 @@ var createStringVariations = require('./createStringVariations.js');

exports.checkDataUrl = checkDataUrl.checkDataUrl;
exports.checkExtension = checkExtension.checkExtension;
exports.convertToList = convertToList.convertToList;

@@ -14,0 +18,0 @@ exports.createStringVariations = createStringVariations.createStringVariations;

{
"name": "@pixi/assets",
"version": "7.0.4",
"version": "7.0.5",
"description": "Asset manager for PixiJS, loading resolving and Cacheing",

@@ -38,3 +38,3 @@ "keywords": [

"type": "git",
"url": "git+https://github.com/pixijs/pixi.js.git"
"url": "git+https://github.com/pixijs/pixijs.git"
},

@@ -45,3 +45,3 @@ "scripts": {

"bugs": {
"url": "https://github.com/pixijs/pixi.js/issues"
"url": "https://github.com/pixijs/pixijs/issues"
},

@@ -54,3 +54,3 @@ "dependencies": {

],
"gitHead": "1d0f4da7abd7238a440f78b3661e40ced1a27614"
"gitHead": "8a89713515f9dbe298484120429202534ac1f9f7"
}

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

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

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