vite-plugin-react-server
Version:
Vite plugin for React Server Components (RSC)
55 lines • 2.34 kB
TypeScript
/**
* Gets all conditions from both NODE_OPTIONS and command-line arguments
*/
export declare const getAllConditions: () => string[];
export declare const detectReactConditionAmbiguity: () => string[];
export declare const warnIfAmbiguousReactConditions: () => void;
/**
* Gets the current condition, defaulting to "react-client" if no conditions are set
*/
export declare const getCurrentCondition: () => "react-server" | "react-client" | undefined;
/**
* Gets the condition with a custom prefix
*/
export declare const getCondition: <Prefix extends string = "react-", DefaultCondition extends `${Prefix}${string}` = `${Prefix}client`>(prefix?: Prefix, defaultReturn?: `${Prefix}server` | `${Prefix}client`) => `${Prefix}client` | `${Prefix}server` | DefaultCondition;
/**
* Asserts that the current condition is react-server
* Throws an error with a descriptive message if not
*/
export declare function assertReactServer(): asserts this is {
condition: "react-server";
};
export declare function assertNonReactServer(): asserts this is {
condition: "react-client";
};
/**
* Checks if the current condition is react-server (strict - requires both NODE_OPTIONS and execArgv)
* Use this for React Server DOM compatibility checks
*/
export declare const isReactServerCondition: () => boolean;
/**
* Checks if the current condition is react-client (strict - requires both NODE_OPTIONS and execArgv)
* Use this for React Server DOM compatibility checks
*/
export declare const isReactClientCondition: () => boolean;
/**
* Checks if react-server condition is present in either NODE_OPTIONS OR execArgv (lenient)
* Use this for plugin internal environment gating
*/
export declare const hasReactServerCondition: () => boolean;
/**
* Checks if react-client condition is present in either NODE_OPTIONS OR execArgv (lenient)
* Use this for plugin internal environment gating
*/
export declare const hasReactClientCondition: () => boolean;
/**
* Legacy function for backward compatibility
* @deprecated Use getAllConditions() instead
*/
export declare const getNodeOptionsConditions: () => string[];
/**
* Legacy export for backward compatibility
* @deprecated Use getCurrentCondition() instead
*/
export declare const condition: "react-server" | "react-client" | undefined;
//# sourceMappingURL=getCondition.d.ts.map