proton_config

Typed project configuration models and JSON decoding for Proton.

moon add moonbit-community/proton_config@0.1.16
Download zip
Version
0.1.16
License
Apache-2.0
Last updated
3 days ago
Downloads
40

Dependencies

README

moonbit-community/proton_config does not have a README file

#
ProjectConfigError

pub(all) suberror ProjectConfigError {
FileRead(path~ : String, detail~ : String)
Syntax(name~ : String, diagnostics~ : String)
InvalidRoot
Validation(errors~ : Array[ProjectConfigError])
MissingField(path~ : String)
DuplicateValue(path~ : String, value~ : String)
UnknownField(path~ : String)
InvalidField(path~ : String, expectation~ : String)
UnsupportedField(path~ : String, reason~ : String)
UnsupportedValue(path~ : String, value~ : String)
} derive(Eq,
Debug
)

Failures produced while loading and validating proton.project.json.

#
ProjectConfigError::message

fn ProjectConfigError::message(self : ProjectConfigError) -> String

#
LoadedProjectConfig

pub(all) struct LoadedProjectConfig {
config : ProjectConfig
warnings : Array[String]
} derive(Eq,
Debug
)

#
LoadedProjectConfig::config

#
LoadedProjectConfig::new

fn LoadedProjectConfig::new(config : ProjectConfig, warnings? : Array[String]) -> LoadedProjectConfig

#
LoadedProjectConfig::warnings

fn LoadedProjectConfig::warnings(self : LoadedProjectConfig) -> Array[String]

#
MoonModMetadata

pub(all) struct MoonModMetadata {
root_dir : String?
name : String?
version : String?
description : String?
license : String?
repository : String?
readme : String?
keywords : Array[String]
} derive(Eq,
Debug
)

Metadata read from a moon.mod file.

#
ProjectAppWindowConfig

pub(all) struct ProjectAppWindowConfig {
id : String
window : ProjectWindowConfig
entry : ProjectEntry
open_on_start : Bool
} derive(Eq,
Debug
)

#
ProjectAppWindowConfig::new

fn ProjectAppWindowConfig::new(id : String, window : ProjectWindowConfig, entry : ProjectEntry, open_on_start? : Bool) -> ProjectAppWindowConfig

#
ProjectBackendConfig

pub(all) struct ProjectBackendConfig {
path : String
app_package : String
} derive(Eq,
Debug
)

#
ProjectBackendConfig::app_package

fn ProjectBackendConfig::app_package(self : ProjectBackendConfig) -> String

#
ProjectBackendConfig::new

fn ProjectBackendConfig::new(path : String, app_package : String) -> ProjectBackendConfig

#
ProjectBackendConfig::path

fn ProjectBackendConfig::path(self : ProjectBackendConfig) -> String

#
ProjectBundleConfig

pub(all) struct ProjectBundleConfig {
active : Bool
targets : Array[String]
icon : Array[String]
resources : Array[String]
sign : ProjectSignConfig?
url_schemes : Array[String]
document_types : Array[ProjectDocumentType]
output : String
} derive(Eq,
Debug
)

#
ProjectBundleConfig::active

fn ProjectBundleConfig::active(self : ProjectBundleConfig) -> Bool

#
ProjectBundleConfig::new

fn ProjectBundleConfig::new(active? : Bool, targets? : Array[String], icon? : Array[String], resources? : Array[String], sign? : ProjectSignConfig?, url_schemes? : Array[String], document_types? : Array[ProjectDocumentType], output? : String) -> ProjectBundleConfig

#
ProjectBundleConfig::output

fn ProjectBundleConfig::output(self : ProjectBundleConfig) -> String

#
ProjectConfig

pub(all) struct ProjectConfig {
base_dir : String
window : ProjectWindowConfig
entry : ProjectEntry
windows : Array[ProjectAppWindowConfig]
metadata : ProjectMetadata
backend : ProjectBackendConfig?
frontend : ProjectFrontendConfig?
bundle : ProjectBundleConfig?
updater : ProjectUpdaterConfig?
permissions : Array[ProjectPermissionGrant]
debug : Int
single_instance : Bool
} derive(Eq,
Debug
)

