Skip to content

Commit c390089

Browse files
committed
Update dependencies to latest.
This also updates warg to 0.4.1, which is the latest supported.
1 parent 4934326 commit c390089

17 files changed

Lines changed: 1960 additions & 753 deletions

File tree

Cargo.lock

Lines changed: 1830 additions & 655 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ wasmparser = { workspace = true }
3434
wasmprinter = { workspace = true }
3535
thiserror = { workspace = true }
3636
indexmap = { workspace = true }
37-
# TODO: use the next release which has support for primary labels
38-
miette = { git = "https://github.com/zkat/miette", features = ["fancy"] }
37+
miette = { workspace = true, features = ["fancy"] }
3938
semver = { workspace = true }
4039
indicatif = { workspace = true, optional = true }
4140

@@ -48,31 +47,33 @@ registry = ["wac-resolver/registry", "indicatif"]
4847
[workspace.dependencies]
4948
wac-parser = { path = "crates/wac-parser", default-features = false }
5049
wac-resolver = { path = "crates/wac-resolver", default-features = false }
51-
wit-parser = "0.13.0"
52-
wasmparser = "0.118.1"
53-
wit-component = "0.19.0"
54-
wasm-encoder = "0.38.1"
55-
wasmprinter = "0.2.75"
56-
wasm-metadata = "0.10.14"
57-
anyhow = "1.0.75"
58-
clap = { version = "4.4.10", features = ["derive"] }
59-
semver = { version = "1.0.20", features = ["serde"] }
50+
wit-parser = "0.201.0"
51+
wasmparser = "0.201.0"
52+
wit-component = "0.201.0"
53+
wasm-encoder = "0.201.0"
54+
wasmprinter = "0.201.0"
55+
wasm-metadata = "0.201.0"
56+
anyhow = "1.0.81"
57+
clap = { version = "4.5.2", features = ["derive"] }
58+
semver = { version = "1.0.22", features = ["serde"] }
6059
pretty_env_logger = "0.5.0"
61-
log = "0.4.20"
62-
tokio = { version = "1.34.0", default-features = false, features = ["macros", "rt-multi-thread"] }
63-
owo-colors = { version = "3.5.0", features = ["supports-colors"] }
64-
indexmap = { version = "2.1.0", features = ["serde"] }
60+
log = "0.4.21"
61+
tokio = { version = "1.36.0", default-features = false, features = ["macros", "rt-multi-thread"] }
62+
owo-colors = { version = "4.0.0", features = ["supports-colors"] }
63+
indexmap = { version = "2.2.5", features = ["serde"] }
6564
id-arena = "2.2.1"
66-
serde = { version = "1.0.193", features = ["derive"] }
67-
serde_json = "1.0.108"
68-
wat = "1.0.82"
69-
logos = "0.13.0"
70-
thiserror = "1.0.50"
71-
# TODO: update these to 0.3.0 when it's released
72-
warg-client = { git = "https://github.com/bytecodealliance/registry" }
73-
warg-protocol = { git = "https://github.com/bytecodealliance/registry" }
74-
warg-crypto = { git = "https://github.com/bytecodealliance/registry" }
75-
warg-server = { git = "https://github.com/bytecodealliance/registry" }
76-
futures = "0.3.29"
77-
indicatif = "0.17.7"
65+
serde = { version = "1.0.197", features = ["derive"] }
66+
serde_json = "1.0.114"
67+
wat = "1.201.0"
68+
logos = "0.14.0"
69+
miette = "7.2.0"
70+
thiserror = "1.0.58"
71+
warg-client = "0.4.1"
72+
warg-protocol = "0.4.1"
73+
warg-crypto = "0.4.1"
74+
warg-server = "0.4.1"
75+
warg-credentials = "0.4.1"
76+
secrecy = "0.8.0"
77+
futures = "0.3.30"
78+
indicatif = "0.17.8"
7879
pretty_assertions = "1.4.0"

crates/wac-parser/Cargo.toml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,18 @@ serde = { workspace = true }
2121
wasmparser = { workspace = true }
2222
wasm-encoder = { workspace = true }
2323
wasm-metadata = { workspace = true }
24-
# TODO: use the next release which has support for primary labels
25-
miette = { git = "https://github.com/zkat/miette", features = ["serde"] }
24+
miette = { workspace = true, features = ["serde"]}
2625

