Vite
in package
Table of Contents
Constants
- DEFAULT_MANIFEST_PATHS = [ 'dist/manifest.json', // vite < 5.0.0 'dist/.vite/manifest.json', ]
- DEFAULT_VITE_DEV_SERVER_URL = 'http://localhost:5173'
Properties
- $cache : array<string|int, mixed>
- 簡易キャッシュのためのメモリ上の配列
- $devServerUrl : string
- $environment : "development"|"production"
- $manifestPath : string
Methods
- __construct() : mixed
- Constructor
- generateHtml() : string
- Generate HTML
- generateReactRefreshHtml() : string
- Generate React Refresh HTML
- getDevServerUrl() : string
- Get development server URL
- getEnvironment() : "development"|"production"
- Get environment
- createCssLinkTags() : string
- Create CSS link tags
- createEntrypointTags() : string
- Create script tags
- createImportedChankLinkTags() : string
- Create imported chank link tags
- createLinkTag() : string
- Create a link tag.
- createModulePreloadLinkTags() : string
- Create modulepreload link tags
- createScriptTag() : string
- Create a script tag.
- getCache() : mixed
- キャッシュから値を取得する
- getManifest() : array<string, mixed>|null
- Get manifest
- getManifestPath() : string
- Get manifest path
- hasCache() : bool
- キャッシュが存在するか確認する
- isCssPath() : bool
- Determine whether the given path is a CSS file.
- parseAttributes() : array<string|int, mixed>
- Parse the attributes into key="value" strings.
- putCache() : void
- キャッシュに値を保存する
- shouldUseDevServer() : bool
- Determine whether to use the development server.
Constants
DEFAULT_MANIFEST_PATHS
private
mixed
DEFAULT_MANIFEST_PATHS
= [
'dist/manifest.json',
// vite < 5.0.0
'dist/.vite/manifest.json',
]
DEFAULT_VITE_DEV_SERVER_URL
private
mixed
DEFAULT_VITE_DEV_SERVER_URL
= 'http://localhost:5173'
Properties
$cache
簡易キャッシュのためのメモリ上の配列
private
array<string|int, mixed>
$cache
= []
$devServerUrl
private
string
$devServerUrl
$environment
private
"development"|"production"
$environment
$manifestPath
private
string
$manifestPath
Methods
__construct()
Constructor
public
__construct(string $devServerUrl, string $manifestPath, "development"|"production" $environment) : mixed
Parameters
- $devServerUrl : string
- $manifestPath : string
- $environment : "development"|"production"
generateHtml()
Generate HTML
public
generateHtml(string|array<string|int, string> $entrypoints[, array{outDir?: string, scriptTagAttributes?: array, linkTagAttributes?: array} $options = [] ]) : string
Parameters
- $entrypoints : string|array<string|int, string>
-
$options
: array{outDir?: string, scriptTagAttributes?: array
, linkTagAttributes?: array = []}
Tags
Return values
stringgenerateReactRefreshHtml()
Generate React Refresh HTML
public
generateReactRefreshHtml() : string
Return values
stringgetDevServerUrl()
Get development server URL
public
getDevServerUrl() : string
Return values
stringgetEnvironment()
Get environment
public
getEnvironment() : "development"|"production"
Return values
"development"|"production"createCssLinkTags()
Create CSS link tags
private
createCssLinkTags(array<string|int, string> $entrypoints, string $outDir) : string
Parameters
- $entrypoints : array<string|int, string>
- $outDir : string
Return values
stringcreateEntrypointTags()
Create script tags
private
createEntrypointTags(array<string|int, string> $entrypoints, string $outDir[, array<string, mixed> $scriptAttributes = [] ][, array<string, mixed> $linkAttributes = [] ]) : string
Parameters
- $entrypoints : array<string|int, string>
- $outDir : string
- $scriptAttributes : array<string, mixed> = []
- $linkAttributes : array<string, mixed> = []
Return values
stringcreateImportedChankLinkTags()
Create imported chank link tags
private
createImportedChankLinkTags(array<string|int, string> $entrypoints, string $outDir) : string
Parameters
- $entrypoints : array<string|int, string>
- $outDir : string
Return values
stringcreateLinkTag()
Create a link tag.
private
createLinkTag(array<string|int, mixed> $attributes) : string
Parameters
- $attributes : array<string|int, mixed>
Return values
stringcreateModulePreloadLinkTags()
Create modulepreload link tags
private
createModulePreloadLinkTags(array<string|int, string> $entrypoints, string $outDir) : string
Parameters
- $entrypoints : array<string|int, string>
- $outDir : string
Return values
stringcreateScriptTag()
Create a script tag.
private
createScriptTag(array<string|int, mixed> $attributes) : string
Parameters
- $attributes : array<string|int, mixed>
Return values
stringgetCache()
キャッシュから値を取得する
private
getCache(string $key) : mixed
Parameters
- $key : string
getManifest()
Get manifest
private
getManifest() : array<string, mixed>|null
Return values
array<string, mixed>|nullgetManifestPath()
Get manifest path
private
getManifestPath() : string
Return values
stringhasCache()
キャッシュが存在するか確認する
private
hasCache(string $key) : bool
Parameters
- $key : string
Return values
boolisCssPath()
Determine whether the given path is a CSS file.
private
isCssPath(string $path) : bool
Parameters
- $path : string
Return values
boolparseAttributes()
Parse the attributes into key="value" strings.
private
parseAttributes(array<string|int, mixed> $attributes) : array<string|int, mixed>
Parameters
- $attributes : array<string|int, mixed>
Return values
array<string|int, mixed>putCache()
キャッシュに値を保存する
private
putCache(string $key, mixed $value) : void
Parameters
- $key : string
- $value : mixed
shouldUseDevServer()
Determine whether to use the development server.
private
shouldUseDevServer() : bool