Files
luma/Sources/LumaCore/PackageAliasTypings.swift
Ole André Vadla Ravnås b88a9be290 Replace SwiftyMonaco with native editors
Drop the Monaco webview. Edit in a GtkSourceView on GTK and in a
native text view on Apple, both speaking to Frida.Compiler's
in-process language server for completions, signature help,
hovers and diagnostics.

Color, complete and indent code natively, matching the GitHub
theme in light and dark.
2026-09-08 19:52:31 +02:00

31 lines
981 B
Swift

import Foundation
public enum PackageAliasTypings {
public static func declarations(for packages: [InstalledPackage]) -> [AmbientDeclarations] {
let aliased = packages.compactMap { package -> (alias: String, module: String)? in
guard let alias = package.globalAlias, !alias.isEmpty else { return nil }
return (alias: alias, module: package.name)
}
guard !aliased.isEmpty else { return [] }
var declarations = """
type LumaPackageAlias<T> = T extends { default: infer D } ? D : T;
declare global {
"""
for (alias, moduleName) in aliased {
declarations += """
const \(alias): LumaPackageAlias<typeof import("\(moduleName)")>;\n
"""
}
declarations += """
}
export {};
"""
return [AmbientDeclarations(content: declarations, fileName: "package-aliases.d.ts")]
}
}