2726
[dev-dependencies]
2827
wac-resolver = { workspace = true, default-features = false, features = ["wat", "wit"] }
29-
owo-colors = "3.5.0"
28+
owo-colors = "4.0.0"
3029
pretty_assertions = { workspace = true }
3130
pretty_env_logger = { workspace = true }
32-
rayon = "1.8.0"
31+
rayon = "1.9.0"
3332
tokio = { workspace = true }
3433
serde_json = { workspace = true }
3534
wasmprinter = { workspace = true }
36-
# TODO: use the next release which has support for primary labels
37-
miette = { git = "https://github.com/zkat/miette", features = [
38-
"serde",
39-
"fancy",
40-
] }
35+
miette = { workspace = true, features = ["fancy", "serde"]}
4136

4237
[[test]]
4338
name = "parser"

crates/wac-parser/src/ast/expr.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl<'a> Parse<'a> for Expr<'a> {
4242
});
4343

4444
Ok(Self {
45-
span: SourceSpan::new(start.offset().into(), len.into()),
45+
span: SourceSpan::new(start.offset().into(), len),
4646
primary,
4747
postfix,
4848
})
@@ -109,7 +109,7 @@ impl<'a> Parse<'a> for NewExpr<'a> {
109109
Ok(Self {
110110
span: SourceSpan::new(
111111
start.offset().into(),
112-
((end.offset() + end.len()) - start.offset()).into(),
112+
(end.offset() + end.len()) - start.offset(),
113113
),
114114
package,
115115
arguments,
@@ -265,7 +265,7 @@ impl<'a> Parse<'a> for NestedExpr<'a> {
265265
Ok(Self {
266266
span: SourceSpan::new(
267267
start.offset().into(),
268-
((end.offset() + end.len()) - start.offset()).into(),
268+
(end.offset() + end.len()) - start.offset(),
269269
),
270270
inner,
271271
})
@@ -315,7 +315,7 @@ impl<'a> Parse<'a> for AccessExpr<'a> {
315315
Ok(Self {
316316
span: SourceSpan::new(
317317
start.offset().into(),
318-
(id.span.offset() - start.offset() + id.span.len()).into(),
318+
id.span.offset() - start.offset() + id.span.len(),
319319
),
320320
id,
321321
})
@@ -346,7 +346,7 @@ impl<'a> Parse<'a> for NamedAccessExpr<'a> {
346346
Ok(Self {
347347
span: SourceSpan::new(
348348
opening.offset().into(),
349-
((closing.offset() + closing.len()) - opening.offset()).into(),
349+
(closing.offset() + closing.len()) - opening.offset(),
350350
),
351351
string,
352352
})

crates/wac-parser/src/ast/import.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,14 @@ pub struct PackagePath<'a> {
137137
impl<'a> PackagePath<'a> {
138138
/// Gets the span of only the package name.
139139
pub fn package_name_span(&self) -> SourceSpan {
140-
SourceSpan::new(self.span.offset().into(), self.name.len().into())
140+
SourceSpan::new(self.span.offset().into(), self.name.len())
141141
}
142142

143143
/// Iterates over the segments of the package path.
144144
pub fn segment_spans<'b>(&'b self) -> impl Iterator<Item = (&'a str, SourceSpan)> + 'b {
145145
self.segments.split('/').map(|s| {
146146
let start = self.span.offset() + s.as_ptr() as usize - self.name.as_ptr() as usize;
147-
(s, SourceSpan::new(start.into(), s.len().into()))
147+
(s, SourceSpan::new(start.into(), s.len()))
148148
})
149149
}
150150
}
@@ -163,10 +163,7 @@ impl<'a> Parse<'a> for PackagePath<'a> {
163163
let start = span.offset() + at + 1;
164164
version.parse().map_err(|_| Error::InvalidVersion {
165165
version: version.to_owned(),
166-
span: SourceSpan::new(
167-
start.into(),
168-
((span.offset() + span.len()) - start).into(),
169-
),
166+
span: SourceSpan::new(start.into(), (span.offset() + span.len()) - start),
170167
})
171168
})
172169
.transpose()?;
@@ -213,10 +210,7 @@ impl<'a> Parse<'a> for PackageName<'a> {
213210
let start = span.offset() + at + 1;
214211
version.parse().map_err(|_| Error::InvalidVersion {
215212
version: version.to_string(),
216-
span: SourceSpan::new(
217-
start.into(),
218-
((span.offset() + span.len()) - start).into(),
219-
),
213+
span: SourceSpan::new(start.into(), (span.offset() + span.len()) - start),
220214
})
221215
})
222216
.transpose()?;

