/** * @public */ export declare type AddOutputFilterByTypeSpec = Array<{ filters: Array; mediaTypes: Array; }>; /** * @public */ export declare type ContentSecurityPolicySandboxValue = "allow-downloads-without-user-activation Experimental" | "allow-downloads" | "allow-forms" | "allow-modals" | "allow-orientation-lock" | "allow-pointer-lock" | "allow-popups-to-escape-sandbox" | "allow-popups" | "allow-presentation" | "allow-same-origin" | "allow-scripts" | "allow-storage-access-by-user-activation Experimental" | "allow-top-navigation-by-user-activation" | "allow-top-navigation-to-custom-protocols" | "allow-top-navigation" | null; /** * @public */ export declare type ContentSecurityPolicySourceDirective = "base-uri" | "connect-src" | "default-src" | "fenced-frame-src" | "font-src" | "form-action" | "frame-ancestors" | "frame-src" | "img-src" | "manifest-src" | "media-src" | "object-src" | "script-src-attr" | "script-src-elem" | "script-src" | "style-src-attr" | "style-src-elem" | "style-src" | "worker-src"; /** * @public */ export declare interface ContentSecurityPolicySources { hashes?: { sha256?: Array; sha384?: Array; sha512?: Array; }; hosts?: Array; "inline-speculation-rules"?: boolean; nonces?: Array; "report-sample"?: boolean; schemes?: { blob?: boolean; data?: boolean; filesystem?: boolean; mediastream?: boolean; }; self?: boolean; "strict-dynamic"?: boolean; "unsafe-eval"?: boolean; "unsafe-hashes"?: boolean; "unsafe-inline"?: boolean; "wasm-unsafe-eval"?: boolean; } /** * @public */ export declare type ContentSecurityPolicySpec = Partial & { "report-to": string; /** * @deprecated The report-uri directive is deprecated and it's recommended to send CSP reports using report-to instead. */ "report-uri": Array; "require-trusted-types-for": "script"; sandbox: ContentSecurityPolicySandboxValue; "trusted-types": ContentSecurityPolicyTrustedTypesValue; "upgrade-insecure-requests": boolean; }>; /** * @public */ export declare interface ContentSecurityPolicyTrustedTypesValue { "allow-duplicates"?: boolean; policies?: Array; } /** * @public */ export declare interface DirectorySlashSpec { value: boolean; } /** * @public */ export declare type ErrorDocumentSpec = Record; /** * @public */ export declare interface ExtractMetaCSPEnabledOptions { defaultPolicyFile?: string; enabled: true; outputDir?: string; perFilePolicyFiles?: Array; } /** * @public */ export declare type ExtractMetaCSPOptions = { enabled: false; } | ExtractMetaCSPEnabledOptions; /** * @public */ export declare interface FilesMatchSpec { innerSpec: Spec; regex: string; } /** * @public */ export declare interface FilesSpec { fileName: string; innerSpec: Spec; } /** * @public */ export declare type HeaderSpec = ({ action: "add" | "append" | "merge" | "set" | "setifempty"; value: HeaderValueSpecMap[T]; } | { action: "echo" | "note" | "unset"; } | { action: "edit" | "edit*"; replacement: string; value: string; }) & { always?: boolean; condition?: { envVar: string; requireUnset?: boolean; } | { expression: string; }; header: T; }; /** * @public */ export declare type HeaderSpecUnion = { [K in keyof HeaderValueSpecMap]: HeaderSpec; }[keyof HeaderValueSpecMap]; /** * @public */ export declare interface HeaderValueSpecMap { "Content-Security-Policy": ContentSecurityPolicySpec; "Permissions-Policy": PermissionsPolicySpec; "Referrer-Policy": ReferrerPolicySpec; "Strict-Transport-Security": StrictTransportSecuritySpec; "X-Content-Type-Options": XContentTypeOptionsSpec; /** * @deprecated The Content-Security-Policy HTTP header has a frame-ancestors directive which obsoletes this header for supporting browsers. */ "X-Frame-Options": XFrameOptionsSpec; /** * @deprecated This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. */ "X-Xss-Protection": XXssProtectionSpec; } /** * @public */ declare function htaccess(opts?: Partial): HtaccessPlugin; export default htaccess; /** * @public */ export declare interface HtaccessPlugin { closeBundle?: PluginHook<(this: PluginContext) => Promise>; configResolved?: PluginHook<(config: { root: string; }) => void>; generateBundle?: PluginHook<(this: PluginContext) => Promise>; name: string; renderStart?: PluginHook<(outputOptions: OutputOptions) => void>; } /** * @public */ export declare interface IfDefineSpec { innerSpec: Spec; inverted?: boolean; parameterName: string; } /** * @public */ export declare interface IfDirectiveSpec { directiveName: string; innerSpec: Spec; inverted?: boolean; } /** * @public */ export declare interface IfFileSpec { fileName: string; innerSpec: Spec; inverted?: boolean; } /** * @public */ export declare interface IfModuleSpec { innerSpec: Spec; inverted?: boolean; moduleNameOrIdentifier: string; } /** * @public */ export declare interface IfSectionSpec { innerSpec: Spec; inverted?: boolean; sectionName: string; } /** * @public */ export declare interface IfSpec { condition: string; Else?: { innerSpec: Spec; }; ElseIf?: Array<{ condition: string; innerSpec: Spec; }>; innerSpec: Spec; } /** * @public */ export declare interface MetadataRewriteRuleFlags { env?: { value: string | null; variable: string; }; handler?: string; type?: string; } /** * @public */ export declare type OptionName = "All" | "ExecCGI" | "FollowSymLinks" | "Includes" | "IncludesNOEXEC" | "Indexes" | "MultiViews" | "SymLinksIfOwnerMatch"; /** * @public */ export declare interface Options { extractMetaCSP: ExtractMetaCSPOptions; fileName: string; spec: Spec; template: string | undefined; } /** * @public */ export declare type OptionsSpec = "None" | { minus?: Array | undefined; plus?: Array | undefined; } | { set: Array; }; /** * @public */ export declare interface OutputOptions { dir: string | undefined; } /** * @public */ export declare type PermissionsPolicyAllowlist = "*" | { origins?: Array; self?: boolean; src?: boolean; }; /** * @public */ export declare type PermissionsPolicyDirectives = "accelerometer" | "ambient-light-sensor" | "attribution-reporting" | "autoplay" | "battery" | "bluetooth" | "camera" | "compute-pressure" | "display-capture" | "document-domain" | "encrypted-media" | "execution-while-not-rendered" | "execution-while-out-of-viewport" | "fullscreen" | "gamepad" | "geolocation" | "gyroscope" | "hid" | "identity-credentials-get" | "idle-detection" | "local-fonts" | "magnetometer" | "microphone" | "midi" | "otp-credentials" | "payment" | "picture-in-picture" | "publickey-credentials-create" | "publickey-credentials-get" | "screen-wake-lock" | "serial" | "speaker-selection" | "storage-access" | "usb" | "web-share" | "window-management" | "xr-spatial-tracking"; /** * @public */ export declare type PermissionsPolicySpec = Partial>; /** * @public */ export declare interface PluginContext { emitFile(emittedFile: { fileName?: string; source?: string; type: "asset"; }): string; error(error: string): never; } /** * @public */ export declare type PluginHook = { handler: T; order?: "post" | "pre"; sequential?: boolean; } | T; /** * @public */ export declare type ReferrerPolicySpec = "no-referrer-when-downgrade" | "no-referrer" | "origin-when-cross-origin" | "origin" | "same-origin" | "strict-origin-when-cross-origin" | "strict-origin" | "unsafe-url"; /** * @public */ export declare interface RewriteCondSpec { conditionPattern: string; flags?: { nocase?: boolean; novary?: boolean; ornext?: boolean; }; testString: string; } /** * @public */ export declare interface RewriteOptionsSpec { AllowAnyURI?: boolean; AllowNoSlash?: boolean; IgnoreContextInfo?: boolean; IgnoreInherit?: boolean; Inherit?: boolean; InheritDown?: boolean; InheritDownBefore?: boolean; LegacyPrefixDocRoot?: boolean; MergeBase?: boolean; } /** * @public */ export declare interface RewriteRuleCookieFlagMinimalSpec { domain: string; name: string; value: string; } /** * @public */ export declare type RewriteRuleCookieFlagSpec = RewriteRuleCookieFlagMinimalSpec & ({ httponly?: boolean | undefined; lifetime?: number | undefined; path?: string | undefined; samesite?: "Lax" | "None" | "Strict" | undefined; secure?: boolean | undefined; } | { httponly?: boolean | undefined; lifetime?: number | undefined; path?: string | undefined; secure?: boolean | undefined; } | { lifetime?: number | undefined; } | { lifetime?: number | undefined; path?: string | undefined; } | { lifetime?: number | undefined; path?: string | undefined; secure?: boolean | undefined; }); /** * @public */ export declare type RewriteRuleSpec = { conditions?: Array; pattern: string; } & ({ flags?: MetadataRewriteRuleFlags & StandardRewriteRuleFlags; substitution: null; } | { flags?: StandardRewriteRuleFlags; substitution: string; }); /** * @public */ export declare interface RewriteSpec { base?: string; options?: RewriteOptionsSpec; rules?: Array; } /** * @public */ export declare interface Spec { AddOutputFilterByType?: AddOutputFilterByTypeSpec; DirectorySlash?: DirectorySlashSpec; ErrorDocument?: ErrorDocumentSpec; Files?: Array; FilesMatch?: Array; Header?: Array; If?: Array; IfDefine?: Array; IfDirective?: Array; IfFile?: Array; IfModule?: Array; IfSection?: Array; Options?: OptionsSpec; rewrite?: RewriteSpec; } /** * @public */ export declare interface StandardRewriteRuleFlags { B?: boolean | string; backrefnoplus?: boolean; BCTLS?: boolean; BNE?: string; chain?: boolean; cookie?: RewriteRuleCookieFlagSpec; discardpath?: boolean; END?: boolean; forbidden?: boolean; gone?: boolean; last?: boolean; next?: boolean; nocase?: boolean; noescape?: boolean; nosubreq?: boolean; proxy?: boolean; qsappend?: boolean; qsdiscard?: boolean; qslast?: boolean; redirect?: number | string; skip?: number; UnsafeAllow3F?: boolean; UnsafePrefixStat?: boolean; } /** * @public */ export declare interface StrictTransportSecuritySpec { includeSubDomains?: boolean; maxAge: number; preload?: boolean; } /** * @public */ export declare interface XContentTypeOptionsSpec { nosniff: true; } /** * @public * @deprecated The Content-Security-Policy HTTP header has a frame-ancestors directive which obsoletes this header for supporting browsers. */ export declare type XFrameOptionsSpec = "deny" | "sameorigin"; /** * @public * @deprecated This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. */ export declare type XXssProtectionSpec = { mode: "block"; } | { mode: "disabled"; } | { mode: "sanitize"; reportUri?: string; }; export { }