vite-plugin-react-server
Version:
Vite plugin for React Server Components (RSC)
340 lines • 13.5 kB
TypeScript
import { parse } from "react-server-loader/transformer";
export declare const DIRECTIVE_CONFIGS: {
readonly client: {
readonly functionLevel: false;
readonly target: "client";
readonly validate: (params: {
code: string;
moduleId?: string;
index: number;
match: RegExpExecArray;
}) => boolean;
readonly warning: "'use client' directive is only allowed at the top of a file";
};
readonly server: {
readonly functionLevel: true;
readonly target: "server";
readonly validate: (params: {
code: string;
moduleId?: string;
index: number;
match: RegExpExecArray;
}) => boolean;
readonly warning: "File-level directives must be at the top of the file, before any other code";
};
};
export declare const getDirectiveType: (directive: string) => "client" | "server" | undefined;
export declare const MODE: string;
export declare const CONDITION: "react-server" | "react-client";
export declare const IS_SERVER: boolean;
export declare const IS_CLIENT: boolean;
export declare const IS_BUILD: boolean;
export declare const IS_SERVE: boolean;
export declare const DEFAULT_LOADER_CONFIG: {
readonly serverDirective: RegExp;
readonly clientDirective: RegExp;
readonly directivePattern: RegExp;
readonly isServerFunctionCode: (code: string, moduleId?: string) => boolean;
readonly isClientComponentCode: (code: string, moduleId?: string) => boolean;
readonly isClientComponentByCode: (code: string) => boolean;
readonly isClientComponentByName: (moduleId: string, _transformedModuleId?: string) => boolean;
readonly allowedDirectives: {
readonly client: {
readonly functionLevel: false;
readonly target: "client";
readonly validate: (params: {
code: string;
moduleId?: string;
index: number;
match: RegExpExecArray;
}) => boolean;
readonly warning: "'use client' directive is only allowed at the top of a file";
};
readonly server: {
readonly functionLevel: true;
readonly target: "server";
readonly validate: (params: {
code: string;
moduleId?: string;
index: number;
match: RegExpExecArray;
}) => boolean;
readonly warning: "File-level directives must be at the top of the file, before any other code";
};
};
readonly importServerPath: "react-server-dom-esm/server";
readonly importClientPath: "react-server-dom-esm/server";
readonly registerClientReferenceName: "registerClientReference";
readonly registerServerReferenceName: "registerServerReference";
readonly getDirectiveType: (directive: string) => "client" | "server" | undefined;
readonly parse: typeof parse;
readonly mode: "development" | "test" | "production";
readonly verbose: false;
readonly logger: import("vite").Logger;
readonly moduleID: (moduleId: string, _sourceContent?: string) => string;
};
export declare const BASE_PATTERNS: {
readonly MODULE: "\\.(m|c)?(j|t)sx?$";
readonly SERVER: "(?:\\.|\\/)?server(?:\\.(m|c)?(j|t)sx?)?$";
readonly CLIENT: "(?:\\.|\\/)?client(?:\\.(m|c)?(j|t)sx?)?$";
readonly PAGE: "(?:\\.|\\/)?(P|p)age(?:\\.(m|c)?(j|t)sx?)?$";
readonly PROPS: "(?:\\.|\\/)?props(?:\\.(m|c)?(j|t)sx?)?$";
readonly DIRECTIVE: "^\"use (client|server)\"[\\s;]*\\n?/m";
readonly VENDOR: "node_modules|@";
readonly VIRTUAL: "@";
readonly DOT_FILES: "\\.";
readonly EXT: {
readonly JS: ".js";
readonly CSS: ".css";
readonly CSS_MODULE: ".module.css.js";
readonly JSON: ".json";
readonly HTML: ".html";
readonly RSC: ".rsc";
readonly NODE: ".node";
};
};
export declare const DEFAULT_CONFIG: {
CLIENT_ASSETS_DIR: string;
RSC_DIR: string;
MODULE_BASE: string;
MODULE_BASE_PATH: string;
MODULE_BASE_URL: string;
PUBLIC_ORIGIN: string;
PAGE: string;
PROPS: string;
CLIENT_ENTRY: undefined;
SERVER_ENTRY: undefined;
PAGE_EXPORT_NAME: string;
PROPS_EXPORT_NAME: string;
HTML_EXPORT_NAME: string;
ROOT_EXPORT_NAME: string;
HTML_WORKER_PATH: string;
RSC_WORKER_PATH: string;
LOADER_PATH: string;
RSC_EXTENSION: string;
ROOT: undefined;
HTML: undefined;
ON_METRICS: undefined;
ON_EVENT: undefined;
DEV_PORT: number;
PREVIEW_PORT: number;
DEV_HOST: string;
PREVIEW_HOST: string;
ENV_PREFIX: string;
REACT_DIRECTIVES: Set<string>;
RSC_TIMEOUT: number;
HTML_TIMEOUT: number;
HTML_WORKER_STARTUP_TIMEOUT: number;
RSC_WORKER_STARTUP_TIMEOUT: number;
FILE_WRITE_TIMEOUT: number;
WORKER_SHUTDOWN_TIMEOUT: number;
COMPONENTS: {
Html: import("../types.js").HtmlComponentType<any, any, any, any>;
Root: import("../types.js").RootComponentType;
};
BUILD: {
pages: never[];
client: string;
server: string;
static: string;
api: string;
outDir: string;
assetsDir: string;
hash: string;
preserveModulesRoot: boolean;
rscOutputPath: string;
htmlOutputPath: string;
extensionMap: {
"\\.(m|c)?(j|t)sx?$": ".js";
"(?:\\.|\\/)?client(?:\\.(m|c)?(j|t)sx?)?$": ".js";
"(?:\\.|\\/)?server(?:\\.(m|c)?(j|t)sx?)?$": ".js";
".css": ".css";
".json": ".json";
".html": ".html";
".rsc": ".rsc";
".node": string;
".client": string;
".server": string;
};
moduleExtension: ".js";
jsExtension: ".js";
cssExtension: ".css";
htmlExtension: ".html";
jsonExtension: ".json";
rscExtension: ".rsc";
cssModuleExtension: ".module.css.js";
nodeExtension: ".node";
useRscWorker: boolean;
useHtmlWorker: boolean;
};
DEV: {
useHtmlWorker: boolean;
useRscWorker: boolean;
};
CSS: {
inlineCss: undefined;
purgeCss: boolean;
inlineThreshold: number;
inlinePatterns: RegExp[];
linkPatterns: RegExp[];
};
AUTO_DISCOVER: {
clientEntry: string;
serverEntry: string;
cssEntry: string;
jsonEntry: string;
htmlEntry: string;
modulePattern: RegExp;
serverPattern: RegExp;
clientPattern: RegExp;
pagePattern: RegExp;
propsPattern: RegExp;
cssPattern: RegExp;
jsonPattern: RegExp;
htmlPattern: RegExp;
rscPattern: RegExp;
nodeOnly: RegExp;
cssModulePattern: RegExp;
vendorPattern: RegExp;
virtualPattern: RegExp;
dotFiles: RegExp;
};
MODULE_ID: (id: string) => string;
VERBOSE: boolean;
PANIC_THRESHOLD: "critical_errors" | "all_errors";
RSC_LOADER: {
development: {
mode: "development";
serverDirective: RegExp;
clientDirective: RegExp;
directivePattern: RegExp;
isServerFunctionCode: (code: string, moduleId?: string) => boolean;
isClientComponentCode: (code: string, moduleId?: string) => boolean;
isClientComponentByCode: (code: string) => boolean;
isClientComponentByName: (moduleId: string, _transformedModuleId?: string) => boolean;
allowedDirectives: {
readonly client: {
readonly functionLevel: false;
readonly target: "client";
readonly validate: (params: {
code: string;
moduleId?: string;
index: number;
match: RegExpExecArray;
}) => boolean;
readonly warning: "'use client' directive is only allowed at the top of a file";
};
readonly server: {
readonly functionLevel: true;
readonly target: "server";
readonly validate: (params: {
code: string;
moduleId?: string;
index: number;
match: RegExpExecArray;
}) => boolean;
readonly warning: "File-level directives must be at the top of the file, before any other code";
};
};
importServerPath: "react-server-dom-esm/server";
importClientPath: "react-server-dom-esm/server";
registerClientReferenceName: "registerClientReference";
registerServerReferenceName: "registerServerReference";
getDirectiveType: (directive: string) => "client" | "server" | undefined;
parse: typeof parse;
verbose: false;
logger: import("vite").Logger;
moduleID: (moduleId: string, _sourceContent?: string) => string;
};
test: {
importServerPath: string;
importClientPath: string;
mode: "test";
serverDirective: RegExp;
clientDirective: RegExp;
directivePattern: RegExp;
isServerFunctionCode: (code: string, moduleId?: string) => boolean;
isClientComponentCode: (code: string, moduleId?: string) => boolean;
isClientComponentByCode: (code: string) => boolean;
isClientComponentByName: (moduleId: string, _transformedModuleId?: string) => boolean;
allowedDirectives: {
readonly client: {
readonly functionLevel: false;
readonly target: "client";
readonly validate: (params: {
code: string;
moduleId?: string;
index: number;
match: RegExpExecArray;
}) => boolean;
readonly warning: "'use client' directive is only allowed at the top of a file";
};
readonly server: {
readonly functionLevel: true;
readonly target: "server";
readonly validate: (params: {
code: string;
moduleId?: string;
index: number;
match: RegExpExecArray;
}) => boolean;
readonly warning: "File-level directives must be at the top of the file, before any other code";
};
};
registerClientReferenceName: "registerClientReference";
registerServerReferenceName: "registerServerReference";
getDirectiveType: (directive: string) => "client" | "server" | undefined;
parse: typeof parse;
verbose: false;
logger: import("vite").Logger;
moduleID: (moduleId: string, _sourceContent?: string) => string;
};
production: {
mode: "production";
serverDirective: RegExp;
clientDirective: RegExp;
directivePattern: RegExp;
isServerFunctionCode: (code: string, moduleId?: string) => boolean;
isClientComponentCode: (code: string, moduleId?: string) => boolean;
isClientComponentByCode: (code: string) => boolean;
isClientComponentByName: (moduleId: string, _transformedModuleId?: string) => boolean;
allowedDirectives: {
readonly client: {
readonly functionLevel: false;
readonly target: "client";
readonly validate: (params: {
code: string;
moduleId?: string;
index: number;
match: RegExpExecArray;
}) => boolean;
readonly warning: "'use client' directive is only allowed at the top of a file";
};
readonly server: {
readonly functionLevel: true;
readonly target: "server";
readonly validate: (params: {
code: string;
moduleId?: string;
index: number;
match: RegExpExecArray;
}) => boolean;
readonly warning: "File-level directives must be at the top of the file, before any other code";
};
};
importServerPath: "react-server-dom-esm/server";
importClientPath: "react-server-dom-esm/server";
registerClientReferenceName: "registerClientReference";
registerServerReferenceName: "registerServerReference";
getDirectiveType: (directive: string) => "client" | "server" | undefined;
parse: typeof parse;
verbose: false;
logger: import("vite").Logger;
moduleID: (moduleId: string, _sourceContent?: string) => string;
};
};
REACT_LOADER_PATH: string;
CSS_LOADER_PATH: string;
ENV_LOADER_PATH: string;
};
//# sourceMappingURL=defaults.d.ts.map