crates/wac-parser/src/ast/type.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ impl<'a> Parse<'a> for Type<'a> {
745745
types,
746746
SourceSpan::new(
747747
span.offset().into(),
748-
((close.offset() + close.len()) - span.offset()).into(),
748+
(close.offset() + close.len()) - span.offset(),
749749
),
750750
))
751751
} else if lookahead.peek(Token::ListKeyword) {
@@ -757,7 +757,7 @@ impl<'a> Parse<'a> for Type<'a> {
757757
ty,
758758
SourceSpan::new(
759759
span.offset().into(),
760-
((close.offset() + close.len()) - span.offset()).into(),
760+
(close.offset() + close.len()) - span.offset(),
761761
),
762762
))
763763
} else if lookahead.peek(Token::OptionKeyword) {
@@ -769,12 +769,13 @@ impl<'a> Parse<'a> for Type<'a> {
769769
ty,
770770
SourceSpan::new(
771771
span.offset().into(),
772-
((close.offset() + close.len()) - span.offset()).into(),
772+
(close.offset() + close.len()) - span.offset(),
773773
),
774774
))
775775
} else if lookahead.peek(Token::ResultKeyword) {
776776
let mut span = lexer.next().unwrap().1;
777-
let (ok, err) = match parse_optional(lexer, Token::OpenAngle, |lexer| {
777+
778+
let parse = |lexer: &mut Lexer<'a>| {
778779
let mut lookahead = Lookahead::new(lexer);
779780
let ok = if lookahead.peek(Token::Underscore) {
780781
lexer.next();
@@ -801,10 +802,12 @@ impl<'a> Parse<'a> for Type<'a> {
801802
let close = parse_token(lexer, Token::CloseAngle)?;
802803
span = SourceSpan::new(
803804
span.offset().into(),
804-
((close.offset() + close.len()) - span.offset()).into(),
805+
(close.offset() + close.len()) - span.offset(),
805806
);
806807
Ok((ok, err))
807-
})? {
808+
};
809+
810+
let (ok, err) = match parse_optional(lexer, Token::OpenAngle, parse)? {
808811
Some((ok, err)) => (ok, err),
809812
None => (None, None),
810813
};
@@ -818,7 +821,7 @@ impl<'a> Parse<'a> for Type<'a> {
818821
id,
819822
SourceSpan::new(
820823
span.offset().into(),
821-
((close.offset() + close.len()) - span.offset()).into(),
824+
(close.offset() + close.len()) - span.offset(),
822825
),
823826
))
824827
} else if Ident::peek(&mut lookahead) {

crates/wac-parser/src/lexer.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use miette::SourceSpan;
55
use std::fmt;
66

77
fn to_source_span(span: logos::Span) -> SourceSpan {
8-
SourceSpan::new(span.start.into(), (span.end - span.start).into())
8+
SourceSpan::new(span.start.into(), span.end - span.start)
99
}
1010

1111
/// Represents a lexer error.
@@ -52,7 +52,7 @@ fn detect_invalid_input(source: &str) -> Result<(), (Error, SourceSpan)> {
5252
| '\u{2067}' | '\u{2068}' | '\u{2069}' => {
5353
return Err((
5454
Error::DisallowedBidirectionalOverride(ch),
55-
SourceSpan::new(offset.into(), ch.len_utf8().into()),
55+
SourceSpan::new(offset.into(), ch.len_utf8()),
5656
));
5757
}
5858

@@ -67,7 +67,7 @@ fn detect_invalid_input(source: &str) -> Result<(), (Error, SourceSpan)> {
6767
| '\u{17b4}' | '\u{17b5}' => {
6868
return Err((
6969
Error::DiscouragedUnicodeCodepoint(ch),
70-
SourceSpan::new(offset.into(), ch.len_utf8().into()),
70+
SourceSpan::new(offset.into(), ch.len_utf8()),
7171
));
7272
}
7373

@@ -77,7 +77,7 @@ fn detect_invalid_input(source: &str) -> Result<(), (Error, SourceSpan)> {
7777
ch if ch.is_control() => {
7878
return Err((
7979
Error::DisallowedControlCode(ch),
80-
SourceSpan::new(offset.into(), ch.len_utf8().into()),
80+
SourceSpan::new(offset.into(), ch.len_utf8()),
8181
));
8282
}
8383

@@ -480,21 +480,21 @@ impl<'a> Lexer<'a> {
480480

481481
/// Peeks at the next token.
482482
pub fn peek(&self) -> Option<(LexerResult<Token>, SourceSpan)> {
483-
let mut lexer = self.0.clone().spanned();
483+
let mut lexer = self.0.clone();
484484
lexer.next().map(|(r, s)| (r, to_source_span(s)))
485485
}
486486

487487
/// Peeks at the token after the next token.
488488
pub fn peek2(&self) -> Option<(LexerResult<Token>, SourceSpan)> {
489-
let mut lexer = self.0.clone().spanned();
489+
let mut lexer = self.0.clone();
490490
lexer.next();
491491
lexer.next().map(|(r, s)| (r, to_source_span(s)))
492492
}
493493

494494
/// Consumes available documentation comment tokens.
495-
pub fn comments<'b>(&'b self) -> Result<Vec<(&'a str, SourceSpan)>, (Error, SourceSpan)> {
495+
pub fn comments(&self) -> Result<Vec<(&'a str, SourceSpan)>, (Error, SourceSpan)> {
496496
let mut comments = Vec::new();
497-
let mut lexer = self.0.clone().morph::<helpers::CommentToken>().spanned();
497+
let mut lexer = (*self.0).clone().morph::<helpers::CommentToken>().spanned();
498498
while let Some((Ok(token), span)) = lexer.next() {
499499
match token {
500500
helpers::CommentToken::Comment(c) | helpers::CommentToken::BlockComment(c) => {
@@ -537,7 +537,7 @@ mod test {
537537
source: &'a Token::Source,
538538
tokens: &[(
539539
Result<Token, Token::Error>,
540-
&'a <Token::Source as Source>::Slice,
540+
<Token::Source as Source>::Slice<'a>,
541541
Range<usize>,
542542
)],
543543
) where

crates/wac-parser/src/resolution/ast.rs

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ use std::{
1414
collections::{hash_map, HashMap, HashSet},
1515
sync::Arc,
1616
};
17-
use wasmparser::names::{ComponentName, ComponentNameKind};
17+
use wasmparser::{
18+
names::{ComponentName, ComponentNameKind},
19+
BinaryReaderError,
20+
};
1821

1922
#[derive(Default)]
2023
struct Scope {
@@ -427,21 +430,20 @@ impl<'a> AstResolver<'a> {
427430
span: SourceSpan,
428431
show_hint: bool,
429432
) -> Result<(), Error> {
430-
match ComponentName::new(&name, 0)
431-
.map_err(|e| {
432-
let msg = e.to_string();
433-
Error::InvalidExternName {
434-
name: name.clone(),
435-
kind: ExternKind::Export,
436-
span,
437-
source: anyhow::anyhow!(
438-
"{msg}",
439-
msg = msg.strip_suffix(" (at offset 0x0)").unwrap_or(&msg)
440-
),
441-
}
442-
})?
443-
.kind()
444-
{
433+
let map_err = |e: BinaryReaderError| {
434+
let msg = e.to_string();
435+
Error::InvalidExternName {
436+
name: name.clone(),
437+
kind: ExternKind::Export,
438+
span,
439+
source: anyhow::anyhow!(
440+
"{msg}",
441+
msg = msg.strip_suffix(" (at offset 0x0)").unwrap_or(&msg)
442+
),
443+
}
444+
};
445+
446+
match ComponentName::new(&name, 0).map_err(map_err)?.kind() {
445447
ComponentNameKind::Hash(_)
446448
| ComponentNameKind::Url(_)
447449
| ComponentNameKind::Dependency(_) => {

0 commit comments

Comments
 (0)