Commit graph

113 commits

Author SHA1 Message Date
David Sherret 10e4b2e140
chore: update copyright year to 2023 (#17247)
Yearly tradition of creating extra noise in git.
2023-01-02 21:00:42 +00:00
David Sherret 8165cded14
fix: ignore local lockfile for deno install and uninstall (#17145)
Closes #17116
2022-12-20 12:00:57 -05:00
Kamil Ogórek 199144daf0
fix(cli): allow for specifying noErrorTruncation compiler option (#17127)
Fixes https://github.com/denoland/deno/issues/16568
2022-12-19 20:29:44 -05:00
linbingquan f46df3e359
chore: update to Rust 1.66.0 (#17078) 2022-12-17 23:20:15 +01:00
Bartek Iwańczuk efcb93f8b9
fix(npm): fix require resolution if using --node-modules-dir (#17087)
In our `require()` implementation we use a special logic to resolve
"base path" when looking for matching packages, however this logic
is in contradiction to what needs to happen if there's a local
"node_modules"
directory used. This commit changes require implementation to be aware
if we're running off of global node modules cache or a local one.
2022-12-16 23:41:51 +01:00
David Sherret 8972ebc9cc
fix: always derive http client from cli flags (#17029)
I'm not sure how to test this. It doesn't seem to have an existing test.

Closes #15921
2022-12-12 21:30:44 -05:00
Bartek Iwańczuk 4a17c93088
feat: add --inspect-wait flag (#17001)
This commit adds new "--inspect-wait" flag which works similarly
to "--inspect-brk" in that it waits for inspector session to be
established before running code. However it doesn't break on the first
statement of user code, but instead runs it as soon as a session
is established.
2022-12-12 15:33:30 +01:00
Geert-Jan Zwiers 890b065310
feat(cli): support deno bench in the config file (#16608)
This PR adds the ability to set `include/exclude` fields for `deno
bench` in the configuration file.
2022-12-10 02:30:47 +01:00
David Sherret 653aebfa1a
fix: respect the --quiet flag in more cases (#16998) 2022-12-09 10:54:24 -05:00
David Sherret 91443bbc0b
fix(compile): ensure import map is used when specified in deno config file (#16990)
Closes #14246
2022-12-08 11:50:09 -05:00
Roj 44b2b950fd
feat(cli): support configuring the lock file in the config file (#16781)
This allows the user to completely opt out from the lock file or rename
it without having to use `--no-lock` and/or `--lock` in all commands.

## Don’t Use Lock File

```json
{
  "lock": false
}
```

## Use Lock File With a Different Name

```json
{
  "lock": "deno2.lock"
}
```

The CLI args `--no-lock` and `--lock` will always override what is in
the config file.

Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2022-12-08 00:13:45 +01:00
David Sherret f8bcf6be28
feat(npm): add support for NPM_CONFIG_REGISTRY (#16980) 2022-12-07 16:10:50 -05:00
Bartek Iwańczuk 1a472ad06b
feat(repl): run "deno repl" with no permissions (#16795)
This commit changes "deno repl" command to run with no permissions by
default and accept "--allow-*" flags. 

This change is dictated by the fact that currently there is no way to
run REPL with limited permissions. Technically it's a breaking 
change in the CLI command, but there's agreement in the team 
that it has merit and it's a good solution.

Running just "deno" command still starts the REPL with full permissions
allowed, but now a banner is printed to inform users about that:
2022-12-07 20:21:18 +01:00
David Sherret 192f07bb7e
feat(flags): add deno check --all as new preferred alias for --remote (#16702)
Closes #16374
2022-12-07 13:33:26 -05:00
David Sherret c03e0f3853
refactor: remove deno_graph::Locker usage (#16877)
This is just a straight refactor and doesn't make any improvements to
the code that could now be made.

Closes #16493
2022-12-06 14:12:51 -05:00
Bartek Iwańczuk d1962e07af
fix(repl): respect --quiet flag (#16875)
This commit changes REPL behavior to respect --quiet flag. Once 
this flag is present REPL will not print a banner at the start.
2022-11-30 23:25:20 +01:00
David Sherret 2d4c46c975
refactor: create util folder, move nap_sym to napi/sym, move http_cache to cache folder (#16857) 2022-11-28 17:28:54 -05:00
David Sherret 0c0af67f89
refactor: DenoDir - move to cache folder and make root_dir private (#16823) 2022-11-26 00:04:30 +00:00
David Sherret dcb4ffb93a
refactor: move dts files, diagnostics.rs, and tsc.rs to tsc folder (#16820) 2022-11-25 18:29:48 -05:00
David Sherret 0cc90d9246
refactor: move lockfile.rs to args module (#16818)
This should be in the `args` folder as it's similar to `config_file`.
2022-11-25 17:00:28 -05:00
Asher Gomez fe7e3a12ca
feat(cli): add warning for incorrectly ordered flags (#16734)
This code checks if permission flags are incorrectly defined after the
module name (e.g. `deno run mod.ts --allow-read` instead of the correct
`deno run --allow-read mod.ts`). If so, a simple warning is displayed.
2022-11-24 03:00:31 +00:00
Aaron O'Mullan 238590aa9f
chore: use Rust 1.65.0 (#16688) 2022-11-18 02:59:10 +01:00
Bartek Iwańczuk dae3940519
fix(lock): add --no-lock flag to disable auto discovery of lock file (#16526) 2022-11-03 16:42:56 +01:00
Bartek Iwańczuk 5dea510b02
fix(lock): autodiscovery of lockfile (#16498)
This commit adds autodiscovery of lockfile. 

This only happens if Deno discovers the configuration file (either 
"deno.json" or "deno.jsonc"). In such case Deno tries to load
"deno.lock"
file that sits next to the configuration file, or creates one for user
if
the lockfile doesn't exist yet.

As a consequence, "--lock" and "--lock-write" flags had been updated.
"--lock" no longer requires a value, if one is not provided, it defaults
to "./deno.lock" resolved from the current working directory.
"--lock-write"
description was updated to say that it forces to overwrite a lockfile.

Autodiscovery is currently not handled by the LSP.
2022-11-02 16:32:30 +01:00
David Sherret edaceecec7
feat: support npm specifiers in deno info for display text output only (#16470) 2022-10-28 16:19:55 -04:00
Brenley Dueck a189c5393e
feat(lint): add a report lint config setting (#16045)
Builds off this PR to add a "report" setting to deno.json which can be
"pretty", "compact", or "json".
2022-10-25 14:21:20 +02:00
David Sherret 15744e2a0c
refactor: testable update checker code (#16386) 2022-10-22 14:31:25 -04:00
Bert Belder a48d05fac7
feat(cli): check for updates in background (#15974)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2022-10-20 16:15:21 +02:00
Mark Gibson fda24b54e9
fix(cli): allow importMap to be an absolute URL within the deno config file (#16234) 2022-10-13 11:01:11 +02:00
Yoshiya Hinosawa 15ea624790
refactor(cli): use shared sys kind parser in flags.rs (#16087) 2022-09-29 19:34:16 +09:00
Brenley Dueck 23125b275f
feat(lint): add --compact flag for terse output (#15926) 2022-09-28 18:47:48 +02:00
Yoshiya Hinosawa fa9e7aab6d
feat: add --allow-sys permission flag (#16028) 2022-09-28 21:46:50 +09:00
David Sherret 716005a0d4
feat(npm): add flag for creating and resolving npm packages to a local node_modules folder (#15971) 2022-09-22 11:17:02 -04:00
Bartek Iwańczuk 9a216806d5
feat(npm): add support for --reload=npm: and --reload=npm:<package> (#15972) 2022-09-22 10:39:58 -04:00
Divy Srivastava 8d50c09c0d
perf(cli): avoid canonicalize_path if config file does not exist (#15957) 2022-09-19 19:31:47 +05:30
Divy Srivastava e2f3801221
perf(cli): avoid clap::App::clone (#15951) 2022-09-19 17:07:49 +05:30
Ben Noordhuis b1b418b81a
chore: fix clippy warnings (#15944)
Stop allowing clippy::derive-partial-eq-without-eq and fix warnings
about deriving PartialEq without also deriving Eq.

In one case I removed the PartialEq because it a) wasn't necessary,
and b) sketchy because it was comparing floating point numbers.

IMO, that's a good argument for enforcing the lint rule, because it
would most likely have been caught during review if it had been enabled.
2022-09-19 10:25:03 +02:00
Bartek Iwańczuk 4a250b2f25
feat: add --no-npm flag to disable npm: imports (#15673)
This commit adds "--no-npm" flag, it's similar to "--no-remote"
flag. This flag makes Deno error out if "npm:" specifier is encountered.
2022-09-07 15:33:51 +02:00
Alexander Sage c0a684c14e
fix(cli): Fix panic when providing invalid urls to --reload (#15784) 2022-09-06 18:30:42 +02:00
Bartek Iwańczuk e324151520
BREAKING(unstable): remove --compat mode (#15678)
This commit removes "compat" mode. We shipped support for "npm:" specifier
support in v1.25 and that is preferred way to interact with Node code that we
will iterate and improve upon.
2022-09-03 18:19:30 +02:00
Geert-Jan Zwiers 7d622a6643
fix(init): suppress info logs when using quiet mode (#15741) 2022-09-02 17:59:36 +02:00
Geert-Jan Zwiers cbd8307710
fix(check): --remote and --no-remote should be mutually exclusive (#14964) 2022-09-01 11:52:11 +02:00
David Sherret ea838d27a2
fix: config file errors should not print specifier with debug formatting (#15648) 2022-08-29 13:13:39 -04:00
Luca Casonato 33c4d45328
fix: resolve jsxImportSource relative to module (#15561)
Previously `jsxImportSource` was resolved relative to the config file
during graph building, and relative to the emitted module during
runtime.

This is now fixed so that the JSX import source is resolved relative to
the module both during graph building and at runtime.
2022-08-24 19:36:05 +02:00
Leo Kettmeir 1ffbd56164
feat: add "deno init" subcommand (#15469)
This adds an init subcommand to that creates a project starter similar to cargo init.

```
$ deno init my_project
Project initialized
Run these commands to get started:
  cd my_project
  deno run main.ts
  deno run main_test.ts
$ deno run main.ts
Add 2 + 3 5
$ cat main.ts
export function add(a: number, b: number): number {
  return a + b;
}
if (import.meta.main) {
  console.log("Add 2 + 3", add(2, 3));
}
$ cat main_test.ts
import { assertEquals } from "https://deno.land/std@0.151.0/testing/asserts.ts";
import { add } from "./main.ts";
Deno.test(function addTest() {
    assertEquals(add(2, 3), 5);
});
```

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-08-20 01:37:05 +02:00
Geert-Jan Zwiers eab66a9f4d
chore(bench,test): list .mts under supported file extensions in cli docs (#15477) 2022-08-15 21:16:23 +02:00
David Sherret 8eed24cd3d
fix(coverage): ensure coverage is only collected in certain situations (#15467) 2022-08-12 15:21:17 -04:00
David Sherret c3b04683c5
refactor(cli): consolidate most MainWorker related code to the same place (#15459) 2022-08-11 16:59:12 -04:00
Cre3per afc29c28ae
fix(task): subcommand parser skips global args (#15297) 2022-08-10 11:55:34 -04:00
David Sherret ffd74cb1a1
chore: update jsonc_parser to 0.20 (#15316) 2022-07-26 21:24:56 -04:00
David Sherret 26cea0e2ca
feat(test): add --parallel flag, soft deprecate --jobs (#15259)
Co-authored-by: mrkldshv <markladyshev@gmail.com>
2022-07-20 17:36:54 -04:00
Nayeem Rahman 6e350b2b7c
chore(cli): Ignore "experimentalDecorators" and "moduleDetection" options (#15202) 2022-07-20 16:59:56 +02:00
David Sherret 73504d76b2
fix(task): resolve deno configuration file first from specified --cwd arg (#15257) 2022-07-20 10:36:14 -04:00
David Sherret 0ab262b901
feat: emit files on demand and fix racy emit (#15220) 2022-07-19 11:58:18 -04:00
Roj 70d1ecaeaa
feat(cli): support configuring the test tool in the config file (#15079) 2022-07-18 15:12:19 -04:00
Mark Ladyshau ee0c0586b3
feat(cli/test): add DENO_JOBS env variable for test subcommand (#14929) 2022-07-15 10:29:55 -04:00
Nayeem Rahman c2770c70b7
chore(cli): remove dead code related to previous tsc emit (#15196) 2022-07-13 15:38:36 -04:00
David Sherret 95d2f206fc
refactor: extract deno_graph::create_graph use to common function (#15009) 2022-07-01 11:50:16 -04:00
David Sherret e46584a75a
fix(vendor): ignore import map in output directory instead of erroring (#14998) 2022-06-29 20:41:48 -04:00
David Sherret 8c4420c005
refactor: rename RootConfig to CliOptions (#15007) 2022-06-29 11:51:11 -04:00
David Sherret 01adbb1efb
refactor: add RootConfig (#14985) 2022-06-28 16:45:55 -04:00
Geert-Jan Zwiers 5b7bcefa11
fix(task): remove --no-config as task subcommand argument (#14983) 2022-06-28 21:47:51 +02:00
David Sherret e1c90963fb
refactor: create args folder (#14982) 2022-06-27 16:54:09 -04:00