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

6913 commits

Author SHA1 Message Date
Marvin Hagemeister
f0b245c8ee
feat(task): workspace support with --filter and --recursive (#26949)
This commit adds workspace support to "deno taks".

Two new flags were added:
- "--recursive" - allows to run a specified task in workspace members,
eg. "deno task --recursive dev"
- "--filter" - allows to run a specified task only in specific workspace members,
eg. "deno task --recursive --filter 'client/*' dev"

"--filter" flag implies "--recursive" flag.

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

---------

Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Signed-off-by: David Sherret <dsherret@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com>
Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-11-21 00:35:12 +01:00
Nathan Whitaker
56f31628f7
feat: subcommand to view and update outdated dependencies (#26942)
Closes #20487

Currently spelled

```
deno outdated
```
and
```
deno outdated --update
```

Works across package.json and deno.json, and in workspaces.

There's a bit of duplicated code, I'll refactor to reduce this in follow
ups

## Currently supported:
### Printing outdated deps (current output below which basically mimics
pnpm, but requesting feedback / suggestions)

```
deno outdated
```
![Screenshot 2024-11-19 at 2 01
56 PM](https://github.com/user-attachments/assets/51fea83a-181a-4082-b388-163313ce15e7)

### Updating deps

semver compatible:
```
deno outdated --update
```
latest:
```
deno outdated --latest
```
current output is basic, again would love suggestions
![Screenshot 2024-11-19 at 2 13
46 PM](https://github.com/user-attachments/assets/e4c4db87-cd67-4b74-9ea7-4bd80106d5e9)

#### Filters
```
deno outdated --update "@std/*"
deno outdated --update --latest "@std/* "!@std/fmt"
```
#### Update to specific versions
```
deno outdated --update @std/fmt@1.0.2 @std/cli@^1.0.3
```

### Include all workspace members
```
deno outdated --recursive
deno outdated --update --recursive
```

## Future work
- interactive update
- update deps in js/ts files
- better support for transitive deps

Known issues (to be fixed in follow ups):
- If no top level dependencies have changed, we won't update transitive
deps (even if they could be updated)
- Can't filter transitive deps, or update them to specific versions

## TODO (in this PR):
- ~~spec tests for filters~~
- ~~spec test for mixed workspace (have tested manually)~~
- tweak output
- suggestion when you try `deno update`

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-11-20 15:22:15 -08:00
Bartek Iwańczuk
0670206a2c
chore: use forked sqlformat-rs (#26952)
Some crucial fixes have not yet been released, so I forked it for the
time being.
2024-11-20 23:21:41 +00:00
Leo Kettmeir
cf49599359
feat: permission stack traces in ops (#26938)
This commit improves permission prompts by adding an option
to print a full trace of where the permissions is being requested.

Due to big performance hint of stack trace collection, this is only
enabled when `DENO_TRACE_PERMISSIONS` env var is present.

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

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-11-20 21:24:04 +00:00
Keith Tan
8f72798622
feat(lint): Add checked files list to the JSON output(#26936)
Fixes #26930
2024-11-20 20:59:43 +01:00
Bartek Iwańczuk
03f47e6cf0
fix(fmt): formatting of .svelte files (#26948)
Closes https://github.com/denoland/deno/issues/26690
Closes https://github.com/denoland/deno/issues/26324
2024-11-20 10:01:56 -08:00
Bartek Iwańczuk
318dd3cbc3
feat(task): add --eval flag (#26943)
This commit adds `--eval` flag to `deno task` subcommand.

This flag allows to evaluate provided "task name" as a task itself,
effectively allowing to use `deno_task_shell` from the command line.

Also fixes shebang parsing for `node_modules/.bin/` entries to handle
`#!/usr/bin/node -S node` in addition to `#!/usr/bin/node node`.

Closes https://github.com/denoland/deno/issues/26918
2024-11-20 02:23:20 +01:00
David Sherret
dabb6775f3
fix(publish): improve error message when missing exports (#26945) 2024-11-20 01:14:49 +00:00
haturau
429f3929fa
feat(info): show location for Web Cache (#26205)
Closes #26181 

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-11-20 01:04:48 +00:00
David Sherret
fadda6a8fb
fix(lockfile): track dependencies specified in TypeScript compiler options (#26551)
We should track dependencies in `jsxImportSource`,
`jsxImportSourceTypes`, and `types`.

That way, for example, if someone removes or changes the
`jsxImportSource` then we can remove those items from the lockfile.
2024-11-20 00:49:19 +00:00
Cornelius Krassow
9956731ddb
feat(publish): add --set-version <version> flag (#26141) 2024-11-20 00:00:47 +00:00
David Sherret
8be2bbf074
feat: Wasm module support (#26668)
Support for Wasm modules.

Note this implements the standard where the default export is the
instance (not the module). The module will come later with source phase
imports.

```ts
import { add } from "./math.wasm";

console.log(add(1, 2));
```
2024-11-19 18:59:23 -05:00
David Sherret
6b478cd0a3
feat(compile): ability to embed directory in executable (#26939) 2024-11-19 23:20:14 +00:00
David Sherret
46b6037644
feat(compile): ability to embed local data files (#26934)
```
> deno compile --allow-read=. --include data-file.txt main.js
```

This only applies to files on the filesystem. For remote modules, that's
going to have to wait for `import ... from "./data.txt" with { "type":
"bytes" }` or whatever it will be.
2024-11-19 16:19:35 -05:00
João Baptista
c55e936be0
feat(fmt): support SQL (#26750)
This commit adds support for .sql files in "deno fmt" subcommand.

Closes: https://github.com/denoland/deno/issues/25024
---------

Signed-off-by: m4rc3l05 <15786310+M4RC3L05@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-11-19 21:01:16 +00:00
Leo Kettmeir
628816448e
refactor: update deno_doc, use prismjs, remove internal reference html generation logic (#26885) 2024-11-19 08:56:04 -08:00
David Sherret
186b52731c
fix(node): handle resolving ".//<something>" in npm packages (#26920)
The issue was this package had an import like: `".//index.js"` and we
resolved that as specified, but node normalizes it to `"./index.js"` so
we have to copy node.
2024-11-19 09:57:12 -05:00
David Sherret
661aa22c03
feat(task): dependencies (#26467)
This commit adds support for "dependencies" in `deno task` subcommand:
```jsonc
{
    "tasks": {
        "build": "deno run -RW build.ts",
        "generate": "deno run -RW generate.ts",
        "serve": {
            "command": "deno run -RN server.ts",
            "dependencies": ["build", "generate"]
        }
    }
}
```
Executing `deno task serve` will first execute `build` and `generate`
tasks (in parallel) and once both complete the `serve` task will be executed.

Number of tasks run in parallel is equal to the no of cores on the
machine, and respects `DENO_JOBS` env var if one is specified.

Part of https://github.com/denoland/deno/issues/26462

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Marvin Hagemeister <marvin@deno.com>
2024-11-19 12:45:09 +00:00
Luca Casonato
594a99817c
feat(runtime): remove public OTEL trace API (#26854)
This PR removes the public Deno.tracing.Span API.
We are not confident we can ship an API that is
better than the `@opentelemetry/api` API, because
V8 CPED does not support us using `using` to
manage span context. If this changes, we can
revisit this decision. For now, users wanting
custom spans can instrument their code using
the `@opentelemetry/api` API and `@deno/otel`.

This PR also speeds up the OTEL trace generation
by a 30% by using Uint8Array instead of
strings for the trace ID and span ID.
2024-11-18 23:55:22 +00:00
Bartek Iwańczuk
106d47a013
feat: fmt and lint respect .gitignore file (#26897)
Closes https://github.com/denoland/deno/issues/26573
2024-11-18 23:54:28 +01:00
Nayeem Rahman
c36f877f8d
fix(lsp): ignore editor indent settings if deno.json is present (#26912) 2024-11-18 21:45:34 +00:00
David Sherret
19bbf83e47
perf(windows): delay load webgpu and some other dlls (#26917)
Before: ~100ms, After: ~40ms for a hello world

Closes https://github.com/denoland/deno/issues/26914
2024-11-18 20:44:17 +00:00
David Sherret
dd4570ed85
perf(compile): code cache (#26528)
Adds a lazily created code cache to `deno compile` by default.

The code cache is created on first run to a single file in the temp
directory and is only written once. After it's been written, the code
cache becomes read only on subsequent runs. Only the modules loaded
during startup are cached (dynamic imports are not code cached).

The code cache can be disabled by compiling with `--no-code-cache`.
2024-11-18 20:09:28 +00:00
Bhuwan Pandit
cff6e280c7
feat(cli): support multiple env file argument (#26527)
Closes #26425 

## Overview

This PR adds support for specifying multiple environment files as
arguments when using the Deno CLI. Subsequent files override
pre-existing variables defined in previous files.

If the same variable is defined in the environment and in the file, the
value from the environment takes precedence.

## Example Usage
```bash
deno run --allow-env --env-file --env-file=".env.one" --env-file=".env.two" script.ts
```

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-11-17 22:49:35 +00:00
Bartek Iwańczuk
a1bcdf17a5
feat(jupyter): Add Deno.jupyter.image API (#26284)
This commit adds `Deno.jupyter.image` API to display PNG and JPG images:

```
const data = Deno.readFileSync("./my-image.jpg");
Deno.jupyter.image(data);

Deno.jupyter.image("./my-image.jpg");
```
2024-11-16 15:13:50 +00:00
HasanAlrimawi
abf06eb87f
feat(watch): log which file changed on HMR or watch change (#25801)
Closes #25504
2024-11-16 15:59:31 +01:00
Miguel Rodrigues
99d5c6e423
fix(cli): show prefix hint when installing a package globally (#26629)
Closes #26545

Shows a hint when a package is installed globally, otherwise fallbacks
to the existing implementation.
2024-11-16 14:57:14 +01:00
Bartek Iwańczuk
84e1238648
feat(task): support object notation, remove support for JSDocs (#26886)
This commit changes three aspects of `deno task`:
1. Tasks can now be written using object notation like so:
```jsonc
{
  "tasks": {
     "foo": "deno run foo.js",
     "bar": {
        "command": "deno run bar.js"
     }
}
```
2. Support for comments for tasks is now removed. Comments above tasks
will
no longer be printed when running `deno task`.
3. Tasks written using object notation can have "description" field that
replaces
support for comments above tasks:
```jsonc
{
  "tasks": {
     "bar": {
        "description": "This is a bar task"
        "command": "deno run bar.js"
     }
}
```
```
$ deno task
Available tasks:
- bar
    // This is a bar task
    deno run bar.js
```

Pulled most of the changes from
https://github.com/denoland/deno/pull/26467 to
support "dependencies" in tasks. Additionally some cleanup was performed
to make code easier to read.

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
2024-11-16 12:18:17 +01:00
Bartek Iwańczuk
dee94473c4
fix: update message for unsupported schemes with npm and jsr (#26884)
Closes https://github.com/denoland/deno/issues/26596
2024-11-15 17:09:19 +00:00
Nayeem Rahman
3f26310728
feat(lsp): auto-imports with @deno-types directives (#26821)
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-11-15 14:40:32 +00:00
Sahand Akbarzadeh
032ae7fb19
feat(ext/fetch): allow embedders to use hickory_dns_resolver instead of default GaiResolver (#26740)
Allows embedders to use `hickory-dns-resolver` instead of threaded "getaddrinfo" resolver
in the `fetch()` implementation.
2024-11-15 11:44:11 +01:00
Bartek Iwańczuk
c9baf3849f
perf: use available system memory for v8 isolate memory limit (#26868)
Instead of using the default 1.4Gb limit (which was meant for browser
tabs) configure V8 to
set the heap limit to the amount of memory available in the system.

Closes https://github.com/denoland/deno/issues/23424
Closes https://github.com/denoland/deno/issues/26435
Closes https://github.com/denoland/deno/issues/21226
2024-11-15 10:33:03 +01:00
David Sherret
617350e79c
refactor(resolver): move more resolution code into deno_resolver (#26873)
Follow-up to cjs refactor.

This moves most of the resolution code into the deno_resolver crate.
Still pending is the npm resolution code.
2024-11-14 15:24:25 -05:00
Marvin Hagemeister
de34c7ed29
feat(cli): add --unstable-node-globals flag (#26617)
This PR adds a new `--unstable-node-globals` flag to expose Node globals
by default.

Fixes https://github.com/denoland/deno/issues/26611

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-11-14 13:11:29 +00:00
snek
4e899d48cf
fix: otel resiliency (#26857)
Improving the breadth of collected data, and ensuring that the collected
data is more likely to be successfully reported.

- Use `log` crate in more places
- Hook up `log` crate to otel
- Switch to process-wide otel processors
- Handle places that use `process::exit`

Also adds a more robust testing framework, with a deterministic tracing
setting.

Refs: https://github.com/denoland/deno/issues/26852
2024-11-14 12:16:28 +00:00
Kyle Kelley
cb107a762f
chore: upgrade runtimelib (jupyter) to 0.19 (#26862)
Upgrades the `runtimelib` crate. Of utility for users and library
authors is the support for binary buffers on messages, especially for
comms.
2024-11-14 11:43:41 +01:00
Yusuke Tanaka
15fae19748
fix(cli): preserve comments in doc tests (#26828)
This commit makes comments in code snippets in JSDoc or markdown
preserved when they are executed as tests. In particular, this is needed
to get TypeScript special comments such as `@ts-ignore` or
`@ts-expect-error` to work correctly.

Fixes #26728
2024-11-13 21:04:32 -08:00
David Sherret
6b5cb41545
fix(fmt): error instead of panic on unstable format (#26859) 2024-11-13 15:39:40 +00:00
David Sherret
f091d1ad69
feat(node): stabilize detecting if CJS via "type": "commonjs" in a package.json (#26439)
This will respect `"type": "commonjs"` in a package.json to determine if
`.js`/`.jsx`/`.ts`/.tsx` files are CJS or ESM. If the file is found to
be ESM it will be loaded as ESM though.
2024-11-13 15:10:09 +00:00
snek
aa546189be
feat: OpenTelemetry Tracing API and Exporting (#26710)
Initial import of OTEL code supporting tracing. Metrics soon to come.
Implements APIs for https://jsr.io/@deno/otel so that code using
OpenTelemetry.js just works tm.

There is still a lot of work to do with configuration and adding
built-in tracing to core APIs, which will come in followup PRs.

---------

Co-authored-by: Luca Casonato <hello@lcas.dev>
2024-11-13 10:38:46 +00:00
Łukasz Czerniawski
7becd83a38
feat(ext/fs): add ctime to Deno.stats and use it in node compat layer (#24801)
This PR fixes #24453, by introducing a ctime (using ctime for UNIX and
ChangeTime for Windows) to Deno.stats.

Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2024-11-13 13:35:04 +09:00
Nathan Whitaker
c371b2a492
fix(install): re-setup bin entries after running lifecycle scripts (#26752)
Fixes #26677

Some packages (like supabase) declare bin entries that don't exist until
lifecycle scripts are run. For instance, the lifecycle script downloads
a binary file which serves as a bin entrypoint.

Unfortunately you can't just defer setting up the bin entries until
after lifecycle scripts have run, because the scripts may rely on them.

I looked into this, and PNPM just re-links bin entries after running
lifecycle scripts. I think that's about the best we can do as well.

Note that we'll only re-setup bin entries for packages whose lifecycle
scripts we run. This should limit the performance cost, as typically a
given project will not have many lifecycle scripts (and of those, many
of them probably don't have bin entries to set up).
2024-11-12 09:23:39 -08:00
Nayeem Rahman
7d326c269c
fix(lsp): skip code action edits that can't be converted (#26831) 2024-11-12 13:15:32 +00:00
denobot
e1b40a69c0
chore: forward v2.0.6 release commit to main (#26804)
This is the release commit being forwarded back to main for 2.0.6

Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-11-10 13:12:18 +05:30
Divy Srivastava
ce778a947e
Revert "perf(upgrade): cache downloaded binaries in DENO_DIR" (#26799)
Reverts denoland/deno#26108

Tests are flaky on main
01de331742
2024-11-10 09:00:44 +05:30
Bartek Iwańczuk
01de331742
perf(upgrade): cache downloaded binaries in DENO_DIR (#26108)
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-11-09 15:19:46 +00:00
snek
73fbd61bd0
fix: performance.timeOrigin (#26787)
`performance.timeOrigin` was being set from when JS started executing,
but `op_now` measures from an `std::time::Instant` stored in `OpState`,
which is created at a completely different time. This caused
`performance.timeOrigin` to be very incorrect. This PR corrects the
origin and also cleans up some of the timer code.

Compared to `Date.now()`, `performance`'s time origin is now
consistently within 5us (0.005ms) of system time.


![image](https://github.com/user-attachments/assets/0a7be04a-4f6d-4816-bd25-38a2e6136926)
2024-11-08 23:20:24 +01:00
Nathan Whitaker
d4f1bd3dac
fix(install): cache jsr deps from all workspace config files (#26779)
Fixes #26772.

I wasn't aware that the `imports()` method only returned the workspace
root imports
2024-11-08 12:45:30 -08:00
Leo Kettmeir
1cab4f07a3
refactor: use concrete error type for remaining ops (#26746) 2024-11-06 16:57:57 -08:00
Bartek Iwańczuk
64e887083a
fix(fmt): don't use self-closing tags in HTML (#26754)
Closes https://github.com/denoland/deno/issues/26748
2024-11-06 13:56:03 +01:00