sdfsdfs
This commit is contained in:
80
node_modules/pixi.js/lib/assets/AssetExtension.d.ts
generated
vendored
Normal file
80
node_modules/pixi.js/lib/assets/AssetExtension.d.ts
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
import type { ExtensionType } from '../extensions/Extensions';
|
||||
import type { CacheParser } from './cache/CacheParser';
|
||||
import type { FormatDetectionParser } from './detections/types';
|
||||
import type { LoaderParserAdvanced } from './loader/parsers/LoaderParser';
|
||||
import type { ResolveURLParser } from './resolver/types';
|
||||
/**
|
||||
* A more verbose version of the AssetExtension,
|
||||
* allowing you to set the cached, loaded, parsed, and unloaded asset separately
|
||||
* @memberof assets
|
||||
*/
|
||||
interface AssetExtensionAdvanced<ASSET = any, PARSED_ASSET = ASSET, UNLOAD_ASSET = ASSET, CACHE_ASSET = ASSET, META_DATA = any> {
|
||||
/** The type of extension */
|
||||
extension: ExtensionType.Asset;
|
||||
/** the asset loader */
|
||||
loader?: LoaderParserAdvanced<ASSET, PARSED_ASSET, UNLOAD_ASSET, META_DATA>;
|
||||
/** the asset resolve parser */
|
||||
resolver?: Partial<ResolveURLParser>;
|
||||
/** the asset cache parser */
|
||||
cache?: Partial<CacheParser<CACHE_ASSET>>;
|
||||
/** the asset format detection parser */
|
||||
detection?: Partial<FormatDetectionParser>;
|
||||
}
|
||||
/**
|
||||
* This developer convenience object allows developers to group
|
||||
* together the various asset parsers into a single object.
|
||||
* @example
|
||||
* import { AssetExtension, extensions } from 'pixi.js';
|
||||
*
|
||||
* // create the CacheParser
|
||||
* const cache = {
|
||||
* test(asset: item): boolean {
|
||||
* // Gets called by the cache when a dev caches an asset
|
||||
* },
|
||||
* getCacheableAssets(keys: string[], asset: item): Record<string, any> {
|
||||
* // If the test passes, this function is called to get the cacheable assets
|
||||
* // an example may be that a spritesheet object will return all the sub textures it has so they can
|
||||
* // be cached.
|
||||
* },
|
||||
* };
|
||||
*
|
||||
* // create the ResolveURLParser
|
||||
* const resolver = {
|
||||
* test(value: string): boolean {
|
||||
* // the test to perform on the url to determine if it should be parsed
|
||||
* },
|
||||
* parse(value: string): ResolvedAsset {
|
||||
* // the function that will convert the url into an object
|
||||
* },
|
||||
* };
|
||||
*
|
||||
* // create the LoaderParser
|
||||
* const loader = {
|
||||
* name: 'itemLoader',
|
||||
* extension: {
|
||||
* type: ExtensionType.LoadParser,
|
||||
* },
|
||||
* async testParse(asset: any, options: ResolvedAsset) {
|
||||
* // This function is used to test if the parse function should be run on the asset
|
||||
* },
|
||||
* async parse(asset: any, options: ResolvedAsset, loader: Loader) {
|
||||
* // Gets called on the asset it testParse passes. Useful to convert a raw asset into something more useful
|
||||
* },
|
||||
* unload(item: any) {
|
||||
* // If an asset is parsed using this parser, the unload function will be called when the user requests an asset
|
||||
* // to be unloaded. This is useful for things like sounds or textures that can be unloaded from memory
|
||||
* },
|
||||
* };
|
||||
*
|
||||
* // put it all together and create the AssetExtension
|
||||
* extensions.add({
|
||||
* extension: ExtensionType.Asset,
|
||||
* cache,
|
||||
* resolver,
|
||||
* loader,
|
||||
* }
|
||||
* @memberof assets
|
||||
*/
|
||||
interface AssetExtension<ASSET = any, META_DATA = any> extends AssetExtensionAdvanced<ASSET, META_DATA> {
|
||||
}
|
||||
export type { AssetExtension, AssetExtensionAdvanced };
|
4
node_modules/pixi.js/lib/assets/AssetExtension.js
generated
vendored
Normal file
4
node_modules/pixi.js/lib/assets/AssetExtension.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
//# sourceMappingURL=AssetExtension.js.map
|
1
node_modules/pixi.js/lib/assets/AssetExtension.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/AssetExtension.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"AssetExtension.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
2
node_modules/pixi.js/lib/assets/AssetExtension.mjs
generated
vendored
Normal file
2
node_modules/pixi.js/lib/assets/AssetExtension.mjs
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
//# sourceMappingURL=AssetExtension.mjs.map
|
1
node_modules/pixi.js/lib/assets/AssetExtension.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/AssetExtension.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"AssetExtension.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
541
node_modules/pixi.js/lib/assets/Assets.d.ts
generated
vendored
Normal file
541
node_modules/pixi.js/lib/assets/Assets.d.ts
generated
vendored
Normal file
@@ -0,0 +1,541 @@
|
||||
import { Cache } from './cache/Cache';
|
||||
import { Loader } from './loader/Loader';
|
||||
import { type LoadTextureConfig } from './loader/parsers/textures/loadTextures';
|
||||
import { Resolver } from './resolver/Resolver';
|
||||
import type { FormatDetectionParser } from './detections/types';
|
||||
import type { LoadSVGConfig } from './loader/parsers/textures/loadSVG';
|
||||
import type { BundleIdentifierOptions } from './resolver/Resolver';
|
||||
import type { ArrayOr, AssetsBundle, AssetsManifest, ResolvedAsset, UnresolvedAsset } from './types';
|
||||
/**
|
||||
* Callback for 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.
|
||||
* @memberof assets
|
||||
* @callback ProgressCallback
|
||||
* @param {number} progress - The percentage (0.0 - 1.0) of the assets loaded.
|
||||
* @returns {void}
|
||||
* @example
|
||||
* (progress) => console.log(progress * 100 + '%')
|
||||
*/
|
||||
export type ProgressCallback = (progress: number) => void;
|
||||
/**
|
||||
* Extensible preferences that can be used, for instance, when configuring loaders.
|
||||
* @since 7.2.0
|
||||
* @memberof assets
|
||||
*/
|
||||
export interface AssetsPreferences extends LoadTextureConfig, LoadSVGConfig, PixiMixins.AssetsPreferences {
|
||||
}
|
||||
/**
|
||||
* Initialization options object for the Assets Class.
|
||||
* @memberof assets
|
||||
*/
|
||||
export interface AssetInitOptions {
|
||||
/** a base path for any assets loaded */
|
||||
basePath?: string;
|
||||
/** a default URL parameter string to append to all assets loaded */
|
||||
defaultSearchParams?: string | Record<string, any>;
|
||||
/**
|
||||
* a manifest to tell the asset loader upfront what all your assets are
|
||||
* this can be the manifest object itself, or a URL to the manifest.
|
||||
*/
|
||||
manifest?: string | AssetsManifest;
|
||||
/**
|
||||
* optional preferences for which textures preferences you have when resolving assets
|
||||
* for example you might set the resolution to 0.5 if the user is on a rubbish old phone
|
||||
* or you might set the resolution to 2 if the user is on a retina display
|
||||
*/
|
||||
texturePreference?: {
|
||||
/** the resolution order you prefer, can be an array (priority order - first is preferred) or a single resolutions */
|
||||
resolution?: number | number[];
|
||||
/**
|
||||
* the formats you prefer, by default this will be:
|
||||
* ['avif', 'webp', 'png', 'jpg', 'jpeg', 'webm', 'mp4', 'm4v', 'ogv']
|
||||
*/
|
||||
format?: ArrayOr<string>;
|
||||
};
|
||||
/**
|
||||
* If true, don't attempt to detect whether browser has preferred formats available.
|
||||
* May result in increased performance as it skips detection step.
|
||||
*/
|
||||
skipDetections?: boolean;
|
||||
/** advanced - override how bundlesIds are generated */
|
||||
bundleIdentifier?: BundleIdentifierOptions;
|
||||
/** Optional loader preferences */
|
||||
preferences?: Partial<AssetsPreferences>;
|
||||
}
|
||||
/**
|
||||
* A one stop shop for all Pixi resource management!
|
||||
* Super modern and easy to use, with enough flexibility to customize and do what you need!
|
||||
* @namespace assets
|
||||
*
|
||||
* Use the singleton class [Assets]{@link assets.Assets} to easily load and manage all your assets.
|
||||
*
|
||||
* ```typescript
|
||||
* import { Assets, Texture } from 'pixi.js';
|
||||
*
|
||||
* const bunnyTexture = await Assets.load<Texture>('bunny.png');
|
||||
* const sprite = new Sprite(bunnyTexture);
|
||||
* ```
|
||||
*
|
||||
* Check out the sections below for more information on how to deal with assets.
|
||||
*
|
||||
* <details id="assets-loading">
|
||||
*
|
||||
* <summary>Asset Loading</summary>
|
||||
*
|
||||
* Do not be afraid to load things multiple times - under the hood, it will **NEVER** load anything more than once.
|
||||
*
|
||||
* *For example:*
|
||||
*
|
||||
* ```js
|
||||
* import { Assets } from 'pixi.js';
|
||||
*
|
||||
* promise1 = Assets.load('bunny.png')
|
||||
* promise2 = Assets.load('bunny.png')
|
||||
*
|
||||
* // promise1 === promise2
|
||||
* ```
|
||||
*
|
||||
* Here both promises will be the same. Once resolved... Forever resolved! It makes for really easy resource management!
|
||||
*
|
||||
* Out of the box Pixi supports the following files:
|
||||
* - Textures (**_avif_**, **_webp_**, **_png_**, **_jpg_**, **_gif_**, **_svg_**) via {@link assets.loadTextures}, {@link assets.loadSvg}
|
||||
* - Video Textures (**_mp4_**, **_m4v_**, **_webm_**, **_ogg_**, **_ogv_**, **_h264_**, **_avi_**, **_mov_**) via {@link assets.loadVideoTextures}
|
||||
* - Sprite sheets (**_json_**) via {@link assets.spritesheetAsset}
|
||||
* - Bitmap fonts (**_xml_**, **_fnt_**, **_txt_**) via {@link assets.loadBitmapFont}
|
||||
* - Web fonts (**_ttf_**, **_woff_**, **_woff2_**) via {@link assets.loadWebFont}
|
||||
* - JSON files (**_json_**) via {@link assets.loadJson}
|
||||
* - Text Files (**_txt_**) via {@link assets.loadTxt}
|
||||
* <br/>
|
||||
* More types can be added fairly easily by creating additional {@link assets.LoaderParser LoaderParsers}.
|
||||
* </details>
|
||||
*
|
||||
* <details id="textures">
|
||||
*
|
||||
* <summary>Textures</summary>
|
||||
*
|
||||
* - Textures are loaded as ImageBitmap on a worker thread where possible. Leading to much less janky load + parse times.
|
||||
* - By default, we will prefer to load AVIF and WebP image files if you specify them.
|
||||
* But if the browser doesn't support AVIF or WebP we will fall back to png and jpg.
|
||||
* - Textures can also be accessed via `Texture.from()` (see {@link core.from|Texture.from})
|
||||
* and now use this asset manager under the hood!
|
||||
* - Don't worry if you set preferences for textures that don't exist
|
||||
* (for example you prefer 2x resolutions images but only 1x is available for that texture,
|
||||
* the Assets manager will pick that up as a fallback automatically)
|
||||
*
|
||||
* #### Sprite sheets
|
||||
* - It's hard to know what resolution a sprite sheet is without loading it first, to address this
|
||||
* there is a naming convention we have added that will let Pixi understand the image format and resolution
|
||||
* of the spritesheet via its file name: `my-spritesheet{resolution}.{imageFormat}.json`
|
||||
* <br><br>For example:
|
||||
* - `my-spritesheet@2x.webp.json`* // 2x resolution, WebP sprite sheet*
|
||||
* - `my-spritesheet@0.5x.png.json`* // 0.5x resolution, png sprite sheet*
|
||||
* - This is optional! You can just load a sprite sheet as normal.
|
||||
* This is only useful if you have a bunch of different res / formatted spritesheets.
|
||||
* </details>
|
||||
*
|
||||
* <details id="fonts">
|
||||
*
|
||||
* <summary>Fonts</summary>
|
||||
*
|
||||
* Web fonts will be loaded with all weights.
|
||||
* It is possible to load only specific weights by doing the following:
|
||||
*
|
||||
* ```js
|
||||
* import { Assets } from 'pixi.js';
|
||||
*
|
||||
* // Load specific weights..
|
||||
* await Assets.load({
|
||||
* data: {
|
||||
* weights: ['normal'], // Only loads the weight
|
||||
* },
|
||||
* src: `outfit.woff2`,
|
||||
* });
|
||||
*
|
||||
* // Load everything...
|
||||
* await Assets.load(`outfit.woff2`);
|
||||
* ```
|
||||
* </details>
|
||||
*
|
||||
* <details id="background-loading">
|
||||
*
|
||||
* <summary>Background Loading</summary>
|
||||
*
|
||||
* Background loading will load stuff for you passively behind the scenes. To minimize jank,
|
||||
* it will only load one asset at a time. As soon as a developer calls `Assets.load(...)` the
|
||||
* background loader is paused and requested assets are loaded as a priority.
|
||||
* Don't worry if something is in there that's already loaded, it will just get skipped!
|
||||
*
|
||||
* You still need to call `Assets.load(...)` to get an asset that has been loaded in the background.
|
||||
* It's just that this promise will resolve instantly if the asset
|
||||
* has already been loaded.
|
||||
* </details>
|
||||
*
|
||||
* <details id="manifests-and-bundles">
|
||||
*
|
||||
* <summary>Manifest and Bundles</summary>
|
||||
*
|
||||
* - {@link assets.AssetsManifest Manifest} is a descriptor that contains a list of all assets and their properties.
|
||||
* - {@link assets.AssetsBundle Bundles} are a way to group assets together.
|
||||
*
|
||||
* ```js
|
||||
* import { Assets } from 'pixi.js';
|
||||
*
|
||||
* // Manifest Example
|
||||
* const manifest = {
|
||||
* bundles: [
|
||||
* {
|
||||
* name: 'load-screen',
|
||||
* assets: [
|
||||
* {
|
||||
* alias: 'background',
|
||||
* src: 'sunset.png',
|
||||
* },
|
||||
* {
|
||||
* alias: 'bar',
|
||||
* src: 'load-bar.{png,webp}',
|
||||
* },
|
||||
* ],
|
||||
* },
|
||||
* {
|
||||
* name: 'game-screen',
|
||||
* assets: [
|
||||
* {
|
||||
* alias: 'character',
|
||||
* src: 'robot.png',
|
||||
* },
|
||||
* {
|
||||
* alias: 'enemy',
|
||||
* src: 'bad-guy.png',
|
||||
* },
|
||||
* ],
|
||||
* },
|
||||
* ]
|
||||
* };
|
||||
*
|
||||
* await Assets.init({ manifest });
|
||||
*
|
||||
* // Load a bundle...
|
||||
* loadScreenAssets = await Assets.loadBundle('load-screen');
|
||||
* // Load another bundle...
|
||||
* gameScreenAssets = await Assets.loadBundle('game-screen');
|
||||
* ```
|
||||
* </details>
|
||||
*/
|
||||
/**
|
||||
* The global Assets class, it's a singleton so you don't need to instantiate it.
|
||||
*
|
||||
* **The `Assets` class has four main responsibilities:**
|
||||
* 1. Allows users to map URLs to keys and resolve them according to the user's browser capabilities
|
||||
* 2. Loads the resources and transforms them into assets that developers understand.
|
||||
* 3. Caches the assets and provides a way to access them.
|
||||
* 4. Allow developers to unload assets and clear the cache.
|
||||
*
|
||||
*
|
||||
* **It also has a few advanced features:**
|
||||
* 1. Allows developers to provide a {@link assets.Manifest} upfront of all assets and help manage
|
||||
* them via {@link assets.AssetsBundles Bundles}.
|
||||
* 2. Allows users to background load assets. Shortening (or eliminating) load times and improving UX. With this feature,
|
||||
* in-game loading bars can be a thing of the past!
|
||||
* @example
|
||||
* import { Assets } from 'pixi.js';
|
||||
*
|
||||
* const bunny = await Assets.load('bunny.png');
|
||||
* @memberof assets
|
||||
* @class Assets
|
||||
*/
|
||||
export declare class AssetsClass {
|
||||
/** the resolver to map various urls */
|
||||
resolver: Resolver;
|
||||
/** The loader, loads stuff! */
|
||||
loader: Loader;
|
||||
/**
|
||||
* The global cache of all assets within PixiJS
|
||||
* @type {assets.Cache}
|
||||
*/
|
||||
cache: typeof Cache;
|
||||
/** takes care of loading assets in the background */
|
||||
private readonly _backgroundLoader;
|
||||
private readonly _detections;
|
||||
private _initialized;
|
||||
constructor();
|
||||
/**
|
||||
* Best practice is to call this function before any loading commences
|
||||
* Initiating is the best time to add any customization to the way things are loaded.
|
||||
*
|
||||
* you do not need to call this for the Assets class to work, only if you want to set any initial properties
|
||||
* @param options - options to initialize the Assets manager with
|
||||
*/
|
||||
init(options?: AssetInitOptions): Promise<void>;
|
||||
/**
|
||||
* Allows you to specify how to resolve any assets load requests.
|
||||
* There are a few ways to add things here as shown below:
|
||||
* @example
|
||||
* import { Assets } from 'pixi.js';
|
||||
*
|
||||
* // Simple
|
||||
* Assets.add({alias: 'bunnyBooBoo', src: 'bunny.png'});
|
||||
* const bunny = await Assets.load('bunnyBooBoo');
|
||||
*
|
||||
* // Multiple keys:
|
||||
* Assets.add({alias: ['burger', 'chicken'], src: 'bunny.png'});
|
||||
*
|
||||
* const bunny = await Assets.load('burger');
|
||||
* const bunny2 = await Assets.load('chicken');
|
||||
*
|
||||
* // passing options to to the object
|
||||
* Assets.add({
|
||||
* alias: 'bunnyBooBooSmooth',
|
||||
* src: 'bunny{png,webp}',
|
||||
* data: { scaleMode: SCALE_MODES.NEAREST }, // Base texture options
|
||||
* });
|
||||
*
|
||||
* // Multiple assets
|
||||
*
|
||||
* // The following all do the same thing:
|
||||
*
|
||||
* Assets.add({alias: 'bunnyBooBoo', src: 'bunny{png,webp}'});
|
||||
*
|
||||
* Assets.add({
|
||||
* alias: 'bunnyBooBoo',
|
||||
* src: [
|
||||
* 'bunny.png',
|
||||
* 'bunny.webp',
|
||||
* ],
|
||||
* });
|
||||
*
|
||||
* const bunny = await Assets.load('bunnyBooBoo'); // Will try to load WebP if available
|
||||
* @param assets - the unresolved assets to add to the resolver
|
||||
*/
|
||||
add(assets: (ArrayOr<UnresolvedAsset>)): void;
|
||||
/**
|
||||
* Loads your assets! You pass in a key or URL and it will return a promise that
|
||||
* resolves to the loaded asset. If multiple assets a requested, it will return a hash of assets.
|
||||
*
|
||||
* Don't worry about loading things multiple times, behind the scenes assets are only ever loaded
|
||||
* once and the same promise reused behind the scenes so you can safely call this function multiple
|
||||
* times with the same key and it will always return the same asset.
|
||||
* @example
|
||||
* import { Assets } from 'pixi.js';
|
||||
*
|
||||
* // Load a URL:
|
||||
* const myImageTexture = await Assets.load('http://some.url.com/image.png'); // => returns a texture
|
||||
*
|
||||
* Assets.add('thumper', 'bunny.png');
|
||||
* Assets.add('chicko', 'chicken.png');
|
||||
*
|
||||
* // Load multiple assets:
|
||||
* const textures = await Assets.load(['thumper', 'chicko']); // => {thumper: Texture, chicko: Texture}
|
||||
* @param urls - the urls to load
|
||||
* @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.
|
||||
* @returns - the assets that were loaded, either a single asset or a hash of assets
|
||||
*/
|
||||
load<T = any>(urls: string | UnresolvedAsset, onProgress?: ProgressCallback): Promise<T>;
|
||||
load<T = any>(urls: string[] | UnresolvedAsset[], onProgress?: ProgressCallback): Promise<Record<string, T>>;
|
||||
/**
|
||||
* This adds a bundle of assets in one go so that you can load them as a group.
|
||||
* For example you could add a bundle for each screen in you pixi app
|
||||
* @example
|
||||
* import { Assets } from 'pixi.js';
|
||||
*
|
||||
* Assets.addBundle('animals', [
|
||||
* { alias: 'bunny', src: 'bunny.png' },
|
||||
* { alias: 'chicken', src: 'chicken.png' },
|
||||
* { alias: 'thumper', src: 'thumper.png' },
|
||||
* ]);
|
||||
* // or
|
||||
* Assets.addBundle('animals', {
|
||||
* bunny: 'bunny.png',
|
||||
* chicken: 'chicken.png',
|
||||
* thumper: 'thumper.png',
|
||||
* });
|
||||
*
|
||||
* const assets = await Assets.loadBundle('animals');
|
||||
* @param bundleId - the id of the bundle to add
|
||||
* @param assets - a record of the asset or assets that will be chosen from when loading via the specified key
|
||||
*/
|
||||
addBundle(bundleId: string, assets: AssetsBundle['assets']): void;
|
||||
/**
|
||||
* Bundles are a way to load multiple assets at once.
|
||||
* If a manifest has been provided to the init function then you can load a bundle, or bundles.
|
||||
* you can also add bundles via `addBundle`
|
||||
* @example
|
||||
* import { Assets } from 'pixi.js';
|
||||
*
|
||||
* // Manifest Example
|
||||
* const manifest = {
|
||||
* bundles: [
|
||||
* {
|
||||
* name: 'load-screen',
|
||||
* assets: [
|
||||
* {
|
||||
* alias: 'background',
|
||||
* src: 'sunset.png',
|
||||
* },
|
||||
* {
|
||||
* alias: 'bar',
|
||||
* src: 'load-bar.{png,webp}',
|
||||
* },
|
||||
* ],
|
||||
* },
|
||||
* {
|
||||
* name: 'game-screen',
|
||||
* assets: [
|
||||
* {
|
||||
* alias: 'character',
|
||||
* src: 'robot.png',
|
||||
* },
|
||||
* {
|
||||
* alias: 'enemy',
|
||||
* src: 'bad-guy.png',
|
||||
* },
|
||||
* ],
|
||||
* },
|
||||
* ]
|
||||
* };
|
||||
*
|
||||
* await Assets.init({ manifest });
|
||||
*
|
||||
* // Load a bundle...
|
||||
* loadScreenAssets = await Assets.loadBundle('load-screen');
|
||||
* // Load another bundle...
|
||||
* gameScreenAssets = await Assets.loadBundle('game-screen');
|
||||
* @param bundleIds - the bundle id or ids to load
|
||||
* @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. 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
|
||||
*/
|
||||
loadBundle(bundleIds: ArrayOr<string>, onProgress?: ProgressCallback): Promise<any>;
|
||||
/**
|
||||
* Initiate a background load of some assets. It will passively begin to load these assets in the background.
|
||||
* So when you actually come to loading them you will get a promise that resolves to the loaded assets immediately
|
||||
*
|
||||
* An example of this might be that you would background load game assets after your initial load.
|
||||
* then when you got to actually load your game screen assets when a player goes to the game - the loading
|
||||
* would already have stared or may even be complete, saving you having to show an interim load bar.
|
||||
* @example
|
||||
* import { Assets } from 'pixi.js';
|
||||
*
|
||||
* Assets.backgroundLoad('bunny.png');
|
||||
*
|
||||
* // later on in your app...
|
||||
* await Assets.loadBundle('bunny.png'); // Will resolve quicker as loading may have completed!
|
||||
* @param urls - the url / urls you want to background load
|
||||
*/
|
||||
backgroundLoad(urls: ArrayOr<string>): Promise<void>;
|
||||
/**
|
||||
* Initiate a background of a bundle, works exactly like backgroundLoad but for bundles.
|
||||
* this can only be used if the loader has been initiated with a manifest
|
||||
* @example
|
||||
* import { Assets } from 'pixi.js';
|
||||
*
|
||||
* await Assets.init({
|
||||
* manifest: {
|
||||
* bundles: [
|
||||
* {
|
||||
* name: 'load-screen',
|
||||
* assets: [...],
|
||||
* },
|
||||
* ...
|
||||
* ],
|
||||
* },
|
||||
* });
|
||||
*
|
||||
* Assets.backgroundLoadBundle('load-screen');
|
||||
*
|
||||
* // Later on in your app...
|
||||
* await Assets.loadBundle('load-screen'); // Will resolve quicker as loading may have completed!
|
||||
* @param bundleIds - the bundleId / bundleIds you want to background load
|
||||
*/
|
||||
backgroundLoadBundle(bundleIds: ArrayOr<string>): Promise<void>;
|
||||
/**
|
||||
* Only intended for development purposes.
|
||||
* This will wipe the resolver and caches.
|
||||
* You will need to reinitialize the Asset
|
||||
*/
|
||||
reset(): void;
|
||||
/**
|
||||
* Instantly gets an asset already loaded from the cache. If the asset has not yet been loaded,
|
||||
* it will return undefined. So it's on you! When in doubt just use `Assets.load` instead.
|
||||
* (Remember, the loader will never load things more than once!)
|
||||
* @param keys - The key or keys for the assets that you want to access
|
||||
* @returns - The assets or hash of assets requested
|
||||
*/
|
||||
get<T = any>(keys: string): T;
|
||||
get<T = any>(keys: string[]): Record<string, T>;
|
||||
/**
|
||||
* helper function to map resolved assets back to loaded assets
|
||||
* @param resolveResults - the resolve results from the resolver
|
||||
* @param onProgress - the progress callback
|
||||
*/
|
||||
private _mapLoadToResolve;
|
||||
/**
|
||||
* Unload an asset or assets. As the Assets class is responsible for creating the assets via the `load` function
|
||||
* this will make sure to destroy any assets and release them from memory.
|
||||
* Once unloaded, you will need to load the asset again.
|
||||
*
|
||||
* Use this to help manage assets if you find that you have a large app and you want to free up memory.
|
||||
*
|
||||
* - it's up to you as the developer to make sure that textures are not actively being used when you unload them,
|
||||
* Pixi won't break but you will end up with missing assets. Not a good look for the user!
|
||||
* @example
|
||||
* import { Assets } from 'pixi.js';
|
||||
*
|
||||
* // Load a URL:
|
||||
* const myImageTexture = await Assets.load('http://some.url.com/image.png'); // => returns a texture
|
||||
*
|
||||
* await Assets.unload('http://some.url.com/image.png')
|
||||
*
|
||||
* // myImageTexture will be destroyed now.
|
||||
*
|
||||
* // Unload multiple assets:
|
||||
* const textures = await Assets.unload(['thumper', 'chicko']);
|
||||
* @param urls - the urls to unload
|
||||
*/
|
||||
unload(urls: ArrayOr<string> | ResolvedAsset | ResolvedAsset[]): Promise<void>;
|
||||
/**
|
||||
* Bundles are a way to manage multiple assets at once.
|
||||
* this will unload all files in a bundle.
|
||||
*
|
||||
* once a bundle has been unloaded, you need to load it again to have access to the assets.
|
||||
* @example
|
||||
* import { Assets } from 'pixi.js';
|
||||
*
|
||||
* Assets.addBundle({
|
||||
* 'thumper': 'http://some.url.com/thumper.png',
|
||||
* })
|
||||
*
|
||||
* const assets = await Assets.loadBundle('thumper');
|
||||
*
|
||||
* // Now to unload...
|
||||
*
|
||||
* await Assets.unloadBundle('thumper');
|
||||
*
|
||||
* // All assets in the assets object will now have been destroyed and purged from the cache
|
||||
* @param bundleIds - the bundle id or ids to unload
|
||||
*/
|
||||
unloadBundle(bundleIds: ArrayOr<string>): Promise<void>;
|
||||
private _unloadFromResolved;
|
||||
/**
|
||||
* Detects the supported formats for the browser, and returns an array of supported formats, respecting
|
||||
* the users preferred formats order.
|
||||
* @param options - the options to use when detecting formats
|
||||
* @param options.preferredFormats - the preferred formats to use
|
||||
* @param options.skipDetections - if we should skip the detections altogether
|
||||
* @param options.detections - the detections to use
|
||||
* @returns - the detected formats
|
||||
*/
|
||||
private _detectFormats;
|
||||
/** All the detection parsers currently added to the Assets class. */
|
||||
get detections(): FormatDetectionParser[];
|
||||
/**
|
||||
* General setter for preferences. This is a helper function to set preferences on all parsers.
|
||||
* @param preferences - the preferences to set
|
||||
*/
|
||||
setPreferences(preferences: Partial<AssetsPreferences>): void;
|
||||
}
|
||||
export declare const Assets: AssetsClass;
|
513
node_modules/pixi.js/lib/assets/Assets.js
generated
vendored
Normal file
513
node_modules/pixi.js/lib/assets/Assets.js
generated
vendored
Normal file
@@ -0,0 +1,513 @@
|
||||
'use strict';
|
||||
|
||||
var Extensions = require('../extensions/Extensions.js');
|
||||
var loadBitmapFont = require('../scene/text-bitmap/asset/loadBitmapFont.js');
|
||||
var warn = require('../utils/logging/warn.js');
|
||||
var BackgroundLoader = require('./BackgroundLoader.js');
|
||||
var Cache = require('./cache/Cache.js');
|
||||
var cacheTextureArray = require('./cache/parsers/cacheTextureArray.js');
|
||||
var detectAvif = require('./detections/parsers/detectAvif.js');
|
||||
var detectDefaults = require('./detections/parsers/detectDefaults.js');
|
||||
var detectMp4 = require('./detections/parsers/detectMp4.js');
|
||||
var detectOgv = require('./detections/parsers/detectOgv.js');
|
||||
var detectWebm = require('./detections/parsers/detectWebm.js');
|
||||
var detectWebp = require('./detections/parsers/detectWebp.js');
|
||||
var Loader = require('./loader/Loader.js');
|
||||
var loadJson = require('./loader/parsers/loadJson.js');
|
||||
var loadTxt = require('./loader/parsers/loadTxt.js');
|
||||
var loadWebFont = require('./loader/parsers/loadWebFont.js');
|
||||
var loadSVG = require('./loader/parsers/textures/loadSVG.js');
|
||||
var loadTextures = require('./loader/parsers/textures/loadTextures.js');
|
||||
var loadVideoTextures = require('./loader/parsers/textures/loadVideoTextures.js');
|
||||
var resolveJsonUrl = require('./resolver/parsers/resolveJsonUrl.js');
|
||||
var resolveTextureUrl = require('./resolver/parsers/resolveTextureUrl.js');
|
||||
var Resolver = require('./resolver/Resolver.js');
|
||||
var convertToList = require('./utils/convertToList.js');
|
||||
var isSingleItem = require('./utils/isSingleItem.js');
|
||||
|
||||
"use strict";
|
||||
class AssetsClass {
|
||||
constructor() {
|
||||
this._detections = [];
|
||||
this._initialized = false;
|
||||
this.resolver = new Resolver.Resolver();
|
||||
this.loader = new Loader.Loader();
|
||||
this.cache = Cache.Cache;
|
||||
this._backgroundLoader = new BackgroundLoader.BackgroundLoader(this.loader);
|
||||
this._backgroundLoader.active = true;
|
||||
this.reset();
|
||||
}
|
||||
/**
|
||||
* Best practice is to call this function before any loading commences
|
||||
* Initiating is the best time to add any customization to the way things are loaded.
|
||||
*
|
||||
* you do not need to call this for the Assets class to work, only if you want to set any initial properties
|
||||
* @param options - options to initialize the Assets manager with
|
||||
*/
|
||||
async init(options = {}) {
|
||||
if (this._initialized) {
|
||||
warn.warn("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");
|
||||
return;
|
||||
}
|
||||
this._initialized = true;
|
||||
if (options.defaultSearchParams) {
|
||||
this.resolver.setDefaultSearchParams(options.defaultSearchParams);
|
||||
}
|
||||
if (options.basePath) {
|
||||
this.resolver.basePath = options.basePath;
|
||||
}
|
||||
if (options.bundleIdentifier) {
|
||||
this.resolver.setBundleIdentifier(options.bundleIdentifier);
|
||||
}
|
||||
if (options.manifest) {
|
||||
let manifest = options.manifest;
|
||||
if (typeof manifest === "string") {
|
||||
manifest = await this.load(manifest);
|
||||
}
|
||||
this.resolver.addManifest(manifest);
|
||||
}
|
||||
const resolutionPref = options.texturePreference?.resolution ?? 1;
|
||||
const resolution = typeof resolutionPref === "number" ? [resolutionPref] : resolutionPref;
|
||||
const formats = await this._detectFormats({
|
||||
preferredFormats: options.texturePreference?.format,
|
||||
skipDetections: options.skipDetections,
|
||||
detections: this._detections
|
||||
});
|
||||
this.resolver.prefer({
|
||||
params: {
|
||||
format: formats,
|
||||
resolution
|
||||
}
|
||||
});
|
||||
if (options.preferences) {
|
||||
this.setPreferences(options.preferences);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Allows you to specify how to resolve any assets load requests.
|
||||
* There are a few ways to add things here as shown below:
|
||||
* @example
|
||||
* import { Assets } from 'pixi.js';
|
||||
*
|
||||
* // Simple
|
||||
* Assets.add({alias: 'bunnyBooBoo', src: 'bunny.png'});
|
||||
* const bunny = await Assets.load('bunnyBooBoo');
|
||||
*
|
||||
* // Multiple keys:
|
||||
* Assets.add({alias: ['burger', 'chicken'], src: 'bunny.png'});
|
||||
*
|
||||
* const bunny = await Assets.load('burger');
|
||||
* const bunny2 = await Assets.load('chicken');
|
||||
*
|
||||
* // passing options to to the object
|
||||
* Assets.add({
|
||||
* alias: 'bunnyBooBooSmooth',
|
||||
* src: 'bunny{png,webp}',
|
||||
* data: { scaleMode: SCALE_MODES.NEAREST }, // Base texture options
|
||||
* });
|
||||
*
|
||||
* // Multiple assets
|
||||
*
|
||||
* // The following all do the same thing:
|
||||
*
|
||||
* Assets.add({alias: 'bunnyBooBoo', src: 'bunny{png,webp}'});
|
||||
*
|
||||
* Assets.add({
|
||||
* alias: 'bunnyBooBoo',
|
||||
* src: [
|
||||
* 'bunny.png',
|
||||
* 'bunny.webp',
|
||||
* ],
|
||||
* });
|
||||
*
|
||||
* const bunny = await Assets.load('bunnyBooBoo'); // Will try to load WebP if available
|
||||
* @param assets - the unresolved assets to add to the resolver
|
||||
*/
|
||||
add(assets) {
|
||||
this.resolver.add(assets);
|
||||
}
|
||||
async load(urls, onProgress) {
|
||||
if (!this._initialized) {
|
||||
await this.init();
|
||||
}
|
||||
const singleAsset = isSingleItem.isSingleItem(urls);
|
||||
const urlArray = convertToList.convertToList(urls).map((url) => {
|
||||
if (typeof url !== "string") {
|
||||
const aliases = this.resolver.getAlias(url);
|
||||
if (aliases.some((alias) => !this.resolver.hasKey(alias))) {
|
||||
this.add(url);
|
||||
}
|
||||
return Array.isArray(aliases) ? aliases[0] : aliases;
|
||||
}
|
||||
if (!this.resolver.hasKey(url))
|
||||
this.add({ alias: url, src: url });
|
||||
return url;
|
||||
});
|
||||
const resolveResults = this.resolver.resolve(urlArray);
|
||||
const out = await this._mapLoadToResolve(resolveResults, onProgress);
|
||||
return singleAsset ? out[urlArray[0]] : out;
|
||||
}
|
||||
/**
|
||||
* This adds a bundle of assets in one go so that you can load them as a group.
|
||||
* For example you could add a bundle for each screen in you pixi app
|
||||
* @example
|
||||
* import { Assets } from 'pixi.js';
|
||||
*
|
||||
* Assets.addBundle('animals', [
|
||||
* { alias: 'bunny', src: 'bunny.png' },
|
||||
* { alias: 'chicken', src: 'chicken.png' },
|
||||
* { alias: 'thumper', src: 'thumper.png' },
|
||||
* ]);
|
||||
* // or
|
||||
* Assets.addBundle('animals', {
|
||||
* bunny: 'bunny.png',
|
||||
* chicken: 'chicken.png',
|
||||
* thumper: 'thumper.png',
|
||||
* });
|
||||
*
|
||||
* const assets = await Assets.loadBundle('animals');
|
||||
* @param bundleId - the id of the bundle to add
|
||||
* @param assets - a record of the asset or assets that will be chosen from when loading via the specified key
|
||||
*/
|
||||
addBundle(bundleId, assets) {
|
||||
this.resolver.addBundle(bundleId, assets);
|
||||
}
|
||||
/**
|
||||
* Bundles are a way to load multiple assets at once.
|
||||
* If a manifest has been provided to the init function then you can load a bundle, or bundles.
|
||||
* you can also add bundles via `addBundle`
|
||||
* @example
|
||||
* import { Assets } from 'pixi.js';
|
||||
*
|
||||
* // Manifest Example
|
||||
* const manifest = {
|
||||
* bundles: [
|
||||
* {
|
||||
* name: 'load-screen',
|
||||
* assets: [
|
||||
* {
|
||||
* alias: 'background',
|
||||
* src: 'sunset.png',
|
||||
* },
|
||||
* {
|
||||
* alias: 'bar',
|
||||
* src: 'load-bar.{png,webp}',
|
||||
* },
|
||||
* ],
|
||||
* },
|
||||
* {
|
||||
* name: 'game-screen',
|
||||
* assets: [
|
||||
* {
|
||||
* alias: 'character',
|
||||
* src: 'robot.png',
|
||||
* },
|
||||
* {
|
||||
* alias: 'enemy',
|
||||
* src: 'bad-guy.png',
|
||||
* },
|
||||
* ],
|
||||
* },
|
||||
* ]
|
||||
* };
|
||||
*
|
||||
* await Assets.init({ manifest });
|
||||
*
|
||||
* // Load a bundle...
|
||||
* loadScreenAssets = await Assets.loadBundle('load-screen');
|
||||
* // Load another bundle...
|
||||
* gameScreenAssets = await Assets.loadBundle('game-screen');
|
||||
* @param bundleIds - the bundle id or ids to load
|
||||
* @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. 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
|
||||
*/
|
||||
async loadBundle(bundleIds, onProgress) {
|
||||
if (!this._initialized) {
|
||||
await this.init();
|
||||
}
|
||||
let singleAsset = false;
|
||||
if (typeof bundleIds === "string") {
|
||||
singleAsset = true;
|
||||
bundleIds = [bundleIds];
|
||||
}
|
||||
const resolveResults = this.resolver.resolveBundle(bundleIds);
|
||||
const out = {};
|
||||
const keys = Object.keys(resolveResults);
|
||||
let count = 0;
|
||||
let total = 0;
|
||||
const _onProgress = () => {
|
||||
onProgress?.(++count / total);
|
||||
};
|
||||
const promises = keys.map((bundleId) => {
|
||||
const resolveResult = resolveResults[bundleId];
|
||||
total += Object.keys(resolveResult).length;
|
||||
return this._mapLoadToResolve(resolveResult, _onProgress).then((resolveResult2) => {
|
||||
out[bundleId] = resolveResult2;
|
||||
});
|
||||
});
|
||||
await Promise.all(promises);
|
||||
return singleAsset ? out[bundleIds[0]] : out;
|
||||
}
|
||||
/**
|
||||
* Initiate a background load of some assets. It will passively begin to load these assets in the background.
|
||||
* So when you actually come to loading them you will get a promise that resolves to the loaded assets immediately
|
||||
*
|
||||
* An example of this might be that you would background load game assets after your initial load.
|
||||
* then when you got to actually load your game screen assets when a player goes to the game - the loading
|
||||
* would already have stared or may even be complete, saving you having to show an interim load bar.
|
||||
* @example
|
||||
* import { Assets } from 'pixi.js';
|
||||
*
|
||||
* Assets.backgroundLoad('bunny.png');
|
||||
*
|
||||
* // later on in your app...
|
||||
* await Assets.loadBundle('bunny.png'); // Will resolve quicker as loading may have completed!
|
||||
* @param urls - the url / urls you want to background load
|
||||
*/
|
||||
async backgroundLoad(urls) {
|
||||
if (!this._initialized) {
|
||||
await this.init();
|
||||
}
|
||||
if (typeof urls === "string") {
|
||||
urls = [urls];
|
||||
}
|
||||
const resolveResults = this.resolver.resolve(urls);
|
||||
this._backgroundLoader.add(Object.values(resolveResults));
|
||||
}
|
||||
/**
|
||||
* Initiate a background of a bundle, works exactly like backgroundLoad but for bundles.
|
||||
* this can only be used if the loader has been initiated with a manifest
|
||||
* @example
|
||||
* import { Assets } from 'pixi.js';
|
||||
*
|
||||
* await Assets.init({
|
||||
* manifest: {
|
||||
* bundles: [
|
||||
* {
|
||||
* name: 'load-screen',
|
||||
* assets: [...],
|
||||
* },
|
||||
* ...
|
||||
* ],
|
||||
* },
|
||||
* });
|
||||
*
|
||||
* Assets.backgroundLoadBundle('load-screen');
|
||||
*
|
||||
* // Later on in your app...
|
||||
* await Assets.loadBundle('load-screen'); // Will resolve quicker as loading may have completed!
|
||||
* @param bundleIds - the bundleId / bundleIds you want to background load
|
||||
*/
|
||||
async backgroundLoadBundle(bundleIds) {
|
||||
if (!this._initialized) {
|
||||
await this.init();
|
||||
}
|
||||
if (typeof bundleIds === "string") {
|
||||
bundleIds = [bundleIds];
|
||||
}
|
||||
const resolveResults = this.resolver.resolveBundle(bundleIds);
|
||||
Object.values(resolveResults).forEach((resolveResult) => {
|
||||
this._backgroundLoader.add(Object.values(resolveResult));
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Only intended for development purposes.
|
||||
* This will wipe the resolver and caches.
|
||||
* You will need to reinitialize the Asset
|
||||
*/
|
||||
reset() {
|
||||
this.resolver.reset();
|
||||
this.loader.reset();
|
||||
this.cache.reset();
|
||||
this._initialized = false;
|
||||
}
|
||||
get(keys) {
|
||||
if (typeof keys === "string") {
|
||||
return Cache.Cache.get(keys);
|
||||
}
|
||||
const assets = {};
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
assets[i] = Cache.Cache.get(keys[i]);
|
||||
}
|
||||
return assets;
|
||||
}
|
||||
/**
|
||||
* helper function to map resolved assets back to loaded assets
|
||||
* @param resolveResults - the resolve results from the resolver
|
||||
* @param onProgress - the progress callback
|
||||
*/
|
||||
async _mapLoadToResolve(resolveResults, onProgress) {
|
||||
const resolveArray = [...new Set(Object.values(resolveResults))];
|
||||
this._backgroundLoader.active = false;
|
||||
const loadedAssets = await this.loader.load(resolveArray, onProgress);
|
||||
this._backgroundLoader.active = true;
|
||||
const out = {};
|
||||
resolveArray.forEach((resolveResult) => {
|
||||
const asset = loadedAssets[resolveResult.src];
|
||||
const keys = [resolveResult.src];
|
||||
if (resolveResult.alias) {
|
||||
keys.push(...resolveResult.alias);
|
||||
}
|
||||
keys.forEach((key) => {
|
||||
out[key] = asset;
|
||||
});
|
||||
Cache.Cache.set(keys, asset);
|
||||
});
|
||||
return out;
|
||||
}
|
||||
/**
|
||||
* Unload an asset or assets. As the Assets class is responsible for creating the assets via the `load` function
|
||||
* this will make sure to destroy any assets and release them from memory.
|
||||
* Once unloaded, you will need to load the asset again.
|
||||
*
|
||||
* Use this to help manage assets if you find that you have a large app and you want to free up memory.
|
||||
*
|
||||
* - it's up to you as the developer to make sure that textures are not actively being used when you unload them,
|
||||
* Pixi won't break but you will end up with missing assets. Not a good look for the user!
|
||||
* @example
|
||||
* import { Assets } from 'pixi.js';
|
||||
*
|
||||
* // Load a URL:
|
||||
* const myImageTexture = await Assets.load('http://some.url.com/image.png'); // => returns a texture
|
||||
*
|
||||
* await Assets.unload('http://some.url.com/image.png')
|
||||
*
|
||||
* // myImageTexture will be destroyed now.
|
||||
*
|
||||
* // Unload multiple assets:
|
||||
* const textures = await Assets.unload(['thumper', 'chicko']);
|
||||
* @param urls - the urls to unload
|
||||
*/
|
||||
async unload(urls) {
|
||||
if (!this._initialized) {
|
||||
await this.init();
|
||||
}
|
||||
const urlArray = convertToList.convertToList(urls).map((url) => typeof url !== "string" ? url.src : url);
|
||||
const resolveResults = this.resolver.resolve(urlArray);
|
||||
await this._unloadFromResolved(resolveResults);
|
||||
}
|
||||
/**
|
||||
* Bundles are a way to manage multiple assets at once.
|
||||
* this will unload all files in a bundle.
|
||||
*
|
||||
* once a bundle has been unloaded, you need to load it again to have access to the assets.
|
||||
* @example
|
||||
* import { Assets } from 'pixi.js';
|
||||
*
|
||||
* Assets.addBundle({
|
||||
* 'thumper': 'http://some.url.com/thumper.png',
|
||||
* })
|
||||
*
|
||||
* const assets = await Assets.loadBundle('thumper');
|
||||
*
|
||||
* // Now to unload...
|
||||
*
|
||||
* await Assets.unloadBundle('thumper');
|
||||
*
|
||||
* // All assets in the assets object will now have been destroyed and purged from the cache
|
||||
* @param bundleIds - the bundle id or ids to unload
|
||||
*/
|
||||
async unloadBundle(bundleIds) {
|
||||
if (!this._initialized) {
|
||||
await this.init();
|
||||
}
|
||||
bundleIds = convertToList.convertToList(bundleIds);
|
||||
const resolveResults = this.resolver.resolveBundle(bundleIds);
|
||||
const promises = Object.keys(resolveResults).map((bundleId) => this._unloadFromResolved(resolveResults[bundleId]));
|
||||
await Promise.all(promises);
|
||||
}
|
||||
async _unloadFromResolved(resolveResult) {
|
||||
const resolveArray = Object.values(resolveResult);
|
||||
resolveArray.forEach((resolveResult2) => {
|
||||
Cache.Cache.remove(resolveResult2.src);
|
||||
});
|
||||
await this.loader.unload(resolveArray);
|
||||
}
|
||||
/**
|
||||
* Detects the supported formats for the browser, and returns an array of supported formats, respecting
|
||||
* the users preferred formats order.
|
||||
* @param options - the options to use when detecting formats
|
||||
* @param options.preferredFormats - the preferred formats to use
|
||||
* @param options.skipDetections - if we should skip the detections altogether
|
||||
* @param options.detections - the detections to use
|
||||
* @returns - the detected formats
|
||||
*/
|
||||
async _detectFormats(options) {
|
||||
let formats = [];
|
||||
if (options.preferredFormats) {
|
||||
formats = Array.isArray(options.preferredFormats) ? options.preferredFormats : [options.preferredFormats];
|
||||
}
|
||||
for (const detection of options.detections) {
|
||||
if (options.skipDetections || await detection.test()) {
|
||||
formats = await detection.add(formats);
|
||||
} else if (!options.skipDetections) {
|
||||
formats = await detection.remove(formats);
|
||||
}
|
||||
}
|
||||
formats = formats.filter((format, index) => formats.indexOf(format) === index);
|
||||
return formats;
|
||||
}
|
||||
/** All the detection parsers currently added to the Assets class. */
|
||||
get detections() {
|
||||
return this._detections;
|
||||
}
|
||||
/**
|
||||
* General setter for preferences. This is a helper function to set preferences on all parsers.
|
||||
* @param preferences - the preferences to set
|
||||
*/
|
||||
setPreferences(preferences) {
|
||||
this.loader.parsers.forEach((parser) => {
|
||||
if (!parser.config)
|
||||
return;
|
||||
Object.keys(parser.config).filter((key) => key in preferences).forEach((key) => {
|
||||
parser.config[key] = preferences[key];
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
const Assets = new AssetsClass();
|
||||
Extensions.extensions.handleByList(Extensions.ExtensionType.LoadParser, Assets.loader.parsers).handleByList(Extensions.ExtensionType.ResolveParser, Assets.resolver.parsers).handleByList(Extensions.ExtensionType.CacheParser, Assets.cache.parsers).handleByList(Extensions.ExtensionType.DetectionParser, Assets.detections);
|
||||
Extensions.extensions.add(
|
||||
cacheTextureArray.cacheTextureArray,
|
||||
detectDefaults.detectDefaults,
|
||||
detectAvif.detectAvif,
|
||||
detectWebp.detectWebp,
|
||||
detectMp4.detectMp4,
|
||||
detectOgv.detectOgv,
|
||||
detectWebm.detectWebm,
|
||||
loadJson.loadJson,
|
||||
loadTxt.loadTxt,
|
||||
loadWebFont.loadWebFont,
|
||||
loadSVG.loadSvg,
|
||||
loadTextures.loadTextures,
|
||||
loadVideoTextures.loadVideoTextures,
|
||||
loadBitmapFont.loadBitmapFont,
|
||||
loadBitmapFont.bitmapFontCachePlugin,
|
||||
resolveTextureUrl.resolveTextureUrl,
|
||||
resolveJsonUrl.resolveJsonUrl
|
||||
);
|
||||
const assetKeyMap = {
|
||||
loader: Extensions.ExtensionType.LoadParser,
|
||||
resolver: Extensions.ExtensionType.ResolveParser,
|
||||
cache: Extensions.ExtensionType.CacheParser,
|
||||
detection: Extensions.ExtensionType.DetectionParser
|
||||
};
|
||||
Extensions.extensions.handle(Extensions.ExtensionType.Asset, (extension) => {
|
||||
const ref = extension.ref;
|
||||
Object.entries(assetKeyMap).filter(([key]) => !!ref[key]).forEach(([key, type]) => Extensions.extensions.add(Object.assign(
|
||||
ref[key],
|
||||
// Allow the function to optionally define it's own
|
||||
// ExtensionMetadata, the use cases here is priority for LoaderParsers
|
||||
{ extension: ref[key].extension ?? type }
|
||||
)));
|
||||
}, (extension) => {
|
||||
const ref = extension.ref;
|
||||
Object.keys(assetKeyMap).filter((key) => !!ref[key]).forEach((key) => Extensions.extensions.remove(ref[key]));
|
||||
});
|
||||
|
||||
exports.Assets = Assets;
|
||||
exports.AssetsClass = AssetsClass;
|
||||
//# sourceMappingURL=Assets.js.map
|
1
node_modules/pixi.js/lib/assets/Assets.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/Assets.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
510
node_modules/pixi.js/lib/assets/Assets.mjs
generated
vendored
Normal file
510
node_modules/pixi.js/lib/assets/Assets.mjs
generated
vendored
Normal file
@@ -0,0 +1,510 @@
|
||||
import { extensions, ExtensionType } from '../extensions/Extensions.mjs';
|
||||
import { loadBitmapFont, bitmapFontCachePlugin } from '../scene/text-bitmap/asset/loadBitmapFont.mjs';
|
||||
import { warn } from '../utils/logging/warn.mjs';
|
||||
import { BackgroundLoader } from './BackgroundLoader.mjs';
|
||||
import { Cache } from './cache/Cache.mjs';
|
||||
import { cacheTextureArray } from './cache/parsers/cacheTextureArray.mjs';
|
||||
import { detectAvif } from './detections/parsers/detectAvif.mjs';
|
||||
import { detectDefaults } from './detections/parsers/detectDefaults.mjs';
|
||||
import { detectMp4 } from './detections/parsers/detectMp4.mjs';
|
||||
import { detectOgv } from './detections/parsers/detectOgv.mjs';
|
||||
import { detectWebm } from './detections/parsers/detectWebm.mjs';
|
||||
import { detectWebp } from './detections/parsers/detectWebp.mjs';
|
||||
import { Loader } from './loader/Loader.mjs';
|
||||
import { loadJson } from './loader/parsers/loadJson.mjs';
|
||||
import { loadTxt } from './loader/parsers/loadTxt.mjs';
|
||||
import { loadWebFont } from './loader/parsers/loadWebFont.mjs';
|
||||
import { loadSvg } from './loader/parsers/textures/loadSVG.mjs';
|
||||
import { loadTextures } from './loader/parsers/textures/loadTextures.mjs';
|
||||
import { loadVideoTextures } from './loader/parsers/textures/loadVideoTextures.mjs';
|
||||
import { resolveJsonUrl } from './resolver/parsers/resolveJsonUrl.mjs';
|
||||
import { resolveTextureUrl } from './resolver/parsers/resolveTextureUrl.mjs';
|
||||
import { Resolver } from './resolver/Resolver.mjs';
|
||||
import { convertToList } from './utils/convertToList.mjs';
|
||||
import { isSingleItem } from './utils/isSingleItem.mjs';
|
||||
|
||||
"use strict";
|
||||
class AssetsClass {
|
||||
constructor() {
|
||||
this._detections = [];
|
||||
this._initialized = false;
|
||||
this.resolver = new Resolver();
|
||||
this.loader = new Loader();
|
||||
this.cache = Cache;
|
||||
this._backgroundLoader = new BackgroundLoader(this.loader);
|
||||
this._backgroundLoader.active = true;
|
||||
this.reset();
|
||||
}
|
||||
/**
|
||||
* Best practice is to call this function before any loading commences
|
||||
* Initiating is the best time to add any customization to the way things are loaded.
|
||||
*
|
||||
* you do not need to call this for the Assets class to work, only if you want to set any initial properties
|
||||
* @param options - options to initialize the Assets manager with
|
||||
*/
|
||||
async init(options = {}) {
|
||||
if (this._initialized) {
|
||||
warn("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");
|
||||
return;
|
||||
}
|
||||
this._initialized = true;
|
||||
if (options.defaultSearchParams) {
|
||||
this.resolver.setDefaultSearchParams(options.defaultSearchParams);
|
||||
}
|
||||
if (options.basePath) {
|
||||
this.resolver.basePath = options.basePath;
|
||||
}
|
||||
if (options.bundleIdentifier) {
|
||||
this.resolver.setBundleIdentifier(options.bundleIdentifier);
|
||||
}
|
||||
if (options.manifest) {
|
||||
let manifest = options.manifest;
|
||||
if (typeof manifest === "string") {
|
||||
manifest = await this.load(manifest);
|
||||
}
|
||||
this.resolver.addManifest(manifest);
|
||||
}
|
||||
const resolutionPref = options.texturePreference?.resolution ?? 1;
|
||||
const resolution = typeof resolutionPref === "number" ? [resolutionPref] : resolutionPref;
|
||||
const formats = await this._detectFormats({
|
||||
preferredFormats: options.texturePreference?.format,
|
||||
skipDetections: options.skipDetections,
|
||||
detections: this._detections
|
||||
});
|
||||
this.resolver.prefer({
|
||||
params: {
|
||||
format: formats,
|
||||
resolution
|
||||
}
|
||||
});
|
||||
if (options.preferences) {
|
||||
this.setPreferences(options.preferences);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Allows you to specify how to resolve any assets load requests.
|
||||
* There are a few ways to add things here as shown below:
|
||||
* @example
|
||||
* import { Assets } from 'pixi.js';
|
||||
*
|
||||
* // Simple
|
||||
* Assets.add({alias: 'bunnyBooBoo', src: 'bunny.png'});
|
||||
* const bunny = await Assets.load('bunnyBooBoo');
|
||||
*
|
||||
* // Multiple keys:
|
||||
* Assets.add({alias: ['burger', 'chicken'], src: 'bunny.png'});
|
||||
*
|
||||
* const bunny = await Assets.load('burger');
|
||||
* const bunny2 = await Assets.load('chicken');
|
||||
*
|
||||
* // passing options to to the object
|
||||
* Assets.add({
|
||||
* alias: 'bunnyBooBooSmooth',
|
||||
* src: 'bunny{png,webp}',
|
||||
* data: { scaleMode: SCALE_MODES.NEAREST }, // Base texture options
|
||||
* });
|
||||
*
|
||||
* // Multiple assets
|
||||
*
|
||||
* // The following all do the same thing:
|
||||
*
|
||||
* Assets.add({alias: 'bunnyBooBoo', src: 'bunny{png,webp}'});
|
||||
*
|
||||
* Assets.add({
|
||||
* alias: 'bunnyBooBoo',
|
||||
* src: [
|
||||
* 'bunny.png',
|
||||
* 'bunny.webp',
|
||||
* ],
|
||||
* });
|
||||
*
|
||||
* const bunny = await Assets.load('bunnyBooBoo'); // Will try to load WebP if available
|
||||
* @param assets - the unresolved assets to add to the resolver
|
||||
*/
|
||||
add(assets) {
|
||||
this.resolver.add(assets);
|
||||
}
|
||||
async load(urls, onProgress) {
|
||||
if (!this._initialized) {
|
||||
await this.init();
|
||||
}
|
||||
const singleAsset = isSingleItem(urls);
|
||||
const urlArray = convertToList(urls).map((url) => {
|
||||
if (typeof url !== "string") {
|
||||
const aliases = this.resolver.getAlias(url);
|
||||
if (aliases.some((alias) => !this.resolver.hasKey(alias))) {
|
||||
this.add(url);
|
||||
}
|
||||
return Array.isArray(aliases) ? aliases[0] : aliases;
|
||||
}
|
||||
if (!this.resolver.hasKey(url))
|
||||
this.add({ alias: url, src: url });
|
||||
return url;
|
||||
});
|
||||
const resolveResults = this.resolver.resolve(urlArray);
|
||||
const out = await this._mapLoadToResolve(resolveResults, onProgress);
|
||||
return singleAsset ? out[urlArray[0]] : out;
|
||||
}
|
||||
/**
|
||||
* This adds a bundle of assets in one go so that you can load them as a group.
|
||||
* For example you could add a bundle for each screen in you pixi app
|
||||
* @example
|
||||
* import { Assets } from 'pixi.js';
|
||||
*
|
||||
* Assets.addBundle('animals', [
|
||||
* { alias: 'bunny', src: 'bunny.png' },
|
||||
* { alias: 'chicken', src: 'chicken.png' },
|
||||
* { alias: 'thumper', src: 'thumper.png' },
|
||||
* ]);
|
||||
* // or
|
||||
* Assets.addBundle('animals', {
|
||||
* bunny: 'bunny.png',
|
||||
* chicken: 'chicken.png',
|
||||
* thumper: 'thumper.png',
|
||||
* });
|
||||
*
|
||||
* const assets = await Assets.loadBundle('animals');
|
||||
* @param bundleId - the id of the bundle to add
|
||||
* @param assets - a record of the asset or assets that will be chosen from when loading via the specified key
|
||||
*/
|
||||
addBundle(bundleId, assets) {
|
||||
this.resolver.addBundle(bundleId, assets);
|
||||
}
|
||||
/**
|
||||
* Bundles are a way to load multiple assets at once.
|
||||
* If a manifest has been provided to the init function then you can load a bundle, or bundles.
|
||||
* you can also add bundles via `addBundle`
|
||||
* @example
|
||||
* import { Assets } from 'pixi.js';
|
||||
*
|
||||
* // Manifest Example
|
||||
* const manifest = {
|
||||
* bundles: [
|
||||
* {
|
||||
* name: 'load-screen',
|
||||
* assets: [
|
||||
* {
|
||||
* alias: 'background',
|
||||
* src: 'sunset.png',
|
||||
* },
|
||||
* {
|
||||
* alias: 'bar',
|
||||
* src: 'load-bar.{png,webp}',
|
||||
* },
|
||||
* ],
|
||||
* },
|
||||
* {
|
||||
* name: 'game-screen',
|
||||
* assets: [
|
||||
* {
|
||||
* alias: 'character',
|
||||
* src: 'robot.png',
|
||||
* },
|
||||
* {
|
||||
* alias: 'enemy',
|
||||
* src: 'bad-guy.png',
|
||||
* },
|
||||
* ],
|
||||
* },
|
||||
* ]
|
||||
* };
|
||||
*
|
||||
* await Assets.init({ manifest });
|
||||
*
|
||||
* // Load a bundle...
|
||||
* loadScreenAssets = await Assets.loadBundle('load-screen');
|
||||
* // Load another bundle...
|
||||
* gameScreenAssets = await Assets.loadBundle('game-screen');
|
||||
* @param bundleIds - the bundle id or ids to load
|
||||
* @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. 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
|
||||
*/
|
||||
async loadBundle(bundleIds, onProgress) {
|
||||
if (!this._initialized) {
|
||||
await this.init();
|
||||
}
|
||||
let singleAsset = false;
|
||||
if (typeof bundleIds === "string") {
|
||||
singleAsset = true;
|
||||
bundleIds = [bundleIds];
|
||||
}
|
||||
const resolveResults = this.resolver.resolveBundle(bundleIds);
|
||||
const out = {};
|
||||
const keys = Object.keys(resolveResults);
|
||||
let count = 0;
|
||||
let total = 0;
|
||||
const _onProgress = () => {
|
||||
onProgress?.(++count / total);
|
||||
};
|
||||
const promises = keys.map((bundleId) => {
|
||||
const resolveResult = resolveResults[bundleId];
|
||||
total += Object.keys(resolveResult).length;
|
||||
return this._mapLoadToResolve(resolveResult, _onProgress).then((resolveResult2) => {
|
||||
out[bundleId] = resolveResult2;
|
||||
});
|
||||
});
|
||||
await Promise.all(promises);
|
||||
return singleAsset ? out[bundleIds[0]] : out;
|
||||
}
|
||||
/**
|
||||
* Initiate a background load of some assets. It will passively begin to load these assets in the background.
|
||||
* So when you actually come to loading them you will get a promise that resolves to the loaded assets immediately
|
||||
*
|
||||
* An example of this might be that you would background load game assets after your initial load.
|
||||
* then when you got to actually load your game screen assets when a player goes to the game - the loading
|
||||
* would already have stared or may even be complete, saving you having to show an interim load bar.
|
||||
* @example
|
||||
* import { Assets } from 'pixi.js';
|
||||
*
|
||||
* Assets.backgroundLoad('bunny.png');
|
||||
*
|
||||
* // later on in your app...
|
||||
* await Assets.loadBundle('bunny.png'); // Will resolve quicker as loading may have completed!
|
||||
* @param urls - the url / urls you want to background load
|
||||
*/
|
||||
async backgroundLoad(urls) {
|
||||
if (!this._initialized) {
|
||||
await this.init();
|
||||
}
|
||||
if (typeof urls === "string") {
|
||||
urls = [urls];
|
||||
}
|
||||
const resolveResults = this.resolver.resolve(urls);
|
||||
this._backgroundLoader.add(Object.values(resolveResults));
|
||||
}
|
||||
/**
|
||||
* Initiate a background of a bundle, works exactly like backgroundLoad but for bundles.
|
||||
* this can only be used if the loader has been initiated with a manifest
|
||||
* @example
|
||||
* import { Assets } from 'pixi.js';
|
||||
*
|
||||
* await Assets.init({
|
||||
* manifest: {
|
||||
* bundles: [
|
||||
* {
|
||||
* name: 'load-screen',
|
||||
* assets: [...],
|
||||
* },
|
||||
* ...
|
||||
* ],
|
||||
* },
|
||||
* });
|
||||
*
|
||||
* Assets.backgroundLoadBundle('load-screen');
|
||||
*
|
||||
* // Later on in your app...
|
||||
* await Assets.loadBundle('load-screen'); // Will resolve quicker as loading may have completed!
|
||||
* @param bundleIds - the bundleId / bundleIds you want to background load
|
||||
*/
|
||||
async backgroundLoadBundle(bundleIds) {
|
||||
if (!this._initialized) {
|
||||
await this.init();
|
||||
}
|
||||
if (typeof bundleIds === "string") {
|
||||
bundleIds = [bundleIds];
|
||||
}
|
||||
const resolveResults = this.resolver.resolveBundle(bundleIds);
|
||||
Object.values(resolveResults).forEach((resolveResult) => {
|
||||
this._backgroundLoader.add(Object.values(resolveResult));
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Only intended for development purposes.
|
||||
* This will wipe the resolver and caches.
|
||||
* You will need to reinitialize the Asset
|
||||
*/
|
||||
reset() {
|
||||
this.resolver.reset();
|
||||
this.loader.reset();
|
||||
this.cache.reset();
|
||||
this._initialized = false;
|
||||
}
|
||||
get(keys) {
|
||||
if (typeof keys === "string") {
|
||||
return Cache.get(keys);
|
||||
}
|
||||
const assets = {};
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
assets[i] = Cache.get(keys[i]);
|
||||
}
|
||||
return assets;
|
||||
}
|
||||
/**
|
||||
* helper function to map resolved assets back to loaded assets
|
||||
* @param resolveResults - the resolve results from the resolver
|
||||
* @param onProgress - the progress callback
|
||||
*/
|
||||
async _mapLoadToResolve(resolveResults, onProgress) {
|
||||
const resolveArray = [...new Set(Object.values(resolveResults))];
|
||||
this._backgroundLoader.active = false;
|
||||
const loadedAssets = await this.loader.load(resolveArray, onProgress);
|
||||
this._backgroundLoader.active = true;
|
||||
const out = {};
|
||||
resolveArray.forEach((resolveResult) => {
|
||||
const asset = loadedAssets[resolveResult.src];
|
||||
const keys = [resolveResult.src];
|
||||
if (resolveResult.alias) {
|
||||
keys.push(...resolveResult.alias);
|
||||
}
|
||||
keys.forEach((key) => {
|
||||
out[key] = asset;
|
||||
});
|
||||
Cache.set(keys, asset);
|
||||
});
|
||||
return out;
|
||||
}
|
||||
/**
|
||||
* Unload an asset or assets. As the Assets class is responsible for creating the assets via the `load` function
|
||||
* this will make sure to destroy any assets and release them from memory.
|
||||
* Once unloaded, you will need to load the asset again.
|
||||
*
|
||||
* Use this to help manage assets if you find that you have a large app and you want to free up memory.
|
||||
*
|
||||
* - it's up to you as the developer to make sure that textures are not actively being used when you unload them,
|
||||
* Pixi won't break but you will end up with missing assets. Not a good look for the user!
|
||||
* @example
|
||||
* import { Assets } from 'pixi.js';
|
||||
*
|
||||
* // Load a URL:
|
||||
* const myImageTexture = await Assets.load('http://some.url.com/image.png'); // => returns a texture
|
||||
*
|
||||
* await Assets.unload('http://some.url.com/image.png')
|
||||
*
|
||||
* // myImageTexture will be destroyed now.
|
||||
*
|
||||
* // Unload multiple assets:
|
||||
* const textures = await Assets.unload(['thumper', 'chicko']);
|
||||
* @param urls - the urls to unload
|
||||
*/
|
||||
async unload(urls) {
|
||||
if (!this._initialized) {
|
||||
await this.init();
|
||||
}
|
||||
const urlArray = convertToList(urls).map((url) => typeof url !== "string" ? url.src : url);
|
||||
const resolveResults = this.resolver.resolve(urlArray);
|
||||
await this._unloadFromResolved(resolveResults);
|
||||
}
|
||||
/**
|
||||
* Bundles are a way to manage multiple assets at once.
|
||||
* this will unload all files in a bundle.
|
||||
*
|
||||
* once a bundle has been unloaded, you need to load it again to have access to the assets.
|
||||
* @example
|
||||
* import { Assets } from 'pixi.js';
|
||||
*
|
||||
* Assets.addBundle({
|
||||
* 'thumper': 'http://some.url.com/thumper.png',
|
||||
* })
|
||||
*
|
||||
* const assets = await Assets.loadBundle('thumper');
|
||||
*
|
||||
* // Now to unload...
|
||||
*
|
||||
* await Assets.unloadBundle('thumper');
|
||||
*
|
||||
* // All assets in the assets object will now have been destroyed and purged from the cache
|
||||
* @param bundleIds - the bundle id or ids to unload
|
||||
*/
|
||||
async unloadBundle(bundleIds) {
|
||||
if (!this._initialized) {
|
||||
await this.init();
|
||||
}
|
||||
bundleIds = convertToList(bundleIds);
|
||||
const resolveResults = this.resolver.resolveBundle(bundleIds);
|
||||
const promises = Object.keys(resolveResults).map((bundleId) => this._unloadFromResolved(resolveResults[bundleId]));
|
||||
await Promise.all(promises);
|
||||
}
|
||||
async _unloadFromResolved(resolveResult) {
|
||||
const resolveArray = Object.values(resolveResult);
|
||||
resolveArray.forEach((resolveResult2) => {
|
||||
Cache.remove(resolveResult2.src);
|
||||
});
|
||||
await this.loader.unload(resolveArray);
|
||||
}
|
||||
/**
|
||||
* Detects the supported formats for the browser, and returns an array of supported formats, respecting
|
||||
* the users preferred formats order.
|
||||
* @param options - the options to use when detecting formats
|
||||
* @param options.preferredFormats - the preferred formats to use
|
||||
* @param options.skipDetections - if we should skip the detections altogether
|
||||
* @param options.detections - the detections to use
|
||||
* @returns - the detected formats
|
||||
*/
|
||||
async _detectFormats(options) {
|
||||
let formats = [];
|
||||
if (options.preferredFormats) {
|
||||
formats = Array.isArray(options.preferredFormats) ? options.preferredFormats : [options.preferredFormats];
|
||||
}
|
||||
for (const detection of options.detections) {
|
||||
if (options.skipDetections || await detection.test()) {
|
||||
formats = await detection.add(formats);
|
||||
} else if (!options.skipDetections) {
|
||||
formats = await detection.remove(formats);
|
||||
}
|
||||
}
|
||||
formats = formats.filter((format, index) => formats.indexOf(format) === index);
|
||||
return formats;
|
||||
}
|
||||
/** All the detection parsers currently added to the Assets class. */
|
||||
get detections() {
|
||||
return this._detections;
|
||||
}
|
||||
/**
|
||||
* General setter for preferences. This is a helper function to set preferences on all parsers.
|
||||
* @param preferences - the preferences to set
|
||||
*/
|
||||
setPreferences(preferences) {
|
||||
this.loader.parsers.forEach((parser) => {
|
||||
if (!parser.config)
|
||||
return;
|
||||
Object.keys(parser.config).filter((key) => key in preferences).forEach((key) => {
|
||||
parser.config[key] = preferences[key];
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
const Assets = new AssetsClass();
|
||||
extensions.handleByList(ExtensionType.LoadParser, Assets.loader.parsers).handleByList(ExtensionType.ResolveParser, Assets.resolver.parsers).handleByList(ExtensionType.CacheParser, Assets.cache.parsers).handleByList(ExtensionType.DetectionParser, Assets.detections);
|
||||
extensions.add(
|
||||
cacheTextureArray,
|
||||
detectDefaults,
|
||||
detectAvif,
|
||||
detectWebp,
|
||||
detectMp4,
|
||||
detectOgv,
|
||||
detectWebm,
|
||||
loadJson,
|
||||
loadTxt,
|
||||
loadWebFont,
|
||||
loadSvg,
|
||||
loadTextures,
|
||||
loadVideoTextures,
|
||||
loadBitmapFont,
|
||||
bitmapFontCachePlugin,
|
||||
resolveTextureUrl,
|
||||
resolveJsonUrl
|
||||
);
|
||||
const assetKeyMap = {
|
||||
loader: ExtensionType.LoadParser,
|
||||
resolver: ExtensionType.ResolveParser,
|
||||
cache: ExtensionType.CacheParser,
|
||||
detection: ExtensionType.DetectionParser
|
||||
};
|
||||
extensions.handle(ExtensionType.Asset, (extension) => {
|
||||
const ref = extension.ref;
|
||||
Object.entries(assetKeyMap).filter(([key]) => !!ref[key]).forEach(([key, type]) => extensions.add(Object.assign(
|
||||
ref[key],
|
||||
// Allow the function to optionally define it's own
|
||||
// ExtensionMetadata, the use cases here is priority for LoaderParsers
|
||||
{ extension: ref[key].extension ?? type }
|
||||
)));
|
||||
}, (extension) => {
|
||||
const ref = extension.ref;
|
||||
Object.keys(assetKeyMap).filter((key) => !!ref[key]).forEach((key) => extensions.remove(ref[key]));
|
||||
});
|
||||
|
||||
export { Assets, AssetsClass };
|
||||
//# sourceMappingURL=Assets.mjs.map
|
1
node_modules/pixi.js/lib/assets/Assets.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/Assets.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
13
node_modules/pixi.js/lib/assets/AssetsMixins.d.ts
generated
vendored
Normal file
13
node_modules/pixi.js/lib/assets/AssetsMixins.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
declare global
|
||||
{
|
||||
namespace PixiMixins
|
||||
{
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
interface AssetsPreferences
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export {};
|
41
node_modules/pixi.js/lib/assets/BackgroundLoader.d.ts
generated
vendored
Normal file
41
node_modules/pixi.js/lib/assets/BackgroundLoader.d.ts
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
import type { Loader } from './loader/Loader';
|
||||
import type { ResolvedAsset } from './types';
|
||||
/**
|
||||
* Quietly Loads assets in the background.
|
||||
* @memberof assets
|
||||
*/
|
||||
export declare class BackgroundLoader {
|
||||
/** Whether or not the loader should continue loading. */
|
||||
private _isActive;
|
||||
/** Assets to load. */
|
||||
private readonly _assetList;
|
||||
/** Whether or not the loader is loading. */
|
||||
private _isLoading;
|
||||
/** Number of assets to load at a time. */
|
||||
private readonly _maxConcurrent;
|
||||
/** Should the loader log to the console. */
|
||||
verbose: boolean;
|
||||
private readonly _loader;
|
||||
/**
|
||||
* @param loader
|
||||
* @param verbose - should the loader log to the console
|
||||
*/
|
||||
constructor(loader: Loader, verbose?: boolean);
|
||||
/**
|
||||
* Adds an array of assets to load.
|
||||
* @param assetUrls - assets to load
|
||||
*/
|
||||
add(assetUrls: ResolvedAsset[]): void;
|
||||
/**
|
||||
* Loads the next set of assets. Will try to load as many assets as it can at the same time.
|
||||
*
|
||||
* The max assets it will try to load at one time will be 4.
|
||||
*/
|
||||
private _next;
|
||||
/**
|
||||
* Activate/Deactivate the loading. If set to true then it will immediately continue to load the next asset.
|
||||
* @returns whether the class is active
|
||||
*/
|
||||
get active(): boolean;
|
||||
set active(value: boolean);
|
||||
}
|
67
node_modules/pixi.js/lib/assets/BackgroundLoader.js
generated
vendored
Normal file
67
node_modules/pixi.js/lib/assets/BackgroundLoader.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
class BackgroundLoader {
|
||||
/**
|
||||
* @param loader
|
||||
* @param verbose - should the loader log to the console
|
||||
*/
|
||||
constructor(loader, verbose = false) {
|
||||
this._loader = loader;
|
||||
this._assetList = [];
|
||||
this._isLoading = false;
|
||||
this._maxConcurrent = 1;
|
||||
this.verbose = verbose;
|
||||
}
|
||||
/**
|
||||
* Adds an array of assets to load.
|
||||
* @param assetUrls - assets to load
|
||||
*/
|
||||
add(assetUrls) {
|
||||
assetUrls.forEach((a) => {
|
||||
this._assetList.push(a);
|
||||
});
|
||||
if (this.verbose) {
|
||||
console.log("[BackgroundLoader] assets: ", this._assetList);
|
||||
}
|
||||
if (this._isActive && !this._isLoading) {
|
||||
void this._next();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Loads the next set of assets. Will try to load as many assets as it can at the same time.
|
||||
*
|
||||
* The max assets it will try to load at one time will be 4.
|
||||
*/
|
||||
async _next() {
|
||||
if (this._assetList.length && this._isActive) {
|
||||
this._isLoading = true;
|
||||
const toLoad = [];
|
||||
const toLoadAmount = Math.min(this._assetList.length, this._maxConcurrent);
|
||||
for (let i = 0; i < toLoadAmount; i++) {
|
||||
toLoad.push(this._assetList.pop());
|
||||
}
|
||||
await this._loader.load(toLoad);
|
||||
this._isLoading = false;
|
||||
void this._next();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Activate/Deactivate the loading. If set to true then it will immediately continue to load the next asset.
|
||||
* @returns whether the class is active
|
||||
*/
|
||||
get active() {
|
||||
return this._isActive;
|
||||
}
|
||||
set active(value) {
|
||||
if (this._isActive === value)
|
||||
return;
|
||||
this._isActive = value;
|
||||
if (value && !this._isLoading) {
|
||||
void this._next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports.BackgroundLoader = BackgroundLoader;
|
||||
//# sourceMappingURL=BackgroundLoader.js.map
|
1
node_modules/pixi.js/lib/assets/BackgroundLoader.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/BackgroundLoader.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"BackgroundLoader.js","sources":["../../src/assets/BackgroundLoader.ts"],"sourcesContent":["import type { Loader } from './loader/Loader';\nimport type { ResolvedAsset } from './types';\n\n/**\n * Quietly Loads assets in the background.\n * @memberof assets\n */\nexport class BackgroundLoader\n{\n /** Whether or not the loader should continue loading. */\n private _isActive: boolean;\n\n /** Assets to load. */\n private readonly _assetList: ResolvedAsset[];\n\n /** Whether or not the loader is loading. */\n private _isLoading: boolean;\n\n /** Number of assets to load at a time. */\n private readonly _maxConcurrent: number;\n\n /** Should the loader log to the console. */\n public verbose: boolean;\n private readonly _loader: Loader;\n\n /**\n * @param loader\n * @param verbose - should the loader log to the console\n */\n constructor(loader: Loader, verbose = false)\n {\n this._loader = loader;\n this._assetList = [];\n this._isLoading = false;\n this._maxConcurrent = 1;\n this.verbose = verbose;\n }\n\n /**\n * Adds an array of assets to load.\n * @param assetUrls - assets to load\n */\n public add(assetUrls: ResolvedAsset[]): void\n {\n assetUrls.forEach((a) =>\n {\n this._assetList.push(a);\n });\n\n if (this.verbose)\n {\n // eslint-disable-next-line no-console\n console.log('[BackgroundLoader] assets: ', this._assetList);\n }\n\n if (this._isActive && !this._isLoading)\n {\n void this._next();\n }\n }\n\n /**\n * Loads the next set of assets. Will try to load as many assets as it can at the same time.\n *\n * The max assets it will try to load at one time will be 4.\n */\n private async _next(): Promise<void>\n {\n if (this._assetList.length && this._isActive)\n {\n this._isLoading = true;\n\n const toLoad = [];\n\n const toLoadAmount = Math.min(this._assetList.length, this._maxConcurrent);\n\n for (let i = 0; i < toLoadAmount; i++)\n {\n toLoad.push(this._assetList.pop());\n }\n\n await this._loader.load(toLoad);\n\n this._isLoading = false;\n\n void this._next();\n }\n }\n\n /**\n * Activate/Deactivate the loading. If set to true then it will immediately continue to load the next asset.\n * @returns whether the class is active\n */\n get active(): boolean\n {\n return this._isActive;\n }\n\n set active(value: boolean)\n {\n if (this._isActive === value) return;\n\n this._isActive = value;\n\n if (value && !this._isLoading)\n {\n void this._next();\n }\n }\n}\n"],"names":[],"mappings":";;;AAOO,MAAM,gBACb,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBI,WAAA,CAAY,MAAgB,EAAA,OAAA,GAAU,KACtC,EAAA;AACI,IAAA,IAAA,CAAK,OAAU,GAAA,MAAA,CAAA;AACf,IAAA,IAAA,CAAK,aAAa,EAAC,CAAA;AACnB,IAAA,IAAA,CAAK,UAAa,GAAA,KAAA,CAAA;AAClB,IAAA,IAAA,CAAK,cAAiB,GAAA,CAAA,CAAA;AACtB,IAAA,IAAA,CAAK,OAAU,GAAA,OAAA,CAAA;AAAA,GACnB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMO,IAAI,SACX,EAAA;AACI,IAAU,SAAA,CAAA,OAAA,CAAQ,CAAC,CACnB,KAAA;AACI,MAAK,IAAA,CAAA,UAAA,CAAW,KAAK,CAAC,CAAA,CAAA;AAAA,KACzB,CAAA,CAAA;AAED,IAAA,IAAI,KAAK,OACT,EAAA;AAEI,MAAQ,OAAA,CAAA,GAAA,CAAI,6BAA+B,EAAA,IAAA,CAAK,UAAU,CAAA,CAAA;AAAA,KAC9D;AAEA,IAAA,IAAI,IAAK,CAAA,SAAA,IAAa,CAAC,IAAA,CAAK,UAC5B,EAAA;AACI,MAAA,KAAK,KAAK,KAAM,EAAA,CAAA;AAAA,KACpB;AAAA,GACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAc,KACd,GAAA;AACI,IAAA,IAAI,IAAK,CAAA,UAAA,CAAW,MAAU,IAAA,IAAA,CAAK,SACnC,EAAA;AACI,MAAA,IAAA,CAAK,UAAa,GAAA,IAAA,CAAA;AAElB,MAAA,MAAM,SAAS,EAAC,CAAA;AAEhB,MAAA,MAAM,eAAe,IAAK,CAAA,GAAA,CAAI,KAAK,UAAW,CAAA,MAAA,EAAQ,KAAK,cAAc,CAAA,CAAA;AAEzE,MAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,CAAI,GAAA,YAAA,EAAc,CAClC,EAAA,EAAA;AACI,QAAA,MAAA,CAAO,IAAK,CAAA,IAAA,CAAK,UAAW,CAAA,GAAA,EAAK,CAAA,CAAA;AAAA,OACrC;AAEA,MAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,IAAA,CAAK,MAAM,CAAA,CAAA;AAE9B,MAAA,IAAA,CAAK,UAAa,GAAA,KAAA,CAAA;AAElB,MAAA,KAAK,KAAK,KAAM,EAAA,CAAA;AAAA,KACpB;AAAA,GACJ;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,MACJ,GAAA;AACI,IAAA,OAAO,IAAK,CAAA,SAAA,CAAA;AAAA,GAChB;AAAA,EAEA,IAAI,OAAO,KACX,EAAA;AACI,IAAA,IAAI,KAAK,SAAc,KAAA,KAAA;AAAO,MAAA,OAAA;AAE9B,IAAA,IAAA,CAAK,SAAY,GAAA,KAAA,CAAA;AAEjB,IAAI,IAAA,KAAA,IAAS,CAAC,IAAA,CAAK,UACnB,EAAA;AACI,MAAA,KAAK,KAAK,KAAM,EAAA,CAAA;AAAA,KACpB;AAAA,GACJ;AACJ;;;;"}
|
65
node_modules/pixi.js/lib/assets/BackgroundLoader.mjs
generated
vendored
Normal file
65
node_modules/pixi.js/lib/assets/BackgroundLoader.mjs
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
"use strict";
|
||||
class BackgroundLoader {
|
||||
/**
|
||||
* @param loader
|
||||
* @param verbose - should the loader log to the console
|
||||
*/
|
||||
constructor(loader, verbose = false) {
|
||||
this._loader = loader;
|
||||
this._assetList = [];
|
||||
this._isLoading = false;
|
||||
this._maxConcurrent = 1;
|
||||
this.verbose = verbose;
|
||||
}
|
||||
/**
|
||||
* Adds an array of assets to load.
|
||||
* @param assetUrls - assets to load
|
||||
*/
|
||||
add(assetUrls) {
|
||||
assetUrls.forEach((a) => {
|
||||
this._assetList.push(a);
|
||||
});
|
||||
if (this.verbose) {
|
||||
console.log("[BackgroundLoader] assets: ", this._assetList);
|
||||
}
|
||||
if (this._isActive && !this._isLoading) {
|
||||
void this._next();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Loads the next set of assets. Will try to load as many assets as it can at the same time.
|
||||
*
|
||||
* The max assets it will try to load at one time will be 4.
|
||||
*/
|
||||
async _next() {
|
||||
if (this._assetList.length && this._isActive) {
|
||||
this._isLoading = true;
|
||||
const toLoad = [];
|
||||
const toLoadAmount = Math.min(this._assetList.length, this._maxConcurrent);
|
||||
for (let i = 0; i < toLoadAmount; i++) {
|
||||
toLoad.push(this._assetList.pop());
|
||||
}
|
||||
await this._loader.load(toLoad);
|
||||
this._isLoading = false;
|
||||
void this._next();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Activate/Deactivate the loading. If set to true then it will immediately continue to load the next asset.
|
||||
* @returns whether the class is active
|
||||
*/
|
||||
get active() {
|
||||
return this._isActive;
|
||||
}
|
||||
set active(value) {
|
||||
if (this._isActive === value)
|
||||
return;
|
||||
this._isActive = value;
|
||||
if (value && !this._isLoading) {
|
||||
void this._next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export { BackgroundLoader };
|
||||
//# sourceMappingURL=BackgroundLoader.mjs.map
|
1
node_modules/pixi.js/lib/assets/BackgroundLoader.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/BackgroundLoader.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"BackgroundLoader.mjs","sources":["../../src/assets/BackgroundLoader.ts"],"sourcesContent":["import type { Loader } from './loader/Loader';\nimport type { ResolvedAsset } from './types';\n\n/**\n * Quietly Loads assets in the background.\n * @memberof assets\n */\nexport class BackgroundLoader\n{\n /** Whether or not the loader should continue loading. */\n private _isActive: boolean;\n\n /** Assets to load. */\n private readonly _assetList: ResolvedAsset[];\n\n /** Whether or not the loader is loading. */\n private _isLoading: boolean;\n\n /** Number of assets to load at a time. */\n private readonly _maxConcurrent: number;\n\n /** Should the loader log to the console. */\n public verbose: boolean;\n private readonly _loader: Loader;\n\n /**\n * @param loader\n * @param verbose - should the loader log to the console\n */\n constructor(loader: Loader, verbose = false)\n {\n this._loader = loader;\n this._assetList = [];\n this._isLoading = false;\n this._maxConcurrent = 1;\n this.verbose = verbose;\n }\n\n /**\n * Adds an array of assets to load.\n * @param assetUrls - assets to load\n */\n public add(assetUrls: ResolvedAsset[]): void\n {\n assetUrls.forEach((a) =>\n {\n this._assetList.push(a);\n });\n\n if (this.verbose)\n {\n // eslint-disable-next-line no-console\n console.log('[BackgroundLoader] assets: ', this._assetList);\n }\n\n if (this._isActive && !this._isLoading)\n {\n void this._next();\n }\n }\n\n /**\n * Loads the next set of assets. Will try to load as many assets as it can at the same time.\n *\n * The max assets it will try to load at one time will be 4.\n */\n private async _next(): Promise<void>\n {\n if (this._assetList.length && this._isActive)\n {\n this._isLoading = true;\n\n const toLoad = [];\n\n const toLoadAmount = Math.min(this._assetList.length, this._maxConcurrent);\n\n for (let i = 0; i < toLoadAmount; i++)\n {\n toLoad.push(this._assetList.pop());\n }\n\n await this._loader.load(toLoad);\n\n this._isLoading = false;\n\n void this._next();\n }\n }\n\n /**\n * Activate/Deactivate the loading. If set to true then it will immediately continue to load the next asset.\n * @returns whether the class is active\n */\n get active(): boolean\n {\n return this._isActive;\n }\n\n set active(value: boolean)\n {\n if (this._isActive === value) return;\n\n this._isActive = value;\n\n if (value && !this._isLoading)\n {\n void this._next();\n }\n }\n}\n"],"names":[],"mappings":";AAOO,MAAM,gBACb,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBI,WAAA,CAAY,MAAgB,EAAA,OAAA,GAAU,KACtC,EAAA;AACI,IAAA,IAAA,CAAK,OAAU,GAAA,MAAA,CAAA;AACf,IAAA,IAAA,CAAK,aAAa,EAAC,CAAA;AACnB,IAAA,IAAA,CAAK,UAAa,GAAA,KAAA,CAAA;AAClB,IAAA,IAAA,CAAK,cAAiB,GAAA,CAAA,CAAA;AACtB,IAAA,IAAA,CAAK,OAAU,GAAA,OAAA,CAAA;AAAA,GACnB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMO,IAAI,SACX,EAAA;AACI,IAAU,SAAA,CAAA,OAAA,CAAQ,CAAC,CACnB,KAAA;AACI,MAAK,IAAA,CAAA,UAAA,CAAW,KAAK,CAAC,CAAA,CAAA;AAAA,KACzB,CAAA,CAAA;AAED,IAAA,IAAI,KAAK,OACT,EAAA;AAEI,MAAQ,OAAA,CAAA,GAAA,CAAI,6BAA+B,EAAA,IAAA,CAAK,UAAU,CAAA,CAAA;AAAA,KAC9D;AAEA,IAAA,IAAI,IAAK,CAAA,SAAA,IAAa,CAAC,IAAA,CAAK,UAC5B,EAAA;AACI,MAAA,KAAK,KAAK,KAAM,EAAA,CAAA;AAAA,KACpB;AAAA,GACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAc,KACd,GAAA;AACI,IAAA,IAAI,IAAK,CAAA,UAAA,CAAW,MAAU,IAAA,IAAA,CAAK,SACnC,EAAA;AACI,MAAA,IAAA,CAAK,UAAa,GAAA,IAAA,CAAA;AAElB,MAAA,MAAM,SAAS,EAAC,CAAA;AAEhB,MAAA,MAAM,eAAe,IAAK,CAAA,GAAA,CAAI,KAAK,UAAW,CAAA,MAAA,EAAQ,KAAK,cAAc,CAAA,CAAA;AAEzE,MAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,CAAI,GAAA,YAAA,EAAc,CAClC,EAAA,EAAA;AACI,QAAA,MAAA,CAAO,IAAK,CAAA,IAAA,CAAK,UAAW,CAAA,GAAA,EAAK,CAAA,CAAA;AAAA,OACrC;AAEA,MAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,IAAA,CAAK,MAAM,CAAA,CAAA;AAE9B,MAAA,IAAA,CAAK,UAAa,GAAA,KAAA,CAAA;AAElB,MAAA,KAAK,KAAK,KAAM,EAAA,CAAA;AAAA,KACpB;AAAA,GACJ;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,MACJ,GAAA;AACI,IAAA,OAAO,IAAK,CAAA,SAAA,CAAA;AAAA,GAChB;AAAA,EAEA,IAAI,OAAO,KACX,EAAA;AACI,IAAA,IAAI,KAAK,SAAc,KAAA,KAAA;AAAO,MAAA,OAAA;AAE9B,IAAA,IAAA,CAAK,SAAY,GAAA,KAAA,CAAA;AAEjB,IAAI,IAAA,KAAA,IAAS,CAAC,IAAA,CAAK,UACnB,EAAA;AACI,MAAA,KAAK,KAAK,KAAM,EAAA,CAAA;AAAA,KACpB;AAAA,GACJ;AACJ;;;;"}
|
54
node_modules/pixi.js/lib/assets/cache/Cache.d.ts
generated
vendored
Normal file
54
node_modules/pixi.js/lib/assets/cache/Cache.d.ts
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
import type { CacheParser } from './CacheParser';
|
||||
/**
|
||||
* A single Cache for all assets.
|
||||
*
|
||||
* When assets are added to the cache via set they normally are added to the cache as key-value pairs.
|
||||
*
|
||||
* With this cache, you can add parsers that will take the object and convert it to a list of assets that can be cached.
|
||||
* for example a cacheSpritesheet parser will add all of the textures found within its sprite sheet directly to the cache.
|
||||
*
|
||||
* This gives devs the flexibility to cache any type of object however we want.
|
||||
*
|
||||
* It is not intended that this class is created by developers - it is part of the Asset package.
|
||||
* This is the first major system of PixiJS' main Assets class.
|
||||
* @example
|
||||
* import { Cache } from 'pixi.js';
|
||||
*
|
||||
* Cache.set('bunny', bunnyTexture);
|
||||
* @class Cache
|
||||
* @memberof assets
|
||||
*/
|
||||
declare class CacheClass {
|
||||
private readonly _parsers;
|
||||
private readonly _cache;
|
||||
private readonly _cacheMap;
|
||||
/** Clear all entries. */
|
||||
reset(): void;
|
||||
/**
|
||||
* Check if the key exists
|
||||
* @param key - The key to check
|
||||
*/
|
||||
has(key: any): boolean;
|
||||
/**
|
||||
* Fetch entry by key
|
||||
* @param key - The key of the entry to get
|
||||
*/
|
||||
get<T = any>(key: any): T;
|
||||
/**
|
||||
* Set a value by key or keys name
|
||||
* @param key - The key or keys to set
|
||||
* @param value - The value to store in the cache or from which cacheable assets will be derived.
|
||||
*/
|
||||
set(key: any | any[], value: unknown): void;
|
||||
/**
|
||||
* Remove entry by key
|
||||
*
|
||||
* This function will also remove any associated alias from the cache also.
|
||||
* @param key - The key of the entry to remove
|
||||
*/
|
||||
remove(key: any): void;
|
||||
/** All loader parsers registered */
|
||||
get parsers(): CacheParser[];
|
||||
}
|
||||
export declare const Cache: CacheClass;
|
||||
export {};
|
101
node_modules/pixi.js/lib/assets/cache/Cache.js
generated
vendored
Normal file
101
node_modules/pixi.js/lib/assets/cache/Cache.js
generated
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
'use strict';
|
||||
|
||||
var warn = require('../../utils/logging/warn.js');
|
||||
var convertToList = require('../utils/convertToList.js');
|
||||
|
||||
"use strict";
|
||||
class CacheClass {
|
||||
constructor() {
|
||||
this._parsers = [];
|
||||
this._cache = /* @__PURE__ */ new Map();
|
||||
this._cacheMap = /* @__PURE__ */ new Map();
|
||||
}
|
||||
/** Clear all entries. */
|
||||
reset() {
|
||||
this._cacheMap.clear();
|
||||
this._cache.clear();
|
||||
}
|
||||
/**
|
||||
* Check if the key exists
|
||||
* @param key - The key to check
|
||||
*/
|
||||
has(key) {
|
||||
return this._cache.has(key);
|
||||
}
|
||||
/**
|
||||
* Fetch entry by key
|
||||
* @param key - The key of the entry to get
|
||||
*/
|
||||
get(key) {
|
||||
const result = this._cache.get(key);
|
||||
if (!result) {
|
||||
warn.warn(`[Assets] Asset id ${key} was not found in the Cache`);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Set a value by key or keys name
|
||||
* @param key - The key or keys to set
|
||||
* @param value - The value to store in the cache or from which cacheable assets will be derived.
|
||||
*/
|
||||
set(key, value) {
|
||||
const keys = convertToList.convertToList(key);
|
||||
let cacheableAssets;
|
||||
for (let i = 0; i < this.parsers.length; i++) {
|
||||
const parser = this.parsers[i];
|
||||
if (parser.test(value)) {
|
||||
cacheableAssets = parser.getCacheableAssets(keys, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
const cacheableMap = new Map(Object.entries(cacheableAssets || {}));
|
||||
if (!cacheableAssets) {
|
||||
keys.forEach((key2) => {
|
||||
cacheableMap.set(key2, value);
|
||||
});
|
||||
}
|
||||
const cacheKeys = [...cacheableMap.keys()];
|
||||
const cachedAssets = {
|
||||
cacheKeys,
|
||||
keys
|
||||
};
|
||||
keys.forEach((key2) => {
|
||||
this._cacheMap.set(key2, cachedAssets);
|
||||
});
|
||||
cacheKeys.forEach((key2) => {
|
||||
const val = cacheableAssets ? cacheableAssets[key2] : value;
|
||||
if (this._cache.has(key2) && this._cache.get(key2) !== val) {
|
||||
warn.warn("[Cache] already has key:", key2);
|
||||
}
|
||||
this._cache.set(key2, cacheableMap.get(key2));
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Remove entry by key
|
||||
*
|
||||
* This function will also remove any associated alias from the cache also.
|
||||
* @param key - The key of the entry to remove
|
||||
*/
|
||||
remove(key) {
|
||||
if (!this._cacheMap.has(key)) {
|
||||
warn.warn(`[Assets] Asset id ${key} was not found in the Cache`);
|
||||
return;
|
||||
}
|
||||
const cacheMap = this._cacheMap.get(key);
|
||||
const cacheKeys = cacheMap.cacheKeys;
|
||||
cacheKeys.forEach((key2) => {
|
||||
this._cache.delete(key2);
|
||||
});
|
||||
cacheMap.keys.forEach((key2) => {
|
||||
this._cacheMap.delete(key2);
|
||||
});
|
||||
}
|
||||
/** All loader parsers registered */
|
||||
get parsers() {
|
||||
return this._parsers;
|
||||
}
|
||||
}
|
||||
const Cache = new CacheClass();
|
||||
|
||||
exports.Cache = Cache;
|
||||
//# sourceMappingURL=Cache.js.map
|
1
node_modules/pixi.js/lib/assets/cache/Cache.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/cache/Cache.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
99
node_modules/pixi.js/lib/assets/cache/Cache.mjs
generated
vendored
Normal file
99
node_modules/pixi.js/lib/assets/cache/Cache.mjs
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
import { warn } from '../../utils/logging/warn.mjs';
|
||||
import { convertToList } from '../utils/convertToList.mjs';
|
||||
|
||||
"use strict";
|
||||
class CacheClass {
|
||||
constructor() {
|
||||
this._parsers = [];
|
||||
this._cache = /* @__PURE__ */ new Map();
|
||||
this._cacheMap = /* @__PURE__ */ new Map();
|
||||
}
|
||||
/** Clear all entries. */
|
||||
reset() {
|
||||
this._cacheMap.clear();
|
||||
this._cache.clear();
|
||||
}
|
||||
/**
|
||||
* Check if the key exists
|
||||
* @param key - The key to check
|
||||
*/
|
||||
has(key) {
|
||||
return this._cache.has(key);
|
||||
}
|
||||
/**
|
||||
* Fetch entry by key
|
||||
* @param key - The key of the entry to get
|
||||
*/
|
||||
get(key) {
|
||||
const result = this._cache.get(key);
|
||||
if (!result) {
|
||||
warn(`[Assets] Asset id ${key} was not found in the Cache`);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Set a value by key or keys name
|
||||
* @param key - The key or keys to set
|
||||
* @param value - The value to store in the cache or from which cacheable assets will be derived.
|
||||
*/
|
||||
set(key, value) {
|
||||
const keys = convertToList(key);
|
||||
let cacheableAssets;
|
||||
for (let i = 0; i < this.parsers.length; i++) {
|
||||
const parser = this.parsers[i];
|
||||
if (parser.test(value)) {
|
||||
cacheableAssets = parser.getCacheableAssets(keys, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
const cacheableMap = new Map(Object.entries(cacheableAssets || {}));
|
||||
if (!cacheableAssets) {
|
||||
keys.forEach((key2) => {
|
||||
cacheableMap.set(key2, value);
|
||||
});
|
||||
}
|
||||
const cacheKeys = [...cacheableMap.keys()];
|
||||
const cachedAssets = {
|
||||
cacheKeys,
|
||||
keys
|
||||
};
|
||||
keys.forEach((key2) => {
|
||||
this._cacheMap.set(key2, cachedAssets);
|
||||
});
|
||||
cacheKeys.forEach((key2) => {
|
||||
const val = cacheableAssets ? cacheableAssets[key2] : value;
|
||||
if (this._cache.has(key2) && this._cache.get(key2) !== val) {
|
||||
warn("[Cache] already has key:", key2);
|
||||
}
|
||||
this._cache.set(key2, cacheableMap.get(key2));
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Remove entry by key
|
||||
*
|
||||
* This function will also remove any associated alias from the cache also.
|
||||
* @param key - The key of the entry to remove
|
||||
*/
|
||||
remove(key) {
|
||||
if (!this._cacheMap.has(key)) {
|
||||
warn(`[Assets] Asset id ${key} was not found in the Cache`);
|
||||
return;
|
||||
}
|
||||
const cacheMap = this._cacheMap.get(key);
|
||||
const cacheKeys = cacheMap.cacheKeys;
|
||||
cacheKeys.forEach((key2) => {
|
||||
this._cache.delete(key2);
|
||||
});
|
||||
cacheMap.keys.forEach((key2) => {
|
||||
this._cacheMap.delete(key2);
|
||||
});
|
||||
}
|
||||
/** All loader parsers registered */
|
||||
get parsers() {
|
||||
return this._parsers;
|
||||
}
|
||||
}
|
||||
const Cache = new CacheClass();
|
||||
|
||||
export { Cache };
|
||||
//# sourceMappingURL=Cache.mjs.map
|
1
node_modules/pixi.js/lib/assets/cache/Cache.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/cache/Cache.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
32
node_modules/pixi.js/lib/assets/cache/CacheParser.d.ts
generated
vendored
Normal file
32
node_modules/pixi.js/lib/assets/cache/CacheParser.d.ts
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import type { ExtensionMetadata } from '../../extensions/Extensions';
|
||||
/**
|
||||
* For every asset that is cached, it will call the parsers test function
|
||||
* the flow is as follows:
|
||||
*
|
||||
* 1. `cacheParser.test()`: Test the asset.
|
||||
* 2. `cacheParser.getCacheableAssets()`: If the test passes call the getCacheableAssets function with the asset
|
||||
*
|
||||
* Useful if you want to add more than just a raw asset to the cache
|
||||
* (for example a spritesheet will want to make all its sub textures easily accessible in the cache)
|
||||
* @memberof assets
|
||||
*/
|
||||
export interface CacheParser<T = any> {
|
||||
/** The extension type of this cache parser */
|
||||
extension?: ExtensionMetadata;
|
||||
/** A config to adjust the parser */
|
||||
config?: Record<string, any>;
|
||||
/**
|
||||
* Gets called by the cache when a dev caches an asset
|
||||
* @param asset - the asset to test
|
||||
*/
|
||||
test: (asset: T) => boolean;
|
||||
/**
|
||||
* If the test passes, this function is called to get the cacheable assets
|
||||
* an example may be that a spritesheet object will return all the sub textures it has so they can
|
||||
* be cached.
|
||||
* @param keys - The keys to cache the assets under
|
||||
* @param asset - The asset to get the cacheable assets from
|
||||
* @returns A key-value pair of cacheable assets
|
||||
*/
|
||||
getCacheableAssets: (keys: string[], asset: T) => Record<string, any>;
|
||||
}
|
4
node_modules/pixi.js/lib/assets/cache/CacheParser.js
generated
vendored
Normal file
4
node_modules/pixi.js/lib/assets/cache/CacheParser.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
//# sourceMappingURL=CacheParser.js.map
|
1
node_modules/pixi.js/lib/assets/cache/CacheParser.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/cache/CacheParser.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"CacheParser.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
2
node_modules/pixi.js/lib/assets/cache/CacheParser.mjs
generated
vendored
Normal file
2
node_modules/pixi.js/lib/assets/cache/CacheParser.mjs
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
//# sourceMappingURL=CacheParser.mjs.map
|
1
node_modules/pixi.js/lib/assets/cache/CacheParser.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/cache/CacheParser.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"CacheParser.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
7
node_modules/pixi.js/lib/assets/cache/parsers/cacheTextureArray.d.ts
generated
vendored
Normal file
7
node_modules/pixi.js/lib/assets/cache/parsers/cacheTextureArray.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import { Texture } from '../../../rendering/renderers/shared/texture/Texture';
|
||||
import type { CacheParser } from '../CacheParser';
|
||||
/**
|
||||
* Returns an object of textures from an array of textures to be cached
|
||||
* @memberof assets
|
||||
*/
|
||||
export declare const cacheTextureArray: CacheParser<Texture[]>;
|
25
node_modules/pixi.js/lib/assets/cache/parsers/cacheTextureArray.js
generated
vendored
Normal file
25
node_modules/pixi.js/lib/assets/cache/parsers/cacheTextureArray.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
|
||||
var Extensions = require('../../../extensions/Extensions.js');
|
||||
var Texture = require('../../../rendering/renderers/shared/texture/Texture.js');
|
||||
|
||||
"use strict";
|
||||
const cacheTextureArray = {
|
||||
extension: {
|
||||
type: Extensions.ExtensionType.CacheParser,
|
||||
name: "cacheTextureArray"
|
||||
},
|
||||
test: (asset) => Array.isArray(asset) && asset.every((t) => t instanceof Texture.Texture),
|
||||
getCacheableAssets: (keys, asset) => {
|
||||
const out = {};
|
||||
keys.forEach((key) => {
|
||||
asset.forEach((item, i) => {
|
||||
out[key + (i === 0 ? "" : i + 1)] = item;
|
||||
});
|
||||
});
|
||||
return out;
|
||||
}
|
||||
};
|
||||
|
||||
exports.cacheTextureArray = cacheTextureArray;
|
||||
//# sourceMappingURL=cacheTextureArray.js.map
|
1
node_modules/pixi.js/lib/assets/cache/parsers/cacheTextureArray.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/cache/parsers/cacheTextureArray.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"cacheTextureArray.js","sources":["../../../../src/assets/cache/parsers/cacheTextureArray.ts"],"sourcesContent":["import { ExtensionType } from '../../../extensions/Extensions';\nimport { Texture } from '../../../rendering/renderers/shared/texture/Texture';\n\nimport type { CacheParser } from '../CacheParser';\n\n/**\n * Returns an object of textures from an array of textures to be cached\n * @memberof assets\n */\nexport const cacheTextureArray: CacheParser<Texture[]> = {\n extension: {\n type: ExtensionType.CacheParser,\n name: 'cacheTextureArray',\n },\n\n test: (asset: any[]) => Array.isArray(asset) && asset.every((t) => t instanceof Texture),\n\n getCacheableAssets: (keys: string[], asset: Texture[]) =>\n {\n const out: Record<string, Texture> = {};\n\n keys.forEach((key: string) =>\n {\n asset.forEach((item: Texture, i: number) =>\n {\n out[key + (i === 0 ? '' : i + 1)] = item;\n });\n });\n\n return out;\n }\n};\n"],"names":["ExtensionType","Texture"],"mappings":";;;;;;AASO,MAAM,iBAA4C,GAAA;AAAA,EACrD,SAAW,EAAA;AAAA,IACP,MAAMA,wBAAc,CAAA,WAAA;AAAA,IACpB,IAAM,EAAA,mBAAA;AAAA,GACV;AAAA,EAEA,IAAM,EAAA,CAAC,KAAiB,KAAA,KAAA,CAAM,OAAQ,CAAA,KAAK,CAAK,IAAA,KAAA,CAAM,KAAM,CAAA,CAAC,CAAM,KAAA,CAAA,YAAaC,eAAO,CAAA;AAAA,EAEvF,kBAAA,EAAoB,CAAC,IAAA,EAAgB,KACrC,KAAA;AACI,IAAA,MAAM,MAA+B,EAAC,CAAA;AAEtC,IAAK,IAAA,CAAA,OAAA,CAAQ,CAAC,GACd,KAAA;AACI,MAAM,KAAA,CAAA,OAAA,CAAQ,CAAC,IAAA,EAAe,CAC9B,KAAA;AACI,QAAA,GAAA,CAAI,OAAO,CAAM,KAAA,CAAA,GAAI,EAAK,GAAA,CAAA,GAAI,EAAE,CAAI,GAAA,IAAA,CAAA;AAAA,OACvC,CAAA,CAAA;AAAA,KACJ,CAAA,CAAA;AAED,IAAO,OAAA,GAAA,CAAA;AAAA,GACX;AACJ;;;;"}
|
23
node_modules/pixi.js/lib/assets/cache/parsers/cacheTextureArray.mjs
generated
vendored
Normal file
23
node_modules/pixi.js/lib/assets/cache/parsers/cacheTextureArray.mjs
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import { ExtensionType } from '../../../extensions/Extensions.mjs';
|
||||
import { Texture } from '../../../rendering/renderers/shared/texture/Texture.mjs';
|
||||
|
||||
"use strict";
|
||||
const cacheTextureArray = {
|
||||
extension: {
|
||||
type: ExtensionType.CacheParser,
|
||||
name: "cacheTextureArray"
|
||||
},
|
||||
test: (asset) => Array.isArray(asset) && asset.every((t) => t instanceof Texture),
|
||||
getCacheableAssets: (keys, asset) => {
|
||||
const out = {};
|
||||
keys.forEach((key) => {
|
||||
asset.forEach((item, i) => {
|
||||
out[key + (i === 0 ? "" : i + 1)] = item;
|
||||
});
|
||||
});
|
||||
return out;
|
||||
}
|
||||
};
|
||||
|
||||
export { cacheTextureArray };
|
||||
//# sourceMappingURL=cacheTextureArray.mjs.map
|
1
node_modules/pixi.js/lib/assets/cache/parsers/cacheTextureArray.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/cache/parsers/cacheTextureArray.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"cacheTextureArray.mjs","sources":["../../../../src/assets/cache/parsers/cacheTextureArray.ts"],"sourcesContent":["import { ExtensionType } from '../../../extensions/Extensions';\nimport { Texture } from '../../../rendering/renderers/shared/texture/Texture';\n\nimport type { CacheParser } from '../CacheParser';\n\n/**\n * Returns an object of textures from an array of textures to be cached\n * @memberof assets\n */\nexport const cacheTextureArray: CacheParser<Texture[]> = {\n extension: {\n type: ExtensionType.CacheParser,\n name: 'cacheTextureArray',\n },\n\n test: (asset: any[]) => Array.isArray(asset) && asset.every((t) => t instanceof Texture),\n\n getCacheableAssets: (keys: string[], asset: Texture[]) =>\n {\n const out: Record<string, Texture> = {};\n\n keys.forEach((key: string) =>\n {\n asset.forEach((item: Texture, i: number) =>\n {\n out[key + (i === 0 ? '' : i + 1)] = item;\n });\n });\n\n return out;\n }\n};\n"],"names":[],"mappings":";;;;AASO,MAAM,iBAA4C,GAAA;AAAA,EACrD,SAAW,EAAA;AAAA,IACP,MAAM,aAAc,CAAA,WAAA;AAAA,IACpB,IAAM,EAAA,mBAAA;AAAA,GACV;AAAA,EAEA,IAAM,EAAA,CAAC,KAAiB,KAAA,KAAA,CAAM,OAAQ,CAAA,KAAK,CAAK,IAAA,KAAA,CAAM,KAAM,CAAA,CAAC,CAAM,KAAA,CAAA,YAAa,OAAO,CAAA;AAAA,EAEvF,kBAAA,EAAoB,CAAC,IAAA,EAAgB,KACrC,KAAA;AACI,IAAA,MAAM,MAA+B,EAAC,CAAA;AAEtC,IAAK,IAAA,CAAA,OAAA,CAAQ,CAAC,GACd,KAAA;AACI,MAAM,KAAA,CAAA,OAAA,CAAQ,CAAC,IAAA,EAAe,CAC9B,KAAA;AACI,QAAA,GAAA,CAAI,OAAO,CAAM,KAAA,CAAA,GAAI,EAAK,GAAA,CAAA,GAAI,EAAE,CAAI,GAAA,IAAA,CAAA;AAAA,OACvC,CAAA,CAAA;AAAA,KACJ,CAAA,CAAA;AAED,IAAO,OAAA,GAAA,CAAA;AAAA,GACX;AACJ;;;;"}
|
6
node_modules/pixi.js/lib/assets/detections/parsers/detectAvif.d.ts
generated
vendored
Normal file
6
node_modules/pixi.js/lib/assets/detections/parsers/detectAvif.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { FormatDetectionParser } from '../types';
|
||||
/**
|
||||
* Detects if the browser supports the AVIF image format.
|
||||
* @memberof assets
|
||||
*/
|
||||
export declare const detectAvif: FormatDetectionParser;
|
21
node_modules/pixi.js/lib/assets/detections/parsers/detectAvif.js
generated
vendored
Normal file
21
node_modules/pixi.js/lib/assets/detections/parsers/detectAvif.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
var Extensions = require('../../../extensions/Extensions.js');
|
||||
var testImageFormat = require('../utils/testImageFormat.js');
|
||||
|
||||
"use strict";
|
||||
const detectAvif = {
|
||||
extension: {
|
||||
type: Extensions.ExtensionType.DetectionParser,
|
||||
priority: 1
|
||||
},
|
||||
test: async () => testImageFormat.testImageFormat(
|
||||
// eslint-disable-next-line max-len
|
||||
"data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="
|
||||
),
|
||||
add: async (formats) => [...formats, "avif"],
|
||||
remove: async (formats) => formats.filter((f) => f !== "avif")
|
||||
};
|
||||
|
||||
exports.detectAvif = detectAvif;
|
||||
//# sourceMappingURL=detectAvif.js.map
|
1
node_modules/pixi.js/lib/assets/detections/parsers/detectAvif.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/detections/parsers/detectAvif.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"detectAvif.js","sources":["../../../../src/assets/detections/parsers/detectAvif.ts"],"sourcesContent":["import { ExtensionType } from '../../../extensions/Extensions';\nimport { testImageFormat } from '../utils/testImageFormat';\n\nimport type { FormatDetectionParser } from '../types';\n\n/**\n * Detects if the browser supports the AVIF image format.\n * @memberof assets\n */\nexport const detectAvif: FormatDetectionParser = {\n extension: {\n type: ExtensionType.DetectionParser,\n priority: 1,\n },\n test: async (): Promise<boolean> => testImageFormat(\n // eslint-disable-next-line max-len\n 'data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A='\n ),\n add: async (formats) => [...formats, 'avif'],\n remove: async (formats) => formats.filter((f) => f !== 'avif'),\n};\n"],"names":["ExtensionType","testImageFormat"],"mappings":";;;;;;AASO,MAAM,UAAoC,GAAA;AAAA,EAC7C,SAAW,EAAA;AAAA,IACP,MAAMA,wBAAc,CAAA,eAAA;AAAA,IACpB,QAAU,EAAA,CAAA;AAAA,GACd;AAAA,EACA,MAAM,YAA8BC,+BAAA;AAAA;AAAA,IAEhC,ybAAA;AAAA,GACJ;AAAA,EACA,KAAK,OAAO,OAAA,KAAY,CAAC,GAAG,SAAS,MAAM,CAAA;AAAA,EAC3C,MAAA,EAAQ,OAAO,OAAY,KAAA,OAAA,CAAQ,OAAO,CAAC,CAAA,KAAM,MAAM,MAAM,CAAA;AACjE;;;;"}
|
19
node_modules/pixi.js/lib/assets/detections/parsers/detectAvif.mjs
generated
vendored
Normal file
19
node_modules/pixi.js/lib/assets/detections/parsers/detectAvif.mjs
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import { ExtensionType } from '../../../extensions/Extensions.mjs';
|
||||
import { testImageFormat } from '../utils/testImageFormat.mjs';
|
||||
|
||||
"use strict";
|
||||
const detectAvif = {
|
||||
extension: {
|
||||
type: ExtensionType.DetectionParser,
|
||||
priority: 1
|
||||
},
|
||||
test: async () => testImageFormat(
|
||||
// eslint-disable-next-line max-len
|
||||
"data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="
|
||||
),
|
||||
add: async (formats) => [...formats, "avif"],
|
||||
remove: async (formats) => formats.filter((f) => f !== "avif")
|
||||
};
|
||||
|
||||
export { detectAvif };
|
||||
//# sourceMappingURL=detectAvif.mjs.map
|
1
node_modules/pixi.js/lib/assets/detections/parsers/detectAvif.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/detections/parsers/detectAvif.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"detectAvif.mjs","sources":["../../../../src/assets/detections/parsers/detectAvif.ts"],"sourcesContent":["import { ExtensionType } from '../../../extensions/Extensions';\nimport { testImageFormat } from '../utils/testImageFormat';\n\nimport type { FormatDetectionParser } from '../types';\n\n/**\n * Detects if the browser supports the AVIF image format.\n * @memberof assets\n */\nexport const detectAvif: FormatDetectionParser = {\n extension: {\n type: ExtensionType.DetectionParser,\n priority: 1,\n },\n test: async (): Promise<boolean> => testImageFormat(\n // eslint-disable-next-line max-len\n 'data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A='\n ),\n add: async (formats) => [...formats, 'avif'],\n remove: async (formats) => formats.filter((f) => f !== 'avif'),\n};\n"],"names":[],"mappings":";;;;AASO,MAAM,UAAoC,GAAA;AAAA,EAC7C,SAAW,EAAA;AAAA,IACP,MAAM,aAAc,CAAA,eAAA;AAAA,IACpB,QAAU,EAAA,CAAA;AAAA,GACd;AAAA,EACA,MAAM,YAA8B,eAAA;AAAA;AAAA,IAEhC,ybAAA;AAAA,GACJ;AAAA,EACA,KAAK,OAAO,OAAA,KAAY,CAAC,GAAG,SAAS,MAAM,CAAA;AAAA,EAC3C,MAAA,EAAQ,OAAO,OAAY,KAAA,OAAA,CAAQ,OAAO,CAAC,CAAA,KAAM,MAAM,MAAM,CAAA;AACjE;;;;"}
|
6
node_modules/pixi.js/lib/assets/detections/parsers/detectDefaults.d.ts
generated
vendored
Normal file
6
node_modules/pixi.js/lib/assets/detections/parsers/detectDefaults.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { FormatDetectionParser } from '../types';
|
||||
/**
|
||||
* Adds some default image formats to the detection parser
|
||||
* @memberof assets
|
||||
*/
|
||||
export declare const detectDefaults: FormatDetectionParser;
|
18
node_modules/pixi.js/lib/assets/detections/parsers/detectDefaults.js
generated
vendored
Normal file
18
node_modules/pixi.js/lib/assets/detections/parsers/detectDefaults.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var Extensions = require('../../../extensions/Extensions.js');
|
||||
|
||||
"use strict";
|
||||
const imageFormats = ["png", "jpg", "jpeg"];
|
||||
const detectDefaults = {
|
||||
extension: {
|
||||
type: Extensions.ExtensionType.DetectionParser,
|
||||
priority: -1
|
||||
},
|
||||
test: () => Promise.resolve(true),
|
||||
add: async (formats) => [...formats, ...imageFormats],
|
||||
remove: async (formats) => formats.filter((f) => !imageFormats.includes(f))
|
||||
};
|
||||
|
||||
exports.detectDefaults = detectDefaults;
|
||||
//# sourceMappingURL=detectDefaults.js.map
|
1
node_modules/pixi.js/lib/assets/detections/parsers/detectDefaults.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/detections/parsers/detectDefaults.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"detectDefaults.js","sources":["../../../../src/assets/detections/parsers/detectDefaults.ts"],"sourcesContent":["import { ExtensionType } from '../../../extensions/Extensions';\n\nimport type { FormatDetectionParser } from '../types';\n\nconst imageFormats = ['png', 'jpg', 'jpeg'];\n\n/**\n * Adds some default image formats to the detection parser\n * @memberof assets\n */\nexport const detectDefaults = {\n extension: {\n type: ExtensionType.DetectionParser,\n priority: -1,\n },\n test: (): Promise<boolean> => Promise.resolve(true),\n add: async (formats) => [...formats, ...imageFormats],\n remove: async (formats) => formats.filter((f) => !imageFormats.includes(f)),\n} as FormatDetectionParser;\n"],"names":["ExtensionType"],"mappings":";;;;;AAIA,MAAM,YAAe,GAAA,CAAC,KAAO,EAAA,KAAA,EAAO,MAAM,CAAA,CAAA;AAMnC,MAAM,cAAiB,GAAA;AAAA,EAC1B,SAAW,EAAA;AAAA,IACP,MAAMA,wBAAc,CAAA,eAAA;AAAA,IACpB,QAAU,EAAA,CAAA,CAAA;AAAA,GACd;AAAA,EACA,IAAM,EAAA,MAAwB,OAAQ,CAAA,OAAA,CAAQ,IAAI,CAAA;AAAA,EAClD,KAAK,OAAO,OAAA,KAAY,CAAC,GAAG,OAAA,EAAS,GAAG,YAAY,CAAA;AAAA,EACpD,MAAA,EAAQ,OAAO,OAAA,KAAY,OAAQ,CAAA,MAAA,CAAO,CAAC,CAAA,KAAM,CAAC,YAAA,CAAa,QAAS,CAAA,CAAC,CAAC,CAAA;AAC9E;;;;"}
|
16
node_modules/pixi.js/lib/assets/detections/parsers/detectDefaults.mjs
generated
vendored
Normal file
16
node_modules/pixi.js/lib/assets/detections/parsers/detectDefaults.mjs
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import { ExtensionType } from '../../../extensions/Extensions.mjs';
|
||||
|
||||
"use strict";
|
||||
const imageFormats = ["png", "jpg", "jpeg"];
|
||||
const detectDefaults = {
|
||||
extension: {
|
||||
type: ExtensionType.DetectionParser,
|
||||
priority: -1
|
||||
},
|
||||
test: () => Promise.resolve(true),
|
||||
add: async (formats) => [...formats, ...imageFormats],
|
||||
remove: async (formats) => formats.filter((f) => !imageFormats.includes(f))
|
||||
};
|
||||
|
||||
export { detectDefaults };
|
||||
//# sourceMappingURL=detectDefaults.mjs.map
|
1
node_modules/pixi.js/lib/assets/detections/parsers/detectDefaults.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/detections/parsers/detectDefaults.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"detectDefaults.mjs","sources":["../../../../src/assets/detections/parsers/detectDefaults.ts"],"sourcesContent":["import { ExtensionType } from '../../../extensions/Extensions';\n\nimport type { FormatDetectionParser } from '../types';\n\nconst imageFormats = ['png', 'jpg', 'jpeg'];\n\n/**\n * Adds some default image formats to the detection parser\n * @memberof assets\n */\nexport const detectDefaults = {\n extension: {\n type: ExtensionType.DetectionParser,\n priority: -1,\n },\n test: (): Promise<boolean> => Promise.resolve(true),\n add: async (formats) => [...formats, ...imageFormats],\n remove: async (formats) => formats.filter((f) => !imageFormats.includes(f)),\n} as FormatDetectionParser;\n"],"names":[],"mappings":";;;AAIA,MAAM,YAAe,GAAA,CAAC,KAAO,EAAA,KAAA,EAAO,MAAM,CAAA,CAAA;AAMnC,MAAM,cAAiB,GAAA;AAAA,EAC1B,SAAW,EAAA;AAAA,IACP,MAAM,aAAc,CAAA,eAAA;AAAA,IACpB,QAAU,EAAA,CAAA,CAAA;AAAA,GACd;AAAA,EACA,IAAM,EAAA,MAAwB,OAAQ,CAAA,OAAA,CAAQ,IAAI,CAAA;AAAA,EAClD,KAAK,OAAO,OAAA,KAAY,CAAC,GAAG,OAAA,EAAS,GAAG,YAAY,CAAA;AAAA,EACpD,MAAA,EAAQ,OAAO,OAAA,KAAY,OAAQ,CAAA,MAAA,CAAO,CAAC,CAAA,KAAM,CAAC,YAAA,CAAa,QAAS,CAAA,CAAC,CAAC,CAAA;AAC9E;;;;"}
|
6
node_modules/pixi.js/lib/assets/detections/parsers/detectMp4.d.ts
generated
vendored
Normal file
6
node_modules/pixi.js/lib/assets/detections/parsers/detectMp4.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { FormatDetectionParser } from '../types';
|
||||
/**
|
||||
* Detects if the browser supports the MP4 video format.
|
||||
* @memberof assets
|
||||
*/
|
||||
export declare const detectMp4: FormatDetectionParser;
|
18
node_modules/pixi.js/lib/assets/detections/parsers/detectMp4.js
generated
vendored
Normal file
18
node_modules/pixi.js/lib/assets/detections/parsers/detectMp4.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var Extensions = require('../../../extensions/Extensions.js');
|
||||
var testVideoFormat = require('../utils/testVideoFormat.js');
|
||||
|
||||
"use strict";
|
||||
const detectMp4 = {
|
||||
extension: {
|
||||
type: Extensions.ExtensionType.DetectionParser,
|
||||
priority: 0
|
||||
},
|
||||
test: async () => testVideoFormat.testVideoFormat("video/mp4"),
|
||||
add: async (formats) => [...formats, "mp4", "m4v"],
|
||||
remove: async (formats) => formats.filter((f) => f !== "mp4" && f !== "m4v")
|
||||
};
|
||||
|
||||
exports.detectMp4 = detectMp4;
|
||||
//# sourceMappingURL=detectMp4.js.map
|
1
node_modules/pixi.js/lib/assets/detections/parsers/detectMp4.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/detections/parsers/detectMp4.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"detectMp4.js","sources":["../../../../src/assets/detections/parsers/detectMp4.ts"],"sourcesContent":["import { ExtensionType } from '../../../extensions/Extensions';\nimport { testVideoFormat } from '../utils/testVideoFormat';\n\nimport type { FormatDetectionParser } from '../types';\n\n/**\n * Detects if the browser supports the MP4 video format.\n * @memberof assets\n */\nexport const detectMp4 = {\n extension: {\n type: ExtensionType.DetectionParser,\n priority: 0,\n },\n test: async (): Promise<boolean> => testVideoFormat('video/mp4'),\n add: async (formats) => [...formats, 'mp4', 'm4v'],\n remove: async (formats) => formats.filter((f) => f !== 'mp4' && f !== 'm4v'),\n} as FormatDetectionParser;\n"],"names":["ExtensionType","testVideoFormat"],"mappings":";;;;;;AASO,MAAM,SAAY,GAAA;AAAA,EACrB,SAAW,EAAA;AAAA,IACP,MAAMA,wBAAc,CAAA,eAAA;AAAA,IACpB,QAAU,EAAA,CAAA;AAAA,GACd;AAAA,EACA,IAAA,EAAM,YAA8BC,+BAAA,CAAgB,WAAW,CAAA;AAAA,EAC/D,KAAK,OAAO,OAAA,KAAY,CAAC,GAAG,OAAA,EAAS,OAAO,KAAK,CAAA;AAAA,EACjD,MAAA,EAAQ,OAAO,OAAA,KAAY,OAAQ,CAAA,MAAA,CAAO,CAAC,CAAM,KAAA,CAAA,KAAM,KAAS,IAAA,CAAA,KAAM,KAAK,CAAA;AAC/E;;;;"}
|
16
node_modules/pixi.js/lib/assets/detections/parsers/detectMp4.mjs
generated
vendored
Normal file
16
node_modules/pixi.js/lib/assets/detections/parsers/detectMp4.mjs
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import { ExtensionType } from '../../../extensions/Extensions.mjs';
|
||||
import { testVideoFormat } from '../utils/testVideoFormat.mjs';
|
||||
|
||||
"use strict";
|
||||
const detectMp4 = {
|
||||
extension: {
|
||||
type: ExtensionType.DetectionParser,
|
||||
priority: 0
|
||||
},
|
||||
test: async () => testVideoFormat("video/mp4"),
|
||||
add: async (formats) => [...formats, "mp4", "m4v"],
|
||||
remove: async (formats) => formats.filter((f) => f !== "mp4" && f !== "m4v")
|
||||
};
|
||||
|
||||
export { detectMp4 };
|
||||
//# sourceMappingURL=detectMp4.mjs.map
|
1
node_modules/pixi.js/lib/assets/detections/parsers/detectMp4.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/detections/parsers/detectMp4.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"detectMp4.mjs","sources":["../../../../src/assets/detections/parsers/detectMp4.ts"],"sourcesContent":["import { ExtensionType } from '../../../extensions/Extensions';\nimport { testVideoFormat } from '../utils/testVideoFormat';\n\nimport type { FormatDetectionParser } from '../types';\n\n/**\n * Detects if the browser supports the MP4 video format.\n * @memberof assets\n */\nexport const detectMp4 = {\n extension: {\n type: ExtensionType.DetectionParser,\n priority: 0,\n },\n test: async (): Promise<boolean> => testVideoFormat('video/mp4'),\n add: async (formats) => [...formats, 'mp4', 'm4v'],\n remove: async (formats) => formats.filter((f) => f !== 'mp4' && f !== 'm4v'),\n} as FormatDetectionParser;\n"],"names":[],"mappings":";;;;AASO,MAAM,SAAY,GAAA;AAAA,EACrB,SAAW,EAAA;AAAA,IACP,MAAM,aAAc,CAAA,eAAA;AAAA,IACpB,QAAU,EAAA,CAAA;AAAA,GACd;AAAA,EACA,IAAA,EAAM,YAA8B,eAAA,CAAgB,WAAW,CAAA;AAAA,EAC/D,KAAK,OAAO,OAAA,KAAY,CAAC,GAAG,OAAA,EAAS,OAAO,KAAK,CAAA;AAAA,EACjD,MAAA,EAAQ,OAAO,OAAA,KAAY,OAAQ,CAAA,MAAA,CAAO,CAAC,CAAM,KAAA,CAAA,KAAM,KAAS,IAAA,CAAA,KAAM,KAAK,CAAA;AAC/E;;;;"}
|
6
node_modules/pixi.js/lib/assets/detections/parsers/detectOgv.d.ts
generated
vendored
Normal file
6
node_modules/pixi.js/lib/assets/detections/parsers/detectOgv.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { FormatDetectionParser } from '../types';
|
||||
/**
|
||||
* Detects if the browser supports the OGV video format.
|
||||
* @memberof assets
|
||||
*/
|
||||
export declare const detectOgv: FormatDetectionParser;
|
18
node_modules/pixi.js/lib/assets/detections/parsers/detectOgv.js
generated
vendored
Normal file
18
node_modules/pixi.js/lib/assets/detections/parsers/detectOgv.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var Extensions = require('../../../extensions/Extensions.js');
|
||||
var testVideoFormat = require('../utils/testVideoFormat.js');
|
||||
|
||||
"use strict";
|
||||
const detectOgv = {
|
||||
extension: {
|
||||
type: Extensions.ExtensionType.DetectionParser,
|
||||
priority: 0
|
||||
},
|
||||
test: async () => testVideoFormat.testVideoFormat("video/ogg"),
|
||||
add: async (formats) => [...formats, "ogv"],
|
||||
remove: async (formats) => formats.filter((f) => f !== "ogv")
|
||||
};
|
||||
|
||||
exports.detectOgv = detectOgv;
|
||||
//# sourceMappingURL=detectOgv.js.map
|
1
node_modules/pixi.js/lib/assets/detections/parsers/detectOgv.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/detections/parsers/detectOgv.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"detectOgv.js","sources":["../../../../src/assets/detections/parsers/detectOgv.ts"],"sourcesContent":["import { ExtensionType } from '../../../extensions/Extensions';\nimport { testVideoFormat } from '../utils/testVideoFormat';\n\nimport type { FormatDetectionParser } from '../types';\n\n/**\n * Detects if the browser supports the OGV video format.\n * @memberof assets\n */\nexport const detectOgv = {\n extension: {\n type: ExtensionType.DetectionParser,\n priority: 0,\n },\n test: async (): Promise<boolean> => testVideoFormat('video/ogg'),\n add: async (formats) => [...formats, 'ogv'],\n remove: async (formats) => formats.filter((f) => f !== 'ogv'),\n} as FormatDetectionParser;\n"],"names":["ExtensionType","testVideoFormat"],"mappings":";;;;;;AASO,MAAM,SAAY,GAAA;AAAA,EACrB,SAAW,EAAA;AAAA,IACP,MAAMA,wBAAc,CAAA,eAAA;AAAA,IACpB,QAAU,EAAA,CAAA;AAAA,GACd;AAAA,EACA,IAAA,EAAM,YAA8BC,+BAAA,CAAgB,WAAW,CAAA;AAAA,EAC/D,KAAK,OAAO,OAAA,KAAY,CAAC,GAAG,SAAS,KAAK,CAAA;AAAA,EAC1C,MAAA,EAAQ,OAAO,OAAY,KAAA,OAAA,CAAQ,OAAO,CAAC,CAAA,KAAM,MAAM,KAAK,CAAA;AAChE;;;;"}
|
16
node_modules/pixi.js/lib/assets/detections/parsers/detectOgv.mjs
generated
vendored
Normal file
16
node_modules/pixi.js/lib/assets/detections/parsers/detectOgv.mjs
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import { ExtensionType } from '../../../extensions/Extensions.mjs';
|
||||
import { testVideoFormat } from '../utils/testVideoFormat.mjs';
|
||||
|
||||
"use strict";
|
||||
const detectOgv = {
|
||||
extension: {
|
||||
type: ExtensionType.DetectionParser,
|
||||
priority: 0
|
||||
},
|
||||
test: async () => testVideoFormat("video/ogg"),
|
||||
add: async (formats) => [...formats, "ogv"],
|
||||
remove: async (formats) => formats.filter((f) => f !== "ogv")
|
||||
};
|
||||
|
||||
export { detectOgv };
|
||||
//# sourceMappingURL=detectOgv.mjs.map
|
1
node_modules/pixi.js/lib/assets/detections/parsers/detectOgv.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/detections/parsers/detectOgv.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"detectOgv.mjs","sources":["../../../../src/assets/detections/parsers/detectOgv.ts"],"sourcesContent":["import { ExtensionType } from '../../../extensions/Extensions';\nimport { testVideoFormat } from '../utils/testVideoFormat';\n\nimport type { FormatDetectionParser } from '../types';\n\n/**\n * Detects if the browser supports the OGV video format.\n * @memberof assets\n */\nexport const detectOgv = {\n extension: {\n type: ExtensionType.DetectionParser,\n priority: 0,\n },\n test: async (): Promise<boolean> => testVideoFormat('video/ogg'),\n add: async (formats) => [...formats, 'ogv'],\n remove: async (formats) => formats.filter((f) => f !== 'ogv'),\n} as FormatDetectionParser;\n"],"names":[],"mappings":";;;;AASO,MAAM,SAAY,GAAA;AAAA,EACrB,SAAW,EAAA;AAAA,IACP,MAAM,aAAc,CAAA,eAAA;AAAA,IACpB,QAAU,EAAA,CAAA;AAAA,GACd;AAAA,EACA,IAAA,EAAM,YAA8B,eAAA,CAAgB,WAAW,CAAA;AAAA,EAC/D,KAAK,OAAO,OAAA,KAAY,CAAC,GAAG,SAAS,KAAK,CAAA;AAAA,EAC1C,MAAA,EAAQ,OAAO,OAAY,KAAA,OAAA,CAAQ,OAAO,CAAC,CAAA,KAAM,MAAM,KAAK,CAAA;AAChE;;;;"}
|
6
node_modules/pixi.js/lib/assets/detections/parsers/detectWebm.d.ts
generated
vendored
Normal file
6
node_modules/pixi.js/lib/assets/detections/parsers/detectWebm.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { FormatDetectionParser } from '../types';
|
||||
/**
|
||||
* Detects if the browser supports the WebM video format.
|
||||
* @memberof assets
|
||||
*/
|
||||
export declare const detectWebm: FormatDetectionParser;
|
18
node_modules/pixi.js/lib/assets/detections/parsers/detectWebm.js
generated
vendored
Normal file
18
node_modules/pixi.js/lib/assets/detections/parsers/detectWebm.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var Extensions = require('../../../extensions/Extensions.js');
|
||||
var testVideoFormat = require('../utils/testVideoFormat.js');
|
||||
|
||||
"use strict";
|
||||
const detectWebm = {
|
||||
extension: {
|
||||
type: Extensions.ExtensionType.DetectionParser,
|
||||
priority: 0
|
||||
},
|
||||
test: async () => testVideoFormat.testVideoFormat("video/webm"),
|
||||
add: async (formats) => [...formats, "webm"],
|
||||
remove: async (formats) => formats.filter((f) => f !== "webm")
|
||||
};
|
||||
|
||||
exports.detectWebm = detectWebm;
|
||||
//# sourceMappingURL=detectWebm.js.map
|
1
node_modules/pixi.js/lib/assets/detections/parsers/detectWebm.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/detections/parsers/detectWebm.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"detectWebm.js","sources":["../../../../src/assets/detections/parsers/detectWebm.ts"],"sourcesContent":["import { ExtensionType } from '../../../extensions/Extensions';\nimport { testVideoFormat } from '../utils/testVideoFormat';\n\nimport type { FormatDetectionParser } from '../types';\n\n/**\n * Detects if the browser supports the WebM video format.\n * @memberof assets\n */\nexport const detectWebm = {\n extension: {\n type: ExtensionType.DetectionParser,\n priority: 0,\n },\n test: async (): Promise<boolean> => testVideoFormat('video/webm'),\n add: async (formats) => [...formats, 'webm'],\n remove: async (formats) => formats.filter((f) => f !== 'webm'),\n} as FormatDetectionParser;\n"],"names":["ExtensionType","testVideoFormat"],"mappings":";;;;;;AASO,MAAM,UAAa,GAAA;AAAA,EACtB,SAAW,EAAA;AAAA,IACP,MAAMA,wBAAc,CAAA,eAAA;AAAA,IACpB,QAAU,EAAA,CAAA;AAAA,GACd;AAAA,EACA,IAAA,EAAM,YAA8BC,+BAAA,CAAgB,YAAY,CAAA;AAAA,EAChE,KAAK,OAAO,OAAA,KAAY,CAAC,GAAG,SAAS,MAAM,CAAA;AAAA,EAC3C,MAAA,EAAQ,OAAO,OAAY,KAAA,OAAA,CAAQ,OAAO,CAAC,CAAA,KAAM,MAAM,MAAM,CAAA;AACjE;;;;"}
|
16
node_modules/pixi.js/lib/assets/detections/parsers/detectWebm.mjs
generated
vendored
Normal file
16
node_modules/pixi.js/lib/assets/detections/parsers/detectWebm.mjs
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import { ExtensionType } from '../../../extensions/Extensions.mjs';
|
||||
import { testVideoFormat } from '../utils/testVideoFormat.mjs';
|
||||
|
||||
"use strict";
|
||||
const detectWebm = {
|
||||
extension: {
|
||||
type: ExtensionType.DetectionParser,
|
||||
priority: 0
|
||||
},
|
||||
test: async () => testVideoFormat("video/webm"),
|
||||
add: async (formats) => [...formats, "webm"],
|
||||
remove: async (formats) => formats.filter((f) => f !== "webm")
|
||||
};
|
||||
|
||||
export { detectWebm };
|
||||
//# sourceMappingURL=detectWebm.mjs.map
|
1
node_modules/pixi.js/lib/assets/detections/parsers/detectWebm.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/detections/parsers/detectWebm.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"detectWebm.mjs","sources":["../../../../src/assets/detections/parsers/detectWebm.ts"],"sourcesContent":["import { ExtensionType } from '../../../extensions/Extensions';\nimport { testVideoFormat } from '../utils/testVideoFormat';\n\nimport type { FormatDetectionParser } from '../types';\n\n/**\n * Detects if the browser supports the WebM video format.\n * @memberof assets\n */\nexport const detectWebm = {\n extension: {\n type: ExtensionType.DetectionParser,\n priority: 0,\n },\n test: async (): Promise<boolean> => testVideoFormat('video/webm'),\n add: async (formats) => [...formats, 'webm'],\n remove: async (formats) => formats.filter((f) => f !== 'webm'),\n} as FormatDetectionParser;\n"],"names":[],"mappings":";;;;AASO,MAAM,UAAa,GAAA;AAAA,EACtB,SAAW,EAAA;AAAA,IACP,MAAM,aAAc,CAAA,eAAA;AAAA,IACpB,QAAU,EAAA,CAAA;AAAA,GACd;AAAA,EACA,IAAA,EAAM,YAA8B,eAAA,CAAgB,YAAY,CAAA;AAAA,EAChE,KAAK,OAAO,OAAA,KAAY,CAAC,GAAG,SAAS,MAAM,CAAA;AAAA,EAC3C,MAAA,EAAQ,OAAO,OAAY,KAAA,OAAA,CAAQ,OAAO,CAAC,CAAA,KAAM,MAAM,MAAM,CAAA;AACjE;;;;"}
|
6
node_modules/pixi.js/lib/assets/detections/parsers/detectWebp.d.ts
generated
vendored
Normal file
6
node_modules/pixi.js/lib/assets/detections/parsers/detectWebp.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { FormatDetectionParser } from '../types';
|
||||
/**
|
||||
* Detects if the browser supports the WebP image format.
|
||||
* @memberof assets
|
||||
*/
|
||||
export declare const detectWebp: FormatDetectionParser;
|
20
node_modules/pixi.js/lib/assets/detections/parsers/detectWebp.js
generated
vendored
Normal file
20
node_modules/pixi.js/lib/assets/detections/parsers/detectWebp.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
var Extensions = require('../../../extensions/Extensions.js');
|
||||
var testImageFormat = require('../utils/testImageFormat.js');
|
||||
|
||||
"use strict";
|
||||
const detectWebp = {
|
||||
extension: {
|
||||
type: Extensions.ExtensionType.DetectionParser,
|
||||
priority: 0
|
||||
},
|
||||
test: async () => testImageFormat.testImageFormat(
|
||||
"data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="
|
||||
),
|
||||
add: async (formats) => [...formats, "webp"],
|
||||
remove: async (formats) => formats.filter((f) => f !== "webp")
|
||||
};
|
||||
|
||||
exports.detectWebp = detectWebp;
|
||||
//# sourceMappingURL=detectWebp.js.map
|
1
node_modules/pixi.js/lib/assets/detections/parsers/detectWebp.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/detections/parsers/detectWebp.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"detectWebp.js","sources":["../../../../src/assets/detections/parsers/detectWebp.ts"],"sourcesContent":["import { ExtensionType } from '../../../extensions/Extensions';\nimport { testImageFormat } from '../utils/testImageFormat';\n\nimport type { FormatDetectionParser } from '../types';\n\n/**\n * Detects if the browser supports the WebP image format.\n * @memberof assets\n */\nexport const detectWebp = {\n extension: {\n type: ExtensionType.DetectionParser,\n priority: 0,\n },\n test: async (): Promise<boolean> => testImageFormat(\n 'data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA='\n ),\n add: async (formats) => [...formats, 'webp'],\n remove: async (formats) => formats.filter((f) => f !== 'webp'),\n} as FormatDetectionParser;\n"],"names":["ExtensionType","testImageFormat"],"mappings":";;;;;;AASO,MAAM,UAAa,GAAA;AAAA,EACtB,SAAW,EAAA;AAAA,IACP,MAAMA,wBAAc,CAAA,eAAA;AAAA,IACpB,QAAU,EAAA,CAAA;AAAA,GACd;AAAA,EACA,MAAM,YAA8BC,+BAAA;AAAA,IAChC,6EAAA;AAAA,GACJ;AAAA,EACA,KAAK,OAAO,OAAA,KAAY,CAAC,GAAG,SAAS,MAAM,CAAA;AAAA,EAC3C,MAAA,EAAQ,OAAO,OAAY,KAAA,OAAA,CAAQ,OAAO,CAAC,CAAA,KAAM,MAAM,MAAM,CAAA;AACjE;;;;"}
|
18
node_modules/pixi.js/lib/assets/detections/parsers/detectWebp.mjs
generated
vendored
Normal file
18
node_modules/pixi.js/lib/assets/detections/parsers/detectWebp.mjs
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { ExtensionType } from '../../../extensions/Extensions.mjs';
|
||||
import { testImageFormat } from '../utils/testImageFormat.mjs';
|
||||
|
||||
"use strict";
|
||||
const detectWebp = {
|
||||
extension: {
|
||||
type: ExtensionType.DetectionParser,
|
||||
priority: 0
|
||||
},
|
||||
test: async () => testImageFormat(
|
||||
"data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="
|
||||
),
|
||||
add: async (formats) => [...formats, "webp"],
|
||||
remove: async (formats) => formats.filter((f) => f !== "webp")
|
||||
};
|
||||
|
||||
export { detectWebp };
|
||||
//# sourceMappingURL=detectWebp.mjs.map
|
1
node_modules/pixi.js/lib/assets/detections/parsers/detectWebp.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/detections/parsers/detectWebp.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"detectWebp.mjs","sources":["../../../../src/assets/detections/parsers/detectWebp.ts"],"sourcesContent":["import { ExtensionType } from '../../../extensions/Extensions';\nimport { testImageFormat } from '../utils/testImageFormat';\n\nimport type { FormatDetectionParser } from '../types';\n\n/**\n * Detects if the browser supports the WebP image format.\n * @memberof assets\n */\nexport const detectWebp = {\n extension: {\n type: ExtensionType.DetectionParser,\n priority: 0,\n },\n test: async (): Promise<boolean> => testImageFormat(\n 'data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA='\n ),\n add: async (formats) => [...formats, 'webp'],\n remove: async (formats) => formats.filter((f) => f !== 'webp'),\n} as FormatDetectionParser;\n"],"names":[],"mappings":";;;;AASO,MAAM,UAAa,GAAA;AAAA,EACtB,SAAW,EAAA;AAAA,IACP,MAAM,aAAc,CAAA,eAAA;AAAA,IACpB,QAAU,EAAA,CAAA;AAAA,GACd;AAAA,EACA,MAAM,YAA8B,eAAA;AAAA,IAChC,6EAAA;AAAA,GACJ;AAAA,EACA,KAAK,OAAO,OAAA,KAAY,CAAC,GAAG,SAAS,MAAM,CAAA;AAAA,EAC3C,MAAA,EAAQ,OAAO,OAAY,KAAA,OAAA,CAAQ,OAAO,CAAC,CAAA,KAAM,MAAM,MAAM,CAAA;AACjE;;;;"}
|
24
node_modules/pixi.js/lib/assets/detections/types.d.ts
generated
vendored
Normal file
24
node_modules/pixi.js/lib/assets/detections/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
import type { ExtensionMetadata } from '../../extensions/Extensions';
|
||||
/**
|
||||
* Format detection is useful for detecting feature support on the current platform.
|
||||
* @memberof assets
|
||||
*/
|
||||
export interface FormatDetectionParser {
|
||||
/** Should be ExtensionType.DetectionParser */
|
||||
extension?: ExtensionMetadata;
|
||||
/** Browser/platform feature detection supported if return true */
|
||||
test: () => Promise<boolean>;
|
||||
/**
|
||||
* Add formats (file extensions) to the existing list of formats.
|
||||
* Return an new array with added formats, do not mutate the formats argument.
|
||||
* @returns {Promise<string[]>} - Promise that resolves to the new formats array.
|
||||
*/
|
||||
add: (formats: string[]) => Promise<string[]>;
|
||||
/**
|
||||
* Remove formats (file extensions) from the list of supported formats.
|
||||
* This is used when uninstalling this DetectionParser.
|
||||
* Return an new array with filtered formats, do not mutate the formats argument.
|
||||
* @returns {Promise<string[]>} - Promise that resolves to the new formats array.
|
||||
*/
|
||||
remove: (formats: string[]) => Promise<string[]>;
|
||||
}
|
4
node_modules/pixi.js/lib/assets/detections/types.js
generated
vendored
Normal file
4
node_modules/pixi.js/lib/assets/detections/types.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
//# sourceMappingURL=types.js.map
|
1
node_modules/pixi.js/lib/assets/detections/types.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/detections/types.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"types.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
2
node_modules/pixi.js/lib/assets/detections/types.mjs
generated
vendored
Normal file
2
node_modules/pixi.js/lib/assets/detections/types.mjs
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
//# sourceMappingURL=types.mjs.map
|
1
node_modules/pixi.js/lib/assets/detections/types.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/detections/types.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"types.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
1
node_modules/pixi.js/lib/assets/detections/utils/testImageFormat.d.ts
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/detections/utils/testImageFormat.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function testImageFormat(imageData: string): Promise<boolean>;
|
30
node_modules/pixi.js/lib/assets/detections/utils/testImageFormat.js
generated
vendored
Normal file
30
node_modules/pixi.js/lib/assets/detections/utils/testImageFormat.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
async function testImageFormat(imageData) {
|
||||
if ("Image" in globalThis) {
|
||||
return new Promise((resolve) => {
|
||||
const image = new Image();
|
||||
image.onload = () => {
|
||||
resolve(true);
|
||||
};
|
||||
image.onerror = () => {
|
||||
resolve(false);
|
||||
};
|
||||
image.src = imageData;
|
||||
});
|
||||
}
|
||||
if ("createImageBitmap" in globalThis && "fetch" in globalThis) {
|
||||
try {
|
||||
const blob = await (await fetch(imageData)).blob();
|
||||
await createImageBitmap(blob);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
exports.testImageFormat = testImageFormat;
|
||||
//# sourceMappingURL=testImageFormat.js.map
|
1
node_modules/pixi.js/lib/assets/detections/utils/testImageFormat.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/detections/utils/testImageFormat.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"testImageFormat.js","sources":["../../../../src/assets/detections/utils/testImageFormat.ts"],"sourcesContent":["export async function testImageFormat(imageData: string): Promise<boolean>\n{\n // Some browsers currently do not support createImageBitmap with Blob, so new Image() is preferred when exist.\n // See https://caniuse.com/createimagebitmap for more information.\n\n if ('Image' in globalThis)\n {\n return new Promise<boolean>((resolve) =>\n {\n const image = new Image();\n\n image.onload = () =>\n {\n resolve(true);\n };\n image.onerror = () =>\n {\n resolve(false);\n };\n image.src = imageData;\n });\n }\n\n if ('createImageBitmap' in globalThis && 'fetch' in globalThis)\n {\n try\n {\n const blob = await (await fetch(imageData)).blob();\n\n await createImageBitmap(blob);\n }\n catch (e)\n {\n return false;\n }\n\n return true;\n }\n\n return false;\n}\n"],"names":[],"mappings":";;;AAAA,eAAsB,gBAAgB,SACtC,EAAA;AAII,EAAA,IAAI,WAAW,UACf,EAAA;AACI,IAAO,OAAA,IAAI,OAAiB,CAAA,CAAC,OAC7B,KAAA;AACI,MAAM,MAAA,KAAA,GAAQ,IAAI,KAAM,EAAA,CAAA;AAExB,MAAA,KAAA,CAAM,SAAS,MACf;AACI,QAAA,OAAA,CAAQ,IAAI,CAAA,CAAA;AAAA,OAChB,CAAA;AACA,MAAA,KAAA,CAAM,UAAU,MAChB;AACI,QAAA,OAAA,CAAQ,KAAK,CAAA,CAAA;AAAA,OACjB,CAAA;AACA,MAAA,KAAA,CAAM,GAAM,GAAA,SAAA,CAAA;AAAA,KACf,CAAA,CAAA;AAAA,GACL;AAEA,EAAI,IAAA,mBAAA,IAAuB,UAAc,IAAA,OAAA,IAAW,UACpD,EAAA;AACI,IACA,IAAA;AACI,MAAA,MAAM,OAAO,MAAO,CAAA,MAAM,KAAM,CAAA,SAAS,GAAG,IAAK,EAAA,CAAA;AAEjD,MAAA,MAAM,kBAAkB,IAAI,CAAA,CAAA;AAAA,aAEzB,CACP,EAAA;AACI,MAAO,OAAA,KAAA,CAAA;AAAA,KACX;AAEA,IAAO,OAAA,IAAA,CAAA;AAAA,GACX;AAEA,EAAO,OAAA,KAAA,CAAA;AACX;;;;"}
|
28
node_modules/pixi.js/lib/assets/detections/utils/testImageFormat.mjs
generated
vendored
Normal file
28
node_modules/pixi.js/lib/assets/detections/utils/testImageFormat.mjs
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
async function testImageFormat(imageData) {
|
||||
if ("Image" in globalThis) {
|
||||
return new Promise((resolve) => {
|
||||
const image = new Image();
|
||||
image.onload = () => {
|
||||
resolve(true);
|
||||
};
|
||||
image.onerror = () => {
|
||||
resolve(false);
|
||||
};
|
||||
image.src = imageData;
|
||||
});
|
||||
}
|
||||
if ("createImageBitmap" in globalThis && "fetch" in globalThis) {
|
||||
try {
|
||||
const blob = await (await fetch(imageData)).blob();
|
||||
await createImageBitmap(blob);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export { testImageFormat };
|
||||
//# sourceMappingURL=testImageFormat.mjs.map
|
1
node_modules/pixi.js/lib/assets/detections/utils/testImageFormat.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/detections/utils/testImageFormat.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"testImageFormat.mjs","sources":["../../../../src/assets/detections/utils/testImageFormat.ts"],"sourcesContent":["export async function testImageFormat(imageData: string): Promise<boolean>\n{\n // Some browsers currently do not support createImageBitmap with Blob, so new Image() is preferred when exist.\n // See https://caniuse.com/createimagebitmap for more information.\n\n if ('Image' in globalThis)\n {\n return new Promise<boolean>((resolve) =>\n {\n const image = new Image();\n\n image.onload = () =>\n {\n resolve(true);\n };\n image.onerror = () =>\n {\n resolve(false);\n };\n image.src = imageData;\n });\n }\n\n if ('createImageBitmap' in globalThis && 'fetch' in globalThis)\n {\n try\n {\n const blob = await (await fetch(imageData)).blob();\n\n await createImageBitmap(blob);\n }\n catch (e)\n {\n return false;\n }\n\n return true;\n }\n\n return false;\n}\n"],"names":[],"mappings":";AAAA,eAAsB,gBAAgB,SACtC,EAAA;AAII,EAAA,IAAI,WAAW,UACf,EAAA;AACI,IAAO,OAAA,IAAI,OAAiB,CAAA,CAAC,OAC7B,KAAA;AACI,MAAM,MAAA,KAAA,GAAQ,IAAI,KAAM,EAAA,CAAA;AAExB,MAAA,KAAA,CAAM,SAAS,MACf;AACI,QAAA,OAAA,CAAQ,IAAI,CAAA,CAAA;AAAA,OAChB,CAAA;AACA,MAAA,KAAA,CAAM,UAAU,MAChB;AACI,QAAA,OAAA,CAAQ,KAAK,CAAA,CAAA;AAAA,OACjB,CAAA;AACA,MAAA,KAAA,CAAM,GAAM,GAAA,SAAA,CAAA;AAAA,KACf,CAAA,CAAA;AAAA,GACL;AAEA,EAAI,IAAA,mBAAA,IAAuB,UAAc,IAAA,OAAA,IAAW,UACpD,EAAA;AACI,IACA,IAAA;AACI,MAAA,MAAM,OAAO,MAAO,CAAA,MAAM,KAAM,CAAA,SAAS,GAAG,IAAK,EAAA,CAAA;AAEjD,MAAA,MAAM,kBAAkB,IAAI,CAAA,CAAA;AAAA,aAEzB,CACP,EAAA;AACI,MAAO,OAAA,KAAA,CAAA;AAAA,KACX;AAEA,IAAO,OAAA,IAAA,CAAA;AAAA,GACX;AAEA,EAAO,OAAA,KAAA,CAAA;AACX;;;;"}
|
1
node_modules/pixi.js/lib/assets/detections/utils/testVideoFormat.d.ts
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/detections/utils/testVideoFormat.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function testVideoFormat(mimeType: string): boolean;
|
14
node_modules/pixi.js/lib/assets/detections/utils/testVideoFormat.js
generated
vendored
Normal file
14
node_modules/pixi.js/lib/assets/detections/utils/testVideoFormat.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
const inWorker = "WorkerGlobalScope" in globalThis && globalThis instanceof globalThis.WorkerGlobalScope;
|
||||
function testVideoFormat(mimeType) {
|
||||
if (inWorker) {
|
||||
return false;
|
||||
}
|
||||
const video = document.createElement("video");
|
||||
return video.canPlayType(mimeType) !== "";
|
||||
}
|
||||
|
||||
exports.testVideoFormat = testVideoFormat;
|
||||
//# sourceMappingURL=testVideoFormat.js.map
|
1
node_modules/pixi.js/lib/assets/detections/utils/testVideoFormat.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/detections/utils/testVideoFormat.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"testVideoFormat.js","sources":["../../../../src/assets/detections/utils/testVideoFormat.ts"],"sourcesContent":["const inWorker = 'WorkerGlobalScope' in globalThis\n && globalThis instanceof (globalThis as any).WorkerGlobalScope;\n\nexport function testVideoFormat(mimeType: string): boolean\n{\n if (inWorker)\n {\n return false;\n }\n\n const video = document.createElement('video');\n\n return video.canPlayType(mimeType) !== '';\n}\n"],"names":[],"mappings":";;;AAAA,MAAM,QAAW,GAAA,mBAAA,IAAuB,UACjC,IAAA,UAAA,YAAuB,UAAmB,CAAA,iBAAA,CAAA;AAE1C,SAAS,gBAAgB,QAChC,EAAA;AACI,EAAA,IAAI,QACJ,EAAA;AACI,IAAO,OAAA,KAAA,CAAA;AAAA,GACX;AAEA,EAAM,MAAA,KAAA,GAAQ,QAAS,CAAA,aAAA,CAAc,OAAO,CAAA,CAAA;AAE5C,EAAO,OAAA,KAAA,CAAM,WAAY,CAAA,QAAQ,CAAM,KAAA,EAAA,CAAA;AAC3C;;;;"}
|
12
node_modules/pixi.js/lib/assets/detections/utils/testVideoFormat.mjs
generated
vendored
Normal file
12
node_modules/pixi.js/lib/assets/detections/utils/testVideoFormat.mjs
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
const inWorker = "WorkerGlobalScope" in globalThis && globalThis instanceof globalThis.WorkerGlobalScope;
|
||||
function testVideoFormat(mimeType) {
|
||||
if (inWorker) {
|
||||
return false;
|
||||
}
|
||||
const video = document.createElement("video");
|
||||
return video.canPlayType(mimeType) !== "";
|
||||
}
|
||||
|
||||
export { testVideoFormat };
|
||||
//# sourceMappingURL=testVideoFormat.mjs.map
|
1
node_modules/pixi.js/lib/assets/detections/utils/testVideoFormat.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/detections/utils/testVideoFormat.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"testVideoFormat.mjs","sources":["../../../../src/assets/detections/utils/testVideoFormat.ts"],"sourcesContent":["const inWorker = 'WorkerGlobalScope' in globalThis\n && globalThis instanceof (globalThis as any).WorkerGlobalScope;\n\nexport function testVideoFormat(mimeType: string): boolean\n{\n if (inWorker)\n {\n return false;\n }\n\n const video = document.createElement('video');\n\n return video.canPlayType(mimeType) !== '';\n}\n"],"names":[],"mappings":";AAAA,MAAM,QAAW,GAAA,mBAAA,IAAuB,UACjC,IAAA,UAAA,YAAuB,UAAmB,CAAA,iBAAA,CAAA;AAE1C,SAAS,gBAAgB,QAChC,EAAA;AACI,EAAA,IAAI,QACJ,EAAA;AACI,IAAO,OAAA,KAAA,CAAA;AAAA,GACX;AAEA,EAAM,MAAA,KAAA,GAAQ,QAAS,CAAA,aAAA,CAAc,OAAO,CAAA,CAAA;AAE5C,EAAO,OAAA,KAAA,CAAM,WAAY,CAAA,QAAQ,CAAM,KAAA,EAAA,CAAA;AAC3C;;;;"}
|
37
node_modules/pixi.js/lib/assets/index.d.ts
generated
vendored
Normal file
37
node_modules/pixi.js/lib/assets/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
export * from './AssetExtension';
|
||||
export * from './Assets';
|
||||
export * from './BackgroundLoader';
|
||||
export * from './cache/Cache';
|
||||
export * from './cache/CacheParser';
|
||||
export * from './cache/parsers/cacheTextureArray';
|
||||
export * from './detections/parsers/detectAvif';
|
||||
export * from './detections/parsers/detectDefaults';
|
||||
export * from './detections/parsers/detectMp4';
|
||||
export * from './detections/parsers/detectOgv';
|
||||
export * from './detections/parsers/detectWebm';
|
||||
export * from './detections/parsers/detectWebp';
|
||||
export * from './detections/types';
|
||||
export * from './detections/utils/testImageFormat';
|
||||
export * from './detections/utils/testVideoFormat';
|
||||
export * from './loader/Loader';
|
||||
export * from './loader/parsers/LoaderParser';
|
||||
export * from './loader/parsers/loadJson';
|
||||
export * from './loader/parsers/loadTxt';
|
||||
export * from './loader/parsers/loadWebFont';
|
||||
export * from './loader/parsers/textures/loadSVG';
|
||||
export * from './loader/parsers/textures/loadTextures';
|
||||
export * from './loader/parsers/textures/loadVideoTextures';
|
||||
export * from './loader/parsers/textures/utils/createTexture';
|
||||
export * from './loader/types';
|
||||
export * from './loader/workers/WorkerManager';
|
||||
export * from './resolver/parsers/resolveJsonUrl';
|
||||
export * from './resolver/parsers/resolveTextureUrl';
|
||||
export * from './resolver/Resolver';
|
||||
export * from './resolver/types';
|
||||
export * from './types';
|
||||
export * from './utils/checkDataUrl';
|
||||
export * from './utils/checkExtension';
|
||||
export * from './utils/convertToList';
|
||||
export * from './utils/copySearchParams';
|
||||
export * from './utils/createStringVariations';
|
||||
export * from './utils/isSingleItem';
|
81
node_modules/pixi.js/lib/assets/index.js
generated
vendored
Normal file
81
node_modules/pixi.js/lib/assets/index.js
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
'use strict';
|
||||
|
||||
require('./AssetExtension.js');
|
||||
var Assets = require('./Assets.js');
|
||||
var BackgroundLoader = require('./BackgroundLoader.js');
|
||||
var Cache = require('./cache/Cache.js');
|
||||
require('./cache/CacheParser.js');
|
||||
var cacheTextureArray = require('./cache/parsers/cacheTextureArray.js');
|
||||
var detectAvif = require('./detections/parsers/detectAvif.js');
|
||||
var detectDefaults = require('./detections/parsers/detectDefaults.js');
|
||||
var detectMp4 = require('./detections/parsers/detectMp4.js');
|
||||
var detectOgv = require('./detections/parsers/detectOgv.js');
|
||||
var detectWebm = require('./detections/parsers/detectWebm.js');
|
||||
var detectWebp = require('./detections/parsers/detectWebp.js');
|
||||
require('./detections/types.js');
|
||||
var testImageFormat = require('./detections/utils/testImageFormat.js');
|
||||
var testVideoFormat = require('./detections/utils/testVideoFormat.js');
|
||||
var Loader = require('./loader/Loader.js');
|
||||
var LoaderParser = require('./loader/parsers/LoaderParser.js');
|
||||
var loadJson = require('./loader/parsers/loadJson.js');
|
||||
var loadTxt = require('./loader/parsers/loadTxt.js');
|
||||
var loadWebFont = require('./loader/parsers/loadWebFont.js');
|
||||
var loadSVG = require('./loader/parsers/textures/loadSVG.js');
|
||||
var loadTextures = require('./loader/parsers/textures/loadTextures.js');
|
||||
var loadVideoTextures = require('./loader/parsers/textures/loadVideoTextures.js');
|
||||
var createTexture = require('./loader/parsers/textures/utils/createTexture.js');
|
||||
require('./loader/types.js');
|
||||
var WorkerManager = require('./loader/workers/WorkerManager.js');
|
||||
var resolveJsonUrl = require('./resolver/parsers/resolveJsonUrl.js');
|
||||
var resolveTextureUrl = require('./resolver/parsers/resolveTextureUrl.js');
|
||||
var Resolver = require('./resolver/Resolver.js');
|
||||
require('./resolver/types.js');
|
||||
require('./types.js');
|
||||
var checkDataUrl = require('./utils/checkDataUrl.js');
|
||||
var checkExtension = require('./utils/checkExtension.js');
|
||||
var convertToList = require('./utils/convertToList.js');
|
||||
var copySearchParams = require('./utils/copySearchParams.js');
|
||||
var createStringVariations = require('./utils/createStringVariations.js');
|
||||
var isSingleItem = require('./utils/isSingleItem.js');
|
||||
|
||||
"use strict";
|
||||
|
||||
exports.Assets = Assets.Assets;
|
||||
exports.AssetsClass = Assets.AssetsClass;
|
||||
exports.BackgroundLoader = BackgroundLoader.BackgroundLoader;
|
||||
exports.Cache = Cache.Cache;
|
||||
exports.cacheTextureArray = cacheTextureArray.cacheTextureArray;
|
||||
exports.detectAvif = detectAvif.detectAvif;
|
||||
exports.detectDefaults = detectDefaults.detectDefaults;
|
||||
exports.detectMp4 = detectMp4.detectMp4;
|
||||
exports.detectOgv = detectOgv.detectOgv;
|
||||
exports.detectWebm = detectWebm.detectWebm;
|
||||
exports.detectWebp = detectWebp.detectWebp;
|
||||
exports.testImageFormat = testImageFormat.testImageFormat;
|
||||
exports.testVideoFormat = testVideoFormat.testVideoFormat;
|
||||
exports.Loader = Loader.Loader;
|
||||
exports.LoaderParserPriority = LoaderParser.LoaderParserPriority;
|
||||
exports.loadJson = loadJson.loadJson;
|
||||
exports.loadTxt = loadTxt.loadTxt;
|
||||
exports.getFontFamilyName = loadWebFont.getFontFamilyName;
|
||||
exports.loadWebFont = loadWebFont.loadWebFont;
|
||||
exports.loadSvg = loadSVG.loadSvg;
|
||||
exports.loadImageBitmap = loadTextures.loadImageBitmap;
|
||||
exports.loadTextures = loadTextures.loadTextures;
|
||||
exports.crossOrigin = loadVideoTextures.crossOrigin;
|
||||
exports.determineCrossOrigin = loadVideoTextures.determineCrossOrigin;
|
||||
exports.loadVideoTextures = loadVideoTextures.loadVideoTextures;
|
||||
exports.preloadVideo = loadVideoTextures.preloadVideo;
|
||||
exports.createTexture = createTexture.createTexture;
|
||||
exports.WorkerManager = WorkerManager.WorkerManager;
|
||||
exports.resolveJsonUrl = resolveJsonUrl.resolveJsonUrl;
|
||||
exports.resolveTextureUrl = resolveTextureUrl.resolveTextureUrl;
|
||||
exports.Resolver = Resolver.Resolver;
|
||||
exports.getUrlExtension = Resolver.getUrlExtension;
|
||||
exports.checkDataUrl = checkDataUrl.checkDataUrl;
|
||||
exports.checkExtension = checkExtension.checkExtension;
|
||||
exports.convertToList = convertToList.convertToList;
|
||||
exports.copySearchParams = copySearchParams.copySearchParams;
|
||||
exports.createStringVariations = createStringVariations.createStringVariations;
|
||||
exports.isSingleItem = isSingleItem.isSingleItem;
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/pixi.js/lib/assets/index.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
40
node_modules/pixi.js/lib/assets/index.mjs
generated
vendored
Normal file
40
node_modules/pixi.js/lib/assets/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
import './AssetExtension.mjs';
|
||||
export { Assets, AssetsClass } from './Assets.mjs';
|
||||
export { BackgroundLoader } from './BackgroundLoader.mjs';
|
||||
export { Cache } from './cache/Cache.mjs';
|
||||
import './cache/CacheParser.mjs';
|
||||
export { cacheTextureArray } from './cache/parsers/cacheTextureArray.mjs';
|
||||
export { detectAvif } from './detections/parsers/detectAvif.mjs';
|
||||
export { detectDefaults } from './detections/parsers/detectDefaults.mjs';
|
||||
export { detectMp4 } from './detections/parsers/detectMp4.mjs';
|
||||
export { detectOgv } from './detections/parsers/detectOgv.mjs';
|
||||
export { detectWebm } from './detections/parsers/detectWebm.mjs';
|
||||
export { detectWebp } from './detections/parsers/detectWebp.mjs';
|
||||
import './detections/types.mjs';
|
||||
export { testImageFormat } from './detections/utils/testImageFormat.mjs';
|
||||
export { testVideoFormat } from './detections/utils/testVideoFormat.mjs';
|
||||
export { Loader } from './loader/Loader.mjs';
|
||||
export { LoaderParserPriority } from './loader/parsers/LoaderParser.mjs';
|
||||
export { loadJson } from './loader/parsers/loadJson.mjs';
|
||||
export { loadTxt } from './loader/parsers/loadTxt.mjs';
|
||||
export { getFontFamilyName, loadWebFont } from './loader/parsers/loadWebFont.mjs';
|
||||
export { loadSvg } from './loader/parsers/textures/loadSVG.mjs';
|
||||
export { loadImageBitmap, loadTextures } from './loader/parsers/textures/loadTextures.mjs';
|
||||
export { crossOrigin, determineCrossOrigin, loadVideoTextures, preloadVideo } from './loader/parsers/textures/loadVideoTextures.mjs';
|
||||
export { createTexture } from './loader/parsers/textures/utils/createTexture.mjs';
|
||||
import './loader/types.mjs';
|
||||
export { WorkerManager } from './loader/workers/WorkerManager.mjs';
|
||||
export { resolveJsonUrl } from './resolver/parsers/resolveJsonUrl.mjs';
|
||||
export { resolveTextureUrl } from './resolver/parsers/resolveTextureUrl.mjs';
|
||||
export { Resolver, getUrlExtension } from './resolver/Resolver.mjs';
|
||||
import './resolver/types.mjs';
|
||||
import './types.mjs';
|
||||
export { checkDataUrl } from './utils/checkDataUrl.mjs';
|
||||
export { checkExtension } from './utils/checkExtension.mjs';
|
||||
export { convertToList } from './utils/convertToList.mjs';
|
||||
export { copySearchParams } from './utils/copySearchParams.mjs';
|
||||
export { createStringVariations } from './utils/createStringVariations.mjs';
|
||||
export { isSingleItem } from './utils/isSingleItem.mjs';
|
||||
|
||||
"use strict";
|
||||
//# sourceMappingURL=index.mjs.map
|
1
node_modules/pixi.js/lib/assets/index.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/index.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
67
node_modules/pixi.js/lib/assets/loader/Loader.d.ts
generated
vendored
Normal file
67
node_modules/pixi.js/lib/assets/loader/Loader.d.ts
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
import type { ResolvedAsset } from '../types';
|
||||
import type { LoaderParser } from './parsers/LoaderParser';
|
||||
import type { PromiseAndParser } from './types';
|
||||
/**
|
||||
* The Loader is responsible for loading all assets, such as images, spritesheets, audio files, etc.
|
||||
* It does not do anything clever with URLs - it just loads stuff!
|
||||
* Behind the scenes all things are cached using promises. This means it's impossible to load an asset more than once.
|
||||
* Through the use of LoaderParsers, the loader can understand how to load any kind of file!
|
||||
*
|
||||
* It is not intended that this class is created by developers - its part of the Asset class
|
||||
* This is the second major system of PixiJS' main Assets class
|
||||
* @memberof assets
|
||||
*/
|
||||
export declare class Loader {
|
||||
private readonly _parsers;
|
||||
private _parserHash;
|
||||
private _parsersValidated;
|
||||
/**
|
||||
* All loader parsers registered
|
||||
* @type {assets.LoaderParser[]}
|
||||
*/
|
||||
parsers: LoaderParser<any, any, Record<string, any>>[];
|
||||
/** Cache loading promises that ae currently active */
|
||||
promiseCache: Record<string, PromiseAndParser>;
|
||||
/** function used for testing */
|
||||
reset(): void;
|
||||
/**
|
||||
* Used internally to generate a promise for the asset to be loaded.
|
||||
* @param url - The URL to be loaded
|
||||
* @param data - any custom additional information relevant to the asset being loaded
|
||||
* @returns - a promise that will resolve to an Asset for example a Texture of a JSON object
|
||||
*/
|
||||
private _getLoadPromiseAndParser;
|
||||
/**
|
||||
* Loads one or more assets using the parsers added to the Loader.
|
||||
* @example
|
||||
* // Single asset:
|
||||
* const asset = await Loader.load('cool.png');
|
||||
* console.log(asset);
|
||||
*
|
||||
* // Multiple assets:
|
||||
* const assets = await Loader.load(['cool.png', 'cooler.png']);
|
||||
* console.log(assets);
|
||||
* @param assetsToLoadIn - urls that you want to load, or a single one!
|
||||
* @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.
|
||||
*/
|
||||
load<T = any>(assetsToLoadIn: string | ResolvedAsset, onProgress?: (progress: number) => void): Promise<T>;
|
||||
load<T = any>(assetsToLoadIn: string[] | ResolvedAsset[], onProgress?: (progress: number) => void): Promise<Record<string, T>>;
|
||||
/**
|
||||
* Unloads one or more assets. Any unloaded assets will be destroyed, freeing up memory for your app.
|
||||
* The parser that created the asset, will be the one that unloads it.
|
||||
* @example
|
||||
* // Single asset:
|
||||
* const asset = await Loader.load('cool.png');
|
||||
*
|
||||
* await Loader.unload('cool.png');
|
||||
*
|
||||
* console.log(asset.destroyed); // true
|
||||
* @param assetsToUnloadIn - urls that you want to unload, or a single one!
|
||||
*/
|
||||
unload(assetsToUnloadIn: string | string[] | ResolvedAsset | ResolvedAsset[]): Promise<void>;
|
||||
/** validates our parsers, right now it only checks for name conflicts but we can add more here as required! */
|
||||
private _validateParsers;
|
||||
}
|
157
node_modules/pixi.js/lib/assets/loader/Loader.js
generated
vendored
Normal file
157
node_modules/pixi.js/lib/assets/loader/Loader.js
generated
vendored
Normal file
@@ -0,0 +1,157 @@
|
||||
'use strict';
|
||||
|
||||
var warn = require('../../utils/logging/warn.js');
|
||||
var path = require('../../utils/path.js');
|
||||
var convertToList = require('../utils/convertToList.js');
|
||||
var isSingleItem = require('../utils/isSingleItem.js');
|
||||
|
||||
"use strict";
|
||||
class Loader {
|
||||
constructor() {
|
||||
this._parsers = [];
|
||||
this._parsersValidated = false;
|
||||
/**
|
||||
* All loader parsers registered
|
||||
* @type {assets.LoaderParser[]}
|
||||
*/
|
||||
this.parsers = new Proxy(this._parsers, {
|
||||
set: (target, key, value) => {
|
||||
this._parsersValidated = false;
|
||||
target[key] = value;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
/** Cache loading promises that ae currently active */
|
||||
this.promiseCache = {};
|
||||
}
|
||||
/** function used for testing */
|
||||
reset() {
|
||||
this._parsersValidated = false;
|
||||
this.promiseCache = {};
|
||||
}
|
||||
/**
|
||||
* Used internally to generate a promise for the asset to be loaded.
|
||||
* @param url - The URL to be loaded
|
||||
* @param data - any custom additional information relevant to the asset being loaded
|
||||
* @returns - a promise that will resolve to an Asset for example a Texture of a JSON object
|
||||
*/
|
||||
_getLoadPromiseAndParser(url, data) {
|
||||
const result = {
|
||||
promise: null,
|
||||
parser: null
|
||||
};
|
||||
result.promise = (async () => {
|
||||
let asset = null;
|
||||
let parser = null;
|
||||
if (data.loadParser) {
|
||||
parser = this._parserHash[data.loadParser];
|
||||
if (!parser) {
|
||||
warn.warn(`[Assets] specified load parser "${data.loadParser}" not found while loading ${url}`);
|
||||
}
|
||||
}
|
||||
if (!parser) {
|
||||
for (let i = 0; i < this.parsers.length; i++) {
|
||||
const parserX = this.parsers[i];
|
||||
if (parserX.load && parserX.test?.(url, data, this)) {
|
||||
parser = parserX;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!parser) {
|
||||
warn.warn(`[Assets] ${url} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
asset = await parser.load(url, data, this);
|
||||
result.parser = parser;
|
||||
for (let i = 0; i < this.parsers.length; i++) {
|
||||
const parser2 = this.parsers[i];
|
||||
if (parser2.parse) {
|
||||
if (parser2.parse && await parser2.testParse?.(asset, data, this)) {
|
||||
asset = await parser2.parse(asset, data, this) || asset;
|
||||
result.parser = parser2;
|
||||
}
|
||||
}
|
||||
}
|
||||
return asset;
|
||||
})();
|
||||
return result;
|
||||
}
|
||||
async load(assetsToLoadIn, onProgress) {
|
||||
if (!this._parsersValidated) {
|
||||
this._validateParsers();
|
||||
}
|
||||
let count = 0;
|
||||
const assets = {};
|
||||
const singleAsset = isSingleItem.isSingleItem(assetsToLoadIn);
|
||||
const assetsToLoad = convertToList.convertToList(assetsToLoadIn, (item) => ({
|
||||
alias: [item],
|
||||
src: item,
|
||||
data: {}
|
||||
}));
|
||||
const total = assetsToLoad.length;
|
||||
const promises = assetsToLoad.map(async (asset) => {
|
||||
const url = path.path.toAbsolute(asset.src);
|
||||
if (!assets[asset.src]) {
|
||||
try {
|
||||
if (!this.promiseCache[url]) {
|
||||
this.promiseCache[url] = this._getLoadPromiseAndParser(url, asset);
|
||||
}
|
||||
assets[asset.src] = await this.promiseCache[url].promise;
|
||||
if (onProgress)
|
||||
onProgress(++count / total);
|
||||
} catch (e) {
|
||||
delete this.promiseCache[url];
|
||||
delete assets[asset.src];
|
||||
throw new Error(`[Loader.load] Failed to load ${url}.
|
||||
${e}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
await Promise.all(promises);
|
||||
return singleAsset ? assets[assetsToLoad[0].src] : assets;
|
||||
}
|
||||
/**
|
||||
* Unloads one or more assets. Any unloaded assets will be destroyed, freeing up memory for your app.
|
||||
* The parser that created the asset, will be the one that unloads it.
|
||||
* @example
|
||||
* // Single asset:
|
||||
* const asset = await Loader.load('cool.png');
|
||||
*
|
||||
* await Loader.unload('cool.png');
|
||||
*
|
||||
* console.log(asset.destroyed); // true
|
||||
* @param assetsToUnloadIn - urls that you want to unload, or a single one!
|
||||
*/
|
||||
async unload(assetsToUnloadIn) {
|
||||
const assetsToUnload = convertToList.convertToList(assetsToUnloadIn, (item) => ({
|
||||
alias: [item],
|
||||
src: item
|
||||
}));
|
||||
const promises = assetsToUnload.map(async (asset) => {
|
||||
const url = path.path.toAbsolute(asset.src);
|
||||
const loadPromise = this.promiseCache[url];
|
||||
if (loadPromise) {
|
||||
const loadedAsset = await loadPromise.promise;
|
||||
delete this.promiseCache[url];
|
||||
await loadPromise.parser?.unload?.(loadedAsset, asset, this);
|
||||
}
|
||||
});
|
||||
await Promise.all(promises);
|
||||
}
|
||||
/** validates our parsers, right now it only checks for name conflicts but we can add more here as required! */
|
||||
_validateParsers() {
|
||||
this._parsersValidated = true;
|
||||
this._parserHash = this._parsers.filter((parser) => parser.name).reduce((hash, parser) => {
|
||||
if (!parser.name) {
|
||||
warn.warn(`[Assets] loadParser should have a name`);
|
||||
} else if (hash[parser.name]) {
|
||||
warn.warn(`[Assets] loadParser name conflict "${parser.name}"`);
|
||||
}
|
||||
return { ...hash, [parser.name]: parser };
|
||||
}, {});
|
||||
}
|
||||
}
|
||||
|
||||
exports.Loader = Loader;
|
||||
//# sourceMappingURL=Loader.js.map
|
1
node_modules/pixi.js/lib/assets/loader/Loader.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/loader/Loader.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
155
node_modules/pixi.js/lib/assets/loader/Loader.mjs
generated
vendored
Normal file
155
node_modules/pixi.js/lib/assets/loader/Loader.mjs
generated
vendored
Normal file
@@ -0,0 +1,155 @@
|
||||
import { warn } from '../../utils/logging/warn.mjs';
|
||||
import { path } from '../../utils/path.mjs';
|
||||
import { convertToList } from '../utils/convertToList.mjs';
|
||||
import { isSingleItem } from '../utils/isSingleItem.mjs';
|
||||
|
||||
"use strict";
|
||||
class Loader {
|
||||
constructor() {
|
||||
this._parsers = [];
|
||||
this._parsersValidated = false;
|
||||
/**
|
||||
* All loader parsers registered
|
||||
* @type {assets.LoaderParser[]}
|
||||
*/
|
||||
this.parsers = new Proxy(this._parsers, {
|
||||
set: (target, key, value) => {
|
||||
this._parsersValidated = false;
|
||||
target[key] = value;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
/** Cache loading promises that ae currently active */
|
||||
this.promiseCache = {};
|
||||
}
|
||||
/** function used for testing */
|
||||
reset() {
|
||||
this._parsersValidated = false;
|
||||
this.promiseCache = {};
|
||||
}
|
||||
/**
|
||||
* Used internally to generate a promise for the asset to be loaded.
|
||||
* @param url - The URL to be loaded
|
||||
* @param data - any custom additional information relevant to the asset being loaded
|
||||
* @returns - a promise that will resolve to an Asset for example a Texture of a JSON object
|
||||
*/
|
||||
_getLoadPromiseAndParser(url, data) {
|
||||
const result = {
|
||||
promise: null,
|
||||
parser: null
|
||||
};
|
||||
result.promise = (async () => {
|
||||
let asset = null;
|
||||
let parser = null;
|
||||
if (data.loadParser) {
|
||||
parser = this._parserHash[data.loadParser];
|
||||
if (!parser) {
|
||||
warn(`[Assets] specified load parser "${data.loadParser}" not found while loading ${url}`);
|
||||
}
|
||||
}
|
||||
if (!parser) {
|
||||
for (let i = 0; i < this.parsers.length; i++) {
|
||||
const parserX = this.parsers[i];
|
||||
if (parserX.load && parserX.test?.(url, data, this)) {
|
||||
parser = parserX;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!parser) {
|
||||
warn(`[Assets] ${url} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
asset = await parser.load(url, data, this);
|
||||
result.parser = parser;
|
||||
for (let i = 0; i < this.parsers.length; i++) {
|
||||
const parser2 = this.parsers[i];
|
||||
if (parser2.parse) {
|
||||
if (parser2.parse && await parser2.testParse?.(asset, data, this)) {
|
||||
asset = await parser2.parse(asset, data, this) || asset;
|
||||
result.parser = parser2;
|
||||
}
|
||||
}
|
||||
}
|
||||
return asset;
|
||||
})();
|
||||
return result;
|
||||
}
|
||||
async load(assetsToLoadIn, onProgress) {
|
||||
if (!this._parsersValidated) {
|
||||
this._validateParsers();
|
||||
}
|
||||
let count = 0;
|
||||
const assets = {};
|
||||
const singleAsset = isSingleItem(assetsToLoadIn);
|
||||
const assetsToLoad = convertToList(assetsToLoadIn, (item) => ({
|
||||
alias: [item],
|
||||
src: item,
|
||||
data: {}
|
||||
}));
|
||||
const total = assetsToLoad.length;
|
||||
const promises = assetsToLoad.map(async (asset) => {
|
||||
const url = path.toAbsolute(asset.src);
|
||||
if (!assets[asset.src]) {
|
||||
try {
|
||||
if (!this.promiseCache[url]) {
|
||||
this.promiseCache[url] = this._getLoadPromiseAndParser(url, asset);
|
||||
}
|
||||
assets[asset.src] = await this.promiseCache[url].promise;
|
||||
if (onProgress)
|
||||
onProgress(++count / total);
|
||||
} catch (e) {
|
||||
delete this.promiseCache[url];
|
||||
delete assets[asset.src];
|
||||
throw new Error(`[Loader.load] Failed to load ${url}.
|
||||
${e}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
await Promise.all(promises);
|
||||
return singleAsset ? assets[assetsToLoad[0].src] : assets;
|
||||
}
|
||||
/**
|
||||
* Unloads one or more assets. Any unloaded assets will be destroyed, freeing up memory for your app.
|
||||
* The parser that created the asset, will be the one that unloads it.
|
||||
* @example
|
||||
* // Single asset:
|
||||
* const asset = await Loader.load('cool.png');
|
||||
*
|
||||
* await Loader.unload('cool.png');
|
||||
*
|
||||
* console.log(asset.destroyed); // true
|
||||
* @param assetsToUnloadIn - urls that you want to unload, or a single one!
|
||||
*/
|
||||
async unload(assetsToUnloadIn) {
|
||||
const assetsToUnload = convertToList(assetsToUnloadIn, (item) => ({
|
||||
alias: [item],
|
||||
src: item
|
||||
}));
|
||||
const promises = assetsToUnload.map(async (asset) => {
|
||||
const url = path.toAbsolute(asset.src);
|
||||
const loadPromise = this.promiseCache[url];
|
||||
if (loadPromise) {
|
||||
const loadedAsset = await loadPromise.promise;
|
||||
delete this.promiseCache[url];
|
||||
await loadPromise.parser?.unload?.(loadedAsset, asset, this);
|
||||
}
|
||||
});
|
||||
await Promise.all(promises);
|
||||
}
|
||||
/** validates our parsers, right now it only checks for name conflicts but we can add more here as required! */
|
||||
_validateParsers() {
|
||||
this._parsersValidated = true;
|
||||
this._parserHash = this._parsers.filter((parser) => parser.name).reduce((hash, parser) => {
|
||||
if (!parser.name) {
|
||||
warn(`[Assets] loadParser should have a name`);
|
||||
} else if (hash[parser.name]) {
|
||||
warn(`[Assets] loadParser name conflict "${parser.name}"`);
|
||||
}
|
||||
return { ...hash, [parser.name]: parser };
|
||||
}, {});
|
||||
}
|
||||
}
|
||||
|
||||
export { Loader };
|
||||
//# sourceMappingURL=Loader.mjs.map
|
1
node_modules/pixi.js/lib/assets/loader/Loader.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/loader/Loader.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
86
node_modules/pixi.js/lib/assets/loader/parsers/LoaderParser.d.ts
generated
vendored
Normal file
86
node_modules/pixi.js/lib/assets/loader/parsers/LoaderParser.d.ts
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
import type { ExtensionMetadata } from '../../../extensions/Extensions';
|
||||
import type { ResolvedAsset } from '../../types';
|
||||
import type { Loader } from '../Loader';
|
||||
/**
|
||||
* The extension priority for loader parsers.
|
||||
* Helpful when managing multiple parsers that share the same extension test.
|
||||
* The higher priority parsers will be checked first.
|
||||
* @enum {number}
|
||||
*/
|
||||
export declare enum LoaderParserPriority {
|
||||
/** Generic parsers: txt, json, webfonts */
|
||||
Low = 0,
|
||||
/** PixiJS assets with generic extensions: spritesheets, bitmapfonts */
|
||||
Normal = 1,
|
||||
/** Specific texture types: svg, png, ktx, dds, basis */
|
||||
High = 2
|
||||
}
|
||||
/** A more verbose version of the LoaderParser, allowing you to set the loaded, parsed, and unloaded asset separately */
|
||||
export interface LoaderParserAdvanced<ASSET = any, PARSED_ASSET = ASSET, UNLOAD_ASSET = ASSET, META_DATA = any, CONFIG = Record<string, any>> {
|
||||
/** Should be ExtensionType.LoaderParser */
|
||||
extension?: ExtensionMetadata;
|
||||
/** A config to adjust the parser */
|
||||
config?: CONFIG;
|
||||
/** The name of the parser (this can be used when specifying loadParser in a ResolvedAsset) */
|
||||
name: string;
|
||||
/**
|
||||
* Each URL to load will be tested here,
|
||||
* if the test is passed the assets are loaded using the load function below.
|
||||
* Good place to test for things like file extensions!
|
||||
* @param url - The URL to test
|
||||
* @param resolvedAsset - Any custom additional information relevant to the asset being loaded
|
||||
* @param loader - The loader instance
|
||||
*/
|
||||
test?: (url: string, resolvedAsset?: ResolvedAsset<META_DATA>, loader?: Loader) => boolean;
|
||||
/**
|
||||
* This is the promise that loads the URL provided
|
||||
* resolves with a loaded asset if returned by the parser.
|
||||
* @param url - The URL to load
|
||||
* @param resolvedAsset - Any custom additional information relevant to the asset being loaded
|
||||
* @param loader - The loader instance
|
||||
*/
|
||||
load?: <T>(url: string, resolvedAsset?: ResolvedAsset<META_DATA>, loader?: Loader) => Promise<ASSET | T>;
|
||||
/**
|
||||
* This function is used to test if the parse function should be run on the asset
|
||||
* If this returns true then parse is called with the asset
|
||||
* @param asset - The loaded asset data
|
||||
* @param resolvedAsset - Any custom additional information relevant to the asset being loaded
|
||||
* @param loader - The loader instance
|
||||
*/
|
||||
testParse?: (asset: ASSET, resolvedAsset?: ResolvedAsset<META_DATA>, loader?: Loader) => Promise<boolean>;
|
||||
/**
|
||||
* Gets called on the asset it testParse passes. Useful to convert a raw asset into something more useful
|
||||
* @param asset - The loaded asset data
|
||||
* @param resolvedAsset - Any custom additional information relevant to the asset being loaded
|
||||
* @param loader - The loader instance
|
||||
*/
|
||||
parse?: <T>(asset: ASSET, resolvedAsset?: ResolvedAsset<META_DATA>, loader?: Loader) => Promise<PARSED_ASSET | T>;
|
||||
/**
|
||||
* If an asset is parsed using this parser, the unload function will be called when the user requests an asset
|
||||
* to be unloaded. This is useful for things like sounds or textures that can be unloaded from memory
|
||||
* @param asset - The asset to unload/destroy
|
||||
* @param resolvedAsset - Any custom additional information relevant to the asset being loaded
|
||||
* @param loader - The loader instance
|
||||
*/
|
||||
unload?: (asset: UNLOAD_ASSET, resolvedAsset?: ResolvedAsset<META_DATA>, loader?: Loader) => Promise<void> | void;
|
||||
}
|
||||
/**
|
||||
* The interface to define a loader parser *(all functions are optional)*.
|
||||
*
|
||||
* When you create a `parser` object, the flow for every asset loaded is:
|
||||
*
|
||||
* 1. `parser.test()` - Each URL to load will be tested here, if the test is passed the assets are
|
||||
* loaded using the load function below. Good place to test for things like file extensions!
|
||||
* 2. `parser.load()` - This is the promise that loads the URL provided resolves with a loaded asset
|
||||
* if returned by the parser.
|
||||
* 3. `parser.testParse()` - This function is used to test if the parse function should be run on the
|
||||
* asset If this returns true then parse is called with the asset
|
||||
* 4. `parse.parse()` - Gets called on the asset it testParse passes. Useful to convert a raw asset
|
||||
* into something more useful
|
||||
*
|
||||
* <br/>
|
||||
* Some loaders may only be used for parsing, some only for loading, and some for both!
|
||||
* @memberof assets
|
||||
*/
|
||||
export interface LoaderParser<ASSET = any, META_DATA = any, CONFIG = Record<string, any>> extends LoaderParserAdvanced<ASSET, ASSET, ASSET, META_DATA, CONFIG> {
|
||||
}
|
12
node_modules/pixi.js/lib/assets/loader/parsers/LoaderParser.js
generated
vendored
Normal file
12
node_modules/pixi.js/lib/assets/loader/parsers/LoaderParser.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
var LoaderParserPriority = /* @__PURE__ */ ((LoaderParserPriority2) => {
|
||||
LoaderParserPriority2[LoaderParserPriority2["Low"] = 0] = "Low";
|
||||
LoaderParserPriority2[LoaderParserPriority2["Normal"] = 1] = "Normal";
|
||||
LoaderParserPriority2[LoaderParserPriority2["High"] = 2] = "High";
|
||||
return LoaderParserPriority2;
|
||||
})(LoaderParserPriority || {});
|
||||
|
||||
exports.LoaderParserPriority = LoaderParserPriority;
|
||||
//# sourceMappingURL=LoaderParser.js.map
|
1
node_modules/pixi.js/lib/assets/loader/parsers/LoaderParser.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/loader/parsers/LoaderParser.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
10
node_modules/pixi.js/lib/assets/loader/parsers/LoaderParser.mjs
generated
vendored
Normal file
10
node_modules/pixi.js/lib/assets/loader/parsers/LoaderParser.mjs
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
var LoaderParserPriority = /* @__PURE__ */ ((LoaderParserPriority2) => {
|
||||
LoaderParserPriority2[LoaderParserPriority2["Low"] = 0] = "Low";
|
||||
LoaderParserPriority2[LoaderParserPriority2["Normal"] = 1] = "Normal";
|
||||
LoaderParserPriority2[LoaderParserPriority2["High"] = 2] = "High";
|
||||
return LoaderParserPriority2;
|
||||
})(LoaderParserPriority || {});
|
||||
|
||||
export { LoaderParserPriority };
|
||||
//# sourceMappingURL=LoaderParser.mjs.map
|
1
node_modules/pixi.js/lib/assets/loader/parsers/LoaderParser.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/loader/parsers/LoaderParser.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
15
node_modules/pixi.js/lib/assets/loader/parsers/loadJson.d.ts
generated
vendored
Normal file
15
node_modules/pixi.js/lib/assets/loader/parsers/loadJson.d.ts
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import { ExtensionType } from '../../../extensions/Extensions';
|
||||
import { LoaderParserPriority } from './LoaderParser';
|
||||
/**
|
||||
* A simple loader plugin for loading json data
|
||||
* @memberof assets
|
||||
*/
|
||||
export declare const loadJson: {
|
||||
extension: {
|
||||
type: ExtensionType.LoadParser;
|
||||
priority: LoaderParserPriority;
|
||||
};
|
||||
name: string;
|
||||
test(url: string): boolean;
|
||||
load<T>(url: string): Promise<T>;
|
||||
};
|
29
node_modules/pixi.js/lib/assets/loader/parsers/loadJson.js
generated
vendored
Normal file
29
node_modules/pixi.js/lib/assets/loader/parsers/loadJson.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
|
||||
var adapter = require('../../../environment/adapter.js');
|
||||
var Extensions = require('../../../extensions/Extensions.js');
|
||||
var checkDataUrl = require('../../utils/checkDataUrl.js');
|
||||
var checkExtension = require('../../utils/checkExtension.js');
|
||||
var LoaderParser = require('./LoaderParser.js');
|
||||
|
||||
"use strict";
|
||||
const validJSONExtension = ".json";
|
||||
const validJSONMIME = "application/json";
|
||||
const loadJson = {
|
||||
extension: {
|
||||
type: Extensions.ExtensionType.LoadParser,
|
||||
priority: LoaderParser.LoaderParserPriority.Low
|
||||
},
|
||||
name: "loadJson",
|
||||
test(url) {
|
||||
return checkDataUrl.checkDataUrl(url, validJSONMIME) || checkExtension.checkExtension(url, validJSONExtension);
|
||||
},
|
||||
async load(url) {
|
||||
const response = await adapter.DOMAdapter.get().fetch(url);
|
||||
const json = await response.json();
|
||||
return json;
|
||||
}
|
||||
};
|
||||
|
||||
exports.loadJson = loadJson;
|
||||
//# sourceMappingURL=loadJson.js.map
|
1
node_modules/pixi.js/lib/assets/loader/parsers/loadJson.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/loader/parsers/loadJson.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"loadJson.js","sources":["../../../../src/assets/loader/parsers/loadJson.ts"],"sourcesContent":["import { DOMAdapter } from '../../../environment/adapter';\nimport { ExtensionType } from '../../../extensions/Extensions';\nimport { checkDataUrl } from '../../utils/checkDataUrl';\nimport { checkExtension } from '../../utils/checkExtension';\nimport { LoaderParserPriority } from './LoaderParser';\n\nimport type { LoaderParser } from './LoaderParser';\n\nconst validJSONExtension = '.json';\nconst validJSONMIME = 'application/json';\n\n/**\n * A simple loader plugin for loading json data\n * @memberof assets\n */\nexport const loadJson = {\n extension: {\n type: ExtensionType.LoadParser,\n priority: LoaderParserPriority.Low,\n },\n\n name: 'loadJson',\n\n test(url: string): boolean\n {\n return checkDataUrl(url, validJSONMIME) || checkExtension(url, validJSONExtension);\n },\n\n async load<T>(url: string): Promise<T>\n {\n const response = await DOMAdapter.get().fetch(url);\n\n const json = await response.json();\n\n return json as T;\n },\n} satisfies LoaderParser<string>;\n"],"names":["ExtensionType","LoaderParserPriority","checkDataUrl","checkExtension","DOMAdapter"],"mappings":";;;;;;;;;AAQA,MAAM,kBAAqB,GAAA,OAAA,CAAA;AAC3B,MAAM,aAAgB,GAAA,kBAAA,CAAA;AAMf,MAAM,QAAW,GAAA;AAAA,EACpB,SAAW,EAAA;AAAA,IACP,MAAMA,wBAAc,CAAA,UAAA;AAAA,IACpB,UAAUC,iCAAqB,CAAA,GAAA;AAAA,GACnC;AAAA,EAEA,IAAM,EAAA,UAAA;AAAA,EAEN,KAAK,GACL,EAAA;AACI,IAAA,OAAOC,0BAAa,GAAK,EAAA,aAAa,CAAK,IAAAC,6BAAA,CAAe,KAAK,kBAAkB,CAAA,CAAA;AAAA,GACrF;AAAA,EAEA,MAAM,KAAQ,GACd,EAAA;AACI,IAAA,MAAM,WAAW,MAAMC,kBAAA,CAAW,GAAI,EAAA,CAAE,MAAM,GAAG,CAAA,CAAA;AAEjD,IAAM,MAAA,IAAA,GAAO,MAAM,QAAA,CAAS,IAAK,EAAA,CAAA;AAEjC,IAAO,OAAA,IAAA,CAAA;AAAA,GACX;AACJ;;;;"}
|
27
node_modules/pixi.js/lib/assets/loader/parsers/loadJson.mjs
generated
vendored
Normal file
27
node_modules/pixi.js/lib/assets/loader/parsers/loadJson.mjs
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import { DOMAdapter } from '../../../environment/adapter.mjs';
|
||||
import { ExtensionType } from '../../../extensions/Extensions.mjs';
|
||||
import { checkDataUrl } from '../../utils/checkDataUrl.mjs';
|
||||
import { checkExtension } from '../../utils/checkExtension.mjs';
|
||||
import { LoaderParserPriority } from './LoaderParser.mjs';
|
||||
|
||||
"use strict";
|
||||
const validJSONExtension = ".json";
|
||||
const validJSONMIME = "application/json";
|
||||
const loadJson = {
|
||||
extension: {
|
||||
type: ExtensionType.LoadParser,
|
||||
priority: LoaderParserPriority.Low
|
||||
},
|
||||
name: "loadJson",
|
||||
test(url) {
|
||||
return checkDataUrl(url, validJSONMIME) || checkExtension(url, validJSONExtension);
|
||||
},
|
||||
async load(url) {
|
||||
const response = await DOMAdapter.get().fetch(url);
|
||||
const json = await response.json();
|
||||
return json;
|
||||
}
|
||||
};
|
||||
|
||||
export { loadJson };
|
||||
//# sourceMappingURL=loadJson.mjs.map
|
1
node_modules/pixi.js/lib/assets/loader/parsers/loadJson.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/loader/parsers/loadJson.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"loadJson.mjs","sources":["../../../../src/assets/loader/parsers/loadJson.ts"],"sourcesContent":["import { DOMAdapter } from '../../../environment/adapter';\nimport { ExtensionType } from '../../../extensions/Extensions';\nimport { checkDataUrl } from '../../utils/checkDataUrl';\nimport { checkExtension } from '../../utils/checkExtension';\nimport { LoaderParserPriority } from './LoaderParser';\n\nimport type { LoaderParser } from './LoaderParser';\n\nconst validJSONExtension = '.json';\nconst validJSONMIME = 'application/json';\n\n/**\n * A simple loader plugin for loading json data\n * @memberof assets\n */\nexport const loadJson = {\n extension: {\n type: ExtensionType.LoadParser,\n priority: LoaderParserPriority.Low,\n },\n\n name: 'loadJson',\n\n test(url: string): boolean\n {\n return checkDataUrl(url, validJSONMIME) || checkExtension(url, validJSONExtension);\n },\n\n async load<T>(url: string): Promise<T>\n {\n const response = await DOMAdapter.get().fetch(url);\n\n const json = await response.json();\n\n return json as T;\n },\n} satisfies LoaderParser<string>;\n"],"names":[],"mappings":";;;;;;;AAQA,MAAM,kBAAqB,GAAA,OAAA,CAAA;AAC3B,MAAM,aAAgB,GAAA,kBAAA,CAAA;AAMf,MAAM,QAAW,GAAA;AAAA,EACpB,SAAW,EAAA;AAAA,IACP,MAAM,aAAc,CAAA,UAAA;AAAA,IACpB,UAAU,oBAAqB,CAAA,GAAA;AAAA,GACnC;AAAA,EAEA,IAAM,EAAA,UAAA;AAAA,EAEN,KAAK,GACL,EAAA;AACI,IAAA,OAAO,aAAa,GAAK,EAAA,aAAa,CAAK,IAAA,cAAA,CAAe,KAAK,kBAAkB,CAAA,CAAA;AAAA,GACrF;AAAA,EAEA,MAAM,KAAQ,GACd,EAAA;AACI,IAAA,MAAM,WAAW,MAAM,UAAA,CAAW,GAAI,EAAA,CAAE,MAAM,GAAG,CAAA,CAAA;AAEjD,IAAM,MAAA,IAAA,GAAO,MAAM,QAAA,CAAS,IAAK,EAAA,CAAA;AAEjC,IAAO,OAAA,IAAA,CAAA;AAAA,GACX;AACJ;;;;"}
|
16
node_modules/pixi.js/lib/assets/loader/parsers/loadTxt.d.ts
generated
vendored
Normal file
16
node_modules/pixi.js/lib/assets/loader/parsers/loadTxt.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import { ExtensionType } from '../../../extensions/Extensions';
|
||||
import { LoaderParserPriority } from './LoaderParser';
|
||||
/**
|
||||
* A simple loader plugin for loading text data
|
||||
* @memberof assets
|
||||
*/
|
||||
export declare const loadTxt: {
|
||||
name: string;
|
||||
extension: {
|
||||
type: ExtensionType.LoadParser;
|
||||
priority: LoaderParserPriority;
|
||||
name: string;
|
||||
};
|
||||
test(url: string): boolean;
|
||||
load<T>(url: string): Promise<string>;
|
||||
};
|
30
node_modules/pixi.js/lib/assets/loader/parsers/loadTxt.js
generated
vendored
Normal file
30
node_modules/pixi.js/lib/assets/loader/parsers/loadTxt.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
'use strict';
|
||||
|
||||
var adapter = require('../../../environment/adapter.js');
|
||||
var Extensions = require('../../../extensions/Extensions.js');
|
||||
var checkDataUrl = require('../../utils/checkDataUrl.js');
|
||||
var checkExtension = require('../../utils/checkExtension.js');
|
||||
var LoaderParser = require('./LoaderParser.js');
|
||||
|
||||
"use strict";
|
||||
const validTXTExtension = ".txt";
|
||||
const validTXTMIME = "text/plain";
|
||||
const loadTxt = {
|
||||
name: "loadTxt",
|
||||
extension: {
|
||||
type: Extensions.ExtensionType.LoadParser,
|
||||
priority: LoaderParser.LoaderParserPriority.Low,
|
||||
name: "loadTxt"
|
||||
},
|
||||
test(url) {
|
||||
return checkDataUrl.checkDataUrl(url, validTXTMIME) || checkExtension.checkExtension(url, validTXTExtension);
|
||||
},
|
||||
async load(url) {
|
||||
const response = await adapter.DOMAdapter.get().fetch(url);
|
||||
const txt = await response.text();
|
||||
return txt;
|
||||
}
|
||||
};
|
||||
|
||||
exports.loadTxt = loadTxt;
|
||||
//# sourceMappingURL=loadTxt.js.map
|
1
node_modules/pixi.js/lib/assets/loader/parsers/loadTxt.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/assets/loader/parsers/loadTxt.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"loadTxt.js","sources":["../../../../src/assets/loader/parsers/loadTxt.ts"],"sourcesContent":["import { DOMAdapter } from '../../../environment/adapter';\nimport { ExtensionType } from '../../../extensions/Extensions';\nimport { checkDataUrl } from '../../utils/checkDataUrl';\nimport { checkExtension } from '../../utils/checkExtension';\nimport { LoaderParserPriority } from './LoaderParser';\n\nimport type { LoaderParser } from './LoaderParser';\n\nconst validTXTExtension = '.txt';\nconst validTXTMIME = 'text/plain';\n\n/**\n * A simple loader plugin for loading text data\n * @memberof assets\n */\nexport const loadTxt = {\n\n name: 'loadTxt',\n\n extension: {\n type: ExtensionType.LoadParser,\n priority: LoaderParserPriority.Low,\n name: 'loadTxt',\n },\n\n test(url: string): boolean\n {\n return checkDataUrl(url, validTXTMIME) || checkExtension(url, validTXTExtension);\n },\n\n async load(url: string): Promise<string>\n {\n const response = await DOMAdapter.get().fetch(url);\n\n const txt = await response.text();\n\n return txt;\n },\n} satisfies LoaderParser<string>;\n"],"names":["ExtensionType","LoaderParserPriority","checkDataUrl","checkExtension","DOMAdapter"],"mappings":";;;;;;;;;AAQA,MAAM,iBAAoB,GAAA,MAAA,CAAA;AAC1B,MAAM,YAAe,GAAA,YAAA,CAAA;AAMd,MAAM,OAAU,GAAA;AAAA,EAEnB,IAAM,EAAA,SAAA;AAAA,EAEN,SAAW,EAAA;AAAA,IACP,MAAMA,wBAAc,CAAA,UAAA;AAAA,IACpB,UAAUC,iCAAqB,CAAA,GAAA;AAAA,IAC/B,IAAM,EAAA,SAAA;AAAA,GACV;AAAA,EAEA,KAAK,GACL,EAAA;AACI,IAAA,OAAOC,0BAAa,GAAK,EAAA,YAAY,CAAK,IAAAC,6BAAA,CAAe,KAAK,iBAAiB,CAAA,CAAA;AAAA,GACnF;AAAA,EAEA,MAAM,KAAK,GACX,EAAA;AACI,IAAA,MAAM,WAAW,MAAMC,kBAAA,CAAW,GAAI,EAAA,CAAE,MAAM,GAAG,CAAA,CAAA;AAEjD,IAAM,MAAA,GAAA,GAAM,MAAM,QAAA,CAAS,IAAK,EAAA,CAAA;AAEhC,IAAO,OAAA,GAAA,CAAA;AAAA,GACX;AACJ;;;;"}
|
28
node_modules/pixi.js/lib/assets/loader/parsers/loadTxt.mjs
generated
vendored
Normal file
28
node_modules/pixi.js/lib/assets/loader/parsers/loadTxt.mjs
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
import { DOMAdapter } from '../../../environment/adapter.mjs';
|
||||
import { ExtensionType } from '../../../extensions/Extensions.mjs';
|
||||
import { checkDataUrl } from '../../utils/checkDataUrl.mjs';
|
||||
import { checkExtension } from '../../utils/checkExtension.mjs';
|
||||
import { LoaderParserPriority } from './LoaderParser.mjs';
|
||||
|
||||
"use strict";
|
||||
const validTXTExtension = ".txt";
|
||||
const validTXTMIME = "text/plain";
|
||||
const loadTxt = {
|
||||
name: "loadTxt",
|
||||
extension: {
|
||||
type: ExtensionType.LoadParser,
|
||||
priority: LoaderParserPriority.Low,
|
||||
name: "loadTxt"
|
||||
},
|
||||
test(url) {
|
||||
return checkDataUrl(url, validTXTMIME) || checkExtension(url, validTXTExtension);
|
||||
},
|
||||
async load(url) {
|
||||
const response = await DOMAdapter.get().fetch(url);
|
||||
const txt = await response.text();
|
||||
return txt;
|
||||
}
|
||||
};
|
||||
|
||||
export { loadTxt };
|
||||
//# sourceMappingURL=loadTxt.mjs.map
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user