one
Version:
One is a new React Framework that makes Vite serve both native and web.
52 lines (43 loc) • 1.91 kB
TypeScript
/// <reference types="vite/client" />
interface OneEnvVariables {
// Core One variables
/** Random number for each production build, or stable per dev server run. Useful for cache keys. */
ONE_CACHE_KEY: string
/** Your app.key setting from vite.config */
ONE_APP_NAME: string
/** Current running server URL in development, e.g. "http://0.0.0.0:8081". Set this yourself for production. */
ONE_SERVER_URL: string
/** "ssr", "ssg", or "spa" based on your defaultRenderMode setting */
ONE_DEFAULT_RENDER_MODE: 'ssr' | 'ssg' | 'spa'
/** The render mode of the current page being rendered. Set before the setup file runs so you can conditionally skip setup logic for certain modes. */
ONE_RENDER_MODE: 'ssr' | 'ssg' | 'spa'
// Platform detection
/** "client" for client-side web, "ssr" for server-side web, "ios" or "android" for native */
VITE_ENVIRONMENT: 'client' | 'ssr' | 'ios' | 'android'
/** "1" for native platforms (iOS and Android), "" for web (client and SSR). Truthy/falsy for tree-shaking native-only code. */
VITE_NATIVE: '' | '1'
/** "web" for web builds, "ios" or "android" for native. Matches Expo convention. */
EXPO_OS: 'web' | 'ios' | 'android'
// React Native (available in native builds)
/** The React Native version string */
REACT_NATIVE_VERSION: string
/** "ios" or "android" in native builds */
REACT_NATIVE_PLATFORM: 'ios' | 'android'
/** Dev server port for React Native */
REACT_NATIVE_SERVER_PUBLIC_PORT: string
}
declare global {
namespace NodeJS {
interface ProcessEnv extends Partial<OneEnvVariables> {}
}
}
interface ImportMetaEnv extends Partial<OneEnvVariables> {}
interface ImportMeta {
readonly env: ImportMetaEnv
}
export {}
// environment guard imports — side-effect-only, no exports
declare module 'server-only' {}
declare module 'client-only' {}
declare module 'native-only' {}
declare module 'web-only' {}