mirror of
https://github.com/typst/typst
synced 2025-07-27 06:17:53 +08:00
I want to get all of this working
This commit is contained in:
parent
bd41fb9427
commit
7089a79b1e
@ -185,7 +185,7 @@ impl PackageStorage {
|
|||||||
if let Ok(version) = self.determine_latest_version(&spec.versionless()) {
|
if let Ok(version) = self.determine_latest_version(&spec.versionless()) {
|
||||||
return Err(PackageError::VersionNotFound(spec.clone(), version));
|
return Err(PackageError::VersionNotFound(spec.clone(), version));
|
||||||
} else {
|
} else {
|
||||||
return Err(PackageError::NotFound(spec.clone()));
|
return Err(PackageError::NotFound(spec.clone(), Some(eco_format!("attempted to download"))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -523,7 +523,9 @@ pub type PackageResult<T> = Result<T, PackageError>;
|
|||||||
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
|
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
|
||||||
pub enum PackageError {
|
pub enum PackageError {
|
||||||
/// The specified package does not exist.
|
/// The specified package does not exist.
|
||||||
NotFound(PackageSpec),
|
/// Optionally provides information on where we tried to find the package,
|
||||||
|
/// defaults to simply "searched for" if absent.
|
||||||
|
NotFound(PackageSpec, Option<EcoString>),
|
||||||
/// The specified package found, but the version does not exist.
|
/// The specified package found, but the version does not exist.
|
||||||
VersionNotFound(PackageSpec, PackageVersion),
|
VersionNotFound(PackageSpec, PackageVersion),
|
||||||
/// Failed to retrieve the package through the network.
|
/// Failed to retrieve the package through the network.
|
||||||
@ -539,9 +541,12 @@ impl std::error::Error for PackageError {}
|
|||||||
impl Display for PackageError {
|
impl Display for PackageError {
|
||||||
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
Self::NotFound(spec) => {
|
Self::NotFound(spec, None) => {
|
||||||
write!(f, "package not found (searched for {spec})",)
|
write!(f, "package not found (searched for {spec})",)
|
||||||
}
|
}
|
||||||
|
Self::NotFound(spec, Some(attempted)) => {
|
||||||
|
write!(f, "package not found ({attempted} {spec})",)
|
||||||
|
}
|
||||||
Self::VersionNotFound(spec, latest) => {
|
Self::VersionNotFound(spec, latest) => {
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
|
1
pending/import1.typ
Normal file
1
pending/import1.typ
Normal file
@ -0,0 +1 @@
|
|||||||
|
#import "@local/mypkg:0.0.1"
|
1
pending/import2.typ
Normal file
1
pending/import2.typ
Normal file
@ -0,0 +1 @@
|
|||||||
|
#import "@nope/mypkg:0.0.1"
|
1
pending/import3.typ
Normal file
1
pending/import3.typ
Normal file
@ -0,0 +1 @@
|
|||||||
|
#import "@local/penpo:5.0.0"
|
1
pending/import4.typ
Normal file
1
pending/import4.typ
Normal file
@ -0,0 +1 @@
|
|||||||
|
#import "@local/noperm:0.0.1"
|
1
pending/import5.typ
Normal file
1
pending/import5.typ
Normal file
@ -0,0 +1 @@
|
|||||||
|
#import "@preview/nope:0.0.1"
|
5
pending/runall.sh
Executable file
5
pending/runall.sh
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#! /usr/bin/env bash
|
||||||
|
|
||||||
|
for file in $(ls pending/*.typ); do
|
||||||
|
cargo run -- compile $file
|
||||||
|
done
|
@ -483,3 +483,16 @@ This is never reached.
|
|||||||
--- import-from-file-package-lookalike ---
|
--- import-from-file-package-lookalike ---
|
||||||
// Error: 9-28 file not found (searched at tests/suite/scripting/#test/mypkg:1.0.0)
|
// Error: 9-28 file not found (searched at tests/suite/scripting/#test/mypkg:1.0.0)
|
||||||
#import "#test/mypkg:1.0.0": *
|
#import "#test/mypkg:1.0.0": *
|
||||||
|
|
||||||
|
--- import-from-package-namespace-not-found ---
|
||||||
|
// Error: todo
|
||||||
|
#import "@missingdir/test:0.0.0": *
|
||||||
|
|
||||||
|
--- import-from-package-not-found ---
|
||||||
|
// Error: todo
|
||||||
|
#import "@test/missingpkg:0.0.0": *
|
||||||
|
|
||||||
|
--- import-from-package-version-not-found ---
|
||||||
|
// Error: todo
|
||||||
|
#import "@test/mypkg:5.0.0": *
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user