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

405 commits

Author SHA1 Message Date
Nathan Whitaker
6d44952d4d
fix(ext/node): resolve exports even if parent module filename isn't present (#26553)
Fixes https://github.com/denoland/deno/issues/26505

I'm not exactly sure how this case comes about (I tried to write tests
for it but couldn't manage to reproduce it), but what happens is the
parent filename ends up null, and we bail out of resolving the specifier
in package exports.

I've checked, and in node the parent filename is also null (so that's
not a bug on our part), but node continues to resolve even in that case.
So this PR should match node's behavior more closely than we currently
do.
2024-10-31 10:02:31 -07:00
David Sherret
90edca21a2
fix: surface package.json location on dep parse failure (#26665)
Related: https://github.com/denoland/deno/issues/26653
2024-10-31 15:35:17 +00:00
Bartek Iwańczuk
484f8ca9c3
fix: provide hints in terminal errors for Node.js globals (#26610)
Add info/hint for terminal errors related to Node.js globals:
- __filename
- __dirname
- Buffer
- global
- setImmediate
- clearImmediate

Closes https://github.com/denoland/deno/issues/17494
2024-10-29 00:55:51 +01:00
David Sherret
0e641632c3
fix(check): expose more globals from @types/node (#26603)
Extracted out of https://github.com/denoland/deno/pull/26558

Closes https://github.com/denoland/deno/issues/26578
2024-10-28 17:43:41 -04:00
snek
4e38fbd0a3
fix: report exceptions from nextTick (#26579)
Fixes: https://github.com/denoland/deno/issues/24713
Fixes: https://github.com/denoland/deno/issues/25855
2024-10-28 18:16:43 +01:00
David Sherret
f61af864df
fix(compile): regression handling redirects (#26586)
Closes https://github.com/denoland/deno/issues/26583
2024-10-28 09:31:58 -04:00
Marvin Hagemeister
5389972ba5
fix(npm): match npm bearer token generation (#26544)
Spend some time stepping through the npm client code and noticed that
the bearer token was different from ours. They do some double encoding
and @dsherret helped me in matching the encoding behavior.

Fixes https://github.com/denoland/deno/issues/26033
2024-10-28 12:08:51 +01:00
Nathan Whitaker
ec968aa5ae
fix(install): cache json exports of JSR packages (#26552)
Fixes https://github.com/denoland/deno/issues/26509.

Ended up being a `deno_graph` bug causing the error to surface. This PR
updates `deno_graph` to pick up the fix and reverts the temporary
workaround that skipped JSON exports.
2024-10-25 20:19:03 +00:00
David Sherret
e70341e65e
fix(check): ignore resolving jsxImportSource when jsx is not used in graph (#26548) 2024-10-25 17:56:40 +00:00
David Sherret
eedf243b5e
perf(compile): pass module source data from binary directly to v8 (#26494)
This changes denort to pass a static reference of the moude source bytes found in the binary to v8 instead of copying it.
2024-10-24 19:48:48 +00:00
Marvin Hagemeister
5f0bb3c6f4
fix: .npmrc settings not being passed to install/add command (#26473)
We weren't passing the resolved npmrc settings to the install commands.
This lead us to always fall back to the default registry url instead of
using the one from npmrc.

Fixes https://github.com/denoland/deno/issues/26139
Fixes https://github.com/denoland/deno/issues/26033
Fixes https://github.com/denoland/deno/issues/25924
Fixes https://github.com/denoland/deno/issues/25822
Fixes https://github.com/denoland/deno/issues/26152

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-10-24 20:03:56 +02:00
Nathan Whitaker
7c57105cc4
fix(ext/node): only set our end of child process pipe to nonblocking mode (#26495)
Fixes playwright on linux, as reported in
https://github.com/denoland/deno/issues/16899#issuecomment-2378268454.

The issue was that we were opening the socket in nonblocking mode, which
meant that subprocesses trying to use it would get a `EWOULDBLOCK` error
(unexpectedly). The fix here is to only set nonblocking mode on our end
(which we need to use asynchronously)
2024-10-23 21:13:30 -07:00
Nathan Whitaker
6d587cbfc8
fix(install): cache all exports of JSR packages listed in deno.json (#26501)
Fixes #26498.

This was a sort of intentional decision originally, as I wanted to avoid
caching extra files that may not be needed. It seems like that behavior
is unintuitive, so I propose we cache all of the exports of listed jsr
packages when you run a bare `deno install`.
2024-10-23 20:12:52 -07:00
Nathan Whitaker
69e1d7a4ed
fix(install): cache type only module deps in deno install (#26497)
Fixes https://github.com/denoland/deno/issues/26180.
2024-10-23 15:01:45 -07:00
Nathan Whitaker
5e020ebc35
fix(check): support --frozen on deno check (#26479)
Fixes https://github.com/denoland/deno/issues/26391
2024-10-22 21:15:00 +00:00
Bartek Iwańczuk
28b5640657
refactor: add 'docs' suggestion (#26463)
Adds another kind to `FixSuggestionKind` specifically for links
documentation pages.
2024-10-22 22:22:26 +02:00
Bartek Iwańczuk
67280f8b55
fix(install): update lockfile when using package.json (#26458)
This commit makes sure that `deno add`, `deno install` and `deno remove`
update the lockfile if only `package.json` file is present.

Fixes https://github.com/denoland/deno/issues/26270
2024-10-22 01:08:45 +02:00
David Sherret
39fb55096e
fix(install): better json editing (#26450)
1. Respects the formatting of the file (ex. keeps four space indents or
tabs).
2. Handles editing of comments.
3. Handles trailing commas.
4. Code is easier to maintain.
2024-10-21 14:17:08 -04:00
Marvin Hagemeister
0e60bb9cf7
fix(info): resolve workspace member mappings (#26350)
This PR fixes the issue where mapped specifiers in a workspace member
would never be found. Only mapped paths from the workspace root would
resolve.

This was caused by always passing the workspace root url to the import
map resolver instead of the workspace member one.

Fixes https://github.com/denoland/deno/issues/26138
Fixes https://github.com/denoland/fresh/issues/2615

---------

Signed-off-by: Marvin Hagemeister <marvinhagemeister50@gmail.com>
Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2024-10-18 21:45:05 +02:00
Marvin Hagemeister
4b99cde504
fix(npm): ensure scoped package name is encoded in URLs (#26390)
Fixes https://github.com/denoland/deno/issues/26385
2024-10-18 20:38:57 +02:00
Nathan Whitaker
50724d014a
fix(install): don't attempt to cache specifiers that point to directories (#26369)
Fixes https://github.com/denoland/deno/issues/26162
2024-10-17 22:25:22 +00:00
Marvin Hagemeister
e515f3dd0e
fix(add): exact version should not have range ^ specifier (#26302)
Fixes https://github.com/denoland/deno/issues/26299
2024-10-16 18:34:33 +02:00
Satya Rohith
2929d583d2
fix(cli): consolidate pkg parser for install & remove (#26298)
Closes https://github.com/denoland/deno/issues/26283
2024-10-16 09:20:41 +00:00
Bartek Iwańczuk
40b1c42138
fix: improve suggestions and hints when using CommonJS modules (#26287)
Ref https://github.com/denoland/deno/issues/26225
2024-10-15 23:25:24 +00:00
Bartek Iwańczuk
ee904ec06c
fix: add hint for missing document global in terminal error (#26218)
This came up on Discord as a question so I thought it's worth adding a
hint for this as it might be a common pitfall.

---------

Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2024-10-15 21:51:39 +00:00
Nathan Whitaker
797405fc61
fix(add): create deno.json when running deno add jsr:<pkg> (#26275)
Fixes https://github.com/denoland/deno/issues/26119.

Originally I wanted to put them in package.json if there's no deno.json,
but on second thought it makes more sense to just create a deno.json
2024-10-15 16:38:42 +00:00
David Sherret
ae6a2b23ba
fix: do not panic running remote cjs module (#26259)
Instead error.
2024-10-15 03:57:31 +00:00
David Sherret
1a0cb5b531
feat(unstable): --unstable-detect-cjs for respecting explicit "type": "commonjs" (#26149)
When using the `--unstable-detect-cjs` flag or adding `"unstable":
["detect-cjs"]` to a deno.json, it will make a JS file CJS if the
closest package.json contains `"type": "commonjs"` and the file is not
an ESM module (no TLA, no `import.meta`, no `import`/`export`).
2024-10-14 20:48:39 -04:00
Mohammad Sulaiman
8dbe77dd29
fix(console/ext/repl): support using parseFloat() (#25900)
Fixes #21428

Co-authored-by: tannal <tannal2409@gmail.com>
2024-10-14 15:04:18 -07:00
David Sherret
c5449d71da
fix(install): support installing npm package with alias (#26246)
Just tried this out today and it wasn't properly implemented in
https://github.com/denoland/deno/pull/24156
2024-10-14 19:35:52 +00:00
Luca Casonato
3eda179220
feat(cli): improve deno info output for npm packages (#25906) 2024-10-14 14:29:50 +02:00
Nathan Whitaker
7a990d9d42
feat(npm): support --allow-scripts on deno run (and deno add, deno test, etc) (#26075)
Fixes https://github.com/denoland/deno/issues/25533. Fixes
https://github.com/denoland/deno/issues/25396.

Previously we only supported it on `deno install` and `deno cache`,
which is annoying if you're using `nodeModulesDir: auto`.

Also changes from printing output of lifecycle scripts directly to
capturing the output and only printing it on error.
2024-10-12 12:14:32 -07:00
Marvin Hagemeister
ccdbeb433b
fix(install): duplicate dependencies in package.json (#26128)
Fixes https://github.com/denoland/deno/issues/26120
2024-10-10 21:31:45 +02:00
David Sherret
66929de3ba
fix(unstable/worker): ensure import permissions are passed (#26101)
We only had integration tests for this and not an integration test.

Closes #26074
2024-10-10 14:01:42 +01:00
Satya Rohith
7b509e492e
tests: enable package_json_node_modules_none (#25825)
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-10-04 09:56:13 +00:00
David Sherret
edac916604
fix(install): surface package.json dependency errors (#26023) 2024-10-04 07:52:00 +00:00
David Sherret
b8a9a4a862
Revert "feat: warn when using --allow-run with no allow list" (#26021)
Although using `--allow-run` without an allow list gives basically no
security, I think we should remove this warning because it gets in the
way and the only way to disable it is via --quiet.
2024-10-04 08:16:35 +01:00
Satya Rohith
779a98cd39
tests: enable specs::run::package_json::invalid_value (#25826)
Towards https://github.com/denoland/deno/issues/25241

Co-authored-by: David Sherret <dsherret@gmail.com>
2024-10-03 16:26:55 +00:00
Nathan Whitaker
275418473e
fix(install): store tags associated with package in node_modules dir (#26000)
Fixes #25998. Fixes https://github.com/denoland/deno/issues/25928.

Originally I was just going to make this an error message instead of a
panic, but once I got to a minimal repro I felt that this really should
work.

The panic occurs when you have `nodeModulesDir: manual` (or a
package.json present), and you have an npm package with a tag in your
deno.json (see the spec test that illustrates this).

This code path only actually executes when trying to choose an
appropriate package version from `node_modules/.deno`, so we should be
able to fix it by storing some extra data at install time.

The fix proposed here is to repurpose the `.initialized` file that we
store in `node_modules` to store the tags associated with a package.
Basically, if you have a version requirement with a tag (e.g.
`npm:chalk@latest`), when we set up the node_modules folder for that
package, we store the tag (`latest`) in `.initialized`. Then, when doing
BYONM resolution, if we have a version requirement with a tag, we read
that file and check if the tag is present.

The downside is that we do more work when setting up `node_modules`. We
_could_ do this only when BYONM is enabled, but that would have the
downside of needing to re-run `deno install` when you switch from auto
-> manual, though maybe that's not a big deal.
2024-10-02 17:16:46 -07:00
Nathan Whitaker
cb74975ab2
fix(install): compare versions directly to decide whether to create a child node_modules dir for a workspace member (#26001)
Fixes #25861.

Previously we were attempting to match the version requirement against
the version already present in `node_modules` root, and if they didn't
match we would create a node_modules dir in the workspace member's
directory with the dependency.

Aside from the fact that this caused the panic, on second thought it
just doesn't make sense in general. We shouldn't be semver matching, as
resolution has already occurred and decided what package versions are
required. Instead, we can just compare the versions directly.
2024-10-02 15:11:43 -07:00
David Sherret
cac28b5262
feat(byonm): support deno run npm:<package> when package is not in package.json (#25981)
Closes https://github.com/denoland/deno/issues/25905
2024-10-02 21:17:39 +01:00
Mohammad Sulaiman
3c193aef98
chore: deprecate check itests (#25963) 2024-10-02 09:22:35 +00:00
David Sherret
d116709d06
chore: remove unnecessary envs in spec tests (#25982) 2024-10-02 10:14:38 +01:00
Nayeem Rahman
3881b71734
feat(lsp): quick fix for @deno-types="npm:@types/*" (#25954) 2024-10-01 22:55:02 +01:00
David Sherret
4c8d57db03
BREAKING: rename "deps" remote cache folder to "remote" (#25969)
Closes https://github.com/denoland/deno/issues/25967
Closes #25968
2024-10-01 14:05:40 -04:00
David Sherret
d7b787792c
fix(info): error instead of panic for npm specifiers when using byonm (#25947) 2024-09-30 19:46:43 +00:00
Marvin Hagemeister
c5c1869992
fix: precompile preserve SVG camelCase attributes (#25945)
See https://github.com/denoland/deno_ast/pull/278

Fixes https://github.com/denoland/deno/issues/25810
2024-09-30 21:25:30 +02:00
David Sherret
a8d1ab5276
fix(flags): --allow-all should conflict with lower permissions (#25909)
Using `--allow-all` with other `--allow-x` permission flags should cause
an error since `--allow-all` is a superset of `--allow-x`.

Closes #25901
2024-09-27 16:49:43 +00:00
Luca Casonato
6f0fbceaf2
fix(lint): correctly handle old jsx in linter (#25902)
Previously the CLI was incorrectly reporting `React` as unused in a JSX
file that uses the "old" transform.

The LSP was already handling this correctly.
2024-09-27 14:14:17 +00:00
Bartek Iwańczuk
09a7cc4723
refactor(fmt): rewrite HTML syntax error handling (#25892) 2024-09-26 20:44:36 -04:00