master

laravel/framework

Last updated at: 29/12/2023 09:25

Vite.php

TLDR

This file defines the Vite facade class, which provides simplified access to the functionality of the \Illuminate\Foundation\Vite class. It allows developers to use Vite's features without needing to instantiate the \Illuminate\Foundation\Vite class directly.

Methods

preloadedAssets

This method returns an array of preloaded assets.

cspNonce

This method returns the CSP (Content Security Policy) nonce value, or null if not set.

useCspNonce

This method sets the CSP nonce value. It takes an optional nonce parameter which can be used to override the default nonce value.

useIntegrityKey

This method sets the integrity key. It takes a key parameter, which can be either a string or false.

withEntryPoints

This method sets the entry points for the Vite application. It takes an array of entry points.

useManifestFilename

This method sets the Vite manifest filename. It takes a filename parameter, which is the desired manifest filename.

hotFile

This method returns the path to the hot file.

useHotFile

This method sets the path to the hot file. It takes a path parameter, which is the desired hot file path.

useBuildDirectory

This method sets the build directory path. It takes a path parameter, which is the desired build directory path.

useScriptTagAttributes

This method sets the attributes for the script tags. It takes a callable or an array as the parameter.

useStyleTagAttributes

This method sets the attributes for the style tags. It takes a callable or an array as the parameter.

usePreloadTagAttributes

This method sets the attributes for the preload tags. It takes a callable, an array, or false as the parameter.

reactRefresh

This method returns a \Illuminate\Support\HtmlString or void type. It refreshes the React components.

asset

This method returns the asset path. It takes an asset parameter, which is the desired asset path, and an optional buildDirectory parameter, which is the build directory path.

content

This method returns the asset content. It takes an asset parameter, which is the desired asset path, and an optional buildDirectory parameter, which is the build directory path.

manifestHash

This method returns the manifest hash. It takes an optional buildDirectory parameter, which is the build directory path.

isRunningHot

This method returns a boolean value indicating if Vite is running in hot module replacement mode.

toHtml

This method returns the Vite HTML output.

macro

This method defines a new macro. It takes a name parameter, which is the name of the macro, and a macro parameter, which is the macro definition as an object or callable.

mixin

This method mixes in functionality from another class or object. It takes a mixin parameter, which is the class or object to be mixed in, and an optional replace parameter.

hasMacro

This method checks if a macro exists. It takes a name parameter, which is the name of the macro.

flushMacros

This method flushes all macros.

Classes

Class Vite

This class is a facade that provides simplified access to the functionality of the \Illuminate\Foundation\Vite class. It extends the Facade class. The getFacadeAccessor method is implemented to return the \Illuminate\Foundation\Vite class.

<?php

namespace Illuminate\Support\Facades;

/**
 * @method static array preloadedAssets()
 * @method static string|null cspNonce()
 * @method static string useCspNonce(string|null $nonce = null)
 * @method static \Illuminate\Foundation\Vite useIntegrityKey(string|false $key)
 * @method static \Illuminate\Foundation\Vite withEntryPoints(array $entryPoints)
 * @method static \Illuminate\Foundation\Vite useManifestFilename(string $filename)
 * @method static string hotFile()
 * @method static \Illuminate\Foundation\Vite useHotFile(string $path)
 * @method static \Illuminate\Foundation\Vite useBuildDirectory(string $path)
 * @method static \Illuminate\Foundation\Vite useScriptTagAttributes(callable|array $attributes)
 * @method static \Illuminate\Foundation\Vite useStyleTagAttributes(callable|array $attributes)
 * @method static \Illuminate\Foundation\Vite usePreloadTagAttributes(callable|array|false $attributes)
 * @method static \Illuminate\Support\HtmlString|void reactRefresh()
 * @method static string asset(string $asset, string|null $buildDirectory = null)
 * @method static string content(string $asset, string|null $buildDirectory = null)
 * @method static string|null manifestHash(string|null $buildDirectory = null)
 * @method static bool isRunningHot()
 * @method static string toHtml()
 * @method static void macro(string $name, object|callable $macro)
 * @method static void mixin(object $mixin, bool $replace = true)
 * @method static bool hasMacro(string $name)
 * @method static void flushMacros()
 *
 * @see \Illuminate\Foundation\Vite
 */
class Vite extends Facade
{
    /**
     * Get the registered name of the component.
     *
     * @return string
     */
    protected static function getFacadeAccessor()
    {
        return \Illuminate\Foundation\Vite::class;
    }
}