#
ProjectConfig::backend

#
ProjectConfig::base_dir

fn ProjectConfig::base_dir(self : ProjectConfig) -> String

#
ProjectConfig::bundle

#
ProjectConfig::debug

fn ProjectConfig::debug(self : ProjectConfig) -> Int

#
ProjectConfig::entries

Returns the primary entry followed by each secondary window entry in declaration order.

#
ProjectConfig::entry

#
ProjectConfig::frontend

#
ProjectConfig::metadata

#
ProjectConfig::new

fn ProjectConfig::new(base_dir : String, window : ProjectWindowConfig, entry : ProjectEntry, metadata : ProjectMetadata, windows? : Array[ProjectAppWindowConfig], backend? : ProjectBackendConfig?, frontend? : ProjectFrontendConfig?, bundle? : ProjectBundleConfig?, updater? : ProjectUpdaterConfig?, permissions? : Array[ProjectPermissionGrant], debug? : Int, single_instance? : Bool) -> ProjectConfig

#
ProjectConfig::permissions

#
ProjectConfig::single_instance

fn ProjectConfig::single_instance(self : ProjectConfig) -> Bool

#
ProjectConfig::updater

#
ProjectConfig::window

#
ProjectConfig::windows

#
ProjectDocumentType

pub(all) struct ProjectDocumentType {
name : String
extensions : Array[String]
role : String
} derive(Eq,
Debug
)

#
ProjectDocumentType::extensions

fn ProjectDocumentType::extensions(self : ProjectDocumentType) -> Array[String]

#
ProjectDocumentType::new

fn ProjectDocumentType::new(name : String, extensions : Array[String], role? : String) -> ProjectDocumentType

#
ProjectEntry

pub(all) enum ProjectEntry {
Html(String)
Url(String)
File(String)
Asset(String)
} derive(Eq,
Debug
)

#
ProjectFrontendConfig

pub(all) struct ProjectFrontendConfig {
dev_url : String?
dist : String?
before_dev : String?
before_build : String?
path : String?
} derive(Eq,
Debug
)

#
ProjectFrontendConfig::before_build

fn ProjectFrontendConfig::before_build(self : ProjectFrontendConfig) -> String?

#
ProjectFrontendConfig::before_dev

fn ProjectFrontendConfig::before_dev(self : ProjectFrontendConfig) -> String?

#
ProjectFrontendConfig::dev_url

fn ProjectFrontendConfig::dev_url(self : ProjectFrontendConfig) -> String?

#
ProjectFrontendConfig::dist

fn ProjectFrontendConfig::dist(self : ProjectFrontendConfig) -> String?

#
ProjectFrontendConfig::new

fn ProjectFrontendConfig::new(dev_url? : String?, dist? : String?, before_dev? : String?, before_build? : String?, path? : String?) -> ProjectFrontendConfig

#
ProjectFrontendConfig::path

fn ProjectFrontendConfig::path(self : ProjectFrontendConfig) -> String?

#
ProjectMetadata

pub(all) struct ProjectMetadata {
product_name : String
identifier : String?
version : String?
description : String?
license : String?
} derive(Eq,
Debug
)

#
ProjectMetadata::new

fn ProjectMetadata::new(product_name : String, identifier? : String?, version? : String?, description? : String?, license? : String?) -> ProjectMetadata

#
ProjectPermissionGrant

pub(all) struct ProjectPermissionGrant {
window : String
origin : String
extension : String
scope : Json
} derive(Eq,
Debug
)

One renderer capability grant from proton.project.json.

window is main or a declared secondary window id. origin is app for bundled Proton pages or entry for the configured window entry. Extension-specific restrictions live in scope.

#
ProjectPermissionGrant::new

fn ProjectPermissionGrant::new(window : String, origin : String, extension : String, scope? : Json) -> ProjectPermissionGrant

