From 952ce4cfdaed34c32970c923bc839dc77fa79b87 Mon Sep 17 00:00:00 2001 From: Amit Upadhyay Date: Fri, 6 Dec 2024 23:44:38 +0530 Subject: [PATCH] some thought on the package, systems, capabilities, apps etc --- v0.5/Cargo.lock | 4 +++ v0.5/Cargo.toml | 2 +- v0.5/fastn-package/Cargo.toml | 11 +++++++ v0.5/fastn-package/src/lib.rs | 55 +++++++++++++++++++++++++++++++++++ 4 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 v0.5/fastn-package/Cargo.toml create mode 100644 v0.5/fastn-package/src/lib.rs diff --git a/v0.5/Cargo.lock b/v0.5/Cargo.lock index df6fb64fa..24ef59f1c 100644 --- a/v0.5/Cargo.lock +++ b/v0.5/Cargo.lock @@ -201,6 +201,10 @@ dependencies = [ "thiserror", ] +[[package]] +name = "fastn-package" +version = "0.1.0" + [[package]] name = "fastn-resolved" version = "0.1.1" diff --git a/v0.5/Cargo.toml b/v0.5/Cargo.toml index 00e8ce829..f5d30467e 100644 --- a/v0.5/Cargo.toml +++ b/v0.5/Cargo.toml @@ -2,7 +2,7 @@ members = [ "fastn", "fastn-compiler", - "fastn-core", + "fastn-core", "fastn-package", "fastn-router", "fastn-section", "fastn-static", diff --git a/v0.5/fastn-package/Cargo.toml b/v0.5/fastn-package/Cargo.toml new file mode 100644 index 000000000..fe9af9d8d --- /dev/null +++ b/v0.5/fastn-package/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "fastn-package" +version = "0.1.0" +authors.workspace = true +edition.workspace = true +description.workspace = true +license.workspace = true +repository.workspace = true +homepage.workspace = true + +[dependencies] diff --git a/v0.5/fastn-package/src/lib.rs b/v0.5/fastn-package/src/lib.rs new file mode 100644 index 000000000..cf01f19b3 --- /dev/null +++ b/v0.5/fastn-package/src/lib.rs @@ -0,0 +1,55 @@ +#![allow(clippy::derive_partial_eq_without_eq, clippy::get_first)] +#![deny(unused_crate_dependencies)] +#![warn(clippy::used_underscore_binding)] +#![allow(dead_code)] + +extern crate self as fastn_package; + +pub struct Package { + name: String, + systems: Vec, + dependencies: Vec, + auto_imports: AutoImport, + apps: Vec, +} + +pub type AutoImport = Vec<(String, String)>; + +// -- system: design-system.com +// via: amitu.com/ds +// alias: some alias ;; if alias is not provided, this is globally passed +pub struct System { + via: String, + sensitive: bool, + alias: Option, +} + +pub struct SystemAlias(String); + +pub struct Dependency { + name: String, + // vector of alias of the systems this dependency and everything downstream + capabilities: Vec, + dependencies: Vec, + auto_imports: AutoImport, +} + +// -- path: /blog/ +// allow: colorful-ds +pub struct CapabilityOverride { + // capabilities for any url prefix can be overridden using this + path: String, + // if this is set, the global capabilities will be merged into .capabilities, else only + // .capabilities will be used. + inherit_global: bool, + capabilities: Vec, +} + +pub struct App { + // this must already be added as a Dependency (not a system) and is its name + name: String, + mount_point: String, + apps: Vec, + // Dependency.capabilities will be merged with this when serving these routes + capabilities: Vec, +}