1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00
Commit graph

208 commits

Author SHA1 Message Date
scarf
2b7e145e56
feat(fmt): support formatting code blocks in Jupyter notebooks (#21310) 2023-11-27 10:32:12 -05:00
David Sherret
a4ec7dfae0
feat(unstable): --unstable-unsafe-proto (#21313)
Closes https://github.com/denoland/deno/issues/21276
2023-11-25 11:41:21 -05:00
Divy Srivastava
89424f8e4a
perf: move "cli/js/40_testing.js" out of main snapshot (#21212)
Closes https://github.com/denoland/deno/issues/21136

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-11-25 04:46:16 +01:00
Luca Casonato
85fd8a7f22
fix: correct flag in tar & upload (#21327) 2023-11-24 14:05:47 +01:00
Bartek Iwańczuk
585cf2de89
feat(unstable): tar up directory with deno.json (#21228)
Co-authored-by: David Sherret <dsherret@gmail.com>
Co-authored-by: Luca Casonato <lucacasonato@yahoo.com>
Co-authored-by: Luca Casonato <hello@lcas.dev>
2023-11-23 23:38:07 +00:00
citrusmunch
08f5db5c62
docs(cli/args/flags.rs): Update dead link for run example (#21277)
The `deno run` example in the help output uses
https://deno.land/std/examples/welcome.ts which no longer exists.

Replacing with https://examples.deno.land/hello-world.ts

Signed-off-by: citrusmunch <citrusmunch@users.noreply.github.com>
2023-11-20 23:59:13 +01:00
Bartek Iwańczuk
9534e6e113
feat(unstable): Workspaces support (#20410)
This commit adds unstable workspace support. This is extremely
bare-bones and
minimal first-pass at this.

With this change `deno.json` supports specifying `workspaces` key, that
accepts a list of subdirectories. Each workspace can have its own import
map. It's required to specify a `"name"` and `"version"` properties in the
configuration file for the workspace:

```jsonc
// deno.json
{
  "workspaces": [
     "a",
     "b"
  },
  "imports": {
    "express": "npm:express@5"
   }
}
```
``` jsonc
// a/deno.json
{
  "name": "a",
  "version": "1.0.2",
  "imports": {
    "kleur": "npm:kleur"
  }
}
```
```jsonc
// b/deno.json
{
  "name": "b",
  "version": "0.51.0",
  "imports": {
    "chalk": "npm:chalk"
  }
}
```

`--unstable-workspaces` flag is required to use this feature:
```
$ deno run --unstable-workspaces mod.ts
```

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
2023-11-17 01:28:38 +00:00
Divy Srivastava
ab0c637425
perf: move jupyter esm out of main snapshot (#21163)
Towards https://github.com/denoland/deno/issues/21136
2023-11-14 22:06:00 +01:00
David Sherret
6e1f3aa013
fix(install): should work with non-existent relative root (#21161)
Closes #21160
2023-11-13 09:44:01 -05:00
Divy Srivastava
9f4a45561f
perf: snapshot runtime ops (#21127)
Closes https://github.com/denoland/deno/issues/21135

~1ms startup time improvement

---------

Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2023-11-11 17:01:48 +00:00
Matt Mastracci
68607b593f
perf(cli): strace mode for ops (undocumented) (#21131)
Example usage:

```
# Trace every op except op_*tick*
cargo run -- run --unstable -A --strace-ops=-tick '/Users/matt/Documents/github/deno/deno/ext/websocket/autobahn/autobahn_server.js

# Trace any op matching op_*http*
cargo run -- run --unstable -A --strace-ops=http ...
```

Example output:

```
[    11.478] op_ws_get_buffer                        : Dispatched Slow
[    11.478] op_ws_get_buffer                        : Completed Slow
[    11.478] op_ws_send_binary                       : Dispatched Fast
[    11.478] op_ws_send_binary                       : Completed Fast
[    11.478] op_ws_next_event                        : Dispatched Async
[    11.478] op_try_close                            : Dispatched Fast
[    11.478] op_try_close                            : Completed Fast
[    11.478] op_timer_handle                         : Dispatched Fast
[    11.478] op_timer_handle                         : Completed Fast
[    11.478] op_sleep                                : Dispatched Asyn
```
2023-11-10 10:41:24 -07:00
David Sherret
9201198efd
fix(node): inspect ancestor directories when resolving cjs re-exports during analysis (#21104)
If a CJS re-export can't be resolved, it will check the ancestor
directories, which is more similar to what `require` does at runtime.
2023-11-07 09:56:06 -05:00
Matt Mastracci
485fade0b6
chore: migrate to new deno_core and metrics (#21057)
- Uses the new OpMetrics system for sync and async calls
- Partial revert of #21048 as we moved Array.fromAsync upstream to
deno_core
2023-11-05 14:27:36 -07:00
Bartek Iwańczuk
ee1e9a6434
fix(doc): require source files if --html or --lint used (#21072)
Fixes https://github.com/denoland/deno/issues/21067
Fixes https://github.com/denoland/deno/issues/21070
2023-11-03 17:06:18 +00:00
David Sherret
58d543a480
fix(repl): jsxImportSource was not working (#21049)
I made some fixes in deno_ast to make this possible and we forgot to
update this.
2023-11-01 23:04:54 +00:00
Bartek Iwańczuk
24c3c96958
feat: granular --unstable-* flags (#20968)
This commit adds granular `--unstable-*` flags:
- "--unstable-broadcast-channel"
- "--unstable-ffi"
- "--unstable-fs"
- "--unstable-http"
- "--unstable-kv"
- "--unstable-net"
- "--unstable-worker-options"
- "--unstable-cron"

These flags are meant to replace a "catch-all" flag - "--unstable", that
gives a binary control whether unstable features are enabled or not. The
downside of this flag that allowing eg. Deno KV API also enables the FFI
API (though the latter is still gated with a permission).

These flags can also be specified in `deno.json` file under `unstable`
key.

Currently, "--unstable" flag works the same way - I will open a follow
up PR that will print a warning when using "--unstable" and suggest to use
concrete "--unstable-*" flag instead. We plan to phase out "--unstable"
completely in Deno 2.
2023-11-01 23:15:08 +01:00
Bartek Iwańczuk
587f2e0800
feat: precompile JSX (#20962)
Co-authored-by: Marvin Hagemeister <marvin@deno.com>
2023-11-01 20:30:23 +00:00
Bartek Iwańczuk
8ea2d926a9
feat: deno doc --html (#21015)
This commit adds static documentation site generate to "deno doc"
subcommand.

Example:
```
$ deno doc --html --name="My library" ./mod.ts
# outputs to ./docs/

$ deno doc --html --name="My library" --output=./documentation/ ./mod.ts ./file2.js
# outputs to ./documentation/

$ deno doc --html --name="My library" ./**/mod.ts
# generate docs for all files with "mod.ts" name
```

Closes https://github.com/denoland/deno/issues/8233
2023-11-01 15:25:05 +00:00
Asher Gomez
f8f4e77632
feat(unstable): deno run --env (#20300)
This change adds the `--env=[FILE]` flag to the `run`, `compile`,
`eval`, `install` and `repl` subcommands. Environment variables set in
the CLI overwrite those defined in the `.env` file.
2023-11-01 15:21:13 +00:00
David Sherret
d1ef561dbf
feat: deno doc --lint (#21032)
Adds a new `--lint` flag to `deno doc` that surfaces three kinds of
diagnostics:

1. Diagnostic for non-exported type referenced in an exported type.
* Why? People often forget to export types from a module in TypeScript.
To supress this diagnostic, add an `@internal` jsdoc tag to the internal
type.
1. Diagnostic for missing return type or missing property type on a
**public** type.
* Why? Otherwise `deno doc` will not display good documentation. Adding
explicit types also helps with type checking performance.
1. Diagnostic for missing jsdoc on a **public** type.
* Why? Everything should be documented. This diagnostic can be supressed
by adding a jsdoc comment description.

If the lint passes, `deno doc` generates documentation as usual.

For example, checking for deno doc diagnostics on the CI:

```shellsession
$ deno doc --lint mod.ts second_entrypoint.ts > /dev/null
```

This feature is incredibly useful for library authors.

## Why not include this in `deno lint`?

1. The command needs the documenation output in order to figure out the
diagnostics.
1. `deno lint` doesn't understand where the entrypoints are. That's
critical for the diagnostics to be useful.
1. It's much more performant to do this while generating documentation.
1. There is precedence in rustdoc (ex. `#![warn(missing_docs)]`).

## Why not `--check`?

It is confusing with `deno run --check`, since that means to run type
checking (and confusing with `deno check --docs`).

## Output Future Improvement

The output is not ideal atm, but it's fine for a first pass. We will
improve it in the future.

Closes https://github.com/denoland/deno_lint/pull/972
Closes https://github.com/denoland/deno_lint/issues/970
Closes https://github.com/denoland/deno/issues/19356
2023-10-31 18:19:42 -04:00
Divy Srivastava
ba6bd444b6
perf: use deno_native_certs crate (#18072)
Fixes #18071 

Replace `rustls_native_certs` which links to Security framework.
https://github.com/denoland/deno_native_certs uses dlopen to lazy load
when needed.
2023-10-31 12:55:46 +01:00
Bartek Iwańczuk
1713df1352
feat: deno run --unstable-hmr (#20876)
This commit adds `--unstable-hmr` flag, that enabled Hot Module Replacement.

This flag works like `--watch` and accepts the same arguments. If
HMR is not possible the process will be restarted instead.

Currently HMR is only supported in `deno run` subcommand.

Upon HMR a `CustomEvent("hmr")` will be dispatched that contains
information which file was changed in its `details` property.

---------

Co-authored-by: Valentin Anger <syrupthinker@gryphno.de>
Co-authored-by: David Sherret <dsherret@gmail.com>
2023-10-31 01:25:58 +01:00
Bartek Iwańczuk
48c5c3a3fb
feat(doc): support multiple file entry (#21018)
This commit adds support for multiple entry points to `deno doc`.

Unfortunately to achieve that, I had to change the semantics of the
command to explicitly require `--filter` parameter for filtering
symbols, instead of treating second free argument as the filter argument.

`deno doc --builtin` is still supported, but cannot be mixed with
actual entrypoints.
2023-10-30 23:58:57 +01:00
Bartek Iwańczuk
e6ff84c9f9
chore: Remove 'UNSTABLE:' from 'deno compile' help (#21003)
Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-10-28 01:54:52 +00:00
David Sherret
be97170a19
feat(unstable): ability to npm install then deno run main.ts (#20967)
This PR adds a new unstable "bring your own node_modules" (BYONM)
functionality currently behind a `--unstable-byonm` flag (`"unstable":
["byonm"]` in a deno.json).

This enables users to run a separate install command (ex. `npm install`,
`pnpm install`) then run `deno run main.ts` and Deno will respect the
layout of the node_modules directory as setup by the separate install
command. It also works with npm/yarn/pnpm workspaces.

For this PR, the behaviour is opted into by specifying
`--unstable-byonm`/`"unstable": ["byonm"]`, but in the future we may
make this the default behaviour as outlined in
https://github.com/denoland/deno/issues/18967#issuecomment-1761248941

This is an extremely rough initial implementation. Errors are
terrible in this and the LSP requires frequent restarts. Improvements
will be done in follow up PRs.
2023-10-25 14:39:00 -04:00
David Sherret
59a5fe530f
refactor: upgrade to deno_ast 0.31 and deno_graph 0.59 (#20965) 2023-10-24 21:43:19 +00:00
Yoshiya Hinosawa
fb73eb1e9d
feat(unstable): allow bare specifier for builtin node module (#20728)
closes #20566
2023-10-20 13:02:08 +09:00
Jesper van den Ende
be7e2bd8c1
fix(cli): Support using both --watch and --inspect at the same time (#20660)
Fixes #20525
2023-10-06 23:33:14 +02:00
David Sherret
1ff525e25b
refactor(node): combine node resolution code for resolving a package subpath from external code (#20791)
We had two methods that did the same functionality.
2023-10-04 23:05:12 -04:00
David Sherret
148694eb35
refactor(npm): make NpmCache, CliNpmRegistryApi, and NpmResolution internal to npm::managed (#20764) 2023-10-02 17:53:55 -04:00
Bartek Iwańczuk
bf07604113
feat: Add "deno jupyter" subcommand (#20337)
This commit adds "deno jupyter" subcommand which
provides a Deno kernel for Jupyter notebooks.

The implementation is mostly based on Deno's REPL and
reuses large parts of it (though there's some clean up that
needs to happen in follow up PRs). Not all functionality of
Jupyter kernel is implemented and some message type
are still not implemented (eg. "inspect_request") but
the kernel is fully working and provides all the capatibilities
that the Deno REPL has; including TypeScript transpilation
and npm packages support.

Closes https://github.com/denoland/deno/issues/13016

---------

Co-authored-by: Adam Powers <apowers@ato.ms>
Co-authored-by: Kyle Kelley <rgbkrk@gmail.com>
2023-09-16 02:42:09 +02:00
Matt Mastracci
947865c054
feat(cli): allow --log-level=trace for additional deep debugging (#20426)
This allows us to opt in to extremely detailed tracing from dependency
libraries, like so:

```
cargo run --features tracing/log,tracing/max_level_trace -- test --log-level=trace -A --unstable ./cli/tests/unit/serve_test.ts 
```

It will not impact normal operation as it requires the
`tracing/max_level_trace` and `tracing/log` to be active.

Note that tracing is already a dependency -- this just makes it a direct
dep of cli so we can access its features more easily.
2023-09-09 12:03:19 -06:00
David Sherret
9cac5601b8
fix(compile): support providing flags as args (#20422)
Closes #20413
2023-09-08 17:14:59 +00:00
Nayeem Rahman
17276a1df9
fix: empty include in config file excludes all (#20404) 2023-09-08 15:04:45 +01:00
Nayeem Rahman
e1fb48524d
Reland "feat(lsp): enable via config file detection (#20334)" (#20349) 2023-09-01 21:13:13 +01:00
Matt Mastracci
d104a09f79
chore(core): bump and trim deps (#20265)
Skipping for a later follow-up:

 - base64: #20266
 - notify
 - indexmap (will require follow-up in upstream projects)
2023-08-26 07:10:42 -06:00
Valentin Anger
a526cff0a9
feat(cli/tools): add TAP test reporter (#14390) (#20073)
This PR adds a test reporter for the [Test Anything
Protocol](https://testanything.org).

It makes the following implementation decisions:
- No TODO pragma, as there is no such marker in `Deno.test`
- SKIP pragma for `ignore`d tests
- Test steps are treated as TAP14 subtests
  - Support for this in consumers seems spotty
- Some consumers will incorrectly interpret these markers, resulting in
unexpected output
- Considering the lack of support, and to avoid implementation
complexity,
subtests are at most one level deep (all test steps are in the same
subtest)
- To accommodate consumers that use comments to indicate test-suites
(unspecced)
  - The test module path is output as a comment
  - This is disabled for `--parallel` testing
- Failure diagnostics are output as JSON, which is also valid YAML
- The structure is not specified, so the format roughly follows the spec
example:
  ```
  ---
  message: "Failed with error 'hostname peebles.example.com not found'"
  severity: fail
  found:
    hostname: 'peebles.example.com'
    address: ~
  wanted:
    hostname: 'peebles.example.com'
    address: '85.193.201.85'
  at:
    file: test/dns-resolve.c
    line: 142
  ...
  ```
2023-08-26 01:19:23 +02:00
Matt Mastracci
8bb4e10881
fix(ext/tls): upgrade webpki version (#20285)
This removes a webpki version that was showing up as vulnerable to
https://github.com/briansmith/webpki/issues/69.

Needed to upgrade `reqwest` as part of this.
2023-08-25 23:40:25 +02:00
Bartek Iwańczuk
f9beb92818
refactor: use "deno_config" crate (#20260)
Moved the configuration file to https://github.com/denoland/deno_config
as we will have to use it in other projects.
2023-08-24 11:21:34 +02:00
David Sherret
5834d282d4
refactor: upgrade deno_ast 0.28 and deno_semver 0.4 (#20193) 2023-08-21 09:53:52 +00:00
Kira
ca9ba87d99
fix(cli) error gracefully when script arg is not present and --v8-flags is present in deno run (#20145)
Fix #20022, fix #19627 (duplicate)

#17333 upgraded clap from version 3.1 to version 4. clap version 3.2.0
(intentionally) broke a behavior that deno was relying on to make `deno
run --v8-flags=--help` work without specifying a file, see
clap-rs/clap#3793. The workaround was to make the script argument
required _unless_ `--v8-flags` is present. This broke the expectation
that all successfully parsed `run` commands have the script argument
set, leading to the panic on
`matches.remove_many::<String>("script_arg").unwrap()`.

Clap, as far as I was able to find out, does not currently offer a neat
solution to this problem. This PR adds logic to create and return a
custom clap error when a parsed run command does not have the script
argument.

I added an appropriate test.
2023-08-13 04:04:17 +02:00
Yusuke Tanaka
f2e30a6f79
refactor(cli): move snapshot_from_lockfile function to deno_npm (#20024)
This commit moves `snapshot_from_lockfile` function to [deno_npm
crate](https://github.com/denoland/deno_npm). This allows this function
to be called outside Deno CLI (in particular, Deno Deploy).
2023-08-08 10:07:29 -07:00
David Sherret
b9b0386948
feat(unstable): rename deno_modules to vendor (#20065)
Renames the unstable `deno_modules` directory and corresponding settings
to `vendor` after feedback. Also causes the vendoring of the
`node_modules` directory which can be disabled via
`--node-modules-dir=false` or `"nodeModulesDir": false`.
2023-08-06 21:56:56 -04:00
Asher Gomez
6fb7e8d93b
feat(permissions): add "--deny-*" flags (#19070)
This commit adds new "--deny-*" permission flags. These are complimentary to
"--allow-*" flags.

These flags can be used to restrict access to certain resources, even if they
were granted using "--allow-*" flags or the "--allow-all" ("-A") flag.

Eg. specifying "--allow-read --deny-read" will result in a permission error,
while "--allow-read --deny-read=/etc" will allow read access to all FS but the
"/etc" directory.

Runtime permissions APIs ("Deno.permissions") were adjusted as well, mainly
by adding, a new "PermissionStatus.partial" field. This field denotes that
while permission might be granted to requested resource, it's only partial (ie.
a "--deny-*" flag was specified that excludes some of the requested resources).
Eg. specifying "--allow-read=foo/ --deny-read=foo/bar" and then querying for
permissions like "Deno.permissions.query({ name: "read", path: "foo/" })"
will return "PermissionStatus { state: "granted", onchange: null, partial: true }",
denoting that some of the subpaths don't have read access.

Closes #18804.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
2023-08-03 13:19:19 +02:00
Bartek Iwańczuk
db287e216d
refactor: use '--reporter' and '--junit-path' flags for 'deno test' (#20031)
This commit adds "--reporter" and "--junit-path" flags to "deno test"
subcommand instead of using "--dot" and "--junit" flags.
2023-08-02 22:05:34 -04:00
Bartek Iwańczuk
029bdf0cd5
feat(cli): Add dot test reporter (#19804)
This commit adds a "dot" reporter to "deno test" subcommand,
that can be activated using "--dot" flag.

It provides a concise output using:
- "." for passing test
- "," for ignored test
- "!" for failing test

User output is silenced and not printed to the console.

In non-TTY environments each result is printed on a separate line.
2023-08-02 18:38:10 +02:00
David Sherret
1cefa831fd
feat(unstable): optional deno_modules directory (#19977)
Closes #15633
2023-08-02 00:49:09 +00:00
David Sherret
cfdef0c380
chore: remove println in DenoCompileBinaryWriter (#19976) 2023-07-29 14:06:47 +02:00
JasperVanEsveld
0ec4feaee7
feat(compile): Add --no-terminal to compile command (#17991) 2023-07-28 18:46:26 +03:00
David Sherret
02d6bbff2c
fix: error on invalid & unsupported jsx compiler options (#19954) 2023-07-27 12:15:39 -04:00