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

342 commits

Author SHA1 Message Date
Bartek Iwańczuk
74e294c8c1
refactor: reenable more tests after DENO_FUTURE migration (#25752)
Rewrites and reenables following tests:
- `task::task_both_package_json_selected`
2024-09-24 03:33:03 +02:00
Óscar Otero
1287739ddf
feat(fmt): support vto and njk extensions (#25831)
Fixes #25802

markup_fmt plugin supports some HTML-like formats like Angular, Jinja,
Twig, Nunjucks or Vento, that are not supported by `deno fmt`. This PR
adds support for the extensions `njk` (Nunjucks) and `vto` (Vento).
Angular doesn't have a custom extension (it uses `html` afaik) and Jinja
and Twig are template engines written in Python and PHP respectively so
it doesn't make sense to be supported by Deno.
2024-09-23 14:27:58 -04:00
Bartek Iwańczuk
a7ac89935b
feat(fmt): stabilize CSS, HTML and YAML formatters (#25753)
This commits stabilizes CSS, HTML and YAML formatters
in `deno fmt`.

It is no longer required to use either of these flags:
- `--unstable-css`
- `--unstable-html`
- `--unstable-yaml`
Or these `unstable` options in the config file:
- `fmt-css`
- `fmt-html`
- `html-yaml`
2024-09-23 18:01:04 +02:00
Satya Rohith
cab3363026
tests: update specs::cache::package_json (#25827)
Towards https://github.com/denoland/deno/issues/25241
2024-09-23 20:17:43 +05:30
Satya Rohith
b1550842d9
tests: enable auto_discovered tests of run/no_deno_json (#25821)
Towards https://github.com/denoland/deno/issues/25241
2024-09-23 15:37:35 +02:00
Bartek Iwańczuk
08d3f17110
feat: make 'globalThis.location' a configurable property (#25812)
This commit changes `globalThis.location` property to be configurable
so that packages wanting to override it (or delete it) work properly.

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

This change makes reproduction from
https://github.com/denoland/deno/issues/23882#issuecomment-2340783437
pass properly.
2024-09-23 14:18:07 +02:00
Bartek Iwańczuk
ef3e4a8f74
feat: Show hints when using window global (#25805)
This commit adds better handling for terminal errors when
`window` global is used. This global is removed in Deno 2,
and while we have lints to help with that, an information and
hints are helpful to guide users to working code.

Ref https://github.com/denoland/deno/issues/25797
2024-09-23 00:05:42 +02:00
Nathan Whitaker
9be8dce0c7
fix(node): Include "node" condition during CJS re-export analysis (#25785)
Fixes #25777.

We were missing the "node" condition, so we were resolving to the wrong
conditional export, causing our analysis to be incorrect.
2024-09-21 16:10:38 -07:00
Satya Rohith
94bdebe399
refactor(tests): migrate npm itests to specs (#25764)
Towards https://github.com/denoland/deno/issues/25241
2024-09-20 22:38:32 +02:00
Bartek Iwańczuk
471a15ecff
test: make specs::test::doc_success less flaky (#25765)
Missed this line in https://github.com/denoland/deno/pull/25726
2024-09-20 13:14:02 +00:00
Yoshiya Hinosawa
66fb81ea85
fix(coverage): ignore urls from doc testing (#25736) 2024-09-20 15:04:22 +09:00
snek
a01dce3a25
fix: cjs resolution cases (#25739)
Fixes cjs modules being loaded as esm.
2024-09-19 21:10:34 -07:00
Nathan Whitaker
f1ba266613
fix(node): Don't error out if we fail to statically analyze CJS re-export (#25748)
Fixes rsbuild running in deno.

You can look at the test to see what was failing, the gist is that we
were trying to statically analyze the re-exports of a CJS script, and if
we couldn't find the source for the re-exported file we would fail.

Instead, we should just treat these as if they were too dynamic to
analyze, and let it fail (or succeed) at runtime. This aligns with
node's behavior.
2024-09-19 18:37:36 -07:00
Bartek Iwańczuk
d7aafda243
test: make specs::test::doc_success less flaky (#25726)
On Windows some of these steps were taking more than 1s
2024-09-19 13:47:52 +02:00
Leo Kettmeir
bb45446fa7
fix: don't include extensionless files in file collection for lint & fmt by default (#25721)
When using the `ext` flag, it will still attempt formatting them with
the provided extension
2024-09-19 11:25:48 +02:00
Asher Gomez
5057f58145
feat: suggest deno install --entrypoint instead of deno cache (#25228)
Hides `deno cache` from `--help` output.

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-09-18 19:55:50 +00:00
Leo Kettmeir
a1d0a427e8
feat: default to TS for file extension and support ext flag in more scenarios (#25472)
Closes #11220
Currently does lint, fmt, and repl
2024-09-18 21:15:13 +02:00
Bartek Iwańczuk
5b14c71daf
feat: improve warnings for deprecations and lifecycle script for npm packages (#25694)
This commit improves warning messages for deprecated npm packages
and packages that rely on lifecycle script.
2024-09-18 19:04:25 +00:00
Divy Srivastava
fd860260ad
feat(lint): add no-process-global lint rule (#25709)
Closes https://github.com/denoland/deno/issues/25679
2024-09-18 20:50:42 +02:00
Leo Kettmeir
ec86089c4e
feat: require jsr prefix for deno install and deno add (#25698) 2024-09-18 20:38:22 +02:00
Leo Kettmeir
c90b074579
fix(flags): don't treat empty run command as task subcommand (#25708) 2024-09-18 20:36:37 +02:00
Bartek Iwańczuk
48ea4e3c92
feat(check): turn on noImplicitOverride (#25695)
Closes https://github.com/denoland/deno/issues/11836

Ref https://github.com/denoland/deno/issues/25162
2024-09-18 14:49:30 +01:00
Luca Casonato
7533492a78
tests: fix upgrade canary test (#25706) 2024-09-18 13:43:50 +00:00
Luca Casonato
42e3a49cc7
tests: re-enable upgrade tests (#25680) 2024-09-18 14:08:21 +02:00
Yusuke Tanaka
d5c00ef50e
feat(cli): evaluate code snippets in JSDoc and markdown (#25220)
This commit lets `deno test --doc` command actually evaluate code snippets in
JSDoc and markdown files.

## How it works

1. Extract code snippets from JSDoc or code fences
2. Convert them into pseudo files by wrapping them in `Deno.test(...)`
3. Register the pseudo files as in-memory files
4. Run type-check and evaluation

We apply some magic at the step 2 - let's say we have the following file named
`mod.ts` as an input:

````ts
/**
 * ```ts
 * import { assertEquals } from "jsr:@std/assert/equals";
 *
 * assertEquals(add(1, 2), 3);
 * ```
 */
export function add(a: number, b: number) {
  return a + b;
}
````

This is virtually transformed into:

```ts
import { assertEquals } from "jsr:@std/assert/equals";
import { add } from "files:///path/to/mod.ts";

Deno.test("mod.ts$2-7.ts", async () => {
  assertEquals(add(1, 2), 3);
});
```

Note that a new import statement is inserted here to make `add` function
available. In a nutshell, all items exported from `mod.ts` become available in
the generated pseudo file with this automatic import insertion.

The intention behind this design is that, from library user's standpoint, it
should be very obvious that this `add` function is what this example code is
attached to. Also, if there is an explicit import statement like
`import { add } from "./mod.ts"`, this import path `./mod.ts` is not helpful for
doc readers because they will need to import it in a different way.

The automatic import insertion has some edge cases, in particular where there is
a local variable in a snippet with the same name as one of the exported items.
This case is addressed by employing swc's scope analysis (see test cases for
more details).

## "type-checking only" mode stays around

This change will likely impact a lot of existing doc tests in the ecosystem
because some doc tests rely on the fact that they are not evaluated - some cause
side effects if executed, some throw errors at runtime although they do pass the
type check, etc. To help those tests gradually transition to the ones runnable
with the new `deno test --doc`, we will keep providing the ability to run
type-checking only via `deno check --doc`. Additionally there is a `--doc-only`
option added to the `check` subcommand too, which is useful when you want to
type-check on code snippets in markdown files, as normal `deno check` command
doesn't accept markdown.

## Demo

https://github.com/user-attachments/assets/47e9af73-d16e-472d-b09e-1853b9e8f5ce

---

Closes #4716
2024-09-17 21:35:48 -07:00
Bartek Iwańczuk
a7d67e3a7a
feat: update warning message for --allow-run with no list (#25693)
Ref https://github.com/denoland/deno/pull/25215#discussion_r1762064605
2024-09-18 00:32:52 +02:00
David Sherret
b0525edd6f
feat: warn when using --allow-run with no allow list (#25215) 2024-09-16 23:08:02 +00:00
David Sherret
8fe90d2861
fix(npm): better error handling for remote npm deps (#25670)
* https://github.com/denoland/deno_npm/pull/68
2024-09-16 21:23:40 +00:00
David Sherret
62e952559f
refactor(permissions): split up Descriptor into Allow, Deny, and Query (#25508)
This makes the permission system more versatile.
2024-09-16 21:39:37 +01:00
HasanAlrimawi
e0b9c745c1
chore: deprecate test itests (#25512)
This PR is part of #22907

---------

Signed-off-by: HasanAlrimawi <141642411+HasanAlrimawi@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-09-16 19:38:40 +00:00
HasanAlrimawi
36a1a79f17
chore: deprecate lint itests (#25655) 2024-09-16 17:45:25 +00:00
Mohammad Sulaiman
acc32e1cee
chore: move info itests (#25659) 2024-09-16 17:08:00 +00:00
Bartek Iwańczuk
968f441da3
test: rewrite some ignored tests to spec tests (#25652)
Ref https://github.com/denoland/deno/issues/25241

Rewritten these tests:
- check::package_json_basic
- check::package_json_fail_check
- check::package_json_with_deno_json
- info::package_json_basic
- test::package_json_basic
- run::package_json_auto_discovered_for_npm_binary
- run::package_json_with_deno_json
2024-09-16 15:39:58 +02:00
Mohammad Sulaiman
eb8ee95f08
chore: deprecate node compat itests (#25573) 2024-09-16 09:53:20 +01:00
Asher Gomez
e4ea9be874
chore: cleanup remaining internals.future code (#25624) 2024-09-16 09:28:35 +10:00
Divy Srivastava
a666c8c9f9
fix(cli): deno task exit with status 0 (#25637)
Fixes https://github.com/denoland/deno/issues/25632

Exit code 1 indiciates some sort of failure but `deno task` (without
arguments) is used to list available commands.

---------

Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2024-09-15 11:29:24 +05:30
David Sherret
af2d992ecd
feat: TypeScript 5.6 and npm:@types/node@22 (#25614) 2024-09-14 11:58:47 +01:00
Asher Gomez
394a620da3
chore: enable specs::run::workspaces::explicit_import_map test (#25611)
Towards #25241
2024-09-13 11:52:48 +02:00
Nathan Whitaker
7477c2d706
feat(serve): Support second parameter in deno serve (#25606)
Closes #24099
2024-09-12 23:32:28 +00:00
Asher Gomez
8476bbff9a
feat: stabilize Deno.createHttpClient() (#25569)
Closes #25518
2024-09-12 10:46:48 +10:00
HasanAlrimawi
1463a4ad58
chore: deprecate task itests (#25558)
This PR is part of #22907
2024-09-11 17:39:47 +02:00
Bartek Iwańczuk
c64aa50c0e
feat(upgrade): better error message on failure (#25503)
Co-authored-by: crowlkats <crowlkats@toaxl.com>
2024-09-11 17:19:45 +02:00
Asher Gomez
4865ae13e1
BREAKING(net): remove Deno.[Tls]Listener.prototype.rid (#25556)
Towards #22079

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-11 01:14:50 +02:00
Asher Gomez
ace1202227
BREAKING(net): remove Deno.ConnectTlsOptions.{certChain,certFile,privateKey} and Deno.ListenTlsOptions.certChain,certFile,keyFile} (#25525)
Towards #22079
2024-09-10 21:55:42 +00:00
Kenta Moriuchi
e522f4b65a
BREAKING(temporal/unstable): Remove obsoleted Temporal APIs part 2 (#25505)
Mainly I removed `Temporal.Calendar` and `Temporal.TimeZone` and
replaced them to APIs that handle calendar and timezone as strings.
https://github.com/tc39/proposal-temporal/pull/2925

Related #24836
2024-09-10 21:36:43 +00:00
Asher Gomez
a69b1e699e
BREAKING(fs): remove Deno.FsFile.prototype.rid (#25499)
Towards #22079

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-11 07:19:34 +10:00
snek
f9007d3386
feat: require(esm) (#25501)
implement require(esm) using `op_import_sync` from deno_core.

possible future changes:
- cts and mts
- replace Deno.core.evalContext to optimize esm syntax detection

Fixes: https://github.com/denoland/deno/issues/25487
2024-09-10 20:12:36 +00:00
Luca Casonato
7bfcb4dd10
feat(cli): use NotCapable error for permission errors (#25431)
Closes #7394

---------

Co-authored-by: snek <snek@deno.com>
2024-09-10 11:12:24 -07:00
Leo Kettmeir
c2f97494f7
refactor: move WebGPU, FFI and FS typings from unstable to stable (#25488)
Closes #25377
2024-09-10 05:04:59 -07:00
HasanAlrimawi
3f6afd1947
fix: update malva in deno to support astro css comments (#25553)
This PR addresses issue #25534 

**Code Changes**
- Updated malva version to the latest in cli/Cargo.toml.
- Updated LanguageOptions to match new Malva config.
- Added test case same as the issue to assure changes success.
2024-09-10 12:54:43 +02:00