Commit graph

136 commits

Author SHA1 Message Date
scarf a45f7f237b
feat(cli): top-level exclude field in deno.json (#17778) 2023-05-18 16:55:10 -04:00
David Sherret 41f618a1df
fix(npm): improved optional dependency support (#19135)
Note: If the package information has already been cached, then this
requires running with `--reload` or for the registry information to be
fetched some other way (ex. the cache busting).

Closes #15544

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-17 17:38:50 -04:00
David Sherret 28aa489de9
feat(compile): unstable npm and node specifier support (#19005)
This is the initial support for npm and node specifiers in `deno
compile`. The npm packages are included in the binary and read from it via
a virtual file system. This also supports the `--node-modules-dir` flag,
dependencies specified in a package.json, and npm binary commands (ex.
`deno compile --unstable npm:cowsay`)

Closes #16632
2023-05-10 20:06:59 -04:00
David Sherret 913176313b
perf: lazily create RootCertStore (#18938) 2023-05-01 16:42:05 -04:00
David Sherret 9efed4c7a3
refactor(cli): remove ProcState - add CliFactory (#18900)
This removes `ProcState` and replaces it with a new `CliFactory` which
initializes our "service structs" on demand. This isn't a performance
improvement at the moment for `deno run`, but might unlock performance
improvements in the future.
2023-05-01 14:35:23 -04:00
David Sherret 94a148cdb6
refactor(cli): use CliMainWorker in standalone (#18880)
Uses `CliMainWorker` in all the cli code.
2023-05-01 08:59:38 -04:00
David Sherret 742cc3111c
refactor(cli): extract out ProcState from CliMainWorker (#18867) 2023-04-27 10:05:20 -04:00
scarf 90a5ef5e34
feat(cli): flatten deno.json configuaration (#17799) 2023-04-26 23:02:36 -04:00
Kevin Whinnery a16ad526e9
docs: Improve inline docs for permissions (deno run --help) (#18757)
Hey there! I took a crack at improving these embedded docs [as requested
here](https://github.com/denoland/deno/issues/18685). These should
accurately reflect the functionality of the permission-related flags for
`deno run`.

### Highlights
* Adds human-readable argument string in the format [prescribed in the
docs](https://docs.rs/clap/latest/clap/struct.Arg.html#method.value_name)
* Keeps text description terse, but includes a relevant copy/pasteable
docs link
* Includes example argument usage/formatting
2023-04-27 02:49:59 +02:00
David Sherret 55a9977c62
refactor(compile): remove usage of ProcState and CliOptions (#18855) 2023-04-26 13:07:15 -04:00
David Sherret efa7c19890
refactor: upgrade to deno_npm 0.3.0 (#18671)
This allows us to specify the `@types/node` version constraint in the
CLI instead of in deno_npm.
2023-04-13 10:47:45 -04:00
Geert-Jan Zwiers aaebd6eb42
chore(docs): clarify what subcommands do not type-check by default (#18520)
The CLI docs suggested that all deno subcommands no longer type-check by
default. This is only the case for some subcommands, and this PR
clarifies the CLI docs in this regard.
2023-04-13 03:42:28 +02:00
David Sherret 17e4782140
fix(npm): eagerly reload package information when version from lockfile not found locally (#18673)
Closes #18624
2023-04-12 18:04:45 -04:00
David Sherret 0e3f62d444
fix(npm): cache bust npm specifiers more aggressively (#18636)
Part 1: #18622 
Part 2: This PR

Closes #16901

---------

Co-authored-by: Luca Casonato <hello@lcas.dev>
2023-04-12 08:36:11 -04:00
David Sherret 5c7f76c570
fix(npm): reload an npm package's dependency's information when version not found (#18622)
This reloads an npm package's dependency's information when a
version/version req/tag is not found.

This PR applies only to dependencies of npm packages. It does NOT yet
cause npm specifiers to have their dependency information cache busted.
That requires a different solution, but this should help cache bust in
more scenarios.

Part of #16901, but doesn't close it yet
2023-04-06 21:41:19 -04:00
David Sherret d07aa4a072
refactor(npm): use deno_npm and deno_semver (#18602) 2023-04-06 18:46:44 -04:00
David Sherret e0429e2ad6
fix(repl): improve package.json support (#18497)
1. Fixes a cosmetic issue in the repl where it would display lsp warning
messages.
2. Lazily loads dependencies from the package.json on use.
3. Supports using bare specifiers from package.json in the REPL.

Closes #17929
Closes #18494
2023-03-30 10:43:16 -04:00
Bartek Iwańczuk 101abf3541
refactor(cli): remove Lazy<String> and fix help outputs (#18462)
This `Lazy<String>` calls were showing up on flamegraph and there's
really no point in using them.
2023-03-27 18:28:41 +02:00
Geert-Jan Zwiers a29d88b43b
feat(bench): add --no-run flag (#18433) 2023-03-26 14:55:58 +00:00
Leo Kettmeir 33362b88c3
chore: upgrade clap to v4 (#17333) 2023-03-26 06:06:18 +02:00
Bartek Iwańczuk 275dee60e7
refactor: make version and user_agent &'static str (#18400)
These caused a bunch of unnecessary allocations on each startup.
2023-03-23 23:27:58 +01:00
Cre3per eb25e50edb
fix(cli): restore deno run - to handle stdin as typescript (#18391)
Bug reported here shortly after merging `--ext` changes
https://github.com/denoland/deno/pull/17172#issuecomment-1480898098

Also found a missing `--check` in integration tests for `--ext` that
would have missed a bug if there was one.

Fixes #18392
2023-03-23 12:45:43 -04:00
Cre3per fd0658fb42
feat(cli): --ext parameter for run, compile, and bundle (#17172)
Adds `--ext` to `deno run`, closes #5088

Additionally

- Adds `--ext` to `deno compile` and `deno bundle`
2023-03-22 10:15:53 -04:00
Matt Mastracci a561cc28cd
chore(cli) Use with_context(|| format!(...)) rather than context(format!(...)) to avoid allocations in non-error path (#18332) 2023-03-21 12:13:32 -06:00
David Sherret 2fcf1f14cf
feat: TypeScript 5.0.2 (except decorators) (#18294)
This upgrades TypeScript to 5.0.2, but does not have ES decorator
support because swc does not support that yet.
2023-03-21 15:46:40 +00:00
Andreu Botella b64ec79268
feat(compile): Enable multiple roots for a standalone module graph (#17663)
This change will enable dynamic imports and web workers to use modules
not reachable from the main module, by passing a list of extra side
module roots as options to `deno compile`. 

This can be done by specifying "--include" flag that accepts a file path or a
URL. This flag can be specified multiple times, to include several modules.
The modules specified with "--include" flag, will be added to the produced
"eszip".
2023-03-19 00:43:07 +01:00
Leo Kettmeir 35196eab27
BREAKING(unstable): remove WebGPU (#18094)
This PR _**temporarily**_ removes WebGPU (which has behind the
`--unstable` flag in Deno), due to performance complications due to its
presence.

It will be brought back in the future; as a point of reference, Chrome
will ship WebGPU to stable on 26/04/2023.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-03-17 00:29:32 +01:00
Nick Hanley 1a3c2e2f1d
feat(repl): add DENO_REPL_HISTORY to change history file path (#18047) 2023-03-17 01:22:24 +09:00
David Sherret ca51f4f6c0
fix(npm): "not implemented scheme" message should properly show the scheme (#18209) 2023-03-15 15:23:30 -04:00
Bartek Iwańczuk 6f308b3af0
test: fix flaky resolve_import_map_flags_take_precedence test (#18182)
Trying to fix https://github.com/denoland/deno/issues/18180
2023-03-14 13:37:15 +02:00
Bartek Iwańczuk 48ede89f1f
refactor(core): resolve_url_or_path and resolve_url_or_path_deprecated (#18170)
This commit changes current "deno_core::resolve_url_or_path" API to
"resolve_url_or_path_deprecated" and adds new "resolve_url_or_path"
API that requires to explicitly pass the directory from which paths
should be resolved to. 

Some of the call sites were updated to use the new API, the reminder
of them will be updated in a follow up PR.

Towards landing https://github.com/denoland/deno/pull/15454
2023-03-14 01:12:09 +00:00
David Sherret a35c8e6588
fix(info/doc): add missing --no-lock and --lock flags (#18166)
Closes #18159
2023-03-13 17:04:00 -04:00
David Sherret bcb6ee9d08
refactor(npm): push npm struct creation to a higher level (#18139)
This has been bothering me for a while and it became more painful while
working on #18136 because injecting the shared progress bar became very
verbose. Basically we should move the creation of all these npm structs
up to a higher level.

This is a stepping stone for a future refactor where we can improve how
we create all our structs.
2023-03-12 23:32:59 -04:00
David Sherret 8db853514c
fix(check): regression where config "types" entries caused type checking errors (#18124)
Closes #18117
Closes #18121 (this is just over 10ms faster in a directory one up from
the root folder)

cc @nayeemrmn
2023-03-11 11:43:45 -05:00
Bartek Iwańczuk bb07e230d1
chore: update Rust to 1.68.0 (#18102) 2023-03-09 19:18:00 +00:00
Caleb Cox 0e3affcd5b
fix(cli): add space after period in --v8-flags (#18063)
Add space between period and "Any" in `--v8-flags` help text.
2023-03-07 17:07:28 +01:00
David Sherret 84bafd11d5
fix: lazily surface errors in package.json deps parsing (#17974)
Closes #17941
2023-03-03 18:27:05 -04:00
David Sherret b5b331e31a
fix(npm): skip analyzing more specifiers in package.json (#17938) 2023-02-25 02:16:26 +00:00
David Sherret 5683daf1aa
fix: ignore workspace specifiers in package.json (#17934)
Part of #17916
2023-02-24 19:27:50 -05:00
David Sherret a27d0885f4
feat: add DENO_NO_PACKAGE_JSON env var (#17926)
Depends on #17924

Part of #17916
2023-02-24 19:23:07 +00:00
David Sherret 7ad64283a1
fix(npm): package.json auto-discovery should respect --no-config and --no-npm (#17924)
Part of #17916
2023-02-24 13:51:21 -05:00
David Sherret 6233c0aff0
fix(npm): support bare specifiers in package.json having a path (#17903)
For example `import * as test from "package/path.js"`
2023-02-23 17:33:23 +00:00
David Sherret 344317ec50
feat(npm): support bare specifiers from package.json in more subcommands and language server (#17891) 2023-02-23 10:58:10 -05:00
David Sherret b15f9e60a0
feat(task): support scripts in package.json (#17887)
This is a super basic initial implementation. We don't create a
`node_modules/.bin` folder at the moment and add it to the PATH like we
should which is necessary to make command name resolution in the
subprocess work properly (ex. you run a script that launches another
script that then tries to launch an "npx command"... this won't work
atm).

Closes #17492
2023-02-22 22:45:35 -05:00
David Sherret ddc350780d
fix(npm): resolve node_modules dir relative to package.json instead of cwd (#17885) 2023-02-22 20:16:16 -05:00
David Sherret 3479bc7661
fix(npm): improve peer dependency resolution (#17835)
This PR fixes peer dependency resolution to only resolve peers based on
the current graph traversal path. Previously, it would resolve a peers
by looking at a graph node's ancestors, which is not correct because
graph nodes are shared by different resolutions.

It also stores more information about peer dependency resolution in the
lockfile.
2023-02-21 12:03:48 -05:00
Bartek Iwańczuk 4d1a14ca7f
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>
2023-02-20 19:14:06 +01:00
Geert-Jan Zwiers ff2e66aa38
chore(cli/test): stabilize coverage, doc, shuffle flags (#17661)
This PR removes the `UNSTABLE` mentions from the CLI docs for `deno test
--coverage/doc/shuffle`.
2023-02-16 00:50:30 +01:00
Bartek Iwańczuk 0f1349bca8
feat: Deprecate 'deno bundle' subcommand (#17695)
This commit adds a deprecation warning when using "deno bundle"
subcommand and removes it from the output of "deno help".
2023-02-14 02:13:44 +01:00
Serhiy Barhamon fc843d035c
feat(bench): Add JSON reporter for "deno bench" subcommand (#17595) 2023-02-12 17:40:45 +00:00