Repository navigation
Releases: Fausto95/lucent
Release list
@lucent-lang/lucent@0.2.0
Minor Changes
-
#99
a36e7d8Thanks @Fausto95! -lucent doctorreads the app's build: the steps the last build failed at (an Android dependency conflict, with its log), why steps ran again, a platform this JavaScript was built without, and whether the newest Xcode or Gradle build of the app was built from these sources, judged as the app judges it -
#102
296d799Thanks @Fausto95! - Offer quick fixes in the editor where a diagnostic's fix is exact (a thrown string becomes an Error, a copied prop is read in place, a missing module import is added), and name what each SDK class and member calls natively in its doc comment, so hover andlucent sdk showsay where it comes from -
#103
733d318Thanks @Fausto95! - Every command's--jsonnow writes one JSON document described by a published schema (explain,new moduleandcleangained one), or is refused with exit code 2 by commands without JSON output (init,dev,trace), and errors under--jsongo to stderr instead of being dropped -
#88
cb08732Thanks @Fausto95! - Show a native view's children by condition ({cond && <X />},{c ? <X /> : <Y />}) and as keyed lists ({items.map((item) => <X key={item.id} />)}), keeping each kept item's view, and accept a quoted value for an Android setter prop (text="note") -
#97
c737a47Thanks @Fausto95! - Lay out native view JSX with React Native's Yoga:<Flex style={{ flexDirection: "row", gap: 8 }}>fromlucent:uiplaces its children, each child'slayout={{ flexGrow: 1 }}places it, and native containers (stack views, LinearLayouts) keep laying out their own -
#98
c896eb6Thanks @Fausto95! - Report coverage of every SDK module withlucent sdk coverage --all(modules the extractor cannot read are listed, not fatal), and append a markdown summary of why members are left out with--summary <file>
Patch Changes
-
#87
2bffa45Thanks @Fausto95! - Declare the initializers an iOS class inherits through a superclass that inherits them too (init(coder:)onUIWindowScene.ActivationAction) on every build, not only when the SDK's classes happen to be read in order -
#85
36064d4Thanks @brunokiafuka! - Keep every Swift overload of one name that a Swift overlay gives an Objective-C class:NSCoder.decodeTopLevelObject(forKey:)andRunLoop.schedule(after:tolerance:options:_:)were dropped beside their first overload. A Swiftinoutparameter is now skipped with its reason, instead of binding the member as if it took a value and generating a shim that does not compile. -
#92
9ced06cThanks @brunokiafuka! - Call an arrow function passed straight tosort,map,filter,forEach,reduceand the like directly, instead of through a function value:sortNumbersruns 1.4x faster, and generated code is smaller. -
#100
62b6f69Thanks @Fausto95! - Read uint32 values back out of anumber[]without mispredicting (crc32runs 1.8x faster), and index arrays with anumberwithout a C library call on x86-64 hosts without SSE4.1, which madesievefar slower on Linux CI. -
#93
93ecab0Thanks @brunokiafuka! - Keep arithmetic whose range is proven, such assum = (sum + x) % m, in integer registers:xorshiftruns 3x faster. Arithmetic that could give -0, NaN or a value past 2^53 stays a double. -
#90
eb6975bThanks @brunokiafuka! - Make strings cheaper: each is one allocation, or none up to 15 Latin-1 characters, and short strings compare and hash faster asMapkeys;joinallocates once. ThestringsandwordCountbenchmark kernels run 1.5–1.8x faster.
@lucent-lang/lucent@0.1.3
Patch Changes
-
#80
86500a7Thanks @brunokiafuka! - AdderrorOf(throwable)tolucent:android: theErrorLucent makes of a thrown Java exception (itscodethe class name,java.lang.IllegalStateException), for adapters whose callback API reports failure with aThrowable.reject(errorOf(e))now rejects as the call would have thrown. -
#64
fe9758dThanks @Fausto95! - Start everylucentcommand about 0.1 s sooner: Node keeps the compiled code of the CLI and TypeScript on disk between runs. -
#68
fbb8e10Thanks @Fausto95! - Bind the version of a native library installed now inlucent devand the editor: after apod installor a rebuilt Swift module, the next rebuild uses its new API instead of the one the process first read. -
#65
23cc5a1Thanks @Fausto95! - Letlucent build --platforms ios(orhost) succeed before the app's Android dependencies are resolved: imports of them in Android code are left untyped with a warning pointing to the Android build, instead of failing with LUCENT3004. -
#78
88cef84Thanks @Fausto95! - Bind Kotlin function types on Android: a(Double) -> Unitparameter, property or result is a TypeScript function instead of theFunction1class, so a Lucent function can be passed or assigned to it and a Kotlin function Lucent gets can be called. A property of a fun interface's type (any Java interface with one abstract method) now takes a function too, in module code, in a view's setup and as a JSX attribute. -
#79
04409e3Thanks @Fausto95! - Call more Kotlin shapes on Android: generic members whose type parameters have bounds (fun <T : Comparable<T>> top(items: List<T>)), with their defaults left out; assigning a value class property; and Lucent classes implementing a Kotlin interface's suspend members (the async method's promise resumes Kotlin) and members taking or giving value classes. Declarations of a class with a value class property are valid again: its accessors are namedgetBest, notgetBest-JdFk__0. -
#68
fbb8e10Thanks @Fausto95! - Say what to do when a native library's type has no member the code uses: the error names the module and the installed version (pod:Name@version) that declare the type, after a library update removed or renamed it. On iOS, for a type only named in another module's signatures, it says to import its module. -
#75
23704bdThanks @Fausto95! - Add--viewstolucent sdk coverage: with the internal views switch on (LUCENT_VIEWS=fabric), it lists each view class of a module as a JSX tag, how a tag makes it, the props and events its declarations give, whether it takes children, and what is left out and why. -
#64
fe9758dThanks @Fausto95! - Make eachlucent buildandlucent checkstart faster: the declarations of the SDK frameworks a project imports are kept in the SDK cache instead of written again by every run (a check importing UIKit: 1.9 s to 1 s). -
#64
fe9758dThanks @Fausto95! - Make rebuilds inlucent dev, checks in the editor and repeated builds faster: the declarations of the SDK frameworks a module imports are written once per process instead of for every compile. -
#81
d163b8fThanks @Fausto95! - Call each Swift initializer that differs from another only by its argument labels:init(service: String)andinit(accessGroup: String)becomeKeychain.withService(…)andKeychain.withAccessGroup(…)instead of twoconstructor(string)overloads, wherenew Keychain("x")silently called the first one declared;newwith such arguments is now an error naming the factories. An unlabeled initializer among them stays the constructor, as Swift calls it. CryptoKit's P256 keys and signatures are made withwithRawRepresentation(…),withX963Representation(…)and the like. -
#82
dd2a572Thanks @Fausto95! - Bind the Swift packages an app adds to its Xcode project: Lucent reads the project and Package.resolved, builds each package's library products at its pinned version for the simulator, binds their modules by rule, and links the ones the code imports into LucentNative (add the package to the project without adding its product to the app target, which would link it twice). iOS declarations are now read for the app's deployment target (IPHONEOS_DEPLOYMENT_TARGET), so an API the app's target already has no longer needs anavailable("ios", …)check, and one newer than it does. -
#83
10cfcfcThanks @Fausto95! - Bind more of what Swift declares on iOS: tuples (as TypeScript tuples, labels as element names), closures passed to or returned by Swift (as Lucent functions, through Objective-C blocks), Objective-C factory initializers Swift imports asinit(+widgetWithLabel:asnew Widget(label)), and C functions Swift imports as members of CoreFoundation-style handles (cgImage.width,cgImage.cropping(rect)).newof a class whose initializers come from a module no file imports now says to import that module. -
#68
fbb8e10Thanks @Fausto95! - Explain a native member Lucent does not bind: calling one the extractor skipped (a Swift tuple, say) now says it exists in the library, why it is not bound, and to wrap it in Swift or Kotlin of your own, rather than that the installed version lacks it. A member refused for a type that cannot cross yet (LUCENT2002) gets the same fix.
@lucent-lang/lucent@0.1.2
Patch Changes
-
#63
e160e7aThanks @Fausto95! - Build again where one platform's SDK is missing (Android on a machine without Xcode) when a module picks a value withPLATFORM === "ios" ? … : …: the host build no longer reports LUCENT2001 for the side it cannot type. -
#60
820fe5fThanks @Fausto95! - Makefor … ofover arrays of objects, strings or arrays faster: each element is moved into the loop's variable instead of copied. -
#63
e160e7aThanks @Fausto95! - Make builds, checks and the editor faster when modules import iOS frameworks: the names of the frameworks they reference are read from the SDK cache once per build instead of once per lookup. -
#60
820fe5fThanks @Fausto95! - Say to runpod installfirst when an iOS module isn't found and the app's pods haven't been installed yet, instead of naming only the SDK's frameworks. -
#63
e160e7aThanks @Fausto95! - Ask Xcode where the iOS SDK is once per process, instead of again for each build whose options differ.
@lucent-lang/lucent@0.1.1
Patch Changes
-
#56
cbe8cd1Thanks @Fausto95! - Compile a program that callscomputeand disposes an AndroidAutoCloseablewith[Symbol.dispose](), which crashed the compiler. -
#56
cbe8cd1Thanks @Fausto95! - Compile functions, methods and modules through Lucent's semantic IR, which checks evaluation order, types and control flow before it generates native code.
@lucent-lang/lucent@0.1.0
Minor Changes
-
#13
9031f4eThanks @Fausto95! - Give Android code the app's Activities.lucent:androidaddscurrentActivity()(the Activity in front, or null; Lucent holds Activities weakly),startActivityForResult(intent, signal?)andrequestPermissions(permissions, signal?)(promises settled once with the answer; aborting forgets the request, and a late answer is dropped), andonActivityEvent(event, handler)for the Activities' lifecycle and new intents. Requests go through a translucent Activity of Lucent's, so they work with any app Activity and survive it being recreated meanwhile. The native package's manifest declares it and a provider that starts tracking Activities with the process. Package manifest components may now set an activity'sthemeandconfigChanges. -
#13
9031f4eThanks @Fausto95! - Supportbigint: literals, every operator JavaScript has for it,BigInt(),BigInt.asIntNandasUintN,Number()andString()of a bigint, and bigints in collections, objects, classes, unions and async code. Values of any size cross the JavaScript boundary exactly, and loose==between a bigint and a number or string, which converts in JavaScript, is reported as LUCENT1002. -
#13
9031f4eThanks @Fausto95! - Turn callback APIs, such as a native listener, into promises and subscriptions withfromCallbackandsubscribefromlucent:core: each settles once, whichever callback or abort comes first, and runs the cleanup you return exactly once. -
#13
9031f4eThanks @Fausto95! - Say exactly what the app needs after a build.lucent buildlistsactions(also in--jsonand the build record): recompile native code, reload JavaScript, repackage resources, relink native dependencies or reinstall the app, each with its platforms and the files behind it. They come from what the build changed: a body edit recompiles, new exports also reload JavaScript, a package's resources are repackaged.lucent devnow watches Lucent packages outside the app (workspace or linked) whole, including theirlucent.jsonand native files, never rebuilds for what builds write, and stops a build a newer change made stale before it writes anything. Generated files are replaced whole, so Metro never reads half a proxy. Package files are hashed once while their size and times hold, and lucent build no longer starts a second Gradle run while another one resolves the classpath. -
#13
9031f4eThanks @Fausto95! - Run heavy work on worker threads withcompute(task, input, { signal })fromlucent:core. The task is a function declared at the top level of a module, taking one parameter, and runs on a bounded pool of workers without a second JavaScript runtime; the promise settles on the calling thread. The compiler checks everything the task runs (no module state, no main-thread or unknown native code, no function values it cannot follow, nothing asynchronous: LUCENT3011) and that its input and result are data (LUCENT3012), naming the path to what breaks the rule. The input is copied whencomputeis called, keeping aliases and cycles; aborting the signal rejects the promise at once, and a running task stops at the next iteration of a loop in the task or in a module function it calls (loops in closures, methods and generic functions, and native calls, run to their end first). The JavaScript version in@lucent-lang/lucent/corebehaves the same on the calling thread, for tests. -
#13
9031f4eThanks @Fausto95! - Recognize components: an exported function of a.lucent.tsxmodule that returns a platform view (a UIKitUIView, an AndroidView, or a subclass). React can't render them yet. Lucent now checks them and leaves them out of the module's JavaScript. It checks that the view comes back on every path, from one props object of plain data, with callback props namedon…that return nothing, and that setup code can run on the main thread. The new diagnostics areLUCENT3020toLUCENT3023.compile()lists each component undercomponents, identified by package, module path and export name. -
#13
9031f4eThanks @Fausto95! - Check iOS availability as Android's is checked: an Objective-C or Swift API newer than iOS 15.1 must be used underavailable("ios", major, minor?)(in anif, after an early exit, or in?:/&&), or the build fails with LUCENT3007 instead of crashing on older devices. Swift shims are marked@availablefrom what they call, so they compile against the deployment target. -
#13
9031f4eThanks @Fausto95! - Lucent classes can extend Objective-C classes on iOS, as they extend SDK classes on Android:class Greeting extends UIViewControlleris made with the base initializersuper(…)names, its methods override the base's (UIKit callingviewDidLoadruns the Lucent one),super.viewDidLoad()calls UIKit's, and inherited members such asthis.viewwork on the instance, which passes wherever the base type is taken. A generated Objective-C subclass stands for each instance; it and the Lucent object keep each other alive while either side uses them, without a cycle. Subclasses of main-thread classes are used on the main thread. -
#13
9031f4eThanks @Fausto95! - Native 64-bit integers are bigints: Java'slong(long[]asbigint[]),int64_t,uint64_t,NSInteger,NSUIntegerand Swift'sInt,Int64andUInt64, in arguments, results, properties, struct fields,Outs, callbacks and constants. Every native value is exact,NSNotFoundandLong.MAX_VALUEincluded, and a bigint the native type cannot hold throwsRangeErrornaming the parameter or field. Enums, option sets and@IntDef/@LongDefgroups stay numbers. Code that passes numbers to these APIs must pass bigints now (1000n,BigInt(n)), andNumber(list.count)turns a count or index back into a number. -
#13
9031f4eThanks @Fausto95! - Hand bytes between Lucent, compute tasks and JavaScript without copying them, withNativeBufferfromlucent:core.NativeBuffer.allocate(size)andNativeBuffer.from(bytes)make one;withRead(read)andwithWrite(write)lend a callback the bytes for one call as a span with aUint8Array's element semantics (reads share the buffer, a write needs it to itself, a conflicting borrow throws anInvalidStateError);transfer(), or passing the buffer tocompute, moves the bytes to a new owner and leaves every reference to the old buffer refusing them;toUint8Array()andfromare the only copies, andNativeBuffer.stats()counts them. The compiler keeps a span inside its callback (LUCENT3030: not returned, stored, captured by a closure that outlives the call, kept by a callee or held acrossawait) and reports a buffer used after it certainly moved (LUCENT3031). JavaScript receives a buffer as an opaque handle with the same methods, whose borrows lend it a copy, so it never holds memory a worker may be writing.Uint8Arraykeeps its copy semantics. -
#13
9031f4eThanks @Fausto95! - Add typed native extensions. A Lucent package declares one inlucent.json(extensions.<name>): a C header in native sources both platforms build, the opaque structs Lucent code holds as handles (their create, destroy, methods and thread), what pointer parameters are (bytes with their length, a UTF-8 string, an error struct) and how results report failure.lucent buildreads the header with clang, checks every name and shape against it, and fails naming the package and the field when they disagree. Lucent code, shared code included, imports the handles as classes and the functions by their C names fromlucent:ext/<name>: handles close once (close(),using, or their last reference), throwInvalidStateErrorafter, and cannot cross to JavaScript; a reported failure throws an Error with C's message and code; 64-bit integers are bigints; an exception escaping C ends the process at the call instead of unwinding through Lucent. The header must declare its functions inextern "C"for C++; a function taking a handle is bound only when the declaration names it; aclose()from another thread waits for the calls using the handle. Editors get the declarations from `.lucent/native/types/...
@lucent-lang/lucent@0.0.4
Patch Changes
-
#8
80aceabThanks @Fausto95! - Keepinstanceofworking for Lucent classes after an app reinstalls Lucent without a new JavaScript runtime: new instances now share their class's prototype. -
#7
edaff0eThanks @Fausto95! - Build the CLI and compiler with Vite+ (tsdown on Rolldown) instead of esbuild: the published package keeps the same files, and its JavaScript is about 5% smaller.