Compare commits

..

No commits in common. "0.5" and "v0.5.2+registry.0.1.1" have entirely different histories.

22 changed files with 60 additions and 219 deletions

View file

@ -1,79 +0,0 @@
name: Debug
on:
push:
pull_request:
jobs:
get-version:
name: Get build version
runs-on: ubuntu-latest
outputs:
version: v${{ steps.get_version.outputs.value }}+rev.g${{ steps.trim_sha.outputs.trimmed_sha }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get package version
uses: SebRollen/toml-action@v1.2.0
id: get_version
with:
file: Cargo.toml
field: package.version
- name: Trim commit SHA
id: trim_sha
run: |
commit_sha=${{ github.sha }}
echo "trimmed_sha=${commit_sha:0:7}" | tee $GITHUB_OUTPUT
build:
strategy:
matrix:
include:
- job-name: windows-x86_64
target: x86_64-pc-windows-msvc
runs-on: windows-latest
artifact-name: pesde-debug-${{ needs.get-version.outputs.version }}-windows-x86_64
- job-name: linux-x86_64
target: x86_64-unknown-linux-gnu
runs-on: ubuntu-latest
artifact-name: pesde-debug-${{ needs.get-version.outputs.version }}-linux-x86_64
- job-name: macos-x86_64
target: x86_64-apple-darwin
runs-on: macos-13
artifact-name: pesde-debug-${{ needs.get-version.outputs.version }}-macos-x86_64
- job-name: macos-aarch64
target: aarch64-apple-darwin
runs-on: macos-latest
artifact-name: pesde-debug-${{ needs.get-version.outputs.version }}-macos-aarch64
name: Build for ${{ matrix.job-name }}
runs-on: ${{ matrix.runs-on }}
needs: get-version
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Linux build dependencies
if: ${{ matrix.runs-on == 'ubuntu-latest' }}
run: |
sudo apt-get update
sudo apt-get install libdbus-1-dev pkg-config
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Compile in debug mode
run: cargo build --bins --no-default-features --features bin,patches,wally-compat --target ${{ matrix.target }} --locked
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}
if-no-files-found: error
path: |
target/${{ matrix.target }}/debug/pesde.exe
target/${{ matrix.target }}/debug/pesde

View file

@ -5,13 +5,6 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.5.3] - 2024-12-30
### Added
- Add meta field in index files to preserve compatibility with potential future changes by @daimond113
### Changed
- Remove verbosity from release mode logging by @daimond113
## [0.5.2] - 2024-12-19 ## [0.5.2] - 2024-12-19
### Fixed ### Fixed
- Change dependency types for removed peer dependencies by @daimond113 - Change dependency types for removed peer dependencies by @daimond113
@ -112,7 +105,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Asyncify dependency linking by @daimond113 - Asyncify dependency linking by @daimond113
- Use `exec` in Unix bin linking to reduce the number of processes by @daimond113 - Use `exec` in Unix bin linking to reduce the number of processes by @daimond113
[0.5.3]: https://github.com/daimond113/pesde/compare/v0.5.2%2Bregistry.0.1.1..v0.5.3%2Bregistry.0.1.2
[0.5.2]: https://github.com/daimond113/pesde/compare/v0.5.1%2Bregistry.0.1.0..v0.5.2%2Bregistry.0.1.1 [0.5.2]: https://github.com/daimond113/pesde/compare/v0.5.1%2Bregistry.0.1.0..v0.5.2%2Bregistry.0.1.1
[0.5.1]: https://github.com/daimond113/pesde/compare/v0.5.0%2Bregistry.0.1.0..v0.5.1%2Bregistry.0.1.0 [0.5.1]: https://github.com/daimond113/pesde/compare/v0.5.0%2Bregistry.0.1.0..v0.5.1%2Bregistry.0.1.0
[0.5.0]: https://github.com/daimond113/pesde/compare/v0.4.7..v0.5.0%2Bregistry.0.1.0 [0.5.0]: https://github.com/daimond113/pesde/compare/v0.4.7..v0.5.0%2Bregistry.0.1.0

4
Cargo.lock generated
View file

