Registry / serialization / metano-runtime

metano-runtime

JSON →
library1.0.3jsnpmunverified

Runtime support library for code generated by the Metano C# → TypeScript transpiler (v1.0.3, updated April 2026). Provides C#-compatible primitives such as HashCode (xxHash32), HashSet with structural equality, a full LINQ API via Enumerable, a branded UUID type for System.Guid mapping, runtime type guards (isInt32, isString, etc.), and JSON serialization (system/json). Release cadence is active (multiple versions per month). Key differentiator: automatically added by Metano to generated projects; side-effect-free for tree-shaking. Requires @typescript/native-preview (peer dep). Only relevant for Metano users; not designed for general-purpose use.

npm install metano-runtime
INSTALL
IMPORT
SIG · METANO-RUNTIME
M
metano-runtime
serializationjavascriptv1.0.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

HashCode
import { HashCode } from 'metano-runtime'
import HashCode from 'metano-runtime'
Named export, not default. ESM-only (no CJS). Types included.
HashSet
import { HashSet } from 'metano-runtime'
const { HashSet } = require('metano-runtime')
Named export. Not available via default import. Requires peer dep @typescript/native-preview for generics.
Enumerable
import { Enumerable } from 'metano-runtime'
import { Enumerable } from 'metano-runtime/enumerable'
Export is from top-level package, not subpath. Provides .NET-like LINQ operations.
UUID
import { UUID } from 'metano-runtime'
import { Uuid } from 'metano-runtime'
Case-sensitive: 'UUID' in all caps. Branded string type.
JsonSerializer
import { JsonSerializer } from 'metano-runtime/system/json'
import { JsonSerializer } from 'metano-runtime'
Located under 'system/json' subpath; not exported from main entry point.

Demonstrates core runtime features: HashCode, HashSet, Enumerable, UUID, and int32 type guard.

import { HashCode, HashSet, Enumerable, UUID, isInt32 } from 'metano-runtime'; // HashCode usage const hc = new HashCode(); hc.add('hello'); hc.add(42); const hash = hc.toHashCode(); // number // HashSet with structural equality class Point { constructor(readonly x: number, readonly y: number) {} equals(other: Point) { return this.x === other.x && this.y === other.y; } hashCode() { const hc = new HashCode(); hc.add(this.x); hc.add(this.y); return hc.toHashCode(); } } const set = new HashSet<Point>(); set.add(new Point(1, 2)); console.log(set.has(new Point(1, 2))); // true // Enumerable (LINQ) const result = Enumerable.from([1, 2, 3, 4, 5]) .where(x => x > 1) .select(x => x * 2) .toArray(); // [4, 6, 8, 10] // UUID const id = UUID.newUuid(); console.log(id); // "550e8400-e29b-41d4-a716-446655440000" if (UUID.isUuid(id)) { console.log('valid UUID'); } // Type guard console.log(isInt32(123)); // true console.log(isInt32(1.5)); // false
Debug
Known issues
gotchaThis library is auto-installed by the Metano transpiler; manual use is discouraged. The public API is unstable across Metano versions.
fix
Only consume via generated code; do not depend on it directly.
affects: <1.0.0
deprecatedThe 'Erasable' annotation was renamed to 'NoContainer' in v1.0.0.
fix
Use [NoContainer] attribute instead of [Erasable] in generated code.
affects: >=0.7.0 <1.0.0
breakingPeer dependency @typescript/native-preview ^7 required since v1.0.0. Older versions did not require it.
fix
Add @typescript/native-preview@^7 as a dependency or devDependency.
affects: <1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'metano-runtime'
metano-runtime is not installed; Metano should add it automatically but missing npm install step.
fix
Run 'npm install' after code generation, or manually add 'metano-runtime' to dependencies.
TypeError: Class extends value undefined is not a constructor or null
Missing peer dependency @typescript/native-preview v7, required for generic type utilities.
fix
Run 'npm install @typescript/native-preview@^7'.
Cannot find module 'metano-runtime/system/json'
Subpath imports may not be supported by older bundlers or Node.js versions (<12).
fix
Update Node.js to >=14 or use a bundler that supports the 'exports' field in package.json.
Upgrade
Version history
1.0.3latest on npm
Audit
Dependencies
@typescript/native-previewoptionalpeer dependency (^7) required for type-level operations used by Metano-generated code
Agent activity
2 hits · last 30 days
node
2
Resources
metano-runtime — npm install metano-runtime · libregistry