Commit graph

455 commits

Author SHA1 Message Date
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
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 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
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 6de3d7f184
refactor: move cdp.rs to tools/repl (#16821) 2022-11-25 18:38:08 -05: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
Bartek Iwańczuk d232746928
feat(core): Ability to create snapshots from existing snapshots (#16597)
Co-authored-by: crowlkats <crowlkats@toaxl.com>
2022-11-21 14:36:26 +01:00
Aaron O'Mullan 238590aa9f
chore: use Rust 1.65.0 (#16688) 2022-11-18 02:59:10 +01:00
David Sherret d6fd171394
fix(install): support npm specifiers (#16634)
Supports npm specifiers for `deno install`. This will by default always
use a lockfile (which is generated on first run) unless `--no-lock` is
specified.
2022-11-14 22:40:05 -05:00
David Sherret 191f4f16ad
fix(bundle): explicit error when using an npm specifier with deno bundle (#16637) 2022-11-14 19:55:08 -05:00
David Sherret 8dc242f789
perf: more efficient deno cache and npm package info usage (#16592)
1. There was a lot of cloning going on with `NpmPackageInfo`. This is
now stored in an `Arc<NpmPackageInfo>` and cloning only happens on the
individual version.
2. The package cache is now cleared from memory after resolution.
3. This surfaced a bug in `deno cache` and I noticed it can be more
efficient if we have multiple root specifiers if we provide all the
specifiers as roots.
2022-11-11 11:33:57 -05:00
Bartek Iwańczuk 630abb58b0
refactor: Combine ImportMapResolver and JsxResolver (#16508)
These resolvers are used in `deno_graph` APIs. Combining them removes a
lot of code and
unblocks me on https://github.com/denoland/deno/pull/16157
2022-11-02 15:47:02 +01:00
Bartek Iwańczuk 2c674dcd20
refactor(npm): reorganize initialization of compat layer (#16471)
Ensures that "std/node" graph is analyzed only once.
2022-10-28 21:53:55 +02:00
David Sherret 56d5cb21b0
refactor: move deno info functionality from deno_graph to CLI (#16434)
Closes #16423
2022-10-28 11:03:33 -04:00
David Sherret 678ac5757b
fix(compile): show an error when using npm specifiers (#16430)
Closes #16427
2022-10-26 13:55:26 +00:00
Bartek Iwańczuk 9835b095e5
fix(npm): add support for npm packages in lock files (#15938)
This commit adds support for npm packages in the lock file.
2022-10-25 18:20:07 +02:00
David Sherret e203bd9c5a
fix: upgrade swc_ecma_parser to 0.122.19 - deno_ast 0.20 (#16406) 2022-10-25 11:55:57 -04:00
David Sherret bcfe279fba
feat(unstable/npm): initial type checking of npm specifiers (#16332) 2022-10-21 15:20:18 +00:00
Bartek Iwańczuk 4b6168d5e3
feat(update): prompt for new version once per day (#16375)
<!--
Before submitting a PR, please read http://deno.land/manual/contributing

1. Give the PR a descriptive title.

  Examples of good title:
    - fix(std/http): Fix race condition in server
    - docs(console): Update docstrings
    - feat(doc): Handle nested reexports

  Examples of bad title:
    - fix #7123
    - update docs
    - fix bugs

2. Ensure there is a related issue and it is referenced in the PR text.
3. Ensure there are tests that cover the changes.
4. Ensure `cargo test` passes.
5. Ensure `./tools/format.js` passes without changing files.
6. Ensure `./tools/lint.js` passes.
-->
2022-10-21 01:50:55 +02: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
Divy Srivastava 0b016a7fb8
feat(npm): implement Node API (#13633)
This PR implements the NAPI for loading native modules into Deno. 

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: DjDeveloper <43033058+DjDeveloperr@users.noreply.github.com>
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2022-10-05 19:36:44 +05:30
Bartek Iwańczuk fde938116d
feat(unstable): add support for npm specifier cli arguments for 'deno cache' (#16141)
This commit adds support for npm specifier in "deno cache" subcommand.

```
$ deno cache --unstable npm:vite npm:chalk https://deno.land/std/http/file_server.ts
```

Besides downloading requested npm package(s), it will also download
necessary code from "std/node/".
2022-10-03 23:26:42 +02:00
Satya Rohith b312279e58
feat: implement Web Cache API (#15829) 2022-09-28 17:41:12 +05:30
David Sherret 73efed218f
refactor(npm): create general use NpmPackageResolver (#15882) 2022-09-13 11:59:01 -04:00
Bartek Iwańczuk f92bd986de
feat: download progress bar (#15814) 2022-09-09 15:57:39 -04: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
Bartek Iwańczuk 223403e899
feat(info): add information about npm modules cache (#15750) 2022-09-03 15:31:01 +02:00
Christian Dürr 63b8089bda
refactor: move JsError formatting to deno_runtime (#15345)
This takes the existing `fmt_error` module from cli and puts it as a
public module into `deno_runtime`.
2022-09-02 22:53:23 +02:00
David Sherret 387300aed0
refactor: extract out check code from emit (#15729)
Closes #15535
2022-09-02 10:54:40 -04:00
David Sherret c3e48cba18
fix(compile): panic when running with a populated dep analysis cache (#15672)
Closes #15612
2022-08-29 14:24:10 -04:00
Bartek Iwańczuk b62ef4d37b
refactor(cli): Remove cli/node dependency on cli/compat (#15654) 2022-08-29 20:19:54 +02: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
David Sherret e7367044d9
feat: binary npm commands (#15542) 2022-08-23 10:39:19 -04:00
David Sherret 7a1a082876
perf: cache swc dependency analysis and don't hold onto ParsedSources in memory (#15502) 2022-08-22 12:14:59 -04:00
Mathias Lafeldt e96933bc16
chore: use Rust 1.63.0 (#15464) 2022-08-21 19:31:14 +02:00
David Sherret 87f80ff6be
feat(unstable): initial support for npm specifiers (#15484)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-08-20 11:31:33 -04: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
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
David Sherret 321a42d1fb
refactor(runtime): split up MainWorker and WebWorker's preload_module method into two separate methods (#15451) 2022-08-10 18:10:51 -04:00
David Sherret d9fae38d1e
feat: add initial internal npm client and dependency resolver (#15446) 2022-08-10 15:23:58 -04:00
Leo Kettmeir d0ffa0beb5
fix(permissions): ignore empty values (#15447) 2022-08-10 21:13:53 +02:00
David Sherret 0ab262b901
feat: emit files on demand and fix racy emit (#15220) 2022-07-19 11:58:18 -04:00
orvit dbf5e95b59
refactor: remove redundant qualification of symbols in Rust (#15201) 2022-07-15 07:52:44 +10: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 698eeb90fd
fix: fallback to no type checking cache when db file can't be created (#15180) 2022-07-12 22:44:15 -04:00
David Sherret 0c87dd1e98
perf: use emit from swc instead of tsc (#15118) 2022-07-12 18:58:39 -04:00