#
ProjectSignConfig

pub(all) struct ProjectSignConfig {
binaries : Array[String]
} derive(Eq,
Debug
)

Signing settings for files copied through bundle.resources.

#
ProjectSignConfig::binaries

fn ProjectSignConfig::binaries(self : ProjectSignConfig) -> Array[String]

Returns the project paths whose packaged copies must be signed.

#
ProjectSignConfig::new

fn ProjectSignConfig::new(binaries? : Array[String]) -> ProjectSignConfig

Creates signing settings for package-relative resource binaries.

#
ProjectTitlebarStyle

pub(all) enum ProjectTitlebarStyle {
TitlebarDefault
TitlebarOverlay
} derive(Eq,
Debug
)

#
ProjectUpdaterConfig

pub(all) struct ProjectUpdaterConfig {
active : Bool
endpoint : String
public_keys : Array[String]
check_on_launch : Bool
freshness_days : Int
} derive(Eq,
Debug
)

The application's update channel, as declared in proton.project.json.

This carries only what the runtime needs in order to decide whether to check, and whom to trust when it does. No private key material appears here, or anywhere else the framework can reach.

#
ProjectUpdaterConfig::checks_on_launch

fn ProjectUpdaterConfig::checks_on_launch(self : ProjectUpdaterConfig) -> Bool

#
ProjectUpdaterConfig::endpoint

fn ProjectUpdaterConfig::endpoint(self : ProjectUpdaterConfig) -> String

#
ProjectUpdaterConfig::freshness_days

fn ProjectUpdaterConfig::freshness_days(self : ProjectUpdaterConfig) -> Int

#
ProjectUpdaterConfig::is_active

fn ProjectUpdaterConfig::is_active(self : ProjectUpdaterConfig) -> Bool

#
ProjectUpdaterConfig::new

fn ProjectUpdaterConfig::new(endpoint : String, public_keys : Array[String], active? : Bool, check_on_launch? : Bool, freshness_days? : Int) -> ProjectUpdaterConfig

#
ProjectUpdaterConfig::public_keys

fn ProjectUpdaterConfig::public_keys(self : ProjectUpdaterConfig) -> Array[String]

#
ProjectWindowConfig

pub(all) struct ProjectWindowConfig {
title : String
width : Int
height : Int
size_hint : ProjectWindowSizeHint
titlebar_style : ProjectTitlebarStyle
} derive(Eq,
Debug
)

#
ProjectWindowConfig::new

fn ProjectWindowConfig::new(title : String, width : Int, height : Int, size_hint? : ProjectWindowSizeHint, titlebar_style? : ProjectTitlebarStyle) -> ProjectWindowConfig

#
ProjectWindowSizeHint

pub(all) enum ProjectWindowSizeHint {
WindowSizeNone
WindowSizeMin
WindowSizeMax
WindowSizeFixed
} derive(Eq,
Debug
)

#
load_project_config_from_file

fn load_project_config_from_file(path : String) -> LoadedProjectConfig raise ProjectConfigError

#
load_project_config_from_json

fn load_project_config_from_json(json : Json, base_dir : String) -> LoadedProjectConfig raise ProjectConfigError

Validates an already parsed Proton project JSON document without serializing it through an intermediate string.

#
load_project_config_from_text

fn load_project_config_from_text(source : String, base_dir : String, name? : String) -> LoadedProjectConfig raise ProjectConfigError

Parses project JSON text at an I/O boundary, then validates the resulting native Json value.

#
read_moon_mod_metadata

fn read_moon_mod_metadata(root_dir : String) -> MoonModMetadata

Reads metadata from moon.mod in exactly the specified module root. Missing, unreadable, and malformed manifests produce empty metadata.

#
read_nearest_moon_mod_metadata

fn read_nearest_moon_mod_metadata(start_dir : String) -> MoonModMetadata

Reads metadata from the nearest enclosing moon.mod file. Missing, unreadable, and malformed manifests produce empty metadata.

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io