Commit graph

296 commits

Author SHA1 Message Date
David Sherret 049e703331
FUTURE: override byonm with nodeModulesDir setting (#23222)
Makes the `"nodeModulesDir"` setting take precedence over byonm when
using `DENO_FUTURE`.
2024-04-05 10:34:51 -04:00
JOTSR 5dda32088a
fix(cli): update deno doc help to fit current usage (#23224) 2024-04-04 22:03:29 +00:00
Bartek Iwańczuk de3f0b93f5
refactor(flags): prepare for deno install changes (#23217)
This commit adds enum to "InstallFlags" and "UninstallFlags" that will
allow to support both local and global (un)installation.

Currently the local variant is not used.

Towards https://github.com/denoland/deno/issues/23062
2024-04-04 14:40:54 +00:00
Bartek Iwańczuk c0b7454175
FUTURE: enable BYONM by default (#23194)
When `DENO_FUTURE=1` env var is present, then BYONM
("bring your own node_modules") is enabled by default.
That means that is there's a `package.json` present, users
are expected to explicitly install dependencies from that file.

Towards https://github.com/denoland/deno/issues/23151
2024-04-03 00:43:03 +02:00
Łukasz Czerniawski 08d5d32dfc
feat: add --watch-exclude flag (#21935)
This PR introduces the ability to exclude certain paths from the file watcher
in Deno. This is particularly useful when running scripts in watch mode,
as it allows developers to prevent unnecessary restarts when changes are
made to files that do not affect the running script, or when executing
scripts that generate new files which results in an infinite restart
loop.

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
2024-03-27 22:47:46 +00:00
Bartek Iwańczuk d31f2307ee
feat(install): require -g / --global flag (#23060)
In preparation for upcoming changes to `deno install` in Deno 2.

If `-g` or `--global` flag is not provided a warning will be emitted:
```
⚠️ `deno install` behavior will change in Deno 2. To preserve the current behavior use `-g` or `--global` flag.
```

The same will happen for `deno uninstall` - unless `-g`/`--global` flag
is provided
a warning will be emitted.

Towards https://github.com/denoland/deno/issues/23062

---------

Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2024-03-27 23:45:57 +01:00
Nathan Whitaker 2dc37f411e
feat(task): Task description in the form of comments (#23101)
Closes #22786.

TLDR;
```jsonc
{
  "tasks": {
    // Some comment
    //
    // describing what the task does
    "dev": "deno run -A --watch main.ts"
  }
}
```
```bash
deno task
```
![Screenshot 2024-03-27 at 1 43
49 PM](https://github.com/denoland/deno/assets/17734409/7a14da8c-8e63-45ba-9bfb-590d250b56a9)
2024-03-27 14:14:27 -07:00
David Sherret 68fecc6de4
fix: less aggressive vendor folder ignoring (#23100)
This is slightly breaking as some users want the `vendor` folder
excluded and may not have that specified in their deno.json.

Closes #22833
2024-03-27 14:25:39 -04:00
Nayeem Rahman 3b61104e2a
refactor(lsp): unify config file data into ConfigTree (#23032) 2024-03-26 15:52:20 +00:00
Matt Mastracci 86cdf37033
perf(cli): use args_os (#23039)
Extracted from #22718
2024-03-22 14:03:56 -07:00
David Sherret ffbcad3800
feat(lint): deno lint --fix and lsp quick fixes (#22615)
Adds a `--fix` option to deno lint. This currently doesn't work for
basically any rules, but we can add them over time to deno lint.
2024-03-21 14:18:59 -07:00
Bartek Iwańczuk e45f433a16
chore: make DENO_FUTURE a singleton (#23009)
Just making sure we read this env var once per process.
2024-03-21 07:32:44 +05:30
Łukasz Czerniawski 5403e4f06b
chore(cli): move away from PathBuf in clap (#22036) 2024-03-14 23:53:46 +00:00
Matt Mastracci eccdb0e99a
chore(permissions): add allow_all flag (#22890)
Unlocking a potential perf optimization at a later date -- carry the
`allow_all` flag into the permission container.
2024-03-13 16:07:24 +00:00
mimikun 8fdc376b4a
fix(publish): typo in --allow-dirty help text (#22799) 2024-03-08 18:03:32 +00:00
David Sherret 2dfc0aca7c
fix(publish): make include and exclude work (#22720)
1. Stops `deno publish` using some custom include/exclude behaviour from
other sub commands
2. Takes ancestor directories into account when resolving gitignore
3. Backards compatible change that adds ability to unexclude an exclude
by using a negated glob at a more specific level for all sub commands
(see https://github.com/denoland/deno_config/pull/44).
2024-03-07 20:16:32 -05:00
Bartek Iwańczuk 914b7495a8
fix(publish): reland error if there are uncommitted changes (#22613) (#22632)
Reverted in https://github.com/denoland/deno/pull/22625
2024-03-07 22:13:36 +01:00
Bartek Iwańczuk f0ec4fe1b8
fix(publish): silence warnings for sloppy imports and node builtins with env var (#22760)
An undocumented "DENO_DISABLE_PEDANTIC_NODE_WARNINGS" env
var can be used to silence warnings for sloppy imports and node builtins
without `node:` prefix.
2024-03-07 14:59:57 +01:00
Nayeem Rahman 01bc2f530e
feat(unstable/pm): support npm packages in 'deno add' (#22715) 2024-03-06 13:24:15 +00:00
David Sherret 942dcbad84
refactor: move deno json functionality to args module (#22710) 2024-03-05 15:45:44 -05:00
Bartek Iwańczuk fb31ae73e4
feat(unstable): deno add subcommand (#22520)
This commit adds "deno add" subcommand that has a basic support for
adding "jsr:" packages to "deno.json" file. 

This currently doesn't support "npm:" specifiers and specifying version
constraints.
2024-02-29 19:12:04 +00:00
Divy Srivastava 9ffc34c159
feat(publish): enable package provenance by default on github actions (#22635) 2024-02-29 21:48:47 +05:30
Nayeem Rahman 3a43568481
feat(lsp): jsr specifier completions (#22612) 2024-02-29 03:54:16 +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
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
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
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
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
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
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
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
David Sherret f90889e5ee
perf(jsr): fast check cache and lazy fast check graph (#22485) 2024-02-20 21:29:57 +00: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
Luca Casonato 15c64365a2
fix: write lockfile in deno info (#22272) 2024-02-19 13:02:40 +01:00
Divy Srivastava b72f0be27c
chore: add DENO_FUTURE env var (#22318)
Closes https://github.com/denoland/deno/issues/22315

```
~> DENO_FUTURE=1 target/debug/deno

> globalThis.window
undefined
```
2024-02-15 04:50:17 +00:00
Nayeem Rahman 012a9d8aeb
chore: rename DENO_REGISTRY_URL to JSR_URL (#22414) 2024-02-14 18:30:44 +00:00
Leo Kettmeir b5d122de32
feat(publish): allow passing config flag (#22416) 2024-02-14 17:13:07 +00:00
David Sherret 83d72e5c1c
refactor: extract out runtime::colors to deno_terminal::colors (#22324) 2024-02-07 11:25:14 -05:00
David Sherret a284f50732
perf: remove duplicate env::current_dir call in package.json search (#22255)
Micro-optimization.
2024-02-04 00:11:12 -05:00
David Sherret 4b7c6049ef
refactor: load bytes in deno_graph (#22212)
Upgrades deno_graph to 0.64 where deno_graph is now responsible for
turning bytes into a string. This is in preparation for Wasm modules.
2024-02-01 03:15:22 +00:00
Bartek Iwańczuk 830d096b66
fix(publish): rename --no-fast-check to --no-zap (#22214)
Also prints an information about the flag when there are `zap` errors.
2024-02-01 02:16:52 +00:00
Bartek Iwańczuk 560390c93c
chore(publish): add --no-fast-check flag (#22203) 2024-01-31 16:10:31 +01:00
Bartek Iwańczuk 9e0495baa7
fix: make deprecation warnings less verbose (#22128)
This commit makes deprecation warnings less verbose by default.

Only a single warnings is issued per deprecated API use.

`DENO_VERBOSE_WARNINGS` env var can be provided to enable more detailed
logging for each use of API including a stack trace.

https://github.com/denoland/deno/assets/13602871/9c036c84-0044-4cb6-9c8e-deb641f43712
2024-01-26 16:41:16 +01:00
Bartek Iwańczuk 44f8b05f5b
feat: Expand 'imports' section of deno.json (#22087)
This commit adds automatic expansion of "imports" field in "deno.json"
file.

If "npm:" or "jsr:" imports are encountered we automatically try to add
a "directory" remapping.

Previously users had to specify entries for both `foo` and `foo/` to be
able to import like
`import { symbol1 } from "foo";` and `import { symbol2 } from
"foo/some_file.js"`:
```
{
  "imports": {
    "foo": "npm:@foo/bar",
    "foo/": "npm:/@foo/bar/",
}
```

With this change users can only add entry for `foo`:
```
{
  "imports": {
    "foo": "npm:@foo/bar",
}
```
The entry for `foo/` will be provided automatically.

Similarly if user provides "directory" remapping explicitly, we will not
overwrite it.
2024-01-24 23:44:06 +01:00
Bartek Iwańczuk b66f5ed00e
feat: TC39 decorator proposal support (#22040)
This commit adds support for [TC39 Decorator
Proposal](https://github.com/tc39/proposal-decorators).

These decorators are only available in transpiled sources - ie.
non-JavaScript files (because of lack of support in V8).

This entails that "experimental TypeScript decorators" are not available
by default
and require to be configured, with a configuration like this:
```
{
  "compilerOptions": {
    "experimentalDecorators": true
  }
}
```


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

---------

Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: crowlkats <crowlkats@toaxl.com>
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-01-24 18:46:23 +05:30
Asher Gomez 4c0b66baab
refactor: set removal version for deno bundle (#22062)
This change sets the removal version for the `deno bundle` sub-command
for Deno v2. The warnings appear when `deno bundle` is run and in the
`--help` menu.
2024-01-24 02:36:51 +01:00
Bartek Iwańczuk cc05dc142d
chore: make deno --help more colorful (#21962)
This commit adds coloring to "--help" flag.

Before:
https://github.com/denoland/deno/assets/13602871/23753f95-3289-45bc-8a1e-842d0ccd92df

After:
https://github.com/denoland/deno/assets/13602871/91b035cc-f199-4cf4-a77c-f65b290b5e19
2024-01-23 19:56:50 +01:00