Skip to content

Commit

Permalink
Merge branch 'main' into fix/ban-cjs-and-cts
Browse files Browse the repository at this point in the history
  • Loading branch information
mbhrznr authored Jan 10, 2025
2 parents 42597a9 + d5dd83d commit 56ed5c4
Show file tree
Hide file tree
Showing 41 changed files with 935 additions and 273 deletions.
479 changes: 390 additions & 89 deletions Cargo.lock

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,33 @@ INSERT INTO bad_words (word) VALUES
`psql postgres://127.0.0.1:5433/registry --user [your username] -f bad_words.sql`,
and provide the password for the provided username.

### Contributing to documentation generation

The documentation generation is done via
[`deno_doc`](https://github.com/denoland/deno_doc).

To be able to use a local `deno_doc` clone in jsr, you need to add this to the
root `Cargo.toml` in this repository:

```toml
[patch.crates-io]
deno_doc = { path = "../deno_doc" }
```

Please make sure that the version of `deno_doc` you have locally is the same
version as the one referenced in `api/Cargo.toml`, else the patching will not
work.

Please open PRs in the `deno_doc` repository when it is changes that should
affect the overall documentation generation system, even if it is only for css
changes, with a few minor exceptions when the css changes are related to the
integration and layouting specific for jsr alone.

For more information on how the HTML documentation generation works and how to
locally work on it, please see the
[HTML development section](https://github.com/denoland/deno_doc?tab=readme-ov-file#html-generation)
of `deno_doc`.

### Other

During local dev, traces are sent to Jaeger. You can view them at
Expand Down
18 changes: 10 additions & 8 deletions api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ serde = { version = "1", features = ["derive"] }
serde_json = "1"
tokio = { version = "1", features = ["full"] }
tokio-stream = "0.1"
url = "2"
url = "2.5.4"
uuid = { version = "1", features = ["v4", "serde"] }
clap = { version = "4", default-features = false, features = [
"derive",
Expand All @@ -74,14 +74,15 @@ opentelemetry = { version = "0.19", features = [
] }
opentelemetry-otlp = "0.12"
opentelemetry-gcloud-trace = "0.5.0"
deno_semver = "0.5.2"
deno_semver = "0.6.0"
flate2 = "1"
thiserror = "1"
thiserror = "2"
async-tar = "0.4.2"
deno_graph = "0.84.1"
deno_ast = { version = "0.43.3", features = ["view"] }
deno_doc = { version = "0.159.2", features = ["comrak"] }
deno_graph = "0.86.3"
deno_ast = { version = "0.44.0", features = ["view"] }
deno_doc = { version = "0.162.3", features = ["comrak"] }
comrak = { version = "0.29.0", default-features = false }
ammonia = "4.0.0"
async-trait = "0.1.73"
jsonwebkey = { version = "0.3.5", features = ["jsonwebtoken", "jwt-convert"] }
jsonwebtoken = "8.3.0"
Expand All @@ -91,7 +92,7 @@ regex = "1.10.2"
postmark = { version = "=0.10.0", features = ["reqwest-rustls-tls"] }
handlebars = "5.0.0"
jsonc-parser = { version = "0.23", features = ["serde"] }
deno_npm = "0.25.0"
deno_npm = "0.26.0"
sha1 = "0.10.6"
infer = "0.15.0"
x509-parser = { version = "0.15.1", features = ["verify"] }
Expand All @@ -109,8 +110,9 @@ tree-sitter-rust = "0.21.2"
tree-sitter-html = "0.20.3"
tree-sitter-bash = "0.21.0"
tree-sitter-xml = "0.6.4"
lazy_static = "1.5.0"

[dev-dependencies]
flate2 = "1"
deno_semver = "0.5.1"
deno_semver = "0.6.0"
pretty_assertions = "1.4.0"
2 changes: 1 addition & 1 deletion api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This Dockerfile is adapted from https://whitfin.io/blog/speeding-up-rust-docker-builds/

FROM rust:1.77 as build
FROM rust:1.83 as build

# create a new empty shell project
RUN USER=root cargo new --bin registry_api
Expand Down
10 changes: 5 additions & 5 deletions api/src/analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ impl deno_graph::source::Resolver for JsrResolver {
&self,
specifier_text: &str,
referrer_range: &deno_graph::Range,
_mode: deno_graph::source::ResolutionMode,
_kind: deno_graph::source::ResolutionKind,
) -> Result<ModuleSpecifier, deno_graph::source::ResolveError> {
if let Ok(package_ref) = JsrPackageReqReference::from_str(specifier_text) {
if self.member.name == package_ref.req().name
Expand Down Expand Up @@ -455,7 +455,7 @@ struct SyncLoader<'a> {
files: &'a HashMap<PackagePath, Vec<u8>>,
}

impl<'a> SyncLoader<'a> {
impl SyncLoader<'_> {
fn load_sync(
&self,
specifier: &ModuleSpecifier,
Expand Down Expand Up @@ -485,7 +485,7 @@ impl<'a> SyncLoader<'a> {
}
}

impl<'a> deno_graph::source::Loader for SyncLoader<'a> {
impl deno_graph::source::Loader for SyncLoader<'_> {
fn load(
&self,
specifier: &ModuleSpecifier,
Expand Down Expand Up @@ -629,7 +629,7 @@ struct GcsLoader<'a> {
version: &'a Version,
}

impl<'a> GcsLoader<'a> {
impl GcsLoader<'_> {
fn load_inner(
&self,
specifier: &ModuleSpecifier,
Expand Down Expand Up @@ -670,7 +670,7 @@ impl<'a> GcsLoader<'a> {
}
}

impl<'a> deno_graph::source::Loader for GcsLoader<'a> {
impl deno_graph::source::Loader for GcsLoader<'_> {
fn load(
&self,
specifier: &ModuleSpecifier,
Expand Down
10 changes: 5 additions & 5 deletions api/src/api/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ pub async fn update_user(mut req: Request<Body>) -> ApiResult<ApiFullUser> {
iam.check_admin_access()?;

let user_id = req.param_uuid("user_id")?;
Span::current().record("user_id", &field::display(&user_id));
Span::current().record("user_id", field::display(&user_id));
let ApiAdminUpdateUserRequest {
is_staff,
is_blocked,
Expand Down Expand Up @@ -172,7 +172,7 @@ pub async fn patch_scopes(mut req: Request<Body>) -> ApiResult<ApiFullScope> {
iam.check_admin_access()?;

let scope = req.param_scope()?;
Span::current().record("scope", &field::display(&scope));
Span::current().record("scope", field::display(&scope));

let ApiAdminUpdateScopeRequest {
package_limit,
Expand Down Expand Up @@ -214,8 +214,8 @@ pub async fn assign_scope(mut req: Request<Body>) -> ApiResult<ApiScope> {
iam.check_admin_access()?;

let ApiAssignScopeRequest { scope, user_id } = decode_json(&mut req).await?;
Span::current().record("scope", &field::display(&scope));
Span::current().record("user_id", &field::display(&user_id));
Span::current().record("scope", field::display(&scope));
Span::current().record("user_id", field::display(&user_id));

let db = req.data::<Database>().unwrap();

Expand Down Expand Up @@ -268,7 +268,7 @@ pub async fn requeue_publishing_tasks(req: Request<Body>) -> ApiResult<()> {

let publishing_task_id = req.param_uuid("publishing_task")?;
Span::current()
.record("publishing_task", &field::display(&publishing_task_id));
.record("publishing_task", field::display(&publishing_task_id));

let db = req.data::<Database>().unwrap().clone();
let task = db
Expand Down
8 changes: 4 additions & 4 deletions api/src/api/authorization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ mod tests {

async fn details(t: &mut TestSetup, code: &str) -> Response<Body> {
t.http()
.get(&format!("/api/authorizations/details/{}", code))
.get(format!("/api/authorizations/details/{}", code))
.call()
.await
.unwrap()
Expand Down Expand Up @@ -335,7 +335,7 @@ mod tests {

let mut resp = t
.http()
.post(&format!("/api/authorizations/approve/{}", auth.code))
.post(format!("/api/authorizations/approve/{}", auth.code))
.call()
.await
.unwrap();
Expand Down Expand Up @@ -399,7 +399,7 @@ mod tests {

let mut resp = t
.http()
.post(&format!("/api/authorizations/approve/{}", auth.code))
.post(format!("/api/authorizations/approve/{}", auth.code))
.call()
.await
.unwrap();
Expand Down Expand Up @@ -454,7 +454,7 @@ mod tests {

let mut resp = t
.http()
.post(&format!("/api/authorizations/deny/{}", auth.code))
.post(format!("/api/authorizations/deny/{}", auth.code))
.call()
.await
.unwrap();
Expand Down
Loading

0 comments on commit 56ed5c4

Please sign in to comment.