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

207 commits

Author SHA1 Message Date
David Sherret
826e42a5b5
fix: improved support for cjs and cts modules (#26558)
* cts support
* better cjs/cts type checking
* deno compile cjs/cts support
* More efficient detect cjs (going towards stabilization)
* Determination of whether .js, .ts, .jsx, or .tsx is cjs or esm is only
done after loading
* Support `import x = require(...);`

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-11-01 12:27:00 -04:00
Taku Amano
50ea707b58
fix(coverage): exclude comment lines from coverage reports (#25939) 2024-10-31 23:20:26 +09: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
David Sherret
ae6a2b23ba
fix: do not panic running remote cjs module (#26259)
Instead error.
2024-10-15 03:57:31 +00: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
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
Simon Lecoq
da7edf1c0c
fix: don't prompt when using Deno.permissions.request with --no-prompt (#25811) 2024-10-03 12:28:38 +00:00
Mohammad Sulaiman
3c193aef98
chore: deprecate check itests (#25963) 2024-10-02 09:22:35 +00:00
David Sherret
7cccb7422b
fix(info): move "version" field to top of json output (#25890) 2024-09-26 15:57:12 -04:00
Bartek Iwańczuk
5504acea67
feat: add --allow-import flag (#25469)
This replaces `--allow-net` for import permissions and makes the
security sandbox stricter by also checking permissions for statically
analyzable imports.

By default, this has a value of
`--allow-import=deno.land:443,jsr.io:443,esm.sh:443,raw.githubusercontent.com:443,gist.githubusercontent.com:443`,
but that can be overridden by providing a different set of hosts.

Additionally, when no value is provided, import permissions are inferred
from the CLI arguments so the following works because
`fresh.deno.dev:443` will be added to the list of allowed imports:

```ts
deno run -A -r https://fresh.deno.dev
```

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
2024-09-26 01:50:54 +00:00
Mohammad Sulaiman
c232ecc6af
chore: deprecate npm itests (#25804) 2024-09-25 18:46:18 +00:00
David Sherret
c4f7b2ac00
fix(check): ignore noImplicitOverrides in remote modules (#25854) 2024-09-24 20:49:44 -04:00
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
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
Ian Bull
3035cdddb8
refactor(ext/webidl): align error messages (#25625)
Towards https://github.com/denoland/deno/issues/25269
2024-09-19 13:03:32 +05:30
David Sherret
3dd83fdbdb
Revert "feat(fmt): sort type-only named import/exports last" (#25705)
Reverts #25690

This was not an issue with the ts compiler anymore. Discussion here:
https://github.com/dprint/dprint-plugin-typescript/pull/664#issuecomment-2357000053
2024-09-18 13:54:52 +00: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
a14e9f55b4
feat(fmt): sort type-only named import/exports last (#25690)
Closes #22583
2024-09-17 18:26:23 +01: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
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
Marvin Hagemeister
597f2d8d4d
feat: print Listening on messages on stderr instead of stdout (#25491)
Fixes https://github.com/denoland/deno/issues/25114

---------

Signed-off-by: Leo Kettmeir <crowlkats@toaxl.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: crowlkats <crowlkats@toaxl.com>
Co-authored-by: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com>
2024-09-14 23:30:06 +02:00
David Sherret
af2d992ecd
feat: TypeScript 5.6 and npm:@types/node@22 (#25614) 2024-09-14 11:58:47 +01: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
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
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
David Sherret
560ad0331b
fix(node/byonm): do not accidentally resolve bare node built-ins (#25543)
This was accidentally enabled in byonm, but it requires the
`--unstable-bare-node-builtins` flag.

Closes #25358
2024-09-09 21:35:41 +00:00
Bartek Iwańczuk
04a9cc95ac
feat: Add better error messages for unstable APIs (#25519)
This commit improves error messages for unstable APIs:
- `--unstable-broadcast-channel`
- `--unstable-cron`
- `--unstable-http`
- `--unstable-kv`
- `--unstable-temporal`

By providing information and hints what went wrong and how the
error can be fixed. It reuses the same infra that was added in 
https://github.com/denoland/deno/pull/21764.
2024-09-09 22:51:55 +02:00
David Sherret
1e0ac609b5
BREAKING: remove deprecated files config (#25535)
The long form "files" config has been flattened into the parent.

Old:

```json
{
  "test": {
    "files": {
      "include": ["**/*.ts"],
      "exclude": ["ignore.ts"]
    }
  }
}
```

New:

```json
{
  "test": {
    "include": ["**/*.ts"],
    "exclude": ["ignore.ts"]
  }
}
```

This was deprecated some time ago, but we're removing it now in Deno
2.0.

Closes #25415
2024-09-09 16:33:09 +00:00
Mohammad Sulaiman
582be0adc2
chore: Deprecate worker itests (#25514) 2024-09-09 11:07:41 -04:00
Asher Gomez
7937ae3f2f
chore(net): soft-remove Deno.serveHttp() (#25451)
Towards #22079

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-09-06 08:15:00 +10:00
David Sherret
c678550a17
BREAKING: remove "emit" and "map" from deno info output (#25468)
The map field has been empty for years now and we don't want the emit
file to be exposed so it allows us to iterate on making the cache
faster. Additionally, it's racy/unreliable to rely on this information.
Instead, people should emit the TS files themselves using tools like
deno_emit, typescript, esbuild, etc.

Closes https://github.com/denoland/deno/issues/17703
2024-09-05 14:22:13 +00:00
David Sherret
15fce5b290
feat(check): turn on useUnknownInCatchVariables (#25465)
Part of #25162

Closes #11826
2024-09-05 15:22:31 +02:00
Bartek Iwańczuk
5dc907df87
fix: update hint for deno add <package> (#25455)
Follow up to https://github.com/denoland/deno/pull/25430
2024-09-05 11:08:22 +02:00
Kamil Ogórek
2c4d99a458
feat: include version number in all --json based outputs (#25335)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-09-05 08:51:40 +00:00
Mohammad Sulaiman
49340b96f6
chore: deprecate doc itests (#25452) 2024-09-05 08:09:09 +00:00
Bartek Iwańczuk
dfc5eec43c
feat: Allow importing .cjs files (#25426)
This commit adds support for executing top-level `.cjs` files, 
as well as import `.cjs` files from within npm packages.

This works only for `.cjs` files, the contents of sibling `package.json`
are not consulted for the `"type"` field.

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

---------

Signed-off-by: David Sherret <dsherret@users.noreply.github.com>
Co-authored-by: Luca Casonato <hello@lcas.dev>
Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2024-09-05 07:59:12 +00:00
Bartek Iwańczuk
acd01eb2b4
feat: Add a hint on error about 'Relative import path ... not prefixed with ...' (#25430)
Running a file like:
```
import "@std/dotenv/load";
```
Without a mapping in `imports` field of `deno.json` or `dependencies` of
`package.json`
will now error out with a hint:
```
error: Relative import path "@std/dotenv/load" not prefixed with / or ./ or ../
  hint: Try running `deno add @std/dotenv/load`
    at [WILDCARD]bare_specifier_without_import/main.ts:1:8

```

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

---------

Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2024-09-05 08:25:56 +02:00
David Sherret
dd208a6df0
fix(regression): do not expose resolved path in Deno.Command permission denied error (#25434)
Regression from https://github.com/denoland/deno/pull/25370
2024-09-04 22:57:49 +00:00
Asher Gomez
195b17ae12
BREAKING(types): soft-remove Deno.run() (#25403)
Towards #22079
2024-09-05 08:45:55 +10:00
David Sherret
07ad47da53
BREAKING(config): make supported compilerOptions an allow list (#25432)
Deno has been using a deny list, which doesn't make sense because a lot
of these options don't even work.

Closes #25363
2024-09-04 17:39:30 +02:00
David Sherret
74fc66da11
fix: lock down allow-run permissions more (#25370)
`--allow-run` even with an allow list has essentially been
`--allow-all`... this locks it down more.

1. Resolves allow list for `--allow-run=` on startup to an absolute
path, then uses these paths when evaluating if a command can execute.
Also, adds these paths to `--deny-write`
1. Resolves the environment (cwd and env vars) before evaluating
permissions and before executing a command. Then uses this environment
to evaluate the permissions and then evaluate the command.
2024-09-04 14:51:24 +02:00
Luca Casonato
b333dccee8
feat(cli): give access to process global everywhere (#25291) 2024-09-04 11:04:06 +02:00