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

819 commits

Author SHA1 Message Date
David Sherret
b5695d02df
fix: only enable byonm if workspace root has pkg json (#25379)
Closes #25355
2024-09-03 09:18:37 +00:00
Nayeem Rahman
e804175a0a
feat(lsp): html/css/yaml file formatting (#25353) 2024-09-02 18:27:25 +01:00
David Sherret
f891e73bbf
refactor: remove DENO_FUTURE (#25314) 2024-08-30 21:58:24 +00:00
Bartek Iwańczuk
b1c6142f74
BREAKING: DENO_FUTURE=1 by default, or welcome to Deno 2.0 (#25213)
This commit effectively turns Deno into Deno 2.0.

This is done by forcing `DENO_FUTURE=1` env var, that was available in
the past few months to try Deno 2 changes.

This commit contains several breaking changes scheduled for Deno 2:
- all deprecated JavaScript APIs are not available any more, mostly
`Deno.*` APIs
- `window` global is removed
- FFI, WebGPU and FS APIs are now stable and don't require
`--unstable-*` flags
- import assertions are no longer supported
- "bring your own node modules" is enabled by default

This is the first commit in a series that are scheduled before the Deno
2 release.

Follow up work is tracked in
https://github.com/denoland/deno/issues/25241.

---------

Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
Co-authored-by: Nathan Whitaker <nathan@deno.com>
2024-08-30 13:58:58 -04:00
Nathan Whitaker
86d5b919d8
feat(config): Node modules option for 2.0 (#25299) 2024-08-29 15:57:43 -07:00
David Sherret
b708a13eb0
feat: improve lockfile v4 to store normalized version constraints and be more terse (#25247)
Stores normalized version constraints in the lockfile, which will
improve reproducibility and will fix a bug with duplicate specifiers
ending up in the lockfile. Also, gets rid of some duplicate data in the
specifiers area of the lockfile.
2024-08-28 14:17:47 -04:00
Nayeem Rahman
97d1635343
fix(lsp): panic on url_to_uri() (#25238) 2024-08-28 05:15:48 +01:00
David Sherret
c89a20b428
perf(cache): single cache file for remote modules (#24983)
This changes the global cache to store the cache file for remote modules
in one file instead of two.
2024-08-26 23:59:17 +00:00
Nayeem Rahman
2ab4afc6b8
refactor(lsp): changes for lsp_types 0.97.0 (#25169) 2024-08-24 01:21:21 +01:00
Nayeem Rahman
c22ff197db
fix(lsp): resolve jsx import source with types mode (#25064) 2024-08-21 20:00:23 +01:00
Nayeem Rahman
76990df6fa
chore(lsp): use 'install' terminology for jsr and npm packages (#25119) 2024-08-21 15:10:28 +01:00
Nayeem Rahman
acba2cd48c
fix(lsp): include scoped import map keys in completions (#25047) 2024-08-20 19:38:47 +01:00
Nathan Whitaker
5168700be6
feat(config): Support frozen lockfile config option in deno.json (#25100)
Closes #24544
2024-08-20 14:55:47 +00:00
David Sherret
f1c58ec041
feat(unstable): ability to use a local copy of jsr packages (#25068) 2024-08-20 14:11:43 +00:00
Hajime-san
19bcb40059
feat(cli/tools): add a subcommand --hide-stacktraces for test (#24095) 2024-08-20 01:27:36 +00:00
Bartek Iwańczuk
2bb013f9ba
refactor: version module exports a single const struct (#25014)
This commit rewrites the internal `version` module that exported
various information about the current executable. Instead of exporting
several consts, we are now exporting a single const structure that 
contains all the necessary information.

This is the first step towards cleaning up how we use this information
and should allow us to use SUI to be able to patch this information
in already produced binary making it easier to cut new releases.

---------

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-08-15 23:47:16 +02:00
Nayeem Rahman
4eff1e8ec4
fix(lsp): import map lookup for jsr subpath auto import (#25025) 2024-08-14 22:38:18 +01:00
Pig Fang
3a3315cc7f
feat(fmt): support HTML, Svelte, Vue, Astro and Angular (#25019)
This commit adds capability to format HTML, Svelte, Vue, Astro and Angular
files.

"--unstable-html" is required to format HTML files, and "--unstable-component"
flag is needed to format other formats. These can also be specified in the config
file.

Close #25015
2024-08-14 22:58:48 +02:00
Nayeem Rahman
9bdab6fb6b
fix(lsp): directly use file referrer when loading document (#24997) 2024-08-12 15:45:27 +01:00
Pig Fang
82884348cb
feat(fmt): support CSS, SCSS, Sass and Less (#24870)
This PR integrates [Malva](https://github.com/g-plane/malva) into `deno
fmt`, which introduces the ability to format CSS, SCSS, Sass and Less
files.

On Linux x64 6.10, this PR increases about 800KiB:

```                                                                                                                                                                      
❯ wc -c target/release/deno
125168728 target/release/deno

❯ wc -c target/release/deno
124349456 target/release/deno
```
2024-08-09 18:52:23 +02:00
David Sherret
c21f42c825
fix(lsp): don't always use byonm resolver when DENO_FUTURE=1 (#24865)
Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
2024-08-09 09:50:37 +02:00
David Sherret
04473c04ed
fix(compile): support workspace members importing other members (#24909) 2024-08-07 07:43:05 +00:00
Nayeem Rahman
9a83efa04b
feat(lsp): node specifier completions (#24904) 2024-08-06 16:30:34 +01:00
Nayeem Rahman
30a97d1e51
perf(lsp): remove fallback config scopes for workspace folders (#24868) 2024-08-06 01:10:02 +01:00
David Sherret
0da81205d5
feat(unstable/fmt): move yaml formatting behind unstable flag (#24848)
This moves YAML formatting behind an unstable flag for Deno 1.46. This
will make it opt-in to start and then we can remove the flag to make it
on by default in version of Deno after that.

This can be specified by doing `deno fmt --unstable-yaml` or by
specifying the following in a deno.json file:

```json
{
  "unstable": ["fmt-yaml"]
}
```
2024-08-02 13:52:48 +00:00
Andreas Deininger
ea121c9a0e
docs: fix typos (#24820)
This PR fixes various typos I spotted in the project.
2024-08-02 13:26:54 +02:00
David Sherret
d3419f7d14
perf: update deno_ast to 0.41 (#24819)
Some perf gains in swc (I measured formatting and it was slightly
faster).

Includes:

* https://github.com/denoland/deno_graph/pull/508
* https://github.com/denoland/eszip/pull/193
2024-07-31 18:31:03 -04:00
Nayeem Rahman
3659781f88
feat(lsp): registry completions for import-mapped specifiers (#24792) 2024-07-30 23:26:09 +01:00
Satya Rohith
8c2f1f5a55
chore: upgrade to rust 1.80 (#24778) 2024-07-29 12:58:04 -04:00
David Sherret
3bf147fe28
refactor: decouple node resolution from deno_core (#24724) 2024-07-25 19:08:14 -04:00
David Sherret
763f05e74d
fix(unstable): move sloppy-import warnings to lint rule (#24710)
Adds a new `no-sloppy-imports` lint rule and cleans up the lint code.

Closes #22844
Closes https://github.com/denoland/deno_lint/issues/1293
2024-07-25 09:07:59 -04:00
HasanAlrimawi
fcd9bbe8ee
fix: update lsp error message of 'relative import path' to 'use deno add' for npm/jsr packages (#24524) 2024-07-24 16:12:42 +01:00
David Sherret
9114a2df69
fix(upgrade): do not error if config in cwd invalid (#24689)
```
> deno upgrade
error: Unsupported lockfile version 'invalid'. Try upgrading Deno or recreating the lockfile.
V:\scratch
> V:\deno\target\debug\deno upgrade
Looking up latest version
Local deno version 1.45.3 is the most recent release
```

Closes #24517
Closes #20729
2024-07-23 19:00:48 -04:00
David Sherret
6055629ee7
refactor: update to use deno_package_json (#24688)
This is in preparation for extracting out node resolution code from
ext/node (which is something I'm going to do gradually over time).

Uses https://github.com/denoland/deno_package_json
2024-07-23 17:34:46 -04:00
Nayeem Rahman
a45a40533e
fix(lsp): rewrite import for 'infer return type' action (#24685) 2024-07-23 19:39:14 +01:00
Nayeem Rahman
5a696551b7
fix(lsp): scope attribution for asset documents (#24663) 2024-07-22 15:06:08 +01:00
David Sherret
5f6d84a281
fix(lsp): hang when caching failed (#24651)
Closes #24600
2024-07-19 21:22:54 -04:00
David Sherret
afcae364be
refactor: update to deno_config 0.25 (#24645)
- Gets rid of WorkspaceMemberContext. It's now `Workspace` and
`WorkspaceDirectory`
- Uses the workspace cache in the lsp

* https://github.com/denoland/deno_config/pull/95
* https://github.com/denoland/deno_config/pull/96
2024-07-19 15:56:07 -04:00
David Sherret
3bda8eb4fe
fix(lsp): support npm workspaces and fix some resolution issues (#24627)
Makes the lsp use the same code as the rest of the cli.
2024-07-18 18:16:35 -04:00
David Sherret
f4b9d85862
fix(workspace): support resolving bare specifiers to npm pkgs within a workspace (#24611)
This makes bare specifiers for npm packages work when inside a
workspace, which emulates the same behaviour as when there's a
node_modules directory. The bare specifier can be overwritten by
specifying an import map entry or package.json dependency entry.

* https://github.com/denoland/deno_config/pull/88

Closes #24605
2024-07-17 09:13:22 -04:00
David Sherret
a49d0bd10b
fix(check): CJS types importing dual ESM/CJS package should prefer CJS types (#24492)
Closes #16370
2024-07-10 14:46:25 -04:00
David Sherret
4d2d764816
feat(jsr): support publishing jsr packages in npm workspaces (#24507)
Supports publishing an npm workspace with a directory structure similar
to the following:

- workspace
  - package.json
  - package-a
    - package.json
    - jsr.json
  - package-b
    - package.json
    - jsr.json

deno_config PR: https://github.com/denoland/deno_config/pull/77

Closes https://github.com/denoland/deno/issues/23638
2024-07-10 14:46:09 -04:00
Nathan Whitaker
ce7dc2be92
feat(node): Support executing npm package lifecycle scripts (preinstall/install/postinstall) (#24487)
Adds support for running npm package lifecycle scripts, opted into via a
new `--allow-scripts` flag.

With this PR, when running `deno cache` (or `DENO_FUTURE=1 deno
install`) you can specify the `--allow-scripts=pkg1,pkg2` flag to run
lifecycle scripts attached to the given packages.

Note at the moment this only works when `nodeModulesDir` is true (using
the local resolver).

When a package with un-run lifecycle scripts is encountered, we emit a
warning suggesting things may not work and to try running lifecycle
scripts. Additionally, if a package script implicitly requires
`node-gyp` and it's not found on the system, we emit a warning.

Extra things in this PR:
- Extracted out bits of `task.rs` into a separate module for reuse
- Added a couple fields to `process.config` in order to support
`node-gyp` (it relies on a few variables being there)
- Drive by fix to downloading new npm packages to test registry

---

TODO:
- [x] validation for allow-scripts args (make sure it looks like an npm
package)
- [x] make allow-scripts matching smarter
- [ ] figure out what issues this closes

---
Review notes:
- This adds a bunch of deps to our test registry due to using
`node-gyp`, so it's pretty noisy
2024-07-10 03:06:08 +00:00
David Sherret
e5c3c21e95
feat(workspace): support object config (#24483)
This adds object config for the workspace config:

```json
{
  "workspace": {
    "members": ["./member-1", "./member-2"]
  }
}
```

This is a more verbose version of `"workspace": ["./member-1",
"./member-2"]`. Although we don't need it at the moment, it makes the
naming of `"workspace"` more clear and leaves the object open for more
config in the future.

Closes https://github.com/denoland/deno/issues/24456
2024-07-09 17:06:50 -04:00
David Sherret
839caf6faf
refactor: use concrete error types for node resolution (#24470)
This will help clean up some of the code in the CLI because we'll be
able to tell how the resolution failed (not part of this PR).
2024-07-09 12:15:03 -04:00
Nayeem Rahman
d472c48b38
fix(lsp): inherit workspace-root-only fields in members (#24440) 2024-07-08 22:31:27 +01:00
David Sherret
86010bec09
fix(workspace): better cli file argument handling (#24447)
Closes https://github.com/denoland/deno/issues/24422
2024-07-08 14:12:10 +00:00
David Sherret
80df9aec1d
refactor: move FileCollector to deno_config (#24433) 2024-07-05 17:53:09 -04:00
David Sherret
147411e64b
feat: npm workspace and better Deno workspace support (#24334)
Adds much better support for the unstable Deno workspaces as well as
support for npm workspaces. npm workspaces is still lacking in that we
only install packages into the root node_modules folder. We'll make it
smarter over time in order for it to figure out when to add node_modules
folders within packages.

This includes a breaking change in config file resolution where we stop
searching for config files on the first found package.json unless it's
in a workspace. For the previous behaviour, the root deno.json needs to
be updated to be a workspace by adding `"workspace":
["./path-to-pkg-json-folder-goes-here"]`. See details in
https://github.com/denoland/deno_config/pull/66

Closes #24340
Closes #24159
Closes #24161
Closes #22020
Closes #18546
Closes #16106
Closes #24160
2024-07-04 00:54:33 +00:00
Nayeem Rahman
dd6d19e120
fix(lsp): correct scope attribution for injected @types/node (#24404) 2024-07-03 20:25:42 +01:00