0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-10-31 09:14:20 -04:00
Commit graph

1898 commits

Author SHA1 Message Date
David Sherret
f4b8c2ea7d
chore: fix flaky netListenUnrefAndRef (#16892)
Closes #16890
2022-12-02 12:41:52 -05:00
Bartek Iwańczuk
4d07ed0efa
chore: rewrite tests and utils to use Deno.Command API (#16895)
Since "Deno.spawn()", "Deno.spawnSync()" and "Deno.spawnChild"
are getting deprecated, this commits rewrites all tests and utilities to
use "Deno.Command" API instead.
2022-12-02 14:43:17 +01:00
David Sherret
1615852025
chore(npm): fix types tests (#16882) 2022-12-01 12:26:33 -05:00
David Sherret
b1e29d1bd0
fix(npm): improve package.json exports support for types (#16880) 2022-11-30 23:07:32 +00:00
Bartek Iwańczuk
d1962e07af
fix(repl): respect --quiet flag (#16875)
This commit changes REPL behavior to respect --quiet flag. Once 
this flag is present REPL will not print a banner at the start.
2022-11-30 23:25:20 +01:00
David Sherret
e2655c992e
fix(lsp): analyze fs dependencies of dependencies to find npm package requirements (#16866)
Closes #16867
2022-11-30 00:32:18 +00:00
sigmaSd
2656af2544
fix(coverage): Error if the emit cache is invalid (#16850) 2022-11-29 18:43:54 +01:00
Yoshiya Hinosawa
e4fe5ee72a
fix(ext/node): allow absolute path in createRequire (#16853)
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-11-29 14:13:14 +09:00
David Sherret
d3299c2d6c
fix(npm): don't resolve JS files when resolving types (#16854)
Closes #16851
2022-11-28 17:48:56 -05:00
Bartek Iwańczuk
f526513d74
feat(core): show unresolved promise origin (#16650)
This commit updates unhelpful messages that are raised when event loop
stalls on unresolved top-level promises.

Instead of "Module evaluation is still pending but there are no pending
ops or dynamic imports. This situation is often caused by unresolved
promises." and "Dynamically imported module evaluation is still pending
but there are no pending ops. This situation is often caused by
unresolved promises." we are now printing a message like: 

error: Top-level await promise never resolved
[SOURCE LINE]
^
    at [FUNCTION NAME] ([FILENAME])

eg:
error: Top-level await promise never resolved
await new Promise((_resolve, _reject) => {});
^
at <anonymous>
(file:///Users/ib/dev/deno/cli/tests/testdata/test/unresolved_promise.ts:1:1)

Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2022-11-28 23:07:23 +01:00
Bartek Iwańczuk
fd51b2e506
fix(npm): allow to inspect npm modules with --inspect-brk (#16841) 2022-11-28 21:59:36 +01:00
Leo Kettmeir
1dd4843b62
feat(unstable): rework Deno.Command (#16812)
Refactors the `Deno.Command` class to not handle any state, but only being an intermediary to calling its methods, and as such any methods and properties besides `output`, `outputSync` & `spawn` have been removed. Interracting with a `spawn`ed subprocess now works by using the methods and properties on the returned class of the `spawn` method.
2022-11-28 12:33:51 +01:00
David Sherret
fb04e87387
fix(npm): ensure npm package downloaded once per run when using --reload (#16842) 2022-11-27 13:25:08 -05:00
Bartek Iwańczuk
0012484f4f
Revert "fix(ext/flash): graceful server startup/shutdown with unsettl… (#16839)
…ed promises in mind (#16616)"

This reverts commit fd023cf793.

There are reports saying that Vite is often hanging in 1.28.2 and this
is
the only PR that changed something with HTTP server. I think we should
hold off on trying to fix this and instead focus on #16787

CC @magurotuna
2022-11-27 04:50:14 +01:00
Bartek Iwańczuk
d4f659d1d3
feat(core): send "executionContextDestroyed" notification on program end (#16831)
This commit changes "JsRuntime" to send "executionContextDestroyed"
notification when the program finishes and shows a prompt informing 
that runtime is waiting for inspector to disconnect.
2022-11-27 00:44:39 +01:00
Bartek Iwańczuk
7e0c558187
tests: move integration tests to separate modules (#16816) 2022-11-26 02:29:56 +01:00
David Sherret
dcb4ffb93a
refactor: move dts files, diagnostics.rs, and tsc.rs to tsc folder (#16820) 2022-11-25 18:29:48 -05:00
David Sherret
d0a4e23ae8
fix(npm): better error message when attempting to use typescript in npm packages (#16813) 2022-11-25 13:42:05 -05:00
David Sherret
e6a9588b43
fix(task): output encoding issues on windows (#16794)
Closes #16792
2022-11-24 19:37:02 -05:00
David Sherret
823a5f6015
fix(npm/types): resolve main entrypoint declaration file when no types entry (#16791)
Closes #16782
2022-11-24 19:13:51 +01:00
Yusuke Tanaka
fd023cf793
fix(ext/flash): graceful server startup/shutdown with unsettled promises in mind (#16616)
This PR resets the revert commit made by #16610, bringing back #16383
which attempts to fix the issue happening when we use the flash server
with `--watch` option enabled.
Also, some code changes are made to pass the regression test added in
#16610.
2022-11-24 18:38:09 +01:00
David Sherret
b6f49cf479
fix(npm/check): prioritize exports over types entry (#16788) 2022-11-24 17:07:36 +00:00
Asher Gomez
fe7e3a12ca
feat(cli): add warning for incorrectly ordered flags (#16734)
This code checks if permission flags are incorrectly defined after the
module name (e.g. `deno run mod.ts --allow-read` instead of the correct
`deno run --allow-read mod.ts`). If so, a simple warning is displayed.
2022-11-24 03:00:31 +00:00
Bartek Iwańczuk
b70f520ebc
fix: Make npm packages works with import maps (#16754)
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-11-22 20:09:30 +01:00
Bartek Iwańczuk
1ec357faf3
fix(inspector): ensure console methods provided by inspector are available (#16724) 2022-11-22 02:17:14 +01:00
Bartek Iwańczuk
5c7dc904fb
test: disable commandChildUnref flaky test (#16752) 2022-11-22 02:16:24 +01:00
Bartek Iwańczuk
d232746928
feat(core): Ability to create snapshots from existing snapshots (#16597)
Co-authored-by: crowlkats <crowlkats@toaxl.com>
2022-11-21 14:36:26 +01:00
David Sherret
a57134de38
fix(npm): handle directory resolution when resolving declaration files (#16706)
Also fixes resolving specifiers like `./something.generated` in
declaration files.

Closes #16695
2022-11-19 10:40:01 -05:00
Yoshiya Hinosawa
7ab08130a0
fix(ext/node): handle URL in createRequire (#16682) 2022-11-19 20:32:39 +09:00
Aaron O'Mullan
238590aa9f
chore: use Rust 1.65.0 (#16688) 2022-11-18 02:59:10 +01:00
Bartek Iwańczuk
1416713cb3
fix(npm): using types for packages with subpath (#16656)
For CommonJS packages we were not trying different extensions for files
specified as subpath of the package ([package_name]/[subpath]). 
This commit fixes that.
2022-11-16 20:41:27 +01:00
Bartek Iwańczuk
bd159b8bad
fix(lock): ensure npm dependencies are written with --lock-write (#16668)
If "--lock-write" flag was present we never passed instance of the lockfile to 
the npm resolver, which made it skip adding discovered npm packages to
the lockfile. This commit fixes that, by always passing lockfile to the npm
resolver and only regenerating resolver snapshot is "--lock-write" is not
present.

Closes https://github.com/denoland/deno/issues/16666
2022-11-16 19:59:26 +01:00
David Sherret
40a72f3555
fix(npm): support non-all lowercase package names (#16669)
Supports package names that aren't all lowercase.

This stores the package with a leading underscore (since that's not
allowed in npm's registry and no package exists with a leading
underscore) then base32 encoded (A-Z0-9) so it can be lowercased and
avoid collisions.

Global cache dir:

```
$DENO_DIR/npm/registry.npmjs.org/_{base32_encode(package_name).to_lowercase()}/{version}
```

node_modules dir `.deno` folder:

```
node_modules/.deno/_{base32_encode(package_name).to_lowercase()}@{version}/node_modules/<package-name>
```

Within node_modules folder:

```
node_modules/<package-name>
```

So, direct childs of the node_modules folder can have collisions between
packages like `JSON` vs `json`, but this is already something npm itself
doesn't handle well. Plus, Deno doesn't actually ever resolve to the
`node_modules/<package-name>` folder, but just has that for
compatibility. Additionally, packages in the `.deno` dir could have
collissions if they have multiple dependencies that only differ in
casing or a dependency that has different casing, but if someone is
doing that then they're already going to have trouble with npm and they
are asking for trouble in general.
2022-11-16 18:44:31 +00:00
Yoshiya Hinosawa
1d85c25205
fix(ext/webstorage): make web storages re-assignable (#16661) 2022-11-17 02:12:58 +09:00
Bartek Iwańczuk
300fd07fad
fix(npm): don't fail if conditional exports don't contains types (#16651)
If resolving types for an npm package, we didn't find "types" entry in 
the conditional exports declaration we were falling-through to regular 
resolution, instead of short-circuiting and giving up on resolving
types, which might lead to unwarranted errors.

Closes https://github.com/denoland/deno/issues/16649
2022-11-16 01:40:03 +01:00
Bartek Iwańczuk
7aa8e9c035
test: don't use remote std for tests (#16631) 2022-11-15 17:21:25 +01:00
Bartek Iwańczuk
c1cb4d6a8d
test: don't use lock file in JSX tests (#16639) 2022-11-15 17:20:40 +01:00
Bartek Iwańczuk
f2bf40d157
fix(npm): probing for files that have a file stem (#16641) 2022-11-15 13:58:04 +01:00
David Sherret
191f4f16ad
fix(bundle): explicit error when using an npm specifier with deno bundle (#16637) 2022-11-14 19:55:08 -05:00
Leo Kettmeir
52dc3ef1a4
feat(unstable): "Deno.Command()" API (#16516)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-11-13 14:00:24 -05:00
David Sherret
2063ed7385
feat(npm): require --unstable for npm specifiers in remote modules (#16612) 2022-11-13 10:42:15 -05:00
Yoshiya Hinosawa
336e96a114
fix(ext/flash): revert #16383 (graceful server startup/shutdown) (#16610)
#16383 made some of Node compat test cases flaky in deno_std (and when
it fails it causes segfaults).

See https://github.com/denoland/deno_std/issues/2882 for details
2022-11-13 17:35:28 +09:00
Bartek Iwańczuk
06bd9e9e16
fix(npm): disable npm specifiers in import.meta.resolve() (#16599) 2022-11-11 18:20:13 +01:00
David Sherret
8dc242f789
perf: more efficient deno cache and npm package info usage (#16592)
1. There was a lot of cloning going on with `NpmPackageInfo`. This is
now stored in an `Arc<NpmPackageInfo>` and cloning only happens on the
individual version.
2. The package cache is now cleared from memory after resolution.
3. This surfaced a bug in `deno cache` and I noticed it can be more
efficient if we have multiple root specifiers if we provide all the
specifiers as roots.
2022-11-11 11:33:57 -05:00
Bartek Iwańczuk
7f0546a6b7
fix(npm): remove forgotten unstable check (#16598) 2022-11-11 17:04:57 +01:00
Divy Srivastava
ff92febb38
fix(ext/flash): graceful server startup/shutdown (#16383)
Fixes https://github.com/denoland/deno/issues/16267

Co-authored-by: Yusuke Tanaka <yusuktan@maguro.dev>
2022-11-11 19:11:52 +05:30
Bartek Iwańczuk
5be8c96ae8
feat: Stabilize Deno.bench() and 'deno bench' subcommand (#16485) 2022-11-11 00:22:14 +01:00
Bartek Iwańczuk
79aa3124a8
test: update lockfile for tests (#16591) 2022-11-10 23:11:38 +01:00
Bartek Iwańczuk
8d5c0112fb
feat: don't require --unstable flag for npm programs (#16520)
This PR adds copies of several unstable APIs that are available
in "Deno[Deno.internal].nodeUnstable" namespace.

These copies do not perform unstable check (ie. don't require
"--unstable" flag to be present). Otherwise they work exactly
the same, including permission checks.

These APIs are not meant to be used by users directly and
can change at any time.

Copies of following APIs are available in that namespace:
- Deno.spawnChild
- Deno.spawn
- Deno.spawnSync
- Deno.serve
- Deno.upgradeHttpRaw
- Deno.listenDatagram
2022-11-10 22:03:28 +01:00
Bartek Iwańczuk
53e974b276
feat: remove --unstable flag requirement for npm: specifiers (#16473)
This commit makes "npm:" specifiers not require "--unstable" flag.
At the moment some APIs used by Node polyfills still require
"--unstable" which will be addressed in follow up PRs.
2022-11-10 17:57:10 +01:00