/** * Class for resolve root and asset paths. * @class PathUtils * @memberof jibo.utils */ declare class PathUtils { private static findRootCache; private static getAssetUriCache; /** * Traverses up the directories until the first folder with a `package.json` file. * This also works for requests with asset-pack, e.g., "core://resources/fonts.css". * @method jibo.utils.PathUtils.findRoot * @param {String} [start] The starting directory, empty uses current working directory. * @return {String} The root directory which contains `package.json`. */ static findRoot(start?: string): string; static _findRoot(start: string): string; /** * Get a project name. Useful for figuring out the asset pack. * @method jibo.utils.PathUtils.getProjectName * @param {String} dir The directory. Should contain `package.json`. * @return {String} The name in the `package.json`. */ static getProjectName(dir: string): string; /** * Basic check to see if a URI is a URL. * @method jibo.utils.PathUtils.isURL * @param {String} uri String path to test. * @return {Boolean} `true` if URI is a URL. */ static isURL(uri: string): boolean; /** * Basic check to see if a URI is an image. * @method jibo.utils.PathUtils.isImage * @param {String} uri String path to test. * @return {Boolean} `true` if URI contains an image extension. */ static isImage(uri: string): boolean; /** * Set the default path for behaviors, rules, animations, etc. * @method jibo.utils.PathUtils.setDefaultPath * @param {String} parentDir The parent directory. * @param {String} fileName The file name. * @return {String} asset URI to load. */ static setDefaultPath(parentDir: string, fileName: string): string; /** * Get the asset pack from the file request, if available. * @method jibo.utils.PathUtils.getAssetPack * @param {String} fileName The file name. * @return {String} The asset pack name, otherwise returns ''. */ static getAssetPack(fileName: string): string; /** * Get an asset pack URI. * @method jibo.utils.PathUtils.getAssetUri * @param {String} fileName The file name to load, can be `asset-pack://etc`. * @param {String} assetPack The current asset pack to load within. * @param {string} [resourceRoot] The root of the skill to get the asset from (defaults to current skill). * @return {String} The result URI. */ static getAssetUri(fileName: string, assetPack?: string, resourceRoot?: string): string; static _getAssetUri(fileName: string, assetPack?: string, resourceRoot?: string): string; /** * Get asset source from filename and asset pack. * @method jibo.utils.PathUtils.getAudioUri * @param {String} fileName The file name to load, can be `asset-pack://etc`. * @param {String} currentAssetPack The current asset pack to load within. * @param {String} [resourceRoot] The root to the skill. * @return {String} The result URI. */ static getAudioUri(fileName: string, currentAssetPack?: string, resourceRoot?: string): string; /** * Get asset source from filename and asset pack. * @method jibo.utils.PathUtils.getTimelineUri * @param {String} fileName The file name to load, can be `asset-pack://etc`. * @param {String} currentAssetPack The current asset pack to load within. * @param {String} [resourceRoot] The root to the skill. * @return {String} The result URI. */ static getTimelineUri(fileName: string, currentAssetPack?: string, resourceRoot?: string): string; /** * Get the URI for an animation referenced from within another animation's reference layer. * In the case of asset pack references, we resolve it relative to the asset pack's "animations" directory. * Otherwise it's a relative reference, relative to the referencing animation file's directory. * @method jibo.utils.PathUtils.getAnimationUri * @param fileName * @param currentAssetPack * @param resourceRoot * @returns {string} */ static getAnimationUri(fileName: string, currentAssetPack?: string, resourceRoot?: string): string; /** * Modified from [https://github.com/sindresorhus/resolve-from](https://github.com/sindresorhus/resolve-from). Return the path to the * module's `package.json`, not the module directory. * @method jibo.utils.PathUtils.resolve * @param {String} moduleId The module to resolve path to. * @param {String} [fromPath=process.cwd()] Resolve path from * @return {String} The resolved file path. */ static resolve(moduleId: string, fromPath?: string): string; /** * Return the root path of the asset pack from the asset filename, if available. * @method jibo.utils.PathUtils.resolveAssetPack * @param {String} assetPack The assetPack name name. * @return {String} Full path to the root directory. */ private static resolveAssetPack(assetPack); private static getPackagePath(); } export default PathUtils;