hyperlane-plugin-static-files 23.0.0

A high-performance static file server plugin for the Hyperlane framework with canonicalized path-traversal protection, built-in FileExtension MIME detection, 64-way sharded hot-file cache, precompressed .br/.gz sidecars, ETag/304 conditional validation, RFC 9110 Range 206/416 support, and SPA fallback.
Documentation
//! hyperlane-plugin-static-files
//!
//! High-performance static file serving plugin for Hyperlane with path-traversal
//! defense, Hyperlane [`FileExtension`] MIME detection, 64-way sharded hot-file
//! caching, `.br`/`.gz` precompressed sidecars, `ETag`/`304`, RFC 9110 `Range`
//! (`206`/`416`), and SPA fallback.

mod r#const;
mod r#fn;
mod r#impl;
mod r#static;
mod r#struct;
mod r#type;

#[cfg(test)]
#[path = "../tests/mod.rs"]
mod tests;

pub use {r#const::*, r#fn::*, r#struct::*};

pub(crate) use {r#static::*, r#type::*};

use std::{
    array::from_fn,
    borrow::Cow,
    collections::{HashMap, VecDeque},
    ffi::{OsStr, OsString},
    fs::{Metadata, canonicalize},
    hash::{BuildHasherDefault, Hasher},
    io,
    path::{Component, Path, PathBuf},
    str::{Split, from_utf8},
    sync::{
        Arc, OnceLock, RwLock, RwLockReadGuard,
        atomic::{AtomicUsize, Ordering},
    },
    time::{Duration, SystemTime, UNIX_EPOCH},
};

use {
    hyperlane::{
        ACCEPT_ENCODING, ACCEPT_RANGES, APPLICATION_JAVASCRIPT, APPLICATION_JSON,
        APPLICATION_OCTET_STREAM, APPLICATION_PDF, APPLICATION_WASM, APPLICATION_XML, AUDIO_MPEG,
        CACHE_CONTROL, CONTENT_ENCODING, CONTENT_RANGE, CONTENT_TYPE, Context, ETAG, FONT_OTF,
        FONT_TTF, FONT_WOFF, FONT_WOFF2, FileExtension, HttpStatus, IF_NONE_MATCH, IMAGE_GIF,
        IMAGE_JPEG, IMAGE_PNG, IMAGE_SVG_XML, IMAGE_WEBP, IMAGE_X_ICON, OK, RANGE, Request,
        Response, ResponseError, ServerHook, Status, Stream, TEXT_CSS, TEXT_HTML, TEXT_PLAIN, VARY,
        VIDEO_MP4, VIDEO_WEBM, tokio::fs,
    },
    lombok_macros::*,
};