/** * This file contains a collection of plugins used for the bundler. * Plugins defined here can extend or modify the behavior of the bundling process, * such as adding lifecycle hooks or custom processing logic. */ import { type LifecyclePlugin } from '@scalar/json-magic/bundle'; /** * A lifecycle plugin that adds a `$status` property to nodes during resolution. * - Sets `$status` to 'loading' when resolution starts. * - Sets `$status` to 'error' if resolution fails. * - Removes `$status` when resolution succeeds. */ export declare const loadingStatus: () => LifecyclePlugin; /** * Lifecycle plugin to resolve and embed external content referenced by an 'externalValue' property in a node. * * When a node contains an 'externalValue' property (as a string), this plugin will: * - Fetch the external resource (such as a URL or file) using the fetchUrls plugin. * - If the fetch is successful, assign the fetched data to the node's 'value' property. * * This is useful for inlining external content (like examples or schemas) into the OpenAPI document during bundling. * * In lazy mode, preserve the absolute URL for on-demand client resolution without fetching a payload. * The default eager mode remains available to existing bundler consumers. */ export declare const externalValueResolver: (options?: { lazy?: boolean; }) => LifecyclePlugin; /** * Lifecycle plugin to resolve $ref on any object, including non-standard locations like the info object. * * This plugin will: * - Detect if a node contains a $ref property (as a string). * - If the node is under the 'info' path, attempt to resolve the reference using fetchUrls. * - Replace the node's properties with the resolved data if successful. * * Note: This currently only supports refs on the 'info' object and does not handle primitive types. */ export declare const refsEverywhere: () => LifecyclePlugin; /** * Lifecycle plugin to restore original $ref values after processing. * * This plugin is intended to be used as a "lifecycle" plugin in the bundling process. * It operates in the `onAfterNodeProcess` hook, and its main purpose is to restore * the original $ref values for external references that may have been replaced or * rewritten during the bundling process. * * How it works: * - For each node processed, if the node contains a $ref property (as a string), * and the root document contains an "x-ext-urls" mapping object, * the plugin will attempt to restore the original $ref value. * - The "x-ext-urls" object is expected to be a mapping from the rewritten $ref * (e.g., a hashed or compressed reference) back to the original external URL or path. * - If a mapping exists for the current $ref, the plugin replaces the $ref value * with the original value from the mapping. If no mapping exists (e.g., for local refs), * the $ref value is left unchanged. * * This is useful for scenarios where you want to present or export the bundled document * with the original external $ref values, rather than the internal or rewritten ones. * * @returns {LifecyclePlugin} The plugin object for use in the bundler. */ export declare const restoreOriginalRefs: () => LifecyclePlugin; /** * Lifecycle plugin to normalize the `scheme` property in securitySchemes to lowercase. * * Our typebox schemas require the `scheme` property to be a lowercase string. * This plugin ensures that any `scheme` field under `components.securitySchemes` is normalized to lowercase, fixing * potential user input errors such as "Bearer" or "BASIC". * * Example: * ```yaml * Before normalization: * components: * securitySchemes: * bearerAuth: * type: http * scheme: Bearer * ``` * After normalization: * ```yaml * components: * securitySchemes: * bearerAuth: * type: http * scheme: bearer * ``` */ export declare const normalizeAuthSchemes: () => LifecyclePlugin; /** * Lifecycle plugin to normalize $ref nodes: * Ensures that for any OpenAPI Reference Object containing a $ref, only $ref, * summary, description, and $status properties are preserved. * This keeps $ref references clean and predictable for downstream consumers. * * Schema Objects are deliberately skipped: in JSON Schema 2020-12 a $ref may * carry sibling keywords, so their siblings must not be stripped. */ export declare const normalizeRefs: () => LifecyclePlugin; /** * Lifecycle plugin to sync path parameters for all operations under a path item. * * When processing a path item (e.g., '/users/{id}'), this plugin will: * - Extract path variables from the path string * - For each HTTP method operation (get, post, put, delete, etc.) * - Sync the operation's parameters to match the path variables * - Preserve existing parameter configurations when possible * * This ensures that path parameters are always in sync with the path string, * even after bundling or other transformations. */ export declare const syncPathParameters: () => LifecyclePlugin; /** * Lifecycle plugin to remove extra Scalar internal keys from nodes. * * This plugin is used to remove extra Scalar internal keys from nodes during the bundling process. * These keys are used for internal purposes and are not needed in the final bundled document. */ export declare const removeExtraScalarKeys: () => LifecyclePlugin; export { openApiDocument, resolveOpenApiDocument } from './openapi-document.js'; //# sourceMappingURL=index.d.ts.map