one
Version:
One is a React framework for web, iOS, and Android apps.
77 lines (66 loc) • 2.92 kB
TypeScript
/// <reference types="vite/client" />
interface OneEnvVariables {
// Server
/** Set the port for both dev and serve. Lower priority than --port CLI flag. */
ONE_PORT: string
/** Override the port for both dev and serve. Takes precedence over --port and ONE_PORT. */
ONE_FORCE_PORT: string
// 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. The One platform contract. */
ONE_PLATFORM: 'web' | 'ios' | 'android'
/** Expo-compatible native platform. Undefined on web. */
EXPO_OS: 'ios' | 'android'
/** "web" for web builds, "native" for native builds. Used by Tamagui and One native route branches. */
TAMAGUI_TARGET: 'web' | 'native'
// 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
}
// a global declaration file: no top-level import or export, so these
// interfaces merge with vite/client and node, and the module declarations
// below are ambient rather than augmentations.
declare namespace NodeJS {
interface ProcessEnv extends Partial<OneEnvVariables> {}
}
interface ImportMetaEnv extends Partial<OneEnvVariables> {}
interface ImportMeta {
readonly env: ImportMetaEnv
}
// environment guard imports, side-effect only
declare module 'server-only' {}
declare module 'client-only' {}
declare module 'native-only' {}
declare module 'web-only' {}
// image metadata from ?imagedata imports; matches ImageData exported by 'one'
declare module '*?imagedata' {
const imageData: {
/** URL path to the image */
src: string
/** Image width in pixels */
width: number
/** Image height in pixels */
height: number
/** Base64 blur placeholder (10px wide) */
blurDataURL: string
}
export default imageData
}