Skip to content
Lucent
SEARCH LUCENT

Search guides, APIs, and examples.

GitHub

Very early and experimental. The language, the generated native code and every package API change without notice. Do not use Lucent in production.

Install Lucent

Add one dev dependency, run lucent init to set the app up, and check the machine with lucent doctor.

You need React Native 0.88 or later, or Expo SDK 58 in a development build, and Node 22.12 or later.

terminal
npm i -D @lucent-lang/lucent
npx lucent init

lucent init shows each change as a diff and asks before applying it. In an Expo app, it:

  • wraps metro.config.js with withLucent, so Metro bundles each module as a proxy;
  • adds the @lucent-lang/lucent config plugin to app.json, which builds your modules during expo prebuild;
  • maps lucent:* imports and turns on noUncheckedIndexedAccess in tsconfig.json;
  • adds .lucent/ to .gitignore;
  • writes a first module, src/hello.lucent.ts, if the app has none.

Run npx lucent init --yes to apply every change without asking. Running it again changes nothing.

terminal
npx lucent doctor
terminal
◆ lucent doctor 0.0.3
✓ Node.js v24.16.0
✓ React Native 0.88.0
✓ Xcode 27.0
✓ CocoaPods 1.16.2
! JDK 27; React Native's Gradle build needs 17 to 21
fix set JAVA_HOME to JDK 17 or 21 (macOS: export JAVA_HOME=$(/usr/libexec/java_home -v 21))
✓ Metro config metro.config.js uses withLucent
1 warning

It checks Node, React Native, Xcode, CocoaPods, the Android SDK, NDK and JDK, the Metro config and the Gradle task. Each problem comes with its fix. The output above is shortened.

tsconfig.json
{
"compilerOptions": {
"plugins": [{ "name": "@lucent-lang/lucent/ts-plugin" }]
}
}

TypeScript accepts code that Lucent rejects, such as any. The plugin shows Lucent's errors as you type; lucent init doesn't add it. In VS Code, pick "Use Workspace Version" of TypeScript so the plugin loads.

Where a fix is exact, the plugin offers it as a quick fix: a thrown string becomes an Error, for one. Hovering over an SDK class or member shows what it calls natively, with or without the plugin: -[UIDevice batteryLevel], or android.os.Vibrator#vibrate(J)V. lucent sdk show UIKit.UIDevice.batteryLevel prints the same.