Files
nothoughts/node_modules/pixi.js/lib/assets/loader/parsers/LoaderParser.mjs.map
2025-08-04 18:57:35 +02:00

1 line
5.1 KiB
Plaintext

{"version":3,"file":"LoaderParser.mjs","sources":["../../../../src/assets/loader/parsers/LoaderParser.ts"],"sourcesContent":["import type { ExtensionMetadata } from '../../../extensions/Extensions';\nimport type { ResolvedAsset } from '../../types';\nimport type { Loader } from '../Loader';\n\n/**\n * The extension priority for loader parsers.\n * Helpful when managing multiple parsers that share the same extension test.\n * The higher priority parsers will be checked first.\n * @enum {number}\n */\nexport enum LoaderParserPriority\n// eslint-disable-next-line @typescript-eslint/indent\n{\n /** Generic parsers: txt, json, webfonts */\n Low = 0,\n /** PixiJS assets with generic extensions: spritesheets, bitmapfonts */\n Normal = 1,\n /** Specific texture types: svg, png, ktx, dds, basis */\n High = 2,\n}\n\n/** A more verbose version of the LoaderParser, allowing you to set the loaded, parsed, and unloaded asset separately */\nexport interface LoaderParserAdvanced<\n ASSET = any,\n PARSED_ASSET = ASSET,\n UNLOAD_ASSET = ASSET,\n META_DATA = any,\n CONFIG = Record<string, any>\n>\n{\n /** Should be ExtensionType.LoaderParser */\n extension?: ExtensionMetadata;\n\n /** A config to adjust the parser */\n config?: CONFIG;\n\n /** The name of the parser (this can be used when specifying loadParser in a ResolvedAsset) */\n name: string;\n\n /**\n * Each URL to load will be tested here,\n * if the test is passed the assets are loaded using the load function below.\n * Good place to test for things like file extensions!\n * @param url - The URL to test\n * @param resolvedAsset - Any custom additional information relevant to the asset being loaded\n * @param loader - The loader instance\n */\n test?: (url: string, resolvedAsset?: ResolvedAsset<META_DATA>, loader?: Loader) => boolean;\n\n /**\n * This is the promise that loads the URL provided\n * resolves with a loaded asset if returned by the parser.\n * @param url - The URL to load\n * @param resolvedAsset - Any custom additional information relevant to the asset being loaded\n * @param loader - The loader instance\n */\n load?: <T>(url: string, resolvedAsset?: ResolvedAsset<META_DATA>, loader?: Loader) => Promise<ASSET | T>;\n\n /**\n * This function is used to test if the parse function should be run on the asset\n * If this returns true then parse is called with the asset\n * @param asset - The loaded asset data\n * @param resolvedAsset - Any custom additional information relevant to the asset being loaded\n * @param loader - The loader instance\n */\n testParse?: (asset: ASSET, resolvedAsset?: ResolvedAsset<META_DATA>, loader?: Loader) => Promise<boolean>;\n\n /**\n * Gets called on the asset it testParse passes. Useful to convert a raw asset into something more useful\n * @param asset - The loaded asset data\n * @param resolvedAsset - Any custom additional information relevant to the asset being loaded\n * @param loader - The loader instance\n */\n parse?: <T>(asset: ASSET, resolvedAsset?: ResolvedAsset<META_DATA>, loader?: Loader) => Promise<PARSED_ASSET | T>;\n\n /**\n * If an asset is parsed using this parser, the unload function will be called when the user requests an asset\n * to be unloaded. This is useful for things like sounds or textures that can be unloaded from memory\n * @param asset - The asset to unload/destroy\n * @param resolvedAsset - Any custom additional information relevant to the asset being loaded\n * @param loader - The loader instance\n */\n unload?: (asset: UNLOAD_ASSET, resolvedAsset?: ResolvedAsset<META_DATA>, loader?: Loader) => Promise<void> | void;\n}\n\n/**\n * The interface to define a loader parser *(all functions are optional)*.\n *\n * When you create a `parser` object, the flow for every asset loaded is:\n *\n * 1. `parser.test()` - Each URL to load will be tested here, if the test is passed the assets are\n * loaded using the load function below. Good place to test for things like file extensions!\n * 2. `parser.load()` - This is the promise that loads the URL provided resolves with a loaded asset\n * if returned by the parser.\n * 3. `parser.testParse()` - This function is used to test if the parse function should be run on the\n * asset If this returns true then parse is called with the asset\n * 4. `parse.parse()` - Gets called on the asset it testParse passes. Useful to convert a raw asset\n * into something more useful\n *\n * <br/>\n * Some loaders may only be used for parsing, some only for loading, and some for both!\n * @memberof assets\n */\nexport interface LoaderParser<ASSET = any, META_DATA = any, CONFIG = Record<string, any>>\n extends LoaderParserAdvanced<ASSET, ASSET, ASSET, META_DATA, CONFIG> {}\n"],"names":["LoaderParserPriority"],"mappings":";AAUY,IAAA,oBAAA,qBAAAA,qBAAL,KAAA;AAIH,EAAAA,qBAAAA,CAAAA,qBAAAA,CAAA,SAAM,CAAN,CAAA,GAAA,KAAA,CAAA;AAEA,EAAAA,qBAAAA,CAAAA,qBAAAA,CAAA,YAAS,CAAT,CAAA,GAAA,QAAA,CAAA;AAEA,EAAAA,qBAAAA,CAAAA,qBAAAA,CAAA,UAAO,CAAP,CAAA,GAAA,MAAA,CAAA;AARQ,EAAAA,OAAAA,qBAAAA,CAAAA;AAAA,CAAA,EAAA,oBAAA,IAAA,EAAA;;;;"}