@ -3662,7 +3662,7 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
[[package]] [[package]]
name = "pesde" name = "pesde"
version = "0.5.3" version = "0.5.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"async-compression", "async-compression",
@ -3706,7 +3706,7 @@ dependencies = [
[[package]] [[package]]
name = "pesde-registry" name = "pesde-registry"
version = "0.1.2" version = "0.1.1"
dependencies = [ dependencies = [
"actix-cors", "actix-cors",
"actix-governor", "actix-governor",

View file

@ -1,6 +1,6 @@
[package] [package]
name = "pesde" name = "pesde"
version = "0.5.3" version = "0.5.2"
edition = "2021" edition = "2021"
license = "MIT" license = "MIT"
authors = ["daimond113 <contact@daimond113.com>"] authors = ["daimond113 <contact@daimond113.com>"]

View file

@ -1,25 +0,0 @@
# Security Policy
## Supported Versions
As pesde is currently in version 0.x, we can only guarantee security for:
- **The latest minor** (currently 0.5).
- **The latest release candidate for the next version**, if available.
When a new minor version is released, the previous version will immediately lose security support.
> **Note:** This policy will change with the release of version 1.0, which will include an extended support period for versions >=1.0.
| Version | Supported |
| ------- | ------------------ |
| 0.5.x | :white_check_mark: |
| < 0.5 | :x: |
## Reporting a Vulnerability
We encourage all security concerns to be reported at [pesde@daimond113.com](mailto:pesde@daimond113.com), along the following format:
- **Subject**: The subject must be prefixed with `[SECURITY]` to ensure it is prioritized as a security concern.
- **Content**:
- **Affected Versions**: Clearly specify which are affected by the issue.
- **Issue Details**: Provide a detailed description of the issue, including reproduction steps and/or a simple example, if applicable.
We will try to respond as soon as possible.

View file

@ -38,17 +38,17 @@ Git dependencies are dependencies on packages hosted on a Git repository.
```toml title="pesde.toml" ```toml title="pesde.toml"
[dependencies] [dependencies]
acme = { repo = "acme/package", rev = "aeff6" } acme = { repo = "acme/package", rev = "main" }
``` ```
In this example, we're specifying a dependency on the package contained within In this example, we're specifying a dependency on the package contained within
the `acme/package` GitHub repository at the `aeff6` commit. the `acme/package` GitHub repository at the `main` branch.
You can also use a URL to specify the Git repository and a tag for the revision. You can also use a URL to specify the Git repository and a specific commit.
```toml title="pesde.toml" ```toml title="pesde.toml"
[dependencies] [dependencies]
acme = { repo = "https://git.acme.local/package.git", rev = "v0.1.0" } acme = { repo = "https://git.acme.local/package.git", rev = "aeff6" }
``` ```
You can also specify a path if the package is not at the root of the repository. You can also specify a path if the package is not at the root of the repository.

View file

@ -20,15 +20,15 @@ to get it added.
Studio. Studio.
Running `pesde init` will prompt you to select a target, select Running `pesde init` will prompt you to select a target, select
`roblox` or `roblox_server` in this case. You will be prompted to pick out a `roblox` or `roblox_server` in this case. This will setup the configuration
scripts package. Select `pesde/scripts_rojo` to get started with Rojo. needed to use pesde in a project using Rojo.
## Usage with other tools ## Usage with other tools
If you are using a different sync tool, you should look for it's scripts If you are using a different sync tool, you should look for it's scripts in the
package on the registry. If you cannot find it, you can write your own and pesde-scripts repository. If you cannot find them, you can write your own and
optionally submit a PR to pesde-scripts to help others using the same tool as optionally submit a PR to help others using the same tool as you get started
you get started quicker. quicker.
Scaffold your project with `pesde init`, select the `roblox` or `roblox_server` Scaffold your project with `pesde init`, select the `roblox` or `roblox_server`
target, and then create a `.pesde/roblox_sync_config_generator.luau` script target, and then create a `.pesde/roblox_sync_config_generator.luau` script

View file

@ -41,16 +41,6 @@ You can follow the installation instructions in the
pesde should now be installed on your system. You may need to restart your pesde should now be installed on your system. You may need to restart your
computer for the changes to take effect. computer for the changes to take effect.
<Aside type="caution">
pesde uses symlinks which are an administrator-level operation on Windows.
To ensure proper functionality, enable [Developer Mode](https://learn.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development).
If you are getting errors such as `Failed to symlink file, a required
privilege is not held by the client`, then enabling this setting will fix
them.
</Aside>
</TabItem> </TabItem>
<TabItem label="Linux & macOS"> <TabItem label="Linux & macOS">
@ -69,7 +59,7 @@ You can follow the installation instructions in the
environment variable. environment variable.
```sh title=".zshrc" ```sh title=".zshrc"
export PATH="$PATH:$HOME/.pesde/bin" export PATH = "$PATH:/home/user/.pesde/bin"
``` ```
You should then be able to run `pesde` after restarting your shell. You should then be able to run `pesde` after restarting your shell.

View file

@ -159,13 +159,12 @@ when the package is installed in order to generate the necessary configuration.
**Allowed in:** `luau`, `lune` **Allowed in:** `luau`, `lune`
A list of scripts that will be linked to the dependant's `.pesde` directory, and A list of scripts that will be linked to the project's `.pesde` directory, and
copied over to the [scripts](#scripts-1) section when initialising a project with copied over to the [scripts](#scripts-1) section when initialising a project with
this package as the scripts package. this package.
```toml ```toml
[target.scripts] scripts = { roblox_sync_config_generator = "scripts/roblox_sync_config_generator.luau" }
roblox_sync_config_generator = "scripts/roblox_sync_config_generator.luau"
``` ```
## `[scripts]` ## `[scripts]`
@ -190,6 +189,10 @@ sync tools.
of files specified within the [`target.build_files`](#build_files) of the of files specified within the [`target.build_files`](#build_files) of the
package. package.
You can find template scripts inside the
[`pesde-scripts` repository](https://github.com/pesde-pkg/scripts)
for various sync tools.
<LinkCard <LinkCard
title="Roblox" title="Roblox"
description="Learn more about using pesde in Roblox projects." description="Learn more about using pesde in Roblox projects."
@ -369,14 +372,14 @@ foo = { wally = "acme/foo", version = "1.2.3", index = "acme" }
```toml ```toml
[dependencies] [dependencies]
foo = { repo = "acme/packages", rev = "aeff6", path = "foo" } foo = { repo = "acme/packages", rev = "main", path = "foo" }
``` ```
**Git dependencies** contain the following fields: **Git dependencies** contain the following fields:
- `repo`: The URL of the Git repository. - `repo`: The URL of the Git repository.
This can either be `<owner>/<name>` for a GitHub repository, or a full URL. This can either be `<owner>/<name>` for a GitHub repository, or a full URL.
- `rev`: The Git revision to install. This can be a tag or commit hash. - `rev`: The Git revision to install. This can be a branch, tag, or commit hash.
- `path`: The path within the repository to install. If not specified, the root - `path`: The path within the repository to install. If not specified, the root
of the repository is used. of the repository is used.

View file

@ -5,18 +5,8 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.1.2]
### Changed
- Update to pesde lib API changes by @daimond113
## [0.1.1] - 2024-12-19
### Changed
- Switch to traccing for logging by @daimond113
## [0.1.0] - 2024-12-14 ## [0.1.0] - 2024-12-14
### Added ### Added
- Rewrite registry for pesde v0.5.0 by @daimond113 - Rewrite registry for pesde v0.5.0 by @daimond113
[0.1.2]: https://github.com/daimond113/pesde/compare/v0.5.2%2Bregistry.0.1.1..v0.5.3%2Bregistry.0.1.2 [0.1.0]: https://github.com/daimond113/pesde/compare/v0.4.7..v0.5.0
[0.1.1]: https://github.com/daimond113/pesde/compare/v0.5.1%2Bregistry.0.1.0..v0.5.2%2Bregistry.0.1.1
[0.1.0]: https://github.com/daimond113/pesde/compare/v0.4.7..v0.5.0%2Bregistry.0.1.0

View file

@ -1,6 +1,6 @@
[package] [package]
name = "pesde-registry" name = "pesde-registry"
version = "0.1.2" version = "0.1.1"
edition = "2021" edition = "2021"
repository = "https://github.com/pesde-pkg/index" repository = "https://github.com/pesde-pkg/index"
publish = false publish = false

View file

@ -71,7 +71,7 @@ pub async fn get_package_version(
let (scope, name_part) = name.as_str(); let (scope, name_part) = name.as_str();
let file: IndexFile = { let entries: IndexFile = {
let source = app_state.source.lock().await; let source = app_state.source.lock().await;
let repo = gix::open(source.path(&app_state.project))?; let repo = gix::open(source.path(&app_state.project))?;
let tree = root_tree(&repo)?; let tree = root_tree(&repo)?;
@ -84,15 +84,14 @@ pub async fn get_package_version(
let Some((v_id, entry, targets)) = ({ let Some((v_id, entry, targets)) = ({
let version = match version { let version = match version {
VersionRequest::Latest => match file.entries.keys().map(|k| k.version()).max() { VersionRequest::Latest => match entries.keys().map(|k| k.version()).max() {
Some(latest) => latest.clone(), Some(latest) => latest.clone(),
None => return Ok(HttpResponse::NotFound().finish()), None => return Ok(HttpResponse::NotFound().finish()),
}, },
VersionRequest::Specific(version) => version, VersionRequest::Specific(version) => version,
}; };
let versions = file let versions = entries
.entries
.iter() .iter()
.filter(|(v_id, _)| *v_id.version() == version); .filter(|(v_id, _)| *v_id.version() == version);

View file

@ -19,7 +19,7 @@ pub async fn get_package_versions(
let (scope, name_part) = name.as_str(); let (scope, name_part) = name.as_str();
let file: IndexFile = { let versions: IndexFile = {
let source = app_state.source.lock().await; let source = app_state.source.lock().await;
let repo = gix::open(source.path(&app_state.project))?; let repo = gix::open(source.path(&app_state.project))?;
let tree = root_tree(&repo)?; let tree = root_tree(&repo)?;
@ -32,7 +32,7 @@ pub async fn get_package_versions(
let mut responses = BTreeMap::new(); let mut responses = BTreeMap::new();
for (v_id, entry) in file.entries { for (v_id, entry) in versions {
let info = responses let info = responses
.entry(v_id.version().clone()) .entry(v_id.version().clone())
.or_insert_with(|| PackageResponse { .or_insert_with(|| PackageResponse {

View file

@ -371,7 +371,7 @@ pub async fn publish_package(
} }
}; };
let mut file: IndexFile = let mut entries: IndexFile =
toml::de::from_str(&read_file(&gix_tree, [scope, name])?.unwrap_or_default())?; toml::de::from_str(&read_file(&gix_tree, [scope, name])?.unwrap_or_default())?;
let new_entry = IndexFileEntry { let new_entry = IndexFileEntry {
@ -386,12 +386,11 @@ pub async fn publish_package(
dependencies, dependencies,
}; };
let this_version = file let this_version = entries
.entries
.keys() .keys()
.find(|v_id| *v_id.version() == manifest.version); .find(|v_id| *v_id.version() == manifest.version);
if let Some(this_version) = this_version { if let Some(this_version) = this_version {
let other_entry = file.entries.get(this_version).unwrap(); let other_entry = entries.get(this_version).unwrap();
// description cannot be different - which one to render in the "Recently published" list? // description cannot be different - which one to render in the "Recently published" list?
// the others cannot be different because what to return from the versions endpoint? // the others cannot be different because what to return from the versions endpoint?
@ -407,8 +406,7 @@ pub async fn publish_package(
} }
} }
if file if entries
.entries
.insert( .insert(
VersionId::new(manifest.version.clone(), manifest.target.kind()), VersionId::new(manifest.version.clone(), manifest.target.kind()),
new_entry.clone(), new_entry.clone(),
@ -424,7 +422,7 @@ pub async fn publish_package(
let reference = repo.find_reference(&refspec)?; let reference = repo.find_reference(&refspec)?;
{ {
let index_content = toml::to_string(&file)?; let index_content = toml::to_string(&entries)?;
let mut blob_writer = repo.blob_writer(None)?; let mut blob_writer = repo.blob_writer(None)?;
blob_writer.write_all(index_content.as_bytes())?; blob_writer.write_all(index_content.as_bytes())?;
oids.push((name, blob_writer.commit()?)); oids.push((name, blob_writer.commit()?));

View file

@ -68,11 +68,10 @@ pub async fn search_packages(
.unwrap(); .unwrap();
let (scope, name) = id.as_str(); let (scope, name) = id.as_str();
let file: IndexFile = let versions: IndexFile =
toml::de::from_str(&read_file(&tree, [scope, name]).unwrap().unwrap()).unwrap(); toml::de::from_str(&read_file(&tree, [scope, name]).unwrap().unwrap()).unwrap();
let (latest_version, entry) = file let (latest_version, entry) = versions
.entries
.iter() .iter()
.max_by_key(|(v_id, _)| v_id.version()) .max_by_key(|(v_id, _)| v_id.version())
.unwrap(); .unwrap();
@ -80,19 +79,17 @@ pub async fn search_packages(
PackageResponse { PackageResponse {
name: id.to_string(), name: id.to_string(),
version: latest_version.version().to_string(), version: latest_version.version().to_string(),
targets: file targets: versions
.entries
.iter() .iter()
.filter(|(v_id, _)| v_id.version() == latest_version.version()) .filter(|(v_id, _)| v_id.version() == latest_version.version())
.map(|(_, entry)| (&entry.target).into()) .map(|(_, entry)| (&entry.target).into())
.collect(), .collect(),
description: entry.description.clone().unwrap_or_default(), description: entry.description.clone().unwrap_or_default(),
published_at: file published_at: versions
.entries
.values() .values()
.map(|entry| entry.published_at) .max_by_key(|entry| entry.published_at)
.max() .unwrap()
.unwrap(), .published_at,
license: entry.license.clone().unwrap_or_default(), license: entry.license.clone().unwrap_or_default(),
authors: entry.authors.clone(), authors: entry.authors.clone(),
repository: entry.repository.clone().map(|url| url.to_string()), repository: entry.repository.clone().map(|url| url.to_string()),

View file

@ -104,7 +104,7 @@ pub async fn make_search(
pin!(stream); pin!(stream);
while let Some((pkg_name, mut file)) = stream.next().await { while let Some((pkg_name, mut file)) = stream.next().await {
let Some((_, latest_entry)) = file.entries.pop_last() else { let Some((_, latest_entry)) = file.pop_last() else {
tracing::error!("no versions found for {pkg_name}"); tracing::error!("no versions found for {pkg_name}");
continue; continue;
}; };

View file

@ -71,7 +71,7 @@ impl Project {
let version_id = version_id.clone(); let version_id = version_id.clone();
let node = node.clone(); let node = node.clone();
let span = tracing::info_span!( let span = tracing::debug_span!(
"download", "download",
name = name.to_string(), name = name.to_string(),
version_id = version_id.to_string() version_id = version_id.to_string()

View file

@ -254,7 +254,7 @@ impl Project {
let manifest = manifest.clone(); let manifest = manifest.clone();
let package_types = package_types.clone(); let package_types = package_types.clone();
let span = tracing::info_span!( let span = tracing::debug_span!(
"link", "link",
name = name.to_string(), name = name.to_string(),
version_id = version_id.to_string() version_id = version_id.to_string()

View file

@ -11,9 +11,10 @@ use std::{
}; };
use tempfile::NamedTempFile; use tempfile::NamedTempFile;
use tracing::instrument; use tracing::instrument;
use tracing_indicatif::{filter::IndicatifFilter, IndicatifLayer}; use tracing_indicatif::IndicatifLayer;
use tracing_subscriber::{ use tracing_subscriber::{
filter::LevelFilter, layer::SubscriberExt, util::SubscriberInitExt, EnvFilter, Layer, filter::LevelFilter, fmt::time::uptime, layer::SubscriberExt, util::SubscriberInitExt,
EnvFilter,
}; };
mod cli; mod cli;
@ -133,7 +134,7 @@ async fn run() -> anyhow::Result<()> {
std::process::exit(status.code().unwrap()); std::process::exit(status.code().unwrap());
} }
let indicatif_layer = IndicatifLayer::new().with_filter(IndicatifFilter::new(false)); let indicatif_layer = IndicatifLayer::new();
let tracing_env_filter = EnvFilter::builder() let tracing_env_filter = EnvFilter::builder()
.with_default_directive(LevelFilter::INFO.into()) .with_default_directive(LevelFilter::INFO.into())
@ -146,23 +147,14 @@ async fn run() -> anyhow::Result<()> {
.add_directive("hyper=info".parse().unwrap()) .add_directive("hyper=info".parse().unwrap())
.add_directive("h2=info".parse().unwrap()); .add_directive("h2=info".parse().unwrap());
let fmt_layer =
tracing_subscriber::fmt::layer().with_writer(indicatif_layer.inner().get_stderr_writer());
#[cfg(debug_assertions)]
let fmt_layer = fmt_layer.with_timer(tracing_subscriber::fmt::time::uptime());
#[cfg(not(debug_assertions))]
let fmt_layer = fmt_layer
.pretty()
.with_timer(())
.with_line_number(false)
.with_file(false)
.with_target(false);
tracing_subscriber::registry() tracing_subscriber::registry()
.with(tracing_env_filter) .with(tracing_env_filter)
.with(fmt_layer) .with(
tracing_subscriber::fmt::layer()
.pretty()
.with_writer(indicatif_layer.get_stderr_writer())
.with_timer(uptime()),
)
.with(indicatif_layer) .with(indicatif_layer)
.init(); .init();

View file

@ -102,7 +102,7 @@ impl Project {
continue; continue;
}; };
let span = tracing::info_span!("resolve from old graph", alias); let span = tracing::debug_span!("resolve from old graph", alias);
let _guard = span.enter(); let _guard = span.enter();
tracing::debug!("resolved {}@{} from old dependency graph", name, version); tracing::debug!("resolved {}@{} from old dependency graph", name, version);
@ -131,7 +131,7 @@ impl Project {
while let Some((dep_name, dep_version, path)) = queue.pop_front() { while let Some((dep_name, dep_version, path)) = queue.pop_front() {
let inner_span = let inner_span =
tracing::info_span!("resolve dependency", path = path.join(">")); tracing::debug_span!("resolve dependency", path = path.join(">"));
let _inner_guard = inner_span.enter(); let _inner_guard = inner_span.enter();
if let Some(dep_node) = previous_graph if let Some(dep_node) = previous_graph
.get(dep_name) .get(dep_name)
@ -399,7 +399,7 @@ impl Project {
Ok(()) Ok(())
} }
.instrument(tracing::info_span!("resolve new/changed", path = path.join(">"))) .instrument(tracing::debug_span!("resolve new/changed", path = path.join(">")))
.await?; .await?;
} }

View file

@ -128,7 +128,7 @@ impl PackageSource for PesdePackageSource {
} }
}; };
let IndexFile { entries, .. } = toml::from_str(&string) let entries: IndexFile = toml::from_str(&string)
.map_err(|e| Self::ResolveError::Parse(specifier.name.to_string(), e))?; .map_err(|e| Self::ResolveError::Parse(specifier.name.to_string(), e))?;
tracing::debug!("{} has {} possible entries", specifier.name, entries.len()); tracing::debug!("{} has {} possible entries", specifier.name, entries.len());
@ -432,20 +432,8 @@ pub struct IndexFileEntry {
pub dependencies: BTreeMap<String, (DependencySpecifiers, DependencyType)>, pub dependencies: BTreeMap<String, (DependencySpecifiers, DependencyType)>,
} }
/// The package metadata in the index file
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)]
pub struct IndexMetadata {}
/// The index file for a package /// The index file for a package
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)] pub type IndexFile = BTreeMap<VersionId, IndexFileEntry>;
pub struct IndexFile {
/// Any package-wide metadata
#[serde(default, skip_serializing_if = "crate::util::is_default")]
pub meta: IndexMetadata,
/// The entries in the index file
#[serde(flatten)]
pub entries: BTreeMap<VersionId, IndexFileEntry>,
}
/// Errors that can occur when interacting with the pesde package source /// Errors that can occur when interacting with the pesde package source
pub mod errors { pub mod errors {

View file

@ -83,7 +83,3 @@ pub fn deserialize_git_like_url<'de, D: Deserializer<'de>>(
pub fn hash<S: AsRef<[u8]>>(struc: S) -> String { pub fn hash<S: AsRef<[u8]>>(struc: S) -> String {
format!("{:x}", Sha256::digest(struc.as_ref())) format!("{:x}", Sha256::digest(struc.as_ref()))
} }
pub fn is_default<T: Default + Eq>(t: &T) -> bool {
t == &T::default()
}