Skip to content

Commit 76a0f1c

Browse files
committed
Merge branch 'main' into fix/ban-cjs-and-cts
2 parents f476c64 + 608cad5 commit 76a0f1c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+3829
-2014
lines changed

Cargo.lock

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

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ making changes to the API.
114114

115115
### Running jsr
116116

117-
1. `deno task services:macos`, `deno task services:macos:amd` or `deno task services:linux` in one terminal
117+
1. `deno task services:macos`, `deno task services:macos:amd` or
118+
`deno task services:linux` in one terminal
118119
2. `deno task dev:api` in another terminal
119120
3. `deno task dev:frontend` in another terminal
120121

@@ -135,10 +136,12 @@ registry with data is to publish
135136
[deno_std](https://github.com/denoland/deno_std) to the registry. This can be
136137
done via the following steps:
137138

138-
1. Make sure to [make yourself a staff user/admin](#making-yourself-a-staff-useradmin).
139+
1. Make sure to
140+
[make yourself a staff user/admin](#making-yourself-a-staff-useradmin).
139141
2. Navigate to your profile page and copy the UUID from the URL.
140-
3. Assign the `std` scope to your user through the [admin panel](http://jsr.test/admin/scopes/assign)
141-
by using the UUID from the previous step.
142+
3. Assign the `std` scope to your user through the
143+
[admin panel](http://jsr.test/admin/scopes/assign) by using the UUID from the
144+
previous step.
142145
4. Clone https://github.com/denoland/deno_std in the same parent folder as the
143146
`jsr` project.
144147
5. Run `JSR_URL=http://jsr.test deno publish` to publish all of the @std

api/Cargo.toml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ deno_semver = "0.5.2"
7878
flate2 = "1"
7979
thiserror = "1"
8080
async-tar = "0.4.2"
81-
deno_graph = "0.83.3"
82-
deno_ast = { version = "0.42.0", features = ["view"] }
83-
deno_doc = { version = "0.155.0" }
84-
comrak = { version = "0.28.0", default-features = false }
81+
deno_graph = "0.84.1"
82+
deno_ast = { version = "0.43.3", features = ["view"] }
83+
deno_doc = { version = "0.157.0", features = ["comrak"] }
84+
comrak = { version = "0.29.0", default-features = false }
8585
async-trait = "0.1.73"
8686
jsonwebkey = { version = "0.3.5", features = ["jsonwebtoken", "jwt-convert"] }
8787
jsonwebtoken = "8.3.0"
@@ -96,6 +96,19 @@ sha1 = "0.10.6"
9696
infer = "0.15.0"
9797
x509-parser = { version = "0.15.1", features = ["verify"] }
9898
sitemap-rs = "0.2.1"
99+
html-escape = "0.2.13"
100+
101+
tree-sitter-highlight = "0.22.6"
102+
tree-sitter-javascript = "0.21.4"
103+
tree-sitter-typescript = "0.21.2"
104+
tree-sitter-json = "0.21.0"
105+
tree-sitter-regex = "0.21.0"
106+
tree-sitter-css = "0.21.0"
107+
tree-sitter-md = "0.2.3"
108+
tree-sitter-rust = "0.21.2"
109+
tree-sitter-html = "0.20.3"
110+
tree-sitter-bash = "0.21.0"
111+
tree-sitter-xml = "0.6.4"
99112

100113
[dev-dependencies]
101114
flate2 = "1"

api/src/analysis.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use deno_graph::source::NullFileSystem;
2121
use deno_graph::BuildFastCheckTypeGraphOptions;
2222
use deno_graph::BuildOptions;
2323
use deno_graph::CapturingModuleAnalyzer;
24-
use deno_graph::DefaultModuleParser;
24+
use deno_graph::DefaultEsParser;
2525
use deno_graph::GraphKind;
2626
use deno_graph::ModuleGraph;
2727
use deno_graph::ModuleInfo;
@@ -168,7 +168,7 @@ async fn analyze_package_inner(
168168
fast_check_cache: None,
169169
fast_check_dts: true,
170170
jsr_url_provider: &PassthroughJsrUrlProvider,
171-
module_parser: Some(&module_analyzer.analyzer),
171+
es_parser: Some(&module_analyzer.analyzer),
172172
resolver: Default::default(),
173173
npm_resolver: Default::default(),
174174
workspace_fast_check: WorkspaceFastCheckOption::Enabled(&workspace_members),
@@ -596,7 +596,7 @@ async fn rebuild_npm_tarball_inner(
596596
fast_check_cache: Default::default(),
597597
fast_check_dts: true,
598598
jsr_url_provider: &PassthroughJsrUrlProvider,
599-
module_parser: Some(&module_analyzer.analyzer),
599+
es_parser: Some(&module_analyzer.analyzer),
600600
resolver: None,
601601
npm_resolver: None,
602602
workspace_fast_check: WorkspaceFastCheckOption::Enabled(&workspace_members),
@@ -681,14 +681,14 @@ impl<'a> deno_graph::source::Loader for GcsLoader<'a> {
681681
}
682682

683683
#[derive(Default)]
684-
pub struct ModuleParser(DefaultModuleParser);
684+
pub struct ModuleParser(DefaultEsParser);
685685

686-
impl deno_graph::ModuleParser for ModuleParser {
687-
fn parse_module(
686+
impl deno_graph::EsParser for ModuleParser {
687+
fn parse_program(
688688
&self,
689689
options: deno_graph::ParseOptions,
690690
) -> Result<ParsedSource, deno_ast::ParseDiagnostic> {
691-
let source = self.0.parse_module(options)?;
691+
let source = self.0.parse_program(options)?;
692692
if let Some(err) = source.diagnostics().first() {
693693
return Err(err.clone());
694694
}
@@ -833,9 +833,9 @@ fn check_for_banned_syntax(
833833
(line_number, column_number)
834834
};
835835

836-
for i in parsed_source.module().body.iter() {
836+
for i in parsed_source.program_ref().body() {
837837
match i {
838-
ast::ModuleItem::ModuleDecl(n) => match n {
838+
deno_ast::ModuleItemRef::ModuleDecl(n) => match n {
839839
ast::ModuleDecl::TsNamespaceExport(n) => {
840840
let (line, column) = line_col(&n.range());
841841
return Err(PublishError::GlobalTypeAugmentation {
@@ -910,7 +910,7 @@ fn check_for_banned_syntax(
910910
}
911911
_ => continue,
912912
},
913-
ast::ModuleItem::Stmt(n) => match n {
913+
deno_ast::ModuleItemRef::Stmt(n) => match n {
914914
ast::Stmt::Decl(ast::Decl::TsModule(n)) => {
915915
if n.global {
916916
let (line, column) = line_col(&n.range());

api/src/api/package.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,7 @@ pub async fn get_docs_handler(
10621062
match docs {
10631063
GeneratedDocsOutput::Docs(docs) => Ok(ApiPackageVersionDocs::Content {
10641064
css: Cow::Borrowed(deno_doc::html::STYLESHEET),
1065+
comrak_css: Cow::Borrowed(deno_doc::html::comrak::COMRAK_STYLESHEET),
10651066
script: Cow::Borrowed(deno_doc::html::SCRIPT_JS),
10661067
breadcrumbs: docs.breadcrumbs,
10671068
toc: docs.toc,
@@ -1300,7 +1301,9 @@ pub async fn get_source_handler(
13001301
let source = if let Some(file) = file {
13011302
let size = file.len();
13021303

1303-
let highlighter = deno_doc::html::setup_highlighter(true);
1304+
let highlighter = crate::tree_sitter::ComrakAdapter {
1305+
show_line_numbers: true,
1306+
};
13041307

13051308
let view = if let Ok(file) = String::from_utf8(file.to_vec()) {
13061309
let mut out = vec![];
@@ -2644,6 +2647,7 @@ ggHohNAjhbzDaY2iBW/m3NC5dehGUP4T2GBo/cwGhg==
26442647
ApiPackageVersionDocs::Content {
26452648
version,
26462649
css,
2650+
comrak_css: _,
26472651
script: _,
26482652
breadcrumbs,
26492653
toc,
@@ -2669,6 +2673,7 @@ ggHohNAjhbzDaY2iBW/m3NC5dehGUP4T2GBo/cwGhg==
26692673
ApiPackageVersionDocs::Content {
26702674
version,
26712675
css,
2676+
comrak_css: _,
26722677
script: _,
26732678
breadcrumbs,
26742679
toc,
@@ -2698,6 +2703,7 @@ ggHohNAjhbzDaY2iBW/m3NC5dehGUP4T2GBo/cwGhg==
26982703
ApiPackageVersionDocs::Content {
26992704
version,
27002705
css,
2706+
comrak_css: _,
27012707
script: _,
27022708
breadcrumbs,
27032709
toc,
@@ -2730,6 +2736,7 @@ ggHohNAjhbzDaY2iBW/m3NC5dehGUP4T2GBo/cwGhg==
27302736
ApiPackageVersionDocs::Content {
27312737
version,
27322738
css,
2739+
comrak_css: _,
27332740
script: _,
27342741
breadcrumbs,
27352742
toc,

api/src/api/types.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,9 +586,11 @@ pub struct ApiPackageVersion {
586586
#[serde(rename_all = "camelCase", tag = "kind")]
587587
#[allow(clippy::large_enum_variant)]
588588
pub enum ApiPackageVersionDocs {
589+
#[serde(rename_all = "camelCase")]
589590
Content {
590591
version: ApiPackageVersion,
591592
css: Cow<'static, str>,
593+
comrak_css: Cow<'static, str>,
592594
script: Cow<'static, str>,
593595
breadcrumbs: Option<String>,
594596
toc: Option<String>,

0 commit comments

Comments
 (0)