1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-18 21:35:31 -05:00
Commit graph

6986 commits

Author SHA1 Message Date
David Sherret
4cfa34052d
fix(compile): analyze modules in directory specified in --include (#27296)
I ended up changing the file system implementation to determine
its root directory as the last step of building it instead of being the
first step which makes it much more reliable.
2024-12-12 18:07:35 +00:00
snek
5f8be055db
refactor(unstable): otel configuration (#27333)
split up otel config into user configurable and runtime configurable
parts. user configurable part is now set via env vars parsed according
to the otel spec. otel is now enabled via `OTEL_DENO=true`, and
`--unstable-otel` only acts as a guard.

Fixes: https://github.com/denoland/deno/issues/27273
2024-12-12 09:17:26 +01:00
David Sherret
c6fa62896d
fix(compile): output contents of embedded file system (#27302) 2024-12-11 09:40:50 -05:00
denobot
9df6be8916
chore: forward v2.1.4 release commit to main (#27329)
This is the release commit being forwarded back to main for 2.1.4

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-12-11 12:47:31 +00:00
Nathan Whitaker
6f506208f6
feat(unstable): support caching npm dependencies only as they're needed (#27300)
Currently deno eagerly caches all npm packages in the workspace's npm
resolution. So, for instance, running a file `foo.ts` that imports
`npm:chalk` will also install all dependencies listed in `package.json`
and all `npm` dependencies listed in the lockfile.

This PR refactors things to give more control over when and what npm
packages are automatically cached while building the module graph.

After this PR, by default the current behavior is unchanged _except_ for
`deno install --entrypoint`, which will only cache npm packages used by
the given entrypoint. For the other subcommands, this behavior can be
enabled with `--unstable-npm-lazy-caching`


Fixes #25782.

---------

Signed-off-by: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com>
Co-authored-by: Luca Casonato <hello@lcas.dev>
2024-12-10 18:24:23 -08:00
Bartek Iwańczuk
dd42a64c43
refactor(lint): manage schema files for linter in Deno repo (#27324)
This commit provides schema files for lint rules and lint tags
in this repo instead of pulling them from `deno_lint` repository.

A unit test was added to ensure all available rules are listed
in the schema file. A unit test for tags can be done once 
https://github.com/denoland/deno/pull/27162 lands.
2024-12-11 02:06:04 +01:00
Bartek Iwańczuk
7c8b55b584
fix(outdated): error when there are no config files (#27306)
This commit changes "deno outdated" subcommand to
error out if run in a directory that has no config file 
(including parent directories). This matches
"pnpm" behavior.

Also added tests for filtering that yields no results,
to ensure that it exists cleanly, that also matches "pnpm"
behavior.

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

---------

Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2024-12-10 23:25:29 +00:00
David Sherret
4ab668ed06
fix(lint): do not error providing --allow-import (#27321)
Closes https://github.com/denoland/deno/issues/27318
2024-12-10 20:55:28 +00:00
Bartek Iwańczuk
7bab83d6c0
fix(outdated): respect --quiet flag for hints (#27317) 2024-12-10 18:22:42 +00:00
David Sherret
21a9e2d42b
perf(compile): improve FileBackedVfsFile (#27299) 2024-12-10 11:13:14 -05:00
Mohammad Sulaiman
59dd5d21d4
fix: replace the @deno-types with @ts-types (#27310) 2024-12-10 09:52:13 -05:00
Bartek Iwańczuk
c3af09821a
fix(outdated): show a suggestion for updating (#27304)
Show command to update dependencies based on the output
of "deno outdated" command.

Closes https://github.com/denoland/deno/issues/27256
2024-12-10 14:41:16 +01:00
David Sherret
94c7653d0e
fix(compile): correct read length for transpiled typescript files (#27301)
Extracted out of https://github.com/denoland/deno/pull/27296/files

It's hard to test for this, but a test for this is in that other PR.
2024-12-09 20:11:52 -05:00
David Sherret
d99b2d6f7d
chore: reduce allocations in a few places (#27288)
Probably doesn't have much impact. I didn't measure any of these, but
reducing allocations should always be good.
2024-12-09 19:28:53 -05:00
David Sherret
da3a676d1c
fix: do not error when subpath has an @ symbol (#27290)
Closes https://github.com/denoland/deno/issues/27243
2024-12-09 13:19:08 -08:00
Nathan Whitaker
44d76975d5
fix(node): update list of builtin node modules, add missing export to _http_common (#27294)
Fixes https://github.com/denoland/deno/issues/27289

We exported these but forgot to add them to the list of builtins used by
the resolver, so we weren't resolving bare imports of some modules (e.g.
`"_http_common"`)

Also adds a missing export of `HTTPParser` from `_http_common`
2024-12-09 13:01:09 -08:00
David Sherret
56035f34a2
fix(task): do not always kill child on ctrl+c on windows (#27269)
We don't need to forward the kill signal because ctrl+c events are sent
to the process group.

Closes https://github.com/denoland/deno/issues/27266
2024-12-09 11:01:57 -05:00
denobot
2e2d3173d1
chore: forward v2.1.3 release commit to main (#27248)
This is the release commit being forwarded back to main for 2.1.3

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-12-06 02:12:57 +01:00
Nathan Whitaker
ffac282805
fix(install): use locked version of jsr package when fetching exports (#27237)
Fixes #27193.
2024-12-05 18:55:35 +00:00
Marvin Hagemeister
f098dd02f7
fix(task): --recursive option not working (#27183)
We didn't handle the `--recursive` option properly in `deno task`. This
PR addresses that.

Fixes https://github.com/denoland/deno/issues/27174
2024-12-05 19:00:35 +01:00
Bartek Iwańczuk
ab4568a03d
fix: clear dep analysis when module loading is done (#27204)
Closes https://github.com/denoland/deno/issues/26663
2024-12-05 15:48:50 +00:00
David Sherret
a26b873a7d
refactor: remove usages of deno_core::resolve_import for resolving redirects (#27234)
This was doing an allocation for reparsing the specifier. Might as well
do `.join` here and it means I can extract out this file fetcher code to
deno_cache_dir more easily.
2024-12-04 17:39:58 -05:00
Nathan Whitaker
e718e3f471
fix(outdated): allow --latest without --update (#27227)
Ref #27025.

it does nothing (it's the default behavior) but it doesn't hurt to allow
it
2024-12-04 18:32:48 +00:00
David Sherret
f0586238fc
fix(task): kill descendants when killing task process on Windows (#27163) 2024-12-04 12:19:06 -05:00
David Sherret
f863a623c9
fix: improve auto-imports for npm packages (#27224)
Improves auto-imports when using `"nodeModulesDir": "auto"`
2024-12-04 12:05:34 -05:00
Marvin Hagemeister
120b3811eb
fix(task): don't panic with filter on missing task argument (#27180)
We were panicing when running `deno task --filter foo` without a task
argument.

Fixes https://github.com/denoland/deno/issues/27177
2024-12-04 13:06:09 +01:00
David Sherret
8cd257de3d
refactor: remove CliNpmRegistryApi (#27222)
Extracts more code out of the CLI.
2024-12-03 19:44:56 -05:00
Marvin Hagemeister
d5b63bb642
fix(task): only pass args to root task (#27213)
When we run `deno task` with args like `deno task foo arg` the argument
should only be passed to the root task, not to its dependencies.

Fixes https://github.com/denoland/deno/issues/27206
2024-12-03 16:35:46 +01:00
David Sherret
c1dcf1b618
refactor: add deno_npm_cache crate (#27200)
Extracting out more code from the CLI for reuse elsewhere (still more
work to do, but this is a start).

This is the code for extracting npm tarballs and saving information in
the npm cache in the global deno_dir.
2024-12-03 02:10:16 +00:00
Bartek Iwańczuk
53936eda11
fix(fmt): stable formatting of HTML files with JS (#27164)
Closes https://github.com/denoland/deno/issues/26407
Closes https://github.com/denoland/deno/issues/26763
Closes https://github.com/denoland/deno/issues/26560
Closes https://github.com/denoland/deno/issues/26744
Closes https://github.com/denoland/deno/issues/27030
2024-12-03 02:04:55 +01:00
Bartek Iwańczuk
76571fd5a5
chore: upgrade deno_lint to 0.68.2 (#27197) 2024-12-02 21:53:00 +00:00
David Sherret
6dd2d5e49e
refactor: upgrade to deno_npm 0.26 (#27194) 2024-12-02 16:00:31 +00:00
Bartek Iwańczuk
1d49b3cb0f
fix: support workspace:^ and workspace:~ version constraints (#27096)
This commit adds support for understanding "workpace:^"
and "workspace:~" version constraints in npm/pnpm workspaces.

This is done by upgrading various crates to their latest versions.

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

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
2024-11-30 00:54:26 +01:00
David Sherret
f6248601f4
fix(task): forward signals to spawned sub-processes on unix (#27141)
Closes https://github.com/denoland/deno/issues/18445
2024-11-29 17:36:43 -05:00
Marvin Hagemeister
3553aa9132
fix(publish): error on missing name field (#27131)
This PR improves the error output on publish when the `name` filed is
missing:

```json
{
  "exports": "./mod.ts",
  "version": "0.0.1"
}
```

Before:

```sh
deno publish --dry-run
error: You did not specify an entrypoint in file:///Users/marvinh/dev/test/deno-pkg-timers/deno.json. Add `exports` mapping in the configuration file, eg:
{
  "name": "@scope/name",
  "version": "0.0.0",
  "exports": "<path_to_entrypoint>"
}
```

After:

```sh
deno publish --dry-run
error: Missing 'name' field in 'file:///Users/marvinh/dev/test/deno-pkg-timers/deno.json'.
```

Fixes https://github.com/denoland/deno/issues/27116
2024-11-28 18:11:36 +01:00
denobot
12aea2014a
chore: forward v2.1.2 release commit to main (#27136)
This is the release commit being forwarded back to main for 2.1.2

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-11-28 17:00:24 +00:00
Marvin Hagemeister
026bbc4a9e
fix(init): support scoped npm packages (#27128)
The naming scheme for create npm packages varies depending on whether
they are scoped or not. We only supported unscoped packages prior to
this PR. This PR adds support for all the following cases which npm
supports:

- `foo` -> `create-foo`
- `@foo/bar` -> `@foo/create-bar`
- `@foo` -> `@foo/create`
- `@foo@2.0.0` -> `@foo/create@2.0.0`
- `@foo/bar@2.0.0` -> `@foo/create-bar@2.0.0`

See https://docs.npmjs.com/cli/v8/commands/npm-init#description

Fixes https://github.com/denoland/deno/issues/27127
2024-11-28 15:07:32 +01:00
Luca Casonato
32e260d55a
fix: support bun specifiers in JSR publish (#24588)
Fixes https://github.com/denoland/deno/issues/26989

---------

Co-authored-by: Nathan Whitaker <nathan@deno.com>
2024-11-28 14:51:24 +01:00
David Sherret
f161adf19e
perf(compile): read embedded files as static references when UTF-8 and reading as strings (#27033) 2024-11-27 21:28:41 -05:00
Nathan Whitaker
76daa03aa9
fix(info): resolve bare specifier pointing to workspace member (#27020)
Fixes https://github.com/denoland/deno/issues/26721

Previously, we were applying only the import map, which would result in
`@scope/foo` expanding to (e.g.) `jsr:@scope/foo@1.0.0`. Since that
didn't exist it would error and fail to resolve.
2024-11-27 13:54:26 -08:00
Bartek Iwańczuk
93adf37bdf
fix(task): strip ansi codes and control chars when printing tasks (#27100) 2024-11-27 15:54:15 +00:00
David Sherret
2bbfef137c
feat(unstable): repurpose --unstable-detect-cjs to attempt loading more modules as cjs (#27094)
This resurrects the `--unstable-detect-cjs` flag (which became stable),
and repurposes it to attempt loading .js/.jsx/.ts/.tsx files as CJS in
the following additional scenarios:

1. There is no package.json
1. There is a package.json without a "type" field

Also cleans up the implementation of this in the LSP a lot by hanging
`resolution_mode()` off `Document` (didn't think about doing that until
now).
2024-11-27 09:50:38 -05:00
Leo Kettmeir
7400181ecb
fix(tools/doc): HTML resolve main entrypoint from config file (#27103)
Fixes #26901
2024-11-27 02:15:15 -08:00
Bartek Iwańczuk
4700f12ddc
fix(task): handle carriage return in task description (#27099)
Ref https://github.com/denoland/deno/pull/27069#discussion_r1857702814
2024-11-27 01:12:47 +00:00
Nathan Whitaker
a750314e04
fix(install): don't re-set up node_modules if running lifecycle script (#26984)
Fixes https://github.com/denoland/deno/issues/26904

If using `nodeModulesDir: "auto"`, it's possible for the lifecycle
script subprocess to try to set up the node_modules dir (despite the
fact that we're already doing that). If it does that, it hangs trying to
acquire the file lock on the node_modules dir.

As a fix, don't try to set up node_modules if we're running as part of a
lifecycle script.

Ideally we'd have better control over when we do and don't set up
node_modules automatically (that's the underlying problem behind #25782
as well)
2024-11-26 15:29:46 -08:00
Kenta Moriuchi
4330ef553f
fix(streams): reject string in ReadableStream.from type (#25116)
WebIDL `async iterable<T>` type rejects `string`

Ref https://github.com/whatwg/webidl/pull/1397, #24623
2024-11-26 19:42:54 +00:00
David Sherret
115a306656
fix(node): correct resolution of dynamic import of esm from cjs (#27071)
Ensures a dynamic import in a CJS file will consider the referrer as an import for node resolution.

Also adds fixes (adds) support for `"resolution-mode"` in TypeScript.
2024-11-26 14:38:24 -05:00
Ian Bull
3a55b67815
chore(compile): prefer denort binary in target/ directory when available (#27052)
Enhances the deno compile workflow for denort development by
automatically checking for a denort binary in the same directory as the
deno binary, provided both are located within a target/ directory. If
found, this denort binary will be used.
    
Key points:

- The DENORT_BIN environment variable remains supported for explicitly
specifying a custom denort binary path.
- Includes additional logic to verify if the deno binary is a symlink
pointing to an executable in the target/ directory.

---------

Signed-off-by: Ian Bull <irbull@gmail.com>
2024-11-26 09:23:09 -05:00
hongmengning
584631d281
docs(cli): remove redundant word in comment (#27055) 2024-11-26 21:07:40 +09:00
snek
e61cf8d7d6
refactor(unstable): move telemetry to own ext (#27067)
Move telemetry to its own ext to clean up some code and resolve circular
deps.
2024-11-26 11:22:18 +00:00