Skip to content

Commit

Permalink
Merge branch 'main' into custom-runtime-snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
mlafeldt committed Apr 29, 2024
2 parents 181f3a9 + 4384a12 commit 3aa046c
Show file tree
Hide file tree
Showing 470 changed files with 4,242 additions and 2,193 deletions.
2 changes: 1 addition & 1 deletion .dprint.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"plugins": [
"https://plugins.dprint.dev/typescript-0.90.4.wasm",
"https://plugins.dprint.dev/json-0.19.2.wasm",
"https://plugins.dprint.dev/markdown-0.16.4.wasm",
"https://plugins.dprint.dev/markdown-0.17.0.wasm",
"https://plugins.dprint.dev/toml-0.6.1.wasm",
"https://plugins.dprint.dev/exec-0.4.4.json@c207bf9b9a4ee1f0ecb75c594f774924baf62e8e53a2ce9d873816a408cecbf7"
]
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/ci.generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,12 @@ const ci = {
run:
"deno run --unstable --allow-write --allow-read --allow-run --allow-net ./tools/lint.js",
},
{
name: "jsdoc_checker.js",
if: "matrix.job == 'lint'",
run:
"deno run --allow-read --allow-env --allow-sys ./tools/jsdoc_checker.js",
},
{
name: "node_compat/setup.ts --check",
if: "matrix.job == 'lint' && matrix.os == 'linux'",
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,9 @@ jobs:
- name: lint.js
if: '!(matrix.skip) && (matrix.job == ''lint'')'
run: deno run --unstable --allow-write --allow-read --allow-run --allow-net ./tools/lint.js
- name: jsdoc_checker.js
if: '!(matrix.skip) && (matrix.job == ''lint'')'
run: deno run --allow-read --allow-env --allow-sys ./tools/jsdoc_checker.js
- name: node_compat/setup.ts --check
if: '!(matrix.skip) && (matrix.job == ''lint'' && matrix.os == ''linux'')'
run: deno run --allow-write --allow-read --allow-run=git ./tests/node_compat/runner/setup.ts --check
Expand Down
58 changes: 51 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ winres.workspace = true
[dependencies]
deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "proposal", "react", "sourcemap", "transforms", "typescript", "view", "visit"] }
deno_cache_dir = { workspace = true }
deno_config = "=0.16.1"
deno_config = "=0.16.2"
deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] }
deno_doc = { version = "=0.128.1", features = ["html"] }
deno_doc = { version = "=0.128.1", features = ["html", "syntect"] }
deno_emit = "=0.40.1"
deno_graph = { version = "=0.74.0", features = ["tokio_executor"] }
deno_lint = { version = "=0.58.4", features = ["docs"] }
Expand Down Expand Up @@ -98,7 +98,7 @@ dissimilar = "=1.0.4"
dotenvy = "0.15.7"
dprint-plugin-json = "=0.19.2"
dprint-plugin-jupyter = "=0.1.3"
dprint-plugin-markdown = "=0.16.4"
dprint-plugin-markdown = "=0.17.0"
dprint-plugin-typescript = "=0.90.4"
env_logger = "=0.10.0"
fancy-regex = "=0.10.0"
Expand Down
2 changes: 1 addition & 1 deletion cli/args/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ impl CliOptions {
&self,
) -> Result<Option<ModuleSpecifier>, AnyError> {
match self.overrides.import_map_specifier.clone() {
Some(maybe_path) => Ok(maybe_path),
Some(maybe_url) => Ok(maybe_url),
None => resolve_import_map_specifier(
self.flags.import_map_path.as_deref(),
self.maybe_config_file.as_ref(),
Expand Down
1 change: 1 addition & 0 deletions cli/cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ impl Loader for FetchCacher {
source: &Arc<[u8]>,
module_info: &deno_graph::ModuleInfo,
) {
log::debug!("Caching module info for {}", specifier);
let source_hash = ModuleInfoCacheSourceHash::from_source(source);
let result = self.module_info_cache.set_module_info(
specifier,
Expand Down
23 changes: 8 additions & 15 deletions cli/lsp/analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ use super::diagnostics::DenoDiagnostic;
use super::diagnostics::DiagnosticSource;
use super::documents::Documents;
use super::language_server;
use super::resolver::LspResolver;
use super::tsc;

use crate::args::jsr_url;
use crate::npm::CliNpmResolver;
use crate::resolver::CliNodeResolver;
use crate::tools::lint::create_linter;
use deno_runtime::fs_util::specifier_to_file_path;

Expand All @@ -27,7 +26,6 @@ use deno_lint::diagnostic::LintDiagnostic;
use deno_lint::rules::LintRule;
use deno_runtime::deno_node::NpmResolver;
use deno_runtime::deno_node::PathClean;
use deno_runtime::permissions::PermissionsContainer;
use deno_semver::jsr::JsrPackageNvReference;
use deno_semver::jsr::JsrPackageReqReference;
use deno_semver::npm::NpmPackageReqReference;
Expand Down Expand Up @@ -217,22 +215,19 @@ fn code_as_string(code: &Option<lsp::NumberOrString>) -> String {
pub struct TsResponseImportMapper<'a> {
documents: &'a Documents,
maybe_import_map: Option<&'a ImportMap>,
node_resolver: Option<&'a CliNodeResolver>,
npm_resolver: Option<&'a dyn CliNpmResolver>,
resolver: &'a LspResolver,
}

impl<'a> TsResponseImportMapper<'a> {
pub fn new(
documents: &'a Documents,
maybe_import_map: Option<&'a ImportMap>,
node_resolver: Option<&'a CliNodeResolver>,
npm_resolver: Option<&'a dyn CliNpmResolver>,
resolver: &'a LspResolver,
) -> Self {
Self {
documents,
maybe_import_map,
node_resolver,
npm_resolver,
resolver,
}
}

Expand Down Expand Up @@ -304,9 +299,7 @@ impl<'a> TsResponseImportMapper<'a> {
return Some(spec_str);
}

if let Some(npm_resolver) =
self.npm_resolver.as_ref().and_then(|r| r.as_managed())
{
if let Some(npm_resolver) = self.resolver.maybe_managed_npm_resolver() {
if npm_resolver.in_npm_package(specifier) {
if let Ok(Some(pkg_id)) =
npm_resolver.resolve_pkg_id_from_specifier(specifier)
Expand Down Expand Up @@ -370,9 +363,9 @@ impl<'a> TsResponseImportMapper<'a> {
&self,
specifier: &ModuleSpecifier,
) -> Option<String> {
let node_resolver = self.node_resolver?;
let package_json = node_resolver
.get_closest_package_json(specifier, &PermissionsContainer::allow_all())
let package_json = self
.resolver
.get_closest_package_json(specifier)
.ok()
.flatten()?;
let root_folder = package_json.path.parent()?;
Expand Down
4 changes: 2 additions & 2 deletions cli/lsp/completions.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

use super::client::Client;
use super::config::ConfigSnapshot;
use super::config::Config;
use super::config::WorkspaceSettings;
use super::documents::Documents;
use super::documents::DocumentsFilter;
Expand Down Expand Up @@ -148,7 +148,7 @@ fn to_narrow_lsp_range(
pub async fn get_import_completions(
specifier: &ModuleSpecifier,
position: &lsp::Position,
config: &ConfigSnapshot,
config: &Config,
client: &Client,
module_registries: &ModuleRegistry,
jsr_search_api: &CliJsrSearchApi,
Expand Down

0 comments on commit 3aa046c

Please sign in to comment.