diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-02-20 19:14:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-20 19:14:06 +0100 |
commit | 4d1a14ca7fa9496f36470a7771448a9b006b0204 (patch) | |
tree | de226f6368faec98065bf14382f23541484cfe72 /cli/lsp/language_server.rs | |
parent | 88f6fc6a1684326ae1f947ea8ec24ad0bff0f449 (diff) |
feat: auto-discover package.json for npm dependencies (#17272)
This commits adds auto-discovery of "package.json" file when running
"deno run" and "deno task" subcommands. In case of "deno run" the
"package.json" is being looked up starting from the directory of the
script that is being run, stopping early if "deno.json(c)" file is found
(ie. FS tree won't be traversed "up" from "deno.json").
When "package.json" is discovered the "--node-modules-dir" flag is
implied, leading to creation of local "node_modules/" directory - we
did that, because most tools relying on "package.json" will expect
"node_modules/" directory to be present (eg. Vite). Additionally
"dependencies" and "devDependencies" specified in the "package.json"
are downloaded on startup.
This is a stepping stone to supporting bare specifier imports, but
the actual integration will be done in a follow up commit.
---------
Co-authored-by: David Sherret <dsherret@gmail.com>
Diffstat (limited to 'cli/lsp/language_server.rs')
-rw-r--r-- | cli/lsp/language_server.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs index 70797eaf2..1bde85d8f 100644 --- a/cli/lsp/language_server.rs +++ b/cli/lsp/language_server.rs @@ -322,7 +322,7 @@ fn create_lsp_npm_resolver( http_client, progress_bar, ); - NpmPackageResolver::new(npm_cache, api, false, None) + NpmPackageResolver::new(npm_cache, api) } impl Inner { @@ -3018,6 +3018,8 @@ impl Inner { self.maybe_config_file.clone(), // TODO(#16510): add support for lockfile None, + // TODO(bartlomieju): handle package.json dependencies here + None, ); cli_options.set_import_map_specifier(self.maybe_import_map_uri.clone()); |