This version of the module is deprecated: This package is deprecated. moonbit-community/proton_config should be preferred.

    proton_config

    Typed config parser for Proton moon.proton and moon.ext files.

    Download zip
    Author
    Version
    0.1.8
    License
    Apache-2.0
    Last updated
    3 months ago
    Downloads
    2K

    justjavac/proton_config does not have a README file

    ConfigLoc

    using @moonbitlang/lexer/basic { type Location as ConfigLoc }

    ProjectConfigError

    pub(all) suberror ProjectConfigError {
    FileRead(path~ : String, detail~ : String)
    Syntax(name~ : String, diagnostics~ : String)
    InvalidRoot
    Validation(errors~ : Array[ProjectConfigError])
    MissingField(path~ : String)
    DuplicateField(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 moon.proton.

    ProjectConfigError::message

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

    ConfigField

    pub(all) struct ConfigField {
    key : String
    key_loc :
    Location

    value : Ast
    } derive(Eq,
    Debug
    )

    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]

    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]
    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], 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?
    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?, permissions? : Array[ProjectPermissionGrant], debug? : Int, single_instance? : Bool) -> ProjectConfig

    ProjectConfig::permissions

    ProjectConfig::single_instance

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

    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 moon.proton.

    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

    ProjectTitlebarStyle

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

    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_text

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

    parse_moon_ext

    fn parse_moon_ext(name? : String, source : String) -> (Ast, Array[
    Report
    ])

    parse_moon_mod

    fn parse_moon_mod(name? : String, source : String) -> (Ast, Array[
    Report
    ])

    parse_moon_proton

    fn parse_moon_proton(name? : String, source : String) -> (Ast, Array[
    Report
    ])