Repository navigation
v3.1.4
Short-name aliases in Monaco + NewObject, plus the Linq .d.ts files are now reflection-generated from C# — no more hand-written declarations drifting from runtime. Pure additive, no breaking API changes.
Added
JsEvalBuilder.AddTypeAlias<T>("Name")— emitsTat root scope in.d.tsAND makesNewObject("Name")return the type at runtime. Single config, both layers.JsEvalBuilder.MapNamespace(prefix, target)— bulk-map a whole namespace tree. Empty target = full flatten (deeply nested sub-namespaces collapse to root too).System.*stays qualified by default.IJsTsDefinitionContributor— new extension point. Any package can contribute.d.tsfiles viaAddTsDefinitionContributor<T>()on the builder.AddLinq()is the first internal user.JsEvalBuilder.AddRuntimeOnlyExtensionMethods(...)— register extension methods with Jint for runtime resolution without pollutingTsDefinition's emitted.d.ts.- Standalone equivalents on
DefinitionBuilder—AddType(type, alias)andMapNamespace(...)for non-DI consumers.
Changed
linq.d.tsandcocoar-jseval-linq.d.tsare auto-emitted byAddLinq()viaTsDefinitionService.GetTsDefinitions(). Both reflection-generated from C# types —linq.d.tsfrom the newLinqGlobalclass,cocoar-jseval-linq.d.tsfromIJsStringAliases/IJsArrayAliases<T>metadata interfaces. No hand-written files left in the Linq package.linq.*return types now matchTsDefinition's output —linq.guid('…')isSystem.Guid, numeric helpers returnnumber. Previous versions referenced undeclaredGuid/Decimal/Longidentifiers that Monaco resolved toany.- PascalCase string/array aliases work at plain Jint runtime.
"abc".Contains('x')and[1,2,3].Any(x => x > 0)now resolve to real BCL /System.Linq.Enumerablemethods, not just inside translator-processed predicates. - Collision detection throws at render time when two distinct types resolve to the same short name — but only when a user rule is involved. Natural nested-type collisions (
Span<T>.Enumeratoretc.) keep the v3.1.3 interface-merging behavior.
Removed
LinqTypeScriptDefinitionhelper class (theRead()/WriteTo(path)methods). UseTsDefinitionService.GetTsDefinitions()— it now surfacescocoar-jseval-linq.d.tsandlinq.d.tsautomatically whenAddLinq()is on the builder.
Fixed
GitVersion.yml:is-main-branchwas pointing atmain, but the repo's trunk isdevelop. GitVersion fell through to theotherrule and emitted empty prerelease labels (3.1.3-.1). Now correctly marksdevelop.- Prerelease workflow: feature-branch prereleases use a
0.0.0-<label>.Nbase instead of inheriting GitVersion's predicted version, so a branch name can't silently imply a release target. Develop still uses the real version.
Example
services.AddJsEval(js => js
.AddLinq()
.MapNamespace("TimeToDo.Infrastructure.Persistence.Marten.Projections", "")
.MapNamespace("TimeToDo.Domain.Identity", ""));Monaco now shows CustomerView on hover instead of the 70-character namespace path, NewObject('CustomerView') returns the right type, and scripts that compare c.Id === linq.guid('…') type-check honestly.
Tests: 329 green (Engine 148, Linq 134, TypeScript 29, Modules 18).