cancellazione modifiche dopo step before oauth
This commit is contained in:
+21
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Taylor Otwell
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
# Laravel Vite Plugin
|
||||
|
||||
<a href="https://github.com/laravel/vite-plugin/actions"><img src="https://github.com/laravel/vite-plugin/workflows/tests/badge.svg" alt="Build Status"></a>
|
||||
<a href="https://www.npmjs.com/package/laravel-vite-plugin"><img src="https://img.shields.io/npm/dt/laravel-vite-plugin" alt="Total Downloads"></a>
|
||||
<a href="https://www.npmjs.com/package/laravel-vite-plugin"><img src="https://img.shields.io/npm/v/laravel-vite-plugin" alt="Latest Stable Version"></a>
|
||||
<a href="https://www.npmjs.com/package/laravel-vite-plugin"><img src="https://img.shields.io/npm/l/laravel-vite-plugin" alt="License"></a>
|
||||
|
||||
## Introduction
|
||||
|
||||
[Vite](https://vitejs.dev) is a modern frontend build tool that provides an extremely fast development environment and bundles your code for production.
|
||||
|
||||
This plugin configures Vite for use with a Laravel backend server.
|
||||
|
||||
## Official Documentation
|
||||
|
||||
Documentation for the Laravel Vite plugin can be found on the [Laravel website](https://laravel.com/docs/vite).
|
||||
|
||||
## Contributing
|
||||
|
||||
Thank you for considering contributing to the Laravel Vite plugin! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
|
||||
|
||||
## Security Vulnerabilities
|
||||
|
||||
Please review [our security policy](https://github.com/laravel/vite-plugin/security/policy) on how to report security vulnerabilities.
|
||||
|
||||
## License
|
||||
|
||||
The Laravel Vite plugin is open-sourced software licensed under the [MIT license](LICENSE.md).
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import { readFileSync, readdirSync, unlinkSync, existsSync } from 'fs'
|
||||
import { dirname } from 'path'
|
||||
|
||||
/*
|
||||
* Argv helpers.
|
||||
*/
|
||||
|
||||
const argument = (name) => {
|
||||
const index = process.argv.findIndex(argument => argument.startsWith(`--${name}=`))
|
||||
|
||||
return index === -1
|
||||
? undefined
|
||||
: process.argv[index].substring(`--${name}=`.length)
|
||||
}
|
||||
|
||||
const option = (name) => process.argv.includes(`--${name}`)
|
||||
|
||||
/*
|
||||
* Helpers.
|
||||
*/
|
||||
const info = option(`quiet`) ? (() => undefined) : console.log
|
||||
const error = option(`quiet`) ? (() => undefined) : console.error
|
||||
|
||||
/*
|
||||
* Clean.
|
||||
*/
|
||||
|
||||
const main = () => {
|
||||
const manifestPaths = argument(`manifest`) ? [argument(`manifest`)] : (option(`ssr`)
|
||||
? [`./bootstrap/ssr/ssr-manifest.json`, `./bootstrap/ssr/manifest.json`]
|
||||
: [`./public/build/manifest.json`])
|
||||
|
||||
const foundManifestPath = manifestPaths.find(existsSync)
|
||||
|
||||
if (! foundManifestPath) {
|
||||
error(`Unable to find manifest file.`)
|
||||
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
info(`Reading manifest [${foundManifestPath}].`)
|
||||
|
||||
const manifest = JSON.parse(readFileSync(foundManifestPath).toString())
|
||||
|
||||
const manifestFiles = Object.keys(manifest)
|
||||
|
||||
const isSsr = Array.isArray(manifest[manifestFiles[0]])
|
||||
|
||||
isSsr
|
||||
? info(`SSR manifest found.`)
|
||||
: info(`Non-SSR manifest found.`)
|
||||
|
||||
const manifestAssets = isSsr
|
||||
? manifestFiles.flatMap(key => manifest[key])
|
||||
: manifestFiles.flatMap(key => [
|
||||
...manifest[key].css ?? [],
|
||||
manifest[key].file,
|
||||
])
|
||||
|
||||
const assetsPath = argument('assets') ?? dirname(foundManifestPath)+'/assets'
|
||||
|
||||
info(`Verify assets in [${assetsPath}].`)
|
||||
|
||||
const existingAssets = readdirSync(assetsPath, { withFileTypes: true })
|
||||
|
||||
const orphanedAssets = existingAssets.filter(file => file.isFile())
|
||||
.filter(file => manifestAssets.findIndex(asset => asset.endsWith(`/${file.name}`)) === -1)
|
||||
|
||||
if (orphanedAssets.length === 0) {
|
||||
info(`No ophaned assets found.`)
|
||||
} else {
|
||||
orphanedAssets.length === 1
|
||||
? info(`[${orphanedAssets.length}] orphaned asset found.`)
|
||||
: info(`[${orphanedAssets.length}] orphaned assets found.`)
|
||||
|
||||
orphanedAssets.forEach(asset => {
|
||||
const path = `${assetsPath}/${asset.name}`
|
||||
|
||||
option(`dry-run`)
|
||||
? info(`Orphaned asset [${path}] would be removed.`)
|
||||
: info(`Removing orphaned asset [${path}].`)
|
||||
|
||||
if (! option(`dry-run`)) {
|
||||
unlinkSync(path)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
||||
+72
File diff suppressed because one or more lines are too long
+7
@@ -0,0 +1,7 @@
|
||||
export declare function resolveCacheDir(projectRoot: string, cacheDir?: string): string;
|
||||
export declare function cacheKey(input: string): string;
|
||||
export declare function readCache(cacheDir: string, key: string): Buffer | undefined;
|
||||
export declare function readCacheText(cacheDir: string, key: string): string | undefined;
|
||||
export declare function writeCache(cacheDir: string, key: string, data: Buffer | string): void;
|
||||
export declare function fetchAndCache(url: string, cacheDir: string, headers?: Record<string, string>): Promise<Buffer>;
|
||||
export declare function fetchTextAndCache(url: string, cacheDir: string, headers?: Record<string, string>): Promise<string>;
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
import type { BaseFontOptions, FontDefinition, FontFormat, FontProviderType, FontStyle, FontWeight, FormatConfig, LocalVariantDefinition, ResolvedFontFamily, ResolvedFontVariant } from './types.js';
|
||||
export declare const FORMATS: FormatConfig[];
|
||||
export declare function inferWeightFromFilename(filePath: string): FontWeight;
|
||||
export declare function inferStyleFromFilename(filePath: string): FontStyle;
|
||||
export declare function inferLocalVariantFromFilename(filePath: string): {
|
||||
weight: FontWeight;
|
||||
style: FontStyle;
|
||||
};
|
||||
export declare function looksLikeVariableFontFilename(filePath: string): boolean;
|
||||
export declare function resolveLocalShorthandVariants(definition: FontDefinition, localConfig: {
|
||||
src: string;
|
||||
}, projectRoot: string): Promise<ResolvedFontVariant[]>;
|
||||
export declare function familyToVariable(family: string): string;
|
||||
export declare function familyToSlug(family: string): string;
|
||||
export declare function aliasToVariable(alias: string): string;
|
||||
export declare function buildFontDefinition(family: string, provider: FontProviderType, options?: BaseFontOptions, extra?: Partial<FontDefinition>): FontDefinition;
|
||||
export declare function buildResolvedFamily(definition: FontDefinition, variants: ResolvedFontVariant[]): ResolvedFontFamily;
|
||||
export declare function inferFormat(filePath: string): FontFormat;
|
||||
export declare function validateFontDefinition(definition: FontDefinition): void;
|
||||
export declare function mergeFontDefinitions(fonts: FontDefinition[]): FontDefinition[];
|
||||
export declare function validateFontsConfig(fonts: FontDefinition[]): FontDefinition[];
|
||||
export declare function resolveLocalExplicitVariants(definition: FontDefinition, localConfig: {
|
||||
variants: LocalVariantDefinition[];
|
||||
}, projectRoot: string): ResolvedFontVariant[];
|
||||
export declare function resolveLocalVariants(definition: FontDefinition, projectRoot: string): Promise<ResolvedFontVariant[]>;
|
||||
export declare function resolveLocalFont(definition: FontDefinition, projectRoot: string): Promise<ResolvedFontFamily>;
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
import type { ParsedFontFace } from './types.js';
|
||||
export declare function parseFontFaceCss(css: string): ParsedFontFace[];
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
import type { ResolvedFontFamily, FallbackMetrics } from './types.js';
|
||||
export declare function generateFontFace(family: ResolvedFontFamily, filePathMap: Map<string, string>): string;
|
||||
export declare function generateFallbackFontFace(fallbackFamily: string, metrics: FallbackMetrics): string;
|
||||
export declare function generateFontClassForFamily(family: ResolvedFontFamily): string;
|
||||
export declare function generateFontClasses(families: ResolvedFontFamily[]): string;
|
||||
export declare function generateCssVariables(families: ResolvedFontFamily[]): string;
|
||||
export declare function generateCssVariablesMap(families: ResolvedFontFamily[]): Record<string, string>;
|
||||
export declare function generateFamilyStyles(families: ResolvedFontFamily[], filePathMap: Map<string, string>, fallbackMap?: Map<string, {
|
||||
fallbackFamily: string;
|
||||
metrics: FallbackMetrics;
|
||||
}>): {
|
||||
familyStyles: Record<string, string>;
|
||||
variables: Record<string, string>;
|
||||
};
|
||||
export declare function generateFontCss(families: ResolvedFontFamily[], filePathMap: Map<string, string>, fallbackMap?: Map<string, {
|
||||
fallbackFamily: string;
|
||||
metrics: FallbackMetrics;
|
||||
}>): string;
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import type { IncomingMessage, ServerResponse } from 'http';
|
||||
import type { ResolvedFontFamily } from './types.js';
|
||||
export declare function buildDevUrlMap(families: ResolvedFontFamily[], devServerUrl: string): Map<string, string>;
|
||||
export declare function createFontMiddleware(): {
|
||||
middleware: (req: IncomingMessage, res: ServerResponse, next: () => void) => void;
|
||||
update: (families: ResolvedFontFamily[]) => void;
|
||||
};
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
import type { FallbackMetrics } from './types.js';
|
||||
export declare function generateFallbackMetrics(fontSource: string): Promise<FallbackMetrics | undefined>;
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export { local, google, bunny, fontsource } from './providers/providers.js';
|
||||
export type { FontDefinition, BaseFontOptions, LocalFontOptions, LocalVariantDefinition, RemoteFontOptions, FontsourceFontOptions, PreloadSelector, FontProviderType, FontFormat, FontStyle, RemoteFontStyle, FontWeight, FontDisplay, FontManifest, FontManifestPreload, FontManifestFamily, FontManifestVariant, FontManifestVariantFile, ResolvedFontFamily, ResolvedFontVariant, ResolvedFontFile, FallbackMetrics, ParsedFontFace, ParsedFontSrc, } from './types.js';
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
// src/fonts/config.ts
|
||||
var FORMATS = [
|
||||
{
|
||||
type: "woff2",
|
||||
extension: ".woff2"
|
||||
},
|
||||
{
|
||||
type: "woff",
|
||||
extension: ".woff"
|
||||
},
|
||||
{
|
||||
type: "ttf",
|
||||
extension: ".ttf"
|
||||
},
|
||||
{
|
||||
type: "otf",
|
||||
extension: ".otf"
|
||||
},
|
||||
{
|
||||
type: "eot",
|
||||
extension: ".eot"
|
||||
}
|
||||
];
|
||||
var FORMAT_PREFERENCE = FORMATS.map((f) => f.type);
|
||||
var FORMAT_MAP = Object.fromEntries(
|
||||
FORMATS.map((f) => [f.extension, f.type])
|
||||
);
|
||||
var SUPPORTED_EXTENSIONS = FORMATS.map((f) => f.extension);
|
||||
var SUPPORTED_GLOB = `*.{${SUPPORTED_EXTENSIONS.map((ext) => ext.slice(1)).join(",")}}`;
|
||||
function familyToSlug(family) {
|
||||
return family.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "");
|
||||
}
|
||||
function aliasToVariable(alias) {
|
||||
return "--font-" + alias;
|
||||
}
|
||||
function buildFontDefinition(family, provider, options, extra) {
|
||||
const alias = options?.alias ?? familyToSlug(family);
|
||||
return {
|
||||
family,
|
||||
alias,
|
||||
provider,
|
||||
variable: options?.variable ?? aliasToVariable(alias),
|
||||
weights: options?.weights ? [...options.weights] : [400],
|
||||
styles: options?.styles ?? ["normal"],
|
||||
subsets: options?.subsets ?? ["latin"],
|
||||
display: options?.display ?? "swap",
|
||||
preload: options?.preload ?? true,
|
||||
fallbacks: options?.fallbacks ?? [],
|
||||
optimizedFallbacks: options?.optimizedFallbacks ?? true,
|
||||
...extra
|
||||
};
|
||||
}
|
||||
|
||||
// src/fonts/providers/providers.ts
|
||||
function google(family, options) {
|
||||
return buildFontDefinition(family, "google", options);
|
||||
}
|
||||
function bunny(family, options) {
|
||||
return buildFontDefinition(family, "bunny", options);
|
||||
}
|
||||
function fontsource(family, options) {
|
||||
return buildFontDefinition(family, "fontsource", options, {
|
||||
_fontsource: { package: options?.package }
|
||||
});
|
||||
}
|
||||
function local(family, options) {
|
||||
const _local = "src" in options && options.src !== void 0 ? { src: options.src } : { variants: options.variants };
|
||||
return buildFontDefinition(family, "local", options, {
|
||||
weights: [],
|
||||
styles: [],
|
||||
subsets: [],
|
||||
_local
|
||||
});
|
||||
}
|
||||
export {
|
||||
bunny,
|
||||
fontsource,
|
||||
google,
|
||||
local
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
import type { FontManifest, ResolvedFontFamily } from './types.js';
|
||||
export declare function buildManifest(families: ResolvedFontFamily[], cssFile: string, filePathMap: Map<string, string>, familyStyles: Record<string, string>, variables: Record<string, string>): FontManifest;
|
||||
export declare function buildDevManifest(families: ResolvedFontFamily[], inlineCss: string, urlMap: Map<string, string>, familyStyles: Record<string, string>, variables: Record<string, string>): FontManifest;
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
import type { Plugin } from 'vite';
|
||||
import type { FontDefinition, ResolvedFontFamily } from './types.js';
|
||||
/** @internal Exported for tests; not part of the public plugin API. */
|
||||
export declare function assertFileRefsResolved(families: ResolvedFontFamily[], fileRefMap: Map<string, string>): void;
|
||||
export declare function resolveFontsPlugin(fonts: FontDefinition[] | undefined, hotFile: string, buildDirectory: string): Plugin[];
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
import type { FontDefinition, FontWeight, RemoteFontOptions, FontsourceFontOptions, LocalFontOptions } from '../types.js';
|
||||
export declare function google<const W extends FontWeight = FontWeight>(family: string, options?: RemoteFontOptions<W>): FontDefinition;
|
||||
export declare function bunny<const W extends FontWeight = FontWeight>(family: string, options?: RemoteFontOptions<W>): FontDefinition;
|
||||
export declare function fontsource<const W extends FontWeight = FontWeight>(family: string, options?: FontsourceFontOptions<W>): FontDefinition;
|
||||
export declare function local(family: string, options: LocalFontOptions): FontDefinition;
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
import type { FontDefinition, ResolvedFontFamily, ResolvedFontVariant } from '../types.js';
|
||||
export declare function resolveFontsourceVariants(definition: FontDefinition, projectRoot: string): ResolvedFontVariant[];
|
||||
export declare function resolveFontsourceFont(definition: FontDefinition, projectRoot: string): ResolvedFontFamily;
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
import type { FontDefinition, ResolvedFontFamily, ResolvedFontVariant } from '../types.js';
|
||||
export declare function buildCss2Url(baseUrl: string, definition: FontDefinition): string;
|
||||
export declare function resolveRemoteVariants(definition: FontDefinition, cacheDir: string, baseUrl: string): Promise<ResolvedFontVariant[]>;
|
||||
export declare function resolveRemoteFont(definition: FontDefinition, cacheDir: string, baseUrl: string): Promise<ResolvedFontFamily>;
|
||||
+195
@@ -0,0 +1,195 @@
|
||||
export type FormatConfig = {
|
||||
extension: string;
|
||||
type: FontFormat;
|
||||
};
|
||||
export type FontProviderType = 'local' | 'google' | 'bunny' | 'fontsource';
|
||||
export type FontFormat = 'woff2' | 'woff' | 'ttf' | 'otf' | 'eot';
|
||||
export type FontStyle = 'normal' | 'italic' | 'oblique';
|
||||
/**
|
||||
* Subset of FontStyle supported by remote providers (Google, Bunny, Fontsource).
|
||||
* The CSS2 / Fontsource APIs do not expose `oblique`.
|
||||
*/
|
||||
export type RemoteFontStyle = 'normal' | 'italic';
|
||||
export type FontWeight = number | string;
|
||||
export type FontDisplay = 'auto' | 'block' | 'swap' | 'fallback' | 'optional';
|
||||
export type PreloadSelector<W extends FontWeight = FontWeight> = {
|
||||
weight: W;
|
||||
/** @default 'normal' */
|
||||
style?: FontStyle;
|
||||
};
|
||||
export type BaseFontOptions<W extends FontWeight = FontWeight> = {
|
||||
/**
|
||||
* Used to reference font with `@fonts` Blade directive or programatically.
|
||||
* Defaults to a slug of the family name.
|
||||
*/
|
||||
alias?: string;
|
||||
/** Defaults to `--font-{alias}`. */
|
||||
variable?: string;
|
||||
/** @default [400] */
|
||||
weights?: readonly W[];
|
||||
/** @default ['normal'] */
|
||||
styles?: FontStyle[];
|
||||
/** @default ['latin'] */
|
||||
subsets?: string[];
|
||||
/** @default 'swap' */
|
||||
display?: FontDisplay;
|
||||
/**
|
||||
* - `true`: preload all WOFF2 variants (default)
|
||||
* - `false`: do not preload
|
||||
* - `[{ weight, style }]`: preload only matching variants.
|
||||
* When `weights` is a literal tuple, preload weights are type-narrowed
|
||||
* to its members.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
preload?: boolean | PreloadSelector<NoInfer<W>>[];
|
||||
/** @default [] */
|
||||
fallbacks?: string[];
|
||||
/**
|
||||
* Generate metric-optimized fallback font faces using fontaine.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
optimizedFallbacks?: boolean;
|
||||
};
|
||||
export type LocalVariantDefinition = {
|
||||
/** Path(s) relative to the project root. */
|
||||
src: string | string[];
|
||||
/** When omitted, inferred from filename. Defaults to 400 if no token found. */
|
||||
weight?: FontWeight;
|
||||
/** @default 'normal' — inferred from filename when omitted. */
|
||||
style?: FontStyle;
|
||||
};
|
||||
export type LocalFontOptions = Omit<BaseFontOptions, 'weights' | 'styles' | 'subsets'> & ({
|
||||
/** Explicit list of font variants. Mutually exclusive with `src`. */
|
||||
variants: LocalVariantDefinition[];
|
||||
src?: never;
|
||||
} | {
|
||||
/**
|
||||
* Shorthand: a file path, directory, or glob pattern.
|
||||
* Mutually exclusive with `variants`.
|
||||
*/
|
||||
src: string;
|
||||
variants?: never;
|
||||
});
|
||||
export type RemoteFontOptions<W extends FontWeight = FontWeight> = Omit<BaseFontOptions<W>, 'styles'> & {
|
||||
/** @default ['normal'] */
|
||||
styles?: RemoteFontStyle[];
|
||||
};
|
||||
export type FontsourceFontOptions<W extends FontWeight = FontWeight> = Omit<BaseFontOptions<W>, 'styles'> & {
|
||||
/** @default ['normal'] */
|
||||
styles?: RemoteFontStyle[];
|
||||
/** Defaults to `@fontsource/{family-slug}`. */
|
||||
package?: string;
|
||||
};
|
||||
export type FontDefinition = {
|
||||
family: string;
|
||||
alias: string;
|
||||
provider: FontProviderType;
|
||||
variable: string;
|
||||
weights: FontWeight[];
|
||||
styles: FontStyle[];
|
||||
subsets: string[];
|
||||
display: FontDisplay;
|
||||
preload: boolean | PreloadSelector[];
|
||||
fallbacks: string[];
|
||||
optimizedFallbacks: boolean;
|
||||
/** @internal */
|
||||
_local?: {
|
||||
variants: LocalVariantDefinition[];
|
||||
} | {
|
||||
src: string;
|
||||
};
|
||||
/** @internal */
|
||||
_fontsource?: {
|
||||
package?: string;
|
||||
};
|
||||
};
|
||||
export type ResolvedFontVariant = {
|
||||
weight: FontWeight;
|
||||
style: FontStyle;
|
||||
files: ResolvedFontFile[];
|
||||
};
|
||||
export type ResolvedFontFile = {
|
||||
source: string;
|
||||
format: FontFormat;
|
||||
unicodeRange?: string;
|
||||
};
|
||||
export type ResolvedFontFamily = {
|
||||
family: string;
|
||||
alias: string;
|
||||
variable: string;
|
||||
display: FontDisplay;
|
||||
optimizedFallbacks: boolean;
|
||||
fallbacks: string[];
|
||||
preload: boolean | PreloadSelector[];
|
||||
provider: FontProviderType;
|
||||
variants: ResolvedFontVariant[];
|
||||
};
|
||||
export type FontManifest = {
|
||||
version: 1;
|
||||
style: {
|
||||
file?: string;
|
||||
inline?: string;
|
||||
familyStyles: Record<string, string>;
|
||||
variables: Record<string, string>;
|
||||
};
|
||||
preloads: FontManifestPreload[];
|
||||
families: Record<string, FontManifestFamily>;
|
||||
};
|
||||
export type FontManifestPreload = {
|
||||
alias: string;
|
||||
family: string;
|
||||
weight: FontWeight;
|
||||
style: FontStyle;
|
||||
file?: string;
|
||||
url?: string;
|
||||
as: 'font';
|
||||
type: string;
|
||||
crossorigin: 'anonymous';
|
||||
};
|
||||
export type FontManifestFamily = {
|
||||
family: string;
|
||||
variable: string;
|
||||
fallbackFamily?: string;
|
||||
fallbacks?: string[];
|
||||
variants: Record<string, FontManifestVariant>;
|
||||
};
|
||||
export type FontManifestVariant = {
|
||||
files: FontManifestVariantFile[];
|
||||
};
|
||||
export type FontManifestVariantFile = {
|
||||
file?: string;
|
||||
url?: string;
|
||||
format: FontFormat;
|
||||
unicodeRange?: string;
|
||||
};
|
||||
export type FallbackMetrics = {
|
||||
localFont: string;
|
||||
ascentOverride: string;
|
||||
descentOverride: string;
|
||||
lineGapOverride: string;
|
||||
sizeAdjust: string;
|
||||
};
|
||||
export type FallbackCategory = 'sans-serif' | 'serif' | 'monospace';
|
||||
export type FallbackEntry = {
|
||||
localFont: string;
|
||||
ascent: number;
|
||||
descent: number;
|
||||
lineGap: number;
|
||||
unitsPerEm: number;
|
||||
xWidthAvg: number;
|
||||
};
|
||||
export type ParsedFontFace = {
|
||||
family: string;
|
||||
style: FontStyle;
|
||||
weight: FontWeight;
|
||||
src: ParsedFontSrc[];
|
||||
unicodeRange?: string;
|
||||
display?: string;
|
||||
};
|
||||
export type ParsedFontSrc = {
|
||||
url: string;
|
||||
format: FontFormat;
|
||||
};
|
||||
export declare const FORMAT_MIME: Record<FontFormat, string>;
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
import { Plugin, UserConfig, ConfigEnv, Rolldown } from 'vite';
|
||||
import { Config as FullReloadConfig } from 'vite-plugin-full-reload';
|
||||
import type { FontDefinition } from './fonts/types.js';
|
||||
interface PluginConfig {
|
||||
/**
|
||||
* The path or paths of the entry points to compile.
|
||||
*/
|
||||
input: Rolldown.InputOption;
|
||||
/**
|
||||
* Laravel's public directory.
|
||||
*
|
||||
* @default 'public'
|
||||
*/
|
||||
publicDirectory?: string;
|
||||
/**
|
||||
* The public subdirectory where compiled assets should be written.
|
||||
*
|
||||
* @default 'build'
|
||||
*/
|
||||
buildDirectory?: string;
|
||||
/**
|
||||
* The path to the "hot" file.
|
||||
*
|
||||
* @default `${publicDirectory}/hot`
|
||||
*/
|
||||
hotFile?: string;
|
||||
/**
|
||||
* The path of the SSR entry point.
|
||||
*/
|
||||
ssr?: Rolldown.InputOption;
|
||||
/**
|
||||
* The directory where the SSR bundle should be written.
|
||||
*
|
||||
* @default 'bootstrap/ssr'
|
||||
*/
|
||||
ssrOutputDirectory?: string;
|
||||
/**
|
||||
* Configuration for performing full page refresh on blade (or other) file changes.
|
||||
*
|
||||
* {@link https://github.com/ElMassimo/vite-plugin-full-reload}
|
||||
* @default false
|
||||
*/
|
||||
refresh?: boolean | string | string[] | RefreshConfig | RefreshConfig[];
|
||||
/**
|
||||
* Utilise the Herd or Valet TLS certificates.
|
||||
*
|
||||
* @default null
|
||||
*/
|
||||
detectTls?: string | boolean | null;
|
||||
/**
|
||||
* Utilise the Herd or Valet TLS certificates.
|
||||
*
|
||||
* @default null
|
||||
* @deprecated use "detectTls" instead
|
||||
*/
|
||||
valetTls?: string | boolean | null;
|
||||
/**
|
||||
* Transform the code while serving.
|
||||
*/
|
||||
transformOnServe?: (code: string, url: DevServerUrl) => string;
|
||||
/**
|
||||
* Asset file glob patterns to include in the build.
|
||||
*
|
||||
* Files matching these patterns will be processed and versioned by Vite,
|
||||
* even if they are not imported in your JavaScript. This is useful for
|
||||
* assets referenced in Blade templates via `Vite::asset()`.
|
||||
*
|
||||
* @default []
|
||||
*/
|
||||
assets?: string | string[];
|
||||
/**
|
||||
* Font configurations for automatic self-hosting and optimization.
|
||||
*
|
||||
* Use provider helpers from `laravel-vite-plugin/fonts`:
|
||||
* `local()`, `google()`, `bunny()`, `fontsource()`.
|
||||
*
|
||||
* @default []
|
||||
*/
|
||||
fonts?: FontDefinition[];
|
||||
}
|
||||
interface RefreshConfig {
|
||||
paths: string[];
|
||||
config?: FullReloadConfig;
|
||||
}
|
||||
interface LaravelPlugin extends Plugin {
|
||||
config: (config: UserConfig, env: ConfigEnv) => UserConfig;
|
||||
}
|
||||
type DevServerUrl = `${'http' | 'https'}://${string}:${number}`;
|
||||
export declare const refreshPaths: string[];
|
||||
/**
|
||||
* Laravel plugin for Vite.
|
||||
*
|
||||
* @param config - A config object or relative path(s) of the scripts to be compiled.
|
||||
*/
|
||||
export default function laravel(config: string | string[] | PluginConfig): [LaravelPlugin, ...Plugin[]];
|
||||
export {};
|
||||
+1603
File diff suppressed because it is too large
Load Diff
+1
@@ -0,0 +1 @@
|
||||
export declare function resolvePageComponent<T>(path: string | string[], pages: Record<string, Promise<T> | (() => Promise<T>)>): Promise<T>;
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
export async function resolvePageComponent(path, pages) {
|
||||
for (const p of (Array.isArray(path) ? path : [path])) {
|
||||
const page = pages[p];
|
||||
if (typeof page === 'undefined') {
|
||||
continue;
|
||||
}
|
||||
return typeof page === 'function' ? page() : page;
|
||||
}
|
||||
throw new Error(`Page not found: ${path}`);
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"name": "laravel-vite-plugin",
|
||||
"version": "3.1.0",
|
||||
"description": "Laravel plugin for Vite.",
|
||||
"keywords": [
|
||||
"laravel",
|
||||
"vite",
|
||||
"vite-plugin"
|
||||
],
|
||||
"homepage": "https://github.com/laravel/vite-plugin",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laravel/vite-plugin"
|
||||
},
|
||||
"license": "MIT",
|
||||
"author": "Laravel",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
},
|
||||
"./inertia-helpers": {
|
||||
"types": "./inertia-helpers/index.d.ts",
|
||||
"default": "./inertia-helpers/index.js"
|
||||
},
|
||||
"./fonts": {
|
||||
"types": "./dist/fonts/index.d.ts",
|
||||
"default": "./dist/fonts/index.js"
|
||||
}
|
||||
},
|
||||
"types": "./dist/index.d.ts",
|
||||
"files": [
|
||||
"/dist",
|
||||
"/inertia-helpers"
|
||||
],
|
||||
"bin": {
|
||||
"clean-orphaned-assets": "bin/clean.js"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "npm run build-plugin && npm run build-fonts && npm run build-inertia-helpers",
|
||||
"build-plugin": "rm -rf dist && npm run build-plugin-types && npm run build-plugin-esm && cp src/dev-server-index.html dist/",
|
||||
"build-plugin-types": "tsc --emitDeclarationOnly",
|
||||
"build-plugin-esm": "esbuild src/index.ts --bundle --platform=node --format=esm --outfile=dist/index.js --external:vite --external:vite-plugin-full-reload --external:picocolors --external:tinyglobby --external:fontaine",
|
||||
"build-fonts": "esbuild src/fonts/index.ts --bundle --platform=node --format=esm --outfile=dist/fonts/index.js",
|
||||
"build-inertia-helpers": "rm -rf inertia-helpers && tsc --project tsconfig.inertia-helpers.json",
|
||||
"lint": "eslint --ext .ts ./src ./tests",
|
||||
"test": "vitest run"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/eslintrc": "^3.3.1",
|
||||
"@eslint/js": "^9.30.1",
|
||||
"@types/node": "^20.19.0 || >=22.12.0",
|
||||
"@types/picomatch": "^4.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
||||
"@typescript-eslint/parser": "^8.0.0",
|
||||
"esbuild": "0.27.4",
|
||||
"eslint": "^9.0.0",
|
||||
"globals": "^16.3.0",
|
||||
"typescript": "^5.0.0",
|
||||
"vite": "^8.0.0",
|
||||
"vitest": "^3.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vite": "^8.0.0",
|
||||
"fontaine": "^0.5.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"fontaine": {
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"picocolors": "^1.0.0",
|
||||
"tinyglobby": "^0.2.12",
|
||||
"vite-plugin-full-reload": "^1.1.0"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user